@bpinternal/const 0.11.0 → 0.13.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.
Files changed (38) hide show
  1. package/dist/billing-legacy/consts.d.ts +9 -0
  2. package/dist/billing-legacy/consts.js +53 -0
  3. package/dist/billing-legacy/index.d.ts +2 -0
  4. package/dist/billing-legacy/index.js +18 -0
  5. package/dist/billing-next/config/addons.d.ts +181 -0
  6. package/dist/{billing-addons.js → billing-next/config/addons.js} +70 -47
  7. package/dist/billing-next/config/index.d.ts +5 -0
  8. package/dist/billing-next/config/index.js +18 -0
  9. package/dist/{billing-meters.d.ts → billing-next/config/meters.d.ts} +22 -12
  10. package/dist/{billing-meters.js → billing-next/config/meters.js} +15 -9
  11. package/dist/billing-next/config/plans.d.ts +170 -0
  12. package/dist/{billing-plans.js → billing-next/config/plans.js} +66 -59
  13. package/dist/{schema.d.ts → billing-next/config/schemas.d.ts} +392 -196
  14. package/dist/{schema.js → billing-next/config/schemas.js} +19 -12
  15. package/dist/billing-next/config/versions.d.ts +829 -0
  16. package/dist/billing-next/config/versions.js +27 -0
  17. package/dist/billing-next/consts.d.ts +5 -0
  18. package/dist/billing-next/consts.js +8 -0
  19. package/dist/billing-next/features.d.ts +125 -0
  20. package/dist/billing-next/features.js +127 -0
  21. package/dist/billing-next/index.d.ts +3 -0
  22. package/dist/billing-next/index.js +19 -0
  23. package/dist/billing-next/type-utils.d.ts +4 -0
  24. package/dist/{types.js → billing-next/type-utils.js} +1 -0
  25. package/dist/index.d.ts +2 -9
  26. package/dist/index.js +2 -10
  27. package/package.json +1 -1
  28. package/dist/billing-addons.d.ts +0 -136
  29. package/dist/billing-features.d.ts +0 -94
  30. package/dist/billing-features.js +0 -132
  31. package/dist/billing-plans.d.ts +0 -127
  32. package/dist/billing-versions.d.ts +0 -10
  33. package/dist/billing-versions.js +0 -37
  34. package/dist/types.d.ts +0 -82
  35. package/dist/usage-metadata.d.ts +0 -22
  36. package/dist/usage-metadata.js +0 -138
  37. /package/dist/{quotas.d.ts → billing-legacy/quotas.d.ts} +0 -0
  38. /package/dist/{quotas.js → billing-legacy/quotas.js} +0 -0
@@ -1,44 +1,47 @@
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.meteredPriceSchema = exports.priceSchema = exports.meterTypeSchema = exports.aggregationSchema = exports.unitAmountSchema = exports.intervalSchema = void 0;
3
+ exports.billingConfigSchema = exports.billingVersionConfigSchema = exports.meterSchema = exports.addOnSchema = exports.planSchema = exports.meteredPriceSchema = exports.priceSchema = exports.meterTypeSchema = exports.aggregationSchema = exports.unitAmountSchema = exports.intervalSchema = exports.featureSchema = exports.UNKNOWN_STRIPE_ID = void 0;
4
4
  const zod_1 = require("zod");
5
- const billing_versions_1 = require("./billing-versions");
6
- const billing_features_1 = require("./billing-features");
5
+ const features_1 = require("../features");
6
+ /**
7
+ * Stripe Identifier that is currently unknown when defining the billing config, but will be filled later by pulumi during deployment.
8
+ * This allows us to have a reference to the Stripe products and prices in our billing config without having to hardcode them before they are created in Stripe.
9
+ */
10
+ exports.UNKNOWN_STRIPE_ID = '__UNKNOWN_STRIPE_ID__';
11
+ exports.featureSchema = zod_1.z.enum(features_1.BILLING_FEATURE_IDS);
7
12
  exports.intervalSchema = zod_1.z.enum(['month', 'year']);
8
13
  exports.unitAmountSchema = zod_1.z.number().int().min(1);
9
14
  exports.aggregationSchema = zod_1.z.enum(['sum', 'count']);
10
15
  exports.meterTypeSchema = zod_1.z.enum(['payAsYouGo', 'creditGrant']);
11
16
  exports.priceSchema = zod_1.z.object({
12
- providerPriceId: zod_1.z.string(),
13
17
  amount: zod_1.z.number(),
14
18
  currency: zod_1.z.enum(['usd']),
15
19
  interval: exports.intervalSchema,
16
20
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
21
+ providerPriceId: zod_1.z.string(), // pulumi
17
22
  });
18
23
  exports.meteredPriceSchema = zod_1.z.object({
19
- providerPriceId: zod_1.z.string(),
20
24
  unitAmount: exports.unitAmountSchema,
21
25
  currency: zod_1.z.enum(['usd']),
22
26
  interval: exports.intervalSchema,
23
27
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
28
+ providerPriceId: zod_1.z.string(), // pulumi
24
29
  });
25
- exports.featureSchema = zod_1.z.enum(billing_features_1.BILLING_FEATURE_IDS);
26
30
  exports.planSchema = zod_1.z.object({
27
31
  id: zod_1.z.string(),
28
32
  name: zod_1.z.string(),
29
33
  description: zod_1.z.string(),
30
34
  tierIndex: zod_1.z.number(),
31
- providerProductId: zod_1.z.string(),
32
35
  prices: zod_1.z.record(exports.intervalSchema, exports.priceSchema),
33
36
  features: zod_1.z.record(exports.featureSchema, zod_1.z.union([zod_1.z.number(), zod_1.z.boolean()])),
34
37
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
38
+ providerProductId: zod_1.z.string(), // pulumi
35
39
  });
36
40
  exports.addOnSchema = zod_1.z
37
41
  .object({
38
42
  id: zod_1.z.string(),
39
43
  name: zod_1.z.string(),
40
44
  description: zod_1.z.string(),
41
- providerProductId: zod_1.z.string(),
42
45
  prices: zod_1.z.record(exports.intervalSchema, exports.priceSchema),
43
46
  feature: exports.featureSchema,
44
47
  increment: zod_1.z.number().positive(),
@@ -47,6 +50,7 @@ exports.addOnSchema = zod_1.z
47
50
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
48
51
  autoRechargeable: zod_1.z.boolean().optional(),
49
52
  hidden: zod_1.z.boolean().optional(),
53
+ providerProductId: zod_1.z.string(), // pulumi
50
54
  })
51
55
  .superRefine((data, ctx) => {
52
56
  if (!data.increments) {
@@ -64,14 +68,17 @@ exports.meterSchema = zod_1.z.object({
64
68
  id: zod_1.z.string(),
65
69
  name: zod_1.z.string(),
66
70
  description: zod_1.z.string(),
67
- providerProductId: zod_1.z.string(),
68
- providerMeterId: zod_1.z.string(),
71
+ defaultAggregation: zod_1.z.object({ formula: exports.aggregationSchema }).optional(),
72
+ customerMapping: zod_1.z.object({ eventPayloadKey: zod_1.z.literal('stripe_customer_id'), type: zod_1.z.literal('by_id') }).optional(),
73
+ valueSettings: zod_1.z.object({ eventPayloadKey: zod_1.z.literal('value') }).optional(),
69
74
  prices: zod_1.z.record(exports.intervalSchema, exports.meteredPriceSchema),
70
75
  meterType: exports.meterTypeSchema,
71
76
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
77
+ providerProductId: zod_1.z.string(), // pulumi
78
+ providerMeterId: zod_1.z.string(), // pulumi
72
79
  });
73
80
  exports.billingVersionConfigSchema = zod_1.z.object({
74
- version: zod_1.z.enum(billing_versions_1.BILLING_VERSIONS),
81
+ version: zod_1.z.string(),
75
82
  name: zod_1.z.string(),
76
83
  description: zod_1.z.string(),
77
84
  plans: zod_1.z.record(zod_1.z.string(), exports.planSchema),
@@ -80,4 +87,4 @@ exports.billingVersionConfigSchema = zod_1.z.object({
80
87
  isActive: zod_1.z.boolean(),
81
88
  createdAt: zod_1.z.string(),
82
89
  });
83
- exports.billingConfigSchema = zod_1.z.record(zod_1.z.enum(billing_versions_1.BILLING_VERSIONS), exports.billingVersionConfigSchema);
90
+ exports.billingConfigSchema = zod_1.z.record(zod_1.z.string(), exports.billingVersionConfigSchema);