@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,415 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { assert, assertInvocationSigner } from './assert.js';
|
|
5
|
+
import { DEFAULT_HEADERS, httpClient } from '@interop/http-client';
|
|
6
|
+
import { signCapabilityInvocation } from '@interop/http-signature-zcap-invoke';
|
|
7
|
+
const ZCAP_ROOT_PREFIX = 'urn:zcap:root:';
|
|
8
|
+
export class HttpsTransport {
|
|
9
|
+
capability;
|
|
10
|
+
defaultHeaders;
|
|
11
|
+
edvId;
|
|
12
|
+
httpsAgent;
|
|
13
|
+
invocationSigner;
|
|
14
|
+
url;
|
|
15
|
+
_rootZcapId;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a transport layer for an EDV client to use to perform an
|
|
18
|
+
* operation with an EDV server over HTTPS.
|
|
19
|
+
*
|
|
20
|
+
* @param {object} options - The options to use.
|
|
21
|
+
* @param {object|string} [options.capability] - The authorization capability
|
|
22
|
+
* (zcap) to use to authorize the operation.
|
|
23
|
+
* @param {object} [options.defaultHeaders] - Default headers to use with
|
|
24
|
+
* HTTP requests.
|
|
25
|
+
* @param {string} [options.edvId] - The ID of the target EDV.
|
|
26
|
+
* @param {HttpsAgent} [options.httpsAgent] - A node.js `https.Agent`
|
|
27
|
+
* instance to use when making requests.
|
|
28
|
+
* @param {object} [options.invocationSigner] - An object with an
|
|
29
|
+
* `id` property and a `sign` function for signing a capability invocation.
|
|
30
|
+
* @param {string} [options.url] - The url to use.
|
|
31
|
+
*
|
|
32
|
+
* @returns {HttpsTransport} An HttpsTransport instance.
|
|
33
|
+
*/
|
|
34
|
+
constructor({ capability, defaultHeaders, edvId, httpsAgent, invocationSigner, url } = {}) {
|
|
35
|
+
if (url !== undefined) {
|
|
36
|
+
assert(url, 'url', 'string');
|
|
37
|
+
}
|
|
38
|
+
if (invocationSigner !== undefined) {
|
|
39
|
+
assertInvocationSigner(invocationSigner);
|
|
40
|
+
}
|
|
41
|
+
this.capability = capability;
|
|
42
|
+
this.defaultHeaders = { ...DEFAULT_HEADERS, ...defaultHeaders };
|
|
43
|
+
this.edvId = edvId;
|
|
44
|
+
this.httpsAgent = httpsAgent;
|
|
45
|
+
this.invocationSigner = invocationSigner;
|
|
46
|
+
this.url = url;
|
|
47
|
+
if (edvId) {
|
|
48
|
+
this._rootZcapId = `${ZCAP_ROOT_PREFIX}${encodeURIComponent(edvId)}`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @inheritdoc
|
|
53
|
+
*/
|
|
54
|
+
async createEdv({ config } = {}) {
|
|
55
|
+
let { capability, url } = this;
|
|
56
|
+
if (!url) {
|
|
57
|
+
url =
|
|
58
|
+
HttpsTransport._getInvocationTarget({ capability }) ||
|
|
59
|
+
_createAbsoluteUrl('/edvs');
|
|
60
|
+
}
|
|
61
|
+
// no invocationSigner was provided, submit the request without a zCap
|
|
62
|
+
const { defaultHeaders, httpsAgent: agent, invocationSigner } = this;
|
|
63
|
+
if (!invocationSigner) {
|
|
64
|
+
const response = await httpClient.post(url, {
|
|
65
|
+
headers: defaultHeaders,
|
|
66
|
+
json: config,
|
|
67
|
+
agent
|
|
68
|
+
});
|
|
69
|
+
return response.data;
|
|
70
|
+
}
|
|
71
|
+
if (!capability) {
|
|
72
|
+
capability = `${ZCAP_ROOT_PREFIX}${encodeURIComponent(url)}`;
|
|
73
|
+
}
|
|
74
|
+
// submit request w/signed zcap invocation
|
|
75
|
+
const response = await this._signedHttpPost({
|
|
76
|
+
url,
|
|
77
|
+
json: config,
|
|
78
|
+
capability,
|
|
79
|
+
insert: true
|
|
80
|
+
});
|
|
81
|
+
return response.data;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @inheritdoc
|
|
85
|
+
*/
|
|
86
|
+
async getConfig({ id = this.edvId } = {}) {
|
|
87
|
+
const { capability } = this;
|
|
88
|
+
if (!(id || capability)) {
|
|
89
|
+
throw new TypeError('"capability" is required if "id" was not provided.');
|
|
90
|
+
}
|
|
91
|
+
const url = HttpsTransport._getInvocationTarget({ capability }) || id;
|
|
92
|
+
const { defaultHeaders, httpsAgent: agent, invocationSigner } = this;
|
|
93
|
+
if (!invocationSigner) {
|
|
94
|
+
// send request w/o zcap invocation
|
|
95
|
+
const response = await httpClient.get(url, {
|
|
96
|
+
headers: defaultHeaders,
|
|
97
|
+
agent
|
|
98
|
+
});
|
|
99
|
+
return response.data;
|
|
100
|
+
}
|
|
101
|
+
// send request w/ zcap invocation
|
|
102
|
+
const response = await this._signedHttpGet({
|
|
103
|
+
url,
|
|
104
|
+
capability,
|
|
105
|
+
notFoundMessage: 'Config not found.'
|
|
106
|
+
});
|
|
107
|
+
return response.data;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @inheritdoc
|
|
111
|
+
*/
|
|
112
|
+
async updateConfig({ config } = {}) {
|
|
113
|
+
const { capability, edvId } = this;
|
|
114
|
+
if (!(edvId || capability)) {
|
|
115
|
+
throw new TypeError('"capability" is required if "edvId" was not provided ' +
|
|
116
|
+
'to the HttpsTransport constructor.');
|
|
117
|
+
}
|
|
118
|
+
const url = HttpsTransport._getInvocationTarget({ capability }) || edvId;
|
|
119
|
+
const { defaultHeaders, httpsAgent: agent, invocationSigner } = this;
|
|
120
|
+
if (!invocationSigner) {
|
|
121
|
+
// send request w/o zcap invocation
|
|
122
|
+
await httpClient.post(url, {
|
|
123
|
+
headers: defaultHeaders,
|
|
124
|
+
json: config,
|
|
125
|
+
agent
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
// send request w/ zcap invocation
|
|
129
|
+
await this._signedHttpPost({ url, json: config, capability, insert: false });
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @inheritdoc
|
|
133
|
+
*/
|
|
134
|
+
async findConfigs({ controller, referenceId, after, limit } = {}) {
|
|
135
|
+
let { capability, url } = this;
|
|
136
|
+
if (!url) {
|
|
137
|
+
url =
|
|
138
|
+
HttpsTransport._getInvocationTarget({ capability }) ||
|
|
139
|
+
_createAbsoluteUrl('/edvs');
|
|
140
|
+
}
|
|
141
|
+
// eliminate undefined properties, to prevent expression of them using
|
|
142
|
+
// the string literal `undefined`
|
|
143
|
+
const searchParams = Object.fromEntries(Object.entries({ controller, referenceId, after, limit }).filter(([, v]) => v !== undefined));
|
|
144
|
+
// no invocationSigner was provided, submit the request without a zCap
|
|
145
|
+
const { defaultHeaders, httpsAgent: agent, invocationSigner } = this;
|
|
146
|
+
if (!invocationSigner) {
|
|
147
|
+
// send request w/o signed zcap invocation
|
|
148
|
+
const response = await httpClient.get(url, {
|
|
149
|
+
searchParams,
|
|
150
|
+
headers: defaultHeaders,
|
|
151
|
+
agent
|
|
152
|
+
});
|
|
153
|
+
return response.data;
|
|
154
|
+
}
|
|
155
|
+
if (!capability) {
|
|
156
|
+
capability = `${ZCAP_ROOT_PREFIX}${encodeURIComponent(url)}`;
|
|
157
|
+
}
|
|
158
|
+
// add params to URL so they will be signed
|
|
159
|
+
url += `?${new URLSearchParams(searchParams)}`;
|
|
160
|
+
const response = await this._signedHttpGet({ url, capability });
|
|
161
|
+
return response.data;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* @inheritdoc
|
|
165
|
+
*/
|
|
166
|
+
async insert({ encrypted } = {}) {
|
|
167
|
+
// trim document ID and trailing slash to post to `/documents`
|
|
168
|
+
let url = this._getDocUrl(encrypted.id, this.capability);
|
|
169
|
+
if (url.endsWith(encrypted.id)) {
|
|
170
|
+
url = url.slice(0, -(encrypted.id.length + 1));
|
|
171
|
+
}
|
|
172
|
+
await this._signedHttpPost({ url, json: encrypted, insert: true });
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @inheritdoc
|
|
176
|
+
*/
|
|
177
|
+
async update({ encrypted } = {}) {
|
|
178
|
+
const url = this._getDocUrl(encrypted.id, this.capability);
|
|
179
|
+
await this._signedHttpPost({ url, json: encrypted, insert: false });
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* @inheritdoc
|
|
183
|
+
*/
|
|
184
|
+
async updateIndex({ docId, entry } = {}) {
|
|
185
|
+
const url = this._getDocUrl(docId, this.capability) + '/index';
|
|
186
|
+
await this._signedHttpPost({ url, json: entry, insert: false });
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* @inheritdoc
|
|
190
|
+
*/
|
|
191
|
+
async get({ id } = {}) {
|
|
192
|
+
const url = this._getDocUrl(id, this.capability);
|
|
193
|
+
const response = await this._signedHttpGet({
|
|
194
|
+
url,
|
|
195
|
+
notFoundMessage: 'Document not found.'
|
|
196
|
+
});
|
|
197
|
+
return response.data;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @inheritdoc
|
|
201
|
+
*/
|
|
202
|
+
async find({ query } = {}) {
|
|
203
|
+
const { capability, edvId } = this;
|
|
204
|
+
let url = HttpsTransport._getInvocationTarget({ capability });
|
|
205
|
+
if (!url) {
|
|
206
|
+
if (!edvId) {
|
|
207
|
+
throw new Error('Either "capability" or "edvId" must be given.');
|
|
208
|
+
}
|
|
209
|
+
url = `${edvId}/query`;
|
|
210
|
+
}
|
|
211
|
+
else if (!url.includes('/query')) {
|
|
212
|
+
// note: capability with a target of `/documents` or the EDV ID,
|
|
213
|
+
// can be used to query by augmenting with `/query`
|
|
214
|
+
url += '/query';
|
|
215
|
+
}
|
|
216
|
+
// for backwards compatibility, convert `returnDocuments` to a query
|
|
217
|
+
// parameter
|
|
218
|
+
if (query.returnDocuments !== undefined) {
|
|
219
|
+
const { returnDocuments, ...rest } = query;
|
|
220
|
+
query = rest;
|
|
221
|
+
url += `?${new URLSearchParams({ returnDocuments })}`;
|
|
222
|
+
}
|
|
223
|
+
// do signed HTTP post w/'read' action
|
|
224
|
+
const response = await this._signedHttpPost({
|
|
225
|
+
url,
|
|
226
|
+
json: query,
|
|
227
|
+
capability,
|
|
228
|
+
capabilityAction: 'read'
|
|
229
|
+
});
|
|
230
|
+
if (query.count === true) {
|
|
231
|
+
return response.data;
|
|
232
|
+
}
|
|
233
|
+
const { documents, documentIds, hasMore } = response.data;
|
|
234
|
+
const result = {};
|
|
235
|
+
if (documents) {
|
|
236
|
+
result.documents = documents;
|
|
237
|
+
}
|
|
238
|
+
if (documentIds) {
|
|
239
|
+
result.documentIds = documentIds;
|
|
240
|
+
}
|
|
241
|
+
if (hasMore !== undefined) {
|
|
242
|
+
result.hasMore = hasMore;
|
|
243
|
+
}
|
|
244
|
+
return result;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* @inheritdoc
|
|
248
|
+
*/
|
|
249
|
+
async revokeCapability({ capabilityToRevoke } = {}) {
|
|
250
|
+
assert(capabilityToRevoke, 'capabilityToRevoke', 'object');
|
|
251
|
+
let { edvId, capability } = this;
|
|
252
|
+
if (!edvId && !(capability && typeof capability === 'object')) {
|
|
253
|
+
// since no `edvId` was set and no `capability` with an invocation
|
|
254
|
+
// target that can be parsed was given, get the EDV ID from the
|
|
255
|
+
// capability that is to be revoked -- presuming it is a document (if
|
|
256
|
+
// revoking any other capability, the `edvId` must be set or a
|
|
257
|
+
// `capability` passed to invoke)
|
|
258
|
+
edvId = this.parseEdvId({ capability: capabilityToRevoke });
|
|
259
|
+
}
|
|
260
|
+
const revokePath = `${edvId}/zcaps/revocations`;
|
|
261
|
+
const url = HttpsTransport._getInvocationTarget({ capability }) ||
|
|
262
|
+
`${revokePath}/${encodeURIComponent(capabilityToRevoke.id)}`;
|
|
263
|
+
if (!capability) {
|
|
264
|
+
capability = `${ZCAP_ROOT_PREFIX}${encodeURIComponent(url)}`;
|
|
265
|
+
}
|
|
266
|
+
await this._signedHttpPost({
|
|
267
|
+
url,
|
|
268
|
+
json: capabilityToRevoke,
|
|
269
|
+
capability,
|
|
270
|
+
insert: true
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* @inheritdoc
|
|
275
|
+
*/
|
|
276
|
+
async storeChunk({ docId, chunk }) {
|
|
277
|
+
// append `/chunks/<chunkIndex>`
|
|
278
|
+
const { index } = chunk;
|
|
279
|
+
const url = this._getDocUrl(docId, this.capability) + `/chunks/${index}`;
|
|
280
|
+
await this._signedHttpPost({ url, json: chunk, insert: false });
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* @inheritdoc
|
|
284
|
+
*/
|
|
285
|
+
async getChunk({ docId, chunkIndex } = {}) {
|
|
286
|
+
// append `/chunks/<chunkIndex>`
|
|
287
|
+
const url = this._getDocUrl(docId, this.capability) + `/chunks/${chunkIndex}`;
|
|
288
|
+
const response = await this._signedHttpGet({
|
|
289
|
+
url,
|
|
290
|
+
notFoundMessage: 'Document chunk not found.'
|
|
291
|
+
});
|
|
292
|
+
// TODO: validate response.data
|
|
293
|
+
// return chunk
|
|
294
|
+
return response.data;
|
|
295
|
+
}
|
|
296
|
+
async _signedHttpGet({ url, capability = this.capability, notFoundMessage } = {}) {
|
|
297
|
+
if (!capability) {
|
|
298
|
+
capability = this._rootZcapId;
|
|
299
|
+
}
|
|
300
|
+
try {
|
|
301
|
+
// sign HTTP header
|
|
302
|
+
const { defaultHeaders, httpsAgent: agent, invocationSigner } = this;
|
|
303
|
+
const headers = await signCapabilityInvocation({
|
|
304
|
+
url,
|
|
305
|
+
method: 'get',
|
|
306
|
+
headers: defaultHeaders,
|
|
307
|
+
capability,
|
|
308
|
+
invocationSigner,
|
|
309
|
+
capabilityAction: 'read'
|
|
310
|
+
});
|
|
311
|
+
// send request
|
|
312
|
+
return await httpClient.get(url, { headers, agent });
|
|
313
|
+
}
|
|
314
|
+
catch (e) {
|
|
315
|
+
// normalize not found errors
|
|
316
|
+
if (notFoundMessage && e.status === 404) {
|
|
317
|
+
const err = new Error(notFoundMessage);
|
|
318
|
+
err.name = 'NotFoundError';
|
|
319
|
+
err.cause = e;
|
|
320
|
+
throw err;
|
|
321
|
+
}
|
|
322
|
+
throw e;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
async _signedHttpPost({ url, json, capability = this.capability, capabilityAction = 'write', insert } = {}) {
|
|
326
|
+
if (!capability) {
|
|
327
|
+
capability = this._rootZcapId;
|
|
328
|
+
}
|
|
329
|
+
try {
|
|
330
|
+
// sign HTTP header
|
|
331
|
+
const { defaultHeaders, httpsAgent: agent, invocationSigner } = this;
|
|
332
|
+
const headers = await signCapabilityInvocation({
|
|
333
|
+
url,
|
|
334
|
+
method: 'post',
|
|
335
|
+
headers: defaultHeaders,
|
|
336
|
+
json,
|
|
337
|
+
capability,
|
|
338
|
+
invocationSigner,
|
|
339
|
+
capabilityAction
|
|
340
|
+
});
|
|
341
|
+
// send request
|
|
342
|
+
return await httpClient.post(url, { agent, json, headers });
|
|
343
|
+
}
|
|
344
|
+
catch (e) {
|
|
345
|
+
// normalize 409 errors to duplicate / conflict errors
|
|
346
|
+
if (insert !== undefined && e.status === 409) {
|
|
347
|
+
const cause = e;
|
|
348
|
+
if (insert) {
|
|
349
|
+
// eslint-disable-next-line no-ex-assign
|
|
350
|
+
e = new Error('Duplicate error.');
|
|
351
|
+
e.name = 'DuplicateError';
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
// eslint-disable-next-line no-ex-assign
|
|
355
|
+
e = new Error('Conflict error.');
|
|
356
|
+
e.name = 'InvalidStateError';
|
|
357
|
+
}
|
|
358
|
+
e.cause = cause;
|
|
359
|
+
}
|
|
360
|
+
throw e;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
// helper that gets a document URL from a document ID
|
|
364
|
+
_getDocUrl(id, capability) {
|
|
365
|
+
if (!this.edvId) {
|
|
366
|
+
if (!capability) {
|
|
367
|
+
throw new Error('Either "capability" or "edvId" must be given.');
|
|
368
|
+
}
|
|
369
|
+
const target = HttpsTransport._getInvocationTarget({ capability });
|
|
370
|
+
// target is the entire documents collection
|
|
371
|
+
if (target.endsWith('/documents')) {
|
|
372
|
+
return `${target}/${id}`;
|
|
373
|
+
}
|
|
374
|
+
return target;
|
|
375
|
+
}
|
|
376
|
+
return `${this.edvId}/documents/${id}`;
|
|
377
|
+
}
|
|
378
|
+
static _getInvocationTarget({ capability }) {
|
|
379
|
+
// no capability, so no invocation target
|
|
380
|
+
if (capability === undefined || capability === null) {
|
|
381
|
+
return null;
|
|
382
|
+
}
|
|
383
|
+
let invocationTarget;
|
|
384
|
+
if (typeof capability === 'string') {
|
|
385
|
+
if (!capability.startsWith(ZCAP_ROOT_PREFIX)) {
|
|
386
|
+
throw new Error('If "capability" is a string, it must be a root capability.');
|
|
387
|
+
}
|
|
388
|
+
invocationTarget = decodeURIComponent(capability.substring(ZCAP_ROOT_PREFIX));
|
|
389
|
+
}
|
|
390
|
+
else if (typeof capability === 'object') {
|
|
391
|
+
;
|
|
392
|
+
({ invocationTarget } = capability);
|
|
393
|
+
}
|
|
394
|
+
if (!(typeof invocationTarget === 'string' && invocationTarget.includes(':'))) {
|
|
395
|
+
throw new TypeError('"invocationTarget" from capability must be an "https" URL.');
|
|
396
|
+
}
|
|
397
|
+
return invocationTarget;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
function _createAbsoluteUrl(url) {
|
|
401
|
+
if (url.includes(':')) {
|
|
402
|
+
return url;
|
|
403
|
+
}
|
|
404
|
+
if (typeof self !== 'undefined') {
|
|
405
|
+
return `${self.location.origin}${url}`;
|
|
406
|
+
}
|
|
407
|
+
throw new Error('"url" must be an absolute URL.');
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* A node.js HTTPS agent.
|
|
411
|
+
*
|
|
412
|
+
* @typedef {object} HttpsAgent
|
|
413
|
+
* @see https://nodejs.org/api/https.html#https_class_https_agent
|
|
414
|
+
*/
|
|
415
|
+
//# sourceMappingURL=HttpsTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpsTransport.js","sourceRoot":"","sources":["../src/HttpsTransport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|
+
export declare class IndexHelper {
|
|
2
|
+
indexes: any;
|
|
3
|
+
compoundIndexes: any;
|
|
4
|
+
_cache: any;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new IndexHelper instance that can be used to blind EDV
|
|
7
|
+
* document attributes to enable indexing.
|
|
8
|
+
*
|
|
9
|
+
* @returns {IndexHelper} An IndexHelper instance.
|
|
10
|
+
*/
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Ensures that future documents inserted or updated using this client
|
|
14
|
+
* instance will be indexed according to the given attribute, provided that
|
|
15
|
+
* they contain that attribute. Compound indexes can be specified by
|
|
16
|
+
* providing an array for `attribute`.
|
|
17
|
+
*
|
|
18
|
+
* Queries may be performed using compound indexes without specifying all
|
|
19
|
+
* attributes in the compound index so long as there is at least one value
|
|
20
|
+
* (or the attribute name for "has" queries) specified for consecutive
|
|
21
|
+
* attributes starting with the first. This allows for querying using only
|
|
22
|
+
* a prefix of a compound index. However, uniqueness will not be enforced
|
|
23
|
+
* unless all attributes in the compound index are present in a document.
|
|
24
|
+
*
|
|
25
|
+
* @param {object} options - The options to use.
|
|
26
|
+
* @param {string|string[]} options.attribute - The attribute name or an
|
|
27
|
+
* array of attribute names to create a unique compound index.
|
|
28
|
+
* @param {boolean} [options.unique=false] - Set to `true` if the index
|
|
29
|
+
* should be considered unique, `false` if not.
|
|
30
|
+
* @param {object} [options.hmac] - An optional HMAC API with `id`, `sign`,
|
|
31
|
+
* and `verify` properties for prewarming caches.
|
|
32
|
+
*/
|
|
33
|
+
ensureIndex({ attribute, unique, hmac }?: any): void;
|
|
34
|
+
/**
|
|
35
|
+
* Creates an indexable entry of blinded attributes for the given document
|
|
36
|
+
* using the HMAC associated with this instance.
|
|
37
|
+
*
|
|
38
|
+
* @param {object} options - The options to use.
|
|
39
|
+
* @param {object} options.hmac - An HMAC API with `id`, `sign`, and `verify`
|
|
40
|
+
* properties.
|
|
41
|
+
* @param {object} options.doc - The document to create the indexable entry
|
|
42
|
+
* for.
|
|
43
|
+
*
|
|
44
|
+
* @returns {Promise<object>} - Resolves to the new indexable entry.
|
|
45
|
+
*/
|
|
46
|
+
createEntry({ hmac, doc }: any): Promise<{
|
|
47
|
+
hmac: {
|
|
48
|
+
id: any;
|
|
49
|
+
type: any;
|
|
50
|
+
};
|
|
51
|
+
sequence: any;
|
|
52
|
+
attributes: any[];
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Returns a shallow copy of the array of indexed entries for the given
|
|
56
|
+
* document where any existing entry matching the HMAC associated with this
|
|
57
|
+
* instance is updated to include the current document attributes. If no
|
|
58
|
+
* existing entry is found, a new entry is appended to the shallow copy
|
|
59
|
+
* prior to its return.
|
|
60
|
+
*
|
|
61
|
+
* @param {object} options - The options to use.
|
|
62
|
+
* @param {object} options.hmac - An HMAC API with `id`, `sign`, and `verify`
|
|
63
|
+
* properties.
|
|
64
|
+
* @param {object} options.doc - The document to create or update an indexable
|
|
65
|
+
* entry for.
|
|
66
|
+
*
|
|
67
|
+
* @returns {Promise<Array>} - Resolves to the updated array of indexable
|
|
68
|
+
* entries.
|
|
69
|
+
*/
|
|
70
|
+
updateEntry({ hmac, doc }: any): Promise<any>;
|
|
71
|
+
/**
|
|
72
|
+
* Builds a query that can be submitted to an EDV index service.
|
|
73
|
+
*
|
|
74
|
+
* @param {object} options - The options to use.
|
|
75
|
+
* @param {object} options.hmac - An HMAC API with `id`, `sign`, and `verify`
|
|
76
|
+
* properties.
|
|
77
|
+
* @param {object|Array} [options.equals] - An object with key-value
|
|
78
|
+
* attribute pairs to match or an array of such objects.
|
|
79
|
+
* @param {string|Array} [options.has] - A string with an attribute name to
|
|
80
|
+
* match or an array of such strings.
|
|
81
|
+
*
|
|
82
|
+
* @returns {Promise<object>} - Resolves to the built query.
|
|
83
|
+
*/
|
|
84
|
+
buildQuery({ hmac, equals, has }: any): Promise<any>;
|
|
85
|
+
/**
|
|
86
|
+
* Blinds a Uint8Array of bytes using the given HMAC API.
|
|
87
|
+
*
|
|
88
|
+
* @param {object} hmac - An HMAC API with `id`, `sign`, and `verify`
|
|
89
|
+
* properties.
|
|
90
|
+
* @param {Uint8Array} data - The value to blind.
|
|
91
|
+
*
|
|
92
|
+
* @returns {Promise<string>} - Resolves to the blinded value.
|
|
93
|
+
*/
|
|
94
|
+
_blindData(hmac: any, data: any): Promise<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Blinds a hashed attribute (compound or simple) using the given HMAC API.
|
|
97
|
+
*
|
|
98
|
+
* @param {object} options - The options to use.
|
|
99
|
+
* @param {object} options.hmac - An HMAC API with `id`, `sign`, and `verify`
|
|
100
|
+
* properties.
|
|
101
|
+
* @param {object} options.hashedAttribute - The attribute with `name`,
|
|
102
|
+
* `value`, and optional `unique` property; `name` and `value` MUST be
|
|
103
|
+
* Uint8Arrays.
|
|
104
|
+
*
|
|
105
|
+
* @returns {Promise<object>} - Resolves to an object
|
|
106
|
+
* `{name, value, unique?}`.
|
|
107
|
+
*/
|
|
108
|
+
_blindHashedAttribute({ hmac, hashedAttribute }: any): Promise<any>;
|
|
109
|
+
_buildBlindAttributes({ hmac, doc, equal, has }: any): Promise<any[]>;
|
|
110
|
+
_getMatchingIndexes({ doc, equal, has }?: any): {
|
|
111
|
+
attributeValues: Map<any, any>;
|
|
112
|
+
simpleMatches: {
|
|
113
|
+
attribute: any;
|
|
114
|
+
unique: any;
|
|
115
|
+
}[];
|
|
116
|
+
compoundMatches: any[];
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Hashes a single attribute, converting its name and value into a hashed
|
|
120
|
+
* name and hashed value.
|
|
121
|
+
*
|
|
122
|
+
* @param {object} options - The options to use.
|
|
123
|
+
* @param {string} options.name - A name associated with a value.
|
|
124
|
+
* @param {any} options.value - The value associated with the name for the
|
|
125
|
+
* attribute.
|
|
126
|
+
*
|
|
127
|
+
* @returns {Promise<object>} - Resolves to an object `{name, value}`.
|
|
128
|
+
*/
|
|
129
|
+
_hashAttribute({ name, value }: any): Promise<{
|
|
130
|
+
name: Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
|
|
131
|
+
value: Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
|
|
132
|
+
}>;
|
|
133
|
+
/**
|
|
134
|
+
* Builds a hashed compound attribute from an array of hashed attributes
|
|
135
|
+
* via the given HMAC API.
|
|
136
|
+
*
|
|
137
|
+
* @param {object} options - The options to use.
|
|
138
|
+
* @param {Array} options.hashedAttributes - The hashed attributes that
|
|
139
|
+
* comprise the compound index.
|
|
140
|
+
* @param {number} [options.length=options.hashedAttributes.length] - The
|
|
141
|
+
* number of hashed attributes to go into the compound attribute
|
|
142
|
+
* (<= `hashedAttributes.length`).
|
|
143
|
+
*
|
|
144
|
+
* @returns {Promise<string>} - Resolves to the hashed compound attribute.
|
|
145
|
+
*/
|
|
146
|
+
_hashCompoundAttribute({ hashedAttributes, length }: any): Promise<{
|
|
147
|
+
name: Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
|
|
148
|
+
value: Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>;
|
|
149
|
+
}>;
|
|
150
|
+
_matchIndexes({ matchFn }?: any): {
|
|
151
|
+
simpleMatches: {
|
|
152
|
+
attribute: any;
|
|
153
|
+
unique: any;
|
|
154
|
+
}[];
|
|
155
|
+
compoundMatches: any[];
|
|
156
|
+
};
|
|
157
|
+
_matchDocument({ attribute, attributeValues, doc }: any): boolean;
|
|
158
|
+
_parseAttribute(attribute: any): any;
|
|
159
|
+
_dereferenceAttribute({ attribute, keys, doc }: any): any;
|
|
160
|
+
_prewarmCache({ attributes, hmac }: any): Promise<any[]>;
|
|
161
|
+
_cachedHmac({ hmac, data }: any): Promise<any>;
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=IndexHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IndexHelper.d.ts","sourceRoot":"","sources":["../src/IndexHelper.ts"],"names":[],"mapp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