@powerlines/engine 0.49.47 → 0.49.49

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 (39) hide show
  1. package/README.md +4 -10
  2. package/dist/_internal/execution-api-worker.d.cts +3 -2
  3. package/dist/_internal/execution-api-worker.d.cts.map +1 -1
  4. package/dist/_internal/execution-api-worker.d.mts +3 -2
  5. package/dist/_internal/execution-api-worker.d.mts.map +1 -1
  6. package/dist/_internal/execution-api-worker.mjs.map +1 -1
  7. package/dist/api/build.mjs.map +1 -1
  8. package/dist/api/prepare.cjs +2 -1
  9. package/dist/api/prepare.d.cts.map +1 -1
  10. package/dist/api/prepare.d.mts.map +1 -1
  11. package/dist/api/prepare.mjs +2 -1
  12. package/dist/api/prepare.mjs.map +1 -1
  13. package/dist/api/types.cjs +2 -1
  14. package/dist/api/types.d.cts.map +1 -1
  15. package/dist/api/types.d.mts.map +1 -1
  16. package/dist/api/types.mjs +2 -1
  17. package/dist/api/types.mjs.map +1 -1
  18. package/dist/context/engine-context.cjs +6 -2
  19. package/dist/context/engine-context.d.cts +2 -1
  20. package/dist/context/engine-context.d.cts.map +1 -1
  21. package/dist/context/engine-context.d.mts +2 -1
  22. package/dist/context/engine-context.d.mts.map +1 -1
  23. package/dist/context/engine-context.mjs +6 -2
  24. package/dist/context/engine-context.mjs.map +1 -1
  25. package/dist/engine.d.cts +11 -10
  26. package/dist/engine.d.cts.map +1 -1
  27. package/dist/engine.d.mts +11 -10
  28. package/dist/engine.d.mts.map +1 -1
  29. package/dist/engine.mjs.map +1 -1
  30. package/dist/helpers/create-api.cjs +1 -1
  31. package/dist/helpers/create-api.mjs +1 -1
  32. package/dist/helpers/create-api.mjs.map +1 -1
  33. package/dist/helpers/finalize.mjs.map +1 -1
  34. package/dist/helpers/stream.mjs.map +1 -1
  35. package/dist/types/context.d.cts +2 -1
  36. package/dist/types/context.d.cts.map +1 -1
  37. package/dist/types/context.d.mts +2 -1
  38. package/dist/types/context.d.mts.map +1 -1
  39. package/package.json +4 -4
@@ -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 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,QAAQC,YAAY,QAAQ,WACxB,gBAAgB,QAAQ,QAAQ,IAChC,MAAM,mBAAmB,QAAQ,GAAG;EAExC,OAAO;CACT;CAE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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
+ {"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 { getName } from \"@powerlines/core/plugin-utils/context-helpers\";\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 { PartialKeys } from \"@stryke/types/base\";\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: PartialKeys<InlineConfig, \"command\">\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, command }\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 ||\n inlineConfig.name ||\n (await getName(this.cwd, 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":";;;;;;;;;;;;AAsDA,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,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M,OAAO,YACX,KAAK,KACL,aAAa,MACb,aAAa,UACf;EAEA,MAAM,SAAS,MAAM,iBACnB,KAAK,KACL,MACA,KAAK,WAAW,MAChB,KAAK,OACL;GAAE,GAAG;GAAc;EAAQ,CAC7B;EACA,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,8BAA8B;EAGhD,MAAM,eAAe,KAAK;EAC1B,MAAM,aAAa,MAAM,QAAQ,IAC/B,QAAQ,OAAO,MAAM,CAAC,CAAC,IAAI,OAAO,GAAG,gBAAgB;GACnD,MAAM,cAAc,kBAClB,OAAO,OAAO,QACZ,aAAa,QACZ,MAAM,QAAQ,KAAK,KAAK,IAAI,GAC/B,SACA,WACF;GAEA,MAAM,UAAU;IACd,KAAK,KAAK;IACV;IACA,WAAW,KAAK;IAChB,OAAO,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"}
package/dist/engine.d.cts CHANGED
@@ -4,6 +4,7 @@ import { Engine } from "./types/api.cjs";
4
4
  import { PowerlinesEngineContext } from "./context/engine-context.cjs";
5
5
  import { ExecutionApiWorker } from "./_internal/execution-api-worker.cjs";
6
6
  import { BuildInlineConfig, CleanInlineConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, InlineConfig, LintInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
7
+ import { PartialKeys } from "@stryke/types/base";
7
8
 
8
9
  //#region src/engine.d.ts
9
10
  /**
@@ -38,7 +39,7 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
38
39
  * @param inlineConfig - The inline configuration for the create command
39
40
  * @returns A promise that resolves when the project has been created
40
41
  */
41
- create(inlineConfig: CreateInlineConfig): Promise<void>;
42
+ create(inlineConfig: PartialKeys<CreateInlineConfig, "command">): Promise<void>;
42
43
  /**
43
44
  * Generate the Powerlines typescript declaration file
44
45
  *
@@ -47,7 +48,7 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
47
48
  *
48
49
  * @param inlineConfig - The inline configuration for the types command
49
50
  */
50
- types(inlineConfig: TypesInlineConfig): Promise<void>;
51
+ types(inlineConfig: PartialKeys<TypesInlineConfig, "command">): Promise<void>;
51
52
  /**
52
53
  * Prepare the Powerlines API
53
54
  *
@@ -56,7 +57,7 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
56
57
  *
57
58
  * @param inlineConfig - The inline configuration for the prepare command
58
59
  */
59
- prepare(inlineConfig: PrepareInlineConfig): Promise<void>;
60
+ prepare(inlineConfig: PartialKeys<PrepareInlineConfig, "command">): Promise<void>;
60
61
  /**
61
62
  * Clean any previously prepared artifacts
62
63
  *
@@ -66,14 +67,14 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
66
67
  * @param inlineConfig - The inline configuration for the clean command
67
68
  * @returns A promise that resolves when the clean command has completed
68
69
  */
69
- clean(inlineConfig: CleanInlineConfig): Promise<void>;
70
+ clean(inlineConfig: PartialKeys<CleanInlineConfig, "command">): Promise<void>;
70
71
  /**
71
72
  * Lint the project
72
73
  *
73
74
  * @param inlineConfig - The inline configuration for the lint command
74
75
  * @returns A promise that resolves when the lint command has completed
75
76
  */
76
- lint(inlineConfig: LintInlineConfig): Promise<void>;
77
+ lint(inlineConfig: PartialKeys<LintInlineConfig, "command">): Promise<void>;
77
78
  /**
78
79
  * Test the project
79
80
  *
@@ -83,7 +84,7 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
83
84
  * @param inlineConfig - The inline configuration for the test command
84
85
  * @returns A promise that resolves when the test command has completed
85
86
  */
86
- test(inlineConfig: TestInlineConfig): Promise<void>;
87
+ test(inlineConfig: PartialKeys<TestInlineConfig, "command">): Promise<void>;
87
88
  /**
88
89
  * Build the project
89
90
  *
@@ -93,14 +94,14 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
93
94
  * @param inlineConfig - The inline configuration for the build command
94
95
  * @returns A promise that resolves when the build command has completed
95
96
  */
96
- build(inlineConfig: BuildInlineConfig): Promise<void>;
97
+ build(inlineConfig: PartialKeys<BuildInlineConfig, "command">): Promise<void>;
97
98
  /**
98
99
  * Prepare the documentation for the project
99
100
  *
100
101
  * @param inlineConfig - The inline configuration for the docs command
101
102
  * @returns A promise that resolves when the documentation generation has completed
102
103
  */
103
- docs(inlineConfig: DocsInlineConfig): Promise<void>;
104
+ docs(inlineConfig: PartialKeys<DocsInlineConfig, "command">): Promise<void>;
104
105
  /**
105
106
  * Deploy the project source code
106
107
  *
@@ -110,7 +111,7 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
110
111
  * @param inlineConfig - The inline configuration for the deploy command
111
112
  * @returns A promise that resolves when the deploy command has completed
112
113
  */
113
- deploy(inlineConfig: DeployInlineConfig): Promise<void>;
114
+ deploy(inlineConfig: PartialKeys<DeployInlineConfig, "command">): Promise<void>;
114
115
  /**
115
116
  * Finalization/cleanup processing for the Powerlines API
116
117
  *
@@ -134,7 +135,7 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
134
135
  * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.
135
136
  * @returns A promise that resolves when all executions for the specified command have completed
136
137
  */
137
- protected execute(command: string, inlineConfig: InlineConfig): Promise<void>;
138
+ protected execute(command: string, inlineConfig: PartialKeys<InlineConfig, "command">): Promise<void>;
138
139
  }
139
140
  declare function createContext(options: EngineOptions): Promise<PowerlinesEngineContext<unknown>>;
140
141
  declare function createEngine(options: EngineOptions, apiPath?: string): Promise<PowerlinesEngine>;
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.cts","names":[],"sources":["../src/engine.ts"],"mappings":";;;;;;;;;;AA8CA;;;cAAa,gBAAA,YAA4B,MAAA,EAAQ,eAAA;EAAA;EAgCnB;;;EAAA,IAlBjB,OAAA,IAAW,aAAA;EAkDW;;;EAAA,IA3CtB,GAAA,IAAO,kBAAA;EAgFe;;;;;;;cArEd,OAAA,EAAS,aAAA,EAAe,GAAA,EAAK,kBAAA;EA2IhB;;;;;;;;;EA7HnB,MAAA,CAAO,YAAA,EAAc,kBAAA,GAAkB,OAAA;EA9CL;;;;;;;;EAgElC,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;EA3ChC;;;;;;;;EA6DL,OAAA,CAAQ,YAAA,EAAc,mBAAA,GAAmB,OAAA;EApCF;;;;;;;;;EAuDvC,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;EAAjB;;;;;;EAgBpB,IAAA,CAAK,YAAA,EAAc,gBAAA,GAAgB,OAAA;EAmBnC;;;;;;;;;EAAA,IAAA,CAAK,YAAA,EAAc,gBAAA,GAAgB,OAAA;EAmC9B;;;;;;;;;EAhBL,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;EAkEhB;;;;;;EAlDrB,IAAA,CAAK,YAAA,EAAc,gBAAA,GAAgB,OAAA;EAgEmB;AA8BrE;;;;;;;;EA3Ee,MAAA,CAAO,YAAA,EAAc,kBAAA,GAAkB,OAAA;EA2ElB;;;;AAAsB;AAuB1D;;;EAhFe,QAAA,IAAQ,OAAA;EAkFa;;;EAAA,CArEpB,MAAA,CAAO,YAAA,KAAa,OAAA;EAoEzB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AA,eAA8B,OAAA;EAgC5C;;;;;;;;EAbD,QAAA,IAAQ,OAAA;EA6B+B;AAAA;AA+BtD;EA/BsD,CAhBtC,MAAA,CAAO,YAAA,KAAa,OAAA;;;;;;;;;;;YAclB,OAAA,CACd,OAAA,UACA,YAAA,EAAc,WAAA,CAAY,YAAA,eAAwB,OAAA;AAAA;AAAA,iBA+BhC,aAAA,CAAc,OAAA,EAAS,aAAA,GAAa,OAAA,CAAA,uBAAA;AAAA,iBAuBpC,YAAA,CACpB,OAAA,EAAS,aAAA,EACT,OAAA,YAAkC,OAAA,CAAA,gBAAA"}
package/dist/engine.d.mts CHANGED
@@ -4,6 +4,7 @@ import { Engine } from "./types/api.mjs";
4
4
  import { PowerlinesEngineContext } from "./context/engine-context.mjs";
5
5
  import { ExecutionApiWorker } from "./_internal/execution-api-worker.mjs";
6
6
  import { BuildInlineConfig, CleanInlineConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, InlineConfig, LintInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
7
+ import { PartialKeys } from "@stryke/types/base";
7
8
 
8
9
  //#region src/engine.d.ts
9
10
  /**
@@ -38,7 +39,7 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
38
39
  * @param inlineConfig - The inline configuration for the create command
39
40
  * @returns A promise that resolves when the project has been created
40
41
  */
41
- create(inlineConfig: CreateInlineConfig): Promise<void>;
42
+ create(inlineConfig: PartialKeys<CreateInlineConfig, "command">): Promise<void>;
42
43
  /**
43
44
  * Generate the Powerlines typescript declaration file
44
45
  *
@@ -47,7 +48,7 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
47
48
  *
48
49
  * @param inlineConfig - The inline configuration for the types command
49
50
  */
50
- types(inlineConfig: TypesInlineConfig): Promise<void>;
51
+ types(inlineConfig: PartialKeys<TypesInlineConfig, "command">): Promise<void>;
51
52
  /**
52
53
  * Prepare the Powerlines API
53
54
  *
@@ -56,7 +57,7 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
56
57
  *
57
58
  * @param inlineConfig - The inline configuration for the prepare command
58
59
  */
59
- prepare(inlineConfig: PrepareInlineConfig): Promise<void>;
60
+ prepare(inlineConfig: PartialKeys<PrepareInlineConfig, "command">): Promise<void>;
60
61
  /**
61
62
  * Clean any previously prepared artifacts
62
63
  *
@@ -66,14 +67,14 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
66
67
  * @param inlineConfig - The inline configuration for the clean command
67
68
  * @returns A promise that resolves when the clean command has completed
68
69
  */
69
- clean(inlineConfig: CleanInlineConfig): Promise<void>;
70
+ clean(inlineConfig: PartialKeys<CleanInlineConfig, "command">): Promise<void>;
70
71
  /**
71
72
  * Lint the project
72
73
  *
73
74
  * @param inlineConfig - The inline configuration for the lint command
74
75
  * @returns A promise that resolves when the lint command has completed
75
76
  */
76
- lint(inlineConfig: LintInlineConfig): Promise<void>;
77
+ lint(inlineConfig: PartialKeys<LintInlineConfig, "command">): Promise<void>;
77
78
  /**
78
79
  * Test the project
79
80
  *
@@ -83,7 +84,7 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
83
84
  * @param inlineConfig - The inline configuration for the test command
84
85
  * @returns A promise that resolves when the test command has completed
85
86
  */
86
- test(inlineConfig: TestInlineConfig): Promise<void>;
87
+ test(inlineConfig: PartialKeys<TestInlineConfig, "command">): Promise<void>;
87
88
  /**
88
89
  * Build the project
89
90
  *
@@ -93,14 +94,14 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
93
94
  * @param inlineConfig - The inline configuration for the build command
94
95
  * @returns A promise that resolves when the build command has completed
95
96
  */
96
- build(inlineConfig: BuildInlineConfig): Promise<void>;
97
+ build(inlineConfig: PartialKeys<BuildInlineConfig, "command">): Promise<void>;
97
98
  /**
98
99
  * Prepare the documentation for the project
99
100
  *
100
101
  * @param inlineConfig - The inline configuration for the docs command
101
102
  * @returns A promise that resolves when the documentation generation has completed
102
103
  */
103
- docs(inlineConfig: DocsInlineConfig): Promise<void>;
104
+ docs(inlineConfig: PartialKeys<DocsInlineConfig, "command">): Promise<void>;
104
105
  /**
105
106
  * Deploy the project source code
106
107
  *
@@ -110,7 +111,7 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
110
111
  * @param inlineConfig - The inline configuration for the deploy command
111
112
  * @returns A promise that resolves when the deploy command has completed
112
113
  */
113
- deploy(inlineConfig: DeployInlineConfig): Promise<void>;
114
+ deploy(inlineConfig: PartialKeys<DeployInlineConfig, "command">): Promise<void>;
114
115
  /**
115
116
  * Finalization/cleanup processing for the Powerlines API
116
117
  *
@@ -134,7 +135,7 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
134
135
  * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.
135
136
  * @returns A promise that resolves when all executions for the specified command have completed
136
137
  */
137
- protected execute(command: string, inlineConfig: InlineConfig): Promise<void>;
138
+ protected execute(command: string, inlineConfig: PartialKeys<InlineConfig, "command">): Promise<void>;
138
139
  }
139
140
  declare function createContext(options: EngineOptions): Promise<PowerlinesEngineContext<unknown>>;
140
141
  declare function createEngine(options: EngineOptions, apiPath?: string): Promise<PowerlinesEngine>;
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.mts","names":[],"sources":["../src/engine.ts"],"mappings":";;;;;;;;;;AA8CA;;;cAAa,gBAAA,YAA4B,MAAA,EAAQ,eAAA;EAAA;EAgCnB;;;EAAA,IAlBjB,OAAA,IAAW,aAAA;EAkDW;;;EAAA,IA3CtB,GAAA,IAAO,kBAAA;EAgFe;;;;;;;cArEd,OAAA,EAAS,aAAA,EAAe,GAAA,EAAK,kBAAA;EA2IhB;;;;;;;;;EA7HnB,MAAA,CAAO,YAAA,EAAc,kBAAA,GAAkB,OAAA;EA9CL;;;;;;;;EAgElC,KAAA,CAAM,YAAA,EAAc,iBAAA,GAAiB,OAAA;EA3ChC;;;;;;;;EA6DL,OAAA,CAAQ,YAAA,EAAc,mBAAA,GAAmB,OAAA;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;;;;;;;EAoF1B,OAAA,CACX,YAAA,EAAc,WAAA,CAAY,mBAAA,eAA+B,OAAA;EAhEhD;;;;;;;;;EAoFE,KAAA,CAAM,YAAA,EAAc,WAAA,CAAY,iBAAA,eAA6B,OAAA;EA1DxE;;;;;;EA0EW,IAAA,CAAK,YAAA,EAAc,WAAA,CAAY,gBAAA,eAA4B,OAAA;EArC3D;;;;;;;;;EAwDA,IAAA,CAAK,YAAA,EAAc,WAAA,CAAY,gBAAA,eAA4B,OAAA;EAnB3D;;;;;;;;;EAsCA,KAAA,CAAM,YAAA,EAAc,WAAA,CAAY,iBAAA,eAA6B,OAAA;EAA7D;;;;;;EAgBA,IAAA,CAAK,YAAA,EAAc,WAAA,CAAY,gBAAA,eAA4B,OAAA;EAA5B;;;;;;;;;EAmB/B,MAAA,CACX,YAAA,EAAc,WAAA,CAAY,kBAAA,eAA8B,OAAA;EAgC5C;;;;;;;;EAbD,QAAA,IAAQ,OAAA;EA6B+B;AAAA;AA+BtD;EA/BsD,CAhBtC,MAAA,CAAO,YAAA,KAAa,OAAA;;;;;;;;;;;YAclB,OAAA,CACd,OAAA,UACA,YAAA,EAAc,WAAA,CAAY,YAAA,eAAwB,OAAA;AAAA;AAAA,iBA+BhC,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.mjs","names":["#context","#api"],"sources":["../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 {\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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cAAa;GACjB,IAAI;IACF,MAAM,KAAK,IAAI,QAAQ,SAAS,UAAU,SAAS,YAAY;GACjE,SAAS,OAAO;IACd,KAAK,QAAQ,MACX,wBAAwB,QAAQ,6CAC9B,UAAU,aACX,sBAAsB,UAAU,QAAQ,YAAY,SACnD,iBAAiB,QACb,MAAM,SAAS,MAAM,UACrB,OAAO,KAAK,GAEpB;IAEA,MAAM;GACR,UAAU;IACR,KAAK,QAAQ,kBACX,UAAU,cACV,UAAU,QAAQ,WACpB;GACF;EACF,CACF,CACF;CACF;AACF;AAEA,eAAsB,cAAc,SAAwB;CAC1D,MAAM,OACJ,QAAQ,QACP,MAAM,QAAQ;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.mjs","names":["#context","#api"],"sources":["../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 {\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 type { PartialKeys } from \"@stryke/types/base\";\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(\n inlineConfig: PartialKeys<CreateInlineConfig, \"command\">\n ) {\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: PartialKeys<TypesInlineConfig, \"command\">) {\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(\n inlineConfig: PartialKeys<PrepareInlineConfig, \"command\">\n ) {\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: PartialKeys<CleanInlineConfig, \"command\">) {\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: PartialKeys<LintInlineConfig, \"command\">) {\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: PartialKeys<TestInlineConfig, \"command\">) {\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: PartialKeys<BuildInlineConfig, \"command\">) {\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: PartialKeys<DocsInlineConfig, \"command\">) {\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(\n inlineConfig: PartialKeys<DeployInlineConfig, \"command\">\n ) {\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(\n command: string,\n inlineConfig: PartialKeys<InlineConfig, \"command\">\n ) {\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":";;;;;;;;;;;;;;AA+CA,IAAa,mBAAb,MAAiE;;;;CAI/D;;;;CAKA;;;;CAKA,IAAW,UAAyB;EAClC,OAAO,KAAKA;CACd;;;;CAKA,IAAW,MAA0B;EACnC,OAAO,KAAKC;CACd;;;;;;;;CASA,AAAO,YAAY,SAAwB,KAAyB;EAClE,KAAKD,WAAW;EAChB,KAAKC,OAAO;CACd;;;;;;;;;;CAWA,MAAa,OACX,cACA;EACA,MAAM,QAAQ,KAAK,QAAQ,MAAM,QAAQ;EACzC,KAAK,QAAQ,KAAK,2BAA2B;EAE7C,MAAM,KAAK,QAAQ,UAAU,YAAY;EAEzC,KAAK,QAAQ,MAAM,yCAAyC;EAC5D,MAAM;CACR;;;;;;;;;CAUA,MAAa,MAAM,cAAyD;EAC1E,MAAM,QAAQ,KAAK,QAAQ,MAAM,OAAO;EACxC,KAAK,QAAQ,KAAK,yDAAyD;EAE3E,MAAM,KAAK,QAAQ,SAAS,YAAY;EAExC,KAAK,QAAQ,MAAM,+CAA+C;EAClE,MAAM;CACR;;;;;;;;;CAUA,MAAa,QACX,cACA;EACA,MAAM,QAAQ,KAAK,QAAQ,MAAM,SAAS;EAC1C,KAAK,QAAQ,KAAK,2BAA2B;EAE7C,MAAM,KAAK,QAAQ,WAAW,YAAY;EAE1C,KAAK,QAAQ,MAAM,0CAA0C;EAC7D,MAAM;CACR;;;;;;;;;;CAWA,MAAa,MAAM,cAAyD;EAC1E,MAAM,QAAQ,KAAK,QAA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S,MALlB,mBAAmB,KAAK,SAAS;EAClD,MAAM,QAAQ;EACd;CACF,CAAC,CAEwC;AAC3C"}
@@ -3,11 +3,11 @@ const require_helpers_rpc = require('./rpc.cjs');
3
3
  const require_helpers_stream = require('./stream.cjs');
4
4
  const require_helpers_type_checks = require('./type-checks.cjs');
5
5
  let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
6
+ let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
6
7
  let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
7
8
  let _powerlines_core_context_execution_context = require("@powerlines/core/context/execution-context");
8
9
  let _powerlines_core_lib_context_helpers = require("@powerlines/core/lib/context-helpers");
9
10
  let _stryke_string_format_list = require("@stryke/string-format/list");
10
- let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
11
11
  let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
12
12
  let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
13
13
  let defu = require("defu");
@@ -2,11 +2,11 @@ import { createRpcClient } from "./rpc.mjs";
2
2
  import { MessagePortDuplex } from "./stream.mjs";
3
3
  import { isEngineExecutionOptions } from "./type-checks.mjs";
4
4
  import { consoleLogger, formatExecutionId } from "@powerlines/core/plugin-utils";
5
+ import { titleCase } from "@stryke/string-format/title-case";
5
6
  import { isSetObject } from "@stryke/type-checks/is-set-object";
6
7
  import { PowerlinesExecutionContext } from "@powerlines/core/context/execution-context";
7
8
  import { resolvePluginConfig } from "@powerlines/core/lib/context-helpers";
8
9
  import { list } from "@stryke/string-format/list";
9
- import { titleCase } from "@stryke/string-format/title-case";
10
10
  import { isFunction } from "@stryke/type-checks/is-function";
11
11
  import { uuid } from "@stryke/unique-id/uuid";
12
12
  import { defu } from "defu";
@@ -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 {\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,KAC7L,OAAO,KAAK,QAAQ,CACtB,EAAE,EACJ;EAGF,QAAQ,gBAAgB;EACxB,QAAQ,gBAAgB,kBACtB,OAAO,aAAa,QAAQ,QAAQ,MACpC,SACA,QAAQ,WACV;EAEA,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,KAC7L,OAAO,KAAK,QAAQ,CACtB,EAAE,EACJ;EAGF,QAAQ,gBAAgB;EACxB,QAAQ,gBAAgB,kBAC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s","names":[],"sources":["../../src/helpers/finalize.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 { ExecutionContext, ResolvedConfig } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { callHook } from \"@powerlines/core/lib/hooks\";\nimport { removeDirectory } from \"@stryke/fs/helpers\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { existsSync } from \"node:fs\";\n\n/**\n * Finalize the execution context by disposing resources and cleaning up.\n *\n * @param context - The execution context to finalize\n */\nexport async function finalize<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(context: ExecutionContext<TResolvedConfig>) {\n const timer = context.timer(\"Finalization\");\n\n await executeEnvironments(context, async env => {\n await callHook(context, \"finalize\", { environment: env });\n await env.fs.dispose();\n\n if (\n existsSync(env.cachePath) &&\n !(await listFiles(joinPaths(env.cachePath, \"**/*\")))?.length\n ) {\n await removeDirectory(env.cachePath);\n }\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;;AA+BA,eAAsB,SAEpB,SAA4C;CAC5C,MAAM,QAAQ,QAAQ,MAAM,cAAc;CAE1C,MAAM,oBAAoB,SAAS,OAAM,QAAO;EAC9C,MAAM,SAAS,SAAS,YAAY,EAAE,aAAa,IAAI,CAAC;EACxD,MAAM,IAAI,GAAG,QAAQ;EAErB,IACE,WAAW,IAAI,SAAS,KACxB,EAAE,MAAM,UAAU,UAAU,IAAI,WAAW,MAAM,CAAC,IAAI,QAEtD,MAAM,gBAAgB,IAAI,SAAS;CAEvC,CAAC;CAED,MAAM;AACR"}
1
+ {"version":3,"file":"finalize.mjs","names":[],"sources":["../../src/helpers/finalize.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 { ExecutionContext, ResolvedConfig } from \"@powerlines/core\";\nimport { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { callHook } from \"@powerlines/core/lib/hooks\";\nimport { removeDirectory } from \"@stryke/fs/helpers\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { existsSync } from \"node:fs\";\n\n/**\n * Finalize the execution context by disposing resources and cleaning up.\n *\n * @param context - The execution context to finalize\n */\nexport async function finalize<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(context: ExecutionContext<TResolvedConfig>) {\n const timer = context.timer(\"Finalization\");\n\n await executeEnvironments(context, async env => {\n await callHook(context, \"finalize\", { environment: env });\n await env.fs.dispose();\n\n if (\n existsSync(env.cachePath) &&\n !(await listFiles(joinPaths(env.cachePath, \"**/*\")))?.length\n ) {\n await removeDirectory(env.cachePath);\n }\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;;AA+BA,eAAsB,SAEpB,SAA4C;CAC5C,MAAM,QAAQ,QAAQ,MAAM,cAAc;CAE1C,MAAM,oBAAoB,SAAS,OAAM,QAAO;EAC9C,MAAM,SAAS,SAAS,YAAY,EAAE,aAAa,IAAI,CAAC;EACxD,MAAM,IAAI,GAAG,QAAQ;EAErB,IACE,WAAW,IAAI,SAAS,KACxB,EAAE,MAAM,UAAU,UAAU,IAAI,WAAW,MAAM,CAAC,EAAC,EAAG,QAEtD,MAAM,gBAAgB,IAAI,SAAS;CAEvC,CAAC;CAED,MAAM;AACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"stream.mjs","names":[],"sources":["../../src/helpers/stream.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 DuplexOptions,\n ReadableOptions,\n WritableOptions\n} from \"node:stream\";\nimport { Duplex, Readable, Writable } from \"node:stream\";\nimport type { MessagePort, Transferable } from \"node:worker_threads\";\n\nconst kPort = Symbol(\"kPort\");\n\ntype PortLike = MessagePort & {\n close: (callback?: () => void) => void;\n};\n\ninterface WritevChunk {\n chunk: unknown;\n encoding: BufferEncoding;\n}\n\nfunction toTransferable(chunk: unknown): Transferable | undefined {\n if (ArrayBuffer.isView(chunk)) {\n return chunk.buffer instanceof ArrayBuffer ? chunk.buffer : undefined;\n }\n\n if (chunk instanceof ArrayBuffer) {\n return chunk;\n }\n\n return undefined;\n}\n\nexport class MessagePortWritable extends Writable {\n private [kPort]: PortLike;\n\n public constructor(port: MessagePort, options?: WritableOptions) {\n super(options);\n this[kPort] = port;\n }\n\n public override _write(\n chunk: unknown,\n _encoding: BufferEncoding,\n callback: (error?: Error | null) => void\n ): void {\n const transfer = toTransferable(chunk);\n this[kPort].postMessage(chunk, transfer ? [transfer] : []);\n callback();\n }\n\n public override _writev(\n data: WritevChunk[],\n callback: (error?: Error | null) => void\n ): void {\n const chunks = data.map(entry => entry.chunk);\n const transfers = data\n .map(entry => toTransferable(entry.chunk))\n .filter((value): value is Transferable => Boolean(value));\n\n this[kPort].postMessage(chunks, transfers);\n callback();\n }\n\n public override _final(callback: (error?: Error | null) => void): void {\n this[kPort].postMessage(null);\n callback();\n }\n\n public override _destroy(\n error: Error | null,\n callback: (error?: Error | null) => void\n ): void {\n this[kPort].close(() => callback(error));\n }\n\n public unref(): this {\n this[kPort].unref();\n return this;\n }\n\n public ref(): this {\n this[kPort].ref();\n return this;\n }\n}\n\nexport class MessagePortReadable extends Readable {\n private [kPort]: PortLike;\n\n public constructor(port: MessagePort, options?: ReadableOptions) {\n super(options);\n this[kPort] = port;\n port.onmessage = ({ data }) => {\n this.push(data);\n };\n }\n\n public override _read(_size: number): void {\n this[kPort].start();\n }\n\n public override _destroy(\n error: Error | null,\n callback: (error?: Error | null) => void\n ): void {\n this[kPort].close(() => {\n this[kPort].onmessage = null;\n callback(error);\n });\n }\n\n public unref(): this {\n this[kPort].unref();\n return this;\n }\n\n public ref(): this {\n this[kPort].ref();\n return this;\n }\n}\n\nexport interface MessagePortDuplexOptions extends DuplexOptions {\n onActivityAbort?: () => void;\n}\n\nexport class MessagePortDuplex extends Duplex {\n private [kPort]: PortLike;\n\n private _activityAbortHandler?: () => void;\n\n public constructor(port: MessagePort, options?: MessagePortDuplexOptions) {\n super(options);\n this[kPort] = port;\n this._activityAbortHandler = options?.onActivityAbort;\n\n port.onmessage = ({ data }) => {\n this.push(data);\n };\n }\n\n public override _read(_size: number): void {\n this[kPort].start();\n }\n\n public override _write(\n chunk: unknown,\n _encoding: BufferEncoding,\n callback: (error?: Error | null) => void\n ): void {\n if (this._activityAbortHandler) {\n this._activityAbortHandler();\n }\n const transfer = toTransferable(chunk);\n this[kPort].postMessage(chunk, transfer ? [transfer] : []);\n callback();\n }\n\n public override _writev(\n data: WritevChunk[],\n callback: (error?: Error | null) => void\n ): void {\n const chunks = data.map(entry => entry.chunk);\n const transfers = data\n .map(entry => toTransferable(entry.chunk))\n .filter((value): value is Transferable => Boolean(value));\n\n this[kPort].postMessage(chunks, transfers);\n callback();\n }\n\n public override _final(callback: (error?: Error | null) => void): void {\n this[kPort].postMessage(null);\n callback();\n }\n\n public override _destroy(\n error: Error | null,\n callback: (error?: Error | null) => void\n ): void {\n this[kPort].close(() => {\n this[kPort].onmessage = null;\n callback(error);\n });\n }\n\n public unref(): this {\n this[kPort].unref();\n return this;\n }\n\n public ref(): this {\n this[kPort].ref();\n return this;\n }\n}\n"],"mappings":";;;AA0BA,MAAM,QAAQ,OAAO,OAAO;AAW5B,SAAS,eAAe,OAA0C;CAChE,IAAI,YAAY,OAAO,KAAK,GAC1B,OAAO,MAAM,kBAAkB,cAAc,MAAM,SAAS;CAG9D,IAAI,iBAAiB,aACnB,OAAO;AAIX;AAEA,IAAa,sBAAb,cAAyC,SAAS;CAChD,CAAS;CAET,AAAO,YAAY,MAAmB,SAA2B;EAC/D,MAAM,OAAO;EACb,KAAK,SAAS;CAChB;CAEA,AAAgB,OACd,OACA,WACA,UACM;EACN,MAAM,WAAW,eAAe,KAAK;EACrC,KAAK,OAAO,YAAY,OAAO,WAAW,CAAC,QAAQ,IAAI,CAAC,CAAC;EACzD,SAAS;CACX;CAEA,AAAgB,QACd,MACA,UACM;EACN,MAAM,SAAS,KAAK,KAAI,UAAS,MAAM,KAAK;EAC5C,MAAM,YAAY,KACf,KAAI,UAAS,eAAe,MAAM,KAAK,CAAC,EACxC,QAAQ,UAAiC,QAAQ,KAAK,CAAC;EAE1D,KAAK,OAAO,YAAY,QAAQ,SAAS;EACzC,SAAS;CACX;CAEA,AAAgB,OAAO,UAAgD;EACrE,KAAK,OAAO,YAAY,IAAI;EAC5B,SAAS;CACX;CAEA,AAAgB,SACd,OACA,UACM;EACN,KAAK,OAAO,YAAY,SAAS,KAAK,CAAC;CACzC;CAEA,AAAO,QAAc;EACnB,KAAK,OAAO,MAAM;EAClB,OAAO;CACT;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AAO,UAAgD;EACrE,KAAK,OAAO,YAAY,IAAI;EAC5B,SAAS;CACX;CAEA,AAAgB,SACd,OACA,UACM;EACN,KAAK,OAAO,YAAY;GACtB,KAAK,OAAO,YAAY;GACxB,SAAS,KAAK;EAChB,CAAC;CACH;CAEA,AAAO,QAAc;EACnB,KAAK,OAAO,MAAM;EAClB,OAAO;CACT;CAEA,AAAO,MAAY;EACjB,KAAK,OAAO,IAAI;EAChB,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"stream.mjs","names":[],"sources":["../../src/helpers/stream.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 DuplexOptions,\n ReadableOptions,\n WritableOptions\n} from \"node:stream\";\nimport { Duplex, Readable, Writable } from \"node:stream\";\nimport type { MessagePort, Transferable } from \"node:worker_threads\";\n\nconst kPort = Symbol(\"kPort\");\n\ntype PortLike = MessagePort & {\n close: (callback?: () => void) => void;\n};\n\ninterface WritevChunk {\n chunk: unknown;\n encoding: BufferEncoding;\n}\n\nfunction toTransferable(chunk: unknown): Transferable | undefined {\n if (ArrayBuffer.isView(chunk)) {\n return chunk.buffer instanceof ArrayBuffer ? chunk.buffer : undefined;\n }\n\n if (chunk instanceof ArrayBuffer) {\n return chunk;\n }\n\n return undefined;\n}\n\nexport class MessagePortWritable extends Writable {\n private [kPort]: PortLike;\n\n public constructor(port: MessagePort, options?: WritableOptions) {\n super(options);\n this[kPort] = port;\n }\n\n public override _write(\n chunk: unknown,\n _encoding: BufferEncoding,\n callback: (error?: Error | null) => void\n ): void {\n const transfer = toTransferable(chunk);\n this[kPort].postMessage(chunk, transfer ? [transfer] : []);\n callback();\n }\n\n public override _writev(\n data: WritevChunk[],\n callback: (error?: Error | null) => void\n ): void {\n const chunks = data.map(entry => entry.chunk);\n const transfers = data\n .map(entry => toTransferable(entry.chunk))\n .filter((value): value is Transferable => Boolean(value));\n\n this[kPort].postMessage(chunks, transfers);\n callback();\n }\n\n public override _final(callback: (error?: Error | null) => void): void {\n this[kPort].postMessage(null);\n callback();\n }\n\n public override _destroy(\n error: Error | null,\n callback: (error?: Error | null) => void\n ): void {\n this[kPort].close(() => callback(error));\n }\n\n public unref(): this {\n this[kPort].unref();\n return this;\n }\n\n public ref(): this {\n this[kPort].ref();\n return this;\n }\n}\n\nexport class MessagePortReadable extends Readable {\n private [kPort]: PortLike;\n\n public constructor(port: MessagePort, options?: ReadableOptions) {\n super(options);\n this[kPort] = port;\n port.onmessage = ({ data }) => {\n this.push(data);\n };\n }\n\n public override _read(_size: number): void {\n this[kPort].start();\n }\n\n public override _destroy(\n error: Error | null,\n callback: (error?: Error | null) => void\n ): void {\n this[kPort].close(() => {\n this[kPort].onmessage = null;\n callback(error);\n });\n }\n\n public unref(): this {\n this[kPort].unref();\n return this;\n }\n\n public ref(): this {\n this[kPort].ref();\n return this;\n }\n}\n\nexport interface MessagePortDuplexOptions extends DuplexOptions {\n onActivityAbort?: () => void;\n}\n\nexport class MessagePortDuplex extends Duplex {\n private [kPort]: PortLike;\n\n private _activityAbortHandler?: () => void;\n\n public constructor(port: MessagePort, options?: MessagePortDuplexOptions) {\n super(options);\n this[kPort] = port;\n this._activityAbortHandler = options?.onActivityAbort;\n\n port.onmessage = ({ data }) => {\n this.push(data);\n };\n }\n\n public override _read(_size: number): void {\n this[kPort].start();\n }\n\n public override _write(\n chunk: unknown,\n _encoding: BufferEncoding,\n callback: (error?: Error | null) => void\n ): void {\n if (this._activityAbortHandler) {\n this._activityAbortHandler();\n }\n const transfer = toTransferable(chunk);\n this[kPort].postMessage(chunk, transfer ? [transfer] : []);\n callback();\n }\n\n public override _writev(\n data: WritevChunk[],\n callback: (error?: Error | null) => void\n ): void {\n const chunks = data.map(entry => entry.chunk);\n const transfers = data\n .map(entry => toTransferable(entry.chunk))\n .filter((value): value is Transferable => Boolean(value));\n\n this[kPort].postMessage(chunks, transfers);\n callback();\n }\n\n public override _final(callback: (error?: Error | null) => void): void {\n this[kPort].postMessage(null);\n callback();\n }\n\n public override _destroy(\n error: Error | null,\n callback: (error?: Error | null) => void\n ): void {\n this[kPort].close(() => {\n this[kPort].onmessage = null;\n callback(error);\n });\n }\n\n public unref(): this {\n this[kPort].unref();\n return this;\n }\n\n public ref(): this {\n this[kPort].ref();\n return this;\n }\n}\n"],"mappings":";;;AA0BA,MAAM,QAAQ,OAAO,OAAO;AAW5B,SAAS,eAAe,OAA0C;CAChE,IAAI,YAAY,OAAO,KAAK,GAC1B,OAAO,MAAM,kBAAkB,cAAc,MAAM,SAAS;CAG9D,IAAI,iBAAiB,aACnB,OAAO;AAIX;AAEA,IAAa,sBAAb,cAAyC,SAAS;CAChD,CAAS;CAET,AAAO,YAAY,MAAmB,SAA2B;EAC/D,MAAM,OAAO;EACb,KAAK,SAAS;CAChB;CAEA,AAAgB,OACd,OACA,WACA,UACM;EACN,MAAM,WAAW,eAAe,KAAK;EACrC,KAAK,MAAM,CAAC,YAAY,OAAO,WAAW,CAAC,QAAQ,IAAI,CAAC,CAAC;EACzD,SAAS;CACX;CAEA,AAAgB,QACd,MACA,UACM;EACN,MAAM,SAAS,KAAK,KAAI,UAAS,MAAM,KAAK;EAC5C,MAAM,YAAY,KACf,KAAI,UAAS,eAAe,MAAM,KAAK,CAAC,CAAC,CACzC,QAAQ,UAAiC,QAAQ,KAAK,CAAC;EAE1D,KAAK,MAAM,CAAC,YAAY,QAAQ,SAAS;EACzC,SAAS;CACX;CAEA,AAAgB,OAAO,UAAgD;EACrE,KAAK,MAAM,CAAC,YAAY,IAAI;EAC5B,SAAS;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AAK,KAAI,UAAS,MAAM,KAAK;EAC5C,MAAM,YAAY,KACf,KAAI,UAAS,eAAe,MAAM,KAAK,CAAC,CAAC,CACzC,QAAQ,UAAiC,QAAQ,KAAK,CAAC;EAE1D,KAAK,MAAM,CAAC,YAAY,QAAQ,SAAS;EACzC,SAAS;CACX;CAEA,AAAgB,OAAO,UAAgD;EACrE,KAAK,MAAM,CAAC,YAAY,IAAI;EAC5B,SAAS;CACX;CAEA,AAAgB,SACd,OACA,UACM;EACN,KAAK,MAAM,CAAC,YAAY;GACtB,KAAK,MAAM,CAAC,YAAY;GACxB,SAAS,KAAK;EAChB,CAAC;CACH;CAEA,AAAO,QAAc;EACnB,KAAK,MAAM,CAAC,MAAM;EAClB,OAAO;CACT;CAEA,AAAO,MAAY;EACjB,KAAK,MAAM,CAAC,IAAI;EAChB,OAAO;CACT;AACF"}
@@ -1,6 +1,7 @@
1
1
  import { RpcClient } from "./rpc.cjs";
2
2
  import { EngineExecutionOptions, EngineOptions } from "./config.cjs";
3
3
  import { BaseContext, InlineConfig, ParsedUserConfig } from "@powerlines/core";
4
+ import { PartialKeys } from "@stryke/types/base";
4
5
  import { ConnectionMeta, DevToolsNodeContext } from "devframe/types";
5
6
 
6
7
  //#region src/types/context.d.ts
@@ -130,7 +131,7 @@ interface EngineContext<TSystemContext = unknown> extends BaseContext<TSystemCon
130
131
  * @remarks
131
132
  * 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.
132
133
  */
133
- loadExecutions: (method: string, inlineConfig: InlineConfig) => Promise<EngineExecutionItem[]>;
134
+ loadExecutions: (method: string, inlineConfig: PartialKeys<InlineConfig, "command">) => Promise<EngineExecutionItem[]>;
134
135
  /**
135
136
  * 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.
136
137
  *
@@ -1 +1 @@
1
- {"version":3,"file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EngineExecutionOptions, EngineOptions } from "./config.mjs";
3
3
  import { BaseContext, InlineConfig, ParsedUserConfig } from "@powerlines/core";
4
+ import { PartialKeys } from "@stryke/types/base";
4
5
  import { ConnectionMeta, DevToolsNodeContext } from "devframe/types";
5
6
 
6
7
  //#region src/types/context.d.ts
@@ -130,7 +131,7 @@ interface EngineContext<TSystemContext = unknown> extends BaseContext<TSystemCon
130
131
  * @remarks
131
132
  * 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.
132
133
  */
133
- loadExecutions: (method: string, inlineConfig: InlineConfig) => Promise<EngineExecutionItem[]>;
134
+ loadExecutions: (method: string, inlineConfig: PartialKeys<InlineConfig, "command">) => Promise<EngineExecutionItem[]>;
134
135
  /**
135
136
  * 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.
136
137
  *
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.mts","names":[],"sources":["../../src/types/context.ts"],"mappings":";;;;;;;;AA0BA;KAAY,kBAAA;;;AAAkB;UAKb,mBAAA;EAAmB;;;EAIlC,SAAA;EAKA;;;EAAA,IAAA;EAKwB;AAM1B;;EANE,IAAA,EAAM,kBAAkB;AAAA;AAUpB;AAMN;;AANM,UAJW,0BAAA,SAAmC,mBAAmB;EAUH;;;EANlE,IAAI;AAAA;AAeA;AAMN;;AANM,UATW,uBAAA,SAAgC,mBAAmB;EAejB;AAI7C;AAMN;EArBE,KAAA;;;;EAKA,IAAA;AAAA;;;;UAMe,yBAAA,SAAkC,mBAAmB;EAmB9D;;;EAfN,IAAI;AAAA;AA0BN;;;AAAA,UApBiB,cAAA;EAkCN;;;EA9BT,OAAA,EAAS,0BAAA;EAwCY;;;EAnCrB,IAAA,EAAM,uBAAA;EAyBG;;;EApBT,MAAA,EAAQ,yBAAA;AAAA;;;AA8Ba;UAxBN,mBAAA;EAi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AgCO;;;EA3BP,OAAA;EAiDY;;;EA5CZ,OAAA,EAAS,IAAA,CAAK,sBAAA;EAuDT;;;EAlDL,UAAA,EAAY,gBAAA;EAiBN;;;EAZN,KAAA,EAAO,cAAA;AAAA;;;;;;;UASQ,aAAA,mCAEb,WAAA,CAAY,cAAA,GACZ,IAAA,CAAK,QAAA,CAAS,aAAA;EAiBN;;;EAbV,OAAA,EAAS,aAAA;EA2BP;;;EAtBF,UAAA,EAAY,cAAA;EAwBP;;;;;;EAhBL,QAAA,EAAU,mBAAA;EA2BK;;;EAtBf,UAAA,EAAY,mBAAA;EA0BE;;;;;;EAlBd,cAAA,GACE,MAAA,UACA,YAAA,EAAc,WAAA,CAAY,YAAA,iBACvB,OAAA,CAAQ,mBAAA;;;;;;;EAQb,iBAAA,GAAoB,YAAA,UAAsB,WAAA;AAAA;AAAA,UAG3B,mBAAA;;;;EAIf,GAAA,EAAK,SAAS;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/engine",
3
- "version": "0.49.47",
3
+ "version": "0.49.49",
4
4
  "private": false,
5
5
  "description": "An internal package containing the core engine modules for Powerlines.",
6
6
  "homepage": "https://stormsoftware.com",
@@ -120,7 +120,7 @@
120
120
  "types": "./dist/index.d.cts",
121
121
  "files": ["dist"],
122
122
  "dependencies": {
123
- "@powerlines/core": "^0.48.45",
123
+ "@powerlines/core": "^0.48.47",
124
124
  "@storm-software/config": "^1.137.72",
125
125
  "@storm-software/config-tools": "^1.190.40",
126
126
  "@stryke/async": "^0.1.12",
@@ -141,7 +141,7 @@
141
141
  "get-port-please": "^3.2.0",
142
142
  "h3": "^1.15.11",
143
143
  "handlebars": "^4.7.9",
144
- "human-id": "^4.1.3",
144
+ "human-id": "^4.2.0",
145
145
  "jiti": "^2.7.0",
146
146
  "sirv": "^3.0.2",
147
147
  "structured-clone-es": "^2.0.0",
@@ -156,5 +156,5 @@
156
156
  "@types/node": "^25.9.1",
157
157
  "typescript": "^6.0.3"
158
158
  },
159
- "gitHead": "f1867a3f2eb847c35107fd76ef57b1ec5a9be808"
159
+ "gitHead": "30ba301952db7af53c07d369bd22f650e5ca9c45"
160
160
  }