@nocobase/plugin-workflow-sql 0.18.0-alpha.1 → 0.18.0-alpha.9
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/dist/client/SQLInstruction.d.ts +7 -2
- package/dist/client/index.js +2 -2
- package/dist/externalVersion.js +3 -3
- package/dist/server/Plugin.d.ts +0 -2
- package/dist/server/Plugin.js +3 -4
- package/dist/server/SQLInstruction.d.ts +2 -2
- package/dist/server/SQLInstruction.js +1 -1
- package/package.json +2 -3
- package/src/client/SQLInstruction.tsx +2 -2
- package/src/client/index.ts +1 -2
- package/src/server/Plugin.ts +2 -5
- package/src/server/SQLInstruction.ts +1 -1
|
@@ -26,8 +26,13 @@ export default class extends Instruction {
|
|
|
26
26
|
title: any;
|
|
27
27
|
}, { types, fieldNames }: {
|
|
28
28
|
types: any;
|
|
29
|
-
fieldNames?:
|
|
29
|
+
fieldNames?: {
|
|
30
|
+
readonly label: "label";
|
|
31
|
+
readonly value: "value";
|
|
32
|
+
readonly children: "children";
|
|
33
|
+
};
|
|
30
34
|
}): {
|
|
31
|
-
|
|
35
|
+
value: any;
|
|
36
|
+
label: any;
|
|
32
37
|
};
|
|
33
38
|
}
|
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(o
|
|
1
|
+
(function(e,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("@nocobase/client"),require("@nocobase/plugin-workflow/client"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@nocobase/plugin-workflow/client","react-i18next"],o):(e=typeof globalThis!="undefined"?globalThis:e||self,o(e["@nocobase/plugin-workflow-sql"]={},e["@nocobase/client"],e["@nocobase/plugin-workflow"]))})(this,function(e,o,t){"use strict";var p=Object.defineProperty;var w=(e,o,t)=>o in e?p(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t;var s=(e,o,t)=>(w(e,typeof o!="symbol"?o+"":o,t),t);var c=(e,o,t)=>new Promise((r,l)=>{var u=n=>{try{i(t.next(n))}catch(a){l(a)}},f=n=>{try{i(t.throw(n))}catch(a){l(a)}},i=n=>n.done?r(n.value):Promise.resolve(n.value).then(u,f);i((t=t.apply(e,o)).next())});const r="workflow-sql";class l extends t.Instruction{constructor(){super(...arguments);s(this,"title",`{{t("SQL action", { ns: "${r}" })}}`);s(this,"type","sql");s(this,"group","collection");s(this,"description",`{{t("Execute a SQL statement in database.", { ns: "${r}" })}}`);s(this,"fieldset",{sql:{type:"string",required:!0,title:"SQL",description:`{{t("Usage of SQL query result is not supported yet.", { ns: "${r}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableRawTextArea","x-component-props":{rows:20,className:o.css`
|
|
2
2
|
font-size: 80%;
|
|
3
3
|
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
4
|
-
`}}});s(this,"components",{WorkflowVariableRawTextArea:t.WorkflowVariableRawTextArea})}useVariables({key:n,title:a},{types:b,fieldNames:d=
|
|
4
|
+
`}}});s(this,"components",{WorkflowVariableRawTextArea:t.WorkflowVariableRawTextArea})}useVariables({key:n,title:a},{types:b,fieldNames:d=t.defaultFieldNames}){return{[d.value]:n,[d.label]:a}}}class u extends o.Plugin{afterAdd(){return c(this,null,function*(){})}beforeLoad(){return c(this,null,function*(){})}load(){return c(this,null,function*(){this.app.pm.get("workflow").registerInstruction("sql",l)})}}e.default=u,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/client": "0.18.0-alpha.
|
|
3
|
-
"@nocobase/plugin-workflow": "0.18.0-alpha.
|
|
2
|
+
"@nocobase/client": "0.18.0-alpha.9",
|
|
3
|
+
"@nocobase/plugin-workflow": "0.18.0-alpha.9",
|
|
4
4
|
"react-i18next": "11.18.6",
|
|
5
|
-
"@nocobase/server": "0.18.0-alpha.
|
|
5
|
+
"@nocobase/server": "0.18.0-alpha.9"
|
|
6
6
|
};
|
package/dist/server/Plugin.d.ts
CHANGED
package/dist/server/Plugin.js
CHANGED
|
@@ -31,12 +31,11 @@ __export(Plugin_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(Plugin_exports);
|
|
33
33
|
var import_server = require("@nocobase/server");
|
|
34
|
+
var import_plugin_workflow = __toESM(require("@nocobase/plugin-workflow"));
|
|
34
35
|
var import_SQLInstruction = __toESM(require("./SQLInstruction"));
|
|
35
36
|
class Plugin_default extends import_server.Plugin {
|
|
36
|
-
workflow;
|
|
37
37
|
async load() {
|
|
38
|
-
const workflowPlugin = this.app.getPlugin(
|
|
39
|
-
|
|
40
|
-
workflowPlugin.instructions.register("sql", new import_SQLInstruction.default(workflowPlugin));
|
|
38
|
+
const workflowPlugin = this.app.getPlugin(import_plugin_workflow.default);
|
|
39
|
+
workflowPlugin.registerInstruction("sql", import_SQLInstruction.default);
|
|
41
40
|
}
|
|
42
41
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Processor, Instruction, FlowNodeModel } from '@nocobase/plugin-workflow';
|
|
2
2
|
export default class extends Instruction {
|
|
3
3
|
run(node: FlowNodeModel, input: any, processor: Processor): Promise<{
|
|
4
|
-
status:
|
|
4
|
+
status: 1;
|
|
5
5
|
result?: undefined;
|
|
6
6
|
} | {
|
|
7
7
|
result: [unknown[], unknown];
|
|
8
|
-
status:
|
|
8
|
+
status: 1;
|
|
9
9
|
}>;
|
|
10
10
|
}
|
|
@@ -31,7 +31,7 @@ class SQLInstruction_default extends import_plugin_workflow.Instruction {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
const result = await sequelize.query(sql, {
|
|
34
|
-
transaction: processor.transaction
|
|
34
|
+
// transaction: processor.transaction,
|
|
35
35
|
// plain: true,
|
|
36
36
|
// model: db.getCollection(node.config.collection).model
|
|
37
37
|
});
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流:SQL 节点",
|
|
5
5
|
"description": "Execute SQL statements in workflow.",
|
|
6
6
|
"description.zh-CN": "可用于在工作流中对数据库执行任意 SQL 语句。",
|
|
7
|
-
"version": "0.18.0-alpha.
|
|
7
|
+
"version": "0.18.0-alpha.9",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"devDependencies": {
|
|
@@ -16,9 +16,8 @@
|
|
|
16
16
|
"@nocobase/client": "0.x",
|
|
17
17
|
"@nocobase/database": "0.x",
|
|
18
18
|
"@nocobase/plugin-workflow": ">=0.17.0-alpha.3",
|
|
19
|
-
"@nocobase/plugin-workflow-test": ">=0.17.0-alpha.3",
|
|
20
19
|
"@nocobase/server": "0.x",
|
|
21
20
|
"@nocobase/test": "0.x"
|
|
22
21
|
},
|
|
23
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "34ca0df4eede2e83fc86297b0fe19eba970e2b1b"
|
|
24
23
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { css
|
|
1
|
+
import { css } from '@nocobase/client';
|
|
2
2
|
|
|
3
|
-
import { Instruction, WorkflowVariableRawTextArea } from '@nocobase/plugin-workflow/client';
|
|
3
|
+
import { Instruction, WorkflowVariableRawTextArea, defaultFieldNames } from '@nocobase/plugin-workflow/client';
|
|
4
4
|
|
|
5
5
|
import { NAMESPACE } from '../locale';
|
|
6
6
|
|
package/src/client/index.ts
CHANGED
|
@@ -13,7 +13,6 @@ export default class extends Plugin {
|
|
|
13
13
|
// You can get and modify the app instance here
|
|
14
14
|
async load() {
|
|
15
15
|
const workflow = this.app.pm.get('workflow') as WorkflowPlugin;
|
|
16
|
-
|
|
17
|
-
workflow.instructions.register(sqlInstruction.type, sqlInstruction);
|
|
16
|
+
workflow.registerInstruction('sql', SQLInstruction);
|
|
18
17
|
}
|
|
19
18
|
}
|
package/src/server/Plugin.ts
CHANGED
|
@@ -4,11 +4,8 @@ import WorkflowPlugin from '@nocobase/plugin-workflow';
|
|
|
4
4
|
import SQLInstruction from './SQLInstruction';
|
|
5
5
|
|
|
6
6
|
export default class extends Plugin {
|
|
7
|
-
workflow: WorkflowPlugin;
|
|
8
|
-
|
|
9
7
|
async load() {
|
|
10
|
-
const workflowPlugin = this.app.getPlugin(
|
|
11
|
-
|
|
12
|
-
workflowPlugin.instructions.register('sql', new SQLInstruction(workflowPlugin));
|
|
8
|
+
const workflowPlugin = this.app.getPlugin<WorkflowPlugin>(WorkflowPlugin);
|
|
9
|
+
workflowPlugin.registerInstruction('sql', SQLInstruction);
|
|
13
10
|
}
|
|
14
11
|
}
|
|
@@ -11,7 +11,7 @@ export default class extends Instruction {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const result = await sequelize.query(sql, {
|
|
14
|
-
transaction: processor.transaction,
|
|
14
|
+
// transaction: processor.transaction,
|
|
15
15
|
// plain: true,
|
|
16
16
|
// model: db.getCollection(node.config.collection).model
|
|
17
17
|
});
|