atmn 0.0.21 → 0.0.22
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.js +12 -11
- package/dist/core/api.d.ts +2 -1
- package/dist/core/utils.d.ts +3 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -52399,7 +52399,7 @@ function getEnvVar(parsed, prodFlag) {
|
|
|
52399
52399
|
return parsed["AUTUMN_PROD_SECRET_KEY"];
|
|
52400
52400
|
return parsed["AUTUMN_SECRET_KEY"];
|
|
52401
52401
|
}
|
|
52402
|
-
function readFromEnv() {
|
|
52402
|
+
function readFromEnv(options) {
|
|
52403
52403
|
const envPath = `${process.cwd()}/.env`;
|
|
52404
52404
|
const envLocalPath = `${process.cwd()}/.env.local`;
|
|
52405
52405
|
const prodFlag = process.argv.includes("--prod") || process.argv.includes("-p");
|
|
@@ -52414,12 +52414,12 @@ function readFromEnv() {
|
|
|
52414
52414
|
secretKey = getEnvVar(import_dotenv.default.parse(fs6.readFileSync(envPath, "utf-8")), prodFlag);
|
|
52415
52415
|
if (fs6.existsSync(envLocalPath))
|
|
52416
52416
|
secretKey = getEnvVar(import_dotenv.default.parse(fs6.readFileSync(envLocalPath, "utf-8")), prodFlag);
|
|
52417
|
-
if (!secretKey) {
|
|
52417
|
+
if (!secretKey && !options?.bypass) {
|
|
52418
52418
|
if (prodFlag) {
|
|
52419
|
-
console.error("[Error] atmn uses the AUTUMN_PROD_SECRET_KEY to call the Autumn production API. Please add it to your .env file.");
|
|
52419
|
+
console.error("[Error] atmn uses the AUTUMN_PROD_SECRET_KEY to call the Autumn production API. Please add it to your .env file or run `atmn login` to authenticate.");
|
|
52420
52420
|
process.exit(1);
|
|
52421
52421
|
} else {
|
|
52422
|
-
console.error("[Error] atmn uses the AUTUMN_SECRET_KEY to call the Autumn sandbox API. Please add it to your .env (or .env.local) file.");
|
|
52422
|
+
console.error("[Error] atmn uses the AUTUMN_SECRET_KEY to call the Autumn sandbox API. Please add it to your .env (or .env.local) file or run `atmn login` to authenticate.");
|
|
52423
52423
|
process.exit(1);
|
|
52424
52424
|
}
|
|
52425
52425
|
}
|
|
@@ -55653,9 +55653,10 @@ async function request({
|
|
|
55653
55653
|
customAuth,
|
|
55654
55654
|
throwOnError = true,
|
|
55655
55655
|
secretKey,
|
|
55656
|
-
queryParams
|
|
55656
|
+
queryParams,
|
|
55657
|
+
bypass
|
|
55657
55658
|
}) {
|
|
55658
|
-
const apiKey = secretKey || readFromEnv();
|
|
55659
|
+
const apiKey = secretKey || readFromEnv({ bypass });
|
|
55659
55660
|
try {
|
|
55660
55661
|
const response = await axios_default.request({
|
|
55661
55662
|
method,
|
|
@@ -55707,7 +55708,8 @@ async function internalRequest({
|
|
|
55707
55708
|
path: path2,
|
|
55708
55709
|
data,
|
|
55709
55710
|
headers,
|
|
55710
|
-
customAuth
|
|
55711
|
+
customAuth,
|
|
55712
|
+
bypass: true
|
|
55711
55713
|
});
|
|
55712
55714
|
}
|
|
55713
55715
|
async function externalRequest({
|
|
@@ -55784,14 +55786,13 @@ var inputTheme2 = {
|
|
|
55784
55786
|
}
|
|
55785
55787
|
};
|
|
55786
55788
|
async function AuthCommand() {
|
|
55787
|
-
if (readFromEnv()) {
|
|
55789
|
+
if (readFromEnv({ bypass: true })) {
|
|
55788
55790
|
let shouldReauth = await esm_default2({
|
|
55789
55791
|
message: "You are already authenticated. Would you like to re-authenticate?",
|
|
55790
55792
|
theme: inputTheme2
|
|
55791
55793
|
});
|
|
55792
|
-
if (!shouldReauth)
|
|
55794
|
+
if (!shouldReauth)
|
|
55793
55795
|
return;
|
|
55794
|
-
}
|
|
55795
55796
|
}
|
|
55796
55797
|
open_default(`${FRONTEND_URL}/dev/cli`);
|
|
55797
55798
|
const otp = await esm_default3({
|
|
@@ -68312,7 +68313,7 @@ async function Push({
|
|
|
68312
68313
|
}
|
|
68313
68314
|
|
|
68314
68315
|
// source/cli.ts
|
|
68315
|
-
var computedVersion = "0.0.
|
|
68316
|
+
var computedVersion = "0.0.21";
|
|
68316
68317
|
program.version(computedVersion);
|
|
68317
68318
|
program.option("-p, --prod", "Push to production");
|
|
68318
68319
|
program.command("env").description("Check the environment of your API key").action(async () => {
|
package/dist/core/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function request({ method, base, path, data, headers, customAuth, throwOnError, secretKey, queryParams, }: {
|
|
1
|
+
export declare function request({ method, base, path, data, headers, customAuth, throwOnError, secretKey, queryParams, bypass, }: {
|
|
2
2
|
method: string;
|
|
3
3
|
base: string;
|
|
4
4
|
path: string;
|
|
@@ -8,6 +8,7 @@ export declare function request({ method, base, path, data, headers, customAuth,
|
|
|
8
8
|
throwOnError?: boolean;
|
|
9
9
|
secretKey?: string;
|
|
10
10
|
queryParams?: Record<string, string>;
|
|
11
|
+
bypass?: boolean;
|
|
11
12
|
}): Promise<any>;
|
|
12
13
|
export declare function internalRequest({ method, path, data, headers, customAuth, }: {
|
|
13
14
|
method: string;
|
package/dist/core/utils.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export declare function idToVar({ id, prefix, }: {
|
|
|
7
7
|
prefix?: string;
|
|
8
8
|
}): string;
|
|
9
9
|
export declare function storeToEnv(prodKey: string, sandboxKey: string): Promise<void>;
|
|
10
|
-
export declare function readFromEnv(
|
|
10
|
+
export declare function readFromEnv(options?: {
|
|
11
|
+
bypass?: boolean;
|
|
12
|
+
}): string | undefined;
|
|
11
13
|
export declare function initSpinner(message: string): import("yocto-spinner").Spinner;
|
|
12
14
|
export declare function isSandboxKey(apiKey: string): Promise<boolean>;
|