@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.
Files changed (67) hide show
  1. package/README.md +21 -10
  2. package/dist/docs/LeafDocsPage.d.ts +3 -23
  3. package/dist/docs/docs.d.ts +4 -7
  4. package/dist/docs/schemaIntrospection.d.ts +4 -13
  5. package/dist/docs/serializer.d.ts +5 -19
  6. package/dist/index.cjs +468 -670
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.ts +30 -105
  9. package/dist/index.mjs +471 -670
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/public/assets/docs.css +1 -1
  12. package/dist/public/assets/docs.js +260 -21
  13. package/dist/web/app.d.ts +1 -8
  14. package/dist/web/main.d.ts +1 -1
  15. package/dist/web/utils/grouping.d.ts +2 -8
  16. package/dist/web/utils/security.d.ts +21 -0
  17. package/dist/web/utils/types.d.ts +17 -0
  18. package/dist/web/v2/AppShell.d.ts +7 -0
  19. package/dist/web/v2/components/JsonInput.d.ts +10 -0
  20. package/dist/web/v2/components/JsonViewer.d.ts +12 -0
  21. package/dist/web/v2/components/MethodBadge.d.ts +4 -0
  22. package/dist/web/v2/components/New/HttpMethodChip.d.ts +7 -0
  23. package/dist/web/v2/components/New/ListToolBar.d.ts +11 -0
  24. package/dist/web/v2/components/New/MethodFiltersChips.d.ts +7 -0
  25. package/dist/web/v2/components/New/RequestStatusChip.d.ts +6 -0
  26. package/dist/web/v2/components/New/SplitPageLayout.d.ts +7 -0
  27. package/dist/web/v2/components/New/StabilityChip.d.ts +7 -0
  28. package/dist/web/v2/components/New/StatusRangeFilter.d.ts +8 -0
  29. package/dist/web/v2/components/RecordItem.d.ts +34 -0
  30. package/dist/web/v2/components/ResizableSidePanel.d.ts +12 -0
  31. package/dist/web/v2/components/SchemaTable.d.ts +5 -0
  32. package/dist/web/v2/components/SectionHeader.d.ts +9 -0
  33. package/dist/web/v2/endpoints/EndpointDetailsPanel.d.ts +5 -0
  34. package/dist/web/v2/endpoints/EndpointList.d.ts +12 -0
  35. package/dist/web/v2/endpoints/EndpointsPage.d.ts +4 -0
  36. package/dist/web/v2/endpoints/endpoints.utils.d.ts +3 -0
  37. package/dist/web/v2/stores/clientStore.d.ts +48 -0
  38. package/dist/web/v2/theme.d.ts +21 -0
  39. package/dist/web/v2/types/types.base.d.ts +30 -0
  40. package/dist/web/v2/types/types.cacheLog.d.ts +165 -0
  41. package/dist/web/v2/types/types.endpoint.d.ts +326 -0
  42. package/dist/web/v2/types/types.log.d.ts +119 -0
  43. package/dist/web/v2/types/types.preset.d.ts +251 -0
  44. package/dist/web/v2/types/types.requestLog.d.ts +264 -0
  45. package/package.json +16 -5
  46. package/dist/docs/presets.d.ts +0 -14
  47. package/dist/web/components/Analytics.d.ts +0 -68
  48. package/dist/web/components/CopyablePre.d.ts +0 -7
  49. package/dist/web/components/EndpointCard.d.ts +0 -10
  50. package/dist/web/components/Filters.d.ts +0 -9
  51. package/dist/web/components/FiltersBar.d.ts +0 -25
  52. package/dist/web/components/HelperEnumInput.d.ts +0 -11
  53. package/dist/web/components/HistoryView.d.ts +0 -7
  54. package/dist/web/components/LogsView.d.ts +0 -1
  55. package/dist/web/components/PlaygroundOverlay.d.ts +0 -94
  56. package/dist/web/components/PresetsView.d.ts +0 -15
  57. package/dist/web/components/RequestLogs.d.ts +0 -10
  58. package/dist/web/components/SchemaTable.d.ts +0 -4
  59. package/dist/web/components/ui/Button.d.ts +0 -8
  60. package/dist/web/components/ui/Clickable.d.ts +0 -7
  61. package/dist/web/components/ui/Tag.d.ts +0 -9
  62. package/dist/web/components/ui/Text.d.ts +0 -8
  63. package/dist/web/components/ui/index.d.ts +0 -4
  64. package/dist/web/historyStore.d.ts +0 -68
  65. package/dist/web/logsStore.d.ts +0 -51
  66. package/dist/web/types.d.ts +0 -5
  67. 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 { createLeafDocsDocument, renderLeafDocsHTML } from '@emeryld/rrroutes-openapi';
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, { assetBasePath: '/__rrroutes/docs/assets' });
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, { assetBasePath: '/__rrroutes/docs/assets' });
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: ({ leavesJson, presetsJson, assetBase, docsBase, historyJson, logsJson, baseUrlSuffix, webhooks, cspNonce, }: DocsDocumentProps) => import("react/jsx-runtime").JSX.Element;
36
- export declare function createLeafDocsDocument(leaves: AnyLeaf[], options?: RenderOptions): ReactElement;
37
- export declare function renderLeafDocsHTML(leaves: AnyLeaf[], options?: RenderOptions): string;
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;
@@ -1,7 +1,4 @@
1
- import type { AnyLeaf } from "@emeryld/rrroutes-contract";
2
- import { RenderOptions } from "./LeafDocsPage.js";
3
- export declare function renderLeafDocsHTML(leaves: AnyLeaf[], options?: RenderOptions): string;
4
- export type { RenderOptions, SerializableHistoryEntry } from "./LeafDocsPage.js";
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 "zod";
2
- export type SerializableSchemaNode = {
3
- kind: string;
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): SerializableSchemaNode | undefined;
5
+ export declare function introspectSchema(schema: ZodAny | undefined): SerializableSchema | undefined;
15
6
  export {};
@@ -1,19 +1,5 @@
1
- import type { AnyLeaf, MethodCfg } from "@emeryld/rrroutes-contract";
2
- import { SerializableSchemaNode } from "./schemaIntrospection.js";
3
- type SerializableMethodCfg = Pick<MethodCfg, "description" | "summary" | "docsGroup" | "tags" | "deprecated" | "stability" | "feed" | "docsMeta"> & {
4
- hasBody: boolean;
5
- hasQuery: boolean;
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;