rpc4next 0.4.12 → 0.4.14
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{deepMerge as x}from"./client-utils";import{createUrl as R}from"./url";import{normalizeHeaders as l}from"../lib/headers";const H=n=>{if(!n)return{};const{headers:i,headersInit:m,...p}=n;return p},U=n=>"content-type"in n?!0:Object.keys(n).some(i=>i.toLowerCase()==="content-type"),B=(n,i,m,p,g)=>async(d,O)=>{const a=n.replace(/^\$/,"").toUpperCase(),I=R([...i],m,p)(d?.url),C=O?.fetch??g.fetch??fetch,f=g.init,u=O?.init,w=l(f?.headers??f?.headersInit),T=l(u?.headers??u?.headersInit),j=l(d?.requestHeaders?.headers),o={...w,...T,...j},b=o.cookie,y=d?.requestHeaders?.cookies;if(y&&Object.keys(y).length>0){const s=Object.entries(y).map(([h,k])=>`${h}=${k}`).join("; ");o.cookie=b?`${b}; ${s}`:s}let t,r;const e=d?.body;e?.json!==void 0?(t=JSON.stringify(e.json),r="application/json"):typeof e?.text=="string"?(t=e.text,r="text/plain; charset=utf-8"):e?.formData instanceof FormData?(t=e.formData,r=void 0):e?.urlencoded instanceof URLSearchParams?(t=e.urlencoded,r="application/x-www-form-urlencoded; charset=UTF-8"):e?.raw!==void 0&&(t=e.raw,r=void 0),(a==="GET"||a==="HEAD")&&(t=void 0),!U(o)&&t&&r&&(o["content-type"]=r);const c=x(H(f),H(u));c.method=a,Object.keys(o).length>0&&(c.headers=o),t!==void 0&&(c.body=t);try{return await C(I.path,c)}catch(s){const h=s instanceof Error?s.message:String(s);throw new Error(`[httpMethod] ${a} ${I.path} failed: ${h}
|
|
1
|
+
import{deepMerge as x}from"./client-utils";import{createUrl as R}from"./url";import{normalizeHeaders as l}from"../lib/headers";const H=n=>{if(!n)return{};const{headers:i,headersInit:m,...p}=n;return p},U=n=>"content-type"in n?!0:Object.keys(n).some(i=>i.toLowerCase()==="content-type"),B=(n,i,m,p,g)=>async(d,O)=>{const a=n.replace(/^\$/,"").toUpperCase(),I=R([...i],m,p)(d?.url),C=O?.fetch??g.fetch??fetch,f=g.init,u=O?.init,w=l(f?.headers??f?.headersInit),T=l(u?.headers??u?.headersInit),j=l(d?.requestHeaders?.headers),o={...w,...T,...j},b=o.cookie,y=d?.requestHeaders?.cookies;if(y&&Object.keys(y).length>0){const s=Object.entries(y).map(([h,k])=>`${h}=${k}`).join("; ");o.cookie=b?`${b}; ${s}`:s}let t,r;const e=d?.body;e?.json!==void 0?(t=JSON.stringify(e.json),r="application/json"):typeof e?.text=="string"?(t=e.text,r="text/plain; charset=utf-8"):e?.formData instanceof FormData?(t=e.formData,r=void 0):e?.urlencoded instanceof URLSearchParams?(t=e.urlencoded,r="application/x-www-form-urlencoded; charset=UTF-8"):e?.raw!==void 0&&(t=e.raw,r=void 0),(a==="GET"||a==="HEAD")&&(t=void 0),!U(o)&&t&&r&&(o["content-type"]=r);const c=x(H(f),H(u));c.method=a,Object.keys(o).length>0&&(c.headers=o),t!==void 0&&(c.body=t);try{return await C(I.path,c)}catch(s){const h=s instanceof Error?s.message:String(s);throw new Error(`[httpMethod] ${a} ${I.path} failed: ${h}`,{cause:s})}};export{B as httpMethod};
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rpc4next",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.14",
|
|
4
4
|
"description": "Inspired by Hono RPC and Pathpida, rpc4next brings a lightweight and intuitive RPC solution to Next.js, making server-client communication seamless",
|
|
5
5
|
"author": "watanabe-1",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/watanabe-1/rpc4next#readme",
|
|
7
8
|
"repository": {
|
|
8
9
|
"type": "git",
|
|
9
10
|
"url": "git+https://github.com/watanabe-1/rpc4next.git",
|
|
10
11
|
"directory": "packages/rpc4next"
|
|
11
12
|
},
|
|
12
|
-
"homepage": "https://github.com/watanabe-1/rpc4next#readme",
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
@@ -94,12 +94,12 @@
|
|
|
94
94
|
"test:coverage": "vitest run --coverage.enabled true",
|
|
95
95
|
"test:ui": "vitest --ui --coverage.enabled true",
|
|
96
96
|
"test:watch": "vitest --watch",
|
|
97
|
-
"lint": "eslint
|
|
98
|
-
"lint:fix": "eslint
|
|
97
|
+
"lint": "eslint src",
|
|
98
|
+
"lint:fix": "eslint src --fix",
|
|
99
99
|
"typecheck": "tsc -b tsconfig.build.json --noEmit"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
|
-
"rpc4next-shared": "^0.1.
|
|
102
|
+
"rpc4next-shared": "^0.1.5"
|
|
103
103
|
},
|
|
104
104
|
"peerDependencies": {
|
|
105
105
|
"next": "^14.0.0 || ^15.0.0"
|