@nocobase/server 1.2.13-alpha → 1.3.0-alpha.20240710084543
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/package.json +14 -14
- package/lib/acl/available-action.d.ts +0 -13
- package/lib/acl/available-action.js +0 -71
- package/lib/acl/index.d.ts +0 -10
- package/lib/acl/index.js +0 -46
- package/lib/app-command.d.ts +0 -20
- package/lib/app-command.js +0 -82
- package/lib/app-supervisor.d.ts +0 -69
- package/lib/app-supervisor.js +0 -302
- package/lib/application.d.ts +0 -345
- package/lib/application.js +0 -876
- package/lib/cache/index.d.ts +0 -11
- package/lib/cache/index.js +0 -44
- package/lib/commands/console.d.ts +0 -11
- package/lib/commands/console.js +0 -48
- package/lib/commands/create-migration.d.ts +0 -11
- package/lib/commands/create-migration.js +0 -79
- package/lib/commands/db-auth.d.ts +0 -11
- package/lib/commands/db-auth.js +0 -38
- package/lib/commands/db-clean.d.ts +0 -11
- package/lib/commands/db-clean.js +0 -41
- package/lib/commands/db-sync.d.ts +0 -11
- package/lib/commands/db-sync.js +0 -50
- package/lib/commands/destroy.d.ts +0 -11
- package/lib/commands/destroy.js +0 -40
- package/lib/commands/index.d.ts +0 -10
- package/lib/commands/index.js +0 -82
- package/lib/commands/install.d.ts +0 -11
- package/lib/commands/install.js +0 -43
- package/lib/commands/migrator.d.ts +0 -11
- package/lib/commands/migrator.js +0 -41
- package/lib/commands/pm.d.ts +0 -11
- package/lib/commands/pm.js +0 -98
- package/lib/commands/refresh.d.ts +0 -11
- package/lib/commands/refresh.js +0 -41
- package/lib/commands/restart.d.ts +0 -11
- package/lib/commands/restart.js +0 -45
- package/lib/commands/start.d.ts +0 -11
- package/lib/commands/start.js +0 -85
- package/lib/commands/stop.d.ts +0 -11
- package/lib/commands/stop.js +0 -44
- package/lib/commands/upgrade.d.ts +0 -14
- package/lib/commands/upgrade.js +0 -39
- package/lib/cron/cron-job-manager.d.ts +0 -22
- package/lib/cron/cron-job-manager.js +0 -82
- package/lib/errors/application-not-install.d.ts +0 -12
- package/lib/errors/application-not-install.js +0 -45
- package/lib/errors/handler.d.ts +0 -11
- package/lib/errors/handler.js +0 -50
- package/lib/errors/plugin-command-error.d.ts +0 -10
- package/lib/errors/plugin-command-error.js +0 -40
- package/lib/errors/plugin-not-exist.d.ts +0 -10
- package/lib/errors/plugin-not-exist.js +0 -40
- package/lib/gateway/errors.d.ts +0 -30
- package/lib/gateway/errors.js +0 -154
- package/lib/gateway/index.d.ts +0 -79
- package/lib/gateway/index.js +0 -393
- package/lib/gateway/ipc-socket-client.d.ts +0 -27
- package/lib/gateway/ipc-socket-client.js +0 -110
- package/lib/gateway/ipc-socket-server.d.ts +0 -21
- package/lib/gateway/ipc-socket-server.js +0 -150
- package/lib/gateway/ws-server.d.ts +0 -36
- package/lib/gateway/ws-server.js +0 -196
- package/lib/helper.d.ts +0 -18
- package/lib/helper.js +0 -193
- package/lib/helpers/application-version.d.ts +0 -18
- package/lib/helpers/application-version.js +0 -88
- package/lib/index.d.ts +0 -17
- package/lib/index.js +0 -64
- package/lib/locale/index.d.ts +0 -9
- package/lib/locale/index.js +0 -30
- package/lib/locale/locale.d.ts +0 -38
- package/lib/locale/locale.js +0 -174
- package/lib/locale/resource.d.ts +0 -9
- package/lib/locale/resource.js +0 -87
- package/lib/main-data-source.d.ts +0 -12
- package/lib/main-data-source.js +0 -57
- package/lib/middlewares/data-template.d.ts +0 -10
- package/lib/middlewares/data-template.js +0 -146
- package/lib/middlewares/data-wrapping.d.ts +0 -11
- package/lib/middlewares/data-wrapping.js +0 -100
- package/lib/middlewares/i18n.d.ts +0 -9
- package/lib/middlewares/i18n.js +0 -53
- package/lib/middlewares/index.d.ts +0 -10
- package/lib/middlewares/index.js +0 -39
- package/lib/middlewares/parse-variables.d.ts +0 -9
- package/lib/middlewares/parse-variables.js +0 -95
- package/lib/middlewares/validate-filter-params.d.ts +0 -9
- package/lib/middlewares/validate-filter-params.js +0 -42
- package/lib/migration.d.ts +0 -20
- package/lib/migration.js +0 -54
- package/lib/migrations/20230912193824-package-name-unique.d.ts +0 -14
- package/lib/migrations/20230912193824-package-name-unique.js +0 -59
- package/lib/migrations/20230912294620-update-pkg.d.ts +0 -14
- package/lib/migrations/20230912294620-update-pkg.js +0 -65
- package/lib/migrations/20240106082756-update-plugins.d.ts +0 -14
- package/lib/migrations/20240106082756-update-plugins.js +0 -51
- package/lib/migrations/20240428235620-rename-plugins.d.ts +0 -14
- package/lib/migrations/20240428235620-rename-plugins.js +0 -49
- package/lib/plugin-manager/clientStaticUtils.d.ts +0 -31
- package/lib/plugin-manager/clientStaticUtils.js +0 -129
- package/lib/plugin-manager/constants.d.ts +0 -15
- package/lib/plugin-manager/constants.js +0 -135
- package/lib/plugin-manager/deps.d.ts +0 -10
- package/lib/plugin-manager/deps.js +0 -83
- package/lib/plugin-manager/index.d.ts +0 -10
- package/lib/plugin-manager/index.js +0 -32
- package/lib/plugin-manager/middleware.d.ts +0 -10
- package/lib/plugin-manager/middleware.js +0 -45
- package/lib/plugin-manager/options/collection.d.ts +0 -10
- package/lib/plugin-manager/options/collection.js +0 -47
- package/lib/plugin-manager/options/resource.d.ts +0 -23
- package/lib/plugin-manager/options/resource.js +0 -186
- package/lib/plugin-manager/plugin-manager-repository.d.ts +0 -36
- package/lib/plugin-manager/plugin-manager-repository.js +0 -158
- package/lib/plugin-manager/plugin-manager.d.ts +0 -206
- package/lib/plugin-manager/plugin-manager.js +0 -1100
- package/lib/plugin-manager/types.d.ts +0 -23
- package/lib/plugin-manager/types.js +0 -24
- package/lib/plugin-manager/utils.d.ts +0 -115
- package/lib/plugin-manager/utils.js +0 -568
- package/lib/plugin.d.ts +0 -99
- package/lib/plugin.js +0 -228
- package/lib/swagger/index.json +0 -1569
package/lib/plugin.js
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
17
|
-
var __export = (target, all) => {
|
|
18
|
-
for (var name in all)
|
|
19
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (let key of __getOwnPropNames(from))
|
|
24
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
-
mod
|
|
36
|
-
));
|
|
37
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
-
var plugin_exports = {};
|
|
39
|
-
__export(plugin_exports, {
|
|
40
|
-
Plugin: () => Plugin,
|
|
41
|
-
default: () => plugin_default
|
|
42
|
-
});
|
|
43
|
-
module.exports = __toCommonJS(plugin_exports);
|
|
44
|
-
var import_utils = require("@nocobase/utils");
|
|
45
|
-
var import_fs = __toESM(require("fs"));
|
|
46
|
-
var import_path = require("path");
|
|
47
|
-
var import_plugin_manager = require("./plugin-manager");
|
|
48
|
-
var import_utils2 = require("./plugin-manager/utils");
|
|
49
|
-
/* istanbul ignore file -- @preserve */
|
|
50
|
-
const _Plugin = class _Plugin {
|
|
51
|
-
options;
|
|
52
|
-
app;
|
|
53
|
-
/**
|
|
54
|
-
* @deprecated
|
|
55
|
-
*/
|
|
56
|
-
model;
|
|
57
|
-
/**
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
state = {};
|
|
61
|
-
/**
|
|
62
|
-
* @internal
|
|
63
|
-
*/
|
|
64
|
-
_sourceDir;
|
|
65
|
-
constructor(app, options) {
|
|
66
|
-
this.app = app;
|
|
67
|
-
this.setOptions(options);
|
|
68
|
-
}
|
|
69
|
-
get log() {
|
|
70
|
-
return this.app.log.child({
|
|
71
|
-
reqId: this.app.context.reqId,
|
|
72
|
-
module: this.name
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
get name() {
|
|
76
|
-
return this.options.name;
|
|
77
|
-
}
|
|
78
|
-
get pm() {
|
|
79
|
-
return this.app.pm;
|
|
80
|
-
}
|
|
81
|
-
get db() {
|
|
82
|
-
return this.app.db;
|
|
83
|
-
}
|
|
84
|
-
get enabled() {
|
|
85
|
-
return this.options.enabled;
|
|
86
|
-
}
|
|
87
|
-
set enabled(value) {
|
|
88
|
-
this.options.enabled = value;
|
|
89
|
-
}
|
|
90
|
-
get installed() {
|
|
91
|
-
return this.options.installed;
|
|
92
|
-
}
|
|
93
|
-
set installed(value) {
|
|
94
|
-
this.options.installed = value;
|
|
95
|
-
}
|
|
96
|
-
get isPreset() {
|
|
97
|
-
return this.options.isPreset;
|
|
98
|
-
}
|
|
99
|
-
getName() {
|
|
100
|
-
return this.options.name;
|
|
101
|
-
}
|
|
102
|
-
createLogger(options) {
|
|
103
|
-
return this.app.createLogger(options);
|
|
104
|
-
}
|
|
105
|
-
afterAdd() {
|
|
106
|
-
}
|
|
107
|
-
beforeLoad() {
|
|
108
|
-
}
|
|
109
|
-
async load() {
|
|
110
|
-
}
|
|
111
|
-
async install(options) {
|
|
112
|
-
}
|
|
113
|
-
async upgrade() {
|
|
114
|
-
}
|
|
115
|
-
async beforeEnable() {
|
|
116
|
-
}
|
|
117
|
-
async afterEnable() {
|
|
118
|
-
}
|
|
119
|
-
async beforeDisable() {
|
|
120
|
-
}
|
|
121
|
-
async afterDisable() {
|
|
122
|
-
}
|
|
123
|
-
async beforeRemove() {
|
|
124
|
-
}
|
|
125
|
-
async afterRemove() {
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* @deprecated
|
|
129
|
-
*/
|
|
130
|
-
async importCollections(collectionsPath) {
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* @internal
|
|
134
|
-
*/
|
|
135
|
-
setOptions(options) {
|
|
136
|
-
this.options = options || {};
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* @internal
|
|
140
|
-
*/
|
|
141
|
-
async loadMigrations() {
|
|
142
|
-
this.app.log.debug(`load plugin migrations [${this.name}]`);
|
|
143
|
-
const basePath = await this.getPluginBasePath();
|
|
144
|
-
if (!basePath) {
|
|
145
|
-
return { beforeLoad: [], afterSync: [], afterLoad: [] };
|
|
146
|
-
}
|
|
147
|
-
const directory = (0, import_path.resolve)(basePath, "server/migrations");
|
|
148
|
-
return await this.app.loadMigrations({
|
|
149
|
-
directory,
|
|
150
|
-
namespace: this.options.packageName,
|
|
151
|
-
context: {
|
|
152
|
-
plugin: this
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
async getPluginBasePath() {
|
|
157
|
-
if (!this.options.packageName) {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
return (0, import_utils2.getPluginBasePath)(this.options.packageName);
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* @internal
|
|
164
|
-
*/
|
|
165
|
-
async loadCollections() {
|
|
166
|
-
const basePath = await this.getPluginBasePath();
|
|
167
|
-
if (!basePath) {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
const directory = (0, import_path.resolve)(basePath, "server/collections");
|
|
171
|
-
if (await (0, import_utils.fsExists)(directory)) {
|
|
172
|
-
await this.db.import({
|
|
173
|
-
directory,
|
|
174
|
-
from: this.options.packageName
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* @deprecated
|
|
180
|
-
*/
|
|
181
|
-
requiredPlugins() {
|
|
182
|
-
return [];
|
|
183
|
-
}
|
|
184
|
-
t(text, options = {}) {
|
|
185
|
-
return this.app.i18n.t(text, { ns: this.options["packageName"], ...options });
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* @experimental
|
|
189
|
-
*/
|
|
190
|
-
async toJSON(options = {}) {
|
|
191
|
-
const { locale = "en-US" } = options;
|
|
192
|
-
const { name, packageName, packageJson } = this.options;
|
|
193
|
-
if (!packageName) {
|
|
194
|
-
return {
|
|
195
|
-
...this.options
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
const results = {
|
|
199
|
-
...this.options,
|
|
200
|
-
keywords: packageJson.keywords,
|
|
201
|
-
readmeUrl: (0, import_plugin_manager.getExposeReadmeUrl)(packageName, locale),
|
|
202
|
-
changelogUrl: (0, import_plugin_manager.getExposeChangelogUrl)(packageName),
|
|
203
|
-
displayName: packageJson[`displayName.${locale}`] || packageJson.displayName || name,
|
|
204
|
-
description: packageJson[`description.${locale}`] || packageJson.description,
|
|
205
|
-
homepage: packageJson[`homepage.${locale}`] || packageJson.homepage
|
|
206
|
-
};
|
|
207
|
-
if (!options.withOutOpenFile) {
|
|
208
|
-
const file = await import_fs.default.promises.realpath(
|
|
209
|
-
(0, import_path.resolve)(process.env.NODE_MODULES_PATH || (0, import_path.resolve)(process.cwd(), "node_modules"), packageName)
|
|
210
|
-
);
|
|
211
|
-
return {
|
|
212
|
-
...results,
|
|
213
|
-
...await (0, import_utils2.checkAndGetCompatible)(packageName),
|
|
214
|
-
lastUpdated: (await import_fs.default.promises.stat(file)).ctime,
|
|
215
|
-
file,
|
|
216
|
-
updatable: file.startsWith(process.env.PLUGIN_STORAGE_PATH)
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
return results;
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
__name(_Plugin, "Plugin");
|
|
223
|
-
let Plugin = _Plugin;
|
|
224
|
-
var plugin_default = Plugin;
|
|
225
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
226
|
-
0 && (module.exports = {
|
|
227
|
-
Plugin
|
|
228
|
-
});
|