@pipelab/plugin-core 1.0.1-beta.13 → 1.0.1-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @pipelab/plugin-core
2
2
 
3
+ ## 1.0.1-beta.19
4
+
5
+ ### Patch Changes
6
+
7
+ - azs
8
+ - Updated dependencies
9
+ - @pipelab/core-node@1.0.1-beta.23
10
+
11
+ ## 1.0.1-beta.18
12
+
13
+ ### Patch Changes
14
+
15
+ - sqqd
16
+ - Updated dependencies
17
+ - @pipelab/core-node@1.0.1-beta.22
18
+
19
+ ## 1.0.1-beta.17
20
+
21
+ ### Patch Changes
22
+
23
+ - sd
24
+ - Updated dependencies
25
+ - @pipelab/core-node@1.0.1-beta.21
26
+
27
+ ## 1.0.1-beta.16
28
+
29
+ ### Patch Changes
30
+
31
+ - sd
32
+ - Updated dependencies
33
+ - @pipelab/core-node@1.0.1-beta.20
34
+
35
+ ## 1.0.1-beta.15
36
+
37
+ ### Patch Changes
38
+
39
+ - wdf
40
+
41
+ ## 1.0.1-beta.14
42
+
43
+ ### Patch Changes
44
+
45
+ - sdf
46
+
3
47
  ## 1.0.1-beta.13
4
48
 
5
49
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -38,14 +38,11 @@ const require_chunk_JTKJZQYV = require("./chunk-JTKJZQYV-DwALyGe5.cjs");
38
38
  let os = require("os");
39
39
  let path = require("path");
40
40
  let util = require("util");
41
- let execa = require("execa");
42
- let node_path = require("node:path");
41
+ let _pipelab_core_node = require("@pipelab/core-node");
43
42
  let node_fs_promises = require("node:fs/promises");
44
- let node_fs = require("node:fs");
45
- let node_stream_promises = require("node:stream/promises");
46
- let pacote = require("pacote");
47
- pacote = __toESM(pacote);
43
+ let node_path = require("node:path");
48
44
  let node_os = require("node:os");
45
+ let node_fs = require("node:fs");
49
46
  let tar = require("tar");
50
47
  tar = __toESM(tar);
51
48
  let yauzl = require("yauzl");
@@ -2381,7 +2378,12 @@ const AppSettingsValidatorV7 = object({
2381
2378
  id: string(),
2382
2379
  name: string(),
2383
2380
  url: string()
2384
- }))
2381
+ })),
2382
+ buildHistory: object({ retentionPolicy: object({
2383
+ enabled: boolean(),
2384
+ maxEntries: number(),
2385
+ maxAge: number()
2386
+ }) })
2385
2387
  });
2386
2388
  const AppSettingsValidator = AppSettingsValidatorV7;
2387
2389
  //#endregion
@@ -64292,113 +64294,16 @@ const createPlugin = (plugin) => {
64292
64294
  return plugin;
64293
64295
  };
64294
64296
  //#endregion
64295
- //#region src/custom-errors.ts
64296
- var ExternalCommandError = class ExternalCommandError extends Error {
64297
- code;
64298
- constructor(message, code) {
64299
- super(message);
64300
- this.code = code;
64301
- Object.setPrototypeOf(this, ExternalCommandError.prototype);
64302
- }
64303
- };
64304
- //#endregion
64305
64297
  //#region src/utils.ts
64306
64298
  const fileExists = async (path) => {
64307
64299
  try {
64308
- await (0, node_fs_promises.access)(path);
64300
+ const { access } = await import("node:fs/promises");
64301
+ await access(path);
64309
64302
  return true;
64310
64303
  } catch {
64311
64304
  return false;
64312
64305
  }
64313
64306
  };
64314
- const runWithLiveLogs = async (command, args, execaOptions, log, hooks, abortSignal) => {
64315
- console.log("command: ", command, args.join(" "));
64316
- const subprocess = (0, execa.execa)(command, args, {
64317
- ...execaOptions,
64318
- stdout: "pipe",
64319
- stderr: "pipe",
64320
- stdin: "pipe",
64321
- env: {
64322
- ...process.env,
64323
- ...execaOptions.env,
64324
- TERM: "xterm-256color",
64325
- FORCE_STDERR_LOGGING: "1"
64326
- },
64327
- cancelSignal: abortSignal
64328
- });
64329
- hooks?.onCreated?.(subprocess);
64330
- subprocess.stdout?.on("data", (data) => {
64331
- hooks?.onStdout?.(data.toString(), subprocess);
64332
- });
64333
- subprocess.stderr?.on("data", (data) => {
64334
- hooks?.onStderr?.(data.toString(), subprocess);
64335
- });
64336
- try {
64337
- const { exitCode } = await subprocess;
64338
- hooks?.onExit?.(exitCode ?? 0);
64339
- } catch (error) {
64340
- const code = error.exitCode ?? 1;
64341
- hooks?.onExit?.(code);
64342
- throw new ExternalCommandError(error.message, code);
64343
- }
64344
- };
64345
- /**
64346
- * Downloads a file from a given URL to a specified local path with progress tracking.
64347
- *
64348
- * @param url - The URL of the file to download.
64349
- * @param localPath - The local file path to save the downloaded file.
64350
- * @returns A promise that resolves when the file is downloaded.
64351
- */
64352
- const downloadFile = async (url, localPath, hooks, abortSignal) => {
64353
- const response = await fetch(url, { signal: abortSignal });
64354
- if (!response.ok) throw new Error(`Failed to fetch file: ${response.statusText}`);
64355
- const contentLength = response.headers.get("content-length");
64356
- if (!contentLength) throw new Error("Content-Length header is missing");
64357
- const totalSize = parseInt(contentLength, 10);
64358
- let downloadedSize = 0;
64359
- const fileStream = (0, node_fs.createWriteStream)(localPath);
64360
- const progressStream = new TransformStream({ transform(chunk, controller) {
64361
- downloadedSize += chunk.length;
64362
- const progress = downloadedSize / totalSize * 100;
64363
- if (hooks?.onProgress) hooks.onProgress({
64364
- progress,
64365
- downloadedSize
64366
- });
64367
- controller.enqueue(chunk);
64368
- } });
64369
- const readable = response.body?.pipeThrough(progressStream);
64370
- if (!readable) throw new Error("Failed to create a readable stream");
64371
- await (0, node_stream_promises.pipeline)(readable, fileStream);
64372
- };
64373
- /**
64374
- * Installs an NPM package from the npm registry as a tarball if not already present.
64375
- * @param thirdpartyDir The directory where third-party tools are stored.
64376
- * @param name The name of the package (e.g., 'pnpm' or '@poki/cli').
64377
- * @param version The version of the package.
64378
- * @param options (Optional) configuration for dependency installation.
64379
- * @returns A Promise that resolves to the path of the extracted package (the 'package' subfolder).
64380
- */
64381
- const ensureNPMPackage = async (thirdpartyDir, name, version, options) => {
64382
- const packageDir = (0, node_path.join)(thirdpartyDir, name, version);
64383
- const finalPath = (0, node_path.join)(packageDir, "package");
64384
- if (await fileExists(finalPath)) return finalPath;
64385
- console.log(`NPM package ${name}@${version} not found at ${finalPath}, installing...`);
64386
- console.log(`Extracting ${name}@${version} to ${finalPath}...`);
64387
- await (0, node_fs_promises.mkdir)(packageDir, { recursive: true });
64388
- await pacote.default.extract(`${name}@${version}`, finalPath);
64389
- if (options?.installDeps && options.pnpmPath) {
64390
- console.log(`Installing dependencies for ${name}@${version} using pnpm at ${options.pnpmPath}...`);
64391
- await (0, execa.execa)(options.nodePath || process.execPath, [
64392
- options.pnpmPath,
64393
- "install",
64394
- "--prod"
64395
- ], {
64396
- cwd: finalPath,
64397
- stdio: "inherit"
64398
- });
64399
- }
64400
- return finalPath;
64401
- };
64402
64307
  //#endregion
64403
64308
  //#region src/fs-utils.ts
64404
64309
  const ensure = async (filesPath, defaultContent = "{}") => {
@@ -64491,6 +64396,16 @@ const zipFolder = async (from, to, log) => {
64491
64396
  });
64492
64397
  };
64493
64398
  //#endregion
64399
+ //#region src/custom-errors.ts
64400
+ var ExternalCommandError = class ExternalCommandError extends Error {
64401
+ code;
64402
+ constructor(message, code) {
64403
+ super(message);
64404
+ this.code = code;
64405
+ Object.setPrototypeOf(this, ExternalCommandError.prototype);
64406
+ }
64407
+ };
64408
+ //#endregion
64494
64409
  //#region src/node-utils.ts
64495
64410
  const fileExists$1 = async (path) => {
64496
64411
  try {
@@ -64532,6 +64447,7 @@ exports.BenefitNotFoundError = BenefitNotFoundError;
64532
64447
  exports.EditorParamValidatorV3 = EditorParamValidatorV3;
64533
64448
  exports.ExternalCommandError = ExternalCommandError;
64534
64449
  exports.OriginValidator = OriginValidator;
64450
+ exports.PipelabContext = _pipelab_core_node.PipelabContext;
64535
64451
  exports.RELEASE_SYNC = src_default;
64536
64452
  exports.SaveLocationExternalValidator = SaveLocationExternalValidator;
64537
64453
  exports.SaveLocationInternalValidator = SaveLocationInternalValidator;
@@ -64590,7 +64506,12 @@ Object.defineProperty(exports, "de_DE", {
64590
64506
  exports.defaultAppSettings = defaultAppSettings;
64591
64507
  exports.defaultFileRepo = defaultFileRepo;
64592
64508
  exports.detectRuntime = detectRuntime;
64593
- exports.downloadFile = downloadFile;
64509
+ Object.defineProperty(exports, "downloadFile", {
64510
+ enumerable: true,
64511
+ get: function() {
64512
+ return _pipelab_core_node.downloadFile;
64513
+ }
64514
+ });
64594
64515
  Object.defineProperty(exports, "en_US", {
64595
64516
  enumerable: true,
64596
64517
  get: function() {
@@ -64598,7 +64519,6 @@ Object.defineProperty(exports, "en_US", {
64598
64519
  }
64599
64520
  });
64600
64521
  exports.ensure = ensure;
64601
- exports.ensureNPMPackage = ensureNPMPackage;
64602
64522
  Object.defineProperty(exports, "es_ES", {
64603
64523
  enumerable: true,
64604
64524
  get: function() {
@@ -64607,6 +64527,30 @@ Object.defineProperty(exports, "es_ES", {
64607
64527
  });
64608
64528
  exports.extractTarGz = extractTarGz;
64609
64529
  exports.extractZip = extractZip;
64530
+ Object.defineProperty(exports, "fetchPackage", {
64531
+ enumerable: true,
64532
+ get: function() {
64533
+ return _pipelab_core_node.fetchPackage;
64534
+ }
64535
+ });
64536
+ Object.defineProperty(exports, "fetchPipelabAsset", {
64537
+ enumerable: true,
64538
+ get: function() {
64539
+ return _pipelab_core_node.fetchPipelabAsset;
64540
+ }
64541
+ });
64542
+ Object.defineProperty(exports, "fetchPipelabCli", {
64543
+ enumerable: true,
64544
+ get: function() {
64545
+ return _pipelab_core_node.fetchPipelabCli;
64546
+ }
64547
+ });
64548
+ Object.defineProperty(exports, "fetchPipelabPlugin", {
64549
+ enumerable: true,
64550
+ get: function() {
64551
+ return _pipelab_core_node.fetchPipelabPlugin;
64552
+ }
64553
+ });
64610
64554
  exports.fileExists = fileExists;
64611
64555
  exports.fileRepoMigrations = fileRepoMigrations;
64612
64556
  exports.fmt = fmt;
@@ -64635,7 +64579,18 @@ Object.defineProperty(exports, "pt_BR", {
64635
64579
  return pt_BR_default;
64636
64580
  }
64637
64581
  });
64638
- exports.runWithLiveLogs = runWithLiveLogs;
64582
+ Object.defineProperty(exports, "runPnpm", {
64583
+ enumerable: true,
64584
+ get: function() {
64585
+ return _pipelab_core_node.runPnpm;
64586
+ }
64587
+ });
64588
+ Object.defineProperty(exports, "runWithLiveLogs", {
64589
+ enumerable: true,
64590
+ get: function() {
64591
+ return _pipelab_core_node.runWithLiveLogs;
64592
+ }
64593
+ });
64639
64594
  exports.savedFileMigrator = savedFileMigrator;
64640
64595
  Object.defineProperty(exports, "schema", {
64641
64596
  enumerable: true,
package/dist/index.d.cts CHANGED
@@ -1,78 +1,72 @@
1
- import { BrowserWindow } from "electron";
2
- import { Options, Subprocess } from "execa";
1
+ import { ActionRunner, ActionRunnerData, ConditionRunner, DownloadHooks as Hooks, EventRunner, ExpressionRunner, LoopRunner, PipelabContext, Runner, RunnerCallbackFnArgument, downloadFile, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, runPnpm, runWithLiveLogs } from "@pipelab/core-node";
3
2
  import { z as schema } from "zod";
4
3
 
5
4
  //#region src/pipelab.d.ts
6
- type RunnerCallbackFnArgument = {
7
- done: () => void;
8
- id: string;
9
- log: (...args: Parameters<(typeof console)["log"]>) => void;
10
- };
11
- type ActionRunnerData<ACTION extends Action> = {
5
+ declare const createActionRunner: <ACTION extends Action>(runner: (data: ActionRunnerData<ACTION>) => Promise<void>) => (data: ActionRunnerData<ACTION>) => Promise<void>;
6
+ declare const createConditionRunner: <CONDITION extends Condition>(runner: (data: {
12
7
  log: typeof console.log;
13
- setOutput: SetOutputActionFn<ACTION>;
14
- inputs: ExtractInputsFromAction<ACTION>;
15
- setMeta: (callback: (data: ACTION["meta"]) => ACTION["meta"]) => void;
16
- meta: ACTION["meta"];
8
+ inputs: ExtractInputsFromCondition<CONDITION>;
9
+ setMeta: (callback: (data: CONDITION["meta"]) => CONDITION["meta"]) => void;
10
+ meta: CONDITION["meta"];
17
11
  cwd: string;
18
- paths: {
19
- assets: string;
20
- cache: string;
21
- pnpm: string;
22
- node: string;
23
- userData: string;
24
- modules: string;
25
- thirdparty: string;
26
- };
27
- api: {
28
- fetchAsset: (packageName: string, version?: string, options?: {
29
- installDeps?: boolean;
30
- }) => Promise<string>;
31
- fetchPlugin: (pluginName: string, version?: string, options?: {
32
- installDeps?: boolean;
33
- }) => Promise<string>;
34
- [key: string]: any;
35
- };
36
- browserWindow: BrowserWindow;
37
- abortSignal: AbortSignal;
38
- };
39
- type ActionRunner<ACTION extends Action> = (data: ActionRunnerData<ACTION>) => Promise<void>;
40
- declare const createActionRunner: <ACTION extends Action>(runner: ActionRunner<ACTION>) => ActionRunner<ACTION>;
41
- type ConditionRunner<CONDITION extends Condition> = (data: {
12
+ context: PipelabContext;
13
+ }) => Promise<boolean>) => (data: {
42
14
  log: typeof console.log;
43
15
  inputs: ExtractInputsFromCondition<CONDITION>;
44
16
  setMeta: (callback: (data: CONDITION["meta"]) => CONDITION["meta"]) => void;
45
17
  meta: CONDITION["meta"];
46
18
  cwd: string;
19
+ context: PipelabContext;
47
20
  }) => Promise<boolean>;
48
- declare const createConditionRunner: <CONDITION extends Condition>(runner: ConditionRunner<CONDITION>) => ConditionRunner<CONDITION>;
49
- type LoopRunner<LOOP extends Loop> = (data: {
21
+ declare const createLoopRunner: <LOOP extends Loop>(runner: (data: {
22
+ log: typeof console.log;
23
+ setOutput: SetOutputLoopFn<LOOP>;
24
+ inputs: ExtractInputsFromLoop<LOOP>;
25
+ setMeta: (callback: (data: LOOP["meta"]) => LOOP["meta"]) => void;
26
+ meta: LOOP["meta"];
27
+ cwd: string;
28
+ context: PipelabContext;
29
+ }) => Promise<"step" | "exit">) => (data: {
50
30
  log: typeof console.log;
51
31
  setOutput: SetOutputLoopFn<LOOP>;
52
32
  inputs: ExtractInputsFromLoop<LOOP>;
53
33
  setMeta: (callback: (data: LOOP["meta"]) => LOOP["meta"]) => void;
54
34
  meta: LOOP["meta"];
55
35
  cwd: string;
36
+ context: PipelabContext;
56
37
  }) => Promise<"step" | "exit">;
57
- declare const createLoopRunner: <LOOP extends Loop>(runner: LoopRunner<LOOP>) => LoopRunner<LOOP>;
58
- type ExpressionRunner<EXPRESSION extends Expression> = (data: {
38
+ declare const createExpressionRunner: <EXPRESSION extends Expression>(runner: (data: {
39
+ log: typeof console.log;
40
+ setOutput: SetOutputExpressionFn<EXPRESSION>;
41
+ inputs: ExtractInputsFromExpression<EXPRESSION>;
42
+ setMeta: (callback: (data: EXPRESSION["meta"]) => EXPRESSION["meta"]) => void;
43
+ meta: EXPRESSION["meta"];
44
+ cwd: string;
45
+ context: PipelabContext;
46
+ }) => Promise<string>) => (data: {
59
47
  log: typeof console.log;
60
48
  setOutput: SetOutputExpressionFn<EXPRESSION>;
61
49
  inputs: ExtractInputsFromExpression<EXPRESSION>;
62
50
  setMeta: (callback: (data: EXPRESSION["meta"]) => EXPRESSION["meta"]) => void;
63
51
  meta: EXPRESSION["meta"];
64
52
  cwd: string;
53
+ context: PipelabContext;
65
54
  }) => Promise<string>;
66
- declare const createExpressionRunner: <EXPRESSION extends Expression>(runner: ExpressionRunner<EXPRESSION>) => ExpressionRunner<EXPRESSION>;
67
- type EventRunner<EVENT extends Event> = (data: {
55
+ declare const createEventRunner: <EVENT extends Event>(runner: (data: {
56
+ log: typeof console.log;
57
+ inputs: ExtractInputsFromEvent<EVENT>;
58
+ setMeta: (callback: (data: EVENT["meta"]) => EVENT["meta"]) => void;
59
+ meta: EVENT["meta"];
60
+ cwd: string;
61
+ context: PipelabContext;
62
+ }) => Promise<void>) => (data: {
68
63
  log: typeof console.log;
69
64
  inputs: ExtractInputsFromEvent<EVENT>;
70
65
  setMeta: (callback: (data: EVENT["meta"]) => EVENT["meta"]) => void;
71
66
  meta: EVENT["meta"];
72
67
  cwd: string;
68
+ context: PipelabContext;
73
69
  }) => Promise<void>;
74
- declare const createEventRunner: <EVENT extends Event>(runner: EventRunner<EVENT>) => EventRunner<EVENT>;
75
- type Runner = ActionRunner<any> | LoopRunner<any> | EventRunner<any> | ConditionRunner<any>;
76
70
  declare const sleep: (duration: number) => Promise<unknown>;
77
71
  //#endregion
78
72
  //#region src/create-plugin.d.ts
@@ -84,39 +78,6 @@ declare const createPlugin: (plugin: Plugin) => Plugin;
84
78
  //#endregion
85
79
  //#region src/utils.d.ts
86
80
  declare const fileExists: (path: string) => Promise<boolean>;
87
- declare const runWithLiveLogs: (command: string, args: string[], execaOptions: Options, log: typeof console.log, hooks?: {
88
- onStdout?: (data: string, subprocess: Subprocess) => void;
89
- onStderr?: (data: string, subprocess: Subprocess) => void;
90
- onExit?: (code: number) => void;
91
- onCreated?: (subprocess: Subprocess) => void;
92
- }, abortSignal?: AbortSignal) => Promise<void>;
93
- interface Hooks {
94
- onProgress?: (data: {
95
- progress: number;
96
- downloadedSize: number;
97
- }) => void;
98
- }
99
- /**
100
- * Downloads a file from a given URL to a specified local path with progress tracking.
101
- *
102
- * @param url - The URL of the file to download.
103
- * @param localPath - The local file path to save the downloaded file.
104
- * @returns A promise that resolves when the file is downloaded.
105
- */
106
- declare const downloadFile: (url: string, localPath: string, hooks?: Hooks, abortSignal?: AbortSignal) => Promise<void>;
107
- /**
108
- * Installs an NPM package from the npm registry as a tarball if not already present.
109
- * @param thirdpartyDir The directory where third-party tools are stored.
110
- * @param name The name of the package (e.g., 'pnpm' or '@poki/cli').
111
- * @param version The version of the package.
112
- * @param options (Optional) configuration for dependency installation.
113
- * @returns A Promise that resolves to the path of the extracted package (the 'package' subfolder).
114
- */
115
- declare const ensureNPMPackage: (thirdpartyDir: string, name: string, version: string, options?: {
116
- nodePath?: string;
117
- pnpmPath?: string;
118
- installDeps?: boolean;
119
- }) => Promise<string>;
120
81
  //#endregion
121
82
  //#region src/fs-utils.d.ts
122
83
  declare const ensure: (filesPath: string, defaultContent?: string) => Promise<void>;
@@ -156,5 +117,5 @@ declare const detectRuntime: (appFolder: string | undefined) => Promise<OutputRu
156
117
  //#region src/index.d.ts
157
118
  type NoData = { [index in string]?: unknown };
158
119
  //#endregion
159
- export { ActionRunner, ActionRunnerData, ConditionRunner, EventRunner, ExpressionRunner, ExternalCommandError, Hooks, LoopRunner, NoData, OutputRuntimes, Plugin, Runner, RunnerCallbackFnArgument, createActionRunner, createConditionRunner, createEventRunner, createExpressionRunner, createLoopRunner, createPlugin, detectRuntime, downloadFile, ensure, ensureNPMPackage, extractTarGz, extractZip, fileExists, generateTempFolder, runWithLiveLogs, schema, sleep, zipFolder };
120
+ export { type ActionRunner, type ActionRunnerData, type ConditionRunner, type EventRunner, type ExpressionRunner, ExternalCommandError, type Hooks, type LoopRunner, NoData, OutputRuntimes, PipelabContext, Plugin, type Runner, type RunnerCallbackFnArgument, createActionRunner, createConditionRunner, createEventRunner, createExpressionRunner, createLoopRunner, createPlugin, detectRuntime, downloadFile, ensure, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, fileExists, generateTempFolder, runPnpm, runWithLiveLogs, schema, sleep, zipFolder };
160
121
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/pipelab.ts","../src/create-plugin.ts","../src/utils.ts","../src/fs-utils.ts","../src/archive-utils.ts","../src/custom-errors.ts","../src/node-utils.ts","../src/index.ts"],"mappings":";;;;;KAmBY,wBAAA;EACV,IAAA;EACA,EAAA;EACA,GAAA,MAAS,IAAA,EAAM,UAAA,SAAmB,OAAA;AAAA;AAAA,KAGxB,gBAAA,gBAAgC,MAAA;EAC1C,GAAA,SAAY,OAAA,CAAQ,GAAA;EACpB,SAAA,EAAW,iBAAA,CAAkB,MAAA;EAC7B,MAAA,EAAQ,uBAAA,CAAwB,MAAA;EAChC,OAAA,GAAU,QAAA,GAAW,IAAA,EAAM,MAAA,aAAmB,MAAA;EAC9C,IAAA,EAAM,MAAA;EACN,GAAA;EACA,KAAA;IACE,MAAA;IACA,KAAA;IACA,IAAA;IACA,IAAA;IACA,QAAA;IACA,OAAA;IACA,UAAA;EAAA;EAEF,GAAA;IACE,UAAA,GACE,WAAA,UACA,OAAA,WACA,OAAA;MAAY,WAAA;IAAA,MACT,OAAA;IACL,WAAA,GACE,UAAA,UACA,OAAA,WACA,O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,KACb,OAAA;;;;;;;;;cAsDU,gBAAA,GACX,aAAA,UACA,IAAA,UACA,OAAA,UACA,OAAA;EACE,QAAA;EACA,QAAA;EACA,WAAA;AAAA,MACD,OAAA;;;cC3IU,MAAA,GAAgB,SAAA,UAAmB,cAAA,cAAqB,OAAA;AAAA,cAexD,kBAAA,GAA4B,IAAA,cAAa,OAAA;;;;;;;;AHDtD;iBILsB,YAAA,CAAa,WAAA,UAAqB,cAAA,WAAyB,OAAA;;;;;;;iBAoB3D,UAAA,CAAW,WAAA,UAAqB,cAAA,WAAyB,OAAA;AAAA,cAuDlE,SAAA,GAAmB,IAAA,UAAc,EAAA,UAAY,GAAA,SAAY,OAAA,CAAQ,GAAA,KAAG,OAAA;;;cCzFpE,oBAAA,SAA6B,KAAA;EACxC,IAAA;cAEY,OAAA,UAAiB,IAAA;AAAA;;;KCAnB,cAAA;;;;;cAeC,aAAA,GACX,SAAA,yBACC,OAAA,CAAQ,cAAA;;;KCXC,MAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/pipelab.ts","../src/create-plugin.ts","../src/utils.ts","../src/fs-utils.ts","../src/archive-utils.ts","../src/custom-errors.ts","../src/node-utils.ts","../src/index.ts"],"mappings":";;;;cA0Ca,kBAAA,kBAAqC,MAAA,EAChD,MAAA,GAAS,IAAA,EAAM,gBAAA,CAAiB,MAAA,MAAY,OAAA,YAAa,IAAA,EAA1C,gBAAA,CAAiB,MAAA,MAAY,OAAA;AAAA,cAGjC,qBAAA,qBAA2C,SAAA,EACtD,MAAA,GAAS,IAAA;EACP,GAAA,SAAY,OAAA,CAAQ,GAAA;EACpB,MAAA,EAAQ,0BAAA,CAA2B,SAAA;EACnC,OAAA,GAAU,QAAA,GAAW,IAAA,EAAM,SAAA,aAAsB,SAAA;EACjD,IAAA,EAAM,SAAA;EACN,GAAA;EACA,OAAA,EAAS,cAAA;AAAA,MACL,OAAA,eAAgB,IAAA;EANpB,GAAA,SAAY,OAAA,CAAQ,GAAA;E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CZ;cMxBa,aAAA,GACX,SAAA,yBACC,OAAA,CAAQ,cAAA;;;KCXC,MAAA"}
package/dist/index.d.mts CHANGED
@@ -1,78 +1,72 @@
1
- import { Options, Subprocess } from "execa";
1
+ import { ActionRunner, ActionRunnerData, ConditionRunner, DownloadHooks as Hooks, EventRunner, ExpressionRunner, LoopRunner, PipelabContext, Runner, RunnerCallbackFnArgument, downloadFile, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, runPnpm, runWithLiveLogs } from "@pipelab/core-node";
2
2
  import { z as schema } from "zod";
3
- import { BrowserWindow } from "electron";
4
3
 
5
4
  //#region src/pipelab.d.ts
6
- type RunnerCallbackFnArgument = {
7
- done: () => void;
8
- id: string;
9
- log: (...args: Parameters<(typeof console)["log"]>) => void;
10
- };
11
- type ActionRunnerData<ACTION extends Action> = {
5
+ declare const createActionRunner: <ACTION extends Action>(runner: (data: ActionRunnerData<ACTION>) => Promise<void>) => (data: ActionRunnerData<ACTION>) => Promise<void>;
6
+ declare const createConditionRunner: <CONDITION extends Condition>(runner: (data: {
12
7
  log: typeof console.log;
13
- setOutput: SetOutputActionFn<ACTION>;
14
- inputs: ExtractInputsFromAction<ACTION>;
15
- setMeta: (callback: (data: ACTION["meta"]) => ACTION["meta"]) => void;
16
- meta: ACTION["meta"];
8
+ inputs: ExtractInputsFromCondition<CONDITION>;
9
+ setMeta: (callback: (data: CONDITION["meta"]) => CONDITION["meta"]) => void;
10
+ meta: CONDITION["meta"];
17
11
  cwd: string;
18
- paths: {
19
- assets: string;
20
- cache: string;
21
- pnpm: string;
22
- node: string;
23
- userData: string;
24
- modules: string;
25
- thirdparty: string;
26
- };
27
- api: {
28
- fetchAsset: (packageName: string, version?: string, options?: {
29
- installDeps?: boolean;
30
- }) => Promise<string>;
31
- fetchPlugin: (pluginName: string, version?: string, options?: {
32
- installDeps?: boolean;
33
- }) => Promise<string>;
34
- [key: string]: any;
35
- };
36
- browserWindow: BrowserWindow;
37
- abortSignal: AbortSignal;
38
- };
39
- type ActionRunner<ACTION extends Action> = (data: ActionRunnerData<ACTION>) => Promise<void>;
40
- declare const createActionRunner: <ACTION extends Action>(runner: ActionRunner<ACTION>) => ActionRunner<ACTION>;
41
- type ConditionRunner<CONDITION extends Condition> = (data: {
12
+ context: PipelabContext;
13
+ }) => Promise<boolean>) => (data: {
42
14
  log: typeof console.log;
43
15
  inputs: ExtractInputsFromCondition<CONDITION>;
44
16
  setMeta: (callback: (data: CONDITION["meta"]) => CONDITION["meta"]) => void;
45
17
  meta: CONDITION["meta"];
46
18
  cwd: string;
19
+ context: PipelabContext;
47
20
  }) => Promise<boolean>;
48
- declare const createConditionRunner: <CONDITION extends Condition>(runner: ConditionRunner<CONDITION>) => ConditionRunner<CONDITION>;
49
- type LoopRunner<LOOP extends Loop> = (data: {
21
+ declare const createLoopRunner: <LOOP extends Loop>(runner: (data: {
22
+ log: typeof console.log;
23
+ setOutput: SetOutputLoopFn<LOOP>;
24
+ inputs: ExtractInputsFromLoop<LOOP>;
25
+ setMeta: (callback: (data: LOOP["meta"]) => LOOP["meta"]) => void;
26
+ meta: LOOP["meta"];
27
+ cwd: string;
28
+ context: PipelabContext;
29
+ }) => Promise<"step" | "exit">) => (data: {
50
30
  log: typeof console.log;
51
31
  setOutput: SetOutputLoopFn<LOOP>;
52
32
  inputs: ExtractInputsFromLoop<LOOP>;
53
33
  setMeta: (callback: (data: LOOP["meta"]) => LOOP["meta"]) => void;
54
34
  meta: LOOP["meta"];
55
35
  cwd: string;
36
+ context: PipelabContext;
56
37
  }) => Promise<"step" | "exit">;
57
- declare const createLoopRunner: <LOOP extends Loop>(runner: LoopRunner<LOOP>) => LoopRunner<LOOP>;
58
- type ExpressionRunner<EXPRESSION extends Expression> = (data: {
38
+ declare const createExpressionRunner: <EXPRESSION extends Expression>(runner: (data: {
39
+ log: typeof console.log;
40
+ setOutput: SetOutputExpressionFn<EXPRESSION>;
41
+ inputs: ExtractInputsFromExpression<EXPRESSION>;
42
+ setMeta: (callback: (data: EXPRESSION["meta"]) => EXPRESSION["meta"]) => void;
43
+ meta: EXPRESSION["meta"];
44
+ cwd: string;
45
+ context: PipelabContext;
46
+ }) => Promise<string>) => (data: {
59
47
  log: typeof console.log;
60
48
  setOutput: SetOutputExpressionFn<EXPRESSION>;
61
49
  inputs: ExtractInputsFromExpression<EXPRESSION>;
62
50
  setMeta: (callback: (data: EXPRESSION["meta"]) => EXPRESSION["meta"]) => void;
63
51
  meta: EXPRESSION["meta"];
64
52
  cwd: string;
53
+ context: PipelabContext;
65
54
  }) => Promise<string>;
66
- declare const createExpressionRunner: <EXPRESSION extends Expression>(runner: ExpressionRunner<EXPRESSION>) => ExpressionRunner<EXPRESSION>;
67
- type EventRunner<EVENT extends Event> = (data: {
55
+ declare const createEventRunner: <EVENT extends Event>(runner: (data: {
56
+ log: typeof console.log;
57
+ inputs: ExtractInputsFromEvent<EVENT>;
58
+ setMeta: (callback: (data: EVENT["meta"]) => EVENT["meta"]) => void;
59
+ meta: EVENT["meta"];
60
+ cwd: string;
61
+ context: PipelabContext;
62
+ }) => Promise<void>) => (data: {
68
63
  log: typeof console.log;
69
64
  inputs: ExtractInputsFromEvent<EVENT>;
70
65
  setMeta: (callback: (data: EVENT["meta"]) => EVENT["meta"]) => void;
71
66
  meta: EVENT["meta"];
72
67
  cwd: string;
68
+ context: PipelabContext;
73
69
  }) => Promise<void>;
74
- declare const createEventRunner: <EVENT extends Event>(runner: EventRunner<EVENT>) => EventRunner<EVENT>;
75
- type Runner = ActionRunner<any> | LoopRunner<any> | EventRunner<any> | ConditionRunner<any>;
76
70
  declare const sleep: (duration: number) => Promise<unknown>;
77
71
  //#endregion
78
72
  //#region src/create-plugin.d.ts
@@ -84,39 +78,6 @@ declare const createPlugin: (plugin: Plugin) => Plugin;
84
78
  //#endregion
85
79
  //#region src/utils.d.ts
86
80
  declare const fileExists: (path: string) => Promise<boolean>;
87
- declare const runWithLiveLogs: (command: string, args: string[], execaOptions: Options, log: typeof console.log, hooks?: {
88
- onStdout?: (data: string, subprocess: Subprocess) => void;
89
- onStderr?: (data: string, subprocess: Subprocess) => void;
90
- onExit?: (code: number) => void;
91
- onCreated?: (subprocess: Subprocess) => void;
92
- }, abortSignal?: AbortSignal) => Promise<void>;
93
- interface Hooks {
94
- onProgress?: (data: {
95
- progress: number;
96
- downloadedSize: number;
97
- }) => void;
98
- }
99
- /**
100
- * Downloads a file from a given URL to a specified local path with progress tracking.
101
- *
102
- * @param url - The URL of the file to download.
103
- * @param localPath - The local file path to save the downloaded file.
104
- * @returns A promise that resolves when the file is downloaded.
105
- */
106
- declare const downloadFile: (url: string, localPath: string, hooks?: Hooks, abortSignal?: AbortSignal) => Promise<void>;
107
- /**
108
- * Installs an NPM package from the npm registry as a tarball if not already present.
109
- * @param thirdpartyDir The directory where third-party tools are stored.
110
- * @param name The name of the package (e.g., 'pnpm' or '@poki/cli').
111
- * @param version The version of the package.
112
- * @param options (Optional) configuration for dependency installation.
113
- * @returns A Promise that resolves to the path of the extracted package (the 'package' subfolder).
114
- */
115
- declare const ensureNPMPackage: (thirdpartyDir: string, name: string, version: string, options?: {
116
- nodePath?: string;
117
- pnpmPath?: string;
118
- installDeps?: boolean;
119
- }) => Promise<string>;
120
81
  //#endregion
121
82
  //#region src/fs-utils.d.ts
122
83
  declare const ensure: (filesPath: string, defaultContent?: string) => Promise<void>;
@@ -156,5 +117,5 @@ declare const detectRuntime: (appFolder: string | undefined) => Promise<OutputRu
156
117
  //#region src/index.d.ts
157
118
  type NoData = { [index in string]?: unknown };
158
119
  //#endregion
159
- export { ActionRunner, ActionRunnerData, ConditionRunner, EventRunner, ExpressionRunner, ExternalCommandError, Hooks, LoopRunner, NoData, OutputRuntimes, Plugin, Runner, RunnerCallbackFnArgument, createActionRunner, createConditionRunner, createEventRunner, createExpressionRunner, createLoopRunner, createPlugin, detectRuntime, downloadFile, ensure, ensureNPMPackage, extractTarGz, extractZip, fileExists, generateTempFolder, runWithLiveLogs, schema, sleep, zipFolder };
120
+ export { type ActionRunner, type ActionRunnerData, type ConditionRunner, type EventRunner, type ExpressionRunner, ExternalCommandError, type Hooks, type LoopRunner, NoData, OutputRuntimes, PipelabContext, Plugin, type Runner, type RunnerCallbackFnArgument, createActionRunner, createConditionRunner, createEventRunner, createExpressionRunner, createLoopRunner, createPlugin, detectRuntime, downloadFile, ensure, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, fileExists, generateTempFolder, runPnpm, runWithLiveLogs, schema, sleep, zipFolder };
160
121
  //# sourceMappingURL=index.d.mts.map