@wildo-ai/platform-config-lib 1.1.12 → 1.1.14

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 (47) hide show
  1. package/dist/esm/bootstrap/minion-database-queue-confinement.contracts.d.ts +41 -0
  2. package/dist/esm/bootstrap/minion-database-queue-confinement.contracts.d.ts.map +1 -0
  3. package/dist/esm/bootstrap/minion-database-queue-confinement.contracts.js +53 -0
  4. package/dist/esm/bootstrap/minion-database-queue-confinement.contracts.js.map +1 -0
  5. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts +64 -0
  6. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.d.ts.map +1 -1
  7. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js +49 -0
  8. package/dist/esm/bootstrap/postgresql-owed-grants.contracts.js.map +1 -1
  9. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts +14 -0
  10. package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
  11. package/dist/esm/bootstrap/runtime-topology.contracts.js +24 -0
  12. package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
  13. package/dist/esm/index.d.ts +1 -0
  14. package/dist/esm/index.d.ts.map +1 -1
  15. package/dist/esm/index.js +1 -0
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/key-management/approval-seal-verifier.d.ts +85 -3
  18. package/dist/esm/key-management/approval-seal-verifier.d.ts.map +1 -1
  19. package/dist/esm/key-management/approval-seal-verifier.js +112 -1
  20. package/dist/esm/key-management/approval-seal-verifier.js.map +1 -1
  21. package/dist/esm/pnpm-settings/application-pnpm-settings.d.ts +1 -1
  22. package/dist/esm/pnpm-settings/application-pnpm-settings.js +1 -1
  23. package/dist/esm/pnpm-settings/application-pnpm-settings.js.map +1 -1
  24. package/dist/esm/project-config/define-infra-env-config.d.ts +37 -0
  25. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  26. package/dist/esm/project-config/define-infra-env-config.js +16 -1
  27. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  28. package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -1
  29. package/dist/esm/project-config/hosted-infra-env-config.js +1 -0
  30. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
  31. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +10 -0
  32. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  33. package/dist/esm/project-config/provider-runtime-artifacts.js +29 -5
  34. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  35. package/dist/esm/project-config/shared/environment.schemas.d.ts +37 -5
  36. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  37. package/dist/esm/project-config/shared/environment.schemas.js +57 -5
  38. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  39. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +8 -0
  40. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  41. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  42. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts +5 -2
  43. package/dist/esm/project-config/shared/platform-key-management.schemas.d.ts.map +1 -1
  44. package/dist/esm/project-config/shared/platform-key-management.schemas.js +8 -2
  45. package/dist/esm/project-config/shared/platform-key-management.schemas.js.map +1 -1
  46. package/dist/tsconfig.build.tsbuildinfo +1 -1
  47. package/package.json +8 -8
@@ -2,9 +2,10 @@ import { createHash } from 'node:crypto';
2
2
  import { existsSync, readFileSync } from 'node:fs';
3
3
  import { resolve as resolvePath } from 'node:path';
4
4
  import { z } from 'zod';
5
- import { assertFrontendProvidersServeOnlyDeclaredKeys, assertNoSecretValueInFrontendProviders, BUILTIN_PROVIDER_CAPABILITY, BUILTIN_PROVIDER_PROTOCOL, FRONTEND_PROVIDER_PUBLIC_CONFIG_KEY, FrontendProviderPublicConfigError, FrontendProvidersBlockSchema, overlayFrontendProviderPublicConfig, ProviderProcessingRegionSelectionStatus, resolveProviderConnectionRef, processingRegionSelectionBindsRuntime, resolveProviderProcessingRegionSelection, assessProviderProcessingAgainstDataResidency, dataResidencyRefusals, narrowRuntimeProviderDataResidency, RuntimeProviderDataResidencySchema, runtimeProviderDataResidencyFor, } from '@wildo-ai/saas-models';
5
+ import { assertFrontendProvidersServeOnlyDeclaredKeys, assertNoSecretValueInFrontendProviders, BUILTIN_PROVIDER_CAPABILITY, BUILTIN_PROVIDER_PROTOCOL, FRONTEND_PROVIDER_PUBLIC_CONFIG_KEY, FrontendProviderPublicConfigError, FrontendProvidersBlockSchema, overlayFrontendProviderPublicConfig, browserPublicProviderSecretValues, confidentialProviderSecretSlotNames, ProviderProcessingRegionSelectionStatus, resolveProviderConnectionRef, processingRegionSelectionBindsRuntime, resolveProviderProcessingRegionSelection, assessProviderProcessingAgainstDataResidency, dataResidencyRefusals, narrowRuntimeProviderDataResidency, RuntimeProviderDataResidencySchema, runtimeProviderDataResidencyFor, } from '@wildo-ai/saas-models';
6
6
  import { SaasLockfileProvidersSectionSchema, } from '../lockfile/wildo-saas-lock.shared.schemas.js';
7
7
  import { getDeclaredApplicationModuleIds, getServiceBoundApplicationModuleIds, } from './shared/application-modules.utils.js';
8
+ import { isRuntimeSecretEnvVarName } from '../bootstrap/runtime-secret-env.contracts.js';
8
9
  import { SaasProvidersScopesSchema, SaasProviderScopeSelectionSchema, } from './define-saas-config.js';
9
10
  import { resolveProviderBasePackage, selectOptedInProviderAugmentations, describeProviderRefClaimedByMoreThanOneImportPath, providerComplianceProfilesFromContributions, readSystemOfRecordFacetModuleSpecifier, } from './provider-companion-discovery.js';
10
11
  export const PROVIDER_RUNTIME_ARTIFACT_AUTOGENERATED_WARNING = 'AUTO-GENERATED FILE. DO NOT EDIT. Regenerate with `wildo config sync`.';
@@ -260,6 +261,7 @@ config, options) {
260
261
  nodeWorkerKeys: options?.nodeWorkerKeys,
261
262
  scopes,
262
263
  providerConfigurations: config.providerConfigurations ?? {},
264
+ providerEnvironmentValues: options?.providerEnvironmentValues,
263
265
  });
264
266
  // #2294: a declared data residency refuses, before any artifact is written, a provider whose chosen region processes
265
267
  // outside it, whose places nothing states, or which a data-serving runtime declares with no choice saying where it
@@ -288,6 +290,7 @@ config, options) {
288
290
  nodeWorkerKeys: options?.nodeWorkerKeys,
289
291
  scopes,
290
292
  providerConfigurations: config.providerConfigurations ?? {},
293
+ providerEnvironmentValues: options?.providerEnvironmentValues,
291
294
  });
292
295
  return { artifacts, lockSection };
293
296
  }
@@ -722,6 +725,7 @@ function materializeRuntimeArtifacts(input) {
722
725
  frontendServiceScopes: scopes.frontendServices ?? {},
723
726
  frontendServiceTypes,
724
727
  providerConfigurations,
728
+ providerEnvironmentValues: input.providerEnvironmentValues,
725
729
  });
726
730
  return pruneUndefined({
727
731
  backend: materializeRuntimeArtifactFile({
@@ -756,6 +760,7 @@ function materializeRuntimeArtifacts(input) {
756
760
  frontendServiceScopes: scopes.frontendServices,
757
761
  frontendServiceTypes,
758
762
  providerConfigurations,
763
+ providerEnvironmentValues: input.providerEnvironmentValues,
759
764
  }),
760
765
  scopes: mapRecord(scopes.frontendServices, materializeRuntimeScope),
761
766
  })
@@ -831,7 +836,7 @@ export function frontendScopeEntryServes(entry, moduleProtocols) {
831
836
  || (entry.protocols ?? []).includes(BUILTIN_PROVIDER_PROTOCOL.FRONTEND_SDK);
832
837
  }
833
838
  function materializeFrontendProviderBootstraps(input) {
834
- const { discoveredContributions, frontendServiceScopes, frontendServiceTypes, providerConfigurations } = input;
839
+ const { discoveredContributions, frontendServiceScopes, frontendServiceTypes, providerConfigurations, providerEnvironmentValues } = input;
835
840
  const entries = Object.entries(frontendServiceScopes).map(([serviceKey, scope]) => {
836
841
  const serviceType = frontendServiceTypes[serviceKey];
837
842
  if (!serviceType) {
@@ -864,6 +869,7 @@ function materializeFrontendProviderBootstraps(input) {
864
869
  entry: moduleEntry,
865
870
  supplied: providerConfigurations[providerRef]?.[FRONTEND_PROVIDER_PUBLIC_CONFIG_KEY],
866
871
  discoveredContributions,
872
+ providerEnvironmentValues,
867
873
  }),
868
874
  ]];
869
875
  }));
@@ -886,18 +892,34 @@ function materializeFrontendProviderBootstraps(input) {
886
892
  * list. Returning early when nothing was supplied skipped both. Secret VALUES are not compared here —
887
893
  * this walk holds no secrets — but by the one publisher of these artifacts before it writes them
888
894
  * ({@link assertFrontendProviderBootstrapsCarryNoSecretValue}).
895
+ *
896
+ * The one secret value this walk may READ is a browser-public slot's: the same vendor's backend slots,
897
+ * filtered by `browserPublicProviderSecretValues` to those whose contract declares `holdsBrowserPublicValue`,
898
+ * looked up in the environment's `providerEnv`. Their values fill the public-config keys of the same slug,
899
+ * so a per-environment browser key lives in `secrets.json` and never in a committed config file. The
900
+ * screen admits them for the same declaration, so it cannot refuse what this fills.
889
901
  */
890
902
  function applyApplicationPublicConfig(input) {
891
- const { serviceKey, providerRef, entry, supplied, discoveredContributions } = input;
892
- const forbiddenKeys = new Set(discoveredContributions
903
+ const { serviceKey, providerRef, entry, supplied, discoveredContributions, providerEnvironmentValues } = input;
904
+ const vendorSecretSlots = discoveredContributions
893
905
  .filter((contribution) => contribution.ref === providerRef
894
906
  && contribution.runtimeTargets.some((target) => target.kind !== 'frontendService'))
895
- .flatMap((contribution) => contribution.secretsContractShape.flatMap((slot) => [slot.slug, slot.envVarName])));
907
+ .flatMap((contribution) => contribution.secretsContractShape);
908
+ const forbiddenKeys = confidentialProviderSecretSlotNames(vendorSecretSlots);
896
909
  try {
910
+ const environmentValues = providerEnvironmentValues === undefined
911
+ ? undefined
912
+ : browserPublicProviderSecretValues({
913
+ providerRef,
914
+ slots: vendorSecretSlots,
915
+ readValue: (envVarName) => providerEnvironmentValues[envVarName],
916
+ isFrameworkSecretName: isRuntimeSecretEnvVarName,
917
+ });
897
918
  const publicConfig = overlayFrontendProviderPublicConfig({
898
919
  providerRef,
899
920
  authored: entry.publicConfig,
900
921
  supplied,
922
+ environmentValues,
901
923
  declaredKeys: entry.publicConfigKeys,
902
924
  forbiddenKeys,
903
925
  });
@@ -1152,6 +1174,7 @@ function buildArtifactMetadata(input) {
1152
1174
  frontendServiceScopes: scopes.frontendServices ?? {},
1153
1175
  frontendServiceTypes,
1154
1176
  providerConfigurations,
1177
+ providerEnvironmentValues: input.providerEnvironmentValues,
1155
1178
  }),
1156
1179
  },
1157
1180
  runtimeLockSection: lockSection.runtimeScopes.backend ?? {},
@@ -1195,6 +1218,7 @@ function buildArtifactMetadata(input) {
1195
1218
  frontendServiceScopes: scopes.frontendServices ?? {},
1196
1219
  frontendServiceTypes,
1197
1220
  providerConfigurations,
1221
+ providerEnvironmentValues: input.providerEnvironmentValues,
1198
1222
  }),
1199
1223
  runtimeLockSection: lockSection.runtimeScopes.frontendServices ?? {},
1200
1224
  scopes,