@nocobase/server 1.3.44-beta → 1.4.0-alpha.0
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/lib/application.d.ts +13 -9
- package/lib/application.js +46 -19
- package/lib/commands/start.js +9 -6
- package/lib/gateway/index.js +1 -1
- package/lib/helper.js +13 -12
- package/lib/index.d.ts +4 -2
- package/lib/index.js +19 -5
- package/lib/locale/locale.d.ts +1 -0
- package/lib/locale/locale.js +3 -1
- package/lib/middlewares/data-template.d.ts +1 -1
- package/lib/middlewares/data-template.js +3 -2
- package/lib/middlewares/i18n.js +1 -1
- package/lib/middlewares/parse-variables.d.ts +1 -1
- package/lib/middlewares/parse-variables.js +3 -2
- package/lib/plugin-manager/deps.js +2 -2
- package/lib/plugin-manager/findPackageNames.d.ts +16 -0
- package/lib/plugin-manager/findPackageNames.js +183 -0
- package/lib/plugin-manager/options/resource.js +4 -2
- package/lib/plugin-manager/plugin-manager-repository.d.ts +1 -0
- package/lib/plugin-manager/plugin-manager-repository.js +18 -5
- package/lib/plugin-manager/plugin-manager.d.ts +4 -1
- package/lib/plugin-manager/plugin-manager.js +116 -170
- package/lib/run-plugin-static-imports.d.ts +1 -0
- package/lib/run-plugin-static-imports.js +52 -0
- package/package.json +15 -15
package/lib/application.d.ts
CHANGED
|
@@ -149,28 +149,30 @@ export declare class Application<StateT = DefaultState, ContextT = DefaultContex
|
|
|
149
149
|
* @internal
|
|
150
150
|
*/
|
|
151
151
|
perfHistograms: Map<string, RecordableHistogram>;
|
|
152
|
+
/**
|
|
153
|
+
* @internal
|
|
154
|
+
*/
|
|
155
|
+
syncManager: SyncManager;
|
|
156
|
+
requestLogger: Logger;
|
|
152
157
|
protected plugins: Map<string, Plugin<any>>;
|
|
153
158
|
protected _appSupervisor: AppSupervisor;
|
|
154
|
-
protected _started: Date | null;
|
|
155
159
|
private _authenticated;
|
|
156
160
|
private _maintaining;
|
|
157
161
|
private _maintainingCommandStatus;
|
|
158
162
|
private _maintainingStatusBeforeCommand;
|
|
159
163
|
private _actionCommand;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
syncManager: SyncManager;
|
|
164
|
-
requestLogger: Logger;
|
|
164
|
+
constructor(options: ApplicationOptions);
|
|
165
|
+
private static staticCommands;
|
|
166
|
+
static addCommand(callback: (app: Application) => void): void;
|
|
165
167
|
private _sqlLogger;
|
|
168
|
+
get sqlLogger(): Logger;
|
|
166
169
|
protected _logger: SystemLogger;
|
|
167
|
-
|
|
170
|
+
get logger(): SystemLogger;
|
|
171
|
+
protected _started: Date | null;
|
|
168
172
|
/**
|
|
169
173
|
* @experimental
|
|
170
174
|
*/
|
|
171
175
|
get started(): Date;
|
|
172
|
-
get logger(): SystemLogger;
|
|
173
|
-
get sqlLogger(): Logger;
|
|
174
176
|
get log(): SystemLogger;
|
|
175
177
|
protected _loaded: boolean;
|
|
176
178
|
/**
|
|
@@ -243,6 +245,7 @@ export declare class Application<StateT = DefaultState, ContextT = DefaultContex
|
|
|
243
245
|
* @deprecated
|
|
244
246
|
*/
|
|
245
247
|
getVersion(): string;
|
|
248
|
+
getPackageVersion(): string;
|
|
246
249
|
/**
|
|
247
250
|
* This method is deprecated and should not be used.
|
|
248
251
|
* Use {@link #this.pm.addPreset()} instead.
|
|
@@ -278,6 +281,7 @@ export declare class Application<StateT = DefaultState, ContextT = DefaultContex
|
|
|
278
281
|
* @internal
|
|
279
282
|
*/
|
|
280
283
|
reInit(): Promise<void>;
|
|
284
|
+
createCacheManager(): Promise<CacheManager>;
|
|
281
285
|
load(options?: LoadOptions): Promise<void>;
|
|
282
286
|
reload(options?: LoadOptions): Promise<void>;
|
|
283
287
|
/**
|
package/lib/application.js
CHANGED
|
@@ -13,6 +13,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
13
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
14
|
var __getProtoOf = Object.getPrototypeOf;
|
|
15
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16
17
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
17
18
|
var __export = (target, all) => {
|
|
18
19
|
for (var name in all)
|
|
@@ -35,6 +36,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
36
|
mod
|
|
36
37
|
));
|
|
37
38
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
38
40
|
var application_exports = {};
|
|
39
41
|
__export(application_exports, {
|
|
40
42
|
Application: () => Application,
|
|
@@ -107,33 +109,36 @@ const _Application = class _Application extends import_koa.default {
|
|
|
107
109
|
* @internal
|
|
108
110
|
*/
|
|
109
111
|
perfHistograms = /* @__PURE__ */ new Map();
|
|
112
|
+
/**
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
syncManager;
|
|
116
|
+
requestLogger;
|
|
110
117
|
plugins = /* @__PURE__ */ new Map();
|
|
111
118
|
_appSupervisor = import_app_supervisor.AppSupervisor.getInstance();
|
|
112
|
-
_started = null;
|
|
113
119
|
_authenticated = false;
|
|
114
120
|
_maintaining = false;
|
|
115
121
|
_maintainingCommandStatus;
|
|
116
122
|
_maintainingStatusBeforeCommand;
|
|
117
123
|
_actionCommand;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
syncManager;
|
|
122
|
-
requestLogger;
|
|
124
|
+
static addCommand(callback) {
|
|
125
|
+
this.staticCommands.push(callback);
|
|
126
|
+
}
|
|
123
127
|
_sqlLogger;
|
|
128
|
+
get sqlLogger() {
|
|
129
|
+
return this._sqlLogger;
|
|
130
|
+
}
|
|
124
131
|
_logger;
|
|
132
|
+
get logger() {
|
|
133
|
+
return this._logger;
|
|
134
|
+
}
|
|
135
|
+
_started = null;
|
|
125
136
|
/**
|
|
126
137
|
* @experimental
|
|
127
138
|
*/
|
|
128
139
|
get started() {
|
|
129
140
|
return this._started;
|
|
130
141
|
}
|
|
131
|
-
get logger() {
|
|
132
|
-
return this._logger;
|
|
133
|
-
}
|
|
134
|
-
get sqlLogger() {
|
|
135
|
-
return this._sqlLogger;
|
|
136
|
-
}
|
|
137
142
|
get log() {
|
|
138
143
|
return this._logger;
|
|
139
144
|
}
|
|
@@ -272,6 +277,9 @@ const _Application = class _Application extends import_koa.default {
|
|
|
272
277
|
getVersion() {
|
|
273
278
|
return import_package.default.version;
|
|
274
279
|
}
|
|
280
|
+
getPackageVersion() {
|
|
281
|
+
return import_package.default.version;
|
|
282
|
+
}
|
|
275
283
|
/**
|
|
276
284
|
* This method is deprecated and should not be used.
|
|
277
285
|
* Use {@link #this.pm.addPreset()} instead.
|
|
@@ -283,7 +291,7 @@ const _Application = class _Application extends import_koa.default {
|
|
|
283
291
|
}
|
|
284
292
|
// @ts-ignore
|
|
285
293
|
use(middleware, options) {
|
|
286
|
-
this.middleware.add(middleware, options);
|
|
294
|
+
this.middleware.add((0, import_utils.wrapMiddlewareWithLogging)(middleware, this.logger), options);
|
|
287
295
|
return this;
|
|
288
296
|
}
|
|
289
297
|
/**
|
|
@@ -349,6 +357,10 @@ const _Application = class _Application extends import_koa.default {
|
|
|
349
357
|
}
|
|
350
358
|
this._loaded = false;
|
|
351
359
|
}
|
|
360
|
+
async createCacheManager() {
|
|
361
|
+
this._cacheManager = await (0, import_cache2.createCacheManager)(this, this.options.cacheManager);
|
|
362
|
+
return this._cacheManager;
|
|
363
|
+
}
|
|
352
364
|
async load(options) {
|
|
353
365
|
var _a;
|
|
354
366
|
if (this._loaded) {
|
|
@@ -369,7 +381,10 @@ const _Application = class _Application extends import_koa.default {
|
|
|
369
381
|
await oldDb.close();
|
|
370
382
|
}
|
|
371
383
|
}
|
|
372
|
-
|
|
384
|
+
if (this.cacheManager) {
|
|
385
|
+
await this.cacheManager.close();
|
|
386
|
+
}
|
|
387
|
+
this._cacheManager = await this.createCacheManager();
|
|
373
388
|
this.log.debug("init plugins");
|
|
374
389
|
this.setMaintainingMessage("init plugins");
|
|
375
390
|
await this.pm.initPlugins();
|
|
@@ -379,9 +394,11 @@ const _Application = class _Application extends import_koa.default {
|
|
|
379
394
|
if ((options == null ? void 0 : options.hooks) !== false) {
|
|
380
395
|
await this.emitAsync("beforeLoad", this, options);
|
|
381
396
|
}
|
|
382
|
-
this.telemetry.
|
|
383
|
-
|
|
384
|
-
this.telemetry.
|
|
397
|
+
if (!this.telemetry.started) {
|
|
398
|
+
this.telemetry.init();
|
|
399
|
+
if ((_a = this.options.telemetry) == null ? void 0 : _a.enabled) {
|
|
400
|
+
this.telemetry.start();
|
|
401
|
+
}
|
|
385
402
|
}
|
|
386
403
|
await this.pm.load(options);
|
|
387
404
|
if (options == null ? void 0 : options.sync) {
|
|
@@ -661,6 +678,7 @@ const _Application = class _Application extends import_koa.default {
|
|
|
661
678
|
await this.reInit();
|
|
662
679
|
await this.db.sync();
|
|
663
680
|
await this.load({ hooks: false });
|
|
681
|
+
this._loaded = false;
|
|
664
682
|
this.log.debug("emit beforeInstall", { method: "install" });
|
|
665
683
|
this.setMaintainingMessage("call beforeInstall hook...");
|
|
666
684
|
await this.emitAsync("beforeInstall", this, options);
|
|
@@ -844,6 +862,9 @@ const _Application = class _Application extends import_koa.default {
|
|
|
844
862
|
}
|
|
845
863
|
(0, import_commands.registerCli)(this);
|
|
846
864
|
this._version = new import_application_version.ApplicationVersion(this);
|
|
865
|
+
for (const callback of _Application.staticCommands) {
|
|
866
|
+
callback(this);
|
|
867
|
+
}
|
|
847
868
|
}
|
|
848
869
|
createMainDataSource(options) {
|
|
849
870
|
const mainDataSourceInstance = new import_main_data_source.MainDataSource({
|
|
@@ -860,14 +881,19 @@ const _Application = class _Application extends import_koa.default {
|
|
|
860
881
|
this.dataSourceManager.dataSources.set("main", mainDataSourceInstance);
|
|
861
882
|
}
|
|
862
883
|
createDatabase(options) {
|
|
863
|
-
const logging = /* @__PURE__ */ __name((
|
|
884
|
+
const logging = /* @__PURE__ */ __name((...args) => {
|
|
885
|
+
let msg = args[0];
|
|
864
886
|
if (typeof msg === "string") {
|
|
865
887
|
msg = msg.replace(/[\r\n]/gm, "").replace(/\s+/g, " ");
|
|
866
888
|
}
|
|
867
889
|
if (msg.includes("INSERT INTO")) {
|
|
868
890
|
msg = msg.substring(0, 2e3) + "...";
|
|
869
891
|
}
|
|
870
|
-
|
|
892
|
+
const content = { message: msg, app: this.name, reqId: this.context.reqId };
|
|
893
|
+
if (args[1] && typeof args[1] === "number") {
|
|
894
|
+
content.executeTime = args[1];
|
|
895
|
+
}
|
|
896
|
+
this._sqlLogger.debug(content);
|
|
871
897
|
}, "logging");
|
|
872
898
|
const dbOptions = options.database instanceof import_database.default ? options.database.options : options.database;
|
|
873
899
|
const db = new import_database.default({
|
|
@@ -882,6 +908,7 @@ const _Application = class _Application extends import_koa.default {
|
|
|
882
908
|
}
|
|
883
909
|
};
|
|
884
910
|
__name(_Application, "Application");
|
|
911
|
+
__publicField(_Application, "staticCommands", []);
|
|
885
912
|
let Application = _Application;
|
|
886
913
|
(0, import_utils.applyMixins)(Application, [import_utils.AsyncEmitter]);
|
|
887
914
|
var application_default = Application;
|
package/lib/commands/start.js
CHANGED
|
@@ -40,20 +40,23 @@ __export(start_exports, {
|
|
|
40
40
|
default: () => start_default
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(start_exports);
|
|
43
|
-
var
|
|
44
|
-
var import_fs = __toESM(require("fs"));
|
|
43
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
45
44
|
var import_path = require("path");
|
|
46
45
|
var import_application_not_install = require("../errors/application-not-install");
|
|
47
46
|
/* istanbul ignore file -- @preserve */
|
|
48
47
|
var start_default = /* @__PURE__ */ __name((app) => {
|
|
49
48
|
app.command("start").auth().option("--db-sync").option("--quickstart").action(async (...cliArgs) => {
|
|
50
49
|
const [options] = cliArgs;
|
|
51
|
-
const file = (0, import_path.resolve)(process.cwd(), "storage
|
|
52
|
-
const upgrading = await
|
|
50
|
+
const file = (0, import_path.resolve)(process.cwd(), "storage/.upgrading");
|
|
51
|
+
const upgrading = await import_fs_extra.default.exists(file);
|
|
53
52
|
if (upgrading) {
|
|
54
|
-
|
|
53
|
+
if (!process.env.VITEST) {
|
|
54
|
+
if (await app.isInstalled()) {
|
|
55
|
+
await app.upgrade();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
55
58
|
try {
|
|
56
|
-
await
|
|
59
|
+
await import_fs_extra.default.rm(file, { recursive: true, force: true });
|
|
57
60
|
} catch (error) {
|
|
58
61
|
}
|
|
59
62
|
} else if (options.quickstart) {
|
package/lib/gateway/index.js
CHANGED
|
@@ -265,7 +265,7 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
|
|
|
265
265
|
if (!process.env.IS_DEV_CMD) {
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
|
-
const file =
|
|
268
|
+
const file = process.env.WATCH_FILE;
|
|
269
269
|
if (!import_fs.default.existsSync(file)) {
|
|
270
270
|
await import_fs.default.promises.writeFile(file, `export const watchId = '${(0, import_utils.uid)()}';`, "utf-8");
|
|
271
271
|
}
|
package/lib/helper.js
CHANGED
|
@@ -54,14 +54,13 @@ var import_crypto = require("crypto");
|
|
|
54
54
|
var import_fs = __toESM(require("fs"));
|
|
55
55
|
var import_i18next = __toESM(require("i18next"));
|
|
56
56
|
var import_koa_bodyparser = __toESM(require("koa-bodyparser"));
|
|
57
|
-
var import_path = require("path");
|
|
58
57
|
var import_perf_hooks = require("perf_hooks");
|
|
59
58
|
var import_data_wrapping = require("./middlewares/data-wrapping");
|
|
60
59
|
var import_i18n = require("./middlewares/i18n");
|
|
61
60
|
function createI18n(options) {
|
|
62
61
|
const instance = import_i18next.default.createInstance();
|
|
63
62
|
instance.init({
|
|
64
|
-
lng: "en-US",
|
|
63
|
+
lng: process.env.INIT_LANG || "en-US",
|
|
65
64
|
resources: {},
|
|
66
65
|
keySeparator: false,
|
|
67
66
|
nsSeparator: false,
|
|
@@ -76,10 +75,13 @@ function createResourcer(options) {
|
|
|
76
75
|
__name(createResourcer, "createResourcer");
|
|
77
76
|
function registerMiddlewares(app, options) {
|
|
78
77
|
var _a;
|
|
79
|
-
app.use(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
app.use(
|
|
79
|
+
/* @__PURE__ */ __name(async function generateReqId(ctx, next) {
|
|
80
|
+
app.context.reqId = (0, import_crypto.randomUUID)();
|
|
81
|
+
await next();
|
|
82
|
+
}, "generateReqId"),
|
|
83
|
+
{ tag: "generateReqId" }
|
|
84
|
+
);
|
|
83
85
|
app.use((0, import_logger.requestLogger)(app.name, app.requestLogger, (_a = options.logger) == null ? void 0 : _a.request), { tag: "logger" });
|
|
84
86
|
app.use(
|
|
85
87
|
(0, import_cors.default)({
|
|
@@ -106,16 +108,16 @@ function registerMiddlewares(app, options) {
|
|
|
106
108
|
}
|
|
107
109
|
);
|
|
108
110
|
}
|
|
109
|
-
app.use(async (ctx, next)
|
|
111
|
+
app.use(/* @__PURE__ */ __name(async function getBearerToken(ctx, next) {
|
|
110
112
|
ctx.getBearerToken = () => {
|
|
111
113
|
const token = ctx.get("Authorization").replace(/^Bearer\s+/gi, "");
|
|
112
114
|
return token || ctx.query.token;
|
|
113
115
|
};
|
|
114
116
|
await next();
|
|
115
|
-
});
|
|
116
|
-
app.use(import_i18n.i18n, { tag: "i18n",
|
|
117
|
+
}, "getBearerToken"));
|
|
118
|
+
app.use(import_i18n.i18n, { tag: "i18n", before: "cors" });
|
|
117
119
|
if (options.dataWrapping !== false) {
|
|
118
|
-
app.use((0, import_data_wrapping.dataWrapping)(), { tag: "dataWrapping", after: "
|
|
120
|
+
app.use((0, import_data_wrapping.dataWrapping)(), { tag: "dataWrapping", after: "cors" });
|
|
119
121
|
}
|
|
120
122
|
app.use(app.dataSourceManager.middleware(), { tag: "dataSource", after: "dataWrapping" });
|
|
121
123
|
}
|
|
@@ -148,8 +150,7 @@ const getCommandFullName = /* @__PURE__ */ __name((command) => {
|
|
|
148
150
|
}, "getCommandFullName");
|
|
149
151
|
/* istanbul ignore next -- @preserve */
|
|
150
152
|
const tsxRerunning = /* @__PURE__ */ __name(async () => {
|
|
151
|
-
const
|
|
152
|
-
await import_fs.default.promises.writeFile(file, `export const watchId = '${(0, import_utils.uid)()}';`, "utf-8");
|
|
153
|
+
await import_fs.default.promises.writeFile(process.env.WATCH_FILE, `export const watchId = '${(0, import_utils.uid)()}';`, "utf-8");
|
|
153
154
|
}, "tsxRerunning");
|
|
154
155
|
/* istanbul ignore next -- @preserve */
|
|
155
156
|
const enablePerfHooks = /* @__PURE__ */ __name((app) => {
|
package/lib/index.d.ts
CHANGED
|
@@ -6,13 +6,15 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
export * from './app-supervisor';
|
|
9
10
|
export * from './application';
|
|
10
11
|
export { Application as default } from './application';
|
|
12
|
+
export * from './gateway';
|
|
11
13
|
export * as middlewares from './middlewares';
|
|
12
14
|
export * from './migration';
|
|
13
15
|
export * from './plugin';
|
|
14
16
|
export * from './plugin-manager';
|
|
15
|
-
export * from './gateway';
|
|
16
|
-
export * from './app-supervisor';
|
|
17
17
|
export * from './sync-manager';
|
|
18
18
|
export declare const OFFICIAL_PLUGIN_PREFIX = "@nocobase/plugin-";
|
|
19
|
+
export { appendToBuiltInPlugins, findAllPlugins, findBuiltInPlugins, findLocalPlugins, packageNameTrim, } from './plugin-manager/findPackageNames';
|
|
20
|
+
export { runPluginStaticImports } from './run-plugin-static-imports';
|
package/lib/index.js
CHANGED
|
@@ -38,29 +38,43 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
38
38
|
var src_exports = {};
|
|
39
39
|
__export(src_exports, {
|
|
40
40
|
OFFICIAL_PLUGIN_PREFIX: () => OFFICIAL_PLUGIN_PREFIX,
|
|
41
|
+
appendToBuiltInPlugins: () => import_findPackageNames.appendToBuiltInPlugins,
|
|
41
42
|
default: () => import_application.Application,
|
|
42
|
-
|
|
43
|
+
findAllPlugins: () => import_findPackageNames.findAllPlugins,
|
|
44
|
+
findBuiltInPlugins: () => import_findPackageNames.findBuiltInPlugins,
|
|
45
|
+
findLocalPlugins: () => import_findPackageNames.findLocalPlugins,
|
|
46
|
+
middlewares: () => middlewares,
|
|
47
|
+
packageNameTrim: () => import_findPackageNames.packageNameTrim,
|
|
48
|
+
runPluginStaticImports: () => import_run_plugin_static_imports.runPluginStaticImports
|
|
43
49
|
});
|
|
44
50
|
module.exports = __toCommonJS(src_exports);
|
|
51
|
+
__reExport(src_exports, require("./app-supervisor"), module.exports);
|
|
45
52
|
__reExport(src_exports, require("./application"), module.exports);
|
|
46
53
|
var import_application = require("./application");
|
|
54
|
+
__reExport(src_exports, require("./gateway"), module.exports);
|
|
47
55
|
var middlewares = __toESM(require("./middlewares"));
|
|
48
56
|
__reExport(src_exports, require("./migration"), module.exports);
|
|
49
57
|
__reExport(src_exports, require("./plugin"), module.exports);
|
|
50
58
|
__reExport(src_exports, require("./plugin-manager"), module.exports);
|
|
51
|
-
__reExport(src_exports, require("./gateway"), module.exports);
|
|
52
|
-
__reExport(src_exports, require("./app-supervisor"), module.exports);
|
|
53
59
|
__reExport(src_exports, require("./sync-manager"), module.exports);
|
|
60
|
+
var import_findPackageNames = require("./plugin-manager/findPackageNames");
|
|
61
|
+
var import_run_plugin_static_imports = require("./run-plugin-static-imports");
|
|
54
62
|
const OFFICIAL_PLUGIN_PREFIX = "@nocobase/plugin-";
|
|
55
63
|
// Annotate the CommonJS export names for ESM import in node:
|
|
56
64
|
0 && (module.exports = {
|
|
57
65
|
OFFICIAL_PLUGIN_PREFIX,
|
|
66
|
+
appendToBuiltInPlugins,
|
|
67
|
+
findAllPlugins,
|
|
68
|
+
findBuiltInPlugins,
|
|
69
|
+
findLocalPlugins,
|
|
58
70
|
middlewares,
|
|
71
|
+
packageNameTrim,
|
|
72
|
+
runPluginStaticImports,
|
|
73
|
+
...require("./app-supervisor"),
|
|
59
74
|
...require("./application"),
|
|
75
|
+
...require("./gateway"),
|
|
60
76
|
...require("./migration"),
|
|
61
77
|
...require("./plugin"),
|
|
62
78
|
...require("./plugin-manager"),
|
|
63
|
-
...require("./gateway"),
|
|
64
|
-
...require("./app-supervisor"),
|
|
65
79
|
...require("./sync-manager")
|
|
66
80
|
});
|
package/lib/locale/locale.d.ts
CHANGED
package/lib/locale/locale.js
CHANGED
|
@@ -71,7 +71,9 @@ const _Locale = class _Locale {
|
|
|
71
71
|
await this.get(this.defaultLang);
|
|
72
72
|
}
|
|
73
73
|
async reload() {
|
|
74
|
-
|
|
74
|
+
const storers = Array.from(this.resourceStorers.getValues());
|
|
75
|
+
const promises = storers.map((storer) => storer.reset());
|
|
76
|
+
await Promise.all([this.cache.reset(), ...promises]);
|
|
75
77
|
}
|
|
76
78
|
setLocaleFn(name, fn) {
|
|
77
79
|
this.localeFn.set(name, fn);
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { Context } from '@nocobase/actions';
|
|
10
|
-
export declare
|
|
10
|
+
export declare function dataTemplate(ctx: Context, next: any): Promise<void>;
|
|
@@ -30,7 +30,7 @@ __export(data_template_exports, {
|
|
|
30
30
|
dataTemplate: () => dataTemplate
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(data_template_exports);
|
|
33
|
-
|
|
33
|
+
async function dataTemplate(ctx, next) {
|
|
34
34
|
const { resourceName, actionName } = ctx.action;
|
|
35
35
|
const { isTemplate, fields } = ctx.action.params;
|
|
36
36
|
await next();
|
|
@@ -40,7 +40,8 @@ const dataTemplate = /* @__PURE__ */ __name(async (ctx, next) => {
|
|
|
40
40
|
include: fields
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
}
|
|
43
|
+
}
|
|
44
|
+
__name(dataTemplate, "dataTemplate");
|
|
44
45
|
const traverseHasMany = /* @__PURE__ */ __name((arr, { collection, exclude = [], include = [] }) => {
|
|
45
46
|
if (!arr) {
|
|
46
47
|
return arr;
|
package/lib/middlewares/i18n.js
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
export declare
|
|
9
|
+
export declare function parseVariables(ctx: any, next: any): Promise<any>;
|
|
@@ -59,7 +59,7 @@ function isNumeric(str) {
|
|
|
59
59
|
return !isNaN(str) && !isNaN(parseFloat(str));
|
|
60
60
|
}
|
|
61
61
|
__name(isNumeric, "isNumeric");
|
|
62
|
-
|
|
62
|
+
async function parseVariables(ctx, next) {
|
|
63
63
|
const filter = ctx.action.params.filter;
|
|
64
64
|
if (!filter) {
|
|
65
65
|
return next();
|
|
@@ -86,7 +86,8 @@ const parseVariables = /* @__PURE__ */ __name(async (ctx, next) => {
|
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
await next();
|
|
89
|
-
}
|
|
89
|
+
}
|
|
90
|
+
__name(parseVariables, "parseVariables");
|
|
90
91
|
// Annotate the CommonJS export names for ESM import in node:
|
|
91
92
|
0 && (module.exports = {
|
|
92
93
|
parseVariables
|
|
@@ -63,7 +63,7 @@ const deps = {
|
|
|
63
63
|
i18next: "22.x",
|
|
64
64
|
"react-i18next": "11.x",
|
|
65
65
|
"@dnd-kit/accessibility": "3.x",
|
|
66
|
-
"@dnd-kit/core": "
|
|
66
|
+
"@dnd-kit/core": "6.x",
|
|
67
67
|
"@dnd-kit/modifiers": "6.x",
|
|
68
68
|
"@dnd-kit/sortable": "6.x",
|
|
69
69
|
"@dnd-kit/utilities": "3.x",
|
|
@@ -73,7 +73,7 @@ const deps = {
|
|
|
73
73
|
"pg-hstore": "2.x",
|
|
74
74
|
sqlite3: "5.x",
|
|
75
75
|
supertest: "6.x",
|
|
76
|
-
axios: "
|
|
76
|
+
axios: "1.7.x",
|
|
77
77
|
"@emotion/css": "11.x",
|
|
78
78
|
ahooks: "3.x",
|
|
79
79
|
lodash: "4.x",
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
declare function trim(packageNames: string[]): Promise<any[]>;
|
|
10
|
+
export declare function findPackageNames(): Promise<any[]>;
|
|
11
|
+
export declare function findBuiltInPlugins(): Promise<any[]>;
|
|
12
|
+
export declare function findLocalPlugins(): Promise<any[]>;
|
|
13
|
+
export declare function findAllPlugins(): Promise<any[]>;
|
|
14
|
+
export declare const packageNameTrim: typeof trim;
|
|
15
|
+
export declare function appendToBuiltInPlugins(nameOrPkg: string): Promise<void>;
|
|
16
|
+
export {};
|