@openmeter/client 1.0.0-beta.229 → 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 +49 -30
- package/dist/funcs/addons.js +111 -28
- package/dist/funcs/apps.js +37 -8
- package/dist/funcs/billing.js +79 -16
- package/dist/funcs/currencies.js +82 -22
- package/dist/funcs/customers.d.ts +3 -1
- package/dist/funcs/customers.js +390 -91
- 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 +99 -27
- package/dist/funcs/governance.js +27 -9
- 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 +77 -23
- package/dist/funcs/meters.d.ts +2 -1
- package/dist/funcs/meters.js +118 -27
- package/dist/funcs/planAddons.js +103 -28
- package/dist/funcs/plans.js +113 -24
- package/dist/funcs/subscriptions.d.ts +2 -1
- package/dist/funcs/subscriptions.js +178 -39
- package/dist/funcs/tax.js +78 -21
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2 -0
- package/dist/lib/config.d.ts +9 -0
- 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 +83 -32
- 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 +27210 -3012
- package/dist/models/schemas.js +6212 -492
- package/dist/models/types.d.ts +4240 -977
- package/dist/sdk/customers.d.ts +3 -1
- package/dist/sdk/customers.js +7 -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
|
@@ -1,64 +1,203 @@
|
|
|
1
1
|
import { http } from '../core.js';
|
|
2
2
|
import { request } from '../lib/request.js';
|
|
3
|
-
import {
|
|
3
|
+
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
4
|
+
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
5
|
+
import * as schemas from '../models/schemas.js';
|
|
4
6
|
export function createSubscription(client, req, options) {
|
|
5
|
-
return request(() =>
|
|
6
|
-
|
|
7
|
-
.
|
|
7
|
+
return request(() => {
|
|
8
|
+
const body = toWire(req, schemas.createSubscriptionBody);
|
|
9
|
+
if (client._options.validate) {
|
|
10
|
+
assertValid(schemas.createSubscriptionBodyWire, body);
|
|
11
|
+
}
|
|
12
|
+
return http(client)
|
|
13
|
+
.post('openmeter/subscriptions', { ...options, json: body })
|
|
14
|
+
.json()
|
|
15
|
+
.then((data) => {
|
|
16
|
+
if (client._options.validate) {
|
|
17
|
+
assertValid(schemas.createSubscriptionResponseWire, data);
|
|
18
|
+
}
|
|
19
|
+
return fromWire(data, schemas.createSubscriptionResponse);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
8
22
|
}
|
|
9
23
|
export function listSubscriptions(client, req = {}, options) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
24
|
+
return request(() => {
|
|
25
|
+
const query = toWire({
|
|
26
|
+
page: req.page,
|
|
27
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
28
|
+
filter: req.filter,
|
|
29
|
+
}, schemas.listSubscriptionsQueryParams);
|
|
30
|
+
if (client._options.validate) {
|
|
31
|
+
assertValid(schemas.listSubscriptionsQueryParamsWire, query);
|
|
32
|
+
}
|
|
33
|
+
const searchParams = toURLSearchParams(query);
|
|
34
|
+
return http(client)
|
|
35
|
+
.get('openmeter/subscriptions', { ...options, searchParams })
|
|
36
|
+
.json()
|
|
37
|
+
.then((data) => {
|
|
38
|
+
if (client._options.validate) {
|
|
39
|
+
assertValid(schemas.listSubscriptionsResponseWire, data);
|
|
40
|
+
}
|
|
41
|
+
return fromWire(data, schemas.listSubscriptionsResponse);
|
|
42
|
+
});
|
|
14
43
|
});
|
|
15
|
-
return request(() => http(client)
|
|
16
|
-
.get('openmeter/subscriptions', { ...options, searchParams })
|
|
17
|
-
.json());
|
|
18
44
|
}
|
|
19
45
|
export function getSubscription(client, req, options) {
|
|
20
|
-
|
|
21
|
-
|
|
46
|
+
return request(() => {
|
|
47
|
+
const path = `openmeter/subscriptions/${(() => {
|
|
48
|
+
if (req.subscriptionId === undefined) {
|
|
49
|
+
throw new Error('missing path parameter: subscriptionId');
|
|
50
|
+
}
|
|
51
|
+
return encodeURIComponent(String(req.subscriptionId));
|
|
52
|
+
})()}`;
|
|
53
|
+
return http(client)
|
|
54
|
+
.get(path, options)
|
|
55
|
+
.json()
|
|
56
|
+
.then((data) => {
|
|
57
|
+
if (client._options.validate) {
|
|
58
|
+
assertValid(schemas.getSubscriptionResponseWire, data);
|
|
59
|
+
}
|
|
60
|
+
return fromWire(data, schemas.getSubscriptionResponse);
|
|
61
|
+
});
|
|
22
62
|
});
|
|
23
|
-
return request(() => http(client).get(path, options).json());
|
|
24
63
|
}
|
|
25
64
|
export function cancelSubscription(client, req, options) {
|
|
26
|
-
|
|
27
|
-
|
|
65
|
+
return request(() => {
|
|
66
|
+
const path = `openmeter/subscriptions/${(() => {
|
|
67
|
+
if (req.subscriptionId === undefined) {
|
|
68
|
+
throw new Error('missing path parameter: subscriptionId');
|
|
69
|
+
}
|
|
70
|
+
return encodeURIComponent(String(req.subscriptionId));
|
|
71
|
+
})()}/cancel`;
|
|
72
|
+
const body = toWire(req.body, schemas.cancelSubscriptionBody);
|
|
73
|
+
if (client._options.validate) {
|
|
74
|
+
assertValid(schemas.cancelSubscriptionBodyWire, body);
|
|
75
|
+
}
|
|
76
|
+
return http(client)
|
|
77
|
+
.post(path, { ...options, json: body })
|
|
78
|
+
.json()
|
|
79
|
+
.then((data) => {
|
|
80
|
+
if (client._options.validate) {
|
|
81
|
+
assertValid(schemas.cancelSubscriptionResponseWire, data);
|
|
82
|
+
}
|
|
83
|
+
return fromWire(data, schemas.cancelSubscriptionResponse);
|
|
84
|
+
});
|
|
28
85
|
});
|
|
29
|
-
return request(() => http(client)
|
|
30
|
-
.post(path, { ...options, json: req.body })
|
|
31
|
-
.json());
|
|
32
86
|
}
|
|
33
87
|
export function unscheduleCancelation(client, req, options) {
|
|
34
|
-
|
|
35
|
-
|
|
88
|
+
return request(() => {
|
|
89
|
+
const path = `openmeter/subscriptions/${(() => {
|
|
90
|
+
if (req.subscriptionId === undefined) {
|
|
91
|
+
throw new Error('missing path parameter: subscriptionId');
|
|
92
|
+
}
|
|
93
|
+
return encodeURIComponent(String(req.subscriptionId));
|
|
94
|
+
})()}/unschedule-cancelation`;
|
|
95
|
+
return http(client)
|
|
96
|
+
.post(path, options)
|
|
97
|
+
.json()
|
|
98
|
+
.then((data) => {
|
|
99
|
+
if (client._options.validate) {
|
|
100
|
+
assertValid(schemas.unscheduleCancelationResponseWire, data);
|
|
101
|
+
}
|
|
102
|
+
return fromWire(data, schemas.unscheduleCancelationResponse);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
36
105
|
}
|
|
37
106
|
export function changeSubscription(client, req, options) {
|
|
38
|
-
|
|
39
|
-
|
|
107
|
+
return request(() => {
|
|
108
|
+
const path = `openmeter/subscriptions/${(() => {
|
|
109
|
+
if (req.subscriptionId === undefined) {
|
|
110
|
+
throw new Error('missing path parameter: subscriptionId');
|
|
111
|
+
}
|
|
112
|
+
return encodeURIComponent(String(req.subscriptionId));
|
|
113
|
+
})()}/change`;
|
|
114
|
+
const body = toWire(req.body, schemas.changeSubscriptionBody);
|
|
115
|
+
if (client._options.validate) {
|
|
116
|
+
assertValid(schemas.changeSubscriptionBodyWire, body);
|
|
117
|
+
}
|
|
118
|
+
return http(client)
|
|
119
|
+
.post(path, { ...options, json: body })
|
|
120
|
+
.json()
|
|
121
|
+
.then((data) => {
|
|
122
|
+
if (client._options.validate) {
|
|
123
|
+
assertValid(schemas.changeSubscriptionResponseWire, data);
|
|
124
|
+
}
|
|
125
|
+
return fromWire(data, schemas.changeSubscriptionResponse);
|
|
126
|
+
});
|
|
40
127
|
});
|
|
41
|
-
return request(() => http(client)
|
|
42
|
-
.post(path, { ...options, json: req.body })
|
|
43
|
-
.json());
|
|
44
128
|
}
|
|
45
|
-
export function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
129
|
+
export function createSubscriptionAddon(client, req, options) {
|
|
130
|
+
return request(() => {
|
|
131
|
+
const path = `openmeter/subscriptions/${(() => {
|
|
132
|
+
if (req.subscriptionId === undefined) {
|
|
133
|
+
throw new Error('missing path parameter: subscriptionId');
|
|
134
|
+
}
|
|
135
|
+
return encodeURIComponent(String(req.subscriptionId));
|
|
136
|
+
})()}/addons`;
|
|
137
|
+
const body = toWire(req.body, schemas.createSubscriptionAddonBody);
|
|
138
|
+
if (client._options.validate) {
|
|
139
|
+
assertValid(schemas.createSubscriptionAddonBodyWire, body);
|
|
140
|
+
}
|
|
141
|
+
return http(client)
|
|
142
|
+
.post(path, { ...options, json: body })
|
|
143
|
+
.json()
|
|
144
|
+
.then((data) => {
|
|
145
|
+
if (client._options.validate) {
|
|
146
|
+
assertValid(schemas.createSubscriptionAddonResponseWire, data);
|
|
147
|
+
}
|
|
148
|
+
return fromWire(data, schemas.createSubscriptionAddonResponse);
|
|
149
|
+
});
|
|
49
150
|
});
|
|
50
|
-
|
|
51
|
-
|
|
151
|
+
}
|
|
152
|
+
export function listSubscriptionAddons(client, req, options) {
|
|
153
|
+
return request(() => {
|
|
154
|
+
const path = `openmeter/subscriptions/${(() => {
|
|
155
|
+
if (req.subscriptionId === undefined) {
|
|
156
|
+
throw new Error('missing path parameter: subscriptionId');
|
|
157
|
+
}
|
|
158
|
+
return encodeURIComponent(String(req.subscriptionId));
|
|
159
|
+
})()}/addons`;
|
|
160
|
+
const query = toWire({
|
|
161
|
+
page: req.page,
|
|
162
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
163
|
+
}, schemas.listSubscriptionAddonsQueryParams);
|
|
164
|
+
if (client._options.validate) {
|
|
165
|
+
assertValid(schemas.listSubscriptionAddonsQueryParamsWire, query);
|
|
166
|
+
}
|
|
167
|
+
const searchParams = toURLSearchParams(query);
|
|
168
|
+
return http(client)
|
|
169
|
+
.get(path, { ...options, searchParams })
|
|
170
|
+
.json()
|
|
171
|
+
.then((data) => {
|
|
172
|
+
if (client._options.validate) {
|
|
173
|
+
assertValid(schemas.listSubscriptionAddonsResponseWire, data);
|
|
174
|
+
}
|
|
175
|
+
return fromWire(data, schemas.listSubscriptionAddonsResponse);
|
|
176
|
+
});
|
|
52
177
|
});
|
|
53
|
-
return request(() => http(client)
|
|
54
|
-
.get(path, { ...options, searchParams })
|
|
55
|
-
.json());
|
|
56
178
|
}
|
|
57
179
|
export function getSubscriptionAddon(client, req, options) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
180
|
+
return request(() => {
|
|
181
|
+
const path = `openmeter/subscriptions/${(() => {
|
|
182
|
+
if (req.subscriptionId === undefined) {
|
|
183
|
+
throw new Error('missing path parameter: subscriptionId');
|
|
184
|
+
}
|
|
185
|
+
return encodeURIComponent(String(req.subscriptionId));
|
|
186
|
+
})()}/addons/${(() => {
|
|
187
|
+
if (req.subscriptionAddonId === undefined) {
|
|
188
|
+
throw new Error('missing path parameter: subscriptionAddonId');
|
|
189
|
+
}
|
|
190
|
+
return encodeURIComponent(String(req.subscriptionAddonId));
|
|
191
|
+
})()}`;
|
|
192
|
+
return http(client)
|
|
193
|
+
.get(path, options)
|
|
194
|
+
.json()
|
|
195
|
+
.then((data) => {
|
|
196
|
+
if (client._options.validate) {
|
|
197
|
+
assertValid(schemas.getSubscriptionAddonResponseWire, data);
|
|
198
|
+
}
|
|
199
|
+
return fromWire(data, schemas.getSubscriptionAddonResponse);
|
|
200
|
+
});
|
|
61
201
|
});
|
|
62
|
-
return request(() => http(client).get(path, options).json());
|
|
63
202
|
}
|
|
64
203
|
//# sourceMappingURL=subscriptions.js.map
|
package/dist/funcs/tax.js
CHANGED
|
@@ -1,39 +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
|
-
|
|
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
|
+
});
|
|
12
40
|
});
|
|
13
|
-
return request(() => http(client).get(path, options).json());
|
|
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
|
-
|
|
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
|
+
});
|
|
27
84
|
});
|
|
28
|
-
return request(() => http(client)
|
|
29
|
-
.put(path, { ...options, json: req.body })
|
|
30
|
-
.json());
|
|
31
85
|
}
|
|
32
86
|
export function deleteTaxCode(client, req, options) {
|
|
33
|
-
const path = encodePath('openmeter/tax-codes/{taxCodeId}', {
|
|
34
|
-
taxCodeId: req.taxCodeId,
|
|
35
|
-
});
|
|
36
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
|
+
})()}`;
|
|
37
94
|
await http(client).delete(path, options);
|
|
38
95
|
});
|
|
39
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/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
|