@emeryld/rrroutes-openapi 2.5.5 → 2.5.7

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 (28) hide show
  1. package/dist/index.cjs +10 -0
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.mjs +10 -0
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/public/assets/docs.js +87 -84
  6. package/dist/web/v2/components/endpoints/EndpointDetailPanel.d.ts +1 -5
  7. package/dist/web/v2/components/endpoints/EndpointPlayground.d.ts +11 -11
  8. package/dist/web/v2/components/endpoints/KeyValueEditor.d.ts +14 -0
  9. package/dist/web/v2/components/endpoints/PlaygroundEditor.d.ts +19 -0
  10. package/dist/web/v2/components/endpoints/PlaygroundRunPanel.d.ts +12 -0
  11. package/dist/web/v2/components/endpoints/PlaygroundTopTabs.d.ts +11 -0
  12. package/dist/web/v2/components/endpoints/usePlaygroundRunner.d.ts +8 -0
  13. package/dist/web/v2/components/inputs/JsonInputWithTools.d.ts +10 -0
  14. package/dist/web/v2/components/playgroundOverlay/PlaygroundOverlayLayout.d.ts +13 -0
  15. package/dist/web/v2/components/playgroundOverlay/useMeasuredElement.d.ts +10 -0
  16. package/dist/web/v2/{sockets → components/sockets}/SocketEventDetailModal.d.ts +1 -1
  17. package/dist/web/v2/{sockets → components/sockets}/SocketEventsTable.d.ts +1 -1
  18. package/dist/web/v2/pages/EndpointPlaygroundPage.d.ts +1 -0
  19. package/dist/web/v2/stores/clientStore.d.ts +5 -0
  20. package/dist/web/v2/stores/playgroundSettingsStore.d.ts +12 -0
  21. package/dist/web/v2/stores/playgroundStore.d.ts +53 -11
  22. package/dist/web/v2/utils/dates.d.ts +1 -0
  23. package/dist/web/v2/utils/endpoints.d.ts +1 -1
  24. package/dist/web/v2/utils/kvRow.d.ts +15 -0
  25. package/dist/web/v2/utils/schemaDefaults.d.ts +7 -0
  26. package/package.json +2 -2
  27. /package/dist/web/v2/{sockets → components/sockets}/SocketEventsSection.d.ts +0 -0
  28. /package/dist/web/v2/{sockets → components/sockets}/SocketPlayground.d.ts +0 -0
@@ -1,12 +1,8 @@
1
- import type { PlaygroundInputs } from '../../stores/clientStore.js';
2
- import type { EndpointType } from '../../types/types.endpoint.js';
3
1
  import { type EndpointTabKey } from '../../utils/endpoints.js';
4
2
  type EndpointDetailPanelProps = {
5
3
  endpointId?: string | null;
6
- onOpenStandalone?: (endpoint: EndpointType, inputs: PlaygroundInputs) => void;
7
- hidePlaygroundTab?: boolean;
8
4
  activeTab?: EndpointTabKey;
9
5
  onTabChange?: (tab: EndpointTabKey) => void;
10
6
  };
11
- export default function EndpointDetailPanel({ endpointId, onOpenStandalone, hidePlaygroundTab, activeTab, onTabChange, }: EndpointDetailPanelProps): import("react/jsx-runtime").JSX.Element;
7
+ export default function EndpointDetailPanel({ endpointId, activeTab, onTabChange, }: EndpointDetailPanelProps): import("react/jsx-runtime").JSX.Element;
12
8
  export {};
@@ -1,16 +1,16 @@
1
+ import { ReactNode } from 'react';
1
2
  import { PlaygroundInputs } from '../../stores/clientStore.js';
2
- import { SerializableSchema } from '../../types/types.endpoint.js';
3
- import type { MethodType } from '../../types/types.base.js';
3
+ import { PlaygroundRouteMeta } from '../../stores/playgroundStore.js';
4
4
  type EndpointPlaygroundProps = {
5
- method: MethodType;
6
- path: string;
7
- contract?: {
8
- body?: SerializableSchema;
9
- query?: SerializableSchema;
10
- params?: SerializableSchema;
11
- };
12
- summary?: string;
5
+ initialRoute?: PlaygroundRouteMeta;
6
+ initialLabel?: string;
13
7
  onOpenStandalone?: (inputs: PlaygroundInputs) => void;
8
+ renderLayout: (slots: {
9
+ topOverlay: ReactNode;
10
+ bottomOverlay: ReactNode | null;
11
+ content: ReactNode;
12
+ settingsButton: ReactNode;
13
+ }) => ReactNode;
14
14
  };
15
- export default function EndpointPlayground({ method, path, contract, summary, onOpenStandalone, }: EndpointPlaygroundProps): import("react/jsx-runtime").JSX.Element;
15
+ export default function EndpointPlayground({ initialRoute, initialLabel, onOpenStandalone, renderLayout, }: EndpointPlaygroundProps): import("react/jsx-runtime").JSX.Element;
16
16
  export {};
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ import { PlaygroundKeyValueRow } from '../../stores/playgroundStore.js';
3
+ type KeyValueEditorProps = {
4
+ title: string;
5
+ rows: PlaygroundKeyValueRow[];
6
+ onChange: (rows: PlaygroundKeyValueRow[]) => void;
7
+ actions?: ReactNode;
8
+ defaultExpanded?: boolean;
9
+ disableAccordion?: boolean;
10
+ summaryToggleButton?: ReactNode;
11
+ showFieldMeta?: boolean;
12
+ };
13
+ export default function KeyValueEditor({ title, rows, onChange, actions, defaultExpanded, disableAccordion, summaryToggleButton, showFieldMeta, }: KeyValueEditorProps): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,19 @@
1
+ import { PlaygroundKeyValueRow, PlaygroundTab } from '../../stores/playgroundStore.js';
2
+ import { SerializableSchema } from '../../types/types.endpoint.js';
3
+ import { type EndpointOption } from '../../utils/endpoints.js';
4
+ import type { PlaygroundRunnerResult } from './usePlaygroundRunner.js';
5
+ type PlaygroundEditorProps = {
6
+ tab: PlaygroundTab;
7
+ onUpdateTab: (updater: (prev: PlaygroundTab) => PlaygroundTab) => void;
8
+ endpointOptions: EndpointOption[];
9
+ isOptionsLoading: boolean;
10
+ onSearchChange: (term: string) => void;
11
+ onEndpointSelect: (selection: EndpointOption | string | null) => void;
12
+ runner: PlaygroundRunnerResult | null;
13
+ };
14
+ export default function PlaygroundEditor({ tab, onUpdateTab, endpointOptions, isOptionsLoading, onSearchChange, onEndpointSelect, runner, }: PlaygroundEditorProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function mergeRows(baseRows: PlaygroundKeyValueRow[], values?: Record<string, unknown>): PlaygroundKeyValueRow[];
16
+ export declare function buildKeyValueRows(schema?: SerializableSchema): PlaygroundKeyValueRow[];
17
+ export declare function rowsToRecord(rows: PlaygroundKeyValueRow[]): Record<string, string>;
18
+ export declare function formatBodyValue(value: unknown, hasSchema: boolean): string;
19
+ export {};
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ import { PlaygroundInputs } from '../../stores/clientStore.js';
3
+ import { PlaygroundTab } from '../../stores/playgroundStore.js';
4
+ type PlaygroundRunPanelProps = {
5
+ tab: PlaygroundTab;
6
+ isRunning: boolean;
7
+ onRun: () => void;
8
+ onOpenStandalone?: (inputs: PlaygroundInputs) => void;
9
+ runButtonSlot?: ReactNode;
10
+ };
11
+ export default function PlaygroundRunPanel({ tab, isRunning, onRun, onOpenStandalone, runButtonSlot, }: PlaygroundRunPanelProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { PlaygroundTab } from '../../stores/playgroundStore.js';
2
+ type PlaygroundTopTabsProps = {
3
+ tabs: PlaygroundTab[];
4
+ activeTabId: string | null;
5
+ isLoading: boolean;
6
+ onSelect: (tabId: string) => void;
7
+ onAdd: () => void;
8
+ onClose: (tabId: string) => void;
9
+ };
10
+ export default function PlaygroundTopTabs({ tabs, activeTabId, isLoading, onSelect, onAdd, onClose, }: PlaygroundTopTabsProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,8 @@
1
+ import { PlaygroundTab } from '../../stores/playgroundStore.js';
2
+ export type PlaygroundRunnerResult = {
3
+ isRunning: boolean;
4
+ bodyError: string | null;
5
+ setBodyError: (value: string | null) => void;
6
+ run: () => Promise<void>;
7
+ };
8
+ export declare function usePlaygroundRunner(tab: PlaygroundTab | null, onUpdateTab: (updater: (prev: PlaygroundTab) => PlaygroundTab) => void): PlaygroundRunnerResult;
@@ -0,0 +1,10 @@
1
+ type JsonInputWithToolsProps = {
2
+ value: string;
3
+ onChange: (next: string) => void;
4
+ placeholder?: string;
5
+ minRows?: number;
6
+ error?: boolean;
7
+ helperText?: string;
8
+ };
9
+ export default function JsonInputWithTools({ value, onChange, placeholder, minRows, error, helperText, }: JsonInputWithToolsProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ type PlaygroundOverlayLayoutProps = {
3
+ top?: ReactNode;
4
+ bottom?: ReactNode;
5
+ children: ReactNode;
6
+ };
7
+ /**
8
+ * Layout component that renders optional fixed overlays above and below
9
+ * the playground content. It measures overlay heights and applies equivalent
10
+ * padding so scrollable content never hides underneath them.
11
+ */
12
+ export default function PlaygroundOverlayLayout({ top, bottom, children, }: PlaygroundOverlayLayoutProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,10 @@
1
+ type UseMeasuredElementResult<T extends HTMLElement> = {
2
+ ref: (node: T | null) => void;
3
+ height: number;
4
+ };
5
+ /**
6
+ * Observes an element with ResizeObserver and exposes its current height.
7
+ * Useful for aligning spacer padding with overlay content height.
8
+ */
9
+ export declare function useMeasuredElement<T extends HTMLElement>(): UseMeasuredElementResult<T>;
10
+ export {};
@@ -1,4 +1,4 @@
1
- import type { SocketEventType } from '../types/types.socket.js';
1
+ import type { SocketEventType } from '../../types/types.socket.js';
2
2
  type SocketEventDetailModalProps = {
3
3
  open: boolean;
4
4
  event: SocketEventType | null;
@@ -1,4 +1,4 @@
1
- import type { SocketEventType } from '../types/types.socket.js';
1
+ import type { SocketEventType } from '../../types/types.socket.js';
2
2
  type SocketEventsTableProps = {
3
3
  events: SocketEventType[];
4
4
  onSelect?: (event: SocketEventType, ordered: SocketEventType[]) => void;
@@ -0,0 +1 @@
1
+ export default function EndpointPlaygroundPage(): import("react/jsx-runtime").JSX.Element;
@@ -24,6 +24,11 @@ export type PlaygroundInputs = {
24
24
  value: string;
25
25
  enabled: boolean;
26
26
  }[];
27
+ headers: {
28
+ key: string;
29
+ value: string;
30
+ enabled: boolean;
31
+ }[];
27
32
  body: string;
28
33
  };
29
34
  type ClientContextValue = {
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ import type { PlaygroundKeyValueRow } from './playgroundStore.js';
3
+ type PlaygroundSettingsContextValue = {
4
+ defaultHeaders: PlaygroundKeyValueRow[];
5
+ setDefaultHeaders: (rows: PlaygroundKeyValueRow[]) => void;
6
+ resetDefaultHeaders: () => void;
7
+ };
8
+ export declare function PlaygroundSettingsProvider({ children, }: {
9
+ children: ReactNode;
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ export declare function usePlaygroundSettings(): PlaygroundSettingsContextValue;
12
+ export {};
@@ -1,5 +1,14 @@
1
1
  import { ReactNode } from 'react';
2
2
  import type { MethodType } from '../types/types.base';
3
+ import type { SerializableSchema, EndpointType } from '../types/types.endpoint';
4
+ export type PlaygroundKeyValueRow = {
5
+ id: string;
6
+ key: string;
7
+ value: string;
8
+ enabled: boolean;
9
+ typeHint?: string;
10
+ description?: string;
11
+ };
3
12
  export type PlaygroundRunRecord = {
4
13
  id: string;
5
14
  method: MethodType;
@@ -17,7 +26,45 @@ export type PlaygroundRunRecord = {
17
26
  headers?: Record<string, string>;
18
27
  };
19
28
  };
20
- type PlaygroundRunsContextValue = {
29
+ export type PlaygroundRouteContract = {
30
+ body?: SerializableSchema;
31
+ query?: SerializableSchema;
32
+ params?: SerializableSchema;
33
+ };
34
+ export type PlaygroundRouteMeta = {
35
+ method: MethodType;
36
+ path: string;
37
+ summary?: string;
38
+ contract?: PlaygroundRouteContract;
39
+ stability?: EndpointType['stability'];
40
+ };
41
+ export type PlaygroundTab = {
42
+ id: string;
43
+ name: string;
44
+ url: string;
45
+ method: MethodType;
46
+ params: PlaygroundKeyValueRow[];
47
+ query: PlaygroundKeyValueRow[];
48
+ headers: PlaygroundKeyValueRow[];
49
+ body: string;
50
+ latestResponse: PlaygroundRunRecord | null;
51
+ route?: PlaygroundRouteMeta;
52
+ };
53
+ export type PlaygroundTabsState = {
54
+ tabs: PlaygroundTab[];
55
+ activeTabId: string | null;
56
+ };
57
+ export type PlaygroundPrefill = {
58
+ method?: MethodType;
59
+ path?: string;
60
+ params?: Record<string, unknown>;
61
+ query?: Record<string, unknown>;
62
+ body?: unknown;
63
+ headers?: Record<string, unknown>;
64
+ leafKey?: string;
65
+ tabName?: string;
66
+ };
67
+ type PlaygroundContextValue = {
21
68
  runs: PlaygroundRunRecord[];
22
69
  addRun: (run: PlaygroundRunRecord) => void;
23
70
  getLastRun: (args: {
@@ -31,17 +78,12 @@ type PlaygroundRunsContextValue = {
31
78
  path?: string;
32
79
  leafKey?: string;
33
80
  }) => PlaygroundPrefill | null;
81
+ prefillVersion: number;
82
+ tabsState: PlaygroundTabsState;
83
+ updateTabsState: (updater: PlaygroundTabsState | ((prev: PlaygroundTabsState) => PlaygroundTabsState)) => void;
34
84
  };
35
- export type PlaygroundPrefill = {
36
- method?: MethodType;
37
- path?: string;
38
- params?: Record<string, unknown>;
39
- query?: Record<string, unknown>;
40
- body?: unknown;
41
- leafKey?: string;
42
- };
43
- export declare function PlaygroundRunsProvider({ children, }: {
85
+ export declare function PlaygroundProvider({ children }: {
44
86
  children: ReactNode;
45
87
  }): import("react/jsx-runtime").JSX.Element;
46
- export declare function usePlaygroundRuns(): PlaygroundRunsContextValue;
88
+ export declare function usePlayground(): PlaygroundContextValue;
47
89
  export {};
@@ -0,0 +1 @@
1
+ export declare function nowIso(): string;
@@ -1,6 +1,6 @@
1
1
  import type { EndpointType } from '../types/types.endpoint.js';
2
2
  import { type MethodType } from '../types/types.base.js';
3
- export type EndpointTabKey = 'request' | 'response' | 'meta' | 'metrics' | 'playground';
3
+ export type EndpointTabKey = 'request' | 'response' | 'meta' | 'metrics';
4
4
  export type EndpointPanelLayout = 'split' | 'details' | 'playground';
5
5
  export declare const ENDPOINT_TAB_QUERY_KEY = "tab";
6
6
  export declare const ENDPOINT_LAYOUT_QUERY_KEY = "layout";
@@ -0,0 +1,15 @@
1
+ import type { PlaygroundKeyValueRow } from '../stores/playgroundStore.js';
2
+ export declare function makeRowId(): string;
3
+ type CreateRowArgs = {
4
+ id?: string;
5
+ key?: string;
6
+ value?: string;
7
+ enabled?: boolean;
8
+ typeHint?: string;
9
+ description?: string;
10
+ };
11
+ export declare function createKeyValueRow({ id, key, value, enabled, typeHint, description, }?: CreateRowArgs): PlaygroundKeyValueRow;
12
+ export declare function cloneKeyValueRows(rows: PlaygroundKeyValueRow[], { preserveIds }?: {
13
+ preserveIds?: boolean;
14
+ }): PlaygroundKeyValueRow[];
15
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { PlaygroundKeyValueRow } from '../stores/playgroundStore.js';
2
+ import type { SerializableSchema } from '../types/types.endpoint.js';
3
+ export declare function describeSchemaType(schema?: SerializableSchema): string | undefined;
4
+ export declare function scaffoldBodyFromSchema(schema?: SerializableSchema): unknown;
5
+ export declare function scaffoldKeyValue(schema?: SerializableSchema): string;
6
+ export declare function fillRowDefaults(rows: PlaygroundKeyValueRow[], schema?: SerializableSchema): PlaygroundKeyValueRow[];
7
+ export declare function fillJsonDefaults(existing: unknown, schema?: SerializableSchema): unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emeryld/rrroutes-openapi",
3
- "version": "2.5.5",
3
+ "version": "2.5.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -17,7 +17,7 @@
17
17
  "dist"
18
18
  ],
19
19
  "dependencies": {
20
- "@emeryld/rrroutes-client": "^2.5.0",
20
+ "@emeryld/rrroutes-client": "^2.5.2",
21
21
  "@emeryld/rrroutes-contract": "^2.5.0",
22
22
  "@emotion/cache": "^11.14.0",
23
23
  "@emotion/react": "^11.14.0",