@clidey/dory 0.9.0 → 0.10.0
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/.claude/settings.json +29 -0
- package/CLAUDE.md +161 -0
- package/docs/api-reference/asyncapi.json +324 -0
- package/docs/api-reference/websocket-operations/receive-chat-message.mdx +5 -0
- package/docs/api-reference/websocket-operations/receive-notifications.mdx +5 -0
- package/docs/api-reference/websocket-operations/receive-presence-update.mdx +5 -0
- package/docs/api-reference/websocket-operations/send-chat-message.mdx +5 -0
- package/docs/api-reference/websocket-operations/send-presence-update.mdx +5 -0
- package/docs/dory.json +16 -0
- package/docs/websocket-playground-demo.mdx +135 -0
- package/k8s/Dockerfile +3 -0
- package/package.json +1 -1
- package/src/components/store.ts +4 -0
- package/src/mdx/async-api.tsx +369 -0
- package/src/mdx/mdx.tsx +5 -1
- package/src/mdx/websocket-playground.tsx +755 -0
- package/src/ui/layout.tsx +21 -3
package/src/ui/layout.tsx
CHANGED
|
@@ -2,8 +2,9 @@ import type { ComponentChildren } from 'preact';
|
|
|
2
2
|
import { useCallback, useEffect, useMemo, useState } from 'preact/hooks';
|
|
3
3
|
import { useLocation } from 'wouter-preact';
|
|
4
4
|
import { Navigation } from '../components/navigation';
|
|
5
|
-
import { ALL_NAVIGATION, ALL_OPENAPI, completeFrontMatter, loadMDXFrontMatterForPath, loadAllMDXFrontMatter, ALL_PAGES, pathFromFilename } from '../components/store';
|
|
5
|
+
import { ALL_NAVIGATION, ALL_OPENAPI, ALL_ASYNCAPI, completeFrontMatter, loadMDXFrontMatterForPath, loadAllMDXFrontMatter, ALL_PAGES, pathFromFilename } from '../components/store';
|
|
6
6
|
import { OpenAPI } from '../mdx/open-api';
|
|
7
|
+
import { AsyncAPI } from '../mdx/async-api';
|
|
7
8
|
import { Header } from './header';
|
|
8
9
|
import { PrevNextLinks } from './prev-next-link';
|
|
9
10
|
import { TableOfContents } from './table-of-content';
|
|
@@ -116,6 +117,21 @@ export default function Layout({ children }: LayoutProps) {
|
|
|
116
117
|
return { method: tab.openapi.split(' ')[0], path: tab.openapi.split(' ')[1] };
|
|
117
118
|
}, [tab, loading]);
|
|
118
119
|
|
|
120
|
+
const asyncAPIJSON = useMemo(() => {
|
|
121
|
+
if (tab == null || tab.asyncapi == null) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
const firstDirectory = `/${tab.path.split('/')[1]}`;
|
|
125
|
+
return ALL_ASYNCAPI[`${firstDirectory}/asyncapi.json`].default;
|
|
126
|
+
}, [tab, loading]);
|
|
127
|
+
|
|
128
|
+
const { operation, channel } = useMemo(() => {
|
|
129
|
+
if (tab == null || tab.asyncapi == null) {
|
|
130
|
+
return { operation: '', channel: '' };
|
|
131
|
+
}
|
|
132
|
+
return { operation: tab.asyncapi.split(' ')[0].toLowerCase(), channel: tab.asyncapi.split(' ')[1] };
|
|
133
|
+
}, [tab, loading]);
|
|
134
|
+
|
|
119
135
|
if (loading) return <div className="h-[25vh] flex grow"><Loading /></div>;
|
|
120
136
|
|
|
121
137
|
return (
|
|
@@ -144,20 +160,22 @@ export default function Layout({ children }: LayoutProps) {
|
|
|
144
160
|
)}
|
|
145
161
|
</header>
|
|
146
162
|
{
|
|
147
|
-
openAPIJSON == null &&
|
|
163
|
+
openAPIJSON == null && asyncAPIJSON == null &&
|
|
148
164
|
<Dropdown className='min-w-[120px]' buttonLabel="AI Actions" items={dropdownItems} />
|
|
149
165
|
}
|
|
150
166
|
</div>
|
|
151
167
|
<div className="flex-1 min-h-[calc(100vh-2rem)]">
|
|
152
168
|
{openAPIJSON && tab && "openapi" in tab && method && path ?
|
|
153
169
|
<OpenAPI openAPIJson={JSON.parse(openAPIJSON)} method={method} path={path} />
|
|
170
|
+
: asyncAPIJSON && tab && "asyncapi" in tab && operation && channel ?
|
|
171
|
+
<AsyncAPI asyncAPIJson={JSON.parse(asyncAPIJSON)} operation={operation} channel={channel} />
|
|
154
172
|
: children}
|
|
155
173
|
</div>
|
|
156
174
|
<PrevNextLinks />
|
|
157
175
|
</article>
|
|
158
176
|
</div>
|
|
159
177
|
{
|
|
160
|
-
openAPIJSON == null &&
|
|
178
|
+
openAPIJSON == null && asyncAPIJSON == null &&
|
|
161
179
|
<TableOfContents />
|
|
162
180
|
}
|
|
163
181
|
</main>
|