@alleyboss/micropay-solana-x402-paywall 3.3.4 → 3.3.5
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/next/index.cjs +22 -1
- package/dist/next/index.d.cts +1 -2
- package/dist/next/index.d.ts +1 -2
- package/dist/next/index.js +22 -1
- package/package.json +1 -1
package/dist/next/index.cjs
CHANGED
|
@@ -241,7 +241,28 @@ function createX402Middleware(config) {
|
|
|
241
241
|
network: config.network === "mainnet-beta" ? "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp" : "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
|
-
|
|
244
|
+
const wrappedHandler = next.withX402(handler, finalConfig, server$2);
|
|
245
|
+
return async (req, ctx) => {
|
|
246
|
+
const compatibleReq = new Proxy(req, {
|
|
247
|
+
get(target, prop) {
|
|
248
|
+
if (prop === "headers") {
|
|
249
|
+
const headers = target.headers;
|
|
250
|
+
return new Proxy(headers, {
|
|
251
|
+
get(hTarget, hProp) {
|
|
252
|
+
if (typeof hProp === "string" && !["get", "set", "has", "delete", "entries", "keys", "values", "forEach", "append"].includes(hProp) && typeof hTarget[hProp] === "undefined") {
|
|
253
|
+
return hTarget.get(hProp) || void 0;
|
|
254
|
+
}
|
|
255
|
+
const val2 = hTarget[hProp];
|
|
256
|
+
return typeof val2 === "function" ? val2.bind(hTarget) : val2;
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
const val = target[prop];
|
|
261
|
+
return typeof val === "function" ? val.bind(target) : val;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
return wrappedHandler(compatibleReq, ctx);
|
|
265
|
+
};
|
|
245
266
|
};
|
|
246
267
|
}
|
|
247
268
|
var withX402 = next.withX402;
|
package/dist/next/index.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as next_server from 'next/server';
|
|
2
1
|
import { withX402 as withX402$1 } from '@x402/next';
|
|
3
2
|
export { x402ResourceServer } from '@x402/core/server';
|
|
4
3
|
|
|
@@ -20,7 +19,7 @@ interface X402Config {
|
|
|
20
19
|
/**
|
|
21
20
|
* Create a specialized Next.js middleware with Solana support pre-configured
|
|
22
21
|
*/
|
|
23
|
-
declare function createX402Middleware(config: X402Config): (handler: any, routeConfig?: any) => (
|
|
22
|
+
declare function createX402Middleware(config: X402Config): (handler: any, routeConfig?: any) => (req: any, ctx: any) => Promise<any>;
|
|
24
23
|
declare const withX402: typeof withX402$1;
|
|
25
24
|
|
|
26
25
|
export { type X402Config, createX402Middleware, withX402 };
|
package/dist/next/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as next_server from 'next/server';
|
|
2
1
|
import { withX402 as withX402$1 } from '@x402/next';
|
|
3
2
|
export { x402ResourceServer } from '@x402/core/server';
|
|
4
3
|
|
|
@@ -20,7 +19,7 @@ interface X402Config {
|
|
|
20
19
|
/**
|
|
21
20
|
* Create a specialized Next.js middleware with Solana support pre-configured
|
|
22
21
|
*/
|
|
23
|
-
declare function createX402Middleware(config: X402Config): (handler: any, routeConfig?: any) => (
|
|
22
|
+
declare function createX402Middleware(config: X402Config): (handler: any, routeConfig?: any) => (req: any, ctx: any) => Promise<any>;
|
|
24
23
|
declare const withX402: typeof withX402$1;
|
|
25
24
|
|
|
26
25
|
export { type X402Config, createX402Middleware, withX402 };
|
package/dist/next/index.js
CHANGED
|
@@ -240,7 +240,28 @@ function createX402Middleware(config) {
|
|
|
240
240
|
network: config.network === "mainnet-beta" ? "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp" : "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"
|
|
241
241
|
}
|
|
242
242
|
};
|
|
243
|
-
|
|
243
|
+
const wrappedHandler = withX402$1(handler, finalConfig, server);
|
|
244
|
+
return async (req, ctx) => {
|
|
245
|
+
const compatibleReq = new Proxy(req, {
|
|
246
|
+
get(target, prop) {
|
|
247
|
+
if (prop === "headers") {
|
|
248
|
+
const headers = target.headers;
|
|
249
|
+
return new Proxy(headers, {
|
|
250
|
+
get(hTarget, hProp) {
|
|
251
|
+
if (typeof hProp === "string" && !["get", "set", "has", "delete", "entries", "keys", "values", "forEach", "append"].includes(hProp) && typeof hTarget[hProp] === "undefined") {
|
|
252
|
+
return hTarget.get(hProp) || void 0;
|
|
253
|
+
}
|
|
254
|
+
const val2 = hTarget[hProp];
|
|
255
|
+
return typeof val2 === "function" ? val2.bind(hTarget) : val2;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
const val = target[prop];
|
|
260
|
+
return typeof val === "function" ? val.bind(target) : val;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
return wrappedHandler(compatibleReq, ctx);
|
|
264
|
+
};
|
|
244
265
|
};
|
|
245
266
|
}
|
|
246
267
|
var withX402 = withX402$1;
|
package/package.json
CHANGED