@nocobase/server 2.2.0-beta.10 → 2.2.0-beta.12
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.
|
@@ -49,6 +49,7 @@ export declare class AppSupervisor extends EventEmitter implements AsyncEmitter
|
|
|
49
49
|
private commandAdapterName;
|
|
50
50
|
private appDbCreator;
|
|
51
51
|
private appConditions;
|
|
52
|
+
private appManifests;
|
|
52
53
|
private appSsoIssuer?;
|
|
53
54
|
appOptionsFactory: AppOptionsFactory;
|
|
54
55
|
private environmentHeartbeatInterval;
|
|
@@ -117,6 +118,8 @@ export declare class AppSupervisor extends EventEmitter implements AsyncEmitter
|
|
|
117
118
|
removeAppManifest(appName: string, namespace: string): Promise<void>;
|
|
118
119
|
getAppManifestItems<T = unknown>(appName: string, namespace: string): Promise<T[]>;
|
|
119
120
|
getAppManifests<T = unknown>(namespace: string, appNames: string[]): Promise<Record<string, T[]>>;
|
|
121
|
+
private getAppManifestKey;
|
|
122
|
+
private getOrCreateAppManifest;
|
|
120
123
|
registerAppCondition(name: string, condition: AppCondition): void;
|
|
121
124
|
unregisterAppCondition(name: string): void;
|
|
122
125
|
getAppCondition(name: string): AppCondition;
|
|
@@ -70,6 +70,7 @@ const _AppSupervisor = class _AppSupervisor extends import_events.EventEmitter {
|
|
|
70
70
|
commandAdapterName;
|
|
71
71
|
appDbCreator = new import_condition_registry.ConditionalRegistry();
|
|
72
72
|
appConditions = /* @__PURE__ */ new Map();
|
|
73
|
+
appManifests = /* @__PURE__ */ new Map();
|
|
73
74
|
appSsoIssuer;
|
|
74
75
|
appOptionsFactory = import_app_options_factory.appOptionsFactory;
|
|
75
76
|
environmentHeartbeatInterval = 2 * 60 * 1e3;
|
|
@@ -284,6 +285,7 @@ const _AppSupervisor = class _AppSupervisor extends import_events.EventEmitter {
|
|
|
284
285
|
await this.processAdapter.removeAllApps();
|
|
285
286
|
await ((_b = (_a = this.discoveryAdapter).dispose) == null ? void 0 : _b.call(_a));
|
|
286
287
|
await ((_d = (_c = this.commandAdapter) == null ? void 0 : _c.dispose) == null ? void 0 : _d.call(_c));
|
|
288
|
+
this.appManifests.clear();
|
|
287
289
|
if (this.environmentHeartbeatTimer) {
|
|
288
290
|
this.environmentHeartbeatTimer = null;
|
|
289
291
|
}
|
|
@@ -436,28 +438,31 @@ const _AppSupervisor = class _AppSupervisor extends import_events.EventEmitter {
|
|
|
436
438
|
return this.discoveryAdapter.listAppModels();
|
|
437
439
|
}
|
|
438
440
|
async setAppManifestItem(appName, namespace, itemKey, item) {
|
|
439
|
-
if (typeof this.discoveryAdapter.setAppManifestItem
|
|
440
|
-
return;
|
|
441
|
+
if (typeof this.discoveryAdapter.setAppManifestItem === "function") {
|
|
442
|
+
return this.discoveryAdapter.setAppManifestItem(appName, namespace, itemKey, item);
|
|
441
443
|
}
|
|
442
|
-
|
|
444
|
+
const manifest = this.getOrCreateAppManifest(appName, namespace);
|
|
445
|
+
manifest.set(itemKey, item);
|
|
443
446
|
}
|
|
444
447
|
async removeAppManifestItem(appName, namespace, itemKey) {
|
|
445
|
-
|
|
446
|
-
|
|
448
|
+
var _a;
|
|
449
|
+
if (typeof this.discoveryAdapter.removeAppManifestItem === "function") {
|
|
450
|
+
return this.discoveryAdapter.removeAppManifestItem(appName, namespace, itemKey);
|
|
447
451
|
}
|
|
448
|
-
|
|
452
|
+
(_a = this.appManifests.get(this.getAppManifestKey(appName, namespace))) == null ? void 0 : _a.delete(itemKey);
|
|
449
453
|
}
|
|
450
454
|
async removeAppManifest(appName, namespace) {
|
|
451
|
-
if (typeof this.discoveryAdapter.removeAppManifest
|
|
452
|
-
return;
|
|
455
|
+
if (typeof this.discoveryAdapter.removeAppManifest === "function") {
|
|
456
|
+
return this.discoveryAdapter.removeAppManifest(appName, namespace);
|
|
453
457
|
}
|
|
454
|
-
|
|
458
|
+
this.appManifests.delete(this.getAppManifestKey(appName, namespace));
|
|
455
459
|
}
|
|
456
460
|
async getAppManifestItems(appName, namespace) {
|
|
457
|
-
|
|
458
|
-
|
|
461
|
+
var _a;
|
|
462
|
+
if (typeof this.discoveryAdapter.getAppManifestItems === "function") {
|
|
463
|
+
return this.discoveryAdapter.getAppManifestItems(appName, namespace);
|
|
459
464
|
}
|
|
460
|
-
return this.
|
|
465
|
+
return Array.from(((_a = this.appManifests.get(this.getAppManifestKey(appName, namespace))) == null ? void 0 : _a.values()) || []);
|
|
461
466
|
}
|
|
462
467
|
async getAppManifests(namespace, appNames) {
|
|
463
468
|
if (typeof this.discoveryAdapter.getAppManifests === "function") {
|
|
@@ -474,6 +479,19 @@ const _AppSupervisor = class _AppSupervisor extends import_events.EventEmitter {
|
|
|
474
479
|
);
|
|
475
480
|
return result;
|
|
476
481
|
}
|
|
482
|
+
getAppManifestKey(appName, namespace) {
|
|
483
|
+
return `${namespace}:${appName}`;
|
|
484
|
+
}
|
|
485
|
+
getOrCreateAppManifest(appName, namespace) {
|
|
486
|
+
const key = this.getAppManifestKey(appName, namespace);
|
|
487
|
+
const manifest = this.appManifests.get(key);
|
|
488
|
+
if (manifest) {
|
|
489
|
+
return manifest;
|
|
490
|
+
}
|
|
491
|
+
const nextManifest = /* @__PURE__ */ new Map();
|
|
492
|
+
this.appManifests.set(key, nextManifest);
|
|
493
|
+
return nextManifest;
|
|
494
|
+
}
|
|
477
495
|
registerAppCondition(name, condition) {
|
|
478
496
|
this.appConditions.set(name, condition);
|
|
479
497
|
}
|
|
@@ -16,18 +16,12 @@ export declare class MainOnlyAdapter implements AppDiscoveryAdapter, AppProcessA
|
|
|
16
16
|
apps: Record<string, Application>;
|
|
17
17
|
status: AppStatus;
|
|
18
18
|
appErrors: Record<string, Error>;
|
|
19
|
-
private readonly appManifests;
|
|
20
19
|
constructor(supervisor: AppSupervisor);
|
|
21
20
|
getApp(appName: string, options?: GetAppOptions): Promise<Application<import("../application").DefaultState, import("../application").DefaultContext>>;
|
|
22
21
|
bootstrapApp(appName: string): Promise<void>;
|
|
23
22
|
addApp(app: Application): Application<import("../application").DefaultState, import("../application").DefaultContext>;
|
|
24
23
|
getApps(): Application<import("../application").DefaultState, import("../application").DefaultContext>[];
|
|
25
24
|
listAppModels(): Promise<any[]>;
|
|
26
|
-
setAppManifestItem(appName: string, namespace: string, itemKey: string, item: unknown): Promise<void>;
|
|
27
|
-
removeAppManifestItem(appName: string, namespace: string, itemKey: string): Promise<void>;
|
|
28
|
-
removeAppManifest(appName: string, namespace: string): Promise<void>;
|
|
29
|
-
getAppManifestItems<T = unknown>(appName: string, namespace: string): Promise<T[]>;
|
|
30
|
-
getAppManifests<T = unknown>(namespace: string, appNames: string[]): Promise<Record<string, T[]>>;
|
|
31
25
|
hasApp(appName: string): boolean;
|
|
32
26
|
startApp(appName: string): Promise<void>;
|
|
33
27
|
stopApp(appName: string): Promise<void>;
|
|
@@ -44,6 +38,4 @@ export declare class MainOnlyAdapter implements AppDiscoveryAdapter, AppProcessA
|
|
|
44
38
|
clearAppError(appName: string): void;
|
|
45
39
|
setAppLastSeenAt(): void;
|
|
46
40
|
getAppLastSeenAt(appName: string): any;
|
|
47
|
-
private getAppManifestKey;
|
|
48
|
-
private getOrCreateAppManifest;
|
|
49
41
|
}
|
|
@@ -39,7 +39,6 @@ const _MainOnlyAdapter = class _MainOnlyAdapter {
|
|
|
39
39
|
apps = {};
|
|
40
40
|
status;
|
|
41
41
|
appErrors = {};
|
|
42
|
-
appManifests = /* @__PURE__ */ new Map();
|
|
43
42
|
async getApp(appName, options = {}) {
|
|
44
43
|
if (appName !== "main") {
|
|
45
44
|
this.supervisor.logger.warn(`only main app is supported`, { method: "getApp", appName });
|
|
@@ -82,31 +81,6 @@ const _MainOnlyAdapter = class _MainOnlyAdapter {
|
|
|
82
81
|
async listAppModels() {
|
|
83
82
|
return [];
|
|
84
83
|
}
|
|
85
|
-
async setAppManifestItem(appName, namespace, itemKey, item) {
|
|
86
|
-
const manifest = this.getOrCreateAppManifest(appName, namespace);
|
|
87
|
-
manifest.set(itemKey, item);
|
|
88
|
-
}
|
|
89
|
-
async removeAppManifestItem(appName, namespace, itemKey) {
|
|
90
|
-
var _a;
|
|
91
|
-
(_a = this.appManifests.get(this.getAppManifestKey(appName, namespace))) == null ? void 0 : _a.delete(itemKey);
|
|
92
|
-
}
|
|
93
|
-
async removeAppManifest(appName, namespace) {
|
|
94
|
-
this.appManifests.delete(this.getAppManifestKey(appName, namespace));
|
|
95
|
-
}
|
|
96
|
-
async getAppManifestItems(appName, namespace) {
|
|
97
|
-
var _a;
|
|
98
|
-
return Array.from(((_a = this.appManifests.get(this.getAppManifestKey(appName, namespace))) == null ? void 0 : _a.values()) || []);
|
|
99
|
-
}
|
|
100
|
-
async getAppManifests(namespace, appNames) {
|
|
101
|
-
const result = {};
|
|
102
|
-
for (const appName of appNames) {
|
|
103
|
-
const data = await this.getAppManifestItems(appName, namespace);
|
|
104
|
-
if (data.length > 0) {
|
|
105
|
-
result[appName] = data;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
84
|
hasApp(appName) {
|
|
111
85
|
if (appName !== "main") {
|
|
112
86
|
return false;
|
|
@@ -188,19 +162,6 @@ const _MainOnlyAdapter = class _MainOnlyAdapter {
|
|
|
188
162
|
getAppLastSeenAt(appName) {
|
|
189
163
|
return null;
|
|
190
164
|
}
|
|
191
|
-
getAppManifestKey(appName, namespace) {
|
|
192
|
-
return `${namespace}:${appName}`;
|
|
193
|
-
}
|
|
194
|
-
getOrCreateAppManifest(appName, namespace) {
|
|
195
|
-
const key = this.getAppManifestKey(appName, namespace);
|
|
196
|
-
const manifest = this.appManifests.get(key);
|
|
197
|
-
if (manifest) {
|
|
198
|
-
return manifest;
|
|
199
|
-
}
|
|
200
|
-
const nextManifest = /* @__PURE__ */ new Map();
|
|
201
|
-
this.appManifests.set(key, nextManifest);
|
|
202
|
-
return nextManifest;
|
|
203
|
-
}
|
|
204
165
|
};
|
|
205
166
|
__name(_MainOnlyAdapter, "MainOnlyAdapter");
|
|
206
167
|
let MainOnlyAdapter = _MainOnlyAdapter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/server",
|
|
3
|
-
"version": "2.2.0-beta.
|
|
3
|
+
"version": "2.2.0-beta.12",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,21 +10,21 @@
|
|
|
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.2.0-beta.
|
|
14
|
-
"@nocobase/actions": "2.2.0-beta.
|
|
15
|
-
"@nocobase/ai": "2.2.0-beta.
|
|
16
|
-
"@nocobase/auth": "2.2.0-beta.
|
|
17
|
-
"@nocobase/cache": "2.2.0-beta.
|
|
18
|
-
"@nocobase/data-source-manager": "2.2.0-beta.
|
|
19
|
-
"@nocobase/database": "2.2.0-beta.
|
|
20
|
-
"@nocobase/evaluators": "2.2.0-beta.
|
|
21
|
-
"@nocobase/lock-manager": "2.2.0-beta.
|
|
22
|
-
"@nocobase/logger": "2.2.0-beta.
|
|
23
|
-
"@nocobase/resourcer": "2.2.0-beta.
|
|
24
|
-
"@nocobase/sdk": "2.2.0-beta.
|
|
25
|
-
"@nocobase/snowflake-id": "2.2.0-beta.
|
|
26
|
-
"@nocobase/telemetry": "2.2.0-beta.
|
|
27
|
-
"@nocobase/utils": "2.2.0-beta.
|
|
13
|
+
"@nocobase/acl": "2.2.0-beta.12",
|
|
14
|
+
"@nocobase/actions": "2.2.0-beta.12",
|
|
15
|
+
"@nocobase/ai": "2.2.0-beta.12",
|
|
16
|
+
"@nocobase/auth": "2.2.0-beta.12",
|
|
17
|
+
"@nocobase/cache": "2.2.0-beta.12",
|
|
18
|
+
"@nocobase/data-source-manager": "2.2.0-beta.12",
|
|
19
|
+
"@nocobase/database": "2.2.0-beta.12",
|
|
20
|
+
"@nocobase/evaluators": "2.2.0-beta.12",
|
|
21
|
+
"@nocobase/lock-manager": "2.2.0-beta.12",
|
|
22
|
+
"@nocobase/logger": "2.2.0-beta.12",
|
|
23
|
+
"@nocobase/resourcer": "2.2.0-beta.12",
|
|
24
|
+
"@nocobase/sdk": "2.2.0-beta.12",
|
|
25
|
+
"@nocobase/snowflake-id": "2.2.0-beta.12",
|
|
26
|
+
"@nocobase/telemetry": "2.2.0-beta.12",
|
|
27
|
+
"@nocobase/utils": "2.2.0-beta.12",
|
|
28
28
|
"@types/decompress": "4.2.7",
|
|
29
29
|
"@types/ini": "^1.3.31",
|
|
30
30
|
"@types/koa-send": "^4.1.3",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"@types/serve-handler": "^6.1.1",
|
|
62
62
|
"@types/ws": "^8.5.5"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "ad8ed32d47eaec2dc56f15999934f720787d5070"
|
|
65
65
|
}
|