@tearleads/client-sdk 0.1.41 → 0.1.43

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 (235) hide show
  1. package/client/Tearleads.js +3 -0
  2. package/client/Tearleads.js.map +1 -1
  3. package/data/blobs/transferPool.js +35 -8
  4. package/data/blobs/transferPool.js.map +1 -1
  5. package/data/containers/shared/projection.js +12 -0
  6. package/data/containers/shared/projection.js.map +1 -1
  7. package/data/documents/blob/shared/types.d.ts +2 -3
  8. package/data/documents/blob/shared/types.js.map +1 -1
  9. package/data/documents/shared/events.js +0 -1
  10. package/data/documents/shared/events.js.map +1 -1
  11. package/data/keyingProjectionVerification/accessManifestCheckpointEnforcement.js +2 -0
  12. package/data/keyingProjectionVerification/accessManifestCheckpointEnforcement.js.map +1 -1
  13. package/data/keyingProjectionVerification/checkpointContext.d.ts +12 -0
  14. package/data/keyingProjectionVerification/checkpointContext.js +16 -0
  15. package/data/keyingProjectionVerification/checkpointContext.js.map +1 -1
  16. package/data/keyingProjectionVerification/containerDestinationVerification.js +3 -1
  17. package/data/keyingProjectionVerification/containerDestinationVerification.js.map +1 -1
  18. package/data/keyingProjectionVerification/containerProjectionVerification.js +12 -6
  19. package/data/keyingProjectionVerification/containerProjectionVerification.js.map +1 -1
  20. package/data/keyingProjectionVerification/documentProjectionVerification.js +10 -4
  21. package/data/keyingProjectionVerification/documentProjectionVerification.js.map +1 -1
  22. package/data/persistence/container-contents/containerContentsPersistence.js +6 -22
  23. package/data/persistence/container-contents/containerContentsPersistence.js.map +1 -1
  24. package/data/persistence/container-contents/containerMetadataMutationPersistence.js +5 -15
  25. package/data/persistence/container-contents/containerMetadataMutationPersistence.js.map +1 -1
  26. package/data/persistence/container-contents/containerPendingUpdatePersistence.js +6 -15
  27. package/data/persistence/container-contents/containerPendingUpdatePersistence.js.map +1 -1
  28. package/data/persistence/container-contents/containerRecoveryPersistence.js +3 -4
  29. package/data/persistence/container-contents/containerRecoveryPersistence.js.map +1 -1
  30. package/data/persistence/container-contents/containerRemovalWork.js +3 -5
  31. package/data/persistence/container-contents/containerRemovalWork.js.map +1 -1
  32. package/data/persistence/container-contents/dormantContainerMetadata.js +1 -5
  33. package/data/persistence/container-contents/dormantContainerMetadata.js.map +1 -1
  34. package/data/persistence/documents/documentsPersistence.js +4 -9
  35. package/data/persistence/documents/documentsPersistence.js.map +1 -1
  36. package/data/persistence/documents/internal/discardDocument.js +1 -2
  37. package/data/persistence/documents/internal/discardDocument.js.map +1 -1
  38. package/data/persistence/documents/internal/documentDeletionPersistence.js +1 -2
  39. package/data/persistence/documents/internal/documentDeletionPersistence.js.map +1 -1
  40. package/data/persistence/documents/internal/documentMutationPersistence.js +17 -25
  41. package/data/persistence/documents/internal/documentMutationPersistence.js.map +1 -1
  42. package/data/persistence/documents/internal/orphanSideRows.js +2 -14
  43. package/data/persistence/documents/internal/orphanSideRows.js.map +1 -1
  44. package/data/persistence/documents/internal/syncQueuePersistence.js +3 -3
  45. package/data/persistence/documents/internal/syncQueuePersistence.js.map +1 -1
  46. package/data/persistence/keyingCheckpointAdvancePersistence.js +27 -8
  47. package/data/persistence/keyingCheckpointAdvancePersistence.js.map +1 -1
  48. package/data/persistence/verifiedManifestBundlePersistence.d.ts +45 -0
  49. package/data/persistence/verifiedManifestBundlePersistence.js +282 -0
  50. package/data/persistence/verifiedManifestBundlePersistence.js.map +1 -0
  51. package/data/sqlite/documentHistoryPersistence.d.ts +9 -3
  52. package/data/sqlite/documentHistoryPersistence.js +31 -8
  53. package/data/sqlite/documentHistoryPersistence.js.map +1 -1
  54. package/data/sqlite/documentPendingUpdatePersistence.d.ts +58 -11
  55. package/data/sqlite/documentPendingUpdatePersistence.js +137 -63
  56. package/data/sqlite/documentPendingUpdatePersistence.js.map +1 -1
  57. package/data/sqlite/documentPersistence.d.ts +1 -1
  58. package/data/sqlite/documentPersistence.js +1 -1
  59. package/data/sqlite/documentPersistence.js.map +1 -1
  60. package/data/sqlite/documentPersistenceTypes.d.ts +2 -2
  61. package/data/sqlite/documentPersistenceTypes.js.map +1 -1
  62. package/data/sqlite/documentRecordPersistence.js +5 -4
  63. package/data/sqlite/documentRecordPersistence.js.map +1 -1
  64. package/data/sqlite/schema.d.ts +350 -443
  65. package/data/sqlite/schema.js +49 -47
  66. package/data/sqlite/schema.js.map +1 -1
  67. package/data/sqlite/verifiedManifestBundleSchema.d.ts +174 -0
  68. package/data/sqlite/verifiedManifestBundleSchema.js +36 -0
  69. package/data/sqlite/verifiedManifestBundleSchema.js.map +1 -0
  70. package/internal/api-client/ApiClient.d.ts +17 -19
  71. package/internal/api-client/ApiClient.js +10 -11
  72. package/internal/api-client/ApiClient.js.map +1 -1
  73. package/internal/api-client/binaryRequestOperationTransport.d.ts +18 -0
  74. package/internal/api-client/index.d.ts +2 -1
  75. package/internal/api-client/index.js +1 -1
  76. package/internal/api-client/index.js.map +1 -1
  77. package/internal/api-client/operationTransportFactory.d.ts +6 -0
  78. package/internal/api-client/principalHistoryRequest.js +8 -2
  79. package/internal/api-client/principalHistoryRequest.js.map +1 -1
  80. package/internal/api-client/principalHistoryRequestContext.js +15 -5
  81. package/internal/api-client/principalHistoryRequestContext.js.map +1 -1
  82. package/internal/api-client/routes/blobs/get.d.ts +7 -0
  83. package/internal/api-client/routes/blobs/get.js.map +1 -1
  84. package/internal/api-client/routes/blobs/multipart.js +1 -11
  85. package/internal/api-client/routes/blobs/multipart.js.map +1 -1
  86. package/internal/api-client/routes/blobs/multipartUpload.d.ts +14 -0
  87. package/internal/api-client/routes/blobs/multipartUpload.js +94 -43
  88. package/internal/api-client/routes/blobs/multipartUpload.js.map +1 -1
  89. package/internal/api-client/routes/writerProjections.js +6 -3
  90. package/internal/api-client/routes/writerProjections.js.map +1 -1
  91. package/internal/api-client/verifiedManifestCitations.d.ts +23 -0
  92. package/internal/api-client/verifiedManifestCitations.js +60 -0
  93. package/internal/api-client/verifiedManifestCitations.js.map +1 -0
  94. package/internal/api-client/writerProjectionRequests.js +75 -14
  95. package/internal/api-client/writerProjectionRequests.js.map +1 -1
  96. package/internal/crypto/index.d.ts +0 -1
  97. package/internal/crypto/index.js +0 -1
  98. package/internal/crypto/index.js.map +1 -1
  99. package/internal/validators/knownManifestsRefinements.js +5 -0
  100. package/internal/validators/knownManifestsRefinements.js.map +1 -0
  101. package/internal/validators/operation/attachments.d.ts +80 -160
  102. package/internal/validators/operation/auth.d.ts +760 -1664
  103. package/internal/validators/operation/blobDownloads.js +1 -1
  104. package/internal/validators/operation/blobDownloads.js.map +1 -1
  105. package/internal/validators/operation/containerMutations.d.ts +416 -856
  106. package/internal/validators/operation/documentMutations.d.ts +120 -264
  107. package/internal/validators/operation/documentSync.d.ts +40 -80
  108. package/internal/validators/operation/index.d.ts +1 -1
  109. package/internal/validators/operation/index.js +1 -1
  110. package/internal/validators/operation/index.js.map +1 -1
  111. package/internal/validators/operation/multipartBlobs.d.ts +70 -190
  112. package/internal/validators/operation/multipartBlobs.js +2 -24
  113. package/internal/validators/operation/multipartBlobs.js.map +1 -1
  114. package/internal/validators/operation/multipartPartUploads.d.ts +5 -5
  115. package/internal/validators/operation/multipartPartUploads.js +6 -20
  116. package/internal/validators/operation/multipartPartUploads.js.map +1 -1
  117. package/internal/validators/operation/organizations.d.ts +882 -1906
  118. package/internal/validators/operation/principals.d.ts +120 -240
  119. package/internal/validators/operation/registry.d.ts +1 -2
  120. package/internal/validators/operation/registry.js +1 -2
  121. package/internal/validators/operation/registry.js.map +1 -1
  122. package/internal/validators/operation/writerProjections.d.ts +85 -319
  123. package/internal/validators/operation/writerProjections.js +11 -11
  124. package/internal/validators/operation/writerProjections.js.map +1 -1
  125. package/internal/validators/request/blob.d.ts +100 -201
  126. package/internal/validators/request/blob.js +6 -13
  127. package/internal/validators/request/blob.js.map +1 -1
  128. package/internal/validators/request/container.d.ts +136 -272
  129. package/internal/validators/request/container.js +16 -10
  130. package/internal/validators/request/container.js.map +1 -1
  131. package/internal/validators/request/containerManifestRef.d.ts +54 -0
  132. package/internal/validators/request/containerManifestRef.js +28 -0
  133. package/internal/validators/request/containerManifestRef.js.map +1 -0
  134. package/internal/validators/request/containerMetadata.d.ts +160 -368
  135. package/internal/validators/request/document.d.ts +100 -245
  136. package/internal/validators/request/document.js +1 -2
  137. package/internal/validators/request/document.js.map +1 -1
  138. package/internal/validators/request/documentSyncSchema.d.ts +42 -109
  139. package/internal/validators/request/documentSyncSchema.js +8 -25
  140. package/internal/validators/request/documentSyncSchema.js.map +1 -1
  141. package/internal/validators/request/index.d.ts +1 -1
  142. package/internal/validators/request/index.js +1 -1
  143. package/internal/validators/request/index.js.map +1 -1
  144. package/internal/validators/request/organization.d.ts +160 -320
  145. package/internal/validators/request/organizationProvisioning.d.ts +2424 -5312
  146. package/internal/validators/request/principal.d.ts +160 -320
  147. package/internal/validators/request/registration.d.ts +760 -1664
  148. package/internal/validators/response/blob.d.ts +48 -27
  149. package/internal/validators/response/blob.js +3 -10
  150. package/internal/validators/response/blob.js.map +1 -1
  151. package/internal/validators/response/container.d.ts +429 -20
  152. package/internal/validators/response/container.js +40 -5
  153. package/internal/validators/response/container.js.map +1 -1
  154. package/internal/validators/response/documentMutation.d.ts +440 -20
  155. package/internal/validators/response/documentMutation.js +33 -3
  156. package/internal/validators/response/documentMutation.js.map +1 -1
  157. package/internal/validators/response/index.d.ts +4 -3
  158. package/internal/validators/response/index.js +4 -3
  159. package/internal/validators/response/index.js.map +1 -1
  160. package/internal/validators/response/manifestBundleReferences.js +79 -0
  161. package/internal/validators/response/manifestBundleReferences.js.map +1 -0
  162. package/internal/validators/response/writerProjectionWire.d.ts +19 -0
  163. package/internal/validators/response/writerProjectionWire.js +132 -0
  164. package/internal/validators/response/writerProjectionWire.js.map +1 -0
  165. package/internal/validators/schema.js +20 -0
  166. package/internal/validators/schema.js.map +1 -1
  167. package/internal/validators/util/blob.d.ts +7 -0
  168. package/internal/validators/util/blob.js +7 -0
  169. package/internal/validators/util/blob.js.map +1 -1
  170. package/internal/validators/util/blobTransferSchemas.d.ts +41 -0
  171. package/internal/validators/util/blobTransferSchemas.js +39 -0
  172. package/internal/validators/util/blobTransferSchemas.js.map +1 -0
  173. package/internal/validators/util/containerLimits.d.ts +7 -0
  174. package/internal/validators/util/containerLimits.js +7 -0
  175. package/internal/validators/util/containerLimits.js.map +1 -1
  176. package/internal/validators/util/index.d.ts +3 -2
  177. package/internal/validators/util/index.js +3 -2
  178. package/internal/validators/util/index.js.map +1 -1
  179. package/internal/validators/util/knownManifestWire.d.ts +11 -0
  180. package/internal/validators/util/knownManifestWire.js +28 -0
  181. package/internal/validators/util/knownManifestWire.js.map +1 -0
  182. package/internal/validators/writerProjectionRefinements.js +5 -0
  183. package/internal/validators/writerProjectionRefinements.js.map +1 -1
  184. package/package.json +1 -1
  185. package/workflows/blobs/multipartFirstParts.js +82 -0
  186. package/workflows/blobs/multipartFirstParts.js.map +1 -0
  187. package/workflows/blobs/multipartStageResolution.js +83 -0
  188. package/workflows/blobs/multipartStageResolution.js.map +1 -0
  189. package/workflows/blobs/multipartUpload.js +45 -89
  190. package/workflows/blobs/multipartUpload.js.map +1 -1
  191. package/workflows/container-contents/documentPriming.js +2 -1
  192. package/workflows/container-contents/documentPriming.js.map +1 -1
  193. package/workflows/container-contents/documentQueries/sql.js +4 -4
  194. package/workflows/container-contents/documentQueries/sql.js.map +1 -1
  195. package/workflows/container-contents/pendingWrites/deferredTails.js +6 -3
  196. package/workflows/container-contents/pendingWrites/deferredTails.js.map +1 -1
  197. package/workflows/container-contents/pendingWrites/sources.js +2 -1
  198. package/workflows/container-contents/pendingWrites/sources.js.map +1 -1
  199. package/workflows/container-contents/pendingWrites.js +2 -1
  200. package/workflows/container-contents/pendingWrites.js.map +1 -1
  201. package/workflows/containers/child/create.js +3 -3
  202. package/workflows/containers/child/create.js.map +1 -1
  203. package/workflows/containers/child/move.js +2 -2
  204. package/workflows/containers/child/move.js.map +1 -1
  205. package/workflows/containers/child/mutationRequestCore.js +5 -4
  206. package/workflows/containers/child/mutationRequestCore.js.map +1 -1
  207. package/workflows/containers/child/recitePlan.js +3 -2
  208. package/workflows/containers/child/recitePlan.js.map +1 -1
  209. package/workflows/containers/child/sharePlanCore.js +2 -2
  210. package/workflows/containers/child/sharePlanCore.js.map +1 -1
  211. package/workflows/containers/root/create.js +2 -2
  212. package/workflows/containers/root/create.js.map +1 -1
  213. package/workflows/registration/provisioningBootstrapBuilders.d.ts +20 -51
  214. package/workflows/sync/remoteReset.js +11 -9
  215. package/workflows/sync/remoteReset.js.map +1 -1
  216. package/workflows/sync/remoteResetPlans.js +6 -3
  217. package/workflows/sync/remoteResetPlans.js.map +1 -1
  218. package/internal/api-client/projectionHistoryTransport.js +0 -107
  219. package/internal/api-client/projectionHistoryTransport.js.map +0 -1
  220. package/internal/api-client/verifiedProjectionHistory.d.ts +0 -4
  221. package/internal/api-client/verifiedProjectionHistory.js +0 -12
  222. package/internal/api-client/verifiedProjectionHistory.js.map +0 -1
  223. package/internal/crypto/projectionHistory.d.ts +0 -14
  224. package/internal/crypto/projectionHistory.js +0 -90
  225. package/internal/crypto/projectionHistory.js.map +0 -1
  226. package/internal/crypto/projectionHistorySlots.d.ts +0 -13
  227. package/internal/crypto/projectionHistorySlots.js +0 -81
  228. package/internal/crypto/projectionHistorySlots.js.map +0 -1
  229. package/internal/validators/operation/blobTransferSchemas.js +0 -11
  230. package/internal/validators/operation/blobTransferSchemas.js.map +0 -1
  231. package/internal/validators/projectionHistoryRefinements.js +0 -5
  232. package/internal/validators/projectionHistoryRefinements.js.map +0 -1
  233. package/internal/validators/util/projectionHistoryWire.d.ts +0 -23
  234. package/internal/validators/util/projectionHistoryWire.js +0 -33
  235. package/internal/validators/util/projectionHistoryWire.js.map +0 -1
@@ -1,23 +1,29 @@
1
1
  import { z } from "zod";
2
2
  import { registerJsonSchemaView } from "../jsonSchema.js";
3
- import { arraySchema, boundedNonEmptyArraySchema, loosePlainObject, nonEmptyStringSchema, plainObjectSchema, requiredUnknownSchema, } from "../schema.js";
4
- import { AccessManifestBundleWireSchema, ContainerKekKeyringWireRecordSchema, MAX_CONTAINER_PATH_LENGTH, MAX_INLINE_CONTAINER_REKEYS, MAX_ROTATION_CONTAINER_REKEYS, } from "../util/index.js";
5
- const AccessManifestBundleWireArraySchema = arraySchema(AccessManifestBundleWireSchema);
3
+ import { arraySchema, loosePlainObject, nonEmptyStringSchema, plainObjectSchema, requiredUnknownSchema, } from "../schema.js";
4
+ import { ContainerKekKeyringWireRecordSchema, MAX_INLINE_CONTAINER_REKEYS, MAX_ROTATION_CONTAINER_REKEYS, } from "../util/index.js";
5
+ import { ContainerManifestPathSchema, ContainerManifestRefListSchema, ContainerManifestRefSchema, OptionalContainerManifestPathSchema, } from "./containerManifestRef.js";
6
6
  const ContainerMutationKeyringSchema = registerJsonSchemaView(z.custom((value) => ContainerKekKeyringWireRecordSchema.safeParse(value).success), ContainerKekKeyringWireRecordSchema);
7
+ // Every manifest a mutation cites that the server already stores travels as a
8
+ // {containerId, manifestHash} reference. The server resolves each one from its
9
+ // own verified store (or from an earlier mutation of the same batch) and pins
10
+ // paths and the previous manifest to current heads; the signed event binds the
11
+ // same hashes as its dependencies, so no request copy of a stored bundle is
12
+ // ever needed. Only the new manifest this mutation commits travels in full.
7
13
  const containerMutationRequestShape = {
8
14
  body: requiredUnknownSchema,
9
- containerManifestHistory: AccessManifestBundleWireArraySchema.optional(),
10
- destinationParentContainerPath: AccessManifestBundleWireArraySchema.optional(),
15
+ containerManifestHistoryRefs: ContainerManifestRefListSchema.optional(),
16
+ destinationParentContainerPathRefs: OptionalContainerManifestPathSchema.optional(),
11
17
  event: plainObjectSchema,
12
18
  expectedManifestHash: nonEmptyStringSchema,
13
19
  keyEpoch: plainObjectSchema,
14
20
  keyring: ContainerMutationKeyringSchema.nullable(),
15
21
  manifest: plainObjectSchema,
16
- parentContainerPath: AccessManifestBundleWireArraySchema.optional(),
22
+ parentContainerPathRefs: OptionalContainerManifestPathSchema.optional(),
17
23
  parentKekState: plainObjectSchema.nullable().optional(),
18
24
  predecessorBridge: plainObjectSchema.nullable(),
19
- previousContainerPath: AccessManifestBundleWireArraySchema.optional(),
20
- previousManifest: AccessManifestBundleWireSchema.nullable().optional(),
25
+ previousContainerPathRefs: OptionalContainerManifestPathSchema.optional(),
26
+ previousManifestRef: ContainerManifestRefSchema.nullable().optional(),
21
27
  principalPolicies: arraySchema(plainObjectSchema),
22
28
  userRecipientKeys: arraySchema(plainObjectSchema).optional(),
23
29
  wraps: arraySchema(plainObjectSchema),
@@ -39,8 +45,8 @@ export const ContainerReciteRequestSchema = loosePlainObject({
39
45
  event: plainObjectSchema,
40
46
  expectedManifestHash: nonEmptyStringSchema,
41
47
  manifest: plainObjectSchema,
42
- previousContainerPath: boundedNonEmptyArraySchema(AccessManifestBundleWireSchema, MAX_CONTAINER_PATH_LENGTH),
43
- previousManifest: AccessManifestBundleWireSchema,
48
+ previousContainerPathRefs: ContainerManifestPathSchema,
49
+ previousManifestRef: ContainerManifestRefSchema,
44
50
  principalPolicies: arraySchema(plainObjectSchema),
45
51
  });
46
52
  export function isContainerReciteRequest(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"container.js","sourceRoot":"","sources":["container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EACL,WAAW,EACX,0BAA0B,EAC1B,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,8BAA8B,EAC9B,mCAAmC,EACnC,yBAAyB,EACzB,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,SAAS,CAAC;AAEjB,MAAM,mCAAmC,GAAG,WAAW,CACrD,8BAA8B,CAC/B,CAAC;AAEF,MAAM,8BAA8B,GAAG,sBAAsB,CAC3D,CAAC,CAAC,MAAM,CACN,CAAC,KAAK,EAAE,EAAE,CAAC,mC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E,oBAAoB;IAC1C,QAAQ,EAAE,iBAAiB;IAC3B,qBAAqB,EAAE,0BAA0B,CAC/C,8BAA8B,EAC9B,yBAAyB,CAC1B;IACD,gBAAgB,EAAE,8BAA8B;IAChD,iBAAiB,EAAE,WAAW,CAAC,iBAAiB,CAAC;CAClD,CAAC,CAAC;AAMH,MAAM,UAAU,wBAAwB,CACtC,KAAc;IAEd,OAAO,4BAA4B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,OAAO,8BAA8B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,OAAO,8BAA8B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,KAAc;IAEd,OAAO,WAAW,CAChB,8BAA8B,EAC9B,2BAA2B,CAC5B;SACE,QAAQ,EAAE;SACV,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC9B,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { registerJsonSchemaView } from \"../jsonSchema\";\nimport {\n arraySchema,\n boundedNonEmptyArraySchema,\n loosePlainObject,\n nonEmptyStringSchema,\n plainObjectSchema,\n requiredUnknownSchema,\n} from \"../schema\";\nimport {\n AccessManifestBundleWireSchema,\n ContainerKekKeyringWireRecordSchema,\n MAX_CONTAINER_PATH_LENGTH,\n MAX_INLINE_CONTAINER_REKEYS,\n MAX_ROTATION_CONTAINER_REKEYS,\n} from \"../util\";\n\nconst AccessManifestBundleWireArraySchema = arraySchema(\n AccessManifestBundleWireSchema,\n);\n\nconst ContainerMutationKeyringSchema = registerJsonSchemaView(\n z.custom<Record<string, unknown>>(\n (value) => ContainerKekKeyringWireRecordSchema.safeParse(value).success,\n ),\n ContainerKekKeyringWireRecordSchema,\n);\n\nconst containerMutationRequestShape = {\n body: requiredUnknownSchema,\n containerManifestHistory: AccessManifestBundleWireArraySchema.optional(),\n destinationParentContainerPath:\n AccessManifestBundleWireArraySchema.optional(),\n event: plainObjectSchema,\n expectedManifestHash: nonEmptyStringSchema,\n keyEpoch: plainObjectSchema,\n keyring: ContainerMutationKeyringSchema.nullable(),\n manifest: plainObjectSchema,\n parentContainerPath: AccessManifestBundleWireArraySchema.optional(),\n parentKekState: plainObjectSchema.nullable().optional(),\n predecessorBridge: plainObjectSchema.nullable(),\n previousContainerPath: AccessManifestBundleWireArraySchema.optional(),\n previousManifest: AccessManifestBundleWireSchema.nullable().optional(),\n principalPolicies: arraySchema(plainObjectSchema),\n userRecipientKeys: arraySchema(plainObjectSchema).optional(),\n wraps: arraySchema(plainObjectSchema),\n};\n\nexport const ContainerMutationRequestSchema = loosePlainObject(\n containerMutationRequestShape,\n);\n\nexport type ContainerMutationRequest = z.infer<\n typeof ContainerMutationRequestSchema\n>;\n\n/**\n * A rekey, revoke, or move: the rotation plus the descendant rekeys it must\n * commit with. `containerRekeys` names, parent-first, the descendants above a\n * directly granted container; they commit with the rotation or not at all.\n * Only these three routes take it, so the carriers that already hold a flat\n * rekey list (document and blob writes) stay as they are.\n */\nexport const ContainerRotationRequestSchema = loosePlainObject({\n ...containerMutationRequestShape,\n containerRekeys: arraySchema(\n ContainerMutationRequestSchema,\n MAX_ROTATION_CONTAINER_REKEYS,\n ).optional(),\n});\n\nexport type ContainerRotationRequest = z.infer<\n typeof ContainerRotationRequestSchema\n>;\n\nexport const ContainerReciteRequestSchema = loosePlainObject({\n body: requiredUnknownSchema,\n event: plainObjectSchema,\n expectedManifestHash: nonEmptyStringSchema,\n manifest: plainObjectSchema,\n previousContainerPath: boundedNonEmptyArraySchema(\n AccessManifestBundleWireSchema,\n MAX_CONTAINER_PATH_LENGTH,\n ),\n previousManifest: AccessManifestBundleWireSchema,\n principalPolicies: arraySchema(plainObjectSchema),\n});\n\nexport type ContainerReciteRequest = z.infer<\n typeof ContainerReciteRequestSchema\n>;\n\nexport function isContainerReciteRequest(\n value: unknown,\n): value is ContainerReciteRequest {\n return ContainerReciteRequestSchema.safeParse(value).success;\n}\n\nexport function isContainerRotationRequest(\n value: unknown,\n): value is ContainerRotationRequest {\n return ContainerRotationRequestSchema.safeParse(value).success;\n}\n\nexport function isContainerMutationRequest(\n value: unknown,\n): value is ContainerMutationRequest {\n return ContainerMutationRequestSchema.safeParse(value).success;\n}\n\nexport function isOptionalContainerMutationRequestArray(\n value: unknown,\n): value is ContainerMutationRequest[] | undefined {\n return arraySchema(\n ContainerMutationRequestSchema,\n MAX_INLINE_CONTAINER_REKEYS,\n )\n .optional()\n .safeParse(value).success;\n}\n"]}
1
+ {"version":3,"file":"container.js","sourceRoot":"","sources":["container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,mCAAmC,EACnC,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,0BAA0B,EAC1B,mCAAmC,GACpC,MAAM,wBAAwB,CAAC;AAEhC,MAAM,8BAA8B,GAAG,sBAAsB,CAC3D,CAAC,CAAC,MAAM,CACN,CAAC,KAAK,EAAE,EAAE,CAAC,mCAAmC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CACxE,EACD,mCAAmC,CACpC,CAAC;AAEF,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,4EAA4E;AAC5E,MAAM,6BAA6B,GAAG;IACpC,IAAI,EAAE,qBAAqB;IAC3B,4BAA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;CAClD,CAAC,CAAC;AAMH,MAAM,UAAU,wBAAwB,CACtC,KAAc;IAEd,OAAO,4BAA4B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,OAAO,8BAA8B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,OAAO,8BAA8B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,KAAc;IAEd,OAAO,WAAW,CAChB,8BAA8B,EAC9B,2BAA2B,CAC5B;SACE,QAAQ,EAAE;SACV,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC9B,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { registerJsonSchemaView } from \"../jsonSchema\";\nimport {\n arraySchema,\n loosePlainObject,\n nonEmptyStringSchema,\n plainObjectSchema,\n requiredUnknownSchema,\n} from \"../schema\";\nimport {\n ContainerKekKeyringWireRecordSchema,\n MAX_INLINE_CONTAINER_REKEYS,\n MAX_ROTATION_CONTAINER_REKEYS,\n} from \"../util\";\nimport {\n ContainerManifestPathSchema,\n ContainerManifestRefListSchema,\n ContainerManifestRefSchema,\n OptionalContainerManifestPathSchema,\n} from \"./containerManifestRef\";\n\nconst ContainerMutationKeyringSchema = registerJsonSchemaView(\n z.custom<Record<string, unknown>>(\n (value) => ContainerKekKeyringWireRecordSchema.safeParse(value).success,\n ),\n ContainerKekKeyringWireRecordSchema,\n);\n\n// Every manifest a mutation cites that the server already stores travels as a\n// {containerId, manifestHash} reference. The server resolves each one from its\n// own verified store (or from an earlier mutation of the same batch) and pins\n// paths and the previous manifest to current heads; the signed event binds the\n// same hashes as its dependencies, so no request copy of a stored bundle is\n// ever needed. Only the new manifest this mutation commits travels in full.\nconst containerMutationRequestShape = {\n body: requiredUnknownSchema,\n containerManifestHistoryRefs: ContainerManifestRefListSchema.optional(),\n destinationParentContainerPathRefs:\n OptionalContainerManifestPathSchema.optional(),\n event: plainObjectSchema,\n expectedManifestHash: nonEmptyStringSchema,\n keyEpoch: plainObjectSchema,\n keyring: ContainerMutationKeyringSchema.nullable(),\n manifest: plainObjectSchema,\n parentContainerPathRefs: OptionalContainerManifestPathSchema.optional(),\n parentKekState: plainObjectSchema.nullable().optional(),\n predecessorBridge: plainObjectSchema.nullable(),\n previousContainerPathRefs: OptionalContainerManifestPathSchema.optional(),\n previousManifestRef: ContainerManifestRefSchema.nullable().optional(),\n principalPolicies: arraySchema(plainObjectSchema),\n userRecipientKeys: arraySchema(plainObjectSchema).optional(),\n wraps: arraySchema(plainObjectSchema),\n};\n\nexport const ContainerMutationRequestSchema = loosePlainObject(\n containerMutationRequestShape,\n);\n\nexport type ContainerMutationRequest = z.infer<\n typeof ContainerMutationRequestSchema\n>;\n\n/**\n * A rekey, revoke, or move: the rotation plus the descendant rekeys it must\n * commit with. `containerRekeys` names, parent-first, the descendants above a\n * directly granted container; they commit with the rotation or not at all.\n * Only these three routes take it, so the carriers that already hold a flat\n * rekey list (document and blob writes) stay as they are.\n */\nexport const ContainerRotationRequestSchema = loosePlainObject({\n ...containerMutationRequestShape,\n containerRekeys: arraySchema(\n ContainerMutationRequestSchema,\n MAX_ROTATION_CONTAINER_REKEYS,\n ).optional(),\n});\n\nexport type ContainerRotationRequest = z.infer<\n typeof ContainerRotationRequestSchema\n>;\n\nexport const ContainerReciteRequestSchema = loosePlainObject({\n body: requiredUnknownSchema,\n event: plainObjectSchema,\n expectedManifestHash: nonEmptyStringSchema,\n manifest: plainObjectSchema,\n previousContainerPathRefs: ContainerManifestPathSchema,\n previousManifestRef: ContainerManifestRefSchema,\n principalPolicies: arraySchema(plainObjectSchema),\n});\n\nexport type ContainerReciteRequest = z.infer<\n typeof ContainerReciteRequestSchema\n>;\n\nexport function isContainerReciteRequest(\n value: unknown,\n): value is ContainerReciteRequest {\n return ContainerReciteRequestSchema.safeParse(value).success;\n}\n\nexport function isContainerRotationRequest(\n value: unknown,\n): value is ContainerRotationRequest {\n return ContainerRotationRequestSchema.safeParse(value).success;\n}\n\nexport function isContainerMutationRequest(\n value: unknown,\n): value is ContainerMutationRequest {\n return ContainerMutationRequestSchema.safeParse(value).success;\n}\n\nexport function isOptionalContainerMutationRequestArray(\n value: unknown,\n): value is ContainerMutationRequest[] | undefined {\n return arraySchema(\n ContainerMutationRequestSchema,\n MAX_INLINE_CONTAINER_REKEYS,\n )\n .optional()\n .safeParse(value).success;\n}\n"]}
@@ -0,0 +1,54 @@
1
+ import type { z } from "zod";
2
+ /**
3
+ * A reference to a container access manifest the server already stores, in lieu
4
+ * of re-embedding the full signed manifest bundle. The server resolves the full
5
+ * manifest from its own store by `manifestHash` and pins it to the container's
6
+ * current head, so the reference carries the same authority as the full bundle
7
+ * without the multi-KB signature. `containerId` is advisory: the server keys the
8
+ * head lookup off the resolved bundle's own containerId and rejects a mismatch.
9
+ */
10
+ export declare const ContainerManifestRefSchema: z.ZodType<{
11
+ containerId: string;
12
+ manifestHash: string;
13
+ }, {
14
+ containerId: string;
15
+ manifestHash: string;
16
+ }, z.core.$ZodTypeInternals<{
17
+ containerId: string;
18
+ manifestHash: string;
19
+ }, {
20
+ containerId: string;
21
+ manifestHash: string;
22
+ }>>;
23
+ export type ContainerManifestRef = z.infer<typeof ContainerManifestRefSchema>;
24
+ /** A root→leaf container path, cited by manifest reference. */
25
+ export declare const ContainerManifestPathSchema: z.ZodCustom<{
26
+ containerId: string;
27
+ manifestHash: string;
28
+ }[], {
29
+ containerId: string;
30
+ manifestHash: string;
31
+ }[]>;
32
+ /**
33
+ * A path that may be empty: a root container create cites no parent. Bounded
34
+ * by the same depth ceiling as a non-empty path.
35
+ */
36
+ export declare const OptionalContainerManifestPathSchema: z.ZodCustom<{
37
+ containerId: string;
38
+ manifestHash: string;
39
+ }[], {
40
+ containerId: string;
41
+ manifestHash: string;
42
+ }[]>;
43
+ /**
44
+ * Stored manifests of one container, cited by reference. A container's lineage
45
+ * has no fixed length; the ceiling keeps the capacity inline bundles had under
46
+ * the request-body bound (see `MAX_CONTAINER_MANIFEST_HISTORY_REFS`).
47
+ */
48
+ export declare const ContainerManifestRefListSchema: z.ZodCustom<{
49
+ containerId: string;
50
+ manifestHash: string;
51
+ }[], {
52
+ containerId: string;
53
+ manifestHash: string;
54
+ }[]>;
@@ -0,0 +1,28 @@
1
+ import { arraySchema, boundedNonEmptyArraySchema, loosePlainObject, nonEmptyStringSchema, } from "../schema.js";
2
+ import { MAX_CONTAINER_MANIFEST_HISTORY_REFS, MAX_CONTAINER_PATH_LENGTH, } from "../util/containerLimits.js";
3
+ /**
4
+ * A reference to a container access manifest the server already stores, in lieu
5
+ * of re-embedding the full signed manifest bundle. The server resolves the full
6
+ * manifest from its own store by `manifestHash` and pins it to the container's
7
+ * current head, so the reference carries the same authority as the full bundle
8
+ * without the multi-KB signature. `containerId` is advisory: the server keys the
9
+ * head lookup off the resolved bundle's own containerId and rejects a mismatch.
10
+ */
11
+ export const ContainerManifestRefSchema = loosePlainObject({
12
+ containerId: nonEmptyStringSchema,
13
+ manifestHash: nonEmptyStringSchema,
14
+ });
15
+ /** A root→leaf container path, cited by manifest reference. */
16
+ export const ContainerManifestPathSchema = boundedNonEmptyArraySchema(ContainerManifestRefSchema, MAX_CONTAINER_PATH_LENGTH);
17
+ /**
18
+ * A path that may be empty: a root container create cites no parent. Bounded
19
+ * by the same depth ceiling as a non-empty path.
20
+ */
21
+ export const OptionalContainerManifestPathSchema = arraySchema(ContainerManifestRefSchema, MAX_CONTAINER_PATH_LENGTH);
22
+ /**
23
+ * Stored manifests of one container, cited by reference. A container's lineage
24
+ * has no fixed length; the ceiling keeps the capacity inline bundles had under
25
+ * the request-body bound (see `MAX_CONTAINER_MANIFEST_HISTORY_REFS`).
26
+ */
27
+ export const ContainerManifestRefListSchema = arraySchema(ContainerManifestRefSchema, MAX_CONTAINER_MANIFEST_HISTORY_REFS);
28
+ //# sourceMappingURL=containerManifestRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"containerManifestRef.js","sourceRoot":"","sources":["containerManifestRef.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,0BAA0B,EAC1B,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,mCAAmC,EACnC,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;IACzD,WAAW,EAAE,oBAAoB;IACjC,YAAY,EAAE,oBAAoB;CACnC,CAAC,CAAC;AAIH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,2BAA2B,GAAG,0BAA0B,CACnE,0BAA0B,EAC1B,yBAAyB,CAC1B,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,WAAW,CAC5D,0BAA0B,EAC1B,yBAAyB,CAC1B,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,WAAW,CACvD,0BAA0B,EAC1B,mCAAmC,CACpC,CAAC","sourcesContent":["import type { z } from \"zod\";\nimport {\n arraySchema,\n boundedNonEmptyArraySchema,\n loosePlainObject,\n nonEmptyStringSchema,\n} from \"../schema\";\nimport {\n MAX_CONTAINER_MANIFEST_HISTORY_REFS,\n MAX_CONTAINER_PATH_LENGTH,\n} from \"../util/containerLimits\";\n\n/**\n * A reference to a container access manifest the server already stores, in lieu\n * of re-embedding the full signed manifest bundle. The server resolves the full\n * manifest from its own store by `manifestHash` and pins it to the container's\n * current head, so the reference carries the same authority as the full bundle\n * without the multi-KB signature. `containerId` is advisory: the server keys the\n * head lookup off the resolved bundle's own containerId and rejects a mismatch.\n */\nexport const ContainerManifestRefSchema = loosePlainObject({\n containerId: nonEmptyStringSchema,\n manifestHash: nonEmptyStringSchema,\n});\n\nexport type ContainerManifestRef = z.infer<typeof ContainerManifestRefSchema>;\n\n/** A root→leaf container path, cited by manifest reference. */\nexport const ContainerManifestPathSchema = boundedNonEmptyArraySchema(\n ContainerManifestRefSchema,\n MAX_CONTAINER_PATH_LENGTH,\n);\n\n/**\n * A path that may be empty: a root container create cites no parent. Bounded\n * by the same depth ceiling as a non-empty path.\n */\nexport const OptionalContainerManifestPathSchema = arraySchema(\n ContainerManifestRefSchema,\n MAX_CONTAINER_PATH_LENGTH,\n);\n\n/**\n * Stored manifests of one container, cited by reference. A container's lineage\n * has no fixed length; the ceiling keeps the capacity inline bundles had under\n * the request-body bound (see `MAX_CONTAINER_MANIFEST_HISTORY_REFS`).\n */\nexport const ContainerManifestRefListSchema = arraySchema(\n ContainerManifestRefSchema,\n MAX_CONTAINER_MANIFEST_HISTORY_REFS,\n);\n"]}