@codemation/host 1.0.1 → 1.0.2
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 +24 -0
- package/dist/{AppConfigFactory-BPp02HMv.js → AppConfigFactory-C4OXGOs2.js} +16 -7
- package/dist/{AppConfigFactory-BPp02HMv.js.map → AppConfigFactory-C4OXGOs2.js.map} +1 -1
- package/dist/{AppConfigFactory-PFmDg5Sg.d.ts → AppConfigFactory-D3k-R3Ch.d.ts} +338 -6
- package/dist/{AppContainerFactory-Cr3JeVmg.js → AppContainerFactory-CKRDz8kQ.js} +409 -92
- package/dist/AppContainerFactory-CKRDz8kQ.js.map +1 -0
- package/dist/{CodemationAppContext-DP_-56c6.d.ts → CodemationAppContext-YgJRUHWF.d.ts} +2 -2
- package/dist/{CodemationAuthoring.types-Cr2QZsUX.d.ts → CodemationAuthoring.types-lUdxXYq-.d.ts} +3 -3
- package/dist/{CodemationConfigNormalizer-B8RGUwAe.d.ts → CodemationConfigNormalizer-BWBp7mFB.d.ts} +2 -2
- package/dist/{CodemationConsumerConfigLoader-C_QVwcI3.d.ts → CodemationConsumerConfigLoader-Bka3v6lh.d.ts} +2 -2
- package/dist/{CodemationPluginListMerger-Bgn1CIX9.d.ts → CodemationPluginListMerger-Oz-GAkxz.d.ts} +17 -5
- package/dist/{CredentialServices-95DPogx-.d.ts → CredentialServices-CKXPg5xu.d.ts} +3 -3
- package/dist/{PublicFrontendBootstrapFactory-C_iLgPV-.d.ts → PublicFrontendBootstrapFactory-DkQoSYDo.d.ts} +2 -2
- package/dist/authoring.d.ts +3 -3
- package/dist/consumer.d.ts +4 -4
- package/dist/credentials.d.ts +3 -3
- package/dist/devServerSidecar.d.ts +1 -1
- package/dist/{index-W4eSjdCM.d.ts → index-BxIc_L4D.d.ts} +233 -151
- package/dist/index.d.ts +11 -11
- package/dist/index.js +4 -4
- package/dist/nextServer.d.ts +7 -7
- package/dist/nextServer.js +2 -2
- package/dist/{persistenceServer-_pqP_0nw.d.ts → persistenceServer-BLG7_6B5.d.ts} +2 -2
- package/dist/{persistenceServer-CA0_q0D7.js → persistenceServer-KyHL0u01.js} +2 -2
- package/dist/{persistenceServer-CA0_q0D7.js.map → persistenceServer-KyHL0u01.js.map} +1 -1
- package/dist/persistenceServer.d.ts +5 -5
- package/dist/persistenceServer.js +2 -2
- package/dist/{server-Q5uwa6iR.d.ts → server-B0SD6Nvk.d.ts} +5 -5
- package/dist/{server-BE4PLhcb.js → server-CMUVhYIc.js} +3 -3
- package/dist/{server-BE4PLhcb.js.map → server-CMUVhYIc.js.map} +1 -1
- package/dist/server.d.ts +8 -8
- package/dist/server.js +4 -4
- package/package.json +5 -5
- package/prisma/migrations/20260430120000_telemetry_iteration_identity/migration.sql +17 -0
- package/prisma/migrations/20260430130000_execution_instance_iteration_identity/migration.sql +11 -0
- package/prisma/migrations.sqlite/20260430120000_telemetry_iteration_identity/migration.sql +14 -0
- package/prisma/migrations.sqlite/20260430130000_execution_instance_iteration_identity/migration.sql +10 -0
- package/prisma/schema.postgresql.prisma +12 -0
- package/prisma/schema.sqlite.prisma +12 -0
- package/src/application/contracts/IterationCostContracts.ts +11 -0
- package/src/application/queries/GetIterationCostQuery.ts +14 -0
- package/src/application/queries/GetIterationCostQueryHandler.ts +92 -0
- package/src/application/queries/GetWorkflowRunDetailQueryHandler.ts +44 -2
- package/src/application/queries/RunIterationProjectionFactory.ts +123 -0
- package/src/application/queries/WorkflowQueryHandlers.ts +1 -0
- package/src/application/telemetry/OtelExecutionTelemetry.types.ts +3 -0
- package/src/application/telemetry/RunEventBusTelemetryReporter.ts +7 -0
- package/src/application/telemetry/StoredNodeExecutionTelemetry.ts +14 -0
- package/src/application/telemetry/StoredTelemetrySpanScope.ts +90 -1
- package/src/bootstrap/AppContainerFactory.ts +5 -0
- package/src/domain/telemetry/TelemetryContracts.ts +12 -0
- package/src/infrastructure/persistence/InMemoryTelemetryMetricPointStore.ts +3 -0
- package/src/infrastructure/persistence/InMemoryTelemetrySpanStore.ts +3 -0
- package/src/infrastructure/persistence/InMemoryWorkflowRunRepository.ts +23 -0
- package/src/infrastructure/persistence/PrismaTelemetryMetricPointStore.ts +9 -0
- package/src/infrastructure/persistence/PrismaTelemetrySpanStore.ts +6 -0
- package/src/infrastructure/persistence/PrismaWorkflowRunRepository.ts +12 -0
- package/src/infrastructure/persistence/generated/prisma-postgresql-client/edge.js +15 -6
- package/src/infrastructure/persistence/generated/prisma-postgresql-client/index-browser.js +11 -2
- package/src/infrastructure/persistence/generated/prisma-postgresql-client/index.d.ts +343 -5
- package/src/infrastructure/persistence/generated/prisma-postgresql-client/index.js +15 -6
- package/src/infrastructure/persistence/generated/prisma-postgresql-client/package.json +1 -1
- package/src/infrastructure/persistence/generated/prisma-postgresql-client/schema.prisma +12 -0
- package/src/infrastructure/persistence/generated/prisma-sqlite-client/edge.js +15 -6
- package/src/infrastructure/persistence/generated/prisma-sqlite-client/index-browser.js +11 -2
- package/src/infrastructure/persistence/generated/prisma-sqlite-client/index.d.ts +343 -5
- package/src/infrastructure/persistence/generated/prisma-sqlite-client/index.js +15 -6
- package/src/infrastructure/persistence/generated/prisma-sqlite-client/package.json +1 -1
- package/src/infrastructure/persistence/generated/prisma-sqlite-client/schema.prisma +12 -0
- package/dist/AppContainerFactory-Cr3JeVmg.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { a as defineCodemationApp, i as FriendlyCodemationExecutionConfig, n as DefinePluginOptions, o as definePlugin, r as FriendlyCodemationDatabaseConfig, s as workflow, t as DefineCodemationAppOptions } from "./CodemationAuthoring.types-
|
|
3
|
-
import { S as CodemationWorkflowDiscovery, _ as CodemationEngineExecutionLimitsConfig, a as AppPluginLoadSummary, b as CodemationSchedulerConfig, c as CodemationPluginContext, d as CodemationAppSchedulerConfig, f as CodemationAppSchedulerKind, g as CodemationDatabaseKind, h as CodemationDatabaseConfig, l as CodemationPluginPackageMetadata, m as CodemationConfig, n as CodemationRegistrationContextBase, o as CodemationPlugin, p as CodemationApplicationRuntimeConfig, r as AppConfig, s as CodemationPluginConfig, t as CodemationAppContext, u as CodemationAppDefinition, v as CodemationEventBusConfig, w as CodemationClassToken, x as CodemationSchedulerKind, y as CodemationEventBusKind } from "./CodemationAppContext-
|
|
1
|
+
import "./index-BxIc_L4D.js";
|
|
2
|
+
import { a as defineCodemationApp, i as FriendlyCodemationExecutionConfig, n as DefinePluginOptions, o as definePlugin, r as FriendlyCodemationDatabaseConfig, s as workflow, t as DefineCodemationAppOptions } from "./CodemationAuthoring.types-lUdxXYq-.js";
|
|
3
|
+
import { S as CodemationWorkflowDiscovery, _ as CodemationEngineExecutionLimitsConfig, a as AppPluginLoadSummary, b as CodemationSchedulerConfig, c as CodemationPluginContext, d as CodemationAppSchedulerConfig, f as CodemationAppSchedulerKind, g as CodemationDatabaseKind, h as CodemationDatabaseConfig, l as CodemationPluginPackageMetadata, m as CodemationConfig, n as CodemationRegistrationContextBase, o as CodemationPlugin, p as CodemationApplicationRuntimeConfig, r as AppConfig, s as CodemationPluginConfig, t as CodemationAppContext, u as CodemationAppDefinition, v as CodemationEventBusConfig, w as CodemationClassToken, x as CodemationSchedulerKind, y as CodemationEventBusKind } from "./CodemationAppContext-YgJRUHWF.js";
|
|
4
4
|
import { a as CodemationAuthConfig, c as CodemationAuthOidcProviderConfig, i as CodemationLogRule, n as CodemationLogConfig, o as CodemationAuthKind, r as CodemationLogLevelName, s as CodemationAuthOAuthProviderConfig, t as CodemationWhitelabelConfig } from "./CodemationWhitelabelConfig-D5rYcLlj.js";
|
|
5
5
|
import "./LogLevelPolicy-CkiJAH75.js";
|
|
6
6
|
import { a as CodemationFrontendAuthSnapshot, i as CodemationFrontendAuthProviderSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-ci0Vwxrb.js";
|
|
7
7
|
import { i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-Ja0GQgpp.js";
|
|
8
|
-
import "./CodemationConfigNormalizer-
|
|
9
|
-
import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-
|
|
10
|
-
import "./CredentialServices-
|
|
11
|
-
import { S as Command, _ as AppContainerFactory, b as Query, c as FrontendRuntime, g as AppContainerLifecycle, h as DatabaseMigrations, n as CodemationBootstrapRequest, r as ApplicationTokens, s as WorkerRuntime, t as CodemationPluginListMerger, x as CommandBus, y as QueryBus } from "./CodemationPluginListMerger-
|
|
12
|
-
import { r as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-
|
|
13
|
-
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-
|
|
14
|
-
import { c as CodemationServerGateway, l as ApiPaths } from "./server-
|
|
15
|
-
import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-
|
|
8
|
+
import "./CodemationConfigNormalizer-BWBp7mFB.js";
|
|
9
|
+
import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-Bka3v6lh.js";
|
|
10
|
+
import "./CredentialServices-CKXPg5xu.js";
|
|
11
|
+
import { S as Command, _ as AppContainerFactory, b as Query, c as FrontendRuntime, g as AppContainerLifecycle, h as DatabaseMigrations, n as CodemationBootstrapRequest, r as ApplicationTokens, s as WorkerRuntime, t as CodemationPluginListMerger, x as CommandBus, y as QueryBus } from "./CodemationPluginListMerger-Oz-GAkxz.js";
|
|
12
|
+
import { r as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-D3k-R3Ch.js";
|
|
13
|
+
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-BLG7_6B5.js";
|
|
14
|
+
import { c as CodemationServerGateway, l as ApiPaths } from "./server-B0SD6Nvk.js";
|
|
15
|
+
import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-DkQoSYDo.js";
|
|
16
16
|
|
|
17
17
|
//#region src/application/contracts/userDirectoryContracts.types.d.ts
|
|
18
18
|
type UserAccountStatus = "invited" | "active" | "inactive";
|
package/dist/index.js
CHANGED
|
@@ -6,11 +6,11 @@ import "./ServerLoggerFactory-CsNW5qhz.js";
|
|
|
6
6
|
import "./decorateParam-D7WPDFAf.js";
|
|
7
7
|
import "./decorate-Dq0XLibd.js";
|
|
8
8
|
import { d as ApplicationTokens } from "./CredentialServices-BNBMFOPt.js";
|
|
9
|
-
import { D as ListUserAccountsQuery, E as UpsertLocalBootstrapUserCommand, _ as FrontendAppConfigFactory, a as AppContainerLifecycle, b as ApiPaths, g as InternalAuthBootstrapFactory, h as PublicFrontendBootstrapFactory, i as DatabaseMigrations, n as WorkerRuntime, r as FrontendRuntime, t as AppContainerFactory, v as CodemationFrontendAuthSnapshotFactory } from "./AppContainerFactory-
|
|
10
|
-
import { n as CodemationPluginPackageMetadata, t as AppConfigFactory } from "./AppConfigFactory-
|
|
9
|
+
import { D as ListUserAccountsQuery, E as UpsertLocalBootstrapUserCommand, _ as FrontendAppConfigFactory, a as AppContainerLifecycle, b as ApiPaths, g as InternalAuthBootstrapFactory, h as PublicFrontendBootstrapFactory, i as DatabaseMigrations, n as WorkerRuntime, r as FrontendRuntime, t as AppContainerFactory, v as CodemationFrontendAuthSnapshotFactory } from "./AppContainerFactory-CKRDz8kQ.js";
|
|
10
|
+
import { n as CodemationPluginPackageMetadata, t as AppConfigFactory } from "./AppConfigFactory-C4OXGOs2.js";
|
|
11
11
|
import { n as CodemationBootstrapRequest, t as CodemationPluginListMerger } from "./CodemationPluginListMerger-_lZaa6gO.js";
|
|
12
|
-
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-
|
|
13
|
-
import { r as CodemationServerGateway } from "./server-
|
|
12
|
+
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-KyHL0u01.js";
|
|
13
|
+
import { r as CodemationServerGateway } from "./server-CMUVhYIc.js";
|
|
14
14
|
import { workflow } from "@codemation/core-nodes";
|
|
15
15
|
|
|
16
16
|
export { ApiPaths, AppConfigFactory, AppContainerFactory, AppContainerLifecycle, ApplicationTokens, CodemationBootstrapRequest, CodemationConsumerConfigLoader, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, CodemationPluginListMerger, CodemationPluginPackageMetadata, CodemationPostgresPrismaClientFactory, CodemationServerGateway, DatabaseMigrations, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, FrontendRuntime, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, ListUserAccountsQuery, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, UpsertLocalBootstrapUserCommand, WorkerRuntime, defineCodemationApp, definePlugin, workflow };
|
package/dist/nextServer.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { D as ActivationIdFactory, I as WorkflowDefinition$1, N as RunIdFactory, O as BinaryAttachment, R as BinaryStorage, X as WorkflowActivationPolicy, Z as WebhookInvocationMatch, k as Item, t as RunIntentService, v as CredentialOAuth2AuthDefinition, w as CredentialTypeDefinition } from "./index-
|
|
2
|
-
import { r as AppConfig } from "./CodemationAppContext-
|
|
1
|
+
import { D as ActivationIdFactory, I as WorkflowDefinition$1, N as RunIdFactory, O as BinaryAttachment, R as BinaryStorage, X as WorkflowActivationPolicy, Z as WebhookInvocationMatch, k as Item, t as RunIntentService, v as CredentialOAuth2AuthDefinition, w as CredentialTypeDefinition } from "./index-BxIc_L4D.js";
|
|
2
|
+
import { r as AppConfig } from "./CodemationAppContext-YgJRUHWF.js";
|
|
3
3
|
import { l as Logger, u as LoggerFactory } from "./CodemationWhitelabelConfig-D5rYcLlj.js";
|
|
4
4
|
import "./LogLevelPolicy-CkiJAH75.js";
|
|
5
5
|
import { a as CodemationFrontendAuthSnapshot, i as CodemationFrontendAuthProviderSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-ci0Vwxrb.js";
|
|
6
|
-
import "./CodemationConfigNormalizer-
|
|
7
|
-
import { a as CredentialInstanceService, c as CredentialSecretCipher, i as CredentialBindingService, l as CredentialFieldEnvOverlayService, o as CredentialOAuth2ScopeResolver, r as CredentialRuntimeMaterialService, s as CredentialMaterialResolver, t as CredentialStore, u as CredentialTypeRegistryImpl } from "./CredentialServices-
|
|
8
|
-
import { _ as AppContainerFactory, a as WorkflowDebuggerOverlayRepository, c as FrontendRuntime, d as LogLevelPolicyFactory, f as logLevelPolicyFactory, g as AppContainerLifecycle, h as DatabaseMigrations, i as HonoApiRouteRegistrar, l as WorkflowRunRetentionPruneScheduler, m as WorkflowRunRepository, n as CodemationBootstrapRequest, o as SessionVerifier, p as LogFilter, r as ApplicationTokens, s as WorkerRuntime, t as CodemationPluginListMerger, u as ServerLoggerFactory, v as WorkflowWebsocketServer, x as CommandBus, y as QueryBus } from "./CodemationPluginListMerger-
|
|
9
|
-
import { t as AppConfigFactory } from "./AppConfigFactory-
|
|
10
|
-
import { a as WorkflowDto, n as InternalAuthBootstrapFactory, o as WorkflowSummary, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-
|
|
6
|
+
import "./CodemationConfigNormalizer-BWBp7mFB.js";
|
|
7
|
+
import { a as CredentialInstanceService, c as CredentialSecretCipher, i as CredentialBindingService, l as CredentialFieldEnvOverlayService, o as CredentialOAuth2ScopeResolver, r as CredentialRuntimeMaterialService, s as CredentialMaterialResolver, t as CredentialStore, u as CredentialTypeRegistryImpl } from "./CredentialServices-CKXPg5xu.js";
|
|
8
|
+
import { _ as AppContainerFactory, a as WorkflowDebuggerOverlayRepository, c as FrontendRuntime, d as LogLevelPolicyFactory, f as logLevelPolicyFactory, g as AppContainerLifecycle, h as DatabaseMigrations, i as HonoApiRouteRegistrar, l as WorkflowRunRetentionPruneScheduler, m as WorkflowRunRepository, n as CodemationBootstrapRequest, o as SessionVerifier, p as LogFilter, r as ApplicationTokens, s as WorkerRuntime, t as CodemationPluginListMerger, u as ServerLoggerFactory, v as WorkflowWebsocketServer, x as CommandBus, y as QueryBus } from "./CodemationPluginListMerger-Oz-GAkxz.js";
|
|
9
|
+
import { t as AppConfigFactory } from "./AppConfigFactory-D3k-R3Ch.js";
|
|
10
|
+
import { a as WorkflowDto, n as InternalAuthBootstrapFactory, o as WorkflowSummary, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-DkQoSYDo.js";
|
|
11
11
|
import { Hono } from "hono";
|
|
12
12
|
import { NodeDefinition, WorkflowDefinition } from "@codemation/core/browser";
|
|
13
13
|
|
package/dist/nextServer.js
CHANGED
|
@@ -3,8 +3,8 @@ import { a as FilteringLogger, i as PerformanceLogPolicy, n as PerformanceLogPol
|
|
|
3
3
|
import "./decorateParam-D7WPDFAf.js";
|
|
4
4
|
import "./decorate-Dq0XLibd.js";
|
|
5
5
|
import { a as CredentialInstanceService, d as ApplicationTokens, i as CredentialBindingService } from "./CredentialServices-BNBMFOPt.js";
|
|
6
|
-
import { S as WorkflowPolicyUiPresentationFactory, T as RunBinaryAttachmentLookupService, _ as FrontendAppConfigFactory, a as AppContainerLifecycle, c as WebhookHttpRouteHandler, d as OAuth2HttpRouteHandler, f as CredentialHttpRouteHandler, g as InternalAuthBootstrapFactory, h as PublicFrontendBootstrapFactory, i as DatabaseMigrations, l as RequestToWebhookItemMapper, m as BinaryHttpRouteHandler, n as WorkerRuntime, o as WorkflowRunRetentionPruneScheduler, p as CodemationHonoApiApp, r as FrontendRuntime, s as WorkflowHttpRouteHandler, t as AppContainerFactory, u as RunHttpRouteHandler, x as WorkflowDefinitionMapper, y as WorkflowWebsocketServer } from "./AppContainerFactory-
|
|
7
|
-
import { t as AppConfigFactory } from "./AppConfigFactory-
|
|
6
|
+
import { S as WorkflowPolicyUiPresentationFactory, T as RunBinaryAttachmentLookupService, _ as FrontendAppConfigFactory, a as AppContainerLifecycle, c as WebhookHttpRouteHandler, d as OAuth2HttpRouteHandler, f as CredentialHttpRouteHandler, g as InternalAuthBootstrapFactory, h as PublicFrontendBootstrapFactory, i as DatabaseMigrations, l as RequestToWebhookItemMapper, m as BinaryHttpRouteHandler, n as WorkerRuntime, o as WorkflowRunRetentionPruneScheduler, p as CodemationHonoApiApp, r as FrontendRuntime, s as WorkflowHttpRouteHandler, t as AppContainerFactory, u as RunHttpRouteHandler, x as WorkflowDefinitionMapper, y as WorkflowWebsocketServer } from "./AppContainerFactory-CKRDz8kQ.js";
|
|
7
|
+
import { t as AppConfigFactory } from "./AppConfigFactory-C4OXGOs2.js";
|
|
8
8
|
import { n as CodemationBootstrapRequest, t as CodemationPluginListMerger } from "./CodemationPluginListMerger-_lZaa6gO.js";
|
|
9
9
|
|
|
10
10
|
export { AppConfigFactory, AppContainerFactory, AppContainerLifecycle, ApplicationTokens, BinaryHttpRouteHandler, CodemationBootstrapRequest, CodemationHonoApiApp, CodemationPluginListMerger, CredentialBindingService, CredentialHttpRouteHandler, CredentialInstanceService, DatabaseMigrations, FilteringLogger, FrontendAppConfigFactory, FrontendRuntime, InternalAuthBootstrapFactory, LogLevelPolicyFactory, OAuth2HttpRouteHandler, PerformanceLogPolicy, PerformanceLogPolicyFactory, PublicFrontendBootstrapFactory, RequestToWebhookItemMapper, RunBinaryAttachmentLookupService, RunHttpRouteHandler, ServerLoggerFactory, WebhookHttpRouteHandler, WorkerRuntime, WorkflowDefinitionMapper, WorkflowHttpRouteHandler, WorkflowPolicyUiPresentationFactory, WorkflowRunRetentionPruneScheduler, WorkflowWebsocketServer, logLevelPolicyFactory, performanceLogPolicyFactory };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as PrismaClient } from "./AppConfigFactory-
|
|
1
|
+
import { i as PrismaClient } from "./AppConfigFactory-D3k-R3Ch.js";
|
|
2
2
|
|
|
3
3
|
//#region src/infrastructure/persistence/CodemationPostgresPrismaClientFactory.d.ts
|
|
4
4
|
declare class CodemationPostgresPrismaClientFactory {
|
|
@@ -6,4 +6,4 @@ declare class CodemationPostgresPrismaClientFactory {
|
|
|
6
6
|
}
|
|
7
7
|
//#endregion
|
|
8
8
|
export { CodemationPostgresPrismaClientFactory as t };
|
|
9
|
-
//# sourceMappingURL=persistenceServer-
|
|
9
|
+
//# sourceMappingURL=persistenceServer-BLG7_6B5.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as __toESM } from "./chunk-7V6ThxGB.js";
|
|
2
|
-
import { i as require_client } from "./AppConfigFactory-
|
|
2
|
+
import { i as require_client } from "./AppConfigFactory-C4OXGOs2.js";
|
|
3
3
|
import { PrismaPg } from "@prisma/adapter-pg";
|
|
4
4
|
|
|
5
5
|
//#region src/infrastructure/persistence/CodemationPostgresPrismaClientFactory.ts
|
|
@@ -12,4 +12,4 @@ var CodemationPostgresPrismaClientFactory = class {
|
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
14
14
|
export { CodemationPostgresPrismaClientFactory as t };
|
|
15
|
-
//# sourceMappingURL=persistenceServer-
|
|
15
|
+
//# sourceMappingURL=persistenceServer-KyHL0u01.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistenceServer-
|
|
1
|
+
{"version":3,"file":"persistenceServer-KyHL0u01.js","names":["PrismaClient"],"sources":["../src/infrastructure/persistence/CodemationPostgresPrismaClientFactory.ts"],"sourcesContent":["import { PrismaPg } from \"@prisma/adapter-pg\";\nimport { PrismaClient } from \"./generated/prisma-postgresql-client/client.js\";\n\nexport class CodemationPostgresPrismaClientFactory {\n static create(databaseUrl: string): PrismaClient {\n const adapter = new PrismaPg({ connectionString: databaseUrl });\n return new PrismaClient({ adapter });\n }\n}\n"],"mappings":";;;;;;AAGA,IAAa,wCAAb,MAAmD;CACjD,OAAO,OAAO,aAAmC;AAE/C,SAAO,IAAIA,2BAAa,EAAE,SADV,IAAI,SAAS,EAAE,kBAAkB,aAAa,CAAC,EAC5B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { i as AppPersistenceConfig } from "./CodemationAppContext-
|
|
1
|
+
import "./index-BxIc_L4D.js";
|
|
2
|
+
import { i as AppPersistenceConfig } from "./CodemationAppContext-YgJRUHWF.js";
|
|
3
3
|
import "./CodemationWhitelabelConfig-D5rYcLlj.js";
|
|
4
|
-
import "./CodemationConfigNormalizer-
|
|
5
|
-
import { n as PrismaMigrationDeployer, r as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-
|
|
6
|
-
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-
|
|
4
|
+
import "./CodemationConfigNormalizer-BWBp7mFB.js";
|
|
5
|
+
import { n as PrismaMigrationDeployer, r as PrismaDatabaseClient, t as AppConfigFactory } from "./AppConfigFactory-D3k-R3Ch.js";
|
|
6
|
+
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-BLG7_6B5.js";
|
|
7
7
|
export { AppConfigFactory, AppPersistenceConfig, CodemationPostgresPrismaClientFactory, PrismaDatabaseClient as PrismaClient, PrismaMigrationDeployer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./decorate-Dq0XLibd.js";
|
|
2
|
-
import { r as PrismaMigrationDeployer, t as AppConfigFactory } from "./AppConfigFactory-
|
|
3
|
-
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-
|
|
2
|
+
import { r as PrismaMigrationDeployer, t as AppConfigFactory } from "./AppConfigFactory-C4OXGOs2.js";
|
|
3
|
+
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-KyHL0u01.js";
|
|
4
4
|
|
|
5
5
|
export { AppConfigFactory, CodemationPostgresPrismaClientFactory, PrismaMigrationDeployer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { m as CodemationConfig, o as CodemationPlugin, r as AppConfig } from "./CodemationAppContext-
|
|
2
|
-
import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-
|
|
3
|
-
import { t as AppConfigFactory } from "./AppConfigFactory-
|
|
4
|
-
import { a as WorkflowDto, o as WorkflowSummary } from "./PublicFrontendBootstrapFactory-
|
|
1
|
+
import { m as CodemationConfig, o as CodemationPlugin, r as AppConfig } from "./CodemationAppContext-YgJRUHWF.js";
|
|
2
|
+
import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-Bka3v6lh.js";
|
|
3
|
+
import { t as AppConfigFactory } from "./AppConfigFactory-D3k-R3Ch.js";
|
|
4
|
+
import { a as WorkflowDto, o as WorkflowSummary } from "./PublicFrontendBootstrapFactory-DkQoSYDo.js";
|
|
5
5
|
|
|
6
6
|
//#region src/presentation/http/ApiPaths.d.ts
|
|
7
7
|
declare class ApiPaths {
|
|
@@ -156,4 +156,4 @@ declare class WorkflowDiscoveryPathSegmentsComputer {
|
|
|
156
156
|
}
|
|
157
157
|
//#endregion
|
|
158
158
|
export { CodemationResolvedPluginPackage as a, CodemationServerGateway as c, CodemationPluginDiscovery as i, ApiPaths as l, WorkflowModulePathFinder as n, AppConfigLoadResult as o, CodemationDiscoveredPluginPackage as r, AppConfigLoader as s, WorkflowDiscoveryPathSegmentsComputer as t };
|
|
159
|
-
//# sourceMappingURL=server-
|
|
159
|
+
//# sourceMappingURL=server-B0SD6Nvk.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as CodemationConfigNormalizer, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-DovlxZNb.js";
|
|
2
2
|
import { d as ApplicationTokens } from "./CredentialServices-BNBMFOPt.js";
|
|
3
|
-
import { C as GetWorkflowSummariesQuery, a as AppContainerLifecycle, p as CodemationHonoApiApp, r as FrontendRuntime, t as AppContainerFactory, w as GetWorkflowDetailQuery, x as WorkflowDefinitionMapper } from "./AppContainerFactory-
|
|
4
|
-
import { n as CodemationPluginPackageMetadata, t as AppConfigFactory } from "./AppConfigFactory-
|
|
3
|
+
import { C as GetWorkflowSummariesQuery, a as AppContainerLifecycle, p as CodemationHonoApiApp, r as FrontendRuntime, t as AppContainerFactory, w as GetWorkflowDetailQuery, x as WorkflowDefinitionMapper } from "./AppContainerFactory-CKRDz8kQ.js";
|
|
4
|
+
import { n as CodemationPluginPackageMetadata, t as AppConfigFactory } from "./AppConfigFactory-C4OXGOs2.js";
|
|
5
5
|
import { readFile, readdir } from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { pathToFileURL } from "node:url";
|
|
@@ -218,4 +218,4 @@ var CodemationPluginDiscovery = class {
|
|
|
218
218
|
|
|
219
219
|
//#endregion
|
|
220
220
|
export { AppConfigLoader as n, CodemationServerGateway as r, CodemationPluginDiscovery as t };
|
|
221
|
-
//# sourceMappingURL=server-
|
|
221
|
+
//# sourceMappingURL=server-CMUVhYIc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-BE4PLhcb.js","names":["config: CodemationConfig","consumerRoot: string","configSource?: string","workflowSources: ReadonlyArray<string>","env?: Readonly<NodeJS.ProcessEnv>","consumerConfigLoader: CodemationConsumerConfigLoader","appConfigFactory: AppConfigFactory","discoveredPackages: CodemationDiscoveredPluginPackage[]","resolvedPackages: CodemationResolvedPluginPackage[]","packageRoots: string[]"],"sources":["../src/presentation/http/CodemationServerGatewayFactory.ts","../src/presentation/server/AppConfigLoader.ts","../src/presentation/server/CodemationPluginDiscovery.ts"],"sourcesContent":["import { accessSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { QueryBus } from \"../../application/bus/QueryBus\";\nimport type { WorkflowDto, WorkflowSummary } from \"../../application/contracts/WorkflowViewContracts\";\nimport { WorkflowDefinitionMapper } from \"../../application/mapping/WorkflowDefinitionMapper\";\nimport { GetWorkflowDetailQuery } from \"../../application/queries/GetWorkflowDetailQuery\";\nimport { GetWorkflowSummariesQuery } from \"../../application/queries/GetWorkflowSummariesQuery\";\nimport { ApplicationTokens } from \"../../applicationTokens\";\nimport { AppContainerFactory } from \"../../bootstrap/AppContainerFactory\";\nimport { AppContainerLifecycle } from \"../../bootstrap/AppContainerLifecycle\";\nimport { FrontendRuntime } from \"../../bootstrap/runtime/FrontendRuntime\";\nimport { AppConfigFactory } from \"../../bootstrap/runtime/AppConfigFactory\";\nimport type { CodemationConfig } from \"../config/CodemationConfig\";\nimport { CodemationConfigNormalizer } from \"../config/CodemationConfigNormalizer\";\nimport { CodemationHonoApiApp } from \"./hono/CodemationHonoApiAppFactory\";\n\ntype ServerGatewayContext = Readonly<{\n container: import(\"@codemation/core\").Container;\n httpApi: CodemationHonoApiApp;\n queryBus: QueryBus;\n workflowDefinitionMapper: WorkflowDefinitionMapper;\n}>;\n\nexport class CodemationServerGateway {\n private static readonly contextsByConfig = new WeakMap<object, Promise<ServerGatewayContext>>();\n\n constructor(\n private readonly config: CodemationConfig,\n private readonly consumerRoot: string,\n private readonly configSource?: string,\n private readonly workflowSources: ReadonlyArray<string> = [],\n private readonly env?: Readonly<NodeJS.ProcessEnv>,\n ) {}\n\n async dispatch(request: Request): Promise<Response> {\n return await (await this.getContext()).httpApi.fetch(request);\n }\n\n async prepare(): Promise<void> {\n await this.getContext();\n }\n\n async close(): Promise<void> {\n const cachedContext = CodemationServerGateway.contextsByConfig.get(this.config as object);\n if (!cachedContext) {\n return;\n }\n CodemationServerGateway.contextsByConfig.delete(this.config as object);\n await (await cachedContext).container.resolve(AppContainerLifecycle).stop();\n }\n\n async loadWorkflowSummaries(): Promise<ReadonlyArray<WorkflowSummary>> {\n const context = await this.getContext();\n const workflows = await context.queryBus.execute(new GetWorkflowSummariesQuery());\n return workflows.map((workflow) => context.workflowDefinitionMapper.toSummary(workflow));\n }\n\n async loadWorkflowDetail(workflowId: string): Promise<WorkflowDto> {\n const context = await this.getContext();\n const workflow = await context.queryBus.execute(new GetWorkflowDetailQuery(workflowId));\n if (!workflow) {\n throw new Error(`Unknown workflowId: ${workflowId}`);\n }\n return await context.workflowDefinitionMapper.map(workflow);\n }\n\n private getContext(): Promise<ServerGatewayContext> {\n const cachedContext = CodemationServerGateway.contextsByConfig.get(this.config as object);\n if (cachedContext) {\n return cachedContext;\n }\n const nextContext = this.createContext();\n CodemationServerGateway.contextsByConfig.set(this.config as object, nextContext);\n return nextContext;\n }\n\n private async createContext(): Promise<ServerGatewayContext> {\n const repoRoot = this.detectWorkspaceRoot(this.consumerRoot);\n // This gateway is the config/env boundary that materializes AppConfig from raw inputs.\n // eslint-disable-next-line no-restricted-properties\n const env = this.env ?? process.env;\n const appConfig = new AppConfigFactory().create({\n repoRoot,\n consumerRoot: this.consumerRoot,\n env,\n config: new CodemationConfigNormalizer().normalize(this.config),\n workflowSources: this.resolveWorkflowSources(),\n });\n const container = await new AppContainerFactory().create({\n appConfig,\n sharedWorkflowWebsocketServer: null,\n });\n await container.resolve(FrontendRuntime).start();\n return {\n container,\n httpApi: container.resolve(CodemationHonoApiApp),\n queryBus: container.resolve(ApplicationTokens.QueryBus),\n workflowDefinitionMapper: container.resolve(WorkflowDefinitionMapper),\n };\n }\n\n private resolveWorkflowSources(): ReadonlyArray<string> {\n if (this.workflowSources.length > 0) {\n return [...this.workflowSources];\n }\n if (!this.configSource || !this.config.workflows || this.config.workflows.length === 0) {\n return [];\n }\n return [this.configSource];\n }\n private detectWorkspaceRoot(startDirectory: string): string {\n let currentDirectory = path.resolve(startDirectory);\n while (true) {\n try {\n accessSync(path.resolve(currentDirectory, \"pnpm-workspace.yaml\"));\n return currentDirectory;\n } catch {\n const parentDirectory = path.dirname(currentDirectory);\n if (parentDirectory === currentDirectory) {\n return startDirectory;\n }\n currentDirectory = parentDirectory;\n }\n }\n }\n}\n","import type { AppConfig } from \"../config/AppConfig\";\nimport { CodemationConsumerConfigLoader } from \"./CodemationConsumerConfigLoader\";\nimport { AppConfigFactory } from \"../../bootstrap/runtime/AppConfigFactory\";\n\nexport type AppConfigLoadResult = Readonly<{\n appConfig: AppConfig;\n bootstrapSource: string | null;\n}>;\n\nexport class AppConfigLoader {\n constructor(\n private readonly consumerConfigLoader: CodemationConsumerConfigLoader = new CodemationConsumerConfigLoader(),\n private readonly appConfigFactory: AppConfigFactory = new AppConfigFactory(),\n ) {}\n\n async load(\n args: Readonly<{\n consumerRoot: string;\n repoRoot: string;\n env: NodeJS.ProcessEnv;\n configPathOverride?: string;\n }>,\n ): Promise<AppConfigLoadResult> {\n const resolution = await this.consumerConfigLoader.load({\n consumerRoot: args.consumerRoot,\n configPathOverride: args.configPathOverride,\n });\n return {\n appConfig: this.appConfigFactory.create({\n repoRoot: args.repoRoot,\n consumerRoot: args.consumerRoot,\n env: args.env,\n config: resolution.config,\n workflowSources: resolution.workflowSources,\n }),\n bootstrapSource: resolution.bootstrapSource,\n };\n }\n}\n","import type { CodemationPackageManifest } from \"../config/CodemationPackageManifest\";\nimport { CodemationPluginPackageMetadata, type CodemationPlugin } from \"../config/CodemationPlugin\";\nimport { readFile, readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nexport type CodemationDiscoveredPluginPackage = Readonly<{\n packageName: string;\n packageRoot: string;\n pluginEntry: string;\n developmentEntry?: string;\n}>;\n\nexport type CodemationResolvedPluginPackage = Readonly<\n CodemationDiscoveredPluginPackage & {\n plugin: CodemationPlugin;\n }\n>;\n\ntype PackageJsonShape = Readonly<{\n codemation?: CodemationPackageManifest;\n name?: string;\n exports?: Readonly<Record<string, unknown>>;\n}>;\n\nexport class CodemationPluginDiscovery {\n private readonly pluginPackageMetadata = new CodemationPluginPackageMetadata();\n\n async discover(consumerRoot: string): Promise<ReadonlyArray<CodemationDiscoveredPluginPackage>> {\n const nodeModulesRoot = path.resolve(consumerRoot, \"node_modules\");\n const packageRoots = await this.collectPackageRoots(nodeModulesRoot);\n const discoveredPackages: CodemationDiscoveredPluginPackage[] = [];\n for (const packageRoot of packageRoots) {\n const packageJson = await this.readPackageJson(path.resolve(packageRoot, \"package.json\"));\n const pluginManifest = packageJson.codemation?.plugin;\n if (!packageJson.name || typeof pluginManifest !== \"string\" || pluginManifest.trim().length === 0) {\n continue;\n }\n discoveredPackages.push({\n packageName: packageJson.name,\n packageRoot,\n pluginEntry: pluginManifest,\n developmentEntry: await this.resolveDevelopmentPluginEntry(packageRoot),\n });\n }\n return discoveredPackages.sort((left, right) => left.packageName.localeCompare(right.packageName));\n }\n\n async resolvePlugins(consumerRoot: string): Promise<ReadonlyArray<CodemationResolvedPluginPackage>> {\n const discoveredPackages = await this.discover(consumerRoot);\n return await this.resolveDiscoveredPackages(discoveredPackages);\n }\n\n async resolveDiscoveredPackages(\n discoveredPackages: ReadonlyArray<CodemationDiscoveredPluginPackage>,\n ): Promise<ReadonlyArray<CodemationResolvedPluginPackage>> {\n const resolvedPackages: CodemationResolvedPluginPackage[] = [];\n for (const discoveredPackage of discoveredPackages) {\n resolvedPackages.push({\n ...discoveredPackage,\n plugin: await this.loadPlugin(discoveredPackage),\n });\n }\n return resolvedPackages;\n }\n\n private async collectPackageRoots(nodeModulesRoot: string): Promise<ReadonlyArray<string>> {\n try {\n const entries = await readdir(nodeModulesRoot, { withFileTypes: true });\n const packageRoots: string[] = [];\n for (const entry of entries) {\n if (!entry.isDirectory() && !entry.isSymbolicLink()) {\n continue;\n }\n if (entry.name.startsWith(\"@\")) {\n const scopedEntries = await readdir(path.resolve(nodeModulesRoot, entry.name), { withFileTypes: true });\n for (const scopedEntry of scopedEntries) {\n if (scopedEntry.isDirectory() || scopedEntry.isSymbolicLink()) {\n packageRoots.push(path.resolve(nodeModulesRoot, entry.name, scopedEntry.name));\n }\n }\n continue;\n }\n packageRoots.push(path.resolve(nodeModulesRoot, entry.name));\n }\n return packageRoots;\n } catch {\n return [];\n }\n }\n\n private async readPackageJson(packageJsonPath: string): Promise<PackageJsonShape> {\n try {\n const rawPackageJson = await readFile(packageJsonPath, \"utf8\");\n return JSON.parse(rawPackageJson) as PackageJsonShape;\n } catch {\n return {};\n }\n }\n\n private async loadPlugin(discoveredPackage: CodemationDiscoveredPluginPackage): Promise<CodemationPlugin> {\n const pluginModulePath = path.resolve(discoveredPackage.packageRoot, this.resolvePluginEntry(discoveredPackage));\n const importedModule = (await import(\n /* webpackIgnore: true */ this.resolvePluginModuleSpecifier(pluginModulePath)\n )) as Record<string, unknown>;\n const exportedValue = importedModule.default;\n const plugin = this.resolvePluginValue(exportedValue);\n if (!plugin) {\n throw new Error(`Plugin package \"${discoveredPackage.packageName}\" did not default-export a Codemation plugin.`);\n }\n return this.pluginPackageMetadata.attachPackageName(plugin, discoveredPackage.packageName);\n }\n\n private resolvePluginValue(value: unknown): CodemationPlugin | null {\n if (this.isPluginConfig(value)) {\n return value;\n }\n return null;\n }\n\n private isPluginConfig(value: unknown): value is CodemationPlugin {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return false;\n }\n const pluginValue = value as {\n credentialTypes?: unknown;\n register?: unknown;\n sandbox?: unknown;\n };\n if (pluginValue.register !== undefined && typeof pluginValue.register !== \"function\") {\n return false;\n }\n if (pluginValue.credentialTypes !== undefined && !Array.isArray(pluginValue.credentialTypes)) {\n return false;\n }\n return (\n pluginValue.register !== undefined ||\n pluginValue.credentialTypes !== undefined ||\n pluginValue.sandbox !== undefined ||\n Object.keys(pluginValue).length === 0\n );\n }\n\n private resolvePluginEntry(discoveredPackage: CodemationDiscoveredPluginPackage): string {\n const preferSource =\n process.env.CODEMATION_PREFER_PLUGIN_SOURCE_ENTRY === \"true\" &&\n typeof discoveredPackage.developmentEntry === \"string\" &&\n discoveredPackage.developmentEntry.trim().length > 0;\n const selectedEntry = preferSource ? discoveredPackage.developmentEntry : discoveredPackage.pluginEntry;\n return selectedEntry;\n }\n\n private async resolveDevelopmentPluginEntry(packageRoot: string): Promise<string | undefined> {\n const candidates = [\n path.resolve(packageRoot, \"codemation.plugin.ts\"),\n path.resolve(packageRoot, \"codemation.plugin.js\"),\n path.resolve(packageRoot, \"src\", \"codemation.plugin.ts\"),\n path.resolve(packageRoot, \"src\", \"codemation.plugin.js\"),\n ];\n for (const candidate of candidates) {\n if (await this.exists(candidate)) {\n return path.relative(packageRoot, candidate);\n }\n }\n return undefined;\n }\n\n private async exists(filePath: string): Promise<boolean> {\n try {\n await readFile(filePath, \"utf8\");\n return true;\n } catch {\n return false;\n }\n }\n\n private resolvePluginModuleSpecifier(pluginModulePath: string): string {\n return pathToFileURL(pluginModulePath).href;\n }\n}\n"],"mappings":";;;;;;;;;;AAuBA,IAAa,0BAAb,MAAa,wBAAwB;CACnC,OAAwB,mCAAmB,IAAI,SAAgD;CAE/F,YACE,AAAiBA,QACjB,AAAiBC,cACjB,AAAiBC,cACjB,AAAiBC,kBAAyC,EAAE,EAC5D,AAAiBC,KACjB;EALiB;EACA;EACA;EACA;EACA;;CAGnB,MAAM,SAAS,SAAqC;AAClD,SAAO,OAAO,MAAM,KAAK,YAAY,EAAE,QAAQ,MAAM,QAAQ;;CAG/D,MAAM,UAAyB;AAC7B,QAAM,KAAK,YAAY;;CAGzB,MAAM,QAAuB;EAC3B,MAAM,gBAAgB,wBAAwB,iBAAiB,IAAI,KAAK,OAAiB;AACzF,MAAI,CAAC,cACH;AAEF,0BAAwB,iBAAiB,OAAO,KAAK,OAAiB;AACtE,SAAO,MAAM,eAAe,UAAU,QAAQ,sBAAsB,CAAC,MAAM;;CAG7E,MAAM,wBAAiE;EACrE,MAAM,UAAU,MAAM,KAAK,YAAY;AAEvC,UADkB,MAAM,QAAQ,SAAS,QAAQ,IAAI,2BAA2B,CAAC,EAChE,KAAK,aAAa,QAAQ,yBAAyB,UAAU,SAAS,CAAC;;CAG1F,MAAM,mBAAmB,YAA0C;EACjE,MAAM,UAAU,MAAM,KAAK,YAAY;EACvC,MAAM,WAAW,MAAM,QAAQ,SAAS,QAAQ,IAAI,uBAAuB,WAAW,CAAC;AACvF,MAAI,CA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,QAAQ,kBAAkB,YAAY;;CAG5F,AAAQ,mBAAmB,OAAyC;AAClE,MAAI,KAAK,eAAe,MAAM,CAC5B,QAAO;AAET,SAAO;;CAGT,AAAQ,eAAe,OAA2C;AAChE,MAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,MAAM,CAC7D,QAAO;EAET,MAAM,cAAc;AAKpB,MAAI,YAAY,aAAa,UAAa,OAAO,YAAY,aAAa,WACxE,QAAO;AAET,MAAI,YAAY,oBAAoB,UAAa,CAAC,MAAM,QAAQ,YAAY,gBAAgB,CAC1F,QAAO;AAET,SACE,YAAY,aAAa,UACzB,YAAY,oBAAoB,UAChC,YAAY,YAAY,UACxB,OAAO,KAAK,YAAY,CAAC,WAAW;;CAIxC,AAAQ,mBAAmB,mBAA8D;AAMvF,SAJE,QAAQ,IAAI,0CAA0C,UACtD,OAAO,kBAAkB,qBAAqB,YAC9C,kBAAkB,iBAAiB,MAAM,CAAC,SAAS,IAChB,kBAAkB,mBAAmB,kBAAkB;;CAI9F,MAAc,8BAA8B,aAAkD;EAC5F,MAAM,aAAa;GACjB,KAAK,QAAQ,aAAa,uBAAuB;GACjD,KAAK,QAAQ,aAAa,uBAAuB;GACjD,KAAK,QAAQ,aAAa,OAAO,uBAAuB;GACxD,KAAK,QAAQ,aAAa,OAAO,uBAAuB;GACzD;AACD,OAAK,MAAM,aAAa,WACtB,KAAI,MAAM,KAAK,OAAO,UAAU,CAC9B,QAAO,KAAK,SAAS,aAAa,UAAU;;CAMlD,MAAc,OAAO,UAAoC;AACvD,MAAI;AACF,SAAM,SAAS,UAAU,OAAO;AAChC,UAAO;UACD;AACN,UAAO;;;CAIX,AAAQ,6BAA6B,kBAAkC;AACrE,SAAO,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"server-CMUVhYIc.js","names":["config: CodemationConfig","consumerRoot: string","configSource?: string","workflowSources: ReadonlyArray<string>","env?: Readonly<NodeJS.ProcessEnv>","consumerConfigLoader: CodemationConsumerConfigLoader","appConfigFactory: AppConfigFactory","discoveredPackages: CodemationDiscoveredPluginPackage[]","resolvedPackages: CodemationResolvedPluginPackage[]","packageRoots: string[]"],"sources":["../src/presentation/http/CodemationServerGatewayFactory.ts","../src/presentation/server/AppConfigLoader.ts","../src/presentation/server/CodemationPluginDiscovery.ts"],"sourcesContent":["import { accessSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { QueryBus } from \"../../application/bus/QueryBus\";\nimport type { WorkflowDto, WorkflowSummary } from \"../../application/contracts/WorkflowViewContracts\";\nimport { WorkflowDefinitionMapper } from \"../../application/mapping/WorkflowDefinitionMapper\";\nimport { GetWorkflowDetailQuery } from \"../../application/queries/GetWorkflowDetailQuery\";\nimport { GetWorkflowSummariesQuery } from \"../../application/queries/GetWorkflowSummariesQuery\";\nimport { ApplicationTokens } from \"../../applicationTokens\";\nimport { AppContainerFactory } from \"../../bootstrap/AppContainerFactory\";\nimport { AppContainerLifecycle } from \"../../bootstrap/AppContainerLifecycle\";\nimport { FrontendRuntime } from \"../../bootstrap/runtime/FrontendRuntime\";\nimport { AppConfigFactory } from \"../../bootstrap/runtime/AppConfigFactory\";\nimport type { CodemationConfig } from \"../config/CodemationConfig\";\nimport { CodemationConfigNormalizer } from \"../config/CodemationConfigNormalizer\";\nimport { CodemationHonoApiApp } from \"./hono/CodemationHonoApiAppFactory\";\n\ntype ServerGatewayContext = Readonly<{\n container: import(\"@codemation/core\").Container;\n httpApi: CodemationHonoApiApp;\n queryBus: QueryBus;\n workflowDefinitionMapper: WorkflowDefinitionMapper;\n}>;\n\nexport class CodemationServerGateway {\n private static readonly contextsByConfig = new WeakMap<object, Promise<ServerGatewayContext>>();\n\n constructor(\n private readonly config: CodemationConfig,\n private readonly consumerRoot: string,\n private readonly configSource?: string,\n private readonly workflowSources: ReadonlyArray<string> = [],\n private readonly env?: Readonly<NodeJS.ProcessEnv>,\n ) {}\n\n async dispatch(request: Request): Promise<Response> {\n return await (await this.getContext()).httpApi.fetch(request);\n }\n\n async prepare(): Promise<void> {\n await this.getContext();\n }\n\n async close(): Promise<void> {\n const cachedContext = CodemationServerGateway.contextsByConfig.get(this.config as object);\n if (!cachedContext) {\n return;\n }\n CodemationServerGateway.contextsByConfig.delete(this.config as object);\n await (await cachedContext).container.resolve(AppContainerLifecycle).stop();\n }\n\n async loadWorkflowSummaries(): Promise<ReadonlyArray<WorkflowSummary>> {\n const context = await this.getContext();\n const workflows = await context.queryBus.execute(new GetWorkflowSummariesQuery());\n return workflows.map((workflow) => context.workflowDefinitionMapper.toSummary(workflow));\n }\n\n async loadWorkflowDetail(workflowId: string): Promise<WorkflowDto> {\n const context = await this.getContext();\n const workflow = await context.queryBus.execute(new GetWorkflowDetailQuery(workflowId));\n if (!workflow) {\n throw new Error(`Unknown workflowId: ${workflowId}`);\n }\n return await context.workflowDefinitionMapper.map(workflow);\n }\n\n private getContext(): Promise<ServerGatewayContext> {\n const cachedContext = CodemationServerGateway.contextsByConfig.get(this.config as object);\n if (cachedContext) {\n return cachedContext;\n }\n const nextContext = this.createContext();\n CodemationServerGateway.contextsByConfig.set(this.config as object, nextContext);\n return nextContext;\n }\n\n private async createContext(): Promise<ServerGatewayContext> {\n const repoRoot = this.detectWorkspaceRoot(this.consumerRoot);\n // This gateway is the config/env boundary that materializes AppConfig from raw inputs.\n // eslint-disable-next-line no-restricted-properties\n const env = this.env ?? process.env;\n const appConfig = new AppConfigFactory().create({\n repoRoot,\n consumerRoot: this.consumerRoot,\n env,\n config: new CodemationConfigNormalizer().normalize(this.config),\n workflowSources: this.resolveWorkflowSources(),\n });\n const container = await new AppContainerFactory().create({\n appConfig,\n sharedWorkflowWebsocketServer: null,\n });\n await container.resolve(FrontendRuntime).start();\n return {\n container,\n httpApi: container.resolve(CodemationHonoApiApp),\n queryBus: container.resolve(ApplicationTokens.QueryBus),\n workflowDefinitionMapper: container.resolve(WorkflowDefinitionMapper),\n };\n }\n\n private resolveWorkflowSources(): ReadonlyArray<string> {\n if (this.workflowSources.length > 0) {\n return [...this.workflowSources];\n }\n if (!this.configSource || !this.config.workflows || this.config.workflows.length === 0) {\n return [];\n }\n return [this.configSource];\n }\n private detectWorkspaceRoot(startDirectory: string): string {\n let currentDirectory = path.resolve(startDirectory);\n while (true) {\n try {\n accessSync(path.resolve(currentDirectory, \"pnpm-workspace.yaml\"));\n return currentDirectory;\n } catch {\n const parentDirectory = path.dirname(currentDirectory);\n if (parentDirectory === currentDirectory) {\n return startDirectory;\n }\n currentDirectory = parentDirectory;\n }\n }\n }\n}\n","import type { AppConfig } from \"../config/AppConfig\";\nimport { CodemationConsumerConfigLoader } from \"./CodemationConsumerConfigLoader\";\nimport { AppConfigFactory } from \"../../bootstrap/runtime/AppConfigFactory\";\n\nexport type AppConfigLoadResult = Readonly<{\n appConfig: AppConfig;\n bootstrapSource: string | null;\n}>;\n\nexport class AppConfigLoader {\n constructor(\n private readonly consumerConfigLoader: CodemationConsumerConfigLoader = new CodemationConsumerConfigLoader(),\n private readonly appConfigFactory: AppConfigFactory = new AppConfigFactory(),\n ) {}\n\n async load(\n args: Readonly<{\n consumerRoot: string;\n repoRoot: string;\n env: NodeJS.ProcessEnv;\n configPathOverride?: string;\n }>,\n ): Promise<AppConfigLoadResult> {\n const resolution = await this.consumerConfigLoader.load({\n consumerRoot: args.consumerRoot,\n configPathOverride: args.configPathOverride,\n });\n return {\n appConfig: this.appConfigFactory.create({\n repoRoot: args.repoRoot,\n consumerRoot: args.consumerRoot,\n env: args.env,\n config: resolution.config,\n workflowSources: resolution.workflowSources,\n }),\n bootstrapSource: resolution.bootstrapSource,\n };\n }\n}\n","import type { CodemationPackageManifest } from \"../config/CodemationPackageManifest\";\nimport { CodemationPluginPackageMetadata, type CodemationPlugin } from \"../config/CodemationPlugin\";\nimport { readFile, readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nexport type CodemationDiscoveredPluginPackage = Readonly<{\n packageName: string;\n packageRoot: string;\n pluginEntry: string;\n developmentEntry?: string;\n}>;\n\nexport type CodemationResolvedPluginPackage = Readonly<\n CodemationDiscoveredPluginPackage & {\n plugin: CodemationPlugin;\n }\n>;\n\ntype PackageJsonShape = Readonly<{\n codemation?: CodemationPackageManifest;\n name?: string;\n exports?: Readonly<Record<string, unknown>>;\n}>;\n\nexport class CodemationPluginDiscovery {\n private readonly pluginPackageMetadata = new CodemationPluginPackageMetadata();\n\n async discover(consumerRoot: string): Promise<ReadonlyArray<CodemationDiscoveredPluginPackage>> {\n const nodeModulesRoot = path.resolve(consumerRoot, \"node_modules\");\n const packageRoots = await this.collectPackageRoots(nodeModulesRoot);\n const discoveredPackages: CodemationDiscoveredPluginPackage[] = [];\n for (const packageRoot of packageRoots) {\n const packageJson = await this.readPackageJson(path.resolve(packageRoot, \"package.json\"));\n const pluginManifest = packageJson.codemation?.plugin;\n if (!packageJson.name || typeof pluginManifest !== \"string\" || pluginManifest.trim().length === 0) {\n continue;\n }\n discoveredPackages.push({\n packageName: packageJson.name,\n packageRoot,\n pluginEntry: pluginManifest,\n developmentEntry: await this.resolveDevelopmentPluginEntry(packageRoot),\n });\n }\n return discoveredPackages.sort((left, right) => left.packageName.localeCompare(right.packageName));\n }\n\n async resolvePlugins(consumerRoot: string): Promise<ReadonlyArray<CodemationResolvedPluginPackage>> {\n const discoveredPackages = await this.discover(consumerRoot);\n return await this.resolveDiscoveredPackages(discoveredPackages);\n }\n\n async resolveDiscoveredPackages(\n discoveredPackages: ReadonlyArray<CodemationDiscoveredPluginPackage>,\n ): Promise<ReadonlyArray<CodemationResolvedPluginPackage>> {\n const resolvedPackages: CodemationResolvedPluginPackage[] = [];\n for (const discoveredPackage of discoveredPackages) {\n resolvedPackages.push({\n ...discoveredPackage,\n plugin: await this.loadPlugin(discoveredPackage),\n });\n }\n return resolvedPackages;\n }\n\n private async collectPackageRoots(nodeModulesRoot: string): Promise<ReadonlyArray<string>> {\n try {\n const entries = await readdir(nodeModulesRoot, { withFileTypes: true });\n const packageRoots: string[] = [];\n for (const entry of entries) {\n if (!entry.isDirectory() && !entry.isSymbolicLink()) {\n continue;\n }\n if (entry.name.startsWith(\"@\")) {\n const scopedEntries = await readdir(path.resolve(nodeModulesRoot, entry.name), { withFileTypes: true });\n for (const scopedEntry of scopedEntries) {\n if (scopedEntry.isDirectory() || scopedEntry.isSymbolicLink()) {\n packageRoots.push(path.resolve(nodeModulesRoot, entry.name, scopedEntry.name));\n }\n }\n continue;\n }\n packageRoots.push(path.resolve(nodeModulesRoot, entry.name));\n }\n return packageRoots;\n } catch {\n return [];\n }\n }\n\n private async readPackageJson(packageJsonPath: string): Promise<PackageJsonShape> {\n try {\n const rawPackageJson = await readFile(packageJsonPath, \"utf8\");\n return JSON.parse(rawPackageJson) as PackageJsonShape;\n } catch {\n return {};\n }\n }\n\n private async loadPlugin(discoveredPackage: CodemationDiscoveredPluginPackage): Promise<CodemationPlugin> {\n const pluginModulePath = path.resolve(discoveredPackage.packageRoot, this.resolvePluginEntry(discoveredPackage));\n const importedModule = (await import(\n /* webpackIgnore: true */ this.resolvePluginModuleSpecifier(pluginModulePath)\n )) as Record<string, unknown>;\n const exportedValue = importedModule.default;\n const plugin = this.resolvePluginValue(exportedValue);\n if (!plugin) {\n throw new Error(`Plugin package \"${discoveredPackage.packageName}\" did not default-export a Codemation plugin.`);\n }\n return this.pluginPackageMetadata.attachPackageName(plugin, discoveredPackage.packageName);\n }\n\n private resolvePluginValue(value: unknown): CodemationPlugin | null {\n if (this.isPluginConfig(value)) {\n return value;\n }\n return null;\n }\n\n private isPluginConfig(value: unknown): value is CodemationPlugin {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return false;\n }\n const pluginValue = value as {\n credentialTypes?: unknown;\n register?: unknown;\n sandbox?: unknown;\n };\n if (pluginValue.register !== undefined && typeof pluginValue.register !== \"function\") {\n return false;\n }\n if (pluginValue.credentialTypes !== undefined && !Array.isArray(pluginValue.credentialTypes)) {\n return false;\n }\n return (\n pluginValue.register !== undefined ||\n pluginValue.credentialTypes !== undefined ||\n pluginValue.sandbox !== undefined ||\n Object.keys(pluginValue).length === 0\n );\n }\n\n private resolvePluginEntry(discoveredPackage: CodemationDiscoveredPluginPackage): string {\n const preferSource =\n process.env.CODEMATION_PREFER_PLUGIN_SOURCE_ENTRY === \"true\" &&\n typeof discoveredPackage.developmentEntry === \"string\" &&\n discoveredPackage.developmentEntry.trim().length > 0;\n const selectedEntry = preferSource ? discoveredPackage.developmentEntry : discoveredPackage.pluginEntry;\n return selectedEntry;\n }\n\n private async resolveDevelopmentPluginEntry(packageRoot: string): Promise<string | undefined> {\n const candidates = [\n path.resolve(packageRoot, \"codemation.plugin.ts\"),\n path.resolve(packageRoot, \"codemation.plugin.js\"),\n path.resolve(packageRoot, \"src\", \"codemation.plugin.ts\"),\n path.resolve(packageRoot, \"src\", \"codemation.plugin.js\"),\n ];\n for (const candidate of candidates) {\n if (await this.exists(candidate)) {\n return path.relative(packageRoot, candidate);\n }\n }\n return undefined;\n }\n\n private async exists(filePath: string): Promise<boolean> {\n try {\n await readFile(filePath, \"utf8\");\n return true;\n } catch {\n return false;\n }\n }\n\n private resolvePluginModuleSpecifier(pluginModulePath: string): string {\n return pathToFileURL(pluginModulePath).href;\n }\n}\n"],"mappings":";;;;;;;;;;AAuBA,IAAa,0BAAb,MAAa,wBAAwB;CACnC,OAAwB,mCAAmB,IAAI,SAAgD;CAE/F,YACE,AAAiBA,QACjB,AAAiBC,cACjB,AAAiBC,cACjB,AAAiBC,kBAAyC,EAAE,EAC5D,AAAiBC,KACjB;EALiB;EACA;EACA;EACA;EACA;;CAGnB,MAAM,SAAS,SAAqC;AAClD,SAAO,OAAO,MAAM,KAAK,YAAY,EAAE,QAAQ,MAAM,QAAQ;;CAG/D,MAAM,UAAyB;AAC7B,QAAM,KAAK,YAAY;;CAGzB,MAAM,QAAuB;EAC3B,MAAM,gBAAgB,wBAAwB,iBAAiB,IAAI,KAAK,OAAiB;AACzF,MAAI,CAAC,cACH;AAEF,0BAAwB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AAuB;GACzD;AACD,OAAK,MAAM,aAAa,WACtB,KAAI,MAAM,KAAK,OAAO,UAAU,CAC9B,QAAO,KAAK,SAAS,aAAa,UAAU;;CAMlD,MAAc,OAAO,UAAoC;AACvD,MAAI;AACF,SAAM,SAAS,UAAU,OAAO;AAChC,UAAO;UACD;AACN,UAAO;;;CAIX,AAAQ,6BAA6B,kBAAkC;AACrE,SAAO,cAAc,iBAAiB,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import "./CodemationAppContext-
|
|
1
|
+
import "./index-BxIc_L4D.js";
|
|
2
|
+
import "./CodemationAppContext-YgJRUHWF.js";
|
|
3
3
|
import "./CodemationWhitelabelConfig-D5rYcLlj.js";
|
|
4
4
|
import { n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-ci0Vwxrb.js";
|
|
5
5
|
import { i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-Ja0GQgpp.js";
|
|
6
|
-
import "./CodemationConfigNormalizer-
|
|
7
|
-
import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-
|
|
8
|
-
import { r as PrismaDatabaseClient } from "./AppConfigFactory-
|
|
9
|
-
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-
|
|
10
|
-
import { a as CodemationResolvedPluginPackage, c as CodemationServerGateway, i as CodemationPluginDiscovery, l as ApiPaths, n as WorkflowModulePathFinder, o as AppConfigLoadResult, r as CodemationDiscoveredPluginPackage, s as AppConfigLoader, t as WorkflowDiscoveryPathSegmentsComputer } from "./server-
|
|
11
|
-
import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-
|
|
6
|
+
import "./CodemationConfigNormalizer-BWBp7mFB.js";
|
|
7
|
+
import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-Bka3v6lh.js";
|
|
8
|
+
import { r as PrismaDatabaseClient } from "./AppConfigFactory-D3k-R3Ch.js";
|
|
9
|
+
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-BLG7_6B5.js";
|
|
10
|
+
import { a as CodemationResolvedPluginPackage, c as CodemationServerGateway, i as CodemationPluginDiscovery, l as ApiPaths, n as WorkflowModulePathFinder, o as AppConfigLoadResult, r as CodemationDiscoveredPluginPackage, s as AppConfigLoader, t as WorkflowDiscoveryPathSegmentsComputer } from "./server-B0SD6Nvk.js";
|
|
11
|
+
import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-DkQoSYDo.js";
|
|
12
12
|
export { ApiPaths, AppConfigLoadResult, AppConfigLoader, CodemationConsumerApp, CodemationConsumerAppResolver, CodemationConsumerConfigLoader, CodemationConsumerConfigResolution, CodemationDiscoveredPluginPackage, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, CodemationPluginDiscovery, CodemationPostgresPrismaClientFactory, CodemationResolvedPluginPackage, CodemationServerGateway, FrontendAppConfig, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, InternalAuthBootstrap, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, PrismaDatabaseClient as PrismaClient, PublicFrontendBootstrap, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, WorkflowDiscoveryPathSegmentsComputer, WorkflowModulePathFinder };
|
package/dist/server.js
CHANGED
|
@@ -5,9 +5,9 @@ import "./ServerLoggerFactory-CsNW5qhz.js";
|
|
|
5
5
|
import "./decorateParam-D7WPDFAf.js";
|
|
6
6
|
import "./decorate-Dq0XLibd.js";
|
|
7
7
|
import "./CredentialServices-BNBMFOPt.js";
|
|
8
|
-
import { _ as FrontendAppConfigFactory, b as ApiPaths, g as InternalAuthBootstrapFactory, h as PublicFrontendBootstrapFactory, v as CodemationFrontendAuthSnapshotFactory } from "./AppContainerFactory-
|
|
9
|
-
import "./AppConfigFactory-
|
|
10
|
-
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-
|
|
11
|
-
import { n as AppConfigLoader, r as CodemationServerGateway, t as CodemationPluginDiscovery } from "./server-
|
|
8
|
+
import { _ as FrontendAppConfigFactory, b as ApiPaths, g as InternalAuthBootstrapFactory, h as PublicFrontendBootstrapFactory, v as CodemationFrontendAuthSnapshotFactory } from "./AppContainerFactory-CKRDz8kQ.js";
|
|
9
|
+
import "./AppConfigFactory-C4OXGOs2.js";
|
|
10
|
+
import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-KyHL0u01.js";
|
|
11
|
+
import { n as AppConfigLoader, r as CodemationServerGateway, t as CodemationPluginDiscovery } from "./server-CMUVhYIc.js";
|
|
12
12
|
|
|
13
13
|
export { ApiPaths, AppConfigLoader, CodemationConsumerAppResolver, CodemationConsumerConfigLoader, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, CodemationPluginDiscovery, CodemationPostgresPrismaClientFactory, CodemationServerGateway, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, WorkflowDiscoveryPathSegmentsComputer, WorkflowModulePathFinder };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemation/host",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -121,9 +121,9 @@
|
|
|
121
121
|
"tsx": "^4.21.0",
|
|
122
122
|
"ws": "^8.19.0",
|
|
123
123
|
"zxcvbn": "^4.4.2",
|
|
124
|
-
"@codemation/core
|
|
125
|
-
"@codemation/eventbus-redis": "0.0.
|
|
126
|
-
"@codemation/core": "1.0.
|
|
124
|
+
"@codemation/core": "1.0.1",
|
|
125
|
+
"@codemation/eventbus-redis": "0.0.33",
|
|
126
|
+
"@codemation/core-nodes": "1.0.2"
|
|
127
127
|
},
|
|
128
128
|
"devDependencies": {
|
|
129
129
|
"@playwright/test": "^1.58.2",
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
"typescript": "^5.9.3",
|
|
150
150
|
"vitest": "^4.0.18",
|
|
151
151
|
"zod": "^4.3.6",
|
|
152
|
-
"@codemation/core-nodes-gmail": "0.1.
|
|
152
|
+
"@codemation/core-nodes-gmail": "0.1.7"
|
|
153
153
|
},
|
|
154
154
|
"scripts": {
|
|
155
155
|
"changeset:verify": "pnpm --workspace-root run changeset:verify",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- Add per-item iteration identity columns to telemetry tables.
|
|
2
|
+
-- See docs in @codemation/host telemetry attribute names: codemation.iteration.id,
|
|
3
|
+
-- codemation.iteration.index, codemation.parent.invocation_id.
|
|
4
|
+
|
|
5
|
+
ALTER TABLE "TelemetrySpan"
|
|
6
|
+
ADD COLUMN "iteration_id" TEXT,
|
|
7
|
+
ADD COLUMN "item_index" INTEGER,
|
|
8
|
+
ADD COLUMN "parent_invocation_id" TEXT;
|
|
9
|
+
|
|
10
|
+
CREATE INDEX "TelemetrySpan_iteration_id_idx" ON "TelemetrySpan"("iteration_id");
|
|
11
|
+
|
|
12
|
+
ALTER TABLE "TelemetryMetricPoint"
|
|
13
|
+
ADD COLUMN "iteration_id" TEXT,
|
|
14
|
+
ADD COLUMN "item_index" INTEGER,
|
|
15
|
+
ADD COLUMN "parent_invocation_id" TEXT;
|
|
16
|
+
|
|
17
|
+
CREATE INDEX "TelemetryMetricPoint_iteration_id_idx" ON "TelemetryMetricPoint"("iteration_id");
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- Add per-item iteration identity columns to ExecutionInstance (Postgres).
|
|
2
|
+
-- These are required so connection invocations restored from disk preserve the
|
|
3
|
+
-- per-item identity that the engine stamps on them at runtime; the bottom
|
|
4
|
+
-- execution tree groups invocations by iterationId to render synthetic
|
|
5
|
+
-- "Item N" parent rows when an agent processed 2+ items.
|
|
6
|
+
ALTER TABLE "ExecutionInstance"
|
|
7
|
+
ADD COLUMN "iteration_id" TEXT,
|
|
8
|
+
ADD COLUMN "item_index" INTEGER,
|
|
9
|
+
ADD COLUMN "parent_invocation_id" TEXT;
|
|
10
|
+
|
|
11
|
+
CREATE INDEX "ExecutionInstance_iteration_id_idx" ON "ExecutionInstance"("iteration_id");
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- Add per-item iteration identity columns to telemetry tables (SQLite).
|
|
2
|
+
-- See @codemation/host telemetry attribute names: codemation.iteration.id,
|
|
3
|
+
-- codemation.iteration.index, codemation.parent.invocation_id.
|
|
4
|
+
ALTER TABLE "TelemetrySpan" ADD COLUMN "iteration_id" TEXT;
|
|
5
|
+
ALTER TABLE "TelemetrySpan" ADD COLUMN "item_index" INTEGER;
|
|
6
|
+
ALTER TABLE "TelemetrySpan" ADD COLUMN "parent_invocation_id" TEXT;
|
|
7
|
+
|
|
8
|
+
CREATE INDEX "TelemetrySpan_iteration_id_idx" ON "TelemetrySpan"("iteration_id");
|
|
9
|
+
|
|
10
|
+
ALTER TABLE "TelemetryMetricPoint" ADD COLUMN "iteration_id" TEXT;
|
|
11
|
+
ALTER TABLE "TelemetryMetricPoint" ADD COLUMN "item_index" INTEGER;
|
|
12
|
+
ALTER TABLE "TelemetryMetricPoint" ADD COLUMN "parent_invocation_id" TEXT;
|
|
13
|
+
|
|
14
|
+
CREATE INDEX "TelemetryMetricPoint_iteration_id_idx" ON "TelemetryMetricPoint"("iteration_id");
|
package/prisma/migrations.sqlite/20260430130000_execution_instance_iteration_identity/migration.sql
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
-- Add per-item iteration identity columns to ExecutionInstance (SQLite).
|
|
2
|
+
-- These are required so connection invocations restored from disk preserve the
|
|
3
|
+
-- per-item identity that the engine stamps on them at runtime; the bottom
|
|
4
|
+
-- execution tree groups invocations by iterationId to render synthetic
|
|
5
|
+
-- "Item N" parent rows when an agent processed 2+ items.
|
|
6
|
+
ALTER TABLE "ExecutionInstance" ADD COLUMN "iteration_id" TEXT;
|
|
7
|
+
ALTER TABLE "ExecutionInstance" ADD COLUMN "item_index" INTEGER;
|
|
8
|
+
ALTER TABLE "ExecutionInstance" ADD COLUMN "parent_invocation_id" TEXT;
|
|
9
|
+
|
|
10
|
+
CREATE INDEX "ExecutionInstance_iteration_id_idx" ON "ExecutionInstance"("iteration_id");
|
|
@@ -95,12 +95,16 @@ model ExecutionInstance {
|
|
|
95
95
|
inputTruncated Boolean? @map("input_truncated")
|
|
96
96
|
outputTruncated Boolean? @map("output_truncated")
|
|
97
97
|
usedPinnedOutput Boolean? @map("used_pinned_output")
|
|
98
|
+
iterationId String? @map("iteration_id")
|
|
99
|
+
itemIndex Int? @map("item_index")
|
|
100
|
+
parentInvocationId String? @map("parent_invocation_id")
|
|
98
101
|
|
|
99
102
|
run Run @relation(fields: [runId], references: [runId], onDelete: Cascade)
|
|
100
103
|
|
|
101
104
|
@@index([runId, slotNodeId, updatedAt])
|
|
102
105
|
@@index([runId, parentInstanceId, updatedAt])
|
|
103
106
|
@@index([runId, kind, updatedAt])
|
|
107
|
+
@@index([iterationId])
|
|
104
108
|
@@unique([runId, slotNodeId, runIndex])
|
|
105
109
|
}
|
|
106
110
|
|
|
@@ -173,6 +177,9 @@ model TelemetrySpan {
|
|
|
173
177
|
attributesJson String? @map("attributes_json")
|
|
174
178
|
eventsJson String? @map("events_json")
|
|
175
179
|
retentionExpiresAt String? @map("retention_expires_at")
|
|
180
|
+
iterationId String? @map("iteration_id")
|
|
181
|
+
itemIndex Int? @map("item_index")
|
|
182
|
+
parentInvocationId String? @map("parent_invocation_id")
|
|
176
183
|
updatedAt String @map("updated_at")
|
|
177
184
|
|
|
178
185
|
@@unique([traceId, spanId])
|
|
@@ -182,6 +189,7 @@ model TelemetrySpan {
|
|
|
182
189
|
@@index([runId, endTime])
|
|
183
190
|
@@index([modelName, endTime])
|
|
184
191
|
@@index([connectionInvocationId])
|
|
192
|
+
@@index([iterationId])
|
|
185
193
|
@@index([retentionExpiresAt])
|
|
186
194
|
}
|
|
187
195
|
|
|
@@ -229,12 +237,16 @@ model TelemetryMetricPoint {
|
|
|
229
237
|
modelName String? @map("model_name")
|
|
230
238
|
dimensionsJson String? @map("dimensions_json")
|
|
231
239
|
retentionExpiresAt String? @map("retention_expires_at")
|
|
240
|
+
iterationId String? @map("iteration_id")
|
|
241
|
+
itemIndex Int? @map("item_index")
|
|
242
|
+
parentInvocationId String? @map("parent_invocation_id")
|
|
232
243
|
|
|
233
244
|
@@index([workflowId, observedAt])
|
|
234
245
|
@@index([workflowId, metricName, observedAt])
|
|
235
246
|
@@index([runId, observedAt])
|
|
236
247
|
@@index([traceId, observedAt])
|
|
237
248
|
@@index([modelName, observedAt])
|
|
249
|
+
@@index([iterationId])
|
|
238
250
|
@@index([retentionExpiresAt])
|
|
239
251
|
}
|
|
240
252
|
|
|
@@ -96,12 +96,16 @@ model ExecutionInstance {
|
|
|
96
96
|
inputTruncated Boolean? @map("input_truncated")
|
|
97
97
|
outputTruncated Boolean? @map("output_truncated")
|
|
98
98
|
usedPinnedOutput Boolean? @map("used_pinned_output")
|
|
99
|
+
iterationId String? @map("iteration_id")
|
|
100
|
+
itemIndex Int? @map("item_index")
|
|
101
|
+
parentInvocationId String? @map("parent_invocation_id")
|
|
99
102
|
|
|
100
103
|
run Run @relation(fields: [runId], references: [runId], onDelete: Cascade)
|
|
101
104
|
|
|
102
105
|
@@index([runId, slotNodeId, updatedAt])
|
|
103
106
|
@@index([runId, parentInstanceId, updatedAt])
|
|
104
107
|
@@index([runId, kind, updatedAt])
|
|
108
|
+
@@index([iterationId])
|
|
105
109
|
@@unique([runId, slotNodeId, runIndex])
|
|
106
110
|
}
|
|
107
111
|
|
|
@@ -174,6 +178,9 @@ model TelemetrySpan {
|
|
|
174
178
|
attributesJson String? @map("attributes_json")
|
|
175
179
|
eventsJson String? @map("events_json")
|
|
176
180
|
retentionExpiresAt String? @map("retention_expires_at")
|
|
181
|
+
iterationId String? @map("iteration_id")
|
|
182
|
+
itemIndex Int? @map("item_index")
|
|
183
|
+
parentInvocationId String? @map("parent_invocation_id")
|
|
177
184
|
updatedAt String @map("updated_at")
|
|
178
185
|
|
|
179
186
|
@@unique([traceId, spanId])
|
|
@@ -183,6 +190,7 @@ model TelemetrySpan {
|
|
|
183
190
|
@@index([runId, endTime])
|
|
184
191
|
@@index([modelName, endTime])
|
|
185
192
|
@@index([connectionInvocationId])
|
|
193
|
+
@@index([iterationId])
|
|
186
194
|
@@index([retentionExpiresAt])
|
|
187
195
|
}
|
|
188
196
|
|
|
@@ -230,12 +238,16 @@ model TelemetryMetricPoint {
|
|
|
230
238
|
modelName String? @map("model_name")
|
|
231
239
|
dimensionsJson String? @map("dimensions_json")
|
|
232
240
|
retentionExpiresAt String? @map("retention_expires_at")
|
|
241
|
+
iterationId String? @map("iteration_id")
|
|
242
|
+
itemIndex Int? @map("item_index")
|
|
243
|
+
parentInvocationId String? @map("parent_invocation_id")
|
|
233
244
|
|
|
234
245
|
@@index([workflowId, observedAt])
|
|
235
246
|
@@index([workflowId, metricName, observedAt])
|
|
236
247
|
@@index([runId, observedAt])
|
|
237
248
|
@@index([traceId, observedAt])
|
|
238
249
|
@@index([modelName, observedAt])
|
|
250
|
+
@@index([iterationId])
|
|
239
251
|
@@index([retentionExpiresAt])
|
|
240
252
|
}
|
|
241
253
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-iteration cost rollup, derived from `codemation.cost.estimated` metric points
|
|
3
|
+
* grouped by `iterationId` and currency.
|
|
4
|
+
*/
|
|
5
|
+
export interface IterationCostRollupDto {
|
|
6
|
+
readonly iterationId: string;
|
|
7
|
+
/** Sum of cost in minor units (per `cost.currency_scale`) keyed by ISO currency code. */
|
|
8
|
+
readonly estimatedCostMinorByCurrency: Readonly<Record<string, number>>;
|
|
9
|
+
/** Currency scale (denominator) per currency, when present on the metric points. */
|
|
10
|
+
readonly estimatedCostCurrencyScaleByCurrency: Readonly<Record<string, number>>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Query } from "../bus/Query";
|
|
2
|
+
import type { IterationCostRollupDto } from "../contracts/IterationCostContracts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Query that returns a per-iteration cost rollup for a single run.
|
|
6
|
+
*
|
|
7
|
+
* The rollup is keyed by `iterationId` and contains the sum of
|
|
8
|
+
* `codemation.cost.estimated` metric points grouped by ISO currency code.
|
|
9
|
+
*/
|
|
10
|
+
export class GetIterationCostQuery extends Query<ReadonlyArray<IterationCostRollupDto>> {
|
|
11
|
+
constructor(public readonly runId: string) {
|
|
12
|
+
super();
|
|
13
|
+
}
|
|
14
|
+
}
|