@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.
- package/cjs/lib/entity/index.d.ts +4 -0
- package/cjs/lib/entity/index.d.ts.map +1 -1
- package/cjs/lib/entity/index.js +4 -0
- package/cjs/lib/entity/index.js.map +1 -1
- package/cjs/lib/entity/vas-account-config.dto.d.ts +2 -4
- package/cjs/lib/entity/vas-account-config.dto.d.ts.map +1 -1
- package/cjs/lib/entity/vas-account-config.dto.js.map +1 -1
- package/cjs/lib/entity/vas-account-object.model.d.ts +1 -0
- package/cjs/lib/entity/vas-account-object.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-account-object.model.js +7 -0
- package/cjs/lib/entity/vas-account-object.model.js.map +1 -1
- package/cjs/lib/entity/vas-field.dto.d.ts +1 -1
- package/cjs/lib/entity/vas-field.dto.js.map +1 -1
- package/cjs/lib/entity/vas-field.model.d.ts +44 -0
- package/cjs/lib/entity/vas-field.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-field.model.js +88 -0
- package/cjs/lib/entity/vas-field.model.js.map +1 -0
- package/cjs/lib/entity/vas-file.dto.d.ts +11 -7
- 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 +37 -0
- package/cjs/lib/entity/vas-file.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-file.model.js +102 -0
- package/cjs/lib/entity/vas-file.model.js.map +1 -0
- package/cjs/lib/entity/vas-form.model.d.ts +5 -5
- package/cjs/lib/entity/vas-form.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-form.model.js +4 -4
- package/cjs/lib/entity/vas-form.model.js.map +1 -1
- package/cjs/lib/entity/vas-group.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-group.model.js +1 -0
- package/cjs/lib/entity/vas-group.model.js.map +1 -1
- package/cjs/lib/entity/vas-job-data.model.d.ts +28 -0
- package/cjs/lib/entity/vas-job-data.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-job-data.model.js +34 -0
- package/cjs/lib/entity/vas-job-data.model.js.map +1 -0
- package/cjs/lib/entity/vas-job.dto.d.ts +8 -2
- 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 +105 -10
- package/cjs/lib/entity/vas-job.model.d.ts.map +1 -1
- package/cjs/lib/entity/vas-job.model.js +139 -9
- package/cjs/lib/entity/vas-job.model.js.map +1 -1
- package/cjs/lib/entity/vas-report-layout.model.d.ts +18 -0
- package/cjs/lib/entity/vas-report-layout.model.d.ts.map +1 -0
- package/cjs/lib/entity/vas-report-layout.model.js +24 -0
- package/cjs/lib/entity/vas-report-layout.model.js.map +1 -0
- package/esm2020/lib/entity/index.mjs +5 -1
- package/esm2020/lib/entity/vas-account-config.dto.mjs +1 -1
- package/esm2020/lib/entity/vas-account-object.model.mjs +8 -1
- package/esm2020/lib/entity/vas-field.dto.mjs +1 -1
- package/esm2020/lib/entity/vas-field.model.mjs +88 -0
- package/esm2020/lib/entity/vas-file.dto.mjs +1 -1
- package/esm2020/lib/entity/vas-file.model.mjs +104 -0
- package/esm2020/lib/entity/vas-form.model.mjs +5 -5
- package/esm2020/lib/entity/vas-group.model.mjs +2 -1
- package/esm2020/lib/entity/vas-job-data.model.mjs +30 -0
- package/esm2020/lib/entity/vas-job.dto.mjs +1 -1
- package/esm2020/lib/entity/vas-job.model.mjs +150 -10
- package/esm2020/lib/entity/vas-report-layout.model.mjs +20 -0
- package/fesm2015/ironcode-vas-lib.mjs +374 -11
- package/fesm2015/ironcode-vas-lib.mjs.map +1 -1
- package/fesm2020/ironcode-vas-lib.mjs +394 -11
- package/fesm2020/ironcode-vas-lib.mjs.map +1 -1
- package/lib/entity/index.d.ts +4 -0
- package/lib/entity/vas-account-config.dto.d.ts +2 -4
- package/lib/entity/vas-account-object.model.d.ts +1 -0
- package/lib/entity/vas-field.dto.d.ts +1 -1
- package/lib/entity/vas-field.model.d.ts +43 -0
- package/lib/entity/vas-file.dto.d.ts +11 -7
- package/lib/entity/vas-file.model.d.ts +36 -0
- package/lib/entity/vas-form.model.d.ts +5 -5
- package/lib/entity/vas-job-data.model.d.ts +27 -0
- package/lib/entity/vas-job.dto.d.ts +8 -2
- package/lib/entity/vas-job.model.d.ts +105 -10
- package/lib/entity/vas-report-layout.model.d.ts +17 -0
- package/package.json +2 -3
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { VasAccountObjectModel } from './vas-account-object.model';
|
|
2
|
+
/**
|
|
3
|
+
* VasJobDataModel
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class VasJobDataModel extends VasAccountObjectModel {
|
|
6
|
+
id: string;
|
|
7
|
+
created: string;
|
|
8
|
+
serverCreated: string;
|
|
9
|
+
createdBy: string;
|
|
10
|
+
modified: string;
|
|
11
|
+
serverModified: string;
|
|
12
|
+
modifiedBy: string;
|
|
13
|
+
account: string;
|
|
14
|
+
job: string;
|
|
15
|
+
/**
|
|
16
|
+
* @param {string} id
|
|
17
|
+
* @param {string} created
|
|
18
|
+
* @param {string} serverCreated
|
|
19
|
+
* @param {string} createdBy
|
|
20
|
+
* @param {string} modified
|
|
21
|
+
* @param {string} serverModified
|
|
22
|
+
* @param {string} modifiedBy
|
|
23
|
+
* @param {string} account
|
|
24
|
+
* @param {string} job
|
|
25
|
+
*/
|
|
26
|
+
constructor(id: string, created: string, serverCreated: string, createdBy: string, modified: string, serverModified: string, modifiedBy: string, account: string, job: string);
|
|
27
|
+
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
import { VasFileDto } from './vas-file.dto';
|
|
1
2
|
import { VasRestrictedAccountObjectDto } from './vas-restricted-account-object.dto';
|
|
2
|
-
import { VasFieldDtoValue } from './vas-field.dto';
|
|
3
|
+
import { VasFieldDto, VasFieldDtoValue } from './vas-field.dto';
|
|
3
4
|
export interface VasJobStaticDto extends VasRestrictedAccountObjectDto {
|
|
4
5
|
reference: string;
|
|
5
6
|
jobDate: string;
|
|
6
7
|
jobStatus: string;
|
|
7
8
|
jobType: string;
|
|
8
|
-
|
|
9
|
+
assigneeId: string;
|
|
9
10
|
formId: string;
|
|
10
11
|
timeZoneOffset: number;
|
|
12
|
+
pendingFields: number;
|
|
13
|
+
childModified: string;
|
|
14
|
+
version: number;
|
|
15
|
+
files: Array<VasFileDto>;
|
|
16
|
+
fields: Array<VasFieldDto>;
|
|
11
17
|
}
|
|
12
18
|
export declare type VasJobDto = VasJobStaticDto & Record<string, VasFieldDtoValue>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VasBaseModel } from './vas-base.model';
|
|
3
|
-
import { VasFieldDtoValue } from './vas-field.dto';
|
|
4
|
-
import { VasFormModel } from './vas-form.model';
|
|
1
|
+
import { VasFileDto } from './vas-file.dto';
|
|
5
2
|
import { VasBaseDto } from './vas-base.dto';
|
|
6
|
-
|
|
3
|
+
import { VasFieldDto, VasFieldDtoValue } from './vas-field.dto';
|
|
4
|
+
import { VasFormModel } from './vas-form.model';
|
|
5
|
+
import { VasJobDto } from './vas-job.dto';
|
|
6
|
+
import { VasRestrictedAccountObjectModel } from './vas-restricted-account-object.model';
|
|
7
|
+
export declare interface VasJobModelDynamicInterface {
|
|
7
8
|
[s: string]: string | number | Record<string, VasFieldDtoValue>;
|
|
8
9
|
}
|
|
9
10
|
export interface ParseSyntaxOptions {
|
|
@@ -13,7 +14,7 @@ export interface ParseSyntaxOptions {
|
|
|
13
14
|
/**
|
|
14
15
|
* JobModel
|
|
15
16
|
*/
|
|
16
|
-
export declare class VasJobModel extends
|
|
17
|
+
export declare class VasJobModel extends VasRestrictedAccountObjectModel {
|
|
17
18
|
id: string;
|
|
18
19
|
created: string;
|
|
19
20
|
serverCreated: string;
|
|
@@ -27,9 +28,14 @@ export declare class VasJobModel extends VasBaseModel {
|
|
|
27
28
|
jobDate: string;
|
|
28
29
|
jobStatus: string;
|
|
29
30
|
jobType: string;
|
|
30
|
-
|
|
31
|
+
assigneeId: string;
|
|
31
32
|
formId: string;
|
|
32
33
|
timeZoneOffset: number;
|
|
34
|
+
pendingFields: number;
|
|
35
|
+
childModified: string;
|
|
36
|
+
version: number;
|
|
37
|
+
fields: Array<VasFieldDto>;
|
|
38
|
+
files: Array<VasFileDto>;
|
|
33
39
|
/**
|
|
34
40
|
* @param {string} id
|
|
35
41
|
* @param {string} created
|
|
@@ -44,11 +50,16 @@ export declare class VasJobModel extends VasBaseModel {
|
|
|
44
50
|
* @param {string} jobDate
|
|
45
51
|
* @param {string} jobStatus
|
|
46
52
|
* @param {string} jobType
|
|
47
|
-
* @param {string}
|
|
53
|
+
* @param {string} assigneeId
|
|
48
54
|
* @param {string} formId
|
|
49
55
|
* @param {number} timeZoneOffset
|
|
56
|
+
* @param {number} pendingFields
|
|
57
|
+
* @param {string} childModified
|
|
58
|
+
* @param {number} version
|
|
59
|
+
* @param {Array<VasFieldDto>} fields
|
|
60
|
+
* @param {Array<VasFileDto>} files
|
|
50
61
|
*/
|
|
51
|
-
constructor(id: string, created: string, serverCreated: string, createdBy: string, modified: string, serverModified: string, modifiedBy: string, account: string, accessGroup: string, reference: string, jobDate: string, jobStatus: string, jobType: string,
|
|
62
|
+
constructor(id: string, created: string, serverCreated: string, createdBy: string, modified: string, serverModified: string, modifiedBy: 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, fields: Array<VasFieldDto>, files: Array<VasFileDto>);
|
|
52
63
|
/**
|
|
53
64
|
* Returns this with the dynamic interface
|
|
54
65
|
* @return {VasJobModelDynamicInterface}
|
|
@@ -87,6 +98,87 @@ export declare class VasJobModel extends VasBaseModel {
|
|
|
87
98
|
* @return {Record<string, VasFieldDtoValue>}
|
|
88
99
|
*/
|
|
89
100
|
getFields2(): Record<string, VasFieldDtoValue>;
|
|
101
|
+
/**
|
|
102
|
+
* This method will hydrate the `fields` property of the model. The reason for
|
|
103
|
+
* this is that we have different ways to store the field data. One way, is
|
|
104
|
+
* we store them as dynamic properties of the job. For example job.foo.bar,
|
|
105
|
+
* where `foo` is the name of a Group, and `bar` is the name of a control.
|
|
106
|
+
* Thus, when we create a job using a form in the client, the job object will
|
|
107
|
+
* have its static properties (id, account, reference etc), and also a number
|
|
108
|
+
* of dynamic properties determined by the Groups and Controls. This kind of
|
|
109
|
+
* object is nice to work with in certain circumstances. However, the api
|
|
110
|
+
* works differently. In the API a Job is a record, and references a number of
|
|
111
|
+
* Field records. Each Field stores the value. Comparing these two models we
|
|
112
|
+
* have:
|
|
113
|
+
* A) job with dynamic properties, e.g.
|
|
114
|
+
* {
|
|
115
|
+
* id: <guid>,
|
|
116
|
+
* reference: "something"
|
|
117
|
+
* <other static job properties>...
|
|
118
|
+
* foo: {
|
|
119
|
+
* bar: "value"
|
|
120
|
+
* }
|
|
121
|
+
* }
|
|
122
|
+
*
|
|
123
|
+
* B) job with fields
|
|
124
|
+
* {
|
|
125
|
+
* id: <guid>,
|
|
126
|
+
* reference: "something"
|
|
127
|
+
* <other static job properties>...
|
|
128
|
+
* <will not have dynamic properties>...
|
|
129
|
+
* fields: [
|
|
130
|
+
* {
|
|
131
|
+
* id: <guid>,
|
|
132
|
+
* <other field properties>,
|
|
133
|
+
* value: "value"
|
|
134
|
+
* }
|
|
135
|
+
* ]
|
|
136
|
+
* }
|
|
137
|
+
*
|
|
138
|
+
* So, what this method does is given a JobModel in the form of A, read all
|
|
139
|
+
* of those dynamic properties and set them into `fields`. Doing this requires
|
|
140
|
+
* knowledge of the Form that was used to create the job. Moreover, since the
|
|
141
|
+
* dynamic properties do not contain the ids of the fields, we also allow to
|
|
142
|
+
* pass in a `controlFieldIdMap`. This map stores the mapping between Control
|
|
143
|
+
* and the Field that was created in the Job to store the value for that
|
|
144
|
+
* Control. This is useful, if for example you want to compare a Job in form A
|
|
145
|
+
* with a Job in form B, for example if you want to update the Job on the API
|
|
146
|
+
* with a Job that was saved by a client in form A.
|
|
147
|
+
*
|
|
148
|
+
* E.g.
|
|
149
|
+
* Client -> API: client requests form
|
|
150
|
+
* User -> Client: user fills in the form and submits
|
|
151
|
+
* Client -> Firestore: client saves the Job in form A i.e. dynamic props
|
|
152
|
+
* Firestore -> Function: A function is triggered to sync the job to the API
|
|
153
|
+
* Function -> API: Function checks if job already exists, it receives 404
|
|
154
|
+
* Function -> Function: The function calls `hydrateFields(...)`
|
|
155
|
+
* Function -> API: The function POST the Job to /jobs
|
|
156
|
+
* Function -> API: The function POST each field to /fields
|
|
157
|
+
*
|
|
158
|
+
* Similarly, if the user updates the job
|
|
159
|
+
* Client -> API: client requests form
|
|
160
|
+
* User -> Client: user fills in the form and submits an update
|
|
161
|
+
* Client -> Firestore: client saves the Job in form A i.e. dynamic props
|
|
162
|
+
* Firestore -> Function: A function is triggered to sync the job to the API
|
|
163
|
+
* Function -> API: Function checks if job already exists, it receives 200
|
|
164
|
+
* Function -> Function: The function calls `hydrateFields(...)` passing in
|
|
165
|
+
* the map is made by iterating over the fields it
|
|
166
|
+
* received from the API and storing the mappings
|
|
167
|
+
* between controlId and fieldId for each field
|
|
168
|
+
* Function -> API: The function PATCH the Job to /jobs
|
|
169
|
+
* Function -> API: The function POST/PATCH each field to /fields
|
|
170
|
+
* treated as new
|
|
171
|
+
*
|
|
172
|
+
* @param {VasFormModel} formModel the VasFormModel that was used to create
|
|
173
|
+
* the job
|
|
174
|
+
* @param {Map<string, string>} controlFieldIdMap a mapping of control to
|
|
175
|
+
* field ids. This is used to determine whether a new id for the field should
|
|
176
|
+
* be generated, or to reuse an existing one from the map.
|
|
177
|
+
* @param {Array<string>} controlNames if a value is provided, it will be used
|
|
178
|
+
* to filter the fields that are returned.
|
|
179
|
+
* @return {Array<VasFieldDto>}
|
|
180
|
+
*/
|
|
181
|
+
hydrateFields(formModel: VasFormModel, controlFieldIdMap?: Map<string, string>, controlNames?: Array<string>): void;
|
|
90
182
|
/**
|
|
91
183
|
|
|
92
184
|
* @param {string[]} path path segments
|
|
@@ -144,5 +236,8 @@ export declare class VasJobModel extends VasBaseModel {
|
|
|
144
236
|
* @return {string} the results of parsing the syntax on this job
|
|
145
237
|
*/
|
|
146
238
|
parseSyntax(value: string, options?: ParseSyntaxOptions): string;
|
|
239
|
+
/**
|
|
240
|
+
* @return {object}
|
|
241
|
+
*/
|
|
242
|
+
toApiDto(): Record<string, string | number | boolean>;
|
|
147
243
|
}
|
|
148
|
-
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { VasRestrictedAccountObjectModel } from './vas-restricted-account-object.model';
|
|
2
|
+
export declare class VasReportLayoutModel extends VasRestrictedAccountObjectModel {
|
|
3
|
+
id: string;
|
|
4
|
+
created: string;
|
|
5
|
+
serverCreated: string;
|
|
6
|
+
createdBy: string;
|
|
7
|
+
modified: string;
|
|
8
|
+
serverModified: string;
|
|
9
|
+
modifiedBy: string;
|
|
10
|
+
account: string;
|
|
11
|
+
accessGroup: string;
|
|
12
|
+
jobType: string;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
entryPoint: string;
|
|
16
|
+
constructor(id: string, created: string, serverCreated: string, createdBy: string, modified: string, serverModified: string, modifiedBy: string, account: string, accessGroup: string, jobType: string, title: string, description: string, entryPoint: string);
|
|
17
|
+
}
|
package/package.json
CHANGED