@commercetools-frontend/application-config 27.5.2 → 27.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-frontend-application-config.cjs.dev.js +55 -57
- package/dist/commercetools-frontend-application-config.cjs.prod.js +55 -57
- package/dist/commercetools-frontend-application-config.esm.js +3 -3
- package/dist/{formatters-5629a23b.esm.js → formatters-CR1HIN8T.esm.js} +2 -2
- package/dist/{formatters-4515015b.cjs.prod.js → formatters-CWjiv2VA.cjs.dev.js} +11 -11
- package/dist/{formatters-5a68b5ac.cjs.dev.js → formatters-CWjiv2VA.cjs.prod.js} +11 -11
- package/package.json +3 -3
- package/ssr/dist/commercetools-frontend-application-config-ssr.cjs.dev.js +1 -3
- package/ssr/dist/commercetools-frontend-application-config-ssr.cjs.prod.js +1 -3
- package/ssr/dist/commercetools-frontend-application-config-ssr.esm.js +1 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
6
4
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
7
5
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -37,7 +35,7 @@ var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/string
|
|
|
37
35
|
var path$1 = require('path');
|
|
38
36
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
39
37
|
var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
|
|
40
|
-
var formatters = require('./formatters-
|
|
38
|
+
var formatters = require('./formatters-CWjiv2VA.cjs.dev.js');
|
|
41
39
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
42
40
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
43
41
|
var Ajv = require('ajv');
|
|
@@ -48,7 +46,7 @@ var jsdom$1 = require('jsdom');
|
|
|
48
46
|
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
49
47
|
require('lodash/upperFirst');
|
|
50
48
|
|
|
51
|
-
function _interopDefault (e) { return e && e.__esModule ? e : {
|
|
49
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
52
50
|
|
|
53
51
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
54
52
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
@@ -116,14 +114,14 @@ const LOADED_CONFIG_TYPES = {
|
|
|
116
114
|
CUSTOM_VIEW: 'custom-view'
|
|
117
115
|
};
|
|
118
116
|
|
|
119
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default
|
|
120
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default
|
|
117
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default.default(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
118
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default.default(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
121
119
|
let MissingOrInvalidConfigError = /*#__PURE__*/function (_Error) {
|
|
122
120
|
function MissingOrInvalidConfigError(message) {
|
|
123
121
|
var _this;
|
|
124
122
|
_classCallCheck(this, MissingOrInvalidConfigError);
|
|
125
123
|
_this = _callSuper(this, MissingOrInvalidConfigError, [message]);
|
|
126
|
-
_Object$defineProperty__default
|
|
124
|
+
_Object$defineProperty__default.default(_this, 'name', {
|
|
127
125
|
value: 'MissingOrInvalidConfigError'
|
|
128
126
|
});
|
|
129
127
|
return _this;
|
|
@@ -138,7 +136,7 @@ let MissingOrInvalidConfigError = /*#__PURE__*/function (_Error) {
|
|
|
138
136
|
// Copied from @commitlint/load/src/utils/load-config.ts
|
|
139
137
|
const isDynamicAwaitSupported = () => {
|
|
140
138
|
var _context;
|
|
141
|
-
const _process$version$repl = _mapInstanceProperty__default
|
|
139
|
+
const _process$version$repl = _mapInstanceProperty__default.default(_context = process.version.replace('v', '').split('.')).call(_context, val => _parseInt__default.default(val)),
|
|
142
140
|
_process$version$repl2 = _slicedToArray(_process$version$repl, 2),
|
|
143
141
|
major = _process$version$repl2[0],
|
|
144
142
|
minor = _process$version$repl2[1];
|
|
@@ -148,9 +146,9 @@ const isDynamicAwaitSupported = () => {
|
|
|
148
146
|
// Is the given directory set up to use ESM (ECMAScript Modules)?
|
|
149
147
|
// Copied from @commitlint/load/src/utils/load-config.ts
|
|
150
148
|
const isEsmModule = async cwd => {
|
|
151
|
-
const packagePath = path__default
|
|
149
|
+
const packagePath = path__default.default.join(cwd, 'package.json');
|
|
152
150
|
try {
|
|
153
|
-
const packageJSON = await fs__default
|
|
151
|
+
const packageJSON = await fs__default.default.readFile(packagePath, {
|
|
154
152
|
encoding: 'utf-8'
|
|
155
153
|
});
|
|
156
154
|
return JSON.parse(packageJSON)?.type === 'module';
|
|
@@ -271,7 +269,7 @@ const substituteFilePathVariablePlaceholder = (valueOfPlaceholder, matchedString
|
|
|
271
269
|
// Security check: Prevent path traversal attacks.
|
|
272
270
|
// Two strategies depending on whether the specifier is a bare module name
|
|
273
271
|
// (e.g. "@scope/pkg/file.svg") or a relative/absolute path (e.g. "./app.svg").
|
|
274
|
-
const isModuleName = !_startsWithInstanceProperty__default
|
|
272
|
+
const isModuleName = !_startsWithInstanceProperty__default.default(filePathOrModule).call(filePathOrModule, '.') && !_startsWithInstanceProperty__default.default(filePathOrModule).call(filePathOrModule, '/');
|
|
275
273
|
if (isModuleName) {
|
|
276
274
|
// Bare module specifiers are resolved by require.resolve through
|
|
277
275
|
// node_modules, linked packages, or Yarn PnP — all legitimate locations
|
|
@@ -281,30 +279,30 @@ const substituteFilePathVariablePlaceholder = (valueOfPlaceholder, matchedString
|
|
|
281
279
|
// require.resolve escape module directories and reach arbitrary files
|
|
282
280
|
// (e.g. "some-pkg/../../../../etc/passwd" resolves through node_modules
|
|
283
281
|
// to /etc/passwd).
|
|
284
|
-
const normalizedSpecifier = path__default$1
|
|
285
|
-
if (_startsWithInstanceProperty__default
|
|
282
|
+
const normalizedSpecifier = path__default$1.default.posix.normalize(filePathOrModule);
|
|
283
|
+
if (_startsWithInstanceProperty__default.default(normalizedSpecifier).call(normalizedSpecifier, '..')) {
|
|
286
284
|
throw new Error(`Path traversal in module specifiers is not allowed: ${filePathOrModule}`);
|
|
287
285
|
}
|
|
288
286
|
}
|
|
289
287
|
const resolvedPath = require.resolve(filePathOrModule, {
|
|
290
288
|
paths: [loadingOptions.applicationPath]
|
|
291
289
|
});
|
|
292
|
-
const normalizedPath = path__default$1
|
|
290
|
+
const normalizedPath = path__default$1.default.normalize(resolvedPath);
|
|
293
291
|
if (!isModuleName) {
|
|
294
292
|
// For relative/absolute paths, verify the resolved path is within the
|
|
295
293
|
// workspace root. require.resolve() already provides some protection by
|
|
296
294
|
// only resolving from applicationPath, but we add an extra layer to
|
|
297
295
|
// prevent access to sensitive system files outside the workspace.
|
|
298
|
-
const applicationPath = path__default$1
|
|
296
|
+
const applicationPath = path__default$1.default.normalize(loadingOptions.applicationPath);
|
|
299
297
|
|
|
300
298
|
// Find workspace root by traversing up from applicationPath until we find
|
|
301
299
|
// package.json, pnpm-workspace.yaml, or reach root
|
|
302
300
|
let workspaceRoot = applicationPath;
|
|
303
301
|
let currentPath = applicationPath;
|
|
304
|
-
const rootPath = path__default$1
|
|
302
|
+
const rootPath = path__default$1.default.parse(currentPath).root;
|
|
305
303
|
while (currentPath !== rootPath) {
|
|
306
|
-
const hasPackageJson = fs__default$1
|
|
307
|
-
const hasWorkspaceConfig = fs__default$1
|
|
304
|
+
const hasPackageJson = fs__default$1.default.existsSync(path__default$1.default.join(currentPath, 'package.json'));
|
|
305
|
+
const hasWorkspaceConfig = fs__default$1.default.existsSync(path__default$1.default.join(currentPath, 'pnpm-workspace.yaml')) || fs__default$1.default.existsSync(path__default$1.default.join(currentPath, 'lerna.json'));
|
|
308
306
|
if (hasPackageJson) {
|
|
309
307
|
workspaceRoot = currentPath;
|
|
310
308
|
if (hasWorkspaceConfig) {
|
|
@@ -312,29 +310,29 @@ const substituteFilePathVariablePlaceholder = (valueOfPlaceholder, matchedString
|
|
|
312
310
|
break;
|
|
313
311
|
}
|
|
314
312
|
}
|
|
315
|
-
currentPath = path__default$1
|
|
313
|
+
currentPath = path__default$1.default.dirname(currentPath);
|
|
316
314
|
}
|
|
317
|
-
const relativePath = path__default$1
|
|
315
|
+
const relativePath = path__default$1.default.relative(workspaceRoot, normalizedPath);
|
|
318
316
|
// Use path.relative() to avoid string prefix vulnerabilities (e.g., "/app" vs "/app-evil")
|
|
319
|
-
const isSafePath = !_startsWithInstanceProperty__default
|
|
317
|
+
const isSafePath = !_startsWithInstanceProperty__default.default(relativePath).call(relativePath, '..') && !path__default$1.default.isAbsolute(relativePath);
|
|
320
318
|
if (!isSafePath) {
|
|
321
319
|
throw new Error(`Access to files outside workspace directory is not allowed: ${filePathOrModule}`);
|
|
322
320
|
}
|
|
323
321
|
}
|
|
324
|
-
const content = fs__default$1
|
|
322
|
+
const content = fs__default$1.default.readFileSync(normalizedPath, {
|
|
325
323
|
encoding: 'utf-8'
|
|
326
324
|
});
|
|
327
325
|
return valueOfEnvConfig.replace(new RegExp(escapeRegExp(matchedString), 'g'), content);
|
|
328
326
|
};
|
|
329
|
-
const getValueOfPlaceholder = valueWithPlaceholder => valueWithPlaceholder.replace(variableSyntax, (_match, varName) => _trimInstanceProperty__default
|
|
327
|
+
const getValueOfPlaceholder = valueWithPlaceholder => valueWithPlaceholder.replace(variableSyntax, (_match, varName) => _trimInstanceProperty__default.default(varName).call(varName)).replace(/\s/g, '');
|
|
330
328
|
const substituteVariablePlaceholders = (config, loadingOptions) => {
|
|
331
|
-
const result = JSON.parse(_JSON$stringify__default
|
|
329
|
+
const result = JSON.parse(_JSON$stringify__default.default(config), (_key, value) => {
|
|
332
330
|
// Only strings are allowed
|
|
333
331
|
let substitutedValue = value;
|
|
334
332
|
if (hasVariablePlaceholder(substitutedValue)) {
|
|
335
333
|
const matchResult = substitutedValue.match(variableSyntax);
|
|
336
334
|
if (matchResult) {
|
|
337
|
-
_forEachInstanceProperty__default
|
|
335
|
+
_forEachInstanceProperty__default.default(matchResult).call(matchResult, matchedString => {
|
|
338
336
|
const valueOfPlaceholder = getValueOfPlaceholder(matchedString);
|
|
339
337
|
if (isEnvVariablePlaceholder(valueOfPlaceholder)) {
|
|
340
338
|
substitutedValue = substituteEnvVariablePlaceholder(valueOfPlaceholder, matchedString, substitutedValue, loadingOptions);
|
|
@@ -1009,7 +1007,7 @@ var customViewSchemaJson = {
|
|
|
1009
1007
|
]
|
|
1010
1008
|
};
|
|
1011
1009
|
|
|
1012
|
-
const ajv = new Ajv__default
|
|
1010
|
+
const ajv = new Ajv__default.default({
|
|
1013
1011
|
strict: true,
|
|
1014
1012
|
useDefaults: true
|
|
1015
1013
|
});
|
|
@@ -1019,7 +1017,7 @@ const printErrors = errors => {
|
|
|
1019
1017
|
if (!errors) {
|
|
1020
1018
|
return 'No errors';
|
|
1021
1019
|
}
|
|
1022
|
-
return _mapInstanceProperty__default
|
|
1020
|
+
return _mapInstanceProperty__default.default(errors).call(errors, error => {
|
|
1023
1021
|
const baseMessage = `${error.instancePath} ${error.message}`;
|
|
1024
1022
|
switch (error.keyword) {
|
|
1025
1023
|
case 'additionalProperties':
|
|
@@ -1038,7 +1036,7 @@ const validateConfig = (configType, config) => {
|
|
|
1038
1036
|
} else if (configType === LOADED_CONFIG_TYPES.CUSTOM_VIEW) {
|
|
1039
1037
|
validation = validateCustomViewConfig;
|
|
1040
1038
|
} else {
|
|
1041
|
-
throw new Error(`Invalid config type "${configType}", expected ${_Object$keys__default
|
|
1039
|
+
throw new Error(`Invalid config type "${configType}", expected ${_Object$keys__default.default(LOADED_CONFIG_TYPES).toString()}`);
|
|
1042
1040
|
}
|
|
1043
1041
|
const isValid = validation(config);
|
|
1044
1042
|
if (!isValid) {
|
|
@@ -1052,8 +1050,8 @@ const validateEntryPointUriPath = config => {
|
|
|
1052
1050
|
};
|
|
1053
1051
|
const validateSubmenuLinks = config => {
|
|
1054
1052
|
var _context;
|
|
1055
|
-
const uriPathSet = new _Set__default
|
|
1056
|
-
_forEachInstanceProperty__default
|
|
1053
|
+
const uriPathSet = new _Set__default.default();
|
|
1054
|
+
_forEachInstanceProperty__default.default(_context = config.submenuLinks).call(_context, _ref => {
|
|
1057
1055
|
let uriPath = _ref.uriPath;
|
|
1058
1056
|
if (uriPathSet.has(uriPath)) {
|
|
1059
1057
|
throw new Error('Duplicate URI path. Every submenu link must have a unique URI path value');
|
|
@@ -1063,12 +1061,12 @@ const validateSubmenuLinks = config => {
|
|
|
1063
1061
|
};
|
|
1064
1062
|
const validateAdditionalOAuthScopes = config => {
|
|
1065
1063
|
var _context2, _context3;
|
|
1066
|
-
const additionalPermissionNames = new _Set__default
|
|
1067
|
-
((_context2 = config.additionalOAuthScopes) == null ? void 0 : _bindInstanceProperty__default
|
|
1064
|
+
const additionalPermissionNames = new _Set__default.default();
|
|
1065
|
+
((_context2 = config.additionalOAuthScopes) == null ? void 0 : _bindInstanceProperty__default.default(_context3 = Function.call).call(_context3, _forEachInstanceProperty__default.default(_context2), _context2))?.(_ref2 => {
|
|
1068
1066
|
let name = _ref2.name,
|
|
1069
1067
|
view = _ref2.view,
|
|
1070
1068
|
manage = _ref2.manage;
|
|
1071
|
-
if ((_Array$isArray__default
|
|
1069
|
+
if ((_Array$isArray__default.default(view) && view.length === 0 || !view) && (_Array$isArray__default.default(manage) && manage.length === 0 || !manage)) {
|
|
1072
1070
|
throw new Error(`At least one OAuth Scope for permission group name "${name}" is required`);
|
|
1073
1071
|
} else if (additionalPermissionNames.has(name)) {
|
|
1074
1072
|
throw new Error(`Duplicate additional permission group name "${name}". Every additional permission must have a unique name`);
|
|
@@ -1080,8 +1078,8 @@ const validateAdditionalOAuthScopes = config => {
|
|
|
1080
1078
|
});
|
|
1081
1079
|
};
|
|
1082
1080
|
|
|
1083
|
-
function ownKeys$1(e, r) { var t = _Object$keys__default
|
|
1084
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
1081
|
+
function ownKeys$1(e, r) { var t = _Object$keys__default.default(e); if (_Object$getOwnPropertySymbols__default.default) { var o = _Object$getOwnPropertySymbols__default.default(e); r && (o = _filterInstanceProperty__default.default(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default.default(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1082
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default.default(_context6 = ownKeys$1(Object(t), true)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default.default ? _Object$defineProperties__default.default(e, _Object$getOwnPropertyDescriptors__default.default(t)) : _forEachInstanceProperty__default.default(_context7 = ownKeys$1(Object(t))).call(_context7, function (r) { _Object$defineProperty__default.default(e, r, _Object$getOwnPropertyDescriptor__default.default(t, r)); }); } return e; }
|
|
1085
1083
|
|
|
1086
1084
|
// The `uriPath` of each submenu link is supposed to be defined relative
|
|
1087
1085
|
// to the `entryPointUriPath`. Computing the full path is done internally to keep
|
|
@@ -1093,13 +1091,13 @@ const computeUriPath = (uriPath, entryPointUriPath) => {
|
|
|
1093
1091
|
if (uriPath === '/') return entryPointUriPath;
|
|
1094
1092
|
// In case the `uriPath` is already configured including the `entryPointUriPath`,
|
|
1095
1093
|
// we return the `uriPath` as-is.
|
|
1096
|
-
if (_startsWithInstanceProperty__default
|
|
1094
|
+
if (_startsWithInstanceProperty__default.default(uriPath).call(uriPath, `${entryPointUriPath}/`)) return uriPath;
|
|
1097
1095
|
// Return the full path including the `entryPointUriPath` as a prefix.
|
|
1098
1096
|
return `${entryPointUriPath}/${uriPath}`;
|
|
1099
1097
|
};
|
|
1100
1098
|
const getPermissions = appConfig => {
|
|
1101
1099
|
var _context, _context2, _context3, _context4;
|
|
1102
|
-
const additionalResourceAccessKeyToOauthScopeMap = _reduceInstanceProperty__default
|
|
1100
|
+
const additionalResourceAccessKeyToOauthScopeMap = _reduceInstanceProperty__default.default(_context = appConfig.additionalOAuthScopes || []).call(_context, (previousOauthScope, _ref) => {
|
|
1103
1101
|
let name = _ref.name,
|
|
1104
1102
|
view = _ref.view,
|
|
1105
1103
|
manage = _ref.manage;
|
|
@@ -1109,7 +1107,7 @@ const getPermissions = appConfig => {
|
|
|
1109
1107
|
[`manage${formattedResourceKey}`]: manage
|
|
1110
1108
|
});
|
|
1111
1109
|
}, {});
|
|
1112
|
-
const additionalPermissionNames = ((_context2 = appConfig.additionalOAuthScopes) == null ? void 0 : _bindInstanceProperty__default
|
|
1110
|
+
const additionalPermissionNames = ((_context2 = appConfig.additionalOAuthScopes) == null ? void 0 : _bindInstanceProperty__default.default(_context3 = Function.call).call(_context3, _mapInstanceProperty__default.default(_context2), _context2))?.(_ref2 => {
|
|
1113
1111
|
let name = _ref2.name;
|
|
1114
1112
|
return name;
|
|
1115
1113
|
}) || [];
|
|
@@ -1118,7 +1116,7 @@ const getPermissions = appConfig => {
|
|
|
1118
1116
|
// configuration is for a custom view. In this case we use the
|
|
1119
1117
|
// default entry point uri path.
|
|
1120
1118
|
constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, additionalPermissionNames);
|
|
1121
|
-
const additionalPermissions = _mapInstanceProperty__default
|
|
1119
|
+
const additionalPermissions = _mapInstanceProperty__default.default(_context4 = _Object$keys__default.default(additionalResourceAccessKeyToOauthScopeMap)).call(_context4, additionalResourceAccessKey => ({
|
|
1122
1120
|
name: permissionKeys[additionalResourceAccessKey],
|
|
1123
1121
|
oAuthScopes: additionalResourceAccessKeyToOauthScopeMap[additionalResourceAccessKey]
|
|
1124
1122
|
}));
|
|
@@ -1144,7 +1142,7 @@ function transformCustomApplicationConfigToData(appConfig) {
|
|
|
1144
1142
|
permissions: getPermissions(appConfig),
|
|
1145
1143
|
icon: appConfig.icon,
|
|
1146
1144
|
mainMenuLink: appConfig.mainMenuLink,
|
|
1147
|
-
submenuLinks: _mapInstanceProperty__default
|
|
1145
|
+
submenuLinks: _mapInstanceProperty__default.default(_context5 = appConfig.submenuLinks).call(_context5, submenuLink => _objectSpread$1(_objectSpread$1({}, submenuLink), {}, {
|
|
1148
1146
|
uriPath: computeUriPath(submenuLink.uriPath, appConfig.entryPointUriPath)
|
|
1149
1147
|
}))
|
|
1150
1148
|
};
|
|
@@ -1190,13 +1188,13 @@ const mapCloudIdentifierToApiUrl = key => {
|
|
|
1190
1188
|
default:
|
|
1191
1189
|
// We would probably never get to this point, as the JSON schema validation
|
|
1192
1190
|
// kicks in before.
|
|
1193
|
-
throw new Error(`Unknown cloud identifier "${key}". Supported values: ${_Object$values__default
|
|
1191
|
+
throw new Error(`Unknown cloud identifier "${key}". Supported values: ${_Object$values__default.default(CLOUD_IDENTIFIERS).toString()}`);
|
|
1194
1192
|
}
|
|
1195
1193
|
};
|
|
1196
1194
|
const getUniqueValues = function () {
|
|
1197
1195
|
let initialValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1198
1196
|
let additionalValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1199
|
-
return uniq__default
|
|
1197
|
+
return uniq__default.default([...initialValues, ...additionalValues]);
|
|
1200
1198
|
};
|
|
1201
1199
|
const nonProductionEnvironment = ['development', 'test'];
|
|
1202
1200
|
const getIsProd = env =>
|
|
@@ -1204,7 +1202,7 @@ const getIsProd = env =>
|
|
|
1204
1202
|
// a production environment unless it's one of `development` or `test`.
|
|
1205
1203
|
// This allows to use for example the `staging` value, which from the
|
|
1206
1204
|
// application perspective is still considered a production environment.
|
|
1207
|
-
env.MC_APP_ENV ? !_includesInstanceProperty__default
|
|
1205
|
+
env.MC_APP_ENV ? !_includesInstanceProperty__default.default(nonProductionEnvironment).call(nonProductionEnvironment, env.MC_APP_ENV) : env.NODE_ENV === 'production';
|
|
1208
1206
|
const getOrThrow = (fn, errorMessage) => {
|
|
1209
1207
|
try {
|
|
1210
1208
|
return fn();
|
|
@@ -1213,13 +1211,13 @@ const getOrThrow = (fn, errorMessage) => {
|
|
|
1213
1211
|
}
|
|
1214
1212
|
};
|
|
1215
1213
|
|
|
1216
|
-
function ownKeys(e, r) { var t = _Object$keys__default
|
|
1217
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
1214
|
+
function ownKeys(e, r) { var t = _Object$keys__default.default(e); if (_Object$getOwnPropertySymbols__default.default) { var o = _Object$getOwnPropertySymbols__default.default(e); r && (o = _filterInstanceProperty__default.default(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default.default(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1215
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default.default(_context2 = ownKeys(Object(t), true)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default.default ? _Object$defineProperties__default.default(e, _Object$getOwnPropertyDescriptors__default.default(t)) : _forEachInstanceProperty__default.default(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty__default.default(e, r, _Object$getOwnPropertyDescriptor__default.default(t, r)); }); } return e; }
|
|
1218
1216
|
// TODO: make it configurable.
|
|
1219
1217
|
const developmentPort = 3001;
|
|
1220
1218
|
const developmentAppUrl = `http://localhost:${developmentPort}`;
|
|
1221
1219
|
const getLoadedConfigurationType = configFileName => {
|
|
1222
|
-
if (_includesInstanceProperty__default
|
|
1220
|
+
if (_includesInstanceProperty__default.default(configFileName).call(configFileName, 'custom-view-config')) {
|
|
1223
1221
|
return LOADED_CONFIG_TYPES.CUSTOM_VIEW;
|
|
1224
1222
|
}
|
|
1225
1223
|
return LOADED_CONFIG_TYPES.CUSTOM_APPLICATION;
|
|
@@ -1241,7 +1239,7 @@ const getRuntimeEnvironmentConfigForDevelopment = _ref => {
|
|
|
1241
1239
|
if (isProd) {
|
|
1242
1240
|
return undefined;
|
|
1243
1241
|
}
|
|
1244
|
-
const oidcConfig = omitEmpty__default
|
|
1242
|
+
const oidcConfig = omitEmpty__default.default(_objectSpread(_objectSpread({
|
|
1245
1243
|
authorizeUrl: [
|
|
1246
1244
|
// In case the MC API url points to localhost, we need to point
|
|
1247
1245
|
// to a local running dev login page to handle the workflow properly.
|
|
@@ -1262,7 +1260,7 @@ const getRuntimeEnvironmentConfigForDevelopment = _ref => {
|
|
|
1262
1260
|
if (isCustomViewData(configurationData)) {
|
|
1263
1261
|
const hostUriPath = appConfig.env.development.hostUriPath;
|
|
1264
1262
|
const defaultHostUriPath = oidcConfig.initialProjectKey ? `/${oidcConfig.initialProjectKey}/${entryPointUriPath}` : `/${entryPointUriPath}`;
|
|
1265
|
-
const hostUrl = new _URL__default
|
|
1263
|
+
const hostUrl = new _URL__default.default(hostUriPath || defaultHostUriPath, developmentAppUrl);
|
|
1266
1264
|
return omitDevConfigIfEmpty({
|
|
1267
1265
|
oidc: oidcConfig,
|
|
1268
1266
|
customViewConfig: configurationData,
|
|
@@ -1309,7 +1307,7 @@ const getRuntimeEnvironmentConfig = _ref2 => {
|
|
|
1309
1307
|
appConfig,
|
|
1310
1308
|
entryPointUriPath
|
|
1311
1309
|
});
|
|
1312
|
-
return _objectSpread(_objectSpread(_objectSpread({}, omitEmpty__default
|
|
1310
|
+
return _objectSpread(_objectSpread(_objectSpread({}, omitEmpty__default.default(additionalAppEnv)), {}, {
|
|
1313
1311
|
cdnUrl: cdnUrl.href,
|
|
1314
1312
|
env: appEnvKey,
|
|
1315
1313
|
frontendHost: appUrl.host,
|
|
@@ -1340,7 +1338,7 @@ const processConfig = async function () {
|
|
|
1340
1338
|
_ref3$processEnv = _ref3.processEnv,
|
|
1341
1339
|
processEnv = _ref3$processEnv === void 0 ? process.env : _ref3$processEnv,
|
|
1342
1340
|
_ref3$applicationPath = _ref3.applicationPath,
|
|
1343
|
-
applicationPath = _ref3$applicationPath === void 0 ? fs__default$1
|
|
1341
|
+
applicationPath = _ref3$applicationPath === void 0 ? fs__default$1.default.realpathSync(process.cwd()) : _ref3$applicationPath;
|
|
1344
1342
|
if (cachedConfig && !disableCache) return cachedConfig;
|
|
1345
1343
|
const _await$loadConfig = await loadConfig(applicationPath),
|
|
1346
1344
|
filepath = _await$loadConfig.filepath,
|
|
@@ -1360,12 +1358,12 @@ const processConfig = async function () {
|
|
|
1360
1358
|
// Parse all the supported URLs, which gets implicitly validated
|
|
1361
1359
|
|
|
1362
1360
|
const envAppUrl = isProd ? configurationData.url : developmentAppUrl;
|
|
1363
|
-
const appUrl = getOrThrow(() => new _URL__default
|
|
1361
|
+
const appUrl = getOrThrow(() => new _URL__default.default(envAppUrl), `Invalid application URL: "${envAppUrl}"`);
|
|
1364
1362
|
|
|
1365
1363
|
// Use `||` instead of `??` to include empty string values.
|
|
1366
1364
|
const envCdnUrl = isProd ? appConfig.env.production.cdnUrl || appUrl.href : developmentAppUrl;
|
|
1367
|
-
const cdnUrl = getOrThrow(() => new _URL__default
|
|
1368
|
-
const mcApiUrl = getOrThrow(() => new _URL__default
|
|
1365
|
+
const cdnUrl = getOrThrow(() => new _URL__default.default(envCdnUrl), `Invalid application CDN URL: "${envCdnUrl}"`);
|
|
1366
|
+
const mcApiUrl = getOrThrow(() => new _URL__default.default(
|
|
1369
1367
|
// Use `||` instead of `??` to include empty string values.
|
|
1370
1368
|
appConfig.mcApiUrl || mapCloudIdentifierToApiUrl(appConfig.cloudIdentifier)), `Invalid MC API URL: "${appConfig.mcApiUrl}"`);
|
|
1371
1369
|
cachedConfig = {
|
|
@@ -1389,7 +1387,7 @@ const processConfig = async function () {
|
|
|
1389
1387
|
// the CSP point of view, it will say only the file `app` can be used as a source, so
|
|
1390
1388
|
// any other file from that domain will be forbidden. Using the slash (ex: https://www.my-domain.com/app/)
|
|
1391
1389
|
// at the end it's like using a wildcard so anything 'below' `app` will be allowed.
|
|
1392
|
-
'connect-src': getUniqueValues(appConfig.headers?.csp?.['connect-src'], _concatInstanceProperty__default
|
|
1390
|
+
'connect-src': getUniqueValues(appConfig.headers?.csp?.['connect-src'], _concatInstanceProperty__default.default(_context = [mcApiUrl.origin]).call(_context, isProd ? [`${trimTrailingSlash(appUrl.href)}/`, `${trimTrailingSlash(cdnUrl.href)}/`] : [])),
|
|
1393
1391
|
'script-src': getUniqueValues(appConfig.headers?.csp?.['script-src'], isProd ? [`${trimTrailingSlash(appUrl.href)}/`, `${trimTrailingSlash(cdnUrl.href)}/`] : []),
|
|
1394
1392
|
'style-src': getUniqueValues(appConfig.headers?.csp?.['style-src'], isProd ? [`${trimTrailingSlash(appUrl.href)}/`, `${trimTrailingSlash(cdnUrl.href)}/`] : [])
|
|
1395
1393
|
})
|
|
@@ -1399,7 +1397,7 @@ const processConfig = async function () {
|
|
|
1399
1397
|
};
|
|
1400
1398
|
|
|
1401
1399
|
const jsdom = new jsdom$1.JSDOM('');
|
|
1402
|
-
const DOMPurify = createDOMPurify__default
|
|
1400
|
+
const DOMPurify = createDOMPurify__default.default(jsdom.window);
|
|
1403
1401
|
function sanitizeSvg(data) {
|
|
1404
1402
|
return DOMPurify.sanitize(data, {
|
|
1405
1403
|
USE_PROFILES: {
|
|
@@ -1411,11 +1409,11 @@ function sanitizeSvg(data) {
|
|
|
1411
1409
|
});
|
|
1412
1410
|
}
|
|
1413
1411
|
|
|
1414
|
-
Object.defineProperty(exports,
|
|
1412
|
+
Object.defineProperty(exports, "ENTRY_POINT_URI_PATH_REGEX", {
|
|
1415
1413
|
enumerable: true,
|
|
1416
1414
|
get: function () { return constants.ENTRY_POINT_URI_PATH_REGEX; }
|
|
1417
1415
|
});
|
|
1418
|
-
Object.defineProperty(exports,
|
|
1416
|
+
Object.defineProperty(exports, "PERMISSION_GROUP_NAME_REGEX", {
|
|
1419
1417
|
enumerable: true,
|
|
1420
1418
|
get: function () { return constants.PERMISSION_GROUP_NAME_REGEX; }
|
|
1421
1419
|
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
6
4
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
7
5
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -37,7 +35,7 @@ var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/string
|
|
|
37
35
|
var path$1 = require('path');
|
|
38
36
|
var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
|
|
39
37
|
var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
|
|
40
|
-
var formatters = require('./formatters-
|
|
38
|
+
var formatters = require('./formatters-CWjiv2VA.cjs.prod.js');
|
|
41
39
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
42
40
|
var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
|
|
43
41
|
var Ajv = require('ajv');
|
|
@@ -48,7 +46,7 @@ var jsdom$1 = require('jsdom');
|
|
|
48
46
|
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
49
47
|
require('lodash/upperFirst');
|
|
50
48
|
|
|
51
|
-
function _interopDefault (e) { return e && e.__esModule ? e : {
|
|
49
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
52
50
|
|
|
53
51
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
54
52
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
@@ -116,14 +114,14 @@ const LOADED_CONFIG_TYPES = {
|
|
|
116
114
|
CUSTOM_VIEW: 'custom-view'
|
|
117
115
|
};
|
|
118
116
|
|
|
119
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default
|
|
120
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default
|
|
117
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default.default(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
118
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct__default.default(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
121
119
|
let MissingOrInvalidConfigError = /*#__PURE__*/function (_Error) {
|
|
122
120
|
function MissingOrInvalidConfigError(message) {
|
|
123
121
|
var _this;
|
|
124
122
|
_classCallCheck(this, MissingOrInvalidConfigError);
|
|
125
123
|
_this = _callSuper(this, MissingOrInvalidConfigError, [message]);
|
|
126
|
-
_Object$defineProperty__default
|
|
124
|
+
_Object$defineProperty__default.default(_this, 'name', {
|
|
127
125
|
value: 'MissingOrInvalidConfigError'
|
|
128
126
|
});
|
|
129
127
|
return _this;
|
|
@@ -138,7 +136,7 @@ let MissingOrInvalidConfigError = /*#__PURE__*/function (_Error) {
|
|
|
138
136
|
// Copied from @commitlint/load/src/utils/load-config.ts
|
|
139
137
|
const isDynamicAwaitSupported = () => {
|
|
140
138
|
var _context;
|
|
141
|
-
const _process$version$repl = _mapInstanceProperty__default
|
|
139
|
+
const _process$version$repl = _mapInstanceProperty__default.default(_context = process.version.replace('v', '').split('.')).call(_context, val => _parseInt__default.default(val)),
|
|
142
140
|
_process$version$repl2 = _slicedToArray(_process$version$repl, 2),
|
|
143
141
|
major = _process$version$repl2[0],
|
|
144
142
|
minor = _process$version$repl2[1];
|
|
@@ -148,9 +146,9 @@ const isDynamicAwaitSupported = () => {
|
|
|
148
146
|
// Is the given directory set up to use ESM (ECMAScript Modules)?
|
|
149
147
|
// Copied from @commitlint/load/src/utils/load-config.ts
|
|
150
148
|
const isEsmModule = async cwd => {
|
|
151
|
-
const packagePath = path__default
|
|
149
|
+
const packagePath = path__default.default.join(cwd, 'package.json');
|
|
152
150
|
try {
|
|
153
|
-
const packageJSON = await fs__default
|
|
151
|
+
const packageJSON = await fs__default.default.readFile(packagePath, {
|
|
154
152
|
encoding: 'utf-8'
|
|
155
153
|
});
|
|
156
154
|
return JSON.parse(packageJSON)?.type === 'module';
|
|
@@ -271,7 +269,7 @@ const substituteFilePathVariablePlaceholder = (valueOfPlaceholder, matchedString
|
|
|
271
269
|
// Security check: Prevent path traversal attacks.
|
|
272
270
|
// Two strategies depending on whether the specifier is a bare module name
|
|
273
271
|
// (e.g. "@scope/pkg/file.svg") or a relative/absolute path (e.g. "./app.svg").
|
|
274
|
-
const isModuleName = !_startsWithInstanceProperty__default
|
|
272
|
+
const isModuleName = !_startsWithInstanceProperty__default.default(filePathOrModule).call(filePathOrModule, '.') && !_startsWithInstanceProperty__default.default(filePathOrModule).call(filePathOrModule, '/');
|
|
275
273
|
if (isModuleName) {
|
|
276
274
|
// Bare module specifiers are resolved by require.resolve through
|
|
277
275
|
// node_modules, linked packages, or Yarn PnP — all legitimate locations
|
|
@@ -281,30 +279,30 @@ const substituteFilePathVariablePlaceholder = (valueOfPlaceholder, matchedString
|
|
|
281
279
|
// require.resolve escape module directories and reach arbitrary files
|
|
282
280
|
// (e.g. "some-pkg/../../../../etc/passwd" resolves through node_modules
|
|
283
281
|
// to /etc/passwd).
|
|
284
|
-
const normalizedSpecifier = path__default$1
|
|
285
|
-
if (_startsWithInstanceProperty__default
|
|
282
|
+
const normalizedSpecifier = path__default$1.default.posix.normalize(filePathOrModule);
|
|
283
|
+
if (_startsWithInstanceProperty__default.default(normalizedSpecifier).call(normalizedSpecifier, '..')) {
|
|
286
284
|
throw new Error(`Path traversal in module specifiers is not allowed: ${filePathOrModule}`);
|
|
287
285
|
}
|
|
288
286
|
}
|
|
289
287
|
const resolvedPath = require.resolve(filePathOrModule, {
|
|
290
288
|
paths: [loadingOptions.applicationPath]
|
|
291
289
|
});
|
|
292
|
-
const normalizedPath = path__default$1
|
|
290
|
+
const normalizedPath = path__default$1.default.normalize(resolvedPath);
|
|
293
291
|
if (!isModuleName) {
|
|
294
292
|
// For relative/absolute paths, verify the resolved path is within the
|
|
295
293
|
// workspace root. require.resolve() already provides some protection by
|
|
296
294
|
// only resolving from applicationPath, but we add an extra layer to
|
|
297
295
|
// prevent access to sensitive system files outside the workspace.
|
|
298
|
-
const applicationPath = path__default$1
|
|
296
|
+
const applicationPath = path__default$1.default.normalize(loadingOptions.applicationPath);
|
|
299
297
|
|
|
300
298
|
// Find workspace root by traversing up from applicationPath until we find
|
|
301
299
|
// package.json, pnpm-workspace.yaml, or reach root
|
|
302
300
|
let workspaceRoot = applicationPath;
|
|
303
301
|
let currentPath = applicationPath;
|
|
304
|
-
const rootPath = path__default$1
|
|
302
|
+
const rootPath = path__default$1.default.parse(currentPath).root;
|
|
305
303
|
while (currentPath !== rootPath) {
|
|
306
|
-
const hasPackageJson = fs__default$1
|
|
307
|
-
const hasWorkspaceConfig = fs__default$1
|
|
304
|
+
const hasPackageJson = fs__default$1.default.existsSync(path__default$1.default.join(currentPath, 'package.json'));
|
|
305
|
+
const hasWorkspaceConfig = fs__default$1.default.existsSync(path__default$1.default.join(currentPath, 'pnpm-workspace.yaml')) || fs__default$1.default.existsSync(path__default$1.default.join(currentPath, 'lerna.json'));
|
|
308
306
|
if (hasPackageJson) {
|
|
309
307
|
workspaceRoot = currentPath;
|
|
310
308
|
if (hasWorkspaceConfig) {
|
|
@@ -312,29 +310,29 @@ const substituteFilePathVariablePlaceholder = (valueOfPlaceholder, matchedString
|
|
|
312
310
|
break;
|
|
313
311
|
}
|
|
314
312
|
}
|
|
315
|
-
currentPath = path__default$1
|
|
313
|
+
currentPath = path__default$1.default.dirname(currentPath);
|
|
316
314
|
}
|
|
317
|
-
const relativePath = path__default$1
|
|
315
|
+
const relativePath = path__default$1.default.relative(workspaceRoot, normalizedPath);
|
|
318
316
|
// Use path.relative() to avoid string prefix vulnerabilities (e.g., "/app" vs "/app-evil")
|
|
319
|
-
const isSafePath = !_startsWithInstanceProperty__default
|
|
317
|
+
const isSafePath = !_startsWithInstanceProperty__default.default(relativePath).call(relativePath, '..') && !path__default$1.default.isAbsolute(relativePath);
|
|
320
318
|
if (!isSafePath) {
|
|
321
319
|
throw new Error(`Access to files outside workspace directory is not allowed: ${filePathOrModule}`);
|
|
322
320
|
}
|
|
323
321
|
}
|
|
324
|
-
const content = fs__default$1
|
|
322
|
+
const content = fs__default$1.default.readFileSync(normalizedPath, {
|
|
325
323
|
encoding: 'utf-8'
|
|
326
324
|
});
|
|
327
325
|
return valueOfEnvConfig.replace(new RegExp(escapeRegExp(matchedString), 'g'), content);
|
|
328
326
|
};
|
|
329
|
-
const getValueOfPlaceholder = valueWithPlaceholder => valueWithPlaceholder.replace(variableSyntax, (_match, varName) => _trimInstanceProperty__default
|
|
327
|
+
const getValueOfPlaceholder = valueWithPlaceholder => valueWithPlaceholder.replace(variableSyntax, (_match, varName) => _trimInstanceProperty__default.default(varName).call(varName)).replace(/\s/g, '');
|
|
330
328
|
const substituteVariablePlaceholders = (config, loadingOptions) => {
|
|
331
|
-
const result = JSON.parse(_JSON$stringify__default
|
|
329
|
+
const result = JSON.parse(_JSON$stringify__default.default(config), (_key, value) => {
|
|
332
330
|
// Only strings are allowed
|
|
333
331
|
let substitutedValue = value;
|
|
334
332
|
if (hasVariablePlaceholder(substitutedValue)) {
|
|
335
333
|
const matchResult = substitutedValue.match(variableSyntax);
|
|
336
334
|
if (matchResult) {
|
|
337
|
-
_forEachInstanceProperty__default
|
|
335
|
+
_forEachInstanceProperty__default.default(matchResult).call(matchResult, matchedString => {
|
|
338
336
|
const valueOfPlaceholder = getValueOfPlaceholder(matchedString);
|
|
339
337
|
if (isEnvVariablePlaceholder(valueOfPlaceholder)) {
|
|
340
338
|
substitutedValue = substituteEnvVariablePlaceholder(valueOfPlaceholder, matchedString, substitutedValue, loadingOptions);
|
|
@@ -1009,7 +1007,7 @@ var customViewSchemaJson = {
|
|
|
1009
1007
|
]
|
|
1010
1008
|
};
|
|
1011
1009
|
|
|
1012
|
-
const ajv = new Ajv__default
|
|
1010
|
+
const ajv = new Ajv__default.default({
|
|
1013
1011
|
strict: true,
|
|
1014
1012
|
useDefaults: true
|
|
1015
1013
|
});
|
|
@@ -1019,7 +1017,7 @@ const printErrors = errors => {
|
|
|
1019
1017
|
if (!errors) {
|
|
1020
1018
|
return 'No errors';
|
|
1021
1019
|
}
|
|
1022
|
-
return _mapInstanceProperty__default
|
|
1020
|
+
return _mapInstanceProperty__default.default(errors).call(errors, error => {
|
|
1023
1021
|
const baseMessage = `${error.instancePath} ${error.message}`;
|
|
1024
1022
|
switch (error.keyword) {
|
|
1025
1023
|
case 'additionalProperties':
|
|
@@ -1038,7 +1036,7 @@ const validateConfig = (configType, config) => {
|
|
|
1038
1036
|
} else if (configType === LOADED_CONFIG_TYPES.CUSTOM_VIEW) {
|
|
1039
1037
|
validation = validateCustomViewConfig;
|
|
1040
1038
|
} else {
|
|
1041
|
-
throw new Error(`Invalid config type "${configType}", expected ${_Object$keys__default
|
|
1039
|
+
throw new Error(`Invalid config type "${configType}", expected ${_Object$keys__default.default(LOADED_CONFIG_TYPES).toString()}`);
|
|
1042
1040
|
}
|
|
1043
1041
|
const isValid = validation(config);
|
|
1044
1042
|
if (!isValid) {
|
|
@@ -1052,8 +1050,8 @@ const validateEntryPointUriPath = config => {
|
|
|
1052
1050
|
};
|
|
1053
1051
|
const validateSubmenuLinks = config => {
|
|
1054
1052
|
var _context;
|
|
1055
|
-
const uriPathSet = new _Set__default
|
|
1056
|
-
_forEachInstanceProperty__default
|
|
1053
|
+
const uriPathSet = new _Set__default.default();
|
|
1054
|
+
_forEachInstanceProperty__default.default(_context = config.submenuLinks).call(_context, _ref => {
|
|
1057
1055
|
let uriPath = _ref.uriPath;
|
|
1058
1056
|
if (uriPathSet.has(uriPath)) {
|
|
1059
1057
|
throw new Error('Duplicate URI path. Every submenu link must have a unique URI path value');
|
|
@@ -1063,12 +1061,12 @@ const validateSubmenuLinks = config => {
|
|
|
1063
1061
|
};
|
|
1064
1062
|
const validateAdditionalOAuthScopes = config => {
|
|
1065
1063
|
var _context2, _context3;
|
|
1066
|
-
const additionalPermissionNames = new _Set__default
|
|
1067
|
-
((_context2 = config.additionalOAuthScopes) == null ? void 0 : _bindInstanceProperty__default
|
|
1064
|
+
const additionalPermissionNames = new _Set__default.default();
|
|
1065
|
+
((_context2 = config.additionalOAuthScopes) == null ? void 0 : _bindInstanceProperty__default.default(_context3 = Function.call).call(_context3, _forEachInstanceProperty__default.default(_context2), _context2))?.(_ref2 => {
|
|
1068
1066
|
let name = _ref2.name,
|
|
1069
1067
|
view = _ref2.view,
|
|
1070
1068
|
manage = _ref2.manage;
|
|
1071
|
-
if ((_Array$isArray__default
|
|
1069
|
+
if ((_Array$isArray__default.default(view) && view.length === 0 || !view) && (_Array$isArray__default.default(manage) && manage.length === 0 || !manage)) {
|
|
1072
1070
|
throw new Error(`At least one OAuth Scope for permission group name "${name}" is required`);
|
|
1073
1071
|
} else if (additionalPermissionNames.has(name)) {
|
|
1074
1072
|
throw new Error(`Duplicate additional permission group name "${name}". Every additional permission must have a unique name`);
|
|
@@ -1080,8 +1078,8 @@ const validateAdditionalOAuthScopes = config => {
|
|
|
1080
1078
|
});
|
|
1081
1079
|
};
|
|
1082
1080
|
|
|
1083
|
-
function ownKeys$1(e, r) { var t = _Object$keys__default
|
|
1084
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
1081
|
+
function ownKeys$1(e, r) { var t = _Object$keys__default.default(e); if (_Object$getOwnPropertySymbols__default.default) { var o = _Object$getOwnPropertySymbols__default.default(e); r && (o = _filterInstanceProperty__default.default(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default.default(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1082
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default.default(_context6 = ownKeys$1(Object(t), true)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default.default ? _Object$defineProperties__default.default(e, _Object$getOwnPropertyDescriptors__default.default(t)) : _forEachInstanceProperty__default.default(_context7 = ownKeys$1(Object(t))).call(_context7, function (r) { _Object$defineProperty__default.default(e, r, _Object$getOwnPropertyDescriptor__default.default(t, r)); }); } return e; }
|
|
1085
1083
|
|
|
1086
1084
|
// The `uriPath` of each submenu link is supposed to be defined relative
|
|
1087
1085
|
// to the `entryPointUriPath`. Computing the full path is done internally to keep
|
|
@@ -1093,13 +1091,13 @@ const computeUriPath = (uriPath, entryPointUriPath) => {
|
|
|
1093
1091
|
if (uriPath === '/') return entryPointUriPath;
|
|
1094
1092
|
// In case the `uriPath` is already configured including the `entryPointUriPath`,
|
|
1095
1093
|
// we return the `uriPath` as-is.
|
|
1096
|
-
if (_startsWithInstanceProperty__default
|
|
1094
|
+
if (_startsWithInstanceProperty__default.default(uriPath).call(uriPath, `${entryPointUriPath}/`)) return uriPath;
|
|
1097
1095
|
// Return the full path including the `entryPointUriPath` as a prefix.
|
|
1098
1096
|
return `${entryPointUriPath}/${uriPath}`;
|
|
1099
1097
|
};
|
|
1100
1098
|
const getPermissions = appConfig => {
|
|
1101
1099
|
var _context, _context2, _context3, _context4;
|
|
1102
|
-
const additionalResourceAccessKeyToOauthScopeMap = _reduceInstanceProperty__default
|
|
1100
|
+
const additionalResourceAccessKeyToOauthScopeMap = _reduceInstanceProperty__default.default(_context = appConfig.additionalOAuthScopes || []).call(_context, (previousOauthScope, _ref) => {
|
|
1103
1101
|
let name = _ref.name,
|
|
1104
1102
|
view = _ref.view,
|
|
1105
1103
|
manage = _ref.manage;
|
|
@@ -1109,7 +1107,7 @@ const getPermissions = appConfig => {
|
|
|
1109
1107
|
[`manage${formattedResourceKey}`]: manage
|
|
1110
1108
|
});
|
|
1111
1109
|
}, {});
|
|
1112
|
-
const additionalPermissionNames = ((_context2 = appConfig.additionalOAuthScopes) == null ? void 0 : _bindInstanceProperty__default
|
|
1110
|
+
const additionalPermissionNames = ((_context2 = appConfig.additionalOAuthScopes) == null ? void 0 : _bindInstanceProperty__default.default(_context3 = Function.call).call(_context3, _mapInstanceProperty__default.default(_context2), _context2))?.(_ref2 => {
|
|
1113
1111
|
let name = _ref2.name;
|
|
1114
1112
|
return name;
|
|
1115
1113
|
}) || [];
|
|
@@ -1118,7 +1116,7 @@ const getPermissions = appConfig => {
|
|
|
1118
1116
|
// configuration is for a custom view. In this case we use the
|
|
1119
1117
|
// default entry point uri path.
|
|
1120
1118
|
constants.CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH, additionalPermissionNames);
|
|
1121
|
-
const additionalPermissions = _mapInstanceProperty__default
|
|
1119
|
+
const additionalPermissions = _mapInstanceProperty__default.default(_context4 = _Object$keys__default.default(additionalResourceAccessKeyToOauthScopeMap)).call(_context4, additionalResourceAccessKey => ({
|
|
1122
1120
|
name: permissionKeys[additionalResourceAccessKey],
|
|
1123
1121
|
oAuthScopes: additionalResourceAccessKeyToOauthScopeMap[additionalResourceAccessKey]
|
|
1124
1122
|
}));
|
|
@@ -1144,7 +1142,7 @@ function transformCustomApplicationConfigToData(appConfig) {
|
|
|
1144
1142
|
permissions: getPermissions(appConfig),
|
|
1145
1143
|
icon: appConfig.icon,
|
|
1146
1144
|
mainMenuLink: appConfig.mainMenuLink,
|
|
1147
|
-
submenuLinks: _mapInstanceProperty__default
|
|
1145
|
+
submenuLinks: _mapInstanceProperty__default.default(_context5 = appConfig.submenuLinks).call(_context5, submenuLink => _objectSpread$1(_objectSpread$1({}, submenuLink), {}, {
|
|
1148
1146
|
uriPath: computeUriPath(submenuLink.uriPath, appConfig.entryPointUriPath)
|
|
1149
1147
|
}))
|
|
1150
1148
|
};
|
|
@@ -1190,13 +1188,13 @@ const mapCloudIdentifierToApiUrl = key => {
|
|
|
1190
1188
|
default:
|
|
1191
1189
|
// We would probably never get to this point, as the JSON schema validation
|
|
1192
1190
|
// kicks in before.
|
|
1193
|
-
throw new Error(`Unknown cloud identifier "${key}". Supported values: ${_Object$values__default
|
|
1191
|
+
throw new Error(`Unknown cloud identifier "${key}". Supported values: ${_Object$values__default.default(CLOUD_IDENTIFIERS).toString()}`);
|
|
1194
1192
|
}
|
|
1195
1193
|
};
|
|
1196
1194
|
const getUniqueValues = function () {
|
|
1197
1195
|
let initialValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1198
1196
|
let additionalValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1199
|
-
return uniq__default
|
|
1197
|
+
return uniq__default.default([...initialValues, ...additionalValues]);
|
|
1200
1198
|
};
|
|
1201
1199
|
const nonProductionEnvironment = ['development', 'test'];
|
|
1202
1200
|
const getIsProd = env =>
|
|
@@ -1204,7 +1202,7 @@ const getIsProd = env =>
|
|
|
1204
1202
|
// a production environment unless it's one of `development` or `test`.
|
|
1205
1203
|
// This allows to use for example the `staging` value, which from the
|
|
1206
1204
|
// application perspective is still considered a production environment.
|
|
1207
|
-
env.MC_APP_ENV ? !_includesInstanceProperty__default
|
|
1205
|
+
env.MC_APP_ENV ? !_includesInstanceProperty__default.default(nonProductionEnvironment).call(nonProductionEnvironment, env.MC_APP_ENV) : env.NODE_ENV === 'production';
|
|
1208
1206
|
const getOrThrow = (fn, errorMessage) => {
|
|
1209
1207
|
try {
|
|
1210
1208
|
return fn();
|
|
@@ -1213,13 +1211,13 @@ const getOrThrow = (fn, errorMessage) => {
|
|
|
1213
1211
|
}
|
|
1214
1212
|
};
|
|
1215
1213
|
|
|
1216
|
-
function ownKeys(e, r) { var t = _Object$keys__default
|
|
1217
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
1214
|
+
function ownKeys(e, r) { var t = _Object$keys__default.default(e); if (_Object$getOwnPropertySymbols__default.default) { var o = _Object$getOwnPropertySymbols__default.default(e); r && (o = _filterInstanceProperty__default.default(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default.default(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1215
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default.default(_context2 = ownKeys(Object(t), true)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default.default ? _Object$defineProperties__default.default(e, _Object$getOwnPropertyDescriptors__default.default(t)) : _forEachInstanceProperty__default.default(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty__default.default(e, r, _Object$getOwnPropertyDescriptor__default.default(t, r)); }); } return e; }
|
|
1218
1216
|
// TODO: make it configurable.
|
|
1219
1217
|
const developmentPort = 3001;
|
|
1220
1218
|
const developmentAppUrl = `http://localhost:${developmentPort}`;
|
|
1221
1219
|
const getLoadedConfigurationType = configFileName => {
|
|
1222
|
-
if (_includesInstanceProperty__default
|
|
1220
|
+
if (_includesInstanceProperty__default.default(configFileName).call(configFileName, 'custom-view-config')) {
|
|
1223
1221
|
return LOADED_CONFIG_TYPES.CUSTOM_VIEW;
|
|
1224
1222
|
}
|
|
1225
1223
|
return LOADED_CONFIG_TYPES.CUSTOM_APPLICATION;
|
|
@@ -1241,7 +1239,7 @@ const getRuntimeEnvironmentConfigForDevelopment = _ref => {
|
|
|
1241
1239
|
if (isProd) {
|
|
1242
1240
|
return undefined;
|
|
1243
1241
|
}
|
|
1244
|
-
const oidcConfig = omitEmpty__default
|
|
1242
|
+
const oidcConfig = omitEmpty__default.default(_objectSpread(_objectSpread({
|
|
1245
1243
|
authorizeUrl: [
|
|
1246
1244
|
// In case the MC API url points to localhost, we need to point
|
|
1247
1245
|
// to a local running dev login page to handle the workflow properly.
|
|
@@ -1262,7 +1260,7 @@ const getRuntimeEnvironmentConfigForDevelopment = _ref => {
|
|
|
1262
1260
|
if (isCustomViewData(configurationData)) {
|
|
1263
1261
|
const hostUriPath = appConfig.env.development.hostUriPath;
|
|
1264
1262
|
const defaultHostUriPath = oidcConfig.initialProjectKey ? `/${oidcConfig.initialProjectKey}/${entryPointUriPath}` : `/${entryPointUriPath}`;
|
|
1265
|
-
const hostUrl = new _URL__default
|
|
1263
|
+
const hostUrl = new _URL__default.default(hostUriPath || defaultHostUriPath, developmentAppUrl);
|
|
1266
1264
|
return omitDevConfigIfEmpty({
|
|
1267
1265
|
oidc: oidcConfig,
|
|
1268
1266
|
customViewConfig: configurationData,
|
|
@@ -1309,7 +1307,7 @@ const getRuntimeEnvironmentConfig = _ref2 => {
|
|
|
1309
1307
|
appConfig,
|
|
1310
1308
|
entryPointUriPath
|
|
1311
1309
|
});
|
|
1312
|
-
return _objectSpread(_objectSpread(_objectSpread({}, omitEmpty__default
|
|
1310
|
+
return _objectSpread(_objectSpread(_objectSpread({}, omitEmpty__default.default(additionalAppEnv)), {}, {
|
|
1313
1311
|
cdnUrl: cdnUrl.href,
|
|
1314
1312
|
env: appEnvKey,
|
|
1315
1313
|
frontendHost: appUrl.host,
|
|
@@ -1340,7 +1338,7 @@ const processConfig = async function () {
|
|
|
1340
1338
|
_ref3$processEnv = _ref3.processEnv,
|
|
1341
1339
|
processEnv = _ref3$processEnv === void 0 ? process.env : _ref3$processEnv,
|
|
1342
1340
|
_ref3$applicationPath = _ref3.applicationPath,
|
|
1343
|
-
applicationPath = _ref3$applicationPath === void 0 ? fs__default$1
|
|
1341
|
+
applicationPath = _ref3$applicationPath === void 0 ? fs__default$1.default.realpathSync(process.cwd()) : _ref3$applicationPath;
|
|
1344
1342
|
if (cachedConfig && !disableCache) return cachedConfig;
|
|
1345
1343
|
const _await$loadConfig = await loadConfig(applicationPath),
|
|
1346
1344
|
filepath = _await$loadConfig.filepath,
|
|
@@ -1360,12 +1358,12 @@ const processConfig = async function () {
|
|
|
1360
1358
|
// Parse all the supported URLs, which gets implicitly validated
|
|
1361
1359
|
|
|
1362
1360
|
const envAppUrl = isProd ? configurationData.url : developmentAppUrl;
|
|
1363
|
-
const appUrl = getOrThrow(() => new _URL__default
|
|
1361
|
+
const appUrl = getOrThrow(() => new _URL__default.default(envAppUrl), `Invalid application URL: "${envAppUrl}"`);
|
|
1364
1362
|
|
|
1365
1363
|
// Use `||` instead of `??` to include empty string values.
|
|
1366
1364
|
const envCdnUrl = isProd ? appConfig.env.production.cdnUrl || appUrl.href : developmentAppUrl;
|
|
1367
|
-
const cdnUrl = getOrThrow(() => new _URL__default
|
|
1368
|
-
const mcApiUrl = getOrThrow(() => new _URL__default
|
|
1365
|
+
const cdnUrl = getOrThrow(() => new _URL__default.default(envCdnUrl), `Invalid application CDN URL: "${envCdnUrl}"`);
|
|
1366
|
+
const mcApiUrl = getOrThrow(() => new _URL__default.default(
|
|
1369
1367
|
// Use `||` instead of `??` to include empty string values.
|
|
1370
1368
|
appConfig.mcApiUrl || mapCloudIdentifierToApiUrl(appConfig.cloudIdentifier)), `Invalid MC API URL: "${appConfig.mcApiUrl}"`);
|
|
1371
1369
|
cachedConfig = {
|
|
@@ -1389,7 +1387,7 @@ const processConfig = async function () {
|
|
|
1389
1387
|
// the CSP point of view, it will say only the file `app` can be used as a source, so
|
|
1390
1388
|
// any other file from that domain will be forbidden. Using the slash (ex: https://www.my-domain.com/app/)
|
|
1391
1389
|
// at the end it's like using a wildcard so anything 'below' `app` will be allowed.
|
|
1392
|
-
'connect-src': getUniqueValues(appConfig.headers?.csp?.['connect-src'], _concatInstanceProperty__default
|
|
1390
|
+
'connect-src': getUniqueValues(appConfig.headers?.csp?.['connect-src'], _concatInstanceProperty__default.default(_context = [mcApiUrl.origin]).call(_context, isProd ? [`${trimTrailingSlash(appUrl.href)}/`, `${trimTrailingSlash(cdnUrl.href)}/`] : [])),
|
|
1393
1391
|
'script-src': getUniqueValues(appConfig.headers?.csp?.['script-src'], isProd ? [`${trimTrailingSlash(appUrl.href)}/`, `${trimTrailingSlash(cdnUrl.href)}/`] : []),
|
|
1394
1392
|
'style-src': getUniqueValues(appConfig.headers?.csp?.['style-src'], isProd ? [`${trimTrailingSlash(appUrl.href)}/`, `${trimTrailingSlash(cdnUrl.href)}/`] : [])
|
|
1395
1393
|
})
|
|
@@ -1399,7 +1397,7 @@ const processConfig = async function () {
|
|
|
1399
1397
|
};
|
|
1400
1398
|
|
|
1401
1399
|
const jsdom = new jsdom$1.JSDOM('');
|
|
1402
|
-
const DOMPurify = createDOMPurify__default
|
|
1400
|
+
const DOMPurify = createDOMPurify__default.default(jsdom.window);
|
|
1403
1401
|
function sanitizeSvg(data) {
|
|
1404
1402
|
return DOMPurify.sanitize(data, {
|
|
1405
1403
|
USE_PROFILES: {
|
|
@@ -1411,11 +1409,11 @@ function sanitizeSvg(data) {
|
|
|
1411
1409
|
});
|
|
1412
1410
|
}
|
|
1413
1411
|
|
|
1414
|
-
Object.defineProperty(exports,
|
|
1412
|
+
Object.defineProperty(exports, "ENTRY_POINT_URI_PATH_REGEX", {
|
|
1415
1413
|
enumerable: true,
|
|
1416
1414
|
get: function () { return constants.ENTRY_POINT_URI_PATH_REGEX; }
|
|
1417
1415
|
});
|
|
1418
|
-
Object.defineProperty(exports,
|
|
1416
|
+
Object.defineProperty(exports, "PERMISSION_GROUP_NAME_REGEX", {
|
|
1419
1417
|
enumerable: true,
|
|
1420
1418
|
get: function () { return constants.PERMISSION_GROUP_NAME_REGEX; }
|
|
1421
1419
|
});
|
|
@@ -34,7 +34,7 @@ import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringif
|
|
|
34
34
|
import path$1 from 'path';
|
|
35
35
|
import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
|
|
36
36
|
import _bindInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/bind';
|
|
37
|
-
import { f as formatEntryPointUriPathToResourceAccessKey,
|
|
37
|
+
import { f as formatEntryPointUriPathToResourceAccessKey, b as entryPointUriPathToResourceAccesses } from './formatters-CR1HIN8T.esm.js';
|
|
38
38
|
import _Set from '@babel/runtime-corejs3/core-js-stable/set';
|
|
39
39
|
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
40
40
|
import Ajv from 'ajv';
|
|
@@ -1045,7 +1045,7 @@ const validateAdditionalOAuthScopes = config => {
|
|
|
1045
1045
|
};
|
|
1046
1046
|
|
|
1047
1047
|
function ownKeys$1(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1048
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys$1(Object(t),
|
|
1048
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys$1(Object(t), true)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context7 = ownKeys$1(Object(t))).call(_context7, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1049
1049
|
|
|
1050
1050
|
// The `uriPath` of each submenu link is supposed to be defined relative
|
|
1051
1051
|
// to the `entryPointUriPath`. Computing the full path is done internally to keep
|
|
@@ -1178,7 +1178,7 @@ const getOrThrow = (fn, errorMessage) => {
|
|
|
1178
1178
|
};
|
|
1179
1179
|
|
|
1180
1180
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1181
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t),
|
|
1181
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), true)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1182
1182
|
// TODO: make it configurable.
|
|
1183
1183
|
const developmentPort = 3001;
|
|
1184
1184
|
const developmentAppUrl = `http://localhost:${developmentPort}`;
|
|
@@ -15,7 +15,7 @@ import upperFirst from 'lodash/upperFirst';
|
|
|
15
15
|
import { CUSTOM_VIEW_HOST_ENTRY_POINT_URI_PATH } from '@commercetools-frontend/constants';
|
|
16
16
|
|
|
17
17
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(t),
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context6 = ownKeys(Object(t), true)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
19
|
/**
|
|
20
20
|
* The function formats the `entryPointUriPath` to a resource access key.
|
|
21
21
|
* It makes the first character of the string and the next character after a special character an uppercase.
|
|
@@ -98,4 +98,4 @@ function entryPointUriPathToPermissionKeys(entryPointUriPath, permissionGroupNam
|
|
|
98
98
|
}, {});
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
export {
|
|
101
|
+
export { computeCustomViewResourceAccesses as a, entryPointUriPathToResourceAccesses as b, computeCustomViewPermissionsKeys as c, formatPermissionGroupNameToResourceAccessKey as d, entryPointUriPathToPermissionKeys as e, formatEntryPointUriPathToResourceAccessKey as f };
|
|
@@ -16,7 +16,7 @@ var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entr
|
|
|
16
16
|
var upperFirst = require('lodash/upperFirst');
|
|
17
17
|
var constants = require('@commercetools-frontend/constants');
|
|
18
18
|
|
|
19
|
-
function _interopDefault (e) { return e && e.__esModule ? e : {
|
|
19
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
20
|
|
|
21
21
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
22
22
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
@@ -31,8 +31,8 @@ var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInsta
|
|
|
31
31
|
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
32
32
|
var upperFirst__default = /*#__PURE__*/_interopDefault(upperFirst);
|
|
33
33
|
|
|
34
|
-
function ownKeys(e, r) { var t = _Object$keys__default
|
|
35
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
34
|
+
function ownKeys(e, r) { var t = _Object$keys__default.default(e); if (_Object$getOwnPropertySymbols__default.default) { var o = _Object$getOwnPropertySymbols__default.default(e); r && (o = _filterInstanceProperty__default.default(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default.default(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
35
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default.default(_context6 = ownKeys(Object(t), true)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default.default ? _Object$defineProperties__default.default(e, _Object$getOwnPropertyDescriptors__default.default(t)) : _forEachInstanceProperty__default.default(_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty__default.default(e, r, _Object$getOwnPropertyDescriptor__default.default(t, r)); }); } return e; }
|
|
36
36
|
/**
|
|
37
37
|
* The function formats the `entryPointUriPath` to a resource access key.
|
|
38
38
|
* It makes the first character of the string and the next character after a special character an uppercase.
|
|
@@ -47,11 +47,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _co
|
|
|
47
47
|
*/
|
|
48
48
|
const formatEntryPointUriPathToResourceAccessKey = entryPointUriPath => {
|
|
49
49
|
var _context, _context2;
|
|
50
|
-
return _mapInstanceProperty__default
|
|
50
|
+
return _mapInstanceProperty__default.default(_context = _mapInstanceProperty__default.default(_context2 = entryPointUriPath
|
|
51
51
|
// Splits the string by underscore.
|
|
52
52
|
.split('_')
|
|
53
53
|
// Uppercase the first character of each word split.
|
|
54
|
-
).call(_context2, upperFirst__default
|
|
54
|
+
).call(_context2, upperFirst__default.default)
|
|
55
55
|
// Join the words by an underscore.
|
|
56
56
|
.join('_')
|
|
57
57
|
// Each word is split by a hyphen.
|
|
@@ -62,7 +62,7 @@ const formatEntryPointUriPathToResourceAccessKey = entryPointUriPath => {
|
|
|
62
62
|
if (i > 0 && /^\d+$/.test(word[0])) {
|
|
63
63
|
return `/${word}`;
|
|
64
64
|
}
|
|
65
|
-
return upperFirst__default
|
|
65
|
+
return upperFirst__default.default(word);
|
|
66
66
|
}).join('');
|
|
67
67
|
};
|
|
68
68
|
|
|
@@ -76,9 +76,9 @@ const formatEntryPointUriPathToResourceAccessKey = entryPointUriPath => {
|
|
|
76
76
|
*/
|
|
77
77
|
const formatPermissionGroupNameToResourceAccessKey = permissionGroupName => {
|
|
78
78
|
var _context3;
|
|
79
|
-
return _mapInstanceProperty__default
|
|
79
|
+
return _mapInstanceProperty__default.default(_context3 = permissionGroupName
|
|
80
80
|
// Each word is split by a hyphen.
|
|
81
|
-
.split('-')).call(_context3, upperFirst__default
|
|
81
|
+
.split('-')).call(_context3, upperFirst__default.default).join('');
|
|
82
82
|
};
|
|
83
83
|
function entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames) {
|
|
84
84
|
var _context4;
|
|
@@ -87,7 +87,7 @@ function entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupN
|
|
|
87
87
|
view: `view${resourceAccessKey}`,
|
|
88
88
|
manage: `manage${resourceAccessKey}`
|
|
89
89
|
};
|
|
90
|
-
const additionalResourceAccesses = _reduceInstanceProperty__default
|
|
90
|
+
const additionalResourceAccesses = _reduceInstanceProperty__default.default(_context4 = permissionGroupNames ?? []).call(_context4, (resourceAccesses, permissionGroupName) => {
|
|
91
91
|
const additionalResourceAccessKey = formatPermissionGroupNameToResourceAccessKey(permissionGroupName);
|
|
92
92
|
return _objectSpread(_objectSpread({}, resourceAccesses), {}, {
|
|
93
93
|
[`view${additionalResourceAccessKey}`]: `${defaultResourceAccesses.view}${additionalResourceAccessKey}`,
|
|
@@ -105,12 +105,12 @@ function computeCustomViewPermissionsKeys(permissionGroupNames) {
|
|
|
105
105
|
function entryPointUriPathToPermissionKeys(entryPointUriPath, permissionGroupNames) {
|
|
106
106
|
var _context5;
|
|
107
107
|
const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames ?? []);
|
|
108
|
-
return _reduceInstanceProperty__default
|
|
108
|
+
return _reduceInstanceProperty__default.default(_context5 = _Object$entries__default.default(resourceAccesses)).call(_context5, (permissionKeys, _ref) => {
|
|
109
109
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
110
110
|
resourceAccessKey = _ref2[0],
|
|
111
111
|
resourceAccessValue = _ref2[1];
|
|
112
112
|
return _objectSpread(_objectSpread({}, permissionKeys), {}, {
|
|
113
|
-
[upperFirst__default
|
|
113
|
+
[upperFirst__default.default(resourceAccessKey)]: upperFirst__default.default(resourceAccessValue)
|
|
114
114
|
});
|
|
115
115
|
}, {});
|
|
116
116
|
}
|
|
@@ -16,7 +16,7 @@ var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entr
|
|
|
16
16
|
var upperFirst = require('lodash/upperFirst');
|
|
17
17
|
var constants = require('@commercetools-frontend/constants');
|
|
18
18
|
|
|
19
|
-
function _interopDefault (e) { return e && e.__esModule ? e : {
|
|
19
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
20
|
|
|
21
21
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
22
22
|
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
@@ -31,8 +31,8 @@ var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInsta
|
|
|
31
31
|
var _Object$entries__default = /*#__PURE__*/_interopDefault(_Object$entries);
|
|
32
32
|
var upperFirst__default = /*#__PURE__*/_interopDefault(upperFirst);
|
|
33
33
|
|
|
34
|
-
function ownKeys(e, r) { var t = _Object$keys__default
|
|
35
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default
|
|
34
|
+
function ownKeys(e, r) { var t = _Object$keys__default.default(e); if (_Object$getOwnPropertySymbols__default.default) { var o = _Object$getOwnPropertySymbols__default.default(e); r && (o = _filterInstanceProperty__default.default(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default.default(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
35
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context6, _context7; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default.default(_context6 = ownKeys(Object(t), true)).call(_context6, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default.default ? _Object$defineProperties__default.default(e, _Object$getOwnPropertyDescriptors__default.default(t)) : _forEachInstanceProperty__default.default(_context7 = ownKeys(Object(t))).call(_context7, function (r) { _Object$defineProperty__default.default(e, r, _Object$getOwnPropertyDescriptor__default.default(t, r)); }); } return e; }
|
|
36
36
|
/**
|
|
37
37
|
* The function formats the `entryPointUriPath` to a resource access key.
|
|
38
38
|
* It makes the first character of the string and the next character after a special character an uppercase.
|
|
@@ -47,11 +47,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _co
|
|
|
47
47
|
*/
|
|
48
48
|
const formatEntryPointUriPathToResourceAccessKey = entryPointUriPath => {
|
|
49
49
|
var _context, _context2;
|
|
50
|
-
return _mapInstanceProperty__default
|
|
50
|
+
return _mapInstanceProperty__default.default(_context = _mapInstanceProperty__default.default(_context2 = entryPointUriPath
|
|
51
51
|
// Splits the string by underscore.
|
|
52
52
|
.split('_')
|
|
53
53
|
// Uppercase the first character of each word split.
|
|
54
|
-
).call(_context2, upperFirst__default
|
|
54
|
+
).call(_context2, upperFirst__default.default)
|
|
55
55
|
// Join the words by an underscore.
|
|
56
56
|
.join('_')
|
|
57
57
|
// Each word is split by a hyphen.
|
|
@@ -62,7 +62,7 @@ const formatEntryPointUriPathToResourceAccessKey = entryPointUriPath => {
|
|
|
62
62
|
if (i > 0 && /^\d+$/.test(word[0])) {
|
|
63
63
|
return `/${word}`;
|
|
64
64
|
}
|
|
65
|
-
return upperFirst__default
|
|
65
|
+
return upperFirst__default.default(word);
|
|
66
66
|
}).join('');
|
|
67
67
|
};
|
|
68
68
|
|
|
@@ -76,9 +76,9 @@ const formatEntryPointUriPathToResourceAccessKey = entryPointUriPath => {
|
|
|
76
76
|
*/
|
|
77
77
|
const formatPermissionGroupNameToResourceAccessKey = permissionGroupName => {
|
|
78
78
|
var _context3;
|
|
79
|
-
return _mapInstanceProperty__default
|
|
79
|
+
return _mapInstanceProperty__default.default(_context3 = permissionGroupName
|
|
80
80
|
// Each word is split by a hyphen.
|
|
81
|
-
.split('-')).call(_context3, upperFirst__default
|
|
81
|
+
.split('-')).call(_context3, upperFirst__default.default).join('');
|
|
82
82
|
};
|
|
83
83
|
function entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames) {
|
|
84
84
|
var _context4;
|
|
@@ -87,7 +87,7 @@ function entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupN
|
|
|
87
87
|
view: `view${resourceAccessKey}`,
|
|
88
88
|
manage: `manage${resourceAccessKey}`
|
|
89
89
|
};
|
|
90
|
-
const additionalResourceAccesses = _reduceInstanceProperty__default
|
|
90
|
+
const additionalResourceAccesses = _reduceInstanceProperty__default.default(_context4 = permissionGroupNames ?? []).call(_context4, (resourceAccesses, permissionGroupName) => {
|
|
91
91
|
const additionalResourceAccessKey = formatPermissionGroupNameToResourceAccessKey(permissionGroupName);
|
|
92
92
|
return _objectSpread(_objectSpread({}, resourceAccesses), {}, {
|
|
93
93
|
[`view${additionalResourceAccessKey}`]: `${defaultResourceAccesses.view}${additionalResourceAccessKey}`,
|
|
@@ -105,12 +105,12 @@ function computeCustomViewPermissionsKeys(permissionGroupNames) {
|
|
|
105
105
|
function entryPointUriPathToPermissionKeys(entryPointUriPath, permissionGroupNames) {
|
|
106
106
|
var _context5;
|
|
107
107
|
const resourceAccesses = entryPointUriPathToResourceAccesses(entryPointUriPath, permissionGroupNames ?? []);
|
|
108
|
-
return _reduceInstanceProperty__default
|
|
108
|
+
return _reduceInstanceProperty__default.default(_context5 = _Object$entries__default.default(resourceAccesses)).call(_context5, (permissionKeys, _ref) => {
|
|
109
109
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
110
110
|
resourceAccessKey = _ref2[0],
|
|
111
111
|
resourceAccessValue = _ref2[1];
|
|
112
112
|
return _objectSpread(_objectSpread({}, permissionKeys), {}, {
|
|
113
|
-
[upperFirst__default
|
|
113
|
+
[upperFirst__default.default(resourceAccessKey)]: upperFirst__default.default(resourceAccessValue)
|
|
114
114
|
});
|
|
115
115
|
}, {});
|
|
116
116
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/application-config",
|
|
3
|
-
"version": "27.5.
|
|
3
|
+
"version": "27.5.3",
|
|
4
4
|
"description": "Configuration utilities for building Custom Applications",
|
|
5
5
|
"bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@babel/register": "^7.22.15",
|
|
46
46
|
"@babel/runtime": "^7.22.15",
|
|
47
47
|
"@babel/runtime-corejs3": "^7.22.15",
|
|
48
|
-
"@commercetools-frontend/constants": "27.5.
|
|
48
|
+
"@commercetools-frontend/constants": "27.5.3",
|
|
49
49
|
"@types/lodash": "^4.14.198",
|
|
50
50
|
"@types/react": "^19.0.3",
|
|
51
51
|
"ajv": "8.18.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/jsdom": "^21.1.2",
|
|
62
62
|
"json-schema-to-typescript": "15.0.4",
|
|
63
|
-
"@commercetools-frontend/assets": "27.5.
|
|
63
|
+
"@commercetools-frontend/assets": "27.5.3"
|
|
64
64
|
},
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": "18.x || 20.x || >=22.0.0"
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var formatters = require('../../dist/formatters-5a68b5ac.cjs.dev.js');
|
|
3
|
+
var formatters = require('../../dist/formatters-CWjiv2VA.cjs.dev.js');
|
|
6
4
|
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
7
5
|
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
8
6
|
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var formatters = require('../../dist/formatters-4515015b.cjs.prod.js');
|
|
3
|
+
var formatters = require('../../dist/formatters-CWjiv2VA.cjs.prod.js');
|
|
6
4
|
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
7
5
|
require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
8
6
|
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { c as computeCustomViewPermissionsKeys, a as computeCustomViewResourceAccesses, e as entryPointUriPathToPermissionKeys, b as entryPointUriPathToResourceAccesses, f as formatEntryPointUriPathToResourceAccessKey, d as formatPermissionGroupNameToResourceAccessKey } from '../../dist/formatters-CR1HIN8T.esm.js';
|
|
2
2
|
import '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
3
3
|
import '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
4
4
|
import '@babel/runtime-corejs3/core-js-stable/instance/filter';
|