@nocobase/server 1.6.0-alpha.5 → 1.6.0-alpha.6

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
- auditLog.metadata = { ...metadata, ...extra };
278
- } else {
279
- const defaultMetaData = await this.getDefaultMetaData(ctx);
280
- auditLog.metadata = { ...metadata, ...defaultMetaData };
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" && fields.length > 0) {
37
+ if (isTemplate && actionName === "get") {
38
38
  ctx.body = traverseJSON(JSON.parse(JSON.stringify(ctx.body)), {
39
- collection: ctx.db.getCollection(resourceName),
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/server",
3
- "version": "1.6.0-alpha.5",
3
+ "version": "1.6.0-alpha.6",
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.5",
14
- "@nocobase/actions": "1.6.0-alpha.5",
15
- "@nocobase/auth": "1.6.0-alpha.5",
16
- "@nocobase/cache": "1.6.0-alpha.5",
17
- "@nocobase/data-source-manager": "1.6.0-alpha.5",
18
- "@nocobase/database": "1.6.0-alpha.5",
19
- "@nocobase/evaluators": "1.6.0-alpha.5",
20
- "@nocobase/lock-manager": "1.6.0-alpha.5",
21
- "@nocobase/logger": "1.6.0-alpha.5",
22
- "@nocobase/resourcer": "1.6.0-alpha.5",
23
- "@nocobase/sdk": "1.6.0-alpha.5",
24
- "@nocobase/telemetry": "1.6.0-alpha.5",
25
- "@nocobase/utils": "1.6.0-alpha.5",
13
+ "@nocobase/acl": "1.6.0-alpha.6",
14
+ "@nocobase/actions": "1.6.0-alpha.6",
15
+ "@nocobase/auth": "1.6.0-alpha.6",
16
+ "@nocobase/cache": "1.6.0-alpha.6",
17
+ "@nocobase/data-source-manager": "1.6.0-alpha.6",
18
+ "@nocobase/database": "1.6.0-alpha.6",
19
+ "@nocobase/evaluators": "1.6.0-alpha.6",
20
+ "@nocobase/lock-manager": "1.6.0-alpha.6",
21
+ "@nocobase/logger": "1.6.0-alpha.6",
22
+ "@nocobase/resourcer": "1.6.0-alpha.6",
23
+ "@nocobase/sdk": "1.6.0-alpha.6",
24
+ "@nocobase/telemetry": "1.6.0-alpha.6",
25
+ "@nocobase/utils": "1.6.0-alpha.6",
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": "b600efcab7fef54f1456ef079787f0ab4992e249"
59
+ "gitHead": "485580ad30e5164ead7e15f3b4d219f2bce2caf4"
60
60
  }