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