@bpinternal/const 0.4.3 → 0.5.1

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.
@@ -0,0 +1,27 @@
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 prices: [{
8
+ readonly unitAmount: 1;
9
+ readonly currency: "usd";
10
+ readonly interval: "month";
11
+ readonly aggregation: "lastDuringPeriod";
12
+ }];
13
+ readonly meterType: "creditGrant";
14
+ };
15
+ readonly ai_spend_pay_as_you_go: {
16
+ readonly id: "ai_spend_pay_as_you_go";
17
+ readonly name: "AI Spend - Pay as you go";
18
+ readonly description: "Usage-based charges for AI spend, billed monthly";
19
+ readonly prices: [{
20
+ readonly unitAmount: 1;
21
+ readonly currency: "usd";
22
+ readonly interval: "month";
23
+ readonly aggregation: "lastDuringPeriod";
24
+ }];
25
+ readonly meterType: "payAsYouGo";
26
+ };
27
+ };
@@ -0,0 +1,34 @@
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
+ prices: [
11
+ {
12
+ unitAmount: 1,
13
+ currency: 'usd',
14
+ interval: 'month',
15
+ aggregation: 'lastDuringPeriod',
16
+ },
17
+ ],
18
+ meterType: 'creditGrant',
19
+ },
20
+ ai_spend_pay_as_you_go: {
21
+ id: 'ai_spend_pay_as_you_go',
22
+ name: 'AI Spend - Pay as you go',
23
+ description: 'Usage-based charges for AI spend, billed monthly',
24
+ prices: [
25
+ {
26
+ unitAmount: 1,
27
+ currency: 'usd',
28
+ interval: 'month',
29
+ aggregation: 'lastDuringPeriod',
30
+ },
31
+ ],
32
+ meterType: 'payAsYouGo',
33
+ },
34
+ };
@@ -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: 5000000000;
25
+ readonly integration_spend: 0;
26
26
  readonly integration_subscription: false;
27
27
  readonly table_rows: 1000;
28
28
  readonly bot_count: 1;
@@ -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: 5_000_000_000, // $5 in nano-dollars
44
+ integration_spend: 0,
45
45
  integration_subscription: false,
46
46
  table_rows: 1000,
47
47
  bot_count: 1,
@@ -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/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;
@@ -19,6 +22,28 @@ export declare const priceSchema: z.ZodObject<{
19
22
  interval: "month" | "year";
20
23
  metadata?: Record<string, string> | undefined;
21
24
  }>;
25
+ export declare const meteredPriceSchema: z.ZodObject<{
26
+ providerPriceId: z.ZodString;
27
+ unitAmount: z.ZodNumber;
28
+ currency: z.ZodEnum<["usd"]>;
29
+ interval: z.ZodEnum<["month", "year"]>;
30
+ aggregation: z.ZodEnum<["sum", "lastDuringPeriod", "lastEver", "max"]>;
31
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ providerPriceId: string;
34
+ currency: "usd";
35
+ interval: "month" | "year";
36
+ unitAmount: number;
37
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
38
+ metadata?: Record<string, string> | undefined;
39
+ }, {
40
+ providerPriceId: string;
41
+ currency: "usd";
42
+ interval: "month" | "year";
43
+ unitAmount: number;
44
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
45
+ metadata?: Record<string, string> | undefined;
46
+ }>;
22
47
  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"]>;
23
48
  export declare const planSchema: z.ZodObject<{
24
49
  id: z.ZodString;
@@ -142,6 +167,66 @@ export declare const addOnSchema: z.ZodObject<{
142
167
  prorationDisabled?: boolean | undefined;
143
168
  autoRechargeable?: boolean | undefined;
144
169
  }>;
170
+ export declare const meterSchema: z.ZodObject<{
171
+ id: z.ZodString;
172
+ name: z.ZodString;
173
+ description: z.ZodString;
174
+ providerProductId: z.ZodString;
175
+ prices: z.ZodRecord<z.ZodEnum<["month", "year"]>, z.ZodObject<{
176
+ providerPriceId: z.ZodString;
177
+ unitAmount: z.ZodNumber;
178
+ currency: z.ZodEnum<["usd"]>;
179
+ interval: z.ZodEnum<["month", "year"]>;
180
+ aggregation: z.ZodEnum<["sum", "lastDuringPeriod", "lastEver", "max"]>;
181
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
182
+ }, "strip", z.ZodTypeAny, {
183
+ providerPriceId: string;
184
+ currency: "usd";
185
+ interval: "month" | "year";
186
+ unitAmount: number;
187
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
188
+ metadata?: Record<string, string> | undefined;
189
+ }, {
190
+ providerPriceId: string;
191
+ currency: "usd";
192
+ interval: "month" | "year";
193
+ unitAmount: number;
194
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
195
+ metadata?: Record<string, string> | undefined;
196
+ }>>;
197
+ meterType: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
198
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
199
+ }, "strip", z.ZodTypeAny, {
200
+ id: string;
201
+ name: string;
202
+ description: string;
203
+ providerProductId: string;
204
+ prices: Partial<Record<"month" | "year", {
205
+ providerPriceId: string;
206
+ currency: "usd";
207
+ interval: "month" | "year";
208
+ unitAmount: number;
209
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
210
+ metadata?: Record<string, string> | undefined;
211
+ }>>;
212
+ meterType: "creditGrant" | "payAsYouGo";
213
+ metadata?: Record<string, string> | undefined;
214
+ }, {
215
+ id: string;
216
+ name: string;
217
+ description: string;
218
+ providerProductId: string;
219
+ prices: Partial<Record<"month" | "year", {
220
+ providerPriceId: string;
221
+ currency: "usd";
222
+ interval: "month" | "year";
223
+ unitAmount: number;
224
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
225
+ metadata?: Record<string, string> | undefined;
226
+ }>>;
227
+ meterType: "creditGrant" | "payAsYouGo";
228
+ metadata?: Record<string, string> | undefined;
229
+ }>;
145
230
  export declare const billingVersionConfigSchema: z.ZodObject<{
146
231
  version: z.ZodEnum<["v4"]>;
147
232
  name: z.ZodString;
@@ -268,6 +353,66 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
268
353
  prorationDisabled?: boolean | undefined;
269
354
  autoRechargeable?: boolean | undefined;
270
355
  }>>;
356
+ meters: z.ZodRecord<z.ZodString, z.ZodObject<{
357
+ id: z.ZodString;
358
+ name: z.ZodString;
359
+ description: z.ZodString;
360
+ providerProductId: z.ZodString;
361
+ prices: z.ZodRecord<z.ZodEnum<["month", "year"]>, z.ZodObject<{
362
+ providerPriceId: z.ZodString;
363
+ unitAmount: z.ZodNumber;
364
+ currency: z.ZodEnum<["usd"]>;
365
+ interval: z.ZodEnum<["month", "year"]>;
366
+ aggregation: z.ZodEnum<["sum", "lastDuringPeriod", "lastEver", "max"]>;
367
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
368
+ }, "strip", z.ZodTypeAny, {
369
+ providerPriceId: string;
370
+ currency: "usd";
371
+ interval: "month" | "year";
372
+ unitAmount: number;
373
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
374
+ metadata?: Record<string, string> | undefined;
375
+ }, {
376
+ providerPriceId: string;
377
+ currency: "usd";
378
+ interval: "month" | "year";
379
+ unitAmount: number;
380
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
381
+ metadata?: Record<string, string> | undefined;
382
+ }>>;
383
+ meterType: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
384
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
385
+ }, "strip", z.ZodTypeAny, {
386
+ id: string;
387
+ name: string;
388
+ description: string;
389
+ providerProductId: string;
390
+ prices: Partial<Record<"month" | "year", {
391
+ providerPriceId: string;
392
+ currency: "usd";
393
+ interval: "month" | "year";
394
+ unitAmount: number;
395
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
396
+ metadata?: Record<string, string> | undefined;
397
+ }>>;
398
+ meterType: "creditGrant" | "payAsYouGo";
399
+ metadata?: Record<string, string> | undefined;
400
+ }, {
401
+ id: string;
402
+ name: string;
403
+ description: string;
404
+ providerProductId: string;
405
+ prices: Partial<Record<"month" | "year", {
406
+ providerPriceId: string;
407
+ currency: "usd";
408
+ interval: "month" | "year";
409
+ unitAmount: number;
410
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
411
+ metadata?: Record<string, string> | undefined;
412
+ }>>;
413
+ meterType: "creditGrant" | "payAsYouGo";
414
+ metadata?: Record<string, string> | undefined;
415
+ }>>;
271
416
  isActive: z.ZodBoolean;
272
417
  createdAt: z.ZodString;
273
418
  }, "strip", z.ZodTypeAny, {
@@ -308,6 +453,22 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
308
453
  prorationDisabled?: boolean | undefined;
309
454
  autoRechargeable?: boolean | undefined;
310
455
  }>;
456
+ meters: Record<string, {
457
+ id: string;
458
+ name: string;
459
+ description: string;
460
+ providerProductId: string;
461
+ prices: Partial<Record<"month" | "year", {
462
+ providerPriceId: string;
463
+ currency: "usd";
464
+ interval: "month" | "year";
465
+ unitAmount: number;
466
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
467
+ metadata?: Record<string, string> | undefined;
468
+ }>>;
469
+ meterType: "creditGrant" | "payAsYouGo";
470
+ metadata?: Record<string, string> | undefined;
471
+ }>;
311
472
  isActive: boolean;
312
473
  createdAt: string;
313
474
  }, {
@@ -348,6 +509,22 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
348
509
  prorationDisabled?: boolean | undefined;
349
510
  autoRechargeable?: boolean | undefined;
350
511
  }>;
512
+ meters: Record<string, {
513
+ id: string;
514
+ name: string;
515
+ description: string;
516
+ providerProductId: string;
517
+ prices: Partial<Record<"month" | "year", {
518
+ providerPriceId: string;
519
+ currency: "usd";
520
+ interval: "month" | "year";
521
+ unitAmount: number;
522
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
523
+ metadata?: Record<string, string> | undefined;
524
+ }>>;
525
+ meterType: "creditGrant" | "payAsYouGo";
526
+ metadata?: Record<string, string> | undefined;
527
+ }>;
351
528
  isActive: boolean;
352
529
  createdAt: string;
353
530
  }>;
@@ -477,6 +654,66 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
477
654
  prorationDisabled?: boolean | undefined;
478
655
  autoRechargeable?: boolean | undefined;
479
656
  }>>;
657
+ meters: z.ZodRecord<z.ZodString, z.ZodObject<{
658
+ id: z.ZodString;
659
+ name: z.ZodString;
660
+ description: z.ZodString;
661
+ providerProductId: z.ZodString;
662
+ prices: z.ZodRecord<z.ZodEnum<["month", "year"]>, z.ZodObject<{
663
+ providerPriceId: z.ZodString;
664
+ unitAmount: z.ZodNumber;
665
+ currency: z.ZodEnum<["usd"]>;
666
+ interval: z.ZodEnum<["month", "year"]>;
667
+ aggregation: z.ZodEnum<["sum", "lastDuringPeriod", "lastEver", "max"]>;
668
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
669
+ }, "strip", z.ZodTypeAny, {
670
+ providerPriceId: string;
671
+ currency: "usd";
672
+ interval: "month" | "year";
673
+ unitAmount: number;
674
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
675
+ metadata?: Record<string, string> | undefined;
676
+ }, {
677
+ providerPriceId: string;
678
+ currency: "usd";
679
+ interval: "month" | "year";
680
+ unitAmount: number;
681
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
682
+ metadata?: Record<string, string> | undefined;
683
+ }>>;
684
+ meterType: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
685
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
686
+ }, "strip", z.ZodTypeAny, {
687
+ id: string;
688
+ name: string;
689
+ description: string;
690
+ providerProductId: string;
691
+ prices: Partial<Record<"month" | "year", {
692
+ providerPriceId: string;
693
+ currency: "usd";
694
+ interval: "month" | "year";
695
+ unitAmount: number;
696
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
697
+ metadata?: Record<string, string> | undefined;
698
+ }>>;
699
+ meterType: "creditGrant" | "payAsYouGo";
700
+ metadata?: Record<string, string> | undefined;
701
+ }, {
702
+ id: string;
703
+ name: string;
704
+ description: string;
705
+ providerProductId: string;
706
+ prices: Partial<Record<"month" | "year", {
707
+ providerPriceId: string;
708
+ currency: "usd";
709
+ interval: "month" | "year";
710
+ unitAmount: number;
711
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
712
+ metadata?: Record<string, string> | undefined;
713
+ }>>;
714
+ meterType: "creditGrant" | "payAsYouGo";
715
+ metadata?: Record<string, string> | undefined;
716
+ }>>;
480
717
  isActive: z.ZodBoolean;
481
718
  createdAt: z.ZodString;
482
719
  }, "strip", z.ZodTypeAny, {
@@ -517,6 +754,22 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
517
754
  prorationDisabled?: boolean | undefined;
518
755
  autoRechargeable?: boolean | undefined;
519
756
  }>;
757
+ meters: Record<string, {
758
+ id: string;
759
+ name: string;
760
+ description: string;
761
+ providerProductId: string;
762
+ prices: Partial<Record<"month" | "year", {
763
+ providerPriceId: string;
764
+ currency: "usd";
765
+ interval: "month" | "year";
766
+ unitAmount: number;
767
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
768
+ metadata?: Record<string, string> | undefined;
769
+ }>>;
770
+ meterType: "creditGrant" | "payAsYouGo";
771
+ metadata?: Record<string, string> | undefined;
772
+ }>;
520
773
  isActive: boolean;
521
774
  createdAt: string;
522
775
  }, {
@@ -557,6 +810,22 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
557
810
  prorationDisabled?: boolean | undefined;
558
811
  autoRechargeable?: boolean | undefined;
559
812
  }>;
813
+ meters: Record<string, {
814
+ id: string;
815
+ name: string;
816
+ description: string;
817
+ providerProductId: string;
818
+ prices: Partial<Record<"month" | "year", {
819
+ providerPriceId: string;
820
+ currency: "usd";
821
+ interval: "month" | "year";
822
+ unitAmount: number;
823
+ aggregation: "lastDuringPeriod" | "sum" | "lastEver" | "max";
824
+ metadata?: Record<string, string> | undefined;
825
+ }>>;
826
+ meterType: "creditGrant" | "payAsYouGo";
827
+ metadata?: Record<string, string> | undefined;
828
+ }>;
560
829
  isActive: boolean;
561
830
  createdAt: string;
562
831
  }>>;
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.meteredPriceSchema = 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(),
@@ -12,6 +15,14 @@ exports.priceSchema = zod_1.z.object({
12
15
  interval: exports.intervalSchema,
13
16
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
14
17
  });
18
+ exports.meteredPriceSchema = zod_1.z.object({
19
+ providerPriceId: zod_1.z.string(),
20
+ unitAmount: exports.unitAmountSchema,
21
+ currency: zod_1.z.enum(['usd']),
22
+ interval: exports.intervalSchema,
23
+ aggregation: exports.aggregationSchema,
24
+ metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
25
+ });
15
26
  exports.featureSchema = zod_1.z.enum(billing_features_1.BILLING_FEATURE_IDS);
16
27
  exports.planSchema = zod_1.z.object({
17
28
  id: zod_1.z.string(),
@@ -35,12 +46,22 @@ exports.addOnSchema = zod_1.z.object({
35
46
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
36
47
  autoRechargeable: zod_1.z.boolean().optional(),
37
48
  });
49
+ exports.meterSchema = zod_1.z.object({
50
+ id: zod_1.z.string(),
51
+ name: zod_1.z.string(),
52
+ description: zod_1.z.string(),
53
+ providerProductId: zod_1.z.string(),
54
+ prices: zod_1.z.record(exports.intervalSchema, exports.meteredPriceSchema),
55
+ meterType: exports.meterTypeSchema,
56
+ metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
57
+ });
38
58
  exports.billingVersionConfigSchema = zod_1.z.object({
39
59
  version: zod_1.z.enum(billing_versions_1.BILLING_VERSIONS),
40
60
  name: zod_1.z.string(),
41
61
  description: zod_1.z.string(),
42
62
  plans: zod_1.z.record(zod_1.z.string(), exports.planSchema),
43
63
  addons: zod_1.z.record(zod_1.z.string(), exports.addOnSchema),
64
+ meters: zod_1.z.record(zod_1.z.string(), exports.meterSchema),
44
65
  isActive: zod_1.z.boolean(),
45
66
  createdAt: zod_1.z.string(),
46
67
  });
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, meteredPriceSchema } 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;
@@ -20,6 +25,12 @@ export type BillingPriceDefinition = {
20
25
  currency: 'usd';
21
26
  interval: Interval;
22
27
  };
28
+ export type BillingMeteredPriceDefinition = {
29
+ unitAmount: number;
30
+ currency: 'usd';
31
+ interval: Interval;
32
+ aggregation: Aggregation;
33
+ };
23
34
  export type BillingPlanDefinition = {
24
35
  id: BillingPlanId;
25
36
  name: string;
@@ -39,6 +50,14 @@ export type BillingAddonDefinition = {
39
50
  prorationDisabled?: boolean;
40
51
  metadata?: Record<string, string>;
41
52
  };
53
+ export type BillingMeterDefinition = {
54
+ id: BillingMeterId;
55
+ name: string;
56
+ description: string;
57
+ prices: Array<BillingMeteredPriceDefinition>;
58
+ meterType: MeterType;
59
+ metadata?: Record<string, string>;
60
+ };
42
61
  export type BillingVersionId = (typeof BILLING_VERSIONS)[number];
43
62
  export type BillingVersionDefinition = {
44
63
  version: BillingVersionId;
@@ -46,6 +65,7 @@ export type BillingVersionDefinition = {
46
65
  description: string;
47
66
  plans: Partial<Record<BillingPlanId, BillingPlanDefinition>>;
48
67
  addons: Partial<Record<BillingAddonId, BillingAddonDefinition>>;
68
+ meters: Partial<Record<BillingMeterId, BillingMeterDefinition>>;
49
69
  isActive: boolean;
50
70
  createdAt: string;
51
71
  };
@@ -53,5 +73,7 @@ export type BillingDefinition = Record<BillingVersionId, BillingVersionDefinitio
53
73
  export type BillingVersionConfig = z.infer<typeof billingVersionConfigSchema>;
54
74
  export type BillingConfig = z.infer<typeof billingConfigSchema>;
55
75
  export type BillingPrice = z.infer<typeof priceSchema>;
76
+ export type BillingMeteredPrice = z.infer<typeof meteredPriceSchema>;
56
77
  export type BillingPlan = z.infer<typeof planSchema>;
57
78
  export type BillingAddon = z.infer<typeof addOnSchema>;
79
+ export type BillingMeter = z.infer<typeof meterSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpinternal/const",
3
- "version": "0.4.3",
3
+ "version": "0.5.1",
4
4
  "description": "Shared constants for Skynet billing refactor (vendored copy of upstream packages/const)",
5
5
  "license": "UNLICENSED",
6
6
  "files": [