@ironcode/vas-lib 0.0.12 → 0.0.15

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,213 @@ 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 Object.assign(Object.assign({}, super.toApiDto()), { control: this.control, value: this.prepareApiValue(this.value) });
458
+ }
459
+ /**
460
+ * Prepares the value to be sent to the API. The api will only accept strings,
461
+ * numbers and booleans, thus if we have an array or object, we need to JSON
462
+ * encode it
463
+ * @param {VasFieldDto} value
464
+ * @return {string | number | boolean}
465
+ * @protected
466
+ */
467
+ prepareApiValue(value) {
468
+ switch (typeof value) {
469
+ case 'object': {
470
+ return JSON.stringify(value);
471
+ }
472
+ case 'boolean': {
473
+ return value;
474
+ }
475
+ case 'string': {
476
+ return value;
477
+ }
478
+ case 'number': {
479
+ return value;
480
+ }
481
+ default: {
482
+ return '';
483
+ }
484
+ }
485
+ }
486
+ }
487
+
488
+ /**
489
+ * VasFileDto
490
+ */
491
+ class VasFileModel extends VasJobDataModel {
492
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, job, name, fileSize, mimeType, sequence, config, url) {
493
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, job);
494
+ this.id = id;
495
+ this.created = created;
496
+ this.serverCreated = serverCreated;
497
+ this.createdBy = createdBy;
498
+ this.modified = modified;
499
+ this.serverModified = serverModified;
500
+ this.modifiedBy = modifiedBy;
501
+ this.account = account;
502
+ this.job = job;
503
+ this.name = name;
504
+ this.fileSize = fileSize;
505
+ this.mimeType = mimeType;
506
+ this.sequence = sequence;
507
+ this.config = config;
508
+ this.url = url;
509
+ }
510
+ /**
511
+ * @param {VasFieldDto} fileDto
512
+ * @return {VasFieldModel}
513
+ */
514
+ static fromDto(fileDto) {
515
+ 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 || '');
516
+ }
517
+ static parseConfig(config = '') {
518
+ try {
519
+ return JSON.parse(config);
520
+ }
521
+ catch (e) {
522
+ return {
523
+ displayAs: 'grid',
524
+ embedLink: false,
525
+ group: 'photo',
526
+ description: '',
527
+ displayedName: '',
528
+ rotation: 0
529
+ };
530
+ }
531
+ }
532
+ /**
533
+ * @return {VasFileDto}
534
+ */
535
+ toDto() {
536
+ return {
537
+ id: this.id,
538
+ created: this.created,
539
+ serverCreated: this.serverCreated,
540
+ createdBy: this.createdBy,
541
+ modified: this.modified,
542
+ serverModified: this.serverModified,
543
+ modifiedBy: this.modifiedBy,
544
+ account: this.account,
545
+ job: this.job,
546
+ name: this.name,
547
+ fileSize: this.fileSize,
548
+ mimeType: this.mimeType,
549
+ sequence: this.sequence,
550
+ config: this.stringifyConfig(this.config),
551
+ url: this.url,
552
+ };
553
+ }
554
+ stringifyConfig(config) {
555
+ if (!config) {
556
+ return JSON.stringify({
557
+ displayAs: 'grid',
558
+ embedLink: false,
559
+ group: 'photo',
560
+ description: '',
561
+ displayedName: '',
562
+ rotation: 0
563
+ });
564
+ }
565
+ try {
566
+ return JSON.stringify(config);
567
+ }
568
+ catch (e) {
569
+ console.warn(e);
570
+ return '';
571
+ }
572
+ }
573
+ toApiDto() {
574
+ return Object.assign(Object.assign({}, super.toApiDto()), { name: this.name || '~', mimeType: this.mimeType || '~', sequence: this.safeNumber(this.sequence), config: JSON.stringify(this.config) });
575
+ }
576
+ safeNumber(value) {
577
+ if (!Number.isFinite(value)) {
578
+ return 0;
579
+ }
580
+ return value;
581
+ }
582
+ }
583
+
370
584
  /**
371
585
  * GroupModel
372
586
  */
@@ -422,6 +636,7 @@ class VasGroupModel extends VasBaseModel {
422
636
  return new VasGroupModel(
423
637
  // eslint-disable-next-line new-cap
424
638
  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 || [])
639
+ .filter(control => control.name.startsWith('fields.'))
425
640
  .sort((a, b) => a.sequence - b.sequence)
426
641
  .map(c => VasControlModel.fromDto(c)), dto.scoreWeight || 1);
427
642
  }
@@ -472,7 +687,7 @@ class VasGroupModel extends VasBaseModel {
472
687
  /**
473
688
  * VasFormModel
474
689
  */
475
- class VasFormModel extends VasBaseModel {
690
+ class VasFormModel extends VasRestrictedAccountObjectModel {
476
691
  /**
477
692
  * @param {string} id
478
693
  * @param {string} created
@@ -493,7 +708,7 @@ class VasFormModel extends VasBaseModel {
493
708
  * @param {string} config
494
709
  */
495
710
  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);
711
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup);
497
712
  this.id = id;
498
713
  this.created = created;
499
714
  this.serverCreated = serverCreated;
@@ -730,7 +945,7 @@ const getValueByPath = (path, object) => {
730
945
  /**
731
946
  * JobModel
732
947
  */
733
- class VasJobModel extends VasBaseModel {
948
+ class VasJobModel extends VasRestrictedAccountObjectModel {
734
949
  /**
735
950
  * @param {string} id
736
951
  * @param {string} created
@@ -745,12 +960,17 @@ class VasJobModel extends VasBaseModel {
745
960
  * @param {string} jobDate
746
961
  * @param {string} jobStatus
747
962
  * @param {string} jobType
748
- * @param {string} assignee
963
+ * @param {string} assigneeId
749
964
  * @param {string} formId
750
965
  * @param {number} timeZoneOffset
966
+ * @param {number} pendingFields
967
+ * @param {string} childModified
968
+ * @param {number} version
969
+ * @param {Array<VasFieldDto>} fields
970
+ * @param {Array<VasFileDto>} files
751
971
  */
752
- constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, reference, jobDate, jobStatus, jobType, assignee, formId, timeZoneOffset) {
753
- super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
972
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, reference, jobDate, jobStatus, jobType, assigneeId, formId, timeZoneOffset, pendingFields, childModified, version, fields, files) {
973
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup);
754
974
  this.id = id;
755
975
  this.created = created;
756
976
  this.serverCreated = serverCreated;
@@ -764,9 +984,14 @@ class VasJobModel extends VasBaseModel {
764
984
  this.jobDate = jobDate;
765
985
  this.jobStatus = jobStatus;
766
986
  this.jobType = jobType;
767
- this.assignee = assignee;
987
+ this.assigneeId = assigneeId;
768
988
  this.formId = formId;
769
989
  this.timeZoneOffset = timeZoneOffset;
990
+ this.pendingFields = pendingFields;
991
+ this.childModified = childModified;
992
+ this.version = version;
993
+ this.fields = fields;
994
+ this.files = files;
770
995
  }
771
996
  /**
772
997
  * Returns this with the dynamic interface
@@ -798,7 +1023,7 @@ class VasJobModel extends VasBaseModel {
798
1023
  static empty() {
799
1024
  return new VasJobModel(
800
1025
  // eslint-disable-next-line new-cap
801
- UUID.UUID(), '', '', '', '', '', '', '', '', '', '', '', '', '', '', moment().utcOffset());
1026
+ UUID.UUID(), '', '', '', '', '', '', '', '', '', '', '', '', '', '', moment().utcOffset(), 0, '', 0, [], []);
802
1027
  }
803
1028
  /**
804
1029
  * @param {VasJobDto} jobDto
@@ -807,7 +1032,7 @@ class VasJobModel extends VasBaseModel {
807
1032
  static fromDto(jobDto) {
808
1033
  const model = new VasJobModel(
809
1034
  // eslint-disable-next-line new-cap
810
- 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());
1035
+ 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 || []);
811
1036
  const emptyKeys = model.staticProperties;
812
1037
  Object
813
1038
  .keys(jobDto)
@@ -851,6 +1076,114 @@ class VasJobModel extends VasBaseModel {
851
1076
  }, {});
852
1077
  return fields;
853
1078
  }
1079
+ /**
1080
+ * This method will hydrate the `fields` property of the model. The reason for
1081
+ * this is that we have different ways to store the field data. One way, is
1082
+ * we store them as dynamic properties of the job. For example job.foo.bar,
1083
+ * where `foo` is the name of a Group, and `bar` is the name of a control.
1084
+ * Thus, when we create a job using a form in the client, the job object will
1085
+ * have its static properties (id, account, reference etc), and also a number
1086
+ * of dynamic properties determined by the Groups and Controls. This kind of
1087
+ * object is nice to work with in certain circumstances. However, the api
1088
+ * works differently. In the API a Job is a record, and references a number of
1089
+ * Field records. Each Field stores the value. Comparing these two models we
1090
+ * have:
1091
+ * A) job with dynamic properties, e.g.
1092
+ * {
1093
+ * id: <guid>,
1094
+ * reference: "something"
1095
+ * <other static job properties>...
1096
+ * foo: {
1097
+ * bar: "value"
1098
+ * }
1099
+ * }
1100
+ *
1101
+ * B) job with fields
1102
+ * {
1103
+ * id: <guid>,
1104
+ * reference: "something"
1105
+ * <other static job properties>...
1106
+ * <will not have dynamic properties>...
1107
+ * fields: [
1108
+ * {
1109
+ * id: <guid>,
1110
+ * <other field properties>,
1111
+ * value: "value"
1112
+ * }
1113
+ * ]
1114
+ * }
1115
+ *
1116
+ * So, what this method does is given a JobModel in the form of A, read all
1117
+ * of those dynamic properties and set them into `fields`. Doing this requires
1118
+ * knowledge of the Form that was used to create the job. Moreover, since the
1119
+ * dynamic properties do not contain the ids of the fields, we also allow to
1120
+ * pass in a `controlFieldIdMap`. This map stores the mapping between Control
1121
+ * and the Field that was created in the Job to store the value for that
1122
+ * Control. This is useful, if for example you want to compare a Job in form A
1123
+ * with a Job in form B, for example if you want to update the Job on the API
1124
+ * with a Job that was saved by a client in form A.
1125
+ *
1126
+ * E.g.
1127
+ * Client -> API: client requests form
1128
+ * User -> Client: user fills in the form and submits
1129
+ * Client -> Firestore: client saves the Job in form A i.e. dynamic props
1130
+ * Firestore -> Function: A function is triggered to sync the job to the API
1131
+ * Function -> API: Function checks if job already exists, it receives 404
1132
+ * Function -> Function: The function calls `hydrateFields(...)`
1133
+ * Function -> API: The function POST the Job to /jobs
1134
+ * Function -> API: The function POST each field to /fields
1135
+ *
1136
+ * Similarly, if the user updates the job
1137
+ * Client -> API: client requests form
1138
+ * User -> Client: user fills in the form and submits an update
1139
+ * Client -> Firestore: client saves the Job in form A i.e. dynamic props
1140
+ * Firestore -> Function: A function is triggered to sync the job to the API
1141
+ * Function -> API: Function checks if job already exists, it receives 200
1142
+ * Function -> Function: The function calls `hydrateFields(...)` passing in
1143
+ * the map is made by iterating over the fields it
1144
+ * received from the API and storing the mappings
1145
+ * between controlId and fieldId for each field
1146
+ * Function -> API: The function PATCH the Job to /jobs
1147
+ * Function -> API: The function POST/PATCH each field to /fields
1148
+ * treated as new
1149
+ *
1150
+ * @param {VasFormModel} formModel the VasFormModel that was used to create
1151
+ * the job
1152
+ * @param {Map<string, string>} controlFieldIdMap a mapping of control to
1153
+ * field ids. This is used to determine whether a new id for the field should
1154
+ * be generated, or to reuse an existing one from the map.
1155
+ * @param {Array<string>} controlNames if a value is provided, it will be used
1156
+ * to filter the fields that are returned.
1157
+ * @return {Array<VasFieldDto>}
1158
+ */
1159
+ hydrateFields(formModel, controlFieldIdMap = new Map(), controlNames) {
1160
+ const fields = [];
1161
+ formModel.groups
1162
+ .forEach(group => {
1163
+ group.controls.forEach(control => {
1164
+ if (!control.name.startsWith('fields.')) {
1165
+ return;
1166
+ }
1167
+ if (controlNames && !controlNames.includes(control.name)) {
1168
+ return;
1169
+ }
1170
+ fields.push(VasFieldModel.fromDto({
1171
+ // if the controlId exists in the map, use the associated fieldId,
1172
+ // otherwise generate a new id for the field.
1173
+ id: controlFieldIdMap.get(control.id) || UUID.UUID(),
1174
+ account: this.account,
1175
+ job: this.id,
1176
+ createdBy: this.createdBy,
1177
+ created: this.created,
1178
+ modifiedBy: this.modifiedBy,
1179
+ modified: this.modified,
1180
+ control: control.id,
1181
+ value: this.getValueByPath([group.name, control.name])
1182
+ }));
1183
+ });
1184
+ });
1185
+ this.fields = fields;
1186
+ }
854
1187
  /**
855
1188
 
856
1189
  * @param {string[]} path path segments
@@ -921,9 +1254,14 @@ class VasJobModel extends VasBaseModel {
921
1254
  jobDate: this.jobDate,
922
1255
  jobStatus: this.jobStatus,
923
1256
  jobType: this.jobType,
924
- assignee: this.assignee,
1257
+ assigneeId: this.assigneeId,
925
1258
  formId: this.formId,
926
1259
  timeZoneOffset: this.timeZoneOffset,
1260
+ pendingFields: this.pendingFields,
1261
+ childModified: this.childModified,
1262
+ version: this.version,
1263
+ fields: this.fields,
1264
+ files: this.files
927
1265
  };
928
1266
  }
929
1267
  const dto = {};
@@ -1026,6 +1364,31 @@ class VasJobModel extends VasBaseModel {
1026
1364
  }).trim();
1027
1365
  }
1028
1366
  ;
1367
+ /**
1368
+ * @return {object}
1369
+ */
1370
+ toApiDto() {
1371
+ return Object.assign(Object.assign({}, super.toApiDto()), { reference: this.reference || '~', jobDate: this.jobDate || '~', jobType: this.jobType || '~', accessGroup: this.accessGroup || '~', jobStatus: this.jobStatus || '~', assigneeId: this.assigneeId || '~', timeZoneOffset: this.timeZoneOffset || 0, pendingFields: this.pendingFields || 0 });
1372
+ }
1373
+ }
1374
+
1375
+ class VasReportLayoutModel extends VasRestrictedAccountObjectModel {
1376
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, jobType, title, description, entryPoint) {
1377
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup);
1378
+ this.id = id;
1379
+ this.created = created;
1380
+ this.serverCreated = serverCreated;
1381
+ this.createdBy = createdBy;
1382
+ this.modified = modified;
1383
+ this.serverModified = serverModified;
1384
+ this.modifiedBy = modifiedBy;
1385
+ this.account = account;
1386
+ this.accessGroup = accessGroup;
1387
+ this.jobType = jobType;
1388
+ this.title = title;
1389
+ this.description = description;
1390
+ this.entryPoint = entryPoint;
1391
+ }
1029
1392
  }
1030
1393
 
1031
1394
  class VasReportRequestModel extends VasBaseModel {
@@ -1113,5 +1476,5 @@ class VasUserModel extends VasBaseModel {
1113
1476
  * Generated bundle index. Do not edit.
1114
1477
  */
1115
1478
 
1116
- export { VasAccountObjectModel, VasBaseModel, VasBranchModel, VasContactModel, VasControlConfigDirection, VasControlModel, VasControlTypeModel, VasFormModel, VasGroupModel, VasJobModel, VasReportRequestModel, VasRestrictedAccountObjectModel, VasUserModel };
1479
+ export { VasAccountObjectModel, VasBaseModel, VasBranchModel, VasContactModel, VasControlConfigDirection, VasControlModel, VasControlTypeModel, VasFieldModel, VasFileModel, VasFormModel, VasGroupModel, VasJobDataModel, VasJobModel, VasReportLayoutModel, VasReportRequestModel, VasRestrictedAccountObjectModel, VasUserModel };
1117
1480
  //# sourceMappingURL=ironcode-vas-lib.mjs.map