@codemation/host 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/{AppConfigFactory-Co4STjwt.d.ts → AppConfigFactory-CaeFn4e9.d.ts} +3 -3
  3. package/dist/{AppContainerFactory-z9aUDFiJ.js → AppContainerFactory-iVVEyHli.js} +10 -49
  4. package/dist/AppContainerFactory-iVVEyHli.js.map +1 -0
  5. package/dist/{CodemationConfig-COs4GcOE.d.ts → CodemationConfig--9jFRY-f.d.ts} +2 -2
  6. package/dist/{CodemationConfigNormalizer-B7w1JA_2.d.ts → CodemationConfigNormalizer-GV9M0JnA.d.ts} +2 -2
  7. package/dist/{CodemationConsumerConfigLoader-OlXKw-us.d.ts → CodemationConsumerConfigLoader-CMUTDn8g.d.ts} +2 -2
  8. package/dist/{CodemationPluginListMerger-_ZIiOQxB.d.ts → CodemationPluginListMerger-HKzQ5LMM.d.ts} +5 -5
  9. package/dist/{CredentialServices-D3VTczpC.d.ts → CredentialServices-5WS6gdqW.d.ts} +3 -3
  10. package/dist/{PublicFrontendBootstrapFactory-CE4oGogq.d.ts → PublicFrontendBootstrapFactory-DIbPtB7-.d.ts} +2 -2
  11. package/dist/consumer.d.ts +4 -4
  12. package/dist/credentials.d.ts +3 -3
  13. package/dist/devServerSidecar.d.ts +1 -1
  14. package/dist/{index-DbYzycTC.d.ts → index-BYbzmUwS.d.ts} +10 -1
  15. package/dist/index.d.ts +10 -10
  16. package/dist/index.js +2 -2
  17. package/dist/nextServer.d.ts +7 -7
  18. package/dist/nextServer.js +1 -1
  19. package/dist/{persistenceServer-Cr-zCuEr.d.ts → persistenceServer-D3dthjEX.d.ts} +2 -2
  20. package/dist/persistenceServer.d.ts +5 -5
  21. package/dist/{server-B6k53aZj.d.ts → server-Cm3qiXA1.d.ts} +5 -5
  22. package/dist/{server-DDVXr7BN.js → server-CvlA-UY1.js} +2 -2
  23. package/dist/{server-DDVXr7BN.js.map → server-CvlA-UY1.js.map} +1 -1
  24. package/dist/server.d.ts +8 -8
  25. package/dist/server.js +2 -2
  26. package/package.json +5 -5
  27. package/src/application/commands/ReplayWorkflowNodeCommandHandler.ts +4 -37
  28. package/src/application/commands/StartWorkflowRunCommandHandler.ts +5 -62
  29. package/dist/AppContainerFactory-z9aUDFiJ.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { a as CodemationWhitelabelConfig, o as CodemationLogConfig, t as CodemationAuthConfig, u as LoggerFactory } from "./CodemationAuthConfig-Bh2cCNCI.js";
2
- import { B as TypeToken, N as WorkflowDefinition, V as EngineExecutionLimitsPolicyConfig, s as AnyCredentialType, z as Container } from "./index-DbYzycTC.js";
2
+ import { B as TypeToken, N as WorkflowDefinition, V as EngineExecutionLimitsPolicyConfig, s as AnyCredentialType, z as Container } from "./index-BYbzmUwS.js";
3
3
 
4
4
  //#region src/presentation/config/CodemationClassToken.d.ts
5
5
  type CodemationClassToken<TValue> = TypeToken<TValue> & (new (...args: never[]) => TValue);
@@ -177,4 +177,4 @@ interface CodemationConfig {
177
177
  }
178
178
  //#endregion
179
179
  export { CodemationContainerRegistration as C, CodemationPluginPackageMetadata as S, AppPersistenceConfig as _, CodemationConfig as a, CodemationPluginConfig as b, CodemationEngineExecutionLimitsConfig as c, CodemationSchedulerConfig as d, CodemationSchedulerKind as f, AppConfig as g, CodemationRegistrationContextBase as h, CodemationApplicationRuntimeConfig as i, CodemationEventBusConfig as l, CodemationAppContext as m, CodemationAppSchedulerConfig as n, CodemationDatabaseConfig as o, CodemationWorkflowDiscovery as p, CodemationAppSchedulerKind as r, CodemationDatabaseKind as s, CodemationAppDefinition as t, CodemationEventBusKind as u, AppPluginLoadSummary as v, CodemationClassToken as w, CodemationPluginContext as x, CodemationPlugin as y };
180
- //# sourceMappingURL=CodemationConfig-COs4GcOE.d.ts.map
180
+ //# sourceMappingURL=CodemationConfig--9jFRY-f.d.ts.map
@@ -1,4 +1,4 @@
1
- import { C as CodemationContainerRegistration, a as CodemationConfig } from "./CodemationConfig-COs4GcOE.js";
1
+ import { C as CodemationContainerRegistration, a as CodemationConfig } from "./CodemationConfig--9jFRY-f.js";
2
2
 
3
3
  //#region src/presentation/config/CodemationConfigNormalizer.d.ts
4
4
  type NormalizedCodemationConfig = CodemationConfig & Readonly<{
@@ -6,4 +6,4 @@ type NormalizedCodemationConfig = CodemationConfig & Readonly<{
6
6
  }>;
7
7
  //#endregion
8
8
  export { NormalizedCodemationConfig as t };
9
- //# sourceMappingURL=CodemationConfigNormalizer-B7w1JA_2.d.ts.map
9
+ //# sourceMappingURL=CodemationConfigNormalizer-GV9M0JnA.d.ts.map
@@ -1,4 +1,4 @@
1
- import { t as NormalizedCodemationConfig } from "./CodemationConfigNormalizer-B7w1JA_2.js";
1
+ import { t as NormalizedCodemationConfig } from "./CodemationConfigNormalizer-GV9M0JnA.js";
2
2
 
3
3
  //#region src/presentation/server/CodemationConsumerAppResolver.d.ts
4
4
  type CodemationConsumerApp = Readonly<{
@@ -62,4 +62,4 @@ declare class CodemationConsumerConfigLoader {
62
62
  }
63
63
  //#endregion
64
64
  export { CodemationConsumerAppResolver as i, CodemationConsumerConfigResolution as n, CodemationConsumerApp as r, CodemationConsumerConfigLoader as t };
65
- //# sourceMappingURL=CodemationConsumerConfigLoader-OlXKw-us.d.ts.map
65
+ //# sourceMappingURL=CodemationConsumerConfigLoader-CMUTDn8g.d.ts.map
@@ -1,8 +1,8 @@
1
1
  import { a as CodemationWhitelabelConfig, l as Logger, t as CodemationAuthConfig, u as LoggerFactory } from "./CodemationAuthConfig-Bh2cCNCI.js";
2
- import { B as TypeToken, H as RunEvent, I as NodeExecutionRequestHandler, J as PersistedRunState, K as WorkflowActivationPolicy, L as NodeExecutionScheduler, N as WorkflowDefinition, P as WorkflowId, R as WorkflowRepository, U as RunEventBus, X as RunSummary, Y as RunCurrentState, Z as Clock, k as RunId, n as Engine, s as AnyCredentialType, z as Container } from "./index-DbYzycTC.js";
3
- import { C as CodemationContainerRegistration, S as CodemationPluginPackageMetadata, g as AppConfig, y as CodemationPlugin } from "./CodemationConfig-COs4GcOE.js";
4
- import { t as CredentialStore } from "./CredentialServices-D3VTczpC.js";
5
- import { n as PrismaMigrationDeployer, r as PrismaClient } from "./AppConfigFactory-Co4STjwt.js";
2
+ import { B as TypeToken, H as RunEvent, I as NodeExecutionRequestHandler, J as PersistedRunState, K as WorkflowActivationPolicy, L as NodeExecutionScheduler, N as WorkflowDefinition, P as WorkflowId, R as WorkflowRepository, U as RunEventBus, X as RunSummary, Y as RunCurrentState, Z as Clock, k as RunId, n as Engine, s as AnyCredentialType, z as Container } from "./index-BYbzmUwS.js";
3
+ import { C as CodemationContainerRegistration, S as CodemationPluginPackageMetadata, g as AppConfig, y as CodemationPlugin } from "./CodemationConfig--9jFRY-f.js";
4
+ import { t as CredentialStore } from "./CredentialServices-5WS6gdqW.js";
5
+ import { n as PrismaMigrationDeployer, r as PrismaClient } from "./AppConfigFactory-CaeFn4e9.js";
6
6
  import "reflect-metadata";
7
7
  import { Hono } from "hono";
8
8
  import { PGlite } from "@electric-sql/pglite";
@@ -350,4 +350,4 @@ declare class CodemationPluginListMerger {
350
350
  }
351
351
  //#endregion
352
352
  export { Command as _, WorkflowDebuggerOverlayRepository as a, WorkerRuntime as c, AppContainerLifecycle as d, AppContainerFactory as f, CommandBus as g, Query as h, HonoApiRouteRegistrar as i, FrontendRuntime as l, QueryBus as m, CodemationBootstrapRequest as n, WorkflowRunRepository as o, WorkflowWebsocketServer as p, ApplicationTokens as r, SessionVerifier as s, CodemationPluginListMerger as t, DatabaseMigrations as u };
353
- //# sourceMappingURL=CodemationPluginListMerger-_ZIiOQxB.d.ts.map
353
+ //# sourceMappingURL=CodemationPluginListMerger-HKzQ5LMM.d.ts.map
@@ -1,5 +1,5 @@
1
- import { C as CredentialTypeId, N as WorkflowDefinition, R as WorkflowRepository, S as CredentialTypeDefinition, _ as CredentialRequirement, b as CredentialSetupStatus, c as CredentialBinding, d as CredentialHealth, f as CredentialInstanceId, h as CredentialMaterialSourceKind, l as CredentialBindingKey, m as CredentialJsonRecord, p as CredentialInstanceRecord, s as AnyCredentialType, u as CredentialFieldSchema, w as CredentialTypeRegistry, x as CredentialType, y as CredentialSessionService } from "./index-DbYzycTC.js";
2
- import { g as AppConfig } from "./CodemationConfig-COs4GcOE.js";
1
+ import { C as CredentialTypeId, N as WorkflowDefinition, R as WorkflowRepository, S as CredentialTypeDefinition, _ as CredentialRequirement, b as CredentialSetupStatus, c as CredentialBinding, d as CredentialHealth, f as CredentialInstanceId, h as CredentialMaterialSourceKind, l as CredentialBindingKey, m as CredentialJsonRecord, p as CredentialInstanceRecord, s as AnyCredentialType, u as CredentialFieldSchema, w as CredentialTypeRegistry, x as CredentialType, y as CredentialSessionService } from "./index-BYbzmUwS.js";
2
+ import { g as AppConfig } from "./CodemationConfig--9jFRY-f.js";
3
3
 
4
4
  //#region src/domain/credentials/CredentialTypeRegistryImpl.d.ts
5
5
  declare class CredentialTypeRegistryImpl implements CredentialTypeRegistry {
@@ -288,4 +288,4 @@ type MutableCredentialSessionService = CredentialSessionService & Readonly<{
288
288
  }>;
289
289
  //#endregion
290
290
  export { CredentialInstanceService as a, CredentialFieldEnvOverlayService as c, CredentialBindingService as i, CredentialTypeRegistryImpl as l, CredentialType$1 as n, CredentialMaterialResolver as o, CredentialRuntimeMaterialService as r, CredentialSecretCipher as s, CredentialStore as t };
291
- //# sourceMappingURL=CredentialServices-D3VTczpC.d.ts.map
291
+ //# sourceMappingURL=CredentialServices-5WS6gdqW.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { t as CodemationAuthConfig } from "./CodemationAuthConfig-Bh2cCNCI.js";
2
2
  import { a as CodemationFrontendAuthSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-p7mS8aWG.js";
3
- import { g as AppConfig } from "./CodemationConfig-COs4GcOE.js";
3
+ import { g as AppConfig } from "./CodemationConfig--9jFRY-f.js";
4
4
 
5
5
  //#region src/application/contracts/WorkflowViewContracts.d.ts
6
6
  type WorkflowNodeDto = Readonly<{
@@ -86,4 +86,4 @@ declare class PublicFrontendBootstrapFactory {
86
86
  }
87
87
  //#endregion
88
88
  export { WorkflowDto as a, CodemationFrontendAuthSnapshotFactory as i, InternalAuthBootstrapFactory as n, WorkflowSummary as o, FrontendAppConfigFactory as r, PublicFrontendBootstrapFactory as t };
89
- //# sourceMappingURL=PublicFrontendBootstrapFactory-CE4oGogq.d.ts.map
89
+ //# sourceMappingURL=PublicFrontendBootstrapFactory-DIbPtB7-.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import "./CodemationAuthConfig-Bh2cCNCI.js";
2
- import "./index-DbYzycTC.js";
3
- import "./CodemationConfig-COs4GcOE.js";
4
- import "./CodemationConfigNormalizer-B7w1JA_2.js";
5
- import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-OlXKw-us.js";
2
+ import "./index-BYbzmUwS.js";
3
+ import "./CodemationConfig--9jFRY-f.js";
4
+ import "./CodemationConfigNormalizer-GV9M0JnA.js";
5
+ import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-CMUTDn8g.js";
6
6
  export { type CodemationConsumerApp, CodemationConsumerAppResolver, CodemationConsumerConfigLoader, type CodemationConsumerConfigResolution };
@@ -1,7 +1,7 @@
1
1
  import "./CodemationAuthConfig-Bh2cCNCI.js";
2
- import { d as CredentialHealth, s as AnyCredentialType, v as CredentialSessionFactoryArgs } from "./index-DbYzycTC.js";
3
- import "./CodemationConfig-COs4GcOE.js";
4
- import { a as CredentialInstanceService, i as CredentialBindingService, n as CredentialType } from "./CredentialServices-D3VTczpC.js";
2
+ import { d as CredentialHealth, s as AnyCredentialType, v as CredentialSessionFactoryArgs } from "./index-BYbzmUwS.js";
3
+ import "./CodemationConfig--9jFRY-f.js";
4
+ import { a as CredentialInstanceService, i as CredentialBindingService, n as CredentialType } from "./CredentialServices-5WS6gdqW.js";
5
5
 
6
6
  //#region src/infrastructure/credentials/OpenAiApiKeyCredentialShapes.types.d.ts
7
7
  /**
@@ -1,4 +1,4 @@
1
- import { N as WorkflowDefinition, z as Container } from "./index-DbYzycTC.js";
1
+ import { N as WorkflowDefinition, z as Container } from "./index-BYbzmUwS.js";
2
2
 
3
3
  //#region src/presentation/server/CodemationTsyringeParamInfoReader.d.ts
4
4
  declare class CodemationTsyringeParamInfoReader {
@@ -1137,6 +1137,7 @@ type StartWorkflowIntent = {
1137
1137
  workflow: WorkflowDefinition;
1138
1138
  startAt?: string;
1139
1139
  items: Items;
1140
+ synthesizeTriggerItems?: boolean;
1140
1141
  parent?: CurrentStateExecutionRequest["parent"];
1141
1142
  executionOptions?: RunExecutionOptions;
1142
1143
  workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
@@ -1150,6 +1151,7 @@ type RerunFromNodeIntent = {
1150
1151
  nodeId: NodeId;
1151
1152
  currentState: RunCurrentState;
1152
1153
  items?: Items;
1154
+ synthesizeTriggerItems?: boolean;
1153
1155
  parent?: CurrentStateExecutionRequest["parent"];
1154
1156
  executionOptions?: RunExecutionOptions;
1155
1157
  workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
@@ -1170,6 +1172,13 @@ declare class RunIntentService {
1170
1172
  constructor(engine: Engine, workflowRepository: WorkflowRepository);
1171
1173
  startWorkflow(args: StartWorkflowIntent): Promise<RunResult>;
1172
1174
  rerunFromNode(args: RerunFromNodeIntent): Promise<RunResult>;
1175
+ private resolveStartWorkflowItems;
1176
+ private resolveRerunItems;
1177
+ private resolveStartWorkflowTriggerNodeId;
1178
+ private resolveRerunTriggerNodeId;
1179
+ private firstTriggerNodeId;
1180
+ private isTriggerNode;
1181
+ private hasNonEmptyItems;
1173
1182
  resolveWebhookTrigger(args: {
1174
1183
  endpointPath: string;
1175
1184
  method: HttpMethod;
@@ -1184,4 +1193,4 @@ declare class RunIntentService {
1184
1193
  }
1185
1194
  //#endregion
1186
1195
  export { RunIdFactory as A, TypeToken as B, CredentialTypeId as C, Item as D, BinaryAttachment as E, BinaryStorage as F, AnyRunnableNodeConfig as G, RunEvent as H, NodeExecutionRequestHandler as I, PersistedRunState as J, WorkflowActivationPolicy as K, NodeExecutionScheduler as L, RunnableNodeOutputJson as M, WorkflowDefinition as N, NodeDefinition as O, WorkflowId as P, WorkflowRepository as R, CredentialTypeDefinition as S, ActivationIdFactory as T, RunEventBus as U, EngineExecutionLimitsPolicyConfig as V, ChainCursor as W, RunSummary as X, RunCurrentState as Y, Clock as Z, CredentialRequirement as _, ToolConfig as a, CredentialSetupStatus as b, CredentialBinding as c, CredentialHealth as d, CredentialInstanceId as f, CredentialOAuth2AuthDefinition as g, CredentialMaterialSourceKind as h, ChatModelConfig as i, RunnableNodeConfig as j, RunId as k, CredentialBindingKey as l, CredentialJsonRecord as m, Engine as n, DefinedNode as o, CredentialInstanceRecord as p, WebhookInvocationMatch as q, AgentGuardrailConfig as r, AnyCredentialType as s, RunIntentService as t, CredentialFieldSchema as u, CredentialSessionFactoryArgs as v, CredentialTypeRegistry as w, CredentialType as x, CredentialSessionService as y, Container as z };
1187
- //# sourceMappingURL=index-DbYzycTC.d.ts.map
1196
+ //# sourceMappingURL=index-BYbzmUwS.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  import { a as CodemationWhitelabelConfig, c as CodemationLogRule, i as CodemationAuthOidcProviderConfig, n as CodemationAuthKind, o as CodemationLogConfig, r as CodemationAuthOAuthProviderConfig, s as CodemationLogLevelName, t as CodemationAuthConfig } from "./CodemationAuthConfig-Bh2cCNCI.js";
2
2
  import { a as CodemationFrontendAuthSnapshot, i as CodemationFrontendAuthProviderSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-p7mS8aWG.js";
3
3
  import { i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-DjkkKXcq.js";
4
- import { G as AnyRunnableNodeConfig, M as RunnableNodeOutputJson, N as WorkflowDefinition, W as ChainCursor, a as ToolConfig, i as ChatModelConfig, j as RunnableNodeConfig, o as DefinedNode, r as AgentGuardrailConfig, s as AnyCredentialType } from "./index-DbYzycTC.js";
5
- import { S as CodemationPluginPackageMetadata, a as CodemationConfig, b as CodemationPluginConfig, c as CodemationEngineExecutionLimitsConfig, d as CodemationSchedulerConfig, f as CodemationSchedulerKind, g as AppConfig, h as CodemationRegistrationContextBase, i as CodemationApplicationRuntimeConfig, l as CodemationEventBusConfig, m as CodemationAppContext, n as CodemationAppSchedulerConfig, o as CodemationDatabaseConfig, p as CodemationWorkflowDiscovery, r as CodemationAppSchedulerKind, s as CodemationDatabaseKind, t as CodemationAppDefinition, u as CodemationEventBusKind, v as AppPluginLoadSummary, w as CodemationClassToken, x as CodemationPluginContext, y as CodemationPlugin } from "./CodemationConfig-COs4GcOE.js";
6
- import "./CodemationConfigNormalizer-B7w1JA_2.js";
7
- import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-OlXKw-us.js";
8
- import "./CredentialServices-D3VTczpC.js";
9
- import { _ as Command, c as WorkerRuntime, d as AppContainerLifecycle, f as AppContainerFactory, g as CommandBus, h as Query, l as FrontendRuntime, m as QueryBus, n as CodemationBootstrapRequest, r as ApplicationTokens, t as CodemationPluginListMerger, u as DatabaseMigrations } from "./CodemationPluginListMerger-_ZIiOQxB.js";
10
- import { r as PrismaClient, t as AppConfigFactory } from "./AppConfigFactory-Co4STjwt.js";
11
- import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-Cr-zCuEr.js";
12
- import { c as CodemationServerGateway, l as ApiPaths } from "./server-B6k53aZj.js";
13
- import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-CE4oGogq.js";
4
+ import { G as AnyRunnableNodeConfig, M as RunnableNodeOutputJson, N as WorkflowDefinition, W as ChainCursor, a as ToolConfig, i as ChatModelConfig, j as RunnableNodeConfig, o as DefinedNode, r as AgentGuardrailConfig, s as AnyCredentialType } from "./index-BYbzmUwS.js";
5
+ import { S as CodemationPluginPackageMetadata, a as CodemationConfig, b as CodemationPluginConfig, c as CodemationEngineExecutionLimitsConfig, d as CodemationSchedulerConfig, f as CodemationSchedulerKind, g as AppConfig, h as CodemationRegistrationContextBase, i as CodemationApplicationRuntimeConfig, l as CodemationEventBusConfig, m as CodemationAppContext, n as CodemationAppSchedulerConfig, o as CodemationDatabaseConfig, p as CodemationWorkflowDiscovery, r as CodemationAppSchedulerKind, s as CodemationDatabaseKind, t as CodemationAppDefinition, u as CodemationEventBusKind, v as AppPluginLoadSummary, w as CodemationClassToken, x as CodemationPluginContext, y as CodemationPlugin } from "./CodemationConfig--9jFRY-f.js";
6
+ import "./CodemationConfigNormalizer-GV9M0JnA.js";
7
+ import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-CMUTDn8g.js";
8
+ import "./CredentialServices-5WS6gdqW.js";
9
+ import { _ as Command, c as WorkerRuntime, d as AppContainerLifecycle, f as AppContainerFactory, g as CommandBus, h as Query, l as FrontendRuntime, m as QueryBus, n as CodemationBootstrapRequest, r as ApplicationTokens, t as CodemationPluginListMerger, u as DatabaseMigrations } from "./CodemationPluginListMerger-HKzQ5LMM.js";
10
+ import { r as PrismaClient, t as AppConfigFactory } from "./AppConfigFactory-CaeFn4e9.js";
11
+ import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-D3dthjEX.js";
12
+ import { c as CodemationServerGateway, l as ApiPaths } from "./server-Cm3qiXA1.js";
13
+ import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-DIbPtB7-.js";
14
14
  import { z } from "zod";
15
15
 
16
16
  //#region src/application/contracts/userDirectoryContracts.types.d.ts
package/dist/index.js CHANGED
@@ -5,11 +5,11 @@ import "./ServerLoggerFactory-BltIIDfQ.js";
5
5
  import "./decorateParam-DrsXNPuw.js";
6
6
  import "./decorate-B0PP651O.js";
7
7
  import { u as ApplicationTokens } from "./CredentialServices-DNb3CZwW.js";
8
- import { E as ListUserAccountsQuery, T as UpsertLocalBootstrapUserCommand, _ as CodemationFrontendAuthSnapshotFactory, a as AppContainerLifecycle, g as FrontendAppConfigFactory, h as InternalAuthBootstrapFactory, i as DatabaseMigrations, m as PublicFrontendBootstrapFactory, n as WorkerRuntime, r as FrontendRuntime, t as AppContainerFactory, y as ApiPaths } from "./AppContainerFactory-z9aUDFiJ.js";
8
+ import { E as ListUserAccountsQuery, T as UpsertLocalBootstrapUserCommand, _ as CodemationFrontendAuthSnapshotFactory, a as AppContainerLifecycle, g as FrontendAppConfigFactory, h as InternalAuthBootstrapFactory, i as DatabaseMigrations, m as PublicFrontendBootstrapFactory, n as WorkerRuntime, r as FrontendRuntime, t as AppContainerFactory, y as ApiPaths } from "./AppContainerFactory-iVVEyHli.js";
9
9
  import { n as CodemationPluginPackageMetadata, t as AppConfigFactory } from "./AppConfigFactory-DxoZ4v8r.js";
10
10
  import { n as CodemationBootstrapRequest, t as CodemationPluginListMerger } from "./CodemationPluginListMerger-CGwOTdZ7.js";
11
11
  import { n as CodemationPostgresPrismaClientFactory, t as import_client } from "./persistenceServer-C4L1uMKn.js";
12
- import { r as CodemationServerGateway } from "./server-DDVXr7BN.js";
12
+ import { r as CodemationServerGateway } from "./server-CvlA-UY1.js";
13
13
  import { workflow } from "@codemation/core-nodes";
14
14
 
15
15
  //#region src/presentation/config/CodemationAuthoring.types.ts
@@ -1,13 +1,13 @@
1
1
  import { l as Logger, u as LoggerFactory } from "./CodemationAuthConfig-Bh2cCNCI.js";
2
2
  import { t as LogLevelPolicy } from "./LogLevelPolicy-BS_NlAOg.js";
3
3
  import { a as CodemationFrontendAuthSnapshot, i as CodemationFrontendAuthProviderSnapshot, n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-p7mS8aWG.js";
4
- import { A as RunIdFactory, D as Item, E as BinaryAttachment, F as BinaryStorage, K as WorkflowActivationPolicy, N as WorkflowDefinition, O as NodeDefinition, S as CredentialTypeDefinition, T as ActivationIdFactory, Z as Clock, g as CredentialOAuth2AuthDefinition, q as WebhookInvocationMatch, t as RunIntentService } from "./index-DbYzycTC.js";
5
- import { g as AppConfig } from "./CodemationConfig-COs4GcOE.js";
6
- import "./CodemationConfigNormalizer-B7w1JA_2.js";
7
- import { a as CredentialInstanceService, c as CredentialFieldEnvOverlayService, i as CredentialBindingService, l as CredentialTypeRegistryImpl, o as CredentialMaterialResolver, r as CredentialRuntimeMaterialService, s as CredentialSecretCipher, t as CredentialStore } from "./CredentialServices-D3VTczpC.js";
8
- import { a as WorkflowDebuggerOverlayRepository, c as WorkerRuntime, d as AppContainerLifecycle, f as AppContainerFactory, g as CommandBus, i as HonoApiRouteRegistrar, l as FrontendRuntime, m as QueryBus, n as CodemationBootstrapRequest, o as WorkflowRunRepository, p as WorkflowWebsocketServer, r as ApplicationTokens, s as SessionVerifier, t as CodemationPluginListMerger, u as DatabaseMigrations } from "./CodemationPluginListMerger-_ZIiOQxB.js";
9
- import { t as AppConfigFactory } from "./AppConfigFactory-Co4STjwt.js";
10
- import { a as WorkflowDto, n as InternalAuthBootstrapFactory, o as WorkflowSummary, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-CE4oGogq.js";
4
+ import { A as RunIdFactory, D as Item, E as BinaryAttachment, F as BinaryStorage, K as WorkflowActivationPolicy, N as WorkflowDefinition, O as NodeDefinition, S as CredentialTypeDefinition, T as ActivationIdFactory, Z as Clock, g as CredentialOAuth2AuthDefinition, q as WebhookInvocationMatch, t as RunIntentService } from "./index-BYbzmUwS.js";
5
+ import { g as AppConfig } from "./CodemationConfig--9jFRY-f.js";
6
+ import "./CodemationConfigNormalizer-GV9M0JnA.js";
7
+ import { a as CredentialInstanceService, c as CredentialFieldEnvOverlayService, i as CredentialBindingService, l as CredentialTypeRegistryImpl, o as CredentialMaterialResolver, r as CredentialRuntimeMaterialService, s as CredentialSecretCipher, t as CredentialStore } from "./CredentialServices-5WS6gdqW.js";
8
+ import { a as WorkflowDebuggerOverlayRepository, c as WorkerRuntime, d as AppContainerLifecycle, f as AppContainerFactory, g as CommandBus, i as HonoApiRouteRegistrar, l as FrontendRuntime, m as QueryBus, n as CodemationBootstrapRequest, o as WorkflowRunRepository, p as WorkflowWebsocketServer, r as ApplicationTokens, s as SessionVerifier, t as CodemationPluginListMerger, u as DatabaseMigrations } from "./CodemationPluginListMerger-HKzQ5LMM.js";
9
+ import { t as AppConfigFactory } from "./AppConfigFactory-CaeFn4e9.js";
10
+ import { a as WorkflowDto, n as InternalAuthBootstrapFactory, o as WorkflowSummary, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-DIbPtB7-.js";
11
11
  import { Hono } from "hono";
12
12
 
13
13
  //#region src/application/dev/DevBootstrapSummaryJson.types.d.ts
@@ -3,7 +3,7 @@ import { a as FilteringLogger, i as PerformanceLogPolicy, n as PerformanceLogPol
3
3
  import { n as __decorateMetadata, t as __decorateParam } from "./decorateParam-DrsXNPuw.js";
4
4
  import { t as __decorate } from "./decorate-B0PP651O.js";
5
5
  import { a as CredentialInstanceService, i as CredentialBindingService, u as ApplicationTokens } from "./CredentialServices-DNb3CZwW.js";
6
- import { a as AppContainerLifecycle, b as WorkflowDefinitionMapper, c as RequestToWebhookItemMapper, d as CredentialHttpRouteHandler, f as CodemationHonoApiApp, g as FrontendAppConfigFactory, h as InternalAuthBootstrapFactory, i as DatabaseMigrations, l as RunHttpRouteHandler, m as PublicFrontendBootstrapFactory, n as WorkerRuntime, o as WorkflowHttpRouteHandler, p as BinaryHttpRouteHandler, r as FrontendRuntime, s as WebhookHttpRouteHandler, t as AppContainerFactory, u as OAuth2HttpRouteHandler, v as WorkflowWebsocketServer, w as RunBinaryAttachmentLookupService, x as WorkflowPolicyUiPresentationFactory } from "./AppContainerFactory-z9aUDFiJ.js";
6
+ import { a as AppContainerLifecycle, b as WorkflowDefinitionMapper, c as RequestToWebhookItemMapper, d as CredentialHttpRouteHandler, f as CodemationHonoApiApp, g as FrontendAppConfigFactory, h as InternalAuthBootstrapFactory, i as DatabaseMigrations, l as RunHttpRouteHandler, m as PublicFrontendBootstrapFactory, n as WorkerRuntime, o as WorkflowHttpRouteHandler, p as BinaryHttpRouteHandler, r as FrontendRuntime, s as WebhookHttpRouteHandler, t as AppContainerFactory, u as OAuth2HttpRouteHandler, v as WorkflowWebsocketServer, w as RunBinaryAttachmentLookupService, x as WorkflowPolicyUiPresentationFactory } from "./AppContainerFactory-iVVEyHli.js";
7
7
  import { t as AppConfigFactory } from "./AppConfigFactory-DxoZ4v8r.js";
8
8
  import { n as CodemationBootstrapRequest, t as CodemationPluginListMerger } from "./CodemationPluginListMerger-CGwOTdZ7.js";
9
9
  import { CoreTokens, RunFinishedAtFactory, inject, injectable } from "@codemation/core";
@@ -1,4 +1,4 @@
1
- import { r as PrismaClient } from "./AppConfigFactory-Co4STjwt.js";
1
+ import { r as PrismaClient } from "./AppConfigFactory-CaeFn4e9.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-Cr-zCuEr.d.ts.map
9
+ //# sourceMappingURL=persistenceServer-D3dthjEX.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import "./CodemationAuthConfig-Bh2cCNCI.js";
2
- import "./index-DbYzycTC.js";
3
- import { _ as AppPersistenceConfig } from "./CodemationConfig-COs4GcOE.js";
4
- import "./CodemationConfigNormalizer-B7w1JA_2.js";
5
- import { n as PrismaMigrationDeployer, r as PrismaClient, t as AppConfigFactory } from "./AppConfigFactory-Co4STjwt.js";
6
- import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-Cr-zCuEr.js";
2
+ import "./index-BYbzmUwS.js";
3
+ import { _ as AppPersistenceConfig } from "./CodemationConfig--9jFRY-f.js";
4
+ import "./CodemationConfigNormalizer-GV9M0JnA.js";
5
+ import { n as PrismaMigrationDeployer, r as PrismaClient, t as AppConfigFactory } from "./AppConfigFactory-CaeFn4e9.js";
6
+ import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-D3dthjEX.js";
7
7
  export { AppConfigFactory, AppPersistenceConfig, CodemationPostgresPrismaClientFactory, PrismaClient, PrismaMigrationDeployer };
@@ -1,7 +1,7 @@
1
- import { a as CodemationConfig, g as AppConfig, y as CodemationPlugin } from "./CodemationConfig-COs4GcOE.js";
2
- import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-OlXKw-us.js";
3
- import { t as AppConfigFactory } from "./AppConfigFactory-Co4STjwt.js";
4
- import { a as WorkflowDto, o as WorkflowSummary } from "./PublicFrontendBootstrapFactory-CE4oGogq.js";
1
+ import { a as CodemationConfig, g as AppConfig, y as CodemationPlugin } from "./CodemationConfig--9jFRY-f.js";
2
+ import { t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-CMUTDn8g.js";
3
+ import { t as AppConfigFactory } from "./AppConfigFactory-CaeFn4e9.js";
4
+ import { a as WorkflowDto, o as WorkflowSummary } from "./PublicFrontendBootstrapFactory-DIbPtB7-.js";
5
5
 
6
6
  //#region src/presentation/http/ApiPaths.d.ts
7
7
  declare class ApiPaths {
@@ -143,4 +143,4 @@ declare class WorkflowDiscoveryPathSegmentsComputer {
143
143
  }
144
144
  //#endregion
145
145
  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 };
146
- //# sourceMappingURL=server-B6k53aZj.d.ts.map
146
+ //# sourceMappingURL=server-Cm3qiXA1.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { a as CodemationConfigNormalizer, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-C_ISRrpI.js";
2
2
  import { u as ApplicationTokens } from "./CredentialServices-DNb3CZwW.js";
3
- import { C as GetWorkflowDetailQuery, S as GetWorkflowSummariesQuery, a as AppContainerLifecycle, b as WorkflowDefinitionMapper, f as CodemationHonoApiApp, r as FrontendRuntime, t as AppContainerFactory } from "./AppContainerFactory-z9aUDFiJ.js";
3
+ import { C as GetWorkflowDetailQuery, S as GetWorkflowSummariesQuery, a as AppContainerLifecycle, b as WorkflowDefinitionMapper, f as CodemationHonoApiApp, r as FrontendRuntime, t as AppContainerFactory } from "./AppContainerFactory-iVVEyHli.js";
4
4
  import { n as CodemationPluginPackageMetadata, t as AppConfigFactory } from "./AppConfigFactory-DxoZ4v8r.js";
5
5
  import { readFile, readdir } from "node:fs/promises";
6
6
  import path from "node:path";
@@ -219,4 +219,4 @@ var CodemationPluginDiscovery = class {
219
219
 
220
220
  //#endregion
221
221
  export { AppConfigLoader as n, CodemationServerGateway as r, CodemationPluginDiscovery as t };
222
- //# sourceMappingURL=server-DDVXr7BN.js.map
222
+ //# sourceMappingURL=server-CvlA-UY1.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-DDVXr7BN.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 if (\n process.env.CODEMATION_PREFER_PLUGIN_SOURCE_ENTRY === \"true\" &&\n typeof discoveredPackage.developmentEntry === \"string\" &&\n discoveredPackage.developmentEntry.trim().length > 0\n ) {\n return discoveredPackage.developmentEntry;\n }\n return discoveredPackage.pluginEntry;\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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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-CvlA-UY1.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 if (\n process.env.CODEMATION_PREFER_PLUGIN_SOURCE_ENTRY === \"true\" &&\n typeof discoveredPackage.developmentEntry === \"string\" &&\n discoveredPackage.developmentEntry.trim().length > 0\n ) {\n return discoveredPackage.developmentEntry;\n }\n return discoveredPackage.pluginEntry;\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,I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OAAO,KAAK,YAAY,CAAC,WAAW;;CAIxC,AAAQ,mBAAmB,mBAA8D;AACvF,MACE,QAAQ,IAAI,0CAA0C,UACtD,OAAO,kBAAkB,qBAAqB,YAC9C,kBAAkB,iBAAiB,MAAM,CAAC,SAAS,EAEnD,QAAO,kBAAkB;AAE3B,SAAO,kBAAkB;;CAG3B,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"}
package/dist/server.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import "./CodemationAuthConfig-Bh2cCNCI.js";
2
2
  import { n as InternalAuthBootstrap, r as FrontendAppConfig, t as PublicFrontendBootstrap } from "./PublicFrontendBootstrap-p7mS8aWG.js";
3
3
  import { i as CodemationFrontendAuthSnapshotJsonCodec, n as InternalAuthBootstrapJsonCodec, r as FrontendAppConfigJsonCodec, t as PublicFrontendBootstrapJsonCodec } from "./PublicFrontendBootstrapJsonCodec-DjkkKXcq.js";
4
- import "./index-DbYzycTC.js";
5
- import "./CodemationConfig-COs4GcOE.js";
6
- import "./CodemationConfigNormalizer-B7w1JA_2.js";
7
- import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-OlXKw-us.js";
8
- import { r as PrismaClient } from "./AppConfigFactory-Co4STjwt.js";
9
- import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-Cr-zCuEr.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-B6k53aZj.js";
11
- import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-CE4oGogq.js";
4
+ import "./index-BYbzmUwS.js";
5
+ import "./CodemationConfig--9jFRY-f.js";
6
+ import "./CodemationConfigNormalizer-GV9M0JnA.js";
7
+ import { i as CodemationConsumerAppResolver, n as CodemationConsumerConfigResolution, r as CodemationConsumerApp, t as CodemationConsumerConfigLoader } from "./CodemationConsumerConfigLoader-CMUTDn8g.js";
8
+ import { r as PrismaClient } from "./AppConfigFactory-CaeFn4e9.js";
9
+ import { t as CodemationPostgresPrismaClientFactory } from "./persistenceServer-D3dthjEX.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-Cm3qiXA1.js";
11
+ import { i as CodemationFrontendAuthSnapshotFactory, n as InternalAuthBootstrapFactory, r as FrontendAppConfigFactory, t as PublicFrontendBootstrapFactory } from "./PublicFrontendBootstrapFactory-DIbPtB7-.js";
12
12
  export { ApiPaths, AppConfigLoadResult, AppConfigLoader, CodemationConsumerApp, CodemationConsumerAppResolver, CodemationConsumerConfigLoader, CodemationConsumerConfigResolution, CodemationDiscoveredPluginPackage, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, CodemationPluginDiscovery, CodemationPostgresPrismaClientFactory, CodemationResolvedPluginPackage, CodemationServerGateway, FrontendAppConfig, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, InternalAuthBootstrap, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, PrismaClient, PublicFrontendBootstrap, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, WorkflowDiscoveryPathSegmentsComputer, WorkflowModulePathFinder };
package/dist/server.js CHANGED
@@ -5,10 +5,10 @@ import "./ServerLoggerFactory-BltIIDfQ.js";
5
5
  import "./decorateParam-DrsXNPuw.js";
6
6
  import "./decorate-B0PP651O.js";
7
7
  import "./CredentialServices-DNb3CZwW.js";
8
- import { _ as CodemationFrontendAuthSnapshotFactory, g as FrontendAppConfigFactory, h as InternalAuthBootstrapFactory, m as PublicFrontendBootstrapFactory, y as ApiPaths } from "./AppContainerFactory-z9aUDFiJ.js";
8
+ import { _ as CodemationFrontendAuthSnapshotFactory, g as FrontendAppConfigFactory, h as InternalAuthBootstrapFactory, m as PublicFrontendBootstrapFactory, y as ApiPaths } from "./AppContainerFactory-iVVEyHli.js";
9
9
  import "./AppConfigFactory-DxoZ4v8r.js";
10
10
  import { n as CodemationPostgresPrismaClientFactory, t as import_client } from "./persistenceServer-C4L1uMKn.js";
11
- import { n as AppConfigLoader, r as CodemationServerGateway, t as CodemationPluginDiscovery } from "./server-DDVXr7BN.js";
11
+ import { n as AppConfigLoader, r as CodemationServerGateway, t as CodemationPluginDiscovery } from "./server-CvlA-UY1.js";
12
12
 
13
13
  var PrismaClient = import_client.PrismaClient;
14
14
  export { ApiPaths, AppConfigLoader, CodemationConsumerAppResolver, CodemationConsumerConfigLoader, CodemationFrontendAuthSnapshotFactory, CodemationFrontendAuthSnapshotJsonCodec, CodemationPluginDiscovery, CodemationPostgresPrismaClientFactory, CodemationServerGateway, FrontendAppConfigFactory, FrontendAppConfigJsonCodec, InternalAuthBootstrapFactory, InternalAuthBootstrapJsonCodec, PrismaClient, PublicFrontendBootstrapFactory, PublicFrontendBootstrapJsonCodec, WorkflowDiscoveryPathSegmentsComputer, WorkflowModulePathFinder };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemation/host",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -110,9 +110,9 @@
110
110
  "tsx": "^4.21.0",
111
111
  "ws": "^8.19.0",
112
112
  "zxcvbn": "^4.4.2",
113
- "@codemation/core": "0.0.18",
114
- "@codemation/core-nodes": "0.0.18",
115
- "@codemation/eventbus-redis": "0.0.18"
113
+ "@codemation/core-nodes": "0.0.19",
114
+ "@codemation/core": "0.0.19",
115
+ "@codemation/eventbus-redis": "0.0.19"
116
116
  },
117
117
  "devDependencies": {
118
118
  "@playwright/test": "^1.58.2",
@@ -137,7 +137,7 @@
137
137
  "tsdown": "^0.15.5",
138
138
  "typescript": "^5.9.3",
139
139
  "vitest": "^4.0.18",
140
- "@codemation/core-nodes-gmail": "0.0.18"
140
+ "@codemation/core-nodes-gmail": "0.0.19"
141
141
  },
142
142
  "scripts": {
143
143
  "prisma:generate": "prisma generate && node ./scripts/ensure-prisma-runtime-sourcemaps.mjs",
@@ -43,12 +43,7 @@ export class ReplayWorkflowNodeCommandHandler extends CommandHandler<ReplayWorkf
43
43
  }
44
44
  const decodedNodeId = decodeURIComponent(command.nodeId);
45
45
  const mode = command.body.mode ?? state.executionOptions?.mode ?? "manual";
46
- const requestedItems = await this.resolveRequestedItems({
47
- workflow,
48
- nodeId: decodedNodeId,
49
- items: command.body.items,
50
- synthesizeTriggerItems: command.body.synthesizeTriggerItems,
51
- });
46
+ const requestedItems = this.resolveRequestedItems(command.body.items);
52
47
  const mutableStateBase = this.cloneMutableState(state.mutableState) ?? { nodesById: {} };
53
48
  const mutableState = requestedItems
54
49
  ? ({
@@ -73,6 +68,7 @@ export class ReplayWorkflowNodeCommandHandler extends CommandHandler<ReplayWorkf
73
68
  nodeId: decodedNodeId,
74
69
  currentState: this.cloneRunCurrentState(state, mutableState),
75
70
  items: requestedItems,
71
+ synthesizeTriggerItems: command.body.synthesizeTriggerItems,
76
72
  executionOptions,
77
73
  workflowSnapshot: this.cloneWorkflowSnapshot(state.workflowSnapshot),
78
74
  mutableState,
@@ -129,36 +125,7 @@ export class ReplayWorkflowNodeCommandHandler extends CommandHandler<ReplayWorkf
129
125
  };
130
126
  }
131
127
 
132
- private async resolveRequestedItems(
133
- args: Readonly<{
134
- workflow: WorkflowDefinition;
135
- nodeId: string;
136
- items: Items | undefined | null;
137
- synthesizeTriggerItems: boolean | undefined;
138
- }>,
139
- ): Promise<Items | undefined> {
140
- const normalizedItems = args.items == null ? undefined : this.itemsInputNormalizer.normalize(args.items);
141
- if (!this.shouldSynthesizeTriggerItems(args.workflow, args.nodeId, args.synthesizeTriggerItems, normalizedItems)) {
142
- return normalizedItems;
143
- }
144
- return await this.engine.createTriggerTestItems({
145
- workflow: args.workflow,
146
- nodeId: args.nodeId,
147
- });
148
- }
149
-
150
- private shouldSynthesizeTriggerItems(
151
- workflow: WorkflowDefinition,
152
- nodeId: string,
153
- synthesizeTriggerItems: boolean | undefined,
154
- normalizedItems: Items | undefined,
155
- ): boolean {
156
- if (synthesizeTriggerItems) {
157
- return true;
158
- }
159
- if (normalizedItems && normalizedItems.length > 0) {
160
- return false;
161
- }
162
- return workflow.nodes.find((node) => node.id === nodeId)?.kind === "trigger";
128
+ private resolveRequestedItems(items: Items | undefined | null): Items | undefined {
129
+ return items == null ? undefined : this.itemsInputNormalizer.normalize(items);
163
130
  }
164
131
  }