@von-development-studio/angular-rest-service 2.0.4-SNAPSHOT → 19.2.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.
Files changed (29) hide show
  1. package/README.md +54 -54
  2. package/fesm2022/von-development-studio-angular-rest-service.mjs +297 -0
  3. package/fesm2022/von-development-studio-angular-rest-service.mjs.map +1 -0
  4. package/{von-development-studio-angular-rest-service.d.ts → index.d.ts} +0 -0
  5. package/lib/{model → models}/von-error-rest-interceptor.model.d.ts +0 -0
  6. package/lib/models/von-header-params.model.d.ts +5 -0
  7. package/lib/{model → models}/von-http-options.model.d.ts +0 -0
  8. package/lib/{model → models}/von-page-response.model.d.ts +3 -0
  9. package/lib/models/von-rest-definition.model.d.ts +21 -0
  10. package/lib/von-rest-interceptor.service.d.ts +31 -4
  11. package/lib/von-rest.service.d.ts +36 -17
  12. package/package.json +10 -18
  13. package/public-api.d.ts +5 -4
  14. package/LICENSE +0 -21
  15. package/esm2020/lib/model/von-error-response.model.mjs +0 -2
  16. package/esm2020/lib/model/von-error-rest-interceptor.model.mjs +0 -2
  17. package/esm2020/lib/model/von-http-options.model.mjs +0 -2
  18. package/esm2020/lib/model/von-page-response.model.mjs +0 -2
  19. package/esm2020/lib/model/von-rest-definition.type.mjs +0 -2
  20. package/esm2020/lib/von-rest-interceptor.service.mjs +0 -62
  21. package/esm2020/lib/von-rest.service.mjs +0 -105
  22. package/esm2020/public-api.mjs +0 -7
  23. package/esm2020/von-development-studio-angular-rest-service.mjs +0 -5
  24. package/fesm2015/von-development-studio-angular-rest-service.mjs +0 -168
  25. package/fesm2015/von-development-studio-angular-rest-service.mjs.map +0 -1
  26. package/fesm2020/von-development-studio-angular-rest-service.mjs +0 -172
  27. package/fesm2020/von-development-studio-angular-rest-service.mjs.map +0 -1
  28. package/lib/model/von-error-response.model.d.ts +0 -5
  29. package/lib/model/von-rest-definition.type.d.ts +0 -25
package/README.md CHANGED
@@ -1,54 +1,54 @@
1
- # Angular Rest Service
2
-
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.0.3.
4
-
5
- ## Installing
6
-
7
- 1. Add NPM package into your project:
8
-
9
- ```node
10
- npm install @von-development-studio/angular-rest-service --save
11
- ```
12
-
13
- 2. Create your rest service file _**RestService**_
14
-
15
- ```typescript
16
- ...
17
- import { VonRestService } from '@von-development-studio/angular-rest-service';
18
- ...
19
-
20
- @Injectable({
21
- providedIn: 'root'
22
- })
23
- export class RestService extends VonRestService {
24
- constructor(
25
- protected http: HttpClient,
26
- protected sanitizer: DomSanitizer
27
- ) {
28
- super(http, sanitizer);
29
- }
30
- }
31
- ```
32
-
33
- 2. Create your rest interceptor service file _**RestInterceptorService**_
34
-
35
- ```typescript
36
- ...
37
- import { VonRestInterceptorService } from '@von-development-studio/angular-rest-service';
38
- ...
39
-
40
- @Injectable({
41
- providedIn: 'root'
42
- })
43
- export class RestInterceptorService extends VonRestInterceptorService {
44
- constructor(
45
- protected router: Router
46
- ) {
47
- super(router);
48
- }
49
- }
50
- ```
51
-
52
- <hr>
53
-
54
- ###### _[By Von Development Studio](https://www.von-development-studio.com/)_
1
+ # Angular Rest Service
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.2.13.
4
+
5
+ ## Installing
6
+
7
+ 1. Add NPM package into your project:
8
+
9
+ ```node
10
+ npm install @von-development-studio/angular-rest-service --save
11
+ ```
12
+
13
+ 2. Create your rest service file _**RestService**_
14
+
15
+ ```typescript
16
+ ...
17
+ import { VonRestService } from '@von-development-studio/angular-rest-service';
18
+ ...
19
+
20
+ @Injectable({
21
+ providedIn: 'root'
22
+ })
23
+ export class RestService extends VonRestService {
24
+ constructor(
25
+ protected http: HttpClient,
26
+ protected sanitizer: DomSanitizer
27
+ ) {
28
+ super(http, sanitizer);
29
+ }
30
+ }
31
+ ```
32
+
33
+ 2. Create your rest interceptor service file _**RestInterceptorService**_
34
+
35
+ ```typescript
36
+ ...
37
+ import { VonRestInterceptorService } from '@von-development-studio/angular-rest-service';
38
+ ...
39
+
40
+ @Injectable({
41
+ providedIn: 'root'
42
+ })
43
+ export class RestInterceptorService extends VonRestInterceptorService {
44
+ constructor(
45
+ protected router: Router
46
+ ) {
47
+ super(router);
48
+ }
49
+ }
50
+ ```
51
+
52
+ <hr>
53
+
54
+ ###### _[By Von Development Studio](https://www.von-development-studio.com/)_
@@ -0,0 +1,297 @@
1
+ import { HttpResponse, HttpHeaders } from '@angular/common/http';
2
+ import { throwError } from 'rxjs';
3
+ import { map, catchError, take, share } from 'rxjs/operators';
4
+
5
+ class VonRestInterceptorService {
6
+ router;
7
+ consoleDebug = false;
8
+ errorResponseUnknown = 'Unknown Error';
9
+ errorResponseForbidden = 'Forbidden Error';
10
+ constructor(router) {
11
+ this.router = router;
12
+ }
13
+ intercept(request, next) {
14
+ return next
15
+ .handle(request)
16
+ .pipe(map(this.mapEvent), catchError(this.catchError));
17
+ }
18
+ mapEvent = (event) => {
19
+ if (event instanceof HttpResponse) {
20
+ if (event.status === 200 || event.status === 204) {
21
+ this.executeBeforePipesOnSuccess();
22
+ // TODO: Remove this call
23
+ this.postHttpRequest();
24
+ return event;
25
+ }
26
+ if (event.status !== 200) {
27
+ const error = {
28
+ status: event.status,
29
+ message: event.statusText,
30
+ body: event.body,
31
+ };
32
+ if (this.consoleDebug) {
33
+ console.error('[ErrorWS]: ', error);
34
+ }
35
+ throw error;
36
+ }
37
+ }
38
+ return event;
39
+ };
40
+ catchError = (errorResponse) => {
41
+ if (this.consoleDebug) {
42
+ console.error('[Fatal]: ', errorResponse);
43
+ }
44
+ const error = {
45
+ status: errorResponse.status,
46
+ message: '',
47
+ body: errorResponse.error || {},
48
+ };
49
+ if (errorResponse.status === 0) {
50
+ error.message = this.errorResponseUnknown;
51
+ }
52
+ if (errorResponse.status === 401) {
53
+ error.message = errorResponse.error
54
+ ? errorResponse.error
55
+ : this.errorResponseForbidden;
56
+ }
57
+ this.execute403Redirect();
58
+ // TODO: Remove all this section.
59
+ if (this.redirectOn403) {
60
+ if (errorResponse.status === 403 ||
61
+ (errorResponse.url && errorResponse.url.indexOf(this.urlWhoAmI) > -1)) {
62
+ this.router.navigate(this.redirect403Url);
63
+ }
64
+ }
65
+ this.execute403Redirect();
66
+ this.executeBeforePipesOnError();
67
+ // TODO: Remove this call
68
+ this.postHttpRequest();
69
+ return throwError(error);
70
+ };
71
+ /**
72
+ * Execute custom implementation before any other pipe from the subscription.
73
+ */
74
+ executeBeforePipesOnSuccess = () => { };
75
+ /**
76
+ * Execute custom implementation before any other pipe from the subscription.
77
+ */
78
+ executeBeforePipesOnError = () => { };
79
+ /**
80
+ * Execute custom implementation to redirect to 403 page based on a specific condition.
81
+ */
82
+ execute403Redirect = () => { };
83
+ // ****
84
+ // ****
85
+ // ****
86
+ // TODO: Remove all below this line
87
+ // ****
88
+ /**
89
+ * @deprecated Use the new custom method execute403Redirect() to trigger redirect to 403. This property is marked to be removed.
90
+ * TODO: Remove this property
91
+ */
92
+ urlWhoAmI = 'api/who-am-i';
93
+ /**
94
+ * @deprecated Use the new custom method execute403Redirect() to trigger redirect to 403. This property is marked to be removed.
95
+ * TODO: Remove this property
96
+ */
97
+ redirectOn403 = true;
98
+ /**
99
+ * @deprecated Use the new custom method execute403Redirect() to trigger redirect to 403. This property is marked to be removed.
100
+ * TODO: Remove this property
101
+ */
102
+ redirect403Url = ['403'];
103
+ /**
104
+ * @deprecated Use either executeBeforePipesOnSuccess() or executeBeforePipesOnError() base on your case. This method is marked to be removed.
105
+ */
106
+ postHttpRequest = () => { };
107
+ }
108
+
109
+ /**
110
+ * Rest service wrapper for API calls. This class needs to be extended in a `@Injectable({ providedIn: 'root' })` service.
111
+ * Parameters needed:
112
+ * @HttpClient
113
+ * @DomSanitizer
114
+ */
115
+ class VonRestService {
116
+ http;
117
+ sanitizer;
118
+ constructor(http, sanitizer) {
119
+ this.http = http;
120
+ this.sanitizer = sanitizer;
121
+ }
122
+ /**
123
+ * Allows to set the default headers
124
+ * @param headerParams Check HeaderParams interface to verify allowed overrides
125
+ * @returns
126
+ * ```json
127
+ * {
128
+ * "Content-Type": "application/json",
129
+ * "Accept": "application/json",
130
+ * "Access-Control-Allow-Origin": "*"
131
+ * }
132
+ * ```
133
+ */
134
+ setHeaders = (headerParams) => {
135
+ return new HttpHeaders({
136
+ 'Content-Type': headerParams?.contentType ?? 'application/json',
137
+ Accept: headerParams?.accept ?? 'application/json',
138
+ 'Access-Control-Allow-Origin': '*',
139
+ });
140
+ };
141
+ setOptions = ({ headerParams, queryParams: params, } = {}) => {
142
+ const options = {
143
+ headers: this.setHeaders(headerParams),
144
+ params,
145
+ withCredentials: true,
146
+ };
147
+ if (headerParams?.responseType) {
148
+ options.responseType = headerParams.responseType;
149
+ }
150
+ return options;
151
+ };
152
+ setOptionsForFile = ({ headerParams, queryParams, } = {}) => {
153
+ const options = {
154
+ ...this.setOptions({
155
+ headerParams,
156
+ queryParams,
157
+ }),
158
+ headers: new HttpHeaders({
159
+ Accept: headerParams?.accept ?? 'application/json',
160
+ 'Access-Control-Allow-Origin': '*',
161
+ }),
162
+ };
163
+ if (headerParams?.responseType) {
164
+ options.responseType = headerParams.responseType;
165
+ }
166
+ return options;
167
+ };
168
+ setUrlParams = (url, params) => {
169
+ if (params != null) {
170
+ for (const p in params) {
171
+ if (p != null) {
172
+ url = url.replace(`{${p}}`, params[p]);
173
+ }
174
+ }
175
+ }
176
+ return url;
177
+ };
178
+ authenticate = (url, username, password) => {
179
+ const authorization = btoa(`${username}:${password}`);
180
+ const headers = new HttpHeaders({
181
+ authorization: `Basic ${authorization}`,
182
+ });
183
+ return this.http
184
+ .get(url, {
185
+ headers,
186
+ withCredentials: true,
187
+ })
188
+ .pipe(take(1), share());
189
+ };
190
+ get = ({ url, urlParams, queryParams: params, headerParams, header: oldHeaderParams, params: oldParams, }) => {
191
+ url = this.setUrlParams(url, urlParams);
192
+ return this.http.get(url, this.setOptions({
193
+ headerParams: {
194
+ ...headerParams,
195
+ ...oldHeaderParams,
196
+ },
197
+ queryParams: {
198
+ ...params,
199
+ ...oldParams,
200
+ },
201
+ }));
202
+ };
203
+ delete = ({ url, urlParams, queryParams: params, headerParams, header: oldHeaderParams, params: oldParams, }) => {
204
+ url = this.setUrlParams(url, urlParams);
205
+ return this.http.delete(url, this.setOptions({
206
+ headerParams: {
207
+ ...headerParams,
208
+ ...oldHeaderParams,
209
+ },
210
+ queryParams: {
211
+ ...params,
212
+ ...oldParams,
213
+ },
214
+ }));
215
+ };
216
+ post = ({ url, body, urlParams, queryParams: params, headerParams, header: oldHeaderParams, params: oldParams, }) => {
217
+ url = this.setUrlParams(url, urlParams);
218
+ const optionsParams = {
219
+ headerParams: {
220
+ ...headerParams,
221
+ ...oldHeaderParams,
222
+ },
223
+ queryParams: {
224
+ ...params,
225
+ ...oldParams,
226
+ },
227
+ };
228
+ let options = body && body instanceof FormData
229
+ ? this.setOptionsForFile(optionsParams)
230
+ : this.setOptions(optionsParams);
231
+ return this.http.post(url, body, options);
232
+ };
233
+ put = ({ url, body, urlParams, queryParams: params, headerParams, header: oldHeaderParams, params: oldParams, }) => {
234
+ url = this.setUrlParams(url, urlParams);
235
+ const optionsParams = {
236
+ headerParams: {
237
+ ...headerParams,
238
+ ...oldHeaderParams,
239
+ },
240
+ queryParams: {
241
+ ...params,
242
+ ...oldParams,
243
+ },
244
+ };
245
+ let options = body && body instanceof FormData
246
+ ? this.setOptionsForFile(optionsParams)
247
+ : this.setOptions(optionsParams);
248
+ return this.http.put(url, body, options);
249
+ };
250
+ patch = ({ url, body, urlParams, queryParams: params, headerParams, header: oldHeaderParams, params: oldParams, }) => {
251
+ url = this.setUrlParams(url, urlParams);
252
+ const optionsParams = {
253
+ headerParams: {
254
+ ...headerParams,
255
+ ...oldHeaderParams,
256
+ },
257
+ queryParams: {
258
+ ...params,
259
+ ...oldParams,
260
+ },
261
+ };
262
+ let options = body && body instanceof FormData
263
+ ? this.setOptionsForFile(optionsParams)
264
+ : this.setOptions(optionsParams);
265
+ return this.http.patch(url, body, options);
266
+ };
267
+ file = ({ url, urlParams, queryParams: params, headerParams, header: oldHeaderParams, params: oldParams, }) => {
268
+ url = this.setUrlParams(url, urlParams);
269
+ return this.http
270
+ .get(url, {
271
+ ...this.setOptionsForFile({
272
+ headerParams: {
273
+ ...headerParams,
274
+ ...oldHeaderParams,
275
+ },
276
+ queryParams: {
277
+ ...params,
278
+ ...oldParams,
279
+ },
280
+ }),
281
+ responseType: 'blob',
282
+ })
283
+ .pipe(map((res) => {
284
+ const fileBlob = new Blob([res], { type: params?.['contentType'] });
285
+ const objUrl = URL.createObjectURL(fileBlob);
286
+ const sanitized = this.sanitizer.bypassSecurityTrustResourceUrl(objUrl);
287
+ return sanitized;
288
+ }));
289
+ };
290
+ }
291
+
292
+ /**
293
+ * Generated bundle index. Do not edit.
294
+ */
295
+
296
+ export { VonRestInterceptorService, VonRestService };
297
+ //# sourceMappingURL=von-development-studio-angular-rest-service.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"von-development-studio-angular-rest-service.mjs","sources":["../../../projects/ng-rest-service/src/lib/von-rest-interceptor.service.ts","../../../projects/ng-rest-service/src/lib/von-rest.service.ts","../../../projects/ng-rest-service/src/von-development-studio-angular-rest-service.ts"],"sourcesContent":["import {\n HttpErrorResponse,\n HttpEvent,\n HttpHandler,\n HttpInterceptor,\n HttpRequest,\n HttpResponse,\n} from '@angular/common/http';\nimport { Router } from '@angular/router';\nimport { Observable, throwError } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\nimport { VonErrorRestInterceptorModel } from './models/von-error-rest-interceptor.model';\n\nexport abstract class VonRestInterceptorService implements HttpInterceptor {\n protected consoleDebug = false;\n protected errorResponseUnknown = 'Unknown Error';\n protected errorResponseForbidden = 'Forbidden Error';\n\n constructor(protected router: Router) {}\n\n intercept(\n request: HttpRequest<any>,\n next: HttpHandler\n ): Observable<HttpEvent<any>> {\n return next\n .handle(request)\n .pipe(map(this.mapEvent), catchError(this.catchError));\n }\n\n protected mapEvent = (event: HttpEvent<any>) => {\n if (event instanceof HttpResponse) {\n if (event.status === 200 || event.status === 204) {\n this.executeBeforePipesOnSuccess();\n // TODO: Remove this call\n this.postHttpRequest();\n return event;\n }\n if (event.status !== 200) {\n const error: VonErrorRestInterceptorModel = {\n status: event.status,\n message: event.statusText,\n body: event.body,\n };\n if (this.consoleDebug) {\n console.error('[ErrorWS]: ', error);\n }\n throw error;\n }\n }\n return event;\n };\n\n protected catchError = (errorResponse: HttpErrorResponse) => {\n if (this.consoleDebug) {\n console.error('[Fatal]: ', errorResponse);\n }\n const error: VonErrorRestInterceptorModel = {\n status: errorResponse.status,\n message: '',\n body: errorResponse.error || {},\n };\n if (errorResponse.status === 0) {\n error.message = this.errorResponseUnknown;\n }\n if (errorResponse.status === 401) {\n error.message = errorResponse.error\n ? errorResponse.error\n : this.errorResponseForbidden;\n }\n\n this.execute403Redirect();\n // TODO: Remove all this section.\n if (this.redirectOn403) {\n if (\n errorResponse.status === 403 ||\n (errorResponse.url && errorResponse.url.indexOf(this.urlWhoAmI) > -1)\n ) {\n this.router.navigate(this.redirect403Url);\n }\n }\n this.execute403Redirect();\n\n this.executeBeforePipesOnError();\n // TODO: Remove this call\n this.postHttpRequest();\n return throwError(error);\n };\n\n /**\n * Execute custom implementation before any other pipe from the subscription.\n */\n protected executeBeforePipesOnSuccess = () => {};\n\n /**\n * Execute custom implementation before any other pipe from the subscription.\n */\n protected executeBeforePipesOnError = () => {};\n\n /**\n * Execute custom implementation to redirect to 403 page based on a specific condition.\n */\n protected execute403Redirect = () => {};\n\n // ****\n // ****\n // ****\n // TODO: Remove all below this line\n // ****\n\n /**\n * @deprecated Use the new custom method execute403Redirect() to trigger redirect to 403. This property is marked to be removed.\n * TODO: Remove this property\n */\n protected urlWhoAmI = 'api/who-am-i';\n /**\n * @deprecated Use the new custom method execute403Redirect() to trigger redirect to 403. This property is marked to be removed.\n * TODO: Remove this property\n */\n protected redirectOn403 = true;\n /**\n * @deprecated Use the new custom method execute403Redirect() to trigger redirect to 403. This property is marked to be removed.\n * TODO: Remove this property\n */\n protected redirect403Url = ['403'];\n /**\n * @deprecated Use either executeBeforePipesOnSuccess() or executeBeforePipesOnError() base on your case. This method is marked to be removed.\n */\n protected postHttpRequest = () => {};\n}\n","import { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';\nimport { Observable } from 'rxjs';\nimport { map, share, take } from 'rxjs/operators';\nimport { HeaderParams } from './models/von-header-params.model';\nimport { VonHttpOptionsModel } from './models/von-http-options.model';\nimport {\n BaseParams,\n BodyParams,\n GenericParams,\n} from './models/von-rest-definition.model';\n\n/**\n * Rest service wrapper for API calls. This class needs to be extended in a `@Injectable({ providedIn: 'root' })` service.\n * Parameters needed:\n * @HttpClient\n * @DomSanitizer\n */\nexport abstract class VonRestService {\n constructor(protected http: HttpClient, protected sanitizer: DomSanitizer) {}\n\n /**\n * Allows to set the default headers\n * @param headerParams Check HeaderParams interface to verify allowed overrides\n * @returns\n * ```json\n * {\n * \"Content-Type\": \"application/json\",\n * \"Accept\": \"application/json\",\n * \"Access-Control-Allow-Origin\": \"*\"\n * }\n * ```\n */\n protected setHeaders = (headerParams?: HeaderParams): HttpHeaders => {\n return new HttpHeaders({\n 'Content-Type': headerParams?.contentType ?? 'application/json',\n Accept: headerParams?.accept ?? 'application/json',\n 'Access-Control-Allow-Origin': '*',\n });\n };\n\n protected setOptions = ({\n headerParams,\n queryParams: params,\n }: {\n headerParams?: HeaderParams;\n queryParams?: GenericParams;\n } = {}): VonHttpOptionsModel => {\n const options: VonHttpOptionsModel = {\n headers: this.setHeaders(headerParams),\n params,\n withCredentials: true,\n };\n if (headerParams?.responseType) {\n options.responseType = headerParams.responseType;\n }\n return options;\n };\n\n protected setOptionsForFile = ({\n headerParams,\n queryParams,\n }: {\n headerParams?: HeaderParams;\n queryParams?: GenericParams;\n } = {}): VonHttpOptionsModel => {\n const options: VonHttpOptionsModel = {\n ...this.setOptions({\n headerParams,\n queryParams,\n }),\n headers: new HttpHeaders({\n Accept: headerParams?.accept ?? 'application/json',\n 'Access-Control-Allow-Origin': '*',\n }),\n };\n if (headerParams?.responseType) {\n options.responseType = headerParams.responseType;\n }\n return options;\n };\n\n protected setUrlParams = (url: string, params?: GenericParams) => {\n if (params != null) {\n for (const p in params) {\n if (p != null) {\n url = url.replace(`{${p}}`, params[p]);\n }\n }\n }\n return url;\n };\n\n protected authenticate = (\n url: string,\n username: string,\n password: string\n ): Observable<any> => {\n const authorization = btoa(`${username}:${password}`);\n const headers = new HttpHeaders({\n authorization: `Basic ${authorization}`,\n });\n return this.http\n .get(url, {\n headers,\n withCredentials: true,\n })\n .pipe(take(1), share());\n };\n\n protected get = <R = any>({\n url,\n urlParams,\n queryParams: params,\n headerParams,\n header: oldHeaderParams,\n params: oldParams,\n }: BaseParams): Observable<R> => {\n url = this.setUrlParams(url, urlParams);\n return this.http.get<R>(\n url,\n this.setOptions({\n headerParams: {\n ...headerParams,\n ...oldHeaderParams,\n },\n queryParams: {\n ...params,\n ...oldParams,\n },\n })\n );\n };\n\n protected delete = <R = any>({\n url,\n urlParams,\n queryParams: params,\n headerParams,\n header: oldHeaderParams,\n params: oldParams,\n }: BaseParams): Observable<R> => {\n url = this.setUrlParams(url, urlParams);\n return this.http.delete<R>(\n url,\n this.setOptions({\n headerParams: {\n ...headerParams,\n ...oldHeaderParams,\n },\n queryParams: {\n ...params,\n ...oldParams,\n },\n })\n );\n };\n\n protected post = <R = any, B = GenericParams | FormData>({\n url,\n body,\n urlParams,\n queryParams: params,\n headerParams,\n header: oldHeaderParams,\n params: oldParams,\n }: BodyParams<B>): Observable<R> => {\n url = this.setUrlParams(url, urlParams);\n const optionsParams = {\n headerParams: {\n ...headerParams,\n ...oldHeaderParams,\n },\n queryParams: {\n ...params,\n ...oldParams,\n },\n };\n let options =\n body && body instanceof FormData\n ? this.setOptionsForFile(optionsParams)\n : this.setOptions(optionsParams);\n return this.http.post<R>(url, body, options);\n };\n\n protected put = <R = any, B = GenericParams | FormData>({\n url,\n body,\n urlParams,\n queryParams: params,\n headerParams,\n header: oldHeaderParams,\n params: oldParams,\n }: BodyParams<B>): Observable<R> => {\n url = this.setUrlParams(url, urlParams);\n const optionsParams = {\n headerParams: {\n ...headerParams,\n ...oldHeaderParams,\n },\n queryParams: {\n ...params,\n ...oldParams,\n },\n };\n let options =\n body && body instanceof FormData\n ? this.setOptionsForFile(optionsParams)\n : this.setOptions(optionsParams);\n return this.http.put<R>(url, body, options);\n };\n\n protected patch = <R = any, B = GenericParams | FormData>({\n url,\n body,\n urlParams,\n queryParams: params,\n headerParams,\n header: oldHeaderParams,\n params: oldParams,\n }: BodyParams<B>): Observable<R> => {\n url = this.setUrlParams(url, urlParams);\n const optionsParams = {\n headerParams: {\n ...headerParams,\n ...oldHeaderParams,\n },\n queryParams: {\n ...params,\n ...oldParams,\n },\n };\n let options =\n body && body instanceof FormData\n ? this.setOptionsForFile(optionsParams)\n : this.setOptions(optionsParams);\n return this.http.patch<R>(url, body, options);\n };\n\n protected file = ({\n url,\n urlParams,\n queryParams: params,\n headerParams,\n header: oldHeaderParams,\n params: oldParams,\n }: BaseParams): Observable<SafeResourceUrl> => {\n url = this.setUrlParams(url, urlParams);\n return this.http\n .get(url, {\n ...this.setOptionsForFile({\n headerParams: {\n ...headerParams,\n ...oldHeaderParams,\n },\n queryParams: {\n ...params,\n ...oldParams,\n },\n }),\n responseType: 'blob' as 'json',\n })\n .pipe(\n map((res: any) => {\n const fileBlob = new Blob([res], { type: params?.['contentType'] });\n const objUrl = URL.createObjectURL(fileBlob);\n const sanitized =\n this.sanitizer.bypassSecurityTrustResourceUrl(objUrl);\n return sanitized;\n })\n );\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAasB,yBAAyB,CAAA;AAKvB,IAAA,MAAA;IAJZ,YAAY,GAAG,KAAK;IACpB,oBAAoB,GAAG,eAAe;IACtC,s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6 @@
1
+ /**
2
+ * @deprecated Define this model in the solution
3
+ */
1
4
  export interface VonPageResponseModel<T> {
2
5
  content: T[];
3
6
  last: boolean;
@@ -0,0 +1,21 @@
1
+ import { HeaderParams } from './von-header-params.model';
2
+ export interface GenericParams {
3
+ [key: string]: any;
4
+ }
5
+ export interface BaseParams {
6
+ url: string;
7
+ urlParams?: GenericParams;
8
+ queryParams?: GenericParams;
9
+ headerParams?: HeaderParams;
10
+ /**
11
+ * @deprecated Use headerParams instead
12
+ */
13
+ header?: HeaderParams;
14
+ /**
15
+ * @deprecated Use queryParams instead
16
+ */
17
+ params?: GenericParams;
18
+ }
19
+ export type BodyParams<B = GenericParams | FormData> = BaseParams & {
20
+ body?: B;
21
+ };
@@ -6,12 +6,39 @@ export declare abstract class VonRestInterceptorService implements HttpIntercept
6
6
  protected consoleDebug: boolean;
7
7
  protected errorResponseUnknown: string;
8
8
  protected errorResponseForbidden: string;
9
- protected urlWhoAmI: string;
10
- protected redirectOn403: boolean;
11
- protected redirect403Url: string[];
12
9
  constructor(router: Router);
13
10
  intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
14
- protected postHttpRequest: () => void;
15
11
  protected mapEvent: (event: HttpEvent<any>) => HttpEvent<any>;
16
12
  protected catchError: (errorResponse: HttpErrorResponse) => Observable<never>;
13
+ /**
14
+ * Execute custom implementation before any other pipe from the subscription.
15
+ */
16
+ protected executeBeforePipesOnSuccess: () => void;
17
+ /**
18
+ * Execute custom implementation before any other pipe from the subscription.
19
+ */
20
+ protected executeBeforePipesOnError: () => void;
21
+ /**
22
+ * Execute custom implementation to redirect to 403 page based on a specific condition.
23
+ */
24
+ protected execute403Redirect: () => void;
25
+ /**
26
+ * @deprecated Use the new custom method execute403Redirect() to trigger redirect to 403. This property is marked to be removed.
27
+ * TODO: Remove this property
28
+ */
29
+ protected urlWhoAmI: string;
30
+ /**
31
+ * @deprecated Use the new custom method execute403Redirect() to trigger redirect to 403. This property is marked to be removed.
32
+ * TODO: Remove this property
33
+ */
34
+ protected redirectOn403: boolean;
35
+ /**
36
+ * @deprecated Use the new custom method execute403Redirect() to trigger redirect to 403. This property is marked to be removed.
37
+ * TODO: Remove this property
38
+ */
39
+ protected redirect403Url: string[];
40
+ /**
41
+ * @deprecated Use either executeBeforePipesOnSuccess() or executeBeforePipesOnError() base on your case. This method is marked to be removed.
42
+ */
43
+ protected postHttpRequest: () => void;
17
44
  }
@@ -1,27 +1,46 @@
1
1
  import { HttpClient, HttpHeaders } from '@angular/common/http';
2
2
  import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
3
3
  import { Observable } from 'rxjs';
4
- import { VonHttpOptionsModel } from './model/von-http-options.model';
5
- import { DeleteParams, GenericParams, GetParams, HeaderParams, PostParams, PutParams } from './model/von-rest-definition.type';
4
+ import { HeaderParams } from './models/von-header-params.model';
5
+ import { VonHttpOptionsModel } from './models/von-http-options.model';
6
+ import { BaseParams, BodyParams, GenericParams } from './models/von-rest-definition.model';
7
+ /**
8
+ * Rest service wrapper for API calls. This class needs to be extended in a `@Injectable({ providedIn: 'root' })` service.
9
+ * Parameters needed:
10
+ * @HttpClient
11
+ * @DomSanitizer
12
+ */
6
13
  export declare abstract class VonRestService {
7
14
  protected http: HttpClient;
8
15
  protected sanitizer: DomSanitizer;
9
16
  constructor(http: HttpClient, sanitizer: DomSanitizer);
10
- protected setHeaders: (headerParams?: HeaderParams | undefined) => HttpHeaders;
11
- protected setOptions: ({ headerParams, params, }: {
12
- headerParams?: HeaderParams | undefined;
13
- params?: GenericParams | undefined;
17
+ /**
18
+ * Allows to set the default headers
19
+ * @param headerParams Check HeaderParams interface to verify allowed overrides
20
+ * @returns
21
+ * ```json
22
+ * {
23
+ * "Content-Type": "application/json",
24
+ * "Accept": "application/json",
25
+ * "Access-Control-Allow-Origin": "*"
26
+ * }
27
+ * ```
28
+ */
29
+ protected setHeaders: (headerParams?: HeaderParams) => HttpHeaders;
30
+ protected setOptions: ({ headerParams, queryParams: params, }?: {
31
+ headerParams?: HeaderParams;
32
+ queryParams?: GenericParams;
14
33
  }) => VonHttpOptionsModel;
15
- protected setOptionsForFile: ({ headerParams, params, }: {
16
- headerParams?: HeaderParams | undefined;
17
- params?: GenericParams | undefined;
34
+ protected setOptionsForFile: ({ headerParams, queryParams, }?: {
35
+ headerParams?: HeaderParams;
36
+ queryParams?: GenericParams;
18
37
  }) => VonHttpOptionsModel;
19
- protected setUrlParams: (url: string, params?: GenericParams | undefined) => string;
20
- authenticate: (url: string, username: string, password: string) => Observable<any>;
21
- get: <R = any>({ url, urlParams, params, header: headerParams, }: GetParams) => Observable<R>;
22
- file: ({ url, urlParams, params, header: headerParams, }: GetParams) => Observable<SafeResourceUrl>;
23
- delete: <R = any>({ url, urlParams, params, header: headerParams, }: DeleteParams) => Observable<R>;
24
- post: <R = any, B = any>({ url, body, urlParams, params, header: headerParams, }: PostParams<B>) => Observable<R>;
25
- put: <R = any, B = any>({ url, body, urlParams, params, header: headerParams, }: PutParams<B>) => Observable<R>;
26
- patch: <R = any, B = any>({ url, body, urlParams, params, header: headerParams, }: PutParams<B>) => Observable<R>;
38
+ protected setUrlParams: (url: string, params?: GenericParams) => string;
39
+ protected authenticate: (url: string, username: string, password: string) => Observable<any>;
40
+ protected get: <R = any>({ url, urlParams, queryParams: params, headerParams, header: oldHeaderParams, params: oldParams, }: BaseParams) => Observable<R>;
41
+ protected delete: <R = any>({ url, urlParams, queryParams: params, headerParams, header: oldHeaderParams, params: oldParams, }: BaseParams) => Observable<R>;
42
+ protected post: <R = any, B = GenericParams | FormData>({ url, body, urlParams, queryParams: params, headerParams, header: oldHeaderParams, params: oldParams, }: BodyParams<B>) => Observable<R>;
43
+ protected put: <R = any, B = GenericParams | FormData>({ url, body, urlParams, queryParams: params, headerParams, header: oldHeaderParams, params: oldParams, }: BodyParams<B>) => Observable<R>;
44
+ protected patch: <R = any, B = GenericParams | FormData>({ url, body, urlParams, queryParams: params, headerParams, header: oldHeaderParams, params: oldParams, }: BodyParams<B>) => Observable<R>;
45
+ protected file: ({ url, urlParams, queryParams: params, headerParams, header: oldHeaderParams, params: oldParams, }: BaseParams) => Observable<SafeResourceUrl>;
27
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@von-development-studio/angular-rest-service",
3
- "version": "2.0.4-SNAPSHOT",
3
+ "version": "19.2.0",
4
4
  "description": "Angular Rest Service wrapper.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,36 +8,28 @@
8
8
  },
9
9
  "keywords": [
10
10
  "angular",
11
- "angular 13",
11
+ "angular 19",
12
12
  "rest client"
13
13
  ],
14
14
  "author": "Luis García Castro",
15
15
  "license": "MIT",
16
16
  "peerDependencies": {
17
- "@angular/common": "^13.3.11",
18
- "@angular/core": "^13.3.11"
17
+ "@angular/common": "^19.2.0",
18
+ "@angular/core": "^19.2.0"
19
19
  },
20
20
  "dependencies": {
21
21
  "tslib": "^2.4.0"
22
22
  },
23
- "module": "fesm2015/von-development-studio-angular-rest-service.mjs",
24
- "es2020": "fesm2020/von-development-studio-angular-rest-service.mjs",
25
- "esm2020": "esm2020/von-development-studio-angular-rest-service.mjs",
26
- "fesm2020": "fesm2020/von-development-studio-angular-rest-service.mjs",
27
- "fesm2015": "fesm2015/von-development-studio-angular-rest-service.mjs",
28
- "typings": "von-development-studio-angular-rest-service.d.ts",
23
+ "sideEffects": false,
24
+ "module": "fesm2022/von-development-studio-angular-rest-service.mjs",
25
+ "typings": "index.d.ts",
29
26
  "exports": {
30
27
  "./package.json": {
31
28
  "default": "./package.json"
32
29
  },
33
30
  ".": {
34
- "types": "./von-development-studio-angular-rest-service.d.ts",
35
- "esm2020": "./esm2020/von-development-studio-angular-rest-service.mjs",
36
- "es2020": "./fesm2020/von-development-studio-angular-rest-service.mjs",
37
- "es2015": "./fesm2015/von-development-studio-angular-rest-service.mjs",
38
- "node": "./fesm2015/von-development-studio-angular-rest-service.mjs",
39
- "default": "./fesm2020/von-development-studio-angular-rest-service.mjs"
31
+ "types": "./index.d.ts",
32
+ "default": "./fesm2022/von-development-studio-angular-rest-service.mjs"
40
33
  }
41
- },
42
- "sideEffects": false
34
+ }
43
35
  }