@ethlete/query 4.10.0 → 4.12.0

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.
@@ -56,6 +56,24 @@ export interface BearerRefreshConfig<T extends AnyQueryCreator> {
56
56
  * The cookie name where the refresh token is stored
57
57
  */
58
58
  cookieName?: string;
59
+ /**
60
+ * The domain of the cookie. If not set, the current origin will be used.
61
+ *
62
+ * @example
63
+ * "https://example.com" -> "example.com"
64
+ * "https://sub.example.com" -> "example.com"
65
+ */
66
+ cookieDomain?: string;
67
+ /**
68
+ * The days until the cookie expires
69
+ * @default 30
70
+ */
71
+ cookieExpiresInDays?: number;
72
+ /**
73
+ * The path of the cookie
74
+ * @default '/'
75
+ */
76
+ cookiePath?: string;
59
77
  /**
60
78
  * Enable or disable the cookie
61
79
  * @default true
@@ -17,5 +17,7 @@ export declare class BearerAuthProvider<T extends AnyQueryCreator> implements Au
17
17
  cleanUp(): void;
18
18
  enableCookie(): void;
19
19
  disableCookie(): void;
20
+ private _setCookie;
21
+ private _deleteCookie;
20
22
  private _prepareForRefresh;
21
23
  }
@@ -1,8 +1,8 @@
1
- import { BehaviorSubject } from 'rxjs';
2
1
  import { EntityStore } from '../entity';
3
2
  import { QueryClient } from '../query-client';
4
3
  import { QueryStore } from '../query-store';
5
4
  import { BaseArguments, GqlQueryConfig, RestQueryConfig, RouteType } from '../query/query.types';
5
+ import { QueryContainerConfig, QuerySubject } from '../utils';
6
6
  import { QueryPrepareFn } from './query-creator.types';
7
7
  export declare class QueryCreator<Arguments extends BaseArguments | undefined, Response, Route extends RouteType<Arguments>, Store extends EntityStore<unknown>, Data, Id> {
8
8
  private _queryConfig;
@@ -10,5 +10,10 @@ export declare class QueryCreator<Arguments extends BaseArguments | undefined, R
10
10
  private _store;
11
11
  constructor(_queryConfig: RestQueryConfig<Route, Response, Arguments, Store, Data, Id> | GqlQueryConfig<Route, Response, Arguments, Store, Data, Id>, _client: QueryClient, _store: QueryStore);
12
12
  prepare: QueryPrepareFn<Arguments, Response, Route, Store, Data, Id>;
13
- behaviorSubject: (initialValue?: ReturnType<typeof this.prepare> | null) => BehaviorSubject<ReturnType<QueryPrepareFn<Arguments, Response, Route, Store, Data, Id>> | null>;
13
+ createSubject: (initialValue?: ReturnType<typeof this.prepare> | null, config?: QueryContainerConfig) => QuerySubject<ReturnType<QueryPrepareFn<Arguments, Response, Route, Store, Data, Id>> | null>;
14
+ createSignal: (initialValue?: ReturnType<typeof this.prepare> | null, config?: QueryContainerConfig) => void;
15
+ /**
16
+ * @deprecated Use `myQuery.createSubject()` or `myQuery.createSignal()` instead. Will be removed in v5.
17
+ */
18
+ behaviorSubject: (initialValue?: ReturnType<typeof this.prepare> | null, config?: QueryContainerConfig) => QuerySubject<ReturnType<QueryPrepareFn<Arguments, Response, Route, Store, Data, Id>> | null>;
14
19
  }
@@ -1,27 +1,9 @@
1
- import { AbstractControl, FormGroup, ɵValue } from '@angular/forms';
2
- import { QueryFieldOptions, QueryFormGroupControls, QueryFormObserveOptions, QueryFormValue } from './query-form.types';
3
- export declare class QueryFormGroup<T extends {
4
- [K in keyof T]: AbstractControl<any, any>;
5
- } = any> extends FormGroup<T> {
6
- patchValue(value: 0 extends 1 & T ? {
7
- [key: string]: any;
8
- } : Partial<{
9
- [K in keyof T]: ɵValue<T[K]>;
10
- }>, options?: {
11
- onlySelf?: boolean | undefined;
12
- emitEvent?: boolean | undefined;
13
- } | undefined): void;
14
- }
1
+ import { FormGroup } from '@angular/forms';
2
+ import { QueryFieldOptions, QueryFormGroupControls, QueryFormObserveOptions, QueryFormValue, QueryFormValueEvent } from './query-form.types';
15
3
  export declare class QueryField<T> {
16
4
  data: QueryFieldOptions<T>;
17
- changes$: import("rxjs").Observable<T | null>;
18
5
  get control(): import("@angular/forms").FormControl<T | null>;
19
- private _currentDebounceTimeout;
20
6
  constructor(data: QueryFieldOptions<T>);
21
- setValue(value: T | null, options?: {
22
- skipDebounce?: boolean;
23
- }): void;
24
- private _setupChangesObservable;
25
7
  }
26
8
  export declare class QueryForm<T extends Record<string, QueryField<any>>> {
27
9
  private _fields;
@@ -32,18 +14,16 @@ export declare class QueryForm<T extends Record<string, QueryField<any>>> {
32
14
  private readonly _defaultValues;
33
15
  private readonly _routerStateService;
34
16
  private readonly _zone;
17
+ private readonly _didValueChanges$;
35
18
  private _isObserving;
36
- readonly form: QueryFormGroup<QueryFormGroupControls<T>>;
19
+ readonly form: FormGroup<QueryFormGroupControls<T>>;
37
20
  private readonly _lastFormValue$;
38
21
  private readonly _currentFormValue$;
39
22
  private get _formValue();
40
23
  private readonly _changes$;
41
- readonly changes$: import("rxjs").Observable<{
42
- previousValue: QueryFormValue<T> | null;
43
- currentValue: QueryFormValue<T>;
44
- }>;
24
+ readonly changes$: import("rxjs").Observable<QueryFormValueEvent<T>>;
45
25
  get controls(): 0 extends 1 & QueryFormGroupControls<T> ? {
46
- [key: string]: AbstractControl<any, any>;
26
+ [key: string]: import("@angular/forms").AbstractControl<any, any>;
47
27
  } : QueryFormGroupControls<T>;
48
28
  get value(): QueryFormValue<T>;
49
29
  constructor(_fields: T);
@@ -52,11 +32,11 @@ export declare class QueryForm<T extends Record<string, QueryField<any>>> {
52
32
  unobserve(): void;
53
33
  setFormValueFromUrlQueryParams(options: {
54
34
  queryParams: Record<string, unknown>;
55
- skipDebounce?: boolean;
56
- }): void;
35
+ }): boolean;
57
36
  private _getDefaultValue;
58
37
  private _isDefaultValue;
59
38
  private _setupFormGroup;
60
39
  private _extractDefaultValues;
61
40
  private _syncViaUrlQueryParams;
41
+ private _handleFormChange;
62
42
  }
@@ -0,0 +1,15 @@
1
+ import { BehaviorSubject } from 'rxjs';
2
+ import { AnyQuery } from '../query';
3
+ export interface QueryContainerConfig {
4
+ /**
5
+ * If `true`, the previous query will be aborted when a new query is pushed into the container.
6
+ * @default false
7
+ */
8
+ abortPrevious?: boolean;
9
+ }
10
+ export declare class QuerySubject<T extends AnyQuery | null> extends BehaviorSubject<T> {
11
+ private _config?;
12
+ constructor(initialValue?: T, _config?: QueryContainerConfig | undefined);
13
+ next(value: T): void;
14
+ }
15
+ export declare const querySignal: <T extends AnyQuery | null>(initialValue?: T, config?: QueryContainerConfig) => void;
@@ -1,2 +1,3 @@
1
+ export * from './data.utils';
1
2
  export * from './deep-freeze.util';
2
3
  export * from './def.util';
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@ethlete/query",
3
- "version": "4.10.0",
3
+ "version": "4.12.0",
4
4
  "dependencies": {
5
5
  "tslib": "^2.5.0"
6
6
  },
7
7
  "peerDependencies": {
8
8
  "@angular/common": "^15.2.1 || ^16.0.0",
9
9
  "@angular/core": "^15.2.1 || ^16.0.0",
10
- "@ethlete/core": "3.3.1"
10
+ "@ethlete/core": "3.4.0"
11
11
  },
12
12
  "module": "fesm2022/ethlete-query.mjs",
13
13
  "typings": "index.d.ts",