@sitecore-jss/sitecore-jss
Advanced tools
Comparing version 22.1.4-canary.1 to 22.1.4-canary.2
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mapButtonToCommand = exports.DefaultEditFrameButtonIds = exports.DefaultEditFrameButtons = exports.DefaultEditFrameButton = exports.handleEditorAnchors = exports.resetEditorChromes = exports.isEditorActive = exports.HorizonEditor = exports.ExperienceEditor = exports.tryParseEnvValue = exports.getAllowedOriginsFromEnv = exports.enforceCors = exports.isTimeoutError = exports.isAbsoluteUrl = exports.resolveUrl = exports.isServer = void 0; | ||
exports.mapButtonToCommand = exports.DefaultEditFrameButtonIds = exports.DefaultEditFrameButtons = exports.DefaultEditFrameButton = exports.handleEditorAnchors = exports.resetEditorChromes = exports.isEditorActive = exports.HorizonEditor = exports.ExperienceEditor = exports.tryParseEnvValue = exports.getAllowedOriginsFromEnv = exports.getPermutations = exports.enforceCors = exports.isTimeoutError = exports.isAbsoluteUrl = exports.resolveUrl = exports.isServer = void 0; | ||
var is_server_1 = require("./is-server"); | ||
@@ -15,2 +15,3 @@ Object.defineProperty(exports, "isServer", { enumerable: true, get: function () { return __importDefault(is_server_1).default; } }); | ||
Object.defineProperty(exports, "enforceCors", { enumerable: true, get: function () { return utils_1.enforceCors; } }); | ||
Object.defineProperty(exports, "getPermutations", { enumerable: true, get: function () { return utils_1.getPermutations; } }); | ||
Object.defineProperty(exports, "getAllowedOriginsFromEnv", { enumerable: true, get: function () { return utils_1.getAllowedOriginsFromEnv; } }); | ||
@@ -17,0 +18,0 @@ var env_1 = require("./env"); |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.enforceCors = exports.getAllowedOriginsFromEnv = exports.isTimeoutError = exports.isAbsoluteUrl = exports.resolveUrl = void 0; | ||
exports.getPermutations = exports.enforceCors = exports.getAllowedOriginsFromEnv = exports.isTimeoutError = exports.isAbsoluteUrl = exports.resolveUrl = void 0; | ||
const is_server_1 = __importDefault(require("./is-server")); | ||
@@ -132,1 +132,16 @@ /** | ||
exports.enforceCors = enforceCors; | ||
/** | ||
* Generates all possible permutations of an array of key-value pairs. | ||
* This is used to create every possible combination of URL query parameters. | ||
* @param {Array<[string, string]>} array - The array of key-value pairs to permute. | ||
* @returns {Array<Array<[string, string]>>} - A 2D array where each inner array is a unique permutation of the input. | ||
*/ | ||
const getPermutations = (array) => { | ||
if (array.length <= 1) | ||
return [array]; | ||
return array.flatMap((current, i) => { | ||
const remaining = array.filter((_, idx) => idx !== i); | ||
return (0, exports.getPermutations)(remaining).map((permutation) => [current, ...permutation]); | ||
}); | ||
}; | ||
exports.getPermutations = getPermutations; |
export { default as isServer } from './is-server'; | ||
export { resolveUrl, isAbsoluteUrl, isTimeoutError, enforceCors, getAllowedOriginsFromEnv, } from './utils'; | ||
export { resolveUrl, isAbsoluteUrl, isTimeoutError, enforceCors, getPermutations, getAllowedOriginsFromEnv, } from './utils'; | ||
export { tryParseEnvValue } from './env'; | ||
@@ -4,0 +4,0 @@ // @deprecated - import editing utils from 'editing' submodule instead. Will be removed in a future major release. |
@@ -120,1 +120,15 @@ import isServer from './is-server'; | ||
}; | ||
/** | ||
* Generates all possible permutations of an array of key-value pairs. | ||
* This is used to create every possible combination of URL query parameters. | ||
* @param {Array<[string, string]>} array - The array of key-value pairs to permute. | ||
* @returns {Array<Array<[string, string]>>} - A 2D array where each inner array is a unique permutation of the input. | ||
*/ | ||
export const getPermutations = (array) => { | ||
if (array.length <= 1) | ||
return [array]; | ||
return array.flatMap((current, i) => { | ||
const remaining = array.filter((_, idx) => idx !== i); | ||
return getPermutations(remaining).map((permutation) => [current, ...permutation]); | ||
}); | ||
}; |
{ | ||
"name": "@sitecore-jss/sitecore-jss", | ||
"version": "22.1.4-canary.1", | ||
"version": "22.1.4-canary.2", | ||
"main": "dist/cjs/index.js", | ||
@@ -68,3 +68,3 @@ "module": "dist/esm/index.js", | ||
"types": "types/index.d.ts", | ||
"gitHead": "7c36f5d86b9a748e33759219d53e0d93f7b4bfeb", | ||
"gitHead": "9c234dbfd9a89e86bc4d2c2371b2e848e2df2291", | ||
"files": [ | ||
@@ -71,0 +71,0 @@ "dist", |
export { default as isServer } from './is-server'; | ||
export { resolveUrl, isAbsoluteUrl, isTimeoutError, enforceCors, EnhancedOmit, getAllowedOriginsFromEnv, } from './utils'; | ||
export { resolveUrl, isAbsoluteUrl, isTimeoutError, enforceCors, getPermutations, EnhancedOmit, getAllowedOriginsFromEnv, } from './utils'; | ||
export { tryParseEnvValue } from './env'; | ||
export { ExperienceEditor, HorizonEditor, isEditorActive, resetEditorChromes, handleEditorAnchors, Metadata, } from '../editing/utils'; | ||
export { DefaultEditFrameButton, DefaultEditFrameButtons, DefaultEditFrameButtonIds, EditFrameDataSource, ChromeCommand, FieldEditButton, WebEditButton, EditButtonTypes, mapButtonToCommand, } from '../editing/edit-frame'; |
/// <reference types="node" /> | ||
import { IncomingMessage, OutgoingMessage } from 'http'; | ||
import { ParsedUrlQueryInput } from 'querystring'; | ||
import { IncomingMessage, OutgoingMessage } from 'http'; | ||
/** | ||
@@ -43,1 +43,8 @@ * Omit properties from T that are in K. This is a simplified version of TypeScript's built-in `Omit` utility type. | ||
export declare const enforceCors: (req: IncomingMessage, res: OutgoingMessage, allowedOrigins?: string[]) => boolean; | ||
/** | ||
* Generates all possible permutations of an array of key-value pairs. | ||
* This is used to create every possible combination of URL query parameters. | ||
* @param {Array<[string, string]>} array - The array of key-value pairs to permute. | ||
* @returns {Array<Array<[string, string]>>} - A 2D array where each inner array is a unique permutation of the input. | ||
*/ | ||
export declare const getPermutations: (array: [string, string][]) => [string, string][][]; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
405634
9038