@acorex/modules 19.1.6 → 19.1.7

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 (33) hide show
  1. package/fesm2022/acorex-modules-form-template-management.mjs +538 -507
  2. package/fesm2022/acorex-modules-form-template-management.mjs.map +1 -1
  3. package/fesm2022/acorex-modules-platform-management.mjs +23 -1
  4. package/fesm2022/acorex-modules-platform-management.mjs.map +1 -1
  5. package/fesm2022/acorex-modules-text-template-management.mjs +27 -1
  6. package/fesm2022/acorex-modules-text-template-management.mjs.map +1 -1
  7. package/form-template-management/lib/search-definition.provider.d.ts +4 -0
  8. package/package.json +4 -8
  9. package/platform-management/index.d.ts +1 -0
  10. package/platform-management/lib/const.d.ts +1 -0
  11. package/platform-management/lib/text-search/index.d.ts +2 -0
  12. package/platform-management/lib/text-search/text-search.service.d.ts +10 -0
  13. package/platform-management/lib/text-search/text-search.types.d.ts +9 -0
  14. package/text-template-management/lib/search-definition.provider.d.ts +4 -0
  15. package/backend/README.md +0 -4
  16. package/backend/index.d.ts +0 -4
  17. package/backend/lib/auth/oidc/application.loader.d.ts +0 -16
  18. package/backend/lib/auth/oidc/configuration.service.d.ts +0 -60
  19. package/backend/lib/auth/oidc/feature.loader.d.ts +0 -6
  20. package/backend/lib/auth/oidc/index.d.ts +0 -6
  21. package/backend/lib/auth/oidc/oidc.strategy.d.ts +0 -50
  22. package/backend/lib/auth/oidc/permission.loader.d.ts +0 -14
  23. package/backend/lib/auth/oidc/signincallback.component.d.ts +0 -12
  24. package/backend/lib/auth/oidc/tenant.loader.d.ts +0 -16
  25. package/backend/lib/backend.configs.d.ts +0 -94
  26. package/backend/lib/backend.module.d.ts +0 -9
  27. package/backend/lib/data/api/comment.service.d.ts +0 -16
  28. package/backend/lib/data/api/data-provider.d.ts +0 -26
  29. package/backend/lib/data/api/file.service.d.ts +0 -16
  30. package/backend/lib/data/api/module-designer.service.d.ts +0 -43
  31. package/backend/lib/data/index.d.ts +0 -4
  32. package/fesm2022/acorex-modules-backend.mjs +0 -943
  33. package/fesm2022/acorex-modules-backend.mjs.map +0 -1
@@ -1,943 +0,0 @@
1
- import { AXM_AUTH_CONFIG_TOKEN, AXMAuthModule } from '@acorex/modules/auth';
2
- import * as i2 from '@acorex/platform/auth';
3
- import { AXPSessionService, AXP_TENANT_LOADER, AXP_APPLICATION_LOADER, AXP_PERMISSION_LOADER, AXP_FEATURE_LOADER, AXPAuthModule } from '@acorex/platform/auth';
4
- import { AXP_ROOT_CONFIG_TOKEN, AXPFilterOperatorMiddlewareService, AXPDataProvider } from '@acorex/platform/common';
5
- import * as i0 from '@angular/core';
6
- import { inject, Injectable, Component, NgModule } from '@angular/core';
7
- import * as i1$1 from '@angular/router';
8
- import { ROUTES } from '@angular/router';
9
- import * as i1 from '@angular/common/http';
10
- import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
11
- import { map, BehaviorSubject, tap, filter, take, of, switchMap, delay, firstValueFrom, Observable } from 'rxjs';
12
- import * as i1$2 from 'angular-oauth2-oidc';
13
- import { OAuthService, OAuthModule } from 'angular-oauth2-oidc';
14
- import { AXPModuleDesignerService } from '@acorex/modules/application-management';
15
- import { AXPFileManagementService } from '@acorex/platform/widgets';
16
- import { AXNetworkService, AXUploadStatus, AXDownloadStatus } from '@acorex/core/network';
17
- import { AXPEntityDefinitionRegistryService } from '@acorex/platform/layout/entity';
18
-
19
- class AXMOidcApplicationLoader {
20
- constructor(http) {
21
- this.http = http;
22
- this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
23
- this.apiGetApps = `${this.configs.baseUrl}/applications/GetListByTenantId`;
24
- this.apiSetApp = `${this.configs.baseUrl}/SetApplication`;
25
- }
26
- getList() {
27
- return this.http.get(this.apiGetApps).pipe(map((response) => {
28
- return response.items.map((item) => this.mapToAXPApplication(item));
29
- }));
30
- }
31
- set(application) {
32
- return Promise.resolve();
33
- }
34
- // //TODO: shoud be removed
35
- // set(application: AXPApplication): Observable<AXPRefreshTokenResult> {
36
- // return this.http.post<any>(this.apiSetApp, { applicationId: application.id }).pipe(
37
- // map((response) => {
38
- // return {
39
- // succeed: true,
40
- // data: {
41
- // accessToken: response.token,
42
- // refreshToken: response.token,
43
- // }
44
- // };
45
- // })
46
- // );
47
- // }
48
- mapToAXPApplication(item) {
49
- return {
50
- id: item.id,
51
- name: item.name || 'defaultName',
52
- title: item.title || 'defaultTitle',
53
- version: item.version || '1.0.0',
54
- description: item.description,
55
- logo: item.logo, // Assuming logo is of type AXPLogoConfig or undefined
56
- editionName: item.editionName,
57
- // features: item.features || [],
58
- };
59
- }
60
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOidcApplicationLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
61
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOidcApplicationLoader }); }
62
- }
63
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOidcApplicationLoader, decorators: [{
64
- type: Injectable
65
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
66
-
67
- class AXMConfigurationService {
68
- constructor(http) {
69
- this.http = http;
70
- this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
71
- this.applicationConfig = null;
72
- this.apiGetConfig = `${this.configs.baseUrl}/abp/application-configuration`;
73
- this.fetchInProgress = false;
74
- this.configSubject = new BehaviorSubject(null);
75
- this.init().subscribe(); // Automatically trigger configuration load on service instantiation
76
- }
77
- init() {
78
- if (!this.fetchInProgress) {
79
- this.fetchInProgress = true;
80
- return this.http.get(this.apiGetConfig).pipe(tap((response) => {
81
- this.applicationConfig = response;
82
- this.configSubject.next(this.applicationConfig);
83
- this.fetchInProgress = false;
84
- }));
85
- }
86
- else {
87
- // Adjusted approach to handle TypeScript's type safety requirements
88
- return this.configSubject.asObservable().pipe(filter((config) => config !== null), take(1) // Ensures it completes after emitting the first non-null value
89
- );
90
- }
91
- }
92
- getConfig() {
93
- if (this.applicationConfig) {
94
- // If the config is already loaded, return it immediately
95
- return of(this.applicationConfig);
96
- }
97
- else {
98
- // If the config is not loaded, initiate loading
99
- return this.configSubject.asObservable().pipe(filter((config) => config !== null), take(1), // Ensure it only emits the first non-null value and completes
100
- switchMap(() => of(this.applicationConfig)));
101
- }
102
- }
103
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMConfigurationService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
104
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMConfigurationService, providedIn: 'root' }); }
105
- }
106
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMConfigurationService, decorators: [{
107
- type: Injectable,
108
- args: [{
109
- providedIn: 'root',
110
- }]
111
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
112
-
113
- class AXMOidcFeatureLoader {
114
- constructor() {
115
- this.list = [
116
- {
117
- name: 'axp-entity-list-custom-view',
118
- title: 'Custom View',
119
- value: false
120
- },
121
- {
122
- name: 'axp-entity-list-quick-search',
123
- title: 'Custom View',
124
- value: false
125
- }
126
- ];
127
- }
128
- getList() {
129
- return of(this.list).pipe(delay(0));
130
- }
131
- }
132
-
133
- class AXMOidcStrategy {
134
- constructor() {
135
- this.aXMAuthConfigs = inject(AXM_AUTH_CONFIG_TOKEN);
136
- this.oauthService = inject(OAuthService);
137
- this.http = inject(HttpClient);
138
- }
139
- async configureOAuth() {
140
- if (this.openidConfigurationInfo)
141
- return;
142
- if (!this.authConfig) {
143
- if (!this.aXMAuthConfigs.authConfig) {
144
- throw new Error('authConfig is missing');
145
- }
146
- this.authConfig = this.aXMAuthConfigs.authConfig;
147
- }
148
- this.oauthService.configure(this.authConfig);
149
- this.oauthService.setStorage(localStorage);
150
- this.openidConfigurationInfo = await this.oauthService.loadDiscoveryDocument();
151
- if (!this.openidConfigurationInfo) {
152
- throw new Error('openidConfigurationInfo is missing');
153
- }
154
- this.oauthService.events.subscribe(async (event) => {
155
- // console.log('event', event);
156
- // if (event.type === 'token_received') {
157
- // console.log('Token has been refreshed');
158
- // }
159
- // if (event.type === 'token_expires') {
160
- // console.log('Token is about to expire. Triggering silent refresh...');
161
- // }
162
- });
163
- const oidcJson = localStorage.getItem(AXPSessionService.SESSION_KEY);
164
- if (oidcJson) {
165
- const authData = JSON.parse(oidcJson);
166
- if (authData) {
167
- this.setServiceProps(authData);
168
- if (authData.expiresIn && new Date(authData.expiresIn) < new Date()) {
169
- if (authData.expiresIn) {
170
- // this.refresh();
171
- }
172
- else {
173
- this.logout();
174
- }
175
- }
176
- }
177
- }
178
- }
179
- async signin(credentials) {
180
- await this.configureOAuth();
181
- try {
182
- const body = new HttpParams()
183
- .set('grant_type', 'password')
184
- .set('client_id', this.authConfig.clientId)
185
- .set('client_secret', this.authConfig.dummyClientSecret)
186
- .set('username', credentials.username)
187
- .set('password', credentials.password)
188
- .set('scope', this.authConfig.scope);
189
- const headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded');
190
- const response = await firstValueFrom(this.http.post(this.openidConfigurationInfo.info.discoveryDocument.token_endpoint, body.toString(), { headers }));
191
- // const authData = new AuthenticationData(response);
192
- this.setServiceProps({
193
- accessToken: response.access_token,
194
- refreshToken: response.refresh_token,
195
- idToken: response.id_token,
196
- expiresIn: this.calculateExpireInDate(response.expires_in ?? 0),
197
- });
198
- return {
199
- succeed: true,
200
- data: {
201
- accessToken: response.access_token,
202
- expiresIn: this.calculateExpireInDate(response.expires_in ?? 0),
203
- idToken: response.id_token,
204
- refreshToken: response.refresh_token,
205
- user: {
206
- id: response.sub,
207
- title: response.fullname,
208
- name: response.sub,
209
- avatar: response.picture,
210
- },
211
- tenant: {
212
- id: response.tenantid,
213
- name: response.tenantname,
214
- title: response.tenanttitle,
215
- },
216
- application: {
217
- id: response.applicationid,
218
- name: response.applicationname,
219
- title: response.applicationtitle,
220
- },
221
- },
222
- };
223
- }
224
- catch (error) {
225
- this.handleError(error);
226
- }
227
- }
228
- async signout() {
229
- //this.logout();
230
- }
231
- async refreshToken(context) {
232
- try {
233
- await this.configureOAuth();
234
- const refreshResult = await this.refresh(context.tenant?.id, context.application?.id);
235
- if (refreshResult) {
236
- return {
237
- succeed: true,
238
- data: {
239
- accessToken: this.oauthService.getAccessToken(),
240
- refreshToken: this.oauthService.getRefreshToken(),
241
- },
242
- };
243
- }
244
- else {
245
- return { succeed: false };
246
- }
247
- }
248
- catch (error) {
249
- console.error('Error refreshing token', error);
250
- return { succeed: false };
251
- }
252
- }
253
- async refresh(tenantId, applicationId) {
254
- await this.configureOAuth();
255
- const authData = this.loadAuthData();
256
- if (!authData)
257
- return false;
258
- const refreshToken = this.oauthService.getRefreshToken();
259
- if (!refreshToken)
260
- return false;
261
- const body = new HttpParams()
262
- .set('grant_type', 'refresh_token')
263
- .set('client_id', this.authConfig.clientId)
264
- .set('client_secret', this.authConfig.dummyClientSecret)
265
- .set('refresh_token', refreshToken)
266
- .set('tenantId', tenantId ?? '')
267
- .set('applicationId', applicationId ?? '');
268
- const headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded');
269
- try {
270
- const response = await firstValueFrom(this.http.post(this.openidConfigurationInfo.info.discoveryDocument.token_endpoint, body.toString(), { headers }));
271
- this.setServiceProps({
272
- accessToken: response.access_token,
273
- refreshToken: response.refresh_token,
274
- idToken: response.id_token,
275
- expiresIn: this.calculateExpireInDate(response.expires_in ?? 0),
276
- });
277
- return true;
278
- }
279
- catch (error) {
280
- console.error('Token refresh error', error);
281
- return false;
282
- }
283
- }
284
- expires_in_milisecound(expires_in_date) {
285
- const now = new Date();
286
- const expire = new Date(expires_in_date);
287
- return expire.getTime() - now.getTime();
288
- }
289
- setServiceProps(authData) {
290
- this.oauthService.getAccessToken = () => authData.accessToken;
291
- this.oauthService.getIdToken = () => authData.idToken ?? '';
292
- this.oauthService.getRefreshToken = () => authData.refreshToken;
293
- if (authData.expiresIn) {
294
- const refreshTime = this.expires_in_milisecound(authData.expiresIn);
295
- this.oauthService.getAccessTokenExpiration = () => refreshTime;
296
- // if (refreshTime < 0) {
297
- // this.refresh();
298
- // }else{
299
- // }
300
- }
301
- }
302
- loadAuthData() {
303
- const authDataJson = localStorage.getItem(AXPSessionService.SESSION_KEY);
304
- if (!authDataJson)
305
- return undefined;
306
- const authData = JSON.parse(authDataJson);
307
- // return authData ? new AuthenticationData(authData) : undefined;
308
- return authData;
309
- }
310
- async loadUserInfo() {
311
- return this.oauthService.loadUserProfile();
312
- }
313
- calculateExpireInDate(expireInMilisecound) {
314
- return new Date(Date.now() + expireInMilisecound * 1000).toISOString();
315
- }
316
- logout() {
317
- this.oauthService.logOut({
318
- noRedirectToLogoutUrl: true
319
- });
320
- }
321
- handleError(error) {
322
- if (error?.reason) {
323
- throw new Error(JSON.stringify(error.reason));
324
- }
325
- else if (error?.message) {
326
- throw new Error(error.message);
327
- }
328
- else {
329
- throw new Error('Network or server error occurred');
330
- }
331
- }
332
- //#region getter
333
- get name() {
334
- return 'user-pass';
335
- }
336
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOidcStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
337
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOidcStrategy }); }
338
- }
339
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOidcStrategy, decorators: [{
340
- type: Injectable
341
- }] });
342
-
343
- class AXMOidcPermissionLoader {
344
- constructor(http) {
345
- this.http = http;
346
- this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
347
- this.apiGetConfig = `${this.configs.baseUrl}/abp/application-configuration`;
348
- }
349
- getList(context) {
350
- return this.http.get(this.apiGetConfig).pipe(map((response) => this.mapTo(response)));
351
- // if (context.user == null)
352
- // return of([]);
353
- // else if (context.user.name.toLowerCase() == 'admin')
354
- // return of(['axp.admin.console', 'asc.admin.message', 'asc.admin.settings', 'asc.admin.gliding', 'asc.user.gliding']);
355
- // else
356
- // return of(['asc.user.gliding']);
357
- // return of(['axp.admin.console', 'asc.admin.message', 'asc.admin.settings', 'asc.admin.gliding', 'asc.user.gliding']);
358
- }
359
- mapTo(jsonObj) {
360
- const policies = jsonObj.auth.grantedPolicies;
361
- const truePolicies = Object.keys(policies).filter((key) => policies[key] === true);
362
- return truePolicies;
363
- }
364
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOidcPermissionLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
365
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOidcPermissionLoader }); }
366
- }
367
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOidcPermissionLoader, decorators: [{
368
- type: Injectable
369
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
370
-
371
- class AXMOidcTenantLoader {
372
- constructor(http) {
373
- this.http = http;
374
- this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
375
- this.apiGetTenants = `${this.configs.baseUrl}/user-tenants/Tenants`;
376
- this.apiSetTenant = `${this.configs.baseUrl}/SetTenant`;
377
- }
378
- getList() {
379
- return this.http.get(this.apiGetTenants).pipe(map((response) => response.items.map((item) => this.mapToAXPTenant(item))));
380
- }
381
- async set(tenant) {
382
- return Promise.resolve();
383
- }
384
- mapToAXPTenant(item) {
385
- return {
386
- id: item.id,
387
- name: item.name || 'defaultName',
388
- title: item.title || 'defaultTitle',
389
- // Add other fields and defaults as needed, and handle the logo if applicable
390
- };
391
- }
392
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOidcTenantLoader, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
393
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOidcTenantLoader }); }
394
- }
395
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOidcTenantLoader, decorators: [{
396
- type: Injectable
397
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
398
-
399
- class AXMBackendDataProvider {
400
- constructor(http) {
401
- this.http = http;
402
- this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
403
- this.filterService = inject(AXPFilterOperatorMiddlewareService);
404
- this.mainUrl = this.configs.baseUrl;
405
- }
406
- insertOne(entity, entityItem) {
407
- const url = `${this.mainUrl}${entity.area ? '/' + entity.area : ''}/${entity.module}/${entity.name}`;
408
- return firstValueFrom(this.http.post(url, entityItem));
409
- }
410
- insertMany(entity, entityList) {
411
- const promises = entityList.map((entity) => {
412
- const url = `${this.mainUrl}${entity.area ? '/' + entity.area : ''}/${entity.module}/${entity.name}`;
413
- return firstValueFrom(this.http.post(url, entity));
414
- });
415
- return Promise.all(promises);
416
- }
417
- getOne(entity, id) {
418
- const url = `${this.mainUrl}${entity.area ? '/' + entity.area : ''}/${entity.module}/${entity.name}${id ? '/' + id : ''}`;
419
- return firstValueFrom(this.http.get(url));
420
- }
421
- getMany(entity, params) {
422
- let httpParams = new HttpParams()
423
- .set('Skip', params?.skip?.toString() ?? '0')
424
- .set('Take', params?.take?.toString() ?? '10');
425
- if (params?.sort && params?.sort.length > 0) {
426
- const sortParam = params?.sort.map((sort) => `${sort.field}:${sort.dir}`).join(',');
427
- httpParams = httpParams.set('$orderby', sortParam);
428
- }
429
- const buildFilterString = (filters) => {
430
- return filters
431
- .map((f) => {
432
- if (f.filters) {
433
- return buildFilterString(f.filters);
434
- }
435
- else {
436
- return `${f.field} ${f.operator.type} ${f.value}`;
437
- }
438
- })
439
- .join(',');
440
- };
441
- let filterString = params?.customFilter ? params.customFilter : '';
442
- if (params?.filter) {
443
- const filter = params.filter;
444
- if (filter.filters) {
445
- // Construct filter string from provided filters
446
- const dynamicFilters = buildFilterString(filter.filters);
447
- // Append dynamic filters to custom filter, if both exist
448
- filterString = filterString ? `${filterString},${dynamicFilters}` : dynamicFilters;
449
- }
450
- }
451
- // Set the $filter parameter if there are any filters
452
- if (filterString) {
453
- httpParams = httpParams.set('$filter', filterString);
454
- }
455
- function capitalizeFirstLetter(str) {
456
- return str ? str.charAt(0).toUpperCase() + str.slice(1) : str;
457
- }
458
- const greaterThanOperator = this.filterService.getOperator('greaterThan');
459
- const lessThanOperator = this.filterService.getOperator('lessThan');
460
- function generateQueryString(filter) {
461
- if (!filter.filters) {
462
- // Base case: single filter
463
- if (typeof filter.value === 'object' && filter.operator.type === 'between') {
464
- return `${filter.field} ${greaterThanOperator.type} '${filter.value.from}' and ${filter.field} ${lessThanOperator.type} '${filter.value.to}'`;
465
- }
466
- else {
467
- return `${filter.field} ${filter.operator.type} '${filter.value}'`;
468
- }
469
- }
470
- else if (!filter.filters.length) {
471
- return;
472
- }
473
- else {
474
- // Recursive case: multiple filters
475
- const filterStrings = filter.filters.map((subFilter) => generateQueryString(subFilter));
476
- const logic = filter.logic || 'AND'; // Default logic is 'AND' if not provided
477
- return `${filterStrings.filter((i) => i).join(` ${logic} `)}`;
478
- }
479
- }
480
- if (params?.date) {
481
- httpParams = httpParams.set('Date', params.date);
482
- }
483
- let queryString = params?.customFilter ? params.customFilter : '';
484
- if (params?.filter) {
485
- const filter = params.filter;
486
- if (filter.filters && filter.filters.length > 0) {
487
- // Construct filter string from provided filters
488
- const dynamicQueries = generateQueryString(filter);
489
- console.log({ dynamicQueries: dynamicQueries });
490
- // Append dynamic filters to custom filter, if both exist
491
- queryString = queryString ? `${queryString},${dynamicQueries}` : dynamicQueries;
492
- }
493
- }
494
- // Set the $filter parameter if there are any filters
495
- if (queryString) {
496
- httpParams = httpParams.set('$query', queryString);
497
- }
498
- return firstValueFrom(this.http.get(`${this.mainUrl}${entity.area ? '/' + entity.area : ''}/${entity.module}/${params?.costumGetter ? params.costumGetter : entity.name}/${params?.sub ? params.sub : ''}`, { params: httpParams })).then((response) => {
499
- return {
500
- total: response.totalCount,
501
- items: response.items,
502
- };
503
- });
504
- }
505
- updateOne(entity, id, data) {
506
- const url = `${this.mainUrl}${entity.area ? '/' + entity.area : ''}/${entity.module}/${entity.name}${id ? '/' + id : ''}`;
507
- return firstValueFrom(this.http.put(url, data));
508
- }
509
- deleteOne(entity, id) {
510
- const url = `${this.mainUrl}${entity.area ? '/' + entity.area : ''}/${entity.module}/${entity.name}/${id}`;
511
- return firstValueFrom(this.http.delete(url));
512
- }
513
- getFirst(entity) {
514
- // return this.getMany(entity.name).then((res) => res.items[0]);
515
- return new Promise((resolve) => resolve(true));
516
- }
517
- // File uploader function
518
- uploadFile(file, title, customUrl) {
519
- const url = customUrl ? `${this.mainUrl}/${customUrl}` : `${this.mainUrl}/common/files`;
520
- const formData = new FormData();
521
- formData.append('File', file);
522
- formData.append('Title', title);
523
- return firstValueFrom(this.http.post(url, formData));
524
- }
525
- // to update a uploaded file
526
- updateFile(id, file, title, customUrl) {
527
- const url = customUrl ? `${this.mainUrl}/${customUrl}` : `${this.mainUrl}/common/files?id=${id}`;
528
- const formData = new FormData();
529
- formData.append('File', file);
530
- formData.append('Title', title);
531
- return firstValueFrom(this.http.put(url, formData));
532
- }
533
- // Function to upload multiple files
534
- uploadMultipleFiles(files, title) {
535
- const uploadPromises = files.map((file) => this.uploadFile(file, title));
536
- return Promise.all(uploadPromises);
537
- }
538
- // Function to view a file
539
- viewFile(id, name) {
540
- const url = `${this.mainUrl}/common/files/${id}/View/${name}`;
541
- return firstValueFrom(this.http.get(url, { responseType: 'blob' }));
542
- }
543
- // Function to download a file
544
- downloadFile(id, name) {
545
- const url = `${this.mainUrl}/common/files/${id}/Download/${name}`;
546
- return firstValueFrom(this.http.get(url, { responseType: 'blob' }));
547
- }
548
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMBackendDataProvider, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
549
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMBackendDataProvider, providedIn: 'root' }); }
550
- }
551
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMBackendDataProvider, decorators: [{
552
- type: Injectable,
553
- args: [{
554
- providedIn: 'root',
555
- }]
556
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
557
-
558
- class SignincallbackComponent {
559
- constructor(router, route) {
560
- this.router = router;
561
- this.route = route;
562
- this.sessionService = inject(AXPSessionService);
563
- }
564
- ngOnInit() {
565
- const queryParams = this.route.snapshot.queryParams;
566
- if (queryParams['tenantid']) {
567
- const selectedTenant = {
568
- id: queryParams['tenantid'],
569
- name: queryParams['tenantname'],
570
- title: queryParams['tenanttitle'],
571
- };
572
- this.sessionService.setTenant(selectedTenant);
573
- }
574
- if (queryParams['applicationid']) {
575
- const selectedApplication = {
576
- id: queryParams['applicationid'],
577
- name: queryParams['applicationname'],
578
- title: queryParams['applicationtitle'],
579
- version: '1',
580
- editionName: queryParams['editionname'],
581
- };
582
- this.sessionService.setApplication(selectedApplication);
583
- }
584
- // this.userManagerService.signinSilentCallback();
585
- }
586
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SignincallbackComponent, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
587
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: SignincallbackComponent, isStandalone: false, selector: "ng-component", ngImport: i0, template: '', isInline: true }); }
588
- }
589
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: SignincallbackComponent, decorators: [{
590
- type: Component,
591
- args: [{
592
- template: '',
593
- standalone: false
594
- }]
595
- }], ctorParameters: () => [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }] });
596
-
597
- class AXMCommentService {
598
- constructor() {
599
- this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
600
- this.http = inject(HttpClient);
601
- this.mainUrl = this.configs.baseUrl;
602
- this.messagesUrl = `${this.configs.baseUrl}/conversion/messages/room`;
603
- this.messagePostUrl = `${this.configs.baseUrl}/conversion/messages`;
604
- this.messageReactionUrl = `${this.configs.baseUrl}/conversion/message-reactions/change`;
605
- }
606
- async get(params) {
607
- const url = `${this.messagesUrl}`;
608
- return await firstValueFrom(this.http.get(url, {
609
- params: params,
610
- }));
611
- }
612
- async post(payload) {
613
- const url = `${this.messagePostUrl}`;
614
- return await firstValueFrom(this.http.post(url, payload));
615
- }
616
- async put(payload) {
617
- const url = `${this.messagePostUrl}/${payload.id}`;
618
- return await firstValueFrom(this.http.put(url, { content: payload.content }));
619
- }
620
- async delete(payload) {
621
- const url = `${this.messagePostUrl}/${payload.id}`;
622
- return await firstValueFrom(this.http.delete(url));
623
- }
624
- async like(payload) {
625
- const url = `${this.messageReactionUrl}`;
626
- return await firstValueFrom(this.http.put(url, payload));
627
- }
628
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMCommentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
629
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMCommentService, providedIn: 'root' }); }
630
- }
631
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMCommentService, decorators: [{
632
- type: Injectable,
633
- args: [{
634
- providedIn: 'root',
635
- }]
636
- }] });
637
-
638
- class AXMFileManagementService {
639
- constructor() {
640
- this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
641
- this.mainUrl = this.configs.baseUrl;
642
- this.http = inject(HttpClient);
643
- this.networkService = inject(AXNetworkService);
644
- }
645
- upload(requests) {
646
- const url = `${this.mainUrl}/common/files`;
647
- const tasks = requests.map((r) => {
648
- const formData = new FormData();
649
- formData.append('File', r.file);
650
- const task = this.networkService.upload(url, formData);
651
- return new Promise((resolve, reject) => {
652
- task.events.subscribe({
653
- next: (event) => {
654
- if (event.status == AXUploadStatus.UploadFailed) {
655
- r.error(event.message || '');
656
- reject(event.result);
657
- }
658
- if (event.status == AXUploadStatus.UploadComplete) {
659
- r.finish();
660
- resolve(event.result);
661
- }
662
- else {
663
- r.setTransferredBytes(event.bytesTransferred);
664
- }
665
- },
666
- });
667
- r.onStart.subscribe(() => {
668
- task.start();
669
- });
670
- r.onCancel.subscribe(() => {
671
- task.cancel();
672
- reject({ status: 'cancelled', request: r });
673
- });
674
- r.upload();
675
- });
676
- });
677
- return Promise.allSettled(tasks);
678
- }
679
- delete(fileId) {
680
- return new Promise((resolve, reject) => {
681
- setTimeout(() => resolve({ success: true, fileId }), 1000);
682
- });
683
- }
684
- get(fileId, name) {
685
- return new Observable((observer) => {
686
- const url = `${this.mainUrl}/common/files/${fileId}/Download/${name}`;
687
- const downloadTask = this.networkService.download(url);
688
- downloadTask.events.subscribe((event) => {
689
- // Emit progress events
690
- observer.next({
691
- status: event.status,
692
- progress: event.progress,
693
- fileId,
694
- data: event.data || null, // Assuming `event.data` contains the downloaded file's data when completed
695
- });
696
- // Complete the observable if download is finished
697
- if (event.status === AXDownloadStatus.DownloadComplete) {
698
- observer.complete();
699
- }
700
- }, (error) => {
701
- console.error('Download failed:', error);
702
- observer.error({
703
- status: 'failed',
704
- fileId,
705
- error,
706
- });
707
- });
708
- return () => {
709
- downloadTask.cancel();
710
- };
711
- });
712
- }
713
- list() {
714
- return new Promise((resolve, reject) => {
715
- setTimeout(() => resolve([{ fileId: '1', data: 'fileData' }]), 1000);
716
- });
717
- }
718
- setMetadata(fileId, metadata) {
719
- return new Promise((resolve, reject) => {
720
- setTimeout(() => resolve({ fileId, metadata }), 1000);
721
- });
722
- }
723
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMFileManagementService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
724
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMFileManagementService, providedIn: 'root' }); }
725
- }
726
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMFileManagementService, decorators: [{
727
- type: Injectable,
728
- args: [{
729
- providedIn: 'root',
730
- }]
731
- }] });
732
-
733
- class AXMModuleDesignerService {
734
- constructor() {
735
- this.loader = inject(AXPEntityDefinitionRegistryService);
736
- this.defaultConfig = {
737
- skip: 0,
738
- sort: [],
739
- take: 10,
740
- filter: {
741
- field: '',
742
- value: '',
743
- operator: 'equal',
744
- },
745
- };
746
- this.AdvanceConfig = (moduleId) => ({
747
- skip: 0,
748
- sort: [],
749
- take: 10,
750
- filter: {
751
- field: '',
752
- value: '',
753
- operator: { type: 'equal' },
754
- filters: [
755
- {
756
- field: 'moduleId',
757
- operator: { type: 'equal' },
758
- value: moduleId,
759
- },
760
- ],
761
- },
762
- });
763
- }
764
- async moduleDef() {
765
- return this.loader.resolve('application-management', 'module');
766
- }
767
- async entityDef() {
768
- return this.loader.resolve('application-management', 'entity');
769
- }
770
- async featureDef() {
771
- return this.loader.resolve('application-management', 'feature');
772
- }
773
- async permissionDef() {
774
- return this.loader.resolve('application-management', 'permission');
775
- }
776
- async getModules() {
777
- const entity = await this.moduleDef();
778
- const func = entity?.queries.list?.execute;
779
- return func(this.defaultConfig);
780
- }
781
- async getSingleModule() { }
782
- async createModule(payload) { }
783
- async updateModule(moduleId, payload) { }
784
- async deleteModule(moduleId) { }
785
- //
786
- async getEntities(moduleId) {
787
- const entity = await this.entityDef();
788
- const func = entity?.queries.list?.execute;
789
- return func(this.AdvanceConfig(moduleId));
790
- }
791
- async getSingleEntity(entityId) { }
792
- async createEntity(payload) { }
793
- async updateEntity(payload) { }
794
- async deleteEntity(entityId) { }
795
- //
796
- async getFeatures(moduleId) {
797
- const entity = await this.featureDef();
798
- const func = entity?.queries.list?.execute;
799
- return func(this.AdvanceConfig(moduleId));
800
- }
801
- async getSingleFeature(featureId) { }
802
- async createFeature(payload) { }
803
- async updateFeature(payload) { }
804
- async deleteFeature(featureId) { }
805
- //
806
- async getPermissions(moduleId) {
807
- const entity = await this.permissionDef();
808
- const func = entity?.queries.list?.execute;
809
- return func(this.AdvanceConfig(moduleId));
810
- }
811
- async getSinglePermission(permissionId) { }
812
- async createPermission(payload) { }
813
- async updatePermission(payload) { }
814
- async deletePermission(permissionId) { }
815
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMModuleDesignerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
816
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMModuleDesignerService, providedIn: 'root' }); }
817
- }
818
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMModuleDesignerService, decorators: [{
819
- type: Injectable,
820
- args: [{
821
- providedIn: 'root',
822
- }]
823
- }] });
824
-
825
- function routesFactory() {
826
- const routes = [{ path: 'auth/signincallback', component: SignincallbackComponent }];
827
- return routes;
828
- }
829
- class AXMBackendModule {
830
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMBackendModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
831
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: AXMBackendModule, imports: [i1$2.OAuthModule, AXMAuthModule, i2.AXPAuthModule] }); }
832
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMBackendModule, providers: [
833
- {
834
- provide: AXPDataProvider,
835
- useClass: AXMBackendDataProvider,
836
- },
837
- {
838
- provide: AXP_TENANT_LOADER,
839
- useClass: AXMOidcTenantLoader,
840
- },
841
- {
842
- provide: AXP_APPLICATION_LOADER,
843
- useClass: AXMOidcApplicationLoader,
844
- },
845
- {
846
- provide: AXP_PERMISSION_LOADER,
847
- useClass: AXMOidcPermissionLoader,
848
- },
849
- {
850
- provide: AXP_FEATURE_LOADER,
851
- useClass: AXMOidcFeatureLoader,
852
- },
853
- {
854
- provide: AXPFileManagementService,
855
- useClass: AXMFileManagementService,
856
- },
857
- // {
858
- // provide: AXPCommentService,
859
- // useClass: AXMCommentService,
860
- // },
861
- // {
862
- // provide: AXMNotificationService,
863
- // useClass: AXMMockNotificationService,
864
- // },
865
- {
866
- provide: AXPModuleDesignerService,
867
- useClass: AXMModuleDesignerService,
868
- },
869
- {
870
- provide: ROUTES,
871
- multi: true,
872
- useFactory: routesFactory,
873
- },
874
- ], imports: [OAuthModule.forRoot(),
875
- AXMAuthModule,
876
- AXPAuthModule.forRoot({
877
- strategies: [AXMOidcStrategy],
878
- })] }); }
879
- }
880
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMBackendModule, decorators: [{
881
- type: NgModule,
882
- args: [{
883
- imports: [
884
- OAuthModule.forRoot(),
885
- AXMAuthModule,
886
- AXPAuthModule.forRoot({
887
- strategies: [AXMOidcStrategy],
888
- }),
889
- ],
890
- exports: [],
891
- declarations: [],
892
- providers: [
893
- {
894
- provide: AXPDataProvider,
895
- useClass: AXMBackendDataProvider,
896
- },
897
- {
898
- provide: AXP_TENANT_LOADER,
899
- useClass: AXMOidcTenantLoader,
900
- },
901
- {
902
- provide: AXP_APPLICATION_LOADER,
903
- useClass: AXMOidcApplicationLoader,
904
- },
905
- {
906
- provide: AXP_PERMISSION_LOADER,
907
- useClass: AXMOidcPermissionLoader,
908
- },
909
- {
910
- provide: AXP_FEATURE_LOADER,
911
- useClass: AXMOidcFeatureLoader,
912
- },
913
- {
914
- provide: AXPFileManagementService,
915
- useClass: AXMFileManagementService,
916
- },
917
- // {
918
- // provide: AXPCommentService,
919
- // useClass: AXMCommentService,
920
- // },
921
- // {
922
- // provide: AXMNotificationService,
923
- // useClass: AXMMockNotificationService,
924
- // },
925
- {
926
- provide: AXPModuleDesignerService,
927
- useClass: AXMModuleDesignerService,
928
- },
929
- {
930
- provide: ROUTES,
931
- multi: true,
932
- useFactory: routesFactory,
933
- },
934
- ],
935
- }]
936
- }] });
937
-
938
- /**
939
- * Generated bundle index. Do not edit.
940
- */
941
-
942
- export { AXMBackendDataProvider, AXMBackendModule, AXMCommentService, AXMConfigurationService, AXMFileManagementService, AXMModuleDesignerService, AXMOidcApplicationLoader, AXMOidcFeatureLoader, AXMOidcPermissionLoader, AXMOidcStrategy, AXMOidcTenantLoader };
943
- //# sourceMappingURL=acorex-modules-backend.mjs.map