@experteam-mx/ngx-services 15.0.0 → 16.0.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 (38) hide show
  1. package/README.md +7 -7
  2. package/{esm2020 → esm2022}/experteam-mx-ngx-services.mjs +4 -4
  3. package/{esm2020 → esm2022}/lib/apis/api-catalog.models.mjs +1 -1
  4. package/{esm2020 → esm2022}/lib/apis/api-companies.service.mjs +255 -255
  5. package/{esm2020 → esm2022}/lib/apis/api-security.service.mjs +128 -128
  6. package/{esm2020 → esm2022}/lib/apis/models/api-companies.interfaces.mjs +1 -1
  7. package/{esm2020 → esm2022}/lib/apis/models/api-companies.types.mjs +1 -1
  8. package/{esm2020 → esm2022}/lib/apis/models/api-security.interfaces.mjs +1 -1
  9. package/{esm2020 → esm2022}/lib/apis/models/api-security.types.mjs +1 -1
  10. package/{esm2020 → esm2022}/lib/apis/models/api.models.mjs +1 -1
  11. package/{esm2020 → esm2022}/lib/helpers/http.mjs +65 -65
  12. package/{esm2020 → esm2022}/lib/interceptors/api-headers.interceptor.mjs +34 -34
  13. package/{esm2020 → esm2022}/lib/interceptors/api-token.interceptor.mjs +35 -35
  14. package/{esm2020 → esm2022}/lib/interceptors/http-caching.interceptor.mjs +38 -38
  15. package/{esm2020 → esm2022}/lib/ngx-services.models.mjs +1 -1
  16. package/{esm2020 → esm2022}/lib/ngx-services.module.mjs +37 -37
  17. package/{esm2020 → esm2022}/public-api.mjs +19 -19
  18. package/{fesm2020 → fesm2022}/experteam-mx-ngx-services.mjs +557 -557
  19. package/{fesm2020 → fesm2022}/experteam-mx-ngx-services.mjs.map +1 -1
  20. package/index.d.ts +5 -5
  21. package/lib/apis/api-catalog.models.d.ts +71 -71
  22. package/lib/apis/api-companies.service.d.ts +163 -163
  23. package/lib/apis/api-security.service.d.ts +79 -79
  24. package/lib/apis/models/api-companies.interfaces.d.ts +380 -380
  25. package/lib/apis/models/api-companies.types.d.ts +75 -75
  26. package/lib/apis/models/api-security.interfaces.d.ts +55 -55
  27. package/lib/apis/models/api-security.types.d.ts +30 -30
  28. package/lib/apis/models/api.models.d.ts +23 -23
  29. package/lib/helpers/http.d.ts +38 -38
  30. package/lib/interceptors/api-headers.interceptor.d.ts +16 -16
  31. package/lib/interceptors/api-token.interceptor.d.ts +19 -19
  32. package/lib/interceptors/http-caching.interceptor.d.ts +12 -12
  33. package/lib/ngx-services.models.d.ts +22 -22
  34. package/lib/ngx-services.module.d.ts +17 -17
  35. package/package.json +10 -16
  36. package/public-api.d.ts +12 -12
  37. package/fesm2015/experteam-mx-ngx-services.mjs +0 -593
  38. package/fesm2015/experteam-mx-ngx-services.mjs.map +0 -1
@@ -6,579 +6,579 @@ import { map, mergeMap, forkJoin, tap, of } from 'rxjs';
6
6
  import * as i2 from 'ngx-cookie-service';
7
7
  import { tap as tap$1 } from 'rxjs/operators';
8
8
 
9
- class NgxServicesModule {
10
- /**
11
- * Returns a module with providers for the NgxServicesModule.
12
- *
13
- * @param {Environment} environment - The environment configuration object.
14
- *
15
- * @return {ModuleWithProviders<NgxServicesModule>} The module with providers for the NgxServicesModule.
16
- */
17
- static forRoot(environment) {
18
- return {
19
- ngModule: NgxServicesModule,
20
- providers: [
21
- {
22
- provide: 'env',
23
- useValue: environment
24
- }
25
- ]
26
- };
27
- }
28
- }
29
- NgxServicesModulefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: NgxServicesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
30
- NgxServicesModulemod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: NgxServicesModule, imports: [HttpClientModule] });
31
- NgxServicesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: NgxServicesModule, imports: [HttpClientModule] });
32
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: NgxServicesModule, decorators: [{
33
- type: NgModule,
34
- args: [{
35
- declarations: [],
36
- imports: [
37
- HttpClientModule
38
- ],
39
- exports: []
40
- }]
9
+ class NgxServicesModule {
10
+ /**
11
+ * Returns a module with providers for the NgxServicesModule.
12
+ *
13
+ * @param {Environment} environment - The environment configuration object.
14
+ *
15
+ * @return {ModuleWithProviders<NgxServicesModule>} The module with providers for the NgxServicesModule.
16
+ */
17
+ static forRoot(environment) {
18
+ return {
19
+ ngModule: NgxServicesModule,
20
+ providers: [
21
+ {
22
+ provide: 'env',
23
+ useValue: environment
24
+ }
25
+ ]
26
+ };
27
+ }
28
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgxServicesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
29
+ static { thismod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: NgxServicesModule, imports: [HttpClientModule] }); }
30
+ static { thisinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgxServicesModule, imports: [HttpClientModule] }); }
31
+ }
32
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgxServicesModule, decorators: [{
33
+ type: NgModule,
34
+ args: [{
35
+ declarations: [],
36
+ imports: [
37
+ HttpClientModule
38
+ ],
39
+ exports: []
40
+ }]
41
41
  }] });
42
42
 
43
- /**
44
- * Convert an object of key-value pairs into a URL query string.
45
- *
46
- * @param {Object} params - The key-value pairs to converted into a query string.
47
- *
48
- * @return {string} - The generated query string.
49
- */
50
- const queryString = (params) => {
51
- let queryElements = [];
52
- Object.entries(params).forEach(([key, value]) => {
53
- if (Array.isArray(value)) {
54
- const arrayQuery = value
55
- .map((item) => `${encodeURIComponent(key)}=${encodeURIComponent(item)}`)
56
- .join('&');
57
- queryElements.push(arrayQuery);
58
- }
59
- else {
60
- const encodedQuery = `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
61
- queryElements.push(encodedQuery);
62
- }
63
- });
64
- const queryString = queryElements.join('&');
65
- return queryString.length ? `?${queryString}` : '';
66
- };
67
- /**
68
- * Creates an instance of HttpParams using the provided params object.
69
- *
70
- * @param {Object} params - The object containing the params to the HttpParams constructor.
71
- *
72
- * @returns {HttpParams} - An instance of HttpParams created from the params object.
73
- */
74
- const httpParams = (params) => new HttpParams({
75
- fromObject: params
76
- });
77
- /**
78
- * Returns the headers for generating PDF files.
79
- *
80
- * @param {string} format - The format of the headers, 'object' or 'http_header'.
81
- *
82
- * @returns {HttpHeaders | { [header: string]: string | string[] }} - The headers for generating PDF files.
83
- */
84
- const pdfHeaders = (format = 'object') => {
85
- const headers = {
86
- 'Accept': 'application/pdf'
87
- };
88
- return format === 'object'
89
- ? headers
90
- : new HttpHeaders(headers);
91
- };
92
- /**
93
- * Returns the headers for generating XML files.
94
- *
95
- * @param {string} format - The format of the headers, 'object' or 'http_header'.
96
- *
97
- * @returns {HttpHeaders | { [header: string]: string | string[] }} - The headers for generating XML files.
98
- */
99
- const xmlHeaders = (format = 'object') => {
100
- const headers = {
101
- 'Accept': 'application/xml',
102
- };
103
- return format === 'object'
104
- ? headers
105
- : new HttpHeaders(headers);
43
+ /**
44
+ * Convert an object of key-value pairs into a URL query string.
45
+ *
46
+ * @param {Object} params - The key-value pairs to converted into a query string.
47
+ *
48
+ * @return {string} - The generated query string.
49
+ */
50
+ const queryString = (params) => {
51
+ let queryElements = [];
52
+ Object.entries(params).forEach(([key, value]) => {
53
+ if (Array.isArray(value)) {
54
+ const arrayQuery = value
55
+ .map((item) => `${encodeURIComponent(key)}=${encodeURIComponent(item)}`)
56
+ .join('&');
57
+ queryElements.push(arrayQuery);
58
+ }
59
+ else {
60
+ const encodedQuery = `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
61
+ queryElements.push(encodedQuery);
62
+ }
63
+ });
64
+ const queryString = queryElements.join('&');
65
+ return queryString.length ? `?${queryString}` : '';
66
+ };
67
+ /**
68
+ * Creates an instance of HttpParams using the provided params object.
69
+ *
70
+ * @param {Object} params - The object containing the params to the HttpParams constructor.
71
+ *
72
+ * @returns {HttpParams} - An instance of HttpParams created from the params object.
73
+ */
74
+ const httpParams = (params) => new HttpParams({
75
+ fromObject: params
76
+ });
77
+ /**
78
+ * Returns the headers for generating PDF files.
79
+ *
80
+ * @param {string} format - The format of the headers, 'object' or 'http_header'.
81
+ *
82
+ * @returns {HttpHeaders | { [header: string]: string | string[] }} - The headers for generating PDF files.
83
+ */
84
+ const pdfHeaders = (format = 'object') => {
85
+ const headers = {
86
+ 'Accept': 'application/pdf'
87
+ };
88
+ return format === 'object'
89
+ ? headers
90
+ : new HttpHeaders(headers);
91
+ };
92
+ /**
93
+ * Returns the headers for generating XML files.
94
+ *
95
+ * @param {string} format - The format of the headers, 'object' or 'http_header'.
96
+ *
97
+ * @returns {HttpHeaders | { [header: string]: string | string[] }} - The headers for generating XML files.
98
+ */
99
+ const xmlHeaders = (format = 'object') => {
100
+ const headers = {
101
+ 'Accept': 'application/xml',
102
+ };
103
+ return format === 'object'
104
+ ? headers
105
+ : new HttpHeaders(headers);
106
106
  };
107
107
 
108
- class ApiCompaniesService {
109
- constructor(environments, http) {
110
- this.environments = environments;
111
- this.http = http;
112
- }
113
- /**
114
- * Retrieves the URL for the companies API from the environment configurations.
115
- *
116
- * @return {string} The URL of the companies API.
117
- */
118
- get url() {
119
- return this.environments.apiCompaniesUrl;
120
- }
121
- /**
122
- * Fetches the installations based on the provided query parameters.
123
- *
124
- * @param {QueryParams} params - The parameters used to filter the installations query.
125
- * @return {Observable<InstallationsData>} An observable that emits the installations data.
126
- */
127
- getInstallations(params) {
128
- return this.http.get(`${this.url}/installations`, {
129
- params: httpParams(params),
130
- }).pipe(map(({ data }) => data));
131
- }
132
- /**
133
- * Retrieves the installation details based on the given installation ID.
134
- *
135
- * @param {number} id - The unique identifier of the installation to retrieve.
136
- * @returns {Observable<InstallationData>} An observable of the installation details.
137
- */
138
- getInstallation(id) {
139
- return this.http.get(`${this.url}/installations/${id}`)
140
- .pipe(map(({ data }) => data));
141
- }
142
- /**
143
- * Retrieves a list of locations based on the provided query parameters.
144
- *
145
- * @param {QueryParams} params - The parameters to use for querying locations.
146
- * @return {Observable<LocationsData>} An observable that emits the locations data.
147
- */
148
- getLocations(params) {
149
- return this.http.get(`${this.url}/locations`, {
150
- params: httpParams(params),
151
- }).pipe(map(({ data }) => data));
152
- }
153
- /**
154
- * Fetches the location details for a given location ID.
155
- *
156
- * @param {number} id - The unique identifier of the location.
157
- * @return {Observable<LocationData>} An Observable containing the location details.
158
- */
159
- getLocation(id) {
160
- return this.http.get(`${this.url}/locations/${id}`)
161
- .pipe(map(({ data }) => data));
162
- }
163
- /**
164
- * Retrieves a list of active supply entities.
165
- *
166
- * @param {QueryParams} params - The query parameters to filter supply entities.
167
- * @return {Observable<SupplyEntitiesData>} Observable emitting supply entities data.
168
- */
169
- getSupplyEntitiesActive(params) {
170
- return this.http.get(`${this.url}/supply-entities/actives`, {
171
- params: httpParams(params),
172
- }).pipe(map(({ data }) => data));
173
- }
174
- /**
175
- * Fetches a list of employees based on the specified query parameters.
176
- *
177
- * @param {QueryParams} params - The parameters to filter and sort the employees.
178
- * @return {Observable<EmployeesData>} An observable that emits the list of employees.
179
- */
180
- getEmployees(params) {
181
- return this.http.get(`${this.url}/employees`, {
182
- params: httpParams(params),
183
- }).pipe(map(({ data }) => data));
184
- }
185
- /**
186
- * Fetches an employee's details based on the provided employee ID.
187
- *
188
- * @param {number} id - The unique identifier of the employee.
189
- * @return {Observable<EmployeeData>} An observable that emits the employee's details.
190
- */
191
- getEmployee(id) {
192
- return this.http.get(`${this.url}/employees/${id}`)
193
- .pipe(map(({ data }) => data));
194
- }
195
- /**
196
- * Retrieves the list of employees for a specified location based on provided query parameters.
197
- *
198
- * @param {QueryParams} params - The query parameters used to filter and retrieve the location employees.
199
- * @returns {Observable<LocationEmployeesData>} An observable that emits the list of employees for the specified location.
200
- */
201
- getLocationEmployees(params) {
202
- return this.http.get(`${this.url}/location-employees`, {
203
- params: httpParams(params),
204
- }).pipe(map(({ data }) => data));
205
- }
206
- /**
207
- * Retrieves a list of countries where the company operates.
208
- *
209
- * @param {QueryParams} params - The query parameters for the API request.
210
- * @return {Observable<CompanyCountriesData>} An observable containing the list of company countries.
211
- */
212
- getCompanyCountries(params) {
213
- return this.http.get(`${this.url}/company-countries`, {
214
- params: httpParams(params),
215
- }).pipe(map(({ data }) => data));
216
- }
217
- /**
218
- * Retrieves the country information for a specified company by its ID.
219
- *
220
- * @param {number} id - The unique identifier of the company.
221
- * @return {Observable<CompanyCountryData>} An observable containing the country information of the company.
222
- */
223
- getCompanyCountry(id) {
224
- return this.http.get(`${this.url}/company-countries/${id}`)
225
- .pipe(map(({ data }) => data));
226
- }
227
- /**
228
- * Fetches the reference currencies for a given country.
229
- *
230
- * @param {QueryParams} params - The query parameters to include in the request.
231
- * @return {Observable<CountryReferenceCurrenciesData>} The observable containing the country reference currencies data.
232
- */
233
- getCountryReferenceCurrencies(params) {
234
- return this.http.get(`${this.url}/country-reference-currencies`, { params }).pipe(map(({ data }) => data));
235
- }
236
- /**
237
- * Retrieves a list of currencies for different countries along with their current exchange rates.
238
- *
239
- * @param {QueryParams} params - The query parameters used to fetch the country reference currencies.
240
- * @return {Observable<CountryCurrencyRate[]>} An observable that emits an array of country currency rates.
241
- */
242
- getCountryCurrenciesWithRate(params) {
243
- return this.getCountryReferenceCurrencies(params)
244
- .pipe(mergeMap((currenciesData) => {
245
- const $observables = currenciesData.country_reference_currencies
246
- .map((country_reference_currency) => this.getCurrentExchanges({
247
- currency_id: country_reference_currency.currency.id,
248
- }).pipe(map((exchangesData) => ({
249
- ...country_reference_currency,
250
- rate: exchangesData.exchanges[0]?.value ?? 1.00,
251
- }))));
252
- return forkJoin($observables);
253
- }));
254
- }
255
- /**
256
- * Retrieves the current exchanges based on the given query parameters.
257
- *
258
- * @param {QueryParams} params - The query parameters to filter the exchanges.
259
- *
260
- * @returns {Observable<ExchangesData>} - An observable that emits the API response data containing the current exchanges.
261
- */
262
- getCurrentExchanges(params) {
263
- return this.http.get(`${this.url}/exchanges/current`, {
264
- params: httpParams(params),
265
- }).pipe(map(({ data }) => data));
266
- }
267
- /**
268
- * Fetches the country-specific tax information for a company.
269
- *
270
- * @param {QueryParams} params - The parameters used to filter and query the taxes.
271
- * @return {Observable<CompanyCountryTaxesData>} An observable that emits the tax information.
272
- */
273
- getCompanyCountryTaxes(params) {
274
- return this.http.get(`${this.url}/company-country-taxes`, {
275
- params: httpParams(params),
276
- }).pipe(map(({ data }) => data));
277
- }
278
- /**
279
- * Retrieves the list of active account entities based on the provided query parameters.
280
- *
281
- * @param {QueryParams} params - The parameters to filter and query active account entities.
282
- * @return {Observable<AccountEntitiesData>} An observable that emits the list of active account entities.
283
- */
284
- getActiveAccountEntities(params) {
285
- return this.http.get(`${this.url}/account-entities/actives`, {
286
- params: httpParams(params),
287
- }).pipe(map(({ data }) => data));
288
- }
289
- /**
290
- * Retrieves the parameter values based on the provided parameter names.
291
- *
292
- * @param {Object} params - An object containing the required parameters.
293
- * @param {string[]} params.paramNames - An array of parameter names for which the values need to be fetched.
294
- * @return {Observable<ParametersData>} An observable that emits the fetched parameter values.
295
- */
296
- getParameters({ paramNames, }) {
297
- const parameters = paramNames.map((p) => ({ name: p }));
298
- return this.http.post(`${this.url}/parameters-values`, {
299
- parameters
300
- }).pipe(map(({ data }) => data));
301
- }
302
- /**
303
- * Retrieves the value of a specified parameter.
304
- *
305
- * @param {Object} input - The input object containing the parameter details.
306
- * @param {string} input.paramName - The name of the parameter whose value is to be retrieved.
307
- * @return {Observable<ParameterValueData>} An observable emitting the value of the specified parameter.
308
- */
309
- getParameterValue({ paramName, }) {
310
- return this.http.get(`${this.url}/parameters-values/${paramName}`)
311
- .pipe(map(({ data }) => data));
312
- }
313
- /**
314
- * Retrieves a list of country references based on the given query parameters.
315
- *
316
- * @param {QueryParams} params - The query parameters for retrieving country references.
317
- * @return {Observable<CountryReferencesData>} An observable containing the country reference data.
318
- */
319
- getCountryReferences(params) {
320
- return this.http.get(`${this.url}/country-references`, {
321
- params: httpParams(params),
322
- }).pipe(map(({ data }) => data));
323
- }
324
- /**
325
- * Fetches the country reference data for a given country ID.
326
- *
327
- * @param {number} id - The unique identifier of the country for which the reference data is to be retrieved.
328
- * @return {Observable<CountryReferenceData>} An observable containing the country reference data.
329
- */
330
- getCountryReference(id) {
331
- return this.http.get(`${this.url}/country-references/${id}`)
332
- .pipe(map(({ data }) => data));
333
- }
334
- /**
335
- * Fetches the list of workflows based on the provided query parameters.
336
- *
337
- * @param {QueryParams} params - The query parameters used to filter workflows.
338
- * @return {Observable<WorkflowsData>} An observable containing the workflow data.
339
- */
340
- getWorkflows(params) {
341
- return this.http.get(`${this.url}/workflows`, {
342
- params: httpParams(params),
343
- }).pipe(map(({ data }) => data));
344
- }
345
- }
346
- ApiCompaniesServicefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiCompaniesService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
347
- ApiCompaniesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiCompaniesService, providedIn: 'root' });
348
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiCompaniesService, decorators: [{
349
- type: Injectable,
350
- args: [{
351
- providedIn: 'root'
352
- }]
353
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
354
- type: Inject,
355
- args: ['env']
108
+ class ApiCompaniesService {
109
+ constructor(environments, http) {
110
+ this.environments = environments;
111
+ this.http = http;
112
+ }
113
+ /**
114
+ * Retrieves the URL for the companies API from the environment configurations.
115
+ *
116
+ * @return {string} The URL of the companies API.
117
+ */
118
+ get url() {
119
+ return this.environments.apiCompaniesUrl;
120
+ }
121
+ /**
122
+ * Fetches the installations based on the provided query parameters.
123
+ *
124
+ * @param {QueryParams} params - The parameters used to filter the installations query.
125
+ * @return {Observable<InstallationsData>} An observable that emits the installations data.
126
+ */
127
+ getInstallations(params) {
128
+ return this.http.get(`${this.url}/installations`, {
129
+ params: httpParams(params),
130
+ }).pipe(map(({ data }) => data));
131
+ }
132
+ /**
133
+ * Retrieves the installation details based on the given installation ID.
134
+ *
135
+ * @param {number} id - The unique identifier of the installation to retrieve.
136
+ * @returns {Observable<InstallationData>} An observable of the installation details.
137
+ */
138
+ getInstallation(id) {
139
+ return this.http.get(`${this.url}/installations/${id}`)
140
+ .pipe(map(({ data }) => data));
141
+ }
142
+ /**
143
+ * Retrieves a list of locations based on the provided query parameters.
144
+ *
145
+ * @param {QueryParams} params - The parameters to use for querying locations.
146
+ * @return {Observable<LocationsData>} An observable that emits the locations data.
147
+ */
148
+ getLocations(params) {
149
+ return this.http.get(`${this.url}/locations`, {
150
+ params: httpParams(params),
151
+ }).pipe(map(({ data }) => data));
152
+ }
153
+ /**
154
+ * Fetches the location details for a given location ID.
155
+ *
156
+ * @param {number} id - The unique identifier of the location.
157
+ * @return {Observable<LocationData>} An Observable containing the location details.
158
+ */
159
+ getLocation(id) {
160
+ return this.http.get(`${this.url}/locations/${id}`)
161
+ .pipe(map(({ data }) => data));
162
+ }
163
+ /**
164
+ * Retrieves a list of active supply entities.
165
+ *
166
+ * @param {QueryParams} params - The query parameters to filter supply entities.
167
+ * @return {Observable<SupplyEntitiesData>} Observable emitting supply entities data.
168
+ */
169
+ getSupplyEntitiesActive(params) {
170
+ return this.http.get(`${this.url}/supply-entities/actives`, {
171
+ params: httpParams(params),
172
+ }).pipe(map(({ data }) => data));
173
+ }
174
+ /**
175
+ * Fetches a list of employees based on the specified query parameters.
176
+ *
177
+ * @param {QueryParams} params - The parameters to filter and sort the employees.
178
+ * @return {Observable<EmployeesData>} An observable that emits the list of employees.
179
+ */
180
+ getEmployees(params) {
181
+ return this.http.get(`${this.url}/employees`, {
182
+ params: httpParams(params),
183
+ }).pipe(map(({ data }) => data));
184
+ }
185
+ /**
186
+ * Fetches an employee's details based on the provided employee ID.
187
+ *
188
+ * @param {number} id - The unique identifier of the employee.
189
+ * @return {Observable<EmployeeData>} An observable that emits the employee's details.
190
+ */
191
+ getEmployee(id) {
192
+ return this.http.get(`${this.url}/employees/${id}`)
193
+ .pipe(map(({ data }) => data));
194
+ }
195
+ /**
196
+ * Retrieves the list of employees for a specified location based on provided query parameters.
197
+ *
198
+ * @param {QueryParams} params - The query parameters used to filter and retrieve the location employees.
199
+ * @returns {Observable<LocationEmployeesData>} An observable that emits the list of employees for the specified location.
200
+ */
201
+ getLocationEmployees(params) {
202
+ return this.http.get(`${this.url}/location-employees`, {
203
+ params: httpParams(params),
204
+ }).pipe(map(({ data }) => data));
205
+ }
206
+ /**
207
+ * Retrieves a list of countries where the company operates.
208
+ *
209
+ * @param {QueryParams} params - The query parameters for the API request.
210
+ * @return {Observable<CompanyCountriesData>} An observable containing the list of company countries.
211
+ */
212
+ getCompanyCountries(params) {
213
+ return this.http.get(`${this.url}/company-countries`, {
214
+ params: httpParams(params),
215
+ }).pipe(map(({ data }) => data));
216
+ }
217
+ /**
218
+ * Retrieves the country information for a specified company by its ID.
219
+ *
220
+ * @param {number} id - The unique identifier of the company.
221
+ * @return {Observable<CompanyCountryData>} An observable containing the country information of the company.
222
+ */
223
+ getCompanyCountry(id) {
224
+ return this.http.get(`${this.url}/company-countries/${id}`)
225
+ .pipe(map(({ data }) => data));
226
+ }
227
+ /**
228
+ * Fetches the reference currencies for a given country.
229
+ *
230
+ * @param {QueryParams} params - The query parameters to include in the request.
231
+ * @return {Observable<CountryReferenceCurrenciesData>} The observable containing the country reference currencies data.
232
+ */
233
+ getCountryReferenceCurrencies(params) {
234
+ return this.http.get(`${this.url}/country-reference-currencies`, { params }).pipe(map(({ data }) => data));
235
+ }
236
+ /**
237
+ * Retrieves a list of currencies for different countries along with their current exchange rates.
238
+ *
239
+ * @param {QueryParams} params - The query parameters used to fetch the country reference currencies.
240
+ * @return {Observable<CountryCurrencyRate[]>} An observable that emits an array of country currency rates.
241
+ */
242
+ getCountryCurrenciesWithRate(params) {
243
+ return this.getCountryReferenceCurrencies(params)
244
+ .pipe(mergeMap((currenciesData) => {
245
+ const $observables = currenciesData.country_reference_currencies
246
+ .map((country_reference_currency) => this.getCurrentExchanges({
247
+ currency_id: country_reference_currency.currency.id,
248
+ }).pipe(map((exchangesData) => ({
249
+ ...country_reference_currency,
250
+ rate: exchangesData.exchanges[0]?.value ?? 1.00,
251
+ }))));
252
+ return forkJoin($observables);
253
+ }));
254
+ }
255
+ /**
256
+ * Retrieves the current exchanges based on the given query parameters.
257
+ *
258
+ * @param {QueryParams} params - The query parameters to filter the exchanges.
259
+ *
260
+ * @returns {Observable<ExchangesData>} - An observable that emits the API response data containing the current exchanges.
261
+ */
262
+ getCurrentExchanges(params) {
263
+ return this.http.get(`${this.url}/exchanges/current`, {
264
+ params: httpParams(params),
265
+ }).pipe(map(({ data }) => data));
266
+ }
267
+ /**
268
+ * Fetches the country-specific tax information for a company.
269
+ *
270
+ * @param {QueryParams} params - The parameters used to filter and query the taxes.
271
+ * @return {Observable<CompanyCountryTaxesData>} An observable that emits the tax information.
272
+ */
273
+ getCompanyCountryTaxes(params) {
274
+ return this.http.get(`${this.url}/company-country-taxes`, {
275
+ params: httpParams(params),
276
+ }).pipe(map(({ data }) => data));
277
+ }
278
+ /**
279
+ * Retrieves the list of active account entities based on the provided query parameters.
280
+ *
281
+ * @param {QueryParams} params - The parameters to filter and query active account entities.
282
+ * @return {Observable<AccountEntitiesData>} An observable that emits the list of active account entities.
283
+ */
284
+ getActiveAccountEntities(params) {
285
+ return this.http.get(`${this.url}/account-entities/actives`, {
286
+ params: httpParams(params),
287
+ }).pipe(map(({ data }) => data));
288
+ }
289
+ /**
290
+ * Retrieves the parameter values based on the provided parameter names.
291
+ *
292
+ * @param {Object} params - An object containing the required parameters.
293
+ * @param {string[]} params.paramNames - An array of parameter names for which the values need to be fetched.
294
+ * @return {Observable<ParametersData>} An observable that emits the fetched parameter values.
295
+ */
296
+ getParameters({ paramNames, }) {
297
+ const parameters = paramNames.map((p) => ({ name: p }));
298
+ return this.http.post(`${this.url}/parameters-values`, {
299
+ parameters
300
+ }).pipe(map(({ data }) => data));
301
+ }
302
+ /**
303
+ * Retrieves the value of a specified parameter.
304
+ *
305
+ * @param {Object} input - The input object containing the parameter details.
306
+ * @param {string} input.paramName - The name of the parameter whose value is to be retrieved.
307
+ * @return {Observable<ParameterValueData>} An observable emitting the value of the specified parameter.
308
+ */
309
+ getParameterValue({ paramName, }) {
310
+ return this.http.get(`${this.url}/parameters-values/${paramName}`)
311
+ .pipe(map(({ data }) => data));
312
+ }
313
+ /**
314
+ * Retrieves a list of country references based on the given query parameters.
315
+ *
316
+ * @param {QueryParams} params - The query parameters for retrieving country references.
317
+ * @return {Observable<CountryReferencesData>} An observable containing the country reference data.
318
+ */
319
+ getCountryReferences(params) {
320
+ return this.http.get(`${this.url}/country-references`, {
321
+ params: httpParams(params),
322
+ }).pipe(map(({ data }) => data));
323
+ }
324
+ /**
325
+ * Fetches the country reference data for a given country ID.
326
+ *
327
+ * @param {number} id - The unique identifier of the country for which the reference data is to be retrieved.
328
+ * @return {Observable<CountryReferenceData>} An observable containing the country reference data.
329
+ */
330
+ getCountryReference(id) {
331
+ return this.http.get(`${this.url}/country-references/${id}`)
332
+ .pipe(map(({ data }) => data));
333
+ }
334
+ /**
335
+ * Fetches the list of workflows based on the provided query parameters.
336
+ *
337
+ * @param {QueryParams} params - The query parameters used to filter workflows.
338
+ * @return {Observable<WorkflowsData>} An observable containing the workflow data.
339
+ */
340
+ getWorkflows(params) {
341
+ return this.http.get(`${this.url}/workflows`, {
342
+ params: httpParams(params),
343
+ }).pipe(map(({ data }) => data));
344
+ }
345
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiCompaniesService, deps: [{ token: 'env' }, { token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
346
+ static { thisprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiCompaniesService, providedIn: 'root' }); }
347
+ }
348
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiCompaniesService, decorators: [{
349
+ type: Injectable,
350
+ args: [{
351
+ providedIn: 'root'
352
+ }]
353
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
354
+ type: Inject,
355
+ args: ['env']
356
356
  }] }, { type: i1.HttpClient }]; } });
357
357
 
358
- class ApiSecurityService {
359
- constructor(environments, http, cookie) {
360
- this.environments = environments;
361
- this.http = http;
362
- this.cookie = cookie;
363
- }
364
- /**
365
- * Retrieves the API security URL from the environments configuration.
366
- *
367
- * @return {string} The API security URL.
368
- */
369
- get url() {
370
- return this.environments.apiSecurityUrl;
371
- }
372
- /**
373
- * Authenticates a user with the provided credentials and role.
374
- *
375
- * @param {Object} param0 - The login input object.
376
- * @param {string} param0.username - The username of the user.
377
- * @param {string} param0.password - The password of the user.
378
- * @param {string} param0.role - The role of the user.
379
- * @return {Observable<LoginOut>} An observable emitting the login output object.
380
- */
381
- login({ username, password, role, }) {
382
- return this.http.post(`${this.url}/auth/login`, {
383
- system_name: 'CRA',
384
- username,
385
- password,
386
- role,
387
- }).pipe(map(({ data }) => data), tap(({ access_token }) => this.cookie.set('tokenCRA', access_token, { path: '/' })));
388
- }
389
- /**
390
- * Logs out the current user by making a POST request to the logout endpoint.
391
- *
392
- * This method deletes all cookies after a successful logout.
393
- *
394
- * @return {Observable<{}>} An observable that emits the server's response to the logout request.
395
- */
396
- logout() {
397
- return this.http.post(`${this.url}/auth/logout`, null)
398
- .pipe(map(({ data }) => data), tap(() => this.cookie.deleteAll('/')));
399
- }
400
- /**
401
- * Creates a new session for a specified model.
402
- *
403
- * @param {Object} params - The parameters for creating the session.
404
- * @param {string} params.modelType - The type of the model.
405
- * @param {string} params.modelId - The ID of the model.
406
- * @param {string} [params.token] - Optional authorization token.
407
- *
408
- * @return {Observable<CreateSessionOut>} An observable containing the created session details.
409
- */
410
- createSession({ modelType, modelId, token, }) {
411
- let headers = new HttpHeaders({});
412
- if (token)
413
- headers = headers.set('Authorization', `Bearer ${token}`);
414
- return this.http.post(`${this.url}/sessions`, {
415
- model_type: modelType,
416
- model_id: modelId,
417
- }, {
418
- headers
419
- }).pipe(map(({ data }) => data));
420
- }
421
- /**
422
- * Fetches the authenticated user's information.
423
- * Sends a GET request to the endpoint '/auth/me' to retrieve information
424
- * about the currently authenticated user.
425
- *
426
- * @return {Observable<MeOut>} An observable that emits the authenticated user's data.
427
- */
428
- me() {
429
- return this.http.get(`${this.url}/auth/me`)
430
- .pipe(map(({ data }) => data));
431
- }
432
- /**
433
- * Fetches the authenticated user's details from the server.
434
- *
435
- * @param token The JWT token used for authorization.
436
- * @return An Observable that emits the user's details encapsulated in a MeOut object.
437
- */
438
- otherMe(token) {
439
- return this.http.get(`${this.url}/auth/me`, {
440
- headers: {
441
- Authorization: `Bearer ${token}`
442
- }
443
- }).pipe(map(({ data }) => data));
444
- }
445
- /**
446
- * Fetches a user by their unique ID.
447
- *
448
- * @param {number} id - The unique identifier of the user to be fetched.
449
- * @return {Observable<GetUserOut>} An observable containing the user information.
450
- */
451
- user(id) {
452
- return this.http.get(`${this.url}/users/${id}`)
453
- .pipe(map(({ data }) => data));
454
- }
455
- /**
456
- * Changes the language for the authenticated user.
457
- *
458
- * @param {Object} params - The input parameters for changing the language.
459
- * @param {string} params.languageId - The ID of the new language to be set.
460
- * @return {Observable<ApiSuccess<MeOut>>} An observable that emits the result of the language change request.
461
- */
462
- changeLanguage({ languageId }) {
463
- return this.http.put(`${this.url}/auth/me`, {
464
- language_id: languageId
465
- }).pipe(map(({ data }) => data));
466
- }
467
- }
468
- ApiSecurityServicefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiSecurityService, deps: [{ token: 'env' }, { token: i1.HttpClient }, { token: i2.CookieService }], target: i0.ɵɵFactoryTarget.Injectable });
469
- ApiSecurityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiSecurityService, providedIn: 'root' });
470
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiSecurityService, decorators: [{
471
- type: Injectable,
472
- args: [{
473
- providedIn: 'root'
474
- }]
475
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
476
- type: Inject,
477
- args: ['env']
358
+ class ApiSecurityService {
359
+ constructor(environments, http, cookie) {
360
+ this.environments = environments;
361
+ this.http = http;
362
+ this.cookie = cookie;
363
+ }
364
+ /**
365
+ * Retrieves the API security URL from the environments configuration.
366
+ *
367
+ * @return {string} The API security URL.
368
+ */
369
+ get url() {
370
+ return this.environments.apiSecurityUrl;
371
+ }
372
+ /**
373
+ * Authenticates a user with the provided credentials and role.
374
+ *
375
+ * @param {Object} param0 - The login input object.
376
+ * @param {string} param0.username - The username of the user.
377
+ * @param {string} param0.password - The password of the user.
378
+ * @param {string} param0.role - The role of the user.
379
+ * @return {Observable<LoginOut>} An observable emitting the login output object.
380
+ */
381
+ login({ username, password, role, }) {
382
+ return this.http.post(`${this.url}/auth/login`, {
383
+ system_name: 'CRA',
384
+ username,
385
+ password,
386
+ role,
387
+ }).pipe(map(({ data }) => data), tap(({ access_token }) => this.cookie.set('tokenCRA', access_token, { path: '/' })));
388
+ }
389
+ /**
390
+ * Logs out the current user by making a POST request to the logout endpoint.
391
+ *
392
+ * This method deletes all cookies after a successful logout.
393
+ *
394
+ * @return {Observable<{}>} An observable that emits the server's response to the logout request.
395
+ */
396
+ logout() {
397
+ return this.http.post(`${this.url}/auth/logout`, null)
398
+ .pipe(map(({ data }) => data), tap(() => this.cookie.deleteAll('/')));
399
+ }
400
+ /**
401
+ * Creates a new session for a specified model.
402
+ *
403
+ * @param {Object} params - The parameters for creating the session.
404
+ * @param {string} params.modelType - The type of the model.
405
+ * @param {string} params.modelId - The ID of the model.
406
+ * @param {string} [params.token] - Optional authorization token.
407
+ *
408
+ * @return {Observable<CreateSessionOut>} An observable containing the created session details.
409
+ */
410
+ createSession({ modelType, modelId, token, }) {
411
+ let headers = new HttpHeaders({});
412
+ if (token)
413
+ headers = headers.set('Authorization', `Bearer ${token}`);
414
+ return this.http.post(`${this.url}/sessions`, {
415
+ model_type: modelType,
416
+ model_id: modelId,
417
+ }, {
418
+ headers
419
+ }).pipe(map(({ data }) => data));
420
+ }
421
+ /**
422
+ * Fetches the authenticated user's information.
423
+ * Sends a GET request to the endpoint '/auth/me' to retrieve information
424
+ * about the currently authenticated user.
425
+ *
426
+ * @return {Observable<MeOut>} An observable that emits the authenticated user's data.
427
+ */
428
+ me() {
429
+ return this.http.get(`${this.url}/auth/me`)
430
+ .pipe(map(({ data }) => data));
431
+ }
432
+ /**
433
+ * Fetches the authenticated user's details from the server.
434
+ *
435
+ * @param token The JWT token used for authorization.
436
+ * @return An Observable that emits the user's details encapsulated in a MeOut object.
437
+ */
438
+ otherMe(token) {
439
+ return this.http.get(`${this.url}/auth/me`, {
440
+ headers: {
441
+ Authorization: `Bearer ${token}`
442
+ }
443
+ }).pipe(map(({ data }) => data));
444
+ }
445
+ /**
446
+ * Fetches a user by their unique ID.
447
+ *
448
+ * @param {number} id - The unique identifier of the user to be fetched.
449
+ * @return {Observable<GetUserOut>} An observable containing the user information.
450
+ */
451
+ user(id) {
452
+ return this.http.get(`${this.url}/users/${id}`)
453
+ .pipe(map(({ data }) => data));
454
+ }
455
+ /**
456
+ * Changes the language for the authenticated user.
457
+ *
458
+ * @param {Object} params - The input parameters for changing the language.
459
+ * @param {string} params.languageId - The ID of the new language to be set.
460
+ * @return {Observable<ApiSuccess<MeOut>>} An observable that emits the result of the language change request.
461
+ */
462
+ changeLanguage({ languageId }) {
463
+ return this.http.put(`${this.url}/auth/me`, {
464
+ language_id: languageId
465
+ }).pipe(map(({ data }) => data));
466
+ }
467
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiSecurityService, deps: [{ token: 'env' }, { token: i1.HttpClient }, { token: i2.CookieService }], target: i0.ɵɵFactoryTarget.Injectable }); }
468
+ static { thisprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiSecurityService, providedIn: 'root' }); }
469
+ }
470
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiSecurityService, decorators: [{
471
+ type: Injectable,
472
+ args: [{
473
+ providedIn: 'root'
474
+ }]
475
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
476
+ type: Inject,
477
+ args: ['env']
478
478
  }] }, { type: i1.HttpClient }, { type: i2.CookieService }]; } });
479
479
 
480
- class ApiHeadersInterceptor {
481
- /**
482
- * Intercepts HTTP requests and adds common headers.
483
- *
484
- * @param {HttpRequest<unknown>} request - The HTTP request intercepted.
485
- * @param {HttpHandler} next - The next handler in the chain.
486
- *
487
- * @returns {Observable<HttpEvent<unknown>>} - Observable of the HTTP event after interception.
488
- */
489
- intercept(request, next) {
490
- let headers = new HttpHeaders({
491
- 'cache-control': 'max-age=0, no-cache, no-store, must-revalidate',
492
- 'expires': '0',
493
- 'pragma': 'no-cache'
494
- });
495
- if (!request.headers.has('Content-Type'))
496
- headers = headers.set('Content-Type', 'application/json');
497
- if (!request.headers.has('Accept'))
498
- headers = headers.set('Accept', 'application/json');
499
- if (!request.headers.has('Accept-Language'))
500
- headers = headers.set('Accept-Language', localStorage.getItem('lang') ?? 'en');
501
- request = request.clone({ headers });
502
- return next.handle(request);
503
- }
504
- }
505
- ApiHeadersInterceptorfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiHeadersInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
506
- ApiHeadersInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiHeadersInterceptor });
507
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiHeadersInterceptor, decorators: [{
508
- type: Injectable
480
+ class ApiHeadersInterceptor {
481
+ /**
482
+ * Intercepts HTTP requests and adds common headers.
483
+ *
484
+ * @param {HttpRequest<unknown>} request - The HTTP request intercepted.
485
+ * @param {HttpHandler} next - The next handler in the chain.
486
+ *
487
+ * @returns {Observable<HttpEvent<unknown>>} - Observable of the HTTP event after interception.
488
+ */
489
+ intercept(request, next) {
490
+ let headers = new HttpHeaders({
491
+ 'cache-control': 'max-age=0, no-cache, no-store, must-revalidate',
492
+ 'expires': '0',
493
+ 'pragma': 'no-cache'
494
+ });
495
+ if (!request.headers.has('Content-Type'))
496
+ headers = headers.set('Content-Type', 'application/json');
497
+ if (!request.headers.has('Accept'))
498
+ headers = headers.set('Accept', 'application/json');
499
+ if (!request.headers.has('Accept-Language'))
500
+ headers = headers.set('Accept-Language', localStorage.getItem('lang') ?? 'en');
501
+ request = request.clone({ headers });
502
+ return next.handle(request);
503
+ }
504
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiHeadersInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
505
+ static { thisprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiHeadersInterceptor }); }
506
+ }
507
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiHeadersInterceptor, decorators: [{
508
+ type: Injectable
509
509
  }] });
510
510
 
511
- class ApiTokenInterceptor {
512
- constructor(cookie) {
513
- this.cookie = cookie;
514
- }
515
- /**
516
- * Intercepts the HTTP request and adds the Authorization header.
517
- *
518
- * @param {HttpRequest<unknown>} request - The HTTP request to intercept.
519
- * @param {HttpHandler} next - The next HTTP handler in the chain.
520
- *
521
- * @returns {Observable<HttpEvent<unknown>>} - An observable containing the HTTP event.
522
- */
523
- intercept(request, next) {
524
- if (request.headers.has('Authorization'))
525
- return next.handle(request);
526
- const token = this.cookie.get('tokenCRA');
527
- if (!token)
528
- return next.handle(request);
529
- request = request.clone({
530
- setHeaders: {
531
- Authorization: `Bearer ${token}`
532
- }
533
- });
534
- return next.handle(request);
535
- }
536
- }
537
- ApiTokenInterceptorfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiTokenInterceptor, deps: [{ token: i2.CookieService }], target: i0.ɵɵFactoryTarget.Injectable });
538
- ApiTokenInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiTokenInterceptor });
539
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ApiTokenInterceptor, decorators: [{
540
- type: Injectable
511
+ class ApiTokenInterceptor {
512
+ constructor(cookie) {
513
+ this.cookie = cookie;
514
+ }
515
+ /**
516
+ * Intercepts the HTTP request and adds the Authorization header.
517
+ *
518
+ * @param {HttpRequest<unknown>} request - The HTTP request to intercept.
519
+ * @param {HttpHandler} next - The next HTTP handler in the chain.
520
+ *
521
+ * @returns {Observable<HttpEvent<unknown>>} - An observable containing the HTTP event.
522
+ */
523
+ intercept(request, next) {
524
+ if (request.headers.has('Authorization'))
525
+ return next.handle(request);
526
+ const token = this.cookie.get('tokenCRA');
527
+ if (!token)
528
+ return next.handle(request);
529
+ request = request.clone({
530
+ setHeaders: {
531
+ Authorization: `Bearer ${token}`
532
+ }
533
+ });
534
+ return next.handle(request);
535
+ }
536
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiTokenInterceptor, deps: [{ token: i2.CookieService }], target: i0.ɵɵFactoryTarget.Injectable }); }
537
+ static { thisprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiTokenInterceptor }); }
538
+ }
539
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ApiTokenInterceptor, decorators: [{
540
+ type: Injectable
541
541
  }], ctorParameters: function () { return [{ type: i2.CookieService }]; } });
542
542
 
543
- const DEFAULT_TTL = 10000; // ttl in ms
544
- class HttpCachingInterceptor {
545
- constructor(envs) {
546
- this.envs = envs;
547
- this.cache = new Map();
548
- }
549
- intercept(req, next) {
550
- if (req.method !== 'GET')
551
- return next.handle(req);
552
- const cached = this.cache.get(req.urlWithParams);
553
- if (cached) {
554
- const isExpired = Date.now() > cached.ttl;
555
- if (!isExpired)
556
- return of(cached.res);
557
- this.cache.delete(req.urlWithParams); // If expired, remove the entry from cache
558
- }
559
- return next.handle(req).pipe(tap$1((res) => {
560
- if (!(res instanceof HttpResponse))
561
- return;
562
- const ttl = Date.now() + (this.envs.cacheTtl ?? DEFAULT_TTL);
563
- this.cache.set(req.urlWithParams, { res, ttl });
564
- }));
565
- }
566
- }
567
- HttpCachingInterceptorfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HttpCachingInterceptor, deps: [{ token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable });
568
- HttpCachingInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HttpCachingInterceptor });
569
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: HttpCachingInterceptor, decorators: [{
570
- type: Injectable
571
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
572
- type: Inject,
573
- args: ['env']
543
+ const DEFAULT_TTL = 10000; // ttl in ms
544
+ class HttpCachingInterceptor {
545
+ constructor(envs) {
546
+ this.envs = envs;
547
+ this.cache = new Map();
548
+ }
549
+ intercept(req, next) {
550
+ if (req.method !== 'GET')
551
+ return next.handle(req);
552
+ const cached = this.cache.get(req.urlWithParams);
553
+ if (cached) {
554
+ const isExpired = Date.now() > cached.ttl;
555
+ if (!isExpired)
556
+ return of(cached.res);
557
+ this.cache.delete(req.urlWithParams); // If expired, remove the entry from cache
558
+ }
559
+ return next.handle(req).pipe(tap$1((res) => {
560
+ if (!(res instanceof HttpResponse))
561
+ return;
562
+ const ttl = Date.now() + (this.envs.cacheTtl ?? DEFAULT_TTL);
563
+ this.cache.set(req.urlWithParams, { res, ttl });
564
+ }));
565
+ }
566
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HttpCachingInterceptor, deps: [{ token: 'env' }], target: i0.ɵɵFactoryTarget.Injectable }); }
567
+ static { thisprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HttpCachingInterceptor }); }
568
+ }
569
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HttpCachingInterceptor, decorators: [{
570
+ type: Injectable
571
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
572
+ type: Inject,
573
+ args: ['env']
574
574
  }] }]; } });
575
575
 
576
- /*
577
- * Public API Surface of ngx-services
576
+ /*
577
+ * Public API Surface of ngx-services
578
578
  */
579
579
 
580
- /**
581
- * Generated bundle index. Do not edit.
580
+ /**
581
+ * Generated bundle index. Do not edit.
582
582
  */
583
583
 
584
584
  export { ApiCompaniesService, ApiHeadersInterceptor, ApiSecurityService, ApiTokenInterceptor, HttpCachingInterceptor, NgxServicesModule, httpParams, pdfHeaders, queryString, xmlHeaders };