@kitsy/cnos 1.8.1 → 1.8.3

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 (55) hide show
  1. package/dist/build/index.cjs +37 -9
  2. package/dist/build/index.d.cts +1 -1
  3. package/dist/build/index.d.ts +1 -1
  4. package/dist/build/index.js +8 -8
  5. package/dist/{chunk-2DGT7N7E.js → chunk-36AR262B.js} +1 -1
  6. package/dist/{chunk-TT4NV56Z.js → chunk-4AAA2RHV.js} +1 -1
  7. package/dist/{chunk-FJOOJGUD.js → chunk-7MUDEJSP.js} +10 -10
  8. package/dist/{chunk-GHGJFRDL.js → chunk-DL5G3QSZ.js} +1 -1
  9. package/dist/{chunk-OA7FQGAG.js → chunk-EJT2VJTM.js} +1 -1
  10. package/dist/{chunk-RYIARE4M.js → chunk-JQLV4OQU.js} +1 -1
  11. package/dist/{chunk-5KIQCYFH.js → chunk-N5DX5QEB.js} +1 -1
  12. package/dist/{chunk-6IYR3LVA.js → chunk-SUMWGMRA.js} +11 -4
  13. package/dist/{chunk-UL63DFLS.js → chunk-UMVFSHP2.js} +1 -1
  14. package/dist/{chunk-2TL42I6M.js → chunk-ZH5QZQ7C.js} +36 -8
  15. package/dist/configure/index.cjs +37 -9
  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/{core-BJ8xewez.d.cts → core-zDTUSVx9.d.cts} +4 -2
  20. package/dist/{core-BJ8xewez.d.ts → core-zDTUSVx9.d.ts} +4 -2
  21. package/dist/{envNaming-BRyiuPoI.d.ts → envNaming-BkorOKW_.d.ts} +1 -1
  22. package/dist/{envNaming-rx71gpi0.d.cts → envNaming-EFzezmB3.d.cts} +1 -1
  23. package/dist/index.cjs +45 -10
  24. package/dist/index.d.cts +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +10 -10
  27. package/dist/internal.cjs +12 -5
  28. package/dist/internal.d.cts +2 -2
  29. package/dist/internal.d.ts +2 -2
  30. package/dist/internal.js +2 -2
  31. package/dist/plugin/basic-schema.d.cts +1 -1
  32. package/dist/plugin/basic-schema.d.ts +1 -1
  33. package/dist/plugin/basic-schema.js +2 -2
  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.d.cts +2 -2
  38. package/dist/plugin/dotenv.d.ts +2 -2
  39. package/dist/plugin/dotenv.js +2 -2
  40. package/dist/plugin/env-export.d.cts +2 -2
  41. package/dist/plugin/env-export.d.ts +2 -2
  42. package/dist/plugin/env-export.js +2 -2
  43. package/dist/plugin/filesystem.d.cts +1 -1
  44. package/dist/plugin/filesystem.d.ts +1 -1
  45. package/dist/plugin/filesystem.js +2 -2
  46. package/dist/plugin/process-env.d.cts +2 -2
  47. package/dist/plugin/process-env.d.ts +2 -2
  48. package/dist/plugin/process-env.js +2 -2
  49. package/dist/runtime/index.cjs +45 -10
  50. package/dist/runtime/index.d.cts +1 -1
  51. package/dist/runtime/index.d.ts +1 -1
  52. package/dist/runtime/index.js +10 -10
  53. package/dist/{toPublicEnv-CCSgdvI9.d.ts → toPublicEnv-CT265rzS.d.ts} +1 -1
  54. package/dist/{toPublicEnv-ivRtLjcw.d.cts → toPublicEnv-Ds1DRwCX.d.cts} +1 -1
  55. package/package.json +1 -1
@@ -46,7 +46,7 @@ interface WorkspaceContext {
46
46
  type ResolutionArrayPolicy = 'replace' | 'append' | 'unique-append';
47
47
  type NamespaceKind = 'data' | 'projection' | 'system';
48
48
  type NamespaceProjectionSource = 'promote' | 'envMapping';
49
- type VaultProviderName = 'local' | 'github-secrets' | (string & {});
49
+ type VaultProviderName = 'local' | 'environment' | 'github-secrets' | (string & {});
50
50
  type VaultAuthMethod = 'passphrase' | 'environment' | 'token' | 'iam' | 'keychain';
51
51
  interface RuntimeNamespaceDefinition {
52
52
  description?: string;
@@ -467,7 +467,9 @@ interface ServerProjection {
467
467
  configHash: string;
468
468
  values: Record<string, unknown>;
469
469
  derived: Record<string, DerivedFormula>;
470
- secretRefs: Record<string, SecretReference>;
470
+ secretRefs: Record<string, SecretReference & {
471
+ envVar?: string;
472
+ }>;
471
473
  publicKeys: string[];
472
474
  runtimeNamespaces: string[];
473
475
  meta: {
@@ -1,4 +1,4 @@
1
- import { N as NormalizedManifest, b as LogicalKey } from './core-BJ8xewez.js';
1
+ import { N as NormalizedManifest, b as LogicalKey } from './core-zDTUSVx9.js';
2
2
 
3
3
  interface EnvMappingConfig {
4
4
  convention?: NormalizedManifest['envMapping']['convention'];
@@ -1,4 +1,4 @@
1
- import { N as NormalizedManifest, b as LogicalKey } from './core-BJ8xewez.cjs';
1
+ import { N as NormalizedManifest, b as LogicalKey } from './core-zDTUSVx9.cjs';
2
2
 
3
3
  interface EnvMappingConfig {
4
4
  convention?: NormalizedManifest['envMapping']['convention'];
package/dist/index.cjs CHANGED
@@ -1519,7 +1519,7 @@ function normalizeVaultAuth(vaultName, provider, auth) {
1519
1519
  ...auth?.config ? { config: auth.config } : {}
1520
1520
  };
1521
1521
  }
1522
- if (provider === "github-secrets") {
1522
+ if (provider === "github-secrets" || provider === "environment") {
1523
1523
  return {
1524
1524
  method: auth?.method ?? "environment",
1525
1525
  ...auth?.config ? { config: auth.config } : {}
@@ -2623,7 +2623,7 @@ function resolveConfiguredVaultPassphrase(definition, vault = "default", process
2623
2623
  }
2624
2624
  async function resolveVaultAccessKey(storeRoot, definition, vault = "default", processEnv = process.env) {
2625
2625
  if (definition?.provider !== "local") {
2626
- return definition?.provider === "github-secrets" ? {
2626
+ return definition?.provider === "github-secrets" || definition?.provider === "environment" ? {
2627
2627
  method: definition.auth?.method ?? "environment",
2628
2628
  ...definition?.auth?.config ? { config: definition.auth.config } : {}
2629
2629
  } : void 0;
@@ -2781,8 +2781,8 @@ var SecretCache = class {
2781
2781
  }
2782
2782
  };
2783
2783
 
2784
- // ../core/src/secrets/providers/github.ts
2785
- var GithubSecretsVaultProvider = class {
2784
+ // ../core/src/secrets/providers/environment.ts
2785
+ var EnvironmentSecretsVaultProvider = class {
2786
2786
  constructor(vaultId, definition, processEnv = process.env) {
2787
2787
  this.vaultId = vaultId;
2788
2788
  this.definition = definition;
@@ -2836,6 +2836,10 @@ var GithubSecretsVaultProvider = class {
2836
2836
  }
2837
2837
  };
2838
2838
 
2839
+ // ../core/src/secrets/providers/github.ts
2840
+ var GithubSecretsVaultProvider = class extends EnvironmentSecretsVaultProvider {
2841
+ };
2842
+
2839
2843
  // ../core/src/secrets/providers/local.ts
2840
2844
  var LocalSecretVaultProvider = class _LocalSecretVaultProvider {
2841
2845
  constructor(vaultId, definition, processEnv = process.env, storeRoot = resolveSecretStoreRoot(processEnv)) {
@@ -2931,6 +2935,9 @@ function createSecretVaultProvider(vaultId, definition, processEnv) {
2931
2935
  if (definition.provider === "local") {
2932
2936
  return new LocalSecretVaultProvider(vaultId, definition, processEnv);
2933
2937
  }
2938
+ if (definition.provider === "environment") {
2939
+ return new EnvironmentSecretsVaultProvider(vaultId, definition, processEnv);
2940
+ }
2934
2941
  if (definition.provider === "github-secrets") {
2935
2942
  return new GithubSecretsVaultProvider(vaultId, definition, processEnv);
2936
2943
  }
@@ -2986,7 +2993,7 @@ async function resolveVaultAuth(vaultId, definition, processEnv = process.env) {
2986
2993
  ...definition.auth?.config ? { config: definition.auth.config } : {}
2987
2994
  };
2988
2995
  }
2989
- if (definition.provider === "github-secrets") {
2996
+ if (definition.provider === "github-secrets" || definition.provider === "environment") {
2990
2997
  return {
2991
2998
  method: definition.auth?.method ?? "environment",
2992
2999
  ...definition.auth?.config ? { config: definition.auth.config } : {}
@@ -3168,10 +3175,20 @@ function stableSortObject(value) {
3168
3175
  function stripValuePrefix(key) {
3169
3176
  return key.startsWith("value.") ? key.slice("value.".length) : key;
3170
3177
  }
3178
+ function resolveProjectedEnvVar(manifest, vaultId, ref) {
3179
+ const mapping = manifest.vaults[vaultId]?.mapping;
3180
+ if (!mapping) {
3181
+ return void 0;
3182
+ }
3183
+ return Object.entries(mapping).find(([, logicalRef]) => logicalRef === ref)?.[0];
3184
+ }
3171
3185
  function configHash(values) {
3172
3186
  const serialized = JSON.stringify(stableSortObject(values));
3173
3187
  return (0, import_node_crypto3.createHash)("sha256").update(serialized).digest("hex");
3174
3188
  }
3189
+ function shouldProjectResolvedValue(sourceId) {
3190
+ return sourceId !== "process-env";
3191
+ }
3175
3192
  function toServerProjection(graph, manifest, cnosVersion = "0.0.0-dev", helpers = {}) {
3176
3193
  const values = {};
3177
3194
  const derived = {};
@@ -3181,14 +3198,22 @@ function toServerProjection(graph, manifest, cnosVersion = "0.0.0-dev", helpers
3181
3198
  const publicKeys = Array.from(graph.entries.values()).filter((entry) => entry.namespace === "public").map((entry) => entry.key.slice("public.".length)).sort((left, right) => left.localeCompare(right));
3182
3199
  for (const [key, entry] of graph.entries) {
3183
3200
  if (entry.namespace === "secret" && isSecretReference(entry.value)) {
3201
+ const vaultId = entry.value.vault ?? "default";
3202
+ const envVar = resolveProjectedEnvVar(manifest, vaultId, entry.value.ref);
3184
3203
  secretRefs[key.slice("secret.".length)] = {
3185
3204
  provider: entry.value.provider,
3186
- vault: entry.value.vault ?? "default",
3187
- ref: entry.value.ref
3205
+ vault: vaultId,
3206
+ ref: entry.value.ref,
3207
+ ...envVar ? {
3208
+ envVar
3209
+ } : {}
3188
3210
  };
3189
3211
  continue;
3190
3212
  }
3191
3213
  if (entry.namespace === "value") {
3214
+ if (!shouldProjectResolvedValue(entry.winner.sourceId)) {
3215
+ continue;
3216
+ }
3192
3217
  if (helpers.isRuntimeDependent?.(key)) {
3193
3218
  const formula = helpers.toServerFormula?.(key);
3194
3219
  if (formula) {
@@ -3205,6 +3230,9 @@ function toServerProjection(graph, manifest, cnosVersion = "0.0.0-dev", helpers
3205
3230
  }
3206
3231
  const namespaceDefinition = manifest.namespaces[entry.namespace];
3207
3232
  if (namespaceDefinition && namespaceDefinition.kind === "data" && !namespaceDefinition.sensitive && entry.namespace !== "public") {
3233
+ if (!shouldProjectResolvedValue(entry.winner.sourceId)) {
3234
+ continue;
3235
+ }
3208
3236
  if (helpers.isRuntimeDependent?.(key)) {
3209
3237
  const formula = helpers.toServerFormula?.(key);
3210
3238
  if (formula) {
@@ -3633,7 +3661,7 @@ async function createCnos(options = {}) {
3633
3661
  });
3634
3662
  const schemaApplied = applySchemaRules(graph, loadedManifest.manifest.schema);
3635
3663
  const promotedGraph = promoteToPublic(schemaApplied.graph, loadedManifest.manifest);
3636
- const secretCache = options.secretResolution === "lazy" ? void 0 : await batchResolveSecrets(promotedGraph, loadedManifest.manifest, options.processEnv);
3664
+ const secretCache = options.secretResolution === "lazy" ? new SecretCache() : await batchResolveSecrets(promotedGraph, loadedManifest.manifest, options.processEnv);
3637
3665
  return createRuntime(
3638
3666
  loadedManifest.manifest,
3639
3667
  appendMetaEntries({
@@ -3686,7 +3714,7 @@ function envVarToLogicalKey(envVar, config = {}) {
3686
3714
  // package.json
3687
3715
  var package_default = {
3688
3716
  name: "@kitsy/cnos",
3689
- version: "1.8.1",
3717
+ version: "1.8.3",
3690
3718
  description: "Batteries-included CNOS runtime package wired with the official plugins.",
3691
3719
  type: "module",
3692
3720
  main: "./dist/index.cjs",
@@ -4876,7 +4904,14 @@ function attachBootstrappedProjection(projection, force = false) {
4876
4904
  if (!ref) {
4877
4905
  return void 0;
4878
4906
  }
4879
- const definition = { provider: ref.provider };
4907
+ const definition = {
4908
+ provider: ref.provider,
4909
+ ...ref.envVar ? {
4910
+ mapping: {
4911
+ [ref.envVar]: ref.ref
4912
+ }
4913
+ } : {}
4914
+ };
4880
4915
  const provider = createSecretVaultProvider(ref.vault ?? "default", definition, process.env);
4881
4916
  const auth = await resolveVaultAuth(ref.vault ?? "default", definition, process.env);
4882
4917
  await provider.authenticate(auth);
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 DerivedFormula, j as DerivedValue, k as ExprNode, I as InspectResult, L as LoaderPlugin, b as LogicalKey, M as ManifestFile, N as NormalizedManifest, P as ParsedDerivation, l as RuntimeProvider } from './core-BJ8xewez.cjs';
2
+ export { h as CnosPlugin, g as CnosRuntime, a as ConfigEntry, i as DerivedFormula, j as DerivedValue, k as ExprNode, I as InspectResult, L as LoaderPlugin, b as LogicalKey, M as ManifestFile, N as NormalizedManifest, P as ParsedDerivation, l as RuntimeProvider } from './core-zDTUSVx9.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 DerivedFormula, j as DerivedValue, k as ExprNode, I as InspectResult, L as LoaderPlugin, b as LogicalKey, M as ManifestFile, N as NormalizedManifest, P as ParsedDerivation, l as RuntimeProvider } from './core-BJ8xewez.js';
2
+ export { h as CnosPlugin, g as CnosRuntime, a as ConfigEntry, i as DerivedFormula, j as DerivedValue, k as ExprNode, I as InspectResult, L as LoaderPlugin, b as LogicalKey, M as ManifestFile, N as NormalizedManifest, P as ParsedDerivation, l as RuntimeProvider } from './core-zDTUSVx9.js';
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  runtime_default
3
- } from "./chunk-6IYR3LVA.js";
4
- import "./chunk-GHGJFRDL.js";
5
- import "./chunk-FJOOJGUD.js";
6
- import "./chunk-OA7FQGAG.js";
7
- import "./chunk-RYIARE4M.js";
8
- import "./chunk-TT4NV56Z.js";
9
- import "./chunk-UL63DFLS.js";
10
- import "./chunk-5KIQCYFH.js";
11
- import "./chunk-2DGT7N7E.js";
12
- import "./chunk-2TL42I6M.js";
3
+ } from "./chunk-SUMWGMRA.js";
4
+ import "./chunk-DL5G3QSZ.js";
5
+ import "./chunk-7MUDEJSP.js";
6
+ import "./chunk-JQLV4OQU.js";
7
+ import "./chunk-4AAA2RHV.js";
8
+ import "./chunk-UMVFSHP2.js";
9
+ import "./chunk-N5DX5QEB.js";
10
+ import "./chunk-36AR262B.js";
11
+ import "./chunk-EJT2VJTM.js";
12
+ import "./chunk-ZH5QZQ7C.js";
13
13
  export {
14
14
  runtime_default as cnos,
15
15
  runtime_default as default
package/dist/internal.cjs CHANGED
@@ -1210,7 +1210,7 @@ function normalizeVaultAuth(vaultName, provider, auth) {
1210
1210
  ...auth?.config ? { config: auth.config } : {}
1211
1211
  };
1212
1212
  }
1213
- if (provider === "github-secrets") {
1213
+ if (provider === "github-secrets" || provider === "environment") {
1214
1214
  return {
1215
1215
  method: auth?.method ?? "environment",
1216
1216
  ...auth?.config ? { config: auth.config } : {}
@@ -1715,7 +1715,7 @@ function resolveConfiguredVaultPassphrase(definition, vault = "default", process
1715
1715
  }
1716
1716
  async function resolveVaultAccessKey(storeRoot, definition, vault = "default", processEnv = process.env) {
1717
1717
  if (definition?.provider !== "local") {
1718
- return definition?.provider === "github-secrets" ? {
1718
+ return definition?.provider === "github-secrets" || definition?.provider === "environment" ? {
1719
1719
  method: definition.auth?.method ?? "environment",
1720
1720
  ...definition?.auth?.config ? { config: definition.auth.config } : {}
1721
1721
  } : void 0;
@@ -1845,8 +1845,8 @@ async function appendAuditEvent(event, processEnv = process.env) {
1845
1845
  );
1846
1846
  }
1847
1847
 
1848
- // ../core/src/secrets/providers/github.ts
1849
- var GithubSecretsVaultProvider = class {
1848
+ // ../core/src/secrets/providers/environment.ts
1849
+ var EnvironmentSecretsVaultProvider = class {
1850
1850
  constructor(vaultId, definition, processEnv = process.env) {
1851
1851
  this.vaultId = vaultId;
1852
1852
  this.definition = definition;
@@ -1900,6 +1900,10 @@ var GithubSecretsVaultProvider = class {
1900
1900
  }
1901
1901
  };
1902
1902
 
1903
+ // ../core/src/secrets/providers/github.ts
1904
+ var GithubSecretsVaultProvider = class extends EnvironmentSecretsVaultProvider {
1905
+ };
1906
+
1903
1907
  // ../core/src/secrets/providers/local.ts
1904
1908
  var LocalSecretVaultProvider = class _LocalSecretVaultProvider {
1905
1909
  constructor(vaultId, definition, processEnv = process.env, storeRoot = resolveSecretStoreRoot(processEnv)) {
@@ -1995,6 +1999,9 @@ function createSecretVaultProvider(vaultId, definition, processEnv) {
1995
1999
  if (definition.provider === "local") {
1996
2000
  return new LocalSecretVaultProvider(vaultId, definition, processEnv);
1997
2001
  }
2002
+ if (definition.provider === "environment") {
2003
+ return new EnvironmentSecretsVaultProvider(vaultId, definition, processEnv);
2004
+ }
1998
2005
  if (definition.provider === "github-secrets") {
1999
2006
  return new GithubSecretsVaultProvider(vaultId, definition, processEnv);
2000
2007
  }
@@ -2050,7 +2057,7 @@ async function resolveVaultAuth(vaultId, definition, processEnv = process.env) {
2050
2057
  ...definition.auth?.config ? { config: definition.auth.config } : {}
2051
2058
  };
2052
2059
  }
2053
- if (definition.provider === "github-secrets") {
2060
+ if (definition.provider === "github-secrets" || definition.provider === "environment") {
2054
2061
  return {
2055
2062
  method: definition.auth?.method ?? "environment",
2056
2063
  ...definition.auth?.config ? { config: definition.auth.config } : {}
@@ -1,5 +1,5 @@
1
- import { j as DerivedValue, P as ParsedDerivation, N as NormalizedManifest, n as LoadManifestOptions, o as LoadedManifest, b as LogicalKey, p as NamespaceDefinition, q as VaultDefinition, r as VaultAuthConfig, s as SecretVaultProvider, t as ResolvedRoot, m as NamespaceName, u as RootResolution, v as SecretReference, g as CnosRuntime, w as ValidationSummary, R as ResolvedGraph, S as ServerProjection } from './core-BJ8xewez.cjs';
2
- export { l as RuntimeProvider, x as ValidationIssue, y as WorkspaceFile } from './core-BJ8xewez.cjs';
1
+ import { j as DerivedValue, P as ParsedDerivation, N as NormalizedManifest, n as LoadManifestOptions, o as LoadedManifest, b as LogicalKey, p as NamespaceDefinition, q as VaultDefinition, r as VaultAuthConfig, s as SecretVaultProvider, t as ResolvedRoot, m as NamespaceName, u as RootResolution, v as SecretReference, g as CnosRuntime, w as ValidationSummary, R as ResolvedGraph, S as ServerProjection } from './core-zDTUSVx9.cjs';
2
+ export { l as RuntimeProvider, x as ValidationIssue, y as WorkspaceFile } from './core-zDTUSVx9.cjs';
3
3
 
4
4
  declare class CnosError extends Error {
5
5
  constructor(message: string);
@@ -1,5 +1,5 @@
1
- import { j as DerivedValue, P as ParsedDerivation, N as NormalizedManifest, n as LoadManifestOptions, o as LoadedManifest, b as LogicalKey, p as NamespaceDefinition, q as VaultDefinition, r as VaultAuthConfig, s as SecretVaultProvider, t as ResolvedRoot, m as NamespaceName, u as RootResolution, v as SecretReference, g as CnosRuntime, w as ValidationSummary, R as ResolvedGraph, S as ServerProjection } from './core-BJ8xewez.js';
2
- export { l as RuntimeProvider, x as ValidationIssue, y as WorkspaceFile } from './core-BJ8xewez.js';
1
+ import { j as DerivedValue, P as ParsedDerivation, N as NormalizedManifest, n as LoadManifestOptions, o as LoadedManifest, b as LogicalKey, p as NamespaceDefinition, q as VaultDefinition, r as VaultAuthConfig, s as SecretVaultProvider, t as ResolvedRoot, m as NamespaceName, u as RootResolution, v as SecretReference, g as CnosRuntime, w as ValidationSummary, R as ResolvedGraph, S as ServerProjection } from './core-zDTUSVx9.js';
2
+ export { l as RuntimeProvider, x as ValidationIssue, y as WorkspaceFile } from './core-zDTUSVx9.js';
3
3
 
4
4
  declare class CnosError extends Error {
5
5
  constructor(message: string);
package/dist/internal.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  serializeRuntimeGraph,
12
12
  serializeSecretPayload,
13
13
  serializeServerProjection
14
- } from "./chunk-GHGJFRDL.js";
14
+ } from "./chunk-DL5G3QSZ.js";
15
15
  import {
16
16
  CnosAuthenticationError,
17
17
  CnosSecurityError,
@@ -64,7 +64,7 @@ import {
64
64
  writeLocalSecret,
65
65
  writeRemoteRootCacheMetadata,
66
66
  writeVaultSessionKey
67
- } from "./chunk-2TL42I6M.js";
67
+ } from "./chunk-ZH5QZQ7C.js";
68
68
 
69
69
  // src/codegen/generateTypes.ts
70
70
  function toPascalCase(value) {
@@ -1,4 +1,4 @@
1
- import { V as ValidatorPlugin } from '../core-BJ8xewez.cjs';
1
+ import { V as ValidatorPlugin } from '../core-zDTUSVx9.cjs';
2
2
 
3
3
  declare function createBasicSchemaPlugin(): ValidatorPlugin;
4
4
 
@@ -1,4 +1,4 @@
1
- import { V as ValidatorPlugin } from '../core-BJ8xewez.js';
1
+ import { V as ValidatorPlugin } from '../core-zDTUSVx9.js';
2
2
 
3
3
  declare function createBasicSchemaPlugin(): ValidatorPlugin;
4
4
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createBasicSchemaPlugin
3
- } from "../chunk-5KIQCYFH.js";
4
- import "../chunk-2TL42I6M.js";
3
+ } from "../chunk-N5DX5QEB.js";
4
+ import "../chunk-ZH5QZQ7C.js";
5
5
  export {
6
6
  createBasicSchemaPlugin
7
7
  };
@@ -1,4 +1,4 @@
1
- import { a as ConfigEntry, L as LoaderPlugin } from '../core-BJ8xewez.cjs';
1
+ import { a as ConfigEntry, L as LoaderPlugin } from '../core-zDTUSVx9.cjs';
2
2
 
3
3
  interface ParsedCliArg {
4
4
  key: string;
@@ -1,4 +1,4 @@
1
- import { a as ConfigEntry, L as LoaderPlugin } from '../core-BJ8xewez.js';
1
+ import { a as ConfigEntry, L as LoaderPlugin } from '../core-zDTUSVx9.js';
2
2
 
3
3
  interface ParsedCliArg {
4
4
  key: string;
@@ -2,8 +2,8 @@ import {
2
2
  cliArgEntriesFromArgs,
3
3
  createCliArgsPlugin,
4
4
  parseCliArgs
5
- } from "../chunk-2DGT7N7E.js";
6
- import "../chunk-2TL42I6M.js";
5
+ } from "../chunk-36AR262B.js";
6
+ import "../chunk-ZH5QZQ7C.js";
7
7
  export {
8
8
  cliArgEntriesFromArgs,
9
9
  createCliArgsPlugin,
@@ -1,5 +1,5 @@
1
- import { L as LoaderPlugin, a as ConfigEntry } from '../core-BJ8xewez.cjs';
2
- import { E as EnvMappingConfig } from '../envNaming-rx71gpi0.cjs';
1
+ import { L as LoaderPlugin, a as ConfigEntry } from '../core-zDTUSVx9.cjs';
2
+ import { E as EnvMappingConfig } from '../envNaming-EFzezmB3.cjs';
3
3
 
4
4
  declare function parseDotenv(document: string): Record<string, string>;
5
5
  declare function dotenvEntriesFromObject(values: Record<string, string>, mapping?: EnvMappingConfig, originFile?: string, workspaceId?: string): ConfigEntry[];
@@ -1,5 +1,5 @@
1
- import { L as LoaderPlugin, a as ConfigEntry } from '../core-BJ8xewez.js';
2
- import { E as EnvMappingConfig } from '../envNaming-BRyiuPoI.js';
1
+ import { L as LoaderPlugin, a as ConfigEntry } from '../core-zDTUSVx9.js';
2
+ import { E as EnvMappingConfig } from '../envNaming-BkorOKW_.js';
3
3
 
4
4
  declare function parseDotenv(document: string): Record<string, string>;
5
5
  declare function dotenvEntriesFromObject(values: Record<string, string>, mapping?: EnvMappingConfig, originFile?: string, workspaceId?: string): ConfigEntry[];
@@ -2,8 +2,8 @@ import {
2
2
  createDotenvPlugin,
3
3
  dotenvEntriesFromObject,
4
4
  parseDotenv
5
- } from "../chunk-OA7FQGAG.js";
6
- import "../chunk-2TL42I6M.js";
5
+ } from "../chunk-EJT2VJTM.js";
6
+ import "../chunk-ZH5QZQ7C.js";
7
7
  export {
8
8
  createDotenvPlugin,
9
9
  dotenvEntriesFromObject,
@@ -1,5 +1,5 @@
1
- import { E as ExporterPlugin } from '../core-BJ8xewez.cjs';
2
- export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-ivRtLjcw.cjs';
1
+ import { E as ExporterPlugin } from '../core-zDTUSVx9.cjs';
2
+ export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-Ds1DRwCX.cjs';
3
3
 
4
4
  declare function createEnvExportPlugin(): ExporterPlugin;
5
5
  declare function createPublicEnvExportPlugin(): ExporterPlugin;
@@ -1,5 +1,5 @@
1
- import { E as ExporterPlugin } from '../core-BJ8xewez.js';
2
- export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-CCSgdvI9.js';
1
+ import { E as ExporterPlugin } from '../core-zDTUSVx9.js';
2
+ export { t as toEnv, a as toPublicEnv } from '../toPublicEnv-CT265rzS.js';
3
3
 
4
4
  declare function createEnvExportPlugin(): ExporterPlugin;
5
5
  declare function createPublicEnvExportPlugin(): ExporterPlugin;
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  createEnvExportPlugin,
3
3
  createPublicEnvExportPlugin
4
- } from "../chunk-RYIARE4M.js";
4
+ } from "../chunk-JQLV4OQU.js";
5
5
  import {
6
6
  toEnv,
7
7
  toPublicEnv
8
- } from "../chunk-2TL42I6M.js";
8
+ } from "../chunk-ZH5QZQ7C.js";
9
9
  export {
10
10
  createEnvExportPlugin,
11
11
  createPublicEnvExportPlugin,
@@ -1,4 +1,4 @@
1
- import { L as LoaderPlugin, a as ConfigEntry, W as WorkspaceRoot, m as NamespaceName } from '../core-BJ8xewez.cjs';
1
+ import { L as LoaderPlugin, a as ConfigEntry, W as WorkspaceRoot, m as NamespaceName } from '../core-zDTUSVx9.cjs';
2
2
 
3
3
  declare function filesystemSecretsReader(filePath: string, document: string, workspaceId?: string): ConfigEntry[];
4
4
  declare function createFilesystemSecretsPlugin(): LoaderPlugin;
@@ -1,4 +1,4 @@
1
- import { L as LoaderPlugin, a as ConfigEntry, W as WorkspaceRoot, m as NamespaceName } from '../core-BJ8xewez.js';
1
+ import { L as LoaderPlugin, a as ConfigEntry, W as WorkspaceRoot, m as NamespaceName } from '../core-zDTUSVx9.js';
2
2
 
3
3
  declare function filesystemSecretsReader(filePath: string, document: string, workspaceId?: string): ConfigEntry[];
4
4
  declare function createFilesystemSecretsPlugin(): LoaderPlugin;
@@ -5,8 +5,8 @@ import {
5
5
  filesystemSecretsReader,
6
6
  filesystemValuesReader,
7
7
  yamlObjectToEntries
8
- } from "../chunk-TT4NV56Z.js";
9
- import "../chunk-2TL42I6M.js";
8
+ } from "../chunk-4AAA2RHV.js";
9
+ import "../chunk-ZH5QZQ7C.js";
10
10
  export {
11
11
  collectFilesystemLayerFiles,
12
12
  createFilesystemSecretsPlugin,
@@ -1,5 +1,5 @@
1
- import { L as LoaderPlugin, a as ConfigEntry } from '../core-BJ8xewez.cjs';
2
- import { E as EnvMappingConfig } from '../envNaming-rx71gpi0.cjs';
1
+ import { L as LoaderPlugin, a as ConfigEntry } from '../core-zDTUSVx9.cjs';
2
+ import { E as EnvMappingConfig } from '../envNaming-EFzezmB3.cjs';
3
3
 
4
4
  declare function processEnvEntriesFromObject(env: Record<string, string | undefined>, mapping?: EnvMappingConfig, workspaceId?: string): ConfigEntry[];
5
5
  declare function processNamespaceEntriesFromContext(env: Record<string, string | undefined>, workspaceId?: string): ConfigEntry[];
@@ -1,5 +1,5 @@
1
- import { L as LoaderPlugin, a as ConfigEntry } from '../core-BJ8xewez.js';
2
- import { E as EnvMappingConfig } from '../envNaming-BRyiuPoI.js';
1
+ import { L as LoaderPlugin, a as ConfigEntry } from '../core-zDTUSVx9.js';
2
+ import { E as EnvMappingConfig } from '../envNaming-BkorOKW_.js';
3
3
 
4
4
  declare function processEnvEntriesFromObject(env: Record<string, string | undefined>, mapping?: EnvMappingConfig, workspaceId?: string): ConfigEntry[];
5
5
  declare function processNamespaceEntriesFromContext(env: Record<string, string | undefined>, workspaceId?: string): ConfigEntry[];
@@ -2,8 +2,8 @@ import {
2
2
  createProcessEnvPlugin,
3
3
  processEnvEntriesFromObject,
4
4
  processNamespaceEntriesFromContext
5
- } from "../chunk-UL63DFLS.js";
6
- import "../chunk-2TL42I6M.js";
5
+ } from "../chunk-UMVFSHP2.js";
6
+ import "../chunk-ZH5QZQ7C.js";
7
7
  export {
8
8
  createProcessEnvPlugin,
9
9
  processEnvEntriesFromObject,
@@ -1516,7 +1516,7 @@ function normalizeVaultAuth(vaultName, provider, auth) {
1516
1516
  ...auth?.config ? { config: auth.config } : {}
1517
1517
  };
1518
1518
  }
1519
- if (provider === "github-secrets") {
1519
+ if (provider === "github-secrets" || provider === "environment") {
1520
1520
  return {
1521
1521
  method: auth?.method ?? "environment",
1522
1522
  ...auth?.config ? { config: auth.config } : {}
@@ -2620,7 +2620,7 @@ function resolveConfiguredVaultPassphrase(definition, vault = "default", process
2620
2620
  }
2621
2621
  async function resolveVaultAccessKey(storeRoot, definition, vault = "default", processEnv = process.env) {
2622
2622
  if (definition?.provider !== "local") {
2623
- return definition?.provider === "github-secrets" ? {
2623
+ return definition?.provider === "github-secrets" || definition?.provider === "environment" ? {
2624
2624
  method: definition.auth?.method ?? "environment",
2625
2625
  ...definition?.auth?.config ? { config: definition.auth.config } : {}
2626
2626
  } : void 0;
@@ -2778,8 +2778,8 @@ var SecretCache = class {
2778
2778
  }
2779
2779
  };
2780
2780
 
2781
- // ../core/src/secrets/providers/github.ts
2782
- var GithubSecretsVaultProvider = class {
2781
+ // ../core/src/secrets/providers/environment.ts
2782
+ var EnvironmentSecretsVaultProvider = class {
2783
2783
  constructor(vaultId, definition, processEnv = process.env) {
2784
2784
  this.vaultId = vaultId;
2785
2785
  this.definition = definition;
@@ -2833,6 +2833,10 @@ var GithubSecretsVaultProvider = class {
2833
2833
  }
2834
2834
  };
2835
2835
 
2836
+ // ../core/src/secrets/providers/github.ts
2837
+ var GithubSecretsVaultProvider = class extends EnvironmentSecretsVaultProvider {
2838
+ };
2839
+
2836
2840
  // ../core/src/secrets/providers/local.ts
2837
2841
  var LocalSecretVaultProvider = class _LocalSecretVaultProvider {
2838
2842
  constructor(vaultId, definition, processEnv = process.env, storeRoot = resolveSecretStoreRoot(processEnv)) {
@@ -2928,6 +2932,9 @@ function createSecretVaultProvider(vaultId, definition, processEnv) {
2928
2932
  if (definition.provider === "local") {
2929
2933
  return new LocalSecretVaultProvider(vaultId, definition, processEnv);
2930
2934
  }
2935
+ if (definition.provider === "environment") {
2936
+ return new EnvironmentSecretsVaultProvider(vaultId, definition, processEnv);
2937
+ }
2931
2938
  if (definition.provider === "github-secrets") {
2932
2939
  return new GithubSecretsVaultProvider(vaultId, definition, processEnv);
2933
2940
  }
@@ -2983,7 +2990,7 @@ async function resolveVaultAuth(vaultId, definition, processEnv = process.env) {
2983
2990
  ...definition.auth?.config ? { config: definition.auth.config } : {}
2984
2991
  };
2985
2992
  }
2986
- if (definition.provider === "github-secrets") {
2993
+ if (definition.provider === "github-secrets" || definition.provider === "environment") {
2987
2994
  return {
2988
2995
  method: definition.auth?.method ?? "environment",
2989
2996
  ...definition.auth?.config ? { config: definition.auth.config } : {}
@@ -3165,10 +3172,20 @@ function stableSortObject(value) {
3165
3172
  function stripValuePrefix(key) {
3166
3173
  return key.startsWith("value.") ? key.slice("value.".length) : key;
3167
3174
  }
3175
+ function resolveProjectedEnvVar(manifest, vaultId, ref) {
3176
+ const mapping = manifest.vaults[vaultId]?.mapping;
3177
+ if (!mapping) {
3178
+ return void 0;
3179
+ }
3180
+ return Object.entries(mapping).find(([, logicalRef]) => logicalRef === ref)?.[0];
3181
+ }
3168
3182
  function configHash(values) {
3169
3183
  const serialized = JSON.stringify(stableSortObject(values));
3170
3184
  return (0, import_node_crypto3.createHash)("sha256").update(serialized).digest("hex");
3171
3185
  }
3186
+ function shouldProjectResolvedValue(sourceId) {
3187
+ return sourceId !== "process-env";
3188
+ }
3172
3189
  function toServerProjection(graph, manifest, cnosVersion = "0.0.0-dev", helpers = {}) {
3173
3190
  const values = {};
3174
3191
  const derived = {};
@@ -3178,14 +3195,22 @@ function toServerProjection(graph, manifest, cnosVersion = "0.0.0-dev", helpers
3178
3195
  const publicKeys = Array.from(graph.entries.values()).filter((entry) => entry.namespace === "public").map((entry) => entry.key.slice("public.".length)).sort((left, right) => left.localeCompare(right));
3179
3196
  for (const [key, entry] of graph.entries) {
3180
3197
  if (entry.namespace === "secret" && isSecretReference(entry.value)) {
3198
+ const vaultId = entry.value.vault ?? "default";
3199
+ const envVar = resolveProjectedEnvVar(manifest, vaultId, entry.value.ref);
3181
3200
  secretRefs[key.slice("secret.".length)] = {
3182
3201
  provider: entry.value.provider,
3183
- vault: entry.value.vault ?? "default",
3184
- ref: entry.value.ref
3202
+ vault: vaultId,
3203
+ ref: entry.value.ref,
3204
+ ...envVar ? {
3205
+ envVar
3206
+ } : {}
3185
3207
  };
3186
3208
  continue;
3187
3209
  }
3188
3210
  if (entry.namespace === "value") {
3211
+ if (!shouldProjectResolvedValue(entry.winner.sourceId)) {
3212
+ continue;
3213
+ }
3189
3214
  if (helpers.isRuntimeDependent?.(key)) {
3190
3215
  const formula = helpers.toServerFormula?.(key);
3191
3216
  if (formula) {
@@ -3202,6 +3227,9 @@ function toServerProjection(graph, manifest, cnosVersion = "0.0.0-dev", helpers
3202
3227
  }
3203
3228
  const namespaceDefinition = manifest.namespaces[entry.namespace];
3204
3229
  if (namespaceDefinition && namespaceDefinition.kind === "data" && !namespaceDefinition.sensitive && entry.namespace !== "public") {
3230
+ if (!shouldProjectResolvedValue(entry.winner.sourceId)) {
3231
+ continue;
3232
+ }
3205
3233
  if (helpers.isRuntimeDependent?.(key)) {
3206
3234
  const formula = helpers.toServerFormula?.(key);
3207
3235
  if (formula) {
@@ -3630,7 +3658,7 @@ async function createCnos(options = {}) {
3630
3658
  });
3631
3659
  const schemaApplied = applySchemaRules(graph, loadedManifest.manifest.schema);
3632
3660
  const promotedGraph = promoteToPublic(schemaApplied.graph, loadedManifest.manifest);
3633
- const secretCache = options.secretResolution === "lazy" ? void 0 : await batchResolveSecrets(promotedGraph, loadedManifest.manifest, options.processEnv);
3661
+ const secretCache = options.secretResolution === "lazy" ? new SecretCache() : await batchResolveSecrets(promotedGraph, loadedManifest.manifest, options.processEnv);
3634
3662
  return createRuntime(
3635
3663
  loadedManifest.manifest,
3636
3664
  appendMetaEntries({
@@ -3683,7 +3711,7 @@ function envVarToLogicalKey(envVar, config = {}) {
3683
3711
  // package.json
3684
3712
  var package_default = {
3685
3713
  name: "@kitsy/cnos",
3686
- version: "1.8.1",
3714
+ version: "1.8.3",
3687
3715
  description: "Batteries-included CNOS runtime package wired with the official plugins.",
3688
3716
  type: "module",
3689
3717
  main: "./dist/index.cjs",
@@ -4873,7 +4901,14 @@ function attachBootstrappedProjection(projection, force = false) {
4873
4901
  if (!ref) {
4874
4902
  return void 0;
4875
4903
  }
4876
- const definition = { provider: ref.provider };
4904
+ const definition = {
4905
+ provider: ref.provider,
4906
+ ...ref.envVar ? {
4907
+ mapping: {
4908
+ [ref.envVar]: ref.ref
4909
+ }
4910
+ } : {}
4911
+ };
4877
4912
  const provider = createSecretVaultProvider(ref.vault ?? "default", definition, process.env);
4878
4913
  const auth = await resolveVaultAuth(ref.vault ?? "default", definition, process.env);
4879
4914
  await provider.authenticate(auth);
@@ -1,4 +1,4 @@
1
- import { b as LogicalKey, g as CnosRuntime, I as InspectResult } from '../core-BJ8xewez.cjs';
1
+ import { b as LogicalKey, g as CnosRuntime, I as InspectResult } from '../core-zDTUSVx9.cjs';
2
2
 
3
3
  interface CnosSingleton {
4
4
  <T = unknown>(key: LogicalKey): T | undefined;