@ironcode/vas-lib 3.0.0-alpha.2 → 3.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/lib/control-value/vas-camera-control-value.model.d.ts +4 -2
- package/cjs/lib/control-value/vas-camera-control-value.model.d.ts.map +1 -1
- package/cjs/lib/control-value/vas-camera-control-value.model.js.map +1 -1
- package/cjs/lib/entity/vas-field.dto.d.ts +3 -4
- package/cjs/lib/entity/vas-field.dto.d.ts.map +1 -1
- package/cjs/lib/entity/vas-field.dto.js.map +1 -1
- package/cjs/lib/model/estimate-control/estimate-control-value.dto.d.ts +14 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.dto.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.dto.js +3 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.dto.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.model.d.ts +11 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.model.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.model.js +84 -0
- package/cjs/lib/model/estimate-control/estimate-control-value.model.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-item.dto.d.ts +16 -0
- package/cjs/lib/model/estimate-control/estimate-item.dto.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-item.dto.js +3 -0
- package/cjs/lib/model/estimate-control/estimate-item.dto.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-item.model.d.ts +24 -0
- package/cjs/lib/model/estimate-control/estimate-item.model.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate-item.model.js +121 -0
- package/cjs/lib/model/estimate-control/estimate-item.model.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate.dto.d.ts +37 -0
- package/cjs/lib/model/estimate-control/estimate.dto.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate.dto.js +3 -0
- package/cjs/lib/model/estimate-control/estimate.dto.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate.model.d.ts +55 -0
- package/cjs/lib/model/estimate-control/estimate.model.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate.model.js +265 -0
- package/cjs/lib/model/estimate-control/estimate.model.js.map +1 -0
- package/cjs/lib/model/estimate-control/estimate.types.d.ts +3 -0
- package/cjs/lib/model/estimate-control/estimate.types.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/estimate.types.js +3 -0
- package/cjs/lib/model/estimate-control/estimate.types.js.map +1 -0
- package/cjs/lib/model/estimate-control/index.d.ts +8 -0
- package/cjs/lib/model/estimate-control/index.d.ts.map +1 -0
- package/cjs/lib/model/estimate-control/index.js +11 -0
- package/cjs/lib/model/estimate-control/index.js.map +1 -0
- package/cjs/lib/model/index.d.ts +2 -0
- package/cjs/lib/model/index.d.ts.map +1 -1
- package/cjs/lib/model/index.js +2 -0
- package/cjs/lib/model/index.js.map +1 -1
- package/cjs/lib/model/report-invocation.d.ts +40 -0
- package/cjs/lib/model/report-invocation.d.ts.map +1 -0
- package/cjs/lib/model/report-invocation.js +3 -0
- package/cjs/lib/model/report-invocation.js.map +1 -0
- package/cjs/lib/utils/get-value-by-path.d.ts +5 -15
- package/cjs/lib/utils/get-value-by-path.d.ts.map +1 -1
- package/cjs/lib/utils/get-value-by-path.js +49 -60
- package/cjs/lib/utils/get-value-by-path.js.map +1 -1
- package/cjs/lib/utils/index.d.ts +8 -0
- package/cjs/lib/utils/index.d.ts.map +1 -0
- package/cjs/lib/utils/index.js +11 -0
- package/cjs/lib/utils/index.js.map +1 -0
- package/cjs/lib/utils/is-array-string.d.ts +3 -0
- package/cjs/lib/utils/is-array-string.d.ts.map +1 -1
- package/cjs/lib/utils/is-array-string.js +3 -0
- package/cjs/lib/utils/is-array-string.js.map +1 -1
- package/cjs/lib/utils/is-numeric.d.ts +2 -0
- package/cjs/lib/utils/is-numeric.d.ts.map +1 -0
- package/cjs/lib/utils/is-numeric.js +10 -0
- package/cjs/lib/utils/is-numeric.js.map +1 -0
- package/cjs/lib/utils/is-plain-object.d.ts +3 -0
- package/cjs/lib/utils/is-plain-object.d.ts.map +1 -1
- package/cjs/lib/utils/is-plain-object.js +3 -0
- package/cjs/lib/utils/is-plain-object.js.map +1 -1
- package/cjs/lib/utils/try-json.d.ts +2 -2
- package/cjs/lib/utils/try-json.js +2 -2
- package/cjs/lib/utils/try-json.js.map +1 -1
- package/cjs/public-api.d.ts +1 -0
- package/cjs/public-api.d.ts.map +1 -1
- package/cjs/public-api.js +1 -0
- package/cjs/public-api.js.map +1 -1
- package/fesm2022/ironcode-vas-lib.mjs +547 -55
- package/fesm2022/ironcode-vas-lib.mjs.map +1 -1
- package/lib/control-value/vas-camera-control-value.model.d.ts +4 -2
- package/lib/entity/vas-field.dto.d.ts +3 -4
- package/lib/model/estimate-control/estimate-control-value.dto.d.ts +13 -0
- package/lib/model/estimate-control/estimate-control-value.model.d.ts +10 -0
- package/lib/model/estimate-control/estimate-item.dto.d.ts +15 -0
- package/lib/model/estimate-control/estimate-item.model.d.ts +23 -0
- package/lib/model/estimate-control/estimate.dto.d.ts +36 -0
- package/lib/model/estimate-control/estimate.model.d.ts +54 -0
- package/lib/model/estimate-control/estimate.types.d.ts +2 -0
- package/lib/model/estimate-control/index.d.ts +7 -0
- package/lib/model/index.d.ts +2 -0
- package/lib/model/report-invocation.d.ts +39 -0
- package/lib/utils/get-value-by-path.d.ts +5 -15
- package/lib/utils/index.d.ts +7 -0
- package/lib/utils/is-array-string.d.ts +4 -0
- package/lib/utils/is-numeric.d.ts +1 -0
- package/lib/utils/is-plain-object.d.ts +3 -0
- package/lib/utils/omit.d.ts +7 -0
- package/lib/utils/try-json.d.ts +2 -2
- package/package.json +3 -2
- package/public-api.d.ts +1 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { VasFileDto } from '../entity';
|
|
2
|
-
export interface
|
|
2
|
+
export interface VasCameraControlValueValue {
|
|
3
3
|
webPath: string;
|
|
4
4
|
path: string;
|
|
5
5
|
url?: string;
|
|
6
6
|
id?: string;
|
|
7
7
|
}
|
|
8
|
-
|
|
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;
|
|
@@ -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
|
-
|
|
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>;
|
|
@@ -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,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';
|
package/lib/model/index.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
2
|
+
* Get a value from an object by path.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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
|
|
8
|
+
export declare function getValueByPath<T>(path: string | number | Array<string | number>, object: null | Record<string, any>): T | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isNumeric(value: string | number): value is number;
|
|
@@ -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>;
|
package/lib/utils/try-json.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Try to parse the value as JSON if it looks like a JSON encoded string
|
|
3
|
-
*
|
|
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
package/public-api.d.ts
CHANGED