@oxyhq/contracts 0.26.0 → 0.28.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.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/accountGraph.js +4 -3
- package/dist/cjs/index.js +186 -1
- package/dist/cjs/inference/accountBilling.js +334 -0
- package/dist/cjs/inference/attribution.js +106 -0
- package/dist/cjs/inference/catalogue.js +482 -0
- package/dist/cjs/inference/entitlement.js +217 -0
- package/dist/cjs/inference/errors.js +210 -0
- package/dist/cjs/inference/identifiers.js +197 -0
- package/dist/cjs/inference/money.js +188 -0
- package/dist/cjs/inference/priceVersion.js +110 -0
- package/dist/cjs/inference/providerConnection.js +142 -0
- package/dist/cjs/inference/request.js +288 -0
- package/dist/cjs/inference/routingPolicy.js +213 -0
- package/dist/cjs/inference/streamEvents.js +219 -0
- package/dist/cjs/inference/usage.js +297 -0
- package/dist/cjs/inference/version.js +85 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/accountGraph.js +4 -3
- package/dist/esm/index.js +54 -0
- package/dist/esm/inference/accountBilling.js +331 -0
- package/dist/esm/inference/attribution.js +103 -0
- package/dist/esm/inference/catalogue.js +479 -0
- package/dist/esm/inference/entitlement.js +214 -0
- package/dist/esm/inference/errors.js +207 -0
- package/dist/esm/inference/identifiers.js +194 -0
- package/dist/esm/inference/money.js +185 -0
- package/dist/esm/inference/priceVersion.js +107 -0
- package/dist/esm/inference/providerConnection.js +139 -0
- package/dist/esm/inference/request.js +285 -0
- package/dist/esm/inference/routingPolicy.js +210 -0
- package/dist/esm/inference/streamEvents.js +216 -0
- package/dist/esm/inference/usage.js +294 -0
- package/dist/esm/inference/version.js +82 -0
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/accountGraph.d.ts +6 -5
- package/dist/types/index.d.ts +27 -0
- package/dist/types/inference/accountBilling.d.ts +738 -0
- package/dist/types/inference/attribution.d.ts +176 -0
- package/dist/types/inference/catalogue.d.ts +1612 -0
- package/dist/types/inference/entitlement.d.ts +519 -0
- package/dist/types/inference/errors.d.ts +206 -0
- package/dist/types/inference/identifiers.d.ts +157 -0
- package/dist/types/inference/money.d.ts +185 -0
- package/dist/types/inference/priceVersion.d.ts +182 -0
- package/dist/types/inference/providerConnection.d.ts +297 -0
- package/dist/types/inference/request.d.ts +2364 -0
- package/dist/types/inference/routingPolicy.d.ts +426 -0
- package/dist/types/inference/streamEvents.d.ts +906 -0
- package/dist/types/inference/usage.d.ts +1139 -0
- package/dist/types/inference/version.d.ts +82 -0
- package/package.json +1 -1
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product entitlements — the interface a first-party product (Alia) queries to
|
|
3
|
+
* learn what an account is entitled to, WITHOUT learning anything it could
|
|
4
|
+
* mistake for a balance.
|
|
5
|
+
*
|
|
6
|
+
* ## The separation this file is
|
|
7
|
+
*
|
|
8
|
+
* #972 states the failure mode outright: confusing a product subscription with
|
|
9
|
+
* pay-as-you-go inference usage. So the two live in disjoint shapes here, and
|
|
10
|
+
* the separation is structural rather than documented:
|
|
11
|
+
*
|
|
12
|
+
* - {@link productEntitlementSchema} carries PLAN and ALLOWANCES. Allowances
|
|
13
|
+
* are whole integer counts of a product entitlement (API credits, included
|
|
14
|
+
* requests) — `z.number().int()`, never `exactDecimalSchema`, so an allowance
|
|
15
|
+
* is not even the same TYPE as money and cannot be added to one.
|
|
16
|
+
* - `accountBalanceSchema` (in `accountBilling.ts`) carries MONEY, as exact
|
|
17
|
+
* decimal strings.
|
|
18
|
+
*
|
|
19
|
+
* There is no field anywhere that is both, and no schema that sums them. A
|
|
20
|
+
* consumer wanting "what can this account do right now" reads both sections and
|
|
21
|
+
* presents both; a consumer that only wanted one is not handed the other in a
|
|
22
|
+
* form it can accidentally arithmetic.
|
|
23
|
+
*
|
|
24
|
+
* ## Allowances do not change what a request COSTS
|
|
25
|
+
*
|
|
26
|
+
* An Alia plan may include an allowance of inference. Oxy still records the
|
|
27
|
+
* exact underlying cost of every request against the account's ledger — the
|
|
28
|
+
* allowance is a PRODUCT-side entitlement that decides what Alia charges its
|
|
29
|
+
* user, not a discount applied to the receipt. That is why
|
|
30
|
+
* {@link productEntitlementSchema} names no price and no currency: a plan that
|
|
31
|
+
* could restate the cost of a request would be a second pricing authority, and
|
|
32
|
+
* a receipt has exactly one.
|
|
33
|
+
*
|
|
34
|
+
* ## Cost centres
|
|
35
|
+
*
|
|
36
|
+
* A first-party cost centre IS an Oxy project account — `users.kind` already has
|
|
37
|
+
* `project`, and an application's `ownerAccountId` already points at one. So a
|
|
38
|
+
* cost centre adds a LABEL and a slug to an account rather than a parallel
|
|
39
|
+
* hierarchy, which is the epic's "do not add a second organization model" rule
|
|
40
|
+
* applied to internal accounting.
|
|
41
|
+
*
|
|
42
|
+
* Decided in: docs/adr/0014-account-billing-and-entitlements.md.
|
|
43
|
+
*/
|
|
44
|
+
import { z } from 'zod';
|
|
45
|
+
/**
|
|
46
|
+
* The statuses a subscription may be mirrored in.
|
|
47
|
+
*
|
|
48
|
+
* All of the processor's, not just the ones this platform sells: a mirror that
|
|
49
|
+
* cannot represent what it mirrors freezes at its previous value, and a
|
|
50
|
+
* subscription the processor moved to `paused` would keep granting a plan
|
|
51
|
+
* nobody is paying for.
|
|
52
|
+
*/
|
|
53
|
+
export declare const PRODUCT_PLAN_STATUSES: readonly ["active", "canceled", "incomplete", "incomplete_expired", "past_due", "paused", "trialing", "unpaid"];
|
|
54
|
+
export declare const productPlanStatusSchema: z.ZodEnum<["active", "canceled", "incomplete", "incomplete_expired", "past_due", "paused", "trialing", "unpaid"]>;
|
|
55
|
+
/**
|
|
56
|
+
* The statuses that mean the plan is LIVE.
|
|
57
|
+
*
|
|
58
|
+
* Exported because "is this entitlement in force" must have one answer across
|
|
59
|
+
* Oxy and every product consuming it — a consumer deriving its own list is how
|
|
60
|
+
* `past_due` comes to be honoured in one place and refused in another.
|
|
61
|
+
*/
|
|
62
|
+
export declare const LIVE_PRODUCT_PLAN_STATUSES: readonly ["active", "trialing"];
|
|
63
|
+
/**
|
|
64
|
+
* One allowance included in a plan.
|
|
65
|
+
*
|
|
66
|
+
* `remaining` is optional and absent means "not metered against this allowance
|
|
67
|
+
* here" — NOT zero. A consumer that read an absent allowance as exhausted would
|
|
68
|
+
* refuse a user who has spent nothing.
|
|
69
|
+
*/
|
|
70
|
+
export declare const planAllowanceSchema: z.ZodObject<{
|
|
71
|
+
/** A stable machine name, e.g. `api_credits_per_month`. */
|
|
72
|
+
key: z.ZodString;
|
|
73
|
+
/** Whole units included per period. Never money. */
|
|
74
|
+
included: z.ZodNumber;
|
|
75
|
+
remaining: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
}, "strict", z.ZodTypeAny, {
|
|
77
|
+
key: string;
|
|
78
|
+
included: number;
|
|
79
|
+
remaining?: number | undefined;
|
|
80
|
+
}, {
|
|
81
|
+
key: string;
|
|
82
|
+
included: number;
|
|
83
|
+
remaining?: number | undefined;
|
|
84
|
+
}>;
|
|
85
|
+
/**
|
|
86
|
+
* The plan an account is on, if any.
|
|
87
|
+
*
|
|
88
|
+
* `price` is deliberately absent. What a customer pays for their plan is the
|
|
89
|
+
* processor's record and this platform's `billing_transactions`; restating it
|
|
90
|
+
* here would put a second price authority in the one interface whose whole job
|
|
91
|
+
* is to keep product pricing and inference cost apart.
|
|
92
|
+
*/
|
|
93
|
+
export declare const productPlanSchema: z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
name: z.ZodString;
|
|
96
|
+
status: z.ZodEnum<["active", "canceled", "incomplete", "incomplete_expired", "past_due", "paused", "trialing", "unpaid"]>;
|
|
97
|
+
live: z.ZodBoolean;
|
|
98
|
+
currentPeriodStart: z.ZodString;
|
|
99
|
+
currentPeriodEnd: z.ZodString;
|
|
100
|
+
cancelAtPeriodEnd: z.ZodBoolean;
|
|
101
|
+
allowances: z.ZodArray<z.ZodObject<{
|
|
102
|
+
/** A stable machine name, e.g. `api_credits_per_month`. */
|
|
103
|
+
key: z.ZodString;
|
|
104
|
+
/** Whole units included per period. Never money. */
|
|
105
|
+
included: z.ZodNumber;
|
|
106
|
+
remaining: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
}, "strict", z.ZodTypeAny, {
|
|
108
|
+
key: string;
|
|
109
|
+
included: number;
|
|
110
|
+
remaining?: number | undefined;
|
|
111
|
+
}, {
|
|
112
|
+
key: string;
|
|
113
|
+
included: number;
|
|
114
|
+
remaining?: number | undefined;
|
|
115
|
+
}>, "many">;
|
|
116
|
+
}, "strict", z.ZodTypeAny, {
|
|
117
|
+
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "trialing" | "unpaid";
|
|
118
|
+
name: string;
|
|
119
|
+
id: string;
|
|
120
|
+
live: boolean;
|
|
121
|
+
currentPeriodStart: string;
|
|
122
|
+
currentPeriodEnd: string;
|
|
123
|
+
cancelAtPeriodEnd: boolean;
|
|
124
|
+
allowances: {
|
|
125
|
+
key: string;
|
|
126
|
+
included: number;
|
|
127
|
+
remaining?: number | undefined;
|
|
128
|
+
}[];
|
|
129
|
+
}, {
|
|
130
|
+
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "trialing" | "unpaid";
|
|
131
|
+
name: string;
|
|
132
|
+
id: string;
|
|
133
|
+
live: boolean;
|
|
134
|
+
currentPeriodStart: string;
|
|
135
|
+
currentPeriodEnd: string;
|
|
136
|
+
cancelAtPeriodEnd: boolean;
|
|
137
|
+
allowances: {
|
|
138
|
+
key: string;
|
|
139
|
+
included: number;
|
|
140
|
+
remaining?: number | undefined;
|
|
141
|
+
}[];
|
|
142
|
+
}>;
|
|
143
|
+
/**
|
|
144
|
+
* The account's inference-spend position, summarised for a product consumer.
|
|
145
|
+
*
|
|
146
|
+
* A REDUCTION of `accountBillingStateSchema`, not a copy: a product asking "may
|
|
147
|
+
* this account run another request" needs to know whether spending is possible
|
|
148
|
+
* and roughly how much room is left, and does not need the bucket breakdown.
|
|
149
|
+
* `promotionalBalance` and `purchasedBalance` are still separate — the rule that
|
|
150
|
+
* a grant and a purchase are never one number does not relax because the
|
|
151
|
+
* consumer is first-party.
|
|
152
|
+
*/
|
|
153
|
+
export declare const payAsYouGoEntitlementSchema: z.ZodObject<{
|
|
154
|
+
/** The account that actually pays — the nearest ancestor with a profile. */
|
|
155
|
+
billingAccountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
|
|
156
|
+
currency: z.ZodString;
|
|
157
|
+
billingMode: z.ZodEnum<["prepaid", "invoiced"]>;
|
|
158
|
+
purchasedBalance: z.ZodBranded<z.ZodString, "ExactDecimal">;
|
|
159
|
+
promotionalBalance: z.ZodBranded<z.ZodString, "ExactDecimal">;
|
|
160
|
+
availableToSpend: z.ZodBranded<z.ZodString, "ExactDecimal">;
|
|
161
|
+
/** False when the profile is suspended, closed, or out of room. */
|
|
162
|
+
canSpend: z.ZodBoolean;
|
|
163
|
+
}, "strict", z.ZodTypeAny, {
|
|
164
|
+
currency: string;
|
|
165
|
+
billingMode: "prepaid" | "invoiced";
|
|
166
|
+
billingAccountId: string & z.BRAND<"OxyAccountId">;
|
|
167
|
+
purchasedBalance: string & z.BRAND<"ExactDecimal">;
|
|
168
|
+
promotionalBalance: string & z.BRAND<"ExactDecimal">;
|
|
169
|
+
availableToSpend: string & z.BRAND<"ExactDecimal">;
|
|
170
|
+
canSpend: boolean;
|
|
171
|
+
}, {
|
|
172
|
+
currency: string;
|
|
173
|
+
billingMode: "prepaid" | "invoiced";
|
|
174
|
+
billingAccountId: string;
|
|
175
|
+
purchasedBalance: string;
|
|
176
|
+
promotionalBalance: string;
|
|
177
|
+
availableToSpend: string;
|
|
178
|
+
canSpend: boolean;
|
|
179
|
+
}>;
|
|
180
|
+
export declare const COST_CENTER_STATUSES: readonly ["active", "retired"];
|
|
181
|
+
export declare const costCenterStatusSchema: z.ZodEnum<["active", "retired"]>;
|
|
182
|
+
/**
|
|
183
|
+
* An internal cost centre — an Oxy account that first-party spend is attributed
|
|
184
|
+
* to, with a stable slug so a report can name it without an id.
|
|
185
|
+
*
|
|
186
|
+
* The account IS the cost centre; this shape only labels it. There is no
|
|
187
|
+
* `parentId` here for the same reason: the account graph already has one, and a
|
|
188
|
+
* second parent link would be a second hierarchy that can disagree with it.
|
|
189
|
+
*/
|
|
190
|
+
export declare const costCenterSchema: z.ZodObject<{
|
|
191
|
+
/** See `version.ts`: this shape is served to Console and to Alia. */
|
|
192
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
193
|
+
accountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
|
|
194
|
+
slug: z.ZodString;
|
|
195
|
+
label: z.ZodString;
|
|
196
|
+
status: z.ZodEnum<["active", "retired"]>;
|
|
197
|
+
createdAt: z.ZodString;
|
|
198
|
+
updatedAt: z.ZodString;
|
|
199
|
+
}, "strict", z.ZodTypeAny, {
|
|
200
|
+
status: "active" | "retired";
|
|
201
|
+
accountId: string & z.BRAND<"OxyAccountId">;
|
|
202
|
+
updatedAt: string;
|
|
203
|
+
createdAt: string;
|
|
204
|
+
schemaVersion: 1;
|
|
205
|
+
slug: string;
|
|
206
|
+
label: string;
|
|
207
|
+
}, {
|
|
208
|
+
status: "active" | "retired";
|
|
209
|
+
accountId: string;
|
|
210
|
+
updatedAt: string;
|
|
211
|
+
createdAt: string;
|
|
212
|
+
schemaVersion: 1;
|
|
213
|
+
slug: string;
|
|
214
|
+
label: string;
|
|
215
|
+
}>;
|
|
216
|
+
/**
|
|
217
|
+
* What one cost centre spent over a window.
|
|
218
|
+
*
|
|
219
|
+
* `billedAmount` comes from settled receipts — the FINANCIAL ledger — never from
|
|
220
|
+
* telemetry sums, per #972 workstream 8. `requestCount` is a count of receipts,
|
|
221
|
+
* so the two are always about the same set of rows.
|
|
222
|
+
*/
|
|
223
|
+
export declare const costCenterSpendSchema: z.ZodObject<{
|
|
224
|
+
/** See `version.ts`: this shape is served to Console and to Alia. */
|
|
225
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
226
|
+
costCenter: z.ZodObject<{
|
|
227
|
+
/** See `version.ts`: this shape is served to Console and to Alia. */
|
|
228
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
229
|
+
accountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
|
|
230
|
+
slug: z.ZodString;
|
|
231
|
+
label: z.ZodString;
|
|
232
|
+
status: z.ZodEnum<["active", "retired"]>;
|
|
233
|
+
createdAt: z.ZodString;
|
|
234
|
+
updatedAt: z.ZodString;
|
|
235
|
+
}, "strict", z.ZodTypeAny, {
|
|
236
|
+
status: "active" | "retired";
|
|
237
|
+
accountId: string & z.BRAND<"OxyAccountId">;
|
|
238
|
+
updatedAt: string;
|
|
239
|
+
createdAt: string;
|
|
240
|
+
schemaVersion: 1;
|
|
241
|
+
slug: string;
|
|
242
|
+
label: string;
|
|
243
|
+
}, {
|
|
244
|
+
status: "active" | "retired";
|
|
245
|
+
accountId: string;
|
|
246
|
+
updatedAt: string;
|
|
247
|
+
createdAt: string;
|
|
248
|
+
schemaVersion: 1;
|
|
249
|
+
slug: string;
|
|
250
|
+
label: string;
|
|
251
|
+
}>;
|
|
252
|
+
currency: z.ZodString;
|
|
253
|
+
periodStart: z.ZodString;
|
|
254
|
+
periodEnd: z.ZodString;
|
|
255
|
+
billedAmount: z.ZodBranded<z.ZodString, "ExactDecimal">;
|
|
256
|
+
requestCount: z.ZodNumber;
|
|
257
|
+
}, "strict", z.ZodTypeAny, {
|
|
258
|
+
periodEnd: string;
|
|
259
|
+
currency: string;
|
|
260
|
+
schemaVersion: 1;
|
|
261
|
+
billedAmount: string & z.BRAND<"ExactDecimal">;
|
|
262
|
+
periodStart: string;
|
|
263
|
+
costCenter: {
|
|
264
|
+
status: "active" | "retired";
|
|
265
|
+
accountId: string & z.BRAND<"OxyAccountId">;
|
|
266
|
+
updatedAt: string;
|
|
267
|
+
createdAt: string;
|
|
268
|
+
schemaVersion: 1;
|
|
269
|
+
slug: string;
|
|
270
|
+
label: string;
|
|
271
|
+
};
|
|
272
|
+
requestCount: number;
|
|
273
|
+
}, {
|
|
274
|
+
periodEnd: string;
|
|
275
|
+
currency: string;
|
|
276
|
+
schemaVersion: 1;
|
|
277
|
+
billedAmount: string;
|
|
278
|
+
periodStart: string;
|
|
279
|
+
costCenter: {
|
|
280
|
+
status: "active" | "retired";
|
|
281
|
+
accountId: string;
|
|
282
|
+
updatedAt: string;
|
|
283
|
+
createdAt: string;
|
|
284
|
+
schemaVersion: 1;
|
|
285
|
+
slug: string;
|
|
286
|
+
label: string;
|
|
287
|
+
};
|
|
288
|
+
requestCount: number;
|
|
289
|
+
}>;
|
|
290
|
+
/**
|
|
291
|
+
* Everything a product needs to decide what an account may do, in one read.
|
|
292
|
+
*
|
|
293
|
+
* The three sections never merge:
|
|
294
|
+
*
|
|
295
|
+
* - `plan` + `allowances` — the product subscription.
|
|
296
|
+
* - `payAsYouGo` — inference money. `null` when the account has no billing
|
|
297
|
+
* profile anywhere up its ancestry, which is a REAL and distinct state from a
|
|
298
|
+
* zero balance: nobody has decided who pays for this account yet.
|
|
299
|
+
* - `costCenter` — where first-party spend is booked, `null` for a customer.
|
|
300
|
+
*/
|
|
301
|
+
export declare const productEntitlementSchema: z.ZodObject<{
|
|
302
|
+
/** See `version.ts`: this shape is served to Console and to Alia. */
|
|
303
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
304
|
+
accountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
|
|
305
|
+
plan: z.ZodNullable<z.ZodObject<{
|
|
306
|
+
id: z.ZodString;
|
|
307
|
+
name: z.ZodString;
|
|
308
|
+
status: z.ZodEnum<["active", "canceled", "incomplete", "incomplete_expired", "past_due", "paused", "trialing", "unpaid"]>;
|
|
309
|
+
live: z.ZodBoolean;
|
|
310
|
+
currentPeriodStart: z.ZodString;
|
|
311
|
+
currentPeriodEnd: z.ZodString;
|
|
312
|
+
cancelAtPeriodEnd: z.ZodBoolean;
|
|
313
|
+
allowances: z.ZodArray<z.ZodObject<{
|
|
314
|
+
/** A stable machine name, e.g. `api_credits_per_month`. */
|
|
315
|
+
key: z.ZodString;
|
|
316
|
+
/** Whole units included per period. Never money. */
|
|
317
|
+
included: z.ZodNumber;
|
|
318
|
+
remaining: z.ZodOptional<z.ZodNumber>;
|
|
319
|
+
}, "strict", z.ZodTypeAny, {
|
|
320
|
+
key: string;
|
|
321
|
+
included: number;
|
|
322
|
+
remaining?: number | undefined;
|
|
323
|
+
}, {
|
|
324
|
+
key: string;
|
|
325
|
+
included: number;
|
|
326
|
+
remaining?: number | undefined;
|
|
327
|
+
}>, "many">;
|
|
328
|
+
}, "strict", z.ZodTypeAny, {
|
|
329
|
+
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "trialing" | "unpaid";
|
|
330
|
+
name: string;
|
|
331
|
+
id: string;
|
|
332
|
+
live: boolean;
|
|
333
|
+
currentPeriodStart: string;
|
|
334
|
+
currentPeriodEnd: string;
|
|
335
|
+
cancelAtPeriodEnd: boolean;
|
|
336
|
+
allowances: {
|
|
337
|
+
key: string;
|
|
338
|
+
included: number;
|
|
339
|
+
remaining?: number | undefined;
|
|
340
|
+
}[];
|
|
341
|
+
}, {
|
|
342
|
+
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "trialing" | "unpaid";
|
|
343
|
+
name: string;
|
|
344
|
+
id: string;
|
|
345
|
+
live: boolean;
|
|
346
|
+
currentPeriodStart: string;
|
|
347
|
+
currentPeriodEnd: string;
|
|
348
|
+
cancelAtPeriodEnd: boolean;
|
|
349
|
+
allowances: {
|
|
350
|
+
key: string;
|
|
351
|
+
included: number;
|
|
352
|
+
remaining?: number | undefined;
|
|
353
|
+
}[];
|
|
354
|
+
}>>;
|
|
355
|
+
/**
|
|
356
|
+
* Allowances in force right now, whether they came from a plan or from the
|
|
357
|
+
* platform's own free tier. Whole counts; never money.
|
|
358
|
+
*/
|
|
359
|
+
allowances: z.ZodArray<z.ZodObject<{
|
|
360
|
+
/** A stable machine name, e.g. `api_credits_per_month`. */
|
|
361
|
+
key: z.ZodString;
|
|
362
|
+
/** Whole units included per period. Never money. */
|
|
363
|
+
included: z.ZodNumber;
|
|
364
|
+
remaining: z.ZodOptional<z.ZodNumber>;
|
|
365
|
+
}, "strict", z.ZodTypeAny, {
|
|
366
|
+
key: string;
|
|
367
|
+
included: number;
|
|
368
|
+
remaining?: number | undefined;
|
|
369
|
+
}, {
|
|
370
|
+
key: string;
|
|
371
|
+
included: number;
|
|
372
|
+
remaining?: number | undefined;
|
|
373
|
+
}>, "many">;
|
|
374
|
+
payAsYouGo: z.ZodNullable<z.ZodObject<{
|
|
375
|
+
/** The account that actually pays — the nearest ancestor with a profile. */
|
|
376
|
+
billingAccountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
|
|
377
|
+
currency: z.ZodString;
|
|
378
|
+
billingMode: z.ZodEnum<["prepaid", "invoiced"]>;
|
|
379
|
+
purchasedBalance: z.ZodBranded<z.ZodString, "ExactDecimal">;
|
|
380
|
+
promotionalBalance: z.ZodBranded<z.ZodString, "ExactDecimal">;
|
|
381
|
+
availableToSpend: z.ZodBranded<z.ZodString, "ExactDecimal">;
|
|
382
|
+
/** False when the profile is suspended, closed, or out of room. */
|
|
383
|
+
canSpend: z.ZodBoolean;
|
|
384
|
+
}, "strict", z.ZodTypeAny, {
|
|
385
|
+
currency: string;
|
|
386
|
+
billingMode: "prepaid" | "invoiced";
|
|
387
|
+
billingAccountId: string & z.BRAND<"OxyAccountId">;
|
|
388
|
+
purchasedBalance: string & z.BRAND<"ExactDecimal">;
|
|
389
|
+
promotionalBalance: string & z.BRAND<"ExactDecimal">;
|
|
390
|
+
availableToSpend: string & z.BRAND<"ExactDecimal">;
|
|
391
|
+
canSpend: boolean;
|
|
392
|
+
}, {
|
|
393
|
+
currency: string;
|
|
394
|
+
billingMode: "prepaid" | "invoiced";
|
|
395
|
+
billingAccountId: string;
|
|
396
|
+
purchasedBalance: string;
|
|
397
|
+
promotionalBalance: string;
|
|
398
|
+
availableToSpend: string;
|
|
399
|
+
canSpend: boolean;
|
|
400
|
+
}>>;
|
|
401
|
+
costCenter: z.ZodNullable<z.ZodObject<{
|
|
402
|
+
/** See `version.ts`: this shape is served to Console and to Alia. */
|
|
403
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
404
|
+
accountId: z.ZodBranded<z.ZodString, "OxyAccountId">;
|
|
405
|
+
slug: z.ZodString;
|
|
406
|
+
label: z.ZodString;
|
|
407
|
+
status: z.ZodEnum<["active", "retired"]>;
|
|
408
|
+
createdAt: z.ZodString;
|
|
409
|
+
updatedAt: z.ZodString;
|
|
410
|
+
}, "strict", z.ZodTypeAny, {
|
|
411
|
+
status: "active" | "retired";
|
|
412
|
+
accountId: string & z.BRAND<"OxyAccountId">;
|
|
413
|
+
updatedAt: string;
|
|
414
|
+
createdAt: string;
|
|
415
|
+
schemaVersion: 1;
|
|
416
|
+
slug: string;
|
|
417
|
+
label: string;
|
|
418
|
+
}, {
|
|
419
|
+
status: "active" | "retired";
|
|
420
|
+
accountId: string;
|
|
421
|
+
updatedAt: string;
|
|
422
|
+
createdAt: string;
|
|
423
|
+
schemaVersion: 1;
|
|
424
|
+
slug: string;
|
|
425
|
+
label: string;
|
|
426
|
+
}>>;
|
|
427
|
+
/** When this view was computed. Entitlements are eventually consistent. */
|
|
428
|
+
resolvedAt: z.ZodString;
|
|
429
|
+
}, "strict", z.ZodTypeAny, {
|
|
430
|
+
accountId: string & z.BRAND<"OxyAccountId">;
|
|
431
|
+
resolvedAt: string;
|
|
432
|
+
schemaVersion: 1;
|
|
433
|
+
allowances: {
|
|
434
|
+
key: string;
|
|
435
|
+
included: number;
|
|
436
|
+
remaining?: number | undefined;
|
|
437
|
+
}[];
|
|
438
|
+
costCenter: {
|
|
439
|
+
status: "active" | "retired";
|
|
440
|
+
accountId: string & z.BRAND<"OxyAccountId">;
|
|
441
|
+
updatedAt: string;
|
|
442
|
+
createdAt: string;
|
|
443
|
+
schemaVersion: 1;
|
|
444
|
+
slug: string;
|
|
445
|
+
label: string;
|
|
446
|
+
} | null;
|
|
447
|
+
plan: {
|
|
448
|
+
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "trialing" | "unpaid";
|
|
449
|
+
name: string;
|
|
450
|
+
id: string;
|
|
451
|
+
live: boolean;
|
|
452
|
+
currentPeriodStart: string;
|
|
453
|
+
currentPeriodEnd: string;
|
|
454
|
+
cancelAtPeriodEnd: boolean;
|
|
455
|
+
allowances: {
|
|
456
|
+
key: string;
|
|
457
|
+
included: number;
|
|
458
|
+
remaining?: number | undefined;
|
|
459
|
+
}[];
|
|
460
|
+
} | null;
|
|
461
|
+
payAsYouGo: {
|
|
462
|
+
currency: string;
|
|
463
|
+
billingMode: "prepaid" | "invoiced";
|
|
464
|
+
billingAccountId: string & z.BRAND<"OxyAccountId">;
|
|
465
|
+
purchasedBalance: string & z.BRAND<"ExactDecimal">;
|
|
466
|
+
promotionalBalance: string & z.BRAND<"ExactDecimal">;
|
|
467
|
+
availableToSpend: string & z.BRAND<"ExactDecimal">;
|
|
468
|
+
canSpend: boolean;
|
|
469
|
+
} | null;
|
|
470
|
+
}, {
|
|
471
|
+
accountId: string;
|
|
472
|
+
resolvedAt: string;
|
|
473
|
+
schemaVersion: 1;
|
|
474
|
+
allowances: {
|
|
475
|
+
key: string;
|
|
476
|
+
included: number;
|
|
477
|
+
remaining?: number | undefined;
|
|
478
|
+
}[];
|
|
479
|
+
costCenter: {
|
|
480
|
+
status: "active" | "retired";
|
|
481
|
+
accountId: string;
|
|
482
|
+
updatedAt: string;
|
|
483
|
+
createdAt: string;
|
|
484
|
+
schemaVersion: 1;
|
|
485
|
+
slug: string;
|
|
486
|
+
label: string;
|
|
487
|
+
} | null;
|
|
488
|
+
plan: {
|
|
489
|
+
status: "active" | "canceled" | "incomplete" | "incomplete_expired" | "past_due" | "paused" | "trialing" | "unpaid";
|
|
490
|
+
name: string;
|
|
491
|
+
id: string;
|
|
492
|
+
live: boolean;
|
|
493
|
+
currentPeriodStart: string;
|
|
494
|
+
currentPeriodEnd: string;
|
|
495
|
+
cancelAtPeriodEnd: boolean;
|
|
496
|
+
allowances: {
|
|
497
|
+
key: string;
|
|
498
|
+
included: number;
|
|
499
|
+
remaining?: number | undefined;
|
|
500
|
+
}[];
|
|
501
|
+
} | null;
|
|
502
|
+
payAsYouGo: {
|
|
503
|
+
currency: string;
|
|
504
|
+
billingMode: "prepaid" | "invoiced";
|
|
505
|
+
billingAccountId: string;
|
|
506
|
+
purchasedBalance: string;
|
|
507
|
+
promotionalBalance: string;
|
|
508
|
+
availableToSpend: string;
|
|
509
|
+
canSpend: boolean;
|
|
510
|
+
} | null;
|
|
511
|
+
}>;
|
|
512
|
+
export type ProductPlanStatus = z.infer<typeof productPlanStatusSchema>;
|
|
513
|
+
export type PlanAllowance = z.infer<typeof planAllowanceSchema>;
|
|
514
|
+
export type ProductPlan = z.infer<typeof productPlanSchema>;
|
|
515
|
+
export type PayAsYouGoEntitlement = z.infer<typeof payAsYouGoEntitlementSchema>;
|
|
516
|
+
export type CostCenterStatus = z.infer<typeof costCenterStatusSchema>;
|
|
517
|
+
export type CostCenter = z.infer<typeof costCenterSchema>;
|
|
518
|
+
export type CostCenterSpend = z.infer<typeof costCenterSpendSchema>;
|
|
519
|
+
export type ProductEntitlement = z.infer<typeof productEntitlementSchema>;
|