@openmeter/client 1.0.0-beta-9caae8e05744 → 1.0.0-beta-f01fb4abbc5a

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.
@@ -9,6 +9,11 @@ export const currencyCode = z
9
9
  .max(3)
10
10
  .regex(new RegExp('^[A-Z]{3}$'))
11
11
  .describe('Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code. Custom three-letter currency codes are also supported for convenience.');
12
+ export const currencyCodeCustom = z
13
+ .string()
14
+ .min(4)
15
+ .max(24)
16
+ .describe('Custom currency code. It should be a unique code but not conflicting with any existing fiat currency codes.');
12
17
  export const numeric = z
13
18
  .string()
14
19
  .regex(new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$'))
@@ -686,11 +691,9 @@ export const updatePriceFree = z
686
691
  export const currencyType = z
687
692
  .enum(['fiat', 'custom'])
688
693
  .describe('Currency type for custom currencies. It should be a unique code but not conflicting with any existing standard currency codes.');
689
- export const currencyCodeCustom = z
690
- .string()
691
- .min(4)
692
- .max(24)
693
- .describe('Custom currency code. It should be a unique code but not conflicting with any existing fiat currency codes.');
694
+ export const currencyExpand = z
695
+ .enum(['cost_basis'])
696
+ .describe("Expands for currencies. Values: - `cost_basis`: The currency's currently-active cost basis.");
694
697
  export const featureLlmTokenType = z
695
698
  .enum([
696
699
  'input',
@@ -1018,12 +1021,6 @@ export const appCustomerDataExternalInvoicing = z
1018
1021
  labels: labels.optional(),
1019
1022
  })
1020
1023
  .describe('External invoicing customer data.');
1021
- export const billingCurrencyCode = z
1022
- .union([currencyCode])
1023
- .describe('Fiat or custom currency code.');
1024
- export const createCurrencyCode = z
1025
- .union([currencyCode])
1026
- .describe('Fiat or custom currency code.');
1027
1024
  export const currencyFiat = z
1028
1025
  .object({
1029
1026
  type: z.literal('fiat').describe('The type of the currency.'),
@@ -1061,6 +1058,43 @@ export const listCostBasesParamsFilter = z
1061
1058
  fiatCode: currencyCode.optional(),
1062
1059
  })
1063
1060
  .describe('Filter options for listing cost bases.');
1061
+ export const billingCurrencyCode = z
1062
+ .union([currencyCode, currencyCodeCustom])
1063
+ .describe('Fiat or custom currency code.');
1064
+ export const createCurrencyCode = z
1065
+ .union([currencyCode, currencyCodeCustom])
1066
+ .describe('Fiat or custom currency code.');
1067
+ export const createCurrencyCustomRequest = z
1068
+ .object({
1069
+ name: z
1070
+ .string()
1071
+ .min(1)
1072
+ .max(256)
1073
+ .describe('The name of the currency. It should be a human-readable string that represents the name of the currency, such as "US Dollar" or "Euro".'),
1074
+ symbol: z
1075
+ .string()
1076
+ .min(1)
1077
+ .optional()
1078
+ .describe('The symbol of the currency. It should be a string that represents the symbol of the currency, such as "$" for US Dollar or "€" for Euro.'),
1079
+ precision: z
1080
+ .number()
1081
+ .int()
1082
+ .nonnegative()
1083
+ .lte(4294967295)
1084
+ .describe('The precision of the currency. It should be a number that represents the number of decimal places used for the currency, such as 2 for US Dollar or Euro.'),
1085
+ decimalMark: z
1086
+ .string()
1087
+ .min(1)
1088
+ .max(1)
1089
+ .describe('The decimal mark for the currency. It should be a string that represents the decimal mark of the currency, such as "." for US Dollar or "," for Euro.'),
1090
+ thousandSeparator: z
1091
+ .string()
1092
+ .min(1)
1093
+ .max(1)
1094
+ .describe('The thousand separator for the currency. It should be a string that represents the thousand separator of the currency, such as "," for US Dollar or "." for Euro.'),
1095
+ code: currencyCodeCustom,
1096
+ })
1097
+ .describe('CurrencyCustom create request.');
1064
1098
  export const currencyAmount = z
1065
1099
  .object({
1066
1100
  amount: numeric,
@@ -2251,37 +2285,6 @@ export const listCurrenciesParamsFilter = z
2251
2285
  code: stringFieldFilter.optional(),
2252
2286
  })
2253
2287
  .describe('Filter options for listing currencies.');
2254
- export const createCurrencyCustomRequest = z
2255
- .object({
2256
- name: z
2257
- .string()
2258
- .min(1)
2259
- .max(256)
2260
- .describe('The name of the currency. It should be a human-readable string that represents the name of the currency, such as "US Dollar" or "Euro".'),
2261
- symbol: z
2262
- .string()
2263
- .min(1)
2264
- .optional()
2265
- .describe('The symbol of the currency. It should be a string that represents the symbol of the currency, such as "$" for US Dollar or "€" for Euro.'),
2266
- precision: z
2267
- .number()
2268
- .int()
2269
- .nonnegative()
2270
- .lte(4294967295)
2271
- .describe('The precision of the currency. It should be a number that represents the number of decimal places used for the currency, such as 2 for US Dollar or Euro.'),
2272
- decimalMark: z
2273
- .string()
2274
- .min(1)
2275
- .max(1)
2276
- .describe('The decimal mark for the currency. It should be a string that represents the decimal mark of the currency, such as "." for US Dollar or "," for Euro.'),
2277
- thousandSeparator: z
2278
- .string()
2279
- .min(1)
2280
- .max(1)
2281
- .describe('The thousand separator for the currency. It should be a string that represents the thousand separator of the currency, such as "," for US Dollar or "." for Euro.'),
2282
- code: currencyCodeCustom,
2283
- })
2284
- .describe('CurrencyCustom create request.');
2285
2288
  export const governanceQueryRequest = z
2286
2289
  .object({
2287
2290
  includeCredits: z
@@ -3843,6 +3846,7 @@ export const rateCard = z
3843
3846
  labels: labels.optional(),
3844
3847
  key: resourceKey,
3845
3848
  feature: featureReference.optional(),
3849
+ currency: billingCurrencyCode.optional(),
3846
3850
  billingCadence: iso8601Duration.optional(),
3847
3851
  price: price,
3848
3852
  unitConfig: unitConfig.optional(),
@@ -4227,7 +4231,7 @@ export const plan = z
4227
4231
  .gte(1)
4228
4232
  .default(1)
4229
4233
  .describe('Plans are versioned to allow you to make changes without affecting running subscriptions.'),
4230
- currency: currencyCode,
4234
+ currency: billingCurrencyCode,
4231
4235
  billingCadence: iso8601Duration,
4232
4236
  proRatingEnabled: z
4233
4237
  .boolean()
@@ -4262,7 +4266,7 @@ export const createPlanRequest = z
4262
4266
  .describe('Optional description of the resource. Maximum 1024 characters.'),
4263
4267
  labels: labels.optional(),
4264
4268
  key: resourceKey,
4265
- currency: currencyCode,
4269
+ currency: billingCurrencyCode,
4266
4270
  billingCadence: iso8601Duration,
4267
4271
  proRatingEnabled: z
4268
4272
  .boolean()
@@ -4869,6 +4873,10 @@ export const listCurrenciesQueryParams = z.object({
4869
4873
  .describe('Determines which page of the collection to retrieve.'),
4870
4874
  sort: sortQuery.optional(),
4871
4875
  filter: listCurrenciesParamsFilter.optional(),
4876
+ expand: z
4877
+ .array(currencyExpand)
4878
+ .optional()
4879
+ .describe('Expand the currencies returned in the response. To include the currently-active cost basis add: expand=cost_basis'),
4872
4880
  });
4873
4881
  export const listCurrenciesResponse = z.object({
4874
4882
  data: z.array(currency),
@@ -5129,6 +5137,11 @@ export const currencyCodeWire = z
5129
5137
  .max(3)
5130
5138
  .regex(new RegExp('^[A-Z]{3}$'))
5131
5139
  .describe('Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code. Custom three-letter currency codes are also supported for convenience.');
5140
+ export const currencyCodeCustomWire = z
5141
+ .string()
5142
+ .min(4)
5143
+ .max(24)
5144
+ .describe('Custom currency code. It should be a unique code but not conflicting with any existing fiat currency codes.');
5132
5145
  export const numericWire = z
5133
5146
  .string()
5134
5147
  .regex(new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$'))
@@ -5799,11 +5812,9 @@ export const updatePriceFreeWire = z
5799
5812
  export const currencyTypeWire = z
5800
5813
  .enum(['fiat', 'custom'])
5801
5814
  .describe('Currency type for custom currencies. It should be a unique code but not conflicting with any existing standard currency codes.');
5802
- export const currencyCodeCustomWire = z
5803
- .string()
5804
- .min(4)
5805
- .max(24)
5806
- .describe('Custom currency code. It should be a unique code but not conflicting with any existing fiat currency codes.');
5815
+ export const currencyExpandWire = z
5816
+ .enum(['cost_basis'])
5817
+ .describe("Expands for currencies. Values: - `cost_basis`: The currency's currently-active cost basis.");
5807
5818
  export const featureLlmTokenTypeWire = z
5808
5819
  .enum([
5809
5820
  'input',
@@ -6131,12 +6142,6 @@ export const appCustomerDataExternalInvoicingWire = z
6131
6142
  labels: labelsWire.optional(),
6132
6143
  })
6133
6144
  .describe('External invoicing customer data.');
6134
- export const billingCurrencyCodeWire = z
6135
- .union([currencyCodeWire])
6136
- .describe('Fiat or custom currency code.');
6137
- export const createCurrencyCodeWire = z
6138
- .union([currencyCodeWire])
6139
- .describe('Fiat or custom currency code.');
6140
6145
  export const currencyFiatWire = z
6141
6146
  .strictObject({
6142
6147
  type: z.literal('fiat').describe('The type of the currency.'),
@@ -6174,6 +6179,43 @@ export const listCostBasesParamsFilterWire = z
6174
6179
  fiat_code: currencyCodeWire.optional(),
6175
6180
  })
6176
6181
  .describe('Filter options for listing cost bases.');
6182
+ export const billingCurrencyCodeWire = z
6183
+ .union([currencyCodeWire, currencyCodeCustomWire])
6184
+ .describe('Fiat or custom currency code.');
6185
+ export const createCurrencyCodeWire = z
6186
+ .union([currencyCodeWire, currencyCodeCustomWire])
6187
+ .describe('Fiat or custom currency code.');
6188
+ export const createCurrencyCustomRequestWire = z
6189
+ .strictObject({
6190
+ name: z
6191
+ .string()
6192
+ .min(1)
6193
+ .max(256)
6194
+ .describe('The name of the currency. It should be a human-readable string that represents the name of the currency, such as "US Dollar" or "Euro".'),
6195
+ symbol: z
6196
+ .string()
6197
+ .min(1)
6198
+ .optional()
6199
+ .describe('The symbol of the currency. It should be a string that represents the symbol of the currency, such as "$" for US Dollar or "€" for Euro.'),
6200
+ precision: z
6201
+ .number()
6202
+ .int()
6203
+ .nonnegative()
6204
+ .lte(4294967295)
6205
+ .describe('The precision of the currency. It should be a number that represents the number of decimal places used for the currency, such as 2 for US Dollar or Euro.'),
6206
+ decimal_mark: z
6207
+ .string()
6208
+ .min(1)
6209
+ .max(1)
6210
+ .describe('The decimal mark for the currency. It should be a string that represents the decimal mark of the currency, such as "." for US Dollar or "," for Euro.'),
6211
+ thousand_separator: z
6212
+ .string()
6213
+ .min(1)
6214
+ .max(1)
6215
+ .describe('The thousand separator for the currency. It should be a string that represents the thousand separator of the currency, such as "," for US Dollar or "." for Euro.'),
6216
+ code: currencyCodeCustomWire,
6217
+ })
6218
+ .describe('CurrencyCustom create request.');
6177
6219
  export const currencyAmountWire = z
6178
6220
  .strictObject({
6179
6221
  amount: numericWire,
@@ -7341,37 +7383,6 @@ export const listCurrenciesParamsFilterWire = z
7341
7383
  code: stringFieldFilterWire.optional(),
7342
7384
  })
7343
7385
  .describe('Filter options for listing currencies.');
7344
- export const createCurrencyCustomRequestWire = z
7345
- .strictObject({
7346
- name: z
7347
- .string()
7348
- .min(1)
7349
- .max(256)
7350
- .describe('The name of the currency. It should be a human-readable string that represents the name of the currency, such as "US Dollar" or "Euro".'),
7351
- symbol: z
7352
- .string()
7353
- .min(1)
7354
- .optional()
7355
- .describe('The symbol of the currency. It should be a string that represents the symbol of the currency, such as "$" for US Dollar or "€" for Euro.'),
7356
- precision: z
7357
- .number()
7358
- .int()
7359
- .nonnegative()
7360
- .lte(4294967295)
7361
- .describe('The precision of the currency. It should be a number that represents the number of decimal places used for the currency, such as 2 for US Dollar or Euro.'),
7362
- decimal_mark: z
7363
- .string()
7364
- .min(1)
7365
- .max(1)
7366
- .describe('The decimal mark for the currency. It should be a string that represents the decimal mark of the currency, such as "." for US Dollar or "," for Euro.'),
7367
- thousand_separator: z
7368
- .string()
7369
- .min(1)
7370
- .max(1)
7371
- .describe('The thousand separator for the currency. It should be a string that represents the thousand separator of the currency, such as "," for US Dollar or "." for Euro.'),
7372
- code: currencyCodeCustomWire,
7373
- })
7374
- .describe('CurrencyCustom create request.');
7375
7386
  export const governanceQueryRequestWire = z
7376
7387
  .strictObject({
7377
7388
  include_credits: z
@@ -8937,6 +8948,7 @@ export const rateCardWire = z
8937
8948
  labels: labelsWire.optional(),
8938
8949
  key: resourceKeyWire,
8939
8950
  feature: featureReferenceWire.optional(),
8951
+ currency: billingCurrencyCodeWire.optional(),
8940
8952
  billing_cadence: iso8601DurationWire.optional(),
8941
8953
  price: priceWire,
8942
8954
  unit_config: unitConfigWire.optional(),
@@ -9319,7 +9331,7 @@ export const planWire = z
9319
9331
  .int()
9320
9332
  .gte(1)
9321
9333
  .describe('Plans are versioned to allow you to make changes without affecting running subscriptions.'),
9322
- currency: currencyCodeWire,
9334
+ currency: billingCurrencyCodeWire,
9323
9335
  billing_cadence: iso8601DurationWire,
9324
9336
  pro_rating_enabled: z
9325
9337
  .boolean()
@@ -9353,7 +9365,7 @@ export const createPlanRequestWire = z
9353
9365
  .describe('Optional description of the resource. Maximum 1024 characters.'),
9354
9366
  labels: labelsWire.optional(),
9355
9367
  key: resourceKeyWire,
9356
- currency: currencyCodeWire,
9368
+ currency: billingCurrencyCodeWire,
9357
9369
  billing_cadence: iso8601DurationWire,
9358
9370
  pro_rating_enabled: z
9359
9371
  .boolean()
@@ -9985,6 +9997,10 @@ export const listCurrenciesQueryParamsWire = z.object({
9985
9997
  .optional()
9986
9998
  .describe('Sort currencies returned in the response. Supported sort attributes are: - `code` (default) - `name` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.'),
9987
9999
  filter: listCurrenciesParamsFilterWire.optional(),
10000
+ expand: z
10001
+ .array(currencyExpandWire)
10002
+ .optional()
10003
+ .describe('Expand the currencies returned in the response. To include the currently-active cost basis add: expand=cost_basis'),
9988
10004
  });
9989
10005
  export const listCurrenciesResponseWire = z.strictObject({
9990
10006
  data: z.array(currencyWire),
@@ -545,6 +545,36 @@ export interface ListCostBasesParamsFilter {
545
545
  /** Filter cost bases by fiat currency code. */
546
546
  fiatCode?: string;
547
547
  }
548
+ /** CurrencyCustom create request. */
549
+ export interface CreateCurrencyCustomRequest {
550
+ /**
551
+ * The name of the currency. It should be a human-readable string that represents
552
+ * the name of the currency, such as "US Dollar" or "Euro".
553
+ */
554
+ name: string;
555
+ /**
556
+ * The symbol of the currency. It should be a string that represents the symbol of
557
+ * the currency, such as "$" for US Dollar or "€" for Euro.
558
+ */
559
+ symbol?: string;
560
+ /**
561
+ * The precision of the currency. It should be a number that represents the number
562
+ * of decimal places used for the currency, such as 2 for US Dollar or Euro.
563
+ */
564
+ precision: number;
565
+ /**
566
+ * The decimal mark for the currency. It should be a string that represents the
567
+ * decimal mark of the currency, such as "." for US Dollar or "," for Euro.
568
+ */
569
+ decimalMark: string;
570
+ /**
571
+ * The thousand separator for the currency. It should be a string that represents
572
+ * the thousand separator of the currency, such as "," for US Dollar or "." for
573
+ * Euro.
574
+ */
575
+ thousandSeparator: string;
576
+ code: string;
577
+ }
548
578
  /** Monetary amount in a specific currency. */
549
579
  export interface CurrencyAmount {
550
580
  amount: string;
@@ -2045,36 +2075,6 @@ export interface ListCurrenciesParamsFilter {
2045
2075
  type?: 'fiat' | 'custom';
2046
2076
  code?: StringFieldFilter;
2047
2077
  }
2048
- /** CurrencyCustom create request. */
2049
- export interface CreateCurrencyCustomRequest {
2050
- /**
2051
- * The name of the currency. It should be a human-readable string that represents
2052
- * the name of the currency, such as "US Dollar" or "Euro".
2053
- */
2054
- name: string;
2055
- /**
2056
- * The symbol of the currency. It should be a string that represents the symbol of
2057
- * the currency, such as "$" for US Dollar or "€" for Euro.
2058
- */
2059
- symbol?: string;
2060
- /**
2061
- * The precision of the currency. It should be a number that represents the number
2062
- * of decimal places used for the currency, such as 2 for US Dollar or Euro.
2063
- */
2064
- precision: number;
2065
- /**
2066
- * The decimal mark for the currency. It should be a string that represents the
2067
- * decimal mark of the currency, such as "." for US Dollar or "," for Euro.
2068
- */
2069
- decimalMark: string;
2070
- /**
2071
- * The thousand separator for the currency. It should be a string that represents
2072
- * the thousand separator of the currency, such as "," for US Dollar or "." for
2073
- * Euro.
2074
- */
2075
- thousandSeparator: string;
2076
- code: string;
2077
- }
2078
2078
  /** Query to evaluate feature access for a list of customers. */
2079
2079
  export interface GovernanceQueryRequest {
2080
2080
  /**
@@ -4269,6 +4269,11 @@ export interface RateCard {
4269
4269
  key: string;
4270
4270
  /** The feature associated with the rate card. */
4271
4271
  feature?: FeatureReference;
4272
+ /**
4273
+ * Overrides the containing plan or add-on currency for this rate card. When
4274
+ * omitted, the containing resource currency applies.
4275
+ */
4276
+ currency?: BillingCurrencyCode;
4272
4277
  /**
4273
4278
  * The billing cadence of the rate card. When null, the charge is one-time
4274
4279
  * (non-recurring). Only valid for flat prices.
@@ -4862,7 +4867,7 @@ export interface Plan {
4862
4867
  */
4863
4868
  version: number;
4864
4869
  /** The currency code of the plan. */
4865
- currency: string;
4870
+ currency: BillingCurrencyCode;
4866
4871
  /** The billing cadence for subscriptions using this plan. */
4867
4872
  billingCadence: string;
4868
4873
  /** Whether pro-rating is enabled for this plan. */
@@ -4930,7 +4935,7 @@ export interface CreatePlanRequest {
4930
4935
  */
4931
4936
  key: string;
4932
4937
  /** The currency code of the plan. */
4933
- currency: string;
4938
+ currency: BillingCurrencyCode;
4934
4939
  /** The billing cadence for subscriptions using this plan. */
4935
4940
  billingCadence: string;
4936
4941
  /** Whether pro-rating is enabled for this plan. */
@@ -5141,9 +5146,9 @@ export type StringFieldFilterExact = string | {
5141
5146
  /** The payment term of a flat price. */
5142
5147
  export type PricePaymentTerm = 'in_advance' | 'in_arrears';
5143
5148
  /** Fiat or custom currency code. */
5144
- export type BillingCurrencyCode = string;
5149
+ export type BillingCurrencyCode = string | string;
5145
5150
  /** Fiat or custom currency code. */
5146
- export type CreateCurrencyCode = string;
5151
+ export type CreateCurrencyCode = string | string;
5147
5152
  /**
5148
5153
  * Filters on the given ULID field value by exact match. All properties are
5149
5154
  * optional; provide exactly one to specify the comparison.
@@ -6056,6 +6061,11 @@ export interface RateCardInput {
6056
6061
  key: string;
6057
6062
  /** The feature associated with the rate card. */
6058
6063
  feature?: FeatureReference;
6064
+ /**
6065
+ * Overrides the containing plan or add-on currency for this rate card. When
6066
+ * omitted, the containing resource currency applies.
6067
+ */
6068
+ currency?: BillingCurrencyCode;
6059
6069
  /**
6060
6070
  * The billing cadence of the rate card. When null, the charge is one-time
6061
6071
  * (non-recurring). Only valid for flat prices.
@@ -6498,7 +6508,7 @@ export interface PlanInput {
6498
6508
  */
6499
6509
  version?: number;
6500
6510
  /** The currency code of the plan. */
6501
- currency: string;
6511
+ currency: BillingCurrencyCode;
6502
6512
  /** The billing cadence for subscriptions using this plan. */
6503
6513
  billingCadence: string;
6504
6514
  /** Whether pro-rating is enabled for this plan. */
@@ -6566,7 +6576,7 @@ export interface CreatePlanRequestInput {
6566
6576
  */
6567
6577
  key: string;
6568
6578
  /** The currency code of the plan. */
6569
- currency: string;
6579
+ currency: BillingCurrencyCode;
6570
6580
  /** The billing cadence for subscriptions using this plan. */
6571
6581
  billingCadence: string;
6572
6582
  /** Whether pro-rating is enabled for this plan. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmeter/client",
3
- "version": "1.0.0-beta-9caae8e05744",
3
+ "version": "1.0.0-beta-f01fb4abbc5a",
4
4
  "description": "Official TypeScript SDK for the OpenMeter API — usage metering and billing",
5
5
  "keywords": [
6
6
  "openmeter",