@powerlines/engine 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/build.cjs +66 -0
- package/dist/api/build.d.cts +14 -0
- package/dist/api/build.d.cts.map +1 -0
- package/dist/api/build.d.mts +14 -0
- package/dist/api/build.d.mts.map +1 -0
- package/dist/api/build.mjs +64 -0
- package/dist/api/build.mjs.map +1 -0
- package/dist/api/clean.cjs +29 -0
- package/dist/api/clean.d.cts +14 -0
- package/dist/api/clean.d.cts.map +1 -0
- package/dist/api/clean.d.mts +14 -0
- package/dist/api/clean.d.mts.map +1 -0
- package/dist/api/clean.mjs +28 -0
- package/dist/api/clean.mjs.map +1 -0
- package/dist/api/create.cjs +59 -0
- package/dist/api/create.d.cts +14 -0
- package/dist/api/create.d.cts.map +1 -0
- package/dist/api/create.d.mts +14 -0
- package/dist/api/create.d.mts.map +1 -0
- package/dist/api/create.mjs +57 -0
- package/dist/api/create.mjs.map +1 -0
- package/dist/api/deploy.cjs +25 -0
- package/dist/api/deploy.d.cts +17 -0
- package/dist/api/deploy.d.cts.map +1 -0
- package/dist/api/deploy.d.mts +17 -0
- package/dist/api/deploy.d.mts.map +1 -0
- package/dist/api/deploy.mjs +24 -0
- package/dist/api/deploy.mjs.map +1 -0
- package/dist/api/docs.cjs +25 -0
- package/dist/api/docs.d.cts +17 -0
- package/dist/api/docs.d.cts.map +1 -0
- package/dist/api/docs.d.mts +17 -0
- package/dist/api/docs.d.mts.map +1 -0
- package/dist/api/docs.mjs +24 -0
- package/dist/api/docs.mjs.map +1 -0
- package/dist/api/lint.cjs +28 -0
- package/dist/api/lint.d.cts +17 -0
- package/dist/api/lint.d.cts.map +1 -0
- package/dist/api/lint.d.mts +17 -0
- package/dist/api/lint.d.mts.map +1 -0
- package/dist/api/lint.mjs +27 -0
- package/dist/api/lint.mjs.map +1 -0
- package/dist/api/prepare.cjs +69 -0
- package/dist/api/prepare.d.cts +14 -0
- package/dist/api/prepare.d.cts.map +1 -0
- package/dist/api/prepare.d.mts +14 -0
- package/dist/api/prepare.d.mts.map +1 -0
- package/dist/api/prepare.mjs +68 -0
- package/dist/api/prepare.mjs.map +1 -0
- package/dist/api/test.cjs +28 -0
- package/dist/api/test.d.cts +17 -0
- package/dist/api/test.d.cts.map +1 -0
- package/dist/api/test.d.mts +17 -0
- package/dist/api/test.d.mts.map +1 -0
- package/dist/api/test.mjs +27 -0
- package/dist/api/test.mjs.map +1 -0
- package/dist/api/types.cjs +71 -0
- package/dist/api/types.d.cts +17 -0
- package/dist/api/types.d.cts.map +1 -0
- package/dist/api/types.d.mts +17 -0
- package/dist/api/types.d.mts.map +1 -0
- package/dist/api/types.mjs +70 -0
- package/dist/api/types.mjs.map +1 -0
- package/dist/api-6w4hZL6n.d.cts +135 -0
- package/dist/api-6w4hZL6n.d.cts.map +1 -0
- package/dist/api-Cdw4v0W4.d.mts +135 -0
- package/dist/api-Cdw4v0W4.d.mts.map +1 -0
- package/dist/config-BNe23XHx.d.mts +204 -0
- package/dist/config-BNe23XHx.d.mts.map +1 -0
- package/dist/config-D6xUniHh.d.cts +204 -0
- package/dist/config-D6xUniHh.d.cts.map +1 -0
- package/dist/context/engine-context.cjs +175 -0
- package/dist/context/engine-context.d.cts +2 -0
- package/dist/context/engine-context.d.mts +2 -0
- package/dist/context/engine-context.mjs +173 -0
- package/dist/context/engine-context.mjs.map +1 -0
- package/dist/context/index.cjs +2 -9
- package/dist/context/index.d.cts +2 -660
- package/dist/context/index.d.mts +2 -660
- package/dist/context/index.mjs +2 -4
- package/dist/context-DzgsMSWr.d.mts +149 -0
- package/dist/context-DzgsMSWr.d.mts.map +1 -0
- package/dist/context-epL7NPvL.d.cts +149 -0
- package/dist/context-epL7NPvL.d.cts.map +1 -0
- package/dist/engine-context-DEotmVzB.d.mts +54 -0
- package/dist/engine-context-DEotmVzB.d.mts.map +1 -0
- package/dist/engine-context-Dw8odBCo.d.cts +54 -0
- package/dist/engine-context-Dw8odBCo.d.cts.map +1 -0
- package/dist/engine.cjs +268 -0
- package/dist/engine.d.cts +143 -0
- package/dist/engine.d.cts.map +1 -0
- package/dist/engine.d.mts +143 -0
- package/dist/engine.d.mts.map +1 -0
- package/dist/engine.mjs +264 -0
- package/dist/engine.mjs.map +1 -0
- package/dist/execution-host.cjs +44 -0
- package/dist/execution-host.d.cts +14 -0
- package/dist/execution-host.d.cts.map +1 -0
- package/dist/execution-host.d.mts +14 -0
- package/dist/execution-host.d.mts.map +1 -0
- package/dist/execution-host.mjs +36 -0
- package/dist/execution-host.mjs.map +1 -0
- package/dist/helpers/create-execution-host.cjs +51 -0
- package/dist/helpers/create-execution-host.d.cts +21 -0
- package/dist/helpers/create-execution-host.d.cts.map +1 -0
- package/dist/helpers/create-execution-host.d.mts +21 -0
- package/dist/helpers/create-execution-host.d.mts.map +1 -0
- package/dist/helpers/create-execution-host.mjs +50 -0
- package/dist/helpers/create-execution-host.mjs.map +1 -0
- package/dist/helpers/execution-host-worker.cjs +308 -0
- package/dist/helpers/execution-host-worker.d.cts +68 -0
- package/dist/helpers/execution-host-worker.d.cts.map +1 -0
- package/dist/helpers/execution-host-worker.d.mts +68 -0
- package/dist/helpers/execution-host-worker.d.mts.map +1 -0
- package/dist/helpers/execution-host-worker.mjs +307 -0
- package/dist/helpers/execution-host-worker.mjs.map +1 -0
- package/dist/helpers/finalize.cjs +27 -0
- package/dist/helpers/finalize.d.cts +12 -0
- package/dist/helpers/finalize.d.cts.map +1 -0
- package/dist/helpers/finalize.d.mts +12 -0
- package/dist/helpers/finalize.d.mts.map +1 -0
- package/dist/helpers/finalize.mjs +26 -0
- package/dist/helpers/finalize.mjs.map +1 -0
- package/dist/helpers/rpc.cjs +140 -0
- package/dist/helpers/rpc.d.cts +7 -0
- package/dist/helpers/rpc.d.cts.map +1 -0
- package/dist/helpers/rpc.d.mts +7 -0
- package/dist/helpers/rpc.d.mts.map +1 -0
- package/dist/helpers/rpc.mjs +139 -0
- package/dist/helpers/rpc.mjs.map +1 -0
- package/dist/index-CNgSR_kt.d.mts +1 -0
- package/dist/index-D_TYgLX3.d.cts +1 -0
- package/dist/index.cjs +13 -567
- package/dist/index.d.cts +9 -126
- package/dist/index.d.mts +9 -126
- package/dist/index.mjs +7 -567
- package/package.json +101 -129
- package/dist/_internal/worker.cjs +0 -4843
- package/dist/_internal/worker.d.cts +0 -38
- package/dist/_internal/worker.d.cts.map +0 -1
- package/dist/_internal/worker.d.mts +0 -38
- package/dist/_internal/worker.d.mts.map +0 -1
- package/dist/_internal/worker.mjs +0 -4804
- package/dist/_internal/worker.mjs.map +0 -1
- package/dist/api.cjs +0 -1274
- package/dist/api.d.cts +0 -265
- package/dist/api.d.cts.map +0 -1
- package/dist/api.d.mts +0 -265
- package/dist/api.d.mts.map +0 -1
- package/dist/api.mjs +0 -1270
- package/dist/api.mjs.map +0 -1
- package/dist/base-context-BUnL_9z8.mjs +0 -241
- package/dist/base-context-BUnL_9z8.mjs.map +0 -1
- package/dist/base-context-CFvO2N9I.cjs +0 -248
- package/dist/context/index.d.cts.map +0 -1
- package/dist/context/index.d.mts.map +0 -1
- package/dist/engine-context-BuD9AGfd.mjs +0 -41
- package/dist/engine-context-BuD9AGfd.mjs.map +0 -1
- package/dist/engine-context-NO6enYev.cjs +0 -45
- package/dist/execution-context-BgGV4xyW.cjs +0 -2614
- package/dist/execution-context-D_CXpe9I.mjs +0 -2570
- package/dist/execution-context-D_CXpe9I.mjs.map +0 -1
- package/dist/fs-D1nIP45P.mjs +0 -226
- package/dist/fs-D1nIP45P.mjs.map +0 -1
- package/dist/fs-XogSgMqT.cjs +0 -262
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/schemas.cjs +0 -9
- package/dist/schemas.d.cts +0 -127
- package/dist/schemas.d.cts.map +0 -1
- package/dist/schemas.d.mts +0 -127
- package/dist/schemas.d.mts.map +0 -1
- package/dist/schemas.mjs +0 -3
- package/dist/storage/index.cjs +0 -9
- package/dist/storage/index.d.cts +0 -419
- package/dist/storage/index.d.cts.map +0 -1
- package/dist/storage/index.d.mts +0 -419
- package/dist/storage/index.d.mts.map +0 -1
- package/dist/storage/index.mjs +0 -3
- package/dist/ts-morph-BaLPVAdB.cjs +0 -114
- package/dist/ts-morph-D0CaA37w.mjs +0 -102
- package/dist/ts-morph-D0CaA37w.mjs.map +0 -1
- package/dist/tsconfig-Cstsoprg.mjs +0 -155
- package/dist/tsconfig-Cstsoprg.mjs.map +0 -1
- package/dist/tsconfig-DeyWQC2N.cjs +0 -198
- package/dist/typescript/index.cjs +0 -13
- package/dist/typescript/index.d.cts +0 -106
- package/dist/typescript/index.d.cts.map +0 -1
- package/dist/typescript/index.d.mts +0 -106
- package/dist/typescript/index.d.mts.map +0 -1
- package/dist/typescript/index.mjs +0 -4
- package/dist/virtual-BNdKVkRw.cjs +0 -548
- package/dist/virtual-gIlTc3Lj.mjs +0 -513
- package/dist/virtual-gIlTc3Lj.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/api/types.ts"],"mappings":";;;;;;;AA8CA;;;;;;iBAAsB,KAAA,yBACI,oBAAA,yBACD,mBAAA,CAAA,CACvB,OAAA,EAAS,gBAAA,CAAiB,eAAA,EAAiB,cAAA,IAAe,OAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { prepare } from "./prepare.mjs";
|
|
2
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
3
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
4
|
+
import { executeEnvironments } from "@powerlines/core/lib/environment";
|
|
5
|
+
import { handleTypes } from "@powerlines/core/lib/generate-types";
|
|
6
|
+
import { installDependencies } from "@powerlines/core/lib/install-dependencies";
|
|
7
|
+
import { writeMetaFile } from "@powerlines/core/lib/meta";
|
|
8
|
+
import { initializeTsconfig, resolveTsconfig } from "@powerlines/core/lib/typescript/tsconfig";
|
|
9
|
+
import { format } from "@powerlines/core/lib/utilities/format";
|
|
10
|
+
import { createDirectory } from "@stryke/fs/helpers";
|
|
11
|
+
import { isObject } from "@stryke/type-checks/is-object";
|
|
12
|
+
import { formatLogMessage } from "@storm-software/config-tools/logger";
|
|
13
|
+
import { omit } from "@stryke/helpers/omit";
|
|
14
|
+
|
|
15
|
+
//#region src/api/types.ts
|
|
16
|
+
/**
|
|
17
|
+
* Generate runtime types for the Powerlines project.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* This function is responsible for generating TypeScript declaration files based on the project's configuration and environment. It executes hooks at various stages of the type generation process, allowing for customization and extension by plugins. The generated types are formatted and written to the appropriate location in the project's file system, ensuring that they are available for use by other parts of the Powerlines system and by end-users of the project.
|
|
21
|
+
*
|
|
22
|
+
* @param context - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.
|
|
23
|
+
*/
|
|
24
|
+
async function types(context) {
|
|
25
|
+
const timer = context.timer("Type Generation");
|
|
26
|
+
context.debug(" Aggregating configuration options for the Powerlines project");
|
|
27
|
+
await executeEnvironments(context, async (env) => {
|
|
28
|
+
env.debug(`Initializing the processing options for the Powerlines project.`);
|
|
29
|
+
await context.callHook("configResolved", {
|
|
30
|
+
environment: env,
|
|
31
|
+
order: "pre"
|
|
32
|
+
});
|
|
33
|
+
await initializeTsconfig(env);
|
|
34
|
+
await context.callHook("configResolved", {
|
|
35
|
+
environment: env,
|
|
36
|
+
order: "normal"
|
|
37
|
+
});
|
|
38
|
+
if (env.entry.length > 0) env.debug(`The configuration provided ${isObject(env.config.input) ? Object.keys(env.config.input).length : toArray(env.config.input).length} entry point(s), Powerlines has found ${env.entry.length} entry files(s) for the ${env.config.title} project${env.entry.length > 0 && env.entry.length < 10 ? `: \n${env.entry.map((entry) => `- ${entry.file}${entry.output ? ` -> ${entry.output}` : ""}`).join(" \n")}` : ""}`);
|
|
39
|
+
else env.warn(`No entry files were found for the ${env.config.title} project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`);
|
|
40
|
+
await resolveTsconfig(env);
|
|
41
|
+
await installDependencies(env);
|
|
42
|
+
await context.callHook("configResolved", {
|
|
43
|
+
environment: env,
|
|
44
|
+
order: "post"
|
|
45
|
+
});
|
|
46
|
+
context.trace(`Powerlines configuration has been resolved: \n\n${formatLogMessage({
|
|
47
|
+
...env.config,
|
|
48
|
+
userConfig: isSetObject(env.config.userConfig) ? omit(env.config.userConfig, ["plugins"]) : void 0,
|
|
49
|
+
inlineConfig: isSetObject(env.config.inlineConfig) ? env.config.inlineConfig : void 0,
|
|
50
|
+
plugins: env.plugins.map((plugin) => plugin.name)
|
|
51
|
+
})}`);
|
|
52
|
+
if (!env.fs.existsSync(env.cachePath)) await createDirectory(env.cachePath);
|
|
53
|
+
if (!env.fs.existsSync(env.dataPath)) await createDirectory(env.dataPath);
|
|
54
|
+
if (env.config.skipCache === true || env.persistedMeta?.checksum !== env.meta.checksum) env.debug(`Using previously prepared files as the meta checksum has not changed.`);
|
|
55
|
+
else {
|
|
56
|
+
env.info(`Running \`prepare\` command as the meta checksum has changed since the last run.`);
|
|
57
|
+
await prepare(context, true);
|
|
58
|
+
}
|
|
59
|
+
await handleTypes(context, env);
|
|
60
|
+
context.debug("Formatting files generated during the types step.");
|
|
61
|
+
await format(env, env.typesPath, await env.fs.read(env.typesPath) ?? "");
|
|
62
|
+
await writeMetaFile(env);
|
|
63
|
+
env.persistedMeta = env.meta;
|
|
64
|
+
});
|
|
65
|
+
timer();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { types };
|
|
70
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../../src/api/types.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 { executeEnvironments } from \"@powerlines/core/lib/environment\";\nimport { handleTypes } from \"@powerlines/core/lib/generate-types\";\nimport { installDependencies } from \"@powerlines/core/lib/install-dependencies\";\nimport { writeMetaFile } from \"@powerlines/core/lib/meta\";\nimport {\n initializeTsconfig,\n resolveTsconfig\n} from \"@powerlines/core/lib/typescript/tsconfig\";\nimport { format } from \"@powerlines/core/lib/utilities/format\";\nimport { ExecutionContext } from \"@powerlines/core/types/context\";\nimport { formatLogMessage } from \"@storm-software/config-tools/logger\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { createDirectory } from \"@stryke/fs/helpers\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { EngineResolvedConfig } from \"../types/config\";\nimport { EngineSystemContext } from \"../types/context\";\nimport { prepare } from \"./prepare\";\n\n/**\n * Generate runtime types for the Powerlines project.\n *\n * @remarks\n * This function is responsible for generating TypeScript declaration files based on the project's configuration and environment. It executes hooks at various stages of the type generation process, allowing for customization and extension by plugins. The generated types are formatted and written to the appropriate location in the project's file system, ensuring that they are available for use by other parts of the Powerlines system and by end-users of the project.\n *\n * @param context - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n */\nexport async function types<\n TResolvedConfig extends EngineResolvedConfig,\n TSystemContext extends EngineSystemContext\n>(context: ExecutionContext<TResolvedConfig, TSystemContext>) {\n const timer = context.timer(\"Type Generation\");\n context.debug(\n \" Aggregating configuration options for the Powerlines project\"\n );\n\n await executeEnvironments(context, async env => {\n env.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"pre\"\n });\n\n await initializeTsconfig<TResolvedConfig, TSystemContext>(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"normal\"\n });\n\n if (env.entry.length > 0) {\n env.debug(\n `The configuration provided ${\n isObject(env.config.input)\n ? Object.keys(env.config.input).length\n : toArray(env.config.input).length\n } entry point(s), Powerlines has found ${\n env.entry.length\n } entry files(s) for the ${env.config.title} project${\n env.entry.length > 0 && env.entry.length < 10\n ? `: \\n${env.entry\n .map(\n entry =>\n `- ${entry.file}${\n entry.output ? ` -> ${entry.output}` : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n env.warn(\n `No entry files were found for the ${\n env.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig<TResolvedConfig, TSystemContext>(env);\n await installDependencies(env);\n\n await context.callHook(\"configResolved\", {\n environment: env,\n order: \"post\"\n });\n\n context.trace(\n `Powerlines configuration has been resolved: \\n\\n${formatLogMessage({\n ...env.config,\n userConfig: isSetObject(env.config.userConfig)\n ? omit(env.config.userConfig, [\"plugins\"])\n : undefined,\n inlineConfig: isSetObject(env.config.inlineConfig)\n ? env.config.inlineConfig\n : undefined,\n plugins: env.plugins.map(plugin => plugin.name)\n })}`\n );\n\n if (!env.fs.existsSync(env.cachePath)) {\n await createDirectory(env.cachePath);\n }\n\n if (!env.fs.existsSync(env.dataPath)) {\n await createDirectory(env.dataPath);\n }\n\n if (\n env.config.skipCache === true ||\n env.persistedMeta?.checksum !== env.meta.checksum\n ) {\n env.debug(\n `Using previously prepared files as the meta checksum has not changed.`\n );\n } else {\n env.info(\n `Running \\`prepare\\` command as the meta checksum has changed since the last run.`\n );\n\n await prepare(context, true);\n }\n\n await handleTypes(context, env);\n\n context.debug(\"Formatting files generated during the types step.\");\n\n await format(env, env.typesPath, (await env.fs.read(env.typesPath)) ?? \"\");\n\n await writeMetaFile(env);\n env.persistedMeta = env.meta;\n });\n\n timer();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8CA,eAAsB,MAGpB,SAA4D;CAC5D,MAAM,QAAQ,QAAQ,MAAM,kBAAkB;AAC9C,SAAQ,MACN,gEACD;AAED,OAAM,oBAAoB,SAAS,OAAM,QAAO;AAC9C,MAAI,MACF,kEACD;AAED,QAAM,QAAQ,SAAS,kBAAkB;GACvC,aAAa;GACb,OAAO;GACR,CAAC;AAEF,QAAM,mBAAoD,IAAI;AAE9D,QAAM,QAAQ,SAAS,kBAAkB;GACvC,aAAa;GACb,OAAO;GACR,CAAC;AAEF,MAAI,IAAI,MAAM,SAAS,EACrB,KAAI,MACF,8BACE,SAAS,IAAI,OAAO,MAAM,GACtB,OAAO,KAAK,IAAI,OAAO,MAAM,CAAC,SAC9B,QAAQ,IAAI,OAAO,MAAM,CAAC,OAC/B,wCACC,IAAI,MAAM,OACX,0BAA0B,IAAI,OAAO,MAAM,UAC1C,IAAI,MAAM,SAAS,KAAK,IAAI,MAAM,SAAS,KACvC,OAAO,IAAI,MACR,KACC,UACE,KAAK,MAAM,OACT,MAAM,SAAS,OAAO,MAAM,WAAW,KAE5C,CACA,KAAK,MAAM,KACd,KAEP;MAED,KAAI,KACF,qCACE,IAAI,OAAO,MACZ,8HACF;AAGH,QAAM,gBAAiD,IAAI;AAC3D,QAAM,oBAAoB,IAAI;AAE9B,QAAM,QAAQ,SAAS,kBAAkB;GACvC,aAAa;GACb,OAAO;GACR,CAAC;AAEF,UAAQ,MACN,mDAAmD,iBAAiB;GAClE,GAAG,IAAI;GACP,YAAY,YAAY,IAAI,OAAO,WAAW,GAC1C,KAAK,IAAI,OAAO,YAAY,CAAC,UAAU,CAAC,GACxC;GACJ,cAAc,YAAY,IAAI,OAAO,aAAa,GAC9C,IAAI,OAAO,eACX;GACJ,SAAS,IAAI,QAAQ,KAAI,WAAU,OAAO,KAAK;GAChD,CAAC,GACH;AAED,MAAI,CAAC,IAAI,GAAG,WAAW,IAAI,UAAU,CACnC,OAAM,gBAAgB,IAAI,UAAU;AAGtC,MAAI,CAAC,IAAI,GAAG,WAAW,IAAI,SAAS,CAClC,OAAM,gBAAgB,IAAI,SAAS;AAGrC,MACE,IAAI,OAAO,cAAc,QACzB,IAAI,eAAe,aAAa,IAAI,KAAK,SAEzC,KAAI,MACF,wEACD;OACI;AACL,OAAI,KACF,mFACD;AAED,SAAM,QAAQ,SAAS,KAAK;;AAG9B,QAAM,YAAY,SAAS,IAAI;AAE/B,UAAQ,MAAM,oDAAoD;AAElE,QAAM,OAAO,KAAK,IAAI,WAAY,MAAM,IAAI,GAAG,KAAK,IAAI,UAAU,IAAK,GAAG;AAE1E,QAAM,cAAc,IAAI;AACxB,MAAI,gBAAgB,IAAI;GACxB;AAEF,QAAO"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { t as EngineExecutionOptions } from "./config-D6xUniHh.cjs";
|
|
2
|
+
import { t as EngineContext } from "./context-epL7NPvL.cjs";
|
|
3
|
+
import { BuildInlineConfig, CleanInlineConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, InlineConfig, LintInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
|
|
4
|
+
import { EXECUTION_API_METHODS } from "@powerlines/core/constants/api";
|
|
5
|
+
|
|
6
|
+
//#region src/types/utils.d.ts
|
|
7
|
+
type Worker<TParams, TExposedMethods extends ReadonlyArray<string>> = { [K in TExposedMethods[number]]: (params: TParams) => Promise<void> } & {
|
|
8
|
+
close: () => void;
|
|
9
|
+
end: () => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/types/api.d.ts
|
|
13
|
+
/**
|
|
14
|
+
* The Powerlines Base API Interface
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* This interface defines the base API for Powerlines, which includes the shared context and the core commands. It is extended by the ExecutionAPI and EngineAPI interfaces to provide additional functionality specific to their respective contexts.
|
|
18
|
+
*/
|
|
19
|
+
interface ExecutionInterface {
|
|
20
|
+
/**
|
|
21
|
+
* Prepare the Powerlines API
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* This method will prepare the Powerlines API for use, initializing any necessary resources.
|
|
25
|
+
*
|
|
26
|
+
* @param inlineConfig - The inline configuration for the prepare command
|
|
27
|
+
*/
|
|
28
|
+
prepare: (inlineConfig: PrepareInlineConfig) => Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Generate the Powerlines typescript declaration file
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* 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.
|
|
34
|
+
*
|
|
35
|
+
* @param inlineConfig - The inline configuration for the types command
|
|
36
|
+
*/
|
|
37
|
+
types: (inlineConfig: TypesInlineConfig) => Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Create a new Powerlines project
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* This method will create a new Powerlines project in the current directory.
|
|
43
|
+
*
|
|
44
|
+
* @param inlineConfig - The inline configuration for the create command
|
|
45
|
+
* @returns A promise that resolves when the project has been created
|
|
46
|
+
*/
|
|
47
|
+
create: (inlineConfig: CreateInlineConfig) => Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Clean any previously prepared artifacts
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* This method will remove the previous Powerlines artifacts from the project.
|
|
53
|
+
*
|
|
54
|
+
* @param inlineConfig - The inline configuration for the clean command
|
|
55
|
+
* @returns A promise that resolves when the clean command has completed
|
|
56
|
+
*/
|
|
57
|
+
clean: (inlineConfig: CleanInlineConfig) => Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Lint the project source code
|
|
60
|
+
*
|
|
61
|
+
* @param inlineConfig - The inline configuration for the lint command
|
|
62
|
+
* @returns A promise that resolves when the lint command has completed
|
|
63
|
+
*/
|
|
64
|
+
lint: (inlineConfig: LintInlineConfig) => Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Test the project source code
|
|
67
|
+
*
|
|
68
|
+
* @param inlineConfig - The inline configuration for the test command
|
|
69
|
+
* @returns A promise that resolves when the test command has completed
|
|
70
|
+
*/
|
|
71
|
+
test: (inlineConfig: TestInlineConfig) => Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Build the project
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* This method will build the Powerlines project, generating the necessary artifacts.
|
|
77
|
+
*
|
|
78
|
+
* @param inlineConfig - The inline configuration for the build command
|
|
79
|
+
* @returns A promise that resolves when the build command has completed
|
|
80
|
+
*/
|
|
81
|
+
build: (inlineConfig: BuildInlineConfig) => Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Prepare the documentation for the project
|
|
84
|
+
*
|
|
85
|
+
* @param inlineConfig - The inline configuration for the docs command
|
|
86
|
+
* @returns A promise that resolves when the documentation generation has completed
|
|
87
|
+
*/
|
|
88
|
+
docs: (inlineConfig: DocsInlineConfig) => Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Deploy the project source code
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
|
|
94
|
+
*
|
|
95
|
+
* @param inlineConfig - The inline configuration for the deploy command
|
|
96
|
+
*/
|
|
97
|
+
deploy: (inlineConfig: DeployInlineConfig) => Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Finalization process
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
|
|
103
|
+
*
|
|
104
|
+
* @returns A promise that resolves when the finalization process has completed
|
|
105
|
+
*/
|
|
106
|
+
finalize: () => Promise<void>;
|
|
107
|
+
}
|
|
108
|
+
interface ExecutionHostParams {
|
|
109
|
+
/**
|
|
110
|
+
* The execution options for the current execution instance
|
|
111
|
+
*/
|
|
112
|
+
options: EngineExecutionOptions;
|
|
113
|
+
/**
|
|
114
|
+
* The inline configuration for the current execution instance, which is the result of merging the user configuration with any configuration provided by plugins during the "config" hook.
|
|
115
|
+
*/
|
|
116
|
+
inlineConfig: InlineConfig;
|
|
117
|
+
}
|
|
118
|
+
type ExecutionHost<TExecutionAPI extends ReadonlyArray<string>> = Worker<ExecutionHostParams, TExecutionAPI>;
|
|
119
|
+
type PowerlinesExecutionHost = ExecutionHost<typeof EXECUTION_API_METHODS>;
|
|
120
|
+
/**
|
|
121
|
+
* The Engine interface represents the Powerlines process' orchestration and coordination API.
|
|
122
|
+
*/
|
|
123
|
+
interface Engine<TExecutionAPI extends ReadonlyArray<string>> extends ExecutionInterface {
|
|
124
|
+
/**
|
|
125
|
+
* The Powerlines shared context
|
|
126
|
+
*/
|
|
127
|
+
context: EngineContext;
|
|
128
|
+
/**
|
|
129
|
+
* 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.
|
|
130
|
+
*/
|
|
131
|
+
host: ExecutionHost<TExecutionAPI>;
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
export { PowerlinesExecutionHost as a, ExecutionInterface as i, ExecutionHost as n, Worker as o, ExecutionHostParams as r, Engine as t };
|
|
135
|
+
//# sourceMappingURL=api-6w4hZL6n.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-6w4hZL6n.d.cts","names":[],"sources":["../src/types/utils.ts","../src/types/api.ts"],"mappings":";;;;;;KAkBY,MAAA,kCAAwC,aAAA,oBAC5C,eAAA,YAA2B,MAAA,EAAQ,OAAA,KAAY,OAAA;EAErD,KAAA;EACA,GAAA,QAAW,OAAA;AAAA;;;;AAJb;;;;;UCuBiB,kBAAA;EDtBsC;;;;;;;;EC+BrD,OAAA,GAAU,YAAA,EAAc,mBAAA,KAAwB,OAAA;ED/BP;;;;;;;;ECyCzC,KAAA,GAAQ,YAAA,EAAc,iBAAA,KAAsB,OAAA;;;AAnB9C;;;;;;;EA8BE,MAAA,GAAS,YAAA,EAAc,kBAAA,KAAuB,OAAA;EAAA;;;;;;;;;EAW9C,KAAA,GAAQ,YAAA,EAAc,iBAAA,KAAsB,OAAA;EAmCF;;;;;;EA3B1C,IAAA,GAAO,YAAA,EAAc,gBAAA,KAAqB,OAAA;EAxClB;;;;;;EAgDxB,IAAA,GAAO,YAAA,EAAc,gBAAA,KAAqB,OAAA;EA3B1C;;;;;;;;;EAsCA,KAAA,GAAQ,YAAA,EAAc,iBAAA,KAAsB,OAAA;EAnBrC;;;;;;EA2BP,IAAA,GAAO,YAAA,EAAc,gBAAA,KAAqB,OAAA;EARpB;;;;;;;;EAkBtB,MAAA,GAAS,YAAA,EAAc,kBAAA,KAAuB,OAAA;EAArC;;;;;;AAaX;;EAHE,QAAA,QAAgB,OAAA;AAAA;AAAA,UAGD,mBAAA;EAIN;;;EAAT,OAAA,EAAS,sBAAA;EAKiB;AAG5B;;EAHE,YAAA,EAAc,YAAA;AAAA;AAAA,KAGJ,aAAA,uBAAoC,aAAA,YAAyB,MAAA,CACvE,mBAAA,EACA,aAAA;AAAA,KAGU,uBAAA,GAA0B,aAAA,QAC7B,qBAAA;;;;UAMQ,MAAA,uBACO,aAAA,kBACd,kBAAA;EAdsC;;;EAkB9C,OAAA,EAAS,aAAA;EAhBI;;AAGf;EAkBE,IAAA,EAAM,aAAA,CAAc,aAAA;AAAA"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { t as EngineExecutionOptions } from "./config-BNe23XHx.mjs";
|
|
2
|
+
import { t as EngineContext } from "./context-DzgsMSWr.mjs";
|
|
3
|
+
import { BuildInlineConfig, CleanInlineConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, InlineConfig, LintInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
|
|
4
|
+
import { EXECUTION_API_METHODS } from "@powerlines/core/constants/api";
|
|
5
|
+
|
|
6
|
+
//#region src/types/utils.d.ts
|
|
7
|
+
type Worker<TParams, TExposedMethods extends ReadonlyArray<string>> = { [K in TExposedMethods[number]]: (params: TParams) => Promise<void> } & {
|
|
8
|
+
close: () => void;
|
|
9
|
+
end: () => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/types/api.d.ts
|
|
13
|
+
/**
|
|
14
|
+
* The Powerlines Base API Interface
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* This interface defines the base API for Powerlines, which includes the shared context and the core commands. It is extended by the ExecutionAPI and EngineAPI interfaces to provide additional functionality specific to their respective contexts.
|
|
18
|
+
*/
|
|
19
|
+
interface ExecutionInterface {
|
|
20
|
+
/**
|
|
21
|
+
* Prepare the Powerlines API
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* This method will prepare the Powerlines API for use, initializing any necessary resources.
|
|
25
|
+
*
|
|
26
|
+
* @param inlineConfig - The inline configuration for the prepare command
|
|
27
|
+
*/
|
|
28
|
+
prepare: (inlineConfig: PrepareInlineConfig) => Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Generate the Powerlines typescript declaration file
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* 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.
|
|
34
|
+
*
|
|
35
|
+
* @param inlineConfig - The inline configuration for the types command
|
|
36
|
+
*/
|
|
37
|
+
types: (inlineConfig: TypesInlineConfig) => Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Create a new Powerlines project
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* This method will create a new Powerlines project in the current directory.
|
|
43
|
+
*
|
|
44
|
+
* @param inlineConfig - The inline configuration for the create command
|
|
45
|
+
* @returns A promise that resolves when the project has been created
|
|
46
|
+
*/
|
|
47
|
+
create: (inlineConfig: CreateInlineConfig) => Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Clean any previously prepared artifacts
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* This method will remove the previous Powerlines artifacts from the project.
|
|
53
|
+
*
|
|
54
|
+
* @param inlineConfig - The inline configuration for the clean command
|
|
55
|
+
* @returns A promise that resolves when the clean command has completed
|
|
56
|
+
*/
|
|
57
|
+
clean: (inlineConfig: CleanInlineConfig) => Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Lint the project source code
|
|
60
|
+
*
|
|
61
|
+
* @param inlineConfig - The inline configuration for the lint command
|
|
62
|
+
* @returns A promise that resolves when the lint command has completed
|
|
63
|
+
*/
|
|
64
|
+
lint: (inlineConfig: LintInlineConfig) => Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Test the project source code
|
|
67
|
+
*
|
|
68
|
+
* @param inlineConfig - The inline configuration for the test command
|
|
69
|
+
* @returns A promise that resolves when the test command has completed
|
|
70
|
+
*/
|
|
71
|
+
test: (inlineConfig: TestInlineConfig) => Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Build the project
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* This method will build the Powerlines project, generating the necessary artifacts.
|
|
77
|
+
*
|
|
78
|
+
* @param inlineConfig - The inline configuration for the build command
|
|
79
|
+
* @returns A promise that resolves when the build command has completed
|
|
80
|
+
*/
|
|
81
|
+
build: (inlineConfig: BuildInlineConfig) => Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Prepare the documentation for the project
|
|
84
|
+
*
|
|
85
|
+
* @param inlineConfig - The inline configuration for the docs command
|
|
86
|
+
* @returns A promise that resolves when the documentation generation has completed
|
|
87
|
+
*/
|
|
88
|
+
docs: (inlineConfig: DocsInlineConfig) => Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Deploy the project source code
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
|
|
94
|
+
*
|
|
95
|
+
* @param inlineConfig - The inline configuration for the deploy command
|
|
96
|
+
*/
|
|
97
|
+
deploy: (inlineConfig: DeployInlineConfig) => Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Finalization process
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
|
|
103
|
+
*
|
|
104
|
+
* @returns A promise that resolves when the finalization process has completed
|
|
105
|
+
*/
|
|
106
|
+
finalize: () => Promise<void>;
|
|
107
|
+
}
|
|
108
|
+
interface ExecutionHostParams {
|
|
109
|
+
/**
|
|
110
|
+
* The execution options for the current execution instance
|
|
111
|
+
*/
|
|
112
|
+
options: EngineExecutionOptions;
|
|
113
|
+
/**
|
|
114
|
+
* The inline configuration for the current execution instance, which is the result of merging the user configuration with any configuration provided by plugins during the "config" hook.
|
|
115
|
+
*/
|
|
116
|
+
inlineConfig: InlineConfig;
|
|
117
|
+
}
|
|
118
|
+
type ExecutionHost<TExecutionAPI extends ReadonlyArray<string>> = Worker<ExecutionHostParams, TExecutionAPI>;
|
|
119
|
+
type PowerlinesExecutionHost = ExecutionHost<typeof EXECUTION_API_METHODS>;
|
|
120
|
+
/**
|
|
121
|
+
* The Engine interface represents the Powerlines process' orchestration and coordination API.
|
|
122
|
+
*/
|
|
123
|
+
interface Engine<TExecutionAPI extends ReadonlyArray<string>> extends ExecutionInterface {
|
|
124
|
+
/**
|
|
125
|
+
* The Powerlines shared context
|
|
126
|
+
*/
|
|
127
|
+
context: EngineContext;
|
|
128
|
+
/**
|
|
129
|
+
* 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.
|
|
130
|
+
*/
|
|
131
|
+
host: ExecutionHost<TExecutionAPI>;
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
export { PowerlinesExecutionHost as a, ExecutionInterface as i, ExecutionHost as n, Worker as o, ExecutionHostParams as r, Engine as t };
|
|
135
|
+
//# sourceMappingURL=api-Cdw4v0W4.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-Cdw4v0W4.d.mts","names":[],"sources":["../src/types/utils.ts","../src/types/api.ts"],"mappings":";;;;;;KAkBY,MAAA,kCAAwC,aAAA,oBAC5C,eAAA,YAA2B,MAAA,EAAQ,OAAA,KAAY,OAAA;EAErD,KAAA;EACA,GAAA,QAAW,OAAA;AAAA;;;;AAJb;;;;;UCuBiB,kBAAA;EDtBsC;;;;;;;;EC+BrD,OAAA,GAAU,YAAA,EAAc,mBAAA,KAAwB,OAAA;ED/BP;;;;;;;;ECyCzC,KAAA,GAAQ,YAAA,EAAc,iBAAA,KAAsB,OAAA;;;AAnB9C;;;;;;;EA8BE,MAAA,GAAS,YAAA,EAAc,kBAAA,KAAuB,OAAA;EAAA;;;;;;;;;EAW9C,KAAA,GAAQ,YAAA,EAAc,iBAAA,KAAsB,OAAA;EAmCF;;;;;;EA3B1C,IAAA,GAAO,YAAA,EAAc,gBAAA,KAAqB,OAAA;EAxClB;;;;;;EAgDxB,IAAA,GAAO,YAAA,EAAc,gBAAA,KAAqB,OAAA;EA3B1C;;;;;;;;;EAsCA,KAAA,GAAQ,YAAA,EAAc,iBAAA,KAAsB,OAAA;EAnBrC;;;;;;EA2BP,IAAA,GAAO,YAAA,EAAc,gBAAA,KAAqB,OAAA;EARpB;;;;;;;;EAkBtB,MAAA,GAAS,YAAA,EAAc,kBAAA,KAAuB,OAAA;EAArC;;;;;;AAaX;;EAHE,QAAA,QAAgB,OAAA;AAAA;AAAA,UAGD,mBAAA;EAIN;;;EAAT,OAAA,EAAS,sBAAA;EAKiB;AAG5B;;EAHE,YAAA,EAAc,YAAA;AAAA;AAAA,KAGJ,aAAA,uBAAoC,aAAA,YAAyB,MAAA,CACvE,mBAAA,EACA,aAAA;AAAA,KAGU,uBAAA,GAA0B,aAAA,QAC7B,qBAAA;;;;UAMQ,MAAA,uBACO,aAAA,kBACd,kBAAA;EAdsC;;;EAkB9C,OAAA,EAAS,aAAA;EAhBI;;AAGf;EAkBE,IAAA,EAAM,aAAA,CAAc,aAAA;AAAA"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { CustomLogger, ExecutionOptions, FrameworkOptions, LogMeta, Options, ResolvedConfig, UserConfig } from "@powerlines/core";
|
|
2
|
+
import { RpcStreamingClientHost } from "devframe/client";
|
|
3
|
+
import { RpcCacheManager, RpcCacheOptions, RpcFunctionsCollector } from "devframe/rpc";
|
|
4
|
+
import { WsRpcChannelOptions } from "devframe/rpc/transports/ws-client";
|
|
5
|
+
import { MaybePromise, PartialKeys, RequiredKeys } from "@stryke/types/base";
|
|
6
|
+
import { BirpcOptions, BirpcReturn, ProxifiedRemoteFunctions } from "birpc";
|
|
7
|
+
import { ConnectionMeta, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevframeDefinition, EventEmitter, RpcSharedStateHost } from "devframe/types";
|
|
8
|
+
import { Asyncify } from "@stryke/types/async";
|
|
9
|
+
|
|
10
|
+
//#region src/types/rpc.d.ts
|
|
11
|
+
interface RpcPayloadMetadata {
|
|
12
|
+
/**
|
|
13
|
+
* A unique identifier for correlating related Rpc messages, which can be used to group messages that belong to the same logical operation or workflow across different parts of the system. This is a required field and should be generated by the sender of the message.
|
|
14
|
+
*/
|
|
15
|
+
messageId: string;
|
|
16
|
+
/**
|
|
17
|
+
* The type of the Rpc message, which indicates the purpose of the message and how it should be handled by the receiving end. This is a required field and must be one of the predefined values in the IpcMessageType enum.
|
|
18
|
+
*/
|
|
19
|
+
type: string;
|
|
20
|
+
/**
|
|
21
|
+
* The timestamp when the Rpc message was created, represented as the number of milliseconds since the Unix epoch.
|
|
22
|
+
*/
|
|
23
|
+
timestamp: number;
|
|
24
|
+
/**
|
|
25
|
+
* A unique identifier for the current execution instance, which can be used for logging and other purposes to distinguish between different executions in the same process.
|
|
26
|
+
*/
|
|
27
|
+
executionId?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The zero-based index of the current execution within the sequence of executions in the same process.
|
|
30
|
+
*/
|
|
31
|
+
configIndex?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Optional environment identifier to specify the context or environment in which the message is being processed.
|
|
34
|
+
*/
|
|
35
|
+
environment?: string;
|
|
36
|
+
}
|
|
37
|
+
interface RpcPayloadEnvelop<TPayload> extends RpcPayloadMetadata {
|
|
38
|
+
/**
|
|
39
|
+
* The payload data associated with the Rpc message, typed according to the message type.
|
|
40
|
+
*/
|
|
41
|
+
payload: TPayload;
|
|
42
|
+
}
|
|
43
|
+
type RpcFunction = (payload: any) => MaybePromise<any>;
|
|
44
|
+
type RpcFunctions = Record<string, RpcFunction>;
|
|
45
|
+
type InputRpcFunction = (envelop: RpcPayloadEnvelop<any>) => any;
|
|
46
|
+
type InputRpcFunctions = Record<string, InputRpcFunction>;
|
|
47
|
+
type WrappedRpcFunction = (envelop: RpcPayloadEnvelop<any>) => Promise<any>;
|
|
48
|
+
type WrappedRpcFunctions = Record<string, WrappedRpcFunction>;
|
|
49
|
+
type ExtractRpcFunction<TFunction extends WrappedRpcFunction> = (payload: Parameters<TFunction>[0]["payload"]) => ReturnType<Asyncify<TFunction>>;
|
|
50
|
+
type ExtractRpcFunctions<TFunctions extends WrappedRpcFunctions> = { [TKey in keyof TFunctions]: ExtractRpcFunction<TFunctions[TKey]> };
|
|
51
|
+
type WrapRpcFunction<TFunction extends RpcFunction> = (envelop: RpcPayloadEnvelop<Parameters<TFunction>[0]>) => ReturnType<TFunction> extends Promise<infer A> ? A : ReturnType<TFunction>;
|
|
52
|
+
type WrapRpcFunctions<TFunctions extends RpcFunctions> = { [TKey in keyof TFunctions]: WrapRpcFunction<TFunctions[TKey]> };
|
|
53
|
+
type RpcClientRemoteFunctions<TFunctions extends WrappedRpcFunctions> = ProxifiedRemoteFunctions<ExtractRpcFunctions<TFunctions>>;
|
|
54
|
+
/**
|
|
55
|
+
* Payload for write log Rpc messages.
|
|
56
|
+
*/
|
|
57
|
+
interface LogPayload {
|
|
58
|
+
/**
|
|
59
|
+
* Metadata associated with the log message, excluding fields that are automatically added by the engine such as executionId, configIndex, environment, and timestamp. This can include custom fields relevant to the log entry, such as category, name, command, hook, plugin, and source.
|
|
60
|
+
*/
|
|
61
|
+
meta: LogMeta;
|
|
62
|
+
/**
|
|
63
|
+
* The log message content, which can be a string or an array of strings representing the log entry. This field is required and should contain the actual message to be logged.
|
|
64
|
+
*/
|
|
65
|
+
message: string;
|
|
66
|
+
}
|
|
67
|
+
interface RpcServerFunctions extends DevToolsRpcServerFunctions {
|
|
68
|
+
"powerlines:log": (payload: LogPayload) => void;
|
|
69
|
+
}
|
|
70
|
+
interface RpcClientFunctions extends DevToolsRpcClientFunctions {}
|
|
71
|
+
interface RpcContext {
|
|
72
|
+
/**
|
|
73
|
+
* The Rpc client to interact with the server
|
|
74
|
+
*/
|
|
75
|
+
readonly rpc: RpcClient;
|
|
76
|
+
}
|
|
77
|
+
type RpcClientHost = RpcFunctionsCollector<RpcClientFunctions, RpcContext>;
|
|
78
|
+
type RpcClientCall = BirpcReturn<RpcServerFunctions, RpcClientFunctions>["$call"];
|
|
79
|
+
type RpcClientCallEvent = BirpcReturn<RpcServerFunctions, RpcClientFunctions>["$callEvent"];
|
|
80
|
+
type RpcClientCallOptional = BirpcReturn<RpcServerFunctions, RpcClientFunctions>["$callOptional"];
|
|
81
|
+
interface RpcClientEvents {
|
|
82
|
+
"rpc:is-trusted:updated": (isTrusted: boolean) => void;
|
|
83
|
+
}
|
|
84
|
+
interface RpcClient {
|
|
85
|
+
/**
|
|
86
|
+
* The events of the client
|
|
87
|
+
*/
|
|
88
|
+
events: EventEmitter<RpcClientEvents>;
|
|
89
|
+
/**
|
|
90
|
+
* Whether the client is trusted
|
|
91
|
+
*/
|
|
92
|
+
readonly isTrusted: boolean | null;
|
|
93
|
+
/**
|
|
94
|
+
* The connection meta
|
|
95
|
+
*/
|
|
96
|
+
readonly connectionMeta: ConnectionMeta;
|
|
97
|
+
/**
|
|
98
|
+
* Return a promise that resolves when the client is trusted
|
|
99
|
+
*
|
|
100
|
+
* Rejects with an error if the timeout is reached
|
|
101
|
+
*
|
|
102
|
+
* @param timeout - The timeout in milliseconds, default to 60 seconds
|
|
103
|
+
*/
|
|
104
|
+
ensureTrusted: (timeout?: number) => Promise<boolean>;
|
|
105
|
+
/**
|
|
106
|
+
* Request trust from the server
|
|
107
|
+
*/
|
|
108
|
+
requestTrust: () => Promise<boolean>;
|
|
109
|
+
/**
|
|
110
|
+
* Request trust from the server using a specific auth token.
|
|
111
|
+
* Updates the stored token and re-requests trust without reloading the page.
|
|
112
|
+
*/
|
|
113
|
+
requestTrustWithToken: (token: string) => Promise<boolean>;
|
|
114
|
+
/**
|
|
115
|
+
* Call a Rpc function on the server
|
|
116
|
+
*/
|
|
117
|
+
call: RpcClientCall;
|
|
118
|
+
/**
|
|
119
|
+
* Call a Rpc event on the server, and does not expect a response
|
|
120
|
+
*/
|
|
121
|
+
callEvent: RpcClientCallEvent;
|
|
122
|
+
/**
|
|
123
|
+
* Call a Rpc optional function on the server
|
|
124
|
+
*/
|
|
125
|
+
callOptional: RpcClientCallOptional;
|
|
126
|
+
/**
|
|
127
|
+
* The client Rpc host
|
|
128
|
+
*/
|
|
129
|
+
client: RpcClientHost;
|
|
130
|
+
/**
|
|
131
|
+
* The shared state host
|
|
132
|
+
*/
|
|
133
|
+
sharedState: RpcSharedStateHost;
|
|
134
|
+
/**
|
|
135
|
+
* The streaming channel host. Subscribe to a server-side stream by
|
|
136
|
+
* channel + id; the returned reader is both `AsyncIterable<T>` and
|
|
137
|
+
* exposes `.readable: ReadableStream<T>` for `pipeTo` consumption.
|
|
138
|
+
*/
|
|
139
|
+
streaming: RpcStreamingClientHost;
|
|
140
|
+
/**
|
|
141
|
+
* The Rpc cache manager
|
|
142
|
+
*/
|
|
143
|
+
cacheManager: RpcCacheManager;
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/types/config.d.ts
|
|
147
|
+
/**
|
|
148
|
+
* The options required to start the Powerlines engine.
|
|
149
|
+
*/
|
|
150
|
+
type EngineOptions = Omit<PartialKeys<DevframeDefinition, "name" | "setup">, "id" | "basePath"> & Options & {
|
|
151
|
+
/**
|
|
152
|
+
* The host URL for the engine's WebSocket server, which is used for communication between the engine and the various hosts (e.g., dev server, CLI, etc.) that interact with it. This value is required for the engine to function properly, as it allows the engine to establish a WebSocket connection and facilitate communication with other components of the system.
|
|
153
|
+
*/
|
|
154
|
+
host?: string;
|
|
155
|
+
/**
|
|
156
|
+
* The port number to use for the websocket connection between the engine and the various hosts.
|
|
157
|
+
*/
|
|
158
|
+
port?: number;
|
|
159
|
+
/**
|
|
160
|
+
* An optional root directory for the engine to use when resolving paths and loading configuration files. This value can be used to specify a custom root directory for the engine, which can be useful in cases where the default behavior of using the current working directory is not desirable. If this option is not provided, the engine will use the current working directory as the root directory by default.
|
|
161
|
+
*/
|
|
162
|
+
root?: string;
|
|
163
|
+
/**
|
|
164
|
+
* A custom logger instance that implements the {@link CustomLogger} interface, which can be used for logging messages during the build process instead of the default Powerlines logger.
|
|
165
|
+
*
|
|
166
|
+
* @remarks
|
|
167
|
+
* Providing a custom logger allows you to integrate Powerlines logging with your own logging system or to customize the logging behavior, such as formatting log messages differently or sending logs to an external service. If a custom logger is not provided, Powerlines will use its default logger implementation.
|
|
168
|
+
*/
|
|
169
|
+
customLogger?: CustomLogger;
|
|
170
|
+
/**
|
|
171
|
+
* The framework for which the engine is being used, which can be used by plugins to customize their behavior based on the specific framework being targeted. This value is optional and can be set to `undefined` if not applicable, but providing it allows plugins to make informed decisions about how to handle certain tasks or configurations based on the framework being used.
|
|
172
|
+
*/
|
|
173
|
+
framework?: FrameworkOptions;
|
|
174
|
+
};
|
|
175
|
+
interface EngineExecutionOptions extends ExecutionOptions {
|
|
176
|
+
/**
|
|
177
|
+
* The base URL for the dev server, which can be used by plugins to construct URLs for assets or API endpoints during development. This value is only relevant in "dev" mode and will be `undefined` in "build" mode.
|
|
178
|
+
*/
|
|
179
|
+
baseURL: string;
|
|
180
|
+
/**
|
|
181
|
+
* Metadata for the connection used by the dev server, including the backend type and websocket configuration.
|
|
182
|
+
*/
|
|
183
|
+
connection: ConnectionMeta;
|
|
184
|
+
/**
|
|
185
|
+
* Options for configuring the WebSocket RPC channel used for communication between the dev server and the client, which can be used by plugins to customize the behavior of the WebSocket connection, such as setting custom timeouts, retry strategies, or other options.
|
|
186
|
+
*/
|
|
187
|
+
wsOptions?: Partial<WsRpcChannelOptions>;
|
|
188
|
+
/**
|
|
189
|
+
* Options for configuring the RPC client used for communication between the dev server and the client, which can be used by plugins to customize the behavior of the RPC client, such as setting custom timeouts, retry strategies, or other options.
|
|
190
|
+
*/
|
|
191
|
+
rpcOptions?: Partial<BirpcOptions<RpcServerFunctions, RpcClientFunctions, boolean>>;
|
|
192
|
+
/**
|
|
193
|
+
* Options for configuring the RPC cache used for caching RPC responses between the dev server and the client, which can be used by plugins to customize the behavior of the RPC cache, such as setting custom cache keys, expiration times, or other options.
|
|
194
|
+
*
|
|
195
|
+
* @remarks
|
|
196
|
+
* This option can be set to `true` to enable caching with default options, or it can be set to a configuration object that allows for fine-grained control over the caching behavior.
|
|
197
|
+
*/
|
|
198
|
+
cacheOptions?: boolean | Partial<RpcCacheOptions>;
|
|
199
|
+
}
|
|
200
|
+
type RpcClientOptions = RequiredKeys<EngineExecutionOptions, "baseURL" | "connection">;
|
|
201
|
+
type EngineResolvedConfig<TUserConfig extends UserConfig = UserConfig> = ResolvedConfig<TUserConfig, EngineExecutionOptions>;
|
|
202
|
+
//#endregion
|
|
203
|
+
export { RpcServerFunctions as C, WrappedRpcFunctions as D, WrappedRpcFunction as E, RpcPayloadMetadata as S, WrapRpcFunctions as T, RpcClientRemoteFunctions as _, ExtractRpcFunction as a, RpcFunctions as b, InputRpcFunctions as c, RpcClientCall as d, RpcClientCallEvent as f, RpcClientHost as g, RpcClientFunctions as h, RpcClientOptions as i, LogPayload as l, RpcClientEvents as m, EngineOptions as n, ExtractRpcFunctions as o, RpcClientCallOptional as p, EngineResolvedConfig as r, InputRpcFunction as s, EngineExecutionOptions as t, RpcClient as u, RpcContext as v, WrapRpcFunction as w, RpcPayloadEnvelop as x, RpcFunction as y };
|
|
204
|
+
//# sourceMappingURL=config-BNe23XHx.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-BNe23XHx.d.mts","names":[],"sources":["../src/types/rpc.ts","../src/types/config.ts"],"mappings":"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"}
|