@neon/env 1.6.6 → 1.6.9
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 +13 -26
- package/dist/cli.js.map +1 -1
- package/dist/env.js +2 -4
- package/dist/env.js.map +1 -1
- package/dist/index.d.ts +3 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
|
10
10
|
import { ConfigLoadError, ErrorCode, MissingContextError, PlatformError, credentialScopesSatisfied, loadConfigFromFile } from "@neon/config/v1";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
12
12
|
import { homedir } from "node:os";
|
|
13
|
-
|
|
13
|
+
// ../../internals/env-core/dist/reuse-secrets.js
|
|
14
14
|
/**
|
|
15
15
|
* Resolve a branch's env while keeping secrets the caller already holds.
|
|
16
16
|
*
|
|
@@ -199,12 +199,10 @@ function halfReusable(named, defaultMeta, requiredScopes) {
|
|
|
199
199
|
if (defaultMeta !== null) return named.tokenId === defaultMeta.tokenId;
|
|
200
200
|
return credentialScopesSatisfied(named.scopes, requiredScopes);
|
|
201
201
|
}
|
|
202
|
-
|
|
203
|
-
//#region ../../internals/cli-core/dist/cli_config.js
|
|
202
|
+
// ../../internals/cli-core/dist/cli_config.js
|
|
204
203
|
const CRED_STORAGE_FILE = "file";
|
|
205
204
|
const CRED_STORAGE_KEYRING = "keyring";
|
|
206
|
-
|
|
207
|
-
//#region ../../internals/cli-core/dist/paths.js
|
|
205
|
+
// ../../internals/cli-core/dist/paths.js
|
|
208
206
|
/**
|
|
209
207
|
* # Where the Neon CLIs keep their files on disk
|
|
210
208
|
*
|
|
@@ -351,8 +349,7 @@ const isOwnedCredentialPath = (configDirectory, file) => {
|
|
|
351
349
|
const legacy = legacyConfigDir();
|
|
352
350
|
return legacy !== void 0 && isInsideConfigDir(legacy, file);
|
|
353
351
|
};
|
|
354
|
-
|
|
355
|
-
//#region ../../internals/cli-core/dist/secure_file.js
|
|
352
|
+
// ../../internals/cli-core/dist/secure_file.js
|
|
356
353
|
/**
|
|
357
354
|
* Write a secret to disk owner-only, by creating a temporary file in the same directory and
|
|
358
355
|
* renaming it over the target.
|
|
@@ -387,8 +384,7 @@ const writeSecretFile = (path, contents) => {
|
|
|
387
384
|
throw err;
|
|
388
385
|
}
|
|
389
386
|
};
|
|
390
|
-
|
|
391
|
-
//#region ../../internals/cli-core/dist/profiles.js
|
|
387
|
+
// ../../internals/cli-core/dist/profiles.js
|
|
392
388
|
/**
|
|
393
389
|
* Pointer-only profiles avoid mirrored credentials and persistent active-profile
|
|
394
390
|
* state while preserving existing single-account and legacy-directory installs.
|
|
@@ -503,8 +499,7 @@ const locationForName = (dir, name) => locationOf(resolveProfile(dir, name));
|
|
|
503
499
|
const resolveEntryPath = (dir, entry) => isAbsolute(entry) ? entry : resolve(profilesDir(dir), entry);
|
|
504
500
|
/** `profiles.json` may sit in the legacy directory, so entries resolve against its own dir. */
|
|
505
501
|
const profilesDir = (dir) => resolve(profilesFilePath(dir), "..");
|
|
506
|
-
|
|
507
|
-
//#region ../../internals/cli-core/dist/auth_selection.js
|
|
502
|
+
// ../../internals/cli-core/dist/auth_selection.js
|
|
508
503
|
const selectCredential = ({ apiKeyFlag, profileFlag, apiKeyEnv, profileEnv }) => {
|
|
509
504
|
const flagKey = nonEmpty$2(apiKeyFlag);
|
|
510
505
|
const flagProfile = nonEmpty$2(profileFlag);
|
|
@@ -538,8 +533,7 @@ function nonEmpty$2(value) {
|
|
|
538
533
|
const trimmed = value.trim();
|
|
539
534
|
return trimmed === "" ? void 0 : trimmed;
|
|
540
535
|
}
|
|
541
|
-
|
|
542
|
-
//#region ../../internals/cli-core/dist/credentials.js
|
|
536
|
+
// ../../internals/cli-core/dist/credentials.js
|
|
543
537
|
/**
|
|
544
538
|
* # Stored credentials — one file per account, two kinds
|
|
545
539
|
*
|
|
@@ -684,8 +678,7 @@ function nonEmpty$1(value) {
|
|
|
684
678
|
const trimmed = value.trim();
|
|
685
679
|
return trimmed === "" ? void 0 : trimmed;
|
|
686
680
|
}
|
|
687
|
-
|
|
688
|
-
//#region ../../internals/cli-core/dist/credential_store.js
|
|
681
|
+
// ../../internals/cli-core/dist/credential_store.js
|
|
689
682
|
const KEYRING_SERVICE = "com.neon.neon-cli";
|
|
690
683
|
/** Hashing the resolved profiles directory isolates config roots while keeping profile names visible. */
|
|
691
684
|
const keyringAccount = (configDir, profile) => `cli:${createHash("sha256").update(dirname(profilesFilePath(configDir))).digest("hex")}:${profile}`;
|
|
@@ -907,8 +900,7 @@ const createCredentialStore = (dir, options = {}) => {
|
|
|
907
900
|
assertKeyringWritable
|
|
908
901
|
};
|
|
909
902
|
};
|
|
910
|
-
|
|
911
|
-
//#region src/lib/cli/keyring.ts
|
|
903
|
+
// src/lib/cli/keyring.ts
|
|
912
904
|
const isPackaged = () => process.pkg !== void 0;
|
|
913
905
|
const isMissingItem = (err) => {
|
|
914
906
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -943,8 +935,7 @@ const tryLoadKeyring = () => {
|
|
|
943
935
|
return null;
|
|
944
936
|
}
|
|
945
937
|
};
|
|
946
|
-
|
|
947
|
-
//#region src/lib/cli/resolve-api-key.ts
|
|
938
|
+
// src/lib/cli/resolve-api-key.ts
|
|
948
939
|
/**
|
|
949
940
|
* Resolve the Neon API key for a `neon-env` CLI invocation.
|
|
950
941
|
*
|
|
@@ -1011,8 +1002,7 @@ function readStoredCredential(selection, env) {
|
|
|
1011
1002
|
if (typeof token === "string" && token.trim() !== "") return token.trim();
|
|
1012
1003
|
throw new Error(`Profile "${profile}" holds a browser sign-in with no usable token at ${credentialLabel(at)}. Sign in again with \`neon login --profile ${profile}\`.`);
|
|
1013
1004
|
}
|
|
1014
|
-
|
|
1015
|
-
//#region src/lib/cli/resolve-context.ts
|
|
1005
|
+
// src/lib/cli/resolve-context.ts
|
|
1016
1006
|
/**
|
|
1017
1007
|
* Resolve `projectId` and `branch` for a CLI invocation. Precedence (each wins over the
|
|
1018
1008
|
* next): explicit flag → `NEON_*` env var → `.neon[/project.json]` walked up from `cwd`.
|
|
@@ -1097,8 +1087,7 @@ function nonEmpty(value) {
|
|
|
1097
1087
|
const trimmed = value.trim();
|
|
1098
1088
|
return trimmed === "" ? void 0 : trimmed;
|
|
1099
1089
|
}
|
|
1100
|
-
|
|
1101
|
-
//#region src/lib/cli/commands.ts
|
|
1090
|
+
// src/lib/cli/commands.ts
|
|
1102
1091
|
/** File `env run` reads to layer one-time auth keys. Matches the Vercel/Next.js convention. */
|
|
1103
1092
|
const DEFAULT_ENV_FILE = ".env.local";
|
|
1104
1093
|
const NEON_CONFIG_FILENAMES = [
|
|
@@ -1336,8 +1325,7 @@ function failure(message, exitCode = 1) {
|
|
|
1336
1325
|
stderr: `${message}\n`
|
|
1337
1326
|
};
|
|
1338
1327
|
}
|
|
1339
|
-
|
|
1340
|
-
//#region src/cli.ts
|
|
1328
|
+
// src/cli.ts
|
|
1341
1329
|
const pkgVersion = readPackageVersion();
|
|
1342
1330
|
const argv = yargs(hideBin(process.argv)).scriptName("neon-env").usage("$0 <command> [options]").parserConfiguration({ "populate--": true }).option("debug", {
|
|
1343
1331
|
type: "boolean",
|
|
@@ -1422,7 +1410,6 @@ function readPackageVersion() {
|
|
|
1422
1410
|
return "0.0.0";
|
|
1423
1411
|
}
|
|
1424
1412
|
}
|
|
1425
|
-
//#endregion
|
|
1426
1413
|
export {};
|
|
1427
1414
|
|
|
1428
1415
|
//# sourceMappingURL=cli.js.map
|