@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.
Files changed (51) hide show
  1. package/README.md +22 -0
  2. package/index.cjs.d.ts +1 -0
  3. package/index.cjs.js +400 -0
  4. package/index.esm.js +384 -0
  5. package/package.json +26 -0
  6. package/src/fixTypes.d.ts +37 -0
  7. package/src/generated/graphql-api/fragment-masking.d.ts +15 -0
  8. package/src/generated/graphql-api/gql.d.ts +37 -0
  9. package/src/generated/graphql-api/graphql.d.ts +360 -0
  10. package/src/generated/graphql-api/index.d.ts +2 -0
  11. package/src/generated/graphql-api/mock.d.ts +5 -0
  12. package/src/index.d.ts +5 -0
  13. package/src/translation.d.ts +34 -0
  14. package/src/useActiveAssetFilters.d.ts +10 -0
  15. package/src/useAssetQueryFilters.d.ts +32 -0
  16. package/src/useAssetSortInput.d.ts +10 -0
  17. package/src/useCustomFieldFilters.d.ts +8 -0
  18. package/translation.cjs.js +7 -0
  19. package/translation.cjs10.js +7 -0
  20. package/translation.cjs11.js +7 -0
  21. package/translation.cjs12.js +7 -0
  22. package/translation.cjs13.js +7 -0
  23. package/translation.cjs14.js +7 -0
  24. package/translation.cjs15.js +7 -0
  25. package/translation.cjs16.js +7 -0
  26. package/translation.cjs17.js +7 -0
  27. package/translation.cjs2.js +7 -0
  28. package/translation.cjs3.js +7 -0
  29. package/translation.cjs4.js +7 -0
  30. package/translation.cjs5.js +7 -0
  31. package/translation.cjs6.js +7 -0
  32. package/translation.cjs7.js +7 -0
  33. package/translation.cjs8.js +7 -0
  34. package/translation.cjs9.js +7 -0
  35. package/translation.esm.js +5 -0
  36. package/translation.esm10.js +5 -0
  37. package/translation.esm11.js +5 -0
  38. package/translation.esm12.js +5 -0
  39. package/translation.esm13.js +5 -0
  40. package/translation.esm14.js +5 -0
  41. package/translation.esm15.js +5 -0
  42. package/translation.esm16.js +5 -0
  43. package/translation.esm17.js +5 -0
  44. package/translation.esm2.js +5 -0
  45. package/translation.esm3.js +5 -0
  46. package/translation.esm4.js +5 -0
  47. package/translation.esm5.js +5 -0
  48. package/translation.esm6.js +5 -0
  49. package/translation.esm7.js +5 -0
  50. package/translation.esm8.js +5 -0
  51. package/translation.esm9.js +5 -0
package/index.esm.js ADDED
@@ -0,0 +1,384 @@
1
+ import 'react/jsx-runtime';
2
+ import { registerTranslations } from '@trackunit/i18n-library-translation';
3
+ import { isStringArrayFilterValue, isMinMaxFilterValue, isDateRangeValue, isBooleanValue } from '@trackunit/filters-filter-bar';
4
+ import { truthy } from '@trackunit/shared-utils';
5
+ import { useCurrentUserSystemOfMeasurement, useAssetSorting } from '@trackunit/react-core-hooks';
6
+ import { useMemo } from 'react';
7
+
8
+ var defaultTranslations = {
9
+
10
+ };
11
+
12
+ /** The translation namespace for this library */
13
+ const namespace = "filters.graphql-hook";
14
+ /**
15
+ * The TranslationResource for this Library.
16
+ * Holds lazy loaded imports for all languages supported by the library.
17
+ *
18
+ * This is used to register the translations for this library before initializing i18next.
19
+ */
20
+ const translations = {
21
+ ns: namespace,
22
+ default: defaultTranslations,
23
+ languages: {
24
+ de: () => import('./translation.esm.js'),
25
+ da: () => import('./translation.esm2.js'),
26
+ cs: () => import('./translation.esm3.js'),
27
+ nl: () => import('./translation.esm4.js'),
28
+ fr: () => import('./translation.esm5.js'),
29
+ fi: () => import('./translation.esm6.js'),
30
+ hu: () => import('./translation.esm7.js'),
31
+ it: () => import('./translation.esm8.js'),
32
+ nb: () => import('./translation.esm9.js'),
33
+ pl: () => import('./translation.esm10.js'),
34
+ pt: () => import('./translation.esm11.js'),
35
+ ru: () => import('./translation.esm12.js'),
36
+ ro: () => import('./translation.esm13.js'),
37
+ es: () => import('./translation.esm14.js'),
38
+ sv: () => import('./translation.esm15.js'),
39
+ ja: () => import('./translation.esm16.js'),
40
+ th: () => import('./translation.esm17.js'),
41
+ },
42
+ };
43
+ /**
44
+ * Registers the translations for this library
45
+ */
46
+ const setupLibraryTranslations = () => {
47
+ registerTranslations(translations);
48
+ };
49
+
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ const isStringFilterValue = (value) => {
52
+ return typeof value === "string";
53
+ };
54
+ /**
55
+ * Fix types for filter values
56
+ *
57
+ * @param values - filter values
58
+ * @param outputTypeRecord - record with output types
59
+ * @returns {Record | undefined}- fixed filter values
60
+ */
61
+ const fixTypes = (
62
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
+ values, outputTypeRecord) => {
64
+ if (!values) {
65
+ return undefined;
66
+ }
67
+ if (Array.isArray(values) && values.length === 0) {
68
+ return undefined;
69
+ }
70
+ if (isStringArrayFilterValue(values)) {
71
+ const result = values.map(value => {
72
+ const valuesFromOutput = Object.values(outputTypeRecord);
73
+ const convertedValue = valuesFromOutput.find(v => value === v);
74
+ if (!convertedValue) {
75
+ throw Error(`Unknown value: ${value} expect one of: ${JSON.stringify(Object.values(outputTypeRecord))}`);
76
+ }
77
+ // eslint-disable-next-line local-rules/no-typescript-assertion
78
+ return convertedValue;
79
+ });
80
+ return result.filter(truthy);
81
+ }
82
+ if (isStringFilterValue(values)) {
83
+ const valuesFromOutput = Object.values(outputTypeRecord);
84
+ const convertedValue = valuesFromOutput.find(v => values === v);
85
+ if (!convertedValue) {
86
+ throw Error(`Unknown value: ${values} expect one of: ${JSON.stringify(Object.values(outputTypeRecord))}`);
87
+ }
88
+ // eslint-disable-next-line local-rules/no-typescript-assertion
89
+ return [convertedValue];
90
+ }
91
+ throw Error(`Unknown value: ${values} should be a string array`);
92
+ };
93
+ /**
94
+ * Fix type for filter value
95
+ *
96
+ * @param values - filter value
97
+ * @param outputTypeRecord - record with output types
98
+ * @returns {Record | null}- fixed filter value
99
+ */
100
+ const fixType = (values, outputTypeRecord) => {
101
+ if (!values) {
102
+ return null;
103
+ }
104
+ const convertedValue = outputTypeRecord[values];
105
+ if (!convertedValue) {
106
+ throw Error(`Unknown value: ${values} expect one of: ${JSON.stringify(Object.values(outputTypeRecord))}`);
107
+ }
108
+ // eslint-disable-next-line local-rules/no-typescript-assertion
109
+ return convertedValue;
110
+ };
111
+ /**
112
+ * Check if value is not empty
113
+ */
114
+ const valuesIfNotEmpty = (
115
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
116
+ value) => {
117
+ if (Array.isArray(value)) {
118
+ return value.length > 0 ? value : undefined;
119
+ }
120
+ return value;
121
+ };
122
+ /**
123
+ * Check if value is string array
124
+ */
125
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
126
+ const isStringArrayValue = (value) => {
127
+ return Array.isArray(value) && value.every(item => typeof item === "string");
128
+ };
129
+ /**
130
+ * Check if value is string array or undefined
131
+ */
132
+ const stringArrayOrUndefined = (
133
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
134
+ value) => {
135
+ if (isStringArrayValue(value)) {
136
+ return value.length > 0 ? value : undefined;
137
+ }
138
+ return undefined;
139
+ };
140
+ /**
141
+ * Check if value is ValueName[]
142
+ */
143
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
144
+ const isValueName = (value) => {
145
+ return (Array.isArray(value) &&
146
+ value.every(item => typeof item === "object" && Object.keys(item).includes("name") && Object.keys(item).includes("value")));
147
+ };
148
+ /**
149
+ * Check if value is ValueName[] or undefined
150
+ */
151
+ const valueNameArrayOrUndefined = (
152
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
153
+ input) => {
154
+ if (isValueName(input) && input.length > 0) {
155
+ return input.map(item => item.value);
156
+ }
157
+ return undefined;
158
+ };
159
+
160
+ const assetActivityState = {
161
+ Idling: "IDLING",
162
+ Stopped: "STOPPED",
163
+ Unknown: "UNKNOWN",
164
+ Working: "WORKING",
165
+ };
166
+ const assetCriticalityState = {
167
+ Critical: "CRITICAL",
168
+ Low: "LOW",
169
+ None: "NONE",
170
+ };
171
+ const assetLastSeen = {
172
+ Last_7Days: "LAST_7_DAYS",
173
+ Last_24Hours: "LAST_24_HOURS",
174
+ Last_30Days: "LAST_30_DAYS",
175
+ LastHour: "LAST_HOUR",
176
+ OlderThan_30Days: "OLDER_THAN_30_DAYS",
177
+ };
178
+ const assetType = {
179
+ Attachment: "ATTACHMENT",
180
+ Equipment: "EQUIPMENT",
181
+ Gateway: "GATEWAY",
182
+ Machine: "MACHINE",
183
+ Other: "OTHER",
184
+ Tool: "TOOL",
185
+ };
186
+ const rentalStatus = {
187
+ Available: "Available",
188
+ InRepair: "InRepair",
189
+ NotOnContract: "NotOnContract",
190
+ OffRent: "OffRent",
191
+ OnRent: "OnRent",
192
+ Other: "Other",
193
+ PickupReady: "PickupReady",
194
+ Reserved: "Reserved",
195
+ Returned: "Returned",
196
+ Transfer: "Transfer",
197
+ };
198
+ const servicePlanStatus = {
199
+ Complete: "COMPLETE",
200
+ Draft: "DRAFT",
201
+ FullyConfigured: "FULLY_CONFIGURED",
202
+ HasPlan: "HAS_PLAN",
203
+ HasServiceProvider: "HAS_SERVICE_PROVIDER",
204
+ MissingPlan: "MISSING_PLAN",
205
+ MissingProvider: "MISSING_PROVIDER",
206
+ Overdue: "OVERDUE",
207
+ Planned: "PLANNED",
208
+ Unknown: "UNKNOWN",
209
+ Upcoming: "UPCOMING",
210
+ };
211
+ const siteTypeSfs = {
212
+ Area: "AREA",
213
+ ClassicPoi: "CLASSIC_POI",
214
+ ClassicZone: "CLASSIC_ZONE",
215
+ ConstructionSite: "CONSTRUCTION_SITE",
216
+ Depot: "DEPOT",
217
+ NotOnSite: "NOT_ON_SITE",
218
+ WorkPlace: "WORK_PLACE",
219
+ };
220
+
221
+ const CustomFieldPrefix$1 = "cf__";
222
+ /**
223
+ * Converts custom field filters to a format that can be used by the GraphQL API
224
+ *
225
+ * @param filters Custom field filters
226
+ * @returns {CustomFieldFilter[]} Custom field filters in a format that can be used by the GraphQL API
227
+ */
228
+ // eslint-disable-next-line @typescript-eslint/ban-types
229
+ const useCustomFieldFilters = (filters) => {
230
+ return useMemo(() => {
231
+ const result = [];
232
+ if (filters) {
233
+ Object.entries(filters).forEach(([key, value]) => {
234
+ const customFieldValue = value;
235
+ if (key.startsWith(CustomFieldPrefix$1)) {
236
+ const definitionId = key.replace(CustomFieldPrefix$1, "");
237
+ if (isStringArrayFilterValue(customFieldValue) && customFieldValue.length > 0) {
238
+ result.push({
239
+ definitionId,
240
+ stringArrayValue: customFieldValue,
241
+ });
242
+ }
243
+ else if (isMinMaxFilterValue(customFieldValue) && (customFieldValue.min || customFieldValue.max)) {
244
+ result.push({
245
+ definitionId,
246
+ numberRange: {
247
+ from: customFieldValue.min,
248
+ to: customFieldValue.max,
249
+ },
250
+ });
251
+ }
252
+ else if (isDateRangeValue(customFieldValue) && (customFieldValue.from || customFieldValue.to)) {
253
+ result.push({
254
+ definitionId,
255
+ dateRange: {
256
+ from: customFieldValue.from,
257
+ to: customFieldValue.to,
258
+ },
259
+ });
260
+ }
261
+ else if (isBooleanValue(customFieldValue)) {
262
+ result.push({
263
+ definitionId,
264
+ booleanValue: customFieldValue.booleanValue === undefined ? null : customFieldValue.booleanValue,
265
+ });
266
+ }
267
+ }
268
+ });
269
+ }
270
+ return result;
271
+ }, [filters]);
272
+ };
273
+
274
+ const CustomFieldPrefix = "cf__";
275
+ /**
276
+ * Converts field filters to a format that can be used by the GraphQL API for AssetFiltersInput
277
+ *
278
+ * @param filters FilterBarValues
279
+ * @returns {AssetFiltersInput} Custom field filters in a format that can be used by the GraphQL API
280
+ */
281
+ const useActiveAssetFilters = (filters) => {
282
+ const { systemOfMeasurement } = useCurrentUserSystemOfMeasurement();
283
+ const customFields = useCustomFieldFilters({ filters });
284
+ // TODO make typesafe checks for all filters
285
+ const filter = useMemo(() => {
286
+ var _a, _b;
287
+ if (!filters) {
288
+ return {};
289
+ }
290
+ const followExist = filters.followed === "ALL" ? undefined : true;
291
+ return {
292
+ assetIds: stringArrayOrUndefined(filters.assetIds),
293
+ searchQuery: filters.search === "" || !filters.search ? undefined : filters.search,
294
+ activities: fixTypes(filters.activity, assetActivityState),
295
+ boundingBox: filters.boundingBox ? filters.boundingBox : undefined,
296
+ brands: stringArrayOrUndefined(filters.brands),
297
+ types: stringArrayOrUndefined(filters.types),
298
+ criticalities: fixTypes(filters.criticality, assetCriticalityState),
299
+ productionYears: valueNameArrayOrUndefined(filters.productionYears),
300
+ followed: filters.followed ? followExist : false,
301
+ lastSeen: filters.lastSeen === "ALL" || !filters.lastSeen ? undefined : (_a = fixTypes(filters.lastSeen, assetLastSeen)) === null || _a === void 0 ? void 0 : _a[0],
302
+ models: stringArrayOrUndefined(filters.models),
303
+ ownerAccountIds: valueNameArrayOrUndefined(filters.ownerAccountIds),
304
+ assetTypes: fixTypes(filters.assetType, assetType),
305
+ servicePlanStatuses: fixTypes(filters.serviceStatus, servicePlanStatus),
306
+ servicePlanAssignments: fixTypes(filters.servicePlanStatus, servicePlanStatus),
307
+ servicePlanIds: valueNameArrayOrUndefined(filters.servicePlan),
308
+ serviceProviderIds: valueNameArrayOrUndefined(filters.serviceProvider),
309
+ //currently we support only 1 filter value to be set so there won't be a second value, soon the partnerId will be transformed to a normal filter and will support an array of strings
310
+ partnerId: (_b = valueNameArrayOrUndefined(filters.partner)) === null || _b === void 0 ? void 0 : _b[0],
311
+ groups: valueNameArrayOrUndefined(filters.groups),
312
+ siteIds: valueNameArrayOrUndefined(filters.siteIds),
313
+ siteTypes: fixTypes(filters.siteType, siteTypeSfs),
314
+ rentalCustomerName: stringArrayOrUndefined(filters.rentalCustomerName),
315
+ rentalStatus: fixTypes(filters.rentalStatus, rentalStatus),
316
+ customFields: valuesIfNotEmpty(customFields),
317
+ systemOfMeasurement: systemOfMeasurement,
318
+ };
319
+ }, [filters, customFields, systemOfMeasurement]);
320
+ return filter;
321
+ };
322
+
323
+ /**
324
+ * This hook is used to convert the sorting state from the AssetSortingContext to the AssetSortInput used by the GraphQL API
325
+ */
326
+ const useAssetSortInput = () => {
327
+ const { sortingState } = useAssetSorting();
328
+ return useMemo(() => convertToAssetSortInput(sortingState), [sortingState]);
329
+ };
330
+ /**
331
+ * Convert the sorting state from the AssetSortingContext to the AssetSortInput used by the GraphQL API
332
+ */
333
+ const convertToAssetSortInput = ({ sortBy, order, customFieldDefinitionId }) => {
334
+ // If any of these fails, it might be because the `AssetSortByProperty` needs to be updated to match the GraphQL enum
335
+ return {
336
+ property: sortBy,
337
+ order,
338
+ customFieldDefinitionId,
339
+ };
340
+ };
341
+
342
+ /**
343
+ * A hook used to handle asset query filters.
344
+ * It resets the pagination when filters change.
345
+ * The assetQueryVariables can be passed directly to any AssetsResolver based query.
346
+ * The filters are converted to the GraphQL API format.
347
+ *
348
+ * @example const { assetQueryVariables } = useAssetQueryFilters({ filters: filterBar.filterBarConfig.values });
349
+ * const { data: assets } = useMyAssetsQuery({
350
+ * variables: assetQueryVariables,
351
+ * });
352
+ * @returns {AssetQueryFilters} - assetQueryVariables
353
+ */
354
+ const useAssetQueryFilters = (props) => {
355
+ const filters = useActiveAssetFilters(props.filters);
356
+ const sort = useAssetSortInput();
357
+ const { systemOfMeasurement } = useCurrentUserSystemOfMeasurement();
358
+ const assetQueryVariables = useMemo(() => ({
359
+ filters,
360
+ sort,
361
+ first: props.first || 50,
362
+ systemOfMeasurement: systemOfMeasurement,
363
+ // TODO only load custom fields active filters and visible custom field columns in table
364
+ // definitionIds:
365
+ // filters.customFields && filters.customFields.length > 0
366
+ // ? filters.customFields.map(customField => customField.definitionId!)
367
+ // : undefined,
368
+ definitionIds: undefined,
369
+ }), [filters, props.first, sort, systemOfMeasurement]);
370
+ return useMemo(() => ({
371
+ assetQueryVariables: assetQueryVariables,
372
+ }), [assetQueryVariables]);
373
+ };
374
+
375
+ /*
376
+ * ----------------------------
377
+ * | SETUP TRANSLATIONS START |
378
+ * ----------------------------
379
+ * This import and function call is needed to register translations for this library.
380
+ * Do not remove this if this library has translations.
381
+ */
382
+ setupLibraryTranslations();
383
+
384
+ export { CustomFieldPrefix, convertToAssetSortInput, fixType, fixTypes, isStringArrayValue, isValueName, stringArrayOrUndefined, useActiveAssetFilters, useAssetQueryFilters, useAssetSortInput, useCustomFieldFilters, valueNameArrayOrUndefined, valuesIfNotEmpty };
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@trackunit/filters-graphql-hook",
3
+ "version": "0.0.1",
4
+ "repository": "https://github.com/Trackunit/manager",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "engines": {
7
+ "node": ">=18.x"
8
+ },
9
+ "dependencies": {
10
+ "@trackunit/react-core-hooks": "*",
11
+ "@trackunit/shared-utils": "*",
12
+ "@trackunit/react-components": "*",
13
+ "@trackunit/react-filter-components": "*",
14
+ "react": "^18.2.0",
15
+ "@trackunit/react-form-components": "*",
16
+ "react-router-dom": "6.18.0",
17
+ "react-virtual": "^2.10.4",
18
+ "dequal": "^2.0.3",
19
+ "lodash": "4.17.21",
20
+ "jest-fetch-mock": "^3.0.3",
21
+ "@trackunit/react-core-contexts-api": "*",
22
+ "@trackunit/i18n-library-translation": "*"
23
+ },
24
+ "module": "./index.esm.js",
25
+ "main": "./index.cjs.js"
26
+ }
@@ -0,0 +1,37 @@
1
+ import { ValueName } from "@trackunit/filters-filter-bar";
2
+ /**
3
+ * Fix types for filter values
4
+ *
5
+ * @param values - filter values
6
+ * @param outputTypeRecord - record with output types
7
+ * @returns {Record | undefined}- fixed filter values
8
+ */
9
+ export declare const fixTypes: <TRecordType extends Record<string, string>>(values: any, outputTypeRecord: TRecordType) => TRecordType[keyof TRecordType][] | undefined;
10
+ /**
11
+ * Fix type for filter value
12
+ *
13
+ * @param values - filter value
14
+ * @param outputTypeRecord - record with output types
15
+ * @returns {Record | null}- fixed filter value
16
+ */
17
+ export declare const fixType: <TRecordType extends Record<string, string>>(values: string | undefined, outputTypeRecord: TRecordType) => TRecordType[keyof TRecordType] | null;
18
+ /**
19
+ * Check if value is not empty
20
+ */
21
+ export declare const valuesIfNotEmpty: <TReturnType>(value: TReturnType) => TReturnType | undefined;
22
+ /**
23
+ * Check if value is string array
24
+ */
25
+ export declare const isStringArrayValue: (value: any) => value is string[];
26
+ /**
27
+ * Check if value is string array or undefined
28
+ */
29
+ export declare const stringArrayOrUndefined: (value: any) => string[] | undefined;
30
+ /**
31
+ * Check if value is ValueName[]
32
+ */
33
+ export declare const isValueName: (value: any) => value is ValueName[];
34
+ /**
35
+ * Check if value is ValueName[] or undefined
36
+ */
37
+ export declare const valueNameArrayOrUndefined: (input: any) => string[] | undefined;
@@ -0,0 +1,15 @@
1
+ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';
2
+ import { Incremental } from './graphql';
3
+ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<infer TType, any> ? [TType] extends [{
4
+ ' $fragmentName'?: infer TKey;
5
+ }] ? TKey extends string ? {
6
+ ' $fragmentRefs'?: {
7
+ [key in TKey]: TType;
8
+ };
9
+ } : never : never : never;
10
+ export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>): TType;
11
+ export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined): TType | null | undefined;
12
+ export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>): ReadonlyArray<TType>;
13
+ export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined): ReadonlyArray<TType> | null | undefined;
14
+ export declare function makeFragmentData<F extends DocumentTypeDecoration<any, any>, FT extends ResultOf<F>>(data: FT, _fragment: F): FragmentType<F>;
15
+ export declare function isFragmentReady<TQuery, TFrag>(queryNode: DocumentTypeDecoration<TQuery, any>, fragmentNode: TypedDocumentNode<TFrag>, data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined): data is FragmentType<typeof fragmentNode>;
@@ -0,0 +1,37 @@
1
+ import * as types from './graphql';
2
+ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
3
+ /**
4
+ * Map of all GraphQL operations in the project.
5
+ *
6
+ * This map has several performance disadvantages:
7
+ * 1. It is not tree-shakeable, so it will include all operations in the project.
8
+ * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
9
+ * 3. It does not support dead code elimination, so it will add unused operations.
10
+ *
11
+ * Therefore it is highly recommended to use the babel or swc plugin for production.
12
+ */
13
+ declare const documents: {
14
+ "query GetFilteredAssets($filters: AssetFiltersInput, $sort: AssetSortInput) {\n assets(filters: $filters, sort: $sort) {\n edges {\n cursor\n }\n }\n}": DocumentNode<types.GetFilteredAssetsQuery, types.Exact<{
15
+ filters?: types.InputMaybe<types.AssetFiltersInput> | undefined;
16
+ sort?: types.InputMaybe<types.AssetSortInput> | undefined;
17
+ }>>;
18
+ };
19
+ /**
20
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
21
+ *
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
26
+ * ```
27
+ *
28
+ * The query argument is unknown!
29
+ * Please regenerate the types.
30
+ */
31
+ export declare function graphql(source: string): unknown;
32
+ /**
33
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
34
+ */
35
+ export declare function graphql(source: "query GetFilteredAssets($filters: AssetFiltersInput, $sort: AssetSortInput) {\n assets(filters: $filters, sort: $sort) {\n edges {\n cursor\n }\n }\n}"): (typeof documents)["query GetFilteredAssets($filters: AssetFiltersInput, $sort: AssetSortInput) {\n assets(filters: $filters, sort: $sort) {\n edges {\n cursor\n }\n }\n}"];
36
+ export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
37
+ export {};