@openmeter/client 1.0.0-beta.228 → 1.0.0-beta.230
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.
- package/README.md +130 -111
- package/dist/funcs/addons.js +115 -28
- package/dist/funcs/apps.js +37 -10
- package/dist/funcs/billing.js +79 -18
- package/dist/funcs/currencies.js +82 -22
- package/dist/funcs/customers.d.ts +3 -1
- package/dist/funcs/customers.js +396 -83
- package/dist/funcs/defaults.js +24 -4
- package/dist/funcs/entitlements.js +19 -5
- package/dist/funcs/events.js +26 -8
- package/dist/funcs/features.js +102 -24
- package/dist/funcs/governance.js +27 -5
- package/dist/funcs/index.d.ts +1 -0
- package/dist/funcs/index.js +1 -0
- package/dist/funcs/invoices.d.ts +8 -0
- package/dist/funcs/invoices.js +81 -0
- package/dist/funcs/llmCost.js +78 -22
- package/dist/funcs/meters.d.ts +2 -1
- package/dist/funcs/meters.js +121 -24
- package/dist/funcs/planAddons.js +106 -20
- package/dist/funcs/plans.js +115 -28
- package/dist/funcs/subscriptions.d.ts +2 -1
- package/dist/funcs/subscriptions.js +182 -38
- package/dist/funcs/tax.js +80 -19
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2 -0
- package/dist/lib/config.d.ts +9 -0
- package/dist/lib/config.js +1 -7
- package/dist/lib/encodings.d.ts +1 -1
- package/dist/lib/encodings.js +5 -4
- package/dist/lib/wire.d.ts +18 -0
- package/dist/lib/wire.js +312 -0
- package/dist/models/operations/addons.d.ts +17 -5
- package/dist/models/operations/apps.d.ts +2 -1
- package/dist/models/operations/billing.d.ts +5 -4
- package/dist/models/operations/currencies.d.ts +27 -9
- package/dist/models/operations/customers.d.ts +84 -33
- package/dist/models/operations/defaults.d.ts +2 -1
- package/dist/models/operations/events.d.ts +20 -4
- package/dist/models/operations/features.d.ts +24 -8
- package/dist/models/operations/governance.d.ts +3 -2
- package/dist/models/operations/invoices.d.ts +48 -0
- package/dist/models/operations/invoices.js +2 -0
- package/dist/models/operations/llmCost.d.ts +16 -4
- package/dist/models/operations/meters.d.ts +29 -8
- package/dist/models/operations/planAddons.d.ts +7 -6
- package/dist/models/operations/plans.d.ts +14 -5
- package/dist/models/operations/subscriptions.d.ts +36 -10
- package/dist/models/operations/tax.d.ts +6 -5
- package/dist/models/schemas.d.ts +27219 -3021
- package/dist/models/schemas.js +7079 -1362
- package/dist/models/types.d.ts +4309 -1046
- package/dist/sdk/apps.js +1 -1
- package/dist/sdk/customers.d.ts +3 -1
- package/dist/sdk/customers.js +7 -1
- package/dist/sdk/entitlements.js +1 -1
- package/dist/sdk/events.js +1 -1
- package/dist/sdk/governance.js +1 -1
- package/dist/sdk/invoices.d.ts +12 -0
- package/dist/sdk/invoices.js +21 -0
- package/dist/sdk/meters.d.ts +2 -1
- package/dist/sdk/meters.js +4 -1
- package/dist/sdk/sdk.d.ts +3 -0
- package/dist/sdk/sdk.js +5 -0
- package/dist/sdk/subscriptions.d.ts +2 -1
- package/dist/sdk/subscriptions.js +4 -1
- package/package.json +4 -3
package/dist/funcs/tax.js
CHANGED
|
@@ -1,35 +1,96 @@
|
|
|
1
1
|
import { http } from '../core.js';
|
|
2
2
|
import { request } from '../lib/request.js';
|
|
3
|
-
import {
|
|
3
|
+
import { toURLSearchParams } from '../lib/encodings.js';
|
|
4
|
+
import { toWire, fromWire, assertValid } from '../lib/wire.js';
|
|
5
|
+
import * as schemas from '../models/schemas.js';
|
|
4
6
|
export function createTaxCode(client, req, options) {
|
|
5
|
-
return request(() =>
|
|
6
|
-
|
|
7
|
-
.
|
|
7
|
+
return request(() => {
|
|
8
|
+
const body = toWire(req, schemas.createTaxCodeBody);
|
|
9
|
+
if (client._options.validate) {
|
|
10
|
+
assertValid(schemas.createTaxCodeBodyWire, body);
|
|
11
|
+
}
|
|
12
|
+
return http(client)
|
|
13
|
+
.post('openmeter/tax-codes', { ...options, json: body })
|
|
14
|
+
.json()
|
|
15
|
+
.then((data) => {
|
|
16
|
+
if (client._options.validate) {
|
|
17
|
+
assertValid(schemas.createTaxCodeResponseWire, data);
|
|
18
|
+
}
|
|
19
|
+
return fromWire(data, schemas.createTaxCodeResponse);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
8
22
|
}
|
|
9
23
|
export function getTaxCode(client, req, options) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
24
|
+
return request(() => {
|
|
25
|
+
const path = `openmeter/tax-codes/${(() => {
|
|
26
|
+
if (req.taxCodeId === undefined) {
|
|
27
|
+
throw new Error('missing path parameter: taxCodeId');
|
|
28
|
+
}
|
|
29
|
+
return encodeURIComponent(String(req.taxCodeId));
|
|
30
|
+
})()}`;
|
|
31
|
+
return http(client)
|
|
32
|
+
.get(path, options)
|
|
33
|
+
.json()
|
|
34
|
+
.then((data) => {
|
|
35
|
+
if (client._options.validate) {
|
|
36
|
+
assertValid(schemas.getTaxCodeResponseWire, data);
|
|
37
|
+
}
|
|
38
|
+
return fromWire(data, schemas.getTaxCodeResponse);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
14
41
|
}
|
|
15
42
|
export function listTaxCodes(client, req = {}, options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
43
|
+
return request(() => {
|
|
44
|
+
const query = toWire({
|
|
45
|
+
page: req.page,
|
|
46
|
+
includeDeleted: req.includeDeleted,
|
|
47
|
+
}, schemas.listTaxCodesQueryParams);
|
|
48
|
+
if (client._options.validate) {
|
|
49
|
+
assertValid(schemas.listTaxCodesQueryParamsWire, query);
|
|
50
|
+
}
|
|
51
|
+
const searchParams = toURLSearchParams(query);
|
|
52
|
+
return http(client)
|
|
53
|
+
.get('openmeter/tax-codes', { ...options, searchParams })
|
|
54
|
+
.json()
|
|
55
|
+
.then((data) => {
|
|
56
|
+
if (client._options.validate) {
|
|
57
|
+
assertValid(schemas.listTaxCodesResponseWire, data);
|
|
58
|
+
}
|
|
59
|
+
return fromWire(data, schemas.listTaxCodesResponse);
|
|
60
|
+
});
|
|
19
61
|
});
|
|
20
|
-
return request(() => http(client)
|
|
21
|
-
.get('openmeter/tax-codes', { ...options, searchParams })
|
|
22
|
-
.json());
|
|
23
62
|
}
|
|
24
63
|
export function upsertTaxCode(client, req, options) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
64
|
+
return request(() => {
|
|
65
|
+
const path = `openmeter/tax-codes/${(() => {
|
|
66
|
+
if (req.taxCodeId === undefined) {
|
|
67
|
+
throw new Error('missing path parameter: taxCodeId');
|
|
68
|
+
}
|
|
69
|
+
return encodeURIComponent(String(req.taxCodeId));
|
|
70
|
+
})()}`;
|
|
71
|
+
const body = toWire(req.body, schemas.upsertTaxCodeBody);
|
|
72
|
+
if (client._options.validate) {
|
|
73
|
+
assertValid(schemas.upsertTaxCodeBodyWire, body);
|
|
74
|
+
}
|
|
75
|
+
return http(client)
|
|
76
|
+
.put(path, { ...options, json: body })
|
|
77
|
+
.json()
|
|
78
|
+
.then((data) => {
|
|
79
|
+
if (client._options.validate) {
|
|
80
|
+
assertValid(schemas.upsertTaxCodeResponseWire, data);
|
|
81
|
+
}
|
|
82
|
+
return fromWire(data, schemas.upsertTaxCodeResponse);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
29
85
|
}
|
|
30
86
|
export function deleteTaxCode(client, req, options) {
|
|
31
|
-
const path = encodePath('openmeter/tax-codes/{taxCodeId}', { taxCodeId: req.taxCodeId });
|
|
32
87
|
return request(async () => {
|
|
88
|
+
const path = `openmeter/tax-codes/${(() => {
|
|
89
|
+
if (req.taxCodeId === undefined) {
|
|
90
|
+
throw new Error('missing path parameter: taxCodeId');
|
|
91
|
+
}
|
|
92
|
+
return encodeURIComponent(String(req.taxCodeId));
|
|
93
|
+
})()}`;
|
|
33
94
|
await http(client).delete(path, options);
|
|
34
95
|
});
|
|
35
96
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { Entitlements } from './sdk/entitlements.js';
|
|
|
6
6
|
export { Subscriptions } from './sdk/subscriptions.js';
|
|
7
7
|
export { Apps } from './sdk/apps.js';
|
|
8
8
|
export { Billing } from './sdk/billing.js';
|
|
9
|
+
export { Invoices } from './sdk/invoices.js';
|
|
9
10
|
export { Tax } from './sdk/tax.js';
|
|
10
11
|
export { Currencies } from './sdk/currencies.js';
|
|
11
12
|
export { Features } from './sdk/features.js';
|
|
@@ -17,6 +18,8 @@ export { Defaults } from './sdk/defaults.js';
|
|
|
17
18
|
export { Governance } from './sdk/governance.js';
|
|
18
19
|
export { Client } from './core.js';
|
|
19
20
|
export { HTTPError } from './models/errors.js';
|
|
21
|
+
export { ValidationError, DepthLimitExceededError } from './lib/wire.js';
|
|
22
|
+
export type { AcceptDateStrings, DateString } from './lib/wire.js';
|
|
20
23
|
export { ServerList, Regions } from './lib/config.js';
|
|
21
24
|
export type { SDKOptions, Region, ServerVariables } from './lib/config.js';
|
|
22
25
|
export type { Result, RequestOptions } from './lib/types.js';
|
|
@@ -29,6 +32,7 @@ export type * from './models/operations/entitlements.js';
|
|
|
29
32
|
export type * from './models/operations/subscriptions.js';
|
|
30
33
|
export type * from './models/operations/apps.js';
|
|
31
34
|
export type * from './models/operations/billing.js';
|
|
35
|
+
export type * from './models/operations/invoices.js';
|
|
32
36
|
export type * from './models/operations/tax.js';
|
|
33
37
|
export type * from './models/operations/currencies.js';
|
|
34
38
|
export type * from './models/operations/features.js';
|
|
@@ -38,5 +42,5 @@ export type * from './models/operations/addons.js';
|
|
|
38
42
|
export type * from './models/operations/planAddons.js';
|
|
39
43
|
export type * from './models/operations/defaults.js';
|
|
40
44
|
export type * from './models/operations/governance.js';
|
|
41
|
-
export type { Labels, CursorPaginationQueryPage, SortQuery, IngestedEventValidationError, CursorMetaPage, BaseError, PageMeta, QueryFilterString, AppStripeCheckoutSessionCustomTextParams, AppStripeCreateCustomerPortalSessionOptions, CreateLabels,
|
|
45
|
+
export type { Labels, CursorPaginationQueryPage, SortQuery, IngestedEventValidationError, CursorMetaPage, BaseError, PageMeta, QueryFilterString, AppStripeCheckoutSessionCustomTextParams, AppStripeCreateCustomerPortalSessionOptions, CreateLabels, TaxConfigStripe, TaxConfigExternalInvoicing, ChargeFlatFeeDiscounts, PriceFree, RateCardStaticEntitlement, RateCardBooleanEntitlement, WorkflowCollectionAlignmentSubscription, WorkflowPaymentChargeAutomaticallySettings, WorkflowPaymentSendInvoiceSettings, InvoiceExternalReferences, InvoiceAvailableActionDetails, InvoiceWorkflowInvoicingSettings, InvoiceLineExternalReferences, UpdateLabels, UpdateBillingInvoiceWorkflowInvoicingSettings, UpdateBillingWorkflowPaymentChargeAutomaticallySettings, UpdateBillingWorkflowPaymentSendInvoiceSettings, UpdatePriceFree, LlmCostProvider, LlmCostModel, ProductCatalogValidationError, GovernanceQueryRequestCustomers, GovernanceQueryRequestFeatures, QueryFilterInteger, QueryFilterFloat, QueryFilterBoolean, PagePaginationQuery, PublicLabels, SystemAccountAccessToken, PersonalAccessToken, KonnectAccessToken, UpdateMeterRequest, AppCustomerDataStripe, AppCustomerDataExternalInvoicing, CurrencyFiat, ListCostBasesParamsFilter, 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, CreateCostBasisRequest, 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, CreateMeterRequest, Meter, PaginatedMeta, QueryFilterStringMapItem, CustomerKeyReference, CustomerUsageAttribution, UpdateCustomerUsageAttribution, Address, UpdateAddress, AppStripeCreateCheckoutSessionCustomerUpdate, AppStripeCreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreement, AppStripeCreateCheckoutSessionTaxIdCollection, AppStripeCreateCheckoutSessionResult, CustomerStripeCreateCustomerPortalSessionRequest, EntitlementAccessResult, CreateCreditGrantPurchase, RateCardMeteredEntitlement, RecurringPeriod, CreditGrantPurchase, UpdateCreditGrantExternalSettlementRequest, ListCreditGrantsParamsFilter, GetCreditBalanceParamsFilter, ListChargesParamsFilter, ListPlansParamsFilter, SubscriptionCreate, RateCardProrationConfiguration, Subscription, UnitConfig, AppCatalogItem, TaxCodeAppMapping, PartyTaxIdentity, UpdateBillingPartyTaxIdentity, WorkflowInvoicingSettings, InvoiceValidationIssue, InvoiceAvailableActions, InvoiceLineAmountDiscount, InvoiceLineUsageDiscount, InvoiceLineBaseDiscount, ListCurrenciesParamsFilter, CurrencyCustom, CreateCurrencyCustomRequest, GovernanceQueryRequest, GovernanceFeatureAccessReason, GovernanceQueryError, AppCustomerData, UpsertAppCustomerDataRequest, CreditAdjustment, CreditBalance, CreateCreditAdjustmentRequest, ListCreditTransactionsParamsFilter, CreditTransaction, PriceTier, ChargeTotals, UpdatePriceTier, FeatureLlmUnitCost, LlmCostPrice, LlmCostOverrideCreate, ListCustomersParamsFilter, ListSubscriptionsParamsFilter, ListFeatureParamsFilter, ListAddonsParamsFilter, CreateCreditGrantTaxConfig, CreditGrantTaxConfig, TaxConfig, RateCardTaxConfig, OrganizationDefaultTaxCodes, UpdateOrganizationDefaultTaxCodesRequest, PlanAddon, CreatePlanAddonRequest, ProfileAppReferences, InvoiceWorkflowAppsReferences, UpdateRateCardTaxConfig, ListEventsParamsFilter, ListInvoicesParamsFilter, ResourceFilters, FieldFilters, IngestedEvent, MeterQueryResult, FeatureCostQueryResult, MeterPagePaginatedResponse, CostBasisPagePaginatedResponse, MeterQueryFilters, FeatureMeterReference, CreateCustomerRequest, Customer, UpsertCustomerRequest, PartyAddresses, InvoiceCustomer, UpdateBillingPartyAddresses, UpdateInvoiceCustomer, AppStripeCreateCheckoutSessionConsentCollection, ListCustomerEntitlementAccessResponseData, WorkflowCollectionAlignmentAnchored, ChargeFlatFeeSystemIntent, SubscriptionPagePaginatedResponse, SubscriptionChangeResponse, SubscriptionCancel, SubscriptionChange, CreateSubscriptionAddonRequest, InvoiceUsageQuantityDetail, AppStripe, AppSandbox, AppExternalInvoicing, CreateTaxCodeRequest, TaxCode, UpsertTaxCodeRequest, InvoiceWorkflow, InvoiceStatusDetails, InvoiceLineDiscounts, UpdateBillingInvoiceWorkflow, GovernanceFeatureAccess, CustomerData, UpsertCustomerBillingDataRequest, CreditBalances, CreditTransactionPaginatedResponse, PriceGraduated, PriceVolume, UpdatePriceGraduated, UpdatePriceVolume, PricePagePaginatedResponse, CreateCreditGrantRequest, CreditGrant, CreateChargeFlatFeeRequest, WorkflowTaxSettings, PlanAddonPagePaginatedResponse, IngestedEventPaginatedResponse, InvalidParameters, MeterQueryRequest, CustomerPagePaginatedResponse, Party, Supplier, UpdateSupplier, AppStripeCreateCheckoutSessionRequestOptions, TaxCodePagePaginatedResponse, InvoiceWorkflowSettings, InvoiceDetailedLine, UpdateInvoiceWorkflowSettings, CurrencyPagePaginatedResponse, GovernanceQueryResult, Feature, CreateFeatureRequest, UpdateFeatureRequest, CreditGrantPagePaginatedResponse, BadRequest, InvoiceBase, CustomerStripeCreateCheckoutSessionRequest, WorkflowCollectionSettings, AppPagePaginatedResponse, ProfileApps, GovernanceQueryResponse, ChargeFlatFee, ChargeUsageBasedSystemIntent, CreateChargeUsageBasedRequest, RateCard, InvoiceLineRateCard, UpdateInvoiceLineRateCard, FeaturePagePaginatedResponse, Workflow, ChargeUsageBased, SubscriptionAddonRateCard, PlanPhase, Addon, CreateAddonRequest, UpsertAddonRequest, InvoiceStandardLine, UpdateInvoiceStandardLine, Profile, CreateBillingProfileRequest, UpsertBillingProfileRequest, SubscriptionAddon, Plan, CreatePlanRequest, UpsertPlanRequest, AddonPagePaginatedResponse, ProfilePagePaginatedResponse, ChargePagePaginatedResponse, SubscriptionAddonPagePaginatedResponse, PlanPagePaginatedResponse, InvoiceStandard, UpdateInvoiceStandardRequest, InvoicePagePaginatedResponse, SortQueryInput, BaseErrorInput, WorkflowPaymentSendInvoiceSettingsInput, InvoiceWorkflowInvoicingSettingsInput, UpdateBillingInvoiceWorkflowInvoicingSettingsInput, UpdateBillingWorkflowPaymentSendInvoiceSettingsInput, EventInput, UnauthorizedInput, ForbiddenInput, NotFoundInput, GoneInput, ConflictInput, PayloadTooLargeInput, UnsupportedMediaTypeInput, UnprocessableContentInput, TooManyRequestsInput, InternalInput, NotImplementedInput, NotAvailableInput, AppStripeCreateCheckoutSessionCustomerUpdateInput, AppStripeCreateCheckoutSessionTaxIdCollectionInput, CreateCreditGrantPurchaseInput, RateCardMeteredEntitlementInput, CreditGrantPurchaseInput, UnitConfigInput, WorkflowInvoicingSettingsInput, GovernanceQueryRequestInput, IngestedEventInput, SubscriptionCancelInput, InvoiceUsageQuantityDetailInput, InvoiceWorkflowInput, UpdateBillingInvoiceWorkflowInput, CreateCreditGrantRequestInput, CreditGrantInput, WorkflowTaxSettingsInput, IngestedEventPaginatedResponseInput, MeterQueryRequestInput, AppStripeCreateCheckoutSessionRequestOptionsInput, InvoiceWorkflowSettingsInput, InvoiceDetailedLineInput, UpdateInvoiceWorkflowSettingsInput, CreditGrantPagePaginatedResponseInput, BadRequestInput, CustomerStripeCreateCheckoutSessionRequestInput, WorkflowCollectionSettingsInput, RateCardInput, WorkflowInput, SubscriptionAddonRateCardInput, PlanPhaseInput, AddonInput, CreateAddonRequestInput, UpsertAddonRequestInput, InvoiceStandardLineInput, ProfileInput, CreateBillingProfileRequestInput, UpsertBillingProfileRequestInput, SubscriptionAddonInput, PlanInput, CreatePlanRequestInput, UpsertPlanRequestInput, AddonPagePaginatedResponseInput, ProfilePagePaginatedResponseInput, SubscriptionAddonPagePaginatedResponseInput, PlanPagePaginatedResponseInput, InvoiceStandardInput, UpdateInvoiceStandardRequestInput, InvoicePagePaginatedResponseInput, } from './models/types.js';
|
|
42
46
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export { Entitlements } from './sdk/entitlements.js';
|
|
|
6
6
|
export { Subscriptions } from './sdk/subscriptions.js';
|
|
7
7
|
export { Apps } from './sdk/apps.js';
|
|
8
8
|
export { Billing } from './sdk/billing.js';
|
|
9
|
+
export { Invoices } from './sdk/invoices.js';
|
|
9
10
|
export { Tax } from './sdk/tax.js';
|
|
10
11
|
export { Currencies } from './sdk/currencies.js';
|
|
11
12
|
export { Features } from './sdk/features.js';
|
|
@@ -17,6 +18,7 @@ export { Defaults } from './sdk/defaults.js';
|
|
|
17
18
|
export { Governance } from './sdk/governance.js';
|
|
18
19
|
export { Client } from './core.js';
|
|
19
20
|
export { HTTPError } from './models/errors.js';
|
|
21
|
+
export { ValidationError, DepthLimitExceededError } from './lib/wire.js';
|
|
20
22
|
export { ServerList, Regions } from './lib/config.js';
|
|
21
23
|
export { encodePath, encodeSort, querySerializer, toURLSearchParams, } from './lib/encodings.js';
|
|
22
24
|
export * as funcs from './funcs/index.js';
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -10,5 +10,14 @@ export interface SDKOptions extends Omit<Options, 'method'> {
|
|
|
10
10
|
baseUrl: (typeof ServerList)[number] | URL | string;
|
|
11
11
|
serverVariables?: ServerVariables;
|
|
12
12
|
apiKey?: string | (() => string | Promise<string>);
|
|
13
|
+
/**
|
|
14
|
+
* Validate request bodies and response payloads against their schemas. Off by
|
|
15
|
+
* default: the SDK maps casing but does not validate, so additive server fields
|
|
16
|
+
* never break clients. When on, a request body or response that fails its schema
|
|
17
|
+
* (missing/wrong-typed field, unknown enum value) returns a failed Result whose
|
|
18
|
+
* `error` is a ValidationError (validation runs inside the SDK's request
|
|
19
|
+
* handling, so it never rejects/throws).
|
|
20
|
+
*/
|
|
21
|
+
validate?: boolean;
|
|
13
22
|
}
|
|
14
23
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/lib/config.js
CHANGED
|
@@ -3,11 +3,5 @@ export const ServerList = [
|
|
|
3
3
|
'http://localhost:{port}/api/v3',
|
|
4
4
|
'https://openmeter.cloud/api/v3',
|
|
5
5
|
];
|
|
6
|
-
export const Regions = [
|
|
7
|
-
'in',
|
|
8
|
-
'me',
|
|
9
|
-
'au',
|
|
10
|
-
'eu',
|
|
11
|
-
'us',
|
|
12
|
-
];
|
|
6
|
+
export const Regions = ['in', 'me', 'au', 'eu', 'us'];
|
|
13
7
|
//# sourceMappingURL=config.js.map
|
package/dist/lib/encodings.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export declare function toURLSearchParams(params: Record<string, unknown>): URLS
|
|
|
4
4
|
export declare function encodeSort(sort: {
|
|
5
5
|
by?: string;
|
|
6
6
|
order?: 'asc' | 'desc';
|
|
7
|
-
} | undefined): string | undefined;
|
|
7
|
+
} | undefined, encodeField?: (field: string) => string): string | undefined;
|
|
8
8
|
//# sourceMappingURL=encodings.d.ts.map
|
package/dist/lib/encodings.js
CHANGED
|
@@ -41,16 +41,17 @@ export function toURLSearchParams(params) {
|
|
|
41
41
|
}
|
|
42
42
|
return search;
|
|
43
43
|
}
|
|
44
|
-
export function encodeSort(sort) {
|
|
44
|
+
export function encodeSort(sort, encodeField = (field) => field) {
|
|
45
45
|
if (!sort?.by) {
|
|
46
46
|
return undefined;
|
|
47
47
|
}
|
|
48
|
+
const by = encodeField(sort.by);
|
|
48
49
|
if (sort.order === 'desc') {
|
|
49
|
-
return `${
|
|
50
|
+
return `${by} desc`;
|
|
50
51
|
}
|
|
51
52
|
if (sort.order === 'asc') {
|
|
52
|
-
return `${
|
|
53
|
+
return `${by} asc`;
|
|
53
54
|
}
|
|
54
|
-
return
|
|
55
|
+
return by;
|
|
55
56
|
}
|
|
56
57
|
//# sourceMappingURL=encodings.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { output, ZodType } from 'zod';
|
|
2
|
+
export declare function toCamelCase(name: string): string;
|
|
3
|
+
export declare function toSnakeCase(name: string): string;
|
|
4
|
+
export type DateString = string & Record<never, never>;
|
|
5
|
+
export type AcceptDateStrings<T> = T extends Date ? Date | DateString : T extends (infer E)[] ? AcceptDateStrings<E>[] : T extends object ? {
|
|
6
|
+
[K in keyof T]: AcceptDateStrings<T[K]>;
|
|
7
|
+
} : T;
|
|
8
|
+
export declare class DepthLimitExceededError extends Error {
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
11
|
+
export declare function toWire<T>(data: T, schema: ZodType): T;
|
|
12
|
+
export declare function fromWire<S extends ZodType>(data: unknown, schema: S): output<S>;
|
|
13
|
+
export declare class ValidationError extends Error {
|
|
14
|
+
readonly issues: unknown;
|
|
15
|
+
constructor(message: string, issues: unknown);
|
|
16
|
+
}
|
|
17
|
+
export declare function assertValid(schema: ZodType, data: unknown): void;
|
|
18
|
+
//# sourceMappingURL=wire.d.ts.map
|
package/dist/lib/wire.js
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
export function toCamelCase(name) {
|
|
2
|
+
return name.replace(/_([a-z0-9])/g, (_m, c) => c.toUpperCase());
|
|
3
|
+
}
|
|
4
|
+
export function toSnakeCase(name) {
|
|
5
|
+
return name.replace(/([A-Z])/g, (_m, c) => `_${c.toLowerCase()}`);
|
|
6
|
+
}
|
|
7
|
+
function def(schema) {
|
|
8
|
+
return schema?.def;
|
|
9
|
+
}
|
|
10
|
+
// Unwrap optional/nullable/default to the schema that describes the value's
|
|
11
|
+
// shape. These wrappers never change keys, so the walker looks through them
|
|
12
|
+
// before classifying a node.
|
|
13
|
+
function unwrap(schema) {
|
|
14
|
+
let current = schema;
|
|
15
|
+
for (let i = 0; i < 100 && current; i++) {
|
|
16
|
+
const d = def(current);
|
|
17
|
+
if (d &&
|
|
18
|
+
(d.type === 'optional' ||
|
|
19
|
+
d.type === 'nullable' ||
|
|
20
|
+
d.type === 'default') &&
|
|
21
|
+
d.innerType) {
|
|
22
|
+
current = d.innerType;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
return current;
|
|
26
|
+
}
|
|
27
|
+
/* v8 ignore next -- loop returns inside; reached only past the cycle guard */
|
|
28
|
+
return current;
|
|
29
|
+
}
|
|
30
|
+
function shapeOf(schema) {
|
|
31
|
+
return schema?.shape;
|
|
32
|
+
}
|
|
33
|
+
// The element schema for array data: the schema's own element when it is an
|
|
34
|
+
// array, or the array variant's element when it is a union of T and T[]
|
|
35
|
+
// (the single-or-batch body shape).
|
|
36
|
+
function arrayElement(schema) {
|
|
37
|
+
const d = def(schema);
|
|
38
|
+
if (d?.type === 'array') {
|
|
39
|
+
return d.element;
|
|
40
|
+
}
|
|
41
|
+
if (d?.type === 'union') {
|
|
42
|
+
for (const option of d.options ?? []) {
|
|
43
|
+
const od = def(unwrap(option));
|
|
44
|
+
if (od?.type === 'array') {
|
|
45
|
+
return od.element;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
// Whether a record value schema needs walking: it carries renamable fields
|
|
52
|
+
// (object/record/array/union of such) or date-typed values that must map
|
|
53
|
+
// between `Date` and the RFC 3339 wire string. Other scalars, literals,
|
|
54
|
+
// unknown, and any are left untouched, so user data (labels, dimensions,
|
|
55
|
+
// event payloads) is never rewritten.
|
|
56
|
+
function needsWalk(schema) {
|
|
57
|
+
const s = unwrap(schema);
|
|
58
|
+
const d = def(s);
|
|
59
|
+
/* v8 ignore next 3 -- a record always has a value schema; defensive only */
|
|
60
|
+
if (!d) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
if (d.type === 'object' || d.type === 'record' || d.type === 'date') {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
if (d.type === 'array') {
|
|
67
|
+
return needsWalk(d.element);
|
|
68
|
+
}
|
|
69
|
+
if (d.type === 'union') {
|
|
70
|
+
return (d.options ?? []).some(needsWalk);
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const _literalsSurviveWidening = true;
|
|
75
|
+
void _literalsSurviveWidening;
|
|
76
|
+
// A handful of schemas are genuinely self-referential (e.g. the `and`/`or`
|
|
77
|
+
// legs of a filter tree), so nesting depth is bounded only by the DATA the
|
|
78
|
+
// server sends, not by the schema. Without a limit, a crafted or
|
|
79
|
+
// accidentally-deep response recurses until the JS engine throws a raw
|
|
80
|
+
// `RangeError: Maximum call stack size exceeded` — still caught by request()
|
|
81
|
+
// and surfaced as Result.error, but as an opaque native error instead of a
|
|
82
|
+
// typed one. 500 levels is far beyond any real filter/record/array nesting
|
|
83
|
+
// in the API today; it exists to fail predictably, not to constrain valid data.
|
|
84
|
+
const MAX_WALK_DEPTH = 500;
|
|
85
|
+
export class DepthLimitExceededError extends Error {
|
|
86
|
+
constructor() {
|
|
87
|
+
super(`wire mapping exceeded maximum nesting depth (${MAX_WALK_DEPTH})`);
|
|
88
|
+
this.name = 'DepthLimitExceededError';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function walk(data, schema, dir, depth = 0) {
|
|
92
|
+
if (data === null || data === undefined) {
|
|
93
|
+
return data;
|
|
94
|
+
}
|
|
95
|
+
// A Date can only ever mean its wire serialization, wherever it sits — a
|
|
96
|
+
// typed date field, a record value, or an unknown-schema position. Wire→
|
|
97
|
+
// public data never contains Date instances (it comes from JSON.parse), so
|
|
98
|
+
// this only rewrites public→wire.
|
|
99
|
+
if (data instanceof Date) {
|
|
100
|
+
return dir.mapDate(data);
|
|
101
|
+
}
|
|
102
|
+
if (depth > MAX_WALK_DEPTH) {
|
|
103
|
+
throw new DepthLimitExceededError();
|
|
104
|
+
}
|
|
105
|
+
const s = unwrap(schema);
|
|
106
|
+
const d = def(s);
|
|
107
|
+
// A date-typed node maps between the public `Date` and the RFC 3339 wire
|
|
108
|
+
// string (fromWire revives the string; a string handed to toWire by an
|
|
109
|
+
// untyped caller passes through as-is).
|
|
110
|
+
if (d?.type === 'date') {
|
|
111
|
+
return dir.mapDate(data);
|
|
112
|
+
}
|
|
113
|
+
if (Array.isArray(data)) {
|
|
114
|
+
// The schema may be the array itself or a union with an array variant
|
|
115
|
+
// (e.g. a single-or-batch body `T | T[]`); resolve the element schema from
|
|
116
|
+
// whichever applies so array items are still walked with their shape.
|
|
117
|
+
const element = arrayElement(s);
|
|
118
|
+
return data.map((item) => walk(item, element, dir, depth + 1));
|
|
119
|
+
}
|
|
120
|
+
if (typeof data !== 'object') {
|
|
121
|
+
// A wire datetime can sit behind a union (`DateTime | null`,
|
|
122
|
+
// enum-or-DateTime): revive the string only when the union's date variant
|
|
123
|
+
// is its sole plausible owner, so enum literals and plain-string variants
|
|
124
|
+
// pass through untouched.
|
|
125
|
+
if (typeof data === 'string' &&
|
|
126
|
+
d?.type === 'union' &&
|
|
127
|
+
unionDateClaims(s, data)) {
|
|
128
|
+
return dir.mapDate(data);
|
|
129
|
+
}
|
|
130
|
+
return data;
|
|
131
|
+
}
|
|
132
|
+
const record = data;
|
|
133
|
+
if (d?.type === 'record') {
|
|
134
|
+
// Record keys are user data (label/dimension names) — preserved verbatim.
|
|
135
|
+
// Only the value is walked, and only when it needs mapping. A null
|
|
136
|
+
// prototype avoids the `__proto__` key silently reassigning `out`'s own
|
|
137
|
+
// prototype instead of becoming a visible entry (user data may contain
|
|
138
|
+
// any key, including reserved object-literal property names). The
|
|
139
|
+
// prototype is restored once every key is a plain own property, so the
|
|
140
|
+
// returned object still behaves normally for consumers (instanceof,
|
|
141
|
+
// template literals) — `Object.prototype` itself was never touched.
|
|
142
|
+
const valueSchema = needsWalk(d.valueType) ? d.valueType : undefined;
|
|
143
|
+
const out = Object.create(null);
|
|
144
|
+
for (const [key, value] of Object.entries(record)) {
|
|
145
|
+
out[key] = valueSchema ? walk(value, valueSchema, dir, depth + 1) : value;
|
|
146
|
+
}
|
|
147
|
+
Object.setPrototypeOf(out, Object.prototype);
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
150
|
+
if (d?.type === 'union') {
|
|
151
|
+
const variant = selectVariant(record, s, dir);
|
|
152
|
+
if (!variant) {
|
|
153
|
+
// No confident match: leave keys untransformed rather than guess.
|
|
154
|
+
return data;
|
|
155
|
+
}
|
|
156
|
+
return walk(data, variant, dir, depth + 1);
|
|
157
|
+
}
|
|
158
|
+
if (d?.type === 'object') {
|
|
159
|
+
const shape = shapeOf(s) ?? {};
|
|
160
|
+
// A null prototype avoids two failure modes from data-controlled keys
|
|
161
|
+
// like `__proto__`/`constructor`: (1) `fieldFor` below reading an
|
|
162
|
+
// inherited Object.prototype member instead of correctly treating the
|
|
163
|
+
// key as schema-undeclared, and (2) the assignment at the end of this
|
|
164
|
+
// loop reassigning `out`'s own prototype instead of adding a visible key.
|
|
165
|
+
const out = Object.create(null);
|
|
166
|
+
for (const [key, value] of Object.entries(record)) {
|
|
167
|
+
const fieldSchema = fieldFor(shape, key);
|
|
168
|
+
// Keys the schema does not declare are dropped, so the result matches the
|
|
169
|
+
// typed shape exactly (a server-added field has no place in the type).
|
|
170
|
+
if (fieldSchema === undefined) {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
out[dir.rename(key)] = walk(value, fieldSchema, dir, depth + 1);
|
|
174
|
+
}
|
|
175
|
+
Object.setPrototypeOf(out, Object.prototype);
|
|
176
|
+
return out;
|
|
177
|
+
}
|
|
178
|
+
// Scalar or unknown schema: pass through untransformed.
|
|
179
|
+
return data;
|
|
180
|
+
}
|
|
181
|
+
// Resolve a data key to its field schema. The schema is camelCase-keyed; a
|
|
182
|
+
// wire→public data key is snake, so it is camelized to index the shape.
|
|
183
|
+
// Own-property checks (not `shape[key]`) so a data-controlled key like
|
|
184
|
+
// `__proto__` or `constructor` cannot resolve to an inherited
|
|
185
|
+
// Object.prototype member and be mistaken for a declared schema field.
|
|
186
|
+
function fieldFor(shape, dataKey) {
|
|
187
|
+
if (Object.hasOwn(shape, dataKey)) {
|
|
188
|
+
return shape[dataKey];
|
|
189
|
+
}
|
|
190
|
+
const camelKey = toCamelCase(dataKey);
|
|
191
|
+
return Object.hasOwn(shape, camelKey) ? shape[camelKey] : undefined;
|
|
192
|
+
}
|
|
193
|
+
function selectVariant(data, schema, dir) {
|
|
194
|
+
const d = def(schema);
|
|
195
|
+
const options = d?.options ?? [];
|
|
196
|
+
if (d?.discriminator && schema) {
|
|
197
|
+
// O(1) dispatch on the discriminator literal. The data key is the wire-name in
|
|
198
|
+
// fromWire (snake) and the public name in toWire (camel); the variant map is
|
|
199
|
+
// keyed by the literal value, which is identical in both directions.
|
|
200
|
+
const dataKey = dir.discriminatorKey(d.discriminator);
|
|
201
|
+
return variantsByDiscriminator(schema, d).get(data[dataKey]);
|
|
202
|
+
}
|
|
203
|
+
// Non-discriminated union: the codegen gate guarantees at most one object
|
|
204
|
+
// variant (it fails the build for a mapped union with two or more), so the single
|
|
205
|
+
// object-shaped option is unambiguous. Other variants (scalars, arrays) reach the
|
|
206
|
+
// walk through their own data-kind branches, not here.
|
|
207
|
+
return options.find((option) => def(unwrap(option))?.type === 'object');
|
|
208
|
+
}
|
|
209
|
+
// Memoized literal→variant map for a discriminated union, built once per schema.
|
|
210
|
+
const variantMapCache = new WeakMap();
|
|
211
|
+
function variantsByDiscriminator(schema, d) {
|
|
212
|
+
const cached = variantMapCache.get(schema);
|
|
213
|
+
if (cached) {
|
|
214
|
+
return cached;
|
|
215
|
+
}
|
|
216
|
+
const map = new Map();
|
|
217
|
+
for (const option of d.options ?? []) {
|
|
218
|
+
const shape = shapeOf(unwrap(option));
|
|
219
|
+
const literal = literalValue(shape?.[d.discriminator]);
|
|
220
|
+
if (literal !== undefined) {
|
|
221
|
+
map.set(literal, option);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
variantMapCache.set(schema, map);
|
|
225
|
+
return map;
|
|
226
|
+
}
|
|
227
|
+
function literalValue(schema) {
|
|
228
|
+
const s = unwrap(schema);
|
|
229
|
+
if (def(s)?.type === 'literal') {
|
|
230
|
+
return s.value;
|
|
231
|
+
}
|
|
232
|
+
/* v8 ignore next -- a discriminated-union variant's discriminator is a literal */
|
|
233
|
+
return undefined;
|
|
234
|
+
}
|
|
235
|
+
// Whether a union's date variant is the sole plausible owner of a string
|
|
236
|
+
// value: the union carries a date option, no string-capable sibling (a plain
|
|
237
|
+
// string variant, an enum containing the value, an equal string literal)
|
|
238
|
+
// claims it, and the value actually parses as a date. `DateTime | null`
|
|
239
|
+
// revives its RFC 3339 string; `'immediate' | DateTime` keeps the enum
|
|
240
|
+
// literal a string. Fail-open: an unclaimed string stays a string.
|
|
241
|
+
function unionDateClaims(schema, value) {
|
|
242
|
+
let hasDate = false;
|
|
243
|
+
for (const option of def(schema)?.options ?? []) {
|
|
244
|
+
const od = def(unwrap(option));
|
|
245
|
+
if (od?.type === 'date') {
|
|
246
|
+
hasDate = true;
|
|
247
|
+
}
|
|
248
|
+
else if (od?.type === 'string') {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
else if (od?.type === 'enum' &&
|
|
252
|
+
Object.values(od.entries ?? {}).includes(value)) {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
else if (od?.type === 'literal' && literalValue(option) === value) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return hasDate && !Number.isNaN(Date.parse(value));
|
|
260
|
+
}
|
|
261
|
+
const toWireDirection = {
|
|
262
|
+
rename: toSnakeCase,
|
|
263
|
+
discriminatorKey: (camelKey) => camelKey,
|
|
264
|
+
mapDate: (value) => (value instanceof Date ? value.toISOString() : value),
|
|
265
|
+
};
|
|
266
|
+
const fromWireDirection = {
|
|
267
|
+
rename: toCamelCase,
|
|
268
|
+
discriminatorKey: (camelKey) => toSnakeCase(camelKey),
|
|
269
|
+
mapDate: (value) => (typeof value === 'string' ? new Date(value) : value),
|
|
270
|
+
};
|
|
271
|
+
// Rewrite a request body or query object from the camelCase public shape to the
|
|
272
|
+
// snake_case wire shape, driven by its schema. Record keys (label/dimension names)
|
|
273
|
+
// are preserved; `Date` values serialize to RFC 3339 strings. The return is typed
|
|
274
|
+
// as the input `T` so call sites stay cast-free (the runtime object has snake keys
|
|
275
|
+
// and wire-encoded dates, but the value is write-only — it flows straight into
|
|
276
|
+
// `json:`/`toURLSearchParams`, both of which accept any object).
|
|
277
|
+
export function toWire(data, schema) {
|
|
278
|
+
return walk(data, schema, toWireDirection);
|
|
279
|
+
}
|
|
280
|
+
// Rewrite a response body from the snake_case wire shape to the camelCase public
|
|
281
|
+
// shape: renames keys and revives RFC 3339 strings into `Date`s at date-typed
|
|
282
|
+
// nodes — never applies defaults or any other coercion. The result is the
|
|
283
|
+
// schema's output shape: `walk` produces exactly the schema's known fields in
|
|
284
|
+
// camelCase, so the inferred `output<S>` type describes the runtime value (the
|
|
285
|
+
// same wire-trust boundary as a plain `.json<T>()`, with no `.parse()`).
|
|
286
|
+
export function fromWire(data, schema) {
|
|
287
|
+
return walk(data, schema, fromWireDirection);
|
|
288
|
+
}
|
|
289
|
+
// Thrown by assertValid when the optional `validate` client option is on and data
|
|
290
|
+
// fails its schema. request() catches it like any Error and surfaces it as
|
|
291
|
+
// Result.error.
|
|
292
|
+
export class ValidationError extends Error {
|
|
293
|
+
issues;
|
|
294
|
+
constructor(message, issues) {
|
|
295
|
+
super(message);
|
|
296
|
+
this.issues = issues;
|
|
297
|
+
this.name = 'ValidationError';
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
// Opt-in schema check used by the funcs (when the validate option is on) against
|
|
301
|
+
// the snake_case wire payload: the request body after toWire, the raw response
|
|
302
|
+
// before fromWire, each against its generated `…Wire` schema. It is a GATE, not a
|
|
303
|
+
// transform — the safeParse output (coercions/defaults) is discarded, so validation
|
|
304
|
+
// never mutates the payload or return value. Off by default; the SDK does not
|
|
305
|
+
// validate by default (additive server fields must not break clients).
|
|
306
|
+
export function assertValid(schema, data) {
|
|
307
|
+
const result = schema.safeParse(data);
|
|
308
|
+
if (!result.success) {
|
|
309
|
+
throw new ValidationError('schema validation failed', result.error.issues);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
//# sourceMappingURL=wire.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AcceptDateStrings } from '../../lib/wire.js';
|
|
1
2
|
import type { Addon, AddonPagePaginatedResponse, CreateAddonRequestInput, ListAddonsParamsFilter, SortQueryInput, UpsertAddonRequestInput } from '../types.js';
|
|
2
3
|
export interface ListAddonsQuery {
|
|
3
4
|
/** Determines which page of the collection to retrieve. */
|
|
@@ -5,19 +6,30 @@ export interface ListAddonsQuery {
|
|
|
5
6
|
size?: number;
|
|
6
7
|
number?: number;
|
|
7
8
|
};
|
|
8
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Sort add-ons returned in the response. Supported sort attributes are:
|
|
11
|
+
*
|
|
12
|
+
* - `id`
|
|
13
|
+
* - `key`
|
|
14
|
+
* - `name`
|
|
15
|
+
* - `created_at` (default)
|
|
16
|
+
* - `updated_at`
|
|
17
|
+
*
|
|
18
|
+
* The `asc` suffix is optional as the default sort order is ascending. The `desc`
|
|
19
|
+
* suffix is used to specify a descending order.
|
|
20
|
+
*/
|
|
9
21
|
sort?: SortQueryInput;
|
|
10
22
|
/** Filter add-ons returned in the response. */
|
|
11
23
|
filter?: ListAddonsParamsFilter;
|
|
12
24
|
}
|
|
13
|
-
export type ListAddonsRequest = ListAddonsQuery
|
|
25
|
+
export type ListAddonsRequest = AcceptDateStrings<ListAddonsQuery>;
|
|
14
26
|
export type ListAddonsResponse = AddonPagePaginatedResponse;
|
|
15
|
-
export type CreateAddonRequest = CreateAddonRequestInput
|
|
27
|
+
export type CreateAddonRequest = AcceptDateStrings<CreateAddonRequestInput>;
|
|
16
28
|
export type CreateAddonResponse = Addon;
|
|
17
|
-
export type UpdateAddonRequest = {
|
|
29
|
+
export type UpdateAddonRequest = AcceptDateStrings<{
|
|
18
30
|
addonId: string;
|
|
19
31
|
body: UpsertAddonRequestInput;
|
|
20
|
-
}
|
|
32
|
+
}>;
|
|
21
33
|
export type UpdateAddonResponse = Addon;
|
|
22
34
|
export type GetAddonRequest = {
|
|
23
35
|
addonId: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as schemas from '../schemas.js';
|
|
3
|
+
import type { AcceptDateStrings } from '../../lib/wire.js';
|
|
3
4
|
import type { AppPagePaginatedResponse } from '../types.js';
|
|
4
5
|
export interface ListAppsQuery {
|
|
5
6
|
/** Determines which page of the collection to retrieve. */
|
|
@@ -8,7 +9,7 @@ export interface ListAppsQuery {
|
|
|
8
9
|
number?: number;
|
|
9
10
|
};
|
|
10
11
|
}
|
|
11
|
-
export type ListAppsRequest = ListAppsQuery
|
|
12
|
+
export type ListAppsRequest = AcceptDateStrings<ListAppsQuery>;
|
|
12
13
|
export type ListAppsResponse = AppPagePaginatedResponse;
|
|
13
14
|
export type GetAppRequest = {
|
|
14
15
|
appId: string;
|