modifywithai 1.9.0 → 1.10.0

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.
@@ -0,0 +1,191 @@
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};
@@ -0,0 +1,43 @@
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 };
@@ -0,0 +1 @@
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};
@@ -0,0 +1,33 @@
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 };
@@ -0,0 +1 @@
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};
@@ -0,0 +1,15 @@
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 };
@@ -0,0 +1 @@
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};
@@ -1,7 +1,6 @@
1
1
  import { z } from "zod";
2
2
 
3
3
  //#region src/types.d.ts
4
-
5
4
  /**
6
5
  * Schema for a modification in the ModifyWithAI system
7
6
  */
@@ -87,49 +86,105 @@ type ApiError = z.infer<typeof ApiErrorSchema>;
87
86
  * Options for modification requests
88
87
  */
89
88
  type ModifyWithAIOptions = {
90
- /** Called when modification submission succeeds */
91
- onSuccess?: () => void;
92
- /** Called when modification submission fails */
89
+ /** Called when modification submission succeeds */onSuccess?: () => void; /** Called when modification submission fails */
93
90
  onError?: (error: Error) => void;
94
91
  };
95
92
  /**
96
93
  * Arguments for listModifications function
97
94
  */
98
95
  type ListModificationsArgs = {
99
- /** The MWAI instance ID */
100
- id: string;
96
+ /** The MWAI instance ID */id: string;
101
97
  };
102
98
  /**
103
99
  * Arguments for modifyWithAI function
104
100
  */
105
101
  type ModifyWithAIArgs = {
106
- /** The MWAI instance ID */
107
- id: string;
108
- /** The modification prompt */
102
+ /** The MWAI instance ID */id: string; /** The modification prompt */
109
103
  prompt: string;
110
104
  };
111
105
  /**
112
106
  * Arguments for enableModification function
113
107
  */
114
108
  type EnableModificationArgs = {
115
- /** The ID of the modification to enable */
116
- modificationId: string;
109
+ /** The ID of the modification to enable */modificationId: string;
117
110
  };
118
111
  /**
119
112
  * Arguments for disableModification function
120
113
  */
121
114
  type DisableModificationArgs = {
122
- /** The ID of the modification to disable */
123
- modificationId: string;
115
+ /** The ID of the modification to disable */modificationId: string;
124
116
  };
125
117
  /**
126
118
  * Options for enable/disable modification requests
127
119
  */
128
120
  type ModificationToggleOptions = {
129
- /** Called when the operation succeeds */
130
- onSuccess?: () => void;
131
- /** Called when the operation fails */
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 */
132
187
  onError?: (error: Error) => void;
133
188
  };
134
189
  //#endregion
135
- export { ModifyWithAIOptions as _, DisableResponseSchema as a, 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 };
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 };
@@ -1 +1 @@
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()});export{n as a,t as i,a as n,r as o,i as r,o as t};
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};
package/package.json CHANGED
@@ -1,37 +1,71 @@
1
1
  {
2
- "name": "modifywithai",
3
- "version": "1.9.0",
4
- "type": "module",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- ".": "./dist/index.js",
10
- "./nextjs/api": "./dist/nextjs/api.js",
11
- "./nextjs/shims": "./dist/nextjs/shims.js",
12
- "./react": "./dist/react/index.js",
13
- "./package.json": "./package.json"
14
- },
15
- "files": [
16
- "dist",
17
- "AGENTS.md"
18
- ],
19
- "scripts": {
20
- "build": "bun run --bun tsdown",
21
- "typecheck": "bun run --bun tsc --noEmit"
22
- },
23
- "devDependencies": {
24
- "@types/bun": "latest",
25
- "@types/react": "^19.2.7",
26
- "@types/react-dom": "^19.2.3",
27
- "tsdown": "^0.18.2"
28
- },
29
- "peerDependencies": {
30
- "react": "^19.2.1",
31
- "next": "^16.1.1"
32
- },
33
- "dependencies": {
34
- "@tanstack/react-query": "^5.0.0",
35
- "zod": "^4.2.0"
36
- }
2
+ "name": "modifywithai",
3
+ "version": "1.10.0",
4
+ "type": "module",
5
+ "types": "./src/index.ts",
6
+ "exports": {
7
+ ".": "./dist/index.js",
8
+ "./nextjs/api": "./dist/nextjs/api.js",
9
+ "./nextjs/shims": "./dist/nextjs/shims.js",
10
+ "./react": "./dist/react/index.js",
11
+ "./remix": "./dist/remix/index.js",
12
+ "./remix/api": "./dist/remix/api.js",
13
+ "./remix/shims": "./dist/remix/shims.js",
14
+ "./tanstack-start": "./dist/tanstack-start/index.js",
15
+ "./tanstack-start/api": "./dist/tanstack-start/api.js",
16
+ "./tanstack-start/shims": "./dist/tanstack-start/shims.js",
17
+ "./package.json": "./package.json"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "AGENTS.md"
22
+ ],
23
+ "scripts": {
24
+ "build": "bun run --bun tsdown",
25
+ "typecheck": "tsc --noEmit"
26
+ },
27
+ "devDependencies": {
28
+ "@types/bun": "1.3.6",
29
+ "@types/react": "^19.2.8",
30
+ "@types/react-dom": "^19.2.3",
31
+ "typescript": "^5.8.3",
32
+ "tsdown": "^0.20.0-beta.2"
33
+ },
34
+ "peerDependencies": {
35
+ "react": "^18.0.0 || ^19.0.0",
36
+ "next": "^14.0.0 || ^15.0.0 || ^16.0.0",
37
+ "@remix-run/node": "^2.0.0",
38
+ "@remix-run/react": "^2.0.0",
39
+ "react-router": "^7.0.0",
40
+ "react-router-dom": "^6.0.0 || ^7.0.0",
41
+ "@tanstack/react-router": "^1.0.0",
42
+ "@tanstack/react-start": "^1.0.0"
43
+ },
44
+ "peerDependenciesMeta": {
45
+ "next": {
46
+ "optional": true
47
+ },
48
+ "@remix-run/node": {
49
+ "optional": true
50
+ },
51
+ "@remix-run/react": {
52
+ "optional": true
53
+ },
54
+ "react-router": {
55
+ "optional": true
56
+ },
57
+ "react-router-dom": {
58
+ "optional": true
59
+ },
60
+ "@tanstack/react-router": {
61
+ "optional": true
62
+ },
63
+ "@tanstack/react-start": {
64
+ "optional": true
65
+ }
66
+ },
67
+ "dependencies": {
68
+ "@tanstack/react-query": "^5.0.0",
69
+ "zod": "^4.2.0"
70
+ }
37
71
  }