@alneas/eaos-server 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE +21 -0
- package/README.ja.md +39 -0
- package/README.md +40 -2
- package/dist/agentic/agent-jobs.d.ts +329 -0
- package/dist/agentic/agent-jobs.js +15 -0
- package/dist/agentic/agent-jobs.js.map +1 -0
- package/dist/agentic/agent-node.d.ts +40 -0
- package/dist/agentic/agent-node.js +7 -0
- package/dist/agentic/agent-node.js.map +1 -0
- package/dist/agentic/agent-runner.d.ts +33 -0
- package/dist/agentic/agent-runner.js +7 -0
- package/dist/agentic/agent-runner.js.map +1 -0
- package/dist/agentic/ai-broker.d.ts +169 -0
- package/dist/agentic/ai-broker.js +8 -0
- package/dist/agentic/ai-broker.js.map +1 -0
- package/dist/agentic/atomic-checkpointer.d.ts +137 -0
- package/dist/agentic/atomic-checkpointer.js +9 -0
- package/dist/agentic/atomic-checkpointer.js.map +1 -0
- package/dist/agentic/autonomous-worker.d.ts +95 -0
- package/dist/agentic/autonomous-worker.js +9 -0
- package/dist/agentic/autonomous-worker.js.map +1 -0
- package/dist/agentic/event-bridge.d.ts +344 -0
- package/dist/agentic/event-bridge.js +9 -0
- package/dist/agentic/event-bridge.js.map +1 -0
- package/dist/agentic/executor.d.ts +91 -0
- package/dist/agentic/executor.js +12 -0
- package/dist/agentic/executor.js.map +1 -0
- package/dist/agentic/graph-projection.d.ts +119 -0
- package/dist/agentic/graph-projection.js +7 -0
- package/dist/agentic/graph-projection.js.map +1 -0
- package/dist/agentic/graph.d.ts +524 -0
- package/dist/agentic/graph.js +7 -0
- package/dist/agentic/graph.js.map +1 -0
- package/dist/agentic/index.d.ts +24 -0
- package/dist/agentic/index.js +86 -0
- package/dist/agentic/index.js.map +1 -0
- package/dist/agentic/local-runner.d.ts +102 -0
- package/dist/agentic/local-runner.js +7 -0
- package/dist/agentic/local-runner.js.map +1 -0
- package/dist/agentic/remote-executor.d.ts +67 -0
- package/dist/agentic/remote-executor.js +8 -0
- package/dist/agentic/remote-executor.js.map +1 -0
- package/dist/agentic/types.d.ts +157 -0
- package/dist/agentic/types.js +7 -0
- package/dist/agentic/types.js.map +1 -0
- package/dist/agentic/workflow-catalog.d.ts +152 -0
- package/dist/agentic/workflow-catalog.js +7 -0
- package/dist/agentic/workflow-catalog.js.map +1 -0
- package/dist/agentic/workflow-compiler.d.ts +44 -0
- package/dist/agentic/workflow-compiler.js +8 -0
- package/dist/agentic/workflow-compiler.js.map +1 -0
- package/dist/agentic/workflow-coordinator.d.ts +170 -0
- package/dist/agentic/workflow-coordinator.js +8 -0
- package/dist/agentic/workflow-coordinator.js.map +1 -0
- package/dist/agentic/workflow-manager.d.ts +91 -0
- package/dist/agentic/workflow-manager.js +7 -0
- package/dist/agentic/workflow-manager.js.map +1 -0
- package/dist/agentic/workflow-registry.d.ts +334 -0
- package/dist/agentic/workflow-registry.js +7 -0
- package/dist/agentic/workflow-registry.js.map +1 -0
- package/dist/artifacts-CteHmCMI.d.ts +614 -0
- package/dist/auth-hooks/api-key.d.ts +75 -0
- package/dist/auth-hooks/api-key.js +7 -0
- package/dist/auth-hooks/api-key.js.map +1 -0
- package/dist/auth-hooks/index.d.ts +80 -0
- package/dist/auth-hooks/index.js +28 -0
- package/dist/auth-hooks/index.js.map +1 -0
- package/dist/browser-auth/account-memberships.d.ts +213 -0
- package/dist/browser-auth/account-memberships.js +13 -0
- package/dist/browser-auth/account-memberships.js.map +1 -0
- package/dist/browser-auth/index.d.ts +8 -0
- package/dist/browser-auth/index.js +59 -0
- package/dist/browser-auth/index.js.map +1 -0
- package/dist/browser-auth/kratos-session.d.ts +37 -0
- package/dist/browser-auth/kratos-session.js +7 -0
- package/dist/browser-auth/kratos-session.js.map +1 -0
- package/dist/browser-auth/platform-session.d.ts +120 -0
- package/dist/browser-auth/platform-session.js +7 -0
- package/dist/browser-auth/platform-session.js.map +1 -0
- package/dist/browser-auth/public-memberships.d.ts +22 -0
- package/dist/browser-auth/public-memberships.js +7 -0
- package/dist/browser-auth/public-memberships.js.map +1 -0
- package/dist/cache/index.d.ts +181 -0
- package/dist/cache/index.js +197 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/chunk-32746UQZ.js +131 -0
- package/dist/chunk-32746UQZ.js.map +1 -0
- package/dist/chunk-3NLSWP2Y.js +223 -0
- package/dist/chunk-3NLSWP2Y.js.map +1 -0
- package/dist/chunk-3P4XTTQH.js +346 -0
- package/dist/chunk-3P4XTTQH.js.map +1 -0
- package/dist/chunk-3VITSHN3.js +15 -0
- package/dist/chunk-3VITSHN3.js.map +1 -0
- package/dist/chunk-46UWPEW2.js +226 -0
- package/dist/chunk-46UWPEW2.js.map +1 -0
- package/dist/chunk-4VORUFKR.js +45 -0
- package/dist/chunk-4VORUFKR.js.map +1 -0
- package/dist/chunk-55D4ERWO.js +1 -0
- package/dist/chunk-55D4ERWO.js.map +1 -0
- package/dist/chunk-5TBBZIND.js +18 -0
- package/dist/chunk-5TBBZIND.js.map +1 -0
- package/dist/chunk-5WOZWPZA.js +211 -0
- package/dist/chunk-5WOZWPZA.js.map +1 -0
- package/dist/chunk-6CBVZ6CT.js +168 -0
- package/dist/chunk-6CBVZ6CT.js.map +1 -0
- package/dist/chunk-6KV5CJBW.js +221 -0
- package/dist/chunk-6KV5CJBW.js.map +1 -0
- package/dist/chunk-6XZXYNJR.js +74 -0
- package/dist/chunk-6XZXYNJR.js.map +1 -0
- package/dist/chunk-753HWDSC.js +222 -0
- package/dist/chunk-753HWDSC.js.map +1 -0
- package/dist/chunk-7AHSS7SO.js +81 -0
- package/dist/chunk-7AHSS7SO.js.map +1 -0
- package/dist/chunk-7FTJN4SA.js +1 -0
- package/dist/chunk-7FTJN4SA.js.map +1 -0
- package/dist/chunk-AVDMLTPF.js +24 -0
- package/dist/chunk-AVDMLTPF.js.map +1 -0
- package/dist/chunk-BKAHUEIT.js +95 -0
- package/dist/chunk-BKAHUEIT.js.map +1 -0
- package/dist/chunk-CJ7OFEF7.js +134 -0
- package/dist/chunk-CJ7OFEF7.js.map +1 -0
- package/dist/chunk-DHQGNP4T.js +770 -0
- package/dist/chunk-DHQGNP4T.js.map +1 -0
- package/dist/chunk-EJKWDZIU.js +111 -0
- package/dist/chunk-EJKWDZIU.js.map +1 -0
- package/dist/chunk-F3O7CELI.js +23 -0
- package/dist/chunk-F3O7CELI.js.map +1 -0
- package/dist/chunk-FD6VC2NA.js +66 -0
- package/dist/chunk-FD6VC2NA.js.map +1 -0
- package/dist/chunk-FRRRWAHO.js +14 -0
- package/dist/chunk-FRRRWAHO.js.map +1 -0
- package/dist/chunk-HCKAGLLB.js +17 -0
- package/dist/chunk-HCKAGLLB.js.map +1 -0
- package/dist/chunk-HVC7FG6B.js +191 -0
- package/dist/chunk-HVC7FG6B.js.map +1 -0
- package/dist/chunk-HXFVOR7Z.js +496 -0
- package/dist/chunk-HXFVOR7Z.js.map +1 -0
- package/dist/chunk-IJWYS2PF.js +122 -0
- package/dist/chunk-IJWYS2PF.js.map +1 -0
- package/dist/chunk-INCHXAFK.js +1395 -0
- package/dist/chunk-INCHXAFK.js.map +1 -0
- package/dist/chunk-JT6BRGQM.js +1 -0
- package/dist/chunk-JT6BRGQM.js.map +1 -0
- package/dist/chunk-L6PMAEMB.js +115 -0
- package/dist/chunk-L6PMAEMB.js.map +1 -0
- package/dist/chunk-LOUGW6MU.js +126 -0
- package/dist/chunk-LOUGW6MU.js.map +1 -0
- package/dist/chunk-LYPZPE53.js +129 -0
- package/dist/chunk-LYPZPE53.js.map +1 -0
- package/dist/chunk-NNCCN7JP.js +186 -0
- package/dist/chunk-NNCCN7JP.js.map +1 -0
- package/dist/chunk-PBC3MZUL.js +212 -0
- package/dist/chunk-PBC3MZUL.js.map +1 -0
- package/dist/chunk-R4ADP2DC.js +20 -0
- package/dist/chunk-R4ADP2DC.js.map +1 -0
- package/dist/chunk-RHN4Y6VS.js +44 -0
- package/dist/chunk-RHN4Y6VS.js.map +1 -0
- package/dist/chunk-THYUY5ZZ.js +204 -0
- package/dist/chunk-THYUY5ZZ.js.map +1 -0
- package/dist/chunk-UGNTCOVR.js +28 -0
- package/dist/chunk-UGNTCOVR.js.map +1 -0
- package/dist/chunk-VC2PCK2S.js +31 -0
- package/dist/chunk-VC2PCK2S.js.map +1 -0
- package/dist/chunk-VF5YDZJC.js +305 -0
- package/dist/chunk-VF5YDZJC.js.map +1 -0
- package/dist/chunk-VISRDVTK.js +675 -0
- package/dist/chunk-VISRDVTK.js.map +1 -0
- package/dist/chunk-W6O3LVBY.js +102 -0
- package/dist/chunk-W6O3LVBY.js.map +1 -0
- package/dist/chunk-WFEAKJLR.js +47 -0
- package/dist/chunk-WFEAKJLR.js.map +1 -0
- package/dist/chunk-XIEY2OF4.js +67 -0
- package/dist/chunk-XIEY2OF4.js.map +1 -0
- package/dist/chunk-XITLHDG3.js +37 -0
- package/dist/chunk-XITLHDG3.js.map +1 -0
- package/dist/chunk-XMWPYZWZ.js +61 -0
- package/dist/chunk-XMWPYZWZ.js.map +1 -0
- package/dist/chunk-XUP6CNOM.js +34 -0
- package/dist/chunk-XUP6CNOM.js.map +1 -0
- package/dist/chunk-YABTQZDJ.js +25 -0
- package/dist/chunk-YABTQZDJ.js.map +1 -0
- package/dist/chunk-YMJ7BRKU.js +510 -0
- package/dist/chunk-YMJ7BRKU.js.map +1 -0
- package/dist/chunk-ZC3XWU7B.js +28 -0
- package/dist/chunk-ZC3XWU7B.js.map +1 -0
- package/dist/chunk-ZHMTD5KV.js +90 -0
- package/dist/chunk-ZHMTD5KV.js.map +1 -0
- package/dist/chunk-ZWZDLOE7.js +160 -0
- package/dist/chunk-ZWZDLOE7.js.map +1 -0
- package/dist/db-package/db/local-first-sqlite-adapter.d.ts +432 -0
- package/dist/db-package/db/local-first-sqlite-adapter.js +7 -0
- package/dist/db-package/db/local-first-sqlite-adapter.js.map +1 -0
- package/dist/db-package/index.d.ts +7 -0
- package/dist/db-package/index.js +16 -0
- package/dist/db-package/index.js.map +1 -0
- package/dist/db-package/migration/aggregator.d.ts +86 -0
- package/dist/db-package/migration/aggregator.js +7 -0
- package/dist/db-package/migration/aggregator.js.map +1 -0
- package/dist/db-package/migration/index.d.ts +3 -0
- package/dist/db-package/migration/index.js +8 -0
- package/dist/db-package/migration/index.js.map +1 -0
- package/dist/engine.d.ts +205 -0
- package/dist/engine.js +20 -0
- package/dist/engine.js.map +1 -0
- package/dist/entitlements/index.d.ts +313 -0
- package/dist/entitlements/index.js +23 -0
- package/dist/entitlements/index.js.map +1 -0
- package/dist/execution/index.d.ts +50 -0
- package/dist/execution/index.js +57 -0
- package/dist/execution/index.js.map +1 -0
- package/dist/extensions/index.d.ts +172 -0
- package/dist/extensions/index.js +95 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/health/index.d.ts +35 -0
- package/dist/health/index.js +7 -0
- package/dist/health/index.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +160 -0
- package/dist/index.js.map +1 -0
- package/dist/lifecycle/index.d.ts +133 -0
- package/dist/lifecycle/index.js +13 -0
- package/dist/lifecycle/index.js.map +1 -0
- package/dist/lifecycle-engine/backend-migration.d.ts +2 -0
- package/dist/lifecycle-engine/backend-migration.js +11 -0
- package/dist/lifecycle-engine/backend-migration.js.map +1 -0
- package/dist/lifecycle-engine/baseline.d.ts +2 -0
- package/dist/lifecycle-engine/baseline.js +9 -0
- package/dist/lifecycle-engine/baseline.js.map +1 -0
- package/dist/lifecycle-engine/index.d.ts +1497 -0
- package/dist/lifecycle-engine/index.js +41 -0
- package/dist/lifecycle-engine/index.js.map +1 -0
- package/dist/lifecycle-engine/platform/artifacts.d.ts +4 -0
- package/dist/lifecycle-engine/platform/artifacts.js +7 -0
- package/dist/lifecycle-engine/platform/artifacts.js.map +1 -0
- package/dist/lifecycle-engine/platform/control-plane.d.ts +12 -0
- package/dist/lifecycle-engine/platform/control-plane.js +2 -0
- package/dist/lifecycle-engine/platform/control-plane.js.map +1 -0
- package/dist/lifecycle-engine/platform/database-router.d.ts +118 -0
- package/dist/lifecycle-engine/platform/database-router.js +7 -0
- package/dist/lifecycle-engine/platform/database-router.js.map +1 -0
- package/dist/lifecycle-engine/platform/deployment-placements.d.ts +464 -0
- package/dist/lifecycle-engine/platform/deployment-placements.js +16 -0
- package/dist/lifecycle-engine/platform/deployment-placements.js.map +1 -0
- package/dist/lifecycle-engine/platform/deployment.d.ts +4 -0
- package/dist/lifecycle-engine/platform/deployment.js +17 -0
- package/dist/lifecycle-engine/platform/deployment.js.map +1 -0
- package/dist/lifecycle-engine/platform/index.d.ts +737 -0
- package/dist/lifecycle-engine/platform/index.js +60 -0
- package/dist/lifecycle-engine/platform/index.js.map +1 -0
- package/dist/lifecycle-engine/platform/runtime.d.ts +80 -0
- package/dist/lifecycle-engine/platform/runtime.js +11 -0
- package/dist/lifecycle-engine/platform/runtime.js.map +1 -0
- package/dist/lifecycle-engine/platform/site-publication.d.ts +102 -0
- package/dist/lifecycle-engine/platform/site-publication.js +7 -0
- package/dist/lifecycle-engine/platform/site-publication.js.map +1 -0
- package/dist/lifecycle-engine/platform/user-directory.d.ts +139 -0
- package/dist/lifecycle-engine/platform/user-directory.js +13 -0
- package/dist/lifecycle-engine/platform/user-directory.js.map +1 -0
- package/dist/mcp.d.ts +92 -0
- package/dist/mcp.js +10 -0
- package/dist/mcp.js.map +1 -0
- package/dist/middleware/auth.d.ts +118 -0
- package/dist/middleware/auth.js +7 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/middleware/error-handler.d.ts +35 -0
- package/dist/middleware/error-handler.js +7 -0
- package/dist/middleware/error-handler.js.map +1 -0
- package/dist/middleware/module-guard.d.ts +33 -0
- package/dist/middleware/module-guard.js +7 -0
- package/dist/middleware/module-guard.js.map +1 -0
- package/dist/platform-admin/index.d.ts +37 -0
- package/dist/platform-admin/index.js +11 -0
- package/dist/platform-admin/index.js.map +1 -0
- package/dist/platform-admin/store.d.ts +346 -0
- package/dist/platform-admin/store.js +7 -0
- package/dist/platform-admin/store.js.map +1 -0
- package/dist/plugin-data/annotations.d.ts +6 -0
- package/dist/plugin-data/annotations.js +12 -0
- package/dist/plugin-data/annotations.js.map +1 -0
- package/dist/plugin-data/atomic-context.d.ts +41 -0
- package/dist/plugin-data/atomic-context.js +9 -0
- package/dist/plugin-data/atomic-context.js.map +1 -0
- package/dist/plugin-data/atomic.d.ts +6 -0
- package/dist/plugin-data/atomic.js +26 -0
- package/dist/plugin-data/atomic.js.map +1 -0
- package/dist/plugin-data/audit.d.ts +6 -0
- package/dist/plugin-data/audit.js +12 -0
- package/dist/plugin-data/audit.js.map +1 -0
- package/dist/plugin-data/commands.d.ts +6 -0
- package/dist/plugin-data/commands.js +8 -0
- package/dist/plugin-data/commands.js.map +1 -0
- package/dist/plugin-data/composite.d.ts +6 -0
- package/dist/plugin-data/composite.js +8 -0
- package/dist/plugin-data/composite.js.map +1 -0
- package/dist/plugin-data/delivery.d.ts +6 -0
- package/dist/plugin-data/delivery.js +16 -0
- package/dist/plugin-data/delivery.js.map +1 -0
- package/dist/plugin-data/index.d.ts +2798 -0
- package/dist/plugin-data/index.js +102 -0
- package/dist/plugin-data/index.js.map +1 -0
- package/dist/plugin-data/json-documents.d.ts +6 -0
- package/dist/plugin-data/json-documents.js +16 -0
- package/dist/plugin-data/json-documents.js.map +1 -0
- package/dist/plugin-data/outbox.d.ts +6 -0
- package/dist/plugin-data/outbox.js +16 -0
- package/dist/plugin-data/outbox.js.map +1 -0
- package/dist/plugin-data/scoped-records.d.ts +6 -0
- package/dist/plugin-data/scoped-records.js +10 -0
- package/dist/plugin-data/scoped-records.js.map +1 -0
- package/dist/plugin-sdk.d.ts +41 -0
- package/dist/plugin-sdk.js +10 -0
- package/dist/plugin-sdk.js.map +1 -0
- package/dist/sql-lifecycle/index.d.ts +138 -0
- package/dist/sql-lifecycle/index.js +167 -0
- package/dist/sql-lifecycle/index.js.map +1 -0
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.js +13 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/s3-compatible.d.ts +139 -0
- package/dist/storage/s3-compatible.js +11 -0
- package/dist/storage/s3-compatible.js.map +1 -0
- package/dist/tenant.d.ts +108 -0
- package/dist/tenant.js +9 -0
- package/dist/tenant.js.map +1 -0
- package/dist/workspace-context.d.ts +119 -0
- package/dist/workspace-context.js +9 -0
- package/dist/workspace-context.js.map +1 -0
- package/docs/api.md +29753 -0
- package/docs/db/README.md +49 -0
- package/docs/db/docs/api.md +1613 -0
- package/docs/db/docs/guide.md +47 -0
- package/docs/entitlements.md +60 -0
- package/docs/guide.md +48 -0
- package/docs/index.md +53 -0
- package/docs/ja/db/README.md +46 -0
- package/docs/ja/db/docs/guide.md +53 -0
- package/docs/ja/guide.md +46 -0
- package/docs/ja/lifecycle/README.md +46 -0
- package/docs/ja/lifecycle/docs/guide.md +45 -0
- package/docs/ja/storage/README.md +46 -0
- package/docs/ja/storage/docs/guide.md +43 -0
- package/docs/lifecycle/README.md +49 -0
- package/docs/lifecycle/docs/api.md +3770 -0
- package/docs/lifecycle/docs/baseline.md +50 -0
- package/docs/lifecycle/docs/guide.md +47 -0
- package/docs/storage/README.md +49 -0
- package/docs/storage/docs/api.md +470 -0
- package/docs/storage/docs/guide.md +47 -0
- package/package.json +345 -4
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// src/db-package/migration/aggregator.ts
|
|
2
|
+
import { resolveDataContracts } from "@alneas/eaos-core/contracts/data-contracts";
|
|
3
|
+
var MigrationAggregator = class {
|
|
4
|
+
/**
|
|
5
|
+
* Captures plugin manifests and available data contracts for later collection.
|
|
6
|
+
* @param plugins - Manifests consulted on every collection call; the array is retained rather than cloned.
|
|
7
|
+
* @param dataContracts - Available contracts used to resolve manifest requirements; defaults to none and is retained.
|
|
8
|
+
*/
|
|
9
|
+
constructor(plugins, dataContracts = []) {
|
|
10
|
+
this.plugins = plugins;
|
|
11
|
+
this.dataContracts = dataContracts;
|
|
12
|
+
}
|
|
13
|
+
plugins;
|
|
14
|
+
dataContracts;
|
|
15
|
+
/**
|
|
16
|
+
* Collects resolved data contracts first, then plugin and extension schemas by migration order.
|
|
17
|
+
* @param resolveSchema - Called with plugin ID and optional extension ID; returns a legacy schema or null to skip it. Plugin schemas declaring data contracts skip the plugin-level callback, but extensions are still resolved.
|
|
18
|
+
* @returns Ordered schema sources; manifests with equal order retain their sort order and missing callback results are omitted.
|
|
19
|
+
* @throws Propagates contract resolution or callback errors.
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { MigrationAggregator } from "@alneas/eaos-server/db/migration/aggregator";
|
|
23
|
+
* const aggregator = new MigrationAggregator([]);
|
|
24
|
+
* console.log(aggregator.collectSchemas(() => null)); // []
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
collectSchemas(resolveSchema) {
|
|
28
|
+
const sources = [];
|
|
29
|
+
const requirements = {};
|
|
30
|
+
for (const plugin of this.plugins) {
|
|
31
|
+
resolveDataContracts(this.dataContracts, plugin.schema.dataContracts ?? {});
|
|
32
|
+
Object.assign(requirements, plugin.schema.dataContracts ?? {});
|
|
33
|
+
}
|
|
34
|
+
for (const contract of resolveDataContracts(this.dataContracts, requirements).contracts) sources.push({ pluginId: `data:${contract.id}`, pluginName: contract.description, schemaJson: contract.schema });
|
|
35
|
+
const sorted = [...this.plugins].sort(
|
|
36
|
+
(a, b) => (a.schema?.migrationOrder ?? 999) - (b.schema?.migrationOrder ?? 999)
|
|
37
|
+
);
|
|
38
|
+
for (const plugin of sorted) {
|
|
39
|
+
const schemaJson = Object.keys(plugin.schema.dataContracts ?? {}).length ? null : resolveSchema(plugin.id);
|
|
40
|
+
if (schemaJson) {
|
|
41
|
+
sources.push({
|
|
42
|
+
pluginId: plugin.id,
|
|
43
|
+
pluginName: plugin.name,
|
|
44
|
+
migrationOrder: plugin.schema?.migrationOrder ?? 999,
|
|
45
|
+
schemaJson
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (plugin.extensions) {
|
|
49
|
+
for (const ext of plugin.extensions) {
|
|
50
|
+
const extSchemaJson = resolveSchema(plugin.id, ext.id);
|
|
51
|
+
if (extSchemaJson) {
|
|
52
|
+
sources.push({
|
|
53
|
+
pluginId: plugin.id,
|
|
54
|
+
pluginName: plugin.name,
|
|
55
|
+
extensionId: ext.id,
|
|
56
|
+
migrationOrder: plugin.schema?.migrationOrder ?? 999,
|
|
57
|
+
schemaJson: extSchemaJson
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return sources;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Renders PostgreSQL table DDL and tenant_id row-level-security policies as text.
|
|
67
|
+
* @param sources - Trusted legacy schemas rendered in supplied order. Every table must declare tenant_id not explicitly nullable.
|
|
68
|
+
* @param dbDriver - Label included in SQL comments only; defaults to postgres and does not change dialect.
|
|
69
|
+
* @returns SQL text with a generated timestamp, CREATE TABLE IF NOT EXISTS, and tenant policies using app.current_tenant as UUID.
|
|
70
|
+
* @throws For canonical x-db/$defs schemas or missing/nullable tenant_id columns.
|
|
71
|
+
* @remarks The host must set app.current_tenant appropriately and review/apply SQL separately.
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* import { MigrationAggregator } from "@alneas/eaos-server/db/migration/aggregator";
|
|
75
|
+
* const aggregator = new MigrationAggregator([]);
|
|
76
|
+
* console.log(aggregator.generatePostgres([]));
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
generatePostgres(sources, dbDriver = "postgres") {
|
|
80
|
+
let sqlOutput = `-- Auto-generated Supabase / PostgreSQL DDL & RLS Policies
|
|
81
|
+
`;
|
|
82
|
+
sqlOutput += `-- Driver: ${dbDriver}
|
|
83
|
+
-- Generated at: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
84
|
+
|
|
85
|
+
`;
|
|
86
|
+
for (const source of sources) {
|
|
87
|
+
const identifier = source.extensionId ? `${source.pluginId}:${source.extensionId}` : source.pluginId;
|
|
88
|
+
sqlOutput += `-- ==========================================
|
|
89
|
+
`;
|
|
90
|
+
sqlOutput += `-- Plugin: ${source.pluginName || source.pluginId} (source: ${identifier})
|
|
91
|
+
`;
|
|
92
|
+
sqlOutput += `-- Migration Order: ${source.migrationOrder ?? 999}
|
|
93
|
+
`;
|
|
94
|
+
sqlOutput += `-- ==========================================
|
|
95
|
+
|
|
96
|
+
`;
|
|
97
|
+
sqlOutput += this.convertJsonSchemaToPostgresSql(identifier, source.schemaJson);
|
|
98
|
+
}
|
|
99
|
+
return sqlOutput;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Renders legacy Oracle table DDL as text.
|
|
103
|
+
* @param sources - Trusted legacy schemas rendered in supplied order; every table must declare tenant_id not explicitly nullable.
|
|
104
|
+
* @returns SQL text with a generated timestamp and CREATE TABLE statements; no VPD policies or default clauses are emitted by this converter.
|
|
105
|
+
* @throws For canonical x-db/$defs schemas or missing/nullable tenant_id columns.
|
|
106
|
+
* @remarks Applying SQL and enforcing Oracle tenant isolation remain host responsibilities.
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* import { MigrationAggregator } from "@alneas/eaos-server/db/migration/aggregator";
|
|
110
|
+
* const aggregator = new MigrationAggregator([]);
|
|
111
|
+
* console.log(aggregator.generateOracle([]));
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
generateOracle(sources) {
|
|
115
|
+
let sqlOutput = `-- Auto-generated Oracle ADB DDL & VPD Context Policies
|
|
116
|
+
`;
|
|
117
|
+
sqlOutput += `-- Driver: ORACLE
|
|
118
|
+
-- Generated at: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
119
|
+
|
|
120
|
+
`;
|
|
121
|
+
for (const source of sources) {
|
|
122
|
+
const identifier = source.extensionId ? `${source.pluginId}:${source.extensionId}` : source.pluginId;
|
|
123
|
+
sqlOutput += `-- ==========================================
|
|
124
|
+
`;
|
|
125
|
+
sqlOutput += `-- Plugin: ${source.pluginName || source.pluginId} (source: ${identifier})
|
|
126
|
+
`;
|
|
127
|
+
sqlOutput += `-- Migration Order: ${source.migrationOrder ?? 999}
|
|
128
|
+
`;
|
|
129
|
+
sqlOutput += `-- ==========================================
|
|
130
|
+
|
|
131
|
+
`;
|
|
132
|
+
sqlOutput += this.convertJsonSchemaToOracleSql(identifier, source.schemaJson);
|
|
133
|
+
}
|
|
134
|
+
return sqlOutput;
|
|
135
|
+
}
|
|
136
|
+
convertJsonSchemaToPostgresSql(_identifier, schemaJson) {
|
|
137
|
+
let sql = "";
|
|
138
|
+
if (schemaJson["x-db"] || schemaJson.$defs) throw new Error("Use the data contract reviewed lifecycle migrations for canonical JSON Schema");
|
|
139
|
+
const tables = schemaJson.tables || {};
|
|
140
|
+
for (const [tableName, tableDef] of Object.entries(tables)) {
|
|
141
|
+
sql += `CREATE TABLE IF NOT EXISTS ${tableName} (
|
|
142
|
+
`;
|
|
143
|
+
const columnDefs = [];
|
|
144
|
+
const columns = tableDef.columns || {};
|
|
145
|
+
assertTenantColumn(tableName, columns);
|
|
146
|
+
for (const [colName, colDef] of Object.entries(columns)) {
|
|
147
|
+
let colType = "TEXT";
|
|
148
|
+
const rawType = (colDef.type || "").toUpperCase();
|
|
149
|
+
if (rawType === "UUID") colType = "UUID";
|
|
150
|
+
else if (rawType.includes("VARCHAR")) colType = "VARCHAR(255)";
|
|
151
|
+
else if (rawType.includes("NUMBER") || rawType.includes("DECIMAL")) colType = "NUMERIC(18,2)";
|
|
152
|
+
else if (rawType.includes("TIMESTAMP") || rawType.includes("DATE")) colType = "TIMESTAMPTZ";
|
|
153
|
+
else if (rawType.includes("INT")) colType = "BIGINT";
|
|
154
|
+
let line = ` ${colName} ${colType}`;
|
|
155
|
+
if (colDef.primaryKey) line += " PRIMARY KEY";
|
|
156
|
+
if (colDef.nullable === false) line += " NOT NULL";
|
|
157
|
+
if (colDef.default) line += ` DEFAULT ${colDef.default}`;
|
|
158
|
+
columnDefs.push(line);
|
|
159
|
+
}
|
|
160
|
+
sql += columnDefs.join(",\n") + "\n);\n\n";
|
|
161
|
+
if (columns["tenant_id"]) {
|
|
162
|
+
sql += `-- Supabase Row Level Security (RLS) for ${tableName}
|
|
163
|
+
`;
|
|
164
|
+
sql += `ALTER TABLE ${tableName} ENABLE ROW LEVEL SECURITY;
|
|
165
|
+
`;
|
|
166
|
+
sql += `DROP POLICY IF EXISTS ${tableName}_tenant_isolation ON ${tableName};
|
|
167
|
+
`;
|
|
168
|
+
sql += `CREATE POLICY ${tableName}_tenant_isolation ON ${tableName} FOR ALL USING (tenant_id = NULLIF(current_setting('app.current_tenant', true), '')::uuid);
|
|
169
|
+
|
|
170
|
+
`;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return sql;
|
|
174
|
+
}
|
|
175
|
+
convertJsonSchemaToOracleSql(_identifier, schemaJson) {
|
|
176
|
+
let sql = "";
|
|
177
|
+
if (schemaJson["x-db"] || schemaJson.$defs) throw new Error("Use the data contract reviewed lifecycle migrations for canonical JSON Schema");
|
|
178
|
+
const tables = schemaJson.tables || {};
|
|
179
|
+
for (const [tableName, tableDef] of Object.entries(tables)) {
|
|
180
|
+
sql += `CREATE TABLE ${tableName} (
|
|
181
|
+
`;
|
|
182
|
+
const columnDefs = [];
|
|
183
|
+
const columns = tableDef.columns || {};
|
|
184
|
+
assertTenantColumn(tableName, columns);
|
|
185
|
+
for (const [colName, colDef] of Object.entries(columns)) {
|
|
186
|
+
let colType = "VARCHAR2(255)";
|
|
187
|
+
const rawType = (colDef.type || "").toUpperCase();
|
|
188
|
+
if (rawType === "UUID") colType = "VARCHAR2(36)";
|
|
189
|
+
else if (rawType.includes("VARCHAR")) colType = "VARCHAR2(255)";
|
|
190
|
+
else if (rawType.includes("NUMBER") || rawType.includes("DECIMAL")) colType = "NUMBER(18,2)";
|
|
191
|
+
else if (rawType.includes("TIMESTAMP") || rawType.includes("DATE")) colType = "TIMESTAMP WITH TIME ZONE";
|
|
192
|
+
else if (rawType.includes("INT")) colType = "NUMBER(19)";
|
|
193
|
+
let line = ` ${colName} ${colType}`;
|
|
194
|
+
if (colDef.primaryKey) line += " PRIMARY KEY";
|
|
195
|
+
if (colDef.nullable === false) line += " NOT NULL";
|
|
196
|
+
columnDefs.push(line);
|
|
197
|
+
}
|
|
198
|
+
sql += columnDefs.join(",\n") + "\n);\n\n";
|
|
199
|
+
}
|
|
200
|
+
return sql;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
function assertTenantColumn(tableName, columns) {
|
|
204
|
+
const tenant = columns.tenant_id;
|
|
205
|
+
if (!tenant || tenant.nullable === true) throw new Error(`Schema table ${tableName} must declare a non-null tenant_id column`);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export {
|
|
209
|
+
MigrationAggregator
|
|
210
|
+
};
|
|
211
|
+
//# sourceMappingURL=chunk-5WOZWPZA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/db-package/migration/aggregator.ts"],"sourcesContent":["import { resolveDataContracts, type DataContract } from '@alneas/eaos-core/contracts/data-contracts'\nimport type { PluginManifest } from '@alneas/eaos-core/plugin-sdk/types'\n\n/**\n * Legacy table-schema input collected for migration text generation.\n * @see MigrationAggregator for a complete usage example.\n */\nexport interface SchemaSource {\n /** Plugin ID, or data:{contractId} for resolved data contracts. */\n pluginId: string\n /** Optional display label used in generated SQL comments. */\n pluginName?: string\n /** Optional extension ID appended to the source identifier. */\n extensionId?: string\n /** Sort order from the plugin manifest; defaults to 999 for plugin schemas. */\n migrationOrder?: number\n /** Legacy tables/columns schema; canonical x-db/$defs schemas require reviewed lifecycle migrations instead. */\n schemaJson: Record<string, any>\n}\n\n/**\n * Collects plugin schema sources and renders legacy PostgreSQL or Oracle DDL text.\n * @remarks Generation never executes SQL. Schema identifiers, defaults, and comments are interpolated from trusted schema inputs; review generated SQL before applying it. Canonical data-contract JSON Schema requires reviewed lifecycle migrations rather than these legacy converters.\n * @example\n * ```typescript\n * import { MigrationAggregator } from \"@alneas/eaos-server/db/migration/aggregator\";\n * const aggregator = new MigrationAggregator([]);\n * console.log(aggregator.generatePostgres([]));\n * ```\n */\nexport class MigrationAggregator {\n /**\n * Captures plugin manifests and available data contracts for later collection.\n * @param plugins - Manifests consulted on every collection call; the array is retained rather than cloned.\n * @param dataContracts - Available contracts used to resolve manifest requirements; defaults to none and is retained.\n */\n constructor(private plugins: PluginManifest[], private dataContracts: DataContract[] = []) {}\n\n /**\n * Collects resolved data contracts first, then plugin and extension schemas by migration order.\n * @param resolveSchema - Called with plugin ID and optional extension ID; returns a legacy schema or null to skip it. Plugin schemas declaring data contracts skip the plugin-level callback, but extensions are still resolved.\n * @returns Ordered schema sources; manifests with equal order retain their sort order and missing callback results are omitted.\n * @throws Propagates contract resolution or callback errors.\n * @example\n * ```typescript\n * import { MigrationAggregator } from \"@alneas/eaos-server/db/migration/aggregator\";\n * const aggregator = new MigrationAggregator([]);\n * console.log(aggregator.collectSchemas(() => null)); // []\n * ```\n */\n collectSchemas(\n resolveSchema: (pluginId: string, extensionId?: string) => Record<string, any> | null\n ): SchemaSource[] {\n const sources: SchemaSource[] = []\n const requirements: Record<string, string> = {}\n for (const plugin of this.plugins) {\n resolveDataContracts(this.dataContracts, plugin.schema.dataContracts ?? {})\n Object.assign(requirements, plugin.schema.dataContracts ?? {})\n }\n for (const contract of resolveDataContracts(this.dataContracts, requirements).contracts) sources.push({ pluginId: `data:${contract.id}`, pluginName: contract.description, schemaJson: contract.schema })\n const sorted = [...this.plugins].sort(\n (a, b) => (a.schema?.migrationOrder ?? 999) - (b.schema?.migrationOrder ?? 999)\n )\n\n for (const plugin of sorted) {\n const schemaJson = Object.keys(plugin.schema.dataContracts ?? {}).length ? null : resolveSchema(plugin.id)\n if (schemaJson) {\n sources.push({\n pluginId: plugin.id,\n pluginName: plugin.name,\n migrationOrder: plugin.schema?.migrationOrder ?? 999,\n schemaJson,\n })\n }\n\n if (plugin.extensions) {\n for (const ext of plugin.extensions) {\n const extSchemaJson = resolveSchema(plugin.id, ext.id)\n if (extSchemaJson) {\n sources.push({\n pluginId: plugin.id,\n pluginName: plugin.name,\n extensionId: ext.id,\n migrationOrder: plugin.schema?.migrationOrder ?? 999,\n schemaJson: extSchemaJson,\n })\n }\n }\n }\n }\n return sources\n }\n\n /**\n * Renders PostgreSQL table DDL and tenant_id row-level-security policies as text.\n * @param sources - Trusted legacy schemas rendered in supplied order. Every table must declare tenant_id not explicitly nullable.\n * @param dbDriver - Label included in SQL comments only; defaults to postgres and does not change dialect.\n * @returns SQL text with a generated timestamp, CREATE TABLE IF NOT EXISTS, and tenant policies using app.current_tenant as UUID.\n * @throws For canonical x-db/$defs schemas or missing/nullable tenant_id columns.\n * @remarks The host must set app.current_tenant appropriately and review/apply SQL separately.\n * @example\n * ```typescript\n * import { MigrationAggregator } from \"@alneas/eaos-server/db/migration/aggregator\";\n * const aggregator = new MigrationAggregator([]);\n * console.log(aggregator.generatePostgres([]));\n * ```\n */\n generatePostgres(sources: SchemaSource[], dbDriver: string = 'postgres'): string {\n let sqlOutput = `-- Auto-generated Supabase / PostgreSQL DDL & RLS Policies\\n`\n sqlOutput += `-- Driver: ${dbDriver}\\n-- Generated at: ${new Date().toISOString()}\\n\\n`\n\n for (const source of sources) {\n const identifier = source.extensionId ? `${source.pluginId}:${source.extensionId}` : source.pluginId\n sqlOutput += `-- ==========================================\\n`\n sqlOutput += `-- Plugin: ${source.pluginName || source.pluginId} (source: ${identifier})\\n`\n sqlOutput += `-- Migration Order: ${source.migrationOrder ?? 999}\\n`\n sqlOutput += `-- ==========================================\\n\\n`\n\n sqlOutput += this.convertJsonSchemaToPostgresSql(identifier, source.schemaJson)\n }\n\n return sqlOutput\n }\n\n /**\n * Renders legacy Oracle table DDL as text.\n * @param sources - Trusted legacy schemas rendered in supplied order; every table must declare tenant_id not explicitly nullable.\n * @returns SQL text with a generated timestamp and CREATE TABLE statements; no VPD policies or default clauses are emitted by this converter.\n * @throws For canonical x-db/$defs schemas or missing/nullable tenant_id columns.\n * @remarks Applying SQL and enforcing Oracle tenant isolation remain host responsibilities.\n * @example\n * ```typescript\n * import { MigrationAggregator } from \"@alneas/eaos-server/db/migration/aggregator\";\n * const aggregator = new MigrationAggregator([]);\n * console.log(aggregator.generateOracle([]));\n * ```\n */\n generateOracle(sources: SchemaSource[]): string {\n let sqlOutput = `-- Auto-generated Oracle ADB DDL & VPD Context Policies\\n`\n sqlOutput += `-- Driver: ORACLE\\n-- Generated at: ${new Date().toISOString()}\\n\\n`\n\n for (const source of sources) {\n const identifier = source.extensionId ? `${source.pluginId}:${source.extensionId}` : source.pluginId\n sqlOutput += `-- ==========================================\\n`\n sqlOutput += `-- Plugin: ${source.pluginName || source.pluginId} (source: ${identifier})\\n`\n sqlOutput += `-- Migration Order: ${source.migrationOrder ?? 999}\\n`\n sqlOutput += `-- ==========================================\\n\\n`\n\n sqlOutput += this.convertJsonSchemaToOracleSql(identifier, source.schemaJson)\n }\n\n return sqlOutput\n }\n\n private convertJsonSchemaToPostgresSql(_identifier: string, schemaJson: any): string {\n let sql = ''\n if (schemaJson['x-db'] || schemaJson.$defs) throw new Error('Use the data contract reviewed lifecycle migrations for canonical JSON Schema')\n const tables = schemaJson.tables || {}\n\n for (const [tableName, tableDef] of Object.entries<any>(tables)) {\n sql += `CREATE TABLE IF NOT EXISTS ${tableName} (\\n`\n const columnDefs: string[] = []\n const columns = tableDef.columns || {}\n assertTenantColumn(tableName, columns)\n\n for (const [colName, colDef] of Object.entries<any>(columns)) {\n let colType = 'TEXT'\n const rawType = (colDef.type || '').toUpperCase()\n\n if (rawType === 'UUID') colType = 'UUID'\n else if (rawType.includes('VARCHAR')) colType = 'VARCHAR(255)'\n else if (rawType.includes('NUMBER') || rawType.includes('DECIMAL')) colType = 'NUMERIC(18,2)'\n else if (rawType.includes('TIMESTAMP') || rawType.includes('DATE')) colType = 'TIMESTAMPTZ'\n else if (rawType.includes('INT')) colType = 'BIGINT'\n\n let line = ` ${colName} ${colType}`\n if (colDef.primaryKey) line += ' PRIMARY KEY'\n if (colDef.nullable === false) line += ' NOT NULL'\n if (colDef.default) line += ` DEFAULT ${colDef.default}`\n\n columnDefs.push(line)\n }\n\n sql += columnDefs.join(',\\n') + '\\n);\\n\\n'\n\n if (columns['tenant_id']) {\n sql += `-- Supabase Row Level Security (RLS) for ${tableName}\\n`\n sql += `ALTER TABLE ${tableName} ENABLE ROW LEVEL SECURITY;\\n`\n sql += `DROP POLICY IF EXISTS ${tableName}_tenant_isolation ON ${tableName};\\n`\n sql += `CREATE POLICY ${tableName}_tenant_isolation ON ${tableName} FOR ALL USING (tenant_id = NULLIF(current_setting('app.current_tenant', true), '')::uuid);\\n\\n`\n }\n }\n\n return sql\n }\n\n private convertJsonSchemaToOracleSql(_identifier: string, schemaJson: any): string {\n let sql = ''\n if (schemaJson['x-db'] || schemaJson.$defs) throw new Error('Use the data contract reviewed lifecycle migrations for canonical JSON Schema')\n const tables = schemaJson.tables || {}\n\n for (const [tableName, tableDef] of Object.entries<any>(tables)) {\n sql += `CREATE TABLE ${tableName} (\\n`\n const columnDefs: string[] = []\n const columns = tableDef.columns || {}\n assertTenantColumn(tableName, columns)\n\n for (const [colName, colDef] of Object.entries<any>(columns)) {\n let colType = 'VARCHAR2(255)'\n const rawType = (colDef.type || '').toUpperCase()\n\n if (rawType === 'UUID') colType = 'VARCHAR2(36)'\n else if (rawType.includes('VARCHAR')) colType = 'VARCHAR2(255)'\n else if (rawType.includes('NUMBER') || rawType.includes('DECIMAL')) colType = 'NUMBER(18,2)'\n else if (rawType.includes('TIMESTAMP') || rawType.includes('DATE')) colType = 'TIMESTAMP WITH TIME ZONE'\n else if (rawType.includes('INT')) colType = 'NUMBER(19)'\n\n let line = ` ${colName} ${colType}`\n if (colDef.primaryKey) line += ' PRIMARY KEY'\n if (colDef.nullable === false) line += ' NOT NULL'\n\n columnDefs.push(line)\n }\n\n sql += columnDefs.join(',\\n') + '\\n);\\n\\n'\n }\n\n return sql\n }\n}\n\nfunction assertTenantColumn(tableName: string, columns: Record<string, any>): void {\n const tenant = columns.tenant_id\n if (!tenant || tenant.nullable === true) throw new Error(`Schema table ${tableName} must declare a non-null tenant_id column`)\n}\n"],"mappings":";AAAA,SAAS,4BAA+C;AA8BjD,IAAM,sBAAN,MAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM/B,YAAoB,SAAmC,gBAAgC,CAAC,GAAG;AAAvE;AAAmC;AAAA,EAAqC;AAAA,EAAxE;AAAA,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcvD,eACE,eACgB;AAChB,UAAM,UAA0B,CAAC;AACjC,UAAM,eAAuC,CAAC;AAC9C,eAAW,UAAU,KAAK,SAAS;AACjC,2BAAqB,KAAK,eAAe,OAAO,OAAO,iBAAiB,CAAC,CAAC;AAC1E,aAAO,OAAO,cAAc,OAAO,OAAO,iBAAiB,CAAC,CAAC;AAAA,IAC/D;AACA,eAAW,YAAY,qBAAqB,KAAK,eAAe,YAAY,EAAE,UAAW,SAAQ,KAAK,EAAE,UAAU,QAAQ,SAAS,EAAE,IAAI,YAAY,SAAS,aAAa,YAAY,SAAS,OAAO,CAAC;AACxM,UAAM,SAAS,CAAC,GAAG,KAAK,OAAO,EAAE;AAAA,MAC/B,CAAC,GAAG,OAAO,EAAE,QAAQ,kBAAkB,QAAQ,EAAE,QAAQ,kBAAkB;AAAA,IAC7E;AAEA,eAAW,UAAU,QAAQ;AAC3B,YAAM,aAAa,OAAO,KAAK,OAAO,OAAO,iBAAiB,CAAC,CAAC,EAAE,SAAS,OAAO,cAAc,OAAO,EAAE;AACzG,UAAI,YAAY;AACd,gBAAQ,KAAK;AAAA,UACX,UAAU,OAAO;AAAA,UACjB,YAAY,OAAO;AAAA,UACnB,gBAAgB,OAAO,QAAQ,kBAAkB;AAAA,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mB,WAAmB,SAAoC;AACjF,QAAM,SAAS,QAAQ;AACvB,MAAI,CAAC,UAAU,OAAO,aAAa,KAAM,OAAM,IAAI,MAAM,gBAAgB,SAAS,2CAA2C;AAC/H;","names":[]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// src/lifecycle-engine/platform/deployment.ts
|
|
2
|
+
var deploymentComponentKinds = ["frontend", "api", "mcp", "service", "function", "worker", "job", "webhook", "workflow", "database", "infrastructure", "storage", "cache", "queue", "search", "integration", "native", "model", "data-import"];
|
|
3
|
+
var deploymentActions = ["build", "test", "preview", "provision", "configure", "migrate", "deploy", "verify", "import", "enable"];
|
|
4
|
+
function object(value) {
|
|
5
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
function nonempty(value) {
|
|
8
|
+
return typeof value === "string" && !!value.trim() && value === value.trim();
|
|
9
|
+
}
|
|
10
|
+
function id(value) {
|
|
11
|
+
return nonempty(value) && /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(value);
|
|
12
|
+
}
|
|
13
|
+
function strings(value, allowEmpty = true) {
|
|
14
|
+
return Array.isArray(value) && (allowEmpty || !!value.length) && value.every(nonempty) && new Set(value).size === value.length;
|
|
15
|
+
}
|
|
16
|
+
function fields(value, allowed) {
|
|
17
|
+
if (Object.keys(value).some((key) => !allowed.includes(key))) throw new Error("Unknown deployment declaration field");
|
|
18
|
+
}
|
|
19
|
+
function mapping(value) {
|
|
20
|
+
return object(value) && Object.entries(value).every(([key, v]) => nonempty(key) && nonempty(v));
|
|
21
|
+
}
|
|
22
|
+
function targetKey(target) {
|
|
23
|
+
return JSON.stringify([target?.environment ?? null, target?.backendId ?? null, target?.databaseId ?? null, target?.tenantId ?? null]);
|
|
24
|
+
}
|
|
25
|
+
function validateDeploymentPlugins(inventory) {
|
|
26
|
+
if (inventory.plugins === void 0) return void 0;
|
|
27
|
+
if (!Array.isArray(inventory.plugins) || !inventory.plugins.length || !strings(inventory.lifecycleBundle, false) || inventory.plugins.length !== inventory.lifecycleBundle.length) throw new Error("Deployment plugins must cover the lifecycle bundle");
|
|
28
|
+
const pluginIds = /* @__PURE__ */ new Set(), assets = new Set(inventory.assets.map((asset) => asset.path));
|
|
29
|
+
for (const plugin of inventory.plugins) {
|
|
30
|
+
if (!object(plugin) || !id(plugin.id) || pluginIds.has(plugin.id) || !inventory.lifecycleBundle.includes(plugin.id) || !Array.isArray(plugin.components) || !Array.isArray(plugin.tasks)) throw new Error("Invalid or duplicate deployment plugin");
|
|
31
|
+
fields(plugin, ["id", "components", "tasks"]);
|
|
32
|
+
pluginIds.add(plugin.id);
|
|
33
|
+
const components = /* @__PURE__ */ new Set(), tasks = /* @__PURE__ */ new Map();
|
|
34
|
+
for (const component of plugin.components) {
|
|
35
|
+
if (!object(component) || !id(component.id) || components.has(component.id) || !deploymentComponentKinds.includes(component.kind) || component.required !== void 0 && typeof component.required !== "boolean" || !["host", "container", "function", "database", "cloud", "native", "external"].includes(component.placement) || component.runtime !== void 0 && !nonempty(component.runtime) || component.assets !== void 0 && (!strings(component.assets) || component.assets.some((path) => !assets.has(path))) || component.assetPatterns !== void 0 && (!strings(component.assetPatterns, false) || component.assetPatterns.some((pattern) => pattern.startsWith("/") || pattern.includes("\\") || pattern.split("/").some((part) => !part || part === "." || part === ".."))) || component.entry !== void 0 && (!nonempty(component.entry) || !assets.has(component.entry)) || component.dataContracts !== void 0 && !mapping(component.dataContracts)) throw new Error("Invalid deployment component or unverified asset reference");
|
|
36
|
+
fields(component, ["id", "kind", "required", "placement", "runtime", "assets", "assetPatterns", "entry", "dataContracts", "requirements"]);
|
|
37
|
+
if (component.requirements !== void 0) {
|
|
38
|
+
const req = component.requirements;
|
|
39
|
+
if (!object(req) || req.tools !== void 0 && !mapping(req.tools) || req.bindings !== void 0 && (!strings(req.bindings) || req.bindings.some((key) => !/^[A-Z][A-Z0-9_]*$/.test(key))) || req.adapters !== void 0 && !strings(req.adapters)) throw new Error("Invalid deployment requirements; declare references, not secret values");
|
|
40
|
+
fields(req, ["tools", "bindings", "adapters"]);
|
|
41
|
+
}
|
|
42
|
+
components.add(component.id);
|
|
43
|
+
}
|
|
44
|
+
for (const task of plugin.tasks) {
|
|
45
|
+
if (!object(task) || !id(task.id) || tasks.has(task.id) || !strings(task.componentIds, false) || task.componentIds.some((ref) => !components.has(ref)) || !deploymentActions.includes(task.action) || !["artifact", "environment", "tenant"].includes(task.scope) || typeof task.required !== "boolean" || !strings(task.dependsOn) || !nonempty(task.executor) || task.argv !== void 0 && (!Array.isArray(task.argv) || !task.argv.length || task.argv.some((arg) => typeof arg !== "string")) || task.instructions !== void 0 && !nonempty(task.instructions)) throw new Error("Invalid deployment task or component reference");
|
|
46
|
+
fields(task, ["id", "componentIds", "action", "scope", "required", "dependsOn", "executor", "argv", "instructions"]);
|
|
47
|
+
if (task.scope === "artifact" && !["build", "test", "verify"].includes(task.action)) throw new Error("Environment-changing work cannot have artifact scope");
|
|
48
|
+
tasks.set(task.id, task);
|
|
49
|
+
}
|
|
50
|
+
const visiting = /* @__PURE__ */ new Set(), visited = /* @__PURE__ */ new Set(), scopeRank = { artifact: 0, environment: 1, tenant: 2 };
|
|
51
|
+
const visit = (task) => {
|
|
52
|
+
if (visiting.has(task.id)) throw new Error("Cyclic deployment task dependency");
|
|
53
|
+
if (visited.has(task.id)) return;
|
|
54
|
+
visiting.add(task.id);
|
|
55
|
+
for (const ref of task.dependsOn) {
|
|
56
|
+
const dependency = tasks.get(ref);
|
|
57
|
+
if (!dependency) throw new Error("Unknown deployment task dependency");
|
|
58
|
+
if (scopeRank[dependency.scope] > scopeRank[task.scope]) throw new Error("Deployment dependency has a narrower target scope");
|
|
59
|
+
visit(dependency);
|
|
60
|
+
}
|
|
61
|
+
visiting.delete(task.id);
|
|
62
|
+
visited.add(task.id);
|
|
63
|
+
};
|
|
64
|
+
for (const task of tasks.values()) visit(task);
|
|
65
|
+
if (plugin.components.some((component) => !plugin.tasks.some((task) => (component.required === false || task.required) && task.componentIds.includes(component.id)))) throw new Error("Every required deployment component requires at least one required task; optional components still require declared work");
|
|
66
|
+
if (!components.size && tasks.size) throw new Error("Tasks require deployment components");
|
|
67
|
+
}
|
|
68
|
+
return inventory.plugins;
|
|
69
|
+
}
|
|
70
|
+
function validateDeploymentTarget(value) {
|
|
71
|
+
if (!object(value) || !nonempty(value.environment) || ["backendId", "databaseId", "tenantId"].some((key) => value[key] !== void 0 && !nonempty(value[key]))) throw new Error("Invalid deployment target");
|
|
72
|
+
fields(value, ["environment", "backendId", "databaseId", "tenantId"]);
|
|
73
|
+
}
|
|
74
|
+
function validateDeploymentReceipt(value) {
|
|
75
|
+
if (!object(value) || value.apiVersion !== 1 || !nonempty(value.owner) || typeof value.inventorySha256 !== "string" || !/^[a-f0-9]{64}$/.test(value.inventorySha256) || !Array.isArray(value.results)) throw new Error("Invalid deployment receipt");
|
|
76
|
+
fields(value, ["apiVersion", "owner", "inventorySha256", "results"]);
|
|
77
|
+
const times = /* @__PURE__ */ new Map();
|
|
78
|
+
for (const result of value.results) {
|
|
79
|
+
if (!object(result) || !id(result.pluginId) || !id(result.taskId) || !["running", "succeeded", "failed"].includes(result.status) || !nonempty(result.actor) || !strings(result.evidence, false) || !nonempty(result.recordedAt) || !/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(result.recordedAt) || !Number.isFinite(Date.parse(result.recordedAt)) || new Date(result.recordedAt).toISOString() !== result.recordedAt) throw new Error("Invalid deployment result; actor, timestamp and evidence are required");
|
|
80
|
+
fields(result, ["pluginId", "taskId", "target", "status", "recordedAt", "actor", "evidence", "destinationId", "placementSha256"]);
|
|
81
|
+
if (result.destinationId === void 0 !== (result.placementSha256 === void 0) || result.destinationId !== void 0 && (!id(result.destinationId) || !/^[a-f0-9]{64}$/.test(result.placementSha256))) throw Error("Placement evidence requires destinationId and placementSha256");
|
|
82
|
+
if (result.target !== void 0) validateDeploymentTarget(result.target);
|
|
83
|
+
const key = JSON.stringify([result.pluginId, result.taskId, targetKey(result.target), result.destinationId ?? null, result.placementSha256 ?? null]);
|
|
84
|
+
const time = Date.parse(result.recordedAt);
|
|
85
|
+
if (time <= (times.get(key) ?? -Infinity)) throw new Error("Deployment result timestamps must increase for each task/target");
|
|
86
|
+
times.set(key, time);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function taskTarget(task, target) {
|
|
90
|
+
if (task.scope === "artifact") return void 0;
|
|
91
|
+
if (!target || task.scope === "tenant" && !target.tenantId) return void 0;
|
|
92
|
+
const { tenantId: _tenantId, ...environment } = target;
|
|
93
|
+
return task.scope === "tenant" ? target : environment;
|
|
94
|
+
}
|
|
95
|
+
function summarizeDeployment(inventory, inventorySha256, receipts = [], target) {
|
|
96
|
+
if (!/^[a-f0-9]{64}$/.test(inventorySha256)) throw new Error("Invalid inventory SHA-256");
|
|
97
|
+
const plugins = validateDeploymentPlugins(inventory);
|
|
98
|
+
if (target !== void 0) validateDeploymentTarget(target);
|
|
99
|
+
const results = /* @__PURE__ */ new Map(), ignoredReceipts = [];
|
|
100
|
+
for (const receipt of receipts) {
|
|
101
|
+
validateDeploymentReceipt(receipt);
|
|
102
|
+
if (receipt.owner !== inventory.owner || receipt.inventorySha256 !== inventorySha256) {
|
|
103
|
+
ignoredReceipts.push({ owner: receipt.owner, reason: receipt.owner !== inventory.owner ? "different-owner" : "stale-inventory" });
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
for (const result of receipt.results) {
|
|
107
|
+
const task = plugins?.find((plugin2) => plugin2.id === result.pluginId)?.tasks.find((task2) => task2.id === result.taskId);
|
|
108
|
+
if (!task) throw new Error("Receipt references an undeclared deployment task");
|
|
109
|
+
if (result.destinationId !== void 0) {
|
|
110
|
+
if (task.scope === "artifact") throw Error("Artifact evidence must not be bound to a destination");
|
|
111
|
+
ignoredReceipts.push({ owner: receipt.owner, reason: "placement-context-required" });
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (task.scope === "artifact" && result.target !== void 0 || task.scope !== "artifact" && !result.target || task.scope === "environment" && result.target?.tenantId !== void 0 || task.scope === "tenant" && !result.target?.tenantId) throw new Error("Receipt target does not match task scope");
|
|
115
|
+
const plugin = plugins.find((plugin2) => plugin2.id === result.pluginId);
|
|
116
|
+
if (task.scope !== "artifact" && plugin.components.some((component) => component.kind === "database" && task.componentIds.includes(component.id)) && (!result.target?.backendId || !result.target.databaseId)) throw new Error("Database work requires explicit backendId and databaseId evidence");
|
|
117
|
+
const expected = taskTarget(task, target);
|
|
118
|
+
if (task.scope !== "artifact" && !expected || targetKey(result.target) !== targetKey(expected)) continue;
|
|
119
|
+
const key = JSON.stringify([result.pluginId, result.taskId]), old = results.get(key);
|
|
120
|
+
if (old && old.recordedAt === result.recordedAt && JSON.stringify(old) !== JSON.stringify(result)) throw new Error("Conflicting deployment results at the same timestamp");
|
|
121
|
+
if (!old || old.recordedAt < result.recordedAt) results.set(key, result);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const summaries = (plugins ?? []).map((plugin) => {
|
|
125
|
+
const artifactResolved = !plugin.components.some((component) => component.assetPatterns?.length);
|
|
126
|
+
const states = /* @__PURE__ */ new Map();
|
|
127
|
+
const status = (task) => {
|
|
128
|
+
const known = states.get(task.id);
|
|
129
|
+
if (known) return known;
|
|
130
|
+
const result = results.get(JSON.stringify([plugin.id, task.id]));
|
|
131
|
+
const dependencies = task.dependsOn.map((ref) => status(plugin.tasks.find((task2) => task2.id === ref)));
|
|
132
|
+
const blocked = dependencies.some((dependency) => dependency.status !== "succeeded");
|
|
133
|
+
const stale = result?.status === "succeeded" && dependencies.some((dependency) => dependency.result && dependency.result.recordedAt > result.recordedAt);
|
|
134
|
+
const state = { status: blocked ? "blocked" : stale ? "stale" : result?.status ?? "pending", result };
|
|
135
|
+
states.set(task.id, state);
|
|
136
|
+
return state;
|
|
137
|
+
};
|
|
138
|
+
const tasks = plugin.tasks.map((task) => ({ ...task, ...status(task) }));
|
|
139
|
+
return {
|
|
140
|
+
id: plugin.id,
|
|
141
|
+
artifactResolved,
|
|
142
|
+
complete: artifactResolved && tasks.filter((task) => task.required).every((task) => task.status === "succeeded"),
|
|
143
|
+
components: plugin.components.map((component) => ({ ...component, complete: artifactResolved && tasks.filter((task) => (component.required === false || task.required) && task.componentIds.includes(component.id)).every((task) => task.status === "succeeded") })),
|
|
144
|
+
tasks
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
return {
|
|
148
|
+
owner: inventory.owner,
|
|
149
|
+
inventorySha256,
|
|
150
|
+
target,
|
|
151
|
+
coverage: plugins ? "declared" : "legacy-unclassified",
|
|
152
|
+
artifactResolved: !!plugins && summaries.every((plugin) => plugin.artifactResolved),
|
|
153
|
+
complete: !!plugins && summaries.every((plugin) => plugin.complete),
|
|
154
|
+
plugins: summaries,
|
|
155
|
+
ignoredReceipts,
|
|
156
|
+
evidencePolicy: "Operator/host-reported evidence; not independent verification or runtime authorization"
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export {
|
|
161
|
+
deploymentComponentKinds,
|
|
162
|
+
deploymentActions,
|
|
163
|
+
validateDeploymentPlugins,
|
|
164
|
+
validateDeploymentTarget,
|
|
165
|
+
validateDeploymentReceipt,
|
|
166
|
+
summarizeDeployment
|
|
167
|
+
};
|
|
168
|
+
//# sourceMappingURL=chunk-6CBVZ6CT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lifecycle-engine/platform/deployment.ts"],"sourcesContent":["import type { DeploymentInventory } from './artifacts'\n\n/**\n * Supported deployment capability categories used to validate component declarations.\n * \n * @see summarizeDeployment for canonical integration usage.\n */\nexport const deploymentComponentKinds = ['frontend', 'api', 'mcp', 'service', 'function', 'worker', 'job', 'webhook', 'workflow', 'database', 'infrastructure', 'storage', 'cache', 'queue', 'search', 'integration', 'native', 'model', 'data-import'] as const\n/**\n * Supported declarative work phases; inspection never executes these actions.\n * \n * @see summarizeDeployment for canonical integration usage.\n */\nexport const deploymentActions = ['build', 'test', 'preview', 'provision', 'configure', 'migrate', 'deploy', 'verify', 'import', 'enable'] as const\n/**\n * One declared deployable capability with explicit placement and nonsecret host requirements.\n * \n * @see summarizeDeployment for canonical integration usage.\n */\nexport interface DeploymentComponent {\n /**\n * Unique component ID within the plugin.\n */\n id: string\n /**\n * False marks an optional capability; omitted means required.\n * \n * Optional provider/native capabilities remain visible without requiring every deployment to adopt them.\n */\n required?: boolean\n /**\n * Supported frontend/server/storage/compute capability category.\n */\n kind: typeof deploymentComponentKinds[number]\n /**\n * Declared host/container/function/database/cloud/native/external placement.\n */\n placement: 'host' | 'container' | 'function' | 'database' | 'cloud' | 'native' | 'external'\n /**\n * Optional runtime descriptor.\n */\n runtime?: string\n /**\n * Exact checksummed inventory asset references.\n * \n * References to files in the checksummed inventory, not arbitrary source paths.\n */\n assets?: string[]\n /**\n * Author-side asset selectors resolved by packing; unresolved patterns prevent completion.\n * \n * Author-side selectors resolved to exact assets by the packer; emitted inventories omit these.\n */\n assetPatterns?: string[]\n /**\n * Optional entry asset path.\n */\n entry?: string\n /**\n * Canonical schema contract IDs and semver ranges, never copied DDL.\n * \n * Canonical contract IDs/ranges; no copied DDL.\n */\n dataContracts?: Record<string, string>\n /**\n * Optional required tool ranges and host binding/adapter names.\n */\n requirements?: { \n /**\n * Tool-name to required-version/range map declared by the plugin.\n */\n tools?: Record<string, string>; \n /**\n * Required nonsecret host binding names; never credential values.\n */\n bindings?: string[]; \n /**\n * Required host adapter capability names.\n */\n adapters?: string[] }\n}\n/**\n * Declarative host-approved work and dependency ordering for deployment evidence.\n * \n * @see summarizeDeployment for canonical integration usage.\n */\nexport interface DeploymentTask {\n /**\n * Unique task ID within the plugin.\n */\n id: string\n /**\n * Existing components whose work this task covers.\n */\n componentIds: string[]\n /**\n * Supported build/test/provision/deploy/etc. phase.\n */\n action: typeof deploymentActions[number]\n /**\n * Artifact work is reusable; environment and tenant work require corresponding target evidence.\n */\n scope: 'artifact' | 'environment' | 'tenant'\n /**\n * Whether successful task evidence is required for completion.\n */\n required: boolean\n /**\n * Existing task IDs that must succeed before this task is considered unblocked.\n */\n dependsOn: string[]\n /**\n * Host-approved executor reference; inspection never launches it.\n * \n * Host-approved executor reference. Inspection never executes it or argv.\n */\n executor: string\n /**\n * Optional declarative arguments; never automatically executed by inspection.\n */\n argv?: string[]\n /**\n * Optional human operator instructions.\n */\n instructions?: string\n}\n/**\n * Classified deployment component/task graph for one lifecycle feature.\n * \n * @see summarizeDeployment for canonical integration usage.\n */\nexport interface DeploymentPlugin {\n /**\n * Plugin ID covered by the inventory lifecycle bundle.\n */\n id: string;\n /**\n * Unique deployable capability definitions.\n */\n components: DeploymentComponent[];\n /**\n * Unique work definitions forming an acyclic dependency graph.\n */\n tasks: DeploymentTask[] }\n/**\n * Nonsecret exact environment, physical placement and optional tenant context for scoped evidence.\n * \n * @see summarizeDeployment for canonical integration usage.\n */\nexport interface DeploymentTarget {\n /**\n * Nonblank deployment environment label.\n */\n environment: string;\n /**\n * Optional exact lifecycle backend ID; required for database work evidence.\n */\n backendId?: string;\n /**\n * Optional physical database identity; required with backendId for database evidence.\n */\n databaseId?: string;\n /**\n * Optional concrete tenant; required for tenant tasks and absent for environment tasks.\n */\n tenantId?: string }\n/**\n * Reported execution evidence bound to a task, inventory and optional destination revision.\n * \n * @see summarizeDeployment for canonical integration usage.\n */\nexport interface DeploymentResult {\n /**\n * Declared inventory plugin ID.\n */\n pluginId: string\n /**\n * Declared plugin task ID.\n */\n taskId: string\n /**\n * Exact environment/tenant target; absent for artifact work.\n */\n target?: DeploymentTarget\n /**\n * Reported running/succeeded/failed result; no independent execution proof is implied.\n */\n status: 'running' | 'succeeded' | 'failed'\n /**\n * Exact UTC ISO timestamp including millisecond precision; increases per task/target/placement.\n */\n recordedAt: string\n /**\n * Nonblank host/operator identity reporting the result.\n */\n actor: string\n /**\n * Nonempty distinct nonsecret evidence references, such as reviewed logs or CI receipts.\n * \n * Non-secret evidence references, such as a reviewed log, CI run or lifecycle plan receipt.\n */\n evidence: string[]\n /**\n * Optional explicit destination identity paired with placementSha256; forbidden for artifact results.\n * \n * Environment/tenant evidence bound to a reviewed component placement. Artifact results remain reusable.\n */\n destinationId?: string\n /**\n * Hash of reviewed placement/binding revisions paired with destinationId.\n */\n placementSha256?: string\n}\n/**\n * Operator/host-owned reported evidence journal pinned to one inventory digest.\n * \n * \n * Host/operator-owned journal. This is reported evidence, never runtime admission authority.\n * @see summarizeDeployment for canonical integration usage.\n */\nexport interface DeploymentReceipt {\n /**\n * Receipt discriminator; currently 1.\n */\n apiVersion: 1\n /**\n * Exact inventory owner to which these results belong.\n */\n owner: string\n /**\n * Lowercase 64-character SHA-256 of the trusted inventory bytes.\n */\n inventorySha256: string\n /**\n * Reported task outcomes in increasing per-task/target/placement timestamp order.\n */\n results: DeploymentResult[]\n}\n/**\n * Derived task readiness: pending, dependency-blocked, stale evidence, running, succeeded or failed.\n * \n * @see summarizeDeployment for canonical integration usage.\n */\nexport type DeploymentTaskStatus = 'pending' | 'blocked' | 'stale' | 'running' | 'succeeded' | 'failed'\n\nfunction object(value: unknown): value is Record<string, any> { return !!value && typeof value === 'object' && !Array.isArray(value) }\nfunction nonempty(value: unknown): value is string { return typeof value === 'string' && !!value.trim() && value === value.trim() }\nfunction id(value: unknown): value is string { return nonempty(value) && /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(value) }\nfunction strings(value: unknown, allowEmpty = true): value is string[] { return Array.isArray(value) && (allowEmpty || !!value.length) && value.every(nonempty) && new Set(value).size === value.length }\nfunction fields(value: object, allowed: string[]) { if (Object.keys(value).some(key => !allowed.includes(key))) throw new Error('Unknown deployment declaration field') }\nfunction mapping(value: unknown) { return object(value) && Object.entries(value).every(([key, v]) => nonempty(key) && nonempty(v)) }\nfunction targetKey(target?: DeploymentTarget) { return JSON.stringify([target?.environment ?? null, target?.backendId ?? null, target?.databaseId ?? null, target?.tenantId ?? null]) }\n\n/**\n * Validates declared plugin component references and task dependencies before artifact inspection.\n * \n * Validate references and the dependency DAG before artifact registration or status inspection.\n * @param inventory - Deployment inventory with checksummed asset metadata and optional per-plugin work declarations.\n * @returns The original plugin array, or undefined for legacy inventories without plugin declarations.\n * @throws Error for invalid/duplicate declarations, unsupported component/action/scope, unknown references, cycles or missing required work.\n * \n * @remarks\n * Requires explicit lifecycle-bundle coverage, known assets/components, acyclic dependencies and work for adopted components. This validates declarations without executing tasks or proving artifact file checksums.\n * \n * @example\n * ```typescript\n * import { validateDeploymentPlugins, type DeploymentInventory } from '@alneas/eaos-server/platform';\n * export function inspectDeclaration(inventory: DeploymentInventory) { return validateDeploymentPlugins(inventory); }\n * ```\n */\nexport function validateDeploymentPlugins(inventory: DeploymentInventory): DeploymentPlugin[] | undefined {\n if (inventory.plugins === undefined) return undefined\n if (!Array.isArray(inventory.plugins) || !inventory.plugins.length || !strings(inventory.lifecycleBundle, false)\n || inventory.plugins.length !== inventory.lifecycleBundle.length) throw new Error('Deployment plugins must cover the lifecycle bundle')\n const pluginIds = new Set<string>(), assets = new Set(inventory.assets.map(asset => asset.path))\n for (const plugin of inventory.plugins) {\n if (!object(plugin) || !id(plugin.id) || pluginIds.has(plugin.id) || !inventory.lifecycleBundle.includes(plugin.id)\n || !Array.isArray(plugin.components) || !Array.isArray(plugin.tasks)) throw new Error('Invalid or duplicate deployment plugin')\n fields(plugin, ['id', 'components', 'tasks'])\n pluginIds.add(plugin.id)\n const components = new Set<string>(), tasks = new Map<string, DeploymentTask>()\n for (const component of plugin.components) {\n if (!object(component) || !id(component.id) || components.has(component.id) || !deploymentComponentKinds.includes(component.kind)\n || (component.required !== undefined && typeof component.required !== 'boolean')\n || !['host', 'container', 'function', 'database', 'cloud', 'native', 'external'].includes(component.placement)\n || (component.runtime !== undefined && !nonempty(component.runtime))\n || (component.assets !== undefined && (!strings(component.assets) || component.assets.some(path => !assets.has(path))))\n || (component.assetPatterns !== undefined && (!strings(component.assetPatterns, false) || component.assetPatterns.some(pattern => pattern.startsWith('/') || pattern.includes('\\\\') || pattern.split('/').some(part => !part || part === '.' || part === '..'))))\n || (component.entry !== undefined && (!nonempty(component.entry) || !assets.has(component.entry)))\n || (component.dataContracts !== undefined && !mapping(component.dataContracts))) throw new Error('Invalid deployment component or unverified asset reference')\n fields(component, ['id', 'kind', 'required', 'placement', 'runtime', 'assets', 'assetPatterns', 'entry', 'dataContracts', 'requirements'])\n if (component.requirements !== undefined) {\n const req = component.requirements\n if (!object(req) || (req.tools !== undefined && !mapping(req.tools)) || (req.bindings !== undefined && (!strings(req.bindings) || req.bindings.some(key => !/^[A-Z][A-Z0-9_]*$/.test(key))))\n || (req.adapters !== undefined && !strings(req.adapters))) throw new Error('Invalid deployment requirements; declare references, not secret values')\n fields(req, ['tools', 'bindings', 'adapters'])\n }\n components.add(component.id)\n }\n for (const task of plugin.tasks) {\n if (!object(task) || !id(task.id) || tasks.has(task.id) || !strings(task.componentIds, false) || task.componentIds.some(ref => !components.has(ref))\n || !deploymentActions.includes(task.action) || !['artifact', 'environment', 'tenant'].includes(task.scope) || typeof task.required !== 'boolean'\n || !strings(task.dependsOn) || !nonempty(task.executor) || (task.argv !== undefined && (!Array.isArray(task.argv) || !task.argv.length || task.argv.some(arg => typeof arg !== 'string')))\n || (task.instructions !== undefined && !nonempty(task.instructions))) throw new Error('Invalid deployment task or component reference')\n fields(task, ['id', 'componentIds', 'action', 'scope', 'required', 'dependsOn', 'executor', 'argv', 'instructions'])\n if (task.scope === 'artifact' && !['build', 'test', 'verify'].includes(task.action)) throw new Error('Environment-changing work cannot have artifact scope')\n tasks.set(task.id, task)\n }\n const visiting = new Set<string>(), visited = new Set<string>(), scopeRank = { artifact: 0, environment: 1, tenant: 2 }\n const visit = (task: DeploymentTask) => {\n if (visiting.has(task.id)) throw new Error('Cyclic deployment task dependency')\n if (visited.has(task.id)) return\n visiting.add(task.id)\n for (const ref of task.dependsOn) {\n const dependency = tasks.get(ref)\n if (!dependency) throw new Error('Unknown deployment task dependency')\n if (scopeRank[dependency.scope] > scopeRank[task.scope]) throw new Error('Deployment dependency has a narrower target scope')\n visit(dependency)\n }\n visiting.delete(task.id); visited.add(task.id)\n }\n for (const task of tasks.values()) visit(task)\n if (plugin.components.some(component => !plugin.tasks.some(task => (component.required === false || task.required) && task.componentIds.includes(component.id)))) throw new Error('Every required deployment component requires at least one required task; optional components still require declared work')\n if (!components.size && tasks.size) throw new Error('Tasks require deployment components')\n }\n return inventory.plugins\n}\n\n/**\n * Validates the exact nonsecret environment/backend/database/tenant target shape.\n * @param value - Untrusted target object with a nonblank environment and optional nonblank identity references.\n * @returns Completes without a value and narrows the input to DeploymentTarget.\n * @throws Error for missing/blank identity fields or unknown target properties.\n * \n * @remarks\n * Does not resolve backend existence, tenant membership or deployment authority.\n * \n * @example\n * ```typescript\n * import { validateDeploymentTarget } from '@alneas/eaos-server/platform/deployment';\n * const target: unknown = { environment: 'review' };\n * validateDeploymentTarget(target);\n * ```\n */\nexport function validateDeploymentTarget(value: unknown): asserts value is DeploymentTarget {\n if (!object(value) || !nonempty(value.environment) || ['backendId', 'databaseId', 'tenantId'].some(key => value[key] !== undefined && !nonempty(value[key]))) throw new Error('Invalid deployment target')\n fields(value, ['environment', 'backendId', 'databaseId', 'tenantId'])\n}\n/**\n * Validates version-1 reported task evidence and strictly increasing timestamps per task/target/placement.\n * @param value - Untrusted receipt with owner, pinned inventory SHA-256 and task result records.\n * @returns Completes without a value and narrows the input to DeploymentReceipt.\n * @throws Error for malformed/extra fields, invalid hashes/timestamps, missing evidence or nonincreasing repeated-result timestamps.\n * \n * @remarks\n * Each result needs a UTC millisecond ISO timestamp, actor and nonempty distinct evidence references. destinationId and placementSha256 must occur together. This validates shape/order only; it does not independently verify evidence or grant runtime admission.\n * \n * @example\n * ```typescript\n * import { validateDeploymentReceipt } from '@alneas/eaos-server/platform/deployment';\n * const receipt: unknown = { apiVersion: 1, owner: 'reports', inventorySha256: 'a'.repeat(64), results: [] };\n * validateDeploymentReceipt(receipt);\n * ```\n */\nexport function validateDeploymentReceipt(value: unknown): asserts value is DeploymentReceipt {\n if (!object(value) || value.apiVersion !== 1 || !nonempty(value.owner) || typeof value.inventorySha256 !== 'string' || !/^[a-f0-9]{64}$/.test(value.inventorySha256) || !Array.isArray(value.results)) throw new Error('Invalid deployment receipt')\n fields(value, ['apiVersion', 'owner', 'inventorySha256', 'results'])\n const times = new Map<string, number>()\n for (const result of value.results) {\n if (!object(result) || !id(result.pluginId) || !id(result.taskId) || !['running', 'succeeded', 'failed'].includes(result.status)\n || !nonempty(result.actor) || !strings(result.evidence, false) || !nonempty(result.recordedAt)\n || !/^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d{3}Z$/.test(result.recordedAt) || !Number.isFinite(Date.parse(result.recordedAt))\n || new Date(result.recordedAt).toISOString() !== result.recordedAt) throw new Error('Invalid deployment result; actor, timestamp and evidence are required')\n fields(result, ['pluginId', 'taskId', 'target', 'status', 'recordedAt', 'actor', 'evidence', 'destinationId', 'placementSha256'])\n if ((result.destinationId === undefined) !== (result.placementSha256 === undefined) || (result.destinationId !== undefined && (!id(result.destinationId) || !/^[a-f0-9]{64}$/.test(result.placementSha256!)))) throw Error('Placement evidence requires destinationId and placementSha256')\n if (result.target !== undefined) validateDeploymentTarget(result.target)\n const key = JSON.stringify([result.pluginId, result.taskId, targetKey(result.target), result.destinationId ?? null, result.placementSha256 ?? null])\n const time = Date.parse(result.recordedAt)\n if (time <= (times.get(key) ?? -Infinity)) throw new Error('Deployment result timestamps must increase for each task/target')\n times.set(key, time)\n }\n}\nfunction taskTarget(task: DeploymentTask, target?: DeploymentTarget): DeploymentTarget | undefined {\n if (task.scope === 'artifact') return undefined\n if (!target || (task.scope === 'tenant' && !target.tenantId)) return undefined\n const { tenantId: _tenantId, ...environment } = target\n return task.scope === 'tenant' ? target : environment\n}\n\n/**\n * Aggregates host/operator task evidence into dependency-aware plugin and component completion states.\n * \n * Aggregate operator/host evidence only. A build receipt cannot complete DB/infra/deployment tasks.\n * @param inventory - Validated artifact declaration; missing plugins remains legacy-unclassified.\n * @param inventorySha256 - Trusted lowercase 64-character inventory digest.\n * @param receipts - Reported receipts; defaults to none.\n * @param target - Optional current environment/backend/database/tenant context for scoped work.\n * @returns A read-only summary with coverage, artifact resolution, task states and ignored owner/stale-inventory/placement receipts.\n * @throws Error for invalid declarations/receipts/hash/target, undeclared tasks, scope mismatch or conflicting equal-time evidence.\n * \n * @remarks\n * No task executes. Artifact work is reusable; environment/tenant evidence must match scope and database work needs explicit backend/database identities. Newer dependency evidence makes older success stale. Completion is host-reported evidence, never admission authority.\n * \n * @example\n * ```typescript\n * import { summarizeDeployment, type DeploymentInventory, type DeploymentReceipt, type DeploymentTarget } from '@alneas/eaos-server/platform';\n * export function inspect(inventory: DeploymentInventory, digest: string, receipts: DeploymentReceipt[], target?: DeploymentTarget) { return summarizeDeployment(inventory, digest, receipts, target); }\n * ```\n */\nexport function summarizeDeployment(inventory: DeploymentInventory, inventorySha256: string, receipts: DeploymentReceipt[] = [], target?: DeploymentTarget) {\n if (!/^[a-f0-9]{64}$/.test(inventorySha256)) throw new Error('Invalid inventory SHA-256')\n const plugins = validateDeploymentPlugins(inventory)\n if (target !== undefined) validateDeploymentTarget(target)\n const results = new Map<string, DeploymentResult>(), ignoredReceipts: Array<{ owner: string; reason: string }> = []\n for (const receipt of receipts) {\n validateDeploymentReceipt(receipt)\n if (receipt.owner !== inventory.owner || receipt.inventorySha256 !== inventorySha256) {\n ignoredReceipts.push({ owner: receipt.owner, reason: receipt.owner !== inventory.owner ? 'different-owner' : 'stale-inventory' }); continue\n }\n for (const result of receipt.results) {\n const task = plugins?.find(plugin => plugin.id === result.pluginId)?.tasks.find(task => task.id === result.taskId)\n if (!task) throw new Error('Receipt references an undeclared deployment task')\n if (result.destinationId !== undefined) {\n if (task.scope === 'artifact') throw Error('Artifact evidence must not be bound to a destination')\n ignoredReceipts.push({ owner: receipt.owner, reason: 'placement-context-required' }); continue\n }\n if ((task.scope === 'artifact' && result.target !== undefined) || (task.scope !== 'artifact' && !result.target)\n || (task.scope === 'environment' && result.target?.tenantId !== undefined) || (task.scope === 'tenant' && !result.target?.tenantId)) throw new Error('Receipt target does not match task scope')\n const plugin = plugins!.find(plugin => plugin.id === result.pluginId)!\n if (task.scope !== 'artifact' && plugin.components.some(component => component.kind === 'database' && task.componentIds.includes(component.id))\n && (!result.target?.backendId || !result.target.databaseId)) throw new Error('Database work requires explicit backendId and databaseId evidence')\n const expected = taskTarget(task, target)\n if ((task.scope !== 'artifact' && !expected) || targetKey(result.target) !== targetKey(expected)) continue\n const key = JSON.stringify([result.pluginId, result.taskId]), old = results.get(key)\n if (old && old.recordedAt === result.recordedAt && JSON.stringify(old) !== JSON.stringify(result)) throw new Error('Conflicting deployment results at the same timestamp')\n if (!old || old.recordedAt < result.recordedAt) results.set(key, result)\n }\n }\n const summaries = (plugins ?? []).map(plugin => {\n const artifactResolved = !plugin.components.some(component => component.assetPatterns?.length)\n const states = new Map<string, { status: DeploymentTaskStatus; result?: DeploymentResult }>()\n const status = (task: DeploymentTask): { status: DeploymentTaskStatus; result?: DeploymentResult } => {\n const known = states.get(task.id)\n if (known) return known\n const result = results.get(JSON.stringify([plugin.id, task.id]))\n const dependencies = task.dependsOn.map(ref => status(plugin.tasks.find(task => task.id === ref)!))\n const blocked = dependencies.some(dependency => dependency.status !== 'succeeded')\n const stale = result?.status === 'succeeded' && dependencies.some(dependency => dependency.result && dependency.result.recordedAt > result.recordedAt)\n const state = { status: (blocked ? 'blocked' : stale ? 'stale' : result?.status ?? 'pending') as DeploymentTaskStatus, result }\n states.set(task.id, state); return state\n }\n const tasks = plugin.tasks.map(task => ({ ...task, ...status(task) }))\n return { id: plugin.id, artifactResolved, complete: artifactResolved && tasks.filter(task => task.required).every(task => task.status === 'succeeded'),\n components: plugin.components.map(component => ({ ...component, complete: artifactResolved && tasks.filter(task => (component.required === false || task.required) && task.componentIds.includes(component.id)).every(task => task.status === 'succeeded') })), tasks }\n })\n return { owner: inventory.owner, inventorySha256, target, coverage: plugins ? 'declared' as const : 'legacy-unclassified' as const,\n artifactResolved: !!plugins && summaries.every(plugin => plugin.artifactResolved), complete: !!plugins && summaries.every(plugin => plugin.complete), plugins: summaries, ignoredReceipts,\n evidencePolicy: 'Operator/host-reported evidence; not independent verification or runtime authorization' }\n}\n"],"mappings":";AAOO,IAAM,2BAA2B,CAAC,YAAY,OAAO,OAAO,WAAW,YAAY,UAAU,OAAO,WAAW,YAAY,YAAY,kBAAkB,WAAW,SAAS,SAAS,UAAU,eAAe,UAAU,SAAS,aAAa;AAM/O,IAAM,oBAAoB,CAAC,SAAS,QAAQ,WAAW,aAAa,aAAa,WAAW,UAAU,UAAU,UAAU,QAAQ;AAwOzI,SAAS,OAAO,OAA8C;AAAE,SAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAAE;AACrI,SAAS,SAAS,OAAiC;AAAE,SAAO,OAAO,UAAU,YAAY,CAAC,CAAC,MAAM,KAAK,KAAK,UAAU,MAAM,KAAK;AAAE;AAClI,SAAS,GAAG,OAAiC;AAAE,SAAO,SAAS,KAAK,KAAK,+BAA+B,KAAK,KAAK;AAAE;AACpH,SAAS,QAAQ,OAAgB,aAAa,MAAyB;AAAE,SAAO,MAAM,QAAQ,KAAK,MAAM,cAAc,CAAC,CAAC,MAAM,WAAW,MAAM,MAAM,QAAQ,KAAK,IAAI,IAAI,KAAK,EAAE,SAAS,MAAM;AAAO;AACxM,SAAS,OAAO,OAAe,SAAmB;AAAE,MAAI,OAAO,KAAK,KAAK,EAAE,KAAK,SAAO,CAAC,QAAQ,SAAS,GAAG,CAAC,EAAG,OAAM,IAAI,MAAM,sCAAsC;AAAE;AACxK,SAAS,QAAQ,OAAgB;AAAE,SAAO,OAAO,KAAK,KAAK,OAAO,QAAQ,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,SAAS,GAAG,KAAK,SAAS,CAAC,CAAC;A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