@pipelab/core-node 1.0.0-beta.2 → 1.0.0-beta.22

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 (45) hide show
  1. package/.oxfmtrc.json +1 -1
  2. package/CHANGELOG.md +173 -0
  3. package/dist/config-Bi0ORcTK.mjs +2 -0
  4. package/dist/config-CFgGRD9U.mjs +265 -0
  5. package/dist/config-CFgGRD9U.mjs.map +1 -0
  6. package/dist/index.d.mts +74 -53
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.mjs +1705 -576
  9. package/dist/index.mjs.map +1 -1
  10. package/package.json +9 -5
  11. package/scratch/simulate-updates.ts +120 -0
  12. package/src/config.test.ts +232 -0
  13. package/src/config.ts +111 -50
  14. package/src/context.ts +117 -5
  15. package/src/handler-func.ts +2 -77
  16. package/src/handlers/build-history.ts +60 -90
  17. package/src/handlers/config.ts +265 -55
  18. package/src/handlers/engine.ts +32 -35
  19. package/src/handlers/history.ts +0 -40
  20. package/src/handlers/index.ts +4 -0
  21. package/src/handlers/migration.ts +621 -0
  22. package/src/handlers/plugins.ts +305 -0
  23. package/src/handlers/system.ts +7 -2
  24. package/src/index.ts +9 -2
  25. package/src/plugins-registry.ts +280 -38
  26. package/src/presets/c3toSteam.ts +13 -7
  27. package/src/presets/demo.ts +9 -9
  28. package/src/presets/list.ts +0 -6
  29. package/src/presets/moreToCome.ts +3 -2
  30. package/src/presets/newProject.ts +3 -2
  31. package/src/presets/test-c3-offline.ts +15 -6
  32. package/src/presets/test-c3-unzip.ts +19 -8
  33. package/src/runner.ts +2 -8
  34. package/src/server.ts +45 -4
  35. package/src/types/runner.ts +2 -30
  36. package/src/utils/fs-extras.ts +6 -24
  37. package/src/utils/github.test.ts +211 -0
  38. package/src/utils/github.ts +90 -10
  39. package/src/utils/remote.test.ts +209 -0
  40. package/src/utils/remote.ts +325 -87
  41. package/src/utils/storage.ts +2 -1
  42. package/src/utils.ts +20 -24
  43. package/src/migrations.ts +0 -72
  44. package/src/presets/if.ts +0 -69
  45. package/src/presets/loop.ts +0 -65
package/src/migrations.ts DELETED
@@ -1,72 +0,0 @@
1
- import { useAPI } from "./ipc-core";
2
- import { PipelabContext } from "./context";
3
- import { setupConfigFile } from "./config";
4
- import {
5
- savedFileMigrator,
6
- fileRepoMigrations,
7
- appSettingsMigrator,
8
- useLogger,
9
- } from "@pipelab/shared";
10
-
11
- /**
12
- * Registers migration handlers for the CLI/Standalone server.
13
- * This overrides the default handlers from @pipelab/core-node to include
14
- * pipeline and file repo migrations directly in the backend.
15
- */
16
- export function registerMigrationHandlers(context: PipelabContext) {
17
- const { handle } = useAPI();
18
- const { logger } = useLogger();
19
-
20
- handle("config:load", async (_, { send, value }) => {
21
- const { config: name } = value;
22
- logger().info("[CLI Migration] config:load", name);
23
-
24
- try {
25
- // Determine which migrator to use
26
- let migrator: any = null;
27
- if (name === "projects") {
28
- migrator = fileRepoMigrations;
29
- } else if (name === "settings") {
30
- migrator = appSettingsMigrator;
31
- } else if (name.startsWith("pipeline-") || name.endsWith(".plb")) {
32
- migrator = savedFileMigrator;
33
- }
34
-
35
- if (!migrator) {
36
- throw new Error(
37
- `No migrator found for configuration: ${name}. All files loaded via config:load MUST have a migration schema.`,
38
- );
39
- }
40
-
41
- // We use a custom loading logic that applies the migrator
42
- // Since setupConfigFile in core-node expects the migrator to be in the configRegistry,
43
- // and we want to keep migrations in the CLI package, we'll manually apply them here.
44
-
45
- const manager = await setupConfigFile(name, { context, migrator });
46
- const json = await manager.getConfig();
47
-
48
- send({
49
- type: "end",
50
- data: {
51
- type: "success",
52
- result: {
53
- result: json,
54
- },
55
- },
56
- });
57
- } catch (e) {
58
- logger().error(`[CLI Migration] config:load error for ${name}:`, e);
59
- send({
60
- type: "end",
61
- data: {
62
- type: "error",
63
- ipcError: e instanceof Error ? e.message : `Unable to load config ${name}`,
64
- },
65
- });
66
- }
67
- });
68
-
69
- // We also need to override config:save if we want to ensure consistency,
70
- // although mostly we just care about migrations on load.
71
- // The default config:save from core-node will work fine as it uses the same setupConfigFile logic.
72
- }
package/src/presets/if.ts DELETED
@@ -1,69 +0,0 @@
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
- };
@@ -1,65 +0,0 @@
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
- };