Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cf-bindings-proxy

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cf-bindings-proxy - npm Package Compare versions

Comparing version 0.3.3 to 0.4.0-c330ca5

127

package.json
{
"name": "cf-bindings-proxy",
"version": "0.3.3",
"description": "Experimental proxy for interfacing with bindings in projects targeting Cloudflare Pages",
"license": "MIT",
"author": "James",
"type": "module",
"bin": "./cli/index.js",
"exports": {
".": {
"import": "./index.js",
"require": "./index.cjs"
}
},
"publishConfig": {
"directory": "dist"
},
"repository": {
"type": "git",
"url": "https://github.com/james-elicx/cf-bindings-proxy"
},
"bugs": {
"url": "https://github.com/james-elicx/cf-bindings-proxy/issues"
},
"homepage": "https://github.com/james-elicx/cf-bindings-proxy#readme",
"scripts": {
"dev": "node ./cli/index.js",
"build": "vite build && node ./scripts/build.js",
"build:watch": "npm run build --watch",
"lint": "eslint \"./**/*.{cjs,js,jsx,ts,tsx}\"",
"prettier": "prettier --ignore-unknown --ignore-path=.gitignore --check .",
"prettier:format": "prettier --ignore-unknown --ignore-path=.gitignore --write .",
"tsc": "tsc --noEmit",
"test": "vitest run",
"test:kill": "rm -rf .wrangler; sudo kill -9 `sudo lsof -i :8799 -t`",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"alter-version": "node ./scripts/alter-version.js",
"release": "changeset publish"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@cloudflare/workers-types": "^4.20230814.0",
"@tsconfig/strictest": "^2.0.1",
"@types/node": "^20.3.3",
"eslint": "^8.41.0",
"eslint-config-ixn": "^1.4.2",
"kysely": "^0.26.1",
"kysely-d1": "^0.3.0",
"nodemon": "^2.0.22",
"prettier": "^2.8.8",
"typescript": "^5.0.4",
"vite": "^4.3.5",
"vite-plugin-dts": "^2.3.0",
"vite-plugin-externalize-deps": "^0.6.0",
"vitest": "^0.31.0",
"vitest-environment-miniflare": "^2.14.0",
"wrangler": "^3.6.0"
},
"peerDependencies": {
"@cloudflare/workers-types": ">=4",
"wrangler": ">=3.0.0"
}
"name": "cf-bindings-proxy",
"version": "0.4.0-c330ca5",
"description": "Experimental proxy for interfacing with bindings in projects targeting Cloudflare Pages",
"license": "MIT",
"author": "James",
"type": "module",
"bin": "./cli/index.js",
"exports": {
".": {
"import": "./index.js",
"require": "./index.cjs"
}
},
"publishConfig": {
"directory": "dist"
},
"repository": {
"type": "git",
"url": "https://github.com/james-elicx/cf-bindings-proxy"
},
"bugs": {
"url": "https://github.com/james-elicx/cf-bindings-proxy/issues"
},
"homepage": "https://github.com/james-elicx/cf-bindings-proxy#readme",
"scripts": {
"dev": "node ./cli/index.js",
"build": "vite build && node ./scripts/build.js",
"build:watch": "npm run build --watch",
"lint": "eslint \"./**/*.{cjs,js,jsx,ts,tsx}\"",
"prettier": "prettier --ignore-unknown --ignore-path=.gitignore --check .",
"prettier:format": "prettier --ignore-unknown --ignore-path=.gitignore --write .",
"tsc": "tsc --noEmit",
"test": "vitest run",
"test:kill": "rm -rf .wrangler; sudo kill -9 `sudo lsof -i :8799 -t`",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"alter-version": "node ./scripts/alter-version.js",
"release": "changeset publish"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@cloudflare/workers-types": "^4.20230814.0",
"@tsconfig/strictest": "^2.0.1",
"@types/node": "^20.3.3",
"eslint": "^8.41.0",
"eslint-config-ixn": "^1.4.2",
"kysely": "^0.26.1",
"kysely-d1": "^0.3.0",
"nodemon": "^2.0.22",
"prettier": "^2.8.8",
"typescript": "^5.0.4",
"vite": "^4.3.5",
"vite-plugin-dts": "^2.3.0",
"vite-plugin-externalize-deps": "^0.6.0",
"vitest": "^0.31.0",
"vitest-environment-miniflare": "^2.14.0",
"wrangler": "^3.6.0"
},
"peerDependencies": {
"@cloudflare/workers-types": ">=4",
"wrangler": ">=3.0.0"
},
"versionMetadata": {
"type": "BETA"
}
}

@@ -1,16 +0,16 @@

import { transformData as _, prepareDataForProxy as u } from "./transform.js";
const h = async (e) => ({
...e,
import { transformData as u, prepareDataForProxy as _ } from "./transform.js";
const f = async (i) => ({
...i,
__calls: await Promise.all(
e.__calls.map(async (i) => ({
...i,
args: await Promise.all(i.args.map((n) => u(n.data, n)))
i.__calls.map(async (o) => ({
...o,
args: await Promise.all(o.args.map((n) => _(n.data, n)))
}))
)
}), c = async (e) => {
const i = await h(e);
}), s = async (i) => {
const o = await f(i);
let n;
try {
n = await fetch("http://127.0.0.1:8799", {
body: JSON.stringify(i),
body: JSON.stringify(o),
method: "POST",

@@ -23,32 +23,38 @@ cache: "no-store",

}
const { success: a, data: r, transform: t } = await n.json();
if (!a)
throw new Error(r || "Bad response from binding proxy");
return t ? _(r, t) : r;
}, y = (e, i, n) => new Proxy(n, {
get(a, r) {
if (!n || ["then", Symbol.iterator, Symbol.toStringTag].includes(r))
const { success: c, data: t, transform: r } = await n.json();
if (!c)
throw new Error(t || "Bad response from binding proxy");
return r ? u(t, r) : t;
}, y = (i, o, n) => new Proxy(n, {
get(c, t) {
if (!n || ["then", Symbol.iterator, Symbol.toStringTag].includes(t))
return;
if (r in n || ["error", "results"].includes(r))
return n[r];
if (Array.isArray(n) && typeof r == "string" && !Number.isNaN(Number(r)))
return n[Number(r)];
if (["toJSON"].includes(r))
if (t in n || ["error", "results"].includes(t))
return n[t];
if (Array.isArray(n) && typeof t == "string" && !Number.isNaN(Number(t)))
return n[Number(t)];
if (["toJSON"].includes(t))
return n;
const t = l(e, !0);
return t.__original_call = i, async (...s) => (t.__calls.push({ prop: r, args: s.map((o) => ({ data: o })) }), c(t));
if (t === "writeHttpMetadata" && n && typeof n == "object") {
const e = n.httpMetadata || {};
return (a) => {
e.cacheControl && a.set("cache-control", e.cacheControl), e.cacheExpiry && a.set("expires", e.cacheExpiry.toUTCString()), e.contentDisposition && a.set("content-disposition", e.contentDisposition), e.contentEncoding && a.set("content-encoding", e.contentEncoding), e.contentLanguage && a.set("content-language", e.contentLanguage), e.contentType && a.set("content-type", e.contentType);
};
}
const r = l(i, !0);
return r.__original_call = o, async (...e) => (r.__calls.push({ prop: t, args: e.map((a) => ({ data: a })) }), s(r));
}
}), f = (e) => ["prepare"].includes(e) ? ["first", "run", "all", "raw"] : [], l = (e, i = !1) => new Proxy({ __bindingId: e, __calls: [], __chainUntil: [] }, {
get(n, a) {
if (typeof a == "string" && a.startsWith("__"))
return n[a];
if (a !== "toJSON" && !i) {
if (n.__chainUntil.length || (n.__chainUntil = f(a)), n.__chainUntil.length && !n.__chainUntil.includes(a)) {
const r = l(e);
return r.__chainUntil = n.__chainUntil, r.__calls = n.__calls, (...t) => (n.__calls.push({ prop: a, args: t.map((s) => ({ data: s })) }), r);
}), h = (i) => ["prepare"].includes(i) ? ["first", "run", "all", "raw"] : [], l = (i, o = !1) => new Proxy({ __bindingId: i, __calls: [], __chainUntil: [] }, {
get(n, c) {
if (typeof c == "string" && c.startsWith("__"))
return n[c];
if (c !== "toJSON" && !o) {
if (n.__chainUntil.length || (n.__chainUntil = h(c)), n.__chainUntil.length && !n.__chainUntil.includes(c)) {
const t = l(i);
return t.__chainUntil = n.__chainUntil, t.__calls = n.__calls, (...r) => (n.__calls.push({ prop: c, args: r.map((e) => ({ data: e })) }), t);
}
return async (...r) => {
n.__calls.push({ prop: a, args: r.map((s) => ({ data: s })) });
const t = await c(n);
return typeof t != "object" || !t ? t : y(e, n, t);
return async (...t) => {
n.__calls.push({ prop: c, args: t.map((e) => ({ data: e })) });
const r = await s(n);
return typeof r != "object" || !r ? r : y(i, n, r);
};

@@ -55,0 +61,0 @@ }

@@ -99,5 +99,5 @@ <p align="center">

- [x] put
- [ ] writeHttpMetadata
- [x] writeHttpMetadata
- [x] get
- [ ] writeHttpMetadata
- [x] writeHttpMetadata
- [x] text

@@ -110,7 +110,7 @@ - [x] json

- [x] head
- [ ] writeHttpMetadata
- [x] writeHttpMetadata
- [x] list
- [ ] writeHttpMetadata
- [x] writeHttpMetadata
- [x] delete
- [ ] createMultipartUpload
- [ ] resumeMultipartUpload

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc