@leaflow/sdk 0.174.0 → 0.175.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.
@@ -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) => {
@@ -36,7 +36,10 @@ export interface PurchaseCreate {
36
36
  * @maxLength 256
37
37
  */
38
38
  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}$ */
39
+ /**
40
+ * 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.
41
+ * @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
42
+ */
40
43
  billing_price_id: string;
41
44
  /**
42
45
  * @minLength 1
@@ -44,6 +47,7 @@ export interface PurchaseCreate {
44
47
  */
45
48
  image_id: string;
46
49
  quantity: 1;
50
+ /** An assertion about the displayed quote, not an authoritative amount. The server obtains a new Billing quote and rejects a mismatch before accepting a purchase. */
47
51
  expected_quote: ExpectedQuote;
48
52
  /**
49
53
  * @minLength 1
@@ -98,6 +102,27 @@ export interface Price {
98
102
  amount: DecimalAmount;
99
103
  period_months: PricePeriodMonths;
100
104
  }
105
+ export type PriceOptionPeriodMonths = (typeof PriceOptionPeriodMonths)[keyof typeof PriceOptionPeriodMonths];
106
+ export declare const PriceOptionPeriodMonths: {
107
+ readonly NUMBER_1: 1;
108
+ readonly NUMBER_3: 3;
109
+ readonly NUMBER_6: 6;
110
+ readonly NUMBER_12: 12;
111
+ readonly NUMBER_24: 24;
112
+ readonly NUMBER_36: 36;
113
+ };
114
+ /**
115
+ * 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, quote checks or disabled purchase controls. IDs and amounts are authoritative only after server revalidation.
116
+ */
117
+ export interface PriceOption {
118
+ /** @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ */
119
+ billing_plan_id: string;
120
+ /** @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ */
121
+ billing_price_id: string;
122
+ currency: "USD";
123
+ amount: DecimalAmount;
124
+ period_months: PriceOptionPeriodMonths;
125
+ }
101
126
  export interface Plan {
102
127
  provider_plan_id: string;
103
128
  region_id: string;
@@ -105,7 +130,14 @@ export interface Plan {
105
130
  /** @minimum 1 */
106
131
  catalog_revision: number;
107
132
  buyable: boolean;
133
+ /** 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
134
  price: Price | null;
135
+ /**
136
+ * 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.
137
+ * @minItems 0
138
+ * @maxItems 6
139
+ */
140
+ prices?: PriceOption[];
109
141
  /**
110
142
  * @minItems 1
111
143
  * @maxItems 256
@@ -119,7 +151,7 @@ export interface Plan {
119
151
  disk_gb: number;
120
152
  }
121
153
  /**
122
- * Bounded catalog snapshot for one requested region. Incomplete or unavailable price information is not a purchasable offer.
154
+ * 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
155
  */
124
156
  export interface Catalog {
125
157
  items: Plan[];
@@ -376,6 +408,10 @@ export type ListPlansParams = {
376
408
  * @maxLength 128
377
409
  */
378
410
  region_id: string;
411
+ /**
412
+ * 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.
413
+ */
414
+ include_prices?: boolean;
379
415
  };
380
416
  export type CreatePurchaseHeaders = {
381
417
  /**
@@ -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.
@@ -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.
@@ -20,6 +20,13 @@ export declare const Catalog: zod.ZodObject<{
20
20
  amount: 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.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.");
@@ -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;
@@ -20,6 +22,13 @@ export declare const Plan: zod.ZodObject<{
20
22
  amount: 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.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),
@@ -0,0 +1,19 @@
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 PriceOption: zod.ZodObject<{
12
+ billing_plan_id: zod.ZodUUID;
13
+ billing_price_id: zod.ZodUUID;
14
+ currency: zod.ZodLiteral<"USD">;
15
+ amount: zod.ZodIntersection<zod.ZodString, zod.ZodString>;
16
+ period_months: zod.ZodUnion<readonly [zod.ZodLiteral<1>, zod.ZodLiteral<3>, zod.ZodLiteral<6>, zod.ZodLiteral<12>, zod.ZodLiteral<24>, zod.ZodLiteral<36>]>;
17
+ }, zod.z.core.$strict>;
18
+ export type PriceOption = zod.input<typeof PriceOption>;
19
+ export type PriceOptionOutput = zod.output<typeof PriceOption>;
@@ -0,0 +1,27 @@
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 priceOptionBillingPlanIdRegExp = 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 priceOptionBillingPriceIdRegExp = new RegExp("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$");
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: DecimalAmount,
18
+ period_months: zod.union([
19
+ zod.literal(1),
20
+ zod.literal(3),
21
+ zod.literal(6),
22
+ zod.literal(12),
23
+ zod.literal(24),
24
+ zod.literal(36),
25
+ ]),
26
+ })
27
+ .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, quote checks or disabled purchase controls. IDs and amounts are authoritative only after server revalidation.");
@@ -15,9 +15,12 @@ export const purchaseCreateRegionIdMax = 128;
15
15
  export const PurchaseCreate = zod.strictObject({
16
16
  catalog_revision: zod.int().min(1).max(purchaseCreateCatalogRevisionMax),
17
17
  provider_plan_id: zod.string().min(1).max(purchaseCreateProviderPlanIdMax),
18
- billing_price_id: zod.uuid().regex(purchaseCreateBillingPriceIdRegExp),
18
+ billing_price_id: zod
19
+ .uuid()
20
+ .regex(purchaseCreateBillingPriceIdRegExp)
21
+ .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."),
19
22
  image_id: zod.string().min(1).max(purchaseCreateImageIdMax),
20
23
  quantity: zod.literal(1),
21
- expected_quote: ExpectedQuote,
24
+ expected_quote: ExpectedQuote.describe("An assertion about the displayed quote, not an authoritative amount. The server obtains a new Billing quote and rejects a mismatch before accepting a purchase."),
22
25
  region_id: zod.string().min(1).max(purchaseCreateRegionIdMax),
23
26
  });
@@ -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.174.0",
3
+ "version": "0.175.0",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {