@trackunit/filters-graphql-hook 1.11.120 → 1.11.123

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
@@ -61,9 +61,7 @@ const isStringFilterValue = (value) => {
61
61
  * @param outputTypeRecord - record with output types
62
62
  * @returns {Record | undefined}- fixed filter values
63
63
  */
64
- const fixTypes = (
65
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
- values, outputTypeRecord) => {
64
+ const fixTypes = (values, outputTypeRecord) => {
67
65
  if (!values) {
68
66
  return undefined;
69
67
  }
@@ -120,16 +118,13 @@ const valuesIfNotEmpty = (value) => {
120
118
  /**
121
119
  * Check if value is string array
122
120
  */
123
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
124
121
  const isStringArrayValue = (value) => {
125
122
  return Array.isArray(value) && value.every(item => typeof item === "string");
126
123
  };
127
124
  /**
128
125
  * Check if value is string array or undefined
129
126
  */
130
- const stringArrayOrUndefined = (
131
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
132
- value) => {
127
+ const stringArrayOrUndefined = (value) => {
133
128
  if (isStringArrayValue(value)) {
134
129
  return value.length > 0 ? value : undefined;
135
130
  }
@@ -153,9 +148,7 @@ const isValueNameArray = (value) => {
153
148
  /**
154
149
  * Check if value is ValueName[] or undefined
155
150
  */
156
- const valueNameArrayOrUndefined = (
157
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
158
- input) => {
151
+ const valueNameArrayOrUndefined = (input) => {
159
152
  if (isValueNameArray(input) && input.length > 0) {
160
153
  return input.map(item => item.value);
161
154
  }
@@ -164,19 +157,18 @@ input) => {
164
157
  /**
165
158
  * Check if value is ValueName or undefined
166
159
  */
167
- const valueNameOrUndefined = (
168
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
169
- input) => {
160
+ const valueNameOrUndefined = (input) => {
170
161
  return isValueName(input) ? input : undefined;
171
162
  };
163
+ const hasBooleanValue = (input) => {
164
+ return typeof input === "object" && input !== null && "booleanValue" in input;
165
+ };
172
166
  /**
173
167
  /**
174
168
  * Check if value is boolean or undefined
175
169
  */
176
- const valueBooleanOrUndefined = (
177
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
178
- input) => {
179
- if (input && typeof input === "object" && "booleanValue" in input) {
170
+ const valueBooleanOrUndefined = (input) => {
171
+ if (hasBooleanValue(input)) {
180
172
  return input.booleanValue;
181
173
  }
182
174
  return undefined;
@@ -184,10 +176,8 @@ input) => {
184
176
  /**
185
177
  *
186
178
  */
187
- const positiveValueBooleanOrNull = (
188
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
189
- input) => {
190
- if (input && typeof input === "object" && "booleanValue" in input && input.booleanValue) {
179
+ const positiveValueBooleanOrNull = (input) => {
180
+ if (hasBooleanValue(input) && input.booleanValue) {
191
181
  return input.booleanValue;
192
182
  }
193
183
  return null;
package/index.esm.js CHANGED
@@ -59,9 +59,7 @@ const isStringFilterValue = (value) => {
59
59
  * @param outputTypeRecord - record with output types
60
60
  * @returns {Record | undefined}- fixed filter values
61
61
  */
62
- const fixTypes = (
63
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
- values, outputTypeRecord) => {
62
+ const fixTypes = (values, outputTypeRecord) => {
65
63
  if (!values) {
66
64
  return undefined;
67
65
  }
@@ -118,16 +116,13 @@ const valuesIfNotEmpty = (value) => {
118
116
  /**
119
117
  * Check if value is string array
120
118
  */
121
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
122
119
  const isStringArrayValue = (value) => {
123
120
  return Array.isArray(value) && value.every(item => typeof item === "string");
124
121
  };
125
122
  /**
126
123
  * Check if value is string array or undefined
127
124
  */
128
- const stringArrayOrUndefined = (
129
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
130
- value) => {
125
+ const stringArrayOrUndefined = (value) => {
131
126
  if (isStringArrayValue(value)) {
132
127
  return value.length > 0 ? value : undefined;
133
128
  }
@@ -151,9 +146,7 @@ const isValueNameArray = (value) => {
151
146
  /**
152
147
  * Check if value is ValueName[] or undefined
153
148
  */
154
- const valueNameArrayOrUndefined = (
155
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
156
- input) => {
149
+ const valueNameArrayOrUndefined = (input) => {
157
150
  if (isValueNameArray(input) && input.length > 0) {
158
151
  return input.map(item => item.value);
159
152
  }
@@ -162,19 +155,18 @@ input) => {
162
155
  /**
163
156
  * Check if value is ValueName or undefined
164
157
  */
165
- const valueNameOrUndefined = (
166
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
167
- input) => {
158
+ const valueNameOrUndefined = (input) => {
168
159
  return isValueName(input) ? input : undefined;
169
160
  };
161
+ const hasBooleanValue = (input) => {
162
+ return typeof input === "object" && input !== null && "booleanValue" in input;
163
+ };
170
164
  /**
171
165
  /**
172
166
  * Check if value is boolean or undefined
173
167
  */
174
- const valueBooleanOrUndefined = (
175
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
176
- input) => {
177
- if (input && typeof input === "object" && "booleanValue" in input) {
168
+ const valueBooleanOrUndefined = (input) => {
169
+ if (hasBooleanValue(input)) {
178
170
  return input.booleanValue;
179
171
  }
180
172
  return undefined;
@@ -182,10 +174,8 @@ input) => {
182
174
  /**
183
175
  *
184
176
  */
185
- const positiveValueBooleanOrNull = (
186
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
187
- input) => {
188
- if (input && typeof input === "object" && "booleanValue" in input && input.booleanValue) {
177
+ const positiveValueBooleanOrNull = (input) => {
178
+ if (hasBooleanValue(input) && input.booleanValue) {
189
179
  return input.booleanValue;
190
180
  }
191
181
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/filters-graphql-hook",
3
- "version": "1.11.120",
3
+ "version": "1.11.123",
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.7.122",
17
- "@trackunit/filters-filter-bar": "1.8.177",
18
- "@trackunit/shared-utils": "1.9.115",
19
- "@trackunit/iris-app-api": "1.10.9",
20
- "@trackunit/react-core-contexts-test": "1.7.129",
21
- "@trackunit/i18n-library-translation": "1.7.137",
22
- "@trackunit/iris-app-runtime-core-api": "1.7.125",
23
- "@trackunit/react-core-hooks": "1.7.129"
16
+ "@trackunit/iris-app-build-utilities": "1.7.125",
17
+ "@trackunit/filters-filter-bar": "1.8.180",
18
+ "@trackunit/shared-utils": "1.9.118",
19
+ "@trackunit/iris-app-api": "1.10.12",
20
+ "@trackunit/react-core-contexts-test": "1.7.132",
21
+ "@trackunit/i18n-library-translation": "1.7.140",
22
+ "@trackunit/iris-app-runtime-core-api": "1.7.128",
23
+ "@trackunit/react-core-hooks": "1.7.132"
24
24
  },
25
25
  "module": "./index.esm.js",
26
26
  "main": "./index.cjs.js",
package/src/fixTypes.d.ts CHANGED
@@ -7,7 +7,7 @@ import { z } from "zod";
7
7
  * @param outputTypeRecord - record with output types
8
8
  * @returns {Record | undefined}- fixed filter values
9
9
  */
10
- export declare const fixTypes: <TRecordType extends Record<string, string>>(values: any, outputTypeRecord: TRecordType) => Array<TRecordType[keyof TRecordType]> | undefined;
10
+ export declare const fixTypes: <TRecordType extends Record<string, string>>(values: unknown, outputTypeRecord: TRecordType) => Array<TRecordType[keyof TRecordType]> | undefined;
11
11
  /**
12
12
  * Fix type for filter value
13
13
  *
@@ -23,11 +23,11 @@ export declare const valuesIfNotEmpty: <TReturnType>(value: TReturnType) => TRet
23
23
  /**
24
24
  * Check if value is string array
25
25
  */
26
- export declare const isStringArrayValue: (value: any) => value is Array<string>;
26
+ export declare const isStringArrayValue: (value: unknown) => value is Array<string>;
27
27
  /**
28
28
  * Check if value is string array or undefined
29
29
  */
30
- export declare const stringArrayOrUndefined: (value: any) => Array<string> | undefined;
30
+ export declare const stringArrayOrUndefined: (value: unknown) => Array<string> | undefined;
31
31
  /**
32
32
  * Type guard to check if a value is a single ValueName object
33
33
  */
@@ -39,20 +39,20 @@ export declare const isValueNameArray: (value: unknown) => value is Array<ValueN
39
39
  /**
40
40
  * Check if value is ValueName[] or undefined
41
41
  */
42
- export declare const valueNameArrayOrUndefined: (input: any) => Array<string> | undefined;
42
+ export declare const valueNameArrayOrUndefined: (input: unknown) => Array<string> | undefined;
43
43
  /**
44
44
  * Check if value is ValueName or undefined
45
45
  */
46
- export declare const valueNameOrUndefined: (input: any) => ValueName | undefined;
46
+ export declare const valueNameOrUndefined: (input: unknown) => ValueName | undefined;
47
47
  /**
48
48
  /**
49
49
  * Check if value is boolean or undefined
50
50
  */
51
- export declare const valueBooleanOrUndefined: (input: any) => boolean | undefined;
51
+ export declare const valueBooleanOrUndefined: (input: unknown) => boolean | undefined;
52
52
  /**
53
53
  *
54
54
  */
55
- export declare const positiveValueBooleanOrNull: (input: any) => boolean | null;
55
+ export declare const positiveValueBooleanOrNull: (input: unknown) => boolean | null;
56
56
  export declare const geoJsonSimplifiedPolygonSchema: z.ZodObject<{
57
57
  type: z.ZodLiteral<"Polygon">;
58
58
  coordinates: z.ZodArray<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">, "many">;
@@ -1,4 +1,5 @@
1
- import { NamespaceTransProps, TransForLibs, TranslationResource } from "@trackunit/i18n-library-translation";
1
+ import type { ReactElement } from "react";
2
+ import { NamespaceTransProps, TransForLibs, TranslationResource, useNamespaceTranslation } from "@trackunit/i18n-library-translation";
2
3
  import defaultTranslations from "./locales/en/translation.json";
3
4
  /** A type for all available translation keys in this library */
4
5
  export type TranslationKeys = keyof typeof defaultTranslations;
@@ -14,11 +15,7 @@ export declare const translations: TranslationResource<TranslationKeys>;
14
15
  /**
15
16
  * Local useTranslation for this specific library
16
17
  */
17
- export declare const useTranslation: () => [TransForLibs<never>, import("i18next").i18n, boolean] & {
18
- t: TransForLibs<never>;
19
- i18n: import("i18next").i18n;
20
- ready: boolean;
21
- };
18
+ export declare const useTranslation: () => ReturnType<typeof useNamespaceTranslation<TranslationKeys>>;
22
19
  /**
23
20
  * Type of the t function for the local useTranslation for this specific library
24
21
  */
@@ -26,7 +23,7 @@ export type TranslationFunction = TransForLibs<TranslationKeys>;
26
23
  /**
27
24
  * Trans for this specific library.
28
25
  */
29
- export declare const Trans: (props: NamespaceTransProps<TranslationKeys>) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const Trans: (props: NamespaceTransProps<TranslationKeys>) => ReactElement;
30
27
  /**
31
28
  * Registers the translations for this library
32
29
  */
@@ -5,4 +5,4 @@ import { CustomFieldFilter } from "./generated/graphql-api/graphql";
5
5
  * @param filters Custom field filters
6
6
  * @returns {CustomFieldFilter[]} Custom field filters in a format that can be used by the GraphQL API
7
7
  */
8
- export declare const useCustomFieldFilters: (filters?: {}) => CustomFieldFilter[];
8
+ export declare const useCustomFieldFilters: (filters?: {}) => Array<CustomFieldFilter>;