@acorex/platform 21.0.0-next.71 → 21.0.0-next.73

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 (60) hide show
  1. package/contracts/README.md +3 -0
  2. package/fesm2022/acorex-platform-auth.mjs +82 -60
  3. package/fesm2022/acorex-platform-auth.mjs.map +1 -1
  4. package/fesm2022/{acorex-platform-common-common-settings.provider-Bi1RYif5.mjs → acorex-platform-common-common-settings.provider-Ytey9uhY.mjs} +15 -1
  5. package/fesm2022/acorex-platform-common-common-settings.provider-Ytey9uhY.mjs.map +1 -0
  6. package/fesm2022/acorex-platform-common.mjs +3796 -1677
  7. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  8. package/fesm2022/acorex-platform-contracts.mjs +10 -0
  9. package/fesm2022/acorex-platform-contracts.mjs.map +1 -0
  10. package/fesm2022/acorex-platform-core.mjs +1126 -114
  11. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  12. package/fesm2022/acorex-platform-layout-builder.mjs +56 -170
  13. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  14. package/fesm2022/acorex-platform-layout-components.mjs +254 -53
  15. package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
  16. package/fesm2022/acorex-platform-layout-designer.mjs +199 -126
  17. package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
  18. package/fesm2022/{acorex-platform-layout-entity-attachments-page.component-D8iQnT-R.mjs → acorex-platform-layout-entity-attachments-page.component-B0EkdqvH.mjs} +6 -1
  19. package/fesm2022/acorex-platform-layout-entity-attachments-page.component-B0EkdqvH.mjs.map +1 -0
  20. package/fesm2022/acorex-platform-layout-entity.mjs +403 -460
  21. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  22. package/fesm2022/acorex-platform-layout-views.mjs +675 -301
  23. package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
  24. package/fesm2022/acorex-platform-layout-widget-core.mjs +126 -75
  25. package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
  26. package/fesm2022/{acorex-platform-layout-widgets-tabular-data-edit-popup.component-BcpRkpJp.mjs → acorex-platform-layout-widgets-tabular-data-edit-popup.component-DjpZU6gz.mjs} +2 -2
  27. package/fesm2022/{acorex-platform-layout-widgets-tabular-data-edit-popup.component-BcpRkpJp.mjs.map → acorex-platform-layout-widgets-tabular-data-edit-popup.component-DjpZU6gz.mjs.map} +1 -1
  28. package/fesm2022/{acorex-platform-layout-widgets-tabular-data-view-popup.component-DQtK4lxl.mjs → acorex-platform-layout-widgets-tabular-data-view-popup.component-gX-3Kx9I.mjs} +2 -2
  29. package/fesm2022/{acorex-platform-layout-widgets-tabular-data-view-popup.component-DQtK4lxl.mjs.map → acorex-platform-layout-widgets-tabular-data-view-popup.component-gX-3Kx9I.mjs.map} +1 -1
  30. package/fesm2022/acorex-platform-layout-widgets.mjs +450 -750
  31. package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
  32. package/fesm2022/acorex-platform-themes-default-error-401.component-B1nsdpTY.mjs +48 -0
  33. package/fesm2022/acorex-platform-themes-default-error-401.component-B1nsdpTY.mjs.map +1 -0
  34. package/fesm2022/acorex-platform-themes-default-error-404.component-D4UvRe8u.mjs +42 -0
  35. package/fesm2022/acorex-platform-themes-default-error-404.component-D4UvRe8u.mjs.map +1 -0
  36. package/fesm2022/acorex-platform-themes-default.mjs +79 -35
  37. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  38. package/fesm2022/acorex-platform-themes-shared-settings.provider-BjuzSe0T.mjs.map +1 -1
  39. package/fesm2022/acorex-platform-themes-shared.mjs +3 -0
  40. package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
  41. package/fesm2022/acorex-platform-workflow.mjs +57 -54
  42. package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
  43. package/package.json +5 -1
  44. package/types/acorex-platform-auth.d.ts +31 -22
  45. package/types/acorex-platform-common.d.ts +892 -259
  46. package/types/acorex-platform-contracts.d.ts +39 -0
  47. package/types/acorex-platform-core.d.ts +291 -47
  48. package/types/acorex-platform-layout-builder.d.ts +10 -22
  49. package/types/acorex-platform-layout-components.d.ts +86 -14
  50. package/types/acorex-platform-layout-entity.d.ts +218 -212
  51. package/types/acorex-platform-layout-views.d.ts +125 -67
  52. package/types/acorex-platform-layout-widget-core.d.ts +56 -62
  53. package/types/acorex-platform-layout-widgets.d.ts +78 -65
  54. package/types/acorex-platform-themes-default.d.ts +14 -4
  55. package/fesm2022/acorex-platform-common-common-settings.provider-Bi1RYif5.mjs.map +0 -1
  56. package/fesm2022/acorex-platform-layout-entity-attachments-page.component-D8iQnT-R.mjs.map +0 -1
  57. package/fesm2022/acorex-platform-themes-default-error-401.component-C7EYJzSr.mjs +0 -31
  58. package/fesm2022/acorex-platform-themes-default-error-401.component-C7EYJzSr.mjs.map +0 -1
  59. package/fesm2022/acorex-platform-themes-default-error-404.component-7MVLMwIa.mjs +0 -25
  60. package/fesm2022/acorex-platform-themes-default-error-404.component-7MVLMwIa.mjs.map +0 -1
@@ -0,0 +1,3 @@
1
+ # @acorex/platform/contracts
2
+
3
+ Secondary entry point of `@acorex/platform`. It can be used by importing from `@acorex/platform/contracts`.
@@ -39,6 +39,60 @@ class AXPApplicationDefaultLoader {
39
39
  }
40
40
  }
41
41
 
42
+ //#region ---- Datasource keys ----
43
+ /** Platform auth datasource registry names. */
44
+ const AXPPlatformAuthDataSourceKeys = {
45
+ PermissionDefinitions: 'platform-permission-definitions',
46
+ };
47
+ //#endregion
48
+
49
+ class AXPUnauthorizedError extends Error {
50
+ constructor(message, data) {
51
+ super(message);
52
+ this.data = data;
53
+ this.name = 'AXPUnauthorizedError';
54
+ }
55
+ }
56
+ class AXPUnauthenticatedError extends Error {
57
+ constructor(message, data) {
58
+ super(message);
59
+ this.data = data;
60
+ this.name = 'AXPUnauthenticatedError';
61
+ }
62
+ }
63
+
64
+ class AXPSessionContext {
65
+ get user() {
66
+ return this._user;
67
+ }
68
+ get tenant() {
69
+ return this._tenant;
70
+ }
71
+ get application() {
72
+ return this._application;
73
+ }
74
+ constructor(context) {
75
+ this._user = null;
76
+ this._tenant = null;
77
+ this._application = null;
78
+ this._user = context.user;
79
+ this._tenant = context.tenant;
80
+ this._application = context.application;
81
+ }
82
+ }
83
+ var AXPSessionStatus;
84
+ (function (AXPSessionStatus) {
85
+ AXPSessionStatus["Authenticated"] = "authenticated";
86
+ AXPSessionStatus["Unauthenticated"] = "unauthenticated";
87
+ AXPSessionStatus["Unauthorized"] = "unauthorized";
88
+ AXPSessionStatus["Authorized"] = "authorized";
89
+ AXPSessionStatus["Expired"] = "expired";
90
+ AXPSessionStatus["SignedOut"] = "signedOut";
91
+ })(AXPSessionStatus || (AXPSessionStatus = {}));
92
+
93
+ //#region ---- Contracts barrel ----
94
+ //#endregion
95
+
42
96
  const AXP_TENANT_LOADER = new InjectionToken('AXP_TENANT_LOADER', {
43
97
  providedIn: 'root',
44
98
  factory: () => {
@@ -149,21 +203,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
149
203
  type: Input
150
204
  }] } });
151
205
 
152
- class AXPUnauthorizedError extends Error {
153
- constructor(message, data) {
154
- super(message);
155
- this.data = data;
156
- this.name = 'AXPUnauthorizedError';
157
- }
158
- }
159
- class AXPUnauthenticatedError extends Error {
160
- constructor(message, data) {
161
- super(message);
162
- this.data = data;
163
- this.name = 'AXPUnauthenticatedError';
164
- }
165
- }
166
-
167
206
  const AXPFeatureGuard = (route, state) => {
168
207
  const sessionService = inject(AXPSessionService);
169
208
  const requiredFeatures = route.data['requiredFeature'];
@@ -205,35 +244,6 @@ class AXPPermissionDefaultLoader {
205
244
  */
206
245
  const AXP_PERMISSION_CHECKER = new InjectionToken('AXP_PERMISSION_CHECKER');
207
246
 
208
- class AXPSessionContext {
209
- get user() {
210
- return this._user;
211
- }
212
- get tenant() {
213
- return this._tenant;
214
- }
215
- get application() {
216
- return this._application;
217
- }
218
- constructor(context) {
219
- this._user = null;
220
- this._tenant = null;
221
- this._application = null;
222
- this._user = context.user;
223
- this._tenant = context.tenant;
224
- this._application = context.application;
225
- }
226
- }
227
- var AXPSessionStatus;
228
- (function (AXPSessionStatus) {
229
- AXPSessionStatus["Authenticated"] = "authenticated";
230
- AXPSessionStatus["Unauthenticated"] = "unauthenticated";
231
- AXPSessionStatus["Unauthorized"] = "unauthorized";
232
- AXPSessionStatus["Authorized"] = "authorized";
233
- AXPSessionStatus["Expired"] = "expired";
234
- AXPSessionStatus["SignedOut"] = "signedOut";
235
- })(AXPSessionStatus || (AXPSessionStatus = {}));
236
-
237
247
  class AXPSessionService {
238
248
  constructor() {
239
249
  this.eventService = inject(AXPBroadcastEventService);
@@ -274,6 +284,13 @@ class AXPSessionService {
274
284
  return this.isAuthenticated$;
275
285
  }), shareReplay(1));
276
286
  this.isAuthorized$ = this.status$.pipe(map((status) => status === AXPSessionStatus.Authorized), shareReplay(1));
287
+ /** Waits for session restore to finish, then emits whether the session is fully authorized. */
288
+ this.isAuthorizedWithLoading$ = this.isLoading$.pipe(switchMap((loading) => {
289
+ if (loading) {
290
+ return this.isLoading$.pipe(filter((isLoading) => !isLoading), switchMap(() => this.isAuthorized$));
291
+ }
292
+ return this.isAuthorized$;
293
+ }), shareReplay(1));
277
294
  }
278
295
  static { this.SESSION_KEY = 'AXP_SESSION'; }
279
296
  get user() {
@@ -366,6 +383,7 @@ class AXPSessionService {
366
383
  tenant: result.data?.tenant,
367
384
  expiresIn: result.data?.expiresIn,
368
385
  idToken: result.data?.idToken ?? null,
386
+ locked: false,
369
387
  });
370
388
  await this.loadPermissions();
371
389
  await this.loadFeatures();
@@ -525,15 +543,10 @@ class AXPSessionService {
525
543
  }, 100);
526
544
  }
527
545
  setSession(tokens) {
546
+ const existing = this.getSessionData() ?? {};
528
547
  const sessionData = {
529
- accessToken: tokens.accessToken,
530
- refreshToken: tokens.refreshToken,
531
- strategy: tokens.strategy,
532
- user: tokens.user,
533
- application: tokens.application,
534
- tenant: tokens.tenant,
535
- expiresIn: tokens.expiresIn,
536
- idToken: tokens.idToken,
548
+ ...existing,
549
+ ...tokens,
537
550
  };
538
551
  // Update subjects
539
552
  if (tokens.user) {
@@ -547,6 +560,18 @@ class AXPSessionService {
547
560
  }
548
561
  localStorage.setItem(AXPSessionService.SESSION_KEY, JSON.stringify(sessionData));
549
562
  }
563
+ /** Whether the client lock overlay should remain active after reload. */
564
+ isLocked() {
565
+ return this.getSessionData()?.locked === true;
566
+ }
567
+ /** Persists client lock state inside {@link AXPSessionService.SESSION_KEY}. */
568
+ setLocked(locked) {
569
+ const existing = this.getSessionData();
570
+ if (!existing) {
571
+ return;
572
+ }
573
+ this.setSession({ locked });
574
+ }
550
575
  setStrategy(strategy) {
551
576
  const sessionData = this.getSessionData();
552
577
  const newSessionData = { ...sessionData, strategy };
@@ -704,12 +729,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
704
729
  const AXPPermissionGuard = (route, state) => {
705
730
  const sessionService = inject(AXPSessionService);
706
731
  const permissionKeys = route.data['requiredPermission'];
707
- return sessionService.isAuthorized$.pipe(first(), map((value) => {
732
+ return sessionService.isAuthorizedWithLoading$.pipe(first(), map((value) => {
733
+ debugger;
708
734
  const keys = !permissionKeys ? [] : Array.isArray(permissionKeys) ? permissionKeys : [permissionKeys];
709
735
  const hasPermission = keys.length == 0 || sessionService.authorize(...keys);
710
736
  if (!hasPermission) {
711
737
  throw new AXPUnauthorizedError(`Access denied. Required permissions: ${keys.join(', ')}. Please contact your administrator if you believe this is an error.`, {
712
- redirectUrl: state.url
738
+ redirectUrl: state.url,
713
739
  });
714
740
  }
715
741
  return true;
@@ -921,10 +947,6 @@ function flattenPermissionDefinitions(nodes, groupPrefix) {
921
947
  }
922
948
  //#endregion
923
949
  //#region ---- Permission definitions data source ----
924
- /**
925
- * Registered permission definitions for select widgets via dataSource name {@link PERMISSION_DEFINITIONS_DATASOURCE_NAME}.
926
- */
927
- const PERMISSION_DEFINITIONS_DATASOURCE_NAME = 'platform-permission-definitions';
928
950
  /**
929
951
  * Data source definition for leaf permissions from {@link AXPPermissionDefinitionService#getGroups}.
930
952
  */
@@ -939,7 +961,7 @@ class AXPPermissionDefinitionsDataSourceDefinition {
939
961
  async items() {
940
962
  return [
941
963
  {
942
- name: PERMISSION_DEFINITIONS_DATASOURCE_NAME,
964
+ name: AXPPlatformAuthDataSourceKeys.PermissionDefinitions,
943
965
  title: 'Permissions',
944
966
  source: () => new AXDataSource({
945
967
  key: 'id',
@@ -1362,5 +1384,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
1362
1384
  * Generated bundle index. Do not edit.
1363
1385
  */
1364
1386
 
1365
- export { AXPAuthGuard, AXPAuthModule, AXPAuthStrategy, AXPAuthStrategyRegistryService, AXPFeatureDirective, AXPFeatureGuard, AXPLoginChallengeComponentBase, AXPLoginChallengeProvider, AXPPermissionDefinitionBuilder, AXPPermissionDefinitionGroupBuilder, AXPPermissionDefinitionProviderContext, AXPPermissionDefinitionService, AXPPermissionDefinitionsDataSourceDefinition, AXPPermissionDirective, AXPPermissionEvaluatorScopeProvider, AXPPermissionGuard, AXPSessionContext, AXPSessionService, AXPSessionStatus, AXPUnauthenticatedError, AXPUnauthorizedError, AXP_APPLICATION_LOADER, AXP_FEATURE_CHECKER, AXP_FEATURE_LOADER, AXP_LOGIN_CHALLENGE_PROVIDER, AXP_PERMISSION_CHECKER, AXP_PERMISSION_DEFINITION_PROVIDER, AXP_PERMISSION_LOADER, AXP_TENANT_LOADER, JwtUtil, PERMISSION_DEFINITIONS_DATASOURCE_NAME, PkceUtil, TimeUtil, initializeAppState };
1387
+ export { AXPAuthGuard, AXPAuthModule, AXPAuthStrategy, AXPAuthStrategyRegistryService, AXPFeatureDirective, AXPFeatureGuard, AXPLoginChallengeComponentBase, AXPLoginChallengeProvider, AXPPermissionDefinitionBuilder, AXPPermissionDefinitionGroupBuilder, AXPPermissionDefinitionProviderContext, AXPPermissionDefinitionService, AXPPermissionDefinitionsDataSourceDefinition, AXPPermissionDirective, AXPPermissionEvaluatorScopeProvider, AXPPermissionGuard, AXPPlatformAuthDataSourceKeys, AXPSessionContext, AXPSessionService, AXPSessionStatus, AXPUnauthenticatedError, AXPUnauthorizedError, AXP_APPLICATION_LOADER, AXP_FEATURE_CHECKER, AXP_FEATURE_LOADER, AXP_LOGIN_CHALLENGE_PROVIDER, AXP_PERMISSION_CHECKER, AXP_PERMISSION_DEFINITION_PROVIDER, AXP_PERMISSION_LOADER, AXP_TENANT_LOADER, JwtUtil, PkceUtil, TimeUtil, initializeAppState };
1366
1388
  //# sourceMappingURL=acorex-platform-auth.mjs.map