atmn 0.0.4 → 0.0.6
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/cli.cjs +603 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +581 -51
- package/dist/index.cjs +48 -0
- package/dist/index.d.cts +175 -0
- package/dist/index.d.ts +175 -0
- package/dist/index.js +42 -0
- package/package.json +8 -6
- package/dist/app.d.ts +0 -6
- package/dist/app.js +0 -7
- package/dist/commands/auth.d.ts +0 -1
- package/dist/commands/auth.js +0 -63
- package/dist/commands/init.d.ts +0 -3
- package/dist/commands/init.js +0 -26
- package/dist/commands/pull.d.ts +0 -3
- package/dist/commands/pull.js +0 -28
- package/dist/commands/push.d.ts +0 -5
- package/dist/commands/push.js +0 -47
- package/dist/constants.d.ts +0 -3
- package/dist/constants.js +0 -55
- package/dist/core/api.d.ts +0 -27
- package/dist/core/api.js +0 -75
- package/dist/core/auth.d.ts +0 -1
- package/dist/core/auth.js +0 -8
- package/dist/core/builders/features.d.ts +0 -2
- package/dist/core/builders/features.js +0 -10
- package/dist/core/builders/products.d.ts +0 -7
- package/dist/core/builders/products.js +0 -71
- package/dist/core/config.d.ts +0 -2
- package/dist/core/config.js +0 -25
- package/dist/core/pull.d.ts +0 -17
- package/dist/core/pull.js +0 -22
- package/dist/core/push.d.ts +0 -7
- package/dist/core/push.js +0 -67
- package/dist/core/utils.d.ts +0 -3
- package/dist/core/utils.js +0 -26
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const ProductSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
is_add_on: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
7
|
+
is_default: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
8
|
+
items: z.ZodArray<z.ZodObject<{
|
|
9
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>;
|
|
10
|
+
feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>;
|
|
12
|
+
interval: z.ZodOptional<z.ZodNullable<z.ZodEnum<["minute", "hour", "day", "week", "month", "quarter", "semi_annual", "year"]>>>;
|
|
13
|
+
usage_model: z.ZodOptional<z.ZodNullable<z.ZodEnum<["prepaid", "pay_per_use"]>>>;
|
|
14
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
15
|
+
billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
18
|
+
feature_id?: string | null | undefined;
|
|
19
|
+
included_usage?: number | "inf" | null | undefined;
|
|
20
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
21
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
22
|
+
price?: number | null | undefined;
|
|
23
|
+
billing_units?: number | null | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
26
|
+
feature_id?: string | null | undefined;
|
|
27
|
+
included_usage?: number | "inf" | null | undefined;
|
|
28
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
29
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
30
|
+
price?: number | null | undefined;
|
|
31
|
+
billing_units?: number | null | undefined;
|
|
32
|
+
}>, "many">;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
items: {
|
|
37
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
38
|
+
feature_id?: string | null | undefined;
|
|
39
|
+
included_usage?: number | "inf" | null | undefined;
|
|
40
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
41
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
42
|
+
price?: number | null | undefined;
|
|
43
|
+
billing_units?: number | null | undefined;
|
|
44
|
+
}[];
|
|
45
|
+
is_add_on?: boolean | undefined;
|
|
46
|
+
is_default?: boolean | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
items: {
|
|
51
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
52
|
+
feature_id?: string | null | undefined;
|
|
53
|
+
included_usage?: number | "inf" | null | undefined;
|
|
54
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
55
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
56
|
+
price?: number | null | undefined;
|
|
57
|
+
billing_units?: number | null | undefined;
|
|
58
|
+
}[];
|
|
59
|
+
is_add_on?: boolean | undefined;
|
|
60
|
+
is_default?: boolean | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
declare const FeatureSchema: z.ZodObject<{
|
|
63
|
+
id: z.ZodString;
|
|
64
|
+
name: z.ZodString;
|
|
65
|
+
type: z.ZodEnum<["boolean", "single_use", "continuous_use", "credit_system"]>;
|
|
66
|
+
credit_schema: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
67
|
+
metered_feature_id: z.ZodString;
|
|
68
|
+
credit_cost: z.ZodNumber;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
metered_feature_id: string;
|
|
71
|
+
credit_cost: number;
|
|
72
|
+
}, {
|
|
73
|
+
metered_feature_id: string;
|
|
74
|
+
credit_cost: number;
|
|
75
|
+
}>, "many">>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
type: "boolean" | "single_use" | "continuous_use" | "credit_system";
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
credit_schema?: {
|
|
81
|
+
metered_feature_id: string;
|
|
82
|
+
credit_cost: number;
|
|
83
|
+
}[] | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
type: "boolean" | "single_use" | "continuous_use" | "credit_system";
|
|
86
|
+
id: string;
|
|
87
|
+
name: string;
|
|
88
|
+
credit_schema?: {
|
|
89
|
+
metered_feature_id: string;
|
|
90
|
+
credit_cost: number;
|
|
91
|
+
}[] | undefined;
|
|
92
|
+
}>;
|
|
93
|
+
type Feature = z.infer<typeof FeatureSchema>;
|
|
94
|
+
type Product = z.infer<typeof ProductSchema>;
|
|
95
|
+
|
|
96
|
+
declare const ProductItemIntervalEnum: z.ZodEnum<["minute", "hour", "day", "week", "month", "quarter", "semi_annual", "year"]>;
|
|
97
|
+
declare const UsageModelEnum: z.ZodEnum<["prepaid", "pay_per_use"]>;
|
|
98
|
+
type ProductItemInterval = z.infer<typeof ProductItemIntervalEnum>;
|
|
99
|
+
type UsageModel = z.infer<typeof UsageModelEnum>;
|
|
100
|
+
declare const ProductItemSchema: z.ZodObject<{
|
|
101
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>;
|
|
102
|
+
feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
+
included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>;
|
|
104
|
+
interval: z.ZodOptional<z.ZodNullable<z.ZodEnum<["minute", "hour", "day", "week", "month", "quarter", "semi_annual", "year"]>>>;
|
|
105
|
+
usage_model: z.ZodOptional<z.ZodNullable<z.ZodEnum<["prepaid", "pay_per_use"]>>>;
|
|
106
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
107
|
+
billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
110
|
+
feature_id?: string | null | undefined;
|
|
111
|
+
included_usage?: number | "inf" | null | undefined;
|
|
112
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
113
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
114
|
+
price?: number | null | undefined;
|
|
115
|
+
billing_units?: number | null | undefined;
|
|
116
|
+
}, {
|
|
117
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
118
|
+
feature_id?: string | null | undefined;
|
|
119
|
+
included_usage?: number | "inf" | null | undefined;
|
|
120
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
121
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
122
|
+
price?: number | null | undefined;
|
|
123
|
+
billing_units?: number | null | undefined;
|
|
124
|
+
}>;
|
|
125
|
+
type ProductItem = z.infer<typeof ProductItemSchema>;
|
|
126
|
+
|
|
127
|
+
declare const product: (p: Product) => {
|
|
128
|
+
id: string;
|
|
129
|
+
name: string;
|
|
130
|
+
items: {
|
|
131
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
132
|
+
feature_id?: string | null | undefined;
|
|
133
|
+
included_usage?: number | "inf" | null | undefined;
|
|
134
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
135
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
136
|
+
price?: number | null | undefined;
|
|
137
|
+
billing_units?: number | null | undefined;
|
|
138
|
+
}[];
|
|
139
|
+
is_add_on?: boolean | undefined;
|
|
140
|
+
is_default?: boolean | undefined;
|
|
141
|
+
};
|
|
142
|
+
declare const feature: (f: Feature) => {
|
|
143
|
+
type: "boolean" | "single_use" | "continuous_use" | "credit_system";
|
|
144
|
+
id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
credit_schema?: {
|
|
147
|
+
metered_feature_id: string;
|
|
148
|
+
credit_cost: number;
|
|
149
|
+
}[] | undefined;
|
|
150
|
+
};
|
|
151
|
+
declare const featureItem: ({ feature_id, included_usage, interval, }: {
|
|
152
|
+
feature_id: string;
|
|
153
|
+
included_usage?: number;
|
|
154
|
+
interval?: ProductItemInterval;
|
|
155
|
+
}) => ProductItem;
|
|
156
|
+
declare const priceItem: ({ price, interval, }: {
|
|
157
|
+
price: number;
|
|
158
|
+
interval?: ProductItemInterval;
|
|
159
|
+
}) => ProductItem;
|
|
160
|
+
declare const pricedFeatureItem: ({ feature_id, price, interval, included_usage, billing_units, usage_model, }: {
|
|
161
|
+
feature_id: string;
|
|
162
|
+
price: number;
|
|
163
|
+
interval?: ProductItemInterval;
|
|
164
|
+
included_usage?: number;
|
|
165
|
+
billing_units?: number;
|
|
166
|
+
usage_model?: UsageModel;
|
|
167
|
+
}) => ProductItem;
|
|
168
|
+
|
|
169
|
+
type Infinity = 'infinity';
|
|
170
|
+
type AutumnConfig = {
|
|
171
|
+
products: Product[];
|
|
172
|
+
features: Feature[];
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export { type AutumnConfig, type Feature, type Infinity, type Product, type ProductItem, feature, featureItem, priceItem, pricedFeatureItem, product };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const ProductSchema: z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
is_add_on: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
7
|
+
is_default: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
8
|
+
items: z.ZodArray<z.ZodObject<{
|
|
9
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>;
|
|
10
|
+
feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>;
|
|
12
|
+
interval: z.ZodOptional<z.ZodNullable<z.ZodEnum<["minute", "hour", "day", "week", "month", "quarter", "semi_annual", "year"]>>>;
|
|
13
|
+
usage_model: z.ZodOptional<z.ZodNullable<z.ZodEnum<["prepaid", "pay_per_use"]>>>;
|
|
14
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
15
|
+
billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
18
|
+
feature_id?: string | null | undefined;
|
|
19
|
+
included_usage?: number | "inf" | null | undefined;
|
|
20
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
21
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
22
|
+
price?: number | null | undefined;
|
|
23
|
+
billing_units?: number | null | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
26
|
+
feature_id?: string | null | undefined;
|
|
27
|
+
included_usage?: number | "inf" | null | undefined;
|
|
28
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
29
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
30
|
+
price?: number | null | undefined;
|
|
31
|
+
billing_units?: number | null | undefined;
|
|
32
|
+
}>, "many">;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
items: {
|
|
37
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
38
|
+
feature_id?: string | null | undefined;
|
|
39
|
+
included_usage?: number | "inf" | null | undefined;
|
|
40
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
41
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
42
|
+
price?: number | null | undefined;
|
|
43
|
+
billing_units?: number | null | undefined;
|
|
44
|
+
}[];
|
|
45
|
+
is_add_on?: boolean | undefined;
|
|
46
|
+
is_default?: boolean | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
items: {
|
|
51
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
52
|
+
feature_id?: string | null | undefined;
|
|
53
|
+
included_usage?: number | "inf" | null | undefined;
|
|
54
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
55
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
56
|
+
price?: number | null | undefined;
|
|
57
|
+
billing_units?: number | null | undefined;
|
|
58
|
+
}[];
|
|
59
|
+
is_add_on?: boolean | undefined;
|
|
60
|
+
is_default?: boolean | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
declare const FeatureSchema: z.ZodObject<{
|
|
63
|
+
id: z.ZodString;
|
|
64
|
+
name: z.ZodString;
|
|
65
|
+
type: z.ZodEnum<["boolean", "single_use", "continuous_use", "credit_system"]>;
|
|
66
|
+
credit_schema: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
67
|
+
metered_feature_id: z.ZodString;
|
|
68
|
+
credit_cost: z.ZodNumber;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
metered_feature_id: string;
|
|
71
|
+
credit_cost: number;
|
|
72
|
+
}, {
|
|
73
|
+
metered_feature_id: string;
|
|
74
|
+
credit_cost: number;
|
|
75
|
+
}>, "many">>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
type: "boolean" | "single_use" | "continuous_use" | "credit_system";
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
credit_schema?: {
|
|
81
|
+
metered_feature_id: string;
|
|
82
|
+
credit_cost: number;
|
|
83
|
+
}[] | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
type: "boolean" | "single_use" | "continuous_use" | "credit_system";
|
|
86
|
+
id: string;
|
|
87
|
+
name: string;
|
|
88
|
+
credit_schema?: {
|
|
89
|
+
metered_feature_id: string;
|
|
90
|
+
credit_cost: number;
|
|
91
|
+
}[] | undefined;
|
|
92
|
+
}>;
|
|
93
|
+
type Feature = z.infer<typeof FeatureSchema>;
|
|
94
|
+
type Product = z.infer<typeof ProductSchema>;
|
|
95
|
+
|
|
96
|
+
declare const ProductItemIntervalEnum: z.ZodEnum<["minute", "hour", "day", "week", "month", "quarter", "semi_annual", "year"]>;
|
|
97
|
+
declare const UsageModelEnum: z.ZodEnum<["prepaid", "pay_per_use"]>;
|
|
98
|
+
type ProductItemInterval = z.infer<typeof ProductItemIntervalEnum>;
|
|
99
|
+
type UsageModel = z.infer<typeof UsageModelEnum>;
|
|
100
|
+
declare const ProductItemSchema: z.ZodObject<{
|
|
101
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>;
|
|
102
|
+
feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
+
included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>;
|
|
104
|
+
interval: z.ZodOptional<z.ZodNullable<z.ZodEnum<["minute", "hour", "day", "week", "month", "quarter", "semi_annual", "year"]>>>;
|
|
105
|
+
usage_model: z.ZodOptional<z.ZodNullable<z.ZodEnum<["prepaid", "pay_per_use"]>>>;
|
|
106
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
107
|
+
billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
110
|
+
feature_id?: string | null | undefined;
|
|
111
|
+
included_usage?: number | "inf" | null | undefined;
|
|
112
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
113
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
114
|
+
price?: number | null | undefined;
|
|
115
|
+
billing_units?: number | null | undefined;
|
|
116
|
+
}, {
|
|
117
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
118
|
+
feature_id?: string | null | undefined;
|
|
119
|
+
included_usage?: number | "inf" | null | undefined;
|
|
120
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
121
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
122
|
+
price?: number | null | undefined;
|
|
123
|
+
billing_units?: number | null | undefined;
|
|
124
|
+
}>;
|
|
125
|
+
type ProductItem = z.infer<typeof ProductItemSchema>;
|
|
126
|
+
|
|
127
|
+
declare const product: (p: Product) => {
|
|
128
|
+
id: string;
|
|
129
|
+
name: string;
|
|
130
|
+
items: {
|
|
131
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
132
|
+
feature_id?: string | null | undefined;
|
|
133
|
+
included_usage?: number | "inf" | null | undefined;
|
|
134
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
135
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
136
|
+
price?: number | null | undefined;
|
|
137
|
+
billing_units?: number | null | undefined;
|
|
138
|
+
}[];
|
|
139
|
+
is_add_on?: boolean | undefined;
|
|
140
|
+
is_default?: boolean | undefined;
|
|
141
|
+
};
|
|
142
|
+
declare const feature: (f: Feature) => {
|
|
143
|
+
type: "boolean" | "single_use" | "continuous_use" | "credit_system";
|
|
144
|
+
id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
credit_schema?: {
|
|
147
|
+
metered_feature_id: string;
|
|
148
|
+
credit_cost: number;
|
|
149
|
+
}[] | undefined;
|
|
150
|
+
};
|
|
151
|
+
declare const featureItem: ({ feature_id, included_usage, interval, }: {
|
|
152
|
+
feature_id: string;
|
|
153
|
+
included_usage?: number;
|
|
154
|
+
interval?: ProductItemInterval;
|
|
155
|
+
}) => ProductItem;
|
|
156
|
+
declare const priceItem: ({ price, interval, }: {
|
|
157
|
+
price: number;
|
|
158
|
+
interval?: ProductItemInterval;
|
|
159
|
+
}) => ProductItem;
|
|
160
|
+
declare const pricedFeatureItem: ({ feature_id, price, interval, included_usage, billing_units, usage_model, }: {
|
|
161
|
+
feature_id: string;
|
|
162
|
+
price: number;
|
|
163
|
+
interval?: ProductItemInterval;
|
|
164
|
+
included_usage?: number;
|
|
165
|
+
billing_units?: number;
|
|
166
|
+
usage_model?: UsageModel;
|
|
167
|
+
}) => ProductItem;
|
|
168
|
+
|
|
169
|
+
type Infinity = 'infinity';
|
|
170
|
+
type AutumnConfig = {
|
|
171
|
+
products: Product[];
|
|
172
|
+
features: Feature[];
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export { type AutumnConfig, type Feature, type Infinity, type Product, type ProductItem, feature, featureItem, priceItem, pricedFeatureItem, product };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// source/compose/builders/builderFunctions.ts
|
|
2
|
+
var product = (p) => p;
|
|
3
|
+
var feature = (f) => f;
|
|
4
|
+
var featureItem = ({
|
|
5
|
+
feature_id,
|
|
6
|
+
included_usage,
|
|
7
|
+
interval
|
|
8
|
+
}) => {
|
|
9
|
+
return {
|
|
10
|
+
included_usage,
|
|
11
|
+
feature_id,
|
|
12
|
+
interval
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
var priceItem = ({
|
|
16
|
+
price,
|
|
17
|
+
interval
|
|
18
|
+
}) => {
|
|
19
|
+
return {
|
|
20
|
+
price,
|
|
21
|
+
interval
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
var pricedFeatureItem = ({
|
|
25
|
+
feature_id,
|
|
26
|
+
price,
|
|
27
|
+
interval,
|
|
28
|
+
included_usage = void 0,
|
|
29
|
+
billing_units = 1,
|
|
30
|
+
usage_model = "pay_per_use"
|
|
31
|
+
}) => {
|
|
32
|
+
return {
|
|
33
|
+
price,
|
|
34
|
+
interval,
|
|
35
|
+
billing_units,
|
|
36
|
+
feature_id,
|
|
37
|
+
usage_model,
|
|
38
|
+
included_usage
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { feature, featureItem, priceItem, pricedFeatureItem, product };
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atmn",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": "dist/cli.js",
|
|
6
|
-
"main": "dist/
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
7
8
|
"type": "module",
|
|
8
9
|
"engines": {
|
|
9
10
|
"node": ">=16"
|
|
10
11
|
},
|
|
11
12
|
"scripts": {
|
|
12
|
-
"build": "
|
|
13
|
-
"dev": "
|
|
13
|
+
"build": "tsup",
|
|
14
|
+
"dev": "tsup --watch",
|
|
14
15
|
"test2": "prettier --check . && xo && ava",
|
|
15
16
|
"test": "node ./dist/cli.js"
|
|
16
17
|
},
|
|
@@ -21,7 +22,6 @@
|
|
|
21
22
|
],
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"@inquirer/prompts": "^7.6.0",
|
|
24
|
-
"autumn-js": "^0.0.102",
|
|
25
25
|
"axios": "^1.10.0",
|
|
26
26
|
"commander": "^14.0.0",
|
|
27
27
|
"dotenv": "^17.2.0",
|
|
@@ -42,8 +42,10 @@
|
|
|
42
42
|
"ink-testing-library": "^3.0.0",
|
|
43
43
|
"prettier": "^2.8.7",
|
|
44
44
|
"ts-node": "^10.9.1",
|
|
45
|
+
"tsup": "^8.4.0",
|
|
45
46
|
"typescript": "^5.0.3",
|
|
46
|
-
"xo": "^0.53.1"
|
|
47
|
+
"xo": "^0.53.1",
|
|
48
|
+
"zod": "^3.24.1"
|
|
47
49
|
},
|
|
48
50
|
"ava": {
|
|
49
51
|
"extensions": {
|
package/dist/app.d.ts
DELETED
package/dist/app.js
DELETED
package/dist/commands/auth.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function AuthCommand(): Promise<void>;
|
package/dist/commands/auth.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import open from 'open';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { input, password, confirm } from '@inquirer/prompts';
|
|
4
|
-
import { storeToEnv, readFromEnv } from '../core/utils.js';
|
|
5
|
-
import { getOTP } from '../core/auth.js';
|
|
6
|
-
import { updateCLIStripeKeys } from '../core/api.js';
|
|
7
|
-
import { FRONTEND_URL } from '../constants.js';
|
|
8
|
-
const passwordTheme = {
|
|
9
|
-
style: {
|
|
10
|
-
answer: (text) => {
|
|
11
|
-
return chalk.magenta('*'.repeat(text.length));
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
const inputTheme = {
|
|
16
|
-
style: {
|
|
17
|
-
answer: (text) => {
|
|
18
|
-
return chalk.magenta(text);
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
export default async function AuthCommand() {
|
|
23
|
-
if (readFromEnv()) {
|
|
24
|
-
let shouldReauth = await confirm({
|
|
25
|
-
message: 'You are already authenticated. Would you like to re-authenticate?',
|
|
26
|
-
theme: inputTheme,
|
|
27
|
-
});
|
|
28
|
-
if (!shouldReauth) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
open(`${FRONTEND_URL}/dev/cli`);
|
|
33
|
-
const otp = await input({
|
|
34
|
-
message: 'Enter OTP:',
|
|
35
|
-
theme: inputTheme,
|
|
36
|
-
});
|
|
37
|
-
const keyInfo = await getOTP(otp);
|
|
38
|
-
if (!keyInfo.stripe_connected) {
|
|
39
|
-
let connectStripe = await confirm({
|
|
40
|
-
message: "It seems like your organization doesn't have any Stripe keys connected. Would you like to connect them now?",
|
|
41
|
-
theme: inputTheme,
|
|
42
|
-
});
|
|
43
|
-
if (connectStripe) {
|
|
44
|
-
// Ask for stripe Keys
|
|
45
|
-
let stripeTestKey = await password({
|
|
46
|
-
message: 'Enter Stripe Test Secret Key:',
|
|
47
|
-
mask: '*',
|
|
48
|
-
theme: passwordTheme,
|
|
49
|
-
});
|
|
50
|
-
// let stripeLiveKey = await password({
|
|
51
|
-
// message: 'Enter Stripe Live Key:',
|
|
52
|
-
// mask: '*',
|
|
53
|
-
// theme: passwordTheme,
|
|
54
|
-
// })
|
|
55
|
-
await updateCLIStripeKeys(stripeTestKey, stripeTestKey, keyInfo.stripeFlowAuthKey);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
console.log(chalk.yellow("Okay, no worries. Go to the Autumn dashboard when you're ready!"));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
storeToEnv(keyInfo.prodKey, keyInfo.sandboxKey);
|
|
62
|
-
console.log(chalk.green('Success! Keys have been stored locally. You may now use the CLI.'));
|
|
63
|
-
}
|
package/dist/commands/init.d.ts
DELETED
package/dist/commands/init.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import Pull from './pull.js';
|
|
3
|
-
import AuthCommand from './auth.js';
|
|
4
|
-
import { readFromEnv } from '../core/utils.js';
|
|
5
|
-
export default async function Init({ config }) {
|
|
6
|
-
// Try to read API key from .env first
|
|
7
|
-
let apiKey = readFromEnv();
|
|
8
|
-
if (apiKey) {
|
|
9
|
-
console.log(chalk.green('API key found. Pulling latest config...'));
|
|
10
|
-
await Pull({ config });
|
|
11
|
-
console.log(chalk.green('Project initialized and config pulled successfully!'));
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
// If not found, run authentication
|
|
15
|
-
console.log(chalk.yellow('No API key found. Running authentication...'));
|
|
16
|
-
await AuthCommand();
|
|
17
|
-
// After authentication, try to read the key again
|
|
18
|
-
apiKey = readFromEnv();
|
|
19
|
-
if (apiKey) {
|
|
20
|
-
await Pull({ config });
|
|
21
|
-
console.log(chalk.green('Project initialized! You are now authenticated and config has been pulled.'));
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
console.log(chalk.red('Authentication did not yield an API key. Please check your setup.'));
|
|
25
|
-
}
|
|
26
|
-
}
|
package/dist/commands/pull.d.ts
DELETED
package/dist/commands/pull.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import { getAllProducts, getFeatures, } from '../core/pull.js';
|
|
3
|
-
import { productBuilder } from '../core/builders/products.js';
|
|
4
|
-
import { featureBuilder } from '../core/builders/features.js';
|
|
5
|
-
import { writeConfig } from '../core/config.js';
|
|
6
|
-
import { importBuilder, exportBuilder } from '../core/builders/products.js';
|
|
7
|
-
import { snakeCaseToCamelCase } from '../core/utils.js';
|
|
8
|
-
export default async function Pull({ config }) {
|
|
9
|
-
console.log(chalk.green('Pulling products and features from Autumn...'));
|
|
10
|
-
const products = await getAllProducts();
|
|
11
|
-
const features = await getFeatures();
|
|
12
|
-
const productSnippets = products.map(product => productBuilder(product));
|
|
13
|
-
const featureSnippets = features.map(feature => featureBuilder(feature));
|
|
14
|
-
const autumnConfig = `
|
|
15
|
-
${importBuilder()}
|
|
16
|
-
|
|
17
|
-
// Features
|
|
18
|
-
${featureSnippets.join('\n')}
|
|
19
|
-
|
|
20
|
-
// Products
|
|
21
|
-
${productSnippets.join('\n')}
|
|
22
|
-
|
|
23
|
-
// Remember to update this when you make changes!
|
|
24
|
-
${exportBuilder(products.map(product => product.id), features.map(feature => snakeCaseToCamelCase(feature.id)))}
|
|
25
|
-
`;
|
|
26
|
-
writeConfig(autumnConfig);
|
|
27
|
-
console.log(chalk.green('Success! Config has been updated.'));
|
|
28
|
-
}
|
package/dist/commands/push.d.ts
DELETED
package/dist/commands/push.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { confirm } from '@inquirer/prompts';
|
|
3
|
-
import { upsertProduct, checkForDeletables, upsertFeature, } from '../core/push.js';
|
|
4
|
-
import { deleteFeature, deleteProduct } from '../core/api.js';
|
|
5
|
-
import { FRONTEND_URL } from '../constants.js';
|
|
6
|
-
export default async function Push({ config, yes, prod, }) {
|
|
7
|
-
let { features, products } = config;
|
|
8
|
-
let { featuresToDelete, productsToDelete } = await checkForDeletables(features, products);
|
|
9
|
-
for (let productId of productsToDelete) {
|
|
10
|
-
let shouldDelete = yes ||
|
|
11
|
-
(await confirm({
|
|
12
|
-
message: `Delete product [${productId}]?`,
|
|
13
|
-
}));
|
|
14
|
-
if (shouldDelete) {
|
|
15
|
-
await deleteProduct(productId);
|
|
16
|
-
console.log(chalk.green(`Product [${productId}] deleted successfully!`));
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
for (let feature of features) {
|
|
20
|
-
console.log(chalk.green(`Pushing feature [${feature.id}]`));
|
|
21
|
-
await upsertFeature(feature);
|
|
22
|
-
console.log(chalk.green(`Pushed feature [${feature.id}]`));
|
|
23
|
-
}
|
|
24
|
-
for (let product of products) {
|
|
25
|
-
console.log(chalk.green(`Pushing product [${product.id}]`));
|
|
26
|
-
await upsertProduct(product);
|
|
27
|
-
console.log(chalk.green(`Pushed product [${product.id}]`));
|
|
28
|
-
}
|
|
29
|
-
for (let featureId of featuresToDelete) {
|
|
30
|
-
let shouldDelete = yes ||
|
|
31
|
-
(await confirm({
|
|
32
|
-
message: `Delete feature [${featureId}]?`,
|
|
33
|
-
}));
|
|
34
|
-
if (shouldDelete) {
|
|
35
|
-
await deleteFeature(featureId);
|
|
36
|
-
console.log(chalk.green(`Feature [${featureId}] deleted successfully!`));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const env = prod ? 'prod' : 'sandbox';
|
|
40
|
-
console.log(chalk.magentaBright(`Success! Changes have been pushed to ${env}.`));
|
|
41
|
-
if (prod) {
|
|
42
|
-
console.log(chalk.magentaBright(`You can view the products at ${FRONTEND_URL}/products`));
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
console.log(chalk.magentaBright(`You can view the products at ${FRONTEND_URL}/sandbox/products`));
|
|
46
|
-
}
|
|
47
|
-
}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const FRONTEND_URL = "http://app.useautumn.com";
|
|
2
|
-
export declare const BACKEND_URL = "https://api.useautumn.com";
|
|
3
|
-
export declare const DEFAULT_CONFIG = "import {\n\tfeature,\n\tproduct,\n\tpriceItem,\n\tfeatureItem,\n\tpricedFeatureItem,\n} from 'autumn-js/compose';\n\nconst seats = feature({\n\tid: 'seats',\n\tname: 'Seats',\n\ttype: 'continuous_use',\n});\n\nconst messages = feature({\n\tid: 'messages',\n\tname: 'Messages',\n\ttype: 'single_use',\n});\n\nconst pro = product({\n\tid: 'pro',\n\tname: 'Pro',\n\titems: [\n\t\t// 500 messages per month\n\t\tfeatureItem({\n\t\t\tfeature_id: messages.id,\n\t\t\tincluded_usage: 500,\n\t\t\tinterval: 'month',\n\t\t}),\n\n\t\t// $10 per seat per month\n\t\tpricedFeatureItem({\n\t\t\tfeature_id: seats.id,\n\t\t\tprice: 10,\n\t\t\tinterval: 'month',\n\t\t}),\n\n\t\t// $50 / month\n\t\tpriceItem({\n\t\t\tprice: 50,\n\t\t\tinterval: 'month',\n\t\t}),\n\t],\n});\n\nexport default {\n\tfeatures: [seats, messages],\n\tproducts: [pro],\n};\n";
|