@kitsy/cnos 1.5.1 → 1.6.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/dist/build/index.cjs +325 -113
- package/dist/build/index.d.cts +3 -2
- package/dist/build/index.d.ts +3 -2
- package/dist/build/index.js +13 -8
- package/dist/chunk-6FAX2VKQ.js +577 -0
- package/dist/{chunk-UWFE4JE2.js → chunk-BMAD24KC.js} +1 -1
- package/dist/{chunk-7EI3RFUE.js → chunk-JYWQFMW5.js} +1 -1
- package/dist/{chunk-F2ZAIZNH.js → chunk-MW4OVAT3.js} +1 -1
- package/dist/{chunk-CMQK2AEF.js → chunk-N32UN66E.js} +8 -8
- package/dist/{chunk-BS33AW4Y.js → chunk-S7H2UULC.js} +307 -103
- package/dist/{chunk-H53ZRQLX.js → chunk-UJBQS7CJ.js} +1 -1
- package/dist/{chunk-EJAXWFNT.js → chunk-UR7CHHNN.js} +1 -1
- package/dist/{chunk-SZKQVA2M.js → chunk-VGZREX5D.js} +1 -1
- package/dist/{chunk-5F2OFKND.js → chunk-XSUP7JKH.js} +23 -1
- package/dist/configure/index.cjs +324 -118
- 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-Dvm_LP2D.d.ts → envNaming-B7Mztkcf.d.ts} +1 -1
- package/dist/{envNaming-S4B-dHUx.d.cts → envNaming-gMVnPOfe.d.cts} +1 -1
- package/dist/index.cjs +698 -136
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -10
- package/dist/internal.cjs +227 -102
- package/dist/internal.d.cts +16 -28
- package/dist/internal.d.ts +16 -28
- package/dist/internal.js +11 -3
- package/dist/plugin/basic-schema.cjs +22 -15
- 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 +27 -18
- 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 +35 -26
- 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 +28 -19
- 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 +42 -33
- 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 +24 -17
- 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-B4xwySxw.d.cts → plugin-CKrBlWGI.d.cts} +52 -3
- package/dist/{plugin-B4xwySxw.d.ts → plugin-CKrBlWGI.d.ts} +52 -3
- package/dist/runtime/index.cjs +696 -136
- package/dist/runtime/index.d.cts +7 -1
- package/dist/runtime/index.d.ts +7 -1
- package/dist/runtime/index.js +10 -10
- package/dist/{toPublicEnv-ggmphZFs.d.cts → toPublicEnv-CmBsy53P.d.cts} +1 -1
- package/dist/{toPublicEnv-CvhGAfsB.d.ts → toPublicEnv-q6VwWxXZ.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-TUMR7JA3.js +0 -234
package/dist/runtime/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as LogicalKey, g as CnosRuntime, I as InspectResult } from '../plugin-
|
|
1
|
+
import { b as LogicalKey, g as CnosRuntime, I as InspectResult } from '../plugin-CKrBlWGI.cjs';
|
|
2
2
|
|
|
3
3
|
interface CnosSingleton {
|
|
4
4
|
<T = unknown>(key: LogicalKey): T | undefined;
|
|
@@ -14,6 +14,9 @@ interface CnosSingleton {
|
|
|
14
14
|
toPublicEnv(options?: Parameters<CnosRuntime['toPublicEnv']>[0]): ReturnType<CnosRuntime['toPublicEnv']>;
|
|
15
15
|
format(message: string): string;
|
|
16
16
|
log(message: string): string;
|
|
17
|
+
loadProjection(source: string): Promise<void>;
|
|
18
|
+
refreshSecrets(): Promise<void>;
|
|
19
|
+
refreshSecret(key: LogicalKey): Promise<void>;
|
|
17
20
|
ready(): Promise<void>;
|
|
18
21
|
}
|
|
19
22
|
declare const cnos: CnosSingleton & {
|
|
@@ -29,6 +32,9 @@ declare const cnos: CnosSingleton & {
|
|
|
29
32
|
toPublicEnv(options: Parameters<CnosRuntime["toPublicEnv"]>[0]): Record<string, string>;
|
|
30
33
|
format(message: string): string;
|
|
31
34
|
log(message: string): string;
|
|
35
|
+
loadProjection(source: string): Promise<void>;
|
|
36
|
+
refreshSecrets(): Promise<void>;
|
|
37
|
+
refreshSecret(key: LogicalKey): Promise<void>;
|
|
32
38
|
ready(): Promise<void>;
|
|
33
39
|
};
|
|
34
40
|
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as LogicalKey, g as CnosRuntime, I as InspectResult } from '../plugin-
|
|
1
|
+
import { b as LogicalKey, g as CnosRuntime, I as InspectResult } from '../plugin-CKrBlWGI.js';
|
|
2
2
|
|
|
3
3
|
interface CnosSingleton {
|
|
4
4
|
<T = unknown>(key: LogicalKey): T | undefined;
|
|
@@ -14,6 +14,9 @@ interface CnosSingleton {
|
|
|
14
14
|
toPublicEnv(options?: Parameters<CnosRuntime['toPublicEnv']>[0]): ReturnType<CnosRuntime['toPublicEnv']>;
|
|
15
15
|
format(message: string): string;
|
|
16
16
|
log(message: string): string;
|
|
17
|
+
loadProjection(source: string): Promise<void>;
|
|
18
|
+
refreshSecrets(): Promise<void>;
|
|
19
|
+
refreshSecret(key: LogicalKey): Promise<void>;
|
|
17
20
|
ready(): Promise<void>;
|
|
18
21
|
}
|
|
19
22
|
declare const cnos: CnosSingleton & {
|
|
@@ -29,6 +32,9 @@ declare const cnos: CnosSingleton & {
|
|
|
29
32
|
toPublicEnv(options: Parameters<CnosRuntime["toPublicEnv"]>[0]): Record<string, string>;
|
|
30
33
|
format(message: string): string;
|
|
31
34
|
log(message: string): string;
|
|
35
|
+
loadProjection(source: string): Promise<void>;
|
|
36
|
+
refreshSecrets(): Promise<void>;
|
|
37
|
+
refreshSecret(key: LogicalKey): Promise<void>;
|
|
32
38
|
ready(): Promise<void>;
|
|
33
39
|
};
|
|
34
40
|
|
package/dist/runtime/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-6FAX2VKQ.js";
|
|
4
|
+
import "../chunk-XSUP7JKH.js";
|
|
5
|
+
import "../chunk-N32UN66E.js";
|
|
6
|
+
import "../chunk-VGZREX5D.js";
|
|
7
|
+
import "../chunk-UR7CHHNN.js";
|
|
8
|
+
import "../chunk-UJBQS7CJ.js";
|
|
9
|
+
import "../chunk-MW4OVAT3.js";
|
|
10
|
+
import "../chunk-JYWQFMW5.js";
|
|
11
|
+
import "../chunk-BMAD24KC.js";
|
|
12
|
+
import "../chunk-S7H2UULC.js";
|
|
13
13
|
export {
|
|
14
14
|
runtime_default as default
|
|
15
15
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ResolvedGraph, N as NormalizedManifest, T as ToEnvOptions, c as ToPublicEnvOptions } from './plugin-
|
|
1
|
+
import { R as ResolvedGraph, N as NormalizedManifest, T as ToEnvOptions, c as ToPublicEnvOptions } from './plugin-CKrBlWGI.cjs';
|
|
2
2
|
|
|
3
3
|
declare function toEnv(graph: ResolvedGraph, manifest: NormalizedManifest, options?: ToEnvOptions): Record<string, string>;
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ResolvedGraph, N as NormalizedManifest, T as ToEnvOptions, c as ToPublicEnvOptions } from './plugin-
|
|
1
|
+
import { R as ResolvedGraph, N as NormalizedManifest, T as ToEnvOptions, c as ToPublicEnvOptions } from './plugin-CKrBlWGI.js';
|
|
2
2
|
|
|
3
3
|
declare function toEnv(graph: ResolvedGraph, manifest: NormalizedManifest, options?: ToEnvOptions): Record<string, string>;
|
|
4
4
|
|
package/package.json
CHANGED
package/dist/chunk-TUMR7JA3.js
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
graphRequiresSecretHydration,
|
|
3
|
-
readRuntimeGraphFromEnv
|
|
4
|
-
} from "./chunk-5F2OFKND.js";
|
|
5
|
-
import {
|
|
6
|
-
createCnos,
|
|
7
|
-
getBootstrappedSecretHydrationRequired,
|
|
8
|
-
getSingletonReady,
|
|
9
|
-
getSingletonRuntime,
|
|
10
|
-
setBootstrappedSecretHydrationRequired,
|
|
11
|
-
setSingletonReady,
|
|
12
|
-
setSingletonRuntime
|
|
13
|
-
} from "./chunk-CMQK2AEF.js";
|
|
14
|
-
import {
|
|
15
|
-
inspectValue,
|
|
16
|
-
readOrValue,
|
|
17
|
-
readValue,
|
|
18
|
-
requireValue,
|
|
19
|
-
toEnv,
|
|
20
|
-
toLogicalKey,
|
|
21
|
-
toNamespaceObject,
|
|
22
|
-
toPublicEnv
|
|
23
|
-
} from "./chunk-BS33AW4Y.js";
|
|
24
|
-
|
|
25
|
-
// src/runtime/index.ts
|
|
26
|
-
var NOT_READY_MESSAGE = "CNOS not initialized. Call await cnos.ready() or use cnos run.";
|
|
27
|
-
function getRuntimeOrThrow() {
|
|
28
|
-
const runtime = getSingletonRuntime();
|
|
29
|
-
if (!runtime) {
|
|
30
|
-
throw new Error(NOT_READY_MESSAGE);
|
|
31
|
-
}
|
|
32
|
-
return runtime;
|
|
33
|
-
}
|
|
34
|
-
function stringifyLogValue(value) {
|
|
35
|
-
if (value === void 0) {
|
|
36
|
-
return "";
|
|
37
|
-
}
|
|
38
|
-
if (value === null) {
|
|
39
|
-
return "null";
|
|
40
|
-
}
|
|
41
|
-
if (typeof value === "string") {
|
|
42
|
-
return value;
|
|
43
|
-
}
|
|
44
|
-
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
45
|
-
return String(value);
|
|
46
|
-
}
|
|
47
|
-
return JSON.stringify(value);
|
|
48
|
-
}
|
|
49
|
-
function formatMessage(runtime, message) {
|
|
50
|
-
return message.replace(/\$\{([^}]+)\}/g, (match, rawKey) => {
|
|
51
|
-
const key = String(rawKey).trim();
|
|
52
|
-
if (!key) {
|
|
53
|
-
return match;
|
|
54
|
-
}
|
|
55
|
-
const value = runtime.read(key);
|
|
56
|
-
return value === void 0 ? match : stringifyLogValue(value);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
function attachBootstrappedGraph(graph) {
|
|
60
|
-
if (getSingletonRuntime()) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const bootstrappedManifest = {
|
|
64
|
-
version: 1,
|
|
65
|
-
project: {
|
|
66
|
-
name: "bootstrapped"
|
|
67
|
-
},
|
|
68
|
-
workspaces: {
|
|
69
|
-
global: {
|
|
70
|
-
enabled: Boolean(graph.workspace.globalRoot),
|
|
71
|
-
...graph.workspace.globalRoot ? {
|
|
72
|
-
root: graph.workspace.globalRoot
|
|
73
|
-
} : {},
|
|
74
|
-
allowWrite: false
|
|
75
|
-
},
|
|
76
|
-
items: {},
|
|
77
|
-
...graph.workspace.workspaceSource === "implicit" ? {} : {
|
|
78
|
-
default: graph.workspace.workspaceId
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
profiles: {
|
|
82
|
-
default: graph.profile,
|
|
83
|
-
resolveFrom: ["default"]
|
|
84
|
-
},
|
|
85
|
-
plugins: {
|
|
86
|
-
loaders: [],
|
|
87
|
-
resolver: "profile-aware",
|
|
88
|
-
validators: [],
|
|
89
|
-
exporters: [],
|
|
90
|
-
inspectors: []
|
|
91
|
-
},
|
|
92
|
-
sources: {},
|
|
93
|
-
resolution: {
|
|
94
|
-
precedence: [],
|
|
95
|
-
arrayPolicy: "replace"
|
|
96
|
-
},
|
|
97
|
-
envMapping: {
|
|
98
|
-
explicit: {}
|
|
99
|
-
},
|
|
100
|
-
public: {
|
|
101
|
-
promote: [],
|
|
102
|
-
frameworks: {}
|
|
103
|
-
},
|
|
104
|
-
namespaces: {},
|
|
105
|
-
vaults: {},
|
|
106
|
-
writePolicy: {
|
|
107
|
-
define: {
|
|
108
|
-
defaultProfile: graph.profile,
|
|
109
|
-
targets: {
|
|
110
|
-
value: "./values/app.yml",
|
|
111
|
-
secret: "./secrets/app.yml"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
schema: {}
|
|
116
|
-
};
|
|
117
|
-
const runtime = {
|
|
118
|
-
manifest: bootstrappedManifest,
|
|
119
|
-
plugins: [],
|
|
120
|
-
graph,
|
|
121
|
-
read(key) {
|
|
122
|
-
return readValue(graph, key);
|
|
123
|
-
},
|
|
124
|
-
require(key) {
|
|
125
|
-
return requireValue(graph, key);
|
|
126
|
-
},
|
|
127
|
-
readOr(key, fallback) {
|
|
128
|
-
return readOrValue(graph, key, fallback);
|
|
129
|
-
},
|
|
130
|
-
value(path) {
|
|
131
|
-
return readValue(graph, toLogicalKey("value", path));
|
|
132
|
-
},
|
|
133
|
-
secret(path) {
|
|
134
|
-
return readValue(graph, toLogicalKey("secret", path));
|
|
135
|
-
},
|
|
136
|
-
meta(path) {
|
|
137
|
-
return readValue(graph, toLogicalKey("meta", path));
|
|
138
|
-
},
|
|
139
|
-
toNamespace(namespace) {
|
|
140
|
-
return toNamespaceObject(graph, namespace);
|
|
141
|
-
},
|
|
142
|
-
toEnv(options) {
|
|
143
|
-
return toEnv(graph, bootstrappedManifest, options);
|
|
144
|
-
},
|
|
145
|
-
toPublicEnv(options) {
|
|
146
|
-
return toPublicEnv(graph, bootstrappedManifest, options);
|
|
147
|
-
},
|
|
148
|
-
inspect(key) {
|
|
149
|
-
return inspectValue(graph, key);
|
|
150
|
-
},
|
|
151
|
-
toObject() {
|
|
152
|
-
return toNamespaceObject(graph);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
setSingletonRuntime(runtime);
|
|
156
|
-
setBootstrappedSecretHydrationRequired(graphRequiresSecretHydration(graph));
|
|
157
|
-
}
|
|
158
|
-
function bootstrapFromProcessEnv() {
|
|
159
|
-
if (typeof process === "undefined") {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
try {
|
|
163
|
-
const graph = readRuntimeGraphFromEnv(process.env);
|
|
164
|
-
if (graph) {
|
|
165
|
-
attachBootstrappedGraph(graph);
|
|
166
|
-
}
|
|
167
|
-
} catch {
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
bootstrapFromProcessEnv();
|
|
171
|
-
var cnos = Object.assign(
|
|
172
|
-
((key) => readValue(getRuntimeOrThrow().graph, key)),
|
|
173
|
-
{
|
|
174
|
-
read(key) {
|
|
175
|
-
return readValue(getRuntimeOrThrow().graph, key);
|
|
176
|
-
},
|
|
177
|
-
require(key) {
|
|
178
|
-
return requireValue(getRuntimeOrThrow().graph, key);
|
|
179
|
-
},
|
|
180
|
-
readOr(key, fallback) {
|
|
181
|
-
return readOrValue(getRuntimeOrThrow().graph, key, fallback);
|
|
182
|
-
},
|
|
183
|
-
value(path) {
|
|
184
|
-
return readValue(getRuntimeOrThrow().graph, toLogicalKey("value", path));
|
|
185
|
-
},
|
|
186
|
-
secret(path) {
|
|
187
|
-
return readValue(getRuntimeOrThrow().graph, toLogicalKey("secret", path));
|
|
188
|
-
},
|
|
189
|
-
meta(path) {
|
|
190
|
-
return readValue(getRuntimeOrThrow().graph, toLogicalKey("meta", path));
|
|
191
|
-
},
|
|
192
|
-
inspect(key) {
|
|
193
|
-
return getRuntimeOrThrow().inspect(key);
|
|
194
|
-
},
|
|
195
|
-
toNamespace(namespace) {
|
|
196
|
-
return getRuntimeOrThrow().toNamespace(namespace);
|
|
197
|
-
},
|
|
198
|
-
toEnv(options) {
|
|
199
|
-
return getRuntimeOrThrow().toEnv(options);
|
|
200
|
-
},
|
|
201
|
-
toPublicEnv(options) {
|
|
202
|
-
return getRuntimeOrThrow().toPublicEnv(options);
|
|
203
|
-
},
|
|
204
|
-
format(message) {
|
|
205
|
-
return formatMessage(getRuntimeOrThrow(), message);
|
|
206
|
-
},
|
|
207
|
-
log(message) {
|
|
208
|
-
const formatted = formatMessage(getRuntimeOrThrow(), message);
|
|
209
|
-
console.log(formatted);
|
|
210
|
-
return formatted;
|
|
211
|
-
},
|
|
212
|
-
async ready() {
|
|
213
|
-
if (getSingletonRuntime() && !getBootstrappedSecretHydrationRequired()) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
const existing = getSingletonReady();
|
|
217
|
-
if (existing && !getBootstrappedSecretHydrationRequired()) {
|
|
218
|
-
await existing;
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
const readyPromise = createCnos().then((runtime) => {
|
|
222
|
-
setSingletonRuntime(runtime);
|
|
223
|
-
return runtime;
|
|
224
|
-
});
|
|
225
|
-
setSingletonReady(readyPromise);
|
|
226
|
-
await readyPromise;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
);
|
|
230
|
-
var runtime_default = cnos;
|
|
231
|
-
|
|
232
|
-
export {
|
|
233
|
-
runtime_default
|
|
234
|
-
};
|