@metronome/sdk 3.5.0 → 3.6.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 (92) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/bin/cli +12 -5
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts.map +1 -1
  5. package/client.js +11 -0
  6. package/client.js.map +1 -1
  7. package/client.mjs +11 -0
  8. package/client.mjs.map +1 -1
  9. package/internal/types.d.mts +6 -6
  10. package/internal/types.d.mts.map +1 -1
  11. package/internal/types.d.ts +6 -6
  12. package/internal/types.d.ts.map +1 -1
  13. package/internal/utils/log.d.mts.map +1 -1
  14. package/internal/utils/log.d.ts.map +1 -1
  15. package/internal/utils/log.js +2 -0
  16. package/internal/utils/log.js.map +1 -1
  17. package/internal/utils/log.mjs +2 -0
  18. package/internal/utils/log.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/resources/shared.d.mts +95 -1
  21. package/resources/shared.d.mts.map +1 -1
  22. package/resources/shared.d.ts +95 -1
  23. package/resources/shared.d.ts.map +1 -1
  24. package/resources/v1/alerts.d.mts +1 -1
  25. package/resources/v1/alerts.d.mts.map +1 -1
  26. package/resources/v1/alerts.d.ts +1 -1
  27. package/resources/v1/alerts.d.ts.map +1 -1
  28. package/resources/v1/contracts/contracts.d.mts +233 -152
  29. package/resources/v1/contracts/contracts.d.mts.map +1 -1
  30. package/resources/v1/contracts/contracts.d.ts +233 -152
  31. package/resources/v1/contracts/contracts.d.ts.map +1 -1
  32. package/resources/v1/contracts/contracts.js +47 -2
  33. package/resources/v1/contracts/contracts.js.map +1 -1
  34. package/resources/v1/contracts/contracts.mjs +47 -2
  35. package/resources/v1/contracts/contracts.mjs.map +1 -1
  36. package/resources/v1/contracts/index.d.mts +1 -1
  37. package/resources/v1/contracts/index.d.mts.map +1 -1
  38. package/resources/v1/contracts/index.d.ts +1 -1
  39. package/resources/v1/contracts/index.d.ts.map +1 -1
  40. package/resources/v1/contracts/index.js.map +1 -1
  41. package/resources/v1/contracts/index.mjs.map +1 -1
  42. package/resources/v1/contracts/products.d.mts +18 -0
  43. package/resources/v1/contracts/products.d.mts.map +1 -1
  44. package/resources/v1/contracts/products.d.ts +18 -0
  45. package/resources/v1/contracts/products.d.ts.map +1 -1
  46. package/resources/v1/customers/alerts.d.mts +1 -1
  47. package/resources/v1/customers/alerts.d.mts.map +1 -1
  48. package/resources/v1/customers/alerts.d.ts +1 -1
  49. package/resources/v1/customers/alerts.d.ts.map +1 -1
  50. package/resources/v1/customers/invoices.d.mts +9 -0
  51. package/resources/v1/customers/invoices.d.mts.map +1 -1
  52. package/resources/v1/customers/invoices.d.ts +9 -0
  53. package/resources/v1/customers/invoices.d.ts.map +1 -1
  54. package/resources/v1/index.d.mts +1 -1
  55. package/resources/v1/index.d.mts.map +1 -1
  56. package/resources/v1/index.d.ts +1 -1
  57. package/resources/v1/index.d.ts.map +1 -1
  58. package/resources/v1/index.js.map +1 -1
  59. package/resources/v1/index.mjs.map +1 -1
  60. package/resources/v1/packages.d.mts +0 -1
  61. package/resources/v1/packages.d.mts.map +1 -1
  62. package/resources/v1/packages.d.ts +0 -1
  63. package/resources/v1/packages.d.ts.map +1 -1
  64. package/resources/v1/v1.d.mts +2 -2
  65. package/resources/v1/v1.d.mts.map +1 -1
  66. package/resources/v1/v1.d.ts +2 -2
  67. package/resources/v1/v1.d.ts.map +1 -1
  68. package/resources/v1/v1.js.map +1 -1
  69. package/resources/v1/v1.mjs.map +1 -1
  70. package/resources/v2/contracts.d.mts +94 -1
  71. package/resources/v2/contracts.d.mts.map +1 -1
  72. package/resources/v2/contracts.d.ts +94 -1
  73. package/resources/v2/contracts.d.ts.map +1 -1
  74. package/src/client.ts +12 -0
  75. package/src/internal/types.ts +6 -8
  76. package/src/internal/utils/log.ts +2 -0
  77. package/src/resources/shared.ts +127 -1
  78. package/src/resources/v1/alerts.ts +1 -1
  79. package/src/resources/v1/contracts/contracts.ts +295 -167
  80. package/src/resources/v1/contracts/index.ts +2 -0
  81. package/src/resources/v1/contracts/products.ts +20 -0
  82. package/src/resources/v1/customers/alerts.ts +1 -1
  83. package/src/resources/v1/customers/invoices.ts +12 -0
  84. package/src/resources/v1/index.ts +2 -0
  85. package/src/resources/v1/packages.ts +0 -2
  86. package/src/resources/v1/v1.ts +4 -0
  87. package/src/resources/v2/contracts.ts +125 -1
  88. package/src/version.ts +1 -1
  89. package/version.d.mts +1 -1
  90. package/version.d.ts +1 -1
  91. package/version.js +1 -1
  92. package/version.mjs +1 -1
@@ -10,6 +10,7 @@ export {
10
10
  type ContractCreateHistoricalInvoicesResponse,
11
11
  type ContractGetNetBalanceResponse,
12
12
  type ContractListBalancesResponse,
13
+ type ContractListSeatBalancesResponse,
13
14
  type ContractRetrieveRateScheduleResponse,
14
15
  type ContractRetrieveSubscriptionQuantityHistoryResponse,
15
16
  type ContractScheduleProServicesInvoiceResponse,
@@ -23,6 +24,7 @@ export {
23
24
  type ContractCreateHistoricalInvoicesParams,
24
25
  type ContractGetNetBalanceParams,
25
26
  type ContractListBalancesParams,
27
+ type ContractListSeatBalancesParams,
26
28
  type ContractRetrieveRateScheduleParams,
27
29
  type ContractRetrieveSubscriptionQuantityHistoryParams,
28
30
  type ContractScheduleProServicesInvoiceParams,
@@ -503,6 +503,16 @@ export interface ProductCreateParams {
503
503
  */
504
504
  quantity_rounding?: QuantityRounding | null;
505
505
 
506
+ /**
507
+ * Defines the breakdown behavior when calculating usage from SQL Billable Metrics.
508
+ * If set to 'service_period' (default), the usage will be evaluated once for all
509
+ * events the invoice service period and the usage will be applied at the last
510
+ * instant of the invoice. If set to 'hour', it will be broken down and evaluated
511
+ * for each hour. For most use cases, 'hour' is recommended. The setting has no
512
+ * effect for Streaming Billable Metrics.
513
+ */
514
+ sql_breakdown_granularity?: 'HOUR' | 'SERVICE_PERIOD';
515
+
506
516
  tags?: Array<string>;
507
517
  }
508
518
 
@@ -604,6 +614,16 @@ export interface ProductUpdateParams {
604
614
  */
605
615
  quantity_rounding?: QuantityRounding | null;
606
616
 
617
+ /**
618
+ * Defines the breakdown behavior when calculating usage from SQL Billable Metrics.
619
+ * If set to 'service_period' (default), the usage will be evaluated once for all
620
+ * events the invoice service period and the usage will be applied at the last
621
+ * instant of the invoice. If set to 'hour', it will be broken down and evaluated
622
+ * for each hour. For most use cases, 'hour' is recommended. The setting has no
623
+ * effect for Streaming Billable Metrics.
624
+ */
625
+ sql_breakdown_granularity?: 'HOUR' | 'SERVICE_PERIOD';
626
+
607
627
  /**
608
628
  * If not provided, defaults to product's current tags
609
629
  */
@@ -302,7 +302,7 @@ export namespace CustomerAlert {
302
302
 
303
303
  export namespace Alert {
304
304
  export interface CustomFieldFilter {
305
- entity: 'Contract' | 'Commit' | 'ContractCredit';
305
+ entity: 'Contract' | 'Commit' | 'ContractCredit' | 'ContractCreditOrCommit';
306
306
 
307
307
  key: string;
308
308
 
@@ -365,6 +365,8 @@ export interface Invoice {
365
365
 
366
366
  plan_name?: string;
367
367
 
368
+ regenerated_from_invoice_id?: string;
369
+
368
370
  /**
369
371
  * Only present for contract invoices with reseller royalties.
370
372
  */
@@ -1007,6 +1009,11 @@ export interface InvoiceListParams extends CursorPageParams {
1007
1009
  */
1008
1010
  customer_id: string;
1009
1011
 
1012
+ /**
1013
+ * Query param: Only return invoices for the specified contract
1014
+ */
1015
+ contract_id?: string;
1016
+
1010
1017
  /**
1011
1018
  * Query param: Only return invoices for the specified credit type
1012
1019
  */
@@ -1040,6 +1047,11 @@ export interface InvoiceListParams extends CursorPageParams {
1040
1047
  * Query param: Invoice status, e.g. DRAFT, FINALIZED, or VOID
1041
1048
  */
1042
1049
  status?: string;
1050
+
1051
+ /**
1052
+ * Query param: Filter invoices by type. Defaults to returning all invoice types.
1053
+ */
1054
+ type?: 'USAGE' | 'USAGE_CONSOLIDATED' | 'SCHEDULED';
1043
1055
  }
1044
1056
 
1045
1057
  export interface InvoiceAddChargeParams {
@@ -35,6 +35,7 @@ export {
35
35
  type ContractCreateHistoricalInvoicesResponse,
36
36
  type ContractGetNetBalanceResponse,
37
37
  type ContractListBalancesResponse,
38
+ type ContractListSeatBalancesResponse,
38
39
  type ContractRetrieveRateScheduleResponse,
39
40
  type ContractRetrieveSubscriptionQuantityHistoryResponse,
40
41
  type ContractScheduleProServicesInvoiceResponse,
@@ -48,6 +49,7 @@ export {
48
49
  type ContractCreateHistoricalInvoicesParams,
49
50
  type ContractGetNetBalanceParams,
50
51
  type ContractListBalancesParams,
52
+ type ContractListSeatBalancesParams,
51
53
  type ContractRetrieveRateScheduleParams,
52
54
  type ContractRetrieveSubscriptionQuantityHistoryParams,
53
55
  type ContractScheduleProServicesInvoiceParams,
@@ -1866,8 +1866,6 @@ export interface PackageCreateParams {
1866
1866
  */
1867
1867
  aliases?: Array<PackageCreateParams.Alias>;
1868
1868
 
1869
- billing_anchor_date?: 'contract_start_date' | 'first_billing_period';
1870
-
1871
1869
  billing_provider?: 'aws_marketplace' | 'azure_marketplace' | 'gcp_marketplace' | 'stripe' | 'netsuite';
1872
1870
 
1873
1871
  commits?: Array<PackageCreateParams.Commit>;
@@ -153,6 +153,8 @@ import {
153
153
  ContractListBalancesResponsesBodyCursorPage,
154
154
  ContractListParams,
155
155
  ContractListResponse,
156
+ ContractListSeatBalancesParams,
157
+ ContractListSeatBalancesResponse,
156
158
  ContractRetrieveParams,
157
159
  ContractRetrieveRateScheduleParams,
158
160
  ContractRetrieveRateScheduleResponse,
@@ -394,6 +396,7 @@ export declare namespace V1 {
394
396
  type ContractCreateHistoricalInvoicesResponse as ContractCreateHistoricalInvoicesResponse,
395
397
  type ContractGetNetBalanceResponse as ContractGetNetBalanceResponse,
396
398
  type ContractListBalancesResponse as ContractListBalancesResponse,
399
+ type ContractListSeatBalancesResponse as ContractListSeatBalancesResponse,
397
400
  type ContractRetrieveRateScheduleResponse as ContractRetrieveRateScheduleResponse,
398
401
  type ContractRetrieveSubscriptionQuantityHistoryResponse as ContractRetrieveSubscriptionQuantityHistoryResponse,
399
402
  type ContractScheduleProServicesInvoiceResponse as ContractScheduleProServicesInvoiceResponse,
@@ -408,6 +411,7 @@ export declare namespace V1 {
408
411
  type ContractCreateHistoricalInvoicesParams as ContractCreateHistoricalInvoicesParams,
409
412
  type ContractGetNetBalanceParams as ContractGetNetBalanceParams,
410
413
  type ContractListBalancesParams as ContractListBalancesParams,
414
+ type ContractListSeatBalancesParams as ContractListSeatBalancesParams,
411
415
  type ContractRetrieveRateScheduleParams as ContractRetrieveRateScheduleParams,
412
416
  type ContractRetrieveSubscriptionQuantityHistoryParams as ContractRetrieveSubscriptionQuantityHistoryParams,
413
417
  type ContractScheduleProServicesInvoiceParams as ContractScheduleProServicesInvoiceParams,
@@ -289,7 +289,7 @@ export namespace ContractGetEditHistoryResponse {
289
289
  /**
290
290
  * List of subscriptions on the contract.
291
291
  */
292
- add_subscriptions?: Array<Shared.Subscription>;
292
+ add_subscriptions?: Array<Data.AddSubscription>;
293
293
 
294
294
  add_usage_filters?: Array<Data.AddUsageFilter>;
295
295
 
@@ -935,6 +935,130 @@ export namespace ContractGetEditHistoryResponse {
935
935
  }
936
936
  }
937
937
 
938
+ export interface AddSubscription {
939
+ /**
940
+ * Previous, current, and next billing periods for the subscription.
941
+ */
942
+ billing_periods: AddSubscription.BillingPeriods;
943
+
944
+ collection_schedule: 'ADVANCE' | 'ARREARS';
945
+
946
+ proration: AddSubscription.Proration;
947
+
948
+ /**
949
+ * Determines how the subscription's quantity is controlled. Defaults to
950
+ * QUANTITY_ONLY. **QUANTITY_ONLY**: The subscription quantity is specified
951
+ * directly on the subscription. `initial_quantity` must be provided with this
952
+ * option. Compatible with recurring commits/credits that use POOLED allocation.
953
+ * **SEAT_BASED**: Use when you want to pass specific seat identifiers (e.g. add
954
+ * user_123) to increment and decrement a subscription quantity, rather than
955
+ * directly providing the quantity. You must use a **SEAT_BASED** subscription to
956
+ * use a linked recurring credit with an allocation per seat. `seat_config` must be
957
+ * provided with this option.
958
+ */
959
+ quantity_management_mode: 'SEAT_BASED' | 'QUANTITY_ONLY';
960
+
961
+ /**
962
+ * List of quantity schedule items for the subscription. Only includes the current
963
+ * quantity and future quantity changes.
964
+ */
965
+ quantity_schedule: Array<AddSubscription.QuantitySchedule>;
966
+
967
+ starting_at: string;
968
+
969
+ subscription_rate: AddSubscription.SubscriptionRate;
970
+
971
+ id?: string;
972
+
973
+ /**
974
+ * Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
975
+ */
976
+ custom_fields?: { [key: string]: string };
977
+
978
+ description?: string;
979
+
980
+ ending_before?: string;
981
+
982
+ fiat_credit_type_id?: string;
983
+
984
+ name?: string;
985
+
986
+ seat_config?: AddSubscription.SeatConfig;
987
+ }
988
+
989
+ export namespace AddSubscription {
990
+ /**
991
+ * Previous, current, and next billing periods for the subscription.
992
+ */
993
+ export interface BillingPeriods {
994
+ current?: BillingPeriods.Current;
995
+
996
+ next?: BillingPeriods.Next;
997
+
998
+ previous?: BillingPeriods.Previous;
999
+ }
1000
+
1001
+ export namespace BillingPeriods {
1002
+ export interface Current {
1003
+ ending_before: string;
1004
+
1005
+ starting_at: string;
1006
+ }
1007
+
1008
+ export interface Next {
1009
+ ending_before: string;
1010
+
1011
+ starting_at: string;
1012
+ }
1013
+
1014
+ export interface Previous {
1015
+ ending_before: string;
1016
+
1017
+ starting_at: string;
1018
+ }
1019
+ }
1020
+
1021
+ export interface Proration {
1022
+ invoice_behavior: 'BILL_IMMEDIATELY' | 'BILL_ON_NEXT_COLLECTION_DATE';
1023
+
1024
+ is_prorated: boolean;
1025
+ }
1026
+
1027
+ export interface QuantitySchedule {
1028
+ quantity: number;
1029
+
1030
+ starting_at: string;
1031
+
1032
+ ending_before?: string;
1033
+ }
1034
+
1035
+ export interface SubscriptionRate {
1036
+ billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1037
+
1038
+ product: SubscriptionRate.Product;
1039
+ }
1040
+
1041
+ export namespace SubscriptionRate {
1042
+ export interface Product {
1043
+ id: string;
1044
+
1045
+ name: string;
1046
+ }
1047
+ }
1048
+
1049
+ export interface SeatConfig {
1050
+ /**
1051
+ * The property name, sent on usage events, that identifies the seat ID associated
1052
+ * with the usage event. For example, the property name might be seat_id or
1053
+ * user_id. The property must be set as a group key on billable metrics and a
1054
+ * presentation/pricing group key on contract products. This allows linked
1055
+ * recurring credits with an allocation per seat to be consumed by only one seat's
1056
+ * usage.
1057
+ */
1058
+ seat_group_key: string;
1059
+ }
1060
+ }
1061
+
938
1062
  export interface AddUsageFilter {
939
1063
  group_key: string;
940
1064
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '3.5.0'; // x-release-please-version
1
+ export const VERSION = '3.6.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.5.0";
1
+ export declare const VERSION = "3.6.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.5.0";
1
+ export declare const VERSION = "3.6.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '3.5.0'; // x-release-please-version
4
+ exports.VERSION = '3.6.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.5.0'; // x-release-please-version
1
+ export const VERSION = '3.6.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map