@pipelab/plugin-system 1.0.0-beta.1 → 1.0.0-beta.2
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/package.json +6 -3
- package/CHANGELOG.md +0 -18
- package/src/alert.ts +0 -45
- package/src/branch.ts +0 -89
- package/src/for.ts +0 -48
- package/src/index.ts +0 -48
- package/src/join.ts +0 -58
- package/src/log.ts +0 -28
- package/src/manual.ts +0 -20
- package/src/prompt.ts +0 -47
- package/src/sleep.ts +0 -26
- package/tsconfig.json +0 -8
- package/tsdown.config.ts +0 -15
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipelab/plugin-system",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"license": "FSL-1.1-MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/CynToolkit/pipelab.git",
|
|
8
8
|
"directory": "plugins/plugin-system"
|
|
9
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
10
13
|
"type": "module",
|
|
11
14
|
"main": "./dist/index.cjs",
|
|
12
15
|
"module": "./dist/index.mjs",
|
|
@@ -16,12 +19,12 @@
|
|
|
16
19
|
},
|
|
17
20
|
"dependencies": {
|
|
18
21
|
"@types/node": "^24.12.2",
|
|
19
|
-
"@pipelab/plugin-core": "1.0.0-beta.
|
|
22
|
+
"@pipelab/plugin-core": "1.0.0-beta.2"
|
|
20
23
|
},
|
|
21
24
|
"devDependencies": {
|
|
22
25
|
"tsdown": "0.21.2",
|
|
23
26
|
"typescript": "5.9.3",
|
|
24
|
-
"@pipelab/tsconfig": "1.0.0-beta.
|
|
27
|
+
"@pipelab/tsconfig": "1.0.0-beta.1"
|
|
25
28
|
},
|
|
26
29
|
"scripts": {
|
|
27
30
|
"format": "oxfmt .",
|
package/CHANGELOG.md
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# @pipelab/plugin-system
|
|
2
|
-
|
|
3
|
-
## 1.0.0-beta.1
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- @pipelab/plugin-core@1.0.0-beta.1
|
|
8
|
-
|
|
9
|
-
## 1.0.0-beta.0
|
|
10
|
-
|
|
11
|
-
### Major Changes
|
|
12
|
-
|
|
13
|
-
- e1befbf: initial release
|
|
14
|
-
|
|
15
|
-
### Patch Changes
|
|
16
|
-
|
|
17
|
-
- Updated dependencies [e1befbf]
|
|
18
|
-
- @pipelab/plugin-core@1.0.0-beta.0
|
package/src/alert.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { createAction, createActionRunner, createStringParam } from "@pipelab/plugin-core";
|
|
2
|
-
|
|
3
|
-
export const ID = "system:alert";
|
|
4
|
-
|
|
5
|
-
export type Data = {
|
|
6
|
-
text: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const alertAction = createAction({
|
|
10
|
-
id: ID,
|
|
11
|
-
name: "Alert",
|
|
12
|
-
description: "Alert a message",
|
|
13
|
-
icon: "",
|
|
14
|
-
displayString: "`Alert ${fmt.param(params.message ?? 'No message')}`",
|
|
15
|
-
meta: {},
|
|
16
|
-
params: {
|
|
17
|
-
message: createStringParam("", {
|
|
18
|
-
required: true,
|
|
19
|
-
label: "Message",
|
|
20
|
-
}),
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
outputs: {
|
|
24
|
-
answer: {
|
|
25
|
-
label: "Answer",
|
|
26
|
-
value: "",
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export const alertActionRunner = createActionRunner<typeof alertAction>(
|
|
32
|
-
async ({ log, inputs, api, setOutput, browserWindow }) => {
|
|
33
|
-
browserWindow.flashFrame(true);
|
|
34
|
-
// 'cancel' | 'ok'
|
|
35
|
-
const _answer = await api.execute("dialog:alert", {
|
|
36
|
-
message: inputs.message,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
if ("content" in _answer) {
|
|
40
|
-
setOutput("answer", _answer.content.toString());
|
|
41
|
-
} else {
|
|
42
|
-
log("error");
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
);
|
package/src/branch.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { createCondition, createConditionRunner } from "@pipelab/plugin-core";
|
|
2
|
-
|
|
3
|
-
export const ID = "branch";
|
|
4
|
-
|
|
5
|
-
export const branchCondition = createCondition({
|
|
6
|
-
id: ID,
|
|
7
|
-
icon: "",
|
|
8
|
-
name: "Branch",
|
|
9
|
-
description: "",
|
|
10
|
-
displayString: "If {{ params.valueA }} {{ params.operator }} {{ params.valueB }}",
|
|
11
|
-
params: {
|
|
12
|
-
valueA: {
|
|
13
|
-
value: "",
|
|
14
|
-
label: "First value",
|
|
15
|
-
control: {
|
|
16
|
-
type: "input",
|
|
17
|
-
options: {
|
|
18
|
-
kind: "text",
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
operator: {
|
|
23
|
-
value: "",
|
|
24
|
-
label: "Comparison",
|
|
25
|
-
control: {
|
|
26
|
-
type: "select",
|
|
27
|
-
options: {
|
|
28
|
-
placeholder: "Comparison",
|
|
29
|
-
options: [
|
|
30
|
-
{
|
|
31
|
-
label: "=",
|
|
32
|
-
value: "=",
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
valueB: {
|
|
39
|
-
value: "",
|
|
40
|
-
label: "Second value",
|
|
41
|
-
control: {
|
|
42
|
-
type: "input",
|
|
43
|
-
options: {
|
|
44
|
-
kind: "text",
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export const branchConditionRunner = createConditionRunner<typeof branchCondition>(
|
|
52
|
-
async ({ log, inputs }) => {
|
|
53
|
-
const firstValue = inputs.valueA;
|
|
54
|
-
const secondValue = inputs.valueB;
|
|
55
|
-
const operator = inputs.operator as "=" | "!=" | "<" | "<=" | ">" | ">=";
|
|
56
|
-
|
|
57
|
-
let result;
|
|
58
|
-
switch (operator) {
|
|
59
|
-
case "!=":
|
|
60
|
-
result = firstValue != secondValue;
|
|
61
|
-
break;
|
|
62
|
-
|
|
63
|
-
case "<":
|
|
64
|
-
result = firstValue < secondValue;
|
|
65
|
-
break;
|
|
66
|
-
|
|
67
|
-
case "<=":
|
|
68
|
-
result = firstValue <= secondValue;
|
|
69
|
-
break;
|
|
70
|
-
|
|
71
|
-
case "=":
|
|
72
|
-
result = firstValue === secondValue;
|
|
73
|
-
break;
|
|
74
|
-
|
|
75
|
-
case ">":
|
|
76
|
-
result = firstValue > secondValue;
|
|
77
|
-
break;
|
|
78
|
-
|
|
79
|
-
case ">=":
|
|
80
|
-
result = firstValue >= secondValue;
|
|
81
|
-
break;
|
|
82
|
-
|
|
83
|
-
default:
|
|
84
|
-
throw new Error("Unhandled case");
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return result;
|
|
88
|
-
},
|
|
89
|
-
);
|
package/src/for.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Meta, createLoop, createLoopRunner } from "@pipelab/plugin-core";
|
|
2
|
-
|
|
3
|
-
export const ID = "for";
|
|
4
|
-
|
|
5
|
-
export const forLoop = createLoop({
|
|
6
|
-
id: ID,
|
|
7
|
-
name: "For",
|
|
8
|
-
icon: "",
|
|
9
|
-
description: "A loop",
|
|
10
|
-
outputs: {
|
|
11
|
-
item: {
|
|
12
|
-
value: undefined as any,
|
|
13
|
-
label: "Item",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
params: {
|
|
17
|
-
value: {
|
|
18
|
-
value: [] as Array<unknown>,
|
|
19
|
-
label: "Value",
|
|
20
|
-
control: {
|
|
21
|
-
type: "expression",
|
|
22
|
-
options: {},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
meta: {
|
|
27
|
-
loopindex: 0,
|
|
28
|
-
},
|
|
29
|
-
displayString: "Loop for every element of {{params.value}}",
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export const ForLoopRunner = createLoopRunner<typeof forLoop>(
|
|
33
|
-
async ({ log, meta, setMeta, inputs }) => {
|
|
34
|
-
const index = meta?.loopindex;
|
|
35
|
-
const value = inputs.value;
|
|
36
|
-
|
|
37
|
-
log("index", index);
|
|
38
|
-
|
|
39
|
-
setMeta((meta) => {
|
|
40
|
-
return {
|
|
41
|
-
...meta,
|
|
42
|
-
loopindex: index + 1,
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return value.length < index ? "step" : "exit";
|
|
47
|
-
},
|
|
48
|
-
);
|
package/src/index.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { createNodeDefinition } from "@pipelab/plugin-core";
|
|
2
|
-
import { logAction, logActionRunner } from "./log";
|
|
3
|
-
// import { branchCondition, branchConditionRunner } from './branch';
|
|
4
|
-
// import { forLoop, ForLoopRunner } from './for';
|
|
5
|
-
import { manualEvent, manualEvaluator } from "./manual";
|
|
6
|
-
import { alertAction, alertActionRunner } from "./alert";
|
|
7
|
-
import { promptAction, promptActionRunner } from "./prompt";
|
|
8
|
-
import { sleepAction, sleepActionRunner } from "./sleep";
|
|
9
|
-
|
|
10
|
-
export default createNodeDefinition({
|
|
11
|
-
id: "system",
|
|
12
|
-
description: "System",
|
|
13
|
-
name: "System",
|
|
14
|
-
icon: {
|
|
15
|
-
type: "icon",
|
|
16
|
-
icon: "mdi-cog-outline",
|
|
17
|
-
},
|
|
18
|
-
nodes: [
|
|
19
|
-
{
|
|
20
|
-
node: logAction,
|
|
21
|
-
runner: logActionRunner,
|
|
22
|
-
},
|
|
23
|
-
// {
|
|
24
|
-
// node: branchCondition,
|
|
25
|
-
// runner: branchConditionRunner,
|
|
26
|
-
// },
|
|
27
|
-
// {
|
|
28
|
-
// node: forLoop,
|
|
29
|
-
// runner: ForLoopRunner
|
|
30
|
-
// },
|
|
31
|
-
{
|
|
32
|
-
node: manualEvent,
|
|
33
|
-
runner: manualEvaluator,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
node: alertAction,
|
|
37
|
-
runner: alertActionRunner,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
node: promptAction,
|
|
41
|
-
runner: promptActionRunner,
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
node: sleepAction,
|
|
45
|
-
runner: sleepActionRunner,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
});
|
package/src/join.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { createExpression, createExpressionRunner } from "@pipelab/plugin-core";
|
|
2
|
-
|
|
3
|
-
export const ID = "join";
|
|
4
|
-
|
|
5
|
-
export type Data = {
|
|
6
|
-
value: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const DEFAULT_SEPARATOR = ", ";
|
|
10
|
-
|
|
11
|
-
export const join = createExpression({
|
|
12
|
-
id: ID,
|
|
13
|
-
name: "Join",
|
|
14
|
-
description: "Join values",
|
|
15
|
-
displayString: "Join {{ params.value }}",
|
|
16
|
-
icon: "",
|
|
17
|
-
meta: {},
|
|
18
|
-
params: {
|
|
19
|
-
input: {
|
|
20
|
-
label: "Input",
|
|
21
|
-
value: [],
|
|
22
|
-
control: {
|
|
23
|
-
type: "input",
|
|
24
|
-
options: {
|
|
25
|
-
kind: "text",
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
separator: {
|
|
30
|
-
label: "Separator",
|
|
31
|
-
value: DEFAULT_SEPARATOR,
|
|
32
|
-
control: {
|
|
33
|
-
type: "input",
|
|
34
|
-
options: {
|
|
35
|
-
kind: "text",
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
outputs: {
|
|
42
|
-
value: {
|
|
43
|
-
label: "Value",
|
|
44
|
-
value: "",
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
export const evaluator = createExpressionRunner<typeof join>(async ({ inputs }) => {
|
|
50
|
-
const inputArr = inputs?.input;
|
|
51
|
-
const separatorArr = inputs?.separator;
|
|
52
|
-
|
|
53
|
-
const input = inputArr ? inputArr[0] : [];
|
|
54
|
-
const separator = separatorArr?.[0] ?? DEFAULT_SEPARATOR;
|
|
55
|
-
|
|
56
|
-
const result = input.join(separator);
|
|
57
|
-
return result;
|
|
58
|
-
});
|
package/src/log.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createAction, createActionRunner, createStringParam } from "@pipelab/plugin-core";
|
|
2
|
-
|
|
3
|
-
export const ID = "log";
|
|
4
|
-
|
|
5
|
-
export type Data = {
|
|
6
|
-
text: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const logAction = createAction({
|
|
10
|
-
id: ID,
|
|
11
|
-
name: "Log",
|
|
12
|
-
description: "Log a message",
|
|
13
|
-
icon: "",
|
|
14
|
-
displayString: '`Log "${fmt.param(params.message)}"`',
|
|
15
|
-
meta: {},
|
|
16
|
-
params: {
|
|
17
|
-
message: createStringParam("", {
|
|
18
|
-
required: true,
|
|
19
|
-
label: "Message",
|
|
20
|
-
}),
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
outputs: {},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export const logActionRunner = createActionRunner<typeof logAction>(async ({ log, inputs }) => {
|
|
27
|
-
log(`${inputs.message ?? ""}`);
|
|
28
|
-
});
|
package/src/manual.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createEvent, createEventRunner } from "@pipelab/plugin-core";
|
|
2
|
-
|
|
3
|
-
export const ID = "manual";
|
|
4
|
-
|
|
5
|
-
export type Data = {};
|
|
6
|
-
|
|
7
|
-
export const manualEvent = createEvent({
|
|
8
|
-
id: ID,
|
|
9
|
-
name: "Manual",
|
|
10
|
-
description: "Start a pipeline manually",
|
|
11
|
-
displayString: "'Start the pipeline manually'",
|
|
12
|
-
icon: "",
|
|
13
|
-
meta: {},
|
|
14
|
-
params: {},
|
|
15
|
-
outputs: {},
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export const manualEvaluator = createEventRunner<typeof manualEvent>(async () => {
|
|
19
|
-
return;
|
|
20
|
-
});
|
package/src/prompt.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { createAction, createActionRunner, createStringParam } from "@pipelab/plugin-core";
|
|
2
|
-
|
|
3
|
-
export const ID = "system:prompt";
|
|
4
|
-
|
|
5
|
-
export type Data = {
|
|
6
|
-
text: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const promptAction = createAction({
|
|
10
|
-
id: ID,
|
|
11
|
-
name: "Prompt",
|
|
12
|
-
description: "Prompt a message",
|
|
13
|
-
icon: "",
|
|
14
|
-
displayString: "`Prompt ${fmt.param(params.message ?? 'No message')}`",
|
|
15
|
-
meta: {},
|
|
16
|
-
params: {
|
|
17
|
-
message: createStringParam("", {
|
|
18
|
-
required: true,
|
|
19
|
-
label: "Message",
|
|
20
|
-
}),
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
outputs: {
|
|
24
|
-
answer: {
|
|
25
|
-
label: "Answer",
|
|
26
|
-
value: "",
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export const promptActionRunner = createActionRunner<typeof promptAction>(
|
|
32
|
-
async ({ log, inputs, api, setOutput, browserWindow }) => {
|
|
33
|
-
browserWindow.flashFrame(true);
|
|
34
|
-
// 'cancel' | 'ok'
|
|
35
|
-
const _answer = await api.execute("dialog:prompt", {
|
|
36
|
-
message: inputs.message,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
log("_answer", _answer);
|
|
40
|
-
|
|
41
|
-
if (_answer.type === "success") {
|
|
42
|
-
setOutput("answer", _answer.result.answer);
|
|
43
|
-
} else {
|
|
44
|
-
throw new Error(_answer.ipcError);
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
);
|
package/src/sleep.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createAction, createActionRunner, createNumberParam } from "@pipelab/plugin-core";
|
|
2
|
-
|
|
3
|
-
export const ID = "system:sleep";
|
|
4
|
-
|
|
5
|
-
export const sleepAction = createAction({
|
|
6
|
-
id: ID,
|
|
7
|
-
name: "Wait",
|
|
8
|
-
description: "Wait for a given time (in milliseconds)",
|
|
9
|
-
icon: "",
|
|
10
|
-
displayString: "`Wait for ${fmt.param(params.duration)}ms`",
|
|
11
|
-
meta: {},
|
|
12
|
-
params: {
|
|
13
|
-
duration: createNumberParam(2000, {
|
|
14
|
-
required: true,
|
|
15
|
-
label: "Duration",
|
|
16
|
-
}),
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
outputs: {},
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const sleep = (duration: number) => new Promise((resolve) => setTimeout(resolve, duration));
|
|
23
|
-
|
|
24
|
-
export const sleepActionRunner = createActionRunner<typeof sleepAction>(async ({ inputs }) => {
|
|
25
|
-
await sleep(inputs.duration);
|
|
26
|
-
});
|
package/tsconfig.json
DELETED
package/tsdown.config.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "tsdown";
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
entry: ["src/index.ts"],
|
|
5
|
-
format: ["esm", "cjs"],
|
|
6
|
-
dts: true,
|
|
7
|
-
clean: true,
|
|
8
|
-
loader: {
|
|
9
|
-
".webp": "dataurl",
|
|
10
|
-
".png": "dataurl",
|
|
11
|
-
".jpg": "dataurl",
|
|
12
|
-
".jpeg": "dataurl",
|
|
13
|
-
".svg": "dataurl",
|
|
14
|
-
},
|
|
15
|
-
});
|