@leaflow/sdk 0.0.0-dev.422.gef294af → 0.0.0-dev.429.gf6440ec

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 (28) hide show
  1. package/dist/swas/v1/generated/functions.d.ts +1 -1
  2. package/dist/swas/v1/generated/functions.js +1 -1
  3. package/dist/swas/v1/generated/models.d.ts +52 -10
  4. package/dist/swas/v1/generated/models.js +8 -0
  5. package/dist/swas/v1/generated/schemas.zod.d.ts +3 -5
  6. package/dist/swas/v1/generated/schemas.zod.js +6 -1
  7. package/dist/swas/v1/generated/validators/catalog.zod.d.ts +8 -1
  8. package/dist/swas/v1/generated/validators/catalog.zod.js +1 -1
  9. package/dist/swas/v1/generated/validators/instance.zod.d.ts +1 -1
  10. package/dist/swas/v1/generated/validators/instanceList.zod.d.ts +1 -1
  11. package/dist/swas/v1/generated/validators/instancePrice.zod.d.ts +2 -1
  12. package/dist/swas/v1/generated/validators/instancePrice.zod.js +7 -2
  13. package/dist/swas/v1/generated/validators/listPlansParams.zod.d.ts +2 -0
  14. package/dist/swas/v1/generated/validators/listPlansParams.zod.js +2 -0
  15. package/dist/swas/v1/generated/validators/plan.zod.d.ts +10 -1
  16. package/dist/swas/v1/generated/validators/plan.zod.js +12 -1
  17. package/dist/swas/v1/generated/validators/price.zod.d.ts +2 -1
  18. package/dist/swas/v1/generated/validators/price.zod.js +7 -2
  19. package/dist/swas/v1/generated/validators/priceOption.zod.d.ts +20 -0
  20. package/dist/swas/v1/generated/validators/priceOption.zod.js +32 -0
  21. package/dist/swas/v1/generated/validators/purchase.zod.js +1 -1
  22. package/dist/swas/v1/generated/validators/purchaseCreate.zod.d.ts +0 -4
  23. package/dist/swas/v1/generated/validators/purchaseCreate.zod.js +4 -3
  24. package/dist/swas/v1/response-schemas.d.ts +1 -0
  25. package/dist/swas/v1/response-schemas.js +1 -0
  26. package/package.json +1 -1
  27. package/dist/swas/v1/generated/validators/expectedQuote.zod.d.ts +0 -14
  28. package/dist/swas/v1/generated/validators/expectedQuote.zod.js +0 -13
@@ -43,7 +43,7 @@ export type listPlansResponseError = (listPlansResponse400 | listPlansResponse40
43
43
  export type listPlansResponse = listPlansResponseSuccess | listPlansResponseError;
44
44
  export declare const getListPlansUrl: (params: ListPlansParams) => string;
45
45
  /**
46
- * Lists available plans and prices for the requested region. A plan without a price is not available to buy.
46
+ * Lists one plan per provider plan ID in the requested region. The default response preserves the single price and buyable fields. With include_prices=true, plans also contain verified price options for explicit billing-period selection. Archived snapshot prices are never offered for purchase.
47
47
  * @summary List plans
48
48
  */
49
49
  export declare const listPlans: (params: ListPlansParams, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<listPlansResponse>;
@@ -11,7 +11,7 @@ export const getListPlansUrl = (params) => {
11
11
  : `https://swas.leaflow.cloud/api/v1/catalog/plans`;
12
12
  };
13
13
  /**
14
- * Lists available plans and prices for the requested region. A plan without a price is not available to buy.
14
+ * Lists one plan per provider plan ID in the requested region. The default response preserves the single price and buyable fields. With include_prices=true, plans also contain verified price options for explicit billing-period selection. Archived snapshot prices are never offered for purchase.
15
15
  * @summary List plans
16
16
  */
17
17
  export const listPlans = async (params, options, fetchFn) => {
@@ -21,10 +21,6 @@ export type Money = string;
21
21
  * A non-negative decimal amount with at most 15 integer digits and 10 fractional digits.
22
22
  */
23
23
  export type DecimalAmount = Money & string;
24
- export interface ExpectedQuote {
25
- currency: "USD";
26
- amount: DecimalAmount;
27
- }
28
24
  export interface PurchaseCreate {
29
25
  /**
30
26
  * @minimum 1
@@ -36,7 +32,10 @@ export interface PurchaseCreate {
36
32
  * @maxLength 256
37
33
  */
38
34
  provider_plan_id: string;
39
- /** @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ */
35
+ /**
36
+ * Selects a price from the requested plan and current catalog revision. The server resolves its immutable Billing terms, billing period and ownership; the client does not set the billing period. SWAS validates the Price selection only. Billing owns quotes, checkout confirmation and payment.
37
+ * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
38
+ */
40
39
  billing_price_id: string;
41
40
  /**
42
41
  * @minLength 1
@@ -44,7 +43,6 @@ export interface PurchaseCreate {
44
43
  */
45
44
  image_id: string;
46
45
  quantity: 1;
47
- expected_quote: ExpectedQuote;
48
46
  /**
49
47
  * @minLength 1
50
48
  * @maxLength 128
@@ -69,7 +67,7 @@ export declare const PurchaseState: {
69
67
  readonly provider_rejected: "provider_rejected";
70
68
  };
71
69
  /**
72
- * Durable purchase progress. delivered and billing_settled describe different facts. Acceptance is not cloud delivery or checkout completion.
70
+ * Durable purchase progress. The checkout_session_id identifies the Billing session for user quote, confirmation and payment. It is not ready while checkout creation is pending. SWAS does not quote or charge automatically. delivered and billing_settled describe different facts; acceptance is not delivery.
73
71
  */
74
72
  export interface Purchase {
75
73
  /** @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ */
@@ -95,9 +93,38 @@ export interface Price {
95
93
  /** @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ */
96
94
  billing_price_id: string;
97
95
  currency: "USD";
98
- amount: DecimalAmount;
96
+ /**
97
+ * Historical display metadata only. New responses omit this field; use Billing for quotes.
98
+ * @deprecated
99
+ */
100
+ amount?: DecimalAmount;
99
101
  period_months: PricePeriodMonths;
100
102
  }
103
+ export type PriceOptionPeriodMonths = (typeof PriceOptionPeriodMonths)[keyof typeof PriceOptionPeriodMonths];
104
+ export declare const PriceOptionPeriodMonths: {
105
+ readonly NUMBER_1: 1;
106
+ readonly NUMBER_3: 3;
107
+ readonly NUMBER_6: 6;
108
+ readonly NUMBER_12: 12;
109
+ readonly NUMBER_24: 24;
110
+ readonly NUMBER_36: 36;
111
+ };
112
+ /**
113
+ * A verified price option for one billing period. Its Billing price must currently be available, use period-end cancellation without an automatic refund, and match this provider plan and region. Archived snapshots, unknown periods and unverified prices are excluded. Selection does not bypass current permissions, Price validation or disabled purchase controls. Billing owns quotes and checkout amounts.
114
+ */
115
+ export interface PriceOption {
116
+ /** @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ */
117
+ billing_plan_id: string;
118
+ /** @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ */
119
+ billing_price_id: string;
120
+ currency: "USD";
121
+ /**
122
+ * Historical display metadata only. New responses omit this field; use Billing for quotes.
123
+ * @deprecated
124
+ */
125
+ amount?: DecimalAmount;
126
+ period_months: PriceOptionPeriodMonths;
127
+ }
101
128
  export interface Plan {
102
129
  provider_plan_id: string;
103
130
  region_id: string;
@@ -105,7 +132,14 @@ export interface Plan {
105
132
  /** @minimum 1 */
106
133
  catalog_revision: number;
107
134
  buyable: boolean;
135
+ /** The existing default price representation. Its availability and the buyable field are unchanged by include_prices; clients using price retain the same default billing period. */
108
136
  price: Price | null;
137
+ /**
138
+ * Present only when include_prices=true. Contains all currently verified billing-period options, ordered by period_months. Billing price IDs and billing periods are each unique within a plan. An empty array means no verified option is available. It does not make the default price buyable.
139
+ * @minItems 0
140
+ * @maxItems 6
141
+ */
142
+ prices?: PriceOption[];
109
143
  /**
110
144
  * @minItems 1
111
145
  * @maxItems 256
@@ -119,7 +153,7 @@ export interface Plan {
119
153
  disk_gb: number;
120
154
  }
121
155
  /**
122
- * Bounded catalog snapshot for one requested region. Incomplete or unavailable price information is not a purchasable offer.
156
+ * Bounded catalog snapshot for one requested region. Incomplete or unavailable price information is not a purchasable offer. Provider plan IDs are unique regardless of the number of billing periods.
123
157
  */
124
158
  export interface Catalog {
125
159
  items: Plan[];
@@ -197,7 +231,11 @@ export declare const InstancePricePeriodMonths: {
197
231
  };
198
232
  export interface InstancePrice {
199
233
  currency: "USD";
200
- amount: DecimalAmount;
234
+ /**
235
+ * Historical display metadata only. Price-only purchases omit this field; use Billing for quotes.
236
+ * @deprecated
237
+ */
238
+ amount?: DecimalAmount;
201
239
  period_months: InstancePricePeriodMonths;
202
240
  }
203
241
  export declare const InstanceCapabilitiesValue: {
@@ -376,6 +414,10 @@ export type ListPlansParams = {
376
414
  * @maxLength 128
377
415
  */
378
416
  region_id: string;
417
+ /**
418
+ * Set to true to include all verified billing-period price options. When false or omitted, the response omits prices and preserves the default price representation.
419
+ */
420
+ include_prices?: boolean;
379
421
  };
380
422
  export type CreatePurchaseHeaders = {
381
423
  /**
@@ -22,6 +22,14 @@ export const PricePeriodMonths = {
22
22
  NUMBER_24: 24,
23
23
  NUMBER_36: 36,
24
24
  };
25
+ export const PriceOptionPeriodMonths = {
26
+ NUMBER_1: 1,
27
+ NUMBER_3: 3,
28
+ NUMBER_6: 6,
29
+ NUMBER_12: 12,
30
+ NUMBER_24: 24,
31
+ NUMBER_36: 36,
32
+ };
25
33
  export const InstancePricePeriodMonths = {
26
34
  NUMBER_1: 1,
27
35
  NUMBER_3: 3,
@@ -7,12 +7,14 @@
7
7
  */
8
8
  import * as zod from "zod";
9
9
  /**
10
- * Lists available plans and prices for the requested region. A plan without a price is not available to buy.
10
+ * Lists one plan per provider plan ID in the requested region. The default response preserves the single price and buyable fields. With include_prices=true, plans also contain verified price options for explicit billing-period selection. Archived snapshot prices are never offered for purchase.
11
11
  * @summary List plans
12
12
  */
13
13
  export declare const listPlansQueryRegionIdMax = 128;
14
+ export declare const listPlansQueryIncludePricesDefault = false;
14
15
  export declare const ListPlansQueryParams: zod.ZodObject<{
15
16
  region_id: zod.ZodString;
17
+ include_prices: zod.ZodDefault<zod.ZodBoolean>;
16
18
  }, zod.z.core.$strict>;
17
19
  /**
18
20
  * Creates a purchase using the current catalog revision and expected price. Reuse the same Idempotency-Key after a timeout. Acceptance is not confirmation of payment or instance delivery.
@@ -28,10 +30,6 @@ export declare const CreatePurchaseBody: zod.ZodObject<{
28
30
  billing_price_id: zod.ZodUUID;
29
31
  image_id: zod.ZodString;
30
32
  quantity: zod.ZodLiteral<1>;
31
- expected_quote: zod.ZodObject<{
32
- currency: zod.ZodLiteral<"USD">;
33
- amount: zod.ZodIntersection<zod.ZodString, zod.ZodString>;
34
- }, zod.z.core.$strict>;
35
33
  region_id: zod.ZodString;
36
34
  }, zod.z.core.$strict>;
37
35
  /**
@@ -11,12 +11,17 @@ import { RebootInstance } from "./validators/rebootInstance.zod.js";
11
11
  import { StartInstance } from "./validators/startInstance.zod.js";
12
12
  import { StopInstance } from "./validators/stopInstance.zod.js";
13
13
  /**
14
- * Lists available plans and prices for the requested region. A plan without a price is not available to buy.
14
+ * Lists one plan per provider plan ID in the requested region. The default response preserves the single price and buyable fields. With include_prices=true, plans also contain verified price options for explicit billing-period selection. Archived snapshot prices are never offered for purchase.
15
15
  * @summary List plans
16
16
  */
17
17
  export const listPlansQueryRegionIdMax = 128;
18
+ export const listPlansQueryIncludePricesDefault = false;
18
19
  export const ListPlansQueryParams = zod.strictObject({
19
20
  region_id: zod.string().min(1).max(listPlansQueryRegionIdMax),
21
+ include_prices: zod
22
+ .boolean()
23
+ .default(listPlansQueryIncludePricesDefault)
24
+ .describe("Set to true to include all verified billing-period price options. When false or omitted, the response omits prices and preserves the default price representation."),
20
25
  });
21
26
  /**
22
27
  * Creates a purchase using the current catalog revision and expected price. Reuse the same Idempotency-Key after a timeout. Acceptance is not confirmation of payment or instance delivery.
@@ -17,9 +17,16 @@ export declare const Catalog: zod.ZodObject<{
17
17
  billing_plan_id: zod.ZodUUID;
18
18
  billing_price_id: zod.ZodUUID;
19
19
  currency: zod.ZodLiteral<"USD">;
20
- amount: zod.ZodIntersection<zod.ZodString, zod.ZodString>;
20
+ amount: zod.ZodOptional<zod.ZodIntersection<zod.ZodString, zod.ZodString>>;
21
21
  period_months: zod.ZodUnion<readonly [zod.ZodUnion<readonly [zod.ZodLiteral<1>, zod.ZodLiteral<3>, zod.ZodLiteral<6>, zod.ZodLiteral<12>, zod.ZodLiteral<24>, zod.ZodLiteral<36>]>, zod.ZodNull]>;
22
22
  }, zod.z.core.$strict>, zod.ZodNull]>;
23
+ prices: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
24
+ billing_plan_id: zod.ZodUUID;
25
+ billing_price_id: zod.ZodUUID;
26
+ currency: zod.ZodLiteral<"USD">;
27
+ amount: zod.ZodOptional<zod.ZodIntersection<zod.ZodString, zod.ZodString>>;
28
+ period_months: zod.ZodUnion<readonly [zod.ZodLiteral<1>, zod.ZodLiteral<3>, zod.ZodLiteral<6>, zod.ZodLiteral<12>, zod.ZodLiteral<24>, zod.ZodLiteral<36>]>;
29
+ }, zod.z.core.$strict>>>;
23
30
  image_ids: zod.ZodArray<zod.ZodString>;
24
31
  cpu: zod.ZodInt;
25
32
  memory_mb: zod.ZodInt;
@@ -13,4 +13,4 @@ export const Catalog = zod
13
13
  source_observed_at: zod.iso.datetime({ offset: true }).describe("UTC RFC 3339 timestamp."),
14
14
  complete: zod.boolean(),
15
15
  })
16
- .describe("Bounded catalog snapshot for one requested region. Incomplete or unavailable price information is not a purchasable offer.");
16
+ .describe("Bounded catalog snapshot for one requested region. Incomplete or unavailable price information is not a purchasable offer. Provider plan IDs are unique regardless of the number of billing periods.");
@@ -42,7 +42,7 @@ export declare const Instance: zod.ZodObject<{
42
42
  expires_at: zod.ZodUnion<readonly [zod.z.ZodISODateTime, zod.ZodNull]>;
43
43
  original_price: zod.ZodObject<{
44
44
  currency: zod.ZodLiteral<"USD">;
45
- amount: zod.ZodIntersection<zod.ZodString, zod.ZodString>;
45
+ amount: zod.ZodOptional<zod.ZodIntersection<zod.ZodString, zod.ZodString>>;
46
46
  period_months: zod.ZodUnion<readonly [zod.ZodLiteral<1>, zod.ZodLiteral<3>, zod.ZodLiteral<6>, zod.ZodLiteral<12>, zod.ZodLiteral<24>, zod.ZodLiteral<36>]>;
47
47
  }, zod.z.core.$strict>;
48
48
  source_observed_at: zod.z.ZodISODateTime;
@@ -40,7 +40,7 @@ export declare const InstanceList: zod.ZodObject<{
40
40
  expires_at: zod.ZodUnion<readonly [zod.z.ZodISODateTime, zod.ZodNull]>;
41
41
  original_price: zod.ZodObject<{
42
42
  currency: zod.ZodLiteral<"USD">;
43
- amount: zod.ZodIntersection<zod.ZodString, zod.ZodString>;
43
+ amount: zod.ZodOptional<zod.ZodIntersection<zod.ZodString, zod.ZodString>>;
44
44
  period_months: zod.ZodUnion<readonly [zod.ZodLiteral<1>, zod.ZodLiteral<3>, zod.ZodLiteral<6>, zod.ZodLiteral<12>, zod.ZodLiteral<24>, zod.ZodLiteral<36>]>;
45
45
  }, zod.z.core.$strict>;
46
46
  source_observed_at: zod.z.ZodISODateTime;
@@ -6,9 +6,10 @@
6
6
  * OpenAPI spec version: 1.0.0
7
7
  */
8
8
  import * as zod from "zod";
9
+ export declare const instancePriceAmountTwoRegExp: RegExp;
9
10
  export declare const InstancePrice: zod.ZodObject<{
10
11
  currency: zod.ZodLiteral<"USD">;
11
- amount: zod.ZodIntersection<zod.ZodString, zod.ZodString>;
12
+ amount: zod.ZodOptional<zod.ZodIntersection<zod.ZodString, zod.ZodString>>;
12
13
  period_months: zod.ZodUnion<readonly [zod.ZodLiteral<1>, zod.ZodLiteral<3>, zod.ZodLiteral<6>, zod.ZodLiteral<12>, zod.ZodLiteral<24>, zod.ZodLiteral<36>]>;
13
14
  }, zod.z.core.$strict>;
14
15
  export type InstancePrice = zod.input<typeof InstancePrice>;
@@ -6,10 +6,15 @@
6
6
  * OpenAPI spec version: 1.0.0
7
7
  */
8
8
  import * as zod from "zod";
9
- import { DecimalAmount } from "./decimalAmount.zod.js";
9
+ export const instancePriceAmountTwoRegExp = new RegExp("^(0|[1-9][0-9]{0,14})(\\.[0-9]{1,10})?$");
10
10
  export const InstancePrice = zod.strictObject({
11
11
  currency: zod.literal("USD"),
12
- amount: DecimalAmount,
12
+ amount: zod
13
+ .string()
14
+ .describe("A decimal string, in the currency stated alongside it.\n\n**The currency is not part of this type.** It is carried by a `currency` field next to the\namount, or by the account the amount belongs to. Reading an amount without that field is\nreading a number with no unit.\n\nIt is a string rather than a JSON number because a JSON number is a float in most parsers,\nand a float loses precision on the first arithmetic. Nothing on this platform puts an amount\nthrough a float.")
15
+ .and(zod.string().regex(instancePriceAmountTwoRegExp))
16
+ .optional()
17
+ .describe("Historical display metadata only. Price-only purchases omit this field; use Billing for quotes."),
13
18
  period_months: zod.union([
14
19
  zod.literal(1),
15
20
  zod.literal(3),
@@ -7,8 +7,10 @@
7
7
  */
8
8
  import * as zod from "zod";
9
9
  export declare const listPlansParamsRegionIdMax = 128;
10
+ export declare const listPlansParamsIncludePricesDefault = false;
10
11
  export declare const ListPlansParams: zod.ZodObject<{
11
12
  region_id: zod.ZodString;
13
+ include_prices: zod.ZodDefault<zod.ZodBoolean>;
12
14
  }, zod.z.core.$strict>;
13
15
  export type ListPlansParams = zod.input<typeof ListPlansParams>;
14
16
  export type ListPlansParamsOutput = zod.output<typeof ListPlansParams>;
@@ -7,6 +7,8 @@
7
7
  */
8
8
  import * as zod from "zod";
9
9
  export const listPlansParamsRegionIdMax = 128;
10
+ export const listPlansParamsIncludePricesDefault = false;
10
11
  export const ListPlansParams = zod.strictObject({
11
12
  region_id: zod.string().min(1).max(listPlansParamsRegionIdMax),
13
+ include_prices: zod.boolean().default(listPlansParamsIncludePricesDefault),
12
14
  });
@@ -6,6 +6,8 @@
6
6
  * OpenAPI spec version: 1.0.0
7
7
  */
8
8
  import * as zod from "zod";
9
+ export declare const planPricesMin = 0;
10
+ export declare const planPricesMax = 6;
9
11
  export declare const planImageIdsMax = 256;
10
12
  export declare const Plan: zod.ZodObject<{
11
13
  provider_plan_id: zod.ZodString;
@@ -17,9 +19,16 @@ export declare const Plan: zod.ZodObject<{
17
19
  billing_plan_id: zod.ZodUUID;
18
20
  billing_price_id: zod.ZodUUID;
19
21
  currency: zod.ZodLiteral<"USD">;
20
- amount: zod.ZodIntersection<zod.ZodString, zod.ZodString>;
22
+ amount: zod.ZodOptional<zod.ZodIntersection<zod.ZodString, zod.ZodString>>;
21
23
  period_months: zod.ZodUnion<readonly [zod.ZodUnion<readonly [zod.ZodLiteral<1>, zod.ZodLiteral<3>, zod.ZodLiteral<6>, zod.ZodLiteral<12>, zod.ZodLiteral<24>, zod.ZodLiteral<36>]>, zod.ZodNull]>;
22
24
  }, zod.z.core.$strict>, zod.ZodNull]>;
25
+ prices: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
26
+ billing_plan_id: zod.ZodUUID;
27
+ billing_price_id: zod.ZodUUID;
28
+ currency: zod.ZodLiteral<"USD">;
29
+ amount: zod.ZodOptional<zod.ZodIntersection<zod.ZodString, zod.ZodString>>;
30
+ period_months: zod.ZodUnion<readonly [zod.ZodLiteral<1>, zod.ZodLiteral<3>, zod.ZodLiteral<6>, zod.ZodLiteral<12>, zod.ZodLiteral<24>, zod.ZodLiteral<36>]>;
31
+ }, zod.z.core.$strict>>>;
23
32
  image_ids: zod.ZodArray<zod.ZodString>;
24
33
  cpu: zod.ZodInt;
25
34
  memory_mb: zod.ZodInt;
@@ -7,6 +7,9 @@
7
7
  */
8
8
  import * as zod from "zod";
9
9
  import { Price } from "./price.zod.js";
10
+ import { PriceOption } from "./priceOption.zod.js";
11
+ export const planPricesMin = 0;
12
+ export const planPricesMax = 6;
10
13
  export const planImageIdsMax = 256;
11
14
  export const Plan = zod.strictObject({
12
15
  provider_plan_id: zod.string(),
@@ -14,7 +17,15 @@ export const Plan = zod.strictObject({
14
17
  name: zod.string(),
15
18
  catalog_revision: zod.int().min(1),
16
19
  buyable: zod.boolean(),
17
- price: zod.union([Price, zod.null()]),
20
+ price: zod
21
+ .union([Price, zod.null()])
22
+ .describe("The existing default price representation. Its availability and the buyable field are unchanged by include_prices; clients using price retain the same default billing period."),
23
+ prices: zod
24
+ .array(PriceOption)
25
+ .min(planPricesMin)
26
+ .max(planPricesMax)
27
+ .optional()
28
+ .describe("Present only when include_prices=true. Contains all currently verified billing-period options, ordered by period_months. Billing price IDs and billing periods are each unique within a plan. An empty array means no verified option is available. It does not make the default price buyable."),
18
29
  image_ids: zod.array(zod.string()).min(1).max(planImageIdsMax),
19
30
  cpu: zod.int().min(1),
20
31
  memory_mb: zod.int().min(1),
@@ -8,11 +8,12 @@
8
8
  import * as zod from "zod";
9
9
  export declare const priceBillingPlanIdRegExp: RegExp;
10
10
  export declare const priceBillingPriceIdRegExp: RegExp;
11
+ export declare const priceAmountTwoRegExp: RegExp;
11
12
  export declare const Price: zod.ZodObject<{
12
13
  billing_plan_id: zod.ZodUUID;
13
14
  billing_price_id: zod.ZodUUID;
14
15
  currency: zod.ZodLiteral<"USD">;
15
- amount: zod.ZodIntersection<zod.ZodString, zod.ZodString>;
16
+ amount: zod.ZodOptional<zod.ZodIntersection<zod.ZodString, zod.ZodString>>;
16
17
  period_months: zod.ZodUnion<readonly [zod.ZodUnion<readonly [zod.ZodLiteral<1>, zod.ZodLiteral<3>, zod.ZodLiteral<6>, zod.ZodLiteral<12>, zod.ZodLiteral<24>, zod.ZodLiteral<36>]>, zod.ZodNull]>;
17
18
  }, zod.z.core.$strict>;
18
19
  export type Price = zod.input<typeof Price>;
@@ -6,14 +6,19 @@
6
6
  * OpenAPI spec version: 1.0.0
7
7
  */
8
8
  import * as zod from "zod";
9
- import { DecimalAmount } from "./decimalAmount.zod.js";
10
9
  export const priceBillingPlanIdRegExp = new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$");
11
10
  export const priceBillingPriceIdRegExp = new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$");
11
+ export const priceAmountTwoRegExp = new RegExp("^(0|[1-9][0-9]{0,14})(\\.[0-9]{1,10})?$");
12
12
  export const Price = zod.strictObject({
13
13
  billing_plan_id: zod.uuid().regex(priceBillingPlanIdRegExp),
14
14
  billing_price_id: zod.uuid().regex(priceBillingPriceIdRegExp),
15
15
  currency: zod.literal("USD"),
16
- amount: DecimalAmount,
16
+ amount: zod
17
+ .string()
18
+ .describe("A decimal string, in the currency stated alongside it.\n\n**The currency is not part of this type.** It is carried by a `currency` field next to the\namount, or by the account the amount belongs to. Reading an amount without that field is\nreading a number with no unit.\n\nIt is a string rather than a JSON number because a JSON number is a float in most parsers,\nand a float loses precision on the first arithmetic. Nothing on this platform puts an amount\nthrough a float.")
19
+ .and(zod.string().regex(priceAmountTwoRegExp))
20
+ .optional()
21
+ .describe("Historical display metadata only. New responses omit this field; use Billing for quotes."),
17
22
  period_months: zod.union([
18
23
  zod.union([
19
24
  zod.literal(1),
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow SWAS API
5
+ * Manage SWAS purchases and instances in the current project. Use an IAM scoped token for every request. Amounts are decimal strings in the stated currency; timestamps are UTC RFC 3339. Accepted requests may still be in progress. Read purchase, operation and refund progress separately.
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ import * as zod from "zod";
9
+ export declare const priceOptionBillingPlanIdRegExp: RegExp;
10
+ export declare const priceOptionBillingPriceIdRegExp: RegExp;
11
+ export declare const priceOptionAmountTwoRegExp: RegExp;
12
+ export declare const PriceOption: zod.ZodObject<{
13
+ billing_plan_id: zod.ZodUUID;
14
+ billing_price_id: zod.ZodUUID;
15
+ currency: zod.ZodLiteral<"USD">;
16
+ amount: zod.ZodOptional<zod.ZodIntersection<zod.ZodString, zod.ZodString>>;
17
+ period_months: zod.ZodUnion<readonly [zod.ZodLiteral<1>, zod.ZodLiteral<3>, zod.ZodLiteral<6>, zod.ZodLiteral<12>, zod.ZodLiteral<24>, zod.ZodLiteral<36>]>;
18
+ }, zod.z.core.$strict>;
19
+ export type PriceOption = zod.input<typeof PriceOption>;
20
+ export type PriceOptionOutput = zod.output<typeof PriceOption>;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow SWAS API
5
+ * Manage SWAS purchases and instances in the current project. Use an IAM scoped token for every request. Amounts are decimal strings in the stated currency; timestamps are UTC RFC 3339. Accepted requests may still be in progress. Read purchase, operation and refund progress separately.
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ import * as zod from "zod";
9
+ export const priceOptionBillingPlanIdRegExp = new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$");
10
+ export const priceOptionBillingPriceIdRegExp = new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$");
11
+ export const priceOptionAmountTwoRegExp = new RegExp("^(0|[1-9][0-9]{0,14})(\\.[0-9]{1,10})?$");
12
+ export const PriceOption = zod
13
+ .strictObject({
14
+ billing_plan_id: zod.uuid().regex(priceOptionBillingPlanIdRegExp),
15
+ billing_price_id: zod.uuid().regex(priceOptionBillingPriceIdRegExp),
16
+ currency: zod.literal("USD"),
17
+ amount: zod
18
+ .string()
19
+ .describe("A decimal string, in the currency stated alongside it.\n\n**The currency is not part of this type.** It is carried by a `currency` field next to the\namount, or by the account the amount belongs to. Reading an amount without that field is\nreading a number with no unit.\n\nIt is a string rather than a JSON number because a JSON number is a float in most parsers,\nand a float loses precision on the first arithmetic. Nothing on this platform puts an amount\nthrough a float.")
20
+ .and(zod.string().regex(priceOptionAmountTwoRegExp))
21
+ .optional()
22
+ .describe("Historical display metadata only. New responses omit this field; use Billing for quotes."),
23
+ period_months: zod.union([
24
+ zod.literal(1),
25
+ zod.literal(3),
26
+ zod.literal(6),
27
+ zod.literal(12),
28
+ zod.literal(24),
29
+ zod.literal(36),
30
+ ]),
31
+ })
32
+ .describe("A verified price option for one billing period. Its Billing price must currently be available, use period-end cancellation without an automatic refund, and match this provider plan and region. Archived snapshots, unknown periods and unverified prices are excluded. Selection does not bypass current permissions, Price validation or disabled purchase controls. Billing owns quotes and checkout amounts.");
@@ -31,4 +31,4 @@ export const Purchase = zod
31
31
  delivered: zod.boolean(),
32
32
  billing_settled: zod.boolean(),
33
33
  })
34
- .describe("Durable purchase progress. delivered and billing_settled describe different facts. Acceptance is not cloud delivery or checkout completion.");
34
+ .describe("Durable purchase progress. The checkout_session_id identifies the Billing session for user quote, confirmation and payment. It is not ready while checkout creation is pending. SWAS does not quote or charge automatically. delivered and billing_settled describe different facts; acceptance is not delivery.");
@@ -17,10 +17,6 @@ export declare const PurchaseCreate: zod.ZodObject<{
17
17
  billing_price_id: zod.ZodUUID;
18
18
  image_id: zod.ZodString;
19
19
  quantity: zod.ZodLiteral<1>;
20
- expected_quote: zod.ZodObject<{
21
- currency: zod.ZodLiteral<"USD">;
22
- amount: zod.ZodIntersection<zod.ZodString, zod.ZodString>;
23
- }, zod.z.core.$strict>;
24
20
  region_id: zod.ZodString;
25
21
  }, zod.z.core.$strict>;
26
22
  export type PurchaseCreate = zod.input<typeof PurchaseCreate>;
@@ -6,7 +6,6 @@
6
6
  * OpenAPI spec version: 1.0.0
7
7
  */
8
8
  import * as zod from "zod";
9
- import { ExpectedQuote } from "./expectedQuote.zod.js";
10
9
  export const purchaseCreateCatalogRevisionMax = 9007199254740991;
11
10
  export const purchaseCreateProviderPlanIdMax = 256;
12
11
  export const purchaseCreateBillingPriceIdRegExp = new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$");
@@ -15,9 +14,11 @@ export const purchaseCreateRegionIdMax = 128;
15
14
  export const PurchaseCreate = zod.strictObject({
16
15
  catalog_revision: zod.int().min(1).max(purchaseCreateCatalogRevisionMax),
17
16
  provider_plan_id: zod.string().min(1).max(purchaseCreateProviderPlanIdMax),
18
- billing_price_id: zod.uuid().regex(purchaseCreateBillingPriceIdRegExp),
17
+ billing_price_id: zod
18
+ .uuid()
19
+ .regex(purchaseCreateBillingPriceIdRegExp)
20
+ .describe("Selects a price from the requested plan and current catalog revision. The server resolves its immutable Billing terms, billing period and ownership; the client does not set the billing period. SWAS validates the Price selection only. Billing owns quotes, checkout confirmation and payment."),
19
21
  image_id: zod.string().min(1).max(purchaseCreateImageIdMax),
20
22
  quantity: zod.literal(1),
21
- expected_quote: ExpectedQuote,
22
23
  region_id: zod.string().min(1).max(purchaseCreateRegionIdMax),
23
24
  });
@@ -16,3 +16,4 @@ export { CustomerRefundProgress } from "./generated/validators/customerRefundPro
16
16
  export { SupplierRefundProgress } from "./generated/validators/supplierRefundProgress.zod.js";
17
17
  export { DecimalAmount } from "./generated/validators/decimalAmount.zod.js";
18
18
  export { Money } from "./generated/validators/money.zod.js";
19
+ export { PriceOption } from "./generated/validators/priceOption.zod.js";
@@ -17,3 +17,4 @@ export { CustomerRefundProgress } from "./generated/validators/customerRefundPro
17
17
  export { SupplierRefundProgress } from "./generated/validators/supplierRefundProgress.zod.js";
18
18
  export { DecimalAmount } from "./generated/validators/decimalAmount.zod.js";
19
19
  export { Money } from "./generated/validators/money.zod.js";
20
+ export { PriceOption } from "./generated/validators/priceOption.zod.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.0.0-dev.422.gef294af",
3
+ "version": "0.0.0-dev.429.gf6440ec",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,14 +0,0 @@
1
- /**
2
- * Generated by orval 🍺
3
- * Do not edit manually.
4
- * Leaflow SWAS API
5
- * Manage SWAS purchases and instances in the current project. Use an IAM scoped token for every request. Amounts are decimal strings in the stated currency; timestamps are UTC RFC 3339. Accepted requests may still be in progress. Read purchase, operation and refund progress separately.
6
- * OpenAPI spec version: 1.0.0
7
- */
8
- import * as zod from "zod";
9
- export declare const ExpectedQuote: zod.ZodObject<{
10
- currency: zod.ZodLiteral<"USD">;
11
- amount: zod.ZodIntersection<zod.ZodString, zod.ZodString>;
12
- }, zod.z.core.$strict>;
13
- export type ExpectedQuote = zod.input<typeof ExpectedQuote>;
14
- export type ExpectedQuoteOutput = zod.output<typeof ExpectedQuote>;
@@ -1,13 +0,0 @@
1
- /**
2
- * Generated by orval 🍺
3
- * Do not edit manually.
4
- * Leaflow SWAS API
5
- * Manage SWAS purchases and instances in the current project. Use an IAM scoped token for every request. Amounts are decimal strings in the stated currency; timestamps are UTC RFC 3339. Accepted requests may still be in progress. Read purchase, operation and refund progress separately.
6
- * OpenAPI spec version: 1.0.0
7
- */
8
- import * as zod from "zod";
9
- import { DecimalAmount } from "./decimalAmount.zod.js";
10
- export const ExpectedQuote = zod.strictObject({
11
- currency: zod.literal("USD"),
12
- amount: DecimalAmount,
13
- });