atmn 1.0.2 → 1.0.4

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.
@@ -1,228 +0,0 @@
1
- import { z } from "zod/v4";
2
- export declare const UsageTierSchema: z.ZodObject<{
3
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
4
- amount: z.ZodNumber;
5
- }, z.core.$strip>;
6
- export declare const PlanFeatureSchema: z.ZodObject<{
7
- feature_id: z.ZodString;
8
- granted_balance: z.ZodOptional<z.ZodNumber>;
9
- unlimited: z.ZodOptional<z.ZodBoolean>;
10
- reset: z.ZodOptional<z.ZodObject<{
11
- interval: z.ZodUnion<readonly [z.ZodLiteral<"one_off">, z.ZodLiteral<"hour">, z.ZodLiteral<"day">, z.ZodLiteral<"week">, z.ZodLiteral<"month">, z.ZodLiteral<"quarter">, z.ZodLiteral<"year">]>;
12
- interval_count: z.ZodOptional<z.ZodNumber>;
13
- reset_when_enabled: z.ZodOptional<z.ZodBoolean>;
14
- }, z.core.$strip>>;
15
- price: z.ZodOptional<z.ZodObject<{
16
- amount: z.ZodOptional<z.ZodNumber>;
17
- tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
18
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
19
- amount: z.ZodNumber;
20
- }, z.core.$strip>>>;
21
- interval: z.ZodUnion<readonly [z.ZodLiteral<"month">, z.ZodLiteral<"quarter">, z.ZodLiteral<"semi_annual">, z.ZodLiteral<"year">]>;
22
- interval_count: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
23
- billing_units: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
24
- usage_model: z.ZodUnion<readonly [z.ZodLiteral<"prepaid">, z.ZodLiteral<"pay_per_use">]>;
25
- max_purchase: z.ZodOptional<z.ZodNumber>;
26
- }, z.core.$strip>>;
27
- proration: z.ZodOptional<z.ZodObject<{
28
- on_increase: z.ZodUnion<readonly [z.ZodLiteral<"prorate">, z.ZodLiteral<"charge_immediately">]>;
29
- on_decrease: z.ZodUnion<readonly [z.ZodLiteral<"prorate">, z.ZodLiteral<"refund_immediately">, z.ZodLiteral<"no_action">]>;
30
- }, z.core.$strip>>;
31
- rollover: z.ZodOptional<z.ZodObject<{
32
- max: z.ZodNumber;
33
- expiry_duration_type: z.ZodUnion<readonly [z.ZodLiteral<"month">, z.ZodLiteral<"forever">]>;
34
- expiry_duration_length: z.ZodOptional<z.ZodNumber>;
35
- }, z.core.$strip>>;
36
- }, z.core.$strip>;
37
- export declare const FreeTrialSchema: z.ZodObject<{
38
- duration_type: z.ZodUnion<readonly [z.ZodLiteral<"day">, z.ZodLiteral<"month">, z.ZodLiteral<"year">]>;
39
- duration_length: z.ZodNumber;
40
- card_required: z.ZodBoolean;
41
- }, z.core.$strip>;
42
- export declare const PlanSchema: z.ZodObject<{
43
- description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
44
- add_on: z.ZodDefault<z.ZodBoolean>;
45
- default: z.ZodDefault<z.ZodBoolean>;
46
- price: z.ZodOptional<z.ZodObject<{
47
- amount: z.ZodNumber;
48
- interval: z.ZodUnion<readonly [z.ZodLiteral<"month">, z.ZodLiteral<"quarter">, z.ZodLiteral<"semi_annual">, z.ZodLiteral<"year">]>;
49
- }, z.core.$strip>>;
50
- features: z.ZodOptional<z.ZodArray<z.ZodObject<{
51
- feature_id: z.ZodString;
52
- granted_balance: z.ZodOptional<z.ZodNumber>;
53
- unlimited: z.ZodOptional<z.ZodBoolean>;
54
- reset: z.ZodOptional<z.ZodObject<{
55
- interval: z.ZodUnion<readonly [z.ZodLiteral<"one_off">, z.ZodLiteral<"hour">, z.ZodLiteral<"day">, z.ZodLiteral<"week">, z.ZodLiteral<"month">, z.ZodLiteral<"quarter">, z.ZodLiteral<"year">]>;
56
- interval_count: z.ZodOptional<z.ZodNumber>;
57
- reset_when_enabled: z.ZodOptional<z.ZodBoolean>;
58
- }, z.core.$strip>>;
59
- price: z.ZodOptional<z.ZodObject<{
60
- amount: z.ZodOptional<z.ZodNumber>;
61
- tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
62
- to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
63
- amount: z.ZodNumber;
64
- }, z.core.$strip>>>;
65
- interval: z.ZodUnion<readonly [z.ZodLiteral<"month">, z.ZodLiteral<"quarter">, z.ZodLiteral<"semi_annual">, z.ZodLiteral<"year">]>;
66
- interval_count: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
67
- billing_units: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
68
- usage_model: z.ZodUnion<readonly [z.ZodLiteral<"prepaid">, z.ZodLiteral<"pay_per_use">]>;
69
- max_purchase: z.ZodOptional<z.ZodNumber>;
70
- }, z.core.$strip>>;
71
- proration: z.ZodOptional<z.ZodObject<{
72
- on_increase: z.ZodUnion<readonly [z.ZodLiteral<"prorate">, z.ZodLiteral<"charge_immediately">]>;
73
- on_decrease: z.ZodUnion<readonly [z.ZodLiteral<"prorate">, z.ZodLiteral<"refund_immediately">, z.ZodLiteral<"no_action">]>;
74
- }, z.core.$strip>>;
75
- rollover: z.ZodOptional<z.ZodObject<{
76
- max: z.ZodNumber;
77
- expiry_duration_type: z.ZodUnion<readonly [z.ZodLiteral<"month">, z.ZodLiteral<"forever">]>;
78
- expiry_duration_length: z.ZodOptional<z.ZodNumber>;
79
- }, z.core.$strip>>;
80
- }, z.core.$strip>>>;
81
- free_trial: z.ZodOptional<z.ZodNullable<z.ZodObject<{
82
- duration_type: z.ZodUnion<readonly [z.ZodLiteral<"day">, z.ZodLiteral<"month">, z.ZodLiteral<"year">]>;
83
- duration_length: z.ZodNumber;
84
- card_required: z.ZodBoolean;
85
- }, z.core.$strip>>>;
86
- id: z.ZodString;
87
- name: z.ZodString;
88
- group: z.ZodDefault<z.ZodString>;
89
- }, z.core.$strip>;
90
- export type ResetInterval = "one_off" | "hour" | "day" | "week" | "month" | "quarter" | "year";
91
- export type RolloverExpiryDurationType = "month" | "forever";
92
- export type BillingInterval = "month" | "quarter" | "semi_annual" | "year";
93
- export type BillingMethod = "prepaid" | "usage_based";
94
- export type OnIncrease = "prorate" | "charge_immediately";
95
- export type OnDecrease = "prorate" | "refund_immediately" | "no_action";
96
- type ResetConfig = {
97
- /** How often usage resets (e.g., 'month', 'day') */
98
- interval: ResetInterval;
99
- /** Number of intervals between resets (default: 1) */
100
- interval_count?: number;
101
- };
102
- type ProrationConfig = {
103
- /** Behavior when quantity increases */
104
- on_increase: OnIncrease;
105
- /** Behavior when quantity decreases */
106
- on_decrease: OnDecrease;
107
- };
108
- type RolloverConfig = {
109
- /** Maximum amount that can roll over (null for unlimited) */
110
- max: number | null;
111
- /** How long rollover lasts before expiring */
112
- expiry_duration_type: RolloverExpiryDurationType;
113
- /** Duration length for rollover expiry */
114
- expiry_duration_length?: number;
115
- };
116
- type PlanFeatureBaseFields = {
117
- /** Reference to the feature being configured */
118
- feature_id: string;
119
- /** Amount of usage included in this plan */
120
- included?: number;
121
- /** Whether usage is unlimited */
122
- unlimited?: boolean;
123
- /** Proration rules for quantity changes */
124
- proration?: ProrationConfig;
125
- /** Rollover policy for unused usage */
126
- rollover?: RolloverConfig;
127
- };
128
- type PriceWithoutInterval = {
129
- /** Flat price per unit */
130
- amount?: number;
131
- /** Tiered pricing structure based on usage ranges */
132
- tiers?: Array<{
133
- to: number | "inf";
134
- amount: number;
135
- }>;
136
- /** Number of units per billing cycle */
137
- billing_units?: number;
138
- /** Billing method: 'prepaid' or 'usage_based' */
139
- billing_method: BillingMethod;
140
- /** Maximum purchasable quantity */
141
- max_purchase?: number;
142
- /** Cannot have price.interval when using top-level reset */
143
- interval?: never;
144
- interval_count?: never;
145
- };
146
- type PriceWithInterval = {
147
- /** Flat price per unit */
148
- amount?: number;
149
- /** Tiered pricing structure based on usage ranges */
150
- tiers?: Array<{
151
- to: number | "inf";
152
- amount: number;
153
- }>;
154
- /** Number of units per billing cycle */
155
- billing_units?: number;
156
- /** Billing method: 'prepaid' or 'usage_based' */
157
- billing_method: BillingMethod;
158
- /** Maximum purchasable quantity */
159
- max_purchase?: number;
160
- /** Billing interval (e.g., 'month', 'day') */
161
- interval: ResetInterval;
162
- /** Number of intervals between billing cycles (default: 1) */
163
- interval_count?: number;
164
- };
165
- /**
166
- * Plan feature with top-level reset configuration.
167
- * Use this for free allocations or features that reset but aren't priced per-use.
168
- */
169
- export type PlanFeatureWithReset = PlanFeatureBaseFields & {
170
- /** Reset configuration for usage limits */
171
- reset: ResetConfig;
172
- /** Optional pricing (cannot have price.interval when using top-level reset) */
173
- price?: PriceWithoutInterval;
174
- };
175
- /**
176
- * Plan feature with pricing that includes interval configuration.
177
- * Use this for usage-based pricing where interval determines billing cycle.
178
- */
179
- export type PlanFeatureWithPriceInterval = PlanFeatureBaseFields & {
180
- /** Cannot have top-level reset when using price.interval */
181
- reset?: never;
182
- /** Pricing configuration with billing interval */
183
- price: PriceWithInterval;
184
- };
185
- /**
186
- * Plan feature without any reset configuration.
187
- * Use this for continuous-use features (like seats) that don't reset.
188
- */
189
- export type PlanFeatureNoReset = PlanFeatureBaseFields & {
190
- /** No reset for continuous-use features */
191
- reset?: never;
192
- /** Optional pricing without interval */
193
- price?: PriceWithoutInterval;
194
- };
195
- /**
196
- * Plan feature configuration with mutually exclusive reset patterns:
197
- * - PlanFeatureWithReset: Top-level reset (for free allocations)
198
- * - PlanFeatureWithPriceInterval: price.interval (for usage-based pricing billing cycle)
199
- * - PlanFeatureNoReset: No reset (for continuous-use features like seats)
200
- */
201
- export type PlanFeature = PlanFeatureWithReset | PlanFeatureWithPriceInterval | PlanFeatureNoReset;
202
- export type FreeTrial = z.infer<typeof FreeTrialSchema>;
203
- export type Plan = {
204
- /** Unique identifier for the plan */
205
- id: string;
206
- /** Display name for the plan */
207
- name: string;
208
- /** Optional description explaining what this plan offers */
209
- description?: string | null;
210
- /** Grouping identifier for organizing related plans */
211
- group?: string;
212
- /** Whether this plan can be purchased alongside other plans */
213
- add_on?: boolean;
214
- /** Whether to automatically enable this plan for new customers */
215
- auto_enable?: boolean;
216
- /** Base price for the plan */
217
- price?: {
218
- /** Price in your currency (e.g., 50 for $50.00) */
219
- amount: number;
220
- /** Billing frequency */
221
- interval: BillingInterval | ResetInterval;
222
- };
223
- /** Features included with usage limits and pricing */
224
- features?: PlanFeature[];
225
- /** Free trial period before billing begins */
226
- free_trial?: FreeTrial | null;
227
- };
228
- export {};
@@ -1 +0,0 @@
1
- export * from './compose/index.js';
@@ -1,52 +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
- var __toESM = (mod, isNodeMode, target) => {
8
- target = mod != null ? __create(__getProtoOf(mod)) : {};
9
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
- for (let key of __getOwnPropNames(mod))
11
- if (!__hasOwnProp.call(to, key))
12
- __defProp(to, key, {
13
- get: () => mod[key],
14
- enumerable: true
15
- });
16
- return to;
17
- };
18
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
- var __export = (target, all) => {
20
- for (var name in all)
21
- __defProp(target, name, {
22
- get: all[name],
23
- enumerable: true,
24
- configurable: true,
25
- set: (newValue) => all[name] = () => newValue
26
- });
27
- };
28
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
29
- var __promiseAll = (args) => Promise.all(args);
30
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
31
-
32
- // source/compose/builders/builderFunctions.ts
33
- var plan = (params) => {
34
- return {
35
- ...params,
36
- description: params.description ?? null,
37
- add_on: params.add_on ?? false,
38
- auto_enable: params.auto_enable ?? false,
39
- group: params.group ?? ""
40
- };
41
- };
42
- var feature = (params) => {
43
- return params;
44
- };
45
- var planFeature = (params) => {
46
- return params;
47
- };
48
- export {
49
- planFeature,
50
- plan,
51
- feature
52
- };