@kitsy/cnos 1.5.1 → 1.6.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.
Files changed (62) hide show
  1. package/dist/build/index.cjs +325 -113
  2. package/dist/build/index.d.cts +3 -2
  3. package/dist/build/index.d.ts +3 -2
  4. package/dist/build/index.js +13 -8
  5. package/dist/{chunk-UWFE4JE2.js → chunk-BMAD24KC.js} +1 -1
  6. package/dist/{chunk-7EI3RFUE.js → chunk-JYWQFMW5.js} +1 -1
  7. package/dist/{chunk-F2ZAIZNH.js → chunk-MW4OVAT3.js} +1 -1
  8. package/dist/chunk-QU5CXL47.js +577 -0
  9. package/dist/{chunk-BS33AW4Y.js → chunk-S7H2UULC.js} +307 -103
  10. package/dist/{chunk-H53ZRQLX.js → chunk-UJBQS7CJ.js} +1 -1
  11. package/dist/{chunk-CMQK2AEF.js → chunk-UOKVLCFL.js} +10 -10
  12. package/dist/{chunk-EJAXWFNT.js → chunk-UR7CHHNN.js} +1 -1
  13. package/dist/{chunk-SZKQVA2M.js → chunk-VGZREX5D.js} +1 -1
  14. package/dist/{chunk-5F2OFKND.js → chunk-XSUP7JKH.js} +23 -1
  15. package/dist/configure/index.cjs +324 -118
  16. package/dist/configure/index.d.cts +3 -3
  17. package/dist/configure/index.d.ts +3 -3
  18. package/dist/configure/index.js +8 -8
  19. package/dist/{envNaming-Dvm_LP2D.d.ts → envNaming-B7Mztkcf.d.ts} +1 -1
  20. package/dist/{envNaming-S4B-dHUx.d.cts → envNaming-gMVnPOfe.d.cts} +1 -1
  21. package/dist/index.cjs +698 -136
  22. package/dist/index.d.cts +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +10 -10
  25. package/dist/internal.cjs +227 -102
  26. package/dist/internal.d.cts +16 -28
  27. package/dist/internal.d.ts +16 -28
  28. package/dist/internal.js +11 -3
  29. package/dist/plugin/basic-schema.cjs +22 -15
  30. package/dist/plugin/basic-schema.d.cts +1 -1
  31. package/dist/plugin/basic-schema.d.ts +1 -1
  32. package/dist/plugin/basic-schema.js +2 -2
  33. package/dist/plugin/cli-args.cjs +27 -18
  34. package/dist/plugin/cli-args.d.cts +1 -1
  35. package/dist/plugin/cli-args.d.ts +1 -1
  36. package/dist/plugin/cli-args.js +2 -2
  37. package/dist/plugin/dotenv.cjs +35 -26
  38. package/dist/plugin/dotenv.d.cts +2 -2
  39. package/dist/plugin/dotenv.d.ts +2 -2
  40. package/dist/plugin/dotenv.js +2 -2
  41. package/dist/plugin/env-export.cjs +28 -19
  42. package/dist/plugin/env-export.d.cts +2 -2
  43. package/dist/plugin/env-export.d.ts +2 -2
  44. package/dist/plugin/env-export.js +2 -2
  45. package/dist/plugin/filesystem.cjs +42 -33
  46. package/dist/plugin/filesystem.d.cts +1 -1
  47. package/dist/plugin/filesystem.d.ts +1 -1
  48. package/dist/plugin/filesystem.js +2 -2
  49. package/dist/plugin/process-env.cjs +24 -17
  50. package/dist/plugin/process-env.d.cts +2 -2
  51. package/dist/plugin/process-env.d.ts +2 -2
  52. package/dist/plugin/process-env.js +2 -2
  53. package/dist/{plugin-B4xwySxw.d.cts → plugin-CKrBlWGI.d.cts} +52 -3
  54. package/dist/{plugin-B4xwySxw.d.ts → plugin-CKrBlWGI.d.ts} +52 -3
  55. package/dist/runtime/index.cjs +696 -136
  56. package/dist/runtime/index.d.cts +7 -1
  57. package/dist/runtime/index.d.ts +7 -1
  58. package/dist/runtime/index.js +10 -10
  59. package/dist/{toPublicEnv-ggmphZFs.d.cts → toPublicEnv-CmBsy53P.d.cts} +1 -1
  60. package/dist/{toPublicEnv-CvhGAfsB.d.ts → toPublicEnv-q6VwWxXZ.d.ts} +1 -1
  61. package/package.json +1 -1
  62. package/dist/chunk-TUMR7JA3.js +0 -234
@@ -1,4 +1,4 @@
1
- import { b as LogicalKey, g as CnosRuntime, I as InspectResult } from '../plugin-B4xwySxw.cjs';
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
 
@@ -1,4 +1,4 @@
1
- import { b as LogicalKey, g as CnosRuntime, I as InspectResult } from '../plugin-B4xwySxw.js';
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
 
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  runtime_default
3
- } from "../chunk-TUMR7JA3.js";
4
- import "../chunk-5F2OFKND.js";
5
- import "../chunk-CMQK2AEF.js";
6
- import "../chunk-SZKQVA2M.js";
7
- import "../chunk-EJAXWFNT.js";
8
- import "../chunk-H53ZRQLX.js";
9
- import "../chunk-F2ZAIZNH.js";
10
- import "../chunk-7EI3RFUE.js";
11
- import "../chunk-UWFE4JE2.js";
12
- import "../chunk-BS33AW4Y.js";
3
+ } from "../chunk-QU5CXL47.js";
4
+ import "../chunk-XSUP7JKH.js";
5
+ import "../chunk-UOKVLCFL.js";
6
+ import "../chunk-BMAD24KC.js";
7
+ import "../chunk-VGZREX5D.js";
8
+ import "../chunk-UR7CHHNN.js";
9
+ import "../chunk-UJBQS7CJ.js";
10
+ import "../chunk-MW4OVAT3.js";
11
+ import "../chunk-JYWQFMW5.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-B4xwySxw.cjs';
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-B4xwySxw.js';
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitsy/cnos",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "Batteries-included CNOS runtime package wired with the official plugins.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -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
- };