@fluxo-dev/api-client-base 0.0.25 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -1740,9 +1740,6 @@ class FluxoStateDispatcher {
1740
1740
  static dispatchHasAdminAccess(hasAdminAccess) {
1741
1741
  state.store.dispatch(state.setHasAdminAccess(hasAdminAccess));
1742
1742
  }
1743
- static dispatchSetRouteRules(rules) {
1744
- state.store.dispatch(state.setRouteRules(rules));
1745
- }
1746
1743
  static dispatchSetConfiguration(items) {
1747
1744
  state.store.dispatch(state.setConfiguration(items));
1748
1745
  }
@@ -1764,6 +1761,12 @@ class FluxoStateDispatcher {
1764
1761
  static dispatchSetCurrentFrontend(frontend) {
1765
1762
  state.store.dispatch(state.setCurrentFrontend(frontend));
1766
1763
  }
1764
+ static dispatchSetSessionMode(mode) {
1765
+ state.store.dispatch(state.setMode(mode));
1766
+ }
1767
+ static dispatchSetRoutes(routes) {
1768
+ state.store.dispatch(state.setRoutes(routes));
1769
+ }
1767
1770
  }
1768
1771
 
1769
1772
  class AuthService {
@@ -2064,34 +2067,12 @@ class PermissionService {
2064
2067
  }
2065
2068
  }
2066
2069
 
2067
- class RouteRuleService extends BaseCommonService {
2068
- constructor() {
2069
- super('route-rule');
2070
- }
2071
- getRouteRulesForScope(scope, packageName) {
2072
- return HttpClient.Instance().client.get(`route-rule?scope=${scope}&packageName=${packageName}`);
2073
- }
2074
- getPermissions(routeRuleId) {
2075
- return HttpClient.Instance().client.get(`route-rule/${routeRuleId}/permissions`);
2076
- }
2077
- addPermission(routeRuleId, permissionId) {
2078
- return HttpClient.Instance().client.post(`route-rule/${routeRuleId}/permissions`, {
2079
- domainRoleId: routeRuleId,
2080
- permissionId: permissionId
2081
- });
2082
- }
2083
- removePermission(routeRuleId, permissionId) {
2084
- return HttpClient.Instance().client.delete(`route-rule/${routeRuleId}/permissions/${permissionId}`);
2085
- }
2086
- }
2087
-
2088
2070
  class SecurityFacade {
2089
2071
  constructor() {
2090
2072
  this._userService = new UserService();
2091
2073
  this._apiKeyService = new ApiKeyService();
2092
2074
  this._domainRoleService = new DomainRoleService();
2093
2075
  this._permissionService = new PermissionService();
2094
- this._routeRuleService = new RouteRuleService();
2095
2076
  this._currentUserService = new CurrentUser();
2096
2077
  }
2097
2078
  get user() {
@@ -2103,9 +2084,6 @@ class SecurityFacade {
2103
2084
  get permission() {
2104
2085
  return this._permissionService;
2105
2086
  }
2106
- get routeRule() {
2107
- return this._routeRuleService;
2108
- }
2109
2087
  get apiKey() {
2110
2088
  return this._apiKeyService;
2111
2089
  }
@@ -2460,6 +2438,12 @@ class EmbeddedModule {
2460
2438
  }
2461
2439
  constructor(name, description, author, version, scope) {
2462
2440
  this._navigation = [];
2441
+ this.getFullyQualifiedRoute = (route, parent = undefined) => {
2442
+ const r1 = "/" + this.scope + "/" + this.name + "/";
2443
+ const r2 = r1 + `${parent && parent !== '/' ? parent + '/' : ''}`;
2444
+ const r3 = r2 + `${route.route && route.route !== '/' ? route.route : ''}`;
2445
+ return r3;
2446
+ };
2463
2447
  this._name = name;
2464
2448
  this._description = description;
2465
2449
  this._author = author;
@@ -2469,6 +2453,23 @@ class EmbeddedModule {
2469
2453
  attachNavigation(navigationConfig) {
2470
2454
  this._navigation.push(navigationConfig);
2471
2455
  }
2456
+ // Generate dictionary of routes recursively
2457
+ getRouteMap(routes = undefined, parent = undefined) {
2458
+ const r = routes !== null && routes !== void 0 ? routes : this._navigation.map(a => a.routes).map(a => a).flat();
2459
+ if (!r || r.length === 0) return {};
2460
+ const routeMap = {};
2461
+ r.map(route => {
2462
+ if (route.route) {
2463
+ routeMap[this.getFullyQualifiedRoute(route, parent)] = {
2464
+ title: route.title
2465
+ };
2466
+ if (route.routes && route.routes.length > 0) {
2467
+ Object.assign(routeMap, this.getRouteMap(route.routes, route.route));
2468
+ }
2469
+ }
2470
+ });
2471
+ return routeMap;
2472
+ }
2472
2473
  getRouteObject(routes = undefined) {
2473
2474
  const r = routes !== null && routes !== void 0 ? routes : this._navigation.map(a => a.routes).map(a => a).flat();
2474
2475
  if (!r || r.length === 0) return [];
@@ -2977,7 +2978,6 @@ exports.MailServerService = MailServerService;
2977
2978
  exports.PermissionService = PermissionService;
2978
2979
  exports.PrintingService = PrintingService;
2979
2980
  exports.ReportingService = ReportingService;
2980
- exports.RouteRuleService = RouteRuleService;
2981
2981
  exports.ServerFilterHelper = ServerFilterHelper;
2982
2982
  exports.UserService = UserService;
2983
2983
  exports.WorkflowService = WorkflowService;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@fluxo-dev/api-client-base",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
- "@fluxo-dev/state": "0.0.25"
6
+ "@fluxo-dev/state": "0.0.27"
7
7
  },
8
8
  "main": "./index.cjs.js"
9
9
  }
package/src/index.d.ts CHANGED
@@ -13,7 +13,6 @@ export * from './lib/security/user';
13
13
  export * from './lib/security/apikey';
14
14
  export * from './lib/security/domain-role';
15
15
  export * from './lib/security/permission';
16
- export * from './lib/security/route-rule';
17
16
  export * from './lib/communication';
18
17
  export * from './lib/korebi';
19
18
  export * from './lib/apps';
@@ -16,6 +16,12 @@ export declare class EmbeddedModule {
16
16
  private _navigation;
17
17
  constructor(name: string, description: string, author: string, version: string, scope: string);
18
18
  attachNavigation(navigationConfig: EmbeddedModuleNavigation): void;
19
+ getRouteMap(routes?: EmbeddedModuleRoute[] | undefined, parent?: string | undefined): {
20
+ [id: string]: {
21
+ title: string | undefined;
22
+ };
23
+ };
24
+ private getFullyQualifiedRoute;
19
25
  getRouteObject(routes?: EmbeddedModuleRoute[] | undefined): RouteObject[];
20
26
  getEmbeddedModule(): FluxoEmbeddedModuleConfiguration;
21
27
  }
@@ -26,5 +32,6 @@ export interface EmbeddedModuleNavigation {
26
32
  export interface EmbeddedModuleRoute {
27
33
  route?: string;
28
34
  component?: any;
35
+ title?: string;
29
36
  routes?: EmbeddedModuleRoute[];
30
37
  }
@@ -3,7 +3,6 @@ import { ClientUi } from "./client-ui";
3
3
  import { FeatureList } from "./models/feature-list";
4
4
  import { FluxoApp } from "../apps/models/fluxo-app";
5
5
  import { DomainRole } from "../security/domain-role/index";
6
- import { RouteRuleWithPermissions } from "../security/route-rule/index";
7
6
  import { Permission } from "../security/permission/index";
8
7
  import { AppMenu } from "./app-menu";
9
8
  import { AppMenuCreateCommand } from "./app-menu-create-command";
@@ -14,7 +13,6 @@ export type InitialConfiguration = {
14
13
  ui: ClientUi;
15
14
  domainRoles: DomainRole[];
16
15
  permissions: any[];
17
- routeRules: RouteRuleWithPermissions[];
18
16
  frontends: string[];
19
17
  currentFrontend: string;
20
18
  isUserLogged: boolean;
@@ -12,7 +12,6 @@ export declare class FluxoStateDispatcher {
12
12
  static dispatchSetAppMenu(items: AppMenuItem[]): void;
13
13
  static dispatchAllowedFrontends(frontends: string[]): void;
14
14
  static dispatchHasAdminAccess(hasAdminAccess: boolean): void;
15
- static dispatchSetRouteRules(rules: any): void;
16
15
  static dispatchSetConfiguration(items: any): void;
17
16
  static dispatchSetSysFeatures(items: any): void;
18
17
  static dispatchSetJitAppsFeatures(items: any): void;
@@ -23,4 +22,10 @@ export declare class FluxoStateDispatcher {
23
22
  name: string;
24
23
  }[]): void;
25
24
  static dispatchSetCurrentFrontend(frontend: string): void;
25
+ static dispatchSetSessionMode(mode: 'single-session' | 'multi-session'): void;
26
+ static dispatchSetRoutes(routes: {
27
+ [id: string]: {
28
+ title: string | undefined;
29
+ };
30
+ }): void;
26
31
  }
@@ -2,7 +2,6 @@ import { UserService } from "./user/user-service";
2
2
  import { DomainRoleService } from "./domain-role";
3
3
  import { ApiKeyService } from "./apikey";
4
4
  import { PermissionService } from "./permission/permission.service";
5
- import { RouteRuleService } from "./route-rule/route-rule.service";
6
5
  import { CurrentUser } from "@fluxo-dev/api-client-base";
7
6
  export declare class SecurityFacade {
8
7
  private readonly _userService;
@@ -10,12 +9,10 @@ export declare class SecurityFacade {
10
9
  private readonly _apiKeyService;
11
10
  private readonly _domainRoleService;
12
11
  private readonly _permissionService;
13
- private readonly _routeRuleService;
14
12
  constructor();
15
13
  get user(): UserService;
16
14
  get currentUser(): CurrentUser;
17
15
  get permission(): PermissionService;
18
- get routeRule(): RouteRuleService;
19
16
  get apiKey(): ApiKeyService;
20
17
  get domainRole(): DomainRoleService;
21
18
  }
@@ -1,3 +0,0 @@
1
- export * from './route-rule';
2
- export * from './route-rule.service';
3
- export * from './route-rule-with-permissions';
@@ -1,4 +0,0 @@
1
- export interface RouteRuleWithPermissions {
2
- route: string;
3
- permissions: string[];
4
- }
@@ -1,7 +0,0 @@
1
- export interface RouteRule {
2
- id?: number;
3
- scope: string;
4
- packageName: string;
5
- route: string;
6
- permissionsCount?: number;
7
- }
@@ -1,10 +0,0 @@
1
- import { RouteRule } from "./route-rule";
2
- import { BaseCommonService } from "../../infrastructure";
3
- import { Permission } from "../permission";
4
- export declare class RouteRuleService extends BaseCommonService<RouteRule> {
5
- constructor();
6
- getRouteRulesForScope(scope: string, packageName: string): Promise<RouteRule[]>;
7
- getPermissions(routeRuleId: string): Promise<Permission[]>;
8
- addPermission(routeRuleId: number, permissionId: number): Promise<void>;
9
- removePermission(routeRuleId: number, permissionId: number): Promise<void>;
10
- }