Comparing version 4.4.2 to 4.5.0
@@ -211,2 +211,9 @@ const Strategy = require('@tangle/strategy') | ||
opts.groupId | ||
? pull.filter(msg => ( | ||
msg.value.content.recps && | ||
msg.value.content.recps[0] === opts.groupId | ||
)) | ||
: null, | ||
// map rootMsg => record (and filter out the ones which were junk) | ||
@@ -213,0 +220,0 @@ pull.asyncMap( |
{ | ||
"name": "ssb-crut", | ||
"version": "4.4.2", | ||
"version": "4.5.0", | ||
"description": "easy CRUT methods for secure scuttlebutt", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -300,3 +300,3 @@ # ssb-crut | ||
## crut.list(opts, cb) | ||
### crut.list(opts, cb) | ||
@@ -308,2 +308,5 @@ List all records (or some subset) of this crut type from your database. | ||
- `opts.filter` *Function* - apply a filter to records being returned (is given a full `record`) | ||
- `opts.groupId` *GroupId* (a String) | ||
- a convenience filter which only allows records published to a particular group | ||
- NOTE - not yet available for `ssb-db2` | ||
- `opts.orderBy` *String* | ||
@@ -334,3 +337,3 @@ - define what order to pull the records in by, looks at the times recorded on the **initial message** of the record. | ||
### Using spec.arbitraryRoot with Private Groups | ||
## Using spec.arbitraryRoot with Private Groups | ||
@@ -348,8 +351,1 @@ If you set `spec.arbitraryRoot` to true, then you can use a `groupId` that you're a part of and `ssb-crut` | ||
Reminder there is no `crut.create` when you have an `arbitraryRoot` | ||
--- | ||
## TODO | ||
- Show user error message caused by failed merge | ||
const test = require('tape') | ||
const Overwrite = require('@tangle/overwrite') | ||
const { promisify } = require('util') | ||
@@ -21,5 +22,5 @@ const { SSB, replicate } = require('./helpers') | ||
// meanwhile I publish a bunch of records | ||
const me = SSB() | ||
const me = SSB({ tribes: !process.env.DB2 }) | ||
const crut = new CRUT(me, spec) | ||
const create = (name) => crut.create({ name }) | ||
const create = (name, recps) => crut.create({ name, recps }) | ||
@@ -133,2 +134,14 @@ await create(1) | ||
if (!process.env.DB2) { | ||
/* opts.groupId */ | ||
const { groupId } = await promisify(me.tribes.create)({}) | ||
await create(4, [groupId]) | ||
list = await crut.list({ groupId }) | ||
t.deepEqual( | ||
list.map(record => record.name), | ||
[4], | ||
'opts.groupId' | ||
) | ||
} | ||
me.close() | ||
@@ -135,0 +148,0 @@ friend.close() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
120016
3444
348
9