@ironcode/vas-lib 0.0.12 → 0.0.14

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 (76) hide show
  1. package/cjs/lib/entity/index.d.ts +4 -0
  2. package/cjs/lib/entity/index.d.ts.map +1 -1
  3. package/cjs/lib/entity/index.js +4 -0
  4. package/cjs/lib/entity/index.js.map +1 -1
  5. package/cjs/lib/entity/vas-account-config.dto.d.ts +2 -4
  6. package/cjs/lib/entity/vas-account-config.dto.d.ts.map +1 -1
  7. package/cjs/lib/entity/vas-account-config.dto.js.map +1 -1
  8. package/cjs/lib/entity/vas-account-object.model.d.ts +1 -0
  9. package/cjs/lib/entity/vas-account-object.model.d.ts.map +1 -1
  10. package/cjs/lib/entity/vas-account-object.model.js +7 -0
  11. package/cjs/lib/entity/vas-account-object.model.js.map +1 -1
  12. package/cjs/lib/entity/vas-field.dto.d.ts +1 -1
  13. package/cjs/lib/entity/vas-field.dto.js.map +1 -1
  14. package/cjs/lib/entity/vas-field.model.d.ts +44 -0
  15. package/cjs/lib/entity/vas-field.model.d.ts.map +1 -0
  16. package/cjs/lib/entity/vas-field.model.js +88 -0
  17. package/cjs/lib/entity/vas-field.model.js.map +1 -0
  18. package/cjs/lib/entity/vas-file.dto.d.ts +11 -7
  19. package/cjs/lib/entity/vas-file.dto.d.ts.map +1 -1
  20. package/cjs/lib/entity/vas-file.dto.js.map +1 -1
  21. package/cjs/lib/entity/vas-file.model.d.ts +37 -0
  22. package/cjs/lib/entity/vas-file.model.d.ts.map +1 -0
  23. package/cjs/lib/entity/vas-file.model.js +102 -0
  24. package/cjs/lib/entity/vas-file.model.js.map +1 -0
  25. package/cjs/lib/entity/vas-form.model.d.ts +5 -5
  26. package/cjs/lib/entity/vas-form.model.d.ts.map +1 -1
  27. package/cjs/lib/entity/vas-form.model.js +4 -4
  28. package/cjs/lib/entity/vas-form.model.js.map +1 -1
  29. package/cjs/lib/entity/vas-group.model.d.ts.map +1 -1
  30. package/cjs/lib/entity/vas-group.model.js +1 -0
  31. package/cjs/lib/entity/vas-group.model.js.map +1 -1
  32. package/cjs/lib/entity/vas-job-data.model.d.ts +28 -0
  33. package/cjs/lib/entity/vas-job-data.model.d.ts.map +1 -0
  34. package/cjs/lib/entity/vas-job-data.model.js +34 -0
  35. package/cjs/lib/entity/vas-job-data.model.js.map +1 -0
  36. package/cjs/lib/entity/vas-job.dto.d.ts +8 -2
  37. package/cjs/lib/entity/vas-job.dto.d.ts.map +1 -1
  38. package/cjs/lib/entity/vas-job.dto.js.map +1 -1
  39. package/cjs/lib/entity/vas-job.model.d.ts +105 -10
  40. package/cjs/lib/entity/vas-job.model.d.ts.map +1 -1
  41. package/cjs/lib/entity/vas-job.model.js +139 -9
  42. package/cjs/lib/entity/vas-job.model.js.map +1 -1
  43. package/cjs/lib/entity/vas-report-layout.model.d.ts +18 -0
  44. package/cjs/lib/entity/vas-report-layout.model.d.ts.map +1 -0
  45. package/cjs/lib/entity/vas-report-layout.model.js +24 -0
  46. package/cjs/lib/entity/vas-report-layout.model.js.map +1 -0
  47. package/esm2020/lib/entity/index.mjs +5 -1
  48. package/esm2020/lib/entity/vas-account-config.dto.mjs +1 -1
  49. package/esm2020/lib/entity/vas-account-object.model.mjs +8 -1
  50. package/esm2020/lib/entity/vas-field.dto.mjs +1 -1
  51. package/esm2020/lib/entity/vas-field.model.mjs +88 -0
  52. package/esm2020/lib/entity/vas-file.dto.mjs +1 -1
  53. package/esm2020/lib/entity/vas-file.model.mjs +104 -0
  54. package/esm2020/lib/entity/vas-form.model.mjs +5 -5
  55. package/esm2020/lib/entity/vas-group.model.mjs +2 -1
  56. package/esm2020/lib/entity/vas-job-data.model.mjs +30 -0
  57. package/esm2020/lib/entity/vas-job.dto.mjs +1 -1
  58. package/esm2020/lib/entity/vas-job.model.mjs +150 -10
  59. package/esm2020/lib/entity/vas-report-layout.model.mjs +20 -0
  60. package/fesm2015/ironcode-vas-lib.mjs +374 -11
  61. package/fesm2015/ironcode-vas-lib.mjs.map +1 -1
  62. package/fesm2020/ironcode-vas-lib.mjs +394 -11
  63. package/fesm2020/ironcode-vas-lib.mjs.map +1 -1
  64. package/lib/entity/index.d.ts +4 -0
  65. package/lib/entity/vas-account-config.dto.d.ts +2 -4
  66. package/lib/entity/vas-account-object.model.d.ts +1 -0
  67. package/lib/entity/vas-field.dto.d.ts +1 -1
  68. package/lib/entity/vas-field.model.d.ts +43 -0
  69. package/lib/entity/vas-file.dto.d.ts +11 -7
  70. package/lib/entity/vas-file.model.d.ts +36 -0
  71. package/lib/entity/vas-form.model.d.ts +5 -5
  72. package/lib/entity/vas-job-data.model.d.ts +27 -0
  73. package/lib/entity/vas-job.dto.d.ts +8 -2
  74. package/lib/entity/vas-job.model.d.ts +105 -10
  75. package/lib/entity/vas-report-layout.model.d.ts +17 -0
  76. package/package.json +2 -3
@@ -45,6 +45,13 @@ class VasAccountObjectModel extends VasBaseModel {
45
45
  this.modifiedBy = modifiedBy;
46
46
  this.account = account;
47
47
  }
48
+ toApiDto() {
49
+ return {
50
+ id: this.id,
51
+ created: this.created,
52
+ modified: this.modified
53
+ };
54
+ }
48
55
  }
49
56
 
50
57
  class VasRestrictedAccountObjectModel extends VasAccountObjectModel {
@@ -367,6 +374,223 @@ class VasControlTypeModel extends VasBaseModel {
367
374
  }
368
375
  }
369
376
 
377
+ /**
378
+ * VasJobDataModel
379
+ */
380
+ class VasJobDataModel extends VasAccountObjectModel {
381
+ /**
382
+ * @param {string} id
383
+ * @param {string} created
384
+ * @param {string} serverCreated
385
+ * @param {string} createdBy
386
+ * @param {string} modified
387
+ * @param {string} serverModified
388
+ * @param {string} modifiedBy
389
+ * @param {string} account
390
+ * @param {string} job
391
+ */
392
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, job) {
393
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account);
394
+ this.id = id;
395
+ this.created = created;
396
+ this.serverCreated = serverCreated;
397
+ this.createdBy = createdBy;
398
+ this.modified = modified;
399
+ this.serverModified = serverModified;
400
+ this.modifiedBy = modifiedBy;
401
+ this.account = account;
402
+ this.job = job;
403
+ }
404
+ }
405
+
406
+ /**
407
+ * VasFieldModel
408
+ */
409
+ class VasFieldModel extends VasJobDataModel {
410
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, job, control, fieldJobPointers, value, version) {
411
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, job);
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.account = account;
420
+ this.job = job;
421
+ this.control = control;
422
+ this.fieldJobPointers = fieldJobPointers;
423
+ this.value = value;
424
+ this.version = version;
425
+ }
426
+ /**
427
+ * @param {VasFieldDto} fieldDto
428
+ * @return {VasFieldModel}
429
+ */
430
+ static fromDto(fieldDto) {
431
+ return new VasFieldModel(fieldDto.id || UUID.UUID(), fieldDto.created || '', fieldDto.serverCreated || '', fieldDto.createdBy || '', fieldDto.modified || '', fieldDto.serverModified || '', fieldDto.modifiedBy || '', fieldDto.account || '', fieldDto.job || '', fieldDto.control || '', fieldDto.fieldJobPointers || [], fieldDto.value || '', fieldDto.version || 0);
432
+ }
433
+ /**
434
+ * @return {VasFieldDto}
435
+ */
436
+ toDto() {
437
+ return {
438
+ id: this.id,
439
+ created: this.created,
440
+ serverCreated: this.serverCreated,
441
+ createdBy: this.createdBy,
442
+ modified: this.modified,
443
+ serverModified: this.serverModified,
444
+ modifiedBy: this.modifiedBy,
445
+ account: this.account,
446
+ job: this.job,
447
+ control: this.control,
448
+ fieldJobPointers: this.fieldJobPointers,
449
+ value: this.value,
450
+ version: this.version,
451
+ };
452
+ }
453
+ /**
454
+ * @return {object}
455
+ */
456
+ toApiDto() {
457
+ return {
458
+ ...super.toApiDto(),
459
+ control: this.control,
460
+ value: this.prepareApiValue(this.value)
461
+ };
462
+ }
463
+ /**
464
+ * Prepares the value to be sent to the API. The api will only accept strings,
465
+ * numbers and booleans, thus if we have an array or object, we need to JSON
466
+ * encode it
467
+ * @param {VasFieldDto} value
468
+ * @return {string | number | boolean}
469
+ * @protected
470
+ */
471
+ prepareApiValue(value) {
472
+ switch (typeof value) {
473
+ case 'object': {
474
+ return JSON.stringify(value);
475
+ }
476
+ case 'boolean': {
477
+ return value;
478
+ }
479
+ case 'string': {
480
+ return value;
481
+ }
482
+ case 'number': {
483
+ return value;
484
+ }
485
+ default: {
486
+ return '';
487
+ }
488
+ }
489
+ }
490
+ }
491
+
492
+ /**
493
+ * VasFileDto
494
+ */
495
+ class VasFileModel extends VasJobDataModel {
496
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, job, name, fileSize, mimeType, sequence, config, url) {
497
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, job);
498
+ this.id = id;
499
+ this.created = created;
500
+ this.serverCreated = serverCreated;
501
+ this.createdBy = createdBy;
502
+ this.modified = modified;
503
+ this.serverModified = serverModified;
504
+ this.modifiedBy = modifiedBy;
505
+ this.account = account;
506
+ this.job = job;
507
+ this.name = name;
508
+ this.fileSize = fileSize;
509
+ this.mimeType = mimeType;
510
+ this.sequence = sequence;
511
+ this.config = config;
512
+ this.url = url;
513
+ }
514
+ /**
515
+ * @param {VasFieldDto} fileDto
516
+ * @return {VasFieldModel}
517
+ */
518
+ static fromDto(fileDto) {
519
+ return new VasFileModel(fileDto.id || UUID.UUID(), fileDto.created || '', fileDto.serverCreated || '', fileDto.createdBy || '', fileDto.modified || '', fileDto.serverModified || '', fileDto.modifiedBy || '', fileDto.account || '', fileDto.job || '', fileDto.name || '', fileDto.fileSize || 0, fileDto.mimeType || '', fileDto.sequence || 0, VasFileModel.parseConfig(fileDto.config), fileDto.url || '');
520
+ }
521
+ static parseConfig(config = '') {
522
+ try {
523
+ return JSON.parse(config);
524
+ }
525
+ catch (e) {
526
+ return {
527
+ displayAs: '',
528
+ embedLink: false,
529
+ group: 'photo',
530
+ description: '',
531
+ displayedName: '',
532
+ rotation: 0
533
+ };
534
+ }
535
+ }
536
+ /**
537
+ * @return {VasFileDto}
538
+ */
539
+ toDto() {
540
+ return {
541
+ id: this.id,
542
+ created: this.created,
543
+ serverCreated: this.serverCreated,
544
+ createdBy: this.createdBy,
545
+ modified: this.modified,
546
+ serverModified: this.serverModified,
547
+ modifiedBy: this.modifiedBy,
548
+ account: this.account,
549
+ job: this.job,
550
+ name: this.name,
551
+ fileSize: this.fileSize,
552
+ mimeType: this.mimeType,
553
+ sequence: this.sequence,
554
+ config: this.stringifyConfig(this.config),
555
+ url: this.url,
556
+ };
557
+ }
558
+ stringifyConfig(config) {
559
+ if (!config) {
560
+ return JSON.stringify({
561
+ displayAs: '',
562
+ embedLink: false,
563
+ group: 'photo',
564
+ description: '',
565
+ displayedName: '',
566
+ rotation: 0
567
+ });
568
+ }
569
+ try {
570
+ return JSON.stringify(config);
571
+ }
572
+ catch (e) {
573
+ console.warn(e);
574
+ return '';
575
+ }
576
+ }
577
+ toApiDto() {
578
+ return {
579
+ ...super.toApiDto(),
580
+ name: this.name || '~',
581
+ mimeType: this.mimeType || '~',
582
+ sequence: this.safeNumber(this.sequence),
583
+ config: JSON.stringify(this.config)
584
+ };
585
+ }
586
+ safeNumber(value) {
587
+ if (!Number.isFinite(value)) {
588
+ return 0;
589
+ }
590
+ return value;
591
+ }
592
+ }
593
+
370
594
  /**
371
595
  * GroupModel
372
596
  */
@@ -422,6 +646,7 @@ class VasGroupModel extends VasBaseModel {
422
646
  return new VasGroupModel(
423
647
  // eslint-disable-next-line new-cap
424
648
  dto.id || UUID.UUID(), dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.account || '', dto.accessGroup || '', dto.name || '', dto.title || '', dto.description || '', dto.sequence || 0, dto.includeInSummary || false, dto.forms || [], dto.visibilityControl || '', dto.visibleIfEquals || '', (dto.controls || [])
649
+ .filter(control => control.name.startsWith('fields.'))
425
650
  .sort((a, b) => a.sequence - b.sequence)
426
651
  .map(c => VasControlModel.fromDto(c)), dto.scoreWeight || 1);
427
652
  }
@@ -472,7 +697,7 @@ class VasGroupModel extends VasBaseModel {
472
697
  /**
473
698
  * VasFormModel
474
699
  */
475
- class VasFormModel extends VasBaseModel {
700
+ class VasFormModel extends VasRestrictedAccountObjectModel {
476
701
  /**
477
702
  * @param {string} id
478
703
  * @param {string} created
@@ -493,7 +718,7 @@ class VasFormModel extends VasBaseModel {
493
718
  * @param {string} config
494
719
  */
495
720
  constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, jobType, title, description, groups, dynamicDescriptor, indexName, pipelineName, config) {
496
- super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
721
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup);
497
722
  this.id = id;
498
723
  this.created = created;
499
724
  this.serverCreated = serverCreated;
@@ -729,7 +954,7 @@ const getValueByPath = (path, object) => {
729
954
  /**
730
955
  * JobModel
731
956
  */
732
- class VasJobModel extends VasBaseModel {
957
+ class VasJobModel extends VasRestrictedAccountObjectModel {
733
958
  /**
734
959
  * @param {string} id
735
960
  * @param {string} created
@@ -744,12 +969,17 @@ class VasJobModel extends VasBaseModel {
744
969
  * @param {string} jobDate
745
970
  * @param {string} jobStatus
746
971
  * @param {string} jobType
747
- * @param {string} assignee
972
+ * @param {string} assigneeId
748
973
  * @param {string} formId
749
974
  * @param {number} timeZoneOffset
975
+ * @param {number} pendingFields
976
+ * @param {string} childModified
977
+ * @param {number} version
978
+ * @param {Array<VasFieldDto>} fields
979
+ * @param {Array<VasFileDto>} files
750
980
  */
751
- constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, reference, jobDate, jobStatus, jobType, assignee, formId, timeZoneOffset) {
752
- super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
981
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, reference, jobDate, jobStatus, jobType, assigneeId, formId, timeZoneOffset, pendingFields, childModified, version, fields, files) {
982
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup);
753
983
  this.id = id;
754
984
  this.created = created;
755
985
  this.serverCreated = serverCreated;
@@ -763,9 +993,14 @@ class VasJobModel extends VasBaseModel {
763
993
  this.jobDate = jobDate;
764
994
  this.jobStatus = jobStatus;
765
995
  this.jobType = jobType;
766
- this.assignee = assignee;
996
+ this.assigneeId = assigneeId;
767
997
  this.formId = formId;
768
998
  this.timeZoneOffset = timeZoneOffset;
999
+ this.pendingFields = pendingFields;
1000
+ this.childModified = childModified;
1001
+ this.version = version;
1002
+ this.fields = fields;
1003
+ this.files = files;
769
1004
  }
770
1005
  /**
771
1006
  * Returns this with the dynamic interface
@@ -797,7 +1032,7 @@ class VasJobModel extends VasBaseModel {
797
1032
  static empty() {
798
1033
  return new VasJobModel(
799
1034
  // eslint-disable-next-line new-cap
800
- UUID.UUID(), '', '', '', '', '', '', '', '', '', '', '', '', '', '', moment().utcOffset());
1035
+ UUID.UUID(), '', '', '', '', '', '', '', '', '', '', '', '', '', '', moment().utcOffset(), 0, '', 0, [], []);
801
1036
  }
802
1037
  /**
803
1038
  * @param {VasJobDto} jobDto
@@ -806,7 +1041,7 @@ class VasJobModel extends VasBaseModel {
806
1041
  static fromDto(jobDto) {
807
1042
  const model = new VasJobModel(
808
1043
  // eslint-disable-next-line new-cap
809
- jobDto.id || UUID.UUID(), jobDto.created || '', jobDto.serverCreated || '', jobDto.createdBy || '', jobDto.modified || '', jobDto.serverModified || '', jobDto.modifiedBy || '', jobDto.account || '', jobDto.accessGroup || '', jobDto.reference || '', jobDto.jobDate || '', jobDto.jobStatus || '', jobDto.jobType || '', jobDto.assignee || '', jobDto.formId || '', jobDto.timeZoneOffset || moment().utcOffset());
1044
+ jobDto.id || UUID.UUID(), jobDto.created || '', jobDto.serverCreated || '', jobDto.createdBy || '', jobDto.modified || '', jobDto.serverModified || '', jobDto.modifiedBy || '', jobDto.account || '', jobDto.accessGroup || '', jobDto.reference || '', jobDto.jobDate || '', jobDto.jobStatus || '', jobDto.jobType || '', jobDto.assigneeId || '', jobDto.formId || '', jobDto.timeZoneOffset || moment().utcOffset(), jobDto.pendingFields || 0, jobDto.childModified || '', jobDto.version || 0, jobDto.fields || [], jobDto.files || []);
810
1045
  const emptyKeys = model.staticProperties;
811
1046
  Object
812
1047
  .keys(jobDto)
@@ -850,6 +1085,114 @@ class VasJobModel extends VasBaseModel {
850
1085
  }, {});
851
1086
  return fields;
852
1087
  }
1088
+ /**
1089
+ * This method will hydrate the `fields` property of the model. The reason for
1090
+ * this is that we have different ways to store the field data. One way, is
1091
+ * we store them as dynamic properties of the job. For example job.foo.bar,
1092
+ * where `foo` is the name of a Group, and `bar` is the name of a control.
1093
+ * Thus, when we create a job using a form in the client, the job object will
1094
+ * have its static properties (id, account, reference etc), and also a number
1095
+ * of dynamic properties determined by the Groups and Controls. This kind of
1096
+ * object is nice to work with in certain circumstances. However, the api
1097
+ * works differently. In the API a Job is a record, and references a number of
1098
+ * Field records. Each Field stores the value. Comparing these two models we
1099
+ * have:
1100
+ * A) job with dynamic properties, e.g.
1101
+ * {
1102
+ * id: <guid>,
1103
+ * reference: "something"
1104
+ * <other static job properties>...
1105
+ * foo: {
1106
+ * bar: "value"
1107
+ * }
1108
+ * }
1109
+ *
1110
+ * B) job with fields
1111
+ * {
1112
+ * id: <guid>,
1113
+ * reference: "something"
1114
+ * <other static job properties>...
1115
+ * <will not have dynamic properties>...
1116
+ * fields: [
1117
+ * {
1118
+ * id: <guid>,
1119
+ * <other field properties>,
1120
+ * value: "value"
1121
+ * }
1122
+ * ]
1123
+ * }
1124
+ *
1125
+ * So, what this method does is given a JobModel in the form of A, read all
1126
+ * of those dynamic properties and set them into `fields`. Doing this requires
1127
+ * knowledge of the Form that was used to create the job. Moreover, since the
1128
+ * dynamic properties do not contain the ids of the fields, we also allow to
1129
+ * pass in a `controlFieldIdMap`. This map stores the mapping between Control
1130
+ * and the Field that was created in the Job to store the value for that
1131
+ * Control. This is useful, if for example you want to compare a Job in form A
1132
+ * with a Job in form B, for example if you want to update the Job on the API
1133
+ * with a Job that was saved by a client in form A.
1134
+ *
1135
+ * E.g.
1136
+ * Client -> API: client requests form
1137
+ * User -> Client: user fills in the form and submits
1138
+ * Client -> Firestore: client saves the Job in form A i.e. dynamic props
1139
+ * Firestore -> Function: A function is triggered to sync the job to the API
1140
+ * Function -> API: Function checks if job already exists, it receives 404
1141
+ * Function -> Function: The function calls `hydrateFields(...)`
1142
+ * Function -> API: The function POST the Job to /jobs
1143
+ * Function -> API: The function POST each field to /fields
1144
+ *
1145
+ * Similarly, if the user updates the job
1146
+ * Client -> API: client requests form
1147
+ * User -> Client: user fills in the form and submits an update
1148
+ * Client -> Firestore: client saves the Job in form A i.e. dynamic props
1149
+ * Firestore -> Function: A function is triggered to sync the job to the API
1150
+ * Function -> API: Function checks if job already exists, it receives 200
1151
+ * Function -> Function: The function calls `hydrateFields(...)` passing in
1152
+ * the map is made by iterating over the fields it
1153
+ * received from the API and storing the mappings
1154
+ * between controlId and fieldId for each field
1155
+ * Function -> API: The function PATCH the Job to /jobs
1156
+ * Function -> API: The function POST/PATCH each field to /fields
1157
+ * treated as new
1158
+ *
1159
+ * @param {VasFormModel} formModel the VasFormModel that was used to create
1160
+ * the job
1161
+ * @param {Map<string, string>} controlFieldIdMap a mapping of control to
1162
+ * field ids. This is used to determine whether a new id for the field should
1163
+ * be generated, or to reuse an existing one from the map.
1164
+ * @param {Array<string>} controlNames if a value is provided, it will be used
1165
+ * to filter the fields that are returned.
1166
+ * @return {Array<VasFieldDto>}
1167
+ */
1168
+ hydrateFields(formModel, controlFieldIdMap = new Map(), controlNames) {
1169
+ const fields = [];
1170
+ formModel.groups
1171
+ .forEach(group => {
1172
+ group.controls.forEach(control => {
1173
+ if (!control.name.startsWith('fields.')) {
1174
+ return;
1175
+ }
1176
+ if (controlNames && !controlNames.includes(control.name)) {
1177
+ return;
1178
+ }
1179
+ fields.push(VasFieldModel.fromDto({
1180
+ // if the controlId exists in the map, use the associated fieldId,
1181
+ // otherwise generate a new id for the field.
1182
+ id: controlFieldIdMap.get(control.id) || UUID.UUID(),
1183
+ account: this.account,
1184
+ job: this.id,
1185
+ createdBy: this.createdBy,
1186
+ created: this.created,
1187
+ modifiedBy: this.modifiedBy,
1188
+ modified: this.modified,
1189
+ control: control.id,
1190
+ value: this.getValueByPath([group.name, control.name])
1191
+ }));
1192
+ });
1193
+ });
1194
+ this.fields = fields;
1195
+ }
853
1196
  /**
854
1197
 
855
1198
  * @param {string[]} path path segments
@@ -920,9 +1263,14 @@ class VasJobModel extends VasBaseModel {
920
1263
  jobDate: this.jobDate,
921
1264
  jobStatus: this.jobStatus,
922
1265
  jobType: this.jobType,
923
- assignee: this.assignee,
1266
+ assigneeId: this.assigneeId,
924
1267
  formId: this.formId,
925
1268
  timeZoneOffset: this.timeZoneOffset,
1269
+ pendingFields: this.pendingFields,
1270
+ childModified: this.childModified,
1271
+ version: this.version,
1272
+ fields: this.fields,
1273
+ files: this.files
926
1274
  };
927
1275
  }
928
1276
  const dto = {};
@@ -1025,6 +1373,41 @@ class VasJobModel extends VasBaseModel {
1025
1373
  }).trim();
1026
1374
  }
1027
1375
  ;
1376
+ /**
1377
+ * @return {object}
1378
+ */
1379
+ toApiDto() {
1380
+ return {
1381
+ ...super.toApiDto(),
1382
+ reference: this.reference || '~',
1383
+ jobDate: this.jobDate || '~',
1384
+ jobType: this.jobType || '~',
1385
+ accessGroup: this.accessGroup || '~',
1386
+ jobStatus: this.jobStatus || '~',
1387
+ assigneeId: this.assigneeId || '~',
1388
+ timeZoneOffset: this.timeZoneOffset || 0,
1389
+ pendingFields: this.pendingFields || 0,
1390
+ };
1391
+ }
1392
+ }
1393
+
1394
+ class VasReportLayoutModel extends VasRestrictedAccountObjectModel {
1395
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, jobType, title, description, entryPoint) {
1396
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup);
1397
+ this.id = id;
1398
+ this.created = created;
1399
+ this.serverCreated = serverCreated;
1400
+ this.createdBy = createdBy;
1401
+ this.modified = modified;
1402
+ this.serverModified = serverModified;
1403
+ this.modifiedBy = modifiedBy;
1404
+ this.account = account;
1405
+ this.accessGroup = accessGroup;
1406
+ this.jobType = jobType;
1407
+ this.title = title;
1408
+ this.description = description;
1409
+ this.entryPoint = entryPoint;
1410
+ }
1028
1411
  }
1029
1412
 
1030
1413
  class VasReportRequestModel extends VasBaseModel {
@@ -1112,5 +1495,5 @@ class VasUserModel extends VasBaseModel {
1112
1495
  * Generated bundle index. Do not edit.
1113
1496
  */
1114
1497
 
1115
- export { VasAccountObjectModel, VasBaseModel, VasBranchModel, VasContactModel, VasControlConfigDirection, VasControlModel, VasControlTypeModel, VasFormModel, VasGroupModel, VasJobModel, VasReportRequestModel, VasRestrictedAccountObjectModel, VasUserModel };
1498
+ export { VasAccountObjectModel, VasBaseModel, VasBranchModel, VasContactModel, VasControlConfigDirection, VasControlModel, VasControlTypeModel, VasFieldModel, VasFileModel, VasFormModel, VasGroupModel, VasJobDataModel, VasJobModel, VasReportLayoutModel, VasReportRequestModel, VasRestrictedAccountObjectModel, VasUserModel };
1116
1499
  //# sourceMappingURL=ironcode-vas-lib.mjs.map