@ngrx/data 15.2.1 → 15.3.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.
- package/esm2020/src/actions/entity-action.mjs +1 -1
- package/esm2020/src/dataservices/default-data.service.mjs +57 -23
- package/esm2020/src/dataservices/interfaces.mjs +1 -1
- package/esm2020/src/effects/entity-effects.mjs +9 -9
- package/fesm2015/ngrx-data.mjs +65 -31
- package/fesm2015/ngrx-data.mjs.map +1 -1
- package/fesm2020/ngrx-data.mjs +64 -31
- package/fesm2020/ngrx-data.mjs.map +1 -1
- package/package.json +4 -4
- package/schematics-core/utility/libs-version.js +1 -1
- package/schematics-core/utility/libs-version.js.map +1 -1
- package/src/actions/entity-action.d.ts +3 -0
- package/src/dataservices/default-data.service.d.ts +10 -9
- package/src/dataservices/interfaces.d.ts +42 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrx/data",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.3.0",
|
|
4
4
|
"description": "API management for NgRx",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@angular/common": "^15.0.0",
|
|
24
24
|
"@angular/core": "^15.0.0",
|
|
25
|
-
"@ngrx/store": "15.
|
|
26
|
-
"@ngrx/effects": "15.
|
|
27
|
-
"@ngrx/entity": "15.
|
|
25
|
+
"@ngrx/store": "15.3.0",
|
|
26
|
+
"@ngrx/effects": "15.3.0",
|
|
27
|
+
"@ngrx/entity": "15.3.0",
|
|
28
28
|
"rxjs": "^6.5.3 || ^7.5.0"
|
|
29
29
|
},
|
|
30
30
|
"schematics": "./schematics/collection.json",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAC","sourcesContent":["export const platformVersion = '^15.
|
|
1
|
+
{"version":3,"file":"libs-version.js","sourceRoot":"","sources":["../../../../../modules/data/schematics-core/utility/libs-version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAC","sourcesContent":["export const platformVersion = '^15.3.0';\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Action } from '@ngrx/store';
|
|
2
2
|
import { EntityOp } from './entity-op';
|
|
3
3
|
import { MergeStrategy } from './merge-strategy';
|
|
4
|
+
import { HttpOptions } from '../dataservices/interfaces';
|
|
4
5
|
/** Action concerning an entity collection. */
|
|
5
6
|
export interface EntityAction<P = any> extends Action {
|
|
6
7
|
readonly type: string;
|
|
@@ -15,6 +16,8 @@ export interface EntityActionOptions {
|
|
|
15
16
|
readonly mergeStrategy?: MergeStrategy;
|
|
16
17
|
/** The tag to use in the action's type. The entityName if no tag specified. */
|
|
17
18
|
readonly tag?: string;
|
|
19
|
+
/** Options that will be passed to the dataService http request. Allows setting of Query Parameters and Headers */
|
|
20
|
+
readonly httpOptions?: HttpOptions;
|
|
18
21
|
/**
|
|
19
22
|
* The action was determined (usually by a reducer) to be in error.
|
|
20
23
|
* Downstream effects should not process but rather treat it as an error.
|
|
@@ -2,7 +2,7 @@ import { HttpClient } from '@angular/common/http';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { Update } from '@ngrx/entity';
|
|
4
4
|
import { DefaultDataServiceConfig } from './default-data-service-config';
|
|
5
|
-
import { EntityCollectionDataService, HttpMethods, QueryParams } from './interfaces';
|
|
5
|
+
import { EntityCollectionDataService, HttpMethods, HttpOptions, QueryParams } from './interfaces';
|
|
6
6
|
import { HttpUrlGenerator } from './http-url-generator';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
8
|
/**
|
|
@@ -24,15 +24,16 @@ export declare class DefaultDataService<T> implements EntityCollectionDataServic
|
|
|
24
24
|
protected trailingSlashEndpoints: boolean;
|
|
25
25
|
get name(): string;
|
|
26
26
|
constructor(entityName: string, http: HttpClient, httpUrlGenerator: HttpUrlGenerator, config?: DefaultDataServiceConfig);
|
|
27
|
-
add(entity: T): Observable<T>;
|
|
28
|
-
delete(key: number | string): Observable<number | string>;
|
|
29
|
-
getAll(): Observable<T[]>;
|
|
30
|
-
getById(key: number | string): Observable<T>;
|
|
31
|
-
getWithQuery(queryParams: QueryParams | string): Observable<T[]>;
|
|
32
|
-
update(update: Update<T
|
|
33
|
-
upsert(entity: T): Observable<T>;
|
|
27
|
+
add(entity: T, options?: HttpOptions): Observable<T>;
|
|
28
|
+
delete(key: number | string, options?: HttpOptions): Observable<number | string>;
|
|
29
|
+
getAll(options?: HttpOptions): Observable<T[]>;
|
|
30
|
+
getById(key: number | string, options?: HttpOptions): Observable<T>;
|
|
31
|
+
getWithQuery(queryParams: QueryParams | string | undefined, options?: HttpOptions): Observable<T[]>;
|
|
32
|
+
update(update: Update<T>, options?: HttpOptions): Observable<T>;
|
|
33
|
+
upsert(entity: T, options?: HttpOptions): Observable<T>;
|
|
34
34
|
protected execute(method: HttpMethods, url: string, data?: any, // data, error, or undefined/null
|
|
35
|
-
options?: any
|
|
35
|
+
options?: any, // options or undefined/null
|
|
36
|
+
httpOptions?: HttpOptions): Observable<any>;
|
|
36
37
|
private handleError;
|
|
37
38
|
private handleDelete404;
|
|
38
39
|
}
|
|
@@ -3,13 +3,13 @@ import { Update } from '@ngrx/entity';
|
|
|
3
3
|
/** A service that performs REST-like HTTP data operations for an entity collection */
|
|
4
4
|
export interface EntityCollectionDataService<T> {
|
|
5
5
|
readonly name: string;
|
|
6
|
-
add(entity: T): Observable<T>;
|
|
7
|
-
delete(id: number | string): Observable<number | string>;
|
|
8
|
-
getAll(): Observable<T[]>;
|
|
9
|
-
getById(id: any): Observable<T>;
|
|
10
|
-
getWithQuery(params: QueryParams | string): Observable<T[]>;
|
|
11
|
-
update(update: Update<T
|
|
12
|
-
upsert(entity: T): Observable<T>;
|
|
6
|
+
add(entity: T, httpOptions?: HttpOptions): Observable<T>;
|
|
7
|
+
delete(id: number | string, httpOptions?: HttpOptions): Observable<number | string>;
|
|
8
|
+
getAll(httpOptions?: HttpOptions): Observable<T[]>;
|
|
9
|
+
getById(id: any, httpOptions?: HttpOptions): Observable<T>;
|
|
10
|
+
getWithQuery(params: QueryParams | string, httpOptions?: HttpOptions): Observable<T[]>;
|
|
11
|
+
update(update: Update<T>, httpOptions?: HttpOptions): Observable<T>;
|
|
12
|
+
upsert(entity: T, httpOptions?: HttpOptions): Observable<T>;
|
|
13
13
|
}
|
|
14
14
|
export declare type HttpMethods = 'DELETE' | 'GET' | 'POST' | 'PUT';
|
|
15
15
|
export interface RequestData {
|
|
@@ -20,9 +20,42 @@ export interface RequestData {
|
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* A key/value map of parameters to be turned into an HTTP query string
|
|
23
|
-
* Same as HttpClient's HttpParamsOptions which
|
|
23
|
+
* Same as HttpClient's HttpParamsOptions which at the time of writing was
|
|
24
|
+
* NOT exported at package level
|
|
24
25
|
* https://github.com/angular/angular/issues/22013
|
|
26
|
+
*
|
|
27
|
+
* @deprecated Use HttpOptions instead. getWithQuery still accepts QueryParams as its
|
|
28
|
+
* first argument, but HttpOptions.httpParams uses Angular's own HttpParamsOptions which
|
|
29
|
+
* HttpClient accepts as an argument.
|
|
25
30
|
*/
|
|
26
31
|
export interface QueryParams {
|
|
27
|
-
[name: string]: string | string
|
|
32
|
+
[name: string]: string | number | boolean | ReadonlyArray<string | number | boolean>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Options that adhere to the constructor arguments for HttpParams and
|
|
36
|
+
* HttpHeaders.
|
|
37
|
+
*/
|
|
38
|
+
export interface HttpOptions {
|
|
39
|
+
httpParams?: HttpParams;
|
|
40
|
+
httpHeaders?: HttpHeaders;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Type that adheres to angular's Http Headers
|
|
44
|
+
*/
|
|
45
|
+
export declare type HttpHeaders = string | {
|
|
46
|
+
[p: string]: string | string[];
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Options that partially adheres to angular's HttpParamsOptions. The non-serializable encoder property is omitted.
|
|
50
|
+
*/
|
|
51
|
+
export declare interface HttpParams {
|
|
52
|
+
/**
|
|
53
|
+
* String representation of the HTTP parameters in URL-query-string format.
|
|
54
|
+
* Mutually exclusive with `fromObject`.
|
|
55
|
+
*/
|
|
56
|
+
fromString?: string;
|
|
57
|
+
/** Object map of the HTTP parameters. Mutually exclusive with `fromString`. */
|
|
58
|
+
fromObject?: {
|
|
59
|
+
[param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>;
|
|
60
|
+
};
|
|
28
61
|
}
|