@ethlete/query 5.39.0 → 5.40.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/CHANGELOG.md +16 -0
- package/fesm2022/ethlete-query.mjs +64 -48
- package/fesm2022/ethlete-query.mjs.map +1 -1
- package/lib/experimental/http/http-request.d.ts +5 -2
- package/lib/experimental/http/query-dependencies.d.ts +6 -1
- package/lib/experimental/http/query-repository.d.ts +15 -4
- package/package.json +6 -5
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { HttpClient, HttpContext, HttpEvent } from '@angular/common/http';
|
|
2
|
-
import { Signal } from '@angular/core';
|
|
2
|
+
import { ErrorHandler, Signal } from '@angular/core';
|
|
3
3
|
import { QueryArgs, RequestArgs, ResponseType } from './query';
|
|
4
4
|
import { CacheAdapterFn } from './query-client-config';
|
|
5
5
|
import { QueryMethod } from './query-creator';
|
|
6
6
|
import { QueryErrorResponse } from './query-error-response';
|
|
7
|
+
import { QueryRepositoryDependencies } from './query-repository';
|
|
7
8
|
import { ShouldRetryRequestFn } from './query-utils';
|
|
8
9
|
export declare const SPEED_BUFFER_TIME_IN_MS = 2000;
|
|
9
10
|
export type HttpRequestTransferCacheConfig = boolean | {
|
|
@@ -13,6 +14,8 @@ export type HttpRequestResponseType = 'json' | 'text' | 'blob' | 'arraybuffer';
|
|
|
13
14
|
export type CreateHttpRequestDependencies = {
|
|
14
15
|
/** The http client instance to use for the request */
|
|
15
16
|
httpClient: HttpClient;
|
|
17
|
+
/** The error handler instance to use for the request */
|
|
18
|
+
ngErrorHandler: ErrorHandler;
|
|
16
19
|
};
|
|
17
20
|
export type CreateHttpRequestClientOptions = {
|
|
18
21
|
/**
|
|
@@ -58,7 +61,7 @@ export type CreateHttpRequestOptions<TArgs extends QueryArgs> = {
|
|
|
58
61
|
/** The data of the request */
|
|
59
62
|
args?: RequestArgs<TArgs> | null;
|
|
60
63
|
/** The dependencies of the request */
|
|
61
|
-
dependencies:
|
|
64
|
+
dependencies: QueryRepositoryDependencies;
|
|
62
65
|
/** The client options of the request */
|
|
63
66
|
clientOptions?: CreateHttpRequestClientOptions;
|
|
64
67
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { DestroyRef, EnvironmentInjector, ErrorHandler, ɵEffectScheduler } from '@angular/core';
|
|
2
3
|
import { QueryClient } from './query-client';
|
|
3
4
|
import { QueryClientConfig } from './query-client-config';
|
|
4
5
|
import { QueryConfig } from './query-creator';
|
|
@@ -17,5 +18,9 @@ export type QueryDependencies = {
|
|
|
17
18
|
injector: EnvironmentInjector;
|
|
18
19
|
/** The effect scheduler */
|
|
19
20
|
effectScheduler: ɵEffectScheduler;
|
|
21
|
+
/** The error handler */
|
|
22
|
+
ngErrorHandler: ErrorHandler;
|
|
23
|
+
/** The http client */
|
|
24
|
+
httpClient: HttpClient;
|
|
20
25
|
};
|
|
21
26
|
export declare const setupQueryDependencies: (options: SetupQueryDependenciesOptions) => QueryDependencies;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { DestroyRef, ErrorHandler } from '@angular/core';
|
|
2
3
|
import { CreateHttpRequestClientOptions, HttpRequest } from './http-request';
|
|
3
4
|
import { QueryArgs, RequestArgs } from './query';
|
|
4
5
|
import { QueryClientConfig } from './query-client-config';
|
|
@@ -24,7 +25,7 @@ export type QueryRepositoryRequestOptions<TArgs extends QueryArgs> = {
|
|
|
24
25
|
/** The previous cache key of the request */
|
|
25
26
|
previousKey?: string | false;
|
|
26
27
|
/** The destroy ref to bind the request to. If the destroy ref is destroyed, the request will be destroyed as well. */
|
|
27
|
-
|
|
28
|
+
consumerDestroyRef: DestroyRef;
|
|
28
29
|
/** Configuration on how to run the query */
|
|
29
30
|
runQueryOptions?: RunQueryExecuteOptions;
|
|
30
31
|
/** Internal options for running the query */
|
|
@@ -45,7 +46,7 @@ export type QueryRepository = {
|
|
|
45
46
|
/** Creates a new request. If the request is already cached, it will be reused. */
|
|
46
47
|
request: <TArgs extends QueryArgs>(options: QueryRepositoryRequestOptions<TArgs>) => QueryRepositoryItem<TArgs>;
|
|
47
48
|
/** Removes a consumer from a request by its key. Destroys the request if there are no more consumers left. */
|
|
48
|
-
unbind: (key: QueryKeyOrNone,
|
|
49
|
+
unbind: (key: QueryKeyOrNone, consumerDestroyRef: DestroyRef) => boolean;
|
|
49
50
|
/** Removes all secure requests and their consumers */
|
|
50
51
|
unbindAllSecure: () => void;
|
|
51
52
|
};
|
|
@@ -55,4 +56,14 @@ export type QueryKey = string;
|
|
|
55
56
|
export type QueryKeyNoCache = false;
|
|
56
57
|
/** A key that may or may not be cached */
|
|
57
58
|
export type QueryKeyOrNone = QueryKey | QueryKeyNoCache;
|
|
58
|
-
export
|
|
59
|
+
export type QueryRepositoryDependencies = {
|
|
60
|
+
/** The HTTP client to use for the requests */
|
|
61
|
+
httpClient: HttpClient;
|
|
62
|
+
/** The error handler to use for the requests */
|
|
63
|
+
ngErrorHandler: ErrorHandler;
|
|
64
|
+
};
|
|
65
|
+
export type CreateQueryRepositoryConfig = QueryClientConfig & {
|
|
66
|
+
/** The dependencies of the query repository */
|
|
67
|
+
dependencies: QueryRepositoryDependencies;
|
|
68
|
+
};
|
|
69
|
+
export declare const createQueryRepository: (config: CreateQueryRepositoryConfig) => QueryRepository;
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethlete/query",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.40.1",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"sideEffects": false,
|
|
5
6
|
"peerDependencies": {
|
|
6
|
-
"@angular/common": "19.2.
|
|
7
|
-
"@angular/core": "19.2.
|
|
8
|
-
"@angular/forms": "19.2.
|
|
9
|
-
"@angular/router": "19.2.
|
|
7
|
+
"@angular/common": "19.2.11",
|
|
8
|
+
"@angular/core": "19.2.11",
|
|
9
|
+
"@angular/forms": "19.2.11",
|
|
10
|
+
"@angular/router": "19.2.11",
|
|
10
11
|
"@ethlete/core": "^4.0.3",
|
|
11
12
|
"@ethlete/types": "^1.6.2",
|
|
12
13
|
"rxjs": "7.8.2",
|