@hubble-ventures/infisicml 1.2.1
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/CHANGELOG.md +103 -0
- package/LICENSE +21 -0
- package/README.md +316 -0
- package/dist/aliases.d.ts +20 -0
- package/dist/aliases.d.ts.map +1 -0
- package/dist/aliases.js +35 -0
- package/dist/aliases.js.map +1 -0
- package/dist/ci-skip.d.ts +27 -0
- package/dist/ci-skip.d.ts.map +1 -0
- package/dist/ci-skip.js +82 -0
- package/dist/ci-skip.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +150 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/export-gha.d.ts +11 -0
- package/dist/commands/export-gha.d.ts.map +1 -0
- package/dist/commands/export-gha.js +79 -0
- package/dist/commands/export-gha.js.map +1 -0
- package/dist/commands/list.d.ts +2 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +35 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/paths.d.ts +8 -0
- package/dist/commands/paths.d.ts.map +1 -0
- package/dist/commands/paths.js +30 -0
- package/dist/commands/paths.js.map +1 -0
- package/dist/commands/pull.d.ts +11 -0
- package/dist/commands/pull.d.ts.map +1 -0
- package/dist/commands/pull.js +65 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/run.d.ts +9 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +30 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/validate.d.ts +2 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +33 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/config.d.ts +58 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +68 -0
- package/dist/config.js.map +1 -0
- package/dist/dotenv.d.ts +6 -0
- package/dist/dotenv.d.ts.map +1 -0
- package/dist/dotenv.js +31 -0
- package/dist/dotenv.js.map +1 -0
- package/dist/env-slug.d.ts +3 -0
- package/dist/env-slug.d.ts.map +1 -0
- package/dist/env-slug.js +7 -0
- package/dist/env-slug.js.map +1 -0
- package/dist/github-env.d.ts +10 -0
- package/dist/github-env.d.ts.map +1 -0
- package/dist/github-env.js +37 -0
- package/dist/github-env.js.map +1 -0
- package/dist/hooks.d.ts +17 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +19 -0
- package/dist/hooks.js.map +1 -0
- package/dist/include.d.ts +46 -0
- package/dist/include.d.ts.map +1 -0
- package/dist/include.js +82 -0
- package/dist/include.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +105 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +153 -0
- package/dist/manifest.js.map +1 -0
- package/dist/optional-keys.d.ts +4 -0
- package/dist/optional-keys.d.ts.map +1 -0
- package/dist/optional-keys.js +11 -0
- package/dist/optional-keys.js.map +1 -0
- package/dist/providers/local.d.ts +38 -0
- package/dist/providers/local.d.ts.map +1 -0
- package/dist/providers/local.js +76 -0
- package/dist/providers/local.js.map +1 -0
- package/dist/providers/remote.d.ts +52 -0
- package/dist/providers/remote.d.ts.map +1 -0
- package/dist/providers/remote.js +166 -0
- package/dist/providers/remote.js.map +1 -0
- package/dist/providers/types.d.ts +14 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +2 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/pull.d.ts +15 -0
- package/dist/pull.d.ts.map +1 -0
- package/dist/pull.js +67 -0
- package/dist/pull.js.map +1 -0
- package/dist/registry.d.ts +14 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +35 -0
- package/dist/registry.js.map +1 -0
- package/package.json +66 -0
- package/schema/secrets.schema.json +105 -0
package/dist/config.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
import { parseDotenv } from "./dotenv.js";
|
|
5
|
+
/** Identity helper for type-safe `infisicml.config.ts` files. */
|
|
6
|
+
export function defineConfig(config) {
|
|
7
|
+
return config;
|
|
8
|
+
}
|
|
9
|
+
const CONFIG_FILENAMES = [
|
|
10
|
+
"infisicml.config.json",
|
|
11
|
+
"infisicml.config.mjs",
|
|
12
|
+
"infisicml.config.js",
|
|
13
|
+
];
|
|
14
|
+
function findConfigFile(startDir) {
|
|
15
|
+
let dir = resolve(startDir);
|
|
16
|
+
while (true) {
|
|
17
|
+
for (const name of CONFIG_FILENAMES) {
|
|
18
|
+
const candidate = join(dir, name);
|
|
19
|
+
if (existsSync(candidate))
|
|
20
|
+
return { dir, file: candidate };
|
|
21
|
+
}
|
|
22
|
+
const parent = resolve(dir, "..");
|
|
23
|
+
if (parent === dir) {
|
|
24
|
+
throw new Error(`Could not find ${CONFIG_FILENAMES[0]} in any parent of ${startDir}`);
|
|
25
|
+
}
|
|
26
|
+
dir = parent;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function readConfigFile(file) {
|
|
30
|
+
if (file.endsWith(".json")) {
|
|
31
|
+
return JSON.parse(readFileSync(file, "utf8"));
|
|
32
|
+
}
|
|
33
|
+
const mod = (await import(pathToFileURL(file).href));
|
|
34
|
+
if (!mod.default) {
|
|
35
|
+
throw new Error(`${file} must export a default InfisicmlConfig`);
|
|
36
|
+
}
|
|
37
|
+
return mod.default;
|
|
38
|
+
}
|
|
39
|
+
function resolveProjectId(repoRoot, config) {
|
|
40
|
+
if (config.projectId)
|
|
41
|
+
return config.projectId;
|
|
42
|
+
if (process.env.INFISICAL_PROJECT_ID)
|
|
43
|
+
return process.env.INFISICAL_PROJECT_ID;
|
|
44
|
+
if (config.projectIdEnvFile) {
|
|
45
|
+
const envPath = join(repoRoot, config.projectIdEnvFile);
|
|
46
|
+
if (existsSync(envPath)) {
|
|
47
|
+
const parsed = parseDotenv(readFileSync(envPath, "utf8"));
|
|
48
|
+
if (parsed.INFISICAL_PROJECT_ID)
|
|
49
|
+
return parsed.INFISICAL_PROJECT_ID;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
throw new Error("INFISICAL_PROJECT_ID not resolved — set config.projectId, projectIdEnvFile, or the INFISICAL_PROJECT_ID env var");
|
|
53
|
+
}
|
|
54
|
+
export async function loadConfig(cwd = process.cwd()) {
|
|
55
|
+
const { dir, file } = findConfigFile(cwd);
|
|
56
|
+
const config = await readConfigFile(file);
|
|
57
|
+
// Project id is only needed by the local (CLI) provider; resolve lazily-ish
|
|
58
|
+
// but tolerate its absence in remote/CI flows that pass a project slug.
|
|
59
|
+
let projectId = "";
|
|
60
|
+
try {
|
|
61
|
+
projectId = resolveProjectId(dir, config);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
projectId = "";
|
|
65
|
+
}
|
|
66
|
+
return { ...config, repoRoot: dir, projectId };
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAyD1C,iEAAiE;AACjE,MAAM,UAAU,YAAY,CAAC,MAAuB;IAClD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,gBAAgB,GAAG;IACvB,uBAAuB;IACvB,sBAAsB;IACtB,qBAAqB;CACtB,CAAC;AAEF,SAAS,cAAc,CAAC,QAAgB;IACtC,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E,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CASpE"}
|
package/dist/dotenv.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse and serialize dotenv-format secret files.
|
|
3
|
+
*/
|
|
4
|
+
export function parseDotenv(text) {
|
|
5
|
+
const out = {};
|
|
6
|
+
for (const line of text.split("\n")) {
|
|
7
|
+
const trimmed = line.trim();
|
|
8
|
+
if (!trimmed || trimmed.startsWith("#"))
|
|
9
|
+
continue;
|
|
10
|
+
const eq = trimmed.indexOf("=");
|
|
11
|
+
if (eq === -1)
|
|
12
|
+
continue;
|
|
13
|
+
const key = trimmed.slice(0, eq).trim();
|
|
14
|
+
let value = trimmed.slice(eq + 1).trim();
|
|
15
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
16
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
17
|
+
value = value.slice(1, -1);
|
|
18
|
+
}
|
|
19
|
+
out[key] = value;
|
|
20
|
+
}
|
|
21
|
+
return out;
|
|
22
|
+
}
|
|
23
|
+
export function serializeDotenv(vars) {
|
|
24
|
+
const lines = [];
|
|
25
|
+
for (const [key, value] of Object.entries(vars).sort(([a], [b]) => a.localeCompare(b))) {
|
|
26
|
+
const needsQuotes = /[\s"'$`#\\]/.test(value);
|
|
27
|
+
lines.push(`${key}=${needsQuotes ? JSON.stringify(value) : value}`);
|
|
28
|
+
}
|
|
29
|
+
return `${lines.join("\n")}\n`;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=dotenv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dotenv.js","sourceRoot":"","sources":["../src/dotenv.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,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AAC,IAAI,CAAC,GAAG,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-slug.d.ts","sourceRoot":"","sources":["../src/env-slug.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGpD"}
|
package/dist/env-slug.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-slug.js","sourceRoot":"","sources":["../src/env-slug.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,YAAY,CAAC;IACxC,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function appendSecretToGithubEnv(githubEnvPath: string, key: string, value: string): void;
|
|
2
|
+
export declare function appendSecretsToGithubEnv(githubEnvPath: string, secrets: Record<string, string>): void;
|
|
3
|
+
/**
|
|
4
|
+
* Append a NON-secret env var (no `::add-mask::`) to GITHUB_ENV. Use for
|
|
5
|
+
* metadata like a comma-separated list of secret key names — the names are not
|
|
6
|
+
* sensitive, and masking them would garble unrelated log output. The value must
|
|
7
|
+
* be a single line (secret key names always are).
|
|
8
|
+
*/
|
|
9
|
+
export declare function appendPlainToGithubEnv(githubEnvPath: string, key: string, value: string): void;
|
|
10
|
+
//# sourceMappingURL=github-env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-env.d.ts","sourceRoot":"","sources":["../src/github-env.ts"],"names":[],"mappings":"AAEA,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,IAAI,CAgBN;AAED,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,IAAI,CAIN;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,IAAI,CAMN"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { appendFileSync } from "node:fs";
|
|
2
|
+
export function appendSecretToGithubEnv(githubEnvPath, key, value) {
|
|
3
|
+
if (!key)
|
|
4
|
+
return;
|
|
5
|
+
// Workflow commands must go to stdout — not GITHUB_ENV (see actions/toolkit#1338).
|
|
6
|
+
for (const line of value.split("\n")) {
|
|
7
|
+
if (!line)
|
|
8
|
+
continue;
|
|
9
|
+
const masked = line.replaceAll("%", "%25");
|
|
10
|
+
process.stdout.write(`::add-mask::${masked}\n`);
|
|
11
|
+
}
|
|
12
|
+
let delim = `INFISCML_${key}_${Date.now()}${process.hrtime.bigint()}`;
|
|
13
|
+
while (value.includes(delim)) {
|
|
14
|
+
delim = `${delim}_`;
|
|
15
|
+
}
|
|
16
|
+
appendFileSync(githubEnvPath, `${key}<<${delim}\n${value}\n${delim}\n`);
|
|
17
|
+
}
|
|
18
|
+
export function appendSecretsToGithubEnv(githubEnvPath, secrets) {
|
|
19
|
+
for (const [key, value] of Object.entries(secrets)) {
|
|
20
|
+
appendSecretToGithubEnv(githubEnvPath, key, value);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Append a NON-secret env var (no `::add-mask::`) to GITHUB_ENV. Use for
|
|
25
|
+
* metadata like a comma-separated list of secret key names — the names are not
|
|
26
|
+
* sensitive, and masking them would garble unrelated log output. The value must
|
|
27
|
+
* be a single line (secret key names always are).
|
|
28
|
+
*/
|
|
29
|
+
export function appendPlainToGithubEnv(githubEnvPath, key, value) {
|
|
30
|
+
if (!key)
|
|
31
|
+
return;
|
|
32
|
+
if (value.includes("\n")) {
|
|
33
|
+
throw new Error(`Plain GITHUB_ENV value for ${key} must be single-line`);
|
|
34
|
+
}
|
|
35
|
+
appendFileSync(githubEnvPath, `${key}=${value}\n`);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=github-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-env.js","sourceRoot":"","sources":["../src/github-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,UAAU,uBAAuB,CACrC,aAAqB,EACrB,GAAW,EACX,KAAa;IAEb,IAAI,CAAC,GAAG;QAAE,OAAO;IAEjB,mFAAmF;IACnF,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC,IAAI;YAAE,SAAS;QACpB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,MAAM,IAAI,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,KAAK,GAAG,YAAY,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;IACtE,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,KAAK,GAAG,GAAG,KAAK,GAAG,CAAC;IACtB,CAAC;IAED,cAAc,CAAC,aAAa,EAAE,GAAG,GAAG,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,aAAqB,EACrB,OAA+B;IAE/B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,uBAAuB,CAAC,aAAa,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,aAAqB,EACrB,GAAW,EACX,KAAa;IAEb,IAAI,CAAC,GAAG;QAAE,OAAO;IACjB,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,8BAA8B,GAAG,sBAAsB,CAAC,CAAC;IAC3E,CAAC;IACD,cAAc,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC;AACrD,CAAC"}
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AdvertiseKeysHook } from "./config.js";
|
|
2
|
+
export type AdvertiseInput = {
|
|
3
|
+
/** Canonical key names from the manifest's base (runtime) paths. */
|
|
4
|
+
runtimeKeys: string[];
|
|
5
|
+
/** Canonical key names across all resolved (profile) paths. */
|
|
6
|
+
allKeys: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function keysForScope(hook: AdvertiseKeysHook, input: AdvertiseInput): string[];
|
|
9
|
+
/**
|
|
10
|
+
* Write each configured `advertiseKeys` hook's key list to GITHUB_ENV as a
|
|
11
|
+
* plain (unmasked, non-secret) comma-separated var. Key NAMES only — values are
|
|
12
|
+
* never advertised. A deploy step forwards exactly these keys by value from the
|
|
13
|
+
* job env, so `secrets.json` stays the single source of truth for what lands on
|
|
14
|
+
* the app (no hand-maintained allowlist in the workflow).
|
|
15
|
+
*/
|
|
16
|
+
export declare function runAdvertiseKeysHooks(githubEnvPath: string, hooks: AdvertiseKeysHook[] | undefined, input: AdvertiseInput): void;
|
|
17
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,cAAc,GAAG;IAC3B,oEAAoE;IACpE,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,+DAA+D;IAC/D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,wBAAgB,YAAY,CAC1B,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,cAAc,GACpB,MAAM,EAAE,CAGV;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,iBAAiB,EAAE,GAAG,SAAS,EACtC,KAAK,EAAE,cAAc,GACpB,IAAI,CAKN"}
|
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { appendPlainToGithubEnv } from "./github-env.js";
|
|
2
|
+
export function keysForScope(hook, input) {
|
|
3
|
+
const keys = hook.scope === "all" ? input.allKeys : input.runtimeKeys;
|
|
4
|
+
return [...keys].sort();
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Write each configured `advertiseKeys` hook's key list to GITHUB_ENV as a
|
|
8
|
+
* plain (unmasked, non-secret) comma-separated var. Key NAMES only — values are
|
|
9
|
+
* never advertised. A deploy step forwards exactly these keys by value from the
|
|
10
|
+
* job env, so `secrets.json` stays the single source of truth for what lands on
|
|
11
|
+
* the app (no hand-maintained allowlist in the workflow).
|
|
12
|
+
*/
|
|
13
|
+
export function runAdvertiseKeysHooks(githubEnvPath, hooks, input) {
|
|
14
|
+
for (const hook of hooks ?? []) {
|
|
15
|
+
const keys = keysForScope(hook, input);
|
|
16
|
+
appendPlainToGithubEnv(githubEnvPath, hook.envVar, keys.join(","));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AASzD,MAAM,UAAU,YAAY,CAC1B,IAAuB,EACvB,KAAqB;IAErB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;IACtE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,aAAqB,EACrB,KAAsC,EACtC,KAAqB;IAErB,KAAK,MAAM,IAAI,IAAI,KAAK,IAAI,EAAE,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACvC,sBAAsB,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACrE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { SecretsManifest } from "./manifest.js";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the canonical vault keys to request in `fetch: "keys"` mode.
|
|
4
|
+
*
|
|
5
|
+
* `include` names the *final* (post-{@link applyAliases}) keys, but the vault is
|
|
6
|
+
* keyed by canonical names. For each `include` entry we request the name itself
|
|
7
|
+
* (it may be a real vault key) plus any alias *source* whose target is that name
|
|
8
|
+
* (so the source value exists to materialize the target). Phantom entries — an
|
|
9
|
+
* alias target that isn't a real vault key — simply miss on fetch, which is
|
|
10
|
+
* harmless: the post-fetch {@link selectEmittedSecrets} still validates the
|
|
11
|
+
* emitted set against `include`, so a genuinely-missing key fails there exactly
|
|
12
|
+
* as in folder mode.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveFetchKeys(include: string[], manifest: SecretsManifest): string[];
|
|
15
|
+
export type IncludeResult = {
|
|
16
|
+
/** The emitted map after allowlist filtering. */
|
|
17
|
+
filtered: Record<string, string>;
|
|
18
|
+
/** `include` names that no folder produced (absent from the input map). */
|
|
19
|
+
unknown: string[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Filter a materialized secret map down to the `include` allowlist.
|
|
23
|
+
*
|
|
24
|
+
* Runs *after* {@link applyAliases}, so it filters the final set of names: an
|
|
25
|
+
* alias whose source isn't listed still emits its target, and a canonical key
|
|
26
|
+
* not listed is dropped even when its alias target is kept.
|
|
27
|
+
*
|
|
28
|
+
* When `include` is `undefined` this is a pass-through (emit all keys) — the
|
|
29
|
+
* backward-compatible default. Returns a new object; the input is not mutated.
|
|
30
|
+
*/
|
|
31
|
+
export declare function applyInclude(merged: Record<string, string>, include: string[] | undefined): IncludeResult;
|
|
32
|
+
/**
|
|
33
|
+
* An `include` name that no folder produced is treated like a missing required
|
|
34
|
+
* key: fail, unless it's listed in the environment's `optionalKeys`, in which
|
|
35
|
+
* case it's downgraded to a `::notice::`. Enforced identically in `pull` and
|
|
36
|
+
* `export-gha` so the two surfaces stay consistent.
|
|
37
|
+
*/
|
|
38
|
+
export declare function enforceIncludeKnown(unknown: string[], optionalKeys: string[]): void;
|
|
39
|
+
/**
|
|
40
|
+
* Shared allowlist step for both emit surfaces: filter the aliased map to the
|
|
41
|
+
* (already-resolved) `include` and enforce the unknown-key policy. Callers
|
|
42
|
+
* resolve `include` once — with {@link resolveInclude} — so the value they use
|
|
43
|
+
* for headers/logging is the same one that governs the filter.
|
|
44
|
+
*/
|
|
45
|
+
export declare function selectEmittedSecrets(aliased: Record<string, string>, include: string[] | undefined, optionalKeys: string[]): Record<string, string>;
|
|
46
|
+
//# sourceMappingURL=include.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EAAE,EACjB,QAAQ,EAAE,eAAe,GACxB,MAAM,EAAE,CAUV;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,2EAA2E;IAC3E,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,GAC5B,aAAa,CAWf;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EAAE,EACjB,YAAY,EAAE,MAAM,EAAE,GACrB,IAAI,CAkBN;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,EAC7B,YAAY,EAAE,MAAM,EAAE,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIxB"}
|
package/dist/include.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { resolveAliases } from "./aliases.js";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the canonical vault keys to request in `fetch: "keys"` mode.
|
|
4
|
+
*
|
|
5
|
+
* `include` names the *final* (post-{@link applyAliases}) keys, but the vault is
|
|
6
|
+
* keyed by canonical names. For each `include` entry we request the name itself
|
|
7
|
+
* (it may be a real vault key) plus any alias *source* whose target is that name
|
|
8
|
+
* (so the source value exists to materialize the target). Phantom entries — an
|
|
9
|
+
* alias target that isn't a real vault key — simply miss on fetch, which is
|
|
10
|
+
* harmless: the post-fetch {@link selectEmittedSecrets} still validates the
|
|
11
|
+
* emitted set against `include`, so a genuinely-missing key fails there exactly
|
|
12
|
+
* as in folder mode.
|
|
13
|
+
*/
|
|
14
|
+
export function resolveFetchKeys(include, manifest) {
|
|
15
|
+
const aliases = resolveAliases(manifest);
|
|
16
|
+
const keys = new Set();
|
|
17
|
+
for (const name of include) {
|
|
18
|
+
keys.add(name);
|
|
19
|
+
for (const { source, targets } of aliases) {
|
|
20
|
+
if (targets.includes(name))
|
|
21
|
+
keys.add(source);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return [...keys];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Filter a materialized secret map down to the `include` allowlist.
|
|
28
|
+
*
|
|
29
|
+
* Runs *after* {@link applyAliases}, so it filters the final set of names: an
|
|
30
|
+
* alias whose source isn't listed still emits its target, and a canonical key
|
|
31
|
+
* not listed is dropped even when its alias target is kept.
|
|
32
|
+
*
|
|
33
|
+
* When `include` is `undefined` this is a pass-through (emit all keys) — the
|
|
34
|
+
* backward-compatible default. Returns a new object; the input is not mutated.
|
|
35
|
+
*/
|
|
36
|
+
export function applyInclude(merged, include) {
|
|
37
|
+
if (include === undefined) {
|
|
38
|
+
return { filtered: { ...merged }, unknown: [] };
|
|
39
|
+
}
|
|
40
|
+
const allow = new Set(include);
|
|
41
|
+
const filtered = {};
|
|
42
|
+
for (const [key, value] of Object.entries(merged)) {
|
|
43
|
+
if (allow.has(key))
|
|
44
|
+
filtered[key] = value;
|
|
45
|
+
}
|
|
46
|
+
const unknown = include.filter((name) => !(name in merged));
|
|
47
|
+
return { filtered, unknown };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* An `include` name that no folder produced is treated like a missing required
|
|
51
|
+
* key: fail, unless it's listed in the environment's `optionalKeys`, in which
|
|
52
|
+
* case it's downgraded to a `::notice::`. Enforced identically in `pull` and
|
|
53
|
+
* `export-gha` so the two surfaces stay consistent.
|
|
54
|
+
*/
|
|
55
|
+
export function enforceIncludeKnown(unknown, optionalKeys) {
|
|
56
|
+
const optional = new Set(optionalKeys);
|
|
57
|
+
const missing = [];
|
|
58
|
+
for (const name of unknown) {
|
|
59
|
+
if (optional.has(name)) {
|
|
60
|
+
console.log(`::notice::include key ${name} not produced by any folder (optional for this environment)`);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
missing.push(name);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (missing.length > 0) {
|
|
67
|
+
throw new Error(`include lists key(s) not produced by any pulled folder: ${missing.join(", ")}. ` +
|
|
68
|
+
"Fix the name, add the folder, or list the key in environments.<slug>.optionalKeys to allow absence.");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Shared allowlist step for both emit surfaces: filter the aliased map to the
|
|
73
|
+
* (already-resolved) `include` and enforce the unknown-key policy. Callers
|
|
74
|
+
* resolve `include` once — with {@link resolveInclude} — so the value they use
|
|
75
|
+
* for headers/logging is the same one that governs the filter.
|
|
76
|
+
*/
|
|
77
|
+
export function selectEmittedSecrets(aliased, include, optionalKeys) {
|
|
78
|
+
const { filtered, unknown } = applyInclude(aliased, include);
|
|
79
|
+
enforceIncludeKnown(unknown, optionalKeys);
|
|
80
|
+
return filtered;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=include.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"include.js","sourceRoot":"","sources":["../src/include.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAiB,EACjB,QAAyB;IAEzB,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;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;IAC7B,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CACT,yBAAyB,IAAI,6DAA6D,CAC3F,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,2DAA2D,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAC/E,qGAAqG,CACxG,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAA+B,EAC/B,OAA6B,EAC7B,YAAsB;IAEtB,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC3C,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { applyAliases, type ResolvedAlias, resolveAliases, } from "./aliases.js";
|
|
2
|
+
export { fetchSecretsForPaths, isCi, keysForCiStub, mergeFolderSecrets, shouldSkipInfisicalPull, } from "./ci-skip.js";
|
|
3
|
+
export { type AdvertiseKeysHook, defineConfig, type DiscoveryConfig, type InfisicmlConfig, loadConfig, type ResolvedConfig, } from "./config.js";
|
|
4
|
+
export { parseDotenv, serializeDotenv } from "./dotenv.js";
|
|
5
|
+
export { normalizeEnvSlug } from "./env-slug.js";
|
|
6
|
+
export { appendPlainToGithubEnv, appendSecretsToGithubEnv, appendSecretToGithubEnv, } from "./github-env.js";
|
|
7
|
+
export { type AdvertiseInput, keysForScope, runAdvertiseKeysHooks, } from "./hooks.js";
|
|
8
|
+
export { applyInclude, enforceIncludeKnown, type IncludeResult, selectEmittedSecrets, } from "./include.js";
|
|
9
|
+
export { loadManifestJson, normalizeFolderPath, resolveInclude, resolvePaths, resolveSecretsOutputPath, type SecretsManifest, secretsManifestSchema, } from "./manifest.js";
|
|
10
|
+
export { logMissingOptionalKeys, resolveOptionalKeys, } from "./optional-keys.js";
|
|
11
|
+
export { commandExists, LocalProvider } from "./providers/local.js";
|
|
12
|
+
export { RemoteProvider } from "./providers/remote.js";
|
|
13
|
+
export type { SecretsProvider } from "./providers/types.js";
|
|
14
|
+
export { type PullResult, pullManifest, writeInjectedSecretsStub, } from "./pull.js";
|
|
15
|
+
export { discoverManifests, type PackageManifest } from "./registry.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,aAAa,EAClB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oBAAoB,EACpB,IAAI,EACJ,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,iBAAiB,EACtB,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,UAAU,EACV,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,cAAc,EACnB,YAAY,EACZ,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,KAAK,aAAa,EAClB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,wBAAwB,EACxB,KAAK,eAAe,EACpB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACL,KAAK,UAAU,EACf,YAAY,EACZ,wBAAwB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { applyAliases, resolveAliases, } from "./aliases.js";
|
|
2
|
+
export { fetchSecretsForPaths, isCi, keysForCiStub, mergeFolderSecrets, shouldSkipInfisicalPull, } from "./ci-skip.js";
|
|
3
|
+
export { defineConfig, loadConfig, } from "./config.js";
|
|
4
|
+
export { parseDotenv, serializeDotenv } from "./dotenv.js";
|
|
5
|
+
export { normalizeEnvSlug } from "./env-slug.js";
|
|
6
|
+
export { appendPlainToGithubEnv, appendSecretsToGithubEnv, appendSecretToGithubEnv, } from "./github-env.js";
|
|
7
|
+
export { keysForScope, runAdvertiseKeysHooks, } from "./hooks.js";
|
|
8
|
+
export { applyInclude, enforceIncludeKnown, selectEmittedSecrets, } from "./include.js";
|
|
9
|
+
export { loadManifestJson, normalizeFolderPath, resolveInclude, resolvePaths, resolveSecretsOutputPath, secretsManifestSchema, } from "./manifest.js";
|
|
10
|
+
export { logMissingOptionalKeys, resolveOptionalKeys, } from "./optional-keys.js";
|
|
11
|
+
export { commandExists, LocalProvider } from "./providers/local.js";
|
|
12
|
+
export { RemoteProvider } from "./providers/remote.js";
|
|
13
|
+
export { pullManifest, writeInjectedSecretsStub, } from "./pull.js";
|
|
14
|
+
export { discoverManifests } from "./registry.js";
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oBAAoB,EACpB,IAAI,EACJ,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,YAAY,EAGZ,UAAU,GAEX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,YAAY,EACZ,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,YAAY,EACZ,mBAAmB,EAEnB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,wBAAwB,EAExB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAEL,YAAY,EACZ,wBAAwB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAwB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const secretsManifestSchema: z.ZodObject<{
|
|
3
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
4
|
+
paths: z.ZodArray<z.ZodString, "many">;
|
|
5
|
+
profiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
6
|
+
paths: z.ZodArray<z.ZodString, "many">;
|
|
7
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
8
|
+
fetch: z.ZodOptional<z.ZodEnum<["folder", "keys"]>>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
paths: string[];
|
|
11
|
+
include?: string[] | undefined;
|
|
12
|
+
fetch?: "keys" | "folder" | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
paths: string[];
|
|
15
|
+
include?: string[] | undefined;
|
|
16
|
+
fetch?: "keys" | "folder" | undefined;
|
|
17
|
+
}>>>;
|
|
18
|
+
ci: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
skipWhenEnv: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
20
|
+
stubInCi: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
skipWhenEnv?: string[] | undefined;
|
|
23
|
+
stubInCi?: boolean | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
skipWhenEnv?: string[] | undefined;
|
|
26
|
+
stubInCi?: boolean | undefined;
|
|
27
|
+
}>>;
|
|
28
|
+
output: z.ZodOptional<z.ZodString>;
|
|
29
|
+
aliases: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
|
|
30
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
31
|
+
fetch: z.ZodOptional<z.ZodEnum<["folder", "keys"]>>;
|
|
32
|
+
environments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
33
|
+
optionalKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
optionalKeys?: string[] | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
optionalKeys?: string[] | undefined;
|
|
38
|
+
}>>>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
paths: string[];
|
|
41
|
+
$schema?: string | undefined;
|
|
42
|
+
include?: string[] | undefined;
|
|
43
|
+
fetch?: "keys" | "folder" | undefined;
|
|
44
|
+
profiles?: Record<string, {
|
|
45
|
+
paths: string[];
|
|
46
|
+
include?: string[] | undefined;
|
|
47
|
+
fetch?: "keys" | "folder" | undefined;
|
|
48
|
+
}> | undefined;
|
|
49
|
+
ci?: {
|
|
50
|
+
skipWhenEnv?: string[] | undefined;
|
|
51
|
+
stubInCi?: boolean | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
output?: string | undefined;
|
|
54
|
+
aliases?: Record<string, string | string[]> | undefined;
|
|
55
|
+
environments?: Record<string, {
|
|
56
|
+
optionalKeys?: string[] | undefined;
|
|
57
|
+
}> | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
paths: string[];
|
|
60
|
+
$schema?: string | undefined;
|
|
61
|
+
include?: string[] | undefined;
|
|
62
|
+
fetch?: "keys" | "folder" | undefined;
|
|
63
|
+
profiles?: Record<string, {
|
|
64
|
+
paths: string[];
|
|
65
|
+
include?: string[] | undefined;
|
|
66
|
+
fetch?: "keys" | "folder" | undefined;
|
|
67
|
+
}> | undefined;
|
|
68
|
+
ci?: {
|
|
69
|
+
skipWhenEnv?: string[] | undefined;
|
|
70
|
+
stubInCi?: boolean | undefined;
|
|
71
|
+
} | undefined;
|
|
72
|
+
output?: string | undefined;
|
|
73
|
+
aliases?: Record<string, string | string[]> | undefined;
|
|
74
|
+
environments?: Record<string, {
|
|
75
|
+
optionalKeys?: string[] | undefined;
|
|
76
|
+
}> | undefined;
|
|
77
|
+
}>;
|
|
78
|
+
export type SecretsManifest = z.infer<typeof secretsManifestSchema>;
|
|
79
|
+
export declare function loadManifestJson(raw: unknown): SecretsManifest;
|
|
80
|
+
/** Profile paths replace default paths when a profile is set. */
|
|
81
|
+
export declare function resolvePaths(manifest: SecretsManifest, profile?: string): string[];
|
|
82
|
+
/**
|
|
83
|
+
* Resolve the effective key allowlist. A profile's `include` replaces the root
|
|
84
|
+
* `include` when the profile defines it; otherwise the root `include` applies.
|
|
85
|
+
* Returns `undefined` when no allowlist is in effect (emit all keys).
|
|
86
|
+
*/
|
|
87
|
+
export declare function resolveInclude(manifest: SecretsManifest, profile?: string): string[] | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Resolve the effective fetch mode. A profile's `fetch` replaces the root
|
|
90
|
+
* `fetch` when the profile defines it; otherwise the root `fetch` applies.
|
|
91
|
+
* Defaults to `"folder"` (whole-folder read + local filter) when unset.
|
|
92
|
+
*/
|
|
93
|
+
export declare function resolveFetchMode(manifest: SecretsManifest, profile?: string): "folder" | "keys";
|
|
94
|
+
/**
|
|
95
|
+
* Cross-field rule: `fetch: "keys"` requires an `include` allowlist, because
|
|
96
|
+
* key mode fetches exactly the keys `include` names. The check spans the root
|
|
97
|
+
* and every profile (a profile's `fetch`/`include` each replace the root's), so
|
|
98
|
+
* every runnable combination is covered. Returns human-readable issue strings
|
|
99
|
+
* (empty when consistent) for `validate` to surface. Zod can't express this —
|
|
100
|
+
* the requirement depends on the resolved profile.
|
|
101
|
+
*/
|
|
102
|
+
export declare function checkFetchIncludeConsistency(manifest: SecretsManifest): string[];
|
|
103
|
+
export declare function normalizeFolderPath(folder: string): string;
|
|
104
|
+
export declare function resolveSecretsOutputPath(manifestDir: string, outputName: string): string;
|
|
105
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAE9D;AAED,iEAAiE;AACjE,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,EAAE,CASV;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,EAAE,GAAG,SAAS,CAMtB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,MAAM,GACf,QAAQ,GAAG,MAAM,CAMnB;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,eAAe,GACxB,MAAM,EAAE,CAeV;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,MAAM,CAiBR"}
|