@ironcode/vas-lib 1.16.0 → 2.0.0

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 (94) hide show
  1. package/cjs/lib/controls-config/index.d.ts +3 -2
  2. package/cjs/lib/controls-config/index.d.ts.map +1 -1
  3. package/cjs/lib/controls-config/index.js +3 -2
  4. package/cjs/lib/controls-config/index.js.map +1 -1
  5. package/cjs/lib/controls-config/{vas-control-config.model.d.ts → vas-control-config.dto.d.ts} +2 -2
  6. package/cjs/lib/controls-config/vas-control-config.dto.d.ts.map +1 -0
  7. package/cjs/lib/controls-config/{vas-control-config.model.js → vas-control-config.dto.js} +1 -1
  8. package/cjs/lib/controls-config/vas-control-config.dto.js.map +1 -0
  9. package/cjs/lib/controls-config/vas-costs-control-config.dto.d.ts +9 -0
  10. package/cjs/lib/controls-config/vas-costs-control-config.dto.d.ts.map +1 -0
  11. package/cjs/lib/controls-config/{vas-select-control-config.model.js → vas-costs-control-config.dto.js} +1 -1
  12. package/cjs/lib/controls-config/vas-costs-control-config.dto.js.map +1 -0
  13. package/cjs/lib/controls-config/vas-select-control-config.dto.d.ts +10 -0
  14. package/cjs/lib/controls-config/vas-select-control-config.dto.d.ts.map +1 -0
  15. package/cjs/lib/controls-config/vas-select-control-config.dto.js +3 -0
  16. package/cjs/lib/controls-config/vas-select-control-config.dto.js.map +1 -0
  17. package/cjs/lib/entity/index.d.ts +10 -0
  18. package/cjs/lib/entity/index.d.ts.map +1 -1
  19. package/cjs/lib/entity/index.js +10 -0
  20. package/cjs/lib/entity/index.js.map +1 -1
  21. package/cjs/lib/entity/step-model.factory.d.ts +11 -0
  22. package/cjs/lib/entity/step-model.factory.d.ts.map +1 -0
  23. package/cjs/lib/entity/step-model.factory.js +41 -0
  24. package/cjs/lib/entity/step-model.factory.js.map +1 -0
  25. package/cjs/lib/entity/vas-job-action-controls-step.model.d.ts +34 -0
  26. package/cjs/lib/entity/vas-job-action-controls-step.model.d.ts.map +1 -0
  27. package/cjs/lib/entity/vas-job-action-controls-step.model.js +58 -0
  28. package/cjs/lib/entity/vas-job-action-controls-step.model.js.map +1 -0
  29. package/cjs/lib/entity/vas-job-action-email-form-step.model.d.ts +42 -0
  30. package/cjs/lib/entity/vas-job-action-email-form-step.model.d.ts.map +1 -0
  31. package/cjs/lib/entity/vas-job-action-email-form-step.model.js +66 -0
  32. package/cjs/lib/entity/vas-job-action-email-form-step.model.js.map +1 -0
  33. package/cjs/lib/entity/vas-job-action-instruction-step.model.d.ts +35 -0
  34. package/cjs/lib/entity/vas-job-action-instruction-step.model.d.ts.map +1 -0
  35. package/cjs/lib/entity/vas-job-action-instruction-step.model.js +60 -0
  36. package/cjs/lib/entity/vas-job-action-instruction-step.model.js.map +1 -0
  37. package/cjs/lib/entity/vas-job-action-note-prompt-step.model.d.ts +33 -0
  38. package/cjs/lib/entity/vas-job-action-note-prompt-step.model.d.ts.map +1 -0
  39. package/cjs/lib/entity/vas-job-action-note-prompt-step.model.js +56 -0
  40. package/cjs/lib/entity/vas-job-action-note-prompt-step.model.js.map +1 -0
  41. package/cjs/lib/entity/vas-job-action-set-datetime-step.model.d.ts +35 -0
  42. package/cjs/lib/entity/vas-job-action-set-datetime-step.model.d.ts.map +1 -0
  43. package/cjs/lib/entity/vas-job-action-set-datetime-step.model.js +60 -0
  44. package/cjs/lib/entity/vas-job-action-set-datetime-step.model.js.map +1 -0
  45. package/cjs/lib/entity/vas-job-action-set-job-status-step.model.d.ts +34 -0
  46. package/cjs/lib/entity/vas-job-action-set-job-status-step.model.d.ts.map +1 -0
  47. package/cjs/lib/entity/vas-job-action-set-job-status-step.model.js +58 -0
  48. package/cjs/lib/entity/vas-job-action-set-job-status-step.model.js.map +1 -0
  49. package/cjs/lib/entity/vas-job-action-set-value-step.model.d.ts +35 -0
  50. package/cjs/lib/entity/vas-job-action-set-value-step.model.d.ts.map +1 -0
  51. package/cjs/lib/entity/vas-job-action-set-value-step.model.js +60 -0
  52. package/cjs/lib/entity/vas-job-action-set-value-step.model.js.map +1 -0
  53. package/cjs/lib/entity/vas-job-action-step.model.d.ts +21 -0
  54. package/cjs/lib/entity/vas-job-action-step.model.d.ts.map +1 -0
  55. package/cjs/lib/entity/vas-job-action-step.model.js +25 -0
  56. package/cjs/lib/entity/vas-job-action-step.model.js.map +1 -0
  57. package/cjs/lib/entity/vas-job-action-webhook-step.model.d.ts +35 -0
  58. package/cjs/lib/entity/vas-job-action-webhook-step.model.d.ts.map +1 -0
  59. package/cjs/lib/entity/vas-job-action-webhook-step.model.js +60 -0
  60. package/cjs/lib/entity/vas-job-action-webhook-step.model.js.map +1 -0
  61. package/cjs/lib/entity/vas-job-action.dto.d.ts +10 -9
  62. package/cjs/lib/entity/vas-job-action.dto.d.ts.map +1 -1
  63. package/cjs/lib/entity/vas-job-action.dto.js +5 -1
  64. package/cjs/lib/entity/vas-job-action.dto.js.map +1 -1
  65. package/cjs/lib/entity/vas-job-action.model.d.ts +37 -0
  66. package/cjs/lib/entity/vas-job-action.model.d.ts.map +1 -0
  67. package/cjs/lib/entity/vas-job-action.model.js +63 -0
  68. package/cjs/lib/entity/vas-job-action.model.js.map +1 -0
  69. package/fesm2022/ironcode-vas-lib.mjs +712 -42
  70. package/fesm2022/ironcode-vas-lib.mjs.map +1 -1
  71. package/lib/controls-config/index.d.ts +3 -2
  72. package/lib/controls-config/{vas-control-config.model.d.ts → vas-control-config.dto.d.ts} +1 -1
  73. package/lib/controls-config/vas-costs-control-config.dto.d.ts +8 -0
  74. package/lib/controls-config/vas-select-control-config.dto.d.ts +9 -0
  75. package/lib/entity/index.d.ts +10 -0
  76. package/lib/entity/step-model.factory.d.ts +10 -0
  77. package/lib/entity/vas-job-action-controls-step.model.d.ts +33 -0
  78. package/lib/entity/vas-job-action-email-form-step.model.d.ts +41 -0
  79. package/lib/entity/vas-job-action-instruction-step.model.d.ts +34 -0
  80. package/lib/entity/vas-job-action-note-prompt-step.model.d.ts +32 -0
  81. package/lib/entity/vas-job-action-set-datetime-step.model.d.ts +34 -0
  82. package/lib/entity/vas-job-action-set-job-status-step.model.d.ts +33 -0
  83. package/lib/entity/vas-job-action-set-value-step.model.d.ts +34 -0
  84. package/lib/entity/vas-job-action-step.model.d.ts +20 -0
  85. package/lib/entity/vas-job-action-webhook-step.model.d.ts +34 -0
  86. package/lib/entity/vas-job-action.dto.d.ts +10 -9
  87. package/lib/entity/vas-job-action.model.d.ts +36 -0
  88. package/package.json +1 -1
  89. package/cjs/lib/controls-config/vas-control-config.model.d.ts.map +0 -1
  90. package/cjs/lib/controls-config/vas-control-config.model.js.map +0 -1
  91. package/cjs/lib/controls-config/vas-select-control-config.model.d.ts +0 -10
  92. package/cjs/lib/controls-config/vas-select-control-config.model.d.ts.map +0 -1
  93. package/cjs/lib/controls-config/vas-select-control-config.model.js.map +0 -1
  94. package/lib/controls-config/vas-select-control-config.model.d.ts +0 -9
@@ -17,10 +17,451 @@ var VasControlConfigDirection;
17
17
  VasControlConfigDirection[VasControlConfigDirection["COLUMN"] = 1] = "COLUMN";
18
18
  })(VasControlConfigDirection || (VasControlConfigDirection = {}));
19
19
 
20
+ /**
21
+ *
22
+ * @param step
23
+ * @deprecated use isJobWebhookStep
24
+ */
25
+ const isJobAutomationStep = (step) => {
26
+ return step && step.type === 'automation';
27
+ };
28
+ const isJobControlsStep = (step) => {
29
+ return step && step.type === 'controls';
30
+ };
31
+ const isJobEmailFormStep = (step) => {
32
+ return step && step.type === 'email-form';
33
+ };
34
+ const isJobInstructionStep = (step) => {
35
+ return step && step.type === 'instruction';
36
+ };
37
+ const isJobNotePromptStep = (step) => {
38
+ return step && step.type === 'note-prompt';
39
+ };
40
+ const isJobSetDatetimeStep = (step) => {
41
+ return step && step.type === 'set-datetime';
42
+ };
43
+ const isJobSetJobStatusStep = (step) => {
44
+ return step && step.type === 'set-job-status';
45
+ };
46
+ const isJobSetValueStep = (step) => {
47
+ return step && step.type === 'set-value';
48
+ };
49
+ const isJobWebhookStep = (step) => {
50
+ return step && step.type === 'webhook';
51
+ };
52
+
20
53
  /**
21
54
  * BaseEntityModel
22
55
  */
23
- class VasBaseModel {
56
+ class VasBaseModel {
57
+ id;
58
+ created;
59
+ serverCreated;
60
+ createdBy;
61
+ modified;
62
+ serverModified;
63
+ modifiedBy;
64
+ createdByName;
65
+ modifiedByName;
66
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName) {
67
+ this.id = id;
68
+ this.created = created;
69
+ this.serverCreated = serverCreated;
70
+ this.createdBy = createdBy;
71
+ this.modified = modified;
72
+ this.serverModified = serverModified;
73
+ this.modifiedBy = modifiedBy;
74
+ this.createdByName = createdByName;
75
+ this.modifiedByName = modifiedByName;
76
+ }
77
+ static fromDto(dto) {
78
+ return new VasBaseModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '');
79
+ }
80
+ static create(user, values = {}) {
81
+ return this.fromDto({
82
+ id: UUID.UUID(),
83
+ created: moment().toISOString(),
84
+ modified: moment().toISOString(),
85
+ createdBy: user?.id || '',
86
+ createdByName: user?.name || '',
87
+ modifiedBy: user?.id || '',
88
+ modifiedByName: user?.name || '',
89
+ ...values,
90
+ });
91
+ }
92
+ }
93
+
94
+ /**
95
+ * VasJobActionBaseStepModel
96
+ */
97
+ class VasJobActionStepModel extends VasBaseModel {
98
+ id;
99
+ created;
100
+ serverCreated;
101
+ createdBy;
102
+ modified;
103
+ serverModified;
104
+ modifiedBy;
105
+ createdByName;
106
+ modifiedByName;
107
+ type;
108
+ stage;
109
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage) {
110
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
111
+ this.id = id;
112
+ this.created = created;
113
+ this.serverCreated = serverCreated;
114
+ this.createdBy = createdBy;
115
+ this.modified = modified;
116
+ this.serverModified = serverModified;
117
+ this.modifiedBy = modifiedBy;
118
+ this.createdByName = createdByName;
119
+ this.modifiedByName = modifiedByName;
120
+ this.type = type;
121
+ this.stage = stage;
122
+ }
123
+ }
124
+
125
+ /**
126
+ * VasJobActionControlsStepModel
127
+ */
128
+ class VasJobActionControlsStepModel extends VasJobActionStepModel {
129
+ id;
130
+ created;
131
+ serverCreated;
132
+ createdBy;
133
+ modified;
134
+ serverModified;
135
+ modifiedBy;
136
+ createdByName;
137
+ modifiedByName;
138
+ type;
139
+ stage;
140
+ controlNames;
141
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage, controlNames) {
142
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage);
143
+ this.id = id;
144
+ this.created = created;
145
+ this.serverCreated = serverCreated;
146
+ this.createdBy = createdBy;
147
+ this.modified = modified;
148
+ this.serverModified = serverModified;
149
+ this.modifiedBy = modifiedBy;
150
+ this.createdByName = createdByName;
151
+ this.modifiedByName = modifiedByName;
152
+ this.type = type;
153
+ this.stage = stage;
154
+ this.controlNames = controlNames;
155
+ }
156
+ /**
157
+ * @return {VasJobActionControlsStepModel}
158
+ */
159
+ static empty() {
160
+ return new VasJobActionControlsStepModel('', '', '', '', '', '', '', '', '', 'controls', 'initializing', []);
161
+ }
162
+ /**
163
+ * @param {VasJobActionControlsStepDto} dto
164
+ * @return {VasJobActionControlsStepModel}
165
+ */
166
+ static fromDto(dto) {
167
+ return new VasJobActionControlsStepModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', 'controls', dto.stage || 'initializing', dto.controlNames || []);
168
+ }
169
+ /**
170
+ * @return {VasJobActionControlsStepDto}
171
+ */
172
+ toDto() {
173
+ return {
174
+ id: this.id,
175
+ created: this.created,
176
+ serverCreated: this.serverCreated,
177
+ createdBy: this.createdBy,
178
+ modified: this.modified,
179
+ serverModified: this.serverModified,
180
+ modifiedBy: this.modifiedBy,
181
+ createdByName: this.createdByName,
182
+ modifiedByName: this.modifiedByName,
183
+ type: this.type,
184
+ stage: this.stage,
185
+ controlNames: this.controlNames
186
+ };
187
+ }
188
+ }
189
+
190
+ /**
191
+ * VasJobActionEmailFormStepModel
192
+ */
193
+ class VasJobActionEmailFormStepModel extends VasJobActionStepModel {
194
+ id;
195
+ created;
196
+ serverCreated;
197
+ createdBy;
198
+ modified;
199
+ serverModified;
200
+ modifiedBy;
201
+ createdByName;
202
+ modifiedByName;
203
+ type;
204
+ stage;
205
+ params;
206
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage, params) {
207
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage);
208
+ this.id = id;
209
+ this.created = created;
210
+ this.serverCreated = serverCreated;
211
+ this.createdBy = createdBy;
212
+ this.modified = modified;
213
+ this.serverModified = serverModified;
214
+ this.modifiedBy = modifiedBy;
215
+ this.createdByName = createdByName;
216
+ this.modifiedByName = modifiedByName;
217
+ this.type = type;
218
+ this.stage = stage;
219
+ this.params = params;
220
+ }
221
+ /**
222
+ * @return {VasJobActionEmailFormStepModel}
223
+ */
224
+ static empty() {
225
+ return new VasJobActionEmailFormStepModel('', '', '', '', '', '', '', '', '', 'email-form', 'initializing', {
226
+ $recipients: [],
227
+ $subject: '',
228
+ $body: []
229
+ });
230
+ }
231
+ /**
232
+ * @param {VasJobActionEmailFormStepDto} dto
233
+ * @return {VasJobActionEmailFormStepModel}
234
+ */
235
+ static fromDto(dto) {
236
+ return new VasJobActionEmailFormStepModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', 'email-form', dto.stage || 'initializing', dto.params || {
237
+ $recipients: [],
238
+ $subject: '',
239
+ $body: []
240
+ });
241
+ }
242
+ /**
243
+ * @return {VasJobActionEmailFormStepDto}
244
+ */
245
+ toDto() {
246
+ return {
247
+ id: this.id,
248
+ created: this.created,
249
+ serverCreated: this.serverCreated,
250
+ createdBy: this.createdBy,
251
+ modified: this.modified,
252
+ serverModified: this.serverModified,
253
+ modifiedBy: this.modifiedBy,
254
+ createdByName: this.createdByName,
255
+ modifiedByName: this.modifiedByName,
256
+ type: this.type,
257
+ stage: this.stage,
258
+ params: this.params
259
+ };
260
+ }
261
+ }
262
+
263
+ /**
264
+ * VasJobActionInstructionStepModel
265
+ */
266
+ class VasJobActionInstructionStepModel extends VasJobActionStepModel {
267
+ id;
268
+ created;
269
+ serverCreated;
270
+ createdBy;
271
+ modified;
272
+ serverModified;
273
+ modifiedBy;
274
+ createdByName;
275
+ modifiedByName;
276
+ type;
277
+ stage;
278
+ instructionProviderId;
279
+ linkControl;
280
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage, instructionProviderId, linkControl) {
281
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage);
282
+ this.id = id;
283
+ this.created = created;
284
+ this.serverCreated = serverCreated;
285
+ this.createdBy = createdBy;
286
+ this.modified = modified;
287
+ this.serverModified = serverModified;
288
+ this.modifiedBy = modifiedBy;
289
+ this.createdByName = createdByName;
290
+ this.modifiedByName = modifiedByName;
291
+ this.type = type;
292
+ this.stage = stage;
293
+ this.instructionProviderId = instructionProviderId;
294
+ this.linkControl = linkControl;
295
+ }
296
+ /**
297
+ * @return {VasJobActionInstructionStepModel}
298
+ */
299
+ static empty() {
300
+ return new VasJobActionInstructionStepModel('', '', '', '', '', '', '', '', '', 'instruction', 'initializing', '', '');
301
+ }
302
+ /**
303
+ * @param {VasJobActionInstructionStepDto} dto
304
+ * @return {VasJobActionInstructionStepModel}
305
+ */
306
+ static fromDto(dto) {
307
+ return new VasJobActionInstructionStepModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', 'instruction', dto.stage || 'initializing', dto.instructionProviderId || '', dto.linkControl || '');
308
+ }
309
+ /**
310
+ * @return {VasJobActionInstructionStepDto}
311
+ */
312
+ toDto() {
313
+ return {
314
+ id: this.id,
315
+ created: this.created,
316
+ serverCreated: this.serverCreated,
317
+ createdBy: this.createdBy,
318
+ modified: this.modified,
319
+ serverModified: this.serverModified,
320
+ modifiedBy: this.modifiedBy,
321
+ createdByName: this.createdByName,
322
+ modifiedByName: this.modifiedByName,
323
+ type: this.type,
324
+ stage: this.stage,
325
+ instructionProviderId: this.instructionProviderId,
326
+ linkControl: this.linkControl
327
+ };
328
+ }
329
+ }
330
+
331
+ /**
332
+ * VasJobActionNotePromptStepModel
333
+ */
334
+ class VasJobActionNotePromptStepModel extends VasJobActionStepModel {
335
+ id;
336
+ created;
337
+ serverCreated;
338
+ createdBy;
339
+ modified;
340
+ serverModified;
341
+ modifiedBy;
342
+ createdByName;
343
+ modifiedByName;
344
+ type;
345
+ stage;
346
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage) {
347
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage);
348
+ this.id = id;
349
+ this.created = created;
350
+ this.serverCreated = serverCreated;
351
+ this.createdBy = createdBy;
352
+ this.modified = modified;
353
+ this.serverModified = serverModified;
354
+ this.modifiedBy = modifiedBy;
355
+ this.createdByName = createdByName;
356
+ this.modifiedByName = modifiedByName;
357
+ this.type = type;
358
+ this.stage = stage;
359
+ }
360
+ /**
361
+ * @return {VasJobActionNotePromptStepModel}
362
+ */
363
+ static empty() {
364
+ return new VasJobActionNotePromptStepModel('', '', '', '', '', '', '', '', '', 'note-prompt', 'initializing');
365
+ }
366
+ /**
367
+ * @param {VasJobActionNotePromptStepDto} dto
368
+ * @return {VasJobActionNotePromptStepModel}
369
+ */
370
+ static fromDto(dto) {
371
+ return new VasJobActionNotePromptStepModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', 'note-prompt', dto.stage || 'initializing');
372
+ }
373
+ /**
374
+ * @return {VasJobActionNotePromptStepDto}
375
+ */
376
+ toDto() {
377
+ return {
378
+ id: this.id,
379
+ created: this.created,
380
+ serverCreated: this.serverCreated,
381
+ createdBy: this.createdBy,
382
+ modified: this.modified,
383
+ serverModified: this.serverModified,
384
+ modifiedBy: this.modifiedBy,
385
+ createdByName: this.createdByName,
386
+ modifiedByName: this.modifiedByName,
387
+ type: this.type,
388
+ stage: this.stage
389
+ };
390
+ }
391
+ }
392
+
393
+ /**
394
+ * VasJobActionSetDatetimeStepModel
395
+ */
396
+ class VasJobActionSetDatetimeStepModel extends VasJobActionStepModel {
397
+ id;
398
+ created;
399
+ serverCreated;
400
+ createdBy;
401
+ modified;
402
+ serverModified;
403
+ modifiedBy;
404
+ createdByName;
405
+ modifiedByName;
406
+ type;
407
+ stage;
408
+ value;
409
+ controlName;
410
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage, value, controlName) {
411
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage);
412
+ this.id = id;
413
+ this.created = created;
414
+ this.serverCreated = serverCreated;
415
+ this.createdBy = createdBy;
416
+ this.modified = modified;
417
+ this.serverModified = serverModified;
418
+ this.modifiedBy = modifiedBy;
419
+ this.createdByName = createdByName;
420
+ this.modifiedByName = modifiedByName;
421
+ this.type = type;
422
+ this.stage = stage;
423
+ this.value = value;
424
+ this.controlName = controlName;
425
+ }
426
+ /**
427
+ * @return {VasJobActionSetDatetimeStepModel}
428
+ */
429
+ static empty() {
430
+ return new VasJobActionSetDatetimeStepModel('', '', '', '', '', '', '', '', '', 'set-datetime', 'initializing', '', '');
431
+ }
432
+ /**
433
+ * @param {VasJobActionSetDatetimeStepDto} dto
434
+ * @return {VasJobActionSetDatetimeStepModel}
435
+ */
436
+ static fromDto(dto) {
437
+ return new VasJobActionSetDatetimeStepModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', 'set-datetime', dto.stage || 'initializing', dto.value || '', dto.controlName || '');
438
+ }
439
+ /**
440
+ * @return {VasJobActionSetDatetimeStepDto}
441
+ */
442
+ toDto() {
443
+ return {
444
+ id: this.id,
445
+ created: this.created,
446
+ serverCreated: this.serverCreated,
447
+ createdBy: this.createdBy,
448
+ modified: this.modified,
449
+ serverModified: this.serverModified,
450
+ modifiedBy: this.modifiedBy,
451
+ createdByName: this.createdByName,
452
+ modifiedByName: this.modifiedByName,
453
+ type: this.type,
454
+ stage: this.stage,
455
+ value: this.value,
456
+ controlName: this.controlName
457
+ };
458
+ }
459
+ }
460
+
461
+ /**
462
+ * VasJobActionSetJobStatusStepModel
463
+ */
464
+ class VasJobActionSetJobStatusStepModel extends VasJobActionStepModel {
24
465
  id;
25
466
  created;
26
467
  serverCreated;
@@ -30,7 +471,11 @@ class VasBaseModel {
30
471
  modifiedBy;
31
472
  createdByName;
32
473
  modifiedByName;
33
- constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName) {
474
+ type;
475
+ stage;
476
+ value;
477
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage, value) {
478
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage);
34
479
  this.id = id;
35
480
  this.created = created;
36
481
  this.serverCreated = serverCreated;
@@ -40,24 +485,208 @@ class VasBaseModel {
40
485
  this.modifiedBy = modifiedBy;
41
486
  this.createdByName = createdByName;
42
487
  this.modifiedByName = modifiedByName;
488
+ this.type = type;
489
+ this.stage = stage;
490
+ this.value = value;
491
+ }
492
+ /**
493
+ * @return {VasJobActionSetJobStatusStepModel}
494
+ */
495
+ static empty() {
496
+ return new VasJobActionSetJobStatusStepModel('', '', '', '', '', '', '', '', '', 'set-job-status', 'initializing', '');
43
497
  }
498
+ /**
499
+ * @param {VasJobActionSetJobStatusStepDto} dto
500
+ * @return {VasJobActionSetJobStatusStepModel}
501
+ */
44
502
  static fromDto(dto) {
45
- return new VasBaseModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '');
503
+ return new VasJobActionSetJobStatusStepModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', 'set-job-status', dto.stage || 'initializing', dto.value || '');
46
504
  }
47
- static create(user, values = {}) {
48
- return this.fromDto({
49
- id: UUID.UUID(),
50
- created: moment().toISOString(),
51
- modified: moment().toISOString(),
52
- createdBy: user?.id || '',
53
- createdByName: user?.name || '',
54
- modifiedBy: user?.id || '',
55
- modifiedByName: user?.name || '',
56
- ...values,
57
- });
505
+ /**
506
+ * @return {VasJobActionSetJobStatusStepDto}
507
+ */
508
+ toDto() {
509
+ return {
510
+ id: this.id,
511
+ created: this.created,
512
+ serverCreated: this.serverCreated,
513
+ createdBy: this.createdBy,
514
+ modified: this.modified,
515
+ serverModified: this.serverModified,
516
+ modifiedBy: this.modifiedBy,
517
+ createdByName: this.createdByName,
518
+ modifiedByName: this.modifiedByName,
519
+ type: this.type,
520
+ stage: this.stage,
521
+ value: this.value
522
+ };
523
+ }
524
+ }
525
+
526
+ /**
527
+ * VasJobActionSetValueStepModel
528
+ */
529
+ class VasJobActionSetValueStepModel extends VasJobActionStepModel {
530
+ id;
531
+ created;
532
+ serverCreated;
533
+ createdBy;
534
+ modified;
535
+ serverModified;
536
+ modifiedBy;
537
+ createdByName;
538
+ modifiedByName;
539
+ type;
540
+ stage;
541
+ value;
542
+ controlName;
543
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage, value, controlName) {
544
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage);
545
+ this.id = id;
546
+ this.created = created;
547
+ this.serverCreated = serverCreated;
548
+ this.createdBy = createdBy;
549
+ this.modified = modified;
550
+ this.serverModified = serverModified;
551
+ this.modifiedBy = modifiedBy;
552
+ this.createdByName = createdByName;
553
+ this.modifiedByName = modifiedByName;
554
+ this.type = type;
555
+ this.stage = stage;
556
+ this.value = value;
557
+ this.controlName = controlName;
558
+ }
559
+ /**
560
+ * @return {VasJobActionSetValueStepModel}
561
+ */
562
+ static empty() {
563
+ return new VasJobActionSetValueStepModel('', '', '', '', '', '', '', '', '', 'set-value', 'initializing', '', '');
564
+ }
565
+ /**
566
+ * @param {VasJobActionSetValueStepDto} dto
567
+ * @return {VasJobActionSetValueStepModel}
568
+ */
569
+ static fromDto(dto) {
570
+ return new VasJobActionSetValueStepModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', 'set-value', dto.stage || 'initializing', dto.value || '', dto.controlName || '');
571
+ }
572
+ /**
573
+ * @return {VasJobActionSetValueStepDto}
574
+ */
575
+ toDto() {
576
+ return {
577
+ id: this.id,
578
+ created: this.created,
579
+ serverCreated: this.serverCreated,
580
+ createdBy: this.createdBy,
581
+ modified: this.modified,
582
+ serverModified: this.serverModified,
583
+ modifiedBy: this.modifiedBy,
584
+ createdByName: this.createdByName,
585
+ modifiedByName: this.modifiedByName,
586
+ type: this.type,
587
+ stage: this.stage,
588
+ value: this.value,
589
+ controlName: this.controlName
590
+ };
591
+ }
592
+ }
593
+
594
+ /**
595
+ * VasJobActionWebhookStepModel
596
+ */
597
+ class VasJobActionWebhookStepModel extends VasBaseModel {
598
+ id;
599
+ created;
600
+ serverCreated;
601
+ createdBy;
602
+ modified;
603
+ serverModified;
604
+ modifiedBy;
605
+ createdByName;
606
+ modifiedByName;
607
+ type;
608
+ stage;
609
+ url;
610
+ params;
611
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, type, stage, url, params) {
612
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
613
+ this.id = id;
614
+ this.created = created;
615
+ this.serverCreated = serverCreated;
616
+ this.createdBy = createdBy;
617
+ this.modified = modified;
618
+ this.serverModified = serverModified;
619
+ this.modifiedBy = modifiedBy;
620
+ this.createdByName = createdByName;
621
+ this.modifiedByName = modifiedByName;
622
+ this.type = type;
623
+ this.stage = stage;
624
+ this.url = url;
625
+ this.params = params;
626
+ }
627
+ /**
628
+ * @return {VasJobActionWebhookStepModel}
629
+ */
630
+ static empty() {
631
+ return new VasJobActionWebhookStepModel('', '', '', '', '', '', '', '', '', 'webhook', 'running', '', {});
632
+ }
633
+ /**
634
+ * @param {VasJobActionWebhookStepDto} dto
635
+ * @return {VasJobActionWebhookStepModel}
636
+ */
637
+ static fromDto(dto) {
638
+ return new VasJobActionWebhookStepModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', 'webhook', dto.stage || 'running', dto.url || '', dto.params || {});
639
+ }
640
+ /**
641
+ * @return {VasJobActionWebhookStepDto}
642
+ */
643
+ toDto() {
644
+ return {
645
+ id: this.id,
646
+ created: this.created,
647
+ serverCreated: this.serverCreated,
648
+ createdBy: this.createdBy,
649
+ modified: this.modified,
650
+ serverModified: this.serverModified,
651
+ modifiedBy: this.modifiedBy,
652
+ createdByName: this.createdByName,
653
+ modifiedByName: this.modifiedByName,
654
+ type: this.type,
655
+ stage: this.stage,
656
+ url: this.url,
657
+ params: this.params
658
+ };
58
659
  }
59
660
  }
60
661
 
662
+ const stepModelFactory = (dto) => {
663
+ if (isJobControlsStep(dto)) {
664
+ return VasJobActionControlsStepModel.fromDto(dto);
665
+ }
666
+ if (isJobEmailFormStep(dto)) {
667
+ return VasJobActionEmailFormStepModel.fromDto(dto);
668
+ }
669
+ if (isJobInstructionStep(dto)) {
670
+ return VasJobActionInstructionStepModel.fromDto(dto);
671
+ }
672
+ if (isJobNotePromptStep(dto)) {
673
+ return VasJobActionNotePromptStepModel.fromDto(dto);
674
+ }
675
+ if (isJobSetDatetimeStep(dto)) {
676
+ return VasJobActionSetDatetimeStepModel.fromDto(dto);
677
+ }
678
+ if (isJobSetJobStatusStep(dto)) {
679
+ return VasJobActionSetJobStatusStepModel.fromDto(dto);
680
+ }
681
+ if (isJobSetValueStep(dto)) {
682
+ return VasJobActionSetValueStepModel.fromDto(dto);
683
+ }
684
+ if (isJobWebhookStep(dto)) {
685
+ return VasJobActionWebhookStepModel.fromDto(dto);
686
+ }
687
+ throw new Error(`Unknown step type: ${dto.type}`);
688
+ };
689
+
61
690
  class VasAccountObjectModel extends VasBaseModel {
62
691
  id;
63
692
  created;
@@ -2096,34 +2725,75 @@ class VasInvitationModel extends VasAccountObjectModel {
2096
2725
  }
2097
2726
 
2098
2727
  /**
2099
- *
2100
- * @param step
2101
- * @deprecated use isJobWebhookStep
2728
+ * VasJobActionModel
2102
2729
  */
2103
- const isJobAutomationStep = (step) => {
2104
- return step && step.type === 'automation';
2105
- };
2106
- const isJobControlsStep = (step) => {
2107
- return step && step.type === 'controls';
2108
- };
2109
- const isJobEmailFormStep = (step) => {
2110
- return step && step.type === 'email-form';
2111
- };
2112
- const isJobNotePromptStep = (step) => {
2113
- return step && step.type === 'note-prompt';
2114
- };
2115
- const isJobSetDatetimeStep = (step) => {
2116
- return step && step.type === 'set-datetime';
2117
- };
2118
- const isJobSetJobStatusStep = (step) => {
2119
- return step && step.type === 'set-job-status';
2120
- };
2121
- const isJobSetValueStep = (step) => {
2122
- return step && step.type === 'set-value';
2123
- };
2124
- const isJobWebhookStep = (step) => {
2125
- return step && step.type === 'webhook';
2126
- };
2730
+ class VasJobActionModel extends VasBaseModel {
2731
+ id;
2732
+ created;
2733
+ serverCreated;
2734
+ createdBy;
2735
+ modified;
2736
+ serverModified;
2737
+ modifiedBy;
2738
+ createdByName;
2739
+ modifiedByName;
2740
+ title;
2741
+ steps;
2742
+ succeededControl;
2743
+ jobStatuses;
2744
+ context;
2745
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, title, steps, succeededControl, jobStatuses, context = 'job-form') {
2746
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
2747
+ this.id = id;
2748
+ this.created = created;
2749
+ this.serverCreated = serverCreated;
2750
+ this.createdBy = createdBy;
2751
+ this.modified = modified;
2752
+ this.serverModified = serverModified;
2753
+ this.modifiedBy = modifiedBy;
2754
+ this.createdByName = createdByName;
2755
+ this.modifiedByName = modifiedByName;
2756
+ this.title = title;
2757
+ this.steps = steps;
2758
+ this.succeededControl = succeededControl;
2759
+ this.jobStatuses = jobStatuses;
2760
+ this.context = context;
2761
+ }
2762
+ /**
2763
+ * @return {VasJobActionModel}
2764
+ */
2765
+ static empty() {
2766
+ return new VasJobActionModel('', '', '', '', '', '', '', '', '', '', [], undefined, [], 'job-form');
2767
+ }
2768
+ /**
2769
+ * @param {VasJobActionDto} dto
2770
+ * @return {VasJobActionModel}
2771
+ */
2772
+ static fromDto(dto) {
2773
+ return new VasJobActionModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.title || '', (dto.steps || []).map(dto => stepModelFactory(dto)), dto.succeededControl, dto.jobStatuses || [], dto.context || 'job-form');
2774
+ }
2775
+ /**
2776
+ * @return {VasJobActionDto}
2777
+ */
2778
+ toDto() {
2779
+ return {
2780
+ id: this.id,
2781
+ created: this.created,
2782
+ serverCreated: this.serverCreated,
2783
+ createdBy: this.createdBy,
2784
+ modified: this.modified,
2785
+ serverModified: this.serverModified,
2786
+ modifiedBy: this.modifiedBy,
2787
+ createdByName: this.createdByName,
2788
+ modifiedByName: this.modifiedByName,
2789
+ title: this.title,
2790
+ steps: this.steps.map(m => m.toDto()),
2791
+ succeededControl: this.succeededControl,
2792
+ jobStatuses: this.jobStatuses,
2793
+ context: this.context
2794
+ };
2795
+ }
2796
+ }
2127
2797
 
2128
2798
  class VasJobCopyModel {
2129
2799
  accessGroup;
@@ -3403,5 +4073,5 @@ class VasVehicleModel extends VasAccountObjectModel {
3403
4073
  * Generated bundle index. Do not edit.
3404
4074
  */
3405
4075
 
3406
- export { VasAccountIndexingMode, VasAccountObjectModel, VasBaseModel, VasBranchModel, VasContactModel, VasControlConfigDirection, VasControlModel, VasControlTypeModel, VasFieldModel, VasFileModel, VasFireUserModel, VasFormConfigModel, VasFormModel, VasGroupModel, VasInstructionJobFieldModel, VasInstructionJobModel, VasInstructionModel, VasInstructionProviderModel, VasInvitationModel, VasInvitationTypeEnum, VasJobCopyModel, VasJobDataModel, VasJobEmailModel, VasJobModel, VasJobStatusModel, VasLookupModel, VasMembershipModel, VasNoteModel, VasReportLayoutModel, VasReportModel, VasReportRequestModel, VasRestrictedAccountObjectModel, VasTaskModel, VasUserModel, VasVehicleModel, getEmptyGeoLocation, isCameraControlValueV1, isFileDto, isJobAutomationStep, isJobControlsStep, isJobEmailFormStep, isJobNotePromptStep, isJobSetDatetimeStep, isJobSetJobStatusStep, isJobSetValueStep, isJobWebhookStep, prepareFieldApiValue };
4076
+ export { VasAccountIndexingMode, VasAccountObjectModel, VasBaseModel, VasBranchModel, VasContactModel, VasControlConfigDirection, VasControlModel, VasControlTypeModel, VasFieldModel, VasFileModel, VasFireUserModel, VasFormConfigModel, VasFormModel, VasGroupModel, VasInstructionJobFieldModel, VasInstructionJobModel, VasInstructionModel, VasInstructionProviderModel, VasInvitationModel, VasInvitationTypeEnum, VasJobActionControlsStepModel, VasJobActionEmailFormStepModel, VasJobActionInstructionStepModel, VasJobActionModel, VasJobActionNotePromptStepModel, VasJobActionSetDatetimeStepModel, VasJobActionSetJobStatusStepModel, VasJobActionSetValueStepModel, VasJobActionWebhookStepModel, VasJobCopyModel, VasJobDataModel, VasJobEmailModel, VasJobModel, VasJobStatusModel, VasLookupModel, VasMembershipModel, VasNoteModel, VasReportLayoutModel, VasReportModel, VasReportRequestModel, VasRestrictedAccountObjectModel, VasTaskModel, VasUserModel, VasVehicleModel, getEmptyGeoLocation, isCameraControlValueV1, isFileDto, isJobAutomationStep, isJobControlsStep, isJobEmailFormStep, isJobInstructionStep, isJobNotePromptStep, isJobSetDatetimeStep, isJobSetJobStatusStep, isJobSetValueStep, isJobWebhookStep, prepareFieldApiValue, stepModelFactory };
3407
4077
  //# sourceMappingURL=ironcode-vas-lib.mjs.map