@powerlines/engine 0.49.27 → 0.49.28

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 (58) hide show
  1. package/dist/api/build.d.cts +1 -1
  2. package/dist/api/build.d.mts +1 -1
  3. package/dist/api/clean.d.cts +1 -1
  4. package/dist/api/clean.d.mts +1 -1
  5. package/dist/api/create.d.cts +1 -1
  6. package/dist/api/create.d.mts +1 -1
  7. package/dist/api/deploy.d.cts +1 -1
  8. package/dist/api/deploy.d.mts +1 -1
  9. package/dist/api/docs.d.cts +1 -1
  10. package/dist/api/docs.d.mts +1 -1
  11. package/dist/api/lint.d.cts +1 -1
  12. package/dist/api/lint.d.mts +1 -1
  13. package/dist/api/prepare.d.cts +1 -1
  14. package/dist/api/prepare.d.mts +1 -1
  15. package/dist/api/test.d.cts +1 -1
  16. package/dist/api/test.d.mts +1 -1
  17. package/dist/api/types.d.cts +1 -1
  18. package/dist/api/types.d.mts +1 -1
  19. package/dist/api.d.cts +1 -1
  20. package/dist/api.d.mts +1 -1
  21. package/dist/context/engine-context.cjs +6 -6
  22. package/dist/context/engine-context.d.cts +1 -1
  23. package/dist/context/engine-context.d.mts +1 -1
  24. package/dist/context/engine-context.mjs +7 -7
  25. package/dist/context/engine-context.mjs.map +1 -1
  26. package/dist/context/index.d.cts +1 -1
  27. package/dist/context/index.d.mts +1 -1
  28. package/dist/{context-CNYu12sa.d.mts → context-C71mv_aw.d.mts} +3 -3
  29. package/dist/{context-CJLRZKhl.d.cts.map → context-C71mv_aw.d.mts.map} +1 -1
  30. package/dist/{context-CJLRZKhl.d.cts → context-ZbJRDGpl.d.cts} +3 -3
  31. package/dist/{context-CNYu12sa.d.mts.map → context-ZbJRDGpl.d.cts.map} +1 -1
  32. package/dist/{engine-qMKcp-AX.d.cts → engine-B5pbfMyg.d.cts} +4 -4
  33. package/dist/{engine-BdhpduRS.d.mts.map → engine-B5pbfMyg.d.cts.map} +1 -1
  34. package/dist/{engine-BdhpduRS.d.mts → engine-CeWEM0TT.d.mts} +4 -4
  35. package/dist/{engine-qMKcp-AX.d.cts.map → engine-CeWEM0TT.d.mts.map} +1 -1
  36. package/dist/engine-DRAFIm5M.mjs.map +1 -1
  37. package/dist/{engine-context-EdV-sOjq.d.mts → engine-context-CaPJFek0.d.mts} +4 -4
  38. package/dist/{engine-context-BJiH5JZe.d.cts.map → engine-context-CaPJFek0.d.mts.map} +1 -1
  39. package/dist/{engine-context-BJiH5JZe.d.cts → engine-context-DDbpdZHC.d.cts} +4 -4
  40. package/dist/{engine-context-EdV-sOjq.d.mts.map → engine-context-DDbpdZHC.d.cts.map} +1 -1
  41. package/dist/engine.d.cts +1 -1
  42. package/dist/engine.d.mts +1 -1
  43. package/dist/helpers/create-api.cjs +2 -0
  44. package/dist/helpers/create-api.d.cts +1 -1
  45. package/dist/helpers/create-api.d.mts +1 -1
  46. package/dist/helpers/create-api.mjs +3 -1
  47. package/dist/helpers/create-api.mjs.map +1 -1
  48. package/dist/helpers/index.d.cts +1 -1
  49. package/dist/helpers/index.d.mts +1 -1
  50. package/dist/helpers/type-checks.d.cts +1 -1
  51. package/dist/helpers/type-checks.d.mts +1 -1
  52. package/dist/{index-BXQx2xGi.d.mts → index-CBobV6Wm.d.mts} +2 -2
  53. package/dist/{index-BXQx2xGi.d.mts.map → index-CBobV6Wm.d.mts.map} +1 -1
  54. package/dist/{index-Bwnu1gvX.d.cts → index-QuLZgb8w.d.cts} +2 -2
  55. package/dist/{index-Bwnu1gvX.d.cts.map → index-QuLZgb8w.d.cts.map} +1 -1
  56. package/dist/index.d.cts +4 -4
  57. package/dist/index.d.mts +4 -4
  58. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-B6udgcnD.cjs";
2
- import { r as EngineSystemContext } from "../context-CJLRZKhl.cjs";
2
+ import { r as EngineSystemContext } from "../context-ZbJRDGpl.cjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/build.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-DXxu0y4t.mjs";
2
- import { r as EngineSystemContext } from "../context-CNYu12sa.mjs";
2
+ import { r as EngineSystemContext } from "../context-C71mv_aw.mjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/build.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-B6udgcnD.cjs";
2
- import { r as EngineSystemContext } from "../context-CJLRZKhl.cjs";
2
+ import { r as EngineSystemContext } from "../context-ZbJRDGpl.cjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/clean.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-DXxu0y4t.mjs";
2
- import { r as EngineSystemContext } from "../context-CNYu12sa.mjs";
2
+ import { r as EngineSystemContext } from "../context-C71mv_aw.mjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/clean.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-B6udgcnD.cjs";
2
- import { r as EngineSystemContext } from "../context-CJLRZKhl.cjs";
2
+ import { r as EngineSystemContext } from "../context-ZbJRDGpl.cjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/create.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-DXxu0y4t.mjs";
2
- import { r as EngineSystemContext } from "../context-CNYu12sa.mjs";
2
+ import { r as EngineSystemContext } from "../context-C71mv_aw.mjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/create.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-B6udgcnD.cjs";
2
- import { r as EngineSystemContext } from "../context-CJLRZKhl.cjs";
2
+ import { r as EngineSystemContext } from "../context-ZbJRDGpl.cjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/deploy.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-DXxu0y4t.mjs";
2
- import { r as EngineSystemContext } from "../context-CNYu12sa.mjs";
2
+ import { r as EngineSystemContext } from "../context-C71mv_aw.mjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/deploy.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-B6udgcnD.cjs";
2
- import { r as EngineSystemContext } from "../context-CJLRZKhl.cjs";
2
+ import { r as EngineSystemContext } from "../context-ZbJRDGpl.cjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/docs.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-DXxu0y4t.mjs";
2
- import { r as EngineSystemContext } from "../context-CNYu12sa.mjs";
2
+ import { r as EngineSystemContext } from "../context-C71mv_aw.mjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/docs.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-B6udgcnD.cjs";
2
- import { r as EngineSystemContext } from "../context-CJLRZKhl.cjs";
2
+ import { r as EngineSystemContext } from "../context-ZbJRDGpl.cjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/lint.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-DXxu0y4t.mjs";
2
- import { r as EngineSystemContext } from "../context-CNYu12sa.mjs";
2
+ import { r as EngineSystemContext } from "../context-C71mv_aw.mjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/lint.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-B6udgcnD.cjs";
2
- import { r as EngineSystemContext } from "../context-CJLRZKhl.cjs";
2
+ import { r as EngineSystemContext } from "../context-ZbJRDGpl.cjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/prepare.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-DXxu0y4t.mjs";
2
- import { r as EngineSystemContext } from "../context-CNYu12sa.mjs";
2
+ import { r as EngineSystemContext } from "../context-C71mv_aw.mjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/prepare.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-B6udgcnD.cjs";
2
- import { r as EngineSystemContext } from "../context-CJLRZKhl.cjs";
2
+ import { r as EngineSystemContext } from "../context-ZbJRDGpl.cjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/test.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-DXxu0y4t.mjs";
2
- import { r as EngineSystemContext } from "../context-CNYu12sa.mjs";
2
+ import { r as EngineSystemContext } from "../context-C71mv_aw.mjs";
3
3
  import { ExecutionContext } from "@powerlines/core";
4
4
 
5
5
  //#region src/api/test.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-B6udgcnD.cjs";
2
- import { r as EngineSystemContext } from "../context-CJLRZKhl.cjs";
2
+ import { r as EngineSystemContext } from "../context-ZbJRDGpl.cjs";
3
3
  import { ExecutionContext } from "@powerlines/core/types/context";
4
4
 
5
5
  //#region src/api/types.d.ts
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig } from "../config-DXxu0y4t.mjs";
2
- import { r as EngineSystemContext } from "../context-CNYu12sa.mjs";
2
+ import { r as EngineSystemContext } from "../context-C71mv_aw.mjs";
3
3
  import { ExecutionContext } from "@powerlines/core/types/context";
4
4
 
5
5
  //#region src/api/types.d.ts
package/dist/api.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { r as ExecutionApiParams } from "./index-Bwnu1gvX.cjs";
1
+ import { r as ExecutionApiParams } from "./index-QuLZgb8w.cjs";
2
2
  import { ExecutionOptions } from "@powerlines/core";
3
3
 
4
4
  //#region src/api.d.ts
package/dist/api.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { r as ExecutionApiParams } from "./index-BXQx2xGi.mjs";
1
+ import { r as ExecutionApiParams } from "./index-CBobV6Wm.mjs";
2
2
  import { ExecutionOptions } from "@powerlines/core";
3
3
 
4
4
  //#region src/api.d.ts
@@ -120,23 +120,23 @@ var PowerlinesEngineContext = class PowerlinesEngineContext extends _powerlines_
120
120
  * @remarks
121
121
  * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
122
122
  *
123
- * @param method - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.
123
+ * @param command - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.
124
124
  * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.
125
125
  */
126
- async loadExecutions(method, inlineConfig) {
126
+ async loadExecutions(command, inlineConfig) {
127
127
  const root = (0, _powerlines_core_lib_config.resolveRoot)(this.cwd, inlineConfig.root, inlineConfig.configFile);
128
128
  const config = await (0, _powerlines_core_lib_config.loadParsedConfig)(this.cwd, root, this.framework?.name, this.orgId, inlineConfig);
129
129
  if (!config) throw new Error("Failed to load configuration");
130
130
  const invocationId = (0, _stryke_unique_id_uuid.uuid)();
131
131
  const executions = await Promise.all((0, _stryke_convert_to_array.toArray)(config.config).map(async (_, configIndex) => {
132
- const executionId = (0, _stryke_unique_id_uuid.uuid)();
132
+ const executionId = (0, _powerlines_core_plugin_utils.formatExecutionId)(config.config.name || inlineConfig.name || root, command, configIndex);
133
133
  const options = {
134
134
  cwd: this.cwd,
135
135
  root,
136
136
  framework: this.framework,
137
137
  orgId: this.orgId,
138
138
  ...this.options,
139
- command: method,
139
+ command,
140
140
  baseURL: this.#devtools.host.resolveOrigin(),
141
141
  connection: this.connection,
142
142
  configFile: config.configFile,
@@ -145,11 +145,11 @@ var PowerlinesEngineContext = class PowerlinesEngineContext extends _powerlines_
145
145
  };
146
146
  this.logger.debug({
147
147
  meta: { category: "config" },
148
- message: `Invoking ${method} with the following execution parameters: \n --- Options --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(options)}\n --- Inline Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(inlineConfig)}`
148
+ message: `Invoking ${command} with the following execution parameters: \n --- Options --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(options)}\n --- Inline Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(inlineConfig)}`
149
149
  });
150
150
  return {
151
151
  invocationId,
152
- method,
152
+ command,
153
153
  configFile: config,
154
154
  options,
155
155
  state: {
@@ -1,2 +1,2 @@
1
- import { t as PowerlinesEngineContext } from "../engine-context-BJiH5JZe.cjs";
1
+ import { t as PowerlinesEngineContext } from "../engine-context-DDbpdZHC.cjs";
2
2
  export { PowerlinesEngineContext };
@@ -1,2 +1,2 @@
1
- import { t as PowerlinesEngineContext } from "../engine-context-EdV-sOjq.mjs";
1
+ import { t as PowerlinesEngineContext } from "../engine-context-CaPJFek0.mjs";
2
2
  export { PowerlinesEngineContext };
@@ -1,4 +1,4 @@
1
- import { createLogger, formatConfig, resolveLogLevel, withCustomLogger } from "@powerlines/core/plugin-utils";
1
+ import { createLogger, formatConfig, formatExecutionId, resolveLogLevel, withCustomLogger } from "@powerlines/core/plugin-utils";
2
2
  import { toArray } from "@stryke/convert/to-array";
3
3
  import { uuid } from "@stryke/unique-id/uuid";
4
4
  import { createHostContext } from "devframe/node";
@@ -117,23 +117,23 @@ var PowerlinesEngineContext = class PowerlinesEngineContext extends PowerlinesBa
117
117
  * @remarks
118
118
  * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
119
119
  *
120
- * @param method - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.
120
+ * @param command - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.
121
121
  * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.
122
122
  */
123
- async loadExecutions(method, inlineConfig) {
123
+ async loadExecutions(command, inlineConfig) {
124
124
  const root = resolveRoot(this.cwd, inlineConfig.root, inlineConfig.configFile);
125
125
  const config = await loadParsedConfig(this.cwd, root, this.framework?.name, this.orgId, inlineConfig);
126
126
  if (!config) throw new Error("Failed to load configuration");
127
127
  const invocationId = uuid();
128
128
  const executions = await Promise.all(toArray(config.config).map(async (_, configIndex) => {
129
- const executionId = uuid();
129
+ const executionId = formatExecutionId(config.config.name || inlineConfig.name || root, command, configIndex);
130
130
  const options = {
131
131
  cwd: this.cwd,
132
132
  root,
133
133
  framework: this.framework,
134
134
  orgId: this.orgId,
135
135
  ...this.options,
136
- command: method,
136
+ command,
137
137
  baseURL: this.#devtools.host.resolveOrigin(),
138
138
  connection: this.connection,
139
139
  configFile: config.configFile,
@@ -142,11 +142,11 @@ var PowerlinesEngineContext = class PowerlinesEngineContext extends PowerlinesBa
142
142
  };
143
143
  this.logger.debug({
144
144
  meta: { category: "config" },
145
- message: `Invoking ${method} with the following execution parameters: \n --- Options --- \n${formatConfig(options)}\n --- Inline Config --- \n${formatConfig(inlineConfig)}`
145
+ message: `Invoking ${command} with the following execution parameters: \n --- Options --- \n${formatConfig(options)}\n --- Inline Config --- \n${formatConfig(inlineConfig)}`
146
146
  });
147
147
  return {
148
148
  invocationId,
149
- method,
149
+ command,
150
150
  configFile: config,
151
151
  options,
152
152
  state: {
@@ -1 +1 @@
1
- {"version":3,"file":"engine-context.mjs","names":["#devtools","#logLevel","#executions"],"sources":["../../src/context/engine-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n FrameworkOptions,\n InlineConfig,\n LogFn,\n LoggerOptions,\n LogLevelResolvedConfig\n} from \"@powerlines/core\";\nimport { PowerlinesBaseContext } from \"@powerlines/core/context/base-context\";\nimport {\n getDefaultLogLevel,\n loadParsedConfig,\n resolveRoot\n} from \"@powerlines/core/lib/config\";\nimport {\n createLogger,\n formatConfig,\n resolveLogLevel,\n withCustomLogger\n} from \"@powerlines/core/plugin-utils\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { createHostContext } from \"devframe/node\";\nimport {\n ConnectionMeta,\n DevToolsHost,\n DevToolsNodeContext\n} from \"devframe/types\";\nimport * as v from \"valibot\";\nimport { EngineOptions } from \"../types/config\";\nimport { EngineContext, EngineExecutionItem } from \"../types/context\";\n\nexport class PowerlinesEngineContext<TSystemContext = unknown>\n extends PowerlinesBaseContext<TSystemContext>\n implements EngineContext<TSystemContext>\n{\n #executions: EngineExecutionItem[] = [];\n\n #devtools!: DevToolsNodeContext;\n\n #logLevel!: LogLevelResolvedConfig;\n\n /**\n * Creates a new instance of the PowerlinesEngineContext class.\n *\n * @param options - The options to initialize the context with.\n * @returns A promise that resolves to an instance of the PowerlinesEngineContext class.\n */\n public static async from<TSystemContext = unknown>(\n options: EngineOptions,\n host: DevToolsHost,\n connection: ConnectionMeta\n ): Promise<PowerlinesEngineContext<TSystemContext>> {\n const context = new PowerlinesEngineContext<TSystemContext>(\n options,\n connection\n );\n\n context.#devtools = await createHostContext({\n cwd: context.cwd,\n mode: \"dev\",\n host\n });\n await options.setup?.(context.#devtools);\n\n context.#devtools.rpc.register({\n name: \"powerlines:log\",\n type: \"event\",\n args: [\n v.object({\n meta: v.object({\n category: v.string(),\n name: v.string(),\n command: v.string(),\n hook: v.string(),\n plugin: v.string(),\n source: v.string()\n }),\n message: v.string()\n })\n ],\n setup: _ => ({\n handler: payload => {\n switch (payload.meta.type) {\n case \"error\":\n context.error(payload);\n break;\n case \"warn\":\n context.warn(payload);\n break;\n case \"info\":\n context.info(payload);\n break;\n case \"debug\":\n context.debug(payload);\n break;\n case \"trace\":\n context.trace(payload);\n break;\n default:\n context.info(payload);\n break;\n }\n }\n })\n });\n\n context.#logLevel = options.logLevel\n ? resolveLogLevel(options.logLevel)\n : await getDefaultLogLevel(context.cwd);\n\n return context;\n }\n\n public override createLogger(options: LoggerOptions = {}, logFn?: LogFn) {\n let logger = createLogger(\n \"engine\",\n {\n logLevel: this.#logLevel,\n ...options\n },\n logFn\n );\n if (this.options.customLogger) {\n logger = withCustomLogger(logger, this.options.customLogger);\n }\n return logger;\n }\n\n public get executions(): EngineExecutionItem[] {\n return this.#executions;\n }\n\n public get devtools(): DevToolsNodeContext {\n return this.#devtools;\n }\n\n public get envPaths(): EnvPaths {\n return getEnvPaths({\n orgId: kebabCase(this.orgId),\n appId: kebabCase(this.framework.name),\n workspaceRoot: this.cwd\n });\n }\n\n public get framework(): FrameworkOptions {\n return {\n name: \"powerlines\",\n orgId: \"storm-software\",\n ...this.options.framework\n };\n }\n\n public get orgId(): string {\n return this.framework.orgId;\n }\n\n /**\n * Creates a new Context instance.\n *\n * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.\n * @param connection - The connection metadata for the dev server.\n */\n protected constructor(\n public override options: EngineOptions,\n public connection: ConnectionMeta\n ) {\n super(options);\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @remarks\n * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.\n *\n * @param method - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.\n * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.\n */\n public async loadExecutions(\n method: string,\n inlineConfig: InlineConfig\n ): Promise<EngineExecutionItem[]> {\n const root = resolveRoot(\n this.cwd,\n inlineConfig.root,\n inlineConfig.configFile\n );\n\n const config = await loadParsedConfig(\n this.cwd,\n root,\n this.framework?.name,\n this.orgId,\n inlineConfig\n );\n if (!config) {\n throw new Error(\"Failed to load configuration\");\n }\n\n const invocationId = uuid();\n const executions = await Promise.all(\n toArray(config.config).map(async (_, configIndex) => {\n const executionId = uuid();\n const options = {\n cwd: this.cwd,\n root,\n framework: this.framework,\n orgId: this.orgId,\n ...this.options,\n command: method,\n baseURL: this.#devtools.host.resolveOrigin(),\n connection: this.connection,\n configFile: config.configFile!,\n executionId,\n configIndex\n };\n\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Invoking ${method} with the following execution parameters: \\n --- Options --- \\n${formatConfig(\n options\n )}\\n --- Inline Config --- \\n${formatConfig(inlineConfig)}`\n });\n\n return {\n invocationId,\n method,\n configFile: config,\n options,\n state: {\n command: null,\n hook: null,\n plugin: null\n }\n };\n })\n );\n\n this.#executions = this.#executions.concat(executions);\n\n return executions;\n }\n\n /**\n * Complete an execution by removing it from the list of active executions based on the provided invocation ID and execution ID. This method is typically called when an execution has finished or has been terminated, allowing the context to clean up any resources associated with that execution and update its internal state accordingly.\n *\n * @param invocationId - The unique identifier for the invocation of the execution to be completed.\n * @param executionId - The unique identifier for the specific execution to be completed.\n */\n public completeExecution(invocationId: string, executionId: string) {\n this.#executions = this.#executions.filter(\n execution =>\n execution.options.executionId !== executionId ||\n execution.invocationId !== invocationId\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AAmDA,IAAa,0BAAb,MAAa,gCACH,sBAEV;CAiIoB;CACT;CAjIT,cAAqC,CAAC;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;CACT;;;;;;;CAQA,AAAO,kBAAkB,cAAsB,aAAqB;EAClE,KAAKA,cAAc,KAAKA,YAAY,QAClC,cACE,UAAU,QAAQ,gBAAgB,eAClC,UAAU,iBAAiB,YAC/B;CACF;AACF"}
1
+ {"version":3,"file":"engine-context.mjs","names":["#devtools","#logLevel","#executions"],"sources":["../../src/context/engine-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n FrameworkOptions,\n InlineConfig,\n LogFn,\n LoggerOptions,\n LogLevelResolvedConfig\n} from \"@powerlines/core\";\nimport { PowerlinesBaseContext } from \"@powerlines/core/context/base-context\";\nimport {\n getDefaultLogLevel,\n loadParsedConfig,\n resolveRoot\n} from \"@powerlines/core/lib/config\";\nimport {\n createLogger,\n formatConfig,\n formatExecutionId,\n resolveLogLevel,\n withCustomLogger\n} from \"@powerlines/core/plugin-utils\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { createHostContext } from \"devframe/node\";\nimport {\n ConnectionMeta,\n DevToolsHost,\n DevToolsNodeContext\n} from \"devframe/types\";\nimport * as v from \"valibot\";\nimport { EngineOptions } from \"../types/config\";\nimport { EngineContext, EngineExecutionItem } from \"../types/context\";\n\nexport class PowerlinesEngineContext<TSystemContext = unknown>\n extends PowerlinesBaseContext<TSystemContext>\n implements EngineContext<TSystemContext>\n{\n #executions: EngineExecutionItem[] = [];\n\n #devtools!: DevToolsNodeContext;\n\n #logLevel!: LogLevelResolvedConfig;\n\n /**\n * Creates a new instance of the PowerlinesEngineContext class.\n *\n * @param options - The options to initialize the context with.\n * @returns A promise that resolves to an instance of the PowerlinesEngineContext class.\n */\n public static async from<TSystemContext = unknown>(\n options: EngineOptions,\n host: DevToolsHost,\n connection: ConnectionMeta\n ): Promise<PowerlinesEngineContext<TSystemContext>> {\n const context = new PowerlinesEngineContext<TSystemContext>(\n options,\n connection\n );\n\n context.#devtools = await createHostContext({\n cwd: context.cwd,\n mode: \"dev\",\n host\n });\n await options.setup?.(context.#devtools);\n\n context.#devtools.rpc.register({\n name: \"powerlines:log\",\n type: \"event\",\n args: [\n v.object({\n meta: v.object({\n category: v.string(),\n name: v.string(),\n command: v.string(),\n hook: v.string(),\n plugin: v.string(),\n source: v.string()\n }),\n message: v.string()\n })\n ],\n setup: _ => ({\n handler: payload => {\n switch (payload.meta.type) {\n case \"error\":\n context.error(payload);\n break;\n case \"warn\":\n context.warn(payload);\n break;\n case \"info\":\n context.info(payload);\n break;\n case \"debug\":\n context.debug(payload);\n break;\n case \"trace\":\n context.trace(payload);\n break;\n default:\n context.info(payload);\n break;\n }\n }\n })\n });\n\n context.#logLevel = options.logLevel\n ? resolveLogLevel(options.logLevel)\n : await getDefaultLogLevel(context.cwd);\n\n return context;\n }\n\n public override createLogger(options: LoggerOptions = {}, logFn?: LogFn) {\n let logger = createLogger(\n \"engine\",\n {\n logLevel: this.#logLevel,\n ...options\n },\n logFn\n );\n if (this.options.customLogger) {\n logger = withCustomLogger(logger, this.options.customLogger);\n }\n return logger;\n }\n\n public get executions(): EngineExecutionItem[] {\n return this.#executions;\n }\n\n public get devtools(): DevToolsNodeContext {\n return this.#devtools;\n }\n\n public get envPaths(): EnvPaths {\n return getEnvPaths({\n orgId: kebabCase(this.orgId),\n appId: kebabCase(this.framework.name),\n workspaceRoot: this.cwd\n });\n }\n\n public get framework(): FrameworkOptions {\n return {\n name: \"powerlines\",\n orgId: \"storm-software\",\n ...this.options.framework\n };\n }\n\n public get orgId(): string {\n return this.framework.orgId;\n }\n\n /**\n * Creates a new Context instance.\n *\n * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.\n * @param connection - The connection metadata for the dev server.\n */\n protected constructor(\n public override options: EngineOptions,\n public connection: ConnectionMeta\n ) {\n super(options);\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @remarks\n * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.\n *\n * @param command - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.\n * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.\n */\n public async loadExecutions(\n command: string,\n inlineConfig: InlineConfig\n ): Promise<EngineExecutionItem[]> {\n const root = resolveRoot(\n this.cwd,\n inlineConfig.root,\n inlineConfig.configFile\n );\n\n const config = await loadParsedConfig(\n this.cwd,\n root,\n this.framework?.name,\n this.orgId,\n inlineConfig\n );\n if (!config) {\n throw new Error(\"Failed to load configuration\");\n }\n\n const invocationId = uuid();\n const executions = await Promise.all(\n toArray(config.config).map(async (_, configIndex) => {\n const executionId = formatExecutionId(\n config.config.name || inlineConfig.name || root,\n command,\n configIndex\n );\n\n const options = {\n cwd: this.cwd,\n root,\n framework: this.framework,\n orgId: this.orgId,\n ...this.options,\n command,\n baseURL: this.#devtools.host.resolveOrigin(),\n connection: this.connection,\n configFile: config.configFile!,\n executionId,\n configIndex\n };\n\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Invoking ${command} with the following execution parameters: \\n --- Options --- \\n${formatConfig(\n options\n )}\\n --- Inline Config --- \\n${formatConfig(inlineConfig)}`\n });\n\n return {\n invocationId,\n command,\n configFile: config,\n options,\n state: {\n command: null,\n hook: null,\n plugin: null\n }\n };\n })\n );\n\n this.#executions = this.#executions.concat(executions);\n\n return executions;\n }\n\n /**\n * Complete an execution by removing it from the list of active executions based on the provided invocation ID and execution ID. This method is typically called when an execution has finished or has been terminated, allowing the context to clean up any resources associated with that execution and update its internal state accordingly.\n *\n * @param invocationId - The unique identifier for the invocation of the execution to be completed.\n * @param executionId - The unique identifier for the specific execution to be completed.\n */\n public completeExecution(invocationId: string, executionId: string) {\n this.#executions = this.#executions.filter(\n execution =>\n execution.options.executionId !== executionId ||\n execution.invocationId !== invocationId\n );\n }\n}\n"],"mappings":";;;;;;;;;;;AAoDA,IAAa,0BAAb,MAAa,gCACH,sBAEV;CAiIoB;CACT;CAjIT,cAAqC,CAAC;CAEtC;CAEA;;;;;;;CAQA,aAAoB,KAClB,SACA,MACA,YACkD;EAClD,MAAM,UAAU,IAAI,wBAClB,SACA,UACF;EAEA,QAAQA,YAAY,MAAM,kBAAkB;GAC1C,KAAK,QAAQ;GACb,MAAM;GACN;EACF,CAAC;EACD,MAAM,QAAQ,QAAQ,QAAQA,SAAS;EAEvC,QAAQA,UAAU,IAAI,SAAS;GAC7B,MAAM;GACN,MAAM;GACN,MAAM,CACJ,EAAE,OAAO;IACP,MAAM,EAAE,OAAO;KACb,UAAU,EAAE,OAAO;KACnB,MAAM,EAAE,OAAO;KACf,SAAS,EAAE,OAAO;KAClB,MAAM,EAAE,OAAO;KACf,QAAQ,EAAE,OAAO;KACjB,QAAQ,EAAE,OAAO;IACnB,CAAC;IACD,SAAS,EAAE,OAAO;GACpB,CAAC,CACH;GACA,QAAO,OAAM,EACX,UAAS,YAAW;IAClB,QAAQ,QAAQ,KAAK,MAArB;KACE,KAAK;MACH,QAAQ,MAAM,OAAO;MACrB;KACF,KAAK;MACH,QAAQ,KAAK,OAAO;MACpB;KACF,KAAK;MACH,QAAQ,KAAK,OAAO;MACpB;KACF,KAAK;MACH,QAAQ,MAAM,OAAO;MACrB;KACF,KAAK;MACH,QAAQ,MAAM,OAAO;MACrB;KACF;MACE,QAAQ,KAAK,OAAO;MACpB;IACJ;GACF,EACF;EACF,CAAC;EAED,Q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KAAK;IACZ,GAAG,KAAK;IACR;IACA,SAAS,KAAKA,UAAU,KAAK,cAAc;IAC3C,YAAY,KAAK;IACjB,YAAY,OAAO;IACnB;IACA;GACF;GAEA,KAAK,OAAO,MAAM;IAChB,MAAM,EAAE,UAAU,SAAS;IAC3B,SAAS,YAAY,QAAQ,iEAAiE,aAC5F,OACF,EAAE,6BAA6B,aAAa,YAAY;GAC1D,CAAC;GAED,OAAO;IACL;IACA;IACA,YAAY;IACZ;IACA,OAAO;KACL,SAAS;KACT,MAAM;KACN,QAAQ;IACV;GACF;EACF,CAAC,CACH;EAEA,KAAKE,cAAc,KAAKA,YAAY,OAAO,UAAU;EAErD,OAAO;CACT;;;;;;;CAQA,AAAO,kBAAkB,cAAsB,aAAqB;EAClE,KAAKA,cAAc,KAAKA,YAAY,QAClC,cACE,UAAU,QAAQ,gBAAgB,eAClC,UAAU,iBAAiB,YAC/B;CACF;AACF"}
@@ -1,2 +1,2 @@
1
- import { t as PowerlinesEngineContext } from "../engine-context-BJiH5JZe.cjs";
1
+ import { t as PowerlinesEngineContext } from "../engine-context-DDbpdZHC.cjs";
2
2
  export { PowerlinesEngineContext };
@@ -1,2 +1,2 @@
1
- import { t as PowerlinesEngineContext } from "../engine-context-EdV-sOjq.mjs";
1
+ import { t as PowerlinesEngineContext } from "../engine-context-CaPJFek0.mjs";
2
2
  export { PowerlinesEngineContext };
@@ -81,9 +81,9 @@ interface EngineExecutionItem {
81
81
  */
82
82
  invocationId: string;
83
83
  /**
84
- * The method being executed, which can be one of the supported Powerlines execution API methods such as "build", "docs", or "deploy". This indicates the specific command or action that is being executed within the Powerlines engine.
84
+ * The command being executed, which can be one of the supported Powerlines execution API methods such as "build", "docs", or "deploy". This indicates the specific command or action that is being executed within the Powerlines engine.
85
85
  */
86
- method: string;
86
+ command: string;
87
87
  /**
88
88
  * The options provided to the Powerlines process for this execution
89
89
  */
@@ -146,4 +146,4 @@ interface EngineSystemContext {
146
146
  }
147
147
  //#endregion
148
148
  export { ExecutionHookScopeState as a, ExecutionScopeType as c, ExecutionCommandScopeState as i, ExecutionState as l, EngineExecutionItem as n, ExecutionPluginScopeState as o, EngineSystemContext as r, ExecutionScopeState as s, EngineContext as t };
149
- //# sourceMappingURL=context-CNYu12sa.d.mts.map
149
+ //# sourceMappingURL=context-C71mv_aw.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-CJLRZKhl.d.cts","names":[],"sources":["../src/types/context.ts"],"mappings":";;;;;;AA0BA;;KAAY,kBAAA;;AAAkB;AAK9B;UAAiB,mBAAA;;;;EAIf,SAAA;EAUA;;;EALA,IAAA;EAWe;;;EANf,IAAA,EAAM,kBAAkB;AAAA;AAgB1B;;;AAAA,UAViB,0BAAA,SAAmC,mBAAmB;EAUtB;;;EAN/C,IAAI;AAAA;AAqBN;;;AAAA,UAfiB,uBAAA,SAAgC,mBAAmB;EAmB9D;AAMN;;EArBE,KAAA;EAyBS;;;EApBT,IAAA;AAAA;;;;UAMe,yBAAA,SAAkC,mBAAmB;EAwBpE;;;EApBA,IAAI;AAAA;;;;UAMW,cAAA;EAuCH;;;EAnCZ,OAAA,EAAS,0BAAA;EAoBT;;;EAfA,IAAA,EAAM,uBAAA;EAyBQ;;;EApBd,MAAA,EAAQ,yBAAA;AAAA;;AA8Ba;AASvB;UAjCiB,mBAAA;EAiCa;;;EA7B5B,YAAA;EAoCS;;;EA/BT,MAAA;EA2DgB;;;EAtDhB,OAAA,EAAS,IAAA,CAAK,sBAAA;EAsBZ;;;EAjBF,UAAA,EAAY,gBAAA;EAgBV;;;EAXF,KAAA,EAAO,cAAA;AAAA;;;;;;;UASQ,aAAA,mCAEb,WAAA,CAAY,cAAA,GACZ,IAAA,CAAK,QAAA,CAAS,aAAA;EAsBJ;;;EAlBZ,OAAA,EAAS,aAAA;EA4BP;;;EAvBF,UAAA,EAAY,cAAA;EAgCQ;;;AAAyC;AAG/D;;EA3BE,QAAA,EAAU,mBAAA;EA+BV;AAAc;;EA1Bd,UAAA,EA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,cAAA,GACE,MAAA,UACA,YAAA,EAAc,YAAA,KACX,OAAA,CAAQ,mBAAA;;;;;;;EAQb,iBAAA,GAAoB,YAAA,UAAsB,WAAA;AAAA;AAAA,UAG3B,mBAAA;;;;EAIf,GAAA,EAAK,SAAS;AAAA"}
@@ -81,9 +81,9 @@ interface EngineExecutionItem {
81
81
  */
82
82
  invocationId: string;
83
83
  /**
84
- * The method being executed, which can be one of the supported Powerlines execution API methods such as "build", "docs", or "deploy". This indicates the specific command or action that is being executed within the Powerlines engine.
84
+ * The command being executed, which can be one of the supported Powerlines execution API methods such as "build", "docs", or "deploy". This indicates the specific command or action that is being executed within the Powerlines engine.
85
85
  */
86
- method: string;
86
+ command: string;
87
87
  /**
88
88
  * The options provided to the Powerlines process for this execution
89
89
  */
@@ -146,4 +146,4 @@ interface EngineSystemContext {
146
146
  }
147
147
  //#endregion
148
148
  export { ExecutionHookScopeState as a, ExecutionScopeType as c, ExecutionCommandScopeState as i, ExecutionState as l, EngineExecutionItem as n, ExecutionPluginScopeState as o, EngineSystemContext as r, ExecutionScopeState as s, EngineContext as t };
149
- //# sourceMappingURL=context-CJLRZKhl.d.cts.map
149
+ //# sourceMappingURL=context-ZbJRDGpl.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-CNYu12sa.d.mts","names":[],"sources":["../src/types/context.ts"],"mappings":";;;;;;AA0BA;;KAAY,kBAAA;;AAAkB;AAK9B;UAAiB,mBAAA;;;;EAIf,SAAA;EAUA;;;EALA,IAAA;EAWe;;;EANf,IAAA,EAAM,kBAAkB;AAAA;AAgB1B;;;AAAA,UAViB,0BAAA,SAAmC,mBAAmB;EAUtB;;;EAN/C,IAAI;AAAA;AAqBN;;;AAAA,UAfiB,uBAAA,SAAgC,mBAAmB;EAmB9D;AAMN;;EArBE,KAAA;EAyBS;;;EApBT,IAAA;AAAA;;;;UAMe,yBAAA,SAAkC,mBAAmB;EAwBpE;;;EApBA,IAAI;AAAA;;;;UAMW,cAAA;EAuCH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AS,0BAAA;EAoBT;;;EAfA,IAAA,EAAM,uBAAA;EAyBQ;;;EApBd,MAAA,EAAQ,yBAAA;AAAA;;AA8Ba;AASvB;UAjCiB,mBAAA;EAiCa;;;EA7B5B,YAAA;EAoCS;;;EA/BT,OAAA;EA2DgB;;;EAtDhB,OAAA,EAAS,IAAA,CAAK,sBAAA;EAsBZ;;;EAjBF,UAAA,EAAY,gBAAA;EAgBV;;;EAXF,KAAA,EAAO,cAAA;AAAA;;;;;;;UASQ,aAAA,mCAEb,WAAA,CAAY,cAAA,GACZ,IAAA,CAAK,QAAA,CAAS,aAAA;EAsBJ;;;EAlBZ,OAAA,EAAS,aAAA;EA4BP;;;EAvBF,UAAA,EAAY,cAAA;EAgCQ;;;AAAyC;AAG/D;;EA3BE,QAAA,EAAU,mBAAA;EA+BV;AAAc;;EA1Bd,UAAA,EAAY,mBAAA;;;;;;;EAQZ,cAAA,GACE,MAAA,UACA,YAAA,EAAc,YAAA,KACX,OAAA,CAAQ,mBAAA;;;;;;;EAQb,iBAAA,GAAoB,YAAA,UAAsB,WAAA;AAAA;AAAA,UAG3B,mBAAA;;;;EAIf,GAAA,EAAK,SAAS;AAAA"}
@@ -1,7 +1,7 @@
1
1
  import { n as EngineExecutionOptions, r as EngineOptions } from "./config-B6udgcnD.cjs";
2
- import { t as EngineContext } from "./context-CJLRZKhl.cjs";
3
- import { i as ExecutionApiWorkerInterface, t as Engine } from "./index-Bwnu1gvX.cjs";
4
- import { t as PowerlinesEngineContext } from "./engine-context-BJiH5JZe.cjs";
2
+ import { t as EngineContext } from "./context-ZbJRDGpl.cjs";
3
+ import { i as ExecutionApiWorkerInterface, t as Engine } from "./index-QuLZgb8w.cjs";
4
+ import { t as PowerlinesEngineContext } from "./engine-context-DDbpdZHC.cjs";
5
5
  import { BuildInlineConfig, CleanInlineConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, InlineConfig, LintInlineConfig, Mode, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
6
6
 
7
7
  //#region src/_internal/execution-api-worker.d.ts
@@ -196,4 +196,4 @@ declare function createContext(options: EngineOptions): Promise<PowerlinesEngine
196
196
  declare function createEngine(options: EngineOptions, apiPath?: string): Promise<PowerlinesEngine>;
197
197
  //#endregion
198
198
  export { createContext as n, createEngine as r, PowerlinesEngine as t };
199
- //# sourceMappingURL=engine-qMKcp-AX.d.cts.map
199
+ //# sourceMappingURL=engine-B5pbfMyg.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine-BdhpduRS.d.mts","names":[],"sources":["../src/_internal/execution-api-worker.ts","../src/engine.ts"],"mappings":";;;;;;;cAwCM,SAAA;AAAA,UA8DW,yBAAA;EA9DX;;;;AAAiD;EA8ErD,OAAA;EAhBwC;;;EAqBxC,cAAA;EAAA;;;EAKA,IAAA,GAAO,IAAA;EAUP;;;EALA,IAAA;EAQW;;;EAHX,OAAA,EAAS,aAAa;AAAA;AAAA,cAGX,kBAAA,YAA8B,2BAAA;EAAA;YAsE7B,gBAAA;EAAA,UACA,OAAA,EAAS,yBAAA;EAAA,cAxDP,cAAA,CAAA,GAAc,OAAA,QAAA,SAAA;EAAA,UASlB,qBAAA,CAAA;EAuWC;;;;;;;EAAA,OAxVS,IAAA,CAClB,OAAA,UACA,OAAA,EAAS,yBAAA,GAAyB,OAAA,CAAA,kBAAA;EAzCK;;;;;;EAAA,UAqEhC,WAAA,CACG,gBAAA,UACA,OAAA,EAAS,yBAAA;EAsTR,OAAA,CACX,OAAA,UACA,OAAA,EAAS,IAAA,CAAK,sBAAA,cACd,YAAA,EAAc,YAAA,GAAY,OAAA;EAjXd;;;EAoZD,QAAA,CAAA,GAAY,OAAA;EAAA,UAUf,SAAA,CAAA;EAAA,UAoBA,UAAA,CAAA;EAAA,UAUM,YAAA,CACd,OAAA,UACA,OAAA,EAAS,IAAA,CAAK,sBAAA,cACd,YAAA,EAAc,YAAA,GAAY,OAAA;AAAA;;;;AArjBmB;;;;cCQpC,gBAAA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;;;;EAkBrC,OAAA,CAAQ,YAAA,EAAc,mBAAA,GAAmB,OAAA;EDqDpD;;;;;;;;;EClCW,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;EDwXhD;;;;;;ECxWW,IAAA,CAAK,YAAA,EAAc,gBAAA,GAAgB,OAAA;ED6YnC;;;;;;;;;EC1XA,IAAA,CAAK,YAAA,EAAc,gBAAA,GAAgB,OAAA;EDqa9C;;;AAA0B;;;;AC7iB9B;;EA2Je,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;EA7I5B;;;;;;EA6JT,IAAA,CAAK,YAAA,EAAc,gBAAA,GAAgB,OAAA;EA3GE;;;;;;;;;EA8HrC,MAAA,CAAO,YAAA,EAAc,kBAAA,GAAkB,OAAA;EAnCF;;;;;;;;EAqDrC,QAAA,CAAA,GAAQ,OAAA;EA2B8C;;;EAAA,CAdrD,MAAA,CAAO,YAAA,KAAa,OAAA;EA7N4B;;;;;;;;;;EAAA,UA2O9C,OAAA,CAAQ,OAAA,UAAiB,YAAA,EAAc,YAAA,GAAY,OAAA;AAAA;AAAA,iBA8B/C,aAAA,CAAc,OAAA,EAAS,aAAA,GAAa,OAAA,CAAA,uBAAA;AAAA,iBAuBpC,YAAA,CACpB,OAAA,EAAS,aAAA,EACT,OAAA,YAAkC,OAAA,CAAA,gBAAA"}
@@ -1,7 +1,7 @@
1
1
  import { n as EngineExecutionOptions, r as EngineOptions } from "./config-DXxu0y4t.mjs";
2
- import { t as EngineContext } from "./context-CNYu12sa.mjs";
3
- import { i as ExecutionApiWorkerInterface, t as Engine } from "./index-BXQx2xGi.mjs";
4
- import { t as PowerlinesEngineContext } from "./engine-context-EdV-sOjq.mjs";
2
+ import { t as EngineContext } from "./context-C71mv_aw.mjs";
3
+ import { i as ExecutionApiWorkerInterface, t as Engine } from "./index-CBobV6Wm.mjs";
4
+ import { t as PowerlinesEngineContext } from "./engine-context-CaPJFek0.mjs";
5
5
  import { BuildInlineConfig, CleanInlineConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, InlineConfig, LintInlineConfig, Mode, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
6
6
 
7
7
  //#region src/_internal/execution-api-worker.d.ts
@@ -196,4 +196,4 @@ declare function createContext(options: EngineOptions): Promise<PowerlinesEngine
196
196
  declare function createEngine(options: EngineOptions, apiPath?: string): Promise<PowerlinesEngine>;
197
197
  //#endregion
198
198
  export { createContext as n, createEngine as r, PowerlinesEngine as t };
199
- //# sourceMappingURL=engine-BdhpduRS.d.mts.map
199
+ //# sourceMappingURL=engine-CeWEM0TT.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine-qMKcp-AX.d.cts","names":[],"sources":["../src/_internal/execution-api-worker.ts","../src/engine.ts"],"mappings":";;;;;;;cAwCM,SAAA;AAAA,UA8DW,yBAAA;EA9DX;;;;AAAiD;EA8ErD,OAAA;EAhBwC;;;EAqBxC,cAAA;EAAA;;;EAKA,IAAA,GAAO,IAAA;EAUP;;;EALA,IAAA;EAQW;;;EAHX,OAAA,EAAS,aAAa;AAAA;AAAA,cAGX,kBAAA,YAA8B,2BAAA;EAAA;YAsE7B,gBAAA;EAAA,UACA,OAAA,EAAS,yBAAA;EAAA,cAxDP,cAAA,CAAA,GAAc,OAAA,QAAA,SAAA;EAAA,UASlB,qBAAA,CAAA;EAuWC;;;;;;;EAAA,OAxVS,IAAA,CAClB,OAAA,UACA,OAAA,EAAS,yBAAA,GAAyB,OAAA,CAAA,kBAAA;EAzCK;;;;;;EAAA,UAqEhC,WAAA,CACG,gBAAA,UACA,OAAA,EAAS,yBAAA;EAsTR,OAAA,CACX,OAAA,UACA,OAAA,EAAS,IAAA,CAAK,sBAAA,cACd,YAAA,EAAc,YAAA,GAAY,OAAA;EAjXd;;;EAoZD,QAAA,CAAA,GAAY,OAAA;EAAA,UAUf,SAAA,CAAA;EAAA,UAoBA,UAAA,CAAA;EAAA,UAUM,YAAA,CACd,OAAA,UAC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AAA,EAAc,kBAAA,GAAkB,OAAA;EDod3B;;;;;;;;EClcZ,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;;;;;;;;;EAkBrC,OAAA,CAAQ,YAAA,EAAc,mBAAA,GAAmB,OAAA;EDqDpD;;;;;;;;;EClCW,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;EDwXhD;;;;;;ECxWW,IAAA,CAAK,YAAA,EAAc,gBAAA,GAAgB,OAAA;ED6YnC;;;;;;;;;EC1XA,IAAA,CAAK,YAAA,EAAc,gBAAA,GAAgB,OAAA;EDqa9C;;;AAA0B;;;;AC7iB9B;;EA2Je,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;EA7I5B;;;;;;EA6JT,IAAA,CAAK,YAAA,EAAc,gBAAA,GAAgB,OAAA;EA3GE;;;;;;;;;EA8HrC,MAAA,CAAO,YAAA,EAAc,kBAAA,GAAkB,OAAA;EAnCF;;;;;;;;EAqDrC,QAAA,CAAA,GAAQ,OAAA;EA2B8C;;;EAAA,CAdrD,MAAA,CAAO,YAAA,KAAa,OAAA;EA7N4B;;;;;;;;;;EAAA,UA2O9C,OAAA,CAAQ,OAAA,UAAiB,YAAA,EAAc,YAAA,GAAY,OAAA;AAAA;AAAA,iBA8B/C,aAAA,CAAc,OAAA,EAAS,aAAA,GAAa,OAAA,CAAA,uBAAA;AAAA,iBAuBpC,YAAA,CACpB,OAAA,EAAS,aAAA,EACT,OAAA,YAAkC,OAAA,CAAA,gBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"engine-DRAFIm5M.mjs","names":["#restartPromise","#resolveRestartPromise","#logger","#worker","#createWorker","#activeTasks","#hangingTimer","#context","#api"],"sources":["../src/_internal/execution-api-worker.ts","../src/engine.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { InlineConfig, Logger, Mode } from \"@powerlines/core\";\nimport { getDefaultMode } from \"@powerlines/core/lib/config\";\nimport { isDebug } from \"@stryke/env/environment-checks\";\nimport { resolve } from \"@stryke/fs/resolve\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { formatDuration } from \"date-fns/formatDuration\";\nimport { pipeline } from \"node:stream\";\nimport { parseArgs } from \"node:util\";\nimport {\n MessageChannel,\n StructuredSerializeOptions\n} from \"node:worker_threads\";\nimport Tinypool from \"tinypool\";\nimport { MessagePortDuplex } from \"../helpers/stream\";\nimport { ExecutionApiWorkerInterface } from \"../types\";\nimport { EngineExecutionOptions } from \"../types/config\";\nimport { EngineContext } from \"../types/context\";\n\nconst RESTARTED = Symbol(\"powerlines-worker:restarted\");\n\n/**\n * The debug address is in the form of `[host:]port`. The host is optional.\n */\ninterface DebugAddress {\n host?: string;\n port: number;\n}\n\n/**\n * Formats the debug address into a string.\n */\nconst formatDebugAddress = ({ host, port }: DebugAddress): string => {\n return host ? `${host}:${port}` : `${port}`;\n};\n\nexport type NodeOptions = Record<string, string | boolean | undefined>;\n\n/**\n * Get's the debug address from the `NODE_OPTIONS` environment variable. If the\n * address is not found, it returns the default host (`undefined`) and port\n * (`9229`).\n *\n * @returns An object with the host and port of the debug address.\n */\nconst getParsedDebugAddress = (\n address: string | boolean | undefined\n): DebugAddress => {\n if (!address || !isString(address)) {\n return { host: undefined, port: 9229 };\n }\n\n // The address is in the form of `[host:]port`. Let's parse the address.\n if (address.includes(\":\")) {\n const [host, port] = address.split(\":\");\n if (!host || !port) {\n throw new Error(`Invalid debug address: ${address}`);\n }\n\n return { host, port: Number.parseInt(port, 10) };\n }\n\n return { host: undefined, port: Number.parseInt(address, 10) };\n};\n\ntype NodeInspectType = \"inspect\" | \"inspect-brk\" | undefined;\n\n/**\n * Get the debug type from the `NODE_OPTIONS` environment variable.\n */\nfunction getNodeDebugType(nodeOptions: NodeOptions): NodeInspectType {\n if (nodeOptions.inspect) {\n return \"inspect\";\n }\n if (nodeOptions[\"inspect-brk\"] || nodeOptions.inspect_brk) {\n return \"inspect-brk\";\n }\n\n return undefined;\n}\n\nexport interface ExecutionApiWorkerOptions {\n // /**\n // * `-1` if not inspectable\n // */\n // debuggerPortOffset?: number;\n\n // /**\n // * Whether to enable source maps support in the worker, which can improve the quality of stack traces at the cost of increased memory usage and slower performance. Defaults to `false`.\n // */\n // enableSourceMaps?: boolean;\n\n /**\n * The maximum time in milliseconds a worker can run before being terminated.\n *\n * @defaultValue 900000 (15 minutes)\n */\n timeout?: number;\n\n /**\n * True if `--max-old-space-size` should not be forwarded to the worker.\n */\n isolatedMemory?: boolean;\n\n /**\n * The mode to run the worker in, which can affect how the worker is initialized and how it behaves. This is determined based on the resolved configuration of the engine, and can be used to optimize the worker for different environments (e.g., development, production, etc.).\n */\n mode?: Mode;\n\n /**\n * An optional root to resolve the execution host path from, which can be used to specify a custom root directory for the worker to use when resolving paths and loading configuration files. If this option is not provided, the worker will use the current working directory as the root directory by default.\n */\n root?: string;\n\n /**\n * The context of the {@link @powerlines/engine#Engine | Engine instance}, which can be used to access the engine's state and services within the worker.\n */\n context: EngineContext;\n}\n\nexport class ExecutionApiWorker implements ExecutionApiWorkerInterface {\n #worker: Tinypool | undefined;\n\n #logger: Logger;\n\n #activeTasks = 0;\n\n #restartPromise: Promise<typeof RESTARTED> | null = null;\n\n #resolveRestartPromise: ((arg: typeof RESTARTED) => void) | null = null;\n\n #hangingTimer: NodeJS.Timeout | false = false;\n\n #createWorker: () => void;\n\n protected get restartPromise() {\n if (!this.#restartPromise) {\n this.#restartPromise = new Promise(resolve => {\n this.#resolveRestartPromise = resolve;\n });\n }\n return this.#restartPromise;\n }\n\n protected resolveRestartPromise() {\n if (this.#resolveRestartPromise) {\n this.#resolveRestartPromise(RESTARTED);\n this.#restartPromise = null;\n this.#resolveRestartPromise = null;\n }\n }\n\n /**\n * Creates a new instance of the Execution API Worker class, which manages a worker process for executing tasks related to the Powerlines Engine. The worker is initialized with the specified options and can be used to run tasks in an isolated environment, with support for automatic restarts and activity monitoring.\n *\n * @param apiPath - The path to the Execution API file.\n * @param options - The options for configuring the worker, including the execution context, exposed methods, timeout, and mode.\n * @returns A promise that resolves to an instance of the ExecutionApiWorker class.\n */\n public static async from(\n apiPath: string,\n options: ExecutionApiWorkerOptions\n ) {\n const mode = await getDefaultMode(options.context.cwd);\n\n const resolvedPath = await resolve(apiPath, {\n paths: [\n options.context.cwd,\n options.root ? appendPath(options.root, options.context.cwd) : undefined\n ].filter(Boolean) as string[]\n });\n if (!resolvedPath) {\n throw new Error(\n `Could not resolve the provided Execution API path: \\`${apiPath}\\`.`\n );\n }\n\n return new ExecutionApiWorker(resolvedPath, {\n mode,\n ...options\n });\n }\n\n /**\n * Create a new API worker instance.\n *\n * @param executionApiPath - The path to the worker file.\n * @param options - The options for the worker, including exposed commands, timeout, and hooks for activity and restart.\n */\n protected constructor(\n protected executionApiPath: string,\n protected options: ExecutionApiWorkerOptions\n ) {\n const {\n isolatedMemory = false,\n mode = \"production\",\n context\n } = this.options;\n\n this.options.timeout ??= 900_000;\n\n this.#logger = context.extendLogger({ category: \"communication\" });\n this.#worker = undefined;\n\n // ensure we end workers if they weren't before exit\n process.on(\"exit\", () => {\n void this.finalize();\n });\n\n let nodeOptions = {} as {\n [longOption: string]: string | boolean | undefined;\n };\n\n const args: string[] = [...process.execArgv];\n if (process.env.NODE_OPTIONS) {\n let isInString = false;\n let willStartNewArg = true;\n\n const stringifiedNodeOptions = process.env.NODE_OPTIONS.split(\" \").filter(\n part =>\n ((part.startsWith('\"') && part.endsWith('\"')) ||\n (part.startsWith(\"'\") && part.endsWith(\"'\"))) &&\n part\n .replace(/^['\"]|['\"]$/g, \"\")\n .split(\" \")\n .filter(isSetString).length > 0 &&\n part\n .replace(/^['\"]|['\"]$/g, \"\")\n .split(\" \")\n .filter(isSetString)\n .every(p => p.startsWith(\"--\"))\n );\n args.push(\n ...stringifiedNodeOptions.map(part => part.replace(/^['\"]|['\"]$/g, \"\"))\n );\n\n const inputNodeModules = stringifiedNodeOptions.reduce((acc, part) => {\n return acc.replace(part, \"\").trim();\n }, process.env.NODE_OPTIONS);\n for (let i = 0; i < inputNodeModules.length; i++) {\n let char = inputNodeModules[i];\n if (char) {\n // Skip any escaped characters in strings.\n if (char === \"\\\\\" && isInString) {\n // Ensure we don't have an escape character at the end.\n if (inputNodeModules.length === i + 1) {\n throw new Error(\"Invalid escape character at the end.\");\n }\n\n // Skip the next character.\n char = inputNodeModules[++i];\n if (!char) {\n continue;\n }\n }\n // If we find a space outside of a string, we should start a new argument.\n else if (char === \" \" && !isInString) {\n willStartNewArg = true;\n continue;\n }\n\n // If we find a quote, we should toggle the string flag.\n else if (char === '\"') {\n isInString = !isInString;\n continue;\n }\n\n // If we're starting a new argument, we should add it to the array.\n if (willStartNewArg) {\n args.push(char);\n willStartNewArg = false;\n }\n // Otherwise, add it to the last argument.\n else {\n args[args.length - 1] += char;\n }\n }\n }\n\n if (isInString) {\n throw new Error(\"Unterminated string\");\n }\n }\n\n if (args.length > 0) {\n const { values, tokens } = parseArgs({\n args,\n strict: false,\n tokens: true\n });\n nodeOptions = values;\n\n // For the `NODE_OPTIONS`, we support arguments with values without the `=`\n // sign. We need to parse them manually.\n let orphan = null;\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n if (!token) continue;\n\n if (token.kind === \"option-terminator\") {\n break;\n }\n\n // When we encounter an option, if it's value is undefined, we should check\n // to see if the following tokens are positional parameters. If they are,\n // then the option is orphaned, and we can assign it.\n if (token.kind === \"option\") {\n orphan = !isSet(token.value) ? token : null;\n continue;\n }\n\n // If the token isn't a positional one, then we can't assign it to the found\n // orphaned option.\n if (token.kind !== \"positional\") {\n orphan = null;\n continue;\n }\n\n // If we don't have an orphan, then we can skip this token.\n if (!orphan) {\n continue;\n }\n\n // If the token is a positional one, and it has a value, so add it to the\n // values object. If it already exists, append it with a space.\n if (orphan.name in nodeOptions && isString(nodeOptions[orphan.name])) {\n nodeOptions[orphan.name] += ` ${token.value}`;\n } else {\n nodeOptions[orphan.name] = token.value;\n }\n }\n }\n\n const originalOptions = { ...nodeOptions };\n\n delete nodeOptions.inspect;\n delete nodeOptions[\"inspect-brk\"];\n delete nodeOptions.inspect_brk;\n\n if (isDebug) {\n const nodeDebugType = getNodeDebugType(originalOptions);\n if (nodeDebugType) {\n const debuggerAddress = getParsedDebugAddress(\n originalOptions[nodeDebugType]\n );\n const address: DebugAddress = {\n host: debuggerAddress.host,\n // current process runs on `address.port`\n port: debuggerAddress.port === 0 ? 0 : debuggerAddress.port + 1 + 1\n };\n nodeOptions[nodeDebugType] = formatDebugAddress(address);\n\n this.#logger.info(\n `Node.js debugger listening on ${nodeOptions[nodeDebugType]}`\n );\n }\n\n nodeOptions[\"enable-source-maps\"] = true;\n }\n\n if (isolatedMemory) {\n delete nodeOptions[\"max-old-space-size\"];\n delete nodeOptions.max_old_space_size;\n }\n\n const execArgv: string[] = [];\n const nodeOptionsParts: string[] = [];\n for (const [key, value] of Object.entries(nodeOptions)) {\n let formatted: string | null = null;\n if (value === true) {\n formatted = `--${key}`;\n } else if (value) {\n formatted = `--${key}=${\n // Values with spaces need to be quoted. We use JSON.stringify to\n // also escape any nested quotes.\n value.includes(\" \") && !value.startsWith('\"')\n ? JSON.stringify(value)\n : value\n }`;\n }\n\n if (formatted === null) {\n continue;\n }\n\n if (\n [\n \"experimental-network-inspection\",\n \"experimental-storage-inspection\",\n \"experimental-worker-inspection\",\n \"experimental-inspector-network-resource\"\n ].includes(key)\n ) {\n execArgv.push(formatted);\n } else {\n nodeOptionsParts.push(formatted);\n }\n }\n\n // // Issue: https://github.com/nodejs/node/issues/59706\n // if (!nodeOptionsParts.includes(\"--no-experimental-strip-types\")) {\n // nodeOptionsParts.push(\"--no-experimental-strip-types\");\n // }\n\n this.#createWorker = () => {\n const env: Record<string, string> = {\n ...process.env,\n NODE_ENV: mode,\n NODE_OPTIONS: nodeOptionsParts.join(\" \"),\n POWERLINES_EXECUTION_WORKER: \"true\"\n };\n\n // Mirror the enablement heuristic from picocolors (see https://github.com/vercel/next.js/blob/6a40da0345939fe4f7b1ae519b296a86dd103432/packages/next/src/lib/picocolors.ts#L21-L24).\n // Picocolors snapshots `process.env`/`stdout.isTTY` at module load time, so when the worker\n // process bootstraps with piped stdio its own check would disable colors. Re-evaluating the\n // same conditions here lets us opt the worker into color output only when the parent would\n // have seen colors, while still respecting explicit opt-outs like NO_COLOR.\n if (\n env.FORCE_COLOR === undefined &&\n !env.NO_COLOR &&\n !env.CI &&\n env.TERM !== \"dumb\" &&\n (process.stdout.isTTY || process.stderr?.isTTY)\n ) {\n env.FORCE_COLOR = \"1\";\n }\n\n this.#logger.debug(\n `Creating worker from file ${\n executionApiPath\n } with execution arguments: ${JSON.stringify(execArgv, null, 2)}`\n );\n\n this.#worker = new Tinypool({\n terminateTimeout: 5000,\n filename: executionApiPath,\n execArgv,\n env\n });\n\n this.#restartPromise = new Promise(resolve => {\n this.#resolveRestartPromise = resolve;\n });\n\n this.#worker.on(\"exit\", (code, signal) => {\n this.#logger.debug(\n `Worker process exited with code ${code} and signal ${signal}`\n );\n\n if ((code || (signal && signal !== \"SIGINT\")) && this.#worker) {\n const error = new Error(\n `Execution Host Worker exited unexpectedly with code ${\n code\n } and signal ${signal}`\n );\n this.#logger.error(error);\n\n void this.finalize().then(() => {\n throw error;\n });\n }\n });\n\n this.#worker.on(\"error\", error => {\n this.#logger.error({\n meta: { category: \"communication\" },\n message: `Worker process emitted an error: ${error.message}`,\n error\n });\n });\n\n // if a child process emits a particular message, we track that as activity\n // so the parent process can keep track of progress\n this.#worker.on(\"message\", data => {\n this.onActivity();\n\n if (Array.isArray(data) && data.length > 1 && isNumber(data[0])) {\n if (data[0] === 0) {\n this.#logger.trace(\n `Received message from worker: ${JSON.stringify(data.slice(1), null, 2)}`\n );\n } else {\n this.#logger.debug(\n `Received error message from worker: ${JSON.stringify(\n data.slice(1),\n null,\n 2\n )}`\n );\n }\n }\n\n this.#logger.trace(\n `Received message from worker: ${JSON.stringify(data, null, 2)}`\n );\n });\n };\n\n this.#createWorker();\n }\n\n public async execute(\n command: string,\n options: Omit<EngineExecutionOptions, \"channel\">,\n inlineConfig: InlineConfig\n ) {\n if (this.options.timeout) {\n this.#activeTasks++;\n try {\n let attempts = 0;\n for (;;) {\n this.onActivity();\n\n const result = await Promise.race([\n this.innerExecute(command, options, inlineConfig),\n this.#restartPromise\n ]);\n if (result !== RESTARTED) {\n return;\n }\n\n this.#logger.warn(\n `Execution Host Worker was restarted while calling method \"${\n command\n }\" (attempt ${attempts++}). Retrying the call...`\n );\n }\n } finally {\n this.#activeTasks--;\n this.onActivity();\n }\n } else {\n await this.innerExecute(command, options, inlineConfig);\n }\n }\n\n /**\n * Closes the worker process, terminating it if it's still running. This method should be called when the worker is no longer needed, to free up system resources and ensure a clean shutdown. If the worker has already been terminated, this method will have no effect.\n */\n public async finalize(): Promise<void> {\n const worker = this.#worker;\n if (!worker) {\n return;\n }\n\n await worker.destroy();\n this.#worker = undefined;\n }\n\n protected onHanging() {\n if (!this.#worker) {\n return;\n }\n\n this.#createWorker();\n\n this.#logger.warn(\n `Sending SIGTERM signal to worker due to timeout${\n this.options.timeout\n ? ` of ${formatDuration({ seconds: this.options.timeout / 1000 })}`\n : \"\"\n }. Subsequent errors may be a result of the worker exiting.`\n );\n\n void this.finalize().then(() => {\n this.#resolveRestartPromise?.(RESTARTED);\n });\n }\n\n protected onActivity() {\n if (this.#hangingTimer) {\n clearTimeout(this.#hangingTimer);\n }\n\n this.#hangingTimer =\n this.#activeTasks > 0 &&\n setTimeout(() => this.onHanging(), this.options.timeout);\n }\n\n protected async innerExecute(\n command: string,\n options: Omit<EngineExecutionOptions, \"channel\">,\n inlineConfig: InlineConfig\n ) {\n if (!this.#worker) {\n throw new Error(\"Execution Host Worker is not initialized\");\n }\n\n const { port1, port2 } = new MessageChannel();\n const promise = this.#worker.run(\n { command, options: { ...options, channel: port2 }, inlineConfig },\n {\n transferList: [port2] as StructuredSerializeOptions\n }\n );\n\n let aborted = false;\n const onActivityAbort = () => {\n if (!aborted) {\n aborted = true;\n }\n };\n const duplex = new MessagePortDuplex(port1, { onActivityAbort });\n\n pipeline(duplex, process.stdout, (err: NodeJS.ErrnoException | null) => {\n if (err) {\n this.#logger.debug(\n `Received exception message from worker: ${JSON.stringify(\n err,\n null,\n 2\n )}`\n );\n\n throw err;\n }\n });\n\n await promise;\n }\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n BuildInlineConfig,\n CleanInlineConfig,\n CreateInlineConfig,\n DeployInlineConfig,\n DocsInlineConfig,\n InlineConfig,\n LintInlineConfig,\n PrepareInlineConfig,\n TestInlineConfig,\n TypesInlineConfig\n} from \"@powerlines/core\";\nimport { createH3DevToolsHost } from \"devframe/node\";\nimport { getPort } from \"get-port-please\";\nimport { createApp, fromNodeMiddleware } from \"h3\";\nimport { EventEmitter } from \"node:events\";\nimport sirv from \"sirv\";\nimport { ExecutionApiWorker } from \"./_internal/execution-api-worker\";\nimport { PowerlinesEngineContext } from \"./context/engine-context\";\nimport { Engine } from \"./types/api\";\nimport { EngineOptions } from \"./types/config\";\nimport { EngineContext } from \"./types/context\";\n\n/**\n * The Powerlines process' orchestration and coordination API.\n *\n * @public\n */\nexport class PowerlinesEngine implements Engine, AsyncDisposable {\n /**\n * The Powerlines context\n */\n #context: EngineContext;\n\n /**\n * The execution host, which provides methods to call the execution API functions from the engine context. This allows the engine to invoke commands and other API functions during the execution of Powerlines commands, enabling communication between the engine and the execution contexts.\n */\n #api: ExecutionApiWorker;\n\n /**\n * The Powerlines context\n */\n public get context(): EngineContext {\n return this.#context;\n }\n\n /**\n * The execution host, which provides methods to call the execution API functions from the engine context. This allows the engine to invoke commands and other API functions during the execution of Powerlines commands, enabling communication between the engine and the execution contexts.\n */\n public get api(): ExecutionApiWorker {\n return this.#api;\n }\n\n /**\n * Create a new Powerlines Engine instance\n *\n * @param context - The Powerlines context\n * @param api - The API host for the execution workers\n * @returns A new instance of the Powerlines Engine\n */\n public constructor(context: EngineContext, api: ExecutionApiWorker) {\n this.#context = context;\n this.#api = api;\n }\n\n /**\n * Create a new Powerlines project\n *\n * @remarks\n * This method will create a new Powerlines project in the current directory.\n *\n * @param inlineConfig - The inline configuration for the create command\n * @returns A promise that resolves when the project has been created\n */\n public async create(inlineConfig: CreateInlineConfig) {\n const timer = this.context.timer(\"Create\");\n this.context.info(\"🆕 Creating a new project\");\n\n await this.execute(\"create\", inlineConfig);\n\n this.context.debug(\"✔ Create command completed successfully\");\n timer();\n }\n\n /**\n * Generate the Powerlines typescript declaration file\n *\n * @remarks\n * This method will only generate the typescript declaration file for the Powerlines project. It is generally recommended to run the full `prepare` command, which will run this method as part of its process.\n *\n * @param inlineConfig - The inline configuration for the types command\n */\n public async types(inlineConfig: TypesInlineConfig) {\n const timer = this.context.timer(\"Types\");\n this.context.info(\"🏗️ Generating typescript declarations for the project\");\n\n await this.execute(\"types\", inlineConfig);\n\n this.context.debug(\"✔ Types generation has completed successfully\");\n timer();\n }\n\n /**\n * Prepare the Powerlines API\n *\n * @remarks\n * This method will prepare the Powerlines API for use, initializing any necessary resources.\n *\n * @param inlineConfig - The inline configuration for the prepare command\n */\n public async prepare(inlineConfig: PrepareInlineConfig) {\n const timer = this.context.timer(\"Prepare\");\n this.context.info(\"🏗️ Preparing the project\");\n\n await this.execute(\"prepare\", inlineConfig);\n\n this.context.debug(\"✔ Preparation has completed successfully\");\n timer();\n }\n\n /**\n * Clean any previously prepared artifacts\n *\n * @remarks\n * This method will remove the previous Powerlines artifacts from the project.\n *\n * @param inlineConfig - The inline configuration for the clean command\n * @returns A promise that resolves when the clean command has completed\n */\n public async clean(inlineConfig: CleanInlineConfig) {\n const timer = this.context.timer(\"Clean\");\n this.context.info(\"🧹 Cleaning the previous artifacts\");\n\n await this.execute(\"clean\", inlineConfig);\n\n this.context.debug(\"✔ Cleaning completed successfully\");\n timer();\n }\n\n /**\n * Lint the project\n *\n * @param inlineConfig - The inline configuration for the lint command\n * @returns A promise that resolves when the lint command has completed\n */\n public async lint(inlineConfig: LintInlineConfig) {\n const timer = this.context.timer(\"Lint\");\n this.context.info(\"📝 Linting the project\");\n\n await this.execute(\"lint\", inlineConfig);\n\n this.context.debug(\"✔ Linting completed successfully\");\n timer();\n }\n\n /**\n * Test the project\n *\n * @remarks\n * This method will run the tests for the Powerlines project.\n *\n * @param inlineConfig - The inline configuration for the test command\n * @returns A promise that resolves when the test command has completed\n */\n public async test(inlineConfig: TestInlineConfig) {\n const timer = this.context.timer(\"Test\");\n this.context.info(\"🧪 Running tests for the project\");\n\n await this.execute(\"test\", inlineConfig);\n\n this.context.debug(\"✔ Testing completed successfully\");\n timer();\n }\n\n /**\n * Build the project\n *\n * @remarks\n * This method will build the Powerlines project, generating the necessary artifacts.\n *\n * @param inlineConfig - The inline configuration for the build command\n * @returns A promise that resolves when the build command has completed\n */\n public async build(inlineConfig: BuildInlineConfig) {\n const timer = this.context.timer(\"Build\");\n this.context.info(\"📦 Building the project\");\n\n await this.execute(\"build\", inlineConfig);\n\n this.context.debug(\"✔ Build completed successfully\");\n timer();\n }\n\n /**\n * Prepare the documentation for the project\n *\n * @param inlineConfig - The inline configuration for the docs command\n * @returns A promise that resolves when the documentation generation has completed\n */\n public async docs(inlineConfig: DocsInlineConfig) {\n const timer = this.context.timer(\"Docs\");\n this.context.info(\"📓 Generating documentation for the project\");\n\n await this.execute(\"docs\", inlineConfig);\n\n this.context.debug(\"✔ Documentation generation completed successfully\");\n timer();\n }\n\n /**\n * Deploy the project source code\n *\n * @remarks\n * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.\n *\n * @param inlineConfig - The inline configuration for the deploy command\n * @returns A promise that resolves when the deploy command has completed\n */\n public async deploy(inlineConfig: DeployInlineConfig) {\n const timer = this.context.timer(\"Deploy\");\n this.context.info(\"🚀 Deploying the project\");\n\n await this.execute(\"deploy\", inlineConfig);\n\n this.context.debug(\"✔ Deployment completed successfully\");\n timer();\n }\n\n /**\n * Finalization/cleanup processing for the Powerlines API\n *\n * @remarks\n * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.\n *\n * @returns A promise that resolves when the finalization process has completed\n */\n public async finalize() {\n const timer = this.context.timer(\"Finalize\");\n this.context.info(\"🏁 Finalization processes started\");\n\n await this.api.finalize();\n\n this.context.debug(\"✔ Finalization completed successfully\");\n timer();\n }\n\n /**\n * Asynchronous disposal method for the Powerlines Engine, which will call the finalize method to perform any necessary cleanup when the engine is disposed of.\n */\n public async [Symbol.asyncDispose]() {\n return this.finalize();\n }\n\n /**\n * Execute a Powerlines command based on the provided execution path and inline configuration, loading the necessary executions from the context and managing their lifecycle.\n *\n * @remarks\n * This method will load the executions for the specified command and inline configuration, then execute each one while managing their lifecycle, including handling their completion and any errors that may occur during execution.\n *\n * @param command - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.\n * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.\n * @returns A promise that resolves when all executions for the specified command have completed\n */\n protected async execute(command: string, inlineConfig: InlineConfig) {\n await Promise.all(\n (await this.context.loadExecutions(command, inlineConfig)).map(\n async execution => {\n try {\n await this.api.execute(command, execution.options, inlineConfig);\n } catch (error) {\n this.context.error(\n `Execution of method \"${command}\" failed for execution with invocation ID \"${\n execution.invocationId\n }\" and execution ID \"${execution.options.executionId}\": \\n\\n${\n error instanceof Error\n ? error.stack || error.message\n : String(error)\n }`\n );\n\n throw error;\n } finally {\n this.context.completeExecution(\n execution.invocationId,\n execution.options.executionId\n );\n }\n }\n )\n );\n }\n}\n\nexport async function createContext(options: EngineOptions) {\n const port =\n options.port ??\n (await getPort({\n host: options.host || \"localhost\",\n random: true\n }));\n\n const app = createApp();\n const host = createH3DevToolsHost({\n appName: options.framework?.name || \"powerlines\",\n origin: `http://${options.host || \"localhost\"}:${port}`,\n mount: (base, dir) => {\n app.use(base, fromNodeMiddleware(sirv(dir, { dev: true, single: true })));\n }\n });\n\n return PowerlinesEngineContext.from(options, host, {\n backend: \"websocket\",\n websocket: port\n });\n}\n\nexport async function createEngine(\n options: EngineOptions,\n apiPath = \"@powerlines/engine/api\"\n) {\n EventEmitter.setMaxListeners(Infinity);\n\n const context = await createContext(options);\n const host = await ExecutionApiWorker.from(apiPath, {\n root: options.root,\n context\n });\n\n return new PowerlinesEngine(context, host);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,YAAY,OAAO,6BAA6B;;;;AAatD,MAAM,sBAAsB,EAAE,MAAM,WAAiC;CACnE,OAAO,OAAO,GAAG,KAAK,GAAG,SAAS,GAAG;AACvC;;;;;;;;AAWA,MAAM,yBACJ,YACiB;CACjB,IAAI,CAAC,WAAW,CAAC,SAAS,OAAO,GAC/B,OAAO;EAAE,MAAM;EAAW,MAAM;CAAK;CAIvC,IAAI,QAAQ,SAAS,GAAG,GAAG;EACzB,MAAM,CAAC,MAAM,QAAQ,QAAQ,MAAM,GAAG;EACtC,IAAI,CAAC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Q;EACb,MAAM,QAAQ,QAAQ;EACtB,QAAQ;CACV,CAAC;CAEH,MAAM,MAAM,UAAU;CACtB,MAAM,OAAO,qBAAqB;EAChC,SAAS,QAAQ,WAAW,QAAQ;EACpC,QAAQ,UAAU,QAAQ,QAAQ,YAAY,GAAG;EACjD,QAAQ,MAAM,QAAQ;GACpB,IAAI,IAAI,MAAM,mBAAmB,KAAK,KAAK;IAAE,KAAK;IAAM,QAAQ;GAAK,CAAC,CAAC,CAAC;EAC1E;CACF,CAAC;CAED,OAAO,wBAAwB,KAAK,SAAS,MAAM;EACjD,SAAS;EACT,WAAW;CACb,CAAC;AACH;AAEA,eAAsB,aACpB,SACA,UAAU,0BACV;CACA,aAAa,gBAAgB,QAAQ;CAErC,MAAM,UAAU,MAAM,cAAc,OAAO;CAM3C,OAAO,IAAI,iBAAiB,SAAS,MALlB,mBAAmB,KAAK,SAAS;EAClD,MAAM,QAAQ;EACd;CACF,CAAC,CAEwC;AAC3C"}
1
+ {"version":3,"file":"engine-DRAFIm5M.mjs","names":["#restartPromise","#resolveRestartPromise","#logger","#worker","#createWorker","#activeTasks","#hangingTimer","#context","#api"],"sources":["../src/_internal/execution-api-worker.ts","../src/engine.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { InlineConfig, Logger, Mode } from \"@powerlines/core\";\nimport { getDefaultMode } from \"@powerlines/core/lib/config\";\nimport { isDebug } from \"@stryke/env/environment-checks\";\nimport { resolve } from \"@stryke/fs/resolve\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { formatDuration } from \"date-fns/formatDuration\";\nimport { pipeline } from \"node:stream\";\nimport { parseArgs } from \"node:util\";\nimport {\n MessageChannel,\n StructuredSerializeOptions\n} from \"node:worker_threads\";\nimport Tinypool from \"tinypool\";\nimport { MessagePortDuplex } from \"../helpers/stream\";\nimport { ExecutionApiWorkerInterface } from \"../types\";\nimport { EngineExecutionOptions } from \"../types/config\";\nimport { EngineContext } from \"../types/context\";\n\nconst RESTARTED = Symbol(\"powerlines-worker:restarted\");\n\n/**\n * The debug address is in the form of `[host:]port`. The host is optional.\n */\ninterface DebugAddress {\n host?: string;\n port: number;\n}\n\n/**\n * Formats the debug address into a string.\n */\nconst formatDebugAddress = ({ host, port }: DebugAddress): string => {\n return host ? `${host}:${port}` : `${port}`;\n};\n\nexport type NodeOptions = Record<string, string | boolean | undefined>;\n\n/**\n * Get's the debug address from the `NODE_OPTIONS` environment variable. If the\n * address is not found, it returns the default host (`undefined`) and port\n * (`9229`).\n *\n * @returns An object with the host and port of the debug address.\n */\nconst getParsedDebugAddress = (\n address: string | boolean | undefined\n): DebugAddress => {\n if (!address || !isString(address)) {\n return { host: undefined, port: 9229 };\n }\n\n // The address is in the form of `[host:]port`. Let's parse the address.\n if (address.includes(\":\")) {\n const [host, port] = address.split(\":\");\n if (!host || !port) {\n throw new Error(`Invalid debug address: ${address}`);\n }\n\n return { host, port: Number.parseInt(port, 10) };\n }\n\n return { host: undefined, port: Number.parseInt(address, 10) };\n};\n\ntype NodeInspectType = \"inspect\" | \"inspect-brk\" | undefined;\n\n/**\n * Get the debug type from the `NODE_OPTIONS` environment variable.\n */\nfunction getNodeDebugType(nodeOptions: NodeOptions): NodeInspectType {\n if (nodeOptions.inspect) {\n return \"inspect\";\n }\n if (nodeOptions[\"inspect-brk\"] || nodeOptions.inspect_brk) {\n return \"inspect-brk\";\n }\n\n return undefined;\n}\n\nexport interface ExecutionApiWorkerOptions {\n // /**\n // * `-1` if not inspectable\n // */\n // debuggerPortOffset?: number;\n\n // /**\n // * Whether to enable source maps support in the worker, which can improve the quality of stack traces at the cost of increased memory usage and slower performance. Defaults to `false`.\n // */\n // enableSourceMaps?: boolean;\n\n /**\n * The maximum time in milliseconds a worker can run before being terminated.\n *\n * @defaultValue 900000 (15 minutes)\n */\n timeout?: number;\n\n /**\n * True if `--max-old-space-size` should not be forwarded to the worker.\n */\n isolatedMemory?: boolean;\n\n /**\n * The mode to run the worker in, which can affect how the worker is initialized and how it behaves. This is determined based on the resolved configuration of the engine, and can be used to optimize the worker for different environments (e.g., development, production, etc.).\n */\n mode?: Mode;\n\n /**\n * An optional root to resolve the execution host path from, which can be used to specify a custom root directory for the worker to use when resolving paths and loading configuration files. If this option is not provided, the worker will use the current working directory as the root directory by default.\n */\n root?: string;\n\n /**\n * The context of the {@link @powerlines/engine#Engine | Engine instance}, which can be used to access the engine's state and services within the worker.\n */\n context: EngineContext;\n}\n\nexport class ExecutionApiWorker implements ExecutionApiWorkerInterface {\n #worker: Tinypool | undefined;\n\n #logger: Logger;\n\n #activeTasks = 0;\n\n #restartPromise: Promise<typeof RESTARTED> | null = null;\n\n #resolveRestartPromise: ((arg: typeof RESTARTED) => void) | null = null;\n\n #hangingTimer: NodeJS.Timeout | false = false;\n\n #createWorker: () => void;\n\n protected get restartPromise() {\n if (!this.#restartPromise) {\n this.#restartPromise = new Promise(resolve => {\n this.#resolveRestartPromise = resolve;\n });\n }\n return this.#restartPromise;\n }\n\n protected resolveRestartPromise() {\n if (this.#resolveRestartPromise) {\n this.#resolveRestartPromise(RESTARTED);\n this.#restartPromise = null;\n this.#resolveRestartPromise = null;\n }\n }\n\n /**\n * Creates a new instance of the Execution API Worker class, which manages a worker process for executing tasks related to the Powerlines Engine. The worker is initialized with the specified options and can be used to run tasks in an isolated environment, with support for automatic restarts and activity monitoring.\n *\n * @param apiPath - The path to the Execution API file.\n * @param options - The options for configuring the worker, including the execution context, exposed methods, timeout, and mode.\n * @returns A promise that resolves to an instance of the ExecutionApiWorker class.\n */\n public static async from(\n apiPath: string,\n options: ExecutionApiWorkerOptions\n ) {\n const mode = await getDefaultMode(options.context.cwd);\n\n const resolvedPath = await resolve(apiPath, {\n paths: [\n options.context.cwd,\n options.root ? appendPath(options.root, options.context.cwd) : undefined\n ].filter(Boolean) as string[]\n });\n if (!resolvedPath) {\n throw new Error(\n `Could not resolve the provided Execution API path: \\`${apiPath}\\`.`\n );\n }\n\n return new ExecutionApiWorker(resolvedPath, {\n mode,\n ...options\n });\n }\n\n /**\n * Create a new API worker instance.\n *\n * @param executionApiPath - The path to the worker file.\n * @param options - The options for the worker, including exposed commands, timeout, and hooks for activity and restart.\n */\n protected constructor(\n protected executionApiPath: string,\n protected options: ExecutionApiWorkerOptions\n ) {\n const {\n isolatedMemory = false,\n mode = \"production\",\n context\n } = this.options;\n\n this.options.timeout ??= 900_000;\n\n this.#logger = context.extendLogger({ category: \"communication\" });\n this.#worker = undefined;\n\n // ensure we end workers if they weren't before exit\n process.on(\"exit\", () => {\n void this.finalize();\n });\n\n let nodeOptions = {} as {\n [longOption: string]: string | boolean | undefined;\n };\n\n const args: string[] = [...process.execArgv];\n if (process.env.NODE_OPTIONS) {\n let isInString = false;\n let willStartNewArg = true;\n\n const stringifiedNodeOptions = process.env.NODE_OPTIONS.split(\" \").filter(\n part =>\n ((part.startsWith('\"') && part.endsWith('\"')) ||\n (part.startsWith(\"'\") && part.endsWith(\"'\"))) &&\n part\n .replace(/^['\"]|['\"]$/g, \"\")\n .split(\" \")\n .filter(isSetString).length > 0 &&\n part\n .replace(/^['\"]|['\"]$/g, \"\")\n .split(\" \")\n .filter(isSetString)\n .every(p => p.startsWith(\"--\"))\n );\n args.push(\n ...stringifiedNodeOptions.map(part => part.replace(/^['\"]|['\"]$/g, \"\"))\n );\n\n const inputNodeModules = stringifiedNodeOptions.reduce((acc, part) => {\n return acc.replace(part, \"\").trim();\n }, process.env.NODE_OPTIONS);\n for (let i = 0; i < inputNodeModules.length; i++) {\n let char = inputNodeModules[i];\n if (char) {\n // Skip any escaped characters in strings.\n if (char === \"\\\\\" && isInString) {\n // Ensure we don't have an escape character at the end.\n if (inputNodeModules.length === i + 1) {\n throw new Error(\"Invalid escape character at the end.\");\n }\n\n // Skip the next character.\n char = inputNodeModules[++i];\n if (!char) {\n continue;\n }\n }\n // If we find a space outside of a string, we should start a new argument.\n else if (char === \" \" && !isInString) {\n willStartNewArg = true;\n continue;\n }\n\n // If we find a quote, we should toggle the string flag.\n else if (char === '\"') {\n isInString = !isInString;\n continue;\n }\n\n // If we're starting a new argument, we should add it to the array.\n if (willStartNewArg) {\n args.push(char);\n willStartNewArg = false;\n }\n // Otherwise, add it to the last argument.\n else {\n args[args.length - 1] += char;\n }\n }\n }\n\n if (isInString) {\n throw new Error(\"Unterminated string\");\n }\n }\n\n if (args.length > 0) {\n const { values, tokens } = parseArgs({\n args,\n strict: false,\n tokens: true\n });\n nodeOptions = values;\n\n // For the `NODE_OPTIONS`, we support arguments with values without the `=`\n // sign. We need to parse them manually.\n let orphan = null;\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n if (!token) continue;\n\n if (token.kind === \"option-terminator\") {\n break;\n }\n\n // When we encounter an option, if it's value is undefined, we should check\n // to see if the following tokens are positional parameters. If they are,\n // then the option is orphaned, and we can assign it.\n if (token.kind === \"option\") {\n orphan = !isSet(token.value) ? token : null;\n continue;\n }\n\n // If the token isn't a positional one, then we can't assign it to the found\n // orphaned option.\n if (token.kind !== \"positional\") {\n orphan = null;\n continue;\n }\n\n // If we don't have an orphan, then we can skip this token.\n if (!orphan) {\n continue;\n }\n\n // If the token is a positional one, and it has a value, so add it to the\n // values object. If it already exists, append it with a space.\n if (orphan.name in nodeOptions && isString(nodeOptions[orphan.name])) {\n nodeOptions[orphan.name] += ` ${token.value}`;\n } else {\n nodeOptions[orphan.name] = token.value;\n }\n }\n }\n\n const originalOptions = { ...nodeOptions };\n\n delete nodeOptions.inspect;\n delete nodeOptions[\"inspect-brk\"];\n delete nodeOptions.inspect_brk;\n\n if (isDebug) {\n const nodeDebugType = getNodeDebugType(originalOptions);\n if (nodeDebugType) {\n const debuggerAddress = getParsedDebugAddress(\n originalOptions[nodeDebugType]\n );\n const address: DebugAddress = {\n host: debuggerAddress.host,\n // current process runs on `address.port`\n port: debuggerAddress.port === 0 ? 0 : debuggerAddress.port + 1 + 1\n };\n nodeOptions[nodeDebugType] = formatDebugAddress(address);\n\n this.#logger.info(\n `Node.js debugger listening on ${nodeOptions[nodeDebugType]}`\n );\n }\n\n nodeOptions[\"enable-source-maps\"] = true;\n }\n\n if (isolatedMemory) {\n delete nodeOptions[\"max-old-space-size\"];\n delete nodeOptions.max_old_space_size;\n }\n\n const execArgv: string[] = [];\n const nodeOptionsParts: string[] = [];\n for (const [key, value] of Object.entries(nodeOptions)) {\n let formatted: string | null = null;\n if (value === true) {\n formatted = `--${key}`;\n } else if (value) {\n formatted = `--${key}=${\n // Values with spaces need to be quoted. We use JSON.stringify to\n // also escape any nested quotes.\n value.includes(\" \") && !value.startsWith('\"')\n ? JSON.stringify(value)\n : value\n }`;\n }\n\n if (formatted === null) {\n continue;\n }\n\n if (\n [\n \"experimental-network-inspection\",\n \"experimental-storage-inspection\",\n \"experimental-worker-inspection\",\n \"experimental-inspector-network-resource\"\n ].includes(key)\n ) {\n execArgv.push(formatted);\n } else {\n nodeOptionsParts.push(formatted);\n }\n }\n\n // // Issue: https://github.com/nodejs/node/issues/59706\n // if (!nodeOptionsParts.includes(\"--no-experimental-strip-types\")) {\n // nodeOptionsParts.push(\"--no-experimental-strip-types\");\n // }\n\n this.#createWorker = () => {\n const env: Record<string, string> = {\n ...process.env,\n NODE_ENV: mode,\n NODE_OPTIONS: nodeOptionsParts.join(\" \"),\n POWERLINES_EXECUTION_WORKER: \"true\"\n };\n\n // Mirror the enablement heuristic from picocolors (see https://github.com/vercel/next.js/blob/6a40da0345939fe4f7b1ae519b296a86dd103432/packages/next/src/lib/picocolors.ts#L21-L24).\n // Picocolors snapshots `process.env`/`stdout.isTTY` at module load time, so when the worker\n // process bootstraps with piped stdio its own check would disable colors. Re-evaluating the\n // same conditions here lets us opt the worker into color output only when the parent would\n // have seen colors, while still respecting explicit opt-outs like NO_COLOR.\n if (\n env.FORCE_COLOR === undefined &&\n !env.NO_COLOR &&\n !env.CI &&\n env.TERM !== \"dumb\" &&\n (process.stdout.isTTY || process.stderr?.isTTY)\n ) {\n env.FORCE_COLOR = \"1\";\n }\n\n this.#logger.debug(\n `Creating worker from file ${\n executionApiPath\n } with execution arguments: ${JSON.stringify(execArgv, null, 2)}`\n );\n\n this.#worker = new Tinypool({\n terminateTimeout: 5000,\n filename: executionApiPath,\n execArgv,\n env\n });\n\n this.#restartPromise = new Promise(resolve => {\n this.#resolveRestartPromise = resolve;\n });\n\n this.#worker.on(\"exit\", (code, signal) => {\n this.#logger.debug(\n `Worker process exited with code ${code} and signal ${signal}`\n );\n\n if ((code || (signal && signal !== \"SIGINT\")) && this.#worker) {\n const error = new Error(\n `Execution Host Worker exited unexpectedly with code ${\n code\n } and signal ${signal}`\n );\n this.#logger.error(error);\n\n void this.finalize().then(() => {\n throw error;\n });\n }\n });\n\n this.#worker.on(\"error\", error => {\n this.#logger.error({\n meta: { category: \"communication\" },\n message: `Worker process emitted an error: ${error.message}`,\n error\n });\n });\n\n // if a child process emits a particular message, we track that as activity\n // so the parent process can keep track of progress\n this.#worker.on(\"message\", data => {\n this.onActivity();\n\n if (Array.isArray(data) && data.length > 1 && isNumber(data[0])) {\n if (data[0] === 0) {\n this.#logger.trace(\n `Received message from worker: ${JSON.stringify(data.slice(1), null, 2)}`\n );\n } else {\n this.#logger.debug(\n `Received error message from worker: ${JSON.stringify(\n data.slice(1),\n null,\n 2\n )}`\n );\n }\n }\n\n this.#logger.trace(\n `Received message from worker: ${JSON.stringify(data, null, 2)}`\n );\n });\n };\n\n this.#createWorker();\n }\n\n public async execute(\n command: string,\n options: Omit<EngineExecutionOptions, \"channel\">,\n inlineConfig: InlineConfig\n ) {\n if (this.options.timeout) {\n this.#activeTasks++;\n try {\n let attempts = 0;\n for (;;) {\n this.onActivity();\n\n const result = await Promise.race([\n this.innerExecute(command, options, inlineConfig),\n this.#restartPromise\n ]);\n if (result !== RESTARTED) {\n return;\n }\n\n this.#logger.warn(\n `Execution Host Worker was restarted while calling method \"${\n command\n }\" (attempt ${attempts++}). Retrying the call...`\n );\n }\n } finally {\n this.#activeTasks--;\n this.onActivity();\n }\n } else {\n await this.innerExecute(command, options, inlineConfig);\n }\n }\n\n /**\n * Closes the worker process, terminating it if it's still running. This method should be called when the worker is no longer needed, to free up system resources and ensure a clean shutdown. If the worker has already been terminated, this method will have no effect.\n */\n public async finalize(): Promise<void> {\n const worker = this.#worker;\n if (!worker) {\n return;\n }\n\n await worker.destroy();\n this.#worker = undefined;\n }\n\n protected onHanging() {\n if (!this.#worker) {\n return;\n }\n\n this.#createWorker();\n\n this.#logger.warn(\n `Sending SIGTERM signal to worker due to timeout${\n this.options.timeout\n ? ` of ${formatDuration({ seconds: this.options.timeout / 1000 })}`\n : \"\"\n }. Subsequent errors may be a result of the worker exiting.`\n );\n\n void this.finalize().then(() => {\n this.#resolveRestartPromise?.(RESTARTED);\n });\n }\n\n protected onActivity() {\n if (this.#hangingTimer) {\n clearTimeout(this.#hangingTimer);\n }\n\n this.#hangingTimer =\n this.#activeTasks > 0 &&\n setTimeout(() => this.onHanging(), this.options.timeout);\n }\n\n protected async innerExecute(\n command: string,\n options: Omit<EngineExecutionOptions, \"channel\">,\n inlineConfig: InlineConfig\n ) {\n if (!this.#worker) {\n throw new Error(\"Execution Host Worker is not initialized\");\n }\n\n const { port1, port2 } = new MessageChannel();\n const promise = this.#worker.run(\n { command, options: { ...options, channel: port2 }, inlineConfig },\n {\n transferList: [port2] as StructuredSerializeOptions\n }\n );\n\n let aborted = false;\n const onActivityAbort = () => {\n if (!aborted) {\n aborted = true;\n }\n };\n const duplex = new MessagePortDuplex(port1, { onActivityAbort });\n\n pipeline(duplex, process.stdout, (err: NodeJS.ErrnoException | null) => {\n if (err) {\n this.#logger.debug(\n `Received exception message from worker: ${JSON.stringify(\n err,\n null,\n 2\n )}`\n );\n\n throw err;\n }\n });\n\n await promise;\n }\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n BuildInlineConfig,\n CleanInlineConfig,\n CreateInlineConfig,\n DeployInlineConfig,\n DocsInlineConfig,\n InlineConfig,\n LintInlineConfig,\n PrepareInlineConfig,\n TestInlineConfig,\n TypesInlineConfig\n} from \"@powerlines/core\";\nimport { createH3DevToolsHost } from \"devframe/node\";\nimport { getPort } from \"get-port-please\";\nimport { createApp, fromNodeMiddleware } from \"h3\";\nimport { EventEmitter } from \"node:events\";\nimport sirv from \"sirv\";\nimport { ExecutionApiWorker } from \"./_internal/execution-api-worker\";\nimport { PowerlinesEngineContext } from \"./context/engine-context\";\nimport { Engine } from \"./types/api\";\nimport { EngineOptions } from \"./types/config\";\nimport { EngineContext } from \"./types/context\";\n\n/**\n * The Powerlines process' orchestration and coordination API.\n *\n * @public\n */\nexport class PowerlinesEngine implements Engine, AsyncDisposable {\n /**\n * The Powerlines context\n */\n #context: EngineContext;\n\n /**\n * The execution host, which provides methods to call the execution API functions from the engine context. This allows the engine to invoke commands and other API functions during the execution of Powerlines commands, enabling communication between the engine and the execution contexts.\n */\n #api: ExecutionApiWorker;\n\n /**\n * The Powerlines context\n */\n public get context(): EngineContext {\n return this.#context;\n }\n\n /**\n * The execution host, which provides methods to call the execution API functions from the engine context. This allows the engine to invoke commands and other API functions during the execution of Powerlines commands, enabling communication between the engine and the execution contexts.\n */\n public get api(): ExecutionApiWorker {\n return this.#api;\n }\n\n /**\n * Create a new Powerlines Engine instance\n *\n * @param context - The Powerlines context\n * @param api - The API host for the execution workers\n * @returns A new instance of the Powerlines Engine\n */\n public constructor(context: EngineContext, api: ExecutionApiWorker) {\n this.#context = context;\n this.#api = api;\n }\n\n /**\n * Create a new Powerlines project\n *\n * @remarks\n * This method will create a new Powerlines project in the current directory.\n *\n * @param inlineConfig - The inline configuration for the create command\n * @returns A promise that resolves when the project has been created\n */\n public async create(inlineConfig: CreateInlineConfig) {\n const timer = this.context.timer(\"Create\");\n this.context.info(\"🆕 Creating a new project\");\n\n await this.execute(\"create\", inlineConfig);\n\n this.context.debug(\"✔ Create command completed successfully\");\n timer();\n }\n\n /**\n * Generate the Powerlines typescript declaration file\n *\n * @remarks\n * This method will only generate the typescript declaration file for the Powerlines project. It is generally recommended to run the full `prepare` command, which will run this method as part of its process.\n *\n * @param inlineConfig - The inline configuration for the types command\n */\n public async types(inlineConfig: TypesInlineConfig) {\n const timer = this.context.timer(\"Types\");\n this.context.info(\"🏗️ Generating typescript declarations for the project\");\n\n await this.execute(\"types\", inlineConfig);\n\n this.context.debug(\"✔ Types generation has completed successfully\");\n timer();\n }\n\n /**\n * Prepare the Powerlines API\n *\n * @remarks\n * This method will prepare the Powerlines API for use, initializing any necessary resources.\n *\n * @param inlineConfig - The inline configuration for the prepare command\n */\n public async prepare(inlineConfig: PrepareInlineConfig) {\n const timer = this.context.timer(\"Prepare\");\n this.context.info(\"🏗️ Preparing the project\");\n\n await this.execute(\"prepare\", inlineConfig);\n\n this.context.debug(\"✔ Preparation has completed successfully\");\n timer();\n }\n\n /**\n * Clean any previously prepared artifacts\n *\n * @remarks\n * This method will remove the previous Powerlines artifacts from the project.\n *\n * @param inlineConfig - The inline configuration for the clean command\n * @returns A promise that resolves when the clean command has completed\n */\n public async clean(inlineConfig: CleanInlineConfig) {\n const timer = this.context.timer(\"Clean\");\n this.context.info(\"🧹 Cleaning the previous artifacts\");\n\n await this.execute(\"clean\", inlineConfig);\n\n this.context.debug(\"✔ Cleaning completed successfully\");\n timer();\n }\n\n /**\n * Lint the project\n *\n * @param inlineConfig - The inline configuration for the lint command\n * @returns A promise that resolves when the lint command has completed\n */\n public async lint(inlineConfig: LintInlineConfig) {\n const timer = this.context.timer(\"Lint\");\n this.context.info(\"📝 Linting the project\");\n\n await this.execute(\"lint\", inlineConfig);\n\n this.context.debug(\"✔ Linting completed successfully\");\n timer();\n }\n\n /**\n * Test the project\n *\n * @remarks\n * This method will run the tests for the Powerlines project.\n *\n * @param inlineConfig - The inline configuration for the test command\n * @returns A promise that resolves when the test command has completed\n */\n public async test(inlineConfig: TestInlineConfig) {\n const timer = this.context.timer(\"Test\");\n this.context.info(\"🧪 Running tests for the project\");\n\n await this.execute(\"test\", inlineConfig);\n\n this.context.debug(\"✔ Testing completed successfully\");\n timer();\n }\n\n /**\n * Build the project\n *\n * @remarks\n * This method will build the Powerlines project, generating the necessary artifacts.\n *\n * @param inlineConfig - The inline configuration for the build command\n * @returns A promise that resolves when the build command has completed\n */\n public async build(inlineConfig: BuildInlineConfig) {\n const timer = this.context.timer(\"Build\");\n this.context.info(\"📦 Building the project\");\n\n await this.execute(\"build\", inlineConfig);\n\n this.context.debug(\"✔ Build completed successfully\");\n timer();\n }\n\n /**\n * Prepare the documentation for the project\n *\n * @param inlineConfig - The inline configuration for the docs command\n * @returns A promise that resolves when the documentation generation has completed\n */\n public async docs(inlineConfig: DocsInlineConfig) {\n const timer = this.context.timer(\"Docs\");\n this.context.info(\"📓 Generating documentation for the project\");\n\n await this.execute(\"docs\", inlineConfig);\n\n this.context.debug(\"✔ Documentation generation completed successfully\");\n timer();\n }\n\n /**\n * Deploy the project source code\n *\n * @remarks\n * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.\n *\n * @param inlineConfig - The inline configuration for the deploy command\n * @returns A promise that resolves when the deploy command has completed\n */\n public async deploy(inlineConfig: DeployInlineConfig) {\n const timer = this.context.timer(\"Deploy\");\n this.context.info(\"🚀 Deploying the project\");\n\n await this.execute(\"deploy\", inlineConfig);\n\n this.context.debug(\"✔ Deployment completed successfully\");\n timer();\n }\n\n /**\n * Finalization/cleanup processing for the Powerlines API\n *\n * @remarks\n * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.\n *\n * @returns A promise that resolves when the finalization process has completed\n */\n public async finalize() {\n const timer = this.context.timer(\"Finalize\");\n this.context.info(\"🏁 Finalization processes started\");\n\n await this.api.finalize();\n\n this.context.debug(\"✔ Finalization completed successfully\");\n timer();\n }\n\n /**\n * Asynchronous disposal method for the Powerlines Engine, which will call the finalize method to perform any necessary cleanup when the engine is disposed of.\n */\n public async [Symbol.asyncDispose]() {\n return this.finalize();\n }\n\n /**\n * Execute a Powerlines command based on the provided execution path and inline configuration, loading the necessary executions from the context and managing their lifecycle.\n *\n * @remarks\n * This method will load the executions for the specified command and inline configuration, then execute each one while managing their lifecycle, including handling their completion and any errors that may occur during execution.\n *\n * @param command - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.\n * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.\n * @returns A promise that resolves when all executions for the specified command have completed\n */\n protected async execute(command: string, inlineConfig: InlineConfig) {\n await Promise.all(\n (await this.context.loadExecutions(command, inlineConfig)).map(\n async execution => {\n try {\n await this.api.execute(command, execution.options, inlineConfig);\n } catch (error) {\n this.context.error(\n `Execution of method \"${command}\" failed for execution with invocation ID \"${\n execution.invocationId\n }\" and execution ID \"${execution.options.executionId}\": \\n\\n${\n error instanceof Error\n ? error.stack || error.message\n : String(error)\n }`\n );\n\n throw error;\n } finally {\n this.context.completeExecution(\n execution.invocationId,\n execution.options.executionId!\n );\n }\n }\n )\n );\n }\n}\n\nexport async function createContext(options: EngineOptions) {\n const port =\n options.port ??\n (await getPort({\n host: options.host || \"localhost\",\n random: true\n }));\n\n const app = createApp();\n const host = createH3DevToolsHost({\n appName: options.framework?.name || \"powerlines\",\n origin: `http://${options.host || \"localhost\"}:${port}`,\n mount: (base, dir) => {\n app.use(base, fromNodeMiddleware(sirv(dir, { dev: true, single: true })));\n }\n });\n\n return PowerlinesEngineContext.from(options, host, {\n backend: \"websocket\",\n websocket: port\n });\n}\n\nexport async function createEngine(\n options: EngineOptions,\n apiPath = \"@powerlines/engine/api\"\n) {\n EventEmitter.setMaxListeners(Infinity);\n\n const context = await createContext(options);\n const host = await ExecutionApiWorker.from(apiPath, {\n root: options.root,\n context\n });\n\n return new PowerlinesEngine(context, host);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,YAAY,OAAO,6BAA6B;;;;AAatD,MAAM,sBAAsB,EAAE,MAAM,WAAiC;CACnE,OAAO,OAAO,GAAG,KAAK,GAAG,SAAS,GAAG;AACvC;;;;;;;;AAWA,MAAM,yBACJ,YACiB;CACjB,IAAI,CAAC,WAAW,CAAC,SAAS,OAAO,GAC/B,OAAO;EAAE,MAAM;EAAW,MAAM;CAAK;CAIvC,IAAI,QAAQ,SAAS,GAAG,GAAG;EACzB,MAAM,CAAC,MAAM,QAAQ,QAAQ,MAAM,GAAG;EACtC,IAAI,CAAC,QAAQ,CAAC,MACZ,MAAM,IAAI,MAAM,0BAA0B,SAAS;EAGrD,OAAO;GAAE;GAAM,MAAM,OAAO,SAAS,MAAM,EAAE;EAAE;CACjD;CAEA,OAAO;EAAE,MAAM;EAAW,MAAM,OAAO,SAAS,SAAS,EAAE;CAAE;AAC/D;;;;AAOA,SAAS,iBAAiB,aAA2C;CACnE,IAAI,YAAY,SACd,OAAO;CAET,IAAI,YAAY,kBAAkB,YAAY,aAC5C,OAAO;AAIX;AAyCA,IAAa,qBAAb,MAAa,mBAA0D;CAsEzD;C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S,MAAM;EACjD,SAAS;EACT,WAAW;CACb,CAAC;AACH;AAEA,eAAsB,aACpB,SACA,UAAU,0BACV;CACA,aAAa,gBAAgB,QAAQ;CAErC,MAAM,UAAU,MAAM,cAAc,OAAO;CAM3C,OAAO,IAAI,iBAAiB,SAAS,MALlB,mBAAmB,KAAK,SAAS;EAClD,MAAM,QAAQ;EACd;CACF,CAAC,CAEwC;AAC3C"}
@@ -1,5 +1,5 @@
1
1
  import { r as EngineOptions } from "./config-DXxu0y4t.mjs";
2
- import { n as EngineExecutionItem, t as EngineContext } from "./context-CNYu12sa.mjs";
2
+ import { n as EngineExecutionItem, t as EngineContext } from "./context-C71mv_aw.mjs";
3
3
  import { FrameworkOptions, InlineConfig, LogFn, LoggerOptions } from "@powerlines/core";
4
4
  import { PowerlinesBaseContext } from "@powerlines/core/context/base-context";
5
5
  import { EnvPaths } from "@stryke/env/get-env-paths";
@@ -36,10 +36,10 @@ declare class PowerlinesEngineContext<TSystemContext = unknown> extends Powerlin
36
36
  * @remarks
37
37
  * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
38
38
  *
39
- * @param method - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.
39
+ * @param command - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.
40
40
  * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.
41
41
  */
42
- loadExecutions(method: string, inlineConfig: InlineConfig): Promise<EngineExecutionItem[]>;
42
+ loadExecutions(command: string, inlineConfig: InlineConfig): Promise<EngineExecutionItem[]>;
43
43
  /**
44
44
  * Complete an execution by removing it from the list of active executions based on the provided invocation ID and execution ID. This method is typically called when an execution has finished or has been terminated, allowing the context to clean up any resources associated with that execution and update its internal state accordingly.
45
45
  *
@@ -50,4 +50,4 @@ declare class PowerlinesEngineContext<TSystemContext = unknown> extends Powerlin
50
50
  }
51
51
  //#endregion
52
52
  export { PowerlinesEngineContext as t };
53
- //# sourceMappingURL=engine-context-EdV-sOjq.d.mts.map
53
+ //# sourceMappingURL=engine-context-CaPJFek0.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine-context-BJiH5JZe.d.cts","names":[],"sources":["../src/context/engine-context.ts"],"mappings":";;;;;;;;cAmDa,uBAAA,mCACH,qBAAA,CAAsB,cAAA,aACnB,aAAA,CAAc,cAAA;EAAA;EAkIP,OAAA,EAAS,aAAA;EAClB,UAAA,EAAY,cAAA;EArIa;;;;;;EAAA,OAgBd,IAAA,0BAAA,CAClB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,YAAA,EACN,UAAA,EAAY,cAAA,GACX,OAAA,CAAQ,uBAAA,CAAwB,cAAA;EA8DnB,YAAA,CAAa,OAAA,GAAS,aAAA,EAAoB,KAAA,GAAQ,KAAA,8BAAK,MAAA;EAAA,IAe5D,UAAA,CAAA,GAAc,mBAAA;EAAA,IAId,QAAA,CAAA,GAAY,mBAAA;EAAA,IAIZ,QAAA,CAAA,GAAY,QAAA;EAAA,IAQZ,SAAA,CAAA,GAAa,gBAAA;EAAA,IAQb,KAAA,CAAA;EAxBc;;;;;;EAAA,UAkChB,WAAA,CACS,OAAA,EAAS,aAAA,EAClB,UAAA,EAAY,cAAA;EAiBV;;;;;;;;;EAHE,cAAA,CACX,MAAA,UACA,YAAA,EAAc,YAAA,GACb,OAAA,CAAQ,mBAAA;EApJc;;;;;;EAwNlB,iBAAA,CAAkB,YAAA,UAAsB,WAAA;AAAA"}
1
+ {"version":3,"file":"engine-context-CaPJFek0.d.mts","names":[],"sources":["../src/context/engine-context.ts"],"mappings":";;;;;;;;cAoDa,uBAAA,mCACH,qBAAA,CAAsB,cAAA,aACnB,aAAA,CAAc,cAAA;EAAA;EAkIP,OAAA,EAAS,aAAA;EAClB,UAAA,EAAY,cAAA;EArIa;;;;;;EAAA,OAgBd,IAAA,0BAAA,CAClB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,YAAA,EACN,UAAA,EAAY,cAAA,GACX,OAAA,CAAQ,uBAAA,CAAwB,cAAA;EA8DnB,YAAA,CAAa,OAAA,GAAS,aAAA,EAAoB,KAAA,GAAQ,KAAA,8BAAK,MAAA;EAAA,IAe5D,UAAA,CAAA,GAAc,mBAAA;EAAA,IAId,QAAA,CAAA,GAAY,mBAAA;EAAA,IAIZ,QAAA,CAAA,GAAY,QAAA;EAAA,IAQZ,SAAA,CAAA,GAAa,gBAAA;EAAA,IAQb,KAAA,CAAA;EAxBc;;;;;;EAAA,UAkChB,WAAA,CACS,OAAA,EAAS,aAAA,EAClB,UAAA,EAAY,cAAA;EAiBV;;;;;;;;;EAHE,cAAA,CACX,OAAA,UACA,YAAA,EAAc,YAAA,GACb,OAAA,CAAQ,mBAAA;EApJc;;;;;;EA6NlB,iBAAA,CAAkB,YAAA,UAAsB,WAAA;AAAA"}
@@ -1,5 +1,5 @@
1
1
  import { r as EngineOptions } from "./config-B6udgcnD.cjs";
2
- import { n as EngineExecutionItem, t as EngineContext } from "./context-CJLRZKhl.cjs";
2
+ import { n as EngineExecutionItem, t as EngineContext } from "./context-ZbJRDGpl.cjs";
3
3
  import { FrameworkOptions, InlineConfig, LogFn, LoggerOptions } from "@powerlines/core";
4
4
  import { ConnectionMeta, DevToolsHost, DevToolsNodeContext } from "devframe/types";
5
5
  import { PowerlinesBaseContext } from "@powerlines/core/context/base-context";
@@ -36,10 +36,10 @@ declare class PowerlinesEngineContext<TSystemContext = unknown> extends Powerlin
36
36
  * @remarks
37
37
  * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
38
38
  *
39
- * @param method - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.
39
+ * @param command - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.
40
40
  * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.
41
41
  */
42
- loadExecutions(method: string, inlineConfig: InlineConfig): Promise<EngineExecutionItem[]>;
42
+ loadExecutions(command: string, inlineConfig: InlineConfig): Promise<EngineExecutionItem[]>;
43
43
  /**
44
44
  * Complete an execution by removing it from the list of active executions based on the provided invocation ID and execution ID. This method is typically called when an execution has finished or has been terminated, allowing the context to clean up any resources associated with that execution and update its internal state accordingly.
45
45
  *
@@ -50,4 +50,4 @@ declare class PowerlinesEngineContext<TSystemContext = unknown> extends Powerlin
50
50
  }
51
51
  //#endregion
52
52
  export { PowerlinesEngineContext as t };
53
- //# sourceMappingURL=engine-context-BJiH5JZe.d.cts.map
53
+ //# sourceMappingURL=engine-context-DDbpdZHC.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine-context-EdV-sOjq.d.mts","names":[],"sources":["../src/context/engine-context.ts"],"mappings":";;;;;;;;cAmDa,uBAAA,mCACH,qBAAA,CAAsB,cAAA,aACnB,aAAA,CAAc,cAAA;EAAA;EAkIP,OAAA,EAAS,aAAA;EAClB,UAAA,EAAY,cAAA;EArIa;;;;;;EAAA,OAgBd,IAAA,0BAAA,CAClB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,YAAA,EACN,UAAA,EAAY,cAAA,GACX,OAAA,CAAQ,uBAAA,CAAwB,cAAA;EA8DnB,YAAA,CAAa,OAAA,GAAS,aAAA,EAAoB,KAAA,GAAQ,KAAA,8BAAK,MAAA;EAAA,IAe5D,UAAA,CAAA,GAAc,mBAAA;EAAA,IAId,QAAA,CAAA,GAAY,mBAAA;EAAA,IAIZ,QAAA,CAAA,GAAY,QAAA;EAAA,IAQZ,SAAA,CAAA,GAAa,gBAAA;EAAA,IAQb,KAAA,CAAA;EAxBc;;;;;;EAAA,UAkChB,WAAA,CACS,OAAA,EAAS,aAAA,EAClB,UAAA,EAAY,cAAA;EAiBV;;;;;;;;;EAHE,cAAA,CACX,MAAA,UACA,YAAA,EAAc,YAAA,GACb,OAAA,CAAQ,mBAAA;EApJc;;;;;;EAwNlB,iBAAA,CAAkB,YAAA,UAAsB,WAAA;AAAA"}
1
+ {"version":3,"file":"engine-context-DDbpdZHC.d.cts","names":[],"sources":["../src/context/engine-context.ts"],"mappings":";;;;;;;;cAoDa,uBAAA,mCACH,qBAAA,CAAsB,cAAA,aACnB,aAAA,CAAc,cAAA;EAAA;EAkIP,OAAA,EAAS,aAAA;EAClB,UAAA,EAAY,cAAA;EArIa;;;;;;EAAA,OAgBd,IAAA,0BAAA,CAClB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,YAAA,EACN,UAAA,EAAY,cAAA,GACX,OAAA,CAAQ,uBAAA,CAAwB,cAAA;EA8DnB,YAAA,CAAa,OAAA,GAAS,aAAA,EAAoB,KAAA,GAAQ,KAAA,8BAAK,MAAA;EAAA,IAe5D,UAAA,CAAA,GAAc,mBAAA;EAAA,IAId,QAAA,CAAA,GAAY,mBAAA;EAAA,IAIZ,QAAA,CAAA,GAAY,QAAA;EAAA,IAQZ,SAAA,CAAA,GAAa,gBAAA;EAAA,IAQb,KAAA,CAAA;EAxBc;;;;;;EAAA,UAkChB,WAAA,CACS,OAAA,EAAS,aAAA,EAClB,UAAA,EAAY,cAAA;EAiBV;;;;;;;;;EAHE,cAAA,CACX,OAAA,UACA,YAAA,EAAc,YAAA,GACb,OAAA,CAAQ,mBAAA;EApJc;;;;;;EA6NlB,iBAAA,CAAkB,YAAA,UAAsB,WAAA;AAAA"}
package/dist/engine.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as createContext, r as createEngine, t as PowerlinesEngine } from "./engine-qMKcp-AX.cjs";
1
+ import { n as createContext, r as createEngine, t as PowerlinesEngine } from "./engine-B5pbfMyg.cjs";
2
2
  export { PowerlinesEngine, createContext, createEngine };
package/dist/engine.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as createContext, r as createEngine, t as PowerlinesEngine } from "./engine-BdhpduRS.mjs";
1
+ import { n as createContext, r as createEngine, t as PowerlinesEngine } from "./engine-CeWEM0TT.mjs";
2
2
  export { PowerlinesEngine, createContext, createEngine };
@@ -24,6 +24,8 @@ function createApi(handlers, inlineConfig = {}) {
24
24
  return async (params) => {
25
25
  const { command, options } = params;
26
26
  if (!handlers[command]) throw new Error(`No API handler function could be found for the command "${command}". Please ensure that a handler function for this command is defined in the \`handlers\` parameter provided to \`createApi\`. The commands available with the current \`handlers\` include: ${(0, _stryke_string_format_list.list)(Object.keys(handlers))}.`);
27
+ options.configIndex ??= 0;
28
+ options.executionId ??= (0, _powerlines_core_plugin_utils.formatExecutionId)(params.inlineConfig.name || options.root, command, options.configIndex);
27
29
  let rpc;
28
30
  if (require_helpers_type_checks.isEngineExecutionOptions(options) && options.channel) {
29
31
  const duplex = new require_helpers_stream.MessagePortDuplex(options.channel);
@@ -1,2 +1,2 @@
1
- import { c as createApi } from "../index-Bwnu1gvX.cjs";
1
+ import { c as createApi } from "../index-QuLZgb8w.cjs";
2
2
  export { createApi };
@@ -1,2 +1,2 @@
1
- import { c as createApi } from "../index-BXQx2xGi.mjs";
1
+ import { c as createApi } from "../index-CBobV6Wm.mjs";
2
2
  export { createApi };
@@ -1,7 +1,7 @@
1
1
  import { createRpcClient } from "./rpc.mjs";
2
2
  import { MessagePortDuplex } from "./stream.mjs";
3
3
  import { isEngineExecutionOptions } from "./type-checks.mjs";
4
- import { consoleLogger } from "@powerlines/core/plugin-utils";
4
+ import { consoleLogger, formatExecutionId } from "@powerlines/core/plugin-utils";
5
5
  import { isSetObject } from "@stryke/type-checks/is-set-object";
6
6
  import { PowerlinesExecutionContext } from "@powerlines/core/context/execution-context";
7
7
  import { resolvePluginConfig } from "@powerlines/core/lib/context-helpers";
@@ -23,6 +23,8 @@ function createApi(handlers, inlineConfig = {}) {
23
23
  return async (params) => {
24
24
  const { command, options } = params;
25
25
  if (!handlers[command]) throw new Error(`No API handler function could be found for the command "${command}". Please ensure that a handler function for this command is defined in the \`handlers\` parameter provided to \`createApi\`. The commands available with the current \`handlers\` include: ${list(Object.keys(handlers))}.`);
26
+ options.configIndex ??= 0;
27
+ options.executionId ??= formatExecutionId(params.inlineConfig.name || options.root, command, options.configIndex);
26
28
  let rpc;
27
29
  if (isEngineExecutionOptions(options) && options.channel) {
28
30
  const duplex = new MessagePortDuplex(options.channel);
@@ -1 +1 @@
1
- {"version":3,"file":"create-api.mjs","names":[],"sources":["../../src/helpers/create-api.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ExecutionContext,\n ExecutionOptions,\n InlineConfig,\n LogFnMeta\n} from \"@powerlines/core\";\nimport { PowerlinesExecutionContext } from \"@powerlines/core/context/execution-context\";\nimport { resolvePluginConfig } from \"@powerlines/core/lib/context-helpers\";\nimport { consoleLogger } from \"@powerlines/core/plugin-utils\";\nimport { list } from \"@stryke/string-format/list\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { DeepPartial, MaybePromise } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { defu } from \"defu\";\nimport type { RpcClient } from \"../types\";\nimport type { ExecutionApiParams } from \"../types/api\";\nimport type { EngineResolvedConfig } from \"../types/config\";\nimport type { EngineSystemContext } from \"../types/context\";\nimport { createRpcClient } from \"./rpc\";\nimport { MessagePortDuplex } from \"./stream\";\nimport { isEngineExecutionOptions } from \"./type-checks\";\n\n/**\n * Creates an execution API with the provided methods. Each method will be wrapped to create an execution context and handle errors appropriately.\n *\n * @param handlers - An object where keys are command names and values are functions that take an execution context and return a promise.\n * @param inlineConfig - An optional partial inline configuration object that will be merged with the context's options when creating the execution context for each command.\n * @returns A function that can be used as an execution API handler, which takes execution parameters and invokes the appropriate command handler with a properly constructed execution context.\n */\nexport function createApi<\n TContext extends ExecutionContext<EngineResolvedConfig, EngineSystemContext> =\n ExecutionContext<EngineResolvedConfig, EngineSystemContext>,\n TOptions extends ExecutionOptions = ExecutionOptions,\n THandlers extends Record<string, (context: TContext) => Promise<void>> =\n Record<string, (context: TContext) => Promise<void>>\n>(\n handlers: THandlers,\n inlineConfig:\n | DeepPartial<InlineConfig>\n | ((prev: InlineConfig) => MaybePromise<InlineConfig>) = {}\n): (\n params: ExecutionApiParams<TOptions, keyof THandlers & string>\n) => Promise<void> {\n return async (\n params: ExecutionApiParams<TOptions, keyof THandlers & string>\n ) => {\n const { command, options } = params;\n\n if (!handlers[command]) {\n throw new Error(\n `No API handler function could be found for the command \"${\n command\n }\". Please ensure that a handler function for this command is defined in the \\`handlers\\` parameter provided to \\`createApi\\`. The commands available with the current \\`handlers\\` include: ${list(\n Object.keys(handlers)\n )}.`\n );\n }\n\n let rpc: RpcClient | undefined;\n if (isEngineExecutionOptions(options) && options.channel) {\n const duplex = new MessagePortDuplex(options.channel);\n duplex.setEncoding(\"utf8\");\n duplex.on(\"data\", (chunk: string) => duplex.write(chunk.toUpperCase()));\n duplex.on(\"end\", () => {\n duplex.end();\n });\n\n if (options.baseURL && options.connection) {\n rpc = createRpcClient(options);\n } else {\n throw new Error(\n `Execution RPC client could not be created - Missing ${\n !options.baseURL\n ? `baseURL${options.connection ? ` and connection information` : \"\"}`\n : \"connection\"\n } or connection information.`\n );\n }\n }\n\n const logFn = (meta: LogFnMeta, message: string) => {\n if (rpc) {\n void rpc.callEvent(\"powerlines:log\", {\n meta: {\n category: \"general\",\n ...options,\n ...(isSetObject(meta) ? meta : { type: meta }),\n logId: uuid(),\n timestamp: Date.now()\n },\n message\n });\n } else {\n consoleLogger(meta, message);\n }\n };\n\n const context = (await PowerlinesExecutionContext.from<\n EngineResolvedConfig,\n EngineSystemContext\n >(\n { ...options, logFn },\n isFunction(inlineConfig)\n ? await Promise.resolve(inlineConfig(params.inlineConfig ?? {}))\n : (defu(inlineConfig, params.inlineConfig ?? {}) as InlineConfig),\n {\n rpc: rpc!\n }\n )) as TContext;\n\n context.logger.info(\n `Starting ${\n titleCase(options.framework?.name) || \"Powerlines\"\n } - ${titleCase(command)} execution (${options.executionId})`\n );\n\n await resolvePluginConfig<EngineResolvedConfig, EngineSystemContext>(\n context\n );\n\n if (!context.config.input) {\n throw new Error(\n `No input defined in configuration for ${\n command\n } execution. Please ensure that the configuration file defines an input for this execution, or provide an inline configuration with the necessary input.`\n );\n }\n\n await handlers[command](context);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiDA,SAAgB,UAOd,UACA,eAE2D,CAAC,GAG3C;CACjB,OAAO,OACL,WACG;EACH,MAAM,EAAE,SAAS,YAAY;EAE7B,IAAI,CAAC,SAAS,UACZ,MAAM,IAAI,MACR,2DACE,QACD,8LAA8L,KAC7L,OAAO,KAAK,QAAQ,CACtB,EAAE,EACJ;EAGF,IAAI;EACJ,IAAI,yBAAyB,OAAO,KAAK,QAAQ,SAAS;GACxD,MAAM,SAAS,IAAI,kBAAkB,QAAQ,OAAO;GACpD,OAAO,YAAY,MAAM;GACzB,OAAO,GAAG,SAAS,UAAkB,OAAO,MAAM,MAAM,YAAY,CAAC,CAAC;GACtE,OAAO,GAAG,aAAa;IACrB,OAAO,IAAI;GACb,CAAC;GAED,IAAI,QAAQ,WAAW,QAAQ,YAC7B,MAAM,gBAAgB,OAAO;QAE7B,MAAM,IAAI,MACR,uDACE,CAAC,QAAQ,UACL,UAAU,QAAQ,aAAa,gCAAgC,OAC/D,aACL,4BACH;EAEJ;EAEA,MAAM,SAAS,MAAiB,YAAoB;GAClD,IAAI,KACF,AAAK,IAAI,UAAU,kBAAkB;IACnC,MAAM;KACJ,UAAU;KACV,GAAG;KACH,GAAI,YAAY,IAAI,IAAI,OAAO,EAAE,MAAM,KAAK;KAC5C,OAAO,KAAK;KACZ,WAAW,KAAK,IAAI;IACtB;IACA;GACF,CAAC;QAED,cAAc,MAAM,OAAO;EAE/B;EAEA,MAAM,UAAW,MAAM,2BAA2B,KAIhD;GAAE,GAAG;GAAS;EAAM,GACpB,WAAW,YAAY,IACnB,MAAM,QAAQ,QAAQ,aAAa,OAAO,gBAAgB,CAAC,CAAC,CAAC,IAC5D,KAAK,cAAc,OAAO,gBAAgB,CAAC,CAAC,GACjD,EACO,IACP,CACF;EAEA,QAAQ,OAAO,KACb,YACE,UAAU,QAAQ,WAAW,IAAI,KAAK,aACvC,KAAK,UAAU,OAAO,EAAE,cAAc,QAAQ,YAAY,EAC7D;EAEA,MAAM,oBACJ,OACF;EAEA,IAAI,CAAC,QAAQ,OAAO,OAClB,MAAM,IAAI,MACR,yCACE,QACD,wJACH;EAGF,MAAM,SAAS,SAAS,OAAO;CACjC;AACF"}
1
+ {"version":3,"file":"create-api.mjs","names":[],"sources":["../../src/helpers/create-api.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n ExecutionContext,\n ExecutionOptions,\n InlineConfig,\n LogFnMeta\n} from \"@powerlines/core\";\nimport { PowerlinesExecutionContext } from \"@powerlines/core/context/execution-context\";\nimport { resolvePluginConfig } from \"@powerlines/core/lib/context-helpers\";\nimport {\n consoleLogger,\n formatExecutionId\n} from \"@powerlines/core/plugin-utils\";\nimport { list } from \"@stryke/string-format/list\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { DeepPartial, MaybePromise } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { defu } from \"defu\";\nimport type { RpcClient } from \"../types\";\nimport type { ExecutionApiParams } from \"../types/api\";\nimport type { EngineResolvedConfig } from \"../types/config\";\nimport type { EngineSystemContext } from \"../types/context\";\nimport { createRpcClient } from \"./rpc\";\nimport { MessagePortDuplex } from \"./stream\";\nimport { isEngineExecutionOptions } from \"./type-checks\";\n\n/**\n * Creates an execution API with the provided methods. Each method will be wrapped to create an execution context and handle errors appropriately.\n *\n * @param handlers - An object where keys are command names and values are functions that take an execution context and return a promise.\n * @param inlineConfig - An optional partial inline configuration object that will be merged with the context's options when creating the execution context for each command.\n * @returns A function that can be used as an execution API handler, which takes execution parameters and invokes the appropriate command handler with a properly constructed execution context.\n */\nexport function createApi<\n TContext extends ExecutionContext<EngineResolvedConfig, EngineSystemContext> =\n ExecutionContext<EngineResolvedConfig, EngineSystemContext>,\n TOptions extends ExecutionOptions = ExecutionOptions,\n THandlers extends Record<string, (context: TContext) => Promise<void>> =\n Record<string, (context: TContext) => Promise<void>>\n>(\n handlers: THandlers,\n inlineConfig:\n | DeepPartial<InlineConfig>\n | ((prev: InlineConfig) => MaybePromise<InlineConfig>) = {}\n): (\n params: ExecutionApiParams<TOptions, keyof THandlers & string>\n) => Promise<void> {\n return async (\n params: ExecutionApiParams<TOptions, keyof THandlers & string>\n ) => {\n const { command, options } = params;\n\n if (!handlers[command]) {\n throw new Error(\n `No API handler function could be found for the command \"${\n command\n }\". Please ensure that a handler function for this command is defined in the \\`handlers\\` parameter provided to \\`createApi\\`. The commands available with the current \\`handlers\\` include: ${list(\n Object.keys(handlers)\n )}.`\n );\n }\n\n options.configIndex ??= 0;\n options.executionId ??= formatExecutionId(\n params.inlineConfig.name || options.root,\n command,\n options.configIndex\n );\n\n let rpc: RpcClient | undefined;\n if (isEngineExecutionOptions(options) && options.channel) {\n const duplex = new MessagePortDuplex(options.channel);\n duplex.setEncoding(\"utf8\");\n duplex.on(\"data\", (chunk: string) => duplex.write(chunk.toUpperCase()));\n duplex.on(\"end\", () => {\n duplex.end();\n });\n\n if (options.baseURL && options.connection) {\n rpc = createRpcClient(options);\n } else {\n throw new Error(\n `Execution RPC client could not be created - Missing ${\n !options.baseURL\n ? `baseURL${options.connection ? ` and connection information` : \"\"}`\n : \"connection\"\n } or connection information.`\n );\n }\n }\n\n const logFn = (meta: LogFnMeta, message: string) => {\n if (rpc) {\n void rpc.callEvent(\"powerlines:log\", {\n meta: {\n category: \"general\",\n ...options,\n ...(isSetObject(meta) ? meta : { type: meta }),\n logId: uuid(),\n timestamp: Date.now()\n },\n message\n });\n } else {\n consoleLogger(meta, message);\n }\n };\n\n const context = (await PowerlinesExecutionContext.from<\n EngineResolvedConfig,\n EngineSystemContext\n >(\n { ...options, logFn },\n isFunction(inlineConfig)\n ? await Promise.resolve(inlineConfig(params.inlineConfig ?? {}))\n : (defu(inlineConfig, params.inlineConfig ?? {}) as InlineConfig),\n {\n rpc: rpc!\n }\n )) as TContext;\n\n context.logger.info(\n `Starting ${\n titleCase(options.framework?.name) || \"Powerlines\"\n } - ${titleCase(command)} execution (${options.executionId})`\n );\n\n await resolvePluginConfig<EngineResolvedConfig, EngineSystemContext>(\n context\n );\n\n if (!context.config.input) {\n throw new Error(\n `No input defined in configuration for ${\n command\n } execution. Please ensure that the configuration file defines an input for this execution, or provide an inline configuration with the necessary input.`\n );\n }\n\n await handlers[command](context);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoDA,SAAgB,UAOd,UACA,eAE2D,CAAC,GAG3C;CACjB,OAAO,OACL,WACG;EACH,MAAM,EAAE,SAAS,YAAY;EAE7B,IAAI,CAAC,SAAS,UACZ,MAAM,IAAI,MACR,2DACE,QACD,8LAA8L,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ACH;EAGF,MAAM,SAAS,SAAS,OAAO;CACjC;AACF"}
@@ -1,4 +1,4 @@
1
- import { c as createApi, o as isApiExecutionOptions, s as isEngineExecutionOptions } from "../index-Bwnu1gvX.cjs";
1
+ import { c as createApi, o as isApiExecutionOptions, s as isEngineExecutionOptions } from "../index-QuLZgb8w.cjs";
2
2
  import { t as finalize } from "../finalize-CuV0r3jg.cjs";
3
3
  import { t as createRpcClient } from "../rpc-5MpqPBPa.cjs";
4
4
  import { i as MessagePortWritable, n as MessagePortDuplexOptions, r as MessagePortReadable, t as MessagePortDuplex } from "../stream-B9jffNbk.cjs";
@@ -1,4 +1,4 @@
1
- import { c as createApi, o as isApiExecutionOptions, s as isEngineExecutionOptions } from "../index-BXQx2xGi.mjs";
1
+ import { c as createApi, o as isApiExecutionOptions, s as isEngineExecutionOptions } from "../index-CBobV6Wm.mjs";
2
2
  import { t as finalize } from "../finalize-CuV0r3jg.mjs";
3
3
  import { t as createRpcClient } from "../rpc-BvVZXS5K.mjs";
4
4
  import { i as MessagePortWritable, n as MessagePortDuplexOptions, r as MessagePortReadable, t as MessagePortDuplex } from "../stream-B9jffNbk.mjs";
@@ -1,2 +1,2 @@
1
- import { o as isApiExecutionOptions, s as isEngineExecutionOptions } from "../index-Bwnu1gvX.cjs";
1
+ import { o as isApiExecutionOptions, s as isEngineExecutionOptions } from "../index-QuLZgb8w.cjs";
2
2
  export { isApiExecutionOptions, isEngineExecutionOptions };
@@ -1,2 +1,2 @@
1
- import { o as isApiExecutionOptions, s as isEngineExecutionOptions } from "../index-BXQx2xGi.mjs";
1
+ import { o as isApiExecutionOptions, s as isEngineExecutionOptions } from "../index-CBobV6Wm.mjs";
2
2
  export { isApiExecutionOptions, isEngineExecutionOptions };
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig, n as EngineExecutionOptions, t as ApiExecutionOptions } from "./config-DXxu0y4t.mjs";
2
- import { r as EngineSystemContext, t as EngineContext } from "./context-CNYu12sa.mjs";
2
+ import { r as EngineSystemContext, t as EngineContext } from "./context-C71mv_aw.mjs";
3
3
  import { BuildInlineConfig, CleanInlineConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, ExecutionContext, ExecutionOptions, InlineConfig, LintInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
4
4
  import { DeepPartial, MaybePromise } from "@stryke/types/base";
5
5
 
@@ -159,4 +159,4 @@ interface Engine extends ExecutionInterface {
159
159
  type ExecutionApi = ReturnType<typeof createApi<ExecutionContext<EngineResolvedConfig, EngineSystemContext>, ExecutionOptions>>;
160
160
  //#endregion
161
161
  export { ExecutionInterface as a, createApi as c, ExecutionApiWorkerInterface as i, ExecutionApi as n, isApiExecutionOptions as o, ExecutionApiParams as r, isEngineExecutionOptions as s, Engine as t };
162
- //# sourceMappingURL=index-BXQx2xGi.d.mts.map
162
+ //# sourceMappingURL=index-CBobV6Wm.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-BXQx2xGi.d.mts","names":[],"sources":["../src/helpers/create-api.ts","../src/helpers/type-checks.ts","../src/types/api.ts"],"mappings":";;;;;;;;;AAiDA;;;;iBAAgB,SAAA,kBACG,gBAAA,CAAiB,oBAAA,EAAsB,mBAAA,IACtD,gBAAA,CAAiB,oBAAA,EAAsB,mBAAA,oBACxB,gBAAA,GAAmB,gBAAA,oBAClB,MAAA,UAAgB,OAAA,EAAS,QAAA,KAAa,OAAA,UACtD,MAAA,UAAgB,OAAA,EAAS,QAAA,KAAa,OAAA,QAAA,CAExC,QAAA,EAAU,SAAA,EACV,YAAA,GACI,WAAA,CAAY,YAAA,MACV,IAAA,EAAM,YAAA,KAAiB,YAAA,CAAa,YAAA,MAE1C,MAAA,EAAQ,kBAAA,CAAmB,QAAA,QAAgB,SAAA,eACxC,OAAA;;;;;;;;;iBCpCW,wBAAA,CACd,OAAA,EAAS,mBAAA,GAAsB,sBAAA,GAC9B,OAAA,IAAW,sBAAA;ADqBd;;;;;;AAAA,iB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AAQ,YAAA,EAAc,iBAAA,KAAsB,OAAA;;;ADpF9C;;;;EC4FE,IAAA,GAAO,YAAA,EAAc,gBAAA,KAAqB,OAAA;ED1F9B;;;;;;;;ECoGZ,MAAA,GAAS,YAAA,EAAc,kBAAA,KAAuB,OAAA;EDpGZ;AAUpC;;;;;;;ECoGE,QAAA,QAAgB,OAAA;AAAA;AAAA,UAGD,kBAAA,kBACE,gBAAA,GAAmB,gBAAA;EDvGpC;;;EC6GA,OAAA,EAAS,QAAA;ED5GsB;;;ECiH/B,OAAA,EAAS,QAAA;EA/GM;;;EAoHf,YAAA,EAAc,YAAA;AAAA;AAAA,UAGC,2BAAA;EACf,OAAA,GACE,OAAA,UACA,OAAA,EAAS,sBAAA,EACT,YAAA,EAAc,YAAA,KACX,OAAA;EACL,QAAA,QAAgB,OAAA;AAAA;;;;UAMD,MAAA,SAAe,kBAAA;EA1ET;;;EA8ErB,OAAA,EAAS,aAAA;EA3DY;;;EAgErB,GAAA,EAAK,2BAAA;AAAA;AAAA,KAGK,YAAA,GAAe,UAAA,QAClB,SAAA,CACL,gBAAA,CAAiB,oBAAA,EAAsB,mBAAA,GACvC,gBAAA"}
@@ -1,5 +1,5 @@
1
1
  import { i as EngineResolvedConfig, n as EngineExecutionOptions, t as ApiExecutionOptions } from "./config-B6udgcnD.cjs";
2
- import { r as EngineSystemContext, t as EngineContext } from "./context-CJLRZKhl.cjs";
2
+ import { r as EngineSystemContext, t as EngineContext } from "./context-ZbJRDGpl.cjs";
3
3
  import { BuildInlineConfig, CleanInlineConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, ExecutionContext, ExecutionOptions, InlineConfig, LintInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
4
4
  import { DeepPartial, MaybePromise } from "@stryke/types/base";
5
5
 
@@ -159,4 +159,4 @@ interface Engine extends ExecutionInterface {
159
159
  type ExecutionApi = ReturnType<typeof createApi<ExecutionContext<EngineResolvedConfig, EngineSystemContext>, ExecutionOptions>>;
160
160
  //#endregion
161
161
  export { ExecutionInterface as a, createApi as c, ExecutionApiWorkerInterface as i, ExecutionApi as n, isApiExecutionOptions as o, ExecutionApiParams as r, isEngineExecutionOptions as s, Engine as t };
162
- //# sourceMappingURL=index-Bwnu1gvX.d.cts.map
162
+ //# sourceMappingURL=index-QuLZgb8w.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-Bwnu1gvX.d.cts","names":[],"sources":["../src/helpers/create-api.ts","../src/helpers/type-checks.ts","../src/types/api.ts"],"mappings":";;;;;;;;;AAiDA;;;;iBAAgB,SAAA,kBACG,gBAAA,CAAiB,oBAAA,EAAsB,mBAAA,IACtD,gBAAA,CAAiB,oBAAA,EAAsB,mBAAA,oBACxB,gBAAA,GAAmB,gBAAA,oBAClB,MAAA,UAAgB,OAAA,EAAS,QAAA,KAAa,OAAA,UACtD,MAAA,UAAgB,OAAA,EAAS,QAAA,KAAa,OAAA,QAAA,CAExC,QAAA,EAAU,SAAA,EACV,YAAA,GACI,WAAA,CAAY,YAAA,MACV,IAAA,EAAM,YAAA,KAAiB,YAAA,CAAa,YAAA,MAE1C,MAAA,EAAQ,kBAAA,CAAmB,QAAA,QAAgB,SAAA,eACxC,OAAA;;;;;;;;;iBCpCW,wBAAA,CACd,OAAA,EAAS,mBAAA,GAAsB,sBAAA,GAC9B,OAAA,IAAW,sBAAA;ADqBd;;;;;;AAAA,iBCXgB,qBAAA,CACd,OAAA,EAAS,mBAAA,GAAsB,sBAAA,GAC9B,OAAA,IAAW,mBAAA;;;;;;;ADSd;;UEPiB,kBAAA;EFQmB;;;;;;;;EEClC,OAAA,GAAU,YAAA,EAAc,mBAAA,KAAwB,OAAA;EFEQ;;;;;;;;EEQxD,KAAA,GAAQ,YAAA,EAAc,iBAAA,KAAsB,OAAA;EFFF;;;;;;;;;EEa1C,MAAA,GAAS,YAAA,EAAc,kBAAA,KAAuB,OAAA;EFtBZ;;;;;;;;;EEiClC,KAAA,GAAQ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AA;EA/GM;;;EAoHf,YAAA,EAAc,YAAA;AAAA;AAAA,UAGC,2BAAA;EACf,OAAA,GACE,OAAA,UACA,OAAA,EAAS,sBAAA,EACT,YAAA,EAAc,YAAA,KACX,OAAA;EACL,QAAA,QAAgB,OAAA;AAAA;;;;UAMD,MAAA,SAAe,kBAAA;EA1ET;;;EA8ErB,OAAA,EAAS,aAAA;EA3DY;;;EAgErB,GAAA,EAAK,2BAAA;AAAA;AAAA,KAGK,YAAA,GAAe,UAAA,QAClB,SAAA,CACL,gBAAA,CAAiB,oBAAA,EAAsB,mBAAA,GACvC,gBAAA"}
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { C as RpcPayloadMetadata, D as WrappedRpcFunction, E as WrapRpcFunctions, O as WrappedRpcFunctions, S as RpcPayloadEnvelop, T as WrapRpcFunction, _ as RpcClientHost, a as RpcClientOptions, b as RpcFunction, c as InputRpcFunction, d as RpcClient, f as RpcClientCall, g as RpcClientFunctions, h as RpcClientEvents, i as EngineResolvedConfig, l as InputRpcFunctions, m as RpcClientCallOptional, n as EngineExecutionOptions, o as ExtractRpcFunction, p as RpcClientCallEvent, r as EngineOptions, s as ExtractRpcFunctions, t as ApiExecutionOptions, u as LogPayload, v as RpcClientRemoteFunctions, w as RpcServerFunctions, x as RpcFunctions, y as RpcContext } from "./config-B6udgcnD.cjs";
2
- import { a as ExecutionHookScopeState, c as ExecutionScopeType, i as ExecutionCommandScopeState, l as ExecutionState, n as EngineExecutionItem, o as ExecutionPluginScopeState, r as EngineSystemContext, s as ExecutionScopeState, t as EngineContext } from "./context-CJLRZKhl.cjs";
3
- import { a as ExecutionInterface, i as ExecutionApiWorkerInterface, n as ExecutionApi, r as ExecutionApiParams, t as Engine } from "./index-Bwnu1gvX.cjs";
4
- import { t as PowerlinesEngineContext } from "./engine-context-BJiH5JZe.cjs";
5
- import { n as createContext, r as createEngine, t as PowerlinesEngine } from "./engine-qMKcp-AX.cjs";
2
+ import { a as ExecutionHookScopeState, c as ExecutionScopeType, i as ExecutionCommandScopeState, l as ExecutionState, n as EngineExecutionItem, o as ExecutionPluginScopeState, r as EngineSystemContext, s as ExecutionScopeState, t as EngineContext } from "./context-ZbJRDGpl.cjs";
3
+ import { a as ExecutionInterface, i as ExecutionApiWorkerInterface, n as ExecutionApi, r as ExecutionApiParams, t as Engine } from "./index-QuLZgb8w.cjs";
4
+ import { t as PowerlinesEngineContext } from "./engine-context-DDbpdZHC.cjs";
5
+ import { n as createContext, r as createEngine, t as PowerlinesEngine } from "./engine-B5pbfMyg.cjs";
6
6
  export { type ApiExecutionOptions, type Engine, type EngineContext, type EngineExecutionItem, type EngineExecutionOptions, type EngineOptions, type EngineResolvedConfig, type EngineSystemContext, type ExecutionApi, type ExecutionApiParams, type ExecutionApiWorkerInterface, type ExecutionCommandScopeState, type ExecutionHookScopeState, type ExecutionInterface, type ExecutionPluginScopeState, type ExecutionScopeState, type ExecutionScopeType, type ExecutionState, type ExtractRpcFunction, type ExtractRpcFunctions, type InputRpcFunction, type InputRpcFunctions, type LogPayload, PowerlinesEngine, PowerlinesEngineContext, type RpcClient, type RpcClientCall, type RpcClientCallEvent, type RpcClientCallOptional, type RpcClientEvents, type RpcClientFunctions, type RpcClientHost, type RpcClientOptions, type RpcClientRemoteFunctions, type RpcContext, type RpcFunction, type RpcFunctions, type RpcPayloadEnvelop, type RpcPayloadMetadata, type RpcServerFunctions, type WrapRpcFunction, type WrapRpcFunctions, type WrappedRpcFunction, type WrappedRpcFunctions, createContext, createEngine };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { C as RpcPayloadMetadata, D as WrappedRpcFunction, E as WrapRpcFunctions, O as WrappedRpcFunctions, S as RpcPayloadEnvelop, T as WrapRpcFunction, _ as RpcClientHost, a as RpcClientOptions, b as RpcFunction, c as InputRpcFunction, d as RpcClient, f as RpcClientCall, g as RpcClientFunctions, h as RpcClientEvents, i as EngineResolvedConfig, l as InputRpcFunctions, m as RpcClientCallOptional, n as EngineExecutionOptions, o as ExtractRpcFunction, p as RpcClientCallEvent, r as EngineOptions, s as ExtractRpcFunctions, t as ApiExecutionOptions, u as LogPayload, v as RpcClientRemoteFunctions, w as RpcServerFunctions, x as RpcFunctions, y as RpcContext } from "./config-DXxu0y4t.mjs";
2
- import { a as ExecutionHookScopeState, c as ExecutionScopeType, i as ExecutionCommandScopeState, l as ExecutionState, n as EngineExecutionItem, o as ExecutionPluginScopeState, r as EngineSystemContext, s as ExecutionScopeState, t as EngineContext } from "./context-CNYu12sa.mjs";
3
- import { a as ExecutionInterface, i as ExecutionApiWorkerInterface, n as ExecutionApi, r as ExecutionApiParams, t as Engine } from "./index-BXQx2xGi.mjs";
4
- import { t as PowerlinesEngineContext } from "./engine-context-EdV-sOjq.mjs";
5
- import { n as createContext, r as createEngine, t as PowerlinesEngine } from "./engine-BdhpduRS.mjs";
2
+ import { a as ExecutionHookScopeState, c as ExecutionScopeType, i as ExecutionCommandScopeState, l as ExecutionState, n as EngineExecutionItem, o as ExecutionPluginScopeState, r as EngineSystemContext, s as ExecutionScopeState, t as EngineContext } from "./context-C71mv_aw.mjs";
3
+ import { a as ExecutionInterface, i as ExecutionApiWorkerInterface, n as ExecutionApi, r as ExecutionApiParams, t as Engine } from "./index-CBobV6Wm.mjs";
4
+ import { t as PowerlinesEngineContext } from "./engine-context-CaPJFek0.mjs";
5
+ import { n as createContext, r as createEngine, t as PowerlinesEngine } from "./engine-CeWEM0TT.mjs";
6
6
  export { type ApiExecutionOptions, type Engine, type EngineContext, type EngineExecutionItem, type EngineExecutionOptions, type EngineOptions, type EngineResolvedConfig, type EngineSystemContext, type ExecutionApi, type ExecutionApiParams, type ExecutionApiWorkerInterface, type ExecutionCommandScopeState, type ExecutionHookScopeState, type ExecutionInterface, type ExecutionPluginScopeState, type ExecutionScopeState, type ExecutionScopeType, type ExecutionState, type ExtractRpcFunction, type ExtractRpcFunctions, type InputRpcFunction, type InputRpcFunctions, type LogPayload, PowerlinesEngine, PowerlinesEngineContext, type RpcClient, type RpcClientCall, type RpcClientCallEvent, type RpcClientCallOptional, type RpcClientEvents, type RpcClientFunctions, type RpcClientHost, type RpcClientOptions, type RpcClientRemoteFunctions, type RpcContext, type RpcFunction, type RpcFunctions, type RpcPayloadEnvelop, type RpcPayloadMetadata, type RpcServerFunctions, type WrapRpcFunction, type WrapRpcFunctions, type WrappedRpcFunction, type WrappedRpcFunctions, createContext, createEngine };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/engine",
3
- "version": "0.49.27",
3
+ "version": "0.49.28",
4
4
  "private": false,
5
5
  "description": "An internal package containing the core engine modules for Powerlines.",
6
6
  "homepage": "https://stormsoftware.com",
@@ -116,7 +116,7 @@
116
116
  "types": "./dist/index.d.cts",
117
117
  "files": ["dist"],
118
118
  "dependencies": {
119
- "@powerlines/core": "^0.48.25",
119
+ "@powerlines/core": "^0.48.26",
120
120
  "@storm-software/config": "^1.137.67",
121
121
  "@storm-software/config-tools": "^1.190.35",
122
122
  "@stryke/async": "^0.1.7",
@@ -152,5 +152,5 @@
152
152
  "@types/node": "^25.9.1",
153
153
  "typescript": "^6.0.3"
154
154
  },
155
- "gitHead": "2a7208605db4b9d25c7e6462fe44deb0284e3b8c"
155
+ "gitHead": "96a654a26c414db84da2bd824d8f821e6c0fe3ff"
156
156
  }