@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.
@@ -1,6 +1,6 @@
1
1
  import { useTranslation } from 'react-i18next';
2
2
 
3
- export const NAMESPACE = 'workflow-sql';
3
+ export const NAMESPACE = '@nocobase/plugin-workflow-sql';
4
4
 
5
5
  export function useLang(key: string, options = {}) {
6
6
  const { t } = usePluginTranslation(options);
@@ -0,0 +1,5 @@
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,5 +1,5 @@
1
1
  {
2
2
  "SQL action": "SQL 操作",
3
- "Execute a SQL statement in database": "在数据库中执行一个 SQL 语句",
4
- "Usage of SQL query result is not supported yet.": "SQL 执行的结果暂不支持使用。"
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
- // transaction: processor.transaction,
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
  });