@nocobase/plugin-client 0.13.0-alpha.9 → 0.14.0-alpha.2

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.
@@ -1 +1 @@
1
- {"name":"cronstrue","title":"cRonstrue","version":"2.27.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":"2023-09-07T04:57:16.994Z"}
1
+ {"name":"cronstrue","title":"cRonstrue","version":"2.27.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":"2023-09-12T20:05:00.796Z"}
@@ -24,6 +24,12 @@ var import_server = require("@nocobase/server");
24
24
  class admin_ui_schema_uid_default extends import_server.Migration {
25
25
  async up() {
26
26
  var _a, _b, _c;
27
+ await this.db.getCollection("systemSettings").sync({
28
+ force: false,
29
+ alter: {
30
+ drop: false
31
+ }
32
+ });
27
33
  const systemSettings = this.db.getRepository("systemSettings");
28
34
  let instance = await systemSettings.findOne();
29
35
  if ((_a = instance == null ? void 0 : instance.options) == null ? void 0 : _a.adminSchemaUid) {
@@ -31,6 +37,9 @@ class admin_ui_schema_uid_default extends import_server.Migration {
31
37
  }
32
38
  const uiRoutes = this.db.getRepository("uiRoutes");
33
39
  const routes = await uiRoutes.find();
40
+ if (!uiRoutes) {
41
+ return;
42
+ }
34
43
  for (const route of routes) {
35
44
  if (route.uiSchemaUid && ((_b = route == null ? void 0 : route.options) == null ? void 0 : _b.component) === "AdminLayout") {
36
45
  const options = instance.options || {};
@@ -37,46 +37,6 @@ var import_path = require("path");
37
37
  var import_antd = require("./antd");
38
38
  var import_cron = require("./cron");
39
39
  var import_cronstrue = require("./cronstrue");
40
- async function getReadMe(name, locale) {
41
- const packageName = import_server.PluginManager.getPackageName(name);
42
- const dir = (0, import_path.resolve)(process.cwd(), "node_modules", packageName);
43
- const files = [(0, import_path.resolve)(dir, `README.${locale}.md`), (0, import_path.resolve)(dir, `README.md`)];
44
- const file = files.find((file2) => {
45
- return import_fs.default.existsSync(file2);
46
- });
47
- return file ? (await import_fs.default.promises.readFile(file)).toString() : "";
48
- }
49
- async function getTabs(name, locale) {
50
- const packageName = import_server.PluginManager.getPackageName(name);
51
- const dir = (0, import_path.resolve)(process.cwd(), "node_modules", packageName);
52
- const file = (0, import_path.resolve)(dir, "docs", locale, "tabs.json");
53
- if (!import_fs.default.existsSync(file)) {
54
- return [
55
- {
56
- title: "README",
57
- path: "__README__"
58
- }
59
- ];
60
- }
61
- return JSON.parse((await import_fs.default.promises.readFile(file)).toString());
62
- }
63
- async function getTabInfo({ filterByTk, path, locale }) {
64
- const packageName = import_server.PluginManager.getPackageName(filterByTk);
65
- const dir = (0, import_path.resolve)(process.cwd(), "node_modules", packageName);
66
- if (path === "__README__") {
67
- return await getReadMe(filterByTk, locale);
68
- }
69
- const files = [
70
- (0, import_path.resolve)(dir, "docs", locale, `${path}.md`),
71
- // default
72
- (0, import_path.resolve)(dir, "docs", "en-US", `${path}.md`),
73
- (0, import_path.resolve)(dir, "docs", "zh-CN", `${path}.md`)
74
- ];
75
- const file = files.find((file2) => {
76
- return import_fs.default.existsSync(file2);
77
- });
78
- return file ? (await import_fs.default.promises.readFile(file)).toString() : "";
79
- }
80
40
  async function getLang(ctx) {
81
41
  const SystemSetting = ctx.db.getRepository("systemSettings");
82
42
  const systemSetting = await SystemSetting.findOne();
@@ -181,6 +141,7 @@ class ClientPlugin extends import_server.Plugin {
181
141
  },
182
142
  async getPlugins(ctx, next) {
183
143
  const pm = ctx.db.getRepository("applicationPlugins");
144
+ const PLUGIN_CLIENT_ENTRY_FILE = "dist/client/index.js";
184
145
  const items = await pm.find({
185
146
  filter: {
186
147
  enabled: true
@@ -189,11 +150,10 @@ class ClientPlugin extends import_server.Plugin {
189
150
  ctx.body = items.map((item) => {
190
151
  try {
191
152
  const packageName = import_server.PluginManager.getPackageName(item.name);
192
- require.resolve(`${packageName}/client`);
193
153
  return {
194
154
  ...item.toJSON(),
195
155
  packageName,
196
- url: (0, import_server.getPackageClientStaticUrl)(packageName, "index")
156
+ url: (0, import_server.getExposeUrl)(packageName, PLUGIN_CLIENT_ENTRY_FILE)
197
157
  };
198
158
  } catch {
199
159
  return false;
@@ -211,38 +171,6 @@ class ClientPlugin extends import_server.Plugin {
211
171
  }
212
172
  }
213
173
  });
214
- this.app.resource({
215
- name: "plugins",
216
- actions: {
217
- async getInfo(ctx, next) {
218
- const lang = await getLang(ctx);
219
- const { filterByTk } = ctx.action.params;
220
- ctx.body = {
221
- filterByTk,
222
- readMe: await getReadMe(filterByTk, lang)
223
- };
224
- await next();
225
- },
226
- async getTabs(ctx, next) {
227
- const lang = await getLang(ctx);
228
- const { filterByTk } = ctx.action.params;
229
- ctx.body = {
230
- filterByTk,
231
- tabs: await getTabs(filterByTk, lang)
232
- };
233
- await next();
234
- },
235
- async getTabInfo(ctx, next) {
236
- const locale = await getLang(ctx);
237
- const { filterByTk } = ctx.action.params;
238
- ctx.body = {
239
- filterByTk,
240
- content: await getTabInfo({ ...ctx.action.params, locale })
241
- };
242
- await next();
243
- }
244
- }
245
- });
246
174
  }
247
175
  }
248
176
  var server_default = ClientPlugin;
package/package.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@nocobase/plugin-client",
3
3
  "displayName": "WEB client",
4
4
  "displayName.zh-CN": "WEB 客户端",
5
- "description": "",
6
- "description.zh-CN": "",
7
- "version": "0.13.0-alpha.9",
5
+ "description": "Provides a client interface for the NocoBase server",
6
+ "description.zh-CN": "为 NocoBase 服务端提供客户端界面",
7
+ "version": "0.14.0-alpha.2",
8
8
  "main": "./dist/server/index.js",
9
9
  "license": "AGPL-3.0",
10
10
  "devDependencies": {
@@ -20,5 +20,5 @@
20
20
  "@nocobase/test": "0.x",
21
21
  "@nocobase/utils": "0.x"
22
22
  },
23
- "gitHead": "ee5825377d8bec05f968a8365a0cdcd49878ada6"
23
+ "gitHead": "ea841d4a1e8c37aa77b4fbae6a6a4937e2aa3c0a"
24
24
  }