modifywithai 1.1.0 → 1.2.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.
- package/dist/index.d.ts +6 -6
- package/dist/nextjs/api.d.ts +0 -12
- package/dist/nextjs/api.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/head.d.ts
|
|
@@ -6,7 +6,7 @@ declare const MWAIHead: ({
|
|
|
6
6
|
basePath
|
|
7
7
|
}?: {
|
|
8
8
|
basePath?: string;
|
|
9
|
-
}) =>
|
|
9
|
+
}) => react_jsx_runtime0.JSX.Element;
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/provider.d.ts
|
|
12
12
|
declare const MWAIProvider: ({
|
|
@@ -15,7 +15,7 @@ declare const MWAIProvider: ({
|
|
|
15
15
|
}: {
|
|
16
16
|
id: string;
|
|
17
17
|
children: ReactNode;
|
|
18
|
-
}) =>
|
|
18
|
+
}) => react_jsx_runtime0.JSX.Element;
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/popover.d.ts
|
|
21
21
|
type ModificationPopoverProps = {
|
|
@@ -51,10 +51,10 @@ declare function MWAIButton({
|
|
|
51
51
|
loadingText,
|
|
52
52
|
side,
|
|
53
53
|
align
|
|
54
|
-
}: ModificationPopoverProps):
|
|
54
|
+
}: ModificationPopoverProps): react_jsx_runtime0.JSX.Element;
|
|
55
55
|
//#endregion
|
|
56
56
|
//#region src/hook.d.ts
|
|
57
|
-
declare const useMWAIComponents: () =>
|
|
58
|
-
declare const MWAIComponents: () =>
|
|
57
|
+
declare const useMWAIComponents: () => react_jsx_runtime0.JSX.Element | null;
|
|
58
|
+
declare const MWAIComponents: () => react_jsx_runtime0.JSX.Element | null;
|
|
59
59
|
//#endregion
|
|
60
60
|
export { MWAIButton, MWAIComponents, MWAIHead, MWAIProvider, useMWAIComponents };
|
package/dist/nextjs/api.d.ts
CHANGED
|
@@ -17,18 +17,6 @@ type CreateApiProxyHandlerOptions = {
|
|
|
17
17
|
* This will be injected into API calls that require endUserId
|
|
18
18
|
*/
|
|
19
19
|
getEndUserId: (request: NextRequest) => Promise<string | null>;
|
|
20
|
-
/**
|
|
21
|
-
* GitHub username for the repository owner
|
|
22
|
-
*/
|
|
23
|
-
githubUsername: string;
|
|
24
|
-
/**
|
|
25
|
-
* GitHub repository name
|
|
26
|
-
*/
|
|
27
|
-
githubRepo: string;
|
|
28
|
-
/**
|
|
29
|
-
* GitHub App installation ID
|
|
30
|
-
*/
|
|
31
|
-
githubInstallationId: string;
|
|
32
20
|
};
|
|
33
21
|
declare function generateStaticParams(): Promise<{
|
|
34
22
|
path: "list" | "enable" | "disable" | "modify" | "status";
|
package/dist/nextjs/api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NextResponse as e}from"next/server";const t=[`list`,`enable`,`disable`,`modify`,`status`],n={modify:{method:`POST`,inBody:!0},disable:{method:`POST`,inBody:!0},enable:{method:`POST`,inBody:!0},list:{method:`GET`,inBody:!1}};async function r(){return t.map(e=>({path:e}))}function i(r){let{baseUrl:i=`https://modifywithai.com`,apiKey:a=process.env.MWAI_API_KEY,getEndUserId:o
|
|
1
|
+
import{NextResponse as e}from"next/server";const t=[`list`,`enable`,`disable`,`modify`,`status`],n={modify:{method:`POST`,inBody:!0},disable:{method:`POST`,inBody:!0},enable:{method:`POST`,inBody:!0},list:{method:`GET`,inBody:!1}};async function r(){return t.map(e=>({path:e}))}function i(r){let{baseUrl:i=`https://modifywithai.com`,apiKey:a=process.env.MWAI_API_KEY,getEndUserId:o}=r;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(r,{params:s}){let c=(await s).path;if(!t.includes(c))return e.json({error:`Not found`},{status:404});let l=c,u=await o(r),d=n[l];if(d&&!u)return e.json({error:`Unauthorized - end user ID required`},{status:401});let f=new URL(`/api/${c}`,i);r.nextUrl.searchParams.forEach((e,t)=>{f.searchParams.set(t,e)});let p=new Headers({"Content-Type":`application/json`,"x-api-key":a}),m;if(r.method===`POST`||r.method===`PUT`||r.method===`PATCH`)try{let e=await r.json();d?.inBody&&u&&(e.endUserId=u),m=JSON.stringify(e)}catch{}r.method===`GET`&&d&&!d.inBody&&u&&f.searchParams.set(`endUserId`,u);let h=await fetch(f.toString(),{method:r.method,headers:p,body:m}),g=await h.text();return new Response(g,{status:h.status,statusText:h.statusText,headers:{"Content-Type":h.headers.get(`Content-Type`)||`application/json`}})}return{GET:s,POST:s,PUT:s,PATCH:s,DELETE:s}}export{i as createNextjsHandler,r as generateStaticParams};
|