@openmeter/client 1.0.0-beta-4d26c6d3c7fe → 1.0.0-beta-e7a04be10ed8
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/LICENSE +202 -0
- package/README.md +316 -55
- package/dist/core.d.ts +0 -1
- package/dist/core.js +8 -1
- package/dist/funcs/addons.d.ts +49 -1
- package/dist/funcs/addons.js +50 -1
- package/dist/funcs/apps.d.ts +14 -1
- package/dist/funcs/apps.js +15 -1
- package/dist/funcs/billing.d.ts +46 -1
- package/dist/funcs/billing.js +47 -1
- package/dist/funcs/currencies.d.ts +30 -1
- package/dist/funcs/currencies.js +31 -1
- package/dist/funcs/customers.d.ts +148 -1
- package/dist/funcs/customers.js +149 -1
- package/dist/funcs/defaults.d.ts +10 -1
- package/dist/funcs/defaults.js +11 -1
- package/dist/funcs/entitlements.d.ts +5 -1
- package/dist/funcs/entitlements.js +6 -1
- package/dist/funcs/events.d.ts +14 -1
- package/dist/funcs/events.js +15 -1
- package/dist/funcs/features.d.ts +42 -1
- package/dist/funcs/features.js +43 -1
- package/dist/funcs/index.d.ts +0 -3
- package/dist/funcs/index.js +1 -3
- package/dist/funcs/llmCost.d.ts +36 -1
- package/dist/funcs/llmCost.js +37 -1
- package/dist/funcs/meters.d.ts +53 -1
- package/dist/funcs/meters.js +54 -1
- package/dist/funcs/planAddons.d.ts +35 -1
- package/dist/funcs/planAddons.js +36 -1
- package/dist/funcs/plans.d.ts +49 -1
- package/dist/funcs/plans.js +50 -1
- package/dist/funcs/subscriptions.d.ts +59 -1
- package/dist/funcs/subscriptions.js +60 -1
- package/dist/funcs/tax.d.ts +25 -1
- package/dist/funcs/tax.js +26 -1
- package/dist/index.d.ts +4 -8
- package/dist/index.js +4 -5
- package/dist/lib/config.d.ts +0 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/encodings.d.ts +0 -1
- package/dist/lib/encodings.js +1 -1
- package/dist/lib/paginate.d.ts +56 -0
- package/dist/lib/paginate.js +60 -0
- package/dist/lib/request.d.ts +0 -1
- package/dist/lib/request.js +1 -1
- package/dist/lib/to-error.d.ts +0 -1
- package/dist/lib/to-error.js +1 -1
- package/dist/lib/types.d.ts +0 -1
- package/dist/lib/types.js +1 -1
- package/dist/lib/version.d.ts +1 -0
- package/dist/lib/version.js +5 -0
- package/dist/lib/wire.d.ts +3 -1
- package/dist/lib/wire.js +93 -4
- package/dist/models/errors.d.ts +13 -2
- package/dist/models/errors.js +31 -4
- package/dist/models/operations/addons.d.ts +0 -1
- package/dist/models/operations/addons.js +1 -1
- package/dist/models/operations/apps.d.ts +2 -5
- package/dist/models/operations/apps.js +1 -1
- package/dist/models/operations/billing.d.ts +0 -1
- package/dist/models/operations/billing.js +1 -1
- package/dist/models/operations/currencies.d.ts +0 -1
- package/dist/models/operations/currencies.js +1 -1
- package/dist/models/operations/customers.d.ts +3 -6
- package/dist/models/operations/customers.js +1 -1
- package/dist/models/operations/defaults.d.ts +0 -1
- package/dist/models/operations/defaults.js +1 -1
- package/dist/models/operations/entitlements.d.ts +0 -1
- package/dist/models/operations/entitlements.js +1 -1
- package/dist/models/operations/events.d.ts +0 -1
- package/dist/models/operations/events.js +1 -1
- package/dist/models/operations/features.d.ts +0 -1
- package/dist/models/operations/features.js +1 -1
- package/dist/models/operations/llmCost.d.ts +0 -1
- package/dist/models/operations/llmCost.js +1 -1
- package/dist/models/operations/meters.d.ts +0 -1
- package/dist/models/operations/meters.js +1 -1
- package/dist/models/operations/planAddons.d.ts +0 -1
- package/dist/models/operations/planAddons.js +1 -1
- package/dist/models/operations/plans.d.ts +0 -1
- package/dist/models/operations/plans.js +1 -1
- package/dist/models/operations/subscriptions.d.ts +0 -1
- package/dist/models/operations/subscriptions.js +1 -1
- package/dist/models/operations/tax.d.ts +0 -1
- package/dist/models/operations/tax.js +1 -1
- package/dist/models/schemas.d.ts +4453 -6950
- package/dist/models/schemas.js +1 -73
- package/dist/models/types.d.ts +381 -566
- package/dist/models/types.js +1 -1
- package/dist/sdk/addons.d.ts +60 -1
- package/dist/sdk/addons.js +63 -1
- package/dist/sdk/apps.d.ts +25 -1
- package/dist/sdk/apps.js +28 -1
- package/dist/sdk/billing.d.ts +57 -1
- package/dist/sdk/billing.js +60 -1
- package/dist/sdk/customers.d.ts +194 -1
- package/dist/sdk/customers.js +203 -1
- package/dist/sdk/defaults.d.ts +10 -1
- package/dist/sdk/defaults.js +11 -1
- package/dist/sdk/entitlements.d.ts +5 -1
- package/dist/sdk/entitlements.js +6 -1
- package/dist/sdk/events.d.ts +25 -1
- package/dist/sdk/events.js +28 -1
- package/dist/sdk/features.d.ts +53 -1
- package/dist/sdk/features.js +56 -1
- package/dist/sdk/internal.d.ts +89 -0
- package/dist/sdk/internal.js +113 -0
- package/dist/sdk/llmCost.d.ts +57 -1
- package/dist/sdk/llmCost.js +62 -1
- package/dist/sdk/meters.d.ts +64 -1
- package/dist/sdk/meters.js +67 -1
- package/dist/sdk/planAddons.d.ts +46 -1
- package/dist/sdk/planAddons.js +49 -1
- package/dist/sdk/plans.d.ts +60 -1
- package/dist/sdk/plans.js +63 -1
- package/dist/sdk/sdk.d.ts +9 -10
- package/dist/sdk/sdk.js +11 -15
- package/dist/sdk/subscriptions.d.ts +72 -3
- package/dist/sdk/subscriptions.js +77 -5
- package/dist/sdk/tax.d.ts +34 -1
- package/dist/sdk/tax.js +37 -1
- package/package.json +28 -4
- package/dist/funcs/governance.d.ts +0 -5
- package/dist/funcs/governance.js +0 -34
- package/dist/funcs/invoices.d.ts +0 -8
- package/dist/funcs/invoices.js +0 -81
- package/dist/models/operations/governance.d.ts +0 -10
- package/dist/models/operations/governance.js +0 -2
- package/dist/models/operations/invoices.d.ts +0 -48
- package/dist/models/operations/invoices.js +0 -2
- package/dist/sdk/currencies.d.ts +0 -12
- package/dist/sdk/currencies.js +0 -21
- package/dist/sdk/governance.d.ts +0 -9
- package/dist/sdk/governance.js +0 -12
- package/dist/sdk/invoices.d.ts +0 -12
- package/dist/sdk/invoices.js +0 -21
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { http } from '../core.js';
|
|
2
3
|
import { request } from '../lib/request.js';
|
|
3
4
|
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
4
5
|
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
5
6
|
import * as schemas from '../models/schemas.js';
|
|
7
|
+
/**
|
|
8
|
+
* Create subscription
|
|
9
|
+
*
|
|
10
|
+
* POST /openmeter/subscriptions
|
|
11
|
+
*/
|
|
6
12
|
export function createSubscription(client, req, options) {
|
|
7
13
|
return request(() => {
|
|
8
14
|
const body = toWire(req, schemas.createSubscriptionBody);
|
|
@@ -20,6 +26,11 @@ export function createSubscription(client, req, options) {
|
|
|
20
26
|
});
|
|
21
27
|
});
|
|
22
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* List subscriptions
|
|
31
|
+
*
|
|
32
|
+
* GET /openmeter/subscriptions
|
|
33
|
+
*/
|
|
23
34
|
export function listSubscriptions(client, req = {}, options) {
|
|
24
35
|
return request(() => {
|
|
25
36
|
const query = toWire({
|
|
@@ -42,6 +53,11 @@ export function listSubscriptions(client, req = {}, options) {
|
|
|
42
53
|
});
|
|
43
54
|
});
|
|
44
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Get subscription
|
|
58
|
+
*
|
|
59
|
+
* GET /openmeter/subscriptions/{subscriptionId}
|
|
60
|
+
*/
|
|
45
61
|
export function getSubscription(client, req, options) {
|
|
46
62
|
return request(() => {
|
|
47
63
|
const path = `openmeter/subscriptions/${(() => {
|
|
@@ -61,6 +77,14 @@ export function getSubscription(client, req, options) {
|
|
|
61
77
|
});
|
|
62
78
|
});
|
|
63
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Cancel subscription
|
|
82
|
+
*
|
|
83
|
+
* Cancels the subscription. Will result in a scheduling conflict if there are
|
|
84
|
+
* other subscriptions scheduled to start after the cancelation time.
|
|
85
|
+
*
|
|
86
|
+
* POST /openmeter/subscriptions/{subscriptionId}/cancel
|
|
87
|
+
*/
|
|
64
88
|
export function cancelSubscription(client, req, options) {
|
|
65
89
|
return request(() => {
|
|
66
90
|
const path = `openmeter/subscriptions/${(() => {
|
|
@@ -84,6 +108,13 @@ export function cancelSubscription(client, req, options) {
|
|
|
84
108
|
});
|
|
85
109
|
});
|
|
86
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Unschedule subscription cancelation
|
|
113
|
+
*
|
|
114
|
+
* Unschedules the subscription cancelation.
|
|
115
|
+
*
|
|
116
|
+
* POST /openmeter/subscriptions/{subscriptionId}/unschedule-cancelation
|
|
117
|
+
*/
|
|
87
118
|
export function unscheduleCancelation(client, req, options) {
|
|
88
119
|
return request(() => {
|
|
89
120
|
const path = `openmeter/subscriptions/${(() => {
|
|
@@ -103,6 +134,14 @@ export function unscheduleCancelation(client, req, options) {
|
|
|
103
134
|
});
|
|
104
135
|
});
|
|
105
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Change subscription
|
|
139
|
+
*
|
|
140
|
+
* Closes a running subscription and starts a new one according to the
|
|
141
|
+
* specification. Can be used for upgrades, downgrades, and plan changes.
|
|
142
|
+
*
|
|
143
|
+
* POST /openmeter/subscriptions/{subscriptionId}/change
|
|
144
|
+
*/
|
|
106
145
|
export function changeSubscription(client, req, options) {
|
|
107
146
|
return request(() => {
|
|
108
147
|
const path = `openmeter/subscriptions/${(() => {
|
|
@@ -126,6 +165,13 @@ export function changeSubscription(client, req, options) {
|
|
|
126
165
|
});
|
|
127
166
|
});
|
|
128
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Create a new subscription add-on
|
|
170
|
+
*
|
|
171
|
+
* Add add-on to a subscription.
|
|
172
|
+
*
|
|
173
|
+
* POST /openmeter/subscriptions/{subscriptionId}/addons
|
|
174
|
+
*/
|
|
129
175
|
export function createSubscriptionAddon(client, req, options) {
|
|
130
176
|
return request(() => {
|
|
131
177
|
const path = `openmeter/subscriptions/${(() => {
|
|
@@ -149,6 +195,13 @@ export function createSubscriptionAddon(client, req, options) {
|
|
|
149
195
|
});
|
|
150
196
|
});
|
|
151
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* List subscription addons
|
|
200
|
+
*
|
|
201
|
+
* List the add-ons of a subscription.
|
|
202
|
+
*
|
|
203
|
+
* GET /openmeter/subscriptions/{subscriptionId}/addons
|
|
204
|
+
*/
|
|
152
205
|
export function listSubscriptionAddons(client, req, options) {
|
|
153
206
|
return request(() => {
|
|
154
207
|
const path = `openmeter/subscriptions/${(() => {
|
|
@@ -176,6 +229,13 @@ export function listSubscriptionAddons(client, req, options) {
|
|
|
176
229
|
});
|
|
177
230
|
});
|
|
178
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Get add-on association for subscription
|
|
234
|
+
*
|
|
235
|
+
* Get an add-on association for a subscription.
|
|
236
|
+
*
|
|
237
|
+
* GET /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}
|
|
238
|
+
*/
|
|
179
239
|
export function getSubscriptionAddon(client, req, options) {
|
|
180
240
|
return request(() => {
|
|
181
241
|
const path = `openmeter/subscriptions/${(() => {
|
|
@@ -200,4 +260,3 @@ export function getSubscriptionAddon(client, req, options) {
|
|
|
200
260
|
});
|
|
201
261
|
});
|
|
202
262
|
}
|
|
203
|
-
//# sourceMappingURL=subscriptions.js.map
|
package/dist/funcs/tax.d.ts
CHANGED
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
3
|
import type { CreateTaxCodeRequest, CreateTaxCodeResponse, GetTaxCodeRequest, GetTaxCodeResponse, ListTaxCodesRequest, ListTaxCodesResponse, UpsertTaxCodeRequest, UpsertTaxCodeResponse, DeleteTaxCodeRequest, DeleteTaxCodeResponse } from '../models/operations/tax.js';
|
|
4
|
+
/**
|
|
5
|
+
* Create tax code
|
|
6
|
+
*
|
|
7
|
+
* POST /openmeter/tax-codes
|
|
8
|
+
*/
|
|
4
9
|
export declare function createTaxCode(client: Client, req: CreateTaxCodeRequest, options?: RequestOptions): Promise<Result<CreateTaxCodeResponse>>;
|
|
10
|
+
/**
|
|
11
|
+
* Get tax code
|
|
12
|
+
*
|
|
13
|
+
* GET /openmeter/tax-codes/{taxCodeId}
|
|
14
|
+
*/
|
|
5
15
|
export declare function getTaxCode(client: Client, req: GetTaxCodeRequest, options?: RequestOptions): Promise<Result<GetTaxCodeResponse>>;
|
|
16
|
+
/**
|
|
17
|
+
* List tax codes
|
|
18
|
+
*
|
|
19
|
+
* GET /openmeter/tax-codes
|
|
20
|
+
*/
|
|
6
21
|
export declare function listTaxCodes(client: Client, req?: ListTaxCodesRequest, options?: RequestOptions): Promise<Result<ListTaxCodesResponse>>;
|
|
22
|
+
/**
|
|
23
|
+
* Upsert tax code
|
|
24
|
+
*
|
|
25
|
+
* PUT /openmeter/tax-codes/{taxCodeId}
|
|
26
|
+
*/
|
|
7
27
|
export declare function upsertTaxCode(client: Client, req: UpsertTaxCodeRequest, options?: RequestOptions): Promise<Result<UpsertTaxCodeResponse>>;
|
|
28
|
+
/**
|
|
29
|
+
* Delete tax code
|
|
30
|
+
*
|
|
31
|
+
* DELETE /openmeter/tax-codes/{taxCodeId}
|
|
32
|
+
*/
|
|
8
33
|
export declare function deleteTaxCode(client: Client, req: DeleteTaxCodeRequest, options?: RequestOptions): Promise<Result<DeleteTaxCodeResponse>>;
|
|
9
|
-
//# sourceMappingURL=tax.d.ts.map
|
package/dist/funcs/tax.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { http } from '../core.js';
|
|
2
3
|
import { request } from '../lib/request.js';
|
|
3
4
|
import { toURLSearchParams } from '../lib/encodings.js';
|
|
4
5
|
import { toWire, fromWire, assertValid } from '../lib/wire.js';
|
|
5
6
|
import * as schemas from '../models/schemas.js';
|
|
7
|
+
/**
|
|
8
|
+
* Create tax code
|
|
9
|
+
*
|
|
10
|
+
* POST /openmeter/tax-codes
|
|
11
|
+
*/
|
|
6
12
|
export function createTaxCode(client, req, options) {
|
|
7
13
|
return request(() => {
|
|
8
14
|
const body = toWire(req, schemas.createTaxCodeBody);
|
|
@@ -20,6 +26,11 @@ export function createTaxCode(client, req, options) {
|
|
|
20
26
|
});
|
|
21
27
|
});
|
|
22
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Get tax code
|
|
31
|
+
*
|
|
32
|
+
* GET /openmeter/tax-codes/{taxCodeId}
|
|
33
|
+
*/
|
|
23
34
|
export function getTaxCode(client, req, options) {
|
|
24
35
|
return request(() => {
|
|
25
36
|
const path = `openmeter/tax-codes/${(() => {
|
|
@@ -39,6 +50,11 @@ export function getTaxCode(client, req, options) {
|
|
|
39
50
|
});
|
|
40
51
|
});
|
|
41
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* List tax codes
|
|
55
|
+
*
|
|
56
|
+
* GET /openmeter/tax-codes
|
|
57
|
+
*/
|
|
42
58
|
export function listTaxCodes(client, req = {}, options) {
|
|
43
59
|
return request(() => {
|
|
44
60
|
const query = toWire({
|
|
@@ -60,6 +76,11 @@ export function listTaxCodes(client, req = {}, options) {
|
|
|
60
76
|
});
|
|
61
77
|
});
|
|
62
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Upsert tax code
|
|
81
|
+
*
|
|
82
|
+
* PUT /openmeter/tax-codes/{taxCodeId}
|
|
83
|
+
*/
|
|
63
84
|
export function upsertTaxCode(client, req, options) {
|
|
64
85
|
return request(() => {
|
|
65
86
|
const path = `openmeter/tax-codes/${(() => {
|
|
@@ -83,6 +104,11 @@ export function upsertTaxCode(client, req, options) {
|
|
|
83
104
|
});
|
|
84
105
|
});
|
|
85
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Delete tax code
|
|
109
|
+
*
|
|
110
|
+
* DELETE /openmeter/tax-codes/{taxCodeId}
|
|
111
|
+
*/
|
|
86
112
|
export function deleteTaxCode(client, req, options) {
|
|
87
113
|
return request(async () => {
|
|
88
114
|
const path = `openmeter/tax-codes/${(() => {
|
|
@@ -94,4 +120,3 @@ export function deleteTaxCode(client, req, options) {
|
|
|
94
120
|
await http(client).delete(path, options);
|
|
95
121
|
});
|
|
96
122
|
}
|
|
97
|
-
//# sourceMappingURL=tax.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -6,22 +6,21 @@ 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';
|
|
10
9
|
export { Tax } from './sdk/tax.js';
|
|
11
|
-
export { Currencies } from './sdk/currencies.js';
|
|
12
10
|
export { Features } from './sdk/features.js';
|
|
13
11
|
export { LLMCost } from './sdk/llmCost.js';
|
|
14
12
|
export { Plans } from './sdk/plans.js';
|
|
15
13
|
export { Addons } from './sdk/addons.js';
|
|
16
14
|
export { PlanAddons } from './sdk/planAddons.js';
|
|
17
15
|
export { Defaults } from './sdk/defaults.js';
|
|
18
|
-
export { Governance } from './sdk/governance.js';
|
|
19
16
|
export { Client } from './core.js';
|
|
20
17
|
export { HTTPError } from './models/errors.js';
|
|
21
|
-
export { ValidationError, DepthLimitExceededError } from './lib/wire.js';
|
|
18
|
+
export { ValidationError, DepthLimitExceededError, UnsafeIntegerError, } from './lib/wire.js';
|
|
22
19
|
export type { AcceptDateStrings, DateString } from './lib/wire.js';
|
|
20
|
+
export { PaginationLimitExceededError } from './lib/paginate.js';
|
|
23
21
|
export { ServerList, Regions } from './lib/config.js';
|
|
24
22
|
export type { SDKOptions, Region, ServerVariables } from './lib/config.js';
|
|
23
|
+
export { unwrap, ok, err } from './lib/types.js';
|
|
25
24
|
export type { Result, RequestOptions } from './lib/types.js';
|
|
26
25
|
export { encodePath, encodeSort, querySerializer, toURLSearchParams, } from './lib/encodings.js';
|
|
27
26
|
export * as funcs from './funcs/index.js';
|
|
@@ -32,7 +31,6 @@ export type * from './models/operations/entitlements.js';
|
|
|
32
31
|
export type * from './models/operations/subscriptions.js';
|
|
33
32
|
export type * from './models/operations/apps.js';
|
|
34
33
|
export type * from './models/operations/billing.js';
|
|
35
|
-
export type * from './models/operations/invoices.js';
|
|
36
34
|
export type * from './models/operations/tax.js';
|
|
37
35
|
export type * from './models/operations/currencies.js';
|
|
38
36
|
export type * from './models/operations/features.js';
|
|
@@ -41,6 +39,4 @@ export type * from './models/operations/plans.js';
|
|
|
41
39
|
export type * from './models/operations/addons.js';
|
|
42
40
|
export type * from './models/operations/planAddons.js';
|
|
43
41
|
export type * from './models/operations/defaults.js';
|
|
44
|
-
export type
|
|
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';
|
|
46
|
-
//# sourceMappingURL=index.d.ts.map
|
|
42
|
+
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, 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, 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, AppCatalogItem, TaxCodeAppMapping, PartyTaxIdentity, UpdateBillingPartyTaxIdentity, WorkflowInvoicingSettings, InvoiceValidationIssue, InvoiceAvailableActions, InvoiceLineAmountDiscount, InvoiceLineUsageDiscount, InvoiceLineBaseDiscount, ListCurrenciesParamsFilter, CurrencyCustom, CreateCurrencyCustomRequest, 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, FeatureCostQueryResult, MeterPagePaginatedResponse, CostBasisPagePaginatedResponse, MeterQueryFilters, FeatureMeterReference, Customer, PartyAddresses, InvoiceCustomer, UpdateBillingPartyAddresses, UpdateInvoiceCustomer, AppStripeCreateCheckoutSessionConsentCollection, ListCustomerEntitlementAccessResponseData, WorkflowCollectionAlignmentAnchored, ChargeFlatFeeSystemIntent, SubscriptionPagePaginatedResponse, SubscriptionChangeResponse, SubscriptionCancel, SubscriptionChange, InvoiceUsageQuantityDetail, AppStripe, AppSandbox, AppExternalInvoicing, TaxCode, 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, InvoiceWorkflowSettings, InvoiceDetailedLine, UpdateInvoiceWorkflowSettings, CurrencyPagePaginatedResponse, GovernanceQueryResult, Feature, CreditGrantPagePaginatedResponse, BadRequest, InvoiceBase, CustomerStripeCreateCheckoutSessionRequest, WorkflowCollectionSettings, AppPagePaginatedResponse, ProfileApps, GovernanceQueryResponse, ChargeFlatFee, ChargeUsageBasedSystemIntent, CreateChargeUsageBasedRequest, RateCard, InvoiceLineRateCard, UpdateInvoiceLineRateCard, FeaturePagePaginatedResponse, Workflow, 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, InvalidParameter, RateCardEntitlement, Currency, FeatureUnitCost, WorkflowCollectionAlignment, App, Price, CreateChargeRequest, Charge, 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, WorkflowPaymentSettingsInput, RateCardEntitlementInput, } from './models/types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
export { OpenMeter } from './sdk/sdk.js';
|
|
2
3
|
export { Events } from './sdk/events.js';
|
|
3
4
|
export { Meters } from './sdk/meters.js';
|
|
@@ -6,20 +7,18 @@ export { Entitlements } from './sdk/entitlements.js';
|
|
|
6
7
|
export { Subscriptions } from './sdk/subscriptions.js';
|
|
7
8
|
export { Apps } from './sdk/apps.js';
|
|
8
9
|
export { Billing } from './sdk/billing.js';
|
|
9
|
-
export { Invoices } from './sdk/invoices.js';
|
|
10
10
|
export { Tax } from './sdk/tax.js';
|
|
11
|
-
export { Currencies } from './sdk/currencies.js';
|
|
12
11
|
export { Features } from './sdk/features.js';
|
|
13
12
|
export { LLMCost } from './sdk/llmCost.js';
|
|
14
13
|
export { Plans } from './sdk/plans.js';
|
|
15
14
|
export { Addons } from './sdk/addons.js';
|
|
16
15
|
export { PlanAddons } from './sdk/planAddons.js';
|
|
17
16
|
export { Defaults } from './sdk/defaults.js';
|
|
18
|
-
export { Governance } from './sdk/governance.js';
|
|
19
17
|
export { Client } from './core.js';
|
|
20
18
|
export { HTTPError } from './models/errors.js';
|
|
21
|
-
export { ValidationError, DepthLimitExceededError } from './lib/wire.js';
|
|
19
|
+
export { ValidationError, DepthLimitExceededError, UnsafeIntegerError, } from './lib/wire.js';
|
|
20
|
+
export { PaginationLimitExceededError } from './lib/paginate.js';
|
|
22
21
|
export { ServerList, Regions } from './lib/config.js';
|
|
22
|
+
export { unwrap, ok, err } from './lib/types.js';
|
|
23
23
|
export { encodePath, encodeSort, querySerializer, toURLSearchParams, } from './lib/encodings.js';
|
|
24
24
|
export * as funcs from './funcs/index.js';
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
package/dist/lib/config.d.ts
CHANGED
package/dist/lib/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
export const ServerList = [
|
|
2
3
|
'https://{region}.api.konghq.com/v3',
|
|
3
4
|
'http://localhost:{port}/api/v3',
|
|
4
5
|
'https://openmeter.cloud/api/v3',
|
|
5
6
|
];
|
|
6
7
|
export const Regions = ['in', 'me', 'au', 'eu', 'us'];
|
|
7
|
-
//# sourceMappingURL=config.js.map
|
package/dist/lib/encodings.d.ts
CHANGED
package/dist/lib/encodings.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
export function encodePath(template, params) {
|
|
2
3
|
return template.replace(/\{(\w+)\}/g, (_, key) => {
|
|
3
4
|
const value = params[key];
|
|
@@ -54,4 +55,3 @@ export function encodeSort(sort, encodeField = (field) => field) {
|
|
|
54
55
|
}
|
|
55
56
|
return by;
|
|
56
57
|
}
|
|
57
|
-
//# sourceMappingURL=encodings.js.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type RequestOptions, type Result } from './types.js';
|
|
2
|
+
export declare class PaginationLimitExceededError extends Error {
|
|
3
|
+
constructor(limit: number);
|
|
4
|
+
}
|
|
5
|
+
interface PageNumberEnvelope<TItem> {
|
|
6
|
+
data: TItem[];
|
|
7
|
+
meta: {
|
|
8
|
+
page: {
|
|
9
|
+
number: number;
|
|
10
|
+
size: number;
|
|
11
|
+
total: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
interface PageNumberRequest {
|
|
16
|
+
page?: {
|
|
17
|
+
number?: number;
|
|
18
|
+
size?: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Iterates every item of a page-number-paginated list operation, advancing
|
|
23
|
+
* `page.number` from wherever the caller's own request starts. Every other
|
|
24
|
+
* field on `request` — filters, sort, page.size — is sent unchanged on every
|
|
25
|
+
* page fetch; only the page number advances. Stops on a page shorter than
|
|
26
|
+
* the server's own reported `size` (including an empty page) or once the
|
|
27
|
+
* running item count reaches the server's reported `total`, whichever comes
|
|
28
|
+
* first — so a final page that exactly fills `total` does not trigger one
|
|
29
|
+
* more, empty request.
|
|
30
|
+
*/
|
|
31
|
+
export declare function paginatePages<TItem, TReq extends PageNumberRequest>(fetchPage: (req: TReq, options?: RequestOptions) => Promise<Result<PageNumberEnvelope<TItem>>>, request: TReq, options?: RequestOptions): AsyncGenerator<TItem, void, undefined>;
|
|
32
|
+
interface CursorEnvelope<TItem> {
|
|
33
|
+
data: TItem[];
|
|
34
|
+
meta: {
|
|
35
|
+
page: {
|
|
36
|
+
next?: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
interface CursorRequest {
|
|
41
|
+
page?: {
|
|
42
|
+
after?: string;
|
|
43
|
+
before?: string;
|
|
44
|
+
size?: number;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Iterates every item of a cursor-paginated list operation, following
|
|
49
|
+
* `meta.page.next` until the server stops returning one. Despite carrying a
|
|
50
|
+
* `format: uri` annotation in the spec, `next` is the opaque cursor token the
|
|
51
|
+
* API expects back verbatim in `page.after` on the following request — not a
|
|
52
|
+
* URI to fetch directly. Every other field on `request` is sent unchanged on
|
|
53
|
+
* every page fetch; only `page.after` advances.
|
|
54
|
+
*/
|
|
55
|
+
export declare function paginateCursor<TItem, TReq extends CursorRequest>(fetchPage: (req: TReq, options?: RequestOptions) => Promise<Result<CursorEnvelope<TItem>>>, request: TReq, options?: RequestOptions): AsyncGenerator<TItem, void, undefined>;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
|
+
import { unwrap } from './types.js';
|
|
3
|
+
// A misbehaving server — inconsistent `meta.page.total`/`size`, or a
|
|
4
|
+
// `meta.page.next` cursor that never resolves to an empty page — would
|
|
5
|
+
// otherwise make these generators loop forever. 10,000 pages is far beyond
|
|
6
|
+
// any real OpenMeter list, so hitting it means the server's pagination
|
|
7
|
+
// contract broke, not that the caller has a legitimately large list.
|
|
8
|
+
const MAX_PAGINATION_PAGES = 10_000;
|
|
9
|
+
export class PaginationLimitExceededError extends Error {
|
|
10
|
+
constructor(limit) {
|
|
11
|
+
super(`pagination exceeded the maximum of ${limit} pages; the server may be returning inconsistent pagination metadata`);
|
|
12
|
+
this.name = 'PaginationLimitExceededError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Iterates every item of a page-number-paginated list operation, advancing
|
|
17
|
+
* `page.number` from wherever the caller's own request starts. Every other
|
|
18
|
+
* field on `request` — filters, sort, page.size — is sent unchanged on every
|
|
19
|
+
* page fetch; only the page number advances. Stops on a page shorter than
|
|
20
|
+
* the server's own reported `size` (including an empty page) or once the
|
|
21
|
+
* running item count reaches the server's reported `total`, whichever comes
|
|
22
|
+
* first — so a final page that exactly fills `total` does not trigger one
|
|
23
|
+
* more, empty request.
|
|
24
|
+
*/
|
|
25
|
+
export async function* paginatePages(fetchPage, request, options) {
|
|
26
|
+
let req = request;
|
|
27
|
+
let seen = 0;
|
|
28
|
+
for (let page = 0; page < MAX_PAGINATION_PAGES; page++) {
|
|
29
|
+
const res = unwrap(await fetchPage(req, options));
|
|
30
|
+
yield* res.data;
|
|
31
|
+
seen += res.data.length;
|
|
32
|
+
const { number, size, total } = res.meta.page;
|
|
33
|
+
if (res.data.length === 0 || res.data.length < size || seen >= total) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
req = { ...req, page: { ...req.page, number: number + 1 } };
|
|
37
|
+
}
|
|
38
|
+
throw new PaginationLimitExceededError(MAX_PAGINATION_PAGES);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Iterates every item of a cursor-paginated list operation, following
|
|
42
|
+
* `meta.page.next` until the server stops returning one. Despite carrying a
|
|
43
|
+
* `format: uri` annotation in the spec, `next` is the opaque cursor token the
|
|
44
|
+
* API expects back verbatim in `page.after` on the following request — not a
|
|
45
|
+
* URI to fetch directly. Every other field on `request` is sent unchanged on
|
|
46
|
+
* every page fetch; only `page.after` advances.
|
|
47
|
+
*/
|
|
48
|
+
export async function* paginateCursor(fetchPage, request, options) {
|
|
49
|
+
let req = request;
|
|
50
|
+
for (let page = 0; page < MAX_PAGINATION_PAGES; page++) {
|
|
51
|
+
const res = unwrap(await fetchPage(req, options));
|
|
52
|
+
yield* res.data;
|
|
53
|
+
const next = res.meta.page.next;
|
|
54
|
+
if (!next) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
req = { ...req, page: { ...req.page, after: next } };
|
|
58
|
+
}
|
|
59
|
+
throw new PaginationLimitExceededError(MAX_PAGINATION_PAGES);
|
|
60
|
+
}
|
package/dist/lib/request.d.ts
CHANGED
package/dist/lib/request.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { ok, err } from './types.js';
|
|
2
3
|
import { toError } from './to-error.js';
|
|
3
4
|
export async function request(fn) {
|
|
@@ -8,4 +9,3 @@ export async function request(fn) {
|
|
|
8
9
|
return err(await toError(e));
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
|
-
//# sourceMappingURL=request.js.map
|
package/dist/lib/to-error.d.ts
CHANGED
package/dist/lib/to-error.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { HTTPError as KyHTTPError } from 'ky';
|
|
2
3
|
import * as schemas from '../models/schemas.js';
|
|
3
4
|
import { HTTPError } from '../models/errors.js';
|
|
@@ -13,4 +14,3 @@ export async function toError(e) {
|
|
|
13
14
|
}
|
|
14
15
|
return new Error(String(e));
|
|
15
16
|
}
|
|
16
|
-
//# sourceMappingURL=to-error.js.map
|
package/dist/lib/types.d.ts
CHANGED
package/dist/lib/types.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SDK_VERSION = "1.0.0-beta-e7a04be10ed8";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
|
+
// The committed value is a dev placeholder. The publish flow
|
|
3
|
+
// (`make -C api/spec publish-aip-sdk`) stamps the real release version here
|
|
4
|
+
// before `pnpm publish`, after `pnpm version` updates package.json.
|
|
5
|
+
export const SDK_VERSION = '1.0.0-beta-e7a04be10ed8';
|
package/dist/lib/wire.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { output, ZodType } from 'zod';
|
|
2
2
|
export declare function toCamelCase(name: string): string;
|
|
3
3
|
export declare function toSnakeCase(name: string): string;
|
|
4
|
+
export declare class UnsafeIntegerError extends Error {
|
|
5
|
+
constructor(value: bigint);
|
|
6
|
+
}
|
|
4
7
|
export type DateString = string & Record<never, never>;
|
|
5
8
|
export type AcceptDateStrings<T> = T extends Date ? Date | DateString : T extends (infer E)[] ? AcceptDateStrings<E>[] : T extends object ? {
|
|
6
9
|
[K in keyof T]: AcceptDateStrings<T[K]>;
|
|
@@ -15,4 +18,3 @@ export declare class ValidationError extends Error {
|
|
|
15
18
|
constructor(message: string, issues: unknown);
|
|
16
19
|
}
|
|
17
20
|
export declare function assertValid(schema: ZodType, data: unknown): void;
|
|
18
|
-
//# sourceMappingURL=wire.d.ts.map
|