@redocly/portal-plugin-async-api 1.0.239 → 1.0.240

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/config.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { FromSchema } from 'json-schema-to-ts';
2
- declare const asyncApiDocsSchema: {
2
+ export declare const asyncApiDocsConfigSchema: {
3
3
  readonly type: "object";
4
4
  readonly properties: {
5
5
  readonly schemaId: {
@@ -23,34 +23,4 @@ declare const asyncApiDocsSchema: {
23
23
  };
24
24
  readonly additionalProperties: false;
25
25
  };
26
- export declare const themeConfigSchema: {
27
- readonly type: "object";
28
- readonly properties: {
29
- readonly asyncapi: {
30
- readonly type: "object";
31
- readonly properties: {
32
- readonly schemaId: {
33
- readonly type: "string";
34
- };
35
- readonly hideInfo: {
36
- readonly type: "boolean";
37
- };
38
- readonly hideOperations: {
39
- readonly type: "boolean";
40
- };
41
- readonly hideServers: {
42
- readonly type: "boolean";
43
- };
44
- readonly hideMessages: {
45
- readonly type: "boolean";
46
- };
47
- readonly hideSchemas: {
48
- readonly type: "boolean";
49
- };
50
- };
51
- readonly additionalProperties: false;
52
- };
53
- };
54
- };
55
- export type AsyncApiDocsSettings = FromSchema<typeof asyncApiDocsSchema>;
56
- export {};
26
+ export type AsyncApiDocsSettings = FromSchema<typeof asyncApiDocsConfigSchema>;
package/lib/config.js CHANGED
@@ -1,4 +1,4 @@
1
- const asyncApiDocsSchema = {
1
+ export const asyncApiDocsConfigSchema = {
2
2
  type: 'object',
3
3
  properties: {
4
4
  schemaId: { type: 'string' },
@@ -10,10 +10,4 @@ const asyncApiDocsSchema = {
10
10
  },
11
11
  additionalProperties: false,
12
12
  };
13
- export const themeConfigSchema = {
14
- type: 'object',
15
- properties: {
16
- asyncapi: asyncApiDocsSchema,
17
- },
18
- };
19
13
  //# sourceMappingURL=config.js.map
package/lib/config.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC7B,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QACnC,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAChC,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QACjC,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KACjC;IACD,oBAAoB,EAAE,KAAK;CACnB,CAAC;AAEX,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,kBAAkB;KAC7B;CACO,CAAC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC7B,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QACnC,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAChC,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QACjC,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KACjC;IACD,oBAAoB,EAAE,KAAK;CACnB,CAAC"}
package/lib/plugin.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import type { PluginInstance } from '@redocly/realm/dist/server/plugins/types';
2
- export default function asyncAPIDocsPlugin(): Promise<PluginInstance>;
1
+ import type { ExternalPlugin } from '@redocly/realm/dist/server/plugins/types';
2
+ export default function asyncAPIDocsPlugin(): ExternalPlugin;
package/lib/plugin.js CHANGED
@@ -13,66 +13,67 @@ import * as asyncApi from '@asyncapi/parser';
13
13
  import { Feature } from '@redocly/realm/dist/server/entitlements/entitlements.types.js';
14
14
  import { logger } from '@redocly/realm/dist/server/utils/index.js';
15
15
  import path from 'node:path';
16
+ import { asyncApiDocsConfigSchema } from './config.js';
16
17
  const ASYNCAPI_TEMPLATE_ID = 'asyncapi-docs';
17
18
  const ASYNCAPI_SHARED_DATA_PREFIX = 'asyncapi-docs-';
18
19
  export default function asyncAPIDocsPlugin() {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- const parser = new asyncApi.Parser();
21
- return {
22
- id: Feature.Asyncapi,
23
- loaders: {
24
- asyncapi: (relativePath, { fs, cache }) => __awaiter(this, void 0, void 0, function* () {
25
- const absolutePath = path.join(fs.cwd, relativePath);
26
- const { data: yaml } = yield cache.load(relativePath, 'yaml');
27
- if (!yaml.asyncapi)
28
- return undefined;
29
- const { document, diagnostics } = yield asyncApi.fromFile(parser, absolutePath).parse();
30
- diagnostics
31
- .filter((d) => d.severity === 0)
32
- .forEach(({ message, path }) => logger.error(`Cannot parse AsyncAPI schema: ${message} in '${relativePath}:${path.join('.')}'`));
33
- return document;
34
- }),
35
- },
36
- processContent: (actions, context) => __awaiter(this, void 0, void 0, function* () {
37
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
38
- const asyncAPITemplateId = actions.createTemplate(ASYNCAPI_TEMPLATE_ID, '@redocly/portal-plugin-async-api/template.js');
39
- const config = yield context.getConfig();
40
- const globalSettings = ((_a = config.theme) === null || _a === void 0 ? void 0 : _a.asyncapi) || {};
41
- for (const record of yield context.fs.scan(/(\.ya?ml|\.json)$/)) {
42
- if (yield context.isPathIgnored(record.relativePath))
20
+ const parser = new asyncApi.Parser();
21
+ return {
22
+ id: 'asyncapi',
23
+ requiredEntitlements: [Feature.Asyncapi],
24
+ redoclyConfigSchema: asyncApiDocsConfigSchema,
25
+ loaders: {
26
+ asyncapi: (relativePath, { fs, cache }) => __awaiter(this, void 0, void 0, function* () {
27
+ const absolutePath = path.join(fs.cwd, relativePath);
28
+ const { data: yaml } = yield cache.load(relativePath, 'yaml');
29
+ if (!yaml.asyncapi)
30
+ return undefined;
31
+ const { document, diagnostics } = yield asyncApi.fromFile(parser, absolutePath).parse();
32
+ diagnostics
33
+ .filter((d) => d.severity === 0)
34
+ .forEach(({ message, path }) => logger.error(`Cannot parse AsyncAPI schema: ${message} in '${relativePath}:${path.join('.')}'`));
35
+ return document;
36
+ }),
37
+ },
38
+ processContent: (actions, context) => __awaiter(this, void 0, void 0, function* () {
39
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
40
+ const asyncAPITemplateId = actions.createTemplate(ASYNCAPI_TEMPLATE_ID, '@redocly/portal-plugin-async-api/template.js');
41
+ const config = yield context.getConfig();
42
+ const globalSettings = (config === null || config === void 0 ? void 0 : config.asyncapi) || {};
43
+ for (const record of yield context.fs.scan(/(\.ya?ml|\.json)$/)) {
44
+ if (yield context.isPathIgnored(record.relativePath))
45
+ continue;
46
+ const { relativePath } = record;
47
+ const sharedDataId = `${ASYNCAPI_SHARED_DATA_PREFIX}${relativePath}`;
48
+ try {
49
+ const { data: document } = yield context.cache.load(record.realRelativePath, 'asyncapi');
50
+ if (!document)
43
51
  continue;
44
- const { relativePath } = record;
45
- const sharedDataId = `${ASYNCAPI_SHARED_DATA_PREFIX}${relativePath}`;
46
- try {
47
- const { data: document } = yield context.cache.load(record.realRelativePath, 'asyncapi');
48
- if (!document)
49
- continue;
50
- yield actions.createSharedData(sharedDataId, (_b = document === null || document === void 0 ? void 0 : document.json()) !== null && _b !== void 0 ? _b : {});
51
- actions.addRoute({
52
- fsPath: relativePath,
53
- templateId: asyncAPITemplateId,
54
- getStaticData: buildGetStaticDataFn(globalSettings),
55
- metadata: Object.assign({ type: 'asyncapi', title: (_e = (_d = (_c = document === null || document === void 0 ? void 0 : document.json()) === null || _c === void 0 ? void 0 : _c.info) === null || _d === void 0 ? void 0 : _d.title) !== null && _e !== void 0 ? _e : 'AsyncAPI', description: (_h = (_g = (_f = document === null || document === void 0 ? void 0 : document.json()) === null || _f === void 0 ? void 0 : _f.info) === null || _g === void 0 ? void 0 : _g.description) !== null && _h !== void 0 ? _h : '' }, ((_l = (_k = (_j = document === null || document === void 0 ? void 0 : document.json()) === null || _j === void 0 ? void 0 : _j.info) === null || _k === void 0 ? void 0 : _k['x-metadata']) !== null && _l !== void 0 ? _l : {})),
56
- sharedData: [{ key: 'AsyncApiDefinition', id: sharedDataId }],
57
- });
58
- }
59
- catch (e) {
60
- console.error(e);
61
- }
52
+ yield actions.createSharedData(sharedDataId, (_a = document === null || document === void 0 ? void 0 : document.json()) !== null && _a !== void 0 ? _a : {});
53
+ actions.addRoute({
54
+ fsPath: relativePath,
55
+ templateId: asyncAPITemplateId,
56
+ getStaticData: buildGetStaticDataFn(globalSettings),
57
+ metadata: Object.assign({ type: 'asyncapi', title: (_d = (_c = (_b = document === null || document === void 0 ? void 0 : document.json()) === null || _b === void 0 ? void 0 : _b.info) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : 'AsyncAPI', description: (_g = (_f = (_e = document === null || document === void 0 ? void 0 : document.json()) === null || _e === void 0 ? void 0 : _e.info) === null || _f === void 0 ? void 0 : _f.description) !== null && _g !== void 0 ? _g : '' }, ((_k = (_j = (_h = document === null || document === void 0 ? void 0 : document.json()) === null || _h === void 0 ? void 0 : _h.info) === null || _j === void 0 ? void 0 : _j['x-metadata']) !== null && _k !== void 0 ? _k : {})),
58
+ sharedData: [{ key: 'AsyncApiDefinition', id: sharedDataId }],
59
+ });
62
60
  }
63
- }),
61
+ catch (e) {
62
+ console.error(e);
63
+ }
64
+ }
65
+ }),
66
+ };
67
+ function buildGetStaticDataFn(settings) {
68
+ return function (route, _context) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ return {
71
+ props: {
72
+ settings: Object.assign(Object.assign({}, settings), { baseUrlPath: withPathPrefix(route.slug) }),
73
+ },
74
+ };
75
+ });
64
76
  };
65
- function buildGetStaticDataFn(settings) {
66
- return function (route, _context) {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- return {
69
- props: {
70
- settings: Object.assign(Object.assign({}, settings), { baseUrlPath: withPathPrefix(route.slug) }),
71
- },
72
- };
73
- });
74
- };
75
- }
76
- });
77
+ }
77
78
  }
78
79
  //# sourceMappingURL=plugin.js.map
package/lib/plugin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uDAAuD;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,+DAA+D,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,IAAI,MAAM,WAAW,CAAC;AAW7B,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAC7C,MAAM,2BAA2B,GAAG,gBAAgB,CAAC;AAErD,MAAM,CAAC,OAAO,UAAgB,kBAAkB;;QAC9C,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QAErC,OAAO;YACL,EAAE,EAAE,OAAO,CAAC,QAAQ;YACpB,OAAO,EAAE;gBACP,QAAQ,EAAE,CAAO,YAAY,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;oBAC9C,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;oBACrD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,IAAI,CAAM,YAAY,EAAE,MAAM,CAAC,CAAC;oBACnE,IAAI,CAAC,IAAI,CAAC,QAAQ;wBAAE,OAAO,SAAS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;wBACpB,UAAU,EAAE,kBAAkB;wBAC9B,aAAa,EAAE,oBAAoB,CAAC,cAAc,CAAC;wBACnD,QAAQ,kBACN,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,EAAE,0CAAE,IAAI,0CAAE,KAAK,mCAAI,UAAU,EAClD,WAAW,EAAE,MAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,EAAE,0CAAE,IAAI,0CAAE,WAAW,mCAAI,EAAE,IACnD,CAAC,MAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,EAAE,0CAAE,IAAI,0CAAG,YAAY,CAAC,mCAAI,EAAE,CAAC,CAClD;wBACD,UAAU,EAAE,CAAC,EAAE,GAAG,EAAE,oBAAoB,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC;qBAC9D,CAAC,CAAC;iBACJ;gBAAC,OAAO,CAAC,EAAE;oBACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClB;aACF;QACH,CAAC,CAAA;KACF,CAAC;IAEF,SAAS,oBAAoB,CAC3B,QAA8B;QAE9B,OAAO,UAAgB,KAAK,EAAE,QAAQ;;gBACpC,OAAO;oBACL,KAAK,EAAE;wBACL,QAAQ,kCACH,QAAQ,KACX,WAAW,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,GACxC;qBACF;iBACF,CAAC;YACJ,CAAC;SAAA,CAAC;IACJ,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/portal-plugin-async-api",
3
- "version": "1.0.239",
3
+ "version": "1.0.240",
4
4
  "description": "Async API plugin for @redocly/portal",
5
5
  "type": "module",
6
6
  "exports": {
@@ -34,8 +34,8 @@
34
34
  "peerDependencies": {
35
35
  "react": "^18.0.0",
36
36
  "react-dom": "^18.0.0",
37
- "@redocly/realm": "0.93.3",
38
- "@redocly/theme": "0.40.1"
37
+ "@redocly/realm": "0.94.0",
38
+ "@redocly/theme": "0.40.2"
39
39
  },
40
40
  "peerDependenciesMeta": {
41
41
  "@redocly/realm": {
package/src/config.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { FromSchema } from 'json-schema-to-ts';
2
2
 
3
- const asyncApiDocsSchema = {
3
+ export const asyncApiDocsConfigSchema = {
4
4
  type: 'object',
5
5
  properties: {
6
6
  schemaId: { type: 'string' },
@@ -13,11 +13,4 @@ const asyncApiDocsSchema = {
13
13
  additionalProperties: false,
14
14
  } as const;
15
15
 
16
- export const themeConfigSchema = {
17
- type: 'object',
18
- properties: {
19
- asyncapi: asyncApiDocsSchema,
20
- },
21
- } as const;
22
-
23
- export type AsyncApiDocsSettings = FromSchema<typeof asyncApiDocsSchema>;
16
+ export type AsyncApiDocsSettings = FromSchema<typeof asyncApiDocsConfigSchema>;
package/src/plugin.ts CHANGED
@@ -7,21 +7,25 @@ import path from 'node:path';
7
7
 
8
8
  import type { AsyncAPIDocumentInterface } from '@asyncapi/parser';
9
9
  import type { PageStaticData } from '@redocly/realm/dist/shared/types';
10
- import type { AsyncApiDocsSettings } from './config';
11
10
  import type {
12
11
  GetStaticDataFn,
13
12
  PageRouteDetails,
14
- PluginInstance,
13
+ ExternalPlugin,
15
14
  } from '@redocly/realm/dist/server/plugins/types';
15
+ import type { AsyncApiDocsSettings } from './config';
16
+
17
+ import { asyncApiDocsConfigSchema } from './config.js';
16
18
 
17
19
  const ASYNCAPI_TEMPLATE_ID = 'asyncapi-docs';
18
20
  const ASYNCAPI_SHARED_DATA_PREFIX = 'asyncapi-docs-';
19
21
 
20
- export default async function asyncAPIDocsPlugin(): Promise<PluginInstance> {
22
+ export default function asyncAPIDocsPlugin(): ExternalPlugin {
21
23
  const parser = new asyncApi.Parser();
22
24
 
23
25
  return {
24
- id: Feature.Asyncapi,
26
+ id: 'asyncapi',
27
+ requiredEntitlements: [Feature.Asyncapi],
28
+ redoclyConfigSchema: asyncApiDocsConfigSchema as any,
25
29
  loaders: {
26
30
  asyncapi: async (relativePath, { fs, cache }) => {
27
31
  const absolutePath = path.join(fs.cwd, relativePath);
@@ -49,7 +53,7 @@ export default async function asyncAPIDocsPlugin(): Promise<PluginInstance> {
49
53
 
50
54
  const config = await context.getConfig();
51
55
  const globalSettings =
52
- (config.theme as { asyncapi: AsyncApiDocsSettings } | undefined)?.asyncapi || {};
56
+ (config as { asyncapi: AsyncApiDocsSettings } | undefined)?.asyncapi || {};
53
57
 
54
58
  for (const record of await context.fs.scan(/(\.ya?ml|\.json)$/)) {
55
59
  if (await context.isPathIgnored(record.relativePath)) continue;