@ethlete/query 6.0.0-next.2 → 6.0.0-next.20
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 +210 -0
- package/fesm2022/ethlete-query-testing.mjs.map +1 -1
- package/fesm2022/ethlete-query.mjs +1867 -299
- package/fesm2022/ethlete-query.mjs.map +1 -1
- package/generators/migrate-to-query-v3/auth-provider-scaffold.js +131 -0
- package/generators/migrate-to-query-v3/cleanup-migration.js +293 -0
- package/generators/migrate-to-query-v3/http-client-check.js +93 -0
- package/generators/migrate-to-query-v3/legacy-prepare-migration.js +772 -0
- package/generators/migrate-to-query-v3/legacy-query-creator-migration.js +607 -0
- package/generators/migrate-to-query-v3/migration-scope.js +41 -0
- package/generators/migrate-to-query-v3/migration.js +28 -2932
- package/generators/migrate-to-query-v3/module-graph.js +153 -0
- package/generators/migrate-to-query-v3/query-client-migration.js +525 -0
- package/generators/migrate-to-query-v3/rename-symbols.js +193 -0
- package/generators/migrate-to-query-v3/report.js +136 -0
- package/generators/migrate-to-query-v3/schema.json +12 -0
- package/generators/migrate-to-query-v3/shared.js +97 -0
- package/generators/prep-for-query-v3/migration.js +3 -3
- package/package.json +12 -12
- package/types/ethlete-query.d.ts +1057 -36
package/types/ethlete-query.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { Signal, Injector, CreateComputedOptions, InjectionToken, TrackByFunction, PipeTransform, OnInit, OnDestroy, DestroyRef, EnvironmentInjector,
|
|
2
|
+
import { Signal, Injector, CreateComputedOptions, InjectionToken, TrackByFunction, PipeTransform, OnInit, OnDestroy, DestroyRef, EnvironmentInjector, ErrorHandler, WritableSignal, CreateEffectOptions, EnvironmentProviders } from '@angular/core';
|
|
3
3
|
import * as _ethlete_core from '@ethlete/core';
|
|
4
4
|
import { ProviderResult, RuntimeError } from '@ethlete/core';
|
|
5
5
|
import * as rxjs from 'rxjs';
|
|
@@ -7,7 +7,8 @@ import { Observable, Subscribable, BehaviorSubject } from 'rxjs';
|
|
|
7
7
|
import * as _angular_common_http from '@angular/common/http';
|
|
8
8
|
import { HttpErrorResponse, HttpHeaders, HttpClient, HttpEvent, HttpStatusCode } from '@angular/common/http';
|
|
9
9
|
import * as _ethlete_query from '@ethlete/query';
|
|
10
|
-
import { Paginated, NormalizedPagination, ContentfulGqlLikePaginated, DynLikePaginated, GgLikePaginated, FormViolationListView
|
|
10
|
+
import { Paginated, FormViolationView, NormalizedPagination, ContentfulGqlLikePaginated, DynLikePaginated, GgLikePaginated, FormViolationListView } from '@ethlete/types';
|
|
11
|
+
import { PathKind, FieldContext, TreeValidationResult, SchemaPath, SchemaPathRules, FieldTree, ValidationError } from '@angular/forms/signals';
|
|
11
12
|
import * as _angular_forms from '@angular/forms';
|
|
12
13
|
import { FormControl, FormGroup } from '@angular/forms';
|
|
13
14
|
import { ToObservableOptions, ToSignalOptions } from '@angular/core/rxjs-interop';
|
|
@@ -66,7 +67,7 @@ declare function mapToPaginated<T>(response: Paginated<T>): rxjs.OperatorFunctio
|
|
|
66
67
|
/**
|
|
67
68
|
* Use an other store to represent a property of the current entity.
|
|
68
69
|
*/
|
|
69
|
-
declare const insertFrom: <OriginStoreType, OriginKeys extends keyof NonNullable<OriginStoreType>, SubStoreType extends NonNullable<OriginStoreType>[OriginKeys] extends Array<infer U> ? U : NonNullable<OriginStoreType>[OriginKeys], IdFn extends (value: NonNullable<OriginStoreType>) => EntityKey | EntityKey[], ComputedEntityType extends ReturnType<IdFn> extends Array<unknown> ? OriginStoreType : Omit<OriginStoreType, OriginKeys> & { [K in OriginKeys]: SubStoreType | null; }>(store: EntityStore<SubStoreType>, { for: key, id }: InsertFromConfig<OriginStoreType, OriginKeys, IdFn>) => rxjs.OperatorFunction<OriginStoreType, ComputedEntityType | null>;
|
|
70
|
+
declare const insertFrom: <OriginStoreType, OriginKeys extends keyof NonNullable<OriginStoreType>, SubStoreType extends (NonNullable<OriginStoreType>[OriginKeys] extends Array<infer U> ? U : NonNullable<OriginStoreType>[OriginKeys]), IdFn extends (value: NonNullable<OriginStoreType>) => EntityKey | EntityKey[], ComputedEntityType extends (ReturnType<IdFn> extends Array<unknown> ? OriginStoreType : Omit<OriginStoreType, OriginKeys> & { [K in OriginKeys]: SubStoreType | null; })>(store: EntityStore<SubStoreType>, { for: key, id }: InsertFromConfig<OriginStoreType, OriginKeys, IdFn>) => rxjs.OperatorFunction<OriginStoreType, ComputedEntityType | null>;
|
|
70
71
|
/**
|
|
71
72
|
* Remove entities from a store based on a where function.
|
|
72
73
|
*/
|
|
@@ -222,7 +223,7 @@ declare const serializeBody: (body: unknown) => ArrayBuffer | URLSearchParams |
|
|
|
222
223
|
declare const transformMethod: (config: {
|
|
223
224
|
method: Method;
|
|
224
225
|
transferVia?: "GET" | "POST";
|
|
225
|
-
}) => "GET" | "POST" | "
|
|
226
|
+
}) => "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE" | "CONNECT" | "PURGE" | "LINK" | "UNLINK" | "CUSTOM";
|
|
226
227
|
declare const detectContentTypeHeader: (body: unknown) => string | null;
|
|
227
228
|
declare const hasHeader: (headers: RequestHeaders, header: string) => boolean;
|
|
228
229
|
declare const forEachHeader: (headers: RequestHeaders, callback: (value: string, key: string) => void) => void;
|
|
@@ -544,6 +545,7 @@ declare class LegacyQuery<Response, Arguments extends BaseArguments | undefined,
|
|
|
544
545
|
newQuery: TNewQuery;
|
|
545
546
|
_arguments: RequestArgs<QueryArgsOf<TNewQuery>>;
|
|
546
547
|
entity?: QueryEntityConfig<Store, Data, Response, Arguments, Id> | undefined;
|
|
548
|
+
private _isDestroyed;
|
|
547
549
|
state$: Observable<V2QueryState<Data>>;
|
|
548
550
|
get rawState(): V2QueryState<any>;
|
|
549
551
|
get isExpired(): boolean | undefined;
|
|
@@ -553,7 +555,15 @@ declare class LegacyQuery<Response, Arguments extends BaseArguments | undefined,
|
|
|
553
555
|
get store(): null;
|
|
554
556
|
get canBeCached(): boolean;
|
|
555
557
|
get _isInMockMode(): boolean;
|
|
556
|
-
constructor(newQuery: TNewQuery, _arguments: RequestArgs<QueryArgsOf<TNewQuery>>, entity?: QueryEntityConfig<Store, Data, Response, Arguments, Id> | undefined
|
|
558
|
+
constructor(newQuery: TNewQuery, _arguments: RequestArgs<QueryArgsOf<TNewQuery>>, entity?: QueryEntityConfig<Store, Data, Response, Arguments, Id> | undefined,
|
|
559
|
+
/**
|
|
560
|
+
* Wraps an inert query — see `createInertQuery`. Skips everything that needs a live injector,
|
|
561
|
+
* so the wrapper is safe to build during teardown.
|
|
562
|
+
*
|
|
563
|
+
* @internal
|
|
564
|
+
*/
|
|
565
|
+
_isInert?: boolean);
|
|
566
|
+
private _teardown;
|
|
557
567
|
destroy(): void;
|
|
558
568
|
execute(options?: ExecuteQueryOptions): this;
|
|
559
569
|
abort(): this;
|
|
@@ -645,6 +655,12 @@ type CreateLegacyQueryCreatorOptions<TArgs extends QueryArgs, Response, Store ex
|
|
|
645
655
|
* Object containing the query's entity store information.
|
|
646
656
|
*/
|
|
647
657
|
entity?: QueryEntityConfig<Store, Data, Response, LegacyArgumentsOfQueryArgs<TArgs>, Id>;
|
|
658
|
+
/**
|
|
659
|
+
* The name this creator is exported under, used to name it in error messages. Emitted by the
|
|
660
|
+
* `migrate-to-query-v3` generator; worth passing by hand too, since without it a `prepare()`
|
|
661
|
+
* called outside an injection context can only be located by bisection.
|
|
662
|
+
*/
|
|
663
|
+
name?: string;
|
|
648
664
|
};
|
|
649
665
|
type WithLegacyConfig = {
|
|
650
666
|
/**
|
|
@@ -1046,7 +1062,10 @@ type QueryCollectionOf<T extends {
|
|
|
1046
1062
|
query: ConstructQuery<T[K]>;
|
|
1047
1063
|
};
|
|
1048
1064
|
}[keyof T];
|
|
1049
|
-
type AnyQueryCollection =
|
|
1065
|
+
type AnyQueryCollection = {
|
|
1066
|
+
type: string;
|
|
1067
|
+
query: AnyV2Query | AnyLegacyQuery;
|
|
1068
|
+
};
|
|
1050
1069
|
type QueryOf<T extends AnyQueryCollection | AnyLegacyQuery | AnyV2Query | null> = T extends AnyV2Query ? T : T extends AnyLegacyQuery ? T : T extends AnyQueryCollection ? T['query'] : never;
|
|
1051
1070
|
type AnyQueryCollectionResponse<T extends AnyQueryCollection> = QueryResponseOf<T['query']>;
|
|
1052
1071
|
type AnyQueryCollectionData<T extends AnyQueryCollection> = QueryDataOf<T['query']>;
|
|
@@ -1148,7 +1167,7 @@ declare const isQueryCollection: <T extends AnyQueryCollection>(query: unknown)
|
|
|
1148
1167
|
declare const createQueryCollection: <T extends AnyQueryCreatorCollection, R extends QueryCollectionOf<T>>(queryMap: T) => BehaviorSubject<R | null>;
|
|
1149
1168
|
declare const createQueryCollectionSubject: <T extends AnyQueryCreatorCollection, R extends QueryCollectionOf<T>>(queryMap: T, config?: QueryContainerConfig) => BehaviorSubject<R | null>;
|
|
1150
1169
|
declare const createQueryCollectionSignal: <T extends AnyQueryCreatorCollection, R extends QueryCollectionOf<T>>(queryMap: T, config?: QueryContainerConfig) => _angular_core.WritableSignal<R | null>;
|
|
1151
|
-
declare const extractQuery: <T extends AnyV2Query | AnyLegacyQuery | AnyQueryCollection | null>(v: T) =>
|
|
1170
|
+
declare const extractQuery: <T extends AnyV2Query | AnyLegacyQuery | AnyQueryCollection | null>(v: T) => AnyV2Query | AnyLegacyQuery | null;
|
|
1152
1171
|
declare const getDefaultHeaders: (headers: RequestHeaders | RequestHeadersMethodMap | null | undefined, method: Method) => RequestHeaders;
|
|
1153
1172
|
declare const castQueryCreatorTypes: <QC extends AnyV2QueryCreator, Arguments extends V2QueryArgsOf<QC>, Response extends QueryResponseOf<QC>, Store extends QueryStoreOf<QC>, Data extends QueryDataOf<QC>, Route extends V2RouteType<Arguments>, Id extends QueryStoreIdOf<QC>, OverrideArguments extends BaseArguments | undefined, OverrideResponse extends Response | undefined>(config: {
|
|
1154
1173
|
creator: QC;
|
|
@@ -1158,7 +1177,7 @@ declare const castQueryCreatorTypes: <QC extends AnyV2QueryCreator, Arguments ex
|
|
|
1158
1177
|
declare const computeQueryMethod: (config: {
|
|
1159
1178
|
config: AnyRestQueryConfig | AnyGqlQueryConfig;
|
|
1160
1179
|
client: V2QueryClient;
|
|
1161
|
-
}) => "GET" | "POST" | "
|
|
1180
|
+
}) => "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | "TRACE" | "CONNECT" | "PURGE" | "LINK" | "UNLINK" | "CUSTOM";
|
|
1162
1181
|
declare const computeQueryBody: (config: {
|
|
1163
1182
|
config: AnyRestQueryConfig | AnyGqlQueryConfig;
|
|
1164
1183
|
client: V2QueryClient;
|
|
@@ -1179,17 +1198,17 @@ declare const computeQueryQueryParams: (config: {
|
|
|
1179
1198
|
client: V2QueryClient;
|
|
1180
1199
|
args?: BaseArguments;
|
|
1181
1200
|
}) => object | undefined;
|
|
1182
|
-
declare const paginatedEntityValueUpdater: <T extends Paginated<unknown>, Args extends BaseArguments, Entity, J extends T extends Paginated<infer X> ? X : never>(findFn: (val: J, entity: Entity) => boolean) => ({ response, rawResponse, entity }: {
|
|
1201
|
+
declare const paginatedEntityValueUpdater: <T extends Paginated<unknown>, Args extends BaseArguments, Entity, J extends (T extends Paginated<infer X> ? X : never)>(findFn: (val: J, entity: Entity) => boolean) => ({ response, rawResponse, entity }: {
|
|
1183
1202
|
rawResponse: T;
|
|
1184
1203
|
response: T;
|
|
1185
1204
|
args: Args;
|
|
1186
1205
|
entity: Entity;
|
|
1187
1206
|
}) => {
|
|
1188
1207
|
response: T & {
|
|
1189
|
-
items:
|
|
1208
|
+
items: unknown[];
|
|
1190
1209
|
};
|
|
1191
1210
|
rawResponse: T & {
|
|
1192
|
-
items:
|
|
1211
|
+
items: unknown[];
|
|
1193
1212
|
};
|
|
1194
1213
|
} | null;
|
|
1195
1214
|
|
|
@@ -1297,7 +1316,7 @@ declare class V2QueryClient {
|
|
|
1297
1316
|
_updateBaseRoute: (route: string) => void;
|
|
1298
1317
|
}
|
|
1299
1318
|
|
|
1300
|
-
declare const v2ShouldCacheQuery: (method: Method) => method is "GET" | "
|
|
1319
|
+
declare const v2ShouldCacheQuery: (method: Method) => method is "GET" | "HEAD" | "OPTIONS" | "GQL_QUERY";
|
|
1301
1320
|
declare const v2BuildQueryCacheKey: (route: string, args: BaseArguments | undefined) => string;
|
|
1302
1321
|
|
|
1303
1322
|
declare class QueryStore {
|
|
@@ -1581,7 +1600,7 @@ declare class QueryDevtoolsComponent {
|
|
|
1581
1600
|
secure: boolean | undefined;
|
|
1582
1601
|
route: any;
|
|
1583
1602
|
reportProgress: boolean | undefined;
|
|
1584
|
-
responseType: "
|
|
1603
|
+
responseType: "arraybuffer" | "blob" | "json" | "text" | undefined;
|
|
1585
1604
|
withCredentials: boolean | undefined;
|
|
1586
1605
|
autoRefreshOn: _ethlete_query.QueryAutoRefreshConfig | undefined;
|
|
1587
1606
|
enableSmartPolling: boolean | undefined;
|
|
@@ -1591,7 +1610,7 @@ declare class QueryDevtoolsComponent {
|
|
|
1591
1610
|
secure: boolean | undefined;
|
|
1592
1611
|
route: any;
|
|
1593
1612
|
reportProgress: boolean | undefined;
|
|
1594
|
-
responseType: "
|
|
1613
|
+
responseType: "arraybuffer" | "blob" | "json" | "text" | undefined;
|
|
1595
1614
|
withCredentials: boolean | undefined;
|
|
1596
1615
|
autoRefreshOn: _ethlete_query.QueryAutoRefreshConfig | undefined;
|
|
1597
1616
|
enableSmartPolling: boolean | undefined;
|
|
@@ -1879,7 +1898,7 @@ declare class InfinityQueryDirective<Q extends InfinityQueryConfig<DirectiveQuer
|
|
|
1879
1898
|
get instance(): InfinityQueryOf<Q> | null;
|
|
1880
1899
|
get data$(): rxjs.Observable<Q["response"]["arrayType"]>;
|
|
1881
1900
|
data: _angular_core.Signal<Q["response"]["arrayType"]>;
|
|
1882
|
-
static ngTemplateContextGuard<Q extends InfinityQueryConfig<DirectiveQueryCreator, BaseArguments | undefined, any, unknown[]>>(
|
|
1901
|
+
static ngTemplateContextGuard<Q extends InfinityQueryConfig<DirectiveQueryCreator, BaseArguments | undefined, any, unknown[]>>(_dir: InfinityQueryDirective<Q>, _ctx: unknown): _ctx is InfinityQueryContext<Q>;
|
|
1883
1902
|
constructor();
|
|
1884
1903
|
private _setupInfinityQuery;
|
|
1885
1904
|
loadNextPage(): void;
|
|
@@ -1947,7 +1966,7 @@ declare class QueryDirective<Q extends QueryDirectiveType | null> {
|
|
|
1947
1966
|
query: _angular_core.InputSignal<Q>;
|
|
1948
1967
|
cache: _angular_core.InputSignal<boolean>;
|
|
1949
1968
|
queryState: _angular_core.WritableSignal<_ethlete_query.V2QueryState<QueryDataOf<QueryOf<Q>>> | null>;
|
|
1950
|
-
static ngTemplateContextGuard<Q extends QueryDirectiveType | null>(
|
|
1969
|
+
static ngTemplateContextGuard<Q extends QueryDirectiveType | null>(_dir: QueryDirective<Q>, _ctx: unknown): _ctx is QueryDirectiveContext<Q>;
|
|
1951
1970
|
constructor();
|
|
1952
1971
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<QueryDirective<any>, never>;
|
|
1953
1972
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<QueryDirective<any>, "[etQuery]", never, { "query": { "alias": "etQuery"; "required": true; "isSignal": true; }; "cache": { "alias": "etQueryCache"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
@@ -1966,6 +1985,60 @@ declare const queryStateDoesNotContainKeyError: (data: unknown) => QueryError;
|
|
|
1966
1985
|
declare const queryStateCannotTransformError: (data: unknown) => QueryError;
|
|
1967
1986
|
declare const invalidBodyError: (data: unknown) => QueryError;
|
|
1968
1987
|
|
|
1988
|
+
/** The args accepted by the creator's `prepare()` — includes `mock`/`config` extras. */
|
|
1989
|
+
type V2PrepareArgsOf<TCreator extends AnyV2QueryCreator | AnyLegacyQueryCreator> = Parameters<TCreator['prepare']>[0];
|
|
1990
|
+
/** Config for {@link validateWithV2Query}. */
|
|
1991
|
+
type ValidateWithV2QueryConfig<TCreator extends AnyV2QueryCreator | AnyLegacyQueryCreator, TValue, TPathKind extends PathKind> = {
|
|
1992
|
+
/**
|
|
1993
|
+
* The legacy query creator to run (from `V2QueryClient`'s `post`/`get`, or a
|
|
1994
|
+
* `createLegacyQueryCreator` interop wrapper). A fresh query is prepared and executed for each
|
|
1995
|
+
* validate request. Running it through the client is the point: auth, base route, caching and
|
|
1996
|
+
* error normalization all apply, unlike a raw `httpResource`.
|
|
1997
|
+
*/
|
|
1998
|
+
queryCreator: TCreator;
|
|
1999
|
+
/**
|
|
2000
|
+
* Builds the `prepare()` args from the field context. Runs reactively on the field value
|
|
2001
|
+
* (debounced), exactly like `validateAsync`'s `params` — e.g.
|
|
2002
|
+
* `(ctx) => ({ pathParams: { id }, body: { ...ctx.value() } })`.
|
|
2003
|
+
*/
|
|
2004
|
+
args: (ctx: FieldContext<TValue, TPathKind>) => V2PrepareArgsOf<TCreator>;
|
|
2005
|
+
/** Debounce before the request runs, in ms. @default 300 */
|
|
2006
|
+
debounce?: number;
|
|
2007
|
+
/** Gate the validation — return `false` to skip the request (e.g. an empty or invalid value). */
|
|
2008
|
+
when?: (ctx: FieldContext<TValue, TPathKind>) => boolean;
|
|
2009
|
+
/**
|
|
2010
|
+
* Override the default violation → error mapping. Receives the violations extracted from the
|
|
2011
|
+
* failed request; return the errors to report (targeting child fields via their `fieldTree`).
|
|
2012
|
+
* Defaults to `mapViolationsToFormErrors`, resolving each violation's `propertyPath` against the
|
|
2013
|
+
* validated field.
|
|
2014
|
+
*/
|
|
2015
|
+
mapViolations?: (violations: FormViolationView[], ctx: FieldContext<TValue, TPathKind>) => TreeValidationResult;
|
|
2016
|
+
};
|
|
2017
|
+
/**
|
|
2018
|
+
* Binds a query-backed async validator to a signal-forms field, adapting a **legacy v2**
|
|
2019
|
+
* `@ethlete/query` query into what `validateAsync` consumes — the `V2QueryClient` counterpart of
|
|
2020
|
+
* {@link validateWithQuery}, so apps that haven't migrated yet can still validate against the
|
|
2021
|
+
* server. The query runs through the client (bearer auth, base route, caching, Symfony error
|
|
2022
|
+
* normalization), where a raw `httpResource` would fire unauthenticated and bypass the pipeline.
|
|
2023
|
+
*
|
|
2024
|
+
* The query is prepared and executed (debounced) as the field value changes, only after the
|
|
2025
|
+
* field's synchronous validators pass. A `204` / successful response reports no errors; a
|
|
2026
|
+
* `422 FormViolationListView` maps each violation onto its child field by `propertyPath`; a
|
|
2027
|
+
* network / other error degrades to a non-swallowed form-level error.
|
|
2028
|
+
*
|
|
2029
|
+
* Call it from a schema definition, the same place you'd call `validateAsync`:
|
|
2030
|
+
*
|
|
2031
|
+
* ```ts
|
|
2032
|
+
* const schema = schema<OpportunityEmail>((p) => {
|
|
2033
|
+
* validateWithV2Query(p, {
|
|
2034
|
+
* queryCreator: postOpportunityEmailValidate, // hubApiClient.post({ ... })
|
|
2035
|
+
* args: (ctx) => ({ pathParams: { opportunityId }, body: { ...ctx.value() } }),
|
|
2036
|
+
* });
|
|
2037
|
+
* });
|
|
2038
|
+
* ```
|
|
2039
|
+
*/
|
|
2040
|
+
declare const validateWithV2Query: <TCreator extends AnyV2QueryCreator | AnyLegacyQueryCreator, TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, config: ValidateWithV2QueryConfig<TCreator, TValue, TPathKind>) => void;
|
|
2041
|
+
|
|
1969
2042
|
type SetupQueryDependenciesOptions = {
|
|
1970
2043
|
/** The query client tuple from createQueryClient */
|
|
1971
2044
|
client: AnyCreateQueryClientResult;
|
|
@@ -1981,12 +2054,16 @@ type QueryDependencies = {
|
|
|
1981
2054
|
client: QueryClient;
|
|
1982
2055
|
/** The injector of the query */
|
|
1983
2056
|
injector: EnvironmentInjector;
|
|
1984
|
-
/** The effect scheduler */
|
|
1985
|
-
effectScheduler: _EffectScheduler;
|
|
1986
2057
|
/** The error handler */
|
|
1987
2058
|
ngErrorHandler: ErrorHandler;
|
|
1988
2059
|
/** The http client */
|
|
1989
2060
|
httpClient: HttpClient;
|
|
2061
|
+
/**
|
|
2062
|
+
* The DOM element of the component/directive that created the query, when it was created in an
|
|
2063
|
+
* element (node) injection context. `null` for queries created in a root/environment context.
|
|
2064
|
+
* Used only by the devtools "inspect" tool.
|
|
2065
|
+
*/
|
|
2066
|
+
hostElement: HTMLElement | null;
|
|
1990
2067
|
};
|
|
1991
2068
|
declare const setupQueryDependencies: (options: SetupQueryDependenciesOptions) => QueryDependencies;
|
|
1992
2069
|
|
|
@@ -2019,6 +2096,28 @@ type QueryErrorResponse = {
|
|
|
2019
2096
|
type QueryErrorResponseItem = {
|
|
2020
2097
|
message: string;
|
|
2021
2098
|
};
|
|
2099
|
+
declare const isQueryErrorResponse: (error: unknown) => error is QueryErrorResponse;
|
|
2100
|
+
/**
|
|
2101
|
+
* Every message carried by an error, flattened into a plain list — one entry for a single error,
|
|
2102
|
+
* one per violation for a list (a form response with several field violations), empty for `null`.
|
|
2103
|
+
*
|
|
2104
|
+
* The single/list split exists because that is how APIs answer; UI almost never wants to branch on
|
|
2105
|
+
* it. Reach for this when rendering, and keep {@link QueryErrorResponse} for anything that needs
|
|
2106
|
+
* the status code or the raw response.
|
|
2107
|
+
*
|
|
2108
|
+
* @example
|
|
2109
|
+
* ```html
|
|
2110
|
+
* @for (message of queryErrorMessages(myQuery.error()); track message) {
|
|
2111
|
+
* <p class="error">{{ message }}</p>
|
|
2112
|
+
* }
|
|
2113
|
+
* ```
|
|
2114
|
+
*/
|
|
2115
|
+
declare const queryErrorMessages: (error: QueryErrorResponse | null | undefined) => string[];
|
|
2116
|
+
/**
|
|
2117
|
+
* The first message of an error, or `null` when there is none — the single-line counterpart to
|
|
2118
|
+
* {@link queryErrorMessages}, for a toast or a form-field hint.
|
|
2119
|
+
*/
|
|
2120
|
+
declare const queryErrorMessage: (error: QueryErrorResponse | null | undefined) => string | null;
|
|
2022
2121
|
declare const createQueryErrorResponse: (error: unknown) => QueryErrorResponse;
|
|
2023
2122
|
|
|
2024
2123
|
type ResetExecuteStateOptions<TArgs extends QueryArgs> = {
|
|
@@ -2052,6 +2151,18 @@ type SetupQueryStateOptions<TArgs extends QueryArgs> = {
|
|
|
2052
2151
|
type QueryStateSubtle<TArgs extends QueryArgs> = {
|
|
2053
2152
|
request: WritableSignal<HttpRequest<TArgs> | null>;
|
|
2054
2153
|
rawResponse: WritableSignal<RawResponseType<TArgs> | null>;
|
|
2154
|
+
/**
|
|
2155
|
+
* Forwards the given request's discrete event stream onto the query-level `events$`.
|
|
2156
|
+
* Called by `queryExecute` whenever a request is (re-)executed.
|
|
2157
|
+
*/
|
|
2158
|
+
bindRequestEvents: (request: HttpRequest<TArgs>) => void;
|
|
2159
|
+
/**
|
|
2160
|
+
* Installs the reactive source that backs `state.args`. The `withArgs` feature uses this so that
|
|
2161
|
+
* `state.args` always reflects the latest args (pulled from the reactive source on read) instead
|
|
2162
|
+
* of being push-updated by an effect that may not have run yet. Without a `withArgs` feature the
|
|
2163
|
+
* default source returns `null`.
|
|
2164
|
+
*/
|
|
2165
|
+
setArgsSource: (source: () => RequestArgs<TArgs> | null) => void;
|
|
2055
2166
|
};
|
|
2056
2167
|
type QueryState<TArgs extends QueryArgs> = {
|
|
2057
2168
|
rawResponse: WritableSignal<RawResponseType<TArgs> | null>;
|
|
@@ -2063,6 +2174,14 @@ type QueryState<TArgs extends QueryArgs> = {
|
|
|
2063
2174
|
lastTimeExecutedAt: WritableSignal<number | null>;
|
|
2064
2175
|
lastTriggeredBy: WritableSignal<string | null>;
|
|
2065
2176
|
executionState: Signal<QueryExecutionState<TArgs> | null>;
|
|
2177
|
+
/**
|
|
2178
|
+
* A discrete, query-level stream of every request event, fed synchronously from the current
|
|
2179
|
+
* request's `events$` at the moment each event occurs. Side-effect features
|
|
2180
|
+
* (success/error/logging) subscribe to this instead of edge-detecting on the shared, resettable
|
|
2181
|
+
* `response`/`error`/`latestHttpEvent` signals — so they cannot miss a transition when the next
|
|
2182
|
+
* execution swaps the underlying request.
|
|
2183
|
+
*/
|
|
2184
|
+
events$: Observable<RequestHttpEvent<TArgs>>;
|
|
2066
2185
|
subtle: QueryStateSubtle<TArgs>;
|
|
2067
2186
|
};
|
|
2068
2187
|
type QueryExecutionStateSuccess<TArgs extends QueryArgs> = {
|
|
@@ -2132,6 +2251,7 @@ declare const QueryFeatureType: {
|
|
|
2132
2251
|
readonly WITH_POLLING: "WITH_POLLING";
|
|
2133
2252
|
readonly WITH_AUTO_REFRESH: "WITH_AUTO_REFRESH";
|
|
2134
2253
|
readonly WITH_RESPONSE_UPDATE: "WITH_RESPONSE_UPDATE";
|
|
2254
|
+
readonly WITH_PAGE_RESET_ON_ERROR: "WITH_PAGE_RESET_ON_ERROR";
|
|
2135
2255
|
};
|
|
2136
2256
|
type QueryFeatureType = (typeof QueryFeatureType)[keyof typeof QueryFeatureType];
|
|
2137
2257
|
type QueryFeatureContext<TArgs extends QueryArgs> = {
|
|
@@ -2241,6 +2361,60 @@ type WithResponseUpdateFeatureOptions<TArgs extends QueryArgs> = {
|
|
|
2241
2361
|
updater: (data: WithResponseUpdateFeatureFnData<TArgs>) => ResponseType<TArgs> | null;
|
|
2242
2362
|
};
|
|
2243
2363
|
declare const withResponseUpdate: <TArgs extends QueryArgs>(options: WithResponseUpdateFeatureOptions<TArgs>) => QueryFeature<TArgs>;
|
|
2364
|
+
/**
|
|
2365
|
+
* Whether an error means the requested page is out of range: HTTP `416`, or a
|
|
2366
|
+
* `500` carrying a Symfony/Pagerfanta out-of-range detail (the dev-mode shape).
|
|
2367
|
+
* Exported so it can also be used as the predicate of a `withErrorHandling` handler.
|
|
2368
|
+
*/
|
|
2369
|
+
declare const isPageOutOfRangeError: (error: QueryErrorResponse) => boolean;
|
|
2370
|
+
type WithPageResetOnErrorFeatureOptions = {
|
|
2371
|
+
/**
|
|
2372
|
+
* Which errors trigger the reset.
|
|
2373
|
+
* @default isPageOutOfRangeError (HTTP 416, or a dev-mode 500 Pagerfanta out-of-range error)
|
|
2374
|
+
*/
|
|
2375
|
+
when?: (error: QueryErrorResponse) => boolean;
|
|
2376
|
+
} & ({
|
|
2377
|
+
/** The writable page signal to reset. */
|
|
2378
|
+
page: WritableSignal<number>;
|
|
2379
|
+
/**
|
|
2380
|
+
* The value to reset the page to.
|
|
2381
|
+
* @default 1
|
|
2382
|
+
*/
|
|
2383
|
+
resetTo?: number;
|
|
2384
|
+
reset?: never;
|
|
2385
|
+
} | {
|
|
2386
|
+
/**
|
|
2387
|
+
* Called when a matching error occurs. Reset whatever drives the page here —
|
|
2388
|
+
* a signal (`() => page.set(1)`) or a query form (`() => qf.resetFieldToDefault('page')`).
|
|
2389
|
+
*/
|
|
2390
|
+
reset: () => void;
|
|
2391
|
+
page?: never;
|
|
2392
|
+
resetTo?: never;
|
|
2393
|
+
});
|
|
2394
|
+
/**
|
|
2395
|
+
* A query feature that resets the page when the current page becomes out of range
|
|
2396
|
+
* — e.g. after a filter shrinks the result set below the current page. It reacts
|
|
2397
|
+
* to the query's error events and resets the page source; the normal reactive
|
|
2398
|
+
* re-execution then runs with the corrected page.
|
|
2399
|
+
*
|
|
2400
|
+
* Because query args are reactively sourced, this fixes the *source* (a signal or
|
|
2401
|
+
* query form field) rather than patching args directly — so the change sticks.
|
|
2402
|
+
*
|
|
2403
|
+
* @example
|
|
2404
|
+
* // signal-driven page
|
|
2405
|
+
* const users = getUsers(
|
|
2406
|
+
* withArgs(() => ({ queryParams: { page: page() } })),
|
|
2407
|
+
* withPageResetOnError({ page }),
|
|
2408
|
+
* );
|
|
2409
|
+
*
|
|
2410
|
+
* @example
|
|
2411
|
+
* // query-form-driven page
|
|
2412
|
+
* const users = getUsers(
|
|
2413
|
+
* withArgs(() => ({ queryParams: qf.value() })),
|
|
2414
|
+
* withPageResetOnError({ reset: () => qf.resetFieldToDefault('page') }),
|
|
2415
|
+
* );
|
|
2416
|
+
*/
|
|
2417
|
+
declare const withPageResetOnError: <TArgs extends QueryArgs>(options: WithPageResetOnErrorFeatureOptions) => QueryFeature<TArgs>;
|
|
2244
2418
|
|
|
2245
2419
|
type RouteType<TArgs extends QueryArgs> = PathParamsType<TArgs> extends {
|
|
2246
2420
|
[key: string]: unknown;
|
|
@@ -2296,6 +2470,14 @@ type BaseQueryCreatorOptions<TArgs extends QueryArgs = QueryArgs> = {
|
|
|
2296
2470
|
* @default Client's retryFn or shouldRetryRequest()
|
|
2297
2471
|
*/
|
|
2298
2472
|
retryFn?: ShouldRetryRequestFn;
|
|
2473
|
+
/**
|
|
2474
|
+
* How long (in ms) this query's cache entry is kept after its last consumer was destroyed.
|
|
2475
|
+
* Overrides the client level `keepUnusedFor`. Use `0` for responses that should never outlive their
|
|
2476
|
+
* consumer (very large payloads, or data that must not be shown stale).
|
|
2477
|
+
*
|
|
2478
|
+
* @default Client's keepUnusedFor (5 minutes)
|
|
2479
|
+
*/
|
|
2480
|
+
keepUnusedFor?: number;
|
|
2299
2481
|
/** Advanced query creator features. **WARNING!** Incorrectly using these features will likely **BREAK** your application. You have been warned! */
|
|
2300
2482
|
subtle?: BaseQueryCreatorOptionsSubtle;
|
|
2301
2483
|
};
|
|
@@ -2391,6 +2573,13 @@ type QueryRepositoryEvent = {
|
|
|
2391
2573
|
key: QueryKey;
|
|
2392
2574
|
isSecure: boolean;
|
|
2393
2575
|
request: HttpRequest<QueryArgs>;
|
|
2576
|
+
} | {
|
|
2577
|
+
/**
|
|
2578
|
+
* Every secure entry was torn down at once — a logout. Emitted after the cache is cleared so
|
|
2579
|
+
* secure queries can drop the state they hold themselves; the repository only owns the
|
|
2580
|
+
* requests, not the `response` signal of the query objects bound to them.
|
|
2581
|
+
*/
|
|
2582
|
+
type: 'unbind-all-secure';
|
|
2394
2583
|
};
|
|
2395
2584
|
type QueryRepositoryRequestOptions<TArgs extends QueryArgs> = {
|
|
2396
2585
|
/**
|
|
@@ -2424,6 +2613,42 @@ type QueryRepositoryItem<TArgs extends QueryArgs> = {
|
|
|
2424
2613
|
/** The request object */
|
|
2425
2614
|
request: HttpRequest<TArgs>;
|
|
2426
2615
|
};
|
|
2616
|
+
/**
|
|
2617
|
+
* A read-only snapshot of a single cache entry, exposed via {@link QueryRepositorySubtle.cacheEntries}
|
|
2618
|
+
* for devtools inspection. The raw cache `Map` is never exposed.
|
|
2619
|
+
*/
|
|
2620
|
+
type QueryRepositoryCacheEntry = {
|
|
2621
|
+
/** The cache key of the entry. */
|
|
2622
|
+
key: QueryKey;
|
|
2623
|
+
/** Whether the entry belongs to a secure (authenticated) request. */
|
|
2624
|
+
isSecure: boolean;
|
|
2625
|
+
/** How many consumers currently hold a binding to the entry. */
|
|
2626
|
+
consumerCount: number;
|
|
2627
|
+
/**
|
|
2628
|
+
* Whether the entry has no consumers left and is only being kept around for its
|
|
2629
|
+
* `keepUnusedFor` window. Such an entry is not a leak — it is waiting to be reused by a
|
|
2630
|
+
* consumer that comes back.
|
|
2631
|
+
*/
|
|
2632
|
+
isUnused: boolean;
|
|
2633
|
+
/** The underlying HTTP request. */
|
|
2634
|
+
request: HttpRequest<QueryArgs>;
|
|
2635
|
+
};
|
|
2636
|
+
/**
|
|
2637
|
+
* Advanced repository internals used by the query devtools. **Not part of the general public
|
|
2638
|
+
* contract** — do not build application logic on top of these.
|
|
2639
|
+
*/
|
|
2640
|
+
type QueryRepositorySubtle = {
|
|
2641
|
+
/** Returns a read-only snapshot of every entry currently held in the cache. */
|
|
2642
|
+
cacheEntries: () => QueryRepositoryCacheEntry[];
|
|
2643
|
+
/** A version counter bumped whenever the cache changes (bind / unbind / unbindAllSecure). */
|
|
2644
|
+
cacheVersion: Signal<number>;
|
|
2645
|
+
/**
|
|
2646
|
+
* Destroys and removes a single cache entry by key, regardless of its consumers. Intended for
|
|
2647
|
+
* devtools cache management — consumers still holding the query will get a fresh request on their
|
|
2648
|
+
* next execution.
|
|
2649
|
+
*/
|
|
2650
|
+
evict: (key: QueryKey) => void;
|
|
2651
|
+
};
|
|
2427
2652
|
/**
|
|
2428
2653
|
* The query repository is responsible for managing all requests and their consumers.
|
|
2429
2654
|
* It will cache requests if they can be cached and reuse them if they are already cached.
|
|
@@ -2436,8 +2661,18 @@ type QueryRepository = {
|
|
|
2436
2661
|
unbind: (key: QueryKey | null, consumerDestroyRef: DestroyRef) => boolean;
|
|
2437
2662
|
/** Removes all secure requests and their consumers */
|
|
2438
2663
|
unbindAllSecure: () => void;
|
|
2664
|
+
/**
|
|
2665
|
+
* Re-executes every cacheable entry that still has consumers, bypassing the cache and restarting
|
|
2666
|
+
* in-flight requests. Entries kept only for their `keepUnusedFor` window are skipped — nobody is
|
|
2667
|
+
* looking at them, and they revalidate on their own when a consumer binds again.
|
|
2668
|
+
*
|
|
2669
|
+
* @see QueryClient.refreshQueriesInUse
|
|
2670
|
+
*/
|
|
2671
|
+
refreshInUse: () => void;
|
|
2439
2672
|
/** Observable stream of repository events (errors, successes, etc.) */
|
|
2440
2673
|
events$: Observable<QueryRepositoryEvent>;
|
|
2674
|
+
/** Advanced repository internals used by the query devtools. */
|
|
2675
|
+
subtle: QueryRepositorySubtle;
|
|
2441
2676
|
};
|
|
2442
2677
|
/** The key of a query (either a cache key for cacheable requests or a UUID for uncacheable requests) */
|
|
2443
2678
|
type QueryKey = string;
|
|
@@ -2454,7 +2689,22 @@ type QueryRepositoryDependencies = {
|
|
|
2454
2689
|
type CreateQueryRepositoryConfig = CreateQueryClientConfigOptions & {
|
|
2455
2690
|
/** The dependencies of the query repository */
|
|
2456
2691
|
dependencies: QueryRepositoryDependencies;
|
|
2692
|
+
/**
|
|
2693
|
+
* Whether unused entries may be retained at all. `false` forces `keepUnusedFor` to `0` everywhere,
|
|
2694
|
+
* regardless of client or creator configuration — used to disable retention on the server, where a
|
|
2695
|
+
* per-request injector must not hold response bodies (and a pending timer) for minutes.
|
|
2696
|
+
* @default true
|
|
2697
|
+
*/
|
|
2698
|
+
retentionEnabled?: boolean;
|
|
2457
2699
|
};
|
|
2700
|
+
/** @see CreateQueryClientConfigOptions.keepUnusedFor */
|
|
2701
|
+
declare const DEFAULT_KEEP_UNUSED_FOR = 300000;
|
|
2702
|
+
/**
|
|
2703
|
+
* Hard cap on entries kept without consumers, per client. Retention is opportunistic, so a runaway
|
|
2704
|
+
* count (a search-as-you-type query produces a new cache key per keystroke, and each one goes through
|
|
2705
|
+
* `unbind`) must never grow unbounded — the least recently orphaned entries are dropped first.
|
|
2706
|
+
*/
|
|
2707
|
+
declare const MAX_UNUSED_ENTRIES = 50;
|
|
2458
2708
|
declare const createQueryRepository: (config: CreateQueryRepositoryConfig) => QueryRepository;
|
|
2459
2709
|
|
|
2460
2710
|
type CacheAdapterFn = (headers: HttpHeaders) => number | null;
|
|
@@ -2466,6 +2716,32 @@ type CreateQueryClientConfigOptions = {
|
|
|
2466
2716
|
baseUrl: string;
|
|
2467
2717
|
/** Configuration for building query strings */
|
|
2468
2718
|
queryString?: BuildQueryStringConfig;
|
|
2719
|
+
/**
|
|
2720
|
+
* Headers sent with every request of this client — an API token, a tenant id, a preview
|
|
2721
|
+
* credential. Per-query `args.headers` are merged on top and win per header name.
|
|
2722
|
+
*
|
|
2723
|
+
* Pass a function to make them dynamic: it is called on every execution, so reading a signal
|
|
2724
|
+
* inside means later requests pick the new value up on their own.
|
|
2725
|
+
*
|
|
2726
|
+
* Client headers are deliberately **not** part of the cache key: they are the same for every
|
|
2727
|
+
* query of the client, so including them would only ever churn the whole cache at once. That
|
|
2728
|
+
* means already-resolved queries keep their response when the headers change — call
|
|
2729
|
+
* {@link QueryClient.refreshQueriesInUse} to re-run them (the v3 equivalent of v2's
|
|
2730
|
+
* `setDefaultHeaders({ refreshQueriesInUse: true })`).
|
|
2731
|
+
*
|
|
2732
|
+
* @example
|
|
2733
|
+
* const previewToken = signal<string | null>(null);
|
|
2734
|
+
*
|
|
2735
|
+
* export const [provideMyClient, injectMyClient] = createQueryClient({
|
|
2736
|
+
* name: 'my-api',
|
|
2737
|
+
* baseUrl: 'https://api.example.com',
|
|
2738
|
+
* headers: () => {
|
|
2739
|
+
* const token = previewToken();
|
|
2740
|
+
* return token ? new HttpHeaders({ 'X-Preview-Token': token }) : new HttpHeaders();
|
|
2741
|
+
* },
|
|
2742
|
+
* });
|
|
2743
|
+
*/
|
|
2744
|
+
headers?: HttpHeaders | (() => HttpHeaders);
|
|
2469
2745
|
/** The name of the client */
|
|
2470
2746
|
name: string;
|
|
2471
2747
|
/**
|
|
@@ -2482,9 +2758,42 @@ type CreateQueryClientConfigOptions = {
|
|
|
2482
2758
|
* @default shouldRetryRequest()
|
|
2483
2759
|
*/
|
|
2484
2760
|
retryFn?: ShouldRetryRequestFn;
|
|
2761
|
+
/**
|
|
2762
|
+
* How long (in ms) a cache entry is kept after its last consumer was destroyed.
|
|
2763
|
+
*
|
|
2764
|
+
* Within that window a query that mounts again — a list page reached via browser back navigation,
|
|
2765
|
+
* for instance — binds to the existing entry and renders its previous response immediately while it
|
|
2766
|
+
* revalidates in the background, instead of starting from a loading state. Unlike the header derived
|
|
2767
|
+
* freshness TTL (`cacheAdapter`) this is independent of `cache-control`, so it also applies to
|
|
2768
|
+
* private/authenticated responses.
|
|
2769
|
+
*
|
|
2770
|
+
* Set to `0` to destroy entries as soon as their last consumer goes away. Only entries that
|
|
2771
|
+
* actually hold a response are retained, and at most 50 unused entries are kept per client
|
|
2772
|
+
* (least recently orphaned dropped first). Always `0` on the server.
|
|
2773
|
+
*
|
|
2774
|
+
* Can be overridden per query creator.
|
|
2775
|
+
*
|
|
2776
|
+
* @default 300000 (5 minutes)
|
|
2777
|
+
*/
|
|
2778
|
+
keepUnusedFor?: number;
|
|
2485
2779
|
};
|
|
2486
2780
|
type QueryClient = {
|
|
2487
2781
|
repository: QueryRepository;
|
|
2782
|
+
/** The base URL the client was configured with. */
|
|
2783
|
+
baseUrl: string;
|
|
2784
|
+
/**
|
|
2785
|
+
* Re-executes every cacheable request this client currently has consumers for, bypassing the
|
|
2786
|
+
* cache and restarting the ones still in flight.
|
|
2787
|
+
*
|
|
2788
|
+
* The case this exists for is a change to something every request carries but nothing tracks —
|
|
2789
|
+
* typically a client-level header (see {@link CreateQueryClientConfigOptions.headers}). Setting
|
|
2790
|
+
* the new value only affects *subsequent* requests, so anything already resolved keeps data
|
|
2791
|
+
* fetched under the old one until this is called.
|
|
2792
|
+
*
|
|
2793
|
+
* Only GET / HEAD / OPTIONS requests are refreshed: re-firing a mutation nobody asked for would
|
|
2794
|
+
* be a far worse surprise than a stale read.
|
|
2795
|
+
*/
|
|
2796
|
+
refreshQueriesInUse: () => void;
|
|
2488
2797
|
};
|
|
2489
2798
|
type QueryClientRef = ProviderResult<QueryClient>;
|
|
2490
2799
|
type AnyCreateQueryClientResult = QueryClientRef;
|
|
@@ -2516,6 +2825,13 @@ type CreateHttpRequestOptions<TArgs extends QueryArgs> = {
|
|
|
2516
2825
|
dependencies: QueryRepositoryDependencies;
|
|
2517
2826
|
/** The client options of the request */
|
|
2518
2827
|
clientOptions?: CreateQueryCreatorOptions;
|
|
2828
|
+
/**
|
|
2829
|
+
* Headers configured on the query client, applied to every request it makes. Per-request
|
|
2830
|
+
* `args.headers` are merged on top and win per header name.
|
|
2831
|
+
*
|
|
2832
|
+
* @see CreateQueryClientConfigOptions.headers
|
|
2833
|
+
*/
|
|
2834
|
+
clientHeaders?: HttpHeaders | (() => HttpHeaders);
|
|
2519
2835
|
/**
|
|
2520
2836
|
* The cache adapter function to use for the request
|
|
2521
2837
|
* @default extractExpiresInSeconds()
|
|
@@ -2546,9 +2862,20 @@ type HttpRequestLoadingProgressState = {
|
|
|
2546
2862
|
remainingTime: number | null;
|
|
2547
2863
|
};
|
|
2548
2864
|
type HttpRequest<TArgs extends QueryArgs> = {
|
|
2549
|
-
/**
|
|
2865
|
+
/** The HTTP method of the request. */
|
|
2866
|
+
method: QueryMethod;
|
|
2867
|
+
/** The full URL of the request (base + path + query params). */
|
|
2868
|
+
url: string;
|
|
2869
|
+
/**
|
|
2870
|
+
* Executes the request.
|
|
2871
|
+
*
|
|
2872
|
+
* `force` runs it even when one is already in flight (the in-flight one is cancelled) or the
|
|
2873
|
+
* cached response is still fresh — used by `refreshQueriesInUse` after something outside the
|
|
2874
|
+
* request changed, such as a client-level header.
|
|
2875
|
+
*/
|
|
2550
2876
|
execute: (options?: {
|
|
2551
2877
|
allowCache?: boolean;
|
|
2878
|
+
force?: boolean;
|
|
2552
2879
|
}) => boolean;
|
|
2553
2880
|
/** Destroys the request (cancels it if in progress) */
|
|
2554
2881
|
destroy: () => boolean;
|
|
@@ -2560,8 +2887,25 @@ type HttpRequest<TArgs extends QueryArgs> = {
|
|
|
2560
2887
|
response: Signal<ResponseType<TArgs> | null>;
|
|
2561
2888
|
/** The current event of the request */
|
|
2562
2889
|
currentEvent: Signal<RequestHttpEvent<TArgs> | null>;
|
|
2563
|
-
/**
|
|
2564
|
-
|
|
2890
|
+
/**
|
|
2891
|
+
* A discrete stream of every event of this request, emitted synchronously at the moment the
|
|
2892
|
+
* event is processed (including the terminal Response / error event). Unlike the `currentEvent`
|
|
2893
|
+
* signal, this never coalesces or gets reset, so consumers cannot miss a transition. Completes
|
|
2894
|
+
* when the request is destroyed.
|
|
2895
|
+
*/
|
|
2896
|
+
events$: Observable<RequestHttpEvent<TArgs>>;
|
|
2897
|
+
/**
|
|
2898
|
+
* Whether the request is stale or not aka the cache header has expired.
|
|
2899
|
+
*
|
|
2900
|
+
* This is a plain getter function (evaluated on each call), not a reactive signal, because
|
|
2901
|
+
* staleness depends on wall-clock time rather than on any tracked signal.
|
|
2902
|
+
*/
|
|
2903
|
+
isStale: () => boolean;
|
|
2904
|
+
/**
|
|
2905
|
+
* The timestamp (ms) at which the cached response goes stale, or `null` when the request is not
|
|
2906
|
+
* cacheable / has no freshness window. Exposed for devtools freshness countdowns.
|
|
2907
|
+
*/
|
|
2908
|
+
expiresAt: Signal<number | null>;
|
|
2565
2909
|
};
|
|
2566
2910
|
/** A custom error event since the Angular http client does not provide a specific event for errors */
|
|
2567
2911
|
type HttpErrorEvent = {
|
|
@@ -2599,6 +2943,19 @@ type PathParamsType<T extends QueryArgs | null> = T extends QueryArgs ? T['pathP
|
|
|
2599
2943
|
type QueryParamsType<T extends QueryArgs | null> = T extends QueryArgs ? T['queryParams'] : never;
|
|
2600
2944
|
type BodyType<T extends QueryArgs | null> = T extends QueryArgs ? T['body'] : never;
|
|
2601
2945
|
type RequestArgs<T extends QueryArgs | null> = T extends QueryArgs ? Omit<T, 'response'> : never;
|
|
2946
|
+
/**
|
|
2947
|
+
* The empty request-args object, typed to satisfy `RequestArgs<TArgs>` for a query that takes no
|
|
2948
|
+
* arguments — its `QueryArgs` is just `{ response: T }`, so `RequestArgs` resolves to `{}`.
|
|
2949
|
+
*
|
|
2950
|
+
* Only needed in generic code, where `TArgs` is still a type parameter and TS therefore cannot see
|
|
2951
|
+
* that `{}` is the whole of it. Against a concrete query, omit the argument instead: both
|
|
2952
|
+
* `query.execute()` and the auth registry's `execute()` already take none.
|
|
2953
|
+
*
|
|
2954
|
+
* @example
|
|
2955
|
+
* const runAnything = <TArgs extends QueryArgs>(query: Query<TArgs>) =>
|
|
2956
|
+
* query.execute({ args: emptyQueryArgs<TArgs>() });
|
|
2957
|
+
*/
|
|
2958
|
+
declare const emptyQueryArgs: <TArgs extends QueryArgs>() => RequestArgs<TArgs>;
|
|
2602
2959
|
type CreateQueryOptions<TArgs extends QueryArgs> = {
|
|
2603
2960
|
creator?: CreateQueryCreatorOptions;
|
|
2604
2961
|
creatorInternals: InternalCreateQueryCreatorOptions<TArgs>;
|
|
@@ -2641,6 +2998,16 @@ type QuerySubtle<TArgs extends QueryArgs> = {
|
|
|
2641
2998
|
destroy: () => void;
|
|
2642
2999
|
/** Manually sets the response of the query. This will not trigger a new execution of the query. */
|
|
2643
3000
|
setResponse: (response: ResponseType<TArgs>) => void;
|
|
3001
|
+
/**
|
|
3002
|
+
* Manually forces the loading state of the query. Overridden on the next execution. Intended for
|
|
3003
|
+
* devtools / testing UI states — not for application logic.
|
|
3004
|
+
*/
|
|
3005
|
+
setLoading: (loading: HttpRequestLoadingState | null) => void;
|
|
3006
|
+
/**
|
|
3007
|
+
* Manually forces the error state of the query. Overridden on the next execution. Intended for
|
|
3008
|
+
* devtools / testing UI states — not for application logic.
|
|
3009
|
+
*/
|
|
3010
|
+
setError: (error: QueryErrorResponse | null) => void;
|
|
2644
3011
|
/** The currently underlying HTTP request of the query. Will be `null` if the query has never been executed. */
|
|
2645
3012
|
request: ObservableSignal<HttpRequest<TArgs> | null>;
|
|
2646
3013
|
/** The destroy reference used to clean up the query when it is no longer needed */
|
|
@@ -2712,7 +3079,7 @@ type GqlVariablesType<T extends GqlQueryArgs | null> = T extends GqlQueryArgs ?
|
|
|
2712
3079
|
declare const isCreateGqlQueryOptions: <TArgs extends QueryArgs>(options: CreateQueryOptions<TArgs> | CreateGqlQueryOptions<any>) => options is CreateGqlQueryOptions<any>;
|
|
2713
3080
|
declare const createGqlQuery: <TArgs extends GqlQueryArgs>(options: CreateGqlQueryOptions<TArgs>) => _ethlete_query.Query<TArgs>;
|
|
2714
3081
|
|
|
2715
|
-
declare const shouldAutoExecuteQuery: (method: QueryMethod) => method is "GET" | "
|
|
3082
|
+
declare const shouldAutoExecuteQuery: (method: QueryMethod) => method is "GET" | "HEAD" | "OPTIONS";
|
|
2716
3083
|
declare const shouldAutoExecuteGqlQuery: (method: GqlQueryMethod) => method is "QUERY";
|
|
2717
3084
|
declare const getQueryFeatureUsage: <TArgs extends QueryArgs>(options: CreateQueryOptions<TArgs> | CreateGqlQueryOptions<any>) => QueryFeatureFlags;
|
|
2718
3085
|
declare const applyQueryFeatures: <TArgs extends QueryArgs>(features: QueryFeature<TArgs>[], context: QueryFeatureContext<TArgs>) => void;
|
|
@@ -2912,7 +3279,7 @@ type PagedQueryStack<TQuery extends AnyNewQuery, TNormPagination extends Normali
|
|
|
2912
3279
|
declare const createPagedQueryStack: <TCreator extends AnyQueryCreator, TArgs extends QueryArgsOf<TCreator>, TNormPagination extends NormalizedPagination<unknown>>(options: CreatePagedQueryStackOptions<TArgs, TNormPagination>) => PagedQueryStack<Query<TArgs>, TNormPagination>;
|
|
2913
3280
|
|
|
2914
3281
|
declare const extractExpiresInSeconds: (headers: HttpHeaders) => number | null;
|
|
2915
|
-
declare const shouldCacheQuery: (method: QueryMethod) => method is "GET" | "
|
|
3282
|
+
declare const shouldCacheQuery: (method: QueryMethod) => method is "GET" | "HEAD" | "OPTIONS";
|
|
2916
3283
|
declare const buildQueryCacheKey: (route: string, args: RequestArgs<QueryArgs> | undefined) => string;
|
|
2917
3284
|
|
|
2918
3285
|
type QueryContext = {
|
|
@@ -2996,6 +3363,8 @@ declare const QueryRuntimeErrorCode: {
|
|
|
2996
3363
|
readonly TOKENS_NOT_AVAILABLE_INSIDE_AUTH_AND_EXEC: 700;
|
|
2997
3364
|
readonly INVALID_STATE_INSIDE_SECURE_EXECUTE_FACTORY: 701;
|
|
2998
3365
|
readonly CIRCULAR_QUERY_DEPENDENCY: 800;
|
|
3366
|
+
readonly QUERY_SEQUENCE_ALREADY_RUNNING: 900;
|
|
3367
|
+
readonly LEGACY_PREPARE_WITHOUT_INJECTION_CONTEXT: 950;
|
|
2999
3368
|
};
|
|
3000
3369
|
type QueryRuntimeErrorCode = (typeof QueryRuntimeErrorCode)[keyof typeof QueryRuntimeErrorCode];
|
|
3001
3370
|
declare const queryFeatureUsedMultipleTimes: (type: QueryFeatureType) => RuntimeError<0>;
|
|
@@ -3020,6 +3389,182 @@ declare const gqlDataPropertyMissingInResponse: () => RuntimeError<600>;
|
|
|
3020
3389
|
declare const tokensNotAvailableInsideAuthAndExec: () => RuntimeError<700>;
|
|
3021
3390
|
declare const invalidStateInsideSecureExecuteFactory: () => RuntimeError<701>;
|
|
3022
3391
|
declare const circularQueryDependency: () => RuntimeError<800>;
|
|
3392
|
+
declare const legacyPrepareWithoutInjectionContext: (creatorName: string | undefined) => RuntimeError<950>;
|
|
3393
|
+
declare const querySequenceAlreadyRunning: () => RuntimeError<900>;
|
|
3394
|
+
|
|
3395
|
+
/** The last element of a tuple type — the response of the step a `.then()` callback follows. */
|
|
3396
|
+
type LastOf<T extends unknown[]> = T extends [...unknown[], infer L] ? L : never;
|
|
3397
|
+
/** The current lifecycle phase of a query sequence. */
|
|
3398
|
+
type QuerySequenceStatus = 'idle' | 'running' | 'success' | 'error';
|
|
3399
|
+
/** The args a sequence step supplies to its query — the same `{ args }` shape `query.execute()` takes. */
|
|
3400
|
+
type QuerySequenceStepArgs<TArgs extends QueryArgs> = {
|
|
3401
|
+
args: RequestArgs<TArgs>;
|
|
3402
|
+
};
|
|
3403
|
+
/**
|
|
3404
|
+
* The outcome of a settled {@link QuerySequence.run}.
|
|
3405
|
+
*
|
|
3406
|
+
* A discriminated union: on success `responses` is the fully-typed tuple of every step's response;
|
|
3407
|
+
* on failure `failedAt` is the zero-based index of the step that errored and `error` is its
|
|
3408
|
+
* normalized {@link QueryErrorResponse}. `snapshots` always holds the settled snapshots of every
|
|
3409
|
+
* step that ran — up to and including the failing one.
|
|
3410
|
+
*/
|
|
3411
|
+
type QuerySequenceResult<TResponses extends unknown[]> = {
|
|
3412
|
+
ok: true;
|
|
3413
|
+
responses: TResponses;
|
|
3414
|
+
snapshots: AnyQuerySnapshot[];
|
|
3415
|
+
} | {
|
|
3416
|
+
ok: false;
|
|
3417
|
+
failedAt: number;
|
|
3418
|
+
error: QueryErrorResponse;
|
|
3419
|
+
snapshots: AnyQuerySnapshot[];
|
|
3420
|
+
};
|
|
3421
|
+
/**
|
|
3422
|
+
* An imperative waterfall of dependent queries — usually mutations (`POST`/`PUT`/`PATCH`/`DELETE`)
|
|
3423
|
+
* where each call needs the previous call's response.
|
|
3424
|
+
*
|
|
3425
|
+
* Build the chain once (e.g. as a component field) with {@link querySequence} and `.then()`, then
|
|
3426
|
+
* trigger it with {@link run}. Each step runs via `executeUntilSettled`, threading the previous
|
|
3427
|
+
* step's response into the next; the first error aborts the rest. The progress signals mirror
|
|
3428
|
+
* `createQueryStack`, so a template can drive a stepper without manual bookkeeping.
|
|
3429
|
+
*/
|
|
3430
|
+
type QuerySequence<TResponses extends unknown[]> = {
|
|
3431
|
+
/**
|
|
3432
|
+
* Appends a dependent step. `mapArgs` runs at {@link run} time and receives the previous step's
|
|
3433
|
+
* (unwrapped, non-null on success) response plus the typed tuple of all responses so far, so a
|
|
3434
|
+
* later step can still reach an earlier one's data.
|
|
3435
|
+
*/
|
|
3436
|
+
then: <TArgs extends QueryArgs>(query: Query<TArgs>, mapArgs: (previousResponse: LastOf<TResponses>, responses: TResponses) => QuerySequenceStepArgs<TArgs>) => QuerySequence<[...TResponses, ResponseType<TArgs>]>;
|
|
3437
|
+
/** The current lifecycle phase — `idle` before the first run, then `running` → `success` | `error`. */
|
|
3438
|
+
status: Signal<QuerySequenceStatus>;
|
|
3439
|
+
/** `true` while a run is in flight. */
|
|
3440
|
+
running: Signal<boolean>;
|
|
3441
|
+
/** The 1-based index of the in-flight step, or `0` when idle. */
|
|
3442
|
+
currentStep: Signal<number>;
|
|
3443
|
+
/** The static number of steps in the sequence. */
|
|
3444
|
+
total: number;
|
|
3445
|
+
/** The query objects backing each step, in order. Useful for devtools / advanced introspection. */
|
|
3446
|
+
queries: AnyNewQuery[];
|
|
3447
|
+
/** The error of the step that failed, or `null` while running / on success. */
|
|
3448
|
+
error: Signal<QueryErrorResponse | null>;
|
|
3449
|
+
/** The zero-based index of the step that failed, or `null` while running / on success. */
|
|
3450
|
+
failedAt: Signal<number | null>;
|
|
3451
|
+
/** The settled snapshots of every step that has run, grows as the waterfall progresses. */
|
|
3452
|
+
snapshots: Signal<AnyQuerySnapshot[]>;
|
|
3453
|
+
/**
|
|
3454
|
+
* The resolved input args each step was run with, grows as the waterfall progresses. The value at
|
|
3455
|
+
* index `i` is what {@link QuerySequence.then}'s `mapArgs` produced for step `i` at run time.
|
|
3456
|
+
*/
|
|
3457
|
+
stepArgs: Signal<unknown[]>;
|
|
3458
|
+
/** The responses of every step that has succeeded, grows as the waterfall progresses. */
|
|
3459
|
+
responses: Signal<Partial<TResponses>>;
|
|
3460
|
+
/**
|
|
3461
|
+
* Runs every step in order, resolving once the waterfall settles.
|
|
3462
|
+
*
|
|
3463
|
+
* Resets the progress signals, then awaits each step in turn — stopping at the first error and
|
|
3464
|
+
* resolving with `{ ok: false, failedAt, error }`, or `{ ok: true, responses }` when all steps
|
|
3465
|
+
* succeed. Re-runnable (e.g. behind a retry button); throws {@link querySequenceAlreadyRunning}
|
|
3466
|
+
* if a run is already in flight.
|
|
3467
|
+
*
|
|
3468
|
+
* Cancellation caveat (inherited from `executeUntilSettled`): if the host scope is destroyed
|
|
3469
|
+
* mid-flight the in-flight query is torn down and this promise never settles.
|
|
3470
|
+
*/
|
|
3471
|
+
run: () => Promise<QuerySequenceResult<TResponses>>;
|
|
3472
|
+
};
|
|
3473
|
+
/**
|
|
3474
|
+
* Starts an imperative waterfall of dependent queries. Chain the remaining steps with `.then()`
|
|
3475
|
+
* and trigger it with `.run()` — see {@link QuerySequence}.
|
|
3476
|
+
*
|
|
3477
|
+
* The seed step's `args` are produced lazily (at `run()` time), so the sequence can safely live as
|
|
3478
|
+
* a component field while still reading current signal values on each run.
|
|
3479
|
+
*
|
|
3480
|
+
* @example
|
|
3481
|
+
* ```ts
|
|
3482
|
+
* readonly checkout = querySequence(this.createOrder, () => ({ args: { body: this.order() } }))
|
|
3483
|
+
* .then(this.createPayment, (order) => ({ args: { body: { orderId: order.id } } }))
|
|
3484
|
+
* .then(this.confirmOrder, (payment, [order]) => ({
|
|
3485
|
+
* args: { pathParams: { paymentId: payment.id }, body: { orderRef: order.id } },
|
|
3486
|
+
* }));
|
|
3487
|
+
*
|
|
3488
|
+
* async submit() {
|
|
3489
|
+
* const result = await this.checkout.run();
|
|
3490
|
+
* if (!result.ok) return this.handle(result.error);
|
|
3491
|
+
* const [order, payment, confirmation] = result.responses;
|
|
3492
|
+
* }
|
|
3493
|
+
* ```
|
|
3494
|
+
*/
|
|
3495
|
+
declare const querySequence: <TArgs extends QueryArgs>(query: Query<TArgs>, seedArgs: () => QuerySequenceStepArgs<TArgs>) => QuerySequence<[ResponseType<TArgs>]>;
|
|
3496
|
+
|
|
3497
|
+
/** `kind` of a `ValidationError` created from a single server violation. */
|
|
3498
|
+
declare const SERVER_VIOLATION_ERROR_KIND = "etServerViolation";
|
|
3499
|
+
/** `kind` of the form-level fallback error created when a failed request carries no violations. */
|
|
3500
|
+
declare const SERVER_ERROR_KIND = "etServerError";
|
|
3501
|
+
/** A signal-forms validation error created from a single server violation. */
|
|
3502
|
+
type ServerViolationValidationError = ValidationError.WithOptionalFieldTree & {
|
|
3503
|
+
kind: typeof SERVER_VIOLATION_ERROR_KIND;
|
|
3504
|
+
message: string;
|
|
3505
|
+
/** The violation this error was created from. */
|
|
3506
|
+
violation: FormViolationView;
|
|
3507
|
+
};
|
|
3508
|
+
/** The form-level fallback error for a failed request that carries no violations. */
|
|
3509
|
+
type ServerValidationError = ValidationError.WithOptionalFieldTree & {
|
|
3510
|
+
kind: typeof SERVER_ERROR_KIND;
|
|
3511
|
+
message: string;
|
|
3512
|
+
};
|
|
3513
|
+
/**
|
|
3514
|
+
* Extracts the violation list from a failed request in any of the shapes it may reach you:
|
|
3515
|
+
* a `QueryErrorResponse` (from `query.error()` or a settled snapshot), a raw `HttpErrorResponse`,
|
|
3516
|
+
* an already-unwrapped error body, or a plain violation array. Returns `[]` when the error
|
|
3517
|
+
* carries no violations.
|
|
3518
|
+
*/
|
|
3519
|
+
declare const extractFormViolations: (error: unknown) => FormViolationView[];
|
|
3520
|
+
type MapViolationsToFormErrorsOptions<TModel> = {
|
|
3521
|
+
/**
|
|
3522
|
+
* The field tree the violation property paths are resolved against — usually the form root
|
|
3523
|
+
* (or the `field` passed to a signal-forms `submit()` action).
|
|
3524
|
+
*/
|
|
3525
|
+
fieldTree: FieldTree<TModel>;
|
|
3526
|
+
/**
|
|
3527
|
+
* The failed request's error in any shape `extractFormViolations` accepts: a
|
|
3528
|
+
* `QueryErrorResponse`, a raw `HttpErrorResponse`, an error body, or a violation array.
|
|
3529
|
+
*/
|
|
3530
|
+
error: unknown;
|
|
3531
|
+
/**
|
|
3532
|
+
* Rewrites a violation's property path before it is resolved against the field tree — use it
|
|
3533
|
+
* when the API's payload shape differs from the form model. Return `null` to treat the
|
|
3534
|
+
* violation as unmapped.
|
|
3535
|
+
*/
|
|
3536
|
+
rewritePath?: (path: string, violation: FormViolationView) => string | null;
|
|
3537
|
+
/**
|
|
3538
|
+
* Overrides how a violation whose path doesn't resolve to a field is turned into an error.
|
|
3539
|
+
* Return `null` to drop the violation. By default an unmapped violation becomes a form-level
|
|
3540
|
+
* error (no `fieldTree`), which signal forms attaches to the submitted field.
|
|
3541
|
+
*/
|
|
3542
|
+
onUnmappedViolation?: (violation: FormViolationView) => ValidationError.WithOptionalFieldTree | null;
|
|
3543
|
+
};
|
|
3544
|
+
/**
|
|
3545
|
+
* Maps a failed request's violations onto a signal-forms field tree as validation errors —
|
|
3546
|
+
* the bridge between an API's violation list (`@ethlete/types` `FormViolationView`) and
|
|
3547
|
+
* signal forms.
|
|
3548
|
+
*
|
|
3549
|
+
* Each violation's `propertyPath` (e.g. `items[2].name`) is resolved against `fieldTree`; a
|
|
3550
|
+
* resolved violation becomes a `ServerViolationValidationError` bound to that field, an
|
|
3551
|
+
* unresolved one becomes a form-level error (customizable via `onUnmappedViolation`). A failed
|
|
3552
|
+
* request that carries no violations at all degrades to form-level `ServerValidationError`s
|
|
3553
|
+
* built from the normalized error message — so returning this function's result from a
|
|
3554
|
+
* `submit()` action never silently succeeds on failure.
|
|
3555
|
+
*
|
|
3556
|
+
* ```ts
|
|
3557
|
+
* await submit(this.form, async (field) => {
|
|
3558
|
+
* const snapshot = await executeUntilSettled(this.createPost, { args: { body: field().value() } });
|
|
3559
|
+
* const error = snapshot.error();
|
|
3560
|
+
*
|
|
3561
|
+
* if (!error) return;
|
|
3562
|
+
*
|
|
3563
|
+
* return mapViolationsToFormErrors({ fieldTree: field, error });
|
|
3564
|
+
* });
|
|
3565
|
+
* ```
|
|
3566
|
+
*/
|
|
3567
|
+
declare const mapViolationsToFormErrors: <TModel>(options: MapViolationsToFormErrorsOptions<TModel>) => ValidationError.WithOptionalFieldTree[];
|
|
3023
3568
|
|
|
3024
3569
|
type CreateQuerySnapshotOptions<TArgs extends QueryArgs> = {
|
|
3025
3570
|
state: QueryState<TArgs>;
|
|
@@ -3028,6 +3573,19 @@ type CreateQuerySnapshotOptions<TArgs extends QueryArgs> = {
|
|
|
3028
3573
|
};
|
|
3029
3574
|
declare const createQuerySnapshotFn: <TArgs extends QueryArgs>(options: CreateQuerySnapshotOptions<TArgs>) => () => QuerySnapshot<TArgs>;
|
|
3030
3575
|
|
|
3576
|
+
/**
|
|
3577
|
+
* Executes the query and resolves once that execution has settled (response or error received).
|
|
3578
|
+
* The returned snapshot is frozen to the awaited execution, so a later execution can't swap the
|
|
3579
|
+
* `response()` / `error()` you read from it.
|
|
3580
|
+
*
|
|
3581
|
+
* Designed for imperative flows that need a mutation's outcome in place — e.g. a signal-forms
|
|
3582
|
+
* `submit()` action mapping server violations onto the form via `mapViolationsToFormErrors`.
|
|
3583
|
+
*
|
|
3584
|
+
* The promise stays pending if the execution is cancelled (e.g. `reset()`) and the query is never
|
|
3585
|
+
* executed again — the snapshot settles with whichever execution completes next.
|
|
3586
|
+
*/
|
|
3587
|
+
declare const executeUntilSettled: <TArgs extends QueryArgs>(query: Query<TArgs>, executeArgs?: QueryExecuteArgs<TArgs>) => Promise<QuerySnapshot<TArgs>>;
|
|
3588
|
+
|
|
3031
3589
|
type QueryStackSubtle<TCreator extends AnyQueryCreator, TQuery extends AnyNewQuery> = {
|
|
3032
3590
|
/** Create a new query with the given arguments. You should always prefer the `args` option instead of this. */
|
|
3033
3591
|
runWithArgs: (args: RequestArgs<QueryArgsOf<TCreator>> | RequestArgs<QueryArgsOf<TCreator>>[] | null) => TQuery | null;
|
|
@@ -3170,6 +3728,58 @@ declare const transformPaginatedResponse: <T extends ({
|
|
|
3170
3728
|
} | null)[]>(responses: T) => NonNullable<NonNullable<T[0]>["items"]>;
|
|
3171
3729
|
declare const createQueryStack: <TCreator extends AnyQueryCreator, TArgs extends QueryArgsOf<TCreator>, TDeps extends () => any, TTransform = (ResponseType<TArgs> | null)[]>(options: CreateQueryStackOptions<TCreator, TDeps, TTransform>) => QueryStack<RunQueryCreator<TCreator>, TCreator, TTransform>;
|
|
3172
3730
|
|
|
3731
|
+
/** Config for {@link validateWithQuery}. */
|
|
3732
|
+
type ValidateWithQueryConfig<TCreator extends AnyQueryCreator, TValue, TPathKind extends PathKind> = {
|
|
3733
|
+
/**
|
|
3734
|
+
* The query creator to run (e.g. a secure `createPostQuery` validate route). Like a query stack,
|
|
3735
|
+
* the query is created **once** and re-executes reactively — never per keystroke. Running it
|
|
3736
|
+
* through the query client is the point: auth, base route, caching and error normalization all
|
|
3737
|
+
* apply, unlike a raw `httpResource`.
|
|
3738
|
+
*/
|
|
3739
|
+
queryCreator: TCreator;
|
|
3740
|
+
/**
|
|
3741
|
+
* Builds the request args from the field context. Runs reactively on the field value (debounced),
|
|
3742
|
+
* exactly like `validateAsync`'s `params` — e.g.
|
|
3743
|
+
* `(ctx) => ({ pathParams: { id }, body: { ...ctx.value() } })`.
|
|
3744
|
+
*/
|
|
3745
|
+
args: (ctx: FieldContext<TValue, TPathKind>) => RequestArgs<QueryArgsOf<TCreator>>;
|
|
3746
|
+
/** Debounce before the request runs, in ms. @default 300 */
|
|
3747
|
+
debounce?: number;
|
|
3748
|
+
/** Gate the validation — return `false` to skip the request (e.g. an empty or invalid value). */
|
|
3749
|
+
when?: (ctx: FieldContext<TValue, TPathKind>) => boolean;
|
|
3750
|
+
/**
|
|
3751
|
+
* Override the default violation → error mapping. Receives the violations extracted from the
|
|
3752
|
+
* failed request; return the errors to report (targeting child fields via their `fieldTree`).
|
|
3753
|
+
* Defaults to `mapViolationsToFormErrors`, resolving each violation's `propertyPath` against the
|
|
3754
|
+
* validated field.
|
|
3755
|
+
*/
|
|
3756
|
+
mapViolations?: (violations: FormViolationView[], ctx: FieldContext<TValue, TPathKind>) => TreeValidationResult;
|
|
3757
|
+
};
|
|
3758
|
+
/**
|
|
3759
|
+
* Binds a query-backed async validator to a signal-forms field, adapting an `@ethlete/query` v3
|
|
3760
|
+
* query into what `validateAsync` consumes. The query runs through the query client — so bearer
|
|
3761
|
+
* auth, base route, caching and Symfony error normalization all apply — where a raw `httpResource`
|
|
3762
|
+
* would fire unauthenticated and bypass the pipeline.
|
|
3763
|
+
*
|
|
3764
|
+
* On the current v3 `QueryClient` / `createPostQuery` creators; the `validateWithV2Query` twin
|
|
3765
|
+
* covers the legacy `V2QueryClient`. The query is created once and re-executed (debounced) as the
|
|
3766
|
+
* field value changes, only after the field's synchronous validators pass. A `204` / successful
|
|
3767
|
+
* response reports no errors; a `422 FormViolationListView` maps each violation onto its child
|
|
3768
|
+
* field by `propertyPath`; a network / other error degrades to a non-swallowed form-level error.
|
|
3769
|
+
*
|
|
3770
|
+
* Call it from a schema definition, the same place you'd call `validateAsync`:
|
|
3771
|
+
*
|
|
3772
|
+
* ```ts
|
|
3773
|
+
* const schema = schema<OpportunityEmail>((p) => {
|
|
3774
|
+
* validateWithQuery(p, {
|
|
3775
|
+
* queryCreator: postOpportunityEmailValidate,
|
|
3776
|
+
* args: (ctx) => ({ pathParams: { opportunityId }, body: { ...ctx.value() } }),
|
|
3777
|
+
* });
|
|
3778
|
+
* });
|
|
3779
|
+
* ```
|
|
3780
|
+
*/
|
|
3781
|
+
declare const validateWithQuery: <TCreator extends AnyQueryCreator, TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, config: ValidateWithQueryConfig<TCreator, TValue, TPathKind>) => void;
|
|
3782
|
+
|
|
3173
3783
|
type InternalSecureCreateQueryCreatorOptions<TArgs extends QueryArgs> = InternalCreateQueryCreatorOptions<TArgs> & {
|
|
3174
3784
|
authProvider: AnyCreateBearerAuthProviderResult;
|
|
3175
3785
|
};
|
|
@@ -3555,6 +4165,25 @@ declare const withTracking: <TBuilders extends readonly AnyQueryBuilder[]>(confi
|
|
|
3555
4165
|
};
|
|
3556
4166
|
declare const createTrackingFeature: <TBuilders extends readonly AnyQueryBuilder[]>(context: BearerAuthProviderFeatureContext<unknown, TBuilders>, config?: TrackingConfig<TBuilders>) => TrackingFeature<TBuilders>;
|
|
3557
4167
|
|
|
4168
|
+
type BearerAuthExecutionStateLoading<TType extends string = string> = {
|
|
4169
|
+
type: TType;
|
|
4170
|
+
state: 'loading';
|
|
4171
|
+
};
|
|
4172
|
+
type BearerAuthExecutionStateSuccess<TType extends string = string> = {
|
|
4173
|
+
type: TType;
|
|
4174
|
+
state: 'success';
|
|
4175
|
+
response: unknown;
|
|
4176
|
+
};
|
|
4177
|
+
type BearerAuthExecutionStateError<TType extends string = string> = {
|
|
4178
|
+
type: TType;
|
|
4179
|
+
state: 'error';
|
|
4180
|
+
error: QueryErrorResponse;
|
|
4181
|
+
};
|
|
4182
|
+
type BearerAuthExecutionStateLogout = {
|
|
4183
|
+
type: 'logout';
|
|
4184
|
+
state: 'success';
|
|
4185
|
+
};
|
|
4186
|
+
type BearerAuthExecutionState<TType extends string = string> = BearerAuthExecutionStateLoading<TType> | BearerAuthExecutionStateSuccess<TType> | BearerAuthExecutionStateError<TType> | BearerAuthExecutionStateLogout;
|
|
3558
4187
|
declare const BearerAuthFeatureType: {
|
|
3559
4188
|
readonly PERSISTENT_AUTH: "PERSISTENT_AUTH";
|
|
3560
4189
|
readonly TOKEN_EXPIRATION_WARNING: "TOKEN_EXPIRATION_WARNING";
|
|
@@ -3569,17 +4198,18 @@ type BearerAuthFeature<TBuilders extends readonly AnyQueryBuilder[], TBearerData
|
|
|
3569
4198
|
};
|
|
3570
4199
|
type ExtractQueryKey<T> = T extends AuthQueryBuilder<infer K, any> ? K : T extends TokenRefreshQueryBuilder<infer K, any> ? K : never;
|
|
3571
4200
|
type ExtractQueryArgs<T> = T extends AuthQueryBuilder<string, infer TArgs> ? TArgs : T extends TokenRefreshQueryBuilder<string, infer TArgs> ? TArgs : never;
|
|
4201
|
+
type QueryRegistryEntry<TArgs extends QueryArgs> = {
|
|
4202
|
+
/**
|
|
4203
|
+
* Executes the auth query. `args` may be omitted for a query that takes none — its
|
|
4204
|
+
* `RequestArgs` is `{}`, which generic helper code cannot produce without a cast.
|
|
4205
|
+
*/
|
|
4206
|
+
execute: (args?: RequestArgs<TArgs>, options?: RunQueryExecuteOptions) => QuerySnapshot<TArgs>;
|
|
4207
|
+
snapshot: Signal<QuerySnapshot<TArgs> | null>;
|
|
4208
|
+
};
|
|
3572
4209
|
type QueryRegistry<TBuilders extends readonly AnyQueryBuilder[]> = {
|
|
3573
|
-
[K in ExtractQueryKey<TBuilders[number]>]: {
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
}>>>, options?: RunQueryExecuteOptions) => QuerySnapshot<ExtractQueryArgs<Extract<TBuilders[number], {
|
|
3577
|
-
key: K;
|
|
3578
|
-
}>>>;
|
|
3579
|
-
snapshot: Signal<QuerySnapshot<ExtractQueryArgs<Extract<TBuilders[number], {
|
|
3580
|
-
key: K;
|
|
3581
|
-
}>>> | null>;
|
|
3582
|
-
};
|
|
4210
|
+
[K in ExtractQueryKey<TBuilders[number]>]: QueryRegistryEntry<ExtractQueryArgs<Extract<TBuilders[number], {
|
|
4211
|
+
key: K;
|
|
4212
|
+
}>>>;
|
|
3583
4213
|
};
|
|
3584
4214
|
type HasFeatureType<TFeatures extends readonly unknown[], TType extends BearerAuthFeatureType> = TFeatures extends readonly ((context: any) => any)[] ? Extract<ReturnType<TFeatures[number]>, {
|
|
3585
4215
|
type: TType;
|
|
@@ -3697,6 +4327,24 @@ type BearerAuthProvider<TBuilders extends readonly AnyQueryBuilder[], TFeatures
|
|
|
3697
4327
|
key: ExtractQueryKey<TBuilders[number]>;
|
|
3698
4328
|
snapshot: QuerySnapshot<QueryArgs>;
|
|
3699
4329
|
} | null>;
|
|
4330
|
+
/**
|
|
4331
|
+
* The current execution state of the auth provider.
|
|
4332
|
+
* Tracks the latest auth operation (login, autoLogin, tokenRefresh, logout, revocation) with its state and payload.
|
|
4333
|
+
*/
|
|
4334
|
+
executionState: Signal<BearerAuthExecutionState<ExtractQueryKey<TBuilders[number]> | 'autoLogin' | 'tokenRefresh' | 'logout' | 'revocation'> | null>;
|
|
4335
|
+
/**
|
|
4336
|
+
* Seeds the provider with tokens that were issued outside of it — an SSO/OIDC callback that
|
|
4337
|
+
* arrives with both tokens in the URL, a token handed over by a native shell, a test harness.
|
|
4338
|
+
*
|
|
4339
|
+
* Behaves exactly like a successful auth query: the tokens are applied, `bearerData` /
|
|
4340
|
+
* `isAuthenticated` update, `afterTokenRefresh$` emits so waiting secure queries run, and (unless
|
|
4341
|
+
* disabled) other tabs are synced. Without it the only way in is to execute the refresh query with
|
|
4342
|
+
* the refresh token and throw the access token away.
|
|
4343
|
+
*
|
|
4344
|
+
* Does **not** persist anything by itself — `withPersistentAuth` picks the tokens up through the
|
|
4345
|
+
* same signals it watches for query-issued ones.
|
|
4346
|
+
*/
|
|
4347
|
+
setTokens: (accessToken: string, refreshToken: string) => void;
|
|
3700
4348
|
/**
|
|
3701
4349
|
* Logout the user (clears all tokens and unbinds secure queries)
|
|
3702
4350
|
*/
|
|
@@ -3722,6 +4370,7 @@ type BearerAuthProviderFeatureContext<TBearerData = unknown, TBuilders extends r
|
|
|
3722
4370
|
instanceCount: Signal<number>;
|
|
3723
4371
|
};
|
|
3724
4372
|
queries: QueryRegistry<TBuilders>;
|
|
4373
|
+
executionState: WritableSignal<BearerAuthExecutionState | null>;
|
|
3725
4374
|
};
|
|
3726
4375
|
type BearerAuthProviderQueryContext<TBearerData = unknown, TBuilders extends readonly AnyQueryBuilder[] = readonly AnyQueryBuilder[]> = {
|
|
3727
4376
|
accessToken: WritableSignal<string | null>;
|
|
@@ -3736,7 +4385,102 @@ type BearerAuthProviderQueryContext<TBearerData = unknown, TBuilders extends rea
|
|
|
3736
4385
|
declare const createBearerAuthProvider: <TBuilders extends readonly AnyQueryBuilder[], TFeatures extends readonly ((context: BearerAuthProviderFeatureContext<TBearerData, TBuilders>) => unknown)[], TBearerData = unknown>(config: CreateBearerAuthProviderConfig<TBuilders, TFeatures, TBearerData>) => ProviderResult<BearerAuthProvider<TBuilders, TFeatures, TBearerData>>;
|
|
3737
4386
|
type BearerAuthProviderRef<TBuilders extends readonly AnyQueryBuilder[] = readonly AnyQueryBuilder[], TFeatures extends readonly ((context: BearerAuthProviderFeatureContext<TBearerData, TBuilders>) => unknown)[] = readonly ((context: BearerAuthProviderFeatureContext<unknown, readonly AnyQueryBuilder[]>) => unknown)[], TBearerData = unknown> = ProviderResult<BearerAuthProvider<TBuilders, TFeatures, TBearerData>>;
|
|
3738
4387
|
type AnyCreateBearerAuthProviderResult = BearerAuthProviderRef<any, any, any>;
|
|
3739
|
-
|
|
4388
|
+
/**
|
|
4389
|
+
* The exact provider type behind a `createBearerAuthProvider` result — query keys, feature registry
|
|
4390
|
+
* and bearer data all preserved.
|
|
4391
|
+
*
|
|
4392
|
+
* Prefer this over {@link AnyBearerAuthProvider} whenever the provider is reachable as a value, e.g.
|
|
4393
|
+
* when passing one into a helper:
|
|
4394
|
+
*
|
|
4395
|
+
* ```ts
|
|
4396
|
+
* export const myApiAuthProviderRef = createBearerAuthProvider({ ... });
|
|
4397
|
+
* export type MyApiAuthProvider = BearerAuthProviderOf<typeof myApiAuthProviderRef>;
|
|
4398
|
+
*
|
|
4399
|
+
* const doLogin = (provider: MyApiAuthProvider) => provider.queries.login({ body: { ... } });
|
|
4400
|
+
* ```
|
|
4401
|
+
*/
|
|
4402
|
+
type BearerAuthProviderOf<TRef extends AnyCreateBearerAuthProviderResult> = NonNullable<ReturnType<TRef[1]>>;
|
|
4403
|
+
type AnyBearerAuthProvider = Omit<NonNullable<ReturnType<AnyCreateBearerAuthProviderResult[1]>>, 'queries'> & {
|
|
4404
|
+
/**
|
|
4405
|
+
* Registry of all configured auth queries.
|
|
4406
|
+
*
|
|
4407
|
+
* Deliberately untyped here: with unknown builders the mapped type degrades to an index
|
|
4408
|
+
* signature, and `noPropertyAccessFromIndexSignature` then rejects `provider.queries.login`
|
|
4409
|
+
* (TS4111) — forcing every call site into bracket access or a hand-written structural contract.
|
|
4410
|
+
* Use {@link BearerAuthProviderOf} where the concrete provider is reachable and the keys survive.
|
|
4411
|
+
*/
|
|
4412
|
+
queries: any;
|
|
4413
|
+
};
|
|
4414
|
+
|
|
4415
|
+
/**
|
|
4416
|
+
* The kind of object a {@link QueryDevtoolsEntry} describes. Part of the devtools contract consumed
|
|
4417
|
+
* by `<et-query-devtools>` — not a general-purpose query API.
|
|
4418
|
+
*/
|
|
4419
|
+
type QueryDevtoolsEntryKind = 'query' | 'query-stack' | 'paged-query-stack' | 'query-sequence' | 'auth-provider' | 'ws-client';
|
|
4420
|
+
/**
|
|
4421
|
+
* Descriptive, mostly-static metadata about a registered devtools entry. The live, reactive state
|
|
4422
|
+
* is read from the entry's {@link QueryDevtoolsEntry.handle} instead.
|
|
4423
|
+
*/
|
|
4424
|
+
type QueryDevtoolsEntryMeta = {
|
|
4425
|
+
/** Display name of the owning query client, where known. */
|
|
4426
|
+
clientName?: string;
|
|
4427
|
+
/** Base URL of the owning query client, where known. */
|
|
4428
|
+
clientBaseUrl?: string;
|
|
4429
|
+
/** Human readable display name (e.g. an auth provider or web socket client name). */
|
|
4430
|
+
name?: string;
|
|
4431
|
+
/** The connection URL, for web socket clients. */
|
|
4432
|
+
url?: string;
|
|
4433
|
+
/** The GraphQL document string, for GraphQL queries. */
|
|
4434
|
+
gqlQuery?: string;
|
|
4435
|
+
/** Stringified route with path params rendered as `:param`, for queries. */
|
|
4436
|
+
route?: string;
|
|
4437
|
+
/** Human readable HTTP/GQL method, for queries (e.g. `GET`, `GQL QUERY`). */
|
|
4438
|
+
method?: string;
|
|
4439
|
+
/** The feature types applied at creation, for queries. */
|
|
4440
|
+
featureTypes?: QueryFeatureType[];
|
|
4441
|
+
/** The query config passed at creation, for queries. */
|
|
4442
|
+
queryConfig?: QueryConfig;
|
|
4443
|
+
/** The creator options passed at creation, for queries. */
|
|
4444
|
+
creator?: CreateQueryCreatorOptions;
|
|
4445
|
+
/** The owning client's repository, where known (queries and auth providers). */
|
|
4446
|
+
repository?: QueryRepository;
|
|
4447
|
+
/**
|
|
4448
|
+
* The DOM element of the component/directive that created a query, when available. Used by the
|
|
4449
|
+
* devtools "inspect" tool to map a query back to its place in the live UI.
|
|
4450
|
+
*/
|
|
4451
|
+
element?: HTMLElement | null;
|
|
4452
|
+
};
|
|
4453
|
+
/**
|
|
4454
|
+
* A single entry in the {@link queryDevtoolsEntries} registry. The `handle` is the live object
|
|
4455
|
+
* (query, stack, sequence or auth provider) so its signals stay reactive when read by the UI.
|
|
4456
|
+
*/
|
|
4457
|
+
type QueryDevtoolsEntry = {
|
|
4458
|
+
id: string;
|
|
4459
|
+
kind: QueryDevtoolsEntryKind;
|
|
4460
|
+
meta: QueryDevtoolsEntryMeta;
|
|
4461
|
+
handle: unknown;
|
|
4462
|
+
createdAt: number;
|
|
4463
|
+
};
|
|
4464
|
+
/**
|
|
4465
|
+
* The reactive list of every registered devtools entry, consumed by the `<et-query-devtools>` UI.
|
|
4466
|
+
*/
|
|
4467
|
+
declare const queryDevtoolsEntries: Signal<QueryDevtoolsEntry[]>;
|
|
4468
|
+
/**
|
|
4469
|
+
* Enables the `@ethlete/query` devtools. Add this to your application providers (e.g. in
|
|
4470
|
+
* `bootstrapApplication`) to make query clients, queries, stacks, sequences and auth providers
|
|
4471
|
+
* appear in the `<et-query-devtools>` panel.
|
|
4472
|
+
*
|
|
4473
|
+
* When omitted, all devtools instrumentation is a no-op — no references are retained and there is no
|
|
4474
|
+
* runtime overhead — so it is safe to leave out of production builds.
|
|
4475
|
+
*
|
|
4476
|
+
* @example
|
|
4477
|
+
* ```ts
|
|
4478
|
+
* bootstrapApplication(AppComponent, {
|
|
4479
|
+
* providers: [provideQueryDevtools()],
|
|
4480
|
+
* });
|
|
4481
|
+
* ```
|
|
4482
|
+
*/
|
|
4483
|
+
declare const provideQueryDevtools: () => EnvironmentProviders;
|
|
3740
4484
|
|
|
3741
4485
|
type TransformedGqlQuery = {
|
|
3742
4486
|
query: string;
|
|
@@ -3827,6 +4571,283 @@ declare class ParseHttpErrorCodeToMessageEnPipe implements PipeTransform {
|
|
|
3827
4571
|
static ɵpipe: _angular_core.ɵɵPipeDeclaration<ParseHttpErrorCodeToMessageEnPipe, "parseHttpErrorCodeToMessageEn", true>;
|
|
3828
4572
|
}
|
|
3829
4573
|
|
|
4574
|
+
/**
|
|
4575
|
+
* The internal, fully-resolved definition of a single query-form field.
|
|
4576
|
+
*
|
|
4577
|
+
* Produced by the field creators (`queryField()`, `searchQueryField()`, …) and
|
|
4578
|
+
* consumed by `createQueryForm()`. `T` is the field's value type and always
|
|
4579
|
+
* includes `null` (a field can be cleared).
|
|
4580
|
+
*/
|
|
4581
|
+
type QueryFieldDef<T> = {
|
|
4582
|
+
/**
|
|
4583
|
+
* The default value. When the field equals this value it is elided from the
|
|
4584
|
+
* URL (unless `appendDefaultValueToUrl` is set) and ignored by the filter
|
|
4585
|
+
* count. A function is evaluated lazily every time the default is needed.
|
|
4586
|
+
*/
|
|
4587
|
+
readonly defaultValue: T | (() => T);
|
|
4588
|
+
/** Debounce in milliseconds before a change is committed (emitted + written to the URL). */
|
|
4589
|
+
readonly debounce?: number;
|
|
4590
|
+
/**
|
|
4591
|
+
* Skip the debounce when the new value is falsy. Useful for search fields so
|
|
4592
|
+
* that clearing the input applies immediately while typing stays debounced.
|
|
4593
|
+
*
|
|
4594
|
+
* @default false
|
|
4595
|
+
*/
|
|
4596
|
+
readonly disableDebounceIfFalsy?: boolean;
|
|
4597
|
+
/**
|
|
4598
|
+
* Write the field's value to the URL. A field is never written while it holds
|
|
4599
|
+
* its default value unless `appendDefaultValueToUrl` is set.
|
|
4600
|
+
*
|
|
4601
|
+
* @default true
|
|
4602
|
+
*/
|
|
4603
|
+
readonly appendToUrl?: boolean;
|
|
4604
|
+
/**
|
|
4605
|
+
* Write the field to the URL even when it holds its default value. Ignored
|
|
4606
|
+
* when `appendToUrl` is `false`.
|
|
4607
|
+
*
|
|
4608
|
+
* @default false
|
|
4609
|
+
*/
|
|
4610
|
+
readonly appendDefaultValueToUrl?: boolean;
|
|
4611
|
+
/**
|
|
4612
|
+
* Reset this field to its default whenever one of the listed sibling fields
|
|
4613
|
+
* changes — e.g. a `page` field is reset by `['search', 'limit']`.
|
|
4614
|
+
*/
|
|
4615
|
+
readonly isResetBy?: readonly string[];
|
|
4616
|
+
/**
|
|
4617
|
+
* Exclude this field from `activeFilterCount`. The common pagination/sort/search
|
|
4618
|
+
* keys are excluded automatically (see `IGNORED_FILTER_COUNT_FIELDS`).
|
|
4619
|
+
*
|
|
4620
|
+
* @default false
|
|
4621
|
+
*/
|
|
4622
|
+
readonly skipInFilterCount?: boolean;
|
|
4623
|
+
/**
|
|
4624
|
+
* Skip the best-effort auto-coercion (numeric strings → number, `'true'`/`'false'`
|
|
4625
|
+
* → boolean, the null sentinel → `null`) when reading the value back from the URL.
|
|
4626
|
+
*
|
|
4627
|
+
* @default false
|
|
4628
|
+
*/
|
|
4629
|
+
readonly skipAutoTransform?: boolean;
|
|
4630
|
+
/** Transform a raw URL query-param value into the field's value type. */
|
|
4631
|
+
readonly queryParamToValue?: (raw: unknown) => T;
|
|
4632
|
+
/** Transform the field's value into a raw URL query-param value. */
|
|
4633
|
+
readonly valueToQueryParam?: (value: T) => unknown;
|
|
4634
|
+
};
|
|
4635
|
+
/**
|
|
4636
|
+
* Options accepted by a field creator. Everything is optional; `isResetBy`
|
|
4637
|
+
* accepts a single key or a list for convenience.
|
|
4638
|
+
*/
|
|
4639
|
+
type QueryFieldConfig<T> = Partial<Omit<QueryFieldDef<T>, 'isResetBy'>> & {
|
|
4640
|
+
readonly isResetBy?: string | readonly string[];
|
|
4641
|
+
};
|
|
4642
|
+
/** Extracts a field definition's value type. */
|
|
4643
|
+
type QueryFieldValue<F> = F extends QueryFieldDef<infer T> ? T : never;
|
|
4644
|
+
/** A map of field name → field definition, as passed to `createQueryForm({ fields })`. */
|
|
4645
|
+
type QueryFormFields = Record<string, QueryFieldDef<unknown>>;
|
|
4646
|
+
/** The value shape of a query form — one entry per field. */
|
|
4647
|
+
type QueryFormModel<TFields extends QueryFormFields> = {
|
|
4648
|
+
[K in keyof TFields]: QueryFieldValue<TFields[K]>;
|
|
4649
|
+
};
|
|
4650
|
+
/** A committed change: the value before and after a commit. */
|
|
4651
|
+
type QueryFormChange<TFields extends QueryFormFields> = {
|
|
4652
|
+
readonly previousValue: QueryFormModel<TFields> | null;
|
|
4653
|
+
readonly currentValue: QueryFormModel<TFields>;
|
|
4654
|
+
};
|
|
4655
|
+
/**
|
|
4656
|
+
* Options passed to `observe()`. Named distinctly from the legacy
|
|
4657
|
+
* `QueryFormObserveOptions` to keep both APIs' barrel exports intact.
|
|
4658
|
+
*/
|
|
4659
|
+
type QueryFormSignalsObserveOptions = {
|
|
4660
|
+
/**
|
|
4661
|
+
* Sync the committed value to the URL query params.
|
|
4662
|
+
* @default true
|
|
4663
|
+
*/
|
|
4664
|
+
readonly writeToQueryParams?: boolean;
|
|
4665
|
+
/**
|
|
4666
|
+
* Apply URL → form changes on navigation (back/forward, external links).
|
|
4667
|
+
* @default true
|
|
4668
|
+
*/
|
|
4669
|
+
readonly syncOnNavigation?: boolean;
|
|
4670
|
+
/**
|
|
4671
|
+
* Replace the current history entry instead of pushing a new one.
|
|
4672
|
+
* @default false
|
|
4673
|
+
*/
|
|
4674
|
+
readonly replaceUrl?: boolean;
|
|
4675
|
+
};
|
|
4676
|
+
/**
|
|
4677
|
+
* Options for a single programmatic write (`setValue`/`patchValue`/reset).
|
|
4678
|
+
*
|
|
4679
|
+
* Named distinctly from the legacy reactive-forms `QueryFormWriteOptions` (which
|
|
4680
|
+
* also carried the RxJS-only `onlySelf`/`emitEvent`) — the signals variant only
|
|
4681
|
+
* needs `skipResets`.
|
|
4682
|
+
*/
|
|
4683
|
+
type QueryFormSignalsWriteOptions = {
|
|
4684
|
+
/**
|
|
4685
|
+
* Skip the `isResetBy` graph for this write, so dependent fields keep their
|
|
4686
|
+
* current value instead of resetting to default.
|
|
4687
|
+
* @default false
|
|
4688
|
+
*/
|
|
4689
|
+
readonly skipResets?: boolean;
|
|
4690
|
+
};
|
|
4691
|
+
|
|
4692
|
+
/**
|
|
4693
|
+
* Fields excluded from `activeFilterCount` by default — pagination, sorting and
|
|
4694
|
+
* search are navigation state, not filters.
|
|
4695
|
+
*/
|
|
4696
|
+
declare const IGNORED_FILTER_COUNT_FIELDS: readonly string[];
|
|
4697
|
+
/**
|
|
4698
|
+
* A detached editor over the same fields — its own signal-forms form and value,
|
|
4699
|
+
* with no URL sync and no reset graph. Written back to the source form via
|
|
4700
|
+
* `source.setValue(branch.value())`. Powers the filter-overlay "edit then apply"
|
|
4701
|
+
* pattern (see `10-filter.md`).
|
|
4702
|
+
*/
|
|
4703
|
+
type QueryFormBranch<TFields extends QueryFormFields> = {
|
|
4704
|
+
/** The bindable signal-forms field tree (`branch.fields.search`). */
|
|
4705
|
+
readonly fields: FieldTree<QueryFormModel<TFields>>;
|
|
4706
|
+
/** The live (undebounced) value of the branch. */
|
|
4707
|
+
readonly value: Signal<QueryFormModel<TFields>>;
|
|
4708
|
+
/** The number of active (non-default) filters in the branch. */
|
|
4709
|
+
readonly activeFilterCount: Signal<number>;
|
|
4710
|
+
setValue(value: QueryFormModel<TFields>): void;
|
|
4711
|
+
patchValue(value: Partial<QueryFormModel<TFields>>): void;
|
|
4712
|
+
resetFieldToDefault(key: keyof QueryFormModel<TFields>): void;
|
|
4713
|
+
resetAllFieldsToDefault(): void;
|
|
4714
|
+
};
|
|
4715
|
+
type CreateQueryFormConfig<TFields extends QueryFormFields> = {
|
|
4716
|
+
readonly fields: TFields;
|
|
4717
|
+
/**
|
|
4718
|
+
* A prefix for every query-param key, so multiple query forms can coexist on
|
|
4719
|
+
* one route (e.g. prefix `'users'` maps the `page` field to `users-page`).
|
|
4720
|
+
* A function is evaluated every time a key is built.
|
|
4721
|
+
*/
|
|
4722
|
+
readonly queryParamPrefix?: string | (() => string);
|
|
4723
|
+
};
|
|
4724
|
+
/**
|
|
4725
|
+
* A signals-first query form: binds on-screen controls to typed fields, keeps a
|
|
4726
|
+
* debounced committed value, syncs to the URL query params, and resets dependent
|
|
4727
|
+
* fields via the `isResetBy` graph — all as signals.
|
|
4728
|
+
*
|
|
4729
|
+
* @example
|
|
4730
|
+
* const qf = createQueryForm({
|
|
4731
|
+
* fields: {
|
|
4732
|
+
* search: searchQueryField(),
|
|
4733
|
+
* sort: sortQueryField(),
|
|
4734
|
+
* page: queryField<number>({ defaultValue: 1, isResetBy: ['search', 'sort'] }),
|
|
4735
|
+
* },
|
|
4736
|
+
* }).observe();
|
|
4737
|
+
* // template: <input etInput [formField]="qf.fields.search" />
|
|
4738
|
+
*/
|
|
4739
|
+
declare class QueryFormSignals<TFields extends QueryFormFields> {
|
|
4740
|
+
private readonly _router;
|
|
4741
|
+
private readonly _route;
|
|
4742
|
+
private readonly _injector;
|
|
4743
|
+
private readonly _fields;
|
|
4744
|
+
private readonly _prefix;
|
|
4745
|
+
private readonly _defaults;
|
|
4746
|
+
/** Live field values (updated immediately by bound controls). */
|
|
4747
|
+
private readonly _model;
|
|
4748
|
+
/** The committed (debounced) value that drives `value`, the URL and the filter count. */
|
|
4749
|
+
private readonly _committed;
|
|
4750
|
+
private readonly _previous;
|
|
4751
|
+
private readonly _observing;
|
|
4752
|
+
private readonly _queryParamChanges;
|
|
4753
|
+
private _observeOptions;
|
|
4754
|
+
private _pendingTimer;
|
|
4755
|
+
private _skipNextResets;
|
|
4756
|
+
/**
|
|
4757
|
+
* The bindable signal-forms field tree — bind a field with `[formField]`, e.g.
|
|
4758
|
+
* `<input etInput [formField]="qf.fields.search" />`.
|
|
4759
|
+
*/
|
|
4760
|
+
readonly fields: FieldTree<QueryFormModel<TFields>>;
|
|
4761
|
+
/** The committed value of the form. */
|
|
4762
|
+
readonly value: Signal<QueryFormModel<TFields>>;
|
|
4763
|
+
/** The committed value before the most recent change. */
|
|
4764
|
+
readonly previousValue: Signal<QueryFormModel<TFields> | null>;
|
|
4765
|
+
/** The previous/current value pair of the most recent committed change. */
|
|
4766
|
+
readonly changes: Signal<QueryFormChange<TFields>>;
|
|
4767
|
+
/**
|
|
4768
|
+
* The number of active filters. Excludes the pagination/sort/search keys and
|
|
4769
|
+
* any field created with `skipInFilterCount`.
|
|
4770
|
+
*/
|
|
4771
|
+
readonly activeFilterCount: Signal<number>;
|
|
4772
|
+
/** The default value of the whole form. */
|
|
4773
|
+
readonly defaultValue: QueryFormModel<TFields>;
|
|
4774
|
+
constructor(config: CreateQueryFormConfig<TFields>);
|
|
4775
|
+
observe(options?: QueryFormSignalsObserveOptions): this;
|
|
4776
|
+
unobserve(): void;
|
|
4777
|
+
setValue(value: QueryFormModel<TFields>, options?: QueryFormSignalsWriteOptions): void;
|
|
4778
|
+
patchValue(value: Partial<QueryFormModel<TFields>>, options?: QueryFormSignalsWriteOptions): void;
|
|
4779
|
+
resetFieldToDefault(key: keyof QueryFormModel<TFields>, options?: QueryFormSignalsWriteOptions): void;
|
|
4780
|
+
resetFieldsToDefault(keys: (keyof QueryFormModel<TFields>)[], options?: QueryFormSignalsWriteOptions): void;
|
|
4781
|
+
resetAllFieldsToDefault(options?: QueryFormSignalsWriteOptions & {
|
|
4782
|
+
skipFields?: (keyof QueryFormModel<TFields>)[];
|
|
4783
|
+
}): void;
|
|
4784
|
+
/** Create a detached editor over the same fields, seeded from the current committed value. */
|
|
4785
|
+
branch(): QueryFormBranch<TFields>;
|
|
4786
|
+
private _onLiveChange;
|
|
4787
|
+
/** Shortest-debounce-wins; `null` means commit immediately. */
|
|
4788
|
+
private _resolveDebounce;
|
|
4789
|
+
private _flush;
|
|
4790
|
+
private _applyResets;
|
|
4791
|
+
private _applyFromUrl;
|
|
4792
|
+
private _commitFromUrl;
|
|
4793
|
+
private _deserialize;
|
|
4794
|
+
private _writeToUrl;
|
|
4795
|
+
private _paramKey;
|
|
4796
|
+
private _clearTimer;
|
|
4797
|
+
private _cleanup;
|
|
4798
|
+
}
|
|
4799
|
+
/**
|
|
4800
|
+
* Create a {@link QueryFormSignals}. Call `.observe()` to start syncing with the
|
|
4801
|
+
* URL. Must be called in an injection context.
|
|
4802
|
+
*/
|
|
4803
|
+
declare const createQueryForm: <TFields extends QueryFormFields>(config: CreateQueryFormConfig<TFields>) => QueryFormSignals<TFields>;
|
|
4804
|
+
|
|
4805
|
+
/**
|
|
4806
|
+
* A generic query-form field. Defaults to `null` and, unless a transform is
|
|
4807
|
+
* given, relies on the auto-coercion when reading back from the URL.
|
|
4808
|
+
*
|
|
4809
|
+
* @example
|
|
4810
|
+
* queryField<number>({ defaultValue: 1, isResetBy: ['search'] })
|
|
4811
|
+
*/
|
|
4812
|
+
declare const queryField: <T = string>(config?: QueryFieldConfig<T | null>) => QueryFieldDef<T | null>;
|
|
4813
|
+
/**
|
|
4814
|
+
* A debounced free-text search field. Debounces typing by 300ms but applies
|
|
4815
|
+
* clearing immediately (`disableDebounceIfFalsy`).
|
|
4816
|
+
*/
|
|
4817
|
+
declare const searchQueryField: (config?: QueryFieldConfig<string | null>) => QueryFieldDef<string | null>;
|
|
4818
|
+
/**
|
|
4819
|
+
* A sort field serialized as `"active:direction"` (e.g. `"name:asc"`). Matches
|
|
4820
|
+
* the wire format the table system's URL adapter uses, so the two interoperate.
|
|
4821
|
+
*/
|
|
4822
|
+
declare const sortQueryField: (config?: QueryFieldConfig<Sort | null>) => QueryFieldDef<Sort | null>;
|
|
4823
|
+
/** A field holding a list of strings. */
|
|
4824
|
+
declare const stringArrayQueryField: (config?: QueryFieldConfig<string[] | null>) => QueryFieldDef<string[] | null>;
|
|
4825
|
+
/** A field holding a list of numbers. */
|
|
4826
|
+
declare const numberArrayQueryField: (config?: QueryFieldConfig<number[] | null>) => QueryFieldDef<number[] | null>;
|
|
4827
|
+
/** A field holding a list of booleans. */
|
|
4828
|
+
declare const booleanArrayQueryField: (config?: QueryFieldConfig<boolean[] | null>) => QueryFieldDef<boolean[] | null>;
|
|
4829
|
+
/** A single date field (expects an ISO/`Date`-parseable string in the URL). */
|
|
4830
|
+
declare const dateQueryField: (config?: QueryFieldConfig<Date | null>) => QueryFieldDef<Date | null>;
|
|
4831
|
+
/** A field holding a list of dates. */
|
|
4832
|
+
declare const dateArrayQueryField: (config?: QueryFieldConfig<Date[] | null>) => QueryFieldDef<Date[] | null>;
|
|
4833
|
+
|
|
4834
|
+
/** A single message captured for the devtools web socket inspector. */
|
|
4835
|
+
type WebSocketDevtoolsMessage = {
|
|
4836
|
+
id: number;
|
|
4837
|
+
timestamp: number;
|
|
4838
|
+
room: string;
|
|
4839
|
+
event: string;
|
|
4840
|
+
data: unknown;
|
|
4841
|
+
};
|
|
4842
|
+
/**
|
|
4843
|
+
* The live handle a web socket client registers with the devtools. Read by the `<et-query-devtools>`
|
|
4844
|
+
* Sockets tab. Not part of the general public contract.
|
|
4845
|
+
*/
|
|
4846
|
+
type WebSocketDevtoolsHandle = {
|
|
4847
|
+
connected: Signal<boolean>;
|
|
4848
|
+
rooms: Signal<string[]>;
|
|
4849
|
+
messages: Signal<WebSocketDevtoolsMessage[]>;
|
|
4850
|
+
};
|
|
3830
4851
|
type CreateWebSocketClientTransport = 'polling' | 'websocket' | 'webtransport';
|
|
3831
4852
|
type CreateWebSocketClientConfigOptions = {
|
|
3832
4853
|
/** A unique name for the client */
|
|
@@ -3870,5 +4891,5 @@ type WebSocketClientResult<TMessageData extends SocketMessageView = SocketMessag
|
|
|
3870
4891
|
type AnyWebSocketClient<TMessageData extends SocketMessageView = SocketMessageView> = WebSocketClientResult<TMessageData>;
|
|
3871
4892
|
declare const createWebSocketClient: <TMessageData extends SocketMessageView = SocketMessageView>(options: CreateWebSocketClientConfigOptions) => WebSocketClientResult<TMessageData>;
|
|
3872
4893
|
|
|
3873
|
-
export { AuthBearerRefreshStrategy, BasicAuthProvider, BearerAuthFeatureType, BooleanArrayQueryField, CLEAR_QUERY_ARGS, CustomHeaderAuthProvider, DateArrayQueryField, DateQueryField, EntityStore, INFINITY_QUERY_TOKEN, InfinityQuery, InfinityQueryDirective, InfinityQueryTriggerDirective, LegacyQuery, LegacyQueryCreator, NumberArrayQueryField, ParseHttpErrorCodeToMessageDePipe, ParseHttpErrorCodeToMessageEnPipe, ParseHttpErrorCodeToTitleDePipe, ParseHttpErrorCodeToTitleEnPipe, QUERY_CLIENT_DEVTOOLS_TOKEN, QueryDevtoolsComponent, QueryDirective, QueryError, QueryFeatureType, QueryField, QueryForm, QueryRuntimeErrorCode, QueryShortNamePipe, QueryStateType, QueryStore, SPEED_BUFFER_TIME_IN_MS, SearchQueryField, SortQueryField, StringArrayQueryField, V2BearerAuthProvider, V2Query, V2QueryClient, V2QueryCreator, addQueryContainerHandling, applyQueryFeatures, authExtractTokensResponseMissingAccessToken, authExtractTokensResponseMissingRefreshToken, authExtractTokensResponseNotObject, authProviderFeatureUsedMultipleTimes, buildErrorMessage, buildQueryCacheKey, buildQueryString, buildRoute, buildTimestampFromSeconds, castQueryCreatorTypes, circularQueryDependency, circularQueryDependencyChecker, computeQueryAuthHeader, computeQueryBody, computeQueryHeaders, computeQueryMethod, computeQueryQueryParams, contentfulGqlLikePaginationAdapter, createBaseQuery, createBaseQueryCreator, createBearerAuthProvider, createDeleteQuery, createExecuteFn, createGetQuery, createGqlExecuteFn, createGqlMutationViaGet, createGqlMutationViaPost, createGqlQuery, createGqlQueryCreator, createGqlQueryViaGet, createGqlQueryViaPost, createHttpRequest, createInfinityQueryConfig, createLegacyQueryCreator, createPagedQueryStack, createPatchQuery, createPersistentAuthFeature, createPostQuery, createPutQuery, createQuery, createQueryClient, createQueryCollection, createQueryCollectionSignal, createQueryCollectionSubject, createQueryContext, createQueryCreator, createQueryErrorResponse, createQueryFeature, createQueryObject, createQueryRepository, createQuerySnapshotFn, createQueryStack, createSecureDeleteQuery, createSecureExecuteFactory, createSecureExecuteFn, createSecureGetQuery, createSecureGqlExecuteFn, createSecureGqlMutationViaGet, createSecureGqlMutationViaPost, createSecureGqlQuery, createSecureGqlQueryCreator, createSecureGqlQueryViaGet, createSecureGqlQueryViaPost, createSecurePatchQuery, createSecurePostQuery, createSecurePutQuery, createSecureQuery, createSecureQueryCreator, createTrackingFeature, createWebSocketClient, decryptBearer, deepFreeze, def, detectContentTypeHeader, dynLikePaginationAdapter, effectComputed, ethletePaginationAdapter, extractExpiresInSeconds, extractQuery, fakePaginationAdapter, filterFailure, filterNull, filterQueryStates, filterSuccess, forEachHeader, getDefaultHeaders, getQueryFeatureUsage, getResponseUrl, ggLikePaginationAdapter, gql, gqlDataPropertyMissingInResponse, hasHeader, ignoreAutoRefresh, injectInfinityQueryResponseDelay, injectQueryContext, insertFrom, invalidBaseRouteError, invalidBodyError, invalidRouteError, invalidStateInsideSecureExecuteFactory, isAutoRefresh, isBasicAuthProvider, isBearerAuthProvider, isClassValidatorError, isCreateGqlQueryOptions, isCustomHeaderAuthProvider, isEmptyString, isGqlQueryConfig, isLegacyQuery, isNaN, isQuery, isQueryCollection, isQueryStateCancelled, isQueryStateFailure, isQueryStateLoading, isQueryStatePrepared, isQueryStateSuccess, isRequestError, isSymfonyError, isSymfonyFormViolationListError, isSymfonyListError, isSymfonyPagerfantaOutOfRangeError, mapToPaginated, maybeExecute, mergeHeaders, nestedEffect, pagedQueryStackNextPageCalledWithoutPreviousPage, pagedQueryStackPageBiggerThanTotalPages, pagedQueryStackPreviousPageCalledButAlreadyAtFirstPage, paginatedEntityValueUpdater, parseAllXhrResponseHeaders, parseHttpErrorCodeToMessageDe, parseHttpErrorCodeToMessageEn, parseHttpErrorCodeToTitleDe, parseHttpErrorCodeToTitleEn, pathParamsMissingInRouteFunctionError, provideInfinityQueryResponseDelay, provideQueryClientForDevtools, queryArrayComputed, queryComputed, queryComputedTillTruthy, queryExecute, queryFeatureUsedMultipleTimes, queryStackTotalQueriesAndExpectedQueriesMismatch, queryStackWithArgsUsed, queryStackWithResponseUpdateUsed, queryStateAlreadyHasKeyError, queryStateCannotTransformError, queryStateDoesNotContainKeyError, queryStateErrorSignal, queryStateLoadingSignal, queryStateResponseSignal, queryStateSignal, removeFrom, request, resetExecuteState, resetPageOnError, serializeBody, setupQueryDependencies, setupQueryExecuteState, setupQueryState, shouldAutoExecuteGqlQuery, shouldAutoExecuteQuery, shouldCacheQuery, shouldRetryRequest, silenceMissingWithArgsFeatureErrorUsedButWithArgsPresent, skipPaginationPageParamCalculator, splitQueryConfig, switchQueryCollectionState, switchQueryState, takeUntilResponse, toQuerySignal, toQuerySubject, tokensNotAvailableInsideAuthAndExec, transformArrayResponse, transformExecStateToQueryState, transformGql, transformMethod, transformPaginatedResponse, transformToBoolean, transformToBooleanArray, transformToDate, transformToDateArray, transformToNumber, transformToNumberArray, transformToSort, transformToSortQueryParam, transformToString, transformToStringArray, uncacheableRequestHasAllowCacheParam, uncacheableRequestHasCacheKeyParam, v2BuildQueryCacheKey, v2ExtractExpiresInSeconds, v2ShouldCacheQuery, v2ShouldRetryRequest, withArgs, withArgsQueryFeatureMissingButRouteIsFunction, withAuthenticationQuery, withAutoRefresh, withAutoRefreshUsedInManualQuery, withAutoRefreshUsedOnUnsupportedHttpMethod, withErrorHandling, withInactivityLogout, withLogging, withPersistentAuth, withPolling, withPollingUsedOnUnsupportedHttpMethod, withRefreshQuery, withResponseUpdate, withSuccessHandling, withTokenExpirationWarning, withTokenRevocation, withTracking, wrapAsObservableSignal };
|
|
3874
|
-
export type { AnyBearerAuthProvider, AnyCreateBearerAuthProviderResult, AnyCreateGqlQueryCreatorOptions, AnyCreateQueryClientResult, AnyGqlQueryConfig, AnyInfinityQuery, AnyInfinityQueryConfig, AnyLegacyQuery, AnyLegacyQueryCreator, AnyNewQuery, AnyPagedQueryStack, AnyQueryBuilder, AnyQueryClient, AnyQueryCollection, AnyQueryCollectionData, AnyQueryCollectionResponse, AnyQueryCreator, AnyQueryCreatorCollection, AnyQueryForm, AnyQuerySnapshot, AnyQueryStack, AnyRestQueryConfig, AnyRoute, AnyV2Query, AnyV2QueryCreator, AnyWebSocketClient, AppendItemsLocation, AuthProvider, AuthProviderBasicConfig, AuthProviderBearerConfig, AuthProviderCustomHeaderConfig, AuthQueryBuilder, AuthQueryConfig, BaseArguments, BaseQueryCreatorFactoryOptions, BaseQueryCreatorOptions, BaseQueryCreatorOptionsSubtle, BearerAuthFeature, BearerAuthProvider, BearerAuthProviderFeatureContext, BearerAuthProviderQueryContext, BearerAuthProviderRef, BearerAuthProviderTokens, BearerRefreshConfig, BodyType, BuildQueryStringConfig, CacheAdapterFn, Cancelled, ClassValidatorError, ClearQueryArgs, ConstructQuery, CreateBaseQueryOptions, CreateBearerAuthProviderConfig, CreateGqlQueryCreatorOptions, CreateGqlQueryExecuteOptions, CreateGqlQueryOptions, CreateHttpRequestDependencies, CreateHttpRequestOptions, CreateLegacyQueryCreatorOptions, CreateLegacyQueryOptions, CreatePagedQueryStackOptions, CreateQueryClientConfigOptions, CreateQueryCreatorOptions, CreateQueryExecuteOptions, CreateQueryObjectOptions, CreateQueryOptions, CreateQueryRepositoryConfig, CreateQuerySnapshotOptions, CreateQueryStackOptions, CreateSecureGqlQueryExecuteOptions, CreateSecureGqlQueryOptions, CreateSecureQueryExecuteOptions, CreateSecureQueryOptions, CreateWebSocketClientConfigOptions, CreateWebSocketClientTransport, DestroyCleanupCallback, EmptyObject, EntityGetParams, EntityIdParams, EntityKey, EntitySetParams, EntityStoreConfig, ExecuteFactory, ExecuteQueryOptions, ExtractQueryArgs, ExtractQueryKey, Failure, FeatureRegistry, GQL, GqlQueryArgs, GqlQueryConfig, GqlQueryConfigWithoutMethod, GqlQueryMethod, GqlQueryTransport, GqlTransferOption, GqlTransformer, GqlVariablesType, HttpErrorEvent, HttpRequest, HttpRequestLoadingProgressState, HttpRequestLoadingState, HttpRequestResponseType, HttpRequestTransferCacheConfig, InactivityLogoutConfig, InactivityLogoutFeature, InfinityQueryConfig, InfinityQueryConfigType, InfinityQueryOf, InfinityQueryParamLocation, InsertFromConfig, InternalCreateGqlQueryCreatorOptions, InternalCreateQueryCreatorOptions, InternalQueryExecute, InternalSecureCreateGqlQueryCreatorOptions, InternalSecureCreateQueryCreatorOptions, InternalWebSocketRoom, LeaderInstanceCountChangeEventData, LeaderStatusChangeEventData, LegacyArgumentsOfQueryArgs, LegacyQueryPrepareFn, Loading, Method, ObservableSignal, OptionalQueryFieldOptions, PageParamCalculatorOptions, PagedQueryStack, PagedQueryStackDirection, PagedQueryStackExecuteOptions, PagedQueryStackResetOptions, PartialXhrState, PathParams, PathParamsType, PersistentAuthConfig, PersistentAuthFeature, PollConfig, Prepared, Query, QueryArgs, QueryArgsOf, QueryArgsOfLegacyArguments, QueryAutoRefreshConfig, QueryBase, QueryClient, QueryClientDevtoolsOptions, QueryClientRef, QueryCollectionKeysOf, QueryCollectionOf, QueryCollectionWithNullableQuery, QueryConfig, QueryConfigBase, QueryConfigWithoutMethod, QueryContainerConfig, QueryContext, QueryCreator, QueryDataOf, QueryDependencies, QueryDirectiveContext, QueryDirectiveType, QueryEntityConfig, QueryErrorResponse, QueryErrorResponseItem, QueryErrorResponseList, QueryErrorResponseSingle, QueryExecute, QueryExecuteArgs, QueryExecuteEventData, QueryExecuteOptions, QueryExecuteState, QueryExecutionState, QueryExecutionStateFailure, QueryExecutionStateLoading, QueryExecutionStateLoadingWithCachedResponse, QueryExecutionStateLoadingWithNoResponse, QueryExecutionStateSuccess, QueryFailureEventData, QueryFeature, QueryFeatureContext, QueryFeatureFlags, QueryFeatureFn, QueryFieldOptions, QueryFilterConfig, QueryFormGroup, QueryFormGroupControls, QueryFormObserveOptions, QueryFormOf, QueryFormOptions, QueryFormValue, QueryFormValueEvent, QueryFormWriteOptions, QueryKey, QueryMethod, QueryMockConfig, QueryOf, QueryParams, QueryParamsType, QueryPrepareFn, QueryRegistry, QueryRepository, QueryRepositoryDependencies, QueryRepositoryEvent, QueryRepositoryItem, QueryRepositoryRequestOptions, QueryResponseOf, QueryRouteOf, QuerySnapshot, QueryStack, QueryStackSubtle, QueryState, QueryStateMeta, QueryStateResponseOf, QueryStateSignal, QueryStateSubtle, QueryStateSuccessMeta, QueryStoreIdOf, QueryStoreOf, QuerySubtle, QuerySuccessEventData, QueryTrigger, RawResponseType, ReadonlyQuery, RemoveFromConfig, RequestArgs, RequestConfig, RequestError, RequestEvent, RequestHeaders, RequestHeadersMethodMap, RequestHttpEvent, RequestProgress, RequestRetryFn, RequestRetryFnConfig, RequestRetryFnResult, RequiresTransform, ResetExecuteStateOptions, ResetPageOnErrorOperatorConfig, ResponseType, RestQueryConfig, RouteString, RouteType, RunQueryCreator, RunQueryExecuteOptions, SecureExecuteFactoryOptions, SetupQueryDependenciesOptions, SetupQueryStateOptions, ShouldRetryRequestFn, ShouldRetryRequestOptions, ShouldRetryRequestResult, SocketMessageView, Sort, SortDirection, Success, SymfonyError, SymfonyErrorTrace, TokenExpirationWarningConfig, TokenExpirationWarningFeature, TokenRefreshEventData, TokenRefreshQueryBuilder, TokenRefreshQueryConfig, TokenResponse, TokenRevocationConfig, TokenRevocationFeature, TotalPagesExtractorOptions, TrackingConfig, TrackingEventDataMap, TrackingEventHandler, TrackingEventName, TrackingFeature, TransformedGqlQuery, V2CacheAdapterFn, V2QueryArgsOf, V2QueryClientConfig, V2QueryConfig, V2QueryState, V2RouteString, V2RouteType, WebSocketClient, WebSocketClientResult, WebSocketClientSubtle, WebSocketRoom, WithAutoRefreshFeatureOptions, WithBody, WithConfig, WithErrorHandlingFeatureOptions, WithHeaders, WithInjector, WithLegacyConfig, WithLoggingFeatureOptions, WithMock, WithPathParams, WithPollingFeatureOptions, WithQueryParams, WithResponseUpdateFeatureFnData, WithResponseUpdateFeatureOptions, WithSuccessHandlingFeatureOptions, WithVariables };
|
|
4894
|
+
export { AuthBearerRefreshStrategy, BasicAuthProvider, BearerAuthFeatureType, BooleanArrayQueryField, CLEAR_QUERY_ARGS, CustomHeaderAuthProvider, DEFAULT_KEEP_UNUSED_FOR, DateArrayQueryField, DateQueryField, EntityStore, IGNORED_FILTER_COUNT_FIELDS, INFINITY_QUERY_TOKEN, InfinityQuery, InfinityQueryDirective, InfinityQueryTriggerDirective, LegacyQuery, LegacyQueryCreator, MAX_UNUSED_ENTRIES, NumberArrayQueryField, ParseHttpErrorCodeToMessageDePipe, ParseHttpErrorCodeToMessageEnPipe, ParseHttpErrorCodeToTitleDePipe, ParseHttpErrorCodeToTitleEnPipe, QUERY_CLIENT_DEVTOOLS_TOKEN, QueryDevtoolsComponent, QueryDirective, QueryError, QueryFeatureType, QueryField, QueryForm, QueryFormSignals, QueryRuntimeErrorCode, QueryShortNamePipe, QueryStateType, QueryStore, SERVER_ERROR_KIND, SERVER_VIOLATION_ERROR_KIND, SPEED_BUFFER_TIME_IN_MS, SearchQueryField, SortQueryField, StringArrayQueryField, V2BearerAuthProvider, V2Query, V2QueryClient, V2QueryCreator, addQueryContainerHandling, applyQueryFeatures, authExtractTokensResponseMissingAccessToken, authExtractTokensResponseMissingRefreshToken, authExtractTokensResponseNotObject, authProviderFeatureUsedMultipleTimes, booleanArrayQueryField, buildErrorMessage, buildQueryCacheKey, buildQueryString, buildRoute, buildTimestampFromSeconds, castQueryCreatorTypes, circularQueryDependency, circularQueryDependencyChecker, computeQueryAuthHeader, computeQueryBody, computeQueryHeaders, computeQueryMethod, computeQueryQueryParams, contentfulGqlLikePaginationAdapter, createBaseQuery, createBaseQueryCreator, createBearerAuthProvider, createDeleteQuery, createExecuteFn, createGetQuery, createGqlExecuteFn, createGqlMutationViaGet, createGqlMutationViaPost, createGqlQuery, createGqlQueryCreator, createGqlQueryViaGet, createGqlQueryViaPost, createHttpRequest, createInfinityQueryConfig, createLegacyQueryCreator, createPagedQueryStack, createPatchQuery, createPersistentAuthFeature, createPostQuery, createPutQuery, createQuery, createQueryClient, createQueryCollection, createQueryCollectionSignal, createQueryCollectionSubject, createQueryContext, createQueryCreator, createQueryErrorResponse, createQueryFeature, createQueryForm, createQueryObject, createQueryRepository, createQuerySnapshotFn, createQueryStack, createSecureDeleteQuery, createSecureExecuteFactory, createSecureExecuteFn, createSecureGetQuery, createSecureGqlExecuteFn, createSecureGqlMutationViaGet, createSecureGqlMutationViaPost, createSecureGqlQuery, createSecureGqlQueryCreator, createSecureGqlQueryViaGet, createSecureGqlQueryViaPost, createSecurePatchQuery, createSecurePostQuery, createSecurePutQuery, createSecureQuery, createSecureQueryCreator, createTrackingFeature, createWebSocketClient, dateArrayQueryField, dateQueryField, decryptBearer, deepFreeze, def, detectContentTypeHeader, dynLikePaginationAdapter, effectComputed, emptyQueryArgs, ethletePaginationAdapter, executeUntilSettled, extractExpiresInSeconds, extractFormViolations, extractQuery, fakePaginationAdapter, filterFailure, filterNull, filterQueryStates, filterSuccess, forEachHeader, getDefaultHeaders, getQueryFeatureUsage, getResponseUrl, ggLikePaginationAdapter, gql, gqlDataPropertyMissingInResponse, hasHeader, ignoreAutoRefresh, injectInfinityQueryResponseDelay, injectQueryContext, insertFrom, invalidBaseRouteError, invalidBodyError, invalidRouteError, invalidStateInsideSecureExecuteFactory, isAutoRefresh, isBasicAuthProvider, isBearerAuthProvider, isClassValidatorError, isCreateGqlQueryOptions, isCustomHeaderAuthProvider, isEmptyString, isGqlQueryConfig, isLegacyQuery, isNaN, isPageOutOfRangeError, isQuery, isQueryCollection, isQueryErrorResponse, isQueryStateCancelled, isQueryStateFailure, isQueryStateLoading, isQueryStatePrepared, isQueryStateSuccess, isRequestError, isSymfonyError, isSymfonyFormViolationListError, isSymfonyListError, isSymfonyPagerfantaOutOfRangeError, legacyPrepareWithoutInjectionContext, mapToPaginated, mapViolationsToFormErrors, maybeExecute, mergeHeaders, nestedEffect, numberArrayQueryField, pagedQueryStackNextPageCalledWithoutPreviousPage, pagedQueryStackPageBiggerThanTotalPages, pagedQueryStackPreviousPageCalledButAlreadyAtFirstPage, paginatedEntityValueUpdater, parseAllXhrResponseHeaders, parseHttpErrorCodeToMessageDe, parseHttpErrorCodeToMessageEn, parseHttpErrorCodeToTitleDe, parseHttpErrorCodeToTitleEn, pathParamsMissingInRouteFunctionError, provideInfinityQueryResponseDelay, provideQueryClientForDevtools, provideQueryDevtools, queryArrayComputed, queryComputed, queryComputedTillTruthy, queryDevtoolsEntries, queryErrorMessage, queryErrorMessages, queryExecute, queryFeatureUsedMultipleTimes, queryField, querySequence, querySequenceAlreadyRunning, queryStackTotalQueriesAndExpectedQueriesMismatch, queryStackWithArgsUsed, queryStackWithResponseUpdateUsed, queryStateAlreadyHasKeyError, queryStateCannotTransformError, queryStateDoesNotContainKeyError, queryStateErrorSignal, queryStateLoadingSignal, queryStateResponseSignal, queryStateSignal, removeFrom, request, resetExecuteState, resetPageOnError, searchQueryField, serializeBody, setupQueryDependencies, setupQueryExecuteState, setupQueryState, shouldAutoExecuteGqlQuery, shouldAutoExecuteQuery, shouldCacheQuery, shouldRetryRequest, silenceMissingWithArgsFeatureErrorUsedButWithArgsPresent, skipPaginationPageParamCalculator, sortQueryField, splitQueryConfig, stringArrayQueryField, switchQueryCollectionState, switchQueryState, takeUntilResponse, toQuerySignal, toQuerySubject, tokensNotAvailableInsideAuthAndExec, transformArrayResponse, transformExecStateToQueryState, transformGql, transformMethod, transformPaginatedResponse, transformToBoolean, transformToBooleanArray, transformToDate, transformToDateArray, transformToNumber, transformToNumberArray, transformToSort, transformToSortQueryParam, transformToString, transformToStringArray, uncacheableRequestHasAllowCacheParam, uncacheableRequestHasCacheKeyParam, v2BuildQueryCacheKey, v2ExtractExpiresInSeconds, v2ShouldCacheQuery, v2ShouldRetryRequest, validateWithQuery, validateWithV2Query, withArgs, withArgsQueryFeatureMissingButRouteIsFunction, withAuthenticationQuery, withAutoRefresh, withAutoRefreshUsedInManualQuery, withAutoRefreshUsedOnUnsupportedHttpMethod, withErrorHandling, withInactivityLogout, withLogging, withPageResetOnError, withPersistentAuth, withPolling, withPollingUsedOnUnsupportedHttpMethod, withRefreshQuery, withResponseUpdate, withSuccessHandling, withTokenExpirationWarning, withTokenRevocation, withTracking, wrapAsObservableSignal };
|
|
4895
|
+
export type { AnyBearerAuthProvider, AnyCreateBearerAuthProviderResult, AnyCreateGqlQueryCreatorOptions, AnyCreateQueryClientResult, AnyGqlQueryConfig, AnyInfinityQuery, AnyInfinityQueryConfig, AnyLegacyQuery, AnyLegacyQueryCreator, AnyNewQuery, AnyPagedQueryStack, AnyQueryBuilder, AnyQueryClient, AnyQueryCollection, AnyQueryCollectionData, AnyQueryCollectionResponse, AnyQueryCreator, AnyQueryCreatorCollection, AnyQueryForm, AnyQuerySnapshot, AnyQueryStack, AnyRestQueryConfig, AnyRoute, AnyV2Query, AnyV2QueryCreator, AnyWebSocketClient, AppendItemsLocation, AuthProvider, AuthProviderBasicConfig, AuthProviderBearerConfig, AuthProviderCustomHeaderConfig, AuthQueryBuilder, AuthQueryConfig, BaseArguments, BaseQueryCreatorFactoryOptions, BaseQueryCreatorOptions, BaseQueryCreatorOptionsSubtle, BearerAuthExecutionState, BearerAuthExecutionStateError, BearerAuthExecutionStateLoading, BearerAuthExecutionStateLogout, BearerAuthExecutionStateSuccess, BearerAuthFeature, BearerAuthProvider, BearerAuthProviderFeatureContext, BearerAuthProviderOf, BearerAuthProviderQueryContext, BearerAuthProviderRef, BearerAuthProviderTokens, BearerRefreshConfig, BodyType, BuildQueryStringConfig, CacheAdapterFn, Cancelled, ClassValidatorError, ClearQueryArgs, ConstructQuery, CreateBaseQueryOptions, CreateBearerAuthProviderConfig, CreateGqlQueryCreatorOptions, CreateGqlQueryExecuteOptions, CreateGqlQueryOptions, CreateHttpRequestDependencies, CreateHttpRequestOptions, CreateLegacyQueryCreatorOptions, CreateLegacyQueryOptions, CreatePagedQueryStackOptions, CreateQueryClientConfigOptions, CreateQueryCreatorOptions, CreateQueryExecuteOptions, CreateQueryFormConfig, CreateQueryObjectOptions, CreateQueryOptions, CreateQueryRepositoryConfig, CreateQuerySnapshotOptions, CreateQueryStackOptions, CreateSecureGqlQueryExecuteOptions, CreateSecureGqlQueryOptions, CreateSecureQueryExecuteOptions, CreateSecureQueryOptions, CreateWebSocketClientConfigOptions, CreateWebSocketClientTransport, DestroyCleanupCallback, EmptyObject, EntityGetParams, EntityIdParams, EntityKey, EntitySetParams, EntityStoreConfig, ExecuteFactory, ExecuteQueryOptions, ExtractQueryArgs, ExtractQueryKey, Failure, FeatureRegistry, GQL, GqlQueryArgs, GqlQueryConfig, GqlQueryConfigWithoutMethod, GqlQueryMethod, GqlQueryTransport, GqlTransferOption, GqlTransformer, GqlVariablesType, HttpErrorEvent, HttpRequest, HttpRequestLoadingProgressState, HttpRequestLoadingState, HttpRequestResponseType, HttpRequestTransferCacheConfig, InactivityLogoutConfig, InactivityLogoutFeature, InfinityQueryConfig, InfinityQueryConfigType, InfinityQueryOf, InfinityQueryParamLocation, InsertFromConfig, InternalCreateGqlQueryCreatorOptions, InternalCreateQueryCreatorOptions, InternalQueryExecute, InternalSecureCreateGqlQueryCreatorOptions, InternalSecureCreateQueryCreatorOptions, InternalWebSocketRoom, LeaderInstanceCountChangeEventData, LeaderStatusChangeEventData, LegacyArgumentsOfQueryArgs, LegacyQueryPrepareFn, Loading, MapViolationsToFormErrorsOptions, Method, ObservableSignal, OptionalQueryFieldOptions, PageParamCalculatorOptions, PagedQueryStack, PagedQueryStackDirection, PagedQueryStackExecuteOptions, PagedQueryStackResetOptions, PartialXhrState, PathParams, PathParamsType, PersistentAuthConfig, PersistentAuthFeature, PollConfig, Prepared, Query, QueryArgs, QueryArgsOf, QueryArgsOfLegacyArguments, QueryAutoRefreshConfig, QueryBase, QueryClient, QueryClientDevtoolsOptions, QueryClientRef, QueryCollectionKeysOf, QueryCollectionOf, QueryCollectionWithNullableQuery, QueryConfig, QueryConfigBase, QueryConfigWithoutMethod, QueryContainerConfig, QueryContext, QueryCreator, QueryDataOf, QueryDependencies, QueryDevtoolsEntry, QueryDevtoolsEntryKind, QueryDevtoolsEntryMeta, QueryDirectiveContext, QueryDirectiveType, QueryEntityConfig, QueryErrorResponse, QueryErrorResponseItem, QueryErrorResponseList, QueryErrorResponseSingle, QueryExecute, QueryExecuteArgs, QueryExecuteEventData, QueryExecuteOptions, QueryExecuteState, QueryExecutionState, QueryExecutionStateFailure, QueryExecutionStateLoading, QueryExecutionStateLoadingWithCachedResponse, QueryExecutionStateLoadingWithNoResponse, QueryExecutionStateSuccess, QueryFailureEventData, QueryFeature, QueryFeatureContext, QueryFeatureFlags, QueryFeatureFn, QueryFieldConfig, QueryFieldDef, QueryFieldOptions, QueryFieldValue, QueryFilterConfig, QueryFormBranch, QueryFormChange, QueryFormFields, QueryFormGroup, QueryFormGroupControls, QueryFormModel, QueryFormObserveOptions, QueryFormOf, QueryFormOptions, QueryFormSignalsObserveOptions, QueryFormSignalsWriteOptions, QueryFormValue, QueryFormValueEvent, QueryFormWriteOptions, QueryKey, QueryMethod, QueryMockConfig, QueryOf, QueryParams, QueryParamsType, QueryPrepareFn, QueryRegistry, QueryRegistryEntry, QueryRepository, QueryRepositoryCacheEntry, QueryRepositoryDependencies, QueryRepositoryEvent, QueryRepositoryItem, QueryRepositoryRequestOptions, QueryRepositorySubtle, QueryResponseOf, QueryRouteOf, QuerySequence, QuerySequenceResult, QuerySequenceStatus, QuerySequenceStepArgs, QuerySnapshot, QueryStack, QueryStackSubtle, QueryState, QueryStateMeta, QueryStateResponseOf, QueryStateSignal, QueryStateSubtle, QueryStateSuccessMeta, QueryStoreIdOf, QueryStoreOf, QuerySubtle, QuerySuccessEventData, QueryTrigger, RawResponseType, ReadonlyQuery, RemoveFromConfig, RequestArgs, RequestConfig, RequestError, RequestEvent, RequestHeaders, RequestHeadersMethodMap, RequestHttpEvent, RequestProgress, RequestRetryFn, RequestRetryFnConfig, RequestRetryFnResult, RequiresTransform, ResetExecuteStateOptions, ResetPageOnErrorOperatorConfig, ResponseType, RestQueryConfig, RouteString, RouteType, RunQueryCreator, RunQueryExecuteOptions, SecureExecuteFactoryOptions, ServerValidationError, ServerViolationValidationError, SetupQueryDependenciesOptions, SetupQueryStateOptions, ShouldRetryRequestFn, ShouldRetryRequestOptions, ShouldRetryRequestResult, SocketMessageView, Sort, SortDirection, Success, SymfonyError, SymfonyErrorTrace, TokenExpirationWarningConfig, TokenExpirationWarningFeature, TokenRefreshEventData, TokenRefreshQueryBuilder, TokenRefreshQueryConfig, TokenResponse, TokenRevocationConfig, TokenRevocationFeature, TotalPagesExtractorOptions, TrackingConfig, TrackingEventDataMap, TrackingEventHandler, TrackingEventName, TrackingFeature, TransformedGqlQuery, V2CacheAdapterFn, V2PrepareArgsOf, V2QueryArgsOf, V2QueryClientConfig, V2QueryConfig, V2QueryState, V2RouteString, V2RouteType, ValidateWithQueryConfig, ValidateWithV2QueryConfig, WebSocketClient, WebSocketClientResult, WebSocketClientSubtle, WebSocketDevtoolsHandle, WebSocketDevtoolsMessage, WebSocketRoom, WithAutoRefreshFeatureOptions, WithBody, WithConfig, WithErrorHandlingFeatureOptions, WithHeaders, WithInjector, WithLegacyConfig, WithLoggingFeatureOptions, WithMock, WithPageResetOnErrorFeatureOptions, WithPathParams, WithPollingFeatureOptions, WithQueryParams, WithResponseUpdateFeatureFnData, WithResponseUpdateFeatureOptions, WithSuccessHandlingFeatureOptions, WithVariables };
|