Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 11:25
    mrzmyr opened #1174
  • 09:00
    Emad-salah commented #1170
  • 06:47
    amark commented #1170
  • 06:47
    amark closed #1155
  • 06:47

    amark on master

    YSON Fixes (#1170) * Rewrite Y… (compare)

  • 06:47
    amark closed #1170
  • Dec 07 20:20
    mmalmi updated the wiki
  • Dec 06 21:19
    resession updated the wiki
  • Dec 06 21:18
    resession updated the wiki
  • Dec 06 21:16
    resession updated the wiki
  • Dec 06 21:15
    resession updated the wiki
  • Dec 06 14:56
    capitalistdog commented #1074
  • Dec 06 14:52
    noctisatrae commented #1074
  • Dec 06 14:46
    noctisatrae commented #1074
  • Dec 06 14:30
    KenEucker commented #1074
  • Dec 06 14:28
    noctisatrae commented #1074
  • Dec 06 13:57
    KenEucker commented #1074
  • Dec 06 13:18
    noctisatrae commented #1074
  • Dec 03 11:56
    Emad-salah commented #1170
  • Dec 03 11:50
    Emad-salah synchronize #1170
Jabis Sevon
@jabis
Tested also with prefix
testing get {'.':{'*':'2021/06'} expecting 6 output
mapfn Map functions are experimental, their behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
getter found data {
  _: { '#': 'chat.-ipfkim', '>': { stuff: 1632566761312 } },
  stuff: '22'
}
ok 1 expected result to be `22` correct
getter found data {
  _: { '#': 'chat.-oi86lk', '>': { stuff: 1632566761313.002 } },
  stuff: '23'
}
ok 2 expected result to be `23` correct
getter found data {
  _: { '#': 'chat.-ug9s0o', '>': { stuff: 1632566761314.001 } },
  stuff: '24'
}
ok 3 expected result to be `24` correct
getter found data {
  _: { '#': 'chat.-1492e3m', '>': { stuff: 1632566761315 } },
  stuff: '25'
}
ok 4 expected result to be `25` correct
getter found data {
  _: { '#': 'chat.1tg6rqc', '>': { stuff: 1632566761315.004 } },
  stuff: '31 1.00'
}
ok 5 expected result to be `31 1.00` correct
getter found data {
  _: { '#': 'chat.1tirdef', '>': { stuff: 1632566761315.008 } },
  stuff: '31 1.30'
}
ok 6 expected result to be `31 1.30` correct
valonce Chainable val is experimental, its behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
# force test to end
ok 7 forcing test to end with process.exit

1..7
# tests 7
# pass  7

# ok
this time set up else also which should've failed if there was extra data
var raddy = gun.get(key).get({'.':{'*':'2021/06'},'%':50000}).map(data=>{
    i++;
    console.log("getter found data",data);

    if(i==2) { t.equal(data.stuff, "22", "expected result to be `22` correct") 
    } else if(i==3) { t.equal(data.stuff, "23", "expected result to be `23` correct")
    } else if(i==4) { t.equal(data.stuff, "24", "expected result to be `24` correct")
    } else if(i==5) { t.equal(data.stuff, "25", "expected result to be `25` correct")
    } else if(i==6) { t.equal(data.stuff, "31 1.00", "expected result to be `31 1.00` correct")
    } else if(i==7) { t.equal(data.stuff, "31 1.30", "expected result to be `31 1.30` correct")
    } else { t.equal(data.stuff, "we shouldn't be here"); }
  }).once();
Adam Bowman
@abow
anyone else see certify() break when updating gun from 0.2020.1234 to 0.2020.1235 ?
1 reply
Jabis Sevon
@jabis
also dropped the bytes to 5000 same results
Wasis Haryo Sasoko
@yokowasis
@jabis I mean your json data.

here is my complete data

{
  "2019/05/25:10:10:10.30": {
    "#": "chat/2019/05/25:10:10:10.30"
  },
  "2019/05/21:10:10:10.30": {
    "#": "chat/2019/05/21:10:10:10.30"
  },
  "2019/05/22:10:10:10.30": {
    "#": "chat/2019/05/22:10:10:10.30"
  },
  "2019/05/23:10:10:10.30": {
    "#": "chat/2019/05/23:10:10:10.30"
  },
  "2019/06/23:10:10:10.30": {
    "#": "chat/2019/06/23:10:10:10.30"
  },
  "2019/06/21:10:10:10.30": {
    "#": "chat/2019/06/21:10:10:10.30"
  },
  "2019/06/22:10:10:10.30": {
    "#": "chat/2019/06/22:10:10:10.30"
  },
  "2019/06/24:10:10:10.30": {
    "#": "chat/2019/06/24:10:10:10.30"
  },
  "2019/06/25:10:10:10.30": {
    "#": "chat/2019/06/25:10:10:10.30"
  },
  "2019/06/20:10:10:10.30": {
    "#": "chat/2019/06/20:10:10:10.30"
  },
  "2019/05": {
    "#": "chat/2019/05"
  }
}

like this

Jabis Sevon
@jabis
I pasted it already above
'2021/05/31': { '#': 'chat.102jvom' },
'2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
'2021/06/23 01:30:00': { '#': 'chat.-oi86lk' },
'2021/06/24 01:00:00': { '#': 'chat.-ug9s0o' },
'2021/06/25 01:30:00': { '#': 'chat.-1492e3m' },
'2021/06/31 01:00:00': { '#': 'chat.1tg6rqc' },
'2021/06/31 01:30:00': { '#': 'chat.1tirdef' }
Wasis Haryo Sasoko
@yokowasis
@jabis can you add one more data with key 2021/06
and try to rerun your test > : 2021/06
and * : 2021/06
Jabis Sevon
@jabis
testing get {'.':{'>':'2021/06'} expecting 7 outputs
mapfn Map functions are experimental, their behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
getter found data {
  _: { '#': 'chat.-1b4get8', '>': { stuff: 1632567525735 } },
  stuff: '2021/06'
}
ok 1 expected result to be `2021/06` correct
getter found data {
  _: { '#': 'chat.-ipfkim', '>': { stuff: 1632567525904 } },
  stuff: '22'
}
ok 2 expected result to be `22` correct
getter found data {
  _: { '#': 'chat.-oi86lk', '>': { stuff: 1632567525905.003 } },
  stuff: '23'
}
ok 3 expected result to be `23` correct
getter found data {
  _: { '#': 'chat.-ug9s0o', '>': { stuff: 1632567525906.002 } },
  stuff: '24'
}
ok 4 expected result to be `24` correct
getter found data {
  _: { '#': 'chat.-1492e3m', '>': { stuff: 1632567525907.002 } },
  stuff: '25'
}
ok 5 expected result to be `25` correct
getter found data {
  _: { '#': 'chat.1tg6rqc', '>': { stuff: 1632567525907.006 } },
  stuff: '31 1.00'
}
ok 6 expected result to be `31 1.00` correct
getter found data {
  _: { '#': 'chat.1tirdef', '>': { stuff: 1632567525908 } },
  stuff: '31 1.30'
}
ok 7 expected result to be `31 1.30` correct
valonce Chainable val is experimental, its behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
# force test to end
ok 8 forcing test to end with process.exit

1..8
# tests 8
# pass  8

# ok
and
testing get {'.':{'*':'2021/06'} expecting 7 outputs
mapfn Map functions are experimental, their behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
getter found data {
  _: { '#': 'chat.-1b4get8', '>': { stuff: 1632567559855 } },
  stuff: '2021/06'
}
ok 1 expected result to be `2021/06` correct
getter found data {
  _: { '#': 'chat.-ipfkim', '>': { stuff: 1632567559960 } },
  stuff: '22'
}
ok 2 expected result to be `22` correct
getter found data {
  _: { '#': 'chat.-oi86lk', '>': { stuff: 1632567559960.004 } },
  stuff: '23'
}
ok 3 expected result to be `23` correct
getter found data {
  _: { '#': 'chat.-ug9s0o', '>': { stuff: 1632567559961.003 } },
  stuff: '24'
}
ok 4 expected result to be `24` correct
getter found data {
  _: { '#': 'chat.-1492e3m', '>': { stuff: 1632567559962.002 } },
  stuff: '25'
}
ok 5 expected result to be `25` correct
getter found data {
  _: { '#': 'chat.1tg6rqc', '>': { stuff: 1632567559962.006 } },
  stuff: '31 1.00'
}
ok 6 expected result to be `31 1.00` correct
getter found data {
  _: { '#': 'chat.1tirdef', '>': { stuff: 1632567559963.002 } },
  stuff: '31 1.30'
}
ok 7 expected result to be `31 1.30` correct
valonce Chainable val is experimental, its behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
# force test to end
ok 8 forcing test to end with process.exit

1..8
# tests 8
# pass  8

# ok
Object was
_: {
    '#': 'chat',
    '>': {
      '2021/06': 1632567559855,
      '2021/06/22 01:00:00': 1632567559960,
      '2021/06/23 01:30:00': 1632567559960.004,
      '2021/06/24 01:00:00': 1632567559961.003,
      '2021/06/25 01:30:00': 1632567559962.002,
      '2021/06/31 01:00:00': 1632567559962.006,
      '2021/06/31 01:30:00': 1632567559963.002
    }
  },
  '2021/06': { '#': 'chat.-1b4get8' },
  '2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
  '2021/06/23 01:30:00': { '#': 'chat.-oi86lk' },
  '2021/06/24 01:00:00': { '#': 'chat.-ug9s0o' },
  '2021/06/25 01:30:00': { '#': 'chat.-1492e3m' },
  '2021/06/31 01:00:00': { '#': 'chat.1tg6rqc' },
  '2021/06/31 01:30:00': { '#': 'chat.1tirdef' }
}
Wasis Haryo Sasoko
@yokowasis

let me rephrase my quesiton :
imagine this is the data

'2021/05/31': { '#': 'chat.102jvom' },
'2021/05/30 01:00:00': { '#': 'chat.-ipfkim' },
'2021/05/29 01:00:00': { '#': 'chat.-ipfkim' },
'2021/05/28 01:00:00': { '#': 'chat.-ipfkim' },
'2021/05': { '#': 'chat.-ipfkim' },
'2021/06': { '#': 'chat.-ipfkim' },
'2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
'2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
'2021/06/23 01:30:00': { '#': 'chat.-oi86lk' },
'2021/06/24 01:00:00': { '#': 'chat.-ug9s0o' },
'2021/06/25 01:30:00': { '#': 'chat.-1492e3m' },
'2021/06/31 01:00:00': { '#': 'chat.1tg6rqc' },
'2021/06/31 01:30:00': { '#': 'chat.1tirdef' }

What's the query to get

'2021/06': { '#': 'chat.-ipfkim' },
'2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
'2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
'2021/06/23 01:30:00': { '#': 'chat.-oi86lk' },
'2021/06/24 01:00:00': { '#': 'chat.-ug9s0o' },
'2021/06/25 01:30:00': { '#': 'chat.-1492e3m' },
'2021/06/31 01:00:00': { '#': 'chat.1tg6rqc' },
'2021/06/31 01:30:00': { '#': 'chat.1tirdef' }
Jabis Sevon
@jabis
lemme add the 2021/05 back in :)
>2021/06 would result in anything over 2021/06
 _: {
    '#': 'chat',
    '>': {
      '2021/05': 1632567792690,
      '2021/06': 1632567792795,
      '2021/06/22 01:00:00': 1632567792796.002,
      '2021/06/23 01:30:00': 1632567792796.006,
      '2021/06/24 01:00:00': 1632567792797.002,
      '2021/06/25 01:30:00': 1632567792798.002,
      '2021/06/31 01:00:00': 1632567792798.006,
      '2021/06/31 01:30:00': 1632567792799.001
    }
  },
  '2021/05': { '#': 'chat.-1b4get9' },
  '2021/06': { '#': 'chat.-1b4get8' },
  '2021/06/22 01:00:00': { '#': 'chat.-ipfkim' },
  '2021/06/23 01:30:00': { '#': 'chat.-oi86lk' },
  '2021/06/24 01:00:00': { '#': 'chat.-ug9s0o' },
  '2021/06/25 01:30:00': { '#': 'chat.-1492e3m' },
  '2021/06/31 01:00:00': { '#': 'chat.1tg6rqc' },
  '2021/06/31 01:30:00': { '#': 'chat.1tirdef' }
}
total dataset
and still passing
testing get {'.':{'*':'2021/06'} expecting 7 outputs
mapfn Map functions are experimental, their behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
getter found data {
  _: { '#': 'chat.-1b4get8', '>': { stuff: 1632567792795 } },
  stuff: '2021/06'
}
ok 1 expected result to be `2021/06` correct
getter found data {
  _: { '#': 'chat.-ipfkim', '>': { stuff: 1632567792796.002 } },
  stuff: '22'
}
ok 2 expected result to be `22` correct
getter found data {
  _: { '#': 'chat.-oi86lk', '>': { stuff: 1632567792796.006 } },
  stuff: '23'
}
ok 3 expected result to be `23` correct
getter found data {
  _: { '#': 'chat.-ug9s0o', '>': { stuff: 1632567792797.002 } },
  stuff: '24'
}
ok 4 expected result to be `24` correct
getter found data {
  _: { '#': 'chat.-1492e3m', '>': { stuff: 1632567792798.002 } },
  stuff: '25'
}
ok 5 expected result to be `25` correct
getter found data {
  _: { '#': 'chat.1tg6rqc', '>': { stuff: 1632567792798.006 } },
  stuff: '31 1.00'
}
ok 6 expected result to be `31 1.00` correct
getter found data {
  _: { '#': 'chat.1tirdef', '>': { stuff: 1632567792799.001 } },
  stuff: '31 1.30'
}
ok 7 expected result to be `31 1.30` correct
valonce Chainable val is experimental, its behavior and API may change moving forward. Please play with it and report bugs and ideas on how to improve it.
# force test to end
ok 8 forcing test to end with process.exit

1..8
no 2021/05 in the hoods
also with "*" prefixed it's returning correctly only 2021/06
why don't you try it yourself
Jabis Sevon
@jabis
not many requirements
const fs = require('fs');
const tape = require('tape');
const _test = require('tape-promise').default // <---- notice 'default'
const test = _test(tape) // decorate tape
const Gun = require('../gun')
const SEA = require('../gun/sea')
require('../gun/lib/then.js')
require('../gun/lib/promise.js')
const RAD = require('../gun/lib/radisk.js')
const mkdirp = require('mkdirp');
const { Random } = require('random-js');
const random = new Random();
const _ = require('lodash');
const sleep = (milliseconds) => {
  return new Promise(resolve => setTimeout(resolve, milliseconds))
}
Gun.log.once=function(...args){ console.log(...args)}
tape tape-promise random-js mkdirp and lodash
tho I'm not really sure all of those are even required, maybe they were - long ass time since I used it since now :D
Wasis Haryo Sasoko
@yokowasis
ok, it works. it's the bug acting up. @jabis some callback is refused to fired.
it's frustating. Any idea what caused it ?
my complete html
<!DOCTYPE html>
<html lang="en" translate="no">
  <head>
    <title>PEERJS TS</title>

    <script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/gun/sea.js"></script>    
    <script src="https://cdn.jsdelivr.net/npm/gun/lib/radix.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/gun/lib/radisk.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/gun/lib/store.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/gun/lib/rindexed.js"></script>    
    <script src="https://unpkg.com/peerjs@1.3.1/dist/peerjs.min.js"></script>
    <script>
        var peer = new Peer(); 
        peer.on('open',(s)=>{
            console.log (s);
        })
        peer.on('connection', function(conn) {
            conn.on('data', function(data){
                // Will print 'hi!'
                console.log(data);
            });
        });        

        const gun = Gun({
                    localStorage : false,
                    axe : false,
                    file : "test",
                })
        const gunHeroku = Gun({
                    localStorage : false,
                    axe : false,
                    file : "test",
                    peers : [
                        "https://fire-gun.herokuapp.com/gun"
                    ]
                })
    </script>

  </head>
  <body>
      PEERJS TEST
  </body>
</html>
Jabis Sevon
@jabis
one thing in your constructor invalid peer it should be peers
Wasis Haryo Sasoko
@yokowasis

for some unknown reason after I commenting out the put the once callback only fired 1 out of 7

@jabis thanks. Fixed it. but still the same. Tried with peers and local, same result.

@jabis can you connect to peers https://fire-gun.herokuapp.com/gun and run this command
gunHeroku.get('chat2').get({'.': {'*': '2021/06'}}).map().once(s=>{
  console.log (s);
})
Jabis Sevon
@jabis

@jabis can you connect to peers https://fire-gun.herokuapp.com/gun and run this command

gunHeroku.get('chat2').get({'.': {'*': '2021/06'}}).map().once(s=>{
  console.log (s);
})

Well, I expected undefined and got undefined lol

writing to ./testdb/ef9oOX406VUVK0IE.json
testing get {'.': {'*': '2021/06'}} expecting output
data undefined
ok 1 s was undefined
# force test to end
ok 2 forcing test to end with process.exit

1..2
# tests 2
# pass  2

# ok
Wasis Haryo Sasoko
@yokowasis
@jabis try it again
gun only allocated i think 30ms to fetch the data before returning undefined.
Jabis Sevon
@jabis
Ok this works, first fetching the parent object
console.log("testing get {'.': {'*': '2021/06'}} expecting output")
  await gun.get('chat2').then();  
  await gun.get('chat2').get({'.': {'>': '2021/06'}}).map().once(s=>{
    console.log ("data",s);
    t.notEqual(s,undefined,"s was not undefined");
  }).then()
I think that was a known bug
testing get {'.': {'*': '2021/06'}} expecting output
data { _: { '#': 'chat2/2021/06/25 01:30:00' } }
ok 1 s was not undefined
data { _: { '#': 'chat2/2021/06/31 01:00:00' } }
ok 2 s was not undefined
data { _: { '#': 'chat2/2021/06/31 01:30:00' } }
ok 3 s was not undefined
data { _: { '#': 'chat2/2021/06' } }
ok 4 s was not undefined
data { _: { '#': 'chat2/2021/06/22 01:00:00' } }
ok 5 s was not undefined
data { _: { '#': 'chat2/2021/06/23 01:30:00' } }
ok 6 s was not undefined
data { _: { '#': 'chat2/2021/06/24 01:00:00' } }
ok 7 s was not undefined
# force test to end
ok 8 forcing test to end with process.exit

1..8
# tests 8
# pass  8

# ok
Wasis Haryo Sasoko
@yokowasis
@jabis does that mean you have to fetch all the data first ? if possible I want to fetch only the data I need.
Jabis Sevon
@jabis
I'd say you only need to trigger a query first
fetching the parent "chat" -object once won't fetch all data I think, only one level
Wasis Haryo Sasoko
@yokowasis
if this is a chat app, 1 level can easily have 1000 entries.
Jabis Sevon
@jabis
add some metadata node that doesn't have anything interesting
Gessic
@gessicapps_twitter
Hi, how do I set something to null? everytime I try, it just adds a new entry/node:
feedProviders.get(providerAddress.Algaddress).set(null);
image.png
Wasis Haryo Sasoko
@yokowasis
@gunar put(null)
@gessicapps_twitter put(null)
Gessic
@gessicapps_twitter
Perfect, thanks @yokowasis
Gessic
@gessicapps_twitter
how can I return the values from .once() without using a callback? It doesnt seem to be an async function...