@bpinternal/const 0.5.0 → 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.
- package/dist/billing-meters.d.ts +12 -8
- package/dist/billing-meters.js +16 -8
- package/dist/schema.d.ts +168 -52
- package/dist/schema.js +10 -5
- package/dist/types.d.ts +9 -5
- package/package.json +1 -1
package/dist/billing-meters.d.ts
CHANGED
|
@@ -4,20 +4,24 @@ 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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
readonly prices: [{
|
|
8
|
+
readonly unitAmount: 1;
|
|
9
|
+
readonly currency: "usd";
|
|
10
|
+
readonly interval: "month";
|
|
11
|
+
readonly aggregation: "lastDuringPeriod";
|
|
12
|
+
}];
|
|
11
13
|
readonly meterType: "creditGrant";
|
|
12
14
|
};
|
|
13
15
|
readonly ai_spend_pay_as_you_go: {
|
|
14
16
|
readonly id: "ai_spend_pay_as_you_go";
|
|
15
17
|
readonly name: "AI Spend - Pay as you go";
|
|
16
18
|
readonly description: "Usage-based charges for AI spend, billed monthly";
|
|
17
|
-
readonly
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
readonly prices: [{
|
|
20
|
+
readonly unitAmount: 1;
|
|
21
|
+
readonly currency: "usd";
|
|
22
|
+
readonly interval: "month";
|
|
23
|
+
readonly aggregation: "lastDuringPeriod";
|
|
24
|
+
}];
|
|
21
25
|
readonly meterType: "payAsYouGo";
|
|
22
26
|
};
|
|
23
27
|
};
|
package/dist/billing-meters.js
CHANGED
|
@@ -7,20 +7,28 @@ 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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
prices: [
|
|
11
|
+
{
|
|
12
|
+
unitAmount: 1,
|
|
13
|
+
currency: 'usd',
|
|
14
|
+
interval: 'month',
|
|
15
|
+
aggregation: 'lastDuringPeriod',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
14
18
|
meterType: 'creditGrant',
|
|
15
19
|
},
|
|
16
20
|
ai_spend_pay_as_you_go: {
|
|
17
21
|
id: 'ai_spend_pay_as_you_go',
|
|
18
22
|
name: 'AI Spend - Pay as you go',
|
|
19
23
|
description: 'Usage-based charges for AI spend, billed monthly',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
prices: [
|
|
25
|
+
{
|
|
26
|
+
unitAmount: 1,
|
|
27
|
+
currency: 'usd',
|
|
28
|
+
interval: 'month',
|
|
29
|
+
aggregation: 'lastDuringPeriod',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
24
32
|
meterType: 'payAsYouGo',
|
|
25
33
|
},
|
|
26
34
|
};
|
package/dist/schema.d.ts
CHANGED
|
@@ -22,6 +22,28 @@ export declare const priceSchema: z.ZodObject<{
|
|
|
22
22
|
interval: "month" | "year";
|
|
23
23
|
metadata?: Record<string, string> | undefined;
|
|
24
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
|
+
}>;
|
|
25
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"]>;
|
|
26
48
|
export declare const planSchema: z.ZodObject<{
|
|
27
49
|
id: z.ZodString;
|
|
@@ -150,32 +172,58 @@ export declare const meterSchema: z.ZodObject<{
|
|
|
150
172
|
name: z.ZodString;
|
|
151
173
|
description: z.ZodString;
|
|
152
174
|
providerProductId: z.ZodString;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
+
}>>;
|
|
157
197
|
meterType: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
|
|
158
198
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
159
199
|
}, "strip", z.ZodTypeAny, {
|
|
160
|
-
currency: "usd";
|
|
161
|
-
interval: "month" | "year";
|
|
162
200
|
id: string;
|
|
163
201
|
name: string;
|
|
164
202
|
description: string;
|
|
165
203
|
providerProductId: string;
|
|
166
|
-
|
|
167
|
-
|
|
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
|
+
}>>;
|
|
168
212
|
meterType: "creditGrant" | "payAsYouGo";
|
|
169
213
|
metadata?: Record<string, string> | undefined;
|
|
170
214
|
}, {
|
|
171
|
-
currency: "usd";
|
|
172
|
-
interval: "month" | "year";
|
|
173
215
|
id: string;
|
|
174
216
|
name: string;
|
|
175
217
|
description: string;
|
|
176
218
|
providerProductId: string;
|
|
177
|
-
|
|
178
|
-
|
|
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
|
+
}>>;
|
|
179
227
|
meterType: "creditGrant" | "payAsYouGo";
|
|
180
228
|
metadata?: Record<string, string> | undefined;
|
|
181
229
|
}>;
|
|
@@ -310,32 +358,58 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
310
358
|
name: z.ZodString;
|
|
311
359
|
description: z.ZodString;
|
|
312
360
|
providerProductId: z.ZodString;
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
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
|
+
}>>;
|
|
317
383
|
meterType: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
|
|
318
384
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
319
385
|
}, "strip", z.ZodTypeAny, {
|
|
320
|
-
currency: "usd";
|
|
321
|
-
interval: "month" | "year";
|
|
322
386
|
id: string;
|
|
323
387
|
name: string;
|
|
324
388
|
description: string;
|
|
325
389
|
providerProductId: string;
|
|
326
|
-
|
|
327
|
-
|
|
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
|
+
}>>;
|
|
328
398
|
meterType: "creditGrant" | "payAsYouGo";
|
|
329
399
|
metadata?: Record<string, string> | undefined;
|
|
330
400
|
}, {
|
|
331
|
-
currency: "usd";
|
|
332
|
-
interval: "month" | "year";
|
|
333
401
|
id: string;
|
|
334
402
|
name: string;
|
|
335
403
|
description: string;
|
|
336
404
|
providerProductId: string;
|
|
337
|
-
|
|
338
|
-
|
|
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
|
+
}>>;
|
|
339
413
|
meterType: "creditGrant" | "payAsYouGo";
|
|
340
414
|
metadata?: Record<string, string> | undefined;
|
|
341
415
|
}>>;
|
|
@@ -380,14 +454,18 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
380
454
|
autoRechargeable?: boolean | undefined;
|
|
381
455
|
}>;
|
|
382
456
|
meters: Record<string, {
|
|
383
|
-
currency: "usd";
|
|
384
|
-
interval: "month" | "year";
|
|
385
457
|
id: string;
|
|
386
458
|
name: string;
|
|
387
459
|
description: string;
|
|
388
460
|
providerProductId: string;
|
|
389
|
-
|
|
390
|
-
|
|
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
|
+
}>>;
|
|
391
469
|
meterType: "creditGrant" | "payAsYouGo";
|
|
392
470
|
metadata?: Record<string, string> | undefined;
|
|
393
471
|
}>;
|
|
@@ -432,14 +510,18 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
|
|
|
432
510
|
autoRechargeable?: boolean | undefined;
|
|
433
511
|
}>;
|
|
434
512
|
meters: Record<string, {
|
|
435
|
-
currency: "usd";
|
|
436
|
-
interval: "month" | "year";
|
|
437
513
|
id: string;
|
|
438
514
|
name: string;
|
|
439
515
|
description: string;
|
|
440
516
|
providerProductId: string;
|
|
441
|
-
|
|
442
|
-
|
|
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
|
+
}>>;
|
|
443
525
|
meterType: "creditGrant" | "payAsYouGo";
|
|
444
526
|
metadata?: Record<string, string> | undefined;
|
|
445
527
|
}>;
|
|
@@ -577,32 +659,58 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
|
|
|
577
659
|
name: z.ZodString;
|
|
578
660
|
description: z.ZodString;
|
|
579
661
|
providerProductId: z.ZodString;
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
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
|
+
}>>;
|
|
584
684
|
meterType: z.ZodEnum<["payAsYouGo", "creditGrant"]>;
|
|
585
685
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
586
686
|
}, "strip", z.ZodTypeAny, {
|
|
587
|
-
currency: "usd";
|
|
588
|
-
interval: "month" | "year";
|
|
589
687
|
id: string;
|
|
590
688
|
name: string;
|
|
591
689
|
description: string;
|
|
592
690
|
providerProductId: string;
|
|
593
|
-
|
|
594
|
-
|
|
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
|
+
}>>;
|
|
595
699
|
meterType: "creditGrant" | "payAsYouGo";
|
|
596
700
|
metadata?: Record<string, string> | undefined;
|
|
597
701
|
}, {
|
|
598
|
-
currency: "usd";
|
|
599
|
-
interval: "month" | "year";
|
|
600
702
|
id: string;
|
|
601
703
|
name: string;
|
|
602
704
|
description: string;
|
|
603
705
|
providerProductId: string;
|
|
604
|
-
|
|
605
|
-
|
|
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
|
+
}>>;
|
|
606
714
|
meterType: "creditGrant" | "payAsYouGo";
|
|
607
715
|
metadata?: Record<string, string> | undefined;
|
|
608
716
|
}>>;
|
|
@@ -647,14 +755,18 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
|
|
|
647
755
|
autoRechargeable?: boolean | undefined;
|
|
648
756
|
}>;
|
|
649
757
|
meters: Record<string, {
|
|
650
|
-
currency: "usd";
|
|
651
|
-
interval: "month" | "year";
|
|
652
758
|
id: string;
|
|
653
759
|
name: string;
|
|
654
760
|
description: string;
|
|
655
761
|
providerProductId: string;
|
|
656
|
-
|
|
657
|
-
|
|
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
|
+
}>>;
|
|
658
770
|
meterType: "creditGrant" | "payAsYouGo";
|
|
659
771
|
metadata?: Record<string, string> | undefined;
|
|
660
772
|
}>;
|
|
@@ -699,14 +811,18 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
|
|
|
699
811
|
autoRechargeable?: boolean | undefined;
|
|
700
812
|
}>;
|
|
701
813
|
meters: Record<string, {
|
|
702
|
-
currency: "usd";
|
|
703
|
-
interval: "month" | "year";
|
|
704
814
|
id: string;
|
|
705
815
|
name: string;
|
|
706
816
|
description: string;
|
|
707
817
|
providerProductId: string;
|
|
708
|
-
|
|
709
|
-
|
|
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
|
+
}>>;
|
|
710
826
|
meterType: "creditGrant" | "payAsYouGo";
|
|
711
827
|
metadata?: Record<string, string> | undefined;
|
|
712
828
|
}>;
|
package/dist/schema.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
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");
|
|
@@ -15,6 +15,14 @@ exports.priceSchema = zod_1.z.object({
|
|
|
15
15
|
interval: exports.intervalSchema,
|
|
16
16
|
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
|
17
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
|
+
});
|
|
18
26
|
exports.featureSchema = zod_1.z.enum(billing_features_1.BILLING_FEATURE_IDS);
|
|
19
27
|
exports.planSchema = zod_1.z.object({
|
|
20
28
|
id: zod_1.z.string(),
|
|
@@ -43,10 +51,7 @@ exports.meterSchema = zod_1.z.object({
|
|
|
43
51
|
name: zod_1.z.string(),
|
|
44
52
|
description: zod_1.z.string(),
|
|
45
53
|
providerProductId: zod_1.z.string(),
|
|
46
|
-
|
|
47
|
-
unitAmount: exports.unitAmountSchema,
|
|
48
|
-
interval: exports.intervalSchema,
|
|
49
|
-
aggregation: exports.aggregationSchema,
|
|
54
|
+
prices: zod_1.z.record(exports.intervalSchema, exports.meteredPriceSchema),
|
|
50
55
|
meterType: exports.meterTypeSchema,
|
|
51
56
|
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
|
52
57
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { BILLING_FEATURE_IDS } from './billing-features';
|
|
|
2
2
|
import { BILLING_METERS_IDS } from './billing-meters';
|
|
3
3
|
import { BILLING_PLAN_IDS, BILLING_ADDON_IDS } from './billing-plans';
|
|
4
4
|
import { BILLING_VERSIONS } from './billing-versions';
|
|
5
|
-
import { billingVersionConfigSchema, billingConfigSchema, intervalSchema, unitAmountSchema, aggregationSchema, meterTypeSchema, priceSchema, planSchema, addOnSchema, meterSchema } from './schema';
|
|
5
|
+
import { billingVersionConfigSchema, billingConfigSchema, intervalSchema, unitAmountSchema, aggregationSchema, meterTypeSchema, priceSchema, planSchema, addOnSchema, meterSchema, meteredPriceSchema } from './schema';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
export type Interval = z.infer<typeof intervalSchema>;
|
|
8
8
|
export type UnitAmount = z.infer<typeof unitAmountSchema>;
|
|
@@ -25,6 +25,12 @@ export type BillingPriceDefinition = {
|
|
|
25
25
|
currency: 'usd';
|
|
26
26
|
interval: Interval;
|
|
27
27
|
};
|
|
28
|
+
export type BillingMeteredPriceDefinition = {
|
|
29
|
+
unitAmount: number;
|
|
30
|
+
currency: 'usd';
|
|
31
|
+
interval: Interval;
|
|
32
|
+
aggregation: Aggregation;
|
|
33
|
+
};
|
|
28
34
|
export type BillingPlanDefinition = {
|
|
29
35
|
id: BillingPlanId;
|
|
30
36
|
name: string;
|
|
@@ -48,10 +54,7 @@ export type BillingMeterDefinition = {
|
|
|
48
54
|
id: BillingMeterId;
|
|
49
55
|
name: string;
|
|
50
56
|
description: string;
|
|
51
|
-
|
|
52
|
-
unitAmount: UnitAmount;
|
|
53
|
-
interval: Interval;
|
|
54
|
-
aggregation: Aggregation;
|
|
57
|
+
prices: Array<BillingMeteredPriceDefinition>;
|
|
55
58
|
meterType: MeterType;
|
|
56
59
|
metadata?: Record<string, string>;
|
|
57
60
|
};
|
|
@@ -70,6 +73,7 @@ export type BillingDefinition = Record<BillingVersionId, BillingVersionDefinitio
|
|
|
70
73
|
export type BillingVersionConfig = z.infer<typeof billingVersionConfigSchema>;
|
|
71
74
|
export type BillingConfig = z.infer<typeof billingConfigSchema>;
|
|
72
75
|
export type BillingPrice = z.infer<typeof priceSchema>;
|
|
76
|
+
export type BillingMeteredPrice = z.infer<typeof meteredPriceSchema>;
|
|
73
77
|
export type BillingPlan = z.infer<typeof planSchema>;
|
|
74
78
|
export type BillingAddon = z.infer<typeof addOnSchema>;
|
|
75
79
|
export type BillingMeter = z.infer<typeof meterSchema>;
|