@redocly/portal-plugin-async-api 1.0.139 → 1.0.140
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/CHANGELOG.md +11 -0
- package/lib/.tsbuildinfo +1 -1
- package/lib/plugin.d.ts +1 -1
- package/lib/plugin.js +11 -7
- package/lib/plugin.js.map +1 -1
- package/lib/template.d.ts +1 -1
- package/lib/template.js +2 -1
- package/lib/template.js.map +1 -1
- package/package.json +7 -2
- package/src/plugin.ts +13 -10
- package/src/template.tsx +4 -2
- package/tsconfig.json +1 -1
package/lib/plugin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PluginInstance } from '@redocly/
|
|
1
|
+
import type { PluginInstance } from '@redocly/realm/dist/server/plugins/types';
|
|
2
2
|
export default function asyncAPIDocsPlugin(): Promise<PluginInstance>;
|
package/lib/plugin.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// FIXME: think of a way to make these imports shorter?
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,15 +7,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
import {
|
|
10
|
+
import path from 'path';
|
|
11
|
+
// FIXME: think of a way to make these imports shorter?
|
|
12
|
+
import { getAllowedTeamsForRoute } from '@redocly/realm/dist/server/utils/rbac.js';
|
|
13
|
+
import { REDOCLY_TEAMS_RBAC } from '@redocly/realm/dist/shared/constants.js';
|
|
14
|
+
import { withPathPrefix } from '@redocly/realm/dist/shared/urls.js';
|
|
14
15
|
import bundle from '@asyncapi/bundler';
|
|
16
|
+
import { Feature } from '@redocly/realm/dist/server/entitlements/entitlements.types.js';
|
|
15
17
|
const ASYNCAPI_TEMPLATE_ID = 'asyncapi-docs';
|
|
16
18
|
const ASYNCAPI_SHARED_DATA_PREFIX = 'asyncapi-docs-';
|
|
17
19
|
export default function asyncAPIDocsPlugin() {
|
|
18
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
21
|
return {
|
|
22
|
+
id: Feature.Asyncapi,
|
|
20
23
|
processContent: (contentProvider, actions) => __awaiter(this, void 0, void 0, function* () {
|
|
21
24
|
var _a;
|
|
22
25
|
const asyncAPITemplateId = actions.createTemplate(ASYNCAPI_TEMPLATE_ID, '@redocly/portal-plugin-async-api/template.js');
|
|
@@ -27,11 +30,12 @@ export default function asyncAPIDocsPlugin() {
|
|
|
27
30
|
for (const [relativePath, parsedDefinition] of definitions) {
|
|
28
31
|
const pageSlug = contentProvider.slugFromRelativePath(relativePath);
|
|
29
32
|
const sharedDataKey = `${ASYNCAPI_SHARED_DATA_PREFIX}${relativePath}`;
|
|
30
|
-
const isLocatedInRoot = relativePath.lastIndexOf('/') === -1;
|
|
31
33
|
try {
|
|
32
|
-
const
|
|
34
|
+
const fsRelativePath = contentProvider.getFsRelativePath(relativePath);
|
|
35
|
+
const isLocatedInRoot = fsRelativePath.lastIndexOf('/') === -1;
|
|
36
|
+
const fileLocation = fsRelativePath.substring(0, isLocatedInRoot ? undefined : fsRelativePath.lastIndexOf('/'));
|
|
33
37
|
// todo: workaround for $ref resolving until following issue is resolved: https://github.com/asyncapi/bundler/issues/136
|
|
34
|
-
process.chdir(fileLocation);
|
|
38
|
+
process.chdir(path.join(contentProvider.cwd, fileLocation));
|
|
35
39
|
const bundledContent = yield bundle([parsedDefinition]);
|
|
36
40
|
yield actions.createSharedData(sharedDataKey, bundledContent.string());
|
|
37
41
|
const route = {
|
package/lib/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sour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3
|
-
import type { PageProps } from '@redocly/
|
|
3
|
+
import type { PageProps } from '@redocly/realm/dist/shared/types';
|
|
4
4
|
import type { AsyncApiDocsSettings } from './config';
|
|
5
5
|
interface AsyncApiDocsProps {
|
|
6
6
|
pageProps: PageProps & {
|
package/lib/template.js
CHANGED
|
@@ -3,8 +3,9 @@ import React from 'react';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
// @ts-ignore
|
|
5
5
|
import { Breadcrumbs as ThemeBreadcrumbs } from '@theme';
|
|
6
|
-
import { usePageSharedData } from '@redocly/portal/dist/client/providers/page-data/use-page-shared-data';
|
|
7
6
|
import '@asyncapi/react-component/lib/styles/fiori.css';
|
|
7
|
+
// @ts-ignore has no exported member error
|
|
8
|
+
import { usePageSharedData } from '@portal/hooks';
|
|
8
9
|
import { StylesProvider } from './styles.js';
|
|
9
10
|
function AsyncApiDocs({ pageProps }) {
|
|
10
11
|
const { settings = {} } = pageProps;
|
package/lib/template.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,aAAa;AACb,OAAO,EAAE,WAAW,IAAI,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.tsx"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,aAAa;AACb,OAAO,EAAE,WAAW,IAAI,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,gDAAgD,CAAC;AAOxD,0C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4
4
|
"description": "Async API plugin for @redocly/portal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -34,7 +34,12 @@
|
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": "^18.0.0",
|
|
36
36
|
"react-dom": "^18.0.0",
|
|
37
|
-
"@redocly/
|
|
37
|
+
"@redocly/realm": "0.69.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependenciesMeta": {
|
|
40
|
+
"@redocly/realm": {
|
|
41
|
+
"optional": true
|
|
42
|
+
}
|
|
38
43
|
},
|
|
39
44
|
"overrides": {
|
|
40
45
|
"react": "^18.0.0",
|
package/src/plugin.ts
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
+
import path from 'path';
|
|
1
2
|
// FIXME: think of a way to make these imports shorter?
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { withPathPrefix } from '@redocly/portal/dist/shared/urls.js';
|
|
3
|
+
import { getAllowedTeamsForRoute } from '@redocly/realm/dist/server/utils/rbac.js';
|
|
4
|
+
import { REDOCLY_TEAMS_RBAC } from '@redocly/realm/dist/shared/constants.js';
|
|
5
|
+
import { withPathPrefix } from '@redocly/realm/dist/shared/urls.js';
|
|
6
6
|
import bundle from '@asyncapi/bundler';
|
|
7
|
+
import { Feature } from '@redocly/realm/dist/server/entitlements/entitlements.types.js';
|
|
7
8
|
|
|
8
|
-
import type { PageStaticData } from '@redocly/
|
|
9
|
+
import type { PageStaticData } from '@redocly/realm/dist/shared/types';
|
|
9
10
|
import type { AsyncApiDocsSettings } from './config';
|
|
10
11
|
import type {
|
|
11
12
|
GetStaticDataFn,
|
|
12
13
|
PageRouteDetails,
|
|
13
14
|
PluginInstance,
|
|
14
|
-
} from '@redocly/
|
|
15
|
+
} from '@redocly/realm/dist/server/plugins/types';
|
|
15
16
|
|
|
16
17
|
const ASYNCAPI_TEMPLATE_ID = 'asyncapi-docs';
|
|
17
18
|
const ASYNCAPI_SHARED_DATA_PREFIX = 'asyncapi-docs-';
|
|
18
19
|
|
|
19
20
|
export default async function asyncAPIDocsPlugin(): Promise<PluginInstance> {
|
|
20
21
|
return {
|
|
22
|
+
id: Feature.Asyncapi,
|
|
21
23
|
processContent: async (contentProvider, actions) => {
|
|
22
24
|
const asyncAPITemplateId = actions.createTemplate(
|
|
23
25
|
ASYNCAPI_TEMPLATE_ID,
|
|
@@ -34,14 +36,15 @@ export default async function asyncAPIDocsPlugin(): Promise<PluginInstance> {
|
|
|
34
36
|
const pageSlug = contentProvider.slugFromRelativePath(relativePath);
|
|
35
37
|
|
|
36
38
|
const sharedDataKey = `${ASYNCAPI_SHARED_DATA_PREFIX}${relativePath}`;
|
|
37
|
-
const isLocatedInRoot = relativePath.lastIndexOf('/') === -1;
|
|
38
39
|
try {
|
|
39
|
-
const
|
|
40
|
+
const fsRelativePath = contentProvider.getFsRelativePath(relativePath);
|
|
41
|
+
const isLocatedInRoot = fsRelativePath.lastIndexOf('/') === -1;
|
|
42
|
+
const fileLocation = fsRelativePath.substring(
|
|
40
43
|
0,
|
|
41
|
-
isLocatedInRoot ? undefined :
|
|
44
|
+
isLocatedInRoot ? undefined : fsRelativePath.lastIndexOf('/'),
|
|
42
45
|
);
|
|
43
46
|
// todo: workaround for $ref resolving until following issue is resolved: https://github.com/asyncapi/bundler/issues/136
|
|
44
|
-
process.chdir(fileLocation);
|
|
47
|
+
process.chdir(path.join(contentProvider.cwd, fileLocation));
|
|
45
48
|
const bundledContent = await bundle([parsedDefinition as string]);
|
|
46
49
|
await actions.createSharedData(sharedDataKey, bundledContent.string());
|
|
47
50
|
|
package/src/template.tsx
CHANGED
|
@@ -3,14 +3,16 @@ import React from 'react';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
// @ts-ignore
|
|
5
5
|
import { Breadcrumbs as ThemeBreadcrumbs } from '@theme';
|
|
6
|
-
import { usePageSharedData } from '@redocly/portal/dist/client/providers/page-data/use-page-shared-data';
|
|
7
6
|
import '@asyncapi/react-component/lib/styles/fiori.css';
|
|
8
7
|
|
|
9
8
|
import type { ConfigInterface, AsyncApiProps } from '@asyncapi/react-component';
|
|
10
|
-
import type { PageProps } from '@redocly/
|
|
9
|
+
import type { PageProps } from '@redocly/realm/dist/shared/types';
|
|
11
10
|
import type { AsyncApiDocsSettings } from './config';
|
|
12
11
|
import type { ExpandConfig, ShowConfig } from '@asyncapi/react-component/lib/config';
|
|
13
12
|
|
|
13
|
+
// @ts-ignore has no exported member error
|
|
14
|
+
import { usePageSharedData } from '@portal/hooks';
|
|
15
|
+
|
|
14
16
|
import { StylesProvider } from './styles.js';
|
|
15
17
|
|
|
16
18
|
interface AsyncApiDocsProps {
|