@openmeter/client 1.0.0-beta-84bb9e2fb342 → 1.0.0-beta-4ffb0202fcfc

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.
@@ -2598,6 +2598,30 @@ export const workflowCollectionAlignmentAnchored = z
2598
2598
  recurring_period: recurringPeriod,
2599
2599
  })
2600
2600
  .describe('BillingWorkflowCollectionAlignmentAnchored specifies the alignment for collecting the pending line items into an invoice.');
2601
+ export const chargeFlatFeeSystemIntent = z
2602
+ .object({
2603
+ name: z
2604
+ .string()
2605
+ .min(1)
2606
+ .max(256)
2607
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
2608
+ description: z
2609
+ .string()
2610
+ .max(1024)
2611
+ .optional()
2612
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
2613
+ labels: labels.optional(),
2614
+ invoice_at: dateTime,
2615
+ service_period: closedPeriod,
2616
+ full_service_period: closedPeriod,
2617
+ billing_period: closedPeriod,
2618
+ payment_term: pricePaymentTerm,
2619
+ discounts: chargeFlatFeeDiscounts.optional(),
2620
+ proration_configuration: rateCardProrationConfiguration,
2621
+ amount_before_proration: currencyAmount,
2622
+ deleted_at: dateTime.optional(),
2623
+ })
2624
+ .describe('Flat fee intent fields from the system lifecycle controller shadowed by a manual override.');
2601
2625
  export const subscriptionPagePaginatedResponse = z
2602
2626
  .object({
2603
2627
  data: z.array(subscription),
@@ -3379,11 +3403,11 @@ export const chargeFlatFee = z
3379
3403
  proration_configuration: rateCardProrationConfiguration,
3380
3404
  amount_after_proration: currencyAmount,
3381
3405
  price: price,
3406
+ system_intent: chargeFlatFeeSystemIntent.optional(),
3382
3407
  })
3383
3408
  .describe('A flat fee charge for a customer.');
3384
- export const chargeUsageBased = z
3409
+ export const chargeUsageBasedSystemIntent = z
3385
3410
  .object({
3386
- id: ulid,
3387
3411
  name: z
3388
3412
  .string()
3389
3413
  .min(1)
@@ -3395,32 +3419,15 @@ export const chargeUsageBased = z
3395
3419
  .optional()
3396
3420
  .describe('Optional description of the resource. Maximum 1024 characters.'),
3397
3421
  labels: labels.optional(),
3398
- created_at: dateTime,
3399
- updated_at: dateTime,
3400
- deleted_at: dateTime.optional(),
3401
- type: z.literal('usage_based').describe('The type of the charge.'),
3402
- customer: billingCustomerReference,
3403
- lifecycle_controller: lifecycleController,
3404
- subscription: subscriptionReference.optional(),
3405
- currency: currencyCode,
3406
- status: chargeStatus,
3407
3422
  invoice_at: dateTime,
3408
3423
  service_period: closedPeriod,
3409
3424
  full_service_period: closedPeriod,
3410
3425
  billing_period: closedPeriod,
3411
- advance_after: dateTime.optional(),
3412
- unique_reference_id: z
3413
- .string()
3414
- .optional()
3415
- .describe('Unique reference ID of the charge.'),
3416
- settlement_mode: settlementMode,
3417
- tax_config: taxConfig.optional(),
3418
3426
  discounts: rateCardDiscounts.optional(),
3419
- feature_key: z.string().describe('The feature associated with the charge.'),
3420
- totals: chargeTotals,
3421
3427
  price: price,
3428
+ deleted_at: dateTime.optional(),
3422
3429
  })
3423
- .describe('A usage-based charge for a customer.');
3430
+ .describe('Usage-based intent fields from the system lifecycle controller shadowed by a manual override.');
3424
3431
  export const createChargeUsageBasedRequest = z
3425
3432
  .object({
3426
3433
  name: z
@@ -3498,9 +3505,47 @@ export const workflow = z
3498
3505
  tax: workflowTaxSettings.optional(),
3499
3506
  })
3500
3507
  .describe('Billing workflow settings.');
3501
- export const charge = z
3502
- .discriminatedUnion('type', [chargeFlatFee, chargeUsageBased])
3503
- .describe('Customer charge.');
3508
+ export const chargeUsageBased = z
3509
+ .object({
3510
+ id: ulid,
3511
+ name: z
3512
+ .string()
3513
+ .min(1)
3514
+ .max(256)
3515
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
3516
+ description: z
3517
+ .string()
3518
+ .max(1024)
3519
+ .optional()
3520
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
3521
+ labels: labels.optional(),
3522
+ created_at: dateTime,
3523
+ updated_at: dateTime,
3524
+ deleted_at: dateTime.optional(),
3525
+ type: z.literal('usage_based').describe('The type of the charge.'),
3526
+ customer: billingCustomerReference,
3527
+ lifecycle_controller: lifecycleController,
3528
+ subscription: subscriptionReference.optional(),
3529
+ currency: currencyCode,
3530
+ status: chargeStatus,
3531
+ invoice_at: dateTime,
3532
+ service_period: closedPeriod,
3533
+ full_service_period: closedPeriod,
3534
+ billing_period: closedPeriod,
3535
+ advance_after: dateTime.optional(),
3536
+ unique_reference_id: z
3537
+ .string()
3538
+ .optional()
3539
+ .describe('Unique reference ID of the charge.'),
3540
+ settlement_mode: settlementMode,
3541
+ tax_config: taxConfig.optional(),
3542
+ discounts: rateCardDiscounts.optional(),
3543
+ feature_key: z.string().describe('The feature associated with the charge.'),
3544
+ totals: chargeTotals,
3545
+ price: price,
3546
+ system_intent: chargeUsageBasedSystemIntent.optional(),
3547
+ })
3548
+ .describe('A usage-based charge for a customer.');
3504
3549
  export const createChargeRequest = z
3505
3550
  .discriminatedUnion('type', [
3506
3551
  createChargeFlatFeeRequest,
@@ -3702,12 +3747,9 @@ export const upsertBillingProfileRequest = z
3702
3747
  default: z.boolean().describe('Whether this is the default profile.'),
3703
3748
  })
3704
3749
  .describe('BillingProfile upsert request.');
3705
- export const chargePagePaginatedResponse = z
3706
- .object({
3707
- data: z.array(charge),
3708
- meta: paginatedMeta,
3709
- })
3710
- .describe('Page paginated response.');
3750
+ export const charge = z
3751
+ .discriminatedUnion('type', [chargeFlatFee, chargeUsageBased])
3752
+ .describe('Customer charge.');
3711
3753
  export const subscriptionAddon = z
3712
3754
  .object({
3713
3755
  id: ulid,
@@ -3853,6 +3895,12 @@ export const profilePagePaginatedResponse = z
3853
3895
  meta: paginatedMeta,
3854
3896
  })
3855
3897
  .describe('Page paginated response.');
3898
+ export const chargePagePaginatedResponse = z
3899
+ .object({
3900
+ data: z.array(charge),
3901
+ meta: paginatedMeta,
3902
+ })
3903
+ .describe('Page paginated response.');
3856
3904
  export const subscriptionAddonPagePaginatedResponse = z
3857
3905
  .object({
3858
3906
  data: z.array(subscriptionAddon),
@@ -2982,6 +2982,46 @@ export interface WorkflowCollectionAlignmentAnchored {
2982
2982
  /** The recurring period for the alignment. */
2983
2983
  recurring_period: RecurringPeriod;
2984
2984
  }
2985
+ /**
2986
+ * Flat fee intent fields from the system lifecycle controller shadowed by a manual
2987
+ * override.
2988
+ */
2989
+ export interface ChargeFlatFeeSystemIntent {
2990
+ /**
2991
+ * Display name of the resource.
2992
+ *
2993
+ * Between 1 and 256 characters.
2994
+ */
2995
+ name: string;
2996
+ /**
2997
+ * Optional description of the resource.
2998
+ *
2999
+ * Maximum 1024 characters.
3000
+ */
3001
+ description?: string;
3002
+ labels?: Labels;
3003
+ /** The timestamp when the charge is intended to be invoiced. */
3004
+ invoice_at: string;
3005
+ /** The effective service period covered by the charge. */
3006
+ service_period: ClosedPeriod;
3007
+ /** The full, unprorated service period of the charge. */
3008
+ full_service_period: ClosedPeriod;
3009
+ /** The billing period the charge belongs to. */
3010
+ billing_period: ClosedPeriod;
3011
+ /** Payment term of the flat fee charge. */
3012
+ payment_term: 'in_advance' | 'in_arrears';
3013
+ /** The discounts applied to the charge. */
3014
+ discounts?: ChargeFlatFeeDiscounts;
3015
+ /** The proration configuration of the charge. */
3016
+ proration_configuration: RateCardProrationConfiguration;
3017
+ /** The amount before proration of the system lifecycle controller flat fee intent. */
3018
+ amount_before_proration: CurrencyAmount;
3019
+ /**
3020
+ * The timestamp when the system lifecycle controller intent was deleted. The
3021
+ * effective charge can remain visible while a manual override is active.
3022
+ */
3023
+ deleted_at?: string;
3024
+ }
2985
3025
  /** Page paginated response. */
2986
3026
  export interface SubscriptionPagePaginatedResponse {
2987
3027
  data: Subscription[];
@@ -4123,10 +4163,18 @@ export interface ChargeFlatFee {
4123
4163
  amount_after_proration: CurrencyAmount;
4124
4164
  /** The price of the charge. */
4125
4165
  price: PriceFree | PriceFlat | PriceUnit | PriceGraduated | PriceVolume;
4166
+ /**
4167
+ * Current intent from the system lifecycle controller for a charge that has an
4168
+ * active manual override. The top-level charge fields remain the effective
4169
+ * customer-facing intent.
4170
+ */
4171
+ system_intent?: ChargeFlatFeeSystemIntent;
4126
4172
  }
4127
- /** A usage-based charge for a customer. */
4128
- export interface ChargeUsageBased {
4129
- id: string;
4173
+ /**
4174
+ * Usage-based intent fields from the system lifecycle controller shadowed by a
4175
+ * manual override.
4176
+ */
4177
+ export interface ChargeUsageBasedSystemIntent {
4130
4178
  /**
4131
4179
  * Display name of the resource.
4132
4180
  *
@@ -4140,30 +4188,6 @@ export interface ChargeUsageBased {
4140
4188
  */
4141
4189
  description?: string;
4142
4190
  labels?: Labels;
4143
- /** An ISO-8601 timestamp representation of entity creation date. */
4144
- created_at: string;
4145
- /** An ISO-8601 timestamp representation of entity last update date. */
4146
- updated_at: string;
4147
- /** An ISO-8601 timestamp representation of entity deletion date. */
4148
- deleted_at?: string;
4149
- /** The type of the charge. */
4150
- type: 'usage_based';
4151
- /** The customer owning the charge. */
4152
- customer: BillingCustomerReference;
4153
- /**
4154
- * Indicates whether the charge lifecycle is controlled by OpenMeter or manually
4155
- * overridden by the API user.
4156
- */
4157
- lifecycle_controller: 'system' | 'manual';
4158
- /**
4159
- * The subscription that originated the charge, when the charge was created from a
4160
- * subscription item.
4161
- */
4162
- subscription?: SubscriptionReference;
4163
- /** The currency of the charge. */
4164
- currency: string;
4165
- /** The lifecycle status of the charge. */
4166
- status: 'created' | 'active' | 'final' | 'deleted';
4167
4191
  /** The timestamp when the charge is intended to be invoiced. */
4168
4192
  invoice_at: string;
4169
4193
  /** The effective service period covered by the charge. */
@@ -4172,25 +4196,15 @@ export interface ChargeUsageBased {
4172
4196
  full_service_period: ClosedPeriod;
4173
4197
  /** The billing period the charge belongs to. */
4174
4198
  billing_period: ClosedPeriod;
4175
- /**
4176
- * The earliest time when the charge should be advanced again by background
4177
- * processing.
4178
- */
4179
- advance_after?: string;
4180
- /** Unique reference ID of the charge. */
4181
- unique_reference_id?: string;
4182
- /** Settlement mode of the charge. */
4183
- settlement_mode: 'credit_then_invoice' | 'credit_only';
4184
- /** Tax configuration of the charge. */
4185
- tax_config?: TaxConfig;
4186
4199
  /** Discounts applied to the usage-based charge. */
4187
4200
  discounts?: RateCardDiscounts;
4188
- /** The feature associated with the charge. */
4189
- feature_key: string;
4190
- /** Aggregated booked and realtime totals for the charge. */
4191
- totals: ChargeTotals;
4192
4201
  /** The price of the charge. */
4193
4202
  price: PriceFree | PriceFlat | PriceUnit | PriceGraduated | PriceVolume;
4203
+ /**
4204
+ * The timestamp when the system lifecycle controller intent was deleted. The
4205
+ * effective charge can remain visible while a manual override is active.
4206
+ */
4207
+ deleted_at?: string;
4194
4208
  }
4195
4209
  /** Usage-based charge create request. */
4196
4210
  export interface CreateChargeUsageBasedRequest {
@@ -4315,6 +4329,80 @@ export interface Workflow {
4315
4329
  /** The tax settings for this workflow */
4316
4330
  tax?: WorkflowTaxSettings;
4317
4331
  }
4332
+ /** A usage-based charge for a customer. */
4333
+ export interface ChargeUsageBased {
4334
+ id: string;
4335
+ /**
4336
+ * Display name of the resource.
4337
+ *
4338
+ * Between 1 and 256 characters.
4339
+ */
4340
+ name: string;
4341
+ /**
4342
+ * Optional description of the resource.
4343
+ *
4344
+ * Maximum 1024 characters.
4345
+ */
4346
+ description?: string;
4347
+ labels?: Labels;
4348
+ /** An ISO-8601 timestamp representation of entity creation date. */
4349
+ created_at: string;
4350
+ /** An ISO-8601 timestamp representation of entity last update date. */
4351
+ updated_at: string;
4352
+ /** An ISO-8601 timestamp representation of entity deletion date. */
4353
+ deleted_at?: string;
4354
+ /** The type of the charge. */
4355
+ type: 'usage_based';
4356
+ /** The customer owning the charge. */
4357
+ customer: BillingCustomerReference;
4358
+ /**
4359
+ * Indicates whether the charge lifecycle is controlled by OpenMeter or manually
4360
+ * overridden by the API user.
4361
+ */
4362
+ lifecycle_controller: 'system' | 'manual';
4363
+ /**
4364
+ * The subscription that originated the charge, when the charge was created from a
4365
+ * subscription item.
4366
+ */
4367
+ subscription?: SubscriptionReference;
4368
+ /** The currency of the charge. */
4369
+ currency: string;
4370
+ /** The lifecycle status of the charge. */
4371
+ status: 'created' | 'active' | 'final' | 'deleted';
4372
+ /** The timestamp when the charge is intended to be invoiced. */
4373
+ invoice_at: string;
4374
+ /** The effective service period covered by the charge. */
4375
+ service_period: ClosedPeriod;
4376
+ /** The full, unprorated service period of the charge. */
4377
+ full_service_period: ClosedPeriod;
4378
+ /** The billing period the charge belongs to. */
4379
+ billing_period: ClosedPeriod;
4380
+ /**
4381
+ * The earliest time when the charge should be advanced again by background
4382
+ * processing.
4383
+ */
4384
+ advance_after?: string;
4385
+ /** Unique reference ID of the charge. */
4386
+ unique_reference_id?: string;
4387
+ /** Settlement mode of the charge. */
4388
+ settlement_mode: 'credit_then_invoice' | 'credit_only';
4389
+ /** Tax configuration of the charge. */
4390
+ tax_config?: TaxConfig;
4391
+ /** Discounts applied to the usage-based charge. */
4392
+ discounts?: RateCardDiscounts;
4393
+ /** The feature associated with the charge. */
4394
+ feature_key: string;
4395
+ /** Aggregated booked and realtime totals for the charge. */
4396
+ totals: ChargeTotals;
4397
+ /** The price of the charge. */
4398
+ price: PriceFree | PriceFlat | PriceUnit | PriceGraduated | PriceVolume;
4399
+ /**
4400
+ * Current intent from the system lifecycle controller for a charge that has an
4401
+ * active manual override. The top-level charge fields remain the effective
4402
+ * customer-facing intent.
4403
+ */
4404
+ system_intent?: ChargeUsageBasedSystemIntent;
4405
+ }
4318
4406
  /** A rate card for a subscription add-on. */
4319
4407
  export interface SubscriptionAddonRateCard {
4320
4408
  /** The rate card. */
@@ -4611,11 +4699,6 @@ export interface UpsertBillingProfileRequest {
4611
4699
  /** Whether this is the default profile. */
4612
4700
  default: boolean;
4613
4701
  }
4614
- /** Page paginated response. */
4615
- export interface ChargePagePaginatedResponse {
4616
- data: (ChargeFlatFee | ChargeUsageBased)[];
4617
- meta: PaginatedMeta;
4618
- }
4619
4702
  /** Addon purchased with a subscription. */
4620
4703
  export interface SubscriptionAddon {
4621
4704
  id: string;
@@ -4803,6 +4886,11 @@ export interface ProfilePagePaginatedResponse {
4803
4886
  meta: PaginatedMeta;
4804
4887
  }
4805
4888
  /** Page paginated response. */
4889
+ export interface ChargePagePaginatedResponse {
4890
+ data: (ChargeFlatFee | ChargeUsageBased)[];
4891
+ meta: PaginatedMeta;
4892
+ }
4893
+ /** Page paginated response. */
4806
4894
  export interface SubscriptionAddonPagePaginatedResponse {
4807
4895
  data: SubscriptionAddon[];
4808
4896
  meta: PaginatedMeta;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmeter/client",
3
- "version": "1.0.0-beta-84bb9e2fb342",
3
+ "version": "1.0.0-beta-4ffb0202fcfc",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://openmeter.io",
6
6
  "repository": {