atmn 0.0.21 → 0.0.23

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.
package/dist/index.d.ts CHANGED
@@ -1 +1,184 @@
1
- export * from './compose/index.js';
1
+ import { z } from 'zod/v4';
2
+
3
+ declare const ProductSchema: z.ZodObject<{
4
+ id: z.ZodString;
5
+ name: z.ZodString;
6
+ is_add_on: z.ZodOptional<z.ZodPrefault<z.ZodBoolean>>;
7
+ is_default: z.ZodOptional<z.ZodPrefault<z.ZodBoolean>>;
8
+ items: z.ZodArray<z.ZodObject<{
9
+ type: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
10
+ feature: "feature";
11
+ priced_feature: "priced_feature";
12
+ }>>>;
13
+ feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
+ included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>>>;
15
+ interval: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
16
+ minute: "minute";
17
+ hour: "hour";
18
+ day: "day";
19
+ week: "week";
20
+ month: "month";
21
+ quarter: "quarter";
22
+ semi_annual: "semi_annual";
23
+ year: "year";
24
+ }>>>;
25
+ usage_model: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
26
+ prepaid: "prepaid";
27
+ pay_per_use: "pay_per_use";
28
+ }>>>;
29
+ price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
30
+ tiers: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
31
+ amount: z.ZodNumber;
32
+ to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
33
+ }, z.core.$strip>>>>;
34
+ billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
35
+ reset_usage_when_enabled: z.ZodOptional<z.ZodBoolean>;
36
+ entity_feature_id: z.ZodOptional<z.ZodString>;
37
+ }, z.core.$strip>>;
38
+ free_trial: z.ZodOptional<z.ZodObject<{
39
+ duration: z.ZodEnum<{
40
+ day: "day";
41
+ month: "month";
42
+ year: "year";
43
+ }>;
44
+ length: z.ZodNumber;
45
+ unique_fingerprint: z.ZodBoolean;
46
+ card_required: z.ZodBoolean;
47
+ }, z.core.$strip>>;
48
+ }, z.core.$strip>;
49
+ declare const FeatureSchema: z.ZodObject<{
50
+ id: z.ZodString;
51
+ name: z.ZodOptional<z.ZodString>;
52
+ type: z.ZodEnum<{
53
+ boolean: "boolean";
54
+ single_use: "single_use";
55
+ continuous_use: "continuous_use";
56
+ credit_system: "credit_system";
57
+ }>;
58
+ credit_schema: z.ZodOptional<z.ZodArray<z.ZodObject<{
59
+ metered_feature_id: z.ZodString;
60
+ credit_cost: z.ZodNumber;
61
+ }, z.core.$strip>>>;
62
+ archived: z.ZodOptional<z.ZodBoolean>;
63
+ }, z.core.$strip>;
64
+ type Feature = z.infer<typeof FeatureSchema>;
65
+ type Product = z.infer<typeof ProductSchema>;
66
+
67
+ declare const ProductItemIntervalEnum: z.ZodEnum<{
68
+ minute: "minute";
69
+ hour: "hour";
70
+ day: "day";
71
+ week: "week";
72
+ month: "month";
73
+ quarter: "quarter";
74
+ semi_annual: "semi_annual";
75
+ year: "year";
76
+ }>;
77
+ declare const UsageModelEnum: z.ZodEnum<{
78
+ prepaid: "prepaid";
79
+ pay_per_use: "pay_per_use";
80
+ }>;
81
+ type ProductItemInterval = z.infer<typeof ProductItemIntervalEnum>;
82
+ type UsageModel = z.infer<typeof UsageModelEnum>;
83
+ declare const ProductItemSchema: z.ZodObject<{
84
+ type: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
85
+ feature: "feature";
86
+ priced_feature: "priced_feature";
87
+ }>>>;
88
+ feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
+ included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>>>;
90
+ interval: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
91
+ minute: "minute";
92
+ hour: "hour";
93
+ day: "day";
94
+ week: "week";
95
+ month: "month";
96
+ quarter: "quarter";
97
+ semi_annual: "semi_annual";
98
+ year: "year";
99
+ }>>>;
100
+ usage_model: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
101
+ prepaid: "prepaid";
102
+ pay_per_use: "pay_per_use";
103
+ }>>>;
104
+ price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
105
+ tiers: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
106
+ amount: z.ZodNumber;
107
+ to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
108
+ }, z.core.$strip>>>>;
109
+ billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
110
+ reset_usage_when_enabled: z.ZodOptional<z.ZodBoolean>;
111
+ entity_feature_id: z.ZodOptional<z.ZodString>;
112
+ }, z.core.$strip>;
113
+ type ProductItem = z.infer<typeof ProductItemSchema>;
114
+
115
+ declare const product: (p: Product) => {
116
+ id: string;
117
+ name: string;
118
+ items: {
119
+ type?: "feature" | "priced_feature" | null | undefined;
120
+ feature_id?: string | null | undefined;
121
+ included_usage?: number | "inf" | null | undefined;
122
+ interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
123
+ usage_model?: "prepaid" | "pay_per_use" | null | undefined;
124
+ price?: number | null | undefined;
125
+ tiers?: {
126
+ amount: number;
127
+ to: number | "inf";
128
+ }[] | null | undefined;
129
+ billing_units?: number | null | undefined;
130
+ reset_usage_when_enabled?: boolean | undefined;
131
+ entity_feature_id?: string | undefined;
132
+ }[];
133
+ is_add_on?: boolean | undefined;
134
+ is_default?: boolean | undefined;
135
+ free_trial?: {
136
+ duration: "day" | "month" | "year";
137
+ length: number;
138
+ unique_fingerprint: boolean;
139
+ card_required: boolean;
140
+ } | undefined;
141
+ };
142
+ declare const feature: (f: Feature) => {
143
+ id: string;
144
+ type: "boolean" | "single_use" | "continuous_use" | "credit_system";
145
+ name?: string | undefined;
146
+ credit_schema?: {
147
+ metered_feature_id: string;
148
+ credit_cost: number;
149
+ }[] | undefined;
150
+ archived?: boolean | undefined;
151
+ };
152
+ declare const featureItem: ({ feature_id, included_usage, interval, reset_usage_when_enabled, entity_feature_id, }: {
153
+ feature_id: string;
154
+ included_usage?: number | "inf";
155
+ interval?: ProductItemInterval;
156
+ reset_usage_when_enabled?: boolean;
157
+ entity_feature_id?: string;
158
+ }) => ProductItem;
159
+ declare const pricedFeatureItem: ({ feature_id, price, tiers, interval, included_usage, billing_units, usage_model, reset_usage_when_enabled, entity_feature_id, }: {
160
+ feature_id: string;
161
+ price?: number;
162
+ tiers?: {
163
+ to: number | "inf";
164
+ amount: number;
165
+ }[];
166
+ interval?: ProductItemInterval;
167
+ included_usage?: number;
168
+ billing_units?: number;
169
+ usage_model?: UsageModel;
170
+ reset_usage_when_enabled?: boolean;
171
+ entity_feature_id?: string;
172
+ }) => ProductItem;
173
+ declare const priceItem: ({ price, interval, }: {
174
+ price: number;
175
+ interval?: ProductItemInterval;
176
+ }) => ProductItem;
177
+
178
+ type Infinity = "infinity";
179
+ type AutumnConfig = {
180
+ products: Product[];
181
+ features: Feature[];
182
+ };
183
+
184
+ export { type AutumnConfig, type Feature, type Infinity, type Product, type ProductItem, feature, featureItem, priceItem, pricedFeatureItem, product };
package/dist/index.js CHANGED
@@ -1,32 +1,3 @@
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 __require = /* @__PURE__ */ createRequire(import.meta.url);
29
-
30
1
  // source/compose/builders/builderFunctions.ts
31
2
  var product = (p) => p;
32
3
  var feature = (f) => f;
@@ -50,7 +21,7 @@ var pricedFeatureItem = ({
50
21
  price,
51
22
  tiers,
52
23
  interval,
53
- included_usage = undefined,
24
+ included_usage = void 0,
54
25
  billing_units = 1,
55
26
  usage_model = "pay_per_use",
56
27
  reset_usage_when_enabled,
@@ -77,10 +48,5 @@ var priceItem = ({
77
48
  interval
78
49
  };
79
50
  };
80
- export {
81
- product,
82
- pricedFeatureItem,
83
- priceItem,
84
- featureItem,
85
- feature
86
- };
51
+
52
+ export { feature, featureItem, priceItem, pricedFeatureItem, product };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atmn",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "license": "MIT",
5
5
  "bin": "dist/cli.js",
6
6
  "main": "dist/index.js",
@@ -10,8 +10,8 @@
10
10
  "node": ">=16"
11
11
  },
12
12
  "scripts": {
13
- "build": "bun bun.config.ts",
14
- "dev": "bun build ./source/cli.ts ./source/index.ts --outdir ./dist --format esm --target node --define:VERSION='\"dev\"' --watch --external prettier",
13
+ "build": "tsup",
14
+ "dev": "tsup --watch",
15
15
  "test2": "prettier --check . && xo && ava",
16
16
  "test": "node --trace-deprecation -- ./dist/cli.js"
17
17
  },