@trackunit/filters-graphql-hook 1.13.18 → 1.13.21

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/index.cjs.js CHANGED
@@ -7,6 +7,7 @@ var sharedUtils = require('@trackunit/shared-utils');
7
7
  var zod = require('zod');
8
8
  var reactCoreHooks = require('@trackunit/react-core-hooks');
9
9
  var react = require('react');
10
+ var irisAppRuntimeCoreApi = require('@trackunit/iris-app-runtime-core-api');
10
11
 
11
12
  var defaultTranslations = {
12
13
 
@@ -186,6 +187,84 @@ const geoJsonSimplifiedPolygonSchema = zod.z.strictObject({
186
187
  type: zod.z.literal("Polygon"),
187
188
  coordinates: zod.z.array(zod.z.array(zod.z.tuple([zod.z.number(), zod.z.number()]))),
188
189
  });
190
+ /**
191
+ * Convert boolean filter value to array or undefined
192
+ */
193
+ const booleanValueToArray = (
194
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
195
+ input) => {
196
+ if (input && typeof input === "object" && "booleanValue" in input && input.booleanValue !== undefined) {
197
+ return [input.booleanValue];
198
+ }
199
+ return undefined;
200
+ };
201
+ /**
202
+ * Convert ValueName filter value with "true"/"false" strings to boolean array or undefined
203
+ */
204
+ const valueNameBooleanToArray = (
205
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
206
+ input) => {
207
+ if (isValueName(input)) {
208
+ if (input.value === "true") {
209
+ return [true];
210
+ }
211
+ if (input.value === "false") {
212
+ return [false];
213
+ }
214
+ }
215
+ return undefined;
216
+ };
217
+ /**
218
+ *
219
+ */
220
+ const minMaxFilterValueToArray = (
221
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
222
+ value) => {
223
+ if (!filtersFilterBar.isMinMaxFilterValue(value)) {
224
+ return undefined;
225
+ }
226
+ const { min, max } = value;
227
+ if (min !== undefined && max !== undefined) {
228
+ return [min, max];
229
+ }
230
+ if (min !== undefined) {
231
+ return [min];
232
+ }
233
+ if (max !== undefined) {
234
+ return [max];
235
+ }
236
+ return undefined;
237
+ };
238
+ /**
239
+ * Convert MinMaxFilterValue to NumberRange
240
+ */
241
+ const minMaxFilterValueToNumberRange = (
242
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
243
+ value) => {
244
+ if (!filtersFilterBar.isMinMaxFilterValue(value)) {
245
+ return undefined;
246
+ }
247
+ const { min, max } = value;
248
+ if (min === undefined && max === undefined) {
249
+ return undefined;
250
+ }
251
+ return { min, max };
252
+ };
253
+ /**
254
+ * Convert MinMaxFilterValue to AggregatedNumberRange with LIFETIME period
255
+ */
256
+ const minMaxFilterValueToAggregatedNumberRange = (
257
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
258
+ value) => {
259
+ if (!filtersFilterBar.isMinMaxFilterValue(value)) {
260
+ return undefined;
261
+ }
262
+ const { min, max } = value;
263
+ if (min === undefined && max === undefined) {
264
+ return undefined;
265
+ }
266
+ return { period: "LIFETIME", range: { min, max } };
267
+ };
189
268
 
190
269
  const accessManagementMode = {
191
270
  LOCKED_FOR_ALL: "LOCKED_FOR_ALL",
@@ -402,11 +481,51 @@ const useActiveAssetFilters = (filters) => {
402
481
  ? null
403
482
  : valueBooleanOrUndefined(filters.assetVisibility),
404
483
  accessManagementDesiredModes: fixTypes(filters.accessManagementMode, accessManagementMode),
484
+ insightsFilters: {
485
+ afterTreatmentDieselExhaustFluidTankLevel: minMaxFilterValueToNumberRange(filters.insightsAfterTreatmentDieselExhaustFluidTankLevel),
486
+ batteryChargerState: valueNameBooleanToArray(filters.insightsBatteryChargerState),
487
+ batteryPotential: minMaxFilterValueToNumberRange(filters.insightsBatteryPotential),
488
+ batteryStateOfChargePercent: minMaxFilterValueToNumberRange(filters.insightsBatteryStateOfChargePercent),
489
+ cumulativeIdleHours: minMaxFilterValueToAggregatedNumberRange(filters.insightsCumulativeIdleHours),
490
+ fuelLevel: minMaxFilterValueToNumberRange(filters.insightsFuelLevel),
491
+ },
492
+ rentalActiveContractFilters: (() => {
493
+ const onRentDateRangeValue = filters.rentalActiveContractItemOnRentDatesDateRange;
494
+ const offRentDateRangeValue = filters.rentalActiveContractItemOffRentDatesDateRange;
495
+ const convertDateRange = (dateRangeValue) => {
496
+ if (filtersFilterBar.isDateRangeValue(dateRangeValue) && (dateRangeValue.from || dateRangeValue.to)) {
497
+ const fromDate = dateRangeValue.from ? new Date(dateRangeValue.from) : undefined;
498
+ if (fromDate) {
499
+ fromDate.setHours(0, 0, 0, 0);
500
+ }
501
+ const toDate = dateRangeValue.to ? new Date(dateRangeValue.to) : undefined;
502
+ if (toDate) {
503
+ toDate.setHours(23, 59, 59, 999);
504
+ }
505
+ return {
506
+ from: fromDate?.toISOString(),
507
+ to: toDate?.toISOString(),
508
+ };
509
+ }
510
+ return undefined;
511
+ };
512
+ const onRentDatesDateRange = convertDateRange(onRentDateRangeValue);
513
+ const offRentDatesDateRange = convertDateRange(offRentDateRangeValue);
514
+ return {
515
+ onRentDatesDateRange,
516
+ offRentDatesDateRange,
517
+ customerExternalReferences: stringArrayOrUndefined(filters.rentalContractCustomerExternalReference),
518
+ };
519
+ })(),
405
520
  };
406
521
  }, [filters, customFields, systemOfMeasurement]);
407
522
  };
408
523
  const booleanArraySchema = zod.z.array(zod.z.boolean());
409
524
 
525
+ /**
526
+ * Sort properties that require an aggregation period
527
+ */
528
+ const CUMULATIVE_SORT_PROPERTIES = [irisAppRuntimeCoreApi.AssetSortByProperty.CumulativeIdleHours];
410
529
  /**
411
530
  * This hook is used to convert the sorting state from the AssetSortingContext to the AssetSortInput used by the GraphQL API
412
531
  */
@@ -417,12 +536,14 @@ const useAssetSortInput = () => {
417
536
  /**
418
537
  * Convert the sorting state from the AssetSortingContext to the AssetSortInput used by the GraphQL API
419
538
  */
420
- const convertToAssetSortInput = ({ sortBy, order, customFieldDefinitionId }) => {
539
+ const convertToAssetSortInput = ({ sortBy, order, customFieldDefinitionId, aggregationPeriod, }) => {
421
540
  // If any of these fails, it might be because the `AssetSortByProperty` needs to be updated to match the GraphQL enum
541
+ const isCumulativeSort = CUMULATIVE_SORT_PROPERTIES.includes(sortBy);
422
542
  return {
423
543
  property: sortBy,
424
544
  order,
425
545
  customFieldDefinitionId,
546
+ aggregationPeriod: isCumulativeSort ? (aggregationPeriod ?? irisAppRuntimeCoreApi.AggregationPeriod.LIFETIME) : undefined,
426
547
  };
427
548
  };
428
549
 
@@ -466,6 +587,7 @@ const useAssetQueryFilters = (props) => {
466
587
  setupLibraryTranslations();
467
588
 
468
589
  exports.CustomFieldPrefix = CustomFieldPrefix;
590
+ exports.booleanValueToArray = booleanValueToArray;
469
591
  exports.convertToAssetSortInput = convertToAssetSortInput;
470
592
  exports.fixType = fixType;
471
593
  exports.fixTypes = fixTypes;
@@ -473,6 +595,9 @@ exports.geoJsonSimplifiedPolygonSchema = geoJsonSimplifiedPolygonSchema;
473
595
  exports.isStringArrayValue = isStringArrayValue;
474
596
  exports.isValueName = isValueName;
475
597
  exports.isValueNameArray = isValueNameArray;
598
+ exports.minMaxFilterValueToAggregatedNumberRange = minMaxFilterValueToAggregatedNumberRange;
599
+ exports.minMaxFilterValueToArray = minMaxFilterValueToArray;
600
+ exports.minMaxFilterValueToNumberRange = minMaxFilterValueToNumberRange;
476
601
  exports.positiveValueBooleanOrNull = positiveValueBooleanOrNull;
477
602
  exports.stringArrayOrUndefined = stringArrayOrUndefined;
478
603
  exports.useActiveAssetFilters = useActiveAssetFilters;
@@ -481,5 +606,6 @@ exports.useAssetSortInput = useAssetSortInput;
481
606
  exports.useCustomFieldFilters = useCustomFieldFilters;
482
607
  exports.valueBooleanOrUndefined = valueBooleanOrUndefined;
483
608
  exports.valueNameArrayOrUndefined = valueNameArrayOrUndefined;
609
+ exports.valueNameBooleanToArray = valueNameBooleanToArray;
484
610
  exports.valueNameOrUndefined = valueNameOrUndefined;
485
611
  exports.valuesIfNotEmpty = valuesIfNotEmpty;
package/index.esm.js CHANGED
@@ -5,6 +5,7 @@ import { objectValues, truthy } from '@trackunit/shared-utils';
5
5
  import { z } from 'zod';
6
6
  import { useCurrentUserSystemOfMeasurement, useAssetSorting } from '@trackunit/react-core-hooks';
7
7
  import { useMemo } from 'react';
8
+ import { AssetSortByProperty, AggregationPeriod } from '@trackunit/iris-app-runtime-core-api';
8
9
 
9
10
  var defaultTranslations = {
10
11
 
@@ -184,6 +185,84 @@ const geoJsonSimplifiedPolygonSchema = z.strictObject({
184
185
  type: z.literal("Polygon"),
185
186
  coordinates: z.array(z.array(z.tuple([z.number(), z.number()]))),
186
187
  });
188
+ /**
189
+ * Convert boolean filter value to array or undefined
190
+ */
191
+ const booleanValueToArray = (
192
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
193
+ input) => {
194
+ if (input && typeof input === "object" && "booleanValue" in input && input.booleanValue !== undefined) {
195
+ return [input.booleanValue];
196
+ }
197
+ return undefined;
198
+ };
199
+ /**
200
+ * Convert ValueName filter value with "true"/"false" strings to boolean array or undefined
201
+ */
202
+ const valueNameBooleanToArray = (
203
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
204
+ input) => {
205
+ if (isValueName(input)) {
206
+ if (input.value === "true") {
207
+ return [true];
208
+ }
209
+ if (input.value === "false") {
210
+ return [false];
211
+ }
212
+ }
213
+ return undefined;
214
+ };
215
+ /**
216
+ *
217
+ */
218
+ const minMaxFilterValueToArray = (
219
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
220
+ value) => {
221
+ if (!isMinMaxFilterValue(value)) {
222
+ return undefined;
223
+ }
224
+ const { min, max } = value;
225
+ if (min !== undefined && max !== undefined) {
226
+ return [min, max];
227
+ }
228
+ if (min !== undefined) {
229
+ return [min];
230
+ }
231
+ if (max !== undefined) {
232
+ return [max];
233
+ }
234
+ return undefined;
235
+ };
236
+ /**
237
+ * Convert MinMaxFilterValue to NumberRange
238
+ */
239
+ const minMaxFilterValueToNumberRange = (
240
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
241
+ value) => {
242
+ if (!isMinMaxFilterValue(value)) {
243
+ return undefined;
244
+ }
245
+ const { min, max } = value;
246
+ if (min === undefined && max === undefined) {
247
+ return undefined;
248
+ }
249
+ return { min, max };
250
+ };
251
+ /**
252
+ * Convert MinMaxFilterValue to AggregatedNumberRange with LIFETIME period
253
+ */
254
+ const minMaxFilterValueToAggregatedNumberRange = (
255
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
256
+ value) => {
257
+ if (!isMinMaxFilterValue(value)) {
258
+ return undefined;
259
+ }
260
+ const { min, max } = value;
261
+ if (min === undefined && max === undefined) {
262
+ return undefined;
263
+ }
264
+ return { period: "LIFETIME", range: { min, max } };
265
+ };
187
266
 
188
267
  const accessManagementMode = {
189
268
  LOCKED_FOR_ALL: "LOCKED_FOR_ALL",
@@ -400,11 +479,51 @@ const useActiveAssetFilters = (filters) => {
400
479
  ? null
401
480
  : valueBooleanOrUndefined(filters.assetVisibility),
402
481
  accessManagementDesiredModes: fixTypes(filters.accessManagementMode, accessManagementMode),
482
+ insightsFilters: {
483
+ afterTreatmentDieselExhaustFluidTankLevel: minMaxFilterValueToNumberRange(filters.insightsAfterTreatmentDieselExhaustFluidTankLevel),
484
+ batteryChargerState: valueNameBooleanToArray(filters.insightsBatteryChargerState),
485
+ batteryPotential: minMaxFilterValueToNumberRange(filters.insightsBatteryPotential),
486
+ batteryStateOfChargePercent: minMaxFilterValueToNumberRange(filters.insightsBatteryStateOfChargePercent),
487
+ cumulativeIdleHours: minMaxFilterValueToAggregatedNumberRange(filters.insightsCumulativeIdleHours),
488
+ fuelLevel: minMaxFilterValueToNumberRange(filters.insightsFuelLevel),
489
+ },
490
+ rentalActiveContractFilters: (() => {
491
+ const onRentDateRangeValue = filters.rentalActiveContractItemOnRentDatesDateRange;
492
+ const offRentDateRangeValue = filters.rentalActiveContractItemOffRentDatesDateRange;
493
+ const convertDateRange = (dateRangeValue) => {
494
+ if (isDateRangeValue(dateRangeValue) && (dateRangeValue.from || dateRangeValue.to)) {
495
+ const fromDate = dateRangeValue.from ? new Date(dateRangeValue.from) : undefined;
496
+ if (fromDate) {
497
+ fromDate.setHours(0, 0, 0, 0);
498
+ }
499
+ const toDate = dateRangeValue.to ? new Date(dateRangeValue.to) : undefined;
500
+ if (toDate) {
501
+ toDate.setHours(23, 59, 59, 999);
502
+ }
503
+ return {
504
+ from: fromDate?.toISOString(),
505
+ to: toDate?.toISOString(),
506
+ };
507
+ }
508
+ return undefined;
509
+ };
510
+ const onRentDatesDateRange = convertDateRange(onRentDateRangeValue);
511
+ const offRentDatesDateRange = convertDateRange(offRentDateRangeValue);
512
+ return {
513
+ onRentDatesDateRange,
514
+ offRentDatesDateRange,
515
+ customerExternalReferences: stringArrayOrUndefined(filters.rentalContractCustomerExternalReference),
516
+ };
517
+ })(),
403
518
  };
404
519
  }, [filters, customFields, systemOfMeasurement]);
405
520
  };
406
521
  const booleanArraySchema = z.array(z.boolean());
407
522
 
523
+ /**
524
+ * Sort properties that require an aggregation period
525
+ */
526
+ const CUMULATIVE_SORT_PROPERTIES = [AssetSortByProperty.CumulativeIdleHours];
408
527
  /**
409
528
  * This hook is used to convert the sorting state from the AssetSortingContext to the AssetSortInput used by the GraphQL API
410
529
  */
@@ -415,12 +534,14 @@ const useAssetSortInput = () => {
415
534
  /**
416
535
  * Convert the sorting state from the AssetSortingContext to the AssetSortInput used by the GraphQL API
417
536
  */
418
- const convertToAssetSortInput = ({ sortBy, order, customFieldDefinitionId }) => {
537
+ const convertToAssetSortInput = ({ sortBy, order, customFieldDefinitionId, aggregationPeriod, }) => {
419
538
  // If any of these fails, it might be because the `AssetSortByProperty` needs to be updated to match the GraphQL enum
539
+ const isCumulativeSort = CUMULATIVE_SORT_PROPERTIES.includes(sortBy);
420
540
  return {
421
541
  property: sortBy,
422
542
  order,
423
543
  customFieldDefinitionId,
544
+ aggregationPeriod: isCumulativeSort ? (aggregationPeriod ?? AggregationPeriod.LIFETIME) : undefined,
424
545
  };
425
546
  };
426
547
 
@@ -463,4 +584,4 @@ const useAssetQueryFilters = (props) => {
463
584
  */
464
585
  setupLibraryTranslations();
465
586
 
466
- export { CustomFieldPrefix, convertToAssetSortInput, fixType, fixTypes, geoJsonSimplifiedPolygonSchema, isStringArrayValue, isValueName, isValueNameArray, positiveValueBooleanOrNull, stringArrayOrUndefined, useActiveAssetFilters, useAssetQueryFilters, useAssetSortInput, useCustomFieldFilters, valueBooleanOrUndefined, valueNameArrayOrUndefined, valueNameOrUndefined, valuesIfNotEmpty };
587
+ export { CustomFieldPrefix, booleanValueToArray, convertToAssetSortInput, fixType, fixTypes, geoJsonSimplifiedPolygonSchema, isStringArrayValue, isValueName, isValueNameArray, minMaxFilterValueToAggregatedNumberRange, minMaxFilterValueToArray, minMaxFilterValueToNumberRange, positiveValueBooleanOrNull, stringArrayOrUndefined, useActiveAssetFilters, useAssetQueryFilters, useAssetSortInput, useCustomFieldFilters, valueBooleanOrUndefined, valueNameArrayOrUndefined, valueNameBooleanToArray, valueNameOrUndefined, valuesIfNotEmpty };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/filters-graphql-hook",
3
- "version": "1.13.18",
3
+ "version": "1.13.21",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -13,14 +13,14 @@
13
13
  "graphql": "^16.10.0",
14
14
  "@apollo/client": "3.13.8",
15
15
  "zod": "^3.23.8",
16
- "@trackunit/iris-app-build-utilities": "1.9.12",
17
- "@trackunit/filters-filter-bar": "1.10.18",
18
- "@trackunit/shared-utils": "1.11.13",
19
- "@trackunit/iris-app-api": "1.12.12",
20
- "@trackunit/react-core-contexts-test": "1.9.16",
21
- "@trackunit/i18n-library-translation": "1.9.16",
22
- "@trackunit/iris-app-runtime-core-api": "1.9.16",
23
- "@trackunit/react-core-hooks": "1.9.16"
16
+ "@trackunit/iris-app-build-utilities": "1.9.14",
17
+ "@trackunit/filters-filter-bar": "1.10.21",
18
+ "@trackunit/shared-utils": "1.11.15",
19
+ "@trackunit/iris-app-api": "1.12.14",
20
+ "@trackunit/react-core-contexts-test": "1.9.19",
21
+ "@trackunit/i18n-library-translation": "1.9.19",
22
+ "@trackunit/iris-app-runtime-core-api": "1.9.19",
23
+ "@trackunit/react-core-hooks": "1.9.19"
24
24
  },
25
25
  "module": "./index.esm.js",
26
26
  "main": "./index.cjs.js",
package/src/fixTypes.d.ts CHANGED
@@ -63,3 +63,32 @@ export declare const geoJsonSimplifiedPolygonSchema: z.ZodObject<{
63
63
  type: "Polygon";
64
64
  coordinates: [number, number][][];
65
65
  }>;
66
+ /**
67
+ * Convert boolean filter value to array or undefined
68
+ */
69
+ export declare const booleanValueToArray: (input: any) => Array<boolean> | undefined;
70
+ /**
71
+ * Convert ValueName filter value with "true"/"false" strings to boolean array or undefined
72
+ */
73
+ export declare const valueNameBooleanToArray: (input: any) => Array<boolean> | undefined;
74
+ /**
75
+ *
76
+ */
77
+ export declare const minMaxFilterValueToArray: (value: any) => Array<number> | undefined;
78
+ /**
79
+ * Convert MinMaxFilterValue to NumberRange
80
+ */
81
+ export declare const minMaxFilterValueToNumberRange: (value: any) => {
82
+ min?: number;
83
+ max?: number;
84
+ } | undefined;
85
+ /**
86
+ * Convert MinMaxFilterValue to AggregatedNumberRange with LIFETIME period
87
+ */
88
+ export declare const minMaxFilterValueToAggregatedNumberRange: (value: any) => {
89
+ period: "LIFETIME";
90
+ range: {
91
+ min?: number;
92
+ max?: number;
93
+ };
94
+ } | undefined;
@@ -137,6 +137,14 @@ export declare const accessManagementMode: {
137
137
  readonly UNSUPPORTED: "UNSUPPORTED";
138
138
  };
139
139
  export type AccessManagementMode = (typeof accessManagementMode)[keyof typeof accessManagementMode];
140
+ export declare const aggregationPeriod: {
141
+ readonly LAST1D: "LAST1D";
142
+ readonly LAST7D: "LAST7D";
143
+ readonly LAST30D: "LAST30D";
144
+ readonly LAST365D: "LAST365D";
145
+ readonly LIFETIME: "LIFETIME";
146
+ };
147
+ export type AggregationPeriod = (typeof aggregationPeriod)[keyof typeof aggregationPeriod];
140
148
  export declare const areaFilterGeoJsonGeometryType: {
141
149
  readonly MultiPolygon: "MultiPolygon";
142
150
  readonly Polygon: "Polygon";
@@ -334,12 +342,20 @@ export declare const assetSortByProperty: {
334
342
  readonly BATTERY_STATE_OF_CHARGE_PERCENT: "BATTERY_STATE_OF_CHARGE_PERCENT";
335
343
  readonly BRAND: "BRAND";
336
344
  readonly CATEGORY: "CATEGORY";
345
+ readonly CONTRACT_ITEM_OFF_RENT_DATE: "CONTRACT_ITEM_OFF_RENT_DATE";
346
+ readonly CONTRACT_ITEM_ON_RENT_DATE: "CONTRACT_ITEM_ON_RENT_DATE";
337
347
  readonly CRITICALITY: "CRITICALITY";
348
+ readonly CUMULATIVE_ENGINE_HOURS: "CUMULATIVE_ENGINE_HOURS";
349
+ readonly CUMULATIVE_IDLE_HOURS: "CUMULATIVE_IDLE_HOURS";
350
+ readonly CUMULATIVE_IDLE_NON_OPERATING_HOURS: "CUMULATIVE_IDLE_NON_OPERATING_HOURS";
351
+ readonly CUMULATIVE_MOVING_HOURS: "CUMULATIVE_MOVING_HOURS";
338
352
  readonly CUMULATIVE_OPERATING_HOURS: "CUMULATIVE_OPERATING_HOURS";
353
+ readonly CUMULATIVE_PRODUCTIVE_HOURS: "CUMULATIVE_PRODUCTIVE_HOURS";
339
354
  readonly CUSTOMER_NAME: "CUSTOMER_NAME";
340
355
  readonly CUSTOM_FIELD: "CUSTOM_FIELD";
341
356
  readonly DEVICE_STATUS: "DEVICE_STATUS";
342
- readonly ENGINE_TOTAL_IDLE_HOURS: "ENGINE_TOTAL_IDLE_HOURS";
357
+ readonly ENGINE_TOTAL_FUEL_USED: "ENGINE_TOTAL_FUEL_USED";
358
+ readonly ENGINE_TOTAL_IDLE_FUEL_USED: "ENGINE_TOTAL_IDLE_FUEL_USED";
343
359
  readonly EXTERNAL_REFERENCE: "EXTERNAL_REFERENCE";
344
360
  readonly FUEL_LEVEL: "FUEL_LEVEL";
345
361
  readonly ISSUE_CREATED_AT: "ISSUE_CREATED_AT";
@@ -485,6 +501,12 @@ export declare const systemOfMeasurement: {
485
501
  readonly US_CUSTOMARY: "US_CUSTOMARY";
486
502
  };
487
503
  export type SystemOfMeasurement = (typeof systemOfMeasurement)[keyof typeof systemOfMeasurement];
504
+ export type AggregatedNumberRange = {
505
+ /** The period of the aggregated number range */
506
+ period: AggregationPeriod;
507
+ /** The range of the aggregated number range */
508
+ range: NumberRange;
509
+ };
488
510
  export type AreaInput = {
489
511
  /** The coordinates of the GeoJSON geometry see [the GeoJSON RFC](https://www.rfc-editor.org/rfc/rfc7946.html#section-3.1) for details. */
490
512
  coordinates: Array<Scalars["GeoJSONCoordinates"]["input"]>;
@@ -549,6 +571,8 @@ export type AssetFiltersInput = {
549
571
  groups?: InputMaybe<Array<Scalars["String"]["input"]>>;
550
572
  /** Filter by insights on the asset. */
551
573
  insights?: InputMaybe<Array<AssetInsightType>>;
574
+ /** Insights filters */
575
+ insightsFilters?: InputMaybe<InsightsFilters>;
552
576
  /** Filter by when was the asset last seen */
553
577
  lastSeen?: InputMaybe<AssetLastSeen>;
554
578
  /** Filter by PARTIAL or COMPLETE asset metadata information */
@@ -567,6 +591,8 @@ export type AssetFiltersInput = {
567
591
  partnerId?: InputMaybe<Scalars["ID"]["input"]>;
568
592
  /** List of production years */
569
593
  productionYears?: InputMaybe<Array<Scalars["String"]["input"]>>;
594
+ /** Rental active contract filters */
595
+ rentalActiveContractFilters?: InputMaybe<RentalActiveContractFilters>;
570
596
  /** List of rental contract external references */
571
597
  rentalContractExternalReferences?: InputMaybe<Array<Scalars["String"]["input"]>>;
572
598
  /** List of rental contract order numbers */
@@ -615,6 +641,8 @@ export type AssetFiltersInput = {
615
641
  types?: InputMaybe<Array<Scalars["String"]["input"]>>;
616
642
  };
617
643
  export type AssetSortInput = {
644
+ /** When sorting by Insights Aggregation, specify the aggregation period. */
645
+ aggregationPeriod?: InputMaybe<AggregationPeriod>;
618
646
  /** When sorting by Custom Field specify the custom field definition to sort by. */
619
647
  customFieldDefinitionId?: InputMaybe<Scalars["ID"]["input"]>;
620
648
  /** Sort order. */
@@ -684,6 +712,54 @@ export type DateRange = {
684
712
  /** start date */
685
713
  start: Scalars["DateTime"]["input"];
686
714
  };
715
+ export type DateTimeRange = {
716
+ /** Start date */
717
+ from?: InputMaybe<Scalars["DateTime"]["input"]>;
718
+ /** End date */
719
+ to?: InputMaybe<Scalars["DateTime"]["input"]>;
720
+ };
721
+ export type InsightsFilters = {
722
+ /** The asset's after treatment diesel exhaust fluid tank level */
723
+ afterTreatmentDieselExhaustFluidTankLevel?: InputMaybe<NumberRange>;
724
+ /** The battery charger state */
725
+ batteryChargerState?: InputMaybe<Array<Scalars["Boolean"]["input"]>>;
726
+ /** The battery potential */
727
+ batteryPotential?: InputMaybe<NumberRange>;
728
+ /** The battery state of charge percent */
729
+ batteryStateOfChargePercent?: InputMaybe<NumberRange>;
730
+ /** Cumulative engine hours of the asset (hours). */
731
+ cumulativeEngineHours?: InputMaybe<AggregatedNumberRange>;
732
+ /** Cumulative idle hours of the asset (hours). */
733
+ cumulativeIdleHours?: InputMaybe<AggregatedNumberRange>;
734
+ /** Cumulative idle non operating hours of the asset (hours). */
735
+ cumulativeIdleNonOperatingHours?: InputMaybe<AggregatedNumberRange>;
736
+ /** Cumulative moving hours of the asset (hours). */
737
+ cumulativeMovingHours?: InputMaybe<AggregatedNumberRange>;
738
+ /** Cumulative operating hours of the asset (hours). */
739
+ cumulativeOperatingHours?: InputMaybe<AggregatedNumberRange>;
740
+ /** Cumulative productive hours of the asset (hours). */
741
+ cumulativeProductiveHours?: InputMaybe<AggregatedNumberRange>;
742
+ /** Engine total fuel used of the asset (hours). */
743
+ engineTotalFuelUsed?: InputMaybe<AggregatedNumberRange>;
744
+ /** The engine's total idle hours */
745
+ engineTotalIdleFuelUsed?: InputMaybe<AggregatedNumberRange>;
746
+ /** The asset's fuel level */
747
+ fuelLevel?: InputMaybe<NumberRange>;
748
+ };
749
+ export type NumberRange = {
750
+ /** max number */
751
+ max?: InputMaybe<Scalars["Float"]["input"]>;
752
+ /** min number */
753
+ min?: InputMaybe<Scalars["Float"]["input"]>;
754
+ };
755
+ export type RentalActiveContractFilters = {
756
+ /** Filter by rental active contract customer external references */
757
+ customerExternalReferences?: InputMaybe<Array<Scalars["String"]["input"]>>;
758
+ /** Filter by rental active contract item off rent dates date range */
759
+ offRentDatesDateRange?: InputMaybe<DateTimeRange>;
760
+ /** Filter by rental active contract item on rent dates date range */
761
+ onRentDatesDateRange?: InputMaybe<DateTimeRange>;
762
+ };
687
763
  export type GetFilteredAssetsQueryVariables = Exact<{
688
764
  filters: InputMaybe<AssetFiltersInput>;
689
765
  sort: InputMaybe<AssetSortInput>;
@@ -7,4 +7,4 @@ export declare const useAssetSortInput: () => AssetSortInput;
7
7
  /**
8
8
  * Convert the sorting state from the AssetSortingContext to the AssetSortInput used by the GraphQL API
9
9
  */
10
- export declare const convertToAssetSortInput: ({ sortBy, order, customFieldDefinitionId }: SortingState) => AssetSortInput;
10
+ export declare const convertToAssetSortInput: ({ sortBy, order, customFieldDefinitionId, aggregationPeriod, }: SortingState) => AssetSortInput;