@ethlete/query 4.11.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.
@@ -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
  }
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethlete/query",
3
- "version": "4.11.0",
3
+ "version": "4.12.0",
4
4
  "dependencies": {
5
5
  "tslib": "^2.5.0"
6
6
  },