@nocobase/plugin-api-doc 0.20.0-alpha.1 → 0.20.0-alpha.11

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.
@@ -1,12 +1,13 @@
1
1
  module.exports = {
2
- "@nocobase/client": "0.20.0-alpha.1",
2
+ "@nocobase/client": "0.20.0-alpha.11",
3
+ "@nocobase/sdk": "0.20.0-alpha.11",
3
4
  "antd": "5.12.8",
4
5
  "react": "18.2.0",
5
6
  "@ant-design/icons": "5.2.6",
6
7
  "antd-style": "3.4.5",
7
8
  "react-i18next": "11.18.6",
8
- "@nocobase/actions": "0.20.0-alpha.1",
9
- "@nocobase/server": "0.20.0-alpha.1",
10
- "@nocobase/utils": "0.20.0-alpha.1",
11
- "@nocobase/database": "0.20.0-alpha.1"
9
+ "@nocobase/actions": "0.20.0-alpha.11",
10
+ "@nocobase/server": "0.20.0-alpha.11",
11
+ "@nocobase/utils": "0.20.0-alpha.11",
12
+ "@nocobase/database": "0.20.0-alpha.11"
12
13
  };
@@ -40,6 +40,7 @@ export declare class SwaggerManager {
40
40
  getCollectionsSwagger(name?: string): Promise<unknown>;
41
41
  getPluginsSwagger(pluginName?: string): Promise<unknown>;
42
42
  getCoreSwagger(): Promise<unknown>;
43
+ getURL(pathname: string): string;
43
44
  getUrls(): Promise<any[]>;
44
45
  private getBaseSwagger;
45
46
  private generateSchemas;
@@ -31,11 +31,11 @@ __export(swagger_exports, {
31
31
  });
32
32
  module.exports = __toCommonJS(swagger_exports);
33
33
  var import_base_swagger = __toESM(require("./base-swagger"));
34
+ var import_collections = __toESM(require("./collections"));
34
35
  var import_constants = require("./constants");
35
36
  var import_helpers = require("./helpers");
36
37
  var import_loader = require("./loader");
37
38
  var import_merge = require("./merge");
38
- var import_collections = __toESM(require("./collections"));
39
39
  class SwaggerManager {
40
40
  plugin;
41
41
  constructor(plugin) {
@@ -99,6 +99,9 @@ class SwaggerManager {
99
99
  async getCoreSwagger() {
100
100
  return (0, import_merge.merge)(await this.getBaseSwagger(), await (0, import_loader.loadSwagger)("@nocobase/server"));
101
101
  }
102
+ getURL(pathname) {
103
+ return process.env.API_BASE_PATH + pathname;
104
+ }
102
105
  async getUrls() {
103
106
  const plugins = await (0, import_loader.getPluginsSwagger)(this.db).then((res) => {
104
107
  return Object.keys(res).map((name) => {
@@ -106,7 +109,7 @@ class SwaggerManager {
106
109
  const schema = res[name];
107
110
  return {
108
111
  name: ((_a = schema.info) == null ? void 0 : _a.title) || name,
109
- url: `/api/swagger:get?ns=${encodeURIComponent(`plugins/${name}`)}`
112
+ url: this.getURL(`swagger:get?ns=${encodeURIComponent(`plugins/${name}`)}`)
110
113
  };
111
114
  });
112
115
  }).catch(() => []);
@@ -119,25 +122,25 @@ class SwaggerManager {
119
122
  return [
120
123
  {
121
124
  name: "NocoBase API",
122
- url: "/api/swagger:get"
125
+ url: this.getURL("swagger:get")
123
126
  },
124
127
  {
125
128
  name: "NocoBase API - Core",
126
- url: "/api/swagger:get?ns=core"
129
+ url: this.getURL("swagger:get?ns=core")
127
130
  },
128
131
  {
129
132
  name: "NocoBase API - All plugins",
130
- url: "/api/swagger:get?ns=plugins"
133
+ url: this.getURL("swagger:get?ns=plugins")
131
134
  },
132
135
  {
133
136
  name: "NocoBase API - Custom collections",
134
- url: "/api/swagger:get?ns=collections"
137
+ url: this.getURL("swagger:get?ns=collections")
135
138
  },
136
139
  ...plugins,
137
140
  ...collections.map((collection) => {
138
141
  return {
139
142
  name: `Collection API - ${collection.title}`,
140
- url: `/api/swagger:get?ns=${encodeURIComponent("collections/" + collection.name)}`
143
+ url: this.getURL(`swagger:get?ns=${encodeURIComponent("collections/" + collection.name)}`)
141
144
  };
142
145
  })
143
146
  ];
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-api-doc",
3
- "version": "0.20.0-alpha.1",
3
+ "version": "0.20.0-alpha.11",
4
4
  "displayName": "API documentation",
5
5
  "displayName.zh-CN": "API 文档",
6
6
  "description": "An OpenAPI documentation generator for NocoBase HTTP API.",
7
7
  "description.zh-CN": "NocoBase HTTP API 的 OpenAPI 文档生成器。",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
- "homepage": "https://docs.nocobase.com/plugins/api-doc",
11
- "homepage.zh-CN": "https://docs-cn.nocobase.com/plugins/api-doc",
10
+ "homepage": "https://docs.nocobase.com/handbook/api-doc",
11
+ "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/api-doc",
12
12
  "types": "./dist/server/index.d.ts",
13
13
  "devDependencies": {
14
14
  "swagger-ui-dist": "^5.3.1"
@@ -23,5 +23,5 @@
23
23
  "url": "git+https://github.com/nocobase/nocobase.git",
24
24
  "directory": "packages/plugins/api-doc"
25
25
  },
26
- "gitHead": "516c0b1470d77ff499f533ae6b57e4c084450ff5"
26
+ "gitHead": "ed56e8464869fefbd6e263a2358fc14930c22f96"
27
27
  }