@wopr-network/platform-core 1.58.1 → 1.60.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 (63) hide show
  1. package/dist/billing/crypto/__tests__/key-server.test.js +3 -0
  2. package/dist/billing/crypto/key-server.js +1 -0
  3. package/dist/billing/crypto/oracle/coingecko.js +1 -0
  4. package/dist/billing/crypto/payment-method-store.d.ts +1 -0
  5. package/dist/billing/crypto/payment-method-store.js +3 -0
  6. package/dist/billing/crypto/tron/__tests__/address-convert.test.d.ts +1 -0
  7. package/dist/billing/crypto/tron/__tests__/address-convert.test.js +55 -0
  8. package/dist/billing/crypto/tron/address-convert.d.ts +14 -0
  9. package/dist/billing/crypto/tron/address-convert.js +83 -0
  10. package/dist/billing/crypto/watcher-service.js +21 -11
  11. package/dist/db/schema/crypto.d.ts +17 -0
  12. package/dist/db/schema/crypto.js +1 -0
  13. package/dist/db/schema/index.d.ts +2 -0
  14. package/dist/db/schema/index.js +2 -0
  15. package/dist/db/schema/product-config.d.ts +610 -0
  16. package/dist/db/schema/product-config.js +51 -0
  17. package/dist/db/schema/products.d.ts +565 -0
  18. package/dist/db/schema/products.js +43 -0
  19. package/dist/product-config/boot.d.ts +36 -0
  20. package/dist/product-config/boot.js +30 -0
  21. package/dist/product-config/drizzle-product-config-repository.d.ts +19 -0
  22. package/dist/product-config/drizzle-product-config-repository.js +200 -0
  23. package/dist/product-config/drizzle-product-config-repository.test.d.ts +1 -0
  24. package/dist/product-config/drizzle-product-config-repository.test.js +114 -0
  25. package/dist/product-config/index.d.ts +24 -0
  26. package/dist/product-config/index.js +37 -0
  27. package/dist/product-config/repository-types.d.ts +143 -0
  28. package/dist/product-config/repository-types.js +53 -0
  29. package/dist/product-config/service.d.ts +27 -0
  30. package/dist/product-config/service.js +74 -0
  31. package/dist/product-config/service.test.d.ts +1 -0
  32. package/dist/product-config/service.test.js +107 -0
  33. package/dist/trpc/index.d.ts +1 -0
  34. package/dist/trpc/index.js +1 -0
  35. package/dist/trpc/product-config-router.d.ts +117 -0
  36. package/dist/trpc/product-config-router.js +137 -0
  37. package/docs/specs/2026-03-23-product-config-db-migration-plan.md +2260 -0
  38. package/docs/specs/2026-03-23-product-config-db-migration.md +371 -0
  39. package/drizzle/migrations/0020_product_config_tables.sql +109 -0
  40. package/drizzle/migrations/0021_watcher_type_column.sql +3 -0
  41. package/drizzle/migrations/meta/_journal.json +7 -0
  42. package/package.json +1 -1
  43. package/scripts/seed-products.ts +268 -0
  44. package/src/billing/crypto/__tests__/key-server.test.ts +3 -0
  45. package/src/billing/crypto/key-server.ts +2 -0
  46. package/src/billing/crypto/oracle/coingecko.ts +1 -0
  47. package/src/billing/crypto/payment-method-store.ts +4 -0
  48. package/src/billing/crypto/tron/__tests__/address-convert.test.ts +67 -0
  49. package/src/billing/crypto/tron/address-convert.ts +80 -0
  50. package/src/billing/crypto/watcher-service.ts +24 -16
  51. package/src/db/schema/crypto.ts +1 -0
  52. package/src/db/schema/index.ts +2 -0
  53. package/src/db/schema/product-config.ts +56 -0
  54. package/src/db/schema/products.ts +58 -0
  55. package/src/product-config/boot.ts +57 -0
  56. package/src/product-config/drizzle-product-config-repository.test.ts +132 -0
  57. package/src/product-config/drizzle-product-config-repository.ts +229 -0
  58. package/src/product-config/index.ts +62 -0
  59. package/src/product-config/repository-types.ts +222 -0
  60. package/src/product-config/service.test.ts +127 -0
  61. package/src/product-config/service.ts +105 -0
  62. package/src/trpc/index.ts +1 -0
  63. package/src/trpc/product-config-router.ts +161 -0
@@ -0,0 +1,610 @@
1
+ export declare const fleetLifecycleEnum: import("drizzle-orm/pg-core").PgEnum<["managed", "ephemeral"]>;
2
+ export declare const fleetBillingModelEnum: import("drizzle-orm/pg-core").PgEnum<["monthly", "per_use", "none"]>;
3
+ export declare const productFeatures: import("drizzle-orm/pg-core").PgTableWithColumns<{
4
+ name: "product_features";
5
+ schema: undefined;
6
+ columns: {
7
+ productId: import("drizzle-orm/pg-core").PgColumn<{
8
+ name: "product_id";
9
+ tableName: "product_features";
10
+ dataType: "string";
11
+ columnType: "PgUUID";
12
+ data: string;
13
+ driverParam: string;
14
+ notNull: true;
15
+ hasDefault: false;
16
+ isPrimaryKey: true;
17
+ isAutoincrement: false;
18
+ hasRuntimeDefault: false;
19
+ enumValues: undefined;
20
+ baseColumn: never;
21
+ identity: undefined;
22
+ generated: undefined;
23
+ }, {}, {}>;
24
+ chatEnabled: import("drizzle-orm/pg-core").PgColumn<{
25
+ name: "chat_enabled";
26
+ tableName: "product_features";
27
+ dataType: "boolean";
28
+ columnType: "PgBoolean";
29
+ data: boolean;
30
+ driverParam: boolean;
31
+ notNull: true;
32
+ hasDefault: true;
33
+ isPrimaryKey: false;
34
+ isAutoincrement: false;
35
+ hasRuntimeDefault: false;
36
+ enumValues: undefined;
37
+ baseColumn: never;
38
+ identity: undefined;
39
+ generated: undefined;
40
+ }, {}, {}>;
41
+ onboardingEnabled: import("drizzle-orm/pg-core").PgColumn<{
42
+ name: "onboarding_enabled";
43
+ tableName: "product_features";
44
+ dataType: "boolean";
45
+ columnType: "PgBoolean";
46
+ data: boolean;
47
+ driverParam: boolean;
48
+ notNull: true;
49
+ hasDefault: true;
50
+ isPrimaryKey: false;
51
+ isAutoincrement: false;
52
+ hasRuntimeDefault: false;
53
+ enumValues: undefined;
54
+ baseColumn: never;
55
+ identity: undefined;
56
+ generated: undefined;
57
+ }, {}, {}>;
58
+ onboardingDefaultModel: import("drizzle-orm/pg-core").PgColumn<{
59
+ name: "onboarding_default_model";
60
+ tableName: "product_features";
61
+ dataType: "string";
62
+ columnType: "PgText";
63
+ data: string;
64
+ driverParam: string;
65
+ notNull: false;
66
+ hasDefault: false;
67
+ isPrimaryKey: false;
68
+ isAutoincrement: false;
69
+ hasRuntimeDefault: false;
70
+ enumValues: [string, ...string[]];
71
+ baseColumn: never;
72
+ identity: undefined;
73
+ generated: undefined;
74
+ }, {}, {}>;
75
+ onboardingSystemPrompt: import("drizzle-orm/pg-core").PgColumn<{
76
+ name: "onboarding_system_prompt";
77
+ tableName: "product_features";
78
+ dataType: "string";
79
+ columnType: "PgText";
80
+ data: string;
81
+ driverParam: string;
82
+ notNull: false;
83
+ hasDefault: false;
84
+ isPrimaryKey: false;
85
+ isAutoincrement: false;
86
+ hasRuntimeDefault: false;
87
+ enumValues: [string, ...string[]];
88
+ baseColumn: never;
89
+ identity: undefined;
90
+ generated: undefined;
91
+ }, {}, {}>;
92
+ onboardingMaxCredits: import("drizzle-orm/pg-core").PgColumn<{
93
+ name: "onboarding_max_credits";
94
+ tableName: "product_features";
95
+ dataType: "number";
96
+ columnType: "PgInteger";
97
+ data: number;
98
+ driverParam: string | number;
99
+ notNull: true;
100
+ hasDefault: true;
101
+ isPrimaryKey: false;
102
+ isAutoincrement: false;
103
+ hasRuntimeDefault: false;
104
+ enumValues: undefined;
105
+ baseColumn: never;
106
+ identity: undefined;
107
+ generated: undefined;
108
+ }, {}, {}>;
109
+ onboardingWelcomeMsg: import("drizzle-orm/pg-core").PgColumn<{
110
+ name: "onboarding_welcome_msg";
111
+ tableName: "product_features";
112
+ dataType: "string";
113
+ columnType: "PgText";
114
+ data: string;
115
+ driverParam: string;
116
+ notNull: false;
117
+ hasDefault: false;
118
+ isPrimaryKey: false;
119
+ isAutoincrement: false;
120
+ hasRuntimeDefault: false;
121
+ enumValues: [string, ...string[]];
122
+ baseColumn: never;
123
+ identity: undefined;
124
+ generated: undefined;
125
+ }, {}, {}>;
126
+ sharedModuleBilling: import("drizzle-orm/pg-core").PgColumn<{
127
+ name: "shared_module_billing";
128
+ tableName: "product_features";
129
+ dataType: "boolean";
130
+ columnType: "PgBoolean";
131
+ data: boolean;
132
+ driverParam: boolean;
133
+ notNull: true;
134
+ hasDefault: true;
135
+ isPrimaryKey: false;
136
+ isAutoincrement: false;
137
+ hasRuntimeDefault: false;
138
+ enumValues: undefined;
139
+ baseColumn: never;
140
+ identity: undefined;
141
+ generated: undefined;
142
+ }, {}, {}>;
143
+ sharedModuleMonitoring: import("drizzle-orm/pg-core").PgColumn<{
144
+ name: "shared_module_monitoring";
145
+ tableName: "product_features";
146
+ dataType: "boolean";
147
+ columnType: "PgBoolean";
148
+ data: boolean;
149
+ driverParam: boolean;
150
+ notNull: true;
151
+ hasDefault: true;
152
+ isPrimaryKey: false;
153
+ isAutoincrement: false;
154
+ hasRuntimeDefault: false;
155
+ enumValues: undefined;
156
+ baseColumn: never;
157
+ identity: undefined;
158
+ generated: undefined;
159
+ }, {}, {}>;
160
+ sharedModuleAnalytics: import("drizzle-orm/pg-core").PgColumn<{
161
+ name: "shared_module_analytics";
162
+ tableName: "product_features";
163
+ dataType: "boolean";
164
+ columnType: "PgBoolean";
165
+ data: boolean;
166
+ driverParam: boolean;
167
+ notNull: true;
168
+ hasDefault: true;
169
+ isPrimaryKey: false;
170
+ isAutoincrement: false;
171
+ hasRuntimeDefault: false;
172
+ enumValues: undefined;
173
+ baseColumn: never;
174
+ identity: undefined;
175
+ generated: undefined;
176
+ }, {}, {}>;
177
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
178
+ name: "updated_at";
179
+ tableName: "product_features";
180
+ dataType: "date";
181
+ columnType: "PgTimestamp";
182
+ data: Date;
183
+ driverParam: string;
184
+ notNull: true;
185
+ hasDefault: true;
186
+ isPrimaryKey: false;
187
+ isAutoincrement: false;
188
+ hasRuntimeDefault: false;
189
+ enumValues: undefined;
190
+ baseColumn: never;
191
+ identity: undefined;
192
+ generated: undefined;
193
+ }, {}, {}>;
194
+ };
195
+ dialect: "pg";
196
+ }>;
197
+ export declare const productFleetConfig: import("drizzle-orm/pg-core").PgTableWithColumns<{
198
+ name: "product_fleet_config";
199
+ schema: undefined;
200
+ columns: {
201
+ productId: import("drizzle-orm/pg-core").PgColumn<{
202
+ name: "product_id";
203
+ tableName: "product_fleet_config";
204
+ dataType: "string";
205
+ columnType: "PgUUID";
206
+ data: string;
207
+ driverParam: string;
208
+ notNull: true;
209
+ hasDefault: false;
210
+ isPrimaryKey: true;
211
+ isAutoincrement: false;
212
+ hasRuntimeDefault: false;
213
+ enumValues: undefined;
214
+ baseColumn: never;
215
+ identity: undefined;
216
+ generated: undefined;
217
+ }, {}, {}>;
218
+ containerImage: import("drizzle-orm/pg-core").PgColumn<{
219
+ name: "container_image";
220
+ tableName: "product_fleet_config";
221
+ dataType: "string";
222
+ columnType: "PgText";
223
+ data: string;
224
+ driverParam: string;
225
+ notNull: true;
226
+ hasDefault: false;
227
+ isPrimaryKey: false;
228
+ isAutoincrement: false;
229
+ hasRuntimeDefault: false;
230
+ enumValues: [string, ...string[]];
231
+ baseColumn: never;
232
+ identity: undefined;
233
+ generated: undefined;
234
+ }, {}, {}>;
235
+ containerPort: import("drizzle-orm/pg-core").PgColumn<{
236
+ name: "container_port";
237
+ tableName: "product_fleet_config";
238
+ dataType: "number";
239
+ columnType: "PgInteger";
240
+ data: number;
241
+ driverParam: string | number;
242
+ notNull: true;
243
+ hasDefault: true;
244
+ isPrimaryKey: false;
245
+ isAutoincrement: false;
246
+ hasRuntimeDefault: false;
247
+ enumValues: undefined;
248
+ baseColumn: never;
249
+ identity: undefined;
250
+ generated: undefined;
251
+ }, {}, {}>;
252
+ lifecycle: import("drizzle-orm/pg-core").PgColumn<{
253
+ name: "lifecycle";
254
+ tableName: "product_fleet_config";
255
+ dataType: "string";
256
+ columnType: "PgEnumColumn";
257
+ data: "managed" | "ephemeral";
258
+ driverParam: string;
259
+ notNull: true;
260
+ hasDefault: true;
261
+ isPrimaryKey: false;
262
+ isAutoincrement: false;
263
+ hasRuntimeDefault: false;
264
+ enumValues: ["managed", "ephemeral"];
265
+ baseColumn: never;
266
+ identity: undefined;
267
+ generated: undefined;
268
+ }, {}, {}>;
269
+ billingModel: import("drizzle-orm/pg-core").PgColumn<{
270
+ name: "billing_model";
271
+ tableName: "product_fleet_config";
272
+ dataType: "string";
273
+ columnType: "PgEnumColumn";
274
+ data: "monthly" | "per_use" | "none";
275
+ driverParam: string;
276
+ notNull: true;
277
+ hasDefault: true;
278
+ isPrimaryKey: false;
279
+ isAutoincrement: false;
280
+ hasRuntimeDefault: false;
281
+ enumValues: ["monthly", "per_use", "none"];
282
+ baseColumn: never;
283
+ identity: undefined;
284
+ generated: undefined;
285
+ }, {}, {}>;
286
+ maxInstances: import("drizzle-orm/pg-core").PgColumn<{
287
+ name: "max_instances";
288
+ tableName: "product_fleet_config";
289
+ dataType: "number";
290
+ columnType: "PgInteger";
291
+ data: number;
292
+ driverParam: string | number;
293
+ notNull: true;
294
+ hasDefault: true;
295
+ isPrimaryKey: false;
296
+ isAutoincrement: false;
297
+ hasRuntimeDefault: false;
298
+ enumValues: undefined;
299
+ baseColumn: never;
300
+ identity: undefined;
301
+ generated: undefined;
302
+ }, {}, {}>;
303
+ imageAllowlist: import("drizzle-orm/pg-core").PgColumn<{
304
+ name: "image_allowlist";
305
+ tableName: "product_fleet_config";
306
+ dataType: "array";
307
+ columnType: "PgArray";
308
+ data: string[];
309
+ driverParam: string | string[];
310
+ notNull: false;
311
+ hasDefault: false;
312
+ isPrimaryKey: false;
313
+ isAutoincrement: false;
314
+ hasRuntimeDefault: false;
315
+ enumValues: [string, ...string[]];
316
+ baseColumn: import("drizzle-orm").Column<{
317
+ name: "image_allowlist";
318
+ tableName: "product_fleet_config";
319
+ dataType: "string";
320
+ columnType: "PgText";
321
+ data: string;
322
+ driverParam: string;
323
+ notNull: false;
324
+ hasDefault: false;
325
+ isPrimaryKey: false;
326
+ isAutoincrement: false;
327
+ hasRuntimeDefault: false;
328
+ enumValues: [string, ...string[]];
329
+ baseColumn: never;
330
+ identity: undefined;
331
+ generated: undefined;
332
+ }, {}, {}>;
333
+ identity: undefined;
334
+ generated: undefined;
335
+ }, {}, {
336
+ baseBuilder: import("drizzle-orm/pg-core").PgColumnBuilder<{
337
+ name: "image_allowlist";
338
+ dataType: "string";
339
+ columnType: "PgText";
340
+ data: string;
341
+ enumValues: [string, ...string[]];
342
+ driverParam: string;
343
+ }, {}, {}, import("drizzle-orm").ColumnBuilderExtraConfig>;
344
+ size: undefined;
345
+ }>;
346
+ dockerNetwork: import("drizzle-orm/pg-core").PgColumn<{
347
+ name: "docker_network";
348
+ tableName: "product_fleet_config";
349
+ dataType: "string";
350
+ columnType: "PgText";
351
+ data: string;
352
+ driverParam: string;
353
+ notNull: true;
354
+ hasDefault: true;
355
+ isPrimaryKey: false;
356
+ isAutoincrement: false;
357
+ hasRuntimeDefault: false;
358
+ enumValues: [string, ...string[]];
359
+ baseColumn: never;
360
+ identity: undefined;
361
+ generated: undefined;
362
+ }, {}, {}>;
363
+ placementStrategy: import("drizzle-orm/pg-core").PgColumn<{
364
+ name: "placement_strategy";
365
+ tableName: "product_fleet_config";
366
+ dataType: "string";
367
+ columnType: "PgText";
368
+ data: string;
369
+ driverParam: string;
370
+ notNull: true;
371
+ hasDefault: true;
372
+ isPrimaryKey: false;
373
+ isAutoincrement: false;
374
+ hasRuntimeDefault: false;
375
+ enumValues: [string, ...string[]];
376
+ baseColumn: never;
377
+ identity: undefined;
378
+ generated: undefined;
379
+ }, {}, {}>;
380
+ fleetDataDir: import("drizzle-orm/pg-core").PgColumn<{
381
+ name: "fleet_data_dir";
382
+ tableName: "product_fleet_config";
383
+ dataType: "string";
384
+ columnType: "PgText";
385
+ data: string;
386
+ driverParam: string;
387
+ notNull: true;
388
+ hasDefault: true;
389
+ isPrimaryKey: false;
390
+ isAutoincrement: false;
391
+ hasRuntimeDefault: false;
392
+ enumValues: [string, ...string[]];
393
+ baseColumn: never;
394
+ identity: undefined;
395
+ generated: undefined;
396
+ }, {}, {}>;
397
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
398
+ name: "updated_at";
399
+ tableName: "product_fleet_config";
400
+ dataType: "date";
401
+ columnType: "PgTimestamp";
402
+ data: Date;
403
+ driverParam: string;
404
+ notNull: true;
405
+ hasDefault: true;
406
+ isPrimaryKey: false;
407
+ isAutoincrement: false;
408
+ hasRuntimeDefault: false;
409
+ enumValues: undefined;
410
+ baseColumn: never;
411
+ identity: undefined;
412
+ generated: undefined;
413
+ }, {}, {}>;
414
+ };
415
+ dialect: "pg";
416
+ }>;
417
+ export declare const productBillingConfig: import("drizzle-orm/pg-core").PgTableWithColumns<{
418
+ name: "product_billing_config";
419
+ schema: undefined;
420
+ columns: {
421
+ productId: import("drizzle-orm/pg-core").PgColumn<{
422
+ name: "product_id";
423
+ tableName: "product_billing_config";
424
+ dataType: "string";
425
+ columnType: "PgUUID";
426
+ data: string;
427
+ driverParam: string;
428
+ notNull: true;
429
+ hasDefault: false;
430
+ isPrimaryKey: true;
431
+ isAutoincrement: false;
432
+ hasRuntimeDefault: false;
433
+ enumValues: undefined;
434
+ baseColumn: never;
435
+ identity: undefined;
436
+ generated: undefined;
437
+ }, {}, {}>;
438
+ stripePublishableKey: import("drizzle-orm/pg-core").PgColumn<{
439
+ name: "stripe_publishable_key";
440
+ tableName: "product_billing_config";
441
+ dataType: "string";
442
+ columnType: "PgText";
443
+ data: string;
444
+ driverParam: string;
445
+ notNull: false;
446
+ hasDefault: false;
447
+ isPrimaryKey: false;
448
+ isAutoincrement: false;
449
+ hasRuntimeDefault: false;
450
+ enumValues: [string, ...string[]];
451
+ baseColumn: never;
452
+ identity: undefined;
453
+ generated: undefined;
454
+ }, {}, {}>;
455
+ stripeSecretKey: import("drizzle-orm/pg-core").PgColumn<{
456
+ name: "stripe_secret_key";
457
+ tableName: "product_billing_config";
458
+ dataType: "string";
459
+ columnType: "PgText";
460
+ data: string;
461
+ driverParam: string;
462
+ notNull: false;
463
+ hasDefault: false;
464
+ isPrimaryKey: false;
465
+ isAutoincrement: false;
466
+ hasRuntimeDefault: false;
467
+ enumValues: [string, ...string[]];
468
+ baseColumn: never;
469
+ identity: undefined;
470
+ generated: undefined;
471
+ }, {}, {}>;
472
+ stripeWebhookSecret: import("drizzle-orm/pg-core").PgColumn<{
473
+ name: "stripe_webhook_secret";
474
+ tableName: "product_billing_config";
475
+ dataType: "string";
476
+ columnType: "PgText";
477
+ data: string;
478
+ driverParam: string;
479
+ notNull: false;
480
+ hasDefault: false;
481
+ isPrimaryKey: false;
482
+ isAutoincrement: false;
483
+ hasRuntimeDefault: false;
484
+ enumValues: [string, ...string[]];
485
+ baseColumn: never;
486
+ identity: undefined;
487
+ generated: undefined;
488
+ }, {}, {}>;
489
+ creditPrices: import("drizzle-orm/pg-core").PgColumn<{
490
+ name: "credit_prices";
491
+ tableName: "product_billing_config";
492
+ dataType: "json";
493
+ columnType: "PgJsonb";
494
+ data: unknown;
495
+ driverParam: unknown;
496
+ notNull: true;
497
+ hasDefault: true;
498
+ isPrimaryKey: false;
499
+ isAutoincrement: false;
500
+ hasRuntimeDefault: false;
501
+ enumValues: undefined;
502
+ baseColumn: never;
503
+ identity: undefined;
504
+ generated: undefined;
505
+ }, {}, {}>;
506
+ affiliateBaseUrl: import("drizzle-orm/pg-core").PgColumn<{
507
+ name: "affiliate_base_url";
508
+ tableName: "product_billing_config";
509
+ dataType: "string";
510
+ columnType: "PgText";
511
+ data: string;
512
+ driverParam: string;
513
+ notNull: false;
514
+ hasDefault: false;
515
+ isPrimaryKey: false;
516
+ isAutoincrement: false;
517
+ hasRuntimeDefault: false;
518
+ enumValues: [string, ...string[]];
519
+ baseColumn: never;
520
+ identity: undefined;
521
+ generated: undefined;
522
+ }, {}, {}>;
523
+ affiliateMatchRate: import("drizzle-orm/pg-core").PgColumn<{
524
+ name: "affiliate_match_rate";
525
+ tableName: "product_billing_config";
526
+ dataType: "string";
527
+ columnType: "PgNumeric";
528
+ data: string;
529
+ driverParam: string;
530
+ notNull: true;
531
+ hasDefault: true;
532
+ isPrimaryKey: false;
533
+ isAutoincrement: false;
534
+ hasRuntimeDefault: false;
535
+ enumValues: undefined;
536
+ baseColumn: never;
537
+ identity: undefined;
538
+ generated: undefined;
539
+ }, {}, {}>;
540
+ affiliateMaxCap: import("drizzle-orm/pg-core").PgColumn<{
541
+ name: "affiliate_max_cap";
542
+ tableName: "product_billing_config";
543
+ dataType: "number";
544
+ columnType: "PgInteger";
545
+ data: number;
546
+ driverParam: string | number;
547
+ notNull: true;
548
+ hasDefault: true;
549
+ isPrimaryKey: false;
550
+ isAutoincrement: false;
551
+ hasRuntimeDefault: false;
552
+ enumValues: undefined;
553
+ baseColumn: never;
554
+ identity: undefined;
555
+ generated: undefined;
556
+ }, {}, {}>;
557
+ dividendRate: import("drizzle-orm/pg-core").PgColumn<{
558
+ name: "dividend_rate";
559
+ tableName: "product_billing_config";
560
+ dataType: "string";
561
+ columnType: "PgNumeric";
562
+ data: string;
563
+ driverParam: string;
564
+ notNull: true;
565
+ hasDefault: true;
566
+ isPrimaryKey: false;
567
+ isAutoincrement: false;
568
+ hasRuntimeDefault: false;
569
+ enumValues: undefined;
570
+ baseColumn: never;
571
+ identity: undefined;
572
+ generated: undefined;
573
+ }, {}, {}>;
574
+ marginConfig: import("drizzle-orm/pg-core").PgColumn<{
575
+ name: "margin_config";
576
+ tableName: "product_billing_config";
577
+ dataType: "json";
578
+ columnType: "PgJsonb";
579
+ data: unknown;
580
+ driverParam: unknown;
581
+ notNull: false;
582
+ hasDefault: false;
583
+ isPrimaryKey: false;
584
+ isAutoincrement: false;
585
+ hasRuntimeDefault: false;
586
+ enumValues: undefined;
587
+ baseColumn: never;
588
+ identity: undefined;
589
+ generated: undefined;
590
+ }, {}, {}>;
591
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
592
+ name: "updated_at";
593
+ tableName: "product_billing_config";
594
+ dataType: "date";
595
+ columnType: "PgTimestamp";
596
+ data: Date;
597
+ driverParam: string;
598
+ notNull: true;
599
+ hasDefault: true;
600
+ isPrimaryKey: false;
601
+ isAutoincrement: false;
602
+ hasRuntimeDefault: false;
603
+ enumValues: undefined;
604
+ baseColumn: never;
605
+ identity: undefined;
606
+ generated: undefined;
607
+ }, {}, {}>;
608
+ };
609
+ dialect: "pg";
610
+ }>;
@@ -0,0 +1,51 @@
1
+ import { boolean, integer, jsonb, numeric, pgEnum, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
2
+ import { products } from "./products.js";
3
+ export const fleetLifecycleEnum = pgEnum("fleet_lifecycle", ["managed", "ephemeral"]);
4
+ export const fleetBillingModelEnum = pgEnum("fleet_billing_model", ["monthly", "per_use", "none"]);
5
+ export const productFeatures = pgTable("product_features", {
6
+ productId: uuid("product_id")
7
+ .primaryKey()
8
+ .references(() => products.id, { onDelete: "cascade" }),
9
+ chatEnabled: boolean("chat_enabled").notNull().default(true),
10
+ onboardingEnabled: boolean("onboarding_enabled").notNull().default(true),
11
+ onboardingDefaultModel: text("onboarding_default_model"),
12
+ onboardingSystemPrompt: text("onboarding_system_prompt"),
13
+ onboardingMaxCredits: integer("onboarding_max_credits").notNull().default(100),
14
+ onboardingWelcomeMsg: text("onboarding_welcome_msg"),
15
+ sharedModuleBilling: boolean("shared_module_billing").notNull().default(true),
16
+ sharedModuleMonitoring: boolean("shared_module_monitoring").notNull().default(true),
17
+ sharedModuleAnalytics: boolean("shared_module_analytics").notNull().default(true),
18
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
19
+ });
20
+ export const productFleetConfig = pgTable("product_fleet_config", {
21
+ productId: uuid("product_id")
22
+ .primaryKey()
23
+ .references(() => products.id, { onDelete: "cascade" }),
24
+ containerImage: text("container_image").notNull(),
25
+ containerPort: integer("container_port").notNull().default(3100),
26
+ lifecycle: fleetLifecycleEnum("lifecycle").notNull().default("managed"),
27
+ billingModel: fleetBillingModelEnum("billing_model").notNull().default("monthly"),
28
+ maxInstances: integer("max_instances").notNull().default(5),
29
+ imageAllowlist: text("image_allowlist").array(),
30
+ dockerNetwork: text("docker_network").notNull().default(""),
31
+ placementStrategy: text("placement_strategy").notNull().default("least-loaded"),
32
+ fleetDataDir: text("fleet_data_dir").notNull().default("/data/fleet"),
33
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
34
+ });
35
+ export const productBillingConfig = pgTable("product_billing_config", {
36
+ productId: uuid("product_id")
37
+ .primaryKey()
38
+ .references(() => products.id, { onDelete: "cascade" }),
39
+ stripePublishableKey: text("stripe_publishable_key"),
40
+ /** Encrypted via credential vault (CRYPTO_SERVICE_KEY) before storage. */
41
+ stripeSecretKey: text("stripe_secret_key"),
42
+ /** Encrypted via credential vault (CRYPTO_SERVICE_KEY) before storage. */
43
+ stripeWebhookSecret: text("stripe_webhook_secret"),
44
+ creditPrices: jsonb("credit_prices").notNull().default({}),
45
+ affiliateBaseUrl: text("affiliate_base_url"),
46
+ affiliateMatchRate: numeric("affiliate_match_rate").notNull().default("1.0"),
47
+ affiliateMaxCap: integer("affiliate_max_cap").notNull().default(20000),
48
+ dividendRate: numeric("dividend_rate").notNull().default("1.0"),
49
+ marginConfig: jsonb("margin_config"),
50
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
51
+ });