@kitsy/cnos 1.5.0 → 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 +333 -117
  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-HMM76UYZ.js → chunk-BMAD24KC.js} +1 -1
  6. package/dist/{chunk-ZTPSFXWP.js → chunk-JYWQFMW5.js} +1 -1
  7. package/dist/{chunk-FWJC4Y2D.js → chunk-MW4OVAT3.js} +1 -1
  8. package/dist/chunk-QU5CXL47.js +577 -0
  9. package/dist/{chunk-APIU4GTB.js → chunk-S7H2UULC.js} +315 -107
  10. package/dist/{chunk-WCHX2QFY.js → chunk-UJBQS7CJ.js} +1 -1
  11. package/dist/{chunk-RYGSG3GR.js → chunk-UOKVLCFL.js} +10 -10
  12. package/dist/{chunk-T6Y57KTT.js → chunk-UR7CHHNN.js} +1 -1
  13. package/dist/{chunk-J4K4JUJL.js → chunk-VGZREX5D.js} +1 -1
  14. package/dist/{chunk-EQSKV3DP.js → chunk-XSUP7JKH.js} +23 -1
  15. package/dist/configure/index.cjs +332 -122
  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 +754 -143
  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 +229 -103
  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 +34 -22
  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 +752 -143
  56. package/dist/runtime/index.d.cts +19 -1
  57. package/dist/runtime/index.d.ts +19 -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-TO76YYS4.js +0 -189
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  envVarToLogicalKey
3
- } from "./chunk-APIU4GTB.js";
3
+ } from "./chunk-S7H2UULC.js";
4
4
 
5
5
  // ../../plugins/process-env/src/index.ts
6
6
  var PROCESS_ENV_PLUGIN_ID = "@kitsy/cnos/plugins/process-env";
@@ -1,27 +1,27 @@
1
+ import {
2
+ createDotenvPlugin
3
+ } from "./chunk-BMAD24KC.js";
1
4
  import {
2
5
  createEnvExportPlugin,
3
6
  createPublicEnvExportPlugin
4
- } from "./chunk-J4K4JUJL.js";
7
+ } from "./chunk-VGZREX5D.js";
5
8
  import {
6
9
  createFilesystemSecretsPlugin,
7
10
  createFilesystemValuesPlugin
8
- } from "./chunk-T6Y57KTT.js";
11
+ } from "./chunk-UR7CHHNN.js";
9
12
  import {
10
13
  createProcessEnvPlugin
11
- } from "./chunk-WCHX2QFY.js";
14
+ } from "./chunk-UJBQS7CJ.js";
12
15
  import {
13
16
  createBasicSchemaPlugin
14
- } from "./chunk-FWJC4Y2D.js";
17
+ } from "./chunk-MW4OVAT3.js";
15
18
  import {
16
19
  createCliArgsPlugin
17
- } from "./chunk-ZTPSFXWP.js";
18
- import {
19
- createDotenvPlugin
20
- } from "./chunk-HMM76UYZ.js";
20
+ } from "./chunk-JYWQFMW5.js";
21
21
  import {
22
22
  createCnos,
23
23
  createProvenanceInspector
24
- } from "./chunk-APIU4GTB.js";
24
+ } from "./chunk-S7H2UULC.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.5.0",
71
+ version: "1.6.0",
72
72
  description: "Batteries-included CNOS runtime package wired with the official plugins.",
73
73
  type: "module",
74
74
  main: "./dist/index.cjs",
@@ -3,7 +3,7 @@ import {
3
3
  isSecretReference,
4
4
  parseYaml,
5
5
  toPortablePath
6
- } from "./chunk-APIU4GTB.js";
6
+ } from "./chunk-S7H2UULC.js";
7
7
 
8
8
  // ../../plugins/filesystem/src/helpers.ts
9
9
  import { readdir } from "fs/promises";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  toEnv,
3
3
  toPublicEnv
4
- } from "./chunk-APIU4GTB.js";
4
+ } from "./chunk-S7H2UULC.js";
5
5
 
6
6
  // ../../plugins/env-export/src/index.ts
7
7
  function createEnvExportPlugin() {
@@ -1,12 +1,23 @@
1
1
  import {
2
2
  isSecretReference
3
- } from "./chunk-APIU4GTB.js";
3
+ } from "./chunk-S7H2UULC.js";
4
4
 
5
5
  // src/runtime/bootstrap.ts
6
6
  import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
7
7
  var CNOS_GRAPH_ENV_VAR = "__CNOS_GRAPH__";
8
+ var CNOS_PROJECTION_ENV_VAR = "__CNOS_PROJECTION__";
8
9
  var CNOS_SECRET_PAYLOAD_ENV_VAR = "__CNOS_SECRET_PAYLOAD__";
9
10
  var CNOS_SESSION_KEY_ENV_VAR = "__CNOS_SESSION_KEY__";
11
+ function serializeServerProjection(projection) {
12
+ return JSON.stringify(projection);
13
+ }
14
+ function deserializeServerProjection(source) {
15
+ const payload = JSON.parse(source);
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
+ throw new Error("Invalid CNOS server projection payload");
18
+ }
19
+ return payload;
20
+ }
10
21
  function serializeRuntimeGraph(graph) {
11
22
  const payload = {
12
23
  entries: Array.from(graph.entries.values()),
@@ -89,17 +100,28 @@ function readRuntimeGraphFromEnv(processEnv = process.env) {
89
100
  }
90
101
  return graph;
91
102
  }
103
+ function readServerProjectionFromEnv(processEnv = process.env) {
104
+ const serialized = processEnv[CNOS_PROJECTION_ENV_VAR];
105
+ if (!serialized) {
106
+ return void 0;
107
+ }
108
+ return deserializeServerProjection(serialized);
109
+ }
92
110
  function graphRequiresSecretHydration(graph) {
93
111
  return Array.from(graph.entries.values()).some((entry) => entry.namespace === "secret" && isSecretReference(entry.value));
94
112
  }
95
113
 
96
114
  export {
97
115
  CNOS_GRAPH_ENV_VAR,
116
+ CNOS_PROJECTION_ENV_VAR,
98
117
  CNOS_SECRET_PAYLOAD_ENV_VAR,
99
118
  CNOS_SESSION_KEY_ENV_VAR,
119
+ serializeServerProjection,
120
+ deserializeServerProjection,
100
121
  serializeRuntimeGraph,
101
122
  deserializeRuntimeGraph,
102
123
  serializeSecretPayload,
103
124
  readRuntimeGraphFromEnv,
125
+ readServerProjectionFromEnv,
104
126
  graphRequiresSecretHydration
105
127
  };