modifywithai 1.10.0 → 2.2.1
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 +145 -0
- package/dist/assistant/index.d.ts +3 -0
- package/dist/assistant/index.js +1 -0
- package/dist/assistant-7f9B_gWg.js +2 -0
- package/dist/assistant-nextjs/api.d.ts +42 -0
- package/dist/assistant-nextjs/api.js +1 -0
- package/dist/assistant-remix/api.d.ts +46 -0
- package/dist/assistant-remix/api.js +1 -0
- package/dist/assistant-tanstack-start/api.d.ts +56 -0
- package/dist/assistant-tanstack-start/api.js +1 -0
- package/dist/index-B2dmSvFt.d.ts +1272 -0
- package/dist/index.d.ts +3 -69
- package/dist/index.js +1 -1
- package/dist/types-C7I0JuqF.d.ts +344 -0
- package/dist/utils-DQD-DMi0.js +1 -0
- package/package.json +67 -20
- package/dist/index-Dp00MJvS.d.ts +0 -391
- package/dist/nextjs/api.d.ts +0 -67
- package/dist/nextjs/api.js +0 -1
- package/dist/nextjs/shims.d.ts +0 -13
- package/dist/nextjs/shims.js +0 -1
- package/dist/react/index.d.ts +0 -3
- package/dist/react/index.js +0 -1
- package/dist/react-CREl6aTM.js +0 -1
- package/dist/remix/api.d.ts +0 -45
- package/dist/remix/api.js +0 -1
- package/dist/remix/index.d.ts +0 -38
- package/dist/remix/index.js +0 -1
- package/dist/remix/shims.d.ts +0 -14
- package/dist/remix/shims.js +0 -1
- package/dist/shims-C5D8K0uz.js +0 -191
- package/dist/tanstack-start/api.d.ts +0 -43
- package/dist/tanstack-start/api.js +0 -1
- package/dist/tanstack-start/index.d.ts +0 -33
- package/dist/tanstack-start/index.js +0 -1
- package/dist/tanstack-start/shims.d.ts +0 -15
- package/dist/tanstack-start/shims.js +0 -1
- package/dist/types-D83LZSks.d.ts +0 -190
- package/dist/types-V6wytIkL.js +0 -1
package/dist/shims-C5D8K0uz.js
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
const e={"tanstack-router-shim.js":`// Re-export @tanstack/react-router from the window object (set by the app)
|
|
2
|
-
// Works with TanStack Start / TanStack Router
|
|
3
|
-
const TanStackRouter = window.__TANSTACK_ROUTER__;
|
|
4
|
-
export const Link = TanStackRouter?.Link;
|
|
5
|
-
export const Navigate = TanStackRouter?.Navigate;
|
|
6
|
-
export const Outlet = TanStackRouter?.Outlet;
|
|
7
|
-
export const useNavigate = TanStackRouter?.useNavigate;
|
|
8
|
-
export const useLocation = TanStackRouter?.useLocation;
|
|
9
|
-
export const useParams = TanStackRouter?.useParams;
|
|
10
|
-
export const useSearch = TanStackRouter?.useSearch;
|
|
11
|
-
export const useMatch = TanStackRouter?.useMatch;
|
|
12
|
-
export const useMatches = TanStackRouter?.useMatches;
|
|
13
|
-
export const useRouter = TanStackRouter?.useRouter;
|
|
14
|
-
export const useRouterState = TanStackRouter?.useRouterState;
|
|
15
|
-
export const useLoaderData = TanStackRouter?.useLoaderData;
|
|
16
|
-
export const useLoaderDeps = TanStackRouter?.useLoaderDeps;
|
|
17
|
-
export const useBlocker = TanStackRouter?.useBlocker;
|
|
18
|
-
export const useChildMatches = TanStackRouter?.useChildMatches;
|
|
19
|
-
export const useParentMatches = TanStackRouter?.useParentMatches;
|
|
20
|
-
export const useRouteContext = TanStackRouter?.useRouteContext;
|
|
21
|
-
export const useLinkProps = TanStackRouter?.useLinkProps;
|
|
22
|
-
export const useMatchRoute = TanStackRouter?.useMatchRoute;
|
|
23
|
-
export const redirect = TanStackRouter?.redirect;
|
|
24
|
-
export const notFound = TanStackRouter?.notFound;
|
|
25
|
-
export const isRedirect = TanStackRouter?.isRedirect;
|
|
26
|
-
export const isNotFound = TanStackRouter?.isNotFound;
|
|
27
|
-
export default TanStackRouter;
|
|
28
|
-
`,"react-shim.js":`// Re-export React from the window object (set by the app)
|
|
29
|
-
const React = window.__REACT__;
|
|
30
|
-
export default React;
|
|
31
|
-
export const {
|
|
32
|
-
useState,
|
|
33
|
-
useEffect,
|
|
34
|
-
useLayoutEffect,
|
|
35
|
-
useRef,
|
|
36
|
-
useCallback,
|
|
37
|
-
useMemo,
|
|
38
|
-
useContext,
|
|
39
|
-
useReducer,
|
|
40
|
-
useId,
|
|
41
|
-
useTransition,
|
|
42
|
-
useDeferredValue,
|
|
43
|
-
useImperativeHandle,
|
|
44
|
-
useDebugValue,
|
|
45
|
-
useSyncExternalStore,
|
|
46
|
-
useInsertionEffect,
|
|
47
|
-
createElement,
|
|
48
|
-
createContext,
|
|
49
|
-
createRef,
|
|
50
|
-
forwardRef,
|
|
51
|
-
memo,
|
|
52
|
-
lazy,
|
|
53
|
-
Suspense,
|
|
54
|
-
Fragment,
|
|
55
|
-
Children,
|
|
56
|
-
cloneElement,
|
|
57
|
-
isValidElement,
|
|
58
|
-
Component,
|
|
59
|
-
PureComponent,
|
|
60
|
-
StrictMode,
|
|
61
|
-
startTransition,
|
|
62
|
-
use,
|
|
63
|
-
} = React;
|
|
64
|
-
`,"react-jsx-shim.js":`// Re-export jsx-runtime from the window object (set by the app)
|
|
65
|
-
const jsxRuntime = window.__REACT_JSX_RUNTIME__;
|
|
66
|
-
export const jsx = jsxRuntime?.jsx;
|
|
67
|
-
export const jsxs = jsxRuntime?.jsxs;
|
|
68
|
-
export const Fragment = jsxRuntime?.Fragment;
|
|
69
|
-
`,"react-dom-shim.js":`// Re-export ReactDOM from the window object (set by the app)
|
|
70
|
-
const ReactDOM = window.__REACT_DOM__
|
|
71
|
-
export default ReactDOM
|
|
72
|
-
export const {
|
|
73
|
-
createPortal,
|
|
74
|
-
flushSync,
|
|
75
|
-
findDOMNode,
|
|
76
|
-
hydrate,
|
|
77
|
-
render,
|
|
78
|
-
unmountComponentAtNode,
|
|
79
|
-
unstable_batchedUpdates,
|
|
80
|
-
version,
|
|
81
|
-
} = ReactDOM || {}
|
|
82
|
-
`,"react-dom-client-shim.js":`// Re-export ReactDOM/client from the window object (set by the app)
|
|
83
|
-
const ReactDOMClient = window.__REACT_DOM_CLIENT__;
|
|
84
|
-
export const createRoot = ReactDOMClient?.createRoot;
|
|
85
|
-
export const hydrateRoot = ReactDOMClient?.hydrateRoot;
|
|
86
|
-
export default ReactDOMClient;
|
|
87
|
-
`,"next-link-shim.js":`// Re-export next/link from the window object (set by the app)
|
|
88
|
-
const NextLink = window.__NEXT_LINK__;
|
|
89
|
-
export default NextLink;
|
|
90
|
-
`,"next-image-shim.js":`// Re-export next/image from the window object (set by the app)
|
|
91
|
-
const NextImage = window.__NEXT_IMAGE__;
|
|
92
|
-
export default NextImage;
|
|
93
|
-
`,"next-navigation-shim.js":`// Re-export next/navigation from the window object (set by the app)
|
|
94
|
-
const NextNavigation = window.__NEXT_NAVIGATION__;
|
|
95
|
-
export const useRouter = NextNavigation?.useRouter;
|
|
96
|
-
export const usePathname = NextNavigation?.usePathname;
|
|
97
|
-
export const useSearchParams = NextNavigation?.useSearchParams;
|
|
98
|
-
export const useParams = NextNavigation?.useParams;
|
|
99
|
-
export const useSelectedLayoutSegment = NextNavigation?.useSelectedLayoutSegment;
|
|
100
|
-
export const useSelectedLayoutSegments = NextNavigation?.useSelectedLayoutSegments;
|
|
101
|
-
export const redirect = NextNavigation?.redirect;
|
|
102
|
-
export const notFound = NextNavigation?.notFound;
|
|
103
|
-
export const permanentRedirect = NextNavigation?.permanentRedirect;
|
|
104
|
-
export default NextNavigation;
|
|
105
|
-
`,"remix-react-shim.js":`// Re-export @remix-run/react from the window object (set by the app)
|
|
106
|
-
// Works with Remix v2
|
|
107
|
-
const RemixReact = window.__REMIX_REACT__;
|
|
108
|
-
export const Link = RemixReact?.Link;
|
|
109
|
-
export const NavLink = RemixReact?.NavLink;
|
|
110
|
-
export const Form = RemixReact?.Form;
|
|
111
|
-
export const Outlet = RemixReact?.Outlet;
|
|
112
|
-
export const ScrollRestoration = RemixReact?.ScrollRestoration;
|
|
113
|
-
export const Scripts = RemixReact?.Scripts;
|
|
114
|
-
export const Links = RemixReact?.Links;
|
|
115
|
-
export const Meta = RemixReact?.Meta;
|
|
116
|
-
export const Await = RemixReact?.Await;
|
|
117
|
-
export const useNavigate = RemixReact?.useNavigate;
|
|
118
|
-
export const useLocation = RemixReact?.useLocation;
|
|
119
|
-
export const useSearchParams = RemixReact?.useSearchParams;
|
|
120
|
-
export const useParams = RemixReact?.useParams;
|
|
121
|
-
export const useMatches = RemixReact?.useMatches;
|
|
122
|
-
export const useLoaderData = RemixReact?.useLoaderData;
|
|
123
|
-
export const useActionData = RemixReact?.useActionData;
|
|
124
|
-
export const useFetcher = RemixReact?.useFetcher;
|
|
125
|
-
export const useFetchers = RemixReact?.useFetchers;
|
|
126
|
-
export const useNavigation = RemixReact?.useNavigation;
|
|
127
|
-
export const useRevalidator = RemixReact?.useRevalidator;
|
|
128
|
-
export const useRouteError = RemixReact?.useRouteError;
|
|
129
|
-
export const useSubmit = RemixReact?.useSubmit;
|
|
130
|
-
export const useBeforeUnload = RemixReact?.useBeforeUnload;
|
|
131
|
-
export const useBlocker = RemixReact?.useBlocker;
|
|
132
|
-
export const useHref = RemixReact?.useHref;
|
|
133
|
-
export const useRouteLoaderData = RemixReact?.useRouteLoaderData;
|
|
134
|
-
export default RemixReact;
|
|
135
|
-
`,"react-router-shim.js":`// Re-export react-router from the window object (set by the app)
|
|
136
|
-
// Works with React Router v7 framework mode
|
|
137
|
-
const ReactRouter = window.__REMIX_REACT__ || window.__REACT_ROUTER__;
|
|
138
|
-
export const Link = ReactRouter?.Link;
|
|
139
|
-
export const NavLink = ReactRouter?.NavLink;
|
|
140
|
-
export const Form = ReactRouter?.Form;
|
|
141
|
-
export const Outlet = ReactRouter?.Outlet;
|
|
142
|
-
export const ScrollRestoration = ReactRouter?.ScrollRestoration;
|
|
143
|
-
export const Scripts = ReactRouter?.Scripts;
|
|
144
|
-
export const Links = ReactRouter?.Links;
|
|
145
|
-
export const Meta = ReactRouter?.Meta;
|
|
146
|
-
export const Await = ReactRouter?.Await;
|
|
147
|
-
export const Navigate = ReactRouter?.Navigate;
|
|
148
|
-
export const useNavigate = ReactRouter?.useNavigate;
|
|
149
|
-
export const useLocation = ReactRouter?.useLocation;
|
|
150
|
-
export const useSearchParams = ReactRouter?.useSearchParams;
|
|
151
|
-
export const useParams = ReactRouter?.useParams;
|
|
152
|
-
export const useMatches = ReactRouter?.useMatches;
|
|
153
|
-
export const useLoaderData = ReactRouter?.useLoaderData;
|
|
154
|
-
export const useActionData = ReactRouter?.useActionData;
|
|
155
|
-
export const useFetcher = ReactRouter?.useFetcher;
|
|
156
|
-
export const useFetchers = ReactRouter?.useFetchers;
|
|
157
|
-
export const useNavigation = ReactRouter?.useNavigation;
|
|
158
|
-
export const useRevalidator = ReactRouter?.useRevalidator;
|
|
159
|
-
export const useRouteError = ReactRouter?.useRouteError;
|
|
160
|
-
export const useSubmit = ReactRouter?.useSubmit;
|
|
161
|
-
export const useBeforeUnload = ReactRouter?.useBeforeUnload;
|
|
162
|
-
export const useBlocker = ReactRouter?.useBlocker;
|
|
163
|
-
export const useHref = ReactRouter?.useHref;
|
|
164
|
-
export const useRouteLoaderData = ReactRouter?.useRouteLoaderData;
|
|
165
|
-
export const redirect = ReactRouter?.redirect;
|
|
166
|
-
export const data = ReactRouter?.data;
|
|
167
|
-
export default ReactRouter;
|
|
168
|
-
`,"react-router-dom-shim.js":`// Re-export react-router-dom from the window object (set by the app)
|
|
169
|
-
// For compatibility with code that imports from react-router-dom
|
|
170
|
-
const ReactRouterDOM = window.__REACT_ROUTER_DOM__ || window.__REMIX_REACT__ || window.__REACT_ROUTER__;
|
|
171
|
-
export const Link = ReactRouterDOM?.Link;
|
|
172
|
-
export const NavLink = ReactRouterDOM?.NavLink;
|
|
173
|
-
export const Form = ReactRouterDOM?.Form;
|
|
174
|
-
export const Outlet = ReactRouterDOM?.Outlet;
|
|
175
|
-
export const Navigate = ReactRouterDOM?.Navigate;
|
|
176
|
-
export const Routes = ReactRouterDOM?.Routes;
|
|
177
|
-
export const Route = ReactRouterDOM?.Route;
|
|
178
|
-
export const BrowserRouter = ReactRouterDOM?.BrowserRouter;
|
|
179
|
-
export const RouterProvider = ReactRouterDOM?.RouterProvider;
|
|
180
|
-
export const createBrowserRouter = ReactRouterDOM?.createBrowserRouter;
|
|
181
|
-
export const useNavigate = ReactRouterDOM?.useNavigate;
|
|
182
|
-
export const useLocation = ReactRouterDOM?.useLocation;
|
|
183
|
-
export const useSearchParams = ReactRouterDOM?.useSearchParams;
|
|
184
|
-
export const useParams = ReactRouterDOM?.useParams;
|
|
185
|
-
export const useMatches = ReactRouterDOM?.useMatches;
|
|
186
|
-
export const useFetcher = ReactRouterDOM?.useFetcher;
|
|
187
|
-
export const useNavigation = ReactRouterDOM?.useNavigation;
|
|
188
|
-
export const useSubmit = ReactRouterDOM?.useSubmit;
|
|
189
|
-
export const useHref = ReactRouterDOM?.useHref;
|
|
190
|
-
export default ReactRouterDOM;
|
|
191
|
-
`};export{e as t};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
//#region src/tanstack-start/api.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* TanStack Start server route handler
|
|
4
|
-
* Uses the server.handlers pattern with GET/POST functions
|
|
5
|
-
*/
|
|
6
|
-
type ServerRouteHandler = {
|
|
7
|
-
request: Request;
|
|
8
|
-
params: Record<string, string | undefined>;
|
|
9
|
-
};
|
|
10
|
-
type CreateTanStackStartHandlerOptions = {
|
|
11
|
-
/**
|
|
12
|
-
* The app ID for this MWAI application
|
|
13
|
-
* This identifies your app in the modifywithai system
|
|
14
|
-
*/
|
|
15
|
-
appId: string;
|
|
16
|
-
/**
|
|
17
|
-
* Base URL of the modifywithai service
|
|
18
|
-
* @default "https://modifywithai.com"
|
|
19
|
-
*/
|
|
20
|
-
baseUrl?: string;
|
|
21
|
-
/**
|
|
22
|
-
* API key for authenticating with the modifywithai service
|
|
23
|
-
* @default process.env.MWAI_API_KEY
|
|
24
|
-
*/
|
|
25
|
-
apiKey?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Function to get the end user's ID from the request
|
|
28
|
-
* This will be injected into API calls that require endUserId
|
|
29
|
-
*/
|
|
30
|
-
getEndUserId: (request: Request) => Promise<string | null>;
|
|
31
|
-
};
|
|
32
|
-
declare function createTanStackStartHandler(options: CreateTanStackStartHandlerOptions): {
|
|
33
|
-
GET: ({
|
|
34
|
-
request,
|
|
35
|
-
params
|
|
36
|
-
}: ServerRouteHandler) => Promise<Response>;
|
|
37
|
-
POST: ({
|
|
38
|
-
request,
|
|
39
|
-
params
|
|
40
|
-
}: ServerRouteHandler) => Promise<Response>;
|
|
41
|
-
};
|
|
42
|
-
//#endregion
|
|
43
|
-
export { createTanStackStartHandler };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=[`list`,`enable`,`disable`,`router`,`status`],t={router:{method:`POST`,inBody:!0,needsEndUserId:!0},disable:{method:`POST`,inBody:!0,needsEndUserId:!0},enable:{method:`POST`,inBody:!0,needsEndUserId:!0},list:{method:`GET`,inBody:!1,needsEndUserId:!1},status:{method:`GET`,inBody:!1,needsEndUserId:!1}};function n(n){let{appId:r,baseUrl:i=`https://modifywithai.com`,apiKey:a=process.env.MWAI_API_KEY,getEndUserId:o}=n;if(!a)throw Error(`MWAI API key is required. Provide it via the apiKey option or set the MWAI_API_KEY environment variable.`);async function s(n,s){let c=s._splat||``;if(!e.includes(c))return new Response(JSON.stringify({error:`Not found`}),{status:404,headers:{"Content-Type":`application/json`}});let l=t[c],u=await o(n);if(l.needsEndUserId&&!u)return new Response(JSON.stringify({error:`Unauthorized - end user ID required`}),{status:401,headers:{"Content-Type":`application/json`}});let d=new URL(`/api/${c}`,i);new URL(n.url).searchParams.forEach((e,t)=>{d.searchParams.set(t,e)});let f=new Headers({"Content-Type":`application/json`,"x-api-key":a}),p;if(n.method===`POST`||n.method===`PUT`||n.method===`PATCH`)try{let e=await n.json();e.appId=r,l.needsEndUserId&&u&&(e.endUserId=u),p=JSON.stringify(e)}catch{let e={appId:r};l.needsEndUserId&&u&&(e.endUserId=u),p=JSON.stringify(e)}n.method===`GET`&&(d.searchParams.set(`appId`,r),u&&d.searchParams.set(`endUserId`,u));let m=await fetch(d.toString(),{method:n.method,headers:f,body:p}),h=await m.text();return new Response(h,{status:m.status,statusText:m.statusText,headers:{"Content-Type":m.headers.get(`Content-Type`)||`application/json`}})}return{GET:async({request:e,params:t})=>s(e,t),POST:async({request:e,params:t})=>s(e,t)}}export{n as createTanStackStartHandler};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { b as RouterMatchedResponse, f as ModificationToggleOptions, i as DisableResponse, s as EnableResponse, t as ApiError, u as Modification, v as RouterCannotCreateResponse, w as UseRouterOptions, x as RouterResponse, y as RouterCreatingResponse } from "../types-D83LZSks.js";
|
|
2
|
-
import { a as useEnable, i as useDisable, n as MWAIContext, o as useList, r as MWAIProvider, s as useRouter, t as mwaiQueryKeys } from "../index-Dp00MJvS.js";
|
|
3
|
-
import { createTanStackStartHandler } from "./api.js";
|
|
4
|
-
import { shimsHandler } from "./shims.js";
|
|
5
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
//#region src/tanstack-start/head.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* MWAIHeadTanStack - Renders the import map for dynamically loaded components
|
|
10
|
-
* Works with TanStack Start / TanStack Router
|
|
11
|
-
*/
|
|
12
|
-
declare const MWAIHeadTanStack: ({
|
|
13
|
-
basePath
|
|
14
|
-
}?: {
|
|
15
|
-
basePath?: string;
|
|
16
|
-
}) => react_jsx_runtime0.JSX.Element;
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/tanstack-start/components.d.ts
|
|
19
|
-
/**
|
|
20
|
-
* Props for MWAITanStackComponents to pass router module
|
|
21
|
-
* Users must pass their @tanstack/react-router import
|
|
22
|
-
*/
|
|
23
|
-
type RouterModules = {
|
|
24
|
-
/** Pass the @tanstack/react-router module */routerModule: Record<string, unknown>;
|
|
25
|
-
};
|
|
26
|
-
declare const useTanStackComponents: (routerModules?: RouterModules) => react_jsx_runtime0.JSX.Element | null;
|
|
27
|
-
declare const MWAITanStackComponents: ({
|
|
28
|
-
routerModule
|
|
29
|
-
}?: {
|
|
30
|
-
/** Pass the @tanstack/react-router module */routerModule?: Record<string, unknown>;
|
|
31
|
-
}) => react_jsx_runtime0.JSX.Element | null;
|
|
32
|
-
//#endregion
|
|
33
|
-
export { type ApiError, type DisableResponse, type EnableResponse, MWAIContext, MWAIHeadTanStack, MWAIProvider, MWAITanStackComponents, type Modification, type ModificationToggleOptions, type RouterCannotCreateResponse, type RouterCreatingResponse, type RouterMatchedResponse, type RouterResponse, type UseRouterOptions, createTanStackStartHandler, mwaiQueryKeys, shimsHandler, useDisable, useEnable, useList, useRouter, useTanStackComponents };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../types-V6wytIkL.js";import{a as e,c as t,i as n,l as r,o as i,s as a,u as o}from"../react-CREl6aTM.js";import{createTanStackStartHandler as s}from"./api.js";import{shimsHandler as c}from"./shims.js";import*as l from"react";import{useContext as u,useLayoutEffect as d,useState as f}from"react";import*as p from"react/jsx-runtime";import{Fragment as m,jsx as h}from"react/jsx-runtime";import*as g from"react-dom";import*as _ from"react-dom/client";const v=({basePath:e=`/api/mwai`}={})=>h(`script`,{type:`importmap`,dangerouslySetInnerHTML:{__html:JSON.stringify({imports:{react:`${e}/shims/react-shim.js`,"react/jsx-runtime":`${e}/shims/react-jsx-shim.js`,"react-dom":`${e}/shims/react-dom-shim.js`,"react-dom/client":`${e}/shims/react-dom-client-shim.js`,"@tanstack/react-router":`${e}/shims/tanstack-router-shim.js`}})}}),y=e=>{let r=u(n),[i,a]=f(null),{data:o}=t();return d(()=>{if(!r){console.error(`ModifyWithAI: No appId provided. Wrap your app with <MWAIProvider appId='your-app-id'>`);return}typeof window<`u`&&(window.__REACT__=l,window.__REACT_JSX_RUNTIME__=p,window.__REACT_DOM__=g,window.__REACT_DOM_CLIENT__=_,e?.routerModule&&(window.__TANSTACK_ROUTER__=e.routerModule))},[r,e]),d(()=>{if(!r||!o)return;let e=Function(`url`,`return import(url)`),t=o.filter(e=>e.enabled&&e.status===`success`).map(e=>e.id);a([]),t.forEach(t=>{e(`https://bucket.modifywithai.com/${r}/${t}.js`).then(e=>a(t=>[...t||[],e.default])).catch(e=>console.error(`Failed to load external module:`,e))})},[r,o]),i?h(m,{children:i.map(e=>h(e,{},e.name))}):null},b=({routerModule:e}={})=>y(e?{routerModule:e}:void 0);export{n as MWAIContext,v as MWAIHeadTanStack,e as MWAIProvider,b as MWAITanStackComponents,s as createTanStackStartHandler,o as mwaiQueryKeys,c as shimsHandler,i as useDisable,a as useEnable,t as useList,r as useRouter,y as useTanStackComponents};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//#region src/tanstack-start/shims.d.ts
|
|
2
|
-
type ServerRouteHandler = {
|
|
3
|
-
params: Record<string, string | undefined>;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Creates handlers for the shims route in TanStack Start
|
|
7
|
-
* Use with createFileRoute's server.handlers pattern
|
|
8
|
-
*/
|
|
9
|
-
declare function shimsHandler(): {
|
|
10
|
-
GET: ({
|
|
11
|
-
params
|
|
12
|
-
}: ServerRouteHandler) => Promise<Response>;
|
|
13
|
-
};
|
|
14
|
-
//#endregion
|
|
15
|
-
export { shimsHandler };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"../shims-C5D8K0uz.js";function t(){return{GET:async({params:t})=>{let n=t._splat;return e[n]?new Response(e[n],{headers:{"Content-Type":`application/javascript`,"Cache-Control":`public, max-age=31536000, immutable`}}):new Response(`Not found`,{status:404})}}}export{t as shimsHandler};
|
package/dist/types-D83LZSks.d.ts
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
//#region src/types.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Schema for a modification in the ModifyWithAI system
|
|
6
|
-
*/
|
|
7
|
-
declare const ModificationSchema: z.ZodObject<{
|
|
8
|
-
id: z.ZodString;
|
|
9
|
-
title: z.ZodNullable<z.ZodString>;
|
|
10
|
-
description: z.ZodNullable<z.ZodString>;
|
|
11
|
-
status: z.ZodEnum<{
|
|
12
|
-
error: "error";
|
|
13
|
-
pending: "pending";
|
|
14
|
-
success: "success";
|
|
15
|
-
}>;
|
|
16
|
-
createdAt: z.ZodNumber;
|
|
17
|
-
updatedAt: z.ZodNumber;
|
|
18
|
-
enabled: z.ZodNullable<z.ZodBoolean>;
|
|
19
|
-
}, z.core.$strip>;
|
|
20
|
-
/**
|
|
21
|
-
* Schema for the list modifications API response
|
|
22
|
-
*/
|
|
23
|
-
declare const ModificationsListSchema: z.ZodArray<z.ZodObject<{
|
|
24
|
-
id: z.ZodString;
|
|
25
|
-
title: z.ZodNullable<z.ZodString>;
|
|
26
|
-
description: z.ZodNullable<z.ZodString>;
|
|
27
|
-
status: z.ZodEnum<{
|
|
28
|
-
error: "error";
|
|
29
|
-
pending: "pending";
|
|
30
|
-
success: "success";
|
|
31
|
-
}>;
|
|
32
|
-
createdAt: z.ZodNumber;
|
|
33
|
-
updatedAt: z.ZodNumber;
|
|
34
|
-
enabled: z.ZodNullable<z.ZodBoolean>;
|
|
35
|
-
}, z.core.$strip>>;
|
|
36
|
-
/**
|
|
37
|
-
* Schema for the modify API response
|
|
38
|
-
*/
|
|
39
|
-
declare const ModifyResponseSchema: z.ZodObject<{
|
|
40
|
-
modificationId: z.ZodString;
|
|
41
|
-
}, z.core.$strip>;
|
|
42
|
-
/**
|
|
43
|
-
* Schema for the enable API response
|
|
44
|
-
*/
|
|
45
|
-
declare const EnableResponseSchema: z.ZodObject<{
|
|
46
|
-
message: z.ZodString;
|
|
47
|
-
modificationId: z.ZodString;
|
|
48
|
-
endUserId: z.ZodString;
|
|
49
|
-
}, z.core.$strip>;
|
|
50
|
-
/**
|
|
51
|
-
* Schema for the disable API response
|
|
52
|
-
*/
|
|
53
|
-
declare const DisableResponseSchema: z.ZodObject<{
|
|
54
|
-
message: z.ZodString;
|
|
55
|
-
modificationId: z.ZodString;
|
|
56
|
-
endUserId: z.ZodString;
|
|
57
|
-
}, z.core.$strip>;
|
|
58
|
-
/**
|
|
59
|
-
* Schema for API error responses
|
|
60
|
-
*/
|
|
61
|
-
declare const ApiErrorSchema: z.ZodObject<{
|
|
62
|
-
message: z.ZodOptional<z.ZodString>;
|
|
63
|
-
error: z.ZodOptional<z.ZodString>;
|
|
64
|
-
}, z.core.$strip>;
|
|
65
|
-
/**
|
|
66
|
-
* Represents a modification in the ModifyWithAI system
|
|
67
|
-
*/
|
|
68
|
-
type Modification = z.infer<typeof ModificationSchema>;
|
|
69
|
-
/**
|
|
70
|
-
* Response from a modification request
|
|
71
|
-
*/
|
|
72
|
-
type ModifyResponse = z.infer<typeof ModifyResponseSchema>;
|
|
73
|
-
/**
|
|
74
|
-
* Response from enabling a modification
|
|
75
|
-
*/
|
|
76
|
-
type EnableResponse = z.infer<typeof EnableResponseSchema>;
|
|
77
|
-
/**
|
|
78
|
-
* Response from disabling a modification
|
|
79
|
-
*/
|
|
80
|
-
type DisableResponse = z.infer<typeof DisableResponseSchema>;
|
|
81
|
-
/**
|
|
82
|
-
* API error response
|
|
83
|
-
*/
|
|
84
|
-
type ApiError = z.infer<typeof ApiErrorSchema>;
|
|
85
|
-
/**
|
|
86
|
-
* Options for modification requests
|
|
87
|
-
*/
|
|
88
|
-
type ModifyWithAIOptions = {
|
|
89
|
-
/** Called when modification submission succeeds */onSuccess?: () => void; /** Called when modification submission fails */
|
|
90
|
-
onError?: (error: Error) => void;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Arguments for listModifications function
|
|
94
|
-
*/
|
|
95
|
-
type ListModificationsArgs = {
|
|
96
|
-
/** The MWAI instance ID */id: string;
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Arguments for modifyWithAI function
|
|
100
|
-
*/
|
|
101
|
-
type ModifyWithAIArgs = {
|
|
102
|
-
/** The MWAI instance ID */id: string; /** The modification prompt */
|
|
103
|
-
prompt: string;
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Arguments for enableModification function
|
|
107
|
-
*/
|
|
108
|
-
type EnableModificationArgs = {
|
|
109
|
-
/** The ID of the modification to enable */modificationId: string;
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* Arguments for disableModification function
|
|
113
|
-
*/
|
|
114
|
-
type DisableModificationArgs = {
|
|
115
|
-
/** The ID of the modification to disable */modificationId: string;
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Options for enable/disable modification requests
|
|
119
|
-
*/
|
|
120
|
-
type ModificationToggleOptions = {
|
|
121
|
-
/** Called when the operation succeeds */onSuccess?: () => void; /** Called when the operation fails */
|
|
122
|
-
onError?: (error: Error) => void;
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* Router route types
|
|
126
|
-
*/
|
|
127
|
-
type RouterRoute = "matched" | "creating" | "cannot_create";
|
|
128
|
-
/**
|
|
129
|
-
* Response when an existing modification matches the request
|
|
130
|
-
*/
|
|
131
|
-
interface RouterMatchedResponse {
|
|
132
|
-
route: "matched";
|
|
133
|
-
modificationId: string;
|
|
134
|
-
title: string | null;
|
|
135
|
-
message: string;
|
|
136
|
-
textMessage: string;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Response when a new modification is being created
|
|
140
|
-
*/
|
|
141
|
-
interface RouterCreatingResponse {
|
|
142
|
-
route: "creating";
|
|
143
|
-
modificationId: string;
|
|
144
|
-
message: string;
|
|
145
|
-
textMessage: string;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Response when the request cannot be fulfilled
|
|
149
|
-
*/
|
|
150
|
-
interface RouterCannotCreateResponse {
|
|
151
|
-
route: "cannot_create";
|
|
152
|
-
requestId: string;
|
|
153
|
-
reason: string | null;
|
|
154
|
-
message: string;
|
|
155
|
-
textMessage: string;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Union type for all router responses
|
|
159
|
-
*/
|
|
160
|
-
type RouterResponse = RouterMatchedResponse | RouterCreatingResponse | RouterCannotCreateResponse;
|
|
161
|
-
/**
|
|
162
|
-
* Schema for router response validation
|
|
163
|
-
*/
|
|
164
|
-
declare const RouterResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
165
|
-
route: z.ZodLiteral<"matched">;
|
|
166
|
-
modificationId: z.ZodString;
|
|
167
|
-
title: z.ZodNullable<z.ZodString>;
|
|
168
|
-
message: z.ZodString;
|
|
169
|
-
textMessage: z.ZodString;
|
|
170
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
171
|
-
route: z.ZodLiteral<"creating">;
|
|
172
|
-
modificationId: z.ZodString;
|
|
173
|
-
message: z.ZodString;
|
|
174
|
-
textMessage: z.ZodString;
|
|
175
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
176
|
-
route: z.ZodLiteral<"cannot_create">;
|
|
177
|
-
requestId: z.ZodString;
|
|
178
|
-
reason: z.ZodNullable<z.ZodString>;
|
|
179
|
-
message: z.ZodString;
|
|
180
|
-
textMessage: z.ZodString;
|
|
181
|
-
}, z.core.$strip>], "route">;
|
|
182
|
-
/**
|
|
183
|
-
* Options for the useRouter hook
|
|
184
|
-
*/
|
|
185
|
-
type UseRouterOptions = {
|
|
186
|
-
/** Called when router submission succeeds */onSuccess?: (response: RouterResponse) => void; /** Called when router submission fails */
|
|
187
|
-
onError?: (error: Error) => void;
|
|
188
|
-
};
|
|
189
|
-
//#endregion
|
|
190
|
-
export { RouterRoute as C, RouterResponseSchema as S, ModifyWithAIOptions as _, DisableResponseSchema as a, RouterMatchedResponse as b, EnableResponseSchema as c, ModificationSchema as d, ModificationToggleOptions as f, ModifyWithAIArgs as g, ModifyResponseSchema as h, DisableResponse as i, ListModificationsArgs as l, ModifyResponse as m, ApiErrorSchema as n, EnableModificationArgs as o, ModificationsListSchema as p, DisableModificationArgs as r, EnableResponse as s, ApiError as t, Modification as u, RouterCannotCreateResponse as v, UseRouterOptions as w, RouterResponse as x, RouterCreatingResponse as y };
|
package/dist/types-V6wytIkL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{z as e}from"zod";const t=e.object({id:e.string(),title:e.string().nullable(),description:e.string().nullable(),status:e.enum([`pending`,`success`,`error`]),createdAt:e.number(),updatedAt:e.number(),enabled:e.boolean().nullable()}),n=e.array(t),r=e.object({modificationId:e.string()}),i=e.object({message:e.string(),modificationId:e.string(),endUserId:e.string()}),a=e.object({message:e.string(),modificationId:e.string(),endUserId:e.string()}),o=e.object({message:e.string().optional(),error:e.string().optional()}),s=e.discriminatedUnion(`route`,[e.object({route:e.literal(`matched`),modificationId:e.string(),title:e.string().nullable(),message:e.string(),textMessage:e.string()}),e.object({route:e.literal(`creating`),modificationId:e.string(),message:e.string(),textMessage:e.string()}),e.object({route:e.literal(`cannot_create`),requestId:e.string(),reason:e.string().nullable(),message:e.string(),textMessage:e.string()})]);export{n as a,t as i,a as n,r as o,i as r,s,o as t};
|