@nocobase/plugin-api-doc 0.13.0-alpha.1 → 0.13.0-alpha.10
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/dist/client/index.js +177 -48574
- package/dist/index.js +33 -11
- package/dist/locale/en-US.js +22 -4
- package/dist/locale/index.js +36 -12
- package/dist/locale/zh-CN.js +22 -4
- package/dist/server/index.js +33 -11
- package/dist/server/server.js +26 -9
- package/dist/server/swagger/base-swagger.js +22 -4
- package/dist/server/swagger/collections/components/field-type-map.js +28 -5
- package/dist/server/swagger/collections/components/index.js +36 -14
- package/dist/server/swagger/collections/components/parameters.js +32 -11
- package/dist/server/swagger/collections/components/schemas.js +29 -12
- package/dist/server/swagger/collections/index.js +38 -17
- package/dist/server/swagger/collections/paths/associations/index.js +47 -19
- package/dist/server/swagger/collections/paths/associations/multiple-association.js +51 -32
- package/dist/server/swagger/collections/paths/associations/single-association.js +38 -21
- package/dist/server/swagger/collections/paths/collection.js +49 -20
- package/dist/server/swagger/collections/paths/index.d.ts +2 -0
- package/dist/server/swagger/collections/paths/index.js +53 -18
- package/dist/server/swagger/collections/tags/index.js +31 -14
- package/dist/server/swagger/constants.js +26 -4
- package/dist/server/swagger/helpers.js +28 -5
- package/dist/server/swagger/index.js +55 -29
- package/dist/server/swagger/loader.js +38 -14
- package/dist/server/swagger/merge.js +28 -7
- package/dist/swagger.js +22 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var src_exports = {};
|
|
29
|
+
__export(src_exports, {
|
|
30
|
+
default: () => import_server.default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(src_exports);
|
|
33
|
+
var import_server = __toESM(require("./server"));
|
package/dist/locale/en-US.js
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var en_US_exports = {};
|
|
19
|
+
__export(en_US_exports, {
|
|
20
|
+
default: () => en_US_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(en_US_exports);
|
|
3
23
|
var en_US_default = {};
|
|
4
|
-
|
|
5
|
-
module.exports = en_US_default;
|
package/dist/locale/index.js
CHANGED
|
@@ -1,20 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var locale_exports = {};
|
|
19
|
+
__export(locale_exports, {
|
|
20
|
+
NAMESPACE: () => NAMESPACE,
|
|
21
|
+
generateNTemplate: () => generateNTemplate,
|
|
22
|
+
lang: () => lang,
|
|
23
|
+
useTranslation: () => useTranslation
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(locale_exports);
|
|
26
|
+
var import_client = require("@nocobase/client");
|
|
27
|
+
var import_react_i18next = require("react-i18next");
|
|
6
28
|
const NAMESPACE = "api-doc";
|
|
7
29
|
function lang(key) {
|
|
8
|
-
return
|
|
30
|
+
return import_client.i18n.t(key, { ns: NAMESPACE });
|
|
9
31
|
}
|
|
10
32
|
function generateNTemplate(key) {
|
|
11
33
|
return `{{t('${key}', { ns: '${NAMESPACE}' })}}`;
|
|
12
34
|
}
|
|
13
35
|
function useTranslation() {
|
|
14
|
-
return
|
|
36
|
+
return (0, import_react_i18next.useTranslation)(NAMESPACE);
|
|
15
37
|
}
|
|
16
|
-
|
|
17
|
-
exports
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
NAMESPACE,
|
|
41
|
+
generateNTemplate,
|
|
42
|
+
lang,
|
|
43
|
+
useTranslation
|
|
44
|
+
});
|
package/dist/locale/zh-CN.js
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var zh_CN_exports = {};
|
|
19
|
+
__export(zh_CN_exports, {
|
|
20
|
+
default: () => zh_CN_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(zh_CN_exports);
|
|
3
23
|
var zh_CN_default = {
|
|
4
24
|
"API documentation": "Api \u6587\u6863",
|
|
5
25
|
"Documentation": "\u6587\u6863",
|
|
6
26
|
"Select a definition": "\u9009\u62E9\u7AEF\u70B9"
|
|
7
27
|
};
|
|
8
|
-
|
|
9
|
-
module.exports = zh_CN_default;
|
package/dist/server/index.js
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var server_exports = {};
|
|
29
|
+
__export(server_exports, {
|
|
30
|
+
default: () => import_server.default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(server_exports);
|
|
33
|
+
var import_server = __toESM(require("./server"));
|
package/dist/server/server.js
CHANGED
|
@@ -1,13 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var server_exports = {};
|
|
19
|
+
__export(server_exports, {
|
|
20
|
+
default: () => APIDoc
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(server_exports);
|
|
23
|
+
var import_server = require("@nocobase/server");
|
|
24
|
+
var import_swagger = require("./swagger");
|
|
25
|
+
class APIDoc extends import_server.Plugin {
|
|
7
26
|
swagger;
|
|
8
27
|
constructor(app, options) {
|
|
9
28
|
super(app, options);
|
|
10
|
-
this.swagger = new
|
|
29
|
+
this.swagger = new import_swagger.SwaggerManager(this);
|
|
11
30
|
}
|
|
12
31
|
beforeLoad() {
|
|
13
32
|
}
|
|
@@ -47,5 +66,3 @@ class APIDoc extends server.Plugin {
|
|
|
47
66
|
});
|
|
48
67
|
}
|
|
49
68
|
}
|
|
50
|
-
|
|
51
|
-
module.exports = APIDoc;
|
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var base_swagger_exports = {};
|
|
19
|
+
__export(base_swagger_exports, {
|
|
20
|
+
default: () => base_swagger_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(base_swagger_exports);
|
|
3
23
|
var base_swagger_default = {
|
|
4
24
|
openapi: "3.0.3",
|
|
5
25
|
info: {
|
|
@@ -50,5 +70,3 @@ var base_swagger_default = {
|
|
|
50
70
|
}
|
|
51
71
|
]
|
|
52
72
|
};
|
|
53
|
-
|
|
54
|
-
module.exports = base_swagger_default;
|
|
@@ -1,5 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var field_type_map_exports = {};
|
|
19
|
+
__export(field_type_map_exports, {
|
|
20
|
+
fieldTypeMap: () => fieldTypeMap,
|
|
21
|
+
getTypeByField: () => getTypeByField
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(field_type_map_exports);
|
|
3
24
|
const fieldTypeMap = {
|
|
4
25
|
bigint: {
|
|
5
26
|
type: "integer",
|
|
@@ -29,6 +50,8 @@ function getTypeByField(field) {
|
|
|
29
50
|
}
|
|
30
51
|
return fieldAttributes;
|
|
31
52
|
}
|
|
32
|
-
|
|
33
|
-
exports
|
|
34
|
-
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
fieldTypeMap,
|
|
56
|
+
getTypeByField
|
|
57
|
+
});
|
|
@@ -1,18 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var components_exports = {};
|
|
29
|
+
__export(components_exports, {
|
|
30
|
+
default: () => components_default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(components_exports);
|
|
33
|
+
var import_schemas = __toESM(require("./schemas"));
|
|
34
|
+
var import_parameters = __toESM(require("./parameters"));
|
|
11
35
|
var components_default = (collection, options) => {
|
|
12
36
|
return {
|
|
13
|
-
...
|
|
14
|
-
...
|
|
37
|
+
...(0, import_schemas.default)(collection, options),
|
|
38
|
+
...(0, import_parameters.default)(collection)
|
|
15
39
|
};
|
|
16
40
|
};
|
|
17
|
-
|
|
18
|
-
module.exports = components_default;
|
|
@@ -1,7 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var parameters_exports = {};
|
|
19
|
+
__export(parameters_exports, {
|
|
20
|
+
default: () => parameters_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(parameters_exports);
|
|
23
|
+
var import_field_type_map = require("./field-type-map");
|
|
5
24
|
var parameters_default = (collection) => {
|
|
6
25
|
const primaryKey = collection.model.primaryKeyAttribute;
|
|
7
26
|
const parameters = {};
|
|
@@ -16,13 +35,13 @@ var parameters_default = (collection) => {
|
|
|
16
35
|
name: "collectionIndex",
|
|
17
36
|
in: "path",
|
|
18
37
|
description: "collection index",
|
|
19
|
-
schema:
|
|
38
|
+
schema: (0, import_field_type_map.getTypeByField)(collection.fields.get(primaryKey))
|
|
20
39
|
},
|
|
21
40
|
filterByTk: {
|
|
22
41
|
name: "filterByTk",
|
|
23
42
|
in: "query",
|
|
24
43
|
description: "filter by TK(default by ID)",
|
|
25
|
-
schema:
|
|
44
|
+
schema: (0, import_field_type_map.getTypeByField)(collection.fields.get(primaryKey))
|
|
26
45
|
},
|
|
27
46
|
filterByTks: {
|
|
28
47
|
name: "filterByTk",
|
|
@@ -30,7 +49,7 @@ var parameters_default = (collection) => {
|
|
|
30
49
|
description: "filter by TKs(default by ID), example: `1,2,3`",
|
|
31
50
|
schema: {
|
|
32
51
|
type: "array",
|
|
33
|
-
items:
|
|
52
|
+
items: (0, import_field_type_map.getTypeByField)(collection.fields.get(primaryKey))
|
|
34
53
|
}
|
|
35
54
|
}
|
|
36
55
|
});
|
|
@@ -40,8 +59,12 @@ var parameters_default = (collection) => {
|
|
|
40
59
|
name: "filter",
|
|
41
60
|
in: "query",
|
|
42
61
|
description: "filter items",
|
|
43
|
-
|
|
44
|
-
|
|
62
|
+
content: {
|
|
63
|
+
"application/json": {
|
|
64
|
+
schema: {
|
|
65
|
+
type: "object"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
45
68
|
}
|
|
46
69
|
},
|
|
47
70
|
sort: {
|
|
@@ -169,5 +192,3 @@ var parameters_default = (collection) => {
|
|
|
169
192
|
parameters
|
|
170
193
|
};
|
|
171
194
|
};
|
|
172
|
-
|
|
173
|
-
module.exports = parameters_default;
|
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var schemas_exports = {};
|
|
19
|
+
__export(schemas_exports, {
|
|
20
|
+
default: () => schemas_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(schemas_exports);
|
|
23
|
+
var import_database = require("@nocobase/database");
|
|
24
|
+
var import_field_type_map = require("./field-type-map");
|
|
25
|
+
var import_associations = require("../paths/associations");
|
|
7
26
|
function getCollectionReadOnlyFields(collection) {
|
|
8
27
|
var _a;
|
|
9
28
|
const readOnlyFields = [];
|
|
@@ -45,7 +64,7 @@ function collectionToSchema(collection) {
|
|
|
45
64
|
[collection.name]: {
|
|
46
65
|
type: "object",
|
|
47
66
|
properties: Array.from(collection.fields).filter(([key, value]) => {
|
|
48
|
-
return !(value instanceof
|
|
67
|
+
return !(value instanceof import_database.RelationField);
|
|
49
68
|
}).reduce((obj, [key, value]) => {
|
|
50
69
|
obj[key] = {
|
|
51
70
|
...getFieldTypeAttributes(value)
|
|
@@ -72,8 +91,8 @@ function collectionToSchema(collection) {
|
|
|
72
91
|
};
|
|
73
92
|
}
|
|
74
93
|
var schemas_default = (collection, options) => {
|
|
75
|
-
const associations
|
|
76
|
-
const associationsTarget = associations
|
|
94
|
+
const associations = (0, import_associations.associationFields)(collection);
|
|
95
|
+
const associationsTarget = associations.map((field) => collection.db.getCollection(field.target));
|
|
77
96
|
const schemas = collectionToSchema(collection);
|
|
78
97
|
if (options.withAssociation) {
|
|
79
98
|
for (const target of associationsTarget) {
|
|
@@ -85,7 +104,5 @@ var schemas_default = (collection, options) => {
|
|
|
85
104
|
};
|
|
86
105
|
};
|
|
87
106
|
function getFieldTypeAttributes(field) {
|
|
88
|
-
return
|
|
107
|
+
return (0, import_field_type_map.getTypeByField)(field);
|
|
89
108
|
}
|
|
90
|
-
|
|
91
|
-
module.exports = schemas_default;
|
|
@@ -1,22 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var collections_exports = {};
|
|
29
|
+
__export(collections_exports, {
|
|
30
|
+
default: () => collections_default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(collections_exports);
|
|
33
|
+
var import_paths = __toESM(require("./paths"));
|
|
34
|
+
var import_components = __toESM(require("./components"));
|
|
35
|
+
var import_tags = __toESM(require("./tags"));
|
|
13
36
|
function collectionToSwaggerObject(collection, options) {
|
|
14
37
|
return {
|
|
15
|
-
paths:
|
|
16
|
-
components:
|
|
17
|
-
tags:
|
|
38
|
+
paths: (0, import_paths.default)(collection, options),
|
|
39
|
+
components: (0, import_components.default)(collection, options),
|
|
40
|
+
tags: (0, import_tags.default)(collection, options)
|
|
18
41
|
};
|
|
19
42
|
}
|
|
20
43
|
var collections_default = collectionToSwaggerObject;
|
|
21
|
-
|
|
22
|
-
module.exports = collections_default;
|