@tearleads/client-sdk 0.1.250 → 0.1.252
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.
- package/Tearleads.d.ts +0 -2
- package/Tearleads.js +14 -25
- package/Tearleads.js.map +1 -1
- package/client/organizations/organizationReadModelPresentation.js +7 -4
- package/client/organizations/organizationReadModelPresentation.js.map +1 -1
- package/client/organizations/organizationReadModels.js +6 -5
- package/client/organizations/organizationReadModels.js.map +1 -1
- package/client/organizations/organizationWorkflowRuntime.js +1 -1
- package/client/organizations/organizationWorkflowRuntime.js.map +1 -1
- package/client/runtime/principalMutationApi.d.ts +4 -0
- package/client/runtime/principalMutationApi.js +9 -5
- package/client/runtime/principalMutationApi.js.map +1 -1
- package/client/runtime/runtimeIdentityResolution.js +23 -0
- package/client/runtime/runtimeIdentityResolution.js.map +1 -1
- package/client/runtime/runtimeSubscription.js +68 -0
- package/client/runtime/runtimeSubscription.js.map +1 -0
- package/client/runtime/workflowRuntime.d.ts +1 -1
- package/client/runtime/workflowRuntime.js +20 -77
- package/client/runtime/workflowRuntime.js.map +1 -1
- package/client/session/authenticationMachine.js +47 -0
- package/client/session/authenticationMachine.js.map +1 -0
- package/client/session/index.js +75 -93
- package/client/session/index.js.map +1 -1
- package/client/session/sessionBlobStore.js +39 -0
- package/client/session/sessionBlobStore.js.map +1 -0
- package/client/session/sessionContext.js +11 -0
- package/client/session/sessionContext.js.map +1 -1
- package/client/session/sessionIdentityTrust.d.ts +2 -1
- package/client/session/sessionIdentityTrust.js +8 -4
- package/client/session/sessionIdentityTrust.js.map +1 -1
- package/client/session/sessionLifetime.js +87 -0
- package/client/session/sessionLifetime.js.map +1 -0
- package/client/session/sessionLogin.js +114 -0
- package/client/session/sessionLogin.js.map +1 -0
- package/client/session/sessionOrganizationCreation.js +3 -2
- package/client/session/sessionOrganizationCreation.js.map +1 -1
- package/client/session/sessionPurgeRecovery.js +11 -3
- package/client/session/sessionPurgeRecovery.js.map +1 -1
- package/client/session/sessionTypes.d.ts +6 -2
- package/client/session/sessionTypes.js.map +1 -1
- package/data/blobs/blobContracts.d.ts +4 -3
- package/data/blobs/blobContracts.js.map +1 -1
- package/data/blobs/createBlobStore.js +1 -8
- package/data/blobs/createBlobStore.js.map +1 -1
- package/data/blobs/encryptedBlobStore.js +17 -12
- package/data/blobs/encryptedBlobStore.js.map +1 -1
- package/data/blobs/memoryBlobStore.js +8 -5
- package/data/blobs/memoryBlobStore.js.map +1 -1
- package/data/blobs/opfsBlobFile.js +36 -0
- package/data/blobs/opfsBlobFile.js.map +1 -0
- package/data/blobs/opfsBlobStore.d.ts +1 -1
- package/data/blobs/opfsBlobStore.js +91 -21
- package/data/blobs/opfsBlobStore.js.map +1 -1
- package/data/documents/shared/events.js +2 -1
- package/data/documents/shared/events.js.map +1 -1
- package/data/principals/principalPolicyCoordinator.js +8 -17
- package/data/principals/principalPolicyCoordinator.js.map +1 -1
- package/data/shared/domainScope.d.ts +2 -0
- package/data/shared/domainScope.js +2 -1
- package/data/shared/domainScope.js.map +1 -1
- package/data/shared/keyedQueue.js +15 -0
- package/data/shared/keyedQueue.js.map +1 -0
- package/data/sqlite/migrations/migrateLocalSchema.js +2 -3
- package/data/sqlite/migrations/migrateLocalSchema.js.map +1 -1
- package/data/sqlite/sqlExec.d.ts +6 -0
- package/data/sqlite/sqlExec.js +64 -13
- package/data/sqlite/sqlExec.js.map +1 -1
- package/data/sqlite/sqlitePersistenceRuntime.js +2 -3
- package/data/sqlite/sqlitePersistenceRuntime.js.map +1 -1
- package/data/trustedUserIdentity/service.js +2 -1
- package/data/trustedUserIdentity/service.js.map +1 -1
- package/data/trustedUserIdentity/types.d.ts +1 -1
- package/data/trustedUserIdentity/types.js.map +1 -1
- package/internal/api-client/ApiClient.d.ts +4 -1
- package/internal/api-client/apiRequestRuntime.d.ts +6 -3
- package/internal/api-client/apiRequestRuntime.js +86 -101
- package/internal/api-client/apiRequestRuntime.js.map +1 -1
- package/internal/api-client/binaryRequestOperationTransport.js +2 -1
- package/internal/api-client/binaryRequestOperationTransport.js.map +1 -1
- package/internal/api-client/binaryResponseOperationTransport.js +6 -2
- package/internal/api-client/binaryResponseOperationTransport.js.map +1 -1
- package/internal/api-client/client/blobs.d.ts +1 -0
- package/internal/api-client/client/blobs.js +12 -3
- package/internal/api-client/client/blobs.js.map +1 -1
- package/internal/api-client/client/laneListingRequest.js +4 -0
- package/internal/api-client/client/laneListingRequest.js.map +1 -1
- package/internal/api-client/client/session.d.ts +5 -1
- package/internal/api-client/client/session.js +12 -4
- package/internal/api-client/client/session.js.map +1 -1
- package/internal/api-client/client/writerProjections.js +12 -13
- package/internal/api-client/client/writerProjections.js.map +1 -1
- package/internal/api-client/operationResponse.d.ts +1 -1
- package/internal/api-client/operationResponse.js +10 -23
- package/internal/api-client/operationResponse.js.map +1 -1
- package/internal/api-client/operationTransport.js +2 -1
- package/internal/api-client/operationTransport.js.map +1 -1
- package/internal/api-client/principalHistoryRequest.js +25 -20
- package/internal/api-client/principalHistoryRequest.js.map +1 -1
- package/internal/api-client/principalHistoryRequestContext.js +30 -6
- package/internal/api-client/principalHistoryRequestContext.js.map +1 -1
- package/internal/api-client/principalPolicyPages.d.ts +4 -1
- package/internal/api-client/principalPolicyPages.js +4 -2
- package/internal/api-client/principalPolicyPages.js.map +1 -1
- package/internal/api-client/projectionPolicyHistoryPages.d.ts +4 -1
- package/internal/api-client/projectionPolicyHistoryPages.js +4 -2
- package/internal/api-client/projectionPolicyHistoryPages.js.map +1 -1
- package/internal/api-client/routes/blobs/blobDownloadBody.js +65 -0
- package/internal/api-client/routes/blobs/blobDownloadBody.js.map +1 -0
- package/internal/api-client/routes/blobs/get.js +9 -67
- package/internal/api-client/routes/blobs/get.js.map +1 -1
- package/internal/api-client/routes/blobs/multipartUpload.js +1 -1
- package/internal/api-client/routes/blobs/multipartUpload.js.map +1 -1
- package/internal/api-client/sessionRefresh.js +1 -1
- package/internal/api-client/sessionRefresh.js.map +1 -1
- package/internal/api-client/sessionRenewal.d.ts +31 -0
- package/internal/api-client/sessionRenewal.js +91 -6
- package/internal/api-client/sessionRenewal.js.map +1 -1
- package/internal/api-client/sessionRequestInit.js +22 -0
- package/internal/api-client/sessionRequestInit.js.map +1 -0
- package/internal/api-client/sessionResponse.js +39 -0
- package/internal/api-client/sessionResponse.js.map +1 -0
- package/internal/api-client/types.d.ts +1 -0
- package/internal/api-client/types.js.map +1 -1
- package/internal/api-client/webSocketTickets.d.ts +1 -0
- package/internal/api-client/webSocketTickets.js +4 -0
- package/internal/api-client/webSocketTickets.js.map +1 -1
- package/internal/sqlite-worker/client.d.ts +1 -1
- package/internal/sqlite-worker/client.js +6 -1
- package/internal/sqlite-worker/client.js.map +1 -1
- package/internal/sqlite-worker/purgeOpfsDatabase.d.ts +1 -1
- package/internal/sqlite-worker/purgeOpfsDatabase.js +3 -2
- package/internal/sqlite-worker/purgeOpfsDatabase.js.map +1 -1
- package/internal/sqlite-worker/types.d.ts +4 -0
- package/internal/sqlite-worker/types.js.map +1 -1
- package/internal/validators/documentCreateSeedRefinements.js +2 -2
- package/internal/validators/documentCreateSeedRefinements.js.map +1 -1
- package/internal/validators/operation/auth.d.ts +50 -1703
- package/internal/validators/operation/auth.js +2 -2
- package/internal/validators/operation/auth.js.map +1 -1
- package/internal/validators/operation/containerMutations.d.ts +1 -294
- package/internal/validators/operation/containerMutations.js +2 -2
- package/internal/validators/operation/containerMutations.js.map +1 -1
- package/internal/validators/operation/documentMutations.d.ts +1 -294
- package/internal/validators/operation/documentMutations.js +2 -2
- package/internal/validators/operation/documentMutations.js.map +1 -1
- package/internal/validators/operation/organizations.d.ts +50 -1703
- package/internal/validators/operation/organizations.js +2 -2
- package/internal/validators/operation/organizations.js.map +1 -1
- package/internal/validators/organizationProvisioningRefinements.js +2 -2
- package/internal/validators/organizationProvisioningRefinements.js.map +1 -1
- package/internal/validators/request/containerMetadata.d.ts +0 -276
- package/internal/validators/request/containerMetadata.js +5 -4
- package/internal/validators/request/containerMetadata.js.map +1 -1
- package/internal/validators/request/document.d.ts +0 -277
- package/internal/validators/request/document.js +8 -4
- package/internal/validators/request/document.js.map +1 -1
- package/internal/validators/request/documentCreateSeed.d.ts +99 -0
- package/internal/validators/request/documentCreateSeed.js +132 -9
- package/internal/validators/request/documentCreateSeed.js.map +1 -1
- package/internal/validators/request/documentSyncSchema.d.ts +41 -0
- package/internal/validators/request/documentSyncSchema.js +1 -1
- package/internal/validators/request/documentSyncSchema.js.map +1 -1
- package/internal/validators/request/index.d.ts +1 -0
- package/internal/validators/request/index.js +1 -0
- package/internal/validators/request/index.js.map +1 -1
- package/internal/validators/request/organizationProvisioning.d.ts +263 -5567
- package/internal/validators/request/organizationProvisioning.js +10 -4
- package/internal/validators/request/organizationProvisioning.js.map +1 -1
- package/internal/validators/request/registration.d.ts +71 -1703
- package/package.json +1 -1
- package/sqlite/worker.js +1 -1
- package/workflows/container-contents/container-state/create/createWithMetadata.js +6 -3
- package/workflows/container-contents/container-state/create/createWithMetadata.js.map +1 -1
- package/workflows/documents/attachments/blobMutationLock.d.ts +1 -1
- package/workflows/documents/attachments/blobMutationLock.js +2 -2
- package/workflows/documents/attachments/blobMutationLock.js.map +1 -1
- package/workflows/documents/create/index.js +4 -4
- package/workflows/documents/create/index.js.map +1 -1
- package/workflows/documents/sync/initialSync.d.ts +26 -11
- package/workflows/documents/sync/initialSync.js +32 -12
- package/workflows/documents/sync/initialSync.js.map +1 -1
- package/workflows/organizations/readModel/readModelProjection.js +2 -0
- package/workflows/organizations/readModel/readModelProjection.js.map +1 -1
- package/workflows/registration/provisionedProfileDocument.js +2 -2
- package/workflows/registration/provisionedProfileDocument.js.map +1 -1
- package/workflows/registration/provisioningBootstrapBuilders.d.ts +0 -68
- package/workflows/registration/provisioningBootstrapBuilders.js +3 -3
- package/workflows/registration/provisioningBootstrapBuilders.js.map +1 -1
- package/workflows/registration/registerIdentity.js +2 -0
- package/workflows/registration/registerIdentity.js.map +1 -1
|
@@ -142,7 +142,6 @@ export declare const documentCreateRequestShape: {
|
|
|
142
142
|
}>>;
|
|
143
143
|
event: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
144
144
|
expectedManifestHash: z.ZodString;
|
|
145
|
-
manifest: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
146
145
|
targetContainerPathRefs: z.ZodOptional<z.ZodCustom<{
|
|
147
146
|
containerId: string;
|
|
148
147
|
manifestHash: string;
|
|
@@ -169,7 +168,6 @@ export declare const DocumentCreateBaseRequestSchema: z.ZodType<{
|
|
|
169
168
|
};
|
|
170
169
|
event: Record<string, unknown>;
|
|
171
170
|
expectedManifestHash: string;
|
|
172
|
-
manifest: Record<string, unknown>;
|
|
173
171
|
authorizingContainerPathRefs?: {
|
|
174
172
|
containerId: string;
|
|
175
173
|
manifestHash: string;
|
|
@@ -236,7 +234,6 @@ export declare const DocumentCreateBaseRequestSchema: z.ZodType<{
|
|
|
236
234
|
};
|
|
237
235
|
event: Record<string, unknown>;
|
|
238
236
|
expectedManifestHash: string;
|
|
239
|
-
manifest: Record<string, unknown>;
|
|
240
237
|
authorizingContainerPathRefs?: {
|
|
241
238
|
containerId: string;
|
|
242
239
|
manifestHash: string;
|
|
@@ -303,7 +300,6 @@ export declare const DocumentCreateBaseRequestSchema: z.ZodType<{
|
|
|
303
300
|
};
|
|
304
301
|
event: Record<string, unknown>;
|
|
305
302
|
expectedManifestHash: string;
|
|
306
|
-
manifest: Record<string, unknown>;
|
|
307
303
|
authorizingContainerPathRefs?: {
|
|
308
304
|
containerId: string;
|
|
309
305
|
manifestHash: string;
|
|
@@ -370,7 +366,6 @@ export declare const DocumentCreateBaseRequestSchema: z.ZodType<{
|
|
|
370
366
|
};
|
|
371
367
|
event: Record<string, unknown>;
|
|
372
368
|
expectedManifestHash: string;
|
|
373
|
-
manifest: Record<string, unknown>;
|
|
374
369
|
authorizingContainerPathRefs?: {
|
|
375
370
|
containerId: string;
|
|
376
371
|
manifestHash: string;
|
|
@@ -443,12 +438,7 @@ export declare const DocumentCreateRequestSchema: z.ZodType<{
|
|
|
443
438
|
};
|
|
444
439
|
event: Record<string, unknown>;
|
|
445
440
|
expectedManifestHash: string;
|
|
446
|
-
manifest: Record<string, unknown>;
|
|
447
441
|
initialSync?: {
|
|
448
|
-
contentKeyEpoch: number;
|
|
449
|
-
expectedLinkSetManifestHash: string;
|
|
450
|
-
expectedTargetHash: string;
|
|
451
|
-
localVersionVector: string | null;
|
|
452
442
|
outgoingUpdates: {
|
|
453
443
|
encryptedData: string;
|
|
454
444
|
id: string;
|
|
@@ -460,69 +450,6 @@ export declare const DocumentCreateRequestSchema: z.ZodType<{
|
|
|
460
450
|
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
461
451
|
sourceVersionVector?: string | undefined;
|
|
462
452
|
}[];
|
|
463
|
-
supportsPullPagination: true;
|
|
464
|
-
authorizingContainerPathRefs?: {
|
|
465
|
-
containerId: string;
|
|
466
|
-
manifestHash: string;
|
|
467
|
-
}[][] | undefined;
|
|
468
|
-
containerRekeys?: {
|
|
469
|
-
body: unknown;
|
|
470
|
-
event: Record<string, unknown>;
|
|
471
|
-
expectedManifestHash: string;
|
|
472
|
-
keyEpoch: Record<string, unknown>;
|
|
473
|
-
keyring: Record<string, unknown> | null;
|
|
474
|
-
predecessorBridge: Record<string, unknown> | null;
|
|
475
|
-
principalPolicyRefs: {
|
|
476
|
-
principalType: "group" | "organization";
|
|
477
|
-
principalId: string;
|
|
478
|
-
version: number;
|
|
479
|
-
stateHash: string;
|
|
480
|
-
}[];
|
|
481
|
-
wraps: Record<string, unknown>[];
|
|
482
|
-
containerManifestHistoryRefs?: {
|
|
483
|
-
containerId: string;
|
|
484
|
-
manifestHash: string;
|
|
485
|
-
}[] | undefined;
|
|
486
|
-
destinationParentContainerPathRefs?: {
|
|
487
|
-
containerId: string;
|
|
488
|
-
manifestHash: string;
|
|
489
|
-
}[] | undefined;
|
|
490
|
-
parentContainerPathRefs?: {
|
|
491
|
-
containerId: string;
|
|
492
|
-
manifestHash: string;
|
|
493
|
-
}[] | undefined;
|
|
494
|
-
parentKekRef?: {
|
|
495
|
-
containerId: string;
|
|
496
|
-
containerKeyEpochId: string;
|
|
497
|
-
keyEpochHash: string;
|
|
498
|
-
} | null | undefined;
|
|
499
|
-
previousContainerPathRefs?: {
|
|
500
|
-
containerId: string;
|
|
501
|
-
manifestHash: string;
|
|
502
|
-
}[] | undefined;
|
|
503
|
-
previousManifestRef?: {
|
|
504
|
-
containerId: string;
|
|
505
|
-
manifestHash: string;
|
|
506
|
-
} | null | undefined;
|
|
507
|
-
userRecipientKeys?: Record<string, unknown>[] | undefined;
|
|
508
|
-
}[] | undefined;
|
|
509
|
-
contentKeyBundle?: {
|
|
510
|
-
contentKeyEpoch: number;
|
|
511
|
-
linkSetManifestHash: string;
|
|
512
|
-
targetHash: string;
|
|
513
|
-
targets: {
|
|
514
|
-
containerId: string;
|
|
515
|
-
containerKeyEpoch: number;
|
|
516
|
-
containerKeyEpochId: string;
|
|
517
|
-
containerManifestHash: string;
|
|
518
|
-
wrappedKey: string;
|
|
519
|
-
wrappingMetadata: Record<string, unknown>;
|
|
520
|
-
}[];
|
|
521
|
-
} | undefined;
|
|
522
|
-
historyMode?: "raw" | undefined;
|
|
523
|
-
inlineRekeyCommitId?: string | undefined;
|
|
524
|
-
minLsn?: string | undefined;
|
|
525
|
-
pullCursor?: string | undefined;
|
|
526
453
|
} | undefined;
|
|
527
454
|
authorizingContainerPathRefs?: {
|
|
528
455
|
containerId: string;
|
|
@@ -590,12 +517,7 @@ export declare const DocumentCreateRequestSchema: z.ZodType<{
|
|
|
590
517
|
};
|
|
591
518
|
event: Record<string, unknown>;
|
|
592
519
|
expectedManifestHash: string;
|
|
593
|
-
manifest: Record<string, unknown>;
|
|
594
520
|
initialSync?: {
|
|
595
|
-
contentKeyEpoch: number;
|
|
596
|
-
expectedLinkSetManifestHash: string;
|
|
597
|
-
expectedTargetHash: string;
|
|
598
|
-
localVersionVector: string | null;
|
|
599
521
|
outgoingUpdates: {
|
|
600
522
|
encryptedData: string;
|
|
601
523
|
id: string;
|
|
@@ -607,69 +529,6 @@ export declare const DocumentCreateRequestSchema: z.ZodType<{
|
|
|
607
529
|
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
608
530
|
sourceVersionVector?: string | undefined;
|
|
609
531
|
}[];
|
|
610
|
-
supportsPullPagination: true;
|
|
611
|
-
authorizingContainerPathRefs?: {
|
|
612
|
-
containerId: string;
|
|
613
|
-
manifestHash: string;
|
|
614
|
-
}[][] | undefined;
|
|
615
|
-
containerRekeys?: {
|
|
616
|
-
body: unknown;
|
|
617
|
-
event: Record<string, unknown>;
|
|
618
|
-
expectedManifestHash: string;
|
|
619
|
-
keyEpoch: Record<string, unknown>;
|
|
620
|
-
keyring: Record<string, unknown> | null;
|
|
621
|
-
predecessorBridge: Record<string, unknown> | null;
|
|
622
|
-
principalPolicyRefs: {
|
|
623
|
-
principalType: "group" | "organization";
|
|
624
|
-
principalId: string;
|
|
625
|
-
version: number;
|
|
626
|
-
stateHash: string;
|
|
627
|
-
}[];
|
|
628
|
-
wraps: Record<string, unknown>[];
|
|
629
|
-
containerManifestHistoryRefs?: {
|
|
630
|
-
containerId: string;
|
|
631
|
-
manifestHash: string;
|
|
632
|
-
}[] | undefined;
|
|
633
|
-
destinationParentContainerPathRefs?: {
|
|
634
|
-
containerId: string;
|
|
635
|
-
manifestHash: string;
|
|
636
|
-
}[] | undefined;
|
|
637
|
-
parentContainerPathRefs?: {
|
|
638
|
-
containerId: string;
|
|
639
|
-
manifestHash: string;
|
|
640
|
-
}[] | undefined;
|
|
641
|
-
parentKekRef?: {
|
|
642
|
-
containerId: string;
|
|
643
|
-
containerKeyEpochId: string;
|
|
644
|
-
keyEpochHash: string;
|
|
645
|
-
} | null | undefined;
|
|
646
|
-
previousContainerPathRefs?: {
|
|
647
|
-
containerId: string;
|
|
648
|
-
manifestHash: string;
|
|
649
|
-
}[] | undefined;
|
|
650
|
-
previousManifestRef?: {
|
|
651
|
-
containerId: string;
|
|
652
|
-
manifestHash: string;
|
|
653
|
-
} | null | undefined;
|
|
654
|
-
userRecipientKeys?: Record<string, unknown>[] | undefined;
|
|
655
|
-
}[] | undefined;
|
|
656
|
-
contentKeyBundle?: {
|
|
657
|
-
contentKeyEpoch: number;
|
|
658
|
-
linkSetManifestHash: string;
|
|
659
|
-
targetHash: string;
|
|
660
|
-
targets: {
|
|
661
|
-
containerId: string;
|
|
662
|
-
containerKeyEpoch: number;
|
|
663
|
-
containerKeyEpochId: string;
|
|
664
|
-
containerManifestHash: string;
|
|
665
|
-
wrappedKey: string;
|
|
666
|
-
wrappingMetadata: Record<string, unknown>;
|
|
667
|
-
}[];
|
|
668
|
-
} | undefined;
|
|
669
|
-
historyMode?: "raw" | undefined;
|
|
670
|
-
inlineRekeyCommitId?: string | undefined;
|
|
671
|
-
minLsn?: string | undefined;
|
|
672
|
-
pullCursor?: string | undefined;
|
|
673
532
|
} | undefined;
|
|
674
533
|
authorizingContainerPathRefs?: {
|
|
675
534
|
containerId: string;
|
|
@@ -737,12 +596,7 @@ export declare const DocumentCreateRequestSchema: z.ZodType<{
|
|
|
737
596
|
};
|
|
738
597
|
event: Record<string, unknown>;
|
|
739
598
|
expectedManifestHash: string;
|
|
740
|
-
manifest: Record<string, unknown>;
|
|
741
599
|
initialSync?: {
|
|
742
|
-
contentKeyEpoch: number;
|
|
743
|
-
expectedLinkSetManifestHash: string;
|
|
744
|
-
expectedTargetHash: string;
|
|
745
|
-
localVersionVector: string | null;
|
|
746
600
|
outgoingUpdates: {
|
|
747
601
|
encryptedData: string;
|
|
748
602
|
id: string;
|
|
@@ -754,69 +608,6 @@ export declare const DocumentCreateRequestSchema: z.ZodType<{
|
|
|
754
608
|
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
755
609
|
sourceVersionVector?: string | undefined;
|
|
756
610
|
}[];
|
|
757
|
-
supportsPullPagination: true;
|
|
758
|
-
authorizingContainerPathRefs?: {
|
|
759
|
-
containerId: string;
|
|
760
|
-
manifestHash: string;
|
|
761
|
-
}[][] | undefined;
|
|
762
|
-
containerRekeys?: {
|
|
763
|
-
body: unknown;
|
|
764
|
-
event: Record<string, unknown>;
|
|
765
|
-
expectedManifestHash: string;
|
|
766
|
-
keyEpoch: Record<string, unknown>;
|
|
767
|
-
keyring: Record<string, unknown> | null;
|
|
768
|
-
predecessorBridge: Record<string, unknown> | null;
|
|
769
|
-
principalPolicyRefs: {
|
|
770
|
-
principalType: "group" | "organization";
|
|
771
|
-
principalId: string;
|
|
772
|
-
version: number;
|
|
773
|
-
stateHash: string;
|
|
774
|
-
}[];
|
|
775
|
-
wraps: Record<string, unknown>[];
|
|
776
|
-
containerManifestHistoryRefs?: {
|
|
777
|
-
containerId: string;
|
|
778
|
-
manifestHash: string;
|
|
779
|
-
}[] | undefined;
|
|
780
|
-
destinationParentContainerPathRefs?: {
|
|
781
|
-
containerId: string;
|
|
782
|
-
manifestHash: string;
|
|
783
|
-
}[] | undefined;
|
|
784
|
-
parentContainerPathRefs?: {
|
|
785
|
-
containerId: string;
|
|
786
|
-
manifestHash: string;
|
|
787
|
-
}[] | undefined;
|
|
788
|
-
parentKekRef?: {
|
|
789
|
-
containerId: string;
|
|
790
|
-
containerKeyEpochId: string;
|
|
791
|
-
keyEpochHash: string;
|
|
792
|
-
} | null | undefined;
|
|
793
|
-
previousContainerPathRefs?: {
|
|
794
|
-
containerId: string;
|
|
795
|
-
manifestHash: string;
|
|
796
|
-
}[] | undefined;
|
|
797
|
-
previousManifestRef?: {
|
|
798
|
-
containerId: string;
|
|
799
|
-
manifestHash: string;
|
|
800
|
-
} | null | undefined;
|
|
801
|
-
userRecipientKeys?: Record<string, unknown>[] | undefined;
|
|
802
|
-
}[] | undefined;
|
|
803
|
-
contentKeyBundle?: {
|
|
804
|
-
contentKeyEpoch: number;
|
|
805
|
-
linkSetManifestHash: string;
|
|
806
|
-
targetHash: string;
|
|
807
|
-
targets: {
|
|
808
|
-
containerId: string;
|
|
809
|
-
containerKeyEpoch: number;
|
|
810
|
-
containerKeyEpochId: string;
|
|
811
|
-
containerManifestHash: string;
|
|
812
|
-
wrappedKey: string;
|
|
813
|
-
wrappingMetadata: Record<string, unknown>;
|
|
814
|
-
}[];
|
|
815
|
-
} | undefined;
|
|
816
|
-
historyMode?: "raw" | undefined;
|
|
817
|
-
inlineRekeyCommitId?: string | undefined;
|
|
818
|
-
minLsn?: string | undefined;
|
|
819
|
-
pullCursor?: string | undefined;
|
|
820
611
|
} | undefined;
|
|
821
612
|
authorizingContainerPathRefs?: {
|
|
822
613
|
containerId: string;
|
|
@@ -884,12 +675,7 @@ export declare const DocumentCreateRequestSchema: z.ZodType<{
|
|
|
884
675
|
};
|
|
885
676
|
event: Record<string, unknown>;
|
|
886
677
|
expectedManifestHash: string;
|
|
887
|
-
manifest: Record<string, unknown>;
|
|
888
678
|
initialSync?: {
|
|
889
|
-
contentKeyEpoch: number;
|
|
890
|
-
expectedLinkSetManifestHash: string;
|
|
891
|
-
expectedTargetHash: string;
|
|
892
|
-
localVersionVector: string | null;
|
|
893
679
|
outgoingUpdates: {
|
|
894
680
|
encryptedData: string;
|
|
895
681
|
id: string;
|
|
@@ -901,69 +687,6 @@ export declare const DocumentCreateRequestSchema: z.ZodType<{
|
|
|
901
687
|
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
902
688
|
sourceVersionVector?: string | undefined;
|
|
903
689
|
}[];
|
|
904
|
-
supportsPullPagination: true;
|
|
905
|
-
authorizingContainerPathRefs?: {
|
|
906
|
-
containerId: string;
|
|
907
|
-
manifestHash: string;
|
|
908
|
-
}[][] | undefined;
|
|
909
|
-
containerRekeys?: {
|
|
910
|
-
body: unknown;
|
|
911
|
-
event: Record<string, unknown>;
|
|
912
|
-
expectedManifestHash: string;
|
|
913
|
-
keyEpoch: Record<string, unknown>;
|
|
914
|
-
keyring: Record<string, unknown> | null;
|
|
915
|
-
predecessorBridge: Record<string, unknown> | null;
|
|
916
|
-
principalPolicyRefs: {
|
|
917
|
-
principalType: "group" | "organization";
|
|
918
|
-
principalId: string;
|
|
919
|
-
version: number;
|
|
920
|
-
stateHash: string;
|
|
921
|
-
}[];
|
|
922
|
-
wraps: Record<string, unknown>[];
|
|
923
|
-
containerManifestHistoryRefs?: {
|
|
924
|
-
containerId: string;
|
|
925
|
-
manifestHash: string;
|
|
926
|
-
}[] | undefined;
|
|
927
|
-
destinationParentContainerPathRefs?: {
|
|
928
|
-
containerId: string;
|
|
929
|
-
manifestHash: string;
|
|
930
|
-
}[] | undefined;
|
|
931
|
-
parentContainerPathRefs?: {
|
|
932
|
-
containerId: string;
|
|
933
|
-
manifestHash: string;
|
|
934
|
-
}[] | undefined;
|
|
935
|
-
parentKekRef?: {
|
|
936
|
-
containerId: string;
|
|
937
|
-
containerKeyEpochId: string;
|
|
938
|
-
keyEpochHash: string;
|
|
939
|
-
} | null | undefined;
|
|
940
|
-
previousContainerPathRefs?: {
|
|
941
|
-
containerId: string;
|
|
942
|
-
manifestHash: string;
|
|
943
|
-
}[] | undefined;
|
|
944
|
-
previousManifestRef?: {
|
|
945
|
-
containerId: string;
|
|
946
|
-
manifestHash: string;
|
|
947
|
-
} | null | undefined;
|
|
948
|
-
userRecipientKeys?: Record<string, unknown>[] | undefined;
|
|
949
|
-
}[] | undefined;
|
|
950
|
-
contentKeyBundle?: {
|
|
951
|
-
contentKeyEpoch: number;
|
|
952
|
-
linkSetManifestHash: string;
|
|
953
|
-
targetHash: string;
|
|
954
|
-
targets: {
|
|
955
|
-
containerId: string;
|
|
956
|
-
containerKeyEpoch: number;
|
|
957
|
-
containerKeyEpochId: string;
|
|
958
|
-
containerManifestHash: string;
|
|
959
|
-
wrappedKey: string;
|
|
960
|
-
wrappingMetadata: Record<string, unknown>;
|
|
961
|
-
}[];
|
|
962
|
-
} | undefined;
|
|
963
|
-
historyMode?: "raw" | undefined;
|
|
964
|
-
inlineRekeyCommitId?: string | undefined;
|
|
965
|
-
minLsn?: string | undefined;
|
|
966
|
-
pullCursor?: string | undefined;
|
|
967
690
|
} | undefined;
|
|
968
691
|
authorizingContainerPathRefs?: {
|
|
969
692
|
containerId: string;
|
|
@@ -4,7 +4,7 @@ import { registerJsonSchemaRuntimeRefinements } from "../jsonSchema.js";
|
|
|
4
4
|
import { arraySchema, loosePlainObject, nonEmptyStringSchema, plainObjectSchema, requiredUnknownSchema, } from "../schema.js";
|
|
5
5
|
import { MAX_CONTAINER_PATH_LENGTH, MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS, MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS, MAX_INLINE_CONTAINER_REKEYS, } from "../util/index.js";
|
|
6
6
|
import { ContainerMutationRequestSchema } from "./container.js";
|
|
7
|
-
import {
|
|
7
|
+
import { DocumentCreateSeedRequestSchema, refineCreateSeedSync, refineSingleUpdateSeed, } from "./documentCreateSeed.js";
|
|
8
8
|
import { ContainerManifestPathSchema, ContainerManifestRefArrayArraySchema, DocumentContentKeyBundleRequestSchema, DocumentOutgoingUpdateSchema, DocumentSyncRequestSchema, } from "./documentSyncSchema.js";
|
|
9
9
|
export { ContainerManifestRefArrayArraySchema, ContainerManifestRefSchema, DocumentContentKeyBundleRequestSchema, DocumentContentKeyTargetEnvelopeSchema, DocumentOutgoingUpdateSchema, DocumentSyncRequestSchema, } from "./documentSyncSchema.js";
|
|
10
10
|
export const documentCreateRequestShape = {
|
|
@@ -13,8 +13,9 @@ export const documentCreateRequestShape = {
|
|
|
13
13
|
containerRekeys: arraySchema(ContainerMutationRequestSchema, MAX_INLINE_CONTAINER_REKEYS).optional(),
|
|
14
14
|
contentKeyBundle: DocumentContentKeyBundleRequestSchema,
|
|
15
15
|
event: plainObjectSchema,
|
|
16
|
+
// The API derives the initial link-set manifest from the signed event and
|
|
17
|
+
// the target path; the request commits to it by hash.
|
|
16
18
|
expectedManifestHash: nonEmptyStringSchema,
|
|
17
|
-
manifest: plainObjectSchema,
|
|
18
19
|
targetContainerPathRefs: ContainerManifestPathSchema.optional(),
|
|
19
20
|
};
|
|
20
21
|
/** A document create with no seed: a container's metadata document. */
|
|
@@ -26,13 +27,16 @@ export const DocumentCreateBaseRequestSchema = loosePlainObject(documentCreateRe
|
|
|
26
27
|
*/
|
|
27
28
|
export const DocumentCreateRequestSchema = registerJsonSchemaRuntimeRefinements(loosePlainObject({
|
|
28
29
|
...documentCreateRequestShape,
|
|
29
|
-
initialSync:
|
|
30
|
+
initialSync: DocumentCreateSeedRequestSchema.optional(),
|
|
30
31
|
}).superRefine((value, context) => {
|
|
31
32
|
refineSingleUpdateSeed(value.initialSync, context, {
|
|
32
33
|
message: "document create seed requires one update and no container rekeys",
|
|
33
34
|
path: "initialSync",
|
|
34
35
|
});
|
|
35
|
-
|
|
36
|
+
refineCreateSeedSync(value, value.initialSync, context, {
|
|
37
|
+
path: "initialSync",
|
|
38
|
+
withinSyncLimit: true,
|
|
39
|
+
});
|
|
36
40
|
}), [documentCreateSeedRefinement]);
|
|
37
41
|
// The prior link-set manifest is the document's current head. The server
|
|
38
42
|
// resolves it from its own store, while the signed event's previous manifest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sourceRoot":"","sources":["document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,oCAAoC,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,yBAAyB,EACzB,yCAAyC,EACzC,qCAAqC,EACrC,2BAA2B,GAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9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,EAAE,QAAQ;YACd,OAAO,EAAE,6BAA6B,CAAC,WAAW;YAClD,IAAI,EAAE,CAAC,8BAA8B,CAAC;SACvC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,EACF,CAAC,6BAA6B,CAAC,CAChC,CAAC;AAMJ,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;IACzD,4BAA4B,EAAE,2BAA2B;IACzD,IAAI,EAAE,qBAAqB;IAC3B,KAAK,EAAE,iBAAiB;CACzB,CAAC,CAAC;AAIH,MAAM,UAAU,gCAAgC,CAC9C,KAAc;IAEd,OAAO,oCAAoC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,KAAc;IAEd,OAAO,qCAAqC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,KAAc;IAEd,OAAO,2BAA2B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,KAAc;IAEd,OAAO,oCAAoC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,KAAc;IAEd,OAAO,0BAA0B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAAc;IAEd,OAAO,yBAAyB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC5D,CAAC","sourcesContent":["import type { z } from \"zod\";\nimport { documentCreateSeedRefinement } from \"../documentCreateSeedRefinements\";\nimport { documentLinkSetPathRefinement } from \"../documentSyncRefinements\";\nimport { registerJsonSchemaRuntimeRefinements } from \"../jsonSchema\";\nimport {\n arraySchema,\n loosePlainObject,\n nonEmptyStringSchema,\n plainObjectSchema,\n requiredUnknownSchema,\n} from \"../schema\";\nimport {\n MAX_CONTAINER_PATH_LENGTH,\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS,\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS,\n MAX_INLINE_CONTAINER_REKEYS,\n} from \"../util\";\nimport { ContainerMutationRequestSchema } from \"./container\";\nimport {\n refineSeedWithinSyncRequestLimit,\n refineSingleUpdateSeed,\n} from \"./documentCreateSeed\";\nimport {\n ContainerManifestPathSchema,\n type ContainerManifestRef,\n ContainerManifestRefArrayArraySchema,\n type DocumentContentKeyBundleRequest,\n DocumentContentKeyBundleRequestSchema,\n DocumentOutgoingUpdateSchema,\n type DocumentSyncRequest,\n DocumentSyncRequestSchema,\n} from \"./documentSyncSchema\";\n\nexport {\n type ContainerManifestRef,\n ContainerManifestRefArrayArraySchema,\n ContainerManifestRefSchema,\n type DocumentContentKeyBundleRequest,\n DocumentContentKeyBundleRequestSchema,\n type DocumentContentKeyTargetEnvelope,\n DocumentContentKeyTargetEnvelopeSchema,\n type DocumentOutgoingUpdate,\n DocumentOutgoingUpdateSchema,\n type DocumentSyncRequest,\n DocumentSyncRequestSchema,\n} from \"./documentSyncSchema\";\n\nexport const documentCreateRequestShape = {\n authorizingContainerPathRefs: ContainerManifestRefArrayArraySchema.optional(),\n body: requiredUnknownSchema,\n containerRekeys: arraySchema(\n ContainerMutationRequestSchema,\n MAX_INLINE_CONTAINER_REKEYS,\n ).optional(),\n contentKeyBundle: DocumentContentKeyBundleRequestSchema,\n event: plainObjectSchema,\n expectedManifestHash: nonEmptyStringSchema,\n manifest: plainObjectSchema,\n targetContainerPathRefs: ContainerManifestPathSchema.optional(),\n} satisfies z.ZodRawShape;\n\n/** A document create with no seed: a container's metadata document. */\nexport const DocumentCreateBaseRequestSchema = loosePlainObject(\n documentCreateRequestShape,\n);\n\n/**\n * `POST /documents`. The optional seed is the create's first queued update,\n * committed in the create transaction under the same checks as a standalone\n * sync, so a new document needs no follow-up sync round trip.\n */\nexport const DocumentCreateRequestSchema = registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...documentCreateRequestShape,\n initialSync: DocumentSyncRequestSchema.optional(),\n }).superRefine((value, context) => {\n refineSingleUpdateSeed(value.initialSync, context, {\n message:\n \"document create seed requires one update and no container rekeys\",\n path: \"initialSync\",\n });\n refineSeedWithinSyncRequestLimit(value.initialSync, context, \"initialSync\");\n }),\n [documentCreateSeedRefinement],\n);\n\nexport type DocumentCreateRequest = z.infer<typeof DocumentCreateRequestSchema>;\n\n// The prior link-set manifest is the document's current head. The server\n// resolves it from its own store, while the signed event's previous manifest\n// hash pins freshness, so the writer does not echo the bundle back.\nexport const DocumentLinkSetMutationRequestSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n authorizingContainerPathRefs: ContainerManifestRefArrayArraySchema,\n body: requiredUnknownSchema,\n containerRekeys: arraySchema(\n ContainerMutationRequestSchema,\n MAX_INLINE_CONTAINER_REKEYS,\n ).optional(),\n contentKeyBundle: DocumentContentKeyBundleRequestSchema,\n event: plainObjectSchema,\n expectedManifestHash: nonEmptyStringSchema,\n rotationBaseline: DocumentOutgoingUpdateSchema.optional(),\n // A container path (root→leaf chain) must carry at least one manifest\n // reference; an empty path authorizes nothing and is never legitimately built.\n targetContainerPathRefs: ContainerManifestPathSchema,\n }).superRefine((request, context) => {\n if (\n !Array.isArray(request.authorizingContainerPathRefs) ||\n !Array.isArray(request.targetContainerPathRefs)\n ) {\n return;\n }\n // The nested schemas have already reported their shape/cardinality\n // errors. Keep this aggregate refinement bounded and never dereference a\n // malformed path after those continuable issues have been replayed.\n if (\n request.authorizingContainerPathRefs.length >\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS ||\n request.targetContainerPathRefs.length > MAX_CONTAINER_PATH_LENGTH ||\n request.authorizingContainerPathRefs.some(\n (path) =>\n !Array.isArray(path) || path.length > MAX_CONTAINER_PATH_LENGTH,\n )\n ) {\n return;\n }\n const totalReferences = request.authorizingContainerPathRefs.reduce(\n (total, path) => total + path.length,\n request.targetContainerPathRefs.length,\n );\n if (totalReferences > MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS) {\n context.addIssue({\n code: \"custom\",\n message: documentLinkSetPathRefinement.description,\n path: [\"authorizingContainerPathRefs\"],\n });\n }\n }),\n [documentLinkSetPathRefinement],\n );\n\nexport type DocumentLinkSetMutationRequest = z.infer<\n typeof DocumentLinkSetMutationRequestSchema\n>;\n\nexport const DocumentPurgeRequestSchema = loosePlainObject({\n authorizingContainerPathRefs: ContainerManifestPathSchema,\n body: requiredUnknownSchema,\n event: plainObjectSchema,\n});\n\nexport type DocumentPurgeRequest = z.infer<typeof DocumentPurgeRequestSchema>;\n\nexport function isContainerManifestRefArrayArray(\n value: unknown,\n): value is ContainerManifestRef[][] {\n return ContainerManifestRefArrayArraySchema.safeParse(value).success;\n}\n\nexport function isDocumentContentKeyBundleRequest(\n value: unknown,\n): value is DocumentContentKeyBundleRequest {\n return DocumentContentKeyBundleRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentCreateRequest(\n value: unknown,\n): value is DocumentCreateRequest {\n return DocumentCreateRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentLinkSetMutationRequest(\n value: unknown,\n): value is DocumentLinkSetMutationRequest {\n return DocumentLinkSetMutationRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentPurgeRequest(\n value: unknown,\n): value is DocumentPurgeRequest {\n return DocumentPurgeRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentSyncRequest(\n value: unknown,\n): value is DocumentSyncRequest {\n return DocumentSyncRequestSchema.safeParse(value).success;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EA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AAC;AAED,MAAM,UAAU,sBAAsB,CACpC,KAAc;IAEd,OAAO,0BAA0B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAAc;IAEd,OAAO,yBAAyB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAC5D,CAAC","sourcesContent":["import type { z } from \"zod\";\nimport { documentCreateSeedRefinement } from \"../documentCreateSeedRefinements\";\nimport { documentLinkSetPathRefinement } from \"../documentSyncRefinements\";\nimport { registerJsonSchemaRuntimeRefinements } from \"../jsonSchema\";\nimport {\n arraySchema,\n loosePlainObject,\n nonEmptyStringSchema,\n plainObjectSchema,\n requiredUnknownSchema,\n} from \"../schema\";\nimport {\n MAX_CONTAINER_PATH_LENGTH,\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS,\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS,\n MAX_INLINE_CONTAINER_REKEYS,\n} from \"../util\";\nimport { ContainerMutationRequestSchema } from \"./container\";\nimport {\n DocumentCreateSeedRequestSchema,\n refineCreateSeedSync,\n refineSingleUpdateSeed,\n} from \"./documentCreateSeed\";\nimport {\n ContainerManifestPathSchema,\n type ContainerManifestRef,\n ContainerManifestRefArrayArraySchema,\n type DocumentContentKeyBundleRequest,\n DocumentContentKeyBundleRequestSchema,\n DocumentOutgoingUpdateSchema,\n type DocumentSyncRequest,\n DocumentSyncRequestSchema,\n} from \"./documentSyncSchema\";\n\nexport {\n type ContainerManifestRef,\n ContainerManifestRefArrayArraySchema,\n ContainerManifestRefSchema,\n type DocumentContentKeyBundleRequest,\n DocumentContentKeyBundleRequestSchema,\n type DocumentContentKeyTargetEnvelope,\n DocumentContentKeyTargetEnvelopeSchema,\n type DocumentOutgoingUpdate,\n DocumentOutgoingUpdateSchema,\n type DocumentSyncRequest,\n DocumentSyncRequestSchema,\n} from \"./documentSyncSchema\";\n\nexport const documentCreateRequestShape = {\n authorizingContainerPathRefs: ContainerManifestRefArrayArraySchema.optional(),\n body: requiredUnknownSchema,\n containerRekeys: arraySchema(\n ContainerMutationRequestSchema,\n MAX_INLINE_CONTAINER_REKEYS,\n ).optional(),\n contentKeyBundle: DocumentContentKeyBundleRequestSchema,\n event: plainObjectSchema,\n // The API derives the initial link-set manifest from the signed event and\n // the target path; the request commits to it by hash.\n expectedManifestHash: nonEmptyStringSchema,\n targetContainerPathRefs: ContainerManifestPathSchema.optional(),\n} satisfies z.ZodRawShape;\n\n/** A document create with no seed: a container's metadata document. */\nexport const DocumentCreateBaseRequestSchema = loosePlainObject(\n documentCreateRequestShape,\n);\n\n/**\n * `POST /documents`. The optional seed is the create's first queued update,\n * committed in the create transaction under the same checks as a standalone\n * sync, so a new document needs no follow-up sync round trip.\n */\nexport const DocumentCreateRequestSchema = registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n ...documentCreateRequestShape,\n initialSync: DocumentCreateSeedRequestSchema.optional(),\n }).superRefine((value, context) => {\n refineSingleUpdateSeed(value.initialSync, context, {\n message:\n \"document create seed requires one update and no container rekeys\",\n path: \"initialSync\",\n });\n refineCreateSeedSync(value, value.initialSync, context, {\n path: \"initialSync\",\n withinSyncLimit: true,\n });\n }),\n [documentCreateSeedRefinement],\n);\n\nexport type DocumentCreateRequest = z.infer<typeof DocumentCreateRequestSchema>;\n\n// The prior link-set manifest is the document's current head. The server\n// resolves it from its own store, while the signed event's previous manifest\n// hash pins freshness, so the writer does not echo the bundle back.\nexport const DocumentLinkSetMutationRequestSchema =\n registerJsonSchemaRuntimeRefinements(\n loosePlainObject({\n authorizingContainerPathRefs: ContainerManifestRefArrayArraySchema,\n body: requiredUnknownSchema,\n containerRekeys: arraySchema(\n ContainerMutationRequestSchema,\n MAX_INLINE_CONTAINER_REKEYS,\n ).optional(),\n contentKeyBundle: DocumentContentKeyBundleRequestSchema,\n event: plainObjectSchema,\n expectedManifestHash: nonEmptyStringSchema,\n rotationBaseline: DocumentOutgoingUpdateSchema.optional(),\n // A container path (root→leaf chain) must carry at least one manifest\n // reference; an empty path authorizes nothing and is never legitimately built.\n targetContainerPathRefs: ContainerManifestPathSchema,\n }).superRefine((request, context) => {\n if (\n !Array.isArray(request.authorizingContainerPathRefs) ||\n !Array.isArray(request.targetContainerPathRefs)\n ) {\n return;\n }\n // The nested schemas have already reported their shape/cardinality\n // errors. Keep this aggregate refinement bounded and never dereference a\n // malformed path after those continuable issues have been replayed.\n if (\n request.authorizingContainerPathRefs.length >\n MAX_DOCUMENT_SYNC_AUTHORIZATION_PATHS ||\n request.targetContainerPathRefs.length > MAX_CONTAINER_PATH_LENGTH ||\n request.authorizingContainerPathRefs.some(\n (path) =>\n !Array.isArray(path) || path.length > MAX_CONTAINER_PATH_LENGTH,\n )\n ) {\n return;\n }\n const totalReferences = request.authorizingContainerPathRefs.reduce(\n (total, path) => total + path.length,\n request.targetContainerPathRefs.length,\n );\n if (totalReferences > MAX_DOCUMENT_SYNC_AUTHORIZATION_PATH_REFS) {\n context.addIssue({\n code: \"custom\",\n message: documentLinkSetPathRefinement.description,\n path: [\"authorizingContainerPathRefs\"],\n });\n }\n }),\n [documentLinkSetPathRefinement],\n );\n\nexport type DocumentLinkSetMutationRequest = z.infer<\n typeof DocumentLinkSetMutationRequestSchema\n>;\n\nexport const DocumentPurgeRequestSchema = loosePlainObject({\n authorizingContainerPathRefs: ContainerManifestPathSchema,\n body: requiredUnknownSchema,\n event: plainObjectSchema,\n});\n\nexport type DocumentPurgeRequest = z.infer<typeof DocumentPurgeRequestSchema>;\n\nexport function isContainerManifestRefArrayArray(\n value: unknown,\n): value is ContainerManifestRef[][] {\n return ContainerManifestRefArrayArraySchema.safeParse(value).success;\n}\n\nexport function isDocumentContentKeyBundleRequest(\n value: unknown,\n): value is DocumentContentKeyBundleRequest {\n return DocumentContentKeyBundleRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentCreateRequest(\n value: unknown,\n): value is DocumentCreateRequest {\n return DocumentCreateRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentLinkSetMutationRequest(\n value: unknown,\n): value is DocumentLinkSetMutationRequest {\n return DocumentLinkSetMutationRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentPurgeRequest(\n value: unknown,\n): value is DocumentPurgeRequest {\n return DocumentPurgeRequestSchema.safeParse(value).success;\n}\n\nexport function isDocumentSyncRequest(\n value: unknown,\n): value is DocumentSyncRequest {\n return DocumentSyncRequestSchema.safeParse(value).success;\n}\n"]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import { type ContainerManifestRef, type DocumentContentKeyBundleRequest, type DocumentSyncRequest } from "./documentSyncSchema.js";
|
|
3
|
+
/**
|
|
4
|
+
* A create's seed: the one update a document is born with, committed in its
|
|
5
|
+
* create transaction. It carries the update alone; the server takes the rest
|
|
6
|
+
* of the sync it stands for from the create itself (see
|
|
7
|
+
* {@link documentCreateSeedSyncRequest}).
|
|
8
|
+
*/
|
|
9
|
+
export declare const DocumentCreateSeedRequestSchema: z.ZodType<{
|
|
10
|
+
outgoingUpdates: {
|
|
11
|
+
encryptedData: string;
|
|
12
|
+
id: string;
|
|
13
|
+
partialEndVersionVector: string;
|
|
14
|
+
partialStartVersionVector: string;
|
|
15
|
+
plaintextHash: string;
|
|
16
|
+
writeHeader: Record<string, unknown>;
|
|
17
|
+
checkpointKind?: "rotate_baseline" | undefined;
|
|
18
|
+
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
19
|
+
sourceVersionVector?: string | undefined;
|
|
20
|
+
}[];
|
|
21
|
+
}, {
|
|
22
|
+
outgoingUpdates: {
|
|
23
|
+
encryptedData: string;
|
|
24
|
+
id: string;
|
|
25
|
+
partialEndVersionVector: string;
|
|
26
|
+
partialStartVersionVector: string;
|
|
27
|
+
plaintextHash: string;
|
|
28
|
+
writeHeader: Record<string, unknown>;
|
|
29
|
+
checkpointKind?: "rotate_baseline" | undefined;
|
|
30
|
+
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
31
|
+
sourceVersionVector?: string | undefined;
|
|
32
|
+
}[];
|
|
33
|
+
}, z.core.$ZodTypeInternals<{
|
|
34
|
+
outgoingUpdates: {
|
|
35
|
+
encryptedData: string;
|
|
36
|
+
id: string;
|
|
37
|
+
partialEndVersionVector: string;
|
|
38
|
+
partialStartVersionVector: string;
|
|
39
|
+
plaintextHash: string;
|
|
40
|
+
writeHeader: Record<string, unknown>;
|
|
41
|
+
checkpointKind?: "rotate_baseline" | undefined;
|
|
42
|
+
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
43
|
+
sourceVersionVector?: string | undefined;
|
|
44
|
+
}[];
|
|
45
|
+
}, {
|
|
46
|
+
outgoingUpdates: {
|
|
47
|
+
encryptedData: string;
|
|
48
|
+
id: string;
|
|
49
|
+
partialEndVersionVector: string;
|
|
50
|
+
partialStartVersionVector: string;
|
|
51
|
+
plaintextHash: string;
|
|
52
|
+
writeHeader: Record<string, unknown>;
|
|
53
|
+
checkpointKind?: "rotate_baseline" | undefined;
|
|
54
|
+
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
55
|
+
sourceVersionVector?: string | undefined;
|
|
56
|
+
}[];
|
|
57
|
+
}>>;
|
|
58
|
+
export type DocumentCreateSeedRequest = z.infer<typeof DocumentCreateSeedRequestSchema>;
|
|
59
|
+
/** The parts of a document create its seed's sync is made of. */
|
|
60
|
+
export interface DocumentCreateSeedSource {
|
|
61
|
+
readonly contentKeyBundle: DocumentContentKeyBundleRequest;
|
|
62
|
+
readonly targetContainerPathRefs?: readonly ContainerManifestRef[] | undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The document sync a create's seed stands for: the seed's update under the
|
|
66
|
+
* create's content-key epoch, expected link-set and target hashes, and target
|
|
67
|
+
* path, with the update's end as the local version. The update's signed write
|
|
68
|
+
* header names the same values, so the sync checks hold it to them exactly as
|
|
69
|
+
* for a standalone first sync. It carries no content-key bundle: the create
|
|
70
|
+
* stores that bundle in the same transaction, and the sync checks the stored
|
|
71
|
+
* one against these hashes.
|
|
72
|
+
*/
|
|
73
|
+
export declare function documentCreateSeedSyncRequest(create: DocumentCreateSeedSource, seed: DocumentCreateSeedRequest): DocumentSyncRequest;
|
|
74
|
+
/**
|
|
75
|
+
* A seed is exactly one outgoing update. An attachment bind's document sync,
|
|
76
|
+
* a full sync request, also holds no container rekeys.
|
|
77
|
+
*/
|
|
78
|
+
export declare function refineSingleUpdateSeed(seed: Pick<DocumentSyncRequest, "outgoingUpdates" | "containerRekeys"> | DocumentCreateSeedRequest | undefined, context: z.RefinementCtx, issue: {
|
|
79
|
+
readonly message: string;
|
|
80
|
+
readonly path: string;
|
|
81
|
+
}): void;
|
|
82
|
+
/**
|
|
83
|
+
* A create seed stands in for the document's first sync, so the sync it
|
|
84
|
+
* stands for is held to the sync request limit the create route's larger
|
|
85
|
+
* ingress ceiling would not apply.
|
|
86
|
+
*/
|
|
87
|
+
export declare function refineSeedWithinSyncRequestLimit(seed: DocumentSyncRequest | undefined, context: z.RefinementCtx, path: string): void;
|
|
88
|
+
/**
|
|
89
|
+
* Holds a create's seed to its update alone and the sync it stands for to the
|
|
90
|
+
* checks a standalone sync request gets: it must parse as a document sync
|
|
91
|
+
* (unique update ids, an authorizing path for the write, rotation fields)
|
|
92
|
+
* and, `withinSyncLimit`, serialize within the sync request limit. The
|
|
93
|
+
* refinement also runs over values whose fields already failed, so it builds
|
|
94
|
+
* that sync only from a well-formed, bounded seed and create.
|
|
95
|
+
*/
|
|
96
|
+
export declare function refineCreateSeedSync(create: unknown, seed: unknown, context: z.RefinementCtx, issue: {
|
|
97
|
+
readonly path: string;
|
|
98
|
+
readonly withinSyncLimit: boolean;
|
|
99
|
+
}): void;
|