@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.
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vas-form.model.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-form.model.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAChD,uDAAkD;AAGlD,qEAA+D;AAK/D;;GAEG;AACH,MAAa,YAAa,SAAQ,6BAAY;IAC5C;;;;;;;;;;;;;;;;;;OAkBG;IACH,YACkB,EAAU,EACV,OAAe,EACf,aAAqB,EACrB,SAAiB,EACjB,QAAgB,EAChB,cAAsB,EACtB,UAAkB,EAC3B,OAAe,EACf,WAAmB,EACnB,OAAe,EACf,KAAa,EACb,WAAmB,EACnB,MAAuB,EACvB,iBAAyB,EACzB,SAAiB,EACjB,YAAoB,EACpB,MAAc;QAErB,KAAK,CACH,EAAE,EACF,OAAO,EACP,aAAa,EACb,SAAS,EACT,QAAQ,EACR,cAAc,EACd,UAAU,CACX,CAAC;QA1Bc,OAAE,GAAF,EAAE,CAAQ;QACV,YAAO,GAAP,OAAO,CAAQ;QACf,kBAAa,GAAb,aAAa,CAAQ;QACrB,cAAS,GAAT,SAAS,CAAQ;QACjB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,mBAAc,GAAd,cAAc,CAAQ;QACtB,eAAU,GAAV,UAAU,CAAQ;QAC3B,YAAO,GAAP,OAAO,CAAQ;QACf,gBAAW,GAAX,WAAW,CAAQ;QACnB,YAAO,GAAP,OAAO,CAAQ;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ControlModel } from './vas-control.model';\nimport { VasFormDto } from './vas-form.dto';\nimport { VasControlTypeModel } from './vas-control-type.model';\nimport { VasControlTypeDto } from './vas-control-type.dto';\nimport { VasFieldDtoValue } from './vas-field.dto';\nimport { VasJobModel } from './vas-job.model';\n\n/**\n * VasFormModel\n */\nexport class VasFormModel extends VasBaseModel {\n /**\n * @param {string} id\n * @param {string} created\n * @param {string} serverCreated\n * @param {string} createdBy\n * @param {string} modified\n * @param {string} serverModified\n * @param {string} modifiedBy\n * @param {string} account\n * @param {string} accessGroup\n * @param {string} jobType\n * @param {string} title\n * @param {string} description\n * @param {VasGroupModel[]} groups\n * @param {string} dynamicDescriptor\n * @param {string} indexName\n * @param {string} pipelineName\n * @param {string} config\n */\n constructor(\n public override id: string,\n public override created: string,\n public override serverCreated: string,\n public override createdBy: string,\n public override modified: string,\n public override serverModified: string,\n public override modifiedBy: string,\n public account: string,\n public accessGroup: string,\n public jobType: string,\n public title: string,\n public description: string,\n public groups: VasGroupModel[],\n public dynamicDescriptor: string,\n public indexName: string,\n public pipelineName: string,\n public config: string\n ) {\n super(\n id,\n created,\n serverCreated,\n createdBy,\n modified,\n serverModified,\n modifiedBy\n );\n }\n\n /**\n * Returns the name of this form in a \"safe\" way, i.e. no spaces, special\n * characters\n * @return {string}\n */\n get safeTitle(): string {\n return this.title\n .replace(/[^a-z0-9]/gi, '-')\n .replace(/-+/g, '-')\n .toLowerCase();\n }\n\n\n /**\n * The VAS API response for Form will inline Group and Control but not\n * ControlType. This method is a help which will allows us to construct an\n * instance of VasFormModel with the ControlType model set appropriately into\n * each VasControlModel\n * @param {VasFormDto} formDto\n * @param {Array<VasControlTypeDto>} controlTypeDtos\n * @return {VasFormModel}\n */\n public static fromApiResponse(\n formDto: VasFormDto,\n controlTypeDtos: Array<VasControlTypeDto>\n ): VasFormModel {\n const controlTypeModels = controlTypeDtos\n .map(ctDto => VasControlTypeModel.fromDto(ctDto));\n const formModel = VasFormModel.fromDto(formDto);\n formModel.groups\n .forEach(group => {\n group.controls\n .forEach(control => {\n control.controlTypeModel = controlTypeModels\n .find(ct => ct.id === control.controlType);\n });\n });\n return formModel;\n }\n\n /**\n * @param {VasFormDto} dto\n * @return {VasFormModel}\n */\n public static fromDto(dto: Partial<VasFormDto>): VasFormModel {\n return new VasFormModel(\n dto.id || '',\n dto.created || '',\n dto.serverCreated || '',\n dto.createdBy || '',\n dto.modified || '',\n dto.serverModified || '',\n dto.modifiedBy || '',\n dto.account || '',\n dto.accessGroup || '',\n dto.jobType || '',\n dto.title || '',\n dto.description || '',\n (dto.groups || [])\n .sort((a, b) => a.sequence - b.sequence)\n .map(g => VasGroupModel.fromDto(g)),\n dto.dynamicDescriptor || '',\n dto.indexName || '',\n dto.pipelineName || '',\n dto.config || ''\n );\n }\n\n addControlTypesToControl(controlTypes: Array<VasControlTypeDto>): void {\n const controlTypeModels = controlTypes\n .map(ct => VasControlTypeModel.fromDto(ct))\n this.groups\n .forEach(group => {\n group.controls\n .forEach(control => {\n control.controlTypeModel = controlTypeModels\n .find(ctm => ctm.id === control.controlType)\n });\n });\n }\n\n /**\n * @param {string} id\n * @return {VasControlModel | undefined}\n */\n findControlModelById(id: string): VasControlModel | undefined {\n let result;\n this.groups\n .find(group => group.controls\n .find(control => {\n if (control.id !== id) {\n return;\n }\n result = control;\n return true;\n }));\n return result;\n }\n\n /**\n *\n * @param {string} name\n * @return {VasControlModel | undefined}\n */\n findControlModelByName(name: string): VasControlModel | undefined {\n let result;\n this.groups\n .find(group => group.controls\n .find(control => {\n if (control.name !== name) {\n return;\n }\n result = control;\n return true;\n }));\n return result;\n }\n\n /**\n *\n * @return {Array<Array<string>>}\n */\n getCameraControlPaths(): Array<Array<string>> {\n const paths: string[][] = [];\n this.groups.forEach(group => {\n group.controls.forEach(control => {\n if (control.controlTypeModel?.name !== 'camera') {\n return;\n }\n paths.push([group.name, control.safeName]);\n });\n });\n return paths;\n }\n\n /**\n * @param {VasJobModel} jobModel\n * @return {Array<{id: string, value: VasFieldDtoValue}>}\n */\n getValuesByControlId(\n jobModel: VasJobModel\n ): Array<{id: string, value: VasFieldDtoValue | undefined}> {\n const items: Array<{id: string, value: VasFieldDtoValue | undefined}> = [];\n this.groups\n .forEach(group => {\n group.controls\n .forEach(control => {\n items.push({\n id: control.id,\n value: jobModel.getValueByPath([group.name, control.safeName])\n });\n });\n });\n return items;\n }\n\n /**\n * @return {VasFormDto}\n */\n toDto(): VasFormDto {\n return {\n id: this.id,\n created: this.created,\n serverCreated: this.serverCreated,\n createdBy: this.createdBy,\n modified: this.modified,\n serverModified: this.serverModified,\n modifiedBy: this.modifiedBy,\n account: this.account,\n accessGroup: this.accessGroup,\n jobType: this.jobType,\n title: this.title,\n description: this.description,\n groups: this.groups.map(group => group.toDto()),\n dynamicDescriptor: this.dynamicDescriptor,\n indexName: this.indexName,\n pipelineName: this.pipelineName,\n config: this.config\n };\n }\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"vas-form.model.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-form.model.ts"],"names":[],"mappings":";;;AAAA,+FAAwF;AAExF,qEAA+D;AAI/D,uDAAkD;AAGlD;;GAEG;AACH,MAAa,YAAa,SAAQ,qEAA+B;IAC/D;;;;;;;;;;;;;;;;;;OAkBG;IACH,YACkB,EAAU,EACV,OAAe,EACf,aAAqB,EACrB,SAAiB,EACjB,QAAgB,EAChB,cAAsB,EACtB,UAAkB,EAClB,OAAe,EACf,WAAmB,EAC5B,OAAe,EACf,KAAa,EACb,WAAmB,EACnB,MAAuB,EACvB,iBAAyB,EACzB,SAAiB,EACjB,YAAoB,EACpB,MAAc;QAErB,KAAK,CACH,EAAE,EACF,OAAO,EACP,aAAa,EACb,SAAS,EACT,QAAQ,EACR,cAAc,EACd,UAAU,EACV,OAAO,EACP,WAAW,CACZ,CAAC;QA5Bc,OAAE,GAAF,EAAE,CAAQ;QACV,YAAO,GAAP,OAAO,CAAQ;QACf,kBAAa,GAAb,aAAa,CAAQ;Q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YACzC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;IACJ,CAAC;CACF;AAxOD,oCAwOC","sourcesContent":["import { VasRestrictedAccountObjectModel } from './vas-restricted-account-object.model';\nimport { VasControlTypeDto } from './vas-control-type.dto';\nimport { VasControlTypeModel } from './vas-control-type.model';\nimport { VasControlModel } from './vas-control.model';\nimport { VasFieldDtoValue } from './vas-field.dto';\nimport { VasFormDto } from './vas-form.dto';\nimport { VasGroupModel } from './vas-group.model';\nimport { VasJobModel } from './vas-job.model';\n\n/**\n * VasFormModel\n */\nexport class VasFormModel extends VasRestrictedAccountObjectModel {\n /**\n * @param {string} id\n * @param {string} created\n * @param {string} serverCreated\n * @param {string} createdBy\n * @param {string} modified\n * @param {string} serverModified\n * @param {string} modifiedBy\n * @param {string} account\n * @param {string} accessGroup\n * @param {string} jobType\n * @param {string} title\n * @param {string} description\n * @param {VasGroupModel[]} groups\n * @param {string} dynamicDescriptor\n * @param {string} indexName\n * @param {string} pipelineName\n * @param {string} config\n */\n constructor(\n public override id: string,\n public override created: string,\n public override serverCreated: string,\n public override createdBy: string,\n public override modified: string,\n public override serverModified: string,\n public override modifiedBy: string,\n public override account: string,\n public override accessGroup: string,\n public jobType: string,\n public title: string,\n public description: string,\n public groups: VasGroupModel[],\n public dynamicDescriptor: string,\n public indexName: string,\n public pipelineName: string,\n public config: string\n ) {\n super(\n id,\n created,\n serverCreated,\n createdBy,\n modified,\n serverModified,\n modifiedBy,\n account,\n accessGroup\n );\n }\n\n /**\n * Returns the name of this form in a \"safe\" way, i.e. no spaces, special\n * characters\n * @return {string}\n */\n get safeTitle(): string {\n return this.title\n .replace(/[^a-z0-9]/gi, '-')\n .replace(/-+/g, '-')\n .toLowerCase();\n }\n\n\n /**\n * The VAS API response for Form will inline Group and Control but not\n * ControlType. This method is a help which will allows us to construct an\n * instance of VasFormModel with the ControlType model set appropriately into\n * each VasControlModel\n * @param {VasFormDto} formDto\n * @param {Array<VasControlTypeDto>} controlTypeDtos\n * @return {VasFormModel}\n */\n public static fromApiResponse(\n formDto: VasFormDto,\n controlTypeDtos: Array<VasControlTypeDto>\n ): VasFormModel {\n const controlTypeModels = controlTypeDtos\n .map(ctDto => VasControlTypeModel.fromDto(ctDto));\n const formModel = VasFormModel.fromDto(formDto);\n formModel.groups\n .forEach(group => {\n group.controls\n .forEach(control => {\n control.controlTypeModel = controlTypeModels\n .find(ct => ct.id === control.controlType);\n });\n });\n return formModel;\n }\n\n /**\n * @param {VasFormDto} dto\n * @return {VasFormModel}\n */\n public static fromDto(dto: Partial<VasFormDto>): VasFormModel {\n return new VasFormModel(\n dto.id || '',\n dto.created || '',\n dto.serverCreated || '',\n dto.createdBy || '',\n dto.modified || '',\n dto.serverModified || '',\n dto.modifiedBy || '',\n dto.account || '',\n dto.accessGroup || '',\n dto.jobType || '',\n dto.title || '',\n dto.description || '',\n (dto.groups || [])\n .sort((a, b) => a.sequence - b.sequence)\n .map(g => VasGroupModel.fromDto(g)),\n dto.dynamicDescriptor || '',\n dto.indexName || '',\n dto.pipelineName || '',\n dto.config || ''\n );\n }\n\n addControlTypesToControl(controlTypes: Array<VasControlTypeDto>): void {\n const controlTypeModels = controlTypes\n .map(ct => VasControlTypeModel.fromDto(ct))\n this.groups\n .forEach(group => {\n group.controls\n .forEach(control => {\n control.controlTypeModel = controlTypeModels\n .find(ctm => ctm.id === control.controlType)\n });\n });\n }\n\n /**\n * @param {string} id\n * @return {VasControlModel | undefined}\n */\n findControlModelById(id: string): VasControlModel | undefined {\n let result;\n this.groups\n .find(group => group.controls\n .find(control => {\n if (control.id !== id) {\n return;\n }\n result = control;\n return true;\n }));\n return result;\n }\n\n /**\n *\n * @param {string} name\n * @return {VasControlModel | undefined}\n */\n findControlModelByName(name: string): VasControlModel | undefined {\n let result;\n this.groups\n .find(group => group.controls\n .find(control => {\n if (control.name !== name) {\n return;\n }\n result = control;\n return true;\n }));\n return result;\n }\n\n /**\n *\n * @return {Array<Array<string>>}\n */\n getCameraControlPaths(): Array<Array<string>> {\n const paths: string[][] = [];\n this.groups.forEach(group => {\n group.controls.forEach(control => {\n if (control.controlTypeModel?.name !== 'camera') {\n return;\n }\n paths.push([group.name, control.safeName]);\n });\n });\n return paths;\n }\n\n /**\n * @param {VasJobModel} jobModel\n * @return {Array<{id: string, value: VasFieldDtoValue}>}\n */\n getValuesByControlId(\n jobModel: VasJobModel\n ): Array<{id: string, value: VasFieldDtoValue | undefined}> {\n const items: Array<{id: string, value: VasFieldDtoValue | undefined}> = [];\n this.groups\n .forEach(group => {\n group.controls\n .forEach(control => {\n items.push({\n id: control.id,\n value: jobModel.getValueByPath([group.name, control.safeName])\n });\n });\n });\n return items;\n }\n\n /**\n * @return {VasFormDto}\n */\n toDto(): VasFormDto {\n return {\n id: this.id,\n created: this.created,\n serverCreated: this.serverCreated,\n createdBy: this.createdBy,\n modified: this.modified,\n serverModified: this.serverModified,\n modifiedBy: this.modifiedBy,\n account: this.account,\n accessGroup: this.accessGroup,\n jobType: this.jobType,\n title: this.title,\n description: this.description,\n groups: this.groups.map(group => group.toDto()),\n dynamicDescriptor: this.dynamicDescriptor,\n indexName: this.indexName,\n pipelineName: this.pipelineName,\n config: this.config\n };\n }\n}\n\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vas-group.model.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-group.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;GAEG;AACH,qBAAa,aAAc,SAAQ,YAAY;IAuB3B,EAAE,EAAE,MAAM;IACV,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,MAAM;IACrB,SAAS,EAAE,MAAM;IACjB,QAAQ,EAAE,MAAM;IAChB,cAAc,EAAE,MAAM;IACtB,UAAU,EAAE,MAAM;IAC3B,OAAO,EAAE,MAAM;IACf,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,MAAM;IACb,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,MAAM;IAChB,gBAAgB,EAAE,OAAO;IACzB,KAAK,EAAE,MAAM,EAAE;IACf,iBAAiB,EAAE,MAAM;IACzB,eAAe,EAAE,MAAM;IACvB,QAAQ,EAAE,eAAe,EAAE;IAC3B,WAAW,EAAE,MAAM;IAxC5B;;;;;;;;;;;;;;;;;;;;OAoBG;gBAEe,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAC3B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,OAAO,EACzB,KAAK,EAAE,MAAM,EAAE,EACf,iBAAiB,EAAE,MAAM,EACzB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,eAAe,EAAE,EAC3B,WAAW,EAAE,MAAM;IAa5B;;;OAGG;WACW,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,aAAa;
|
|
1
|
+
{"version":3,"file":"vas-group.model.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-group.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,eAAe,EAA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GAAG,aAAa;IA4B/D;;;OAGG;IACH,SAAS,CACP,iBAAiB,EAAE,KAAK,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAAA;KAAC,CAAC,GAC1E,OAAO;IAgBV;;OAEG;IACH,KAAK,IAAI,WAAW;CAuBrB"}
|
|
@@ -59,6 +59,7 @@ class VasGroupModel extends vas_base_model_1.VasBaseModel {
|
|
|
59
59
|
return new VasGroupModel(
|
|
60
60
|
// eslint-disable-next-line new-cap
|
|
61
61
|
dto.id || angular2_uuid_1.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 || [])
|
|
62
|
+
.filter(control => control.name.startsWith('fields.'))
|
|
62
63
|
.sort((a, b) => a.sequence - b.sequence)
|
|
63
64
|
.map(c => vas_control_model_1.VasControlModel.fromDto(c)), dto.scoreWeight || 1);
|
|
64
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vas-group.model.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-group.model.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAChD,2DAAsD;AAEtD,iDAAqC;AAGrC;;GAEG;AACH,MAAa,aAAc,SAAQ,6BAAY;IAC7C;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YACkB,EAAU,EACV,OAAe,EACf,aAAqB,EACrB,SAAiB,EACjB,QAAgB,EAChB,cAAsB,EACtB,UAAkB,EAC3B,OAAe,EACf,WAAmB,EACnB,IAAY,EACZ,KAAa,EACb,WAAmB,EACnB,QAAgB,EAChB,gBAAyB,EACzB,KAAe,EACf,iBAAyB,EACzB,eAAuB,EACvB,QAA2B,EAC3B,WAAmB;QA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YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACvD,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;IACJ,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"vas-group.model.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-group.model.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAChD,2DAAsD;AAEtD,iDAAqC;AAGrC;;GAEG;AACH,MAAa,aAAc,SAAQ,6BAAY;IAC7C;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YACkB,EAAU,EACV,OAAe,EACf,aAAqB,EACrB,SAAiB,EACjB,QAAgB,EAChB,cAAsB,EACtB,UAAkB,EAC3B,OAAe,EACf,WAAmB,EACnB,IAAY,EACZ,KAAa,EACb,WAAmB,EACnB,QAAgB,EAChB,gBAAyB,EACzB,KAAe,EACf,iBAAyB,EACzB,eAAuB,EACvB,QAA2B,EAC3B,WAAmB;QAE1B,KAAK,CACH,EAAE,EACF,OAAO,EACP,aAAa,EACb,SAAS,EACT,QAAQ,EACR,cAAc,EACd,UA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CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACvD,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;IACJ,CAAC;CACF;AAtID,sCAsIC","sourcesContent":["import { VasBaseModel } from './vas-base.model';\nimport { VasControlModel } from './vas-control.model';\nimport { VasGroupDto } from './vas-group.dto';\nimport { UUID } from 'angular2-uuid';\nimport { VasFieldDtoValue } from './vas-field.dto';\n\n/**\n * GroupModel\n */\nexport class VasGroupModel extends VasBaseModel {\n /**\n * @param {string} id\n * @param {string} created\n * @param {string} serverCreated\n * @param {string} createdBy\n * @param {string} modified\n * @param {string} serverModified\n * @param {string} modifiedBy\n * @param {string} account\n * @param {string} accessGroup\n * @param {string} name\n * @param {string} title\n * @param {string} description\n * @param {number} sequence\n * @param {boolean} includeInSummary\n * @param {string[]} forms\n * @param {string} visibilityControl\n * @param {string} visibleIfEquals\n * @param {VasControlModel[]} controls\n * @param {number} scoreWeight\n */\n constructor(\n public override id: string,\n public override created: string,\n public override serverCreated: string,\n public override createdBy: string,\n public override modified: string,\n public override serverModified: string,\n public override modifiedBy: string,\n public account: string,\n public accessGroup: string,\n public name: string,\n public title: string,\n public description: string,\n public sequence: number,\n public includeInSummary: boolean,\n public forms: string[],\n public visibilityControl: string,\n public visibleIfEquals: string,\n public controls: VasControlModel[],\n public scoreWeight: number\n ) {\n super(\n id,\n created,\n serverCreated,\n createdBy,\n modified,\n serverModified,\n modifiedBy\n );\n }\n\n /**\n * @param {VasGroupDto} dto\n * @return {VasGroupModel}\n */\n public static fromDto(dto: Partial<VasGroupDto>): VasGroupModel {\n return new VasGroupModel(\n // eslint-disable-next-line new-cap\n dto.id || UUID.UUID(),\n dto.created || '',\n dto.serverCreated || '',\n dto.createdBy || '',\n dto.modified || '',\n dto.serverModified || '',\n dto.modifiedBy || '',\n dto.account || '',\n dto.accessGroup || '',\n dto.name || '',\n dto.title || '',\n dto.description || '',\n dto.sequence || 0,\n dto.includeInSummary || false,\n dto.forms || [],\n dto.visibilityControl || '',\n dto.visibleIfEquals || '',\n (dto.controls || [])\n .filter(control => control.name.startsWith('fields.'))\n .sort((a, b) => a.sequence - b.sequence)\n .map(c => VasControlModel.fromDto(c)),\n dto.scoreWeight || 1\n );\n }\n\n /**\n * @param {Array<VasControlModel>} valuesByControlId\n * @return {boolean}\n */\n isVisible(\n valuesByControlId: Array<{id: string, value: VasFieldDtoValue | undefined}>\n ): boolean {\n if (!this.visibilityControl || !this.visibleIfEquals) {\n return true;\n }\n\n const control = valuesByControlId\n .find(c => c.id === this.visibilityControl);\n\n if (!control) {\n console.warn(`control with id ${this.visibilityControl} not found`);\n return true;\n }\n\n return (control.value || '').toString() === this.visibleIfEquals;\n }\n\n /**\n * @return {VasGroupDto}\n */\n toDto(): VasGroupDto {\n return {\n id: this.id,\n created: this.created,\n serverCreated: this.serverCreated,\n createdBy: this.createdBy,\n modified: this.modified,\n serverModified: this.serverModified,\n modifiedBy: this.modifiedBy,\n account: this.account,\n accessGroup: this.accessGroup,\n name: this.name,\n title: this.title,\n description: this.description,\n sequence: this.sequence,\n includeInSummary: this.includeInSummary,\n forms: this.forms,\n visibilityControl: this.visibilityControl,\n visibleIfEquals: this.visibleIfEquals,\n controls: this.controls.map(control => control.toDto()),\n scoreWeight: this.scoreWeight\n };\n }\n}\n\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
}
|
|
28
|
+
//# sourceMappingURL=vas-job-data.model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vas-job-data.model.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-job-data.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;GAEG;AACH,8BAAsB,eAAgB,SAAQ,qBAAqB;IAa/C,EAAE,EAAE,MAAM;IACV,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,MAAM;IACrB,SAAS,EAAE,MAAM;IACjB,QAAQ,EAAE,MAAM;IAChB,cAAc,EAAE,MAAM;IACtB,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM;IACxB,GAAG,EAAE,MAAM;IApBpB;;;;;;;;;;OAUG;gBAEe,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACxB,GAAG,EAAE,MAAM;CAarB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VasJobDataModel = void 0;
|
|
4
|
+
const vas_account_object_model_1 = require("./vas-account-object.model");
|
|
5
|
+
/**
|
|
6
|
+
* VasJobDataModel
|
|
7
|
+
*/
|
|
8
|
+
class VasJobDataModel extends vas_account_object_model_1.VasAccountObjectModel {
|
|
9
|
+
/**
|
|
10
|
+
* @param {string} id
|
|
11
|
+
* @param {string} created
|
|
12
|
+
* @param {string} serverCreated
|
|
13
|
+
* @param {string} createdBy
|
|
14
|
+
* @param {string} modified
|
|
15
|
+
* @param {string} serverModified
|
|
16
|
+
* @param {string} modifiedBy
|
|
17
|
+
* @param {string} account
|
|
18
|
+
* @param {string} job
|
|
19
|
+
*/
|
|
20
|
+
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, job) {
|
|
21
|
+
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account);
|
|
22
|
+
this.id = id;
|
|
23
|
+
this.created = created;
|
|
24
|
+
this.serverCreated = serverCreated;
|
|
25
|
+
this.createdBy = createdBy;
|
|
26
|
+
this.modified = modified;
|
|
27
|
+
this.serverModified = serverModified;
|
|
28
|
+
this.modifiedBy = modifiedBy;
|
|
29
|
+
this.account = account;
|
|
30
|
+
this.job = job;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.VasJobDataModel = VasJobDataModel;
|
|
34
|
+
//# sourceMappingURL=vas-job-data.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vas-job-data.model.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-job-data.model.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEnE;;GAEG;AACH,MAAsB,eAAgB,SAAQ,gDAAqB;IACjE;;;;;;;;;;OAUG;IACH,YACkB,EAAU,EACV,OAAe,EACf,aAAqB,EACrB,SAAiB,EACjB,QAAgB,EAChB,cAAsB,EACtB,UAAkB,EAClB,OAAe,EACxB,GAAW;QAElB,KAAK,CACH,EAAE,EACF,OAAO,EACP,aAAa,EACb,SAAS,EACT,QAAQ,EACR,cAAc,EACd,UAAU,EACV,OAAO,CACR,CAAC;QAnBc,OAAE,GAAF,EAAE,CAAQ;QACV,YAAO,GAAP,OAAO,CAAQ;QACf,kBAAa,GAAb,aAAa,CAAQ;QACrB,cAAS,GAAT,SAAS,CAAQ;QACjB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,mBAAc,GAAd,cAAc,CAAQ;QACtB,eAAU,GAAV,UAAU,CAAQ;QAClB,YAAO,GAAP,OAAO,CAAQ;QACxB,QAAG,GAAH,GAAG,CAAQ;IAYpB,CAAC;CACF;AAlCD,0CAkCC","sourcesContent":["import { VasAccountObjectModel } from './vas-account-object.model';\n\n/**\n * VasJobDataModel\n */\nexport abstract class VasJobDataModel extends VasAccountObjectModel {\n /**\n * @param {string} id\n * @param {string} created\n * @param {string} serverCreated\n * @param {string} createdBy\n * @param {string} modified\n * @param {string} serverModified\n * @param {string} modifiedBy\n * @param {string} account\n * @param {string} job\n */\n constructor(\n public override id: string,\n public override created: string,\n public override serverCreated: string,\n public override createdBy: string,\n public override modified: string,\n public override serverModified: string,\n public override modifiedBy: string,\n public override account: string,\n public job: string\n ) {\n super(\n id,\n created,\n serverCreated,\n createdBy,\n modified,\n serverModified,\n modifiedBy,\n account\n );\n }\n}\n"]}
|
|
@@ -1,13 +1,19 @@
|
|
|
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>;
|
|
13
19
|
//# sourceMappingURL=vas-job.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vas-job.dto.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-job.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"vas-job.dto.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-job.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,WAAW,eAAgB,SAAQ,6BAA6B;IACpE,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACzB,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;CAC5B;AACD,MAAM,CAAC,OAAO,MAAM,SAAS,GAAG,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vas-job.dto.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-job.dto.ts"],"names":[],"mappings":"","sourcesContent":["import { VasRestrictedAccountObjectDto } from './vas-restricted-account-object.dto';\nimport { VasFieldDtoValue } from './vas-field.dto';\n\nexport interface VasJobStaticDto extends VasRestrictedAccountObjectDto {\n reference: string;\n jobDate: string;\n jobStatus: string;\n jobType: string;\n
|
|
1
|
+
{"version":3,"file":"vas-job.dto.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/entity/vas-job.dto.ts"],"names":[],"mappings":"","sourcesContent":["import { VasFileDto } from './vas-file.dto';\nimport { VasRestrictedAccountObjectDto } from './vas-restricted-account-object.dto';\nimport { VasFieldDto, VasFieldDtoValue } from './vas-field.dto';\n\nexport interface VasJobStaticDto extends VasRestrictedAccountObjectDto {\n reference: string;\n jobDate: string;\n jobStatus: string;\n jobType: string;\n assigneeId: string;\n formId: string;\n timeZoneOffset: number;\n pendingFields: number;\n childModified: string;\n version: number;\n files: Array<VasFileDto>;\n fields: Array<VasFieldDto>;\n}\nexport declare type VasJobDto = VasJobStaticDto & Record<string, VasFieldDtoValue>;\n"]}
|
|
@@ -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,6 +236,9 @@ 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 {};
|
|
149
244
|
//# sourceMappingURL=vas-job.model.d.ts.map
|
|
@@ -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":"
|
|
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,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI5C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAExF,MAAM,CAAC,OAAO,WAAW,2BAA2B;IAClD,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CACjE;AAED,MAAM,WAAW,kBAAkB;IAKjC,cAAc,EAAE,MAAM,CAAC;IAMvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;CAClF;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,+BAA+B;IAyB5C,EAAE,EAAE,MAAM;IACV,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,MAAM;IACrB,SAAS,EAAE,MAAM;IACjB,QAAQ,EAAE,MAAM;IAChB,cAAc,EAAE,MAAM;IACtB,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM;IACf,WAAW,EAAE,MAAM;IAC5B,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AAC,SAAS,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAYpE;;;;;;;OAOG;IACH,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAgB9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+EG;IACH,aAAa,CACX,SAAS,EAAE,YAAY,EACvB,iBAAiB,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAA6B,EAClE,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAC3B,IAAI;IAkCP;;;;OAIG;IACH,cAAc,CAAC,CAAC,SAAS,gBAAgB,EACvC,IAAI,GAAE,MAAM,EAAO,GAClB,CAAC,GAAG,SAAS;IAIhB;;;;;;;;;;;;;;;;OAgBG;IACH,cAAc,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,GAAE,MAAM,EAAO,GAAG,IAAI;IAyBlE;;;;OAIG;IACI,KAAK,CAAC,UAAU,UAAQ,GAAG,SAAS;IAoC3C;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,WAAW,CACT,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,kBAER,GACA,MAAM;IAuET;;OAEG;IACM,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAa/D"}
|
|
@@ -3,13 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VasJobModel = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const angular2_uuid_1 = require("angular2-uuid");
|
|
6
|
-
const vas_base_model_1 = require("./vas-base.model");
|
|
7
6
|
const moment_1 = tslib_1.__importDefault(require("moment"));
|
|
8
7
|
const get_value_by_path_1 = require("../utils/get-value-by-path");
|
|
8
|
+
const vas_field_model_1 = require("./vas-field.model");
|
|
9
|
+
const vas_restricted_account_object_model_1 = require("./vas-restricted-account-object.model");
|
|
9
10
|
/**
|
|
10
11
|
* JobModel
|
|
11
12
|
*/
|
|
12
|
-
class VasJobModel extends
|
|
13
|
+
class VasJobModel extends vas_restricted_account_object_model_1.VasRestrictedAccountObjectModel {
|
|
13
14
|
/**
|
|
14
15
|
* @param {string} id
|
|
15
16
|
* @param {string} created
|
|
@@ -24,12 +25,17 @@ class VasJobModel extends vas_base_model_1.VasBaseModel {
|
|
|
24
25
|
* @param {string} jobDate
|
|
25
26
|
* @param {string} jobStatus
|
|
26
27
|
* @param {string} jobType
|
|
27
|
-
* @param {string}
|
|
28
|
+
* @param {string} assigneeId
|
|
28
29
|
* @param {string} formId
|
|
29
30
|
* @param {number} timeZoneOffset
|
|
31
|
+
* @param {number} pendingFields
|
|
32
|
+
* @param {string} childModified
|
|
33
|
+
* @param {number} version
|
|
34
|
+
* @param {Array<VasFieldDto>} fields
|
|
35
|
+
* @param {Array<VasFileDto>} files
|
|
30
36
|
*/
|
|
31
|
-
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, reference, jobDate, jobStatus, jobType,
|
|
32
|
-
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
|
|
37
|
+
constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, reference, jobDate, jobStatus, jobType, assigneeId, formId, timeZoneOffset, pendingFields, childModified, version, fields, files) {
|
|
38
|
+
super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup);
|
|
33
39
|
this.id = id;
|
|
34
40
|
this.created = created;
|
|
35
41
|
this.serverCreated = serverCreated;
|
|
@@ -43,9 +49,14 @@ class VasJobModel extends vas_base_model_1.VasBaseModel {
|
|
|
43
49
|
this.jobDate = jobDate;
|
|
44
50
|
this.jobStatus = jobStatus;
|
|
45
51
|
this.jobType = jobType;
|
|
46
|
-
this.
|
|
52
|
+
this.assigneeId = assigneeId;
|
|
47
53
|
this.formId = formId;
|
|
48
54
|
this.timeZoneOffset = timeZoneOffset;
|
|
55
|
+
this.pendingFields = pendingFields;
|
|
56
|
+
this.childModified = childModified;
|
|
57
|
+
this.version = version;
|
|
58
|
+
this.fields = fields;
|
|
59
|
+
this.files = files;
|
|
49
60
|
}
|
|
50
61
|
/**
|
|
51
62
|
* Returns this with the dynamic interface
|
|
@@ -77,7 +88,7 @@ class VasJobModel extends vas_base_model_1.VasBaseModel {
|
|
|
77
88
|
static empty() {
|
|
78
89
|
return new VasJobModel(
|
|
79
90
|
// eslint-disable-next-line new-cap
|
|
80
|
-
angular2_uuid_1.UUID.UUID(), '', '', '', '', '', '', '', '', '', '', '', '', '', '', (0, moment_1.default)().utcOffset());
|
|
91
|
+
angular2_uuid_1.UUID.UUID(), '', '', '', '', '', '', '', '', '', '', '', '', '', '', (0, moment_1.default)().utcOffset(), 0, '', 0, [], []);
|
|
81
92
|
}
|
|
82
93
|
/**
|
|
83
94
|
* @param {VasJobDto} jobDto
|
|
@@ -86,7 +97,7 @@ class VasJobModel extends vas_base_model_1.VasBaseModel {
|
|
|
86
97
|
static fromDto(jobDto) {
|
|
87
98
|
const model = new VasJobModel(
|
|
88
99
|
// eslint-disable-next-line new-cap
|
|
89
|
-
jobDto.id || angular2_uuid_1.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.
|
|
100
|
+
jobDto.id || angular2_uuid_1.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 || (0, moment_1.default)().utcOffset(), jobDto.pendingFields || 0, jobDto.childModified || '', jobDto.version || 0, jobDto.fields || [], jobDto.files || []);
|
|
90
101
|
const emptyKeys = model.staticProperties;
|
|
91
102
|
Object
|
|
92
103
|
.keys(jobDto)
|
|
@@ -130,6 +141,114 @@ class VasJobModel extends vas_base_model_1.VasBaseModel {
|
|
|
130
141
|
}, {});
|
|
131
142
|
return fields;
|
|
132
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* This method will hydrate the `fields` property of the model. The reason for
|
|
146
|
+
* this is that we have different ways to store the field data. One way, is
|
|
147
|
+
* we store them as dynamic properties of the job. For example job.foo.bar,
|
|
148
|
+
* where `foo` is the name of a Group, and `bar` is the name of a control.
|
|
149
|
+
* Thus, when we create a job using a form in the client, the job object will
|
|
150
|
+
* have its static properties (id, account, reference etc), and also a number
|
|
151
|
+
* of dynamic properties determined by the Groups and Controls. This kind of
|
|
152
|
+
* object is nice to work with in certain circumstances. However, the api
|
|
153
|
+
* works differently. In the API a Job is a record, and references a number of
|
|
154
|
+
* Field records. Each Field stores the value. Comparing these two models we
|
|
155
|
+
* have:
|
|
156
|
+
* A) job with dynamic properties, e.g.
|
|
157
|
+
* {
|
|
158
|
+
* id: <guid>,
|
|
159
|
+
* reference: "something"
|
|
160
|
+
* <other static job properties>...
|
|
161
|
+
* foo: {
|
|
162
|
+
* bar: "value"
|
|
163
|
+
* }
|
|
164
|
+
* }
|
|
165
|
+
*
|
|
166
|
+
* B) job with fields
|
|
167
|
+
* {
|
|
168
|
+
* id: <guid>,
|
|
169
|
+
* reference: "something"
|
|
170
|
+
* <other static job properties>...
|
|
171
|
+
* <will not have dynamic properties>...
|
|
172
|
+
* fields: [
|
|
173
|
+
* {
|
|
174
|
+
* id: <guid>,
|
|
175
|
+
* <other field properties>,
|
|
176
|
+
* value: "value"
|
|
177
|
+
* }
|
|
178
|
+
* ]
|
|
179
|
+
* }
|
|
180
|
+
*
|
|
181
|
+
* So, what this method does is given a JobModel in the form of A, read all
|
|
182
|
+
* of those dynamic properties and set them into `fields`. Doing this requires
|
|
183
|
+
* knowledge of the Form that was used to create the job. Moreover, since the
|
|
184
|
+
* dynamic properties do not contain the ids of the fields, we also allow to
|
|
185
|
+
* pass in a `controlFieldIdMap`. This map stores the mapping between Control
|
|
186
|
+
* and the Field that was created in the Job to store the value for that
|
|
187
|
+
* Control. This is useful, if for example you want to compare a Job in form A
|
|
188
|
+
* with a Job in form B, for example if you want to update the Job on the API
|
|
189
|
+
* with a Job that was saved by a client in form A.
|
|
190
|
+
*
|
|
191
|
+
* E.g.
|
|
192
|
+
* Client -> API: client requests form
|
|
193
|
+
* User -> Client: user fills in the form and submits
|
|
194
|
+
* Client -> Firestore: client saves the Job in form A i.e. dynamic props
|
|
195
|
+
* Firestore -> Function: A function is triggered to sync the job to the API
|
|
196
|
+
* Function -> API: Function checks if job already exists, it receives 404
|
|
197
|
+
* Function -> Function: The function calls `hydrateFields(...)`
|
|
198
|
+
* Function -> API: The function POST the Job to /jobs
|
|
199
|
+
* Function -> API: The function POST each field to /fields
|
|
200
|
+
*
|
|
201
|
+
* Similarly, if the user updates the job
|
|
202
|
+
* Client -> API: client requests form
|
|
203
|
+
* User -> Client: user fills in the form and submits an update
|
|
204
|
+
* Client -> Firestore: client saves the Job in form A i.e. dynamic props
|
|
205
|
+
* Firestore -> Function: A function is triggered to sync the job to the API
|
|
206
|
+
* Function -> API: Function checks if job already exists, it receives 200
|
|
207
|
+
* Function -> Function: The function calls `hydrateFields(...)` passing in
|
|
208
|
+
* the map is made by iterating over the fields it
|
|
209
|
+
* received from the API and storing the mappings
|
|
210
|
+
* between controlId and fieldId for each field
|
|
211
|
+
* Function -> API: The function PATCH the Job to /jobs
|
|
212
|
+
* Function -> API: The function POST/PATCH each field to /fields
|
|
213
|
+
* treated as new
|
|
214
|
+
*
|
|
215
|
+
* @param {VasFormModel} formModel the VasFormModel that was used to create
|
|
216
|
+
* the job
|
|
217
|
+
* @param {Map<string, string>} controlFieldIdMap a mapping of control to
|
|
218
|
+
* field ids. This is used to determine whether a new id for the field should
|
|
219
|
+
* be generated, or to reuse an existing one from the map.
|
|
220
|
+
* @param {Array<string>} controlNames if a value is provided, it will be used
|
|
221
|
+
* to filter the fields that are returned.
|
|
222
|
+
* @return {Array<VasFieldDto>}
|
|
223
|
+
*/
|
|
224
|
+
hydrateFields(formModel, controlFieldIdMap = new Map(), controlNames) {
|
|
225
|
+
const fields = [];
|
|
226
|
+
formModel.groups
|
|
227
|
+
.forEach(group => {
|
|
228
|
+
group.controls.forEach(control => {
|
|
229
|
+
if (!control.name.startsWith('fields.')) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (controlNames && !controlNames.includes(control.name)) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
fields.push(vas_field_model_1.VasFieldModel.fromDto({
|
|
236
|
+
// if the controlId exists in the map, use the associated fieldId,
|
|
237
|
+
// otherwise generate a new id for the field.
|
|
238
|
+
id: controlFieldIdMap.get(control.id) || angular2_uuid_1.UUID.UUID(),
|
|
239
|
+
account: this.account,
|
|
240
|
+
job: this.id,
|
|
241
|
+
createdBy: this.createdBy,
|
|
242
|
+
created: this.created,
|
|
243
|
+
modifiedBy: this.modifiedBy,
|
|
244
|
+
modified: this.modified,
|
|
245
|
+
control: control.id,
|
|
246
|
+
value: this.getValueByPath([group.name, control.name])
|
|
247
|
+
}));
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
this.fields = fields;
|
|
251
|
+
}
|
|
133
252
|
/**
|
|
134
253
|
|
|
135
254
|
* @param {string[]} path path segments
|
|
@@ -200,9 +319,14 @@ class VasJobModel extends vas_base_model_1.VasBaseModel {
|
|
|
200
319
|
jobDate: this.jobDate,
|
|
201
320
|
jobStatus: this.jobStatus,
|
|
202
321
|
jobType: this.jobType,
|
|
203
|
-
|
|
322
|
+
assigneeId: this.assigneeId,
|
|
204
323
|
formId: this.formId,
|
|
205
324
|
timeZoneOffset: this.timeZoneOffset,
|
|
325
|
+
pendingFields: this.pendingFields,
|
|
326
|
+
childModified: this.childModified,
|
|
327
|
+
version: this.version,
|
|
328
|
+
fields: this.fields,
|
|
329
|
+
files: this.files
|
|
206
330
|
};
|
|
207
331
|
}
|
|
208
332
|
const dto = {};
|
|
@@ -305,6 +429,12 @@ class VasJobModel extends vas_base_model_1.VasBaseModel {
|
|
|
305
429
|
}).trim();
|
|
306
430
|
}
|
|
307
431
|
;
|
|
432
|
+
/**
|
|
433
|
+
* @return {object}
|
|
434
|
+
*/
|
|
435
|
+
toApiDto() {
|
|
436
|
+
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 });
|
|
437
|
+
}
|
|
308
438
|
}
|
|
309
439
|
exports.VasJobModel = VasJobModel;
|
|
310
440
|
//# sourceMappingURL=vas-job.model.js.map
|