@trackunit/filters-graphql-hook 0.0.1
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/README.md +22 -0
- package/index.cjs.d.ts +1 -0
- package/index.cjs.js +400 -0
- package/index.esm.js +384 -0
- package/package.json +26 -0
- package/src/fixTypes.d.ts +37 -0
- package/src/generated/graphql-api/fragment-masking.d.ts +15 -0
- package/src/generated/graphql-api/gql.d.ts +37 -0
- package/src/generated/graphql-api/graphql.d.ts +360 -0
- package/src/generated/graphql-api/index.d.ts +2 -0
- package/src/generated/graphql-api/mock.d.ts +5 -0
- package/src/index.d.ts +5 -0
- package/src/translation.d.ts +34 -0
- package/src/useActiveAssetFilters.d.ts +10 -0
- package/src/useAssetQueryFilters.d.ts +32 -0
- package/src/useAssetSortInput.d.ts +10 -0
- package/src/useCustomFieldFilters.d.ts +8 -0
- package/translation.cjs.js +7 -0
- package/translation.cjs10.js +7 -0
- package/translation.cjs11.js +7 -0
- package/translation.cjs12.js +7 -0
- package/translation.cjs13.js +7 -0
- package/translation.cjs14.js +7 -0
- package/translation.cjs15.js +7 -0
- package/translation.cjs16.js +7 -0
- package/translation.cjs17.js +7 -0
- package/translation.cjs2.js +7 -0
- package/translation.cjs3.js +7 -0
- package/translation.cjs4.js +7 -0
- package/translation.cjs5.js +7 -0
- package/translation.cjs6.js +7 -0
- package/translation.cjs7.js +7 -0
- package/translation.cjs8.js +7 -0
- package/translation.cjs9.js +7 -0
- package/translation.esm.js +5 -0
- package/translation.esm10.js +5 -0
- package/translation.esm11.js +5 -0
- package/translation.esm12.js +5 -0
- package/translation.esm13.js +5 -0
- package/translation.esm14.js +5 -0
- package/translation.esm15.js +5 -0
- package/translation.esm16.js +5 -0
- package/translation.esm17.js +5 -0
- package/translation.esm2.js +5 -0
- package/translation.esm3.js +5 -0
- package/translation.esm4.js +5 -0
- package/translation.esm5.js +5 -0
- package/translation.esm6.js +5 -0
- package/translation.esm7.js +5 -0
- package/translation.esm8.js +5 -0
- package/translation.esm9.js +5 -0
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { TypedDocumentNode as DocumentNode } from "@graphql-typed-document-node/core";
|
|
2
|
+
import type { PublicIrisAppManifest } from "@trackunit/iris-app-api";
|
|
3
|
+
export type Maybe<T> = T | null;
|
|
4
|
+
export type InputMaybe<T> = Maybe<T>;
|
|
5
|
+
export type Exact<T extends {
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}> = {
|
|
8
|
+
[K in keyof T]: T[K];
|
|
9
|
+
};
|
|
10
|
+
export type Incremental<T> = T | {
|
|
11
|
+
[P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never;
|
|
12
|
+
};
|
|
13
|
+
export type DateTimeISOString = string;
|
|
14
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
15
|
+
export type Scalars = {
|
|
16
|
+
ID: {
|
|
17
|
+
input: string;
|
|
18
|
+
output: string;
|
|
19
|
+
};
|
|
20
|
+
String: {
|
|
21
|
+
input: string;
|
|
22
|
+
output: string;
|
|
23
|
+
};
|
|
24
|
+
Boolean: {
|
|
25
|
+
input: boolean;
|
|
26
|
+
output: boolean;
|
|
27
|
+
};
|
|
28
|
+
Int: {
|
|
29
|
+
input: number;
|
|
30
|
+
output: number;
|
|
31
|
+
};
|
|
32
|
+
Float: {
|
|
33
|
+
input: number;
|
|
34
|
+
output: number;
|
|
35
|
+
};
|
|
36
|
+
/** Cursor scalar. */
|
|
37
|
+
Cursor: {
|
|
38
|
+
input: string;
|
|
39
|
+
output: string;
|
|
40
|
+
};
|
|
41
|
+
/** The javascript `Date` as string. Type represents date and time as the ISO Date string. */
|
|
42
|
+
DateTime: {
|
|
43
|
+
input: DateTimeISOString;
|
|
44
|
+
output: DateTimeISOString;
|
|
45
|
+
};
|
|
46
|
+
/** Duration represents an ISO 8601 duration */
|
|
47
|
+
Duration: {
|
|
48
|
+
input: any;
|
|
49
|
+
output: any;
|
|
50
|
+
};
|
|
51
|
+
/** A (possiblely multidimensional) set of coordinates following x, y, z order. */
|
|
52
|
+
GeoJSONCoordinates: {
|
|
53
|
+
input: number[] | number[][];
|
|
54
|
+
output: number[] | number[][];
|
|
55
|
+
};
|
|
56
|
+
/** Raw JSON object structure, not serialized to string */
|
|
57
|
+
JSON: {
|
|
58
|
+
input: any;
|
|
59
|
+
output: any;
|
|
60
|
+
};
|
|
61
|
+
/** Javascript `Long`. Type represents a 64 bit integer. */
|
|
62
|
+
Long: {
|
|
63
|
+
input: any;
|
|
64
|
+
output: any;
|
|
65
|
+
};
|
|
66
|
+
/** The `PublicIrisAppManifest` scalar type represents an Iris App Manifest as JSON */
|
|
67
|
+
PublicIrisAppManifest: {
|
|
68
|
+
input: PublicIrisAppManifest;
|
|
69
|
+
output: PublicIrisAppManifest;
|
|
70
|
+
};
|
|
71
|
+
/** The `Upload` scalar type represents a file upload. */
|
|
72
|
+
Upload: {
|
|
73
|
+
input: any;
|
|
74
|
+
output: any;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export declare const assetActivityState: {
|
|
78
|
+
readonly Idling: "IDLING";
|
|
79
|
+
readonly Stopped: "STOPPED";
|
|
80
|
+
readonly Unknown: "UNKNOWN";
|
|
81
|
+
readonly Working: "WORKING";
|
|
82
|
+
};
|
|
83
|
+
export type AssetActivityState = (typeof assetActivityState)[keyof typeof assetActivityState];
|
|
84
|
+
export declare const assetCriticalityState: {
|
|
85
|
+
readonly Critical: "CRITICAL";
|
|
86
|
+
readonly Low: "LOW";
|
|
87
|
+
readonly None: "NONE";
|
|
88
|
+
};
|
|
89
|
+
export type AssetCriticalityState = (typeof assetCriticalityState)[keyof typeof assetCriticalityState];
|
|
90
|
+
/** Asset filters input */
|
|
91
|
+
export type AssetFiltersInput = {
|
|
92
|
+
/** List of activities */
|
|
93
|
+
activities?: InputMaybe<Array<AssetActivityState>>;
|
|
94
|
+
/** A list of asset ID's to do a bulk lookup for. */
|
|
95
|
+
assetIds?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
96
|
+
/** List of asset types */
|
|
97
|
+
assetTypes?: InputMaybe<Array<AssetType>>;
|
|
98
|
+
/** Filter by bounding box */
|
|
99
|
+
boundingBox?: InputMaybe<BoundingBoxInput>;
|
|
100
|
+
/** Filter by bounding shape */
|
|
101
|
+
boundingShape?: InputMaybe<BoundingShapeInput>;
|
|
102
|
+
/** Filter to only include this list of brands */
|
|
103
|
+
brands?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
104
|
+
/** List of criticalities */
|
|
105
|
+
criticalities?: InputMaybe<Array<AssetCriticalityState>>;
|
|
106
|
+
/** List of custom fields to filter by */
|
|
107
|
+
customFields?: InputMaybe<Array<CustomFieldFilter>>;
|
|
108
|
+
/** Digital key mode of the asset */
|
|
109
|
+
digitalKeyModes?: InputMaybe<Array<DigitalKeyMode>>;
|
|
110
|
+
/** List of external references */
|
|
111
|
+
externalReferences?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
112
|
+
/** Filter by if the asset is followed */
|
|
113
|
+
followed?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
114
|
+
/** Filter by global group. */
|
|
115
|
+
globalGroup?: InputMaybe<Scalars["String"]["input"]>;
|
|
116
|
+
/** Filter by groups */
|
|
117
|
+
groups?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
118
|
+
/** Filter by when was the asset last seen */
|
|
119
|
+
lastSeen?: InputMaybe<AssetLastSeen>;
|
|
120
|
+
/** Filter by if the asset have PARTIAL or COMPLETE metadata information */
|
|
121
|
+
metadataCompleteness?: InputMaybe<MetadataCompleteness>;
|
|
122
|
+
/** List of models */
|
|
123
|
+
models?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
124
|
+
/** List of owner account ids */
|
|
125
|
+
ownerAccountIds?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
126
|
+
/** List of owner account names */
|
|
127
|
+
ownerAccountNames?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
128
|
+
/** Filter by partner ID */
|
|
129
|
+
partnerId?: InputMaybe<Scalars["String"]["input"]>;
|
|
130
|
+
/** List of production years */
|
|
131
|
+
productionYears?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
132
|
+
/** List of rental customer names */
|
|
133
|
+
rentalCustomerName?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
134
|
+
/** List of rental statuses */
|
|
135
|
+
rentalStatus?: InputMaybe<Array<RentalStatus>>;
|
|
136
|
+
/** A string that could match a property of an asset within your fleet */
|
|
137
|
+
searchQuery?: InputMaybe<Scalars["String"]["input"]>;
|
|
138
|
+
/** List of serial numbers */
|
|
139
|
+
serialNumbers?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
140
|
+
/** List of service plan assignments */
|
|
141
|
+
servicePlanAssignments?: InputMaybe<Array<ServicePlanStatus>>;
|
|
142
|
+
/** List of service plan IDs */
|
|
143
|
+
servicePlanIds?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
144
|
+
/** List of service plan statuses */
|
|
145
|
+
servicePlanStatuses?: InputMaybe<Array<ServicePlanStatus>>;
|
|
146
|
+
/** List of service provider IDs */
|
|
147
|
+
serviceProviderIds?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
148
|
+
/** List of siteIds */
|
|
149
|
+
siteIds?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
150
|
+
/** List of site types */
|
|
151
|
+
siteTypes?: InputMaybe<Array<SiteTypeSfs>>;
|
|
152
|
+
/** The measurement system used for unit conversion of filters. */
|
|
153
|
+
systemOfMeasurement?: InputMaybe<SystemOfMeasurement>;
|
|
154
|
+
/** List of telematics device serial numbers */
|
|
155
|
+
telematicsDeviceSerialNumbers?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
156
|
+
/** List of types (also known as subtypes) */
|
|
157
|
+
types?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
158
|
+
};
|
|
159
|
+
export declare const assetLastSeen: {
|
|
160
|
+
readonly Last_7Days: "LAST_7_DAYS";
|
|
161
|
+
readonly Last_24Hours: "LAST_24_HOURS";
|
|
162
|
+
readonly Last_30Days: "LAST_30_DAYS";
|
|
163
|
+
readonly LastHour: "LAST_HOUR";
|
|
164
|
+
readonly OlderThan_30Days: "OLDER_THAN_30_DAYS";
|
|
165
|
+
};
|
|
166
|
+
export type AssetLastSeen = (typeof assetLastSeen)[keyof typeof assetLastSeen];
|
|
167
|
+
export declare const assetSortByProperty: {
|
|
168
|
+
readonly AccessManagement: "ACCESS_MANAGEMENT";
|
|
169
|
+
readonly Activity: "ACTIVITY";
|
|
170
|
+
readonly Brand: "BRAND";
|
|
171
|
+
readonly Category: "CATEGORY";
|
|
172
|
+
readonly Criticality: "CRITICALITY";
|
|
173
|
+
readonly CustomField: "CUSTOM_FIELD";
|
|
174
|
+
readonly ExternalReference: "EXTERNAL_REFERENCE";
|
|
175
|
+
readonly Location: "LOCATION";
|
|
176
|
+
readonly LocationUpdatedAt: "LOCATION_UPDATED_AT";
|
|
177
|
+
readonly Model: "MODEL";
|
|
178
|
+
readonly Name: "NAME";
|
|
179
|
+
readonly OwnerAccountName: "OWNER_ACCOUNT_NAME";
|
|
180
|
+
readonly ProductionYear: "PRODUCTION_YEAR";
|
|
181
|
+
readonly SerialNumber: "SERIAL_NUMBER";
|
|
182
|
+
readonly ServicePlanAssignmentStatus: "SERVICE_PLAN_ASSIGNMENT_STATUS";
|
|
183
|
+
readonly ServicePlanOverdueness: "SERVICE_PLAN_OVERDUENESS";
|
|
184
|
+
readonly ServicePlanStatus: "SERVICE_PLAN_STATUS";
|
|
185
|
+
readonly TelematicsDeviceSerialNumber: "TELEMATICS_DEVICE_SERIAL_NUMBER";
|
|
186
|
+
readonly Type: "TYPE";
|
|
187
|
+
};
|
|
188
|
+
export type AssetSortByProperty = (typeof assetSortByProperty)[keyof typeof assetSortByProperty];
|
|
189
|
+
/** Asset sort input. */
|
|
190
|
+
export type AssetSortInput = {
|
|
191
|
+
/** When sorting by Custom Field specify the custom field definition to sort by. */
|
|
192
|
+
customFieldDefinitionId?: InputMaybe<Scalars["ID"]["input"]>;
|
|
193
|
+
/** Sort order. */
|
|
194
|
+
order: SortOrder;
|
|
195
|
+
/** Sort property. */
|
|
196
|
+
property: AssetSortByProperty;
|
|
197
|
+
/** When sorting by location, sorting will be relative to this location */
|
|
198
|
+
relativeToLocation?: InputMaybe<CoordinatesInput>;
|
|
199
|
+
};
|
|
200
|
+
export declare const assetType: {
|
|
201
|
+
readonly Attachment: "ATTACHMENT";
|
|
202
|
+
readonly Equipment: "EQUIPMENT";
|
|
203
|
+
readonly Gateway: "GATEWAY";
|
|
204
|
+
readonly Machine: "MACHINE";
|
|
205
|
+
readonly Other: "OTHER";
|
|
206
|
+
readonly Tool: "TOOL";
|
|
207
|
+
};
|
|
208
|
+
export type AssetType = (typeof assetType)[keyof typeof assetType];
|
|
209
|
+
/** Bounding box input. */
|
|
210
|
+
export type BoundingBoxInput = {
|
|
211
|
+
/** The coordinates for the North/West values of the bounding box. */
|
|
212
|
+
nw: CoordinatesInput;
|
|
213
|
+
/** The coordinates for the South/East values of the bounding box. */
|
|
214
|
+
se: CoordinatesInput;
|
|
215
|
+
/** The zoom level from which the bound box spans. */
|
|
216
|
+
zoom?: InputMaybe<Scalars["Float"]["input"]>;
|
|
217
|
+
};
|
|
218
|
+
/** Bounding shape input. */
|
|
219
|
+
export type BoundingShapeInput = {
|
|
220
|
+
/** Points of coordinates for the bounding shape. */
|
|
221
|
+
points: Array<CoordinatesInput>;
|
|
222
|
+
};
|
|
223
|
+
/** Coordinates input */
|
|
224
|
+
export type CoordinatesInput = {
|
|
225
|
+
/** The latitude of the coordinate. */
|
|
226
|
+
latitude: Scalars["Float"]["input"];
|
|
227
|
+
/** The longitude of the coordinate. */
|
|
228
|
+
longitude: Scalars["Float"]["input"];
|
|
229
|
+
};
|
|
230
|
+
/** Custom field date range */
|
|
231
|
+
export type CustomFieldDateRange = {
|
|
232
|
+
/** The first date to include. */
|
|
233
|
+
from?: InputMaybe<Scalars["String"]["input"]>;
|
|
234
|
+
/** The last date to include. */
|
|
235
|
+
to?: InputMaybe<Scalars["String"]["input"]>;
|
|
236
|
+
};
|
|
237
|
+
/** Filter by custom field value */
|
|
238
|
+
export type CustomFieldFilter = {
|
|
239
|
+
/** The boolean value of the custom field value input. */
|
|
240
|
+
booleanValue?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
241
|
+
/** The date value of the custom field value input. */
|
|
242
|
+
dateRange?: InputMaybe<CustomFieldDateRange>;
|
|
243
|
+
/** The definition ID of the custom field value input. */
|
|
244
|
+
definitionId?: InputMaybe<Scalars["ID"]["input"]>;
|
|
245
|
+
/** The definition key of the custom field value input. */
|
|
246
|
+
definitionKey?: InputMaybe<Scalars["String"]["input"]>;
|
|
247
|
+
/** The number range of the custom field value input. */
|
|
248
|
+
numberRange?: InputMaybe<CustomFieldNumberRange>;
|
|
249
|
+
/** The owner of the custom field value input. */
|
|
250
|
+
owner?: InputMaybe<CustomFieldOwnerInput>;
|
|
251
|
+
/** The string array value of the custom field value input. */
|
|
252
|
+
stringArrayValue?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
253
|
+
/** The string value of the custom field value input. */
|
|
254
|
+
stringValue?: InputMaybe<Scalars["String"]["input"]>;
|
|
255
|
+
};
|
|
256
|
+
/** Custom field number range */
|
|
257
|
+
export type CustomFieldNumberRange = {
|
|
258
|
+
/** The smallest number to include. */
|
|
259
|
+
from?: InputMaybe<Scalars["Float"]["input"]>;
|
|
260
|
+
/** The lagest number to include. */
|
|
261
|
+
to?: InputMaybe<Scalars["Float"]["input"]>;
|
|
262
|
+
};
|
|
263
|
+
/** Custom field owner input. */
|
|
264
|
+
export type CustomFieldOwnerInput = {
|
|
265
|
+
/** The account ID of the custom field owner input. */
|
|
266
|
+
accountId?: InputMaybe<Scalars["ID"]["input"]>;
|
|
267
|
+
/** The iris app ID of the custom field owner input. */
|
|
268
|
+
irisAppId?: InputMaybe<Scalars["String"]["input"]>;
|
|
269
|
+
/** The owner type of the custom field owner input. */
|
|
270
|
+
ownerType: CustomFieldOwnerType;
|
|
271
|
+
};
|
|
272
|
+
export declare const customFieldOwnerType: {
|
|
273
|
+
readonly Account: "ACCOUNT";
|
|
274
|
+
readonly IrisApp: "IRIS_APP";
|
|
275
|
+
readonly Trackunit: "TRACKUNIT";
|
|
276
|
+
};
|
|
277
|
+
export type CustomFieldOwnerType = (typeof customFieldOwnerType)[keyof typeof customFieldOwnerType];
|
|
278
|
+
export declare const digitalKeyMode: {
|
|
279
|
+
readonly Disabled: "DISABLED";
|
|
280
|
+
readonly LockedForAll: "LOCKED_FOR_ALL";
|
|
281
|
+
readonly NeverInitialized: "NEVER_INITIALIZED";
|
|
282
|
+
readonly Unknown: "UNKNOWN";
|
|
283
|
+
readonly UnlockedForAll: "UNLOCKED_FOR_ALL";
|
|
284
|
+
readonly UnlockedForAllFixed: "UNLOCKED_FOR_ALL_FIXED";
|
|
285
|
+
readonly UnlockedForKey: "UNLOCKED_FOR_KEY";
|
|
286
|
+
readonly UnlockedForKeyAndPin: "UNLOCKED_FOR_KEY_AND_PIN";
|
|
287
|
+
readonly UnlockedForPin: "UNLOCKED_FOR_PIN";
|
|
288
|
+
readonly Unsupported: "UNSUPPORTED";
|
|
289
|
+
};
|
|
290
|
+
export type DigitalKeyMode = (typeof digitalKeyMode)[keyof typeof digitalKeyMode];
|
|
291
|
+
export declare const metadataCompleteness: {
|
|
292
|
+
readonly Complete: "COMPLETE";
|
|
293
|
+
readonly Partial: "PARTIAL";
|
|
294
|
+
};
|
|
295
|
+
export type MetadataCompleteness = (typeof metadataCompleteness)[keyof typeof metadataCompleteness];
|
|
296
|
+
export declare const rentalStatus: {
|
|
297
|
+
readonly Available: "Available";
|
|
298
|
+
readonly InRepair: "InRepair";
|
|
299
|
+
readonly NotOnContract: "NotOnContract";
|
|
300
|
+
readonly OffRent: "OffRent";
|
|
301
|
+
readonly OnRent: "OnRent";
|
|
302
|
+
readonly Other: "Other";
|
|
303
|
+
readonly PickupReady: "PickupReady";
|
|
304
|
+
readonly Reserved: "Reserved";
|
|
305
|
+
readonly Returned: "Returned";
|
|
306
|
+
readonly Transfer: "Transfer";
|
|
307
|
+
};
|
|
308
|
+
export type RentalStatus = (typeof rentalStatus)[keyof typeof rentalStatus];
|
|
309
|
+
export declare const servicePlanStatus: {
|
|
310
|
+
readonly Complete: "COMPLETE";
|
|
311
|
+
readonly Draft: "DRAFT";
|
|
312
|
+
readonly FullyConfigured: "FULLY_CONFIGURED";
|
|
313
|
+
readonly HasPlan: "HAS_PLAN";
|
|
314
|
+
readonly HasServiceProvider: "HAS_SERVICE_PROVIDER";
|
|
315
|
+
readonly MissingPlan: "MISSING_PLAN";
|
|
316
|
+
readonly MissingProvider: "MISSING_PROVIDER";
|
|
317
|
+
readonly Overdue: "OVERDUE";
|
|
318
|
+
readonly Planned: "PLANNED";
|
|
319
|
+
readonly Unknown: "UNKNOWN";
|
|
320
|
+
readonly Upcoming: "UPCOMING";
|
|
321
|
+
};
|
|
322
|
+
export type ServicePlanStatus = (typeof servicePlanStatus)[keyof typeof servicePlanStatus];
|
|
323
|
+
export declare const siteTypeSfs: {
|
|
324
|
+
readonly Area: "AREA";
|
|
325
|
+
readonly ClassicPoi: "CLASSIC_POI";
|
|
326
|
+
readonly ClassicZone: "CLASSIC_ZONE";
|
|
327
|
+
readonly ConstructionSite: "CONSTRUCTION_SITE";
|
|
328
|
+
readonly Depot: "DEPOT";
|
|
329
|
+
readonly NotOnSite: "NOT_ON_SITE";
|
|
330
|
+
readonly WorkPlace: "WORK_PLACE";
|
|
331
|
+
};
|
|
332
|
+
export type SiteTypeSfs = (typeof siteTypeSfs)[keyof typeof siteTypeSfs];
|
|
333
|
+
export declare const sortOrder: {
|
|
334
|
+
readonly Asc: "ASC";
|
|
335
|
+
readonly Desc: "DESC";
|
|
336
|
+
};
|
|
337
|
+
export type SortOrder = (typeof sortOrder)[keyof typeof sortOrder];
|
|
338
|
+
export declare const systemOfMeasurement: {
|
|
339
|
+
readonly Si: "SI";
|
|
340
|
+
readonly UsCustomary: "US_CUSTOMARY";
|
|
341
|
+
};
|
|
342
|
+
export type SystemOfMeasurement = (typeof systemOfMeasurement)[keyof typeof systemOfMeasurement];
|
|
343
|
+
export type GetFilteredAssetsQueryVariables = Exact<{
|
|
344
|
+
filters?: InputMaybe<AssetFiltersInput>;
|
|
345
|
+
sort?: InputMaybe<AssetSortInput>;
|
|
346
|
+
}>;
|
|
347
|
+
export type GetFilteredAssetsQuery = {
|
|
348
|
+
__typename?: "Query";
|
|
349
|
+
assets: {
|
|
350
|
+
__typename?: "AssetConnection";
|
|
351
|
+
edges: Array<{
|
|
352
|
+
__typename?: "AssetEdge";
|
|
353
|
+
cursor: string;
|
|
354
|
+
}>;
|
|
355
|
+
};
|
|
356
|
+
};
|
|
357
|
+
export declare const GetFilteredAssetsDocument: DocumentNode<GetFilteredAssetsQuery, Exact<{
|
|
358
|
+
filters?: InputMaybe<AssetFiltersInput> | undefined;
|
|
359
|
+
sort?: InputMaybe<AssetSortInput> | undefined;
|
|
360
|
+
}>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DeepPartialNullable } from "@trackunit/react-core-contexts-test";
|
|
2
|
+
import * as gql from "./graphql";
|
|
3
|
+
export declare const mockForGetFilteredAssetsQuery: (variables: gql.GetFilteredAssetsQueryVariables, data?: DeepPartialNullable<gql.GetFilteredAssetsQuery>) => import("@apollo/client/testing").MockedResponse<gql.GetFilteredAssetsQuery, Record<string, any>> & {
|
|
4
|
+
data: gql.GetFilteredAssetsQuery;
|
|
5
|
+
};
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NamespaceTransProps, TransForLibs, TranslationResource } from "@trackunit/i18n-library-translation";
|
|
3
|
+
import defaultTranslations from "./locales/en/translation.json";
|
|
4
|
+
/** A type for all available translation keys in this library */
|
|
5
|
+
export type TranslationKeys = keyof typeof defaultTranslations;
|
|
6
|
+
/** The translation namespace for this library */
|
|
7
|
+
export declare const namespace = "filters.graphql-hook";
|
|
8
|
+
/**
|
|
9
|
+
* The TranslationResource for this Library.
|
|
10
|
+
* Holds lazy loaded imports for all languages supported by the library.
|
|
11
|
+
*
|
|
12
|
+
* This is used to register the translations for this library before initializing i18next.
|
|
13
|
+
*/
|
|
14
|
+
export declare const translations: TranslationResource<TranslationKeys>;
|
|
15
|
+
/**
|
|
16
|
+
* Local useTranslation for this specific library
|
|
17
|
+
*/
|
|
18
|
+
export declare const useTranslation: () => [TransForLibs<never>, import("i18next").i18n, boolean] & {
|
|
19
|
+
t: TransForLibs<never>;
|
|
20
|
+
i18n: import("i18next").i18n;
|
|
21
|
+
ready: boolean;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Type of the t function for the local useTranslation for this specific library
|
|
25
|
+
*/
|
|
26
|
+
export type TranslationFunction = TransForLibs<TranslationKeys>;
|
|
27
|
+
/**
|
|
28
|
+
* Trans for this specific library.
|
|
29
|
+
*/
|
|
30
|
+
export declare const Trans: (props: NamespaceTransProps<TranslationKeys>) => JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* Registers the translations for this library
|
|
33
|
+
*/
|
|
34
|
+
export declare const setupLibraryTranslations: () => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FilterBarValues } from "@trackunit/react-core-contexts-api";
|
|
2
|
+
import { AssetFiltersInput } from "./generated/graphql-api/graphql";
|
|
3
|
+
export declare const CustomFieldPrefix = "cf__";
|
|
4
|
+
/**
|
|
5
|
+
* Converts field filters to a format that can be used by the GraphQL API for AssetFiltersInput
|
|
6
|
+
*
|
|
7
|
+
* @param filters FilterBarValues
|
|
8
|
+
* @returns {AssetFiltersInput} Custom field filters in a format that can be used by the GraphQL API
|
|
9
|
+
*/
|
|
10
|
+
export declare const useActiveAssetFilters: (filters?: FilterBarValues) => AssetFiltersInput;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FilterBarValues } from "@trackunit/react-core-contexts-api";
|
|
2
|
+
import { AssetFiltersInput, AssetSortInput, SystemOfMeasurement } from "./generated/graphql-api/graphql";
|
|
3
|
+
export interface AssetQueryInputVariables {
|
|
4
|
+
filters: AssetFiltersInput;
|
|
5
|
+
sort: AssetSortInput;
|
|
6
|
+
first: number;
|
|
7
|
+
systemOfMeasurement: SystemOfMeasurement;
|
|
8
|
+
definitionIds: string[] | undefined;
|
|
9
|
+
}
|
|
10
|
+
export interface AssetQueryFilters {
|
|
11
|
+
assetQueryVariables: AssetQueryInputVariables;
|
|
12
|
+
}
|
|
13
|
+
export interface UseAssetQueryFiltersProps {
|
|
14
|
+
filters: FilterBarValues;
|
|
15
|
+
/**
|
|
16
|
+
* Will default to 50
|
|
17
|
+
*/
|
|
18
|
+
first?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A hook used to handle asset query filters.
|
|
22
|
+
* It resets the pagination when filters change.
|
|
23
|
+
* The assetQueryVariables can be passed directly to any AssetsResolver based query.
|
|
24
|
+
* The filters are converted to the GraphQL API format.
|
|
25
|
+
*
|
|
26
|
+
* @example const { assetQueryVariables } = useAssetQueryFilters({ filters: filterBar.filterBarConfig.values });
|
|
27
|
+
* const { data: assets } = useMyAssetsQuery({
|
|
28
|
+
* variables: assetQueryVariables,
|
|
29
|
+
* });
|
|
30
|
+
* @returns {AssetQueryFilters} - assetQueryVariables
|
|
31
|
+
*/
|
|
32
|
+
export declare const useAssetQueryFilters: (props: UseAssetQueryFiltersProps) => AssetQueryFilters;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SortingState } from "@trackunit/react-core-contexts-api";
|
|
2
|
+
import { AssetSortInput } from "./generated/graphql-api/graphql";
|
|
3
|
+
/**
|
|
4
|
+
* This hook is used to convert the sorting state from the AssetSortingContext to the AssetSortInput used by the GraphQL API
|
|
5
|
+
*/
|
|
6
|
+
export declare const useAssetSortInput: () => AssetSortInput;
|
|
7
|
+
/**
|
|
8
|
+
* Convert the sorting state from the AssetSortingContext to the AssetSortInput used by the GraphQL API
|
|
9
|
+
*/
|
|
10
|
+
export declare const convertToAssetSortInput: ({ sortBy, order, customFieldDefinitionId }: SortingState) => AssetSortInput;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CustomFieldFilter } from "./generated/graphql-api/graphql";
|
|
2
|
+
/**
|
|
3
|
+
* Converts custom field filters to a format that can be used by the GraphQL API
|
|
4
|
+
*
|
|
5
|
+
* @param filters Custom field filters
|
|
6
|
+
* @returns {CustomFieldFilter[]} Custom field filters in a format that can be used by the GraphQL API
|
|
7
|
+
*/
|
|
8
|
+
export declare const useCustomFieldFilters: (filters?: {}) => CustomFieldFilter[];
|