@ironcode/vas-lib 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/cjs/lib/control-value/index.d.ts +2 -0
- package/cjs/lib/control-value/index.d.ts.map +1 -0
- package/cjs/lib/control-value/index.js +5 -0
- package/cjs/lib/control-value/index.js.map +1 -0
- package/cjs/lib/control-value/vas-camera-control-value.model.d.ts +7 -0
- package/cjs/lib/control-value/vas-camera-control-value.model.d.ts.map +1 -0
- package/cjs/lib/control-value/vas-camera-control-value.model.js +3 -0
- package/cjs/lib/control-value/vas-camera-control-value.model.js.map +1 -0
- package/cjs/lib/controls-config/index.d.ts +4 -0
- package/cjs/lib/controls-config/index.d.ts.map +1 -0
- package/cjs/lib/controls-config/index.js +7 -0
- package/cjs/lib/controls-config/index.js.map +1 -0
- package/cjs/lib/controls-config/vas-control-config-direction.enum.d.ts +5 -0
- package/cjs/lib/controls-config/vas-control-config-direction.enum.d.ts.map +1 -0
- package/cjs/lib/controls-config/vas-control-config-direction.enum.js +11 -0
- package/cjs/lib/controls-config/vas-control-config-direction.enum.js.map +1 -0
- package/cjs/lib/controls-config/vas-control-config.model.d.ts +8 -0
- package/cjs/lib/controls-config/vas-control-config.model.d.ts.map +1 -0
- package/cjs/lib/controls-config/vas-control-config.model.js +3 -0
- package/cjs/lib/controls-config/vas-control-config.model.js.map +1 -0
- package/cjs/lib/controls-config/vas-select-control-config.model.d.ts +10 -0
- package/cjs/lib/controls-config/vas-select-control-config.model.d.ts.map +1 -0
- package/cjs/lib/controls-config/vas-select-control-config.model.js +3 -0
- package/cjs/lib/controls-config/vas-select-control-config.model.js.map +1 -0
- package/cjs/lib/entity/index.d.ts +23 -0
- package/cjs/lib/entity/index.d.ts.map +1 -0
- package/cjs/lib/entity/index.js +26 -0
- package/cjs/lib/entity/index.js.map +1 -0
- package/cjs/lib/entity/vas-account-object.dto.d.ts +5 -0
- package/cjs/lib/entity/vas-account-object.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-account-object.dto.js +3 -0
- package/cjs/lib/entity/vas-account-object.dto.js.map +1 -0
- package/cjs/lib/entity/vas-base.dto.d.ts +13 -0
- package/cjs/lib/entity/vas-base.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-base.dto.js +3 -0
- package/cjs/lib/entity/vas-base.dto.js.map +1 -0
- package/cjs/lib/entity/vas-base.model.d.ts +24 -0
- package/cjs/lib/entity/vas-base.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-base.model.js +28 -0
- package/cjs/lib/entity/vas-base.model.js.map +1 -0
- package/cjs/lib/entity/vas-control-type.dto.d.ts +5 -0
- package/cjs/lib/entity/vas-control-type.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-control-type.dto.js +3 -0
- package/cjs/lib/entity/vas-control-type.dto.js.map +1 -0
- package/cjs/lib/entity/vas-control-type.model.d.ts +36 -0
- package/cjs/lib/entity/vas-control-type.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-control-type.model.js +57 -0
- package/cjs/lib/entity/vas-control-type.model.js.map +1 -0
- package/cjs/lib/entity/vas-control.dto.d.ts +14 -0
- package/cjs/lib/entity/vas-control.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-control.dto.js +3 -0
- package/cjs/lib/entity/vas-control.dto.js.map +1 -0
- package/cjs/lib/entity/vas-control.model.d.ts +92 -0
- package/cjs/lib/entity/vas-control.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-control.model.js +145 -0
- package/cjs/lib/entity/vas-control.model.js.map +1 -0
- package/cjs/lib/entity/vas-field.dto.d.ts +10 -0
- package/cjs/lib/entity/vas-field.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-field.dto.js +3 -0
- package/cjs/lib/entity/vas-field.dto.js.map +1 -0
- package/cjs/lib/entity/vas-file.dto.d.ts +14 -0
- package/cjs/lib/entity/vas-file.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-file.dto.js +3 -0
- package/cjs/lib/entity/vas-file.dto.js.map +1 -0
- package/cjs/lib/entity/vas-form.dto.d.ts +9 -0
- package/cjs/lib/entity/vas-form.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-form.dto.js +3 -0
- package/cjs/lib/entity/vas-form.dto.js.map +1 -0
- package/cjs/lib/entity/vas-form.model.d.ts +79 -0
- package/cjs/lib/entity/vas-form.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-form.model.js +148 -0
- package/cjs/lib/entity/vas-form.model.js.map +1 -0
- package/cjs/lib/entity/vas-group.dto.d.ts +15 -0
- package/cjs/lib/entity/vas-group.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-group.dto.js +3 -0
- package/cjs/lib/entity/vas-group.dto.js.map +1 -0
- package/cjs/lib/entity/vas-group.model.d.ts +68 -0
- package/cjs/lib/entity/vas-group.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-group.model.js +109 -0
- package/cjs/lib/entity/vas-group.model.js.map +1 -0
- package/cjs/lib/entity/vas-job-data.dto.d.ts +5 -0
- package/cjs/lib/entity/vas-job-data.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-job-data.dto.js +3 -0
- package/cjs/lib/entity/vas-job-data.dto.js.map +1 -0
- package/cjs/lib/entity/vas-job.dto.d.ts +12 -0
- package/cjs/lib/entity/vas-job.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-job.dto.js +3 -0
- package/cjs/lib/entity/vas-job.dto.js.map +1 -0
- package/cjs/lib/entity/vas-job.model.d.ts +124 -0
- package/cjs/lib/entity/vas-job.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-job.model.js +209 -0
- package/cjs/lib/entity/vas-job.model.js.map +1 -0
- package/cjs/lib/entity/vas-job.model.spec-data.d.ts +3 -0
- package/cjs/lib/entity/vas-job.model.spec-data.d.ts.map +1 -0
- package/cjs/lib/entity/vas-job.model.spec-data.js +63 -0
- package/cjs/lib/entity/vas-job.model.spec-data.js.map +1 -0
- package/cjs/lib/entity/vas-report-layout.dto.d.ts +8 -0
- package/cjs/lib/entity/vas-report-layout.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-report-layout.dto.js +3 -0
- package/cjs/lib/entity/vas-report-layout.dto.js.map +1 -0
- package/cjs/lib/entity/vas-report-request.dto.d.ts +8 -0
- package/cjs/lib/entity/vas-report-request.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-report-request.dto.js +3 -0
- package/cjs/lib/entity/vas-report-request.dto.js.map +1 -0
- package/cjs/lib/entity/vas-report-request.model.d.ts +19 -0
- package/cjs/lib/entity/vas-report-request.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-report-request.model.js +42 -0
- package/cjs/lib/entity/vas-report-request.model.js.map +1 -0
- package/cjs/lib/entity/vas-restricted-account-object.dto.d.ts +5 -0
- package/cjs/lib/entity/vas-restricted-account-object.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-restricted-account-object.dto.js +3 -0
- package/cjs/lib/entity/vas-restricted-account-object.dto.js.map +1 -0
- package/cjs/lib/entity/vas-user.dto.d.ts +6 -0
- package/cjs/lib/entity/vas-user.dto.d.ts.map +1 -0
- package/cjs/lib/entity/vas-user.dto.js +3 -0
- package/cjs/lib/entity/vas-user.dto.js.map +1 -0
- package/cjs/lib/entity/vas-user.model.d.ts +18 -0
- package/cjs/lib/entity/vas-user.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-user.model.js +50 -0
- package/cjs/lib/entity/vas-user.model.js.map +1 -0
- package/cjs/lib/utils/find-form-control.d.ts +3 -0
- package/cjs/lib/utils/find-form-control.d.ts.map +1 -0
- package/cjs/lib/utils/find-form-control.js +25 -0
- package/cjs/lib/utils/find-form-control.js.map +1 -0
- package/cjs/package.json +47 -0
- package/cjs/public-api.d.ts +4 -0
- package/cjs/public-api.d.ts.map +1 -0
- package/cjs/public-api.js +7 -0
- package/cjs/public-api.js.map +1 -0
- package/esm2020/ironcode-vas-lib.mjs +5 -0
- package/esm2020/lib/control-value/index.mjs +2 -0
- package/esm2020/lib/control-value/vas-camera-control-value.model.mjs +2 -0
- package/esm2020/lib/controls-config/index.mjs +4 -0
- package/esm2020/lib/controls-config/vas-control-config-direction.enum.mjs +8 -0
- package/esm2020/lib/controls-config/vas-control-config.model.mjs +2 -0
- package/esm2020/lib/controls-config/vas-select-control-config.model.mjs +2 -0
- package/esm2020/lib/entity/index.mjs +23 -0
- package/esm2020/lib/entity/vas-account-object.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-base.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-base.model.mjs +24 -0
- package/esm2020/lib/entity/vas-control-type.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-control-type.model.mjs +53 -0
- package/esm2020/lib/entity/vas-control.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-control.model.mjs +141 -0
- package/esm2020/lib/entity/vas-field.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-file.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-form.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-form.model.mjs +143 -0
- package/esm2020/lib/entity/vas-group.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-group.model.mjs +105 -0
- package/esm2020/lib/entity/vas-job-data.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-job.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-job.model.mjs +205 -0
- package/esm2020/lib/entity/vas-report-layout.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-report-request.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-report-request.model.mjs +38 -0
- package/esm2020/lib/entity/vas-restricted-account-object.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-user.dto.mjs +2 -0
- package/esm2020/lib/entity/vas-user.model.mjs +46 -0
- package/esm2020/public-api.mjs +4 -0
- package/fesm2015/ironcode-vas-lib.mjs +756 -0
- package/fesm2015/ironcode-vas-lib.mjs.map +1 -0
- package/fesm2020/ironcode-vas-lib.mjs +755 -0
- package/fesm2020/ironcode-vas-lib.mjs.map +1 -0
- package/ironcode-vas-lib.d.ts +5 -0
- package/lib/control-value/index.d.ts +1 -0
- package/lib/control-value/vas-camera-control-value.model.d.ts +6 -0
- package/lib/controls-config/index.d.ts +3 -0
- package/lib/controls-config/vas-control-config-direction.enum.d.ts +4 -0
- package/lib/controls-config/vas-control-config.model.d.ts +7 -0
- package/lib/controls-config/vas-select-control-config.model.d.ts +9 -0
- package/lib/entity/index.d.ts +22 -0
- package/lib/entity/vas-account-object.dto.d.ts +4 -0
- package/lib/entity/vas-base.dto.d.ts +12 -0
- package/lib/entity/vas-base.model.d.ts +23 -0
- package/lib/entity/vas-control-type.dto.d.ts +4 -0
- package/lib/entity/vas-control-type.model.d.ts +35 -0
- package/lib/entity/vas-control.dto.d.ts +13 -0
- package/lib/entity/vas-control.model.d.ts +91 -0
- package/lib/entity/vas-field.dto.d.ts +9 -0
- package/lib/entity/vas-file.dto.d.ts +13 -0
- package/lib/entity/vas-form.dto.d.ts +8 -0
- package/lib/entity/vas-form.model.d.ts +78 -0
- package/lib/entity/vas-group.dto.d.ts +14 -0
- package/lib/entity/vas-group.model.d.ts +67 -0
- package/lib/entity/vas-job-data.dto.d.ts +4 -0
- package/lib/entity/vas-job.dto.d.ts +11 -0
- package/lib/entity/vas-job.model.d.ts +123 -0
- package/lib/entity/vas-report-layout.dto.d.ts +7 -0
- package/lib/entity/vas-report-request.dto.d.ts +7 -0
- package/lib/entity/vas-report-request.model.d.ts +18 -0
- package/lib/entity/vas-restricted-account-object.dto.d.ts +4 -0
- package/lib/entity/vas-user.dto.d.ts +5 -0
- package/lib/entity/vas-user.model.d.ts +17 -0
- package/package.json +35 -0
- package/public-api.d.ts +3 -0
|
@@ -0,0 +1,755 @@
|
|
|
1
|
+
import { UUID } from 'angular2-uuid';
|
|
2
|
+
import * as moment_ from 'moment';
|
|
3
|
+
|
|
4
|
+
var VasControlConfigDirection;
|
|
5
|
+
(function (VasControlConfigDirection) {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
VasControlConfigDirection[VasControlConfigDirection["ROW"] = 0] = "ROW";
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
|
+
VasControlConfigDirection[VasControlConfigDirection["COLUMN"] = 1] = "COLUMN";
|
|
10
|
+
})(VasControlConfigDirection || (VasControlConfigDirection = {}));
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* BaseEntityModel
|
|
14
|
+
*/
|
|
15
|
+
class VasBaseModel {
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} id
|
|
18
|
+
* @param {string} created
|
|
19
|
+
* @param {string} serverCreated
|
|
20
|
+
* @param {string} createdBy
|
|
21
|
+
* @param {string} modified
|
|
22
|
+
* @param {string} serverModified
|
|
23
|
+
* @param {string} modifiedBy
|
|
24
|
+
*/
|
|
25
|
+
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy) {
|
|
26
|
+
this.id = id;
|
|
27
|
+
this.created = created;
|
|
28
|
+
this.serverCreated = serverCreated;
|
|
29
|
+
this.createdBy = createdBy;
|
|
30
|
+
this.modified = modified;
|
|
31
|
+
this.serverModified = serverModified;
|
|
32
|
+
this.modifiedBy = modifiedBy;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* ControlModel
|
|
38
|
+
*/
|
|
39
|
+
class VasControlModel extends VasBaseModel {
|
|
40
|
+
/**
|
|
41
|
+
* @param {string} id
|
|
42
|
+
* @param {string} created
|
|
43
|
+
* @param {string} serverCreated
|
|
44
|
+
* @param {string} createdBy
|
|
45
|
+
* @param {string} modified
|
|
46
|
+
* @param {string} serverModified
|
|
47
|
+
* @param {string} modifiedBy
|
|
48
|
+
* @param {string} account
|
|
49
|
+
* @param {string} accessGroup
|
|
50
|
+
* @param {string} controlType
|
|
51
|
+
* @param {string} group
|
|
52
|
+
* @param {string[]} validators
|
|
53
|
+
* @param {string} name
|
|
54
|
+
* @param {string} title
|
|
55
|
+
* @param {boolean} linkable
|
|
56
|
+
* @param {number} sequence
|
|
57
|
+
* @param {string} description
|
|
58
|
+
* @param {string} defaultValue
|
|
59
|
+
* @param {object} config
|
|
60
|
+
*/
|
|
61
|
+
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, controlType, group, validators, name, title, linkable, sequence, description, defaultValue, config) {
|
|
62
|
+
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
|
|
63
|
+
this.id = id;
|
|
64
|
+
this.created = created;
|
|
65
|
+
this.serverCreated = serverCreated;
|
|
66
|
+
this.createdBy = createdBy;
|
|
67
|
+
this.modified = modified;
|
|
68
|
+
this.serverModified = serverModified;
|
|
69
|
+
this.modifiedBy = modifiedBy;
|
|
70
|
+
this.account = account;
|
|
71
|
+
this.accessGroup = accessGroup;
|
|
72
|
+
this.controlType = controlType;
|
|
73
|
+
this.group = group;
|
|
74
|
+
this.validators = validators;
|
|
75
|
+
this.name = name;
|
|
76
|
+
this.title = title;
|
|
77
|
+
this.linkable = linkable;
|
|
78
|
+
this.sequence = sequence;
|
|
79
|
+
this.description = description;
|
|
80
|
+
this.defaultValue = defaultValue;
|
|
81
|
+
this.config = config;
|
|
82
|
+
this.controlTypeModel = undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The config property is returned from the api as a json string, this getter
|
|
86
|
+
* will deserialize it
|
|
87
|
+
* @return {T}
|
|
88
|
+
*/
|
|
89
|
+
getConfigModel() {
|
|
90
|
+
return JSON.parse(this.config);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The defaultValue property is returned from the api as a string or number,
|
|
94
|
+
* in the case of string, it maybe a json. This getter will return an
|
|
95
|
+
* object if the value is a json string
|
|
96
|
+
*/
|
|
97
|
+
get defaultValueDecoded() {
|
|
98
|
+
return this.parseMaybeJson(this.defaultValue);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Returns the name of this control to be used in the report templates
|
|
102
|
+
* i.e. field.foo -> foo
|
|
103
|
+
* @return {string}
|
|
104
|
+
*/
|
|
105
|
+
get reportTemplateName() {
|
|
106
|
+
return this.name.replace(/^fields\./, '');
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @return {string}
|
|
110
|
+
*/
|
|
111
|
+
get safeName() {
|
|
112
|
+
return this.name;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* @return {VasControlModel}
|
|
116
|
+
*/
|
|
117
|
+
static empty() {
|
|
118
|
+
return VasControlModel.fromDto({
|
|
119
|
+
// eslint-disable-next-line new-cap
|
|
120
|
+
id: UUID.UUID()
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* @param {VasControlDto} dto
|
|
125
|
+
* @return {VasControlModel}
|
|
126
|
+
*/
|
|
127
|
+
static fromDto(dto) {
|
|
128
|
+
return new VasControlModel(
|
|
129
|
+
// eslint-disable-next-line new-cap
|
|
130
|
+
dto.id || UUID.UUID(), dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.account || '', dto.accessGroup || '', dto.controlType || '', dto.group || '', dto.validators || [], dto.name || '', dto.title || '', dto.linkable || false, dto.sequence || 0, dto.description || '', dto.defaultValue || '', dto.config || '{}');
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @param {string} value
|
|
134
|
+
* @return {VasControlModelDefaultValueType}
|
|
135
|
+
*/
|
|
136
|
+
parseMaybeJson(value) {
|
|
137
|
+
if (typeof value !== 'string') {
|
|
138
|
+
return value;
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
return JSON.parse(value);
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
return value;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* @return {VasControlDto}
|
|
149
|
+
*/
|
|
150
|
+
toDto() {
|
|
151
|
+
return {
|
|
152
|
+
id: this.id,
|
|
153
|
+
created: this.created,
|
|
154
|
+
serverCreated: this.serverCreated,
|
|
155
|
+
createdBy: this.createdBy,
|
|
156
|
+
modified: this.modified,
|
|
157
|
+
serverModified: this.serverModified,
|
|
158
|
+
modifiedBy: this.modifiedBy,
|
|
159
|
+
account: this.account,
|
|
160
|
+
accessGroup: this.accessGroup,
|
|
161
|
+
controlType: this.controlType,
|
|
162
|
+
group: this.group,
|
|
163
|
+
validators: this.validators,
|
|
164
|
+
name: this.name,
|
|
165
|
+
title: this.title,
|
|
166
|
+
linkable: this.linkable,
|
|
167
|
+
sequence: this.sequence,
|
|
168
|
+
description: this.description,
|
|
169
|
+
defaultValue: this.defaultValue,
|
|
170
|
+
config: this.config
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* VasControlTypeModel
|
|
177
|
+
*/
|
|
178
|
+
class VasControlTypeModel extends VasBaseModel {
|
|
179
|
+
/**
|
|
180
|
+
* @param {string} id
|
|
181
|
+
* @param {string} created
|
|
182
|
+
* @param {string} serverCreated
|
|
183
|
+
* @param {string} createdBy
|
|
184
|
+
* @param {string} modified
|
|
185
|
+
* @param {string} serverModified
|
|
186
|
+
* @param {string} modifiedBy
|
|
187
|
+
* @param {string} name
|
|
188
|
+
*/
|
|
189
|
+
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, name) {
|
|
190
|
+
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
|
|
191
|
+
this.id = id;
|
|
192
|
+
this.created = created;
|
|
193
|
+
this.serverCreated = serverCreated;
|
|
194
|
+
this.createdBy = createdBy;
|
|
195
|
+
this.modified = modified;
|
|
196
|
+
this.serverModified = serverModified;
|
|
197
|
+
this.modifiedBy = modifiedBy;
|
|
198
|
+
this.name = name;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* @param {VasControlTypeDto} dto
|
|
202
|
+
* @return {VasControlTypeModel}
|
|
203
|
+
*/
|
|
204
|
+
static fromDto(dto) {
|
|
205
|
+
return new VasControlTypeModel(
|
|
206
|
+
// eslint-disable-next-line new-cap
|
|
207
|
+
dto.id || UUID.UUID(), dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.name || '');
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* @return {VasControlTypeDto}
|
|
211
|
+
*/
|
|
212
|
+
toDto() {
|
|
213
|
+
return {
|
|
214
|
+
id: this.id,
|
|
215
|
+
created: this.created,
|
|
216
|
+
serverCreated: this.serverCreated,
|
|
217
|
+
createdBy: this.createdBy,
|
|
218
|
+
modified: this.modified,
|
|
219
|
+
serverModified: this.serverModified,
|
|
220
|
+
modifiedBy: this.modifiedBy,
|
|
221
|
+
name: this.name
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* GroupModel
|
|
228
|
+
*/
|
|
229
|
+
class VasGroupModel extends VasBaseModel {
|
|
230
|
+
/**
|
|
231
|
+
* @param {string} id
|
|
232
|
+
* @param {string} created
|
|
233
|
+
* @param {string} serverCreated
|
|
234
|
+
* @param {string} createdBy
|
|
235
|
+
* @param {string} modified
|
|
236
|
+
* @param {string} serverModified
|
|
237
|
+
* @param {string} modifiedBy
|
|
238
|
+
* @param {string} account
|
|
239
|
+
* @param {string} accessGroup
|
|
240
|
+
* @param {string} name
|
|
241
|
+
* @param {string} title
|
|
242
|
+
* @param {string} description
|
|
243
|
+
* @param {number} sequence
|
|
244
|
+
* @param {boolean} includeInSummary
|
|
245
|
+
* @param {string[]} forms
|
|
246
|
+
* @param {string} visibilityControl
|
|
247
|
+
* @param {string} visibleIfEquals
|
|
248
|
+
* @param {VasControlModel[]} controls
|
|
249
|
+
* @param {number} scoreWeight
|
|
250
|
+
*/
|
|
251
|
+
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, name, title, description, sequence, includeInSummary, forms, visibilityControl, visibleIfEquals, controls, scoreWeight) {
|
|
252
|
+
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
|
|
253
|
+
this.id = id;
|
|
254
|
+
this.created = created;
|
|
255
|
+
this.serverCreated = serverCreated;
|
|
256
|
+
this.createdBy = createdBy;
|
|
257
|
+
this.modified = modified;
|
|
258
|
+
this.serverModified = serverModified;
|
|
259
|
+
this.modifiedBy = modifiedBy;
|
|
260
|
+
this.account = account;
|
|
261
|
+
this.accessGroup = accessGroup;
|
|
262
|
+
this.name = name;
|
|
263
|
+
this.title = title;
|
|
264
|
+
this.description = description;
|
|
265
|
+
this.sequence = sequence;
|
|
266
|
+
this.includeInSummary = includeInSummary;
|
|
267
|
+
this.forms = forms;
|
|
268
|
+
this.visibilityControl = visibilityControl;
|
|
269
|
+
this.visibleIfEquals = visibleIfEquals;
|
|
270
|
+
this.controls = controls;
|
|
271
|
+
this.scoreWeight = scoreWeight;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* @param {VasGroupDto} dto
|
|
275
|
+
* @return {VasGroupModel}
|
|
276
|
+
*/
|
|
277
|
+
static fromDto(dto) {
|
|
278
|
+
return new VasGroupModel(
|
|
279
|
+
// eslint-disable-next-line new-cap
|
|
280
|
+
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 || [])
|
|
281
|
+
.sort((a, b) => a.sequence - b.sequence)
|
|
282
|
+
.map(c => VasControlModel.fromDto(c)), dto.scoreWeight || 1);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* @param {Array<VasControlModel>} valuesByControlId
|
|
286
|
+
* @return {boolean}
|
|
287
|
+
*/
|
|
288
|
+
isVisible(valuesByControlId) {
|
|
289
|
+
if (!this.visibilityControl || !this.visibleIfEquals) {
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
const control = valuesByControlId
|
|
293
|
+
.find(c => c.id === this.visibilityControl);
|
|
294
|
+
if (!control) {
|
|
295
|
+
console.warn(`control with id ${this.visibilityControl} not found`);
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
return (control.value || '').toString() === this.visibleIfEquals;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* @return {VasGroupDto}
|
|
302
|
+
*/
|
|
303
|
+
toDto() {
|
|
304
|
+
return {
|
|
305
|
+
id: this.id,
|
|
306
|
+
created: this.created,
|
|
307
|
+
serverCreated: this.serverCreated,
|
|
308
|
+
createdBy: this.createdBy,
|
|
309
|
+
modified: this.modified,
|
|
310
|
+
serverModified: this.serverModified,
|
|
311
|
+
modifiedBy: this.modifiedBy,
|
|
312
|
+
account: this.account,
|
|
313
|
+
accessGroup: this.accessGroup,
|
|
314
|
+
name: this.name,
|
|
315
|
+
title: this.title,
|
|
316
|
+
description: this.description,
|
|
317
|
+
sequence: this.sequence,
|
|
318
|
+
includeInSummary: this.includeInSummary,
|
|
319
|
+
forms: this.forms,
|
|
320
|
+
visibilityControl: this.visibilityControl,
|
|
321
|
+
visibleIfEquals: this.visibleIfEquals,
|
|
322
|
+
controls: this.controls.map(control => control.toDto()),
|
|
323
|
+
scoreWeight: this.scoreWeight
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* VasFormModel
|
|
330
|
+
*/
|
|
331
|
+
class VasFormModel extends VasBaseModel {
|
|
332
|
+
/**
|
|
333
|
+
* @param {string} id
|
|
334
|
+
* @param {string} created
|
|
335
|
+
* @param {string} serverCreated
|
|
336
|
+
* @param {string} createdBy
|
|
337
|
+
* @param {string} modified
|
|
338
|
+
* @param {string} serverModified
|
|
339
|
+
* @param {string} modifiedBy
|
|
340
|
+
* @param {string} account
|
|
341
|
+
* @param {string} accessGroup
|
|
342
|
+
* @param {string} jobType
|
|
343
|
+
* @param {string} title
|
|
344
|
+
* @param {string} description
|
|
345
|
+
* @param {VasGroupModel[]} groups
|
|
346
|
+
*/
|
|
347
|
+
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, jobType, title, description, groups) {
|
|
348
|
+
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
|
|
349
|
+
this.id = id;
|
|
350
|
+
this.created = created;
|
|
351
|
+
this.serverCreated = serverCreated;
|
|
352
|
+
this.createdBy = createdBy;
|
|
353
|
+
this.modified = modified;
|
|
354
|
+
this.serverModified = serverModified;
|
|
355
|
+
this.modifiedBy = modifiedBy;
|
|
356
|
+
this.account = account;
|
|
357
|
+
this.accessGroup = accessGroup;
|
|
358
|
+
this.jobType = jobType;
|
|
359
|
+
this.title = title;
|
|
360
|
+
this.description = description;
|
|
361
|
+
this.groups = groups;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* The VAS API response for Form will inline Group and Control but not
|
|
365
|
+
* ControlType. This method is a help which will allows us to construct an
|
|
366
|
+
* instance of VasFormModel with the ControlType model set appropriately into
|
|
367
|
+
* each VasControlModel
|
|
368
|
+
* @param {VasFormDto} formDto
|
|
369
|
+
* @param {Array<VasControlTypeDto>} controlTypeDtos
|
|
370
|
+
* @return {VasFormModel}
|
|
371
|
+
*/
|
|
372
|
+
static fromApiResponse(formDto, controlTypeDtos) {
|
|
373
|
+
const controlTypeModels = controlTypeDtos
|
|
374
|
+
.map(ctDto => VasControlTypeModel.fromDto(ctDto));
|
|
375
|
+
const formModel = VasFormModel.fromDto(formDto);
|
|
376
|
+
formModel.groups
|
|
377
|
+
.forEach(group => {
|
|
378
|
+
group.controls
|
|
379
|
+
.forEach(control => {
|
|
380
|
+
control.controlTypeModel = controlTypeModels
|
|
381
|
+
.find(ct => ct.id === control.controlType);
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
return formModel;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* @param {VasFormDto} dto
|
|
388
|
+
* @return {VasFormModel}
|
|
389
|
+
*/
|
|
390
|
+
static fromDto(dto) {
|
|
391
|
+
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 || [])
|
|
392
|
+
.sort((a, b) => a.sequence - b.sequence)
|
|
393
|
+
.map(g => VasGroupModel.fromDto(g)));
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* @param {string} id
|
|
397
|
+
* @return {VasControlModel | undefined}
|
|
398
|
+
*/
|
|
399
|
+
findControlModelById(id) {
|
|
400
|
+
let result;
|
|
401
|
+
this.groups
|
|
402
|
+
.find(group => group.controls
|
|
403
|
+
.find(control => {
|
|
404
|
+
if (control.id !== id) {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
result = control;
|
|
408
|
+
return true;
|
|
409
|
+
}));
|
|
410
|
+
return result;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
*
|
|
414
|
+
* @return {Array<Array<string>>}
|
|
415
|
+
*/
|
|
416
|
+
getCameraControlPaths() {
|
|
417
|
+
const paths = [];
|
|
418
|
+
this.groups.forEach(group => {
|
|
419
|
+
group.controls.forEach(control => {
|
|
420
|
+
if (control.controlTypeModel?.name !== 'camera') {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
paths.push([group.name, control.safeName]);
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
return paths;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* @param {VasJobModel} jobModel
|
|
430
|
+
* @return {Array<{id: string, value: VasFieldDtoValue}>}
|
|
431
|
+
*/
|
|
432
|
+
getValuesByControlId(jobModel) {
|
|
433
|
+
const items = [];
|
|
434
|
+
this.groups
|
|
435
|
+
.forEach(group => {
|
|
436
|
+
group.controls
|
|
437
|
+
.forEach(control => {
|
|
438
|
+
items.push({
|
|
439
|
+
id: control.id,
|
|
440
|
+
value: jobModel.getValueByPath([group.name, control.safeName])
|
|
441
|
+
});
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
return items;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* @return {VasFormDto}
|
|
448
|
+
*/
|
|
449
|
+
toDto() {
|
|
450
|
+
return {
|
|
451
|
+
id: this.id,
|
|
452
|
+
created: this.created,
|
|
453
|
+
serverCreated: this.serverCreated,
|
|
454
|
+
createdBy: this.createdBy,
|
|
455
|
+
modified: this.modified,
|
|
456
|
+
serverModified: this.serverModified,
|
|
457
|
+
modifiedBy: this.modifiedBy,
|
|
458
|
+
account: this.account,
|
|
459
|
+
accessGroup: this.accessGroup,
|
|
460
|
+
jobType: this.jobType,
|
|
461
|
+
title: this.title,
|
|
462
|
+
description: this.description,
|
|
463
|
+
groups: this.groups.map(group => group.toDto()),
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* JobModel
|
|
470
|
+
*/
|
|
471
|
+
class VasJobModel extends VasBaseModel {
|
|
472
|
+
/**
|
|
473
|
+
* @param {string} id
|
|
474
|
+
* @param {string} created
|
|
475
|
+
* @param {string} serverCreated
|
|
476
|
+
* @param {string} createdBy
|
|
477
|
+
* @param {string} modified
|
|
478
|
+
* @param {string} serverModified
|
|
479
|
+
* @param {string} modifiedBy
|
|
480
|
+
* @param {string} account
|
|
481
|
+
* @param {string} accessGroup
|
|
482
|
+
* @param {string} reference
|
|
483
|
+
* @param {string} jobDate
|
|
484
|
+
* @param {string} jobStatus
|
|
485
|
+
* @param {string} jobType
|
|
486
|
+
* @param {string} assignee
|
|
487
|
+
* @param {string} formId
|
|
488
|
+
*/
|
|
489
|
+
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, reference, jobDate, jobStatus, jobType, assignee, formId) {
|
|
490
|
+
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
|
|
491
|
+
this.id = id;
|
|
492
|
+
this.created = created;
|
|
493
|
+
this.serverCreated = serverCreated;
|
|
494
|
+
this.createdBy = createdBy;
|
|
495
|
+
this.modified = modified;
|
|
496
|
+
this.serverModified = serverModified;
|
|
497
|
+
this.modifiedBy = modifiedBy;
|
|
498
|
+
this.account = account;
|
|
499
|
+
this.accessGroup = accessGroup;
|
|
500
|
+
this.reference = reference;
|
|
501
|
+
this.jobDate = jobDate;
|
|
502
|
+
this.jobStatus = jobStatus;
|
|
503
|
+
this.jobType = jobType;
|
|
504
|
+
this.assignee = assignee;
|
|
505
|
+
this.formId = formId;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Returns this with the dynamic interface
|
|
509
|
+
* @return {VasJobModelDynamicInterface}
|
|
510
|
+
*/
|
|
511
|
+
get $this() {
|
|
512
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
513
|
+
const $this = this;
|
|
514
|
+
return this;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Returns a list of Job dynamic properties i.e. those that are added by the
|
|
518
|
+
* dynamic forms
|
|
519
|
+
*/
|
|
520
|
+
get dynamicProperties() {
|
|
521
|
+
const nativeProps = this.staticProperties;
|
|
522
|
+
return Object
|
|
523
|
+
.getOwnPropertyNames(this)
|
|
524
|
+
.filter(prop => !nativeProps.includes(prop));
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Returns a list of Job static properties i.e. those that are declared by
|
|
528
|
+
* the type
|
|
529
|
+
*/
|
|
530
|
+
get staticProperties() {
|
|
531
|
+
return Object.getOwnPropertyNames(VasJobModel.empty());
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* @return {VasJobModel}
|
|
535
|
+
*/
|
|
536
|
+
static empty() {
|
|
537
|
+
return new VasJobModel(
|
|
538
|
+
// eslint-disable-next-line new-cap
|
|
539
|
+
UUID.UUID(), '', '', '', '', '', '', '', '', '', '', '', '', '', '');
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* @param {VasJobDto} jobDto
|
|
543
|
+
* @return {VasJobModel}
|
|
544
|
+
*/
|
|
545
|
+
static fromDto(jobDto) {
|
|
546
|
+
const model = new VasJobModel(
|
|
547
|
+
// eslint-disable-next-line new-cap
|
|
548
|
+
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 || '');
|
|
549
|
+
const emptyKeys = model.staticProperties;
|
|
550
|
+
Object
|
|
551
|
+
.keys(jobDto)
|
|
552
|
+
.filter(key => emptyKeys.indexOf(key) === -1)
|
|
553
|
+
.forEach((key) => model.$this[key] = jobDto[key]);
|
|
554
|
+
return model;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* @param {VasFormModel} formModel
|
|
558
|
+
* @return {Record<string, VasFieldDtoValue>}
|
|
559
|
+
*/
|
|
560
|
+
getFields(formModel) {
|
|
561
|
+
const fields = {};
|
|
562
|
+
formModel.groups
|
|
563
|
+
.forEach(group => {
|
|
564
|
+
group.controls.forEach(control => {
|
|
565
|
+
(fields)[control.reportTemplateName] =
|
|
566
|
+
this.getValueByPath([group.name, control.name]);
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
return fields;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* A very non sophisticated way to get values from the job via paths
|
|
573
|
+
*
|
|
574
|
+
* For example:
|
|
575
|
+
*
|
|
576
|
+
* getValueByPath(['foo', 'bar']);
|
|
577
|
+
*
|
|
578
|
+
* if job is
|
|
579
|
+
* {
|
|
580
|
+
* foo: {
|
|
581
|
+
* bar: 'value'
|
|
582
|
+
* }
|
|
583
|
+
* }
|
|
584
|
+
*
|
|
585
|
+
* will return "value"
|
|
586
|
+
*
|
|
587
|
+
* @param {string[]} path path segments
|
|
588
|
+
* @return {void}
|
|
589
|
+
*/
|
|
590
|
+
getValueByPath(path = []) {
|
|
591
|
+
switch (path.length) {
|
|
592
|
+
case 0: {
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
case 1: {
|
|
596
|
+
return (this.$this)[path[0]];
|
|
597
|
+
}
|
|
598
|
+
case 2: {
|
|
599
|
+
const val0 = this.$this[path[0]];
|
|
600
|
+
return val0[path[1]];
|
|
601
|
+
}
|
|
602
|
+
case 3: {
|
|
603
|
+
const val0 = this.$this[path[0]];
|
|
604
|
+
const val1 = val0[path[1]];
|
|
605
|
+
return val1[path[2]];
|
|
606
|
+
}
|
|
607
|
+
default: {
|
|
608
|
+
throw Error('path has too many segments');
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* A very non sophisticated way to set values in the job via paths
|
|
614
|
+
*
|
|
615
|
+
* For example:
|
|
616
|
+
*
|
|
617
|
+
* setValueByPath('value', ['foo', 'bar']);
|
|
618
|
+
*
|
|
619
|
+
* will make results in job
|
|
620
|
+
* {
|
|
621
|
+
* foo: {
|
|
622
|
+
* bar: 'value'
|
|
623
|
+
* }
|
|
624
|
+
* }
|
|
625
|
+
*
|
|
626
|
+
* @param {any} value the value to set
|
|
627
|
+
* @param {string[]} path path segments
|
|
628
|
+
*/
|
|
629
|
+
setValueByPath(value, path = []) {
|
|
630
|
+
switch (path.length) {
|
|
631
|
+
case 0: {
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
case 1: {
|
|
635
|
+
(this.$this)[path[0]] = value;
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
case 2: {
|
|
639
|
+
// eslint-disable-next-line max-len
|
|
640
|
+
this.$this[path[0]][path[1]] = value;
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
case 3: {
|
|
644
|
+
// eslint-disable-next-line max-len
|
|
645
|
+
this.$this[path[0]][path[1]][path[2]] = value;
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
default: {
|
|
649
|
+
throw Error('path has too many segments');
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* @param {boolean} staticOnly if true, will only output values for the static
|
|
655
|
+
* properties in the dto
|
|
656
|
+
* @return {VasJobDto}
|
|
657
|
+
*/
|
|
658
|
+
toDto(staticOnly = false) {
|
|
659
|
+
const dto = {};
|
|
660
|
+
this.staticProperties
|
|
661
|
+
.forEach(prop => (dto)[prop] = this.$this[prop]);
|
|
662
|
+
if (staticOnly) {
|
|
663
|
+
return dto;
|
|
664
|
+
}
|
|
665
|
+
this.dynamicProperties
|
|
666
|
+
.forEach(prop => dto[prop] = this.$this[prop]);
|
|
667
|
+
return dto;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
class VasReportRequestModel extends VasBaseModel {
|
|
672
|
+
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, error, jobId, title, url) {
|
|
673
|
+
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
|
|
674
|
+
this.id = id;
|
|
675
|
+
this.created = created;
|
|
676
|
+
this.serverCreated = serverCreated;
|
|
677
|
+
this.createdBy = createdBy;
|
|
678
|
+
this.modified = modified;
|
|
679
|
+
this.serverModified = serverModified;
|
|
680
|
+
this.modifiedBy = modifiedBy;
|
|
681
|
+
this.error = error;
|
|
682
|
+
this.jobId = jobId;
|
|
683
|
+
this.title = title;
|
|
684
|
+
this.url = url;
|
|
685
|
+
}
|
|
686
|
+
static fromDto(dto) {
|
|
687
|
+
return new VasReportRequestModel(dto.id || UUID.UUID(), dto.created || moment_().toISOString(), dto.serverCreated || '', dto.createdBy || '', dto.modified || moment_().toISOString(), dto.serverModified || '', dto.modifiedBy || '', dto.error || '', dto.jobId || '', dto.title || '', dto.url || '');
|
|
688
|
+
}
|
|
689
|
+
toDto() {
|
|
690
|
+
return {
|
|
691
|
+
id: this.id,
|
|
692
|
+
created: this.created,
|
|
693
|
+
serverCreated: this.serverCreated,
|
|
694
|
+
createdBy: this.createdBy,
|
|
695
|
+
modified: this.modified,
|
|
696
|
+
serverModified: this.serverModified,
|
|
697
|
+
modifiedBy: this.modifiedBy,
|
|
698
|
+
error: this.error,
|
|
699
|
+
jobId: this.jobId,
|
|
700
|
+
title: this.title,
|
|
701
|
+
url: this.url
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
class VasUserModel extends VasBaseModel {
|
|
707
|
+
constructor(id, created = '', serverCreated = '', createdBy = '', modified = '', serverModified = '', modifiedBy = '', email, username) {
|
|
708
|
+
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
|
|
709
|
+
this.id = id;
|
|
710
|
+
this.created = created;
|
|
711
|
+
this.serverCreated = serverCreated;
|
|
712
|
+
this.createdBy = createdBy;
|
|
713
|
+
this.modified = modified;
|
|
714
|
+
this.serverModified = serverModified;
|
|
715
|
+
this.modifiedBy = modifiedBy;
|
|
716
|
+
this.email = email;
|
|
717
|
+
this.username = username;
|
|
718
|
+
}
|
|
719
|
+
static fromDto(dto) {
|
|
720
|
+
return new VasUserModel(dto.id, dto.created, dto.serverCreated, dto.createdBy, dto.modified, dto.serverModified, dto.modifiedBy, dto.email, dto.username);
|
|
721
|
+
}
|
|
722
|
+
static newUser(uid, displayName, email) {
|
|
723
|
+
return {
|
|
724
|
+
id: uid,
|
|
725
|
+
created: moment_().toISOString(),
|
|
726
|
+
createdBy: uid,
|
|
727
|
+
modified: moment_().toISOString(),
|
|
728
|
+
modifiedBy: uid,
|
|
729
|
+
serverCreated: moment_().toISOString(),
|
|
730
|
+
serverModified: moment_().toISOString(),
|
|
731
|
+
email: email,
|
|
732
|
+
username: displayName,
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
toDto() {
|
|
736
|
+
return {
|
|
737
|
+
id: this.id,
|
|
738
|
+
created: this.created,
|
|
739
|
+
serverCreated: this.serverCreated,
|
|
740
|
+
createdBy: this.createdBy,
|
|
741
|
+
modified: this.modified,
|
|
742
|
+
serverModified: this.serverModified,
|
|
743
|
+
modifiedBy: this.modifiedBy,
|
|
744
|
+
email: this.email,
|
|
745
|
+
username: this.username
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Generated bundle index. Do not edit.
|
|
752
|
+
*/
|
|
753
|
+
|
|
754
|
+
export { VasBaseModel, VasControlConfigDirection, VasControlModel, VasControlTypeModel, VasFormModel, VasGroupModel, VasJobModel, VasReportRequestModel, VasUserModel };
|
|
755
|
+
//# sourceMappingURL=ironcode-vas-lib.mjs.map
|