@nocobase/plugin-workflow-sql 0.18.0-alpha.9 → 0.19.0-alpha.10
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 +4 -0
- package/dist/client/index.js +2 -2
- package/dist/externalVersion.js +7 -3
- package/dist/locale/index.d.ts +2 -2
- package/dist/locale/index.js +1 -1
- package/dist/locale/ko_KR.json +5 -0
- package/dist/locale/zh-CN.json +2 -2
- package/dist/server/SQLInstruction.js +1 -1
- package/package.json +7 -2
- package/src/client/SQLInstruction.tsx +16 -1
- package/src/client/__e2e__/dataCURD.test.ts +1312 -0
- package/src/locale/index.ts +1 -1
- package/src/locale/ko_KR.json +5 -0
- package/src/locale/zh-CN.json +2 -2
- package/src/server/SQLInstruction.ts +1 -1
- package/src/server/__tests__/instruction.test.ts +30 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Instruction, WorkflowVariableRawTextArea } from '@nocobase/plugin-workflow/client';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
export default class extends Instruction {
|
|
3
4
|
title: string;
|
|
4
5
|
type: string;
|
|
@@ -18,6 +19,9 @@ export default class extends Instruction {
|
|
|
18
19
|
};
|
|
19
20
|
};
|
|
20
21
|
};
|
|
22
|
+
scope: {
|
|
23
|
+
sqlDescription(): React.JSX.Element;
|
|
24
|
+
};
|
|
21
25
|
components: {
|
|
22
26
|
WorkflowVariableRawTextArea: typeof WorkflowVariableRawTextArea;
|
|
23
27
|
};
|
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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,
|
|
1
|
+
(function(e,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@nocobase/plugin-workflow/client"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","@nocobase/plugin-workflow/client","react-i18next"],o):(e=typeof globalThis!="undefined"?globalThis:e||self,o(e["@nocobase/plugin-workflow-sql"]={},e["@nocobase/client"],e.jsxRuntime,e["@nocobase/plugin-workflow"],e["react-i18next"]))})(this,function(e,o,n,s,c){"use strict";var x=Object.defineProperty;var b=(e,o,n)=>o in e?x(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n;var r=(e,o,n)=>(b(e,typeof o!="symbol"?o+"":o,n),n);var u=(e,o,n)=>new Promise((s,c)=>{var i=t=>{try{a(n.next(t))}catch(l){c(l)}},d=t=>{try{a(n.throw(t))}catch(l){c(l)}},a=t=>t.done?s(t.value):Promise.resolve(t.value).then(i,d);a((n=n.apply(e,o)).next())});const i="@nocobase/plugin-workflow-sql";class d extends s.Instruction{constructor(){super(...arguments);r(this,"title",`{{t("SQL action", { ns: "${i}" })}}`);r(this,"type","sql");r(this,"group","collection");r(this,"description",`{{t("Execute a SQL statement in database.", { ns: "${i}" })}}`);r(this,"fieldset",{sql:{type:"string",required:!0,title:"SQL",description:"{{sqlDescription()}}","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
|
-
`}}});
|
|
4
|
+
`}}});r(this,"scope",{sqlDescription(){return n.jsxs(c.Trans,{ns:i,children:["SQL query result could be used through ",n.jsx("a",{href:"https://docs-cn.nocobase.com/plugins/workflow-json-query",target:"_blank",rel:"noreferrer",children:"JSON query node"})," (Commercial plugin)."]})}});r(this,"components",{WorkflowVariableRawTextArea:s.WorkflowVariableRawTextArea})}useVariables({key:p,title:w},{types:m,fieldNames:f=s.defaultFieldNames}){return{[f.value]:p,[f.label]:w}}}class a extends o.Plugin{afterAdd(){return u(this,null,function*(){})}beforeLoad(){return u(this,null,function*(){})}load(){return u(this,null,function*(){this.app.pm.get("workflow").registerInstruction("sql",d)})}}e.default=a,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/client": "0.
|
|
3
|
-
"@nocobase/plugin-workflow": "0.
|
|
2
|
+
"@nocobase/client": "0.19.0-alpha.10",
|
|
3
|
+
"@nocobase/plugin-workflow": "0.19.0-alpha.10",
|
|
4
4
|
"react-i18next": "11.18.6",
|
|
5
|
-
"
|
|
5
|
+
"react": "18.2.0",
|
|
6
|
+
"@nocobase/server": "0.19.0-alpha.10",
|
|
7
|
+
"@nocobase/plugin-workflow-test": "0.19.0-alpha.10",
|
|
8
|
+
"@nocobase/test": "0.19.0-alpha.10",
|
|
9
|
+
"@nocobase/utils": "0.19.0-alpha.10"
|
|
6
10
|
};
|
package/dist/locale/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const NAMESPACE = "workflow-sql";
|
|
1
|
+
export declare const NAMESPACE = "@nocobase/plugin-workflow-sql";
|
|
2
2
|
export declare function useLang(key: string, options?: {}): string;
|
|
3
|
-
export declare function usePluginTranslation(options: any): import("react-i18next").UseTranslationResponse<"workflow-sql", undefined>;
|
|
3
|
+
export declare function usePluginTranslation(options: any): import("react-i18next").UseTranslationResponse<"@nocobase/plugin-workflow-sql", undefined>;
|
package/dist/locale/index.js
CHANGED
|
@@ -23,7 +23,7 @@ __export(locale_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(locale_exports);
|
|
25
25
|
var import_react_i18next = require("react-i18next");
|
|
26
|
-
const NAMESPACE = "workflow-sql";
|
|
26
|
+
const NAMESPACE = "@nocobase/plugin-workflow-sql";
|
|
27
27
|
function useLang(key, options = {}) {
|
|
28
28
|
const { t } = usePluginTranslation(options);
|
|
29
29
|
return t(key);
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"SQL action": "SQL 操作",
|
|
3
|
-
"Execute a SQL statement in database": "在数据库中执行一个 SQL 语句",
|
|
4
|
-
"
|
|
3
|
+
"Execute a SQL statement in database.": "在数据库中执行一个 SQL 语句",
|
|
4
|
+
"SQL query result could be used through <1>JSON query node</1> (Commercial plugin).": "SQL 执行的结果可在 <1>JSON 解析节点</1> 中使用(商业插件)。"
|
|
5
5
|
}
|
|
@@ -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
|
-
|
|
34
|
+
transaction: processor.transaction
|
|
35
35
|
// plain: true,
|
|
36
36
|
// model: db.getCollection(node.config.collection).model
|
|
37
37
|
});
|
package/package.json
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
"displayName.zh-CN": "工作流:SQL 节点",
|
|
5
5
|
"description": "Execute SQL statements in workflow.",
|
|
6
6
|
"description.zh-CN": "可用于在工作流中对数据库执行任意 SQL 语句。",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.19.0-alpha.10",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
|
+
"homepage": "https://docs.nocobase.com/plugins/workflow-sql",
|
|
11
|
+
"homepage.zh-CN": "https://docs-cn.nocobase.com/plugins/workflow-sql",
|
|
10
12
|
"devDependencies": {
|
|
11
13
|
"antd": "5.x",
|
|
12
14
|
"react": "18.x",
|
|
@@ -19,5 +21,8 @@
|
|
|
19
21
|
"@nocobase/server": "0.x",
|
|
20
22
|
"@nocobase/test": "0.x"
|
|
21
23
|
},
|
|
22
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "d09d81eba67339da36bcec27939a85b35d180770",
|
|
25
|
+
"keywords": [
|
|
26
|
+
"Workflow"
|
|
27
|
+
]
|
|
23
28
|
}
|
|
@@ -3,6 +3,8 @@ import { css } from '@nocobase/client';
|
|
|
3
3
|
import { Instruction, WorkflowVariableRawTextArea, defaultFieldNames } from '@nocobase/plugin-workflow/client';
|
|
4
4
|
|
|
5
5
|
import { NAMESPACE } from '../locale';
|
|
6
|
+
import { Trans } from 'react-i18next';
|
|
7
|
+
import React from 'react';
|
|
6
8
|
|
|
7
9
|
export default class extends Instruction {
|
|
8
10
|
title = `{{t("SQL action", { ns: "${NAMESPACE}" })}}`;
|
|
@@ -14,7 +16,7 @@ export default class extends Instruction {
|
|
|
14
16
|
type: 'string',
|
|
15
17
|
required: true,
|
|
16
18
|
title: 'SQL',
|
|
17
|
-
description:
|
|
19
|
+
description: '{{sqlDescription()}}',
|
|
18
20
|
'x-decorator': 'FormItem',
|
|
19
21
|
'x-component': 'WorkflowVariableRawTextArea',
|
|
20
22
|
'x-component-props': {
|
|
@@ -26,6 +28,19 @@ export default class extends Instruction {
|
|
|
26
28
|
},
|
|
27
29
|
},
|
|
28
30
|
};
|
|
31
|
+
scope = {
|
|
32
|
+
sqlDescription() {
|
|
33
|
+
return (
|
|
34
|
+
<Trans ns={NAMESPACE}>
|
|
35
|
+
{'SQL query result could be used through '}
|
|
36
|
+
<a href="https://docs-cn.nocobase.com/plugins/workflow-json-query" target="_blank" rel="noreferrer">
|
|
37
|
+
{'JSON query node'}
|
|
38
|
+
</a>
|
|
39
|
+
{' (Commercial plugin).'}
|
|
40
|
+
</Trans>
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
};
|
|
29
44
|
components = {
|
|
30
45
|
WorkflowVariableRawTextArea,
|
|
31
46
|
};
|