@nocobase/database 1.9.36 → 1.9.38
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/options-parser.js +16 -8
- package/lib/view/view-inference.js +1 -2
- package/package.json +4 -5
package/lib/options-parser.js
CHANGED
|
@@ -293,7 +293,7 @@ const _OptionsParser = class _OptionsParser {
|
|
|
293
293
|
return filterParams;
|
|
294
294
|
}
|
|
295
295
|
const sortedAppends = import_lodash.default.sortBy(appendList, (append) => append.split(".").length);
|
|
296
|
-
const setInclude = /* @__PURE__ */ __name((model, queryParams, append) => {
|
|
296
|
+
const setInclude = /* @__PURE__ */ __name((model, queryParams, append, parentAs) => {
|
|
297
297
|
var _a;
|
|
298
298
|
const appendWithOptions = this.parseAppendWithOptions(append);
|
|
299
299
|
append = appendWithOptions.name;
|
|
@@ -332,10 +332,21 @@ const _OptionsParser = class _OptionsParser {
|
|
|
332
332
|
return;
|
|
333
333
|
}
|
|
334
334
|
if (existIncludeIndex == -1) {
|
|
335
|
-
|
|
335
|
+
const association = associations[appendAssociation];
|
|
336
|
+
if (!association) {
|
|
337
|
+
throw new Error(`association ${appendAssociation} in ${model.name} not found`);
|
|
338
|
+
}
|
|
339
|
+
let includeOptions = {
|
|
336
340
|
association: appendAssociation,
|
|
337
341
|
options: appendWithOptions.options || {}
|
|
338
|
-
}
|
|
342
|
+
};
|
|
343
|
+
if (association.associationType === "BelongsToArray") {
|
|
344
|
+
includeOptions = {
|
|
345
|
+
...includeOptions,
|
|
346
|
+
...association.generateInclude(parentAs)
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
queryParams["include"].push(includeOptions);
|
|
339
350
|
existIncludeIndex = queryParams["include"].length - 1;
|
|
340
351
|
}
|
|
341
352
|
if (lastLevel) {
|
|
@@ -371,11 +382,8 @@ const _OptionsParser = class _OptionsParser {
|
|
|
371
382
|
if (appendWithOptions.raw) {
|
|
372
383
|
nextAppend += appendWithOptions.raw;
|
|
373
384
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
queryParams["include"][existIncludeIndex],
|
|
377
|
-
nextAppend
|
|
378
|
-
);
|
|
385
|
+
const association = model.associations[queryParams["include"][existIncludeIndex].association];
|
|
386
|
+
setInclude(association.target, queryParams["include"][existIncludeIndex], nextAppend, association.as);
|
|
379
387
|
}
|
|
380
388
|
}, "setInclude");
|
|
381
389
|
for (const append of sortedAppends) {
|
|
@@ -40,7 +40,6 @@ __export(view_inference_exports, {
|
|
|
40
40
|
ViewFieldInference: () => ViewFieldInference
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(view_inference_exports);
|
|
43
|
-
var import_mathjs = require("mathjs");
|
|
44
43
|
var import_field_type_map = __toESM(require("./field-type-map"));
|
|
45
44
|
const _ViewFieldInference = class _ViewFieldInference {
|
|
46
45
|
static extractTypeFromDefinition(typeDefinition) {
|
|
@@ -137,7 +136,7 @@ const _ViewFieldInference = class _ViewFieldInference {
|
|
|
137
136
|
}
|
|
138
137
|
const queryType = this.extractTypeFromDefinition(options.type);
|
|
139
138
|
const mappedType = fieldTypeMap[queryType];
|
|
140
|
-
if (
|
|
139
|
+
if (Array.isArray(mappedType)) {
|
|
141
140
|
return {
|
|
142
141
|
type: mappedType[0],
|
|
143
142
|
possibleTypes: mappedType
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/database",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.38",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"license": "AGPL-3.0",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@nocobase/logger": "1.9.
|
|
10
|
-
"@nocobase/utils": "1.9.
|
|
9
|
+
"@nocobase/logger": "1.9.38",
|
|
10
|
+
"@nocobase/utils": "1.9.38",
|
|
11
11
|
"async-mutex": "^0.3.2",
|
|
12
12
|
"chalk": "^4.1.1",
|
|
13
13
|
"cron-parser": "4.4.0",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"graphlib": "^2.1.8",
|
|
21
21
|
"joi": "^17.13.3",
|
|
22
22
|
"lodash": "^4.17.21",
|
|
23
|
-
"mathjs": "^10.6.1",
|
|
24
23
|
"nanoid": "^3.3.11",
|
|
25
24
|
"node-fetch": "^2.6.7",
|
|
26
25
|
"node-sql-parser": "^4.18.0",
|
|
@@ -39,5 +38,5 @@
|
|
|
39
38
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
40
39
|
"directory": "packages/database"
|
|
41
40
|
},
|
|
42
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "9646a7fcd02c833a5b0c14ddf7c509a4a3e1e75c"
|
|
43
42
|
}
|