@bootkit/ng0 0.0.0-alpha.2 → 0.0.0-alpha.21
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/common/index.d.ts +118 -6
- package/components/accordion/index.d.ts +1 -1
- package/components/backdrop/index.d.ts +12 -0
- package/components/button/index.d.ts +48 -0
- package/components/card/index.d.ts +27 -0
- package/components/code/index.d.ts +35 -0
- package/components/confirmation/index.d.ts +66 -0
- package/components/dropdown/index.d.ts +78 -0
- package/components/form-field/index.d.ts +72 -0
- package/components/list/index.d.ts +127 -0
- package/components/modal/index.d.ts +22 -4
- package/components/nav/index.d.ts +23 -19
- package/components/pagination/index.d.ts +35 -9
- package/components/popover/index.d.ts +1 -1
- package/components/select/index.d.ts +116 -0
- package/components/sidenav/index.d.ts +59 -0
- package/components/stepper/index.d.ts +26 -0
- package/components/table/index.d.ts +273 -0
- package/components/toast/index.d.ts +1 -1
- package/components/tooltip/index.d.ts +1 -1
- package/components/vertical-menu/index.d.ts +61 -0
- package/data/index.d.ts +258 -46
- package/date/index.d.ts +34 -0
- package/fesm2022/bootkit-ng0-common.mjs +89 -11
- package/fesm2022/bootkit-ng0-common.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-accordion.mjs +13 -13
- package/fesm2022/bootkit-ng0-components-accordion.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-backdrop.mjs +46 -0
- package/fesm2022/bootkit-ng0-components-backdrop.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-button.mjs +119 -0
- package/fesm2022/bootkit-ng0-components-button.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-card.mjs +62 -0
- package/fesm2022/bootkit-ng0-components-card.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-code.mjs +70 -0
- package/fesm2022/bootkit-ng0-components-code.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-collapse.mjs +14 -14
- package/fesm2022/bootkit-ng0-components-collapse.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-confirmation.mjs +167 -0
- package/fesm2022/bootkit-ng0-components-confirmation.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-dropdown.mjs +189 -0
- package/fesm2022/bootkit-ng0-components-dropdown.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-form-field.mjs +147 -0
- package/fesm2022/bootkit-ng0-components-form-field.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-list.mjs +331 -0
- package/fesm2022/bootkit-ng0-components-list.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-modal.mjs +40 -23
- package/fesm2022/bootkit-ng0-components-modal.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-nav.mjs +58 -59
- package/fesm2022/bootkit-ng0-components-nav.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-offcanvas.mjs +9 -9
- package/fesm2022/bootkit-ng0-components-offcanvas.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-overlay.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-pagination.mjs +58 -23
- package/fesm2022/bootkit-ng0-components-pagination.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-popover.mjs +10 -10
- package/fesm2022/bootkit-ng0-components-popover.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-select.mjs +427 -0
- package/fesm2022/bootkit-ng0-components-select.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-sidenav.mjs +153 -0
- package/fesm2022/bootkit-ng0-components-sidenav.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-stepper.mjs +91 -0
- package/fesm2022/bootkit-ng0-components-stepper.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-table.mjs +461 -0
- package/fesm2022/bootkit-ng0-components-table.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-toast.mjs +7 -7
- package/fesm2022/bootkit-ng0-components-toast.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-tooltip.mjs +8 -8
- package/fesm2022/bootkit-ng0-components-tooltip.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-vertical-menu.mjs +161 -0
- package/fesm2022/bootkit-ng0-components-vertical-menu.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-data.mjs +291 -90
- package/fesm2022/bootkit-ng0-data.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-date.mjs +50 -0
- package/fesm2022/bootkit-ng0-date.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-file.mjs +50 -0
- package/fesm2022/bootkit-ng0-file.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-form.mjs +514 -0
- package/fesm2022/bootkit-ng0-form.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-http.mjs +225 -179
- package/fesm2022/bootkit-ng0-http.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-localization-locales.mjs +115 -0
- package/fesm2022/bootkit-ng0-localization-locales.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-localization.mjs +481 -0
- package/fesm2022/bootkit-ng0-localization.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-platform-browser.mjs +51 -0
- package/fesm2022/bootkit-ng0-platform-browser.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-script.mjs +59 -0
- package/fesm2022/bootkit-ng0-script.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-security.mjs +17 -15
- package/fesm2022/bootkit-ng0-security.mjs.map +1 -1
- package/file/index.d.ts +22 -0
- package/form/index.d.ts +127 -0
- package/http/index.d.ts +141 -40
- package/localization/index.d.ts +305 -0
- package/localization/locales/index.d.ts +7 -0
- package/package.json +90 -10
- package/platform/browser/index.d.ts +22 -0
- package/script/index.d.ts +27 -0
- package/security/index.d.ts +3 -9
|
@@ -1,231 +1,277 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { HttpParams } from '@angular/common/http';
|
|
3
|
-
import { Subject, of, tap, map } from 'rxjs';
|
|
1
|
+
import { Subject, of, tap, Observable, map } from 'rxjs';
|
|
4
2
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { InjectionToken, makeStateKey, PLATFORM_ID, Inject,
|
|
3
|
+
import { InjectionToken, makeEnvironmentProviders, inject, makeStateKey, runInInjectionContext, PLATFORM_ID, Inject, Injectable } from '@angular/core';
|
|
6
4
|
import { isPlatformServer } from '@angular/common';
|
|
5
|
+
import * as i1 from '@angular/common/http';
|
|
6
|
+
import { HttpClient } from '@angular/common/http';
|
|
7
7
|
import { DataResult } from '@bootkit/ng0/data';
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
class HttpResponseEvent extends HttpEvent {
|
|
24
|
-
constructor(url, options) {
|
|
25
|
-
super(url, options);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
class HttpErrorEvent extends HttpEvent {
|
|
29
|
-
constructor(url, options) {
|
|
30
|
-
super(url, options);
|
|
31
|
-
}
|
|
9
|
+
const HTTP_SERVICE_CONFIG = new InjectionToken('HttpServiceConfig');
|
|
10
|
+
/**
|
|
11
|
+
* Provides the configuration for the HttpService.
|
|
12
|
+
* @param config
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
function provideHttpService(config, ...features) {
|
|
16
|
+
// const mergedfeatures = Object.assign({}, ...features);
|
|
17
|
+
return makeEnvironmentProviders([
|
|
18
|
+
HttpService,
|
|
19
|
+
{ provide: HTTP_SERVICE_CONFIG, useValue: config || {} },
|
|
20
|
+
features.map((feature) => feature.ɵproviders),
|
|
21
|
+
]);
|
|
32
22
|
}
|
|
33
23
|
|
|
24
|
+
/**
|
|
25
|
+
* HttpService provides a simple HTTP client for making requests.
|
|
26
|
+
* It supports GET, POST, PUT, DELETE methods and can handle DataRequest objects.
|
|
27
|
+
* It also supports transfer state for server-side rendering.
|
|
28
|
+
* It emits events for request lifecycle: Send, Progress, Complete and Error.
|
|
29
|
+
* It can be configured with a base URL and a default DataRequest resolver.
|
|
30
|
+
* It can also handle multipart/form-data requests.
|
|
31
|
+
*/
|
|
34
32
|
class HttpService {
|
|
35
|
-
|
|
33
|
+
http;
|
|
36
34
|
transferState;
|
|
35
|
+
injector;
|
|
37
36
|
platformId;
|
|
38
37
|
_eventsSubject = new Subject();
|
|
39
38
|
_baseUrl;
|
|
40
39
|
events = this._eventsSubject.asObservable();
|
|
41
40
|
defaultHeaders;
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
_config = inject(HTTP_SERVICE_CONFIG);
|
|
42
|
+
constructor(http, transferState, injector, platformId) {
|
|
43
|
+
this.http = http;
|
|
44
44
|
this.transferState = transferState;
|
|
45
|
+
this.injector = injector;
|
|
45
46
|
this.platformId = platformId;
|
|
46
|
-
this._baseUrl =
|
|
47
|
+
this._baseUrl = this._config.baseUrl ?? '';
|
|
47
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Sends a GET request to the specified URL.
|
|
51
|
+
* @param url The URL to send the request to.
|
|
52
|
+
* @param options The options for the request.
|
|
53
|
+
* @returns An observable of the response.
|
|
54
|
+
*/
|
|
48
55
|
get(url, options) {
|
|
49
|
-
this.
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
obs = this._handleTransferState(obs, options);
|
|
54
|
-
return obs;
|
|
55
|
-
}
|
|
56
|
-
_handleTransferState(obs, options) {
|
|
57
|
-
if (!options?.transferState) {
|
|
58
|
-
return obs;
|
|
56
|
+
this._verifyOptions(options);
|
|
57
|
+
const transferStateData = this._findInTransferState(options);
|
|
58
|
+
if (transferStateData.found) {
|
|
59
|
+
return of(transferStateData.data);
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (this.transferState.hasKey(key)) {
|
|
66
|
-
const data = this.transferState.get(key, null);
|
|
67
|
-
if (options.transferState.clearAfterUse || true) {
|
|
68
|
-
this.transferState.remove(key); // Free memory
|
|
61
|
+
this._eventsSubject.next({ type: 'Send', url, options });
|
|
62
|
+
let obs = this.http.get(this._makeUrl(url, options), options).pipe(tap(result => {
|
|
63
|
+
if (isPlatformServer(this.platformId) && options?.transferState) {
|
|
64
|
+
const key = makeStateKey(options.id);
|
|
65
|
+
this.transferState.set(key, result);
|
|
69
66
|
}
|
|
70
|
-
|
|
67
|
+
}));
|
|
68
|
+
return this._handleEvents(obs, url, options);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Sends a DataRequest to the specified URL and returns a DataResult.
|
|
72
|
+
* This method is used for paginated or filtered data requests.
|
|
73
|
+
* It uses the configured DataRequestResolver to handle the request.
|
|
74
|
+
* @param url The URL to send the request to.
|
|
75
|
+
* @param request The DataRequest object containing the request parameters.
|
|
76
|
+
* @param options The options for the request.
|
|
77
|
+
* @returns An observable of DataResult<T>.
|
|
78
|
+
*/
|
|
79
|
+
getDataResult(url, request, options) {
|
|
80
|
+
this._verifyOptions(options);
|
|
81
|
+
const transferStateData = this._findInTransferState(options);
|
|
82
|
+
if (transferStateData.found) {
|
|
83
|
+
return of(transferStateData.data);
|
|
71
84
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
}));
|
|
85
|
+
this._eventsSubject.next({ type: 'Send', url, options });
|
|
86
|
+
let resolver = this._config.dataRequestResolver;
|
|
87
|
+
if (!resolver) {
|
|
88
|
+
throw new Error('No HttpDataRequestResolver provided.');
|
|
78
89
|
}
|
|
90
|
+
const URL = this._makeUrl(url, options);
|
|
91
|
+
let obs = runInInjectionContext(this.injector, resolver.bind(null, URL, request, options));
|
|
92
|
+
if (!(obs instanceof Observable)) {
|
|
93
|
+
throw Error('HttpDataRequestResolver should return an observable.');
|
|
94
|
+
}
|
|
95
|
+
return this._handleEvents(obs, url, options);
|
|
79
96
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.pipe(map((x) => new DataResult(request, x.data, x.total)));
|
|
88
|
-
return this.tap(o, url, options);
|
|
89
|
-
}
|
|
97
|
+
/**
|
|
98
|
+
* Sends a POST request to the specified URL with the given body.
|
|
99
|
+
* @param url The URL to send the request to.
|
|
100
|
+
* @param body The body of the request.
|
|
101
|
+
* @param options The options for the request.
|
|
102
|
+
* @returns An observable of the response.
|
|
103
|
+
*/
|
|
90
104
|
post(url, body, options) {
|
|
91
|
-
this.
|
|
92
|
-
|
|
93
|
-
const BODY = this.
|
|
94
|
-
|
|
95
|
-
return this.
|
|
105
|
+
this._verifyOptions(options);
|
|
106
|
+
this._eventsSubject.next({ type: 'Send', url, options });
|
|
107
|
+
const BODY = this._makeBody(body, options);
|
|
108
|
+
let obs = this.http.post(this._makeUrl(url, options), BODY, options);
|
|
109
|
+
return this._handleEvents(obs, url, options);
|
|
96
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Sends a PUT request to the specified URL with the given body.
|
|
113
|
+
* @param url The URL to send the request to.
|
|
114
|
+
* @param body The body of the request.
|
|
115
|
+
* @param options The options for the request.
|
|
116
|
+
* @returns An observable of the response.
|
|
117
|
+
*/
|
|
97
118
|
put(url, body, options) {
|
|
98
|
-
this.
|
|
99
|
-
|
|
100
|
-
const BODY = this.
|
|
101
|
-
|
|
102
|
-
return this.
|
|
119
|
+
this._verifyOptions(options);
|
|
120
|
+
this._eventsSubject.next({ type: 'Send', url, options });
|
|
121
|
+
const BODY = this._makeBody(body, options);
|
|
122
|
+
let obs = this.http.put(this._makeUrl(url, options), BODY, options);
|
|
123
|
+
return this._handleEvents(obs, url, options);
|
|
103
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Sends a DELETE request to the specified URL.
|
|
127
|
+
* @param url The URL to send the request to.
|
|
128
|
+
* @param options The options for the request.
|
|
129
|
+
* @returns An observable of the response.
|
|
130
|
+
*/
|
|
104
131
|
delete(url, options) {
|
|
105
|
-
this.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return this.
|
|
132
|
+
this._verifyOptions(options);
|
|
133
|
+
this._eventsSubject.next({ type: 'Send', url, options });
|
|
134
|
+
let obs = this.http.delete(this._makeUrl(url, options), options);
|
|
135
|
+
return this._handleEvents(obs, url, options);
|
|
109
136
|
}
|
|
110
|
-
|
|
137
|
+
_makeUrl(url, options) {
|
|
138
|
+
return (options?.pathType === 'absolute') ? url : (this._baseUrl + url);
|
|
139
|
+
}
|
|
140
|
+
_makeBody(body, options) {
|
|
141
|
+
if (options?.contentType === 'multipart/form-data') {
|
|
142
|
+
const formData = new FormData();
|
|
143
|
+
for (const key in body) {
|
|
144
|
+
if (body.hasOwnProperty(key)) {
|
|
145
|
+
const field = body[key];
|
|
146
|
+
let value;
|
|
147
|
+
if (typeof field === 'string' || field instanceof File) {
|
|
148
|
+
value = field;
|
|
149
|
+
}
|
|
150
|
+
else if (typeof field === 'number') {
|
|
151
|
+
value = field.toString();
|
|
152
|
+
}
|
|
153
|
+
else if (typeof field === 'object') {
|
|
154
|
+
value = JSON.stringify(field);
|
|
155
|
+
}
|
|
156
|
+
if (value) {
|
|
157
|
+
formData.append(key, value);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return formData;
|
|
162
|
+
}
|
|
163
|
+
return body;
|
|
164
|
+
}
|
|
165
|
+
_handleEvents(o, url, options) {
|
|
111
166
|
return o.pipe(tap({
|
|
112
167
|
next: r => {
|
|
113
|
-
this._eventsSubject.next(
|
|
168
|
+
this._eventsSubject.next({ type: 'Complete', url, options, response: r });
|
|
114
169
|
},
|
|
115
170
|
error: e => {
|
|
116
|
-
this._eventsSubject.next(
|
|
171
|
+
this._eventsSubject.next({ type: 'Error', url, options, error: e });
|
|
117
172
|
}
|
|
118
173
|
}));
|
|
119
174
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (!options) {
|
|
125
|
-
return undefined;
|
|
126
|
-
}
|
|
127
|
-
const ngOptions = {};
|
|
128
|
-
// Query String
|
|
129
|
-
const query = options.query;
|
|
130
|
-
if (typeof query === 'object') {
|
|
131
|
-
let params = new HttpParams();
|
|
132
|
-
for (const key in query) {
|
|
133
|
-
if (query.hasOwnProperty(key)) {
|
|
134
|
-
const value = query[key];
|
|
135
|
-
const type = typeof value;
|
|
136
|
-
if (type === 'string' || type === 'number' || type === 'boolean') {
|
|
137
|
-
params = params.set(key, value);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
175
|
+
_verifyOptions(options) {
|
|
176
|
+
if (options) {
|
|
177
|
+
if (options.transferState && !options.id) {
|
|
178
|
+
throw Error('To use transferState, set request id');
|
|
140
179
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
// Response Type
|
|
144
|
-
// if (options.responseType) {
|
|
145
|
-
ngOptions.responseType = options.responseType;
|
|
146
|
-
// }
|
|
147
|
-
if (!options.sendAuthToken) {
|
|
148
|
-
}
|
|
149
|
-
ngOptions.headers = this.defaultHeaders;
|
|
150
|
-
ngOptions.reportProgress = options.reportProgress;
|
|
151
|
-
ngOptions.observe = options.observe;
|
|
152
|
-
return ngOptions;
|
|
153
|
-
}
|
|
154
|
-
makeBody(body, options) {
|
|
155
|
-
body = this.processBodyFields(body);
|
|
156
|
-
if (!options || !options.contentType || options.contentType !== 'multipart/form-data') {
|
|
157
|
-
return body;
|
|
158
|
-
}
|
|
159
|
-
// contentType is multipart/form-data
|
|
160
|
-
const formData = new FormData();
|
|
161
|
-
for (const key in body) {
|
|
162
|
-
if (body.hasOwnProperty(key)) {
|
|
163
|
-
const field = body[key];
|
|
164
|
-
let value;
|
|
165
|
-
if (typeof field === 'string' || field instanceof File) {
|
|
166
|
-
value = field;
|
|
167
|
-
}
|
|
168
|
-
else if (typeof field === 'number') {
|
|
169
|
-
value = field.toString();
|
|
170
|
-
}
|
|
171
|
-
else if (typeof field === 'object') {
|
|
172
|
-
value = JSON.stringify(field);
|
|
173
|
-
}
|
|
174
|
-
if (value) {
|
|
175
|
-
formData.append(key, value);
|
|
176
|
-
}
|
|
180
|
+
if (this.transferState && (options.observe == 'events' || options.observe == 'response')) {
|
|
181
|
+
throw Error('TransferState is only supported with observe == body.');
|
|
177
182
|
}
|
|
178
183
|
}
|
|
179
|
-
return formData;
|
|
180
|
-
}
|
|
181
|
-
processBodyFields(body) {
|
|
182
|
-
return body;
|
|
183
184
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return result;
|
|
188
|
-
}
|
|
189
|
-
if (Number.isInteger(request.pageIndex) && Number.isInteger(request.pageSize)) {
|
|
190
|
-
result['page.size'] = request.pageSize;
|
|
191
|
-
result['page.index'] = request.pageIndex;
|
|
192
|
-
}
|
|
193
|
-
if (request.sort) {
|
|
194
|
-
result['sort[field]'] = request.sort.field;
|
|
195
|
-
result['sort[asc]'] = request.sort.asc;
|
|
196
|
-
}
|
|
197
|
-
for (let i = 0; i < request.filters.length; i++) {
|
|
198
|
-
const filter = request.filters[i];
|
|
199
|
-
result[`filters[${i}].field`] = filter.field;
|
|
200
|
-
result[`filters[${i}].operator`] = filter.operator;
|
|
201
|
-
result[`filters[${i}].value`] = filter.value;
|
|
185
|
+
_findInTransferState(options) {
|
|
186
|
+
if (!options?.transferState || isPlatformServer(this.platformId)) {
|
|
187
|
+
return { found: false, data: undefined };
|
|
202
188
|
}
|
|
203
|
-
|
|
204
|
-
|
|
189
|
+
const key = makeStateKey(options.id);
|
|
190
|
+
if (this.transferState.hasKey(key)) {
|
|
191
|
+
const data = this.transferState.get(key, null);
|
|
192
|
+
if (options.transferState?.['clearAfterUse']) {
|
|
193
|
+
this.transferState.remove(key); // Free memory
|
|
194
|
+
}
|
|
195
|
+
return { found: true, data: data };
|
|
205
196
|
}
|
|
206
|
-
return
|
|
197
|
+
return { found: false, data: undefined };
|
|
207
198
|
}
|
|
208
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
209
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.
|
|
199
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: HttpService, deps: [{ token: i1.HttpClient }, { token: i0.TransferState }, { token: i0.Injector }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
200
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: HttpService });
|
|
210
201
|
}
|
|
211
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
212
|
-
type: Injectable
|
|
213
|
-
|
|
214
|
-
providedIn: 'root'
|
|
215
|
-
}]
|
|
216
|
-
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: i0.TransferState }, { type: undefined, decorators: [{
|
|
202
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: HttpService, decorators: [{
|
|
203
|
+
type: Injectable
|
|
204
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: i0.TransferState }, { type: i0.Injector }, { type: undefined, decorators: [{
|
|
217
205
|
type: Inject,
|
|
218
206
|
args: [PLATFORM_ID]
|
|
219
|
-
}] }, { type: undefined, decorators: [{
|
|
220
|
-
type: Optional
|
|
221
|
-
}, {
|
|
222
|
-
type: Inject,
|
|
223
|
-
args: [HttpServiceBaseUrl]
|
|
224
207
|
}] }] });
|
|
225
208
|
|
|
209
|
+
/**
|
|
210
|
+
* HttpDataRequestWriter is a function that takes an HTTP request and a DataRequest
|
|
211
|
+
* and writes the DataRequest parameters to the HTTP request.
|
|
212
|
+
* This is used to convert a DataRequest into query parameters or request body.
|
|
213
|
+
* @param url The URL to send the request to.
|
|
214
|
+
* @param dataRequest The DataRequest to convert.
|
|
215
|
+
* @param httpClient The HttpClient to use for the request.
|
|
216
|
+
* @param options Additional options for the request, such as headers.
|
|
217
|
+
* @template T data item type
|
|
218
|
+
* @returns An Observable that emits the DataResult.
|
|
219
|
+
*/
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Default implementation of httpDataRequestResolver1.
|
|
223
|
+
* It adds DataRequest parameters as query string to the HTTP request.
|
|
224
|
+
* @param url
|
|
225
|
+
* @param dataRequest
|
|
226
|
+
* @param options
|
|
227
|
+
* @template T data item type
|
|
228
|
+
* @returns
|
|
229
|
+
*/
|
|
230
|
+
function httpDataRequestResolver1(url, dataRequest, options) {
|
|
231
|
+
var query = {};
|
|
232
|
+
const httpClient = inject(HttpClient);
|
|
233
|
+
if (dataRequest.page) {
|
|
234
|
+
query['page[size]'] = dataRequest.page.size;
|
|
235
|
+
query['page[index]'] = dataRequest.page.index;
|
|
236
|
+
}
|
|
237
|
+
if (dataRequest.sort) {
|
|
238
|
+
query['sort[field]'] = dataRequest.sort.field;
|
|
239
|
+
query['sort[asc]'] = dataRequest.sort.asc;
|
|
240
|
+
}
|
|
241
|
+
if (Array.isArray(dataRequest.filters)) {
|
|
242
|
+
for (let i = 0; i < dataRequest.filters.length; i++) {
|
|
243
|
+
const filter = dataRequest.filters[i];
|
|
244
|
+
query[`filters[${i}].field`] = filter.field;
|
|
245
|
+
query[`filters[${i}].operator`] = filter.operator;
|
|
246
|
+
query[`filters[${i}].value`] = filter.value;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (typeof dataRequest.computeTotal == 'boolean') {
|
|
250
|
+
query['computeTotal'] = dataRequest.computeTotal;
|
|
251
|
+
}
|
|
252
|
+
return httpClient.get(url, {
|
|
253
|
+
params: query,
|
|
254
|
+
headers: options?.headers,
|
|
255
|
+
}).pipe(map(result => {
|
|
256
|
+
return new DataResult(result.data, result.total);
|
|
257
|
+
}));
|
|
258
|
+
}
|
|
259
|
+
// /**
|
|
260
|
+
// * Provides httpDataRequestResolver1.
|
|
261
|
+
// * This is used to convert a DataRequest into query parameters for the HTTP (GET) request.
|
|
262
|
+
// * @returns
|
|
263
|
+
// */
|
|
264
|
+
// export function withHttpDataRequestResolver1(): HttpServiceFeature {
|
|
265
|
+
// return {
|
|
266
|
+
// ɵproviders: [
|
|
267
|
+
// { provide: DEFAULT_DATA_REQUEST_RESOLVER, useValue: HttpDataRequestResolver1 }
|
|
268
|
+
// ]
|
|
269
|
+
// };
|
|
270
|
+
// }
|
|
271
|
+
|
|
226
272
|
/**
|
|
227
273
|
* Generated bundle index. Do not edit.
|
|
228
274
|
*/
|
|
229
275
|
|
|
230
|
-
export {
|
|
276
|
+
export { HTTP_SERVICE_CONFIG, HttpService, httpDataRequestResolver1, provideHttpService };
|
|
231
277
|
//# sourceMappingURL=bootkit-ng0-http.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootkit-ng0-http.mjs","sources":["../../../projects/ng0/http/types.ts","../../../projects/ng0/http/http.service.ts","../../../projects/ng0/http/bootkit-ng0-http.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\r\n\r\nexport const HttpServiceBaseUrl = new InjectionToken('HttpServiceBaseUrl');\r\n\r\nexport interface HttpOptions {\r\n /** Http request ID */\r\n id?: string;\r\n query?: any;\r\n pathType?: 'relative' | 'absolute';\r\n responseType?: 'json' | 'blob' | 'text';\r\n contentType?: 'json' | 'multipart/form-data';\r\n reportProgress?: boolean;\r\n observe?: 'response' | 'body' | 'events';\r\n displayServerErrors?: boolean;\r\n sendAuthToken?: boolean;\r\n\r\n /** Save response in transfer state */\r\n transferState?: {\r\n enable: boolean,\r\n clearAfterUse?: boolean; \r\n };\r\n}\r\n\r\nexport abstract class HttpEvent {\r\n constructor(public readonly url: string, public readonly options?: HttpOptions) {\r\n }\r\n}\r\n\r\nexport class HttpRequestSendEvent extends HttpEvent {\r\n constructor(url: string, options?: HttpOptions) {\r\n super(url, options);\r\n }\r\n}\r\n\r\nexport class HttpResponseEvent extends HttpEvent {\r\n constructor(url: string, options?: HttpOptions) {\r\n super(url, options);\r\n }\r\n}\r\n\r\nexport class HttpErrorEvent extends HttpEvent {\r\n constructor(url: string, options?: HttpOptions) {\r\n super(url, options);\r\n }\r\n}\r\n","import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';\r\nimport { map, Observable, of, Subject, tap } from 'rxjs';\r\nimport { HttpErrorEvent, HttpEvent, HttpOptions, HttpRequestSendEvent, HttpResponseEvent, HttpServiceBaseUrl } from './types';\r\nimport { Inject, Injectable, makeStateKey, Optional, PLATFORM_ID, TransferState } from '@angular/core';\r\nimport { isPlatformServer } from '@angular/common';\r\nimport { DataRequest, DataResult } from '@bootkit/ng0/data';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class HttpService {\r\n private _eventsSubject = new Subject<HttpEvent>();\r\n private _baseUrl?: string;\r\n\r\n public events = this._eventsSubject.asObservable();\r\n public defaultHeaders?: HttpHeaders;\r\n\r\n constructor(\r\n private _http: HttpClient,\r\n private transferState: TransferState,\r\n @Inject(PLATFORM_ID) private platformId: object,\r\n @Optional() @Inject(HttpServiceBaseUrl) baseUrl?: string\r\n ) {\r\n this._baseUrl = typeof baseUrl == 'string' ? baseUrl : '';\r\n }\r\n\r\n public get<T>(url: string, options?: HttpOptions): Observable<T> {\r\n this._eventsSubject.next(new HttpRequestSendEvent(url, options));\r\n const URL = this.makeUrl(url, options);\r\n const OPTIONS = this.makeHttpClientOptions(options);\r\n let obs = this.tap<T>(this._http.get<T>(URL, OPTIONS), url, options);\r\n obs = this._handleTransferState(obs, options);\r\n return obs;\r\n }\r\n\r\n private _handleTransferState<T>(obs: Observable<T>, options: HttpOptions | undefined): Observable<T> {\r\n if (!options?.transferState) {\r\n return obs;\r\n }\r\n\r\n if (!options.id) {\r\n throw Error('To use transferState, set request id')\r\n }\r\n\r\n let key = makeStateKey<T>(options.id!);\r\n\r\n // Check if data exists in TransferState (to avoid refetching)\r\n if (this.transferState.hasKey(key)) {\r\n const data = this.transferState.get<T>(key, null!);\r\n\r\n if(options.transferState.clearAfterUse || true) { \r\n this.transferState.remove(key); // Free memory\r\n }\r\n \r\n return of<T>(data);\r\n } else {\r\n return obs.pipe(\r\n tap((d) => {\r\n if (isPlatformServer(this.platformId)) {\r\n this.transferState.set(key, d);\r\n }\r\n })\r\n )\r\n }\r\n }\r\n\r\n public getResult<T>(url: string, request: DataRequest, options?: HttpOptions): Observable<DataResult<T>> {\r\n this._eventsSubject.next(new HttpRequestSendEvent(url, options));\r\n const URL = this.makeUrl(url, options);\r\n options = options || {};\r\n options.query = { ...options.query, ...this.mapDataRequesToQueryObject(request) };\r\n const OPTIONS = this.makeHttpClientOptions(options);\r\n var o = this._http.get<{ data: any[], total: number }>(URL, OPTIONS)\r\n .pipe(\r\n map((x: any) => new DataResult(request, x.data, x.total))\r\n );\r\n\r\n return this.tap(o, url, options);\r\n }\r\n\r\n public post<T>(url: string, body: any, options?: HttpOptions): Observable<T> {\r\n this._eventsSubject.next(new HttpRequestSendEvent(url, options));\r\n const URL = this.makeUrl(url, options);\r\n const BODY = this.makeBody(body, options);\r\n const OPTIONS = this.makeHttpClientOptions(options);\r\n return this.tap<T>(this._http.post(URL, BODY, OPTIONS), url, options);\r\n }\r\n\r\n public put<T>(url: string, body: any, options?: HttpOptions): Observable<T> {\r\n this._eventsSubject.next(new HttpRequestSendEvent(url, options));\r\n const URL = this.makeUrl(url, options);\r\n const BODY = this.makeBody(body, options);\r\n const OPTIONS = this.makeHttpClientOptions(options);\r\n return this.tap<T>(this._http.put(URL, BODY, OPTIONS), url, options);\r\n }\r\n\r\n public delete<T>(url: string, options?: HttpOptions): Observable<T> {\r\n this._eventsSubject.next(new HttpRequestSendEvent(url, options));\r\n const URL = this.makeUrl(url, options);\r\n const OPTIONS = this.makeHttpClientOptions(options);\r\n return this.tap<T>(this._http.delete(URL, OPTIONS), url, options);\r\n }\r\n\r\n private tap<T>(o: Observable<any>, url: string, options?: HttpOptions): Observable<T> {\r\n return o.pipe(\r\n tap({\r\n next: r => {\r\n this._eventsSubject.next(new HttpResponseEvent(url, options));\r\n },\r\n error: e => {\r\n this._eventsSubject.next(new HttpErrorEvent(url, options))\r\n }\r\n })\r\n )\r\n }\r\n\r\n private makeUrl(url: string, options?: HttpOptions) {\r\n return (options?.pathType === 'absolute') ? url : (this._baseUrl + url);\r\n }\r\n\r\n private makeHttpClientOptions(options?: HttpOptions) {\r\n if (!options) {\r\n return undefined;\r\n }\r\n\r\n const ngOptions: any = {};\r\n\r\n // Query String\r\n const query = options.query;\r\n if (typeof query === 'object') {\r\n let params = new HttpParams();\r\n for (const key in query) {\r\n if (query.hasOwnProperty(key)) {\r\n const value = query[key];\r\n const type = typeof value;\r\n if (type === 'string' || type === 'number' || type === 'boolean') {\r\n params = params.set(key, value);\r\n }\r\n }\r\n }\r\n ngOptions.params = params;\r\n }\r\n\r\n // Response Type\r\n // if (options.responseType) {\r\n ngOptions.responseType = options.responseType;\r\n // }\r\n\r\n if (!options.sendAuthToken) {\r\n }\r\n\r\n ngOptions.headers = this.defaultHeaders;\r\n ngOptions.reportProgress = options.reportProgress;\r\n ngOptions.observe = options.observe;\r\n\r\n return ngOptions;\r\n }\r\n\r\n private makeBody(body: any, options?: HttpOptions) {\r\n body = this.processBodyFields(body);\r\n if (!options || !options.contentType || options.contentType !== 'multipart/form-data') {\r\n return body;\r\n }\r\n\r\n // contentType is multipart/form-data\r\n const formData = new FormData();\r\n for (const key in body) {\r\n if (body.hasOwnProperty(key)) {\r\n const field = body[key];\r\n let value;\r\n\r\n if (typeof field === 'string' || field instanceof File) {\r\n value = field;\r\n } else if (typeof field === 'number') {\r\n value = field.toString();\r\n } else if (typeof field === 'object') {\r\n value = JSON.stringify(field);\r\n }\r\n\r\n if (value) {\r\n formData.append(key, value);\r\n }\r\n }\r\n }\r\n return formData;\r\n }\r\n\r\n private processBodyFields(body: any) {\r\n return body;\r\n }\r\n\r\n private mapDataRequesToQueryObject(request: DataRequest) {\r\n var result: { [key: string]: any } = {};\r\n\r\n if (!request) {\r\n return result;\r\n }\r\n\r\n if (Number.isInteger(request.pageIndex) && Number.isInteger(request.pageSize)) {\r\n result['page.size'] = request.pageSize;\r\n result['page.index'] = request.pageIndex;\r\n }\r\n\r\n if (request.sort) {\r\n result['sort[field]'] = request.sort.field;\r\n result['sort[asc]'] = request.sort.asc;\r\n }\r\n\r\n for (let i = 0; i < request.filters.length; i++) {\r\n const filter = request.filters[i];\r\n result[`filters[${i}].field`] = filter.field;\r\n result[`filters[${i}].operator`] = filter.operator;\r\n result[`filters[${i}].value`] = filter.value;\r\n }\r\n\r\n if (typeof request.computeTotal == 'boolean') {\r\n result['ct'] = request.computeTotal;\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAEa,kBAAkB,GAAG,IAAI,cAAc,CAAC,oBAAoB;MAqBnD,SAAS,CAAA;AACC,IAAA,GAAA;AAA6B,IAAA,OAAA;IAAzD,WAA4B,CAAA,GAAW,EAAkB,OAAqB,EAAA;QAAlD,IAAG,CAAA,GAAA,GAAH,GAAG;QAA0B,IAAO,CAAA,OAAA,GAAP,OAAO;;AAEnE;AAEK,MAAO,oBAAqB,SAAQ,SAAS,CAAA;IAC/C,WAAY,CAAA,GAAW,EAAE,OAAqB,EAAA;AAC1C,QAAA,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC;;AAE1B;AAEK,MAAO,iBAAkB,SAAQ,SAAS,CAAA;IAC5C,WAAY,CAAA,GAAW,EAAE,OAAqB,EAAA;AAC1C,QAAA,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC;;AAE1B;AAEK,MAAO,cAAe,SAAQ,SAAS,CAAA;IACzC,WAAY,CAAA,GAAW,EAAE,OAAqB,EAAA;AAC1C,QAAA,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC;;AAE1B;;MClCY,WAAW,CAAA;AAQZ,IAAA,KAAA;AACA,IAAA,aAAA;AACq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CAAA,OAAA,CAAS,CAAC,GAAG,MAAM,CAAC,KAAK;;AAG9C,QAAA,IAAI,OAAO,OAAO,CAAC,YAAY,IAAI,SAAS,EAAE;AAC5C,YAAA,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,YAAY;;AAGrC,QAAA,OAAO,MAAM;;uGAjNJ,WAAW,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,aAAA,EAAA,EAAA,EAAA,KAAA,EAUZ,WAAW,EAAA,EAAA,EAAA,KAAA,EACC,kBAAkB,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAX7B,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,cAFV,MAAM,EAAA,CAAA;;2FAEP,WAAW,EAAA,UAAA,EAAA,CAAA;kBAHvB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE;AACb,iBAAA;;0BAWI,MAAM;2BAAC,WAAW;;0BAClB;;0BAAY,MAAM;2BAAC,kBAAkB;;;ACrB1C;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"bootkit-ng0-http.mjs","sources":["../../../projects/ng0/http/provide.ts","../../../projects/ng0/http/http.service.ts","../../../projects/ng0/http/types.ts","../../../projects/ng0/http/data-request-resolvers/http-data-request-resolver-1.ts","../../../projects/ng0/http/bootkit-ng0-http.ts"],"sourcesContent":["import { EnvironmentProviders, InjectionToken, makeEnvironmentProviders, Provider } from \"@angular/core\";\r\nimport { HttpDataRequestResolver } from \"./types\";\r\nimport { HttpService } from \"./http.service\";\r\n\r\nexport const HTTP_SERVICE_CONFIG = new InjectionToken<HttpServiceConfig>('HttpServiceConfig');\r\n\r\n/**\r\n * Configuration for the HttpService.\r\n */\r\nexport interface HttpServiceConfig {\r\n /**\r\n * Base URL for the HTTP requests.\r\n * This is prepended to all request URLs.\r\n */\r\n baseUrl?: string;\r\n\r\n /**\r\n * A Resolver function to convert DataRequest to DataResult.\r\n */\r\n dataRequestResolver?: HttpDataRequestResolver;\r\n}\r\n\r\nexport interface HttpServiceFeature { \r\n ɵproviders: Array<Provider | EnvironmentProviders>;\r\n}\r\n\r\n/**\r\n * Provides the configuration for the HttpService.\r\n * @param config \r\n * @returns \r\n */\r\nexport function provideHttpService(config?: HttpServiceConfig, ...features: Partial<HttpServiceFeature>[]) {\r\n // const mergedfeatures = Object.assign({}, ...features);\r\n return makeEnvironmentProviders([\r\n HttpService,\r\n { provide: HTTP_SERVICE_CONFIG, useValue: config || {} },\r\n features.map((feature) => feature.ɵproviders),\r\n ]);\r\n}\r\n","import { HttpClient, HttpHeaders } from '@angular/common/http';\r\nimport { Observable, of, Subject, tap } from 'rxjs';\r\nimport { HttpRequestOptions, HttpRequestEvent } from './types';\r\nimport { inject, Inject, Injectable, Injector, makeStateKey, PLATFORM_ID, runInInjectionContext, TransferState } from '@angular/core';\r\nimport { isPlatformServer } from '@angular/common';\r\nimport { DataRequest, DataResult } from '@bootkit/ng0/data';\r\nimport { HTTP_SERVICE_CONFIG } from './provide';\r\n\r\n/**\r\n * HttpService provides a simple HTTP client for making requests.\r\n * It supports GET, POST, PUT, DELETE methods and can handle DataRequest objects.\r\n * It also supports transfer state for server-side rendering.\r\n * It emits events for request lifecycle: Send, Progress, Complete and Error.\r\n * It can be configured with a base URL and a default DataRequest resolver.\r\n * It can also handle multipart/form-data requests.\r\n */\r\n@Injectable()\r\nexport class HttpService {\r\n private _eventsSubject = new Subject<HttpRequestEvent>();\r\n private _baseUrl?: string;\r\n\r\n public events = this._eventsSubject.asObservable();\r\n public defaultHeaders?: HttpHeaders;\r\n\r\n private readonly _config = inject(HTTP_SERVICE_CONFIG);\r\n\r\n constructor(\r\n private http: HttpClient,\r\n private transferState: TransferState,\r\n private injector: Injector,\r\n @Inject(PLATFORM_ID) private platformId: object,\r\n ) {\r\n this._baseUrl = this._config.baseUrl ?? '';\r\n }\r\n\r\n /**\r\n * Sends a GET request to the specified URL.\r\n * @param url The URL to send the request to.\r\n * @param options The options for the request.\r\n * @returns An observable of the response.\r\n */\r\n public get<T>(url: string, options?: HttpRequestOptions): Observable<T> {\r\n this._verifyOptions(options);\r\n const transferStateData = this._findInTransferState<T>(options);\r\n if (transferStateData.found) {\r\n return of(transferStateData.data!);\r\n }\r\n\r\n this._eventsSubject.next({ type: 'Send', url, options });\r\n let obs = this.http.get<T>(this._makeUrl(url, options), options as any).pipe(\r\n tap(result => {\r\n if (isPlatformServer(this.platformId) && options?.transferState) {\r\n const key = makeStateKey<T>(options.id);\r\n this.transferState.set(key, result as T);\r\n }\r\n })\r\n );\r\n return this._handleEvents<T>(obs, url, options);\r\n }\r\n\r\n\r\n /**\r\n * Sends a DataRequest to the specified URL and returns a DataResult.\r\n * This method is used for paginated or filtered data requests.\r\n * It uses the configured DataRequestResolver to handle the request. \r\n * @param url The URL to send the request to.\r\n * @param request The DataRequest object containing the request parameters.\r\n * @param options The options for the request.\r\n * @returns An observable of DataResult<T>.\r\n */\r\n public getDataResult<T>(url: string, request: DataRequest, options?: HttpRequestOptions): Observable<DataResult<T>> {\r\n this._verifyOptions(options);\r\n const transferStateData = this._findInTransferState<DataResult<T>>(options);\r\n if (transferStateData.found) {\r\n return of(transferStateData.data!);\r\n }\r\n\r\n this._eventsSubject.next({ type: 'Send', url, options });\r\n let resolver = this._config.dataRequestResolver;\r\n if (!resolver) {\r\n throw new Error('No HttpDataRequestResolver provided.');\r\n }\r\n\r\n const URL = this._makeUrl(url, options);\r\n let obs = runInInjectionContext<Observable<DataResult<T>>>(this.injector, resolver.bind(null, URL, request, options));\r\n if (!(obs instanceof Observable)) {\r\n throw Error('HttpDataRequestResolver should return an observable.');\r\n }\r\n\r\n return this._handleEvents(obs, url, options);\r\n }\r\n\r\n /**\r\n * Sends a POST request to the specified URL with the given body.\r\n * @param url The URL to send the request to.\r\n * @param body The body of the request.\r\n * @param options The options for the request.\r\n * @returns An observable of the response.\r\n */\r\n public post<T>(url: string, body: any, options?: HttpRequestOptions): Observable<T> {\r\n this._verifyOptions(options);\r\n this._eventsSubject.next({ type: 'Send', url, options });\r\n const BODY = this._makeBody(body, options);\r\n let obs = this.http.post(this._makeUrl(url, options), BODY, options as any) as Observable<T>;\r\n return this._handleEvents<T>(obs, url, options);\r\n }\r\n\r\n /**\r\n * Sends a PUT request to the specified URL with the given body.\r\n * @param url The URL to send the request to.\r\n * @param body The body of the request.\r\n * @param options The options for the request.\r\n * @returns An observable of the response.\r\n */\r\n public put<T>(url: string, body: any, options?: HttpRequestOptions): Observable<T> {\r\n this._verifyOptions(options);\r\n this._eventsSubject.next({ type: 'Send', url, options });\r\n const BODY = this._makeBody(body, options);\r\n let obs = this.http.put(this._makeUrl(url, options), BODY, options as any) as Observable<T>;\r\n return this._handleEvents<T>(obs, url, options);\r\n }\r\n\r\n /**\r\n * Sends a DELETE request to the specified URL.\r\n * @param url The URL to send the request to.\r\n * @param options The options for the request.\r\n * @returns An observable of the response.\r\n */\r\n public delete<T>(url: string, options?: HttpRequestOptions): Observable<T> {\r\n this._verifyOptions(options);\r\n this._eventsSubject.next({ type: 'Send', url, options });\r\n let obs = this.http.delete(this._makeUrl(url, options), options as any)\r\n return this._handleEvents<T>(obs, url, options);\r\n }\r\n\r\n private _makeUrl(url: string, options?: HttpRequestOptions) {\r\n return (options?.pathType === 'absolute') ? url : (this._baseUrl + url);\r\n }\r\n\r\n private _makeBody(body: any, options?: HttpRequestOptions) {\r\n if (options?.contentType === 'multipart/form-data') {\r\n const formData = new FormData();\r\n for (const key in body) {\r\n if (body.hasOwnProperty(key)) {\r\n const field = body[key];\r\n let value;\r\n\r\n if (typeof field === 'string' || field instanceof File) {\r\n value = field;\r\n } else if (typeof field === 'number') {\r\n value = field.toString();\r\n } else if (typeof field === 'object') {\r\n value = JSON.stringify(field);\r\n }\r\n\r\n if (value) {\r\n formData.append(key, value);\r\n }\r\n }\r\n }\r\n\r\n return formData;\r\n }\r\n\r\n return body;\r\n }\r\n\r\n private _handleEvents<T>(o: Observable<any>, url: string, options?: HttpRequestOptions): Observable<T> {\r\n return o.pipe(\r\n tap({\r\n next: r => {\r\n this._eventsSubject.next({ type: 'Complete', url, options, response: r });\r\n },\r\n error: e => {\r\n this._eventsSubject.next({ type: 'Error', url, options, error: e });\r\n }\r\n })\r\n )\r\n }\r\n\r\n private _verifyOptions(options?: HttpRequestOptions) {\r\n if (options) {\r\n if (options.transferState && !options.id) {\r\n throw Error('To use transferState, set request id')\r\n }\r\n\r\n if (this.transferState && (options.observe == 'events' || options.observe == 'response')) {\r\n throw Error('TransferState is only supported with observe == body.');\r\n }\r\n }\r\n }\r\n\r\n private _findInTransferState<T>(options?: HttpRequestOptions): { found: boolean, data: T | undefined } {\r\n if (!options?.transferState || isPlatformServer(this.platformId)) {\r\n return { found: false, data: undefined };\r\n }\r\n\r\n const key = makeStateKey<T>(options.id);\r\n if (this.transferState.hasKey(key)) {\r\n const data = this.transferState.get<T>(key, null!);\r\n if ((options.transferState as any)?.['clearAfterUse']) {\r\n this.transferState.remove(key); // Free memory\r\n }\r\n\r\n return { found: true, data: data };\r\n }\r\n\r\n return { found: false, data: undefined };\r\n }\r\n}\r\n","import { HttpClient, HttpHeaders, HttpParams, HttpRequest, HttpResponse } from '@angular/common/http';\r\nimport { DataRequest, DataResult } from '@bootkit/ng0/data';\r\nimport { Observable } from 'rxjs';\r\n\r\nexport interface HttpRequestOptions {\r\n /** Http request ID */\r\n id?: any;\r\n params?: HttpParams | Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;\r\n headers?: HttpHeaders | Record<string, string | string[]>;\r\n pathType?: 'relative' | 'absolute';\r\n responseType?: 'json' | 'blob' | 'text';\r\n contentType?: 'json' | 'multipart/form-data';\r\n reportProgress?: boolean;\r\n observe?: 'response' | 'body' | 'events';\r\n\r\n /**\r\n * Additional data to associate with this object.\r\n */\r\n tag?: Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;\r\n\r\n /** \r\n * Save response in transfer state \r\n * \r\n */\r\n transferState?: boolean | {\r\n /**\r\n * Clear transfer state after first read.\r\n */\r\n clearAfterUse?: boolean;\r\n };\r\n}\r\n\r\n/**\r\n * HttpDataRequestResolver is a function that takes a URL, a DataRequest, and options,\r\n * and returns an Observable that emits a DataResult.\r\n * This is used to convert a DataRequest into query parameters or request body for an HTTP request.\r\n * @param url The URL to send the request to.\r\n * @param dataRequest The DataRequest to convert.\r\n * @param options Additional options for the request, such as headers.\r\n */\r\nexport type HttpDataRequestResolver<T = any> = (url: string, dataRequest: DataRequest, options?: HttpRequestOptions) => Observable<DataResult<T>>;\r\n\r\nexport interface HttpRequestEventBase {\r\n type: 'Send' | 'Complete' | 'Progress' | 'Error';\r\n url: string;\r\n options?: HttpRequestOptions\r\n}\r\n\r\nexport interface HttpRequestSendEvent extends HttpRequestEventBase {\r\n type: 'Send';\r\n}\r\n\r\nexport interface HttpRequestCompleteEvent extends HttpRequestEventBase {\r\n type: 'Complete';\r\n response?: any;\r\n}\r\n\r\nexport interface HttpRequestProgressEvent extends HttpRequestEventBase {\r\n type: 'Progress';\r\n}\r\n\r\nexport interface HttpRequestErrorEvent extends HttpRequestEventBase {\r\n type: 'Error';\r\n error: any;\r\n}\r\n\r\nexport type HttpRequestEvent = HttpRequestSendEvent | HttpRequestCompleteEvent | HttpRequestProgressEvent | HttpRequestErrorEvent;\r\n\r\n/**\r\n * HttpDataRequestWriter is a function that takes an HTTP request and a DataRequest\r\n * and writes the DataRequest parameters to the HTTP request.\r\n * This is used to convert a DataRequest into query parameters or request body.\r\n * @param url The URL to send the request to.\r\n * @param dataRequest The DataRequest to convert.\r\n * @param httpClient The HttpClient to use for the request.\r\n * @param options Additional options for the request, such as headers.\r\n * @template T data item type\r\n * @returns An Observable that emits the DataResult.\r\n */\r\n","import { DataRequest, DataResult } from \"@bootkit/ng0/data\";\r\nimport { HttpRequestOptions } from \"../types\";\r\nimport { map, Observable } from \"rxjs\";\r\nimport { HttpClient } from \"@angular/common/http\";\r\nimport { inject } from \"@angular/core\";\r\n\r\n/**\r\n * Default implementation of httpDataRequestResolver1.\r\n * It adds DataRequest parameters as query string to the HTTP request.\r\n * @param url \r\n * @param dataRequest \r\n * @param options\r\n * @template T data item type\r\n * @returns \r\n */\r\nexport function httpDataRequestResolver1<T = any>(\r\n url: string,\r\n dataRequest: DataRequest,\r\n options?: HttpRequestOptions): Observable<DataResult<T>> {\r\n var query: Record<string, any> = {};\r\n\r\n const httpClient = inject(HttpClient);\r\n\r\n if (dataRequest.page) {\r\n query['page[size]'] = dataRequest.page.size;\r\n query['page[index]'] = dataRequest.page.index;\r\n }\r\n\r\n if (dataRequest.sort) {\r\n query['sort[field]'] = dataRequest.sort.field;\r\n query['sort[asc]'] = dataRequest.sort.asc;\r\n }\r\n\r\n if (Array.isArray(dataRequest.filters)) {\r\n for (let i = 0; i < dataRequest.filters.length; i++) {\r\n const filter = dataRequest.filters[i];\r\n query[`filters[${i}].field`] = filter.field;\r\n query[`filters[${i}].operator`] = filter.operator;\r\n query[`filters[${i}].value`] = filter.value;\r\n }\r\n }\r\n\r\n if (typeof dataRequest.computeTotal == 'boolean') {\r\n query['computeTotal'] = dataRequest.computeTotal;\r\n }\r\n\r\n return httpClient.get<{ data: T[], total?: number }>(url, {\r\n params: query,\r\n headers: options?.headers,\r\n }).pipe(\r\n map(result => {\r\n return new DataResult<T>(result.data, result.total)\r\n })\r\n );\r\n}\r\n\r\n// /**\r\n// * Provides httpDataRequestResolver1.\r\n// * This is used to convert a DataRequest into query parameters for the HTTP (GET) request.\r\n// * @returns \r\n// */\r\n// export function withHttpDataRequestResolver1(): HttpServiceFeature {\r\n// return {\r\n// ɵproviders: [\r\n// { provide: DEFAULT_DATA_REQUEST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