@tearleads/client-sdk 0.1.250 → 0.1.251
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/data/documents/shared/events.js +2 -1
- package/data/documents/shared/events.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/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/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/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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { documentSyncRequestRotationRefinement } from "../documentSyncRefinements.js";
|
|
3
3
|
import { organizationProvisioningRequestRuntimeRefinements, organizationProvisioningResponseRuntimeRefinements, } from "../organizationProvisioningRefinements.js";
|
|
4
4
|
import { ChallengeRequestSchema, isChallengeRequest, isRegistrationRequest, isVerifyRequest, RegistrationRequestSchema, VerifyRequestSchema, } from "../request/index.js";
|
|
5
5
|
import { ChallengeErrorResponseSchema, ChallengeResponseSchema, DestroySessionResponseSchema, ErrorResponseSchema, isChallengeResponse, isDestroySessionResponse, isListSessionsResponse, isRegistrationResponse, isUserIdentityResponse, isVerifyResponse, isWebSocketTicketResponse, ListSessionsResponseSchema, RegistrationResponseSchema, registrationCommitCheckpointRefinements, SessionFailureResponseSchema, UserIdentityResponseSchema, VerifyFailureResponseSchema, VerifySuccessResponseSchema, WebSocketTicketResponseSchema, } from "../response/index.js";
|
|
@@ -74,7 +74,7 @@ export const registerOperation = defineJsonOperation({
|
|
|
74
74
|
200: RegistrationResponseSchema,
|
|
75
75
|
},
|
|
76
76
|
runtimeRefinements: [
|
|
77
|
-
|
|
77
|
+
documentSyncRequestRotationRefinement,
|
|
78
78
|
...organizationProvisioningRequestRuntimeRefinements,
|
|
79
79
|
...organizationProvisioningResponseRuntimeRefinements,
|
|
80
80
|
...registrationCommitCheckpointRefinements,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EACL,iDAAiD,EACjD,kDAAkD,GACnD,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,4BAA4B,EAC5B,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,uCAAuC,EACvC,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,oBAAoB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AAChD,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC;IAC7C,SAAS,EAAE,qBAAqB;CACjC,CAAC,CAAC;AACH,MAAM,4BAA4B,GAAG,CAAC,CAAC,YAAY,CAAC;IAClD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,k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mB;KACzB;IACD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAChC,EAAE,EAAE,mBAAmB;IACvB,OAAO,EAAE,8BAA8B;IACvC,WAAW,EACT,iRAAiR;IACnR,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,4BAA4B;IACpC,IAAI,EAAE,8BAA8B;IACpC,SAAS,EAAE;QACT,GAAG,EAAE,0BAA0B;KAChC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,kBAAkB,CAAC;AAC9D,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAChE,MAAM,CAAC,MAAM,8BAA8B,GAAG,qBAAqB,CAAC;AACpE,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,wBAAwB,GAAG,eAAe,CAAC;AACxD,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;AAC1D,MAAM,CAAC,MAAM,yBAAyB,GAAG,wBAAwB,CAAC;AAClE,MAAM,CAAC,MAAM,kCAAkC,GAAG,yBAAyB,CAAC;AAC5E,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,iCAAiC,GAAG,wBAAwB,CAAC;AAC1E,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { documentSyncRequestRuntimeRefinements } from \"../documentSyncRefinements\";\nimport {\n organizationProvisioningRequestRuntimeRefinements,\n organizationProvisioningResponseRuntimeRefinements,\n} from \"../organizationProvisioningRefinements\";\nimport {\n ChallengeRequestSchema,\n isChallengeRequest,\n isRegistrationRequest,\n isVerifyRequest,\n RegistrationRequestSchema,\n VerifyRequestSchema,\n} from \"../request\";\nimport {\n ChallengeErrorResponseSchema,\n ChallengeResponseSchema,\n DestroySessionResponseSchema,\n ErrorResponseSchema,\n isChallengeResponse,\n isDestroySessionResponse,\n isListSessionsResponse,\n isRegistrationResponse,\n isUserIdentityResponse,\n isVerifyResponse,\n isWebSocketTicketResponse,\n ListSessionsResponseSchema,\n RegistrationResponseSchema,\n registrationCommitCheckpointRefinements,\n SessionFailureResponseSchema,\n UserIdentityResponseSchema,\n VerifyFailureResponseSchema,\n VerifySuccessResponseSchema,\n WebSocketTicketResponseSchema,\n} from \"../response\";\nimport { sha256HexStringSchema } from \"../schema\";\nimport { defineJsonOperation } from \"./definition\";\n\nconst AuthPathParamsSchema = z.strictObject({});\nconst SessionPathParamsSchema = z.strictObject({\n sessionId: sha256HexStringSchema,\n});\nconst UserIdentityPathParamsSchema = z.strictObject({\n userId: z.string(),\n});\n\nexport const challengeOperation = defineJsonOperation({\n auth: \"none\",\n body: ChallengeRequestSchema,\n failureResponses: {\n 400: ChallengeErrorResponseSchema,\n 404: ChallengeErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 404, 500],\n id: \"auth.challenge\",\n summary: \"Request an auth challenge\",\n description:\n \"Starts sign-in for a registered identity: the server stores a short-lived random challenge for the signing key fingerprint, and the client signs it and sends the signature to `POST /auth/verify`. No session is needed; an unknown fingerprint returns 404.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/challenge\",\n responses: {\n 200: ChallengeResponseSchema,\n },\n});\n\nexport const verifyOperation = defineJsonOperation({\n auth: \"none\",\n body: VerifyRequestSchema,\n failureResponses: {\n 400: ChallengeErrorResponseSchema,\n 401: VerifyFailureResponseSchema,\n 403: VerifyFailureResponseSchema,\n 404: VerifyFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 500],\n id: \"auth.verify\",\n summary: \"Verify an auth challenge\",\n description:\n \"Completes sign-in by checking the challenge signature, bound to the API origin, against the identity's registered signing key, then opens a session and returns its bearer token plus the first WebSocket ticket. Each challenge can be used once. A suspended identity's valid signature is refused with 403 and code `account_suspended`, which clients treat as terminal.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/verify\",\n responses: {\n 200: VerifySuccessResponseSchema,\n },\n});\n\nexport const registerOperation = defineJsonOperation({\n auth: \"none\",\n body: RegistrationRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n 503: ErrorResponseSchema,\n },\n failureStatuses: [400, 403, 404, 409, 500, 503],\n id: \"auth.register\",\n summary: \"Register an identity and bootstrap its root state\",\n description:\n \"Creates a new identity from its signing and encapsulation public keys and, in one transaction, provisions its personal organization: the reserved `Admins` and `Members` groups, the root container, and their signed policies and metadata documents. The response carries a fresh login challenge, so the client signs in next with `POST /auth/verify`. A signing key that is already registered returns 409.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/register\",\n responses: {\n 200: RegistrationResponseSchema,\n },\n runtimeRefinements: [\n ...documentSyncRequestRuntimeRefinements,\n ...organizationProvisioningRequestRuntimeRefinements,\n ...organizationProvisioningResponseRuntimeRefinements,\n ...registrationCommitCheckpointRefinements,\n ],\n});\n\nexport const logoutOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 500],\n id: \"auth.logout\",\n summary: \"Destroy the current session\",\n description:\n \"Ends the session that made the request, so its bearer token stops working. Any signed-in user may call it.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/logout\",\n responses: {\n 200: DestroySessionResponseSchema,\n },\n});\n\nexport const webSocketTicketOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 500],\n id: \"auth.webSocketTicket\",\n summary: \"Mint a one-time WebSocket ticket\",\n description:\n \"Issues a single-use, short-lived ticket that authenticates one WebSocket upgrade to the realtime hint gateway, because browsers cannot attach an `Authorization` header to a WebSocket handshake. Clients call it before each reconnect; sign-in already returns the first ticket.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/ws-ticket\",\n responses: {\n 200: WebSocketTicketResponseSchema,\n },\n});\n\nexport const listSessionsOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 500],\n id: \"auth.sessions.list\",\n summary: \"List auth sessions\",\n description:\n \"Lists the signed-in user's live sessions with their creation time, last activity, IP addresses, and signing key fingerprint, flagging the one that made the request. It only ever returns the caller's own sessions.\",\n method: \"GET\",\n params: AuthPathParamsSchema,\n path: \"/auth/sessions\",\n responses: {\n 200: ListSessionsResponseSchema,\n },\n});\n\nexport const destroySessionOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 404, 500],\n id: \"auth.sessions.destroy\",\n summary: \"Destroy a user session\",\n description:\n \"Signs out one of the caller's own sessions, for example a lost device. A session id that is unknown or belongs to another user returns 404.\",\n method: \"DELETE\",\n params: SessionPathParamsSchema,\n path: \"/auth/sessions/{sessionId}\",\n responses: {\n 200: DestroySessionResponseSchema,\n },\n});\n\nexport const userIdentityOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 404, 500],\n id: \"auth.userIdentity\",\n summary: \"Get a complete user identity\",\n description:\n \"Returns a user's registered signing and encapsulation public keys and fingerprints. Clients never trust the answer alone: they compare it with an identity link or an existing identity pin before using the keys. Any signed-in user may call it; an unknown user returns 404.\",\n method: \"GET\",\n params: UserIdentityPathParamsSchema,\n path: \"/auth/user-identity/{userId}\",\n responses: {\n 200: UserIdentityResponseSchema,\n },\n});\n\nexport const isChallengeOperationRequest = isChallengeRequest;\nexport const isChallengeOperationResponse = isChallengeResponse;\nexport const isRegistrationOperationRequest = isRegistrationRequest;\nexport const isRegistrationOperationResponse = isRegistrationResponse;\nexport const isVerifyOperationRequest = isVerifyRequest;\nexport const isVerifyOperationResponse = isVerifyResponse;\nexport const isLogoutOperationResponse = isDestroySessionResponse;\nexport const isWebSocketTicketOperationResponse = isWebSocketTicketResponse;\nexport const isListSessionsOperationResponse = isListSessionsResponse;\nexport const isDestroySessionOperationResponse = isDestroySessionResponse;\nexport const isUserIdentityOperationResponse = isUserIdentityResponse;\n"]}
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EACL,iDAAiD,EACjD,kDAAkD,GACnD,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,4BAA4B,EAC5B,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,uCAAuC,EACvC,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,oBAAoB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AAChD,MAAM,uBAAuB,GA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BAA4B;KAClC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;IACvD,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE;QAChB,GAAG,EAAE,4BAA4B;QACjC,GAAG,EAAE,mBAAmB;QACxB,GAAG,EAAE,mBAAmB;KACzB;IACD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAChC,EAAE,EAAE,mBAAmB;IACvB,OAAO,EAAE,8BAA8B;IACvC,WAAW,EACT,iRAAiR;IACnR,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,4BAA4B;IACpC,IAAI,EAAE,8BAA8B;IACpC,SAAS,EAAE;QACT,GAAG,EAAE,0BAA0B;KAChC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,kBAAkB,CAAC;AAC9D,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAChE,MAAM,CAAC,MAAM,8BAA8B,GAAG,qBAAqB,CAAC;AACpE,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,wBAAwB,GAAG,eAAe,CAAC;AACxD,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;AAC1D,MAAM,CAAC,MAAM,yBAAyB,GAAG,wBAAwB,CAAC;AAClE,MAAM,CAAC,MAAM,kCAAkC,GAAG,yBAAyB,CAAC;AAC5E,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,iCAAiC,GAAG,wBAAwB,CAAC;AAC1E,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { documentSyncRequestRotationRefinement } from \"../documentSyncRefinements\";\nimport {\n organizationProvisioningRequestRuntimeRefinements,\n organizationProvisioningResponseRuntimeRefinements,\n} from \"../organizationProvisioningRefinements\";\nimport {\n ChallengeRequestSchema,\n isChallengeRequest,\n isRegistrationRequest,\n isVerifyRequest,\n RegistrationRequestSchema,\n VerifyRequestSchema,\n} from \"../request\";\nimport {\n ChallengeErrorResponseSchema,\n ChallengeResponseSchema,\n DestroySessionResponseSchema,\n ErrorResponseSchema,\n isChallengeResponse,\n isDestroySessionResponse,\n isListSessionsResponse,\n isRegistrationResponse,\n isUserIdentityResponse,\n isVerifyResponse,\n isWebSocketTicketResponse,\n ListSessionsResponseSchema,\n RegistrationResponseSchema,\n registrationCommitCheckpointRefinements,\n SessionFailureResponseSchema,\n UserIdentityResponseSchema,\n VerifyFailureResponseSchema,\n VerifySuccessResponseSchema,\n WebSocketTicketResponseSchema,\n} from \"../response\";\nimport { sha256HexStringSchema } from \"../schema\";\nimport { defineJsonOperation } from \"./definition\";\n\nconst AuthPathParamsSchema = z.strictObject({});\nconst SessionPathParamsSchema = z.strictObject({\n sessionId: sha256HexStringSchema,\n});\nconst UserIdentityPathParamsSchema = z.strictObject({\n userId: z.string(),\n});\n\nexport const challengeOperation = defineJsonOperation({\n auth: \"none\",\n body: ChallengeRequestSchema,\n failureResponses: {\n 400: ChallengeErrorResponseSchema,\n 404: ChallengeErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 404, 500],\n id: \"auth.challenge\",\n summary: \"Request an auth challenge\",\n description:\n \"Starts sign-in for a registered identity: the server stores a short-lived random challenge for the signing key fingerprint, and the client signs it and sends the signature to `POST /auth/verify`. No session is needed; an unknown fingerprint returns 404.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/challenge\",\n responses: {\n 200: ChallengeResponseSchema,\n },\n});\n\nexport const verifyOperation = defineJsonOperation({\n auth: \"none\",\n body: VerifyRequestSchema,\n failureResponses: {\n 400: ChallengeErrorResponseSchema,\n 401: VerifyFailureResponseSchema,\n 403: VerifyFailureResponseSchema,\n 404: VerifyFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 500],\n id: \"auth.verify\",\n summary: \"Verify an auth challenge\",\n description:\n \"Completes sign-in by checking the challenge signature, bound to the API origin, against the identity's registered signing key, then opens a session and returns its bearer token plus the first WebSocket ticket. Each challenge can be used once. A suspended identity's valid signature is refused with 403 and code `account_suspended`, which clients treat as terminal.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/verify\",\n responses: {\n 200: VerifySuccessResponseSchema,\n },\n});\n\nexport const registerOperation = defineJsonOperation({\n auth: \"none\",\n body: RegistrationRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n 503: ErrorResponseSchema,\n },\n failureStatuses: [400, 403, 404, 409, 500, 503],\n id: \"auth.register\",\n summary: \"Register an identity and bootstrap its root state\",\n description:\n \"Creates a new identity from its signing and encapsulation public keys and, in one transaction, provisions its personal organization: the reserved `Admins` and `Members` groups, the root container, and their signed policies and metadata documents. The response carries a fresh login challenge, so the client signs in next with `POST /auth/verify`. A signing key that is already registered returns 409.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/register\",\n responses: {\n 200: RegistrationResponseSchema,\n },\n runtimeRefinements: [\n documentSyncRequestRotationRefinement,\n ...organizationProvisioningRequestRuntimeRefinements,\n ...organizationProvisioningResponseRuntimeRefinements,\n ...registrationCommitCheckpointRefinements,\n ],\n});\n\nexport const logoutOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 500],\n id: \"auth.logout\",\n summary: \"Destroy the current session\",\n description:\n \"Ends the session that made the request, so its bearer token stops working. Any signed-in user may call it.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/logout\",\n responses: {\n 200: DestroySessionResponseSchema,\n },\n});\n\nexport const webSocketTicketOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 500],\n id: \"auth.webSocketTicket\",\n summary: \"Mint a one-time WebSocket ticket\",\n description:\n \"Issues a single-use, short-lived ticket that authenticates one WebSocket upgrade to the realtime hint gateway, because browsers cannot attach an `Authorization` header to a WebSocket handshake. Clients call it before each reconnect; sign-in already returns the first ticket.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/ws-ticket\",\n responses: {\n 200: WebSocketTicketResponseSchema,\n },\n});\n\nexport const listSessionsOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 500],\n id: \"auth.sessions.list\",\n summary: \"List auth sessions\",\n description:\n \"Lists the signed-in user's live sessions with their creation time, last activity, IP addresses, and signing key fingerprint, flagging the one that made the request. It only ever returns the caller's own sessions.\",\n method: \"GET\",\n params: AuthPathParamsSchema,\n path: \"/auth/sessions\",\n responses: {\n 200: ListSessionsResponseSchema,\n },\n});\n\nexport const destroySessionOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 404, 500],\n id: \"auth.sessions.destroy\",\n summary: \"Destroy a user session\",\n description:\n \"Signs out one of the caller's own sessions, for example a lost device. A session id that is unknown or belongs to another user returns 404.\",\n method: \"DELETE\",\n params: SessionPathParamsSchema,\n path: \"/auth/sessions/{sessionId}\",\n responses: {\n 200: DestroySessionResponseSchema,\n },\n});\n\nexport const userIdentityOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 404, 500],\n id: \"auth.userIdentity\",\n summary: \"Get a complete user identity\",\n description:\n \"Returns a user's registered signing and encapsulation public keys and fingerprints. Clients never trust the answer alone: they compare it with an identity link or an existing identity pin before using the keys. Any signed-in user may call it; an unknown user returns 404.\",\n method: \"GET\",\n params: UserIdentityPathParamsSchema,\n path: \"/auth/user-identity/{userId}\",\n responses: {\n 200: UserIdentityResponseSchema,\n },\n});\n\nexport const isChallengeOperationRequest = isChallengeRequest;\nexport const isChallengeOperationResponse = isChallengeResponse;\nexport const isRegistrationOperationRequest = isRegistrationRequest;\nexport const isRegistrationOperationResponse = isRegistrationResponse;\nexport const isVerifyOperationRequest = isVerifyRequest;\nexport const isVerifyOperationResponse = isVerifyResponse;\nexport const isLogoutOperationResponse = isDestroySessionResponse;\nexport const isWebSocketTicketOperationResponse = isWebSocketTicketResponse;\nexport const isListSessionsOperationResponse = isListSessionsResponse;\nexport const isDestroySessionOperationResponse = isDestroySessionResponse;\nexport const isUserIdentityOperationResponse = isUserIdentityResponse;\n"]}
|
|
@@ -566,7 +566,6 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
566
566
|
};
|
|
567
567
|
event: Record<string, unknown>;
|
|
568
568
|
expectedManifestHash: string;
|
|
569
|
-
manifest: Record<string, unknown>;
|
|
570
569
|
authorizingContainerPathRefs?: {
|
|
571
570
|
containerId: string;
|
|
572
571
|
manifestHash: string;
|
|
@@ -618,10 +617,6 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
618
617
|
}[] | undefined;
|
|
619
618
|
};
|
|
620
619
|
initialMetadataSync?: {
|
|
621
|
-
contentKeyEpoch: number;
|
|
622
|
-
expectedLinkSetManifestHash: string;
|
|
623
|
-
expectedTargetHash: string;
|
|
624
|
-
localVersionVector: string | null;
|
|
625
620
|
outgoingUpdates: {
|
|
626
621
|
encryptedData: string;
|
|
627
622
|
id: string;
|
|
@@ -633,69 +628,6 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
633
628
|
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
634
629
|
sourceVersionVector?: string | undefined;
|
|
635
630
|
}[];
|
|
636
|
-
supportsPullPagination: true;
|
|
637
|
-
authorizingContainerPathRefs?: {
|
|
638
|
-
containerId: string;
|
|
639
|
-
manifestHash: string;
|
|
640
|
-
}[][] | undefined;
|
|
641
|
-
containerRekeys?: {
|
|
642
|
-
body: unknown;
|
|
643
|
-
event: Record<string, unknown>;
|
|
644
|
-
expectedManifestHash: string;
|
|
645
|
-
keyEpoch: Record<string, unknown>;
|
|
646
|
-
keyring: Record<string, unknown> | null;
|
|
647
|
-
predecessorBridge: Record<string, unknown> | null;
|
|
648
|
-
principalPolicyRefs: {
|
|
649
|
-
principalType: "group" | "organization";
|
|
650
|
-
principalId: string;
|
|
651
|
-
version: number;
|
|
652
|
-
stateHash: string;
|
|
653
|
-
}[];
|
|
654
|
-
wraps: Record<string, unknown>[];
|
|
655
|
-
containerManifestHistoryRefs?: {
|
|
656
|
-
containerId: string;
|
|
657
|
-
manifestHash: string;
|
|
658
|
-
}[] | undefined;
|
|
659
|
-
destinationParentContainerPathRefs?: {
|
|
660
|
-
containerId: string;
|
|
661
|
-
manifestHash: string;
|
|
662
|
-
}[] | undefined;
|
|
663
|
-
parentContainerPathRefs?: {
|
|
664
|
-
containerId: string;
|
|
665
|
-
manifestHash: string;
|
|
666
|
-
}[] | undefined;
|
|
667
|
-
parentKekRef?: {
|
|
668
|
-
containerId: string;
|
|
669
|
-
containerKeyEpochId: string;
|
|
670
|
-
keyEpochHash: string;
|
|
671
|
-
} | null | undefined;
|
|
672
|
-
previousContainerPathRefs?: {
|
|
673
|
-
containerId: string;
|
|
674
|
-
manifestHash: string;
|
|
675
|
-
}[] | undefined;
|
|
676
|
-
previousManifestRef?: {
|
|
677
|
-
containerId: string;
|
|
678
|
-
manifestHash: string;
|
|
679
|
-
} | null | undefined;
|
|
680
|
-
userRecipientKeys?: Record<string, unknown>[] | undefined;
|
|
681
|
-
}[] | undefined;
|
|
682
|
-
contentKeyBundle?: {
|
|
683
|
-
contentKeyEpoch: number;
|
|
684
|
-
linkSetManifestHash: string;
|
|
685
|
-
targetHash: string;
|
|
686
|
-
targets: {
|
|
687
|
-
containerId: string;
|
|
688
|
-
containerKeyEpoch: number;
|
|
689
|
-
containerKeyEpochId: string;
|
|
690
|
-
containerManifestHash: string;
|
|
691
|
-
wrappedKey: string;
|
|
692
|
-
wrappingMetadata: Record<string, unknown>;
|
|
693
|
-
}[];
|
|
694
|
-
} | undefined;
|
|
695
|
-
historyMode?: "raw" | undefined;
|
|
696
|
-
inlineRekeyCommitId?: string | undefined;
|
|
697
|
-
minLsn?: string | undefined;
|
|
698
|
-
pullCursor?: string | undefined;
|
|
699
631
|
} | undefined;
|
|
700
632
|
systemSlot?: string | null | undefined;
|
|
701
633
|
}, {
|
|
@@ -757,7 +689,6 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
757
689
|
};
|
|
758
690
|
event: Record<string, unknown>;
|
|
759
691
|
expectedManifestHash: string;
|
|
760
|
-
manifest: Record<string, unknown>;
|
|
761
692
|
authorizingContainerPathRefs?: {
|
|
762
693
|
containerId: string;
|
|
763
694
|
manifestHash: string;
|
|
@@ -809,10 +740,6 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
809
740
|
}[] | undefined;
|
|
810
741
|
};
|
|
811
742
|
initialMetadataSync?: {
|
|
812
|
-
contentKeyEpoch: number;
|
|
813
|
-
expectedLinkSetManifestHash: string;
|
|
814
|
-
expectedTargetHash: string;
|
|
815
|
-
localVersionVector: string | null;
|
|
816
743
|
outgoingUpdates: {
|
|
817
744
|
encryptedData: string;
|
|
818
745
|
id: string;
|
|
@@ -824,69 +751,6 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
824
751
|
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
825
752
|
sourceVersionVector?: string | undefined;
|
|
826
753
|
}[];
|
|
827
|
-
supportsPullPagination: true;
|
|
828
|
-
authorizingContainerPathRefs?: {
|
|
829
|
-
containerId: string;
|
|
830
|
-
manifestHash: string;
|
|
831
|
-
}[][] | undefined;
|
|
832
|
-
containerRekeys?: {
|
|
833
|
-
body: unknown;
|
|
834
|
-
event: Record<string, unknown>;
|
|
835
|
-
expectedManifestHash: string;
|
|
836
|
-
keyEpoch: Record<string, unknown>;
|
|
837
|
-
keyring: Record<string, unknown> | null;
|
|
838
|
-
predecessorBridge: Record<string, unknown> | null;
|
|
839
|
-
principalPolicyRefs: {
|
|
840
|
-
principalType: "group" | "organization";
|
|
841
|
-
principalId: string;
|
|
842
|
-
version: number;
|
|
843
|
-
stateHash: string;
|
|
844
|
-
}[];
|
|
845
|
-
wraps: Record<string, unknown>[];
|
|
846
|
-
containerManifestHistoryRefs?: {
|
|
847
|
-
containerId: string;
|
|
848
|
-
manifestHash: string;
|
|
849
|
-
}[] | undefined;
|
|
850
|
-
destinationParentContainerPathRefs?: {
|
|
851
|
-
containerId: string;
|
|
852
|
-
manifestHash: string;
|
|
853
|
-
}[] | undefined;
|
|
854
|
-
parentContainerPathRefs?: {
|
|
855
|
-
containerId: string;
|
|
856
|
-
manifestHash: string;
|
|
857
|
-
}[] | undefined;
|
|
858
|
-
parentKekRef?: {
|
|
859
|
-
containerId: string;
|
|
860
|
-
containerKeyEpochId: string;
|
|
861
|
-
keyEpochHash: string;
|
|
862
|
-
} | null | undefined;
|
|
863
|
-
previousContainerPathRefs?: {
|
|
864
|
-
containerId: string;
|
|
865
|
-
manifestHash: string;
|
|
866
|
-
}[] | undefined;
|
|
867
|
-
previousManifestRef?: {
|
|
868
|
-
containerId: string;
|
|
869
|
-
manifestHash: string;
|
|
870
|
-
} | null | undefined;
|
|
871
|
-
userRecipientKeys?: Record<string, unknown>[] | undefined;
|
|
872
|
-
}[] | undefined;
|
|
873
|
-
contentKeyBundle?: {
|
|
874
|
-
contentKeyEpoch: number;
|
|
875
|
-
linkSetManifestHash: string;
|
|
876
|
-
targetHash: string;
|
|
877
|
-
targets: {
|
|
878
|
-
containerId: string;
|
|
879
|
-
containerKeyEpoch: number;
|
|
880
|
-
containerKeyEpochId: string;
|
|
881
|
-
containerManifestHash: string;
|
|
882
|
-
wrappedKey: string;
|
|
883
|
-
wrappingMetadata: Record<string, unknown>;
|
|
884
|
-
}[];
|
|
885
|
-
} | undefined;
|
|
886
|
-
historyMode?: "raw" | undefined;
|
|
887
|
-
inlineRekeyCommitId?: string | undefined;
|
|
888
|
-
minLsn?: string | undefined;
|
|
889
|
-
pullCursor?: string | undefined;
|
|
890
754
|
} | undefined;
|
|
891
755
|
systemSlot?: string | null | undefined;
|
|
892
756
|
}, z.core.$ZodTypeInternals<{
|
|
@@ -948,7 +812,6 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
948
812
|
};
|
|
949
813
|
event: Record<string, unknown>;
|
|
950
814
|
expectedManifestHash: string;
|
|
951
|
-
manifest: Record<string, unknown>;
|
|
952
815
|
authorizingContainerPathRefs?: {
|
|
953
816
|
containerId: string;
|
|
954
817
|
manifestHash: string;
|
|
@@ -1000,10 +863,6 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
1000
863
|
}[] | undefined;
|
|
1001
864
|
};
|
|
1002
865
|
initialMetadataSync?: {
|
|
1003
|
-
contentKeyEpoch: number;
|
|
1004
|
-
expectedLinkSetManifestHash: string;
|
|
1005
|
-
expectedTargetHash: string;
|
|
1006
|
-
localVersionVector: string | null;
|
|
1007
866
|
outgoingUpdates: {
|
|
1008
867
|
encryptedData: string;
|
|
1009
868
|
id: string;
|
|
@@ -1015,69 +874,6 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
1015
874
|
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
1016
875
|
sourceVersionVector?: string | undefined;
|
|
1017
876
|
}[];
|
|
1018
|
-
supportsPullPagination: true;
|
|
1019
|
-
authorizingContainerPathRefs?: {
|
|
1020
|
-
containerId: string;
|
|
1021
|
-
manifestHash: string;
|
|
1022
|
-
}[][] | undefined;
|
|
1023
|
-
containerRekeys?: {
|
|
1024
|
-
body: unknown;
|
|
1025
|
-
event: Record<string, unknown>;
|
|
1026
|
-
expectedManifestHash: string;
|
|
1027
|
-
keyEpoch: Record<string, unknown>;
|
|
1028
|
-
keyring: Record<string, unknown> | null;
|
|
1029
|
-
predecessorBridge: Record<string, unknown> | null;
|
|
1030
|
-
principalPolicyRefs: {
|
|
1031
|
-
principalType: "group" | "organization";
|
|
1032
|
-
principalId: string;
|
|
1033
|
-
version: number;
|
|
1034
|
-
stateHash: string;
|
|
1035
|
-
}[];
|
|
1036
|
-
wraps: Record<string, unknown>[];
|
|
1037
|
-
containerManifestHistoryRefs?: {
|
|
1038
|
-
containerId: string;
|
|
1039
|
-
manifestHash: string;
|
|
1040
|
-
}[] | undefined;
|
|
1041
|
-
destinationParentContainerPathRefs?: {
|
|
1042
|
-
containerId: string;
|
|
1043
|
-
manifestHash: string;
|
|
1044
|
-
}[] | undefined;
|
|
1045
|
-
parentContainerPathRefs?: {
|
|
1046
|
-
containerId: string;
|
|
1047
|
-
manifestHash: string;
|
|
1048
|
-
}[] | undefined;
|
|
1049
|
-
parentKekRef?: {
|
|
1050
|
-
containerId: string;
|
|
1051
|
-
containerKeyEpochId: string;
|
|
1052
|
-
keyEpochHash: string;
|
|
1053
|
-
} | null | undefined;
|
|
1054
|
-
previousContainerPathRefs?: {
|
|
1055
|
-
containerId: string;
|
|
1056
|
-
manifestHash: string;
|
|
1057
|
-
}[] | undefined;
|
|
1058
|
-
previousManifestRef?: {
|
|
1059
|
-
containerId: string;
|
|
1060
|
-
manifestHash: string;
|
|
1061
|
-
} | null | undefined;
|
|
1062
|
-
userRecipientKeys?: Record<string, unknown>[] | undefined;
|
|
1063
|
-
}[] | undefined;
|
|
1064
|
-
contentKeyBundle?: {
|
|
1065
|
-
contentKeyEpoch: number;
|
|
1066
|
-
linkSetManifestHash: string;
|
|
1067
|
-
targetHash: string;
|
|
1068
|
-
targets: {
|
|
1069
|
-
containerId: string;
|
|
1070
|
-
containerKeyEpoch: number;
|
|
1071
|
-
containerKeyEpochId: string;
|
|
1072
|
-
containerManifestHash: string;
|
|
1073
|
-
wrappedKey: string;
|
|
1074
|
-
wrappingMetadata: Record<string, unknown>;
|
|
1075
|
-
}[];
|
|
1076
|
-
} | undefined;
|
|
1077
|
-
historyMode?: "raw" | undefined;
|
|
1078
|
-
inlineRekeyCommitId?: string | undefined;
|
|
1079
|
-
minLsn?: string | undefined;
|
|
1080
|
-
pullCursor?: string | undefined;
|
|
1081
877
|
} | undefined;
|
|
1082
878
|
systemSlot?: string | null | undefined;
|
|
1083
879
|
}, {
|
|
@@ -1139,7 +935,6 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
1139
935
|
};
|
|
1140
936
|
event: Record<string, unknown>;
|
|
1141
937
|
expectedManifestHash: string;
|
|
1142
|
-
manifest: Record<string, unknown>;
|
|
1143
938
|
authorizingContainerPathRefs?: {
|
|
1144
939
|
containerId: string;
|
|
1145
940
|
manifestHash: string;
|
|
@@ -1191,10 +986,6 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
1191
986
|
}[] | undefined;
|
|
1192
987
|
};
|
|
1193
988
|
initialMetadataSync?: {
|
|
1194
|
-
contentKeyEpoch: number;
|
|
1195
|
-
expectedLinkSetManifestHash: string;
|
|
1196
|
-
expectedTargetHash: string;
|
|
1197
|
-
localVersionVector: string | null;
|
|
1198
989
|
outgoingUpdates: {
|
|
1199
990
|
encryptedData: string;
|
|
1200
991
|
id: string;
|
|
@@ -1206,69 +997,6 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
1206
997
|
checkpointPayloadKind?: "full_history_snapshot" | undefined;
|
|
1207
998
|
sourceVersionVector?: string | undefined;
|
|
1208
999
|
}[];
|
|
1209
|
-
supportsPullPagination: true;
|
|
1210
|
-
authorizingContainerPathRefs?: {
|
|
1211
|
-
containerId: string;
|
|
1212
|
-
manifestHash: string;
|
|
1213
|
-
}[][] | undefined;
|
|
1214
|
-
containerRekeys?: {
|
|
1215
|
-
body: unknown;
|
|
1216
|
-
event: Record<string, unknown>;
|
|
1217
|
-
expectedManifestHash: string;
|
|
1218
|
-
keyEpoch: Record<string, unknown>;
|
|
1219
|
-
keyring: Record<string, unknown> | null;
|
|
1220
|
-
predecessorBridge: Record<string, unknown> | null;
|
|
1221
|
-
principalPolicyRefs: {
|
|
1222
|
-
principalType: "group" | "organization";
|
|
1223
|
-
principalId: string;
|
|
1224
|
-
version: number;
|
|
1225
|
-
stateHash: string;
|
|
1226
|
-
}[];
|
|
1227
|
-
wraps: Record<string, unknown>[];
|
|
1228
|
-
containerManifestHistoryRefs?: {
|
|
1229
|
-
containerId: string;
|
|
1230
|
-
manifestHash: string;
|
|
1231
|
-
}[] | undefined;
|
|
1232
|
-
destinationParentContainerPathRefs?: {
|
|
1233
|
-
containerId: string;
|
|
1234
|
-
manifestHash: string;
|
|
1235
|
-
}[] | undefined;
|
|
1236
|
-
parentContainerPathRefs?: {
|
|
1237
|
-
containerId: string;
|
|
1238
|
-
manifestHash: string;
|
|
1239
|
-
}[] | undefined;
|
|
1240
|
-
parentKekRef?: {
|
|
1241
|
-
containerId: string;
|
|
1242
|
-
containerKeyEpochId: string;
|
|
1243
|
-
keyEpochHash: string;
|
|
1244
|
-
} | null | undefined;
|
|
1245
|
-
previousContainerPathRefs?: {
|
|
1246
|
-
containerId: string;
|
|
1247
|
-
manifestHash: string;
|
|
1248
|
-
}[] | undefined;
|
|
1249
|
-
previousManifestRef?: {
|
|
1250
|
-
containerId: string;
|
|
1251
|
-
manifestHash: string;
|
|
1252
|
-
} | null | undefined;
|
|
1253
|
-
userRecipientKeys?: Record<string, unknown>[] | undefined;
|
|
1254
|
-
}[] | undefined;
|
|
1255
|
-
contentKeyBundle?: {
|
|
1256
|
-
contentKeyEpoch: number;
|
|
1257
|
-
linkSetManifestHash: string;
|
|
1258
|
-
targetHash: string;
|
|
1259
|
-
targets: {
|
|
1260
|
-
containerId: string;
|
|
1261
|
-
containerKeyEpoch: number;
|
|
1262
|
-
containerKeyEpochId: string;
|
|
1263
|
-
containerManifestHash: string;
|
|
1264
|
-
wrappedKey: string;
|
|
1265
|
-
wrappingMetadata: Record<string, unknown>;
|
|
1266
|
-
}[];
|
|
1267
|
-
} | undefined;
|
|
1268
|
-
historyMode?: "raw" | undefined;
|
|
1269
|
-
inlineRekeyCommitId?: string | undefined;
|
|
1270
|
-
minLsn?: string | undefined;
|
|
1271
|
-
pullCursor?: string | undefined;
|
|
1272
1000
|
} | undefined;
|
|
1273
1001
|
systemSlot?: string | null | undefined;
|
|
1274
1002
|
}>>;
|
|
@@ -1560,29 +1288,8 @@ export declare const createContainerWithMetadataDocumentOperation: Omit<{
|
|
|
1560
1288
|
readonly description: "a container response keyring is null exactly for container key epoch 1";
|
|
1561
1289
|
readonly id: "response.organization-provisioning-container-keyring";
|
|
1562
1290
|
}, {
|
|
1563
|
-
readonly description: "a container create metadata seed must contain exactly one outgoing update and no container rekeys, and
|
|
1291
|
+
readonly description: "a container create metadata seed must contain exactly one outgoing update and no container rekeys, and with the metadata document's content-key bundle and target path form a valid document sync that serializes within the document sync request limit";
|
|
1564
1292
|
readonly id: "request.container-create-metadata-seed";
|
|
1565
|
-
}, {
|
|
1566
|
-
readonly description: "inlineRekeyCommitId must be present exactly when containerRekeys is non-empty";
|
|
1567
|
-
readonly id: "request.inline-rekey-commit-marker";
|
|
1568
|
-
}, {
|
|
1569
|
-
readonly description: "authorizingContainerPathRefs is required when outgoingUpdates is non-empty";
|
|
1570
|
-
readonly id: "request.authorizing-paths-for-writes";
|
|
1571
|
-
}, {
|
|
1572
|
-
readonly description: "containerRekeys may be non-empty only when outgoingUpdates is non-empty";
|
|
1573
|
-
readonly id: "request.container-rekeys-require-write";
|
|
1574
|
-
}, {
|
|
1575
|
-
readonly description: "outgoing update ids must be unique within the request";
|
|
1576
|
-
readonly id: "request.unique-outgoing-update-ids";
|
|
1577
|
-
}, {
|
|
1578
|
-
readonly description: "a request carrying pullCursor must not contain outgoing updates, container rekeys, a content-key bundle, or authorizing paths";
|
|
1579
|
-
readonly id: "request.pull-continuation-read-only";
|
|
1580
|
-
}, {
|
|
1581
|
-
readonly description: "historyMode \"raw\" must not be combined with outgoing updates, container rekeys, a content-key bundle, or authorizing paths";
|
|
1582
|
-
readonly id: "request.raw-history-read-only";
|
|
1583
|
-
}, {
|
|
1584
|
-
readonly description: "historyMode \"raw\" requires localVersionVector to be null so the complete retained history is requested";
|
|
1585
|
-
readonly id: "request.raw-history-null-frontier";
|
|
1586
1293
|
}, {
|
|
1587
1294
|
readonly description: "checkpointKind, checkpointPayloadKind, and sourceVersionVector must be absent together or form a rotation baseline";
|
|
1588
1295
|
readonly id: "request.rotation-checkpoint-fields";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { containerCreateMetadataSeedRefinement } from "../documentCreateSeedRefinements.js";
|
|
3
|
-
import {
|
|
3
|
+
import { documentSyncRequestRotationRefinement } from "../documentSyncRefinements.js";
|
|
4
4
|
import { organizationProvisioningContainerKeyringRefinement } from "../organizationProvisioningRefinements.js";
|
|
5
5
|
import { organizationReadModelResponseRuntimeRefinements } from "../organizationReadModelRefinements.js";
|
|
6
6
|
import { ContainerCreateWithMetadataDocumentRequestSchema, ContainerMutationRequestSchema, ContainerReciteRequestSchema, ContainerRotationRequestSchema, isContainerCreateWithMetadataDocumentRequest, isContainerMutationRequest, isContainerRotationRequest, OrganizationReadModelHeldCursorQuerySchema, } from "../request/index.js";
|
|
@@ -57,7 +57,7 @@ export const createContainerWithMetadataDocumentOperation = defineJsonOperation(
|
|
|
57
57
|
runtimeRefinements: [
|
|
58
58
|
...containerMutationRuntimeRefinements,
|
|
59
59
|
containerCreateMetadataSeedRefinement,
|
|
60
|
-
|
|
60
|
+
documentSyncRequestRotationRefinement,
|
|
61
61
|
],
|
|
62
62
|
});
|
|
63
63
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerMutations.js","sour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CAAC,MAAM,mCAAmC,GAAG,0BAA0B,CAAC;AAC9E,MAAM,CAAC,MAAM,oCAAoC,GAAG,2BAA2B,CAAC;AAChF,MAAM,CAAC,MAAM,qDAAqD,GAChE,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,sDAAsD,GACjE,6CAA6C,CAAC;AAChD,MAAM,CAAC,MAAM,kCAAkC,GAAG,yBAAyB,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { containerCreateMetadataSeedRefinement } from \"../documentCreateSeedRefinements\";\nimport { documentSyncRequestRuntimeRefinements } from \"../documentSyncRefinements\";\nimport { organizationProvisioningContainerKeyringRefinement } from \"../organizationProvisioningRefinements\";\nimport { organizationReadModelResponseRuntimeRefinements } from \"../organizationReadModelRefinements\";\nimport {\n ContainerCreateWithMetadataDocumentRequestSchema,\n ContainerMutationRequestSchema,\n ContainerReciteRequestSchema,\n ContainerRotationRequestSchema,\n isContainerCreateWithMetadataDocumentRequest,\n isContainerMutationRequest,\n isContainerRotationRequest,\n OrganizationReadModelHeldCursorQuerySchema,\n} from \"../request\";\nimport {\n ContainerCreateWithMetadataDocumentResponseSchema,\n ContainerDeleteResponseSchema,\n ContainerMutationFailureResponseSchema,\n ContainerMutationResponseSchema,\n ContainerNotFoundErrorResponseSchema,\n ContainerReciteResponseSchema,\n ContainerRotationResponseSchema,\n ContainerShareResponseSchema,\n ErrorResponseSchema,\n isContainerCreateWithMetadataDocumentResponse,\n isContainerDeleteResponse,\n isContainerMutationResponse,\n isContainerRotationResponse,\n isContainerShareResponse,\n PaymentRequiredErrorResponseSchema,\n SessionFailureResponseSchema,\n} from \"../response\";\nimport { defineJsonOperation } from \"./definition\";\n\nconst EmptyContainerMutationPathParamsSchema = z.strictObject({});\n\nexport const ContainerMutationPathParamsSchema = z.strictObject({\n containerId: z.string(),\n});\n\nexport type ContainerMutationPathParams = z.infer<\n typeof ContainerMutationPathParamsSchema\n>;\n\nconst containerMutationFailureResponses = {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ContainerMutationFailureResponseSchema,\n 500: ErrorResponseSchema,\n} as const;\n\nconst containerMutationFailureStatuses = [\n 400, 401, 402, 403, 404, 409, 500,\n] as const;\n\nconst containerMutationRuntimeRefinements = [\n organizationProvisioningContainerKeyringRefinement,\n] as const;\n\nexport const createContainerOperation = defineJsonOperation({\n auth: \"session\",\n body: ContainerMutationRequestSchema,\n failureResponses: containerMutationFailureResponses,\n failureStatuses: containerMutationFailureStatuses,\n id: \"containers.create\",\n summary: \"Create a container\",\n description:\n \"Creates a container from a signed `container.create` event, the hash of the access manifest it derives, and the container KEK wrapped to its recipients. Requires write access to the parent container, or admin access for a system container. A retry of a create that already committed returns 409 `container_manifest_already_exists`, which lets the client adopt it; a stale parent returns 409 `container_mutation_state_stale`.\",\n method: \"POST\",\n params: EmptyContainerMutationPathParamsSchema,\n path: \"/containers\",\n responses: { 200: ContainerMutationResponseSchema },\n runtimeRefinements: containerMutationRuntimeRefinements,\n});\n\nexport const createContainerWithMetadataDocumentOperation = defineJsonOperation(\n {\n auth: \"session\",\n body: ContainerCreateWithMetadataDocumentRequestSchema,\n failureResponses: {\n ...containerMutationFailureResponses,\n 503: ErrorResponseSchema,\n },\n failureStatuses: [...containerMutationFailureStatuses, 503],\n id: \"containers.withMetadataDocument.create\",\n summary: \"Create a container with its metadata document\",\n description:\n \"Creates a container and its encrypted metadata document in one transaction, optionally seeding the document's first update. Authorization and conflicts are those of `POST /containers` and `POST /documents`; a 409 `document_manifest_already_exists` may have rolled the new container back, so clients treat it as terminal unless they verify both artifacts.\",\n method: \"POST\",\n params: EmptyContainerMutationPathParamsSchema,\n path: \"/containers/with-metadata-document\",\n responses: { 200: ContainerCreateWithMetadataDocumentResponseSchema },\n runtimeRefinements: [\n ...containerMutationRuntimeRefinements,\n containerCreateMetadataSeedRefinement,\n ...documentSyncRequestRuntimeRefinements,\n ],\n },\n);\n\n/**\n * Rekey, revoke, and move mint a new key epoch, so they alone may carry the\n * descendant rekeys that must commit with them.\n */\nfunction defineContainerRotationOperation<\n const Id extends string,\n const Path extends `/${string}`,\n>(input: {\n readonly id: Id;\n readonly path: Path;\n readonly summary: string;\n readonly description: string;\n}) {\n return defineJsonOperation({\n auth: \"session\",\n body: ContainerRotationRequestSchema,\n failureResponses: containerMutationFailureResponses,\n failureStatuses: containerMutationFailureStatuses,\n id: input.id,\n summary: input.summary,\n description: input.description,\n method: \"POST\",\n params: ContainerMutationPathParamsSchema,\n path: input.path,\n responses: { 200: ContainerRotationResponseSchema },\n runtimeRefinements: containerMutationRuntimeRefinements,\n });\n}\n\nexport const shareContainerOperation = defineJsonOperation({\n auth: \"session\",\n body: ContainerMutationRequestSchema,\n failureResponses: containerMutationFailureResponses,\n failureStatuses: containerMutationFailureStatuses,\n id: \"containers.share\",\n summary: \"Share a container\",\n description:\n \"Adds or changes a user or group grant on a container through a signed `container.grant` event, wrapping the current container KEK to the new recipients. Requires admin access through the container's path. Cited heads must be current: a stale container head returns 409 `container_mutation_state_stale`, and a stale principal policy returns 409 `principal_policy_stale` with the current heads. When `readModelCursor` names the read-model head the share's grants stamp advanced from, the response carries the read-model delta a feed read from that cursor returns.\",\n method: \"POST\",\n params: ContainerMutationPathParamsSchema,\n path: \"/containers/{containerId}/share\",\n query: OrganizationReadModelHeldCursorQuerySchema,\n responses: { 200: ContainerShareResponseSchema },\n runtimeRefinements: [\n ...containerMutationRuntimeRefinements,\n ...organizationReadModelResponseRuntimeRefinements,\n ],\n});\n\nexport const reciteContainerOperation = defineJsonOperation({\n auth: \"session\",\n body: ContainerReciteRequestSchema,\n failureResponses: containerMutationFailureResponses,\n failureStatuses: containerMutationFailureStatuses,\n id: \"containers.recite\",\n summary: \"Re-cite a held container's current ancestor path\",\n description:\n \"Advances a container's access manifest so it cites its ancestors' current heads, without changing grants, keys, or parent. Clients call it after changing an ancestor so descendants they already hold stop citing superseded heads. Requires admin access; after 512 epochs the container no longer accepts re-citations.\",\n method: \"POST\",\n params: ContainerMutationPathParamsSchema,\n path: \"/containers/{containerId}/recite\",\n responses: { 200: ContainerReciteResponseSchema },\n});\n\nexport const revokeContainerOperation = defineContainerRotationOperation({\n id: \"containers.revoke\",\n summary: \"Revoke a container grant\",\n description:\n \"Removes a grant from a container through a signed `container.revoke` event and rotates the container KEK so the removed principal cannot read later content. The request carries the new KEK epoch, its predecessor bridge, and the re-sealed container KEK keyring. Requires admin access; stale cited heads return 409.\",\n path: \"/containers/{containerId}/revoke\",\n});\n\nexport const rekeyContainerOperation = defineContainerRotationOperation({\n id: \"containers.rekey\",\n summary: \"Rekey a container\",\n description:\n \"Rotates a container's KEK to a new epoch without changing grants, carrying the predecessor bridge and the re-sealed container KEK keyring. Requires write access. Stale cited heads return 409, and epochs above 65536 are refused.\",\n path: \"/containers/{containerId}/rekey\",\n});\n\nexport const moveContainerOperation = defineContainerRotationOperation({\n id: \"containers.move\",\n summary: \"Move a container\",\n description:\n \"Moves a container under a new parent through a signed `container.move` event and rotates its container KEK. Requires admin access at the source and write access at the destination; root and system containers cannot move. Moving into Trash is an ordinary move and can be undone.\",\n path: \"/containers/{containerId}/move\",\n});\n\nexport const deleteContainerOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n ...containerMutationFailureResponses,\n 404: ContainerNotFoundErrorResponseSchema,\n },\n failureStatuses: containerMutationFailureStatuses,\n id: \"containers.delete\",\n summary: \"Delete a container\",\n description:\n \"Deletes an empty folder: a container with no child containers and no linked user documents, along with its own metadata document. Requires admin access; root and system containers cannot be deleted. Peers learn of the deletion from a sync tombstone, and an unknown container returns 404 `container_not_found`.\",\n method: \"DELETE\",\n params: ContainerMutationPathParamsSchema,\n path: \"/containers/{containerId}\",\n query: z.strictObject({ requiredAncestorId: z.string().min(1).optional() }),\n responses: { 200: ContainerDeleteResponseSchema },\n});\n\nexport const isContainerMutationOperationRequest = isContainerMutationRequest;\nexport const isContainerMutationOperationResponse = isContainerMutationResponse;\nexport const isShareContainerOperationResponse = isContainerShareResponse;\nexport const isContainerRotationOperationRequest = isContainerRotationRequest;\nexport const isContainerRotationOperationResponse = isContainerRotationResponse;\nexport const isCreateContainerWithMetadataDocumentOperationRequest =\n isContainerCreateWithMetadataDocumentRequest;\nexport const isCreateContainerWithMetadataDocumentOperationResponse =\n isContainerCreateWithMetadataDocumentResponse;\nexport const isDeleteContainerOperationResponse = isContainerDeleteResponse;\n"]}
|
|
1
|
+
{"version":3,"file":"containerMutations.js","sourceRoot":"","sources":["containerMutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qCAAqC,EAAE,MAAM,kCAAkC,CAAC;AACzF,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAE,kDAAkD,EAAE,MAAM,wCAAwC,CAAC;AAC5G,OAAO,EAAE,+CAA+C,EAAE,MAAM,qCAAqC,CAAC;AACtG,OAAO,EACL,gDAAgD,EAChD,8BAA8B,EAC9B,4BAA4B,EAC5B,8BAA8B,EAC9B,4CAA4C,EAC5C,0BAA0B,EAC1B,0BAA0B,EAC1B,0CAA0C,GAC3C,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iDAAiD,EACjD,6BAA6B,EAC7B,sCAAsC,EACtC,+BAA+B,EAC/B,oCAAoC,EACpC,6BAA6B,EAC7B,+BAA+B,EAC/B,4BAA4B,EAC5B,mBAAmB,EACnB,6CAA6C,EAC7C,yBAAyB,EACzB,2BAA2B,EAC3B,2BAA2B,EAC3B,wBAAwB,EACxB,kCAAkC,EAClC,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,sCAAsC,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAA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CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC3E,SAAS,EAAE,EAAE,GAAG,EAAE,6BAA6B,EAAE;CAClD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mCAAmC,GAAG,0BAA0B,CAAC;AAC9E,MAAM,CAAC,MAAM,oCAAoC,GAAG,2BAA2B,CAAC;AAChF,MAAM,CAAC,MAAM,iCAAiC,GAAG,wBAAwB,CAAC;AAC1E,MAAM,CAAC,MAAM,mCAAmC,GAAG,0BAA0B,CAAC;AAC9E,MAAM,CAAC,MAAM,oCAAoC,GAAG,2BAA2B,CAAC;AAChF,MAAM,CAAC,MAAM,qDAAqD,GAChE,4CAA4C,CAAC;AAC/C,MAAM,CAAC,MAAM,sDAAsD,GACjE,6CAA6C,CAAC;AAChD,MAAM,CAAC,MAAM,kCAAkC,GAAG,yBAAyB,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { containerCreateMetadataSeedRefinement } from \"../documentCreateSeedRefinements\";\nimport { documentSyncRequestRotationRefinement } from \"../documentSyncRefinements\";\nimport { organizationProvisioningContainerKeyringRefinement } from \"../organizationProvisioningRefinements\";\nimport { organizationReadModelResponseRuntimeRefinements } from \"../organizationReadModelRefinements\";\nimport {\n ContainerCreateWithMetadataDocumentRequestSchema,\n ContainerMutationRequestSchema,\n ContainerReciteRequestSchema,\n ContainerRotationRequestSchema,\n isContainerCreateWithMetadataDocumentRequest,\n isContainerMutationRequest,\n isContainerRotationRequest,\n OrganizationReadModelHeldCursorQuerySchema,\n} from \"../request\";\nimport {\n ContainerCreateWithMetadataDocumentResponseSchema,\n ContainerDeleteResponseSchema,\n ContainerMutationFailureResponseSchema,\n ContainerMutationResponseSchema,\n ContainerNotFoundErrorResponseSchema,\n ContainerReciteResponseSchema,\n ContainerRotationResponseSchema,\n ContainerShareResponseSchema,\n ErrorResponseSchema,\n isContainerCreateWithMetadataDocumentResponse,\n isContainerDeleteResponse,\n isContainerMutationResponse,\n isContainerRotationResponse,\n isContainerShareResponse,\n PaymentRequiredErrorResponseSchema,\n SessionFailureResponseSchema,\n} from \"../response\";\nimport { defineJsonOperation } from \"./definition\";\n\nconst EmptyContainerMutationPathParamsSchema = z.strictObject({});\n\nexport const ContainerMutationPathParamsSchema = z.strictObject({\n containerId: z.string(),\n});\n\nexport type ContainerMutationPathParams = z.infer<\n typeof ContainerMutationPathParamsSchema\n>;\n\nconst containerMutationFailureResponses = {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ContainerMutationFailureResponseSchema,\n 500: ErrorResponseSchema,\n} as const;\n\nconst containerMutationFailureStatuses = [\n 400, 401, 402, 403, 404, 409, 500,\n] as const;\n\nconst containerMutationRuntimeRefinements = [\n organizationProvisioningContainerKeyringRefinement,\n] as const;\n\nexport const createContainerOperation = defineJsonOperation({\n auth: \"session\",\n body: ContainerMutationRequestSchema,\n failureResponses: containerMutationFailureResponses,\n failureStatuses: containerMutationFailureStatuses,\n id: \"containers.create\",\n summary: \"Create a container\",\n description:\n \"Creates a container from a signed `container.create` event, the hash of the access manifest it derives, and the container KEK wrapped to its recipients. Requires write access to the parent container, or admin access for a system container. A retry of a create that already committed returns 409 `container_manifest_already_exists`, which lets the client adopt it; a stale parent returns 409 `container_mutation_state_stale`.\",\n method: \"POST\",\n params: EmptyContainerMutationPathParamsSchema,\n path: \"/containers\",\n responses: { 200: ContainerMutationResponseSchema },\n runtimeRefinements: containerMutationRuntimeRefinements,\n});\n\nexport const createContainerWithMetadataDocumentOperation = defineJsonOperation(\n {\n auth: \"session\",\n body: ContainerCreateWithMetadataDocumentRequestSchema,\n failureResponses: {\n ...containerMutationFailureResponses,\n 503: ErrorResponseSchema,\n },\n failureStatuses: [...containerMutationFailureStatuses, 503],\n id: \"containers.withMetadataDocument.create\",\n summary: \"Create a container with its metadata document\",\n description:\n \"Creates a container and its encrypted metadata document in one transaction, optionally seeding the document's first update. Authorization and conflicts are those of `POST /containers` and `POST /documents`; a 409 `document_manifest_already_exists` may have rolled the new container back, so clients treat it as terminal unless they verify both artifacts.\",\n method: \"POST\",\n params: EmptyContainerMutationPathParamsSchema,\n path: \"/containers/with-metadata-document\",\n responses: { 200: ContainerCreateWithMetadataDocumentResponseSchema },\n runtimeRefinements: [\n ...containerMutationRuntimeRefinements,\n containerCreateMetadataSeedRefinement,\n documentSyncRequestRotationRefinement,\n ],\n },\n);\n\n/**\n * Rekey, revoke, and move mint a new key epoch, so they alone may carry the\n * descendant rekeys that must commit with them.\n */\nfunction defineContainerRotationOperation<\n const Id extends string,\n const Path extends `/${string}`,\n>(input: {\n readonly id: Id;\n readonly path: Path;\n readonly summary: string;\n readonly description: string;\n}) {\n return defineJsonOperation({\n auth: \"session\",\n body: ContainerRotationRequestSchema,\n failureResponses: containerMutationFailureResponses,\n failureStatuses: containerMutationFailureStatuses,\n id: input.id,\n summary: input.summary,\n description: input.description,\n method: \"POST\",\n params: ContainerMutationPathParamsSchema,\n path: input.path,\n responses: { 200: ContainerRotationResponseSchema },\n runtimeRefinements: containerMutationRuntimeRefinements,\n });\n}\n\nexport const shareContainerOperation = defineJsonOperation({\n auth: \"session\",\n body: ContainerMutationRequestSchema,\n failureResponses: containerMutationFailureResponses,\n failureStatuses: containerMutationFailureStatuses,\n id: \"containers.share\",\n summary: \"Share a container\",\n description:\n \"Adds or changes a user or group grant on a container through a signed `container.grant` event, wrapping the current container KEK to the new recipients. Requires admin access through the container's path. Cited heads must be current: a stale container head returns 409 `container_mutation_state_stale`, and a stale principal policy returns 409 `principal_policy_stale` with the current heads. When `readModelCursor` names the read-model head the share's grants stamp advanced from, the response carries the read-model delta a feed read from that cursor returns.\",\n method: \"POST\",\n params: ContainerMutationPathParamsSchema,\n path: \"/containers/{containerId}/share\",\n query: OrganizationReadModelHeldCursorQuerySchema,\n responses: { 200: ContainerShareResponseSchema },\n runtimeRefinements: [\n ...containerMutationRuntimeRefinements,\n ...organizationReadModelResponseRuntimeRefinements,\n ],\n});\n\nexport const reciteContainerOperation = defineJsonOperation({\n auth: \"session\",\n body: ContainerReciteRequestSchema,\n failureResponses: containerMutationFailureResponses,\n failureStatuses: containerMutationFailureStatuses,\n id: \"containers.recite\",\n summary: \"Re-cite a held container's current ancestor path\",\n description:\n \"Advances a container's access manifest so it cites its ancestors' current heads, without changing grants, keys, or parent. Clients call it after changing an ancestor so descendants they already hold stop citing superseded heads. Requires admin access; after 512 epochs the container no longer accepts re-citations.\",\n method: \"POST\",\n params: ContainerMutationPathParamsSchema,\n path: \"/containers/{containerId}/recite\",\n responses: { 200: ContainerReciteResponseSchema },\n});\n\nexport const revokeContainerOperation = defineContainerRotationOperation({\n id: \"containers.revoke\",\n summary: \"Revoke a container grant\",\n description:\n \"Removes a grant from a container through a signed `container.revoke` event and rotates the container KEK so the removed principal cannot read later content. The request carries the new KEK epoch, its predecessor bridge, and the re-sealed container KEK keyring. Requires admin access; stale cited heads return 409.\",\n path: \"/containers/{containerId}/revoke\",\n});\n\nexport const rekeyContainerOperation = defineContainerRotationOperation({\n id: \"containers.rekey\",\n summary: \"Rekey a container\",\n description:\n \"Rotates a container's KEK to a new epoch without changing grants, carrying the predecessor bridge and the re-sealed container KEK keyring. Requires write access. Stale cited heads return 409, and epochs above 65536 are refused.\",\n path: \"/containers/{containerId}/rekey\",\n});\n\nexport const moveContainerOperation = defineContainerRotationOperation({\n id: \"containers.move\",\n summary: \"Move a container\",\n description:\n \"Moves a container under a new parent through a signed `container.move` event and rotates its container KEK. Requires admin access at the source and write access at the destination; root and system containers cannot move. Moving into Trash is an ordinary move and can be undone.\",\n path: \"/containers/{containerId}/move\",\n});\n\nexport const deleteContainerOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n ...containerMutationFailureResponses,\n 404: ContainerNotFoundErrorResponseSchema,\n },\n failureStatuses: containerMutationFailureStatuses,\n id: \"containers.delete\",\n summary: \"Delete a container\",\n description:\n \"Deletes an empty folder: a container with no child containers and no linked user documents, along with its own metadata document. Requires admin access; root and system containers cannot be deleted. Peers learn of the deletion from a sync tombstone, and an unknown container returns 404 `container_not_found`.\",\n method: \"DELETE\",\n params: ContainerMutationPathParamsSchema,\n path: \"/containers/{containerId}\",\n query: z.strictObject({ requiredAncestorId: z.string().min(1).optional() }),\n responses: { 200: ContainerDeleteResponseSchema },\n});\n\nexport const isContainerMutationOperationRequest = isContainerMutationRequest;\nexport const isContainerMutationOperationResponse = isContainerMutationResponse;\nexport const isShareContainerOperationResponse = isContainerShareResponse;\nexport const isContainerRotationOperationRequest = isContainerRotationRequest;\nexport const isContainerRotationOperationResponse = isContainerRotationResponse;\nexport const isCreateContainerWithMetadataDocumentOperationRequest =\n isContainerCreateWithMetadataDocumentRequest;\nexport const isCreateContainerWithMetadataDocumentOperationResponse =\n isContainerCreateWithMetadataDocumentResponse;\nexport const isDeleteContainerOperationResponse = isContainerDeleteResponse;\n"]}
|