@interop/was-client 0.34.0 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -0
- package/dist/Collection.d.ts +172 -1
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +368 -2
- package/dist/Collection.js.map +1 -1
- package/dist/codec.d.ts +101 -3
- package/dist/codec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.d.ts +38 -4
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +318 -54
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/docCipher.d.ts +4 -3
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +17 -17
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/hmacKey.d.ts +76 -0
- package/dist/edv/hmacKey.d.ts.map +1 -0
- package/dist/edv/hmacKey.js +105 -0
- package/dist/edv/hmacKey.js.map +1 -0
- package/dist/edv/index.d.ts +7 -0
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/edv/index.js +6 -0
- package/dist/edv/index.js.map +1 -1
- package/dist/edv/recipients.d.ts +22 -3
- package/dist/edv/recipients.d.ts.map +1 -1
- package/dist/edv/recipients.js +197 -21
- package/dist/edv/recipients.js.map +1 -1
- package/dist/errors.d.ts +20 -10
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +24 -14
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/codec.d.ts.map +1 -1
- package/dist/internal/codec.js +64 -3
- package/dist/internal/codec.js.map +1 -1
- package/dist/internal/content.d.ts +12 -0
- package/dist/internal/content.d.ts.map +1 -1
- package/dist/internal/content.js +18 -0
- package/dist/internal/content.js.map +1 -1
- package/dist/internal/indexSchema.d.ts +95 -0
- package/dist/internal/indexSchema.d.ts.map +1 -0
- package/dist/internal/indexSchema.js +120 -0
- package/dist/internal/indexSchema.js.map +1 -0
- package/dist/internal/paths.d.ts +6 -0
- package/dist/internal/paths.d.ts.map +1 -1
- package/dist/internal/paths.js +8 -0
- package/dist/internal/paths.js.map +1 -1
- package/dist/paths.d.ts +1 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +1 -1
- package/dist/paths.js.map +1 -1
- package/dist/sync/index.d.ts +9 -5
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +9 -5
- package/dist/sync/index.js.map +1 -1
- package/dist/types.d.ts +40 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
- [Revoking a capability](#revoking-a-capability)
|
|
21
21
|
- [Public sharing and access-control policies](#public-sharing-and-access-control-policies)
|
|
22
22
|
- [Resource metadata](#resource-metadata)
|
|
23
|
+
- [Collection metadata](#collection-metadata)
|
|
23
24
|
- [Conditional writes (optimistic concurrency)](#conditional-writes-optimistic-concurrency)
|
|
24
25
|
- [Storage introspection: backends and quotas](#storage-introspection-backends-and-quotas)
|
|
25
26
|
- [Registering a Bring-Your-Own-Storage backend](#registering-a-bring-your-own-storage-backend)
|
|
@@ -243,6 +244,11 @@ await collection.delete() // deletes the whole collection; idempotent
|
|
|
243
244
|
To delete a single resource instead of the whole collection, use
|
|
244
245
|
`collection.resource(id).delete()`.
|
|
245
246
|
|
|
247
|
+
The Description's `name` is server-visible plaintext. An encrypted collection
|
|
248
|
+
leaves it unpopulated by convention and carries its name and tags on the
|
|
249
|
+
[Collection metadata](#collection-metadata) surface instead, where they are
|
|
250
|
+
encrypted.
|
|
251
|
+
|
|
246
252
|
An application that provisions a collection can record who it was provisioned
|
|
247
253
|
for, with the optional `generator` (the application's DID) and `generatorOrigin`
|
|
248
254
|
(the Web origin that DID was bound to) description fields. Both are accepted at
|
|
@@ -462,6 +468,39 @@ await resource.setTags({ status: 'verified' }) // keeps existing name
|
|
|
462
468
|
The `custom.name` is the same value surfaced as a resource's `name` in
|
|
463
469
|
collection listings; updating one updates the other.
|
|
464
470
|
|
|
471
|
+
### Collection metadata
|
|
472
|
+
|
|
473
|
+
A Collection has the same metadata surface at its own reserved `/meta` path:
|
|
474
|
+
server-managed properties (`createdAt` / `updatedAt` / `createdBy`) plus a
|
|
475
|
+
user-writable `custom` object (`name` and `tags`). A server without the endpoint
|
|
476
|
+
surfaces its 501 as `NotImplementedError`.
|
|
477
|
+
|
|
478
|
+
```ts
|
|
479
|
+
const meta = await collection.meta() // CollectionMetadata | null (null on a miss)
|
|
480
|
+
|
|
481
|
+
// setMeta() is a full replacement of `custom`; omitted properties are cleared.
|
|
482
|
+
await collection.setMeta({ custom: { name: 'Vault', tags: { app: 'wallet' } } })
|
|
483
|
+
|
|
484
|
+
// setName() / setTags() are read-modify-write sugar that preserve the other.
|
|
485
|
+
await collection.setName('Renamed vault') // keeps existing tags
|
|
486
|
+
await collection.setTags({ app: 'wallet' }) // keeps existing name
|
|
487
|
+
|
|
488
|
+
// Conditional metadata write, against a `conditional-writes` backend.
|
|
489
|
+
await collection.setMeta({ custom: { name: 'Vault' } }, { ifMatch: meta?.etag })
|
|
490
|
+
// ...or write only if no metadata is set yet:
|
|
491
|
+
await collection.setMeta({ custom: { name: 'Vault' } }, { ifNoneMatch: true })
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
A failed precondition throws `PreconditionFailedError` (412). This `/meta` ETag
|
|
495
|
+
(`metaVersion`) is versioned independently of the Collection Description's ETag
|
|
496
|
+
and of every Resource's versions: writing one never bumps the other.
|
|
497
|
+
|
|
498
|
+
On an encrypted collection `custom` is encrypted into an envelope before it is
|
|
499
|
+
sent, so `name` / `tags` are never stored as server-visible plaintext, and
|
|
500
|
+
`meta()` decrypts them back for a keyed reader. This is the encrypted
|
|
501
|
+
collection's name/tags surface: by convention the plaintext Description `name`
|
|
502
|
+
is left unpopulated there.
|
|
503
|
+
|
|
465
504
|
### Conditional writes (optimistic concurrency)
|
|
466
505
|
|
|
467
506
|
Against a backend that advertises the `conditional-writes` feature (see below),
|
|
@@ -678,11 +717,84 @@ scope for now):
|
|
|
678
717
|
encrypted into an envelope before it is sent, so the server never sees the
|
|
679
718
|
plaintext, and `meta()` decrypts it back for a keyed reader. The `/meta`
|
|
680
719
|
endpoint has its own ETag (`metaVersion`), independent of the content ETag.
|
|
720
|
+
The same pair at Collection level (`collection.setName()` / `setTags()` /
|
|
721
|
+
`setMeta()` / `meta()`) is where an encrypted collection carries its own name
|
|
722
|
+
and tags, since the Description's plaintext `name` is left unpopulated; the
|
|
723
|
+
collection-level envelope binds no resource id, and a resource-bound envelope
|
|
724
|
+
served into that slot is refused.
|
|
681
725
|
- **Binary.** A small `Blob`/`Uint8Array` is encrypted as a single document;
|
|
682
726
|
larger binaries are rejected until chunked encrypted blobs land.
|
|
683
727
|
- **Raw reads.** `get()` decrypts; the `getText()` / `getBytes()` escape hatches
|
|
684
728
|
do not (they return the stored representation).
|
|
685
729
|
|
|
730
|
+
#### Searching an encrypted collection
|
|
731
|
+
|
|
732
|
+
An encrypted collection can be searched by attribute without the server ever
|
|
733
|
+
learning the attribute names or their values: the client blinds both into HMAC
|
|
734
|
+
tokens (equal plaintext blinds to equal tokens, and nothing else), stores them
|
|
735
|
+
alongside the ciphertext, and blinds the query the same way. The server compares
|
|
736
|
+
opaque strings.
|
|
737
|
+
|
|
738
|
+
The blinding key is installed with the collection's first key epoch or never --
|
|
739
|
+
retro-fitting one would leave every already-written document unindexed -- so ask
|
|
740
|
+
for it at provisioning time:
|
|
741
|
+
|
|
742
|
+
```ts
|
|
743
|
+
await ensureFirstEpoch({
|
|
744
|
+
collection: declared,
|
|
745
|
+
recipients: [ownerRecipient({ keyAgreementKey })],
|
|
746
|
+
blindedIndex: true // searchable: a property fixed at birth
|
|
747
|
+
})
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
Then declare what is searchable and search it:
|
|
751
|
+
|
|
752
|
+
```ts
|
|
753
|
+
const vault = was.space(spaceId).collection('vault')
|
|
754
|
+
await vault.declareIndex({ attribute: 'content.type' })
|
|
755
|
+
|
|
756
|
+
await vault.add({ type: 'note', title: 'alpha' })
|
|
757
|
+
|
|
758
|
+
const page = await vault.find({ equals: { 'content.type': 'note' } })
|
|
759
|
+
// { items: [{ id, data: { type: 'note', title: 'alpha' } }], hasMore: false }
|
|
760
|
+
|
|
761
|
+
const { count } = await vault.find({
|
|
762
|
+
equals: { 'content.type': 'note' },
|
|
763
|
+
count: true
|
|
764
|
+
})
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
Attribute names are dotted paths rooted at `content` or `meta` (the document's
|
|
768
|
+
own `meta`, which carries the content type and encoding -- not the WAS `/meta`
|
|
769
|
+
name/tags, which live in a separate envelope and are deliberately not indexed).
|
|
770
|
+
Pass an array of names for a compound index, searchable by a leading prefix of
|
|
771
|
+
its attributes; `unique: true` makes the server answer a colliding write with
|
|
772
|
+
`409`. Give `find()` either `equals` (an array of objects is an OR of
|
|
773
|
+
alternatives) or `has` (attribute names a document must carry); page with
|
|
774
|
+
`limit` and the returned `cursor`.
|
|
775
|
+
|
|
776
|
+
Two properties are worth planning around:
|
|
777
|
+
|
|
778
|
+
- **Declarations are collection state, not app state.** The schema is persisted
|
|
779
|
+
inside the collection's encrypted metadata envelope, so any recipient
|
|
780
|
+
discovers it -- read it with `collection.indexes()`. That is what lets an app
|
|
781
|
+
granted access to an existing collection learn what is queryable; the stored
|
|
782
|
+
tokens cannot teach it, being blinded. Concurrent declarations reconcile
|
|
783
|
+
through the metadata ETag rather than overwriting each other.
|
|
784
|
+
- **Declarations are prospective.** A document written before an attribute was
|
|
785
|
+
declared carries no token for it and does not match until it is rewritten
|
|
786
|
+
(each entry's `addedIn` revision records when it became searchable). Searching
|
|
787
|
+
an attribute the schema does not declare throws `ValidationError` rather than
|
|
788
|
+
silently matching nothing.
|
|
789
|
+
|
|
790
|
+
Requires the collection's backend to advertise `blinded-index-query`; a backend
|
|
791
|
+
without it answers `501` (`NotImplementedError`). `find()` / `declareIndex()` on
|
|
792
|
+
a plaintext collection throw -- there is no client-side index there.
|
|
793
|
+
|
|
794
|
+
Note that `collection.setMeta({ custom })` replaces the whole `custom` object,
|
|
795
|
+
schema included; the `setName()` / `setTags()` sugar merges instead and leaves
|
|
796
|
+
it intact.
|
|
797
|
+
|
|
686
798
|
### Cross-replica sync
|
|
687
799
|
|
|
688
800
|
The opt-in `@interop/was-client/sync` subpath supplies everything a wallet needs
|
package/dist/Collection.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ClientContext } from './internal/request.js';
|
|
2
|
+
import type { IndexDeclaration, IndexSchema } from './codec.js';
|
|
2
3
|
import { Resource } from './Resource.js';
|
|
3
4
|
import type { ChangesCheckpoint, ChangesPage } from '@interop/storage-core';
|
|
4
|
-
import type { AddResult, BackendDescriptor, BackendUsage, CollectionDescription, CollectionWritableFields, EncryptionOverride, GrantOptions, HandleOptions, IDelegatedZcap, IZcap, Json, ResourceData, LinkSet, PolicyDocument, CollectionResourcesList, ResourceSummary } from './types.js';
|
|
5
|
+
import type { AddResult, BackendDescriptor, BackendUsage, CollectionDescription, CollectionMetadata, CollectionWritableFields, EncryptionOverride, FindPage, GrantOptions, HandleOptions, IDelegatedZcap, IZcap, Json, ResourceData, LinkSet, PolicyDocument, CollectionResourcesList, ResourceMetadataCustom, ResourceSummary } from './types.js';
|
|
5
6
|
export declare class Collection {
|
|
6
7
|
#private;
|
|
7
8
|
readonly spaceId: string;
|
|
@@ -105,6 +106,176 @@ export declare class Collection {
|
|
|
105
106
|
* @returns {Promise<void>}
|
|
106
107
|
*/
|
|
107
108
|
delete(): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* Reads the Collection's metadata object (server-managed timestamps,
|
|
111
|
+
* `createdBy` and the encrypted-`custom` key `epoch`, plus the user-writable
|
|
112
|
+
* `custom` object). Returns `null` if the collection is missing or not
|
|
113
|
+
* visible to you (404 conflation caveat). A server without Collection
|
|
114
|
+
* metadata support surfaces its 501 as `NotImplementedError`.
|
|
115
|
+
*
|
|
116
|
+
* On an encrypted collection the stored `custom` is an opaque envelope; this
|
|
117
|
+
* decodes it (decrypts, via the codec) so a caller always sees plaintext
|
|
118
|
+
* `{ name, tags }`. A collection with no user metadata reports `custom` as
|
|
119
|
+
* `{}`.
|
|
120
|
+
*
|
|
121
|
+
* Against a backend with the `conditional-writes` feature the result also
|
|
122
|
+
* carries the metadata's current `etag` (the `/meta` `metaVersion`
|
|
123
|
+
* validator) -- pass it as `setMeta(meta, { ifMatch })` for a
|
|
124
|
+
* lost-update-safe metadata update. That validator is independent of the
|
|
125
|
+
* Collection Description's ETag ({@link describeWithEtag}) and of every
|
|
126
|
+
* Resource's versions: writing one never bumps the other.
|
|
127
|
+
*
|
|
128
|
+
* @returns {Promise<(CollectionMetadata & { etag?: string }) | null>}
|
|
129
|
+
*/
|
|
130
|
+
meta(): Promise<(CollectionMetadata & {
|
|
131
|
+
etag?: string;
|
|
132
|
+
}) | null>;
|
|
133
|
+
/**
|
|
134
|
+
* Replaces the Collection's user-writable metadata (`custom`). This is a full
|
|
135
|
+
* replacement: any property omitted from `custom` is cleared, and an omitted
|
|
136
|
+
* `custom` clears them all. Does not create the collection -- a `PUT` to the
|
|
137
|
+
* metadata of a nonexistent collection throws `NotFoundError`. Servers
|
|
138
|
+
* without Collection metadata support surface their 501 as
|
|
139
|
+
* `NotImplementedError`.
|
|
140
|
+
*
|
|
141
|
+
* On an encrypted collection `custom` is encrypted into an opaque envelope by
|
|
142
|
+
* the codec before it is sent, so `name` / `tags` are never stored as
|
|
143
|
+
* server-visible plaintext -- transparently, the same call works on plaintext
|
|
144
|
+
* and encrypted collections alike.
|
|
145
|
+
*
|
|
146
|
+
* Conditional metadata writes (the backend's `conditional-writes` feature):
|
|
147
|
+
* pass `ifMatch` (the `etag` from a prior `meta()`) for an
|
|
148
|
+
* update-if-unchanged, or `ifNoneMatch: true` for a
|
|
149
|
+
* write-only-if-no-metadata. A failed precondition throws
|
|
150
|
+
* `PreconditionFailedError` (412). The `/meta` ETag (`metaVersion`) is
|
|
151
|
+
* independent of the Collection Description's ETag. Returns the new `etag`.
|
|
152
|
+
*
|
|
153
|
+
* @param meta {object}
|
|
154
|
+
* @param [meta.custom] {ResourceMetadataCustom} the user-writable properties
|
|
155
|
+
* @param options {object}
|
|
156
|
+
* @param [options.ifMatch] {string} update only if the `/meta` ETag matches
|
|
157
|
+
* @param [options.ifNoneMatch] {boolean} write only if no metadata is set
|
|
158
|
+
* @returns {Promise<{ etag?: string }>} the metadata's new ETag
|
|
159
|
+
*/
|
|
160
|
+
setMeta(meta?: {
|
|
161
|
+
custom?: ResourceMetadataCustom;
|
|
162
|
+
}, options?: {
|
|
163
|
+
ifMatch?: string;
|
|
164
|
+
ifNoneMatch?: boolean;
|
|
165
|
+
}): Promise<{
|
|
166
|
+
etag?: string;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Sets the Collection's metadata-level human-readable `name`, preserving any
|
|
170
|
+
* existing `tags`. Convenience over `setMeta()`. The write is pinned to the
|
|
171
|
+
* `etag` the `meta()` read returned (when the backend supports
|
|
172
|
+
* `conditional-writes`), so a concurrent metadata write surfaces as
|
|
173
|
+
* `PreconditionFailedError` instead of being silently erased by this
|
|
174
|
+
* full-replacement write.
|
|
175
|
+
*
|
|
176
|
+
* On an encrypted collection this is the collection's client-encrypted name
|
|
177
|
+
* surface: the codec seals it into the `custom` envelope, and by convention
|
|
178
|
+
* the plaintext Description `name` is left unpopulated. On a plaintext
|
|
179
|
+
* collection the two are separate labels -- space-level listings surface the
|
|
180
|
+
* Description's `name` (set via `configure({ name })`), while this one is
|
|
181
|
+
* metadata-level.
|
|
182
|
+
*
|
|
183
|
+
* @param name {string}
|
|
184
|
+
* @returns {Promise<void>}
|
|
185
|
+
*/
|
|
186
|
+
setName(name: string): Promise<void>;
|
|
187
|
+
/**
|
|
188
|
+
* Sets the Collection's `tags`, preserving any existing `name`. Convenience
|
|
189
|
+
* over `setMeta()`. Pinned to the `meta()` read's `etag` like
|
|
190
|
+
* {@link setName}.
|
|
191
|
+
*
|
|
192
|
+
* @param tags {Record<string, string>}
|
|
193
|
+
* @returns {Promise<void>}
|
|
194
|
+
*/
|
|
195
|
+
setTags(tags: Record<string, string>): Promise<void>;
|
|
196
|
+
/**
|
|
197
|
+
* Reads the Collection's persisted index schema: which attributes its
|
|
198
|
+
* documents are searchable by, whether each index is unique, and the schema
|
|
199
|
+
* revision each was added in. Any recipient that can decrypt the collection
|
|
200
|
+
* can read it, which is the point of persisting it -- an app granted access
|
|
201
|
+
* to an existing collection learns what is queryable with no out-of-band
|
|
202
|
+
* coordination (the stored index tokens cannot teach it, being blinded).
|
|
203
|
+
*
|
|
204
|
+
* `addedIn` is the partial-coverage marker: documents written before an
|
|
205
|
+
* attribute was declared carry no token for it, so they do not match a search
|
|
206
|
+
* on it until they are rewritten.
|
|
207
|
+
*
|
|
208
|
+
* @returns {Promise<IndexDeclaration[]>}
|
|
209
|
+
*/
|
|
210
|
+
indexes(): Promise<IndexDeclaration[]>;
|
|
211
|
+
/**
|
|
212
|
+
* Declares an attribute searchable, persisting it in the Collection's
|
|
213
|
+
* encrypted index schema and installing it on this handle's codec.
|
|
214
|
+
* Idempotent: re-declaring an attribute already in the schema on the same
|
|
215
|
+
* terms is a no-op write.
|
|
216
|
+
*
|
|
217
|
+
* Declarations are collection state, not app state: they are stored inside
|
|
218
|
+
* the encrypted `/meta` envelope, so every recipient discovers them (see
|
|
219
|
+
* {@link indexes}). Concurrent declarations from two clients are reconciled
|
|
220
|
+
* with a compare-and-swap against the metadata's own `metaVersion` ETag and a
|
|
221
|
+
* bounded retry, so neither is silently erased.
|
|
222
|
+
*
|
|
223
|
+
* A declaration is prospective: documents already written carry no token for
|
|
224
|
+
* the new attribute and do not match a search on it until they are rewritten
|
|
225
|
+
* (the backfill is a re-encrypt sweep of the collection).
|
|
226
|
+
*
|
|
227
|
+
* Pass an array of attribute names for a compound index. A compound index can
|
|
228
|
+
* be searched by a leading prefix of its attributes; `unique` is enforced
|
|
229
|
+
* only when a document carries the whole combination.
|
|
230
|
+
*
|
|
231
|
+
* @param options {object}
|
|
232
|
+
* @param options.attribute {string | string[]} a dotted attribute path
|
|
233
|
+
* rooted at `content` or `meta` (e.g. `content.type`), or an array of them
|
|
234
|
+
* for a compound index
|
|
235
|
+
* @param [options.unique] {boolean} reject a second document that carries
|
|
236
|
+
* the same value (the server answers a colliding write with `409`)
|
|
237
|
+
* @returns {Promise<IndexSchema>} the schema now in force
|
|
238
|
+
*/
|
|
239
|
+
declareIndex({ attribute, unique }: {
|
|
240
|
+
attribute: string | string[];
|
|
241
|
+
unique?: boolean;
|
|
242
|
+
}): Promise<IndexSchema>;
|
|
243
|
+
/**
|
|
244
|
+
* Searches the collection's encrypted documents by indexed attribute. The
|
|
245
|
+
* terms are blinded client-side before they are sent, so the server matches
|
|
246
|
+
* opaque tokens and learns neither the attribute names nor the values; the
|
|
247
|
+
* documents it returns are decrypted here, exactly as `get()` decrypts one.
|
|
248
|
+
*
|
|
249
|
+
* Give either `equals` (attribute/value pairs a document must match -- an
|
|
250
|
+
* array of objects is an OR of alternatives) or `has` (attribute names a
|
|
251
|
+
* document must carry), not both. Every attribute named must already be in
|
|
252
|
+
* the collection's schema ({@link declareIndex}); an undeclared one is
|
|
253
|
+
* refused with `ValidationError` rather than silently matching nothing.
|
|
254
|
+
*
|
|
255
|
+
* Pass `count: true` for just the number of matches. Otherwise the result is
|
|
256
|
+
* one page: `limit` caps its size (the server clamps its own maximum), and a
|
|
257
|
+
* `hasMore` page carries the `cursor` to pass back for the next one.
|
|
258
|
+
*
|
|
259
|
+
* Requires the collection's backend to advertise the `blinded-index-query`
|
|
260
|
+
* feature; a backend without it answers `501` (`NotImplementedError`).
|
|
261
|
+
*
|
|
262
|
+
* @param options {object}
|
|
263
|
+
* @param [options.equals] {object | object[]} attribute/value pairs to match
|
|
264
|
+
* @param [options.has] {string | string[]} attribute names to require
|
|
265
|
+
* @param [options.count] {boolean} return `{ count }` instead of documents
|
|
266
|
+
* @param [options.limit] {number} maximum documents in the page
|
|
267
|
+
* @param [options.cursor] {string} continue from a previous page
|
|
268
|
+
* @returns {Promise<FindPage | { count: number }>}
|
|
269
|
+
*/
|
|
270
|
+
find(options: {
|
|
271
|
+
equals?: Record<string, unknown> | Array<Record<string, unknown>>;
|
|
272
|
+
has?: string | string[];
|
|
273
|
+
count?: boolean;
|
|
274
|
+
limit?: number;
|
|
275
|
+
cursor?: string;
|
|
276
|
+
}): Promise<FindPage | {
|
|
277
|
+
count: number;
|
|
278
|
+
}>;
|
|
108
279
|
/**
|
|
109
280
|
* Returns a lazy handle to a resource by id. No I/O.
|
|
110
281
|
*
|
package/dist/Collection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../src/Collection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Collection.d.ts","sourceRoot":"","sources":["../src/Collection.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAwC1D,OAAO,KAAK,EAEV,gBAAgB,EAChB,WAAW,EAEZ,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC3E,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,cAAc,EACd,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,cAAc,EACd,uBAAuB,EACvB,sBAAsB,EACtB,eAAe,EAChB,MAAM,YAAY,CAAA;AAEnB,qBAAa,UAAU;;IACrB,QAAQ,CAAC,OAAO,EA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