@pipelab/core-node 1.0.1-beta.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/.turbo/turbo-build.log +75 -0
  2. package/CHANGELOG.md +291 -0
  3. package/LICENSE +110 -0
  4. package/LICENSE.md +110 -0
  5. package/README.md +10 -0
  6. package/dist/index.d.mts +344 -0
  7. package/dist/index.d.mts.map +1 -0
  8. package/dist/index.mjs +51852 -0
  9. package/dist/index.mjs.map +1 -0
  10. package/package.json +62 -0
  11. package/src/api.ts +115 -0
  12. package/src/config.ts +105 -0
  13. package/src/context.ts +53 -0
  14. package/src/handler-func.ts +234 -0
  15. package/src/handlers/agents.ts +32 -0
  16. package/src/handlers/auth.ts +95 -0
  17. package/src/handlers/build-history.ts +360 -0
  18. package/src/handlers/config.ts +109 -0
  19. package/src/handlers/engine.ts +229 -0
  20. package/src/handlers/fs.ts +97 -0
  21. package/src/handlers/history.ts +299 -0
  22. package/src/handlers/index.ts +41 -0
  23. package/src/handlers/shell.ts +57 -0
  24. package/src/handlers/system.ts +18 -0
  25. package/src/handlers.ts +2 -0
  26. package/src/heavy.ts +4 -0
  27. package/src/index.ts +16 -0
  28. package/src/ipc-core.ts +70 -0
  29. package/src/migrations.ts +72 -0
  30. package/src/paths.ts +1 -0
  31. package/src/plugins-registry.ts +62 -0
  32. package/src/presets/c3toSteam.ts +272 -0
  33. package/src/presets/demo.ts +123 -0
  34. package/src/presets/if.ts +69 -0
  35. package/src/presets/list.ts +30 -0
  36. package/src/presets/loop.ts +65 -0
  37. package/src/presets/moreToCome.ts +32 -0
  38. package/src/presets/newProject.ts +31 -0
  39. package/src/presets/preset.model.ts +0 -0
  40. package/src/presets/test-c3-offline.ts +78 -0
  41. package/src/presets/test-c3-unzip.ts +124 -0
  42. package/src/runner.ts +107 -0
  43. package/src/server.ts +80 -0
  44. package/src/types/runner.ts +101 -0
  45. package/src/utils/fs-extras.ts +182 -0
  46. package/src/utils/remote.ts +381 -0
  47. package/src/utils/storage.ts +99 -0
  48. package/src/utils.ts +258 -0
  49. package/src/websocket-server.ts +288 -0
  50. package/tsconfig.json +19 -0
@@ -0,0 +1,62 @@
1
+ import { fetchPipelabPlugin } from "./utils/remote";
2
+ import { pathToFileURL } from "node:url";
3
+ import { join } from "node:path";
4
+ import { readdir } from "node:fs/promises";
5
+ import { existsSync } from "node:fs";
6
+ import { isDev, projectRoot, PipelabContext } from "./context";
7
+
8
+ const DEFAULT_PLUGIN_IDS = [
9
+ "construct",
10
+ "filesystem",
11
+ "system",
12
+ "steam",
13
+ "itch",
14
+ "electron",
15
+ "discord",
16
+ "poki",
17
+ "nvpatch",
18
+ "tauri",
19
+ "minify",
20
+ "netlify",
21
+ ];
22
+
23
+ export const builtInPlugins = async (options: { context: PipelabContext }) => {
24
+ console.log("[Plugins] Finalizing default plugins list...");
25
+ const promises = DEFAULT_PLUGIN_IDS.map(async (id) => {
26
+ try {
27
+ const packageName = `@pipelab/plugin-${id}`;
28
+ // console.log(`[Plugins] [${id}] Attempting to resolve...`);
29
+
30
+ const { packageDir, entryPoint } = await fetchPipelabPlugin(packageName, "latest", {
31
+ context: options.context,
32
+ });
33
+
34
+ console.log(`[Plugins] [${id}] Attempting to import from: ${entryPoint}`);
35
+ if (!existsSync(entryPoint)) {
36
+ console.error(`[Plugins] [${id}] CRITICAL: Plugin entry point not found at ${entryPoint}`);
37
+ // Optionally list files in the directory to see what's there
38
+ try {
39
+ const files = await readdir(packageDir, { recursive: true });
40
+ console.log(`[Plugins] [${id}] Directory contents:`, files);
41
+ } catch (e) {}
42
+ }
43
+
44
+ const pluginModule = await import(pathToFileURL(entryPoint).href);
45
+ console.log(`[Plugins] [${id}] Successfully loaded from: ${packageDir}`);
46
+ return pluginModule.default;
47
+ } catch (e: any) {
48
+ console.error(`[Plugins] [${id}] CRITICAL: Failed to load:`, e);
49
+ if (e.code === "ERR_MODULE_NOT_FOUND") {
50
+ console.error(
51
+ `[Plugins] [${id}] This usually means a dependency is missing in the plugin's node_modules.`,
52
+ );
53
+ }
54
+ return null;
55
+ }
56
+ });
57
+
58
+ const plugins = await Promise.all(promises);
59
+ const filtered = plugins.filter(Boolean).flat();
60
+ console.log(`[Plugins] Successfully loaded ${filtered.length} default plugins`);
61
+ return filtered;
62
+ };
@@ -0,0 +1,272 @@
1
+ import { PresetFn, SavedFile } from "@pipelab/shared";
2
+
3
+ export const c3toSteamPreset: PresetFn = async () => {
4
+ const startId = "manual-start";
5
+
6
+ const data: SavedFile = {
7
+ version: "3.0.0",
8
+ name: "Construct 3 to Steam",
9
+ description: "A basic project to get you started with Construct 3 and Steam",
10
+ variables: [],
11
+ canvas: {
12
+ triggers: [
13
+ {
14
+ type: "event",
15
+ origin: {
16
+ pluginId: "system",
17
+ nodeId: "manual",
18
+ },
19
+ uid: startId,
20
+ params: {},
21
+ },
22
+ ],
23
+ blocks: [
24
+ {
25
+ uid: "3oHbOKmCXo6NSjmrn0tHG",
26
+ type: "action",
27
+ origin: {
28
+ nodeId: "export-construct-project",
29
+ pluginId: "construct",
30
+ },
31
+ params: {
32
+ file: {
33
+ editor: "simple",
34
+ value: "",
35
+ },
36
+ username: {
37
+ editor: "simple",
38
+ value: '""',
39
+ },
40
+ password: {
41
+ editor: "simple",
42
+ value: '""',
43
+ },
44
+ version: {
45
+ editor: "simple",
46
+ value: "",
47
+ },
48
+ headless: {
49
+ editor: "simple",
50
+ value: "true",
51
+ },
52
+ timeout: {
53
+ editor: "simple",
54
+ value: "120",
55
+ },
56
+ customProfile: {
57
+ editor: "simple",
58
+ value: "",
59
+ },
60
+ },
61
+ },
62
+ {
63
+ uid: "6s1uYWDi2XbRriBpvQSBS",
64
+ type: "action",
65
+ origin: {
66
+ nodeId: "unzip-file-node",
67
+ pluginId: "filesystem",
68
+ },
69
+ params: {
70
+ file: {
71
+ editor: "editor",
72
+ value: "steps['3oHbOKmCXo6NSjmrn0tHG']['outputs']['zipFile']",
73
+ },
74
+ },
75
+ },
76
+ {
77
+ uid: "cvxzwBfXPZhH1RbmmxBdG",
78
+ type: "action",
79
+ origin: {
80
+ nodeId: "electron:package:v2",
81
+ pluginId: "electron",
82
+ },
83
+ params: {
84
+ arch: {
85
+ editor: "simple",
86
+ value: "",
87
+ },
88
+ platform: {
89
+ editor: "simple",
90
+ value: "",
91
+ },
92
+ "input-folder": {
93
+ editor: "editor",
94
+ value: "steps['6s1uYWDi2XbRriBpvQSBS']['outputs']['output']",
95
+ },
96
+ name: {
97
+ editor: "simple",
98
+ value: '"Pipelab"',
99
+ },
100
+ appBundleId: {
101
+ editor: "simple",
102
+ value: '"com.pipelab.app"',
103
+ },
104
+ appCopyright: {
105
+ editor: "simple",
106
+ value: '"Copyright © 2024 Pipelab"',
107
+ },
108
+ appVersion: {
109
+ editor: "simple",
110
+ value: '"1.0.0"',
111
+ },
112
+ icon: {
113
+ editor: "simple",
114
+ value: "",
115
+ },
116
+ author: {
117
+ editor: "simple",
118
+ value: '"Pipelab"',
119
+ },
120
+ description: {
121
+ editor: "simple",
122
+ value: '"A sample application"',
123
+ },
124
+ appCategoryType: {
125
+ editor: "simple",
126
+ value: '"public.app-category.developer-tools"',
127
+ },
128
+ width: {
129
+ editor: "simple",
130
+ value: 800,
131
+ },
132
+ height: {
133
+ editor: "simple",
134
+ value: 600,
135
+ },
136
+ fullscreen: {
137
+ editor: "simple",
138
+ value: "false",
139
+ },
140
+ frame: {
141
+ editor: "simple",
142
+ value: "true",
143
+ },
144
+ transparent: {
145
+ editor: "simple",
146
+ value: "false",
147
+ },
148
+ toolbar: {
149
+ editor: "simple",
150
+ value: "true",
151
+ },
152
+ alwaysOnTop: {
153
+ editor: "simple",
154
+ value: "false",
155
+ },
156
+ electronVersion: {
157
+ editor: "simple",
158
+ value: '""',
159
+ },
160
+ customMainCode: {
161
+ editor: "simple",
162
+ value: "",
163
+ },
164
+ disableAsarPackaging: {
165
+ editor: "simple",
166
+ value: "true",
167
+ },
168
+ enableExtraLogging: {
169
+ editor: "simple",
170
+ value: "false",
171
+ },
172
+ clearServiceWorkerOnBoot: {
173
+ editor: "simple",
174
+ value: "false",
175
+ },
176
+ enableInProcessGPU: {
177
+ editor: "simple",
178
+ value: "false",
179
+ },
180
+ enableDisableRendererBackgrounding: {
181
+ editor: "simple",
182
+ value: "false",
183
+ },
184
+ forceHighPerformanceGpu: {
185
+ editor: "simple",
186
+ value: "false",
187
+ },
188
+ websocketApi: {
189
+ editor: "simple",
190
+ value: "[]",
191
+ },
192
+ ignore: {
193
+ editor: "simple",
194
+ value: "[\n // use 'src/app/' as starting point\n]",
195
+ },
196
+ enableSteamSupport: {
197
+ editor: "simple",
198
+ value: "true",
199
+ },
200
+ steamGameId: {
201
+ editor: "simple",
202
+ value: "480",
203
+ },
204
+ },
205
+ },
206
+ {
207
+ uid: "1pJrNARroFnuY9DfiC56r",
208
+ type: "action",
209
+ origin: {
210
+ nodeId: "steam-upload",
211
+ pluginId: "steam",
212
+ },
213
+ params: {
214
+ sdk: {
215
+ editor: "simple",
216
+ value: "",
217
+ },
218
+ username: {
219
+ editor: "simple",
220
+ value: "",
221
+ },
222
+ appId: {
223
+ editor: "simple",
224
+ value: "",
225
+ },
226
+ depotId: {
227
+ editor: "simple",
228
+ value: "",
229
+ },
230
+ description: {
231
+ editor: "simple",
232
+ value: "",
233
+ },
234
+ folder: {
235
+ editor: "editor",
236
+ value: "steps['cvxzwBfXPZhH1RbmmxBdG']['outputs']['output']",
237
+ },
238
+ enableDRM: {
239
+ editor: "simple",
240
+ value: "false",
241
+ },
242
+ binaryToPatch: {
243
+ editor: "simple",
244
+ value: "",
245
+ },
246
+ },
247
+ disabled: false,
248
+ },
249
+ {
250
+ uid: "gnTsA6oO49ySfetxUf-0K",
251
+ type: "action",
252
+ origin: {
253
+ nodeId: "fs:open-in-explorer",
254
+ pluginId: "filesystem",
255
+ },
256
+ params: {
257
+ path: {
258
+ editor: "editor",
259
+ value: "steps['cvxzwBfXPZhH1RbmmxBdG']['outputs']['output']",
260
+ },
261
+ },
262
+ disabled: false,
263
+ },
264
+ ],
265
+ },
266
+ };
267
+
268
+ return {
269
+ data,
270
+ hightlight: true,
271
+ };
272
+ };
@@ -0,0 +1,123 @@
1
+ // @ts-nocheck
2
+
3
+ import { PresetFn, SavedFile } from "@pipelab/shared";
4
+
5
+ export const demoPreset: PresetFn = async () => {
6
+ const startId = "manual-start";
7
+ const exportConstructProjectId = "export-construct-project";
8
+ const listFilesNodeId = "list-files-node";
9
+ const logOkId = "log-ok";
10
+
11
+ const data: SavedFile = {
12
+ version: "1.0.0",
13
+ variables: [],
14
+ name: "demo",
15
+ description: "demo",
16
+ canvas: {
17
+ blocks: [
18
+ {
19
+ type: "event",
20
+ origin: {
21
+ pluginId: "system",
22
+ nodeId: "manual",
23
+ },
24
+ uid: startId,
25
+ params: {},
26
+ },
27
+ {
28
+ type: "action",
29
+ origin: {
30
+ pluginId: "construct",
31
+ nodeId: "export-construct-project",
32
+ },
33
+ uid: exportConstructProjectId,
34
+ params: {
35
+ version: "300",
36
+ username: "quentin",
37
+ password: "aaa",
38
+ headless: false,
39
+ },
40
+ },
41
+ {
42
+ type: "action",
43
+ origin: {
44
+ pluginId: "filesystem",
45
+ nodeId: "list-files-node",
46
+ },
47
+ uid: listFilesNodeId,
48
+ params: {
49
+ folder: "/home/quentin/Téléchargements/sourcegit/",
50
+ recursive: true,
51
+ },
52
+ },
53
+ {
54
+ type: "loop",
55
+ origin: {
56
+ pluginId: "system",
57
+ nodeId: "for",
58
+ },
59
+
60
+ params: {
61
+ value: `{{ steps['${listFilesNodeId}']['outputs']['paths'] }}`,
62
+ },
63
+ children: [
64
+ {
65
+ type: "condition",
66
+ origin: {
67
+ pluginId: "filesystem",
68
+ nodeId: "is-file",
69
+ },
70
+ uid: "is-file-condition",
71
+
72
+ params: {
73
+ path: `{{ steps['${listFilesNodeId}']['outputs']['paths'][context.loopindex] }}`,
74
+ },
75
+ branchTrue: [
76
+ {
77
+ type: "action",
78
+ origin: {
79
+ pluginId: "system",
80
+ nodeId: "log",
81
+ },
82
+ params: {
83
+ message: `File: {{ steps['${listFilesNodeId}']['outputs']['paths'] }}`,
84
+ },
85
+ uid: "log-ok-in-foreach",
86
+ },
87
+ ],
88
+ branchFalse: [
89
+ {
90
+ type: "action",
91
+ origin: {
92
+ pluginId: "system",
93
+ nodeId: "log",
94
+ },
95
+ params: {
96
+ message: `Folder: {{ steps['${listFilesNodeId}']['outputs']['paths'] }}`,
97
+ },
98
+ uid: "log-ko-in-foreach",
99
+ },
100
+ ],
101
+ },
102
+ ],
103
+ uid: "for-each-file",
104
+ },
105
+ {
106
+ type: "action",
107
+ origin: {
108
+ pluginId: "system",
109
+ nodeId: "log",
110
+ },
111
+ uid: logOkId,
112
+ params: {
113
+ message: "{{ Filesystem.Join() }}",
114
+ },
115
+ },
116
+ ],
117
+ },
118
+ };
119
+
120
+ return {
121
+ data,
122
+ };
123
+ };
@@ -0,0 +1,69 @@
1
+ // @ts-nocheck
2
+ import { PresetFn, SavedFile } from "@pipelab/shared";
3
+
4
+ export const ifPreset: PresetFn = async () => {
5
+ const branchId = "branchId";
6
+ const logOkId = "logOkId";
7
+ const logKoId = "logKoId";
8
+ const booleanId = "booleanId";
9
+
10
+ const data: SavedFile = {
11
+ version: "1.0.0",
12
+ name: "Condition demo",
13
+ description: "Condition demo",
14
+ variables: [
15
+ {
16
+ type: "boolean",
17
+ id: booleanId,
18
+ description: "The value of the conditon",
19
+ name: "Value",
20
+ value: true,
21
+ },
22
+ ],
23
+ canvas: {
24
+ blocks: [
25
+ {
26
+ type: "condition",
27
+ origin: {
28
+ pluginId: "system",
29
+ nodeId: "branch",
30
+ },
31
+ uid: branchId,
32
+ params: {
33
+ condition: "",
34
+ },
35
+ branchTrue: [
36
+ {
37
+ type: "action",
38
+ origin: {
39
+ pluginId: "system",
40
+ nodeId: "log",
41
+ },
42
+ uid: logOkId,
43
+ params: {
44
+ text: "OK",
45
+ },
46
+ },
47
+ ],
48
+ branchFalse: [
49
+ {
50
+ type: "action",
51
+ origin: {
52
+ pluginId: "system",
53
+ nodeId: "log",
54
+ },
55
+ uid: logKoId,
56
+ params: {
57
+ text: "KO",
58
+ },
59
+ },
60
+ ],
61
+ },
62
+ ],
63
+ },
64
+ };
65
+
66
+ return {
67
+ data,
68
+ };
69
+ };
@@ -0,0 +1,30 @@
1
+ // import { demoPreset } from './demo'
2
+ // import { ifPreset } from './if'
3
+ // import { loopPreset } from './loop'
4
+ // import { testC3Unzip } from './test-c3-unzip'
5
+ // import { testC3Offline } from './test-c3-offline'
6
+ import { c3toSteamPreset } from "./c3toSteam";
7
+ import { newProjectPreset } from "./newProject";
8
+ import { moreToCome } from "./moreToCome";
9
+
10
+ export const presets = async () => {
11
+ const newProjectVal = await newProjectPreset();
12
+ const c3toSteamVal = await c3toSteamPreset();
13
+ const moreToComeVal = await moreToCome();
14
+
15
+ // const demoPresetVal = await demoPreset()
16
+ // const ifPresetVal = await ifPreset()
17
+ // const loopPresetVal = await loopPreset()
18
+ // const testC3UnzipVal = await testC3Unzip()
19
+ // const testC3OfflineVal = await testC3Offline()
20
+ return {
21
+ newProject: newProjectVal,
22
+ c3toSteam: c3toSteamVal,
23
+ moreToCome: moreToComeVal,
24
+ // demo: demoPresetVal,
25
+ // if: ifPresetVal,
26
+ // loop: loopPresetVal,
27
+ // testC3Unzip: testC3UnzipVal,
28
+ // testC3Offline: testC3OfflineVal,
29
+ };
30
+ };
@@ -0,0 +1,65 @@
1
+ // @ts-nocheck
2
+
3
+ import { PresetFn, SavedFile } from "@pipelab/shared";
4
+
5
+ export const loopPreset: PresetFn = async () => {
6
+ const forId = "forId";
7
+ const arrayId = "arrayId";
8
+
9
+ const logStepId = "logStepId";
10
+ const logExitId = "logExitId";
11
+
12
+ const data: SavedFile = {
13
+ version: "1.0.0",
14
+ name: "Loop demo",
15
+ description: "Loop demo",
16
+ variables: [
17
+ {
18
+ id: arrayId,
19
+ description: "An array",
20
+ name: "Array",
21
+ type: "array",
22
+ of: "string",
23
+ value: [],
24
+ },
25
+ ],
26
+ canvas: {
27
+ blocks: [
28
+ {
29
+ type: "loop",
30
+ origin: {
31
+ pluginId: "system",
32
+ nodeId: "for",
33
+ },
34
+
35
+ params: {},
36
+ children: [
37
+ {
38
+ type: "action",
39
+ origin: {
40
+ pluginId: "system",
41
+ nodeId: "log",
42
+ },
43
+ params: {},
44
+ uid: logStepId,
45
+ },
46
+ ],
47
+ uid: forId,
48
+ },
49
+ {
50
+ type: "action",
51
+ origin: {
52
+ pluginId: "system",
53
+ nodeId: "log",
54
+ },
55
+ params: {},
56
+ uid: logExitId,
57
+ },
58
+ ],
59
+ },
60
+ };
61
+
62
+ return {
63
+ data,
64
+ };
65
+ };
@@ -0,0 +1,32 @@
1
+ import { PresetFn, SavedFile } from "@pipelab/shared";
2
+
3
+ export const moreToCome: PresetFn = async () => {
4
+ const startId = "manual-start";
5
+
6
+ const data: SavedFile = {
7
+ version: "3.0.0",
8
+ name: "More to come!",
9
+ description: "Do not hesitate to suggest templates you would see here",
10
+ variables: [],
11
+ canvas: {
12
+ triggers: [
13
+ {
14
+ type: "event",
15
+ origin: {
16
+ pluginId: "system",
17
+ nodeId: "manual",
18
+ },
19
+ uid: startId,
20
+ params: {},
21
+ },
22
+ ],
23
+ blocks: [],
24
+ },
25
+ };
26
+
27
+ return {
28
+ data,
29
+ disabled: true,
30
+ hightlight: false,
31
+ };
32
+ };
@@ -0,0 +1,31 @@
1
+ import { PresetFn, SavedFile } from "@pipelab/shared";
2
+
3
+ export const newProjectPreset: PresetFn = async () => {
4
+ const startId = "manual-start";
5
+
6
+ const data: SavedFile = {
7
+ version: "3.0.0",
8
+ name: "Empty project",
9
+ description: "A default project with no tasks added",
10
+ variables: [],
11
+ canvas: {
12
+ triggers: [
13
+ {
14
+ type: "event",
15
+ origin: {
16
+ pluginId: "system",
17
+ nodeId: "manual",
18
+ },
19
+ uid: startId,
20
+ params: {},
21
+ },
22
+ ],
23
+ blocks: [],
24
+ },
25
+ };
26
+
27
+ return {
28
+ data,
29
+ hightlight: true,
30
+ };
31
+ };
File without changes