@nocobase/server 1.6.0-alpha.5 → 1.6.0-alpha.7
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.
|
@@ -260,6 +260,8 @@ const _AuditManager = class _AuditManager {
|
|
|
260
260
|
const auditLog = this.formatAuditData(ctx);
|
|
261
261
|
auditLog.uuid = reqId;
|
|
262
262
|
auditLog.status = ctx.status;
|
|
263
|
+
const defaultMetaData = await this.getDefaultMetaData(ctx);
|
|
264
|
+
auditLog.metadata = { ...metadata, ...defaultMetaData };
|
|
263
265
|
if (typeof action !== "string") {
|
|
264
266
|
if (action.getUserInfo) {
|
|
265
267
|
const userInfo = await action.getUserInfo(ctx);
|
|
@@ -274,10 +276,15 @@ const _AuditManager = class _AuditManager {
|
|
|
274
276
|
}
|
|
275
277
|
if (action.getMetaData) {
|
|
276
278
|
const extra = await action.getMetaData(ctx);
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
279
|
+
if (extra) {
|
|
280
|
+
if (extra.request) {
|
|
281
|
+
auditLog.metadata.request = { ...auditLog.metadata.request, ...extra.request };
|
|
282
|
+
}
|
|
283
|
+
if (extra.response) {
|
|
284
|
+
auditLog.metadata.response = { ...auditLog.metadata.response, ...extra.response };
|
|
285
|
+
}
|
|
286
|
+
auditLog.metadata = { ...extra, ...auditLog.metadata };
|
|
287
|
+
}
|
|
281
288
|
}
|
|
282
289
|
if (action.getSourceAndTarget) {
|
|
283
290
|
const sourceAndTarget = await action.getSourceAndTarget(ctx);
|
|
@@ -288,9 +295,6 @@ const _AuditManager = class _AuditManager {
|
|
|
288
295
|
auditLog.targetRecordUK = sourceAndTarget.targetRecordUK;
|
|
289
296
|
}
|
|
290
297
|
}
|
|
291
|
-
} else {
|
|
292
|
-
const defaultMetaData = await this.getDefaultMetaData(ctx);
|
|
293
|
-
auditLog.metadata = { ...metadata, ...defaultMetaData };
|
|
294
298
|
}
|
|
295
299
|
this.logger.log(auditLog);
|
|
296
300
|
} catch (err) {
|
|
@@ -32,12 +32,12 @@ __export(data_template_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(data_template_exports);
|
|
33
33
|
async function dataTemplate(ctx, next) {
|
|
34
34
|
const { resourceName, actionName } = ctx.action;
|
|
35
|
-
const { isTemplate, fields } = ctx.action.params;
|
|
35
|
+
const { isTemplate, fields, appends } = ctx.action.params;
|
|
36
36
|
await next();
|
|
37
|
-
if (isTemplate && actionName === "get"
|
|
37
|
+
if (isTemplate && actionName === "get") {
|
|
38
38
|
ctx.body = traverseJSON(JSON.parse(JSON.stringify(ctx.body)), {
|
|
39
|
-
collection: ctx.
|
|
40
|
-
include: fields
|
|
39
|
+
collection: ctx.getCurrentRepository().collection,
|
|
40
|
+
include: [...fields || [], ...appends || []]
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -101,7 +101,7 @@ const traverseJSON = /* @__PURE__ */ __name((data, options) => {
|
|
|
101
101
|
result[key] = data[key];
|
|
102
102
|
continue;
|
|
103
103
|
}
|
|
104
|
-
if (field.options.primaryKey && excludePk) {
|
|
104
|
+
if (field.options.primaryKey && excludePk && !collection.isMultiFilterTargetKey()) {
|
|
105
105
|
continue;
|
|
106
106
|
}
|
|
107
107
|
if (field.options.isForeignKey) {
|
|
@@ -67,7 +67,7 @@ export declare class PluginManager {
|
|
|
67
67
|
/**
|
|
68
68
|
* @internal
|
|
69
69
|
*/
|
|
70
|
-
static getPackageName(name: string): Promise<
|
|
70
|
+
static getPackageName(name: string): Promise<any>;
|
|
71
71
|
/**
|
|
72
72
|
* @internal
|
|
73
73
|
*/
|
|
@@ -75,7 +75,7 @@ export declare class PluginManager {
|
|
|
75
75
|
/**
|
|
76
76
|
* @internal
|
|
77
77
|
*/
|
|
78
|
-
static findPackage(name: string): Promise<
|
|
78
|
+
static findPackage(name: string): Promise<any>;
|
|
79
79
|
/**
|
|
80
80
|
* @internal
|
|
81
81
|
*/
|
|
@@ -139,15 +139,12 @@ const _PluginManager = class _PluginManager {
|
|
|
139
139
|
* @internal
|
|
140
140
|
*/
|
|
141
141
|
static async getPackageName(name) {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (exists) {
|
|
147
|
-
return `${prefix}${name}`;
|
|
148
|
-
}
|
|
142
|
+
const { packageName } = await this.parseName(name);
|
|
143
|
+
const packageFile = (0, import_path.resolve)(process.env.NODE_MODULES_PATH, packageName, "package.json");
|
|
144
|
+
if (!await import_fs_extra.default.exists(packageFile)) {
|
|
145
|
+
return null;
|
|
149
146
|
}
|
|
150
|
-
|
|
147
|
+
return packageName;
|
|
151
148
|
}
|
|
152
149
|
/**
|
|
153
150
|
* @internal
|
|
@@ -312,7 +309,9 @@ const _PluginManager = class _PluginManager {
|
|
|
312
309
|
try {
|
|
313
310
|
if (typeof plugin === "string" && options.name && !options.packageName) {
|
|
314
311
|
const packageName = await _PluginManager.getPackageName(options.name);
|
|
315
|
-
|
|
312
|
+
if (packageName) {
|
|
313
|
+
options["packageName"] = packageName;
|
|
314
|
+
}
|
|
316
315
|
}
|
|
317
316
|
if (options.packageName) {
|
|
318
317
|
const packageJson = await _PluginManager.getPackageJson(options.packageName);
|
|
@@ -320,12 +319,14 @@ const _PluginManager = class _PluginManager {
|
|
|
320
319
|
options["version"] = packageJson.version;
|
|
321
320
|
}
|
|
322
321
|
} catch (error) {
|
|
322
|
+
this.app.log.error(error);
|
|
323
323
|
console.error(error);
|
|
324
324
|
}
|
|
325
|
-
this.app.log.trace(`
|
|
325
|
+
this.app.log.trace(`adding plugin [${options.name}]`, {
|
|
326
326
|
method: "add",
|
|
327
327
|
submodule: "plugin-manager",
|
|
328
|
-
name: options.name
|
|
328
|
+
name: options.name,
|
|
329
|
+
options
|
|
329
330
|
});
|
|
330
331
|
let P;
|
|
331
332
|
try {
|
|
@@ -343,6 +344,12 @@ const _PluginManager = class _PluginManager {
|
|
|
343
344
|
this.pluginAliases.set(options.packageName, instance);
|
|
344
345
|
}
|
|
345
346
|
await instance.afterAdd();
|
|
347
|
+
this.app.log.trace(`added plugin [${options.name}]`, {
|
|
348
|
+
method: "add",
|
|
349
|
+
submodule: "plugin-manager",
|
|
350
|
+
name: instance.name,
|
|
351
|
+
options: instance.options
|
|
352
|
+
});
|
|
346
353
|
}
|
|
347
354
|
/**
|
|
348
355
|
* @internal
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/server",
|
|
3
|
-
"version": "1.6.0-alpha.
|
|
3
|
+
"version": "1.6.0-alpha.7",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -10,19 +10,19 @@
|
|
|
10
10
|
"@koa/cors": "^3.1.0",
|
|
11
11
|
"@koa/multer": "^3.0.2",
|
|
12
12
|
"@koa/router": "^9.4.0",
|
|
13
|
-
"@nocobase/acl": "1.6.0-alpha.
|
|
14
|
-
"@nocobase/actions": "1.6.0-alpha.
|
|
15
|
-
"@nocobase/auth": "1.6.0-alpha.
|
|
16
|
-
"@nocobase/cache": "1.6.0-alpha.
|
|
17
|
-
"@nocobase/data-source-manager": "1.6.0-alpha.
|
|
18
|
-
"@nocobase/database": "1.6.0-alpha.
|
|
19
|
-
"@nocobase/evaluators": "1.6.0-alpha.
|
|
20
|
-
"@nocobase/lock-manager": "1.6.0-alpha.
|
|
21
|
-
"@nocobase/logger": "1.6.0-alpha.
|
|
22
|
-
"@nocobase/resourcer": "1.6.0-alpha.
|
|
23
|
-
"@nocobase/sdk": "1.6.0-alpha.
|
|
24
|
-
"@nocobase/telemetry": "1.6.0-alpha.
|
|
25
|
-
"@nocobase/utils": "1.6.0-alpha.
|
|
13
|
+
"@nocobase/acl": "1.6.0-alpha.7",
|
|
14
|
+
"@nocobase/actions": "1.6.0-alpha.7",
|
|
15
|
+
"@nocobase/auth": "1.6.0-alpha.7",
|
|
16
|
+
"@nocobase/cache": "1.6.0-alpha.7",
|
|
17
|
+
"@nocobase/data-source-manager": "1.6.0-alpha.7",
|
|
18
|
+
"@nocobase/database": "1.6.0-alpha.7",
|
|
19
|
+
"@nocobase/evaluators": "1.6.0-alpha.7",
|
|
20
|
+
"@nocobase/lock-manager": "1.6.0-alpha.7",
|
|
21
|
+
"@nocobase/logger": "1.6.0-alpha.7",
|
|
22
|
+
"@nocobase/resourcer": "1.6.0-alpha.7",
|
|
23
|
+
"@nocobase/sdk": "1.6.0-alpha.7",
|
|
24
|
+
"@nocobase/telemetry": "1.6.0-alpha.7",
|
|
25
|
+
"@nocobase/utils": "1.6.0-alpha.7",
|
|
26
26
|
"@types/decompress": "4.2.7",
|
|
27
27
|
"@types/ini": "^1.3.31",
|
|
28
28
|
"@types/koa-send": "^4.1.3",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"@types/serve-handler": "^6.1.1",
|
|
57
57
|
"@types/ws": "^8.5.5"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "d9552440f5e3ce2795c9f2f23a1b04f5376a1550"
|
|
60
60
|
}
|