@tachybase/plugin-devtools 0.23.8

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