@nocobase/plugin-client 2.2.0-beta.8 → 2.2.0-beta.9

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.
@@ -10,13 +10,13 @@
10
10
  module.exports = {
11
11
  "react": "18.2.0",
12
12
  "react-i18next": "11.18.6",
13
- "@nocobase/client": "2.2.0-beta.8",
13
+ "@nocobase/client": "2.2.0-beta.9",
14
14
  "antd": "5.24.2",
15
15
  "@ant-design/icons": "5.6.1",
16
16
  "@formily/react": "2.3.7",
17
- "@nocobase/utils": "2.2.0-beta.8",
17
+ "@nocobase/utils": "2.2.0-beta.9",
18
18
  "lodash": "4.18.1",
19
- "@nocobase/database": "2.2.0-beta.8",
20
- "@nocobase/client-v2": "2.2.0-beta.8",
21
- "@nocobase/server": "2.2.0-beta.8"
19
+ "@nocobase/database": "2.2.0-beta.9",
20
+ "@nocobase/client-v2": "2.2.0-beta.9",
21
+ "@nocobase/server": "2.2.0-beta.9"
22
22
  };
@@ -907,6 +907,7 @@
907
907
  "No blocks to connect": "No blocks to connect",
908
908
  "No camera device detected": "No camera device detected",
909
909
  "No configuration available.": "No configuration available.",
910
+ "No configured entries": "No configured entries",
910
911
  "No available data currently": "No available data currently",
911
912
  "No data": "No data",
912
913
  "No event flows": "No event flows",
@@ -905,6 +905,7 @@
905
905
  "No blocks to connect": "没有可连接的区块",
906
906
  "No camera device detected": "未检测到摄像头设备",
907
907
  "No configuration available.": "无可配置项。",
908
+ "No configured entries": "未配置入口",
908
909
  "No available data currently": "当前无可用数据",
909
910
  "No data": "暂无数据",
910
911
  "No event flows": "暂无事件流",
@@ -1 +1 @@
1
- {"name":"cronstrue","title":"cRonstrue","version":"2.47.0","description":"Convert cron expressions into human readable descriptions","author":"Brady Holt","license":"MIT","bugs":{"url":"https://github.com/bradymholt/cronstrue/issues"},"homepage":"https://github.com/bradymholt/cronstrue","keywords":["cron","cronjob","crontab","schedule","parser","cron expression","cron description","pretty cron","cron for humans","cron translated","cron english","cron schedule","cron english","cron schedule"],"main":"dist/cronstrue.js","bin":{"cronstrue":"bin/cli.js"},"typings":"dist/cronstrue.d.ts","files":["dist/","locales/","i18n.js","i18n.d.ts"],"repository":{"type":"git","url":"git+https://github.com/bradymholt/cronstrue.git"},"publishConfig":{"access":"public"},"prettier":{"printWidth":120},"devDependencies":{"@types/chai":"^4.2.11","@types/mocha":"^8.0.0","chai":"^4.2.0","handlebars":"^4.7.6","marked":"^4.0.10","mocha":"^10.1.0","pixl-xml":"^1.0.13","prettier":"^2.1.1","terser-webpack-plugin":"^5.3.1","ts-loader":"^9.2.6","ts-node":"^10.5.0","typescript":"^4.6.2","webpack":"^5.69.1","webpack-cli":"^4.9.2","xml2js":"^0.5.0"},"scripts":{"start":"npm run build","build":"npx tsc -p ./src --emitDeclarationOnly","test":"npx mocha --reporter spec --require ts-node/register \"./test/**/*.ts\"","prepublishOnly":"rm -rf ./dist && ./node_modules/webpack-cli/bin/cli.js && git add -A"},"dependencies":{},"_lastModified":"2026-06-29T01:53:22.941Z"}
1
+ {"name":"cronstrue","title":"cRonstrue","version":"2.47.0","description":"Convert cron expressions into human readable descriptions","author":"Brady Holt","license":"MIT","bugs":{"url":"https://github.com/bradymholt/cronstrue/issues"},"homepage":"https://github.com/bradymholt/cronstrue","keywords":["cron","cronjob","crontab","schedule","parser","cron expression","cron description","pretty cron","cron for humans","cron translated","cron english","cron schedule","cron english","cron schedule"],"main":"dist/cronstrue.js","bin":{"cronstrue":"bin/cli.js"},"typings":"dist/cronstrue.d.ts","files":["dist/","locales/","i18n.js","i18n.d.ts"],"repository":{"type":"git","url":"git+https://github.com/bradymholt/cronstrue.git"},"publishConfig":{"access":"public"},"prettier":{"printWidth":120},"devDependencies":{"@types/chai":"^4.2.11","@types/mocha":"^8.0.0","chai":"^4.2.0","handlebars":"^4.7.6","marked":"^4.0.10","mocha":"^10.1.0","pixl-xml":"^1.0.13","prettier":"^2.1.1","terser-webpack-plugin":"^5.3.1","ts-loader":"^9.2.6","ts-node":"^10.5.0","typescript":"^4.6.2","webpack":"^5.69.1","webpack-cli":"^4.9.2","xml2js":"^0.5.0"},"scripts":{"start":"npm run build","build":"npx tsc -p ./src --emitDeclarationOnly","test":"npx mocha --reporter spec --require ts-node/register \"./test/**/*.ts\"","prepublishOnly":"rm -rf ./dist && ./node_modules/webpack-cli/bin/cli.js && git add -A"},"dependencies":{},"_lastModified":"2026-07-06T02:55:10.251Z"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { AppStatus } from '@nocobase/server';
10
+ export type AppPortalAppStatus = AppStatus | Record<string, AppStatus> | null;
11
+ export type AppPortalAppItem = {
12
+ name: string;
13
+ title?: string | null;
14
+ icon?: string | null;
15
+ cname?: string | null;
16
+ ssoEnabled?: boolean;
17
+ target?: string;
18
+ status?: AppPortalAppStatus;
19
+ };
20
+ export type AppPortalItem = {
21
+ uid?: string | null;
22
+ appName: string;
23
+ title?: string | null;
24
+ icon?: string | null;
25
+ routePath: string;
26
+ layout?: string | null;
27
+ defaultPortal?: boolean;
28
+ };
29
+ export type StoredAppPortalItem = Omit<AppPortalItem, 'appName' | 'defaultPortal'>;
30
+ export declare function listAppPortals(currentAppName?: string | null): Promise<{
31
+ apps: AppPortalAppItem[];
32
+ portals: AppPortalItem[];
33
+ }>;
@@ -0,0 +1,168 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var appPortals_exports = {};
28
+ __export(appPortals_exports, {
29
+ listAppPortals: () => listAppPortals
30
+ });
31
+ module.exports = __toCommonJS(appPortals_exports);
32
+ var import_server = require("@nocobase/server");
33
+ const MAIN_APP_NAME = "main";
34
+ const MULTI_PORTAL_MANIFEST_NAMESPACE = "multi-portal";
35
+ const DEFAULT_PORTALS = [
36
+ {
37
+ uid: "__default_admin__",
38
+ title: "Admin",
39
+ icon: "DesktopOutlined",
40
+ routePath: "/admin",
41
+ layout: "desktop",
42
+ defaultPortal: true
43
+ },
44
+ {
45
+ uid: "__default_mobile__",
46
+ title: "Mobile",
47
+ icon: "MobileOutlined",
48
+ routePath: "/mobile",
49
+ layout: "mobile",
50
+ defaultPortal: true
51
+ }
52
+ ];
53
+ function getCname(cname) {
54
+ const trimmed = cname == null ? void 0 : cname.trim();
55
+ return trimmed || null;
56
+ }
57
+ function getAppName(appModel) {
58
+ return typeof appModel.name === "string" && appModel.name ? appModel.name : null;
59
+ }
60
+ function getAppStatus(appName, statuses) {
61
+ return statuses[appName] ?? null;
62
+ }
63
+ function shouldUseCnameVisitUrl(options) {
64
+ const { cname, ssoEnabled, ssoCnameEnabled } = options;
65
+ return Boolean(cname && (!ssoEnabled || ssoCnameEnabled));
66
+ }
67
+ function toAppPortalAppItem(appModel, appSsoIssuer, target) {
68
+ var _a, _b, _c, _d;
69
+ const name = getAppName(appModel);
70
+ if (!name || name === MAIN_APP_NAME) {
71
+ return null;
72
+ }
73
+ const cname = getCname(appModel.cname);
74
+ const ssoEnabled = ((_b = (_a = appModel.options) == null ? void 0 : _a.sso) == null ? void 0 : _b.enabled) === true;
75
+ const ssoCnameEnabled = Boolean(((_d = (_c = appModel.options) == null ? void 0 : _c.sso) == null ? void 0 : _d.issuer) || appSsoIssuer);
76
+ return {
77
+ name,
78
+ title: appModel.title || name,
79
+ icon: appModel.icon || null,
80
+ cname: shouldUseCnameVisitUrl({ cname, ssoEnabled, ssoCnameEnabled }) ? cname : null,
81
+ ssoEnabled,
82
+ target
83
+ };
84
+ }
85
+ function getPortalKey(item) {
86
+ return item.uid ? `${item.appName}:${item.uid}` : `${item.appName}:${item.routePath}`;
87
+ }
88
+ function addPortal(portals, item) {
89
+ if (!item.appName || !item.routePath) {
90
+ return;
91
+ }
92
+ portals.set(getPortalKey(item), item);
93
+ }
94
+ function addDefaultPortals(portals, appNames) {
95
+ for (const appName of appNames) {
96
+ for (const portal of DEFAULT_PORTALS) {
97
+ addPortal(portals, {
98
+ ...portal,
99
+ appName
100
+ });
101
+ }
102
+ }
103
+ }
104
+ function addStoredPortals(portals, appName, storedPortals) {
105
+ if (!Array.isArray(storedPortals)) {
106
+ return;
107
+ }
108
+ for (const portal of storedPortals) {
109
+ if (!portal || typeof portal.routePath !== "string" || !portal.routePath) {
110
+ continue;
111
+ }
112
+ addPortal(portals, {
113
+ uid: typeof portal.uid === "string" ? portal.uid : null,
114
+ appName,
115
+ title: typeof portal.title === "string" ? portal.title : null,
116
+ icon: typeof portal.icon === "string" ? portal.icon : null,
117
+ routePath: portal.routePath,
118
+ layout: typeof portal.layout === "string" ? portal.layout : null
119
+ });
120
+ }
121
+ }
122
+ async function listAppPortals(currentAppName) {
123
+ const supervisor = import_server.AppSupervisor.getInstance();
124
+ const appModels = await supervisor.listAppModels();
125
+ const apps = /* @__PURE__ */ new Map();
126
+ const appNames = /* @__PURE__ */ new Set([MAIN_APP_NAME]);
127
+ const target = currentAppName === MAIN_APP_NAME ? "_blank" : void 0;
128
+ const appSsoIssuer = supervisor.getAppSsoIssuer();
129
+ const appItems = appModels.map((appModel) => toAppPortalAppItem(appModel, appSsoIssuer, target));
130
+ if (currentAppName) {
131
+ appNames.add(currentAppName);
132
+ }
133
+ for (const app of appItems) {
134
+ if (!app) {
135
+ continue;
136
+ }
137
+ apps.set(app.name, app);
138
+ appNames.add(app.name);
139
+ }
140
+ if (appNames.size > 1 && !apps.has(MAIN_APP_NAME)) {
141
+ apps.set(MAIN_APP_NAME, {
142
+ name: MAIN_APP_NAME,
143
+ title: "Main",
144
+ icon: null
145
+ });
146
+ }
147
+ const appStatuses = await supervisor.getAppsStatuses(Array.from(appNames));
148
+ for (const app of apps.values()) {
149
+ app.status = getAppStatus(app.name, appStatuses);
150
+ }
151
+ const manifests = await supervisor.getAppManifests(
152
+ MULTI_PORTAL_MANIFEST_NAMESPACE,
153
+ Array.from(appNames)
154
+ );
155
+ const portals = /* @__PURE__ */ new Map();
156
+ addDefaultPortals(portals, appNames);
157
+ for (const appName of appNames) {
158
+ addStoredPortals(portals, appName, manifests[appName]);
159
+ }
160
+ return {
161
+ apps: [...apps.values()],
162
+ portals: [...portals.values()]
163
+ };
164
+ }
165
+ // Annotate the CommonJS export names for ESM import in node:
166
+ 0 && (module.exports = {
167
+ listAppPortals
168
+ });
@@ -45,6 +45,7 @@ var import_utils = require("@nocobase/utils");
45
45
  var import_lodash = __toESM(require("lodash"));
46
46
  var process = __toESM(require("node:process"));
47
47
  var import_path = require("path");
48
+ var import_appPortals = require("./appPortals");
48
49
  var import_antd = require("./antd");
49
50
  var import_cron = require("./cron");
50
51
  var import_cronstrue = require("./cronstrue");
@@ -80,6 +81,7 @@ class PluginClientServer extends import_server.Plugin {
80
81
  });
81
82
  this.app.acl.allow("app", "getLang");
82
83
  this.app.acl.allow("app", "getInfo");
84
+ this.app.acl.allow("app", "getPortals", "loggedIn");
83
85
  this.app.acl.registerSnippet({
84
86
  name: "app",
85
87
  actions: ["app:restart", "app:refresh", "app:clearCache", "app:publishEvent"]
@@ -128,6 +130,11 @@ class PluginClientServer extends import_server.Plugin {
128
130
  };
129
131
  await next();
130
132
  },
133
+ getPortals: async (ctx, next) => {
134
+ var _a;
135
+ ctx.body = await (0, import_appPortals.listAppPortals)((_a = ctx.app) == null ? void 0 : _a.name);
136
+ await next();
137
+ },
131
138
  async clearCache(ctx, next) {
132
139
  await ctx.cache.reset();
133
140
  await next();
@@ -153,7 +160,7 @@ class PluginClientServer extends import_server.Plugin {
153
160
  }
154
161
  const { id, username } = ((_c = ctx.auth) == null ? void 0 : _c.user) ?? {};
155
162
  const user = id ? { id, username } : void 0;
156
- const eventName = `${command}@${plugin}`;
163
+ const eventName = `${command.replaceAll(":", ".")}.${plugin}`;
157
164
  try {
158
165
  await ctx.app.eventQueue.publish(eventName, {
159
166
  plugin,
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Provides a client interface for the NocoBase server",
7
7
  "description.ru-RU": "Предоставляет клиентский интерфейс для сервера NocoBase",
8
8
  "description.zh-CN": "为 NocoBase 服务端提供客户端界面",
9
- "version": "2.2.0-beta.8",
9
+ "version": "2.2.0-beta.9",
10
10
  "main": "./dist/server/index.js",
11
11
  "license": "Apache-2.0",
12
12
  "devDependencies": {
@@ -23,5 +23,5 @@
23
23
  "@nocobase/test": "2.x",
24
24
  "@nocobase/utils": "2.x"
25
25
  },
26
- "gitHead": "fa2502c1e9faf6d74b3f51b42dbc6546638d46af"
26
+ "gitHead": "60e3d7abbaa0c7cead76f71a4f3d5eedb6b8acdb"
27
27
  }