ng2-rest 13.2.8 → 13.2.9
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/README.md +135 -135
- package/assets/shared/shared_folder_info.txt +1 -1
- package/browser/README.md +24 -24
- package/browser/esm2020/lib/content-type.mjs +12 -12
- package/browser/esm2020/lib/cookie.mjs +28 -28
- package/browser/esm2020/lib/helpers.mjs +23 -23
- package/browser/esm2020/lib/index.mjs +12 -12
- package/browser/esm2020/lib/mapping.mjs +238 -238
- package/browser/esm2020/lib/models.mjs +159 -159
- package/browser/esm2020/lib/other/simple-resource.mjs +116 -116
- package/browser/esm2020/lib/params.mjs +278 -278
- package/browser/esm2020/lib/request-cache.mjs +100 -100
- package/browser/esm2020/lib/resource.service.mjs +213 -213
- package/browser/esm2020/lib/rest-headers.mjs +128 -128
- package/browser/esm2020/lib/rest-request.mjs +321 -321
- package/browser/esm2020/lib/rest.class.mjs +115 -115
- package/browser/esm2020/ng2-rest.mjs +4 -4
- package/browser/esm2020/public-api.mjs +1 -1
- package/browser/fesm2015/ng2-rest.mjs +1677 -1677
- package/browser/fesm2020/ng2-rest.mjs +1675 -1675
- package/browser/lib/content-type.d.ts +4 -4
- package/browser/lib/cookie.d.ts +7 -7
- package/browser/lib/helpers.d.ts +10 -10
- package/browser/lib/index.d.ts +9 -9
- package/browser/lib/mapping.d.ts +12 -12
- package/browser/lib/models.d.ts +157 -157
- package/browser/lib/other/simple-resource.d.ts +29 -29
- package/browser/lib/params.d.ts +23 -23
- package/browser/lib/request-cache.d.ts +17 -17
- package/browser/lib/resource.service.d.ts +43 -43
- package/browser/lib/rest-headers.d.ts +57 -57
- package/browser/lib/rest-request.d.ts +21 -21
- package/browser/lib/rest.class.d.ts +36 -36
- package/browser/ng2-rest.d.ts +4 -4
- package/client/README.md +24 -24
- package/client/esm2020/lib/content-type.mjs +12 -12
- package/client/esm2020/lib/cookie.mjs +28 -28
- package/client/esm2020/lib/helpers.mjs +23 -23
- package/client/esm2020/lib/index.mjs +12 -12
- package/client/esm2020/lib/mapping.mjs +238 -238
- package/client/esm2020/lib/models.mjs +159 -159
- package/client/esm2020/lib/other/simple-resource.mjs +116 -116
- package/client/esm2020/lib/params.mjs +278 -278
- package/client/esm2020/lib/request-cache.mjs +100 -100
- package/client/esm2020/lib/resource.service.mjs +213 -213
- package/client/esm2020/lib/rest-headers.mjs +128 -128
- package/client/esm2020/lib/rest-request.mjs +321 -321
- package/client/esm2020/lib/rest.class.mjs +115 -115
- package/client/esm2020/ng2-rest.mjs +4 -4
- package/client/esm2020/public-api.mjs +1 -1
- package/client/fesm2015/ng2-rest.mjs +1677 -1677
- package/client/fesm2020/ng2-rest.mjs +1675 -1675
- package/client/lib/content-type.d.ts +4 -4
- package/client/lib/cookie.d.ts +7 -7
- package/client/lib/helpers.d.ts +10 -10
- package/client/lib/index.d.ts +9 -9
- package/client/lib/mapping.d.ts +12 -12
- package/client/lib/models.d.ts +157 -157
- package/client/lib/other/simple-resource.d.ts +29 -29
- package/client/lib/params.d.ts +23 -23
- package/client/lib/request-cache.d.ts +17 -17
- package/client/lib/resource.service.d.ts +43 -43
- package/client/lib/rest-headers.d.ts +57 -57
- package/client/lib/rest-request.d.ts +21 -21
- package/client/lib/rest.class.d.ts +36 -36
- package/client/ng2-rest.d.ts +4 -4
- package/client/package.json +33 -31
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/lib/content-type.d.ts +5 -5
- package/lib/content-type.js.map +1 -1
- package/lib/cookie.d.ts +8 -8
- package/lib/cookie.js.map +1 -1
- package/lib/helpers.d.ts +11 -11
- package/lib/helpers.js.map +1 -1
- package/lib/index.d.ts +10 -10
- package/lib/index.js.map +1 -1
- package/lib/mapping.d.ts +13 -13
- package/lib/mapping.js.map +1 -1
- package/lib/models.d.ts +158 -158
- package/lib/models.js.map +1 -1
- package/lib/other/simple-resource.d.ts +30 -30
- package/lib/other/simple-resource.js.map +1 -1
- package/lib/params.d.ts +24 -24
- package/lib/params.js.map +1 -1
- package/lib/request-cache.d.ts +18 -18
- package/lib/request-cache.js.map +1 -1
- package/lib/resource.service.d.ts +44 -44
- package/lib/resource.service.js.map +1 -1
- package/lib/rest-headers.d.ts +58 -58
- package/lib/rest-headers.js.map +1 -1
- package/lib/rest-request.d.ts +22 -22
- package/lib/rest-request.js.map +1 -1
- package/lib/rest.class.d.ts +37 -37
- package/lib/rest.class.js.map +1 -1
- package/package.json +6 -6
- package/package.json_devDependencies.json +217 -217
- package/package.json_tnp.json5 +53 -53
- package/tmp-environment.json +37 -35
- package/websql/README.md +24 -24
- package/websql/esm2020/lib/content-type.mjs +12 -12
- package/websql/esm2020/lib/cookie.mjs +28 -28
- package/websql/esm2020/lib/helpers.mjs +23 -23
- package/websql/esm2020/lib/index.mjs +12 -12
- package/websql/esm2020/lib/mapping.mjs +238 -238
- package/websql/esm2020/lib/models.mjs +159 -159
- package/websql/esm2020/lib/other/simple-resource.mjs +116 -116
- package/websql/esm2020/lib/params.mjs +278 -278
- package/websql/esm2020/lib/request-cache.mjs +100 -100
- package/websql/esm2020/lib/resource.service.mjs +213 -213
- package/websql/esm2020/lib/rest-headers.mjs +128 -128
- package/websql/esm2020/lib/rest-request.mjs +321 -321
- package/websql/esm2020/lib/rest.class.mjs +115 -115
- package/websql/esm2020/ng2-rest.mjs +4 -4
- package/websql/esm2020/public-api.mjs +1 -1
- package/websql/fesm2015/ng2-rest.mjs +1677 -1677
- package/websql/fesm2020/ng2-rest.mjs +1675 -1675
- package/websql/lib/content-type.d.ts +4 -4
- package/websql/lib/cookie.d.ts +7 -7
- package/websql/lib/helpers.d.ts +10 -10
- package/websql/lib/index.d.ts +9 -9
- package/websql/lib/mapping.d.ts +12 -12
- package/websql/lib/models.d.ts +157 -157
- package/websql/lib/other/simple-resource.d.ts +29 -29
- package/websql/lib/params.d.ts +23 -23
- package/websql/lib/request-cache.d.ts +17 -17
- package/websql/lib/resource.service.d.ts +43 -43
- package/websql/lib/rest-headers.d.ts +57 -57
- package/websql/lib/rest-request.d.ts +21 -21
- package/websql/lib/rest.class.d.ts +36 -36
- package/websql/ng2-rest.d.ts +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { RestHeaders } from "./rest-headers";
|
|
3
|
-
export declare const CONTENT_TYPE: {
|
|
4
|
-
APPLICATION_JSON: RestHeaders;
|
|
5
|
-
APPLICATINO_VND_API_JSON: RestHeaders;
|
|
2
|
+
import { RestHeaders } from "./rest-headers";
|
|
3
|
+
export declare const CONTENT_TYPE: {
|
|
4
|
+
APPLICATION_JSON: RestHeaders;
|
|
5
|
+
APPLICATINO_VND_API_JSON: RestHeaders;
|
|
6
6
|
};
|
package/client/lib/cookie.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
export declare class Cookie {
|
|
3
|
-
static get Instance(): Cookie;
|
|
4
|
-
private static __instance;
|
|
5
|
-
private constructor();
|
|
6
|
-
read(name: string): string;
|
|
7
|
-
write(name: string, value: string, days?: number): void;
|
|
8
|
-
remove(name: string): void;
|
|
2
|
+
export declare class Cookie {
|
|
3
|
+
static get Instance(): Cookie;
|
|
4
|
+
private static __instance;
|
|
5
|
+
private constructor();
|
|
6
|
+
read(name: string): string;
|
|
7
|
+
write(name: string, value: string, days?: number): void;
|
|
8
|
+
remove(name: string): void;
|
|
9
9
|
}
|
package/client/lib/helpers.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { CoreHelpers } from 'tnp-core/browser';
|
|
3
|
-
import { Mapping } from './mapping';
|
|
4
|
-
import { JSON10 } from 'json10/browser';
|
|
5
|
-
export declare class Helpers extends CoreHelpers {
|
|
6
|
-
static JSON: typeof JSON10;
|
|
7
|
-
static get Mapping(): {
|
|
8
|
-
encode<T = Function>(json: Object, mapping: Mapping.Mapping): T;
|
|
9
|
-
decode(json: Object, autodetect?: boolean): Mapping.Mapping;
|
|
10
|
-
};
|
|
11
|
-
static checkValidUrl(url: string): boolean;
|
|
2
|
+
import { CoreHelpers } from 'tnp-core/browser';
|
|
3
|
+
import { Mapping } from './mapping';
|
|
4
|
+
import { JSON10 } from 'json10/browser';
|
|
5
|
+
export declare class Helpers extends CoreHelpers {
|
|
6
|
+
static JSON: typeof JSON10;
|
|
7
|
+
static get Mapping(): {
|
|
8
|
+
encode<T = Function>(json: Object, mapping: Mapping.Mapping): T;
|
|
9
|
+
decode(json: Object, autodetect?: boolean): Mapping.Mapping;
|
|
10
|
+
};
|
|
11
|
+
static checkValidUrl(url: string): boolean;
|
|
12
12
|
}
|
package/client/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
export * from './resource.service';
|
|
3
|
-
export * from './models';
|
|
4
|
-
export * from './mapping';
|
|
5
|
-
export * from './rest.class';
|
|
6
|
-
export * from './rest-headers';
|
|
7
|
-
export * from './helpers';
|
|
8
|
-
export * from './request-cache';
|
|
9
|
-
export * from './content-type';
|
|
10
|
-
export { SimpleResource } from './other/simple-resource';
|
|
2
|
+
export * from './resource.service';
|
|
3
|
+
export * from './models';
|
|
4
|
+
export * from './mapping';
|
|
5
|
+
export * from './rest.class';
|
|
6
|
+
export * from './rest-headers';
|
|
7
|
+
export * from './helpers';
|
|
8
|
+
export * from './request-cache';
|
|
9
|
+
export * from './content-type';
|
|
10
|
+
export { SimpleResource } from './other/simple-resource';
|
|
11
11
|
export { interpolateParamsToUrl } from './params';
|
package/client/lib/mapping.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { Circ } from 'json10/browser';
|
|
3
|
-
export declare namespace Mapping {
|
|
4
|
-
function decode(json: Object, autodetect?: boolean): Mapping;
|
|
5
|
-
function encode<T = Function>(json: Object, mapping: Mapping, circular?: Circ[]): T;
|
|
6
|
-
function getModelsMapping(entity: Function): {};
|
|
7
|
-
type Mapping<T = {}> = {
|
|
8
|
-
[P in keyof T]?: string | string[];
|
|
9
|
-
};
|
|
10
|
-
type ModelValue<T> = {
|
|
11
|
-
[propName in keyof T]?: T[propName];
|
|
12
|
-
};
|
|
13
|
-
function DefaultModelWithMapping<T = Object>(defaultModelValues?: ModelValue<T>, mapping?: Mapping<T>): (target: Function) => void;
|
|
2
|
+
import { Circ } from 'json10/browser';
|
|
3
|
+
export declare namespace Mapping {
|
|
4
|
+
function decode(json: Object, autodetect?: boolean): Mapping;
|
|
5
|
+
function encode<T = Function>(json: Object, mapping: Mapping, circular?: Circ[]): T;
|
|
6
|
+
function getModelsMapping(entity: Function): {};
|
|
7
|
+
type Mapping<T = {}> = {
|
|
8
|
+
[P in keyof T]?: string | string[];
|
|
9
|
+
};
|
|
10
|
+
type ModelValue<T> = {
|
|
11
|
+
[propName in keyof T]?: T[propName];
|
|
12
|
+
};
|
|
13
|
+
function DefaultModelWithMapping<T = Object>(defaultModelValues?: ModelValue<T>, mapping?: Mapping<T>): (target: Function) => void;
|
|
14
14
|
}
|
package/client/lib/models.d.ts
CHANGED
|
@@ -1,159 +1,159 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { Subject } from 'rxjs';
|
|
4
|
-
import { RestHeaders } from './rest-headers';
|
|
5
|
-
import { Rest } from './rest.class';
|
|
6
|
-
import { Cookie } from './cookie';
|
|
7
|
-
import { Mapping } from './mapping';
|
|
8
|
-
import { Models as HelpersModels } from 'typescript-class-helpers/browser';
|
|
9
|
-
import { Circ } from 'json10/browser';
|
|
10
|
-
import { RequestCache } from './request-cache';
|
|
11
|
-
import { ConfigModels } from 'tnp-config/browser';
|
|
12
|
-
export declare namespace Models {
|
|
13
|
-
export import HttpMethod = ConfigModels.HttpMethod;
|
|
14
|
-
export import ParamType = ConfigModels.ParamType;
|
|
15
|
-
export import MethodConfig = HelpersModels.MethodConfig;
|
|
16
|
-
export import ClassConfig = HelpersModels.ClassConfig;
|
|
17
|
-
export import ParamConfig = HelpersModels.ParamConfig;
|
|
18
|
-
interface HandleResultOptions {
|
|
19
|
-
res: Models.MockResponse;
|
|
20
|
-
method: Models.HttpMethod;
|
|
21
|
-
jobid?: number;
|
|
22
|
-
isArray?: boolean;
|
|
23
|
-
}
|
|
24
|
-
interface HandleResultSourceRequestOptions {
|
|
25
|
-
url: string;
|
|
26
|
-
method: Models.HttpMethod;
|
|
27
|
-
body: any;
|
|
28
|
-
isArray: boolean;
|
|
29
|
-
}
|
|
30
|
-
type BackendError = {
|
|
31
|
-
msg?: string;
|
|
32
|
-
stack?: string[];
|
|
33
|
-
data: any;
|
|
34
|
-
};
|
|
35
|
-
type MetaRequest = {
|
|
36
|
-
path: string;
|
|
37
|
-
endpoint: string;
|
|
38
|
-
entity: Mapping.Mapping;
|
|
39
|
-
circular: Circ[];
|
|
40
|
-
};
|
|
41
|
-
type HttpCode = 200 | 400 | 401 | 404 | 500;
|
|
42
|
-
type PromiseObservableMix<T> = Promise<T> & {
|
|
43
|
-
cache?: RequestCache;
|
|
44
|
-
observable: Observable<T>;
|
|
45
|
-
};
|
|
46
|
-
type MethodWithoutBody<E, T, R = PromiseObservableMix<E>> = (params?: UrlParams[], doNotSerializeParams?: boolean) => R;
|
|
47
|
-
type MethodWithBody<E, T, R = PromiseObservableMix<E>> = (item?: T, params?: UrlParams[], doNotSerializeParams?: boolean) => R;
|
|
48
|
-
type ReplayData = {
|
|
49
|
-
subject: Subject<any>;
|
|
50
|
-
data: {
|
|
51
|
-
url: string;
|
|
52
|
-
body: string;
|
|
53
|
-
headers: RestHeaders;
|
|
54
|
-
isArray: boolean;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* jobid
|
|
58
|
-
*/
|
|
59
|
-
id: number;
|
|
60
|
-
};
|
|
61
|
-
type ReqParams = {
|
|
62
|
-
url: string;
|
|
63
|
-
method: ConfigModels.HttpMethod;
|
|
64
|
-
headers?: RestHeaders;
|
|
65
|
-
body?: any;
|
|
66
|
-
jobid: number;
|
|
67
|
-
isArray: boolean;
|
|
68
|
-
};
|
|
69
|
-
interface ResourceModel<A, TA> {
|
|
70
|
-
model: (pathModels?: Object, responseObjectType?: Function) => Rest<A, TA>;
|
|
71
|
-
replay: (method: ConfigModels.HttpMethod) => void;
|
|
72
|
-
headers: RestHeaders;
|
|
73
|
-
}
|
|
74
|
-
interface Ng2RestMethods<E, T> {
|
|
75
|
-
get: MethodWithoutBody<E, T>;
|
|
76
|
-
post: MethodWithBody<E, T>;
|
|
77
|
-
put: MethodWithBody<E, T>;
|
|
78
|
-
patch: MethodWithBody<E, T>;
|
|
79
|
-
head: MethodWithoutBody<E, T>;
|
|
80
|
-
delete: MethodWithoutBody<E, T>;
|
|
81
|
-
jsonp: MethodWithoutBody<E, T>;
|
|
82
|
-
}
|
|
83
|
-
type MockController = (url: string, method: ConfigModels.HttpMethod, headers?: RestHeaders, body?: any) => MockResponse;
|
|
84
|
-
type MockHttp = (MockResponse | MockController);
|
|
85
|
-
interface FnMethodsHttp<T, TA> extends Ng2RestMethods<HttpResponse<T>, T> {
|
|
86
|
-
array: Ng2RestMethods<HttpResponse<TA>, TA>;
|
|
87
|
-
}
|
|
88
|
-
interface FnMethodsHttpWithMock<T, TA> extends Ng2RestMethods<HttpResponse<T>, T> {
|
|
89
|
-
array: Ng2RestMethods<HttpResponse<TA>, TA>;
|
|
90
|
-
mock(mock: MockHttp, code: HttpCode): FnMethodsHttp<T, TA>;
|
|
91
|
-
}
|
|
92
|
-
interface NestedParams {
|
|
93
|
-
[params: string]: string;
|
|
94
|
-
}
|
|
95
|
-
interface UrlParams {
|
|
96
|
-
[urlModelName: string]: string | number | boolean | RegExp | Object;
|
|
97
|
-
regex?: RegExp;
|
|
98
|
-
}
|
|
99
|
-
abstract class BaseBody {
|
|
100
|
-
protected toJSON(data: any, isJSONArray?: boolean): any;
|
|
101
|
-
}
|
|
102
|
-
class HttpBody<T> extends BaseBody {
|
|
103
|
-
private responseText;
|
|
104
|
-
private isArray;
|
|
105
|
-
private entity;
|
|
106
|
-
private circular;
|
|
107
|
-
constructor(responseText: string | Blob, isArray: boolean, entity: Mapping.Mapping, circular: Circ[]);
|
|
108
|
-
get blob(): Blob;
|
|
109
|
-
get booleanValue(): boolean;
|
|
110
|
-
get rawJson(): Partial<T>;
|
|
111
|
-
get json(): T;
|
|
112
|
-
get text(): string;
|
|
113
|
-
}
|
|
114
|
-
class ErrorBody extends BaseBody {
|
|
115
|
-
private data;
|
|
116
|
-
constructor(data: any);
|
|
117
|
-
get json(): Object;
|
|
118
|
-
get text(): any;
|
|
119
|
-
}
|
|
120
|
-
abstract class BaseResponse<T> {
|
|
121
|
-
responseText?: string | Blob;
|
|
122
|
-
readonly headers?: RestHeaders;
|
|
123
|
-
readonly statusCode?: HttpCode | number;
|
|
124
|
-
isArray: boolean;
|
|
125
|
-
protected static readonly cookies: Cookie;
|
|
126
|
-
get cookies(): Cookie;
|
|
127
|
-
constructor(responseText?: string | Blob, headers?: RestHeaders, statusCode?: HttpCode | number, isArray?: boolean);
|
|
128
|
-
}
|
|
129
|
-
class HttpResponse<T> extends BaseResponse<T> {
|
|
130
|
-
sourceRequest: Models.HandleResultSourceRequestOptions;
|
|
131
|
-
responseText?: string | Blob;
|
|
132
|
-
headers?: RestHeaders;
|
|
133
|
-
statusCode?: HttpCode | number;
|
|
134
|
-
entity?: Mapping.Mapping | Function;
|
|
135
|
-
circular?: Circ[];
|
|
136
|
-
jobid?: number;
|
|
137
|
-
isArray: boolean;
|
|
138
|
-
body?: HttpBody<T>;
|
|
139
|
-
rq: RequestCache;
|
|
140
|
-
constructor(sourceRequest: Models.HandleResultSourceRequestOptions, responseText?: string | Blob, headers?: RestHeaders, statusCode?: HttpCode | number, entity?: Mapping.Mapping | Function, circular?: Circ[], jobid?: number, isArray?: boolean);
|
|
141
|
-
init(): void;
|
|
142
|
-
get cache(): RequestCache;
|
|
143
|
-
}
|
|
144
|
-
class HttpResponseError extends BaseResponse<any> {
|
|
145
|
-
message: string;
|
|
146
|
-
jobid?: number;
|
|
147
|
-
private body;
|
|
148
|
-
constructor(message: string, responseText?: string, headers?: RestHeaders, statusCode?: HttpCode | number, jobid?: number);
|
|
149
|
-
}
|
|
150
|
-
interface MockResponse {
|
|
151
|
-
data?: any;
|
|
152
|
-
code?: HttpCode;
|
|
153
|
-
error?: string;
|
|
154
|
-
headers?: RestHeaders;
|
|
155
|
-
jobid?: number;
|
|
156
|
-
isArray: boolean;
|
|
157
|
-
}
|
|
158
|
-
type ResponseTypeAxios = 'blob' | 'text';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { RestHeaders } from './rest-headers';
|
|
5
|
+
import { Rest } from './rest.class';
|
|
6
|
+
import { Cookie } from './cookie';
|
|
7
|
+
import { Mapping } from './mapping';
|
|
8
|
+
import { Models as HelpersModels } from 'typescript-class-helpers/browser';
|
|
9
|
+
import { Circ } from 'json10/browser';
|
|
10
|
+
import { RequestCache } from './request-cache';
|
|
11
|
+
import { ConfigModels } from 'tnp-config/browser';
|
|
12
|
+
export declare namespace Models {
|
|
13
|
+
export import HttpMethod = ConfigModels.HttpMethod;
|
|
14
|
+
export import ParamType = ConfigModels.ParamType;
|
|
15
|
+
export import MethodConfig = HelpersModels.MethodConfig;
|
|
16
|
+
export import ClassConfig = HelpersModels.ClassConfig;
|
|
17
|
+
export import ParamConfig = HelpersModels.ParamConfig;
|
|
18
|
+
interface HandleResultOptions {
|
|
19
|
+
res: Models.MockResponse;
|
|
20
|
+
method: Models.HttpMethod;
|
|
21
|
+
jobid?: number;
|
|
22
|
+
isArray?: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface HandleResultSourceRequestOptions {
|
|
25
|
+
url: string;
|
|
26
|
+
method: Models.HttpMethod;
|
|
27
|
+
body: any;
|
|
28
|
+
isArray: boolean;
|
|
29
|
+
}
|
|
30
|
+
type BackendError = {
|
|
31
|
+
msg?: string;
|
|
32
|
+
stack?: string[];
|
|
33
|
+
data: any;
|
|
34
|
+
};
|
|
35
|
+
type MetaRequest = {
|
|
36
|
+
path: string;
|
|
37
|
+
endpoint: string;
|
|
38
|
+
entity: Mapping.Mapping;
|
|
39
|
+
circular: Circ[];
|
|
40
|
+
};
|
|
41
|
+
type HttpCode = 200 | 400 | 401 | 404 | 500;
|
|
42
|
+
type PromiseObservableMix<T> = Promise<T> & {
|
|
43
|
+
cache?: RequestCache;
|
|
44
|
+
observable: Observable<T>;
|
|
45
|
+
};
|
|
46
|
+
type MethodWithoutBody<E, T, R = PromiseObservableMix<E>> = (params?: UrlParams[], doNotSerializeParams?: boolean) => R;
|
|
47
|
+
type MethodWithBody<E, T, R = PromiseObservableMix<E>> = (item?: T, params?: UrlParams[], doNotSerializeParams?: boolean) => R;
|
|
48
|
+
type ReplayData = {
|
|
49
|
+
subject: Subject<any>;
|
|
50
|
+
data: {
|
|
51
|
+
url: string;
|
|
52
|
+
body: string;
|
|
53
|
+
headers: RestHeaders;
|
|
54
|
+
isArray: boolean;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* jobid
|
|
58
|
+
*/
|
|
59
|
+
id: number;
|
|
60
|
+
};
|
|
61
|
+
type ReqParams = {
|
|
62
|
+
url: string;
|
|
63
|
+
method: ConfigModels.HttpMethod;
|
|
64
|
+
headers?: RestHeaders;
|
|
65
|
+
body?: any;
|
|
66
|
+
jobid: number;
|
|
67
|
+
isArray: boolean;
|
|
68
|
+
};
|
|
69
|
+
interface ResourceModel<A, TA> {
|
|
70
|
+
model: (pathModels?: Object, responseObjectType?: Function) => Rest<A, TA>;
|
|
71
|
+
replay: (method: ConfigModels.HttpMethod) => void;
|
|
72
|
+
headers: RestHeaders;
|
|
73
|
+
}
|
|
74
|
+
interface Ng2RestMethods<E, T> {
|
|
75
|
+
get: MethodWithoutBody<E, T>;
|
|
76
|
+
post: MethodWithBody<E, T>;
|
|
77
|
+
put: MethodWithBody<E, T>;
|
|
78
|
+
patch: MethodWithBody<E, T>;
|
|
79
|
+
head: MethodWithoutBody<E, T>;
|
|
80
|
+
delete: MethodWithoutBody<E, T>;
|
|
81
|
+
jsonp: MethodWithoutBody<E, T>;
|
|
82
|
+
}
|
|
83
|
+
type MockController = (url: string, method: ConfigModels.HttpMethod, headers?: RestHeaders, body?: any) => MockResponse;
|
|
84
|
+
type MockHttp = (MockResponse | MockController);
|
|
85
|
+
interface FnMethodsHttp<T, TA> extends Ng2RestMethods<HttpResponse<T>, T> {
|
|
86
|
+
array: Ng2RestMethods<HttpResponse<TA>, TA>;
|
|
87
|
+
}
|
|
88
|
+
interface FnMethodsHttpWithMock<T, TA> extends Ng2RestMethods<HttpResponse<T>, T> {
|
|
89
|
+
array: Ng2RestMethods<HttpResponse<TA>, TA>;
|
|
90
|
+
mock(mock: MockHttp, code: HttpCode): FnMethodsHttp<T, TA>;
|
|
91
|
+
}
|
|
92
|
+
interface NestedParams {
|
|
93
|
+
[params: string]: string;
|
|
94
|
+
}
|
|
95
|
+
interface UrlParams {
|
|
96
|
+
[urlModelName: string]: string | number | boolean | RegExp | Object;
|
|
97
|
+
regex?: RegExp;
|
|
98
|
+
}
|
|
99
|
+
abstract class BaseBody {
|
|
100
|
+
protected toJSON(data: any, isJSONArray?: boolean): any;
|
|
101
|
+
}
|
|
102
|
+
class HttpBody<T> extends BaseBody {
|
|
103
|
+
private responseText;
|
|
104
|
+
private isArray;
|
|
105
|
+
private entity;
|
|
106
|
+
private circular;
|
|
107
|
+
constructor(responseText: string | Blob, isArray: boolean, entity: Mapping.Mapping, circular: Circ[]);
|
|
108
|
+
get blob(): Blob;
|
|
109
|
+
get booleanValue(): boolean;
|
|
110
|
+
get rawJson(): Partial<T>;
|
|
111
|
+
get json(): T;
|
|
112
|
+
get text(): string;
|
|
113
|
+
}
|
|
114
|
+
class ErrorBody extends BaseBody {
|
|
115
|
+
private data;
|
|
116
|
+
constructor(data: any);
|
|
117
|
+
get json(): Object;
|
|
118
|
+
get text(): any;
|
|
119
|
+
}
|
|
120
|
+
abstract class BaseResponse<T> {
|
|
121
|
+
responseText?: string | Blob;
|
|
122
|
+
readonly headers?: RestHeaders;
|
|
123
|
+
readonly statusCode?: HttpCode | number;
|
|
124
|
+
isArray: boolean;
|
|
125
|
+
protected static readonly cookies: Cookie;
|
|
126
|
+
get cookies(): Cookie;
|
|
127
|
+
constructor(responseText?: string | Blob, headers?: RestHeaders, statusCode?: HttpCode | number, isArray?: boolean);
|
|
128
|
+
}
|
|
129
|
+
class HttpResponse<T> extends BaseResponse<T> {
|
|
130
|
+
sourceRequest: Models.HandleResultSourceRequestOptions;
|
|
131
|
+
responseText?: string | Blob;
|
|
132
|
+
headers?: RestHeaders;
|
|
133
|
+
statusCode?: HttpCode | number;
|
|
134
|
+
entity?: Mapping.Mapping | Function;
|
|
135
|
+
circular?: Circ[];
|
|
136
|
+
jobid?: number;
|
|
137
|
+
isArray: boolean;
|
|
138
|
+
body?: HttpBody<T>;
|
|
139
|
+
rq: RequestCache;
|
|
140
|
+
constructor(sourceRequest: Models.HandleResultSourceRequestOptions, responseText?: string | Blob, headers?: RestHeaders, statusCode?: HttpCode | number, entity?: Mapping.Mapping | Function, circular?: Circ[], jobid?: number, isArray?: boolean);
|
|
141
|
+
init(): void;
|
|
142
|
+
get cache(): RequestCache;
|
|
143
|
+
}
|
|
144
|
+
class HttpResponseError extends BaseResponse<any> {
|
|
145
|
+
message: string;
|
|
146
|
+
jobid?: number;
|
|
147
|
+
private body;
|
|
148
|
+
constructor(message: string, responseText?: string, headers?: RestHeaders, statusCode?: HttpCode | number, jobid?: number);
|
|
149
|
+
}
|
|
150
|
+
interface MockResponse {
|
|
151
|
+
data?: any;
|
|
152
|
+
code?: HttpCode;
|
|
153
|
+
error?: string;
|
|
154
|
+
headers?: RestHeaders;
|
|
155
|
+
jobid?: number;
|
|
156
|
+
isArray: boolean;
|
|
157
|
+
}
|
|
158
|
+
type ResponseTypeAxios = 'blob' | 'text';
|
|
159
159
|
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { Models } from '../models';
|
|
4
|
-
export interface RestPromises<A, TA, QP extends Models.UrlParams> {
|
|
5
|
-
get: (queryParams?: QP) => Observable<Models.HttpResponse<A>>;
|
|
6
|
-
head: (queryParams?: QP) => Observable<Models.HttpResponse<A>>;
|
|
7
|
-
query: (queryParams?: QP) => Observable<Models.HttpResponse<TA>>;
|
|
8
|
-
put: (item?: A, queryParams?: QP) => Observable<Models.HttpResponse<A>>;
|
|
9
|
-
patch: (item?: A, queryParams?: QP) => Observable<Models.HttpResponse<A>>;
|
|
10
|
-
post: (item?: A, queryParams?: QP) => Observable<Models.HttpResponse<A>>;
|
|
11
|
-
delete: (queryParams?: QP) => Observable<Models.HttpResponse<A> | any>;
|
|
12
|
-
}
|
|
13
|
-
export interface Model<A, TA, RP extends Object, QP extends Models.UrlParams> {
|
|
14
|
-
(restParams?: RP): RestPromises<A, TA, QP>;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @export
|
|
19
|
-
* @class SimpleResource
|
|
20
|
-
* @template A single model type
|
|
21
|
-
* @template TA array model type
|
|
22
|
-
* @template RP rest parameters type
|
|
23
|
-
* @template QP query parameters type
|
|
24
|
-
*/
|
|
25
|
-
export declare class SimpleResource<A, TA> {
|
|
26
|
-
model: Model<A, TA, Object, Models.UrlParams>;
|
|
27
|
-
private static _isSetQueryParamsSerialization;
|
|
28
|
-
static set doNotSerializeQueryParams(value: any);
|
|
29
|
-
static __destroy(): void;
|
|
30
|
-
constructor(endpoint: string, model: string);
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Models } from '../models';
|
|
4
|
+
export interface RestPromises<A, TA, QP extends Models.UrlParams> {
|
|
5
|
+
get: (queryParams?: QP) => Observable<Models.HttpResponse<A>>;
|
|
6
|
+
head: (queryParams?: QP) => Observable<Models.HttpResponse<A>>;
|
|
7
|
+
query: (queryParams?: QP) => Observable<Models.HttpResponse<TA>>;
|
|
8
|
+
put: (item?: A, queryParams?: QP) => Observable<Models.HttpResponse<A>>;
|
|
9
|
+
patch: (item?: A, queryParams?: QP) => Observable<Models.HttpResponse<A>>;
|
|
10
|
+
post: (item?: A, queryParams?: QP) => Observable<Models.HttpResponse<A>>;
|
|
11
|
+
delete: (queryParams?: QP) => Observable<Models.HttpResponse<A> | any>;
|
|
12
|
+
}
|
|
13
|
+
export interface Model<A, TA, RP extends Object, QP extends Models.UrlParams> {
|
|
14
|
+
(restParams?: RP): RestPromises<A, TA, QP>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
* @class SimpleResource
|
|
20
|
+
* @template A single model type
|
|
21
|
+
* @template TA array model type
|
|
22
|
+
* @template RP rest parameters type
|
|
23
|
+
* @template QP query parameters type
|
|
24
|
+
*/
|
|
25
|
+
export declare class SimpleResource<A, TA> {
|
|
26
|
+
model: Model<A, TA, Object, Models.UrlParams>;
|
|
27
|
+
private static _isSetQueryParamsSerialization;
|
|
28
|
+
static set doNotSerializeQueryParams(value: any);
|
|
29
|
+
static __destroy(): void;
|
|
30
|
+
constructor(endpoint: string, model: string);
|
|
31
31
|
}
|
package/client/lib/params.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { Models } from './models';
|
|
3
|
-
/** check if string is a valid pattern */
|
|
4
|
-
export declare function isValid(pattern: string): boolean;
|
|
5
|
-
export declare function check(url: string, pattern: string): boolean;
|
|
6
|
-
export declare function getModels(pattern: string): string[];
|
|
7
|
-
export declare function getRestPramsNames(pattern: string): string[];
|
|
8
|
-
export declare function containsModels(url: string, models: string[]): boolean;
|
|
9
|
-
export declare function stars(n: number): string;
|
|
10
|
-
export declare function getRestParams(url: string, pattern: string): Object;
|
|
11
|
-
export declare const regexisPath: RegExp;
|
|
12
|
-
export declare function interpolateParamsToUrl(params: Object, url: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Get query params from url, like 'ex' in /api/books?ex=value
|
|
15
|
-
*/
|
|
16
|
-
export declare function decodeUrl(url: string): Object;
|
|
17
|
-
/**
|
|
18
|
-
* Create query params string for url
|
|
19
|
-
*
|
|
20
|
-
* @export
|
|
21
|
-
* @param {UrlParams[]} params
|
|
22
|
-
* @returns {string}
|
|
23
|
-
*/
|
|
24
|
-
export declare function getParamsUrl(params: Models.UrlParams[], doNotSerialize?: boolean): string;
|
|
2
|
+
import { Models } from './models';
|
|
3
|
+
/** check if string is a valid pattern */
|
|
4
|
+
export declare function isValid(pattern: string): boolean;
|
|
5
|
+
export declare function check(url: string, pattern: string): boolean;
|
|
6
|
+
export declare function getModels(pattern: string): string[];
|
|
7
|
+
export declare function getRestPramsNames(pattern: string): string[];
|
|
8
|
+
export declare function containsModels(url: string, models: string[]): boolean;
|
|
9
|
+
export declare function stars(n: number): string;
|
|
10
|
+
export declare function getRestParams(url: string, pattern: string): Object;
|
|
11
|
+
export declare const regexisPath: RegExp;
|
|
12
|
+
export declare function interpolateParamsToUrl(params: Object, url: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Get query params from url, like 'ex' in /api/books?ex=value
|
|
15
|
+
*/
|
|
16
|
+
export declare function decodeUrl(url: string): Object;
|
|
17
|
+
/**
|
|
18
|
+
* Create query params string for url
|
|
19
|
+
*
|
|
20
|
+
* @export
|
|
21
|
+
* @param {UrlParams[]} params
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
export declare function getParamsUrl(params: Models.UrlParams[], doNotSerialize?: boolean): string;
|
|
25
25
|
export declare function prepareUrlOldWay(params?: TemplateStringsArray): string;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { Models } from './models';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated
|
|
5
|
-
* there is Cache API for that
|
|
6
|
-
*/
|
|
7
|
-
export declare class RequestCache {
|
|
8
|
-
response: Models.HttpResponse<any>;
|
|
9
|
-
static readonly LOCAL_STORAGE_KEY = "ng2restrequestcache";
|
|
10
|
-
private static cached;
|
|
11
|
-
private static isRestoredFromLocalStorage;
|
|
12
|
-
private static restoreFromLocalStorage;
|
|
13
|
-
static findBy(sourceRequest: Models.HandleResultSourceRequestOptions): RequestCache;
|
|
14
|
-
constructor(response: Models.HttpResponse<any>);
|
|
15
|
-
get containsCache(): boolean;
|
|
16
|
-
private persistsInLocalStorage;
|
|
17
|
-
store(): this;
|
|
18
|
-
remove(): void;
|
|
2
|
+
import { Models } from './models';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated
|
|
5
|
+
* there is Cache API for that
|
|
6
|
+
*/
|
|
7
|
+
export declare class RequestCache {
|
|
8
|
+
response: Models.HttpResponse<any>;
|
|
9
|
+
static readonly LOCAL_STORAGE_KEY = "ng2restrequestcache";
|
|
10
|
+
private static cached;
|
|
11
|
+
private static isRestoredFromLocalStorage;
|
|
12
|
+
private static restoreFromLocalStorage;
|
|
13
|
+
static findBy(sourceRequest: Models.HandleResultSourceRequestOptions): RequestCache;
|
|
14
|
+
constructor(response: Models.HttpResponse<any>);
|
|
15
|
+
get containsCache(): boolean;
|
|
16
|
+
private persistsInLocalStorage;
|
|
17
|
+
store(): this;
|
|
18
|
+
remove(): void;
|
|
19
19
|
}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { Subject } from 'rxjs';
|
|
4
|
-
import { Rest } from './rest.class';
|
|
5
|
-
import { RestHeaders } from './rest-headers';
|
|
6
|
-
import { Cookie } from './cookie';
|
|
7
|
-
import { Mapping } from './mapping';
|
|
8
|
-
import { Models } from './models';
|
|
9
|
-
import { Circ } from 'json10/browser';
|
|
10
|
-
export declare class Resource<E, T, TA> {
|
|
11
|
-
protected static _listenErrors: Subject<Models.BackendError>;
|
|
12
|
-
protected static _listenSuccess: Subject<Models.HttpResponse<any>>;
|
|
13
|
-
static get listenErrors(): Observable<Models.BackendError>;
|
|
14
|
-
static get listenSuccessOperations(): Observable<Models.HttpResponse<any>>;
|
|
15
|
-
static enableWarnings: boolean;
|
|
16
|
-
private getZone;
|
|
17
|
-
static initAngularNgZone(zone: any): void;
|
|
18
|
-
private checkNestedModels;
|
|
19
|
-
private static instance;
|
|
20
|
-
private static endpoints;
|
|
21
|
-
static getModel(endpoint: string, model: string): Rest<any>;
|
|
22
|
-
private static request;
|
|
23
|
-
static create<A, TA = A[]>(e: string, model?: string, entityMapping?: Mapping.Mapping, circular?: Circ[], customContentType?: RestHeaders): Models.ResourceModel<A, TA>;
|
|
24
|
-
static reset(): void;
|
|
25
|
-
private constructor();
|
|
26
|
-
static Cookies: Cookie;
|
|
27
|
-
private static map;
|
|
28
|
-
private static prepareModel;
|
|
29
|
-
/**
|
|
30
|
-
* And enipoint to application
|
|
31
|
-
*
|
|
32
|
-
* @param {E} endpoint
|
|
33
|
-
* @param {string} model
|
|
34
|
-
* @returns {boolean}
|
|
35
|
-
*/
|
|
36
|
-
private add;
|
|
37
|
-
/**
|
|
38
|
-
* Access api throught endpoint
|
|
39
|
-
*
|
|
40
|
-
* @param {E} endpoint
|
|
41
|
-
* @param {string} model
|
|
42
|
-
* @returns {Rest<T, TA>}
|
|
43
|
-
*/
|
|
44
|
-
private api;
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { Rest } from './rest.class';
|
|
5
|
+
import { RestHeaders } from './rest-headers';
|
|
6
|
+
import { Cookie } from './cookie';
|
|
7
|
+
import { Mapping } from './mapping';
|
|
8
|
+
import { Models } from './models';
|
|
9
|
+
import { Circ } from 'json10/browser';
|
|
10
|
+
export declare class Resource<E, T, TA> {
|
|
11
|
+
protected static _listenErrors: Subject<Models.BackendError>;
|
|
12
|
+
protected static _listenSuccess: Subject<Models.HttpResponse<any>>;
|
|
13
|
+
static get listenErrors(): Observable<Models.BackendError>;
|
|
14
|
+
static get listenSuccessOperations(): Observable<Models.HttpResponse<any>>;
|
|
15
|
+
static enableWarnings: boolean;
|
|
16
|
+
private getZone;
|
|
17
|
+
static initAngularNgZone(zone: any): void;
|
|
18
|
+
private checkNestedModels;
|
|
19
|
+
private static instance;
|
|
20
|
+
private static endpoints;
|
|
21
|
+
static getModel(endpoint: string, model: string): Rest<any>;
|
|
22
|
+
private static request;
|
|
23
|
+
static create<A, TA = A[]>(e: string, model?: string, entityMapping?: Mapping.Mapping, circular?: Circ[], customContentType?: RestHeaders): Models.ResourceModel<A, TA>;
|
|
24
|
+
static reset(): void;
|
|
25
|
+
private constructor();
|
|
26
|
+
static Cookies: Cookie;
|
|
27
|
+
private static map;
|
|
28
|
+
private static prepareModel;
|
|
29
|
+
/**
|
|
30
|
+
* And enipoint to application
|
|
31
|
+
*
|
|
32
|
+
* @param {E} endpoint
|
|
33
|
+
* @param {string} model
|
|
34
|
+
* @returns {boolean}
|
|
35
|
+
*/
|
|
36
|
+
private add;
|
|
37
|
+
/**
|
|
38
|
+
* Access api throught endpoint
|
|
39
|
+
*
|
|
40
|
+
* @param {E} endpoint
|
|
41
|
+
* @param {string} model
|
|
42
|
+
* @returns {Rest<T, TA>}
|
|
43
|
+
*/
|
|
44
|
+
private api;
|
|
45
45
|
}
|