@wildo-ai/platform-config-lib 1.1.7 → 1.1.9
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/esm/_unimplemented/index.d.ts.map +1 -1
- package/dist/esm/_unimplemented/index.js.map +1 -1
- package/dist/esm/_unimplemented/soft-warn.d.ts.map +1 -1
- package/dist/esm/_unimplemented/soft-warn.js.map +1 -1
- package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts.map +1 -1
- package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +1 -1
- package/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/application-backend-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/application-creation-verification-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap-planner.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts +12 -5
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.js +21 -5
- package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/platform-store-preconnect.d.ts.map +1 -1
- package/dist/esm/bootstrap/platform-store-preconnect.js.map +1 -1
- package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
- package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-network-policy.js.map +1 -1
- package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -1
- package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-platform-access.js.map +1 -1
- package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-principal.contracts.js.map +1 -1
- package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
- package/dist/esm/config-authoring.entry.d.ts.map +1 -1
- package/dist/esm/config-authoring.entry.js.map +1 -1
- package/dist/esm/credentials/credential-generator.service.d.ts.map +1 -1
- package/dist/esm/credentials/credential-generator.service.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -1
- package/dist/esm/lockfile/build-parallelism.js.map +1 -1
- package/dist/esm/lockfile/canonical-json.d.ts.map +1 -1
- package/dist/esm/lockfile/canonical-json.js.map +1 -1
- package/dist/esm/lockfile/file-lock-hold.d.ts +87 -0
- package/dist/esm/lockfile/file-lock-hold.d.ts.map +1 -0
- package/dist/esm/lockfile/file-lock-hold.js +279 -0
- package/dist/esm/lockfile/file-lock-hold.js.map +1 -0
- package/dist/esm/lockfile/lockfile-io.d.ts +21 -3
- package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
- package/dist/esm/lockfile/lockfile-io.js +8 -16
- package/dist/esm/lockfile/lockfile-io.js.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -1
- package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -1
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -1
- package/dist/esm/project-config/application-public-pricing-catalog.loader.d.ts.map +1 -1
- package/dist/esm/project-config/application-public-pricing-catalog.loader.js.map +1 -1
- package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-framework-config.js.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-minion-config.js.map +1 -1
- package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-saas-config.js.map +1 -1
- package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-worker-config.js.map +1 -1
- package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -1
- package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
- package/dist/esm/project-config/index.d.ts.map +1 -1
- package/dist/esm/project-config/index.js.map +1 -1
- package/dist/esm/project-config/loader.d.ts +16 -1
- package/dist/esm/project-config/loader.d.ts.map +1 -1
- package/dist/esm/project-config/loader.js +35 -1
- package/dist/esm/project-config/loader.js.map +1 -1
- package/dist/esm/project-config/minion-local-provider-registration.d.ts.map +1 -1
- package/dist/esm/project-config/minion-local-provider-registration.js.map +1 -1
- package/dist/esm/project-config/npm-version-range.d.ts.map +1 -1
- package/dist/esm/project-config/npm-version-range.js.map +1 -1
- package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -1
- package/dist/esm/project-config/provider-catalog-types.js.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.js +1 -0
- package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
- package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-creation-verification.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-modules.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-modules.utils.js.map +1 -1
- package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/backing-service-servability.d.ts.map +1 -1
- package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -1
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/cdn.example.d.ts.map +1 -1
- package/dist/esm/project-config/shared/cdn.example.js.map +1 -1
- package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/cdn.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
- package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp-emit.js.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/data-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/env-example-defaults.js.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +13 -0
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infra-service.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -1
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
- package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
- package/dist/esm/project-config/shared/object-storage-session-policy.d.ts.map +1 -1
- package/dist/esm/project-config/shared/object-storage-session-policy.js.map +1 -1
- package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/schema-version.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/service-definitions.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -1
- package/dist/esm/project-config/static-asset-import-noop.d.ts.map +1 -1
- package/dist/esm/project-config/static-asset-import-noop.js.map +1 -1
- package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -1
- package/dist/esm/registry/artifact-domain.schemas.js.map +1 -1
- package/dist/esm/registry/digest.schemas.d.ts.map +1 -1
- package/dist/esm/registry/digest.schemas.js.map +1 -1
- package/dist/esm/registry/index.d.ts.map +1 -1
- package/dist/esm/registry/index.js.map +1 -1
- package/dist/esm/registry/local-checkout-source.d.ts.map +1 -1
- package/dist/esm/registry/local-checkout-source.js.map +1 -1
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -1
- package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
- package/dist/esm/registry/module-search.schemas.d.ts.map +1 -1
- package/dist/esm/registry/module-search.schemas.js.map +1 -1
- package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -1
- package/dist/esm/registry/registry-config.schemas.js.map +1 -1
- package/dist/esm/registry/registry-defaults.constants.d.ts.map +1 -1
- package/dist/esm/registry/registry-defaults.constants.js.map +1 -1
- package/dist/esm/registry/registry-errors.d.ts.map +1 -1
- package/dist/esm/registry/registry-errors.js.map +1 -1
- package/dist/esm/registry/registry-keys.schemas.d.ts.map +1 -1
- package/dist/esm/registry/registry-keys.schemas.js.map +1 -1
- package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -1
- package/dist/esm/registry/registry-section-schemas.constants.js.map +1 -1
- package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
- package/dist/esm/release/framework-release.constants.js.map +1 -1
- package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-info.schemas.js.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-application-config.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-application-secrets.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-config.schemas.js.map +1 -1
- package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -1
- package/dist/esm/workspace-scope/application-subject-manifest.js.map +1 -1
- package/dist/esm/workspace-scope/index.d.ts.map +1 -1
- package/dist/esm/workspace-scope/index.js.map +1 -1
- package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -1
- package/dist/esm/workspace-scope/resolve-homes.js.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope-detector.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope-detector.js.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lockfile-io.js","sourceRoot":"","sources":["../../../src/lockfile/lockfile-io.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,0BAA0B,GAG3B,MAAM,kCAAkC,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,kCAAkC,CAAC;AAEhF;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACnD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ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AAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,MAAM,CAAM,CAAC;QAClC,sEAAsE;QACtE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/C,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;IAC5C,CAAC,CACF,CAAC;IACF,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["/**\n * Shared `wildo-saas.lock.json` IO primitives.\n *\n * Phase 1 graduates the locking + atomic-write surface validated by\n * the Phase 0.B contention spike (`module-registry-analysis.md`)\n * into `platform-config-lib`. Both the dev companion's\n * `WildoSaasLockCompanionService` and the CLI-side\n * `RegistryLockfileService` consume this module so concurrent\n * writers — across processes (CLI + companion + minions) — never\n * lose updates and never observe a half-written envelope.\n *\n * Exposes two layers:\n *\n * 1. `withLockfileMutate(opts, mutator)` — full-envelope mutate\n * under `proper-lockfile` + `write-file-atomic`. The companion\n * uses this so it can preserve its full-envelope contract and\n * validate its companion-owned i18n schema in the same pass.\n *\n * 2. `withLockfileSectionMutate(opts, mutator)` — section-scoped\n * mutate. The CLI uses this so it can ONLY touch one section\n * (e.g. `sections.modules`) and never accidentally clobber a\n * sibling section.\n *\n * Both layers preserve unknown sections verbatim — every consumer\n * MUST round-trip every `sections.*` key it does not recognize.\n *\n * Hard contract (KD-4 / KD-15 / KD-18):\n * - The library NEVER writes provider runtime artifacts under\n * `.wildo-saas/generated/providers/*.runtime-providers.generated.json` or\n * `src/generated/wildo-provider-runtime.generated.ts`. Those are\n * produced by the provider materialization workflow alone.\n * - `sections.providers.runtimeScopes` is owned end-to-end by the\n * provider workstream; module-registry callers MUST NOT mutate it.\n * This module is unaware of the provider section beyond\n * preserving its bytes.\n */\n\nimport { promises as fs } from 'node:fs';\nimport * as path from 'node:path';\nimport lockfile from 'proper-lockfile';\nimport writeFileAtomic from 'write-file-atomic';\nimport { z } from 'zod';\nimport {\n SaasLockfileEnvelopeSchema,\n type SaasLockfileEnvelope,\n type SaasLockfileKnownSections,\n} from './wildo-saas-lock.shared.schemas';\n\n/**\n * Canonical path of the saas-app lockfile, relative to the saas root.\n */\nexport const WILDO_SAAS_LOCK_RELATIVE_PATH = '.wildo-saas/wildo-saas.lock.json';\n\n/**\n * Build the absolute lockfile path for a given saas root.\n */\nexport function getWildoSaasLockPath(saasRoot: string): string {\n return path.resolve(saasRoot, WILDO_SAAS_LOCK_RELATIVE_PATH);\n}\n\n/**\n * Default `proper-lockfile` options. The 5s `stale` window matches\n * the Phase 0.B spike (`module-registry-analysis.md` Phase 0.B\n * Findings): typical lock-hold time is < 50ms; 5s is generous enough\n * to absorb a CI pause without compromising legitimate locks. Tests\n * 4a-4d all passed under these settings.\n *\n * `realpath: false` is required when the saas root is symlinked\n * (common with pnpm `dependenciesMeta.injected: true` workspaces).\n */\nexport const DEFAULT_LOCK_OPTIONS = {\n retries: { retries: 200, minTimeout: 5, maxTimeout: 50, factor: 1.2 },\n stale: 5000,\n realpath: false,\n} as const satisfies Parameters<typeof lockfile.lock>[1];\n\n/**\n * The result of merging caller options over {@link DEFAULT_LOCK_OPTIONS}.\n *\n * Its leaves are WIDENED (`number` / `boolean`) and that is the point: the\n * defaults are `as const`, so `typeof DEFAULT_LOCK_OPTIONS` describes those exact\n * literals — `stale: 5000`, `realpath: false`. A merge that honours a caller\n * override cannot satisfy it, because an overridden `stale` is not `5000`.\n *\n * Annotating the merge as `typeof DEFAULT_LOCK_OPTIONS` claimed the result was\n * always the defaults, which is true only when nothing was overridden — i.e. in\n * the one case the function exists to avoid.\n */\nexport type ResolvedLockOptions = {\n /**\n * Either a retry POLICY or a bare attempt count — `proper-lockfile` accepts\n * both, and the merge passes a bare number straight through\n * (`overrideRetries ?? baseRetries`). Omitting `number` made the merge unable to\n * describe its own fallback branch.\n */\n readonly retries: number | { retries?: number; minTimeout?: number; maxTimeout?: number; factor?: number };\n readonly stale: number;\n readonly realpath: boolean;\n};\n\n/**\n * Deep-merge caller-supplied lock options on top of `DEFAULT_LOCK_OPTIONS`.\n *\n * Phase 1 review (M-2.1): a shallow merge replaced the entire\n * `retries` object whenever a caller passed a partial — so\n * `lockOptions: { retries: { retries: 5 } }` silently lost the\n * `minTimeout`/`maxTimeout`/`factor` defaults that Phase 0.B\n * validated. The deep merge keeps every default intact unless\n * the caller explicitly overrides each leaf.\n */\nfunction mergeLockOptions(\n // `DedicatedFileLockOptions`, NOT `Partial<typeof DEFAULT_LOCK_OPTIONS>`: that constant is\n // `as const`, so every leaf is a LITERAL type and `Partial` only reaches the top level — which\n // made the very call shape this merge exists to support (`{ retries: { retries: 5 } }`) a type\n // error, because `5` is not `200`. It also removes the cast the dedicated-lock caller needed.\n override?: DedicatedFileLockOptions,\n): ResolvedLockOptions {\n if (!override) return DEFAULT_LOCK_OPTIONS;\n const baseRetries = DEFAULT_LOCK_OPTIONS.retries;\n const overrideRetries = override.retries;\n const mergedRetries =\n typeof overrideRetries === 'object' && overrideRetries !== null\n ? { ...baseRetries, ...overrideRetries }\n : overrideRetries ?? baseRetries;\n return {\n ...DEFAULT_LOCK_OPTIONS,\n ...override,\n retries: mergedRetries,\n };\n}\n\nexport interface LockfileMutateOptions {\n /** Absolute path to the saas application root. */\n saasRoot: string;\n /**\n * Optional Zod schemas to validate sibling sections at parse time.\n * Companion-owned sections (e.g. `i18n`) are validated by passing\n * them here. CLI callers can pass\n * `DEFAULT_REGISTRY_SECTION_SCHEMAS` to validate `modules`.\n *\n * Sections not listed here are still PRESERVED on round-trip via\n * the envelope's `.catchall(z.unknown())` — they are simply not\n * type-narrowed.\n */\n sectionSchemas?: Record<string, z.ZodTypeAny>;\n /**\n * Override `proper-lockfile` options. Phase 0.B's measurements\n * suggest the defaults are fine for both CLI and companion\n * call patterns; this hook exists for tests + tuning.\n */\n lockOptions?: DedicatedFileLockOptions;\n /**\n * If true (default), the lockfile is created on first read with an\n * empty `sections` map. Set to false to fail with ENOENT.\n */\n createIfMissing?: boolean;\n}\n\n/**\n * Read the lockfile envelope, applying schema validation.\n *\n * - Returns a fresh empty envelope if the file does not exist\n * (and `createIfMissing` is not explicitly false).\n * - Validates the canonical envelope shape (schemaVersion, generatedAt,\n * sections) against `SaasLockfileEnvelopeSchema`.\n * - Applies caller-supplied `sectionSchemas` after the envelope\n * shape passes — failures throw a `ZodError` so the caller knows\n * exactly which section + field rejected.\n *\n * Does NOT acquire a lock; reads are unsynchronized. Callers that\n * need read-after-write coherence must read INSIDE `withLockfileMutate`.\n */\nexport async function readWildoSaasLock(\n options: Pick<LockfileMutateOptions, 'saasRoot' | 'sectionSchemas' | 'createIfMissing'>,\n): Promise<SaasLockfileEnvelope> {\n const filePath = getWildoSaasLockPath(options.saasRoot);\n let raw: string;\n try {\n raw = await fs.readFile(filePath, 'utf8');\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT' && options.createIfMissing !== false) {\n return {\n schemaVersion: 2,\n generatedAt: new Date().toISOString(),\n sections: {},\n };\n }\n throw err;\n }\n const json = JSON.parse(raw) as unknown;\n const envelope = SaasLockfileEnvelopeSchema.parse(json);\n if (options.sectionSchemas) {\n validateAndNormalizeSections(envelope.sections, options.sectionSchemas);\n }\n return envelope;\n}\n\n/**\n * Validate every present `sections.<key>` against its caller-supplied\n * Zod schema AND write the parsed (default-expanded) value back so\n * defaults declared in those schemas actually persist on disk.\n *\n * Phase 1 review (H-2.1 / M-1.2): the prior implementation called\n * `.parse(value)` and discarded the result, which meant\n * `.default(...)` clauses in section schemas were only ever applied\n * during validation — never written. Schemas with shallow defaults\n * (e.g. `installed: z.record(...).default({})`) tolerated the bug\n * because mutators always set `installed` directly, but a future\n * schema with deep defaults would silently lose them.\n */\nfunction validateAndNormalizeSections(\n sections: SaasLockfileKnownSections,\n sectionSchemas: Record<string, z.ZodTypeAny>,\n): void {\n const mutable = sections as Record<string, unknown>;\n for (const [key, schema] of Object.entries(sectionSchemas)) {\n const value = mutable[key];\n if (value === undefined) continue;\n mutable[key] = schema.parse(value);\n }\n}\n\n/**\n * Acquire the OS-level lockfile lock, run `fn`, then release it.\n *\n * Wrapper around `proper-lockfile` that:\n * - Creates the parent dir + an empty file if missing (proper-lockfile\n * refuses to lock a non-existent file).\n * - Forwards `realpath: false` so symlinked workspaces lock correctly.\n * - Always releases the lock, even on error.\n */\nasync function withLock<T>(\n filePath: string,\n fn: () => Promise<T>,\n // A MERGED value, not the defaults — see `ResolvedLockOptions`. Typing this as\n // `typeof DEFAULT_LOCK_OPTIONS` demanded the literal `200`/`5000`/`false`, so any\n // caller-overridden option was a type error at the point of USE rather than at\n // the point of override, which is why it read as a failure in the merge.\n lockOptions: ResolvedLockOptions,\n): Promise<T> {\n await fs.mkdir(path.dirname(filePath), { recursive: true });\n // Ensure the file exists; `proper-lockfile.lock` refuses ENOENT.\n try {\n await fs.access(filePath);\n } catch {\n await writeFileAtomicAsync(filePath, JSON.stringify(emptyEnvelope(), null, 2));\n }\n const release = await lockfile.lock(filePath, lockOptions);\n try {\n return await fn();\n } finally {\n await release();\n }\n}\n\n/** The one on-disk form of the envelope: two-space JSON with a trailing newline. */\nfunction serializeLockfile(envelope: SaasLockfileEnvelope): string {\n return JSON.stringify(envelope, null, 2) + '\\n';\n}\n\nfunction emptyEnvelope(): SaasLockfileEnvelope {\n return {\n schemaVersion: 2,\n generatedAt: new Date().toISOString(),\n sections: {},\n };\n}\n\nasync function writeFileAtomicAsync(filePath: string, content: string): Promise<void> {\n await new Promise<void>((resolve, reject) => {\n writeFileAtomic(filePath, content, (err: Error | undefined) => {\n if (err) reject(err);\n else resolve();\n });\n });\n}\n\n/**\n * Read-modify-write a lockfile under an OS-level lock.\n *\n * The mutator receives a deep-cloned, schema-validated envelope —\n * any in-place mutation is safe and won't bleed back into the\n * pre-write copy. After the mutator returns, the result is\n * re-validated against the envelope schema (and any caller-supplied\n * `sectionSchemas`) before being atomically written.\n *\n * `generatedAt` is refreshed only when the mutation changes the file. When the bytes that would be\n * written — with the previous `generatedAt` — equal the bytes on disk, nothing is written and the\n * envelope is returned as it was. The lockfile is committed, and a timestamp that moved on every no-op\n * sync dirtied the tree with nothing in it: a `wildo registry add` + `remove` round trip left exactly\n * one diff, this field (#1765). The comparison is on BYTES rather than on the parsed sections so a\n * no-op mutation still writes back what normalization changed (schema defaults, a missing trailing\n * newline).\n *\n * The library never inspects `sections.providers.runtimeScopes`,\n * `sections.modules`, or `sections.i18n` — it only enforces the\n * envelope shape. Concrete section semantics live in their owning\n * subsystems.\n */\nexport async function withLockfileMutate(\n options: LockfileMutateOptions,\n mutator: (envelope: SaasLockfileEnvelope) => void | Promise<void>,\n): Promise<SaasLockfileEnvelope> {\n const filePath = getWildoSaasLockPath(options.saasRoot);\n const lockOptions = mergeLockOptions(options.lockOptions);\n return withLock(filePath, async () => {\n const before = await readWildoSaasLock({\n saasRoot: options.saasRoot,\n sectionSchemas: options.sectionSchemas,\n createIfMissing: true,\n });\n const next: SaasLockfileEnvelope = structuredClone(before);\n await mutator(next);\n // Re-validate AFTER mutation; the mutator may have introduced\n // structurally-invalid input.\n SaasLockfileEnvelopeSchema.parse(next);\n if (options.sectionSchemas) {\n validateAndNormalizeSections(next.sections, options.sectionSchemas);\n }\n const onDisk = await fs.readFile(filePath, 'utf8').catch(() => null);\n if (onDisk === serializeLockfile({ ...next, generatedAt: before.generatedAt })) {\n return { ...next, generatedAt: before.generatedAt };\n }\n next.generatedAt = new Date().toISOString();\n await writeFileAtomicAsync(filePath, serializeLockfile(next));\n return next;\n }, lockOptions);\n}\n\n/**\n * Hold an OS-level `proper-lockfile` lock on an ARBITRARY dedicated lock\n * target while `fn` runs — the path-parameterized sibling of\n * `withLockfileMutate` for callers that need cross-process mutual\n * exclusion WITHOUT the `wildo-saas.lock.json` envelope semantics.\n *\n * Why this exists (meta-workflows P-20, 2026-07-03): the companion's\n * coding-agent dispatch lane serializes workspace mutations on a\n * dedicated target (`<saasRoot>/.wildo-saas/state/workspace-mutation.lock`)\n * held for the WHOLE agent run (minutes). Routing that through\n * `withLockfileMutate` would hold the shared saas lockfile hostage —\n * starving i18n/registry writers — and the envelope re-validation is\n * meaningless for a pure mutex. The primitive lives HERE (not\n * companion-local) so the CLI can adopt the SAME lock target with the\n * SAME semantics when its worktree-mutating commands learn to respect it.\n *\n * Semantics:\n * - Parent directory + an empty placeholder file are created if missing\n * (`proper-lockfile` refuses ENOENT targets). The file content is never\n * read or written by this helper — it is a pure lock anchor.\n * - `proper-lockfile` auto-refreshes the lock mtime while the holder is\n * alive, so long-running holds survive the `stale` window; a crashed\n * holder's lock goes stale and is reclaimed by the next acquirer.\n * - Lock options merge over {@link DEFAULT_LOCK_OPTIONS}. Callers that\n * want fail-fast contention (HTTP 409 instead of queueing) pass\n * `{ retries: { retries: 0 } }`.\n * - The lock is always released (or at least attempted) on completion,\n * including the error path.\n *\n * Contention surfaces as the `proper-lockfile` `ELOCKED` error\n * (`error.code === 'ELOCKED'`) — callers map it to their own conflict\n * vocabulary.\n */\nexport interface DedicatedFileLockOptions {\n /** `proper-lockfile` retry policy — `{ retries: { retries: 0 } }` = fail-fast contention. */\n retries?: { retries?: number; minTimeout?: number; maxTimeout?: number; factor?: number };\n /** Stale window in ms (lock mtime auto-refreshes while the holder lives). */\n stale?: number;\n /** Keep `false` for symlinked (pnpm-injected) workspaces. */\n realpath?: boolean;\n}\n\nexport async function withDedicatedFileLock<T>(\n lockTargetPath: string,\n fn: () => Promise<T>,\n lockOptions?: DedicatedFileLockOptions,\n): Promise<T> {\n await fs.mkdir(path.dirname(lockTargetPath), { recursive: true });\n try {\n await fs.access(lockTargetPath);\n } catch {\n await writeFileAtomicAsync(lockTargetPath, '');\n }\n const release = await lockfile.lock(\n lockTargetPath,\n mergeLockOptions(lockOptions),\n );\n try {\n return await fn();\n } finally {\n await release();\n }\n}\n\n/**\n * Canonical workspace-mutation lock target, app-root-relative. ONE constant\n * shared by every process that mutates the application worktree in a way\n * that must serialize against coding-agent dispatch runs (meta-workflows\n * P-20): the companion's dispatch lane holds it for the whole agent run;\n * CLI worktree-writers (e.g. `wildo config sync`) acquire it fail-fast\n * around their write phase. Deliberately NOT taken by human/parallel-session\n * edits (P-19b — per-file attribution compensates, never exclusion).\n * Keep companion and CLI on THIS constant — a hand-copied path is drift.\n */\nexport const WORKSPACE_MUTATION_LOCK_RELATIVE_PATH: string =\n '.wildo-saas/state/workspace-mutation.lock';\n\n/** Absolute workspace-mutation lock target for an application root. */\nexport function getWorkspaceMutationLockPath(saasRoot: string): string {\n return path.join(saasRoot, WORKSPACE_MUTATION_LOCK_RELATIVE_PATH);\n}\n\n/**\n * Section-scoped mutate. The mutator only sees one section's payload\n * (`sections.<sectionKey>`) and CANNOT reach sibling sections —\n * preventing accidental clobbers. Returns the mutated section.\n *\n * Use this from CLI callers (`RegistryLockfileService`) so cross-\n * section bugs are impossible by construction. Companion callers\n * that legitimately need full-envelope access keep using\n * `withLockfileMutate` directly.\n */\nexport async function withLockfileSectionMutate<S>(\n options: LockfileMutateOptions & {\n /** Section key under `sections` (e.g. `'modules'`, `'i18n'`). */\n sectionKey: string;\n /** Zod schema validating the section payload. Required. */\n sectionSchema: z.ZodType<S>;\n /** Initial value when the section does not yet exist. */\n initialSection: () => S;\n },\n mutator: (section: S) => S | void | Promise<S | void>,\n): Promise<S> {\n let mutatedOut!: S;\n await withLockfileMutate(\n {\n saasRoot: options.saasRoot,\n lockOptions: options.lockOptions,\n sectionSchemas: {\n ...options.sectionSchemas,\n [options.sectionKey]: options.sectionSchema,\n },\n },\n async (envelope) => {\n const sections = envelope.sections as Record<string, unknown>;\n const current = (sections[options.sectionKey] as S | undefined) ?? options.initialSection();\n const cloned = structuredClone(current);\n const ret = await mutator(cloned);\n const next = (ret ?? cloned) as S;\n // Per-section validation (also covers initial-default re-validation).\n mutatedOut = options.sectionSchema.parse(next);\n sections[options.sectionKey] = mutatedOut;\n },\n );\n return mutat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C1B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,cAAc,EAAE;YACd,GAAG,OAAO,CAAC,cAAc;YACzB,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,aAAa;SAC5C;KACF,EACD,KAAK,EAAE,QAAQ,EAAE,EAAE;QACjB,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAmC,CAAC;QAC9D,MAAM,OAAO,GAAI,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAmB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC5F,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;QACxC,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,MAAM,CAAM,CAAC;QAClC,sEAAsE;QACtE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/C,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;IAC5C,CAAC,CACF,CAAC;IACF,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["/**\n * Shared `wildo-saas.lock.json` IO primitives.\n *\n * Phase 1 graduates the locking + atomic-write surface validated by\n * the Phase 0.B contention spike (`module-registry-analysis.md`)\n * into `platform-config-lib`. Both the dev companion's\n * `WildoSaasLockCompanionService` and the CLI-side\n * `RegistryLockfileService` consume this module so concurrent\n * writers — across processes (CLI + companion + minions) — never\n * lose updates and never observe a half-written envelope.\n *\n * Exposes two layers:\n *\n * 1. `withLockfileMutate(opts, mutator)` — full-envelope mutate\n * under `proper-lockfile` + `write-file-atomic`. The companion\n * uses this so it can preserve its full-envelope contract and\n * validate its companion-owned i18n schema in the same pass.\n *\n * 2. `withLockfileSectionMutate(opts, mutator)` — section-scoped\n * mutate. The CLI uses this so it can ONLY touch one section\n * (e.g. `sections.modules`) and never accidentally clobber a\n * sibling section.\n *\n * Both layers preserve unknown sections verbatim — every consumer\n * MUST round-trip every `sections.*` key it does not recognize.\n *\n * Hard contract (KD-4 / KD-15 / KD-18):\n * - The library NEVER writes provider runtime artifacts under\n * `.wildo-saas/generated/providers/*.runtime-providers.generated.json` or\n * `src/generated/wildo-provider-runtime.generated.ts`. Those are\n * produced by the provider materialization workflow alone.\n * - `sections.providers.runtimeScopes` is owned end-to-end by the\n * provider workstream; module-registry callers MUST NOT mutate it.\n * This module is unaware of the provider section beyond\n * preserving its bytes.\n */\n\nimport { promises as fs } from 'node:fs';\nimport * as path from 'node:path';\nimport type lockfile from 'proper-lockfile';\nimport writeFileAtomic from 'write-file-atomic';\nimport { z } from 'zod';\nimport {\n SaasLockfileEnvelopeSchema,\n type SaasLockfileEnvelope,\n type SaasLockfileKnownSections,\n} from './wildo-saas-lock.shared.schemas';\nimport { assertHeldFileLocksIntact, holdFileLock, type FileLockCompromisedError } from './file-lock-hold';\n\n/**\n * Canonical path of the saas-app lockfile, relative to the saas root.\n */\nexport const WILDO_SAAS_LOCK_RELATIVE_PATH = '.wildo-saas/wildo-saas.lock.json';\n\n/**\n * Build the absolute lockfile path for a given saas root.\n */\nexport function getWildoSaasLockPath(saasRoot: string): string {\n return path.resolve(saasRoot, WILDO_SAAS_LOCK_RELATIVE_PATH);\n}\n\n/**\n * Default `proper-lockfile` options. The 5s `stale` window matches\n * the Phase 0.B spike (`module-registry-analysis.md` Phase 0.B\n * Findings): typical lock-hold time is < 50ms; 5s is generous enough\n * to absorb a CI pause without compromising legitimate locks. Tests\n * 4a-4d all passed under these settings.\n *\n * `realpath: false` is required when the saas root is symlinked\n * (common with pnpm `dependenciesMeta.injected: true` workspaces).\n */\nexport const DEFAULT_LOCK_OPTIONS = {\n retries: { retries: 200, minTimeout: 5, maxTimeout: 50, factor: 1.2 },\n stale: 5000,\n realpath: false,\n} as const satisfies Parameters<typeof lockfile.lock>[1];\n\n/**\n * The result of merging caller options over {@link DEFAULT_LOCK_OPTIONS}.\n *\n * Its leaves are WIDENED (`number` / `boolean`) and that is the point: the\n * defaults are `as const`, so `typeof DEFAULT_LOCK_OPTIONS` describes those exact\n * literals — `stale: 5000`, `realpath: false`. A merge that honours a caller\n * override cannot satisfy it, because an overridden `stale` is not `5000`.\n *\n * Annotating the merge as `typeof DEFAULT_LOCK_OPTIONS` claimed the result was\n * always the defaults, which is true only when nothing was overridden — i.e. in\n * the one case the function exists to avoid.\n */\nexport type ResolvedLockOptions = {\n /**\n * Either a retry POLICY or a bare attempt count — `proper-lockfile` accepts\n * both, and the merge passes a bare number straight through\n * (`overrideRetries ?? baseRetries`). Omitting `number` made the merge unable to\n * describe its own fallback branch.\n */\n readonly retries: number | { retries?: number; minTimeout?: number; maxTimeout?: number; factor?: number };\n readonly stale: number;\n readonly realpath: boolean;\n /** See {@link DedicatedFileLockOptions.onCompromised}. */\n readonly onCompromised?: (error: FileLockCompromisedError) => void;\n};\n\n/**\n * Deep-merge caller-supplied lock options on top of `DEFAULT_LOCK_OPTIONS`.\n *\n * Phase 1 review (M-2.1): a shallow merge replaced the entire\n * `retries` object whenever a caller passed a partial — so\n * `lockOptions: { retries: { retries: 5 } }` silently lost the\n * `minTimeout`/`maxTimeout`/`factor` defaults that Phase 0.B\n * validated. The deep merge keeps every default intact unless\n * the caller explicitly overrides each leaf.\n */\nfunction mergeLockOptions(\n // `DedicatedFileLockOptions`, NOT `Partial<typeof DEFAULT_LOCK_OPTIONS>`: that constant is\n // `as const`, so every leaf is a LITERAL type and `Partial` only reaches the top level — which\n // made the very call shape this merge exists to support (`{ retries: { retries: 5 } }`) a type\n // error, because `5` is not `200`. It also removes the cast the dedicated-lock caller needed.\n override?: DedicatedFileLockOptions,\n): ResolvedLockOptions {\n if (!override) return DEFAULT_LOCK_OPTIONS;\n const baseRetries = DEFAULT_LOCK_OPTIONS.retries;\n const overrideRetries = override.retries;\n const mergedRetries =\n typeof overrideRetries === 'object' && overrideRetries !== null\n ? { ...baseRetries, ...overrideRetries }\n : overrideRetries ?? baseRetries;\n return {\n ...DEFAULT_LOCK_OPTIONS,\n ...override,\n retries: mergedRetries,\n };\n}\n\nexport interface LockfileMutateOptions {\n /** Absolute path to the saas application root. */\n saasRoot: string;\n /**\n * Optional Zod schemas to validate sibling sections at parse time.\n * Companion-owned sections (e.g. `i18n`) are validated by passing\n * them here. CLI callers can pass\n * `DEFAULT_REGISTRY_SECTION_SCHEMAS` to validate `modules`.\n *\n * Sections not listed here are still PRESERVED on round-trip via\n * the envelope's `.catchall(z.unknown())` — they are simply not\n * type-narrowed.\n */\n sectionSchemas?: Record<string, z.ZodTypeAny>;\n /**\n * Override `proper-lockfile` options. Phase 0.B's measurements\n * suggest the defaults are fine for both CLI and companion\n * call patterns; this hook exists for tests + tuning.\n */\n lockOptions?: DedicatedFileLockOptions;\n /**\n * If true (default), the lockfile is created on first read with an\n * empty `sections` map. Set to false to fail with ENOENT.\n */\n createIfMissing?: boolean;\n}\n\n/**\n * Read the lockfile envelope, applying schema validation.\n *\n * - Returns a fresh empty envelope if the file does not exist\n * (and `createIfMissing` is not explicitly false).\n * - Validates the canonical envelope shape (schemaVersion, generatedAt,\n * sections) against `SaasLockfileEnvelopeSchema`.\n * - Applies caller-supplied `sectionSchemas` after the envelope\n * shape passes — failures throw a `ZodError` so the caller knows\n * exactly which section + field rejected.\n *\n * Does NOT acquire a lock; reads are unsynchronized. Callers that\n * need read-after-write coherence must read INSIDE `withLockfileMutate`.\n */\nexport async function readWildoSaasLock(\n options: Pick<LockfileMutateOptions, 'saasRoot' | 'sectionSchemas' | 'createIfMissing'>,\n): Promise<SaasLockfileEnvelope> {\n const filePath = getWildoSaasLockPath(options.saasRoot);\n let raw: string;\n try {\n raw = await fs.readFile(filePath, 'utf8');\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT' && options.createIfMissing !== false) {\n return {\n schemaVersion: 2,\n generatedAt: new Date().toISOString(),\n sections: {},\n };\n }\n throw err;\n }\n const json = JSON.parse(raw) as unknown;\n const envelope = SaasLockfileEnvelopeSchema.parse(json);\n if (options.sectionSchemas) {\n validateAndNormalizeSections(envelope.sections, options.sectionSchemas);\n }\n return envelope;\n}\n\n/**\n * Validate every present `sections.<key>` against its caller-supplied\n * Zod schema AND write the parsed (default-expanded) value back so\n * defaults declared in those schemas actually persist on disk.\n *\n * Phase 1 review (H-2.1 / M-1.2): the prior implementation called\n * `.parse(value)` and discarded the result, which meant\n * `.default(...)` clauses in section schemas were only ever applied\n * during validation — never written. Schemas with shallow defaults\n * (e.g. `installed: z.record(...).default({})`) tolerated the bug\n * because mutators always set `installed` directly, but a future\n * schema with deep defaults would silently lose them.\n */\nfunction validateAndNormalizeSections(\n sections: SaasLockfileKnownSections,\n sectionSchemas: Record<string, z.ZodTypeAny>,\n): void {\n const mutable = sections as Record<string, unknown>;\n for (const [key, schema] of Object.entries(sectionSchemas)) {\n const value = mutable[key];\n if (value === undefined) continue;\n mutable[key] = schema.parse(value);\n }\n}\n\n/**\n * Acquire the OS-level lockfile lock, run `fn`, then release it.\n *\n * Wrapper around `holdFileLock` (`./file-lock-hold`) that:\n * - Creates the parent dir + an empty file if missing (proper-lockfile\n * refuses to lock a non-existent file).\n * - Forwards `realpath: false` so symlinked workspaces lock correctly.\n * - Always releases the lock, even on error.\n * - Inherits the live-holder reclaim guard and the compromise-as-error\n * handling (#2225).\n */\nasync function withLock<T>(\n filePath: string,\n fn: () => Promise<T>,\n // A MERGED value, not the defaults — see `ResolvedLockOptions`. Typing this as\n // `typeof DEFAULT_LOCK_OPTIONS` demanded the literal `200`/`5000`/`false`, so any\n // caller-overridden option was a type error at the point of USE rather than at\n // the point of override, which is why it read as a failure in the merge.\n lockOptions: ResolvedLockOptions,\n): Promise<T> {\n await fs.mkdir(path.dirname(filePath), { recursive: true });\n // Ensure the file exists; `proper-lockfile.lock` refuses ENOENT.\n try {\n await fs.access(filePath);\n } catch {\n await writeFileAtomicAsync(filePath, JSON.stringify(emptyEnvelope(), null, 2));\n }\n return holdFileLock(filePath, fn, lockOptions);\n}\n\n/** The one on-disk form of the envelope: two-space JSON with a trailing newline. */\nfunction serializeLockfile(envelope: SaasLockfileEnvelope): string {\n return JSON.stringify(envelope, null, 2) + '\\n';\n}\n\nfunction emptyEnvelope(): SaasLockfileEnvelope {\n return {\n schemaVersion: 2,\n generatedAt: new Date().toISOString(),\n sections: {},\n };\n}\n\nasync function writeFileAtomicAsync(filePath: string, content: string): Promise<void> {\n await new Promise<void>((resolve, reject) => {\n writeFileAtomic(filePath, content, (err: Error | undefined) => {\n if (err) reject(err);\n else resolve();\n });\n });\n}\n\n/**\n * Read-modify-write a lockfile under an OS-level lock.\n *\n * The mutator receives a deep-cloned, schema-validated envelope —\n * any in-place mutation is safe and won't bleed back into the\n * pre-write copy. After the mutator returns, the result is\n * re-validated against the envelope schema (and any caller-supplied\n * `sectionSchemas`) before being atomically written.\n *\n * `generatedAt` is refreshed only when the mutation changes the file. When the bytes that would be\n * written — with the previous `generatedAt` — equal the bytes on disk, nothing is written and the\n * envelope is returned as it was. The lockfile is committed, and a timestamp that moved on every no-op\n * sync dirtied the tree with nothing in it: a `wildo registry add` + `remove` round trip left exactly\n * one diff, this field (#1765). The comparison is on BYTES rather than on the parsed sections so a\n * no-op mutation still writes back what normalization changed (schema defaults, a missing trailing\n * newline).\n *\n * The library never inspects `sections.providers.runtimeScopes`,\n * `sections.modules`, or `sections.i18n` — it only enforces the\n * envelope shape. Concrete section semantics live in their owning\n * subsystems.\n */\nexport async function withLockfileMutate(\n options: LockfileMutateOptions,\n mutator: (envelope: SaasLockfileEnvelope) => void | Promise<void>,\n): Promise<SaasLockfileEnvelope> {\n const filePath = getWildoSaasLockPath(options.saasRoot);\n const lockOptions = mergeLockOptions(options.lockOptions);\n return withLock(filePath, async () => {\n const before = await readWildoSaasLock({\n saasRoot: options.saasRoot,\n sectionSchemas: options.sectionSchemas,\n createIfMissing: true,\n });\n const next: SaasLockfileEnvelope = structuredClone(before);\n await mutator(next);\n // Re-validate AFTER mutation; the mutator may have introduced\n // structurally-invalid input.\n SaasLockfileEnvelopeSchema.parse(next);\n if (options.sectionSchemas) {\n validateAndNormalizeSections(next.sections, options.sectionSchemas);\n }\n const onDisk = await fs.readFile(filePath, 'utf8').catch(() => null);\n if (onDisk === serializeLockfile({ ...next, generatedAt: before.generatedAt })) {\n return { ...next, generatedAt: before.generatedAt };\n }\n next.generatedAt = new Date().toISOString();\n // A writer that lost the lock mid-mutation would overwrite whoever took it (#2225).\n assertHeldFileLocksIntact();\n await writeFileAtomicAsync(filePath, serializeLockfile(next));\n return next;\n }, lockOptions);\n}\n\n/**\n * Hold an OS-level `proper-lockfile` lock on an ARBITRARY dedicated lock\n * target while `fn` runs — the path-parameterized sibling of\n * `withLockfileMutate` for callers that need cross-process mutual\n * exclusion WITHOUT the `wildo-saas.lock.json` envelope semantics.\n *\n * Why this exists (meta-workflows P-20, 2026-07-03): the companion's\n * coding-agent dispatch lane serializes workspace mutations on a\n * dedicated target (`<saasRoot>/.wildo-saas/state/workspace-mutation.lock`)\n * held for the WHOLE agent run (minutes). Routing that through\n * `withLockfileMutate` would hold the shared saas lockfile hostage —\n * starving i18n/registry writers — and the envelope re-validation is\n * meaningless for a pure mutex. The primitive lives HERE (not\n * companion-local) so the CLI can adopt the SAME lock target with the\n * SAME semantics when its worktree-mutating commands learn to respect it.\n *\n * Semantics:\n * - Parent directory + an empty placeholder file are created if missing\n * (`proper-lockfile` refuses ENOENT targets). The file content is never\n * read or written by this helper — it is a pure lock anchor.\n * - `proper-lockfile` refreshes the lock mtime every `stale / 2` while the\n * holder is alive. That refresh can be LATE — an event-loop stall or a\n * saturated threadpool — and the mtime alone would then read as stale.\n * So a waiter's reclaim is refused while the recorded holder process is\n * alive on this host (`holdFileLock`, #2225); a CRASHED holder's lock is\n * still reclaimed after `stale`. Until #2225 this said long holds\n * \"survive the `stale` window\" unconditionally, and a 2026-10-01 build\n * wave showed they did not.\n * - Losing the lock while held never exits the process: the call rejects\n * with `FileLockCompromisedError` (`code: 'ECOMPROMISED'`) once `fn`\n * settles, and `assertHeldFileLocksIntact()` refuses inside `fn` from\n * the moment of the loss — call it before a commit or a write the lock\n * serializes.\n * - Lock options merge over {@link DEFAULT_LOCK_OPTIONS}. Callers that\n * want fail-fast contention (HTTP 409 instead of queueing) pass\n * `{ retries: { retries: 0 } }`.\n * - The lock is always released (or at least attempted) on completion,\n * including the error path.\n *\n * Contention surfaces as the `proper-lockfile` `ELOCKED` error\n * (`error.code === 'ELOCKED'`) — callers map it to their own conflict\n * vocabulary.\n */\nexport interface DedicatedFileLockOptions {\n /** `proper-lockfile` retry policy — `{ retries: { retries: 0 } }` = fail-fast contention. */\n retries?: { retries?: number; minTimeout?: number; maxTimeout?: number; factor?: number };\n /** Stale window in ms (lock mtime auto-refreshes while the holder lives). */\n stale?: number;\n /** Keep `false` for symlinked (pnpm-injected) workspaces. */\n realpath?: boolean;\n /**\n * Told once if the lock is lost while held, for the caller's own log. The section still fails with\n * `FileLockCompromisedError`. Omitted, one line goes to stderr.\n */\n onCompromised?: (error: FileLockCompromisedError) => void;\n}\n\nexport async function withDedicatedFileLock<T>(\n lockTargetPath: string,\n fn: () => Promise<T>,\n lockOptions?: DedicatedFileLockOptions,\n): Promise<T> {\n await fs.mkdir(path.dirname(lockTargetPath), { recursive: true });\n try {\n await fs.access(lockTargetPath);\n } catch {\n await writeFileAtomicAsync(lockTargetPath, '');\n }\n return holdFileLock(lockTargetPath, fn, mergeLockOptions(lockOptions));\n}\n\n/**\n * Canonical workspace-mutation lock target, app-root-relative. ONE constant\n * shared by every process that mutates the application worktree in a way\n * that must serialize against coding-agent dispatch runs (meta-workflows\n * P-20): the companion's dispatch lane holds it for the whole agent run;\n * CLI worktree-writers (e.g. `wildo config sync`) acquire it fail-fast\n * around their write phase. Deliberately NOT taken by human/parallel-session\n * edits (P-19b — per-file attribution compensates, never exclusion).\n * Keep companion and CLI on THIS constant — a hand-copied path is drift.\n */\nexport const WORKSPACE_MUTATION_LOCK_RELATIVE_PATH: string =\n '.wildo-saas/state/workspace-mutation.lock';\n\n/** Absolute workspace-mutation lock target for an application root. */\nexport function getWorkspaceMutationLockPath(saasRoot: string): string {\n return path.join(saasRoot, WORKSPACE_MUTATION_LOCK_RELATIVE_PATH);\n}\n\n/**\n * Section-scoped mutate. The mutator only sees one section's payload\n * (`sections.<sectionKey>`) and CANNOT reach sibling sections —\n * preventing accidental clobbers. Returns the mutated section.\n *\n * Use this from CLI callers (`RegistryLockfileService`) so cross-\n * section bugs are impossible by construction. Companion callers\n * that legitimately need full-envelope access keep using\n * `withLockfileMutate` directly.\n */\nexport async function withLockfileSectionMutate<S>(\n options: LockfileMutateOptions & {\n /** Section key under `sections` (e.g. `'modules'`, `'i18n'`). */\n sectionKey: string;\n /** Zod schema validating the section payload. Required. */\n sectionSchema: z.ZodType<S>;\n /** Initial value when the section does not yet exist. */\n initialSection: () => S;\n },\n mutator: (section: S) => S | void | Promise<S | void>,\n): Promise<S> {\n let mutatedOut!: S;\n await withLockfileMutate(\n {\n saasRoot: options.saasRoot,\n lockOptions: options.lockOptions,\n sectionSchemas: {\n ...options.sectionSchemas,\n [options.sectionKey]: options.sectionSchema,\n },\n },\n async (envelope) => {\n const sections = envelope.sections as Record<string, unknown>;\n const current = (sections[options.sectionKey] as S | undefined) ?? options.initialSection();\n const cloned = structuredClone(current);\n const ret = await mutator(cloned);\n const next = (ret ?? cloned) as S;\n // Per-section validation (also covers initial-default re-validation).\n mutatedOut = options.sectionSchema.parse(next);\n sections[options.sectionKey] = mutatedOut;\n },\n );\n return mutatedOut;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"materialize-infra-section.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"materialize-infra-section.d.ts","sourceRoot":"","sources":["../../../../src/lockfile/materialize-infra-section.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAKL,KAAK,wBAAwB,EAC9B,MAAM,mDAAmD,CAAC;AAE3D,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EAEpB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,KAAK,EAEV,wBAAwB,EACzB,MAAM,kCAAkC,CAAC;AAG1C;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,wBAAwB,GAAG,SAAS,CAAC;CACvD;AAED,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;IAC5C;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;;;;;OAgBG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC;IAC5D;;;;;;;OAOG;IACH,iBAAiB,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;IAC9C;;;;;;;;;;;;;;;;;OAiBG;IACH,eAAe,CAAC,EAAE,wBAAwB,CAAC;CAC5C;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,8BAA8B,GACtC,wBAAwB,GAAG,SAAS,CAuBtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"materialize-infra-section.js","sourceRoot":"","sources":["../../../src/lockfile/materialize-infra-section.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EACL,kBAAkB,EAClB,mCAAmC,EACnC,oBAAoB,GAGrB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,sDAAsD,CAAC;AAUhH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAwEtD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAuC;IAEvC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KA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uBAAuB,CAC9B,QAAuB,EACvB,IAAwB,EACxB,KAA8B,EAC9B,YAAoB,EACpB,OAAe,EACf,SAAsE;IAEtE,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACjC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,MAAM,eAAe,GAAiC;QACpD,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,SAAS,EAAE,uDAAuD;QAC3E,iBAAiB,EAAE,IAAI;QACvB,MAAM,EAAE,KAAK;KACd,CAAC;IACF,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAClD,OAAO,kBAAkB,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * `materializeInfraSection` — pure function that projects authored\n * `wildo.infra.<envName>.config.ts` files into the\n * `sections.infra` slice of `wildo-saas.lock.json` (Slice 2.5b of\n * `infra-provider-planner.md`).\n *\n * Lives in `platform-config-lib` (no runtime, no DI, no I/O — pure\n * projection). The CLI-side caller is responsible for loading the\n * authored configs from disk via\n * `loadInfraEnvConfig` (this package; the CLI's `loadAuthoredInfraEnvConfig` delegates to it) and passing\n * the parsed `backingServices` slice plus the env name.\n *\n * **Slice 2.5c-1 (2026-05-10)**: when the caller supplies an optional\n * `moduleMap` of `InfraProvider → InfraProviderModule`, the digest\n * is computed from `module.plan(planningContext)` instead of from\n * the authored entry. This captures **provider-version drift**\n * (e.g., a module change to plumbing port, secret env vars,\n * per-app blob paths) on top of authored-config drift. When the\n * map is omitted, behavior matches Slice 2.5b — backward-compatible.\n * When the map IS supplied but doesn't contain a module for the\n * resolved `InfraProvider`, the materializer falls back to the\n * authored-entry digest for that capability. After #1693 that can only\n * happen for a provider the catalogue declares servable WITHOUT a module\n * (`OPERATOR_CREDENTIALED_INFRA_PROVIDERS`, empty since #1696 gave\n * `IMMUDB_SELF` its module): every other module-less provider is refused\n * before any digest is computed.\n *\n * **#1693 (2026-09-26)**: the materializer REFUSES any declaration the\n * platform cannot serve — one that resolves to no `InfraProvider`, or to\n * one outside the `servableProviders` set the caller must supply. It used\n * to skip the first silently and hash the second, so the lockfile either\n * omitted a declared kind or recorded a selection nothing executes. Both\n * of its callers (`wildo config sync`, `wildo lock check`) reach the one\n * check here, so the two projections cannot disagree about what is\n * refused. See `backing-service-servability.ts`.\n *\n * **Slice 4.A.1 / H2 fix (2026-05-07)**: digest computation uses\n * `stableSha256Digest` (recursive sorted-keys serialization via\n * `canonical-json.ts`) so nested-object property reorders don't\n * spuriously trigger drift.\n */\n\nimport {\n BackingServiceKind,\n BackingServiceKindToInfraCapability,\n resolveInfraProvider,\n type BackingServiceEnvConfig,\n type BackingServicesEnvConfig,\n} from '../project-config/shared/backing-services.schemas';\nimport { assertBackingServiceDeclarationsServable } from '../project-config/shared/backing-service-servability';\nimport type {\n InfraProvider,\n InfraProviderModule,\n InfraProviderPlanningContext,\n} from '../project-config/shared/infra-providers.schemas';\nimport type {\n SaasLockfileInfraEnvironment,\n SaasLockfileInfraSection,\n} from './wildo-saas-lock.shared.schemas';\nimport { stableSha256Digest } from './canonical-json';\n\n/**\n * Per-env input for the materializer. The caller has already loaded\n * the authored `wildo.infra.<envName>.config.ts` and parsed it via\n * `defineInfraEnvConfig`; we only consume the `backingServices`\n * slice (the only authored surface that maps to `InfraCapability`\n * selections).\n */\nexport interface InfraEnvSelectionInput {\n envName: string;\n backingServices: BackingServicesEnvConfig | undefined;\n}\n\nexport interface MaterializeInfraSectionOptions {\n envs: ReadonlyArray<InfraEnvSelectionInput>;\n /**\n * ISO-8601 timestamp used as the selection time for NEWLY-selected\n * or CHANGED capabilities (see `previousSection` for the sticky-reuse\n * rule). Caller controls it so multi-env writes share one\n * deterministic timestamp (matches the pattern from\n * `materializeSaasProviderRuntimeArtifacts`).\n */\n generatedAt: string;\n /**\n * Optional `InfraProvider → InfraProviderModule` lookup. When\n * present, each capability's `planContributionDigest` is computed\n * from `module.plan(planningContext)` (richer — captures\n * provider-version drift) instead of from the authored entry\n * (Slice 2.5b). Slice 2.5c-1 of `infra-provider-planner.md`.\n *\n * The CLI-side caller in `provider-runtime-sync.service.ts`\n * builds this from `@wildo-ai/platform-infra-providers`'s\n * `buildInfraProviderModuleMap()`. Apps-manager-side callers\n * (none today) would do the same.\n *\n * **Module-less providers**: a resolved provider with no entry here\n * falls back to the authored-entry digest. Only a provider in\n * `servableProviders` can reach that point, so the fallback covers\n * exactly the catalogue's explicit module-less exemptions.\n */\n moduleMap?: ReadonlyMap<InfraProvider, InfraProviderModule>;\n /**\n * The providers the platform can actually SERVE — from\n * `collectServableInfraProviders()` in `@wildo-ai/platform-infra-providers`.\n * REQUIRED, not optional: a caller that could omit it would be a\n * projection that skips the refusal, and the whole point is that\n * `wildo config sync` and `wildo lock check` refuse the same\n * declarations (#1693).\n */\n servableProviders: ReadonlySet<InfraProvider>;\n /**\n * The previous lockfile's `sections.infra` (when present). Threaded\n * so `providerSelectedAt` is STICKY: a capability whose resolved\n * `provider` is unchanged retains its prior `providerSelectedAt`\n * instead of being re-stamped with `generatedAt`. Only a newly-\n * selected capability or a provider CHANGE stamps a fresh\n * `generatedAt`.\n *\n * **Why this exists**: `generatedAt` is the lockfile's volatile\n * generation timestamp — it is bumped by EVERY lockfile write,\n * including writes by unrelated subsystems via `withLockfileMutate`.\n * Deriving `providerSelectedAt` directly from it made the field\n * drift on every unrelated write, producing phantom\n * `wildo lock check` failures even when no infra selection changed.\n * Both callers — the `wildo config sync` writer and the\n * `wildo lock check` drift-checker — MUST pass the same previous\n * section so their projections agree.\n */\n previousSection?: SaasLockfileInfraSection;\n}\n\n/**\n * Project authored infra envs into the lockfile `sections.infra`\n * shape. Returns `undefined` when there are no envs to record (so\n * the lockfile writer can skip emitting the section entirely\n * instead of writing an empty `{ environments: {} }`).\n */\nexport function materializeInfraSection(\n options: MaterializeInfraSectionOptions,\n): SaasLockfileInfraSection | undefined {\n if (options.envs.length === 0) return undefined;\n\n // Refuse every unservable declaration, across every environment, before projecting any of them.\n assertBackingServiceDeclarationsServable({ envs: options.envs, servableProviders: options.servableProviders });\n\n const environments: SaasLockfileInfraSection['environments'] = {};\n let recordedAny = false;\n\n for (const env of options.envs) {\n const capabilities = projectBackingServicesToCapabilities(\n env.backingServices,\n options.generatedAt,\n env.envName,\n options.moduleMap,\n options.previousSection?.environments[env.envName],\n );\n if (Object.keys(capabilities).length === 0) continue;\n environments[env.envName] = { capabilities };\n recordedAny = true;\n }\n\n return recordedAny ? { environments } : undefined;\n}\n\nfunction projectBackingServicesToCapabilities(\n backingServices: BackingServicesEnvConfig | undefined,\n generatedAt: string,\n envName: string,\n moduleMap: ReadonlyMap<InfraProvider, InfraProviderModule> | undefined,\n previousEnv: SaasLockfileInfraEnvironment | undefined,\n): SaasLockfileInfraEnvironment['capabilities'] {\n const capabilities: SaasLockfileInfraEnvironment['capabilities'] = {};\n if (!backingServices) return capabilities;\n\n // Iterate via `Object.values(BackingServiceKind)` (Slice 4.A.2 / M7)\n // — avoids an unsafe `kindKey as BackingServiceKind` cast on\n // `Object.entries`'s string keys. `BackingServicesEnvConfigSchema`\n // is `.strict()` so unknown keys can't reach this code path; this\n // tightening just removes the dead defensive guard that came with\n // the cast.\n for (const kind of Object.values(BackingServiceKind)) {\n const entry = backingServices[kind];\n if (!entry) continue;\n const capability = BackingServiceKindToInfraCapability[kind];\n\n // Some kinds carry an additional `provider` brand (e.g. S3 = minio | aws);\n // others don't. The cast lifts to a permissive shape since\n // `BackingServiceEnvConfig` is a discriminated union and the brand only\n // exists on some variants.\n const providerBrand = (entry as BackingServiceEnvConfig & { provider?: string }).provider;\n const provider = resolveInfraProvider(kind, entry.source, providerBrand);\n if (!provider) {\n // Unreachable: `assertBackingServiceDeclarationsServable` has already refused every declaration\n // that resolves to no provider. Kept as a throw rather than a `continue`, because a silent skip\n // here is precisely the defect that assertion closed (#1693).\n throw new Error(`backingServices.${kind} in environment '${envName}' resolved to no provider after the servability check.`);\n }\n\n // Slice 2.5c-1: prefer module.plan() digest when the catalog\n // exposes a module for this provider. Falls back to the\n // authored-entry digest only for a servable provider the catalogue\n // serves without a module (the operator-credentialed exemptions).\n const planContributionDigest =\n computeModulePlanDigest(provider, kind, entry, generatedAt, envName, moduleMap)\n ?? computeAuthoredEntryDigest(entry);\n\n // `providerSelectedAt` is STICKY — only a provider's first\n // selection (or re-selection after a change) is a meaningful moment.\n // Reuse the prior timestamp when the resolved provider is unchanged\n // so an unrelated `generatedAt` bump never perturbs it (the root\n // cause of phantom `wildo lock check` infra drift). A newly-added\n // capability or a provider change stamps the fresh `generatedAt`.\n const previousEntry = previousEnv?.capabilities[capability];\n const providerSelectedAt =\n previousEntry && previousEntry.provider === provider\n ? previousEntry.providerSelectedAt\n : generatedAt;\n\n capabilities[capability] = {\n provider,\n providerSelectedAt,\n planContributionDigest,\n };\n }\n return capabilities;\n}\n\n/**\n * Stable digest of an authored `BackingServiceEnvConfig` entry.\n * Uses `stableJsonStringify` (recursive sorted-keys serialization)\n * via `stableSha256Digest` so the digest is insensitive to property-\n * order shuffles at ANY nesting level — not just top-level. This\n * matters for entries with nested objects like\n * `MongoBackingService.options: {retryWrites, w, authSource}` where\n * editor saves frequently reorder the nested keys.\n *\n * Slice 4.A.1 / H2 fix: previously this used `JSON.stringify(entry,\n * Object.keys(entry).sort())` which only sorted top-level keys.\n */\nfunction computeAuthoredEntryDigest(entry: BackingServiceEnvConfig): string {\n return stableSha256Digest(entry);\n}\n\n/**\n * Slice 2.5c-1: compute the digest by invoking the module's\n * `plan()` and hashing its contribution. Returns `undefined` when\n * the module map is missing OR doesn't cover the provider — caller\n * falls back to `computeAuthoredEntryDigest`.\n *\n * **Why include the authored entry IN the planning context**: the\n * module may use authored fields (e.g., a future opt-in flag in\n * `RabbitBackingService`) to vary its contribution. Threading the\n * entry through `config` keeps the digest sensitive to authored\n * drift even when the digest source is `module.plan()`.\n *\n * **Why ignore `generatedAt` in the digest**: the timestamp is the\n * `providerSelectedAt` field, NOT part of plan-contribution\n * identity. Using it would make every `wildo lock` run produce a\n * different digest — defeats drift detection. We don't pass it to\n * `module.plan()`; we pass it through the surrounding shape only.\n */\nfunction computeModulePlanDigest(\n provider: InfraProvider,\n kind: BackingServiceKind,\n entry: BackingServiceEnvConfig,\n _generatedAt: string,\n envName: string,\n moduleMap: ReadonlyMap<InfraProvider, InfraProviderModule> | undefined,\n): string | undefined {\n if (!moduleMap) return undefined;\n const module = moduleMap.get(provider);\n if (!module) return undefined;\n const planningContext: InfraProviderPlanningContext = {\n environment: envName,\n runtime: 'unknown', // Caller doesn't expose runtime per env at this layer.\n backingServiceKey: kind,\n config: entry,\n };\n const contribution = module.plan(planningContext);\n return stableSha256Digest(contribution);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"materialize-infra-section.js","sourceRoot":"","sources":["../../../../src/lockfile/materialize-infra-section.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EACL,kBAAkB,EAClB,mCAAmC,EACnC,oBAAoB,GAGrB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,sDAAsD,CAAC;AAUhH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAwEtD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAuC;IAEvC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAEhD,gGAAgG;IAChG,wCAAwC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAE/G,MAAM,YAAY,GAA6C,EAAE,CAAC;IAClE,IAAI,WAAW,GAAG,KAAK,CAAC;IAExB,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,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pD,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,SAAS,EAAE,uDAAuD;QAC3E,iBAAiB,EAAE,IAAI;QACvB,MAAM,EAAE,KAAK;KACd,CAAC;IACF,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAClD,OAAO,kBAAkB,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * `materializeInfraSection` — pure function that projects authored\n * `wildo.infra.<envName>.config.ts` files into the\n * `sections.infra` slice of `wildo-saas.lock.json` (Slice 2.5b of\n * `infra-provider-planner.md`).\n *\n * Lives in `platform-config-lib` (no runtime, no DI, no I/O — pure\n * projection). The CLI-side caller is responsible for loading the\n * authored configs from disk via\n * `loadInfraEnvConfig` (this package; the CLI's `loadAuthoredInfraEnvConfig` delegates to it) and passing\n * the parsed `backingServices` slice plus the env name.\n *\n * **Slice 2.5c-1 (2026-05-10)**: when the caller supplies an optional\n * `moduleMap` of `InfraProvider → InfraProviderModule`, the digest\n * is computed from `module.plan(planningContext)` instead of from\n * the authored entry. This captures **provider-version drift**\n * (e.g., a module change to plumbing port, secret env vars,\n * per-app blob paths) on top of authored-config drift. When the\n * map is omitted, behavior matches Slice 2.5b — backward-compatible.\n * When the map IS supplied but doesn't contain a module for the\n * resolved `InfraProvider`, the materializer falls back to the\n * authored-entry digest for that capability. After #1693 that can only\n * happen for a provider the catalogue declares servable WITHOUT a module\n * (`OPERATOR_CREDENTIALED_INFRA_PROVIDERS`, empty since #1696 gave\n * `IMMUDB_SELF` its module): every other module-less provider is refused\n * before any digest is computed.\n *\n * **#1693 (2026-09-26)**: the materializer REFUSES any declaration the\n * platform cannot serve — one that resolves to no `InfraProvider`, or to\n * one outside the `servableProviders` set the caller must supply. It used\n * to skip the first silently and hash the second, so the lockfile either\n * omitted a declared kind or recorded a selection nothing executes. Both\n * of its callers (`wildo config sync`, `wildo lock check`) reach the one\n * check here, so the two projections cannot disagree about what is\n * refused. See `backing-service-servability.ts`.\n *\n * **Slice 4.A.1 / H2 fix (2026-05-07)**: digest computation uses\n * `stableSha256Digest` (recursive sorted-keys serialization via\n * `canonical-json.ts`) so nested-object property reorders don't\n * spuriously trigger drift.\n */\n\nimport {\n BackingServiceKind,\n BackingServiceKindToInfraCapability,\n resolveInfraProvider,\n type BackingServiceEnvConfig,\n type BackingServicesEnvConfig,\n} from '../project-config/shared/backing-services.schemas';\nimport { assertBackingServiceDeclarationsServable } from '../project-config/shared/backing-service-servability';\nimport type {\n InfraProvider,\n InfraProviderModule,\n InfraProviderPlanningContext,\n} from '../project-config/shared/infra-providers.schemas';\nimport type {\n SaasLockfileInfraEnvironment,\n SaasLockfileInfraSection,\n} from './wildo-saas-lock.shared.schemas';\nimport { stableSha256Digest } from './canonical-json';\n\n/**\n * Per-env input for the materializer. The caller has already loaded\n * the authored `wildo.infra.<envName>.config.ts` and parsed it via\n * `defineInfraEnvConfig`; we only consume the `backingServices`\n * slice (the only authored surface that maps to `InfraCapability`\n * selections).\n */\nexport interface InfraEnvSelectionInput {\n envName: string;\n backingServices: BackingServicesEnvConfig | undefined;\n}\n\nexport interface MaterializeInfraSectionOptions {\n envs: ReadonlyArray<InfraEnvSelectionInput>;\n /**\n * ISO-8601 timestamp used as the selection time for NEWLY-selected\n * or CHANGED capabilities (see `previousSection` for the sticky-reuse\n * rule). Caller controls it so multi-env writes share one\n * deterministic timestamp (matches the pattern from\n * `materializeSaasProviderRuntimeArtifacts`).\n */\n generatedAt: string;\n /**\n * Optional `InfraProvider → InfraProviderModule` lookup. When\n * present, each capability's `planContributionDigest` is computed\n * from `module.plan(planningContext)` (richer — captures\n * provider-version drift) instead of from the authored entry\n * (Slice 2.5b). Slice 2.5c-1 of `infra-provider-planner.md`.\n *\n * The CLI-side caller in `provider-runtime-sync.service.ts`\n * builds this from `@wildo-ai/platform-infra-providers`'s\n * `buildInfraProviderModuleMap()`. Apps-manager-side callers\n * (none today) would do the same.\n *\n * **Module-less providers**: a resolved provider with no entry here\n * falls back to the authored-entry digest. Only a provider in\n * `servableProviders` can reach that point, so the fallback covers\n * exactly the catalogue's explicit module-less exemptions.\n */\n moduleMap?: ReadonlyMap<InfraProvider, InfraProviderModule>;\n /**\n * The providers the platform can actually SERVE — from\n * `collectServableInfraProviders()` in `@wildo-ai/platform-infra-providers`.\n * REQUIRED, not optional: a caller that could omit it would be a\n * projection that skips the refusal, and the whole point is that\n * `wildo config sync` and `wildo lock check` refuse the same\n * declarations (#1693).\n */\n servableProviders: ReadonlySet<InfraProvider>;\n /**\n * The previous lockfile's `sections.infra` (when present). Threaded\n * so `providerSelectedAt` is STICKY: a capability whose resolved\n * `provider` is unchanged retains its prior `providerSelectedAt`\n * instead of being re-stamped with `generatedAt`. Only a newly-\n * selected capability or a provider CHANGE stamps a fresh\n * `generatedAt`.\n *\n * **Why this exists**: `generatedAt` is the lockfile's volatile\n * generation timestamp — it is bumped by EVERY lockfile write,\n * including writes by unrelated subsystems via `withLockfileMutate`.\n * Deriving `providerSelectedAt` directly from it made the field\n * drift on every unrelated write, producing phantom\n * `wildo lock check` failures even when no infra selection changed.\n * Both callers — the `wildo config sync` writer and the\n * `wildo lock check` drift-checker — MUST pass the same previous\n * section so their projections agree.\n */\n previousSection?: SaasLockfileInfraSection;\n}\n\n/**\n * Project authored infra envs into the lockfile `sections.infra`\n * shape. Returns `undefined` when there are no envs to record (so\n * the lockfile writer can skip emitting the section entirely\n * instead of writing an empty `{ environments: {} }`).\n */\nexport function materializeInfraSection(\n options: MaterializeInfraSectionOptions,\n): SaasLockfileInfraSection | undefined {\n if (options.envs.length === 0) return undefined;\n\n // Refuse every unservable declaration, across every environment, before projecting any of them.\n assertBackingServiceDeclarationsServable({ envs: options.envs, servableProviders: options.servableProviders });\n\n const environments: SaasLockfileInfraSection['environments'] = {};\n let recordedAny = false;\n\n for (const env of options.envs) {\n const capabilities = projectBackingServicesToCapabilities(\n env.backingServices,\n options.generatedAt,\n env.envName,\n options.moduleMap,\n options.previousSection?.environments[env.envName],\n );\n if (Object.keys(capabilities).length === 0) continue;\n environments[env.envName] = { capabilities };\n recordedAny = true;\n }\n\n return recordedAny ? { environments } : undefined;\n}\n\nfunction projectBackingServicesToCapabilities(\n backingServices: BackingServicesEnvConfig | undefined,\n generatedAt: string,\n envName: string,\n moduleMap: ReadonlyMap<InfraProvider, InfraProviderModule> | undefined,\n previousEnv: SaasLockfileInfraEnvironment | undefined,\n): SaasLockfileInfraEnvironment['capabilities'] {\n const capabilities: SaasLockfileInfraEnvironment['capabilities'] = {};\n if (!backingServices) return capabilities;\n\n // Iterate via `Object.values(BackingServiceKind)` (Slice 4.A.2 / M7)\n // — avoids an unsafe `kindKey as BackingServiceKind` cast on\n // `Object.entries`'s string keys. `BackingServicesEnvConfigSchema`\n // is `.strict()` so unknown keys can't reach this code path; this\n // tightening just removes the dead defensive guard that came with\n // the cast.\n for (const kind of Object.values(BackingServiceKind)) {\n const entry = backingServices[kind];\n if (!entry) continue;\n const capability = BackingServiceKindToInfraCapability[kind];\n\n // Some kinds carry an additional `provider` brand (e.g. S3 = minio | aws);\n // others don't. The cast lifts to a permissive shape since\n // `BackingServiceEnvConfig` is a discriminated union and the brand only\n // exists on some variants.\n const providerBrand = (entry as BackingServiceEnvConfig & { provider?: string }).provider;\n const provider = resolveInfraProvider(kind, entry.source, providerBrand);\n if (!provider) {\n // Unreachable: `assertBackingServiceDeclarationsServable` has already refused every declaration\n // that resolves to no provider. Kept as a throw rather than a `continue`, because a silent skip\n // here is precisely the defect that assertion closed (#1693).\n throw new Error(`backingServices.${kind} in environment '${envName}' resolved to no provider after the servability check.`);\n }\n\n // Slice 2.5c-1: prefer module.plan() digest when the catalog\n // exposes a module for this provider. Falls back to the\n // authored-entry digest only for a servable provider the catalogue\n // serves without a module (the operator-credentialed exemptions).\n const planContributionDigest =\n computeModulePlanDigest(provider, kind, entry, generatedAt, envName, moduleMap)\n ?? computeAuthoredEntryDigest(entry);\n\n // `providerSelectedAt` is STICKY — only a provider's first\n // selection (or re-selection after a change) is a meaningful moment.\n // Reuse the prior timestamp when the resolved provider is unchanged\n // so an unrelated `generatedAt` bump never perturbs it (the root\n // cause of phantom `wildo lock check` infra drift). A newly-added\n // capability or a provider change stamps the fresh `generatedAt`.\n const previousEntry = previousEnv?.capabilities[capability];\n const providerSelectedAt =\n previousEntry && previousEntry.provider === provider\n ? previousEntry.providerSelectedAt\n : generatedAt;\n\n capabilities[capability] = {\n provider,\n providerSelectedAt,\n planContributionDigest,\n };\n }\n return capabilities;\n}\n\n/**\n * Stable digest of an authored `BackingServiceEnvConfig` entry.\n * Uses `stableJsonStringify` (recursive sorted-keys serialization)\n * via `stableSha256Digest` so the digest is insensitive to property-\n * order shuffles at ANY nesting level — not just top-level. This\n * matters for entries with nested objects like\n * `MongoBackingService.options: {retryWrites, w, authSource}` where\n * editor saves frequently reorder the nested keys.\n *\n * Slice 4.A.1 / H2 fix: previously this used `JSON.stringify(entry,\n * Object.keys(entry).sort())` which only sorted top-level keys.\n */\nfunction computeAuthoredEntryDigest(entry: BackingServiceEnvConfig): string {\n return stableSha256Digest(entry);\n}\n\n/**\n * Slice 2.5c-1: compute the digest by invoking the module's\n * `plan()` and hashing its contribution. Returns `undefined` when\n * the module map is missing OR doesn't cover the provider — caller\n * falls back to `computeAuthoredEntryDigest`.\n *\n * **Why include the authored entry IN the planning context**: the\n * module may use authored fields (e.g., a future opt-in flag in\n * `RabbitBackingService`) to vary its contribution. Threading the\n * entry through `config` keeps the digest sensitive to authored\n * drift even when the digest source is `module.plan()`.\n *\n * **Why ignore `generatedAt` in the digest**: the timestamp is the\n * `providerSelectedAt` field, NOT part of plan-contribution\n * identity. Using it would make every `wildo lock` run produce a\n * different digest — defeats drift detection. We don't pass it to\n * `module.plan()`; we pass it through the surrounding shape only.\n */\nfunction computeModulePlanDigest(\n provider: InfraProvider,\n kind: BackingServiceKind,\n entry: BackingServiceEnvConfig,\n _generatedAt: string,\n envName: string,\n moduleMap: ReadonlyMap<InfraProvider, InfraProviderModule> | undefined,\n): string | undefined {\n if (!moduleMap) return undefined;\n const module = moduleMap.get(provider);\n if (!module) return undefined;\n const planningContext: InfraProviderPlanningContext = {\n environment: envName,\n runtime: 'unknown', // Caller doesn't expose runtime per env at this layer.\n backingServiceKey: kind,\n config: entry,\n };\n const contribution = module.plan(planningContext);\n return stableSha256Digest(contribution);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wildo-saas-lock.shared.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"wildo-saas-lock.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/lockfile/wildo-saas-lock.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAEL,aAAa,EACd,MAAM,kDAAkD,CAAC;AAY1D;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B;;;;;;;IAO1C;;;OAGG;;IAEH;;;;;OAKG;;;;;QAKD,4IAA4I;;;kBAG9I,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF;;;GAGG;AACH,eAAO,MAAM,wCAAwC;;;;;;;;QAzBnD;;;WAGG;;QAEH;;;;;WAKG;;;;;YAKD,4IAA4I;;;;;;;;;;;QAf9I;;;WAGG;;QAEH;;;;;WAKG;;;;;YAKD,4IAA4I;;;;;;;;;;;QAf9I;;;WAGG;;QAEH;;;;;WAKG;;;;;YAKD,4IAA4I;;;;;;;;;;;QAf9I;;;WAGG;;QAEH;;;;;WAKG;;;;;YAKD,4IAA4I;;;;;;;;;;;QAf9I;;;WAGG;;QAEH;;;;;WAKG;;;;;YAKD,4IAA4I;;;;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e,CAAC,aAAa,CAAC,EAAE,0CAA0C,CAAC,QAAQ,EAAE;QACtF,CAAC,eAAe,CAAC,iBAAiB,CAAC,EAAE,0CAA0C,CAAC,QAAQ,EAAE;QAC1F,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,0CAA0C,CAAC,QAAQ,EAAE;KACxF,CAAC,CAAC,MAAM,EAAE;CACZ,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,YAAY,CAAC;IAC3D,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,kCAAkC,CAAC;CACvE,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,SAAS,EAAE,kCAAkC,CAAC,QAAQ,EAAE;IACxD,OAAO,EAAE,gCAAgC,CAAC,QAAQ,EAAE;IACpD,KAAK,EAAE,8BAA8B,CAAC,QAAQ,EAAE;CACjD,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAGzB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,YAAY,CAAC;IACvD,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAClD,QAAQ,EAAE,+BAA+B;CAC1C,CAAC,CAAC","sourcesContent":["/**\n * Canonical `wildo-saas.lock.json` envelope shared by every lockfile\n * writer.\n *\n * The envelope mirrors the existing companion-owned lockfile model:\n * `{ schemaVersion, generatedAt, sections }`. Each subsystem owns a\n * named section under `sections`; the envelope never promotes subsystem\n * data to top-level keys.\n *\n * Reserved section names:\n * - `i18n`: companion labelling/translation state.\n * - `providers`: provider-registration lock section.\n * - `modules`: module-registry lock section.\n * - `infra`: infra-provider planning lock section (per-environment\n * InfraCapability → InfraProvider selection + plan-contribution\n * digest). See `infra-provider-planner.md` for the design.\n */\n\nimport { z } from 'zod';\nimport { ExternalProvider_ExchangeProtocol_Kind } from '@wildo-ai/external-connectors-models';\nimport { EngineCapability } from '@wildo-ai/saas-models';\nimport { RegistryModulesLockSectionSchema } from '../registry/lockfile-modules-section.schemas';\nimport {\n InfraCapability,\n InfraProvider,\n} from '../project-config/shared/infra-providers.schemas';\n\nconst ProviderCapabilityLockValueSchema = z.string().regex(\n /^(?:[A-Z][A-Z0-9_]*(?:\\.[A-Z][A-Z0-9_]*)?|[a-z][a-z0-9]*(?:-[a-z0-9]+)*)$/,\n 'providerCapabilities must use built-in uppercase or app custom kebab-case literals',\n);\n\nconst ProviderProtocolLockValueSchema = z.union([\n z.enum(ExternalProvider_ExchangeProtocol_Kind),\n z.string().regex(/^[A-Z][A-Z0-9_]*$/, 'protocols must use known external protocol literals or backend protocol constants'),\n]);\n\n/**\n * Per-facet, per-provider locked entry. Recorded once per `(facet, ref)`.\n *\n * NEVER includes secret values. `secretsContractDigest` only digests the\n * shape of the contract: env-var names, required-ness, and descriptions.\n */\nexport const SaasLockfileProviderEntrySchema = z.strictObject({\n ref: z.string(),\n digest: z.string(),\n engineCapabilities: z.array(z.enum(EngineCapability)).default([]),\n providerCapabilities: z.array(ProviderCapabilityLockValueSchema),\n protocols: z.array(ProviderProtocolLockValueSchema),\n secretsContractDigest: z.string(),\n /**\n * The BASE ref whose connection this provider spends (#1725), present only when it is another ref — a member of\n * a declared `providers.sharedConnections` entry. Absent for every undeclared ref, which is its own connection.\n */\n connectionRef: z.string().min(1).optional(),\n /**\n * The augmentations the application opted into for this provider (#1672): third-party packages whose\n * operations run on this provider's grant. Recorded per package with its INSTALLED version and a digest of\n * the operation ids it adds, so a lock diff shows third-party code arriving, being upgraded, or changing what\n * it adds. Absent when nothing augments the provider.\n */\n augmentations: z.array(z.strictObject({\n packageName: z.string().min(1),\n packageVersion: z.string().min(1),\n operationIdsDigest: z.string().min(1),\n /** A digest of the vendor scopes it requires (#1671) — a new scope is a new thing a person may be asked to consent to. Absent when none. */\n requiredScopesDigest: z.string().min(1).optional(),\n })).optional(),\n});\nexport type SaasLockfileProviderEntry = z.infer<typeof SaasLockfileProviderEntrySchema>;\n\n/**\n * `sections.providers`: provider lock records keyed by runtime scope and\n * provider ref. Runtime scopes mirror `defineSaaSProviders({ scopes })`.\n */\nexport const SaasLockfileRuntimeScopesProvidersSchema = z.strictObject({\n backend: z.record(z.string(), SaasLockfileProviderEntrySchema).optional(),\n companion: z.record(z.string(), SaasLockfileProviderEntrySchema).optional(),\n frontendServices: z.record(\n z.string(),\n z.record(z.string(), SaasLockfileProviderEntrySchema),\n ).optional(),\n workers: z.record(\n z.string(),\n z.record(z.string(), SaasLockfileProviderEntrySchema),\n ).optional(),\n minions: z.record(\n z.string(),\n z.record(z.string(), SaasLockfileProviderEntrySchema),\n ).optional(),\n});\nexport type SaasLockfileRuntimeScopesProviders = z.infer<typeof SaasLockfileRuntimeScopesProvidersSchema>;\n\nexport const SaasLockfileProvidersSectionSchema = z.strictObject({\n runtimeScopes: SaasLockfileRuntimeScopesProvidersSchema,\n /**\n * The packages from outside the names discovery walks by itself that `providers.packages` admitted (#1676), each\n * with its INSTALLED version, sorted by name. Recorded so a lock diff shows third-party code entering provider\n * discovery, or being upgraded. Absent when the application lists none.\n */\n admittedPackages: z.array(z.strictObject({\n packageName: z.string().min(1),\n packageVersion: z.string().min(1).optional(),\n })).optional(),\n});\nexport type SaasLockfileProvidersSection = z.infer<typeof SaasLockfileProvidersSectionSchema>;\n\n/**\n * `sections.infra`: infra-provider lock records keyed by environment\n * name and `InfraCapability`. Captures which `InfraProvider` was\n * selected for a capability in a given environment and the digest of\n * its `plan()` contribution at that time. Drift between authored\n * `wildo.infra.<env>.config.ts` and the lockfile fails CI (future\n * `wildo lock --check` slice).\n *\n * Decomposition is per-environment first (then capability) because\n * `wildo.infra.<env>.config.ts` is per-env: cross-env diffs read more\n * naturally as \"env A provides QUEUE via X, env B provides QUEUE via\n * Y\" than as \"QUEUE is provided by X in env A and Y in env B\".\n */\nconst SaasLockfileInfraCapabilitySelectionSchema = z.strictObject({\n provider: z.enum(InfraProvider),\n providerSelectedAt: z.string().datetime({ offset: true }),\n planContributionDigest: z.string(),\n});\nexport type SaasLockfileInfraCapabilitySelection = z.infer<\n typeof SaasLockfileInfraCapabilitySelectionSchema\n>;\n\n/**\n * Per-environment capability map. Capabilities are sparse — an env\n * only declares the capabilities its app actually selects, so each\n * `InfraCapability` slot is `.optional()`. This mirrors the pattern\n * used by `BackingServicesEnvConfigSchema` (in\n * `../project-config/shared/backing-services.schemas.ts`).\n */\nconst SaasLockfileInfraEnvironmentSchema = z.strictObject({\n capabilities: z.object({\n [InfraCapability.DOCUMENT_DATABASE]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.RELATIONAL_DATABASE]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.AUDIT_LOG_STORAGE]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.OBJECT_STORAGE]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.ANTIVIRUS_SCANNING]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.QUEUING_SYSTEM]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.CACHE_MANAGER]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.METRICS_TELEMETRY]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.BACKUP_MANAGER]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n }).strict(),\n});\nexport type SaasLockfileInfraEnvironment = z.infer<typeof SaasLockfileInfraEnvironmentSchema>;\n\nexport const SaasLockfileInfraSectionSchema = z.strictObject({\n environments: z.record(z.string(), SaasLockfileInfraEnvironmentSchema),\n});\nexport type SaasLockfileInfraSection = z.infer<typeof SaasLockfileInfraSectionSchema>;\n\nexport const SaasLockfileKnownSectionsSchema = z.object({\n providers: SaasLockfileProvidersSectionSchema.optional(),\n modules: RegistryModulesLockSectionSchema.optional(),\n infra: SaasLockfileInfraSectionSchema.optional(),\n}).catchall(z.unknown());\nexport type SaasLockfileKnownSections = z.infer<typeof SaasLockfileKnownSectionsSchema>;\n\n/**\n * Top-level lockfile envelope.\n *\n * Forward compatibility lives in `sections`: readers validate the\n * sections they know and preserve unknown section payloads as `unknown`.\n * This keeps a provider-only tool from accidentally deleting `i18n` or\n * module-registry state.\n */\nexport const SaasLockfileEnvelopeSchema = z.strictObject({\n schemaVersion: z.literal(2),\n generatedAt: z.string().datetime({ offset: true }),\n sections: SaasLockfileKnownSectionsSchema,\n});\nexport type SaasLockfileEnvelope = z.infer<typeof SaasLockfileEnvelopeSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"wildo-saas-lock.shared.schemas.js","sourceRoot":"","sources":["../../../../src/lockfile/wildo-saas-lock.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EACL,eAAe,EACf,aAAa,GACd,MAAM,kDAAkD,CAAC;AAE1D,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CACxD,2EAA2E,EAC3E,oFAAoF,CACrF,CAAC;AAEF,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC;IAC9C,CAAC,CAAC,IAAI,CAAC,sCAAsC,CAAC;IAC9C,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,EAAE,mFAAmF,CAAC;CAC3H,CAAC,CAAC;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,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAGzB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,YAAY,CAAC;IACvD,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAClD,QAAQ,EAAE,+BAA+B;CAC1C,CAAC,CAAC","sourcesContent":["/**\n * Canonical `wildo-saas.lock.json` envelope shared by every lockfile\n * writer.\n *\n * The envelope mirrors the existing companion-owned lockfile model:\n * `{ schemaVersion, generatedAt, sections }`. Each subsystem owns a\n * named section under `sections`; the envelope never promotes subsystem\n * data to top-level keys.\n *\n * Reserved section names:\n * - `i18n`: companion labelling/translation state.\n * - `providers`: provider-registration lock section.\n * - `modules`: module-registry lock section.\n * - `infra`: infra-provider planning lock section (per-environment\n * InfraCapability → InfraProvider selection + plan-contribution\n * digest). See `infra-provider-planner.md` for the design.\n */\n\nimport { z } from 'zod';\nimport { ExternalProvider_ExchangeProtocol_Kind } from '@wildo-ai/external-connectors-models';\nimport { EngineCapability } from '@wildo-ai/saas-models';\nimport { RegistryModulesLockSectionSchema } from '../registry/lockfile-modules-section.schemas';\nimport {\n InfraCapability,\n InfraProvider,\n} from '../project-config/shared/infra-providers.schemas';\n\nconst ProviderCapabilityLockValueSchema = z.string().regex(\n /^(?:[A-Z][A-Z0-9_]*(?:\\.[A-Z][A-Z0-9_]*)?|[a-z][a-z0-9]*(?:-[a-z0-9]+)*)$/,\n 'providerCapabilities must use built-in uppercase or app custom kebab-case literals',\n);\n\nconst ProviderProtocolLockValueSchema = z.union([\n z.enum(ExternalProvider_ExchangeProtocol_Kind),\n z.string().regex(/^[A-Z][A-Z0-9_]*$/, 'protocols must use known external protocol literals or backend protocol constants'),\n]);\n\n/**\n * Per-facet, per-provider locked entry. Recorded once per `(facet, ref)`.\n *\n * NEVER includes secret values. `secretsContractDigest` only digests the\n * shape of the contract: env-var names, required-ness, and descriptions.\n */\nexport const SaasLockfileProviderEntrySchema = z.strictObject({\n ref: z.string(),\n digest: z.string(),\n engineCapabilities: z.array(z.enum(EngineCapability)).default([]),\n providerCapabilities: z.array(ProviderCapabilityLockValueSchema),\n protocols: z.array(ProviderProtocolLockValueSchema),\n secretsContractDigest: z.string(),\n /**\n * The BASE ref whose connection this provider spends (#1725), present only when it is another ref — a member of\n * a declared `providers.sharedConnections` entry. Absent for every undeclared ref, which is its own connection.\n */\n connectionRef: z.string().min(1).optional(),\n /**\n * The augmentations the application opted into for this provider (#1672): third-party packages whose\n * operations run on this provider's grant. Recorded per package with its INSTALLED version and a digest of\n * the operation ids it adds, so a lock diff shows third-party code arriving, being upgraded, or changing what\n * it adds. Absent when nothing augments the provider.\n */\n augmentations: z.array(z.strictObject({\n packageName: z.string().min(1),\n packageVersion: z.string().min(1),\n operationIdsDigest: z.string().min(1),\n /** A digest of the vendor scopes it requires (#1671) — a new scope is a new thing a person may be asked to consent to. Absent when none. */\n requiredScopesDigest: z.string().min(1).optional(),\n })).optional(),\n});\nexport type SaasLockfileProviderEntry = z.infer<typeof SaasLockfileProviderEntrySchema>;\n\n/**\n * `sections.providers`: provider lock records keyed by runtime scope and\n * provider ref. Runtime scopes mirror `defineSaaSProviders({ scopes })`.\n */\nexport const SaasLockfileRuntimeScopesProvidersSchema = z.strictObject({\n backend: z.record(z.string(), SaasLockfileProviderEntrySchema).optional(),\n companion: z.record(z.string(), SaasLockfileProviderEntrySchema).optional(),\n frontendServices: z.record(\n z.string(),\n z.record(z.string(), SaasLockfileProviderEntrySchema),\n ).optional(),\n workers: z.record(\n z.string(),\n z.record(z.string(), SaasLockfileProviderEntrySchema),\n ).optional(),\n minions: z.record(\n z.string(),\n z.record(z.string(), SaasLockfileProviderEntrySchema),\n ).optional(),\n});\nexport type SaasLockfileRuntimeScopesProviders = z.infer<typeof SaasLockfileRuntimeScopesProvidersSchema>;\n\nexport const SaasLockfileProvidersSectionSchema = z.strictObject({\n runtimeScopes: SaasLockfileRuntimeScopesProvidersSchema,\n /**\n * The packages from outside the names discovery walks by itself that `providers.packages` admitted (#1676), each\n * with its INSTALLED version, sorted by name. Recorded so a lock diff shows third-party code entering provider\n * discovery, or being upgraded. Absent when the application lists none.\n */\n admittedPackages: z.array(z.strictObject({\n packageName: z.string().min(1),\n packageVersion: z.string().min(1).optional(),\n })).optional(),\n});\nexport type SaasLockfileProvidersSection = z.infer<typeof SaasLockfileProvidersSectionSchema>;\n\n/**\n * `sections.infra`: infra-provider lock records keyed by environment\n * name and `InfraCapability`. Captures which `InfraProvider` was\n * selected for a capability in a given environment and the digest of\n * its `plan()` contribution at that time. Drift between authored\n * `wildo.infra.<env>.config.ts` and the lockfile fails CI (future\n * `wildo lock --check` slice).\n *\n * Decomposition is per-environment first (then capability) because\n * `wildo.infra.<env>.config.ts` is per-env: cross-env diffs read more\n * naturally as \"env A provides QUEUE via X, env B provides QUEUE via\n * Y\" than as \"QUEUE is provided by X in env A and Y in env B\".\n */\nconst SaasLockfileInfraCapabilitySelectionSchema = z.strictObject({\n provider: z.enum(InfraProvider),\n providerSelectedAt: z.string().datetime({ offset: true }),\n planContributionDigest: z.string(),\n});\nexport type SaasLockfileInfraCapabilitySelection = z.infer<\n typeof SaasLockfileInfraCapabilitySelectionSchema\n>;\n\n/**\n * Per-environment capability map. Capabilities are sparse — an env\n * only declares the capabilities its app actually selects, so each\n * `InfraCapability` slot is `.optional()`. This mirrors the pattern\n * used by `BackingServicesEnvConfigSchema` (in\n * `../project-config/shared/backing-services.schemas.ts`).\n */\nconst SaasLockfileInfraEnvironmentSchema = z.strictObject({\n capabilities: z.object({\n [InfraCapability.DOCUMENT_DATABASE]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.RELATIONAL_DATABASE]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.AUDIT_LOG_STORAGE]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.OBJECT_STORAGE]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.ANTIVIRUS_SCANNING]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.QUEUING_SYSTEM]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.CACHE_MANAGER]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.METRICS_TELEMETRY]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n [InfraCapability.BACKUP_MANAGER]: SaasLockfileInfraCapabilitySelectionSchema.optional(),\n }).strict(),\n});\nexport type SaasLockfileInfraEnvironment = z.infer<typeof SaasLockfileInfraEnvironmentSchema>;\n\nexport const SaasLockfileInfraSectionSchema = z.strictObject({\n environments: z.record(z.string(), SaasLockfileInfraEnvironmentSchema),\n});\nexport type SaasLockfileInfraSection = z.infer<typeof SaasLockfileInfraSectionSchema>;\n\nexport const SaasLockfileKnownSectionsSchema = z.object({\n providers: SaasLockfileProvidersSectionSchema.optional(),\n modules: RegistryModulesLockSectionSchema.optional(),\n infra: SaasLockfileInfraSectionSchema.optional(),\n}).catchall(z.unknown());\nexport type SaasLockfileKnownSections = z.infer<typeof SaasLockfileKnownSectionsSchema>;\n\n/**\n * Top-level lockfile envelope.\n *\n * Forward compatibility lives in `sections`: readers validate the\n * sections they know and preserve unknown section payloads as `unknown`.\n * This keeps a provider-only tool from accidentally deleting `i18n` or\n * module-registry state.\n */\nexport const SaasLockfileEnvelopeSchema = z.strictObject({\n schemaVersion: z.literal(2),\n generatedAt: z.string().datetime({ offset: true }),\n sections: SaasLockfileKnownSectionsSchema,\n});\nexport type SaasLockfileEnvelope = z.infer<typeof SaasLockfileEnvelopeSchema>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-public-pricing-catalog.loader.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"application-public-pricing-catalog.loader.d.ts","sourceRoot":"","sources":["../../../../src/project-config/application-public-pricing-catalog.loader.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAmD,KAAK,oBAAoB,EAAyB,MAAM,uBAAuB,CAAC;AAE1I,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI5D,uGAAuG;AACvG,eAAO,MAAM,6BAA6B,WAAW,CAAC;AAEtD,MAAM,WAAW,wCAAwC;IACvD,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IACxD,yFAAyF;IACzF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAsB,mCAAmC,CAAC,KAAK,EAAE,wCAAwC,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA2BxI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-public-pricing-catalog.loader.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"application-public-pricing-catalog.loader.js","sourceRoot":"","sources":["../../../../src/project-config/application-public-pricing-catalog.loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAoD,MAAM,uBAAuB,CAAC;AAG1I,OAAO,EAAE,UAAU,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAE3E,uGAAuG;AACvG,MAAM,CAAC,MAAM,6BAA6B,GAAG,QAAQ,CAAC;AAUtD,MAAM,CAAC,KAAK,UAAU,mCAAmC,CAAC,KAA+C;IACvG,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,6BAA6B,CAAC,CAAC;IAC5E,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAEhD,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,MAAM,SAAS,GAAG,gCAAgC,CAAC,WAAW,EAAE,SAAS,EAAE,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACrH,mGAAmG;IACnG,6BAA6B,EAAE,CAAC;IAEhC,IAAI,OAAoC,CAAC;IACzC,IAAI,CAAC;QACH,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAA4D,SAAS,CAAC,CAAC;QAChH,IAAI,OAAO,gBAAgB,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;YAC7D,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,GAAG,MAAM,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,sDAAsD,SAAS,6DAA6D;cACxH,+DAA+D,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAChG,CAAC;IACJ,CAAC;IAED,OAAO,0BAA0B,CAC/B,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,kBAAkB,IAAI,EAAE,CAAC,EAC5D,KAAK,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAC1E,CAAC;AACJ,CAAC","sourcesContent":["/**\n * `loadApplicationPublicPricingCatalog` — the application's billing catalogue, as its public pricing\n * surfaces may state it, read at BUILD time from the application's shared library (#1835).\n *\n * ## The one source\n *\n * The catalogue an application sells is the `productDefinitions` its shared modules declare — the same\n * array the backend's catalogue sync pushes to the billing provider. A public website that advertises\n * prices must read that array, not a copy: before this, every generated site re-typed its prices, and\n * Wonder Todos' site published a tier its own catalogue does not sell.\n *\n * ## Why it reads SOURCE\n *\n * Through the ONE door the dev companion and the CLI already open — the shared library's `./companion`\n * entry, resolved with `moduleResolution: 'framework-source'` and evaluated by `loadConfig` (jiti). A\n * website image builds only the website (`pnpm --filter ./website run build`), so the shared library's\n * `dist` does not exist there; and where it does exist, a dist older than its source is a price the site\n * would advertise after the catalogue changed. Measured on Wonder Todos: the whole shared graph loads\n * from source in about ten seconds cold and 2.3 seconds warm, once per build, only for the pages that ask.\n *\n * ## ABSENT vs FAILED\n *\n * An application that declares no shared library has no catalogue, and gets an empty one. A shared\n * library that cannot be LOADED is not \"no plans\" — publishing an empty pricing page, or one whose\n * structured data offers nothing, would be a false statement about what the application sells — so it\n * throws, and the build stops with the reason.\n */\nimport { resolve as resolvePath } from 'node:path';\n\nimport { derivePublicPricingCatalog, describeCaughtError, type PublicPricingCatalog, type SharedSaaSModule } from '@wildo-ai/saas-models';\n\nimport type { WildoSaasConfig } from './define-saas-config';\nimport { loadConfig, resolvePackageCompanionEntryPath } from './loader';\nimport { registerStaticAssetImportNoop } from './static-asset-import-noop';\n\n/** The library id the dev companion reads shared modules from, and the one every scaffold declares. */\nexport const APPLICATION_SHARED_LIBRARY_ID = 'shared';\n\nexport interface LoadApplicationPublicPricingCatalogInput {\n /** The application root (the directory holding `wildo.saas.config.ts`). */\n readonly saasRoot: string;\n readonly saasConfig: Pick<WildoSaasConfig, 'libraries'>;\n /** Keep only plans this scope may subscribe to (a `ResourcePrimaryScope` wire value). */\n readonly targetScope?: string;\n}\n\nexport async function loadApplicationPublicPricingCatalog(input: LoadApplicationPublicPricingCatalogInput): Promise<PublicPricingCatalog> {\n const library = input.saasConfig.libraries?.[APPLICATION_SHARED_LIBRARY_ID];\n if (library === undefined) return { plans: [] };\n\n const packageRoot = resolvePath(input.saasRoot, library.path);\n const entryPath = resolvePackageCompanionEntryPath(packageRoot, undefined, { moduleResolution: 'framework-source' });\n // The shared graph reaches frontend presets that import stylesheets; Node cannot execute a `.css`.\n registerStaticAssetImportNoop();\n\n let modules: readonly SharedSaaSModule[];\n try {\n const companionExports = await loadConfig<{ loadSharedModules?: () => Promise<SharedSaaSModule[]> }>(entryPath);\n if (typeof companionExports.loadSharedModules !== 'function') {\n throw new Error(`its default export has no loadSharedModules() function`);\n }\n modules = await companionExports.loadSharedModules();\n } catch (error) {\n throw new Error(\n `Could not load the application's shared library at ${entryPath}, so the plans its pricing surfaces advertise are unknown. `\n + `Refusing to state an empty catalogue in their place. Cause: ${describeCaughtError(error)}`,\n );\n }\n\n return derivePublicPricingCatalog(\n modules.flatMap((module) => module.productDefinitions ?? []),\n input.targetScope === undefined ? {} : { targetScope: input.targetScope },\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-framework-config.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"define-framework-config.d.ts","sourceRoot":"","sources":["../../../../src/project-config/define-framework-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,oBAAY,6BAA6B;IACvC,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;CAC5C;AAED,oBAAY,gCAAgC;IAC1C,OAAO,YAAY;IACnB,IAAI,SAAS;CACd;AAED,eAAO,MAAM,sCAAsC;;;;iBAIjD,CAAC;AACH,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sCAAsC,CAAC,CAAC;AAEtG,eAAO,MAAM,oCAAoC;;;;iBAsB/C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAElG,eAAO,MAAM,uCAAuC;;;;;;;;iBAmClD,CAAC;AACH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC;AAExG,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;iBAQrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEnF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,yBAAyB,GAAG,oBAAoB,CAE7F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-framework-config.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"define-framework-config.js","sourceRoot":"","sources":["../../../../src/project-config/define-framework-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,kCAAkC,EAClC,sCAAsC,EACtC,2BAA2B,GAC5B,MAAM,wCAAwC,CAAC;AAEhD,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CACzC,iBAAiB,EACjB,kDAAkD,CACnD,CAAC;AAEF,MAAM,CAAN,IAAY,6BAGX;AAHD,WAAY,6BAA6B;IACvC,sEAAqC,CAAA;IACrC,4EAA2C,CAAA;AAC7C,CAAC,EAHW,6BAA6B,KAA7B,6BAA6B,QAGxC;AAED,MAAM,CAAN,IAAY,gCAGX;AAHD,WAAY,gCAAgC;IAC1C,uDAAmB,CAAA;IACnB,iDAAa,CAAA;AACf,CAAC,EAHW,gCAAgC,KAAhC,gCAAgC,QAG3C;AAED,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,6BAA6B,CAAC;IACj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;gBACd,IAAI,EAAE,CAAC,QAAQ,CAAC;gBAChB,OAAO,EAAE,+BAA+B,KAAK,CAAC,SAAS,kBAAkB;aAC1E,CAAC,CAAC;QACL,CAAC;QACD,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAEpC,MAAM,cAAc,GAAG,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACxD,IAAI,gBAAgB,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;YACzC,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,QAAQ,CAAC;gBAChB,OAAO,EAAE,kCAAkC,cAAc,kBAAkB;aAC5E,CAAC,CAAC;QACL,CAAC;QACD,gBAAgB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC;AACH,CAAC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,gBAAgB,EAAE,kBAAkB;IACpC,aAAa,EAAE,kBAAkB;IACjC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,GAAG,EAAE,oCAAoC;QACzC,MAAM,EAAE,uCAAuC;KAChD,CAAC;CACH,CAAC,CAAC;AAIH;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAiC;IACrE,OAAO,0BAA0B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n FRAMEWORK_RELEASE_DOCKER_NAMESPACE,\n FRAMEWORK_RELEASE_DOCKER_REGISTRY_HOST,\n FRAMEWORK_RELEASE_NPM_SCOPE,\n} from '../release/framework-release.constants';\n\nconst SimpleSemverSchema = z.string().regex(\n /^\\d+\\.\\d+\\.\\d+$/,\n 'must be a simple semver string in the form x.y.z',\n);\n\nexport enum WildoFrameworkDockerImageRole {\n PLATFORM_SERVICE = 'platform-service',\n APPLICATION_BACKEND = 'application-backend',\n}\n\nexport enum WildoFrameworkDockerImageVariant {\n DEFAULT = 'default',\n JAVA = 'java',\n}\n\nexport const WildoFrameworkReleaseDockerImageSchema = z.object({\n imageName: z.string().min(1),\n role: z.nativeEnum(WildoFrameworkDockerImageRole),\n variant: z.nativeEnum(WildoFrameworkDockerImageVariant).default(WildoFrameworkDockerImageVariant.DEFAULT),\n});\nexport type WildoFrameworkReleaseDockerImage = z.infer<typeof WildoFrameworkReleaseDockerImageSchema>;\n\nexport const WildoFrameworkReleaseNpmConfigSchema = z.object({\n scope: z.literal(FRAMEWORK_RELEASE_NPM_SCOPE),\n /**\n * Canonical HTTPS URL of the repository that owns every published framework\n * package. This is the single authority from which per-package\n * `repository` metadata is derived at publish materialization.\n *\n * It is declared here rather than in each package manifest for two reasons:\n * every framework package is published from ONE repository, so thirteen\n * hand-maintained copies could only ever drift; and npm trusted publishing\n * (OIDC) validates the published `repository.url` against the GitHub\n * repository that ran the workflow, which makes an inconsistent copy a\n * publish failure rather than a cosmetic defect.\n *\n * Authored WITHOUT the `git+` prefix or the `.git` suffix — the materializer\n * applies npm's canonical `git+<url>.git` form so the shape cannot drift\n * between packages.\n */\n repositoryUrl: z.url().refine((value) => !value.endsWith('.git'), {\n message: 'must be authored without the \".git\" suffix; the publish materializer applies npm\\'s canonical form',\n }),\n packages: z.array(z.string().min(1)).default([]),\n});\nexport type WildoFrameworkReleaseNpmConfig = z.infer<typeof WildoFrameworkReleaseNpmConfigSchema>;\n\nexport const WildoFrameworkReleaseDockerConfigSchema = z.object({\n /**\n * Registry host that owns the published images, stated explicitly so the\n * choice is reviewable. Locked, like `namespace` and the npm `scope`: a\n * framework release must not silently retarget its registry, because the\n * image reference is a public contract and a redirected push is\n * indistinguishable from a correct one until a consumer pulls.\n */\n registryHost: z.literal(FRAMEWORK_RELEASE_DOCKER_REGISTRY_HOST),\n namespace: z.literal(FRAMEWORK_RELEASE_DOCKER_NAMESPACE),\n images: z.array(WildoFrameworkReleaseDockerImageSchema).default([]),\n}).superRefine((config, ctx) => {\n const seenImageNames = new Set<string>();\n const seenRoleVariants = new Set<string>();\n\n for (const image of config.images) {\n if (seenImageNames.has(image.imageName)) {\n ctx.addIssue({\n code: 'custom',\n path: ['images'],\n message: `duplicate docker imageName \"${image.imageName}\" is not allowed`,\n });\n }\n seenImageNames.add(image.imageName);\n\n const roleVariantKey = `${image.role}:${image.variant}`;\n if (seenRoleVariants.has(roleVariantKey)) {\n ctx.addIssue({\n code: 'custom',\n path: ['images'],\n message: `duplicate docker role/variant \"${roleVariantKey}\" is not allowed`,\n });\n }\n seenRoleVariants.add(roleVariantKey);\n }\n});\nexport type WildoFrameworkReleaseDockerConfig = z.infer<typeof WildoFrameworkReleaseDockerConfigSchema>;\n\nexport const WildoFrameworkConfigSchema = z.object({\n version: z.number().int().positive().default(1),\n frameworkVersion: SimpleSemverSchema,\n minCliVersion: SimpleSemverSchema,\n publish: z.object({\n npm: WildoFrameworkReleaseNpmConfigSchema,\n docker: WildoFrameworkReleaseDockerConfigSchema,\n }),\n});\nexport type WildoFrameworkConfig = z.infer<typeof WildoFrameworkConfigSchema>;\nexport type WildoFrameworkConfigInput = z.input<typeof WildoFrameworkConfigSchema>;\n\n/**\n * Define framework-scoped release configuration.\n *\n * This is the author-owned source of truth for framework release metadata that\n * later materializes into `wildo-framework.info.json` and the CLI publish flow.\n */\nexport function defineFrameworkConfig(config: WildoFrameworkConfigInput): WildoFrameworkConfig {\n return WildoFrameworkConfigSchema.parse(config);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-infra-env-config.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"define-infra-env-config.d.ts","sourceRoot":"","sources":["../../../../src/project-config/define-infra-env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