@redocly/portal-plugin-async-api 1.20.0-next.7 → 1.20.0-next.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.
package/lib/config.d.ts DELETED
@@ -1,26 +0,0 @@
1
- import type { FromSchema } from 'json-schema-to-ts';
2
- export declare const asyncApiDocsConfigSchema: {
3
- readonly type: 'object';
4
- readonly properties: {
5
- readonly schemaId: {
6
- readonly type: 'string';
7
- };
8
- readonly hideInfo: {
9
- readonly type: 'boolean';
10
- };
11
- readonly hideOperations: {
12
- readonly type: 'boolean';
13
- };
14
- readonly hideServers: {
15
- readonly type: 'boolean';
16
- };
17
- readonly hideMessages: {
18
- readonly type: 'boolean';
19
- };
20
- readonly hideSchemas: {
21
- readonly type: 'boolean';
22
- };
23
- };
24
- readonly additionalProperties: false;
25
- };
26
- export type AsyncApiDocsSettings = FromSchema<typeof asyncApiDocsConfigSchema>;
package/lib/config.js DELETED
@@ -1,13 +0,0 @@
1
- export const asyncApiDocsConfigSchema = {
2
- type: 'object',
3
- properties: {
4
- schemaId: { type: 'string' },
5
- hideInfo: { type: 'boolean' },
6
- hideOperations: { type: 'boolean' },
7
- hideServers: { type: 'boolean' },
8
- hideMessages: { type: 'boolean' },
9
- hideSchemas: { type: 'boolean' },
10
- },
11
- additionalProperties: false,
12
- };
13
- //# sourceMappingURL=config.js.map
package/lib/config.js.map DELETED
@@ -1 +0,0 @@
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 DELETED
@@ -1,2 +0,0 @@
1
- import type { ExternalPlugin } from '@redocly/realm/dist/server/types';
2
- export default function asyncAPIDocsPlugin(): ExternalPlugin;
package/lib/plugin.js DELETED
@@ -1,78 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import * as asyncApi from '@asyncapi/parser';
11
- import { AvroSchemaParser } from '@asyncapi/avro-schema-parser';
12
- import path from 'node:path';
13
- import { asyncApiDocsConfigSchema } from './config.js';
14
- const ASYNCAPI_TEMPLATE_ID = 'asyncapi-docs';
15
- const ASYNCAPI_SHARED_DATA_PREFIX = 'asyncapi-docs-';
16
- export default function asyncAPIDocsPlugin() {
17
- const parser = new asyncApi.Parser();
18
- parser.registerSchemaParser(AvroSchemaParser());
19
- return {
20
- id: 'asyncapi',
21
- requiredEntitlements: ['asyncapi'],
22
- redoclyConfigSchema: asyncApiDocsConfigSchema,
23
- loaders: {
24
- asyncapi: (relativePath_1, _a) => __awaiter(this, [relativePath_1, _a], void 0, function* (relativePath, { fs, cache, logger }) {
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;
38
- var _g, _h, _j, _k;
39
- const asyncAPITemplateId = actions.createTemplate(ASYNCAPI_TEMPLATE_ID, '@redocly/portal-plugin-async-api/template.js');
40
- const config = yield context.getConfig();
41
- const globalSettings = (config === null || config === void 0 ? void 0 : config.asyncapi) || {};
42
- for (const record of yield context.fs.scan(/(\.ya?ml|\.json)$/)) {
43
- if (yield context.isPathIgnored(record.relativePath))
44
- continue;
45
- const { relativePath } = record;
46
- const sharedDataId = `${ASYNCAPI_SHARED_DATA_PREFIX}${relativePath}`;
47
- try {
48
- const { data: document } = yield context.cache.load(record.realRelativePath, 'asyncapi');
49
- if (!document)
50
- continue;
51
- yield actions.createSharedData(sharedDataId, (_g = document === null || document === void 0 ? void 0 : document.json()) !== null && _g !== void 0 ? _g : {});
52
- actions.addRoute({
53
- fsPath: relativePath,
54
- templateId: asyncAPITemplateId,
55
- getStaticData: buildGetStaticDataFn(globalSettings, context.withPathPrefix),
56
- metadata: Object.assign({ type: 'asyncapi', title: (_h = (_b = (_a = document === null || document === void 0 ? void 0 : document.json()) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.title) !== null && _h !== void 0 ? _h : 'AsyncAPI', description: (_j = (_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.description) !== null && _j !== void 0 ? _j : '' }, ((_k = (_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['x-metadata']) !== null && _k !== void 0 ? _k : {})),
57
- sharedData: [{ key: 'AsyncApiDefinition', id: sharedDataId }],
58
- });
59
- }
60
- catch (e) {
61
- console.error(e);
62
- }
63
- }
64
- }),
65
- };
66
- function buildGetStaticDataFn(settings, withPathPrefix) {
67
- return function (route, _context) {
68
- return __awaiter(this, void 0, void 0, function* () {
69
- return {
70
- props: {
71
- settings: Object.assign(Object.assign({}, settings), { baseUrlPath: withPathPrefix(route.slug) }),
72
- },
73
- };
74
- });
75
- };
76
- }
77
- }
78
- //# sourceMappingURL=plugin.js.map
package/lib/plugin.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,IAAI,MAAM,WAAW,CAAC;AAY7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAC7C,MAAM,2BAA2B,GAAG,gBAAgB,CAAC;AAErD,MAAM,CAAC,OAAO,UAAU,kBAAkB;IACxC,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;IACrC,MAAM,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAEhD,OAAO;QACL,EAAE,EAAE,UAAU;QACd,oBAAoB,EAAE,CAAC,UAAqB,CAAC;QAC7C,mBAAmB,EAAE,wBAA+B;QACpD,OAAO,EAAE;YACP,QAAQ,EAAE,qBAA4C,EAAE,0DAAvC,YAAY,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;gBAClD,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;gBACrD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,IAAI,CAAM,YAAY,EAAE,MAAM,CA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C,KAAK,CAAC,IAAI,CAAC,GACxC;qBACF;iBACF,CAAC;YACJ,CAAC;SAAA,CAAC;IACJ,CAAC;AACH,CAAC"}
package/lib/styles.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const StylesProvider: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
package/lib/styles.js DELETED
@@ -1,59 +0,0 @@
1
- import styled from 'styled-components';
2
- export const StylesProvider = styled.div `
3
- margin: auto;
4
- padding: 0 var(--spacing-xl);
5
- max-width: var(--layout-stacked-large-max-width);
6
-
7
- .aui-root {
8
- font-family: var(--font-family-base);
9
- font-size: var(--font-size-base);
10
- line-height: var(--line-height-base);
11
- font-weight: var(--font-weight-regular);
12
- background: var(--bg-color);
13
- color: var(--text-color-primary);
14
- margin: 0 -2rem;
15
- }
16
-
17
- .aui-root .text-gray-700,
18
- .aui-root .prose {
19
- color: var(--text-color-primary);
20
- }
21
-
22
- .aui-root .bg-white,
23
- .aui-root .bg-gray-100,
24
- .aui-root .bg-gray-200 {
25
- background: var(--bg-color);
26
- }
27
-
28
- .aui-root div.border {
29
- border: solid 1px;
30
- border-color: var(--border-color-primary);
31
- }
32
-
33
- .aui-root .rounded {
34
- border-radius: var(--button-border-radius);
35
- }
36
-
37
- .aui-root .shadow {
38
- box-shadow: none;
39
- }
40
-
41
- .aui-root .text-4xl {
42
- margin: var(--h1-margin-top) 0 var(--h1-margin-bottom);
43
- font-size: var(--h1-font-size);
44
- font-weight: var(--h1-font-weight);
45
- font-family: var(--h1-font-family);
46
- line-height: var(--h1-line-height);
47
- color: var(--h1-text-color);
48
- text-transform: var(--h1-text-transform);
49
- }
50
-
51
- .aui-root .prose h3 {
52
- color: var(--text-color-primary);
53
- }
54
-
55
- .aui-root .text-gray-800 {
56
- color: var(--text-color-primary);
57
- }
58
- `;
59
- //# sourceMappingURL=styles.js.map
package/lib/styles.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDvC,CAAC"}
package/lib/template.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import type { PageProps } from '@redocly/config';
2
- import type { AsyncApiDocsSettings } from './config';
3
- import '@asyncapi/react-component/styles/default.css';
4
- interface AsyncApiDocsProps {
5
- pageProps: PageProps & {
6
- settings?: AsyncApiDocsSettings;
7
- };
8
- }
9
- declare function AsyncApiDocs({ pageProps }: AsyncApiDocsProps): import("react/jsx-runtime").JSX.Element;
10
- export default AsyncApiDocs;
package/lib/template.js DELETED
@@ -1,43 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import AsyncApiComponent from '@asyncapi/react-component';
3
- import styled from 'styled-components';
4
- import { Breadcrumbs as ThemeBreadcrumbs } from '@redocly/theme';
5
- import { usePageSharedData } from '@redocly/realm/dist/client/app/hooks';
6
- import '@asyncapi/react-component/styles/default.css';
7
- import { StylesProvider } from './styles';
8
- function AsyncApiDocs({ pageProps }) {
9
- const { settings = {} } = pageProps;
10
- const asyncApiDefinition = usePageSharedData('AsyncApiDefinition');
11
- const { schemaId, hideOperations, hideInfo, hideMessages, hideSchemas, hideServers } = settings;
12
- const componentConfig = {
13
- schemaID: schemaId,
14
- show: {
15
- errors: true,
16
- info: !hideInfo,
17
- operations: !hideOperations,
18
- servers: !hideServers,
19
- messages: !hideMessages,
20
- schemas: !hideSchemas,
21
- sidebar: false,
22
- },
23
- expand: {
24
- messageExamples: false,
25
- },
26
- sidebar: {
27
- showServers: 'byDefault',
28
- showOperations: 'byDefault',
29
- },
30
- publishLabel: 'PUBLISHER',
31
- subscribeLabel: 'SUBSCRIBER',
32
- sendLabel: 'SEND',
33
- receiveLabel: 'RECEIVE',
34
- requestLabel: 'REQUEST',
35
- replyLabel: 'REPLY',
36
- };
37
- return (_jsxs(StylesProvider, { children: [_jsx(Breadcrumbs, {}), _jsx(AsyncApiComponent, { schema: asyncApiDefinition, config: componentConfig })] }));
38
- }
39
- export default AsyncApiDocs;
40
- const Breadcrumbs = styled(ThemeBreadcrumbs) `
41
- margin-top: 20px;
42
- `;
43
- //# sourceMappingURL=template.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.tsx"],"names":[],"mappings":";AAAA,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAC1D,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,WAAW,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAMzE,OAAO,8CAA8C,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAQ1C,SAAS,YAAY,CAAC,EAAE,SAAS,EAAqB;IACpD,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,SAAS,CAAC;IACpC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,oBAAoB,CAA4B,CAAC;IAE9F,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,QAAQ,CAAC;IAEhG,MAAM,eAAe,GAA6B;QAChD,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE;YACJ,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,CAAC,QAAQ;YACf,UAAU,EAAE,CAAC,cAAc;YAC3B,OAAO,EAAE,CAAC,WAAW;YACrB,QAAQ,E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