@tearleads/client-sdk 0.1.69 → 0.1.72

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 (102) hide show
  1. package/data/shared/userTiming.js +42 -0
  2. package/data/shared/userTiming.js.map +1 -0
  3. package/data/sqlite/sqlExec.js +27 -3
  4. package/data/sqlite/sqlExec.js.map +1 -1
  5. package/data/sync/coordinatorLaneRun.js +29 -6
  6. package/data/sync/coordinatorLaneRun.js.map +1 -1
  7. package/data/sync/coordinatorState.d.ts +3 -1
  8. package/data/sync/coordinatorState.js +1 -0
  9. package/data/sync/coordinatorState.js.map +1 -1
  10. package/data/sync/syncTelemetry.d.ts +15 -0
  11. package/data/sync/syncTelemetry.js +10 -0
  12. package/data/sync/syncTelemetry.js.map +1 -1
  13. package/data/sync/uploadLane.js +20 -3
  14. package/data/sync/uploadLane.js.map +1 -1
  15. package/internal/api-client/ApiClient.d.ts +73 -3
  16. package/internal/api-client/apiRequestMetrics.d.ts +18 -4
  17. package/internal/api-client/apiRequestMetrics.js +55 -5
  18. package/internal/api-client/apiRequestMetrics.js.map +1 -1
  19. package/internal/api-client/durationSampleWindow.d.ts +26 -0
  20. package/internal/api-client/durationSampleWindow.js +42 -0
  21. package/internal/api-client/durationSampleWindow.js.map +1 -0
  22. package/internal/api-client/measureApiRequest.js +9 -4
  23. package/internal/api-client/measureApiRequest.js.map +1 -1
  24. package/internal/api-client/serverTiming.d.ts +12 -0
  25. package/internal/api-client/serverTiming.js +49 -0
  26. package/internal/api-client/serverTiming.js.map +1 -0
  27. package/internal/validators/documentCreateSeedRefinements.js +9 -0
  28. package/internal/validators/documentCreateSeedRefinements.js.map +1 -0
  29. package/internal/validators/operation/auth.d.ts +120 -0
  30. package/internal/validators/operation/containerMutations.d.ts +355 -0
  31. package/internal/validators/operation/containerMutations.js +7 -1
  32. package/internal/validators/operation/containerMutations.js.map +1 -1
  33. package/internal/validators/operation/documentMutations.d.ts +356 -0
  34. package/internal/validators/operation/documentMutations.js +6 -1
  35. package/internal/validators/operation/documentMutations.js.map +1 -1
  36. package/internal/validators/operation/documentSync.d.ts +9 -9
  37. package/internal/validators/operation/organizations.d.ts +120 -0
  38. package/internal/validators/request/containerMetadata.d.ts +313 -0
  39. package/internal/validators/request/containerMetadata.js +20 -3
  40. package/internal/validators/request/containerMetadata.js.map +1 -1
  41. package/internal/validators/request/document.d.ts +571 -0
  42. package/internal/validators/request/document.js +19 -1
  43. package/internal/validators/request/document.js.map +1 -1
  44. package/internal/validators/request/documentCreateSeed.js +35 -0
  45. package/internal/validators/request/documentCreateSeed.js.map +1 -0
  46. package/internal/validators/request/organizationProvisioning.js +9 -22
  47. package/internal/validators/request/organizationProvisioning.js.map +1 -1
  48. package/internal/validators/response/containerMetadata.d.ts +20 -0
  49. package/internal/validators/response/documentMutation.d.ts +43 -0
  50. package/internal/validators/response/documentMutation.js +12 -1
  51. package/internal/validators/response/documentMutation.js.map +1 -1
  52. package/internal/validators/response/documentSyncSchema.d.ts +13 -9
  53. package/internal/validators/response/documentSyncSchema.js +23 -18
  54. package/internal/validators/response/documentSyncSchema.js.map +1 -1
  55. package/internal/validators/response/index.d.ts +1 -1
  56. package/internal/validators/response/index.js.map +1 -1
  57. package/internal/validators/response/organizationProvisioning.d.ts +350 -0
  58. package/internal/validators/response/registration.d.ts +120 -0
  59. package/package.json +1 -1
  60. package/stores/container-contents/containerState/containerStatePersistence.js +2 -0
  61. package/stores/container-contents/containerState/containerStatePersistence.js.map +1 -1
  62. package/stores/container-contents/remoteEvents/remoteEventSync.js +1 -1
  63. package/stores/container-contents/remoteEvents/remoteEventSync.js.map +1 -1
  64. package/stores/container-contents/state.js +2 -0
  65. package/stores/container-contents/state.js.map +1 -1
  66. package/stores/container-contents/syncAgent/syncAgentTypes.d.ts +5 -0
  67. package/stores/container-contents/syncAgent/syncAgentTypes.js.map +1 -1
  68. package/stores/documents/documentStore/sync/createdDocumentPersistence.js +71 -0
  69. package/stores/documents/documentStore/sync/createdDocumentPersistence.js.map +1 -0
  70. package/stores/documents/documentStore/sync/index.js +13 -2
  71. package/stores/documents/documentStore/sync/index.js.map +1 -1
  72. package/stores/documents/documentStore/sync/syncRemoteSignals.js +21 -3
  73. package/stores/documents/documentStore/sync/syncRemoteSignals.js.map +1 -1
  74. package/stores/documents/documentStore/sync/syncSeededCreate.js +50 -0
  75. package/stores/documents/documentStore/sync/syncSeededCreate.js.map +1 -0
  76. package/stores/documents/documentStore/sync/syncShared.js +16 -8
  77. package/stores/documents/documentStore/sync/syncShared.js.map +1 -1
  78. package/workflows/container-contents/container-state/create/createIntentSeed.js +60 -0
  79. package/workflows/container-contents/container-state/create/createIntentSeed.js.map +1 -0
  80. package/workflows/container-contents/container-state/create/createIntentSync.js +18 -19
  81. package/workflows/container-contents/container-state/create/createIntentSync.js.map +1 -1
  82. package/workflows/container-contents/container-state/create/createWithMetadata.js +43 -6
  83. package/workflows/container-contents/container-state/create/createWithMetadata.js.map +1 -1
  84. package/workflows/container-contents/container-state/create/createWithMetadataPlan.js +5 -1
  85. package/workflows/container-contents/container-state/create/createWithMetadataPlan.js.map +1 -1
  86. package/workflows/container-contents/container-state/remote.js +15 -0
  87. package/workflows/container-contents/container-state/remote.js.map +1 -1
  88. package/workflows/container-contents/container-state/types.js.map +1 -1
  89. package/workflows/container-contents/metadata/metadataEvents.d.ts +7 -1
  90. package/workflows/container-contents/metadata/metadataEvents.js +8 -2
  91. package/workflows/container-contents/metadata/metadataEvents.js.map +1 -1
  92. package/workflows/container-contents/remoteHydration/types.d.ts +3 -0
  93. package/workflows/container-contents/remoteHydration/types.js.map +1 -1
  94. package/workflows/documents/create/index.d.ts +7 -0
  95. package/workflows/documents/create/index.js +40 -2
  96. package/workflows/documents/create/index.js.map +1 -1
  97. package/workflows/documents/index.d.ts +1 -0
  98. package/workflows/documents/index.js +1 -0
  99. package/workflows/documents/index.js.map +1 -1
  100. package/workflows/documents/sync/initialSync.d.ts +39 -0
  101. package/workflows/documents/sync/initialSync.js +39 -6
  102. package/workflows/documents/sync/initialSync.js.map +1 -1
@@ -5423,6 +5423,11 @@ export declare const createOrganizationOperation: Omit<{
5423
5423
  targets: Record<string, unknown>[];
5424
5424
  };
5425
5425
  id: string;
5426
+ initialSync?: {
5427
+ commitLsn: string | null;
5428
+ commitLsnMode: "tracked" | "untracked";
5429
+ acceptedOutgoingUpdateIds: string[];
5430
+ } | undefined;
5426
5431
  };
5427
5432
  };
5428
5433
  organizationMetadataContainerId: string;
@@ -5464,6 +5469,11 @@ export declare const createOrganizationOperation: Omit<{
5464
5469
  targets: Record<string, unknown>[];
5465
5470
  };
5466
5471
  id: string;
5472
+ initialSync?: {
5473
+ commitLsn: string | null;
5474
+ commitLsnMode: "tracked" | "untracked";
5475
+ acceptedOutgoingUpdateIds: string[];
5476
+ } | undefined;
5467
5477
  };
5468
5478
  rootMetadataDocumentId: string;
5469
5479
  systemContainers: {
@@ -5562,6 +5572,11 @@ export declare const createOrganizationOperation: Omit<{
5562
5572
  targets: Record<string, unknown>[];
5563
5573
  };
5564
5574
  id: string;
5575
+ initialSync?: {
5576
+ commitLsn: string | null;
5577
+ commitLsnMode: "tracked" | "untracked";
5578
+ acceptedOutgoingUpdateIds: string[];
5579
+ } | undefined;
5565
5580
  };
5566
5581
  }[];
5567
5582
  userId: string;
@@ -5600,6 +5615,11 @@ export declare const createOrganizationOperation: Omit<{
5600
5615
  targets: Record<string, unknown>[];
5601
5616
  };
5602
5617
  id: string;
5618
+ initialSync?: {
5619
+ commitLsn: string | null;
5620
+ commitLsnMode: "tracked" | "untracked";
5621
+ acceptedOutgoingUpdateIds: string[];
5622
+ } | undefined;
5603
5623
  } | undefined;
5604
5624
  organizationProfileDocumentId?: string | undefined;
5605
5625
  rosterProfileContainer?: {
@@ -5698,6 +5718,11 @@ export declare const createOrganizationOperation: Omit<{
5698
5718
  targets: Record<string, unknown>[];
5699
5719
  };
5700
5720
  id: string;
5721
+ initialSync?: {
5722
+ commitLsn: string | null;
5723
+ commitLsnMode: "tracked" | "untracked";
5724
+ acceptedOutgoingUpdateIds: string[];
5725
+ } | undefined;
5701
5726
  };
5702
5727
  } | undefined;
5703
5728
  rosterProfileContainerId?: string | undefined;
@@ -5736,6 +5761,11 @@ export declare const createOrganizationOperation: Omit<{
5736
5761
  targets: Record<string, unknown>[];
5737
5762
  };
5738
5763
  id: string;
5764
+ initialSync?: {
5765
+ commitLsn: string | null;
5766
+ commitLsnMode: "tracked" | "untracked";
5767
+ acceptedOutgoingUpdateIds: string[];
5768
+ } | undefined;
5739
5769
  } | undefined;
5740
5770
  rosterProfileDocumentId?: string | undefined;
5741
5771
  }, {
@@ -5852,6 +5882,11 @@ export declare const createOrganizationOperation: Omit<{
5852
5882
  targets: Record<string, unknown>[];
5853
5883
  };
5854
5884
  id: string;
5885
+ initialSync?: {
5886
+ commitLsn: string | null;
5887
+ commitLsnMode: "tracked" | "untracked";
5888
+ acceptedOutgoingUpdateIds: string[];
5889
+ } | undefined;
5855
5890
  };
5856
5891
  };
5857
5892
  organizationMetadataContainerId: string;
@@ -5893,6 +5928,11 @@ export declare const createOrganizationOperation: Omit<{
5893
5928
  targets: Record<string, unknown>[];
5894
5929
  };
5895
5930
  id: string;
5931
+ initialSync?: {
5932
+ commitLsn: string | null;
5933
+ commitLsnMode: "tracked" | "untracked";
5934
+ acceptedOutgoingUpdateIds: string[];
5935
+ } | undefined;
5896
5936
  };
5897
5937
  rootMetadataDocumentId: string;
5898
5938
  systemContainers: {
@@ -5991,6 +6031,11 @@ export declare const createOrganizationOperation: Omit<{
5991
6031
  targets: Record<string, unknown>[];
5992
6032
  };
5993
6033
  id: string;
6034
+ initialSync?: {
6035
+ commitLsn: string | null;
6036
+ commitLsnMode: "tracked" | "untracked";
6037
+ acceptedOutgoingUpdateIds: string[];
6038
+ } | undefined;
5994
6039
  };
5995
6040
  }[];
5996
6041
  userId: string;
@@ -6029,6 +6074,11 @@ export declare const createOrganizationOperation: Omit<{
6029
6074
  targets: Record<string, unknown>[];
6030
6075
  };
6031
6076
  id: string;
6077
+ initialSync?: {
6078
+ commitLsn: string | null;
6079
+ commitLsnMode: "tracked" | "untracked";
6080
+ acceptedOutgoingUpdateIds: string[];
6081
+ } | undefined;
6032
6082
  } | undefined;
6033
6083
  organizationProfileDocumentId?: string | undefined;
6034
6084
  rosterProfileContainer?: {
@@ -6127,6 +6177,11 @@ export declare const createOrganizationOperation: Omit<{
6127
6177
  targets: Record<string, unknown>[];
6128
6178
  };
6129
6179
  id: string;
6180
+ initialSync?: {
6181
+ commitLsn: string | null;
6182
+ commitLsnMode: "tracked" | "untracked";
6183
+ acceptedOutgoingUpdateIds: string[];
6184
+ } | undefined;
6130
6185
  };
6131
6186
  } | undefined;
6132
6187
  rosterProfileContainerId?: string | undefined;
@@ -6165,6 +6220,11 @@ export declare const createOrganizationOperation: Omit<{
6165
6220
  targets: Record<string, unknown>[];
6166
6221
  };
6167
6222
  id: string;
6223
+ initialSync?: {
6224
+ commitLsn: string | null;
6225
+ commitLsnMode: "tracked" | "untracked";
6226
+ acceptedOutgoingUpdateIds: string[];
6227
+ } | undefined;
6168
6228
  } | undefined;
6169
6229
  rosterProfileDocumentId?: string | undefined;
6170
6230
  }, z.core.$ZodTypeInternals<{
@@ -6281,6 +6341,11 @@ export declare const createOrganizationOperation: Omit<{
6281
6341
  targets: Record<string, unknown>[];
6282
6342
  };
6283
6343
  id: string;
6344
+ initialSync?: {
6345
+ commitLsn: string | null;
6346
+ commitLsnMode: "tracked" | "untracked";
6347
+ acceptedOutgoingUpdateIds: string[];
6348
+ } | undefined;
6284
6349
  };
6285
6350
  };
6286
6351
  organizationMetadataContainerId: string;
@@ -6322,6 +6387,11 @@ export declare const createOrganizationOperation: Omit<{
6322
6387
  targets: Record<string, unknown>[];
6323
6388
  };
6324
6389
  id: string;
6390
+ initialSync?: {
6391
+ commitLsn: string | null;
6392
+ commitLsnMode: "tracked" | "untracked";
6393
+ acceptedOutgoingUpdateIds: string[];
6394
+ } | undefined;
6325
6395
  };
6326
6396
  rootMetadataDocumentId: string;
6327
6397
  systemContainers: {
@@ -6420,6 +6490,11 @@ export declare const createOrganizationOperation: Omit<{
6420
6490
  targets: Record<string, unknown>[];
6421
6491
  };
6422
6492
  id: string;
6493
+ initialSync?: {
6494
+ commitLsn: string | null;
6495
+ commitLsnMode: "tracked" | "untracked";
6496
+ acceptedOutgoingUpdateIds: string[];
6497
+ } | undefined;
6423
6498
  };
6424
6499
  }[];
6425
6500
  userId: string;
@@ -6458,6 +6533,11 @@ export declare const createOrganizationOperation: Omit<{
6458
6533
  targets: Record<string, unknown>[];
6459
6534
  };
6460
6535
  id: string;
6536
+ initialSync?: {
6537
+ commitLsn: string | null;
6538
+ commitLsnMode: "tracked" | "untracked";
6539
+ acceptedOutgoingUpdateIds: string[];
6540
+ } | undefined;
6461
6541
  } | undefined;
6462
6542
  organizationProfileDocumentId?: string | undefined;
6463
6543
  rosterProfileContainer?: {
@@ -6556,6 +6636,11 @@ export declare const createOrganizationOperation: Omit<{
6556
6636
  targets: Record<string, unknown>[];
6557
6637
  };
6558
6638
  id: string;
6639
+ initialSync?: {
6640
+ commitLsn: string | null;
6641
+ commitLsnMode: "tracked" | "untracked";
6642
+ acceptedOutgoingUpdateIds: string[];
6643
+ } | undefined;
6559
6644
  };
6560
6645
  } | undefined;
6561
6646
  rosterProfileContainerId?: string | undefined;
@@ -6594,6 +6679,11 @@ export declare const createOrganizationOperation: Omit<{
6594
6679
  targets: Record<string, unknown>[];
6595
6680
  };
6596
6681
  id: string;
6682
+ initialSync?: {
6683
+ commitLsn: string | null;
6684
+ commitLsnMode: "tracked" | "untracked";
6685
+ acceptedOutgoingUpdateIds: string[];
6686
+ } | undefined;
6597
6687
  } | undefined;
6598
6688
  rosterProfileDocumentId?: string | undefined;
6599
6689
  }, {
@@ -6710,6 +6800,11 @@ export declare const createOrganizationOperation: Omit<{
6710
6800
  targets: Record<string, unknown>[];
6711
6801
  };
6712
6802
  id: string;
6803
+ initialSync?: {
6804
+ commitLsn: string | null;
6805
+ commitLsnMode: "tracked" | "untracked";
6806
+ acceptedOutgoingUpdateIds: string[];
6807
+ } | undefined;
6713
6808
  };
6714
6809
  };
6715
6810
  organizationMetadataContainerId: string;
@@ -6751,6 +6846,11 @@ export declare const createOrganizationOperation: Omit<{
6751
6846
  targets: Record<string, unknown>[];
6752
6847
  };
6753
6848
  id: string;
6849
+ initialSync?: {
6850
+ commitLsn: string | null;
6851
+ commitLsnMode: "tracked" | "untracked";
6852
+ acceptedOutgoingUpdateIds: string[];
6853
+ } | undefined;
6754
6854
  };
6755
6855
  rootMetadataDocumentId: string;
6756
6856
  systemContainers: {
@@ -6849,6 +6949,11 @@ export declare const createOrganizationOperation: Omit<{
6849
6949
  targets: Record<string, unknown>[];
6850
6950
  };
6851
6951
  id: string;
6952
+ initialSync?: {
6953
+ commitLsn: string | null;
6954
+ commitLsnMode: "tracked" | "untracked";
6955
+ acceptedOutgoingUpdateIds: string[];
6956
+ } | undefined;
6852
6957
  };
6853
6958
  }[];
6854
6959
  userId: string;
@@ -6887,6 +6992,11 @@ export declare const createOrganizationOperation: Omit<{
6887
6992
  targets: Record<string, unknown>[];
6888
6993
  };
6889
6994
  id: string;
6995
+ initialSync?: {
6996
+ commitLsn: string | null;
6997
+ commitLsnMode: "tracked" | "untracked";
6998
+ acceptedOutgoingUpdateIds: string[];
6999
+ } | undefined;
6890
7000
  } | undefined;
6891
7001
  organizationProfileDocumentId?: string | undefined;
6892
7002
  rosterProfileContainer?: {
@@ -6985,6 +7095,11 @@ export declare const createOrganizationOperation: Omit<{
6985
7095
  targets: Record<string, unknown>[];
6986
7096
  };
6987
7097
  id: string;
7098
+ initialSync?: {
7099
+ commitLsn: string | null;
7100
+ commitLsnMode: "tracked" | "untracked";
7101
+ acceptedOutgoingUpdateIds: string[];
7102
+ } | undefined;
6988
7103
  };
6989
7104
  } | undefined;
6990
7105
  rosterProfileContainerId?: string | undefined;
@@ -7023,6 +7138,11 @@ export declare const createOrganizationOperation: Omit<{
7023
7138
  targets: Record<string, unknown>[];
7024
7139
  };
7025
7140
  id: string;
7141
+ initialSync?: {
7142
+ commitLsn: string | null;
7143
+ commitLsnMode: "tracked" | "untracked";
7144
+ acceptedOutgoingUpdateIds: string[];
7145
+ } | undefined;
7026
7146
  } | undefined;
7027
7147
  rosterProfileDocumentId?: string | undefined;
7028
7148
  }>>;
@@ -408,6 +408,11 @@ export declare const containerCreateWithMetadataDocumentRequestShape: {
408
408
  }>>;
409
409
  systemSlot: z.ZodOptional<z.ZodNullable<z.ZodCustom<string, string>>>;
410
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
+ */
411
416
  export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType<{
412
417
  container: {
413
418
  body: unknown;
@@ -512,6 +517,83 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
512
517
  manifestHash: string;
513
518
  }[] | undefined;
514
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;
515
597
  systemSlot?: string | null | undefined;
516
598
  }, {
517
599
  container: {
@@ -617,6 +699,83 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
617
699
  manifestHash: string;
618
700
  }[] | undefined;
619
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;
620
779
  systemSlot?: string | null | undefined;
621
780
  }, z.core.$ZodTypeInternals<{
622
781
  container: {
@@ -722,6 +881,83 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
722
881
  manifestHash: string;
723
882
  }[] | undefined;
724
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;
725
961
  systemSlot?: string | null | undefined;
726
962
  }, {
727
963
  container: {
@@ -827,6 +1063,83 @@ export declare const ContainerCreateWithMetadataDocumentRequestSchema: z.ZodType
827
1063
  manifestHash: string;
828
1064
  }[] | undefined;
829
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;
830
1143
  systemSlot?: string | null | undefined;
831
1144
  }>>;
832
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"]}