@bpinternal/const 0.7.0 → 0.8.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 +20 -2
- package/dist/billing-meters.js +6 -2
- package/dist/schema.d.ts +14 -23
- package/dist/schema.js +2 -2
- package/dist/types.d.ts +10 -1
- package/package.json +1 -1
package/dist/billing-meters.d.ts
CHANGED
|
@@ -4,11 +4,20 @@ export declare const billingMetersDefs: {
|
|
|
4
4
|
readonly id: "ai_spend_credit_grant";
|
|
5
5
|
readonly name: "AI Spend - Credit grant";
|
|
6
6
|
readonly description: "Pre-purchased credits applied toward AI usage";
|
|
7
|
+
readonly defaultAggregation: {
|
|
8
|
+
readonly formula: "sum";
|
|
9
|
+
};
|
|
10
|
+
readonly customerMapping: {
|
|
11
|
+
readonly eventPayloadKey: "stripe_customer_id";
|
|
12
|
+
readonly type: "by_id";
|
|
13
|
+
};
|
|
14
|
+
readonly valueSettings: {
|
|
15
|
+
readonly eventPayloadKey: "value";
|
|
16
|
+
};
|
|
7
17
|
readonly prices: [{
|
|
8
18
|
readonly unitAmount: 1;
|
|
9
19
|
readonly currency: "usd";
|
|
10
20
|
readonly interval: "month";
|
|
11
|
-
readonly aggregation: "last_during_period";
|
|
12
21
|
}];
|
|
13
22
|
readonly meterType: "creditGrant";
|
|
14
23
|
};
|
|
@@ -16,11 +25,20 @@ export declare const billingMetersDefs: {
|
|
|
16
25
|
readonly id: "ai_spend_pay_as_you_go";
|
|
17
26
|
readonly name: "AI Spend - Pay as you go";
|
|
18
27
|
readonly description: "Usage-based charges for AI spend, billed monthly";
|
|
28
|
+
readonly defaultAggregation: {
|
|
29
|
+
readonly formula: "sum";
|
|
30
|
+
};
|
|
31
|
+
readonly customerMapping: {
|
|
32
|
+
readonly eventPayloadKey: "stripe_customer_id";
|
|
33
|
+
readonly type: "by_id";
|
|
34
|
+
};
|
|
35
|
+
readonly valueSettings: {
|
|
36
|
+
readonly eventPayloadKey: "value";
|
|
37
|
+
};
|
|
19
38
|
readonly prices: [{
|
|
20
39
|
readonly unitAmount: 1;
|
|
21
40
|
readonly currency: "usd";
|
|
22
41
|
readonly interval: "month";
|
|
23
|
-
readonly aggregation: "last_during_period";
|
|
24
42
|
}];
|
|
25
43
|
readonly meterType: "payAsYouGo";
|
|
26
44
|
};
|
package/dist/billing-meters.js
CHANGED
|
@@ -7,12 +7,14 @@ exports.billingMetersDefs = {
|
|
|
7
7
|
id: 'ai_spend_credit_grant',
|
|
8
8
|
name: 'AI Spend - Credit grant',
|
|
9
9
|
description: 'Pre-purchased credits applied toward AI usage',
|
|
10
|
+
defaultAggregation: { formula: 'sum' },
|
|
11
|
+
customerMapping: { eventPayloadKey: 'stripe_customer_id', type: 'by_id' },
|
|
12
|
+
valueSettings: { eventPayloadKey: 'value' },
|
|
10
13
|
prices: [
|
|
11
14
|
{
|
|
12
15
|
unitAmount: 1,
|
|
13
16
|
currency: 'usd',
|
|
14
17
|
interval: 'month',
|
|
15
|
-
aggregation: 'last_during_period',
|
|
16
18
|
},
|
|
17
19
|
],
|
|
18
20
|
meterType: 'creditGrant',
|
|
@@ -21,12 +23,14 @@ exports.billingMetersDefs = {
|
|
|
21
23
|
id: 'ai_spend_pay_as_you_go',
|
|
22
24
|
name: 'AI Spend - Pay as you go',
|
|
23
25
|
description: 'Usage-based charges for AI spend, billed monthly',
|
|
26
|
+
defaultAggregation: { formula: 'sum' },
|
|
27
|
+
customerMapping: { eventPayloadKey: 'stripe_customer_id', type: 'by_id' },
|
|
28
|
+
valueSettings: { eventPayloadKey: 'value' },
|
|
24
29
|
prices: [
|
|
25
30
|
{
|
|
26
31
|
unitAmount: 1,
|
|
27
32
|
currency: 'usd',
|
|
28
33
|
interval: 'month',
|
|
29
|
-
aggregation: 'last_during_period',
|
|
30
34
|
},
|
|
31
35
|
],
|
|
32
36
|
meterType: 'payAsYouGo',
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const intervalSchema: z.ZodEnum<["month", "year"]>;
|
|
3
3
|
export declare const unitAmountSchema: z.ZodNumber;
|
|
4
|
-
export declare const aggregationSchema: z.ZodEnum<["sum", "
|
|
4
|
+
export declare const aggregationSchema: z.ZodEnum<["sum", "count"]>;
|
|
5
5
|
export declare const meterTypeSchema: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
|
|
6
6
|
export declare const priceSchema: z.ZodObject<{
|
|
7
7
|
providerPriceId: z.ZodString;
|
|
@@ -27,21 +27,18 @@ export declare const meteredPriceSchema: z.ZodObject<{
|
|
|
27
27
|
unitAmount: z.ZodNumber;
|
|
28
28
|
currency: z.ZodEnum<["usd"]>;
|
|
29
29
|
interval: z.ZodEnum<["month", "year"]>;
|
|
30
|
-
aggregation: z.ZodEnum<["sum", "last_during_period", "last_ever", "max"]>;
|
|
31
30
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
32
31
|
}, "strip", z.ZodTypeAny, {
|
|
33
32
|
providerPriceId: string;
|
|
34
33
|
currency: "usd";
|
|
35
34
|
interval: "month" | "year";
|
|
36
35
|
unitAmount: number;
|
|
37
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
38
36
|
metadata?: Record<string, string> | undefined;
|
|
39
37
|
}, {
|
|
40
38
|
providerPriceId: string;
|
|
41
39
|
currency: "usd";
|
|
42
40
|
interval: "month" | "year";
|
|
43
41
|
unitAmount: number;
|
|
44
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
45
42
|
metadata?: Record<string, string> | undefined;
|
|
46
43
|
}>;
|
|
47
44
|
export declare const featureSchema: 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"]>;
|
|
@@ -175,26 +172,24 @@ export declare const meterSchema: z.ZodObject<{
|
|
|
175
172
|
name: z.ZodString;
|
|
176
173
|
description: z.ZodString;
|
|
177
174
|
providerProductId: z.ZodString;
|
|
175
|
+
providerMeterId: z.ZodString;
|
|
178
176
|
prices: z.ZodRecord<z.ZodEnum<["month", "year"]>, z.ZodObject<{
|
|
179
177
|
providerPriceId: z.ZodString;
|
|
180
178
|
unitAmount: z.ZodNumber;
|
|
181
179
|
currency: z.ZodEnum<["usd"]>;
|
|
182
180
|
interval: z.ZodEnum<["month", "year"]>;
|
|
183
|
-
aggregation: z.ZodEnum<["sum", "last_during_period", "last_ever", "max"]>;
|
|
184
181
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
185
182
|
}, "strip", z.ZodTypeAny, {
|
|
186
183
|
providerPriceId: string;
|
|
187
184
|
currency: "usd";
|
|
188
185
|
interval: "month" | "year";
|
|
189
186
|
unitAmount: number;
|
|
190
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
191
187
|
metadata?: Record<string, string> | undefined;
|
|
192
188
|
}, {
|
|
193
189
|
providerPriceId: string;
|
|
194
190
|
currency: "usd";
|
|
195
191
|
interval: "month" | "year";
|
|
196
192
|
unitAmount: number;
|
|
197
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
198
193
|
metadata?: Record<string, string> | undefined;
|
|
199
194
|
}>>;
|
|
200
195
|
meterType: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
|
|
@@ -209,9 +204,9 @@ export declare const meterSchema: z.ZodObject<{
|
|
|
209
204
|
currency: "usd";
|
|
210
205
|
interval: "month" | "year";
|
|
211
206
|
unitAmount: number;
|
|
212
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
213
207
|
metadata?: Record<string, string> | undefined;
|
|
214
208
|
}>>;
|
|
209
|
+
providerMeterId: string;
|
|
215
210
|
meterType: "creditGrant" | "payAsYouGo";
|
|
216
211
|
metadata?: Record<string, string> | undefined;
|
|
217
212
|
}, {
|
|
@@ -224,9 +219,9 @@ export declare const meterSchema: z.ZodObject<{
|
|
|
224
219
|
currency: "usd";
|
|
225
220
|
interval: "month" | "year";
|
|
226
221
|
unitAmount: number;
|
|
227
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
228
222
|
metadata?: Record<string, string> | undefined;
|
|
229
223
|
}>>;
|
|
224
|
+
providerMeterId: string;
|
|
230
225
|
meterType: "creditGrant" | "payAsYouGo";
|
|
231
226
|
metadata?: Record<string, string> | undefined;
|
|
232
227
|
}>;
|
|
@@ -364,26 +359,24 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
364
359
|
name: z.ZodString;
|
|
365
360
|
description: z.ZodString;
|
|
366
361
|
providerProductId: z.ZodString;
|
|
362
|
+
providerMeterId: z.ZodString;
|
|
367
363
|
prices: z.ZodRecord<z.ZodEnum<["month", "year"]>, z.ZodObject<{
|
|
368
364
|
providerPriceId: z.ZodString;
|
|
369
365
|
unitAmount: z.ZodNumber;
|
|
370
366
|
currency: z.ZodEnum<["usd"]>;
|
|
371
367
|
interval: z.ZodEnum<["month", "year"]>;
|
|
372
|
-
aggregation: z.ZodEnum<["sum", "last_during_period", "last_ever", "max"]>;
|
|
373
368
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
374
369
|
}, "strip", z.ZodTypeAny, {
|
|
375
370
|
providerPriceId: string;
|
|
376
371
|
currency: "usd";
|
|
377
372
|
interval: "month" | "year";
|
|
378
373
|
unitAmount: number;
|
|
379
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
380
374
|
metadata?: Record<string, string> | undefined;
|
|
381
375
|
}, {
|
|
382
376
|
providerPriceId: string;
|
|
383
377
|
currency: "usd";
|
|
384
378
|
interval: "month" | "year";
|
|
385
379
|
unitAmount: number;
|
|
386
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
387
380
|
metadata?: Record<string, string> | undefined;
|
|
388
381
|
}>>;
|
|
389
382
|
meterType: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
|
|
@@ -398,9 +391,9 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
398
391
|
currency: "usd";
|
|
399
392
|
interval: "month" | "year";
|
|
400
393
|
unitAmount: number;
|
|
401
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
402
394
|
metadata?: Record<string, string> | undefined;
|
|
403
395
|
}>>;
|
|
396
|
+
providerMeterId: string;
|
|
404
397
|
meterType: "creditGrant" | "payAsYouGo";
|
|
405
398
|
metadata?: Record<string, string> | undefined;
|
|
406
399
|
}, {
|
|
@@ -413,9 +406,9 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
413
406
|
currency: "usd";
|
|
414
407
|
interval: "month" | "year";
|
|
415
408
|
unitAmount: number;
|
|
416
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
417
409
|
metadata?: Record<string, string> | undefined;
|
|
418
410
|
}>>;
|
|
411
|
+
providerMeterId: string;
|
|
419
412
|
meterType: "creditGrant" | "payAsYouGo";
|
|
420
413
|
metadata?: Record<string, string> | undefined;
|
|
421
414
|
}>>;
|
|
@@ -470,9 +463,9 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
470
463
|
currency: "usd";
|
|
471
464
|
interval: "month" | "year";
|
|
472
465
|
unitAmount: number;
|
|
473
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
474
466
|
metadata?: Record<string, string> | undefined;
|
|
475
467
|
}>>;
|
|
468
|
+
providerMeterId: string;
|
|
476
469
|
meterType: "creditGrant" | "payAsYouGo";
|
|
477
470
|
metadata?: Record<string, string> | undefined;
|
|
478
471
|
}>;
|
|
@@ -527,9 +520,9 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
527
520
|
currency: "usd";
|
|
528
521
|
interval: "month" | "year";
|
|
529
522
|
unitAmount: number;
|
|
530
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
531
523
|
metadata?: Record<string, string> | undefined;
|
|
532
524
|
}>>;
|
|
525
|
+
providerMeterId: string;
|
|
533
526
|
meterType: "creditGrant" | "payAsYouGo";
|
|
534
527
|
metadata?: Record<string, string> | undefined;
|
|
535
528
|
}>;
|
|
@@ -670,26 +663,24 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
|
|
|
670
663
|
name: z.ZodString;
|
|
671
664
|
description: z.ZodString;
|
|
672
665
|
providerProductId: z.ZodString;
|
|
666
|
+
providerMeterId: z.ZodString;
|
|
673
667
|
prices: z.ZodRecord<z.ZodEnum<["month", "year"]>, z.ZodObject<{
|
|
674
668
|
providerPriceId: z.ZodString;
|
|
675
669
|
unitAmount: z.ZodNumber;
|
|
676
670
|
currency: z.ZodEnum<["usd"]>;
|
|
677
671
|
interval: z.ZodEnum<["month", "year"]>;
|
|
678
|
-
aggregation: z.ZodEnum<["sum", "last_during_period", "last_ever", "max"]>;
|
|
679
672
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
680
673
|
}, "strip", z.ZodTypeAny, {
|
|
681
674
|
providerPriceId: string;
|
|
682
675
|
currency: "usd";
|
|
683
676
|
interval: "month" | "year";
|
|
684
677
|
unitAmount: number;
|
|
685
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
686
678
|
metadata?: Record<string, string> | undefined;
|
|
687
679
|
}, {
|
|
688
680
|
providerPriceId: string;
|
|
689
681
|
currency: "usd";
|
|
690
682
|
interval: "month" | "year";
|
|
691
683
|
unitAmount: number;
|
|
692
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
693
684
|
metadata?: Record<string, string> | undefined;
|
|
694
685
|
}>>;
|
|
695
686
|
meterType: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
|
|
@@ -704,9 +695,9 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
|
|
|
704
695
|
currency: "usd";
|
|
705
696
|
interval: "month" | "year";
|
|
706
697
|
unitAmount: number;
|
|
707
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
708
698
|
metadata?: Record<string, string> | undefined;
|
|
709
699
|
}>>;
|
|
700
|
+
providerMeterId: string;
|
|
710
701
|
meterType: "creditGrant" | "payAsYouGo";
|
|
711
702
|
metadata?: Record<string, string> | undefined;
|
|
712
703
|
}, {
|
|
@@ -719,9 +710,9 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
|
|
|
719
710
|
currency: "usd";
|
|
720
711
|
interval: "month" | "year";
|
|
721
712
|
unitAmount: number;
|
|
722
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
723
713
|
metadata?: Record<string, string> | undefined;
|
|
724
714
|
}>>;
|
|
715
|
+
providerMeterId: string;
|
|
725
716
|
meterType: "creditGrant" | "payAsYouGo";
|
|
726
717
|
metadata?: Record<string, string> | undefined;
|
|
727
718
|
}>>;
|
|
@@ -776,9 +767,9 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
|
|
|
776
767
|
currency: "usd";
|
|
777
768
|
interval: "month" | "year";
|
|
778
769
|
unitAmount: number;
|
|
779
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
780
770
|
metadata?: Record<string, string> | undefined;
|
|
781
771
|
}>>;
|
|
772
|
+
providerMeterId: string;
|
|
782
773
|
meterType: "creditGrant" | "payAsYouGo";
|
|
783
774
|
metadata?: Record<string, string> | undefined;
|
|
784
775
|
}>;
|
|
@@ -833,9 +824,9 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
|
|
|
833
824
|
currency: "usd";
|
|
834
825
|
interval: "month" | "year";
|
|
835
826
|
unitAmount: number;
|
|
836
|
-
aggregation: "last_during_period" | "sum" | "last_ever" | "max";
|
|
837
827
|
metadata?: Record<string, string> | undefined;
|
|
838
828
|
}>>;
|
|
829
|
+
providerMeterId: string;
|
|
839
830
|
meterType: "creditGrant" | "payAsYouGo";
|
|
840
831
|
metadata?: Record<string, string> | undefined;
|
|
841
832
|
}>;
|
package/dist/schema.js
CHANGED
|
@@ -6,7 +6,7 @@ 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
8
|
exports.unitAmountSchema = zod_1.z.number().int().min(1);
|
|
9
|
-
exports.aggregationSchema = zod_1.z.enum(['sum', '
|
|
9
|
+
exports.aggregationSchema = zod_1.z.enum(['sum', 'count']);
|
|
10
10
|
exports.meterTypeSchema = zod_1.z.enum(['payAsYouGo', 'creditGrant']);
|
|
11
11
|
exports.priceSchema = zod_1.z.object({
|
|
12
12
|
providerPriceId: zod_1.z.string(),
|
|
@@ -20,7 +20,6 @@ exports.meteredPriceSchema = zod_1.z.object({
|
|
|
20
20
|
unitAmount: exports.unitAmountSchema,
|
|
21
21
|
currency: zod_1.z.enum(['usd']),
|
|
22
22
|
interval: exports.intervalSchema,
|
|
23
|
-
aggregation: exports.aggregationSchema,
|
|
24
23
|
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
|
25
24
|
});
|
|
26
25
|
exports.featureSchema = zod_1.z.enum(billing_features_1.BILLING_FEATURE_IDS);
|
|
@@ -52,6 +51,7 @@ exports.meterSchema = zod_1.z.object({
|
|
|
52
51
|
name: zod_1.z.string(),
|
|
53
52
|
description: zod_1.z.string(),
|
|
54
53
|
providerProductId: zod_1.z.string(),
|
|
54
|
+
providerMeterId: zod_1.z.string(),
|
|
55
55
|
prices: zod_1.z.record(exports.intervalSchema, exports.meteredPriceSchema),
|
|
56
56
|
meterType: exports.meterTypeSchema,
|
|
57
57
|
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
package/dist/types.d.ts
CHANGED
|
@@ -29,7 +29,6 @@ export type BillingMeteredPriceDefinition = {
|
|
|
29
29
|
unitAmount: number;
|
|
30
30
|
currency: 'usd';
|
|
31
31
|
interval: Interval;
|
|
32
|
-
aggregation: Aggregation;
|
|
33
32
|
};
|
|
34
33
|
export type BillingPlanDefinition = {
|
|
35
34
|
id: BillingPlanId;
|
|
@@ -55,6 +54,16 @@ export type BillingMeterDefinition = {
|
|
|
55
54
|
id: BillingMeterId;
|
|
56
55
|
name: string;
|
|
57
56
|
description: string;
|
|
57
|
+
defaultAggregation: {
|
|
58
|
+
formula: Aggregation;
|
|
59
|
+
};
|
|
60
|
+
customerMapping: {
|
|
61
|
+
eventPayloadKey: 'stripe_customer_id';
|
|
62
|
+
type: 'by_id';
|
|
63
|
+
};
|
|
64
|
+
valueSettings: {
|
|
65
|
+
eventPayloadKey: 'value';
|
|
66
|
+
};
|
|
58
67
|
prices: Array<BillingMeteredPriceDefinition>;
|
|
59
68
|
meterType: MeterType;
|
|
60
69
|
metadata?: Record<string, string>;
|