@tearleads/client-sdk 0.1.115 → 0.1.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/client/containerContents/documentDiscovery.js +5 -3
  2. package/client/containerContents/documentDiscovery.js.map +1 -1
  3. package/data/persistence/container-contents/containerContentsPersistence.js +14 -13
  4. package/data/persistence/container-contents/containerContentsPersistence.js.map +1 -1
  5. package/data/persistence/documents/internal/ensureDocumentsSchema.js +10 -12
  6. package/data/persistence/documents/internal/ensureDocumentsSchema.js.map +1 -1
  7. package/data/sqlite/schema/containerSchema.d.ts +1 -0
  8. package/data/sqlite/schema/containerSchema.js +8 -1
  9. package/data/sqlite/schema/containerSchema.js.map +1 -1
  10. package/data/sqlite/schema/documentAttachmentSchema.d.ts +0 -2
  11. package/data/sqlite/schema/documentAttachmentSchema.js +0 -4
  12. package/data/sqlite/schema/documentAttachmentSchema.js.map +1 -1
  13. package/data/sqlite/schema/index.d.ts +2 -0
  14. package/data/sqlite/schema/index.js +10 -1
  15. package/data/sqlite/schema/index.js.map +1 -1
  16. package/data/sqlite/schema/principalPolicySchema.js +0 -1
  17. package/data/sqlite/schema/principalPolicySchema.js.map +1 -1
  18. package/data/sqlite/schema/verifiedManifestBundleSchema.js +4 -2
  19. package/data/sqlite/schema/verifiedManifestBundleSchema.js.map +1 -1
  20. package/data/sqlite/sqlExec.d.ts +12 -0
  21. package/data/sqlite/sqlExec.js +47 -3
  22. package/data/sqlite/sqlExec.js.map +1 -1
  23. package/data/sqlite/sqlTableSchema.js +40 -15
  24. package/data/sqlite/sqlTableSchema.js.map +1 -1
  25. package/data/sqlite/sqlitePersistenceRuntime.js +18 -10
  26. package/data/sqlite/sqlitePersistenceRuntime.js.map +1 -1
  27. package/internal/api-client/ApiClient.d.ts +118 -0
  28. package/internal/api-client/ApiClient.js +4 -0
  29. package/internal/api-client/ApiClient.js.map +1 -1
  30. package/internal/api-client/index.d.ts +1 -1
  31. package/internal/api-client/index.js.map +1 -1
  32. package/internal/api-client/principalPolicyPages.d.ts +15 -1
  33. package/internal/api-client/principalPolicyPages.js +48 -2
  34. package/internal/api-client/principalPolicyPages.js.map +1 -1
  35. package/internal/api-client/principalPolicyRequests.d.ts +118 -1
  36. package/internal/api-client/principalPolicyRequests.js +4 -1
  37. package/internal/api-client/principalPolicyRequests.js.map +1 -1
  38. package/internal/validators/operation/principalPolicyPageQuery.d.ts +9 -0
  39. package/internal/validators/operation/principalPolicyPageQuery.js +10 -0
  40. package/internal/validators/operation/principalPolicyPageQuery.js.map +1 -1
  41. package/internal/validators/operation/principals.d.ts +37 -4
  42. package/internal/validators/operation/principals.js +5 -3
  43. package/internal/validators/operation/principals.js.map +1 -1
  44. package/internal/validators/response/index.d.ts +1 -1
  45. package/internal/validators/response/index.js +1 -1
  46. package/internal/validators/response/index.js.map +1 -1
  47. package/internal/validators/response/principalPolicyPage.d.ts +497 -1
  48. package/internal/validators/response/principalPolicyPage.js +18 -0
  49. package/internal/validators/response/principalPolicyPage.js.map +1 -1
  50. package/package.json +1 -1
  51. package/workflows/container-contents/documentLinks/index.d.ts +4 -0
  52. package/workflows/container-contents/documentLinks/index.js +10 -3
  53. package/workflows/container-contents/documentLinks/index.js.map +1 -1
  54. package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerPageHydration.js +7 -2
  55. package/workflows/container-contents/remoteHydration/remoteContainers/remoteContainerPageHydration.js.map +1 -1
  56. package/workflows/container-contents/tombstones/documentTombstoneEvidence.js +6 -5
  57. package/workflows/container-contents/tombstones/documentTombstoneEvidence.js.map +1 -1
  58. package/workflows/principals/principalPolicyHistoryReader.d.ts +6 -1
  59. package/workflows/principals/principalPolicyHistoryReader.js +4 -1
  60. package/workflows/principals/principalPolicyHistoryReader.js.map +1 -1
  61. package/workflows/principals/recoveryOperation/principalRecoveryDirectory.js +108 -59
  62. package/workflows/principals/recoveryOperation/principalRecoveryDirectory.js.map +1 -1
  63. package/workflows/principals/runtimePolicyRecovery.js +26 -14
  64. package/workflows/principals/runtimePolicyRecovery.js.map +1 -1
  65. package/workflows/principals/runtimePolicyWarmer.d.ts +26 -0
  66. package/workflows/principals/runtimePolicyWarmer.js +8 -5
  67. package/workflows/principals/runtimePolicyWarmer.js.map +1 -1
@@ -1,5 +1,6 @@
1
1
  import { serializeKeyingCanonicalJson } from "../crypto/index.js";
2
2
  import { getPrincipalPolicyOperation } from "../validators/operation/index.js";
3
+ import { isPrincipalPolicyPageResponse, isPrincipalPolicyUnchangedResponse, } from "../validators/response/index.js";
3
4
  import { principalHistoryRequest } from "./principalHistoryRequest.js";
4
5
  import { PrincipalHistoryRequestContext } from "./principalHistoryRequestContext.js";
5
6
  import { getPrincipalPolicy } from "./routes/principals/policy.js";
@@ -30,7 +31,7 @@ function readResume(input) {
30
31
  previousStates: [],
31
32
  historyPage: { afterVersion: input.afterVersion, nextAfterVersion: null },
32
33
  };
33
- if (!getPrincipalPolicy.isResponse(page))
34
+ if (!isPrincipalPolicyPageResponse(page))
34
35
  return undefined;
35
36
  const current = structuredClone(currentArtifacts(page));
36
37
  return {
@@ -115,7 +116,7 @@ export async function* readPrincipalPolicyPages(runtime, principalType, principa
115
116
  : firstPath;
116
117
  const result = await principalHistoryRequest(runtime, {
117
118
  path,
118
- validator: getPrincipalPolicy.isResponse,
119
+ validator: isPrincipalPolicyPageResponse,
119
120
  method: "GET",
120
121
  operation: getPrincipalPolicyOperation,
121
122
  options,
@@ -155,6 +156,51 @@ export async function* readPrincipalPolicyPages(runtime, principalType, principa
155
156
  afterVersion = nextAfterVersion;
156
157
  }
157
158
  }
159
+ /**
160
+ * One unpinned discovery read. With `ifHead`, a server whose live head is
161
+ * exactly that head answers `{ unchanged, head }` instead of the first page.
162
+ * The reply is untrusted: the caller must check the head is the one it holds.
163
+ */
164
+ export async function readPrincipalPolicyDiscovery(runtime, principalType, principalId, options) {
165
+ const { ifHead, ...requestOptions } = options;
166
+ const query = ifHead
167
+ ? { ifVersion: ifHead.version, ifStateHash: ifHead.stateHash }
168
+ : {};
169
+ if (!getPrincipalPolicyOperation.query.safeParse(query).success)
170
+ return pageFailure(runtime, getPrincipalPolicy.path(principalType, principalId), requestOptions, "Invalid held principal history head", null);
171
+ const path = getPrincipalPolicy.path(principalType, principalId, query);
172
+ const result = await principalHistoryRequest(runtime, {
173
+ path,
174
+ validator: getPrincipalPolicy.isResponse,
175
+ method: "GET",
176
+ operation: getPrincipalPolicyOperation,
177
+ options: requestOptions,
178
+ });
179
+ if (!result.ok)
180
+ return result;
181
+ const response = result.data;
182
+ // Exactly one variant: the strict bare-head reply, only to a conditional
183
+ // read and only for the requested principal, or a valid first page.
184
+ const unchanged = isPrincipalPolicyUnchangedResponse(response);
185
+ const page = isPrincipalPolicyPageResponse(response);
186
+ const valid = unchanged
187
+ ? !page &&
188
+ ifHead !== undefined &&
189
+ response.head.principalType === principalType &&
190
+ response.head.principalId === principalId
191
+ : page &&
192
+ validPage(response, {
193
+ principalType,
194
+ principalId,
195
+ stateHash: undefined,
196
+ pinnedBytes: undefined,
197
+ bytes: "",
198
+ afterVersion: 0,
199
+ });
200
+ return valid
201
+ ? result
202
+ : pageFailure(runtime, path, requestOptions, "Principal discovery reply does not match its request", 200);
203
+ }
158
204
  /** Full-bundle adapter for consumers that have not adopted durable staging. */
159
205
  export async function collectPrincipalPolicyPages(runtime, principalType, principalId, options) {
160
206
  let current;
@@ -1 +1 @@
1
- {"version":3,"file":"principalPolicyPages.js","sourceRoot":"","sources":["principalPolicyPages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAM9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAsBhE,SAAS,gB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B,CACjD,OAAO,EACP,aAAa,EACb,WAAW,EACX,OAAO,CACR,EAAE,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;QAC5B,OAAO,KAAK,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC1C,cAAc,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC;AAED,SAAS,WAAW,CAClB,OAA0B,EAC1B,IAAY,EACZ,OAA6B,EAC7B,OAAe,EACf,MAAqB;IAErB,OAAO,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC;QAC3C,IAAI,EAAE,OAAO;QACb,OAAO;QACP,MAAM,EAAE,KAAK;QACb,OAAO;QACP,IAAI;QACJ,MAAM;QACN,UAAU,EAAE,EAAE;KACf,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { serializeKeyingCanonicalJson } from \"@tearleads/crypto\";\nimport { getPrincipalPolicyOperation } from \"@tearleads/validators/operation\";\nimport type {\n PrincipalPolicyBundleResponse,\n PrincipalPolicyPageResponse,\n} from \"@tearleads/validators/response\";\nimport type { ApiRequestRuntime } from \"./apiRequestRuntime\";\nimport { principalHistoryRequest } from \"./principalHistoryRequest\";\nimport { PrincipalHistoryRequestContext } from \"./principalHistoryRequestContext\";\nimport { getPrincipalPolicy } from \"./routes/principals/policy\";\nimport type { RequestResult, RequestResultOptions } from \"./types\";\n\nexport type PrincipalPolicyPageCurrent = Omit<\n PrincipalPolicyBundleResponse,\n \"previousStates\"\n>;\n\n/** A transport position. Only the caller can authenticate the saved prefix. */\nexport interface PrincipalPolicyPageResume {\n readonly current: PrincipalPolicyPageCurrent;\n readonly afterVersion: number;\n}\n\nexport interface PrincipalPolicyPageReadOptions extends RequestResultOptions {\n /** Select an exact signed head even before its first page has been read. */\n readonly stateHash?: string | undefined;\n /** Transport offset for a caller-authenticated prefix; requires stateHash. */\n readonly afterVersion?: number | undefined;\n readonly resume?: PrincipalPolicyPageResume | undefined;\n}\n\nfunction currentArtifacts(page: PrincipalPolicyPageResponse) {\n return {\n currentState: page.currentState,\n currentPayload: page.currentPayload,\n currentProjection: page.currentProjection,\n currentGrants: page.currentGrants,\n currentMemberEnvelopes: page.currentMemberEnvelopes,\n };\n}\n\nfunction validResume(\n principalType: \"group\" | \"organization\",\n principalId: string,\n resume: PrincipalPolicyPageResume,\n stateHash: string | undefined,\n): boolean {\n const state = resume.current.currentState;\n return (\n Number.isSafeInteger(resume.afterVersion) &&\n resume.afterVersion >= 0 &&\n resume.afterVersion < state.version &&\n state.principalType === principalType &&\n state.principalId === principalId &&\n (stateHash === undefined || state.stateHash === stateHash)\n );\n}\n\nfunction readResume(input: PrincipalPolicyPageResume | undefined) {\n if (input === undefined) return undefined;\n try {\n const page = {\n ...input.current,\n previousStates: [],\n historyPage: { afterVersion: input.afterVersion, nextAfterVersion: null },\n };\n if (!getPrincipalPolicy.isResponse(page)) return undefined;\n const current = structuredClone(currentArtifacts(page));\n return {\n current,\n afterVersion: page.historyPage.afterVersion,\n bytes: serializeKeyingCanonicalJson(current),\n };\n } catch {\n return undefined;\n }\n}\n\nfunction validPage(\n page: PrincipalPolicyPageResponse,\n expected: {\n principalType: \"group\" | \"organization\";\n principalId: string;\n stateHash: string | undefined;\n pinnedBytes: string | undefined;\n bytes: string;\n afterVersion: number;\n },\n): boolean {\n const { afterVersion } = expected;\n const lastVersion = afterVersion + page.previousStates.length;\n return (\n page.currentState.principalType === expected.principalType &&\n page.currentState.principalId === expected.principalId &&\n (expected.stateHash === undefined ||\n page.currentState.stateHash === expected.stateHash) &&\n (expected.pinnedBytes === undefined ||\n expected.bytes === expected.pinnedBytes) &&\n page.historyPage.afterVersion === afterVersion &&\n lastVersion < page.currentState.version &&\n page.previousStates.every(\n ({ state }, index) =>\n state.version === afterVersion + index + 1 &&\n state.principalId === expected.principalId &&\n state.principalType === expected.principalType,\n ) &&\n (page.historyPage.nextAfterVersion === null\n ? lastVersion === page.currentState.version - 1\n : lastVersion > afterVersion &&\n lastVersion < page.currentState.version - 1 &&\n page.historyPage.nextAfterVersion === lastVersion)\n );\n}\n\nfunction preparePrincipalPolicyRead(\n runtime: ApiRequestRuntime,\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyPageReadOptions,\n) {\n const query =\n options.stateHash === undefined\n ? {}\n : {\n afterVersion: options.afterVersion ?? 0,\n stateHash: options.stateHash,\n };\n const basePath = getPrincipalPolicy.path(principalType, principalId);\n const failure = (message: string) => ({\n ok: false as const,\n failure: pageFailure(runtime, basePath, options, message, null),\n });\n if (\n options.afterVersion !== undefined &&\n (options.stateHash === undefined ||\n options.resume !== undefined ||\n !Number.isSafeInteger(options.afterVersion))\n )\n return failure(\"Initial principal history cursor requires one exact head\");\n if (!getPrincipalPolicyOperation.query.safeParse(query).success)\n return failure(\"Invalid requested principal history head\");\n const resume = readResume(options.resume);\n if (\n options.resume !== undefined &&\n (!resume ||\n !validResume(principalType, principalId, resume, options.stateHash))\n )\n return failure(\"Invalid saved principal history position\");\n return {\n ok: true as const,\n firstPath: getPrincipalPolicy.path(principalType, principalId, query),\n afterVersion: options.afterVersion ?? 0,\n resume,\n };\n}\n\n/** Pull one page at a time; the caller owns verification and durable admission. */\nexport async function* readPrincipalPolicyPages(\n runtime: ApiRequestRuntime,\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyPageReadOptions,\n): AsyncGenerator<RequestResult<PrincipalPolicyPageResponse>, void> {\n const position = preparePrincipalPolicyRead(\n runtime,\n principalType,\n principalId,\n options,\n );\n if (!position.ok) {\n yield position.failure;\n return;\n }\n const { firstPath, resume } = position;\n const context = new PrincipalHistoryRequestContext(\n runtime,\n \"GET\",\n firstPath,\n options,\n );\n let pinned = resume?.current;\n let pinnedBytes = resume?.bytes;\n let afterVersion = resume?.afterVersion ?? position.afterVersion;\n while (true) {\n const path = pinned\n ? getPrincipalPolicy.path(principalType, principalId, {\n afterVersion,\n stateHash: pinned.currentState.stateHash,\n })\n : firstPath;\n const result = await principalHistoryRequest(runtime, {\n path,\n validator: getPrincipalPolicy.isResponse,\n method: \"GET\",\n operation: getPrincipalPolicyOperation,\n options,\n context,\n });\n if (!result.ok) {\n yield result;\n return;\n }\n const page = result.data;\n const artifacts = currentArtifacts(page);\n const bytes = serializeKeyingCanonicalJson(artifacts);\n const valid = validPage(page, {\n principalType,\n principalId,\n stateHash: options.stateHash,\n pinnedBytes,\n bytes,\n afterVersion,\n });\n if (!valid) {\n yield pageFailure(\n runtime,\n path,\n options,\n \"Principal history page changed its head, order, or cursor\",\n 200,\n );\n return;\n }\n pinned ??= structuredClone(artifacts);\n pinnedBytes ??= bytes;\n context.afterReadPage();\n const nextAfterVersion = page.historyPage.nextAfterVersion;\n yield result;\n // A page consumer may await verification or storage while its session ends.\n if (context.cancelled()) {\n yield context.failure();\n return;\n }\n if (nextAfterVersion === null) return;\n afterVersion = nextAfterVersion;\n }\n}\n\n/** Full-bundle adapter for consumers that have not adopted durable staging. */\nexport async function collectPrincipalPolicyPages(\n runtime: ApiRequestRuntime,\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: RequestResultOptions,\n): Promise<PrincipalPolicyBundleResponse | null> {\n let current: PrincipalPolicyPageCurrent | undefined;\n const previousStates: PrincipalPolicyBundleResponse[\"previousStates\"] = [];\n for await (const result of readPrincipalPolicyPages(\n runtime,\n principalType,\n principalId,\n options,\n )) {\n if (!result.ok) return null;\n current ??= currentArtifacts(result.data);\n previousStates.push(...result.data.previousStates);\n }\n return current ? { ...current, previousStates } : null;\n}\n\nfunction pageFailure(\n runtime: ApiRequestRuntime,\n path: string,\n options: RequestResultOptions,\n message: string,\n status: number | null,\n) {\n return runtime.responseRequest.reportFailure({\n kind: \"shape\",\n message,\n method: \"GET\",\n options,\n path,\n status,\n statusText: \"\",\n });\n}\n"]}
1
+ {"version":3,"file":"principalPolicyPages.js","sourceRoot":"","sources":["principalPolicyPages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EACL,6BAA6B,EAC7B,kCAAkC,GAInC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAsBhE,SAAS,gBAAgB,CAAC,IAAiC;IACzD,OAAO;QACL,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;KACpD,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAClB,aAAuC,EACvC,WAAmB,EACnB,MAAiC,EACjC,SAA6B;IAE7B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;IAC1C,OAAO,CACL,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC;QACzC,MAAM,CAAC,YAAY,IAAI,CAAC;QACxB,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC,OAAO;QACnC,KAAK,CAAC,aAAa,KAAK,aAAa;QACrC,KAAK,CAAC,WAAW,KAAK,WAAW;QACjC,CAAC,SAAS,KAAK,SAAS,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAC3D,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAA4C;IAC9D,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,C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OAA0B,EAC1B,IAAY,EACZ,OAA6B,EAC7B,OAAe,EACf,MAAqB;IAErB,OAAO,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC;QAC3C,IAAI,EAAE,OAAO;QACb,OAAO;QACP,MAAM,EAAE,KAAK;QACb,OAAO;QACP,IAAI;QACJ,MAAM;QACN,UAAU,EAAE,EAAE;KACf,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { serializeKeyingCanonicalJson } from \"@tearleads/crypto\";\nimport { getPrincipalPolicyOperation } from \"@tearleads/validators/operation\";\nimport {\n isPrincipalPolicyPageResponse,\n isPrincipalPolicyUnchangedResponse,\n type PrincipalPolicyBundleResponse,\n type PrincipalPolicyPageResponse,\n type PrincipalPolicyReadResponse,\n} from \"@tearleads/validators/response\";\nimport type { ApiRequestRuntime } from \"./apiRequestRuntime\";\nimport { principalHistoryRequest } from \"./principalHistoryRequest\";\nimport { PrincipalHistoryRequestContext } from \"./principalHistoryRequestContext\";\nimport { getPrincipalPolicy } from \"./routes/principals/policy\";\nimport type { RequestResult, RequestResultOptions } from \"./types\";\n\nexport type PrincipalPolicyPageCurrent = Omit<\n PrincipalPolicyBundleResponse,\n \"previousStates\"\n>;\n\n/** A transport position. Only the caller can authenticate the saved prefix. */\nexport interface PrincipalPolicyPageResume {\n readonly current: PrincipalPolicyPageCurrent;\n readonly afterVersion: number;\n}\n\nexport interface PrincipalPolicyPageReadOptions extends RequestResultOptions {\n /** Select an exact signed head even before its first page has been read. */\n readonly stateHash?: string | undefined;\n /** Transport offset for a caller-authenticated prefix; requires stateHash. */\n readonly afterVersion?: number | undefined;\n readonly resume?: PrincipalPolicyPageResume | undefined;\n}\n\nfunction currentArtifacts(page: PrincipalPolicyPageResponse) {\n return {\n currentState: page.currentState,\n currentPayload: page.currentPayload,\n currentProjection: page.currentProjection,\n currentGrants: page.currentGrants,\n currentMemberEnvelopes: page.currentMemberEnvelopes,\n };\n}\n\nfunction validResume(\n principalType: \"group\" | \"organization\",\n principalId: string,\n resume: PrincipalPolicyPageResume,\n stateHash: string | undefined,\n): boolean {\n const state = resume.current.currentState;\n return (\n Number.isSafeInteger(resume.afterVersion) &&\n resume.afterVersion >= 0 &&\n resume.afterVersion < state.version &&\n state.principalType === principalType &&\n state.principalId === principalId &&\n (stateHash === undefined || state.stateHash === stateHash)\n );\n}\n\nfunction readResume(input: PrincipalPolicyPageResume | undefined) {\n if (input === undefined) return undefined;\n try {\n const page = {\n ...input.current,\n previousStates: [],\n historyPage: { afterVersion: input.afterVersion, nextAfterVersion: null },\n };\n if (!isPrincipalPolicyPageResponse(page)) return undefined;\n const current = structuredClone(currentArtifacts(page));\n return {\n current,\n afterVersion: page.historyPage.afterVersion,\n bytes: serializeKeyingCanonicalJson(current),\n };\n } catch {\n return undefined;\n }\n}\n\nfunction validPage(\n page: PrincipalPolicyPageResponse,\n expected: {\n principalType: \"group\" | \"organization\";\n principalId: string;\n stateHash: string | undefined;\n pinnedBytes: string | undefined;\n bytes: string;\n afterVersion: number;\n },\n): boolean {\n const { afterVersion } = expected;\n const lastVersion = afterVersion + page.previousStates.length;\n return (\n page.currentState.principalType === expected.principalType &&\n page.currentState.principalId === expected.principalId &&\n (expected.stateHash === undefined ||\n page.currentState.stateHash === expected.stateHash) &&\n (expected.pinnedBytes === undefined ||\n expected.bytes === expected.pinnedBytes) &&\n page.historyPage.afterVersion === afterVersion &&\n lastVersion < page.currentState.version &&\n page.previousStates.every(\n ({ state }, index) =>\n state.version === afterVersion + index + 1 &&\n state.principalId === expected.principalId &&\n state.principalType === expected.principalType,\n ) &&\n (page.historyPage.nextAfterVersion === null\n ? lastVersion === page.currentState.version - 1\n : lastVersion > afterVersion &&\n lastVersion < page.currentState.version - 1 &&\n page.historyPage.nextAfterVersion === lastVersion)\n );\n}\n\nfunction preparePrincipalPolicyRead(\n runtime: ApiRequestRuntime,\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyPageReadOptions,\n) {\n const query =\n options.stateHash === undefined\n ? {}\n : {\n afterVersion: options.afterVersion ?? 0,\n stateHash: options.stateHash,\n };\n const basePath = getPrincipalPolicy.path(principalType, principalId);\n const failure = (message: string) => ({\n ok: false as const,\n failure: pageFailure(runtime, basePath, options, message, null),\n });\n if (\n options.afterVersion !== undefined &&\n (options.stateHash === undefined ||\n options.resume !== undefined ||\n !Number.isSafeInteger(options.afterVersion))\n )\n return failure(\"Initial principal history cursor requires one exact head\");\n if (!getPrincipalPolicyOperation.query.safeParse(query).success)\n return failure(\"Invalid requested principal history head\");\n const resume = readResume(options.resume);\n if (\n options.resume !== undefined &&\n (!resume ||\n !validResume(principalType, principalId, resume, options.stateHash))\n )\n return failure(\"Invalid saved principal history position\");\n return {\n ok: true as const,\n firstPath: getPrincipalPolicy.path(principalType, principalId, query),\n afterVersion: options.afterVersion ?? 0,\n resume,\n };\n}\n\n/** Pull one page at a time; the caller owns verification and durable admission. */\nexport async function* readPrincipalPolicyPages(\n runtime: ApiRequestRuntime,\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyPageReadOptions,\n): AsyncGenerator<RequestResult<PrincipalPolicyPageResponse>, void> {\n const position = preparePrincipalPolicyRead(\n runtime,\n principalType,\n principalId,\n options,\n );\n if (!position.ok) {\n yield position.failure;\n return;\n }\n const { firstPath, resume } = position;\n const context = new PrincipalHistoryRequestContext(\n runtime,\n \"GET\",\n firstPath,\n options,\n );\n let pinned = resume?.current;\n let pinnedBytes = resume?.bytes;\n let afterVersion = resume?.afterVersion ?? position.afterVersion;\n while (true) {\n const path = pinned\n ? getPrincipalPolicy.path(principalType, principalId, {\n afterVersion,\n stateHash: pinned.currentState.stateHash,\n })\n : firstPath;\n const result = await principalHistoryRequest(runtime, {\n path,\n validator: isPrincipalPolicyPageResponse,\n method: \"GET\",\n operation: getPrincipalPolicyOperation,\n options,\n context,\n });\n if (!result.ok) {\n yield result;\n return;\n }\n const page = result.data;\n const artifacts = currentArtifacts(page);\n const bytes = serializeKeyingCanonicalJson(artifacts);\n const valid = validPage(page, {\n principalType,\n principalId,\n stateHash: options.stateHash,\n pinnedBytes,\n bytes,\n afterVersion,\n });\n if (!valid) {\n yield pageFailure(\n runtime,\n path,\n options,\n \"Principal history page changed its head, order, or cursor\",\n 200,\n );\n return;\n }\n pinned ??= structuredClone(artifacts);\n pinnedBytes ??= bytes;\n context.afterReadPage();\n const nextAfterVersion = page.historyPage.nextAfterVersion;\n yield result;\n // A page consumer may await verification or storage while its session ends.\n if (context.cancelled()) {\n yield context.failure();\n return;\n }\n if (nextAfterVersion === null) return;\n afterVersion = nextAfterVersion;\n }\n}\n\n/** A head the caller already holds and has authenticated. */\nexport interface PrincipalPolicyHeldHead {\n readonly version: number;\n readonly stateHash: string;\n}\n\nexport interface PrincipalPolicyDiscoveryOptions extends RequestResultOptions {\n readonly ifHead?: PrincipalPolicyHeldHead | undefined;\n}\n\n/**\n * One unpinned discovery read. With `ifHead`, a server whose live head is\n * exactly that head answers `{ unchanged, head }` instead of the first page.\n * The reply is untrusted: the caller must check the head is the one it holds.\n */\nexport async function readPrincipalPolicyDiscovery(\n runtime: ApiRequestRuntime,\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyDiscoveryOptions,\n): Promise<RequestResult<PrincipalPolicyReadResponse>> {\n const { ifHead, ...requestOptions } = options;\n const query = ifHead\n ? { ifVersion: ifHead.version, ifStateHash: ifHead.stateHash }\n : {};\n if (!getPrincipalPolicyOperation.query.safeParse(query).success)\n return pageFailure(\n runtime,\n getPrincipalPolicy.path(principalType, principalId),\n requestOptions,\n \"Invalid held principal history head\",\n null,\n );\n const path = getPrincipalPolicy.path(principalType, principalId, query);\n const result = await principalHistoryRequest(runtime, {\n path,\n validator: getPrincipalPolicy.isResponse,\n method: \"GET\",\n operation: getPrincipalPolicyOperation,\n options: requestOptions,\n });\n if (!result.ok) return result;\n const response = result.data;\n // Exactly one variant: the strict bare-head reply, only to a conditional\n // read and only for the requested principal, or a valid first page.\n const unchanged = isPrincipalPolicyUnchangedResponse(response);\n const page = isPrincipalPolicyPageResponse(response);\n const valid = unchanged\n ? !page &&\n ifHead !== undefined &&\n response.head.principalType === principalType &&\n response.head.principalId === principalId\n : page &&\n validPage(response, {\n principalType,\n principalId,\n stateHash: undefined,\n pinnedBytes: undefined,\n bytes: \"\",\n afterVersion: 0,\n });\n return valid\n ? result\n : pageFailure(\n runtime,\n path,\n requestOptions,\n \"Principal discovery reply does not match its request\",\n 200,\n );\n}\n\n/** Full-bundle adapter for consumers that have not adopted durable staging. */\nexport async function collectPrincipalPolicyPages(\n runtime: ApiRequestRuntime,\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: RequestResultOptions,\n): Promise<PrincipalPolicyBundleResponse | null> {\n let current: PrincipalPolicyPageCurrent | undefined;\n const previousStates: PrincipalPolicyBundleResponse[\"previousStates\"] = [];\n for await (const result of readPrincipalPolicyPages(\n runtime,\n principalType,\n principalId,\n options,\n )) {\n if (!result.ok) return null;\n current ??= currentArtifacts(result.data);\n previousStates.push(...result.data.previousStates);\n }\n return current ? { ...current, previousStates } : null;\n}\n\nfunction pageFailure(\n runtime: ApiRequestRuntime,\n path: string,\n options: RequestResultOptions,\n message: string,\n status: number | null,\n) {\n return runtime.responseRequest.reportFailure({\n kind: \"shape\",\n message,\n method: \"GET\",\n options,\n path,\n status,\n statusText: \"\",\n });\n}\n"]}
@@ -2,7 +2,7 @@ import type { CommitOrganizationGroupPolicyRequest, CreateOrganizationGroupWithP
2
2
  import type { PrincipalPolicyBundleResponse } from "../validators/response/index.js";
3
3
  import type { BoundedCache } from "./ApiCache.js";
4
4
  import type { ApiRequestRuntime } from "./apiRequestRuntime.js";
5
- import { type PrincipalPolicyPageReadOptions } from "./principalPolicyPages.js";
5
+ import { type PrincipalPolicyDiscoveryOptions, type PrincipalPolicyPageReadOptions } from "./principalPolicyPages.js";
6
6
  import { readProjectionPolicyHistoryPages } from "./projectionPolicyHistoryPages.js";
7
7
  import type { RequestResultOptions } from "./types.js";
8
8
  export declare class PrincipalPolicyRequests {
@@ -203,6 +203,123 @@ export declare class PrincipalPolicyRequests {
203
203
  version: number;
204
204
  };
205
205
  }>, void, any>;
206
+ discover(principalType: "group" | "organization", principalId: string, options?: PrincipalPolicyDiscoveryOptions): Promise<import("./types.js").RequestResult<{
207
+ previousStates: {
208
+ grants: {
209
+ accessLevel: "admin" | "read" | "write";
210
+ containerId: string;
211
+ }[];
212
+ projection: {
213
+ role: "member" | "admin";
214
+ userId: string;
215
+ }[];
216
+ state: {
217
+ createdAt: string;
218
+ encapsulationPublicKey: string;
219
+ externalAuthority: {
220
+ keyEpoch: number;
221
+ keyFingerprint: string;
222
+ principalId: string;
223
+ principalType: "group";
224
+ stateHash: string;
225
+ version: number;
226
+ } | null;
227
+ grantCount: number;
228
+ grantRoot: string;
229
+ keyEpoch: number;
230
+ keyFingerprint: string;
231
+ memberCount: number;
232
+ memberEnvelopesRoot: string;
233
+ membershipMode: "projection";
234
+ membershipRoot: string;
235
+ payloadCiphertextHash: string;
236
+ prevStateHash: string | null;
237
+ principalId: string;
238
+ principalType: "group" | "organization";
239
+ projectionRoot: string;
240
+ signature: string;
241
+ signedAt: string;
242
+ signerUserId: string;
243
+ signerUserKeyFingerprint: string;
244
+ stateHash: string;
245
+ version: number;
246
+ };
247
+ }[];
248
+ historyPage: {
249
+ afterVersion: number;
250
+ nextAfterVersion: number | null;
251
+ };
252
+ currentGrants: {
253
+ accessLevel: "admin" | "read" | "write";
254
+ containerId: string;
255
+ }[];
256
+ currentMemberEnvelopes: {
257
+ envelopes: {
258
+ kemCipherText: string;
259
+ memberKeyFingerprint: string;
260
+ userId: string;
261
+ wrappedKey: string;
262
+ }[];
263
+ epoch: number;
264
+ principalId: string;
265
+ principalType: "group" | "organization";
266
+ stateHash: string;
267
+ };
268
+ currentPayload: {
269
+ cipherSuite: "aes-256-gcm";
270
+ ciphertext: string;
271
+ ciphertextHash: string;
272
+ createdAt: string;
273
+ principalId: string;
274
+ principalType: "group" | "organization";
275
+ stateHash: string;
276
+ };
277
+ currentProjection: {
278
+ role: "member" | "admin";
279
+ userId: string;
280
+ }[];
281
+ currentState: {
282
+ createdAt: string;
283
+ encapsulationPublicKey: string;
284
+ externalAuthority: {
285
+ keyEpoch: number;
286
+ keyFingerprint: string;
287
+ principalId: string;
288
+ principalType: "group";
289
+ stateHash: string;
290
+ version: number;
291
+ } | null;
292
+ grantCount: number;
293
+ grantRoot: string;
294
+ keyEpoch: number;
295
+ keyFingerprint: string;
296
+ memberCount: number;
297
+ memberEnvelopesRoot: string;
298
+ membershipMode: "projection";
299
+ membershipRoot: string;
300
+ payloadCiphertextHash: string;
301
+ prevStateHash: string | null;
302
+ principalId: string;
303
+ principalType: "group" | "organization";
304
+ projectionRoot: string;
305
+ signature: string;
306
+ signedAt: string;
307
+ signerUserId: string;
308
+ signerUserKeyFingerprint: string;
309
+ stateHash: string;
310
+ version: number;
311
+ };
312
+ } | {
313
+ unchanged: true;
314
+ head: {
315
+ keyEpoch: number;
316
+ keyFingerprint: string;
317
+ principalId: string;
318
+ principalType: "group" | "organization";
319
+ stateHash: string;
320
+ version: number;
321
+ };
322
+ }>>;
206
323
  get(principalType: "group" | "organization", principalId: string, options?: RequestResultOptions): Promise<{
207
324
  previousStates: {
208
325
  grants: {
@@ -1,6 +1,6 @@
1
1
  import { commitOrganizationGroupPolicyOperation, createOrganizationGroupOperation, deleteOrganizationGroupOperation, putPrincipalPolicyOperation, } from "../validators/operation/index.js";
2
2
  import { principalHistoryRequest } from "./principalHistoryRequest.js";
3
- import { collectPrincipalPolicyPages, readPrincipalPolicyPages, } from "./principalPolicyPages.js";
3
+ import { collectPrincipalPolicyPages, readPrincipalPolicyDiscovery, readPrincipalPolicyPages, } from "./principalPolicyPages.js";
4
4
  import { readProjectionPolicyHistoryPages } from "./projectionPolicyHistoryPages.js";
5
5
  import { dedupedRequest } from "./requestInternals.js";
6
6
  import { createOrganizationGroup } from "./routes/organizations/createGroup.js";
@@ -21,6 +21,9 @@ export class PrincipalPolicyRequests {
21
21
  pages(principalType, principalId, options = {}) {
22
22
  return readPrincipalPolicyPages(this.runtime, principalType, principalId, options);
23
23
  }
24
+ discover(principalType, principalId, options = {}) {
25
+ return readPrincipalPolicyDiscovery(this.runtime, principalType, principalId, options);
26
+ }
24
27
  get(principalType, principalId, options = {}) {
25
28
  const request = () => collectPrincipalPolicyPages(this.runtime, principalType, principalId, options);
26
29
  const key = JSON.stringify([principalType, principalId]);
@@ -1 +1 @@
1
- {"version":3,"file":"principalPolicyRequests.js","sourceRoot":"","sources":["principalPolicyRequests.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sCAAsC,EACtC,gCAAgC,EAChC,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,iCAAiC,CAAC;AAUzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,2BAA2B,EAE3B,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EACL,6BAA6B,EAC7B,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAGpC,MAAM,OAAO,uBAAuB;IAEf;IACA;IAGA;IALnB,YACmB,OAA0B,EAC1B,KAEhB,EACgB,2BAAuC;QAJvC,YAAO,GAAP,OAAO,CAAmB;QAC1B,UAAK,GAAL,KAAK,CAErB;QACgB,gCAA2B,GAA3B,2BAA2B,CAAY;IACvD,CAAC;IAEJ,WAAW,CACT,MAA8D,EAC9D,UAAkE,EAAE;QAEpE,OAAO,gCAAgC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CACH,aAAuC,EACvC,WAAmB,E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AO,CAAC;gBACjE,SAAS,EAAE,6BAA6B,CAAC,UAAU;gBACnD,MAAM,EAAE,6BAA6B,CAAC,MAAM;gBAC5C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBAC3B,OAAO,EAAE;oBACP,qCAAqC,EAAE,cAAc;oBACrD,GAAG,OAAO;iBACX;gBACD,SAAS,EAAE,sCAAsC;aAClD,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;YACnC,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACrC,CAAC;IACH,CAAC;CACF","sourcesContent":["import {\n commitOrganizationGroupPolicyOperation,\n createOrganizationGroupOperation,\n deleteOrganizationGroupOperation,\n putPrincipalPolicyOperation,\n} from \"@tearleads/validators/operation\";\nimport type {\n CommitOrganizationGroupPolicyRequest,\n CreateOrganizationGroupWithPolicyRequest,\n DeleteOrganizationGroupRequest,\n OrganizationPrincipalPolicyRequest,\n} from \"@tearleads/validators/request\";\nimport type { PrincipalPolicyBundleResponse } from \"@tearleads/validators/response\";\nimport type { BoundedCache } from \"./ApiCache\";\nimport type { ApiRequestRuntime } from \"./apiRequestRuntime\";\nimport { principalHistoryRequest } from \"./principalHistoryRequest\";\nimport {\n collectPrincipalPolicyPages,\n type PrincipalPolicyPageReadOptions,\n readPrincipalPolicyPages,\n} from \"./principalPolicyPages\";\nimport { readProjectionPolicyHistoryPages } from \"./projectionPolicyHistoryPages\";\nimport { dedupedRequest } from \"./requestInternals\";\nimport { createOrganizationGroup } from \"./routes/organizations/createGroup\";\nimport { deleteOrganizationGroup } from \"./routes/organizations/deleteGroup\";\nimport {\n commitOrganizationGroupPolicy,\n putPrincipalPolicy,\n} from \"./routes/principals/policy\";\nimport type { RequestResultOptions } from \"./types\";\n\nexport class PrincipalPolicyRequests {\n constructor(\n private readonly runtime: ApiRequestRuntime,\n private readonly cache: BoundedCache<\n Promise<PrincipalPolicyBundleResponse | null>\n >,\n private readonly clearWriterProjectionCaches: () => void,\n ) {}\n\n publicPages(\n source: Parameters<typeof readProjectionPolicyHistoryPages>[1],\n options: Parameters<typeof readProjectionPolicyHistoryPages>[2] = {},\n ) {\n return readProjectionPolicyHistoryPages(this.runtime, source, options);\n }\n\n pages(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyPageReadOptions = {},\n ) {\n return readPrincipalPolicyPages(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n }\n\n get(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: RequestResultOptions = {},\n ) {\n const request = () =>\n collectPrincipalPolicyPages(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n const key = JSON.stringify([principalType, principalId]);\n // Cancellation, reporting and renewal preferences belong to their caller.\n return Object.keys(options).length > 0\n ? request()\n : dedupedRequest(this.cache, key, request);\n }\n\n put(...args: Parameters<PrincipalPolicyRequests[\"putResult\"]>) {\n return this.putResult(...args).then((result) =>\n result.ok ? result.data : null,\n );\n }\n\n putResult(\n principalType: \"organization\",\n principalId: string,\n input: OrganizationPrincipalPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n const key = JSON.stringify([principalType, principalId]);\n this.cache.delete(key);\n return principalHistoryRequest(this.runtime, {\n path: putPrincipalPolicy.path(principalType, principalId),\n validator: putPrincipalPolicy.isResponse,\n method: putPrincipalPolicy.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: principalId,\n ...options,\n },\n operation: putPrincipalPolicyOperation,\n }).finally(() => this.cache.delete(key));\n }\n\n createResult(\n organizationId: string,\n input: CreateOrganizationGroupWithPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n return this.groupMutation(organizationId, input.groupId, () =>\n principalHistoryRequest(this.runtime, {\n path: createOrganizationGroup.path(organizationId),\n validator: createOrganizationGroup.isResponse,\n method: createOrganizationGroup.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: createOrganizationGroupOperation,\n }),\n );\n }\n\n deleteResult(\n organizationId: string,\n groupId: string,\n input: DeleteOrganizationGroupRequest,\n options: RequestResultOptions = {},\n ) {\n return this.groupMutation(organizationId, groupId, () =>\n principalHistoryRequest(this.runtime, {\n path: deleteOrganizationGroup.path(organizationId, groupId),\n validator: deleteOrganizationGroup.isResponse,\n method: deleteOrganizationGroup.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: deleteOrganizationGroupOperation,\n }),\n );\n }\n\n private async groupMutation<T>(\n organizationId: string,\n groupId: string,\n request: () => Promise<T>,\n ): Promise<T> {\n const groupKey = JSON.stringify([\"group\", groupId]);\n const organizationKey = JSON.stringify([\"organization\", organizationId]);\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n try {\n return await request();\n } finally {\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n this.clearWriterProjectionCaches();\n }\n }\n\n async commitResult(\n organizationId: string,\n groupId: string,\n input: CommitOrganizationGroupPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n const groupKey = JSON.stringify([\"group\", groupId]);\n const organizationKey = JSON.stringify([\"organization\", organizationId]);\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n try {\n return await principalHistoryRequest(this.runtime, {\n path: commitOrganizationGroupPolicy.path(organizationId, groupId),\n validator: commitOrganizationGroupPolicy.isResponse,\n method: commitOrganizationGroupPolicy.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: commitOrganizationGroupPolicyOperation,\n });\n } finally {\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n this.clearWriterProjectionCaches();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"principalPolicyRequests.js","sourceRoot":"","sources":["principalPolicyRequests.ts"],"names":[],"mappings":"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,EAAE,cAAc;oBACrD,GAAG,OAAO;iBACX;gBACD,SAAS,EAAE,sCAAsC;aAClD,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;YACnC,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACrC,CAAC;IACH,CAAC;CACF","sourcesContent":["import {\n commitOrganizationGroupPolicyOperation,\n createOrganizationGroupOperation,\n deleteOrganizationGroupOperation,\n putPrincipalPolicyOperation,\n} from \"@tearleads/validators/operation\";\nimport type {\n CommitOrganizationGroupPolicyRequest,\n CreateOrganizationGroupWithPolicyRequest,\n DeleteOrganizationGroupRequest,\n OrganizationPrincipalPolicyRequest,\n} from \"@tearleads/validators/request\";\nimport type { PrincipalPolicyBundleResponse } from \"@tearleads/validators/response\";\nimport type { BoundedCache } from \"./ApiCache\";\nimport type { ApiRequestRuntime } from \"./apiRequestRuntime\";\nimport { principalHistoryRequest } from \"./principalHistoryRequest\";\nimport {\n collectPrincipalPolicyPages,\n type PrincipalPolicyDiscoveryOptions,\n type PrincipalPolicyPageReadOptions,\n readPrincipalPolicyDiscovery,\n readPrincipalPolicyPages,\n} from \"./principalPolicyPages\";\nimport { readProjectionPolicyHistoryPages } from \"./projectionPolicyHistoryPages\";\nimport { dedupedRequest } from \"./requestInternals\";\nimport { createOrganizationGroup } from \"./routes/organizations/createGroup\";\nimport { deleteOrganizationGroup } from \"./routes/organizations/deleteGroup\";\nimport {\n commitOrganizationGroupPolicy,\n putPrincipalPolicy,\n} from \"./routes/principals/policy\";\nimport type { RequestResultOptions } from \"./types\";\n\nexport class PrincipalPolicyRequests {\n constructor(\n private readonly runtime: ApiRequestRuntime,\n private readonly cache: BoundedCache<\n Promise<PrincipalPolicyBundleResponse | null>\n >,\n private readonly clearWriterProjectionCaches: () => void,\n ) {}\n\n publicPages(\n source: Parameters<typeof readProjectionPolicyHistoryPages>[1],\n options: Parameters<typeof readProjectionPolicyHistoryPages>[2] = {},\n ) {\n return readProjectionPolicyHistoryPages(this.runtime, source, options);\n }\n\n pages(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyPageReadOptions = {},\n ) {\n return readPrincipalPolicyPages(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n }\n\n discover(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: PrincipalPolicyDiscoveryOptions = {},\n ) {\n return readPrincipalPolicyDiscovery(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n }\n\n get(\n principalType: \"group\" | \"organization\",\n principalId: string,\n options: RequestResultOptions = {},\n ) {\n const request = () =>\n collectPrincipalPolicyPages(\n this.runtime,\n principalType,\n principalId,\n options,\n );\n const key = JSON.stringify([principalType, principalId]);\n // Cancellation, reporting and renewal preferences belong to their caller.\n return Object.keys(options).length > 0\n ? request()\n : dedupedRequest(this.cache, key, request);\n }\n\n put(...args: Parameters<PrincipalPolicyRequests[\"putResult\"]>) {\n return this.putResult(...args).then((result) =>\n result.ok ? result.data : null,\n );\n }\n\n putResult(\n principalType: \"organization\",\n principalId: string,\n input: OrganizationPrincipalPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n const key = JSON.stringify([principalType, principalId]);\n this.cache.delete(key);\n return principalHistoryRequest(this.runtime, {\n path: putPrincipalPolicy.path(principalType, principalId),\n validator: putPrincipalPolicy.isResponse,\n method: putPrincipalPolicy.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: principalId,\n ...options,\n },\n operation: putPrincipalPolicyOperation,\n }).finally(() => this.cache.delete(key));\n }\n\n createResult(\n organizationId: string,\n input: CreateOrganizationGroupWithPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n return this.groupMutation(organizationId, input.groupId, () =>\n principalHistoryRequest(this.runtime, {\n path: createOrganizationGroup.path(organizationId),\n validator: createOrganizationGroup.isResponse,\n method: createOrganizationGroup.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: createOrganizationGroupOperation,\n }),\n );\n }\n\n deleteResult(\n organizationId: string,\n groupId: string,\n input: DeleteOrganizationGroupRequest,\n options: RequestResultOptions = {},\n ) {\n return this.groupMutation(organizationId, groupId, () =>\n principalHistoryRequest(this.runtime, {\n path: deleteOrganizationGroup.path(organizationId, groupId),\n validator: deleteOrganizationGroup.isResponse,\n method: deleteOrganizationGroup.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: deleteOrganizationGroupOperation,\n }),\n );\n }\n\n private async groupMutation<T>(\n organizationId: string,\n groupId: string,\n request: () => Promise<T>,\n ): Promise<T> {\n const groupKey = JSON.stringify([\"group\", groupId]);\n const organizationKey = JSON.stringify([\"organization\", organizationId]);\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n try {\n return await request();\n } finally {\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n this.clearWriterProjectionCaches();\n }\n }\n\n async commitResult(\n organizationId: string,\n groupId: string,\n input: CommitOrganizationGroupPolicyRequest,\n options: RequestResultOptions = {},\n ) {\n const groupKey = JSON.stringify([\"group\", groupId]);\n const organizationKey = JSON.stringify([\"organization\", organizationId]);\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n try {\n return await principalHistoryRequest(this.runtime, {\n path: commitOrganizationGroupPolicy.path(organizationId, groupId),\n validator: commitOrganizationGroupPolicy.isResponse,\n method: commitOrganizationGroupPolicy.method,\n body: JSON.stringify(input),\n options: {\n expectedPaymentRequiredOrganizationId: organizationId,\n ...options,\n },\n operation: commitOrganizationGroupPolicyOperation,\n });\n } finally {\n this.cache.delete(groupKey);\n this.cache.delete(organizationKey);\n this.clearWriterProjectionCaches();\n }\n }\n}\n"]}
@@ -1,6 +1,15 @@
1
1
  import { z } from "zod";
2
+ /**
3
+ * `stateHash` and `afterVersion` pin delivery to one exact head. The
4
+ * `ifVersion` and `ifStateHash` pair makes an unpinned discovery read
5
+ * conditional: when the live head is exactly that pair, the reply carries the
6
+ * head alone. The API refuses a partial pair or one combined with a pin, as it
7
+ * refuses a cursor without a pin.
8
+ */
2
9
  export declare const PrincipalPolicyPageQuerySchema: z.ZodObject<{
3
10
  afterVersion: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<number, string | number>>>;
4
11
  stateHash: z.ZodOptional<z.ZodCustom<string, string>>;
12
+ ifVersion: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<number, string | number>>>;
13
+ ifStateHash: z.ZodOptional<z.ZodCustom<string, string>>;
5
14
  }, z.core.$strict>;
6
15
  export type PrincipalPolicyPageQuery = z.infer<typeof PrincipalPolicyPageQuerySchema>;
@@ -13,8 +13,18 @@ const cursorInput = registerJsonSchemaFragment(z.union([z.string(), z.number()])
13
13
  return Number.isSafeInteger(parsed) && parsed >= 0;
14
14
  }), cursorJsonSchema);
15
15
  const afterVersion = registerJsonSchemaFragment(cursorInput.transform(Number), cursorJsonSchema);
16
+ const headVersion = registerJsonSchemaFragment(cursorInput.transform(Number).refine((value) => value >= 1), { ...cursorJsonSchema, minimum: 1 });
17
+ /**
18
+ * `stateHash` and `afterVersion` pin delivery to one exact head. The
19
+ * `ifVersion` and `ifStateHash` pair makes an unpinned discovery read
20
+ * conditional: when the live head is exactly that pair, the reply carries the
21
+ * head alone. The API refuses a partial pair or one combined with a pin, as it
22
+ * refuses a cursor without a pin.
23
+ */
16
24
  export const PrincipalPolicyPageQuerySchema = z.strictObject({
17
25
  afterVersion: afterVersion.optional(),
18
26
  stateHash: sha256HexStringSchema.optional(),
27
+ ifVersion: headVersion.optional(),
28
+ ifStateHash: sha256HexStringSchema.optional(),
19
29
  });
20
30
  //# sourceMappingURL=principalPolicyPageQuery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"principalPolicyPageQuery.js","sourceRoot":"","sources":["principalPolicyPageQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAElD,MAAM,gBAAgB,GAAG;IACvB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,MAAM,CAAC,gBAAgB;CACxB,CAAC;AACX,MAAM,WAAW,GAAG,0BAA0B,CAC5C,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC;QAC/D,OAAO,KAAK,CAAC;IACf,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC;AACrD,CAAC,CAAC,EACF,gBAAgB,CACjB,CAAC;AACF,MAAM,YAAY,GAAG,0BAA0B,CAC7C,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,EAC7B,gBAAgB,CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,YAAY,CAAC;IAC3D,YAAY,EAAE,YAAY,CAAC,QAAQ,EAAE;IACrC,SAAS,EAAE,qBAAqB,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { registerJsonSchemaFragment } from \"../jsonSchema\";\nimport { sha256HexStringSchema } from \"../schema\";\n\nconst cursorJsonSchema = {\n type: \"integer\",\n minimum: 0,\n maximum: Number.MAX_SAFE_INTEGER,\n} as const;\nconst cursorInput = registerJsonSchemaFragment(\n z.union([z.string(), z.number()]).refine((value) => {\n if (typeof value === \"string\" && !/^(0|[1-9][0-9]*)$/.test(value))\n return false;\n const parsed = Number(value);\n return Number.isSafeInteger(parsed) && parsed >= 0;\n }),\n cursorJsonSchema,\n);\nconst afterVersion = registerJsonSchemaFragment(\n cursorInput.transform(Number),\n cursorJsonSchema,\n);\n\nexport const PrincipalPolicyPageQuerySchema = z.strictObject({\n afterVersion: afterVersion.optional(),\n stateHash: sha256HexStringSchema.optional(),\n});\n\nexport type PrincipalPolicyPageQuery = z.infer<\n typeof PrincipalPolicyPageQuerySchema\n>;\n"]}
1
+ {"version":3,"file":"principalPolicyPageQuery.js","sourceRoot":"","sources":["principalPolicyPageQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAElD,MAAM,gBAAgB,GAAG;IACvB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,MAAM,CAAC,gBAAgB;CACxB,CAAC;AACX,MAAM,WAAW,GAAG,0BAA0B,CAC5C,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC;QAC/D,OAAO,KAAK,CAAC;IACf,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC;AACrD,CAAC,CAAC,EACF,gBAAgB,CACjB,CAAC;AACF,MAAM,YAAY,GAAG,0BAA0B,CAC7C,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,EAC7B,gBAAgB,CACjB,CAAC;AAEF,MAAM,WAAW,GAAG,0BAA0B,CAC5C,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC,EAC3D,EAAE,GAAG,gBAAgB,EAAE,OAAO,EAAE,CAAC,EAAE,CACpC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,YAAY,CAAC;IAC3D,YAAY,EAAE,YAAY,CAAC,QAAQ,EAAE;IACrC,SAAS,EAAE,qBAAqB,CAAC,QAAQ,EAAE;IAC3C,SAAS,EAAE,WAAW,CAAC,QAAQ,EAAE;IACjC,WAAW,EAAE,qBAAqB,CAAC,QAAQ,EAAE;CAC9C,CAAC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { registerJsonSchemaFragment } from \"../jsonSchema\";\nimport { sha256HexStringSchema } from \"../schema\";\n\nconst cursorJsonSchema = {\n type: \"integer\",\n minimum: 0,\n maximum: Number.MAX_SAFE_INTEGER,\n} as const;\nconst cursorInput = registerJsonSchemaFragment(\n z.union([z.string(), z.number()]).refine((value) => {\n if (typeof value === \"string\" && !/^(0|[1-9][0-9]*)$/.test(value))\n return false;\n const parsed = Number(value);\n return Number.isSafeInteger(parsed) && parsed >= 0;\n }),\n cursorJsonSchema,\n);\nconst afterVersion = registerJsonSchemaFragment(\n cursorInput.transform(Number),\n cursorJsonSchema,\n);\n\nconst headVersion = registerJsonSchemaFragment(\n cursorInput.transform(Number).refine((value) => value >= 1),\n { ...cursorJsonSchema, minimum: 1 },\n);\n\n/**\n * `stateHash` and `afterVersion` pin delivery to one exact head. The\n * `ifVersion` and `ifStateHash` pair makes an unpinned discovery read\n * conditional: when the live head is exactly that pair, the reply carries the\n * head alone. The API refuses a partial pair or one combined with a pin, as it\n * refuses a cursor without a pin.\n */\nexport const PrincipalPolicyPageQuerySchema = z.strictObject({\n afterVersion: afterVersion.optional(),\n stateHash: sha256HexStringSchema.optional(),\n ifVersion: headVersion.optional(),\n ifStateHash: sha256HexStringSchema.optional(),\n});\n\nexport type PrincipalPolicyPageQuery = z.infer<\n typeof PrincipalPolicyPageQuerySchema\n>;\n"]}
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { isCommitOrganizationGroupPolicyRequest, isOrganizationPrincipalPolicyRequest } from "../request/index.js";
3
- import { ErrorResponseSchema, isCommitOrganizationGroupPolicyResponse, isPrincipalPolicyMutationResponse, isPrincipalPolicyPageResponse } from "../response/index.js";
3
+ import { ErrorResponseSchema, isCommitOrganizationGroupPolicyResponse, isPrincipalPolicyMutationResponse, type PrincipalPolicyReadResponse } from "../response/index.js";
4
4
  export declare const PrincipalPolicyPathParamsSchema: z.ZodObject<{
5
5
  principalType: z.ZodLiteral<"group" | "organization">;
6
6
  principalId: z.ZodCustom<string, string>;
@@ -75,12 +75,14 @@ export declare const getPrincipalPolicyOperation: Omit<{
75
75
  readonly query: z.ZodObject<{
76
76
  afterVersion: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<number, string | number>>>;
77
77
  stateHash: z.ZodOptional<z.ZodCustom<string, string>>;
78
+ ifVersion: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<number, string | number>>>;
79
+ ifStateHash: z.ZodOptional<z.ZodCustom<string, string>>;
78
80
  }, z.core.$strict>;
79
81
  readonly responseDescriptions: {
80
82
  readonly 202: "The attempted operation rolled back. Retry the identical request to continue verification preparation.";
81
83
  };
82
84
  readonly responses: {
83
- readonly 200: z.ZodType<{
85
+ readonly 200: z.ZodUnion<readonly [z.ZodType<{
84
86
  previousStates: {
85
87
  grants: {
86
88
  accessLevel: "admin" | "read" | "write";
@@ -504,7 +506,38 @@ export declare const getPrincipalPolicyOperation: Omit<{
504
506
  stateHash: string;
505
507
  version: number;
506
508
  };
507
- }>>;
509
+ }>>, z.ZodObject<{
510
+ unchanged: z.ZodLiteral<true>;
511
+ head: z.ZodType<{
512
+ keyEpoch: number;
513
+ keyFingerprint: string;
514
+ principalId: string;
515
+ principalType: "group" | "organization";
516
+ stateHash: string;
517
+ version: number;
518
+ }, {
519
+ keyEpoch: number;
520
+ keyFingerprint: string;
521
+ principalId: string;
522
+ principalType: "group" | "organization";
523
+ stateHash: string;
524
+ version: number;
525
+ }, z.core.$ZodTypeInternals<{
526
+ keyEpoch: number;
527
+ keyFingerprint: string;
528
+ principalId: string;
529
+ principalType: "group" | "organization";
530
+ stateHash: string;
531
+ version: number;
532
+ }, {
533
+ keyEpoch: number;
534
+ keyFingerprint: string;
535
+ principalId: string;
536
+ principalType: "group" | "organization";
537
+ stateHash: string;
538
+ version: number;
539
+ }>>;
540
+ }, z.core.$strict>]>;
508
541
  readonly 202: z.ZodObject<{
509
542
  code: z.ZodLiteral<"principal_history_preparation_pending">;
510
543
  committed: z.ZodLiteral<false>;
@@ -4493,6 +4526,6 @@ export declare const commitOrganizationGroupPolicyOperation: Omit<{
4493
4526
  };
4494
4527
  export declare const isCommitOrganizationGroupPolicyOperationRequest: typeof isCommitOrganizationGroupPolicyRequest;
4495
4528
  export declare const isCommitOrganizationGroupPolicyOperationResponse: typeof isCommitOrganizationGroupPolicyResponse;
4496
- export declare const isGetPrincipalPolicyOperationResponse: typeof isPrincipalPolicyPageResponse;
4529
+ export declare function isGetPrincipalPolicyOperationResponse(value: unknown): value is PrincipalPolicyReadResponse;
4497
4530
  export declare const isPutPrincipalPolicyOperationRequest: typeof isOrganizationPrincipalPolicyRequest;
4498
4531
  export declare const isPutPrincipalPolicyOperationResponse: typeof isPrincipalPolicyMutationResponse;
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { organizationProvisioningContainerKeyringRefinement } from "../organizationProvisioningRefinements.js";
3
3
  import { CommitOrganizationGroupPolicyRequestSchema, isCommitOrganizationGroupPolicyRequest, isOrganizationPrincipalPolicyRequest, OrganizationPrincipalPolicyRequestSchema, } from "../request/index.js";
4
- import { CommitOrganizationGroupPolicyConflictResponseSchema, CommitOrganizationGroupPolicyResponseSchema, ErrorResponseSchema, isCommitOrganizationGroupPolicyResponse, isPrincipalPolicyMutationResponse, isPrincipalPolicyPageResponse, PaymentRequiredErrorResponseSchema, PrincipalPolicyErrorResponseSchema, PrincipalPolicyMutationResponseSchema, PrincipalPolicyPageResponseSchema, SessionFailureResponseSchema, } from "../response/index.js";
4
+ import { CommitOrganizationGroupPolicyConflictResponseSchema, CommitOrganizationGroupPolicyResponseSchema, ErrorResponseSchema, isCommitOrganizationGroupPolicyResponse, isPrincipalPolicyMutationResponse, PaymentRequiredErrorResponseSchema, PrincipalPolicyErrorResponseSchema, PrincipalPolicyMutationResponseSchema, PrincipalPolicyReadResponseSchema, SessionFailureResponseSchema, } from "../response/index.js";
5
5
  import { PrincipalHistoryPreparationFailureResponseSchema, PrincipalHistoryPreparationResponseSchema, principalHistoryRollbackRefinement, } from "../response/principalHistoryPreparation.js";
6
6
  import { uuidV4StringSchema } from "../schema.js";
7
7
  import { defineJsonOperation } from "./definition.js";
@@ -34,7 +34,7 @@ export const getPrincipalPolicyOperation = defineJsonOperation({
34
34
  query: PrincipalPolicyPageQuerySchema,
35
35
  responseDescriptions: preparationResponseDescriptions,
36
36
  responses: {
37
- 200: PrincipalPolicyPageResponseSchema,
37
+ 200: PrincipalPolicyReadResponseSchema,
38
38
  202: PrincipalHistoryPreparationResponseSchema,
39
39
  },
40
40
  });
@@ -96,7 +96,9 @@ export const commitOrganizationGroupPolicyOperation = defineJsonOperation({
96
96
  });
97
97
  export const isCommitOrganizationGroupPolicyOperationRequest = isCommitOrganizationGroupPolicyRequest;
98
98
  export const isCommitOrganizationGroupPolicyOperationResponse = isCommitOrganizationGroupPolicyResponse;
99
- export const isGetPrincipalPolicyOperationResponse = isPrincipalPolicyPageResponse;
99
+ export function isGetPrincipalPolicyOperationResponse(value) {
100
+ return PrincipalPolicyReadResponseSchema.safeParse(value).success;
101
+ }
100
102
  export const isPutPrincipalPolicyOperationRequest = isOrganizationPrincipalPolicyRequest;
101
103
  export const isPutPrincipalPolicyOperationResponse = isPrincipalPolicyMutationResponse;
102
104
  //# sourceMappingURL=principals.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"principals.js","sourceRoot":"","sources":["principals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kDAAkD,EAAE,MAAM,wCAAwC,CAAC;AAC5G,OAAO,EACL,0CAA0C,EAC1C,sCAAsC,EACtC,oCAAoC,EACpC,wCAAwC,GACzC,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mDAAmD,EACnD,2CAA2C,EAC3C,mBAAmB,EACnB,uCAAuC,EACvC,iCAAiC,EACjC,6BAA6B,EAC7B,kCAAkC,EAClC,kCAAkC,EAClC,qCAAqC,EACrC,iCAAiC,EACjC,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gDAAgD,EAChD,yCAAyC,EACzC,kCAAkC,GACnC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAE5E,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,YAAY,CAAC;IAC5D,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACnD,WAAW,EAAE,kBAAkB;CAChC,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,CAAC,YAAY,CAAC;IACpE,cAAc,EAAE,kBAAk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import { organizationProvisioningContainerKeyringRefinement } from \"../organizationProvisioningRefinements\";\nimport {\n CommitOrganizationGroupPolicyRequestSchema,\n isCommitOrganizationGroupPolicyRequest,\n isOrganizationPrincipalPolicyRequest,\n OrganizationPrincipalPolicyRequestSchema,\n} from \"../request\";\nimport {\n CommitOrganizationGroupPolicyConflictResponseSchema,\n CommitOrganizationGroupPolicyResponseSchema,\n ErrorResponseSchema,\n isCommitOrganizationGroupPolicyResponse,\n isPrincipalPolicyMutationResponse,\n isPrincipalPolicyPageResponse,\n PaymentRequiredErrorResponseSchema,\n PrincipalPolicyErrorResponseSchema,\n PrincipalPolicyMutationResponseSchema,\n PrincipalPolicyPageResponseSchema,\n SessionFailureResponseSchema,\n} from \"../response\";\nimport {\n PrincipalHistoryPreparationFailureResponseSchema,\n PrincipalHistoryPreparationResponseSchema,\n principalHistoryRollbackRefinement,\n} from \"../response/principalHistoryPreparation\";\nimport { uuidV4StringSchema } from \"../schema\";\nimport { defineJsonOperation } from \"./definition\";\nimport { PrincipalPolicyPageQuerySchema } from \"./principalPolicyPageQuery\";\n\nexport const PrincipalPolicyPathParamsSchema = z.strictObject({\n principalType: z.literal([\"group\", \"organization\"]),\n principalId: uuidV4StringSchema,\n});\n\nexport type PrincipalPolicyPathParams = z.infer<\n typeof PrincipalPolicyPathParamsSchema\n>;\n\nexport const OrganizationGroupPolicyPathParamsSchema = z.strictObject({\n organizationId: uuidV4StringSchema,\n groupId: uuidV4StringSchema,\n});\n\nexport type OrganizationGroupPolicyPathParams = z.infer<\n typeof OrganizationGroupPolicyPathParamsSchema\n>;\n\nconst preparationResponseDescriptions = {\n 202: \"The attempted operation rolled back. Retry the identical request to continue verification preparation.\",\n} as const;\n\nexport const getPrincipalPolicyOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 409, 500],\n id: \"principals.policy.get\",\n method: \"GET\",\n params: PrincipalPolicyPathParamsSchema,\n path: \"/principals/{principalType}/{principalId}/policy\",\n query: PrincipalPolicyPageQuerySchema,\n responseDescriptions: preparationResponseDescriptions,\n responses: {\n 200: PrincipalPolicyPageResponseSchema,\n 202: PrincipalHistoryPreparationResponseSchema,\n },\n});\n\nexport const putPrincipalPolicyOperation = defineJsonOperation({\n auth: \"session\",\n body: OrganizationPrincipalPolicyRequestSchema,\n failureResponses: {\n 400: PrincipalPolicyErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: PrincipalPolicyErrorResponseSchema,\n 404: PrincipalPolicyErrorResponseSchema,\n 409: PrincipalPolicyErrorResponseSchema,\n 500: ErrorResponseSchema,\n 503: PrincipalHistoryPreparationFailureResponseSchema,\n },\n failureStatuses: [400, 401, 402, 403, 404, 409, 500, 503],\n id: \"principals.policy.update\",\n method: \"PUT\",\n params: PrincipalPolicyPathParamsSchema,\n path: \"/principals/{principalType}/{principalId}/policy\",\n responseDescriptions: preparationResponseDescriptions,\n responses: {\n 200: PrincipalPolicyMutationResponseSchema,\n 202: PrincipalHistoryPreparationResponseSchema,\n },\n runtimeRefinements: [\n organizationProvisioningContainerKeyringRefinement,\n principalHistoryRollbackRefinement,\n ],\n});\n\nexport const commitOrganizationGroupPolicyOperation = defineJsonOperation({\n auth: \"session\",\n body: CommitOrganizationGroupPolicyRequestSchema,\n failureResponses: {\n 400: PrincipalPolicyErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: PrincipalPolicyErrorResponseSchema,\n 404: PrincipalPolicyErrorResponseSchema,\n 409: CommitOrganizationGroupPolicyConflictResponseSchema,\n 500: ErrorResponseSchema,\n 503: PrincipalHistoryPreparationFailureResponseSchema,\n },\n failureStatuses: [400, 401, 402, 403, 404, 409, 500, 503],\n id: \"organizations.groups.policy.commit\",\n method: \"PUT\",\n params: OrganizationGroupPolicyPathParamsSchema,\n path: \"/organizations/{organizationId}/groups/{groupId}/policy-commit\",\n responseDescriptions: preparationResponseDescriptions,\n responses: {\n 200: CommitOrganizationGroupPolicyResponseSchema,\n 202: PrincipalHistoryPreparationResponseSchema,\n },\n runtimeRefinements: [\n organizationProvisioningContainerKeyringRefinement,\n principalHistoryRollbackRefinement,\n ],\n});\n\nexport const isCommitOrganizationGroupPolicyOperationRequest =\n isCommitOrganizationGroupPolicyRequest;\nexport const isCommitOrganizationGroupPolicyOperationResponse =\n isCommitOrganizationGroupPolicyResponse;\n\nexport const isGetPrincipalPolicyOperationResponse =\n isPrincipalPolicyPageResponse;\nexport const isPutPrincipalPolicyOperationRequest =\n isOrganizationPrincipalPolicyRequest;\nexport const isPutPrincipalPolicyOperationResponse =\n isPrincipalPolicyMutationResponse;\n"]}
1
+ {"version":3,"file":"principals.js","sourceRoot":"","sources":["principals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kDAAkD,EAAE,MAAM,wCAAwC,CAAC;AAC5G,OAAO,EACL,0CAA0C,EAC1C,sCAAsC,EACtC,oCAAoC,EACpC,wCAAwC,GACzC,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mDAAmD,EACnD,2CAA2C,EAC3C,mBAAmB,EACnB,uCAAuC,EACvC,iCAAiC,EACjC,kCAAkC,EAClC,kCAAkC,EAClC,qCAAqC,EAErC,iCAAiC,EACjC,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gDAAgD,EAChD,yCAAyC,EACzC,kCAAkC,GACnC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAE5E,MAAM,CAAC,MAAM,+BA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AAC;AACzC,MAAM,CAAC,MAAM,gDAAgD,GAC3D,uCAAuC,CAAC;AAE1C,MAAM,UAAU,qCAAqC,CACnD,KAAc;IAEd,OAAO,iCAAiC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AACpE,CAAC;AACD,MAAM,CAAC,MAAM,oCAAoC,GAC/C,oCAAoC,CAAC;AACvC,MAAM,CAAC,MAAM,qCAAqC,GAChD,iCAAiC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { organizationProvisioningContainerKeyringRefinement } from \"../organizationProvisioningRefinements\";\nimport {\n CommitOrganizationGroupPolicyRequestSchema,\n isCommitOrganizationGroupPolicyRequest,\n isOrganizationPrincipalPolicyRequest,\n OrganizationPrincipalPolicyRequestSchema,\n} from \"../request\";\nimport {\n CommitOrganizationGroupPolicyConflictResponseSchema,\n CommitOrganizationGroupPolicyResponseSchema,\n ErrorResponseSchema,\n isCommitOrganizationGroupPolicyResponse,\n isPrincipalPolicyMutationResponse,\n PaymentRequiredErrorResponseSchema,\n PrincipalPolicyErrorResponseSchema,\n PrincipalPolicyMutationResponseSchema,\n type PrincipalPolicyReadResponse,\n PrincipalPolicyReadResponseSchema,\n SessionFailureResponseSchema,\n} from \"../response\";\nimport {\n PrincipalHistoryPreparationFailureResponseSchema,\n PrincipalHistoryPreparationResponseSchema,\n principalHistoryRollbackRefinement,\n} from \"../response/principalHistoryPreparation\";\nimport { uuidV4StringSchema } from \"../schema\";\nimport { defineJsonOperation } from \"./definition\";\nimport { PrincipalPolicyPageQuerySchema } from \"./principalPolicyPageQuery\";\n\nexport const PrincipalPolicyPathParamsSchema = z.strictObject({\n principalType: z.literal([\"group\", \"organization\"]),\n principalId: uuidV4StringSchema,\n});\n\nexport type PrincipalPolicyPathParams = z.infer<\n typeof PrincipalPolicyPathParamsSchema\n>;\n\nexport const OrganizationGroupPolicyPathParamsSchema = z.strictObject({\n organizationId: uuidV4StringSchema,\n groupId: uuidV4StringSchema,\n});\n\nexport type OrganizationGroupPolicyPathParams = z.infer<\n typeof OrganizationGroupPolicyPathParamsSchema\n>;\n\nconst preparationResponseDescriptions = {\n 202: \"The attempted operation rolled back. Retry the identical request to continue verification preparation.\",\n} as const;\n\nexport const getPrincipalPolicyOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 409, 500],\n id: \"principals.policy.get\",\n method: \"GET\",\n params: PrincipalPolicyPathParamsSchema,\n path: \"/principals/{principalType}/{principalId}/policy\",\n query: PrincipalPolicyPageQuerySchema,\n responseDescriptions: preparationResponseDescriptions,\n responses: {\n 200: PrincipalPolicyReadResponseSchema,\n 202: PrincipalHistoryPreparationResponseSchema,\n },\n});\n\nexport const putPrincipalPolicyOperation = defineJsonOperation({\n auth: \"session\",\n body: OrganizationPrincipalPolicyRequestSchema,\n failureResponses: {\n 400: PrincipalPolicyErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: PrincipalPolicyErrorResponseSchema,\n 404: PrincipalPolicyErrorResponseSchema,\n 409: PrincipalPolicyErrorResponseSchema,\n 500: ErrorResponseSchema,\n 503: PrincipalHistoryPreparationFailureResponseSchema,\n },\n failureStatuses: [400, 401, 402, 403, 404, 409, 500, 503],\n id: \"principals.policy.update\",\n method: \"PUT\",\n params: PrincipalPolicyPathParamsSchema,\n path: \"/principals/{principalType}/{principalId}/policy\",\n responseDescriptions: preparationResponseDescriptions,\n responses: {\n 200: PrincipalPolicyMutationResponseSchema,\n 202: PrincipalHistoryPreparationResponseSchema,\n },\n runtimeRefinements: [\n organizationProvisioningContainerKeyringRefinement,\n principalHistoryRollbackRefinement,\n ],\n});\n\nexport const commitOrganizationGroupPolicyOperation = defineJsonOperation({\n auth: \"session\",\n body: CommitOrganizationGroupPolicyRequestSchema,\n failureResponses: {\n 400: PrincipalPolicyErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 402: PaymentRequiredErrorResponseSchema,\n 403: PrincipalPolicyErrorResponseSchema,\n 404: PrincipalPolicyErrorResponseSchema,\n 409: CommitOrganizationGroupPolicyConflictResponseSchema,\n 500: ErrorResponseSchema,\n 503: PrincipalHistoryPreparationFailureResponseSchema,\n },\n failureStatuses: [400, 401, 402, 403, 404, 409, 500, 503],\n id: \"organizations.groups.policy.commit\",\n method: \"PUT\",\n params: OrganizationGroupPolicyPathParamsSchema,\n path: \"/organizations/{organizationId}/groups/{groupId}/policy-commit\",\n responseDescriptions: preparationResponseDescriptions,\n responses: {\n 200: CommitOrganizationGroupPolicyResponseSchema,\n 202: PrincipalHistoryPreparationResponseSchema,\n },\n runtimeRefinements: [\n organizationProvisioningContainerKeyringRefinement,\n principalHistoryRollbackRefinement,\n ],\n});\n\nexport const isCommitOrganizationGroupPolicyOperationRequest =\n isCommitOrganizationGroupPolicyRequest;\nexport const isCommitOrganizationGroupPolicyOperationResponse =\n isCommitOrganizationGroupPolicyResponse;\n\nexport function isGetPrincipalPolicyOperationResponse(\n value: unknown,\n): value is PrincipalPolicyReadResponse {\n return PrincipalPolicyReadResponseSchema.safeParse(value).success;\n}\nexport const isPutPrincipalPolicyOperationRequest =\n isOrganizationPrincipalPolicyRequest;\nexport const isPutPrincipalPolicyOperationResponse =\n isPrincipalPolicyMutationResponse;\n"]}
@@ -31,7 +31,7 @@ export { type CreateOrganizationResponse, CreateOrganizationResponseSchema, isCr
31
31
  export { isOrganizationReadModelResponse, type OrganizationReadModelDeltaResponse, type OrganizationReadModelDirectoryResponse, type OrganizationReadModelGrantsResponse, type OrganizationReadModelGroupMemberResponse, type OrganizationReadModelGroupMembershipResponse, type OrganizationReadModelGroupMembershipsResponse, type OrganizationReadModelOrganizationPolicyResponse, type OrganizationReadModelResponse, OrganizationReadModelResponseSchema, type OrganizationReadModelSnapshotResponse, } from "./organizationReadModel.js";
32
32
  export { ORGANIZATION_READ_MODEL_ERROR_CODES, type OrganizationReadModelErrorCode, OrganizationReadModelErrorCodeSchema, type OrganizationReadModelFailureResponse, OrganizationReadModelFailureResponseSchema, } from "./organizationReadModelError.js";
33
33
  export { CommitOrganizationGroupPolicyConflictResponseSchema, type CommitOrganizationGroupPolicyResponse, CommitOrganizationGroupPolicyResponseSchema, type CurrentPrincipalMemberEnvelopesResponse, CurrentPrincipalMemberEnvelopesResponseSchema, isCommitOrganizationGroupPolicyResponse, isCurrentPrincipalMemberEnvelopesResponse, isPrincipalPolicyBundleResponse, isPrincipalPolicyMutationResponse, isPrincipalPolicyStaleErrorResponse, isPrincipalPolicyStateChainEntryResponse, isPrincipalStatePayloadResponse, isPrincipalStateResponse, type PrincipalContainerGrantResponse, PrincipalContainerGrantResponseSchema, type PrincipalMemberEnvelopeResponse, PrincipalMemberEnvelopeResponseSchema, type PrincipalPolicyBundleResponse, PrincipalPolicyBundleResponseSchema, type PrincipalPolicyErrorResponse, PrincipalPolicyErrorResponseSchema, type PrincipalPolicyMutationResponse, PrincipalPolicyMutationResponseSchema, type PrincipalPolicySnapshotResponse, PrincipalPolicySnapshotResponseSchema, type PrincipalPolicyStaleErrorResponse, PrincipalPolicyStaleErrorResponseSchema, type PrincipalPolicyStateChainEntryResponse, PrincipalPolicyStateChainEntryResponseSchema, type PrincipalProjectionMemberResponse, PrincipalProjectionMemberResponseSchema, type PrincipalStateExternalAuthorityResponse, PrincipalStateExternalAuthorityResponseSchema, type PrincipalStatePayloadResponse, PrincipalStatePayloadResponseSchema, type PrincipalStateResponse, PrincipalStateResponseSchema, } from "./principal.js";
34
- export { isPrincipalPolicyPageResponse, type PrincipalPolicyPageResponse, PrincipalPolicyPageResponseSchema, } from "./principalPolicyPage.js";
34
+ export { isPrincipalPolicyPageResponse, isPrincipalPolicyUnchangedResponse, type PrincipalPolicyPageResponse, PrincipalPolicyPageResponseSchema, type PrincipalPolicyReadResponse, PrincipalPolicyReadResponseSchema, type PrincipalPolicyUnchangedResponse, PrincipalPolicyUnchangedResponseSchema, } from "./principalPolicyPage.js";
35
35
  export { isPrincipalPolicySnapshotPageResponse, type PrincipalPolicyHistorySourceResponse, PrincipalPolicyHistorySourceResponseSchema, type PrincipalPolicySnapshotPageResponse, PrincipalPolicySnapshotPageResponseSchema, } from "./principalPolicySnapshotPage.js";
36
36
  export { isReferencedPrincipalStateResponse, type ReferencedPrincipalStateResponse, ReferencedPrincipalStateResponseSchema, } from "./principalReference.js";
37
37
  export { type ProjectionPolicyEvidenceResponse, ProjectionPolicyEvidenceResponseSchema, } from "./projectionPolicyEvidence.js";
@@ -30,7 +30,7 @@ export { CreateOrganizationResponseSchema, isCreateOrganizationResponse, isOrgan
30
30
  export { isOrganizationReadModelResponse, OrganizationReadModelResponseSchema, } from "./organizationReadModel.js";
31
31
  export { ORGANIZATION_READ_MODEL_ERROR_CODES, OrganizationReadModelErrorCodeSchema, OrganizationReadModelFailureResponseSchema, } from "./organizationReadModelError.js";
32
32
  export { CommitOrganizationGroupPolicyConflictResponseSchema, CommitOrganizationGroupPolicyResponseSchema, CurrentPrincipalMemberEnvelopesResponseSchema, isCommitOrganizationGroupPolicyResponse, isCurrentPrincipalMemberEnvelopesResponse, isPrincipalPolicyBundleResponse, isPrincipalPolicyMutationResponse, isPrincipalPolicyStaleErrorResponse, isPrincipalPolicyStateChainEntryResponse, isPrincipalStatePayloadResponse, isPrincipalStateResponse, PrincipalContainerGrantResponseSchema, PrincipalMemberEnvelopeResponseSchema, PrincipalPolicyBundleResponseSchema, PrincipalPolicyErrorResponseSchema, PrincipalPolicyMutationResponseSchema, PrincipalPolicySnapshotResponseSchema, PrincipalPolicyStaleErrorResponseSchema, PrincipalPolicyStateChainEntryResponseSchema, PrincipalProjectionMemberResponseSchema, PrincipalStateExternalAuthorityResponseSchema, PrincipalStatePayloadResponseSchema, PrincipalStateResponseSchema, } from "./principal.js";
33
- export { isPrincipalPolicyPageResponse, PrincipalPolicyPageResponseSchema, } from "./principalPolicyPage.js";
33
+ export { isPrincipalPolicyPageResponse, isPrincipalPolicyUnchangedResponse, PrincipalPolicyPageResponseSchema, PrincipalPolicyReadResponseSchema, PrincipalPolicyUnchangedResponseSchema, } from "./principalPolicyPage.js";
34
34
  export { isPrincipalPolicySnapshotPageResponse, PrincipalPolicyHistorySourceResponseSchema, PrincipalPolicySnapshotPageResponseSchema, } from "./principalPolicySnapshotPage.js";
35
35
  export { isReferencedPrincipalStateResponse, ReferencedPrincipalStateResponseSchema, } from "./principalReference.js";
36
36
  export { ProjectionPolicyEvidenceResponseSchema, } from "./projectionPolicyEvidence.js";