@leaflow/sdk 0.120.0 → 0.121.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.
@@ -1288,6 +1288,16 @@ export interface InvoiceItem {
1288
1288
  taxable?: boolean;
1289
1289
  /** Discount applied to this line before tax. */
1290
1290
  discount_amount?: string;
1291
+ /**
1292
+ * The account discount applied to this line.
1293
+ * @nullable
1294
+ */
1295
+ discount_id?: string | null;
1296
+ /**
1297
+ * The coupon applied to this line.
1298
+ * @nullable
1299
+ */
1300
+ coupon_id?: string | null;
1291
1301
  /** Tax on the discounted line, including tax already included in the price. */
1292
1302
  tax_amount?: string;
1293
1303
  /** The part of tax_amount already included in amount. */
@@ -2108,7 +2118,19 @@ export declare const DiscountType: {
2108
2118
  readonly free_setup: "free_setup";
2109
2119
  };
2110
2120
  /**
2111
- * A coupon held on this account. It applies at checkout without a code.
2121
+ * Whether the discount continues on renewals of the purchased item. `once` applies only to the
2122
+ * purchase or renewal that uses the coupon, `recurring` continues for `frequency_duration` billing
2123
+ * periods including the first, and `forever` continues on every renewal.
2124
+ */
2125
+ export type DiscountFrequency = (typeof DiscountFrequency)[keyof typeof DiscountFrequency];
2126
+ export declare const DiscountFrequency: {
2127
+ readonly once: "once";
2128
+ readonly recurring: "recurring";
2129
+ readonly forever: "forever";
2130
+ };
2131
+ /**
2132
+ * A coupon held on this account for a period. Within the period it applies without a code to purchases and
2133
+ * to metered usage that the coupon covers.
2112
2134
  */
2113
2135
  export interface Discount {
2114
2136
  min_amount?: string;
@@ -2118,9 +2140,14 @@ export interface Discount {
2118
2140
  status: DiscountStatus;
2119
2141
  revoked_at?: string;
2120
2142
  type: DiscountType;
2121
- recurring?: boolean;
2143
+ /**
2144
+ * Whether the discount continues on renewals of the purchased item. `once` applies only to the
2145
+ * purchase or renewal that uses the coupon, `recurring` continues for `frequency_duration` billing
2146
+ * periods including the first, and `forever` continues on every renewal.
2147
+ */
2148
+ frequency?: DiscountFrequency;
2122
2149
  /** @minimum 1 */
2123
- recurring_cycles?: number;
2150
+ frequency_duration?: number;
2124
2151
  id: string;
2125
2152
  name?: string;
2126
2153
  /** For a percentage discount, out of one hundred. */
@@ -2149,14 +2176,20 @@ export interface OrderItemList {
2149
2176
  pagination: OffsetPagination;
2150
2177
  }
2151
2178
  /**
2152
- * `included` came with a recurring purchase and ends with its subscription, `promotional` was
2153
- * granted.
2179
+ * Whether the quantity was paid for or granted free of charge. Both are consumed the same way.
2154
2180
  */
2155
- export type AllowanceSourceType = (typeof AllowanceSourceType)[keyof typeof AllowanceSourceType];
2156
- export declare const AllowanceSourceType: {
2157
- readonly included: "included";
2181
+ export type AllowanceCategory = (typeof AllowanceCategory)[keyof typeof AllowanceCategory];
2182
+ export declare const AllowanceCategory: {
2183
+ readonly paid: "paid";
2158
2184
  readonly promotional: "promotional";
2159
2185
  };
2186
+ /**
2187
+ * Exact values for a subset of the meter's dimensions. Only usage with these values is deducted;
2188
+ * omitted dimensions are not restricted.
2189
+ */
2190
+ export type AllowanceDimensions = {
2191
+ [key: string]: string;
2192
+ };
2160
2193
  export type AllowanceStatus = (typeof AllowanceStatus)[keyof typeof AllowanceStatus];
2161
2194
  export declare const AllowanceStatus: {
2162
2195
  readonly active: "active";
@@ -2174,11 +2207,13 @@ export interface Allowance {
2174
2207
  meter: ObjectIdentity;
2175
2208
  /** The unit it is counted in, such as `MiB`. */
2176
2209
  unit?: string;
2210
+ /** Whether the quantity was paid for or granted free of charge. Both are consumed the same way. */
2211
+ category: AllowanceCategory;
2177
2212
  /**
2178
- * `included` came with a recurring purchase and ends with its subscription, `promotional` was
2179
- * granted.
2213
+ * Exact values for a subset of the meter's dimensions. Only usage with these values is deducted;
2214
+ * omitted dimensions are not restricted.
2180
2215
  */
2181
- source_type: AllowanceSourceType;
2216
+ dimensions: AllowanceDimensions;
2182
2217
  name: string;
2183
2218
  /** How much was granted. */
2184
2219
  quantity: string;
@@ -262,8 +262,13 @@ export const DiscountType = {
262
262
  price_override: "price_override",
263
263
  free_setup: "free_setup",
264
264
  };
265
- export const AllowanceSourceType = {
266
- included: "included",
265
+ export const DiscountFrequency = {
266
+ once: "once",
267
+ recurring: "recurring",
268
+ forever: "forever",
269
+ };
270
+ export const AllowanceCategory = {
271
+ paid: "paid",
267
272
  promotional: "promotional",
268
273
  };
269
274
  export const AllowanceStatus = {
@@ -22,10 +22,11 @@ export declare const Allowance: zod.ZodObject<{
22
22
  name: zod.ZodString;
23
23
  }, zod.z.core.$strict>;
24
24
  unit: zod.ZodOptional<zod.ZodString>;
25
- source_type: zod.ZodEnum<{
26
- included: "included";
25
+ category: zod.ZodEnum<{
26
+ paid: "paid";
27
27
  promotional: "promotional";
28
28
  }>;
29
+ dimensions: zod.ZodRecord<zod.ZodString, zod.ZodString>;
29
30
  name: zod.ZodString;
30
31
  quantity: zod.ZodString;
31
32
  remaining_quantity: zod.ZodString;
@@ -19,9 +19,12 @@ export const Allowance = zod.strictObject({
19
19
  product: Product,
20
20
  meter: ObjectIdentity,
21
21
  unit: zod.string().optional().describe("The unit it is counted in, such as `MiB`."),
22
- source_type: zod
23
- .enum(["included", "promotional"])
24
- .describe("`included` came with a recurring purchase and ends with its subscription, `promotional` was\ngranted."),
22
+ category: zod
23
+ .enum(["paid", "promotional"])
24
+ .describe("Whether the quantity was paid for or granted free of charge. Both are consumed the same way."),
25
+ dimensions: zod
26
+ .record(zod.string(), zod.string())
27
+ .describe("Exact values for a subset of the meter's dimensions. Only usage with these values is deducted;\nomitted dimensions are not restricted."),
25
28
  name: zod.string(),
26
29
  quantity: zod.string().describe("How much was granted."),
27
30
  remaining_quantity: zod.string().describe("How much is left."),
@@ -23,10 +23,11 @@ export declare const AllowanceList: zod.ZodObject<{
23
23
  name: zod.ZodString;
24
24
  }, zod.z.core.$strict>;
25
25
  unit: zod.ZodOptional<zod.ZodString>;
26
- source_type: zod.ZodEnum<{
27
- included: "included";
26
+ category: zod.ZodEnum<{
27
+ paid: "paid";
28
28
  promotional: "promotional";
29
29
  }>;
30
+ dimensions: zod.ZodRecord<zod.ZodString, zod.ZodString>;
30
31
  name: zod.ZodString;
31
32
  quantity: zod.ZodString;
32
33
  remaining_quantity: zod.ZodString;
@@ -22,8 +22,12 @@ export declare const Discount: zod.ZodObject<{
22
22
  price_override: "price_override";
23
23
  free_setup: "free_setup";
24
24
  }>;
25
- recurring: zod.ZodOptional<zod.ZodBoolean>;
26
- recurring_cycles: zod.ZodOptional<zod.ZodInt>;
25
+ frequency: zod.ZodOptional<zod.ZodEnum<{
26
+ once: "once";
27
+ recurring: "recurring";
28
+ forever: "forever";
29
+ }>>;
30
+ frequency_duration: zod.ZodOptional<zod.ZodInt>;
27
31
  id: zod.ZodUUID;
28
32
  name: zod.ZodOptional<zod.ZodString>;
29
33
  percent_off: zod.ZodOptional<zod.ZodString>;
@@ -17,8 +17,11 @@ export const Discount = zod
17
17
  status: zod.enum(["active", "revoked"]),
18
18
  revoked_at: zod.iso.datetime({ offset: true }).optional(),
19
19
  type: zod.enum(["percentage", "fixed_amount", "price_override", "free_setup"]),
20
- recurring: zod.boolean().optional(),
21
- recurring_cycles: zod.int().min(1).optional(),
20
+ frequency: zod
21
+ .enum(["once", "recurring", "forever"])
22
+ .optional()
23
+ .describe("Whether the discount continues on renewals of the purchased item. `once` applies only to the\npurchase or renewal that uses the coupon, `recurring` continues for `frequency_duration` billing\nperiods including the first, and `forever` continues on every renewal."),
24
+ frequency_duration: zod.int().min(1).optional(),
22
25
  id: zod.uuid(),
23
26
  name: zod.string().optional(),
24
27
  percent_off: zod.string().optional().describe("For a percentage discount, out of one hundred."),
@@ -33,4 +36,4 @@ export const Discount = zod
33
36
  started_at: zod.iso.datetime({ offset: true }).optional(),
34
37
  ended_at: zod.iso.datetime({ offset: true }).nullish(),
35
38
  })
36
- .describe("A coupon held on this account. It applies at checkout without a code.");
39
+ .describe("A coupon held on this account for a period. Within the period it applies without a code to purchases and\nto metered usage that the coupon covers.");
@@ -23,8 +23,12 @@ export declare const DiscountList: zod.ZodObject<{
23
23
  price_override: "price_override";
24
24
  free_setup: "free_setup";
25
25
  }>;
26
- recurring: zod.ZodOptional<zod.ZodBoolean>;
27
- recurring_cycles: zod.ZodOptional<zod.ZodInt>;
26
+ frequency: zod.ZodOptional<zod.ZodEnum<{
27
+ once: "once";
28
+ recurring: "recurring";
29
+ forever: "forever";
30
+ }>>;
31
+ frequency_duration: zod.ZodOptional<zod.ZodInt>;
28
32
  id: zod.ZodUUID;
29
33
  name: zod.ZodOptional<zod.ZodString>;
30
34
  percent_off: zod.ZodOptional<zod.ZodString>;
@@ -9,6 +9,8 @@ import * as zod from "zod";
9
9
  export declare const InvoiceItem: zod.ZodObject<{
10
10
  taxable: zod.ZodOptional<zod.ZodBoolean>;
11
11
  discount_amount: zod.ZodOptional<zod.ZodString>;
12
+ discount_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
13
+ coupon_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
12
14
  tax_amount: zod.ZodOptional<zod.ZodString>;
13
15
  tax_included_amount: zod.ZodOptional<zod.ZodString>;
14
16
  id: zod.ZodUUID;
@@ -11,6 +11,8 @@ import { NamedIdentity } from "./namedIdentity.zod.js";
11
11
  export const InvoiceItem = zod.strictObject({
12
12
  taxable: zod.boolean().optional(),
13
13
  discount_amount: zod.string().optional().describe("Discount applied to this line before tax."),
14
+ discount_id: zod.uuid().nullish().describe("The account discount applied to this line."),
15
+ coupon_id: zod.uuid().nullish().describe("The coupon applied to this line."),
14
16
  tax_amount: zod
15
17
  .string()
16
18
  .optional()
@@ -10,6 +10,8 @@ export declare const InvoiceItemList: zod.ZodObject<{
10
10
  items: zod.ZodArray<zod.ZodObject<{
11
11
  taxable: zod.ZodOptional<zod.ZodBoolean>;
12
12
  discount_amount: zod.ZodOptional<zod.ZodString>;
13
+ discount_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
14
+ coupon_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
13
15
  tax_amount: zod.ZodOptional<zod.ZodString>;
14
16
  tax_included_amount: zod.ZodOptional<zod.ZodString>;
15
17
  id: zod.ZodUUID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.120.0",
3
+ "version": "0.121.0",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {