@bisondesk/core-sdk 1.0.7 → 1.0.9

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.
@@ -1,44 +1,12 @@
1
- import { SortFilter } from '@bisondesk/commons-sdk/lib/types';
2
- import { FieldTypes } from './fields';
1
+ ///////////////////////////////////////////////////////
2
+ // Generic stuff
3
+ ///////////////////////////////////////////////////////
3
4
 
4
5
  export enum ConditionType {
5
6
  and = 'AND',
6
7
  or = 'OR',
7
8
  }
8
9
 
9
- export type Filter<OP extends string = string> = {
10
- data: string;
11
- fieldId: string;
12
- fieldType: FieldTypes;
13
- operator: OP;
14
- };
15
-
16
- export type ComplexFilter<OP extends string = string> = {
17
- condition: ConditionType;
18
- filters: Array<Filter<OP> | ComplexFilter<OP>>;
19
- };
20
-
21
- export type SearchRequest<OP extends string = string> = {
22
- fullText?: string;
23
- limit: number;
24
- offset?: number;
25
- query?: ComplexFilter<OP>;
26
- sortBy?: SortFilter[];
27
- lang: string;
28
- };
29
-
30
- export type RecordSearchRequest<OP extends string = string> = SearchRequest<OP> & {
31
- businessEntityId: string;
32
- };
33
-
34
- export type TextSearchRequest = {
35
- businessEntityIds?: string[]; // omit to search across all valid business entities
36
- fullText: string;
37
- limit: number;
38
- offset?: number;
39
- lang: string;
40
- };
41
-
42
10
  export enum ElasticsearchOperator {
43
11
  // all properties
44
12
  empty = 'EMPTY',
@@ -58,66 +26,16 @@ export enum ElasticsearchOperator {
58
26
  endsWith = 'ENDS_WITH',
59
27
  }
60
28
 
61
- export enum DateOperator {
62
- after = 'GTE',
63
- before = 'LTE',
64
- empty = 'EMPTY',
65
- is = 'IS',
66
- lastMonth = 'LAST_MONTH',
67
- lastWeek = 'LAST_WEEK',
68
- notEmpty = 'NOT_EMPTY',
69
- thisMonth = 'THIS_MONTH',
70
- thisWeek = 'THIS_WEEK',
71
- today = 'TODAY',
72
- yesterday = 'YESTERDAY',
73
- }
74
-
75
- export enum NumberOperator {
76
- between = 'BETWEEN',
77
- empty = 'EMPTY',
78
- greaterThan = 'GT',
79
- greaterThanOrEqual = 'GTE',
80
- is = 'IS',
81
- isNot = 'IS_NOT',
82
- lessThan = 'LT',
83
- lessThanEqual = 'LTE',
84
- notEmpty = 'NOT_EMPTY',
85
- }
86
-
87
- export enum CheckboxOperator {
88
- empty = 'EMPTY',
89
- is = 'IS',
90
- notEmpty = 'NOT_EMPTY',
91
- }
92
-
93
- export enum PicklistOperator {
94
- empty = 'EMPTY',
95
- isMultiple = 'IS_MULTIPLE',
96
- isNotMultiple = 'IS_NOT_MULTIPLE',
97
- notEmpty = 'NOT_EMPTY',
98
- }
99
-
100
- export enum RatingOperator {
101
- empty = 'EMPTY',
102
- greaterThan = 'GT',
103
- greaterThanOrEqual = 'GTE',
104
- is = 'IS',
105
- isNot = 'IS_NOT',
106
- lessThan = 'LT',
107
- lessThanEqual = 'LTE',
108
- notEmpty = 'NOT_EMPTY',
109
- }
29
+ export type Filter<OP = ElasticsearchOperator> = {
30
+ data: string;
31
+ fieldId: string;
32
+ operator: OP;
33
+ };
110
34
 
111
- export enum TextOperator {
112
- contains = 'CONTAINS',
113
- empty = 'EMPTY',
114
- endsWith = 'ENDS_WITH',
115
- is = 'IS',
116
- isNot = 'IS_NOT',
117
- notContains = 'NOT_CONTAINS',
118
- notEmpty = 'NOT_EMPTY',
119
- startsWith = 'STARTS_WITH',
120
- }
35
+ export type ComplexFilter<OP = ElasticsearchOperator> = {
36
+ condition: ConditionType;
37
+ filters: Array<Filter<OP> | ComplexFilter<OP>>;
38
+ };
121
39
 
122
40
  export type SearchResponse<T = any> = {
123
41
  took: number;
@@ -145,9 +63,29 @@ export type SearchResponse<T = any> = {
145
63
  sort?: Array<string | number>;
146
64
  }>;
147
65
  };
148
- aggregations?: unknown;
66
+ aggregations?: { [aggName: string]: object };
67
+ };
68
+
69
+ ///////////////////////////////////////////////////////
70
+ // Search
71
+ ///////////////////////////////////////////////////////
72
+
73
+ export const FILTER_RANGE_SEPARATOR = '__';
74
+
75
+ export enum SortOrder {
76
+ asc = 'asc',
77
+ desc = 'desc',
78
+ }
79
+
80
+ export type SortFilter = {
81
+ fieldId: string;
82
+ order: SortOrder;
149
83
  };
150
84
 
151
- export type FilterTransformer = (
152
- filter: Filter<string>
153
- ) => Filter<ElasticsearchOperator> | ComplexFilter<ElasticsearchOperator>;
85
+ export type SearchRequest = {
86
+ fullText?: string;
87
+ limit: number;
88
+ offset?: number;
89
+ query?: ComplexFilter<ElasticsearchOperator>;
90
+ sortBy?: SortFilter[];
91
+ };
@@ -14,3 +14,14 @@ export type Tenant = NewTenant & {
14
14
  // Pay attention to what information is added here since
15
15
  // the tenant can be obtained without authentication
16
16
  };
17
+
18
+ export type HdmsVehiclesSync = {
19
+ active: boolean;
20
+ filterName: string;
21
+ };
22
+
23
+ export type TenantSyncSettings = {
24
+ tenantId: string;
25
+ hdmsVehicles: HdmsVehiclesSync | undefined;
26
+ hdmsCrm: unknown | undefined;
27
+ };
@@ -0,0 +1,222 @@
1
+ // mostly inspired by the Hexon data model
2
+
3
+ import { AttachmentValue } from './fields';
4
+
5
+ export type Vehicle = {
6
+ id: string;
7
+ body?: {
8
+ cabin?: {
9
+ type: 'Day' | 'Sleep / Small' | 'Sleep / Medium' | 'Sleep / Large';
10
+ model?: string;
11
+ };
12
+ colour?: string;
13
+ dimensions?: {
14
+ height?: number;
15
+ length?: number;
16
+ width?: number;
17
+ };
18
+ doorCount?: number;
19
+ interior?: {
20
+ bedCount?: number;
21
+ seatCount?: number;
22
+ };
23
+ };
24
+ mainPicture?: AttachmentValue;
25
+ pictures?: AttachmentValue[];
26
+ condition?: {
27
+ damaged?: boolean;
28
+ odometer?: {
29
+ km?: number;
30
+ };
31
+ used?: boolean;
32
+ };
33
+ description?: {
34
+ remarks?: {
35
+ [lang: string]: string;
36
+ };
37
+ internal_remarks?: {
38
+ [lang: string]: string;
39
+ };
40
+ internal_technical_remarks?: {
41
+ [lang: string]: string;
42
+ };
43
+ titles?: {
44
+ [lang: string]: string;
45
+ };
46
+ };
47
+ general: {
48
+ bodystyle: string;
49
+ category: string;
50
+ make: string;
51
+ model?: string;
52
+ type?: string;
53
+ };
54
+ history?: {
55
+ advertisingYear?: number;
56
+ constructionYear?: number;
57
+ currentRegistration?: {
58
+ country?: string;
59
+ technicalInspectionEndDate?: string;
60
+ };
61
+ firstRegistration?: string;
62
+ };
63
+ identification?: {
64
+ administrativeNumber: string;
65
+ externalId?: string;
66
+ hdmsId: string;
67
+ hdmsOrg: string;
68
+ licensePlate?: string;
69
+ stockNumber: string;
70
+ vin?: string;
71
+ };
72
+ powertrain?: {
73
+ axles?: {
74
+ details?: VehicleAxle[];
75
+ configuration?: string;
76
+ count?: number;
77
+ poweredAxlesCount?: number;
78
+ wheelbase?: number;
79
+ suspension?: 'Air' | 'Air/Steel' | 'Steel';
80
+ };
81
+ emissions?: {
82
+ class?: string;
83
+ };
84
+ engine?: {
85
+ energy?: string;
86
+ power?: {
87
+ hp?: number;
88
+ };
89
+ displacement?: number;
90
+ };
91
+ transmission?: {
92
+ gearCount?: number;
93
+ make?: string;
94
+ model?: string;
95
+ type?: 'Automatic' | 'Manual' | 'Semi-Automatic';
96
+ };
97
+ };
98
+ salesConditions?: {
99
+ leasing?: boolean;
100
+ expected?: boolean;
101
+ reserved?: boolean;
102
+ pricing?: {
103
+ internet?: string;
104
+ premium?: string;
105
+ minimum?: string;
106
+ currency?: string;
107
+ };
108
+ };
109
+ superstructure?: {
110
+ carCapacity?: number;
111
+ compartmentCount?: number;
112
+ counter?: boolean;
113
+ crane?: {
114
+ make?: string;
115
+ model?: string;
116
+ position?: 'Behind the cabin' | 'Rear';
117
+ present?: boolean;
118
+ year?: number;
119
+ };
120
+ dimensions?: {
121
+ height?: number;
122
+ length?: number;
123
+ width?: number;
124
+ extended?: 'L1' | 'L2' | 'L3' | 'L4' | 'L5';
125
+ heightened?: 'H1' | 'H2' | 'H3';
126
+ };
127
+ extendable?: boolean;
128
+ highPressurePump?: boolean;
129
+ hoses?: boolean;
130
+ loadingPlatformHeight?: number;
131
+ pump?: boolean;
132
+ slidingRoof?: boolean;
133
+ tailgate?: {
134
+ capacity?: number;
135
+ make?: string;
136
+ model?: string;
137
+ present?: boolean;
138
+ type?: 'slider_lift' | 'cantilever' | 'column_lift';
139
+ };
140
+ tank?: {
141
+ capacity: number;
142
+ };
143
+ temperatureControl?: {
144
+ engineType?: 'diesel' | 'electric' | 'diesel+electric' | 'engine';
145
+ make?: string;
146
+ runningHours?: {
147
+ diesel?: number;
148
+ electric?: number;
149
+ };
150
+ };
151
+ tipper?: {
152
+ tipsBack?: boolean;
153
+ tipsLeft?: boolean;
154
+ tipsRight?: boolean;
155
+ };
156
+ };
157
+ weights?: {
158
+ gvw?: number;
159
+ massEmpty?: number;
160
+ };
161
+ accessories: {
162
+ abs?: boolean;
163
+ adr?: boolean;
164
+ airco?: boolean;
165
+ alloyWheels?: boolean;
166
+ aluminiumFuelTank?: boolean;
167
+ cdPlayer?: boolean;
168
+ centralLocking?: boolean;
169
+ centralLubrication?: boolean;
170
+ crane?: boolean;
171
+ cruiseControl?: boolean;
172
+ electricDoorMirrors?: boolean;
173
+ electricWindows?: boolean;
174
+ engineBrake?: boolean;
175
+ forklift?: boolean;
176
+ navigationSystem?: boolean;
177
+ hydraulicTipperKit?: boolean;
178
+ lowDeck?: boolean;
179
+ lowNoise?: boolean;
180
+ parkingHeater?: boolean;
181
+ particleFilter?: boolean;
182
+ powerTakeOff?: boolean;
183
+ refrigerator?: boolean;
184
+ retarderIntarder?: boolean;
185
+ reversingCamera?: boolean;
186
+ roofSpoiler?: boolean;
187
+ sideSkirts?: boolean;
188
+ spareKey?: boolean;
189
+ spareWheel?: boolean;
190
+ speedLimiter?: boolean;
191
+ spoilers?: boolean;
192
+ spotlights?: boolean;
193
+ stabilityControl?: boolean;
194
+ standardAirco?: boolean;
195
+ television?: boolean;
196
+ toolbox?: boolean;
197
+ trailerCoupling?: boolean;
198
+ twinFuelTank?: boolean;
199
+ visor?: boolean;
200
+ xenonLights?: boolean;
201
+ };
202
+ };
203
+
204
+ export type VehicleAxle = {
205
+ alloyWheels?: boolean;
206
+ brakes?: string;
207
+ differentialLock?: boolean;
208
+ liftAxle?: boolean;
209
+ maxLoad?: number;
210
+ nr: number;
211
+ position?: string;
212
+ powered?: boolean;
213
+ reduction?: string;
214
+ steering?: boolean;
215
+ suspension?: string;
216
+ twinWheels?: boolean;
217
+ tyreConditionPercLeftInside?: number;
218
+ tyreConditionPercLeftOutside?: number;
219
+ tyreConditionPercRightInside?: number;
220
+ tyreConditionPercRightOutside?: number;
221
+ tyreSize?: string;
222
+ };