@ironcode/vas-lib 3.0.0-alpha.2 → 3.0.0-alpha.5

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.
Files changed (119) hide show
  1. package/cjs/lib/control-value/vas-camera-control-value.model.d.ts +4 -2
  2. package/cjs/lib/control-value/vas-camera-control-value.model.d.ts.map +1 -1
  3. package/cjs/lib/control-value/vas-camera-control-value.model.js.map +1 -1
  4. package/cjs/lib/entity/vas-base.model.d.ts +1 -1
  5. package/cjs/lib/entity/vas-base.model.d.ts.map +1 -1
  6. package/cjs/lib/entity/vas-base.model.js.map +1 -1
  7. package/cjs/lib/entity/vas-field.dto.d.ts +3 -4
  8. package/cjs/lib/entity/vas-field.dto.d.ts.map +1 -1
  9. package/cjs/lib/entity/vas-field.dto.js.map +1 -1
  10. package/cjs/lib/entity/vas-field.model.js +1 -1
  11. package/cjs/lib/entity/vas-field.model.js.map +1 -1
  12. package/cjs/lib/entity/vas-form.model.d.ts +1 -1
  13. package/cjs/lib/entity/vas-form.model.d.ts.map +1 -1
  14. package/cjs/lib/entity/vas-form.model.js.map +1 -1
  15. package/cjs/lib/entity/vas-job-copy.d.ts +12 -12
  16. package/cjs/lib/entity/vas-job-copy.d.ts.map +1 -1
  17. package/cjs/lib/entity/vas-job-copy.js.map +1 -1
  18. package/cjs/lib/entity/vas-job.dto.d.ts +9 -3
  19. package/cjs/lib/entity/vas-job.dto.d.ts.map +1 -1
  20. package/cjs/lib/entity/vas-job.dto.js.map +1 -1
  21. package/cjs/lib/entity/vas-job.model.d.ts +25 -13
  22. package/cjs/lib/entity/vas-job.model.d.ts.map +1 -1
  23. package/cjs/lib/entity/vas-job.model.js +139 -90
  24. package/cjs/lib/entity/vas-job.model.js.map +1 -1
  25. package/cjs/lib/model/estimate-control/estimate-control-value.dto.d.ts +14 -0
  26. package/cjs/lib/model/estimate-control/estimate-control-value.dto.d.ts.map +1 -0
  27. package/cjs/lib/model/estimate-control/estimate-control-value.dto.js +3 -0
  28. package/cjs/lib/model/estimate-control/estimate-control-value.dto.js.map +1 -0
  29. package/cjs/lib/model/estimate-control/estimate-control-value.model.d.ts +11 -0
  30. package/cjs/lib/model/estimate-control/estimate-control-value.model.d.ts.map +1 -0
  31. package/cjs/lib/model/estimate-control/estimate-control-value.model.js +84 -0
  32. package/cjs/lib/model/estimate-control/estimate-control-value.model.js.map +1 -0
  33. package/cjs/lib/model/estimate-control/estimate-item.dto.d.ts +16 -0
  34. package/cjs/lib/model/estimate-control/estimate-item.dto.d.ts.map +1 -0
  35. package/cjs/lib/model/estimate-control/estimate-item.dto.js +3 -0
  36. package/cjs/lib/model/estimate-control/estimate-item.dto.js.map +1 -0
  37. package/cjs/lib/model/estimate-control/estimate-item.model.d.ts +24 -0
  38. package/cjs/lib/model/estimate-control/estimate-item.model.d.ts.map +1 -0
  39. package/cjs/lib/model/estimate-control/estimate-item.model.js +121 -0
  40. package/cjs/lib/model/estimate-control/estimate-item.model.js.map +1 -0
  41. package/cjs/lib/model/estimate-control/estimate.dto.d.ts +37 -0
  42. package/cjs/lib/model/estimate-control/estimate.dto.d.ts.map +1 -0
  43. package/cjs/lib/model/estimate-control/estimate.dto.js +3 -0
  44. package/cjs/lib/model/estimate-control/estimate.dto.js.map +1 -0
  45. package/cjs/lib/model/estimate-control/estimate.model.d.ts +55 -0
  46. package/cjs/lib/model/estimate-control/estimate.model.d.ts.map +1 -0
  47. package/cjs/lib/model/estimate-control/estimate.model.js +265 -0
  48. package/cjs/lib/model/estimate-control/estimate.model.js.map +1 -0
  49. package/cjs/lib/model/estimate-control/estimate.types.d.ts +3 -0
  50. package/cjs/lib/model/estimate-control/estimate.types.d.ts.map +1 -0
  51. package/cjs/lib/model/estimate-control/estimate.types.js +3 -0
  52. package/cjs/lib/model/estimate-control/estimate.types.js.map +1 -0
  53. package/cjs/lib/model/estimate-control/index.d.ts +8 -0
  54. package/cjs/lib/model/estimate-control/index.d.ts.map +1 -0
  55. package/cjs/lib/model/estimate-control/index.js +11 -0
  56. package/cjs/lib/model/estimate-control/index.js.map +1 -0
  57. package/cjs/lib/model/index.d.ts +2 -0
  58. package/cjs/lib/model/index.d.ts.map +1 -1
  59. package/cjs/lib/model/index.js +2 -0
  60. package/cjs/lib/model/index.js.map +1 -1
  61. package/cjs/lib/model/report-invocation.d.ts +40 -0
  62. package/cjs/lib/model/report-invocation.d.ts.map +1 -0
  63. package/cjs/lib/model/report-invocation.js +3 -0
  64. package/cjs/lib/model/report-invocation.js.map +1 -0
  65. package/cjs/lib/utils/get-value-by-path.d.ts +5 -15
  66. package/cjs/lib/utils/get-value-by-path.d.ts.map +1 -1
  67. package/cjs/lib/utils/get-value-by-path.js +48 -59
  68. package/cjs/lib/utils/get-value-by-path.js.map +1 -1
  69. package/cjs/lib/utils/index.d.ts +8 -0
  70. package/cjs/lib/utils/index.d.ts.map +1 -0
  71. package/cjs/lib/utils/index.js +11 -0
  72. package/cjs/lib/utils/index.js.map +1 -0
  73. package/cjs/lib/utils/is-array-string.d.ts +3 -0
  74. package/cjs/lib/utils/is-array-string.d.ts.map +1 -1
  75. package/cjs/lib/utils/is-array-string.js +3 -0
  76. package/cjs/lib/utils/is-array-string.js.map +1 -1
  77. package/cjs/lib/utils/is-numeric.d.ts +2 -0
  78. package/cjs/lib/utils/is-numeric.d.ts.map +1 -0
  79. package/cjs/lib/utils/is-numeric.js +10 -0
  80. package/cjs/lib/utils/is-numeric.js.map +1 -0
  81. package/cjs/lib/utils/is-plain-object.d.ts +3 -0
  82. package/cjs/lib/utils/is-plain-object.d.ts.map +1 -1
  83. package/cjs/lib/utils/is-plain-object.js +3 -0
  84. package/cjs/lib/utils/is-plain-object.js.map +1 -1
  85. package/cjs/lib/utils/try-json.d.ts +2 -2
  86. package/cjs/lib/utils/try-json.js +2 -2
  87. package/cjs/lib/utils/try-json.js.map +1 -1
  88. package/cjs/public-api.d.ts +1 -0
  89. package/cjs/public-api.d.ts.map +1 -1
  90. package/cjs/public-api.js +1 -0
  91. package/cjs/public-api.js.map +1 -1
  92. package/fesm2022/ironcode-vas-lib.mjs +694 -154
  93. package/fesm2022/ironcode-vas-lib.mjs.map +1 -1
  94. package/lib/control-value/vas-camera-control-value.model.d.ts +4 -2
  95. package/lib/entity/vas-base.model.d.ts +1 -1
  96. package/lib/entity/vas-field.dto.d.ts +3 -4
  97. package/lib/entity/vas-form.model.d.ts +1 -1
  98. package/lib/entity/vas-job-copy.d.ts +12 -12
  99. package/lib/entity/vas-job.dto.d.ts +9 -3
  100. package/lib/entity/vas-job.model.d.ts +25 -13
  101. package/lib/model/estimate-control/estimate-control-value.dto.d.ts +13 -0
  102. package/lib/model/estimate-control/estimate-control-value.model.d.ts +10 -0
  103. package/lib/model/estimate-control/estimate-item.dto.d.ts +15 -0
  104. package/lib/model/estimate-control/estimate-item.model.d.ts +23 -0
  105. package/lib/model/estimate-control/estimate.dto.d.ts +36 -0
  106. package/lib/model/estimate-control/estimate.model.d.ts +54 -0
  107. package/lib/model/estimate-control/estimate.types.d.ts +2 -0
  108. package/lib/model/estimate-control/index.d.ts +7 -0
  109. package/lib/model/index.d.ts +2 -0
  110. package/lib/model/report-invocation.d.ts +39 -0
  111. package/lib/utils/get-value-by-path.d.ts +5 -15
  112. package/lib/utils/index.d.ts +7 -0
  113. package/lib/utils/is-array-string.d.ts +4 -0
  114. package/lib/utils/is-numeric.d.ts +1 -0
  115. package/lib/utils/is-plain-object.d.ts +3 -0
  116. package/lib/utils/omit.d.ts +7 -0
  117. package/lib/utils/try-json.d.ts +2 -2
  118. package/package.json +3 -2
  119. package/public-api.d.ts +1 -0
@@ -1,9 +1,11 @@
1
1
  import { VasFileDto } from '../entity';
2
- export interface VasCameraControlValueModel {
2
+ export interface VasCameraControlValueValue {
3
3
  webPath: string;
4
4
  path: string;
5
5
  url?: string;
6
6
  id?: string;
7
7
  }
8
- export declare function isCameraControlValueV1(object: any): object is VasCameraControlValueModel;
8
+ /** @deprecated */
9
+ export type VasCameraControlValueModel = VasCameraControlValueValue;
10
+ export declare function isCameraControlValueV1(object: any): object is VasCameraControlValueValue;
9
11
  export declare function isCameraControlValueV2(object: any): object is VasFileDto;
@@ -18,7 +18,7 @@ export declare class VasBaseModel implements VasBaseDto {
18
18
  modifiedByName: string;
19
19
  constructor(id: string, created: string, serverCreated: string, createdBy: string, modified: string, serverModified: string, modifiedBy: string, createdByName: string, modifiedByName: string);
20
20
  static fromDto(dto: Partial<VasBaseDto>): VasBaseModel;
21
- static create<T extends VasBaseDto>(this: VasModelStatic<T>, user: {
21
+ static create<T extends VasBaseModel>(this: VasModelStatic<T>, user: {
22
22
  id: string;
23
23
  name: string;
24
24
  }, values?: Partial<T>): T;
@@ -1,9 +1,8 @@
1
1
  import { VasJobDataDto } from './vas-job-data.dto';
2
2
  import { VasFileDto } from './vas-file.dto';
3
- import { GeoLocation } from '../model';
4
- import { VasFunctionControlValueDto } from '../control-value';
5
- import { VasCameraControlValueModel } from '../control-value';
6
- export declare type FieldValueType = string | number | boolean | null | GeoLocation | Array<object | string | number | boolean | VasFileDto> | Record<string, any> | VasCameraControlValueModel | VasFunctionControlValueDto;
3
+ import { EstimateControlValueDto, GeoLocation } from '../model';
4
+ import { VasCameraControlValueValue, VasFunctionControlValueDto } from '../control-value';
5
+ export declare type FieldValueType = string | number | boolean | null | GeoLocation | Array<object | string | number | boolean | VasFileDto> | Record<string, any> | VasCameraControlValueValue | EstimateControlValueDto | VasFunctionControlValueDto;
7
6
  export interface VasFieldDto extends VasJobDataDto {
8
7
  control: string;
9
8
  fieldJobPointers: Array<string>;
@@ -4,8 +4,8 @@ import { VasControlModel } from './vas-control.model';
4
4
  import { FieldValueType } from './vas-field.dto';
5
5
  import { VasFormDto } from './vas-form.dto';
6
6
  import { VasGroupModel } from './vas-group.model';
7
- import { VasJobModel } from './vas-job.model';
8
7
  import { VasFormConfigModel } from './vas-form-config.model';
8
+ import { VasJobModel } from './vas-job.model';
9
9
  /**
10
10
  * VasFormModel
11
11
  */
@@ -1,24 +1,24 @@
1
- import { VasJobDto } from './vas-job.dto';
1
+ import { VasJobBaseDto } from './vas-job.dto';
2
2
  export interface VasJobCopyDto {
3
- accessGroup: VasJobDto['accessGroup'];
4
- jobType: VasJobDto['jobType'];
5
- jobStatus: VasJobDto['jobStatus'];
6
- jobDate: VasJobDto['jobDate'];
7
- assigneeId: VasJobDto['assigneeId'];
3
+ accessGroup: VasJobBaseDto['accessGroup'];
4
+ jobType: VasJobBaseDto['jobType'];
5
+ jobStatus: VasJobBaseDto['jobStatus'];
6
+ jobDate: VasJobBaseDto['jobDate'];
7
+ assigneeId: VasJobBaseDto['assigneeId'];
8
8
  fields: Array<string>;
9
9
  files: Array<string>;
10
10
  reports: Array<string>;
11
11
  }
12
12
  export declare class VasJobCopyModel {
13
- accessGroup: VasJobDto['accessGroup'];
14
- jobType: VasJobDto['jobType'];
15
- jobStatus: VasJobDto['jobStatus'];
16
- jobDate: VasJobDto['jobDate'];
17
- assigneeId: VasJobDto['assigneeId'];
13
+ accessGroup: VasJobBaseDto['accessGroup'];
14
+ jobType: VasJobBaseDto['jobType'];
15
+ jobStatus: VasJobBaseDto['jobStatus'];
16
+ jobDate: VasJobBaseDto['jobDate'];
17
+ assigneeId: VasJobBaseDto['assigneeId'];
18
18
  fields: Array<string>;
19
19
  files: Array<string>;
20
20
  reports: Array<string>;
21
- constructor(accessGroup: VasJobDto['accessGroup'], jobType: VasJobDto['jobType'], jobStatus: VasJobDto['jobStatus'], jobDate: VasJobDto['jobDate'], assigneeId: VasJobDto['assigneeId'], fields: Array<string>, files: Array<string>, reports: Array<string>);
21
+ constructor(accessGroup: VasJobBaseDto['accessGroup'], jobType: VasJobBaseDto['jobType'], jobStatus: VasJobBaseDto['jobStatus'], jobDate: VasJobBaseDto['jobDate'], assigneeId: VasJobBaseDto['assigneeId'], fields: Array<string>, files: Array<string>, reports: Array<string>);
22
22
  static fromDto(dto: Partial<VasJobCopyDto>): VasJobCopyModel;
23
23
  toDto(): VasJobCopyDto;
24
24
  toApiDto(): Record<string, unknown>;
@@ -1,16 +1,17 @@
1
1
  import { VasFileDto } from './vas-file.dto';
2
2
  import { VasRestrictedAccountObjectDto } from './vas-restricted-account-object.dto';
3
- import { FieldValueType } from './vas-field.dto';
3
+ import { FieldValueType, VasFieldDto } from './vas-field.dto';
4
4
  import { GeoLocation } from '../model';
5
5
  import { VasReportDto } from './vas-report.dto';
6
6
  import { VasTaskDto } from './vas-task.dto';
7
7
  import { VasNoteDto } from './vas-note.dto';
8
8
  import { VasJobEmailDto } from './vas-job-email.dto';
9
9
  import { VasInstructionDto } from './vas-instruction.dto';
10
- export interface VasJobDto extends VasRestrictedAccountObjectDto {
10
+ export interface VasJobBaseDto extends VasRestrictedAccountObjectDto {
11
11
  reference: string;
12
12
  jobDate: string;
13
13
  jobStatus: string;
14
+ jobStatusLastUpdate: string;
14
15
  jobType: string;
15
16
  assigneeId: string;
16
17
  formId: string;
@@ -20,10 +21,15 @@ export interface VasJobDto extends VasRestrictedAccountObjectDto {
20
21
  version: number;
21
22
  geoLocation: GeoLocation;
22
23
  files: Array<VasFileDto>;
23
- fields: Record<string, FieldValueType>;
24
24
  jobEmails: Array<VasJobEmailDto>;
25
25
  notes: Array<VasNoteDto>;
26
26
  reports: Array<VasReportDto>;
27
27
  tasks: Array<VasTaskDto>;
28
28
  instruction: null | VasInstructionDto;
29
29
  }
30
+ export interface VasJobRelationalDto extends VasJobBaseDto {
31
+ fields: Array<VasFieldDto>;
32
+ }
33
+ export interface VasJobDocumentDto extends VasJobBaseDto {
34
+ fields: Record<string, FieldValueType>;
35
+ }
@@ -2,7 +2,7 @@ import { VasFileDto } from './vas-file.dto';
2
2
  import { VasBaseDto } from './vas-base.dto';
3
3
  import { FieldValueType } from './vas-field.dto';
4
4
  import { VasFormModel } from './vas-form.model';
5
- import { VasJobDto } from './vas-job.dto';
5
+ import { VasJobBaseDto, VasJobDocumentDto, VasJobRelationalDto } from './vas-job.dto';
6
6
  import { VasRestrictedAccountObjectModel } from './vas-restricted-account-object.model';
7
7
  import { GeoLocation } from '../model';
8
8
  import { VasReportDto } from './vas-report.dto';
@@ -10,14 +10,15 @@ import { VasTaskDto } from './vas-task.dto';
10
10
  import { VasNoteDto } from './vas-note.dto';
11
11
  import { VasJobEmailDto } from './vas-job-email.dto';
12
12
  import { VasInstructionDto } from './vas-instruction.dto';
13
+ import { VasFieldModel } from './vas-field.model';
13
14
  export interface ParseSyntaxOptions {
14
15
  timeZoneOffset: number;
15
16
  objects?: Record<string, Partial<VasBaseDto> | Record<string, FieldValueType>>;
16
17
  }
17
18
  /**
18
- * JobModel
19
+ * VasJobBaseModel
19
20
  */
20
- export declare class VasJobModel extends VasRestrictedAccountObjectModel {
21
+ export declare abstract class VasJobBaseModel<FType extends Record<string, FieldValueType> | Array<VasFieldModel>> extends VasRestrictedAccountObjectModel {
21
22
  id: string;
22
23
  created: string;
23
24
  serverCreated: string;
@@ -32,6 +33,7 @@ export declare class VasJobModel extends VasRestrictedAccountObjectModel {
32
33
  reference: string;
33
34
  jobDate: string;
34
35
  jobStatus: string;
36
+ jobStatusLastUpdate: string;
35
37
  jobType: string;
36
38
  assigneeId: string;
37
39
  formId: string;
@@ -41,24 +43,19 @@ export declare class VasJobModel extends VasRestrictedAccountObjectModel {
41
43
  version: number;
42
44
  geoLocation: GeoLocation;
43
45
  files: Array<VasFileDto>;
44
- fields: Record<string, FieldValueType>;
46
+ fields: FType;
45
47
  jobEmails: Array<VasJobEmailDto>;
46
48
  notes: Array<VasNoteDto>;
47
49
  reports: Array<VasReportDto>;
48
50
  tasks: Array<VasTaskDto>;
49
51
  instruction: VasInstructionDto | null;
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);
52
+ 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, jobStatusLastUpdate: string, jobType: string, assigneeId: string, formId: string, timeZoneOffset: number, pendingFields: number, childModified: string, version: number, geoLocation: GeoLocation, files: Array<VasFileDto>, fields: FType, jobEmails: Array<VasJobEmailDto>, notes: Array<VasNoteDto>, reports: Array<VasReportDto>, tasks: Array<VasTaskDto>, instruction: VasInstructionDto | null);
51
53
  get createdByDisplayName(): string;
52
54
  get modifiedByDisplayName(): string;
53
55
  /**
54
56
  * Return the list of Job properties
55
57
  */
56
58
  get staticProperties(): Set<string>;
57
- /**
58
- * @return {VasJobModel}
59
- */
60
- static empty(): VasJobModel;
61
- static fromDto(dto: Partial<VasJobDto>): VasJobModel;
62
59
  /**
63
60
  * Returns an object describing how many attachments were added to this job
64
61
  * (camera controls and files), and how many have not been uploaded yet.
@@ -73,8 +70,7 @@ export declare class VasJobModel extends VasRestrictedAccountObjectModel {
73
70
  /**
74
71
  * @param path path segments
75
72
  */
76
- getValueByPath<T>(path?: string | string[]): T | undefined;
77
- toDto(): VasJobDto;
73
+ getValueByPath<T>(path?: string | string[]): T | null | undefined;
78
74
  /**
79
75
  * This method will parse a syntax that allows us to build strings from the
80
76
  * values of from the job model. For example if the job model was:
@@ -106,5 +102,21 @@ export declare class VasJobModel extends VasRestrictedAccountObjectModel {
106
102
  * @return {object}
107
103
  */
108
104
  toApiDto(): Record<string, string | number | boolean>;
109
- static toApiPatchDto(item: Partial<VasJobDto>): Partial<VasJobDto>;
105
+ static toApiPatchDto(item: Partial<VasJobBaseDto>): Partial<VasJobBaseDto>;
106
+ }
107
+ export declare class VasJobRelationalModel extends VasJobBaseModel<Array<VasFieldModel>> {
108
+ getValueByPath<T>(path?: string | string[]): T | null | undefined;
109
+ getFieldsMap(): Record<string, FieldValueType>;
110
+ getFieldValueByPath<T extends FieldValueType>(controlName: string, path: string[]): T | null | undefined;
111
+ static fromDto(dto: Partial<VasJobRelationalDto>): VasJobRelationalModel;
112
+ static empty(): VasJobRelationalModel;
113
+ toDto(): VasJobRelationalDto;
114
+ }
115
+ export declare class VasJobDocumentModel extends VasJobBaseModel<Record<string, FieldValueType>> {
116
+ static fromRelationalDto(dto: Partial<VasJobRelationalDto>): VasJobDocumentModel;
117
+ static fromDto(dto: Partial<VasJobDocumentDto>): VasJobDocumentModel;
118
+ static empty(): VasJobDocumentModel;
119
+ toDto(): VasJobDocumentDto;
110
120
  }
121
+ /** @deprecated use either VasJobDocumentModel or VasJobRelationalModel **/
122
+ export type VasJobModel = VasJobDocumentModel | VasJobRelationalModel;
@@ -0,0 +1,13 @@
1
+ import { EstimateDto, EstimateSummaryDto } from './estimate.dto';
2
+ export interface EstimateControlValueSummaryDto {
3
+ original: EstimateSummaryDto;
4
+ latest: EstimateSummaryDto;
5
+ savings: EstimateSummaryDto;
6
+ }
7
+ /**
8
+ * Describes the value of the estimate control
9
+ */
10
+ export interface EstimateControlValueDto {
11
+ estimates: Array<EstimateDto>;
12
+ summary: EstimateControlValueSummaryDto;
13
+ }
@@ -0,0 +1,10 @@
1
+ import { EstimateControlValueSummaryDto } from './estimate-control-value.dto';
2
+ import { EstimateModel } from './estimate.model';
3
+ /**
4
+ * Utility class for computing the summary value for an estimate control given
5
+ * the first and last estimates
6
+ */
7
+ export declare class EstimateControlValueModel {
8
+ static calculateSummary(original: EstimateModel, latest: EstimateModel): EstimateControlValueSummaryDto;
9
+ static getEmptySummary(): EstimateControlValueSummaryDto;
10
+ }
@@ -0,0 +1,15 @@
1
+ import { EstimateCostCategory, EstimateWorkCategory } from './estimate.types';
2
+ export interface EstimateItemDto {
3
+ id: string;
4
+ description: string;
5
+ type: string;
6
+ quantity: number;
7
+ units: number;
8
+ price: string;
9
+ workCategory: EstimateWorkCategory;
10
+ costCategory: EstimateCostCategory;
11
+ comment: string;
12
+ quantityAdjusted: number;
13
+ unitsAdjusted: number;
14
+ priceAdjusted: string;
15
+ }
@@ -0,0 +1,23 @@
1
+ import { EstimateItemDto } from './estimate-item.dto';
2
+ import { EstimateCostCategory, EstimateWorkCategory } from './estimate.types';
3
+ export declare class EstimateItemModel {
4
+ id: string;
5
+ description: string;
6
+ type: string;
7
+ quantity: number;
8
+ quantityAdjusted: number;
9
+ units: number;
10
+ unitsAdjusted: number;
11
+ price: string;
12
+ priceAdjusted: string;
13
+ workCategory: EstimateWorkCategory;
14
+ costCategory: EstimateCostCategory;
15
+ comment: string;
16
+ constructor(id: string, description: string, type: string, quantity: number, quantityAdjusted: number, units: number, unitsAdjusted: number, price: string, priceAdjusted: string, workCategory: EstimateWorkCategory, costCategory: EstimateCostCategory, comment: string);
17
+ getTotalUnits(adjusted?: boolean): string;
18
+ getLineValue(labourRate?: string, timeBasis?: string, adjusted?: boolean): string;
19
+ toDto(): EstimateItemDto;
20
+ static create(): EstimateItemModel;
21
+ static fromDto(dto: Partial<EstimateItemDto>): EstimateItemModel;
22
+ static equal(a: EstimateItemDto | undefined, b: EstimateItemDto | undefined): boolean;
23
+ }
@@ -0,0 +1,36 @@
1
+ import { EstimateItemDto } from './estimate-item.dto';
2
+ import { EstimateSource, EstimateSundryMethod } from './estimate.model';
3
+ import { EstimateCostCategory } from './estimate.types';
4
+ export type CostCategorySummary = Record<EstimateCostCategory, string>;
5
+ export interface CostCategorySummaryTotals {
6
+ net: string;
7
+ vat: string;
8
+ gross: string;
9
+ hours: string;
10
+ labourRate: string;
11
+ }
12
+ export type EstimateSummaryDto = CostCategorySummary & CostCategorySummaryTotals;
13
+ export interface EstimateDto {
14
+ id: string;
15
+ source: EstimateSource;
16
+ label: string;
17
+ comment: string;
18
+ timestamp: string;
19
+ version: number;
20
+ net: string;
21
+ vat: string;
22
+ gross: string;
23
+ labourRate: string;
24
+ vatRate: string;
25
+ sundryRate: string;
26
+ sundryMax: string;
27
+ sundryFixed: string;
28
+ sundryMethod: EstimateSundryMethod;
29
+ partsDiscount: string;
30
+ paintDiscount: string;
31
+ timeBasis: string;
32
+ adjusted: boolean;
33
+ items: Array<EstimateItemDto>;
34
+ summary: EstimateSummaryDto;
35
+ summaryAdjusted: EstimateSummaryDto | null;
36
+ }
@@ -0,0 +1,54 @@
1
+ import { EstimateItemModel } from './estimate-item.model';
2
+ import { EstimateDto, EstimateSummaryDto } from './estimate.dto';
3
+ import { EstimateItemDto } from './estimate-item.dto';
4
+ export declare type EstimateSundryMethod = 'percentage' | 'percentage-with-max' | 'fixed';
5
+ export declare type EstimateSource = 'audatex' | 'glassmatix' | 'manual' | 'ibody';
6
+ export declare class EstimateModel {
7
+ id: string;
8
+ source: EstimateSource;
9
+ label: string;
10
+ comment: string;
11
+ timestamp: string;
12
+ version: number;
13
+ net: string;
14
+ vat: string;
15
+ gross: string;
16
+ labourRate: string;
17
+ vatRate: string;
18
+ sundryRate: string;
19
+ sundryMax: string;
20
+ sundryFixed: string;
21
+ sundryMethod: EstimateSundryMethod;
22
+ partsDiscount: string;
23
+ paintDiscount: string;
24
+ timeBasis: string;
25
+ adjusted: boolean;
26
+ items: Array<EstimateItemModel>;
27
+ summaryNet: EstimateSummaryDto;
28
+ summary: EstimateSummaryDto;
29
+ summaryAdjusted: EstimateSummaryDto;
30
+ static create(source?: EstimateSource): EstimateModel;
31
+ static fromDto(dto: Partial<EstimateDto>): EstimateModel;
32
+ addItem(modelOrDto: EstimateItemModel | Partial<EstimateItemDto>, opts?: {
33
+ calculate?: boolean;
34
+ }): void;
35
+ addItems(items: Array<EstimateItemModel>, opts?: {
36
+ calculate?: boolean;
37
+ }): void;
38
+ calculate(): void;
39
+ /**
40
+ * Returns the net summary (before sundries and discounts) of the estimate.
41
+ * By summary, we mean grouping the costs by cost category.
42
+ *
43
+ * @param adjusted if the values should be calculated using the original or
44
+ * adjusted values
45
+ */
46
+ getSummaryNet(adjusted?: boolean): EstimateSummaryDto;
47
+ /**
48
+ * Applies the sundry and discount values to the net summary.
49
+
50
+ */
51
+ getSummary(summaryNet: EstimateDto['summary'], sundryRate: string, sundryMax: string, sundryFixed: string, sundryMethod: EstimateSundryMethod, partsDiscount: string, paintDiscount: string, adjusted: boolean): EstimateDto['summary'];
52
+ toDto(): EstimateDto;
53
+ getTotalHours(adjusted?: boolean): string;
54
+ }
@@ -0,0 +1,2 @@
1
+ export declare type EstimateWorkCategory = 'none' | 'blend' | 'check' | 'new' | 'paint' | 'rr' | 'removed' | 'repair' | 'specialist';
2
+ export declare type EstimateCostCategory = 'labour' | 'none' | 'pm' | 'pl' | 'parts' | 'other' | 'specialist';
@@ -0,0 +1,7 @@
1
+ export * from './estimate.dto';
2
+ export * from './estimate.model';
3
+ export * from './estimate.types';
4
+ export * from './estimate-control-value.dto';
5
+ export * from './estimate-control-value.model';
6
+ export * from './estimate-item.dto';
7
+ export * from './estimate-item.model';
@@ -1,3 +1,5 @@
1
+ export * from './estimate-control';
1
2
  export * from './firebase-document-meta.interface';
2
3
  export * from './geo-location';
4
+ export * from './report-invocation';
3
5
  export * from './vas-time-range.model';
@@ -0,0 +1,39 @@
1
+ import { FieldValueType } from '../entity';
2
+ export interface ReportInvocationFile {
3
+ id: string;
4
+ name: string;
5
+ sequence: number;
6
+ fileSize: number;
7
+ mimeType: string;
8
+ url: string;
9
+ embedLink: boolean;
10
+ rotation: number;
11
+ description: string;
12
+ displayAs: string;
13
+ displayedName: string;
14
+ group: string;
15
+ index: number;
16
+ }
17
+ export interface ReportInvocation {
18
+ id: string;
19
+ reportLayout: string;
20
+ data: {
21
+ id: string;
22
+ account: string;
23
+ reference: string;
24
+ jobDate: string;
25
+ assigneeId: string;
26
+ assigneeName: string;
27
+ jobStatus: string;
28
+ jobType: string;
29
+ /** @deprecated */
30
+ timeZoneOffset?: number;
31
+ files: {
32
+ photo: Array<ReportInvocationFile>;
33
+ documents: Array<ReportInvocationFile>;
34
+ other: Array<ReportInvocationFile>;
35
+ pdf: Array<ReportInvocationFile>;
36
+ };
37
+ fields: Record<string, FieldValueType>;
38
+ };
39
+ }
@@ -1,18 +1,8 @@
1
1
  /**
2
- * A non sophisticated way to get values from the job via paths. For example:
2
+ * Get a value from an object by path.
3
3
  *
4
- * getValueByPath(
5
- * ['foo', 'bar'],
6
- * {
7
- * foo: {
8
- * bar: 'value'
9
- * }
10
- * }
11
- * );
12
- *
13
- * will return "value"
14
- * @param {string[]} path
15
- * @param {Record<string, FieldValueType>} object
16
- * @return {T | undefined}
4
+ * Path can be an array of strings or numbers.
5
+ * Path can be a string using dot notation, which can include square brackets to
6
+ * access array positions e.g. foo.bar[0].baz
17
7
  */
18
- export declare const getValueByPath: <T>(path: string[], object: Record<string, any>) => T | undefined;
8
+ export declare function getValueByPath<T>(path: string | number | Array<string | number>, object: null | Record<string, any>): T | null | undefined;
@@ -0,0 +1,7 @@
1
+ export * from './get-value-by-path';
2
+ export * from './is-array-string';
3
+ export * from './is-numeric';
4
+ export * from './is-plain-object';
5
+ export * from './omit';
6
+ export * from './only';
7
+ export * from './try-json';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Return true IFF the array contains only strings
3
+ */
4
+ export declare const isArrayString: (value: any) => value is Array<string>;
@@ -0,0 +1 @@
1
+ export declare function isNumeric(value: string | number): value is number;
@@ -1 +1,4 @@
1
+ /**
2
+ * Return true if the argument is a plain object {}, i.e. not an array, null.
3
+ */
1
4
  export declare function isPlainObject<T>(value: any): value is T;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Return an object omitting properties specified by key(s)
3
+ *
4
+ * @param obj object to be processed
5
+ * @param omitKey key or array of keys to be omitted
6
+ */
7
+ export declare const omit: <T extends Record<string, any>>(obj: T, omitKey: string | Array<string>) => Partial<T>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Try to parse the value as JSON if it looks like a JSON encoded string
3
- * @param value
2
+ * Try to parse the value as JSON if it looks like a JSON encoded string, return
3
+ * the original value if it's not a JSON string or parsing fails.
4
4
  */
5
5
  export declare const tryJson: <T>(value: T) => Record<string, any> | T;
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@ironcode/vas-lib",
3
- "version": "3.0.0-alpha.2",
3
+ "version": "3.0.0-alpha.5",
4
4
  "peerDependencies": {
5
5
  "angular2-uuid": "^1.1.1",
6
- "moment": "^2.0.0"
6
+ "moment": "^2.0.0",
7
+ "uuid": "^9.0.1"
7
8
  },
8
9
  "dependencies": {
9
10
  "tslib": "^2.3.0"
package/public-api.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from './lib/controls-config/index';
3
3
  export * from './lib/elastic/index';
4
4
  export * from './lib/entity/index';
5
5
  export * from './lib/model/index';
6
+ export * from './lib/utils';