@nocobase/plugin-api-doc 1.2.12-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.
Files changed (52) hide show
  1. package/package.json +2 -2
  2. package/dist/client/Document.d.ts +0 -12
  3. package/dist/client/index.d.ts +0 -14
  4. package/dist/client/index.js +0 -160
  5. package/dist/externalVersion.js +0 -22
  6. package/dist/index.d.ts +0 -9
  7. package/dist/index.js +0 -42
  8. package/dist/locale/en-US.json +0 -5
  9. package/dist/locale/index.d.ts +0 -12
  10. package/dist/locale/index.js +0 -53
  11. package/dist/locale/ko_KR.json +0 -5
  12. package/dist/locale/zh-CN.json +0 -5
  13. package/dist/server/index.d.ts +0 -9
  14. package/dist/server/index.js +0 -42
  15. package/dist/server/server.d.ts +0 -17
  16. package/dist/server/server.js +0 -83
  17. package/dist/server/swagger/base-swagger.d.ts +0 -57
  18. package/dist/server/swagger/base-swagger.js +0 -81
  19. package/dist/server/swagger/collections/components/field-type-map.d.ts +0 -30
  20. package/dist/server/swagger/collections/components/field-type-map.js +0 -66
  21. package/dist/server/swagger/collections/components/index.d.ts +0 -32
  22. package/dist/server/swagger/collections/components/index.js +0 -49
  23. package/dist/server/swagger/collections/components/parameters.d.ts +0 -13
  24. package/dist/server/swagger/collections/components/parameters.js +0 -203
  25. package/dist/server/swagger/collections/components/schemas.d.ts +0 -31
  26. package/dist/server/swagger/collections/components/schemas.js +0 -117
  27. package/dist/server/swagger/collections/index.d.ts +0 -39
  28. package/dist/server/swagger/collections/index.js +0 -52
  29. package/dist/server/swagger/collections/paths/associations/index.d.ts +0 -14
  30. package/dist/server/swagger/collections/paths/associations/index.js +0 -69
  31. package/dist/server/swagger/collections/paths/associations/multiple-association.d.ts +0 -14
  32. package/dist/server/swagger/collections/paths/associations/multiple-association.js +0 -134
  33. package/dist/server/swagger/collections/paths/associations/single-association.d.ts +0 -13
  34. package/dist/server/swagger/collections/paths/associations/single-association.js +0 -114
  35. package/dist/server/swagger/collections/paths/collection.d.ts +0 -209
  36. package/dist/server/swagger/collections/paths/collection.js +0 -371
  37. package/dist/server/swagger/collections/paths/index.d.ts +0 -14
  38. package/dist/server/swagger/collections/paths/index.js +0 -74
  39. package/dist/server/swagger/collections/tags/index.d.ts +0 -14
  40. package/dist/server/swagger/collections/tags/index.js +0 -52
  41. package/dist/server/swagger/constants.d.ts +0 -18
  42. package/dist/server/swagger/constants.js +0 -45
  43. package/dist/server/swagger/helpers.d.ts +0 -179
  44. package/dist/server/swagger/helpers.js +0 -143
  45. package/dist/server/swagger/index.d.ts +0 -57
  46. package/dist/server/swagger/index.js +0 -259
  47. package/dist/server/swagger/loader.d.ts +0 -12
  48. package/dist/server/swagger/loader.js +0 -89
  49. package/dist/server/swagger/merge.d.ts +0 -9
  50. package/dist/server/swagger/merge.js +0 -43
  51. package/dist/swagger.d.ts +0 -51
  52. package/dist/swagger.js +0 -73
@@ -1,74 +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 __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var paths_exports = {};
38
- __export(paths_exports, {
39
- default: () => paths_default,
40
- hasSortField: () => hasSortField,
41
- isViewCollection: () => isViewCollection,
42
- readOnlyCollection: () => readOnlyCollection
43
- });
44
- module.exports = __toCommonJS(paths_exports);
45
- var import_collection = __toESM(require("./collection"));
46
- var import_associations = __toESM(require("./associations"));
47
- var paths_default = (collection, options) => {
48
- const paths = (0, import_collection.default)(collection);
49
- if (options.withAssociation && !isViewCollection(collection)) {
50
- Object.assign(paths, (0, import_associations.default)(collection));
51
- }
52
- return paths;
53
- };
54
- function hasSortField(collection) {
55
- for (const field of collection.fields.values()) {
56
- if (field.type === "sort") {
57
- return true;
58
- }
59
- }
60
- return false;
61
- }
62
- function readOnlyCollection(collection) {
63
- var _a;
64
- return isViewCollection(collection) && ((_a = collection.options) == null ? void 0 : _a.writableView) == false;
65
- }
66
- function isViewCollection(collection) {
67
- return collection.isView();
68
- }
69
- // Annotate the CommonJS export names for ESM import in node:
70
- 0 && (module.exports = {
71
- hasSortField,
72
- isViewCollection,
73
- readOnlyCollection
74
- });
@@ -1,14 +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
- import { Collection } from '@nocobase/database';
10
- declare const _default: (collection: Collection, options: any) => {
11
- name: string;
12
- description: string;
13
- }[];
14
- export default _default;
@@ -1,52 +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 __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var tags_exports = {};
28
- __export(tags_exports, {
29
- default: () => tags_default
30
- });
31
- module.exports = __toCommonJS(tags_exports);
32
- var import_associations = require("../paths/associations");
33
- var import_collection = require("../paths/collection");
34
- var tags_default = (collection, options) => {
35
- var _a, _b, _c, _d;
36
- const associations = (0, import_associations.associationFields)(collection);
37
- const tags = [
38
- {
39
- name: collection.name,
40
- description: ((_a = collection.options) == null ? void 0 : _a.title) || collection.name
41
- }
42
- ];
43
- if (options.withAssociation) {
44
- for (const field of associations) {
45
- tags.push({
46
- name: `${collection.name}.${field.name}`,
47
- description: `${(0, import_collection.relationTypeToString)(field)} relationship, ${((_b = collection.options) == null ? void 0 : _b.title) || collection.name}/${((_d = (_c = field.options) == null ? void 0 : _c.uiSchema) == null ? void 0 : _d.title) || field.name}`
48
- });
49
- }
50
- }
51
- return tags;
52
- };
@@ -1,18 +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
- export declare const SchemaTypeMapping: {
10
- uid: string;
11
- json: string;
12
- jsonb: string;
13
- text: string;
14
- bigInt: string;
15
- sort: string;
16
- context: string;
17
- set: string;
18
- };
@@ -1,45 +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 __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var constants_exports = {};
28
- __export(constants_exports, {
29
- SchemaTypeMapping: () => SchemaTypeMapping
30
- });
31
- module.exports = __toCommonJS(constants_exports);
32
- const SchemaTypeMapping = {
33
- uid: "string",
34
- json: "object",
35
- jsonb: "object",
36
- text: "string",
37
- bigInt: "integer",
38
- sort: "integer",
39
- context: "string",
40
- set: "array"
41
- };
42
- // Annotate the CommonJS export names for ESM import in node:
43
- 0 && (module.exports = {
44
- SchemaTypeMapping
45
- });
@@ -1,179 +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
- export declare const createDefaultActionSwagger: ({ collection }: {
10
- collection: any;
11
- }) => {
12
- list: {
13
- method: string;
14
- responses: {
15
- default: {
16
- content: {
17
- 'application/json': {
18
- schema: {
19
- $ref: string;
20
- };
21
- };
22
- };
23
- };
24
- };
25
- };
26
- create: {
27
- method: string;
28
- requestBody: {
29
- content: {
30
- 'application/json': {
31
- schema: {
32
- $ref: string;
33
- };
34
- };
35
- };
36
- };
37
- };
38
- get: {
39
- method: string;
40
- responses: {
41
- default: {
42
- content: {
43
- 'application/json': {
44
- schema: {
45
- $ref: string;
46
- };
47
- };
48
- };
49
- };
50
- };
51
- };
52
- update: {
53
- method: string;
54
- requestBody: {
55
- content: {
56
- 'application/json': {
57
- schema: {
58
- $ref: string;
59
- };
60
- };
61
- };
62
- };
63
- responses: {
64
- default: {
65
- content: {
66
- 'application/json': {
67
- schema: {
68
- $ref: string;
69
- };
70
- };
71
- };
72
- };
73
- };
74
- };
75
- destroy: {
76
- method: string;
77
- responses: {
78
- default: {
79
- content: {
80
- 'application/json': {
81
- schema: {
82
- $ref: string;
83
- };
84
- };
85
- };
86
- };
87
- };
88
- };
89
- add: {
90
- method: string;
91
- requestBody: {
92
- content: {
93
- 'application/json': {
94
- schema: {
95
- $ref: string;
96
- };
97
- };
98
- };
99
- };
100
- responses: {
101
- default: {
102
- content: {
103
- 'application/json': {
104
- schema: {
105
- $ref: string;
106
- };
107
- };
108
- };
109
- };
110
- };
111
- };
112
- set: {
113
- method: string;
114
- requestBody: {
115
- content: {
116
- 'application/json': {
117
- schema: {
118
- $ref: string;
119
- };
120
- };
121
- };
122
- };
123
- };
124
- remove: {
125
- method: string;
126
- responses: {
127
- default: {
128
- content: {
129
- 'application/json': {
130
- schema: {
131
- $ref: string;
132
- };
133
- };
134
- };
135
- };
136
- };
137
- };
138
- toggle: {
139
- method: string;
140
- requestBody: {
141
- content: {
142
- 'application/json': {
143
- schema: {
144
- $ref: string;
145
- };
146
- };
147
- };
148
- };
149
- responses: {
150
- default: {
151
- content: {
152
- 'application/json': {
153
- schema: {
154
- $ref: string;
155
- };
156
- };
157
- };
158
- };
159
- };
160
- };
161
- move: {
162
- method: string;
163
- requestBody: {
164
- content: {
165
- 'application/json': {
166
- schema: {
167
- $ref: string;
168
- };
169
- };
170
- };
171
- };
172
- };
173
- };
174
- export declare const getInterfaceCollection: (options: Record<string, any>) => {
175
- '/{resourceName}': any[];
176
- '/{resourceName}/{resourceIndex}': any[];
177
- '/{associatedName}/{associatedIndex}/{resourceName}': any[];
178
- '/{associatedName}/{associatedIndex}/{resourceName}/{resourceIndex}': any[];
179
- };
@@ -1,143 +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 __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var helpers_exports = {};
28
- __export(helpers_exports, {
29
- createDefaultActionSwagger: () => createDefaultActionSwagger,
30
- getInterfaceCollection: () => getInterfaceCollection
31
- });
32
- module.exports = __toCommonJS(helpers_exports);
33
- const createDefaultActionSwagger = ({ collection }) => {
34
- const responses = {
35
- default: {
36
- content: {
37
- "application/json": {
38
- schema: {
39
- $ref: `#/components/schemas/${collection.name}`
40
- }
41
- }
42
- }
43
- }
44
- };
45
- const requestBody = {
46
- content: {
47
- "application/json": {
48
- schema: {
49
- $ref: `#/components/schemas/${collection.name}`
50
- }
51
- }
52
- }
53
- };
54
- return {
55
- list: {
56
- method: "get",
57
- responses
58
- },
59
- create: {
60
- method: "post",
61
- requestBody
62
- },
63
- get: {
64
- method: "get",
65
- responses
66
- },
67
- update: {
68
- method: "put",
69
- requestBody,
70
- responses
71
- },
72
- destroy: {
73
- method: "delete",
74
- responses
75
- },
76
- add: {
77
- method: "post",
78
- requestBody,
79
- responses
80
- },
81
- set: {
82
- method: "post",
83
- requestBody
84
- },
85
- remove: {
86
- method: "delete",
87
- responses
88
- },
89
- toggle: {
90
- method: "post",
91
- requestBody,
92
- responses
93
- },
94
- move: {
95
- method: "post",
96
- requestBody
97
- }
98
- };
99
- };
100
- const getInterfaceCollection = (options) => {
101
- const accessors = {
102
- // 常规 actions
103
- list: "list",
104
- create: "create",
105
- get: "get",
106
- update: "update",
107
- delete: "destroy",
108
- // associate 操作
109
- add: "add",
110
- set: "set",
111
- remove: "remove",
112
- toggle: "toggle",
113
- move: "move",
114
- ...options.accessors || {}
115
- };
116
- const single = {
117
- "/{resourceName}": [accessors.list, accessors.create, accessors.delete],
118
- "/{resourceName}/{resourceIndex}": [accessors.get, accessors.update, accessors.delete],
119
- "/{associatedName}/{associatedIndex}/{resourceName}": [
120
- accessors.list,
121
- accessors.create,
122
- accessors.delete,
123
- accessors.toggle,
124
- accessors.add,
125
- accessors.remove
126
- ],
127
- "/{associatedName}/{associatedIndex}/{resourceName}/{resourceIndex}": [
128
- accessors.get,
129
- accessors.update,
130
- accessors.delete,
131
- accessors.remove,
132
- accessors.toggle,
133
- accessors.set,
134
- accessors.move
135
- ]
136
- };
137
- return single;
138
- };
139
- // Annotate the CommonJS export names for ESM import in node:
140
- 0 && (module.exports = {
141
- createDefaultActionSwagger,
142
- getInterfaceCollection
143
- });
@@ -1,57 +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
- import APIDocPlugin from '../server';
10
- export declare class SwaggerManager {
11
- private plugin;
12
- constructor(plugin: APIDocPlugin);
13
- private get app();
14
- private get db();
15
- generateSwagger(options?: {
16
- plugins?: string[];
17
- }): Promise<unknown>;
18
- getSwagger(): Promise<unknown>;
19
- collection2Swagger(collectionName: string, withAssociation?: boolean): Promise<{
20
- paths: any;
21
- components: {
22
- parameters: {};
23
- schemas: {
24
- [x: string]: {
25
- type: string;
26
- properties: {};
27
- allOf?: undefined;
28
- } | {
29
- allOf: ({
30
- $ref: string;
31
- type?: undefined;
32
- properties?: undefined;
33
- } | {
34
- type: string;
35
- properties: any;
36
- $ref?: undefined;
37
- })[];
38
- type?: undefined;
39
- properties?: undefined;
40
- };
41
- };
42
- };
43
- tags: {
44
- name: string;
45
- description: string;
46
- }[];
47
- }>;
48
- getCollectionsSwagger(name?: string): Promise<unknown>;
49
- getPluginsSwagger(pluginName?: string): Promise<unknown>;
50
- getCoreSwagger(): Promise<unknown>;
51
- getURL(pathname: string): string;
52
- getUrls(): Promise<any[]>;
53
- private getBaseSwagger;
54
- private generateSchemas;
55
- private generateCollectionBuiltInInterface;
56
- private loadSwaggers;
57
- }