@emeryld/rrroutes-openapi 2.3.1 → 2.3.3
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/README.md +21 -10
- package/dist/docs/LeafDocsPage.d.ts +3 -23
- package/dist/docs/docs.d.ts +4 -7
- package/dist/docs/schemaIntrospection.d.ts +4 -13
- package/dist/docs/serializer.d.ts +5 -19
- package/dist/index.cjs +468 -670
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +30 -105
- package/dist/index.mjs +471 -670
- package/dist/index.mjs.map +1 -1
- package/dist/public/assets/docs.css +1 -1
- package/dist/public/assets/docs.js +260 -21
- package/dist/web/app.d.ts +1 -8
- package/dist/web/main.d.ts +1 -1
- package/dist/web/utils/grouping.d.ts +2 -8
- package/dist/web/utils/security.d.ts +21 -0
- package/dist/web/utils/types.d.ts +17 -0
- package/dist/web/v2/AppShell.d.ts +7 -0
- package/dist/web/v2/components/JsonInput.d.ts +10 -0
- package/dist/web/v2/components/JsonViewer.d.ts +12 -0
- package/dist/web/v2/components/MethodBadge.d.ts +4 -0
- package/dist/web/v2/components/New/HttpMethodChip.d.ts +7 -0
- package/dist/web/v2/components/New/ListToolBar.d.ts +11 -0
- package/dist/web/v2/components/New/MethodFiltersChips.d.ts +7 -0
- package/dist/web/v2/components/New/RequestStatusChip.d.ts +6 -0
- package/dist/web/v2/components/New/SplitPageLayout.d.ts +7 -0
- package/dist/web/v2/components/New/StabilityChip.d.ts +7 -0
- package/dist/web/v2/components/New/StatusRangeFilter.d.ts +8 -0
- package/dist/web/v2/components/RecordItem.d.ts +34 -0
- package/dist/web/v2/components/ResizableSidePanel.d.ts +12 -0
- package/dist/web/v2/components/SchemaTable.d.ts +5 -0
- package/dist/web/v2/components/SectionHeader.d.ts +9 -0
- package/dist/web/v2/endpoints/EndpointDetailsPanel.d.ts +5 -0
- package/dist/web/v2/endpoints/EndpointList.d.ts +12 -0
- package/dist/web/v2/endpoints/EndpointsPage.d.ts +4 -0
- package/dist/web/v2/endpoints/endpoints.utils.d.ts +3 -0
- package/dist/web/v2/stores/clientStore.d.ts +48 -0
- package/dist/web/v2/theme.d.ts +21 -0
- package/dist/web/v2/types/types.base.d.ts +30 -0
- package/dist/web/v2/types/types.cacheLog.d.ts +165 -0
- package/dist/web/v2/types/types.endpoint.d.ts +326 -0
- package/dist/web/v2/types/types.log.d.ts +119 -0
- package/dist/web/v2/types/types.preset.d.ts +251 -0
- package/dist/web/v2/types/types.requestLog.d.ts +264 -0
- package/package.json +16 -5
- package/dist/docs/presets.d.ts +0 -14
- package/dist/web/components/Analytics.d.ts +0 -68
- package/dist/web/components/CopyablePre.d.ts +0 -7
- package/dist/web/components/EndpointCard.d.ts +0 -10
- package/dist/web/components/Filters.d.ts +0 -9
- package/dist/web/components/FiltersBar.d.ts +0 -25
- package/dist/web/components/HelperEnumInput.d.ts +0 -11
- package/dist/web/components/HistoryView.d.ts +0 -7
- package/dist/web/components/LogsView.d.ts +0 -1
- package/dist/web/components/PlaygroundOverlay.d.ts +0 -94
- package/dist/web/components/PresetsView.d.ts +0 -15
- package/dist/web/components/RequestLogs.d.ts +0 -10
- package/dist/web/components/SchemaTable.d.ts +0 -4
- package/dist/web/components/ui/Button.d.ts +0 -8
- package/dist/web/components/ui/Clickable.d.ts +0 -7
- package/dist/web/components/ui/Tag.d.ts +0 -9
- package/dist/web/components/ui/Text.d.ts +0 -8
- package/dist/web/components/ui/index.d.ts +0 -4
- package/dist/web/historyStore.d.ts +0 -68
- package/dist/web/logsStore.d.ts +0 -51
- package/dist/web/types.d.ts +0 -5
- package/dist/webhooks.d.ts +0 -181
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
RRRoutes docs + “try it” playground, shipped as static assets plus a thin Express helper. The UI is React-based and reads the serialized registry you provide (no OpenAPI YAML needed).
|
|
4
4
|
|
|
5
5
|
## What you get
|
|
6
|
+
|
|
6
7
|
- React docs UI (filters, grouping, schema tables) with a built-in playground for hitting your endpoints.
|
|
7
8
|
- Express helper that mounts the docs page and serves the built assets.
|
|
8
9
|
- Playground inputs share a base URL and let you set custom request headers across calls.
|
|
@@ -11,23 +12,24 @@ RRRoutes docs + “try it” playground, shipped as static assets plus a thin Ex
|
|
|
11
12
|
## Quick start (Express)
|
|
12
13
|
|
|
13
14
|
```ts
|
|
14
|
-
import express from 'express'
|
|
15
|
-
import { finalize } from '@emeryld/rrroutes-contract'
|
|
16
|
-
import { mountRRRoutesDocs } from '@emeryld/rrroutes-openapi'
|
|
17
|
-
import { leaves } from './contract'
|
|
15
|
+
import express from 'express'
|
|
16
|
+
import { finalize } from '@emeryld/rrroutes-contract'
|
|
17
|
+
import { mountRRRoutesDocs } from '@emeryld/rrroutes-openapi'
|
|
18
|
+
import { leaves } from './contract'
|
|
18
19
|
|
|
19
|
-
const registry = finalize(leaves)
|
|
20
|
-
const router = express.Router()
|
|
20
|
+
const registry = finalize(leaves)
|
|
21
|
+
const router = express.Router()
|
|
21
22
|
|
|
22
23
|
// Mounts page at /__rrroutes/docs and serves JS/CSS from /__rrroutes/docs/assets
|
|
23
24
|
mountRRRoutesDocs({
|
|
24
25
|
router,
|
|
25
26
|
leaves: registry.all,
|
|
26
27
|
options: { path: '/__rrroutes/docs' },
|
|
27
|
-
})
|
|
28
|
+
})
|
|
28
29
|
```
|
|
29
30
|
|
|
30
31
|
### Options (server)
|
|
32
|
+
|
|
31
33
|
- `path` (default `/__rrroutes/docs`): where the page is mounted.
|
|
32
34
|
- `assetBasePath` (default `${path}/assets`): where the static JS/CSS are served from.
|
|
33
35
|
- `csp` (default `true`): emit a CSP header + nonce.
|
|
@@ -40,18 +42,26 @@ mountRRRoutesDocs({
|
|
|
40
42
|
If you want to control rendering:
|
|
41
43
|
|
|
42
44
|
```ts
|
|
43
|
-
import {
|
|
45
|
+
import {
|
|
46
|
+
createLeafDocsDocument,
|
|
47
|
+
renderLeafDocsHTML,
|
|
48
|
+
} from '@emeryld/rrroutes-openapi'
|
|
44
49
|
|
|
45
50
|
// React element – mount into your own tree
|
|
46
|
-
const element = createLeafDocsDocument(registry.all, {
|
|
51
|
+
const element = createLeafDocsDocument(registry.all, {
|
|
52
|
+
assetBasePath: '/__rrroutes/docs/assets',
|
|
53
|
+
})
|
|
47
54
|
|
|
48
55
|
// Or prerender to a string
|
|
49
|
-
const html = renderLeafDocsHTML(registry.all, {
|
|
56
|
+
const html = renderLeafDocsHTML(registry.all, {
|
|
57
|
+
assetBasePath: '/__rrroutes/docs/assets',
|
|
58
|
+
})
|
|
50
59
|
```
|
|
51
60
|
|
|
52
61
|
## Data shape
|
|
53
62
|
|
|
54
63
|
The docs UI expects serialized leaves from `@emeryld/rrroutes-contract`. Each leaf includes:
|
|
64
|
+
|
|
55
65
|
- `method`, `path`, and `cfg` (summary, description, tags, docsGroup, stability, deprecated, docsMeta, feed)
|
|
56
66
|
- Optional Zod schemas for params/query/body/output; these are introspected into a serializable AST for schema tables.
|
|
57
67
|
|
|
@@ -64,5 +74,6 @@ pnpm run build # Builds node bundle + types + web assets to dist/public
|
|
|
64
74
|
```
|
|
65
75
|
|
|
66
76
|
Published package contents:
|
|
77
|
+
|
|
67
78
|
- `dist/index.{mjs,cjs,d.ts}`: server helper + exports
|
|
68
79
|
- `dist/public/assets/docs.{js,css}`: the docs UI bundle served by `mountRRRoutesDocs`
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import type { AnyLeaf } from '@emeryld/rrroutes-contract';
|
|
2
1
|
import type { ReactElement } from 'react';
|
|
3
|
-
import type { SerializablePreset } from './presets.js';
|
|
4
|
-
import type { WebhookPaths } from '../webhooks.js';
|
|
5
|
-
import type { LogFeedEntry } from '../webhooks.js';
|
|
6
2
|
export interface RenderOptions {
|
|
7
3
|
/** CSP nonce applied to data + script tags. */
|
|
8
4
|
cspNonce?: string;
|
|
@@ -10,31 +6,15 @@ export interface RenderOptions {
|
|
|
10
6
|
assetBasePath?: string;
|
|
11
7
|
/** Root path where the docs are mounted (e.g. `/__rrroutes/docs`). Used for client routing. */
|
|
12
8
|
docsBasePath?: string;
|
|
13
|
-
/** Optional suffix appended to the window origin when building default playground base URLs. */
|
|
14
|
-
baseUrlSuffix?: string;
|
|
15
|
-
/** Preset collections rendered into the docs UI. */
|
|
16
|
-
presets?: SerializablePreset[];
|
|
17
|
-
/** Optional seed history entries to pre-populate the UI (useful in dev). */
|
|
18
|
-
historySeeds?: SerializableHistoryEntry[];
|
|
19
|
-
/** Optional seed log entries to pre-populate the logs UI. */
|
|
20
|
-
logSeeds?: LogFeedEntry[];
|
|
21
|
-
/** Paths for webhook-backed history/log feeds. */
|
|
22
|
-
webhooks?: WebhookPaths;
|
|
23
9
|
}
|
|
24
10
|
type DocsDocumentProps = {
|
|
25
|
-
leavesJson: string;
|
|
26
|
-
presetsJson: string;
|
|
27
11
|
assetBase: string;
|
|
28
12
|
docsBase: string;
|
|
29
|
-
historyJson: string;
|
|
30
|
-
logsJson: string;
|
|
31
|
-
baseUrlSuffix?: string;
|
|
32
|
-
webhooks?: WebhookPaths;
|
|
33
13
|
cspNonce?: string;
|
|
34
14
|
};
|
|
35
|
-
export declare const DocsDocument: ({
|
|
36
|
-
export declare function createLeafDocsDocument(
|
|
37
|
-
export declare function renderLeafDocsHTML(
|
|
15
|
+
export declare const DocsDocument: ({ assetBase, docsBase, cspNonce, }: DocsDocumentProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function createLeafDocsDocument(options?: RenderOptions): ReactElement;
|
|
17
|
+
export declare function renderLeafDocsHTML(options?: RenderOptions): string;
|
|
38
18
|
export type SerializableHistoryEntry = {
|
|
39
19
|
id?: string;
|
|
40
20
|
timestamp: number;
|
package/dist/docs/docs.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export type { RenderOptions
|
|
5
|
-
export { createLeafDocsDocument } from "./LeafDocsPage.js";
|
|
6
|
-
export type { SerializablePreset, SerializablePresetOperation } from "./presets.js";
|
|
7
|
-
export type { LogFeedEntry } from "../webhooks.js";
|
|
1
|
+
import { RenderOptions } from './LeafDocsPage.js';
|
|
2
|
+
export declare function renderLeafDocsHTML(options?: RenderOptions): string;
|
|
3
|
+
export { createLeafDocsDocument } from './LeafDocsPage.js';
|
|
4
|
+
export type { RenderOptions } from './LeafDocsPage.js';
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import * as z from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
optional?: boolean;
|
|
5
|
-
nullable?: boolean;
|
|
6
|
-
description?: string;
|
|
7
|
-
properties?: Record<string, SerializableSchemaNode>;
|
|
8
|
-
element?: SerializableSchemaNode;
|
|
9
|
-
union?: SerializableSchemaNode[];
|
|
10
|
-
literal?: unknown;
|
|
11
|
-
enumValues?: string[];
|
|
12
|
-
};
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import type { SerializableSchema } from '../web/v2/types/types.endpoint.js';
|
|
3
|
+
export type SerializableSchemaNode = SerializableSchema;
|
|
13
4
|
type ZodAny = z.ZodTypeAny;
|
|
14
|
-
export declare function introspectSchema(schema: ZodAny | undefined):
|
|
5
|
+
export declare function introspectSchema(schema: ZodAny | undefined): SerializableSchema | undefined;
|
|
15
6
|
export {};
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
hasParams: boolean;
|
|
7
|
-
hasOutput: boolean;
|
|
8
|
-
bodySchema?: SerializableSchemaNode;
|
|
9
|
-
querySchema?: SerializableSchemaNode;
|
|
10
|
-
paramsSchema?: SerializableSchemaNode;
|
|
11
|
-
outputSchema?: SerializableSchemaNode;
|
|
12
|
-
};
|
|
13
|
-
export type SerializableLeaf = {
|
|
14
|
-
method: string;
|
|
15
|
-
path: string;
|
|
16
|
-
cfg: SerializableMethodCfg;
|
|
17
|
-
};
|
|
18
|
-
export type { SerializableSchemaNode } from "./schemaIntrospection.js";
|
|
19
|
-
export declare function serializeLeaf(leaf: AnyLeaf): SerializableLeaf;
|
|
1
|
+
import { type AnyLeafLowProfile } from '@emeryld/rrroutes-contract';
|
|
2
|
+
import type { Endpoint } from '../web/v2/types/types.endpoint.js';
|
|
3
|
+
export type SerializedLeaf = Endpoint;
|
|
4
|
+
export type { SerializableSchemaNode } from './schemaIntrospection.js';
|
|
5
|
+
export declare function serializeLeaf(leaf: AnyLeafLowProfile): Endpoint;
|