@powerlines/engine 0.49.33 → 0.49.35

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 (120) hide show
  1. package/dist/{engine-BKEDCOCb.cjs → _internal/execution-api-worker.cjs} +4 -277
  2. package/dist/_internal/execution-api-worker.d.cts +64 -0
  3. package/dist/_internal/execution-api-worker.d.cts.map +1 -0
  4. package/dist/_internal/execution-api-worker.d.mts +64 -0
  5. package/dist/_internal/execution-api-worker.d.mts.map +1 -0
  6. package/dist/{engine-DRAFIm5M.mjs → _internal/execution-api-worker.mjs} +3 -258
  7. package/dist/_internal/execution-api-worker.mjs.map +1 -0
  8. package/dist/{chunk-C_NdSu1c.cjs → _virtual/_rolldown/runtime.cjs} +1 -6
  9. package/dist/api/build.cjs +4 -4
  10. package/dist/api/build.d.cts +2 -2
  11. package/dist/api/build.d.cts.map +1 -1
  12. package/dist/api/build.d.mts +2 -2
  13. package/dist/api/build.d.mts.map +1 -1
  14. package/dist/api/build.mjs +2 -2
  15. package/dist/api/build.mjs.map +1 -1
  16. package/dist/api/clean.d.cts +2 -2
  17. package/dist/api/clean.d.mts +2 -2
  18. package/dist/api/create.cjs +2 -2
  19. package/dist/api/create.d.cts +2 -2
  20. package/dist/api/create.d.mts +2 -2
  21. package/dist/api/deploy.d.cts +2 -2
  22. package/dist/api/deploy.d.mts +2 -2
  23. package/dist/api/docs.d.cts +2 -2
  24. package/dist/api/docs.d.mts +2 -2
  25. package/dist/api/lint.d.cts +2 -2
  26. package/dist/api/lint.d.mts +2 -2
  27. package/dist/api/prepare.d.cts +2 -2
  28. package/dist/api/prepare.d.mts +2 -2
  29. package/dist/api/test.d.cts +2 -2
  30. package/dist/api/test.d.mts +2 -2
  31. package/dist/api/types.d.cts +2 -2
  32. package/dist/api/types.d.mts +2 -2
  33. package/dist/api.d.cts +1 -1
  34. package/dist/api.d.mts +1 -1
  35. package/dist/context/engine-context.cjs +2 -2
  36. package/dist/context/engine-context.d.cts +53 -2
  37. package/dist/context/engine-context.d.cts.map +1 -0
  38. package/dist/context/engine-context.d.mts +53 -2
  39. package/dist/context/engine-context.d.mts.map +1 -0
  40. package/dist/context/index.d.cts +1 -1
  41. package/dist/context/index.d.mts +1 -1
  42. package/dist/engine.cjs +261 -4
  43. package/dist/engine.d.cts +143 -2
  44. package/dist/engine.d.cts.map +1 -0
  45. package/dist/engine.d.mts +143 -2
  46. package/dist/engine.d.mts.map +1 -0
  47. package/dist/engine.mjs +258 -2
  48. package/dist/engine.mjs.map +1 -0
  49. package/dist/helpers/create-api.d.cts +18 -2
  50. package/dist/helpers/create-api.d.cts.map +1 -0
  51. package/dist/helpers/create-api.d.mts +18 -2
  52. package/dist/helpers/create-api.d.mts.map +1 -0
  53. package/dist/helpers/finalize.d.cts +12 -2
  54. package/dist/helpers/finalize.d.cts.map +1 -0
  55. package/dist/helpers/finalize.d.mts +12 -2
  56. package/dist/helpers/finalize.d.mts.map +1 -0
  57. package/dist/helpers/index.d.cts +5 -4
  58. package/dist/helpers/index.d.mts +5 -4
  59. package/dist/helpers/rpc.d.cts +8 -2
  60. package/dist/helpers/rpc.d.cts.map +1 -0
  61. package/dist/helpers/rpc.d.mts +8 -2
  62. package/dist/helpers/rpc.d.mts.map +1 -0
  63. package/dist/helpers/stream.d.cts +45 -2
  64. package/dist/helpers/stream.d.cts.map +1 -0
  65. package/dist/helpers/stream.d.mts +45 -2
  66. package/dist/helpers/stream.d.mts.map +1 -0
  67. package/dist/helpers/type-checks.d.cts +19 -2
  68. package/dist/helpers/type-checks.d.cts.map +1 -0
  69. package/dist/helpers/type-checks.d.mts +19 -2
  70. package/dist/helpers/type-checks.d.mts.map +1 -0
  71. package/dist/index.cjs +1 -1
  72. package/dist/index.d.cts +6 -5
  73. package/dist/index.d.mts +6 -5
  74. package/dist/index.mjs +1 -1
  75. package/dist/{index-CBobV6Wm.d.mts → types/api.d.cts} +5 -31
  76. package/dist/types/api.d.cts.map +1 -0
  77. package/dist/{index-QuLZgb8w.d.cts → types/api.d.mts} +5 -31
  78. package/dist/types/api.d.mts.map +1 -0
  79. package/dist/types/config.d.cts +72 -0
  80. package/dist/types/config.d.cts.map +1 -0
  81. package/dist/types/config.d.mts +72 -0
  82. package/dist/types/config.d.mts.map +1 -0
  83. package/dist/{context-C71mv_aw.d.mts → types/context.d.cts} +4 -3
  84. package/dist/types/context.d.cts.map +1 -0
  85. package/dist/{context-ZbJRDGpl.d.cts → types/context.d.mts} +4 -3
  86. package/dist/types/context.d.mts.map +1 -0
  87. package/dist/types/index.d.cts +4 -0
  88. package/dist/types/index.d.mts +4 -0
  89. package/dist/{config-B6udgcnD.d.cts → types/rpc.d.cts} +7 -70
  90. package/dist/types/rpc.d.cts.map +1 -0
  91. package/dist/{config-DXxu0y4t.d.mts → types/rpc.d.mts} +7 -70
  92. package/dist/types/rpc.d.mts.map +1 -0
  93. package/package.json +16 -16
  94. package/dist/config-B6udgcnD.d.cts.map +0 -1
  95. package/dist/config-DXxu0y4t.d.mts.map +0 -1
  96. package/dist/context-C71mv_aw.d.mts.map +0 -1
  97. package/dist/context-ZbJRDGpl.d.cts.map +0 -1
  98. package/dist/engine-B5pbfMyg.d.cts +0 -199
  99. package/dist/engine-B5pbfMyg.d.cts.map +0 -1
  100. package/dist/engine-CeWEM0TT.d.mts +0 -199
  101. package/dist/engine-CeWEM0TT.d.mts.map +0 -1
  102. package/dist/engine-DRAFIm5M.mjs.map +0 -1
  103. package/dist/engine-context-CaPJFek0.d.mts +0 -53
  104. package/dist/engine-context-CaPJFek0.d.mts.map +0 -1
  105. package/dist/engine-context-DDbpdZHC.d.cts +0 -53
  106. package/dist/engine-context-DDbpdZHC.d.cts.map +0 -1
  107. package/dist/finalize-CuV0r3jg.d.cts +0 -12
  108. package/dist/finalize-CuV0r3jg.d.cts.map +0 -1
  109. package/dist/finalize-CuV0r3jg.d.mts +0 -12
  110. package/dist/finalize-CuV0r3jg.d.mts.map +0 -1
  111. package/dist/index-CBobV6Wm.d.mts.map +0 -1
  112. package/dist/index-QuLZgb8w.d.cts.map +0 -1
  113. package/dist/rpc-5MpqPBPa.d.cts +0 -7
  114. package/dist/rpc-5MpqPBPa.d.cts.map +0 -1
  115. package/dist/rpc-BvVZXS5K.d.mts +0 -7
  116. package/dist/rpc-BvVZXS5K.d.mts.map +0 -1
  117. package/dist/stream-B9jffNbk.d.cts +0 -45
  118. package/dist/stream-B9jffNbk.d.cts.map +0 -1
  119. package/dist/stream-B9jffNbk.d.mts +0 -45
  120. package/dist/stream-B9jffNbk.d.mts.map +0 -1
@@ -1,5 +1,5 @@
1
- import { i as EngineResolvedConfig } from "../config-DXxu0y4t.mjs";
2
- import { r as EngineSystemContext } from "../context-C71mv_aw.mjs";
1
+ import { EngineResolvedConfig } from "../types/config.mjs";
2
+ import { EngineSystemContext } from "../types/context.mjs";
3
3
  import { ExecutionContext } from "@powerlines/core/types/context";
4
4
 
5
5
  //#region src/api/types.d.ts
package/dist/api.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { r as ExecutionApiParams } from "./index-QuLZgb8w.cjs";
1
+ import { ExecutionApiParams } from "./types/api.cjs";
2
2
  import { ExecutionOptions } from "@powerlines/core";
3
3
 
4
4
  //#region src/api.d.ts
package/dist/api.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { r as ExecutionApiParams } from "./index-CBobV6Wm.mjs";
1
+ import { ExecutionApiParams } from "./types/api.mjs";
2
2
  import { ExecutionOptions } from "@powerlines/core";
3
3
 
4
4
  //#region src/api.d.ts
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_chunk = require('../chunk-C_NdSu1c.cjs');
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
4
4
  let _stryke_convert_to_array = require("@stryke/convert/to-array");
5
5
  let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
@@ -9,7 +9,7 @@ let _powerlines_core_context_base_context = require("@powerlines/core/context/ba
9
9
  let _stryke_env_get_env_paths = require("@stryke/env/get-env-paths");
10
10
  let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
11
11
  let valibot = require("valibot");
12
- valibot = require_chunk.__toESM(valibot, 1);
12
+ valibot = require_runtime.__toESM(valibot, 1);
13
13
 
14
14
  //#region src/context/engine-context.ts
15
15
  var PowerlinesEngineContext = class PowerlinesEngineContext extends _powerlines_core_context_base_context.PowerlinesBaseContext {
@@ -1,2 +1,53 @@
1
- import { t as PowerlinesEngineContext } from "../engine-context-DDbpdZHC.cjs";
2
- export { PowerlinesEngineContext };
1
+ import { EngineOptions } from "../types/config.cjs";
2
+ import { EngineContext, EngineExecutionItem } from "../types/context.cjs";
3
+ import { FrameworkOptions, InlineConfig, LogFn, LoggerOptions } from "@powerlines/core";
4
+ import { ConnectionMeta, DevToolsHost, DevToolsNodeContext } from "devframe/types";
5
+ import { PowerlinesBaseContext } from "@powerlines/core/context/base-context";
6
+ import { EnvPaths } from "@stryke/env/get-env-paths";
7
+
8
+ //#region src/context/engine-context.d.ts
9
+ declare class PowerlinesEngineContext<TSystemContext = unknown> extends PowerlinesBaseContext<TSystemContext> implements EngineContext<TSystemContext> {
10
+ #private;
11
+ options: EngineOptions;
12
+ connection: ConnectionMeta;
13
+ /**
14
+ * Creates a new instance of the PowerlinesEngineContext class.
15
+ *
16
+ * @param options - The options to initialize the context with.
17
+ * @returns A promise that resolves to an instance of the PowerlinesEngineContext class.
18
+ */
19
+ static from<TSystemContext = unknown>(options: EngineOptions, host: DevToolsHost, connection: ConnectionMeta): Promise<PowerlinesEngineContext<TSystemContext>>;
20
+ createLogger(options?: LoggerOptions, logFn?: LogFn): import("@powerlines/core").Logger;
21
+ get executions(): EngineExecutionItem[];
22
+ get devtools(): DevToolsNodeContext;
23
+ get envPaths(): EnvPaths;
24
+ get framework(): FrameworkOptions;
25
+ get orgId(): string;
26
+ /**
27
+ * Creates a new Context instance.
28
+ *
29
+ * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.
30
+ * @param connection - The connection metadata for the dev server.
31
+ */
32
+ protected constructor(options: EngineOptions, connection: ConnectionMeta);
33
+ /**
34
+ * Initialize the context with the provided configuration options
35
+ *
36
+ * @remarks
37
+ * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
38
+ *
39
+ * @param command - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.
40
+ * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.
41
+ */
42
+ loadExecutions(command: string, inlineConfig: InlineConfig): Promise<EngineExecutionItem[]>;
43
+ /**
44
+ * Complete an execution by removing it from the list of active executions based on the provided invocation ID and execution ID. This method is typically called when an execution has finished or has been terminated, allowing the context to clean up any resources associated with that execution and update its internal state accordingly.
45
+ *
46
+ * @param invocationId - The unique identifier for the invocation of the execution to be completed.
47
+ * @param executionId - The unique identifier for the specific execution to be completed.
48
+ */
49
+ completeExecution(invocationId: string, executionId: string): void;
50
+ }
51
+ //#endregion
52
+ export { PowerlinesEngineContext };
53
+ //# sourceMappingURL=engine-context.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-context.d.cts","names":[],"sources":["../../src/context/engine-context.ts"],"mappings":";;;;;;;;cAoDa,uBAAA,mCACH,qBAAA,CAAsB,cAAA,aACnB,aAAA,CAAc,cAAA;EAAA;EAkIP,OAAA,EAAS,aAAA;EAClB,UAAA,EAAY,cAAA;EArIa;;;;;;EAAA,OAgBd,IAAA,2BAClB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,YAAA,EACN,UAAA,EAAY,cAAA,GACX,OAAA,CAAQ,uBAAA,CAAwB,cAAA;EA8DnB,YAAA,CAAa,OAAA,GAAS,aAAA,EAAoB,KAAA,GAAQ,KAAA,8BAAK,MAAA;EAAA,IAe5D,UAAA,IAAc,mBAAA;EAAA,IAId,QAAA,IAAY,mBAAA;EAAA,IAIZ,QAAA,IAAY,QAAA;EAAA,IAQZ,SAAA,IAAa,gBAAA;EAAA,IAQb,KAAA;EAxBc;;;;;;EAAA,UAkChB,WAAA,CACS,OAAA,EAAS,aAAA,EAClB,UAAA,EAAY,cAAA;EAiBV;;;;;;;;;EAHE,cAAA,CACX,OAAA,UACA,YAAA,EAAc,YAAA,GACb,OAAA,CAAQ,mBAAA;EApJc;;;;;;EA6NlB,iBAAA,CAAkB,YAAA,UAAsB,WAAA;AAAA"}
@@ -1,2 +1,53 @@
1
- import { t as PowerlinesEngineContext } from "../engine-context-CaPJFek0.mjs";
2
- export { PowerlinesEngineContext };
1
+ import { EngineOptions } from "../types/config.mjs";
2
+ import { EngineContext, EngineExecutionItem } from "../types/context.mjs";
3
+ import { FrameworkOptions, InlineConfig, LogFn, LoggerOptions } from "@powerlines/core";
4
+ import { PowerlinesBaseContext } from "@powerlines/core/context/base-context";
5
+ import { EnvPaths } from "@stryke/env/get-env-paths";
6
+ import { ConnectionMeta, DevToolsHost, DevToolsNodeContext } from "devframe/types";
7
+
8
+ //#region src/context/engine-context.d.ts
9
+ declare class PowerlinesEngineContext<TSystemContext = unknown> extends PowerlinesBaseContext<TSystemContext> implements EngineContext<TSystemContext> {
10
+ #private;
11
+ options: EngineOptions;
12
+ connection: ConnectionMeta;
13
+ /**
14
+ * Creates a new instance of the PowerlinesEngineContext class.
15
+ *
16
+ * @param options - The options to initialize the context with.
17
+ * @returns A promise that resolves to an instance of the PowerlinesEngineContext class.
18
+ */
19
+ static from<TSystemContext = unknown>(options: EngineOptions, host: DevToolsHost, connection: ConnectionMeta): Promise<PowerlinesEngineContext<TSystemContext>>;
20
+ createLogger(options?: LoggerOptions, logFn?: LogFn): import("@powerlines/core").Logger;
21
+ get executions(): EngineExecutionItem[];
22
+ get devtools(): DevToolsNodeContext;
23
+ get envPaths(): EnvPaths;
24
+ get framework(): FrameworkOptions;
25
+ get orgId(): string;
26
+ /**
27
+ * Creates a new Context instance.
28
+ *
29
+ * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.
30
+ * @param connection - The connection metadata for the dev server.
31
+ */
32
+ protected constructor(options: EngineOptions, connection: ConnectionMeta);
33
+ /**
34
+ * Initialize the context with the provided configuration options
35
+ *
36
+ * @remarks
37
+ * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
38
+ *
39
+ * @param command - The path to the execution configuration to load and run, which can be used to specify different execution configurations for different commands or scenarios.
40
+ * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.
41
+ */
42
+ loadExecutions(command: string, inlineConfig: InlineConfig): Promise<EngineExecutionItem[]>;
43
+ /**
44
+ * Complete an execution by removing it from the list of active executions based on the provided invocation ID and execution ID. This method is typically called when an execution has finished or has been terminated, allowing the context to clean up any resources associated with that execution and update its internal state accordingly.
45
+ *
46
+ * @param invocationId - The unique identifier for the invocation of the execution to be completed.
47
+ * @param executionId - The unique identifier for the specific execution to be completed.
48
+ */
49
+ completeExecution(invocationId: string, executionId: string): void;
50
+ }
51
+ //#endregion
52
+ export { PowerlinesEngineContext };
53
+ //# sourceMappingURL=engine-context.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-context.d.mts","names":[],"sources":["../../src/context/engine-context.ts"],"mappings":";;;;;;;;cAoDa,uBAAA,mCACH,qBAAA,CAAsB,cAAA,aACnB,aAAA,CAAc,cAAA;EAAA;EAkIP,OAAA,EAAS,aAAA;EAClB,UAAA,EAAY,cAAA;EArIa;;;;;;EAAA,OAgBd,IAAA,2BAClB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,YAAA,EACN,UAAA,EAAY,cAAA,GACX,OAAA,CAAQ,uBAAA,CAAwB,cAAA;EA8DnB,YAAA,CAAa,OAAA,GAAS,aAAA,EAAoB,KAAA,GAAQ,KAAA,8BAAK,MAAA;EAAA,IAe5D,UAAA,IAAc,mBAAA;EAAA,IAId,QAAA,IAAY,mBAAA;EAAA,IAIZ,QAAA,IAAY,QAAA;EAAA,IAQZ,SAAA,IAAa,gBAAA;EAAA,IAQb,KAAA;EAxBc;;;;;;EAAA,UAkChB,WAAA,CACS,OAAA,EAAS,aAAA,EAClB,UAAA,EAAY,cAAA;EAiBV;;;;;;;;;EAHE,cAAA,CACX,OAAA,UACA,YAAA,EAAc,YAAA,GACb,OAAA,CAAQ,mBAAA;EApJc;;;;;;EA6NlB,iBAAA,CAAkB,YAAA,UAAsB,WAAA;AAAA"}
@@ -1,2 +1,2 @@
1
- import { t as PowerlinesEngineContext } from "../engine-context-DDbpdZHC.cjs";
1
+ import { PowerlinesEngineContext } from "./engine-context.cjs";
2
2
  export { PowerlinesEngineContext };
@@ -1,2 +1,2 @@
1
- import { t as PowerlinesEngineContext } from "../engine-context-CaPJFek0.mjs";
1
+ import { PowerlinesEngineContext } from "./engine-context.mjs";
2
2
  export { PowerlinesEngineContext };
package/dist/engine.cjs CHANGED
@@ -1,6 +1,263 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_engine = require('./engine-BKEDCOCb.cjs');
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_execution_api_worker = require('./_internal/execution-api-worker.cjs');
4
+ const require_context_engine_context = require('./context/engine-context.cjs');
5
+ let node_events = require("node:events");
6
+ let devframe_node = require("devframe/node");
7
+ let get_port_please = require("get-port-please");
8
+ let h3 = require("h3");
9
+ let sirv = require("sirv");
10
+ sirv = require_runtime.__toESM(sirv, 1);
3
11
 
4
- exports.PowerlinesEngine = require_engine.PowerlinesEngine;
5
- exports.createContext = require_engine.createContext;
6
- exports.createEngine = require_engine.createEngine;
12
+ //#region src/engine.ts
13
+ /**
14
+ * The Powerlines process' orchestration and coordination API.
15
+ *
16
+ * @public
17
+ */
18
+ var PowerlinesEngine = class {
19
+ /**
20
+ * The Powerlines context
21
+ */
22
+ #context;
23
+ /**
24
+ * 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.
25
+ */
26
+ #api;
27
+ /**
28
+ * The Powerlines context
29
+ */
30
+ get context() {
31
+ return this.#context;
32
+ }
33
+ /**
34
+ * 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.
35
+ */
36
+ get api() {
37
+ return this.#api;
38
+ }
39
+ /**
40
+ * Create a new Powerlines Engine instance
41
+ *
42
+ * @param context - The Powerlines context
43
+ * @param api - The API host for the execution workers
44
+ * @returns A new instance of the Powerlines Engine
45
+ */
46
+ constructor(context, api) {
47
+ this.#context = context;
48
+ this.#api = api;
49
+ }
50
+ /**
51
+ * Create a new Powerlines project
52
+ *
53
+ * @remarks
54
+ * This method will create a new Powerlines project in the current directory.
55
+ *
56
+ * @param inlineConfig - The inline configuration for the create command
57
+ * @returns A promise that resolves when the project has been created
58
+ */
59
+ async create(inlineConfig) {
60
+ const timer = this.context.timer("Create");
61
+ this.context.info("🆕 Creating a new project");
62
+ await this.execute("create", inlineConfig);
63
+ this.context.debug("✔ Create command completed successfully");
64
+ timer();
65
+ }
66
+ /**
67
+ * Generate the Powerlines typescript declaration file
68
+ *
69
+ * @remarks
70
+ * 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.
71
+ *
72
+ * @param inlineConfig - The inline configuration for the types command
73
+ */
74
+ async types(inlineConfig) {
75
+ const timer = this.context.timer("Types");
76
+ this.context.info("🏗️ Generating typescript declarations for the project");
77
+ await this.execute("types", inlineConfig);
78
+ this.context.debug("✔ Types generation has completed successfully");
79
+ timer();
80
+ }
81
+ /**
82
+ * Prepare the Powerlines API
83
+ *
84
+ * @remarks
85
+ * This method will prepare the Powerlines API for use, initializing any necessary resources.
86
+ *
87
+ * @param inlineConfig - The inline configuration for the prepare command
88
+ */
89
+ async prepare(inlineConfig) {
90
+ const timer = this.context.timer("Prepare");
91
+ this.context.info("🏗️ Preparing the project");
92
+ await this.execute("prepare", inlineConfig);
93
+ this.context.debug("✔ Preparation has completed successfully");
94
+ timer();
95
+ }
96
+ /**
97
+ * Clean any previously prepared artifacts
98
+ *
99
+ * @remarks
100
+ * This method will remove the previous Powerlines artifacts from the project.
101
+ *
102
+ * @param inlineConfig - The inline configuration for the clean command
103
+ * @returns A promise that resolves when the clean command has completed
104
+ */
105
+ async clean(inlineConfig) {
106
+ const timer = this.context.timer("Clean");
107
+ this.context.info("🧹 Cleaning the previous artifacts");
108
+ await this.execute("clean", inlineConfig);
109
+ this.context.debug("✔ Cleaning completed successfully");
110
+ timer();
111
+ }
112
+ /**
113
+ * Lint the project
114
+ *
115
+ * @param inlineConfig - The inline configuration for the lint command
116
+ * @returns A promise that resolves when the lint command has completed
117
+ */
118
+ async lint(inlineConfig) {
119
+ const timer = this.context.timer("Lint");
120
+ this.context.info("📝 Linting the project");
121
+ await this.execute("lint", inlineConfig);
122
+ this.context.debug("✔ Linting completed successfully");
123
+ timer();
124
+ }
125
+ /**
126
+ * Test the project
127
+ *
128
+ * @remarks
129
+ * This method will run the tests for the Powerlines project.
130
+ *
131
+ * @param inlineConfig - The inline configuration for the test command
132
+ * @returns A promise that resolves when the test command has completed
133
+ */
134
+ async test(inlineConfig) {
135
+ const timer = this.context.timer("Test");
136
+ this.context.info("🧪 Running tests for the project");
137
+ await this.execute("test", inlineConfig);
138
+ this.context.debug("✔ Testing completed successfully");
139
+ timer();
140
+ }
141
+ /**
142
+ * Build the project
143
+ *
144
+ * @remarks
145
+ * This method will build the Powerlines project, generating the necessary artifacts.
146
+ *
147
+ * @param inlineConfig - The inline configuration for the build command
148
+ * @returns A promise that resolves when the build command has completed
149
+ */
150
+ async build(inlineConfig) {
151
+ const timer = this.context.timer("Build");
152
+ this.context.info("📦 Building the project");
153
+ await this.execute("build", inlineConfig);
154
+ this.context.debug("✔ Build completed successfully");
155
+ timer();
156
+ }
157
+ /**
158
+ * Prepare the documentation for the project
159
+ *
160
+ * @param inlineConfig - The inline configuration for the docs command
161
+ * @returns A promise that resolves when the documentation generation has completed
162
+ */
163
+ async docs(inlineConfig) {
164
+ const timer = this.context.timer("Docs");
165
+ this.context.info("📓 Generating documentation for the project");
166
+ await this.execute("docs", inlineConfig);
167
+ this.context.debug("✔ Documentation generation completed successfully");
168
+ timer();
169
+ }
170
+ /**
171
+ * Deploy the project source code
172
+ *
173
+ * @remarks
174
+ * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
175
+ *
176
+ * @param inlineConfig - The inline configuration for the deploy command
177
+ * @returns A promise that resolves when the deploy command has completed
178
+ */
179
+ async deploy(inlineConfig) {
180
+ const timer = this.context.timer("Deploy");
181
+ this.context.info("🚀 Deploying the project");
182
+ await this.execute("deploy", inlineConfig);
183
+ this.context.debug("✔ Deployment completed successfully");
184
+ timer();
185
+ }
186
+ /**
187
+ * Finalization/cleanup processing for the Powerlines API
188
+ *
189
+ * @remarks
190
+ * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
191
+ *
192
+ * @returns A promise that resolves when the finalization process has completed
193
+ */
194
+ async finalize() {
195
+ const timer = this.context.timer("Finalize");
196
+ this.context.info("🏁 Finalization processes started");
197
+ await this.api.finalize();
198
+ this.context.debug("✔ Finalization completed successfully");
199
+ timer();
200
+ }
201
+ /**
202
+ * Asynchronous disposal method for the Powerlines Engine, which will call the finalize method to perform any necessary cleanup when the engine is disposed of.
203
+ */
204
+ async [Symbol.asyncDispose]() {
205
+ return this.finalize();
206
+ }
207
+ /**
208
+ * Execute a Powerlines command based on the provided execution path and inline configuration, loading the necessary executions from the context and managing their lifecycle.
209
+ *
210
+ * @remarks
211
+ * 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.
212
+ *
213
+ * @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.
214
+ * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.
215
+ * @returns A promise that resolves when all executions for the specified command have completed
216
+ */
217
+ async execute(command, inlineConfig) {
218
+ await Promise.all((await this.context.loadExecutions(command, inlineConfig)).map(async (execution) => {
219
+ try {
220
+ await this.api.execute(command, execution.options, inlineConfig);
221
+ } catch (error) {
222
+ this.context.error(`Execution of method "${command}" failed for execution with invocation ID "${execution.invocationId}" and execution ID "${execution.options.executionId}": \n\n${error instanceof Error ? error.stack || error.message : String(error)}`);
223
+ throw error;
224
+ } finally {
225
+ this.context.completeExecution(execution.invocationId, execution.options.executionId);
226
+ }
227
+ }));
228
+ }
229
+ };
230
+ async function createContext(options) {
231
+ const port = options.port ?? await (0, get_port_please.getPort)({
232
+ host: options.host || "localhost",
233
+ random: true
234
+ });
235
+ const app = (0, h3.createApp)();
236
+ const host = (0, devframe_node.createH3DevToolsHost)({
237
+ appName: options.framework?.name || "powerlines",
238
+ origin: `http://${options.host || "localhost"}:${port}`,
239
+ mount: (base, dir) => {
240
+ app.use(base, (0, h3.fromNodeMiddleware)((0, sirv.default)(dir, {
241
+ dev: true,
242
+ single: true
243
+ })));
244
+ }
245
+ });
246
+ return require_context_engine_context.PowerlinesEngineContext.from(options, host, {
247
+ backend: "websocket",
248
+ websocket: port
249
+ });
250
+ }
251
+ async function createEngine(options, apiPath = "@powerlines/engine/api") {
252
+ node_events.EventEmitter.setMaxListeners(Infinity);
253
+ const context = await createContext(options);
254
+ return new PowerlinesEngine(context, await require_execution_api_worker.ExecutionApiWorker.from(apiPath, {
255
+ root: options.root,
256
+ context
257
+ }));
258
+ }
259
+
260
+ //#endregion
261
+ exports.PowerlinesEngine = PowerlinesEngine;
262
+ exports.createContext = createContext;
263
+ exports.createEngine = createEngine;
package/dist/engine.d.cts CHANGED
@@ -1,2 +1,143 @@
1
- import { n as createContext, r as createEngine, t as PowerlinesEngine } from "./engine-B5pbfMyg.cjs";
2
- export { PowerlinesEngine, createContext, createEngine };
1
+ import { EngineOptions } from "./types/config.cjs";
2
+ import { EngineContext } from "./types/context.cjs";
3
+ import { Engine } from "./types/api.cjs";
4
+ import { PowerlinesEngineContext } from "./context/engine-context.cjs";
5
+ import { ExecutionApiWorker } from "./_internal/execution-api-worker.cjs";
6
+ import { BuildInlineConfig, CleanInlineConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, InlineConfig, LintInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
7
+
8
+ //#region src/engine.d.ts
9
+ /**
10
+ * The Powerlines process' orchestration and coordination API.
11
+ *
12
+ * @public
13
+ */
14
+ declare class PowerlinesEngine implements Engine, AsyncDisposable {
15
+ #private;
16
+ /**
17
+ * The Powerlines context
18
+ */
19
+ get context(): EngineContext;
20
+ /**
21
+ * 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.
22
+ */
23
+ get api(): ExecutionApiWorker;
24
+ /**
25
+ * Create a new Powerlines Engine instance
26
+ *
27
+ * @param context - The Powerlines context
28
+ * @param api - The API host for the execution workers
29
+ * @returns A new instance of the Powerlines Engine
30
+ */
31
+ constructor(context: EngineContext, api: ExecutionApiWorker);
32
+ /**
33
+ * Create a new Powerlines project
34
+ *
35
+ * @remarks
36
+ * This method will create a new Powerlines project in the current directory.
37
+ *
38
+ * @param inlineConfig - The inline configuration for the create command
39
+ * @returns A promise that resolves when the project has been created
40
+ */
41
+ create(inlineConfig: CreateInlineConfig): Promise<void>;
42
+ /**
43
+ * Generate the Powerlines typescript declaration file
44
+ *
45
+ * @remarks
46
+ * 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.
47
+ *
48
+ * @param inlineConfig - The inline configuration for the types command
49
+ */
50
+ types(inlineConfig: TypesInlineConfig): Promise<void>;
51
+ /**
52
+ * Prepare the Powerlines API
53
+ *
54
+ * @remarks
55
+ * This method will prepare the Powerlines API for use, initializing any necessary resources.
56
+ *
57
+ * @param inlineConfig - The inline configuration for the prepare command
58
+ */
59
+ prepare(inlineConfig: PrepareInlineConfig): Promise<void>;
60
+ /**
61
+ * Clean any previously prepared artifacts
62
+ *
63
+ * @remarks
64
+ * This method will remove the previous Powerlines artifacts from the project.
65
+ *
66
+ * @param inlineConfig - The inline configuration for the clean command
67
+ * @returns A promise that resolves when the clean command has completed
68
+ */
69
+ clean(inlineConfig: CleanInlineConfig): Promise<void>;
70
+ /**
71
+ * Lint the project
72
+ *
73
+ * @param inlineConfig - The inline configuration for the lint command
74
+ * @returns A promise that resolves when the lint command has completed
75
+ */
76
+ lint(inlineConfig: LintInlineConfig): Promise<void>;
77
+ /**
78
+ * Test the project
79
+ *
80
+ * @remarks
81
+ * This method will run the tests for the Powerlines project.
82
+ *
83
+ * @param inlineConfig - The inline configuration for the test command
84
+ * @returns A promise that resolves when the test command has completed
85
+ */
86
+ test(inlineConfig: TestInlineConfig): Promise<void>;
87
+ /**
88
+ * Build the project
89
+ *
90
+ * @remarks
91
+ * This method will build the Powerlines project, generating the necessary artifacts.
92
+ *
93
+ * @param inlineConfig - The inline configuration for the build command
94
+ * @returns A promise that resolves when the build command has completed
95
+ */
96
+ build(inlineConfig: BuildInlineConfig): Promise<void>;
97
+ /**
98
+ * Prepare the documentation for the project
99
+ *
100
+ * @param inlineConfig - The inline configuration for the docs command
101
+ * @returns A promise that resolves when the documentation generation has completed
102
+ */
103
+ docs(inlineConfig: DocsInlineConfig): Promise<void>;
104
+ /**
105
+ * Deploy the project source code
106
+ *
107
+ * @remarks
108
+ * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
109
+ *
110
+ * @param inlineConfig - The inline configuration for the deploy command
111
+ * @returns A promise that resolves when the deploy command has completed
112
+ */
113
+ deploy(inlineConfig: DeployInlineConfig): Promise<void>;
114
+ /**
115
+ * Finalization/cleanup processing for the Powerlines API
116
+ *
117
+ * @remarks
118
+ * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
119
+ *
120
+ * @returns A promise that resolves when the finalization process has completed
121
+ */
122
+ finalize(): Promise<void>;
123
+ /**
124
+ * Asynchronous disposal method for the Powerlines Engine, which will call the finalize method to perform any necessary cleanup when the engine is disposed of.
125
+ */
126
+ [Symbol.asyncDispose](): Promise<void>;
127
+ /**
128
+ * Execute a Powerlines command based on the provided execution path and inline configuration, loading the necessary executions from the context and managing their lifecycle.
129
+ *
130
+ * @remarks
131
+ * 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.
132
+ *
133
+ * @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.
134
+ * @param inlineConfig - Additional configuration options provided at runtime, which can override or supplement the options defined in the user configuration file.
135
+ * @returns A promise that resolves when all executions for the specified command have completed
136
+ */
137
+ protected execute(command: string, inlineConfig: InlineConfig): Promise<void>;
138
+ }
139
+ declare function createContext(options: EngineOptions): Promise<PowerlinesEngineContext<unknown>>;
140
+ declare function createEngine(options: EngineOptions, apiPath?: string): Promise<PowerlinesEngine>;
141
+ //#endregion
142
+ export { PowerlinesEngine, createContext, createEngine };
143
+ //# sourceMappingURL=engine.d.cts.map
@@ -0,0 +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;;;;;;AACyB;;;;EADzB,UAtDO,OAAA,CAAQ,OAAA,UAAiB,YAAA,EAAc,YAAA,GAAY,OAAA;AAAA;AAAA,iBA8B/C,aAAA,CAAc,OAAA,EAAS,aAAA,GAAa,OAAA,CAAA,uBAAA;AAAA,iBAuBpC,YAAA,CACpB,OAAA,EAAS,aAAA,EACT,OAAA,YAAkC,OAAA,CAAA,gBAAA"}