@interop/was-client 0.49.0 → 0.51.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.
Files changed (47) hide show
  1. package/README.md +36 -7
  2. package/dist/Collection.d.ts +49 -0
  3. package/dist/Collection.d.ts.map +1 -1
  4. package/dist/Collection.js +74 -2
  5. package/dist/Collection.js.map +1 -1
  6. package/dist/errors.d.ts.map +1 -1
  7. package/dist/errors.js +1 -0
  8. package/dist/errors.js.map +1 -1
  9. package/dist/internal/conditional.d.ts +12 -0
  10. package/dist/internal/conditional.d.ts.map +1 -1
  11. package/dist/internal/conditional.js +17 -0
  12. package/dist/internal/conditional.js.map +1 -1
  13. package/dist/internal/content.d.ts +8 -0
  14. package/dist/internal/content.d.ts.map +1 -1
  15. package/dist/internal/content.js +8 -0
  16. package/dist/internal/content.js.map +1 -1
  17. package/dist/internal/paths.d.ts +6 -0
  18. package/dist/internal/paths.d.ts.map +1 -1
  19. package/dist/internal/paths.js +8 -0
  20. package/dist/internal/paths.js.map +1 -1
  21. package/dist/internal/write.d.ts +1 -1
  22. package/dist/internal/write.d.ts.map +1 -1
  23. package/dist/internal/write.js +4 -2
  24. package/dist/internal/write.js.map +1 -1
  25. package/dist/log/index.d.ts +2 -1
  26. package/dist/log/index.d.ts.map +1 -1
  27. package/dist/log/index.js +2 -1
  28. package/dist/log/index.js.map +1 -1
  29. package/dist/log/logStore.d.ts +33 -23
  30. package/dist/log/logStore.d.ts.map +1 -1
  31. package/dist/log/logStore.js +85 -40
  32. package/dist/log/logStore.js.map +1 -1
  33. package/dist/paths.d.ts +1 -1
  34. package/dist/paths.d.ts.map +1 -1
  35. package/dist/paths.js +1 -1
  36. package/dist/paths.js.map +1 -1
  37. package/dist/sync/index.d.ts +2 -2
  38. package/dist/sync/index.d.ts.map +1 -1
  39. package/dist/sync/index.js +1 -1
  40. package/dist/sync/index.js.map +1 -1
  41. package/dist/sync/port.d.ts +20 -15
  42. package/dist/sync/port.d.ts.map +1 -1
  43. package/dist/sync/port.js +62 -31
  44. package/dist/sync/port.js.map +1 -1
  45. package/dist/sync/types.d.ts +51 -24
  46. package/dist/sync/types.d.ts.map +1 -1
  47. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/internal/write.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACd,MAAM,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAMjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEzD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,aAAa,EACtB,EACE,IAAI,EACJ,MAAM,EACN,OAAO,EACP,UAAU,EACV,YAAY,EACb,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,YAAY,CAAA;IACrB,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,YAAY,CAAC,EAAE,iBAAiB,CAAA;CACjC,GACA,OAAO,CAAC,YAAY,CAAC,CAcvB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,aAAa,EACtB,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE;IAAE,QAAQ,EAAE,YAAY,CAAC;IAAC,UAAU,CAAC,EAAE,KAAK,CAAA;CAAE,GACvE,mBAAmB,CAUrB;AAED;;;;;GAKG;AACH,MAAM,M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C,GACA,OAAO,CAAC,YAAY,CAAC,CA6FvB"}
@@ -1,7 +1,7 @@
1
1
  import { isChunkedWrite } from '../codec.js';
2
2
  import { PreconditionFailedError, ValidationError } from '../errors.js';
3
3
  import { send } from './request.js';
4
- import { assertPreconditionAgainstPreRead, encodedPrecondition, writeHeaders } from './conditional.js';
4
+ import { assertPreconditionAgainstPreRead, encodedPrecondition, writeHeaders, namedPrecondition } from './conditional.js';
5
5
  /**
6
6
  * Sends an encoded write (`PUT`/`POST`) to a resource path, applying the
7
7
  * encoded body (`json` or `body`), its content-type, and the conditional-write
@@ -162,7 +162,9 @@ export async function insertResource(context, { itemsPath, pathForId, codec, dat
162
162
  * precondition (used only for a non-conditional codec)
163
163
  * @returns {Promise<HttpResponse>}
164
164
  */
165
- export async function upsertResource(context, { path, codec, id, data, features, contentType, capability, precondition }) {
165
+ export async function upsertResource(context, { path, codec, id, data, features, contentType, capability, precondition: callerPrecondition }) {
166
+ // An empty precondition object (the handle's default) names no baseline.
167
+ const precondition = namedPrecondition(callerPrecondition);
166
168
  let current;
167
169
  if (codec.conditionalWrites) {
168
170
  current = await send(context, {
@@ -1 +1 @@
1
- {"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/internal/write.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGvE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EACL,gCAAgC,EAChC,mBAAmB,EACnB,YAAY,EACb,MAAM,kBAAkB,CAAA;AAGzB;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAsB,EACtB,EACE,IAAI,EACJ,MAAM,EACN,OAAO,EACP,UAAU,EACV,YAAY,EAOb;IAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE;QACnC,IAAI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ChB,IAAI,CAAC;QACH,OAAO,MAAM,gBAAgB,CAAC,OAAO,EAAE;YACrC,IAAI;YACJ,MAAM,EAAE,KAAK;YACb,UAAU;YACV,OAAO;YACP,YAAY,EAAE,MAAM;SACrB,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IACE,GAAG,YAAY,uBAAuB;YACtC,KAAK,CAAC,iBAAiB;YACvB,OAAO,KAAK,IAAI,EAChB,CAAC;YACD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,CAAA;YACxD,MAAM,IAAI,uBAAuB,CAC/B,kCAAkC,IAAI,gCAAgC;gBACpE,0DAA0D;gBAC1D,kEAAkE;gBAClE,gEAAgE;gBAChE,+DAA+D;gBAC/D,WAAW,EACb,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CACzD,CAAA;QACH,CAAC;QACD,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC"}
@@ -5,7 +5,8 @@
5
5
  * The `@interop/was-client/log` subpath entry: the WAS binding of
6
6
  * `@interop/vh-resource-log`'s store port -- `resourceLogStore` maps the
7
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
8
+ * onto the conditional writes of one WAS Resource, or of a Collection's
9
+ * governing history log at `/meta/log`, rethrowing a lost race as the
9
10
  * library's `ResourceLogConflictError`. Everything else about resource logs
10
11
  * (the Resource Log Profile, encrypted-collections-spec
11
12
  * `#resource-log-profile`) lives in that library: the JSON Lines codec, the
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/log/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA"}
package/dist/log/index.js CHANGED
@@ -5,7 +5,8 @@
5
5
  * The `@interop/was-client/log` subpath entry: the WAS binding of
6
6
  * `@interop/vh-resource-log`'s store port -- `resourceLogStore` maps the
7
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
8
+ * onto the conditional writes of one WAS Resource, or of a Collection's
9
+ * governing history log at `/meta/log`, rethrowing a lost race as the
9
10
  * library's `ResourceLogConflictError`. Everything else about resource logs
10
11
  * (the Resource Log Profile, encrypted-collections-spec
11
12
  * `#resource-log-profile`) lives in that library: the JSON Lines codec, the
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/log/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA"}
@@ -2,15 +2,22 @@
2
2
  * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
3
  */
4
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.
5
+ * The WAS binding of `@interop/vh-resource-log`'s store port, over either of
6
+ * the two places a WAS server keeps a resource log. A log may be a WAS
7
+ * Resource's entire body (the user key roster's `key-map/user-key.jsonl`), or
8
+ * a Collection's governing history log at the `/meta/log` sub-resource (the
9
+ * backend's `governed-history-logs` feature, from which the server derives
10
+ * the Collection's served `encryption` member). Either way the log is stored
11
+ * as `text/jsonl`, with the port's read-with-etag, compare-and-swap append,
12
+ * and guarded genesis create mapped onto the target's conditional writes.
13
+ *
14
+ * A Resource-hosted log's collection may be plaintext or encrypted: a
15
+ * conditional codec pins the write to the `ifMatch` this store passes rather
16
+ * than to the ETag its own pre-read observed, so the append profile's
17
+ * compare-and-swap holds either way. On an encrypted host the resource id
18
+ * must be one the codec mints, since the EDV codec refuses to create a
19
+ * document under a human-readable id. A Collection's history log is never
20
+ * encrypted and runs no codec: the server reads its head itself.
14
21
  *
15
22
  * Both the append and the create ride the backend's `conditional-writes`
16
23
  * feature -- the profile requires it (without the precondition, concurrent
@@ -23,26 +30,29 @@
23
30
  * adapter-to-library package boundary).
24
31
  */
25
32
  import { type ResourceLogStore } from '@interop/vh-resource-log';
33
+ import type { Collection } from '../Collection.js';
26
34
  import type { Resource } from '../Resource.js';
35
+ import { LOG_CONTENT_TYPE } from '../internal/content.js';
36
+ export { LOG_CONTENT_TYPE };
27
37
  /**
28
- * The content type a resource log is stored under (JSON Lines, not JSON --
29
- * load-bearing: a JSON content type would have the request layer parse and
30
- * re-serialize the body, losing the line framing).
31
- */
32
- export declare const LOG_CONTENT_TYPE = "text/jsonl";
33
- /**
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.
38
+ * The WAS adapter implementing the library's `ResourceLogStore` port, over
39
+ * one of two hosts: `resource`, a WAS Resource whose whole body is the log,
40
+ * or `collection`, whose governing history log at `/meta/log` is the log.
41
+ * `append` carries the prior entries' bytes forward verbatim from the most
42
+ * recent read (an append never re-serializes history), and both `append` and
43
+ * `create` translate the transport's 412 into the library's conflict error.
40
44
  *
41
45
  * @param options {object}
42
- * @param options.resource {Resource}
46
+ * @param [options.resource] {Resource} the Resource holding the log
47
+ * @param [options.collection] {Collection} the Collection whose history log
48
+ * is the log; exactly one of the two is given
43
49
  * @returns {ResourceLogStore}
44
50
  */
45
- export declare function resourceLogStore({ resource }: {
51
+ export declare function resourceLogStore(options: {
46
52
  resource: Resource;
53
+ collection?: undefined;
54
+ } | {
55
+ collection: Collection;
56
+ resource?: undefined;
47
57
  }): ResourceLogStore;
48
58
  //# sourceMappingURL=logStore.d.ts.map
@@ -1 +1 @@
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,CAuFnB"}
1
+ {"version":3,"file":"logStore.d.ts","sourceRoot":"","sources":["../../src/log/logStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAG9C,OAAO,EAAW,gBAAgB,EAAU,MAAM,wBAAwB,CAAA;AAE1E,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAqE3B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EACH;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,CAAA;CAAE,GAC9C;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GACnD,gBAAgB,CA6ElB"}
@@ -2,15 +2,22 @@
2
2
  * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
3
  */
4
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.
5
+ * The WAS binding of `@interop/vh-resource-log`'s store port, over either of
6
+ * the two places a WAS server keeps a resource log. A log may be a WAS
7
+ * Resource's entire body (the user key roster's `key-map/user-key.jsonl`), or
8
+ * a Collection's governing history log at the `/meta/log` sub-resource (the
9
+ * backend's `governed-history-logs` feature, from which the server derives
10
+ * the Collection's served `encryption` member). Either way the log is stored
11
+ * as `text/jsonl`, with the port's read-with-etag, compare-and-swap append,
12
+ * and guarded genesis create mapped onto the target's conditional writes.
13
+ *
14
+ * A Resource-hosted log's collection may be plaintext or encrypted: a
15
+ * conditional codec pins the write to the `ifMatch` this store passes rather
16
+ * than to the ETag its own pre-read observed, so the append profile's
17
+ * compare-and-swap holds either way. On an encrypted host the resource id
18
+ * must be one the codec mints, since the EDV codec refuses to create a
19
+ * document under a human-readable id. A Collection's history log is never
20
+ * encrypted and runs no codec: the server reads its head itself.
14
21
  *
15
22
  * Both the append and the create ride the backend's `conditional-writes`
16
23
  * feature -- the profile requires it (without the precondition, concurrent
@@ -25,31 +32,18 @@
25
32
  import { ResourceLogConflictError, parseResourceLog, serializeResourceLog, serializeResourceLogEntry } from '@interop/vh-resource-log';
26
33
  import { PreconditionFailedError, ValidationError } from '../errors.js';
27
34
  import { blobText } from '../internal/blob.js';
28
- import { ENCODER, isBlob } from '../internal/content.js';
29
- /**
30
- * The content type a resource log is stored under (JSON Lines, not JSON --
31
- * load-bearing: a JSON content type would have the request layer parse and
32
- * re-serialize the body, losing the line framing).
33
- */
34
- export const LOG_CONTENT_TYPE = 'text/jsonl';
35
+ import { ENCODER, LOG_CONTENT_TYPE, isBlob } from '../internal/content.js';
36
+ export { LOG_CONTENT_TYPE };
35
37
  /**
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.
38
+ * The Resource host: `getWithEtag` (so the codec runs and a text body is
39
+ * decoded as a Blob or a string) and `put` with the log content type.
40
+ * `read` keeps the Blob / text body handling (a React Native Blob has no
41
+ * `text()`; `blobText` falls back to `FileReader`).
42
42
  *
43
- * @param options {object}
44
- * @param options.resource {Resource}
45
- * @returns {ResourceLogStore}
43
+ * @param resource {Resource}
44
+ * @returns {LogTarget}
46
45
  */
47
- export function resourceLogStore({ resource }) {
48
- // The raw body observed by the most recent read; an append extends these
49
- // bytes verbatim instead of re-serializing the parsed entries. Safe to carry
50
- // even if stale: the append is pinned to the same read's ETag, so a
51
- // concurrent append fails the CAS instead.
52
- let lastReadBody;
46
+ function resourceTarget(resource) {
53
47
  return {
54
48
  async read() {
55
49
  const current = await resource.getWithEtag();
@@ -65,8 +59,62 @@ export function resourceLogStore({ resource }) {
65
59
  throw new ValidationError(`Cannot read resource log: the resource "${resource.id}" does not ` +
66
60
  'hold a text body (is it stored as JSON instead of JSON Lines?).');
67
61
  }
68
- const entries = parseResourceLog(body);
69
- lastReadBody = body;
62
+ return { body, etag: current.etag };
63
+ },
64
+ async put(body, precondition) {
65
+ await resource.put(ENCODER.encode(body), {
66
+ contentType: LOG_CONTENT_TYPE,
67
+ ...precondition
68
+ });
69
+ }
70
+ };
71
+ }
72
+ /**
73
+ * The Collection host: the governing history log at `/meta/log`, read and
74
+ * written verbatim through the handle's own transport methods.
75
+ *
76
+ * @param collection {Collection}
77
+ * @returns {LogTarget}
78
+ */
79
+ function collectionTarget(collection) {
80
+ return {
81
+ read: () => collection.getHistoryLog(),
82
+ async put(body, precondition) {
83
+ await collection.putHistoryLog(body, precondition);
84
+ }
85
+ };
86
+ }
87
+ /**
88
+ * The WAS adapter implementing the library's `ResourceLogStore` port, over
89
+ * one of two hosts: `resource`, a WAS Resource whose whole body is the log,
90
+ * or `collection`, whose governing history log at `/meta/log` is the log.
91
+ * `append` carries the prior entries' bytes forward verbatim from the most
92
+ * recent read (an append never re-serializes history), and both `append` and
93
+ * `create` translate the transport's 412 into the library's conflict error.
94
+ *
95
+ * @param options {object}
96
+ * @param [options.resource] {Resource} the Resource holding the log
97
+ * @param [options.collection] {Collection} the Collection whose history log
98
+ * is the log; exactly one of the two is given
99
+ * @returns {ResourceLogStore}
100
+ */
101
+ export function resourceLogStore(options) {
102
+ const target = options.resource !== undefined
103
+ ? resourceTarget(options.resource)
104
+ : collectionTarget(options.collection);
105
+ // The raw body observed by the most recent read; an append extends these
106
+ // bytes verbatim instead of re-serializing the parsed entries. Safe to carry
107
+ // even if stale: the append is pinned to the same read's ETag, so a
108
+ // concurrent append fails the CAS instead.
109
+ let lastReadBody;
110
+ return {
111
+ async read() {
112
+ const current = await target.read();
113
+ if (current === null) {
114
+ return null;
115
+ }
116
+ const entries = parseResourceLog(current.body);
117
+ lastReadBody = current.body;
70
118
  return { entries, etag: current.etag };
71
119
  },
72
120
  async append(entry, { ifMatch }) {
@@ -78,7 +126,7 @@ export function resourceLogStore({ resource }) {
78
126
  const extended = lastReadBody + separator + serializeResourceLogEntry(entry) + '\n';
79
127
  await putOrConflict({
80
128
  body: extended,
81
- options: { ifMatch },
129
+ precondition: { ifMatch },
82
130
  conflict: 'Resource-log append lost its compare-and-swap: the validator ' +
83
131
  'is stale.'
84
132
  });
@@ -88,7 +136,7 @@ export function resourceLogStore({ resource }) {
88
136
  const serialized = serializeResourceLog([entry]);
89
137
  await putOrConflict({
90
138
  body: serialized,
91
- options: { ifNoneMatch: true },
139
+ precondition: { ifNoneMatch: true },
92
140
  conflict: 'Resource-log create lost its guarded-create race: the log ' +
93
141
  'already exists.'
94
142
  });
@@ -102,12 +150,9 @@ export function resourceLogStore({ resource }) {
102
150
  * it is the port's CAS conflict, not an error: the library's rebase loop
103
151
  * re-reads, re-verifies, and retries on it.
104
152
  */
105
- async function putOrConflict({ body, options, conflict }) {
153
+ async function putOrConflict({ body, precondition, conflict }) {
106
154
  try {
107
- await resource.put(ENCODER.encode(body), {
108
- contentType: LOG_CONTENT_TYPE,
109
- ...options
110
- });
155
+ await target.put(body, precondition);
111
156
  }
112
157
  catch (err) {
113
158
  if (err instanceof PreconditionFailedError) {
@@ -1 +1 @@
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,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,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
24
24
  * Kept off the core entry so a consumer opts in; every export here is a pure
25
25
  * function with no I/O and no client state.
26
26
  */
27
- export { spacePath, spaceItems, collectionPath, collectionItems, collectionMeta, collectionQuery, resourcePath, resourceMeta, toUrl, parseSpacePath, parseSpaceTarget } from './internal/paths.js';
27
+ export { spacePath, spaceItems, collectionPath, collectionItems, collectionMeta, collectionLog, collectionQuery, resourcePath, resourceMeta, toUrl, parseSpacePath, parseSpaceTarget } from './internal/paths.js';
28
28
  export type { ParsedSpacePath } from './internal/paths.js';
29
29
  export { rootCapabilityId, rootCapability } from './internal/revoke.js';
30
30
  //# sourceMappingURL=paths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,cAAc,EACd,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAE1D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,cAAc,EACd,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAE1D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
package/dist/paths.js CHANGED
@@ -24,6 +24,6 @@
24
24
  * Kept off the core entry so a consumer opts in; every export here is a pure
25
25
  * function with no I/O and no client state.
26
26
  */
27
- export { spacePath, spaceItems, collectionPath, collectionItems, collectionMeta, collectionQuery, resourcePath, resourceMeta, toUrl, parseSpacePath, parseSpaceTarget } from './internal/paths.js';
27
+ export { spacePath, spaceItems, collectionPath, collectionItems, collectionMeta, collectionLog, collectionQuery, resourcePath, resourceMeta, toUrl, parseSpacePath, parseSpaceTarget } from './internal/paths.js';
28
28
  export { rootCapabilityId, rootCapability } from './internal/revoke.js';
29
29
  //# sourceMappingURL=paths.js.map
package/dist/paths.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,cAAc,EACd,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,cAAc,EACd,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
@@ -39,7 +39,7 @@
39
39
  * boundary the predicates are the contract
40
40
  * (`decisions/0001-cross-package-errors-match-by-name.md`).
41
41
  */
42
- export { createWasSyncPort, KEY_EPOCH_HEADER, formatEtag, parseEtag } from './port.js';
42
+ export { createWasSyncPort, KEY_EPOCH_HEADER, parseEtag } from './port.js';
43
43
  export { httpStatus as errorStatus, errorMessage } from '../errors.js';
44
44
  export { contentCid, cidFrom, deriveSpaceId } from './cid.js';
45
45
  export { isEncryptedEnvelope } from './envelope.js';
@@ -47,5 +47,5 @@ export { createPlaintextDocCipher } from './plaintextCipher.js';
47
47
  export { ensureSpace, ensureSpaceAndCollection } from './provisioning.js';
48
48
  export { isSyncAuthError, isSyncConflictError, isSyncNotFoundError, isUnknownEpochError } from './predicates.js';
49
49
  export { EncryptionError, KeyUnwrapError, UnknownEpochError, WasSyncAuthError, WasSyncConflictError, WasSyncNotFoundError } from '../errors.js';
50
- export type { Json, SyncCheckpoint, WireDoc, SyncPage, MasterState, SyncStatus, WasSyncPort, DocCipher } from './types.js';
50
+ export type { Json, SyncCheckpoint, WireDoc, SyncPage, MasterState, WriteAck, SyncStatus, WasSyncPort, DocCipher } from './types.js';
51
51
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,SAAS,EACV,MAAM,WAAW,CAAA;AAIlB,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,cAAc,CAAA;AAErB,YAAY,EACV,IAAI,EACJ,cAAc,EACd,OAAO,EACP,QAAQ,EACR,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,EACV,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAI1E,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,cAAc,CAAA;AAErB,YAAY,EACV,IAAI,EACJ,cAAc,EACd,OAAO,EACP,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,UAAU,EACV,WAAW,EACX,SAAS,EACV,MAAM,YAAY,CAAA"}
@@ -39,7 +39,7 @@
39
39
  * boundary the predicates are the contract
40
40
  * (`decisions/0001-cross-package-errors-match-by-name.md`).
41
41
  */
42
- export { createWasSyncPort, KEY_EPOCH_HEADER, formatEtag, parseEtag } from './port.js';
42
+ export { createWasSyncPort, KEY_EPOCH_HEADER, parseEtag } from './port.js';
43
43
  // The sync subpath's names for the client's own error accessors, so a
44
44
  // sync-only consumer reads a raw ky/ezcap failure without importing the core
45
45
  // entry.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,SAAS,EACV,MAAM,WAAW,CAAA;AAClB,sEAAsE;AACtE,6EAA6E;AAC7E,SAAS;AACT,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC1E,sEAAsE;AACtE,6EAA6E;AAC7E,SAAS;AACT,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,cAAc,CAAA"}
@@ -19,11 +19,16 @@
19
19
  * `POST /space/:s/:c/query` (profile `changes`) as a root invocation and, like
20
20
  * the raw writes, ships the stored bodies verbatim without decrypting.
21
21
  *
22
- * Conditional writes ride the server's monotonic content `version` (`ETag`),
23
- * enforced uniformly for plaintext and encrypted resources, so there is no
24
- * plaintext-vs-encrypted fork. `putContent`/`deleteContent` return the server-
25
- * acked `version` (parsed from the write's `ETag`, re-read only if the backend
26
- * sent none), so a caller can record acked revisions immediately.
22
+ * Conditional writes ride the server's `ETag`: an opaque quoted string
23
+ * (`"<generation>.<version>"`, a per-record generation marker ahead of the
24
+ * monotonic content `version` so a hard-deleted-and-recreated id can never
25
+ * collide with its predecessor's validators), enforced uniformly for
26
+ * plaintext and encrypted resources, so there is no plaintext-vs-encrypted
27
+ * fork. `putContent`/`deleteContent` return the server-acked {@link
28
+ * WriteAck} -- the write's raw `etag` (re-read only if the backend sent
29
+ * none) plus its `version` parsed out of it -- so a caller can record acked
30
+ * revisions immediately and echo `etag` back verbatim as a later write's
31
+ * `ifMatch`.
27
32
  *
28
33
  * Bypassing the codec is not bypassing the error mapper. Every failure caught
29
34
  * here goes through the client's own `mapError` first, so the port's signals
@@ -42,17 +47,17 @@ import type { WasSyncPort } from './types.js';
42
47
  */
43
48
  export { KEY_EPOCH_HEADER };
44
49
  /**
45
- * Formats a numeric content `version` as the quoted strong `ETag` an
46
- * update-if-unchanged write passes as its `ifMatch` precondition (e.g. `3` to
47
- * `"3"`). Inverse of {@link parseEtag}.
50
+ * Parses a quoted strong `ETag` into its numeric revision: the decimal
51
+ * integer after the LAST `.` inside the quotes (`"3mJr7AoUXx2.3"` to `3`).
52
+ * Returns `undefined` when the header is absent, has no `.`, or the trailing
53
+ * segment is anything other than a run of digits.
48
54
  *
49
- * @param version {number}
50
- * @returns {string}
51
- */
52
- export declare function formatEtag(version: number): string;
53
- /**
54
- * Parses a quoted strong `ETag` (`"3"`) into its numeric revision, or
55
- * `undefined` when the header is absent or non-numeric (no such revision yet).
55
+ * The quoted string as a whole is opaque -- it also carries a per-record
56
+ * generation marker ahead of the version, minted once and kept for the
57
+ * record's life, so this is one-way: there is no `formatEtag` to build a
58
+ * validator back out of a bare revision number. Always echo the `etag` a read
59
+ * or write returned back verbatim for `ifMatch`/`ifNoneMatch`; this helper
60
+ * only reads the revision out of it for comparison or display.
56
61
  *
57
62
  * @param etag {string | null | undefined}
58
63
  * @returns {number | undefined}
@@ -1 +1 @@
1
- {"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../src/sync/port.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,EACL,gBAAgB,EAGjB,MAAM,4BAA4B,CAAA;AAWnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,YAAY,CAAA;AAEhE;;;;;GAKG;AACH,OAAO,EAAE,gBAAgB,EAAE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