@ironcode/vas-lib 2.3.0 → 3.0.0-alpha.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/cjs/lib/control-value/vas-camera-control-value.model.d.ts +2 -0
- package/cjs/lib/control-value/vas-camera-control-value.model.d.ts.map +1 -1
- package/cjs/lib/control-value/vas-camera-control-value.model.js +10 -0
- package/cjs/lib/control-value/vas-camera-control-value.model.js.map +1 -1
- package/cjs/lib/entity/vas-control.model.d.ts +4 -4
- package/cjs/lib/entity/vas-control.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-control.model.js +1 -1
- package/cjs/lib/entity/vas-control.model.js.map +1 -1
- package/cjs/lib/entity/vas-field.dto.d.ts +3 -5
- package/cjs/lib/entity/vas-field.dto.d.ts.map +1 -1
- package/cjs/lib/entity/vas-field.dto.js.map +1 -1
- package/cjs/lib/entity/vas-field.model.d.ts +4 -4
- package/cjs/lib/entity/vas-field.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-field.model.js.map +1 -1
- package/cjs/lib/entity/vas-form.model.d.ts +3 -3
- package/cjs/lib/entity/vas-form.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-form.model.js +1 -1
- package/cjs/lib/entity/vas-form.model.js.map +1 -1
- package/cjs/lib/entity/vas-group.model.d.ts +2 -2
- package/cjs/lib/entity/vas-group.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-group.model.js.map +1 -1
- package/cjs/lib/entity/vas-job.dto.d.ts +3 -6
- package/cjs/lib/entity/vas-job.dto.d.ts.map +1 -1
- package/cjs/lib/entity/vas-job.dto.js.map +1 -1
- package/cjs/lib/entity/vas-job.model.d.ts +10 -133
- package/cjs/lib/entity/vas-job.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-job.model.js +97 -324
- package/cjs/lib/entity/vas-job.model.js.map +1 -1
- package/cjs/lib/model/firebase-document-meta.interface.d.ts +6 -0
- package/cjs/lib/model/firebase-document-meta.interface.d.ts.map +1 -0
- package/cjs/lib/model/firebase-document-meta.interface.js +3 -0
- package/cjs/lib/model/firebase-document-meta.interface.js.map +1 -0
- package/cjs/lib/model/index.d.ts +1 -0
- package/cjs/lib/model/index.d.ts.map +1 -1
- package/cjs/lib/model/index.js +1 -0
- package/cjs/lib/model/index.js.map +1 -1
- package/cjs/lib/utils/get-value-by-path.d.ts +2 -3
- package/cjs/lib/utils/get-value-by-path.d.ts.map +1 -1
- package/cjs/lib/utils/get-value-by-path.js +1 -1
- package/cjs/lib/utils/get-value-by-path.js.map +1 -1
- package/cjs/lib/utils/is-plain-object.d.ts +2 -0
- package/cjs/lib/utils/is-plain-object.d.ts.map +1 -0
- package/cjs/lib/utils/is-plain-object.js +7 -0
- package/cjs/lib/utils/is-plain-object.js.map +1 -0
- package/cjs/lib/utils/try-json.d.ts +6 -0
- package/cjs/lib/utils/try-json.d.ts.map +1 -0
- package/cjs/lib/utils/try-json.js +20 -0
- package/cjs/lib/utils/try-json.js.map +1 -0
- package/fesm2022/ironcode-vas-lib.mjs +126 -328
- package/fesm2022/ironcode-vas-lib.mjs.map +1 -1
- package/lib/control-value/vas-camera-control-value.model.d.ts +2 -0
- package/lib/entity/vas-control.model.d.ts +4 -4
- package/lib/entity/vas-field.dto.d.ts +3 -5
- package/lib/entity/vas-field.model.d.ts +4 -4
- package/lib/entity/vas-form.model.d.ts +3 -3
- package/lib/entity/vas-group.model.d.ts +2 -2
- package/lib/entity/vas-job.dto.d.ts +3 -6
- package/lib/entity/vas-job.model.d.ts +10 -133
- package/lib/model/firebase-document-meta.interface.d.ts +5 -0
- package/lib/model/index.d.ts +1 -0
- package/lib/utils/get-value-by-path.d.ts +2 -3
- package/lib/utils/is-plain-object.d.ts +1 -0
- package/lib/utils/try-json.d.ts +5 -0
- package/package.json +1 -1
- package/cjs/lib/entity/vas-job.model.spec-data.d.ts +0 -2
- package/cjs/lib/entity/vas-job.model.spec-data.d.ts.map +0 -1
- package/cjs/lib/entity/vas-job.model.spec-data.js +0 -29
- package/cjs/lib/entity/vas-job.model.spec-data.js.map +0 -1
- package/lib/utils/is-array-string.d.ts +0 -1
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { VasFileDto } from './vas-file.dto';
|
|
2
2
|
import { VasBaseDto } from './vas-base.dto';
|
|
3
|
-
import {
|
|
3
|
+
import { FieldValueType } from './vas-field.dto';
|
|
4
4
|
import { VasFormModel } from './vas-form.model';
|
|
5
5
|
import { VasJobDto } from './vas-job.dto';
|
|
6
6
|
import { VasRestrictedAccountObjectModel } from './vas-restricted-account-object.model';
|
|
7
7
|
import { GeoLocation } from '../model';
|
|
8
|
-
import { VasFormDto } from './vas-form.dto';
|
|
9
8
|
import { VasReportDto } from './vas-report.dto';
|
|
10
9
|
import { VasTaskDto } from './vas-task.dto';
|
|
11
10
|
import { VasNoteDto } from './vas-note.dto';
|
|
12
11
|
import { VasJobEmailDto } from './vas-job-email.dto';
|
|
13
12
|
import { VasInstructionDto } from './vas-instruction.dto';
|
|
14
|
-
export declare interface VasJobModelDynamicInterface {
|
|
15
|
-
[s: string]: string | number | Record<string, VasFieldDtoValue>;
|
|
16
|
-
}
|
|
17
13
|
export interface ParseSyntaxOptions {
|
|
18
14
|
timeZoneOffset: number;
|
|
19
|
-
objects?: Record<string, Partial<VasBaseDto> | Record<string,
|
|
15
|
+
objects?: Record<string, Partial<VasBaseDto> | Record<string, FieldValueType>>;
|
|
20
16
|
}
|
|
21
17
|
/**
|
|
22
18
|
* JobModel
|
|
@@ -43,58 +39,26 @@ export declare class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
43
39
|
pendingFields: number;
|
|
44
40
|
childModified: string;
|
|
45
41
|
version: number;
|
|
46
|
-
createdByDisplayName: string;
|
|
47
|
-
modifiedByDisplayName: string;
|
|
48
42
|
geoLocation: GeoLocation;
|
|
49
43
|
files: Array<VasFileDto>;
|
|
50
|
-
fields:
|
|
44
|
+
fields: Record<string, FieldValueType>;
|
|
51
45
|
jobEmails: Array<VasJobEmailDto>;
|
|
52
46
|
notes: Array<VasNoteDto>;
|
|
53
47
|
reports: Array<VasReportDto>;
|
|
54
48
|
tasks: Array<VasTaskDto>;
|
|
55
49
|
instruction: VasInstructionDto | null;
|
|
56
|
-
constructor(id: string, created: string, serverCreated: string, createdBy: string, modified: string, serverModified: string, modifiedBy: string, createdByName: string, modifiedByName: string, account: string, accessGroup: string, reference: string, jobDate: string, jobStatus: string, jobType: string, assigneeId: string, formId: string, timeZoneOffset: number, pendingFields: number, childModified: string, version: number,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
* @return {VasJobModelDynamicInterface}
|
|
60
|
-
*/
|
|
61
|
-
get $this(): VasJobModelDynamicInterface;
|
|
50
|
+
constructor(id: string, created: string, serverCreated: string, createdBy: string, modified: string, serverModified: string, modifiedBy: string, createdByName: string, modifiedByName: string, account: string, accessGroup: string, reference: string, jobDate: string, jobStatus: string, jobType: string, assigneeId: string, formId: string, timeZoneOffset: number, pendingFields: number, childModified: string, version: number, geoLocation: GeoLocation, files: Array<VasFileDto>, fields: Record<string, FieldValueType>, jobEmails: Array<VasJobEmailDto>, notes: Array<VasNoteDto>, reports: Array<VasReportDto>, tasks: Array<VasTaskDto>, instruction: VasInstructionDto | null);
|
|
51
|
+
get createdByDisplayName(): string;
|
|
52
|
+
get modifiedByDisplayName(): string;
|
|
62
53
|
/**
|
|
63
|
-
*
|
|
64
|
-
* dynamic forms
|
|
54
|
+
* Return the list of Job properties
|
|
65
55
|
*/
|
|
66
|
-
get
|
|
67
|
-
/**
|
|
68
|
-
* Returns the list of properties of the Job type
|
|
69
|
-
*/
|
|
70
|
-
get staticProperties(): Array<string>;
|
|
56
|
+
get staticProperties(): Set<string>;
|
|
71
57
|
/**
|
|
72
58
|
* @return {VasJobModel}
|
|
73
59
|
*/
|
|
74
60
|
static empty(): VasJobModel;
|
|
75
61
|
static fromDto(dto: Partial<VasJobDto>): VasJobModel;
|
|
76
|
-
/**
|
|
77
|
-
* This method will instantiate a new JobModel. The difference with this
|
|
78
|
-
* method of instantiation is that we are coming from a relation frame i.e.
|
|
79
|
-
* the job has a list of {@link VasFieldDto} instead of a Job document.
|
|
80
|
-
*
|
|
81
|
-
*/
|
|
82
|
-
static fromRelational(dto: Partial<VasJobDto>, form: VasFormDto): VasJobModel;
|
|
83
|
-
/**
|
|
84
|
-
* @param {VasFormModel} formModel
|
|
85
|
-
* @return {Record<string, VasFieldDtoValue>}
|
|
86
|
-
*/
|
|
87
|
-
getFields(formModel: VasFormModel): Record<string, VasFieldDtoValue>;
|
|
88
|
-
/**
|
|
89
|
-
* Will return an object whose keys are the names of all fields in the job.
|
|
90
|
-
* This method is similar to `getFields` except that this method will only
|
|
91
|
-
* return values where a value was set, as opposed to `getFields` which will
|
|
92
|
-
* return a value for every control even if no value was set, because it uses
|
|
93
|
-
* the form to drive the logic. Note also this method will return values for
|
|
94
|
-
* any Fields in the fields array.
|
|
95
|
-
* @return {Record<string, VasFieldDtoValue>}
|
|
96
|
-
*/
|
|
97
|
-
getFields2(): Record<string, VasFieldDtoValue>;
|
|
98
62
|
/**
|
|
99
63
|
* Returns an object describing how many attachments were added to this job
|
|
100
64
|
* (camera controls and files), and how many have not been uploaded yet.
|
|
@@ -107,97 +71,10 @@ export declare class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
|
107
71
|
total: number;
|
|
108
72
|
};
|
|
109
73
|
/**
|
|
110
|
-
* This method will return the dynamic property from the JobModel that
|
|
111
|
-
* represent a group (from a form).
|
|
112
|
-
*
|
|
113
|
-
* @param name the name of the group
|
|
114
|
-
* @param init if true (default) and group is not found, initialise an empty
|
|
115
|
-
* group, otherwise throw an error
|
|
116
|
-
*/
|
|
117
|
-
getGroup(name: string, init?: boolean): Record<string, VasFieldDtoValue>;
|
|
118
|
-
/**
|
|
119
|
-
* @param path path segments
|
|
120
|
-
*/
|
|
121
|
-
getValueByPath<T extends VasFieldDtoValue>(path?: string[]): T | undefined;
|
|
122
|
-
/**
|
|
123
|
-
* In order to understand why we need this method it is important to
|
|
124
|
-
* understand that within the system, Jobs can be represented in one of two
|
|
125
|
-
* ways, document and relational.
|
|
126
|
-
*
|
|
127
|
-
* The important distinction is how values submitted by a form are stored.
|
|
128
|
-
*
|
|
129
|
-
* Jobs stored as documents (JSON objects) will store user values, as dynamic
|
|
130
|
-
* properties of the document.
|
|
131
|
-
*
|
|
132
|
-
* Whereas, Jobs stored as relational, will store user values in an array of
|
|
133
|
-
* {@link VasFieldDto} objects.
|
|
134
|
-
*
|
|
135
|
-
* Depending on where we are in the system, either one of these approaches can
|
|
136
|
-
* be more useful than the other.
|
|
137
|
-
*
|
|
138
|
-
* This method, assumes that the JobModel has been instantiated from a
|
|
139
|
-
* document representation, and serves to hydrate the fields array. In order
|
|
140
|
-
* to achieve this, knowledge of the {@link VasFormDto} that created the job
|
|
141
|
-
* is required.
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* Job in document representation
|
|
145
|
-
* {
|
|
146
|
-
* id: <guid>,
|
|
147
|
-
* reference: "something"
|
|
148
|
-
* <other static job properties>...
|
|
149
|
-
* foo: {
|
|
150
|
-
* bar: "value"
|
|
151
|
-
* }
|
|
152
|
-
* }
|
|
153
|
-
*
|
|
154
|
-
* Job in relational representation
|
|
155
|
-
* {
|
|
156
|
-
* id: <guid>,
|
|
157
|
-
* reference: "something"
|
|
158
|
-
* <other static job properties>...
|
|
159
|
-
* <will not have dynamic properties>...
|
|
160
|
-
* fields: [
|
|
161
|
-
* {
|
|
162
|
-
* id: <guid>,
|
|
163
|
-
* <other field properties>,
|
|
164
|
-
* value: "value"
|
|
165
|
-
* }
|
|
166
|
-
* ]
|
|
167
|
-
* }
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* @param formModel the VasFormModel that was used to create the job
|
|
171
|
-
* @param controlFieldIdMap This is used to determine the id each field.
|
|
172
|
-
* Either one will be found in the map, or a new one is generated.
|
|
173
|
-
* @param controlNames if a value is provided, it will be used
|
|
174
|
-
* to filter the fields that are returned.
|
|
175
|
-
* @return {Array<VasFieldDto>}
|
|
176
|
-
*/
|
|
177
|
-
hydrateFields(formModel: VasFormModel, controlFieldIdMap?: Map<string, string>, controlNames?: Array<string>): void;
|
|
178
|
-
/**
|
|
179
|
-
* A very non sophisticated way to set values in the job via paths
|
|
180
|
-
*
|
|
181
|
-
* For example:
|
|
182
|
-
*
|
|
183
|
-
* setValueByPath('value', ['foo', 'bar']);
|
|
184
|
-
*
|
|
185
|
-
* will make results in job
|
|
186
|
-
* {
|
|
187
|
-
* foo: {
|
|
188
|
-
* bar: 'value'
|
|
189
|
-
* }
|
|
190
|
-
* }
|
|
191
|
-
*
|
|
192
|
-
* @param value the value to set
|
|
193
74
|
* @param path path segments
|
|
194
75
|
*/
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
* @param staticOnly if true, will only output values for the static
|
|
198
|
-
* properties in the dto
|
|
199
|
-
*/
|
|
200
|
-
toDto(staticOnly?: boolean): VasJobDto;
|
|
76
|
+
getValueByPath<T>(path?: string | string[]): T | undefined;
|
|
77
|
+
toDto(): VasJobDto;
|
|
201
78
|
/**
|
|
202
79
|
* This method will parse a syntax that allows us to build strings from the
|
|
203
80
|
* values of from the job model. For example if the job model was:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vas-job.model.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-job.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"vas-job.model.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-job.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAe,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM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