@oxy.so/contracts 4.22.0 → 4.24.0

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 (36) hide show
  1. package/dist/cjs/agency.js +33 -1
  2. package/dist/cjs/appAssertions.js +201 -0
  3. package/dist/cjs/client/appAssertions.js +80 -0
  4. package/dist/cjs/client/index.js +17 -3
  5. package/dist/cjs/client/products.js +33 -11
  6. package/dist/cjs/index.js +10 -3
  7. package/dist/cjs/products/billing.js +1 -0
  8. package/dist/cjs/products/checkout.js +14 -1
  9. package/dist/cjs/products/plans.js +18 -2
  10. package/dist/cjs/userResponse.js +8 -1
  11. package/dist/esm/agency.js +32 -0
  12. package/dist/esm/appAssertions.js +191 -0
  13. package/dist/esm/client/appAssertions.js +77 -0
  14. package/dist/esm/client/index.js +2 -1
  15. package/dist/esm/client/products.js +32 -10
  16. package/dist/esm/index.js +3 -2
  17. package/dist/esm/products/billing.js +1 -0
  18. package/dist/esm/products/checkout.js +13 -0
  19. package/dist/esm/products/plans.js +17 -1
  20. package/dist/esm/userResponse.js +8 -1
  21. package/dist/types/agency.d.ts +64 -0
  22. package/dist/types/appAssertions.d.ts +335 -0
  23. package/dist/types/client/appAssertions.d.ts +60 -0
  24. package/dist/types/client/index.d.ts +2 -1
  25. package/dist/types/client/products.d.ts +43 -10
  26. package/dist/types/externalIdentity.d.ts +33 -0
  27. package/dist/types/index.d.ts +4 -3
  28. package/dist/types/inference/aliaModelRelease.d.ts +8 -8
  29. package/dist/types/inference/modelDocumentation.d.ts +8 -8
  30. package/dist/types/products/billing.d.ts +8 -0
  31. package/dist/types/products/checkout.d.ts +36 -0
  32. package/dist/types/products/plans.d.ts +102 -5
  33. package/dist/types/safety.d.ts +27 -0
  34. package/dist/types/updates.d.ts +6 -6
  35. package/dist/types/userResponse.d.ts +139 -3
  36. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizedAppEventSchema = exports.catalogRegistrationSchema = exports.appCapabilityCatalogSchema = exports.CATALOG_INTERNAL_TRANSPORTS = exports.catalogFeatureSchema = exports.catalogEventSchema = exports.catalogToolSchema = exports.auditEventSchema = exports.auditResultSchema = exports.policyDecisionSchema = exports.invocationPrincipalSchema = exports.capabilityTicketClaimsSchema = exports.automationDefinitionSchema = exports.automationDataFlowSchema = exports.automationActorSelectionSchema = exports.automationTriggerSchema = exports.agentRequesterCeilingSchema = exports.agentRequesterCeilingWriteSchema = exports.AGENT_REQUESTER_CEILING_AUTONOMY = exports.delegationGrantSchema = exports.capabilityTicketRequestSchema = exports.capabilityCoordinatorSchema = exports.executionAuthorizationRefSchema = exports.capabilityCatalogBindingSchema = exports.grantLimitSchema = exports.toolGrantOverrideSchema = exports.resourceRefSchema = exports.foregroundExecutionAuthorizationInputSchema = exports.executionActorRefSchema = exports.actorRefSchema = exports.capabilityPackageSchema = exports.CAPABILITY_PACKAGES = exports.autonomyLevelSchema = exports.AUTONOMY_LEVELS = void 0;
3
+ exports.normalizedAppEventSchema = exports.catalogRegistrationSchema = exports.appCapabilityCatalogSchema = exports.CATALOG_INTERNAL_TRANSPORTS = exports.catalogFeatureSchema = exports.catalogEventSchema = exports.catalogToolSchema = exports.auditEventSchema = exports.auditResultSchema = exports.policyDecisionSchema = exports.invocationPrincipalSchema = exports.capabilityTicketClaimsSchema = exports.automationDefinitionSchema = exports.automationDataFlowSchema = exports.automationActorSelectionSchema = exports.automationTriggerSchema = exports.agentAvailabilitySchema = exports.applicationAgentSchema = exports.applicationAgentWriteSchema = exports.applicationAgentAvailabilitySchema = exports.APPLICATION_AGENT_AVAILABILITIES = exports.agentRequesterCeilingSchema = exports.agentRequesterCeilingWriteSchema = exports.AGENT_REQUESTER_CEILING_AUTONOMY = exports.delegationGrantSchema = exports.capabilityTicketRequestSchema = exports.capabilityCoordinatorSchema = exports.executionAuthorizationRefSchema = exports.capabilityCatalogBindingSchema = exports.grantLimitSchema = exports.toolGrantOverrideSchema = exports.resourceRefSchema = exports.foregroundExecutionAuthorizationInputSchema = exports.executionActorRefSchema = exports.actorRefSchema = exports.capabilityPackageSchema = exports.CAPABILITY_PACKAGES = exports.autonomyLevelSchema = exports.AUTONOMY_LEVELS = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const capabilityInvocation_1 = require("./capabilityInvocation");
6
6
  const nonEmptyStringSchema = zod_1.z.string().trim().min(1);
@@ -172,6 +172,38 @@ exports.agentRequesterCeilingSchema = exports.agentRequesterCeilingWriteSchema
172
172
  updatedAt: zod_1.z.string().datetime(),
173
173
  })
174
174
  .strict();
175
+ /**
176
+ * Where an application's own agent opens (ADR 0044): `anywhere`, or only in
177
+ * sessions that belong to that application (`own_application`). An agent with
178
+ * no application row is available anywhere.
179
+ */
180
+ exports.APPLICATION_AGENT_AVAILABILITIES = ['anywhere', 'own_application'];
181
+ exports.applicationAgentAvailabilitySchema = zod_1.z.enum(exports.APPLICATION_AGENT_AVAILABILITIES);
182
+ /** What Oxy staff write for one of an application's agents. */
183
+ exports.applicationAgentWriteSchema = zod_1.z
184
+ .object({ availability: exports.applicationAgentAvailabilitySchema })
185
+ .strict();
186
+ /** One row of the application registry's agents: an agent is one application's. */
187
+ exports.applicationAgentSchema = exports.applicationAgentWriteSchema
188
+ .extend({
189
+ applicationId: identifierSchema,
190
+ agentAccountId: identifierSchema,
191
+ createdByUserId: identifierSchema.nullable(),
192
+ createdAt: zod_1.z.string().datetime(),
193
+ updatedAt: zod_1.z.string().datetime(),
194
+ })
195
+ .strict();
196
+ /**
197
+ * `GET /capabilities/agent-availability/:agentAccountId`: the sessions an agent
198
+ * is reachable from. `anywhere: false` lists the applications whose sessions
199
+ * (the session validation answer's `applicationId`) may reach it.
200
+ */
201
+ exports.agentAvailabilitySchema = zod_1.z.discriminatedUnion('anywhere', [
202
+ zod_1.z.object({ anywhere: zod_1.z.literal(true) }).strict(),
203
+ zod_1.z
204
+ .object({ anywhere: zod_1.z.literal(false), applicationIds: zod_1.z.array(identifierSchema).min(1) })
205
+ .strict(),
206
+ ]);
175
207
  exports.automationTriggerSchema = zod_1.z.discriminatedUnion('type', [
176
208
  zod_1.z.object({ type: zod_1.z.literal('manual') }).strict(),
177
209
  zod_1.z
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ /**
3
+ * App assertions (ADR 0045): how an Oxy app proves which app it is.
4
+ *
5
+ * ## The registry
6
+ *
7
+ * Each application may declare how it is recognised, written only by Oxy staff
8
+ * through the application administration lane
9
+ * (`PUT /applications/:appId/recognition`): its exact `https://` web origins,
10
+ * its Android package and signing certificates, and its iOS team and bundle.
11
+ * A platform it does not declare can never assert it.
12
+ *
13
+ * ## The exchange
14
+ *
15
+ * With the person's own bearer, the app asks `POST /apps/assertions` for an
16
+ * `OXY-APP+JWT` naming the application, and proves itself by platform: on the
17
+ * web the browser's `Origin`; on Android a Play Integrity token whose request
18
+ * hash is a challenge from `POST /apps/assertions/challenge`; on iOS an App
19
+ * Attest assertion over such a challenge, made with a key registered through
20
+ * `POST /apps/attest-keys`. The assertion lives five minutes and names the
21
+ * person (`sub`) and the session (`sid`) it was issued to.
22
+ *
23
+ * The Zod-free half (vocabularies, header name, response checks) is
24
+ * `./client/appAssertions.ts`.
25
+ */
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.appAssertionResponseSchema = exports.appAssertionRequestSchema = exports.appAttestKeyResponseSchema = exports.appAttestKeyRequestSchema = exports.appAttestKeyIdSchema = exports.appAssertionChallengeResponseSchema = exports.appAssertionChallengeRequestSchema = exports.applicationRecognitionSchema = exports.applicationRecognitionWriteSchema = exports.applicationIosRecognitionSchema = exports.applicationAndroidRecognitionSchema = exports.appleBundleIdSchema = exports.appleTeamIdSchema = exports.signingCertSha256Schema = exports.androidPackageNameSchema = exports.applicationWebOriginSchema = exports.appAssertionErrorCodeSchema = exports.appAssertionPlatformSchema = exports.OXY_APP_ASSERTION_TYPE = exports.OXY_APP_ASSERTION_TTL_SECONDS = exports.OXY_APP_ASSERTION_HEADER = exports.OXY_APP_ASSERTION_AUDIENCE = exports.APP_ASSERTION_PLATFORMS = exports.APP_ASSERTION_ERROR_CODES = exports.APP_ASSERTION_CHALLENGE_PURPOSES = void 0;
28
+ exports.isExactHttpsOrigin = isExactHttpsOrigin;
29
+ const zod_1 = require("zod");
30
+ const appAssertions_1 = require("./client/appAssertions");
31
+ Object.defineProperty(exports, "APP_ASSERTION_CHALLENGE_PURPOSES", { enumerable: true, get: function () { return appAssertions_1.APP_ASSERTION_CHALLENGE_PURPOSES; } });
32
+ Object.defineProperty(exports, "APP_ASSERTION_ERROR_CODES", { enumerable: true, get: function () { return appAssertions_1.APP_ASSERTION_ERROR_CODES; } });
33
+ Object.defineProperty(exports, "APP_ASSERTION_PLATFORMS", { enumerable: true, get: function () { return appAssertions_1.APP_ASSERTION_PLATFORMS; } });
34
+ Object.defineProperty(exports, "OXY_APP_ASSERTION_AUDIENCE", { enumerable: true, get: function () { return appAssertions_1.OXY_APP_ASSERTION_AUDIENCE; } });
35
+ Object.defineProperty(exports, "OXY_APP_ASSERTION_HEADER", { enumerable: true, get: function () { return appAssertions_1.OXY_APP_ASSERTION_HEADER; } });
36
+ Object.defineProperty(exports, "OXY_APP_ASSERTION_TTL_SECONDS", { enumerable: true, get: function () { return appAssertions_1.OXY_APP_ASSERTION_TTL_SECONDS; } });
37
+ Object.defineProperty(exports, "OXY_APP_ASSERTION_TYPE", { enumerable: true, get: function () { return appAssertions_1.OXY_APP_ASSERTION_TYPE; } });
38
+ const applicationIdSchema = zod_1.z.string().trim().min(1).max(255);
39
+ const base64Url32Schema = zod_1.z.string().regex(/^[A-Za-z0-9_-]{43}$/);
40
+ const base64Schema = (max) => zod_1.z
41
+ .string()
42
+ .min(4)
43
+ .max(max)
44
+ .regex(/^[A-Za-z0-9+/]+={0,2}$/);
45
+ exports.appAssertionPlatformSchema = zod_1.z.enum(appAssertions_1.APP_ASSERTION_PLATFORMS);
46
+ exports.appAssertionErrorCodeSchema = zod_1.z.enum(appAssertions_1.APP_ASSERTION_ERROR_CODES);
47
+ // ---------------------------------------------------------------------------
48
+ // Registry
49
+ // ---------------------------------------------------------------------------
50
+ /** True for an exact origin: `https:`, no path, query, fragment or credentials, in canonical form. */
51
+ function isExactHttpsOrigin(value) {
52
+ try {
53
+ const url = new URL(value);
54
+ return url.protocol === 'https:' && url.origin === value;
55
+ }
56
+ catch {
57
+ return false;
58
+ }
59
+ }
60
+ /** An exact `https://` origin, in the form a browser sends in `Origin` (`https://mention.earth`). */
61
+ exports.applicationWebOriginSchema = zod_1.z
62
+ .string()
63
+ .max(255)
64
+ .refine(isExactHttpsOrigin, 'Must be an exact https origin, as a browser sends it');
65
+ /** A Java-style Android application id, at least two segments. */
66
+ exports.androidPackageNameSchema = zod_1.z
67
+ .string()
68
+ .max(255)
69
+ .regex(/^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)+$/, 'Must be an Android package name');
70
+ /** A signing certificate's SHA-256, 64 lowercase hex characters (keytool's digest without colons). */
71
+ exports.signingCertSha256Schema = zod_1.z
72
+ .string()
73
+ .regex(/^[0-9a-f]{64}$/, 'Must be 64 lowercase hex characters');
74
+ /** An Apple Developer team id. */
75
+ exports.appleTeamIdSchema = zod_1.z.string().regex(/^[A-Z0-9]{10}$/, 'Must be an Apple team id');
76
+ /** An Apple bundle id. */
77
+ exports.appleBundleIdSchema = zod_1.z
78
+ .string()
79
+ .max(255)
80
+ .regex(/^[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/, 'Must be an Apple bundle id');
81
+ const unique = (values) => new Set(values).size === values.length;
82
+ exports.applicationAndroidRecognitionSchema = zod_1.z
83
+ .object({
84
+ packageName: exports.androidPackageNameSchema,
85
+ signingCertSha256: zod_1.z
86
+ .array(exports.signingCertSha256Schema)
87
+ .min(1)
88
+ .max(10)
89
+ .refine(unique, 'Certificates must be unique'),
90
+ })
91
+ .strict();
92
+ exports.applicationIosRecognitionSchema = zod_1.z
93
+ .object({ teamId: exports.appleTeamIdSchema, bundleId: exports.appleBundleIdSchema })
94
+ .strict();
95
+ /**
96
+ * What Oxy staff write for an application: the whole declaration, replaced at
97
+ * once. `null` and `[]` declare nothing for that platform.
98
+ */
99
+ exports.applicationRecognitionWriteSchema = zod_1.z
100
+ .object({
101
+ webOrigins: zod_1.z
102
+ .array(exports.applicationWebOriginSchema)
103
+ .max(20)
104
+ .refine(unique, 'Origins must be unique'),
105
+ android: exports.applicationAndroidRecognitionSchema.nullable(),
106
+ ios: exports.applicationIosRecognitionSchema.nullable(),
107
+ })
108
+ .strict();
109
+ /** An application's recognition as the registry holds it; `updatedAt` is `null` when none was written. */
110
+ exports.applicationRecognitionSchema = exports.applicationRecognitionWriteSchema
111
+ .extend({
112
+ applicationId: applicationIdSchema,
113
+ updatedAt: zod_1.z.string().datetime().nullable(),
114
+ })
115
+ .strict();
116
+ // ---------------------------------------------------------------------------
117
+ // The exchange
118
+ // ---------------------------------------------------------------------------
119
+ /** `POST /apps/assertions/challenge`: a single-use challenge for a device proof. */
120
+ exports.appAssertionChallengeRequestSchema = zod_1.z.discriminatedUnion('platform', [
121
+ zod_1.z.object({ applicationId: applicationIdSchema, platform: zod_1.z.literal('android') }).strict(),
122
+ zod_1.z
123
+ .object({
124
+ applicationId: applicationIdSchema,
125
+ platform: zod_1.z.literal('ios'),
126
+ purpose: zod_1.z.enum(appAssertions_1.APP_ASSERTION_CHALLENGE_PURPOSES),
127
+ })
128
+ .strict(),
129
+ ]);
130
+ /**
131
+ * The challenge, and `requestHash`: what the device signs or hands to Play
132
+ * Integrity, binding the challenge to this application, platform, purpose and
133
+ * session. `cloudProjectNumber` is the Google Cloud project Play Integrity
134
+ * tokens are requested for (Android only).
135
+ */
136
+ exports.appAssertionChallengeResponseSchema = zod_1.z
137
+ .object({
138
+ challenge: base64Url32Schema,
139
+ requestHash: base64Url32Schema,
140
+ expiresAt: zod_1.z.string().datetime(),
141
+ cloudProjectNumber: zod_1.z
142
+ .string()
143
+ .regex(/^[0-9]{1,20}$/)
144
+ .optional(),
145
+ })
146
+ .strict();
147
+ /** An App Attest key id: the standard base64 of the SHA-256 of the key. */
148
+ exports.appAttestKeyIdSchema = zod_1.z.string().regex(/^[A-Za-z0-9+/]{43}=$/);
149
+ /** `POST /apps/attest-keys`: register an App Attest key, attested over a `attest_key` challenge. */
150
+ exports.appAttestKeyRequestSchema = zod_1.z
151
+ .object({
152
+ applicationId: applicationIdSchema,
153
+ keyId: exports.appAttestKeyIdSchema,
154
+ challenge: base64Url32Schema,
155
+ attestation: base64Schema(32768),
156
+ })
157
+ .strict();
158
+ exports.appAttestKeyResponseSchema = zod_1.z.object({ keyId: exports.appAttestKeyIdSchema }).strict();
159
+ /**
160
+ * `POST /apps/assertions`. The body names the application and the platform;
161
+ * the proof is the platform's: none on the web (the browser's `Origin` is), a
162
+ * Play Integrity token on Android, an App Attest assertion on iOS, each over a
163
+ * challenge minted for `assertion`.
164
+ */
165
+ exports.appAssertionRequestSchema = zod_1.z.discriminatedUnion('platform', [
166
+ zod_1.z.object({ applicationId: applicationIdSchema, platform: zod_1.z.literal('web') }).strict(),
167
+ zod_1.z
168
+ .object({
169
+ applicationId: applicationIdSchema,
170
+ platform: zod_1.z.literal('android'),
171
+ proof: zod_1.z
172
+ .object({
173
+ challenge: base64Url32Schema,
174
+ integrityToken: zod_1.z.string().min(1).max(16384),
175
+ })
176
+ .strict(),
177
+ })
178
+ .strict(),
179
+ zod_1.z
180
+ .object({
181
+ applicationId: applicationIdSchema,
182
+ platform: zod_1.z.literal('ios'),
183
+ proof: zod_1.z
184
+ .object({
185
+ challenge: base64Url32Schema,
186
+ keyId: exports.appAttestKeyIdSchema,
187
+ assertion: base64Schema(4096),
188
+ })
189
+ .strict(),
190
+ })
191
+ .strict(),
192
+ ]);
193
+ /** The assertion, and what it says. Send it as {@link OXY_APP_ASSERTION_HEADER}. */
194
+ exports.appAssertionResponseSchema = zod_1.z
195
+ .object({
196
+ assertion: zod_1.z.string().regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/),
197
+ applicationId: zod_1.z.string().regex(/^\S{1,255}$/),
198
+ platform: exports.appAssertionPlatformSchema,
199
+ expiresAt: zod_1.z.string().datetime(),
200
+ })
201
+ .strict();
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ /**
3
+ * App assertions (ADR 0045), without Zod. Schemas: `../appAssertions.ts`.
4
+ *
5
+ * An Oxy app proves which app it is by trading platform evidence (the browser's
6
+ * `Origin`, a Play Integrity verdict, an App Attest assertion) for a short-lived
7
+ * `OXY-APP+JWT` signed by Oxy. A service that needs to know the app reads it
8
+ * from {@link OXY_APP_ASSERTION_HEADER} and verifies it against Oxy's JWKS
9
+ * (`verifyAppAssertion` in `@oxy.so/core/server`).
10
+ *
11
+ * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.appAssertionResponseCheck = exports.appAttestKeyResponseCheck = exports.appAssertionChallengeResponseCheck = exports.APP_ASSERTION_ERROR_CODES = exports.OXY_APP_ASSERTION_TTL_SECONDS = exports.OXY_APP_ASSERTION_HEADER = exports.OXY_APP_ASSERTION_AUDIENCE = exports.OXY_APP_ASSERTION_TYPE = exports.APP_ASSERTION_CHALLENGE_PURPOSES = exports.APP_ASSERTION_PLATFORMS = void 0;
15
+ const check_1 = require("./check");
16
+ /** How an app proves itself: the browser's origin, Play Integrity, or App Attest. */
17
+ exports.APP_ASSERTION_PLATFORMS = ['web', 'android', 'ios'];
18
+ /**
19
+ * What a device challenge is spent on: an assertion, or (iOS only) registering
20
+ * an App Attest key. A challenge minted for one is refused for the other.
21
+ */
22
+ exports.APP_ASSERTION_CHALLENGE_PURPOSES = ['assertion', 'attest_key'];
23
+ /** The JOSE `typ` of an app assertion. No other Oxy token carries it. */
24
+ exports.OXY_APP_ASSERTION_TYPE = 'OXY-APP+JWT';
25
+ /** The `aud` of every app assertion. */
26
+ exports.OXY_APP_ASSERTION_AUDIENCE = 'oxy-apps';
27
+ /** The request header an app (or an SDK acting for it) sends the assertion in. */
28
+ exports.OXY_APP_ASSERTION_HEADER = 'X-Oxy-App-Assertion';
29
+ /** Oxy signs an app assertion for exactly this long. */
30
+ exports.OXY_APP_ASSERTION_TTL_SECONDS = 300;
31
+ /**
32
+ * Why Oxy refused an app assertion, a challenge or an App Attest key. The API
33
+ * answers `{ error: <code>, message }`.
34
+ *
35
+ * - `application_unavailable`: no active application has that id.
36
+ * - `session_other_application`: the bearer's session belongs to another application.
37
+ * - `platform_not_registered`: the application declares no recognition for that platform.
38
+ * - `origin_not_registered`: the request's `Origin` is not one of the application's web origins.
39
+ * - `challenge_invalid`: the challenge is unknown, used, expired, or minted for something else.
40
+ * - `integrity_refused`: the Play Integrity verdict does not name this app, a registered
41
+ * certificate, a Play-recognised install and this challenge.
42
+ * - `integrity_unconfigured` / `integrity_unavailable`: Oxy cannot ask Google (503).
43
+ * - `attest_key_unknown`: no App Attest key with that id is registered for the app; attest a new one.
44
+ * - `attest_key_exists`: that App Attest key is already registered.
45
+ * - `attestation_invalid`: the App Attest attestation does not verify.
46
+ * - `assertion_invalid`: the App Attest assertion does not verify, or its counter did not advance.
47
+ * - `signing_unavailable`: Oxy cannot sign (503).
48
+ */
49
+ exports.APP_ASSERTION_ERROR_CODES = [
50
+ 'application_unavailable',
51
+ 'session_other_application',
52
+ 'platform_not_registered',
53
+ 'origin_not_registered',
54
+ 'challenge_invalid',
55
+ 'integrity_refused',
56
+ 'integrity_unconfigured',
57
+ 'integrity_unavailable',
58
+ 'attest_key_unknown',
59
+ 'attest_key_exists',
60
+ 'attestation_invalid',
61
+ 'assertion_invalid',
62
+ 'signing_unavailable',
63
+ ];
64
+ /** 32 random bytes, base64url: a challenge, or the SHA-256 it is bound into. */
65
+ const BASE64URL_32 = /^[A-Za-z0-9_-]{43}$/;
66
+ /** An App Attest key id: the standard base64 of a SHA-256. */
67
+ const APP_ATTEST_KEY_ID = /^[A-Za-z0-9+/]{43}=$/;
68
+ exports.appAssertionChallengeResponseCheck = (0, check_1.exact)()((0, check_1.strictObject)({
69
+ challenge: (0, check_1.string)((0, check_1.pattern)(BASE64URL_32)),
70
+ requestHash: (0, check_1.string)((0, check_1.pattern)(BASE64URL_32)),
71
+ expiresAt: (0, check_1.string)(check_1.datetime),
72
+ cloudProjectNumber: (0, check_1.optional)((0, check_1.string)((0, check_1.pattern)(/^[0-9]{1,20}$/))),
73
+ }));
74
+ exports.appAttestKeyResponseCheck = (0, check_1.exact)()((0, check_1.strictObject)({ keyId: (0, check_1.string)((0, check_1.pattern)(APP_ATTEST_KEY_ID)) }));
75
+ exports.appAssertionResponseCheck = (0, check_1.exact)()((0, check_1.strictObject)({
76
+ assertion: (0, check_1.string)((0, check_1.pattern)(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/)),
77
+ applicationId: (0, check_1.string)((0, check_1.pattern)(/^\S{1,255}$/)),
78
+ platform: (0, check_1.oneOf)(exports.APP_ASSERTION_PLATFORMS),
79
+ expiresAt: (0, check_1.string)(check_1.datetime),
80
+ }));
@@ -17,9 +17,9 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.deviceJoinCodeResponseCheck = exports.deviceBackgroundCredentialResponseCheck = exports.activeTokenCheck = exports.SESSION_ACCOUNTS_CHANGED_EVENT = exports.deviceDirectorySyncCheck = exports.deviceDirectoryCheck = exports.deviceActivateResponseCheck = exports.signedRecordEnvelopeCheck = exports.externalIdentityReferenceCheck = exports.loginResultCheck = exports.isLoopbackOrigin = exports.executeAgentKeyOperationCheck = exports.agentVerifyRequestCheck = exports.agentProofClaimsCheck = exports.agentKeyOperationResultCheck = exports.agentKeyOperationCheck = exports.agentKeyOperationChallengeCheck = exports.agentKeyListResponseCheck = exports.agentChallengeRequestCheck = exports.AGENT_PROOF_TTL_MS = exports.AGENT_PROOF_AUDIENCE = exports.AGENT_PROOF_ACTIONS = exports.ACCOUNT_AUTH_METHODS = exports.emailVerificationStartResponseCheck = exports.emailVerificationConfirmResponseCheck = exports.emailTicketCheck = exports.emailAddressCheck = exports.EMAIL_VERIFICATION_PURPOSES = exports.EMAIL_VERIFICATION_ERROR_CODES = exports.EMAIL_TICKET_TTL_MS = exports.EMAIL_CODE_TTL_MS = exports.EMAIL_CODE_MAX_ATTEMPTS = exports.EMAIL_CODE_LENGTH = exports.newlyAddedRetiredCategories = exports.kindAcceptsAccountCategories = exports.isSelectableAccountCategoryId = exports.isOperatorSwitchTargetKind = exports.isDelegatedActAsEligibleKind = exports.isAccountKind = exports.SELECTABLE_ACCOUNT_CATEGORY_IDS = exports.RETIRED_ACCOUNT_CATEGORY_IDS = exports.MAX_ACCOUNT_CATEGORIES = exports.CHILD_ACCOUNT_KINDS = exports.ACCOUNT_KINDS = exports.ACCOUNT_CATEGORY_KINDS = exports.ACCOUNT_CATEGORY_IDS = exports.parseContract = exports.formatCheckPath = exports.checkContract = exports.ContractCheckError = void 0;
20
- exports.subjectProductAccessCheck = exports.productSubscriptionsResponseCheck = exports.productSubscriptionCancellationResultCheck = exports.personalPlanCheckoutResultCheck = exports.personalPlanCheckoutRequestCheck = exports.personalPlanCatalogueCheck = exports.cancelProductSubscriptionCheck = exports.updateOrganizationCheck = exports.organizationNameCheck = exports.organizationListCheck = exports.organizationImportBatchResultCheck = exports.organizationExternalResolutionCheck = exports.organizationExternalCheck = exports.organizationCurationResultCheck = exports.organizationClaimReviewCheck = exports.organizationClaimListCheck = exports.organizationClaimInputCheck = exports.organizationClaimDetailCheck = exports.organizationClaimCheck = exports.organizationCheck = exports.organizationBatchCheck = exports.createOrganizationCheck = exports.ORGANIZATION_TYPES = exports.ORGANIZATION_STATUSES = exports.ORGANIZATION_NAME_MAX_LENGTH = exports.ORGANIZATION_ERROR_CODES = exports.ORGANIZATION_CLAIM_STATUSES = exports.ORGANIZATION_CLAIM_DECISIONS = exports.ORGANIZATION_ALIAS_KINDS = exports.canonicalJson = exports.buildIdentityProofMessage = exports.IDENTITY_PROOF_VERSION = exports.IDENTITY_PROOF_DOMAIN = exports.IDENTITY_PROOF_CHALLENGE_TTL_MS = exports.IDENTITY_PROOF_AUDIENCE = exports.IDENTITY_PROOF_ACTION_VALUES = exports.IDENTITY_PROOF_ACTIONS = exports.IDENTITY_ERROR_CODES = exports.parseIdentityLinkQrPayload = exports.identityLinkStateCheck = exports.identityLinkCreateResponseCheck = exports.buildIdentityLinkQrPayload = exports.IDENTITY_LINK_STATUSES = exports.IDENTITY_LINK_QR_PREFIX = exports.sessionAccountsChangedEventCheck = exports.deviceTokenMintResponseCheck = exports.deviceSessionSyncCheck = exports.deviceSessionStateCheck = exports.deviceRegisterResponseCheck = exports.deviceJoinResponseCheck = void 0;
21
- exports.secondFactorRequiredCheck = exports.reauthProofCheck = exports.normalizeEmailSignInCode = exports.isSecondFactorRequired = exports.isEmailSignInChooseAccount = exports.emailSignInStartResponseCheck = exports.emailSignInPendingCheck = exports.emailSignInLinkResponseCheck = exports.emailSignInChooseAccountCheck = exports.TOTP_PERIOD_SECONDS = exports.TOTP_DIGITS = exports.TOTP_BACKUP_CODE_COUNT = exports.SIGN_IN_ERROR_CODES = exports.SIGNIN_SECOND_FACTOR_TTL_MS = exports.SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS = exports.REAUTH_ACTIONS = exports.PASSWORD_MIN_LENGTH = exports.PASSWORD_MAX_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_ALPHABET = exports.EMAIL_SIGNIN_LINK_TTL_MS = exports.EMAIL_SIGNIN_CHOICE_TTL_MS = exports.EMAIL_ACCOUNTS_MAX = exports.publicApplicationCheck = exports.supervisionStateCheck = exports.supervisionReviewInputCheck = exports.supervisionInviteInputCheck = exports.supervisionInvitationCheck = exports.supervisionContactsResponseCheck = exports.supervisionContactInputCheck = exports.supervisionAcceptInputCheck = exports.safetyPeopleResponseCheck = exports.safetyPeopleInputCheck = exports.safetyOrganizationsResponseCheck = exports.safetyOrganizationsInputCheck = exports.purchaseReviewInputCheck = exports.purchaseApprovalListCheck = exports.purchaseApprovalCheck = exports.profileAccessInputCheck = exports.profileAccessDecisionCheck = exports.SUPERVISION_STATUSES = exports.SUPERVISION_INVITATION_STATUSES = exports.SUPERVISION_CONSENT_VERSION = exports.SUPERVISED_ACTIONS = exports.SAFETY_POLICY_VERSION = exports.PURCHASE_APPROVAL_STATUSES = exports.isFullReputationBalance = exports.recommendationRequestCheck = exports.subscriptionCreditGrantsResponseCheck = exports.subjectProductAccessQueryCheck = void 0;
22
- exports.isRightsClaim = exports.isErasureRequest = exports.OPEN_CONTENT_CLAIM_STATES = exports.ERASURE_REQUEST_DEADLINE_DAYS = exports.COUNTER_NOTICE_STATEMENTS = exports.COUNTER_NOTICE_STATEMENT_VERSION = exports.CONTENT_CLAIM_STATES = exports.CONTENT_CLAIM_REFERENCE_PATTERN = exports.CONTENT_CLAIM_LIMITS = exports.CONTENT_CLAIM_KINDS = exports.CONTENT_CLAIM_ERROR_CODES = exports.CONTENT_CLAIM_COUNTER_NOTICE_LIMITS = exports.CLOSED_CONTENT_CLAIM_STATES = exports.CLAIMANT_RELATIONSHIPS = exports.userNameCheck = exports.usernameCheckForAccountKind = exports.usernameCheck = exports.stripDisallowedUsernameCharacters = exports.botUsernameCheck = exports.applyBotUsernameSuffix = exports.USERNAME_PATTERN_SOURCE = exports.USERNAME_MIN_LENGTH = exports.USERNAME_MAX_LENGTH = exports.USERNAME_INVALID_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.RESERVED_USERNAMES = exports.NUMERIC_USERNAME_MESSAGE = exports.BOT_USERNAME_SUFFIX = exports.BOT_USERNAME_INVALID_MESSAGE = exports.totpEnrollResponseCheck = exports.totpBackupCodesResponseCheck = exports.signInMethodsCheck = void 0;
20
+ exports.productSubscriptionCancellationResultCheck = exports.productPlanCheckoutRequestCheck = exports.productPlanCatalogueCheck = exports.personalPlanCheckoutResultCheck = exports.personalPlanCheckoutRequestCheck = exports.personalPlanCatalogueCheck = exports.cancelProductSubscriptionCheck = exports.updateOrganizationCheck = exports.organizationNameCheck = exports.organizationListCheck = exports.organizationImportBatchResultCheck = exports.organizationExternalResolutionCheck = exports.organizationExternalCheck = exports.organizationCurationResultCheck = exports.organizationClaimReviewCheck = exports.organizationClaimListCheck = exports.organizationClaimInputCheck = exports.organizationClaimDetailCheck = exports.organizationClaimCheck = exports.organizationCheck = exports.organizationBatchCheck = exports.createOrganizationCheck = exports.ORGANIZATION_TYPES = exports.ORGANIZATION_STATUSES = exports.ORGANIZATION_NAME_MAX_LENGTH = exports.ORGANIZATION_ERROR_CODES = exports.ORGANIZATION_CLAIM_STATUSES = exports.ORGANIZATION_CLAIM_DECISIONS = exports.ORGANIZATION_ALIAS_KINDS = exports.canonicalJson = exports.buildIdentityProofMessage = exports.IDENTITY_PROOF_VERSION = exports.IDENTITY_PROOF_DOMAIN = exports.IDENTITY_PROOF_CHALLENGE_TTL_MS = exports.IDENTITY_PROOF_AUDIENCE = exports.IDENTITY_PROOF_ACTION_VALUES = exports.IDENTITY_PROOF_ACTIONS = exports.IDENTITY_ERROR_CODES = exports.parseIdentityLinkQrPayload = exports.identityLinkStateCheck = exports.identityLinkCreateResponseCheck = exports.buildIdentityLinkQrPayload = exports.IDENTITY_LINK_STATUSES = exports.IDENTITY_LINK_QR_PREFIX = exports.sessionAccountsChangedEventCheck = exports.deviceTokenMintResponseCheck = exports.deviceSessionSyncCheck = exports.deviceSessionStateCheck = exports.deviceRegisterResponseCheck = exports.deviceJoinResponseCheck = void 0;
21
+ exports.isSecondFactorRequired = exports.isEmailSignInChooseAccount = exports.emailSignInStartResponseCheck = exports.emailSignInPendingCheck = exports.emailSignInLinkResponseCheck = exports.emailSignInChooseAccountCheck = exports.TOTP_PERIOD_SECONDS = exports.TOTP_DIGITS = exports.TOTP_BACKUP_CODE_COUNT = exports.SIGN_IN_ERROR_CODES = exports.SIGNIN_SECOND_FACTOR_TTL_MS = exports.SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS = exports.REAUTH_ACTIONS = exports.PASSWORD_MIN_LENGTH = exports.PASSWORD_MAX_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_ALPHABET = exports.EMAIL_SIGNIN_LINK_TTL_MS = exports.EMAIL_SIGNIN_CHOICE_TTL_MS = exports.EMAIL_ACCOUNTS_MAX = exports.publicApplicationCheck = exports.supervisionStateCheck = exports.supervisionReviewInputCheck = exports.supervisionInviteInputCheck = exports.supervisionInvitationCheck = exports.supervisionContactsResponseCheck = exports.supervisionContactInputCheck = exports.supervisionAcceptInputCheck = exports.safetyPeopleResponseCheck = exports.safetyPeopleInputCheck = exports.safetyOrganizationsResponseCheck = exports.safetyOrganizationsInputCheck = exports.purchaseReviewInputCheck = exports.purchaseApprovalListCheck = exports.purchaseApprovalCheck = exports.profileAccessInputCheck = exports.profileAccessDecisionCheck = exports.SUPERVISION_STATUSES = exports.SUPERVISION_INVITATION_STATUSES = exports.SUPERVISION_CONSENT_VERSION = exports.SUPERVISED_ACTIONS = exports.SAFETY_POLICY_VERSION = exports.PURCHASE_APPROVAL_STATUSES = exports.isFullReputationBalance = exports.recommendationRequestCheck = exports.subscriptionCreditGrantsResponseCheck = exports.subjectProductAccessQueryCheck = exports.subjectProductAccessCheck = exports.productSubscriptionsResponseCheck = exports.productSubscriptionRenewalRequestCheck = void 0;
22
+ exports.appAttestKeyResponseCheck = exports.appAssertionResponseCheck = exports.appAssertionChallengeResponseCheck = exports.OXY_APP_ASSERTION_TYPE = exports.OXY_APP_ASSERTION_TTL_SECONDS = exports.OXY_APP_ASSERTION_HEADER = exports.OXY_APP_ASSERTION_AUDIENCE = exports.APP_ASSERTION_PLATFORMS = exports.APP_ASSERTION_ERROR_CODES = exports.APP_ASSERTION_CHALLENGE_PURPOSES = exports.isRightsClaim = exports.isErasureRequest = exports.OPEN_CONTENT_CLAIM_STATES = exports.ERASURE_REQUEST_DEADLINE_DAYS = exports.COUNTER_NOTICE_STATEMENTS = exports.COUNTER_NOTICE_STATEMENT_VERSION = exports.CONTENT_CLAIM_STATES = exports.CONTENT_CLAIM_REFERENCE_PATTERN = exports.CONTENT_CLAIM_LIMITS = exports.CONTENT_CLAIM_KINDS = exports.CONTENT_CLAIM_ERROR_CODES = exports.CONTENT_CLAIM_COUNTER_NOTICE_LIMITS = exports.CLOSED_CONTENT_CLAIM_STATES = exports.CLAIMANT_RELATIONSHIPS = exports.userNameCheck = exports.usernameCheckForAccountKind = exports.usernameCheck = exports.stripDisallowedUsernameCharacters = exports.botUsernameCheck = exports.applyBotUsernameSuffix = exports.USERNAME_PATTERN_SOURCE = exports.USERNAME_MIN_LENGTH = exports.USERNAME_MAX_LENGTH = exports.USERNAME_INVALID_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.RESERVED_USERNAMES = exports.NUMERIC_USERNAME_MESSAGE = exports.BOT_USERNAME_SUFFIX = exports.BOT_USERNAME_INVALID_MESSAGE = exports.totpEnrollResponseCheck = exports.totpBackupCodesResponseCheck = exports.signInMethodsCheck = exports.secondFactorRequiredCheck = exports.reauthProofCheck = exports.normalizeEmailSignInCode = void 0;
23
23
  var check_1 = require("./check");
24
24
  Object.defineProperty(exports, "ContractCheckError", { enumerable: true, get: function () { return check_1.ContractCheckError; } });
25
25
  Object.defineProperty(exports, "checkContract", { enumerable: true, get: function () { return check_1.checkContract; } });
@@ -131,7 +131,10 @@ Object.defineProperty(exports, "cancelProductSubscriptionCheck", { enumerable: t
131
131
  Object.defineProperty(exports, "personalPlanCatalogueCheck", { enumerable: true, get: function () { return products_1.personalPlanCatalogueCheck; } });
132
132
  Object.defineProperty(exports, "personalPlanCheckoutRequestCheck", { enumerable: true, get: function () { return products_1.personalPlanCheckoutRequestCheck; } });
133
133
  Object.defineProperty(exports, "personalPlanCheckoutResultCheck", { enumerable: true, get: function () { return products_1.personalPlanCheckoutResultCheck; } });
134
+ Object.defineProperty(exports, "productPlanCatalogueCheck", { enumerable: true, get: function () { return products_1.productPlanCatalogueCheck; } });
135
+ Object.defineProperty(exports, "productPlanCheckoutRequestCheck", { enumerable: true, get: function () { return products_1.productPlanCheckoutRequestCheck; } });
134
136
  Object.defineProperty(exports, "productSubscriptionCancellationResultCheck", { enumerable: true, get: function () { return products_1.productSubscriptionCancellationResultCheck; } });
137
+ Object.defineProperty(exports, "productSubscriptionRenewalRequestCheck", { enumerable: true, get: function () { return products_1.productSubscriptionRenewalRequestCheck; } });
135
138
  Object.defineProperty(exports, "productSubscriptionsResponseCheck", { enumerable: true, get: function () { return products_1.productSubscriptionsResponseCheck; } });
136
139
  Object.defineProperty(exports, "subjectProductAccessCheck", { enumerable: true, get: function () { return products_1.subjectProductAccessCheck; } });
137
140
  Object.defineProperty(exports, "subjectProductAccessQueryCheck", { enumerable: true, get: function () { return products_1.subjectProductAccessQueryCheck; } });
@@ -224,3 +227,14 @@ Object.defineProperty(exports, "ERASURE_REQUEST_DEADLINE_DAYS", { enumerable: tr
224
227
  Object.defineProperty(exports, "OPEN_CONTENT_CLAIM_STATES", { enumerable: true, get: function () { return contentClaims_1.OPEN_CONTENT_CLAIM_STATES; } });
225
228
  Object.defineProperty(exports, "isErasureRequest", { enumerable: true, get: function () { return contentClaims_1.isErasureRequest; } });
226
229
  Object.defineProperty(exports, "isRightsClaim", { enumerable: true, get: function () { return contentClaims_1.isRightsClaim; } });
230
+ var appAssertions_1 = require("./appAssertions");
231
+ Object.defineProperty(exports, "APP_ASSERTION_CHALLENGE_PURPOSES", { enumerable: true, get: function () { return appAssertions_1.APP_ASSERTION_CHALLENGE_PURPOSES; } });
232
+ Object.defineProperty(exports, "APP_ASSERTION_ERROR_CODES", { enumerable: true, get: function () { return appAssertions_1.APP_ASSERTION_ERROR_CODES; } });
233
+ Object.defineProperty(exports, "APP_ASSERTION_PLATFORMS", { enumerable: true, get: function () { return appAssertions_1.APP_ASSERTION_PLATFORMS; } });
234
+ Object.defineProperty(exports, "OXY_APP_ASSERTION_AUDIENCE", { enumerable: true, get: function () { return appAssertions_1.OXY_APP_ASSERTION_AUDIENCE; } });
235
+ Object.defineProperty(exports, "OXY_APP_ASSERTION_HEADER", { enumerable: true, get: function () { return appAssertions_1.OXY_APP_ASSERTION_HEADER; } });
236
+ Object.defineProperty(exports, "OXY_APP_ASSERTION_TTL_SECONDS", { enumerable: true, get: function () { return appAssertions_1.OXY_APP_ASSERTION_TTL_SECONDS; } });
237
+ Object.defineProperty(exports, "OXY_APP_ASSERTION_TYPE", { enumerable: true, get: function () { return appAssertions_1.OXY_APP_ASSERTION_TYPE; } });
238
+ Object.defineProperty(exports, "appAssertionChallengeResponseCheck", { enumerable: true, get: function () { return appAssertions_1.appAssertionChallengeResponseCheck; } });
239
+ Object.defineProperty(exports, "appAssertionResponseCheck", { enumerable: true, get: function () { return appAssertions_1.appAssertionResponseCheck; } });
240
+ Object.defineProperty(exports, "appAttestKeyResponseCheck", { enumerable: true, get: function () { return appAssertions_1.appAttestKeyResponseCheck; } });
@@ -6,7 +6,7 @@
6
6
  * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.productSubscriptionCancellationResultCheck = exports.cancelProductSubscriptionCheck = exports.subscriptionCreditGrantsResponseCheck = exports.productSubscriptionsResponseCheck = exports.personalPlanCheckoutResultCheck = exports.personalPlanCheckoutRequestCheck = exports.personalPlanCatalogueCheck = exports.subjectProductAccessCheck = exports.subjectProductAccessQueryCheck = void 0;
9
+ exports.productSubscriptionCancellationResultCheck = exports.cancelProductSubscriptionCheck = exports.subscriptionCreditGrantsResponseCheck = exports.productSubscriptionsResponseCheck = exports.personalPlanCheckoutResultCheck = exports.productSubscriptionRenewalRequestCheck = exports.productPlanCheckoutRequestCheck = exports.personalPlanCheckoutRequestCheck = exports.productPlanCatalogueCheck = exports.personalPlanCatalogueCheck = exports.subjectProductAccessCheck = exports.subjectProductAccessQueryCheck = void 0;
10
10
  const check_1 = require("./check");
11
11
  const identifier = (0, check_1.string)((0, check_1.minLength)(1), (0, check_1.maxLength)(160));
12
12
  const displayName = (0, check_1.string)((0, check_1.minLength)(1), (0, check_1.maxLength)(100));
@@ -16,6 +16,15 @@ const oxyAccountId = (0, check_1.branded)((0, check_1.string)((0, check_1.minLen
16
16
  const actionKey = (0, check_1.string)((0, check_1.minLength)(8), (0, check_1.maxLength)(160), (0, check_1.pattern)(/^[a-zA-Z0-9_-]+$/));
17
17
  const combination = (0, check_1.oneOf)(['maximum', 'sum', 'exclusive']);
18
18
  const origin = (0, check_1.oneOf)(['individual', 'bundle']);
19
+ const purchase = (0, check_1.oneOf)(['unavailable', 'available']);
20
+ const displayPrice = (interval) => (0, check_1.strictObject)({
21
+ currency: (0, check_1.string)((0, check_1.pattern)(/^[A-Z]{3}$/)),
22
+ amountMinorUnits: version,
23
+ interval,
24
+ trial: (0, check_1.literal)('none'),
25
+ taxTreatment: (0, check_1.literal)('inclusive'),
26
+ merchantTotal: (0, check_1.literal)('final'),
27
+ });
19
28
  const period = (message) => (0, check_1.refine)((0, check_1.strictObject)({ start: (0, check_1.string)(check_1.datetime), end: (0, check_1.string)(check_1.datetime) }), (value) => Date.parse(value.end) > Date.parse(value.start), message);
20
29
  const productBenefit = (0, check_1.discriminatedUnion)('kind', {
21
30
  capability: (0, check_1.strictObject)({ kind: (0, check_1.literal)('capability'), productId: identifier, key: identifier }),
@@ -60,29 +69,41 @@ exports.subjectProductAccessCheck = (0, check_1.exact)()((0, check_1.strictObjec
60
69
  exports.personalPlanCatalogueCheck = (0, check_1.exact)()((0, check_1.refine)((0, check_1.strictObject)({
61
70
  schemaVersion: (0, check_1.literal)(1),
62
71
  state: (0, check_1.oneOf)(['unconfigured', 'configured']),
63
- purchase: (0, check_1.literal)('unavailable'),
72
+ purchase,
64
73
  plans: (0, check_1.array)((0, check_1.strictObject)({
65
74
  offerId: identifier,
66
75
  offerVersion: version,
67
76
  displayName,
68
77
  audience: (0, check_1.literal)('personal'),
69
78
  kind: (0, check_1.literal)('oxy_one'),
70
- price: (0, check_1.optional)((0, check_1.strictObject)({
71
- currency: (0, check_1.string)((0, check_1.pattern)(/^[A-Z]{3}$/)),
72
- amountMinorUnits: version,
73
- interval: (0, check_1.literal)('month'),
74
- trial: (0, check_1.literal)('none'),
75
- taxTreatment: (0, check_1.literal)('inclusive'),
76
- merchantTotal: (0, check_1.literal)('final'),
77
- })),
79
+ price: (0, check_1.optional)(displayPrice((0, check_1.literal)('month'))),
78
80
  benefits: (0, check_1.array)((0, check_1.strictObject)({ displayName, benefit: productBenefit })),
79
81
  })),
80
82
  }), (value) => (value.state === 'unconfigured') === (value.plans.length === 0), 'Catalogue state must match published plans'));
81
- exports.personalPlanCheckoutRequestCheck = (0, check_1.exact)()((0, check_1.strictObject)({
83
+ exports.productPlanCatalogueCheck = (0, check_1.exact)()((0, check_1.strictObject)({
84
+ schemaVersion: (0, check_1.literal)(1),
85
+ productId: identifier,
86
+ purchase,
87
+ plans: (0, check_1.array)((0, check_1.strictObject)({
88
+ productId: identifier,
89
+ offerId: identifier,
90
+ offerVersion: version,
91
+ displayName,
92
+ price: displayPrice((0, check_1.oneOf)(['month', 'year'])),
93
+ })),
94
+ }));
95
+ const checkoutRequestShape = {
82
96
  expectedSubjectAccountId: oxyAccountId,
83
97
  offerId: identifier,
84
98
  offerVersion: version,
85
99
  idempotencyKey: actionKey,
100
+ };
101
+ exports.personalPlanCheckoutRequestCheck = (0, check_1.exact)()((0, check_1.strictObject)(checkoutRequestShape));
102
+ exports.productPlanCheckoutRequestCheck = (0, check_1.exact)()((0, check_1.strictObject)({ ...checkoutRequestShape, productId: identifier }));
103
+ exports.productSubscriptionRenewalRequestCheck = (0, check_1.exact)()((0, check_1.strictObject)({
104
+ expectedSubjectAccountId: oxyAccountId,
105
+ sourceId: identifier,
106
+ idempotencyKey: actionKey,
86
107
  }));
87
108
  exports.personalPlanCheckoutResultCheck = (0, check_1.exact)()((0, check_1.discriminatedUnion)('state', {
88
109
  unconfigured: (0, check_1.strictObject)({
@@ -114,6 +135,7 @@ exports.productSubscriptionsResponseCheck = (0, check_1.exact)()((0, check_1.str
114
135
  period: billingPeriod,
115
136
  cancelAtPeriodEnd: check_1.boolean,
116
137
  canCancel: check_1.boolean,
138
+ canRenew: (0, check_1.optional)(check_1.boolean),
117
139
  offers: (0, check_1.array)((0, check_1.strictObject)({
118
140
  segmentId: identifier,
119
141
  offerId: identifier,
package/dist/cjs/index.js CHANGED
@@ -37,9 +37,9 @@ exports.inferenceToolCallSchema = exports.inferenceContentPartSchema = exports.i
37
37
  exports.realtimeItemTruncateCommandSchema = exports.realtimeItemDeleteCommandSchema = exports.realtimeItemCreateCommandSchema = exports.realtimeSessionUpdateCommandSchema = exports.realtimeResponseParametersSchema = exports.realtimeConversationItemSchema = exports.realtimeContentPartSchema = exports.realtimeSessionRequestSchema = exports.realtimeClientMetadataSchema = exports.realtimeSessionLimitsSchema = exports.realtimeSessionConfigUpdateSchema = exports.realtimeSessionConfigSchema = exports.realtimeTranslationSchema = exports.realtimeInputTranscriptionSchema = exports.realtimeTurnDetectionSchema = exports.realtimeOutputModalitySchema = exports.realtimeAudioFormatSchema = exports.realtimeResponseIdSchema = exports.realtimeItemIdSchema = exports.realtimeCommandIdSchema = exports.MAX_REALTIME_RESUME_WINDOW_MS = exports.MAX_REALTIME_SESSION_AUDIO_BYTES = exports.MAX_REALTIME_SESSION_DURATION_MS = exports.MAX_REALTIME_AUDIO_FRAME_BASE64_LENGTH = exports.inferenceStreamEventSchema = exports.inferenceStreamDoneEventSchema = exports.inferenceFinishReasonSchema = exports.inferenceStreamErrorEventSchema = exports.inferenceStreamRouteSwitchEventSchema = exports.inferenceRouteSwitchReasonSchema = exports.inferenceRouteSwitchDetailSchema = exports.inferenceStreamUsageEventSchema = exports.inferenceStreamToolCallEventSchema = exports.inferenceStreamAudioEventSchema = exports.MAX_INFERENCE_AUDIO_BYTES = exports.inferenceAudioMediaTypeSchema = exports.inferenceStreamDeltaEventSchema = exports.inferenceStreamStartEventSchema = exports.inferenceAudioOutputParametersSchema = exports.inferenceSpeechParametersSchema = exports.inferenceRequestSchema = exports.clientRequestMetadataSchema = exports.responseFormatSchema = exports.toolChoiceSchema = exports.toolDefinitionSchema = exports.inferenceReasoningSchema = exports.samplingParametersSchema = exports.inferenceInputSchema = exports.inferenceMessageSchema = exports.inferenceMessageRoleSchema = void 0;
38
38
  exports.kaanaCredentialRotateMutationSchema = exports.kaanaCredentialCreateMutationSchema = exports.kaanaCredentialIdentitySchema = exports.kaanaCredentialOperationActionSchema = exports.kaanaCredentialOperationIdSchema = exports.kaanaCredentialHandleSchema = exports.providerConnectionScopeSchema = exports.usageRefundSchema = exports.usageRefundReasonSchema = exports.usageRefundSubjectSchema = exports.usageReceiptSchema = exports.normalizedUsageReportSchema = exports.inferenceRequestOutcomeSchema = exports.usageReservationSchema = exports.usageReservationStatusSchema = exports.usageReservationRequestSchema = exports.realtimeServerEventSchema = exports.realtimeSessionClosedEventSchema = exports.realtimeSessionCloseReasonSchema = exports.realtimeErrorEventSchema = exports.realtimeResponseDoneEventSchema = exports.realtimeResponseStatusSchema = exports.realtimeToolCallEventSchema = exports.realtimeTextDeltaEventSchema = exports.realtimeTranscriptDoneEventSchema = exports.realtimeTranscriptDeltaEventSchema = exports.realtimeTranscriptSourceSchema = exports.realtimeOutputAudioDoneEventSchema = exports.realtimeOutputAudioDeltaEventSchema = exports.realtimeResponseCreatedEventSchema = exports.realtimeInputAudioClearedEventSchema = exports.realtimeInputAudioCommittedEventSchema = exports.realtimeSpeechStoppedEventSchema = exports.realtimeSpeechStartedEventSchema = exports.realtimeItemTruncatedEventSchema = exports.realtimeItemDeletedEventSchema = exports.realtimeItemDoneEventSchema = exports.realtimeItemAddedEventSchema = exports.realtimeCommandAcceptedEventSchema = exports.realtimeSessionResumedEventSchema = exports.realtimeSessionUpdatedEventSchema = exports.realtimeSessionCreatedEventSchema = exports.realtimeClientCommandSchema = exports.realtimeSessionCloseCommandSchema = exports.realtimeSessionResumeCommandSchema = exports.realtimeResponseCancelCommandSchema = exports.realtimeResponseCreateCommandSchema = exports.realtimeInputAudioClearCommandSchema = exports.realtimeInputAudioCommitCommandSchema = exports.realtimeInputAudioAppendCommandSchema = void 0;
39
39
  exports.payAsYouGoEntitlementSchema = exports.productPlanSchema = exports.planAllowanceSchema = exports.LIVE_PRODUCT_PLAN_STATUSES = exports.productPlanStatusSchema = exports.PRODUCT_PLAN_STATUSES = exports.reconciliationReportSchema = exports.reconciliationRunSchema = exports.reconciliationDiscrepancySchema = exports.reconciliationRunStatusSchema = exports.RECONCILIATION_RUN_STATUSES = exports.reconciliationDiscrepancyKindSchema = exports.RECONCILIATION_DISCREPANCY_KINDS = exports.autoRechargeAttemptSchema = exports.autoRechargeStatusSchema = exports.AUTO_RECHARGE_STATUSES = exports.externalPaymentSchema = exports.externalPaymentKindSchema = exports.EXTERNAL_PAYMENT_KINDS = exports.externalPaymentProviderSchema = exports.EXTERNAL_PAYMENT_PROVIDERS = exports.billingInvoiceSchema = exports.billingInvoiceStatusSchema = exports.BILLING_INVOICE_STATUSES = exports.accountBillingStateSchema = exports.billingProfileSchema = exports.autoRechargeSchema = exports.billingProfileStatusSchema = exports.BILLING_PROFILE_STATUSES = exports.billingModeSchema = exports.BILLING_MODES = exports.providerConnectionSchema = exports.providerConnectionStatusSchema = exports.providerConnectionValidationSchema = exports.providerCredentialCustodyStateSchema = exports.providerCredentialValidationDeploymentSchema = exports.providerCredentialValidationOperationSchema = exports.kaanaCredentialValidationOutcomeSchema = exports.kaanaCredentialValidationFailureCodeSchema = exports.kaanaCredentialValidationOutcomeStateSchema = exports.kaanaCredentialValidationTaskSchema = exports.kaanaCredentialOutcomeSchema = exports.kaanaCredentialConflictOutcomeSchema = exports.kaanaCredentialAppliedOutcomeSchema = exports.kaanaCredentialOutcomeRequestSchema = exports.kaanaCredentialRevokeOutcomeRequestSchema = exports.kaanaCredentialRotateOutcomeRequestSchema = exports.kaanaCredentialCreateOutcomeRequestSchema = exports.kaanaCredentialMutationSchema = exports.kaanaCredentialRevokeMutationSchema = void 0;
40
- exports.resolveCatalogInvocation = exports.matchCatalogInvocation = exports.findOverlappingCatalogInvocations = exports.catalogInvocationTemplatesEquivalent = exports.catalogInvocationsOverlap = exports.catalogInvocationPathParameters = exports.normalizedAppEventSchema = exports.catalogRegistrationSchema = exports.appCapabilityCatalogSchema = exports.CATALOG_INTERNAL_TRANSPORTS = exports.catalogFeatureSchema = exports.catalogEventSchema = exports.catalogToolSchema = exports.auditEventSchema = exports.auditResultSchema = exports.policyDecisionSchema = exports.invocationPrincipalSchema = exports.capabilityTicketClaimsSchema = exports.automationDefinitionSchema = exports.automationDataFlowSchema = exports.automationActorSelectionSchema = exports.automationTriggerSchema = exports.agentRequesterCeilingSchema = exports.agentRequesterCeilingWriteSchema = exports.AGENT_REQUESTER_CEILING_AUTONOMY = exports.delegationGrantSchema = exports.capabilityTicketRequestSchema = exports.capabilityCoordinatorSchema = exports.executionAuthorizationRefSchema = exports.capabilityCatalogBindingSchema = exports.grantLimitSchema = exports.toolGrantOverrideSchema = exports.resourceRefSchema = exports.foregroundExecutionAuthorizationInputSchema = exports.executionActorRefSchema = exports.actorRefSchema = exports.capabilityPackageSchema = exports.autonomyLevelSchema = exports.CAPABILITY_PACKAGES = exports.AUTONOMY_LEVELS = exports.costCenterUsageSchema = exports.providerCostSourceSchema = exports.PROVIDER_COST_SOURCES = exports.inferenceEconomicTreatmentSchema = exports.INFERENCE_ECONOMIC_TREATMENTS = exports.productEntitlementSchema = exports.costCenterSpendSchema = exports.costCenterSchema = exports.costCenterStatusSchema = exports.COST_CENTER_STATUSES = void 0;
41
- exports.subjectProductGrantSnapshotSchema = exports.productAccessGrantSchema = exports.productSubscriptionSourceSchema = exports.productOfferSchema = exports.productBenefitSchema = exports.subjectProductAccessQuerySchema = exports.productDefinitionSchema = exports.privateAutoInferenceRequestSchema = exports.privateAutoOperationId = exports.privateAutoInputSchema = exports.privateAutoExecutionSchema = exports.privateAutoSourceApprovalSchema = exports.privateAutoPrincipalSchema = exports.PRIVATE_AUTO_QUESTION = exports.PRIVATE_AUTO_INSTRUCTIONS = exports.PRIVATE_AUTO_LIMITS = exports.PRIVATE_AUTO_REQUEST_ENVELOPE_VERSION = exports.PRIVATE_AUTO_EXECUTION_CONTRACT_VERSION = exports.scopedInferenceRequestSchema = exports.canonicalScopedExecutionJson = exports.scopedExecutionSchema = exports.scopedExecutionAudienceSchema = exports.SCOPED_REQUEST_ENVELOPE_VERSION = exports.SCOPED_EXECUTION_CONTRACT_VERSION = exports.decisionAnswersMatch = exports.decisionFitsGateway = exports.decisionInputBudget = exports.decisionFailureSchema = exports.decisionSuccessSchema = exports.decisionResultSchema = exports.decisionAnswerSchema = exports.decisionRequestSchema = exports.decisionInputSchema = exports.decisionQuestionSchema = exports.decisionEffortSchema = exports.inboxInferenceStreamEventSchema = exports.inboxThreadSummaryResponseSchema = exports.inboxSmartRepliesResponseSchema = exports.inboxNaturalSearchResponseSchema = exports.inboxInferenceTextResponseSchema = exports.inboxMessageInferenceParamsSchema = exports.inboxNaturalSearchRequestSchema = exports.INBOX_DAILY_BRIEF_SECTIONS = exports.inboxDailyBriefResponseSchema = exports.inboxDailyBriefRequestSchema = exports.inboxComposeRequestSchema = exports.emailAgentContextSchema = exports.emailContextMessageSchema = exports.emailContextMailboxSchema = exports.emailContextAddressSchema = void 0;
42
- exports.serviceTokenOptionsSchema = exports.serviceTokenScopesSchema = exports.personalPlanCatalogueSchema = exports.personalPlanDisplayPriceSchema = exports.productSubscriptionCancellationResultSchema = exports.cancelProductSubscriptionSchema = exports.subscriptionCreditGrantsResponseSchema = exports.subscriptionCreditGrantSchema = exports.productSubscriptionsResponseSchema = exports.productSubscriptionSummarySchema = exports.isLoopbackOrigin = exports.inputSatisfiesCapabilityLimits = exports.canonicalCapabilityJson = exports.meteredGenerationSchema = exports.subjectProductAccessSchema = exports.productOfferSegmentSchema = void 0;
40
+ exports.catalogInvocationPathParameters = exports.normalizedAppEventSchema = exports.catalogRegistrationSchema = exports.appCapabilityCatalogSchema = exports.CATALOG_INTERNAL_TRANSPORTS = exports.catalogFeatureSchema = exports.catalogEventSchema = exports.catalogToolSchema = exports.auditEventSchema = exports.auditResultSchema = exports.policyDecisionSchema = exports.invocationPrincipalSchema = exports.capabilityTicketClaimsSchema = exports.automationDefinitionSchema = exports.automationDataFlowSchema = exports.automationActorSelectionSchema = exports.automationTriggerSchema = exports.agentAvailabilitySchema = exports.applicationAgentSchema = exports.applicationAgentWriteSchema = exports.applicationAgentAvailabilitySchema = exports.APPLICATION_AGENT_AVAILABILITIES = exports.agentRequesterCeilingSchema = exports.agentRequesterCeilingWriteSchema = exports.AGENT_REQUESTER_CEILING_AUTONOMY = exports.delegationGrantSchema = exports.capabilityTicketRequestSchema = exports.capabilityCoordinatorSchema = exports.executionAuthorizationRefSchema = exports.capabilityCatalogBindingSchema = exports.grantLimitSchema = exports.toolGrantOverrideSchema = exports.resourceRefSchema = exports.foregroundExecutionAuthorizationInputSchema = exports.executionActorRefSchema = exports.actorRefSchema = exports.capabilityPackageSchema = exports.autonomyLevelSchema = exports.CAPABILITY_PACKAGES = exports.AUTONOMY_LEVELS = exports.costCenterUsageSchema = exports.providerCostSourceSchema = exports.PROVIDER_COST_SOURCES = exports.inferenceEconomicTreatmentSchema = exports.INFERENCE_ECONOMIC_TREATMENTS = exports.productEntitlementSchema = exports.costCenterSpendSchema = exports.costCenterSchema = exports.costCenterStatusSchema = exports.COST_CENTER_STATUSES = void 0;
41
+ exports.subjectProductAccessQuerySchema = exports.productDefinitionSchema = exports.privateAutoInferenceRequestSchema = exports.privateAutoOperationId = exports.privateAutoInputSchema = exports.privateAutoExecutionSchema = exports.privateAutoSourceApprovalSchema = exports.privateAutoPrincipalSchema = exports.PRIVATE_AUTO_QUESTION = exports.PRIVATE_AUTO_INSTRUCTIONS = exports.PRIVATE_AUTO_LIMITS = exports.PRIVATE_AUTO_REQUEST_ENVELOPE_VERSION = exports.PRIVATE_AUTO_EXECUTION_CONTRACT_VERSION = exports.scopedInferenceRequestSchema = exports.canonicalScopedExecutionJson = exports.scopedExecutionSchema = exports.scopedExecutionAudienceSchema = exports.SCOPED_REQUEST_ENVELOPE_VERSION = exports.SCOPED_EXECUTION_CONTRACT_VERSION = exports.decisionAnswersMatch = exports.decisionFitsGateway = exports.decisionInputBudget = exports.decisionFailureSchema = exports.decisionSuccessSchema = exports.decisionResultSchema = exports.decisionAnswerSchema = exports.decisionRequestSchema = exports.decisionInputSchema = exports.decisionQuestionSchema = exports.decisionEffortSchema = exports.inboxInferenceStreamEventSchema = exports.inboxThreadSummaryResponseSchema = exports.inboxSmartRepliesResponseSchema = exports.inboxNaturalSearchResponseSchema = exports.inboxInferenceTextResponseSchema = exports.inboxMessageInferenceParamsSchema = exports.inboxNaturalSearchRequestSchema = exports.INBOX_DAILY_BRIEF_SECTIONS = exports.inboxDailyBriefResponseSchema = exports.inboxDailyBriefRequestSchema = exports.inboxComposeRequestSchema = exports.emailAgentContextSchema = exports.emailContextMessageSchema = exports.emailContextMailboxSchema = exports.emailContextAddressSchema = exports.resolveCatalogInvocation = exports.matchCatalogInvocation = exports.findOverlappingCatalogInvocations = exports.catalogInvocationTemplatesEquivalent = exports.catalogInvocationsOverlap = void 0;
42
+ exports.serviceTokenOptionsSchema = exports.serviceTokenScopesSchema = exports.productPlanCatalogueSchema = exports.personalPlanCatalogueSchema = exports.personalPlanDisplayPriceSchema = exports.productSubscriptionCancellationResultSchema = exports.cancelProductSubscriptionSchema = exports.subscriptionCreditGrantsResponseSchema = exports.subscriptionCreditGrantSchema = exports.productSubscriptionsResponseSchema = exports.productSubscriptionSummarySchema = exports.isLoopbackOrigin = exports.inputSatisfiesCapabilityLimits = exports.canonicalCapabilityJson = exports.meteredGenerationSchema = exports.subjectProductAccessSchema = exports.productOfferSegmentSchema = exports.subjectProductGrantSnapshotSchema = exports.productAccessGrantSchema = exports.productSubscriptionSourceSchema = exports.productOfferSchema = exports.productBenefitSchema = void 0;
43
43
  var accountGraph_1 = require("./accountGraph");
44
44
  Object.defineProperty(exports, "ACCOUNT_KINDS", { enumerable: true, get: function () { return accountGraph_1.ACCOUNT_KINDS; } });
45
45
  Object.defineProperty(exports, "accountKindSchema", { enumerable: true, get: function () { return accountGraph_1.accountKindSchema; } });
@@ -785,6 +785,11 @@ Object.defineProperty(exports, "delegationGrantSchema", { enumerable: true, get:
785
785
  Object.defineProperty(exports, "AGENT_REQUESTER_CEILING_AUTONOMY", { enumerable: true, get: function () { return agency_1.AGENT_REQUESTER_CEILING_AUTONOMY; } });
786
786
  Object.defineProperty(exports, "agentRequesterCeilingWriteSchema", { enumerable: true, get: function () { return agency_1.agentRequesterCeilingWriteSchema; } });
787
787
  Object.defineProperty(exports, "agentRequesterCeilingSchema", { enumerable: true, get: function () { return agency_1.agentRequesterCeilingSchema; } });
788
+ Object.defineProperty(exports, "APPLICATION_AGENT_AVAILABILITIES", { enumerable: true, get: function () { return agency_1.APPLICATION_AGENT_AVAILABILITIES; } });
789
+ Object.defineProperty(exports, "applicationAgentAvailabilitySchema", { enumerable: true, get: function () { return agency_1.applicationAgentAvailabilitySchema; } });
790
+ Object.defineProperty(exports, "applicationAgentWriteSchema", { enumerable: true, get: function () { return agency_1.applicationAgentWriteSchema; } });
791
+ Object.defineProperty(exports, "applicationAgentSchema", { enumerable: true, get: function () { return agency_1.applicationAgentSchema; } });
792
+ Object.defineProperty(exports, "agentAvailabilitySchema", { enumerable: true, get: function () { return agency_1.agentAvailabilitySchema; } });
788
793
  Object.defineProperty(exports, "automationTriggerSchema", { enumerable: true, get: function () { return agency_1.automationTriggerSchema; } });
789
794
  Object.defineProperty(exports, "automationActorSelectionSchema", { enumerable: true, get: function () { return agency_1.automationActorSelectionSchema; } });
790
795
  Object.defineProperty(exports, "automationDataFlowSchema", { enumerable: true, get: function () { return agency_1.automationDataFlowSchema; } });
@@ -892,6 +897,7 @@ Object.defineProperty(exports, "productSubscriptionCancellationResultSchema", {
892
897
  var plans_1 = require("./products/plans");
893
898
  Object.defineProperty(exports, "personalPlanDisplayPriceSchema", { enumerable: true, get: function () { return plans_1.personalPlanDisplayPriceSchema; } });
894
899
  Object.defineProperty(exports, "personalPlanCatalogueSchema", { enumerable: true, get: function () { return plans_1.personalPlanCatalogueSchema; } });
900
+ Object.defineProperty(exports, "productPlanCatalogueSchema", { enumerable: true, get: function () { return plans_1.productPlanCatalogueSchema; } });
895
901
  __exportStar(require("./products/checkout"), exports);
896
902
  __exportStar(require("./organizations"), exports);
897
903
  __exportStar(require("./safety"), exports);
@@ -900,3 +906,4 @@ Object.defineProperty(exports, "serviceTokenScopesSchema", { enumerable: true, g
900
906
  Object.defineProperty(exports, "serviceTokenOptionsSchema", { enumerable: true, get: function () { return serviceToken_1.serviceTokenOptionsSchema; } });
901
907
  __exportStar(require("./applicationRoles"), exports);
902
908
  __exportStar(require("./contentClaims"), exports);
909
+ __exportStar(require("./appAssertions"), exports);
@@ -27,6 +27,7 @@ exports.productSubscriptionSummarySchema = zod_1.z
27
27
  period,
28
28
  cancelAtPeriodEnd: zod_1.z.boolean(),
29
29
  canCancel: zod_1.z.boolean(),
30
+ canRenew: zod_1.z.boolean().optional(),
30
31
  offers: zod_1.z.array(zod_1.z
31
32
  .object({
32
33
  segmentId: id,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.personalPlanCheckoutResultSchema = exports.personalPlanCheckoutRequestSchema = void 0;
3
+ exports.productSubscriptionRenewalRequestSchema = exports.productPlanCheckoutRequestSchema = exports.personalPlanCheckoutResultSchema = exports.personalPlanCheckoutRequestSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const identifiers_1 = require("../inference/identifiers");
6
6
  exports.personalPlanCheckoutRequestSchema = zod_1.z
@@ -33,3 +33,16 @@ exports.personalPlanCheckoutResultSchema = zod_1.z.discriminatedUnion('state', [
33
33
  zod_1.z.object({ state: zod_1.z.literal('closed'), intentId: zod_1.z.string().min(1).max(160) }).strict(),
34
34
  zod_1.z.object({ state: zod_1.z.literal('fulfilled'), intentId: zod_1.z.string().min(1).max(160) }).strict(),
35
35
  ]);
36
+ /** Explicit individual product offer; still owned and paid through Oxy. */
37
+ exports.productPlanCheckoutRequestSchema = exports.personalPlanCheckoutRequestSchema
38
+ .extend({
39
+ productId: zod_1.z.string().min(1).max(160),
40
+ })
41
+ .strict();
42
+ exports.productSubscriptionRenewalRequestSchema = zod_1.z
43
+ .object({
44
+ expectedSubjectAccountId: identifiers_1.oxyAccountIdSchema,
45
+ sourceId: zod_1.z.string().min(1).max(160),
46
+ idempotencyKey: exports.personalPlanCheckoutRequestSchema.shape.idempotencyKey,
47
+ })
48
+ .strict();
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.personalPlanCatalogueSchema = exports.personalPlanDisplayPriceSchema = void 0;
3
+ exports.productPlanCatalogueSchema = exports.personalPlanCatalogueSchema = exports.personalPlanDisplayPriceSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const access_1 = require("./access");
6
6
  /** Approved display terms never identify or activate a billing-provider price. */
@@ -19,7 +19,7 @@ exports.personalPlanCatalogueSchema = zod_1.z
19
19
  .object({
20
20
  schemaVersion: zod_1.z.literal(1),
21
21
  state: zod_1.z.enum(['unconfigured', 'configured']),
22
- purchase: zod_1.z.literal('unavailable'),
22
+ purchase: zod_1.z.enum(['unavailable', 'available']),
23
23
  plans: zod_1.z.array(zod_1.z
24
24
  .object({
25
25
  offerId: zod_1.z.string().min(1).max(160),
@@ -36,3 +36,19 @@ exports.personalPlanCatalogueSchema = zod_1.z
36
36
  })
37
37
  .strict()
38
38
  .refine((value) => (value.state === 'unconfigured') === (value.plans.length === 0), 'Catalogue state must match published plans');
39
+ exports.productPlanCatalogueSchema = zod_1.z
40
+ .object({
41
+ schemaVersion: zod_1.z.literal(1),
42
+ productId: zod_1.z.string().min(1).max(160),
43
+ purchase: zod_1.z.enum(['unavailable', 'available']),
44
+ plans: zod_1.z.array(zod_1.z
45
+ .object({
46
+ productId: zod_1.z.string().min(1).max(160),
47
+ offerId: zod_1.z.string().min(1).max(160),
48
+ offerVersion: zod_1.z.number().int().positive().safe(),
49
+ displayName: zod_1.z.string().min(1).max(100),
50
+ price: exports.personalPlanDisplayPriceSchema.extend({ interval: zod_1.z.enum(['month', 'year']) }),
51
+ })
52
+ .strict()),
53
+ })
54
+ .strict();