@nocobase/server 2.0.0-alpha.27 → 2.0.0-alpha.28
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/app-command.d.ts +1 -0
- package/lib/app-command.js +3 -0
- package/lib/application.d.ts +1 -0
- package/lib/application.js +3 -0
- package/lib/commands/pm.js +11 -0
- package/lib/plugin-manager/plugin-manager.d.ts +1 -0
- package/lib/plugin-manager/plugin-manager.js +35 -0
- package/package.json +16 -16
package/lib/app-command.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class AppCommand extends Command {
|
|
|
14
14
|
auth(): this;
|
|
15
15
|
preload(): this;
|
|
16
16
|
hasCommand(name: string): boolean;
|
|
17
|
+
findCommand(name: string): any;
|
|
17
18
|
isHandleByIPCServer(): boolean;
|
|
18
19
|
createCommand(name?: string): AppCommand;
|
|
19
20
|
parseHandleByIPCServer(argv: any, parseOptions?: any): Boolean;
|
package/lib/app-command.js
CHANGED
|
@@ -51,6 +51,9 @@ const _AppCommand = class _AppCommand extends import_commander.Command {
|
|
|
51
51
|
const names = this.commands.map((c) => c.name());
|
|
52
52
|
return names.includes(name);
|
|
53
53
|
}
|
|
54
|
+
findCommand(name) {
|
|
55
|
+
return this._findCommand(name);
|
|
56
|
+
}
|
|
54
57
|
isHandleByIPCServer() {
|
|
55
58
|
return this._handleByIPCServer;
|
|
56
59
|
}
|
package/lib/application.d.ts
CHANGED
|
@@ -193,6 +193,7 @@ export declare class Application<StateT = DefaultState, ContextT = DefaultContex
|
|
|
193
193
|
backgroundJobManager: BackgroundJobManager;
|
|
194
194
|
constructor(options: ApplicationOptions);
|
|
195
195
|
private static staticCommands;
|
|
196
|
+
static registerStaticCommand(callback: (app: Application) => void): void;
|
|
196
197
|
static addCommand(callback: (app: Application) => void): void;
|
|
197
198
|
private _sqlLogger;
|
|
198
199
|
get instanceId(): number;
|
package/lib/application.js
CHANGED
|
@@ -143,6 +143,9 @@ const _Application = class _Application extends import_koa.default {
|
|
|
143
143
|
lockManager;
|
|
144
144
|
eventQueue;
|
|
145
145
|
backgroundJobManager;
|
|
146
|
+
static registerStaticCommand(callback) {
|
|
147
|
+
this.staticCommands.push(callback);
|
|
148
|
+
}
|
|
146
149
|
static addCommand(callback) {
|
|
147
150
|
this.staticCommands.push(callback);
|
|
148
151
|
}
|
package/lib/commands/pm.js
CHANGED
|
@@ -38,6 +38,17 @@ var pm_default = /* @__PURE__ */ __name((app) => {
|
|
|
38
38
|
pm.command("create").argument("plugin").option("--force-recreate").action(async (plugin, options) => {
|
|
39
39
|
await app.pm.create(plugin, options);
|
|
40
40
|
});
|
|
41
|
+
pm.command("pull").arguments("<packageNames...>").option("--registry [registry]").option("--auth-token [authToken]").option("--version [version]").action(async (packageNames, options, cli) => {
|
|
42
|
+
try {
|
|
43
|
+
let name = packageNames;
|
|
44
|
+
if (Array.isArray(packageNames) && packageNames.length === 1) {
|
|
45
|
+
name = packageNames[0];
|
|
46
|
+
}
|
|
47
|
+
await app.pm.pull(name, { ...options });
|
|
48
|
+
} catch (error) {
|
|
49
|
+
throw new import_plugin_command_error.PluginCommandError(`Failed to pull plugin`, { cause: error });
|
|
50
|
+
}
|
|
51
|
+
});
|
|
41
52
|
pm.command("add").ipc().preload().arguments("<packageNames...>").option("--registry [registry]").option("--auth-token [authToken]").option("--version [version]").action(async (packageNames, options, cli) => {
|
|
42
53
|
try {
|
|
43
54
|
let name = packageNames;
|
|
@@ -718,6 +718,41 @@ const _PluginManager = class _PluginManager {
|
|
|
718
718
|
await removeDir();
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
|
+
async pull(urlOrName, options, emitStartedEvent = true) {
|
|
722
|
+
if (Array.isArray(urlOrName)) {
|
|
723
|
+
for (const packageName of urlOrName) {
|
|
724
|
+
await this.addViaCLI(packageName, import_lodash.default.omit(options, "name"), false);
|
|
725
|
+
}
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
if ((0, import_utils.isURL)(urlOrName)) {
|
|
729
|
+
await this.addByCompressedFileUrl(
|
|
730
|
+
{
|
|
731
|
+
...options,
|
|
732
|
+
compressedFileUrl: urlOrName
|
|
733
|
+
},
|
|
734
|
+
emitStartedEvent
|
|
735
|
+
);
|
|
736
|
+
} else if (await import_fs_extra.default.exists(urlOrName)) {
|
|
737
|
+
await this.addByCompressedFileUrl(
|
|
738
|
+
{
|
|
739
|
+
...options,
|
|
740
|
+
compressedFileUrl: urlOrName
|
|
741
|
+
},
|
|
742
|
+
emitStartedEvent
|
|
743
|
+
);
|
|
744
|
+
} else if (options == null ? void 0 : options.registry) {
|
|
745
|
+
const { name, packageName } = await _PluginManager.parseName(urlOrName);
|
|
746
|
+
options["name"] = name;
|
|
747
|
+
await this.addByNpm(
|
|
748
|
+
{
|
|
749
|
+
...options,
|
|
750
|
+
packageName
|
|
751
|
+
},
|
|
752
|
+
emitStartedEvent
|
|
753
|
+
);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
721
756
|
/**
|
|
722
757
|
* @internal
|
|
723
758
|
*/
|
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.28",
|
|
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.28",
|
|
14
|
+
"@nocobase/actions": "2.0.0-alpha.28",
|
|
15
|
+
"@nocobase/auth": "2.0.0-alpha.28",
|
|
16
|
+
"@nocobase/cache": "2.0.0-alpha.28",
|
|
17
|
+
"@nocobase/data-source-manager": "2.0.0-alpha.28",
|
|
18
|
+
"@nocobase/database": "2.0.0-alpha.28",
|
|
19
|
+
"@nocobase/evaluators": "2.0.0-alpha.28",
|
|
20
|
+
"@nocobase/lock-manager": "2.0.0-alpha.28",
|
|
21
|
+
"@nocobase/logger": "2.0.0-alpha.28",
|
|
22
|
+
"@nocobase/resourcer": "2.0.0-alpha.28",
|
|
23
|
+
"@nocobase/sdk": "2.0.0-alpha.28",
|
|
24
|
+
"@nocobase/snowflake-id": "2.0.0-alpha.28",
|
|
25
|
+
"@nocobase/telemetry": "2.0.0-alpha.28",
|
|
26
|
+
"@nocobase/utils": "2.0.0-alpha.28",
|
|
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": "25c2df8f18a912feb35780dc05f8b0594432bc15"
|
|
63
63
|
}
|