@saltcorn/data 1.6.0-alpha.8 → 1.6.0-beta.1

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.
Files changed (207) hide show
  1. package/dist/base-plugin/actions.d.ts +3 -3
  2. package/dist/base-plugin/actions.d.ts.map +1 -1
  3. package/dist/base-plugin/actions.js +59 -17
  4. package/dist/base-plugin/actions.js.map +1 -1
  5. package/dist/base-plugin/index.d.ts +10 -5
  6. package/dist/base-plugin/index.d.ts.map +1 -1
  7. package/dist/base-plugin/types.d.ts +7 -2
  8. package/dist/base-plugin/types.d.ts.map +1 -1
  9. package/dist/base-plugin/types.js +9 -4
  10. package/dist/base-plugin/types.js.map +1 -1
  11. package/dist/base-plugin/viewtemplates/edit.d.ts.map +1 -1
  12. package/dist/base-plugin/viewtemplates/edit.js +3 -0
  13. package/dist/base-plugin/viewtemplates/edit.js.map +1 -1
  14. package/dist/base-plugin/viewtemplates/filter.d.ts.map +1 -1
  15. package/dist/base-plugin/viewtemplates/filter.js +11 -3
  16. package/dist/base-plugin/viewtemplates/filter.js.map +1 -1
  17. package/dist/base-plugin/viewtemplates/list.d.ts +2 -1
  18. package/dist/base-plugin/viewtemplates/list.d.ts.map +1 -1
  19. package/dist/base-plugin/viewtemplates/list.js +18 -8
  20. package/dist/base-plugin/viewtemplates/list.js.map +1 -1
  21. package/dist/base-plugin/viewtemplates/show.d.ts.map +1 -1
  22. package/dist/base-plugin/viewtemplates/show.js +3 -0
  23. package/dist/base-plugin/viewtemplates/show.js.map +1 -1
  24. package/dist/db/state.d.ts +4 -0
  25. package/dist/db/state.d.ts.map +1 -1
  26. package/dist/db/state.js +27 -4
  27. package/dist/db/state.js.map +1 -1
  28. package/dist/migrate.d.ts.map +1 -1
  29. package/dist/migrate.js +9 -4
  30. package/dist/migrate.js.map +1 -1
  31. package/dist/migrations/202603101553.d.ts +4 -0
  32. package/dist/migrations/202603101553.d.ts.map +1 -0
  33. package/dist/migrations/202603101553.js +22 -0
  34. package/dist/migrations/202603101553.js.map +1 -0
  35. package/dist/mobile-mocks/node/assert.d.ts +1 -0
  36. package/dist/mobile-mocks/node/assert.d.ts.map +1 -0
  37. package/dist/mobile-mocks/node/assert.js +2 -0
  38. package/dist/mobile-mocks/node/assert.js.map +1 -0
  39. package/dist/models/expression.d.ts +1 -1
  40. package/dist/models/expression.d.ts.map +1 -1
  41. package/dist/models/expression.js +51 -16
  42. package/dist/models/expression.js.map +1 -1
  43. package/dist/models/field.d.ts.map +1 -1
  44. package/dist/models/field.js +67 -10
  45. package/dist/models/field.js.map +1 -1
  46. package/dist/models/index.d.ts +1 -1
  47. package/dist/models/index.d.ts.map +1 -1
  48. package/dist/models/internal/push_message_helper.d.ts.map +1 -1
  49. package/dist/models/internal/push_message_helper.js +5 -2
  50. package/dist/models/internal/push_message_helper.js.map +1 -1
  51. package/dist/models/metadata.d.ts +2 -1
  52. package/dist/models/metadata.d.ts.map +1 -1
  53. package/dist/models/metadata.js +5 -0
  54. package/dist/models/metadata.js.map +1 -1
  55. package/dist/models/page.d.ts.map +1 -1
  56. package/dist/models/page.js +3 -1
  57. package/dist/models/page.js.map +1 -1
  58. package/dist/models/plugin.d.ts +2 -2
  59. package/dist/models/plugin.d.ts.map +1 -1
  60. package/dist/models/plugin.js +2 -2
  61. package/dist/models/plugin.js.map +1 -1
  62. package/dist/models/table.d.ts +8 -0
  63. package/dist/models/table.d.ts.map +1 -1
  64. package/dist/models/table.js +196 -83
  65. package/dist/models/table.js.map +1 -1
  66. package/dist/models/trigger.d.ts.map +1 -1
  67. package/dist/models/trigger.js +20 -9
  68. package/dist/models/trigger.js.map +1 -1
  69. package/dist/models/user.d.ts.map +1 -1
  70. package/dist/models/user.js +4 -0
  71. package/dist/models/user.js.map +1 -1
  72. package/dist/models/workflow.d.ts.map +1 -1
  73. package/dist/models/workflow.js +6 -0
  74. package/dist/models/workflow.js.map +1 -1
  75. package/dist/plugin-helper.d.ts.map +1 -1
  76. package/dist/plugin-helper.js +8 -0
  77. package/dist/plugin-helper.js.map +1 -1
  78. package/dist/viewable_fields.d.ts +2 -2
  79. package/dist/viewable_fields.d.ts.map +1 -1
  80. package/dist/viewable_fields.js +13 -8
  81. package/dist/viewable_fields.js.map +1 -1
  82. package/package.json +8 -8
  83. package/webpack.config.js +1 -0
  84. package/dist/tests/actions.test.d.ts +0 -2
  85. package/dist/tests/actions.test.d.ts.map +0 -1
  86. package/dist/tests/actions.test.js +0 -936
  87. package/dist/tests/actions.test.js.map +0 -1
  88. package/dist/tests/auth.test.d.ts +0 -2
  89. package/dist/tests/auth.test.d.ts.map +0 -1
  90. package/dist/tests/auth.test.js +0 -824
  91. package/dist/tests/auth.test.js.map +0 -1
  92. package/dist/tests/auxtest.test.d.ts +0 -2
  93. package/dist/tests/auxtest.test.d.ts.map +0 -1
  94. package/dist/tests/auxtest.test.js +0 -562
  95. package/dist/tests/auxtest.test.js.map +0 -1
  96. package/dist/tests/base.test.d.ts +0 -2
  97. package/dist/tests/base.test.d.ts.map +0 -1
  98. package/dist/tests/base.test.js +0 -30
  99. package/dist/tests/base.test.js.map +0 -1
  100. package/dist/tests/calc.test.d.ts +0 -2
  101. package/dist/tests/calc.test.d.ts.map +0 -1
  102. package/dist/tests/calc.test.js +0 -1081
  103. package/dist/tests/calc.test.js.map +0 -1
  104. package/dist/tests/composite_pk.test.d.ts +0 -2
  105. package/dist/tests/composite_pk.test.d.ts.map +0 -1
  106. package/dist/tests/composite_pk.test.js +0 -98
  107. package/dist/tests/composite_pk.test.js.map +0 -1
  108. package/dist/tests/config.test.d.ts +0 -2
  109. package/dist/tests/config.test.d.ts.map +0 -1
  110. package/dist/tests/config.test.js +0 -86
  111. package/dist/tests/config.test.js.map +0 -1
  112. package/dist/tests/db.test.d.ts +0 -2
  113. package/dist/tests/db.test.d.ts.map +0 -1
  114. package/dist/tests/db.test.js +0 -178
  115. package/dist/tests/db.test.js.map +0 -1
  116. package/dist/tests/discover.test.d.ts +0 -2
  117. package/dist/tests/discover.test.d.ts.map +0 -1
  118. package/dist/tests/discover.test.js +0 -245
  119. package/dist/tests/discover.test.js.map +0 -1
  120. package/dist/tests/edit.test.d.ts +0 -2
  121. package/dist/tests/edit.test.d.ts.map +0 -1
  122. package/dist/tests/edit.test.js +0 -1161
  123. package/dist/tests/edit.test.js.map +0 -1
  124. package/dist/tests/email.test.d.ts +0 -2
  125. package/dist/tests/email.test.d.ts.map +0 -1
  126. package/dist/tests/email.test.js +0 -255
  127. package/dist/tests/email.test.js.map +0 -1
  128. package/dist/tests/exact_views.test.d.ts +0 -2
  129. package/dist/tests/exact_views.test.d.ts.map +0 -1
  130. package/dist/tests/exact_views.test.js +0 -1363
  131. package/dist/tests/exact_views.test.js.map +0 -1
  132. package/dist/tests/field.test.d.ts +0 -2
  133. package/dist/tests/field.test.d.ts.map +0 -1
  134. package/dist/tests/field.test.js +0 -588
  135. package/dist/tests/field.test.js.map +0 -1
  136. package/dist/tests/fieldviews.test.d.ts +0 -2
  137. package/dist/tests/fieldviews.test.d.ts.map +0 -1
  138. package/dist/tests/fieldviews.test.js +0 -74
  139. package/dist/tests/fieldviews.test.js.map +0 -1
  140. package/dist/tests/file.test.d.ts +0 -2
  141. package/dist/tests/file.test.d.ts.map +0 -1
  142. package/dist/tests/file.test.js +0 -148
  143. package/dist/tests/file.test.js.map +0 -1
  144. package/dist/tests/filter.test.d.ts +0 -2
  145. package/dist/tests/filter.test.d.ts.map +0 -1
  146. package/dist/tests/filter.test.js +0 -496
  147. package/dist/tests/filter.test.js.map +0 -1
  148. package/dist/tests/form.test.d.ts +0 -2
  149. package/dist/tests/form.test.d.ts.map +0 -1
  150. package/dist/tests/form.test.js +0 -264
  151. package/dist/tests/form.test.js.map +0 -1
  152. package/dist/tests/list.test.d.ts +0 -2
  153. package/dist/tests/list.test.d.ts.map +0 -1
  154. package/dist/tests/list.test.js +0 -1037
  155. package/dist/tests/list.test.js.map +0 -1
  156. package/dist/tests/models.test.d.ts +0 -2
  157. package/dist/tests/models.test.d.ts.map +0 -1
  158. package/dist/tests/models.test.js +0 -417
  159. package/dist/tests/models.test.js.map +0 -1
  160. package/dist/tests/page.test.d.ts +0 -2
  161. package/dist/tests/page.test.d.ts.map +0 -1
  162. package/dist/tests/page.test.js +0 -26
  163. package/dist/tests/page.test.js.map +0 -1
  164. package/dist/tests/page_group.test.d.ts +0 -2
  165. package/dist/tests/page_group.test.d.ts.map +0 -1
  166. package/dist/tests/page_group.test.js +0 -51
  167. package/dist/tests/page_group.test.js.map +0 -1
  168. package/dist/tests/plugin.test.d.ts +0 -2
  169. package/dist/tests/plugin.test.d.ts.map +0 -1
  170. package/dist/tests/plugin.test.js +0 -60
  171. package/dist/tests/plugin.test.js.map +0 -1
  172. package/dist/tests/show.test.d.ts +0 -2
  173. package/dist/tests/show.test.d.ts.map +0 -1
  174. package/dist/tests/show.test.js +0 -561
  175. package/dist/tests/show.test.js.map +0 -1
  176. package/dist/tests/state.test.d.ts +0 -2
  177. package/dist/tests/state.test.d.ts.map +0 -1
  178. package/dist/tests/state.test.js +0 -82
  179. package/dist/tests/state.test.js.map +0 -1
  180. package/dist/tests/table.test.d.ts +0 -2
  181. package/dist/tests/table.test.d.ts.map +0 -1
  182. package/dist/tests/table.test.js +0 -2717
  183. package/dist/tests/table.test.js.map +0 -1
  184. package/dist/tests/table_history.test.d.ts +0 -2
  185. package/dist/tests/table_history.test.d.ts.map +0 -1
  186. package/dist/tests/table_history.test.js +0 -413
  187. package/dist/tests/table_history.test.js.map +0 -1
  188. package/dist/tests/tag.test.d.ts +0 -2
  189. package/dist/tests/tag.test.d.ts.map +0 -1
  190. package/dist/tests/tag.test.js +0 -97
  191. package/dist/tests/tag.test.js.map +0 -1
  192. package/dist/tests/user.test.d.ts +0 -2
  193. package/dist/tests/user.test.d.ts.map +0 -1
  194. package/dist/tests/user.test.js +0 -441
  195. package/dist/tests/user.test.js.map +0 -1
  196. package/dist/tests/view.test.d.ts +0 -2
  197. package/dist/tests/view.test.d.ts.map +0 -1
  198. package/dist/tests/view.test.js +0 -699
  199. package/dist/tests/view.test.js.map +0 -1
  200. package/dist/tests/workflow.test.d.ts +0 -2
  201. package/dist/tests/workflow.test.d.ts.map +0 -1
  202. package/dist/tests/workflow.test.js +0 -303
  203. package/dist/tests/workflow.test.js.map +0 -1
  204. package/dist/tests/workflow_run.test.d.ts +0 -2
  205. package/dist/tests/workflow_run.test.d.ts.map +0 -1
  206. package/dist/tests/workflow_run.test.js +0 -922
  207. package/dist/tests/workflow_run.test.js.map +0 -1
@@ -1,922 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const workflow_run_1 = __importDefault(require("../models/workflow_run"));
7
- const workflow_step_1 = __importDefault(require("../models/workflow_step"));
8
- const trigger_1 = __importDefault(require("../models/trigger"));
9
- const db_1 = __importDefault(require("../db"));
10
- const assertions_1 = require("./assertions");
11
- const globals_1 = require("@jest/globals");
12
- const multi_tenant_1 = require("@saltcorn/db-common/multi-tenant");
13
- const { getState } = require("../db/state");
14
- getState().registerPlugin("base", require("../base-plugin"));
15
- const mocks_1 = __importDefault(require("./mocks"));
16
- const user_1 = __importDefault(require("../models/user"));
17
- const table_1 = __importDefault(require("../models/table"));
18
- const workflow_trace_1 = __importDefault(require("../models/workflow_trace"));
19
- const { mockReqRes } = mocks_1.default;
20
- (0, globals_1.afterAll)(db_1.default.close);
21
- beforeAll(async () => {
22
- await require("../db/reset_schema")();
23
- await require("../db/fixtures")();
24
- });
25
- jest.setTimeout(10000);
26
- (0, globals_1.describe)("Workflow run steps", () => {
27
- (0, globals_1.it)("should create steps", async () => {
28
- const trigger = await trigger_1.default.create({
29
- action: "Workflow",
30
- when_trigger: "Never",
31
- name: "mywf",
32
- });
33
- await workflow_step_1.default.create({
34
- trigger_id: trigger.id,
35
- name: "first_step",
36
- next_step: "second_step",
37
- action_name: "run_js_code",
38
- initial_step: true,
39
- configuration: { code: `return {x:1}` },
40
- });
41
- await workflow_step_1.default.create({
42
- trigger_id: trigger.id,
43
- name: "second_step",
44
- next_step: "third_step",
45
- action_name: "SetContext",
46
- initial_step: false,
47
- configuration: { ctx_values: `{y:await x+1}` },
48
- });
49
- await workflow_step_1.default.create({
50
- trigger_id: trigger.id,
51
- name: "third_step",
52
- next_step: "x>2 ? fifth_step : fourth_step ",
53
- only_if: "y>4",
54
- action_name: "run_js_code",
55
- initial_step: false,
56
- configuration: { code: `return {x:3}` },
57
- });
58
- await workflow_step_1.default.create({
59
- trigger_id: trigger.id,
60
- name: "fourth_step",
61
- action_name: "run_js_code",
62
- initial_step: false,
63
- configuration: { code: `return {last:1}` },
64
- });
65
- await workflow_step_1.default.create({
66
- trigger_id: trigger.id,
67
- name: "fifth_step",
68
- action_name: "run_js_code",
69
- initial_step: false,
70
- configuration: { code: `return {last:2}` },
71
- });
72
- });
73
- (0, globals_1.it)("should run", async () => {
74
- const user = await user_1.default.findOne({ id: 1 });
75
- (0, assertions_1.assertIsSet)(user);
76
- const trigger = trigger_1.default.findOne({ name: "mywf" });
77
- (0, assertions_1.assertIsSet)(trigger);
78
- const wfrun = await workflow_run_1.default.create({
79
- trigger_id: trigger.id,
80
- });
81
- await wfrun.run({ user });
82
- (0, globals_1.expect)(wfrun.context.x).toBe(1);
83
- (0, globals_1.expect)(wfrun.context.y).toBe(2);
84
- (0, globals_1.expect)(wfrun.context.last).toBe(1);
85
- (0, globals_1.expect)(wfrun.current_step[0]).toBe("fourth_step");
86
- (0, globals_1.expect)(wfrun.current_step_name).toBe("fourth_step");
87
- });
88
- (0, globals_1.it)("should run through trigger", async () => {
89
- const user = await user_1.default.findOne({ id: 1 });
90
- (0, assertions_1.assertIsSet)(user);
91
- const trigger = trigger_1.default.findOne({ name: "mywf" });
92
- (0, assertions_1.assertIsSet)(trigger);
93
- const result = await trigger.runWithoutRow({ user });
94
- (0, globals_1.expect)(result.x).toBe(1);
95
- (0, globals_1.expect)(result.y).toBe(2);
96
- (0, globals_1.expect)(result.last).toBe(1);
97
- });
98
- (0, globals_1.it)("should run with traces", async () => {
99
- const user = await user_1.default.findOne({ id: 1 });
100
- (0, assertions_1.assertIsSet)(user);
101
- const trigger0 = trigger_1.default.findOne({ name: "mywf" });
102
- (0, assertions_1.assertIsSet)(trigger0);
103
- await trigger_1.default.update(trigger0.id, { configuration: { save_traces: true } });
104
- const trigger = trigger_1.default.findOne({ name: "mywf" });
105
- (0, assertions_1.assertIsSet)(trigger);
106
- const result = await trigger.runWithoutRow({ user });
107
- (0, globals_1.expect)(result.x).toBe(1);
108
- (0, globals_1.expect)(result.y).toBe(2);
109
- (0, globals_1.expect)(result.last).toBe(1);
110
- const traces = await workflow_trace_1.default.find({ run_id: result.__wf_run_id });
111
- (0, globals_1.expect)(traces.length).toBe(3);
112
- });
113
- });
114
- (0, globals_1.describe)("Workflow run forloop", () => {
115
- (0, globals_1.it)("should create steps", async () => {
116
- const trigger = await trigger_1.default.create({
117
- action: "Workflow",
118
- when_trigger: "Never",
119
- name: "wfForLoop",
120
- });
121
- await workflow_step_1.default.create({
122
- trigger_id: trigger.id,
123
- name: "first_step",
124
- next_step: "second_step",
125
- action_name: "SetContext",
126
- initial_step: true,
127
- configuration: { ctx_values: "{xs: [1,2,3], ys: []}" },
128
- });
129
- await workflow_step_1.default.create({
130
- trigger_id: trigger.id,
131
- name: "second_step",
132
- next_step: "third_step",
133
- action_name: "ForLoop",
134
- initial_step: false,
135
- configuration: {
136
- array_expression: "xs",
137
- item_variable: "x",
138
- loop_body_initial_step: "body0",
139
- },
140
- });
141
- await workflow_step_1.default.create({
142
- trigger_id: trigger.id,
143
- name: "third_step",
144
- action_name: "SetContext",
145
- initial_step: false,
146
- configuration: { ctx_values: `{done:true}` },
147
- });
148
- await workflow_step_1.default.create({
149
- trigger_id: trigger.id,
150
- name: "body0",
151
- next_step: "body1",
152
- action_name: "run_js_code",
153
- initial_step: false,
154
- configuration: { code: `return {ys:[...ys, x+3]}` },
155
- });
156
- await workflow_step_1.default.create({
157
- trigger_id: trigger.id,
158
- name: "body1",
159
- action_name: "run_js_code",
160
- initial_step: false,
161
- configuration: { code: `return {inloop: x}` },
162
- });
163
- });
164
- (0, globals_1.it)("should run", async () => {
165
- const user = await user_1.default.findOne({ id: 1 });
166
- (0, assertions_1.assertIsSet)(user);
167
- const trigger = trigger_1.default.findOne({ name: "wfForLoop" });
168
- (0, assertions_1.assertIsSet)(trigger);
169
- const wfrun = await workflow_run_1.default.create({
170
- trigger_id: trigger.id,
171
- });
172
- await wfrun.run({ user });
173
- (0, globals_1.expect)(wfrun.context.ys).toStrictEqual([4, 5, 6]);
174
- //expect(wfrun.context.y).toBe(2);
175
- //expect(wfrun.context.last).toBe(1);
176
- });
177
- });
178
- (0, globals_1.describe)("Workflow run error handling", () => {
179
- (0, globals_1.it)("should create steps", async () => {
180
- const trigger = await trigger_1.default.create({
181
- action: "Workflow",
182
- when_trigger: "Never",
183
- name: "mywf1",
184
- });
185
- await workflow_step_1.default.create({
186
- trigger_id: trigger.id,
187
- name: "first_step",
188
- next_step: "second_step",
189
- action_name: "SetErrorHandler",
190
- initial_step: true,
191
- configuration: { error_handling_step: "ehan" },
192
- });
193
- await workflow_step_1.default.create({
194
- trigger_id: trigger.id,
195
- name: "second_step",
196
- next_step: "third_step",
197
- action_name: "run_js_code",
198
- initial_step: false,
199
- configuration: { code: `throw new Error("HAHA")` },
200
- });
201
- await workflow_step_1.default.create({
202
- trigger_id: trigger.id,
203
- name: "third_step",
204
- action_name: "run_js_code",
205
- initial_step: false,
206
- configuration: { code: `return {afterCrash:1}` },
207
- });
208
- await workflow_step_1.default.create({
209
- trigger_id: trigger.id,
210
- name: "ehan",
211
- action_name: "run_js_code",
212
- next_step: "fifth_step",
213
- initial_step: false,
214
- configuration: { code: `return {runEhan:1}` },
215
- });
216
- await workflow_step_1.default.create({
217
- trigger_id: trigger.id,
218
- name: "fifth_step",
219
- action_name: "run_js_code",
220
- initial_step: false,
221
- configuration: { code: `return {afterEhan:1}` },
222
- });
223
- });
224
- (0, globals_1.it)("should run", async () => {
225
- const user = await user_1.default.findOne({ id: 1 });
226
- (0, assertions_1.assertIsSet)(user);
227
- const trigger = trigger_1.default.findOne({ name: "mywf1" });
228
- (0, assertions_1.assertIsSet)(trigger);
229
- const wfrun = await workflow_run_1.default.create({
230
- trigger_id: trigger.id,
231
- });
232
- await wfrun.run({ user });
233
- (0, globals_1.expect)(wfrun.context.afterCrash).toBe(undefined);
234
- (0, globals_1.expect)(wfrun.context.runEhan).toBe(1);
235
- (0, globals_1.expect)(wfrun.context.afterEhan).toBe(1);
236
- });
237
- });
238
- (0, globals_1.describe)("Workflow run error handling with transaction and database ops", () => {
239
- (0, globals_1.it)("should create steps", async () => {
240
- const trigger = await trigger_1.default.create({
241
- action: "Workflow",
242
- when_trigger: "Never",
243
- name: "mywferrdb",
244
- });
245
- await workflow_step_1.default.create({
246
- trigger_id: trigger.id,
247
- name: "first_step",
248
- next_step: "second_step",
249
- action_name: "SetErrorHandler",
250
- initial_step: true,
251
- configuration: { error_handling_step: "ehan" },
252
- });
253
- await workflow_step_1.default.create({
254
- trigger_id: trigger.id,
255
- name: "second_step",
256
- next_step: "third_step",
257
- action_name: "run_js_code",
258
- initial_step: false,
259
- configuration: {
260
- code: `await Table.findOne("books").insertRow({author:"Simon Marlow", pages: 223, foo:3})`,
261
- },
262
- });
263
- await workflow_step_1.default.create({
264
- trigger_id: trigger.id,
265
- name: "third_step",
266
- action_name: "run_js_code",
267
- initial_step: false,
268
- configuration: { code: `return {afterCrash:1}` },
269
- });
270
- await workflow_step_1.default.create({
271
- trigger_id: trigger.id,
272
- name: "ehan",
273
- action_name: "run_js_code",
274
- next_step: "fifth_step",
275
- initial_step: false,
276
- configuration: { code: `return {runEhan:1}` },
277
- });
278
- await workflow_step_1.default.create({
279
- trigger_id: trigger.id,
280
- name: "fifth_step",
281
- action_name: "run_js_code",
282
- initial_step: false,
283
- configuration: {
284
- code: `await Table.findOne("books").insertRow({author:"Simon Marlow", pages: 234})`,
285
- },
286
- });
287
- });
288
- (0, globals_1.it)("should run", async () => {
289
- await (0, multi_tenant_1.runWithTenant)("public", async () => {
290
- await db_1.default.withTransaction(async () => {
291
- const user = await user_1.default.findOne({ id: 1 });
292
- (0, assertions_1.assertIsSet)(user);
293
- const trigger = trigger_1.default.findOne({ name: "mywferrdb" });
294
- (0, assertions_1.assertIsSet)(trigger);
295
- const wfrun = await workflow_run_1.default.create({
296
- trigger_id: trigger.id,
297
- });
298
- await wfrun.run({ user });
299
- (0, globals_1.expect)(wfrun.context.afterCrash).toBe(undefined);
300
- (0, globals_1.expect)(wfrun.context.runEhan).toBe(1);
301
- const books = await table_1.default.findOne("books")?.getRows({
302
- author: "Simon Marlow",
303
- });
304
- (0, globals_1.expect)(books?.length).toBe(1);
305
- (0, globals_1.expect)(books?.[0].pages).toBe(234);
306
- });
307
- });
308
- });
309
- });
310
- (0, globals_1.describe)("Workflow run subworkflows", () => {
311
- (0, globals_1.it)("should create steps", async () => {
312
- const main = await trigger_1.default.create({
313
- action: "Workflow",
314
- when_trigger: "Never",
315
- name: "wfmain",
316
- });
317
- const sub = await trigger_1.default.create({
318
- action: "Workflow",
319
- when_trigger: "Never",
320
- name: "wfsub",
321
- });
322
- await workflow_step_1.default.create({
323
- trigger_id: main.id,
324
- name: "first_step",
325
- next_step: "second_step",
326
- action_name: "SetContext",
327
- initial_step: true,
328
- configuration: { ctx_values: "{foo: {x:1}, bar: {y:2}}" },
329
- });
330
- await workflow_step_1.default.create({
331
- trigger_id: main.id,
332
- name: "second_step",
333
- next_step: "third_step",
334
- action_name: "wfsub",
335
- initial_step: false,
336
- configuration: { subcontext: "foo" },
337
- });
338
- await workflow_step_1.default.create({
339
- trigger_id: main.id,
340
- name: "third_step",
341
- next_step: "",
342
- action_name: "SetContext",
343
- initial_step: false,
344
- configuration: { ctx_values: `{done: true}` },
345
- });
346
- await workflow_step_1.default.create({
347
- trigger_id: sub.id,
348
- name: "first_step",
349
- next_step: "second_step",
350
- action_name: "run_js_code",
351
- initial_step: true,
352
- configuration: { code: `return {w:5+x}` },
353
- });
354
- await workflow_step_1.default.create({
355
- trigger_id: sub.id,
356
- name: "second_step",
357
- action_name: "run_js_code",
358
- initial_step: false,
359
- configuration: { code: `return {z:9}` },
360
- });
361
- });
362
- (0, globals_1.it)("should run", async () => {
363
- const user = await user_1.default.findOne({ id: 1 });
364
- (0, assertions_1.assertIsSet)(user);
365
- const trigger = trigger_1.default.findOne({ name: "wfmain" });
366
- (0, assertions_1.assertIsSet)(trigger);
367
- const wfrun = await workflow_run_1.default.create({
368
- trigger_id: trigger.id,
369
- });
370
- await wfrun.run({ user });
371
- //console.log(wfrun.context);
372
- (0, globals_1.expect)(wfrun.context.done).toBe(true);
373
- (0, globals_1.expect)(wfrun.context.foo.w).toBe(6);
374
- (0, globals_1.expect)(wfrun.context.foo.z).toBe(9);
375
- (0, globals_1.expect)(wfrun.context.bar.y).toBe(2);
376
- (0, globals_1.expect)(wfrun.context.foo.x).toBe(1);
377
- });
378
- });
379
- (0, globals_1.describe)("Workflow run actions", () => {
380
- (0, globals_1.it)("should create steps", async () => {
381
- const table = table_1.default.findOne({ name: "books" });
382
- (0, assertions_1.assertIsSet)(table);
383
- await trigger_1.default.create({
384
- action: "run_js_code",
385
- table_id: table.id,
386
- name: "InsertBook",
387
- when_trigger: "Never",
388
- configuration: {
389
- code: `await table.insertRow({author: "Mary Contrary", pages: 124, publisher: row.publisher})`,
390
- },
391
- });
392
- const main = await trigger_1.default.create({
393
- action: "Workflow",
394
- when_trigger: "Never",
395
- name: "wfrunaction",
396
- });
397
- await workflow_step_1.default.create({
398
- trigger_id: main.id,
399
- name: "first_step",
400
- next_step: "second_step",
401
- action_name: "SetContext",
402
- initial_step: true,
403
- configuration: { ctx_values: "{foo: {x:1}}" },
404
- });
405
- await workflow_step_1.default.create({
406
- trigger_id: main.id,
407
- name: "second_step",
408
- next_step: "third_step",
409
- action_name: "InsertBook",
410
- initial_step: false,
411
- configuration: { row_expr: "{publisher: thepub}" },
412
- });
413
- await workflow_step_1.default.create({
414
- trigger_id: main.id,
415
- name: "third_step",
416
- next_step: "",
417
- action_name: "TableQuery",
418
- initial_step: false,
419
- configuration: {
420
- query_table: "books",
421
- query_object: "{pages: 124}",
422
- query_variable: "books",
423
- },
424
- });
425
- });
426
- (0, globals_1.it)("should run", async () => {
427
- const user = await user_1.default.findOne({ id: 1 });
428
- (0, assertions_1.assertIsSet)(user);
429
- const trigger = trigger_1.default.findOne({ name: "wfrunaction" });
430
- (0, assertions_1.assertIsSet)(trigger);
431
- const wfrun = await workflow_run_1.default.create({
432
- trigger_id: trigger.id,
433
- context: { thepub: 2 },
434
- });
435
- await wfrun.run({ user });
436
- (0, globals_1.expect)(wfrun.context.foo.x).toBe(1);
437
- (0, globals_1.expect)(wfrun.context.books.length).toBe(1);
438
- (0, globals_1.expect)(wfrun.context.books[0].pages).toBe(124);
439
- (0, globals_1.expect)(wfrun.context.books[0].author).toBe("Mary Contrary");
440
- (0, globals_1.expect)(wfrun.context.books[0].publisher).toBe(2);
441
- });
442
- (0, globals_1.it)("should dereference key row fields", async () => {
443
- const user = await user_1.default.findOne({ id: 1 });
444
- (0, assertions_1.assertIsSet)(user);
445
- const table = table_1.default.findOne({ name: "books" });
446
- (0, assertions_1.assertIsSet)(table);
447
- await table.deleteRows({ pages: 124 });
448
- const trigger = trigger_1.default.findOne({ name: "wfrunaction" });
449
- (0, assertions_1.assertIsSet)(trigger);
450
- const wfrun = await workflow_run_1.default.create({
451
- trigger_id: trigger.id,
452
- context: { thepub: "No starch" },
453
- });
454
- await wfrun.run({ user });
455
- (0, globals_1.expect)(wfrun.context.foo.x).toBe(1);
456
- (0, globals_1.expect)(wfrun.context.books.length).toBe(1);
457
- (0, globals_1.expect)(wfrun.context.books[0].pages).toBe(124);
458
- (0, globals_1.expect)(wfrun.context.books[0].author).toBe("Mary Contrary");
459
- (0, globals_1.expect)(wfrun.context.books[0].publisher).toBe(2);
460
- });
461
- });
462
- (0, globals_1.describe)("Workflow run userform", () => {
463
- (0, globals_1.it)("should create steps", async () => {
464
- const trigger = await trigger_1.default.create({
465
- action: "Workflow",
466
- when_trigger: "Never",
467
- name: "uformwf",
468
- });
469
- await workflow_step_1.default.create({
470
- trigger_id: trigger.id,
471
- name: "first_step",
472
- next_step: "second_step",
473
- action_name: "run_js_code",
474
- initial_step: true,
475
- configuration: { code: `return {x:1}` },
476
- });
477
- await workflow_step_1.default.create({
478
- trigger_id: trigger.id,
479
- name: "second_step",
480
- next_step: "third",
481
- action_name: "UserForm",
482
- initial_step: false,
483
- configuration: {
484
- form_header: "",
485
- user_id_expression: "",
486
- user_form_questions: [
487
- {
488
- label: "What is your name",
489
- qtype: "Free text",
490
- var_name: "name",
491
- },
492
- ],
493
- },
494
- });
495
- await workflow_step_1.default.create({
496
- trigger_id: trigger.id,
497
- name: "third",
498
- next_step: "",
499
- action_name: "Output",
500
- initial_step: false,
501
- configuration: {
502
- markdown: false,
503
- output_text: "hello {{name}}",
504
- },
505
- });
506
- });
507
- (0, globals_1.it)("should run", async () => {
508
- const user = await user_1.default.findOne({ id: 1 });
509
- (0, assertions_1.assertIsSet)(user);
510
- const trigger = trigger_1.default.findOne({ name: "uformwf" });
511
- (0, assertions_1.assertIsSet)(trigger);
512
- const wfrun = await workflow_run_1.default.create({
513
- trigger_id: trigger.id,
514
- });
515
- await wfrun.run({ user });
516
- (0, globals_1.expect)(wfrun.context.x).toBe(1);
517
- (0, globals_1.expect)(wfrun.status).toBe("Waiting");
518
- (0, globals_1.expect)(wfrun.wait_info).toStrictEqual({ form: true, user_id: 1 });
519
- await wfrun.provide_form_input({ name: "Tom" });
520
- await wfrun.run({
521
- user,
522
- });
523
- (0, globals_1.expect)(wfrun.status).toBe("Waiting");
524
- (0, globals_1.expect)(wfrun.context.name).toBe("Tom");
525
- (0, globals_1.expect)(wfrun.wait_info.output).toBe("hello Tom");
526
- await wfrun.provide_form_input({});
527
- await wfrun.run({
528
- user,
529
- });
530
- (0, globals_1.expect)(wfrun.status).toBe("Finished");
531
- });
532
- (0, globals_1.it)("should run interactively", async () => {
533
- const user = await user_1.default.findOne({ id: 1 });
534
- (0, assertions_1.assertIsSet)(user);
535
- const trigger = trigger_1.default.findOne({ name: "uformwf" });
536
- (0, assertions_1.assertIsSet)(trigger);
537
- const wfrun = await workflow_run_1.default.create({
538
- trigger_id: trigger.id,
539
- });
540
- const runres0 = await wfrun.run({ user, interactive: true });
541
- (0, globals_1.expect)(runres0.popup).toContain("/actions/fill-workflow-form/");
542
- (0, globals_1.expect)(runres0.popup).toContain("?resume=");
543
- (0, globals_1.expect)(wfrun.context.x).toBe(1);
544
- (0, globals_1.expect)(wfrun.status).toBe("Waiting");
545
- (0, globals_1.expect)(wfrun.wait_info).toStrictEqual({ form: true, user_id: 1 });
546
- await wfrun.provide_form_input({ name: "Tom" });
547
- const runres1 = await wfrun.run({
548
- user,
549
- interactive: true,
550
- });
551
- (0, globals_1.expect)(runres1.popup).toContain("/actions/fill-workflow-form/");
552
- (0, globals_1.expect)(runres1.popup).toContain("?resume=");
553
- (0, globals_1.expect)(wfrun.status).toBe("Waiting");
554
- (0, globals_1.expect)(wfrun.wait_info.output).toBe("hello Tom");
555
- (0, globals_1.expect)(wfrun.context.name).toBe("Tom");
556
- await wfrun.provide_form_input({});
557
- await wfrun.run({
558
- user,
559
- });
560
- (0, globals_1.expect)(wfrun.status).toBe("Finished");
561
- });
562
- (0, globals_1.it)("should skip form on only-if", async () => {
563
- const trigger = await trigger_1.default.create({
564
- action: "Workflow",
565
- when_trigger: "Never",
566
- name: "uformwf0",
567
- });
568
- await workflow_step_1.default.create({
569
- trigger_id: trigger.id,
570
- name: "first_step",
571
- next_step: "second_step",
572
- action_name: "run_js_code",
573
- initial_step: true,
574
- configuration: { code: `return {x:1}` },
575
- });
576
- await workflow_step_1.default.create({
577
- trigger_id: trigger.id,
578
- name: "second_step",
579
- next_step: "third",
580
- action_name: "UserForm",
581
- initial_step: false,
582
- only_if: "x>5",
583
- configuration: {
584
- form_header: "",
585
- user_id_expression: "",
586
- user_form_questions: [
587
- {
588
- label: "What is your name",
589
- qtype: "Free text",
590
- var_name: "name",
591
- },
592
- ],
593
- },
594
- });
595
- await workflow_step_1.default.create({
596
- trigger_id: trigger.id,
597
- name: "third",
598
- next_step: "",
599
- action_name: "run_js_code",
600
- initial_step: false,
601
- configuration: { code: `return {x:2}` },
602
- });
603
- const user = await user_1.default.findOne({ id: 1 });
604
- (0, assertions_1.assertIsSet)(user);
605
- const wfrun = await workflow_run_1.default.create({
606
- trigger_id: trigger.id,
607
- });
608
- await wfrun.run({ user });
609
- (0, globals_1.expect)(wfrun.context.x).toBe(2);
610
- (0, globals_1.expect)(wfrun.status).toBe("Finished");
611
- });
612
- });
613
- (0, globals_1.describe)("Workflow with notify in ForLoop", () => {
614
- (0, globals_1.it)("should create steps", async () => {
615
- const trigger = await trigger_1.default.create({
616
- action: "Workflow",
617
- when_trigger: "Never",
618
- name: "forloopnotifywf",
619
- });
620
- const trigger_id = trigger.id;
621
- await workflow_step_1.default.create({
622
- trigger_id,
623
- name: "set_xs",
624
- next_step: "loop",
625
- only_if: "",
626
- action_name: "SetContext",
627
- initial_step: true,
628
- configuration: {
629
- ctx_values: "{xs: [1,2,3,4,5,6,7,8,9]}",
630
- },
631
- });
632
- await workflow_step_1.default.create({
633
- trigger_id,
634
- name: "loop",
635
- next_step: "step5",
636
- only_if: "",
637
- action_name: "ForLoop",
638
- initial_step: false,
639
- configuration: {
640
- item_variable: "x",
641
- index_variable: "ix",
642
- array_expression: "xs",
643
- loop_body_initial_step: "step3",
644
- },
645
- });
646
- await workflow_step_1.default.create({
647
- name: "step3",
648
- trigger_id,
649
- next_step: "step4",
650
- only_if: "",
651
- action_name: "run_js_code",
652
- initial_step: false,
653
- configuration: {
654
- code: "let y = x+ix;\r\n\r\nawait sleep(100+y)",
655
- run_where: "Server",
656
- },
657
- });
658
- await workflow_step_1.default.create({
659
- name: "step4",
660
- trigger_id,
661
- next_step: "",
662
- only_if: "",
663
- action_name: "toast",
664
- initial_step: false,
665
- configuration: {
666
- text: "{{ix+1}}",
667
- title: "",
668
- notify_type: "Notify",
669
- remove_delay: 1,
670
- },
671
- });
672
- await workflow_step_1.default.create({
673
- name: "step5",
674
- trigger_id,
675
- next_step: "",
676
- only_if: "",
677
- action_name: "run_js_code",
678
- initial_step: false,
679
- configuration: {
680
- code: "1",
681
- run_where: "Server",
682
- },
683
- });
684
- });
685
- (0, globals_1.it)("should run interactively", async () => {
686
- const user = await user_1.default.findOne({ id: 1 });
687
- (0, assertions_1.assertIsSet)(user);
688
- const trigger = trigger_1.default.findOne({ name: "forloopnotifywf" });
689
- (0, assertions_1.assertIsSet)(trigger);
690
- const wfrun = await workflow_run_1.default.create({
691
- trigger_id: trigger.id,
692
- });
693
- const runres0 = await wfrun.run({ user, interactive: true });
694
- (0, globals_1.expect)(runres0.notify).toBe("1");
695
- (0, globals_1.expect)(runres0.resume_workflow).toBe(wfrun.id);
696
- (0, globals_1.expect)(wfrun.context.x).toBe(2);
697
- const runres1 = await wfrun.run({
698
- user,
699
- interactive: true,
700
- });
701
- (0, globals_1.expect)(runres1.notify).toBe("2");
702
- (0, globals_1.expect)(runres1.resume_workflow).toBe(wfrun.id);
703
- await wfrun.run({
704
- user,
705
- });
706
- (0, globals_1.expect)(wfrun.status).toBe("Finished");
707
- });
708
- });
709
- (0, globals_1.describe)("Workflow step operations", () => {
710
- (0, globals_1.it)("should generate a diagram", async () => {
711
- const trigger = await trigger_1.default.create({
712
- action: "Workflow",
713
- when_trigger: "Never",
714
- name: "diagramTrigger",
715
- });
716
- await workflow_step_1.default.create({
717
- trigger_id: trigger.id,
718
- name: "startStep",
719
- next_step: "endStep",
720
- action_name: "SetContext",
721
- initial_step: true,
722
- configuration: { ctx_values: "{x: 1}" },
723
- });
724
- await workflow_step_1.default.create({
725
- trigger_id: trigger.id,
726
- name: "endStep",
727
- initial_step: false,
728
- action_name: "SetContext",
729
- configuration: { ctx_values: "{y: 2}" },
730
- });
731
- const steps = await workflow_step_1.default.find({ trigger_id: trigger.id });
732
- const diagram = workflow_step_1.default.generate_diagram(steps);
733
- (0, globals_1.expect)(diagram).toContain("startStep");
734
- (0, globals_1.expect)(diagram).toContain("endStep");
735
- });
736
- (0, globals_1.it)("should handle delete with connect_prev_next", async () => {
737
- const trigger = await trigger_1.default.create({
738
- action: "Workflow",
739
- when_trigger: "Never",
740
- name: "deleteTrigger",
741
- });
742
- await workflow_step_1.default.create({
743
- trigger_id: trigger.id,
744
- name: "step1",
745
- next_step: "step2",
746
- action_name: "SetContext",
747
- initial_step: true,
748
- configuration: { ctx_values: "{x: 1}" },
749
- });
750
- await workflow_step_1.default.create({
751
- trigger_id: trigger.id,
752
- name: "step2",
753
- next_step: "step3",
754
- action_name: "SetContext",
755
- initial_step: false,
756
- configuration: { ctx_values: "{y: 2}" },
757
- });
758
- await workflow_step_1.default.create({
759
- trigger_id: trigger.id,
760
- name: "step3",
761
- action_name: "SetContext",
762
- initial_step: false,
763
- configuration: { ctx_values: "{z: 3}" },
764
- });
765
- const step2 = await workflow_step_1.default.findOne({ name: "step2" });
766
- (0, assertions_1.assertIsSet)(step2);
767
- await step2.delete(true);
768
- const updatedStep1 = await workflow_step_1.default.findOne({ name: "step1" });
769
- (0, assertions_1.assertIsSet)(updatedStep1);
770
- (0, globals_1.expect)(updatedStep1.next_step).toBe("step3");
771
- });
772
- (0, globals_1.it)("should find steps with specific conditions", async () => {
773
- const trigger = await trigger_1.default.create({
774
- action: "Workflow",
775
- when_trigger: "Never",
776
- name: "findTrigger",
777
- });
778
- await workflow_step_1.default.create({
779
- trigger_id: trigger.id,
780
- name: "findStep1",
781
- next_step: "findStep2",
782
- action_name: "SetContext",
783
- initial_step: true,
784
- configuration: { ctx_values: "{x: 1}" },
785
- });
786
- await workflow_step_1.default.create({
787
- trigger_id: trigger.id,
788
- name: "findStep2",
789
- action_name: "SetContext",
790
- initial_step: false,
791
- configuration: { ctx_values: "{y: 2}" },
792
- });
793
- const steps = await workflow_step_1.default.find({ trigger_id: trigger.id });
794
- (0, globals_1.expect)(steps.length).toBe(2);
795
- (0, globals_1.expect)(steps[0].name).toBe("findStep1");
796
- (0, globals_1.expect)(steps[1].name).toBe("findStep2");
797
- });
798
- // More tests for update, delete, and 'get diagram loop link backs'
799
- (0, globals_1.it)("should update a workflow steop", async () => {
800
- const trigger = await trigger_1.default.create({
801
- action: "Workflow",
802
- when_trigger: "Never",
803
- name: "updateTrigger",
804
- });
805
- const step = await workflow_step_1.default.create({
806
- trigger_id: trigger.id,
807
- name: "updateStep",
808
- next_step: "nextStep",
809
- action_name: "SetContext",
810
- initial_step: true,
811
- configuration: { ctx_values: "{x: 1}" },
812
- });
813
- const fetchedStep = await workflow_step_1.default.findOne({ name: "updateStep" });
814
- (0, assertions_1.assertIsSet)(fetchedStep);
815
- await fetchedStep.update({
816
- next_step: "updatedNextStep",
817
- });
818
- const updatedStep = await workflow_step_1.default.findOne({ name: "updateStep" });
819
- (0, assertions_1.assertIsSet)(updatedStep);
820
- (0, globals_1.expect)(updatedStep.next_step).toBe("updatedNextStep");
821
- });
822
- (0, globals_1.it)("should get diagram loop link backs", async () => {
823
- const trigger = await trigger_1.default.create({
824
- action: "Workflow",
825
- when_trigger: "Never",
826
- name: "loopTrigger",
827
- });
828
- await workflow_step_1.default.create({
829
- trigger_id: trigger.id,
830
- name: "forLoopStep",
831
- action_name: "ForLoop",
832
- initial_step: true,
833
- configuration: {
834
- loop_body_initial_step: "loopBodyStep",
835
- },
836
- });
837
- await workflow_step_1.default.create({
838
- trigger_id: trigger.id,
839
- name: "loopBodyStep",
840
- next_step: "endStep",
841
- action_name: "SetContext",
842
- initial_step: false,
843
- configuration: { ctx_values: `return {y: 2}` },
844
- });
845
- await workflow_step_1.default.create({
846
- trigger_id: trigger.id,
847
- name: "endStep",
848
- action_name: "SetContext",
849
- initial_step: false,
850
- configuration: { ctx_values: `return {z: 3}` },
851
- });
852
- const steps = await workflow_step_1.default.find({ trigger_id: trigger.id });
853
- const loopLinks = workflow_step_1.default.getDiagramLoopLinkBacks(steps);
854
- (0, globals_1.expect)(loopLinks["endStep"]).toBe("forLoopStep");
855
- });
856
- (0, globals_1.it)("should delet a workflow step and connect previous to next", async () => {
857
- const trigger = await trigger_1.default.create({
858
- action: "Workflow",
859
- when_trigger: "Never",
860
- name: "deleteConnectTrigger",
861
- });
862
- await workflow_step_1.default.create({
863
- trigger_id: trigger.id,
864
- name: "stepA",
865
- next_step: "stepB",
866
- action_name: "SetContext",
867
- initial_step: true,
868
- configuration: { ctx_values: "{x: 1}" },
869
- });
870
- await workflow_step_1.default.create({
871
- trigger_id: trigger.id,
872
- name: "stepB",
873
- next_step: "stepC",
874
- action_name: "SetContext",
875
- initial_step: false,
876
- configuration: { ctx_values: "{y: 2}" },
877
- });
878
- await workflow_step_1.default.create({
879
- trigger_id: trigger.id,
880
- name: "stepC",
881
- action_name: "SetContext",
882
- initial_step: false,
883
- configuration: { ctx_values: "{z: 3}" },
884
- });
885
- const stepB = await workflow_step_1.default.findOne({ name: "stepB" });
886
- (0, assertions_1.assertIsSet)(stepB);
887
- await stepB.delete(true);
888
- const updatedStepA = await workflow_step_1.default.findOne({ name: "stepA" });
889
- (0, assertions_1.assertIsSet)(updatedStepA);
890
- (0, globals_1.expect)(updatedStepA.next_step).toBe("stepC");
891
- });
892
- (0, globals_1.it)("should handle reserved names in mermaid diagram generation", async () => {
893
- const trigger = await trigger_1.default.create({
894
- action: "Workflow",
895
- when_trigger: "Never",
896
- name: "reservedNamesTrigger",
897
- });
898
- await workflow_step_1.default.create({
899
- trigger_id: trigger.id,
900
- name: "end",
901
- next_step: "subgraph",
902
- action_name: "SetContext",
903
- initial_step: true,
904
- configuration: { ctx_values: "{x: 1}" },
905
- });
906
- await workflow_step_1.default.create({
907
- trigger_id: trigger.id,
908
- name: "subgraph",
909
- action_name: "SetContext",
910
- initial_step: false,
911
- configuration: { ctx_values: "{y: 2}" },
912
- });
913
- const steps = await workflow_step_1.default.find({ trigger_id: trigger.id });
914
- const diagram = workflow_step_1.default.generate_diagram(steps);
915
- (0, globals_1.expect)(diagram).toContain("flowchart TD");
916
- (0, globals_1.expect)(diagram).toContain('_end_["`**end**\n SetContext`"]:::wfstep');
917
- (0, globals_1.expect)(diagram).toContain('_subgraph_["`**subgraph**\n SetContext`"]:::wfstep');
918
- (0, globals_1.expect)(diagram).toContain("_Start--");
919
- (0, globals_1.expect)(diagram).toContain("--> _End__subgraph_");
920
- });
921
- });
922
- //# sourceMappingURL=workflow_run.test.js.map