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

@wix/sdk

Package Overview
Dependencies
Maintainers
33
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wix/sdk - npm Package Compare versions

Comparing version

to
1.1.9

21

dist/cjs/wixClient.js

@@ -62,7 +62,7 @@ "use strict";

const wrapperBuilder = (origFunc, sessionParams // @ts-expect-error
const wrapperBuilder = (origFunc, headers // @ts-expect-error
) => {
return origFunc({
request: async factory => {
if (!sessionParams.accessToken) {
if (!headers.Authorization) {
throw {

@@ -94,3 +94,3 @@ response: {

origin: config.domain,
Authorization: sessionParams.accessToken,
...headers,
'Content-Type': 'application/json'

@@ -112,5 +112,4 @@ }

const _session = {
accessToken: '',
refreshToken: ''
const _headers = {
Authorization: ''
};

@@ -125,3 +124,3 @@

} else if (typeof obj[key] === 'function') {
prev[key] = wrapperBuilder(value, _session);
prev[key] = wrapperBuilder(value, _headers);
} else {

@@ -138,4 +137,8 @@ prev[key] = value;

setSession: sessionParams => {
_session.accessToken = sessionParams.accessToken;
_session.refreshToken = sessionParams.refreshToken;
_headers.Authorization = sessionParams.accessToken;
},
setHeaders: headers => {
for (const k in headers) {
_headers[k] = headers[k];
}
}

@@ -142,0 +145,0 @@ };

@@ -60,7 +60,7 @@ import _extends from "@babel/runtime/helpers/extends";

const wrapperBuilder = (origFunc, sessionParams // @ts-expect-error
const wrapperBuilder = (origFunc, headers // @ts-expect-error
) => {
return origFunc({
request: async factory => {
if (!sessionParams.accessToken) {
if (!headers.Authorization) {
throw {

@@ -90,7 +90,7 @@ response: {

}, {
headers: {
origin: config.domain,
Authorization: sessionParams.accessToken,
headers: _extends({
origin: config.domain
}, headers, {
'Content-Type': 'application/json'
}
})
}));

@@ -110,5 +110,4 @@ const data = await res.json();

const _session = {
accessToken: '',
refreshToken: ''
const _headers = {
Authorization: ''
};

@@ -126,3 +125,3 @@

} else if (typeof obj[key] === 'function') {
prev[key] = wrapperBuilder(value, _session);
prev[key] = wrapperBuilder(value, _headers);
} else {

@@ -139,4 +138,8 @@ prev[key] = value;

setSession: sessionParams => {
_session.accessToken = sessionParams.accessToken;
_session.refreshToken = sessionParams.refreshToken;
_headers.Authorization = sessionParams.accessToken;
},
setHeaders: headers => {
for (const k in headers) {
_headers[k] = headers[k];
}
}

@@ -143,0 +146,0 @@ });

@@ -6,2 +6,5 @@ import { Simplify } from 'type-fest';

}
declare type Headers = {
Authorization: string;
} & Record<string, string>;
declare type WithoutFunctionWrapper<T> = {

@@ -12,2 +15,3 @@ [Key in keyof T]: T[Key] extends (...args: any) => any ? ReturnType<T[Key]> : Simplify<WithoutFunctionWrapper<T[Key]>>;

setSession(sessionParams: SessionParams): void;
setHeaders(headers: Headers): void;
}

@@ -14,0 +18,0 @@ export declare function session(tokens: Partial<SessionParams> | undefined, configParam: {

{
"name": "@wix/sdk",
"version": "1.1.8",
"version": "1.1.9",
"license": "UNLICENSED",

@@ -32,3 +32,3 @@ "author": {

"@wix/image-kit": "^1.23.0",
"@wix/sdk-types": "^1.1.8",
"@wix/sdk-types": "^1.1.9",
"querystring": "^0.2.1",

@@ -68,3 +68,4 @@ "type-fest": "^2.19.0"

"autoDetect": true
}
},
"falconPackageHash": "41abd56e0f217373904d67db99b853eeccbc83859c1f70938770746f"
}

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