@nocobase/server 2.0.0-alpha.20 → 2.0.0-alpha.21
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 +2 -2
- package/lib/application.js +10 -4
- package/lib/locale/locale.js +1 -1
- package/lib/locale/resource.js +6 -9
- package/package.json +16 -16
package/lib/application.d.ts
CHANGED
|
@@ -33,11 +33,11 @@ import { PubSubManager, PubSubManagerOptions } from './pub-sub-manager';
|
|
|
33
33
|
import { SyncMessageManager } from './sync-message-manager';
|
|
34
34
|
import AesEncryptor from './aes-encryptor';
|
|
35
35
|
import { AuditManager } from './audit-manager';
|
|
36
|
+
import { BackgroundJobManager, BackgroundJobManagerOptions } from './background-job-manager';
|
|
36
37
|
import { Environment } from './environment';
|
|
37
|
-
import { ServiceContainer } from './service-container';
|
|
38
38
|
import { EventQueue, EventQueueOptions } from './event-queue';
|
|
39
|
-
import { BackgroundJobManager, BackgroundJobManagerOptions } from './background-job-manager';
|
|
40
39
|
import { RedisConfig, RedisConnectionManager } from './redis-connection-manager';
|
|
40
|
+
import { ServiceContainer } from './service-container';
|
|
41
41
|
import { WorkerIdAllocator } from './worker-id-allocator';
|
|
42
42
|
export type PluginType = string | typeof Plugin;
|
|
43
43
|
export type PluginConfiguration = PluginType | [PluginType, any];
|
package/lib/application.js
CHANGED
|
@@ -50,8 +50,8 @@ var import_database = __toESM(require("@nocobase/database"));
|
|
|
50
50
|
var import_logger = require("@nocobase/logger");
|
|
51
51
|
var import_telemetry = require("@nocobase/telemetry");
|
|
52
52
|
var import_lock_manager = require("@nocobase/lock-manager");
|
|
53
|
-
var import_utils = require("@nocobase/utils");
|
|
54
53
|
var import_snowflake_id = require("@nocobase/snowflake-id");
|
|
54
|
+
var import_utils = require("@nocobase/utils");
|
|
55
55
|
var import_crypto = require("crypto");
|
|
56
56
|
var import_glob = __toESM(require("glob"));
|
|
57
57
|
var import_koa = __toESM(require("koa"));
|
|
@@ -80,13 +80,13 @@ var import_package = __toESM(require("../package.json"));
|
|
|
80
80
|
var import_available_action = require("./acl/available-action");
|
|
81
81
|
var import_aes_encryptor = __toESM(require("./aes-encryptor"));
|
|
82
82
|
var import_audit_manager = require("./audit-manager");
|
|
83
|
+
var import_background_job_manager = require("./background-job-manager");
|
|
83
84
|
var import_environment = require("./environment");
|
|
84
|
-
var import_service_container = require("./service-container");
|
|
85
85
|
var import_event_queue = require("./event-queue");
|
|
86
|
-
var import_background_job_manager = require("./background-job-manager");
|
|
87
86
|
var import_redis_connection_manager = require("./redis-connection-manager");
|
|
88
|
-
var
|
|
87
|
+
var import_service_container = require("./service-container");
|
|
89
88
|
var import_snowflake_id_field = require("./snowflake-id-field");
|
|
89
|
+
var import_worker_id_allocator = require("./worker-id-allocator");
|
|
90
90
|
const _Application = class _Application extends import_koa.default {
|
|
91
91
|
constructor(options) {
|
|
92
92
|
super();
|
|
@@ -777,6 +777,12 @@ const _Application = class _Application extends import_koa.default {
|
|
|
777
777
|
}
|
|
778
778
|
async upgrade(options = {}) {
|
|
779
779
|
this.log.info("upgrading...");
|
|
780
|
+
const pkgVersion = this.getPackageVersion();
|
|
781
|
+
const appVersion = await this.version.get();
|
|
782
|
+
if (process.env.SKIP_SAME_VERSION_UPGRADE === "true" && pkgVersion === appVersion) {
|
|
783
|
+
this.log.info(`app is already the latest version (${appVersion})`);
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
780
786
|
await this.reInit();
|
|
781
787
|
const migrator1 = await this.loadCoreMigrations();
|
|
782
788
|
await migrator1.beforeLoad.up();
|
package/lib/locale/locale.js
CHANGED
|
@@ -138,7 +138,7 @@ const _Locale = class _Locale {
|
|
|
138
138
|
if (!packageName) {
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
|
-
const res = (0, import_resource.getResource)(packageName, lang);
|
|
141
|
+
const res = await (0, import_resource.getResource)(packageName, lang);
|
|
142
142
|
if (res) {
|
|
143
143
|
resources[packageName] = { ...res };
|
|
144
144
|
if (packageName.includes(import__.OFFICIAL_PLUGIN_PREFIX)) {
|
package/lib/locale/resource.js
CHANGED
|
@@ -40,7 +40,7 @@ __export(resource_exports, {
|
|
|
40
40
|
getResource: () => getResource
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(resource_exports);
|
|
43
|
-
var
|
|
43
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
44
44
|
const arr2obj = /* @__PURE__ */ __name((items) => {
|
|
45
45
|
const obj = {};
|
|
46
46
|
for (const item of items) {
|
|
@@ -48,7 +48,7 @@ const arr2obj = /* @__PURE__ */ __name((items) => {
|
|
|
48
48
|
}
|
|
49
49
|
return obj;
|
|
50
50
|
}, "arr2obj");
|
|
51
|
-
const getResource = /* @__PURE__ */ __name((packageName, lang, isPlugin = true) => {
|
|
51
|
+
const getResource = /* @__PURE__ */ __name(async (packageName, lang, isPlugin = true) => {
|
|
52
52
|
const resources = [];
|
|
53
53
|
const prefixes = [isPlugin ? "dist" : "lib"];
|
|
54
54
|
if (process.env.APP_ENV !== "production") {
|
|
@@ -70,13 +70,10 @@ const getResource = /* @__PURE__ */ __name((packageName, lang, isPlugin = true)
|
|
|
70
70
|
}
|
|
71
71
|
for (const prefix of prefixes) {
|
|
72
72
|
try {
|
|
73
|
-
const file = `${packageName}/${prefix}/locale/${lang}`;
|
|
73
|
+
const file = `${packageName}/${prefix}/locale/${lang}.json`;
|
|
74
74
|
const f = require.resolve(file);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
const resource = (0, import_utils.requireModule)(file);
|
|
79
|
-
resources.push(resource);
|
|
75
|
+
const resource = await import_promises.default.readFile(f, "utf8");
|
|
76
|
+
resources.push(JSON.parse(resource));
|
|
80
77
|
} catch (error) {
|
|
81
78
|
}
|
|
82
79
|
if (resources.length) {
|
|
@@ -84,7 +81,7 @@ const getResource = /* @__PURE__ */ __name((packageName, lang, isPlugin = true)
|
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
83
|
if (resources.length === 0 && lang.replace("-", "_") !== lang) {
|
|
87
|
-
return getResource(packageName, lang.replace("-", "_"));
|
|
84
|
+
return await getResource(packageName, lang.replace("-", "_"));
|
|
88
85
|
}
|
|
89
86
|
return arr2obj(resources);
|
|
90
87
|
}, "getResource");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/server",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.21",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -10,20 +10,20 @@
|
|
|
10
10
|
"@koa/cors": "^5.0.0",
|
|
11
11
|
"@koa/multer": "^3.1.0",
|
|
12
12
|
"@koa/router": "^13.1.0",
|
|
13
|
-
"@nocobase/acl": "2.0.0-alpha.
|
|
14
|
-
"@nocobase/actions": "2.0.0-alpha.
|
|
15
|
-
"@nocobase/auth": "2.0.0-alpha.
|
|
16
|
-
"@nocobase/cache": "2.0.0-alpha.
|
|
17
|
-
"@nocobase/data-source-manager": "2.0.0-alpha.
|
|
18
|
-
"@nocobase/database": "2.0.0-alpha.
|
|
19
|
-
"@nocobase/evaluators": "2.0.0-alpha.
|
|
20
|
-
"@nocobase/lock-manager": "2.0.0-alpha.
|
|
21
|
-
"@nocobase/logger": "2.0.0-alpha.
|
|
22
|
-
"@nocobase/resourcer": "2.0.0-alpha.
|
|
23
|
-
"@nocobase/sdk": "2.0.0-alpha.
|
|
24
|
-
"@nocobase/snowflake-id": "2.0.0-alpha.
|
|
25
|
-
"@nocobase/telemetry": "2.0.0-alpha.
|
|
26
|
-
"@nocobase/utils": "2.0.0-alpha.
|
|
13
|
+
"@nocobase/acl": "2.0.0-alpha.21",
|
|
14
|
+
"@nocobase/actions": "2.0.0-alpha.21",
|
|
15
|
+
"@nocobase/auth": "2.0.0-alpha.21",
|
|
16
|
+
"@nocobase/cache": "2.0.0-alpha.21",
|
|
17
|
+
"@nocobase/data-source-manager": "2.0.0-alpha.21",
|
|
18
|
+
"@nocobase/database": "2.0.0-alpha.21",
|
|
19
|
+
"@nocobase/evaluators": "2.0.0-alpha.21",
|
|
20
|
+
"@nocobase/lock-manager": "2.0.0-alpha.21",
|
|
21
|
+
"@nocobase/logger": "2.0.0-alpha.21",
|
|
22
|
+
"@nocobase/resourcer": "2.0.0-alpha.21",
|
|
23
|
+
"@nocobase/sdk": "2.0.0-alpha.21",
|
|
24
|
+
"@nocobase/snowflake-id": "2.0.0-alpha.21",
|
|
25
|
+
"@nocobase/telemetry": "2.0.0-alpha.21",
|
|
26
|
+
"@nocobase/utils": "2.0.0-alpha.21",
|
|
27
27
|
"@types/decompress": "4.2.7",
|
|
28
28
|
"@types/ini": "^1.3.31",
|
|
29
29
|
"@types/koa-send": "^4.1.3",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"@types/serve-handler": "^6.1.1",
|
|
60
60
|
"@types/ws": "^8.5.5"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "0398c85e979d09e834952e71c5c1a1ccf1a3a8e1"
|
|
63
63
|
}
|