@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
package/src/locale/index.ts
CHANGED
package/src/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
|
}
|
|
@@ -11,7 +11,7 @@ export default class extends Instruction {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const result = await sequelize.query(sql, {
|
|
14
|
-
|
|
14
|
+
transaction: processor.transaction,
|
|
15
15
|
// plain: true,
|
|
16
16
|
// model: db.getCollection(node.config.collection).model
|
|
17
17
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Database from '@nocobase/database';
|
|
1
|
+
import Database, { fn } from '@nocobase/database';
|
|
2
2
|
import { Application } from '@nocobase/server';
|
|
3
3
|
import { EXECUTION_STATUS, JOB_STATUS } from '@nocobase/plugin-workflow';
|
|
4
4
|
import { getApp, sleep } from '@nocobase/plugin-workflow-test';
|
|
@@ -166,4 +166,33 @@ describe('workflow > instructions > sql', () => {
|
|
|
166
166
|
expect(queryJob.result).toBeNull();
|
|
167
167
|
});
|
|
168
168
|
});
|
|
169
|
+
|
|
170
|
+
describe('run in sync mode', () => {
|
|
171
|
+
it('sync workflow', async () => {
|
|
172
|
+
const w2 = await WorkflowModel.create({
|
|
173
|
+
enabled: true,
|
|
174
|
+
sync: true,
|
|
175
|
+
type: 'collection',
|
|
176
|
+
config: {
|
|
177
|
+
mode: 1,
|
|
178
|
+
collection: 'categories',
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
const n1 = await w2.createNode({
|
|
183
|
+
type: 'sql',
|
|
184
|
+
config: {
|
|
185
|
+
sql: `select count(id) from ${PostCollection.quotedTableName()}`,
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const CategoryRepo = db.getCollection('categories').repository;
|
|
190
|
+
const category = await CategoryRepo.create({ values: { title: 't1' } });
|
|
191
|
+
|
|
192
|
+
const [execution] = await w2.getExecutions();
|
|
193
|
+
expect(execution.status).toBe(EXECUTION_STATUS.RESOLVED);
|
|
194
|
+
const [job] = await execution.getJobs();
|
|
195
|
+
expect(job.status).toBe(JOB_STATUS.RESOLVED);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
169
198
|
});
|