@tearleads/client-sdk 0.1.68 → 0.1.71

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 (123) hide show
  1. package/data/containers/shared/principalPolicies.js +8 -12
  2. package/data/containers/shared/principalPolicies.js.map +1 -1
  3. package/internal/api-client/ApiClient.d.ts +73 -3
  4. package/internal/api-client/apiRequestMetrics.d.ts +18 -4
  5. package/internal/api-client/apiRequestMetrics.js +55 -5
  6. package/internal/api-client/apiRequestMetrics.js.map +1 -1
  7. package/internal/api-client/durationSampleWindow.d.ts +26 -0
  8. package/internal/api-client/durationSampleWindow.js +42 -0
  9. package/internal/api-client/durationSampleWindow.js.map +1 -0
  10. package/internal/api-client/measureApiRequest.js +9 -4
  11. package/internal/api-client/measureApiRequest.js.map +1 -1
  12. package/internal/api-client/serverTiming.d.ts +12 -0
  13. package/internal/api-client/serverTiming.js +49 -0
  14. package/internal/api-client/serverTiming.js.map +1 -0
  15. package/internal/validators/documentCreateSeedRefinements.js +9 -0
  16. package/internal/validators/documentCreateSeedRefinements.js.map +1 -0
  17. package/internal/validators/operation/attachments.d.ts +48 -8
  18. package/internal/validators/operation/auth.d.ts +576 -76
  19. package/internal/validators/operation/containerMutations.d.ts +619 -44
  20. package/internal/validators/operation/containerMutations.js +7 -1
  21. package/internal/validators/operation/containerMutations.js.map +1 -1
  22. package/internal/validators/operation/documentMutations.d.ts +428 -12
  23. package/internal/validators/operation/documentMutations.js +6 -1
  24. package/internal/validators/operation/documentMutations.js.map +1 -1
  25. package/internal/validators/operation/documentSync.d.ts +33 -13
  26. package/internal/validators/operation/organizations.d.ts +648 -88
  27. package/internal/validators/operation/principals.d.ts +96 -16
  28. package/internal/validators/request/blob.d.ts +48 -8
  29. package/internal/validators/request/container.d.ts +96 -16
  30. package/internal/validators/request/container.js +5 -2
  31. package/internal/validators/request/container.js.map +1 -1
  32. package/internal/validators/request/containerMetadata.d.ts +409 -16
  33. package/internal/validators/request/containerMetadata.js +20 -3
  34. package/internal/validators/request/containerMetadata.js.map +1 -1
  35. package/internal/validators/request/document.d.ts +631 -10
  36. package/internal/validators/request/document.js +19 -1
  37. package/internal/validators/request/document.js.map +1 -1
  38. package/internal/validators/request/documentCreateSeed.js +35 -0
  39. package/internal/validators/request/documentCreateSeed.js.map +1 -0
  40. package/internal/validators/request/documentSyncSchema.d.ts +24 -4
  41. package/internal/validators/request/documentSyncSchema.js +2 -1
  42. package/internal/validators/request/documentSyncSchema.js.map +1 -1
  43. package/internal/validators/request/index.d.ts +1 -0
  44. package/internal/validators/request/index.js +1 -0
  45. package/internal/validators/request/index.js.map +1 -1
  46. package/internal/validators/request/organization.d.ts +96 -16
  47. package/internal/validators/request/organizationProvisioning.d.ts +1456 -246
  48. package/internal/validators/request/organizationProvisioning.js +9 -22
  49. package/internal/validators/request/organizationProvisioning.js.map +1 -1
  50. package/internal/validators/request/principal.d.ts +120 -20
  51. package/internal/validators/request/principalPolicyRef.d.ts +42 -0
  52. package/internal/validators/request/principalPolicyRef.js +19 -0
  53. package/internal/validators/request/principalPolicyRef.js.map +1 -0
  54. package/internal/validators/request/registration.d.ts +456 -76
  55. package/internal/validators/response/containerMetadata.d.ts +20 -0
  56. package/internal/validators/response/documentMutation.d.ts +43 -0
  57. package/internal/validators/response/documentMutation.js +12 -1
  58. package/internal/validators/response/documentMutation.js.map +1 -1
  59. package/internal/validators/response/documentSyncSchema.d.ts +13 -9
  60. package/internal/validators/response/documentSyncSchema.js +23 -18
  61. package/internal/validators/response/documentSyncSchema.js.map +1 -1
  62. package/internal/validators/response/index.d.ts +1 -1
  63. package/internal/validators/response/index.js.map +1 -1
  64. package/internal/validators/response/organizationProvisioning.d.ts +350 -0
  65. package/internal/validators/response/registration.d.ts +120 -0
  66. package/internal/validators/util/containerLimits.d.ts +8 -0
  67. package/internal/validators/util/containerLimits.js +8 -0
  68. package/internal/validators/util/containerLimits.js.map +1 -1
  69. package/package.json +1 -1
  70. package/stores/container-contents/containerState/containerStatePersistence.js +2 -0
  71. package/stores/container-contents/containerState/containerStatePersistence.js.map +1 -1
  72. package/stores/container-contents/remoteEvents/remoteEventSync.js +1 -1
  73. package/stores/container-contents/remoteEvents/remoteEventSync.js.map +1 -1
  74. package/stores/container-contents/state.js +2 -0
  75. package/stores/container-contents/state.js.map +1 -1
  76. package/stores/container-contents/syncAgent/syncAgentTypes.d.ts +5 -0
  77. package/stores/container-contents/syncAgent/syncAgentTypes.js.map +1 -1
  78. package/stores/documents/documentStore/sync/createdDocumentPersistence.js +71 -0
  79. package/stores/documents/documentStore/sync/createdDocumentPersistence.js.map +1 -0
  80. package/stores/documents/documentStore/sync/index.js +13 -2
  81. package/stores/documents/documentStore/sync/index.js.map +1 -1
  82. package/stores/documents/documentStore/sync/syncRemoteSignals.js +21 -3
  83. package/stores/documents/documentStore/sync/syncRemoteSignals.js.map +1 -1
  84. package/stores/documents/documentStore/sync/syncSeededCreate.js +50 -0
  85. package/stores/documents/documentStore/sync/syncSeededCreate.js.map +1 -0
  86. package/stores/documents/documentStore/sync/syncShared.js +16 -8
  87. package/stores/documents/documentStore/sync/syncShared.js.map +1 -1
  88. package/workflows/container-contents/container-state/create/createIntentSeed.js +60 -0
  89. package/workflows/container-contents/container-state/create/createIntentSeed.js.map +1 -0
  90. package/workflows/container-contents/container-state/create/createIntentSync.js +18 -19
  91. package/workflows/container-contents/container-state/create/createIntentSync.js.map +1 -1
  92. package/workflows/container-contents/container-state/create/createWithMetadata.js +43 -6
  93. package/workflows/container-contents/container-state/create/createWithMetadata.js.map +1 -1
  94. package/workflows/container-contents/container-state/create/createWithMetadataPlan.js +5 -1
  95. package/workflows/container-contents/container-state/create/createWithMetadataPlan.js.map +1 -1
  96. package/workflows/container-contents/container-state/remote.js +15 -0
  97. package/workflows/container-contents/container-state/remote.js.map +1 -1
  98. package/workflows/container-contents/container-state/types.js.map +1 -1
  99. package/workflows/container-contents/metadata/metadataEvents.d.ts +7 -1
  100. package/workflows/container-contents/metadata/metadataEvents.js +8 -2
  101. package/workflows/container-contents/metadata/metadataEvents.js.map +1 -1
  102. package/workflows/container-contents/remoteHydration/types.d.ts +3 -0
  103. package/workflows/container-contents/remoteHydration/types.js.map +1 -1
  104. package/workflows/containers/child/mutationRequestCore.js +2 -2
  105. package/workflows/containers/child/mutationRequestCore.js.map +1 -1
  106. package/workflows/containers/child/recitePlan.js +2 -2
  107. package/workflows/containers/child/recitePlan.js.map +1 -1
  108. package/workflows/containers/root/create.js +17 -28
  109. package/workflows/containers/root/create.js.map +1 -1
  110. package/workflows/containers/root/initialGroupPolicy.js +0 -23
  111. package/workflows/containers/root/initialGroupPolicy.js.map +1 -1
  112. package/workflows/documents/create/index.d.ts +7 -0
  113. package/workflows/documents/create/index.js +40 -2
  114. package/workflows/documents/create/index.js.map +1 -1
  115. package/workflows/documents/index.d.ts +1 -0
  116. package/workflows/documents/index.js +1 -0
  117. package/workflows/documents/index.js.map +1 -1
  118. package/workflows/documents/sync/initialSync.d.ts +39 -0
  119. package/workflows/documents/sync/initialSync.js +39 -6
  120. package/workflows/documents/sync/initialSync.js.map +1 -1
  121. package/workflows/documents/syncFailures/syncPolicyRepair.js +2 -8
  122. package/workflows/documents/syncFailures/syncPolicyRepair.js.map +1 -1
  123. package/workflows/registration/provisioningBootstrapBuilders.d.ts +12 -2
@@ -8,7 +8,12 @@ export declare const containerCreateWithMetadataDocumentRequestShape: {
8
8
  keyring: Record<string, unknown> | null;
9
9
  manifest: Record<string, unknown>;
10
10
  predecessorBridge: Record<string, unknown> | null;
11
- principalPolicies: Record<string, unknown>[];
11
+ principalPolicyRefs: {
12
+ principalType: "group" | "organization";
13
+ principalId: string;
14
+ version: number;
15
+ stateHash: string;
16
+ }[];
12
17
  wraps: Record<string, unknown>[];
13
18
  containerManifestHistoryRefs?: {
14
19
  containerId: string;
@@ -40,7 +45,12 @@ export declare const containerCreateWithMetadataDocumentRequestShape: {
40
45
  keyring: Record<string, unknown> | null;
41
46
  manifest: Record<string, unknown>;
42
47
  predecessorBridge: Record<string, unknown> | null;
43
- principalPolicies: Record<string, unknown>[];
48
+ principalPolicyRefs: {
49
+ principalType: "group" | "organization";
50
+ principalId: string;
51
+ version: number;
52
+ stateHash: string;
53
+ }[];
44
54
  wraps: Record<string, unknown>[];
45
55
  containerManifestHistoryRefs?: {
46
56
  containerId: string;
@@ -72,7 +82,12 @@ export declare const containerCreateWithMetadataDocumentRequestShape: {
72
82
  keyring: Record<string, unknown> | null;
73
83
  manifest: Record<string, unknown>;
74
84
  predecessorBridge: Record<string, unknown> | null;
75
- principalPolicies: Record<string, unknown>[];
85
+ principalPolicyRefs: {
86
+ principalType: "group" | "organization";
87
+ principalId: string;
88
+ version: number;
89
+ stateHash: string;
90
+ }[];
76
91
  wraps: Record<string, unknown>[];
77
92
  containerManifestHistoryRefs?: {
78
93
  containerId: string;
@@ -104,7 +119,12 @@ export declare const containerCreateWithMetadataDocumentRequestShape: {
104
119
  keyring: Record<string, unknown> | null;
105
120
  manifest: Record<string, unknown>;
106
121
  predecessorBridge: Record<string, unknown> | null;
107
- principalPolicies: Record<string, unknown>[];
122
+ principalPolicyRefs: {
123
+ principalType: "group" | "organization";
124
+ principalId: string;
125
+ version: number;
126
+ stateHash: string;
127
+ }[];
108
128
  wraps: Record<string, unknown>[];
109
129
  containerManifestHistoryRefs?: {
110
130
  containerId: string;
@@ -159,7 +179,12 @@ export declare const containerCreateWithMetadataDocumentRequestShape: {
159
179
  keyring: Record<string, unknown> | null;
160
180
  manifest: Record<string, unknown>;
161
181
  predecessorBridge: Record<string, unknown> | null;
162
- principalPolicies: Record<string, unknown>[];
182
+ principalPolicyRefs: {
183
+ principalType: "group" | "organization";
184
+ principalId: string;
185
+ version: number;
186
+ stateHash: string;
187
+ }[];
163
188
  wraps: Record<string, unknown>[];
164
189
  containerManifestHistoryRefs?: {
165
190
  containerId: string;
@@ -218,7 +243,12 @@ export declare const containerCreateWithMetadataDocumentRequestShape: {
218
243
  keyring: Record<string, unknown> | null;
219
244
  manifest: Record<string, unknown>;
220
245
  predecessorBridge: Record<string, unknown> | null;
221
- principalPolicies: Record<string, unknown>[];
246
+ principalPolicyRefs: {
247
+ principalType: "group" | "organization";
248
+ principalId: string;
249
+ version: number;
250
+ stateHash: string;
251
+ }[];
222
252
  wraps: Record<string, unknown>[];
223
253
  containerManifestHistoryRefs?: {
224
254
  containerId: string;
@@ -277,7 +307,12 @@ export declare const containerCreateWithMetadataDocumentRequestShape: {
277
307
  keyring: Record<string, unknown> | null;
278
308
  manifest: Record<string, unknown>;
279
309
  predecessorBridge: Record<string, unknown> | null;
280
- principalPolicies: Record<string, unknown>[];
310
+ principalPolicyRefs: {
311
+ principalType: "group" | "organization";
312
+ principalId: string;
313
+ version: number;
314
+ stateHash: string;
315
+ }[];
281
316
  wraps: Record<string, unknown>[];
282
317
  containerManifestHistoryRefs?: {
283
318
  containerId: string;
@@ -336,7 +371,12 @@ export declare const containerCreateWithMetadataDocumentRequestShape: {
336
371
  keyring: Record<string, unknown> | null;
337
372
  manifest: Record<string, unknown>;
338
373
  predecessorBridge: Record<string, unknown> | null;
339
- principalPolicies: Record<string, unknown>[];
374
+ principalPolicyRefs: {
375
+ principalType: "group" | "organization";
376
+ principalId: string;
377
+ version: number;
378
+ stateHash: string;
379
+ }[];
340
380
  wraps: Record<string, unknown>[];
341
381
  containerManifestHistoryRefs?: {
342
382
  containerId: string;
@@ -368,6 +408,11 @@ export declare const containerCreateWithMetadataDocumentRequestShape: {
368
408
  }>>;
369
409
  systemSlot: z.ZodOptional<z.ZodNullable<z.ZodCustom<string, string>>>;
370
410
  };
411
+ /**
412
+ * The optional seed is the metadata document's first queued update, committed
413
+ * in the create transaction exactly as organization provisioning commits a
414
+ * system container's metadata seed.
415
+ */
371
416
  export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType<{
372
417
  container: {
373
418
  body: unknown;
@@ -377,7 +422,12 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
377
422
  keyring: Record<string, unknown> | null;
378
423
  manifest: Record<string, unknown>;
379
424
  predecessorBridge: Record<string, unknown> | null;
380
- principalPolicies: Record<string, unknown>[];
425
+ principalPolicyRefs: {
426
+ principalType: "group" | "organization";
427
+ principalId: string;
428
+ version: number;
429
+ stateHash: string;
430
+ }[];
381
431
  wraps: Record<string, unknown>[];
382
432
  containerManifestHistoryRefs?: {
383
433
  containerId: string;
@@ -432,7 +482,12 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
432
482
  keyring: Record<string, unknown> | null;
433
483
  manifest: Record<string, unknown>;
434
484
  predecessorBridge: Record<string, unknown> | null;
435
- principalPolicies: Record<string, unknown>[];
485
+ principalPolicyRefs: {
486
+ principalType: "group" | "organization";
487
+ principalId: string;
488
+ version: number;
489
+ stateHash: string;
490
+ }[];
436
491
  wraps: Record<string, unknown>[];
437
492
  containerManifestHistoryRefs?: {
438
493
  containerId: string;
@@ -462,6 +517,83 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
462
517
  manifestHash: string;
463
518
  }[] | undefined;
464
519
  };
520
+ initialMetadataSync?: {
521
+ contentKeyEpoch: number;
522
+ expectedLinkSetManifestHash: string;
523
+ expectedTargetHash: string;
524
+ localVersionVector: string | null;
525
+ outgoingUpdates: {
526
+ encryptedData: string;
527
+ id: string;
528
+ partialEndVersionVector: string;
529
+ partialStartVersionVector: string;
530
+ plaintextHash: string;
531
+ writeHeader: Record<string, unknown>;
532
+ checkpointKind?: "rotate_baseline" | undefined;
533
+ checkpointPayloadKind?: "full_history_snapshot" | undefined;
534
+ sourceVersionVector?: string | undefined;
535
+ }[];
536
+ supportsPullPagination: true;
537
+ authorizingContainerPathRefs?: {
538
+ containerId: string;
539
+ manifestHash: string;
540
+ }[][] | undefined;
541
+ containerRekeys?: {
542
+ body: unknown;
543
+ event: Record<string, unknown>;
544
+ expectedManifestHash: string;
545
+ keyEpoch: Record<string, unknown>;
546
+ keyring: Record<string, unknown> | null;
547
+ manifest: Record<string, unknown>;
548
+ predecessorBridge: Record<string, unknown> | null;
549
+ principalPolicyRefs: {
550
+ principalType: "group" | "organization";
551
+ principalId: string;
552
+ version: number;
553
+ stateHash: string;
554
+ }[];
555
+ wraps: Record<string, unknown>[];
556
+ containerManifestHistoryRefs?: {
557
+ containerId: string;
558
+ manifestHash: string;
559
+ }[] | undefined;
560
+ destinationParentContainerPathRefs?: {
561
+ containerId: string;
562
+ manifestHash: string;
563
+ }[] | undefined;
564
+ parentContainerPathRefs?: {
565
+ containerId: string;
566
+ manifestHash: string;
567
+ }[] | undefined;
568
+ parentKekState?: Record<string, unknown> | null | undefined;
569
+ previousContainerPathRefs?: {
570
+ containerId: string;
571
+ manifestHash: string;
572
+ }[] | undefined;
573
+ previousManifestRef?: {
574
+ containerId: string;
575
+ manifestHash: string;
576
+ } | null | undefined;
577
+ userRecipientKeys?: Record<string, unknown>[] | undefined;
578
+ }[] | undefined;
579
+ contentKeyBundle?: {
580
+ contentKeyEpoch: number;
581
+ linkSetManifestHash: string;
582
+ targetHash: string;
583
+ targets: {
584
+ containerId: string;
585
+ containerKeyEpoch: number;
586
+ containerKeyEpochId: string;
587
+ containerManifestHash: string;
588
+ wrappedKey: string;
589
+ wrappingMetadata: Record<string, unknown>;
590
+ }[];
591
+ } | undefined;
592
+ historyMode?: "raw" | undefined;
593
+ inlineRekeyCommitId?: string | undefined;
594
+ minLsn?: string | undefined;
595
+ pullCursor?: string | undefined;
596
+ } | undefined;
465
597
  systemSlot?: string | null | undefined;
466
598
  }, {
467
599
  container: {
@@ -472,7 +604,12 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
472
604
  keyring: Record<string, unknown> | null;
473
605
  manifest: Record<string, unknown>;
474
606
  predecessorBridge: Record<string, unknown> | null;
475
- principalPolicies: Record<string, unknown>[];
607
+ principalPolicyRefs: {
608
+ principalType: "group" | "organization";
609
+ principalId: string;
610
+ version: number;
611
+ stateHash: string;
612
+ }[];
476
613
  wraps: Record<string, unknown>[];
477
614
  containerManifestHistoryRefs?: {
478
615
  containerId: string;
@@ -527,7 +664,12 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
527
664
  keyring: Record<string, unknown> | null;
528
665
  manifest: Record<string, unknown>;
529
666
  predecessorBridge: Record<string, unknown> | null;
530
- principalPolicies: Record<string, unknown>[];
667
+ principalPolicyRefs: {
668
+ principalType: "group" | "organization";
669
+ principalId: string;
670
+ version: number;
671
+ stateHash: string;
672
+ }[];
531
673
  wraps: Record<string, unknown>[];
532
674
  containerManifestHistoryRefs?: {
533
675
  containerId: string;
@@ -557,6 +699,83 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
557
699
  manifestHash: string;
558
700
  }[] | undefined;
559
701
  };
702
+ initialMetadataSync?: {
703
+ contentKeyEpoch: number;
704
+ expectedLinkSetManifestHash: string;
705
+ expectedTargetHash: string;
706
+ localVersionVector: string | null;
707
+ outgoingUpdates: {
708
+ encryptedData: string;
709
+ id: string;
710
+ partialEndVersionVector: string;
711
+ partialStartVersionVector: string;
712
+ plaintextHash: string;
713
+ writeHeader: Record<string, unknown>;
714
+ checkpointKind?: "rotate_baseline" | undefined;
715
+ checkpointPayloadKind?: "full_history_snapshot" | undefined;
716
+ sourceVersionVector?: string | undefined;
717
+ }[];
718
+ supportsPullPagination: true;
719
+ authorizingContainerPathRefs?: {
720
+ containerId: string;
721
+ manifestHash: string;
722
+ }[][] | undefined;
723
+ containerRekeys?: {
724
+ body: unknown;
725
+ event: Record<string, unknown>;
726
+ expectedManifestHash: string;
727
+ keyEpoch: Record<string, unknown>;
728
+ keyring: Record<string, unknown> | null;
729
+ manifest: Record<string, unknown>;
730
+ predecessorBridge: Record<string, unknown> | null;
731
+ principalPolicyRefs: {
732
+ principalType: "group" | "organization";
733
+ principalId: string;
734
+ version: number;
735
+ stateHash: string;
736
+ }[];
737
+ wraps: Record<string, unknown>[];
738
+ containerManifestHistoryRefs?: {
739
+ containerId: string;
740
+ manifestHash: string;
741
+ }[] | undefined;
742
+ destinationParentContainerPathRefs?: {
743
+ containerId: string;
744
+ manifestHash: string;
745
+ }[] | undefined;
746
+ parentContainerPathRefs?: {
747
+ containerId: string;
748
+ manifestHash: string;
749
+ }[] | undefined;
750
+ parentKekState?: Record<string, unknown> | null | undefined;
751
+ previousContainerPathRefs?: {
752
+ containerId: string;
753
+ manifestHash: string;
754
+ }[] | undefined;
755
+ previousManifestRef?: {
756
+ containerId: string;
757
+ manifestHash: string;
758
+ } | null | undefined;
759
+ userRecipientKeys?: Record<string, unknown>[] | undefined;
760
+ }[] | undefined;
761
+ contentKeyBundle?: {
762
+ contentKeyEpoch: number;
763
+ linkSetManifestHash: string;
764
+ targetHash: string;
765
+ targets: {
766
+ containerId: string;
767
+ containerKeyEpoch: number;
768
+ containerKeyEpochId: string;
769
+ containerManifestHash: string;
770
+ wrappedKey: string;
771
+ wrappingMetadata: Record<string, unknown>;
772
+ }[];
773
+ } | undefined;
774
+ historyMode?: "raw" | undefined;
775
+ inlineRekeyCommitId?: string | undefined;
776
+ minLsn?: string | undefined;
777
+ pullCursor?: string | undefined;
778
+ } | undefined;
560
779
  systemSlot?: string | null | undefined;
561
780
  }, z.core.$ZodTypeInternals<{
562
781
  container: {
@@ -567,7 +786,12 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
567
786
  keyring: Record<string, unknown> | null;
568
787
  manifest: Record<string, unknown>;
569
788
  predecessorBridge: Record<string, unknown> | null;
570
- principalPolicies: Record<string, unknown>[];
789
+ principalPolicyRefs: {
790
+ principalType: "group" | "organization";
791
+ principalId: string;
792
+ version: number;
793
+ stateHash: string;
794
+ }[];
571
795
  wraps: Record<string, unknown>[];
572
796
  containerManifestHistoryRefs?: {
573
797
  containerId: string;
@@ -622,7 +846,12 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
622
846
  keyring: Record<string, unknown> | null;
623
847
  manifest: Record<string, unknown>;
624
848
  predecessorBridge: Record<string, unknown> | null;
625
- principalPolicies: Record<string, unknown>[];
849
+ principalPolicyRefs: {
850
+ principalType: "group" | "organization";
851
+ principalId: string;
852
+ version: number;
853
+ stateHash: string;
854
+ }[];
626
855
  wraps: Record<string, unknown>[];
627
856
  containerManifestHistoryRefs?: {
628
857
  containerId: string;
@@ -652,6 +881,83 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
652
881
  manifestHash: string;
653
882
  }[] | undefined;
654
883
  };
884
+ initialMetadataSync?: {
885
+ contentKeyEpoch: number;
886
+ expectedLinkSetManifestHash: string;
887
+ expectedTargetHash: string;
888
+ localVersionVector: string | null;
889
+ outgoingUpdates: {
890
+ encryptedData: string;
891
+ id: string;
892
+ partialEndVersionVector: string;
893
+ partialStartVersionVector: string;
894
+ plaintextHash: string;
895
+ writeHeader: Record<string, unknown>;
896
+ checkpointKind?: "rotate_baseline" | undefined;
897
+ checkpointPayloadKind?: "full_history_snapshot" | undefined;
898
+ sourceVersionVector?: string | undefined;
899
+ }[];
900
+ supportsPullPagination: true;
901
+ authorizingContainerPathRefs?: {
902
+ containerId: string;
903
+ manifestHash: string;
904
+ }[][] | undefined;
905
+ containerRekeys?: {
906
+ body: unknown;
907
+ event: Record<string, unknown>;
908
+ expectedManifestHash: string;
909
+ keyEpoch: Record<string, unknown>;
910
+ keyring: Record<string, unknown> | null;
911
+ manifest: Record<string, unknown>;
912
+ predecessorBridge: Record<string, unknown> | null;
913
+ principalPolicyRefs: {
914
+ principalType: "group" | "organization";
915
+ principalId: string;
916
+ version: number;
917
+ stateHash: string;
918
+ }[];
919
+ wraps: Record<string, unknown>[];
920
+ containerManifestHistoryRefs?: {
921
+ containerId: string;
922
+ manifestHash: string;
923
+ }[] | undefined;
924
+ destinationParentContainerPathRefs?: {
925
+ containerId: string;
926
+ manifestHash: string;
927
+ }[] | undefined;
928
+ parentContainerPathRefs?: {
929
+ containerId: string;
930
+ manifestHash: string;
931
+ }[] | undefined;
932
+ parentKekState?: Record<string, unknown> | null | undefined;
933
+ previousContainerPathRefs?: {
934
+ containerId: string;
935
+ manifestHash: string;
936
+ }[] | undefined;
937
+ previousManifestRef?: {
938
+ containerId: string;
939
+ manifestHash: string;
940
+ } | null | undefined;
941
+ userRecipientKeys?: Record<string, unknown>[] | undefined;
942
+ }[] | undefined;
943
+ contentKeyBundle?: {
944
+ contentKeyEpoch: number;
945
+ linkSetManifestHash: string;
946
+ targetHash: string;
947
+ targets: {
948
+ containerId: string;
949
+ containerKeyEpoch: number;
950
+ containerKeyEpochId: string;
951
+ containerManifestHash: string;
952
+ wrappedKey: string;
953
+ wrappingMetadata: Record<string, unknown>;
954
+ }[];
955
+ } | undefined;
956
+ historyMode?: "raw" | undefined;
957
+ inlineRekeyCommitId?: string | undefined;
958
+ minLsn?: string | undefined;
959
+ pullCursor?: string | undefined;
960
+ } | undefined;
655
961
  systemSlot?: string | null | undefined;
656
962
  }, {
657
963
  container: {
@@ -662,7 +968,12 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
662
968
  keyring: Record<string, unknown> | null;
663
969
  manifest: Record<string, unknown>;
664
970
  predecessorBridge: Record<string, unknown> | null;
665
- principalPolicies: Record<string, unknown>[];
971
+ principalPolicyRefs: {
972
+ principalType: "group" | "organization";
973
+ principalId: string;
974
+ version: number;
975
+ stateHash: string;
976
+ }[];
666
977
  wraps: Record<string, unknown>[];
667
978
  containerManifestHistoryRefs?: {
668
979
  containerId: string;
@@ -717,7 +1028,12 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
717
1028
  keyring: Record<string, unknown> | null;
718
1029
  manifest: Record<string, unknown>;
719
1030
  predecessorBridge: Record<string, unknown> | null;
720
- principalPolicies: Record<string, unknown>[];
1031
+ principalPolicyRefs: {
1032
+ principalType: "group" | "organization";
1033
+ principalId: string;
1034
+ version: number;
1035
+ stateHash: string;
1036
+ }[];
721
1037
  wraps: Record<string, unknown>[];
722
1038
  containerManifestHistoryRefs?: {
723
1039
  containerId: string;
@@ -747,6 +1063,83 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
747
1063
  manifestHash: string;
748
1064
  }[] | undefined;
749
1065
  };
1066
+ initialMetadataSync?: {
1067
+ contentKeyEpoch: number;
1068
+ expectedLinkSetManifestHash: string;
1069
+ expectedTargetHash: string;
1070
+ localVersionVector: string | null;
1071
+ outgoingUpdates: {
1072
+ encryptedData: string;
1073
+ id: string;
1074
+ partialEndVersionVector: string;
1075
+ partialStartVersionVector: string;
1076
+ plaintextHash: string;
1077
+ writeHeader: Record<string, unknown>;
1078
+ checkpointKind?: "rotate_baseline" | undefined;
1079
+ checkpointPayloadKind?: "full_history_snapshot" | undefined;
1080
+ sourceVersionVector?: string | undefined;
1081
+ }[];
1082
+ supportsPullPagination: true;
1083
+ authorizingContainerPathRefs?: {
1084
+ containerId: string;
1085
+ manifestHash: string;
1086
+ }[][] | undefined;
1087
+ containerRekeys?: {
1088
+ body: unknown;
1089
+ event: Record<string, unknown>;
1090
+ expectedManifestHash: string;
1091
+ keyEpoch: Record<string, unknown>;
1092
+ keyring: Record<string, unknown> | null;
1093
+ manifest: Record<string, unknown>;
1094
+ predecessorBridge: Record<string, unknown> | null;
1095
+ principalPolicyRefs: {
1096
+ principalType: "group" | "organization";
1097
+ principalId: string;
1098
+ version: number;
1099
+ stateHash: string;
1100
+ }[];
1101
+ wraps: Record<string, unknown>[];
1102
+ containerManifestHistoryRefs?: {
1103
+ containerId: string;
1104
+ manifestHash: string;
1105
+ }[] | undefined;
1106
+ destinationParentContainerPathRefs?: {
1107
+ containerId: string;
1108
+ manifestHash: string;
1109
+ }[] | undefined;
1110
+ parentContainerPathRefs?: {
1111
+ containerId: string;
1112
+ manifestHash: string;
1113
+ }[] | undefined;
1114
+ parentKekState?: Record<string, unknown> | null | undefined;
1115
+ previousContainerPathRefs?: {
1116
+ containerId: string;
1117
+ manifestHash: string;
1118
+ }[] | undefined;
1119
+ previousManifestRef?: {
1120
+ containerId: string;
1121
+ manifestHash: string;
1122
+ } | null | undefined;
1123
+ userRecipientKeys?: Record<string, unknown>[] | undefined;
1124
+ }[] | undefined;
1125
+ contentKeyBundle?: {
1126
+ contentKeyEpoch: number;
1127
+ linkSetManifestHash: string;
1128
+ targetHash: string;
1129
+ targets: {
1130
+ containerId: string;
1131
+ containerKeyEpoch: number;
1132
+ containerKeyEpochId: string;
1133
+ containerManifestHash: string;
1134
+ wrappedKey: string;
1135
+ wrappingMetadata: Record<string, unknown>;
1136
+ }[];
1137
+ } | undefined;
1138
+ historyMode?: "raw" | undefined;
1139
+ inlineRekeyCommitId?: string | undefined;
1140
+ minLsn?: string | undefined;
1141
+ pullCursor?: string | undefined;
1142
+ } | undefined;
750
1143
  systemSlot?: string | null | undefined;
751
1144
  }>>;
752
1145
  export type ContainerCreateWithMetadataDocumentRequest = z.infer<typeof ContainerCreateWithMetadataDocumentRequestSchema>;
@@ -1,13 +1,30 @@
1
1
  import { ContainerSystemSlotSchema } from "../containerSystemSlot.js";
2
+ import { containerCreateMetadataSeedRefinement } from "../documentCreateSeedRefinements.js";
3
+ import { registerJsonSchemaRuntimeRefinements } from "../jsonSchema.js";
2
4
  import { loosePlainObject } from "../schema.js";
3
5
  import { ContainerMutationRequestSchema } from "./container.js";
4
- import { DocumentCreateRequestSchema } from "./document.js";
6
+ import { DocumentCreateBaseRequestSchema, DocumentSyncRequestSchema, } from "./document.js";
7
+ import { refineSeedWithinSyncRequestLimit, refineSingleUpdateSeed, } from "./documentCreateSeed.js";
5
8
  export const containerCreateWithMetadataDocumentRequestShape = {
6
9
  container: ContainerMutationRequestSchema,
7
- metadataDocument: DocumentCreateRequestSchema,
10
+ metadataDocument: DocumentCreateBaseRequestSchema,
8
11
  systemSlot: ContainerSystemSlotSchema.nullable().optional(),
9
12
  };
10
- export const ContainerCreateWithMetadataDocumentRequestSchema = loosePlainObject(containerCreateWithMetadataDocumentRequestShape);
13
+ /**
14
+ * The optional seed is the metadata document's first queued update, committed
15
+ * in the create transaction exactly as organization provisioning commits a
16
+ * system container's metadata seed.
17
+ */
18
+ export const ContainerCreateWithMetadataDocumentRequestSchema = registerJsonSchemaRuntimeRefinements(loosePlainObject({
19
+ ...containerCreateWithMetadataDocumentRequestShape,
20
+ initialMetadataSync: DocumentSyncRequestSchema.optional(),
21
+ }).superRefine((value, context) => {
22
+ refineSingleUpdateSeed(value.initialMetadataSync, context, {
23
+ message: "container create metadata seed requires one update and no container rekeys",
24
+ path: "initialMetadataSync",
25
+ });
26
+ refineSeedWithinSyncRequestLimit(value.initialMetadataSync, context, "initialMetadataSync");
27
+ }), [containerCreateMetadataSeedRefinement]);
11
28
  export function isContainerCreateWithMetadataDocumentRequest(value) {
12
29
  return ContainerCreateWithMetadataDocumentRequestSchema.safeParse(value)
13
30
  .success;
@@ -1 +1 @@
1
- {"version":3,"file":"containerMetadata.js","sourceRoot":"","sources":["containerMetadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAEzD,MAAM,CAAC,MAAM,+CAA+C,GAAG;IAC7D,SAAS,EAAE,8BAA8B;IACzC,gBAAgB,EAAE,2BAA2B;IAC7C,UAAU,EAAE,yBAAyB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC5D,CAAC;AAEF,MAAM,CAAC,MAAM,gDAAgD,GAC3D,gBAAgB,CAAC,+CAA+C,CAAC,CAAC;AAMpE,MAAM,UAAU,4CAA4C,CAC1D,KAAc;IAEd,OAAO,gDAAgD,CAAC,SAAS,CAAC,KAAK,CAAC;SACrE,OAAO,CAAC;AACb,CAAC","sourcesContent":["import type { z } from \"zod\";\nimport { ContainerSystemSlotSchema } from \"../containerSystemSlot\";\nimport { loosePlainObject } from \"../schema\";\nimport { ContainerMutationRequestSchema } from \"./container\";\nimport { DocumentCreateRequestSchema } from \"./document\";\n\nexport const containerCreateWithMetadataDocumentRequestShape = {\n container: ContainerMutationRequestSchema,\n metadataDocument: DocumentCreateRequestSchema,\n systemSlot: ContainerSystemSlotSchema.nullable().optional(),\n};\n\nexport const ContainerCreateWithMetadataDocumentRequestSchema =\n loosePlainObject(containerCreateWithMetadataDocumentRequestShape);\n\nexport type ContainerCreateWithMetadataDocumentRequest = z.infer<\n typeof ContainerCreateWithMetadataDocumentRequestSchema\n>;\n\nexport function isContainerCreateWithMetadataDocumentRequest(\n value: unknown,\n): value is ContainerCreateWithMetadataDocumentRequest {\n return ContainerCreateWithMetadataDocumentRequestSchema.safeParse(value)\n .success;\n}\n"]}
1
+ {"version":3,"file":"containerMetadata.js","sourceRoot":"","sources":["containerMetadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,qCAAqC,EAAE,MAAM,kCAAkC,CAAC;AACzF,OAAO,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,CAAC,MAAM,+CAA+C,GAAG;IAC7D,SAAS,EAAE,8BAA8B;IACzC,gBAAgB,EAAE,+BAA+B;IACjD,UAAU,EAAE,yBAAyB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC5D,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gDAAgD,GAC3D,oCAAoC,CAClC,gBAAgB,CAAC;IACf,GAAG,+CAA+C;IAClD,mBAAmB,EAAE,yBAAyB,CAAC,QAAQ,EAAE;CAC1D,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IAChC,sBAAsB,CAAC,KAAK,CAAC,mBAAmB,EAAE,OAAO,EAAE;QACzD,OAAO,EACL,4EAA4E;QAC9E,IAAI,EAAE,qBAAqB;KAC5B,CAAC,CAAC;IACH,gCAAgC,CAC9B,KAAK,CAAC,mBAAmB,EACzB,OAAO,EACP,qBAAqB,CACtB,CAAC;AACJ,CAAC,CAAC,EACF,CAAC,qCAAqC,CAAC,CACxC,CAAC;AAMJ,MAAM,UAAU,4CAA4C,CAC1D,KAAc;IAEd,OAAO,gDAAgD,CAAC,SAAS,CAAC,KAAK,CAAC;SACrE,OAAO,CAAC;AACb,CAAC","sourcesContent":["import type { z } from \"zod\";\nimport { ContainerSystemSlotSchema } from \"../containerSystemSlot\";\nimport { containerCreateMetadataSeedRefinement } from \"../documentCreateSeedRefinements\";\nimport { registerJsonSchemaRuntimeRefinements } from \"../jsonSchema\";\nimport { loosePlainObject } from \"../schema\";\nimport { ContainerMutationRequestSchema } from \"./container\";\nimport {\n DocumentCreateBaseRequestSchema,\n DocumentSyncRequestSchema,\n} from \"./document\";\nimport {\n refineSeedWithinSyncRequestLimit,\n refineSingleUpdateSeed,\n} from \"./documentCreateSeed\";\n\nexport const containerCreateWithMetadataDocumentRequestShape = {\n container: ContainerMutationRequestSchema,\n metadataDocument: DocumentCreateBaseRequestSchema,\n systemSlot: ContainerSystemSlotSchema.nullable().optional(),\n};\n\n/**\n * The optional seed is the metadata document's first queued update, committed\n * in the create transaction exactly as organization provisioning commits a\n * system container's metadata seed.\n */\nexport const ContainerCreateWithMetadataDocumentRequestSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...containerCreateWithMetadataDocumentRequestShape,\n initialMetadataSync: DocumentSyncRequestSchema.optional(),\n }).superRefine((value, context) => {\n refineSingleUpdateSeed(value.initialMetadataSync, context, {\n message:\n \"container create metadata seed requires one update and no container rekeys\",\n path: \"initialMetadataSync\",\n });\n refineSeedWithinSyncRequestLimit(\n value.initialMetadataSync,\n context,\n \"initialMetadataSync\",\n );\n }),\n [containerCreateMetadataSeedRefinement],\n );\n\nexport type ContainerCreateWithMetadataDocumentRequest = z.infer<\n typeof ContainerCreateWithMetadataDocumentRequestSchema\n>;\n\nexport function isContainerCreateWithMetadataDocumentRequest(\n value: unknown,\n): value is ContainerCreateWithMetadataDocumentRequest {\n return ContainerCreateWithMetadataDocumentRequestSchema.safeParse(value)\n .success;\n}\n"]}