New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@data-eden/network

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@data-eden/network - npm Package Compare versions

Comparing version 0.1.4 to 0.2.0

__tests__/tsconfig.json

12

__tests__/fetch-test.ts
import { beforeAll, afterAll, afterEach, expect, test, describe } from 'vitest';
import { Response, Request } from 'cross-fetch';
import { setupServer } from 'msw/node';
import { rest } from 'msw';
// TODO: this import _should_ use `msw/node`, but the types do not resolve
// properly when using `moduleResolution: 'node16'`
import { setupServer } from 'msw/lib/node/index.js';
import { MockedRequest, rest } from 'msw';
import { buildFetch, Middleware, NormalizedFetch } from '../src/fetch';
import { buildFetch, Middleware, NormalizedFetch } from '@data-eden/network';

@@ -34,3 +36,3 @@ describe('@data-eden/fetch', function () {

server.events.on('request:unhandled', (req) => {
server.events.on('request:unhandled', (req: MockedRequest) => {
console.log('%s %s has no handler', req.method, req.url.href);

@@ -116,3 +118,3 @@

const customFetch = (
_input: RequestInfo,
_input: URL | RequestInfo,
_init?: RequestInit

@@ -119,0 +121,0 @@ ): Promise<Response> => {

@@ -1,15 +0,6 @@

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { Request, fetch } from 'cross-fetch';
function combine(next, middleware) {
return (request) => __awaiter(this, void 0, void 0, function* () {
return async (request) => {
return middleware(request, next);
});
};
}

@@ -23,11 +14,11 @@ /**

export function buildFetch(middlewares, options) {
const _fetch = (options === null || options === void 0 ? void 0 : options.fetch) || fetch;
const _fetch = options?.fetch || fetch;
const curriedMiddlewares = [...middlewares]
.reverse()
.reduce(combine, _fetch);
return (rawRequest, init) => __awaiter(this, void 0, void 0, function* () {
return async (rawRequest, init) => {
const normalizedRequest = new Request(rawRequest, init);
return curriedMiddlewares(normalizedRequest);
});
};
}
//# sourceMappingURL=fetch.js.map
{
"name": "@data-eden/network",
"version": "0.1.4",
"version": "0.2.0",
"repository": {

@@ -27,4 +27,3 @@ "type": "git",

"devDependencies": {
"msw": "^0.42.0",
"vitest": "^0.13.1"
"msw": "^0.42.0"
},

@@ -31,0 +30,0 @@ "volta": {

@@ -1,2 +0,2 @@

import { defineConfig } from 'vite';
import { defineConfig } from 'vitest/config';

@@ -3,0 +3,0 @@ export default defineConfig({

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