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 CHANGED
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
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
- }) => react_jsx_runtime1.JSX.Element;
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
- }) => react_jsx_runtime1.JSX.Element;
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): react_jsx_runtime1.JSX.Element;
54
+ }: ModificationPopoverProps): react_jsx_runtime0.JSX.Element;
55
55
  //#endregion
56
56
  //#region src/hook.d.ts
57
- declare const useMWAIComponents: () => react_jsx_runtime1.JSX.Element | null;
58
- declare const MWAIComponents: () => react_jsx_runtime1.JSX.Element | null;
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 };
@@ -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";
@@ -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,githubUsername:s,githubRepo:c,githubInstallationId:l}=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 u(r,{params:u}){let d=(await u).path;if(!t.includes(d))return e.json({error:`Not found`},{status:404});let f=d,p=await o(r),m=n[f];if(m&&!p)return e.json({error:`Unauthorized - end user ID required`},{status:401});let h=new URL(`/api/${d}`,i);r.nextUrl.searchParams.forEach((e,t)=>{h.searchParams.set(t,e)});let g=new Headers({"Content-Type":`application/json`,"x-api-key":a}),_;if(r.method===`POST`||r.method===`PUT`||r.method===`PATCH`)try{let e=await r.json();m?.inBody&&p&&(e.endUserId=p),f===`modify`&&(e.githubUsername=s,e.githubRepo=c,e.githubInstallationId=l),_=JSON.stringify(e)}catch{}r.method===`GET`&&m&&!m.inBody&&p&&h.searchParams.set(`endUserId`,p);let v=await fetch(h.toString(),{method:r.method,headers:g,body:_}),y=await v.text();return new Response(y,{status:v.status,statusText:v.statusText,headers:{"Content-Type":v.headers.get(`Content-Type`)||`application/json`}})}return{GET:u,POST:u,PUT:u,PATCH:u,DELETE:u}}export{i as createNextjsHandler,r as generateStaticParams};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "modifywithai",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",