@ironcode/vas-lib 3.0.0-alpha.1 → 3.0.0-alpha.12

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 (124) 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 +12 -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 +28 -13
  22. package/cjs/lib/entity/vas-job.model.d.ts.map +1 -1
  23. package/cjs/lib/entity/vas-job.model.js +230 -96
  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 +17 -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 +25 -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 +126 -0
  40. package/cjs/lib/model/estimate-control/estimate-item.model.js.map +1 -0
  41. package/cjs/lib/model/estimate-control/estimate-source.d.ts +2 -0
  42. package/cjs/lib/model/estimate-control/estimate-source.d.ts.map +1 -0
  43. package/cjs/lib/model/estimate-control/estimate-source.js +3 -0
  44. package/cjs/lib/model/estimate-control/estimate-source.js.map +1 -0
  45. package/cjs/lib/model/estimate-control/estimate.dto.d.ts +38 -0
  46. package/cjs/lib/model/estimate-control/estimate.dto.d.ts.map +1 -0
  47. package/cjs/lib/model/estimate-control/estimate.dto.js +3 -0
  48. package/cjs/lib/model/estimate-control/estimate.dto.js.map +1 -0
  49. package/cjs/lib/model/estimate-control/estimate.model.d.ts +55 -0
  50. package/cjs/lib/model/estimate-control/estimate.model.d.ts.map +1 -0
  51. package/cjs/lib/model/estimate-control/estimate.model.js +278 -0
  52. package/cjs/lib/model/estimate-control/estimate.model.js.map +1 -0
  53. package/cjs/lib/model/estimate-control/estimate.types.d.ts +3 -0
  54. package/cjs/lib/model/estimate-control/estimate.types.d.ts.map +1 -0
  55. package/cjs/lib/model/estimate-control/estimate.types.js +3 -0
  56. package/cjs/lib/model/estimate-control/estimate.types.js.map +1 -0
  57. package/cjs/lib/model/estimate-control/index.d.ts +9 -0
  58. package/cjs/lib/model/estimate-control/index.d.ts.map +1 -0
  59. package/cjs/lib/model/estimate-control/index.js +11 -0
  60. package/cjs/lib/model/estimate-control/index.js.map +1 -0
  61. package/cjs/lib/model/index.d.ts +2 -0
  62. package/cjs/lib/model/index.d.ts.map +1 -1
  63. package/cjs/lib/model/index.js +2 -0
  64. package/cjs/lib/model/index.js.map +1 -1
  65. package/cjs/lib/model/report-invocation.d.ts +40 -0
  66. package/cjs/lib/model/report-invocation.d.ts.map +1 -0
  67. package/cjs/lib/model/report-invocation.js +3 -0
  68. package/cjs/lib/model/report-invocation.js.map +1 -0
  69. package/cjs/lib/utils/get-value-by-path.d.ts +5 -15
  70. package/cjs/lib/utils/get-value-by-path.d.ts.map +1 -1
  71. package/cjs/lib/utils/get-value-by-path.js +48 -59
  72. package/cjs/lib/utils/get-value-by-path.js.map +1 -1
  73. package/cjs/lib/utils/index.d.ts +8 -0
  74. package/cjs/lib/utils/index.d.ts.map +1 -0
  75. package/cjs/lib/utils/index.js +11 -0
  76. package/cjs/lib/utils/index.js.map +1 -0
  77. package/cjs/lib/utils/is-array-string.d.ts +3 -0
  78. package/cjs/lib/utils/is-array-string.d.ts.map +1 -1
  79. package/cjs/lib/utils/is-array-string.js +3 -0
  80. package/cjs/lib/utils/is-array-string.js.map +1 -1
  81. package/cjs/lib/utils/is-numeric.d.ts +2 -0
  82. package/cjs/lib/utils/is-numeric.d.ts.map +1 -0
  83. package/cjs/lib/utils/is-numeric.js +10 -0
  84. package/cjs/lib/utils/is-numeric.js.map +1 -0
  85. package/cjs/lib/utils/is-plain-object.d.ts +3 -0
  86. package/cjs/lib/utils/is-plain-object.d.ts.map +1 -1
  87. package/cjs/lib/utils/is-plain-object.js +3 -0
  88. package/cjs/lib/utils/is-plain-object.js.map +1 -1
  89. package/cjs/lib/utils/try-json.d.ts +2 -2
  90. package/cjs/lib/utils/try-json.js +2 -2
  91. package/cjs/lib/utils/try-json.js.map +1 -1
  92. package/cjs/public-api.d.ts +1 -0
  93. package/cjs/public-api.d.ts.map +1 -1
  94. package/cjs/public-api.js +1 -0
  95. package/cjs/public-api.js.map +1 -1
  96. package/fesm2022/ironcode-vas-lib.mjs +797 -149
  97. package/fesm2022/ironcode-vas-lib.mjs.map +1 -1
  98. package/lib/control-value/vas-camera-control-value.model.d.ts +4 -2
  99. package/lib/entity/vas-base.model.d.ts +1 -1
  100. package/lib/entity/vas-field.dto.d.ts +3 -4
  101. package/lib/entity/vas-form.model.d.ts +1 -1
  102. package/lib/entity/vas-job-copy.d.ts +12 -12
  103. package/lib/entity/vas-job.dto.d.ts +12 -3
  104. package/lib/entity/vas-job.model.d.ts +28 -13
  105. package/lib/model/estimate-control/estimate-control-value.dto.d.ts +13 -0
  106. package/lib/model/estimate-control/estimate-control-value.model.d.ts +10 -0
  107. package/lib/model/estimate-control/estimate-item.dto.d.ts +16 -0
  108. package/lib/model/estimate-control/estimate-item.model.d.ts +24 -0
  109. package/lib/model/estimate-control/estimate-source.d.ts +1 -0
  110. package/lib/model/estimate-control/estimate.dto.d.ts +37 -0
  111. package/lib/model/estimate-control/estimate.model.d.ts +54 -0
  112. package/lib/model/estimate-control/estimate.types.d.ts +2 -0
  113. package/lib/model/estimate-control/index.d.ts +8 -0
  114. package/lib/model/index.d.ts +2 -0
  115. package/lib/model/report-invocation.d.ts +39 -0
  116. package/lib/utils/get-value-by-path.d.ts +5 -15
  117. package/lib/utils/index.d.ts +7 -0
  118. package/lib/utils/is-array-string.d.ts +4 -0
  119. package/lib/utils/is-numeric.d.ts +1 -0
  120. package/lib/utils/is-plain-object.d.ts +3 -0
  121. package/lib/utils/omit.d.ts +7 -0
  122. package/lib/utils/try-json.d.ts +2 -2
  123. package/package.json +3 -2
  124. package/public-api.d.ts +1 -0
@@ -0,0 +1,278 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EstimateModel = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const big_js_1 = require("big.js");
6
+ const moment_1 = tslib_1.__importDefault(require("moment"));
7
+ const uuid_1 = require("uuid");
8
+ const estimate_item_model_1 = require("./estimate-item.model");
9
+ const b = (value = '0') => {
10
+ try {
11
+ if (typeof value === 'string') {
12
+ return new big_js_1.Big(value.replace(/[^\d^.]/g, ''));
13
+ }
14
+ return new big_js_1.Big(value);
15
+ }
16
+ catch (e) {
17
+ console.error(`failed to construct Big from value '${value}'`);
18
+ return new big_js_1.Big('0');
19
+ }
20
+ };
21
+ function isLabourWorkCategory(value) {
22
+ return ['check', 'rr', 'repair', 'removed'].includes(value);
23
+ }
24
+ function isPaintWorkCategory(value) {
25
+ return ['blend', 'paint'].includes(value);
26
+ }
27
+ class EstimateModel {
28
+ constructor() {
29
+ this.id = (0, uuid_1.v4)();
30
+ this.source = 'manual';
31
+ this.label = '';
32
+ this.comment = '';
33
+ this.timestamp = (0, moment_1.default)().toISOString();
34
+ this.version = 1;
35
+ this.net = '0.00';
36
+ this.vat = '0.00';
37
+ this.gross = '0.00';
38
+ this.labourRate = '1';
39
+ this.vatRate = '0.00';
40
+ this.sundryRate = '0.00';
41
+ this.sundryMax = '0.00';
42
+ this.sundryFixed = '0.00';
43
+ this.sundryMethod = 'fixed';
44
+ this.partsDiscount = '0.00';
45
+ this.paintDiscount = '0.00';
46
+ this.timeBasis = '1';
47
+ this.adjusted = false;
48
+ this.items = [];
49
+ this.summaryNet = {
50
+ labour: '0.00',
51
+ none: '0.00',
52
+ parts: '0.00',
53
+ pm: '0.00',
54
+ pl: '0.00',
55
+ specialist: '0.00',
56
+ other: '0.00',
57
+ gross: '0.00',
58
+ net: '0.00',
59
+ hours: '0.00',
60
+ vat: '0.00',
61
+ labourRate: '0.00',
62
+ };
63
+ this.summary = {
64
+ labour: '0.00',
65
+ none: '0.00',
66
+ parts: '0.00',
67
+ pm: '0.00',
68
+ pl: '0.00',
69
+ specialist: '0.00',
70
+ other: '0.00',
71
+ gross: '0.00',
72
+ net: '0.00',
73
+ hours: '0.00',
74
+ vat: '0.00',
75
+ labourRate: '0.00',
76
+ };
77
+ this.summaryAdjusted = {
78
+ labour: '0.00',
79
+ none: '0.00',
80
+ parts: '0.00',
81
+ pm: '0.00',
82
+ pl: '0.00',
83
+ specialist: '0.00',
84
+ other: '0.00',
85
+ gross: '0.00',
86
+ net: '0.00',
87
+ hours: '0.00',
88
+ vat: '0.00',
89
+ labourRate: '0.00',
90
+ };
91
+ }
92
+ get timeBasisSafe() {
93
+ return (this.timeBasis || '1') === '0' ? '1' : this.timeBasis;
94
+ }
95
+ static create(source = 'manual') {
96
+ const model = new EstimateModel();
97
+ model.source = source;
98
+ return model;
99
+ }
100
+ static fromDto(dto) {
101
+ var _a;
102
+ const model = new this();
103
+ Object.assign(model, Object.assign(Object.assign({}, dto), { items: (_a = dto.items) === null || _a === void 0 ? void 0 : _a.map(item => estimate_item_model_1.EstimateItemModel.fromDto(item)) }));
104
+ model.calculate();
105
+ return model;
106
+ }
107
+ addItem(modelOrDto, opts) {
108
+ this.items.push(modelOrDto instanceof estimate_item_model_1.EstimateItemModel ?
109
+ modelOrDto :
110
+ estimate_item_model_1.EstimateItemModel.fromDto(modelOrDto));
111
+ if (!opts || (opts && opts.calculate)) {
112
+ this.calculate();
113
+ }
114
+ }
115
+ addItems(items, opts) {
116
+ this.items = this.items.concat(items);
117
+ if (!opts || (opts && opts.calculate)) {
118
+ this.calculate();
119
+ }
120
+ }
121
+ calculate() {
122
+ this.summaryNet = this.getSummaryNet(false);
123
+ if (this.adjusted) {
124
+ this.summaryAdjusted = this.getSummary(this.summaryNet, this.sundryRate, this.sundryMax, this.sundryFixed, this.sundryMethod, this.partsDiscount, this.paintDiscount, true);
125
+ }
126
+ this.summary = this.getSummary(this.summaryNet, this.sundryRate, this.sundryMax, this.sundryFixed, this.sundryMethod, this.partsDiscount, this.paintDiscount, false);
127
+ this.net = this.summary.net;
128
+ this.vat = this.summary.vat;
129
+ this.gross = this.summary.gross;
130
+ }
131
+ /**
132
+ * Returns the net summary (before sundries and discounts) of the estimate.
133
+ * By summary, we mean grouping the costs by cost category.
134
+ *
135
+ * @param adjusted if the values should be calculated using the original or
136
+ * adjusted values
137
+ */
138
+ getSummaryNet(adjusted = false) {
139
+ const summary = this.items.reduce((map, item) => {
140
+ map[item.costCategory] = b(map[item.costCategory] || '0')
141
+ .add(item.getLineValue(this.labourRate, this.timeBasisSafe, adjusted, this.source === 'gtmotive' ? false : undefined))
142
+ .toFixed(2);
143
+ return map;
144
+ }, {
145
+ labour: '0.00',
146
+ none: '0.00',
147
+ parts: '0.00',
148
+ pm: '0.00',
149
+ pl: '0.00',
150
+ specialist: '0.00',
151
+ other: '0.00',
152
+ net: '0.00',
153
+ vat: '0.00',
154
+ gross: '0.00',
155
+ hours: '0.00',
156
+ labourRate: '0',
157
+ });
158
+ if (this.source === 'audatex') {
159
+ const mechHours = this.items
160
+ .reduce((h, item) => {
161
+ return isLabourWorkCategory(item.workCategory) ?
162
+ h.add(b(item.quantity || '0').mul(item.units || '0')) :
163
+ h;
164
+ }, b())
165
+ .div(this.timeBasisSafe || '1')
166
+ .round(2);
167
+ const paintHours = this.items
168
+ .reduce((h, item) => {
169
+ return isPaintWorkCategory(item.workCategory) ?
170
+ h.add(b(item.quantity || '0').mul(item.units || '0')) :
171
+ h;
172
+ }, b())
173
+ .div(this.timeBasisSafe || '1')
174
+ .round(1);
175
+ const mechCost = mechHours.mul(this.labourRate || '0');
176
+ const paintCost = paintHours.mul(this.labourRate || '0');
177
+ summary.labour = mechCost.add(paintCost).toFixed(2);
178
+ }
179
+ return summary;
180
+ }
181
+ /**
182
+ * Applies the sundry and discount values to the net summary.
183
+ */
184
+ getSummary(summaryNet, sundryRate, sundryMax, sundryFixed, sundryMethod, partsDiscount, paintDiscount, adjusted) {
185
+ const partsDisc = b('1').minus(partsDiscount || '0');
186
+ const paintDisc = b('1').minus(paintDiscount || '0');
187
+ let partsSundry = '0.00';
188
+ if (sundryMethod === 'percentage') {
189
+ partsSundry = b(summaryNet.parts).mul(sundryRate || '1').toFixed(2);
190
+ }
191
+ else if (sundryMethod === 'percentage-with-max') {
192
+ partsSundry = b(summaryNet.parts).mul(sundryRate || '1').toFixed(2);
193
+ partsSundry = Math.min(parseFloat(sundryMax || '0'), parseFloat(partsSundry)).toFixed(2);
194
+ }
195
+ else if (sundryMethod === 'fixed') {
196
+ partsSundry = b(sundryFixed).toFixed(2);
197
+ }
198
+ const parts = b(summaryNet.parts).add(partsSundry);
199
+ const net = b(0)
200
+ .add(summaryNet.labour)
201
+ .add(summaryNet.none)
202
+ .add(parts)
203
+ .add(summaryNet.pm)
204
+ .add(summaryNet.specialist)
205
+ .toFixed(2);
206
+ const vat = b(net || '0')
207
+ .mul(this.vatRate || '0')
208
+ .toFixed(2);
209
+ let gross = b(net || '0').add(vat || '0').toFixed(2);
210
+ // calculate the total value of lines that are VAT excluded
211
+ const vatExcludeTotal = this.items.reduce((p, c) => c.vatExcluded ?
212
+ p.add(c.getLineValue(this.labourRate, this.timeBasisSafe, adjusted, true)) :
213
+ p, b());
214
+ gross = b(gross).add(vatExcludeTotal).toFixed(2);
215
+ return {
216
+ labour: summaryNet.labour,
217
+ none: summaryNet.none,
218
+ parts: b(parts).mul(partsDisc).toFixed(2),
219
+ pm: b(summaryNet.pm).mul(paintDisc).toFixed(2),
220
+ pl: summaryNet.pl,
221
+ specialist: summaryNet.specialist,
222
+ other: summaryNet.other,
223
+ net: net,
224
+ vat: vat,
225
+ gross: gross,
226
+ labourRate: this.labourRate,
227
+ hours: this.getTotalHours(adjusted)
228
+ };
229
+ }
230
+ toDto() {
231
+ return {
232
+ id: this.id,
233
+ source: this.source,
234
+ label: this.label,
235
+ comment: this.comment,
236
+ timestamp: this.timestamp,
237
+ version: this.version,
238
+ net: this.net,
239
+ vat: this.vat,
240
+ gross: this.gross,
241
+ labourRate: this.labourRate,
242
+ vatRate: this.vatRate,
243
+ sundryRate: this.sundryRate,
244
+ sundryMax: this.sundryMax,
245
+ sundryFixed: this.sundryFixed,
246
+ sundryMethod: this.sundryMethod,
247
+ partsDiscount: this.partsDiscount,
248
+ paintDiscount: this.paintDiscount,
249
+ timeBasis: this.timeBasisSafe,
250
+ items: this.items.map(i => i.toDto()),
251
+ adjusted: this.adjusted,
252
+ summary: this.summary,
253
+ summaryAdjusted: this.summaryAdjusted
254
+ };
255
+ }
256
+ getTotalHours(adjusted = false) {
257
+ if (this.source === 'audatex') {
258
+ const mechUnitsHours = this.items
259
+ .filter(item => item.workCategory !== 'paint')
260
+ .reduce((h, item) => h.add(b(item.getTotalUnits(adjusted))), b())
261
+ .round(2)
262
+ .div(this.timeBasisSafe);
263
+ const paintHours = this.items
264
+ .filter(item => item.workCategory === 'paint')
265
+ .reduce((h, item) => h.add(b(item.getTotalUnits(adjusted))), b())
266
+ .round(1)
267
+ .div(this.timeBasisSafe);
268
+ return mechUnitsHours.add(paintHours).toFixed(2);
269
+ }
270
+ const units = this.items
271
+ .filter(i => i.costCategory === 'labour')
272
+ .reduce((p, c) => p.add(b(c.getTotalUnits(adjusted))), b('0'))
273
+ .toFixed(2);
274
+ return b(units).div(this.timeBasisSafe).toFixed(2);
275
+ }
276
+ }
277
+ exports.EstimateModel = EstimateModel;
278
+ //# sourceMappingURL=estimate.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimate.model.js","sourceRoot":"","sources":["../../../../../../projects/vas-lib/src/lib/model/estimate-control/estimate.model.ts"],"names":[],"mappings":";;;;AAAA,mCAA6B;AAC7B,4DAA4B;AAC5B,+BAAkC;AAClC,+DAA0D;AAW1D,MAAM,CAAC,GAAG,CAAC,QAA+B,GAAG,EAAE,EAAE;IAC/C,IAAI,CAAC;QACH,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,IAAI,YAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,EA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Q,CAAC;aACxC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;aAC7D,OAAO,CAAC,CAAC,CAAC,CAAC;QACd,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC;CACF;AAtUD,sCAsUC","sourcesContent":["import { Big } from 'big.js';\nimport moment from 'moment';\nimport { v4 as uuid } from 'uuid';\nimport { EstimateItemModel } from './estimate-item.model';\nimport { EstimateDto, EstimateSummaryDto } from './estimate.dto';\nimport { EstimateItemDto } from './estimate-item.dto';\nimport { EstimateWorkCategory } from './estimate.types';\nimport { EstimateSource } from './estimate-source';\n\nexport declare type EstimateSundryMethod =\n 'fixed' |\n 'percentage' |\n 'percentage-with-max';\n\nconst b = (value: string | number | Big = '0') => {\n try {\n if (typeof value === 'string') {\n return new Big(value.replace(/[^\\d^.]/g, ''));\n }\n return new Big(value);\n } catch (e) {\n console.error(`failed to construct Big from value '${value}'`);\n return new Big('0');\n }\n};\n\nfunction isLabourWorkCategory(value: EstimateWorkCategory): boolean {\n return ['check', 'rr', 'repair', 'removed'].includes(value);\n}\n\nfunction isPaintWorkCategory(value: EstimateWorkCategory): boolean {\n return ['blend', 'paint'].includes(value);\n}\n\nexport class EstimateModel {\n\n public id: string = uuid();\n public source: EstimateSource = 'manual';\n public label: string = '';\n public comment: string = '';\n public timestamp: string = moment().toISOString();\n public version: number = 1;\n public net: string = '0.00';\n public vat: string = '0.00';\n public gross: string = '0.00';\n public labourRate: string = '1';\n public vatRate: string = '0.00';\n public sundryRate: string = '0.00';\n public sundryMax: string = '0.00';\n public sundryFixed: string = '0.00';\n public sundryMethod: EstimateSundryMethod = 'fixed';\n public partsDiscount: string = '0.00';\n public paintDiscount: string = '0.00';\n public timeBasis: string = '1';\n public adjusted = false;\n public items: Array<EstimateItemModel> = [];\n public summaryNet: EstimateSummaryDto = {\n labour: '0.00',\n none: '0.00',\n parts: '0.00',\n pm: '0.00',\n pl: '0.00',\n specialist: '0.00',\n other: '0.00',\n gross: '0.00',\n net: '0.00',\n hours: '0.00',\n vat: '0.00',\n labourRate: '0.00',\n };\n public summary: EstimateSummaryDto = {\n labour: '0.00',\n none: '0.00',\n parts: '0.00',\n pm: '0.00',\n pl: '0.00',\n specialist: '0.00',\n other: '0.00',\n gross: '0.00',\n net: '0.00',\n hours: '0.00',\n vat: '0.00',\n labourRate: '0.00',\n };\n public summaryAdjusted: EstimateSummaryDto = {\n labour: '0.00',\n none: '0.00',\n parts: '0.00',\n pm: '0.00',\n pl: '0.00',\n specialist: '0.00',\n other: '0.00',\n gross: '0.00',\n net: '0.00',\n hours: '0.00',\n vat: '0.00',\n labourRate: '0.00',\n };\n\n get timeBasisSafe(): string {\n return (this.timeBasis || '1') === '0' ? '1' : this.timeBasis;\n }\n\n static create(source: EstimateSource = 'manual'): EstimateModel {\n const model = new EstimateModel();\n model.source = source;\n return model;\n }\n\n static fromDto<T extends EstimateModel>(\n this: new () => T,\n dto: Partial<EstimateDto>\n ): T {\n const model = new this();\n Object.assign(model, {\n ...dto,\n items: dto.items?.map(item => EstimateItemModel.fromDto(item)),\n });\n model.calculate();\n return model;\n }\n\n addItem(\n modelOrDto: EstimateItemModel | Partial<EstimateItemDto>,\n opts?: { calculate?: boolean }\n ) {\n this.items.push(modelOrDto instanceof EstimateItemModel ?\n modelOrDto :\n EstimateItemModel.fromDto(modelOrDto)\n );\n if (!opts || (opts && opts.calculate)) {\n this.calculate();\n }\n }\n\n addItems(items: Array<EstimateItemModel>, opts?: { calculate?: boolean }) {\n this.items = this.items.concat(items);\n if (!opts || (opts && opts.calculate)) {\n this.calculate();\n }\n }\n\n calculate(): void {\n\n this.summaryNet = this.getSummaryNet(false);\n\n if (this.adjusted) {\n this.summaryAdjusted = this.getSummary(\n this.summaryNet,\n this.sundryRate,\n this.sundryMax,\n this.sundryFixed,\n this.sundryMethod,\n this.partsDiscount,\n this.paintDiscount,\n true\n );\n }\n this.summary = this.getSummary(\n this.summaryNet,\n this.sundryRate,\n this.sundryMax,\n this.sundryFixed,\n this.sundryMethod,\n this.partsDiscount,\n this.paintDiscount,\n false\n );\n\n this.net = this.summary.net;\n this.vat = this.summary.vat;\n this.gross = this.summary.gross;\n }\n\n /**\n * Returns the net summary (before sundries and discounts) of the estimate.\n * By summary, we mean grouping the costs by cost category.\n *\n * @param adjusted if the values should be calculated using the original or\n * adjusted values\n */\n getSummaryNet(adjusted = false): EstimateSummaryDto {\n const summary = this.items.reduce((map, item) => {\n map[item.costCategory] = b(map[item.costCategory] || '0')\n .add(item.getLineValue(\n this.labourRate,\n this.timeBasisSafe,\n adjusted,\n this.source === 'gtmotive' ? false : undefined\n ))\n .toFixed(2);\n return map;\n }, {\n labour: '0.00',\n none: '0.00',\n parts: '0.00',\n pm: '0.00',\n pl: '0.00',\n specialist: '0.00',\n other: '0.00',\n net: '0.00',\n vat: '0.00',\n gross: '0.00',\n hours: '0.00',\n labourRate: '0',\n } as EstimateSummaryDto);\n\n if (this.source === 'audatex') {\n const mechHours = this.items\n .reduce(\n (h, item) => {\n return isLabourWorkCategory(item.workCategory) ?\n h.add(b(item.quantity || '0').mul(item.units || '0')) :\n h;\n },\n b()\n )\n .div(this.timeBasisSafe || '1')\n .round(2);\n const paintHours = this.items\n .reduce(\n (h, item) => {\n return isPaintWorkCategory(item.workCategory) ?\n h.add(b(item.quantity || '0').mul(item.units || '0')) :\n h;\n },\n b()\n )\n .div(this.timeBasisSafe || '1')\n .round(1);\n\n const mechCost = mechHours.mul(this.labourRate || '0');\n const paintCost = paintHours.mul(this.labourRate || '0');\n summary.labour = mechCost.add(paintCost).toFixed(2);\n }\n return summary;\n }\n\n /**\n * Applies the sundry and discount values to the net summary.\n */\n getSummary(\n summaryNet: EstimateDto['summary'],\n sundryRate: string,\n sundryMax: string,\n sundryFixed: string,\n sundryMethod: EstimateSundryMethod,\n partsDiscount: string,\n paintDiscount: string,\n adjusted: boolean\n ): EstimateDto['summary'] {\n const partsDisc = b('1').minus(partsDiscount || '0');\n const paintDisc = b('1').minus(paintDiscount || '0');\n\n let partsSundry = '0.00';\n\n if (sundryMethod === 'percentage') {\n partsSundry = b(summaryNet.parts).mul(sundryRate || '1').toFixed(2);\n } else if (sundryMethod === 'percentage-with-max') {\n partsSundry = b(summaryNet.parts).mul(sundryRate || '1').toFixed(2);\n partsSundry = Math.min(\n parseFloat(sundryMax || '0'),\n parseFloat(partsSundry)\n ).toFixed(2);\n } else if (sundryMethod === 'fixed') {\n partsSundry = b(sundryFixed).toFixed(2);\n }\n\n const parts = b(summaryNet.parts).add(partsSundry);\n\n const net = b(0)\n .add(summaryNet.labour)\n .add(summaryNet.none)\n .add(parts)\n .add(summaryNet.pm)\n .add(summaryNet.specialist)\n .toFixed(2);\n const vat = b(net || '0')\n .mul(this.vatRate || '0')\n .toFixed(2);\n let gross = b(net || '0').add(vat || '0').toFixed(2);\n\n // calculate the total value of lines that are VAT excluded\n const vatExcludeTotal = this.items.reduce(\n (p, c) =>\n c.vatExcluded ?\n p.add(c.getLineValue(\n this.labourRate,\n this.timeBasisSafe,\n adjusted,\n true\n )) :\n p,\n b()\n );\n gross = b(gross).add(vatExcludeTotal).toFixed(2);\n\n return {\n labour: summaryNet.labour,\n none: summaryNet.none,\n parts: b(parts).mul(partsDisc).toFixed(2),\n pm: b(summaryNet.pm).mul(paintDisc).toFixed(2),\n pl: summaryNet.pl,\n specialist: summaryNet.specialist,\n other: summaryNet.other,\n net: net,\n vat: vat,\n gross: gross,\n labourRate: this.labourRate,\n hours: this.getTotalHours(adjusted)\n };\n }\n\n toDto(): EstimateDto {\n return {\n id: this.id,\n source: this.source,\n label: this.label,\n comment: this.comment,\n timestamp: this.timestamp,\n version: this.version,\n net: this.net,\n vat: this.vat,\n gross: this.gross,\n labourRate: this.labourRate,\n vatRate: this.vatRate,\n sundryRate: this.sundryRate,\n sundryMax: this.sundryMax,\n sundryFixed: this.sundryFixed,\n sundryMethod: this.sundryMethod,\n partsDiscount: this.partsDiscount,\n paintDiscount: this.paintDiscount,\n timeBasis: this.timeBasisSafe,\n items: this.items.map(i => i.toDto()),\n adjusted: this.adjusted,\n summary: this.summary,\n summaryAdjusted: this.summaryAdjusted\n };\n }\n\n getTotalHours(adjusted = false): string {\n if (this.source === 'audatex') {\n const mechUnitsHours = this.items\n .filter(item => item.workCategory !== 'paint')\n .reduce((h, item) => h.add(b(item.getTotalUnits(adjusted))), b())\n .round(2)\n .div(this.timeBasisSafe);\n const paintHours = this.items\n .filter(item => item.workCategory === 'paint')\n .reduce((h, item) => h.add(b(item.getTotalUnits(adjusted))), b())\n .round(1)\n .div(this.timeBasisSafe);\n return mechUnitsHours.add(paintHours).toFixed(2);\n }\n const units = this.items\n .filter(i => i.costCategory === 'labour')\n .reduce((p, c) => p.add(b(c.getTotalUnits(adjusted))), b('0'))\n .toFixed(2);\n return b(units).div(this.timeBasisSafe).toFixed(2);\n }\n}\n"]}
@@ -0,0 +1,3 @@
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';
3
+ //# sourceMappingURL=estimate.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimate.types.d.ts","sourceRoot":"","sources":["../../../../../../projects/vas-lib/src/lib/model/estimate-control/estimate.types.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,MAAM,oBAAoB,GACtC,MAAM,GACJ,OAAO,GACP,OAAO,GACP,KAAK,GACL,OAAO,GACP,IAAI,GACJ,SAAS,GACT,QAAQ,GACR,YAAY,CAAC;AAEjB,MAAM,CAAC,OAAO,MAAM,oBAAoB,GACtC,QAAQ,GACR,MAAM,GACN,IAAI,GACJ,IAAI,GACJ,OAAO,GACP,OAAO,GACP,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=estimate.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimate.types.js","sourceRoot":"","sources":["../../../../../../projects/vas-lib/src/lib/model/estimate-control/estimate.types.ts"],"names":[],"mappings":"","sourcesContent":["\nexport declare type EstimateWorkCategory =\n 'none'\n | 'blend'\n | 'check'\n | 'new'\n | 'paint'\n | 'rr'\n | 'removed'\n | 'repair'\n | 'specialist';\n\nexport declare type EstimateCostCategory =\n 'labour' |\n 'none' |\n 'pm' |\n 'pl' |\n 'parts' |\n 'other' |\n 'specialist';\n"]}
@@ -0,0 +1,9 @@
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';
8
+ export { EstimateSource } from './estimate-source';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../projects/vas-lib/src/lib/model/estimate-control/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./estimate.dto"), exports);
5
+ tslib_1.__exportStar(require("./estimate.model"), exports);
6
+ tslib_1.__exportStar(require("./estimate.types"), exports);
7
+ tslib_1.__exportStar(require("./estimate-control-value.dto"), exports);
8
+ tslib_1.__exportStar(require("./estimate-control-value.model"), exports);
9
+ tslib_1.__exportStar(require("./estimate-item.dto"), exports);
10
+ tslib_1.__exportStar(require("./estimate-item.model"), exports);
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../projects/vas-lib/src/lib/model/estimate-control/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,2DAAiC;AACjC,2DAAiC;AACjC,uEAA6C;AAC7C,yEAA+C;AAC/C,8DAAoC;AACpC,gEAAsC","sourcesContent":["export * from './estimate.dto';\nexport * from './estimate.model';\nexport * from './estimate.types';\nexport * from './estimate-control-value.dto';\nexport * from './estimate-control-value.model';\nexport * from './estimate-item.dto';\nexport * from './estimate-item.model';\nexport { EstimateSource } from './estimate-source';\n"]}
@@ -1,4 +1,6 @@
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';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,oCAAoC,CAAA;AAClD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAC"}
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./estimate-control"), exports);
4
5
  tslib_1.__exportStar(require("./firebase-document-meta.interface"), exports);
5
6
  tslib_1.__exportStar(require("./geo-location"), exports);
7
+ tslib_1.__exportStar(require("./report-invocation"), exports);
6
8
  tslib_1.__exportStar(require("./vas-time-range.model"), exports);
7
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/model/index.ts"],"names":[],"mappings":";;;AAAA,6EAAkD;AAClD,yDAA+B;AAC/B,iEAAuC","sourcesContent":["export * from './firebase-document-meta.interface'\nexport * from './geo-location';\nexport * from './vas-time-range.model';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/model/index.ts"],"names":[],"mappings":";;;AAAA,6DAAkC;AAClC,6EAAkD;AAClD,yDAA+B;AAC/B,8DAAmC;AACnC,iEAAuC","sourcesContent":["export * from './estimate-control'\nexport * from './firebase-document-meta.interface'\nexport * from './geo-location';\nexport * from './report-invocation'\nexport * from './vas-time-range.model';\n"]}
@@ -0,0 +1,40 @@
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
+ }
40
+ //# sourceMappingURL=report-invocation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-invocation.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/model/report-invocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,kBAAkB;QAClB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,KAAK,EAAE;YACL,KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACnC,SAAS,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACvC,KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACnC,GAAG,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;SAClC,CAAA;QACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;KACvC,CAAC;CACH"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=report-invocation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-invocation.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/model/report-invocation.ts"],"names":[],"mappings":"","sourcesContent":["import { FieldValueType } from '../entity';\n\nexport interface ReportInvocationFile {\n id: string;\n name: string;\n sequence: number;\n fileSize: number;\n mimeType: string;\n url: string;\n embedLink: boolean;\n rotation: number;\n description: string;\n displayAs: string;\n displayedName: string;\n group: string;\n index: number;\n}\n\nexport interface ReportInvocation {\n id: string;\n reportLayout: string;\n data: {\n id: string;\n account: string;\n reference: string;\n jobDate: string;\n assigneeId: string;\n assigneeName: string;\n jobStatus: string;\n jobType: string;\n /** @deprecated */\n timeZoneOffset?: number;\n files: {\n photo: Array<ReportInvocationFile>;\n documents: Array<ReportInvocationFile>;\n other: Array<ReportInvocationFile>;\n pdf: Array<ReportInvocationFile>;\n }\n fields: Record<string, FieldValueType>\n };\n}\n"]}
@@ -1,19 +1,9 @@
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;
19
9
  //# sourceMappingURL=get-value-by-path.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-value-by-path.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/get-value-by-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,QACxB,MAAM,EAAE,UACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC1B,CAAC,GAAG,SA6CN,CAAC"}
1
+ {"version":3,"file":"get-value-by-path.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/get-value-by-path.ts"],"names":[],"mappings":"AAmCA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC9C,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjC,CAAC,GAAG,IAAI,GAAG,SAAS,CActB"}
@@ -1,68 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getValueByPath = void 0;
4
- /**
5
- * A non sophisticated way to get values from the job via paths. For example:
6
- *
7
- * getValueByPath(
8
- * ['foo', 'bar'],
9
- * {
10
- * foo: {
11
- * bar: 'value'
12
- * }
13
- * }
14
- * );
15
- *
16
- * will return "value"
17
- * @param {string[]} path
18
- * @param {Record<string, FieldValueType>} object
19
- * @return {T | undefined}
20
- */
21
- const getValueByPath = (path, object) => {
22
- switch (path.length) {
23
- case 0: {
3
+ exports.getValueByPath = getValueByPath;
4
+ const is_numeric_1 = require("./is-numeric");
5
+ function coalescePath(pathOrPaths) {
6
+ let keys = [];
7
+ if (typeof pathOrPaths === 'string') {
8
+ keys = pathOrPaths.split('.');
9
+ }
10
+ else if (typeof pathOrPaths === 'number') {
11
+ keys = [pathOrPaths];
12
+ }
13
+ else if (Array.isArray(pathOrPaths)) {
14
+ keys = pathOrPaths;
15
+ }
16
+ else {
17
+ throw Error('Expected string, number or array of strings or numbers');
18
+ }
19
+ const result = [];
20
+ keys.forEach(key => {
21
+ if (typeof key === 'number') {
22
+ result.push(key);
24
23
  return;
25
24
  }
26
- case 1: {
27
- return (object)[path[0]];
28
- }
29
- case 2: {
30
- const val0 = object[path[0]];
31
- if (!val0) {
32
- return undefined;
25
+ if (key.endsWith(']')) {
26
+ const match = /^([\w_#$-]+)\[([\w_#$-]+)]$/.exec(key.toString());
27
+ if (match !== null) {
28
+ result.push(match[1]);
29
+ result.push((0, is_numeric_1.isNumeric)(match[2]) ? parseInt(match[2], 10) : match[2]);
30
+ return;
33
31
  }
34
- return val0[path[1]];
35
32
  }
36
- case 3: {
37
- const val0 = object[path[0]];
38
- if (!val0) {
39
- return undefined;
40
- }
41
- const val1 = val0[path[1]];
42
- if (!val1) {
43
- return undefined;
44
- }
45
- return val1[path[2]];
46
- }
47
- case 4: {
48
- const val0 = object[path[0]];
49
- if (!val0) {
50
- return undefined;
51
- }
52
- const val1 = val0[path[1]];
53
- if (!val1) {
54
- return undefined;
55
- }
56
- const val2 = val1[path[2]];
57
- if (!val2) {
58
- return undefined;
59
- }
60
- return val2[path[3]];
61
- }
62
- default: {
63
- throw Error('path has too many segments');
33
+ result.push(key);
34
+ });
35
+ return result;
36
+ }
37
+ /**
38
+ * Get a value from an object by path.
39
+ *
40
+ * Path can be an array of strings or numbers.
41
+ * Path can be a string using dot notation, which can include square brackets to
42
+ * access array positions e.g. foo.bar[0].baz
43
+ */
44
+ function getValueByPath(path, object) {
45
+ const p = coalescePath(path);
46
+ let scope = object === undefined ? null : object;
47
+ let index = 0;
48
+ const length = p.length;
49
+ while (index < length) {
50
+ if (scope === undefined || scope === null) {
51
+ return undefined;
64
52
  }
53
+ scope = scope[p[index++]];
65
54
  }
66
- };
67
- exports.getValueByPath = getValueByPath;
55
+ return scope;
56
+ }
68
57
  //# sourceMappingURL=get-value-by-path.js.map