@kitsy/cnos 1.1.1 → 1.2.0
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/README.md +4 -1
- package/dist/browser/index.cjs +94 -0
- package/dist/browser/index.d.cts +16 -0
- package/dist/browser/index.d.ts +16 -0
- package/dist/browser/index.js +67 -0
- package/dist/build/index.cjs +2100 -0
- package/dist/build/index.d.cts +5 -0
- package/dist/build/index.d.ts +5 -0
- package/dist/build/index.js +14 -0
- package/dist/{chunk-JPJ3S3CO.js → chunk-APCTXRUN.js} +620 -426
- package/dist/{chunk-PBU5NAX4.js → chunk-EIN55XXA.js} +1 -1
- package/dist/chunk-JUHPBAEH.js +20 -0
- package/dist/{chunk-L3HOQHCH.js → chunk-MLQGYCO7.js} +1 -1
- package/dist/chunk-PQ4KSV76.js +50 -0
- package/dist/{chunk-7GNXYEO6.js → chunk-RD5WMHPM.js} +1 -1
- package/dist/chunk-SO5XREEU.js +179 -0
- package/dist/{chunk-QKJ6QLRS.js → chunk-SXTMTACL.js} +2 -2
- package/dist/{chunk-X4GOXEKX.js → chunk-WHUGFPE4.js} +1 -1
- package/dist/{chunk-M4S6PYM5.js → chunk-ZA74BO47.js} +1 -1
- package/dist/{envNaming-BrOk5ndZ.d.cts → envNaming-BTJpH93W.d.cts} +1 -1
- package/dist/{envNaming-DCaNdnrF.d.ts → envNaming-CcsqAel3.d.ts} +1 -1
- package/dist/index.cjs +294 -133
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +14 -132
- package/dist/internal.cjs +479 -61
- package/dist/internal.d.cts +29 -3
- package/dist/internal.d.ts +29 -3
- package/dist/internal.js +27 -1
- package/dist/plugin/basic-schema.cjs +3 -3
- package/dist/plugin/basic-schema.d.cts +1 -1
- package/dist/plugin/basic-schema.d.ts +1 -1
- package/dist/plugin/basic-schema.js +2 -2
- package/dist/plugin/cli-args.cjs +3 -3
- package/dist/plugin/cli-args.d.cts +1 -1
- package/dist/plugin/cli-args.d.ts +1 -1
- package/dist/plugin/cli-args.js +2 -2
- package/dist/plugin/dotenv.cjs +9 -9
- package/dist/plugin/dotenv.d.cts +2 -2
- package/dist/plugin/dotenv.d.ts +2 -2
- package/dist/plugin/dotenv.js +2 -2
- package/dist/plugin/env-export.cjs +46 -64
- package/dist/plugin/env-export.d.cts +2 -2
- package/dist/plugin/env-export.d.ts +2 -2
- package/dist/plugin/env-export.js +2 -2
- package/dist/plugin/filesystem.cjs +10 -10
- package/dist/plugin/filesystem.d.cts +1 -1
- package/dist/plugin/filesystem.d.ts +1 -1
- package/dist/plugin/filesystem.js +2 -2
- package/dist/plugin/process-env.cjs +9 -9
- package/dist/plugin/process-env.d.cts +2 -2
- package/dist/plugin/process-env.d.ts +2 -2
- package/dist/plugin/process-env.js +2 -2
- package/dist/{plugin-BVNEHj19.d.cts → plugin-DkOIT5uI.d.cts} +30 -2
- package/dist/{plugin-BVNEHj19.d.ts → plugin-DkOIT5uI.d.ts} +30 -2
- package/dist/runtime/index.cjs +2288 -0
- package/dist/runtime/index.d.cts +23 -0
- package/dist/runtime/index.d.ts +23 -0
- package/dist/runtime/index.js +190 -0
- package/dist/{toPublicEnv-Gwz3xTK0.d.ts → toPublicEnv-C9clvXLo.d.ts} +1 -1
- package/dist/{toPublicEnv-Dd152fFy.d.cts → toPublicEnv-DvFeV3qG.d.cts} +1 -1
- package/package.json +16 -1
package/dist/internal.d.cts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import { d as CnosRuntime,
|
|
2
|
-
export {
|
|
1
|
+
import { i as LoadManifestOptions, j as LoadedManifest, N as NormalizedManifest, g as LogicalKey, V as VaultDefinition, d as CnosRuntime, k as ValidationSummary, R as ResolvedGraph } from './plugin-DkOIT5uI.cjs';
|
|
2
|
+
export { l as ValidationIssue, W as WorkspaceFile } from './plugin-DkOIT5uI.cjs';
|
|
3
|
+
|
|
4
|
+
declare class CnosError extends Error {
|
|
5
|
+
constructor(message: string);
|
|
6
|
+
}
|
|
7
|
+
declare class CnosSecurityError extends CnosError {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare function loadManifest(options?: LoadManifestOptions): Promise<LoadedManifest>;
|
|
12
|
+
|
|
13
|
+
type ProjectionTarget = 'public' | 'env';
|
|
14
|
+
declare function ensureProjectionAllowed(manifest: NormalizedManifest, key: LogicalKey, target: ProjectionTarget): void;
|
|
3
15
|
|
|
4
16
|
declare function flattenObject(value: Record<string, unknown>, prefix?: string): Record<string, unknown>;
|
|
5
17
|
|
|
18
|
+
declare function resolveManifestRoot(root?: string): Promise<string>;
|
|
6
19
|
declare function resolveConfigDocumentPath(workspaceRoot: string, namespace: 'value' | 'secret', configPath: string, profile?: string): string;
|
|
7
20
|
|
|
8
21
|
interface SecretReference {
|
|
@@ -10,9 +23,17 @@ interface SecretReference {
|
|
|
10
23
|
ref: string;
|
|
11
24
|
vault?: string;
|
|
12
25
|
}
|
|
26
|
+
interface ResolvedVaultDefinition extends VaultDefinition {
|
|
27
|
+
name: string;
|
|
28
|
+
requiresPassphrase: boolean;
|
|
29
|
+
}
|
|
13
30
|
declare function resolveSecretStoreRoot(processEnv?: Record<string, string | undefined>): string;
|
|
14
31
|
declare function resolveSecretVaultFile(storeRoot: string, vault?: string): string;
|
|
15
32
|
declare function resolveSecretPassphrase(vault?: string, processEnv?: Record<string, string | undefined>): string | undefined;
|
|
33
|
+
declare function getVaultPassphraseEnvVar(vault?: string): string;
|
|
34
|
+
declare function isPassphraseEnvRef(value: string | undefined): boolean;
|
|
35
|
+
declare function resolveConfiguredVaultPassphrase(definition: VaultDefinition | undefined, vault?: string, processEnv?: Record<string, string | undefined>): string | undefined;
|
|
36
|
+
declare function resolveVaultDefinition(vaults: Record<string, VaultDefinition> | undefined, vault?: string): ResolvedVaultDefinition;
|
|
16
37
|
declare function createSecretVault(storeRoot: string, vault: string, passphrase: string): Promise<string>;
|
|
17
38
|
declare function listSecretVaults(storeRoot: string): Promise<string[]>;
|
|
18
39
|
declare function writeLocalSecret(storeRoot: string, ref: string, value: string, passphrase: string, vault?: string): Promise<string>;
|
|
@@ -22,4 +43,9 @@ declare function stringifyYaml(value: unknown): string;
|
|
|
22
43
|
|
|
23
44
|
declare function validateRuntime(runtime: CnosRuntime): Promise<ValidationSummary>;
|
|
24
45
|
|
|
25
|
-
|
|
46
|
+
declare const CNOS_GRAPH_ENV_VAR = "__CNOS_GRAPH__";
|
|
47
|
+
declare function serializeRuntimeGraph(graph: ResolvedGraph): string;
|
|
48
|
+
declare function deserializeRuntimeGraph(source: string): ResolvedGraph;
|
|
49
|
+
declare function readRuntimeGraphFromEnv(processEnv?: Record<string, string | undefined>): ResolvedGraph | undefined;
|
|
50
|
+
|
|
51
|
+
export { CNOS_GRAPH_ENV_VAR, CnosSecurityError, type ResolvedVaultDefinition, type SecretReference, ValidationSummary, VaultDefinition, createSecretVault, deserializeRuntimeGraph, ensureProjectionAllowed, flattenObject, getVaultPassphraseEnvVar, isPassphraseEnvRef, listSecretVaults, loadManifest, parseYaml, readRuntimeGraphFromEnv, resolveConfigDocumentPath, resolveConfiguredVaultPassphrase, resolveManifestRoot, resolveSecretPassphrase, resolveSecretStoreRoot, resolveSecretVaultFile, resolveVaultDefinition, serializeRuntimeGraph, stringifyYaml, validateRuntime, writeLocalSecret };
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import { d as CnosRuntime,
|
|
2
|
-
export {
|
|
1
|
+
import { i as LoadManifestOptions, j as LoadedManifest, N as NormalizedManifest, g as LogicalKey, V as VaultDefinition, d as CnosRuntime, k as ValidationSummary, R as ResolvedGraph } from './plugin-DkOIT5uI.js';
|
|
2
|
+
export { l as ValidationIssue, W as WorkspaceFile } from './plugin-DkOIT5uI.js';
|
|
3
|
+
|
|
4
|
+
declare class CnosError extends Error {
|
|
5
|
+
constructor(message: string);
|
|
6
|
+
}
|
|
7
|
+
declare class CnosSecurityError extends CnosError {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare function loadManifest(options?: LoadManifestOptions): Promise<LoadedManifest>;
|
|
12
|
+
|
|
13
|
+
type ProjectionTarget = 'public' | 'env';
|
|
14
|
+
declare function ensureProjectionAllowed(manifest: NormalizedManifest, key: LogicalKey, target: ProjectionTarget): void;
|
|
3
15
|
|
|
4
16
|
declare function flattenObject(value: Record<string, unknown>, prefix?: string): Record<string, unknown>;
|
|
5
17
|
|
|
18
|
+
declare function resolveManifestRoot(root?: string): Promise<string>;
|
|
6
19
|
declare function resolveConfigDocumentPath(workspaceRoot: string, namespace: 'value' | 'secret', configPath: string, profile?: string): string;
|
|
7
20
|
|
|
8
21
|
interface SecretReference {
|
|
@@ -10,9 +23,17 @@ interface SecretReference {
|
|
|
10
23
|
ref: string;
|
|
11
24
|
vault?: string;
|
|
12
25
|
}
|
|
26
|
+
interface ResolvedVaultDefinition extends VaultDefinition {
|
|
27
|
+
name: string;
|
|
28
|
+
requiresPassphrase: boolean;
|
|
29
|
+
}
|
|
13
30
|
declare function resolveSecretStoreRoot(processEnv?: Record<string, string | undefined>): string;
|
|
14
31
|
declare function resolveSecretVaultFile(storeRoot: string, vault?: string): string;
|
|
15
32
|
declare function resolveSecretPassphrase(vault?: string, processEnv?: Record<string, string | undefined>): string | undefined;
|
|
33
|
+
declare function getVaultPassphraseEnvVar(vault?: string): string;
|
|
34
|
+
declare function isPassphraseEnvRef(value: string | undefined): boolean;
|
|
35
|
+
declare function resolveConfiguredVaultPassphrase(definition: VaultDefinition | undefined, vault?: string, processEnv?: Record<string, string | undefined>): string | undefined;
|
|
36
|
+
declare function resolveVaultDefinition(vaults: Record<string, VaultDefinition> | undefined, vault?: string): ResolvedVaultDefinition;
|
|
16
37
|
declare function createSecretVault(storeRoot: string, vault: string, passphrase: string): Promise<string>;
|
|
17
38
|
declare function listSecretVaults(storeRoot: string): Promise<string[]>;
|
|
18
39
|
declare function writeLocalSecret(storeRoot: string, ref: string, value: string, passphrase: string, vault?: string): Promise<string>;
|
|
@@ -22,4 +43,9 @@ declare function stringifyYaml(value: unknown): string;
|
|
|
22
43
|
|
|
23
44
|
declare function validateRuntime(runtime: CnosRuntime): Promise<ValidationSummary>;
|
|
24
45
|
|
|
25
|
-
|
|
46
|
+
declare const CNOS_GRAPH_ENV_VAR = "__CNOS_GRAPH__";
|
|
47
|
+
declare function serializeRuntimeGraph(graph: ResolvedGraph): string;
|
|
48
|
+
declare function deserializeRuntimeGraph(source: string): ResolvedGraph;
|
|
49
|
+
declare function readRuntimeGraphFromEnv(processEnv?: Record<string, string | undefined>): ResolvedGraph | undefined;
|
|
50
|
+
|
|
51
|
+
export { CNOS_GRAPH_ENV_VAR, CnosSecurityError, type ResolvedVaultDefinition, type SecretReference, ValidationSummary, VaultDefinition, createSecretVault, deserializeRuntimeGraph, ensureProjectionAllowed, flattenObject, getVaultPassphraseEnvVar, isPassphraseEnvRef, listSecretVaults, loadManifest, parseYaml, readRuntimeGraphFromEnv, resolveConfigDocumentPath, resolveConfiguredVaultPassphrase, resolveManifestRoot, resolveSecretPassphrase, resolveSecretStoreRoot, resolveSecretVaultFile, resolveVaultDefinition, serializeRuntimeGraph, stringifyYaml, validateRuntime, writeLocalSecret };
|
package/dist/internal.js
CHANGED
|
@@ -1,25 +1,51 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CNOS_GRAPH_ENV_VAR,
|
|
3
|
+
deserializeRuntimeGraph,
|
|
4
|
+
readRuntimeGraphFromEnv,
|
|
5
|
+
serializeRuntimeGraph
|
|
6
|
+
} from "./chunk-PQ4KSV76.js";
|
|
7
|
+
import {
|
|
8
|
+
CnosSecurityError,
|
|
2
9
|
createSecretVault,
|
|
10
|
+
ensureProjectionAllowed,
|
|
3
11
|
flattenObject,
|
|
12
|
+
getVaultPassphraseEnvVar,
|
|
13
|
+
isPassphraseEnvRef,
|
|
4
14
|
listSecretVaults,
|
|
15
|
+
loadManifest,
|
|
5
16
|
parseYaml,
|
|
6
17
|
resolveConfigDocumentPath,
|
|
18
|
+
resolveConfiguredVaultPassphrase,
|
|
19
|
+
resolveManifestRoot,
|
|
7
20
|
resolveSecretPassphrase,
|
|
8
21
|
resolveSecretStoreRoot,
|
|
9
22
|
resolveSecretVaultFile,
|
|
23
|
+
resolveVaultDefinition,
|
|
10
24
|
stringifyYaml,
|
|
11
25
|
validateRuntime,
|
|
12
26
|
writeLocalSecret
|
|
13
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-APCTXRUN.js";
|
|
14
28
|
export {
|
|
29
|
+
CNOS_GRAPH_ENV_VAR,
|
|
30
|
+
CnosSecurityError,
|
|
15
31
|
createSecretVault,
|
|
32
|
+
deserializeRuntimeGraph,
|
|
33
|
+
ensureProjectionAllowed,
|
|
16
34
|
flattenObject,
|
|
35
|
+
getVaultPassphraseEnvVar,
|
|
36
|
+
isPassphraseEnvRef,
|
|
17
37
|
listSecretVaults,
|
|
38
|
+
loadManifest,
|
|
18
39
|
parseYaml,
|
|
40
|
+
readRuntimeGraphFromEnv,
|
|
19
41
|
resolveConfigDocumentPath,
|
|
42
|
+
resolveConfiguredVaultPassphrase,
|
|
43
|
+
resolveManifestRoot,
|
|
20
44
|
resolveSecretPassphrase,
|
|
21
45
|
resolveSecretStoreRoot,
|
|
22
46
|
resolveSecretVaultFile,
|
|
47
|
+
resolveVaultDefinition,
|
|
48
|
+
serializeRuntimeGraph,
|
|
23
49
|
stringifyYaml,
|
|
24
50
|
validateRuntime,
|
|
25
51
|
writeLocalSecret
|
|
@@ -205,12 +205,12 @@ function applySchemaRules(graph, schema) {
|
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
// ../core/src/
|
|
208
|
+
// ../core/src/utils/secretStore.ts
|
|
209
|
+
var import_node_crypto = require("crypto");
|
|
209
210
|
var import_promises6 = require("fs/promises");
|
|
210
211
|
var import_node_path6 = __toESM(require("path"), 1);
|
|
211
212
|
|
|
212
|
-
// ../core/src/
|
|
213
|
-
var import_node_crypto = require("crypto");
|
|
213
|
+
// ../core/src/runtime/dump.ts
|
|
214
214
|
var import_promises7 = require("fs/promises");
|
|
215
215
|
var import_node_path7 = __toESM(require("path"), 1);
|
|
216
216
|
|
package/dist/plugin/cli-args.cjs
CHANGED
|
@@ -63,12 +63,12 @@ var import_node_path4 = __toESM(require("path"), 1);
|
|
|
63
63
|
var import_promises5 = require("fs/promises");
|
|
64
64
|
var import_node_path5 = __toESM(require("path"), 1);
|
|
65
65
|
|
|
66
|
-
// ../core/src/
|
|
66
|
+
// ../core/src/utils/secretStore.ts
|
|
67
|
+
var import_node_crypto = require("crypto");
|
|
67
68
|
var import_promises6 = require("fs/promises");
|
|
68
69
|
var import_node_path6 = __toESM(require("path"), 1);
|
|
69
70
|
|
|
70
|
-
// ../core/src/
|
|
71
|
-
var import_node_crypto = require("crypto");
|
|
71
|
+
// ../core/src/runtime/dump.ts
|
|
72
72
|
var import_promises7 = require("fs/promises");
|
|
73
73
|
var import_node_path7 = __toESM(require("path"), 1);
|
|
74
74
|
|
package/dist/plugin/cli-args.js
CHANGED
package/dist/plugin/dotenv.cjs
CHANGED
|
@@ -89,6 +89,15 @@ var import_node_path4 = __toESM(require("path"), 1);
|
|
|
89
89
|
var import_promises5 = require("fs/promises");
|
|
90
90
|
var import_node_path5 = __toESM(require("path"), 1);
|
|
91
91
|
|
|
92
|
+
// ../core/src/utils/secretStore.ts
|
|
93
|
+
var import_node_crypto = require("crypto");
|
|
94
|
+
var import_promises6 = require("fs/promises");
|
|
95
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
96
|
+
|
|
97
|
+
// ../core/src/runtime/dump.ts
|
|
98
|
+
var import_promises7 = require("fs/promises");
|
|
99
|
+
var import_node_path7 = __toESM(require("path"), 1);
|
|
100
|
+
|
|
92
101
|
// ../core/src/utils/envNaming.ts
|
|
93
102
|
function normalizeMappingConfig(config = {}) {
|
|
94
103
|
return {
|
|
@@ -121,15 +130,6 @@ function envVarToLogicalKey(envVar, config = {}) {
|
|
|
121
130
|
return `value.${fromScreamingSnake(envVar)}`;
|
|
122
131
|
}
|
|
123
132
|
|
|
124
|
-
// ../core/src/runtime/dump.ts
|
|
125
|
-
var import_promises6 = require("fs/promises");
|
|
126
|
-
var import_node_path6 = __toESM(require("path"), 1);
|
|
127
|
-
|
|
128
|
-
// ../core/src/utils/secretStore.ts
|
|
129
|
-
var import_node_crypto = require("crypto");
|
|
130
|
-
var import_promises7 = require("fs/promises");
|
|
131
|
-
var import_node_path7 = __toESM(require("path"), 1);
|
|
132
|
-
|
|
133
133
|
// ../../plugins/dotenv/src/index.ts
|
|
134
134
|
var DOTENV_PLUGIN_ID = "@kitsy/cnos/plugins/dotenv";
|
|
135
135
|
function parseDoubleQuoted(value) {
|
package/dist/plugin/dotenv.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LoaderPlugin, f as ConfigEntry } from '../plugin-
|
|
2
|
-
import { E as EnvMappingConfig } from '../envNaming-
|
|
1
|
+
import { L as LoaderPlugin, f as ConfigEntry } from '../plugin-DkOIT5uI.cjs';
|
|
2
|
+
import { E as EnvMappingConfig } from '../envNaming-BTJpH93W.cjs';
|
|
3
3
|
|
|
4
4
|
declare function parseDotenv(document: string): Record<string, string>;
|
|
5
5
|
declare function dotenvEntriesFromObject(values: Record<string, string>, mapping?: EnvMappingConfig, originFile?: string, workspaceId?: string): ConfigEntry[];
|
package/dist/plugin/dotenv.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LoaderPlugin, f as ConfigEntry } from '../plugin-
|
|
2
|
-
import { E as EnvMappingConfig } from '../envNaming-
|
|
1
|
+
import { L as LoaderPlugin, f as ConfigEntry } from '../plugin-DkOIT5uI.js';
|
|
2
|
+
import { E as EnvMappingConfig } from '../envNaming-CcsqAel3.js';
|
|
3
3
|
|
|
4
4
|
declare function parseDotenv(document: string): Record<string, string>;
|
|
5
5
|
declare function dotenvEntriesFromObject(values: Record<string, string>, mapping?: EnvMappingConfig, originFile?: string, workspaceId?: string): ConfigEntry[];
|
package/dist/plugin/dotenv.js
CHANGED
|
@@ -60,6 +60,9 @@ var import_node_path2 = __toESM(require("path"), 1);
|
|
|
60
60
|
var import_promises = require("fs/promises");
|
|
61
61
|
var import_node_os = __toESM(require("os"), 1);
|
|
62
62
|
var import_node_path = __toESM(require("path"), 1);
|
|
63
|
+
function stripNamespace(key) {
|
|
64
|
+
return key.split(".").slice(1).join(".");
|
|
65
|
+
}
|
|
63
66
|
|
|
64
67
|
// ../core/src/utils/yaml.ts
|
|
65
68
|
var import_yaml = require("yaml");
|
|
@@ -72,52 +75,39 @@ var import_node_path3 = __toESM(require("path"), 1);
|
|
|
72
75
|
var import_promises4 = require("fs/promises");
|
|
73
76
|
var import_node_path4 = __toESM(require("path"), 1);
|
|
74
77
|
|
|
78
|
+
// ../core/src/promotions/validatePromotion.ts
|
|
79
|
+
var DEFAULT_DATA_NAMESPACE = {
|
|
80
|
+
kind: "data",
|
|
81
|
+
shareable: false
|
|
82
|
+
};
|
|
83
|
+
function getNamespaceNameForKey(key) {
|
|
84
|
+
const [namespace] = key.split(".");
|
|
85
|
+
if (!namespace || !key.includes(".")) {
|
|
86
|
+
throw new CnosManifestError(`Logical key must be namespace-qualified: ${key}`);
|
|
87
|
+
}
|
|
88
|
+
return namespace;
|
|
89
|
+
}
|
|
90
|
+
function getNamespaceDefinition(manifest, namespaceOrKey) {
|
|
91
|
+
const namespace = namespaceOrKey.includes(".") ? getNamespaceNameForKey(namespaceOrKey) : namespaceOrKey;
|
|
92
|
+
return manifest.namespaces[namespace] ?? DEFAULT_DATA_NAMESPACE;
|
|
93
|
+
}
|
|
94
|
+
|
|
75
95
|
// ../core/src/workspaces/resolveWorkspaceContext.ts
|
|
76
96
|
var import_promises5 = require("fs/promises");
|
|
77
97
|
var import_node_path5 = __toESM(require("path"), 1);
|
|
78
98
|
|
|
79
|
-
// ../core/src/utils/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
function toScreamingSnakeSegment(segment) {
|
|
87
|
-
return segment.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
|
|
88
|
-
}
|
|
89
|
-
function toScreamingSnake(path8) {
|
|
90
|
-
return path8.split(".").map((segment) => toScreamingSnakeSegment(segment)).filter(Boolean).join("_");
|
|
99
|
+
// ../core/src/utils/secretStore.ts
|
|
100
|
+
var import_node_crypto = require("crypto");
|
|
101
|
+
var import_promises6 = require("fs/promises");
|
|
102
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
103
|
+
function isObject(value) {
|
|
104
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
91
105
|
}
|
|
92
|
-
function
|
|
93
|
-
|
|
94
|
-
const explicitEntry = Object.entries(normalized.explicit).find(([, logicalKey]) => logicalKey === key);
|
|
95
|
-
if (explicitEntry) {
|
|
96
|
-
return explicitEntry[0];
|
|
97
|
-
}
|
|
98
|
-
if (normalized.convention !== "SCREAMING_SNAKE") {
|
|
99
|
-
return void 0;
|
|
100
|
-
}
|
|
101
|
-
if (key.startsWith("value.")) {
|
|
102
|
-
return toScreamingSnake(key.slice("value.".length));
|
|
103
|
-
}
|
|
104
|
-
if (key.startsWith("secret.")) {
|
|
105
|
-
return `SECRET_${toScreamingSnake(key.slice("secret.".length))}`;
|
|
106
|
-
}
|
|
107
|
-
return void 0;
|
|
106
|
+
function isSecretReference(value) {
|
|
107
|
+
return isObject(value) && typeof value.provider === "string" && value.provider.trim().length > 0 && typeof value.ref === "string" && value.ref.trim().length > 0 && (value.vault === void 0 && true || typeof value.vault === "string" && value.vault.trim().length > 0) && Object.keys(value).every((key) => ["provider", "ref", "vault"].includes(key));
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
// ../core/src/runtime/toEnv.ts
|
|
111
|
-
function fallbackLogicalKeyToEnvVar(key) {
|
|
112
|
-
if (key.startsWith("value.")) {
|
|
113
|
-
return key.slice("value.".length).replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
|
|
114
|
-
}
|
|
115
|
-
if (key.startsWith("secret.")) {
|
|
116
|
-
const normalized = key.slice("secret.".length).replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
|
|
117
|
-
return `SECRET_${normalized}`;
|
|
118
|
-
}
|
|
119
|
-
return key.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
|
|
120
|
-
}
|
|
121
111
|
function normalizeEnvValue(value) {
|
|
122
112
|
if (value === void 0 || value === null) {
|
|
123
113
|
return "";
|
|
@@ -133,25 +123,32 @@ function normalizeEnvValue(value) {
|
|
|
133
123
|
function toEnv(graph, manifest, options = {}) {
|
|
134
124
|
const includeSecrets = options.includeSecrets ?? true;
|
|
135
125
|
const output = {};
|
|
136
|
-
const
|
|
137
|
-
(left, right) => left.
|
|
126
|
+
const mappedEntries = Object.entries(manifest.envMapping.explicit).sort(
|
|
127
|
+
([left], [right]) => left.localeCompare(right)
|
|
138
128
|
);
|
|
139
|
-
for (const
|
|
140
|
-
|
|
129
|
+
for (const [envVar, logicalKey] of mappedEntries) {
|
|
130
|
+
const entry = graph.entries.get(logicalKey);
|
|
131
|
+
if (!entry) {
|
|
141
132
|
continue;
|
|
142
133
|
}
|
|
143
|
-
|
|
134
|
+
const namespaceDefinition = getNamespaceDefinition(manifest, entry.namespace);
|
|
135
|
+
if (namespaceDefinition.kind !== "data" || !namespaceDefinition.shareable || namespaceDefinition.sensitive) {
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (entry.namespace === "secret" && !includeSecrets) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (isSecretReference(entry.value)) {
|
|
144
142
|
continue;
|
|
145
143
|
}
|
|
146
|
-
const envVar = logicalKeyToEnvVar(entry.key, manifest.envMapping) ?? fallbackLogicalKeyToEnvVar(entry.key);
|
|
147
144
|
output[envVar] = normalizeEnvValue(entry.value);
|
|
148
145
|
}
|
|
149
146
|
return output;
|
|
150
147
|
}
|
|
151
148
|
|
|
152
149
|
// ../core/src/runtime/toPublicEnv.ts
|
|
153
|
-
function
|
|
154
|
-
return
|
|
150
|
+
function fallbackPublicEnvVar(valuePath) {
|
|
151
|
+
return valuePath.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
|
|
155
152
|
}
|
|
156
153
|
function normalizeEnvValue2(value) {
|
|
157
154
|
if (value === void 0 || value === null) {
|
|
@@ -178,22 +175,12 @@ function resolvePublicPrefix(manifest, options) {
|
|
|
178
175
|
}
|
|
179
176
|
return configuredPrefix;
|
|
180
177
|
}
|
|
181
|
-
function ensurePublicPromotionKey(key) {
|
|
182
|
-
if (!key.startsWith("value.")) {
|
|
183
|
-
throw new CnosManifestError(`public.promote may only contain value.* keys: ${key}`);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
178
|
function toPublicEnv(graph, manifest, options = {}) {
|
|
187
179
|
const prefix = resolvePublicPrefix(manifest, options);
|
|
188
180
|
const output = {};
|
|
189
|
-
const promotions =
|
|
190
|
-
for (const
|
|
191
|
-
|
|
192
|
-
const resolved = graph.entries.get(key);
|
|
193
|
-
if (!resolved) {
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
const baseEnvVar = logicalKeyToEnvVar(key, manifest.envMapping) ?? fallbackValueEnvVar(key);
|
|
181
|
+
const promotions = Array.from(graph.entries.values()).filter((entry) => entry.namespace === "public").sort((left, right) => left.key.localeCompare(right.key));
|
|
182
|
+
for (const resolved of promotions) {
|
|
183
|
+
const baseEnvVar = fallbackPublicEnvVar(stripNamespace(resolved.key));
|
|
197
184
|
const envVar = prefix && !baseEnvVar.startsWith(prefix) ? `${prefix}${baseEnvVar}` : baseEnvVar;
|
|
198
185
|
output[envVar] = normalizeEnvValue2(resolved.value);
|
|
199
186
|
}
|
|
@@ -201,11 +188,6 @@ function toPublicEnv(graph, manifest, options = {}) {
|
|
|
201
188
|
}
|
|
202
189
|
|
|
203
190
|
// ../core/src/runtime/dump.ts
|
|
204
|
-
var import_promises6 = require("fs/promises");
|
|
205
|
-
var import_node_path6 = __toESM(require("path"), 1);
|
|
206
|
-
|
|
207
|
-
// ../core/src/utils/secretStore.ts
|
|
208
|
-
var import_node_crypto = require("crypto");
|
|
209
191
|
var import_promises7 = require("fs/promises");
|
|
210
192
|
var import_node_path7 = __toESM(require("path"), 1);
|
|
211
193
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ExporterPlugin } from '../plugin-
|
|
2
|
-
export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-
|
|
1
|
+
import { E as ExporterPlugin } from '../plugin-DkOIT5uI.cjs';
|
|
2
|
+
export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-DvFeV3qG.cjs';
|
|
3
3
|
|
|
4
4
|
declare function createEnvExportPlugin(): ExporterPlugin;
|
|
5
5
|
declare function createPublicEnvExportPlugin(): ExporterPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ExporterPlugin } from '../plugin-
|
|
2
|
-
export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-
|
|
1
|
+
import { E as ExporterPlugin } from '../plugin-DkOIT5uI.js';
|
|
2
|
+
export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-C9clvXLo.js';
|
|
3
3
|
|
|
4
4
|
declare function createEnvExportPlugin(): ExporterPlugin;
|
|
5
5
|
declare function createPublicEnvExportPlugin(): ExporterPlugin;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createEnvExportPlugin,
|
|
3
3
|
createPublicEnvExportPlugin
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-EIN55XXA.js";
|
|
5
5
|
import {
|
|
6
6
|
toEnv,
|
|
7
7
|
toPublicEnv
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-APCTXRUN.js";
|
|
9
9
|
export {
|
|
10
10
|
createEnvExportPlugin,
|
|
11
11
|
createPublicEnvExportPlugin,
|
|
@@ -100,14 +100,10 @@ var import_node_path4 = __toESM(require("path"), 1);
|
|
|
100
100
|
var import_promises5 = require("fs/promises");
|
|
101
101
|
var import_node_path5 = __toESM(require("path"), 1);
|
|
102
102
|
|
|
103
|
-
// ../core/src/runtime/dump.ts
|
|
104
|
-
var import_promises6 = require("fs/promises");
|
|
105
|
-
var import_node_path6 = __toESM(require("path"), 1);
|
|
106
|
-
|
|
107
103
|
// ../core/src/utils/secretStore.ts
|
|
108
104
|
var import_node_crypto = require("crypto");
|
|
109
|
-
var
|
|
110
|
-
var
|
|
105
|
+
var import_promises6 = require("fs/promises");
|
|
106
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
111
107
|
function isObject(value) {
|
|
112
108
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
113
109
|
}
|
|
@@ -115,10 +111,10 @@ function isSecretReference(value) {
|
|
|
115
111
|
return isObject(value) && typeof value.provider === "string" && value.provider.trim().length > 0 && typeof value.ref === "string" && value.ref.trim().length > 0 && (value.vault === void 0 && true || typeof value.vault === "string" && value.vault.trim().length > 0) && Object.keys(value).every((key) => ["provider", "ref", "vault"].includes(key));
|
|
116
112
|
}
|
|
117
113
|
function resolveSecretStoreRoot(processEnv = process.env) {
|
|
118
|
-
return
|
|
114
|
+
return import_node_path6.default.resolve(expandHomePath(processEnv.CNOS_SECRET_HOME ?? "~/.cnos/secrets"));
|
|
119
115
|
}
|
|
120
116
|
function resolveSecretStoreFile(storeRoot, ref, vault = "default") {
|
|
121
|
-
return
|
|
117
|
+
return import_node_path6.default.join(storeRoot, "vaults", vault, "store", ...ref.split("/")).concat(".json");
|
|
122
118
|
}
|
|
123
119
|
function deriveKey(passphrase, salt) {
|
|
124
120
|
return (0, import_node_crypto.scryptSync)(passphrase, salt, 32);
|
|
@@ -145,7 +141,7 @@ async function readLocalSecret(storeRoot, ref, passphrase, vault = "default") {
|
|
|
145
141
|
);
|
|
146
142
|
}
|
|
147
143
|
const filePath = resolveSecretStoreFile(storeRoot, ref, vault);
|
|
148
|
-
const source = await (0,
|
|
144
|
+
const source = await (0, import_promises6.readFile)(filePath, "utf8");
|
|
149
145
|
const document = JSON.parse(source);
|
|
150
146
|
if (document.version !== 1 || document.algorithm !== "aes-256-gcm" || typeof document.salt !== "string" || typeof document.iv !== "string" || typeof document.tag !== "string" || typeof document.ciphertext !== "string") {
|
|
151
147
|
throw new CnosManifestError("Invalid local secret document", filePath);
|
|
@@ -153,6 +149,10 @@ async function readLocalSecret(storeRoot, ref, passphrase, vault = "default") {
|
|
|
153
149
|
return decryptDocument(document, passphrase);
|
|
154
150
|
}
|
|
155
151
|
|
|
152
|
+
// ../core/src/runtime/dump.ts
|
|
153
|
+
var import_promises7 = require("fs/promises");
|
|
154
|
+
var import_node_path7 = __toESM(require("path"), 1);
|
|
155
|
+
|
|
156
156
|
// ../../plugins/filesystem/src/helpers.ts
|
|
157
157
|
var YAML_EXTENSIONS = /* @__PURE__ */ new Set([".yml", ".yaml"]);
|
|
158
158
|
var FILESYSTEM_PLUGIN_ID = "@kitsy/cnos/plugins/filesystem";
|
|
@@ -257,7 +257,7 @@ async function resolveSecretValue(value, processEnv) {
|
|
|
257
257
|
value.vault
|
|
258
258
|
);
|
|
259
259
|
}
|
|
260
|
-
if (value.provider === "env") {
|
|
260
|
+
if (value.provider === "env" || value.provider === "github-secrets") {
|
|
261
261
|
const resolved = processEnv?.[value.ref];
|
|
262
262
|
if (resolved === void 0) {
|
|
263
263
|
return value;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as LoaderPlugin, f as ConfigEntry,
|
|
1
|
+
import { L as LoaderPlugin, f as ConfigEntry, n as WorkspaceRoot, o as NamespaceName } from '../plugin-DkOIT5uI.cjs';
|
|
2
2
|
|
|
3
3
|
declare function filesystemSecretsReader(filePath: string, document: string, workspaceId?: string): ConfigEntry[];
|
|
4
4
|
declare function createFilesystemSecretsPlugin(): LoaderPlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as LoaderPlugin, f as ConfigEntry,
|
|
1
|
+
import { L as LoaderPlugin, f as ConfigEntry, n as WorkspaceRoot, o as NamespaceName } from '../plugin-DkOIT5uI.js';
|
|
2
2
|
|
|
3
3
|
declare function filesystemSecretsReader(filePath: string, document: string, workspaceId?: string): ConfigEntry[];
|
|
4
4
|
declare function createFilesystemSecretsPlugin(): LoaderPlugin;
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
filesystemSecretsReader,
|
|
6
6
|
filesystemValuesReader,
|
|
7
7
|
yamlObjectToEntries
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-SXTMTACL.js";
|
|
9
|
+
import "../chunk-APCTXRUN.js";
|
|
10
10
|
export {
|
|
11
11
|
collectFilesystemLayerFiles,
|
|
12
12
|
createFilesystemSecretsPlugin,
|
|
@@ -59,6 +59,15 @@ var import_node_path4 = __toESM(require("path"), 1);
|
|
|
59
59
|
var import_promises5 = require("fs/promises");
|
|
60
60
|
var import_node_path5 = __toESM(require("path"), 1);
|
|
61
61
|
|
|
62
|
+
// ../core/src/utils/secretStore.ts
|
|
63
|
+
var import_node_crypto = require("crypto");
|
|
64
|
+
var import_promises6 = require("fs/promises");
|
|
65
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
66
|
+
|
|
67
|
+
// ../core/src/runtime/dump.ts
|
|
68
|
+
var import_promises7 = require("fs/promises");
|
|
69
|
+
var import_node_path7 = __toESM(require("path"), 1);
|
|
70
|
+
|
|
62
71
|
// ../core/src/utils/envNaming.ts
|
|
63
72
|
function normalizeMappingConfig(config = {}) {
|
|
64
73
|
return {
|
|
@@ -91,15 +100,6 @@ function envVarToLogicalKey(envVar, config = {}) {
|
|
|
91
100
|
return `value.${fromScreamingSnake(envVar)}`;
|
|
92
101
|
}
|
|
93
102
|
|
|
94
|
-
// ../core/src/runtime/dump.ts
|
|
95
|
-
var import_promises6 = require("fs/promises");
|
|
96
|
-
var import_node_path6 = __toESM(require("path"), 1);
|
|
97
|
-
|
|
98
|
-
// ../core/src/utils/secretStore.ts
|
|
99
|
-
var import_node_crypto = require("crypto");
|
|
100
|
-
var import_promises7 = require("fs/promises");
|
|
101
|
-
var import_node_path7 = __toESM(require("path"), 1);
|
|
102
|
-
|
|
103
103
|
// ../../plugins/process-env/src/index.ts
|
|
104
104
|
var PROCESS_ENV_PLUGIN_ID = "@kitsy/cnos/plugins/process-env";
|
|
105
105
|
function processEnvEntriesFromObject(env, mapping = {}, workspaceId = "default") {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LoaderPlugin, f as ConfigEntry } from '../plugin-
|
|
2
|
-
import { E as EnvMappingConfig } from '../envNaming-
|
|
1
|
+
import { L as LoaderPlugin, f as ConfigEntry } from '../plugin-DkOIT5uI.cjs';
|
|
2
|
+
import { E as EnvMappingConfig } from '../envNaming-BTJpH93W.cjs';
|
|
3
3
|
|
|
4
4
|
declare function processEnvEntriesFromObject(env: Record<string, string | undefined>, mapping?: EnvMappingConfig, workspaceId?: string): ConfigEntry[];
|
|
5
5
|
declare function createProcessEnvPlugin(): LoaderPlugin;
|