@kitsy/cnos 1.3.0 → 1.5.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 +1 -1
- package/dist/build/index.cjs +153 -11
- package/dist/build/index.d.cts +11 -3
- package/dist/build/index.d.ts +11 -3
- package/dist/build/index.js +56 -9
- package/dist/{chunk-DRKDNY4I.js → chunk-APIU4GTB.js} +14 -4
- package/dist/{chunk-K6QYI2T4.js → chunk-EQSKV3DP.js} +1 -1
- package/dist/{chunk-JDII6O72.js → chunk-FWJC4Y2D.js} +1 -1
- package/dist/{chunk-QTKXPY3N.js → chunk-HMM76UYZ.js} +1 -1
- package/dist/{chunk-OOKFRWTN.js → chunk-J4K4JUJL.js} +1 -1
- package/dist/{chunk-EDCLLCNL.js → chunk-RYGSG3GR.js} +8 -8
- package/dist/{chunk-FC3IV6A7.js → chunk-T6Y57KTT.js} +20 -1
- package/dist/{chunk-E7SE6N26.js → chunk-TO76YYS4.js} +3 -3
- package/dist/chunk-WCHX2QFY.js +115 -0
- package/dist/{chunk-OWUZQ4OH.js → chunk-ZTPSFXWP.js} +1 -1
- package/dist/configure/index.cjs +102 -9
- package/dist/configure/index.d.cts +3 -3
- package/dist/configure/index.d.ts +3 -3
- package/dist/configure/index.js +8 -8
- package/dist/{envNaming-Dy3WYiGK.d.ts → envNaming-Dvm_LP2D.d.ts} +1 -1
- package/dist/{envNaming-D6k66myh.d.cts → envNaming-S4B-dHUx.d.cts} +1 -1
- package/dist/index.cjs +102 -9
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -10
- package/dist/internal.cjs +14 -2
- package/dist/internal.d.cts +5 -4
- package/dist/internal.d.ts +5 -4
- package/dist/internal.js +10 -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.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.d.cts +2 -2
- package/dist/plugin/dotenv.d.ts +2 -2
- package/dist/plugin/dotenv.js +2 -2
- 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 +19 -0
- 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 +74 -7
- package/dist/plugin/process-env.d.cts +4 -3
- package/dist/plugin/process-env.d.ts +4 -3
- package/dist/plugin/process-env.js +6 -4
- package/dist/{plugin-CyNkf7Dm.d.cts → plugin-B4xwySxw.d.cts} +2 -1
- package/dist/{plugin-CyNkf7Dm.d.ts → plugin-B4xwySxw.d.ts} +2 -1
- package/dist/runtime/index.cjs +102 -9
- package/dist/runtime/index.d.cts +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +10 -10
- package/dist/{toPublicEnv-D2PZkaN-.d.ts → toPublicEnv-CvhGAfsB.d.ts} +1 -1
- package/dist/{toPublicEnv-Cz72m6y0.d.cts → toPublicEnv-ggmphZFs.d.cts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-CDXJISGB.js +0 -49
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import {
|
|
2
|
+
envVarToLogicalKey
|
|
3
|
+
} from "./chunk-APIU4GTB.js";
|
|
4
|
+
|
|
5
|
+
// ../../plugins/process-env/src/index.ts
|
|
6
|
+
var PROCESS_ENV_PLUGIN_ID = "@kitsy/cnos/plugins/process-env";
|
|
7
|
+
var PROCESS_GRAPH_OMIT = /* @__PURE__ */ new Set([
|
|
8
|
+
"__CNOS_GRAPH__",
|
|
9
|
+
"__CNOS_SECRET_PAYLOAD__",
|
|
10
|
+
"__CNOS_SESSION_KEY__"
|
|
11
|
+
]);
|
|
12
|
+
function processEnvEntriesFromObject(env, mapping = {}, workspaceId = "default") {
|
|
13
|
+
return Object.entries(env).flatMap(([envVar, value]) => {
|
|
14
|
+
if (typeof value !== "string") {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
const logicalKey = envVarToLogicalKey(envVar, mapping);
|
|
18
|
+
if (!logicalKey) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
key: logicalKey,
|
|
24
|
+
value,
|
|
25
|
+
namespace: logicalKey.startsWith("secret.") ? "secret" : "value",
|
|
26
|
+
sourceId: "process-env",
|
|
27
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
28
|
+
workspaceId,
|
|
29
|
+
origin: {
|
|
30
|
+
envVar
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function processNamespaceEntriesFromContext(env, workspaceId = "default") {
|
|
37
|
+
const envEntries = Object.entries(env).filter((entry) => typeof entry[1] === "string").filter(([envVar]) => !PROCESS_GRAPH_OMIT.has(envVar)).map(([envVar, value]) => ({
|
|
38
|
+
key: `process.env.${envVar}`,
|
|
39
|
+
value,
|
|
40
|
+
namespace: "process",
|
|
41
|
+
sourceId: "process-runtime",
|
|
42
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
43
|
+
workspaceId,
|
|
44
|
+
origin: {
|
|
45
|
+
envVar
|
|
46
|
+
}
|
|
47
|
+
}));
|
|
48
|
+
const runtimeEntries = [
|
|
49
|
+
{
|
|
50
|
+
key: "process.cwd",
|
|
51
|
+
value: process.cwd(),
|
|
52
|
+
namespace: "process",
|
|
53
|
+
sourceId: "process-runtime",
|
|
54
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
55
|
+
workspaceId
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
key: "process.platform",
|
|
59
|
+
value: process.platform,
|
|
60
|
+
namespace: "process",
|
|
61
|
+
sourceId: "process-runtime",
|
|
62
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
63
|
+
workspaceId
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: "process.arch",
|
|
67
|
+
value: process.arch,
|
|
68
|
+
namespace: "process",
|
|
69
|
+
sourceId: "process-runtime",
|
|
70
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
71
|
+
workspaceId
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
key: "process.node.version",
|
|
75
|
+
value: process.version,
|
|
76
|
+
namespace: "process",
|
|
77
|
+
sourceId: "process-runtime",
|
|
78
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
79
|
+
workspaceId
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
key: "process.args.raw",
|
|
83
|
+
value: process.argv.slice(2),
|
|
84
|
+
namespace: "process",
|
|
85
|
+
sourceId: "process-runtime",
|
|
86
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
87
|
+
workspaceId
|
|
88
|
+
}
|
|
89
|
+
];
|
|
90
|
+
return [...runtimeEntries, ...envEntries];
|
|
91
|
+
}
|
|
92
|
+
function createProcessEnvPlugin() {
|
|
93
|
+
return {
|
|
94
|
+
id: "process-env",
|
|
95
|
+
kind: "loader",
|
|
96
|
+
async load(context) {
|
|
97
|
+
const config = context.manifestConfig;
|
|
98
|
+
const env = context.processEnv ?? process.env;
|
|
99
|
+
return [
|
|
100
|
+
...processEnvEntriesFromObject(
|
|
101
|
+
env,
|
|
102
|
+
config.envMapping,
|
|
103
|
+
context.workspace.workspaceId
|
|
104
|
+
),
|
|
105
|
+
...processNamespaceEntriesFromContext(env, context.workspace.workspaceId)
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export {
|
|
112
|
+
processEnvEntriesFromObject,
|
|
113
|
+
processNamespaceEntriesFromContext,
|
|
114
|
+
createProcessEnvPlugin
|
|
115
|
+
};
|
package/dist/configure/index.cjs
CHANGED
|
@@ -299,6 +299,11 @@ var DEFAULT_NAMESPACES = {
|
|
|
299
299
|
shareable: false,
|
|
300
300
|
readonly: true
|
|
301
301
|
},
|
|
302
|
+
process: {
|
|
303
|
+
kind: "system",
|
|
304
|
+
shareable: false,
|
|
305
|
+
readonly: true
|
|
306
|
+
},
|
|
302
307
|
public: {
|
|
303
308
|
kind: "projection",
|
|
304
309
|
source: "promote",
|
|
@@ -958,12 +963,15 @@ async function exists2(targetPath) {
|
|
|
958
963
|
return false;
|
|
959
964
|
}
|
|
960
965
|
}
|
|
961
|
-
async function resolveLocalWorkspaceRoot(manifestRoot, workspaceId) {
|
|
966
|
+
async function resolveLocalWorkspaceRoot(manifestRoot, workspaceId, manifest) {
|
|
962
967
|
const workspaceRoot = import_node_path5.default.join(manifestRoot, "workspaces", workspaceId);
|
|
963
968
|
if (await exists2(workspaceRoot)) {
|
|
964
969
|
return workspaceRoot;
|
|
965
970
|
}
|
|
966
|
-
const
|
|
971
|
+
const customDataNamespaceRoots = Object.entries(manifest.namespaces).filter(
|
|
972
|
+
([namespace, definition]) => namespace !== "value" && namespace !== "secret" && definition.kind === "data" && !definition.sensitive
|
|
973
|
+
).map(([namespace]) => namespace);
|
|
974
|
+
const legacyMarkers = ["values", "secrets", "env", "profiles", ...customDataNamespaceRoots].map(
|
|
967
975
|
(segment) => import_node_path5.default.join(manifestRoot, segment)
|
|
968
976
|
);
|
|
969
977
|
if ((await Promise.all(legacyMarkers.map((marker) => exists2(marker)))).some(Boolean)) {
|
|
@@ -1050,7 +1058,7 @@ async function resolveWorkspaceContext(manifest, options) {
|
|
|
1050
1058
|
workspaceRoots.push({
|
|
1051
1059
|
scope: "local",
|
|
1052
1060
|
workspaceId: chainWorkspaceId,
|
|
1053
|
-
path: await resolveLocalWorkspaceRoot(options.manifestRoot, chainWorkspaceId)
|
|
1061
|
+
path: await resolveLocalWorkspaceRoot(options.manifestRoot, chainWorkspaceId, manifest)
|
|
1054
1062
|
});
|
|
1055
1063
|
}
|
|
1056
1064
|
return {
|
|
@@ -1215,6 +1223,7 @@ async function runPipeline(options) {
|
|
|
1215
1223
|
const collectedEntries = await Promise.all(
|
|
1216
1224
|
options.plugins.map(
|
|
1217
1225
|
(plugin) => plugin.load({
|
|
1226
|
+
manifest: options.manifest,
|
|
1218
1227
|
manifestConfig: {
|
|
1219
1228
|
...options.manifest.sources[plugin.id] ?? {},
|
|
1220
1229
|
envMapping: options.manifest.envMapping
|
|
@@ -2355,7 +2364,7 @@ function envVarToLogicalKey(envVar, config = {}) {
|
|
|
2355
2364
|
// package.json
|
|
2356
2365
|
var package_default = {
|
|
2357
2366
|
name: "@kitsy/cnos",
|
|
2358
|
-
version: "1.
|
|
2367
|
+
version: "1.5.0",
|
|
2359
2368
|
description: "Batteries-included CNOS runtime package wired with the official plugins.",
|
|
2360
2369
|
type: "module",
|
|
2361
2370
|
main: "./dist/index.cjs",
|
|
@@ -2829,11 +2838,30 @@ function createFilesystemValuesPlugin() {
|
|
|
2829
2838
|
sourceRoot,
|
|
2830
2839
|
context.profileActivation.values
|
|
2831
2840
|
);
|
|
2841
|
+
const customNamespaces = Object.entries(context.manifest.namespaces).filter(
|
|
2842
|
+
([namespace, definition]) => namespace !== "value" && namespace !== "secret" && definition.kind === "data" && !definition.sensitive
|
|
2843
|
+
).map(([namespace]) => namespace);
|
|
2832
2844
|
const entries = [];
|
|
2833
2845
|
for (const file of files) {
|
|
2834
2846
|
const document = await (0, import_promises13.readFile)(file.absolutePath, "utf8");
|
|
2835
2847
|
entries.push(...filesystemValuesReader(file.relativePath, document, file.workspaceId));
|
|
2836
2848
|
}
|
|
2849
|
+
for (const namespace of customNamespaces) {
|
|
2850
|
+
const layers = [
|
|
2851
|
+
namespace,
|
|
2852
|
+
...context.profileChain.filter((profile) => profile !== "base").map((profile) => `profiles/${profile}/${namespace}`)
|
|
2853
|
+
];
|
|
2854
|
+
const namespaceFiles = await collectFilesystemLayerFiles(
|
|
2855
|
+
context.manifestRoot,
|
|
2856
|
+
context.workspace.workspaceRoots,
|
|
2857
|
+
sourceRoot,
|
|
2858
|
+
layers
|
|
2859
|
+
);
|
|
2860
|
+
for (const file of namespaceFiles) {
|
|
2861
|
+
const document = await (0, import_promises13.readFile)(file.absolutePath, "utf8");
|
|
2862
|
+
entries.push(...yamlObjectToEntries(document, file.relativePath, namespace, "filesystem-values", file.workspaceId));
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2837
2865
|
return entries;
|
|
2838
2866
|
}
|
|
2839
2867
|
};
|
|
@@ -2841,6 +2869,11 @@ function createFilesystemValuesPlugin() {
|
|
|
2841
2869
|
|
|
2842
2870
|
// ../../plugins/process-env/src/index.ts
|
|
2843
2871
|
var PROCESS_ENV_PLUGIN_ID = "@kitsy/cnos/plugins/process-env";
|
|
2872
|
+
var PROCESS_GRAPH_OMIT = /* @__PURE__ */ new Set([
|
|
2873
|
+
"__CNOS_GRAPH__",
|
|
2874
|
+
"__CNOS_SECRET_PAYLOAD__",
|
|
2875
|
+
"__CNOS_SESSION_KEY__"
|
|
2876
|
+
]);
|
|
2844
2877
|
function processEnvEntriesFromObject(env, mapping = {}, workspaceId = "default") {
|
|
2845
2878
|
return Object.entries(env).flatMap(([envVar, value]) => {
|
|
2846
2879
|
if (typeof value !== "string") {
|
|
@@ -2865,17 +2898,77 @@ function processEnvEntriesFromObject(env, mapping = {}, workspaceId = "default")
|
|
|
2865
2898
|
];
|
|
2866
2899
|
});
|
|
2867
2900
|
}
|
|
2901
|
+
function processNamespaceEntriesFromContext(env, workspaceId = "default") {
|
|
2902
|
+
const envEntries = Object.entries(env).filter((entry) => typeof entry[1] === "string").filter(([envVar]) => !PROCESS_GRAPH_OMIT.has(envVar)).map(([envVar, value]) => ({
|
|
2903
|
+
key: `process.env.${envVar}`,
|
|
2904
|
+
value,
|
|
2905
|
+
namespace: "process",
|
|
2906
|
+
sourceId: "process-runtime",
|
|
2907
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2908
|
+
workspaceId,
|
|
2909
|
+
origin: {
|
|
2910
|
+
envVar
|
|
2911
|
+
}
|
|
2912
|
+
}));
|
|
2913
|
+
const runtimeEntries = [
|
|
2914
|
+
{
|
|
2915
|
+
key: "process.cwd",
|
|
2916
|
+
value: process.cwd(),
|
|
2917
|
+
namespace: "process",
|
|
2918
|
+
sourceId: "process-runtime",
|
|
2919
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2920
|
+
workspaceId
|
|
2921
|
+
},
|
|
2922
|
+
{
|
|
2923
|
+
key: "process.platform",
|
|
2924
|
+
value: process.platform,
|
|
2925
|
+
namespace: "process",
|
|
2926
|
+
sourceId: "process-runtime",
|
|
2927
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2928
|
+
workspaceId
|
|
2929
|
+
},
|
|
2930
|
+
{
|
|
2931
|
+
key: "process.arch",
|
|
2932
|
+
value: process.arch,
|
|
2933
|
+
namespace: "process",
|
|
2934
|
+
sourceId: "process-runtime",
|
|
2935
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2936
|
+
workspaceId
|
|
2937
|
+
},
|
|
2938
|
+
{
|
|
2939
|
+
key: "process.node.version",
|
|
2940
|
+
value: process.version,
|
|
2941
|
+
namespace: "process",
|
|
2942
|
+
sourceId: "process-runtime",
|
|
2943
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2944
|
+
workspaceId
|
|
2945
|
+
},
|
|
2946
|
+
{
|
|
2947
|
+
key: "process.args.raw",
|
|
2948
|
+
value: process.argv.slice(2),
|
|
2949
|
+
namespace: "process",
|
|
2950
|
+
sourceId: "process-runtime",
|
|
2951
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2952
|
+
workspaceId
|
|
2953
|
+
}
|
|
2954
|
+
];
|
|
2955
|
+
return [...runtimeEntries, ...envEntries];
|
|
2956
|
+
}
|
|
2868
2957
|
function createProcessEnvPlugin() {
|
|
2869
2958
|
return {
|
|
2870
2959
|
id: "process-env",
|
|
2871
2960
|
kind: "loader",
|
|
2872
2961
|
async load(context) {
|
|
2873
2962
|
const config = context.manifestConfig;
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2963
|
+
const env = context.processEnv ?? process.env;
|
|
2964
|
+
return [
|
|
2965
|
+
...processEnvEntriesFromObject(
|
|
2966
|
+
env,
|
|
2967
|
+
config.envMapping,
|
|
2968
|
+
context.workspace.workspaceId
|
|
2969
|
+
),
|
|
2970
|
+
...processNamespaceEntriesFromContext(env, context.workspace.workspaceId)
|
|
2971
|
+
];
|
|
2879
2972
|
}
|
|
2880
2973
|
};
|
|
2881
2974
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { R as ResolvedGraph, D as DumpPlanOptions, d as DumpPlan, e as DumpOptions, f as DumpResult, C as CnosCreateOptions, g as CnosRuntime, h as CnosPlugin } from '../plugin-
|
|
2
|
-
export { a as ConfigEntry, I as InspectResult, L as LoaderPlugin, b as LogicalKey, M as ManifestFile, N as NormalizedManifest, T as ToEnvOptions, c as ToPublicEnvOptions } from '../plugin-
|
|
3
|
-
export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-
|
|
1
|
+
import { R as ResolvedGraph, D as DumpPlanOptions, d as DumpPlan, e as DumpOptions, f as DumpResult, C as CnosCreateOptions, g as CnosRuntime, h as CnosPlugin } from '../plugin-B4xwySxw.cjs';
|
|
2
|
+
export { a as ConfigEntry, I as InspectResult, L as LoaderPlugin, b as LogicalKey, M as ManifestFile, N as NormalizedManifest, T as ToEnvOptions, c as ToPublicEnvOptions } from '../plugin-B4xwySxw.cjs';
|
|
3
|
+
export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-ggmphZFs.cjs';
|
|
4
4
|
|
|
5
5
|
declare function planDump(graph: ResolvedGraph, options?: DumpPlanOptions): DumpPlan;
|
|
6
6
|
declare function writeDump(graph: ResolvedGraph, options: DumpOptions): Promise<DumpResult>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { R as ResolvedGraph, D as DumpPlanOptions, d as DumpPlan, e as DumpOptions, f as DumpResult, C as CnosCreateOptions, g as CnosRuntime, h as CnosPlugin } from '../plugin-
|
|
2
|
-
export { a as ConfigEntry, I as InspectResult, L as LoaderPlugin, b as LogicalKey, M as ManifestFile, N as NormalizedManifest, T as ToEnvOptions, c as ToPublicEnvOptions } from '../plugin-
|
|
3
|
-
export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-
|
|
1
|
+
import { R as ResolvedGraph, D as DumpPlanOptions, d as DumpPlan, e as DumpOptions, f as DumpResult, C as CnosCreateOptions, g as CnosRuntime, h as CnosPlugin } from '../plugin-B4xwySxw.js';
|
|
2
|
+
export { a as ConfigEntry, I as InspectResult, L as LoaderPlugin, b as LogicalKey, M as ManifestFile, N as NormalizedManifest, T as ToEnvOptions, c as ToPublicEnvOptions } from '../plugin-B4xwySxw.js';
|
|
3
|
+
export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-CvhGAfsB.js';
|
|
4
4
|
|
|
5
5
|
declare function planDump(graph: ResolvedGraph, options?: DumpPlanOptions): DumpPlan;
|
|
6
6
|
declare function writeDump(graph: ResolvedGraph, options: DumpOptions): Promise<DumpResult>;
|
package/dist/configure/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCnos,
|
|
3
3
|
defaultPlugins
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-RYGSG3GR.js";
|
|
5
|
+
import "../chunk-J4K4JUJL.js";
|
|
6
|
+
import "../chunk-T6Y57KTT.js";
|
|
7
|
+
import "../chunk-WCHX2QFY.js";
|
|
8
|
+
import "../chunk-FWJC4Y2D.js";
|
|
9
|
+
import "../chunk-ZTPSFXWP.js";
|
|
10
|
+
import "../chunk-HMM76UYZ.js";
|
|
11
11
|
import {
|
|
12
12
|
planDump,
|
|
13
13
|
toEnv,
|
|
14
14
|
toPublicEnv,
|
|
15
15
|
writeDump
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-APIU4GTB.js";
|
|
17
17
|
export {
|
|
18
18
|
createCnos,
|
|
19
19
|
defaultPlugins,
|
package/dist/index.cjs
CHANGED
|
@@ -295,6 +295,11 @@ var DEFAULT_NAMESPACES = {
|
|
|
295
295
|
shareable: false,
|
|
296
296
|
readonly: true
|
|
297
297
|
},
|
|
298
|
+
process: {
|
|
299
|
+
kind: "system",
|
|
300
|
+
shareable: false,
|
|
301
|
+
readonly: true
|
|
302
|
+
},
|
|
298
303
|
public: {
|
|
299
304
|
kind: "projection",
|
|
300
305
|
source: "promote",
|
|
@@ -954,12 +959,15 @@ async function exists2(targetPath) {
|
|
|
954
959
|
return false;
|
|
955
960
|
}
|
|
956
961
|
}
|
|
957
|
-
async function resolveLocalWorkspaceRoot(manifestRoot, workspaceId) {
|
|
962
|
+
async function resolveLocalWorkspaceRoot(manifestRoot, workspaceId, manifest) {
|
|
958
963
|
const workspaceRoot = import_node_path5.default.join(manifestRoot, "workspaces", workspaceId);
|
|
959
964
|
if (await exists2(workspaceRoot)) {
|
|
960
965
|
return workspaceRoot;
|
|
961
966
|
}
|
|
962
|
-
const
|
|
967
|
+
const customDataNamespaceRoots = Object.entries(manifest.namespaces).filter(
|
|
968
|
+
([namespace, definition]) => namespace !== "value" && namespace !== "secret" && definition.kind === "data" && !definition.sensitive
|
|
969
|
+
).map(([namespace]) => namespace);
|
|
970
|
+
const legacyMarkers = ["values", "secrets", "env", "profiles", ...customDataNamespaceRoots].map(
|
|
963
971
|
(segment) => import_node_path5.default.join(manifestRoot, segment)
|
|
964
972
|
);
|
|
965
973
|
if ((await Promise.all(legacyMarkers.map((marker) => exists2(marker)))).some(Boolean)) {
|
|
@@ -1046,7 +1054,7 @@ async function resolveWorkspaceContext(manifest, options) {
|
|
|
1046
1054
|
workspaceRoots.push({
|
|
1047
1055
|
scope: "local",
|
|
1048
1056
|
workspaceId: chainWorkspaceId,
|
|
1049
|
-
path: await resolveLocalWorkspaceRoot(options.manifestRoot, chainWorkspaceId)
|
|
1057
|
+
path: await resolveLocalWorkspaceRoot(options.manifestRoot, chainWorkspaceId, manifest)
|
|
1050
1058
|
});
|
|
1051
1059
|
}
|
|
1052
1060
|
return {
|
|
@@ -1211,6 +1219,7 @@ async function runPipeline(options) {
|
|
|
1211
1219
|
const collectedEntries = await Promise.all(
|
|
1212
1220
|
options.plugins.map(
|
|
1213
1221
|
(plugin) => plugin.load({
|
|
1222
|
+
manifest: options.manifest,
|
|
1214
1223
|
manifestConfig: {
|
|
1215
1224
|
...options.manifest.sources[plugin.id] ?? {},
|
|
1216
1225
|
envMapping: options.manifest.envMapping
|
|
@@ -2309,7 +2318,7 @@ function envVarToLogicalKey(envVar, config = {}) {
|
|
|
2309
2318
|
// package.json
|
|
2310
2319
|
var package_default = {
|
|
2311
2320
|
name: "@kitsy/cnos",
|
|
2312
|
-
version: "1.
|
|
2321
|
+
version: "1.5.0",
|
|
2313
2322
|
description: "Batteries-included CNOS runtime package wired with the official plugins.",
|
|
2314
2323
|
type: "module",
|
|
2315
2324
|
main: "./dist/index.cjs",
|
|
@@ -2783,11 +2792,30 @@ function createFilesystemValuesPlugin() {
|
|
|
2783
2792
|
sourceRoot,
|
|
2784
2793
|
context.profileActivation.values
|
|
2785
2794
|
);
|
|
2795
|
+
const customNamespaces = Object.entries(context.manifest.namespaces).filter(
|
|
2796
|
+
([namespace, definition]) => namespace !== "value" && namespace !== "secret" && definition.kind === "data" && !definition.sensitive
|
|
2797
|
+
).map(([namespace]) => namespace);
|
|
2786
2798
|
const entries = [];
|
|
2787
2799
|
for (const file of files) {
|
|
2788
2800
|
const document = await (0, import_promises13.readFile)(file.absolutePath, "utf8");
|
|
2789
2801
|
entries.push(...filesystemValuesReader(file.relativePath, document, file.workspaceId));
|
|
2790
2802
|
}
|
|
2803
|
+
for (const namespace of customNamespaces) {
|
|
2804
|
+
const layers = [
|
|
2805
|
+
namespace,
|
|
2806
|
+
...context.profileChain.filter((profile) => profile !== "base").map((profile) => `profiles/${profile}/${namespace}`)
|
|
2807
|
+
];
|
|
2808
|
+
const namespaceFiles = await collectFilesystemLayerFiles(
|
|
2809
|
+
context.manifestRoot,
|
|
2810
|
+
context.workspace.workspaceRoots,
|
|
2811
|
+
sourceRoot,
|
|
2812
|
+
layers
|
|
2813
|
+
);
|
|
2814
|
+
for (const file of namespaceFiles) {
|
|
2815
|
+
const document = await (0, import_promises13.readFile)(file.absolutePath, "utf8");
|
|
2816
|
+
entries.push(...yamlObjectToEntries(document, file.relativePath, namespace, "filesystem-values", file.workspaceId));
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2791
2819
|
return entries;
|
|
2792
2820
|
}
|
|
2793
2821
|
};
|
|
@@ -2795,6 +2823,11 @@ function createFilesystemValuesPlugin() {
|
|
|
2795
2823
|
|
|
2796
2824
|
// ../../plugins/process-env/src/index.ts
|
|
2797
2825
|
var PROCESS_ENV_PLUGIN_ID = "@kitsy/cnos/plugins/process-env";
|
|
2826
|
+
var PROCESS_GRAPH_OMIT = /* @__PURE__ */ new Set([
|
|
2827
|
+
"__CNOS_GRAPH__",
|
|
2828
|
+
"__CNOS_SECRET_PAYLOAD__",
|
|
2829
|
+
"__CNOS_SESSION_KEY__"
|
|
2830
|
+
]);
|
|
2798
2831
|
function processEnvEntriesFromObject(env, mapping = {}, workspaceId = "default") {
|
|
2799
2832
|
return Object.entries(env).flatMap(([envVar, value]) => {
|
|
2800
2833
|
if (typeof value !== "string") {
|
|
@@ -2819,17 +2852,77 @@ function processEnvEntriesFromObject(env, mapping = {}, workspaceId = "default")
|
|
|
2819
2852
|
];
|
|
2820
2853
|
});
|
|
2821
2854
|
}
|
|
2855
|
+
function processNamespaceEntriesFromContext(env, workspaceId = "default") {
|
|
2856
|
+
const envEntries = Object.entries(env).filter((entry) => typeof entry[1] === "string").filter(([envVar]) => !PROCESS_GRAPH_OMIT.has(envVar)).map(([envVar, value]) => ({
|
|
2857
|
+
key: `process.env.${envVar}`,
|
|
2858
|
+
value,
|
|
2859
|
+
namespace: "process",
|
|
2860
|
+
sourceId: "process-runtime",
|
|
2861
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2862
|
+
workspaceId,
|
|
2863
|
+
origin: {
|
|
2864
|
+
envVar
|
|
2865
|
+
}
|
|
2866
|
+
}));
|
|
2867
|
+
const runtimeEntries = [
|
|
2868
|
+
{
|
|
2869
|
+
key: "process.cwd",
|
|
2870
|
+
value: process.cwd(),
|
|
2871
|
+
namespace: "process",
|
|
2872
|
+
sourceId: "process-runtime",
|
|
2873
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2874
|
+
workspaceId
|
|
2875
|
+
},
|
|
2876
|
+
{
|
|
2877
|
+
key: "process.platform",
|
|
2878
|
+
value: process.platform,
|
|
2879
|
+
namespace: "process",
|
|
2880
|
+
sourceId: "process-runtime",
|
|
2881
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2882
|
+
workspaceId
|
|
2883
|
+
},
|
|
2884
|
+
{
|
|
2885
|
+
key: "process.arch",
|
|
2886
|
+
value: process.arch,
|
|
2887
|
+
namespace: "process",
|
|
2888
|
+
sourceId: "process-runtime",
|
|
2889
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2890
|
+
workspaceId
|
|
2891
|
+
},
|
|
2892
|
+
{
|
|
2893
|
+
key: "process.node.version",
|
|
2894
|
+
value: process.version,
|
|
2895
|
+
namespace: "process",
|
|
2896
|
+
sourceId: "process-runtime",
|
|
2897
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2898
|
+
workspaceId
|
|
2899
|
+
},
|
|
2900
|
+
{
|
|
2901
|
+
key: "process.args.raw",
|
|
2902
|
+
value: process.argv.slice(2),
|
|
2903
|
+
namespace: "process",
|
|
2904
|
+
sourceId: "process-runtime",
|
|
2905
|
+
pluginId: PROCESS_ENV_PLUGIN_ID,
|
|
2906
|
+
workspaceId
|
|
2907
|
+
}
|
|
2908
|
+
];
|
|
2909
|
+
return [...runtimeEntries, ...envEntries];
|
|
2910
|
+
}
|
|
2822
2911
|
function createProcessEnvPlugin() {
|
|
2823
2912
|
return {
|
|
2824
2913
|
id: "process-env",
|
|
2825
2914
|
kind: "loader",
|
|
2826
2915
|
async load(context) {
|
|
2827
2916
|
const config = context.manifestConfig;
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2917
|
+
const env = context.processEnv ?? process.env;
|
|
2918
|
+
return [
|
|
2919
|
+
...processEnvEntriesFromObject(
|
|
2920
|
+
env,
|
|
2921
|
+
config.envMapping,
|
|
2922
|
+
context.workspace.workspaceId
|
|
2923
|
+
),
|
|
2924
|
+
...processNamespaceEntriesFromContext(env, context.workspace.workspaceId)
|
|
2925
|
+
];
|
|
2833
2926
|
}
|
|
2834
2927
|
};
|
|
2835
2928
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { CnosSingleton, default as cnos, default } from './runtime/index.cjs';
|
|
2
|
-
export { h as CnosPlugin, g as CnosRuntime, a as ConfigEntry, I as InspectResult, L as LoaderPlugin, b as LogicalKey, M as ManifestFile, N as NormalizedManifest } from './plugin-
|
|
2
|
+
export { h as CnosPlugin, g as CnosRuntime, a as ConfigEntry, I as InspectResult, L as LoaderPlugin, b as LogicalKey, M as ManifestFile, N as NormalizedManifest } from './plugin-B4xwySxw.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { CnosSingleton, default as cnos, default } from './runtime/index.js';
|
|
2
|
-
export { h as CnosPlugin, g as CnosRuntime, a as ConfigEntry, I as InspectResult, L as LoaderPlugin, b as LogicalKey, M as ManifestFile, N as NormalizedManifest } from './plugin-
|
|
2
|
+
export { h as CnosPlugin, g as CnosRuntime, a as ConfigEntry, I as InspectResult, L as LoaderPlugin, b as LogicalKey, M as ManifestFile, N as NormalizedManifest } from './plugin-B4xwySxw.js';
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runtime_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-TO76YYS4.js";
|
|
4
|
+
import "./chunk-EQSKV3DP.js";
|
|
5
|
+
import "./chunk-RYGSG3GR.js";
|
|
6
|
+
import "./chunk-J4K4JUJL.js";
|
|
7
|
+
import "./chunk-T6Y57KTT.js";
|
|
8
|
+
import "./chunk-WCHX2QFY.js";
|
|
9
|
+
import "./chunk-FWJC4Y2D.js";
|
|
10
|
+
import "./chunk-ZTPSFXWP.js";
|
|
11
|
+
import "./chunk-HMM76UYZ.js";
|
|
12
|
+
import "./chunk-APIU4GTB.js";
|
|
13
13
|
export {
|
|
14
14
|
runtime_default as cnos,
|
|
15
15
|
runtime_default as default
|
package/dist/internal.cjs
CHANGED
|
@@ -50,6 +50,7 @@ __export(internal_exports, {
|
|
|
50
50
|
flattenObject: () => flattenObject,
|
|
51
51
|
formatDriftReport: () => formatDriftReport,
|
|
52
52
|
generateCodegenContent: () => generateCodegenContent,
|
|
53
|
+
getNamespaceDefinition: () => getNamespaceDefinition,
|
|
53
54
|
getVaultPassphraseEnvVar: () => getVaultPassphraseEnvVar,
|
|
54
55
|
getVaultSessionKeyEnvVar: () => getVaultSessionKeyEnvVar,
|
|
55
56
|
graphRequiresSecretHydration: () => graphRequiresSecretHydration,
|
|
@@ -268,7 +269,7 @@ function expandHomePath(targetPath) {
|
|
|
268
269
|
return targetPath;
|
|
269
270
|
}
|
|
270
271
|
function resolveNamespaceDirectory(workspaceRoot, namespace, profile) {
|
|
271
|
-
const rootFolder = namespace === "value" ? "values" : "secrets";
|
|
272
|
+
const rootFolder = namespace === "value" ? "values" : namespace === "secret" ? "secrets" : namespace;
|
|
272
273
|
if (profile && profile !== "base") {
|
|
273
274
|
return import_node_path.default.resolve(workspaceRoot, "profiles", profile, rootFolder);
|
|
274
275
|
}
|
|
@@ -321,6 +322,11 @@ var DEFAULT_NAMESPACES = {
|
|
|
321
322
|
shareable: false,
|
|
322
323
|
readonly: true
|
|
323
324
|
},
|
|
325
|
+
process: {
|
|
326
|
+
kind: "system",
|
|
327
|
+
shareable: false,
|
|
328
|
+
readonly: true
|
|
329
|
+
},
|
|
324
330
|
public: {
|
|
325
331
|
kind: "projection",
|
|
326
332
|
source: "promote",
|
|
@@ -1775,6 +1781,9 @@ function isSchemaDefault(entry) {
|
|
|
1775
1781
|
function shouldTrackKey(key) {
|
|
1776
1782
|
return key.startsWith("value.") || key.startsWith("secret.");
|
|
1777
1783
|
}
|
|
1784
|
+
function isTransientRuntimeSource(entry) {
|
|
1785
|
+
return entry.winner.sourceId === "process-env" || entry.winner.sourceId === "cli-args";
|
|
1786
|
+
}
|
|
1778
1787
|
function compareSchemaToGraph(runtime) {
|
|
1779
1788
|
const schema = runtime.manifest.schema;
|
|
1780
1789
|
const missing = [];
|
|
@@ -1814,7 +1823,9 @@ function compareSchemaToGraph(runtime) {
|
|
|
1814
1823
|
});
|
|
1815
1824
|
}
|
|
1816
1825
|
}
|
|
1817
|
-
const undeclared = Array.from(runtime.graph.entries.values()).filter(
|
|
1826
|
+
const undeclared = Array.from(runtime.graph.entries.values()).filter(
|
|
1827
|
+
(entry) => shouldTrackKey(entry.key) && !schema[entry.key] && !isSchemaDefault(entry) && !isTransientRuntimeSource(entry)
|
|
1828
|
+
).map((entry) => {
|
|
1818
1829
|
const issue = {
|
|
1819
1830
|
key: entry.key,
|
|
1820
1831
|
value: entry.winner.value,
|
|
@@ -2149,6 +2160,7 @@ async function watchFiles(runtime, root) {
|
|
|
2149
2160
|
flattenObject,
|
|
2150
2161
|
formatDriftReport,
|
|
2151
2162
|
generateCodegenContent,
|
|
2163
|
+
getNamespaceDefinition,
|
|
2152
2164
|
getVaultPassphraseEnvVar,
|
|
2153
2165
|
getVaultSessionKeyEnvVar,
|
|
2154
2166
|
graphRequiresSecretHydration,
|