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
@@ -1,122 +0,0 @@
1
- import { createRequire } from "node:module";
2
- var __create = Object.create;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- function __accessProp(key) {
8
- return this[key];
9
- }
10
- var __toESMCache_node;
11
- var __toESMCache_esm;
12
- var __toESM = (mod, isNodeMode, target) => {
13
- var canCache = mod != null && typeof mod === "object";
14
- if (canCache) {
15
- var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
- var cached = cache.get(mod);
17
- if (cached)
18
- return cached;
19
- }
20
- target = mod != null ? __create(__getProtoOf(mod)) : {};
21
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
- for (let key of __getOwnPropNames(mod))
23
- if (!__hasOwnProp.call(to, key))
24
- __defProp(to, key, {
25
- get: __accessProp.bind(mod, key),
26
- enumerable: true
27
- });
28
- if (canCache)
29
- cache.set(mod, to);
30
- return to;
31
- };
32
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
- var __returnValue = (v) => v;
34
- function __exportSetter(name, newValue) {
35
- this[name] = __returnValue.bind(null, newValue);
36
- }
37
- var __export = (target, all) => {
38
- for (var name in all)
39
- __defProp(target, name, {
40
- get: all[name],
41
- enumerable: true,
42
- configurable: true,
43
- set: __exportSetter.bind(all, name)
44
- });
45
- };
46
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
47
- var __promiseAll = (args) => Promise.all(args);
48
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
49
-
50
- // src/compose/builders/builderFunctions.ts
51
- var plan = (params) => {
52
- return {
53
- ...params,
54
- description: params.description ?? null,
55
- addOn: params.addOn ?? false,
56
- autoEnable: params.autoEnable ?? false,
57
- group: params.group ?? ""
58
- };
59
- };
60
- var feature = (params) => {
61
- return params;
62
- };
63
- var item = (params) => {
64
- return params;
65
- };
66
- var billingControls = (params) => {
67
- return params;
68
- };
69
-
70
- // src/compose/builders/rewardFunctions.ts
71
- var tagged = (value, type) => {
72
- Object.defineProperty(value, "__atmnType", {
73
- value: type,
74
- enumerable: false
75
- });
76
- return value;
77
- };
78
- var reward = (params) => tagged(params, "reward");
79
- var referralProgram = (params) => tagged(params, "referral_program");
80
-
81
- // src/compose/builders/variantFunctions.ts
82
- var createVariant = (params) => {
83
- return params;
84
- };
85
-
86
- // src/compose/index.ts
87
- var plan2 = (params) => {
88
- const base = plan(params);
89
- Object.defineProperty(base, "__atmnType", {
90
- value: "plan",
91
- enumerable: false
92
- });
93
- Object.defineProperty(base, "variant", {
94
- value: (variantParams) => {
95
- const planVariant = createVariant(variantParams);
96
- Object.defineProperty(planVariant, "__atmnType", {
97
- value: "variant",
98
- enumerable: false
99
- });
100
- base.variants = [...base.variants ?? [], planVariant];
101
- return planVariant;
102
- },
103
- enumerable: false
104
- });
105
- return base;
106
- };
107
- var feature2 = (params) => {
108
- const value = feature(params);
109
- Object.defineProperty(value, "__atmnType", {
110
- value: "feature",
111
- enumerable: false
112
- });
113
- return value;
114
- };
115
- export {
116
- reward,
117
- referralProgram,
118
- plan2 as plan,
119
- item,
120
- feature2 as feature,
121
- billingControls
122
- };
@@ -1,84 +0,0 @@
1
- import type { Feature } from "../models/featureModels.js";
2
- import type { BillingControls, Plan, PlanItem } from "../models/planModels.js";
3
- type PlanInput = Omit<Plan, "description" | "addOn" | "autoEnable" | "group"> & Partial<Pick<Plan, "description" | "addOn" | "autoEnable" | "group">>;
4
- /**
5
- * Define a pricing plan in your Autumn configuration
6
- *
7
- * @param p - Plan configuration
8
- * @returns Plan object for use in autumn.config.ts
9
- *
10
- * @example
11
- * export const pro = plan({
12
- * id: 'pro',
13
- * name: 'Pro Plan',
14
- * description: 'For growing teams',
15
- * items: [
16
- * item({ featureId: seats.id, included: 10 }),
17
- * item({
18
- * featureId: messages.id,
19
- * included: 1000,
20
- * reset: { interval: 'month' }
21
- * })
22
- * ],
23
- * price: { amount: 50, interval: 'month' }
24
- * });
25
- */
26
- export declare const plan: (params: PlanInput) => Plan;
27
- /**
28
- * Define a feature that can be included in plans
29
- *
30
- * @param f - Feature configuration
31
- * @returns Feature object for use in autumn.config.ts
32
- *
33
- * @example
34
- * // Metered consumable feature (like API calls, tokens)
35
- * export const apiCalls = feature({
36
- * id: 'api_calls',
37
- * name: 'API Calls',
38
- * type: 'metered',
39
- * consumable: true
40
- * });
41
- *
42
- * @example
43
- * // Metered non-consumable feature (like seats)
44
- * export const seats = feature({
45
- * id: 'seats',
46
- * name: 'Team Seats',
47
- * type: 'metered',
48
- * consumable: false
49
- * });
50
- */
51
- export declare const feature: (params: Feature) => Feature;
52
- /**
53
- * Include a feature in a plan with specific configuration
54
- *
55
- * @param config - Feature configuration for this plan
56
- * @returns PlanItem for use in plan's items array
57
- *
58
- * @example
59
- * // Simple included usage
60
- * item({
61
- * featureId: messages.id,
62
- * included: 1000,
63
- * reset: { interval: 'month' }
64
- * })
65
- *
66
- * @example
67
- * // Priced feature with tiers
68
- * item({
69
- * featureId: seats.id,
70
- * included: 5,
71
- * reset: { interval: 'month' },
72
- * price: {
73
- * tiers: [
74
- * { to: 10, amount: 10 },
75
- * { to: 'inf', amount: 8 }
76
- * ],
77
- * billingMethod: 'usage_based',
78
- * billingUnits: 1
79
- * }
80
- * })
81
- */
82
- export declare const item: (params: PlanItem) => PlanItem;
83
- export declare const billingControls: (params: BillingControls) => BillingControls;
84
- export {};
@@ -1,5 +0,0 @@
1
- import type { ReferralProgram, Reward } from "../models/rewardModels.js";
2
- type ConfigInput<T> = T extends unknown ? Omit<T, "__atmnType"> : never;
3
- export declare const reward: (params: ConfigInput<Reward>) => Reward;
4
- export declare const referralProgram: (params: ConfigInput<ReferralProgram>) => ReferralProgram;
5
- export {};
@@ -1,2 +0,0 @@
1
- import type { Variant } from "../models/variantModels.js";
2
- export declare const createVariant: (params: Omit<Variant, "__atmnType">) => Variant;
@@ -1,19 +0,0 @@
1
- import { billingControls, item } from "./builders/builderFunctions.js";
2
- import { referralProgram, reward } from "./builders/rewardFunctions.js";
3
- import type { Feature } from "./models/featureModels.js";
4
- import type { BillingControls, FreeTrial, PlanItem, PlanLicense } from "./models/planModels.js";
5
- import type { ReferralProgram, Reward } from "./models/rewardModels.js";
6
- import type { CustomizePlan, Plan, PlanItemFilter, Variant } from "./models/variantModels.js";
7
- export { billingControls, plan, feature, item, referralProgram, reward };
8
- export type { BillingControls, CustomizePlan, Feature, FreeTrial, Plan, PlanItem, PlanItemFilter, PlanLicense, Variant, ReferralProgram, Reward, };
9
- type PlanInput = Omit<Plan, "description" | "addOn" | "autoEnable" | "group" | "variant"> & Partial<Pick<Plan, "description" | "addOn" | "autoEnable" | "group">>;
10
- type PlanWithVariantMethod = Plan & {
11
- variant: NonNullable<Plan["variant"]>;
12
- };
13
- declare const plan: (params: PlanInput) => PlanWithVariantMethod;
14
- declare const feature: (params: Feature) => Feature;
15
- export type Infinity = "infinity";
16
- export type AutumnConfig = {
17
- plans: Plan[];
18
- features: Feature[];
19
- };
@@ -1,262 +0,0 @@
1
- import { z } from "zod/v4";
2
- export declare const CreditTierSchema: z.ZodObject<{
3
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
4
- creditCost: z.ZodNumber;
5
- }, z.core.$strip>;
6
- export declare const CreditDimensionSchema: z.ZodUnion<readonly [z.ZodObject<{
7
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
8
- priority: z.ZodOptional<z.ZodNumber>;
9
- creditCost: z.ZodNumber;
10
- tierBehavior: z.ZodOptional<z.ZodNever>;
11
- tiers: z.ZodOptional<z.ZodNever>;
12
- }, z.core.$strip>, z.ZodObject<{
13
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
14
- priority: z.ZodOptional<z.ZodNumber>;
15
- creditCost: z.ZodOptional<z.ZodNever>;
16
- tierBehavior: z.ZodLiteral<"graduated">;
17
- tiers: z.ZodArray<z.ZodObject<{
18
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
19
- creditCost: z.ZodNumber;
20
- }, z.core.$strip>>;
21
- }, z.core.$strip>]>;
22
- export declare const CreditMultiplierSchema: z.ZodObject<{
23
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
24
- factor: z.ZodOptional<z.ZodNumber>;
25
- add: z.ZodOptional<z.ZodNumber>;
26
- }, z.core.$strip>;
27
- export declare const FlatCreditSchemaItemSchema: z.ZodObject<{
28
- meteredFeatureId: z.ZodString;
29
- billingUnits: z.ZodOptional<z.ZodNumber>;
30
- dimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
31
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
32
- priority: z.ZodOptional<z.ZodNumber>;
33
- creditCost: z.ZodNumber;
34
- tierBehavior: z.ZodOptional<z.ZodNever>;
35
- tiers: z.ZodOptional<z.ZodNever>;
36
- }, z.core.$strip>, z.ZodObject<{
37
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
38
- priority: z.ZodOptional<z.ZodNumber>;
39
- creditCost: z.ZodOptional<z.ZodNever>;
40
- tierBehavior: z.ZodLiteral<"graduated">;
41
- tiers: z.ZodArray<z.ZodObject<{
42
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
43
- creditCost: z.ZodNumber;
44
- }, z.core.$strip>>;
45
- }, z.core.$strip>]>>>;
46
- multipliers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
47
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
48
- factor: z.ZodOptional<z.ZodNumber>;
49
- add: z.ZodOptional<z.ZodNumber>;
50
- }, z.core.$strip>>>;
51
- creditCost: z.ZodNumber;
52
- tierBehavior: z.ZodOptional<z.ZodNever>;
53
- tiers: z.ZodOptional<z.ZodNever>;
54
- }, z.core.$strip>;
55
- export declare const GraduatedCreditSchemaItemSchema: z.ZodObject<{
56
- meteredFeatureId: z.ZodString;
57
- billingUnits: z.ZodOptional<z.ZodNumber>;
58
- dimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
59
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
60
- priority: z.ZodOptional<z.ZodNumber>;
61
- creditCost: z.ZodNumber;
62
- tierBehavior: z.ZodOptional<z.ZodNever>;
63
- tiers: z.ZodOptional<z.ZodNever>;
64
- }, z.core.$strip>, z.ZodObject<{
65
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
66
- priority: z.ZodOptional<z.ZodNumber>;
67
- creditCost: z.ZodOptional<z.ZodNever>;
68
- tierBehavior: z.ZodLiteral<"graduated">;
69
- tiers: z.ZodArray<z.ZodObject<{
70
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
71
- creditCost: z.ZodNumber;
72
- }, z.core.$strip>>;
73
- }, z.core.$strip>]>>>;
74
- multipliers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
75
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
76
- factor: z.ZodOptional<z.ZodNumber>;
77
- add: z.ZodOptional<z.ZodNumber>;
78
- }, z.core.$strip>>>;
79
- creditCost: z.ZodOptional<z.ZodNever>;
80
- tierBehavior: z.ZodLiteral<"graduated">;
81
- tiers: z.ZodArray<z.ZodObject<{
82
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
83
- creditCost: z.ZodNumber;
84
- }, z.core.$strip>>;
85
- }, z.core.$strip>;
86
- export declare const CreditSchemaItemSchema: z.ZodUnion<readonly [z.ZodObject<{
87
- meteredFeatureId: z.ZodString;
88
- billingUnits: z.ZodOptional<z.ZodNumber>;
89
- dimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
90
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
91
- priority: z.ZodOptional<z.ZodNumber>;
92
- creditCost: z.ZodNumber;
93
- tierBehavior: z.ZodOptional<z.ZodNever>;
94
- tiers: z.ZodOptional<z.ZodNever>;
95
- }, z.core.$strip>, z.ZodObject<{
96
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
97
- priority: z.ZodOptional<z.ZodNumber>;
98
- creditCost: z.ZodOptional<z.ZodNever>;
99
- tierBehavior: z.ZodLiteral<"graduated">;
100
- tiers: z.ZodArray<z.ZodObject<{
101
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
102
- creditCost: z.ZodNumber;
103
- }, z.core.$strip>>;
104
- }, z.core.$strip>]>>>;
105
- multipliers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
106
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
107
- factor: z.ZodOptional<z.ZodNumber>;
108
- add: z.ZodOptional<z.ZodNumber>;
109
- }, z.core.$strip>>>;
110
- creditCost: z.ZodNumber;
111
- tierBehavior: z.ZodOptional<z.ZodNever>;
112
- tiers: z.ZodOptional<z.ZodNever>;
113
- }, z.core.$strip>, z.ZodObject<{
114
- meteredFeatureId: z.ZodString;
115
- billingUnits: z.ZodOptional<z.ZodNumber>;
116
- dimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
117
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
118
- priority: z.ZodOptional<z.ZodNumber>;
119
- creditCost: z.ZodNumber;
120
- tierBehavior: z.ZodOptional<z.ZodNever>;
121
- tiers: z.ZodOptional<z.ZodNever>;
122
- }, z.core.$strip>, z.ZodObject<{
123
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
124
- priority: z.ZodOptional<z.ZodNumber>;
125
- creditCost: z.ZodOptional<z.ZodNever>;
126
- tierBehavior: z.ZodLiteral<"graduated">;
127
- tiers: z.ZodArray<z.ZodObject<{
128
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
129
- creditCost: z.ZodNumber;
130
- }, z.core.$strip>>;
131
- }, z.core.$strip>]>>>;
132
- multipliers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
133
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
134
- factor: z.ZodOptional<z.ZodNumber>;
135
- add: z.ZodOptional<z.ZodNumber>;
136
- }, z.core.$strip>>>;
137
- creditCost: z.ZodOptional<z.ZodNever>;
138
- tierBehavior: z.ZodLiteral<"graduated">;
139
- tiers: z.ZodArray<z.ZodObject<{
140
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
141
- creditCost: z.ZodNumber;
142
- }, z.core.$strip>>;
143
- }, z.core.$strip>]>;
144
- export type CreditSchemaItem = z.infer<typeof CreditSchemaItemSchema>;
145
- export type CreditDimension = z.infer<typeof CreditDimensionSchema>;
146
- export type CreditMultiplier = z.infer<typeof CreditMultiplierSchema>;
147
- export declare const FeatureSchema: z.ZodObject<{
148
- id: z.ZodString;
149
- name: z.ZodString;
150
- eventNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
151
- creditSchema: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
152
- meteredFeatureId: z.ZodString;
153
- billingUnits: z.ZodOptional<z.ZodNumber>;
154
- dimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
155
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
156
- priority: z.ZodOptional<z.ZodNumber>;
157
- creditCost: z.ZodNumber;
158
- tierBehavior: z.ZodOptional<z.ZodNever>;
159
- tiers: z.ZodOptional<z.ZodNever>;
160
- }, z.core.$strip>, z.ZodObject<{
161
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
162
- priority: z.ZodOptional<z.ZodNumber>;
163
- creditCost: z.ZodOptional<z.ZodNever>;
164
- tierBehavior: z.ZodLiteral<"graduated">;
165
- tiers: z.ZodArray<z.ZodObject<{
166
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
167
- creditCost: z.ZodNumber;
168
- }, z.core.$strip>>;
169
- }, z.core.$strip>]>>>;
170
- multipliers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
171
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
172
- factor: z.ZodOptional<z.ZodNumber>;
173
- add: z.ZodOptional<z.ZodNumber>;
174
- }, z.core.$strip>>>;
175
- creditCost: z.ZodNumber;
176
- tierBehavior: z.ZodOptional<z.ZodNever>;
177
- tiers: z.ZodOptional<z.ZodNever>;
178
- }, z.core.$strip>, z.ZodObject<{
179
- meteredFeatureId: z.ZodString;
180
- billingUnits: z.ZodOptional<z.ZodNumber>;
181
- dimensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
182
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
183
- priority: z.ZodOptional<z.ZodNumber>;
184
- creditCost: z.ZodNumber;
185
- tierBehavior: z.ZodOptional<z.ZodNever>;
186
- tiers: z.ZodOptional<z.ZodNever>;
187
- }, z.core.$strip>, z.ZodObject<{
188
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
189
- priority: z.ZodOptional<z.ZodNumber>;
190
- creditCost: z.ZodOptional<z.ZodNever>;
191
- tierBehavior: z.ZodLiteral<"graduated">;
192
- tiers: z.ZodArray<z.ZodObject<{
193
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
194
- creditCost: z.ZodNumber;
195
- }, z.core.$strip>>;
196
- }, z.core.$strip>]>>>;
197
- multipliers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
198
- match: z.ZodRecord<z.ZodString, z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodString>>;
199
- factor: z.ZodOptional<z.ZodNumber>;
200
- add: z.ZodOptional<z.ZodNumber>;
201
- }, z.core.$strip>>>;
202
- creditCost: z.ZodOptional<z.ZodNever>;
203
- tierBehavior: z.ZodLiteral<"graduated">;
204
- tiers: z.ZodArray<z.ZodObject<{
205
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
206
- creditCost: z.ZodNumber;
207
- }, z.core.$strip>>;
208
- }, z.core.$strip>]>>>;
209
- archived: z.ZodBoolean;
210
- }, z.core.$strip>;
211
- type FeatureBase = {
212
- /** Unique identifier for the feature */
213
- id: string;
214
- /** Display name for the feature */
215
- name: string;
216
- /** Whether the feature is archived */
217
- archived?: boolean;
218
- /** Event names that trigger this feature */
219
- eventNames?: string[];
220
- /** Credit schema for credit_system features */
221
- creditSchema?: CreditSchemaItem[];
222
- };
223
- /** Boolean feature - no consumable field allowed */
224
- export type BooleanFeature = FeatureBase & {
225
- type: "boolean";
226
- consumable?: never;
227
- };
228
- /** Metered feature - requires consumable field */
229
- export type MeteredFeature = FeatureBase & {
230
- type: "metered";
231
- /** Whether usage is consumed (true) or accumulated (false) */
232
- consumable: boolean;
233
- };
234
- /** Credit system feature - always consumable */
235
- export type CreditSystemFeature = FeatureBase & {
236
- type: "credit_system";
237
- /** Credit systems are always consumable */
238
- consumable?: true;
239
- /** Required: defines how credits map to metered features */
240
- creditSchema: CreditSchemaItem[];
241
- };
242
- export type ModelMarkupEntry = {
243
- /** Per-model markup override. Omit to inherit provider/global markup. */
244
- markup?: number;
245
- inputCost?: number;
246
- outputCost?: number;
247
- };
248
- export type ProviderMarkupEntry = {
249
- markup: number;
250
- };
251
- /** AI credit system feature - uses model-based pricing */
252
- export type AiCreditSystemFeature = FeatureBase & {
253
- type: "ai_credit_system";
254
- /** Per-model markup overrides (highest priority). */
255
- modelMarkups?: Record<string, ModelMarkupEntry>;
256
- /** Default markup applied when no model or provider markup matches. */
257
- defaultMarkup?: number;
258
- /** Per-provider default markups, keyed by the first segment of the model id. */
259
- providerMarkups?: Record<string, ProviderMarkupEntry>;
260
- };
261
- export type Feature = BooleanFeature | MeteredFeature | CreditSystemFeature | AiCreditSystemFeature;
262
- export {};
@@ -1,3 +0,0 @@
1
- export * from "./planModels.js";
2
- export * from "./featureModels.js";
3
- export * from "./rewardModels.js";