@interop/was-client 0.42.0 → 0.44.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 +17 -21
- package/dist/codec.d.ts +6 -1
- package/dist/codec.d.ts.map +1 -1
- package/dist/codec.js.map +1 -1
- package/dist/edv/EdvCodec.d.ts +45 -7
- package/dist/edv/EdvCodec.d.ts.map +1 -1
- package/dist/edv/EdvCodec.js +70 -29
- package/dist/edv/EdvCodec.js.map +1 -1
- package/dist/edv/constants.d.ts +0 -8
- package/dist/edv/constants.d.ts.map +1 -1
- package/dist/edv/constants.js +0 -8
- package/dist/edv/constants.js.map +1 -1
- package/dist/edv/docCipher.d.ts.map +1 -1
- package/dist/edv/docCipher.js +12 -9
- package/dist/edv/docCipher.js.map +1 -1
- package/dist/edv/index.d.ts +2 -2
- package/dist/edv/index.d.ts.map +1 -1
- package/dist/edv/index.js +1 -1
- package/dist/edv/index.js.map +1 -1
- package/dist/errors.d.ts +0 -10
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +0 -10
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/log/index.d.ts +16 -18
- package/dist/log/index.d.ts.map +1 -1
- package/dist/log/index.js +16 -16
- package/dist/log/index.js.map +1 -1
- package/dist/log/logStore.d.ts +31 -81
- package/dist/log/logStore.d.ts.map +1 -1
- package/dist/log/logStore.js +53 -64
- package/dist/log/logStore.js.map +1 -1
- package/package.json +3 -2
- package/dist/log/jsonl.d.ts +0 -49
- package/dist/log/jsonl.d.ts.map +0 -1
- package/dist/log/jsonl.js +0 -60
- package/dist/log/jsonl.js.map +0 -1
package/dist/edv/docCipher.js
CHANGED
|
@@ -3,7 +3,6 @@ import { DECODER, storedResponse } from '../internal/content.js';
|
|
|
3
3
|
import { EMPTY_INDEX_SCHEMA, readIndexSchema } from '../internal/indexSchema.js';
|
|
4
4
|
import { EncryptOnlyCipherError, KeyUnwrapError, ValidationError } from '../errors.js';
|
|
5
5
|
import { buildEdvCodec, encryptOnlyEdvCodec } from './EdvCodec.js';
|
|
6
|
-
import { LOCAL_SPACE_ID } from './constants.js';
|
|
7
6
|
// `isEncryptedEnvelope` and the `DocCipher` interface live in the crypto-free
|
|
8
7
|
// `../sync` module, and the decrypt-routing signals (`UnknownEpochError` for a
|
|
9
8
|
// stale descriptor, `KeyUnwrapError` for a reader that is not a recipient of
|
|
@@ -90,7 +89,6 @@ export async function createEdvDocCipher({ keyAgreementKey, keyResolver, collect
|
|
|
90
89
|
let codec;
|
|
91
90
|
try {
|
|
92
91
|
codec = await buildEdvCodec({
|
|
93
|
-
spaceId: LOCAL_SPACE_ID,
|
|
94
92
|
collectionId,
|
|
95
93
|
encryption,
|
|
96
94
|
keys: { keyAgreementKey, keyResolver },
|
|
@@ -159,15 +157,20 @@ function docCipherOverCodec({ codec, collectionId }) {
|
|
|
159
157
|
'a Collection handle, or split it before encrypting.');
|
|
160
158
|
}
|
|
161
159
|
const encoded = write;
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
// Read `envelope` first and never touch `body` when it is there: the EDV
|
|
161
|
+
// codec exposes `body` as a lazy getter, so testing it would serialize the
|
|
162
|
+
// wire bytes this path has no use for.
|
|
163
|
+
let envelope;
|
|
164
|
+
if (encoded.envelope !== undefined) {
|
|
165
|
+
envelope = encoded.envelope;
|
|
166
|
+
}
|
|
167
|
+
else if (encoded.body instanceof Uint8Array) {
|
|
168
|
+
// A codec that surfaces no object form: parse the wire bytes.
|
|
169
|
+
envelope = JSON.parse(DECODER.decode(encoded.body));
|
|
170
|
+
}
|
|
171
|
+
if (typeof encoded.id !== 'string' || envelope === undefined) {
|
|
164
172
|
throw new Error(`EDV encrypt for collection "${collectionId}" returned no id/envelope body.`);
|
|
165
173
|
}
|
|
166
|
-
// Prefer the object form the codec already holds; parse the wire bytes only
|
|
167
|
-
// when a codec does not surface it.
|
|
168
|
-
const envelope = encoded.envelope !== undefined
|
|
169
|
-
? encoded.envelope
|
|
170
|
-
: JSON.parse(DECODER.decode(encoded.body));
|
|
171
174
|
return {
|
|
172
175
|
id: encoded.id,
|
|
173
176
|
envelope,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docCipher.js","sourceRoot":"","sources":["../../src/edv/docCipher.ts"],"names":[],"mappings":"AAiDA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAChF,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,eAAe,EAChB,MAAM,cAAc,CAAA;AAGrB,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"docCipher.js","sourceRoot":"","sources":["../../src/edv/docCipher.ts"],"names":[],"mappings":"AAiDA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAChF,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,eAAe,EAChB,MAAM,cAAc,CAAA;AAGrB,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAIlE,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,qEAAqE;AACrE,8EAA8E;AAC9E,iBAAiB;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EAClB,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,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,CAAC,CAAC,CAAS,CAAA;QAC/D,CAAC;KACF,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAAC,EAClD,YAAY,EACZ,YAAY,GAAG,SAAS,EACxB,UAAU,EAKX;IACC,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC;QACtC,YAAY;QACZ,YAAY;QACZ,UAAU;KACX,CAAC,CAAA;IACF,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,kBAAkB,CAAC;QACpD,KAAK;QACL,YAAY;KACb,CAAC,CAAA;IACF,OAAO;QACL,OAAO;QACP,aAAa;QACb,KAAK,CAAC,OAAO;YACX,MAAM,IAAI,sBAAsB,CAC9B,4CAA4C,YAAY,YAAY;gBAClE,kEAAkE;gBAClE,mDAAmD;gBACnD,wDAAwD,CAC3D,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/edv/index.d.ts
CHANGED
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
* recipient key is always derived from an identifier both sides already hold
|
|
43
43
|
* rather than transmitted.
|
|
44
44
|
*/
|
|
45
|
-
export { createEdvEncryption, EdvCodec } from './EdvCodec.js';
|
|
46
|
-
export type { EdvKeys } from './EdvCodec.js';
|
|
45
|
+
export { createEdvEncryption, EdvCodec, wasTransportFactory } from './EdvCodec.js';
|
|
46
|
+
export type { CodecTransportFactory, EdvKeys } from './EdvCodec.js';
|
|
47
47
|
export { WasTransport } from './WasTransport.js';
|
|
48
48
|
export { EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE } from './constants.js';
|
|
49
49
|
export { ensureFirstEpoch, initRecipients, addRecipient, removeRecipient, replaceRecipient } from './recipients.js';
|
package/dist/edv/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GA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ClB,6BAA6B,EAC7B,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/edv/index.js
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
* recipient key is always derived from an identifier both sides already hold
|
|
43
43
|
* rather than transmitted.
|
|
44
44
|
*/
|
|
45
|
-
export { createEdvEncryption, EdvCodec } from './EdvCodec.js';
|
|
45
|
+
export { createEdvEncryption, EdvCodec, wasTransportFactory } from './EdvCodec.js';
|
|
46
46
|
export { WasTransport } from './WasTransport.js';
|
|
47
47
|
export { EDV_SCHEME_VERSION, JOSE_CONTENT_TYPE } from './constants.js';
|
|
48
48
|
export { ensureFirstEpoch, initRecipients, addRecipient, removeRecipient, replaceRecipient } from './recipients.js';
|
package/dist/edv/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/edv/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,OAAO,EACL,mBAAmB,EACnB,QAAQ,EACR,mBAAmB,EACpB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EACjB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,eAAe,EACf,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,eAAe,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACf,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,gBAAgB,CAAA"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -85,16 +85,6 @@ export declare class ConflictError extends WasError {
|
|
|
85
85
|
export declare class PreconditionFailedError extends WasError {
|
|
86
86
|
name: string;
|
|
87
87
|
}
|
|
88
|
-
/**
|
|
89
|
-
* A resource-log append was acknowledged by the host but the read-back did not
|
|
90
|
-
* contain the appended entry (the profile's "acknowledgement is a promise"
|
|
91
|
-
* rule): the served log is shorter than the appended entry's ordinal, or the
|
|
92
|
-
* entry at that ordinal differs from what was written. Recover by re-reading,
|
|
93
|
-
* re-verifying, and re-appending on the current head.
|
|
94
|
-
*/
|
|
95
|
-
export declare class LogNotConfirmedError extends WasError {
|
|
96
|
-
name: string;
|
|
97
|
-
}
|
|
98
88
|
/**
|
|
99
89
|
* A single upload exceeded the target backend's `maxUploadBytes` constraint
|
|
100
90
|
* (HTTP 413). Unlike `QuotaExceededError`, this is per-request -- a smaller
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,MAAM,WAAW,eAAe;IA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G;AACH,qBAAa,cAAe,SAAQ,eAAe;IACxC,IAAI,SAAmB;CACjC;AAED;;;;;;;;;;GAUG;AACH,qBAAa,cAAe,SAAQ,eAAe;IACxC,IAAI,SAAmB;CACjC;AAED;;;;;;;;;GASG;AACH,qBAAa,sBAAuB,SAAQ,eAAe;IAChD,IAAI,SAA2B;CACzC;AAED;;;;;;;;GAQG;AACH,qBAAa,oBAAqB,SAAQ,uBAAuB;gBAE7D,OAAO,SAA+C,EACtD,OAAO,GAAE,eAAoB;CAKhC;AAED;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;gBAEnD,OAAO,SAA4B,EACnC,OAAO,GAAE,eAAoB;CAKhC;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,gBAAiB,SAAQ,iBAAiB;gBACzC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAO1D;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IACjC,IAAI,SAAmB;CACjC;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,EACV,YAAY,EACZ,IAAI,EACL,EAAE;QACD,YAAY,EAAE,MAAM,CAAA;QACpB,IAAI,EAAE,MAAM,EAAE,CAAA;KACf;CAUF;AA4DD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAG3D;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAEjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,CA2D/C"}
|
package/dist/errors.js
CHANGED
|
@@ -88,16 +88,6 @@ export class ConflictError extends WasError {
|
|
|
88
88
|
export class PreconditionFailedError extends WasError {
|
|
89
89
|
name = 'PreconditionFailedError';
|
|
90
90
|
}
|
|
91
|
-
/**
|
|
92
|
-
* A resource-log append was acknowledged by the host but the read-back did not
|
|
93
|
-
* contain the appended entry (the profile's "acknowledgement is a promise"
|
|
94
|
-
* rule): the served log is shorter than the appended entry's ordinal, or the
|
|
95
|
-
* entry at that ordinal differs from what was written. Recover by re-reading,
|
|
96
|
-
* re-verifying, and re-appending on the current head.
|
|
97
|
-
*/
|
|
98
|
-
export class LogNotConfirmedError extends WasError {
|
|
99
|
-
name = 'LogNotConfirmedError';
|
|
100
|
-
}
|
|
101
91
|
/**
|
|
102
92
|
* A single upload exceeded the target backend's `maxUploadBytes` constraint
|
|
103
93
|
* (HTTP 413). Unlike `QuotaExceededError`, this is per-request -- a smaller
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAmBpD;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,MAAM,CAAS;IACf,IAAI,CAAS;IACb,KAAK,CAAS;IACd,OAAO,CAAW;IAClB,UAAU,CAAS;IAEnB,YAAY,OAAe,EAAE,UAA2B,EAAE;QACxD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;QACnE,KAAK,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;QAC3D,IAAI,CAAC,IAAI,GAAG,UAAU,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UA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AAG;YACN,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC9C,KAAK,GAAG;YACN,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC5C,KAAK,GAAG;YACN,OAAO,IAAI,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACtD,KAAK,GAAG;YACN,OAAO,IAAI,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACnD,KAAK,GAAG;YACN,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAClD,KAAK,GAAG;YACN,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QAChD,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;IAED,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACvC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { parseSpaceTarget } from './internal/paths.js';
|
|
|
13
13
|
export type { ParsedSpacePath } from './internal/paths.js';
|
|
14
14
|
export { readEtag, writeHeaders } from './internal/conditional.js';
|
|
15
15
|
export type { WritePrecondition } from './internal/conditional.js';
|
|
16
|
-
export { WasError, NotFoundError, ValidationError, AuthRequiredError, NotImplementedError, NotSupportedError, ConflictError, PreconditionFailedError,
|
|
16
|
+
export { WasError, NotFoundError, ValidationError, AuthRequiredError, NotImplementedError, NotSupportedError, ConflictError, PreconditionFailedError, PayloadTooLargeError, QuotaExceededError, EncryptionError, EncryptOnlyCipherError, KeyUnwrapError, IntegrityError, WasSyncAuthError, WasSyncConflictError, WasSyncNotFoundError, WasServerError, mapError } from './errors.js';
|
|
17
17
|
export type { FeatureProbe } from './internal/features.js';
|
|
18
18
|
export { isChunkedWrite } from './codec.js';
|
|
19
19
|
export type { ResourceCodec, EncryptionProvider, ChunkedWrite, CodecRequestContext, CodecWrite, EncodedWrite, ResponseLike, BlindedQuery, CodecIndexing, IndexDeclaration, IndexSchema } from './codec.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAElE,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,YAAY,EAAE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,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,cAAc,EACd,OAAO,EACR,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,6 @@ export { Collection } from './Collection.js';
|
|
|
11
11
|
export { Resource } from './Resource.js';
|
|
12
12
|
export { parseSpaceTarget } from './internal/paths.js';
|
|
13
13
|
export { readEtag, writeHeaders } from './internal/conditional.js';
|
|
14
|
-
export { WasError, NotFoundError, ValidationError, AuthRequiredError, NotImplementedError, NotSupportedError, ConflictError, PreconditionFailedError,
|
|
14
|
+
export { WasError, NotFoundError, ValidationError, AuthRequiredError, NotImplementedError, NotSupportedError, ConflictError, PreconditionFailedError, PayloadTooLargeError, QuotaExceededError, EncryptionError, EncryptOnlyCipherError, KeyUnwrapError, IntegrityError, WasSyncAuthError, WasSyncConflictError, WasSyncNotFoundError, WasServerError, mapError } from './errors.js';
|
|
15
15
|
export { isChunkedWrite } from './codec.js';
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAGlE,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAGlE,OAAO,EACL,QAAQ,EACR,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACT,MAAM,aAAa,CAAA;AAIpB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/log/index.d.ts
CHANGED
|
@@ -2,23 +2,21 @@
|
|
|
2
2
|
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* The `@interop/was-client/log` subpath entry:
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
5
|
+
* The `@interop/was-client/log` subpath entry: the WAS binding of
|
|
6
|
+
* `@interop/vh-resource-log`'s store port -- `resourceLogStore` maps the
|
|
7
|
+
* port's read-with-etag, compare-and-swap append, and guarded genesis create
|
|
8
|
+
* onto one WAS Resource's conditional writes, rethrowing a lost race as the
|
|
9
|
+
* library's `ResourceLogConflictError`. Everything else about resource logs
|
|
10
|
+
* (the Resource Log Profile, encrypted-collections-spec
|
|
11
|
+
* `#resource-log-profile`) lives in that library: the JSON Lines codec, the
|
|
12
|
+
* `ResourceLogStore` port itself, the read-back `confirmAppend`, chain
|
|
13
|
+
* verification, and the chain-head pin. The wire types live in
|
|
14
|
+
* `@interop/storage-core`. This subpath re-exports none of them: one owner
|
|
15
|
+
* per name.
|
|
16
|
+
*
|
|
17
|
+
* The subpath stays off the `/edv` graph. It is no longer crypto-free: the
|
|
18
|
+
* library's graph includes `@interop/did-method-webvh` and `@noble/curves`
|
|
19
|
+
* -- the hashing and proof kernel only, with no DID resolution.
|
|
17
20
|
*/
|
|
18
|
-
export {
|
|
19
|
-
export { LOG_CONTENT_TYPE, resourceLogStore, confirmAppend } from './logStore.js';
|
|
20
|
-
export type { ResourceLogStore } from './logStore.js';
|
|
21
|
-
export { LogNotConfirmedError } from '../errors.js';
|
|
22
|
-
export { RESOURCE_LOG_METHOD } from '@interop/storage-core';
|
|
23
|
-
export type { ResourceLogEntry, ResourceLogEntryProof, ResourceLogGenesisParameters, ResourceLogTerminalParameters, ResourceLogParameters } from '@interop/storage-core';
|
|
21
|
+
export { LOG_CONTENT_TYPE, resourceLogStore } from './logStore.js';
|
|
24
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/log/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/log/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/log/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/log/index.js
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* The `@interop/was-client/log` subpath entry:
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
5
|
+
* The `@interop/was-client/log` subpath entry: the WAS binding of
|
|
6
|
+
* `@interop/vh-resource-log`'s store port -- `resourceLogStore` maps the
|
|
7
|
+
* port's read-with-etag, compare-and-swap append, and guarded genesis create
|
|
8
|
+
* onto one WAS Resource's conditional writes, rethrowing a lost race as the
|
|
9
|
+
* library's `ResourceLogConflictError`. Everything else about resource logs
|
|
10
|
+
* (the Resource Log Profile, encrypted-collections-spec
|
|
11
|
+
* `#resource-log-profile`) lives in that library: the JSON Lines codec, the
|
|
12
|
+
* `ResourceLogStore` port itself, the read-back `confirmAppend`, chain
|
|
13
|
+
* verification, and the chain-head pin. The wire types live in
|
|
14
|
+
* `@interop/storage-core`. This subpath re-exports none of them: one owner
|
|
15
|
+
* per name.
|
|
16
|
+
*
|
|
17
|
+
* The subpath stays off the `/edv` graph. It is no longer crypto-free: the
|
|
18
|
+
* library's graph includes `@interop/did-method-webvh` and `@noble/curves`
|
|
19
|
+
* -- the hashing and proof kernel only, with no DID resolution.
|
|
17
20
|
*/
|
|
18
|
-
export {
|
|
19
|
-
export { LOG_CONTENT_TYPE, resourceLogStore, confirmAppend } from './logStore.js';
|
|
20
|
-
export { LogNotConfirmedError } from '../errors.js';
|
|
21
|
-
export { RESOURCE_LOG_METHOD } from '@interop/storage-core';
|
|
21
|
+
export { LOG_CONTENT_TYPE, resourceLogStore } from './logStore.js';
|
|
22
22
|
//# sourceMappingURL=index.js.map
|
package/dist/log/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/log/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/log/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/log/logStore.d.ts
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The WAS binding of `@interop/vh-resource-log`'s store port: the log is a
|
|
6
|
+
* WAS Resource's entire body, stored as `text/jsonl`, with the port's
|
|
7
|
+
* read-with-etag, compare-and-swap append, and guarded genesis create mapped
|
|
8
|
+
* onto the resource's conditional writes. The hosting collection may be
|
|
9
|
+
* plaintext or encrypted: a conditional codec pins the write to the `ifMatch`
|
|
10
|
+
* this store passes rather than to the ETag its own pre-read observed, so the
|
|
11
|
+
* append profile's compare-and-swap holds either way. On an encrypted host
|
|
12
|
+
* the resource id must be one the codec mints, since the EDV codec refuses to
|
|
13
|
+
* create a document under a human-readable id.
|
|
14
|
+
*
|
|
15
|
+
* Both the append and the create ride the backend's `conditional-writes`
|
|
16
|
+
* feature -- the profile requires it (without the precondition, concurrent
|
|
17
|
+
* appends silently overwrite one another instead of failing into the caller's
|
|
18
|
+
* rebase-and-retry loop). A lost race -- a stale `ifMatch`, or a guarded
|
|
19
|
+
* create against a log that already exists -- is rethrown as the library's
|
|
20
|
+
* `ResourceLogConflictError` with the transport's `PreconditionFailedError`
|
|
21
|
+
* as `cause`, which is the port's one conflict signal and what the library's
|
|
22
|
+
* rebase loop catches (by `name`, never `instanceof` -- the error crosses the
|
|
23
|
+
* adapter-to-library package boundary).
|
|
24
|
+
*/
|
|
25
|
+
import { type ResourceLogStore } from '@interop/vh-resource-log';
|
|
2
26
|
import type { Resource } from '../Resource.js';
|
|
3
27
|
/**
|
|
4
28
|
* The content type a resource log is stored under (JSON Lines, not JSON --
|
|
@@ -7,63 +31,12 @@ import type { Resource } from '../Resource.js';
|
|
|
7
31
|
*/
|
|
8
32
|
export declare const LOG_CONTENT_TYPE = "text/jsonl";
|
|
9
33
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Reads the full log together with the opaque `etag` validator the next
|
|
18
|
-
* {@link append} must be compare-and-swapped against. Resolves `null` when
|
|
19
|
-
* the log resource does not exist yet (the pre-genesis state -- see
|
|
20
|
-
* {@link create}); throws on a body that does not parse as strict JSON
|
|
21
|
-
* Lines. `etag` is absent against a backend that does not version resources
|
|
22
|
-
* -- a caller MUST NOT append without one (the profile forbids falling back
|
|
23
|
-
* to an unconditional write).
|
|
24
|
-
*
|
|
25
|
-
* @returns {Promise<{ entries: ResourceLogEntry[]; etag?: string } | null>}
|
|
26
|
-
*/
|
|
27
|
-
read(): Promise<{
|
|
28
|
-
entries: ResourceLogEntry[];
|
|
29
|
-
etag?: string;
|
|
30
|
-
} | null>;
|
|
31
|
-
/**
|
|
32
|
-
* Appends one entry to the log read by the most recent {@link read} on this
|
|
33
|
-
* store instance, compare-and-swapped against `ifMatch` (the validator that
|
|
34
|
-
* read returned); a stale validator throws `PreconditionFailedError` (412),
|
|
35
|
-
* and the caller re-reads, re-verifies, rebases the entry on the new head,
|
|
36
|
-
* and retries. The prior entries' bytes are carried forward verbatim from
|
|
37
|
-
* the read, with the new entry's line appended -- an append never
|
|
38
|
-
* re-serializes history.
|
|
39
|
-
*
|
|
40
|
-
* @param entry {ResourceLogEntry} the entry extending the log
|
|
41
|
-
* @param options {object}
|
|
42
|
-
* @param options.ifMatch {string} the validator from the prior read
|
|
43
|
-
* @returns {Promise<void>}
|
|
44
|
-
*/
|
|
45
|
-
append(entry: ResourceLogEntry, options: {
|
|
46
|
-
ifMatch: string;
|
|
47
|
-
}): Promise<void>;
|
|
48
|
-
/**
|
|
49
|
-
* Creates the log with its genesis entry where {@link read} resolved `null`,
|
|
50
|
-
* guarded create-if-absent (`If-None-Match: *`); throws
|
|
51
|
-
* `PreconditionFailedError` (412) when a concurrent writer created the log
|
|
52
|
-
* first.
|
|
53
|
-
*
|
|
54
|
-
* @param entry {ResourceLogEntry} the genesis entry
|
|
55
|
-
* @returns {Promise<void>}
|
|
56
|
-
*/
|
|
57
|
-
create(entry: ResourceLogEntry): Promise<void>;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* The WAS Resource adapter: the log is the resource's entire body, stored as
|
|
61
|
-
* `text/jsonl`. The hosting collection may be plaintext or encrypted: a
|
|
62
|
-
* conditional codec pins the write to the `ifMatch` this store passes rather
|
|
63
|
-
* than to the ETag its own pre-read observed, so the append profile's
|
|
64
|
-
* compare-and-swap holds either way. On an encrypted host the resource id must
|
|
65
|
-
* be one the codec mints, since the EDV codec refuses to create a document
|
|
66
|
-
* under a human-readable id.
|
|
34
|
+
* The WAS Resource adapter implementing the library's `ResourceLogStore`
|
|
35
|
+
* port. `read` keeps the Blob / text body handling (a React Native Blob has
|
|
36
|
+
* no `text()`; `blobText` falls back to `FileReader`), `append` carries the
|
|
37
|
+
* prior entries' bytes forward verbatim from the most recent read (an append
|
|
38
|
+
* never re-serializes history), and both `append` and `create` translate the
|
|
39
|
+
* transport's 412 into the library's conflict error.
|
|
67
40
|
*
|
|
68
41
|
* @param options {object}
|
|
69
42
|
* @param options.resource {Resource}
|
|
@@ -72,27 +45,4 @@ export interface ResourceLogStore {
|
|
|
72
45
|
export declare function resourceLogStore({ resource }: {
|
|
73
46
|
resource: Resource;
|
|
74
47
|
}): ResourceLogStore;
|
|
75
|
-
/**
|
|
76
|
-
* The profile's "acknowledgement is a promise" rule, mechanically: after an
|
|
77
|
-
* acked {@link ResourceLogStore.append} (or `create`), reads the log back and
|
|
78
|
-
* checks the served history actually contains the written entry at its
|
|
79
|
-
* ordinal, throwing {@link LogNotConfirmedError} when it does not (the log is
|
|
80
|
-
* missing, shorter than the entry's ordinal, or holds a different entry
|
|
81
|
-
* there). Returns the read-back log so the caller can run full chain
|
|
82
|
-
* verification over exactly what was confirmed -- containment here is a
|
|
83
|
-
* byte-level check (JCS equality), not a verification.
|
|
84
|
-
*
|
|
85
|
-
* @param options {object}
|
|
86
|
-
* @param options.store {ResourceLogStore}
|
|
87
|
-
* @param options.entry {ResourceLogEntry} the entry the append wrote
|
|
88
|
-
* @returns {Promise<{ entries: ResourceLogEntry[]; etag?: string }>} the
|
|
89
|
-
* read-back log containing the entry
|
|
90
|
-
*/
|
|
91
|
-
export declare function confirmAppend({ store, entry }: {
|
|
92
|
-
store: ResourceLogStore;
|
|
93
|
-
entry: ResourceLogEntry;
|
|
94
|
-
}): Promise<{
|
|
95
|
-
entries: ResourceLogEntry[];
|
|
96
|
-
etag?: string;
|
|
97
|
-
}>;
|
|
98
48
|
//# sourceMappingURL=logStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logStore.d.ts","sourceRoot":"","sources":["../../src/log/logStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logStore.d.ts","sourceRoot":"","sources":["../../src/log/logStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAK9C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,eAAe,CAAA;AAE5C;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACT,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAA;CACnB,GAAG,gBAAgB,CA6EnB"}
|
package/dist/log/logStore.js
CHANGED
|
@@ -2,28 +2,30 @@
|
|
|
2
2
|
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* The
|
|
6
|
-
*
|
|
7
|
-
* etag, and
|
|
8
|
-
* the
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
5
|
+
* The WAS binding of `@interop/vh-resource-log`'s store port: the log is a
|
|
6
|
+
* WAS Resource's entire body, stored as `text/jsonl`, with the port's
|
|
7
|
+
* read-with-etag, compare-and-swap append, and guarded genesis create mapped
|
|
8
|
+
* onto the resource's conditional writes. The hosting collection may be
|
|
9
|
+
* plaintext or encrypted: a conditional codec pins the write to the `ifMatch`
|
|
10
|
+
* this store passes rather than to the ETag its own pre-read observed, so the
|
|
11
|
+
* append profile's compare-and-swap holds either way. On an encrypted host
|
|
12
|
+
* the resource id must be one the codec mints, since the EDV codec refuses to
|
|
13
|
+
* create a document under a human-readable id.
|
|
13
14
|
*
|
|
14
15
|
* Both the append and the create ride the backend's `conditional-writes`
|
|
15
16
|
* feature -- the profile requires it (without the precondition, concurrent
|
|
16
17
|
* appends silently overwrite one another instead of failing into the caller's
|
|
17
|
-
* rebase-and-retry loop).
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* rebase-and-retry loop). A lost race -- a stale `ifMatch`, or a guarded
|
|
19
|
+
* create against a log that already exists -- is rethrown as the library's
|
|
20
|
+
* `ResourceLogConflictError` with the transport's `PreconditionFailedError`
|
|
21
|
+
* as `cause`, which is the port's one conflict signal and what the library's
|
|
22
|
+
* rebase loop catches (by `name`, never `instanceof` -- the error crosses the
|
|
23
|
+
* adapter-to-library package boundary).
|
|
21
24
|
*/
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
25
|
+
import { ResourceLogConflictError, parseResourceLog, serializeResourceLog, serializeResourceLogEntry } from '@interop/vh-resource-log';
|
|
26
|
+
import { PreconditionFailedError, ValidationError } from '../errors.js';
|
|
24
27
|
import { blobText } from '../internal/blob.js';
|
|
25
28
|
import { ENCODER, isBlob } from '../internal/content.js';
|
|
26
|
-
import { parseResourceLog, serializeResourceLog, serializeResourceLogEntry } from './jsonl.js';
|
|
27
29
|
/**
|
|
28
30
|
* The content type a resource log is stored under (JSON Lines, not JSON --
|
|
29
31
|
* load-bearing: a JSON content type would have the request layer parse and
|
|
@@ -31,13 +33,12 @@ import { parseResourceLog, serializeResourceLog, serializeResourceLogEntry } fro
|
|
|
31
33
|
*/
|
|
32
34
|
export const LOG_CONTENT_TYPE = 'text/jsonl';
|
|
33
35
|
/**
|
|
34
|
-
* The WAS Resource adapter
|
|
35
|
-
* `
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* under a human-readable id.
|
|
36
|
+
* The WAS Resource adapter implementing the library's `ResourceLogStore`
|
|
37
|
+
* port. `read` keeps the Blob / text body handling (a React Native Blob has
|
|
38
|
+
* no `text()`; `blobText` falls back to `FileReader`), `append` carries the
|
|
39
|
+
* prior entries' bytes forward verbatim from the most recent read (an append
|
|
40
|
+
* never re-serializes history), and both `append` and `create` translate the
|
|
41
|
+
* transport's 412 into the library's conflict error.
|
|
41
42
|
*
|
|
42
43
|
* @param options {object}
|
|
43
44
|
* @param options.resource {Resource}
|
|
@@ -75,53 +76,41 @@ export function resourceLogStore({ resource }) {
|
|
|
75
76
|
}
|
|
76
77
|
const separator = lastReadBody.endsWith('\n') ? '' : '\n';
|
|
77
78
|
const extended = lastReadBody + separator + serializeResourceLogEntry(entry) + '\n';
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
try {
|
|
80
|
+
await resource.put(ENCODER.encode(extended), {
|
|
81
|
+
contentType: LOG_CONTENT_TYPE,
|
|
82
|
+
ifMatch
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
// However the 412 was minted (problem type or status fallback), and
|
|
87
|
+
// including the WasSyncConflictError subtype, it is the port's CAS
|
|
88
|
+
// conflict, not an error: the library's rebase loop re-reads,
|
|
89
|
+
// re-verifies, and retries on it.
|
|
90
|
+
if (err instanceof PreconditionFailedError) {
|
|
91
|
+
throw new ResourceLogConflictError('Resource-log append lost its compare-and-swap: the validator ' +
|
|
92
|
+
'is stale.', { cause: err });
|
|
93
|
+
}
|
|
94
|
+
throw err;
|
|
95
|
+
}
|
|
82
96
|
lastReadBody = extended;
|
|
83
97
|
},
|
|
84
98
|
async create(entry) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
99
|
+
try {
|
|
100
|
+
await resource.put(ENCODER.encode(serializeResourceLog([entry])), {
|
|
101
|
+
contentType: LOG_CONTENT_TYPE,
|
|
102
|
+
ifNoneMatch: true
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
if (err instanceof PreconditionFailedError) {
|
|
107
|
+
throw new ResourceLogConflictError('Resource-log create lost its guarded-create race: the log ' +
|
|
108
|
+
'already exists.', { cause: err });
|
|
109
|
+
}
|
|
110
|
+
throw err;
|
|
111
|
+
}
|
|
89
112
|
lastReadBody = serializeResourceLog([entry]);
|
|
90
113
|
}
|
|
91
114
|
};
|
|
92
115
|
}
|
|
93
|
-
/**
|
|
94
|
-
* The profile's "acknowledgement is a promise" rule, mechanically: after an
|
|
95
|
-
* acked {@link ResourceLogStore.append} (or `create`), reads the log back and
|
|
96
|
-
* checks the served history actually contains the written entry at its
|
|
97
|
-
* ordinal, throwing {@link LogNotConfirmedError} when it does not (the log is
|
|
98
|
-
* missing, shorter than the entry's ordinal, or holds a different entry
|
|
99
|
-
* there). Returns the read-back log so the caller can run full chain
|
|
100
|
-
* verification over exactly what was confirmed -- containment here is a
|
|
101
|
-
* byte-level check (JCS equality), not a verification.
|
|
102
|
-
*
|
|
103
|
-
* @param options {object}
|
|
104
|
-
* @param options.store {ResourceLogStore}
|
|
105
|
-
* @param options.entry {ResourceLogEntry} the entry the append wrote
|
|
106
|
-
* @returns {Promise<{ entries: ResourceLogEntry[]; etag?: string }>} the
|
|
107
|
-
* read-back log containing the entry
|
|
108
|
-
*/
|
|
109
|
-
export async function confirmAppend({ store, entry }) {
|
|
110
|
-
const ordinal = Number.parseInt(entry.versionId, 10);
|
|
111
|
-
if (!Number.isInteger(ordinal) || ordinal < 1) {
|
|
112
|
-
throw new ValidationError(`Cannot confirm append: the entry's versionId "${entry.versionId}" ` +
|
|
113
|
-
'does not start with a 1-based ordinal.');
|
|
114
|
-
}
|
|
115
|
-
const current = await store.read();
|
|
116
|
-
if (current === null) {
|
|
117
|
-
throw new LogNotConfirmedError('Resource-log append not confirmed: the log resource is missing on ' +
|
|
118
|
-
'read-back.');
|
|
119
|
-
}
|
|
120
|
-
const served = current.entries[ordinal - 1];
|
|
121
|
-
if (served === undefined || canonicalize(served) !== canonicalize(entry)) {
|
|
122
|
-
throw new LogNotConfirmedError(`Resource-log append not confirmed: the served log does not contain ` +
|
|
123
|
-
`the appended entry at ordinal ${ordinal}.`);
|
|
124
|
-
}
|
|
125
|
-
return current;
|
|
126
|
-
}
|
|
127
116
|
//# sourceMappingURL=logStore.js.map
|