@ethlete/query 0.1.0-next.3 → 0.1.0-next.5

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,5 +1,5 @@
1
- import { BaseArguments } from '../query';
2
- import { AnyQueryCreator } from '../query-client';
1
+ import { BaseArguments, QueryStateData } from '../query';
2
+ import { AnyQueryCreator, QueryCreatorArgs, QueryCreatorReturnType } from '../query-client';
3
3
  export declare type InfinityQueryParamLocation = 'path' | 'query' | 'body' | 'header' | 'variable';
4
4
  export declare type AppendItemsLocation = 'start' | 'end';
5
5
  export interface PageParamCalculatorOptions {
@@ -89,3 +89,6 @@ export interface InfinityQueryConfig<QueryCreator extends AnyQueryCreator, Argum
89
89
  totalPagesExtractor?: (data: TotalPagesExtractorOptions<QueryResponse>) => number;
90
90
  };
91
91
  }
92
+ declare type OmitUndefined<T> = T extends undefined ? never : T;
93
+ export declare type InfinityQueryConfigType<QueryCreator extends AnyQueryCreator, InfinityResponse extends unknown[]> = InfinityQueryConfig<QueryCreator, OmitUndefined<QueryCreatorArgs<QueryCreator>>, QueryStateData<QueryCreatorReturnType<QueryCreator>['state']>, InfinityResponse>;
94
+ export {};
@@ -34,10 +34,14 @@ export interface QueryFieldOptions<T = unknown> {
34
34
  * - `transformToBooleanArray`
35
35
  * - `transformToDate` (expects a string in the default js format)
36
36
  * - `transformToDateArray` (expects strings in the default js format)
37
+ * - `transformToSort` (expects a string in the format `field:direction`)
37
38
  */
38
39
  queryParamToValueTransformFn?: (val: unknown) => T | null;
39
40
  /**
40
41
  * A function that transforms the value of the field to a value that can be appended to the url query params.
42
+ *
43
+ * The following common transformations are already implemented:
44
+ * - `transformToSortQueryParam` (returns an object containing `field` and `direction` properties)
41
45
  */
42
46
  valueToQueryParamTransformFn?: (val: T | null) => unknown;
43
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethlete/query",
3
- "version": "0.1.0-next.3",
3
+ "version": "0.1.0-next.5",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0"
6
6
  },