@interop/was-client 0.59.1 → 0.61.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 (101) hide show
  1. package/README.md +66 -45
  2. package/dist/Collection.d.ts +140 -96
  3. package/dist/Collection.d.ts.map +1 -1
  4. package/dist/Collection.js +648 -194
  5. package/dist/Collection.js.map +1 -1
  6. package/dist/Resource.d.ts +1 -1
  7. package/dist/Resource.d.ts.map +1 -1
  8. package/dist/Resource.js +0 -3
  9. package/dist/Resource.js.map +1 -1
  10. package/dist/Space.d.ts +17 -16
  11. package/dist/Space.d.ts.map +1 -1
  12. package/dist/Space.js +41 -24
  13. package/dist/Space.js.map +1 -1
  14. package/dist/WasClient.d.ts.map +1 -1
  15. package/dist/WasClient.js +9 -3
  16. package/dist/WasClient.js.map +1 -1
  17. package/dist/codec.d.ts +3 -3
  18. package/dist/edv/EdvCodec.d.ts.map +1 -1
  19. package/dist/edv/EdvCodec.js +22 -46
  20. package/dist/edv/EdvCodec.js.map +1 -1
  21. package/dist/edv/descriptorStore.d.ts +16 -14
  22. package/dist/edv/descriptorStore.d.ts.map +1 -1
  23. package/dist/edv/descriptorStore.js +17 -14
  24. package/dist/edv/descriptorStore.js.map +1 -1
  25. package/dist/edv/didKeyRecipient.d.ts +6 -1
  26. package/dist/edv/didKeyRecipient.d.ts.map +1 -1
  27. package/dist/edv/didKeyRecipient.js +4 -0
  28. package/dist/edv/didKeyRecipient.js.map +1 -1
  29. package/dist/edv/epochKeys.d.ts +43 -3
  30. package/dist/edv/epochKeys.d.ts.map +1 -1
  31. package/dist/edv/epochKeys.js +90 -9
  32. package/dist/edv/epochKeys.js.map +1 -1
  33. package/dist/edv/epochRoster.d.ts +36 -26
  34. package/dist/edv/epochRoster.d.ts.map +1 -1
  35. package/dist/edv/epochRoster.js +61 -10
  36. package/dist/edv/epochRoster.js.map +1 -1
  37. package/dist/edv/hmacKey.d.ts +17 -5
  38. package/dist/edv/hmacKey.d.ts.map +1 -1
  39. package/dist/edv/hmacKey.js +19 -5
  40. package/dist/edv/hmacKey.js.map +1 -1
  41. package/dist/edv/index.d.ts +1 -1
  42. package/dist/edv/index.js +1 -1
  43. package/dist/edv/logGovernedDescriptorStore.d.ts +2 -2
  44. package/dist/edv/logGovernedDescriptorStore.d.ts.map +1 -1
  45. package/dist/edv/logGovernedDescriptorStore.js +10 -9
  46. package/dist/edv/logGovernedDescriptorStore.js.map +1 -1
  47. package/dist/edv/recipients.d.ts +1 -1
  48. package/dist/edv/recipients.d.ts.map +1 -1
  49. package/dist/edv/recipients.js +12 -4
  50. package/dist/edv/recipients.js.map +1 -1
  51. package/dist/edv/refresh.d.ts +6 -1
  52. package/dist/edv/refresh.d.ts.map +1 -1
  53. package/dist/edv/refresh.js +19 -2
  54. package/dist/edv/refresh.js.map +1 -1
  55. package/dist/errors.d.ts +1 -1
  56. package/dist/errors.js +3 -3
  57. package/dist/errors.js.map +1 -1
  58. package/dist/index.d.ts +1 -1
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/internal/cas.d.ts.map +1 -1
  61. package/dist/internal/cas.js +7 -4
  62. package/dist/internal/cas.js.map +1 -1
  63. package/dist/internal/codec.d.ts +22 -1
  64. package/dist/internal/codec.d.ts.map +1 -1
  65. package/dist/internal/codec.js +117 -46
  66. package/dist/internal/codec.js.map +1 -1
  67. package/dist/internal/content.d.ts.map +1 -1
  68. package/dist/internal/content.js +12 -1
  69. package/dist/internal/content.js.map +1 -1
  70. package/dist/internal/describe.d.ts +98 -24
  71. package/dist/internal/describe.d.ts.map +1 -1
  72. package/dist/internal/describe.js +125 -18
  73. package/dist/internal/describe.js.map +1 -1
  74. package/dist/internal/meta.d.ts +32 -17
  75. package/dist/internal/meta.d.ts.map +1 -1
  76. package/dist/internal/meta.js +64 -35
  77. package/dist/internal/meta.js.map +1 -1
  78. package/dist/internal/paths.d.ts +33 -17
  79. package/dist/internal/paths.d.ts.map +1 -1
  80. package/dist/internal/paths.js +92 -40
  81. package/dist/internal/paths.js.map +1 -1
  82. package/dist/internal/reserved.d.ts +14 -0
  83. package/dist/internal/reserved.d.ts.map +1 -1
  84. package/dist/internal/reserved.js +23 -4
  85. package/dist/internal/reserved.js.map +1 -1
  86. package/dist/internal/write.js +30 -1
  87. package/dist/internal/write.js.map +1 -1
  88. package/dist/paths.d.ts +8 -5
  89. package/dist/paths.d.ts.map +1 -1
  90. package/dist/paths.js +8 -5
  91. package/dist/paths.js.map +1 -1
  92. package/dist/sync/port.d.ts.map +1 -1
  93. package/dist/sync/port.js +14 -1
  94. package/dist/sync/port.js.map +1 -1
  95. package/dist/sync/provisioning.d.ts +7 -7
  96. package/dist/sync/provisioning.d.ts.map +1 -1
  97. package/dist/sync/provisioning.js +27 -15
  98. package/dist/sync/provisioning.js.map +1 -1
  99. package/dist/types.d.ts +16 -9
  100. package/dist/types.d.ts.map +1 -1
  101. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/internal/codec.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAA;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAyBnE;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,WAAW;IACb,KAAK,CAAuB;IAErC;;;OAGG;IACH,YAAY,OAAuC;QACjD,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;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AAC,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAIrE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAE3E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAM1D;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,YAAY,GAAG,IAAI,GAC5B,OAAO,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAS7B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAErE"}
@@ -246,7 +246,18 @@ export function createdResource(response) {
246
246
  .pop()
247
247
  : undefined;
248
248
  if (segment) {
249
- return { id: decodeURIComponent(segment), location };
249
+ // A stray or malformed percent escape in the segment (`100%discount`,
250
+ // `%zz`) makes `decodeURIComponent` throw a raw `URIError`. That is a
251
+ // malformed create response like any other, so it leaves here as the
252
+ // `WasServerError` this function exists to produce.
253
+ try {
254
+ return { id: decodeURIComponent(segment), location };
255
+ }
256
+ catch (err) {
257
+ throw new WasServerError(`Create response carried a malformed resource id: the \`Location\` ` +
258
+ `header "${location}" ends in a segment ("${segment}") that is not ` +
259
+ 'valid percent-encoding.', { cause: err });
260
+ }
250
261
  }
251
262
  throw new WasServerError('Create response carried no resource id: the body has no `id` and there ' +
252
263
  'is no `Location` header.');
@@ -1 +1 @@
1
- {"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/internal/content.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG9D,MAAM,YAAY,GAAG,0BAA0B,CAAA;AAE/C;;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OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAChE,CAAC"}
@@ -2,19 +2,44 @@
2
2
  * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
3
  */
4
4
  /**
5
- * Reads a Collection Description with a single GET. Shared by
6
- * `Collection.describe()` and the standalone-resource codec's descriptor
7
- * discovery so the request shape (path, capability, null-unwrap) lives in one
8
- * place. Also owns the masked-404 fail-closed policy: WAS returns 404 for both
9
- * not-found and unauthorized, so a `null` description is ambiguous and an
10
- * operation that must know the current state fails closed via
5
+ * Reads a Collection Metadata object with a single GET of the Collection's
6
+ * `meta` sub-resource, in the wire form the server serves it: `custom` is
7
+ * whatever is stored there (an opaque envelope on an encrypted Collection),
8
+ * left undecoded, because the codec that would decode it is itself resolved
9
+ * from this object's `encryption` member. Shared by `Collection`'s read and
10
+ * write paths and by the codec resolver's descriptor discovery, so the request
11
+ * shape (path, capability, null-unwrap, validator) lives in one place.
12
+ *
13
+ * Also owns the masked-404 fail-closed policy: WAS returns 404 for both
14
+ * not-found and unauthorized, so a `null` read is ambiguous and an operation
15
+ * that must know the current state fails closed via
11
16
  * `unreadableDescriptionError` rather than guessing. `collectionWritableFields`
12
- * lives here too: it is the one inclusion rule for the writable description
13
- * fields, shared by every path that builds a description body.
17
+ * lives here too: it is the one inclusion rule for the writable configuration
18
+ * members a caller supplies, beside `carriedForward`, the rule for the stored
19
+ * members a full-replacement write re-sends unchanged.
14
20
  */
15
21
  import type { ClientContext } from './request.js';
16
22
  import type { WasError } from '../errors.js';
17
- import type { CollectionDescription, CollectionEncryption, CollectionWritableFields, IZcap } from '../types.js';
23
+ import type { CollectionEncryption, CollectionMetadata, CollectionWritableFields, IZcap } from '../types.js';
24
+ /**
25
+ * A Collection Metadata object exactly as the server served it. Typed as an
26
+ * open record rather than as `CollectionMetadata`, because `custom` here is the
27
+ * stored value (an opaque encryption envelope on an encrypted Collection) and
28
+ * because a write forwards members this client does not model verbatim rather
29
+ * than dropping them (see {@link carriedForward}).
30
+ */
31
+ export type StoredCollectionMetadata = Record<string, unknown>;
32
+ /**
33
+ * Reads a stored Collection Metadata object as the `CollectionMetadata` wire
34
+ * type. The stored form is typed as an open record -- `custom` is the stored
35
+ * value and a write forwards members this client does not model -- while the
36
+ * server guarantees the object's shape, so the assertion lives here once
37
+ * instead of at each reader.
38
+ *
39
+ * @param stored {StoredCollectionMetadata}
40
+ * @returns {CollectionMetadata}
41
+ */
42
+ export declare function asCollectionMetadata(stored: StoredCollectionMetadata): CollectionMetadata;
18
43
  /**
19
44
  * Whether a served encryption descriptor is the server-derived projection of
20
45
  * a Collection governed by its history log (it carries the `history` pointer)
@@ -31,38 +56,87 @@ export declare function isGovernedDescriptor(descriptor: CollectionEncryption):
31
56
  };
32
57
  };
33
58
  /**
34
- * Picks the writable Collection Description fields that are set. The one
35
- * inclusion rule (`!== undefined`) behind every description body -- the
36
- * `configure` / `replaceDescription` request bodies and their echoed return
37
- * descriptions, and `Space.createCollection`'s create body -- so the paths
38
- * cannot drift and a new writable field is added in one place.
59
+ * Picks the writable Collection configuration members that are set. The one
60
+ * inclusion rule (`!== undefined`) behind every Collection Metadata write body
61
+ * -- the `configure` / `replaceDescription` request bodies and their echoed
62
+ * returns, and `Space.createCollection`'s create body -- so the paths cannot
63
+ * drift and a new writable member is added in one place.
39
64
  *
40
65
  * @param fields {CollectionWritableFields}
41
66
  * @returns {CollectionWritableFields}
42
67
  */
43
68
  export declare function collectionWritableFields(fields: CollectionWritableFields): CollectionWritableFields;
44
69
  /**
45
- * Reads the Collection Description. Returns `null` if the collection is missing
46
- * or not visible to you (WAS returns 404 for both not-found and unauthorized).
70
+ * The Collection's configuration members: what a configuration write
71
+ * (`configure`, `replaceDescription`) states in full and an annotation write
72
+ * carries forward.
73
+ */
74
+ export declare const CONFIGURATION_MEMBERS: readonly string[];
75
+ /**
76
+ * The Collection's annotation members: the user-writable `custom` and the key
77
+ * epoch its envelope was sealed under. What an annotation write (`setMeta` and
78
+ * its sugar) states and a configuration write carries forward.
79
+ */
80
+ export declare const ANNOTATION_MEMBERS: readonly string[];
81
+ /**
82
+ * Reads a stored `encryption` descriptor at its wire type. The one place the
83
+ * open stored record is narrowed to `CollectionEncryption`, shared by the
84
+ * compose paths and the codec resolver so the assertion is not repeated.
85
+ *
86
+ * @param stored {StoredCollectionMetadata}
87
+ * @returns {CollectionEncryption | undefined}
88
+ */
89
+ export declare function storedEncryption(stored: StoredCollectionMetadata): CollectionEncryption | undefined;
90
+ /**
91
+ * Picks the stored members a full-replacement write carries forward: every
92
+ * member except the ones the server manages and the ones this write states
93
+ * itself. A denylist rather than an allowlist, so a member this client does
94
+ * not model -- `plaintext`, or one a newer server serves -- survives a write
95
+ * it is not about instead of being silently cleared.
96
+ *
97
+ * A governed `encryption` descriptor is deliberately dropped: on a
98
+ * log-governed Collection the served descriptor is the server's projection of
99
+ * the history log's head, and a write that carries it is refused
100
+ * (`encryption-history-log-governed`). Omitting the member leaves the derived
101
+ * descriptor in place.
102
+ *
103
+ * @param stored {StoredCollectionMetadata}
104
+ * @param options {object}
105
+ * @param options.replacing {readonly string[]} the members this write states
106
+ * itself (`CONFIGURATION_MEMBERS` on a configuration write,
107
+ * `ANNOTATION_MEMBERS` on an annotation write)
108
+ * @returns {StoredCollectionMetadata}
109
+ */
110
+ export declare function carriedForward(stored: StoredCollectionMetadata, { replacing }: {
111
+ replacing: readonly string[];
112
+ }): StoredCollectionMetadata;
113
+ /**
114
+ * Reads the Collection Metadata object with its `metaVersion` validator, in the
115
+ * stored wire form. Returns `null` if the collection is missing or not visible
116
+ * to you (WAS returns 404 for both not-found and unauthorized); `etag` is
117
+ * absent against a backend that does not version the object.
47
118
  *
48
119
  * @param context {ClientContext}
49
120
  * @param options {object}
50
121
  * @param options.spaceId {string}
51
122
  * @param options.collectionId {string}
52
123
  * @param [options.capability] {IZcap} capability attached to the request
53
- * @returns {Promise<CollectionDescription | null>}
124
+ * @returns {Promise<{ metadata: StoredCollectionMetadata; etag?: string } | null>}
54
125
  */
55
- export declare function describeCollection(context: ClientContext, options: {
126
+ export declare function readCollectionMetadata(context: ClientContext, options: {
56
127
  spaceId: string;
57
128
  collectionId: string;
58
129
  capability?: IZcap;
59
- }): Promise<CollectionDescription | null>;
130
+ }): Promise<{
131
+ metadata: StoredCollectionMetadata;
132
+ etag?: string;
133
+ } | null>;
60
134
  /**
61
- * Builds the fail-closed error for an operation that needs a description it
62
- * could not read. The one owner of the masked-404 policy statement ("WAS
63
- * returns 404 for both not-found and unauthorized, so a null description is
64
- * ambiguous -- fail closed"); callers supply the operation, its consequence,
65
- * and the recovery advice.
135
+ * Builds the fail-closed error for an operation that needs a Collection
136
+ * Metadata object it could not read. The one owner of the masked-404 policy
137
+ * statement ("WAS returns 404 for both not-found and unauthorized, so a null
138
+ * read is ambiguous -- fail closed"); callers supply the operation, its
139
+ * consequence, and the recovery advice.
66
140
  *
67
141
  * @param options {object}
68
142
  * @param options.operation {string} what was refused, continuing "Cannot ..."
@@ -1 +1 @@
1
- {"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/internal/describe.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAIjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,EACN,MAAM,aAAa,CAAA;AAEpB;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,oBAAoB,GAC/B,UAAU,IAAI,oBAAoB,GAAG;IACtC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;CAC9C,CAEA;AAED;;;;;;;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GAAG,QAAQ,CAQX"}
@@ -1,6 +1,19 @@
1
- import { readData } from './request.js';
2
- import { collectionPath } from './paths.js';
1
+ import { readDataWithEtag } from './request.js';
2
+ import { collectionMeta } from './paths.js';
3
3
  import { ValidationError } from '../errors.js';
4
+ /**
5
+ * Reads a stored Collection Metadata object as the `CollectionMetadata` wire
6
+ * type. The stored form is typed as an open record -- `custom` is the stored
7
+ * value and a write forwards members this client does not model -- while the
8
+ * server guarantees the object's shape, so the assertion lives here once
9
+ * instead of at each reader.
10
+ *
11
+ * @param stored {StoredCollectionMetadata}
12
+ * @returns {CollectionMetadata}
13
+ */
14
+ export function asCollectionMetadata(stored) {
15
+ return stored;
16
+ }
4
17
  /**
5
18
  * Whether a served encryption descriptor is the server-derived projection of
6
19
  * a Collection governed by its history log (it carries the `history` pointer)
@@ -14,11 +27,11 @@ export function isGovernedDescriptor(descriptor) {
14
27
  return descriptor.history !== undefined;
15
28
  }
16
29
  /**
17
- * Picks the writable Collection Description fields that are set. The one
18
- * inclusion rule (`!== undefined`) behind every description body -- the
19
- * `configure` / `replaceDescription` request bodies and their echoed return
20
- * descriptions, and `Space.createCollection`'s create body -- so the paths
21
- * cannot drift and a new writable field is added in one place.
30
+ * Picks the writable Collection configuration members that are set. The one
31
+ * inclusion rule (`!== undefined`) behind every Collection Metadata write body
32
+ * -- the `configure` / `replaceDescription` request bodies and their echoed
33
+ * returns, and `Space.createCollection`'s create body -- so the paths cannot
34
+ * drift and a new writable member is added in one place.
22
35
  *
23
36
  * @param fields {CollectionWritableFields}
24
37
  * @returns {CollectionWritableFields}
@@ -35,28 +48,122 @@ export function collectionWritableFields(fields) {
35
48
  };
36
49
  }
37
50
  /**
38
- * Reads the Collection Description. Returns `null` if the collection is missing
39
- * or not visible to you (WAS returns 404 for both not-found and unauthorized).
51
+ * The members of a Collection Metadata object the server owns: it ignores them
52
+ * in a request body and re-derives them on every write, so a write never
53
+ * echoes them back. `id` is stated by the write path itself, `type` is the
54
+ * server's classification, and the rest are server-observed (the spec's
55
+ * "server-managed members are read-only" rule).
56
+ */
57
+ const SERVER_MANAGED_MEMBERS = [
58
+ 'id',
59
+ 'type',
60
+ // Not a stored member at all: the client-side projection of the validator
61
+ // that `describe()` returns beside the object, which must not travel back.
62
+ 'etag',
63
+ 'url',
64
+ 'linkset',
65
+ 'createdAt',
66
+ 'updatedAt',
67
+ 'createdBy'
68
+ ];
69
+ /**
70
+ * The Collection's configuration members: what a configuration write
71
+ * (`configure`, `replaceDescription`) states in full and an annotation write
72
+ * carries forward.
73
+ */
74
+ export const CONFIGURATION_MEMBERS = [
75
+ 'name',
76
+ 'backend',
77
+ 'encryption',
78
+ 'generator',
79
+ 'generatorOrigin'
80
+ ];
81
+ /**
82
+ * The Collection's annotation members: the user-writable `custom` and the key
83
+ * epoch its envelope was sealed under. What an annotation write (`setMeta` and
84
+ * its sugar) states and a configuration write carries forward.
85
+ */
86
+ export const ANNOTATION_MEMBERS = ['custom', 'epoch'];
87
+ /**
88
+ * Reads a stored `encryption` descriptor at its wire type. The one place the
89
+ * open stored record is narrowed to `CollectionEncryption`, shared by the
90
+ * compose paths and the codec resolver so the assertion is not repeated.
91
+ *
92
+ * @param stored {StoredCollectionMetadata}
93
+ * @returns {CollectionEncryption | undefined}
94
+ */
95
+ export function storedEncryption(stored) {
96
+ return stored.encryption;
97
+ }
98
+ /**
99
+ * Picks the stored members a full-replacement write carries forward: every
100
+ * member except the ones the server manages and the ones this write states
101
+ * itself. A denylist rather than an allowlist, so a member this client does
102
+ * not model -- `plaintext`, or one a newer server serves -- survives a write
103
+ * it is not about instead of being silently cleared.
104
+ *
105
+ * A governed `encryption` descriptor is deliberately dropped: on a
106
+ * log-governed Collection the served descriptor is the server's projection of
107
+ * the history log's head, and a write that carries it is refused
108
+ * (`encryption-history-log-governed`). Omitting the member leaves the derived
109
+ * descriptor in place.
110
+ *
111
+ * @param stored {StoredCollectionMetadata}
112
+ * @param options {object}
113
+ * @param options.replacing {readonly string[]} the members this write states
114
+ * itself (`CONFIGURATION_MEMBERS` on a configuration write,
115
+ * `ANNOTATION_MEMBERS` on an annotation write)
116
+ * @returns {StoredCollectionMetadata}
117
+ */
118
+ export function carriedForward(stored, { replacing }) {
119
+ const carried = {};
120
+ for (const [member, value] of Object.entries(stored)) {
121
+ if (value === undefined) {
122
+ continue;
123
+ }
124
+ if (SERVER_MANAGED_MEMBERS.includes(member) || replacing.includes(member)) {
125
+ continue;
126
+ }
127
+ carried[member] = value;
128
+ }
129
+ const encryption = storedEncryption(stored);
130
+ if (encryption !== undefined && isGovernedDescriptor(encryption)) {
131
+ delete carried.encryption;
132
+ }
133
+ return carried;
134
+ }
135
+ /**
136
+ * Reads the Collection Metadata object with its `metaVersion` validator, in the
137
+ * stored wire form. Returns `null` if the collection is missing or not visible
138
+ * to you (WAS returns 404 for both not-found and unauthorized); `etag` is
139
+ * absent against a backend that does not version the object.
40
140
  *
41
141
  * @param context {ClientContext}
42
142
  * @param options {object}
43
143
  * @param options.spaceId {string}
44
144
  * @param options.collectionId {string}
45
145
  * @param [options.capability] {IZcap} capability attached to the request
46
- * @returns {Promise<CollectionDescription | null>}
146
+ * @returns {Promise<{ metadata: StoredCollectionMetadata; etag?: string } | null>}
47
147
  */
48
- export async function describeCollection(context, options) {
49
- return readData(context, {
50
- path: collectionPath(options.spaceId, options.collectionId),
148
+ export async function readCollectionMetadata(context, options) {
149
+ const read = await readDataWithEtag(context, {
150
+ path: collectionMeta(options.spaceId, options.collectionId),
51
151
  capability: options.capability
52
152
  });
153
+ if (read === null) {
154
+ return null;
155
+ }
156
+ return {
157
+ metadata: read.data,
158
+ ...(read.etag !== undefined && { etag: read.etag })
159
+ };
53
160
  }
54
161
  /**
55
- * Builds the fail-closed error for an operation that needs a description it
56
- * could not read. The one owner of the masked-404 policy statement ("WAS
57
- * returns 404 for both not-found and unauthorized, so a null description is
58
- * ambiguous -- fail closed"); callers supply the operation, its consequence,
59
- * and the recovery advice.
162
+ * Builds the fail-closed error for an operation that needs a Collection
163
+ * Metadata object it could not read. The one owner of the masked-404 policy
164
+ * statement ("WAS returns 404 for both not-found and unauthorized, so a null
165
+ * read is ambiguous -- fail closed"); callers supply the operation, its
166
+ * consequence, and the recovery advice.
60
167
  *
61
168
  * @param options {object}
62
169
  * @param options.operation {string} what was refused, continuing "Cannot ..."
@@ -1 +1 @@
1
- {"version":3,"file":"describe.js","sourceRoot":"","sources":["../../src/internal/describe.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAS9C;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAgC;IAIhC,OAAO,UAAU,CAAC,OAAO,KAAK,SAAS,CAAA;AACzC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAgC;IAEhC,OAAO;QACL,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QACvD,GAAG,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;QAChE,GAAG,CAAC,MAAM,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;QACzE,GAAG,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;QACtE,GAAG,CAAC,MAAM,CAAC,eAAe,KAAK,SAAS,IAAI;YAC1C,eAAe,EAAE,MAAM,CAAC,eAAe;SACxC,CAAC;KACH,CAAA;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAAsB,EACtB,OAAsE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AAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC7C,CAAA;AACH,CAAC"}
@@ -16,47 +16,51 @@ import type { IZcap, ResourceMetadataCustom, ResourceMetadataCustomInput } from
16
16
  * @param options.slot {MetaReadSlot} the `/meta` slot being read, for an
17
17
  * encrypting codec's envelope-binding check
18
18
  * @param [options.capability] {IZcap}
19
+ * @param [options.onStored] {function} receives the document as served, with
20
+ * its validator and its `custom` still undecoded, before the decode -- so a
21
+ * caller whose next step is a full-replacement write of the same document
22
+ * can compose that write against the read it just paid for
19
23
  * @returns {Promise<(Metadata & { etag?: string }) | null>}
20
24
  */
21
25
  export declare function readMeta<Metadata extends {
22
26
  custom?: ResourceMetadataCustom;
23
- }>(context: ClientContext, { metaPath, codec: codecPromise, subject, slot, capability }: {
27
+ }>(context: ClientContext, { metaPath, codec: codecPromise, subject, slot, capability, onStored }: {
24
28
  metaPath: string;
25
29
  codec: Promise<ResourceCodec>;
26
30
  subject: string;
27
31
  slot: MetaReadSlot;
28
32
  capability?: IZcap;
33
+ onStored?: (read: {
34
+ metadata: Record<string, unknown>;
35
+ etag?: string;
36
+ }) => void;
29
37
  }): Promise<(Metadata & {
30
38
  etag?: string;
31
39
  }) | null>;
32
40
  /**
33
- * Replaces a metadata document's user-writable `custom`, encoding it through
34
- * the codec first (which seals it into an opaque envelope on an encrypted
35
- * collection).
41
+ * Replaces a Resource metadata document's user-writable `custom`, encoding it
42
+ * through the codec first (which seals it into an opaque envelope on an
43
+ * encrypted collection). A key epoch the codec surfaces is deliberately
44
+ * dropped: a Resource's epoch stamps its *content* write through the
45
+ * `Key-Epoch` header, not its metadata.
36
46
  *
37
47
  * @param context {ClientContext}
38
48
  * @param options {object}
39
- * @param options.metaPath {string} the `/meta` sub-resource path
49
+ * @param options.metaPath {string} the `meta` sub-resource path
40
50
  * @param options.codec {Promise<ResourceCodec>} the resolving codec
41
51
  * @param options.custom {ResourceMetadataCustomInput} the user-writable
42
52
  * properties, as a full replacement
43
- * @param options.sendEpoch {boolean} whether the codec's key epoch travels as
44
- * a top-level member of this PUT body. True at Collection level, where the
45
- * stamp describes the `custom` envelope itself; false at Resource level,
46
- * where a Resource's epoch instead stamps its content write via the
47
- * `Key-Epoch` header, so an epoch surfaced here is deliberately dropped.
48
- * @param options.slot {MetaWriteSlot} the `/meta` slot being written, which
53
+ * @param options.slot {MetaWriteSlot} the `meta` slot being written, which
49
54
  * an encrypting codec binds into the envelope
50
- * @param [options.ifMatch] {string} update only if the `/meta` ETag matches
55
+ * @param [options.ifMatch] {string} update only if the `meta` ETag matches
51
56
  * @param [options.ifNoneMatch] {boolean} write only if no metadata is set
52
57
  * @param [options.capability] {IZcap}
53
58
  * @returns {Promise<{ etag?: string }>} the metadata's new ETag
54
59
  */
55
- export declare function writeMeta(context: ClientContext, { metaPath, codec: codecPromise, custom, sendEpoch, slot, ifMatch, ifNoneMatch, capability }: {
60
+ export declare function writeMeta(context: ClientContext, { metaPath, codec: codecPromise, custom, slot, ifMatch, ifNoneMatch, capability }: {
56
61
  metaPath: string;
57
62
  codec: Promise<ResourceCodec>;
58
63
  custom: ResourceMetadataCustomInput;
59
- sendEpoch: boolean;
60
64
  slot: MetaWriteSlot;
61
65
  ifMatch?: string;
62
66
  ifNoneMatch?: boolean;
@@ -68,12 +72,23 @@ export declare function writeMeta(context: ClientContext, { metaPath, codec: cod
68
72
  * The shared read-then-CAS body of the handles' `setName` / `setTags`: reads
69
73
  * the current metadata, merges `patch` over its `custom`, and writes it back
70
74
  * pinned to the read's `etag` (when the backend supports `conditional-writes`),
71
- * so a concurrent metadata write surfaces as `PreconditionFailedError` instead
72
- * of being silently erased by the full-replacement write.
75
+ * so a concurrent metadata write is rebased on rather than silently erased by
76
+ * the full-replacement write.
77
+ *
78
+ * A lost race (`412`) re-reads and re-applies the patch, up to the shared
79
+ * compare-and-swap attempt limit. A handle whose metadata cannot be read at
80
+ * all patches nothing onto an empty object: the write it drives is the one
81
+ * that refuses (`Collection.setMeta` throws `NotFoundError`), so a masked 404
82
+ * cannot turn a rename into a create. At Collection level that is not a rare event:
83
+ * one `metaVersion` covers the configuration members and the annotations
84
+ * alike, so a concurrent `configure` -- or an epoch rotation -- legitimately
85
+ * invalidates an in-flight annotation write.
73
86
  *
74
87
  * @param handle {object} the Collection or Resource handle to patch
75
88
  * @param patch {ResourceMetadataCustom} the properties to merge over the
76
89
  * current `custom`
90
+ * @param operation {string} what the caller is doing, for the exhaustion
91
+ * error (e.g. `Metadata update`)
77
92
  * @returns {Promise<void>}
78
93
  */
79
94
  export declare function patchCustom(handle: {
@@ -88,5 +103,5 @@ export declare function patchCustom(handle: {
88
103
  }): Promise<{
89
104
  etag?: string;
90
105
  }>;
91
- }, patch: ResourceMetadataCustom): Promise<void>;
106
+ }, patch: ResourceMetadataCustom, operation?: string): Promise<void>;
92
107
  //# sourceMappingURL=meta.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/internal/meta.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAIjD,OAAO,KAAK,EACV,KAAK,EACL,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,aAAa,CAAA;AAEpB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,QAAQ,CAC5B,QAAQ,SAAS;IAAE,MAAM,CAAC,EAAE,sBAAsB,CAAA;CAAE,EAEpD,OAAO,EAAE,aAAa,EACtB,EACE,QAAQ,EACR,KAAK,EAAE,YAAY,EACnB,OAAO,EACP,IAAI,EACJ,UAAU,EACX,EAAE;IACD,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,I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