@nocobase/plugin-workflow-sql 1.2.13-alpha → 1.3.0-alpha.20240710084543

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 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": "1.2.13-alpha",
7
+ "version": "1.3.0-alpha.20240710084543",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/workflow-sql",
@@ -21,7 +21,7 @@
21
21
  "@nocobase/server": "1.x",
22
22
  "@nocobase/test": "1.x"
23
23
  },
24
- "gitHead": "b6a1c2ee330b47c2581ea2ce15ee46210e6220f2",
24
+ "gitHead": "07a8b596fc64a9779a194cb9b0dc2ca7570ed9d4",
25
25
  "keywords": [
26
26
  "Workflow"
27
27
  ]
@@ -1,63 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Instruction, WorkflowVariableRawTextArea } from '@nocobase/plugin-workflow/client';
10
- import React from 'react';
11
- export default class extends Instruction {
12
- title: string;
13
- type: string;
14
- group: string;
15
- description: string;
16
- fieldset: {
17
- dataSource: {
18
- type: string;
19
- required: boolean;
20
- title: string;
21
- description: string;
22
- 'x-decorator': string;
23
- 'x-component': string;
24
- 'x-component-props': {
25
- className: string;
26
- filter(item: any): any;
27
- };
28
- default: string;
29
- };
30
- sql: {
31
- type: string;
32
- required: boolean;
33
- title: string;
34
- description: string;
35
- 'x-decorator': string;
36
- 'x-component': string;
37
- 'x-component-props': {
38
- rows: number;
39
- className: string;
40
- };
41
- };
42
- };
43
- scope: {
44
- sqlDescription(): React.JSX.Element;
45
- };
46
- components: {
47
- WorkflowVariableRawTextArea: typeof WorkflowVariableRawTextArea;
48
- };
49
- useVariables({ key, title }: {
50
- key: any;
51
- title: any;
52
- }, { types, fieldNames }: {
53
- types: any;
54
- fieldNames?: {
55
- readonly label: "label";
56
- readonly value: "value";
57
- readonly children: "children";
58
- };
59
- }): {
60
- value: any;
61
- label: any;
62
- };
63
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Plugin } from '@nocobase/client';
10
- export default class extends Plugin {
11
- afterAdd(): Promise<void>;
12
- beforeLoad(): Promise<void>;
13
- load(): Promise<void>;
14
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- (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,t,a,l){"use strict";var m=Object.defineProperty;var x=(e,o,t)=>o in e?m(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t;var r=(e,o,t)=>(x(e,typeof o!="symbol"?o+"":o,t),t);var d=(e,o,t)=>new Promise((a,l)=>{var s=n=>{try{i(t.next(n))}catch(c){l(c)}},p=n=>{try{i(t.throw(n))}catch(c){l(c)}},i=n=>n.done?a(n.value):Promise.resolve(n.value).then(s,p);i((t=t.apply(e,o)).next())});const s="@nocobase/plugin-workflow-sql";class p extends a.Instruction{constructor(){super(...arguments);r(this,"title",`{{t("SQL action", { ns: "${s}" })}}`);r(this,"type","sql");r(this,"group","collection");r(this,"description",`{{t("Execute a SQL statement in database.", { ns: "${s}" })}}`);r(this,"fieldset",{dataSource:{type:"string",required:!0,title:'{{t("Data source")}}',description:`{{t("Select a data source to execute SQL.", { ns: "${s}" })}}`,"x-decorator":"FormItem","x-component":"DataSourceSelect","x-component-props":{className:"auto-width",filter(u){return u.options.isDBInstance||u.key===o.DEFAULT_DATA_SOURCE_KEY}},default:"main"},sql:{type:"string",required:!0,title:"SQL",description:"{{sqlDescription()}}","x-decorator":"FormItem","x-component":"WorkflowVariableRawTextArea","x-component-props":{rows:20,className:o.css`
11
- font-size: 80%;
12
- font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
13
- `}}});r(this,"scope",{sqlDescription(){return t.jsxs(l.Trans,{ns:s,children:["SQL query result could be used through ",t.jsx("a",{href:"https://docs-cn.nocobase.com/handbook/workflow-json-query",target:"_blank",rel:"noreferrer",children:"JSON query node"})," (Commercial plugin)."]})}});r(this,"components",{WorkflowVariableRawTextArea:a.WorkflowVariableRawTextArea})}useVariables({key:u,title:w},{types:b,fieldNames:f=a.defaultFieldNames}){return{[f.value]:u,[f.label]:w}}}class i extends o.Plugin{afterAdd(){return d(this,null,function*(){})}beforeLoad(){return d(this,null,function*(){})}load(){return d(this,null,function*(){this.app.pm.get("workflow").registerInstruction("sql",p)})}}e.default=i,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,19 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- module.exports = {
11
- "@nocobase/client": "1.2.13-alpha",
12
- "@nocobase/plugin-workflow": "1.2.13-alpha",
13
- "react": "18.2.0",
14
- "react-i18next": "11.18.6",
15
- "@nocobase/server": "1.2.13-alpha",
16
- "@nocobase/plugin-workflow-test": "1.2.13-alpha",
17
- "@nocobase/test": "1.2.13-alpha",
18
- "@nocobase/utils": "1.2.13-alpha"
19
- };
package/dist/index.d.ts DELETED
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- export * from './server';
10
- export { default } from './server';
package/dist/index.js DELETED
@@ -1,48 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
- var src_exports = {};
39
- __export(src_exports, {
40
- default: () => import_server.default
41
- });
42
- module.exports = __toCommonJS(src_exports);
43
- __reExport(src_exports, require("./server"), module.exports);
44
- var import_server = __toESM(require("./server"));
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- ...require("./server")
48
- });
@@ -1,5 +0,0 @@
1
- {
2
- "SQL action": "SQL action",
3
- "Execute a SQL statement in database": "Execute a SQL statement in database",
4
- "Usage of SQL query result is not supported yet.": "Usage of SQL query result is not supported yet."
5
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- export declare const NAMESPACE = "@nocobase/plugin-workflow-sql";
10
- export declare function useLang(key: string, options?: {}): string;
11
- export declare function usePluginTranslation(options: any): import("react-i18next").UseTranslationResponse<"@nocobase/plugin-workflow-sql", undefined>;
@@ -1,48 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var locale_exports = {};
28
- __export(locale_exports, {
29
- NAMESPACE: () => NAMESPACE,
30
- useLang: () => useLang,
31
- usePluginTranslation: () => usePluginTranslation
32
- });
33
- module.exports = __toCommonJS(locale_exports);
34
- var import_react_i18next = require("react-i18next");
35
- const NAMESPACE = "@nocobase/plugin-workflow-sql";
36
- function useLang(key, options = {}) {
37
- const { t } = usePluginTranslation(options);
38
- return t(key);
39
- }
40
- function usePluginTranslation(options) {
41
- return (0, import_react_i18next.useTranslation)(NAMESPACE, options);
42
- }
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- NAMESPACE,
46
- useLang,
47
- usePluginTranslation
48
- });
@@ -1,5 +0,0 @@
1
- {
2
- "SQL action": "SQL 작업",
3
- "Execute a SQL statement in database": "데이터베이스에서 SQL 문을 실행합니다",
4
- "Usage of SQL query result is not supported yet.": "아직 SQL 쿼리 결과의 사용은 지원되지 않습니다."
5
- }
@@ -1,6 +0,0 @@
1
- {
2
- "SQL action": "SQL 操作",
3
- "Execute a SQL statement in database.": "在数据库中执行一个 SQL 语句",
4
- "Select a data source to execute SQL.": "选择一个数据源来执行 SQL",
5
- "SQL query result could be used through <1>JSON query node</1> (Commercial plugin).": "SQL 执行的结果可在 <1>JSON 解析节点</1> 中使用(商业插件)。"
6
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Plugin } from '@nocobase/server';
10
- export default class extends Plugin {
11
- load(): Promise<void>;
12
- }
@@ -1,50 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var Plugin_exports = {};
38
- __export(Plugin_exports, {
39
- default: () => Plugin_default
40
- });
41
- module.exports = __toCommonJS(Plugin_exports);
42
- var import_server = require("@nocobase/server");
43
- var import_plugin_workflow = __toESM(require("@nocobase/plugin-workflow"));
44
- var import_SQLInstruction = __toESM(require("./SQLInstruction"));
45
- class Plugin_default extends import_server.Plugin {
46
- async load() {
47
- const workflowPlugin = this.app.getPlugin(import_plugin_workflow.default);
48
- workflowPlugin.registerInstruction("sql", import_SQLInstruction.default);
49
- }
50
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Processor, Instruction, FlowNodeModel } from '@nocobase/plugin-workflow';
10
- export default class extends Instruction {
11
- run(node: FlowNodeModel, input: any, processor: Processor): Promise<{
12
- status: 1;
13
- result?: undefined;
14
- } | {
15
- result: any;
16
- status: 1;
17
- }>;
18
- }
@@ -1,57 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var SQLInstruction_exports = {};
28
- __export(SQLInstruction_exports, {
29
- default: () => SQLInstruction_default
30
- });
31
- module.exports = __toCommonJS(SQLInstruction_exports);
32
- var import_plugin_workflow = require("@nocobase/plugin-workflow");
33
- class SQLInstruction_default extends import_plugin_workflow.Instruction {
34
- async run(node, input, processor) {
35
- const { db } = this.workflow.app.dataSourceManager.dataSources.get(
36
- node.config.dataSource || "main"
37
- ).collectionManager;
38
- if (!db) {
39
- throw new Error(`type of data source "${node.config.dataSource}" is not database`);
40
- }
41
- const sql = processor.getParsedValue(node.config.sql || "", node.id).trim();
42
- if (!sql) {
43
- return {
44
- status: import_plugin_workflow.JOB_STATUS.RESOLVED
45
- };
46
- }
47
- const result = await db.sequelize.query(sql, {
48
- transaction: processor.transaction
49
- // plain: true,
50
- // model: db.getCollection(node.config.collection).model
51
- });
52
- return {
53
- result,
54
- status: import_plugin_workflow.JOB_STATUS.RESOLVED
55
- };
56
- }
57
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- export { default } from './Plugin';
@@ -1,42 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var server_exports = {};
38
- __export(server_exports, {
39
- default: () => import_Plugin.default
40
- });
41
- module.exports = __toCommonJS(server_exports);
42
- var import_Plugin = __toESM(require("./Plugin"));