@interop/edv-client 17.0.0
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/LICENSE +27 -0
- package/README.md +276 -0
- package/dist/EdvClient.d.ts +412 -0
- package/dist/EdvClient.d.ts.map +1 -0
- package/dist/EdvClient.js +663 -0
- package/dist/EdvClient.js.map +1 -0
- package/dist/EdvClientCore.d.ts +264 -0
- package/dist/EdvClientCore.d.ts.map +1 -0
- package/dist/EdvClientCore.js +698 -0
- package/dist/EdvClientCore.js.map +1 -0
- package/dist/EdvDocument.d.ts +92 -0
- package/dist/EdvDocument.d.ts.map +1 -0
- package/dist/EdvDocument.js +149 -0
- package/dist/EdvDocument.js.map +1 -0
- package/dist/HttpsTransport.d.ts +87 -0
- package/dist/HttpsTransport.d.ts.map +1 -0
- package/dist/HttpsTransport.js +415 -0
- package/dist/HttpsTransport.js.map +1 -0
- package/dist/IndexHelper.d.ts +163 -0
- package/dist/IndexHelper.d.ts.map +1 -0
- package/dist/IndexHelper.js +539 -0
- package/dist/IndexHelper.js.map +1 -0
- package/dist/LegacyIndexHelperVersion1.d.ts +150 -0
- package/dist/LegacyIndexHelperVersion1.d.ts.map +1 -0
- package/dist/LegacyIndexHelperVersion1.js +475 -0
- package/dist/LegacyIndexHelperVersion1.js.map +1 -0
- package/dist/Transport.d.ts +142 -0
- package/dist/Transport.d.ts.map +1 -0
- package/dist/Transport.js +181 -0
- package/dist/Transport.js.map +1 -0
- package/dist/assert.d.ts +6 -0
- package/dist/assert.d.ts.map +1 -0
- package/dist/assert.js +61 -0
- package/dist/assert.js.map +1 -0
- package/dist/baseX.d.ts +7 -0
- package/dist/baseX.d.ts.map +1 -0
- package/dist/baseX.js +8 -0
- package/dist/baseX.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/util.d.ts +3 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +13 -0
- package/dist/util.js.map +1 -0
- package/package.json +112 -0
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import type { ISigner } from '@interop/data-integrity-core';
|
|
2
|
+
import { EdvClientCore } from './EdvClientCore.js';
|
|
3
|
+
/**
|
|
4
|
+
* Note: An Encrypted Data Vault (EDV) server MUST expose an HTTPS API with a
|
|
5
|
+
* URL structure that is partitioned like so:
|
|
6
|
+
*
|
|
7
|
+
* <edvID>/documents/<documentID> .
|
|
8
|
+
*
|
|
9
|
+
* The <edvID> must take the form:
|
|
10
|
+
*
|
|
11
|
+
* <authority>/edvs/<multibase base58 multihash encoded random ID> .
|
|
12
|
+
*/
|
|
13
|
+
export declare class EdvClient extends EdvClientCore {
|
|
14
|
+
capability: any;
|
|
15
|
+
invocationSigner?: ISigner;
|
|
16
|
+
httpsAgent: any;
|
|
17
|
+
defaultHeaders: any;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new EdvClient for connecting to an Encrypted Data Vault (EDV).
|
|
20
|
+
*
|
|
21
|
+
* @param {object} options - The options to use.
|
|
22
|
+
* @param {object} [options.capability] - An authorization capability
|
|
23
|
+
* (zcap) to use that will work with every method called on the client
|
|
24
|
+
* with the exception of `revokeCapability`, where a capability must be
|
|
25
|
+
* passed to that function if the root zcap is not to be invoked.
|
|
26
|
+
* @param {object} [options.defaultHeaders] - Default HTTP headers to use
|
|
27
|
+
* with HTTPS requests.
|
|
28
|
+
* @param {HttpsAgent} [options.httpsAgent] - A HttpsAgent to use to handle
|
|
29
|
+
* HTTPS requests.
|
|
30
|
+
* @param {object} [options.hmac] - A default HMAC API for blinding
|
|
31
|
+
* indexable attributes.
|
|
32
|
+
* @param {object} [options.invocationSigner] - An object with an
|
|
33
|
+
* `id` property and a `sign` function for signing capability invocations.
|
|
34
|
+
* @param {string} [options.id] - The ID of the EDV that must be a
|
|
35
|
+
* URL that refers to the EDV's root storage location; if not given, then
|
|
36
|
+
* a separate capability must be given here that can be used for each
|
|
37
|
+
* method to be called -- or a separate capability must be given to each
|
|
38
|
+
* called method directly.
|
|
39
|
+
* @param {object} [options.keyAgreementKey] - A default KeyAgreementKey
|
|
40
|
+
* API for deriving shared KEKs for wrapping content encryption keys.
|
|
41
|
+
* @param {Function} [options.keyResolver] - A default function that returns
|
|
42
|
+
* a Promise that resolves a key ID to a DH public key.
|
|
43
|
+
* @param {string} [options.cipherVersion='recommended'] - Sets the cipher
|
|
44
|
+
* version to either "recommended" or "fips".
|
|
45
|
+
* @param {string} [options._attributeVersion] - Sets the blinded attribute
|
|
46
|
+
* version to use; for internal use only.
|
|
47
|
+
*
|
|
48
|
+
* @returns {EdvClient} An EdvClient instance.
|
|
49
|
+
*/
|
|
50
|
+
constructor({ capability, defaultHeaders, hmac, id, invocationSigner, httpsAgent, keyAgreementKey, keyResolver, cipherVersion, _attributeVersion }?: any);
|
|
51
|
+
/**
|
|
52
|
+
* @inheritdoc
|
|
53
|
+
*
|
|
54
|
+
* @param {object} options - The options to use.
|
|
55
|
+
* @param {object} options.doc - The document to insert.
|
|
56
|
+
* @param {ReadableStream} [options.stream] - A WHATWG Readable stream to read
|
|
57
|
+
* from to associate chunked data with this document.
|
|
58
|
+
* @param {number} [options.chunkSize=1048576] - The size, in bytes, of the
|
|
59
|
+
* chunks to break the incoming stream data into.
|
|
60
|
+
* @param {object[]} [options.recipients=[]] - A set of JWE recipients
|
|
61
|
+
* to encrypt the document for; if not present, a default recipient will
|
|
62
|
+
* be added using `this.keyAgreementKey` and if no `keyAgreementKey` is
|
|
63
|
+
* set, an error will be thrown.
|
|
64
|
+
* @param {Function} [options.keyResolver=this.keyResolver] - A function that
|
|
65
|
+
* returns a Promise that resolves a key ID to a DH public key.
|
|
66
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
67
|
+
* KeyAgreementKey API for deriving shared KEKs for wrapping content
|
|
68
|
+
* encryption keys.
|
|
69
|
+
* @param {object} [options.hmac=this.hmac] - An HMAC API for blinding
|
|
70
|
+
* indexable attributes.
|
|
71
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
72
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
73
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
74
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
75
|
+
* invocation.
|
|
76
|
+
*
|
|
77
|
+
* @returns {Promise<object>} - Resolves to the inserted document.
|
|
78
|
+
*/
|
|
79
|
+
insert({ doc, stream, chunkSize, recipients, keyResolver, keyAgreementKey, hmac, capability, invocationSigner }?: any): Promise<any>;
|
|
80
|
+
/**
|
|
81
|
+
* @inheritdoc
|
|
82
|
+
*
|
|
83
|
+
* @param {object} options - The options to use.
|
|
84
|
+
* @param {object} options.doc - The document to insert.
|
|
85
|
+
* @param {ReadableStream} [options.stream] - A WHATWG Readable stream to read
|
|
86
|
+
* from to associate chunked data with this document.
|
|
87
|
+
* @param {number} [options.chunkSize=1048576] - The size, in bytes, of the
|
|
88
|
+
* chunks to break the incoming stream data into.
|
|
89
|
+
* @param {object} [options.recipients=[]] - A set of JWE recipients to
|
|
90
|
+
* encrypt the document for; if present, recipients will be added to any
|
|
91
|
+
* existing recipients; to remove existing recipients, modify the
|
|
92
|
+
* `encryptedDoc.jwe.recipients` field.
|
|
93
|
+
* @param {Function} [options.keyResolver=this.keyResolver] - A function that
|
|
94
|
+
* returns a Promise that resolves a key ID to a DH public key.
|
|
95
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
96
|
+
* KeyAgreementKey API for deriving shared KEKs for wrapping content
|
|
97
|
+
* encryption keys.
|
|
98
|
+
* @param {object} [options.hmac=this.hmac] - An HMAC API for blinding
|
|
99
|
+
* indexable attributes.
|
|
100
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
101
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
102
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
103
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
104
|
+
* invocation.
|
|
105
|
+
*
|
|
106
|
+
* @returns {Promise<object>} - Resolves to the updated document.
|
|
107
|
+
*/
|
|
108
|
+
update({ doc, stream, chunkSize, recipients, keyResolver, keyAgreementKey, hmac, capability, invocationSigner }?: any): Promise<any>;
|
|
109
|
+
/**
|
|
110
|
+
* @inheritdoc
|
|
111
|
+
*
|
|
112
|
+
* @param {object} options - The options to use.
|
|
113
|
+
* @param {object} options.doc - The document to create or update an index
|
|
114
|
+
* for.
|
|
115
|
+
* @param {object} [options.hmac=this.hmac] - An HMAC API for blinding
|
|
116
|
+
* indexable attributes.
|
|
117
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
118
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
119
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
120
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
121
|
+
* invocation.
|
|
122
|
+
*
|
|
123
|
+
* @returns {Promise} - Resolves once the operation completes.
|
|
124
|
+
*/
|
|
125
|
+
updateIndex({ doc, hmac, capability, invocationSigner }?: any): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* @inheritdoc
|
|
128
|
+
*
|
|
129
|
+
* @param {object} options - The options to use.
|
|
130
|
+
* @param {object} options.doc - The document to delete.
|
|
131
|
+
* @param {object} [options.recipients=[]] - A set of JWE recipients to
|
|
132
|
+
* encrypt the document for; if present, recipients will be added to
|
|
133
|
+
* any existing recipients; to remove existing recipients, modify
|
|
134
|
+
* the `encryptedDoc.jwe.recipients` field.
|
|
135
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
136
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
137
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
138
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
139
|
+
* invocation.
|
|
140
|
+
* @param {Function} [options.keyResolver=this.keyResolver] - A function that
|
|
141
|
+
* returns a Promise that resolves a key ID to a DH public key.
|
|
142
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
143
|
+
* KeyAgreementKey API for deriving shared KEKs for wrapping content
|
|
144
|
+
* encryption keys.
|
|
145
|
+
*
|
|
146
|
+
* @returns {Promise<boolean>} - Resolves to `true` if the document was
|
|
147
|
+
* deleted.
|
|
148
|
+
*/
|
|
149
|
+
delete({ doc, recipients, capability, invocationSigner, keyResolver, keyAgreementKey }?: any): Promise<boolean>;
|
|
150
|
+
/**
|
|
151
|
+
* @inheritdoc
|
|
152
|
+
*
|
|
153
|
+
* @param {object} options - The options to use.
|
|
154
|
+
* @param {string} options.id - The ID of the document to get.
|
|
155
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
156
|
+
* KeyAgreementKey API for deriving a shared KEK to unwrap the content
|
|
157
|
+
* encryption key.
|
|
158
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
159
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
160
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
161
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
162
|
+
* invocation.
|
|
163
|
+
*
|
|
164
|
+
* @returns {Promise<object>} - Resolves to the document.
|
|
165
|
+
*/
|
|
166
|
+
get({ id, keyAgreementKey, capability, invocationSigner }?: any): Promise<any>;
|
|
167
|
+
/**
|
|
168
|
+
* @inheritdoc
|
|
169
|
+
*
|
|
170
|
+
* @param {object} options - The options to use.
|
|
171
|
+
* @param {object} options.doc - The document to get a stream for.
|
|
172
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
173
|
+
* KeyAgreementKey API for deriving a shared KEK to unwrap the content
|
|
174
|
+
* encryption key.
|
|
175
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
176
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
177
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
178
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
179
|
+
* invocation.
|
|
180
|
+
*
|
|
181
|
+
* @returns {Promise<ReadableStream>} - Resolves to a `ReadableStream` to read
|
|
182
|
+
* the chunked data from.
|
|
183
|
+
*/
|
|
184
|
+
getStream({ doc, keyAgreementKey, capability, invocationSigner }?: any): Promise<ReadableStream<any>>;
|
|
185
|
+
/**
|
|
186
|
+
* @inheritdoc
|
|
187
|
+
*
|
|
188
|
+
* @see find - For more detailed documentation on the search options.
|
|
189
|
+
*
|
|
190
|
+
* @param {object} options - The options to use.
|
|
191
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
192
|
+
* KeyAgreementKey API for deriving a shared KEK to unwrap the content
|
|
193
|
+
* encryption key.
|
|
194
|
+
* @param {object} [options.hmac=this.hmac] - An HMAC API for blinding
|
|
195
|
+
* indexable attributes.
|
|
196
|
+
* @param {object|Array} [options.equals] - An object with key-value
|
|
197
|
+
* attribute pairs to match or an array of such objects.
|
|
198
|
+
* @param {string|Array} [options.has] - A string with an attribute name to
|
|
199
|
+
* match or an array of such strings.
|
|
200
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
201
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
202
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
203
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
204
|
+
* invocation.
|
|
205
|
+
*
|
|
206
|
+
* @returns {Promise<number>} - Resolves to the number of matching documents.
|
|
207
|
+
*/
|
|
208
|
+
count({ keyAgreementKey, hmac, equals, has, capability, invocationSigner }?: any): Promise<any>;
|
|
209
|
+
/**
|
|
210
|
+
* @inheritdoc
|
|
211
|
+
*
|
|
212
|
+
* @param {object} options - The options to use.
|
|
213
|
+
* @param {object} [options.keyAgreementKey=this.keyAgreementKey] - A
|
|
214
|
+
* KeyAgreementKey API for deriving a shared KEK to unwrap the content
|
|
215
|
+
* encryption key.
|
|
216
|
+
* @param {object} [options.hmac=this.hmac] - An HMAC API for blinding
|
|
217
|
+
* indexable attributes.
|
|
218
|
+
* @param {object|Array} [options.equals] - An object with key-value
|
|
219
|
+
* attribute pairs to match or an array of such objects.
|
|
220
|
+
* @param {string|Array} [options.has] - A string with an attribute name to
|
|
221
|
+
* match or an array of such strings.
|
|
222
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
223
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
224
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
225
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
226
|
+
* invocation.
|
|
227
|
+
* @param {boolean} [options.returnDocuments] - Set to `false` to
|
|
228
|
+
* request only document IDs from the server (not full documents); note
|
|
229
|
+
* that a server that does not accept this option will return full
|
|
230
|
+
* documents, so either return value is possible.
|
|
231
|
+
* @param {boolean} [options.count] - Set to `false` to find all documents
|
|
232
|
+
* that match a query or to `true` to give a count of documents.
|
|
233
|
+
* @param {number} [options.limit] - Set to limit the number of documents
|
|
234
|
+
* to be returned from a query (min=1, max=1000).
|
|
235
|
+
*
|
|
236
|
+
* @returns {Promise<object>} - Resolves to the matching documents:
|
|
237
|
+
* {documents: [...]} OR to the matching document IDs, if requested
|
|
238
|
+
* and supported by the server: {documentIds: [...]}.
|
|
239
|
+
*/
|
|
240
|
+
find({ keyAgreementKey, hmac, equals, has, capability, invocationSigner, returnDocuments, count, limit }?: any): Promise<any>;
|
|
241
|
+
/**
|
|
242
|
+
* @inheritdoc
|
|
243
|
+
*
|
|
244
|
+
* @param {object} options - The options to use.
|
|
245
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
246
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
247
|
+
* @param {object} [options.headers] - An optional
|
|
248
|
+
* headers object to use when making requests.
|
|
249
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
250
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
251
|
+
* invocation.
|
|
252
|
+
*
|
|
253
|
+
* @returns {Promise<object>} - Resolves to the configuration for the EDV.
|
|
254
|
+
*/
|
|
255
|
+
getConfig({ capability, headers, invocationSigner }?: any): Promise<any>;
|
|
256
|
+
/**
|
|
257
|
+
* @inheritdoc
|
|
258
|
+
*
|
|
259
|
+
* @param {object} options - The options to use.
|
|
260
|
+
* @param {object} options.config - The new EDV config.
|
|
261
|
+
* @param {object|string} [options.capability=this.capability] - The
|
|
262
|
+
* authorization capability (zcap) to use to authorize the operation.
|
|
263
|
+
* @param {object} [options.headers] - An optional headers object to use when
|
|
264
|
+
* making requests.
|
|
265
|
+
* @param {object} [options.invocationSigner=this.invocationSigner] - An API
|
|
266
|
+
* with an `id` property and a `sign` function for signing a capability
|
|
267
|
+
* invocation.
|
|
268
|
+
*
|
|
269
|
+
* @returns {Promise<void>} - Resolves once the operation completes.
|
|
270
|
+
*/
|
|
271
|
+
updateConfig({ config, capability, headers, invocationSigner }?: any): Promise<any>;
|
|
272
|
+
/**
|
|
273
|
+
* Revoke an authorization capability (zcap). If no `capability` is passed,
|
|
274
|
+
* then the root zcap for the revocation endpoint will be invoked.
|
|
275
|
+
*
|
|
276
|
+
* @param {object} options - The options to use.
|
|
277
|
+
* @param {object} options.capabilityToRevoke - The capability to revoke.
|
|
278
|
+
* @param {object|string} [options.capability] - The authorization capability
|
|
279
|
+
* (zcap) to use to authorize the operation.
|
|
280
|
+
* @param {object} options.invocationSigner - An API with an
|
|
281
|
+
* `id` property and a `sign` function for signing a capability invocation.
|
|
282
|
+
*
|
|
283
|
+
* @returns {Promise<object>} Resolves once the operation completes.
|
|
284
|
+
*/
|
|
285
|
+
revokeCapability({ capabilityToRevoke, capability, invocationSigner }?: any): Promise<void>;
|
|
286
|
+
/**
|
|
287
|
+
* Parses an EDV ID from a capability's invocation target.
|
|
288
|
+
*
|
|
289
|
+
* @param {object} options - The options to use.
|
|
290
|
+
* @param {object|string} options.capability - The authorization capability
|
|
291
|
+
* (zcap) to parse the EDV ID from.
|
|
292
|
+
*
|
|
293
|
+
* @returns {string} - The ID of the EDV.
|
|
294
|
+
*/
|
|
295
|
+
parseEdvId({ capability }?: any): any;
|
|
296
|
+
/**
|
|
297
|
+
* Creates a new EDV using the given configuration.
|
|
298
|
+
*
|
|
299
|
+
* @param {object} options - The options to use.
|
|
300
|
+
* @param {string} options.url - The url to post the configuration to.
|
|
301
|
+
* @param {string} options.config - The EDV's configuration.
|
|
302
|
+
* @param {object|string} [options.capability] - The authorization capability
|
|
303
|
+
* (zcap) to use to authorize the operation.
|
|
304
|
+
* @param {object} [options.headers=undefined] - An optional
|
|
305
|
+
* headers object to use when making requests.
|
|
306
|
+
* @param {HttpsAgent} [options.httpsAgent=undefined] - An optional
|
|
307
|
+
* node.js `https.Agent` instance to use when making requests.
|
|
308
|
+
* @param {object} [options.invocationSigner] - An object with an
|
|
309
|
+
* `id` property and a `sign` function for signing a capability invocation.
|
|
310
|
+
*
|
|
311
|
+
* @returns {Promise<object>} - Resolves to the configuration for the newly
|
|
312
|
+
* created EDV.
|
|
313
|
+
*/
|
|
314
|
+
static createEdv({ url, config, capability, httpsAgent, headers, invocationSigner }?: any): Promise<unknown>;
|
|
315
|
+
/**
|
|
316
|
+
* Gets the EDV config for the given controller and reference ID.
|
|
317
|
+
*
|
|
318
|
+
* @param {object} options - The options to use.
|
|
319
|
+
* @param {string} options.url - The url to query.
|
|
320
|
+
* @param {string} options.controller - The ID of the controller.
|
|
321
|
+
* @param {string} options.referenceId - A controller-unique reference ID.
|
|
322
|
+
* @param {HttpsAgent} [options.httpsAgent] - An optional
|
|
323
|
+
* node.js `https.Agent` instance to use when making requests.
|
|
324
|
+
* @param {object} [options.headers] - An optional
|
|
325
|
+
* headers object to use when making requests.
|
|
326
|
+
* @param {object} [options.invocationSigner] - An object with an
|
|
327
|
+
* `id` property and a `sign` function for signing a capability invocation.
|
|
328
|
+
* @param {object|string} [options.capability] - The authorization capability
|
|
329
|
+
* (zcap) to use to authorize the operation.
|
|
330
|
+
*
|
|
331
|
+
* @returns {Promise<object>} - Resolves to the EDV configuration
|
|
332
|
+
* containing the given controller and reference ID.
|
|
333
|
+
*/
|
|
334
|
+
static findConfig({ url, controller, referenceId, httpsAgent, invocationSigner, headers, capability }?: any): Promise<any>;
|
|
335
|
+
/**
|
|
336
|
+
* Get all EDV configurations matching a query.
|
|
337
|
+
*
|
|
338
|
+
* @param {object} options - The options to use.
|
|
339
|
+
* @param {string} options.url - The url to query.
|
|
340
|
+
* @param {string} options.controller - The EDV's controller.
|
|
341
|
+
* @param {string} [options.referenceId] - A controller-unique reference ID.
|
|
342
|
+
* @param {string} [options.after] - An EDV's ID.
|
|
343
|
+
* @param {number} [options.limit] - How many EDV configs to return.
|
|
344
|
+
* @param {HttpsAgent} [options.httpsAgent=undefined] - An optional
|
|
345
|
+
* node.js `https.Agent` instance to use when making requests.
|
|
346
|
+
* @param {object} [options.headers=undefined] - An optional
|
|
347
|
+
* headers object to use when making requests.
|
|
348
|
+
* @param {object} [options.invocationSigner] - An object with an
|
|
349
|
+
* `id` property and a `sign` function for signing a capability invocation.
|
|
350
|
+
* @param {object|string} [options.capability] - The authorization capability
|
|
351
|
+
* (zcap) to use to authorize the operation.
|
|
352
|
+
*
|
|
353
|
+
* @returns {Promise<Array>} - Resolves to the matching EDV configurations.
|
|
354
|
+
*/
|
|
355
|
+
static findConfigs({ url, controller, referenceId, after, limit, httpsAgent, headers, capability, invocationSigner }?: any): Promise<unknown>;
|
|
356
|
+
/**
|
|
357
|
+
* Generates a multibase encoded random 128-bit identifier for a document.
|
|
358
|
+
*
|
|
359
|
+
* @returns {Promise<string>} - Resolves to the identifier.
|
|
360
|
+
*/
|
|
361
|
+
static generateId(): Promise<string>;
|
|
362
|
+
/**
|
|
363
|
+
* Migrates all documents that match the given `equals` or `has` query
|
|
364
|
+
* from the attribute version configured for the `from` EdvClient instance
|
|
365
|
+
* to the attribute version configured for the `to` EdvClient instance.
|
|
366
|
+
*
|
|
367
|
+
* This method should be used with caution. It is not exposed as a public
|
|
368
|
+
* API (it is marked private by `_` convention).
|
|
369
|
+
*
|
|
370
|
+
* WARNING: Concurrent writes to an EDV store should be prevented while it is
|
|
371
|
+
* running if the operating environment cannot guarantee that uniqueness
|
|
372
|
+
* constraints will not be violated.
|
|
373
|
+
*
|
|
374
|
+
* WARNING: At present, this method will fail if the number of documents to
|
|
375
|
+
* be migrated exceeds a maximum of `999`.
|
|
376
|
+
*
|
|
377
|
+
* A more robust implementation may be provided in the future if further
|
|
378
|
+
* migrations are needed.
|
|
379
|
+
*
|
|
380
|
+
* @param {object} options - The options to use.
|
|
381
|
+
* @param {EdvClient} options.from - The EDV client instance configured to
|
|
382
|
+
* use the attribute version to convert from.
|
|
383
|
+
* @param {EdvClient} options.to - The EDV client instance configured to
|
|
384
|
+
* use the attribute version to convert to.
|
|
385
|
+
* @param {object|Array} [options.equals] - An object with key-value
|
|
386
|
+
* attribute pairs to match or an array of such objects.
|
|
387
|
+
* @param {string|Array} [options.has] - A string with an attribute name to
|
|
388
|
+
* match or an array of such strings.
|
|
389
|
+
*
|
|
390
|
+
* @returns {Promise} Resolves once the operation completes.
|
|
391
|
+
*/
|
|
392
|
+
static _migrate({ from, to, equals, has }?: any): Promise<void>;
|
|
393
|
+
_getDocUrl(id: any, capability: any): any;
|
|
394
|
+
/**
|
|
395
|
+
* Parses an EDV ID from a capability's invocation target.
|
|
396
|
+
*
|
|
397
|
+
* @param {object} options - The options to use.
|
|
398
|
+
* @param {object|string} options.capability - The authorization capability
|
|
399
|
+
* (zcap) to parse the EDV ID from.
|
|
400
|
+
*
|
|
401
|
+
* @returns {string} - The ID of the EDV.
|
|
402
|
+
*/
|
|
403
|
+
static _parseEdvId({ capability }?: any): any;
|
|
404
|
+
static _getInvocationTarget({ capability }: any): string | null;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* A node.js HTTPS agent.
|
|
408
|
+
*
|
|
409
|
+
* @typedef {object} HttpsAgent
|
|
410
|
+
* @see https://nodejs.org/api/https.html#https_class_https_agent
|
|
411
|
+
*/
|
|
412
|
+
//# sourceMappingURL=EdvClient.d.ts.map
|
|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