@bpinternal/const 0.10.0 → 0.12.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.
@@ -5,7 +5,7 @@
5
5
  export declare const FREE_PRICE = -1;
6
6
  export declare const ALLOWED_TRIAL_LENGTHS_IN_DAYS = 7;
7
7
  export declare const ALLOWED_TRIAL_PLANS: readonly ["plus", "team"];
8
- export declare const BILLING_PLAN_IDS: readonly ["community", "plus", "team", "enterprise"];
8
+ export declare const BILLING_PLAN_IDS: readonly ["community", "plus", "team", "enterprise", "managed"];
9
9
  export declare const BILLING_ADDON_IDS: readonly ["bot_addon", "collaborator_addon", "always_alive_addon", "messages_events_addon", "table_rows_addon", "file_storage_addon", "vector_db_storage_addon", "web_search_addon", "ai_credits_addon", "enterprise_ai_token", "enterprise_additional_workspace"];
10
10
  export declare const billingPlansDefs: {
11
11
  readonly community: {
@@ -108,20 +108,47 @@ export declare const billingPlansDefs: {
108
108
  readonly interval: "month";
109
109
  }];
110
110
  readonly features: {
111
- readonly human_in_the_loop: true;
112
- readonly ratelimit: 10000;
113
- readonly incoming_messages_events: 1000000;
114
- readonly integration_spend: 5000000000;
115
- readonly integration_subscription: true;
116
- readonly table_rows: 10000000;
117
- readonly bot_count: 100;
118
- readonly always_alive_count: 50;
119
- readonly always_alive_concurrency: 3;
120
- readonly collaborator_count: 100;
121
- readonly file_storage: 1000000000000;
122
- readonly vector_db_storage: 500000000000;
123
- readonly saved_versions: 1000;
124
- readonly indexed_file_count: 10000;
111
+ human_in_the_loop: boolean;
112
+ ratelimit: number;
113
+ incoming_messages_events: number;
114
+ integration_spend: number;
115
+ integration_subscription: boolean;
116
+ table_rows: number;
117
+ bot_count: number;
118
+ always_alive_count: number;
119
+ always_alive_concurrency: number;
120
+ collaborator_count: number;
121
+ file_storage: number;
122
+ vector_db_storage: number;
123
+ saved_versions: number;
124
+ indexed_file_count: number;
125
+ };
126
+ };
127
+ readonly managed: {
128
+ readonly id: "managed";
129
+ readonly name: "Plan - Managed";
130
+ readonly description: "Managed license subscription";
131
+ readonly tierIndex: 4;
132
+ readonly prices: [{
133
+ readonly price: -1;
134
+ readonly currency: "usd";
135
+ readonly interval: "month";
136
+ }];
137
+ readonly features: {
138
+ human_in_the_loop: boolean;
139
+ ratelimit: number;
140
+ incoming_messages_events: number;
141
+ integration_spend: number;
142
+ integration_subscription: boolean;
143
+ table_rows: number;
144
+ bot_count: number;
145
+ always_alive_count: number;
146
+ always_alive_concurrency: number;
147
+ collaborator_count: number;
148
+ file_storage: number;
149
+ vector_db_storage: number;
150
+ saved_versions: number;
151
+ indexed_file_count: number;
125
152
  };
126
153
  };
127
154
  };
@@ -9,7 +9,7 @@ exports.FREE_PRICE = -1;
9
9
  exports.ALLOWED_TRIAL_LENGTHS_IN_DAYS = 7;
10
10
  exports.ALLOWED_TRIAL_PLANS = ['plus', 'team'];
11
11
  // keep this in order of lowest to highest tier
12
- exports.BILLING_PLAN_IDS = ['community', 'plus', 'team', 'enterprise'];
12
+ exports.BILLING_PLAN_IDS = ['community', 'plus', 'team', 'enterprise', 'managed'];
13
13
  exports.BILLING_ADDON_IDS = [
14
14
  'bot_addon',
15
15
  'collaborator_addon',
@@ -23,6 +23,22 @@ exports.BILLING_ADDON_IDS = [
23
23
  'enterprise_ai_token',
24
24
  'enterprise_additional_workspace',
25
25
  ];
26
+ const ENTERPRISE_PLAN_FEATURES = {
27
+ human_in_the_loop: true,
28
+ ratelimit: 10000,
29
+ incoming_messages_events: 1000000,
30
+ integration_spend: 5_000_000_000, // $5 in nano-dollars
31
+ integration_subscription: true,
32
+ table_rows: 10000000,
33
+ bot_count: 100,
34
+ always_alive_count: 50,
35
+ always_alive_concurrency: 3,
36
+ collaborator_count: 100,
37
+ file_storage: 1000_000_000_000, // 1000 GB
38
+ vector_db_storage: 500_000_000_000, // 500 GB
39
+ saved_versions: 1000,
40
+ indexed_file_count: 10_000,
41
+ };
26
42
  /* IMPORTANT: the `name` field is used to match existing products in Stripe DO NOT CHANGE THE NAME OF AN EXISTING PRODUCT */
27
43
  exports.billingPlansDefs = {
28
44
  community: {
@@ -134,21 +150,20 @@ exports.billingPlansDefs = {
134
150
  interval: 'month',
135
151
  },
136
152
  ],
137
- features: {
138
- human_in_the_loop: true,
139
- ratelimit: 10000,
140
- incoming_messages_events: 1000000,
141
- integration_spend: 5_000_000_000, // $5 in nano-dollars
142
- integration_subscription: true,
143
- table_rows: 10000000,
144
- bot_count: 100,
145
- always_alive_count: 50,
146
- always_alive_concurrency: 3,
147
- collaborator_count: 100,
148
- file_storage: 1000_000_000_000, // 1000 GB
149
- vector_db_storage: 500_000_000_000, // 500 GB
150
- saved_versions: 1000,
151
- indexed_file_count: 10_000,
152
- },
153
+ features: ENTERPRISE_PLAN_FEATURES,
154
+ },
155
+ managed: {
156
+ id: 'managed',
157
+ name: 'Plan - Managed',
158
+ description: 'Managed license subscription',
159
+ tierIndex: 4,
160
+ prices: [
161
+ {
162
+ price: exports.FREE_PRICE, // Custom pricing
163
+ currency: 'usd',
164
+ interval: 'month',
165
+ },
166
+ ],
167
+ features: ENTERPRISE_PLAN_FEATURES,
153
168
  },
154
169
  };
package/dist/schema.d.ts CHANGED
@@ -67,13 +67,12 @@ export declare const planSchema: z.ZodObject<{
67
67
  interval: "month" | "year";
68
68
  metadata?: Record<string, string> | undefined;
69
69
  }>>;
70
- features: z.ZodRecord<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", "indexed_file_count", "saved_versions"]>, z.ZodAny>;
70
+ features: z.ZodRecord<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", "indexed_file_count", "saved_versions"]>, z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
71
71
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
72
72
  }, "strip", z.ZodTypeAny, {
73
73
  id: string;
74
74
  name: string;
75
75
  description: string;
76
- tierIndex: number;
77
76
  providerProductId: string;
78
77
  prices: Partial<Record<"month" | "year", {
79
78
  providerPriceId: string;
@@ -82,13 +81,13 @@ export declare const planSchema: z.ZodObject<{
82
81
  interval: "month" | "year";
83
82
  metadata?: Record<string, string> | undefined;
84
83
  }>>;
85
- features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", any>>;
84
+ tierIndex: number;
85
+ features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number | boolean>>;
86
86
  metadata?: Record<string, string> | undefined;
87
87
  }, {
88
88
  id: string;
89
89
  name: string;
90
90
  description: string;
91
- tierIndex: number;
92
91
  providerProductId: string;
93
92
  prices: Partial<Record<"month" | "year", {
94
93
  providerPriceId: string;
@@ -97,10 +96,11 @@ export declare const planSchema: z.ZodObject<{
97
96
  interval: "month" | "year";
98
97
  metadata?: Record<string, string> | undefined;
99
98
  }>>;
100
- features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", any>>;
99
+ tierIndex: number;
100
+ features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number | boolean>>;
101
101
  metadata?: Record<string, string> | undefined;
102
102
  }>;
103
- export declare const addOnSchema: z.ZodObject<{
103
+ export declare const addOnSchema: z.ZodEffects<z.ZodObject<{
104
104
  id: z.ZodString;
105
105
  name: z.ZodString;
106
106
  description: z.ZodString;
@@ -126,6 +126,7 @@ export declare const addOnSchema: z.ZodObject<{
126
126
  }>>;
127
127
  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", "indexed_file_count", "saved_versions"]>;
128
128
  increment: z.ZodNumber;
129
+ increments: z.ZodOptional<z.ZodRecord<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", "indexed_file_count", "saved_versions"]>, z.ZodNumber>>;
129
130
  prorationDisabled: z.ZodOptional<z.ZodBoolean>;
130
131
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
131
132
  autoRechargeable: z.ZodOptional<z.ZodBoolean>;
@@ -145,6 +146,7 @@ export declare const addOnSchema: z.ZodObject<{
145
146
  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" | "indexed_file_count" | "saved_versions";
146
147
  increment: number;
147
148
  metadata?: Record<string, string> | undefined;
149
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
148
150
  prorationDisabled?: boolean | undefined;
149
151
  autoRechargeable?: boolean | undefined;
150
152
  hidden?: boolean | undefined;
@@ -163,6 +165,45 @@ export declare const addOnSchema: z.ZodObject<{
163
165
  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" | "indexed_file_count" | "saved_versions";
164
166
  increment: number;
165
167
  metadata?: Record<string, string> | undefined;
168
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
169
+ prorationDisabled?: boolean | undefined;
170
+ autoRechargeable?: boolean | undefined;
171
+ hidden?: boolean | undefined;
172
+ }>, {
173
+ id: string;
174
+ name: string;
175
+ description: string;
176
+ providerProductId: string;
177
+ prices: Partial<Record<"month" | "year", {
178
+ providerPriceId: string;
179
+ amount: number;
180
+ currency: "usd";
181
+ interval: "month" | "year";
182
+ metadata?: Record<string, string> | undefined;
183
+ }>>;
184
+ 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" | "indexed_file_count" | "saved_versions";
185
+ increment: number;
186
+ metadata?: Record<string, string> | undefined;
187
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
188
+ prorationDisabled?: boolean | undefined;
189
+ autoRechargeable?: boolean | undefined;
190
+ hidden?: boolean | undefined;
191
+ }, {
192
+ id: string;
193
+ name: string;
194
+ description: string;
195
+ providerProductId: string;
196
+ prices: Partial<Record<"month" | "year", {
197
+ providerPriceId: string;
198
+ amount: number;
199
+ currency: "usd";
200
+ interval: "month" | "year";
201
+ metadata?: Record<string, string> | undefined;
202
+ }>>;
203
+ 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" | "indexed_file_count" | "saved_versions";
204
+ increment: number;
205
+ metadata?: Record<string, string> | undefined;
206
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
166
207
  prorationDisabled?: boolean | undefined;
167
208
  autoRechargeable?: boolean | undefined;
168
209
  hidden?: boolean | undefined;
@@ -254,13 +295,12 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
254
295
  interval: "month" | "year";
255
296
  metadata?: Record<string, string> | undefined;
256
297
  }>>;
257
- features: z.ZodRecord<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", "indexed_file_count", "saved_versions"]>, z.ZodAny>;
298
+ features: z.ZodRecord<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", "indexed_file_count", "saved_versions"]>, z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
258
299
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
259
300
  }, "strip", z.ZodTypeAny, {
260
301
  id: string;
261
302
  name: string;
262
303
  description: string;
263
- tierIndex: number;
264
304
  providerProductId: string;
265
305
  prices: Partial<Record<"month" | "year", {
266
306
  providerPriceId: string;
@@ -269,13 +309,13 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
269
309
  interval: "month" | "year";
270
310
  metadata?: Record<string, string> | undefined;
271
311
  }>>;
272
- features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", any>>;
312
+ tierIndex: number;
313
+ features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number | boolean>>;
273
314
  metadata?: Record<string, string> | undefined;
274
315
  }, {
275
316
  id: string;
276
317
  name: string;
277
318
  description: string;
278
- tierIndex: number;
279
319
  providerProductId: string;
280
320
  prices: Partial<Record<"month" | "year", {
281
321
  providerPriceId: string;
@@ -284,10 +324,11 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
284
324
  interval: "month" | "year";
285
325
  metadata?: Record<string, string> | undefined;
286
326
  }>>;
287
- features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", any>>;
327
+ tierIndex: number;
328
+ features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number | boolean>>;
288
329
  metadata?: Record<string, string> | undefined;
289
330
  }>>;
290
- addons: z.ZodRecord<z.ZodString, z.ZodObject<{
331
+ addons: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
291
332
  id: z.ZodString;
292
333
  name: z.ZodString;
293
334
  description: z.ZodString;
@@ -313,6 +354,7 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
313
354
  }>>;
314
355
  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", "indexed_file_count", "saved_versions"]>;
315
356
  increment: z.ZodNumber;
357
+ increments: z.ZodOptional<z.ZodRecord<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", "indexed_file_count", "saved_versions"]>, z.ZodNumber>>;
316
358
  prorationDisabled: z.ZodOptional<z.ZodBoolean>;
317
359
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
318
360
  autoRechargeable: z.ZodOptional<z.ZodBoolean>;
@@ -332,6 +374,7 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
332
374
  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" | "indexed_file_count" | "saved_versions";
333
375
  increment: number;
334
376
  metadata?: Record<string, string> | undefined;
377
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
335
378
  prorationDisabled?: boolean | undefined;
336
379
  autoRechargeable?: boolean | undefined;
337
380
  hidden?: boolean | undefined;
@@ -350,6 +393,45 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
350
393
  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" | "indexed_file_count" | "saved_versions";
351
394
  increment: number;
352
395
  metadata?: Record<string, string> | undefined;
396
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
397
+ prorationDisabled?: boolean | undefined;
398
+ autoRechargeable?: boolean | undefined;
399
+ hidden?: boolean | undefined;
400
+ }>, {
401
+ id: string;
402
+ name: string;
403
+ description: string;
404
+ providerProductId: string;
405
+ prices: Partial<Record<"month" | "year", {
406
+ providerPriceId: string;
407
+ amount: number;
408
+ currency: "usd";
409
+ interval: "month" | "year";
410
+ metadata?: Record<string, string> | undefined;
411
+ }>>;
412
+ 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" | "indexed_file_count" | "saved_versions";
413
+ increment: number;
414
+ metadata?: Record<string, string> | undefined;
415
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
416
+ prorationDisabled?: boolean | undefined;
417
+ autoRechargeable?: boolean | undefined;
418
+ hidden?: boolean | undefined;
419
+ }, {
420
+ id: string;
421
+ name: string;
422
+ description: string;
423
+ providerProductId: string;
424
+ prices: Partial<Record<"month" | "year", {
425
+ providerPriceId: string;
426
+ amount: number;
427
+ currency: "usd";
428
+ interval: "month" | "year";
429
+ metadata?: Record<string, string> | undefined;
430
+ }>>;
431
+ 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" | "indexed_file_count" | "saved_versions";
432
+ increment: number;
433
+ metadata?: Record<string, string> | undefined;
434
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
353
435
  prorationDisabled?: boolean | undefined;
354
436
  autoRechargeable?: boolean | undefined;
355
437
  hidden?: boolean | undefined;
@@ -422,7 +504,6 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
422
504
  id: string;
423
505
  name: string;
424
506
  description: string;
425
- tierIndex: number;
426
507
  providerProductId: string;
427
508
  prices: Partial<Record<"month" | "year", {
428
509
  providerPriceId: string;
@@ -431,7 +512,8 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
431
512
  interval: "month" | "year";
432
513
  metadata?: Record<string, string> | undefined;
433
514
  }>>;
434
- features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", any>>;
515
+ tierIndex: number;
516
+ features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number | boolean>>;
435
517
  metadata?: Record<string, string> | undefined;
436
518
  }>;
437
519
  addons: Record<string, {
@@ -449,6 +531,7 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
449
531
  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" | "indexed_file_count" | "saved_versions";
450
532
  increment: number;
451
533
  metadata?: Record<string, string> | undefined;
534
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
452
535
  prorationDisabled?: boolean | undefined;
453
536
  autoRechargeable?: boolean | undefined;
454
537
  hidden?: boolean | undefined;
@@ -479,7 +562,6 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
479
562
  id: string;
480
563
  name: string;
481
564
  description: string;
482
- tierIndex: number;
483
565
  providerProductId: string;
484
566
  prices: Partial<Record<"month" | "year", {
485
567
  providerPriceId: string;
@@ -488,7 +570,8 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
488
570
  interval: "month" | "year";
489
571
  metadata?: Record<string, string> | undefined;
490
572
  }>>;
491
- features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", any>>;
573
+ tierIndex: number;
574
+ features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number | boolean>>;
492
575
  metadata?: Record<string, string> | undefined;
493
576
  }>;
494
577
  addons: Record<string, {
@@ -506,6 +589,7 @@ export declare const billingVersionConfigSchema: z.ZodObject<{
506
589
  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" | "indexed_file_count" | "saved_versions";
507
590
  increment: number;
508
591
  metadata?: Record<string, string> | undefined;
592
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
509
593
  prorationDisabled?: boolean | undefined;
510
594
  autoRechargeable?: boolean | undefined;
511
595
  hidden?: boolean | undefined;
@@ -558,13 +642,12 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
558
642
  interval: "month" | "year";
559
643
  metadata?: Record<string, string> | undefined;
560
644
  }>>;
561
- features: z.ZodRecord<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", "indexed_file_count", "saved_versions"]>, z.ZodAny>;
645
+ features: z.ZodRecord<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", "indexed_file_count", "saved_versions"]>, z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
562
646
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
563
647
  }, "strip", z.ZodTypeAny, {
564
648
  id: string;
565
649
  name: string;
566
650
  description: string;
567
- tierIndex: number;
568
651
  providerProductId: string;
569
652
  prices: Partial<Record<"month" | "year", {
570
653
  providerPriceId: string;
@@ -573,13 +656,13 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
573
656
  interval: "month" | "year";
574
657
  metadata?: Record<string, string> | undefined;
575
658
  }>>;
576
- features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", any>>;
659
+ tierIndex: number;
660
+ features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number | boolean>>;
577
661
  metadata?: Record<string, string> | undefined;
578
662
  }, {
579
663
  id: string;
580
664
  name: string;
581
665
  description: string;
582
- tierIndex: number;
583
666
  providerProductId: string;
584
667
  prices: Partial<Record<"month" | "year", {
585
668
  providerPriceId: string;
@@ -588,10 +671,11 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
588
671
  interval: "month" | "year";
589
672
  metadata?: Record<string, string> | undefined;
590
673
  }>>;
591
- features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", any>>;
674
+ tierIndex: number;
675
+ features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number | boolean>>;
592
676
  metadata?: Record<string, string> | undefined;
593
677
  }>>;
594
- addons: z.ZodRecord<z.ZodString, z.ZodObject<{
678
+ addons: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
595
679
  id: z.ZodString;
596
680
  name: z.ZodString;
597
681
  description: z.ZodString;
@@ -617,6 +701,7 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
617
701
  }>>;
618
702
  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", "indexed_file_count", "saved_versions"]>;
619
703
  increment: z.ZodNumber;
704
+ increments: z.ZodOptional<z.ZodRecord<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", "indexed_file_count", "saved_versions"]>, z.ZodNumber>>;
620
705
  prorationDisabled: z.ZodOptional<z.ZodBoolean>;
621
706
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
622
707
  autoRechargeable: z.ZodOptional<z.ZodBoolean>;
@@ -636,6 +721,45 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
636
721
  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" | "indexed_file_count" | "saved_versions";
637
722
  increment: number;
638
723
  metadata?: Record<string, string> | undefined;
724
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
725
+ prorationDisabled?: boolean | undefined;
726
+ autoRechargeable?: boolean | undefined;
727
+ hidden?: boolean | undefined;
728
+ }, {
729
+ id: string;
730
+ name: string;
731
+ description: string;
732
+ providerProductId: string;
733
+ prices: Partial<Record<"month" | "year", {
734
+ providerPriceId: string;
735
+ amount: number;
736
+ currency: "usd";
737
+ interval: "month" | "year";
738
+ metadata?: Record<string, string> | undefined;
739
+ }>>;
740
+ 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" | "indexed_file_count" | "saved_versions";
741
+ increment: number;
742
+ metadata?: Record<string, string> | undefined;
743
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
744
+ prorationDisabled?: boolean | undefined;
745
+ autoRechargeable?: boolean | undefined;
746
+ hidden?: boolean | undefined;
747
+ }>, {
748
+ id: string;
749
+ name: string;
750
+ description: string;
751
+ providerProductId: string;
752
+ prices: Partial<Record<"month" | "year", {
753
+ providerPriceId: string;
754
+ amount: number;
755
+ currency: "usd";
756
+ interval: "month" | "year";
757
+ metadata?: Record<string, string> | undefined;
758
+ }>>;
759
+ 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" | "indexed_file_count" | "saved_versions";
760
+ increment: number;
761
+ metadata?: Record<string, string> | undefined;
762
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
639
763
  prorationDisabled?: boolean | undefined;
640
764
  autoRechargeable?: boolean | undefined;
641
765
  hidden?: boolean | undefined;
@@ -654,6 +778,7 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
654
778
  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" | "indexed_file_count" | "saved_versions";
655
779
  increment: number;
656
780
  metadata?: Record<string, string> | undefined;
781
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
657
782
  prorationDisabled?: boolean | undefined;
658
783
  autoRechargeable?: boolean | undefined;
659
784
  hidden?: boolean | undefined;
@@ -726,7 +851,6 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
726
851
  id: string;
727
852
  name: string;
728
853
  description: string;
729
- tierIndex: number;
730
854
  providerProductId: string;
731
855
  prices: Partial<Record<"month" | "year", {
732
856
  providerPriceId: string;
@@ -735,7 +859,8 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
735
859
  interval: "month" | "year";
736
860
  metadata?: Record<string, string> | undefined;
737
861
  }>>;
738
- features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", any>>;
862
+ tierIndex: number;
863
+ features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number | boolean>>;
739
864
  metadata?: Record<string, string> | undefined;
740
865
  }>;
741
866
  addons: Record<string, {
@@ -753,6 +878,7 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
753
878
  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" | "indexed_file_count" | "saved_versions";
754
879
  increment: number;
755
880
  metadata?: Record<string, string> | undefined;
881
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
756
882
  prorationDisabled?: boolean | undefined;
757
883
  autoRechargeable?: boolean | undefined;
758
884
  hidden?: boolean | undefined;
@@ -783,7 +909,6 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
783
909
  id: string;
784
910
  name: string;
785
911
  description: string;
786
- tierIndex: number;
787
912
  providerProductId: string;
788
913
  prices: Partial<Record<"month" | "year", {
789
914
  providerPriceId: string;
@@ -792,7 +917,8 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
792
917
  interval: "month" | "year";
793
918
  metadata?: Record<string, string> | undefined;
794
919
  }>>;
795
- features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", any>>;
920
+ tierIndex: number;
921
+ features: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number | boolean>>;
796
922
  metadata?: Record<string, string> | undefined;
797
923
  }>;
798
924
  addons: Record<string, {
@@ -810,6 +936,7 @@ export declare const billingConfigSchema: z.ZodRecord<z.ZodEnum<["v4"]>, z.ZodOb
810
936
  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" | "indexed_file_count" | "saved_versions";
811
937
  increment: number;
812
938
  metadata?: Record<string, string> | undefined;
939
+ increments?: Partial<Record<"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" | "indexed_file_count" | "saved_versions", number>> | undefined;
813
940
  prorationDisabled?: boolean | undefined;
814
941
  autoRechargeable?: boolean | undefined;
815
942
  hidden?: boolean | undefined;
package/dist/schema.js CHANGED
@@ -30,21 +30,35 @@ exports.planSchema = zod_1.z.object({
30
30
  tierIndex: zod_1.z.number(),
31
31
  providerProductId: zod_1.z.string(),
32
32
  prices: zod_1.z.record(exports.intervalSchema, exports.priceSchema),
33
- features: zod_1.z.record(exports.featureSchema, zod_1.z.any()),
33
+ features: zod_1.z.record(exports.featureSchema, zod_1.z.union([zod_1.z.number(), zod_1.z.boolean()])),
34
34
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
35
35
  });
36
- exports.addOnSchema = zod_1.z.object({
36
+ exports.addOnSchema = zod_1.z
37
+ .object({
37
38
  id: zod_1.z.string(),
38
39
  name: zod_1.z.string(),
39
40
  description: zod_1.z.string(),
40
41
  providerProductId: zod_1.z.string(),
41
42
  prices: zod_1.z.record(exports.intervalSchema, exports.priceSchema),
42
43
  feature: exports.featureSchema,
43
- increment: zod_1.z.number(),
44
+ increment: zod_1.z.number().positive(),
45
+ increments: zod_1.z.record(exports.featureSchema, zod_1.z.number().positive()).optional(),
44
46
  prorationDisabled: zod_1.z.boolean().optional(),
45
47
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
46
48
  autoRechargeable: zod_1.z.boolean().optional(),
47
49
  hidden: zod_1.z.boolean().optional(),
50
+ })
51
+ .superRefine((data, ctx) => {
52
+ if (!data.increments) {
53
+ return;
54
+ }
55
+ if (data.increments[data.feature] !== data.increment) {
56
+ ctx.addIssue({
57
+ code: zod_1.z.ZodIssueCode.custom,
58
+ message: 'addon increments must include the legacy feature with the same increment',
59
+ path: ['increments', data.feature],
60
+ });
61
+ }
48
62
  });
49
63
  exports.meterSchema = zod_1.z.object({
50
64
  id: zod_1.z.string(),
package/dist/types.d.ts CHANGED
@@ -39,16 +39,9 @@ export type BillingPlanDefinition = {
39
39
  features: Partial<Record<BillingFeatureId, number | boolean>>;
40
40
  metadata?: Record<string, string>;
41
41
  };
42
- export type BillingAddonDefinition = {
42
+ export type BillingAddonDefinition = Omit<BillingAddon, 'id' | 'prices' | 'providerProductId'> & {
43
43
  id: BillingAddonId;
44
- name: string;
45
- description: string;
46
44
  prices: Array<BillingPriceDefinition>;
47
- feature: BillingFeatureId;
48
- increment: number;
49
- prorationDisabled?: boolean;
50
- metadata?: Record<string, string>;
51
- hidden?: boolean;
52
45
  };
53
46
  export type BillingMeterDefinition = {
54
47
  id: BillingMeterId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpinternal/const",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "Shared constants for Skynet billing refactor (vendored copy of upstream packages/const)",
5
5
  "license": "UNLICENSED",
6
6
  "files": [