@pipelab/core-node 1.0.0-beta.0

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 (48) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE +110 -0
  3. package/README.md +10 -0
  4. package/dist/index.d.mts +416 -0
  5. package/dist/index.d.mts.map +1 -0
  6. package/dist/index.mjs +52612 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/package.json +64 -0
  9. package/src/api.ts +115 -0
  10. package/src/config.ts +105 -0
  11. package/src/context.ts +68 -0
  12. package/src/handler-func.ts +234 -0
  13. package/src/handlers/agents.ts +32 -0
  14. package/src/handlers/auth.ts +95 -0
  15. package/src/handlers/build-history.ts +381 -0
  16. package/src/handlers/config.ts +109 -0
  17. package/src/handlers/engine.ts +229 -0
  18. package/src/handlers/fs.ts +97 -0
  19. package/src/handlers/history.ts +329 -0
  20. package/src/handlers/index.ts +41 -0
  21. package/src/handlers/shell.ts +57 -0
  22. package/src/handlers/system.ts +18 -0
  23. package/src/handlers.ts +2 -0
  24. package/src/heavy.ts +4 -0
  25. package/src/index.ts +16 -0
  26. package/src/ipc-core.ts +77 -0
  27. package/src/migrations.ts +72 -0
  28. package/src/paths.ts +1 -0
  29. package/src/plugins-registry.ts +78 -0
  30. package/src/presets/c3toSteam.ts +272 -0
  31. package/src/presets/demo.ts +123 -0
  32. package/src/presets/if.ts +69 -0
  33. package/src/presets/list.ts +30 -0
  34. package/src/presets/loop.ts +65 -0
  35. package/src/presets/moreToCome.ts +32 -0
  36. package/src/presets/newProject.ts +31 -0
  37. package/src/presets/preset.model.ts +0 -0
  38. package/src/presets/test-c3-offline.ts +78 -0
  39. package/src/presets/test-c3-unzip.ts +124 -0
  40. package/src/runner.ts +160 -0
  41. package/src/server.ts +99 -0
  42. package/src/types/runner.ts +101 -0
  43. package/src/utils/fs-extras.ts +211 -0
  44. package/src/utils/remote.ts +497 -0
  45. package/src/utils/storage.ts +99 -0
  46. package/src/utils.ts +268 -0
  47. package/src/websocket-server.ts +288 -0
  48. package/tsconfig.json +19 -0
@@ -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
@@ -0,0 +1,78 @@
1
+ import { PresetFn, SavedFile } from "@pipelab/shared";
2
+
3
+ export const testC3Offline: PresetFn = async () => {
4
+ const packageWithElecton = "electron-package-node";
5
+ const steamUpload = "steam-upload-node";
6
+
7
+ const data: SavedFile = {
8
+ version: "3.0.0",
9
+ variables: [],
10
+ name: "C3 test without export",
11
+ description: "C3 test without export",
12
+ canvas: {
13
+ triggers: [
14
+ {
15
+ type: "event",
16
+ origin: {
17
+ pluginId: "system",
18
+ nodeId: "manual",
19
+ },
20
+ uid: "manual-start",
21
+ params: {},
22
+ },
23
+ ],
24
+ blocks: [
25
+ {
26
+ uid: packageWithElecton,
27
+ type: "action",
28
+ origin: {
29
+ nodeId: "package-to-electron",
30
+ pluginId: "electron",
31
+ },
32
+ params: {
33
+ "input-folder": {
34
+ editor: "editor",
35
+ value: `/home/quentin/Documents/Cyn Assets/app`,
36
+ },
37
+ arch: undefined,
38
+ platform: undefined,
39
+ },
40
+ },
41
+ {
42
+ uid: steamUpload,
43
+ type: "action",
44
+ origin: {
45
+ nodeId: "steam-upload",
46
+ pluginId: "steam",
47
+ },
48
+ params: {
49
+ folder: {
50
+ editor: "editor",
51
+ value: `{{ steps['${packageWithElecton}']['outputs']['output'] }}`,
52
+ },
53
+ appId: {
54
+ editor: "editor",
55
+ value: "3047200",
56
+ },
57
+ depotId: {
58
+ editor: "editor",
59
+ value: "3047201",
60
+ },
61
+ sdk: {
62
+ editor: "editor",
63
+ value: "/home/quentin/Documents/steamworkssdk/sdk",
64
+ },
65
+ username: {
66
+ editor: "editor",
67
+ value: "armaldio",
68
+ },
69
+ },
70
+ },
71
+ ],
72
+ },
73
+ };
74
+
75
+ return {
76
+ data,
77
+ };
78
+ };
@@ -0,0 +1,124 @@
1
+ import { PresetFn, SavedFile } from "@pipelab/shared";
2
+
3
+ export const testC3Unzip: PresetFn = async () => {
4
+ const exportConstructProjectId = "export-construct-project";
5
+ const unzipFileId = "unzip-file-node";
6
+ const packageWithElecton = "electron-package-node";
7
+ const steamUpload = "steam-upload-node";
8
+
9
+ const data: SavedFile = {
10
+ version: "3.0.0",
11
+ name: "From Construct to Steam",
12
+ description: "Export from Construct, package with Electron, then upload to Steam",
13
+ variables: [],
14
+ canvas: {
15
+ triggers: [
16
+ {
17
+ type: "event",
18
+ origin: {
19
+ pluginId: "system",
20
+ nodeId: "manual",
21
+ },
22
+ uid: "manual-start",
23
+ params: {},
24
+ },
25
+ ],
26
+ blocks: [
27
+ {
28
+ uid: exportConstructProjectId,
29
+ type: "action",
30
+ origin: {
31
+ nodeId: "export-construct-project",
32
+ pluginId: "construct",
33
+ },
34
+ params: {
35
+ file: {
36
+ editor: "editor",
37
+ value: `'/home/armaldio/Téléchargements/test.c3p'`,
38
+ },
39
+ username: {
40
+ editor: "editor",
41
+ value: '"a"',
42
+ },
43
+ password: {
44
+ editor: "editor",
45
+ value: '"a"',
46
+ },
47
+ version: {
48
+ editor: "editor",
49
+ value: '"395"',
50
+ },
51
+ headless: {
52
+ editor: "editor",
53
+ value: false,
54
+ },
55
+ },
56
+ },
57
+ {
58
+ uid: unzipFileId,
59
+ type: "action",
60
+ origin: {
61
+ nodeId: "unzip-file-node",
62
+ pluginId: "filesystem",
63
+ },
64
+ params: {
65
+ file: {
66
+ editor: "editor",
67
+ value: `steps['${exportConstructProjectId}']['outputs']['folder']`,
68
+ },
69
+ },
70
+ },
71
+ {
72
+ uid: packageWithElecton,
73
+ type: "action",
74
+ origin: {
75
+ nodeId: "electron:package",
76
+ pluginId: "electron",
77
+ },
78
+ params: {
79
+ "input-folder": {
80
+ editor: "editor",
81
+ value: `steps['${unzipFileId}']['outputs']['output']`,
82
+ },
83
+ arch: undefined,
84
+ platform: undefined,
85
+ },
86
+ },
87
+ {
88
+ uid: steamUpload,
89
+ type: "action",
90
+ origin: {
91
+ nodeId: "steam-upload",
92
+ pluginId: "steam",
93
+ },
94
+ params: {
95
+ folder: {
96
+ editor: "editor",
97
+ value: `steps['${packageWithElecton}']['outputs']['output']`,
98
+ },
99
+ appId: {
100
+ editor: "editor",
101
+ value: "'3047200'",
102
+ },
103
+ depotId: {
104
+ editor: "editor",
105
+ value: "'3047201'",
106
+ },
107
+ sdk: {
108
+ editor: "editor",
109
+ value: "'/home/armaldio/Documents/steamworkssdk/sdk'",
110
+ },
111
+ username: {
112
+ editor: "editor",
113
+ value: "'armaldio'",
114
+ },
115
+ },
116
+ },
117
+ ],
118
+ },
119
+ };
120
+
121
+ return {
122
+ data,
123
+ };
124
+ };