@ethlete/query 5.25.0 → 5.25.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.
@@ -9,7 +9,7 @@ export declare const ggLikePaginationAdapter: <T>(response: GgLikePaginated<T>)
9
9
  export declare const dynLikePaginationAdapter: <T>(response: DynLikePaginated<T>) => NormalizedPagination<T>;
10
10
  export declare const contentfulGqlLikePaginationAdapter: <T>(response: ContentfulGqlLikePaginated<T>) => NormalizedPagination<T>;
11
11
  export declare const fakePaginationAdapter: (totalHits?: number) => <T>(response: T) => NormalizedPagination<T>;
12
- export type CreatePagedQueryStackOptions<TArgs extends QueryArgs> = {
12
+ export type CreatePagedQueryStackOptions<TArgs extends QueryArgs, TNormPagination extends NormalizedPagination<unknown>> = {
13
13
  /**
14
14
  * The normalizer function that will be used to normalize the response to a format that the paged query can understand.
15
15
  *
@@ -20,7 +20,7 @@ export type CreatePagedQueryStackOptions<TArgs extends QueryArgs> = {
20
20
  * - `contentfulGqlLikePaginationAdapter`
21
21
  * - `fakePaginationAdapter` (for testing purposes)
22
22
  */
23
- responseNormalizer: (response: ResponseType<TArgs>) => NormalizedPagination<ResponseType<TArgs>>;
23
+ responseNormalizer: (response: ResponseType<TArgs>) => TNormPagination;
24
24
  /**
25
25
  * The query creator function that will be used to create the paged query.
26
26
  */
@@ -62,7 +62,7 @@ export type PagedQueryStackResetOptions = {
62
62
  */
63
63
  initialPage?: number;
64
64
  };
65
- export type PagedQueryStackExecuteOptions<TArgs extends QueryArgs> = {
65
+ export type PagedQueryStackExecuteOptions<TNormPagination extends NormalizedPagination<unknown>> = {
66
66
  /**
67
67
  * If provided, only the queries that match the condition will be executed.
68
68
  * This will also execute the previous and next query to the one that matched the condition.
@@ -71,7 +71,7 @@ export type PagedQueryStackExecuteOptions<TArgs extends QueryArgs> = {
71
71
  * @example
72
72
  * myPagedQuery.execute({ where: (item) => item.id === 4 });
73
73
  */
74
- where?: (item: ResponseType<TArgs>, index: number, array: ResponseType<TArgs>[]) => boolean;
74
+ where?: (item: TNormPagination['items'][number], index: number, array: TNormPagination['items']) => boolean;
75
75
  /**
76
76
  * If true, the cache will be used (if not expired) and the request will not be made.
77
77
  * @default false
@@ -79,12 +79,12 @@ export type PagedQueryStackExecuteOptions<TArgs extends QueryArgs> = {
79
79
  allowCache?: boolean;
80
80
  };
81
81
  export type PagedQueryStackDirection = 'next' | 'previous';
82
- export type AnyPagedQueryStack = PagedQueryStack<AnyQuery>;
83
- export type PagedQueryStack<TQuery extends AnyQuery> = {
82
+ export type AnyPagedQueryStack = PagedQueryStack<AnyQuery, NormalizedPagination<unknown>>;
83
+ export type PagedQueryStack<TQuery extends AnyQuery, TNormPagination extends NormalizedPagination<unknown>> = {
84
84
  /**
85
85
  * The current pagination state of the paged query.
86
86
  */
87
- pagination: Signal<NormalizedPagination<ResponseType<QueryArgsOf<TQuery>>> | null>;
87
+ pagination: Signal<TNormPagination | null>;
88
88
  /**
89
89
  * Fetches the previous page of the paged query.
90
90
  *
@@ -112,7 +112,7 @@ export type PagedQueryStack<TQuery extends AnyQuery> = {
112
112
  /**
113
113
  * The items of the paged query.
114
114
  */
115
- items: Signal<ResponseType<QueryArgsOf<TQuery>>[]>;
115
+ items: Signal<TNormPagination['items']>;
116
116
  /**
117
117
  * Whether the paged query is loading or not.
118
118
  */
@@ -140,10 +140,10 @@ export type PagedQueryStack<TQuery extends AnyQuery> = {
140
140
  /**
141
141
  * Executes the paged query.
142
142
  */
143
- execute: (options?: PagedQueryStackExecuteOptions<QueryArgsOf<TQuery>>) => void;
143
+ execute: (options?: PagedQueryStackExecuteOptions<TNormPagination>) => void;
144
144
  /**
145
145
  * The current direction of the paged query.
146
146
  */
147
147
  direction: Signal<PagedQueryStackDirection>;
148
148
  };
149
- export declare const createPagedQueryStack: <TCreator extends AnyQueryCreator, TArgs extends QueryArgsOf<TCreator>>(options: CreatePagedQueryStackOptions<TArgs>) => PagedQueryStack<Query<TArgs>>;
149
+ export declare const createPagedQueryStack: <TCreator extends AnyQueryCreator, TArgs extends QueryArgsOf<TCreator>, TNormPagination extends NormalizedPagination<unknown>>(options: CreatePagedQueryStackOptions<TArgs, TNormPagination>) => PagedQueryStack<Query<TArgs>, TNormPagination>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethlete/query",
3
- "version": "5.25.0",
3
+ "version": "5.25.1",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "@angular/common": "19.1.4",