atmn 0.0.24 → 0.0.27
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 +49 -15
- package/dist/cli.js +48 -14
- package/dist/commands/init.d.ts +1 -3
- package/dist/commands/pull.d.ts +2 -2
- package/dist/commands/push.d.ts +6 -1
- package/dist/compose/builders/builderFunctions.d.ts +6 -19
- package/dist/compose/index.d.ts +4 -4
- package/dist/compose/models/composeModels.d.ts +1 -25
- package/dist/compose/models/productItemModels.d.ts +0 -4
- package/dist/constants.d.ts +2 -2
- package/dist/core/api.d.ts +8 -12
- package/dist/core/builders/products.d.ts +1 -1
- package/dist/core/config.d.ts +1 -10
- package/dist/core/pull.d.ts +7 -27
- package/dist/core/push.d.ts +19 -2
- package/dist/core/utils.d.ts +6 -9
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
- package/dist/cli.js.map +0 -278
- package/dist/core/builders/featureBuilder.d.ts +0 -2
- package/dist/core/builders/freeTrialBuilder.d.ts +0 -4
- package/dist/core/builders/productBuilder.d.ts +0 -18
- package/dist/core/requests/featureRequests.d.ts +0 -10
- package/dist/core/requests/orgRequests.d.ts +0 -1
- package/dist/core/requests/prodRequests.d.ts +0 -10
- package/dist/index.js.map +0 -10
package/dist/cli.cjs
CHANGED
|
@@ -28,11 +28,15 @@ var prettier__default = /*#__PURE__*/_interopDefault(prettier);
|
|
|
28
28
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
29
29
|
var createJiti__default = /*#__PURE__*/_interopDefault(createJiti);
|
|
30
30
|
|
|
31
|
-
// ../node_modules/.pnpm/tsup@8.5.
|
|
31
|
+
// ../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.5_jiti@2.5.1_postcss@8.5.6_tsx@4.20.4_typescript@5.9.2_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
|
|
32
32
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
33
33
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
34
34
|
var notNullish = (value) => value !== null && value !== void 0;
|
|
35
35
|
var nullish = (value) => value === null || value === void 0;
|
|
36
|
+
var isLocalFlag = () => {
|
|
37
|
+
const localFlag = process.argv.includes("--local") || process.argv.includes("-l");
|
|
38
|
+
return localFlag;
|
|
39
|
+
};
|
|
36
40
|
function idToVar({
|
|
37
41
|
id,
|
|
38
42
|
prefix = "product"
|
|
@@ -108,13 +112,13 @@ function readFromEnv(options) {
|
|
|
108
112
|
if (!prodFlag && process.env["AUTUMN_SECRET_KEY"]) {
|
|
109
113
|
return process.env["AUTUMN_SECRET_KEY"];
|
|
110
114
|
}
|
|
111
|
-
let secretKey
|
|
112
|
-
if (fs__default.default.existsSync(envPath))
|
|
115
|
+
let secretKey;
|
|
116
|
+
if (fs__default.default.existsSync(envPath) && !secretKey)
|
|
113
117
|
secretKey = getEnvVar(
|
|
114
118
|
dotenv__default.default.parse(fs__default.default.readFileSync(envPath, "utf-8")),
|
|
115
119
|
prodFlag
|
|
116
120
|
);
|
|
117
|
-
if (fs__default.default.existsSync(envLocalPath))
|
|
121
|
+
if (fs__default.default.existsSync(envLocalPath) && !secretKey)
|
|
118
122
|
secretKey = getEnvVar(
|
|
119
123
|
dotenv__default.default.parse(fs__default.default.readFileSync(envLocalPath, "utf-8")),
|
|
120
124
|
prodFlag
|
|
@@ -214,6 +218,13 @@ async function request({
|
|
|
214
218
|
queryParams,
|
|
215
219
|
bypass
|
|
216
220
|
}) {
|
|
221
|
+
if (isLocalFlag()) {
|
|
222
|
+
INTERNAL_BASE = "http://localhost:8080";
|
|
223
|
+
EXTERNAL_BASE = "http://localhost:8080/v1";
|
|
224
|
+
if (base) {
|
|
225
|
+
base = base.replace(BACKEND_URL, "http://localhost:8080");
|
|
226
|
+
}
|
|
227
|
+
}
|
|
217
228
|
const apiKey = secretKey || readFromEnv({ bypass });
|
|
218
229
|
try {
|
|
219
230
|
const response = await axios__default.default.request({
|
|
@@ -232,7 +243,8 @@ async function request({
|
|
|
232
243
|
if (throwOnError) {
|
|
233
244
|
throw error;
|
|
234
245
|
}
|
|
235
|
-
console.error(
|
|
246
|
+
console.error(`
|
|
247
|
+
${chalk8__default.default.bgRed.white.bold(" API REQUEST FAILED ")}`);
|
|
236
248
|
const methodPath = `${method.toUpperCase()} ${base}${path2}`;
|
|
237
249
|
console.error(chalk8__default.default.red(methodPath));
|
|
238
250
|
if (error instanceof axios.AxiosError) {
|
|
@@ -302,7 +314,7 @@ async function deleteProduct({
|
|
|
302
314
|
return await externalRequest({
|
|
303
315
|
method: "DELETE",
|
|
304
316
|
path: `/products/${id}`,
|
|
305
|
-
queryParams: { all_versions: allVersions
|
|
317
|
+
queryParams: { all_versions: !!allVersions }
|
|
306
318
|
});
|
|
307
319
|
}
|
|
308
320
|
async function updateCLIStripeKeys({
|
|
@@ -391,6 +403,16 @@ async function AuthCommand() {
|
|
|
391
403
|
)
|
|
392
404
|
);
|
|
393
405
|
}
|
|
406
|
+
async function getProducts(ids) {
|
|
407
|
+
return await Promise.all(
|
|
408
|
+
ids.map(
|
|
409
|
+
(id) => externalRequest({
|
|
410
|
+
method: "GET",
|
|
411
|
+
path: `/products/${id}`
|
|
412
|
+
})
|
|
413
|
+
)
|
|
414
|
+
);
|
|
415
|
+
}
|
|
394
416
|
async function getAllProducts(params) {
|
|
395
417
|
const { list: products } = await externalRequest({
|
|
396
418
|
method: "GET",
|
|
@@ -686,7 +708,8 @@ var ProductSchema = v4.z.object({
|
|
|
686
708
|
items: v4.z.array(ProductItemSchema, {
|
|
687
709
|
message: "Items must be an array of product items"
|
|
688
710
|
}),
|
|
689
|
-
free_trial: FreeTrialSchema.optional()
|
|
711
|
+
free_trial: FreeTrialSchema.optional(),
|
|
712
|
+
archived: v4.z.boolean().optional()
|
|
690
713
|
});
|
|
691
714
|
var FeatureSchema = v4.z.object({
|
|
692
715
|
id: v4.z.string().min(1, "Feature ID is required and cannot be empty"),
|
|
@@ -1257,16 +1280,23 @@ var gatherProductDeletionDecisions = async ({
|
|
|
1257
1280
|
const productId = productsToDelete[i];
|
|
1258
1281
|
const result = checkProductResults[i];
|
|
1259
1282
|
if (!productId) continue;
|
|
1283
|
+
const product = (await getProducts([productId])).find(
|
|
1284
|
+
(x) => x.id === productId
|
|
1285
|
+
);
|
|
1260
1286
|
if (result && result.totalCount > 0) {
|
|
1261
1287
|
const otherCustomersText = result.totalCount > 1 ? ` and ${result.totalCount - 1} other customer(s)` : "";
|
|
1262
1288
|
const customerNameText = result.customerName || "Unknown Customer";
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1289
|
+
if (product?.archived) {
|
|
1290
|
+
productDeletionDecisions.set(productId, "skip");
|
|
1291
|
+
} else {
|
|
1292
|
+
const shouldArchive = yes || await prompts.confirm({
|
|
1293
|
+
message: `Product ${productId} has customer ${customerNameText}${otherCustomersText}. As such, you cannot delete it. Would you like to archive the product instead?`
|
|
1294
|
+
});
|
|
1295
|
+
productDeletionDecisions.set(
|
|
1296
|
+
productId,
|
|
1297
|
+
shouldArchive ? "archive" : "skip"
|
|
1298
|
+
);
|
|
1299
|
+
}
|
|
1270
1300
|
} else {
|
|
1271
1301
|
productDeletionDecisions.set(productId, "delete");
|
|
1272
1302
|
}
|
|
@@ -1359,7 +1389,10 @@ var gatherProductDecisions = async ({
|
|
|
1359
1389
|
const s = createSpinner({
|
|
1360
1390
|
message: `Un-archiving product [${result.id}]`
|
|
1361
1391
|
});
|
|
1362
|
-
await updateProduct({
|
|
1392
|
+
await updateProduct({
|
|
1393
|
+
productId: result.id,
|
|
1394
|
+
update: { archived: false }
|
|
1395
|
+
});
|
|
1363
1396
|
s.success(`Product [${result.id}] un-archived successfully!`);
|
|
1364
1397
|
productDecisions.set(result.id, true);
|
|
1365
1398
|
} else {
|
|
@@ -1513,6 +1546,7 @@ async function Push({
|
|
|
1513
1546
|
var computedVersion = typeof VERSION !== "undefined" && VERSION ? VERSION : "dev";
|
|
1514
1547
|
commander.program.version(computedVersion);
|
|
1515
1548
|
commander.program.option("-p, --prod", "Push to production");
|
|
1549
|
+
commander.program.option("-l, --local", "Use local autumn environment");
|
|
1516
1550
|
commander.program.command("env").description("Check the environment of your API key").action(async () => {
|
|
1517
1551
|
const env = await isSandboxKey(readFromEnv() ?? "");
|
|
1518
1552
|
console.log(chalk8__default.default.green(`Environment: ${env ? "Sandbox" : "Production"}`));
|
package/dist/cli.js
CHANGED
|
@@ -16,6 +16,10 @@ import { z } from 'zod/v4';
|
|
|
16
16
|
|
|
17
17
|
var notNullish = (value) => value !== null && value !== void 0;
|
|
18
18
|
var nullish = (value) => value === null || value === void 0;
|
|
19
|
+
var isLocalFlag = () => {
|
|
20
|
+
const localFlag = process.argv.includes("--local") || process.argv.includes("-l");
|
|
21
|
+
return localFlag;
|
|
22
|
+
};
|
|
19
23
|
function idToVar({
|
|
20
24
|
id,
|
|
21
25
|
prefix = "product"
|
|
@@ -91,13 +95,13 @@ function readFromEnv(options) {
|
|
|
91
95
|
if (!prodFlag && process.env["AUTUMN_SECRET_KEY"]) {
|
|
92
96
|
return process.env["AUTUMN_SECRET_KEY"];
|
|
93
97
|
}
|
|
94
|
-
let secretKey
|
|
95
|
-
if (fs.existsSync(envPath))
|
|
98
|
+
let secretKey;
|
|
99
|
+
if (fs.existsSync(envPath) && !secretKey)
|
|
96
100
|
secretKey = getEnvVar(
|
|
97
101
|
dotenv.parse(fs.readFileSync(envPath, "utf-8")),
|
|
98
102
|
prodFlag
|
|
99
103
|
);
|
|
100
|
-
if (fs.existsSync(envLocalPath))
|
|
104
|
+
if (fs.existsSync(envLocalPath) && !secretKey)
|
|
101
105
|
secretKey = getEnvVar(
|
|
102
106
|
dotenv.parse(fs.readFileSync(envLocalPath, "utf-8")),
|
|
103
107
|
prodFlag
|
|
@@ -197,6 +201,13 @@ async function request({
|
|
|
197
201
|
queryParams,
|
|
198
202
|
bypass
|
|
199
203
|
}) {
|
|
204
|
+
if (isLocalFlag()) {
|
|
205
|
+
INTERNAL_BASE = "http://localhost:8080";
|
|
206
|
+
EXTERNAL_BASE = "http://localhost:8080/v1";
|
|
207
|
+
if (base) {
|
|
208
|
+
base = base.replace(BACKEND_URL, "http://localhost:8080");
|
|
209
|
+
}
|
|
210
|
+
}
|
|
200
211
|
const apiKey = secretKey || readFromEnv({ bypass });
|
|
201
212
|
try {
|
|
202
213
|
const response = await axios.request({
|
|
@@ -215,7 +226,8 @@ async function request({
|
|
|
215
226
|
if (throwOnError) {
|
|
216
227
|
throw error;
|
|
217
228
|
}
|
|
218
|
-
console.error(
|
|
229
|
+
console.error(`
|
|
230
|
+
${chalk8.bgRed.white.bold(" API REQUEST FAILED ")}`);
|
|
219
231
|
const methodPath = `${method.toUpperCase()} ${base}${path2}`;
|
|
220
232
|
console.error(chalk8.red(methodPath));
|
|
221
233
|
if (error instanceof AxiosError) {
|
|
@@ -285,7 +297,7 @@ async function deleteProduct({
|
|
|
285
297
|
return await externalRequest({
|
|
286
298
|
method: "DELETE",
|
|
287
299
|
path: `/products/${id}`,
|
|
288
|
-
queryParams: { all_versions: allVersions
|
|
300
|
+
queryParams: { all_versions: !!allVersions }
|
|
289
301
|
});
|
|
290
302
|
}
|
|
291
303
|
async function updateCLIStripeKeys({
|
|
@@ -374,6 +386,16 @@ async function AuthCommand() {
|
|
|
374
386
|
)
|
|
375
387
|
);
|
|
376
388
|
}
|
|
389
|
+
async function getProducts(ids) {
|
|
390
|
+
return await Promise.all(
|
|
391
|
+
ids.map(
|
|
392
|
+
(id) => externalRequest({
|
|
393
|
+
method: "GET",
|
|
394
|
+
path: `/products/${id}`
|
|
395
|
+
})
|
|
396
|
+
)
|
|
397
|
+
);
|
|
398
|
+
}
|
|
377
399
|
async function getAllProducts(params) {
|
|
378
400
|
const { list: products } = await externalRequest({
|
|
379
401
|
method: "GET",
|
|
@@ -669,7 +691,8 @@ var ProductSchema = z.object({
|
|
|
669
691
|
items: z.array(ProductItemSchema, {
|
|
670
692
|
message: "Items must be an array of product items"
|
|
671
693
|
}),
|
|
672
|
-
free_trial: FreeTrialSchema.optional()
|
|
694
|
+
free_trial: FreeTrialSchema.optional(),
|
|
695
|
+
archived: z.boolean().optional()
|
|
673
696
|
});
|
|
674
697
|
var FeatureSchema = z.object({
|
|
675
698
|
id: z.string().min(1, "Feature ID is required and cannot be empty"),
|
|
@@ -1240,16 +1263,23 @@ var gatherProductDeletionDecisions = async ({
|
|
|
1240
1263
|
const productId = productsToDelete[i];
|
|
1241
1264
|
const result = checkProductResults[i];
|
|
1242
1265
|
if (!productId) continue;
|
|
1266
|
+
const product = (await getProducts([productId])).find(
|
|
1267
|
+
(x) => x.id === productId
|
|
1268
|
+
);
|
|
1243
1269
|
if (result && result.totalCount > 0) {
|
|
1244
1270
|
const otherCustomersText = result.totalCount > 1 ? ` and ${result.totalCount - 1} other customer(s)` : "";
|
|
1245
1271
|
const customerNameText = result.customerName || "Unknown Customer";
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1272
|
+
if (product?.archived) {
|
|
1273
|
+
productDeletionDecisions.set(productId, "skip");
|
|
1274
|
+
} else {
|
|
1275
|
+
const shouldArchive = yes || await confirm({
|
|
1276
|
+
message: `Product ${productId} has customer ${customerNameText}${otherCustomersText}. As such, you cannot delete it. Would you like to archive the product instead?`
|
|
1277
|
+
});
|
|
1278
|
+
productDeletionDecisions.set(
|
|
1279
|
+
productId,
|
|
1280
|
+
shouldArchive ? "archive" : "skip"
|
|
1281
|
+
);
|
|
1282
|
+
}
|
|
1253
1283
|
} else {
|
|
1254
1284
|
productDeletionDecisions.set(productId, "delete");
|
|
1255
1285
|
}
|
|
@@ -1342,7 +1372,10 @@ var gatherProductDecisions = async ({
|
|
|
1342
1372
|
const s = createSpinner({
|
|
1343
1373
|
message: `Un-archiving product [${result.id}]`
|
|
1344
1374
|
});
|
|
1345
|
-
await updateProduct({
|
|
1375
|
+
await updateProduct({
|
|
1376
|
+
productId: result.id,
|
|
1377
|
+
update: { archived: false }
|
|
1378
|
+
});
|
|
1346
1379
|
s.success(`Product [${result.id}] un-archived successfully!`);
|
|
1347
1380
|
productDecisions.set(result.id, true);
|
|
1348
1381
|
} else {
|
|
@@ -1496,6 +1529,7 @@ async function Push({
|
|
|
1496
1529
|
var computedVersion = typeof VERSION !== "undefined" && VERSION ? VERSION : "dev";
|
|
1497
1530
|
program.version(computedVersion);
|
|
1498
1531
|
program.option("-p, --prod", "Push to production");
|
|
1532
|
+
program.option("-l, --local", "Use local autumn environment");
|
|
1499
1533
|
program.command("env").description("Check the environment of your API key").action(async () => {
|
|
1500
1534
|
const env = await isSandboxKey(readFromEnv() ?? "");
|
|
1501
1535
|
console.log(chalk8.green(`Environment: ${env ? "Sandbox" : "Production"}`));
|
package/dist/commands/init.d.ts
CHANGED
package/dist/commands/pull.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export default function Pull(
|
|
2
|
-
|
|
1
|
+
export default function Pull(options?: {
|
|
2
|
+
archived?: boolean;
|
|
3
3
|
}): Promise<void>;
|
package/dist/commands/push.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import type { Feature, Product } from "../compose/index.js";
|
|
1
2
|
export default function Push({ config, yes, prod, }: {
|
|
2
|
-
config:
|
|
3
|
+
config: {
|
|
4
|
+
features: Feature[];
|
|
5
|
+
products: Product[];
|
|
6
|
+
env: string;
|
|
7
|
+
};
|
|
3
8
|
yes: boolean;
|
|
4
9
|
prod: boolean;
|
|
5
10
|
}): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ProductItem, ProductItemInterval, UsageModel } from
|
|
1
|
+
import type { Feature, Product } from "../models/composeModels.js";
|
|
2
|
+
import type { ProductItem, ProductItemInterval, UsageModel } from "../models/productItemModels.js";
|
|
3
3
|
export declare const product: (p: Product) => {
|
|
4
4
|
id: string;
|
|
5
5
|
name: string;
|
|
@@ -10,22 +10,13 @@ export declare const product: (p: Product) => {
|
|
|
10
10
|
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
11
11
|
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
12
12
|
price?: number | null | undefined;
|
|
13
|
-
tiers?: {
|
|
14
|
-
amount: number;
|
|
15
|
-
to: number | "inf";
|
|
16
|
-
}[] | null | undefined;
|
|
17
13
|
billing_units?: number | null | undefined;
|
|
18
14
|
reset_usage_when_enabled?: boolean | undefined;
|
|
19
15
|
entity_feature_id?: string | undefined;
|
|
20
16
|
}[];
|
|
21
17
|
is_add_on?: boolean | undefined;
|
|
22
18
|
is_default?: boolean | undefined;
|
|
23
|
-
|
|
24
|
-
duration: "day" | "month" | "year";
|
|
25
|
-
length: number;
|
|
26
|
-
unique_fingerprint: boolean;
|
|
27
|
-
card_required: boolean;
|
|
28
|
-
} | undefined;
|
|
19
|
+
archived?: boolean | undefined;
|
|
29
20
|
};
|
|
30
21
|
export declare const feature: (f: Feature) => {
|
|
31
22
|
id: string;
|
|
@@ -38,18 +29,14 @@ export declare const feature: (f: Feature) => {
|
|
|
38
29
|
};
|
|
39
30
|
export declare const featureItem: ({ feature_id, included_usage, interval, reset_usage_when_enabled, entity_feature_id, }: {
|
|
40
31
|
feature_id: string;
|
|
41
|
-
included_usage?: number
|
|
32
|
+
included_usage?: number;
|
|
42
33
|
interval?: ProductItemInterval;
|
|
43
34
|
reset_usage_when_enabled?: boolean;
|
|
44
35
|
entity_feature_id?: string;
|
|
45
36
|
}) => ProductItem;
|
|
46
|
-
export declare const pricedFeatureItem: ({ feature_id, price,
|
|
37
|
+
export declare const pricedFeatureItem: ({ feature_id, price, interval, included_usage, billing_units, usage_model, reset_usage_when_enabled, entity_feature_id, }: {
|
|
47
38
|
feature_id: string;
|
|
48
|
-
price
|
|
49
|
-
tiers?: {
|
|
50
|
-
to: number | "inf";
|
|
51
|
-
amount: number;
|
|
52
|
-
}[];
|
|
39
|
+
price: number;
|
|
53
40
|
interval?: ProductItemInterval;
|
|
54
41
|
included_usage?: number;
|
|
55
42
|
billing_units?: number;
|
package/dist/compose/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Feature, Product } from
|
|
3
|
-
import { ProductItem } from
|
|
1
|
+
import { feature, featureItem, pricedFeatureItem, priceItem, product } from "./builders/builderFunctions.js";
|
|
2
|
+
import type { Feature, Product } from "./models/composeModels.js";
|
|
3
|
+
import type { ProductItem } from "./models/productItemModels.js";
|
|
4
4
|
export { product, priceItem, feature, featureItem, pricedFeatureItem };
|
|
5
5
|
export type { Feature, Product, ProductItem };
|
|
6
|
-
export type Infinity =
|
|
6
|
+
export type Infinity = "infinity";
|
|
7
7
|
export type AutumnConfig = {
|
|
8
8
|
products: Product[];
|
|
9
9
|
features: Feature[];
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
export declare const FreeTrialSchema: z.ZodObject<{
|
|
3
|
-
duration: z.ZodEnum<{
|
|
4
|
-
day: "day";
|
|
5
|
-
month: "month";
|
|
6
|
-
year: "year";
|
|
7
|
-
}>;
|
|
8
|
-
length: z.ZodNumber;
|
|
9
|
-
unique_fingerprint: z.ZodBoolean;
|
|
10
|
-
card_required: z.ZodBoolean;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
2
|
export declare const ProductSchema: z.ZodObject<{
|
|
13
3
|
id: z.ZodString;
|
|
14
4
|
name: z.ZodString;
|
|
@@ -36,24 +26,11 @@ export declare const ProductSchema: z.ZodObject<{
|
|
|
36
26
|
pay_per_use: "pay_per_use";
|
|
37
27
|
}>>>;
|
|
38
28
|
price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
39
|
-
tiers: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
40
|
-
amount: z.ZodNumber;
|
|
41
|
-
to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
42
|
-
}, z.core.$strip>>>>;
|
|
43
29
|
billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
44
30
|
reset_usage_when_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
45
31
|
entity_feature_id: z.ZodOptional<z.ZodString>;
|
|
46
32
|
}, z.core.$strip>>;
|
|
47
|
-
|
|
48
|
-
duration: z.ZodEnum<{
|
|
49
|
-
day: "day";
|
|
50
|
-
month: "month";
|
|
51
|
-
year: "year";
|
|
52
|
-
}>;
|
|
53
|
-
length: z.ZodNumber;
|
|
54
|
-
unique_fingerprint: z.ZodBoolean;
|
|
55
|
-
card_required: z.ZodBoolean;
|
|
56
|
-
}, z.core.$strip>>;
|
|
33
|
+
archived: z.ZodOptional<z.ZodPrefault<z.ZodBoolean>>;
|
|
57
34
|
}, z.core.$strip>;
|
|
58
35
|
export declare const FeatureSchema: z.ZodObject<{
|
|
59
36
|
id: z.ZodString;
|
|
@@ -71,4 +48,3 @@ export declare const FeatureSchema: z.ZodObject<{
|
|
|
71
48
|
}, z.core.$strip>;
|
|
72
49
|
export type Feature = z.infer<typeof FeatureSchema>;
|
|
73
50
|
export type Product = z.infer<typeof ProductSchema>;
|
|
74
|
-
export type FreeTrial = z.infer<typeof FreeTrialSchema>;
|
|
@@ -37,10 +37,6 @@ export declare const ProductItemSchema: z.ZodObject<{
|
|
|
37
37
|
pay_per_use: "pay_per_use";
|
|
38
38
|
}>>>;
|
|
39
39
|
price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
40
|
-
tiers: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
41
|
-
amount: z.ZodNumber;
|
|
42
|
-
to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
43
|
-
}, z.core.$strip>>>>;
|
|
44
40
|
billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
45
41
|
reset_usage_when_enabled: z.ZodOptional<z.ZodBoolean>;
|
|
46
42
|
entity_feature_id: z.ZodOptional<z.ZodString>;
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const FRONTEND_URL = "http://
|
|
2
|
-
export declare const BACKEND_URL = "
|
|
1
|
+
export declare const FRONTEND_URL = "http://app.useautumn.com";
|
|
2
|
+
export declare const BACKEND_URL = "https://api.useautumn.com";
|
|
3
3
|
export declare const DEFAULT_CONFIG = "import {\n\tfeature,\n\tproduct,\n\tpriceItem,\n\tfeatureItem,\n\tpricedFeatureItem,\n} from 'atmn';\n\nexport const seats = feature({\n\tid: 'seats',\n\tname: 'Seats',\n\ttype: 'continuous_use',\n});\n\nexport const messages = feature({\n\tid: 'messages',\n\tname: 'Messages',\n\ttype: 'single_use',\n});\n\nexport const 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";
|
package/dist/core/api.d.ts
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
export declare function request({ method, base, path, data, headers, customAuth, throwOnError,
|
|
1
|
+
export declare function request({ method, base, path, data, headers, customAuth, throwOnError, }: {
|
|
2
2
|
method: string;
|
|
3
3
|
base: string;
|
|
4
4
|
path: string;
|
|
5
|
-
data?:
|
|
6
|
-
headers?:
|
|
5
|
+
data?: Record<string, unknown>;
|
|
6
|
+
headers?: Record<string, string>;
|
|
7
7
|
customAuth?: string;
|
|
8
8
|
throwOnError?: boolean;
|
|
9
|
-
secretKey?: string;
|
|
10
9
|
}): Promise<any>;
|
|
11
10
|
export declare function internalRequest({ method, path, data, headers, customAuth, }: {
|
|
12
11
|
method: string;
|
|
13
12
|
path: string;
|
|
14
|
-
data?:
|
|
15
|
-
headers?:
|
|
13
|
+
data?: Record<string, unknown>;
|
|
14
|
+
headers?: Record<string, string>;
|
|
16
15
|
customAuth?: string;
|
|
17
16
|
}): Promise<any>;
|
|
18
17
|
export declare function externalRequest({ method, path, data, headers, customAuth, throwOnError, }: {
|
|
19
18
|
method: string;
|
|
20
19
|
path: string;
|
|
21
|
-
data?:
|
|
22
|
-
headers?:
|
|
20
|
+
data?: Record<string, unknown>;
|
|
21
|
+
headers?: Record<string, string>;
|
|
23
22
|
customAuth?: string;
|
|
24
23
|
throwOnError?: boolean;
|
|
25
24
|
}): Promise<any>;
|
|
26
25
|
export declare function deleteFeature(id: string): Promise<any>;
|
|
27
26
|
export declare function deleteProduct(id: string): Promise<any>;
|
|
28
|
-
export declare function updateCLIStripeKeys(
|
|
29
|
-
stripeSecretKey: string;
|
|
30
|
-
autumnSecretKey: string;
|
|
31
|
-
}): Promise<any>;
|
|
27
|
+
export declare function updateCLIStripeKeys(stripeTestKey: string, stripeLiveKey: string, stripeFlowAuthKey: string): Promise<any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Feature, Product, ProductItem } from "../../compose/index.js";
|
|
2
2
|
export declare function importBuilder(): string;
|
|
3
3
|
export declare function exportBuilder(productIds: string[], featureIds: string[]): string;
|
|
4
4
|
export declare function productBuilder({ product, features, }: {
|
package/dist/core/config.d.ts
CHANGED
|
@@ -9,22 +9,13 @@ export declare function loadAutumnConfigFile(): Promise<{
|
|
|
9
9
|
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
10
10
|
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
11
11
|
price?: number | null | undefined;
|
|
12
|
-
tiers?: {
|
|
13
|
-
amount: number;
|
|
14
|
-
to: number | "inf";
|
|
15
|
-
}[] | null | undefined;
|
|
16
12
|
billing_units?: number | null | undefined;
|
|
17
13
|
reset_usage_when_enabled?: boolean | undefined;
|
|
18
14
|
entity_feature_id?: string | undefined;
|
|
19
15
|
}[];
|
|
20
16
|
is_add_on?: boolean | undefined;
|
|
21
17
|
is_default?: boolean | undefined;
|
|
22
|
-
|
|
23
|
-
duration: "day" | "month" | "year";
|
|
24
|
-
length: number;
|
|
25
|
-
unique_fingerprint: boolean;
|
|
26
|
-
card_required: boolean;
|
|
27
|
-
} | undefined;
|
|
18
|
+
archived?: boolean | undefined;
|
|
28
19
|
}[];
|
|
29
20
|
features: {
|
|
30
21
|
id: string;
|
package/dist/core/pull.d.ts
CHANGED
|
@@ -1,29 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Product } from "../compose/models/composeModels.js";
|
|
2
|
+
export declare function getProducts(ids: string[]): Promise<Product[]>;
|
|
3
|
+
export declare function getAllProducts(archived?: boolean): Promise<Product[]>;
|
|
4
|
+
export declare function getAllProductVariants(): Promise<any[]>;
|
|
5
|
+
export declare function getFeatures(): Promise<any>;
|
|
6
|
+
export declare function getCustomers(limit?: number, offset?: number): Promise<{
|
|
2
7
|
id: string;
|
|
3
|
-
|
|
4
|
-
items: {
|
|
5
|
-
type?: "feature" | "priced_feature" | null | undefined;
|
|
6
|
-
feature_id?: string | null | undefined;
|
|
7
|
-
included_usage?: number | "inf" | null | undefined;
|
|
8
|
-
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
9
|
-
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
10
|
-
price?: number | null | undefined;
|
|
11
|
-
tiers?: {
|
|
12
|
-
amount: number;
|
|
13
|
-
to: number | "inf";
|
|
14
|
-
}[] | null | undefined;
|
|
15
|
-
billing_units?: number | null | undefined;
|
|
16
|
-
reset_usage_when_enabled?: boolean | undefined;
|
|
17
|
-
entity_feature_id?: string | undefined;
|
|
18
|
-
}[];
|
|
19
|
-
is_add_on?: boolean | undefined;
|
|
20
|
-
is_default?: boolean | undefined;
|
|
21
|
-
free_trial?: {
|
|
22
|
-
duration: "day" | "month" | "year";
|
|
23
|
-
length: number;
|
|
24
|
-
unique_fingerprint: boolean;
|
|
25
|
-
card_required: boolean;
|
|
26
|
-
} | undefined;
|
|
8
|
+
text: string;
|
|
27
9
|
}[]>;
|
|
28
|
-
export declare function getAllProducts(): Promise<any>;
|
|
29
|
-
export declare function getFeatures(): Promise<any>;
|
package/dist/core/push.d.ts
CHANGED
|
@@ -2,9 +2,26 @@ import type { Spinner } from "yocto-spinner";
|
|
|
2
2
|
import type { Feature, Product } from "../compose/index.js";
|
|
3
3
|
export declare function checkForDeletables(currentFeatures: Feature[], currentProducts: Product[]): Promise<{
|
|
4
4
|
curFeatures: any;
|
|
5
|
-
curProducts:
|
|
5
|
+
curProducts: {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
items: {
|
|
9
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
10
|
+
feature_id?: string | null | undefined;
|
|
11
|
+
included_usage?: number | "inf" | null | undefined;
|
|
12
|
+
interval?: "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | null | undefined;
|
|
13
|
+
usage_model?: "prepaid" | "pay_per_use" | null | undefined;
|
|
14
|
+
price?: number | null | undefined;
|
|
15
|
+
billing_units?: number | null | undefined;
|
|
16
|
+
reset_usage_when_enabled?: boolean | undefined;
|
|
17
|
+
entity_feature_id?: string | undefined;
|
|
18
|
+
}[];
|
|
19
|
+
is_add_on?: boolean | undefined;
|
|
20
|
+
is_default?: boolean | undefined;
|
|
21
|
+
archived?: boolean | undefined;
|
|
22
|
+
}[];
|
|
6
23
|
featuresToDelete: any;
|
|
7
|
-
productsToDelete:
|
|
24
|
+
productsToDelete: string[];
|
|
8
25
|
}>;
|
|
9
26
|
export declare function upsertFeature(feature: Feature, s: Spinner): Promise<any>;
|
|
10
27
|
export declare function checkProductForConfirmation({ curProducts, product, }: {
|
package/dist/core/utils.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
export declare const notNullish: (value:
|
|
2
|
-
export declare const nullish: (value:
|
|
3
|
-
export declare const isProdFlag: () => boolean;
|
|
1
|
+
export declare const notNullish: (value: unknown) => value is {};
|
|
2
|
+
export declare const nullish: (value: unknown) => value is null | undefined;
|
|
4
3
|
export declare function snakeCaseToCamelCase(value: string): string;
|
|
5
|
-
export declare function idToVar(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}): string;
|
|
9
|
-
export declare function storeToEnv(prodKey: string, sandboxKey: string): Promise<void>;
|
|
10
|
-
export declare function readFromEnv(): string;
|
|
4
|
+
export declare function idToVar(id: string): string;
|
|
5
|
+
export declare function storeToEnv(prodKey: string, sandboxKey: string): void;
|
|
6
|
+
export declare function readFromEnv<T extends boolean = false>(errorOnNotFound?: T): T extends true ? string : string | undefined;
|
|
11
7
|
export declare function initSpinner(message: string): import("yocto-spinner").Spinner;
|
|
8
|
+
export declare function isSandboxKey(apiKey: string): Promise<boolean>;
|
package/dist/index.d.cts
CHANGED
|
@@ -45,6 +45,7 @@ declare const ProductSchema: z.ZodObject<{
|
|
|
45
45
|
unique_fingerprint: z.ZodBoolean;
|
|
46
46
|
card_required: z.ZodBoolean;
|
|
47
47
|
}, z.core.$strip>>;
|
|
48
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
48
49
|
}, z.core.$strip>;
|
|
49
50
|
declare const FeatureSchema: z.ZodObject<{
|
|
50
51
|
id: z.ZodString;
|
|
@@ -138,6 +139,7 @@ declare const product: (p: Product) => {
|
|
|
138
139
|
unique_fingerprint: boolean;
|
|
139
140
|
card_required: boolean;
|
|
140
141
|
} | undefined;
|
|
142
|
+
archived?: boolean | undefined;
|
|
141
143
|
};
|
|
142
144
|
declare const feature: (f: Feature) => {
|
|
143
145
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ declare const ProductSchema: z.ZodObject<{
|
|
|
45
45
|
unique_fingerprint: z.ZodBoolean;
|
|
46
46
|
card_required: z.ZodBoolean;
|
|
47
47
|
}, z.core.$strip>>;
|
|
48
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
48
49
|
}, z.core.$strip>;
|
|
49
50
|
declare const FeatureSchema: z.ZodObject<{
|
|
50
51
|
id: z.ZodString;
|
|
@@ -138,6 +139,7 @@ declare const product: (p: Product) => {
|
|
|
138
139
|
unique_fingerprint: boolean;
|
|
139
140
|
card_required: boolean;
|
|
140
141
|
} | undefined;
|
|
142
|
+
archived?: boolean | undefined;
|
|
141
143
|
};
|
|
142
144
|
declare const feature: (f: Feature) => {
|
|
143
145
|
id: string;
|