@openmeter/client 1.0.0-beta.232 → 1.0.0-beta.233

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 (50) hide show
  1. package/README.md +76 -45
  2. package/dist/funcs/apps.js +7 -2
  3. package/dist/funcs/billing.js +7 -2
  4. package/dist/funcs/charges.d.ts +14 -0
  5. package/dist/funcs/charges.js +42 -0
  6. package/dist/funcs/{governance.d.ts → entitlementAccess.d.ts} +4 -4
  7. package/dist/funcs/{governance.js → entitlementAccess.js} +10 -10
  8. package/dist/funcs/entitlements.d.ts +9 -1
  9. package/dist/funcs/entitlements.js +50 -1
  10. package/dist/funcs/index.d.ts +2 -1
  11. package/dist/funcs/index.js +2 -1
  12. package/dist/funcs/planAddons.js +7 -2
  13. package/dist/funcs/subscriptions.d.ts +60 -1
  14. package/dist/funcs/subscriptions.js +204 -0
  15. package/dist/index.d.ts +4 -2
  16. package/dist/index.js +1 -0
  17. package/dist/lib/version.d.ts +1 -1
  18. package/dist/lib/version.js +1 -1
  19. package/dist/lib/wire.js +62 -6
  20. package/dist/models/operations/apps.d.ts +17 -1
  21. package/dist/models/operations/billing.d.ts +19 -1
  22. package/dist/models/operations/charges.d.ts +54 -0
  23. package/dist/models/operations/customers.d.ts +19 -5
  24. package/dist/models/operations/entitlementAccess.d.ts +9 -0
  25. package/dist/models/operations/entitlementAccess.js +2 -0
  26. package/dist/models/operations/entitlements.d.ts +18 -1
  27. package/dist/models/operations/planAddons.d.ts +14 -1
  28. package/dist/models/operations/subscriptions.d.ts +27 -3
  29. package/dist/models/schemas.d.ts +46830 -22570
  30. package/dist/models/schemas.js +3175 -1508
  31. package/dist/models/types.d.ts +4115 -1896
  32. package/dist/sdk/apps.d.ts +1 -62
  33. package/dist/sdk/apps.js +1 -76
  34. package/dist/sdk/customers.d.ts +2 -56
  35. package/dist/sdk/customers.js +1 -67
  36. package/dist/sdk/entitlements.d.ts +9 -1
  37. package/dist/sdk/entitlements.js +11 -1
  38. package/dist/sdk/internal.d.ts +183 -22
  39. package/dist/sdk/internal.js +231 -26
  40. package/dist/sdk/invoices.d.ts +112 -0
  41. package/dist/sdk/invoices.js +115 -0
  42. package/dist/sdk/planAddons.d.ts +1 -20
  43. package/dist/sdk/planAddons.js +1 -24
  44. package/dist/sdk/sdk.d.ts +3 -0
  45. package/dist/sdk/sdk.js +5 -0
  46. package/dist/sdk/subscriptions.d.ts +20 -1
  47. package/dist/sdk/subscriptions.js +24 -1
  48. package/package.json +1 -1
  49. package/dist/models/operations/governance.d.ts +0 -9
  50. /package/dist/models/operations/{governance.js → charges.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type Result, type RequestOptions } from '../lib/types.js';
3
- import type { CreateSubscriptionRequest, CreateSubscriptionResponse, ListSubscriptionsRequest, ListSubscriptionsResponse, GetSubscriptionRequest, GetSubscriptionResponse, CancelSubscriptionRequest, CancelSubscriptionResponse, UnscheduleCancelationRequest, UnscheduleCancelationResponse, ChangeSubscriptionRequest, ChangeSubscriptionResponse, CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse, ListSubscriptionAddonsRequest, ListSubscriptionAddonsResponse, GetSubscriptionAddonRequest, GetSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
3
+ import type { CreateSubscriptionRequest, CreateSubscriptionResponse, ListSubscriptionsRequest, ListSubscriptionsResponse, GetSubscriptionRequest, GetSubscriptionResponse, CancelSubscriptionRequest, CancelSubscriptionResponse, UnscheduleCancelationRequest, UnscheduleCancelationResponse, UnscheduleSubscriptionRequest, UnscheduleSubscriptionResponse, RestoreSubscriptionRequest, RestoreSubscriptionResponse, ChangeSubscriptionRequest, ChangeSubscriptionResponse, MigrateSubscriptionRequest, MigrateSubscriptionResponse, EditSubscriptionRequest, EditSubscriptionResponse, CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse, ListSubscriptionAddonsRequest, ListSubscriptionAddonsResponse, GetSubscriptionAddonRequest, GetSubscriptionAddonResponse, UpdateSubscriptionAddonRequest, UpdateSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
4
4
  /**
5
5
  * Create subscription
6
6
  *
@@ -36,6 +36,29 @@ export declare function cancelSubscription(client: Client, req: CancelSubscripti
36
36
  * POST /openmeter/subscriptions/{subscriptionId}/unschedule-cancelation
37
37
  */
38
38
  export declare function unscheduleCancelation(client: Client, req: UnscheduleCancelationRequest, options?: RequestOptions): Promise<Result<UnscheduleCancelationResponse>>;
39
+ /**
40
+ * Unschedule subscription
41
+ *
42
+ * Deletes a scheduled subscription that has not yet become active, removing it and
43
+ * resolving any scheduling conflict it was holding. This is distinct from
44
+ * canceling: cancel ends a running subscription, whereas unscheduling removes a
45
+ * not-yet-active one. Only scheduled subscriptions can be unscheduled;
46
+ * unscheduling an active or already-started subscription is rejected.
47
+ *
48
+ * POST /openmeter/subscriptions/{subscriptionId}/unschedule
49
+ */
50
+ export declare function unscheduleSubscription(client: Client, req: UnscheduleSubscriptionRequest, options?: RequestOptions): Promise<Result<UnscheduleSubscriptionResponse>>;
51
+ /**
52
+ * Restore subscription
53
+ *
54
+ * Restores the subscription by deleting any later-scheduled successor
55
+ * subscriptions and continuing this one indefinitely. This is the inverse of a
56
+ * future-dated change, which schedules a successor. Restore is not available when
57
+ * multi-subscription is enabled.
58
+ *
59
+ * POST /openmeter/subscriptions/{subscriptionId}/restore
60
+ */
61
+ export declare function restoreSubscription(client: Client, req: RestoreSubscriptionRequest, options?: RequestOptions): Promise<Result<RestoreSubscriptionResponse>>;
39
62
  /**
40
63
  * Change subscription
41
64
  *
@@ -45,6 +68,32 @@ export declare function unscheduleCancelation(client: Client, req: UnscheduleCan
45
68
  * POST /openmeter/subscriptions/{subscriptionId}/change
46
69
  */
47
70
  export declare function changeSubscription(client: Client, req: ChangeSubscriptionRequest, options?: RequestOptions): Promise<Result<ChangeSubscriptionResponse>>;
71
+ /**
72
+ * Migrate subscription
73
+ *
74
+ * Migrates to a later version of the current plan. With starting_phase omitted and
75
+ * billing_anchor omitted or unchanged, migration amends the subscription in place:
76
+ * unchanged items retain their service periods and both response entries have the
77
+ * same ID. Existing addons must remain compatible with the target plan.
78
+ * Incompatible phase timelines or billing settings return an error. Providing
79
+ * starting_phase or a different billing_anchor explicitly requests replacement,
80
+ * which resets the phase timeline, may produce billing adjustments, and does not
81
+ * transfer addons. Custom subscriptions cannot be migrated.
82
+ *
83
+ * POST /openmeter/subscriptions/{subscriptionId}/migrate
84
+ */
85
+ export declare function migrateSubscription(client: Client, req: MigrateSubscriptionRequest, options?: RequestOptions): Promise<Result<MigrateSubscriptionResponse>>;
86
+ /**
87
+ * Edit subscription
88
+ *
89
+ * Edits a running subscription by applying an ordered batch of customizations
90
+ * (adding or removing items, adding, removing, or stretching phases, or
91
+ * unscheduling a pending edit). The changes may take effect immediately or at the
92
+ * next billing cycle. Subscriptions that have add-ons cannot be edited.
93
+ *
94
+ * POST /openmeter/subscriptions/{subscriptionId}/edit
95
+ */
96
+ export declare function editSubscription(client: Client, req: EditSubscriptionRequest, options?: RequestOptions): Promise<Result<EditSubscriptionResponse>>;
48
97
  /**
49
98
  * Create a new subscription add-on
50
99
  *
@@ -69,3 +118,13 @@ export declare function listSubscriptionAddons(client: Client, req: ListSubscrip
69
118
  * GET /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}
70
119
  */
71
120
  export declare function getSubscriptionAddon(client: Client, req: GetSubscriptionAddonRequest, options?: RequestOptions): Promise<Result<GetSubscriptionAddonResponse>>;
121
+ /**
122
+ * Update subscription addon
123
+ *
124
+ * Update a subscription add-on. Only the quantity is mutable; the timing controls
125
+ * when the new quantity takes effect. A new entry is appended to the add-on's
126
+ * timeline.
127
+ *
128
+ * PATCH /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}
129
+ */
130
+ export declare function updateSubscriptionAddon(client: Client, req: UpdateSubscriptionAddonRequest, options?: RequestOptions): Promise<Result<UpdateSubscriptionAddonResponse>>;
@@ -164,6 +164,75 @@ export function unscheduleCancelation(client, req, options) {
164
164
  });
165
165
  });
166
166
  }
167
+ /**
168
+ * Unschedule subscription
169
+ *
170
+ * Deletes a scheduled subscription that has not yet become active, removing it and
171
+ * resolving any scheduling conflict it was holding. This is distinct from
172
+ * canceling: cancel ends a running subscription, whereas unscheduling removes a
173
+ * not-yet-active one. Only scheduled subscriptions can be unscheduled;
174
+ * unscheduling an active or already-started subscription is rejected.
175
+ *
176
+ * POST /openmeter/subscriptions/{subscriptionId}/unschedule
177
+ */
178
+ export function unscheduleSubscription(client, req, options) {
179
+ return request(async () => {
180
+ const pathParamsInput = {
181
+ subscriptionId: req.subscriptionId,
182
+ };
183
+ const pathParams = client._options.validate
184
+ ? toPathWire(pathParamsInput, schemas.unscheduleSubscriptionPathParams)
185
+ : pathParamsInput;
186
+ if (client._options.validate) {
187
+ assertValid(schemas.unscheduleSubscriptionPathParamsWire, pathParams);
188
+ }
189
+ const path = `openmeter/subscriptions/${(() => {
190
+ if (pathParams.subscriptionId === undefined) {
191
+ throw new Error('missing path parameter: subscriptionId');
192
+ }
193
+ return encodeURIComponent(String(pathParams.subscriptionId));
194
+ })()}/unschedule`;
195
+ await http(client).post(path, options);
196
+ });
197
+ }
198
+ /**
199
+ * Restore subscription
200
+ *
201
+ * Restores the subscription by deleting any later-scheduled successor
202
+ * subscriptions and continuing this one indefinitely. This is the inverse of a
203
+ * future-dated change, which schedules a successor. Restore is not available when
204
+ * multi-subscription is enabled.
205
+ *
206
+ * POST /openmeter/subscriptions/{subscriptionId}/restore
207
+ */
208
+ export function restoreSubscription(client, req, options) {
209
+ return request(() => {
210
+ const pathParamsInput = {
211
+ subscriptionId: req.subscriptionId,
212
+ };
213
+ const pathParams = client._options.validate
214
+ ? toPathWire(pathParamsInput, schemas.restoreSubscriptionPathParams)
215
+ : pathParamsInput;
216
+ if (client._options.validate) {
217
+ assertValid(schemas.restoreSubscriptionPathParamsWire, pathParams);
218
+ }
219
+ const path = `openmeter/subscriptions/${(() => {
220
+ if (pathParams.subscriptionId === undefined) {
221
+ throw new Error('missing path parameter: subscriptionId');
222
+ }
223
+ return encodeURIComponent(String(pathParams.subscriptionId));
224
+ })()}/restore`;
225
+ return http(client)
226
+ .post(path, options)
227
+ .json()
228
+ .then((data) => {
229
+ if (client._options.validate) {
230
+ assertValid(schemas.restoreSubscriptionResponseWire, data);
231
+ }
232
+ return fromWire(data, schemas.restoreSubscriptionResponse);
233
+ });
234
+ });
235
+ }
167
236
  /**
168
237
  * Change subscription
169
238
  *
@@ -204,6 +273,94 @@ export function changeSubscription(client, req, options) {
204
273
  });
205
274
  });
206
275
  }
276
+ /**
277
+ * Migrate subscription
278
+ *
279
+ * Migrates to a later version of the current plan. With starting_phase omitted and
280
+ * billing_anchor omitted or unchanged, migration amends the subscription in place:
281
+ * unchanged items retain their service periods and both response entries have the
282
+ * same ID. Existing addons must remain compatible with the target plan.
283
+ * Incompatible phase timelines or billing settings return an error. Providing
284
+ * starting_phase or a different billing_anchor explicitly requests replacement,
285
+ * which resets the phase timeline, may produce billing adjustments, and does not
286
+ * transfer addons. Custom subscriptions cannot be migrated.
287
+ *
288
+ * POST /openmeter/subscriptions/{subscriptionId}/migrate
289
+ */
290
+ export function migrateSubscription(client, req, options) {
291
+ return request(() => {
292
+ const pathParamsInput = {
293
+ subscriptionId: req.subscriptionId,
294
+ };
295
+ const pathParams = client._options.validate
296
+ ? toPathWire(pathParamsInput, schemas.migrateSubscriptionPathParams)
297
+ : pathParamsInput;
298
+ if (client._options.validate) {
299
+ assertValid(schemas.migrateSubscriptionPathParamsWire, pathParams);
300
+ }
301
+ const path = `openmeter/subscriptions/${(() => {
302
+ if (pathParams.subscriptionId === undefined) {
303
+ throw new Error('missing path parameter: subscriptionId');
304
+ }
305
+ return encodeURIComponent(String(pathParams.subscriptionId));
306
+ })()}/migrate`;
307
+ const body = toWire(req.body, schemas.migrateSubscriptionBody);
308
+ if (client._options.validate) {
309
+ assertValid(schemas.migrateSubscriptionBodyWire, body);
310
+ }
311
+ return http(client)
312
+ .post(path, { ...options, json: body })
313
+ .json()
314
+ .then((data) => {
315
+ if (client._options.validate) {
316
+ assertValid(schemas.migrateSubscriptionResponseWire, data);
317
+ }
318
+ return fromWire(data, schemas.migrateSubscriptionResponse);
319
+ });
320
+ });
321
+ }
322
+ /**
323
+ * Edit subscription
324
+ *
325
+ * Edits a running subscription by applying an ordered batch of customizations
326
+ * (adding or removing items, adding, removing, or stretching phases, or
327
+ * unscheduling a pending edit). The changes may take effect immediately or at the
328
+ * next billing cycle. Subscriptions that have add-ons cannot be edited.
329
+ *
330
+ * POST /openmeter/subscriptions/{subscriptionId}/edit
331
+ */
332
+ export function editSubscription(client, req, options) {
333
+ return request(() => {
334
+ const pathParamsInput = {
335
+ subscriptionId: req.subscriptionId,
336
+ };
337
+ const pathParams = client._options.validate
338
+ ? toPathWire(pathParamsInput, schemas.editSubscriptionPathParams)
339
+ : pathParamsInput;
340
+ if (client._options.validate) {
341
+ assertValid(schemas.editSubscriptionPathParamsWire, pathParams);
342
+ }
343
+ const path = `openmeter/subscriptions/${(() => {
344
+ if (pathParams.subscriptionId === undefined) {
345
+ throw new Error('missing path parameter: subscriptionId');
346
+ }
347
+ return encodeURIComponent(String(pathParams.subscriptionId));
348
+ })()}/edit`;
349
+ const body = toWire(req.body, schemas.editSubscriptionBody);
350
+ if (client._options.validate) {
351
+ assertValid(schemas.editSubscriptionBodyWire, body);
352
+ }
353
+ return http(client)
354
+ .post(path, { ...options, json: body })
355
+ .json()
356
+ .then((data) => {
357
+ if (client._options.validate) {
358
+ assertValid(schemas.editSubscriptionResponseWire, data);
359
+ }
360
+ return fromWire(data, schemas.editSubscriptionResponse);
361
+ });
362
+ });
363
+ }
207
364
  /**
208
365
  * Create a new subscription add-on
209
366
  *
@@ -330,3 +487,50 @@ export function getSubscriptionAddon(client, req, options) {
330
487
  });
331
488
  });
332
489
  }
490
+ /**
491
+ * Update subscription addon
492
+ *
493
+ * Update a subscription add-on. Only the quantity is mutable; the timing controls
494
+ * when the new quantity takes effect. A new entry is appended to the add-on's
495
+ * timeline.
496
+ *
497
+ * PATCH /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}
498
+ */
499
+ export function updateSubscriptionAddon(client, req, options) {
500
+ return request(() => {
501
+ const pathParamsInput = {
502
+ subscriptionId: req.subscriptionId,
503
+ subscriptionAddonId: req.subscriptionAddonId,
504
+ };
505
+ const pathParams = client._options.validate
506
+ ? toPathWire(pathParamsInput, schemas.updateSubscriptionAddonPathParams)
507
+ : pathParamsInput;
508
+ if (client._options.validate) {
509
+ assertValid(schemas.updateSubscriptionAddonPathParamsWire, pathParams);
510
+ }
511
+ const path = `openmeter/subscriptions/${(() => {
512
+ if (pathParams.subscriptionId === undefined) {
513
+ throw new Error('missing path parameter: subscriptionId');
514
+ }
515
+ return encodeURIComponent(String(pathParams.subscriptionId));
516
+ })()}/addons/${(() => {
517
+ if (pathParams.subscriptionAddonId === undefined) {
518
+ throw new Error('missing path parameter: subscriptionAddonId');
519
+ }
520
+ return encodeURIComponent(String(pathParams.subscriptionAddonId));
521
+ })()}`;
522
+ const body = toWire(req.body, schemas.updateSubscriptionAddonBody);
523
+ if (client._options.validate) {
524
+ assertValid(schemas.updateSubscriptionAddonBodyWire, body);
525
+ }
526
+ return http(client)
527
+ .patch(path, { ...options, json: body })
528
+ .json()
529
+ .then((data) => {
530
+ if (client._options.validate) {
531
+ assertValid(schemas.updateSubscriptionAddonResponseWire, data);
532
+ }
533
+ return fromWire(data, schemas.updateSubscriptionAddonResponse);
534
+ });
535
+ });
536
+ }
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { Meters } from './sdk/meters.js';
4
4
  export { Customers } from './sdk/customers.js';
5
5
  export { Entitlements } from './sdk/entitlements.js';
6
6
  export { Subscriptions } from './sdk/subscriptions.js';
7
+ export { Apps } from './sdk/apps.js';
7
8
  export { Billing } from './sdk/billing.js';
8
9
  export { Tax } from './sdk/tax.js';
9
10
  export { Features } from './sdk/features.js';
@@ -31,6 +32,7 @@ export type * from './models/operations/subscriptions.js';
31
32
  export type * from './models/operations/apps.js';
32
33
  export type * from './models/operations/billing.js';
33
34
  export type * from './models/operations/invoices.js';
35
+ export type * from './models/operations/charges.js';
34
36
  export type * from './models/operations/tax.js';
35
37
  export type * from './models/operations/currencies.js';
36
38
  export type * from './models/operations/features.js';
@@ -39,5 +41,5 @@ export type * from './models/operations/plans.js';
39
41
  export type * from './models/operations/addons.js';
40
42
  export type * from './models/operations/planAddons.js';
41
43
  export type * from './models/operations/defaults.js';
42
- export type * from './models/operations/governance.js';
43
- export type { Labels, CursorPaginationQueryPage, SortQuery, IngestedEventValidationError, CursorMetaPage, BaseError, PageMeta, QueryFilterString, AppStripeCheckoutSessionCustomTextParams, AppStripeCreateCustomerPortalSessionOptions, CreateLabels, TaxConfigStripe, TaxConfigExternalInvoicing, ChargeFlatFeeDiscounts, PriceFree, RateCardStaticEntitlement, RateCardBooleanEntitlement, UpdateLabels, InstallAppStripeWithApiKey, InstallAppSandbox, InstallAppExternalInvoicing, WorkflowCollectionAlignmentSubscription, WorkflowPaymentChargeAutomaticallySettings, WorkflowPaymentSendInvoiceSettings, InvoiceExternalReferences, InvoiceAvailableActionDetails, InvoiceWorkflowInvoicingSettings, InvoiceLineExternalReferences, UpdateBillingInvoiceWorkflowInvoicingSettings, UpdateBillingWorkflowPaymentChargeAutomaticallySettings, UpdateBillingWorkflowPaymentSendInvoiceSettings, UpdatePriceFree, LlmCostProvider, LlmCostModel, ProductCatalogValidationError, GovernanceQueryRequestCustomers, GovernanceQueryRequestFeatures, QueryFilterInteger, QueryFilterFloat, QueryFilterBoolean, PagePaginationQuery, PublicLabels, SystemAccountAccessToken, PersonalAccessToken, KonnectAccessToken, AppCustomerDataStripe, AppCustomerDataExternalInvoicing, CurrencyFiat, ListCostBasesParamsFilter, CreateCurrencyCustomRequest, CurrencyAmount, PriceFlat, PriceUnit, RateCardDiscounts, Totals, SpendCommitments, InvoiceLineCreditsApplied, UpdatePriceFlat, UpdatePriceUnit, UpdateDiscounts, FeatureManualUnitCost, FeatureLlmUnitCostPricing, LlmCostModelPricing, QueryFilterNumeric, CursorPaginationQuery, ListMetersParamsFilter, ListLlmCostPricesParamsFilter, LabelsFieldFilter, CustomerReference, ProfileReference, CreateResourceReference, TaxCodeReference, CreditGrantInvoiceReference, BillingCustomerReference, SubscriptionReference, AddonReference, FeatureReference, AppReference, ChargeReference, UpdateResourceReference, Event, MeterQueryRow, AppStripeCreateCustomerPortalSessionResult, ClosedPeriod, SubscriptionAddonTimelineSegment, UpdateClosedPeriod, CostBasis, FeatureCostQueryRow, Resource, ResourceImmutable, QueryFilterDateTime, CursorMeta, InvalidParameterStandard, InvalidParameterMinimumLength, InvalidParameterMaximumLength, InvalidParameterChoiceItem, InvalidParameterDependentItem, Unauthorized, Forbidden, NotFound, Gone, Conflict, PayloadTooLarge, UnsupportedMediaType, UnprocessableContent, TooManyRequests, Internal, NotImplemented, NotAvailable, CreateCreditGrantFilters, CreditGrantFilters, UpsertPlanAddonRequest, ResourceWithKey, Meter, PaginatedMeta, QueryFilterStringMapItem, CustomerKeyReference, CustomerUsageAttribution, UpdateCustomerUsageAttribution, Address, UpdateAddress, AppStripeCreateCheckoutSessionCustomerUpdate, AppStripeCreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreement, AppStripeCreateCheckoutSessionTaxIdCollection, AppStripeCreateCheckoutSessionResult, CustomerStripeCreateCustomerPortalSessionRequest, EntitlementAccessResult, CreateCreditGrantPurchase, RateCardMeteredEntitlement, RecurringPeriod, CreditGrantPurchase, ListCreditGrantsParamsFilter, GetCreditBalanceParamsFilter, ListChargesParamsFilter, ListPlansParamsFilter, SubscriptionCreate, RateCardProrationConfiguration, Subscription, UnitConfig, TaxCodeAppMapping, AppCapability, UpdateAppStripeRequest, UpdateAppSandboxRequest, UpdateAppExternalInvoicingRequest, PartyTaxIdentity, UpdateBillingPartyTaxIdentity, WorkflowInvoicingSettings, InvoiceValidationIssue, InvoiceAvailableActions, InvoiceLineAmountDiscount, InvoiceLineUsageDiscount, InvoiceLineBaseDiscount, ListCurrenciesParamsFilter, GovernanceQueryRequest, GovernanceFeatureAccessReason, GovernanceQueryError, AppCustomerData, UpsertAppCustomerDataRequest, CreditAdjustment, CreditBalance, ListCreditTransactionsParamsFilter, CreditTransaction, PriceTier, ChargeTotals, UpdatePriceTier, FeatureLlmUnitCost, LlmCostPrice, LlmCostOverrideCreate, ListCustomersParamsFilter, ListSubscriptionsParamsFilter, ListFeatureParamsFilter, ListAddonsParamsFilter, CreateCreditGrantTaxConfig, CreditGrantTaxConfig, TaxConfig, RateCardTaxConfig, OrganizationDefaultTaxCodes, PlanAddon, ProfileAppReferences, InvoiceWorkflowAppsReferences, UpdateRateCardTaxConfig, ListEventsParamsFilter, ListInvoicesParamsFilter, ResourceFilters, FieldFilters, IngestedEvent, MeterQueryResult, CurrencyCustom, FeatureCostQueryResult, MeterPagePaginatedResponse, CostBasisPagePaginatedResponse, MeterQueryFilters, FeatureMeterReference, Customer, PartyAddresses, InvoiceCustomer, UpdateBillingPartyAddresses, UpdateInvoiceCustomer, AppStripeCreateCheckoutSessionConsentCollection, ListCustomerEntitlementAccessResponseData, WorkflowCollectionAlignmentAnchored, ChargeFlatFeeSystemIntent, SubscriptionPagePaginatedResponse, SubscriptionChangeResponse, SubscriptionCancel, SubscriptionChange, InvoiceUsageQuantityDetail, TaxCode, AppCatalogItem, InvoiceWorkflow, InvoiceStatusDetails, InvoiceLineDiscounts, UpdateBillingInvoiceWorkflow, GovernanceFeatureAccess, CustomerData, UpsertCustomerBillingDataRequest, CreditBalances, CreditTransactionPaginatedResponse, PriceGraduated, PriceVolume, UpdatePriceGraduated, UpdatePriceVolume, PricePagePaginatedResponse, CreditGrant, CreateChargeFlatFeeRequest, WorkflowTaxSettings, PlanAddonPagePaginatedResponse, IngestedEventPaginatedResponse, InvalidParameters, MeterQueryRequest, CustomerPagePaginatedResponse, Party, Supplier, UpdateSupplier, AppStripeCreateCheckoutSessionRequestOptions, TaxCodePagePaginatedResponse, AppStripe, AppSandbox, AppExternalInvoicing, AppCatalogItemPagePaginatedResponse, InvoiceWorkflowSettings, InvoiceDetailedLine, UpdateInvoiceWorkflowSettings, GovernanceQueryResult, Feature, CreditGrantPagePaginatedResponse, CurrencyPagePaginatedResponse, BadRequest, InvoiceBase, CustomerStripeCreateCheckoutSessionRequest, WorkflowCollectionSettings, GovernanceQueryResponse, ChargeFlatFee, ChargeUsageBasedSystemIntent, CreateChargeUsageBasedRequest, RateCard, InvoiceLineRateCard, UpdateInvoiceLineRateCard, FeaturePagePaginatedResponse, Workflow, AppPagePaginatedResponse, BillingInstallAppResponse, ProfileApps, ChargeUsageBased, SubscriptionAddonRateCard, PlanPhase, Addon, UpsertAddonRequest, InvoiceStandardLine, UpdateInvoiceStandardLine, Profile, UpsertBillingProfileRequest, SubscriptionAddon, Plan, UpsertPlanRequest, AddonPagePaginatedResponse, ProfilePagePaginatedResponse, ChargePagePaginatedResponse, SubscriptionAddonPagePaginatedResponse, PlanPagePaginatedResponse, InvoiceStandard, UpdateInvoiceStandardRequest, InvoicePagePaginatedResponse, StringFieldFilter, MeterAggregation, MeterQueryGranularity, StringFieldFilterExact, PricePaymentTerm, BillingCurrencyCode, CreateCurrencyCode, UlidFieldFilter, DateTimeFieldFilter, SubscriptionEditTiming, WorkflowPaymentSettings, UpdateBillingWorkflowPaymentSettings, InvalidParameter, RateCardEntitlement, FeatureUnitCost, Currency, WorkflowCollectionAlignment, Price, UpdatePrice, App, CreateChargeRequest, Charge, InvoiceLine, UpdateInvoiceLine, Invoice, SortQueryInput, BaseErrorInput, WorkflowPaymentSendInvoiceSettingsInput, InvoiceWorkflowInvoicingSettingsInput, UpdateBillingInvoiceWorkflowInvoicingSettingsInput, UpdateBillingWorkflowPaymentSendInvoiceSettingsInput, EventInput, UnauthorizedInput, ForbiddenInput, NotFoundInput, GoneInput, ConflictInput, PayloadTooLargeInput, UnsupportedMediaTypeInput, UnprocessableContentInput, TooManyRequestsInput, InternalInput, NotImplementedInput, NotAvailableInput, AppStripeCreateCheckoutSessionCustomerUpdateInput, AppStripeCreateCheckoutSessionTaxIdCollectionInput, CreateCreditGrantPurchaseInput, RateCardMeteredEntitlementInput, CreditGrantPurchaseInput, VoidCreditGrantRequestInput, UnitConfigInput, WorkflowInvoicingSettingsInput, GovernanceQueryRequestInput, IngestedEventInput, SubscriptionCancelInput, InvoiceUsageQuantityDetailInput, InvoiceWorkflowInput, UpdateBillingInvoiceWorkflowInput, CreateCreditGrantRequestInput, CreditGrantInput, WorkflowTaxSettingsInput, IngestedEventPaginatedResponseInput, MeterQueryRequestInput, AppStripeCreateCheckoutSessionRequestOptionsInput, InvoiceWorkflowSettingsInput, InvoiceDetailedLineInput, UpdateInvoiceWorkflowSettingsInput, CreditGrantPagePaginatedResponseInput, BadRequestInput, CustomerStripeCreateCheckoutSessionRequestInput, WorkflowCollectionSettingsInput, RateCardInput, InvoiceLineRateCardInput, WorkflowInput, SubscriptionAddonRateCardInput, PlanPhaseInput, AddonInput, CreateAddonRequestInput, UpsertAddonRequestInput, InvoiceStandardLineInput, ProfileInput, CreateBillingProfileRequestInput, UpsertBillingProfileRequestInput, SubscriptionAddonInput, PlanInput, CreatePlanRequestInput, UpsertPlanRequestInput, AddonPagePaginatedResponseInput, ProfilePagePaginatedResponseInput, SubscriptionAddonPagePaginatedResponseInput, PlanPagePaginatedResponseInput, InvoiceStandardInput, UpdateInvoiceStandardRequestInput, InvoicePagePaginatedResponseInput, WorkflowPaymentSettingsInput, UpdateBillingWorkflowPaymentSettingsInput, RateCardEntitlementInput, InvoiceLineInput, InvoiceInput, UpdateInvoiceRequestInput, } from './models/types.js';
44
+ export type * from './models/operations/entitlementAccess.js';
45
+ export type { Labels, CursorPaginationQueryPage, SortQuery, IngestedEventValidationError, CursorMetaPage, BaseError, PageMeta, QueryFilterString, AppStripeCheckoutSessionCustomTextParams, AppStripeCreateCustomerPortalSessionOptions, CreateLabels, PriceFree, RateCardStaticEntitlement, RateCardBooleanEntitlement, TaxConfigStripe, TaxConfigExternalInvoicing, InvoiceExternalReferences, InvoiceAvailableActionDetails, InvoiceWorkflowInvoicingSettings, WorkflowPaymentChargeAutomaticallySettings, WorkflowPaymentSendInvoiceSettings, ChargeFlatFeeDiscounts, SubscriptionEditRemoveItem, SubscriptionEditUnscheduleEdit, UpdateLabels, InstallAppStripeWithApiKey, InstallAppSandbox, InstallAppExternalInvoicing, WorkflowCollectionAlignmentSubscription, InvoiceLineExternalReferences, UpdateBillingInvoiceWorkflowInvoicingSettings, UpdateBillingWorkflowPaymentChargeAutomaticallySettings, UpdateBillingWorkflowPaymentSendInvoiceSettings, UpdatePriceFree, LlmCostProvider, LlmCostModel, ProductCatalogValidationError, EntitlementAccessQueryRequestCustomers, EntitlementAccessQueryRequestFeatures, QueryFilterInteger, QueryFilterFloat, QueryFilterBoolean, PagePaginationQuery, PublicLabels, SystemAccountAccessToken, PersonalAccessToken, KonnectAccessToken, AppCustomerDataStripe, AppCustomerDataExternalInvoicing, CreateChargeCostBasisDynamic, ChargeCostBasisDynamic, CurrencyFiat, ListCostBasesParamsFilter, CreateCurrencyCustomRequest, EntitlementAccessValue, CreateChargeCostBasisManual, ChargeCostBasisManual, PriceFlat, PriceUnit, SpendCommitments, RateCardDiscounts, Totals, ChargeRealizationDetailedLineCreditApplied, ChargeRealizationAmountDiscount, FeatureManualUnitCost, FeatureLlmUnitCostPricing, InvoiceLineCreditsApplied, InvoiceUsageQuantityDetail, UpdatePriceFlat, UpdatePriceUnit, UpdateDiscounts, LlmCostModelPricing, FiatCurrencyAmount, QueryFilterNumeric, CursorPaginationQuery, ListMetersParamsFilter, ListLlmCostPricesParamsFilter, LabelsFieldFilter, CustomerReference, ProfileReference, CreateChargeCostBasisPinned, CreateResourceReference, ChargeCostBasisPinned, TaxCodeReference, CreditGrantInvoiceReference, SubscriptionCostBasisPin, FeatureReference, SubscriptionReference, AppReference, ChargeRealizationInvoiceReference, AddonReference, ChargeReference, UpdateResourceReference, BillingCustomerReference, ChargeFeature, Event, MeterQueryRow, AppStripeCreateCustomerPortalSessionResult, ChargeResolvedCostBasis, ClosedPeriod, SubscriptionAddonTimelineSegment, UpdateClosedPeriod, CostBasis, FeatureCostQueryRow, Resource, ResourceImmutable, QueryFilterDateTime, CursorMeta, InvalidParameterStandard, InvalidParameterMinimumLength, InvalidParameterMaximumLength, InvalidParameterChoiceItem, InvalidParameterDependentItem, Unauthorized, Forbidden, NotFound, Gone, Conflict, PayloadTooLarge, UnsupportedMediaType, UnprocessableContent, TooManyRequests, Internal, NotImplemented, NotAvailable, CreateCreditGrantFilters, CreditGrantFilters, SubscriptionPlanReference, UpsertPlanAddonRequest, ResourceWithKey, Meter, PaginatedMeta, QueryFilterStringMapItem, CustomerKeyReference, CustomerUsageAttribution, UpdateCustomerUsageAttribution, Address, UpdateAddress, AppStripeCreateCheckoutSessionCustomerUpdate, AppStripeCreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreement, AppStripeCreateCheckoutSessionTaxIdCollection, AppStripeCreateCheckoutSessionResult, CustomerStripeCreateCustomerPortalSessionRequest, RateCardMeteredEntitlement, SubscriptionPhaseCreate, SubscriptionEditStretchPhase, RecurringPeriod, ListCreditGrantsParamsFilter, ValidationIssue, GetCreditBalanceParamsFilter, ListPlansParamsFilter, SubscriptionProRatingConfig, RateCardProrationConfiguration, UnitConfig, PartyTaxIdentity, UpdateBillingPartyTaxIdentity, InvoiceAvailableActions, ChargeRealizationPayment, SubscriptionEditRemovePhase, TaxCodeAppMapping, AppCapability, UpdateAppStripeRequest, UpdateAppSandboxRequest, UpdateAppExternalInvoicingRequest, WorkflowInvoicingSettings, InvoiceLineAmountDiscount, InvoiceLineUsageDiscount, InvoiceLineBaseDiscount, ListCurrenciesParamsFilter, EntitlementAccessQueryRequest, EntitlementFeatureAccessReason, EntitlementAccessQueryError, AppCustomerData, UpsertAppCustomerDataRequest, CreditAdjustment, CreditBalance, ListCreditTransactionsParamsFilter, CreditTransaction, CurrencyAmount, EntitlementAccessResult, PriceTier, ChargeTotals, FeatureLlmUnitCost, UpdatePriceTier, LlmCostPrice, LlmCostOverrideCreate, ListCustomersParamsFilter, ListSubscriptionsParamsFilter, ListAppsParamsFilter, ListBillingProfilesParamsFilter, ListFeatureParamsFilter, ListAddonsParamsFilter, ListPlanAddonsParamsFilter, CreateCreditGrantTaxConfig, CreditGrantTaxConfig, RateCardTaxConfig, TaxConfig, OrganizationDefaultTaxCodes, InvoiceWorkflowAppsReferences, ProfileAppReferences, PlanAddon, UpdateRateCardTaxConfig, ListEventsParamsFilter, ListCustomerChargesParamsFilter, ListInvoicesParamsFilter, ListChargesParamsFilter, ResourceFilters, FieldFilters, IngestedEvent, MeterQueryResult, ChargeRealizationDetailedLineFlatFee, ChargeRealizationDetailedLineUsageBased, CurrencyCustom, FeatureCostQueryResult, MeterPagePaginatedResponse, CostBasisPagePaginatedResponse, MeterQueryFilters, FeatureMeterReference, Customer, PartyAddresses, InvoiceCustomer, UpdateBillingPartyAddresses, UpdateInvoiceCustomer, AppStripeCreateCheckoutSessionConsentCollection, SubscriptionEditAddPhase, WorkflowCollectionAlignmentAnchored, SubscriptionBase, InvoiceStatusDetails, InvoiceWorkflow, SubscriptionCancel, SubscriptionMigrate, SubscriptionAddonUpdate, TaxCode, AppCatalogItem, InvoiceLineDiscounts, UpdateBillingInvoiceWorkflow, EntitlementFeatureAccess, CustomerData, UpsertCustomerBillingDataRequest, CreditBalances, CreditTransactionPaginatedResponse, ChargeFlatFeeSystemIntent, ListCustomerEntitlementAccessResponseData, PriceGraduated, PriceVolume, UpdatePriceGraduated, UpdatePriceVolume, PricePagePaginatedResponse, CreateCreditGrantPurchase, CreditGrantPurchase, CreateChargeFlatFeeRequest, WorkflowTaxSettings, PlanAddonPagePaginatedResponse, IngestedEventPaginatedResponse, InvalidParameters, MeterQueryRequest, CustomerPagePaginatedResponse, Supplier, Party, UpdateSupplier, AppStripeCreateCheckoutSessionRequestOptions, InvoiceWorkflowSettings, TaxCodePagePaginatedResponse, AppStripe, AppSandbox, AppExternalInvoicing, AppCatalogItemPagePaginatedResponse, InstalledAppStripe, InstalledAppSandbox, InstalledAppExternalInvoicing, InvoiceDetailedLine, UpdateInvoiceWorkflowSettings, EntitlementAccessQueryResult, Feature, CreditGrant, CurrencyPagePaginatedResponse, BadRequest, InvoiceBase, CustomerStripeCreateCheckoutSessionRequest, WorkflowCollectionSettings, ChargeRealizationInvoice, EntitlementAccessQueryResponse, RateCard, InvoiceLineRateCard, ChargeUsageBasedSystemIntent, CreateChargeUsageBasedRequest, FeaturePagePaginatedResponse, UpdateInvoiceLineRateCard, CreditGrantPagePaginatedResponse, Workflow, AppPagePaginatedResponse, ProfileApps, SubscriptionItem, PlanPhase, SubscriptionEditAddItem, SubscriptionAddonRateCard, Addon, UpsertAddonRequest, InvoiceStandardLine, UpdateInvoiceStandardLine, Profile, UpsertBillingProfileRequest, ChargeRealization, SubscriptionPhase, SubscriptionCustomPlan, Plan, UpsertPlanRequest, SubscriptionAddon, AddonPagePaginatedResponse, ProfilePagePaginatedResponse, Subscription, SubscriptionCreate, SubscriptionChange, PlanPagePaginatedResponse, SubscriptionEdit, SubscriptionAddonPagePaginatedResponse, InvoiceStandard, UpdateInvoiceStandardRequest, SubscriptionPagePaginatedResponse, SubscriptionChangeResponse, SubscriptionMigrateResponse, ChargeFlatFee, ChargeUsageBased, InvoicePagePaginatedResponse, ChargePagePaginatedResponse, StringFieldFilter, MeterAggregation, MeterQueryGranularity, StringFieldFilterExact, PricePaymentTerm, BillingCurrencyCode, CreateCurrencyCode, UlidFieldFilter, DateTimeFieldFilter, WorkflowPaymentSettings, SubscriptionCreateTiming, SubscriptionEditTiming, UpdateBillingWorkflowPaymentSettings, CreateChargeCostBasis, ChargeCostBasis, InvalidParameter, RateCardEntitlement, FeatureUnitCost, ChargeRealizationDetailedLine, Currency, CustomerOrReference, WorkflowCollectionAlignment, Price, PriceUsageBased, UpdatePrice, App, BillingInstallAppResponse, FeatureOrReference, ChargeRealizationInvoiceOrReference, CreateChargeRequest, SubscriptionEditOperation, InvoiceLine, UpdateInvoiceLine, SubscriptionOrReference, Invoice, Charge, SortQueryInput, BaseErrorInput, InvoiceWorkflowInvoicingSettingsInput, WorkflowPaymentSendInvoiceSettingsInput, UpdateBillingInvoiceWorkflowInvoicingSettingsInput, UpdateBillingWorkflowPaymentSendInvoiceSettingsInput, EventInput, UnauthorizedInput, ForbiddenInput, NotFoundInput, GoneInput, ConflictInput, PayloadTooLargeInput, UnsupportedMediaTypeInput, UnprocessableContentInput, TooManyRequestsInput, InternalInput, NotImplementedInput, NotAvailableInput, AppStripeCreateCheckoutSessionCustomerUpdateInput, AppStripeCreateCheckoutSessionTaxIdCollectionInput, RateCardMeteredEntitlementInput, VoidCreditGrantRequestInput, UnitConfigInput, WorkflowInvoicingSettingsInput, EntitlementAccessQueryRequestInput, IngestedEventInput, SubscriptionBaseInput, InvoiceWorkflowInput, SubscriptionCancelInput, SubscriptionMigrateInput, UpdateBillingInvoiceWorkflowInput, CreateCreditGrantPurchaseInput, CreditGrantPurchaseInput, WorkflowTaxSettingsInput, IngestedEventPaginatedResponseInput, MeterQueryRequestInput, AppStripeCreateCheckoutSessionRequestOptionsInput, InvoiceWorkflowSettingsInput, InvoiceDetailedLineInput, UpdateInvoiceWorkflowSettingsInput, CreateCreditGrantRequestInput, CreditGrantInput, BadRequestInput, CustomerStripeCreateCheckoutSessionRequestInput, WorkflowCollectionSettingsInput, ChargeRealizationInvoiceInput, RateCardInput, InvoiceLineRateCardInput, ChargeUsageBasedSystemIntentInput, CreateChargeUsageBasedRequestInput, CreditGrantPagePaginatedResponseInput, WorkflowInput, SubscriptionItemInput, PlanPhaseInput, SubscriptionEditAddItemInput, SubscriptionAddonRateCardInput, AddonInput, CreateAddonRequestInput, UpsertAddonRequestInput, InvoiceStandardLineInput, ProfileInput, CreateBillingProfileRequestInput, UpsertBillingProfileRequestInput, ChargeRealizationInput, SubscriptionPhaseInput, SubscriptionCustomPlanInput, PlanInput, CreatePlanRequestInput, UpsertPlanRequestInput, SubscriptionAddonInput, AddonPagePaginatedResponseInput, ProfilePagePaginatedResponseInput, SubscriptionInput, SubscriptionCreateInput, SubscriptionChangeInput, PlanPagePaginatedResponseInput, SubscriptionEditInput, SubscriptionAddonPagePaginatedResponseInput, InvoiceStandardInput, UpdateInvoiceStandardRequestInput, SubscriptionPagePaginatedResponseInput, SubscriptionChangeResponseInput, SubscriptionMigrateResponseInput, ChargeFlatFeeInput, ChargeUsageBasedInput, InvoicePagePaginatedResponseInput, ChargePagePaginatedResponseInput, WorkflowPaymentSettingsInput, UpdateBillingWorkflowPaymentSettingsInput, RateCardEntitlementInput, ChargeRealizationInvoiceOrReferenceInput, CreateChargeRequestInput, SubscriptionEditOperationInput, InvoiceLineInput, SubscriptionOrReferenceInput, InvoiceInput, UpdateInvoiceRequestInput, ChargeInput, } from './models/types.js';
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ export { Meters } from './sdk/meters.js';
5
5
  export { Customers } from './sdk/customers.js';
6
6
  export { Entitlements } from './sdk/entitlements.js';
7
7
  export { Subscriptions } from './sdk/subscriptions.js';
8
+ export { Apps } from './sdk/apps.js';
8
9
  export { Billing } from './sdk/billing.js';
9
10
  export { Tax } from './sdk/tax.js';
10
11
  export { Features } from './sdk/features.js';
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "v1.0.0-beta.232";
1
+ export declare const SDK_VERSION = "v1.0.0-beta.233";
@@ -2,4 +2,4 @@
2
2
  // The committed value is a dev placeholder. The publish flow
3
3
  // (`make -C api/spec publish-aip-sdk`) stamps the real release version here
4
4
  // before `pnpm publish`, after `pnpm version` updates package.json.
5
- export const SDK_VERSION = 'v1.0.0-beta.232';
5
+ export const SDK_VERSION = 'v1.0.0-beta.233';
package/dist/lib/wire.js CHANGED
@@ -212,7 +212,13 @@ function walk(data, schema, dir, depth = 0) {
212
212
  if (d?.type === 'union') {
213
213
  const variant = selectVariant(record, s, dir);
214
214
  if (!variant) {
215
- // No confident match: leave keys untransformed rather than guess.
215
+ // No variant owns this data: a discriminated union whose discriminator
216
+ // value the SDK does not know (a variant added server-side after
217
+ // generation), or a union with no object-shaped variant at all reached
218
+ // with object data. Both mean the schema describes nothing about these
219
+ // keys, so leave them untransformed rather than guess. Note this is NOT
220
+ // the zero-key-coverage case — a non-discriminated union with any object
221
+ // variant always resolves one; see selectVariant.
216
222
  return data;
217
223
  }
218
224
  return walk(data, variant, dir, depth + 1);
@@ -279,11 +285,61 @@ function selectVariant(data, schema, dir) {
279
285
  const dataKey = dir.discriminatorKey(d.discriminator);
280
286
  return variantsByDiscriminator(schema, d).get(data[dataKey]);
281
287
  }
282
- // Non-discriminated union: the codegen gate guarantees at most one object
283
- // variant (it fails the build for a mapped union with two or more), so the single
284
- // object-shaped option is unambiguous. Other variants (scalars, arrays) reach the
285
- // walk through their own data-kind branches, not here.
286
- return options.find((option) => def(unwrap(option))?.type === 'object');
288
+ // Non-discriminated union: pick the object variant that best covers the data's
289
+ // keys. The codegen gate guarantees the object variants agree on every key they
290
+ // share (they differ only in WHICH keys they declare, e.g. a customer reference
291
+ // versus the full customer), so the pick can never change how a key is mapped —
292
+ // it only decides which keys the object branch keeps. Most keys matched
293
+ // therefore preserves a wider variant's extra fields, and the narrowest shape
294
+ // wins a tie so toWire does not materialize defaults for a field the value never
295
+ // carried. Other variants (scalars, arrays) reach the walk through their own
296
+ // data-kind branches, not here.
297
+ const dataKeys = Object.keys(data);
298
+ let best;
299
+ // Starting below zero means data that matches NO variant's keys still selects
300
+ // one — the narrowest, by the tie-break below — instead of falling through to
301
+ // the pass-through above. That is deliberate: the selected variant's object
302
+ // walk then drops the undeclared keys, exactly as the object branch does for a
303
+ // non-union field. Passing the keys through instead would put snake_case names
304
+ // into a value fromWire's return type declares to be camelCase.
305
+ let bestMatched = -1;
306
+ let bestWidth = 0;
307
+ for (const option of options) {
308
+ // A variant that is itself a union (`Invoice | InvoiceReference`, where
309
+ // `Invoice` is the discriminated union of its concrete types) resolves
310
+ // through its own selection first, so the nested union contributes the one
311
+ // variant its discriminator — or its own key coverage — identifies. Without
312
+ // this the nested union is no object and gets skipped, leaving the
313
+ // reference variant the only candidate and silently dropping every field
314
+ // of an expanded resource. A nested union that cannot resolve (reference
315
+ // data carries no discriminator) contributes nothing, which is what leaves
316
+ // the reference variant to win on its own merits. The gate verifies a
317
+ // nested union's variants against the outer siblings they compete with, so
318
+ // the agreement guarantee above covers them too. It does not verify two
319
+ // nested unions against each other; no union in the spec declares two
320
+ // union-typed variants.
321
+ const inner = unwrap(option);
322
+ const candidate = def(inner)?.type === 'union' ? selectVariant(data, inner, dir) : option;
323
+ const resolved = unwrap(candidate);
324
+ if (def(resolved)?.type !== 'object') {
325
+ continue;
326
+ }
327
+ const shape = shapeOf(resolved) ?? {};
328
+ const width = Object.keys(shape).length;
329
+ let matched = 0;
330
+ for (const key of dataKeys) {
331
+ if (fieldFor(shape, key) !== undefined) {
332
+ matched++;
333
+ }
334
+ }
335
+ if (matched > bestMatched ||
336
+ (matched === bestMatched && width < bestWidth)) {
337
+ best = candidate;
338
+ bestMatched = matched;
339
+ bestWidth = width;
340
+ }
341
+ }
342
+ return best;
287
343
  }
288
344
  // Memoized literal→variant map for a discriminated union, built once per schema.
289
345
  const variantMapCache = new WeakMap();
@@ -1,11 +1,27 @@
1
1
  import type { AcceptDateStrings } from '../../lib/wire.js';
2
- import type { App, AppCatalogItem, AppCatalogItemPagePaginatedResponse, AppPagePaginatedResponse, BillingInstallAppResponse, InstallAppRequest as InstallAppRequestBody, UpdateAppRequest as UpdateAppRequestBody } from '../types.js';
2
+ import type { App, AppCatalogItem, AppCatalogItemPagePaginatedResponse, AppPagePaginatedResponse, BillingInstallAppResponse, InstallAppRequest as InstallAppRequestBody, ListAppsParamsFilter, SortQueryInput, UpdateAppRequest as UpdateAppRequestBody } from '../types.js';
3
3
  export interface ListAppsQuery {
4
4
  /** Determines which page of the collection to retrieve. */
5
5
  page?: {
6
6
  size?: number;
7
7
  number?: number;
8
8
  };
9
+ /**
10
+ * Sort apps returned in the response. Supported sort attributes are:
11
+ *
12
+ * - `id`
13
+ * - `created_at` (default)
14
+ *
15
+ * The `asc` suffix is optional as the default sort order is ascending. The `desc`
16
+ * suffix is used to specify a descending order.
17
+ */
18
+ sort?: SortQueryInput;
19
+ /**
20
+ * Filter apps returned in the response.
21
+ *
22
+ * To filter apps by name add the following query param: filter[name]=my-app
23
+ */
24
+ filter?: ListAppsParamsFilter;
9
25
  }
10
26
  export type ListAppsRequest = AcceptDateStrings<ListAppsQuery>;
11
27
  export type ListAppsResponse = AppPagePaginatedResponse;
@@ -1,11 +1,29 @@
1
1
  import type { AcceptDateStrings } from '../../lib/wire.js';
2
- import type { CreateBillingProfileRequestInput, Profile, ProfilePagePaginatedResponse, UpsertBillingProfileRequestInput } from '../types.js';
2
+ import type { CreateBillingProfileRequestInput, ListBillingProfilesParamsFilter, Profile, ProfilePagePaginatedResponse, SortQueryInput, UpsertBillingProfileRequestInput } from '../types.js';
3
3
  export interface ListBillingProfilesQuery {
4
4
  /** Determines which page of the collection to retrieve. */
5
5
  page?: {
6
6
  size?: number;
7
7
  number?: number;
8
8
  };
9
+ /**
10
+ * Sort billing profiles returned in the response. Supported sort attributes are:
11
+ *
12
+ * - `id`
13
+ * - `name`
14
+ * - `created_at` (default)
15
+ *
16
+ * The `asc` suffix is optional as the default sort order is ascending. The `desc`
17
+ * suffix is used to specify a descending order.
18
+ */
19
+ sort?: SortQueryInput;
20
+ /**
21
+ * Filter billing profiles returned in the response.
22
+ *
23
+ * To filter billing profiles by name add the following query param:
24
+ * filter[name]=my-profile
25
+ */
26
+ filter?: ListBillingProfilesParamsFilter;
9
27
  }
10
28
  export type ListBillingProfilesRequest = AcceptDateStrings<ListBillingProfilesQuery>;
11
29
  export type ListBillingProfilesResponse = ProfilePagePaginatedResponse;
@@ -0,0 +1,54 @@
1
+ import type { AcceptDateStrings } from '../../lib/wire.js';
2
+ import type { ChargePagePaginatedResponse, ListChargesParamsFilter, SortQueryInput } from '../types.js';
3
+ export interface ListChargesQuery {
4
+ /** Determines which page of the collection to retrieve. */
5
+ page?: {
6
+ size?: number;
7
+ number?: number;
8
+ };
9
+ /**
10
+ * Sort charges returned in the response.
11
+ *
12
+ * Supported sort attributes are:
13
+ *
14
+ * - `id`
15
+ * - `created_at`
16
+ * - `service_period.from`
17
+ * - `billing_period.from`
18
+ */
19
+ sort?: SortQueryInput;
20
+ /**
21
+ * Filter charges.
22
+ *
23
+ * To filter charges by customer add the following query param:
24
+ * `filter[customer_id][eq]=<id>` or `filter[customer_id][oeq]=<id>,<id>`.
25
+ *
26
+ * To filter charges by status add the following query param:
27
+ * `filter[status][oeq]=created,active`
28
+ *
29
+ * To filter charges by feature, use `filter[feature_id][oeq]=<id>,<id>` or
30
+ * `filter[feature_key][oeq]=<key>,<key>`.
31
+ *
32
+ * See the `service_period_from` filter field for expressing a service-period
33
+ * window query.
34
+ */
35
+ filter?: ListChargesParamsFilter;
36
+ /**
37
+ * Expand full objects for referenced entities.
38
+ *
39
+ * Supported values are:
40
+ *
41
+ * - `real_time_usage`: Expand the charge's real-time usage; it sets the `usage`
42
+ * and the `totals.realtime` fields.
43
+ * - `customer`: Expand the charge's customer to the complete entity.
44
+ * - `feature`: Expand the charge's feature to the complete entity.
45
+ * - `subscription`: Expand the charge's subscription to the complete entity.
46
+ * - `realization.invoice`: Expand each realization's invoice to the complete
47
+ * entity.
48
+ * - `realization.totals`: Expand each realization run's `totals`.
49
+ * - `realization.detailed_lines`: Expand each realization run's `detailed_lines`.
50
+ */
51
+ expand?: ('real_time_usage' | 'customer' | 'feature' | 'subscription' | 'realization.invoice' | 'realization.totals' | 'realization.detailed_lines')[];
52
+ }
53
+ export type ListChargesRequest = AcceptDateStrings<ListChargesQuery>;
54
+ export type ListChargesResponse = ChargePagePaginatedResponse;
@@ -1,5 +1,5 @@
1
1
  import type { AcceptDateStrings } from '../../lib/wire.js';
2
- import type { AppCustomerData, AppStripeCreateCheckoutSessionResult, AppStripeCreateCustomerPortalSessionResult, Charge, ChargePagePaginatedResponse, CreateChargeRequest, CreateCreditAdjustmentRequest as CreateCreditAdjustmentRequestBody, CreateCreditGrantRequestInput, CreateCustomerRequest as CreateCustomerRequestBody, CreditAdjustment, CreditBalances, CreditGrant, CreditGrantPagePaginatedResponse, CreditTransactionPaginatedResponse, CursorPaginationQueryPage, Customer, CustomerData, CustomerPagePaginatedResponse, CustomerStripeCreateCheckoutSessionRequestInput, CustomerStripeCreateCustomerPortalSessionRequest, GetCreditBalanceParamsFilter, ListChargesParamsFilter, ListCreditGrantsParamsFilter, ListCreditTransactionsParamsFilter, ListCustomersParamsFilter, SortQueryInput, UpdateCreditGrantExternalSettlementRequest as UpdateCreditGrantExternalSettlementRequestBody, UpsertAppCustomerDataRequest, UpsertCustomerBillingDataRequest, UpsertCustomerRequest as UpsertCustomerRequestBody, VoidCreditGrantRequestInput } from '../types.js';
2
+ import type { AppCustomerData, AppStripeCreateCheckoutSessionResult, AppStripeCreateCustomerPortalSessionResult, Charge, ChargePagePaginatedResponse, CreateChargeRequestInput, CreateCreditAdjustmentRequest as CreateCreditAdjustmentRequestBody, CreateCreditGrantRequestInput, CreateCustomerRequest as CreateCustomerRequestBody, CreditAdjustment, CreditBalances, CreditGrant, CreditGrantPagePaginatedResponse, CreditTransactionPaginatedResponse, CursorPaginationQueryPage, Customer, CustomerData, CustomerPagePaginatedResponse, CustomerStripeCreateCheckoutSessionRequestInput, CustomerStripeCreateCustomerPortalSessionRequest, GetCreditBalanceParamsFilter, ListCreditGrantsParamsFilter, ListCreditTransactionsParamsFilter, ListCustomerChargesParamsFilter, ListCustomersParamsFilter, SortQueryInput, UpdateCreditGrantExternalSettlementRequest as UpdateCreditGrantExternalSettlementRequestBody, UpsertAppCustomerDataRequest, UpsertCustomerBillingDataRequest, UpsertCustomerRequest as UpsertCustomerRequestBody, VoidCreditGrantRequestInput } from '../types.js';
3
3
  export type CreateCustomerRequest = AcceptDateStrings<CreateCustomerRequestBody>;
4
4
  export type CreateCustomerResponse = Customer;
5
5
  export type GetCustomerRequest = {
@@ -150,16 +150,30 @@ export interface ListCustomerChargesQuery {
150
150
  *
151
151
  * To filter charges by status add the following query param:
152
152
  * `filter[status][oeq]=created,active`
153
+ *
154
+ * To filter charges by feature, use `filter[feature_id][oeq]=<id>,<id>` or
155
+ * `filter[feature_key][oeq]=<key>,<key>`.
156
+ *
157
+ * See the `service_period_from` filter field for expressing a service-period
158
+ * window query.
153
159
  */
154
- filter?: ListChargesParamsFilter;
160
+ filter?: ListCustomerChargesParamsFilter;
155
161
  /**
156
162
  * Expand full objects for referenced entities.
157
163
  *
158
164
  * Supported values are:
159
165
  *
160
- * - `real_time_usage`: Expand the charge's real-time usage.
166
+ * - `real_time_usage`: Expand the charge's real-time usage; it sets the `usage`
167
+ * and the `totals.realtime` fields.
168
+ * - `customer`: Expand the charge's customer to the complete entity.
169
+ * - `feature`: Expand the charge's feature to the complete entity.
170
+ * - `subscription`: Expand the charge's subscription to the complete entity.
171
+ * - `realization.invoice`: Expand each realization's invoice to the complete
172
+ * entity.
173
+ * - `realization.totals`: Expand each realization run's `totals`.
174
+ * - `realization.detailed_lines`: Expand each realization run's `detailed_lines`.
161
175
  */
162
- expand?: 'real_time_usage'[];
176
+ expand?: ('real_time_usage' | 'customer' | 'feature' | 'subscription' | 'realization.invoice' | 'realization.totals' | 'realization.detailed_lines')[];
163
177
  }
164
178
  export type ListCustomerChargesRequest = AcceptDateStrings<ListCustomerChargesQuery & {
165
179
  customerId: string;
@@ -167,6 +181,6 @@ export type ListCustomerChargesRequest = AcceptDateStrings<ListCustomerChargesQu
167
181
  export type ListCustomerChargesResponse = ChargePagePaginatedResponse;
168
182
  export type CreateCustomerChargesRequest = AcceptDateStrings<{
169
183
  customerId: string;
170
- body: CreateChargeRequest;
184
+ body: CreateChargeRequestInput;
171
185
  }>;
172
186
  export type CreateCustomerChargesResponse = Charge;