@ironcode/vas-lib 0.0.39 → 0.0.41
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.
- package/cjs/lib/entity/vas-file.dto.d.ts +2 -1
- package/cjs/lib/entity/vas-file.dto.d.ts.map +1 -1
- package/cjs/lib/entity/vas-file.dto.js.map +1 -1
- package/cjs/lib/entity/vas-file.model.d.ts +3 -3
- package/cjs/lib/entity/vas-file.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-file.model.js +2 -2
- package/cjs/lib/entity/vas-file.model.js.map +1 -1
- package/cjs/lib/entity/vas-form.dto.d.ts +1 -0
- package/cjs/lib/entity/vas-form.dto.d.ts.map +1 -1
- package/cjs/lib/entity/vas-form.dto.js.map +1 -1
- package/cjs/lib/entity/vas-form.model.d.ts +2 -21
- package/cjs/lib/entity/vas-form.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-form.model.js +5 -23
- package/cjs/lib/entity/vas-form.model.js.map +1 -1
- package/cjs/lib/entity/vas-job.model.d.ts +11 -1
- package/cjs/lib/entity/vas-job.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-job.model.js +48 -1
- package/cjs/lib/entity/vas-job.model.js.map +1 -1
- package/cjs/lib/entity/vas-job.model.spec-data.d.ts.map +1 -1
- package/cjs/lib/entity/vas-job.model.spec-data.js +1 -0
- package/cjs/lib/entity/vas-job.model.spec-data.js.map +1 -1
- package/cjs/lib/utils/is-array-string.d.ts +2 -0
- package/cjs/lib/utils/is-array-string.d.ts.map +1 -0
- package/cjs/lib/utils/is-array-string.js +8 -0
- package/cjs/lib/utils/is-array-string.js.map +1 -0
- package/esm2020/lib/entity/vas-file.dto.mjs +1 -1
- package/esm2020/lib/entity/vas-file.model.mjs +3 -3
- package/esm2020/lib/entity/vas-form.dto.mjs +1 -1
- package/esm2020/lib/entity/vas-form.model.mjs +6 -24
- package/esm2020/lib/entity/vas-job.model.mjs +49 -2
- package/esm2020/lib/utils/is-array-string.mjs +4 -0
- package/fesm2015/ironcode-vas-lib.mjs +56 -26
- package/fesm2015/ironcode-vas-lib.mjs.map +1 -1
- package/fesm2020/ironcode-vas-lib.mjs +56 -26
- package/fesm2020/ironcode-vas-lib.mjs.map +1 -1
- package/lib/entity/vas-file.dto.d.ts +2 -1
- package/lib/entity/vas-file.model.d.ts +3 -3
- package/lib/entity/vas-form.dto.d.ts +1 -0
- package/lib/entity/vas-form.model.d.ts +2 -21
- package/lib/entity/vas-job.model.d.ts +11 -1
- package/lib/utils/is-array-string.d.ts +1 -0
- package/package.json +1 -1
|
@@ -688,10 +688,10 @@ class VasFileModel extends VasJobDataModel {
|
|
|
688
688
|
description: '',
|
|
689
689
|
displayedName: '',
|
|
690
690
|
rotation: 0
|
|
691
|
-
}, '', '', '', '', '');
|
|
691
|
+
}, '', '', '', 'NEW', '');
|
|
692
692
|
}
|
|
693
693
|
static fromDto(fileDto) {
|
|
694
|
-
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 || '', fileDto.controlPath || '', fileDto.message || '', fileDto.status || '', fileDto.uri || '');
|
|
694
|
+
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 || '', fileDto.controlPath || '', fileDto.message || '', fileDto.status || 'NEW', fileDto.uri || '');
|
|
695
695
|
}
|
|
696
696
|
static parseConfig(config = '') {
|
|
697
697
|
try {
|
|
@@ -881,27 +881,7 @@ class VasGroupModel extends VasBaseModel {
|
|
|
881
881
|
* VasFormModel
|
|
882
882
|
*/
|
|
883
883
|
class VasFormModel extends VasRestrictedAccountObjectModel {
|
|
884
|
-
|
|
885
|
-
* @param {string} id
|
|
886
|
-
* @param {string} created
|
|
887
|
-
* @param {string} serverCreated
|
|
888
|
-
* @param {string} createdBy
|
|
889
|
-
* @param {string} modified
|
|
890
|
-
* @param {string} serverModified
|
|
891
|
-
* @param {string} modifiedBy
|
|
892
|
-
* @param {string} account
|
|
893
|
-
* @param {string} accessGroup
|
|
894
|
-
* @param {string} jobType
|
|
895
|
-
* @param {string} title
|
|
896
|
-
* @param {string} description
|
|
897
|
-
* @param {VasGroupModel[]} groups
|
|
898
|
-
* @param {string} dynamicDescriptor
|
|
899
|
-
* @param {string} indexName
|
|
900
|
-
* @param {string} pipelineName
|
|
901
|
-
* @param {string} config
|
|
902
|
-
* @param {boolean} geoLocationEnabled
|
|
903
|
-
*/
|
|
904
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, jobType, title, description, groups, dynamicDescriptor, indexName, pipelineName, config, geoLocationEnabled) {
|
|
884
|
+
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, jobType, title, description, groups, dynamicDescriptor, indexName, pipelineName, config, geoLocationEnabled, filesEnabled) {
|
|
905
885
|
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup);
|
|
906
886
|
this.id = id;
|
|
907
887
|
this.created = created;
|
|
@@ -921,6 +901,7 @@ class VasFormModel extends VasRestrictedAccountObjectModel {
|
|
|
921
901
|
this.pipelineName = pipelineName;
|
|
922
902
|
this.config = config;
|
|
923
903
|
this.geoLocationEnabled = geoLocationEnabled;
|
|
904
|
+
this.filesEnabled = filesEnabled;
|
|
924
905
|
}
|
|
925
906
|
/**
|
|
926
907
|
* Returns the name of this form in a "safe" way, i.e. no spaces, special
|
|
@@ -963,7 +944,7 @@ class VasFormModel extends VasRestrictedAccountObjectModel {
|
|
|
963
944
|
static fromDto(dto) {
|
|
964
945
|
return new VasFormModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.account || '', dto.accessGroup || '', dto.jobType || '', dto.title || '', dto.description || '', (dto.groups || [])
|
|
965
946
|
.sort((a, b) => a.sequence - b.sequence)
|
|
966
|
-
.map(g => VasGroupModel.fromDto(g)), dto.dynamicDescriptor || '', dto.indexName || '', dto.pipelineName || '', dto.config || '', dto.geoLocationEnabled || false);
|
|
947
|
+
.map(g => VasGroupModel.fromDto(g)), dto.dynamicDescriptor || '', dto.indexName || '', dto.pipelineName || '', dto.config || '', dto.geoLocationEnabled || false, dto.filesEnabled || false);
|
|
967
948
|
}
|
|
968
949
|
addControlTypesToControl(controlTypes) {
|
|
969
950
|
const controlTypeModels = controlTypes
|
|
@@ -1068,7 +1049,8 @@ class VasFormModel extends VasRestrictedAccountObjectModel {
|
|
|
1068
1049
|
indexName: this.indexName,
|
|
1069
1050
|
pipelineName: this.pipelineName,
|
|
1070
1051
|
config: this.config,
|
|
1071
|
-
geoLocationEnabled: this.geoLocationEnabled
|
|
1052
|
+
geoLocationEnabled: this.geoLocationEnabled,
|
|
1053
|
+
filesEnabled: this.filesEnabled
|
|
1072
1054
|
};
|
|
1073
1055
|
}
|
|
1074
1056
|
}
|
|
@@ -1180,6 +1162,10 @@ const getEmptyGeoLocation = () => ({
|
|
|
1180
1162
|
timestamp: ''
|
|
1181
1163
|
});
|
|
1182
1164
|
|
|
1165
|
+
const isArrayString = (value) => {
|
|
1166
|
+
return Array.isArray(value) && value.every(i => typeof i === 'string');
|
|
1167
|
+
};
|
|
1168
|
+
|
|
1183
1169
|
/**
|
|
1184
1170
|
* JobModel
|
|
1185
1171
|
*/
|
|
@@ -1320,6 +1306,51 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1320
1306
|
}, {});
|
|
1321
1307
|
return fields;
|
|
1322
1308
|
}
|
|
1309
|
+
/**
|
|
1310
|
+
* Returns an object describing how many attachments were added to this job
|
|
1311
|
+
* (camera controls and files), and how many have not been uploaded yet.
|
|
1312
|
+
*
|
|
1313
|
+
* @param formModel instance of {@link VasFormModel} that was used when the
|
|
1314
|
+
* job was created
|
|
1315
|
+
*/
|
|
1316
|
+
getFilesUploadStatus(formModel) {
|
|
1317
|
+
const pathsWithValue = formModel
|
|
1318
|
+
.getCameraControlPaths()
|
|
1319
|
+
.map(path => {
|
|
1320
|
+
const value = this.getValueByPath(path);
|
|
1321
|
+
if (value && !!value.id) {
|
|
1322
|
+
return path;
|
|
1323
|
+
}
|
|
1324
|
+
return null;
|
|
1325
|
+
})
|
|
1326
|
+
.filter(path => path !== null ? path : null)
|
|
1327
|
+
.filter(isArrayString);
|
|
1328
|
+
let total = pathsWithValue.length;
|
|
1329
|
+
total += this.files.length;
|
|
1330
|
+
// calculate the number of camera images still to upload
|
|
1331
|
+
let pending = pathsWithValue
|
|
1332
|
+
.map(path => this.getValueByPath(path))
|
|
1333
|
+
.map((value) => {
|
|
1334
|
+
if (isFileDto(value)) {
|
|
1335
|
+
return value.id && value.status !== 'COMPLETE';
|
|
1336
|
+
}
|
|
1337
|
+
else if (isCameraControlValueV1(value)) {
|
|
1338
|
+
// if url is not set, it hasn't been uploaded
|
|
1339
|
+
return value.id && !value.url;
|
|
1340
|
+
}
|
|
1341
|
+
return false;
|
|
1342
|
+
})
|
|
1343
|
+
.filter(hasUploaded => hasUploaded)
|
|
1344
|
+
.length;
|
|
1345
|
+
// add total from files that are pending
|
|
1346
|
+
pending += this.files
|
|
1347
|
+
.filter(value => value.status !== 'COMPLETE')
|
|
1348
|
+
.length;
|
|
1349
|
+
return {
|
|
1350
|
+
pending,
|
|
1351
|
+
total
|
|
1352
|
+
};
|
|
1353
|
+
}
|
|
1323
1354
|
/**
|
|
1324
1355
|
* This method will hydrate the `fields` property of the model. The reason for
|
|
1325
1356
|
* this is that we have different ways to store the field data. One way, is
|
|
@@ -1429,7 +1460,6 @@ class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
1429
1460
|
this.fields = fields;
|
|
1430
1461
|
}
|
|
1431
1462
|
/**
|
|
1432
|
-
|
|
1433
1463
|
* @param {string[]} path path segments
|
|
1434
1464
|
* @return {void}
|
|
1435
1465
|
*/
|