@bpinternal/const 0.4.2 → 0.5.0
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/dist/billing-meters.d.ts +23 -0
- package/dist/billing-meters.js +26 -0
- package/dist/billing-plans.d.ts +1 -1
- package/dist/billing-plans.js +1 -1
- package/dist/billing-versions.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/limits.d.ts +4 -0
- package/dist/limits.js +4 -0
- package/dist/schema.d.ts +179 -0
- package/dist/schema.js +19 -1
- package/dist/types.d.ts +20 -1
- package/package.json +9 -9
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const BILLING_METERS_IDS: readonly ["ai_spend_credit_grant", "ai_spend_pay_as_you_go"];
|
|
2
|
+
export declare const billingMetersDefs: {
|
|
3
|
+
readonly ai_spend_credit_grant: {
|
|
4
|
+
readonly id: "ai_spend_credit_grant";
|
|
5
|
+
readonly name: "AI Spend - Credit grant";
|
|
6
|
+
readonly description: "Pre-purchased credits applied toward AI usage";
|
|
7
|
+
readonly currency: "usd";
|
|
8
|
+
readonly unitAmount: 1;
|
|
9
|
+
readonly interval: "month";
|
|
10
|
+
readonly aggregation: "lastDuringPeriod";
|
|
11
|
+
readonly meterType: "creditGrant";
|
|
12
|
+
};
|
|
13
|
+
readonly ai_spend_pay_as_you_go: {
|
|
14
|
+
readonly id: "ai_spend_pay_as_you_go";
|
|
15
|
+
readonly name: "AI Spend - Pay as you go";
|
|
16
|
+
readonly description: "Usage-based charges for AI spend, billed monthly";
|
|
17
|
+
readonly currency: "usd";
|
|
18
|
+
readonly unitAmount: 1;
|
|
19
|
+
readonly interval: "month";
|
|
20
|
+
readonly aggregation: "lastDuringPeriod";
|
|
21
|
+
readonly meterType: "payAsYouGo";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.billingMetersDefs = exports.BILLING_METERS_IDS = void 0;
|
|
4
|
+
exports.BILLING_METERS_IDS = ['ai_spend_credit_grant', 'ai_spend_pay_as_you_go'];
|
|
5
|
+
exports.billingMetersDefs = {
|
|
6
|
+
ai_spend_credit_grant: {
|
|
7
|
+
id: 'ai_spend_credit_grant',
|
|
8
|
+
name: 'AI Spend - Credit grant',
|
|
9
|
+
description: 'Pre-purchased credits applied toward AI usage',
|
|
10
|
+
currency: 'usd',
|
|
11
|
+
unitAmount: 1,
|
|
12
|
+
interval: 'month',
|
|
13
|
+
aggregation: 'lastDuringPeriod',
|
|
14
|
+
meterType: 'creditGrant',
|
|
15
|
+
},
|
|
16
|
+
ai_spend_pay_as_you_go: {
|
|
17
|
+
id: 'ai_spend_pay_as_you_go',
|
|
18
|
+
name: 'AI Spend - Pay as you go',
|
|
19
|
+
description: 'Usage-based charges for AI spend, billed monthly',
|
|
20
|
+
currency: 'usd',
|
|
21
|
+
unitAmount: 1,
|
|
22
|
+
interval: 'month',
|
|
23
|
+
aggregation: 'lastDuringPeriod',
|
|
24
|
+
meterType: 'payAsYouGo',
|
|
25
|
+
},
|
|
26
|
+
};
|
package/dist/billing-plans.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare const billingPlansDefs: {
|
|
|
22
22
|
readonly human_in_the_loop: false;
|
|
23
23
|
readonly ratelimit: 100;
|
|
24
24
|
readonly incoming_messages_events: 500;
|
|
25
|
-
readonly integration_spend:
|
|
25
|
+
readonly integration_spend: 0;
|
|
26
26
|
readonly integration_subscription: false;
|
|
27
27
|
readonly table_rows: 1000;
|
|
28
28
|
readonly bot_count: 1;
|
package/dist/billing-plans.js
CHANGED
|
@@ -41,7 +41,7 @@ exports.billingPlansDefs = {
|
|
|
41
41
|
human_in_the_loop: false,
|
|
42
42
|
ratelimit: 100,
|
|
43
43
|
incoming_messages_events: 500,
|
|
44
|
-
integration_spend:
|
|
44
|
+
integration_spend: 0,
|
|
45
45
|
integration_subscription: false,
|
|
46
46
|
table_rows: 1000,
|
|
47
47
|
bot_count: 1,
|
package/dist/billing-versions.js
CHANGED
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.getBillingVersion = exports.getActiveBillingVersion = exports.billingDefinitions = exports.billingV4Definition = exports.BILLING_VERSIONS = void 0;
|
|
8
8
|
const billing_plans_1 = require("./billing-plans");
|
|
9
9
|
const billing_addons_1 = require("./billing-addons");
|
|
10
|
+
const billing_meters_1 = require("./billing-meters");
|
|
10
11
|
exports.BILLING_VERSIONS = ['v4'];
|
|
11
12
|
exports.billingV4Definition = {
|
|
12
13
|
version: 'v4',
|
|
@@ -14,6 +15,7 @@ exports.billingV4Definition = {
|
|
|
14
15
|
description: 'New billing system with credit grants and entitlements',
|
|
15
16
|
plans: billing_plans_1.billingPlansDefs,
|
|
16
17
|
addons: billing_addons_1.billingAddonsDefs,
|
|
18
|
+
meters: billing_meters_1.billingMetersDefs,
|
|
17
19
|
isActive: true,
|
|
18
20
|
createdAt: new Date().toISOString(),
|
|
19
21
|
// stripeMapping will be populated by Pulumi
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from './billing-features';
|
|
|
9
9
|
export * from './billing-plans';
|
|
10
10
|
export * from './billing-versions';
|
|
11
11
|
export * from './billing-addons';
|
|
12
|
+
export * from './billing-meters';
|
|
12
13
|
export * from './usage-metadata';
|
|
13
14
|
export * from './schema';
|
|
14
15
|
export * from './types';
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __exportStar(require("./billing-features"), exports);
|
|
|
26
26
|
__exportStar(require("./billing-plans"), exports);
|
|
27
27
|
__exportStar(require("./billing-versions"), exports);
|
|
28
28
|
__exportStar(require("./billing-addons"), exports);
|
|
29
|
+
__exportStar(require("./billing-meters"), exports);
|
|
29
30
|
__exportStar(require("./usage-metadata"), exports);
|
|
30
31
|
__exportStar(require("./schema"), exports);
|
|
31
32
|
__exportStar(require("./types"), exports);
|
package/dist/limits.d.ts
CHANGED
package/dist/limits.js
CHANGED
package/dist/schema.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const intervalSchema: z.ZodEnum<["month", "year"]>;
|
|
3
|
+
export declare const unitAmountSchema: z.ZodNumber;
|
|
4
|
+
export declare const aggregationSchema: z.ZodEnum<["sum", "lastDuringPeriod", "lastEver", "max"]>;
|
|
5
|
+
export declare const meterTypeSchema: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
|
|
3
6
|
export declare const priceSchema: z.ZodObject<{
|
|
4
7
|
providerPriceId: z.ZodString;
|
|
5
8
|
amount: z.ZodNumber;
|
|
@@ -104,7 +107,9 @@ export declare const addOnSchema: z.ZodObject<{
|
|
|
104
107
|
}>>;
|
|
105
108
|
feature: z.ZodEnum<["human_in_the_loop", "ratelimit", "incoming_messages_events", "integration_spend", "integration_subscription", "table_rows", "bot_count", "always_alive_count", "always_alive_concurrency", "collaborator_count", "file_storage", "vector_db_storage", "saved_versions"]>;
|
|
106
109
|
increment: z.ZodNumber;
|
|
110
|
+
prorationDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
107
111
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
112
|
+
autoRechargeable: z.ZodOptional<z.ZodBoolean>;
|
|
108
113
|
}, "strip", z.ZodTypeAny, {
|
|
109
114
|
id: string;
|
|
110
115
|
name: string;
|
|
@@ -120,6 +125,8 @@ export declare const addOnSchema: z.ZodObject<{
|
|
|
120
125
|
feature: "human_in_the_loop" | "ratelimit" | "incoming_messages_events" | "integration_spend" | "integration_subscription" | "table_rows" | "bot_count" | "always_alive_count" | "always_alive_concurrency" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions";
|
|
121
126
|
increment: number;
|
|
122
127
|
metadata?: Record<string, string> | undefined;
|
|
128
|
+
prorationDisabled?: boolean | undefined;
|
|
129
|
+
autoRechargeable?: boolean | undefined;
|
|
123
130
|
}, {
|
|
124
131
|
id: string;
|
|
125
132
|
name: string;
|
|
@@ -135,6 +142,42 @@ export declare const addOnSchema: z.ZodObject<{
|
|
|
135
142
|
feature: "human_in_the_loop" | "ratelimit" | "incoming_messages_events" | "integration_spend" | "integration_subscription" | "table_rows" | "bot_count" | "always_alive_count" | "always_alive_concurrency" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions";
|
|
136
143
|
increment: number;
|
|
137
144
|
metadata?: Record<string, string> | undefined;
|
|
145
|
+
prorationDisabled?: boolean | undefined;
|
|
146
|
+
autoRechargeable?: boolean | undefined;
|
|
147
|
+
}>;
|
|
148
|
+
export declare const meterSchema: z.ZodObject<{
|
|
149
|
+
id: z.ZodString;
|
|
150
|
+
name: z.ZodString;
|
|
151
|
+
description: z.ZodString;
|
|
152
|
+
providerProductId: z.ZodString;
|
|
153
|
+
currency: z.ZodEnum<["usd"]>;
|
|
154
|
+
unitAmount: z.ZodNumber;
|
|
155
|
+
interval: z.ZodEnum<["month", "year"]>;
|
|
156
|
+
aggregation: z.ZodEnum<["sum", "lastDuringPeriod", "lastEver", "max"]>;
|
|
157
|
+
meterType: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
|
|
158
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
currency: "usd";
|
|
161
|
+
interval: "month" | "year";
|
|
162
|
+
id: string;
|
|
163
|
+
name: string;
|
|
164
|
+
description: string;
|
|
165
|
+
providerProductId: string;
|
|
166
|
+
unitAmount: number;
|
|
167
|
+
aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
|
|
168
|
+
meterType: "creditGrant" | "payAsYouGo";
|
|
169
|
+
metadata?: Record<string, string> | undefined;
|
|
170
|
+
}, {
|
|
171
|
+
currency: "usd";
|
|
172
|
+
interval: "month" | "year";
|
|
173
|
+
id: string;
|
|
174
|
+
name: string;
|
|
175
|
+
description: string;
|
|
176
|
+
providerProductId: string;
|
|
177
|
+
unitAmount: number;
|
|
178
|
+
aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
|
|
179
|
+
meterType: "creditGrant" | "payAsYouGo";
|
|
180
|
+
metadata?: Record<string, string> | undefined;
|
|
138
181
|
}>;
|
|
139
182
|
export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
140
183
|
version: z.ZodEnum<["v4"]>;
|
|
@@ -224,7 +267,9 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
224
267
|
}>>;
|
|
225
268
|
feature: z.ZodEnum<["human_in_the_loop", "ratelimit", "incoming_messages_events", "integration_spend", "integration_subscription", "table_rows", "bot_count", "always_alive_count", "always_alive_concurrency", "collaborator_count", "file_storage", "vector_db_storage", "saved_versions"]>;
|
|
226
269
|
increment: z.ZodNumber;
|
|
270
|
+
prorationDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
227
271
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
272
|
+
autoRechargeable: z.ZodOptional<z.ZodBoolean>;
|
|
228
273
|
}, "strip", z.ZodTypeAny, {
|
|
229
274
|
id: string;
|
|
230
275
|
name: string;
|
|
@@ -240,6 +285,8 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
240
285
|
feature: "human_in_the_loop" | "ratelimit" | "incoming_messages_events" | "integration_spend" | "integration_subscription" | "table_rows" | "bot_count" | "always_alive_count" | "always_alive_concurrency" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions";
|
|
241
286
|
increment: number;
|
|
242
287
|
metadata?: Record<string, string> | undefined;
|
|
288
|
+
prorationDisabled?: boolean | undefined;
|
|
289
|
+
autoRechargeable?: boolean | undefined;
|
|
243
290
|
}, {
|
|
244
291
|
id: string;
|
|
245
292
|
name: string;
|
|
@@ -255,6 +302,42 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
255
302
|
feature: "human_in_the_loop" | "ratelimit" | "incoming_messages_events" | "integration_spend" | "integration_subscription" | "table_rows" | "bot_count" | "always_alive_count" | "always_alive_concurrency" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions";
|
|
256
303
|
increment: number;
|
|
257
304
|
metadata?: Record<string, string> | undefined;
|
|
305
|
+
prorationDisabled?: boolean | undefined;
|
|
306
|
+
autoRechargeable?: boolean | undefined;
|
|
307
|
+
}>>;
|
|
308
|
+
meters: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
309
|
+
id: z.ZodString;
|
|
310
|
+
name: z.ZodString;
|
|
311
|
+
description: z.ZodString;
|
|
312
|
+
providerProductId: z.ZodString;
|
|
313
|
+
currency: z.ZodEnum<["usd"]>;
|
|
314
|
+
unitAmount: z.ZodNumber;
|
|
315
|
+
interval: z.ZodEnum<["month", "year"]>;
|
|
316
|
+
aggregation: z.ZodEnum<["sum", "lastDuringPeriod", "lastEver", "max"]>;
|
|
317
|
+
meterType: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
|
|
318
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
319
|
+
}, "strip", z.ZodTypeAny, {
|
|
320
|
+
currency: "usd";
|
|
321
|
+
interval: "month" | "year";
|
|
322
|
+
id: string;
|
|
323
|
+
name: string;
|
|
324
|
+
description: string;
|
|
325
|
+
providerProductId: string;
|
|
326
|
+
unitAmount: number;
|
|
327
|
+
aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
|
|
328
|
+
meterType: "creditGrant" | "payAsYouGo";
|
|
329
|
+
metadata?: Record<string, string> | undefined;
|
|
330
|
+
}, {
|
|
331
|
+
currency: "usd";
|
|
332
|
+
interval: "month" | "year";
|
|
333
|
+
id: string;
|
|
334
|
+
name: string;
|
|
335
|
+
description: string;
|
|
336
|
+
providerProductId: string;
|
|
337
|
+
unitAmount: number;
|
|
338
|
+
aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
|
|
339
|
+
meterType: "creditGrant" | "payAsYouGo";
|
|
340
|
+
metadata?: Record<string, string> | undefined;
|
|
258
341
|
}>>;
|
|
259
342
|
isActive: z.ZodBoolean;
|
|
260
343
|
createdAt: z.ZodString;
|
|
@@ -293,6 +376,20 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
293
376
|
feature: "human_in_the_loop" | "ratelimit" | "incoming_messages_events" | "integration_spend" | "integration_subscription" | "table_rows" | "bot_count" | "always_alive_count" | "always_alive_concurrency" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions";
|
|
294
377
|
increment: number;
|
|
295
378
|
metadata?: Record<string, string> | undefined;
|
|
379
|
+
prorationDisabled?: boolean | undefined;
|
|
380
|
+
autoRechargeable?: boolean | undefined;
|
|
381
|
+
}>;
|
|
382
|
+
meters: Record<string, {
|
|
383
|
+
currency: "usd";
|
|
384
|
+
interval: "month" | "year";
|
|
385
|
+
id: string;
|
|
386
|
+
name: string;
|
|
387
|
+
description: string;
|
|
388
|
+
providerProductId: string;
|
|
389
|
+
unitAmount: number;
|
|
390
|
+
aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
|
|
391
|
+
meterType: "creditGrant" | "payAsYouGo";
|
|
392
|
+
metadata?: Record<string, string> | undefined;
|
|
296
393
|
}>;
|
|
297
394
|
isActive: boolean;
|
|
298
395
|
createdAt: string;
|
|
@@ -331,6 +428,20 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
331
428
|
feature: "human_in_the_loop" | "ratelimit" | "incoming_messages_events" | "integration_spend" | "integration_subscription" | "table_rows" | "bot_count" | "always_alive_count" | "always_alive_concurrency" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions";
|
|
332
429
|
increment: number;
|
|
333
430
|
metadata?: Record<string, string> | undefined;
|
|
431
|
+
prorationDisabled?: boolean | undefined;
|
|
432
|
+
autoRechargeable?: boolean | undefined;
|
|
433
|
+
}>;
|
|
434
|
+
meters: Record<string, {
|
|
435
|
+
currency: "usd";
|
|
436
|
+
interval: "month" | "year";
|
|
437
|
+
id: string;
|
|
438
|
+
name: string;
|
|
439
|
+
description: string;
|
|
440
|
+
providerProductId: string;
|
|
441
|
+
unitAmount: number;
|
|
442
|
+
aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
|
|
443
|
+
meterType: "creditGrant" | "payAsYouGo";
|
|
444
|
+
metadata?: Record<string, string> | undefined;
|
|
334
445
|
}>;
|
|
335
446
|
isActive: boolean;
|
|
336
447
|
createdAt: string;
|
|
@@ -423,7 +534,9 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
|
|
|
423
534
|
}>>;
|
|
424
535
|
feature: z.ZodEnum<["human_in_the_loop", "ratelimit", "incoming_messages_events", "integration_spend", "integration_subscription", "table_rows", "bot_count", "always_alive_count", "always_alive_concurrency", "collaborator_count", "file_storage", "vector_db_storage", "saved_versions"]>;
|
|
425
536
|
increment: z.ZodNumber;
|
|
537
|
+
prorationDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
426
538
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
539
|
+
autoRechargeable: z.ZodOptional<z.ZodBoolean>;
|
|
427
540
|
}, "strip", z.ZodTypeAny, {
|
|
428
541
|
id: string;
|
|
429
542
|
name: string;
|
|
@@ -439,6 +552,8 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
|
|
|
439
552
|
feature: "human_in_the_loop" | "ratelimit" | "incoming_messages_events" | "integration_spend" | "integration_subscription" | "table_rows" | "bot_count" | "always_alive_count" | "always_alive_concurrency" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions";
|
|
440
553
|
increment: number;
|
|
441
554
|
metadata?: Record<string, string> | undefined;
|
|
555
|
+
prorationDisabled?: boolean | undefined;
|
|
556
|
+
autoRechargeable?: boolean | undefined;
|
|
442
557
|
}, {
|
|
443
558
|
id: string;
|
|
444
559
|
name: string;
|
|
@@ -454,6 +569,42 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
|
|
|
454
569
|
feature: "human_in_the_loop" | "ratelimit" | "incoming_messages_events" | "integration_spend" | "integration_subscription" | "table_rows" | "bot_count" | "always_alive_count" | "always_alive_concurrency" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions";
|
|
455
570
|
increment: number;
|
|
456
571
|
metadata?: Record<string, string> | undefined;
|
|
572
|
+
prorationDisabled?: boolean | undefined;
|
|
573
|
+
autoRechargeable?: boolean | undefined;
|
|
574
|
+
}>>;
|
|
575
|
+
meters: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
576
|
+
id: z.ZodString;
|
|
577
|
+
name: z.ZodString;
|
|
578
|
+
description: z.ZodString;
|
|
579
|
+
providerProductId: z.ZodString;
|
|
580
|
+
currency: z.ZodEnum<["usd"]>;
|
|
581
|
+
unitAmount: z.ZodNumber;
|
|
582
|
+
interval: z.ZodEnum<["month", "year"]>;
|
|
583
|
+
aggregation: z.ZodEnum<["sum", "lastDuringPeriod", "lastEver", "max"]>;
|
|
584
|
+
meterType: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
|
|
585
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
586
|
+
}, "strip", z.ZodTypeAny, {
|
|
587
|
+
currency: "usd";
|
|
588
|
+
interval: "month" | "year";
|
|
589
|
+
id: string;
|
|
590
|
+
name: string;
|
|
591
|
+
description: string;
|
|
592
|
+
providerProductId: string;
|
|
593
|
+
unitAmount: number;
|
|
594
|
+
aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
|
|
595
|
+
meterType: "creditGrant" | "payAsYouGo";
|
|
596
|
+
metadata?: Record<string, string> | undefined;
|
|
597
|
+
}, {
|
|
598
|
+
currency: "usd";
|
|
599
|
+
interval: "month" | "year";
|
|
600
|
+
id: string;
|
|
601
|
+
name: string;
|
|
602
|
+
description: string;
|
|
603
|
+
providerProductId: string;
|
|
604
|
+
unitAmount: number;
|
|
605
|
+
aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
|
|
606
|
+
meterType: "creditGrant" | "payAsYouGo";
|
|
607
|
+
metadata?: Record<string, string> | undefined;
|
|
457
608
|
}>>;
|
|
458
609
|
isActive: z.ZodBoolean;
|
|
459
610
|
createdAt: z.ZodString;
|
|
@@ -492,6 +643,20 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
|
|
|
492
643
|
feature: "human_in_the_loop" | "ratelimit" | "incoming_messages_events" | "integration_spend" | "integration_subscription" | "table_rows" | "bot_count" | "always_alive_count" | "always_alive_concurrency" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions";
|
|
493
644
|
increment: number;
|
|
494
645
|
metadata?: Record<string, string> | undefined;
|
|
646
|
+
prorationDisabled?: boolean | undefined;
|
|
647
|
+
autoRechargeable?: boolean | undefined;
|
|
648
|
+
}>;
|
|
649
|
+
meters: Record<string, {
|
|
650
|
+
currency: "usd";
|
|
651
|
+
interval: "month" | "year";
|
|
652
|
+
id: string;
|
|
653
|
+
name: string;
|
|
654
|
+
description: string;
|
|
655
|
+
providerProductId: string;
|
|
656
|
+
unitAmount: number;
|
|
657
|
+
aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
|
|
658
|
+
meterType: "creditGrant" | "payAsYouGo";
|
|
659
|
+
metadata?: Record<string, string> | undefined;
|
|
495
660
|
}>;
|
|
496
661
|
isActive: boolean;
|
|
497
662
|
createdAt: string;
|
|
@@ -530,6 +695,20 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
|
|
|
530
695
|
feature: "human_in_the_loop" | "ratelimit" | "incoming_messages_events" | "integration_spend" | "integration_subscription" | "table_rows" | "bot_count" | "always_alive_count" | "always_alive_concurrency" | "collaborator_count" | "file_storage" | "vector_db_storage" | "saved_versions";
|
|
531
696
|
increment: number;
|
|
532
697
|
metadata?: Record<string, string> | undefined;
|
|
698
|
+
prorationDisabled?: boolean | undefined;
|
|
699
|
+
autoRechargeable?: boolean | undefined;
|
|
700
|
+
}>;
|
|
701
|
+
meters: Record<string, {
|
|
702
|
+
currency: "usd";
|
|
703
|
+
interval: "month" | "year";
|
|
704
|
+
id: string;
|
|
705
|
+
name: string;
|
|
706
|
+
description: string;
|
|
707
|
+
providerProductId: string;
|
|
708
|
+
unitAmount: number;
|
|
709
|
+
aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
|
|
710
|
+
meterType: "creditGrant" | "payAsYouGo";
|
|
711
|
+
metadata?: Record<string, string> | undefined;
|
|
533
712
|
}>;
|
|
534
713
|
isActive: boolean;
|
|
535
714
|
createdAt: string;
|
package/dist/schema.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.billingConfigSchema = exports.billingVersionConfigSchema = exports.addOnSchema = exports.planSchema = exports.featureSchema = exports.priceSchema = exports.intervalSchema = void 0;
|
|
3
|
+
exports.billingConfigSchema = exports.billingVersionConfigSchema = exports.meterSchema = exports.addOnSchema = exports.planSchema = exports.featureSchema = exports.priceSchema = exports.meterTypeSchema = exports.aggregationSchema = exports.unitAmountSchema = exports.intervalSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const billing_versions_1 = require("./billing-versions");
|
|
6
6
|
const billing_features_1 = require("./billing-features");
|
|
7
7
|
exports.intervalSchema = zod_1.z.enum(['month', 'year']);
|
|
8
|
+
exports.unitAmountSchema = zod_1.z.number().int().min(1);
|
|
9
|
+
exports.aggregationSchema = zod_1.z.enum(['sum', 'lastDuringPeriod', 'lastEver', 'max']);
|
|
10
|
+
exports.meterTypeSchema = zod_1.z.enum(['payAsYouGo', 'creditGrant']);
|
|
8
11
|
exports.priceSchema = zod_1.z.object({
|
|
9
12
|
providerPriceId: zod_1.z.string(),
|
|
10
13
|
amount: zod_1.z.number(),
|
|
@@ -31,6 +34,20 @@ exports.addOnSchema = zod_1.z.object({
|
|
|
31
34
|
prices: zod_1.z.record(exports.intervalSchema, exports.priceSchema),
|
|
32
35
|
feature: exports.featureSchema,
|
|
33
36
|
increment: zod_1.z.number(),
|
|
37
|
+
prorationDisabled: zod_1.z.boolean().optional(),
|
|
38
|
+
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
|
39
|
+
autoRechargeable: zod_1.z.boolean().optional(),
|
|
40
|
+
});
|
|
41
|
+
exports.meterSchema = zod_1.z.object({
|
|
42
|
+
id: zod_1.z.string(),
|
|
43
|
+
name: zod_1.z.string(),
|
|
44
|
+
description: zod_1.z.string(),
|
|
45
|
+
providerProductId: zod_1.z.string(),
|
|
46
|
+
currency: zod_1.z.enum(['usd']),
|
|
47
|
+
unitAmount: exports.unitAmountSchema,
|
|
48
|
+
interval: exports.intervalSchema,
|
|
49
|
+
aggregation: exports.aggregationSchema,
|
|
50
|
+
meterType: exports.meterTypeSchema,
|
|
34
51
|
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
|
35
52
|
});
|
|
36
53
|
exports.billingVersionConfigSchema = zod_1.z.object({
|
|
@@ -39,6 +56,7 @@ exports.billingVersionConfigSchema = zod_1.z.object({
|
|
|
39
56
|
description: zod_1.z.string(),
|
|
40
57
|
plans: zod_1.z.record(zod_1.z.string(), exports.planSchema),
|
|
41
58
|
addons: zod_1.z.record(zod_1.z.string(), exports.addOnSchema),
|
|
59
|
+
meters: zod_1.z.record(zod_1.z.string(), exports.meterSchema),
|
|
42
60
|
isActive: zod_1.z.boolean(),
|
|
43
61
|
createdAt: zod_1.z.string(),
|
|
44
62
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { BILLING_FEATURE_IDS } from './billing-features';
|
|
2
|
+
import { BILLING_METERS_IDS } from './billing-meters';
|
|
2
3
|
import { BILLING_PLAN_IDS, BILLING_ADDON_IDS } from './billing-plans';
|
|
3
4
|
import { BILLING_VERSIONS } from './billing-versions';
|
|
4
|
-
import { billingVersionConfigSchema, billingConfigSchema, intervalSchema, priceSchema, planSchema, addOnSchema } from './schema';
|
|
5
|
+
import { billingVersionConfigSchema, billingConfigSchema, intervalSchema, unitAmountSchema, aggregationSchema, meterTypeSchema, priceSchema, planSchema, addOnSchema, meterSchema } from './schema';
|
|
5
6
|
import { z } from 'zod';
|
|
6
7
|
export type Interval = z.infer<typeof intervalSchema>;
|
|
8
|
+
export type UnitAmount = z.infer<typeof unitAmountSchema>;
|
|
9
|
+
export type Aggregation = z.infer<typeof aggregationSchema>;
|
|
10
|
+
export type MeterType = z.infer<typeof meterTypeSchema>;
|
|
7
11
|
export type BillingFeatureId = (typeof BILLING_FEATURE_IDS)[number];
|
|
8
12
|
export type BillingAddonId = (typeof BILLING_ADDON_IDS)[number];
|
|
9
13
|
export type BillingPlanId = (typeof BILLING_PLAN_IDS)[number];
|
|
14
|
+
export type BillingMeterId = (typeof BILLING_METERS_IDS)[number];
|
|
10
15
|
export type BillingFeatureDefinition = {
|
|
11
16
|
name: string;
|
|
12
17
|
description: string;
|
|
@@ -36,6 +41,18 @@ export type BillingAddonDefinition = {
|
|
|
36
41
|
prices: Array<BillingPriceDefinition>;
|
|
37
42
|
feature: BillingFeatureId;
|
|
38
43
|
increment: number;
|
|
44
|
+
prorationDisabled?: boolean;
|
|
45
|
+
metadata?: Record<string, string>;
|
|
46
|
+
};
|
|
47
|
+
export type BillingMeterDefinition = {
|
|
48
|
+
id: BillingMeterId;
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
currency: 'usd';
|
|
52
|
+
unitAmount: UnitAmount;
|
|
53
|
+
interval: Interval;
|
|
54
|
+
aggregation: Aggregation;
|
|
55
|
+
meterType: MeterType;
|
|
39
56
|
metadata?: Record<string, string>;
|
|
40
57
|
};
|
|
41
58
|
export type BillingVersionId = (typeof BILLING_VERSIONS)[number];
|
|
@@ -45,6 +62,7 @@ export type BillingVersionDefinition = {
|
|
|
45
62
|
description: string;
|
|
46
63
|
plans: Partial<Record<BillingPlanId, BillingPlanDefinition>>;
|
|
47
64
|
addons: Partial<Record<BillingAddonId, BillingAddonDefinition>>;
|
|
65
|
+
meters: Partial<Record<BillingMeterId, BillingMeterDefinition>>;
|
|
48
66
|
isActive: boolean;
|
|
49
67
|
createdAt: string;
|
|
50
68
|
};
|
|
@@ -54,3 +72,4 @@ export type BillingConfig = z.infer<typeof billingConfigSchema>;
|
|
|
54
72
|
export type BillingPrice = z.infer<typeof priceSchema>;
|
|
55
73
|
export type BillingPlan = z.infer<typeof planSchema>;
|
|
56
74
|
export type BillingAddon = z.infer<typeof addOnSchema>;
|
|
75
|
+
export type BillingMeter = z.infer<typeof meterSchema>;
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpinternal/const",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Shared constants for Skynet billing refactor (vendored copy of upstream packages/const)",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
6
|
"files": [
|
|
9
7
|
"dist"
|
|
10
8
|
],
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
},
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
14
11
|
"dependencies": {
|
|
15
12
|
"zod": "^3.24.4"
|
|
16
13
|
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "5.9.3"
|
|
16
|
+
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tsc -b tsconfig.json",
|
|
19
19
|
"dev": "tsc -w",
|
|
20
20
|
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
21
|
-
"check:
|
|
22
|
-
"
|
|
23
|
-
"
|
|
21
|
+
"check:type": "tsc --noEmit",
|
|
22
|
+
"check:lint": "oxlint --type-aware",
|
|
23
|
+
"fix:lint": "oxlint --type-aware --fix"
|
|
24
24
|
}
|
|
25
25
|
}
|