@leaflow/sdk 0.133.0 → 0.135.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 (49) hide show
  1. package/dist/billing/type/order/v1/generated/models.d.ts +23 -4
  2. package/dist/billing/type/order/v1/generated/validators/invoiceItem.zod.d.ts +8 -0
  3. package/dist/billing/type/order/v1/generated/validators/invoiceItem.zod.js +5 -0
  4. package/dist/billing/type/order/v1/generated/validators/invoiceItemList.zod.d.ts +8 -0
  5. package/dist/billing/type/order/v1/generated/validators/invoiceItemProration.zod.d.ts +18 -0
  6. package/dist/billing/type/order/v1/generated/validators/invoiceItemProration.zod.js +23 -0
  7. package/dist/billing/type/order/v1/generated/validators/orderItem.zod.js +1 -1
  8. package/dist/billing/type/order/v1/generated/validators/subscription.zod.d.ts +0 -1
  9. package/dist/billing/type/order/v1/generated/validators/subscription.zod.js +0 -4
  10. package/dist/billing/type/order/v1/generated/validators/subscriptionList.zod.d.ts +0 -1
  11. package/dist/billing/v1/generated/models.d.ts +23 -4
  12. package/dist/billing/v1/generated/validators/invoiceItem.zod.d.ts +8 -0
  13. package/dist/billing/v1/generated/validators/invoiceItem.zod.js +5 -0
  14. package/dist/billing/v1/generated/validators/invoiceItemList.zod.d.ts +8 -0
  15. package/dist/billing/v1/generated/validators/invoiceItemProration.zod.d.ts +18 -0
  16. package/dist/billing/v1/generated/validators/invoiceItemProration.zod.js +23 -0
  17. package/dist/billing/v1/generated/validators/orderItem.zod.js +1 -1
  18. package/dist/billing/v1/generated/validators/subscription.zod.d.ts +0 -1
  19. package/dist/billing/v1/generated/validators/subscription.zod.js +0 -4
  20. package/dist/billing/v1/generated/validators/subscriptionList.zod.d.ts +0 -1
  21. package/dist/canopy/inference/v1/generated/functions.d.ts +14 -14
  22. package/dist/canopy/inference/v1/generated/functions.js +11 -7
  23. package/dist/canopy/inference/v1/generated/schemas.zod.d.ts +1 -1
  24. package/dist/canopy/inference/v1/generated/schemas.zod.js +1 -1
  25. package/dist/canopy/v1/generated/models.d.ts +23 -4
  26. package/dist/canopy/v1/generated/validators/invoiceItem.zod.d.ts +8 -0
  27. package/dist/canopy/v1/generated/validators/invoiceItem.zod.js +5 -0
  28. package/dist/canopy/v1/generated/validators/invoiceItemList.zod.d.ts +8 -0
  29. package/dist/canopy/v1/generated/validators/invoiceItemProration.zod.d.ts +41 -0
  30. package/dist/canopy/v1/generated/validators/invoiceItemProration.zod.js +46 -0
  31. package/dist/canopy/v1/generated/validators/orderItem.zod.js +1 -1
  32. package/dist/canopy/v1/generated/validators/subscription.zod.d.ts +0 -1
  33. package/dist/canopy/v1/generated/validators/subscription.zod.js +0 -4
  34. package/dist/canopy/v1/generated/validators/subscriptionList.zod.d.ts +0 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.js +1 -1
  37. package/dist/membership/v1/generated/models.d.ts +23 -4
  38. package/dist/membership/v1/generated/validators/invoiceItem.zod.d.ts +8 -0
  39. package/dist/membership/v1/generated/validators/invoiceItem.zod.js +5 -0
  40. package/dist/membership/v1/generated/validators/invoiceItemList.zod.d.ts +8 -0
  41. package/dist/membership/v1/generated/validators/invoiceItemProration.zod.d.ts +18 -0
  42. package/dist/membership/v1/generated/validators/invoiceItemProration.zod.js +23 -0
  43. package/dist/membership/v1/generated/validators/orderItem.zod.js +1 -1
  44. package/dist/membership/v1/generated/validators/subscription.zod.d.ts +0 -1
  45. package/dist/membership/v1/generated/validators/subscription.zod.js +0 -4
  46. package/dist/membership/v1/generated/validators/subscriptionList.zod.d.ts +0 -1
  47. package/dist/routes.d.ts +2 -2
  48. package/dist/routes.js +2 -2
  49. package/package.json +1 -1
@@ -1528,6 +1528,22 @@ export declare const InvoiceItemType: {
1528
1528
  readonly setup: "setup";
1529
1529
  readonly adjustment: "adjustment";
1530
1530
  };
1531
+ /**
1532
+ * The value of one paid period moved to the new configuration of a subscription.
1533
+ */
1534
+ export interface InvoiceItemProration {
1535
+ /** The earlier invoice line that paid for the period. */
1536
+ credited_invoice_item_id: string;
1537
+ /** The wording of the earlier invoice line as recorded when this invoice was created. */
1538
+ description: string;
1539
+ period_start: string;
1540
+ /** Exclusive. */
1541
+ period_end: string;
1542
+ /** Before tax and discounts, the new configuration for the period. */
1543
+ remaining_amount: Money;
1544
+ /** Before tax, the unused value of the earlier line for the period, credited against `remaining_amount`. */
1545
+ credited_amount: Money;
1546
+ }
1531
1547
  export interface InvoiceItem {
1532
1548
  taxable?: boolean;
1533
1549
  /** Discount applied to this line before tax. */
@@ -1573,6 +1589,11 @@ export interface InvoiceItem {
1573
1589
  period_start?: string | null;
1574
1590
  /** @nullable */
1575
1591
  period_end?: string | null;
1592
+ /**
1593
+ * Present on a line that changes a subscription immediately, one entry for each paid period it
1594
+ * covers. `amount` is the sum of `remaining_amount` minus `credited_amount` over the entries.
1595
+ */
1596
+ prorations?: InvoiceItemProration[];
1576
1597
  }
1577
1598
  export interface InvoiceItemList {
1578
1599
  items: InvoiceItem[];
@@ -1953,8 +1974,6 @@ export interface Subscription {
1953
1974
  termination_policy?: TerminationPolicy;
1954
1975
  refund_policy?: RefundPolicy;
1955
1976
  order_item_id?: string;
1956
- /** Present only on subscriptions created by an earlier change that replaced the subscription. A change now keeps the subscription ID. */
1957
- replaces_subscription_id?: string;
1958
1977
  coupon_id?: string;
1959
1978
  coupon?: ObjectIdentity;
1960
1979
  /** @minimum 0 */
@@ -2277,8 +2296,8 @@ export interface OrderItem {
2277
2296
  /**
2278
2297
  * Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`
2279
2298
  * times `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is
2280
- * the new price minus the old price for the time left in the paid period, both at the subscription's
2281
- * own period price, and the period end does not move; a downgrade charges nothing and may refund the
2299
+ * the new price for the time left in the paid period, at the subscription's own period price, minus
2300
+ * the amount paid for that time, and the period end does not move; a downgrade charges nothing and may refund the
2282
2301
  * difference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.
2283
2302
  *
2284
2303
  * Under an inclusive tax rate it includes tax, as the price does, and the included part is
@@ -36,6 +36,14 @@ export declare const InvoiceItem: zod.ZodObject<{
36
36
  currency: zod.ZodString;
37
37
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
38
38
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
39
+ prorations: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
40
+ credited_invoice_item_id: zod.ZodUUID;
41
+ description: zod.ZodString;
42
+ period_start: zod.z.ZodISODateTime;
43
+ period_end: zod.z.ZodISODateTime;
44
+ remaining_amount: zod.ZodString;
45
+ credited_amount: zod.ZodString;
46
+ }, zod.z.core.$strict>>>;
39
47
  }, zod.z.core.$strict>;
40
48
  export type InvoiceItem = zod.input<typeof InvoiceItem>;
41
49
  export type InvoiceItemOutput = zod.output<typeof InvoiceItem>;
@@ -6,6 +6,7 @@
6
6
  * OpenAPI spec version: v1
7
7
  */
8
8
  import * as zod from "zod";
9
+ import { InvoiceItemProration } from "./invoiceItemProration.zod.js";
9
10
  import { Money } from "./money.zod.js";
10
11
  import { NamedIdentity } from "./namedIdentity.zod.js";
11
12
  export const InvoiceItem = zod.strictObject({
@@ -43,4 +44,8 @@ export const InvoiceItem = zod.strictObject({
43
44
  currency: zod.string(),
44
45
  period_start: zod.iso.datetime({ offset: true }).nullish(),
45
46
  period_end: zod.iso.datetime({ offset: true }).nullish(),
47
+ prorations: zod
48
+ .array(InvoiceItemProration)
49
+ .optional()
50
+ .describe("Present on a line that changes a subscription immediately, one entry for each paid period it\ncovers. `amount` is the sum of `remaining_amount` minus `credited_amount` over the entries."),
46
51
  });
@@ -37,6 +37,14 @@ export declare const InvoiceItemList: zod.ZodObject<{
37
37
  currency: zod.ZodString;
38
38
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
39
39
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
40
+ prorations: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
41
+ credited_invoice_item_id: zod.ZodUUID;
42
+ description: zod.ZodString;
43
+ period_start: zod.z.ZodISODateTime;
44
+ period_end: zod.z.ZodISODateTime;
45
+ remaining_amount: zod.ZodString;
46
+ credited_amount: zod.ZodString;
47
+ }, zod.z.core.$strict>>>;
40
48
  }, zod.z.core.$strict>>;
41
49
  pagination: zod.ZodObject<{
42
50
  page: zod.ZodInt;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Billing Order Types
5
+ * The Billing order a product purchase placed. Types only; this document declares no operations.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ export declare const InvoiceItemProration: zod.ZodObject<{
10
+ credited_invoice_item_id: zod.ZodUUID;
11
+ description: zod.ZodString;
12
+ period_start: zod.z.ZodISODateTime;
13
+ period_end: zod.z.ZodISODateTime;
14
+ remaining_amount: zod.ZodString;
15
+ credited_amount: zod.ZodString;
16
+ }, zod.z.core.$strict>;
17
+ export type InvoiceItemProration = zod.input<typeof InvoiceItemProration>;
18
+ export type InvoiceItemProrationOutput = zod.output<typeof InvoiceItemProration>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Billing Order Types
5
+ * The Billing order a product purchase placed. Types only; this document declares no operations.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ import { Money } from "./money.zod.js";
10
+ export const InvoiceItemProration = zod
11
+ .strictObject({
12
+ credited_invoice_item_id: zod
13
+ .uuid()
14
+ .describe("The earlier invoice line that paid for the period."),
15
+ description: zod
16
+ .string()
17
+ .describe("The wording of the earlier invoice line as recorded when this invoice was created."),
18
+ period_start: zod.iso.datetime({ offset: true }),
19
+ period_end: zod.iso.datetime({ offset: true }).describe("Exclusive."),
20
+ remaining_amount: Money.describe("Before tax and discounts, the new configuration for the period."),
21
+ credited_amount: Money.describe("Before tax, the unused value of the earlier line for the period, credited against `remaining_amount`."),
22
+ })
23
+ .describe("The value of one paid period moved to the new configuration of a subscription.");
@@ -61,7 +61,7 @@ export const OrderItem = zod
61
61
  .describe("What it was called when bought. It does not follow later catalogue renames and is\nnot translated."),
62
62
  quantity: zod.string(),
63
63
  unit_amount: Money.optional().describe("The unit amount of the price this line is charged under. Absent for a tiered price, which has no\nsingle unit amount, and for a change that takes effect at once, which is charged as `gross_amount`\ndescribes."),
64
- gross_amount: Money.optional().describe("Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`\ntimes `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is\nthe new price minus the old price for the time left in the paid period, both at the subscription's\nown period price, and the period end does not move; a downgrade charges nothing and may refund the\ndifference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.\n\nUnder an inclusive tax rate it includes tax, as the price does, and the included part is\n`tax_included_amount`. A renewal at the agreed terms is the exception: the agreed amount excludes\ntax, and tax is added to it."),
64
+ gross_amount: Money.optional().describe("Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`\ntimes `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is\nthe new price for the time left in the paid period, at the subscription's own period price, minus\nthe amount paid for that time, and the period end does not move; a downgrade charges nothing and may refund the\ndifference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.\n\nUnder an inclusive tax rate it includes tax, as the price does, and the included part is\n`tax_included_amount`. A renewal at the agreed terms is the exception: the agreed amount excludes\ntax, and tax is added to it."),
65
65
  discount_amount: Money.optional().describe("The reduction on this line: from the coupon the order uses and, for a renewal at the agreed terms,\nfrom the discount the subscription carries.\n\nA carried discount is part of the agreed amount. It is listed here, and `gross_amount` is then\n`unit_amount` times `quantity`, except in two cases where `gross_amount` is the agreed amount and\nthe carried discount is already reflected in it: the renewal order also uses a coupon the account\nholds, or the account's tax rate is inclusive."),
66
66
  amount: Money.optional().describe("`gross_amount` less `discount_amount`."),
67
67
  currency: zod.string(),
@@ -31,7 +31,6 @@ export declare const Subscription: zod.ZodObject<{
31
31
  prorated: "prorated";
32
32
  }>>;
33
33
  order_item_id: zod.ZodOptional<zod.ZodUUID>;
34
- replaces_subscription_id: zod.ZodOptional<zod.ZodUUID>;
35
34
  coupon_id: zod.ZodOptional<zod.ZodUUID>;
36
35
  coupon: zod.ZodOptional<zod.ZodObject<{
37
36
  lookup_key: zod.ZodOptional<zod.ZodString>;
@@ -29,10 +29,6 @@ export const Subscription = zod
29
29
  termination_policy: TerminationPolicy.optional(),
30
30
  refund_policy: RefundPolicy.optional(),
31
31
  order_item_id: zod.uuid().optional(),
32
- replaces_subscription_id: zod
33
- .uuid()
34
- .optional()
35
- .describe("Present only on subscriptions created by an earlier change that replaced the subscription. A change now keeps the subscription ID."),
36
32
  coupon_id: zod.uuid().optional(),
37
33
  coupon: ObjectIdentity.optional(),
38
34
  discounted_renewals_remaining: zod
@@ -31,7 +31,6 @@ export declare const SubscriptionList: zod.ZodObject<{
31
31
  prorated: "prorated";
32
32
  }>>;
33
33
  order_item_id: zod.ZodOptional<zod.ZodUUID>;
34
- replaces_subscription_id: zod.ZodOptional<zod.ZodUUID>;
35
34
  coupon_id: zod.ZodOptional<zod.ZodUUID>;
36
35
  coupon: zod.ZodOptional<zod.ZodObject<{
37
36
  lookup_key: zod.ZodOptional<zod.ZodString>;
@@ -1314,6 +1314,22 @@ export declare const InvoiceItemType: {
1314
1314
  readonly setup: "setup";
1315
1315
  readonly adjustment: "adjustment";
1316
1316
  };
1317
+ /**
1318
+ * The value of one paid period moved to the new configuration of a subscription.
1319
+ */
1320
+ export interface InvoiceItemProration {
1321
+ /** The earlier invoice line that paid for the period. */
1322
+ credited_invoice_item_id: string;
1323
+ /** The wording of the earlier invoice line as recorded when this invoice was created. */
1324
+ description: string;
1325
+ period_start: string;
1326
+ /** Exclusive. */
1327
+ period_end: string;
1328
+ /** Before tax and discounts, the new configuration for the period. */
1329
+ remaining_amount: Money;
1330
+ /** Before tax, the unused value of the earlier line for the period, credited against `remaining_amount`. */
1331
+ credited_amount: Money;
1332
+ }
1317
1333
  export interface InvoiceItem {
1318
1334
  taxable?: boolean;
1319
1335
  /** Discount applied to this line before tax. */
@@ -1359,6 +1375,11 @@ export interface InvoiceItem {
1359
1375
  period_start?: string | null;
1360
1376
  /** @nullable */
1361
1377
  period_end?: string | null;
1378
+ /**
1379
+ * Present on a line that changes a subscription immediately, one entry for each paid period it
1380
+ * covers. `amount` is the sum of `remaining_amount` minus `credited_amount` over the entries.
1381
+ */
1382
+ prorations?: InvoiceItemProration[];
1362
1383
  }
1363
1384
  export interface InvoiceItemList {
1364
1385
  items: InvoiceItem[];
@@ -1739,8 +1760,6 @@ export interface Subscription {
1739
1760
  termination_policy?: TerminationPolicy;
1740
1761
  refund_policy?: RefundPolicy;
1741
1762
  order_item_id?: string;
1742
- /** Present only on subscriptions created by an earlier change that replaced the subscription. A change now keeps the subscription ID. */
1743
- replaces_subscription_id?: string;
1744
1763
  coupon_id?: string;
1745
1764
  coupon?: ObjectIdentity;
1746
1765
  /** @minimum 0 */
@@ -2097,8 +2116,8 @@ export interface OrderItem {
2097
2116
  /**
2098
2117
  * Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`
2099
2118
  * times `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is
2100
- * the new price minus the old price for the time left in the paid period, both at the subscription's
2101
- * own period price, and the period end does not move; a downgrade charges nothing and may refund the
2119
+ * the new price for the time left in the paid period, at the subscription's own period price, minus
2120
+ * the amount paid for that time, and the period end does not move; a downgrade charges nothing and may refund the
2102
2121
  * difference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.
2103
2122
  *
2104
2123
  * Under an inclusive tax rate it includes tax, as the price does, and the included part is
@@ -36,6 +36,14 @@ export declare const InvoiceItem: zod.ZodObject<{
36
36
  currency: zod.ZodString;
37
37
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
38
38
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
39
+ prorations: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
40
+ credited_invoice_item_id: zod.ZodUUID;
41
+ description: zod.ZodString;
42
+ period_start: zod.z.ZodISODateTime;
43
+ period_end: zod.z.ZodISODateTime;
44
+ remaining_amount: zod.ZodString;
45
+ credited_amount: zod.ZodString;
46
+ }, zod.z.core.$strict>>>;
39
47
  }, zod.z.core.$strict>;
40
48
  export type InvoiceItem = zod.input<typeof InvoiceItem>;
41
49
  export type InvoiceItemOutput = zod.output<typeof InvoiceItem>;
@@ -6,6 +6,7 @@
6
6
  * OpenAPI spec version: v1
7
7
  */
8
8
  import * as zod from "zod";
9
+ import { InvoiceItemProration } from "./invoiceItemProration.zod.js";
9
10
  import { Money } from "./money.zod.js";
10
11
  import { NamedIdentity } from "./namedIdentity.zod.js";
11
12
  export const InvoiceItem = zod.strictObject({
@@ -43,4 +44,8 @@ export const InvoiceItem = zod.strictObject({
43
44
  currency: zod.string(),
44
45
  period_start: zod.iso.datetime({ offset: true }).nullish(),
45
46
  period_end: zod.iso.datetime({ offset: true }).nullish(),
47
+ prorations: zod
48
+ .array(InvoiceItemProration)
49
+ .optional()
50
+ .describe("Present on a line that changes a subscription immediately, one entry for each paid period it\ncovers. `amount` is the sum of `remaining_amount` minus `credited_amount` over the entries."),
46
51
  });
@@ -37,6 +37,14 @@ export declare const InvoiceItemList: zod.ZodObject<{
37
37
  currency: zod.ZodString;
38
38
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
39
39
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
40
+ prorations: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
41
+ credited_invoice_item_id: zod.ZodUUID;
42
+ description: zod.ZodString;
43
+ period_start: zod.z.ZodISODateTime;
44
+ period_end: zod.z.ZodISODateTime;
45
+ remaining_amount: zod.ZodString;
46
+ credited_amount: zod.ZodString;
47
+ }, zod.z.core.$strict>>>;
40
48
  }, zod.z.core.$strict>>;
41
49
  pagination: zod.ZodObject<{
42
50
  page: zod.ZodInt;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Financial operations require an account access token and billing-account authorization. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ export declare const InvoiceItemProration: zod.ZodObject<{
10
+ credited_invoice_item_id: zod.ZodUUID;
11
+ description: zod.ZodString;
12
+ period_start: zod.z.ZodISODateTime;
13
+ period_end: zod.z.ZodISODateTime;
14
+ remaining_amount: zod.ZodString;
15
+ credited_amount: zod.ZodString;
16
+ }, zod.z.core.$strict>;
17
+ export type InvoiceItemProration = zod.input<typeof InvoiceItemProration>;
18
+ export type InvoiceItemProrationOutput = zod.output<typeof InvoiceItemProration>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Billing API
5
+ * Products, prices, orders, subscriptions and account billing. Financial operations require an account access token and billing-account authorization. Public catalogue operations declare no security requirement.
6
+ * OpenAPI spec version: v1
7
+ */
8
+ import * as zod from "zod";
9
+ import { Money } from "./money.zod.js";
10
+ export const InvoiceItemProration = zod
11
+ .strictObject({
12
+ credited_invoice_item_id: zod
13
+ .uuid()
14
+ .describe("The earlier invoice line that paid for the period."),
15
+ description: zod
16
+ .string()
17
+ .describe("The wording of the earlier invoice line as recorded when this invoice was created."),
18
+ period_start: zod.iso.datetime({ offset: true }),
19
+ period_end: zod.iso.datetime({ offset: true }).describe("Exclusive."),
20
+ remaining_amount: Money.describe("Before tax and discounts, the new configuration for the period."),
21
+ credited_amount: Money.describe("Before tax, the unused value of the earlier line for the period, credited against `remaining_amount`."),
22
+ })
23
+ .describe("The value of one paid period moved to the new configuration of a subscription.");
@@ -61,7 +61,7 @@ export const OrderItem = zod
61
61
  .describe("What it was called when bought. It does not follow later catalogue renames and is\nnot translated."),
62
62
  quantity: zod.string(),
63
63
  unit_amount: Money.optional().describe("The unit amount of the price this line is charged under. Absent for a tiered price, which has no\nsingle unit amount, and for a change that takes effect at once, which is charged as `gross_amount`\ndescribes."),
64
- gross_amount: Money.optional().describe("Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`\ntimes `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is\nthe new price minus the old price for the time left in the paid period, both at the subscription's\nown period price, and the period end does not move; a downgrade charges nothing and may refund the\ndifference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.\n\nUnder an inclusive tax rate it includes tax, as the price does, and the included part is\n`tax_included_amount`. A renewal at the agreed terms is the exception: the agreed amount excludes\ntax, and tax is added to it."),
64
+ gross_amount: Money.optional().describe("Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`\ntimes `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is\nthe new price for the time left in the paid period, at the subscription's own period price, minus\nthe amount paid for that time, and the period end does not move; a downgrade charges nothing and may refund the\ndifference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.\n\nUnder an inclusive tax rate it includes tax, as the price does, and the included part is\n`tax_included_amount`. A renewal at the agreed terms is the exception: the agreed amount excludes\ntax, and tax is added to it."),
65
65
  discount_amount: Money.optional().describe("The reduction on this line: from the coupon the order uses and, for a renewal at the agreed terms,\nfrom the discount the subscription carries.\n\nA carried discount is part of the agreed amount. It is listed here, and `gross_amount` is then\n`unit_amount` times `quantity`, except in two cases where `gross_amount` is the agreed amount and\nthe carried discount is already reflected in it: the renewal order also uses a coupon the account\nholds, or the account's tax rate is inclusive."),
66
66
  amount: Money.optional().describe("`gross_amount` less `discount_amount`."),
67
67
  currency: zod.string(),
@@ -31,7 +31,6 @@ export declare const Subscription: zod.ZodObject<{
31
31
  prorated: "prorated";
32
32
  }>>;
33
33
  order_item_id: zod.ZodOptional<zod.ZodUUID>;
34
- replaces_subscription_id: zod.ZodOptional<zod.ZodUUID>;
35
34
  coupon_id: zod.ZodOptional<zod.ZodUUID>;
36
35
  coupon: zod.ZodOptional<zod.ZodObject<{
37
36
  lookup_key: zod.ZodOptional<zod.ZodString>;
@@ -29,10 +29,6 @@ export const Subscription = zod
29
29
  termination_policy: TerminationPolicy.optional(),
30
30
  refund_policy: RefundPolicy.optional(),
31
31
  order_item_id: zod.uuid().optional(),
32
- replaces_subscription_id: zod
33
- .uuid()
34
- .optional()
35
- .describe("Present only on subscriptions created by an earlier change that replaced the subscription. A change now keeps the subscription ID."),
36
32
  coupon_id: zod.uuid().optional(),
37
33
  coupon: ObjectIdentity.optional(),
38
34
  discounted_renewals_remaining: zod
@@ -31,7 +31,6 @@ export declare const SubscriptionList: zod.ZodObject<{
31
31
  prorated: "prorated";
32
32
  }>>;
33
33
  order_item_id: zod.ZodOptional<zod.ZodUUID>;
34
- replaces_subscription_id: zod.ZodOptional<zod.ZodUUID>;
35
34
  coupon_id: zod.ZodOptional<zod.ZodUUID>;
36
35
  coupon: zod.ZodOptional<zod.ZodObject<{
37
36
  lookup_key: zod.ZodOptional<zod.ZodString>;
@@ -58,43 +58,43 @@ export declare const getCreateEmbeddingsUrl: () => string;
58
58
  * @summary Create embeddings
59
59
  */
60
60
  export declare const createEmbeddings: (embeddingRequest: EmbeddingRequest, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<createEmbeddingsResponse>;
61
- export type listModelsResponse200 = {
61
+ export type listInferenceModelsResponse200 = {
62
62
  data: ModelList;
63
63
  status: 200;
64
64
  };
65
- export type listModelsResponseDefault = {
65
+ export type listInferenceModelsResponseDefault = {
66
66
  data: Error;
67
67
  status: Exclude<HTTPStatusCodes, 200>;
68
68
  };
69
- export type listModelsResponseSuccess = listModelsResponse200 & {
69
+ export type listInferenceModelsResponseSuccess = listInferenceModelsResponse200 & {
70
70
  headers: Headers;
71
71
  };
72
- export type listModelsResponseError = listModelsResponseDefault & {
72
+ export type listInferenceModelsResponseError = listInferenceModelsResponseDefault & {
73
73
  headers: Headers;
74
74
  };
75
- export type listModelsResponse = listModelsResponseSuccess | listModelsResponseError;
76
- export declare const getListModelsUrl: () => string;
75
+ export type listInferenceModelsResponse = listInferenceModelsResponseSuccess | listInferenceModelsResponseError;
76
+ export declare const getListInferenceModelsUrl: () => string;
77
77
  /**
78
78
  * @summary List callable models with capabilities and parameter limits
79
79
  */
80
- export declare const listModels: (options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<listModelsResponse>;
81
- export type getModelResponse200 = {
80
+ export declare const listInferenceModels: (options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<listInferenceModelsResponse>;
81
+ export type getInferenceModelResponse200 = {
82
82
  data: Model;
83
83
  status: 200;
84
84
  };
85
- export type getModelResponseDefault = {
85
+ export type getInferenceModelResponseDefault = {
86
86
  data: Error;
87
87
  status: Exclude<HTTPStatusCodes, 200>;
88
88
  };
89
- export type getModelResponseSuccess = getModelResponse200 & {
89
+ export type getInferenceModelResponseSuccess = getInferenceModelResponse200 & {
90
90
  headers: Headers;
91
91
  };
92
- export type getModelResponseError = getModelResponseDefault & {
92
+ export type getInferenceModelResponseError = getInferenceModelResponseDefault & {
93
93
  headers: Headers;
94
94
  };
95
- export type getModelResponse = getModelResponseSuccess | getModelResponseError;
96
- export declare const getGetModelUrl: (model: string) => string;
95
+ export type getInferenceModelResponse = getInferenceModelResponseSuccess | getInferenceModelResponseError;
96
+ export declare const getGetInferenceModelUrl: (model: string) => string;
97
97
  /**
98
98
  * @summary Get a callable model with capabilities and parameter limits
99
99
  */
100
- export declare const getModel: (model: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<getModelResponse>;
100
+ export declare const getInferenceModel: (model: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<getInferenceModelResponse>;
@@ -27,7 +27,11 @@ export const createChatCompletion = async (chatCompletionRequest, options, fetch
27
27
  headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
28
28
  body: JSON.stringify(chatCompletionRequest),
29
29
  });
30
- const body = [204, 205, 304].includes(res.status) ? null : await res.blob();
30
+ const body = [204, 205, 304].includes(res.status)
31
+ ? null
32
+ : res.headers.get("content-type")?.includes("application/json")
33
+ ? JSON.parse(await res.text())
34
+ : await res.blob();
31
35
  const data = body;
32
36
  return { data, status: res.status, headers: res.headers };
33
37
  };
@@ -64,14 +68,14 @@ export const createEmbeddings = async (embeddingRequest, options, fetchFn) => {
64
68
  const data = body ? JSON.parse(body) : {};
65
69
  return { data, status: res.status, headers: res.headers };
66
70
  };
67
- export const getListModelsUrl = () => {
71
+ export const getListInferenceModelsUrl = () => {
68
72
  return `https://canopy.leaflow.cloud/v1/models`;
69
73
  };
70
74
  /**
71
75
  * @summary List callable models with capabilities and parameter limits
72
76
  */
73
- export const listModels = async (options, fetchFn) => {
74
- const res = await (fetchFn ?? fetch)(getListModelsUrl(), {
77
+ export const listInferenceModels = async (options, fetchFn) => {
78
+ const res = await (fetchFn ?? fetch)(getListInferenceModelsUrl(), {
75
79
  ...options,
76
80
  method: "GET",
77
81
  });
@@ -79,14 +83,14 @@ export const listModels = async (options, fetchFn) => {
79
83
  const data = body ? JSON.parse(body) : {};
80
84
  return { data, status: res.status, headers: res.headers };
81
85
  };
82
- export const getGetModelUrl = (model) => {
86
+ export const getGetInferenceModelUrl = (model) => {
83
87
  return `https://canopy.leaflow.cloud/v1/models/${encodeURIComponent(String(model))}`;
84
88
  };
85
89
  /**
86
90
  * @summary Get a callable model with capabilities and parameter limits
87
91
  */
88
- export const getModel = async (model, options, fetchFn) => {
89
- const res = await (fetchFn ?? fetch)(getGetModelUrl(model), {
92
+ export const getInferenceModel = async (model, options, fetchFn) => {
93
+ const res = await (fetchFn ?? fetch)(getGetInferenceModelUrl(model), {
90
94
  ...options,
91
95
  method: "GET",
92
96
  });
@@ -35,6 +35,6 @@ export declare const CreateEmbeddingsBody: zod.ZodObject<{
35
35
  /**
36
36
  * @summary Get a callable model with capabilities and parameter limits
37
37
  */
38
- export declare const GetModelParams: zod.ZodObject<{
38
+ export declare const GetInferenceModelParams: zod.ZodObject<{
39
39
  model: zod.ZodString;
40
40
  }, zod.z.core.$strict>;
@@ -21,6 +21,6 @@ export const CreateEmbeddingsBody = EmbeddingRequest;
21
21
  /**
22
22
  * @summary Get a callable model with capabilities and parameter limits
23
23
  */
24
- export const GetModelParams = zod.strictObject({
24
+ export const GetInferenceModelParams = zod.strictObject({
25
25
  model: zod.string(),
26
26
  });
@@ -2000,6 +2000,22 @@ export declare const InvoiceItemType: {
2000
2000
  readonly setup: "setup";
2001
2001
  readonly adjustment: "adjustment";
2002
2002
  };
2003
+ /**
2004
+ * The value of one paid period moved to the new configuration of a subscription.
2005
+ */
2006
+ export interface InvoiceItemProration {
2007
+ /** The earlier invoice line that paid for the period. */
2008
+ credited_invoice_item_id: string;
2009
+ /** The wording of the earlier invoice line as recorded when this invoice was created. */
2010
+ description: string;
2011
+ period_start: string;
2012
+ /** Exclusive. */
2013
+ period_end: string;
2014
+ /** Before tax and discounts, the new configuration for the period. */
2015
+ remaining_amount: Money;
2016
+ /** Before tax, the unused value of the earlier line for the period, credited against `remaining_amount`. */
2017
+ credited_amount: Money;
2018
+ }
2003
2019
  export interface InvoiceItem {
2004
2020
  taxable?: boolean;
2005
2021
  /** Discount applied to this line before tax. */
@@ -2045,6 +2061,11 @@ export interface InvoiceItem {
2045
2061
  period_start?: string | null;
2046
2062
  /** @nullable */
2047
2063
  period_end?: string | null;
2064
+ /**
2065
+ * Present on a line that changes a subscription immediately, one entry for each paid period it
2066
+ * covers. `amount` is the sum of `remaining_amount` minus `credited_amount` over the entries.
2067
+ */
2068
+ prorations?: InvoiceItemProration[];
2048
2069
  }
2049
2070
  export interface InvoiceItemList {
2050
2071
  items: InvoiceItem[];
@@ -2425,8 +2446,6 @@ export interface Subscription {
2425
2446
  termination_policy?: TerminationPolicy;
2426
2447
  refund_policy?: RefundPolicy;
2427
2448
  order_item_id?: string;
2428
- /** Present only on subscriptions created by an earlier change that replaced the subscription. A change now keeps the subscription ID. */
2429
- replaces_subscription_id?: string;
2430
2449
  coupon_id?: string;
2431
2450
  coupon?: ObjectIdentity;
2432
2451
  /** @minimum 0 */
@@ -2749,8 +2768,8 @@ export interface OrderItem {
2749
2768
  /**
2750
2769
  * Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`
2751
2770
  * times `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is
2752
- * the new price minus the old price for the time left in the paid period, both at the subscription's
2753
- * own period price, and the period end does not move; a downgrade charges nothing and may refund the
2771
+ * the new price for the time left in the paid period, at the subscription's own period price, minus
2772
+ * the amount paid for that time, and the period end does not move; a downgrade charges nothing and may refund the
2754
2773
  * difference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.
2755
2774
  *
2756
2775
  * Under an inclusive tax rate it includes tax, as the price does, and the included part is
@@ -59,6 +59,14 @@ export declare const InvoiceItem: zod.ZodObject<{
59
59
  currency: zod.ZodString;
60
60
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
61
61
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
62
+ prorations: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
63
+ credited_invoice_item_id: zod.ZodUUID;
64
+ description: zod.ZodString;
65
+ period_start: zod.z.ZodISODateTime;
66
+ period_end: zod.z.ZodISODateTime;
67
+ remaining_amount: zod.ZodString;
68
+ credited_amount: zod.ZodString;
69
+ }, zod.z.core.$strict>>>;
62
70
  }, zod.z.core.$strict>;
63
71
  export type InvoiceItem = zod.input<typeof InvoiceItem>;
64
72
  export type InvoiceItemOutput = zod.output<typeof InvoiceItem>;
@@ -29,6 +29,7 @@
29
29
  * OpenAPI spec version: 1.0.0
30
30
  */
31
31
  import * as zod from "zod";
32
+ import { InvoiceItemProration } from "./invoiceItemProration.zod.js";
32
33
  import { Money } from "./money.zod.js";
33
34
  import { NamedIdentity } from "./namedIdentity.zod.js";
34
35
  export const InvoiceItem = zod.strictObject({
@@ -66,4 +67,8 @@ export const InvoiceItem = zod.strictObject({
66
67
  currency: zod.string(),
67
68
  period_start: zod.iso.datetime({ offset: true }).nullish(),
68
69
  period_end: zod.iso.datetime({ offset: true }).nullish(),
70
+ prorations: zod
71
+ .array(InvoiceItemProration)
72
+ .optional()
73
+ .describe("Present on a line that changes a subscription immediately, one entry for each paid period it\ncovers. `amount` is the sum of `remaining_amount` minus `credited_amount` over the entries."),
69
74
  });
@@ -60,6 +60,14 @@ export declare const InvoiceItemList: zod.ZodObject<{
60
60
  currency: zod.ZodString;
61
61
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
62
62
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
63
+ prorations: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
64
+ credited_invoice_item_id: zod.ZodUUID;
65
+ description: zod.ZodString;
66
+ period_start: zod.z.ZodISODateTime;
67
+ period_end: zod.z.ZodISODateTime;
68
+ remaining_amount: zod.ZodString;
69
+ credited_amount: zod.ZodString;
70
+ }, zod.z.core.$strict>>>;
63
71
  }, zod.z.core.$strict>>;
64
72
  pagination: zod.ZodObject<{
65
73
  page: zod.ZodInt;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Canopy API
5
+ * Management of API keys, together with the models available and the usage recorded against them.
6
+ *
7
+ * **These endpoints do not perform inference.** Requests are issued to the forwarding address, which accepts the OpenAI, Anthropic and Gemini request formats:
8
+ *
9
+ * ```
10
+ * POST /v1/chat/completions OpenAI
11
+ * POST /v1/messages Anthropic
12
+ * POST /v1beta/models/{model}:generateContent Gemini
13
+ * ```
14
+ *
15
+ * ## Authentication
16
+ *
17
+ * Every request carries a scoped token; see the `bearerAuth` security scheme.
18
+ *
19
+ * These management endpoints do not accept a Canopy API key. On this userapi host, the OpenAI-compatible `/v1/chat/completions`, `/v1/embeddings`, `/v1/models` and `/v1/models/{model}` endpoints accept the same project token; see the project inference contract. The separate API-key gateway continues to accept Canopy API keys.
20
+ *
21
+ * ## Conventions
22
+ *
23
+ * - **The plaintext of an API key is returned once.** The `secret` appears in the response that issues it and is returned by no other endpoint. A key that has been lost has to be revoked and reissued.
24
+ * - **Disabling and revoking are distinct.** A disabled key may be enabled again at any time, while a revocation is irreversible and is intended for a key that has been exposed. Neither removes the record, and the usage the key accrued remains readable.
25
+ * - **A usage query must carry a time range**, spanning no more than 31 days. `from` and `to` carry a timezone offset, which the server does not infer.
26
+ * - **The request and response bodies do not appear in the ledger.** They are not recorded. Quote the `upstream_request_id` from the response when reporting a problem.
27
+ * - **Usage may be estimated.** The upstream provider does not report usage on every request. Where it does not, `usage_source` is `estimated` and the figures are derived from the character classes of the payload, to within roughly fifteen per cent.
28
+ * - **The service is enabled before use.** A project enables the model platform once, through `create-service`; the forwarding endpoints refuse its requests until the service is `active`. Requests are then billed under the service's subscription by the tokens they use, at the rates stated in each model's `pricing`.
29
+ * OpenAPI spec version: 1.0.0
30
+ */
31
+ import * as zod from "zod";
32
+ export declare const InvoiceItemProration: zod.ZodObject<{
33
+ credited_invoice_item_id: zod.ZodUUID;
34
+ description: zod.ZodString;
35
+ period_start: zod.z.ZodISODateTime;
36
+ period_end: zod.z.ZodISODateTime;
37
+ remaining_amount: zod.ZodString;
38
+ credited_amount: zod.ZodString;
39
+ }, zod.z.core.$strict>;
40
+ export type InvoiceItemProration = zod.input<typeof InvoiceItemProration>;
41
+ export type InvoiceItemProrationOutput = zod.output<typeof InvoiceItemProration>;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Canopy API
5
+ * Management of API keys, together with the models available and the usage recorded against them.
6
+ *
7
+ * **These endpoints do not perform inference.** Requests are issued to the forwarding address, which accepts the OpenAI, Anthropic and Gemini request formats:
8
+ *
9
+ * ```
10
+ * POST /v1/chat/completions OpenAI
11
+ * POST /v1/messages Anthropic
12
+ * POST /v1beta/models/{model}:generateContent Gemini
13
+ * ```
14
+ *
15
+ * ## Authentication
16
+ *
17
+ * Every request carries a scoped token; see the `bearerAuth` security scheme.
18
+ *
19
+ * These management endpoints do not accept a Canopy API key. On this userapi host, the OpenAI-compatible `/v1/chat/completions`, `/v1/embeddings`, `/v1/models` and `/v1/models/{model}` endpoints accept the same project token; see the project inference contract. The separate API-key gateway continues to accept Canopy API keys.
20
+ *
21
+ * ## Conventions
22
+ *
23
+ * - **The plaintext of an API key is returned once.** The `secret` appears in the response that issues it and is returned by no other endpoint. A key that has been lost has to be revoked and reissued.
24
+ * - **Disabling and revoking are distinct.** A disabled key may be enabled again at any time, while a revocation is irreversible and is intended for a key that has been exposed. Neither removes the record, and the usage the key accrued remains readable.
25
+ * - **A usage query must carry a time range**, spanning no more than 31 days. `from` and `to` carry a timezone offset, which the server does not infer.
26
+ * - **The request and response bodies do not appear in the ledger.** They are not recorded. Quote the `upstream_request_id` from the response when reporting a problem.
27
+ * - **Usage may be estimated.** The upstream provider does not report usage on every request. Where it does not, `usage_source` is `estimated` and the figures are derived from the character classes of the payload, to within roughly fifteen per cent.
28
+ * - **The service is enabled before use.** A project enables the model platform once, through `create-service`; the forwarding endpoints refuse its requests until the service is `active`. Requests are then billed under the service's subscription by the tokens they use, at the rates stated in each model's `pricing`.
29
+ * OpenAPI spec version: 1.0.0
30
+ */
31
+ import * as zod from "zod";
32
+ import { Money } from "./money.zod.js";
33
+ export const InvoiceItemProration = zod
34
+ .strictObject({
35
+ credited_invoice_item_id: zod
36
+ .uuid()
37
+ .describe("The earlier invoice line that paid for the period."),
38
+ description: zod
39
+ .string()
40
+ .describe("The wording of the earlier invoice line as recorded when this invoice was created."),
41
+ period_start: zod.iso.datetime({ offset: true }),
42
+ period_end: zod.iso.datetime({ offset: true }).describe("Exclusive."),
43
+ remaining_amount: Money.describe("Before tax and discounts, the new configuration for the period."),
44
+ credited_amount: Money.describe("Before tax, the unused value of the earlier line for the period, credited against `remaining_amount`."),
45
+ })
46
+ .describe("The value of one paid period moved to the new configuration of a subscription.");
@@ -84,7 +84,7 @@ export const OrderItem = zod
84
84
  .describe("What it was called when bought. It does not follow later catalogue renames and is\nnot translated."),
85
85
  quantity: zod.string(),
86
86
  unit_amount: Money.optional().describe("The unit amount of the price this line is charged under. Absent for a tiered price, which has no\nsingle unit amount, and for a change that takes effect at once, which is charged as `gross_amount`\ndescribes."),
87
- gross_amount: Money.optional().describe("Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`\ntimes `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is\nthe new price minus the old price for the time left in the paid period, both at the subscription's\nown period price, and the period end does not move; a downgrade charges nothing and may refund the\ndifference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.\n\nUnder an inclusive tax rate it includes tax, as the price does, and the included part is\n`tax_included_amount`. A renewal at the agreed terms is the exception: the agreed amount excludes\ntax, and tax is added to it."),
87
+ gross_amount: Money.optional().describe("Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`\ntimes `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is\nthe new price for the time left in the paid period, at the subscription's own period price, minus\nthe amount paid for that time, and the period end does not move; a downgrade charges nothing and may refund the\ndifference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.\n\nUnder an inclusive tax rate it includes tax, as the price does, and the included part is\n`tax_included_amount`. A renewal at the agreed terms is the exception: the agreed amount excludes\ntax, and tax is added to it."),
88
88
  discount_amount: Money.optional().describe("The reduction on this line: from the coupon the order uses and, for a renewal at the agreed terms,\nfrom the discount the subscription carries.\n\nA carried discount is part of the agreed amount. It is listed here, and `gross_amount` is then\n`unit_amount` times `quantity`, except in two cases where `gross_amount` is the agreed amount and\nthe carried discount is already reflected in it: the renewal order also uses a coupon the account\nholds, or the account's tax rate is inclusive."),
89
89
  amount: Money.optional().describe("`gross_amount` less `discount_amount`."),
90
90
  currency: zod.string(),
@@ -54,7 +54,6 @@ export declare const Subscription: zod.ZodObject<{
54
54
  prorated: "prorated";
55
55
  }>>;
56
56
  order_item_id: zod.ZodOptional<zod.ZodUUID>;
57
- replaces_subscription_id: zod.ZodOptional<zod.ZodUUID>;
58
57
  coupon_id: zod.ZodOptional<zod.ZodUUID>;
59
58
  coupon: zod.ZodOptional<zod.ZodObject<{
60
59
  lookup_key: zod.ZodOptional<zod.ZodString>;
@@ -52,10 +52,6 @@ export const Subscription = zod
52
52
  termination_policy: TerminationPolicy.optional(),
53
53
  refund_policy: RefundPolicy.optional(),
54
54
  order_item_id: zod.uuid().optional(),
55
- replaces_subscription_id: zod
56
- .uuid()
57
- .optional()
58
- .describe("Present only on subscriptions created by an earlier change that replaced the subscription. A change now keeps the subscription ID."),
59
55
  coupon_id: zod.uuid().optional(),
60
56
  coupon: ObjectIdentity.optional(),
61
57
  discounted_renewals_remaining: zod
@@ -54,7 +54,6 @@ export declare const SubscriptionList: zod.ZodObject<{
54
54
  prorated: "prorated";
55
55
  }>>;
56
56
  order_item_id: zod.ZodOptional<zod.ZodUUID>;
57
- replaces_subscription_id: zod.ZodOptional<zod.ZodUUID>;
58
57
  coupon_id: zod.ZodOptional<zod.ZodUUID>;
59
58
  coupon: zod.ZodOptional<zod.ZodObject<{
60
59
  lookup_key: zod.ZodOptional<zod.ZodString>;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export * as account from "./account/v1/index.js";
2
2
  export * as assistant from "./assistant/v1/index.js";
3
3
  export * as billing from "./billing/v1/index.js";
4
- export * as canopy from "./canopy/v1/index.js";
5
4
  export * as canopyInference from "./canopy/inference/v1/index.js";
5
+ export * as canopy from "./canopy/v1/index.js";
6
6
  export * as compute from "./compute/v1/index.js";
7
7
  export * as dns from "./dns/v1/index.js";
8
8
  export * as iam from "./iam/v1/index.js";
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export * as account from "./account/v1/index.js";
2
2
  export * as assistant from "./assistant/v1/index.js";
3
3
  export * as billing from "./billing/v1/index.js";
4
- export * as canopy from "./canopy/v1/index.js";
5
4
  export * as canopyInference from "./canopy/inference/v1/index.js";
5
+ export * as canopy from "./canopy/v1/index.js";
6
6
  export * as compute from "./compute/v1/index.js";
7
7
  export * as dns from "./dns/v1/index.js";
8
8
  export * as iam from "./iam/v1/index.js";
@@ -1823,6 +1823,22 @@ export declare const InvoiceItemType: {
1823
1823
  readonly setup: "setup";
1824
1824
  readonly adjustment: "adjustment";
1825
1825
  };
1826
+ /**
1827
+ * The value of one paid period moved to the new configuration of a subscription.
1828
+ */
1829
+ export interface InvoiceItemProration {
1830
+ /** The earlier invoice line that paid for the period. */
1831
+ credited_invoice_item_id: string;
1832
+ /** The wording of the earlier invoice line as recorded when this invoice was created. */
1833
+ description: string;
1834
+ period_start: string;
1835
+ /** Exclusive. */
1836
+ period_end: string;
1837
+ /** Before tax and discounts, the new configuration for the period. */
1838
+ remaining_amount: Money;
1839
+ /** Before tax, the unused value of the earlier line for the period, credited against `remaining_amount`. */
1840
+ credited_amount: Money;
1841
+ }
1826
1842
  export interface InvoiceItem {
1827
1843
  taxable?: boolean;
1828
1844
  /** Discount applied to this line before tax. */
@@ -1868,6 +1884,11 @@ export interface InvoiceItem {
1868
1884
  period_start?: string | null;
1869
1885
  /** @nullable */
1870
1886
  period_end?: string | null;
1887
+ /**
1888
+ * Present on a line that changes a subscription immediately, one entry for each paid period it
1889
+ * covers. `amount` is the sum of `remaining_amount` minus `credited_amount` over the entries.
1890
+ */
1891
+ prorations?: InvoiceItemProration[];
1871
1892
  }
1872
1893
  export interface InvoiceItemList {
1873
1894
  items: InvoiceItem[];
@@ -2248,8 +2269,6 @@ export interface Subscription {
2248
2269
  termination_policy?: TerminationPolicy;
2249
2270
  refund_policy?: RefundPolicy;
2250
2271
  order_item_id?: string;
2251
- /** Present only on subscriptions created by an earlier change that replaced the subscription. A change now keeps the subscription ID. */
2252
- replaces_subscription_id?: string;
2253
2272
  coupon_id?: string;
2254
2273
  coupon?: ObjectIdentity;
2255
2274
  /** @minimum 0 */
@@ -2572,8 +2591,8 @@ export interface OrderItem {
2572
2591
  /**
2573
2592
  * Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`
2574
2593
  * times `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is
2575
- * the new price minus the old price for the time left in the paid period, both at the subscription's
2576
- * own period price, and the period end does not move; a downgrade charges nothing and may refund the
2594
+ * the new price for the time left in the paid period, at the subscription's own period price, minus
2595
+ * the amount paid for that time, and the period end does not move; a downgrade charges nothing and may refund the
2577
2596
  * difference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.
2578
2597
  *
2579
2598
  * Under an inclusive tax rate it includes tax, as the price does, and the included part is
@@ -36,6 +36,14 @@ export declare const InvoiceItem: zod.ZodObject<{
36
36
  currency: zod.ZodString;
37
37
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
38
38
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
39
+ prorations: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
40
+ credited_invoice_item_id: zod.ZodUUID;
41
+ description: zod.ZodString;
42
+ period_start: zod.z.ZodISODateTime;
43
+ period_end: zod.z.ZodISODateTime;
44
+ remaining_amount: zod.ZodString;
45
+ credited_amount: zod.ZodString;
46
+ }, zod.z.core.$strict>>>;
39
47
  }, zod.z.core.$strict>;
40
48
  export type InvoiceItem = zod.input<typeof InvoiceItem>;
41
49
  export type InvoiceItemOutput = zod.output<typeof InvoiceItem>;
@@ -6,6 +6,7 @@
6
6
  * OpenAPI spec version: 1.0.0
7
7
  */
8
8
  import * as zod from "zod";
9
+ import { InvoiceItemProration } from "./invoiceItemProration.zod.js";
9
10
  import { Money } from "./money.zod.js";
10
11
  import { NamedIdentity } from "./namedIdentity.zod.js";
11
12
  export const InvoiceItem = zod.strictObject({
@@ -43,4 +44,8 @@ export const InvoiceItem = zod.strictObject({
43
44
  currency: zod.string(),
44
45
  period_start: zod.iso.datetime({ offset: true }).nullish(),
45
46
  period_end: zod.iso.datetime({ offset: true }).nullish(),
47
+ prorations: zod
48
+ .array(InvoiceItemProration)
49
+ .optional()
50
+ .describe("Present on a line that changes a subscription immediately, one entry for each paid period it\ncovers. `amount` is the sum of `remaining_amount` minus `credited_amount` over the entries."),
46
51
  });
@@ -37,6 +37,14 @@ export declare const InvoiceItemList: zod.ZodObject<{
37
37
  currency: zod.ZodString;
38
38
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
39
39
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
40
+ prorations: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
41
+ credited_invoice_item_id: zod.ZodUUID;
42
+ description: zod.ZodString;
43
+ period_start: zod.z.ZodISODateTime;
44
+ period_end: zod.z.ZodISODateTime;
45
+ remaining_amount: zod.ZodString;
46
+ credited_amount: zod.ZodString;
47
+ }, zod.z.core.$strict>>>;
40
48
  }, zod.z.core.$strict>>;
41
49
  pagination: zod.ZodObject<{
42
50
  page: zod.ZodInt;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Membership API
5
+ * Membership tiers and account memberships. Catalog queries support any configured currency; purchases use the billing account currency.
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ import * as zod from "zod";
9
+ export declare const InvoiceItemProration: zod.ZodObject<{
10
+ credited_invoice_item_id: zod.ZodUUID;
11
+ description: zod.ZodString;
12
+ period_start: zod.z.ZodISODateTime;
13
+ period_end: zod.z.ZodISODateTime;
14
+ remaining_amount: zod.ZodString;
15
+ credited_amount: zod.ZodString;
16
+ }, zod.z.core.$strict>;
17
+ export type InvoiceItemProration = zod.input<typeof InvoiceItemProration>;
18
+ export type InvoiceItemProrationOutput = zod.output<typeof InvoiceItemProration>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Membership API
5
+ * Membership tiers and account memberships. Catalog queries support any configured currency; purchases use the billing account currency.
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ import * as zod from "zod";
9
+ import { Money } from "./money.zod.js";
10
+ export const InvoiceItemProration = zod
11
+ .strictObject({
12
+ credited_invoice_item_id: zod
13
+ .uuid()
14
+ .describe("The earlier invoice line that paid for the period."),
15
+ description: zod
16
+ .string()
17
+ .describe("The wording of the earlier invoice line as recorded when this invoice was created."),
18
+ period_start: zod.iso.datetime({ offset: true }),
19
+ period_end: zod.iso.datetime({ offset: true }).describe("Exclusive."),
20
+ remaining_amount: Money.describe("Before tax and discounts, the new configuration for the period."),
21
+ credited_amount: Money.describe("Before tax, the unused value of the earlier line for the period, credited against `remaining_amount`."),
22
+ })
23
+ .describe("The value of one paid period moved to the new configuration of a subscription.");
@@ -61,7 +61,7 @@ export const OrderItem = zod
61
61
  .describe("What it was called when bought. It does not follow later catalogue renames and is\nnot translated."),
62
62
  quantity: zod.string(),
63
63
  unit_amount: Money.optional().describe("The unit amount of the price this line is charged under. Absent for a tiered price, which has no\nsingle unit amount, and for a change that takes effect at once, which is charged as `gross_amount`\ndescribes."),
64
- gross_amount: Money.optional().describe("Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`\ntimes `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is\nthe new price minus the old price for the time left in the paid period, both at the subscription's\nown period price, and the period end does not move; a downgrade charges nothing and may refund the\ndifference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.\n\nUnder an inclusive tax rate it includes tax, as the price does, and the included part is\n`tax_included_amount`. A renewal at the agreed terms is the exception: the agreed amount excludes\ntax, and tax is added to it."),
64
+ gross_amount: Money.optional().describe("Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`\ntimes `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is\nthe new price for the time left in the paid period, at the subscription's own period price, minus\nthe amount paid for that time, and the period end does not move; a downgrade charges nothing and may refund the\ndifference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.\n\nUnder an inclusive tax rate it includes tax, as the price does, and the included part is\n`tax_included_amount`. A renewal at the agreed terms is the exception: the agreed amount excludes\ntax, and tax is added to it."),
65
65
  discount_amount: Money.optional().describe("The reduction on this line: from the coupon the order uses and, for a renewal at the agreed terms,\nfrom the discount the subscription carries.\n\nA carried discount is part of the agreed amount. It is listed here, and `gross_amount` is then\n`unit_amount` times `quantity`, except in two cases where `gross_amount` is the agreed amount and\nthe carried discount is already reflected in it: the renewal order also uses a coupon the account\nholds, or the account's tax rate is inclusive."),
66
66
  amount: Money.optional().describe("`gross_amount` less `discount_amount`."),
67
67
  currency: zod.string(),
@@ -31,7 +31,6 @@ export declare const Subscription: zod.ZodObject<{
31
31
  prorated: "prorated";
32
32
  }>>;
33
33
  order_item_id: zod.ZodOptional<zod.ZodUUID>;
34
- replaces_subscription_id: zod.ZodOptional<zod.ZodUUID>;
35
34
  coupon_id: zod.ZodOptional<zod.ZodUUID>;
36
35
  coupon: zod.ZodOptional<zod.ZodObject<{
37
36
  lookup_key: zod.ZodOptional<zod.ZodString>;
@@ -29,10 +29,6 @@ export const Subscription = zod
29
29
  termination_policy: TerminationPolicy.optional(),
30
30
  refund_policy: RefundPolicy.optional(),
31
31
  order_item_id: zod.uuid().optional(),
32
- replaces_subscription_id: zod
33
- .uuid()
34
- .optional()
35
- .describe("Present only on subscriptions created by an earlier change that replaced the subscription. A change now keeps the subscription ID."),
36
32
  coupon_id: zod.uuid().optional(),
37
33
  coupon: ObjectIdentity.optional(),
38
34
  discounted_renewals_remaining: zod
@@ -31,7 +31,6 @@ export declare const SubscriptionList: zod.ZodObject<{
31
31
  prorated: "prorated";
32
32
  }>>;
33
33
  order_item_id: zod.ZodOptional<zod.ZodUUID>;
34
- replaces_subscription_id: zod.ZodOptional<zod.ZodUUID>;
35
34
  coupon_id: zod.ZodOptional<zod.ZodUUID>;
36
35
  coupon: zod.ZodOptional<zod.ZodObject<{
37
36
  lookup_key: zod.ZodOptional<zod.ZodString>;
package/dist/routes.d.ts CHANGED
@@ -1131,7 +1131,7 @@ export declare const routes: readonly [{
1131
1131
  readonly contract: "canopy/inference";
1132
1132
  readonly method: "GET";
1133
1133
  readonly path: "/v1/models";
1134
- readonly operationId: "list-models";
1134
+ readonly operationId: "list-inference-models";
1135
1135
  readonly securityScheme: "ScopedToken";
1136
1136
  readonly upstreamUrl: "https://canopy.leaflow.cloud";
1137
1137
  }, {
@@ -1139,7 +1139,7 @@ export declare const routes: readonly [{
1139
1139
  readonly contract: "canopy/inference";
1140
1140
  readonly method: "GET";
1141
1141
  readonly path: "/v1/models/{model}";
1142
- readonly operationId: "get-model";
1142
+ readonly operationId: "get-inference-model";
1143
1143
  readonly securityScheme: "ScopedToken";
1144
1144
  readonly upstreamUrl: "https://canopy.leaflow.cloud";
1145
1145
  }, {
package/dist/routes.js CHANGED
@@ -1274,7 +1274,7 @@ export const routes = [
1274
1274
  contract: "canopy/inference",
1275
1275
  method: "GET",
1276
1276
  path: "/v1/models",
1277
- operationId: "list-models",
1277
+ operationId: "list-inference-models",
1278
1278
  securityScheme: "ScopedToken",
1279
1279
  upstreamUrl: "https://canopy.leaflow.cloud",
1280
1280
  },
@@ -1283,7 +1283,7 @@ export const routes = [
1283
1283
  contract: "canopy/inference",
1284
1284
  method: "GET",
1285
1285
  path: "/v1/models/{model}",
1286
- operationId: "get-model",
1286
+ operationId: "get-inference-model",
1287
1287
  securityScheme: "ScopedToken",
1288
1288
  upstreamUrl: "https://canopy.leaflow.cloud",
1289
1289
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.133.0",
3
+ "version": "0.135.0",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {