@fluxo-dev/api-client-base 0.0.26 → 0.0.28

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
@@ -1761,6 +1761,12 @@ class FluxoStateDispatcher {
1761
1761
  static dispatchSetCurrentFrontend(frontend) {
1762
1762
  state.store.dispatch(state.setCurrentFrontend(frontend));
1763
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
+ }
1764
1770
  }
1765
1771
 
1766
1772
  class AuthService {
@@ -2050,9 +2056,6 @@ class PermissionService {
2050
2056
  deletePermissionScope(scope, packageName, namespace) {
2051
2057
  return HttpClient.Instance().client.delete(`identity/permissions/scopes/${scope}/${packageName}/${namespace}`);
2052
2058
  }
2053
- installPermissions(data) {
2054
- return HttpClient.Instance().client.post('apps/permissions/install', data);
2055
- }
2056
2059
  createCustomPermission(data) {
2057
2060
  return HttpClient.Instance().client.post('identity/permissions/custom', data);
2058
2061
  }
@@ -2164,34 +2167,34 @@ class KorebiFacade {
2164
2167
 
2165
2168
  class AppService {
2166
2169
  getApps(onlyDeployed) {
2167
- const url = onlyDeployed ? 'apps?onlyDeployed=true' : 'apps';
2170
+ const url = onlyDeployed ? 'module?onlyDeployed=true' : 'apps';
2168
2171
  return HttpClient.Instance().client.get(url);
2169
2172
  }
2170
2173
  activateApp(appId) {
2171
- return HttpClient.Instance().client.post(`apps/${appId}/activate`, {});
2174
+ return HttpClient.Instance().client.post(`module/${appId}/activate`, {});
2172
2175
  }
2173
2176
  deactivateApp(appId) {
2174
- return HttpClient.Instance().client.post(`apps/${appId}/deactivate`, {});
2177
+ return HttpClient.Instance().client.post(`module/${appId}/deactivate`, {});
2175
2178
  }
2176
2179
  installApp(data) {
2177
- return HttpClient.Instance().client.post(`apps/install`, data, {
2180
+ return HttpClient.Instance().client.post(`module/install`, data, {
2178
2181
  headers: {
2179
2182
  "Content-Type": "multipart/form-data"
2180
2183
  }
2181
2184
  });
2182
2185
  }
2183
2186
  upgradeApp(appId, data) {
2184
- return HttpClient.Instance().client.post(`apps/${appId}/upgrade`, data, {
2187
+ return HttpClient.Instance().client.post(`module/${appId}/upgrade`, data, {
2185
2188
  headers: {
2186
2189
  "Content-Type": "multipart/form-data"
2187
2190
  }
2188
2191
  });
2189
2192
  }
2190
2193
  uninstallApp(appId) {
2191
- return HttpClient.Instance().client.delete(`apps/${appId}/uninstall`);
2194
+ return HttpClient.Instance().client.delete(`module/${appId}/uninstall`);
2192
2195
  }
2193
2196
  installEmbeddedModule(data) {
2194
- return HttpClient.Instance().client.post(`apps/install/embedded`, data);
2197
+ return HttpClient.Instance().client.post(`module/install/embedded`, data);
2195
2198
  }
2196
2199
  }
2197
2200
 
@@ -2432,6 +2435,12 @@ class EmbeddedModule {
2432
2435
  }
2433
2436
  constructor(name, description, author, version, scope) {
2434
2437
  this._navigation = [];
2438
+ this.getFullyQualifiedRoute = (route, parent = undefined) => {
2439
+ const r1 = "/" + this.scope + "/" + this.name + "/";
2440
+ const r2 = r1 + `${parent && parent !== '/' ? parent + '/' : ''}`;
2441
+ const r3 = r2 + `${route.route && route.route !== '/' ? route.route : ''}`;
2442
+ return r3;
2443
+ };
2435
2444
  this._name = name;
2436
2445
  this._description = description;
2437
2446
  this._author = author;
@@ -2441,6 +2450,23 @@ class EmbeddedModule {
2441
2450
  attachNavigation(navigationConfig) {
2442
2451
  this._navigation.push(navigationConfig);
2443
2452
  }
2453
+ // Generate dictionary of routes recursively
2454
+ getRouteMap(routes = undefined, parent = undefined) {
2455
+ const r = routes !== null && routes !== void 0 ? routes : this._navigation.map(a => a.routes).map(a => a).flat();
2456
+ if (!r || r.length === 0) return {};
2457
+ const routeMap = {};
2458
+ r.map(route => {
2459
+ if (route.route) {
2460
+ routeMap[this.getFullyQualifiedRoute(route, parent)] = {
2461
+ title: route.title
2462
+ };
2463
+ if (route.routes && route.routes.length > 0) {
2464
+ Object.assign(routeMap, this.getRouteMap(route.routes, route.route));
2465
+ }
2466
+ }
2467
+ });
2468
+ return routeMap;
2469
+ }
2444
2470
  getRouteObject(routes = undefined) {
2445
2471
  const r = routes !== null && routes !== void 0 ? routes : this._navigation.map(a => a.routes).map(a => a).flat();
2446
2472
  if (!r || r.length === 0) return [];
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@fluxo-dev/api-client-base",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
- "@fluxo-dev/state": "0.0.26"
6
+ "@fluxo-dev/state": "0.0.28"
7
7
  },
8
8
  "main": "./index.cjs.js"
9
9
  }
@@ -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
  }
@@ -22,4 +22,10 @@ export declare class FluxoStateDispatcher {
22
22
  name: string;
23
23
  }[]): void;
24
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;
25
31
  }
@@ -1,4 +1,3 @@
1
- import { InstallPermissionCommand } from "./install-permission-command";
2
1
  import { Permission } from "./permission";
3
2
  import { CreatePermissionScopeCommand } from "./create-permission-scope-command";
4
3
  import { PermissionScope } from "./permission-scope";
@@ -8,7 +7,6 @@ export declare class PermissionService {
8
7
  getPermissionsInScope(scope: string, packageName: string, namespace: string): Promise<Permission[]>;
9
8
  createPermissionScope(data: CreatePermissionScopeCommand): Promise<void>;
10
9
  deletePermissionScope(scope: string, packageName: string, namespace: string): Promise<void>;
11
- installPermissions(data: InstallPermissionCommand): Promise<void>;
12
10
  createCustomPermission(data: CreateCustomPermissionCommand): Promise<void>;
13
11
  deleteCustomPermission(permissionId: number): Promise<void>;
14
12
  }