@motiadev/plugin-endpoint 0.8.2-beta.140-957262 → 0.8.2-beta.140-111855
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 +12 -12
- package/dist/api/endpoints-stream.d.ts +22 -0
- package/dist/api/endpoints-stream.d.ts.map +1 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/components/configuration-list-item.d.ts.map +1 -1
- package/dist/components/endpoint-badge.d.ts +1 -1
- package/dist/components/endpoint-badge.d.ts.map +1 -1
- package/dist/components/endpoint-item.d.ts.map +1 -1
- package/dist/components/endpoint-path-preview.d.ts.map +1 -1
- package/dist/components/endpoint-path.d.ts.map +1 -1
- package/dist/components/endpoint-tab-label.d.ts +1 -1
- package/dist/components/flow-group.d.ts.map +1 -1
- package/dist/components/json-editor.d.ts.map +1 -1
- package/dist/hooks/use-endpoint-configuration.d.ts +3 -3
- package/dist/hooks/use-get-endpoints.d.ts.map +1 -1
- package/dist/hooks/use-json-schema-to-json.d.ts +1 -1
- package/dist/index.cjs +27 -0
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2243 -9
- package/dist/play/response-code.d.ts.map +1 -1
- package/dist/play/response-content.d.ts +1 -1
- package/dist/play/response-content.d.ts.map +1 -1
- package/dist/play/side-panel-body-tab.d.ts.map +1 -1
- package/dist/play/side-panel-response.d.ts +1 -1
- package/dist/play/side-panel.d.ts.map +1 -1
- package/dist/play/trigger-button.d.ts +1 -1
- package/dist/play/trigger-button.d.ts.map +1 -1
- package/dist/plugin-endpoint.css +1 -0
- package/dist/plugin.cjs +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +67 -0
- package/dist/spec/spec-body-panel.d.ts +0 -2
- package/dist/spec/spec-body-panel.d.ts.map +1 -1
- package/dist/spec/spec-path-params-panel.d.ts.map +1 -1
- package/dist/spec/spec-query-params-panel.d.ts.map +1 -1
- package/dist/spec/spec-response-schema.d.ts.map +1 -1
- package/dist/spec/spec-side-panel.d.ts.map +1 -1
- package/package.json +31 -20
- package/dist/components/configuration-list-item.js +0 -36
- package/dist/components/configuration-list-item.js.map +0 -1
- package/dist/components/endpoint-badge.js +0 -29
- package/dist/components/endpoint-badge.js.map +0 -1
- package/dist/components/endpoint-item.js +0 -5
- package/dist/components/endpoint-item.js.map +0 -1
- package/dist/components/endpoint-path-preview.js +0 -22
- package/dist/components/endpoint-path-preview.js.map +0 -1
- package/dist/components/endpoint-path.js +0 -26
- package/dist/components/endpoint-path.js.map +0 -1
- package/dist/components/endpoint-tab-label.js +0 -6
- package/dist/components/endpoint-tab-label.js.map +0 -1
- package/dist/components/endpoints-search.js +0 -10
- package/dist/components/endpoints-search.js.map +0 -1
- package/dist/components/flow-group.js +0 -13
- package/dist/components/flow-group.js.map +0 -1
- package/dist/components/json-editor.js +0 -105
- package/dist/components/json-editor.js.map +0 -1
- package/dist/endpoints-page.js +0 -29
- package/dist/endpoints-page.js.map +0 -1
- package/dist/hooks/use-endpoint-configuration.js +0 -142
- package/dist/hooks/use-endpoint-configuration.js.map +0 -1
- package/dist/hooks/use-get-endpoints.js +0 -23
- package/dist/hooks/use-get-endpoints.js.map +0 -1
- package/dist/hooks/use-json-schema-to-json.js +0 -12
- package/dist/hooks/use-json-schema-to-json.js.map +0 -1
- package/dist/hooks/use-path-params.js +0 -5
- package/dist/hooks/use-path-params.js.map +0 -1
- package/dist/hooks/use-path-url.js +0 -15
- package/dist/hooks/use-path-url.js.map +0 -1
- package/dist/hooks/use-state-stream.js +0 -19
- package/dist/hooks/use-state-stream.js.map +0 -1
- package/dist/hooks/utils.js +0 -30
- package/dist/hooks/utils.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/play/reponse-code/utils.js +0 -73
- package/dist/play/reponse-code/utils.js.map +0 -1
- package/dist/play/response-code.js +0 -11
- package/dist/play/response-code.js.map +0 -1
- package/dist/play/response-content.js +0 -38
- package/dist/play/response-content.js.map +0 -1
- package/dist/play/side-panel-body-tab.js +0 -23
- package/dist/play/side-panel-body-tab.js.map +0 -1
- package/dist/play/side-panel-headers-tab.js +0 -26
- package/dist/play/side-panel-headers-tab.js.map +0 -1
- package/dist/play/side-panel-params-tab.js +0 -39
- package/dist/play/side-panel-params-tab.js.map +0 -1
- package/dist/play/side-panel-response.js +0 -21
- package/dist/play/side-panel-response.js.map +0 -1
- package/dist/play/side-panel.js +0 -26
- package/dist/play/side-panel.js.map +0 -1
- package/dist/play/trigger-button.js +0 -40
- package/dist/play/trigger-button.js.map +0 -1
- package/dist/spec/spec-body-panel.js +0 -13
- package/dist/spec/spec-body-panel.js.map +0 -1
- package/dist/spec/spec-path-params-panel.js +0 -11
- package/dist/spec/spec-path-params-panel.js.map +0 -1
- package/dist/spec/spec-query-params-panel.js +0 -10
- package/dist/spec/spec-query-params-panel.js.map +0 -1
- package/dist/spec/spec-response-schema.js +0 -18
- package/dist/spec/spec-response-schema.js.map +0 -1
- package/dist/spec/spec-side-panel.js +0 -22
- package/dist/spec/spec-side-panel.js.map +0 -1
- package/dist/styles.css +0 -1108
- package/dist/types/endpoint.js +0 -2
- package/dist/types/endpoint.js.map +0 -1
package/README.md
CHANGED
|
@@ -4,31 +4,31 @@ This package provides React components for the Motia workbench endpoint function
|
|
|
4
4
|
|
|
5
5
|
## TailwindCSS Compilation
|
|
6
6
|
|
|
7
|
-
This package
|
|
7
|
+
This package includes TailwindCSS compilation to ensure all Tailwind classes used in the components are properly compiled and available.
|
|
8
8
|
|
|
9
9
|
### Build Process
|
|
10
10
|
|
|
11
|
-
The build process
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
The build process uses Vite with integrated CSS compilation:
|
|
12
|
+
|
|
13
|
+
1. **Vite Build**: Compiles TypeScript, CSS, and generates type declarations
|
|
14
|
+
2. **Output Formats**: Generates both ES modules and CommonJS formats
|
|
15
|
+
3. **Type Declarations**: Automatically generates `.d.ts` files
|
|
14
16
|
|
|
15
17
|
### Usage
|
|
16
18
|
|
|
17
19
|
To use the compiled styles in consuming packages, import the CSS file:
|
|
18
20
|
|
|
19
21
|
```css
|
|
20
|
-
@import
|
|
22
|
+
@import '@motiadev/plugin-endpoint/styles.css';
|
|
21
23
|
```
|
|
22
24
|
|
|
23
25
|
### Development
|
|
24
26
|
|
|
25
|
-
- `pnpm run build` - Build
|
|
26
|
-
- `pnpm run dev` - Watch mode for
|
|
27
|
-
- `pnpm run
|
|
28
|
-
- `pnpm run dev:css` - Watch mode for CSS only
|
|
27
|
+
- `pnpm run build` - Build all files using Vite
|
|
28
|
+
- `pnpm run dev` - Watch mode for development
|
|
29
|
+
- `pnpm run clean` - Remove the dist directory
|
|
29
30
|
|
|
30
31
|
### Configuration Files
|
|
31
32
|
|
|
32
|
-
- `
|
|
33
|
-
- `
|
|
34
|
-
- `src/styles.css` - Main CSS entry point with Tailwind imports
|
|
33
|
+
- `vite.config.ts` - Vite configuration with TailwindCSS plugin
|
|
34
|
+
- `src/styles.css` - Main CSS entry point with Tailwind imports
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ApiRouteConfig, ApiRouteMethod, JsonSchema, LockedData, QueryParam, Step, StreamAdapter } from '@motiadev/core';
|
|
2
|
+
type ApiEndpoint = {
|
|
3
|
+
id: string;
|
|
4
|
+
method: ApiRouteMethod;
|
|
5
|
+
path: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
queryParams?: QueryParam[];
|
|
8
|
+
responseSchema?: JsonSchema;
|
|
9
|
+
bodySchema?: JsonSchema;
|
|
10
|
+
flows?: string[];
|
|
11
|
+
};
|
|
12
|
+
export declare const mapEndpoint: (step: Step<ApiRouteConfig>) => ApiEndpoint;
|
|
13
|
+
export declare class EndpointsStream extends StreamAdapter<ApiEndpoint> {
|
|
14
|
+
private readonly lockedData;
|
|
15
|
+
constructor(lockedData: LockedData);
|
|
16
|
+
get(_groupId: string, id: string): Promise<ApiEndpoint | null>;
|
|
17
|
+
delete(id: string): Promise<ApiEndpoint>;
|
|
18
|
+
set(_: string, __: string, data: ApiEndpoint): Promise<ApiEndpoint>;
|
|
19
|
+
getGroup(): Promise<ApiEndpoint[]>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=endpoints-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints-stream.d.ts","sourceRoot":"","sources":["../../src/api/endpoints-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,IAAI,EACT,aAAa,EACd,MAAM,gBAAgB,CAAA;AAEvB,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,cAAc,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;IAC1B,cAAc,CAAC,EAAE,UAAU,CAAA;IAC3B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,MAAM,IAAI,CAAC,cAAc,CAAC,KAAG,WAWxD,CAAA;AAED,qBAAa,eAAgB,SAAQ,aAAa,CAAC,WAAW,CAAC;IACjD,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAI7C,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAK9D,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIxC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAInE,QAAQ,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;CAGzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAa,MAAM,gBAAgB,CAAA;AAGhG,wBAAgB,MAAM,CAAC,EAAE,UAAU,EAAE,EAAE,kBAAkB,GAAG,WAAW,CAmDtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration-list-item.d.ts","sourceRoot":"","sources":["../../src/components/configuration-list-item.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAuC,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"configuration-list-item.d.ts","sourceRoot":"","sources":["../../src/components/configuration-list-item.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAuC,MAAM,OAAO,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAE/E,UAAU,0BAA0B;IAClC,KAAK,EAAE,oBAAoB,CAAA;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,KAAK,IAAI,CAAA;IAC5F,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAmFhE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-badge.d.ts","sourceRoot":"","sources":["../../src/components/endpoint-badge.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"endpoint-badge.d.ts","sourceRoot":"","sources":["../../src/components/endpoint-badge.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAEnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAuBvD,UAAU,UAAW,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC/D,OAAO,EAAE,cAAc,CAAA;CACxB;AAED,eAAO,MAAM,aAAa,+DAA2C,UAAU,6CAK7E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-item.d.ts","sourceRoot":"","sources":["../../src/components/endpoint-item.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"endpoint-item.d.ts","sourceRoot":"","sources":["../../src/components/endpoint-item.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAGpD,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,WAAW,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;IACnB,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAgC9C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-path-preview.d.ts","sourceRoot":"","sources":["../../src/components/endpoint-path-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"endpoint-path-preview.d.ts","sourceRoot":"","sources":["../../src/components/endpoint-path-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAY,MAAM,OAAO,CAAA;AAGzC,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAyC5D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-path.d.ts","sourceRoot":"","sources":["../../src/components/endpoint-path.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"endpoint-path.d.ts","sourceRoot":"","sources":["../../src/components/endpoint-path.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAW,MAAM,OAAO,CAAA;AAIxC,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;CACb;AAMD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAiC9C,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const EndpointTabLabel: import(
|
|
1
|
+
export declare const EndpointTabLabel: import('react').MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
2
2
|
//# sourceMappingURL=endpoint-tab-label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-group.d.ts","sourceRoot":"","sources":["../../src/components/flow-group.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"flow-group.d.ts","sourceRoot":"","sources":["../../src/components/flow-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAGpD,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,WAAW,EAAE,CAAA;IACxB,MAAM,EAAE,OAAO,CAAA;IACf,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,gBAAgB,EAAE,MAAM,IAAI,CAAA;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAyDxC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-editor.d.ts","sourceRoot":"","sources":["../../src/components/json-editor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAwC,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"json-editor.d.ts","sourceRoot":"","sources":["../../src/components/json-editor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAwC,MAAM,OAAO,CAAA;AAErE,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACvC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CA4H1C,CAAA"}
|
|
@@ -45,17 +45,17 @@ export declare const getBodySelector: (state: UseEndpointConfiguration) => strin
|
|
|
45
45
|
export declare const getResponseSelector: (state: UseEndpointConfiguration) => ResponseData | undefined;
|
|
46
46
|
export declare const getQueryParamsSelector: (state: UseEndpointConfiguration) => Params;
|
|
47
47
|
export declare const getPathParamsSelector: (state: UseEndpointConfiguration) => Params;
|
|
48
|
-
export declare const useEndpointConfiguration: import(
|
|
48
|
+
export declare const useEndpointConfiguration: import('zustand').UseBoundStore<Omit<Omit<import('zustand').StoreApi<UseEndpointConfiguration>, "setState" | "persist"> & {
|
|
49
49
|
setState(partial: UseEndpointConfiguration | Partial<UseEndpointConfiguration> | ((state: UseEndpointConfiguration) => UseEndpointConfiguration | Partial<UseEndpointConfiguration>), replace?: false | undefined): unknown;
|
|
50
50
|
setState(state: UseEndpointConfiguration | ((state: UseEndpointConfiguration) => UseEndpointConfiguration), replace: true): unknown;
|
|
51
51
|
persist: {
|
|
52
|
-
setOptions: (options: Partial<import(
|
|
52
|
+
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<UseEndpointConfiguration, unknown, unknown>>) => void;
|
|
53
53
|
clearStorage: () => void;
|
|
54
54
|
rehydrate: () => Promise<void> | void;
|
|
55
55
|
hasHydrated: () => boolean;
|
|
56
56
|
onHydrate: (fn: (state: UseEndpointConfiguration) => void) => () => void;
|
|
57
57
|
onFinishHydration: (fn: (state: UseEndpointConfiguration) => void) => () => void;
|
|
58
|
-
getOptions: () => Partial<import(
|
|
58
|
+
getOptions: () => Partial<import('zustand/middleware').PersistOptions<UseEndpointConfiguration, unknown, unknown>>;
|
|
59
59
|
};
|
|
60
60
|
}, "setState" | "devtools"> & {
|
|
61
61
|
setState(partial: UseEndpointConfiguration | Partial<UseEndpointConfiguration> | ((state: UseEndpointConfiguration) => UseEndpointConfiguration | Partial<UseEndpointConfiguration>), replace?: false | undefined, action?: (string | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-get-endpoints.d.ts","sourceRoot":"","sources":["../../src/hooks/use-get-endpoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-get-endpoints.d.ts","sourceRoot":"","sources":["../../src/hooks/use-get-endpoints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,eAAO,MAAM,eAAe;;;CAyB3B,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const useJsonSchemaToJson: (schema: Record<string, any> | undefined) => {
|
|
2
2
|
body: string;
|
|
3
|
-
setBody: import(
|
|
3
|
+
setBody: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
4
4
|
};
|
|
5
5
|
//# sourceMappingURL=use-json-schema-to-json.d.ts.map
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),u=require("@motiadev/ui"),E=require("lucide-react"),Pe=require("zustand"),fe=require("@motiadev/stream-client-react"),be=require("react18-json-view"),ie=require("@monaco-editor/react"),Re=require("react-syntax-highlighter");var B={exports:{}},A={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var le;function _e(){if(le)return A;le=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(s,n,a){var c=null;if(a!==void 0&&(c=""+a),n.key!==void 0&&(c=""+n.key),"key"in n){a={};for(var d in n)d!=="key"&&(a[d]=n[d])}else a=n;return n=a.ref,{$$typeof:e,type:s,key:c,ref:n!==void 0?n:null,props:a}}return A.Fragment=t,A.jsx=o,A.jsxs=o,A}var D={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var ce;function Oe(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&function(){function e(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===Ee?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case m:return"Fragment";case k:return"Profiler";case S:return"StrictMode";case H:return"Suspense";case je:return"SuspenseList";case Ce:return"Activity"}if(typeof i=="object")switch(typeof i.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),i.$$typeof){case j:return"Portal";case P:return(i.displayName||"Context")+".Provider";case y:return(i._context.displayName||"Context")+".Consumer";case F:var b=i.render;return i=i.displayName,i||(i=b.displayName||b.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Se:return b=i.displayName||null,b!==null?b:e(i.type)||"Memo";case ee:b=i._payload,i=i._init;try{return e(i(b))}catch{}}return null}function t(i){return""+i}function o(i){try{t(i);var b=!1}catch{b=!0}if(b){b=console;var w=b.error,T=typeof Symbol=="function"&&Symbol.toStringTag&&i[Symbol.toStringTag]||i.constructor.name||"Object";return w.call(b,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",T),t(i)}}function s(i){if(i===m)return"<>";if(typeof i=="object"&&i!==null&&i.$$typeof===ee)return"<...>";try{var b=e(i);return b?"<"+b+">":"<...>"}catch{return"<...>"}}function n(){var i=U.A;return i===null?null:i.getOwner()}function a(){return Error("react-stack-top-frame")}function c(i){if(te.call(i,"key")){var b=Object.getOwnPropertyDescriptor(i,"key").get;if(b&&b.isReactWarning)return!1}return i.key!==void 0}function d(i,b){function w(){re||(re=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",b))}w.isReactWarning=!0,Object.defineProperty(i,"key",{get:w,configurable:!0})}function g(){var i=e(this.type);return oe[i]||(oe[i]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),i=this.props.ref,i!==void 0?i:null}function f(i,b,w,T,O,_,V,$){return w=_.ref,i={$$typeof:x,type:i,key:b,props:_,_owner:O},(w!==void 0?w:null)!==null?Object.defineProperty(i,"ref",{enumerable:!1,get:g}):Object.defineProperty(i,"ref",{enumerable:!1,value:null}),i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(i,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(i,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.defineProperty(i,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:$}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i}function l(i,b,w,T,O,_,V,$){var N=b.children;if(N!==void 0)if(T)if(Te(N)){for(T=0;T<N.length;T++)v(N[T]);Object.freeze&&Object.freeze(N)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else v(N);if(te.call(b,"key")){N=e(i);var I=Object.keys(b).filter(function(Ne){return Ne!=="key"});T=0<I.length?"{key: someKey, "+I.join(": ..., ")+": ...}":"{key: someKey}",ae[N+T]||(I=0<I.length?"{"+I.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,T,N,I,N),ae[N+T]=!0)}if(N=null,w!==void 0&&(o(w),N=""+w),c(b)&&(o(b.key),N=""+b.key),"key"in b){w={};for(var J in b)J!=="key"&&(w[J]=b[J])}else w=b;return N&&d(w,typeof i=="function"?i.displayName||i.name||"Unknown":i),f(i,N,_,O,n(),w,V,$)}function v(i){typeof i=="object"&&i!==null&&i.$$typeof===x&&i._store&&(i._store.validated=1)}var h=p,x=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),P=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),je=Symbol.for("react.suspense_list"),Se=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),Ce=Symbol.for("react.activity"),Ee=Symbol.for("react.client.reference"),U=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=Object.prototype.hasOwnProperty,Te=Array.isArray,q=console.createTask?console.createTask:function(){return null};h={react_stack_bottom_frame:function(i){return i()}};var re,oe={},ne=h.react_stack_bottom_frame.bind(h,a)(),se=q(s(a)),ae={};D.Fragment=m,D.jsx=function(i,b,w,T,O){var _=1e4>U.recentlyCreatedOwnerStacks++;return l(i,b,w,!1,T,O,_?Error("react-stack-top-frame"):ne,_?q(s(i)):se)},D.jsxs=function(i,b,w,T,O){var _=1e4>U.recentlyCreatedOwnerStacks++;return l(i,b,w,!0,T,O,_?Error("react-stack-top-frame"):ne,_?q(s(i)):se)}}()),D}var de;function Ie(){return de||(de=1,process.env.NODE_ENV==="production"?B.exports=_e():B.exports=Oe()),B.exports}var r=Ie();const Fe=({value:e,onChange:t,onClear:o})=>r.jsx("div",{className:"p-2 border-b gap-4","data-testid":"endpoints-search-container",children:r.jsxs("div",{className:"relative",children:[r.jsx(E.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50"}),r.jsx(u.Input,{variant:"shade",value:e,onChange:s=>t(s.target.value),className:"px-9 font-medium",placeholder:"Search by Method or Path"}),r.jsx(E.X,{className:u.cn("cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground",{visible:e!=="",invisible:e===""}),onClick:o})]})}),Ae=e=>{switch(e.toUpperCase()){case"POST":return"bg-[#258DC3]/15 text-[#258DC3]";case"GET":return"bg-[#709A2D]/15 text-[#709A2D]";case"DELETE":return"bg-[#DE2134]/15 text-[#DE2134]";case"PUT":return"bg-[#B9922D]/15 text-[#B9922D]";case"PATCH":return"bg-[#B9922D]/15 text-[#B9922D]";case"HEAD":return"bg-[#E221DF]/15 text-[#E221DF]";case"OPTIONS":return"bg-[#B9922D]/15 text-[#B9922D]";default:return"bg-[#258DC3]/15 text-[#258DC3]"}},De=p.memo(({className:e,variant:t,...o})=>{const s="rounded-lg px-2 py-0.5 text-xs font-mono font-bold transition-colors",n=Ae(t);return r.jsx("div",{className:u.cn(s,n,e),...o})}),ue=()=>r.jsx("div",{className:"text-muted-foreground",children:"/"}),Q=({method:e,path:t})=>{const o=p.useMemo(()=>{const s=t.split("/").filter(Boolean),n=s.length-1;return s.flatMap((a,c)=>{const d=c===n,g=`part-${a}-${c}`,f=d?void 0:r.jsx(ue,{},`separator-${g}`);return a.startsWith(":")?[r.jsx("div",{className:"bg-[#2862FE]/20 text-[#2862FE] rounded-sm px-1 py-0.5 text-sm font-mono font-bold font-medium",children:a},g),f]:[r.jsx("div",{children:a},g),f]})},[t]);return r.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-2 items-center",children:[r.jsx(De,{variant:e,children:e}),r.jsxs("span",{className:"font-mono font-bold whitespace-nowrap flex flex-row gap-2 items-center truncate",children:[r.jsx(ue,{}),o]})]})},Me=({endpoint:e,isSelected:t,isLast:o,onSelect:s})=>r.jsxs("div",{"data-testid":`endpoint-${e.method}-${e.path}`,onClick:()=>s(e.id),className:u.cn("grid grid-cols-[auto_1fr] items-center justify-center px-[17px] select-none hover:bg-muted-foreground/10 cursor-pointer",t&&"bg-muted-foreground/10"),children:[o?r.jsx("svg",{width:"14",height:"34",viewBox:"0 0 12 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("path",{d:"M6.5 16.5C6.50006 19.2614 8.7386 21.4999 11.5 21.5C11.7759 21.5003 12 21.724 12 22C12 22.276 11.7759 22.4997 11.5 22.5C8.18632 22.4999 5.50006 19.8137 5.5 16.5V0H6.5V16.5Z",className:"fill-[#555]"})}):r.jsx("svg",{width:"14",height:"34",viewBox:"0 0 12 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("path",{d:"M6.5 0V11.5C6.50007 14.2614 8.73861 16.4999 11.5 16.5C11.7759 16.5003 12 16.724 12 17C12 17.276 11.7759 17.4997 11.5 17.5C9.41273 17.5 7.57486 16.4335 6.5 14.8164V34H5.5V0H6.5Z",className:"fill-[#555]"})}),r.jsx("div",{children:r.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-3 px-2",children:[r.jsx(Q,{method:e.method,path:e.path}),r.jsx("span",{className:"text-sm text-muted-foreground truncate",children:e.description})]})})]}),Le=({flow:e,endpoints:t,isOpen:o,isSelected:s,onToggle:n,onClearSelection:a,selectedEndpointId:c,onSelectEndpoint:d})=>r.jsxs("div",{className:"pt-2",children:[r.jsxs("button",{"data-testid":`flow-group-${e}`,className:"w-full grid grid-cols-[auto_1fr] items-center gap-3 hover:bg-muted/40 cursor-pointer min-h-8.5 select-none hover:bg-muted-foreground/10 px-4",onClick:()=>{s&&a(),n(e)},children:[r.jsxs("div",{className:"grid grid-cols-1",children:[r.jsx(E.ChevronDown,{className:u.cn("w-4 h-4 transition-transform duration-300 text-[#555]",{"rotate-180 mt-2.5":o}),strokeWidth:1.5}),r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"2",height:"10",viewBox:"0 0 2 10",fill:"none",className:u.cn("ml-[7px]",{hidden:!o}),children:r.jsx("path",{d:"M1.5 1C1.5 0.723858 1.27614 0.5 1 0.5C0.723858 0.5 0.5 0.723858 0.5 1H1H1.5ZM1 1H0.5V10H1H1.5V1H1Z",className:"fill-[#555]"})})]}),r.jsx("h3",{className:"text-sm font-medium text-left",children:e})]}),r.jsx("div",{className:u.cn("grid grid-cols-1 items-center justify-center",{hidden:!o}),children:t.map((g,f)=>r.jsx(Me,{endpoint:g,isSelected:c===g.id,isLast:f===t.length-1,onSelect:d},g.id))})]}),me={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},M=new Map,z=e=>{const t=M.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([o,s])=>[o,s.getState()])):{}},Be=(e,t,o)=>{if(e===void 0)return{type:"untracked",connection:t.connect(o)};const s=M.get(o.name);if(s)return{type:"tracked",store:e,...s};const n={connection:t.connect(o),stores:{}};return M.set(o.name,n),{type:"tracked",store:e,...n}},ze=(e,t)=>{if(t===void 0)return;const o=M.get(e);o&&(delete o.stores[t],Object.keys(o.stores).length===0&&M.delete(e))},He=e=>{var t,o;if(!e)return;const s=e.split(`
|
|
23
|
+
`),n=s.findIndex(c=>c.includes("api.setState"));if(n<0)return;const a=((t=s[n+1])==null?void 0:t.trim())||"";return(o=/.+ (.+) .+/.exec(a))==null?void 0:o[1]},Ue=(e,t={})=>(o,s,n)=>{const{enabled:a,anonymousActionType:c,store:d,...g}=t;let f;try{f=(a??(me?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!f)return e(o,s,n);const{connection:l,...v}=Be(d,f,g);let h=!0;n.setState=(m,S,k)=>{const y=o(m,S);if(!h)return y;const P=k===void 0?{type:c||He(new Error().stack)||"anonymous"}:typeof k=="string"?{type:k}:k;return d===void 0?(l?.send(P,s()),y):(l?.send({...P,type:`${d}/${P.type}`},{...z(g.name),[d]:n.getState()}),y)},n.devtools={cleanup:()=>{l&&typeof l.unsubscribe=="function"&&l.unsubscribe(),ze(g.name,d)}};const x=(...m)=>{const S=h;h=!1,o(...m),h=S},j=e(n.setState,s,n);if(v.type==="untracked"?l?.init(j):(v.stores[v.store]=n,l?.init(Object.fromEntries(Object.entries(v.stores).map(([m,S])=>[m,m===v.store?j:S.getState()])))),n.dispatchFromDevtools&&typeof n.dispatch=="function"){let m=!1;const S=n.dispatch;n.dispatch=(...k)=>{(me?"production":void 0)!=="production"&&k[0].type==="__setState"&&!m&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),m=!0),S(...k)}}return l.subscribe(m=>{var S;switch(m.type){case"ACTION":if(typeof m.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return W(m.payload,k=>{if(k.type==="__setState"){if(d===void 0){x(k.state);return}Object.keys(k.state).length!==1&&console.error(`
|
|
24
|
+
[zustand devtools middleware] Unsupported __setState action format.
|
|
25
|
+
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
26
|
+
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|
|
27
|
+
`);const y=k.state[d];if(y==null)return;JSON.stringify(n.getState())!==JSON.stringify(y)&&x(y);return}n.dispatchFromDevtools&&typeof n.dispatch=="function"&&n.dispatch(k)});case"DISPATCH":switch(m.payload.type){case"RESET":return x(j),d===void 0?l?.init(n.getState()):l?.init(z(g.name));case"COMMIT":if(d===void 0){l?.init(n.getState());return}return l?.init(z(g.name));case"ROLLBACK":return W(m.state,k=>{if(d===void 0){x(k),l?.init(n.getState());return}x(k[d]),l?.init(z(g.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return W(m.state,k=>{if(d===void 0){x(k);return}JSON.stringify(n.getState())!==JSON.stringify(k[d])&&x(k[d])});case"IMPORT_STATE":{const{nextLiftedState:k}=m.payload,y=(S=k.computedStates.slice(-1)[0])==null?void 0:S.state;if(!y)return;x(d===void 0?y:y[d]),l?.send(null,k);return}case"PAUSE_RECORDING":return h=!h}return}}),j},qe=Ue,W=(e,t)=>{let o;try{o=JSON.parse(e)}catch(s){console.error("[zustand devtools middleware] Could not parse the received json",s)}o!==void 0&&t(o)};function ve(e,t){let o;try{o=e()}catch{return}return{getItem:n=>{var a;const c=g=>g===null?null:JSON.parse(g,void 0),d=(a=o.getItem(n))!=null?a:null;return d instanceof Promise?d.then(c):c(d)},setItem:(n,a)=>o.setItem(n,JSON.stringify(a,void 0)),removeItem:n=>o.removeItem(n)}}const G=e=>t=>{try{const o=e(t);return o instanceof Promise?o:{then(s){return G(s)(o)},catch(s){return this}}}catch(o){return{then(s){return this},catch(s){return G(s)(o)}}}},Ve=(e,t)=>(o,s,n)=>{let a={storage:ve(()=>localStorage),partialize:m=>m,version:0,merge:(m,S)=>({...S,...m}),...t},c=!1;const d=new Set,g=new Set;let f=a.storage;if(!f)return e((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),o(...m)},s,n);const l=()=>{const m=a.partialize({...s()});return f.setItem(a.name,{state:m,version:a.version})},v=n.setState;n.setState=(m,S)=>(v(m,S),l());const h=e((...m)=>(o(...m),l()),s,n);n.getInitialState=()=>h;let x;const j=()=>{var m,S;if(!f)return;c=!1,d.forEach(y=>{var P;return y((P=s())!=null?P:h)});const k=((S=a.onRehydrateStorage)==null?void 0:S.call(a,(m=s())!=null?m:h))||void 0;return G(f.getItem.bind(f))(a.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==a.version){if(a.migrate){const P=a.migrate(y.state,y.version);return P instanceof Promise?P.then(F=>[!0,F]):[!0,P]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,y.state];return[!1,void 0]}).then(y=>{var P;const[F,H]=y;if(x=a.merge(H,(P=s())!=null?P:h),o(x,!0),F)return l()}).then(()=>{k?.(x,void 0),x=s(),c=!0,g.forEach(y=>y(x))}).catch(y=>{k?.(void 0,y)})};return n.persist={setOptions:m=>{a={...a,...m},m.storage&&(f=m.storage)},clearStorage:()=>{f?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>j(),hasHydrated:()=>c,onHydrate:m=>(d.add(m),()=>{d.delete(m)}),onFinishHydration:m=>(g.add(m),()=>{g.delete(m)})},a.skipHydration||j(),x||h},$e=Ve,Y={CONTENT_TYPE:{name:"Content-Type",value:"application/json",active:!0},USER_AGENT:{name:"User-Agent",value:"Motia/1.0",active:!0},ACCEPT:{name:"Accept",value:"application/json",active:!0}},Z=e=>{const t=e.selectedEndpointId;return t&&e.headers[t]||Y},Je=e=>{const t=e.selectedEndpointId;return t?e.bodyIsValid[t]:!0},xe=e=>{const t=e.selectedEndpointId;return t&&e.body[t]||""},ke=e=>{const t=e.selectedEndpointId;if(t)return e.response[t]||void 0},K=e=>{const t=e.selectedEndpointId;return t?e.queryParams[t]||{}:{}},ye=e=>{const t=e.selectedEndpointId;return t?e.pathParams[t]||{}:{}},C=Pe.create()($e(qe(e=>({selectedEndpointId:"",headers:{},body:{},bodyIsValid:{},response:{},queryParams:{},pathParams:{},flowGroupStatus:{},toggleFlowGroupStatus:t=>e(o=>({flowGroupStatus:{...o.flowGroupStatus,[t]:!o.flowGroupStatus[t]}})),setSelectedEndpointId:t=>e({selectedEndpointId:t}),setQueryParams:t=>e(o=>({queryParams:{...o.queryParams,[o.selectedEndpointId]:t}})),removeQueryParams:t=>e(o=>{const s={...o.queryParams[o.selectedEndpointId]};return delete s[t],{queryParams:{...o.queryParams,[o.selectedEndpointId]:s}}}),setPathParams:t=>e(o=>({pathParams:{...o.pathParams,[o.selectedEndpointId]:t}})),removePathParams:t=>e(o=>{const s={...o.pathParams[o.selectedEndpointId]};return delete s[t],{pathParams:{...o.pathParams,[o.selectedEndpointId]:s}}}),setHeaders:t=>e(o=>({headers:{...o.headers,[o.selectedEndpointId]:t}})),setResponse:async(t,o)=>{if(!t){e(n=>({response:{...n.response,[n.selectedEndpointId]:void 0}}));return}let s;try{const n=t?.headers.get("content-type")??"";n.includes("text/")?s=t?await t.text():void 0:n.includes("application/json")?s=t?await t.json():void 0:(s=t?await t.blob():void 0,s.toJSON=()=>"Preview not available")}catch(n){console.error("Error setting response:",n)}e(n=>({response:{...n.response,[n.selectedEndpointId]:{executionTime:Date.now()-o,statusCode:t?.status,headers:t?.headers?Object.fromEntries(t.headers.entries()):{},body:s}}}))},setBody:t=>e(o=>({body:{...o.body,[o.selectedEndpointId]:t}})),removeHeaders:t=>e(o=>{const n={...o.headers[o.selectedEndpointId]||Y};return delete n[t],{headers:{...o.headers,[o.selectedEndpointId]:n}}}),setBodyIsValid:t=>e(o=>({bodyIsValid:{...o.bodyIsValid,[o.selectedEndpointId]:t}}))})),{name:"motia-endpoint-configuration",storage:ve(()=>localStorage)})),We=()=>{const{data:e}=fe.useStreamGroup({streamName:"__motia.api-endpoints",groupId:"default"}),t=p.useMemo(()=>e.reduce((o,s)=>(s.flows?.forEach(n=>{o[n]=o[n]||[],o[n].push(s)}),s.flows?.length==0&&(o["no-flow"]=o["no-flow"]||[],o["no-flow"].push(s)),o),{}),[e]);return{endpoints:e,groupedEndpoints:t}},he=e=>Symbol.iterator in e,pe=e=>"entries"in e,ge=(e,t)=>{const o=e instanceof Map?e:new Map(e.entries()),s=t instanceof Map?t:new Map(t.entries());if(o.size!==s.size)return!1;for(const[n,a]of o)if(!s.has(n)||!Object.is(a,s.get(n)))return!1;return!0},Ge=(e,t)=>{const o=e[Symbol.iterator](),s=t[Symbol.iterator]();let n=o.next(),a=s.next();for(;!n.done&&!a.done;){if(!Object.is(n.value,a.value))return!1;n=o.next(),a=s.next()}return!!n.done&&!!a.done};function Ye(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:he(e)&&he(t)?pe(e)&&pe(t)?ge(e,t):Ge(e,t):ge({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function R(e){const t=p.useRef(void 0);return o=>{const s=e(o);return Ye(t.current,s)?t.current:t.current=s}}const L=e=>{if(!e)return{};if(e.type==="object"){const t={};return e.properties&&Object.entries(e.properties).forEach(([o,s])=>{t[o]=L(s)}),t}switch(e.type){case"array":return[L(e.items)];case"string":return e.enum?.[0]??e.description??"string";case"number":return e.description??0;case"integer":return 0;case"boolean":return e.description??!1;case"null":return e.description??null;default:return}},Xe=e=>{const[t,o]=p.useState("");return p.useEffect(()=>{e&&o(JSON.stringify(L(e),null,2))},[e]),{body:t,setBody:o}},Qe=({endpoint:e,panelName:t,value:o})=>["post","put","patch"].includes(e.method.toLowerCase())?r.jsx(u.Panel,{title:"Body",size:"sm",contentClassName:"p-0","data-testid":`endpoint-body-panel__${t}`,children:r.jsx(be,{src:o?JSON.parse(o):{},theme:"default",enableClipboard:!1,style:{backgroundColor:"transparent"}})}):null,Ze=e=>e.match(/:(\w+)/g)?.map(o=>o.slice(1))??[],Ke=({endpoint:e})=>{const t=Ze(e.path);return t.length?r.jsx(u.Panel,{title:"Path params",size:"sm",variant:"default",children:r.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"1fr 2fr"},children:t.map(o=>r.jsx("div",{className:"font-bold leading-[36px] flex text-xs",children:o},o))})}):null},et=({endpoint:e})=>e.queryParams?.length?r.jsx(u.Panel,{title:"Query params",size:"sm",variant:"outlined",children:r.jsx("div",{className:"grid gap-3",style:{gridTemplateColumns:"1fr 2fr",gridTemplateRows:"1fr 1fr"},children:e.queryParams.map(t=>r.jsxs(p.Fragment,{children:[r.jsx("div",{className:"font-bold leading-[36px] flex text-xs",children:t.name}),r.jsx("div",{className:"flex items-center text-xs ",children:r.jsx("span",{children:t.description})})]},t.name))})}):null,tt=({responseCode:e,bodySchema:t})=>{const o=u.useThemeStore(a=>a.theme),s=p.useMemo(()=>L(t),[t]),n=typeof t.description=="string"?t.description:"";return r.jsx(u.TabsContent,{value:e,className:"border-t",children:r.jsx("div",{className:"text-xs font-mono rounded-lg whitespace-pre-wrap",children:s?r.jsx(be,{src:s,dark:o==="dark",enableClipboard:!1,style:{backgroundColor:"transparent"}}):r.jsx("div",{className:"text-xs font-mono rounded-lg whitespace-pre-wrap p-4",children:n})})},e)},rt=({items:e})=>e.length===0?null:r.jsx("div",{className:"flex flex-col rounded-lg border",children:r.jsxs(u.Tabs,{defaultValue:e[0].responseCode,children:[r.jsx("div",{className:"flex items-center justify-between bg-card",children:r.jsx(u.TabsList,{className:"bg-transparent p-0",children:e.map(t=>r.jsx(u.TabsTrigger,{value:t.responseCode,className:"text-xs font-bold cursor-pointer",children:t.responseCode},t.responseCode))})}),e.map(t=>r.jsx(tt,{...t},t.responseCode))]})}),ot=({endpoint:e,onClose:t})=>{const{body:o}=Xe(e.bodySchema);return r.jsxs(u.Sidebar,{initialWidth:600,subtitle:e.description,title:r.jsx(Q,{method:e.method,path:e.path}),onClose:t,actions:[{icon:r.jsx(E.X,{className:"cursor-pointer w-4 h-4",onClick:t}),onClick:t}],children:[r.jsx(Ke,{endpoint:e}),r.jsx(et,{endpoint:e}),r.jsx(Qe,{endpoint:e,panelName:"details",value:o}),r.jsx(rt,{items:Object.entries(e?.responseSchema??{}).map(([s,n])=>({responseCode:s,bodySchema:n}))})]})},nt=({value:e,schema:t,onChange:o,onValidate:s,language:n="json",readOnly:a=!1})=>{const c=ie.useMonaco(),d=u.useThemeStore(h=>h.theme),g=p.useMemo(()=>d==="dark"?"transparent-dark":"transparent-light",[d]),[f,l]=p.useState(null),v=p.useRef(null);return p.useEffect(()=>{c&&(c.editor.defineTheme("transparent-light",{base:"vs",inherit:!0,rules:[],colors:{"editor.background":"#00000000","editor.lineHighlightBackground":"#00000000","editorLineNumber.foreground":"#999999","editorLineNumber.activeForeground":"#000000",focusBorder:"#00000000","widget.border":"#00000000","editor.border":"#00000000","editorWidget.border":"#00000000"}}),c.editor.defineTheme("transparent-dark",{base:"vs-dark",inherit:!0,rules:[],colors:{"editor.background":"#00000000","editor.lineHighlightBackground":"#00000000","editorLineNumber.foreground":"#666666","editorLineNumber.activeForeground":"#ffffff",focusBorder:"#00000000","widget.border":"#00000000","editor.border":"#00000000","editorWidget.border":"#00000000"}}))},[c]),p.useEffect(()=>{c&&(c.languages.typescript.javascriptDefaults.setCompilerOptions({isolatedModules:!0}),c.languages.json.jsonDefaults.setDiagnosticsOptions({schemas:t?[{uri:window.location.href,fileMatch:["*"],schema:t}]:[]}))},[c,t]),p.useEffect(()=>{c&&c.editor.setTheme(g)},[c,g]),p.useEffect(()=>{if(!f)return;const h=f.getContainerDomNode().parentElement?.parentElement;if(!h)return;const x=()=>{v.current!==null&&cancelAnimationFrame(v.current),v.current=requestAnimationFrame(()=>{const{width:m,height:S}=h.getBoundingClientRect();f.layout({width:m,height:S}),v.current=null})};x();const j=new ResizeObserver(x);return j.observe(h),()=>{j.disconnect(),v.current!==null&&cancelAnimationFrame(v.current)}},[f]),r.jsx(ie.Editor,{"data-testid":"json-editor",language:n,value:e,theme:g,onMount:l,onChange:h=>{h||s?.(!1),o?.(h??"")},onValidate:h=>s?.(h.length===0),options:{automaticLayout:!1,readOnly:a,scrollBeyondLastLine:!1,minimap:{enabled:!1},overviewRulerLanes:0}})},st=p.memo(({schema:e})=>{const{setBody:t,setBodyIsValid:o}=C(),s=C(R(Je)),n=C(xe);p.useEffect(()=>{e&&(t(n||JSON.stringify(L(e),null,2)),o(!0))},[e]);const a=p.useCallback(c=>{t(c)},[t,o]);return r.jsxs("div",{className:"max-h-full h-full relative",children:[r.jsx(nt,{value:n,schema:e,onChange:a,onValidate:o}),!s&&r.jsxs("div",{className:"absolute bottom-0 left-0 right-0 border-t border-border p-3 text-sm dark:text-yellow-500 text-yellow-700 flex items-center gap-1 font-medium","data-testid":"endpoint-body-tab-invalid",children:[r.jsx(E.CircleX,{className:"w-4 h-4"}),"The body payload is invalid"]})]})}),X=p.memo(({value:e,id:t,onUpdate:o,onRemove:s,required:n=!1})=>{const[a,c]=p.useState(null),[d,g]=p.useState(null),f=p.useRef(void 0),l=a===t,v=p.useCallback(j=>{clearTimeout(f.current),g(j),f.current=setTimeout(()=>{g(null)},5e3)},[g]),h=p.useCallback(()=>{n||c(t)},[t,n]),x=p.useCallback(()=>{n||c(null)},[n]);return r.jsxs("div",{className:u.cn("grid grid-cols-[auto_1fr_auto] items-center py-2 px-4 bg-muted/30 rounded-lg gap-2",l&&"bg-card"),onMouseOver:h,onMouseLeave:x,children:[r.jsx(u.Checkbox,{checked:e.active,onCheckedChange:j=>o(t,"active",j),disabled:n,children:r.jsx(E.Check,{className:"h-3 w-3"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx(u.Input,{readOnly:n,disabled:!e.active,variant:n?"outlineReadonly":"outline",id:`name-${t}`,defaultValue:e.name,onBlur:j=>o(t,"name",j.target.value),placeholder:"Name",className:"h-8"}),r.jsx(u.Input,{disabled:!e.active,variant:"outline",id:`value-${t}`,defaultValue:e.value,onBlur:j=>o(t,"value",j.target.value),placeholder:"Value",className:"h-8"})]}),r.jsx(u.Button,{variant:"ghost",size:"icon",onClick:()=>{d===t?s?.(t):v(t)},className:u.cn("h-6 w-6 opacity-0 transition-opacity duration-200",l&&"opacity-100"),title:d===t&&l?"Click again to remove":"Remove",children:d===t?r.jsx(E.AlertCircle,{className:"h-3 w-3 text-destructive"}):r.jsx(E.Trash2,{className:"h-3 w-3"})})]})}),at=()=>{const{setHeaders:e,removeHeaders:t}=C(),o=C(R(Z)),s=p.useCallback(()=>{const a={name:"",value:"",active:!0};e({...o,[new Date().getTime().toString()]:a})},[o,e]),n=p.useCallback((a,c,d)=>{a&&e({...o,[a]:{...o[a],[c]:d}})},[o,e]);return r.jsxs("div",{className:"h-full max-h-full grid grid-rows-[auto_1fr]",children:[r.jsx("div",{className:"grid px-4 border-b h-10 items-center grid-cols-[auto_1fr]",children:r.jsxs(u.Button,{size:"sm",onClick:s,children:[r.jsx(E.Plus,{className:"h-3 w-3"}),"Add"]})}),r.jsxs("div",{className:"p-2",children:[Object.entries(o).map(([a,c])=>r.jsx(X,{value:c,id:a,onUpdate:n,onRemove:t},a)),Object.entries(o).length===0&&r.jsx("div",{className:"grid grid-cols-1 items-center h-full",children:r.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"There are no headers in this endpoint"})})]})]})},it=e=>Object.values(K(e)).filter(t=>t.active&&t.value!==""&&t.name!==""),we=e=>{const t=C(R(ye)),o=C(R(it));return p.useMemo(()=>e.replace(/:(\w+)/g,(n,a)=>t[a]?.value||n)+(o.length>0?`?${o.map(n=>`${n.name}=${n.value}`).join("&")}`:""),[e,t,o])},lt=({path:e,baseUrl:t=window.location.origin})=>{const o=we(e),s=`${t}${o}`,[n,a]=p.useState(!1),c=async()=>{try{await navigator.clipboard.writeText(s),a(!0),setTimeout(()=>a(!1),2e3)}catch(d){console.error("Failed to copy URL:",d)}};return r.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-5 px-5 relative border-b border-border",children:[r.jsx("div",{className:"text-sm font-medium py-2",children:"URL Preview"}),r.jsxs("div",{className:"bg-muted-foreground/10 box-border grid grid-cols-[1fr_auto] gap-1 h-6 items-center px-2 py-1 rounded border border-border",children:[r.jsx("div",{className:"min-w-0",children:r.jsx("div",{className:"font-medium text-xs text-muted-foreground truncate",title:s,children:s})}),r.jsx(u.Button,{onClick:c,className:u.cn("w-3 h-3 grid place-items-center transition-colors cursor-pointer",n?"text-green-400":"text-muted-foreground"),variant:"icon",size:"sm","aria-label":"Copy URL",children:n?r.jsx(E.Check,{className:"w-2.5 h-2.5"}):r.jsx(E.Copy,{className:"w-2.5 h-2.5"})})]})]})},ct=({path:e})=>{const{setQueryParams:t,removeQueryParams:o,setPathParams:s}=C(),n=C(R(K)),a=C(R(ye)),c=p.useMemo(()=>e.match(/:(\w+)/g)?.map(v=>({name:v.slice(1),value:a[v.slice(1)]?.value??"",active:!0}))??[],[e]),d=p.useCallback(()=>{const l={name:"",value:"",active:!0};t({...n,[new Date().getTime().toString()]:l})},[n,t]),g=p.useCallback((l,v,h)=>{l&&t({...n,[l]:{...n[l],[v]:h}})},[n,t]),f=p.useCallback((l,v,h)=>{l&&s({...a,[l]:{...a[l],[v]:h}})},[a,s]);return r.jsxs("div",{className:"h-full grid grid-rows-[auto_auto_1fr]",children:[r.jsx("div",{className:"grid px-4 border-b h-10 items-center grid-cols-[auto_1fr]",children:r.jsxs(u.Button,{size:"sm",onClick:d,children:[r.jsx(E.Plus,{className:"h-3 w-3"}),"Add"]})}),r.jsx(lt,{path:e}),r.jsxs("div",{className:"grid grid-rows-[1fr_1fr]",children:[c.length>0&&r.jsxs("div",{className:"p-2",children:[r.jsx("div",{className:"text-sm font-medium pl-3",children:"Path variables"}),c.map(l=>r.jsx(X,{value:{name:l.name,value:l.value,active:l.active},id:l.name,required:!0,onUpdate:f},l.name))]}),r.jsxs("div",{className:"p-2 border-b border-border",children:[r.jsx("div",{className:"text-sm font-medium pl-3",children:"Query parameters"}),Object.entries(n).map(([l,v])=>r.jsx(X,{value:v,id:l,onUpdate:g,onRemove:o},l)),Object.entries(n).length===0&&r.jsx("div",{className:"grid grid-cols-1 items-center h-full",children:r.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"There are no query params in this endpoint"})})]})]})]})},dt=e=>{const{__motia:t,...o}=typeof e=="string"?{}:e||{},{data:s}=fe.useStreamItem(t),n=Array.isArray(e)?e:o||e;return typeof e=="string"?{data:e,originalData:e,isStreamed:!1}:{data:JSON.stringify(s||n,null,2),originalData:n,isStreamed:!!t}},ut={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"},mt=e=>ut[e]||"Unknown",ht=({statusCode:e})=>{const t=mt(e),o=e>0&&e<400,s=e>=400&&e<500,n=e>=500;return r.jsxs("div",{className:u.cn("px-2 py-1 rounded-sm flex items-center gap-1",s&&"dark:bg-[#EAB71F]/20 dark:text-[#EAB71F] bg-[#EAB71F] text-white",n&&"dark:bg-[#F8367D]/20 dark:text-[#F8367D] bg-[#F8367D] text-white",o&&"dark:bg-accent-200 dark:text-primary bg-accent text-white"),children:[r.jsx("span",{className:"font-bold font-mono",children:e})," ",t]})},pt={'code[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto",borderRadius:"0.3em",background:"#1d1f21"},':not(pre) > code[class*="language-"]':{background:"#1d1f21",padding:".1em",borderRadius:".3em"},comment:{color:"#7C7C7C"},prolog:{color:"#7C7C7C"},doctype:{color:"#7C7C7C"},cdata:{color:"#7C7C7C"},punctuation:{color:"#c5c8c6"},".namespace":{Opacity:".7"},property:{color:"#96CBFE"},keyword:{color:"#96CBFE"},tag:{color:"#96CBFE"},"class-name":{color:"#FFFFB6",textDecoration:"underline"},boolean:{color:"#99CC99"},constant:{color:"#99CC99"},symbol:{color:"#f92672"},deleted:{color:"#f92672"},number:{color:"#FF73FD"},selector:{color:"#A8FF60"},"attr-name":{color:"#A8FF60"},string:{color:"#A8FF60"},char:{color:"#A8FF60"},builtin:{color:"#A8FF60"},inserted:{color:"#A8FF60"},variable:{color:"#C6C5FE"},operator:{color:"#EDEDED"},entity:{color:"#FFFFB6",cursor:"help"},url:{color:"#96CBFE"},".language-css .token.string":{color:"#87C38A"},".style .token.string":{color:"#87C38A"},atrule:{color:"#F9EE98"},"attr-value":{color:"#F9EE98"},function:{color:"#DAD085"},regex:{color:"#E9C062"},important:{color:"#fd971f",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},gt={'code[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"]::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},prolog:{color:"hsl(230, 4%, 64%)"},cdata:{color:"hsl(230, 4%, 64%)"},doctype:{color:"hsl(230, 8%, 24%)"},punctuation:{color:"hsl(230, 8%, 24%)"},entity:{color:"hsl(230, 8%, 24%)",cursor:"help"},"attr-name":{color:"hsl(35, 99%, 36%)"},"class-name":{color:"hsl(35, 99%, 36%)"},boolean:{color:"hsl(35, 99%, 36%)"},constant:{color:"hsl(35, 99%, 36%)"},number:{color:"hsl(35, 99%, 36%)"},atrule:{color:"hsl(35, 99%, 36%)"},keyword:{color:"hsl(301, 63%, 40%)"},property:{color:"hsl(5, 74%, 59%)"},tag:{color:"hsl(5, 74%, 59%)"},symbol:{color:"hsl(5, 74%, 59%)"},deleted:{color:"hsl(5, 74%, 59%)"},important:{color:"hsl(5, 74%, 59%)"},selector:{color:"hsl(119, 34%, 47%)"},string:{color:"hsl(119, 34%, 47%)"},char:{color:"hsl(119, 34%, 47%)"},builtin:{color:"hsl(119, 34%, 47%)"},inserted:{color:"hsl(119, 34%, 47%)"},regex:{color:"hsl(119, 34%, 47%)"},"attr-value":{color:"hsl(119, 34%, 47%)"},"attr-value > .token.punctuation":{color:"hsl(119, 34%, 47%)"},variable:{color:"hsl(221, 87%, 60%)"},operator:{color:"hsl(221, 87%, 60%)"},function:{color:"hsl(221, 87%, 60%)"},url:{color:"hsl(198, 99%, 37%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(230, 8%, 24%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(230, 8%, 24%)"},".language-css .token.selector":{color:"hsl(5, 74%, 59%)"},".language-css .token.property":{color:"hsl(230, 8%, 24%)"},".language-css .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.string.url":{color:"hsl(119, 34%, 47%)"},".language-css .token.important":{color:"hsl(301, 63%, 40%)"},".language-css .token.atrule .token.rule":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.operator":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(344, 84%, 43%)"},".language-json .token.operator":{color:"hsl(230, 8%, 24%)"},".language-json .token.null.keyword":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.url":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.operator":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.content":{color:"hsl(221, 87%, 60%)"},".language-markdown .token.url > .token.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.url-reference.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(119, 34%, 47%)"},".language-markdown .token.bold .token.content":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.italic .token.content":{color:"hsl(301, 63%, 40%)"},".language-markdown .token.strike .token.content":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.list.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(5, 74%, 59%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.cr:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.lf:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.space:before":{color:"hsla(230, 8%, 24%, 0.2)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},".line-highlight.line-highlight":{background:"hsla(230, 8%, 24%, 0.05)"},".line-highlight.line-highlight:before":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(230, 8%, 24%, 0.05)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".command-line .command-line-prompt":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(230, 1%, 62%)"},".command-line .command-line-prompt > span:before":{color:"hsl(230, 1%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(301, 63%, 40%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(0, 0, 95%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(0, 0, 95%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(0, 0, 95%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(0, 0, 95%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(0, 0%, 100%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(230, 8%, 24%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(230, 8%, 24%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(230, 8%, 24%)"}},ft={style:{fontFamily:"DM Mono, monospace",fontSize:"16px"}},bt={margin:0,borderRadius:0,padding:0},vt=e=>e?.includes("json")?"json":e?.includes("html")?"html":"text",xt=({code:e,blob:t,contentType:o})=>{const n=u.useThemeStore(d=>d.theme)==="dark"?pt:gt,a=vt(o),c=()=>{if(t){const d=URL.createObjectURL(t);window.open(d,"_blank")}};return r.jsxs("div",{className:"flex flex-col h-full overflow-y-auto",children:[t&&r.jsx("div",{className:"flex p-8 justify-center",children:r.jsxs(u.Button,{variant:"default",onClick:c,children:[r.jsx(E.Download,{className:"h-4 w-4"})," Download"]})}),!t&&e&&r.jsx(Re.Prism,{showLineNumbers:!0,language:a,style:n,codeTagProps:ft,customStyle:bt,wrapLines:!0,children:e})]})},kt=p.memo(()=>{const{setResponse:e}=C(),t=C(ke),{data:o}=dt(t?.body instanceof Blob?void 0:t?.body),[s,n]=p.useState("preview"),a=()=>e(void 0);return t?r.jsxs(u.Tabs,{value:s,onValueChange:c=>n(c),className:"border-l border-border","data-testid":"endpoint-response-container",children:[r.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center h-10 border-b px-5 bg-card",children:[r.jsxs(u.TabsList,{children:[r.jsx(u.TabsTrigger,{value:"preview",className:"cursor-pointer",children:"Preview"}),r.jsx(u.TabsTrigger,{value:"headers",className:"grid grid-cols-[auto_auto] gap-2 items-center cursor-pointer",children:"Headers"})]}),r.jsx(u.Button,{variant:"ghost",size:"icon",onClick:a,children:r.jsx(E.X,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"sticky bottom-0 border-b border-border p-3 text-sm flex items-center gap-1 font-medium",children:r.jsxs("div",{className:"flex flex-row items-center flex-1 gap-3",children:[r.jsx(ht,{statusCode:t.statusCode}),!!t.executionTime&&r.jsxs("div",{className:"text-muted-foreground bg-muted-foreground/10 px-2 py-1 rounded-sm",children:[t.executionTime,"ms"]})]})}),r.jsx(u.TabsContent,{value:"preview",children:r.jsx(xt,{code:o,blob:t?.body instanceof Blob?t.body:void 0,contentType:t.headers["content-type"]})}),r.jsx(u.TabsContent,{value:"headers",children:r.jsx("div",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-4 p-4 overflow-auto auto-rows-max h-full",children:t.headers&&Object.entries(t.headers).map(([c,d])=>r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-bold text-sm h-8 items-center grid whitespace-nowrap",children:c}),r.jsx("span",{className:"text-sm text-muted-foreground h-8 items-center grid whitespace-nowrap",children:d})]}))})})]}):null}),yt=p.memo(({method:e,path:t})=>{const{setResponse:o}=C(),s=C(R(Z)),n=C(R(xe)),a=we(t),[c,d]=p.useState(!1),g=async()=>{try{d(!0);const f=Object.values(s).filter(h=>h.active&&h.name!==""&&h.value!=="").reduce((h,x)=>(h[x.name.toLowerCase()]=x.value,h),{}),l=Date.now(),v=await fetch(a,{method:e,headers:f,body:["GET","DELETE","HEAD","OPTIONS"].includes(e)?null:n});o(v,l)}catch(f){console.error("Error triggering endpoint:",f)}finally{d(!1)}};return r.jsx(u.Button,{variant:"ghost",size:"icon",onClick:g,disabled:c,"data-testid":"endpoint-play-button",children:c?r.jsx(E.Loader2,{className:"animate-spin"}):r.jsx(E.Play,{className:"h-4 w-4"})})}),wt=e=>Object.keys(Z(e)).length,jt=e=>ke(e)!==void 0,St=e=>Object.keys(K(e)).length,Ct=p.memo(({endpoint:e,onClose:t})=>{const o=e.method==="GET"||e.method==="DELETE",[s,n]=p.useState(o?"params":"body"),[a,c]=p.useState(!1),d=C(R(wt)),g=C(R(jt)),f=C(R(St));return r.jsxs("div",{className:"isolate grid grid-cols-1 overflow-y-auto min-w-0 grid-rows-[auto_1fr] border-l border-border","data-testid":"endpoint-details-panel",children:[r.jsx(u.BackgroundEffect,{}),r.jsxs("div",{className:"grid grid-cols-[1fr_1fr_auto] items-start gap-4 px-5 py-4 border-b bg-card w-full",children:[r.jsxs("div",{className:"grid grid-rows-2 gap-2",children:[r.jsx(Q,{method:e.method,path:e.path}),e.description&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.description})]}),r.jsx("div",{className:"flex items-end justify-end",children:r.jsx(u.Button,{variant:"icon",size:"icon",onClick:()=>c(!a),"data-testid":"endpoint-spec-button",children:r.jsx(E.Book,{})})}),r.jsx(u.Button,{variant:"icon",size:"icon",onClick:t,children:r.jsx(E.X,{})})]}),r.jsxs("div",{className:u.cn("grid grid-cols-[minmax(350px,1fr)_minmax(auto,1fr)]",!g&&"grid-cols-1"),children:[r.jsxs(u.Tabs,{value:s,onValueChange:l=>n(l),children:[r.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center h-10 border-b px-5 bg-card",children:[r.jsxs(u.TabsList,{children:[r.jsxs(u.TabsTrigger,{value:"params",className:"grid grid-cols-[auto_auto] gap-2 items-center cursor-pointer","data-testid":"endpoint-params-tab",children:["Params",r.jsx(u.Badge,{variant:"outline",className:"h-4 px-1.5 text-xs",children:f})]}),r.jsx(u.TabsTrigger,{value:"body",className:"cursor-pointer","data-testid":"endpoint-body-tab",children:"Body"}),r.jsxs(u.TabsTrigger,{value:"headers",className:"grid grid-cols-[auto_auto] gap-2 items-center cursor-pointer","data-testid":"endpoint-headers-tab",children:["Headers",r.jsx(u.Badge,{variant:"outline",className:"h-4 px-1.5 text-xs",children:d})]})]}),r.jsx(yt,{method:e.method,path:e.path.toString()})]}),r.jsx(u.TabsContent,{value:"params",children:r.jsx(ct,{path:e.path})}),r.jsx(u.TabsContent,{value:"body",children:r.jsx(st,{schema:e.bodySchema})}),r.jsx(u.TabsContent,{value:"headers",children:r.jsx(at,{})})]}),r.jsx(kt,{})]}),a&&r.jsx(ot,{endpoint:e,onClose:()=>c(!1)})]})}),Et=()=>{const{endpoints:e,groupedEndpoints:t}=We(),{selectedEndpointId:o,setSelectedEndpointId:s,toggleFlowGroupStatus:n,flowGroupStatus:a}=C(),c=p.useMemo(()=>e.find(v=>v.id===o),[e,o]),d=p.useCallback(()=>{s("")},[s]),[g,f]=p.useState(""),l=p.useMemo(()=>Object.entries(t).filter(([v,h])=>h.some(x=>x.method?.toLowerCase().includes(g.toLowerCase())||x.path?.toLowerCase().includes(g.toLowerCase()))),[t,g]);return r.jsxs("div",{className:u.cn("grid h-full max-h-full",c?"grid-cols-[300px_1fr] ":"grid-cols-1"),"data-testid":"endpoints-list",children:[r.jsxs("div",{className:"grid grid-rows-[auto_1fr] h-full overflow-auto min-w-0",children:[r.jsx(Fe,{value:g,onChange:f,onClear:()=>f("")}),r.jsx("div",{className:"grid grid-cols-1 auto-rows-max overflow-auto min-w-0",children:l.map(([v,h])=>{const x=h.some(m=>m.id===o),j=!a[v]||x||g!=="";return r.jsx(Le,{flow:v,endpoints:h,isOpen:j,isSelected:x,onToggle:n,onClearSelection:()=>s(""),selectedEndpointId:o,onSelectEndpoint:s},v)})})]}),c&&r.jsx(Ct,{endpoint:c,onClose:d})]})};exports.EndpointsPage=Et;
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA"}
|