@interop/was-client 0.35.1 → 0.36.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/README.md +22 -5
- package/dist/Collection.d.ts +5 -0
- package/dist/Collection.d.ts.map +1 -1
- package/dist/Collection.js +37 -4
- package/dist/Collection.js.map +1 -1
- package/dist/Resource.d.ts +4 -3
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +31 -20
- package/dist/Resource.js.map +1 -1
- package/dist/codec.d.ts +91 -4
- package/dist/codec.d.ts.map +1 -1
- package/dist/codec.js +10 -1
- package/dist/codec.js.map +1 -1
- package/dist/edv/EdvCodec.d.ts +29 -9
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +421 -40
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/WasTransport.d.ts +39 -2
- package/dist/edv/WasTransport.d.ts.map +1 -1
- package/dist/edv/WasTransport.js +82 -26
- package/dist/edv/WasTransport.js.map +1 -1
- package/dist/edv/docCipher.d.ts +55 -4
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +51 -5
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/index.d.ts +1 -1
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/errors.d.ts +11 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +11 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/features.d.ts +44 -1
- package/dist/internal/features.d.ts.map +1 -1
- package/dist/internal/features.js +39 -0
- package/dist/internal/features.js.map +1 -1
- package/dist/internal/write.d.ts +65 -12
- package/dist/internal/write.d.ts.map +1 -1
- package/dist/internal/write.js +71 -9
- package/dist/internal/write.js.map +1 -1
- package/package.json +1 -1
package/dist/edv/EdvCodec.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EdvClientCore } from '@interop/edv-client';
|
|
2
2
|
import type { IKeyAgreementKey, IKeyResolver } from '@interop/data-integrity-core';
|
|
3
|
-
import type { CodecIndexing,
|
|
3
|
+
import type { CodecIndexing, CodecRequestContext, CodecWrite, EncryptionProvider, ResourceCodec, ResponseLike } from '../codec.js';
|
|
4
4
|
import type { BlindingKey } from './hmacKey.js';
|
|
5
5
|
import type { Json, ResourceData, ResourceMetadataCustom } from '../types.js';
|
|
6
6
|
/**
|
|
@@ -25,12 +25,20 @@ export declare class EdvCodec implements ResourceCodec {
|
|
|
25
25
|
* into every envelope's `was.epoch`, which the decode side checks against
|
|
26
26
|
* the decrypting key's epoch unconditionally.
|
|
27
27
|
* @param options.contentType {string} stored envelope content type
|
|
28
|
-
* @param options.maxBlobBytes {number}
|
|
28
|
+
* @param options.maxBlobBytes {number} the size above which a binary write
|
|
29
|
+
* is routed to the chunked-stream path instead of one document
|
|
30
|
+
* @param [options.chunkSize] {number} the size of each encrypted chunk a
|
|
31
|
+
* routed write emits (defaults to the EDV core's 1 MiB). One chunk is one
|
|
32
|
+
* upload, so it must stay under the backend's `maxUploadBytes`; that
|
|
33
|
+
* constraint is not advertised through the feature probe, so it is the
|
|
34
|
+
* caller's to respect (see `createEdvEncryption`)
|
|
29
35
|
* @param options.idDerivation {string} how `add()` mints a document
|
|
30
36
|
* id: `'random'` (classic `generateId()`) or `'content'` (derived from the
|
|
31
37
|
* JWE ciphertext, content-addressed)
|
|
32
38
|
* @param [options.version] {number} the EDV-over-WAS scheme version to bind
|
|
33
39
|
* into each envelope's `was.v` (defaults to {@link EDV_SCHEME_VERSION})
|
|
40
|
+
* @param options.spaceId {string} the Space holding the Collection, for the
|
|
41
|
+
* chunked-stream path's own transport
|
|
34
42
|
* @param options.collectionId {string} the Collection this codec reads and
|
|
35
43
|
* writes: bound into the Collection metadata envelope's `was.collection`
|
|
36
44
|
* (and checked on read), and it labels decrypt-routing errors
|
|
@@ -40,15 +48,17 @@ export declare class EdvCodec implements ResourceCodec {
|
|
|
40
48
|
* @param [options.hmac] {BlindingKey} the collection's blinded-index key,
|
|
41
49
|
* where it declares one
|
|
42
50
|
*/
|
|
43
|
-
constructor({ edv, keyAgreementKey, readKeys, writeEpoch, contentType, maxBlobBytes, idDerivation, version, collectionId, epochIds, hmac }: {
|
|
51
|
+
constructor({ edv, keyAgreementKey, readKeys, writeEpoch, contentType, maxBlobBytes, chunkSize, idDerivation, version, spaceId, collectionId, epochIds, hmac }: {
|
|
44
52
|
edv: EdvClientCore;
|
|
45
53
|
keyAgreementKey: IKeyAgreementKey;
|
|
46
54
|
readKeys: IKeyAgreementKey[];
|
|
47
55
|
writeEpoch: string;
|
|
48
56
|
contentType: string;
|
|
49
57
|
maxBlobBytes: number;
|
|
58
|
+
chunkSize?: number;
|
|
50
59
|
idDerivation: 'random' | 'content';
|
|
51
60
|
version?: number;
|
|
61
|
+
spaceId: string;
|
|
52
62
|
collectionId: string;
|
|
53
63
|
epochIds: string[];
|
|
54
64
|
hmac?: BlindingKey | null;
|
|
@@ -71,11 +81,11 @@ export declare class EdvCodec implements ResourceCodec {
|
|
|
71
81
|
data: ResourceData;
|
|
72
82
|
contentType?: string;
|
|
73
83
|
current?: ResponseLike | null;
|
|
74
|
-
}): Promise<
|
|
84
|
+
}): Promise<CodecWrite>;
|
|
75
85
|
/**
|
|
76
86
|
* @inheritdoc
|
|
77
87
|
*/
|
|
78
|
-
decode(response: ResponseLike, expectedId?: string): Promise<Json | Blob>;
|
|
88
|
+
decode(response: ResponseLike, expectedId?: string, context?: CodecRequestContext): Promise<Json | Blob>;
|
|
79
89
|
/**
|
|
80
90
|
* @inheritdoc
|
|
81
91
|
*
|
|
@@ -146,10 +156,19 @@ export interface EdvKeys {
|
|
|
146
156
|
* defaults to `application/json`. Pass `JOSE_CONTENT_TYPE`
|
|
147
157
|
* (`application/jose+json`) against a server that registers an
|
|
148
158
|
* `application/*+json` parser.
|
|
149
|
-
* @param [options.maxBlobBytes] {number}
|
|
150
|
-
*
|
|
159
|
+
* @param [options.maxBlobBytes] {number} the size in raw bytes above which a
|
|
160
|
+
* binary `add()` is routed to the chunked-stream path instead of one document
|
|
161
|
+
* (default 512 KiB, sized so a single-document envelope stays under a
|
|
151
162
|
* server's ~1 MiB JSON body cap; raise it against a server with a larger
|
|
152
|
-
* limit)
|
|
163
|
+
* limit). A routing threshold, not a hard cap.
|
|
164
|
+
* @param [options.chunkSize] {number} the size of each encrypted chunk a
|
|
165
|
+
* routed write emits, in bytes (default 1 MiB). Each chunk is one upload, so
|
|
166
|
+
* it must stay under the backend's `maxUploadBytes` constraint (the
|
|
167
|
+
* encrypted chunk is somewhat larger than `chunkSize`, so leave headroom).
|
|
168
|
+
* This is not checked client-side: the shared backend probe reads the
|
|
169
|
+
* descriptor's affordance tokens, not its `constraints`, so a chunk over the
|
|
170
|
+
* limit is rejected by the server with a `PayloadTooLargeError` (413) and
|
|
171
|
+
* the failed write's document stub is then cleaned up.
|
|
153
172
|
* @param [options.idDerivation] {string} how `add()` mints a document id.
|
|
154
173
|
* `'random'` (default) is the classic mutable-document model: a random
|
|
155
174
|
* `generateId()` id, updated in place via `sequence`. `'content'` derives the
|
|
@@ -161,13 +180,14 @@ export interface EdvKeys {
|
|
|
161
180
|
* `put(id, ...)` path is unaffected either way.
|
|
162
181
|
* @returns {EncryptionProvider}
|
|
163
182
|
*/
|
|
164
|
-
export declare function createEdvEncryption({ resolveKeys, contentType, maxBlobBytes, idDerivation }: {
|
|
183
|
+
export declare function createEdvEncryption({ resolveKeys, contentType, maxBlobBytes, chunkSize, idDerivation }: {
|
|
165
184
|
resolveKeys: (ref: {
|
|
166
185
|
spaceId: string;
|
|
167
186
|
collectionId: string;
|
|
168
187
|
}) => Promise<EdvKeys | null>;
|
|
169
188
|
contentType?: string;
|
|
170
189
|
maxBlobBytes?: number;
|
|
190
|
+
chunkSize?: number;
|
|
171
191
|
idDerivation?: 'random' | 'content';
|
|
172
192
|
}): EncryptionProvider;
|
|
173
193
|
//# sourceMappingURL=EdvCodec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EdvCodec.d.ts","sourceRoot":"","sources":["../../src/edv/EdvCodec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EdvCodec.d.ts","sourceRoot":"","sources":["../../src/edv/EdvCodec.ts"],"names":[],"mappings":"AAoEA,OAAO,EAAE,aAAa,EAAe,MAAM,qBAAqB,CAAA;AAChE,OAAO,KAAK,EAGV,gBAAgB,EAChB,YAAY,EAEb,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAGV,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,kBAAkB,EAElB,aAAa,EACb,YAAY,EACb,MAAM,aAAa,CAAA;AAmBpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAO/C,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAgJ7E;;;;GAIG;AACH,qBAAa,QAAS,YAAW,aAAa;;IAC5C,QAAQ,CAAC,iBAAiB,QAAO;IAmFjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;gBACS,EACV,GAAG,EACH,eAAe,EACf,QAAQ,EACR,UAAU,EACV,WAAW,EACX,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,OAAO,EACP,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,IAAI,EACL,EAAE;QACD,GAAG,EAAE,aAAa,CAAA;QAClB,eAAe,EAAE,gBAAgB,CAAA;QACjC,QAAQ,EAAE,gBAAgB,EAAE,CAAA;QAC5B,UAAU,EAAE,MAAM,CAAA;QAClB,WAAW,EAAE,MAAM,CAAA;QACnB,YAAY,EAAE,MAAM,CAAA;QACpB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,YAAY,EAAE,QAAQ,GAAG,SAAS,CAAA;QAClC,OAAO,CAAC,EAAE,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