@pipelab/core-node 1.0.1-beta.23 → 1.0.1-beta.25

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,23 @@
1
1
  # @pipelab/core-node
2
2
 
3
+ ## 1.0.1-beta.25
4
+
5
+ ### Patch Changes
6
+
7
+ - sdsd
8
+ - Updated dependencies
9
+ - @pipelab/constants@1.0.1-beta.21
10
+ - @pipelab/shared@2.0.1-beta.22
11
+
12
+ ## 1.0.1-beta.24
13
+
14
+ ### Patch Changes
15
+
16
+ - gf
17
+ - Updated dependencies
18
+ - @pipelab/constants@1.0.1-beta.20
19
+ - @pipelab/shared@2.0.1-beta.21
20
+
3
21
  ## 1.0.1-beta.23
4
22
 
5
23
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,24 +1,24 @@
1
1
  /// <reference types="node" />
2
2
  import { WebSocket } from "ws";
3
- import { Action, Agent, BlockCondition, Channels, Condition, End, Event as Event$1, Events, Expression, ExtractInputsFromAction, ExtractInputsFromCondition, ExtractInputsFromEvent, ExtractInputsFromExpression, ExtractInputsFromLoop, HandleListenerRendererSendFn, IpcMessage, Loop, Migrator, RendererChannels, RendererData, RendererEnd, RendererEvents, RendererMessage, RequestId, SetOutputActionFn, SetOutputExpressionFn, SetOutputLoopFn, UpdateStatus, WebSocketConnectionState, WebSocketEvent, WebSocketHandler, WebSocketSendFunction } from "@pipelab/shared";
3
+ import { Action, Agent, BlockCondition, BuildHistoryEntry, Channels, Condition, End, Event as Event$1, Events, Expression, ExtractInputsFromAction, ExtractInputsFromCondition, ExtractInputsFromEvent, ExtractInputsFromExpression, ExtractInputsFromLoop, HandleListenerRendererSendFn, IBuildHistoryStorage, IpcMessage, Loop, Migrator, RendererChannels, RendererData, RendererEnd, RendererEvents, RendererMessage, RequestId, SetOutputActionFn, SetOutputExpressionFn, SetOutputLoopFn, UpdateStatus, Variable, WebSocketConnectionState, WebSocketEvent, WebSocketHandler, WebSocketSendFunction } from "@pipelab/shared";
4
4
  import * as execa$1 from "execa";
5
5
  import { Options as Options$1, Subprocess } from "execa";
6
6
  import * as http$1 from "http";
7
7
  import http from "http";
8
8
 
9
9
  //#region src/context.d.ts
10
- /**
11
- * Encapsulates the execution context of a Pipelab operation.
12
- * Must be passed explicitly to all functions that require context.
13
- */
14
- interface PipelabContext {
15
- readonly isDev: boolean;
10
+ declare const isDev: boolean;
11
+ declare const projectRoot: string | null;
12
+ interface PipelabContextOptions {
13
+ userDataPath: string;
14
+ }
15
+ declare class PipelabContext {
16
16
  readonly userDataPath: string;
17
- readonly assetsPath: string;
17
+ constructor(options: PipelabContextOptions);
18
+ getPackagesPath(...subpaths: string[]): string;
19
+ getThirdPartyPath(...subpaths: string[]): string;
20
+ getConfigPath(...subpaths: string[]): string;
18
21
  }
19
- declare function createPipelabContext(options?: {
20
- userDataPath?: string;
21
- }): PipelabContext;
22
22
  //#endregion
23
23
  //#region src/websocket-server.d.ts
24
24
  interface ConnectedClient {
@@ -66,10 +66,10 @@ declare const useAPI: () => {
66
66
  };
67
67
  //#endregion
68
68
  //#region src/handlers/shell.d.ts
69
- declare const registerShellHandlers: () => void;
69
+ declare const registerShellHandlers: (_context: PipelabContext) => void;
70
70
  //#endregion
71
71
  //#region src/handlers/fs.d.ts
72
- declare const registerFsHandlers: () => void;
72
+ declare const registerFsHandlers: (_context: PipelabContext) => void;
73
73
  //#endregion
74
74
  //#region src/handlers/config.d.ts
75
75
  declare const registerConfigHandlers: (context: PipelabContext) => void;
@@ -81,21 +81,58 @@ declare const registerHistoryHandlers: (context: PipelabContext) => void;
81
81
  declare const registerEngineHandlers: (context: PipelabContext) => void;
82
82
  //#endregion
83
83
  //#region src/handlers/agents.d.ts
84
- declare const registerAgentsHandlers: () => void;
84
+ declare const registerAgentsHandlers: (_context: PipelabContext) => void;
85
+ //#endregion
86
+ //#region src/handlers/build-history.d.ts
87
+ declare class BuildHistoryStorage implements IBuildHistoryStorage {
88
+ private context;
89
+ private logger;
90
+ constructor(context: PipelabContext);
91
+ private getStoragePath;
92
+ private getPipelinePath;
93
+ private ensureStoragePath;
94
+ private loadPipelineHistory;
95
+ private savePipelineHistory;
96
+ applyRetentionPolicy(): Promise<void>;
97
+ save(entry: BuildHistoryEntry): Promise<void>;
98
+ get(id: string, pipelineId?: string): Promise<BuildHistoryEntry | undefined>;
99
+ getAll(): Promise<BuildHistoryEntry[]>;
100
+ getByPipeline(pipelineId: string): Promise<BuildHistoryEntry[]>;
101
+ update(id: string, updates: Partial<BuildHistoryEntry>, pipelineId?: string): Promise<void>;
102
+ delete(id: string, pipelineId?: string): Promise<void>;
103
+ clear(): Promise<void>;
104
+ clearByPipeline(pipelineId: string): Promise<void>;
105
+ getStorageInfo(): Promise<{
106
+ totalEntries: number;
107
+ totalSize: number;
108
+ oldestEntry?: number;
109
+ newestEntry?: number;
110
+ numberOfPipelines: number;
111
+ cachePath: string;
112
+ userDataPath: string;
113
+ retentionPolicy: {
114
+ enabled: boolean;
115
+ maxEntries: number;
116
+ maxAge: number;
117
+ };
118
+ }>;
119
+ private getAllPipelineFiles;
120
+ }
85
121
  //#endregion
86
122
  //#region src/handlers/index.d.ts
87
123
  declare const registerAllHandlers: (options: {
88
124
  version: string;
89
- nodePath?: string;
90
- pnpmPath?: string;
91
- }, context: PipelabContext) => Promise<void>;
125
+ context: PipelabContext;
126
+ }) => Promise<void>;
92
127
  //#endregion
93
128
  //#region src/config.d.ts
94
129
  declare const getMigrator: <T>(name: string) => any;
95
- declare const setupConfigFile: <T>(name: string, customMigrator?: Migrator<T>, context?: PipelabContext) => Promise<{
96
- getConfig: () => Promise<any>;
97
- saveConfig: (json: T) => Promise<void>;
98
- migrate: (json: any) => Promise<T>;
130
+ declare const setupConfigFile: <T>(name: string, options: {
131
+ context: PipelabContext;
132
+ migrator?: Migrator<T>;
133
+ }) => Promise<{
134
+ setConfig: (config: T) => Promise<boolean>;
135
+ getConfig: () => Promise<T>;
99
136
  }>;
100
137
  //#endregion
101
138
  //#region src/api.d.ts
@@ -110,38 +147,37 @@ declare const usePluginAPI: (browserWindow: any) => {
110
147
  execute: <KEY extends RendererChannels>(channel: KEY, data?: RendererData<KEY>, listener?: ListenerMain<KEY>) => Promise<RendererEnd<KEY>>;
111
148
  };
112
149
  type UseMainAPI = ReturnType<typeof usePluginAPI>;
113
- declare function createApiObject(context: PipelabContext): PipelabApi$1;
114
150
  //#endregion
115
151
  //#region src/handler-func.d.ts
116
152
  declare const handleConditionExecute: (nodeId: string, pluginId: string, params: BlockCondition["params"], cwd: string, context: PipelabContext) => Promise<End<"condition:execute">>;
117
153
  declare const handleActionExecute: (nodeId: string, pluginId: string, params: Record<string, string>, mainWindow: any | undefined, send: HandleListenerSendFn<"action:execute">, abortSignal: AbortSignal, cwd: string, cachePath: string, context: PipelabContext) => Promise<End<"action:execute">>;
118
154
  //#endregion
119
155
  //#region src/utils.d.ts
120
- declare const getFinalPlugins: () => any[];
156
+ declare const getFinalPlugins: () => RendererPluginDefinition[];
121
157
  declare const executeGraphWithHistory: ({
122
158
  graph,
123
159
  variables,
124
160
  projectName,
125
161
  projectPath,
126
162
  pipelineId,
127
- mainWindow,
128
163
  onNodeEnter,
129
164
  onNodeExit,
130
165
  onLog,
131
166
  abortSignal,
167
+ mainWindow,
132
168
  cachePath,
133
169
  context
134
170
  }: {
135
171
  graph: any;
136
- variables: any;
172
+ variables: Variable[];
137
173
  projectName: string;
138
174
  projectPath: string;
139
175
  pipelineId: string;
140
- mainWindow: any;
141
176
  onNodeEnter?: (node: any) => void;
142
177
  onNodeExit?: (node: any) => void;
143
- onLog?: (data: any, node: any) => void;
178
+ onLog?: (data: any, node?: any) => void;
144
179
  abortSignal: AbortSignal;
180
+ mainWindow?: any;
145
181
  cachePath: string;
146
182
  context: PipelabContext;
147
183
  }) => Promise<{
@@ -151,23 +187,20 @@ declare const executeGraphWithHistory: ({
151
187
  //#endregion
152
188
  //#region src/plugins-registry.d.ts
153
189
  declare const builtInPlugins: (options: {
154
- nodePath?: string;
155
- pnpmPath?: string;
156
- } | undefined, context: PipelabContext) => Promise<any[]>;
190
+ context: PipelabContext;
191
+ }) => Promise<any[]>;
157
192
  //#endregion
158
193
  //#region src/utils/remote.d.ts
159
194
  type FetchOptions = {
160
195
  installDeps?: boolean;
161
- nodePath?: string;
162
- pnpmPath?: string;
163
- baseDir?: string;
164
196
  signal?: AbortSignal;
197
+ context: PipelabContext;
165
198
  };
166
199
  /**
167
200
  * Robust utility to fetch, cache, and resolve an NPM package.
168
201
  * Centralized in core-node to avoid circular dependencies.
169
202
  */
170
- declare function fetchPackage(packageName: string, versionOrRange: string | undefined, context: PipelabContext, options?: FetchOptions): Promise<{
203
+ declare function fetchPackage(packageName: string, versionOrRange: string, options: FetchOptions): Promise<{
171
204
  packageDir: string;
172
205
  resolvedVersion: string;
173
206
  isLocal?: boolean;
@@ -176,14 +209,15 @@ declare function fetchPackage(packageName: string, versionOrRange: string | unde
176
209
  /**
177
210
  * Executes a pnpm install in a specific directory with a portable environment.
178
211
  */
179
- declare function runPnpm(cwd: string, context: PipelabContext, options?: {
212
+ declare function runPnpm(cwd: string, options: {
180
213
  args?: string[];
181
214
  extraEnv?: Record<string, string>;
182
215
  signal?: AbortSignal;
216
+ context: PipelabContext;
183
217
  }): Promise<execa$1.Result<{
184
218
  cwd: string;
185
219
  all: true;
186
- signal: AbortSignal | undefined;
220
+ cancelSignal: AbortSignal | undefined;
187
221
  env: {
188
222
  NODE_ENV: string;
189
223
  PATH: string | undefined;
@@ -193,18 +227,22 @@ declare function runPnpm(cwd: string, context: PipelabContext, options?: {
193
227
  /**
194
228
  * Installs a specific version of Node.js if not already present.
195
229
  */
196
- declare function ensureNodeJS(version: string, context: PipelabContext): Promise<string>;
230
+ declare function ensureNodeJS(version: string, options: {
231
+ context: PipelabContext;
232
+ }): Promise<string>;
197
233
  /**
198
234
  * Installs the PNPM package from npm if not already present.
199
235
  */
200
- declare function ensurePNPM(context: PipelabContext, version?: string): Promise<string>;
201
- declare function fetchPipelabAsset(packageName: string, context: PipelabContext, versionOrRange?: string, options?: FetchOptions): Promise<string>;
202
- declare function fetchPipelabPlugin(pluginName: string, context: PipelabContext, versionOrRange?: string, options?: FetchOptions): Promise<{
236
+ declare function ensurePNPM(version: string | undefined, options: {
237
+ context: PipelabContext;
238
+ }): Promise<string>;
239
+ declare function fetchPipelabAsset(packageName: string, versionOrRange: string, options: FetchOptions): Promise<string>;
240
+ declare function fetchPipelabPlugin(pluginName: string, versionOrRange: string, options: FetchOptions): Promise<{
203
241
  packageDir: string;
204
242
  entryPoint: string;
205
243
  isLocal: boolean;
206
244
  }>;
207
- declare function fetchPipelabCli(context: PipelabContext, versionOrRange?: string, options?: FetchOptions): Promise<{
245
+ declare function fetchPipelabCli(versionOrRange: string, options: FetchOptions): Promise<{
208
246
  packageDir: string;
209
247
  entryPoint: string;
210
248
  isLocal: boolean;
@@ -280,48 +318,68 @@ type RunnerCallbackFnArgument = {
280
318
  log: (...args: Parameters<(typeof console)["log"]>) => void;
281
319
  };
282
320
  type ActionRunnerData<ACTION extends Action> = {
321
+ log: typeof console.log;
283
322
  setOutput: SetOutputActionFn<ACTION>;
284
323
  inputs: ExtractInputsFromAction<ACTION>;
285
324
  setMeta: (callback: (data: ACTION["meta"]) => ACTION["meta"]) => void;
286
325
  meta: ACTION["meta"];
326
+ cwd: string;
327
+ paths: {
328
+ cache: string;
329
+ pnpm: string;
330
+ node: string;
331
+ userData: string;
332
+ modules: string;
333
+ thirdparty: string;
334
+ };
287
335
  browserWindow: BrowserWindow$1;
288
336
  abortSignal: AbortSignal;
337
+ context: PipelabContext;
289
338
  };
290
- type ActionRunner<ACTION extends Action> = (api: PipelabApi, data: ActionRunnerData<ACTION>) => Promise<void>;
291
- type ConditionRunnerData<CONDITION extends Condition> = {
339
+ type ActionRunner<ACTION extends Action> = (data: ActionRunnerData<ACTION>) => Promise<void>;
340
+ type ConditionRunner<CONDITION extends Condition> = (data: {
341
+ log: typeof console.log;
292
342
  inputs: ExtractInputsFromCondition<CONDITION>;
293
343
  setMeta: (callback: (data: CONDITION["meta"]) => CONDITION["meta"]) => void;
294
344
  meta: CONDITION["meta"];
295
- };
296
- type ConditionRunner<CONDITION extends Condition> = (api: PipelabApi, data: ConditionRunnerData<CONDITION>) => Promise<boolean>;
297
- type LoopRunnerData<LOOP extends Loop> = {
345
+ cwd: string;
346
+ context: PipelabContext;
347
+ }) => Promise<boolean>;
348
+ type LoopRunner<LOOP extends Loop> = (data: {
349
+ log: typeof console.log;
298
350
  setOutput: SetOutputLoopFn<LOOP>;
299
351
  inputs: ExtractInputsFromLoop<LOOP>;
300
352
  setMeta: (callback: (data: LOOP["meta"]) => LOOP["meta"]) => void;
301
353
  meta: LOOP["meta"];
302
- };
303
- type LoopRunner<LOOP extends Loop> = (api: PipelabApi, data: LoopRunnerData<LOOP>) => Promise<"step" | "exit">;
304
- type ExpressionRunnerData<EXPRESSION extends Expression> = {
354
+ cwd: string;
355
+ context: PipelabContext;
356
+ }) => Promise<"step" | "exit">;
357
+ type ExpressionRunner<EXPRESSION extends Expression> = (data: {
358
+ log: typeof console.log;
305
359
  setOutput: SetOutputExpressionFn<EXPRESSION>;
306
360
  inputs: ExtractInputsFromExpression<EXPRESSION>;
307
361
  setMeta: (callback: (data: EXPRESSION["meta"]) => EXPRESSION["meta"]) => void;
308
362
  meta: EXPRESSION["meta"];
309
- };
310
- type ExpressionRunner<EXPRESSION extends Expression> = (api: PipelabApi, data: ExpressionRunnerData<EXPRESSION>) => Promise<string>;
311
- type EventRunnerData<EVENT extends Event$1> = {
363
+ cwd: string;
364
+ context: PipelabContext;
365
+ }) => Promise<string>;
366
+ type EventRunner<EVENT extends Event$1> = (data: {
367
+ log: typeof console.log;
312
368
  inputs: ExtractInputsFromEvent<EVENT>;
313
369
  setMeta: (callback: (data: EVENT["meta"]) => EVENT["meta"]) => void;
314
370
  meta: EVENT["meta"];
315
- };
316
- type EventRunner<EVENT extends Event$1> = (api: PipelabApi, data: EventRunnerData<EVENT>) => Promise<void>;
371
+ cwd: string;
372
+ context: PipelabContext;
373
+ }) => Promise<void>;
317
374
  type Runner = ActionRunner<any> | LoopRunner<any> | EventRunner<any> | ConditionRunner<any>;
318
375
  //#endregion
319
376
  //#region src/runner.d.ts
320
- declare function runPipelineCommand(file: string, options: {
377
+ interface RunOptions {
378
+ userData?: string;
321
379
  variables?: string;
322
380
  output?: string;
323
- userData?: string;
324
- }, version: string, context: PipelabContext): Promise<any>;
381
+ }
382
+ declare function runPipelineCommand(file: string, options: RunOptions, version: string): Promise<any>;
325
383
  //#endregion
326
384
  //#region src/migrations.d.ts
327
385
  /**
@@ -338,7 +396,7 @@ interface ServeOptions {
338
396
  nodePath?: string;
339
397
  pnpmPath?: string;
340
398
  }
341
- declare function serveCommand(options: ServeOptions, version: string, dirname: string, context: PipelabContext): Promise<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>>;
399
+ declare function serveCommand(options: ServeOptions, version: string, _dirname: string): Promise<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>>;
342
400
  //#endregion
343
- export { type Action, ActionRunner, ActionRunnerData, type Condition, ConditionRunner, ConditionRunnerData, ConnectedClient, DownloadHooks, type Event$1 as Event, EventRunner, EventRunnerData, type Expression, ExpressionRunner, ExpressionRunnerData, type ExtractInputsFromAction, type ExtractInputsFromCondition, type ExtractInputsFromEvent, type ExtractInputsFromExpression, type ExtractInputsFromLoop, FetchOptions, HandleListener, HandleListenerRenderer, type HandleListenerRendererSendFn, HandleListenerSendFn, ListenerMain, type Loop, LoopRunner, LoopRunnerData, PipelabContext, type RendererChannels, type RendererData, type RendererEnd, type RendererEvents, type RendererMessage, type RequestId, Runner, RunnerCallbackFnArgument, ServeOptions, type SetOutputActionFn, type SetOutputExpressionFn, type SetOutputLoopFn, type UpdateStatus, UseMainAPI, WebSocketServer, WsEvent, builtInPlugins, createApiObject, createPipelabContext, downloadFile, ensure, ensureNodeJS, ensurePNPM, executeGraphWithHistory, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, generateTempFolder, getFinalPlugins, getMigrator, handleActionExecute, handleConditionExecute, registerAgentsHandlers, registerAllHandlers, registerConfigHandlers, registerEngineHandlers, registerFsHandlers, registerHistoryHandlers, registerMigrationHandlers, registerShellHandlers, runPipelineCommand, runPnpm, runWithLiveLogs, serveCommand, setupConfigFile, useAPI, usePluginAPI, webSocketServer, zipFolder };
401
+ export { type Action, ActionRunner, ActionRunnerData, BuildHistoryStorage, type Condition, ConditionRunner, ConnectedClient, DownloadHooks, type Event$1 as Event, EventRunner, type Expression, ExpressionRunner, type ExtractInputsFromAction, type ExtractInputsFromCondition, type ExtractInputsFromEvent, type ExtractInputsFromExpression, type ExtractInputsFromLoop, FetchOptions, HandleListener, HandleListenerRenderer, type HandleListenerRendererSendFn, HandleListenerSendFn, ListenerMain, type Loop, LoopRunner, PipelabContext, PipelabContextOptions, type RendererChannels, type RendererData, type RendererEnd, type RendererEvents, type RendererMessage, type RequestId, RunOptions, Runner, RunnerCallbackFnArgument, ServeOptions, type SetOutputActionFn, type SetOutputExpressionFn, type SetOutputLoopFn, type UpdateStatus, UseMainAPI, WebSocketServer, WsEvent, builtInPlugins, downloadFile, ensure, ensureNodeJS, ensurePNPM, executeGraphWithHistory, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, generateTempFolder, getFinalPlugins, getMigrator, handleActionExecute, handleConditionExecute, isDev, projectRoot, registerAgentsHandlers, registerAllHandlers, registerConfigHandlers, registerEngineHandlers, registerFsHandlers, registerHistoryHandlers, registerMigrationHandlers, registerShellHandlers, runPipelineCommand, runPnpm, runWithLiveLogs, serveCommand, setupConfigFile, useAPI, usePluginAPI, webSocketServer, zipFolder };
344
402
  //# sourceMappingURL=index.d.mts.map