@kitsy/cnos 1.6.1 → 1.7.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/dist/build/index.cjs +1332 -156
- package/dist/build/index.d.cts +1 -1
- package/dist/build/index.d.ts +1 -1
- package/dist/build/index.js +36 -14
- package/dist/{chunk-JYWQFMW5.js → chunk-2DGT7N7E.js} +1 -1
- package/dist/{chunk-S7H2UULC.js → chunk-2TL42I6M.js} +1323 -139
- package/dist/{chunk-MW4OVAT3.js → chunk-5KIQCYFH.js} +1 -1
- package/dist/{chunk-N32UN66E.js → chunk-CV3SLBYZ.js} +8 -8
- package/dist/{chunk-XSUP7JKH.js → chunk-GHGJFRDL.js} +6 -2
- package/dist/{chunk-BMAD24KC.js → chunk-OA7FQGAG.js} +1 -1
- package/dist/{chunk-6FAX2VKQ.js → chunk-PFT56ID2.js} +195 -28
- package/dist/{chunk-VGZREX5D.js → chunk-RYIARE4M.js} +1 -1
- package/dist/{chunk-UR7CHHNN.js → chunk-TT4NV56Z.js} +3 -2
- package/dist/{chunk-UJBQS7CJ.js → chunk-UL63DFLS.js} +1 -1
- package/dist/configure/index.cjs +1309 -155
- 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/{plugin-CKrBlWGI.d.cts → core-BJ8xewez.d.cts} +142 -60
- package/dist/{plugin-CKrBlWGI.d.ts → core-BJ8xewez.d.ts} +142 -60
- package/dist/{envNaming-B7Mztkcf.d.ts → envNaming-BRyiuPoI.d.ts} +1 -1
- package/dist/{envNaming-gMVnPOfe.d.cts → envNaming-rx71gpi0.d.cts} +1 -1
- package/dist/index.cjs +1548 -227
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -10
- package/dist/internal.cjs +831 -122
- package/dist/internal.d.cts +56 -3
- package/dist/internal.d.ts +56 -3
- package/dist/internal.js +30 -3
- package/dist/plugin/basic-schema.cjs +49 -23
- 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 +38 -23
- 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 +46 -31
- 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 +56 -27
- 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 +61 -39
- 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 +40 -25
- 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/runtime/index.cjs +1548 -227
- package/dist/runtime/index.d.cts +3 -1
- package/dist/runtime/index.d.ts +3 -1
- package/dist/runtime/index.js +10 -10
- package/dist/toPublicEnv-CCSgdvI9.d.ts +13 -0
- package/dist/toPublicEnv-ivRtLjcw.d.cts +13 -0
- package/package.json +1 -1
- package/dist/toPublicEnv-CmBsy53P.d.cts +0 -7
- package/dist/toPublicEnv-q6VwWxXZ.d.ts +0 -7
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createEnvExportPlugin,
|
|
3
3
|
createPublicEnvExportPlugin
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RYIARE4M.js";
|
|
5
5
|
import {
|
|
6
6
|
createFilesystemSecretsPlugin,
|
|
7
7
|
createFilesystemValuesPlugin
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TT4NV56Z.js";
|
|
9
9
|
import {
|
|
10
10
|
createProcessEnvPlugin
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-UL63DFLS.js";
|
|
12
12
|
import {
|
|
13
13
|
createBasicSchemaPlugin
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5KIQCYFH.js";
|
|
15
15
|
import {
|
|
16
16
|
createCliArgsPlugin
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-2DGT7N7E.js";
|
|
18
18
|
import {
|
|
19
19
|
createDotenvPlugin
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-OA7FQGAG.js";
|
|
21
21
|
import {
|
|
22
22
|
createCnos,
|
|
23
23
|
createProvenanceInspector
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-2TL42I6M.js";
|
|
25
25
|
|
|
26
26
|
// src/defaultPlugins.ts
|
|
27
27
|
function defaultPlugins() {
|
|
@@ -68,7 +68,7 @@ function setBootstrappedSecretHydrationRequired(value) {
|
|
|
68
68
|
// package.json
|
|
69
69
|
var package_default = {
|
|
70
70
|
name: "@kitsy/cnos",
|
|
71
|
-
version: "1.
|
|
71
|
+
version: "1.7.0",
|
|
72
72
|
description: "Batteries-included CNOS runtime package wired with the official plugins.",
|
|
73
73
|
type: "module",
|
|
74
74
|
main: "./dist/index.cjs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isSecretReference
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2TL42I6M.js";
|
|
4
4
|
|
|
5
5
|
// src/runtime/bootstrap.ts
|
|
6
6
|
import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
|
|
@@ -16,7 +16,11 @@ function deserializeServerProjection(source) {
|
|
|
16
16
|
if (!payload || payload.version !== 1 || typeof payload.workspace !== "string" || typeof payload.profile !== "string" || typeof payload.resolvedAt !== "string" || typeof payload.configHash !== "string" || !payload.values || typeof payload.values !== "object" || Array.isArray(payload.values) || !payload.secretRefs || typeof payload.secretRefs !== "object" || Array.isArray(payload.secretRefs) || !Array.isArray(payload.publicKeys) || !payload.meta || typeof payload.meta !== "object") {
|
|
17
17
|
throw new Error("Invalid CNOS server projection payload");
|
|
18
18
|
}
|
|
19
|
-
return
|
|
19
|
+
return {
|
|
20
|
+
...payload,
|
|
21
|
+
derived: payload.derived && typeof payload.derived === "object" && !Array.isArray(payload.derived) ? payload.derived : {},
|
|
22
|
+
runtimeNamespaces: Array.isArray(payload.runtimeNamespaces) ? payload.runtimeNamespaces : []
|
|
23
|
+
};
|
|
20
24
|
}
|
|
21
25
|
function serializeRuntimeGraph(graph) {
|
|
22
26
|
const payload = {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
graphRequiresSecretHydration,
|
|
4
4
|
readRuntimeGraphFromEnv,
|
|
5
5
|
readServerProjectionFromEnv
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GHGJFRDL.js";
|
|
7
7
|
import {
|
|
8
8
|
createCnos,
|
|
9
9
|
getBootstrappedSecretHydrationRequired,
|
|
@@ -12,19 +12,23 @@ import {
|
|
|
12
12
|
setBootstrappedSecretHydrationRequired,
|
|
13
13
|
setSingletonReady,
|
|
14
14
|
setSingletonRuntime
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CV3SLBYZ.js";
|
|
16
16
|
import {
|
|
17
|
+
createDefaultRuntimeProviders,
|
|
18
|
+
createDerivedRuntimeSupport,
|
|
17
19
|
createSecretVaultProvider,
|
|
18
20
|
inspectValue,
|
|
19
|
-
|
|
21
|
+
isDerivedValue,
|
|
22
|
+
parseDerivation,
|
|
20
23
|
readValue,
|
|
24
|
+
registerRuntimeProvider,
|
|
21
25
|
requireValue,
|
|
22
26
|
resolveVaultAuth,
|
|
23
27
|
toEnv,
|
|
24
28
|
toLogicalKey,
|
|
25
29
|
toNamespaceObject,
|
|
26
30
|
toPublicEnv
|
|
27
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-2TL42I6M.js";
|
|
28
32
|
|
|
29
33
|
// src/runtime/index.ts
|
|
30
34
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -68,6 +72,27 @@ function formatMessage(runtime, message) {
|
|
|
68
72
|
return value === void 0 ? match : stringifyLogValue(value);
|
|
69
73
|
});
|
|
70
74
|
}
|
|
75
|
+
function discoverRuntimeNamespacesFromGraph(graph) {
|
|
76
|
+
const configNamespaces = /* @__PURE__ */ new Set(["value", "secret", "meta", "public"]);
|
|
77
|
+
for (const entry of graph.entries.values()) {
|
|
78
|
+
configNamespaces.add(entry.namespace);
|
|
79
|
+
}
|
|
80
|
+
const runtimeNamespaces = /* @__PURE__ */ new Set();
|
|
81
|
+
for (const entry of graph.entries.values()) {
|
|
82
|
+
if (!isDerivedValue(entry.value)) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const parsed = parseDerivation(entry.value);
|
|
86
|
+
for (const ref of parsed.refs) {
|
|
87
|
+
const namespace = ref.split(".")[0] ?? "";
|
|
88
|
+
if (!namespace || configNamespaces.has(namespace)) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
runtimeNamespaces.add(namespace);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return Array.from(runtimeNamespaces).sort((left, right) => left.localeCompare(right));
|
|
95
|
+
}
|
|
71
96
|
function attachBootstrappedGraph(graph) {
|
|
72
97
|
if (getSingletonRuntime()) {
|
|
73
98
|
return;
|
|
@@ -114,6 +139,21 @@ function attachBootstrappedGraph(graph) {
|
|
|
114
139
|
frameworks: {}
|
|
115
140
|
},
|
|
116
141
|
namespaces: {},
|
|
142
|
+
runtimeNamespaces: {
|
|
143
|
+
process: {
|
|
144
|
+
description: "Live process runtime values.",
|
|
145
|
+
serverOnly: true,
|
|
146
|
+
builtIn: true
|
|
147
|
+
},
|
|
148
|
+
...Object.fromEntries(
|
|
149
|
+
discoverRuntimeNamespacesFromGraph(graph).map((namespace) => [
|
|
150
|
+
namespace,
|
|
151
|
+
{
|
|
152
|
+
serverOnly: true
|
|
153
|
+
}
|
|
154
|
+
])
|
|
155
|
+
)
|
|
156
|
+
},
|
|
117
157
|
vaults: {},
|
|
118
158
|
writePolicy: {
|
|
119
159
|
define: {
|
|
@@ -126,18 +166,36 @@ function attachBootstrappedGraph(graph) {
|
|
|
126
166
|
},
|
|
127
167
|
schema: {}
|
|
128
168
|
};
|
|
169
|
+
const runtimeProviders = createDefaultRuntimeProviders(bootstrappedManifest, process.env);
|
|
170
|
+
const derivedSupport = createDerivedRuntimeSupport(graph, bootstrappedManifest, runtimeProviders);
|
|
171
|
+
const resolveProjectedSourceKey = (key) => {
|
|
172
|
+
if (!key.startsWith("public.")) {
|
|
173
|
+
return key;
|
|
174
|
+
}
|
|
175
|
+
const promotedFrom = graph.entries.get(key)?.winner.metadata?.promotedFrom;
|
|
176
|
+
if (typeof promotedFrom === "string") {
|
|
177
|
+
return promotedFrom;
|
|
178
|
+
}
|
|
179
|
+
const fallback = `value.${key.slice("public.".length)}`;
|
|
180
|
+
return graph.entries.has(fallback) ? fallback : key;
|
|
181
|
+
};
|
|
129
182
|
const runtime = {
|
|
130
183
|
manifest: bootstrappedManifest,
|
|
131
184
|
plugins: [],
|
|
132
185
|
graph,
|
|
133
186
|
read(key) {
|
|
134
|
-
return readValue(graph,
|
|
187
|
+
return derivedSupport.read(key, (ref) => readValue(graph, ref));
|
|
135
188
|
},
|
|
136
189
|
require(key) {
|
|
137
|
-
|
|
190
|
+
const value = this.read(key);
|
|
191
|
+
if (value === void 0) {
|
|
192
|
+
return requireValue(graph, key);
|
|
193
|
+
}
|
|
194
|
+
return value;
|
|
138
195
|
},
|
|
139
196
|
readOr(key, fallback) {
|
|
140
|
-
|
|
197
|
+
const value = this.read(key);
|
|
198
|
+
return value === void 0 ? fallback : value;
|
|
141
199
|
},
|
|
142
200
|
value(path2) {
|
|
143
201
|
return readValue(graph, toLogicalKey("value", path2));
|
|
@@ -149,23 +207,35 @@ function attachBootstrappedGraph(graph) {
|
|
|
149
207
|
return readValue(graph, toLogicalKey("meta", path2));
|
|
150
208
|
},
|
|
151
209
|
toNamespace(namespace) {
|
|
152
|
-
return toNamespaceObject(graph, namespace);
|
|
210
|
+
return toNamespaceObject(graph, namespace, (key) => this.read(key));
|
|
153
211
|
},
|
|
154
212
|
toEnv(options) {
|
|
155
|
-
return toEnv(graph, bootstrappedManifest, options
|
|
213
|
+
return toEnv(graph, bootstrappedManifest, options, {
|
|
214
|
+
read: (key) => this.read(key),
|
|
215
|
+
isRuntimeDependent: (key) => derivedSupport.isRuntimeDependentKey(key)
|
|
216
|
+
});
|
|
156
217
|
},
|
|
157
218
|
toPublicEnv(options) {
|
|
158
|
-
return toPublicEnv(graph, bootstrappedManifest, options
|
|
219
|
+
return toPublicEnv(graph, bootstrappedManifest, options, {
|
|
220
|
+
read: (key) => derivedSupport.toConcreteValue(resolveProjectedSourceKey(key), (ref) => readValue(graph, ref), "public"),
|
|
221
|
+
isRuntimeDependent: (key) => derivedSupport.isRuntimeDependentKey(resolveProjectedSourceKey(key))
|
|
222
|
+
});
|
|
159
223
|
},
|
|
160
224
|
inspect(key) {
|
|
161
|
-
return inspectValue(graph, key
|
|
225
|
+
return inspectValue(graph, key, {
|
|
226
|
+
read: (ref) => this.read(ref),
|
|
227
|
+
describeDerived: (ref) => derivedSupport.describe(ref, (candidate) => readValue(graph, candidate))
|
|
228
|
+
});
|
|
162
229
|
},
|
|
163
230
|
toObject() {
|
|
164
|
-
return toNamespaceObject(graph);
|
|
231
|
+
return toNamespaceObject(graph, void 0, (key) => this.read(key));
|
|
165
232
|
},
|
|
166
233
|
toServerProjection() {
|
|
167
234
|
throw new Error("CNOS graph bootstrap payload does not support server projection export.");
|
|
168
235
|
},
|
|
236
|
+
registerRuntimeProvider(namespace, provider) {
|
|
237
|
+
registerRuntimeProvider(bootstrappedManifest, runtimeProviders, namespace, provider);
|
|
238
|
+
},
|
|
169
239
|
async refreshSecrets() {
|
|
170
240
|
return;
|
|
171
241
|
},
|
|
@@ -176,7 +246,7 @@ function attachBootstrappedGraph(graph) {
|
|
|
176
246
|
setSingletonRuntime(runtime);
|
|
177
247
|
setBootstrappedSecretHydrationRequired(graphRequiresSecretHydration(graph));
|
|
178
248
|
}
|
|
179
|
-
function toBootstrappedManifest(graph) {
|
|
249
|
+
function toBootstrappedManifest(graph, runtimeNamespaces = []) {
|
|
180
250
|
return {
|
|
181
251
|
version: 1,
|
|
182
252
|
project: {
|
|
@@ -219,8 +289,24 @@ function toBootstrappedManifest(graph) {
|
|
|
219
289
|
value: { kind: "data", shareable: true },
|
|
220
290
|
secret: { kind: "data", shareable: false, sensitive: true },
|
|
221
291
|
meta: { kind: "system", shareable: false, readonly: true },
|
|
292
|
+
process: { kind: "system", shareable: false, readonly: true },
|
|
222
293
|
public: { kind: "projection", shareable: true, readonly: true, source: "promote" }
|
|
223
294
|
},
|
|
295
|
+
runtimeNamespaces: {
|
|
296
|
+
process: {
|
|
297
|
+
description: "Live process runtime values.",
|
|
298
|
+
serverOnly: true,
|
|
299
|
+
builtIn: true
|
|
300
|
+
},
|
|
301
|
+
...Object.fromEntries(
|
|
302
|
+
runtimeNamespaces.filter((namespace) => namespace !== "process").map((namespace) => [
|
|
303
|
+
namespace,
|
|
304
|
+
{
|
|
305
|
+
serverOnly: true
|
|
306
|
+
}
|
|
307
|
+
])
|
|
308
|
+
)
|
|
309
|
+
},
|
|
224
310
|
vaults: {},
|
|
225
311
|
writePolicy: {
|
|
226
312
|
define: {
|
|
@@ -259,6 +345,31 @@ function graphFromProjection(projection) {
|
|
|
259
345
|
overridden: []
|
|
260
346
|
});
|
|
261
347
|
}
|
|
348
|
+
for (const [key, formula] of Object.entries(projection.derived)) {
|
|
349
|
+
const firstSegment = key.split(".")[0] ?? "";
|
|
350
|
+
const logicalKey = key.startsWith("value.") || key.startsWith("public.") || explicitNamespaces.has(firstSegment) ? key : `value.${key}`;
|
|
351
|
+
const namespace = logicalKey.slice(0, logicalKey.indexOf("."));
|
|
352
|
+
const winner = {
|
|
353
|
+
key: logicalKey,
|
|
354
|
+
value: {
|
|
355
|
+
$derive: {
|
|
356
|
+
expr: formula.expr
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
namespace,
|
|
360
|
+
sourceId: "server-projection",
|
|
361
|
+
pluginId: "cnos",
|
|
362
|
+
workspaceId: projection.workspace,
|
|
363
|
+
profile: projection.profile
|
|
364
|
+
};
|
|
365
|
+
entries.set(logicalKey, {
|
|
366
|
+
key: logicalKey,
|
|
367
|
+
value: winner.value,
|
|
368
|
+
namespace,
|
|
369
|
+
winner,
|
|
370
|
+
overridden: []
|
|
371
|
+
});
|
|
372
|
+
}
|
|
262
373
|
for (const [key, ref] of Object.entries(projection.secretRefs)) {
|
|
263
374
|
const logicalKey = `secret.${key}`;
|
|
264
375
|
entries.set(logicalKey, {
|
|
@@ -295,7 +406,10 @@ function graphFromProjection(projection) {
|
|
|
295
406
|
sourceId: "server-projection",
|
|
296
407
|
pluginId: "cnos",
|
|
297
408
|
workspaceId: projection.workspace,
|
|
298
|
-
profile: projection.profile
|
|
409
|
+
profile: projection.profile,
|
|
410
|
+
metadata: {
|
|
411
|
+
promotedFrom: valueKey
|
|
412
|
+
}
|
|
299
413
|
},
|
|
300
414
|
overridden: []
|
|
301
415
|
});
|
|
@@ -333,8 +447,21 @@ function attachBootstrappedProjection(projection, force = false) {
|
|
|
333
447
|
return;
|
|
334
448
|
}
|
|
335
449
|
const graph = graphFromProjection(projection);
|
|
336
|
-
const manifest = toBootstrappedManifest(graph);
|
|
450
|
+
const manifest = toBootstrappedManifest(graph, projection.runtimeNamespaces);
|
|
337
451
|
const hydratedSecrets = /* @__PURE__ */ new Map();
|
|
452
|
+
const runtimeProviders = createDefaultRuntimeProviders(manifest, process.env);
|
|
453
|
+
const derivedSupport = createDerivedRuntimeSupport(graph, manifest, runtimeProviders);
|
|
454
|
+
const resolveProjectedSourceKey = (key) => {
|
|
455
|
+
if (!key.startsWith("public.")) {
|
|
456
|
+
return key;
|
|
457
|
+
}
|
|
458
|
+
const promotedFrom = graph.entries.get(key)?.winner.metadata?.promotedFrom;
|
|
459
|
+
if (typeof promotedFrom === "string") {
|
|
460
|
+
return promotedFrom;
|
|
461
|
+
}
|
|
462
|
+
const fallback = `value.${key.slice("public.".length)}`;
|
|
463
|
+
return graph.entries.has(fallback) ? fallback : key;
|
|
464
|
+
};
|
|
338
465
|
const resolveSecretValue = async (key) => {
|
|
339
466
|
const entry = graph.entries.get(key);
|
|
340
467
|
if (!entry || entry.namespace !== "secret") {
|
|
@@ -360,14 +487,16 @@ function attachBootstrappedProjection(projection, force = false) {
|
|
|
360
487
|
plugins: [],
|
|
361
488
|
graph,
|
|
362
489
|
read(key) {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
490
|
+
return derivedSupport.read(key, (ref) => {
|
|
491
|
+
const entry = graph.entries.get(ref);
|
|
492
|
+
if (!entry) {
|
|
493
|
+
return void 0;
|
|
494
|
+
}
|
|
495
|
+
if (entry.namespace === "secret") {
|
|
496
|
+
return hydratedSecrets.get(ref);
|
|
497
|
+
}
|
|
498
|
+
return entry.value;
|
|
499
|
+
});
|
|
371
500
|
},
|
|
372
501
|
require(key) {
|
|
373
502
|
const value = this.read(key);
|
|
@@ -399,24 +528,59 @@ function attachBootstrappedProjection(projection, force = false) {
|
|
|
399
528
|
])
|
|
400
529
|
)
|
|
401
530
|
},
|
|
402
|
-
key
|
|
531
|
+
key,
|
|
532
|
+
{
|
|
533
|
+
read: (ref) => this.read(ref),
|
|
534
|
+
describeDerived: (ref) => derivedSupport.describe(ref, (candidate) => {
|
|
535
|
+
const entry = graph.entries.get(candidate);
|
|
536
|
+
if (!entry) {
|
|
537
|
+
return void 0;
|
|
538
|
+
}
|
|
539
|
+
if (entry.namespace === "secret") {
|
|
540
|
+
return hydratedSecrets.get(candidate);
|
|
541
|
+
}
|
|
542
|
+
return entry.value;
|
|
543
|
+
})
|
|
544
|
+
}
|
|
403
545
|
);
|
|
404
546
|
},
|
|
405
547
|
toObject() {
|
|
406
|
-
return toNamespaceObject(graph);
|
|
548
|
+
return toNamespaceObject(graph, void 0, (key) => this.read(key));
|
|
407
549
|
},
|
|
408
550
|
toNamespace(namespace) {
|
|
409
|
-
return toNamespaceObject(graph, namespace);
|
|
551
|
+
return toNamespaceObject(graph, namespace, (key) => this.read(key));
|
|
410
552
|
},
|
|
411
553
|
toEnv(options) {
|
|
412
|
-
return toEnv(graph, manifest, options
|
|
554
|
+
return toEnv(graph, manifest, options, {
|
|
555
|
+
read: (key) => this.read(key),
|
|
556
|
+
isRuntimeDependent: (key) => derivedSupport.isRuntimeDependentKey(key)
|
|
557
|
+
});
|
|
413
558
|
},
|
|
414
559
|
toPublicEnv(options) {
|
|
415
|
-
return toPublicEnv(graph, manifest, options
|
|
560
|
+
return toPublicEnv(graph, manifest, options, {
|
|
561
|
+
read: (key) => derivedSupport.toConcreteValue(
|
|
562
|
+
resolveProjectedSourceKey(key),
|
|
563
|
+
(ref) => {
|
|
564
|
+
const entry = graph.entries.get(ref);
|
|
565
|
+
if (!entry) {
|
|
566
|
+
return void 0;
|
|
567
|
+
}
|
|
568
|
+
if (entry.namespace === "secret") {
|
|
569
|
+
return hydratedSecrets.get(ref);
|
|
570
|
+
}
|
|
571
|
+
return entry.value;
|
|
572
|
+
},
|
|
573
|
+
"public"
|
|
574
|
+
),
|
|
575
|
+
isRuntimeDependent: (key) => derivedSupport.isRuntimeDependentKey(resolveProjectedSourceKey(key))
|
|
576
|
+
});
|
|
416
577
|
},
|
|
417
578
|
toServerProjection() {
|
|
418
579
|
return projection;
|
|
419
580
|
},
|
|
581
|
+
registerRuntimeProvider(namespace, provider) {
|
|
582
|
+
registerRuntimeProvider(manifest, runtimeProviders, namespace, provider);
|
|
583
|
+
},
|
|
420
584
|
async refreshSecrets() {
|
|
421
585
|
for (const key of Object.keys(projection.secretRefs).map((segment) => `secret.${segment}`)) {
|
|
422
586
|
hydratedSecrets.delete(key);
|
|
@@ -538,6 +702,9 @@ var cnos = Object.assign(
|
|
|
538
702
|
attachBootstrappedProjection(projection, true);
|
|
539
703
|
setBootstrappedSecretHydrationRequired(Object.keys(projection.secretRefs).length > 0);
|
|
540
704
|
},
|
|
705
|
+
registerRuntimeProvider(namespace, provider) {
|
|
706
|
+
getRuntimeOrThrow().registerRuntimeProvider(namespace, provider);
|
|
707
|
+
},
|
|
541
708
|
async refreshSecrets() {
|
|
542
709
|
await getRuntimeOrThrow().refreshSecrets();
|
|
543
710
|
setBootstrappedSecretHydrationRequired(false);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CnosManifestError,
|
|
3
|
+
isDerivedValue,
|
|
3
4
|
isSecretReference,
|
|
4
5
|
parseYaml,
|
|
5
6
|
toPortablePath
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2TL42I6M.js";
|
|
7
8
|
|
|
8
9
|
// ../../plugins/filesystem/src/helpers.ts
|
|
9
10
|
import { readdir } from "fs/promises";
|
|
@@ -65,7 +66,7 @@ function assertObjectDocument(value, filePath) {
|
|
|
65
66
|
function flattenConfigObject(value, options = {}, prefix = "") {
|
|
66
67
|
return Object.entries(value).reduce((accumulator, [key, nestedValue]) => {
|
|
67
68
|
const nextKey = prefix ? `${prefix}.${key}` : key;
|
|
68
|
-
if (nestedValue && typeof nestedValue === "object" && !Array.isArray(nestedValue) && !options.stopAtLeaf?.(nestedValue)) {
|
|
69
|
+
if (nestedValue && typeof nestedValue === "object" && !Array.isArray(nestedValue) && !isDerivedValue(nestedValue) && !options.stopAtLeaf?.(nestedValue)) {
|
|
69
70
|
Object.assign(
|
|
70
71
|
accumulator,
|
|
71
72
|
flattenConfigObject(nestedValue, options, nextKey)
|