atmn 1.1.25 → 2.0.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 (117) hide show
  1. package/README.md +120 -0
  2. package/dist/bin.js +23102 -0
  3. package/dist/index.js +2906 -0
  4. package/dist/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +27 -74
  6. package/src/actions/api/callApi.ts +280 -0
  7. package/src/actions/api/registerApiCommands.ts +121 -0
  8. package/src/actions/env/fetchOrgInfo.ts +32 -0
  9. package/src/actions/env/types/orgInfo.ts +18 -0
  10. package/src/actions/env.ts +94 -0
  11. package/src/actions/init/runInit.ts +401 -0
  12. package/src/actions/login/keyless.ts +135 -0
  13. package/src/actions/login.ts +144 -0
  14. package/src/actions/pull/appendPlanVersionFixture.ts +373 -0
  15. package/src/actions/pull/applyPreview.ts +553 -0
  16. package/src/actions/pull/applySettingsPreview.ts +114 -0
  17. package/src/actions/pull/changedFixtureKeys.ts +88 -0
  18. package/src/actions/pull/listSourceFiles.ts +29 -0
  19. package/src/actions/pull/locateFixture.ts +78 -0
  20. package/src/actions/pull/resolveCollectionTarget.ts +198 -0
  21. package/src/actions/pull/rewriteConfig.ts +57 -0
  22. package/src/actions/pull/scaffoldConfig.ts +118 -0
  23. package/src/actions/pull.ts +399 -0
  24. package/src/actions/push/backfillInternalIds.ts +394 -0
  25. package/src/actions/push/deprecatedFields.ts +55 -0
  26. package/src/actions/push.ts +294 -0
  27. package/src/actions/reset/runReset.ts +58 -0
  28. package/src/actions/sandbox/createSandbox.ts +83 -0
  29. package/src/actions/sandbox/deleteSandbox.ts +91 -0
  30. package/src/actions/sandbox/listSandboxes.ts +28 -0
  31. package/src/actions/sandbox/types/sandboxClient.ts +16 -0
  32. package/src/actions/sandbox/useSandbox.ts +157 -0
  33. package/src/actions/sandbox/withSandboxScopeHint.ts +27 -0
  34. package/src/actions/skills/skills.ts +246 -0
  35. package/src/auth/announceAuthorizationUrl.ts +26 -0
  36. package/src/auth/browser/openSystemBrowser.ts +7 -0
  37. package/src/auth/browser/tryOpenBrowser.ts +17 -0
  38. package/src/auth/browser/watchLauncher.ts +46 -0
  39. package/src/auth/buildAuthorizationUrl.ts +36 -0
  40. package/src/auth/callbackPages.ts +126 -0
  41. package/src/auth/createOrgApiKeys.ts +46 -0
  42. package/src/auth/keyless.ts +119 -0
  43. package/src/auth/oauthConfig.ts +63 -0
  44. package/src/auth/runOAuthFlow.ts +230 -0
  45. package/src/auth/types/browserOpener.ts +5 -0
  46. package/src/auth/types/impersonationTokens.ts +23 -0
  47. package/src/auth/types/oauthTokens.ts +13 -0
  48. package/src/auth/types/orgApiKeys.ts +6 -0
  49. package/src/bin.ts +9 -0
  50. package/src/cli.ts +648 -0
  51. package/src/config/configPackageName.ts +9 -0
  52. package/src/config/legacyConfig.ts +25 -0
  53. package/src/config/loadConfig.ts +231 -0
  54. package/src/env/assertSandboxTarget.ts +20 -0
  55. package/src/env/loadEnv.ts +184 -0
  56. package/src/env/resolveTarget.ts +134 -0
  57. package/src/env/sandboxKeyName.ts +18 -0
  58. package/src/generated/apiRoutes.ts +3787 -0
  59. package/src/generated/client.ts +51564 -0
  60. package/src/generated/emit.ts +1163 -0
  61. package/src/generated/emitRuntime.ts +522 -0
  62. package/src/generated/features.ts +146 -0
  63. package/src/generated/labels.ts +29 -0
  64. package/src/generated/licenses.ts +287 -0
  65. package/src/generated/lintRules.ts +2207 -0
  66. package/src/generated/lintRuntime.ts +865 -0
  67. package/src/generated/plans.ts +1628 -0
  68. package/src/generated/referralPrograms.ts +22 -0
  69. package/src/generated/rewards.ts +58 -0
  70. package/src/generated/settings.ts +21 -0
  71. package/src/generated/skills.ts +305 -0
  72. package/src/generated/variants.ts +934 -0
  73. package/src/generated/wire.ts +334 -0
  74. package/src/http/autumnFetch.ts +30 -0
  75. package/src/index.ts +20 -0
  76. package/src/project/chooseConfigDir.ts +41 -0
  77. package/src/project/resolveProject.ts +115 -0
  78. package/src/project/rootMarker.ts +40 -0
  79. package/src/prompt/prompt.ts +186 -0
  80. package/src/prompt/select.ts +162 -0
  81. package/src/render/renderEnv.ts +77 -0
  82. package/src/render/renderPreview.ts +945 -0
  83. package/src/render/renderSandboxes.ts +92 -0
  84. package/src/render/stripTerminalControls.ts +19 -0
  85. package/src/repo/findRepoRoot.ts +79 -0
  86. package/src/surgery/appendPropertyEdit.ts +67 -0
  87. package/src/surgery/appendToArray.ts +87 -0
  88. package/src/surgery/appendToBinding.ts +19 -0
  89. package/src/surgery/appendToCollection.ts +40 -0
  90. package/src/surgery/appendToFixtureArray.ts +71 -0
  91. package/src/surgery/arrayBinding.ts +30 -0
  92. package/src/surgery/deleteFixtureLiteral.ts +81 -0
  93. package/src/surgery/deleteReference.ts +48 -0
  94. package/src/surgery/ensureBuilderImport.ts +65 -0
  95. package/src/surgery/findFixture.ts +238 -0
  96. package/src/surgery/fixtureEdit.ts +156 -0
  97. package/src/surgery/fixtureLocation.ts +32 -0
  98. package/src/surgery/insertCollection.ts +86 -0
  99. package/src/surgery/insertFirstProperty.ts +73 -0
  100. package/src/surgery/patchFixtureProperty.ts +152 -0
  101. package/src/surgery/patchSingletonProperty.ts +221 -0
  102. package/src/surgery/replaceFixture.ts +28 -0
  103. package/src/surgery/setFixtureProperty.ts +55 -0
  104. package/src/surgery/staticFixtureRule.ts +48 -0
  105. package/src/version.ts +5 -0
  106. package/dist/cli.js +0 -146296
  107. package/dist/compose/index.js +0 -122
  108. package/dist/src/compose/builders/builderFunctions.d.ts +0 -84
  109. package/dist/src/compose/builders/rewardFunctions.d.ts +0 -5
  110. package/dist/src/compose/builders/variantFunctions.d.ts +0 -2
  111. package/dist/src/compose/index.d.ts +0 -19
  112. package/dist/src/compose/models/featureModels.d.ts +0 -262
  113. package/dist/src/compose/models/index.d.ts +0 -3
  114. package/dist/src/compose/models/planModels.d.ts +0 -562
  115. package/dist/src/compose/models/rewardModels.d.ts +0 -52
  116. package/dist/src/compose/models/variantModels.d.ts +0 -34
  117. package/readme.md +0 -186
@@ -0,0 +1,2207 @@
1
+ // Generated by @autumn/atmn-generator from packages/openapi/openapi-internal.yml.
2
+ // Do not edit — run `bun generate` in packages/atmn-generator instead.
3
+
4
+ import type { LintRules } from "./lintRuntime.js";
5
+ export const LINT_RULES: LintRules = {
6
+ features: {
7
+ label: "feature",
8
+ idField: "featureId",
9
+ required: ["featureId", "name", "type"],
10
+ fields: {
11
+ type: {
12
+ enum: ["boolean", "metered", "credit_system", "ai_credit_system"],
13
+ },
14
+ defaultMarkup: {
15
+ minimum: -100,
16
+ },
17
+ internalId: {
18
+ minLength: 1,
19
+ },
20
+ },
21
+ rules: [
22
+ {
23
+ kind: "requiredWhen",
24
+ when: "type",
25
+ equals: "metered",
26
+ require: ["consumable"],
27
+ because:
28
+ "Omitting it silently creates a non-consumable feature, which never resets.",
29
+ },
30
+ {
31
+ kind: "unique",
32
+ field: "featureId",
33
+ because: "Two features claiming one id race to define the same row.",
34
+ },
35
+ {
36
+ kind: "unique",
37
+ field: "internalId",
38
+ because:
39
+ "A stable id names exactly one row; two fixtures cannot both be it.",
40
+ },
41
+ ],
42
+ },
43
+ "features.creditSchema": {
44
+ variants: {
45
+ on: "tierBehavior",
46
+ byValue: {
47
+ graduated: {
48
+ required: ["meteredFeatureId", "tierBehavior", "tiers"],
49
+ fields: {
50
+ meteredFeatureId: {
51
+ minLength: 1,
52
+ },
53
+ billingUnits: {
54
+ exclusiveMinimum: 0,
55
+ },
56
+ tierBehavior: {
57
+ enum: ["graduated"],
58
+ },
59
+ tiers: {
60
+ minItems: 1,
61
+ },
62
+ },
63
+ },
64
+ },
65
+ fallback: {
66
+ required: ["creditCost", "meteredFeatureId"],
67
+ fields: {
68
+ meteredFeatureId: {
69
+ minLength: 1,
70
+ },
71
+ billingUnits: {
72
+ exclusiveMinimum: 0,
73
+ },
74
+ creditCost: {
75
+ minimum: 0,
76
+ },
77
+ },
78
+ },
79
+ },
80
+ },
81
+ "features.creditSchema.dimensions": {
82
+ keys: {
83
+ minLength: 1,
84
+ maxLength: 64,
85
+ },
86
+ },
87
+ "features.creditSchema.dimensions.*": {
88
+ variants: {
89
+ on: "tierBehavior",
90
+ byValue: {
91
+ graduated: {
92
+ required: ["match", "tierBehavior", "tiers"],
93
+ fields: {
94
+ priority: {
95
+ minimum: -9007199254740991,
96
+ maximum: 9007199254740991,
97
+ },
98
+ tierBehavior: {
99
+ enum: ["graduated"],
100
+ },
101
+ tiers: {
102
+ minItems: 1,
103
+ },
104
+ },
105
+ },
106
+ },
107
+ fallback: {
108
+ required: ["creditCost", "match"],
109
+ fields: {
110
+ priority: {
111
+ minimum: -9007199254740991,
112
+ maximum: 9007199254740991,
113
+ },
114
+ creditCost: {
115
+ minimum: 0,
116
+ },
117
+ },
118
+ },
119
+ },
120
+ },
121
+ "features.creditSchema.dimensions.*.tiers": {
122
+ required: ["creditCost", "to"],
123
+ fields: {
124
+ to: {
125
+ exclusiveMinimum: 0,
126
+ },
127
+ creditCost: {
128
+ minimum: 0,
129
+ },
130
+ },
131
+ },
132
+ "features.creditSchema.multipliers": {
133
+ keys: {
134
+ minLength: 1,
135
+ maxLength: 64,
136
+ },
137
+ },
138
+ "features.creditSchema.multipliers.*": {
139
+ required: ["match"],
140
+ fields: {
141
+ factor: {
142
+ exclusiveMinimum: 0,
143
+ },
144
+ },
145
+ },
146
+ "features.creditSchema.tiers": {
147
+ required: ["creditCost", "to"],
148
+ fields: {
149
+ to: {
150
+ exclusiveMinimum: 0,
151
+ },
152
+ creditCost: {
153
+ minimum: 0,
154
+ },
155
+ },
156
+ },
157
+ "features.display": {
158
+ required: ["plural", "singular"],
159
+ },
160
+ "features.modelMarkups": {
161
+ keys: {
162
+ pattern: ".+\\/.+",
163
+ },
164
+ },
165
+ "features.modelMarkups.*": {
166
+ fields: {
167
+ markup: {
168
+ minimum: -100,
169
+ },
170
+ inputCost: {
171
+ minimum: 0,
172
+ },
173
+ outputCost: {
174
+ minimum: 0,
175
+ },
176
+ },
177
+ },
178
+ "features.providerMarkups.*": {
179
+ required: ["markup"],
180
+ fields: {
181
+ markup: {
182
+ minimum: -100,
183
+ },
184
+ },
185
+ },
186
+ plans: {
187
+ label: "plan",
188
+ idField: "planId",
189
+ required: ["planId", "versionSlug"],
190
+ fields: {
191
+ planId: {
192
+ minLength: 1,
193
+ pattern: "^[a-zA-Z0-9_-]+$",
194
+ },
195
+ newPlanId: {
196
+ minLength: 1,
197
+ pattern: "^[a-zA-Z0-9_-]+$",
198
+ },
199
+ internalId: {
200
+ minLength: 1,
201
+ },
202
+ name: {
203
+ minLength: 1,
204
+ },
205
+ version: {
206
+ minimum: 1,
207
+ maximum: 9007199254740991,
208
+ },
209
+ versionSlug: {
210
+ minLength: 1,
211
+ pattern: "^[a-zA-Z0-9_-]+$",
212
+ },
213
+ newVersionSlug: {
214
+ minLength: 1,
215
+ pattern: "^[a-zA-Z0-9_-]+$",
216
+ },
217
+ versioning: {
218
+ enum: ["existing", "new_version", "all_versions"],
219
+ },
220
+ baseVariantId: {
221
+ minLength: 1,
222
+ pattern: "^[a-zA-Z0-9_-]+$",
223
+ },
224
+ },
225
+ rules: [
226
+ {
227
+ kind: "unique",
228
+ field: "internalId",
229
+ because:
230
+ "A stable id names exactly one row; two fixtures cannot both be it.",
231
+ },
232
+ {
233
+ kind: "unique",
234
+ field: "planId",
235
+ alongside: "versionSlug",
236
+ because: "A plan id plus a version slug names exactly one version.",
237
+ },
238
+ {
239
+ kind: "linkedOnce",
240
+ groupBy: "planId",
241
+ namedBy: "versionSlug",
242
+ absentMeans: "v1",
243
+ collection: "variants",
244
+ identity: "variantPlanId",
245
+ pins: ["versionSlug", "version"],
246
+ because:
247
+ "When versioning a base plan with variants linked, you also need to version the variant, and relink the new version to the new variant version.",
248
+ },
249
+ {
250
+ kind: "exactlyOneActive",
251
+ groupBy: "planId",
252
+ field: "active",
253
+ label: "Plan",
254
+ because:
255
+ "Every version of a plan lives in plans; mark the one customers can buy active: true and the rest active: false.",
256
+ },
257
+ ],
258
+ },
259
+ "plans.billingControls.autoTopups": {
260
+ required: ["featureId", "quantity", "threshold"],
261
+ fields: {
262
+ quantity: {
263
+ minimum: 1,
264
+ },
265
+ },
266
+ },
267
+ "plans.billingControls.autoTopups.purchaseLimit": {
268
+ required: ["interval", "limit"],
269
+ fields: {
270
+ interval: {
271
+ enum: ["hour", "day", "week", "month"],
272
+ },
273
+ intervalCount: {
274
+ minimum: 1,
275
+ },
276
+ limit: {
277
+ minimum: 1,
278
+ },
279
+ count: {
280
+ minimum: 0,
281
+ },
282
+ },
283
+ },
284
+ "plans.billingControls.overageAllowed": {
285
+ required: ["featureId"],
286
+ },
287
+ "plans.billingControls.spendLimits": {
288
+ fields: {
289
+ limitType: {
290
+ enum: ["absolute", "usage_percentage"],
291
+ },
292
+ overageLimit: {
293
+ minimum: 0,
294
+ },
295
+ },
296
+ },
297
+ "plans.billingControls.usageAlerts": {
298
+ required: ["threshold", "thresholdType"],
299
+ fields: {
300
+ threshold: {
301
+ minimum: 0,
302
+ },
303
+ thresholdType: {
304
+ enum: [
305
+ "usage",
306
+ "usage_percentage",
307
+ "remaining",
308
+ "remaining_percentage",
309
+ ],
310
+ },
311
+ basis: {
312
+ enum: ["balance", "included", "recurring", "usage_limit"],
313
+ },
314
+ },
315
+ },
316
+ "plans.billingControls.usageAlerts.filter": {
317
+ required: ["properties"],
318
+ },
319
+ "plans.billingControls.usageAlerts.filter.properties": {
320
+ keys: {
321
+ minLength: 1,
322
+ maxLength: 64,
323
+ },
324
+ },
325
+ "plans.billingControls.usageLimits": {
326
+ required: ["featureId", "interval", "limit"],
327
+ fields: {
328
+ limit: {
329
+ minimum: 0,
330
+ },
331
+ interval: {
332
+ enum: ["day", "week", "month", "year"],
333
+ },
334
+ anchor: {
335
+ enum: ["billing_cycle", "utc"],
336
+ },
337
+ },
338
+ },
339
+ "plans.billingControls.usageLimits.filter": {
340
+ required: ["properties"],
341
+ },
342
+ "plans.billingControls.usageLimits.filter.properties": {
343
+ keys: {
344
+ minLength: 1,
345
+ maxLength: 64,
346
+ },
347
+ },
348
+ "plans.freeTrial": {
349
+ required: ["durationLength"],
350
+ fields: {
351
+ durationType: {
352
+ enum: ["day", "month", "year"],
353
+ },
354
+ onEnd: {
355
+ enum: ["bill", "revert"],
356
+ },
357
+ },
358
+ },
359
+ "plans.items": {
360
+ label: "item",
361
+ idField: "featureId",
362
+ required: ["featureId"],
363
+ fields: {
364
+ included: {
365
+ maximum: 10000000000000,
366
+ },
367
+ },
368
+ rules: [
369
+ {
370
+ kind: "exists",
371
+ field: "featureId",
372
+ in: "features",
373
+ matching: "featureId",
374
+ because: "A plan item meters a feature this config does not declare.",
375
+ },
376
+ {
377
+ kind: "targetHas",
378
+ when: "featureOverride",
379
+ field: "featureId",
380
+ in: "features",
381
+ matching: "featureId",
382
+ target: "type",
383
+ equals: "credit_system",
384
+ because:
385
+ "featureOverride is only honoured on classic credit-system features.",
386
+ },
387
+ {
388
+ kind: "targetLacks",
389
+ field: "featureId",
390
+ in: "features",
391
+ matching: "featureId",
392
+ target: "archived",
393
+ label: "Feature",
394
+ parentGuard: "archived",
395
+ parentIdField: "planId",
396
+ parentLabel: "plan",
397
+ because:
398
+ "An archived feature should not gain new customers through a live plan.",
399
+ },
400
+ ],
401
+ },
402
+ "plans.items.featureOverride.creditSchema": {
403
+ variants: {
404
+ on: "tierBehavior",
405
+ byValue: {
406
+ graduated: {
407
+ required: ["meteredFeatureId", "tierBehavior", "tiers"],
408
+ fields: {
409
+ meteredFeatureId: {
410
+ minLength: 1,
411
+ },
412
+ billingUnits: {
413
+ exclusiveMinimum: 0,
414
+ },
415
+ tierBehavior: {
416
+ enum: ["graduated"],
417
+ },
418
+ tiers: {
419
+ minItems: 1,
420
+ },
421
+ },
422
+ },
423
+ },
424
+ fallback: {
425
+ required: ["creditCost", "meteredFeatureId"],
426
+ fields: {
427
+ meteredFeatureId: {
428
+ minLength: 1,
429
+ },
430
+ billingUnits: {
431
+ exclusiveMinimum: 0,
432
+ },
433
+ creditCost: {
434
+ minimum: 0,
435
+ },
436
+ },
437
+ },
438
+ },
439
+ },
440
+ "plans.items.featureOverride.creditSchema.dimensions": {
441
+ keys: {
442
+ minLength: 1,
443
+ maxLength: 64,
444
+ },
445
+ },
446
+ "plans.items.featureOverride.creditSchema.dimensions.*": {
447
+ variants: {
448
+ on: "tierBehavior",
449
+ byValue: {
450
+ graduated: {
451
+ required: ["match", "tierBehavior", "tiers"],
452
+ fields: {
453
+ priority: {
454
+ minimum: -9007199254740991,
455
+ maximum: 9007199254740991,
456
+ },
457
+ tierBehavior: {
458
+ enum: ["graduated"],
459
+ },
460
+ tiers: {
461
+ minItems: 1,
462
+ },
463
+ },
464
+ },
465
+ },
466
+ fallback: {
467
+ required: ["creditCost", "match"],
468
+ fields: {
469
+ priority: {
470
+ minimum: -9007199254740991,
471
+ maximum: 9007199254740991,
472
+ },
473
+ creditCost: {
474
+ minimum: 0,
475
+ },
476
+ },
477
+ },
478
+ },
479
+ },
480
+ "plans.items.featureOverride.creditSchema.dimensions.*.tiers": {
481
+ required: ["creditCost", "to"],
482
+ fields: {
483
+ to: {
484
+ exclusiveMinimum: 0,
485
+ },
486
+ creditCost: {
487
+ minimum: 0,
488
+ },
489
+ },
490
+ },
491
+ "plans.items.featureOverride.creditSchema.multipliers": {
492
+ keys: {
493
+ minLength: 1,
494
+ maxLength: 64,
495
+ },
496
+ },
497
+ "plans.items.featureOverride.creditSchema.multipliers.*": {
498
+ required: ["match"],
499
+ fields: {
500
+ factor: {
501
+ exclusiveMinimum: 0,
502
+ },
503
+ },
504
+ },
505
+ "plans.items.featureOverride.creditSchema.tiers": {
506
+ required: ["creditCost", "to"],
507
+ fields: {
508
+ to: {
509
+ exclusiveMinimum: 0,
510
+ },
511
+ creditCost: {
512
+ minimum: 0,
513
+ },
514
+ },
515
+ },
516
+ "plans.items.featureOverride.markups": {
517
+ fields: {
518
+ defaultMarkup: {
519
+ minimum: -100,
520
+ },
521
+ },
522
+ },
523
+ "plans.items.featureOverride.markups.modelMarkups": {
524
+ keys: {
525
+ pattern: ".+\\/.+",
526
+ },
527
+ },
528
+ "plans.items.featureOverride.markups.modelMarkups.*": {
529
+ fields: {
530
+ markup: {
531
+ minimum: -100,
532
+ },
533
+ inputCost: {
534
+ minimum: 0,
535
+ },
536
+ outputCost: {
537
+ minimum: 0,
538
+ },
539
+ },
540
+ },
541
+ "plans.items.featureOverride.markups.providerMarkups.*": {
542
+ required: ["markup"],
543
+ fields: {
544
+ markup: {
545
+ minimum: -100,
546
+ },
547
+ },
548
+ },
549
+ "plans.items.price": {
550
+ label: "price",
551
+ required: ["billingMethod", "interval"],
552
+ fields: {
553
+ tierBehavior: {
554
+ enum: ["graduated", "volume"],
555
+ },
556
+ interval: {
557
+ enum: ["one_off", "week", "month", "quarter", "semi_annual", "year"],
558
+ },
559
+ billingMethod: {
560
+ enum: ["prepaid", "usage_based"],
561
+ },
562
+ allocatedBilling: {
563
+ enum: ["arrear", "prorated_legacy"],
564
+ },
565
+ },
566
+ rules: [
567
+ {
568
+ kind: "valueWhen",
569
+ when: "tierBehavior",
570
+ equals: "volume",
571
+ field: "billingMethod",
572
+ mustBe: "prepaid",
573
+ because: "Volume tiers are prepaid-only.",
574
+ },
575
+ ],
576
+ },
577
+ "plans.items.price.additionalCurrencies": {
578
+ required: ["amount", "currency"],
579
+ },
580
+ "plans.items.price.processors.stripe": {
581
+ required: ["priceId"],
582
+ },
583
+ "plans.items.price.tiers": {
584
+ required: ["to"],
585
+ },
586
+ "plans.items.price.tiers.additionalCurrencies": {
587
+ required: ["currency"],
588
+ },
589
+ "plans.items.proration": {
590
+ required: ["onDecrease", "onIncrease"],
591
+ fields: {
592
+ onIncrease: {
593
+ enum: [
594
+ "bill_immediately",
595
+ "prorate_immediately",
596
+ "prorate_next_cycle",
597
+ "bill_next_cycle",
598
+ ],
599
+ },
600
+ onDecrease: {
601
+ enum: [
602
+ "prorate",
603
+ "prorate_immediately",
604
+ "prorate_next_cycle",
605
+ "none",
606
+ "no_prorations",
607
+ ],
608
+ },
609
+ },
610
+ },
611
+ "plans.items.reset": {
612
+ required: ["interval"],
613
+ fields: {
614
+ interval: {
615
+ enum: [
616
+ "one_off",
617
+ "minute",
618
+ "hour",
619
+ "day",
620
+ "week",
621
+ "month",
622
+ "quarter",
623
+ "semi_annual",
624
+ "year",
625
+ ],
626
+ },
627
+ },
628
+ },
629
+ "plans.items.rollover": {
630
+ required: ["expiryDurationType"],
631
+ fields: {
632
+ expiryDurationType: {
633
+ enum: ["month", "forever"],
634
+ },
635
+ },
636
+ },
637
+ "plans.items.thresholdBilling": {
638
+ required: ["threshold"],
639
+ fields: {
640
+ threshold: {
641
+ exclusiveMinimum: 0,
642
+ },
643
+ },
644
+ },
645
+ "plans.licenses": {
646
+ label: "license",
647
+ idField: "licensePlanId",
648
+ required: ["licensePlanId", "versionSlug"],
649
+ fields: {
650
+ included: {
651
+ minimum: 0,
652
+ maximum: 9007199254740991,
653
+ },
654
+ },
655
+ },
656
+ "plans.licenses.customize.addItems": {
657
+ required: ["featureId"],
658
+ fields: {
659
+ included: {
660
+ maximum: 10000000000000,
661
+ },
662
+ },
663
+ },
664
+ "plans.licenses.customize.addItems.featureOverride.creditSchema": {
665
+ variants: {
666
+ on: "tierBehavior",
667
+ byValue: {
668
+ graduated: {
669
+ required: ["meteredFeatureId", "tierBehavior", "tiers"],
670
+ fields: {
671
+ meteredFeatureId: {
672
+ minLength: 1,
673
+ },
674
+ billingUnits: {
675
+ exclusiveMinimum: 0,
676
+ },
677
+ tierBehavior: {
678
+ enum: ["graduated"],
679
+ },
680
+ tiers: {
681
+ minItems: 1,
682
+ },
683
+ },
684
+ },
685
+ },
686
+ fallback: {
687
+ required: ["creditCost", "meteredFeatureId"],
688
+ fields: {
689
+ meteredFeatureId: {
690
+ minLength: 1,
691
+ },
692
+ billingUnits: {
693
+ exclusiveMinimum: 0,
694
+ },
695
+ creditCost: {
696
+ minimum: 0,
697
+ },
698
+ },
699
+ },
700
+ },
701
+ },
702
+ "plans.licenses.customize.addItems.featureOverride.creditSchema.dimensions": {
703
+ keys: {
704
+ minLength: 1,
705
+ maxLength: 64,
706
+ },
707
+ },
708
+ "plans.licenses.customize.addItems.featureOverride.creditSchema.dimensions.*":
709
+ {
710
+ variants: {
711
+ on: "tierBehavior",
712
+ byValue: {
713
+ graduated: {
714
+ required: ["match", "tierBehavior", "tiers"],
715
+ fields: {
716
+ priority: {
717
+ minimum: -9007199254740991,
718
+ maximum: 9007199254740991,
719
+ },
720
+ tierBehavior: {
721
+ enum: ["graduated"],
722
+ },
723
+ tiers: {
724
+ minItems: 1,
725
+ },
726
+ },
727
+ },
728
+ },
729
+ fallback: {
730
+ required: ["creditCost", "match"],
731
+ fields: {
732
+ priority: {
733
+ minimum: -9007199254740991,
734
+ maximum: 9007199254740991,
735
+ },
736
+ creditCost: {
737
+ minimum: 0,
738
+ },
739
+ },
740
+ },
741
+ },
742
+ },
743
+ "plans.licenses.customize.addItems.featureOverride.creditSchema.dimensions.*.tiers":
744
+ {
745
+ required: ["creditCost", "to"],
746
+ fields: {
747
+ to: {
748
+ exclusiveMinimum: 0,
749
+ },
750
+ creditCost: {
751
+ minimum: 0,
752
+ },
753
+ },
754
+ },
755
+ "plans.licenses.customize.addItems.featureOverride.creditSchema.multipliers":
756
+ {
757
+ keys: {
758
+ minLength: 1,
759
+ maxLength: 64,
760
+ },
761
+ },
762
+ "plans.licenses.customize.addItems.featureOverride.creditSchema.multipliers.*":
763
+ {
764
+ required: ["match"],
765
+ fields: {
766
+ factor: {
767
+ exclusiveMinimum: 0,
768
+ },
769
+ },
770
+ },
771
+ "plans.licenses.customize.addItems.featureOverride.creditSchema.tiers": {
772
+ required: ["creditCost", "to"],
773
+ fields: {
774
+ to: {
775
+ exclusiveMinimum: 0,
776
+ },
777
+ creditCost: {
778
+ minimum: 0,
779
+ },
780
+ },
781
+ },
782
+ "plans.licenses.customize.addItems.featureOverride.markups": {
783
+ fields: {
784
+ defaultMarkup: {
785
+ minimum: -100,
786
+ },
787
+ },
788
+ },
789
+ "plans.licenses.customize.addItems.featureOverride.markups.modelMarkups": {
790
+ keys: {
791
+ pattern: ".+\\/.+",
792
+ },
793
+ },
794
+ "plans.licenses.customize.addItems.featureOverride.markups.modelMarkups.*": {
795
+ fields: {
796
+ markup: {
797
+ minimum: -100,
798
+ },
799
+ inputCost: {
800
+ minimum: 0,
801
+ },
802
+ outputCost: {
803
+ minimum: 0,
804
+ },
805
+ },
806
+ },
807
+ "plans.licenses.customize.addItems.featureOverride.markups.providerMarkups.*":
808
+ {
809
+ required: ["markup"],
810
+ fields: {
811
+ markup: {
812
+ minimum: -100,
813
+ },
814
+ },
815
+ },
816
+ "plans.licenses.customize.addItems.price": {
817
+ required: ["billingMethod", "interval"],
818
+ fields: {
819
+ tierBehavior: {
820
+ enum: ["graduated", "volume"],
821
+ },
822
+ interval: {
823
+ enum: ["one_off", "week", "month", "quarter", "semi_annual", "year"],
824
+ },
825
+ billingMethod: {
826
+ enum: ["prepaid", "usage_based"],
827
+ },
828
+ allocatedBilling: {
829
+ enum: ["arrear", "prorated_legacy"],
830
+ },
831
+ },
832
+ },
833
+ "plans.licenses.customize.addItems.price.additionalCurrencies": {
834
+ required: ["amount", "currency"],
835
+ },
836
+ "plans.licenses.customize.addItems.price.tiers": {
837
+ required: ["to"],
838
+ },
839
+ "plans.licenses.customize.addItems.price.tiers.additionalCurrencies": {
840
+ required: ["currency"],
841
+ },
842
+ "plans.licenses.customize.addItems.proration": {
843
+ required: ["onDecrease", "onIncrease"],
844
+ fields: {
845
+ onIncrease: {
846
+ enum: [
847
+ "bill_immediately",
848
+ "prorate_immediately",
849
+ "prorate_next_cycle",
850
+ "bill_next_cycle",
851
+ ],
852
+ },
853
+ onDecrease: {
854
+ enum: [
855
+ "prorate",
856
+ "prorate_immediately",
857
+ "prorate_next_cycle",
858
+ "none",
859
+ "no_prorations",
860
+ ],
861
+ },
862
+ },
863
+ },
864
+ "plans.licenses.customize.addItems.reset": {
865
+ required: ["interval"],
866
+ fields: {
867
+ interval: {
868
+ enum: [
869
+ "one_off",
870
+ "minute",
871
+ "hour",
872
+ "day",
873
+ "week",
874
+ "month",
875
+ "quarter",
876
+ "semi_annual",
877
+ "year",
878
+ ],
879
+ },
880
+ },
881
+ },
882
+ "plans.licenses.customize.addItems.rollover": {
883
+ required: ["expiryDurationType"],
884
+ fields: {
885
+ expiryDurationType: {
886
+ enum: ["month", "forever"],
887
+ },
888
+ },
889
+ },
890
+ "plans.licenses.customize.addItems.thresholdBilling": {
891
+ required: ["threshold"],
892
+ fields: {
893
+ threshold: {
894
+ exclusiveMinimum: 0,
895
+ },
896
+ },
897
+ },
898
+ "plans.licenses.customize.price": {
899
+ required: ["amount", "interval"],
900
+ fields: {
901
+ interval: {
902
+ enum: ["one_off", "week", "month", "quarter", "semi_annual", "year"],
903
+ },
904
+ },
905
+ },
906
+ "plans.licenses.customize.price.additionalCurrencies": {
907
+ required: ["amount", "currency"],
908
+ },
909
+ "plans.licenses.customize.removeItems": {
910
+ fields: {
911
+ billingMethod: {
912
+ enum: ["prepaid", "usage_based"],
913
+ },
914
+ interval: {
915
+ enum: [
916
+ "one_off",
917
+ "week",
918
+ "month",
919
+ "quarter",
920
+ "semi_annual",
921
+ "year",
922
+ "minute",
923
+ "hour",
924
+ "day",
925
+ ],
926
+ },
927
+ intervalCount: {
928
+ minimum: -9007199254740991,
929
+ maximum: 9007199254740991,
930
+ exclusiveMinimum: 0,
931
+ },
932
+ included: {
933
+ maximum: 10000000000000,
934
+ },
935
+ },
936
+ },
937
+ "plans.price": {
938
+ required: ["amount", "interval"],
939
+ fields: {
940
+ interval: {
941
+ enum: ["one_off", "week", "month", "quarter", "semi_annual", "year"],
942
+ },
943
+ },
944
+ },
945
+ "plans.price.additionalCurrencies": {
946
+ required: ["amount", "currency"],
947
+ },
948
+ "plans.price.processors.stripe": {
949
+ required: ["priceId"],
950
+ },
951
+ "plans.processors.revenuecat": {
952
+ required: ["products"],
953
+ },
954
+ "plans.processors.revenuecat.products": {
955
+ required: ["productId"],
956
+ },
957
+ "plans.processors.revenuecat.products.featureQuantities": {
958
+ required: ["featureId"],
959
+ fields: {
960
+ quantity: {
961
+ minimum: 0,
962
+ },
963
+ },
964
+ },
965
+ "plans.processors.stripe": {
966
+ required: ["productId"],
967
+ },
968
+ "plans.propagate.licenseParents": {
969
+ required: ["planId"],
970
+ fields: {
971
+ planId: {
972
+ minLength: 1,
973
+ pattern: "^[a-zA-Z0-9_-]+$",
974
+ },
975
+ version: {
976
+ minimum: 1,
977
+ maximum: 9007199254740991,
978
+ },
979
+ versionSlug: {
980
+ minLength: 1,
981
+ pattern: "^[a-zA-Z0-9_-]+$",
982
+ },
983
+ newVersionSlug: {
984
+ minLength: 1,
985
+ pattern: "^[a-zA-Z0-9_-]+$",
986
+ },
987
+ },
988
+ },
989
+ "plans.propagate.variants": {
990
+ required: ["planId"],
991
+ fields: {
992
+ planId: {
993
+ minLength: 1,
994
+ pattern: "^[a-zA-Z0-9_-]+$",
995
+ },
996
+ version: {
997
+ minimum: 1,
998
+ maximum: 9007199254740991,
999
+ },
1000
+ versionSlug: {
1001
+ minLength: 1,
1002
+ pattern: "^[a-zA-Z0-9_-]+$",
1003
+ },
1004
+ newVersionSlug: {
1005
+ minLength: 1,
1006
+ pattern: "^[a-zA-Z0-9_-]+$",
1007
+ },
1008
+ },
1009
+ },
1010
+ "plans.variants": {
1011
+ label: "variant",
1012
+ idField: "variantPlanId",
1013
+ required: ["variantPlanId", "versionSlug"],
1014
+ fields: {
1015
+ variantPlanId: {
1016
+ minLength: 1,
1017
+ pattern: "^[a-zA-Z0-9_-]+$",
1018
+ },
1019
+ internalId: {
1020
+ minLength: 1,
1021
+ },
1022
+ version: {
1023
+ minimum: 1,
1024
+ maximum: 9007199254740991,
1025
+ },
1026
+ versionSlug: {
1027
+ minLength: 1,
1028
+ pattern: "^[a-zA-Z0-9_-]+$",
1029
+ },
1030
+ name: {
1031
+ minLength: 1,
1032
+ },
1033
+ newPlanId: {
1034
+ minLength: 1,
1035
+ pattern: "^[a-zA-Z0-9_-]+$",
1036
+ },
1037
+ newVersionSlug: {
1038
+ minLength: 1,
1039
+ pattern: "^[a-zA-Z0-9_-]+$",
1040
+ },
1041
+ baseVariantId: {
1042
+ minLength: 1,
1043
+ pattern: "^[a-zA-Z0-9_-]+$",
1044
+ },
1045
+ },
1046
+ },
1047
+ "plans.variants.customize.addItems": {
1048
+ required: ["featureId"],
1049
+ fields: {
1050
+ included: {
1051
+ maximum: 10000000000000,
1052
+ },
1053
+ },
1054
+ },
1055
+ "plans.variants.customize.addItems.featureOverride.creditSchema": {
1056
+ variants: {
1057
+ on: "tierBehavior",
1058
+ byValue: {
1059
+ graduated: {
1060
+ required: ["meteredFeatureId", "tierBehavior", "tiers"],
1061
+ fields: {
1062
+ meteredFeatureId: {
1063
+ minLength: 1,
1064
+ },
1065
+ billingUnits: {
1066
+ exclusiveMinimum: 0,
1067
+ },
1068
+ tierBehavior: {
1069
+ enum: ["graduated"],
1070
+ },
1071
+ tiers: {
1072
+ minItems: 1,
1073
+ },
1074
+ },
1075
+ },
1076
+ },
1077
+ fallback: {
1078
+ required: ["creditCost", "meteredFeatureId"],
1079
+ fields: {
1080
+ meteredFeatureId: {
1081
+ minLength: 1,
1082
+ },
1083
+ billingUnits: {
1084
+ exclusiveMinimum: 0,
1085
+ },
1086
+ creditCost: {
1087
+ minimum: 0,
1088
+ },
1089
+ },
1090
+ },
1091
+ },
1092
+ },
1093
+ "plans.variants.customize.addItems.featureOverride.creditSchema.dimensions": {
1094
+ keys: {
1095
+ minLength: 1,
1096
+ maxLength: 64,
1097
+ },
1098
+ },
1099
+ "plans.variants.customize.addItems.featureOverride.creditSchema.dimensions.*":
1100
+ {
1101
+ variants: {
1102
+ on: "tierBehavior",
1103
+ byValue: {
1104
+ graduated: {
1105
+ required: ["match", "tierBehavior", "tiers"],
1106
+ fields: {
1107
+ priority: {
1108
+ minimum: -9007199254740991,
1109
+ maximum: 9007199254740991,
1110
+ },
1111
+ tierBehavior: {
1112
+ enum: ["graduated"],
1113
+ },
1114
+ tiers: {
1115
+ minItems: 1,
1116
+ },
1117
+ },
1118
+ },
1119
+ },
1120
+ fallback: {
1121
+ required: ["creditCost", "match"],
1122
+ fields: {
1123
+ priority: {
1124
+ minimum: -9007199254740991,
1125
+ maximum: 9007199254740991,
1126
+ },
1127
+ creditCost: {
1128
+ minimum: 0,
1129
+ },
1130
+ },
1131
+ },
1132
+ },
1133
+ },
1134
+ "plans.variants.customize.addItems.featureOverride.creditSchema.dimensions.*.tiers":
1135
+ {
1136
+ required: ["creditCost", "to"],
1137
+ fields: {
1138
+ to: {
1139
+ exclusiveMinimum: 0,
1140
+ },
1141
+ creditCost: {
1142
+ minimum: 0,
1143
+ },
1144
+ },
1145
+ },
1146
+ "plans.variants.customize.addItems.featureOverride.creditSchema.multipliers":
1147
+ {
1148
+ keys: {
1149
+ minLength: 1,
1150
+ maxLength: 64,
1151
+ },
1152
+ },
1153
+ "plans.variants.customize.addItems.featureOverride.creditSchema.multipliers.*":
1154
+ {
1155
+ required: ["match"],
1156
+ fields: {
1157
+ factor: {
1158
+ exclusiveMinimum: 0,
1159
+ },
1160
+ },
1161
+ },
1162
+ "plans.variants.customize.addItems.featureOverride.creditSchema.tiers": {
1163
+ required: ["creditCost", "to"],
1164
+ fields: {
1165
+ to: {
1166
+ exclusiveMinimum: 0,
1167
+ },
1168
+ creditCost: {
1169
+ minimum: 0,
1170
+ },
1171
+ },
1172
+ },
1173
+ "plans.variants.customize.addItems.featureOverride.markups": {
1174
+ fields: {
1175
+ defaultMarkup: {
1176
+ minimum: -100,
1177
+ },
1178
+ },
1179
+ },
1180
+ "plans.variants.customize.addItems.featureOverride.markups.modelMarkups": {
1181
+ keys: {
1182
+ pattern: ".+\\/.+",
1183
+ },
1184
+ },
1185
+ "plans.variants.customize.addItems.featureOverride.markups.modelMarkups.*": {
1186
+ fields: {
1187
+ markup: {
1188
+ minimum: -100,
1189
+ },
1190
+ inputCost: {
1191
+ minimum: 0,
1192
+ },
1193
+ outputCost: {
1194
+ minimum: 0,
1195
+ },
1196
+ },
1197
+ },
1198
+ "plans.variants.customize.addItems.featureOverride.markups.providerMarkups.*":
1199
+ {
1200
+ required: ["markup"],
1201
+ fields: {
1202
+ markup: {
1203
+ minimum: -100,
1204
+ },
1205
+ },
1206
+ },
1207
+ "plans.variants.customize.addItems.price": {
1208
+ required: ["billingMethod", "interval"],
1209
+ fields: {
1210
+ tierBehavior: {
1211
+ enum: ["graduated", "volume"],
1212
+ },
1213
+ interval: {
1214
+ enum: ["one_off", "week", "month", "quarter", "semi_annual", "year"],
1215
+ },
1216
+ billingMethod: {
1217
+ enum: ["prepaid", "usage_based"],
1218
+ },
1219
+ allocatedBilling: {
1220
+ enum: ["arrear", "prorated_legacy"],
1221
+ },
1222
+ },
1223
+ },
1224
+ "plans.variants.customize.addItems.price.additionalCurrencies": {
1225
+ required: ["amount", "currency"],
1226
+ },
1227
+ "plans.variants.customize.addItems.price.tiers": {
1228
+ required: ["to"],
1229
+ },
1230
+ "plans.variants.customize.addItems.price.tiers.additionalCurrencies": {
1231
+ required: ["currency"],
1232
+ },
1233
+ "plans.variants.customize.addItems.proration": {
1234
+ required: ["onDecrease", "onIncrease"],
1235
+ fields: {
1236
+ onIncrease: {
1237
+ enum: [
1238
+ "bill_immediately",
1239
+ "prorate_immediately",
1240
+ "prorate_next_cycle",
1241
+ "bill_next_cycle",
1242
+ ],
1243
+ },
1244
+ onDecrease: {
1245
+ enum: [
1246
+ "prorate",
1247
+ "prorate_immediately",
1248
+ "prorate_next_cycle",
1249
+ "none",
1250
+ "no_prorations",
1251
+ ],
1252
+ },
1253
+ },
1254
+ },
1255
+ "plans.variants.customize.addItems.reset": {
1256
+ required: ["interval"],
1257
+ fields: {
1258
+ interval: {
1259
+ enum: [
1260
+ "one_off",
1261
+ "minute",
1262
+ "hour",
1263
+ "day",
1264
+ "week",
1265
+ "month",
1266
+ "quarter",
1267
+ "semi_annual",
1268
+ "year",
1269
+ ],
1270
+ },
1271
+ },
1272
+ },
1273
+ "plans.variants.customize.addItems.rollover": {
1274
+ required: ["expiryDurationType"],
1275
+ fields: {
1276
+ expiryDurationType: {
1277
+ enum: ["month", "forever"],
1278
+ },
1279
+ },
1280
+ },
1281
+ "plans.variants.customize.addItems.thresholdBilling": {
1282
+ required: ["threshold"],
1283
+ fields: {
1284
+ threshold: {
1285
+ exclusiveMinimum: 0,
1286
+ },
1287
+ },
1288
+ },
1289
+ "plans.variants.customize.billingControls.autoTopups": {
1290
+ required: ["featureId", "quantity", "threshold"],
1291
+ fields: {
1292
+ quantity: {
1293
+ minimum: 1,
1294
+ },
1295
+ },
1296
+ },
1297
+ "plans.variants.customize.billingControls.autoTopups.purchaseLimit": {
1298
+ required: ["interval", "limit"],
1299
+ fields: {
1300
+ interval: {
1301
+ enum: ["hour", "day", "week", "month"],
1302
+ },
1303
+ intervalCount: {
1304
+ minimum: 1,
1305
+ },
1306
+ limit: {
1307
+ minimum: 1,
1308
+ },
1309
+ count: {
1310
+ minimum: 0,
1311
+ },
1312
+ },
1313
+ },
1314
+ "plans.variants.customize.billingControls.overageAllowed": {
1315
+ required: ["featureId"],
1316
+ },
1317
+ "plans.variants.customize.billingControls.spendLimits": {
1318
+ fields: {
1319
+ limitType: {
1320
+ enum: ["absolute", "usage_percentage"],
1321
+ },
1322
+ overageLimit: {
1323
+ minimum: 0,
1324
+ },
1325
+ },
1326
+ },
1327
+ "plans.variants.customize.billingControls.usageAlerts": {
1328
+ required: ["threshold", "thresholdType"],
1329
+ fields: {
1330
+ threshold: {
1331
+ minimum: 0,
1332
+ },
1333
+ thresholdType: {
1334
+ enum: [
1335
+ "usage",
1336
+ "usage_percentage",
1337
+ "remaining",
1338
+ "remaining_percentage",
1339
+ ],
1340
+ },
1341
+ basis: {
1342
+ enum: ["balance", "included", "recurring", "usage_limit"],
1343
+ },
1344
+ },
1345
+ },
1346
+ "plans.variants.customize.billingControls.usageAlerts.filter": {
1347
+ required: ["properties"],
1348
+ },
1349
+ "plans.variants.customize.billingControls.usageAlerts.filter.properties": {
1350
+ keys: {
1351
+ minLength: 1,
1352
+ maxLength: 64,
1353
+ },
1354
+ },
1355
+ "plans.variants.customize.billingControls.usageLimits": {
1356
+ required: ["featureId", "interval", "limit"],
1357
+ fields: {
1358
+ limit: {
1359
+ minimum: 0,
1360
+ },
1361
+ interval: {
1362
+ enum: ["day", "week", "month", "year"],
1363
+ },
1364
+ anchor: {
1365
+ enum: ["billing_cycle", "utc"],
1366
+ },
1367
+ },
1368
+ },
1369
+ "plans.variants.customize.billingControls.usageLimits.filter": {
1370
+ required: ["properties"],
1371
+ },
1372
+ "plans.variants.customize.billingControls.usageLimits.filter.properties": {
1373
+ keys: {
1374
+ minLength: 1,
1375
+ maxLength: 64,
1376
+ },
1377
+ },
1378
+ "plans.variants.customize.freeTrial": {
1379
+ required: ["durationLength"],
1380
+ fields: {
1381
+ durationType: {
1382
+ enum: ["day", "month", "year"],
1383
+ },
1384
+ onEnd: {
1385
+ enum: ["bill", "revert"],
1386
+ },
1387
+ },
1388
+ },
1389
+ "plans.variants.customize.items": {
1390
+ required: ["featureId"],
1391
+ fields: {
1392
+ included: {
1393
+ maximum: 10000000000000,
1394
+ },
1395
+ },
1396
+ },
1397
+ "plans.variants.customize.items.featureOverride.creditSchema": {
1398
+ variants: {
1399
+ on: "tierBehavior",
1400
+ byValue: {
1401
+ graduated: {
1402
+ required: ["meteredFeatureId", "tierBehavior", "tiers"],
1403
+ fields: {
1404
+ meteredFeatureId: {
1405
+ minLength: 1,
1406
+ },
1407
+ billingUnits: {
1408
+ exclusiveMinimum: 0,
1409
+ },
1410
+ tierBehavior: {
1411
+ enum: ["graduated"],
1412
+ },
1413
+ tiers: {
1414
+ minItems: 1,
1415
+ },
1416
+ },
1417
+ },
1418
+ },
1419
+ fallback: {
1420
+ required: ["creditCost", "meteredFeatureId"],
1421
+ fields: {
1422
+ meteredFeatureId: {
1423
+ minLength: 1,
1424
+ },
1425
+ billingUnits: {
1426
+ exclusiveMinimum: 0,
1427
+ },
1428
+ creditCost: {
1429
+ minimum: 0,
1430
+ },
1431
+ },
1432
+ },
1433
+ },
1434
+ },
1435
+ "plans.variants.customize.items.featureOverride.creditSchema.dimensions": {
1436
+ keys: {
1437
+ minLength: 1,
1438
+ maxLength: 64,
1439
+ },
1440
+ },
1441
+ "plans.variants.customize.items.featureOverride.creditSchema.dimensions.*": {
1442
+ variants: {
1443
+ on: "tierBehavior",
1444
+ byValue: {
1445
+ graduated: {
1446
+ required: ["match", "tierBehavior", "tiers"],
1447
+ fields: {
1448
+ priority: {
1449
+ minimum: -9007199254740991,
1450
+ maximum: 9007199254740991,
1451
+ },
1452
+ tierBehavior: {
1453
+ enum: ["graduated"],
1454
+ },
1455
+ tiers: {
1456
+ minItems: 1,
1457
+ },
1458
+ },
1459
+ },
1460
+ },
1461
+ fallback: {
1462
+ required: ["creditCost", "match"],
1463
+ fields: {
1464
+ priority: {
1465
+ minimum: -9007199254740991,
1466
+ maximum: 9007199254740991,
1467
+ },
1468
+ creditCost: {
1469
+ minimum: 0,
1470
+ },
1471
+ },
1472
+ },
1473
+ },
1474
+ },
1475
+ "plans.variants.customize.items.featureOverride.creditSchema.dimensions.*.tiers":
1476
+ {
1477
+ required: ["creditCost", "to"],
1478
+ fields: {
1479
+ to: {
1480
+ exclusiveMinimum: 0,
1481
+ },
1482
+ creditCost: {
1483
+ minimum: 0,
1484
+ },
1485
+ },
1486
+ },
1487
+ "plans.variants.customize.items.featureOverride.creditSchema.multipliers": {
1488
+ keys: {
1489
+ minLength: 1,
1490
+ maxLength: 64,
1491
+ },
1492
+ },
1493
+ "plans.variants.customize.items.featureOverride.creditSchema.multipliers.*": {
1494
+ required: ["match"],
1495
+ fields: {
1496
+ factor: {
1497
+ exclusiveMinimum: 0,
1498
+ },
1499
+ },
1500
+ },
1501
+ "plans.variants.customize.items.featureOverride.creditSchema.tiers": {
1502
+ required: ["creditCost", "to"],
1503
+ fields: {
1504
+ to: {
1505
+ exclusiveMinimum: 0,
1506
+ },
1507
+ creditCost: {
1508
+ minimum: 0,
1509
+ },
1510
+ },
1511
+ },
1512
+ "plans.variants.customize.items.featureOverride.markups": {
1513
+ fields: {
1514
+ defaultMarkup: {
1515
+ minimum: -100,
1516
+ },
1517
+ },
1518
+ },
1519
+ "plans.variants.customize.items.featureOverride.markups.modelMarkups": {
1520
+ keys: {
1521
+ pattern: ".+\\/.+",
1522
+ },
1523
+ },
1524
+ "plans.variants.customize.items.featureOverride.markups.modelMarkups.*": {
1525
+ fields: {
1526
+ markup: {
1527
+ minimum: -100,
1528
+ },
1529
+ inputCost: {
1530
+ minimum: 0,
1531
+ },
1532
+ outputCost: {
1533
+ minimum: 0,
1534
+ },
1535
+ },
1536
+ },
1537
+ "plans.variants.customize.items.featureOverride.markups.providerMarkups.*": {
1538
+ required: ["markup"],
1539
+ fields: {
1540
+ markup: {
1541
+ minimum: -100,
1542
+ },
1543
+ },
1544
+ },
1545
+ "plans.variants.customize.items.price": {
1546
+ required: ["billingMethod", "interval"],
1547
+ fields: {
1548
+ tierBehavior: {
1549
+ enum: ["graduated", "volume"],
1550
+ },
1551
+ interval: {
1552
+ enum: ["one_off", "week", "month", "quarter", "semi_annual", "year"],
1553
+ },
1554
+ billingMethod: {
1555
+ enum: ["prepaid", "usage_based"],
1556
+ },
1557
+ allocatedBilling: {
1558
+ enum: ["arrear", "prorated_legacy"],
1559
+ },
1560
+ },
1561
+ },
1562
+ "plans.variants.customize.items.price.additionalCurrencies": {
1563
+ required: ["amount", "currency"],
1564
+ },
1565
+ "plans.variants.customize.items.price.tiers": {
1566
+ required: ["to"],
1567
+ },
1568
+ "plans.variants.customize.items.price.tiers.additionalCurrencies": {
1569
+ required: ["currency"],
1570
+ },
1571
+ "plans.variants.customize.items.proration": {
1572
+ required: ["onDecrease", "onIncrease"],
1573
+ fields: {
1574
+ onIncrease: {
1575
+ enum: [
1576
+ "bill_immediately",
1577
+ "prorate_immediately",
1578
+ "prorate_next_cycle",
1579
+ "bill_next_cycle",
1580
+ ],
1581
+ },
1582
+ onDecrease: {
1583
+ enum: [
1584
+ "prorate",
1585
+ "prorate_immediately",
1586
+ "prorate_next_cycle",
1587
+ "none",
1588
+ "no_prorations",
1589
+ ],
1590
+ },
1591
+ },
1592
+ },
1593
+ "plans.variants.customize.items.reset": {
1594
+ required: ["interval"],
1595
+ fields: {
1596
+ interval: {
1597
+ enum: [
1598
+ "one_off",
1599
+ "minute",
1600
+ "hour",
1601
+ "day",
1602
+ "week",
1603
+ "month",
1604
+ "quarter",
1605
+ "semi_annual",
1606
+ "year",
1607
+ ],
1608
+ },
1609
+ },
1610
+ },
1611
+ "plans.variants.customize.items.rollover": {
1612
+ required: ["expiryDurationType"],
1613
+ fields: {
1614
+ expiryDurationType: {
1615
+ enum: ["month", "forever"],
1616
+ },
1617
+ },
1618
+ },
1619
+ "plans.variants.customize.items.thresholdBilling": {
1620
+ required: ["threshold"],
1621
+ fields: {
1622
+ threshold: {
1623
+ exclusiveMinimum: 0,
1624
+ },
1625
+ },
1626
+ },
1627
+ "plans.variants.customize.price": {
1628
+ required: ["amount", "interval"],
1629
+ fields: {
1630
+ interval: {
1631
+ enum: ["one_off", "week", "month", "quarter", "semi_annual", "year"],
1632
+ },
1633
+ },
1634
+ },
1635
+ "plans.variants.customize.price.additionalCurrencies": {
1636
+ required: ["amount", "currency"],
1637
+ },
1638
+ "plans.variants.customize.removeItems": {
1639
+ fields: {
1640
+ billingMethod: {
1641
+ enum: ["prepaid", "usage_based"],
1642
+ },
1643
+ interval: {
1644
+ enum: [
1645
+ "one_off",
1646
+ "week",
1647
+ "month",
1648
+ "quarter",
1649
+ "semi_annual",
1650
+ "year",
1651
+ "minute",
1652
+ "hour",
1653
+ "day",
1654
+ ],
1655
+ },
1656
+ intervalCount: {
1657
+ minimum: -9007199254740991,
1658
+ maximum: 9007199254740991,
1659
+ exclusiveMinimum: 0,
1660
+ },
1661
+ included: {
1662
+ maximum: 10000000000000,
1663
+ },
1664
+ },
1665
+ },
1666
+ "plans.variants.customize.removeLicenses": {
1667
+ required: ["licensePlanId"],
1668
+ },
1669
+ "plans.variants.customize.upsertLicenses": {
1670
+ required: ["licensePlanId"],
1671
+ fields: {
1672
+ included: {
1673
+ minimum: 0,
1674
+ maximum: 9007199254740991,
1675
+ },
1676
+ },
1677
+ },
1678
+ "plans.variants.customize.upsertLicenses.customize.addItems": {
1679
+ required: ["featureId"],
1680
+ fields: {
1681
+ included: {
1682
+ maximum: 10000000000000,
1683
+ },
1684
+ },
1685
+ },
1686
+ "plans.variants.customize.upsertLicenses.customize.addItems.featureOverride.creditSchema":
1687
+ {
1688
+ variants: {
1689
+ on: "tierBehavior",
1690
+ byValue: {
1691
+ graduated: {
1692
+ required: ["meteredFeatureId", "tierBehavior", "tiers"],
1693
+ fields: {
1694
+ meteredFeatureId: {
1695
+ minLength: 1,
1696
+ },
1697
+ billingUnits: {
1698
+ exclusiveMinimum: 0,
1699
+ },
1700
+ tierBehavior: {
1701
+ enum: ["graduated"],
1702
+ },
1703
+ tiers: {
1704
+ minItems: 1,
1705
+ },
1706
+ },
1707
+ },
1708
+ },
1709
+ fallback: {
1710
+ required: ["creditCost", "meteredFeatureId"],
1711
+ fields: {
1712
+ meteredFeatureId: {
1713
+ minLength: 1,
1714
+ },
1715
+ billingUnits: {
1716
+ exclusiveMinimum: 0,
1717
+ },
1718
+ creditCost: {
1719
+ minimum: 0,
1720
+ },
1721
+ },
1722
+ },
1723
+ },
1724
+ },
1725
+ "plans.variants.customize.upsertLicenses.customize.addItems.featureOverride.creditSchema.dimensions":
1726
+ {
1727
+ keys: {
1728
+ minLength: 1,
1729
+ maxLength: 64,
1730
+ },
1731
+ },
1732
+ "plans.variants.customize.upsertLicenses.customize.addItems.featureOverride.creditSchema.dimensions.*":
1733
+ {
1734
+ variants: {
1735
+ on: "tierBehavior",
1736
+ byValue: {
1737
+ graduated: {
1738
+ required: ["match", "tierBehavior", "tiers"],
1739
+ fields: {
1740
+ priority: {
1741
+ minimum: -9007199254740991,
1742
+ maximum: 9007199254740991,
1743
+ },
1744
+ tierBehavior: {
1745
+ enum: ["graduated"],
1746
+ },
1747
+ tiers: {
1748
+ minItems: 1,
1749
+ },
1750
+ },
1751
+ },
1752
+ },
1753
+ fallback: {
1754
+ required: ["creditCost", "match"],
1755
+ fields: {
1756
+ priority: {
1757
+ minimum: -9007199254740991,
1758
+ maximum: 9007199254740991,
1759
+ },
1760
+ creditCost: {
1761
+ minimum: 0,
1762
+ },
1763
+ },
1764
+ },
1765
+ },
1766
+ },
1767
+ "plans.variants.customize.upsertLicenses.customize.addItems.featureOverride.creditSchema.dimensions.*.tiers":
1768
+ {
1769
+ required: ["creditCost"],
1770
+ fields: {
1771
+ creditCost: {
1772
+ minimum: 0,
1773
+ },
1774
+ },
1775
+ },
1776
+ "plans.variants.customize.upsertLicenses.customize.addItems.featureOverride.creditSchema.multipliers":
1777
+ {
1778
+ keys: {
1779
+ minLength: 1,
1780
+ maxLength: 64,
1781
+ },
1782
+ },
1783
+ "plans.variants.customize.upsertLicenses.customize.addItems.featureOverride.creditSchema.multipliers.*":
1784
+ {
1785
+ required: ["match"],
1786
+ fields: {
1787
+ factor: {
1788
+ exclusiveMinimum: 0,
1789
+ },
1790
+ },
1791
+ },
1792
+ "plans.variants.customize.upsertLicenses.customize.addItems.featureOverride.creditSchema.tiers":
1793
+ {
1794
+ required: ["creditCost", "to"],
1795
+ fields: {
1796
+ to: {
1797
+ exclusiveMinimum: 0,
1798
+ },
1799
+ creditCost: {
1800
+ minimum: 0,
1801
+ },
1802
+ },
1803
+ },
1804
+ "plans.variants.customize.upsertLicenses.customize.addItems.featureOverride.markups":
1805
+ {
1806
+ fields: {
1807
+ defaultMarkup: {
1808
+ minimum: -100,
1809
+ },
1810
+ },
1811
+ },
1812
+ "plans.variants.customize.upsertLicenses.customize.addItems.featureOverride.markups.modelMarkups":
1813
+ {
1814
+ keys: {
1815
+ pattern: ".+\\/.+",
1816
+ },
1817
+ },
1818
+ "plans.variants.customize.upsertLicenses.customize.addItems.featureOverride.markups.modelMarkups.*":
1819
+ {
1820
+ fields: {
1821
+ markup: {
1822
+ minimum: -100,
1823
+ },
1824
+ inputCost: {
1825
+ minimum: 0,
1826
+ },
1827
+ outputCost: {
1828
+ minimum: 0,
1829
+ },
1830
+ },
1831
+ },
1832
+ "plans.variants.customize.upsertLicenses.customize.addItems.featureOverride.markups.providerMarkups.*":
1833
+ {
1834
+ required: ["markup"],
1835
+ fields: {
1836
+ markup: {
1837
+ minimum: -100,
1838
+ },
1839
+ },
1840
+ },
1841
+ "plans.variants.customize.upsertLicenses.customize.addItems.price": {
1842
+ required: ["billingMethod", "interval"],
1843
+ fields: {
1844
+ tierBehavior: {
1845
+ enum: ["graduated", "volume"],
1846
+ },
1847
+ interval: {
1848
+ enum: ["one_off", "week", "month", "quarter", "semi_annual", "year"],
1849
+ },
1850
+ billingMethod: {
1851
+ enum: ["prepaid", "usage_based"],
1852
+ },
1853
+ allocatedBilling: {
1854
+ enum: ["arrear", "prorated_legacy"],
1855
+ },
1856
+ },
1857
+ },
1858
+ "plans.variants.customize.upsertLicenses.customize.addItems.price.additionalCurrencies":
1859
+ {
1860
+ required: ["amount", "currency"],
1861
+ },
1862
+ "plans.variants.customize.upsertLicenses.customize.addItems.price.tiers": {
1863
+ required: ["to"],
1864
+ },
1865
+ "plans.variants.customize.upsertLicenses.customize.addItems.price.tiers.additionalCurrencies":
1866
+ {
1867
+ required: ["currency"],
1868
+ },
1869
+ "plans.variants.customize.upsertLicenses.customize.addItems.proration": {
1870
+ required: ["onDecrease", "onIncrease"],
1871
+ fields: {
1872
+ onIncrease: {
1873
+ enum: [
1874
+ "bill_immediately",
1875
+ "prorate_immediately",
1876
+ "prorate_next_cycle",
1877
+ "bill_next_cycle",
1878
+ ],
1879
+ },
1880
+ onDecrease: {
1881
+ enum: [
1882
+ "prorate",
1883
+ "prorate_immediately",
1884
+ "prorate_next_cycle",
1885
+ "none",
1886
+ "no_prorations",
1887
+ ],
1888
+ },
1889
+ },
1890
+ },
1891
+ "plans.variants.customize.upsertLicenses.customize.addItems.reset": {
1892
+ required: ["interval"],
1893
+ fields: {
1894
+ interval: {
1895
+ enum: [
1896
+ "one_off",
1897
+ "minute",
1898
+ "hour",
1899
+ "day",
1900
+ "week",
1901
+ "month",
1902
+ "quarter",
1903
+ "semi_annual",
1904
+ "year",
1905
+ ],
1906
+ },
1907
+ },
1908
+ },
1909
+ "plans.variants.customize.upsertLicenses.customize.addItems.rollover": {
1910
+ required: ["expiryDurationType"],
1911
+ fields: {
1912
+ expiryDurationType: {
1913
+ enum: ["month", "forever"],
1914
+ },
1915
+ },
1916
+ },
1917
+ "plans.variants.customize.upsertLicenses.customize.addItems.thresholdBilling":
1918
+ {
1919
+ required: ["threshold"],
1920
+ fields: {
1921
+ threshold: {
1922
+ exclusiveMinimum: 0,
1923
+ },
1924
+ },
1925
+ },
1926
+ "plans.variants.customize.upsertLicenses.customize.price": {
1927
+ required: ["amount", "interval"],
1928
+ fields: {
1929
+ interval: {
1930
+ enum: ["one_off", "week", "month", "quarter", "semi_annual", "year"],
1931
+ },
1932
+ },
1933
+ },
1934
+ "plans.variants.customize.upsertLicenses.customize.price.additionalCurrencies":
1935
+ {
1936
+ required: ["amount", "currency"],
1937
+ },
1938
+ "plans.variants.customize.upsertLicenses.customize.removeItems": {
1939
+ fields: {
1940
+ billingMethod: {
1941
+ enum: ["prepaid", "usage_based"],
1942
+ },
1943
+ interval: {
1944
+ enum: [
1945
+ "one_off",
1946
+ "week",
1947
+ "month",
1948
+ "quarter",
1949
+ "semi_annual",
1950
+ "year",
1951
+ "minute",
1952
+ "hour",
1953
+ "day",
1954
+ ],
1955
+ },
1956
+ intervalCount: {
1957
+ minimum: -9007199254740991,
1958
+ maximum: 9007199254740991,
1959
+ exclusiveMinimum: 0,
1960
+ },
1961
+ included: {
1962
+ maximum: 10000000000000,
1963
+ },
1964
+ },
1965
+ },
1966
+ "plans.variants.processors.revenuecat": {
1967
+ required: ["products"],
1968
+ },
1969
+ "plans.variants.processors.revenuecat.products": {
1970
+ required: ["productId"],
1971
+ },
1972
+ "plans.variants.processors.revenuecat.products.featureQuantities": {
1973
+ required: ["featureId"],
1974
+ fields: {
1975
+ quantity: {
1976
+ minimum: 0,
1977
+ },
1978
+ },
1979
+ },
1980
+ "plans.variants.processors.stripe": {
1981
+ required: ["productId"],
1982
+ },
1983
+ referralPrograms: {
1984
+ label: "referral program",
1985
+ idField: "id",
1986
+ required: ["id", "receivedBy", "redeemOn", "rewardId"],
1987
+ fields: {
1988
+ id: {
1989
+ minLength: 1,
1990
+ },
1991
+ rewardId: {
1992
+ minLength: 1,
1993
+ },
1994
+ redeemOn: {
1995
+ enum: ["customer_creation", "checkout"],
1996
+ },
1997
+ receivedBy: {
1998
+ enum: ["referrer", "all"],
1999
+ },
2000
+ maxRedemptions: {
2001
+ minimum: -9007199254740991,
2002
+ maximum: 9007199254740991,
2003
+ exclusiveMinimum: 0,
2004
+ },
2005
+ internalId: {
2006
+ minLength: 1,
2007
+ },
2008
+ },
2009
+ rules: [
2010
+ {
2011
+ kind: "unique",
2012
+ field: "id",
2013
+ because:
2014
+ "Two referral programs claiming one id race to define the same row.",
2015
+ },
2016
+ {
2017
+ kind: "unique",
2018
+ field: "internalId",
2019
+ because:
2020
+ "A stable id names exactly one row; two fixtures cannot both be it.",
2021
+ },
2022
+ {
2023
+ kind: "exists",
2024
+ field: "rewardId",
2025
+ in: "rewards",
2026
+ matching: ["coupon.id", "featureGrant.id"],
2027
+ because:
2028
+ "A referral program grants a reward this config does not declare.",
2029
+ },
2030
+ {
2031
+ kind: "exists",
2032
+ field: "planIds",
2033
+ in: "plans",
2034
+ matching: "planId",
2035
+ because:
2036
+ "A referral program triggers on checkout of a plan this config does not declare.",
2037
+ },
2038
+ ],
2039
+ },
2040
+ removeFeatures: {
2041
+ required: ["featureId"],
2042
+ },
2043
+ removePlans: {
2044
+ required: ["planId"],
2045
+ fields: {
2046
+ version: {
2047
+ minimum: 1,
2048
+ maximum: 9007199254740991,
2049
+ },
2050
+ },
2051
+ },
2052
+ rewards: {
2053
+ label: "reward",
2054
+ rules: [
2055
+ {
2056
+ kind: "unique",
2057
+ field: ["coupon.id", "featureGrant.id"],
2058
+ because: "Two rewards claiming one id race to define the same row.",
2059
+ },
2060
+ {
2061
+ kind: "unique",
2062
+ field: ["coupon.internalId", "featureGrant.internalId"],
2063
+ because:
2064
+ "A stable id names exactly one row; two fixtures cannot both be it.",
2065
+ },
2066
+ ],
2067
+ },
2068
+ "rewards.coupon": {
2069
+ label: "coupon",
2070
+ idField: "id",
2071
+ required: [
2072
+ "duration",
2073
+ "id",
2074
+ "name",
2075
+ "planIds",
2076
+ "promoCodes",
2077
+ "type",
2078
+ "value",
2079
+ ],
2080
+ fields: {
2081
+ id: {
2082
+ minLength: 1,
2083
+ },
2084
+ name: {
2085
+ minLength: 1,
2086
+ },
2087
+ planIds: {
2088
+ minItems: 1,
2089
+ },
2090
+ internalId: {
2091
+ minLength: 1,
2092
+ },
2093
+ type: {
2094
+ enum: ["percentage_discount", "fixed_discount"],
2095
+ },
2096
+ value: {
2097
+ exclusiveMinimum: 0,
2098
+ },
2099
+ },
2100
+ rules: [
2101
+ {
2102
+ kind: "exists",
2103
+ field: "planIds",
2104
+ in: "plans",
2105
+ matching: "planId",
2106
+ because: "A coupon discounts a plan this config does not declare.",
2107
+ },
2108
+ ],
2109
+ },
2110
+ "rewards.coupon.duration": {
2111
+ required: ["length", "type"],
2112
+ fields: {
2113
+ type: {
2114
+ enum: ["one_off", "months", "forever"],
2115
+ },
2116
+ length: {
2117
+ minimum: -9007199254740991,
2118
+ maximum: 9007199254740991,
2119
+ exclusiveMinimum: 0,
2120
+ },
2121
+ },
2122
+ },
2123
+ "rewards.coupon.promoCodes": {
2124
+ required: ["code"],
2125
+ fields: {
2126
+ code: {
2127
+ minLength: 1,
2128
+ },
2129
+ globalMaxRedemption: {
2130
+ minimum: -9007199254740991,
2131
+ maximum: 9007199254740991,
2132
+ exclusiveMinimum: 0,
2133
+ },
2134
+ },
2135
+ },
2136
+ "rewards.featureGrant": {
2137
+ label: "feature grant",
2138
+ idField: "id",
2139
+ required: ["grants", "id", "name", "promoCodes"],
2140
+ fields: {
2141
+ id: {
2142
+ minLength: 1,
2143
+ },
2144
+ name: {
2145
+ minLength: 1,
2146
+ },
2147
+ grants: {
2148
+ minItems: 1,
2149
+ },
2150
+ promoCodes: {
2151
+ minItems: 1,
2152
+ },
2153
+ internalId: {
2154
+ minLength: 1,
2155
+ },
2156
+ },
2157
+ },
2158
+ "rewards.featureGrant.grants": {
2159
+ label: "grant",
2160
+ idField: "featureId",
2161
+ required: ["expiry", "featureId", "included"],
2162
+ fields: {
2163
+ featureId: {
2164
+ minLength: 1,
2165
+ },
2166
+ included: {
2167
+ minimum: 0,
2168
+ },
2169
+ },
2170
+ rules: [
2171
+ {
2172
+ kind: "exists",
2173
+ field: "featureId",
2174
+ in: "features",
2175
+ matching: "featureId",
2176
+ because:
2177
+ "A feature grant awards a feature this config does not declare.",
2178
+ },
2179
+ ],
2180
+ },
2181
+ "rewards.featureGrant.grants.expiry": {
2182
+ required: ["length", "type"],
2183
+ fields: {
2184
+ type: {
2185
+ enum: ["day", "week", "month", "year"],
2186
+ },
2187
+ length: {
2188
+ minimum: -9007199254740991,
2189
+ maximum: 9007199254740991,
2190
+ exclusiveMinimum: 0,
2191
+ },
2192
+ },
2193
+ },
2194
+ "rewards.featureGrant.promoCodes": {
2195
+ required: ["code", "maxUses"],
2196
+ fields: {
2197
+ code: {
2198
+ minLength: 1,
2199
+ },
2200
+ maxUses: {
2201
+ minimum: -9007199254740991,
2202
+ maximum: 9007199254740991,
2203
+ exclusiveMinimum: 0,
2204
+ },
2205
+ },
2206
+ },
2207
+ };