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

@commercetools/frontend-sdk

Package Overview
Dependencies
Maintainers
2
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools/frontend-sdk - npm Package Compare versions

Comparing version 1.9.3 to 1.10.0

lib/chunk-3FMOF5CB.mjs

7

CHANGELOG.md
## Version 1.10.0 (2024-04-09)
* Set cookie options httpOnly and secure to true by default
* Added the ability to skip the action queue on the SDK.callAction method
## Version 1.9.3 (2024-03-04)
* Improved error handling

@@ -6,0 +11,0 @@

35

lib/index.js

@@ -648,3 +648,6 @@ "use strict";

async setCookie(key, data, options) {
let _cookieOptions;
let _cookieOptions = {
httpOnly: true,
secure: true
};
let _req;

@@ -656,3 +659,3 @@ let _res;

_res = res;
_cookieOptions = _options;
_cookieOptions = Object.assign({}, _options, _cookieOptions);
}

@@ -864,2 +867,3 @@ const cookieStr = (0, import_cookie2.serialize)(key, this.stringify(data), {

* @param {Object.<string, number, boolean, string[], number[], boolean[]>} [options.query] - An optional key, value pair object to be serialised into the url query.
* @param {boolean} [options.skipQueue] - An optional boolean, default false indicating whether or not to skip the action queue and execute fully asyncronously. May cause race conditions if used incorrectly.
* @param {Object} [options.serverOptions] - An optional object containing the res and req objects for ServerResponse and IncomingMessage with cookies respectively. Required for server-side rendering session management.

@@ -879,15 +883,18 @@ *

let result;
const action = () => fetcher(
this.#normaliseUrl(
`${this.#endpoint}/frontastic/action/${options.actionName}${params}`
),
fetcherOptions,
options.serverOptions,
this.#sessionLifetime
);
try {
result = await this.#actionQueue.add(
() => {
return fetcher(
this.#normaliseUrl(
`${this.#endpoint}/frontastic/action/${options.actionName}${params}`
),
fetcherOptions,
options.serverOptions,
this.#sessionLifetime
);
}
);
if (options.skipQueue) {
result = await action();
} else {
result = await this.#actionQueue.add(
action
);
}
} catch (error) {

@@ -894,0 +901,0 @@ return this.#handleError({

@@ -88,3 +88,6 @@ "use strict";

async setCookie(key, data, options) {
let _cookieOptions;
let _cookieOptions = {
httpOnly: true,
secure: true
};
let _req;

@@ -96,3 +99,3 @@ let _res;

_res = res;
_cookieOptions = _options;
_cookieOptions = Object.assign({}, _options, _cookieOptions);
}

@@ -99,0 +102,0 @@ const cookieStr = (0, import_cookie.serialize)(key, this.stringify(data), {

@@ -88,2 +88,3 @@ import { EventManager } from './EventManager.js';

* @param {Object.<string, number, boolean, string[], number[], boolean[]>} [options.query] - An optional key, value pair object to be serialised into the url query.
* @param {boolean} [options.skipQueue] - An optional boolean, default false indicating whether or not to skip the action queue and execute fully asyncronously. May cause race conditions if used incorrectly.
* @param {Object} [options.serverOptions] - An optional object containing the res and req objects for ServerResponse and IncomingMessage with cookies respectively. Required for server-side rendering session management.

@@ -97,2 +98,3 @@ *

query?: AcceptedQueryTypes;
skipQueue?: boolean;
serverOptions?: ServerOptions;

@@ -99,0 +101,0 @@ }): Promise<SDKResponse<ReturnData>>;

@@ -428,3 +428,6 @@ "use strict";

async setCookie(key, data, options) {
let _cookieOptions;
let _cookieOptions = {
httpOnly: true,
secure: true
};
let _req;

@@ -436,3 +439,3 @@ let _res;

_res = res;
_cookieOptions = _options;
_cookieOptions = Object.assign({}, _options, _cookieOptions);
}

@@ -644,2 +647,3 @@ const cookieStr = (0, import_cookie.serialize)(key, this.stringify(data), {

* @param {Object.<string, number, boolean, string[], number[], boolean[]>} [options.query] - An optional key, value pair object to be serialised into the url query.
* @param {boolean} [options.skipQueue] - An optional boolean, default false indicating whether or not to skip the action queue and execute fully asyncronously. May cause race conditions if used incorrectly.
* @param {Object} [options.serverOptions] - An optional object containing the res and req objects for ServerResponse and IncomingMessage with cookies respectively. Required for server-side rendering session management.

@@ -659,15 +663,18 @@ *

let result;
const action = () => fetcher(
this.#normaliseUrl(
`${this.#endpoint}/frontastic/action/${options.actionName}${params}`
),
fetcherOptions,
options.serverOptions,
this.#sessionLifetime
);
try {
result = await this.#actionQueue.add(
() => {
return fetcher(
this.#normaliseUrl(
`${this.#endpoint}/frontastic/action/${options.actionName}${params}`
),
fetcherOptions,
options.serverOptions,
this.#sessionLifetime
);
}
);
if (options.skipQueue) {
result = await action();
} else {
result = await this.#actionQueue.add(
action
);
}
} catch (error) {

@@ -674,0 +681,0 @@ return this.#handleError({

{
"name": "@commercetools/frontend-sdk",
"version": "1.9.3",
"version": "1.10.0",
"license": "UNLICENSED",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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