@interop/was-client 0.43.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/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/README.md
CHANGED
|
@@ -901,27 +901,23 @@ Collection-handle write does; a cipher built without it writes documents
|
|
|
901
901
|
|
|
902
902
|
### Resource logs (co-managed key resources)
|
|
903
903
|
|
|
904
|
-
The opt-in `@interop/was-client/log` subpath is the
|
|
905
|
-
logs -- the hash-linked, JSON
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
the
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
the append as durable.
|
|
922
|
-
|
|
923
|
-
The subpath is crypto-free and re-exports the wire types (`ResourceLogEntry` et
|
|
924
|
-
al.) from `@interop/storage-core`.
|
|
904
|
+
The opt-in `@interop/was-client/log` subpath is the WAS binding of
|
|
905
|
+
`@interop/vh-resource-log`'s store port. Resource logs -- the hash-linked, JSON
|
|
906
|
+
Lines log format (the encrypted-collections spec's Resource Log Profile)
|
|
907
|
+
governing key resources co-managed between a wallet's clients and the storage
|
|
908
|
+
server, such as encryption descriptors and key rosters -- otherwise live in that
|
|
909
|
+
library: the JSON Lines codec, the `ResourceLogStore` port, the read-back
|
|
910
|
+
`confirmAppend`, chain verification, and the chain-head pin. The wire types
|
|
911
|
+
(`ResourceLogEntry` et al.) live in `@interop/storage-core`. This subpath
|
|
912
|
+
re-exports none of them.
|
|
913
|
+
|
|
914
|
+
- **`resourceLogStore({ resource })`** -- the port over a WAS Resource (stored
|
|
915
|
+
as `text/jsonl`): read-with-etag of the full log, compare-and-swap append
|
|
916
|
+
conditioned on that etag, and the guarded create of a genesis entry. Appends
|
|
917
|
+
carry the prior lines' bytes forward verbatim. Both writes ride the backend's
|
|
918
|
+
`conditional-writes` feature, which the profile requires; a lost race rethrows
|
|
919
|
+
the library's `ResourceLogConflictError` with the transport's
|
|
920
|
+
`PreconditionFailedError` as `cause`.
|
|
925
921
|
|
|
926
922
|
### Export and import
|
|
927
923
|
|
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;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;gBAEP,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;CAU3D;AAED;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IAChC,IAAI,SAAkB;CAChC;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IAClC,IAAI,SAAoB;CAClC;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IACpC,IAAI,SAAsB;CACpC;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,QAAQ;IACtC,IAAI,SAAwB;CACtC;AAED;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IACpC,IAAI,SAAsB;CACpC;AAED;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IAChC,IAAI,SAAkB;CAChC;AAED;;;;;;;GAOG;AACH,qBAAa,uBAAwB,SAAQ,QAAQ;IAC1C,IAAI,SAA4B;CAC1C;AAED
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],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Error 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,G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OAAO,EAAE,OAAO,CAAC,CAAA;QAChD,KAAK,GAAG;YACN,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC5C,KAAK,GAAG;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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,EACZ,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,eAAe,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
|
package/dist/log/logStore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logStore.js","sourceRoot":"","sources":["../../src/log/logStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"logStore.js","sourceRoot":"","sources":["../../src/log/logStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,oBAAoB,EACpB,yBAAyB,EAE1B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,GAAG,EAAE,CACf,CAAA;gBACH,CAAC;gBACD,MAAM,GAAG,CAAA;YACX,CAAC;YACD,YAAY,GAAG,oBAAoB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;QAC9C,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interop/was-client",
|
|
3
3
|
"description": "A developer-friendly client for Wallet Attached Storage (WAS) servers.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.44.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "pnpm run clear && tsc",
|
|
@@ -68,10 +68,11 @@
|
|
|
68
68
|
"@interop/http-client": "^1.0.5",
|
|
69
69
|
"@interop/minimal-cipher": "^7.8.3",
|
|
70
70
|
"@interop/storage-core": "^0.9.1",
|
|
71
|
+
"@interop/vh-resource-log": "^0.1.2",
|
|
71
72
|
"@interop/x25519-key-agreement-key": "^5.2.2",
|
|
72
73
|
"@noble/hashes": "^2.3.0",
|
|
73
74
|
"@scure/base": "^2.3.0",
|
|
74
|
-
"json-canonicalize": "
|
|
75
|
+
"json-canonicalize": "3.0.0"
|
|
75
76
|
},
|
|
76
77
|
"devDependencies": {
|
|
77
78
|
"@eslint/js": "^10.0.1",
|
package/dist/log/jsonl.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Strict JSON Lines parse/serialize for resource logs (the Resource Log
|
|
6
|
-
* Profile, App Connect spec `#resource-log-profile`): one log entry as one
|
|
7
|
-
* JSON object per line, lines separated by U+000A LINE FEED, with a single
|
|
8
|
-
* terminating LINE FEED after the last line. Strict on purpose -- a non-object
|
|
9
|
-
* line is a parse failure, not a skip, so a truncated or doctored log surfaces
|
|
10
|
-
* as an error instead of a silently shorter history.
|
|
11
|
-
*
|
|
12
|
-
* Wire level only: the parse guarantees each line is one JSON object and
|
|
13
|
-
* nothing deeper. The profile's verifier-side rules (the five-member entry
|
|
14
|
-
* shape, `parameters` per position, SCID and chain-hash recomputation, proofs,
|
|
15
|
-
* authorization) belong to the consuming verifier, which runs over the parsed
|
|
16
|
-
* entries.
|
|
17
|
-
*/
|
|
18
|
-
import type { ResourceLogEntry } from '@interop/storage-core';
|
|
19
|
-
/**
|
|
20
|
-
* Parses a resource-log body into its entries, strictly: the text must be one
|
|
21
|
-
* JSON object per line, with an optional single trailing newline. Any empty
|
|
22
|
-
* line, non-JSON line, or line holding a non-object JSON value (an array, a
|
|
23
|
-
* string, a number, `null`) fails the whole parse. An empty body fails too --
|
|
24
|
-
* a log has at least its genesis entry (an absent resource is the store
|
|
25
|
-
* seam's `null`, not an empty body).
|
|
26
|
-
*
|
|
27
|
-
* @param text {string} the log resource's body
|
|
28
|
-
* @returns {ResourceLogEntry[]} the parsed entries, first line first
|
|
29
|
-
*/
|
|
30
|
-
export declare function parseResourceLog(text: string): ResourceLogEntry[];
|
|
31
|
-
/**
|
|
32
|
-
* Serializes one log entry as its single JSON Lines line, without the line
|
|
33
|
-
* separator. `JSON.stringify` escapes any newline inside string values, so the
|
|
34
|
-
* result never contains an embedded U+000A.
|
|
35
|
-
*
|
|
36
|
-
* @param entry {ResourceLogEntry}
|
|
37
|
-
* @returns {string}
|
|
38
|
-
*/
|
|
39
|
-
export declare function serializeResourceLogEntry(entry: ResourceLogEntry): string;
|
|
40
|
-
/**
|
|
41
|
-
* Serializes a full resource log as JSON Lines: one entry per line, in order,
|
|
42
|
-
* with a terminating newline. Refuses an empty log (a log carries at least
|
|
43
|
-
* its genesis entry).
|
|
44
|
-
*
|
|
45
|
-
* @param entries {ResourceLogEntry[]}
|
|
46
|
-
* @returns {string}
|
|
47
|
-
*/
|
|
48
|
-
export declare function serializeResourceLog(entries: ResourceLogEntry[]): string;
|
|
49
|
-
//# sourceMappingURL=jsonl.d.ts.map
|
package/dist/log/jsonl.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../../src/log/jsonl.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAG7D;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,EAAE,CA6BjE;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAEzE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAOxE"}
|
package/dist/log/jsonl.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { ValidationError } from '../errors.js';
|
|
2
|
-
/**
|
|
3
|
-
* Parses a resource-log body into its entries, strictly: the text must be one
|
|
4
|
-
* JSON object per line, with an optional single trailing newline. Any empty
|
|
5
|
-
* line, non-JSON line, or line holding a non-object JSON value (an array, a
|
|
6
|
-
* string, a number, `null`) fails the whole parse. An empty body fails too --
|
|
7
|
-
* a log has at least its genesis entry (an absent resource is the store
|
|
8
|
-
* seam's `null`, not an empty body).
|
|
9
|
-
*
|
|
10
|
-
* @param text {string} the log resource's body
|
|
11
|
-
* @returns {ResourceLogEntry[]} the parsed entries, first line first
|
|
12
|
-
*/
|
|
13
|
-
export function parseResourceLog(text) {
|
|
14
|
-
const body = text.endsWith('\n') ? text.slice(0, -1) : text;
|
|
15
|
-
if (body === '') {
|
|
16
|
-
throw new ValidationError('Cannot parse resource log: the body is empty (a log carries at least ' +
|
|
17
|
-
'its genesis entry).');
|
|
18
|
-
}
|
|
19
|
-
return body.split('\n').map((line, index) => {
|
|
20
|
-
let parsed;
|
|
21
|
-
try {
|
|
22
|
-
parsed = JSON.parse(line);
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
throw new ValidationError(`Cannot parse resource log: line ${index + 1} is not valid JSON.`, { cause: err });
|
|
26
|
-
}
|
|
27
|
-
if (parsed === null ||
|
|
28
|
-
typeof parsed !== 'object' ||
|
|
29
|
-
Array.isArray(parsed)) {
|
|
30
|
-
throw new ValidationError(`Cannot parse resource log: line ${index + 1} is not a JSON object.`);
|
|
31
|
-
}
|
|
32
|
-
return parsed;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Serializes one log entry as its single JSON Lines line, without the line
|
|
37
|
-
* separator. `JSON.stringify` escapes any newline inside string values, so the
|
|
38
|
-
* result never contains an embedded U+000A.
|
|
39
|
-
*
|
|
40
|
-
* @param entry {ResourceLogEntry}
|
|
41
|
-
* @returns {string}
|
|
42
|
-
*/
|
|
43
|
-
export function serializeResourceLogEntry(entry) {
|
|
44
|
-
return JSON.stringify(entry);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Serializes a full resource log as JSON Lines: one entry per line, in order,
|
|
48
|
-
* with a terminating newline. Refuses an empty log (a log carries at least
|
|
49
|
-
* its genesis entry).
|
|
50
|
-
*
|
|
51
|
-
* @param entries {ResourceLogEntry[]}
|
|
52
|
-
* @returns {string}
|
|
53
|
-
*/
|
|
54
|
-
export function serializeResourceLog(entries) {
|
|
55
|
-
if (entries.length === 0) {
|
|
56
|
-
throw new ValidationError('Cannot serialize resource log: a log carries at least its genesis entry.');
|
|
57
|
-
}
|
|
58
|
-
return entries.map(serializeResourceLogEntry).join('\n') + '\n';
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=jsonl.js.map
|
package/dist/log/jsonl.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl.js","sourceRoot":"","sources":["../../src/log/jsonl.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,eAAe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