inject fetch into KV emu

This commit is contained in:
41666 2020-12-14 14:10:24 -05:00
parent 22cbde52dd
commit 12d8e99513
2 changed files with 3 additions and 0 deletions

View file

@ -90,6 +90,7 @@
"jest-styled-components": "^7.0.3",
"level": "^6.0.1",
"minimist": "^1.2.5",
"node-fetch": "^2.6.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.2.1",
"prettier-plugin-organize-imports": "^1.1.1",

View file

@ -9,6 +9,7 @@ const { Crypto } = require('@peculiar/webcrypto');
const roleypolyConfig = require('../backend-worker/roleypoly.config');
const { KVShim } = require('./kv');
const crypto = new Crypto();
const fetch = require('node-fetch');
const getKVs = (namespaces = []) =>
namespaces.reduce((acc, ns) => ({ ...acc, [ns]: new KVShim(ns) }), {});
@ -43,6 +44,7 @@ const context = () =>
setInterval: setInterval,
clearInterval: clearInterval,
clearTimeout: clearTimeout,
fetch: fetch,
...workerShims,
},
{