Socket
Socket
Sign inDemoInstall

@empathyco/x-adapter

Package Overview
Dependencies
Maintainers
5
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@empathyco/x-adapter - npm Package Compare versions

Comparing version 8.0.0-alpha.5 to 8.0.0-alpha.6

7

dist/cjs/http-clients/__mocks__/fetch.mock.js

@@ -27,3 +27,8 @@ "use strict";

else {
resolve({ ok: true, json: () => Promise.resolve(response) });
resolve({
ok: true,
status: 200,
json: () => Promise.resolve(response),
text: () => Promise.resolve(JSON.stringify(response))
});
}

@@ -30,0 +35,0 @@ });

6

dist/cjs/http-clients/fetch.http-client.js

@@ -16,4 +16,4 @@ "use strict";

*/
const fetchHttpClient = (endpoint, { id = endpoint, parameters = {}, properties, sendParamsInBody = false } = {}) => {
const signal = abortAndGetNewAbortSignal(id);
const fetchHttpClient = (endpoint, { id = endpoint, cancelable = true, parameters = {}, properties, sendParamsInBody = false } = {}) => {
const signal = cancelable ? { signal: abortAndGetNewAbortSignal(id) } : {};
const flatParameters = (0, x_utils_1.flatObject)(parameters);

@@ -25,3 +25,3 @@ const url = sendParamsInBody ? endpoint : (0, utils_1.buildUrl)(endpoint, flatParameters);

...bodyParameters,
signal
...signal
}).then(utils_1.toJson);

@@ -28,0 +28,0 @@ };

@@ -18,3 +18,4 @@ "use strict";

if (response.ok) {
return response.json();
// eslint-disable-next-line @typescript-eslint/no-extra-parens
return response.text().then(text => (text ? JSON.parse(text) : {}));
}

@@ -21,0 +22,0 @@ else {

@@ -24,3 +24,8 @@ export const okFetchMock = jest.fn(fetchMock({}));

else {
resolve({ ok: true, json: () => Promise.resolve(response) });
resolve({
ok: true,
status: 200,
json: () => Promise.resolve(response),
text: () => Promise.resolve(JSON.stringify(response))
});
}

@@ -27,0 +32,0 @@ });

@@ -13,4 +13,4 @@ import { flatObject } from '@empathyco/x-utils';

*/
export const fetchHttpClient = (endpoint, { id = endpoint, parameters = {}, properties, sendParamsInBody = false } = {}) => {
const signal = abortAndGetNewAbortSignal(id);
export const fetchHttpClient = (endpoint, { id = endpoint, cancelable = true, parameters = {}, properties, sendParamsInBody = false } = {}) => {
const signal = cancelable ? { signal: abortAndGetNewAbortSignal(id) } : {};
const flatParameters = flatObject(parameters);

@@ -22,3 +22,3 @@ const url = sendParamsInBody ? endpoint : buildUrl(endpoint, flatParameters);

...bodyParameters,
signal
...signal
}).then(toJson);

@@ -25,0 +25,0 @@ };

@@ -15,3 +15,4 @@ import { forEach } from '@empathyco/x-utils';

if (response.ok) {
return response.json();
// eslint-disable-next-line @typescript-eslint/no-extra-parens
return response.text().then(text => (text ? JSON.parse(text) : {}));
}

@@ -18,0 +19,0 @@ else {

/// <reference types="jest" />
export declare const okFetchMock: jest.Mock<unknown, any[]>;
export declare const okFetchMock: jest.Mock<Promise<Response>, [url: string, params: RequestInit]>;
export declare const koFetchMock: jest.Mock<Promise<{

@@ -17,2 +17,2 @@ ok: boolean;

*/
export declare function fetchMock(response: any): any;
export declare function fetchMock(response: unknown): (url: string, params: RequestInit) => Promise<Response>;

@@ -22,2 +22,6 @@ import { Dictionary } from '@empathyco/x-utils';

/**
* True if the request can be cancelled.
*/
cancelable?: boolean;
/**
* A flag to send parameters in the body if true or in the url QueryString if false.

@@ -24,0 +28,0 @@ */

{
"name": "@empathyco/x-adapter",
"version": "8.0.0-alpha.5",
"version": "8.0.0-alpha.6",
"description": "A utils library to create a client for any API",

@@ -51,3 +51,3 @@ "author": "Empathy Systems Corporation S.L.",

},
"gitHead": "0687f98044c987babc41bb8109b6550f0a9985a1"
"gitHead": "7a369790f31c25b69de07ad659e7a705bbeb71e4"
}

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

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