@devtron-labs/devtron-fe-common-lib 0.0.50 → 0.0.51-beta-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/Common/ChartVersionAndTypeSelector.d.ts +4 -0
- package/dist/Common/Common.service.d.ts +1 -0
- package/dist/Common/Constants.d.ts +5 -0
- package/dist/Common/CustomInput/CustomInput.d.ts +1 -1
- package/dist/Common/CustomInput/Types.d.ts +1 -0
- package/dist/Common/EmptyState/GenericEmptyState.d.ts +1 -1
- package/dist/Common/Helper.d.ts +9 -0
- package/dist/Common/Types.d.ts +64 -0
- package/dist/Common/index.d.ts +1 -0
- package/dist/index.js +1670 -21
- package/package.json +3 -1
- package/src/Common/ChartVersionAndTypeSelector.tsx +78 -0
- package/src/Common/Common.service.ts +4 -0
- package/src/Common/Constants.ts +7 -1
- package/src/Common/CustomInput/CustomInput.tsx +3 -2
- package/src/Common/CustomInput/Types.ts +1 -0
- package/src/Common/EmptyState/GenericEmptyState.tsx +37 -13
- package/src/Common/Helper.tsx +101 -0
- package/src/Common/Types.ts +69 -0
- package/src/Common/index.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var ReactDOM = require('react-dom');
|
|
6
6
|
var reactRouterDom = require('react-router-dom');
|
|
7
|
+
var vm = require('vm');
|
|
7
8
|
var RJSF = require('@rjsf/core');
|
|
8
9
|
var RJSFValidator = require('@rjsf/validator-ajv8');
|
|
9
10
|
var utils = require('@rjsf/utils');
|
|
@@ -47,7 +48,8 @@ var ROUTES = {
|
|
|
47
48
|
PROJECT_LIST_MIN: 'team/autocomplete',
|
|
48
49
|
USER_CHECK_ROLE: 'user/check/roles',
|
|
49
50
|
IMAGE_TAGGING: 'app/image-tagging',
|
|
50
|
-
CD_MATERIAL_GET: 'app/cd-pipeline'
|
|
51
|
+
CD_MATERIAL_GET: 'app/cd-pipeline',
|
|
52
|
+
DEPLOYMENT_TEMPLATE_LIST: 'app/template/list'
|
|
51
53
|
};
|
|
52
54
|
exports.KEY_VALUE = void 0;
|
|
53
55
|
(function (KEY_VALUE) {
|
|
@@ -254,7 +256,12 @@ var RepositoryAction = {
|
|
|
254
256
|
CONTAINER: "CONTAINER",
|
|
255
257
|
CHART_PULL: "CHART_PULL",
|
|
256
258
|
CHART_PUSH: "CHART_PUSH"
|
|
257
|
-
};
|
|
259
|
+
};
|
|
260
|
+
exports.APPROVAL_MODAL_TYPE = void 0;
|
|
261
|
+
(function (APPROVAL_MODAL_TYPE) {
|
|
262
|
+
APPROVAL_MODAL_TYPE["CONFIG"] = "CONFIG";
|
|
263
|
+
APPROVAL_MODAL_TYPE["DEPLOYMENT"] = "DEPLOYMENT";
|
|
264
|
+
})(exports.APPROVAL_MODAL_TYPE || (exports.APPROVAL_MODAL_TYPE = {}));
|
|
258
265
|
|
|
259
266
|
/******************************************************************************
|
|
260
267
|
Copyright (c) Microsoft Corporation.
|
|
@@ -279,7 +286,7 @@ var extendStatics = function(d, b) {
|
|
|
279
286
|
return extendStatics(d, b);
|
|
280
287
|
};
|
|
281
288
|
|
|
282
|
-
function __extends(d, b) {
|
|
289
|
+
function __extends$1(d, b) {
|
|
283
290
|
if (typeof b !== "function" && b !== null)
|
|
284
291
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
285
292
|
extendStatics(d, b);
|
|
@@ -385,7 +392,7 @@ var ServerError = /** @class */ (function () {
|
|
|
385
392
|
return ServerError;
|
|
386
393
|
}());
|
|
387
394
|
var ServerErrors = /** @class */ (function (_super) {
|
|
388
|
-
__extends(ServerErrors, _super);
|
|
395
|
+
__extends$1(ServerErrors, _super);
|
|
389
396
|
function ServerErrors(obj) {
|
|
390
397
|
var _this = _super.call(this) || this;
|
|
391
398
|
_this.code = obj.code;
|
|
@@ -2175,7 +2182,7 @@ eventManager.on(2
|
|
|
2175
2182
|
});
|
|
2176
2183
|
|
|
2177
2184
|
var ToastBody = /** @class */ (function (_super) {
|
|
2178
|
-
__extends(ToastBody, _super);
|
|
2185
|
+
__extends$1(ToastBody, _super);
|
|
2179
2186
|
function ToastBody() {
|
|
2180
2187
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2181
2188
|
}
|
|
@@ -2185,7 +2192,7 @@ var ToastBody = /** @class */ (function (_super) {
|
|
|
2185
2192
|
return ToastBody;
|
|
2186
2193
|
}(React.Component));
|
|
2187
2194
|
var ToastBody3 = /** @class */ (function (_super) {
|
|
2188
|
-
__extends(ToastBody3, _super);
|
|
2195
|
+
__extends$1(ToastBody3, _super);
|
|
2189
2196
|
function ToastBody3() {
|
|
2190
2197
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2191
2198
|
}
|
|
@@ -2195,7 +2202,7 @@ var ToastBody3 = /** @class */ (function (_super) {
|
|
|
2195
2202
|
return ToastBody3;
|
|
2196
2203
|
}(React.Component));
|
|
2197
2204
|
var ToastBodyWithButton = /** @class */ (function (_super) {
|
|
2198
|
-
__extends(ToastBodyWithButton, _super);
|
|
2205
|
+
__extends$1(ToastBodyWithButton, _super);
|
|
2199
2206
|
function ToastBodyWithButton() {
|
|
2200
2207
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2201
2208
|
}
|
|
@@ -2229,7 +2236,17 @@ var AppNotDeployed = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAGQCAYA
|
|
|
2229
2236
|
function GenericEmptyState(_a) {
|
|
2230
2237
|
var title = _a.title, image = _a.image, subTitle = _a.subTitle, isButtonAvailable = _a.isButtonAvailable, classname = _a.classname, styles = _a.styles, heightToDeduct = _a.heightToDeduct, imageType = _a.imageType, renderButton = _a.renderButton, imageClassName = _a.imageClassName, children = _a.children, SvgImage = _a.SvgImage, noImage = _a.noImage, _b = _a.layout, layout = _b === void 0 ? 'column' : _b, _c = _a.contentClassName, contentClassName = _c === void 0 ? '' : _c;
|
|
2231
2238
|
var isRowLayout = layout === 'row';
|
|
2232
|
-
|
|
2239
|
+
var getImageSize = function () {
|
|
2240
|
+
switch (imageType) {
|
|
2241
|
+
case exports.ImageType.Medium:
|
|
2242
|
+
return { width: '200', height: '160' };
|
|
2243
|
+
case exports.ImageType.Large:
|
|
2244
|
+
return { width: '250', height: '200' };
|
|
2245
|
+
default:
|
|
2246
|
+
return { width: '200', height: '160' };
|
|
2247
|
+
}
|
|
2248
|
+
};
|
|
2249
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isRowLayout ? 'dc__gap-32' : 'column dc__gap-20', " empty-state ").concat(classname ? classname : ''), style: styles, "data-testid": "generic-empty-state" }, (heightToDeduct >= 0 && { style: __assign(__assign({}, styles), { height: "calc(100vh - ".concat(heightToDeduct, "px)") }) }), { children: [!SvgImage ? (!noImage && (jsxRuntime.jsx("img", { className: imageClassName ? imageClassName : '', src: image || AppNotDeployed, width: getImageSize().width, height: getImageSize().height, alt: "empty-state" }))) : (jsxRuntime.jsx(SvgImage, { style: { width: "".concat(getImageSize().width, "px"), height: "".concat(getImageSize().height, "px") } })), jsxRuntime.jsxs("div", __assign({ className: "flex column dc__gap-10 dc__mxw-300 ".concat(isRowLayout ? 'dc__align-start' : '', " ").concat(contentClassName) }, { children: [jsxRuntime.jsx("h4", __assign({ className: "title fw-6 cn-9 mt-0 mb-0" }, { children: title })), subTitle && jsxRuntime.jsx("p", __assign({ className: "subtitle ".concat(isRowLayout ? 'subtitle--text-start' : '') }, { children: subTitle })), isButtonAvailable && renderButton(), children] }))] })));
|
|
2233
2250
|
}
|
|
2234
2251
|
|
|
2235
2252
|
function ErrorScreenNotFound() {
|
|
@@ -2244,7 +2261,7 @@ function ErrorScreenNotFound() {
|
|
|
2244
2261
|
}
|
|
2245
2262
|
|
|
2246
2263
|
var ErrorScreenManager = /** @class */ (function (_super) {
|
|
2247
|
-
__extends(ErrorScreenManager, _super);
|
|
2264
|
+
__extends$1(ErrorScreenManager, _super);
|
|
2248
2265
|
function ErrorScreenManager() {
|
|
2249
2266
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2250
2267
|
}
|
|
@@ -2275,7 +2292,7 @@ var ErrorScreenManager = /** @class */ (function (_super) {
|
|
|
2275
2292
|
return ErrorScreenManager;
|
|
2276
2293
|
}(React.Component));
|
|
2277
2294
|
var ErrorScreenNotAuthorized = /** @class */ (function (_super) {
|
|
2278
|
-
__extends(ErrorScreenNotAuthorized, _super);
|
|
2295
|
+
__extends$1(ErrorScreenNotAuthorized, _super);
|
|
2279
2296
|
function ErrorScreenNotAuthorized() {
|
|
2280
2297
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2281
2298
|
}
|
|
@@ -9864,6 +9881,1506 @@ var moment$1 = {
|
|
|
9864
9881
|
|
|
9865
9882
|
var moment = momentExports;
|
|
9866
9883
|
|
|
9884
|
+
const {
|
|
9885
|
+
hasOwnProperty: hasOwnProp
|
|
9886
|
+
} = Object.prototype;
|
|
9887
|
+
/**
|
|
9888
|
+
* @typedef {null|boolean|number|string|PlainObject|GenericArray} JSONObject
|
|
9889
|
+
*/
|
|
9890
|
+
|
|
9891
|
+
/**
|
|
9892
|
+
* @typedef {any} AnyItem
|
|
9893
|
+
*/
|
|
9894
|
+
|
|
9895
|
+
/**
|
|
9896
|
+
* @typedef {any} AnyResult
|
|
9897
|
+
*/
|
|
9898
|
+
|
|
9899
|
+
/**
|
|
9900
|
+
* Copies array and then pushes item into it.
|
|
9901
|
+
* @param {GenericArray} arr Array to copy and into which to push
|
|
9902
|
+
* @param {AnyItem} item Array item to add (to end)
|
|
9903
|
+
* @returns {GenericArray} Copy of the original array
|
|
9904
|
+
*/
|
|
9905
|
+
|
|
9906
|
+
function push(arr, item) {
|
|
9907
|
+
arr = arr.slice();
|
|
9908
|
+
arr.push(item);
|
|
9909
|
+
return arr;
|
|
9910
|
+
}
|
|
9911
|
+
/**
|
|
9912
|
+
* Copies array and then unshifts item into it.
|
|
9913
|
+
* @param {AnyItem} item Array item to add (to beginning)
|
|
9914
|
+
* @param {GenericArray} arr Array to copy and into which to unshift
|
|
9915
|
+
* @returns {GenericArray} Copy of the original array
|
|
9916
|
+
*/
|
|
9917
|
+
|
|
9918
|
+
|
|
9919
|
+
function unshift(item, arr) {
|
|
9920
|
+
arr = arr.slice();
|
|
9921
|
+
arr.unshift(item);
|
|
9922
|
+
return arr;
|
|
9923
|
+
}
|
|
9924
|
+
/**
|
|
9925
|
+
* Caught when JSONPath is used without `new` but rethrown if with `new`
|
|
9926
|
+
* @extends Error
|
|
9927
|
+
*/
|
|
9928
|
+
|
|
9929
|
+
|
|
9930
|
+
class NewError extends Error {
|
|
9931
|
+
/**
|
|
9932
|
+
* @param {AnyResult} value The evaluated scalar value
|
|
9933
|
+
*/
|
|
9934
|
+
constructor(value) {
|
|
9935
|
+
super('JSONPath should not be called with "new" (it prevents return ' + 'of (unwrapped) scalar values)');
|
|
9936
|
+
this.avoidNew = true;
|
|
9937
|
+
this.value = value;
|
|
9938
|
+
this.name = 'NewError';
|
|
9939
|
+
}
|
|
9940
|
+
|
|
9941
|
+
}
|
|
9942
|
+
/**
|
|
9943
|
+
* @typedef {PlainObject} ReturnObject
|
|
9944
|
+
* @property {string} path
|
|
9945
|
+
* @property {JSONObject} value
|
|
9946
|
+
* @property {PlainObject|GenericArray} parent
|
|
9947
|
+
* @property {string} parentProperty
|
|
9948
|
+
*/
|
|
9949
|
+
|
|
9950
|
+
/**
|
|
9951
|
+
* @callback JSONPathCallback
|
|
9952
|
+
* @param {string|PlainObject} preferredOutput
|
|
9953
|
+
* @param {"value"|"property"} type
|
|
9954
|
+
* @param {ReturnObject} fullRetObj
|
|
9955
|
+
* @returns {void}
|
|
9956
|
+
*/
|
|
9957
|
+
|
|
9958
|
+
/**
|
|
9959
|
+
* @callback OtherTypeCallback
|
|
9960
|
+
* @param {JSONObject} val
|
|
9961
|
+
* @param {string} path
|
|
9962
|
+
* @param {PlainObject|GenericArray} parent
|
|
9963
|
+
* @param {string} parentPropName
|
|
9964
|
+
* @returns {boolean}
|
|
9965
|
+
*/
|
|
9966
|
+
|
|
9967
|
+
/* eslint-disable max-len -- Can make multiline type after https://github.com/syavorsky/comment-parser/issues/109 */
|
|
9968
|
+
|
|
9969
|
+
/**
|
|
9970
|
+
* @typedef {PlainObject} JSONPathOptions
|
|
9971
|
+
* @property {JSON} json
|
|
9972
|
+
* @property {string|string[]} path
|
|
9973
|
+
* @property {"value"|"path"|"pointer"|"parent"|"parentProperty"|"all"} [resultType="value"]
|
|
9974
|
+
* @property {boolean} [flatten=false]
|
|
9975
|
+
* @property {boolean} [wrap=true]
|
|
9976
|
+
* @property {PlainObject} [sandbox={}]
|
|
9977
|
+
* @property {boolean} [preventEval=false]
|
|
9978
|
+
* @property {PlainObject|GenericArray|null} [parent=null]
|
|
9979
|
+
* @property {string|null} [parentProperty=null]
|
|
9980
|
+
* @property {JSONPathCallback} [callback]
|
|
9981
|
+
* @property {OtherTypeCallback} [otherTypeCallback] Defaults to
|
|
9982
|
+
* function which throws on encountering `@other`
|
|
9983
|
+
* @property {boolean} [autostart=true]
|
|
9984
|
+
*/
|
|
9985
|
+
|
|
9986
|
+
/* eslint-enable max-len -- Can make multiline type after https://github.com/syavorsky/comment-parser/issues/109 */
|
|
9987
|
+
|
|
9988
|
+
/**
|
|
9989
|
+
* @param {string|JSONPathOptions} opts If a string, will be treated as `expr`
|
|
9990
|
+
* @param {string} [expr] JSON path to evaluate
|
|
9991
|
+
* @param {JSON} [obj] JSON object to evaluate against
|
|
9992
|
+
* @param {JSONPathCallback} [callback] Passed 3 arguments: 1) desired payload
|
|
9993
|
+
* per `resultType`, 2) `"value"|"property"`, 3) Full returned object with
|
|
9994
|
+
* all payloads
|
|
9995
|
+
* @param {OtherTypeCallback} [otherTypeCallback] If `@other()` is at the end
|
|
9996
|
+
* of one's query, this will be invoked with the value of the item, its
|
|
9997
|
+
* path, its parent, and its parent's property name, and it should return
|
|
9998
|
+
* a boolean indicating whether the supplied value belongs to the "other"
|
|
9999
|
+
* type or not (or it may handle transformations and return `false`).
|
|
10000
|
+
* @returns {JSONPath}
|
|
10001
|
+
* @class
|
|
10002
|
+
*/
|
|
10003
|
+
|
|
10004
|
+
|
|
10005
|
+
function JSONPath(opts, expr, obj, callback, otherTypeCallback) {
|
|
10006
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
10007
|
+
if (!(this instanceof JSONPath)) {
|
|
10008
|
+
try {
|
|
10009
|
+
return new JSONPath(opts, expr, obj, callback, otherTypeCallback);
|
|
10010
|
+
} catch (e) {
|
|
10011
|
+
if (!e.avoidNew) {
|
|
10012
|
+
throw e;
|
|
10013
|
+
}
|
|
10014
|
+
|
|
10015
|
+
return e.value;
|
|
10016
|
+
}
|
|
10017
|
+
}
|
|
10018
|
+
|
|
10019
|
+
if (typeof opts === 'string') {
|
|
10020
|
+
otherTypeCallback = callback;
|
|
10021
|
+
callback = obj;
|
|
10022
|
+
obj = expr;
|
|
10023
|
+
expr = opts;
|
|
10024
|
+
opts = null;
|
|
10025
|
+
}
|
|
10026
|
+
|
|
10027
|
+
const optObj = opts && typeof opts === 'object';
|
|
10028
|
+
opts = opts || {};
|
|
10029
|
+
this.json = opts.json || obj;
|
|
10030
|
+
this.path = opts.path || expr;
|
|
10031
|
+
this.resultType = opts.resultType || 'value';
|
|
10032
|
+
this.flatten = opts.flatten || false;
|
|
10033
|
+
this.wrap = hasOwnProp.call(opts, 'wrap') ? opts.wrap : true;
|
|
10034
|
+
this.sandbox = opts.sandbox || {};
|
|
10035
|
+
this.preventEval = opts.preventEval || false;
|
|
10036
|
+
this.parent = opts.parent || null;
|
|
10037
|
+
this.parentProperty = opts.parentProperty || null;
|
|
10038
|
+
this.callback = opts.callback || callback || null;
|
|
10039
|
+
|
|
10040
|
+
this.otherTypeCallback = opts.otherTypeCallback || otherTypeCallback || function () {
|
|
10041
|
+
throw new TypeError('You must supply an otherTypeCallback callback option ' + 'with the @other() operator.');
|
|
10042
|
+
};
|
|
10043
|
+
|
|
10044
|
+
if (opts.autostart !== false) {
|
|
10045
|
+
const args = {
|
|
10046
|
+
path: optObj ? opts.path : expr
|
|
10047
|
+
};
|
|
10048
|
+
|
|
10049
|
+
if (!optObj) {
|
|
10050
|
+
args.json = obj;
|
|
10051
|
+
} else if ('json' in opts) {
|
|
10052
|
+
args.json = opts.json;
|
|
10053
|
+
}
|
|
10054
|
+
|
|
10055
|
+
const ret = this.evaluate(args);
|
|
10056
|
+
|
|
10057
|
+
if (!ret || typeof ret !== 'object') {
|
|
10058
|
+
throw new NewError(ret);
|
|
10059
|
+
}
|
|
10060
|
+
|
|
10061
|
+
return ret;
|
|
10062
|
+
}
|
|
10063
|
+
} // PUBLIC METHODS
|
|
10064
|
+
|
|
10065
|
+
|
|
10066
|
+
JSONPath.prototype.evaluate = function (expr, json, callback, otherTypeCallback) {
|
|
10067
|
+
let currParent = this.parent,
|
|
10068
|
+
currParentProperty = this.parentProperty;
|
|
10069
|
+
let {
|
|
10070
|
+
flatten,
|
|
10071
|
+
wrap
|
|
10072
|
+
} = this;
|
|
10073
|
+
this.currResultType = this.resultType;
|
|
10074
|
+
this.currPreventEval = this.preventEval;
|
|
10075
|
+
this.currSandbox = this.sandbox;
|
|
10076
|
+
callback = callback || this.callback;
|
|
10077
|
+
this.currOtherTypeCallback = otherTypeCallback || this.otherTypeCallback;
|
|
10078
|
+
json = json || this.json;
|
|
10079
|
+
expr = expr || this.path;
|
|
10080
|
+
|
|
10081
|
+
if (expr && typeof expr === 'object' && !Array.isArray(expr)) {
|
|
10082
|
+
if (!expr.path && expr.path !== '') {
|
|
10083
|
+
throw new TypeError('You must supply a "path" property when providing an object ' + 'argument to JSONPath.evaluate().');
|
|
10084
|
+
}
|
|
10085
|
+
|
|
10086
|
+
if (!hasOwnProp.call(expr, 'json')) {
|
|
10087
|
+
throw new TypeError('You must supply a "json" property when providing an object ' + 'argument to JSONPath.evaluate().');
|
|
10088
|
+
}
|
|
10089
|
+
|
|
10090
|
+
({
|
|
10091
|
+
json
|
|
10092
|
+
} = expr);
|
|
10093
|
+
flatten = hasOwnProp.call(expr, 'flatten') ? expr.flatten : flatten;
|
|
10094
|
+
this.currResultType = hasOwnProp.call(expr, 'resultType') ? expr.resultType : this.currResultType;
|
|
10095
|
+
this.currSandbox = hasOwnProp.call(expr, 'sandbox') ? expr.sandbox : this.currSandbox;
|
|
10096
|
+
wrap = hasOwnProp.call(expr, 'wrap') ? expr.wrap : wrap;
|
|
10097
|
+
this.currPreventEval = hasOwnProp.call(expr, 'preventEval') ? expr.preventEval : this.currPreventEval;
|
|
10098
|
+
callback = hasOwnProp.call(expr, 'callback') ? expr.callback : callback;
|
|
10099
|
+
this.currOtherTypeCallback = hasOwnProp.call(expr, 'otherTypeCallback') ? expr.otherTypeCallback : this.currOtherTypeCallback;
|
|
10100
|
+
currParent = hasOwnProp.call(expr, 'parent') ? expr.parent : currParent;
|
|
10101
|
+
currParentProperty = hasOwnProp.call(expr, 'parentProperty') ? expr.parentProperty : currParentProperty;
|
|
10102
|
+
expr = expr.path;
|
|
10103
|
+
}
|
|
10104
|
+
|
|
10105
|
+
currParent = currParent || null;
|
|
10106
|
+
currParentProperty = currParentProperty || null;
|
|
10107
|
+
|
|
10108
|
+
if (Array.isArray(expr)) {
|
|
10109
|
+
expr = JSONPath.toPathString(expr);
|
|
10110
|
+
}
|
|
10111
|
+
|
|
10112
|
+
if (!expr && expr !== '' || !json) {
|
|
10113
|
+
return undefined;
|
|
10114
|
+
}
|
|
10115
|
+
|
|
10116
|
+
const exprList = JSONPath.toPathArray(expr);
|
|
10117
|
+
|
|
10118
|
+
if (exprList[0] === '$' && exprList.length > 1) {
|
|
10119
|
+
exprList.shift();
|
|
10120
|
+
}
|
|
10121
|
+
|
|
10122
|
+
this._hasParentSelector = null;
|
|
10123
|
+
|
|
10124
|
+
const result = this._trace(exprList, json, ['$'], currParent, currParentProperty, callback).filter(function (ea) {
|
|
10125
|
+
return ea && !ea.isParentSelector;
|
|
10126
|
+
});
|
|
10127
|
+
|
|
10128
|
+
if (!result.length) {
|
|
10129
|
+
return wrap ? [] : undefined;
|
|
10130
|
+
}
|
|
10131
|
+
|
|
10132
|
+
if (!wrap && result.length === 1 && !result[0].hasArrExpr) {
|
|
10133
|
+
return this._getPreferredOutput(result[0]);
|
|
10134
|
+
}
|
|
10135
|
+
|
|
10136
|
+
return result.reduce((rslt, ea) => {
|
|
10137
|
+
const valOrPath = this._getPreferredOutput(ea);
|
|
10138
|
+
|
|
10139
|
+
if (flatten && Array.isArray(valOrPath)) {
|
|
10140
|
+
rslt = rslt.concat(valOrPath);
|
|
10141
|
+
} else {
|
|
10142
|
+
rslt.push(valOrPath);
|
|
10143
|
+
}
|
|
10144
|
+
|
|
10145
|
+
return rslt;
|
|
10146
|
+
}, []);
|
|
10147
|
+
}; // PRIVATE METHODS
|
|
10148
|
+
|
|
10149
|
+
|
|
10150
|
+
JSONPath.prototype._getPreferredOutput = function (ea) {
|
|
10151
|
+
const resultType = this.currResultType;
|
|
10152
|
+
|
|
10153
|
+
switch (resultType) {
|
|
10154
|
+
case 'all':
|
|
10155
|
+
{
|
|
10156
|
+
const path = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);
|
|
10157
|
+
ea.pointer = JSONPath.toPointer(path);
|
|
10158
|
+
ea.path = typeof ea.path === 'string' ? ea.path : JSONPath.toPathString(ea.path);
|
|
10159
|
+
return ea;
|
|
10160
|
+
}
|
|
10161
|
+
|
|
10162
|
+
case 'value':
|
|
10163
|
+
case 'parent':
|
|
10164
|
+
case 'parentProperty':
|
|
10165
|
+
return ea[resultType];
|
|
10166
|
+
|
|
10167
|
+
case 'path':
|
|
10168
|
+
return JSONPath.toPathString(ea[resultType]);
|
|
10169
|
+
|
|
10170
|
+
case 'pointer':
|
|
10171
|
+
return JSONPath.toPointer(ea.path);
|
|
10172
|
+
|
|
10173
|
+
default:
|
|
10174
|
+
throw new TypeError('Unknown result type');
|
|
10175
|
+
}
|
|
10176
|
+
};
|
|
10177
|
+
|
|
10178
|
+
JSONPath.prototype._handleCallback = function (fullRetObj, callback, type) {
|
|
10179
|
+
if (callback) {
|
|
10180
|
+
const preferredOutput = this._getPreferredOutput(fullRetObj);
|
|
10181
|
+
|
|
10182
|
+
fullRetObj.path = typeof fullRetObj.path === 'string' ? fullRetObj.path : JSONPath.toPathString(fullRetObj.path); // eslint-disable-next-line n/callback-return
|
|
10183
|
+
|
|
10184
|
+
callback(preferredOutput, type, fullRetObj);
|
|
10185
|
+
}
|
|
10186
|
+
};
|
|
10187
|
+
/**
|
|
10188
|
+
*
|
|
10189
|
+
* @param {string} expr
|
|
10190
|
+
* @param {JSONObject} val
|
|
10191
|
+
* @param {string} path
|
|
10192
|
+
* @param {PlainObject|GenericArray} parent
|
|
10193
|
+
* @param {string} parentPropName
|
|
10194
|
+
* @param {JSONPathCallback} callback
|
|
10195
|
+
* @param {boolean} hasArrExpr
|
|
10196
|
+
* @param {boolean} literalPriority
|
|
10197
|
+
* @returns {ReturnObject|ReturnObject[]}
|
|
10198
|
+
*/
|
|
10199
|
+
|
|
10200
|
+
|
|
10201
|
+
JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {
|
|
10202
|
+
// No expr to follow? return path and value as the result of
|
|
10203
|
+
// this trace branch
|
|
10204
|
+
let retObj;
|
|
10205
|
+
|
|
10206
|
+
if (!expr.length) {
|
|
10207
|
+
retObj = {
|
|
10208
|
+
path,
|
|
10209
|
+
value: val,
|
|
10210
|
+
parent,
|
|
10211
|
+
parentProperty: parentPropName,
|
|
10212
|
+
hasArrExpr
|
|
10213
|
+
};
|
|
10214
|
+
|
|
10215
|
+
this._handleCallback(retObj, callback, 'value');
|
|
10216
|
+
|
|
10217
|
+
return retObj;
|
|
10218
|
+
}
|
|
10219
|
+
|
|
10220
|
+
const loc = expr[0],
|
|
10221
|
+
x = expr.slice(1); // We need to gather the return value of recursive trace calls in order to
|
|
10222
|
+
// do the parent sel computation.
|
|
10223
|
+
|
|
10224
|
+
const ret = [];
|
|
10225
|
+
/**
|
|
10226
|
+
*
|
|
10227
|
+
* @param {ReturnObject|ReturnObject[]} elems
|
|
10228
|
+
* @returns {void}
|
|
10229
|
+
*/
|
|
10230
|
+
|
|
10231
|
+
function addRet(elems) {
|
|
10232
|
+
if (Array.isArray(elems)) {
|
|
10233
|
+
// This was causing excessive stack size in Node (with or
|
|
10234
|
+
// without Babel) against our performance test:
|
|
10235
|
+
// `ret.push(...elems);`
|
|
10236
|
+
elems.forEach(t => {
|
|
10237
|
+
ret.push(t);
|
|
10238
|
+
});
|
|
10239
|
+
} else {
|
|
10240
|
+
ret.push(elems);
|
|
10241
|
+
}
|
|
10242
|
+
}
|
|
10243
|
+
|
|
10244
|
+
if ((typeof loc !== 'string' || literalPriority) && val && hasOwnProp.call(val, loc)) {
|
|
10245
|
+
// simple case--directly follow property
|
|
10246
|
+
addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr)); // eslint-disable-next-line unicorn/prefer-switch -- Part of larger `if`
|
|
10247
|
+
} else if (loc === '*') {
|
|
10248
|
+
// all child properties
|
|
10249
|
+
this._walk(val, m => {
|
|
10250
|
+
addRet(this._trace(x, val[m], push(path, m), val, m, callback, true, true));
|
|
10251
|
+
});
|
|
10252
|
+
} else if (loc === '..') {
|
|
10253
|
+
// all descendent parent properties
|
|
10254
|
+
// Check remaining expression with val's immediate children
|
|
10255
|
+
addRet(this._trace(x, val, path, parent, parentPropName, callback, hasArrExpr));
|
|
10256
|
+
|
|
10257
|
+
this._walk(val, m => {
|
|
10258
|
+
// We don't join m and x here because we only want parents,
|
|
10259
|
+
// not scalar values
|
|
10260
|
+
if (typeof val[m] === 'object') {
|
|
10261
|
+
// Keep going with recursive descent on val's
|
|
10262
|
+
// object children
|
|
10263
|
+
addRet(this._trace(expr.slice(), val[m], push(path, m), val, m, callback, true));
|
|
10264
|
+
}
|
|
10265
|
+
}); // The parent sel computation is handled in the frame above using the
|
|
10266
|
+
// ancestor object of val
|
|
10267
|
+
|
|
10268
|
+
} else if (loc === '^') {
|
|
10269
|
+
// This is not a final endpoint, so we do not invoke the callback here
|
|
10270
|
+
this._hasParentSelector = true;
|
|
10271
|
+
return {
|
|
10272
|
+
path: path.slice(0, -1),
|
|
10273
|
+
expr: x,
|
|
10274
|
+
isParentSelector: true
|
|
10275
|
+
};
|
|
10276
|
+
} else if (loc === '~') {
|
|
10277
|
+
// property name
|
|
10278
|
+
retObj = {
|
|
10279
|
+
path: push(path, loc),
|
|
10280
|
+
value: parentPropName,
|
|
10281
|
+
parent,
|
|
10282
|
+
parentProperty: null
|
|
10283
|
+
};
|
|
10284
|
+
|
|
10285
|
+
this._handleCallback(retObj, callback, 'property');
|
|
10286
|
+
|
|
10287
|
+
return retObj;
|
|
10288
|
+
} else if (loc === '$') {
|
|
10289
|
+
// root only
|
|
10290
|
+
addRet(this._trace(x, val, path, null, null, callback, hasArrExpr));
|
|
10291
|
+
} else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(loc)) {
|
|
10292
|
+
// [start:end:step] Python slice syntax
|
|
10293
|
+
addRet(this._slice(loc, x, val, path, parent, parentPropName, callback));
|
|
10294
|
+
} else if (loc.indexOf('?(') === 0) {
|
|
10295
|
+
// [?(expr)] (filtering)
|
|
10296
|
+
if (this.currPreventEval) {
|
|
10297
|
+
throw new Error('Eval [?(expr)] prevented in JSONPath expression.');
|
|
10298
|
+
}
|
|
10299
|
+
|
|
10300
|
+
const safeLoc = loc.replace(/^\?\((.*?)\)$/u, '$1');
|
|
10301
|
+
|
|
10302
|
+
this._walk(val, m => {
|
|
10303
|
+
if (this._eval(safeLoc, val[m], m, path, parent, parentPropName)) {
|
|
10304
|
+
addRet(this._trace(x, val[m], push(path, m), val, m, callback, true));
|
|
10305
|
+
}
|
|
10306
|
+
});
|
|
10307
|
+
} else if (loc[0] === '(') {
|
|
10308
|
+
// [(expr)] (dynamic property/index)
|
|
10309
|
+
if (this.currPreventEval) {
|
|
10310
|
+
throw new Error('Eval [(expr)] prevented in JSONPath expression.');
|
|
10311
|
+
} // As this will resolve to a property name (but we don't know it
|
|
10312
|
+
// yet), property and parent information is relative to the
|
|
10313
|
+
// parent of the property to which this expression will resolve
|
|
10314
|
+
|
|
10315
|
+
|
|
10316
|
+
addRet(this._trace(unshift(this._eval(loc, val, path[path.length - 1], path.slice(0, -1), parent, parentPropName), x), val, path, parent, parentPropName, callback, hasArrExpr));
|
|
10317
|
+
} else if (loc[0] === '@') {
|
|
10318
|
+
// value type: @boolean(), etc.
|
|
10319
|
+
let addType = false;
|
|
10320
|
+
const valueType = loc.slice(1, -2);
|
|
10321
|
+
|
|
10322
|
+
switch (valueType) {
|
|
10323
|
+
case 'scalar':
|
|
10324
|
+
if (!val || !['object', 'function'].includes(typeof val)) {
|
|
10325
|
+
addType = true;
|
|
10326
|
+
}
|
|
10327
|
+
|
|
10328
|
+
break;
|
|
10329
|
+
|
|
10330
|
+
case 'boolean':
|
|
10331
|
+
case 'string':
|
|
10332
|
+
case 'undefined':
|
|
10333
|
+
case 'function':
|
|
10334
|
+
// eslint-disable-next-line valid-typeof
|
|
10335
|
+
if (typeof val === valueType) {
|
|
10336
|
+
addType = true;
|
|
10337
|
+
}
|
|
10338
|
+
|
|
10339
|
+
break;
|
|
10340
|
+
|
|
10341
|
+
case 'integer':
|
|
10342
|
+
if (Number.isFinite(val) && !(val % 1)) {
|
|
10343
|
+
addType = true;
|
|
10344
|
+
}
|
|
10345
|
+
|
|
10346
|
+
break;
|
|
10347
|
+
|
|
10348
|
+
case 'number':
|
|
10349
|
+
if (Number.isFinite(val)) {
|
|
10350
|
+
addType = true;
|
|
10351
|
+
}
|
|
10352
|
+
|
|
10353
|
+
break;
|
|
10354
|
+
|
|
10355
|
+
case 'nonFinite':
|
|
10356
|
+
if (typeof val === 'number' && !Number.isFinite(val)) {
|
|
10357
|
+
addType = true;
|
|
10358
|
+
}
|
|
10359
|
+
|
|
10360
|
+
break;
|
|
10361
|
+
|
|
10362
|
+
case 'object':
|
|
10363
|
+
// eslint-disable-next-line valid-typeof
|
|
10364
|
+
if (val && typeof val === valueType) {
|
|
10365
|
+
addType = true;
|
|
10366
|
+
}
|
|
10367
|
+
|
|
10368
|
+
break;
|
|
10369
|
+
|
|
10370
|
+
case 'array':
|
|
10371
|
+
if (Array.isArray(val)) {
|
|
10372
|
+
addType = true;
|
|
10373
|
+
}
|
|
10374
|
+
|
|
10375
|
+
break;
|
|
10376
|
+
|
|
10377
|
+
case 'other':
|
|
10378
|
+
addType = this.currOtherTypeCallback(val, path, parent, parentPropName);
|
|
10379
|
+
break;
|
|
10380
|
+
|
|
10381
|
+
case 'null':
|
|
10382
|
+
if (val === null) {
|
|
10383
|
+
addType = true;
|
|
10384
|
+
}
|
|
10385
|
+
|
|
10386
|
+
break;
|
|
10387
|
+
|
|
10388
|
+
/* c8 ignore next 2 */
|
|
10389
|
+
|
|
10390
|
+
default:
|
|
10391
|
+
throw new TypeError('Unknown value type ' + valueType);
|
|
10392
|
+
}
|
|
10393
|
+
|
|
10394
|
+
if (addType) {
|
|
10395
|
+
retObj = {
|
|
10396
|
+
path,
|
|
10397
|
+
value: val,
|
|
10398
|
+
parent,
|
|
10399
|
+
parentProperty: parentPropName
|
|
10400
|
+
};
|
|
10401
|
+
|
|
10402
|
+
this._handleCallback(retObj, callback, 'value');
|
|
10403
|
+
|
|
10404
|
+
return retObj;
|
|
10405
|
+
} // `-escaped property
|
|
10406
|
+
|
|
10407
|
+
} else if (loc[0] === '`' && val && hasOwnProp.call(val, loc.slice(1))) {
|
|
10408
|
+
const locProp = loc.slice(1);
|
|
10409
|
+
addRet(this._trace(x, val[locProp], push(path, locProp), val, locProp, callback, hasArrExpr, true));
|
|
10410
|
+
} else if (loc.includes(',')) {
|
|
10411
|
+
// [name1,name2,...]
|
|
10412
|
+
const parts = loc.split(',');
|
|
10413
|
+
|
|
10414
|
+
for (const part of parts) {
|
|
10415
|
+
addRet(this._trace(unshift(part, x), val, path, parent, parentPropName, callback, true));
|
|
10416
|
+
} // simple case--directly follow property
|
|
10417
|
+
|
|
10418
|
+
} else if (!literalPriority && val && hasOwnProp.call(val, loc)) {
|
|
10419
|
+
addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr, true));
|
|
10420
|
+
} // We check the resulting values for parent selections. For parent
|
|
10421
|
+
// selections we discard the value object and continue the trace with the
|
|
10422
|
+
// current val object
|
|
10423
|
+
|
|
10424
|
+
|
|
10425
|
+
if (this._hasParentSelector) {
|
|
10426
|
+
for (let t = 0; t < ret.length; t++) {
|
|
10427
|
+
const rett = ret[t];
|
|
10428
|
+
|
|
10429
|
+
if (rett && rett.isParentSelector) {
|
|
10430
|
+
const tmp = this._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
|
|
10431
|
+
|
|
10432
|
+
if (Array.isArray(tmp)) {
|
|
10433
|
+
ret[t] = tmp[0];
|
|
10434
|
+
const tl = tmp.length;
|
|
10435
|
+
|
|
10436
|
+
for (let tt = 1; tt < tl; tt++) {
|
|
10437
|
+
t++;
|
|
10438
|
+
ret.splice(t, 0, tmp[tt]);
|
|
10439
|
+
}
|
|
10440
|
+
} else {
|
|
10441
|
+
ret[t] = tmp;
|
|
10442
|
+
}
|
|
10443
|
+
}
|
|
10444
|
+
}
|
|
10445
|
+
}
|
|
10446
|
+
|
|
10447
|
+
return ret;
|
|
10448
|
+
};
|
|
10449
|
+
|
|
10450
|
+
JSONPath.prototype._walk = function (val, f) {
|
|
10451
|
+
if (Array.isArray(val)) {
|
|
10452
|
+
const n = val.length;
|
|
10453
|
+
|
|
10454
|
+
for (let i = 0; i < n; i++) {
|
|
10455
|
+
f(i);
|
|
10456
|
+
}
|
|
10457
|
+
} else if (val && typeof val === 'object') {
|
|
10458
|
+
Object.keys(val).forEach(m => {
|
|
10459
|
+
f(m);
|
|
10460
|
+
});
|
|
10461
|
+
}
|
|
10462
|
+
};
|
|
10463
|
+
|
|
10464
|
+
JSONPath.prototype._slice = function (loc, expr, val, path, parent, parentPropName, callback) {
|
|
10465
|
+
if (!Array.isArray(val)) {
|
|
10466
|
+
return undefined;
|
|
10467
|
+
}
|
|
10468
|
+
|
|
10469
|
+
const len = val.length,
|
|
10470
|
+
parts = loc.split(':'),
|
|
10471
|
+
step = parts[2] && Number.parseInt(parts[2]) || 1;
|
|
10472
|
+
let start = parts[0] && Number.parseInt(parts[0]) || 0,
|
|
10473
|
+
end = parts[1] && Number.parseInt(parts[1]) || len;
|
|
10474
|
+
start = start < 0 ? Math.max(0, start + len) : Math.min(len, start);
|
|
10475
|
+
end = end < 0 ? Math.max(0, end + len) : Math.min(len, end);
|
|
10476
|
+
const ret = [];
|
|
10477
|
+
|
|
10478
|
+
for (let i = start; i < end; i += step) {
|
|
10479
|
+
const tmp = this._trace(unshift(i, expr), val, path, parent, parentPropName, callback, true); // Should only be possible to be an array here since first part of
|
|
10480
|
+
// ``unshift(i, expr)` passed in above would not be empty, nor `~`,
|
|
10481
|
+
// nor begin with `@` (as could return objects)
|
|
10482
|
+
// This was causing excessive stack size in Node (with or
|
|
10483
|
+
// without Babel) against our performance test: `ret.push(...tmp);`
|
|
10484
|
+
|
|
10485
|
+
|
|
10486
|
+
tmp.forEach(t => {
|
|
10487
|
+
ret.push(t);
|
|
10488
|
+
});
|
|
10489
|
+
}
|
|
10490
|
+
|
|
10491
|
+
return ret;
|
|
10492
|
+
};
|
|
10493
|
+
|
|
10494
|
+
JSONPath.prototype._eval = function (code, _v, _vname, path, parent, parentPropName) {
|
|
10495
|
+
this.currSandbox._$_parentProperty = parentPropName;
|
|
10496
|
+
this.currSandbox._$_parent = parent;
|
|
10497
|
+
this.currSandbox._$_property = _vname;
|
|
10498
|
+
this.currSandbox._$_root = this.json;
|
|
10499
|
+
this.currSandbox._$_v = _v;
|
|
10500
|
+
const containsPath = code.includes('@path');
|
|
10501
|
+
|
|
10502
|
+
if (containsPath) {
|
|
10503
|
+
this.currSandbox._$_path = JSONPath.toPathString(path.concat([_vname]));
|
|
10504
|
+
}
|
|
10505
|
+
|
|
10506
|
+
const scriptCacheKey = 'script:' + code;
|
|
10507
|
+
|
|
10508
|
+
if (!JSONPath.cache[scriptCacheKey]) {
|
|
10509
|
+
let script = code.replace(/@parentProperty/gu, '_$_parentProperty').replace(/@parent/gu, '_$_parent').replace(/@property/gu, '_$_property').replace(/@root/gu, '_$_root').replace(/@([.\s)[])/gu, '_$_v$1');
|
|
10510
|
+
|
|
10511
|
+
if (containsPath) {
|
|
10512
|
+
script = script.replace(/@path/gu, '_$_path');
|
|
10513
|
+
}
|
|
10514
|
+
|
|
10515
|
+
JSONPath.cache[scriptCacheKey] = new this.vm.Script(script);
|
|
10516
|
+
}
|
|
10517
|
+
|
|
10518
|
+
try {
|
|
10519
|
+
return JSONPath.cache[scriptCacheKey].runInNewContext(this.currSandbox);
|
|
10520
|
+
} catch (e) {
|
|
10521
|
+
throw new Error('jsonPath: ' + e.message + ': ' + code);
|
|
10522
|
+
}
|
|
10523
|
+
}; // PUBLIC CLASS PROPERTIES AND METHODS
|
|
10524
|
+
// Could store the cache object itself
|
|
10525
|
+
|
|
10526
|
+
|
|
10527
|
+
JSONPath.cache = {};
|
|
10528
|
+
/**
|
|
10529
|
+
* @param {string[]} pathArr Array to convert
|
|
10530
|
+
* @returns {string} The path string
|
|
10531
|
+
*/
|
|
10532
|
+
|
|
10533
|
+
JSONPath.toPathString = function (pathArr) {
|
|
10534
|
+
const x = pathArr,
|
|
10535
|
+
n = x.length;
|
|
10536
|
+
let p = '$';
|
|
10537
|
+
|
|
10538
|
+
for (let i = 1; i < n; i++) {
|
|
10539
|
+
if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
|
|
10540
|
+
p += /^[0-9*]+$/u.test(x[i]) ? '[' + x[i] + ']' : "['" + x[i] + "']";
|
|
10541
|
+
}
|
|
10542
|
+
}
|
|
10543
|
+
|
|
10544
|
+
return p;
|
|
10545
|
+
};
|
|
10546
|
+
/**
|
|
10547
|
+
* @param {string} pointer JSON Path
|
|
10548
|
+
* @returns {string} JSON Pointer
|
|
10549
|
+
*/
|
|
10550
|
+
|
|
10551
|
+
|
|
10552
|
+
JSONPath.toPointer = function (pointer) {
|
|
10553
|
+
const x = pointer,
|
|
10554
|
+
n = x.length;
|
|
10555
|
+
let p = '';
|
|
10556
|
+
|
|
10557
|
+
for (let i = 1; i < n; i++) {
|
|
10558
|
+
if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
|
|
10559
|
+
p += '/' + x[i].toString().replace(/~/gu, '~0').replace(/\//gu, '~1');
|
|
10560
|
+
}
|
|
10561
|
+
}
|
|
10562
|
+
|
|
10563
|
+
return p;
|
|
10564
|
+
};
|
|
10565
|
+
/**
|
|
10566
|
+
* @param {string} expr Expression to convert
|
|
10567
|
+
* @returns {string[]}
|
|
10568
|
+
*/
|
|
10569
|
+
|
|
10570
|
+
|
|
10571
|
+
JSONPath.toPathArray = function (expr) {
|
|
10572
|
+
const {
|
|
10573
|
+
cache
|
|
10574
|
+
} = JSONPath;
|
|
10575
|
+
|
|
10576
|
+
if (cache[expr]) {
|
|
10577
|
+
return cache[expr].concat();
|
|
10578
|
+
}
|
|
10579
|
+
|
|
10580
|
+
const subx = [];
|
|
10581
|
+
const normalized = expr // Properties
|
|
10582
|
+
.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ';$&;') // Parenthetical evaluations (filtering and otherwise), directly
|
|
10583
|
+
// within brackets or single quotes
|
|
10584
|
+
.replace(/[['](\??\(.*?\))[\]']/gu, function ($0, $1) {
|
|
10585
|
+
return '[#' + (subx.push($1) - 1) + ']';
|
|
10586
|
+
}) // Escape periods and tildes within properties
|
|
10587
|
+
.replace(/\[['"]([^'\]]*)['"]\]/gu, function ($0, prop) {
|
|
10588
|
+
return "['" + prop.replace(/\./gu, '%@%').replace(/~/gu, '%%@@%%') + "']";
|
|
10589
|
+
}) // Properties operator
|
|
10590
|
+
.replace(/~/gu, ';~;') // Split by property boundaries
|
|
10591
|
+
.replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu, ';') // Reinsert periods within properties
|
|
10592
|
+
.replace(/%@%/gu, '.') // Reinsert tildes within properties
|
|
10593
|
+
.replace(/%%@@%%/gu, '~') // Parent
|
|
10594
|
+
.replace(/(?:;)?(\^+)(?:;)?/gu, function ($0, ups) {
|
|
10595
|
+
return ';' + ups.split('').join(';') + ';';
|
|
10596
|
+
}) // Descendents
|
|
10597
|
+
.replace(/;;;|;;/gu, ';..;') // Remove trailing
|
|
10598
|
+
.replace(/;$|'?\]|'$/gu, '');
|
|
10599
|
+
const exprList = normalized.split(';').map(function (exp) {
|
|
10600
|
+
const match = exp.match(/#(\d+)/u);
|
|
10601
|
+
return !match || !match[1] ? exp : subx[match[1]];
|
|
10602
|
+
});
|
|
10603
|
+
cache[expr] = exprList;
|
|
10604
|
+
return cache[expr].concat();
|
|
10605
|
+
};
|
|
10606
|
+
|
|
10607
|
+
JSONPath.prototype.vm = vm;
|
|
10608
|
+
|
|
10609
|
+
/*!
|
|
10610
|
+
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
10611
|
+
* (c) 2017-2022 Joachim Wester
|
|
10612
|
+
* MIT licensed
|
|
10613
|
+
*/
|
|
10614
|
+
var __extends = (undefined && undefined.__extends) || (function () {
|
|
10615
|
+
var extendStatics = function (d, b) {
|
|
10616
|
+
extendStatics = Object.setPrototypeOf ||
|
|
10617
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
10618
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
10619
|
+
return extendStatics(d, b);
|
|
10620
|
+
};
|
|
10621
|
+
return function (d, b) {
|
|
10622
|
+
extendStatics(d, b);
|
|
10623
|
+
function __() { this.constructor = d; }
|
|
10624
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
10625
|
+
};
|
|
10626
|
+
})();
|
|
10627
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
10628
|
+
function hasOwnProperty$b(obj, key) {
|
|
10629
|
+
return _hasOwnProperty.call(obj, key);
|
|
10630
|
+
}
|
|
10631
|
+
function _objectKeys(obj) {
|
|
10632
|
+
if (Array.isArray(obj)) {
|
|
10633
|
+
var keys_1 = new Array(obj.length);
|
|
10634
|
+
for (var k = 0; k < keys_1.length; k++) {
|
|
10635
|
+
keys_1[k] = "" + k;
|
|
10636
|
+
}
|
|
10637
|
+
return keys_1;
|
|
10638
|
+
}
|
|
10639
|
+
if (Object.keys) {
|
|
10640
|
+
return Object.keys(obj);
|
|
10641
|
+
}
|
|
10642
|
+
var keys = [];
|
|
10643
|
+
for (var i in obj) {
|
|
10644
|
+
if (hasOwnProperty$b(obj, i)) {
|
|
10645
|
+
keys.push(i);
|
|
10646
|
+
}
|
|
10647
|
+
}
|
|
10648
|
+
return keys;
|
|
10649
|
+
}
|
|
10650
|
+
/**
|
|
10651
|
+
* Deeply clone the object.
|
|
10652
|
+
* https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy)
|
|
10653
|
+
* @param {any} obj value to clone
|
|
10654
|
+
* @return {any} cloned obj
|
|
10655
|
+
*/
|
|
10656
|
+
function _deepClone(obj) {
|
|
10657
|
+
switch (typeof obj) {
|
|
10658
|
+
case "object":
|
|
10659
|
+
return JSON.parse(JSON.stringify(obj)); //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5
|
|
10660
|
+
case "undefined":
|
|
10661
|
+
return null; //this is how JSON.stringify behaves for array items
|
|
10662
|
+
default:
|
|
10663
|
+
return obj; //no need to clone primitives
|
|
10664
|
+
}
|
|
10665
|
+
}
|
|
10666
|
+
//3x faster than cached /^\d+$/.test(str)
|
|
10667
|
+
function isInteger(str) {
|
|
10668
|
+
var i = 0;
|
|
10669
|
+
var len = str.length;
|
|
10670
|
+
var charCode;
|
|
10671
|
+
while (i < len) {
|
|
10672
|
+
charCode = str.charCodeAt(i);
|
|
10673
|
+
if (charCode >= 48 && charCode <= 57) {
|
|
10674
|
+
i++;
|
|
10675
|
+
continue;
|
|
10676
|
+
}
|
|
10677
|
+
return false;
|
|
10678
|
+
}
|
|
10679
|
+
return true;
|
|
10680
|
+
}
|
|
10681
|
+
/**
|
|
10682
|
+
* Escapes a json pointer path
|
|
10683
|
+
* @param path The raw pointer
|
|
10684
|
+
* @return the Escaped path
|
|
10685
|
+
*/
|
|
10686
|
+
function escapePathComponent(path) {
|
|
10687
|
+
if (path.indexOf('/') === -1 && path.indexOf('~') === -1)
|
|
10688
|
+
return path;
|
|
10689
|
+
return path.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
10690
|
+
}
|
|
10691
|
+
/**
|
|
10692
|
+
* Unescapes a json pointer path
|
|
10693
|
+
* @param path The escaped pointer
|
|
10694
|
+
* @return The unescaped path
|
|
10695
|
+
*/
|
|
10696
|
+
function unescapePathComponent(path) {
|
|
10697
|
+
return path.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
10698
|
+
}
|
|
10699
|
+
/**
|
|
10700
|
+
* Recursively checks whether an object has any undefined values inside.
|
|
10701
|
+
*/
|
|
10702
|
+
function hasUndefined(obj) {
|
|
10703
|
+
if (obj === undefined) {
|
|
10704
|
+
return true;
|
|
10705
|
+
}
|
|
10706
|
+
if (obj) {
|
|
10707
|
+
if (Array.isArray(obj)) {
|
|
10708
|
+
for (var i_1 = 0, len = obj.length; i_1 < len; i_1++) {
|
|
10709
|
+
if (hasUndefined(obj[i_1])) {
|
|
10710
|
+
return true;
|
|
10711
|
+
}
|
|
10712
|
+
}
|
|
10713
|
+
}
|
|
10714
|
+
else if (typeof obj === "object") {
|
|
10715
|
+
var objKeys = _objectKeys(obj);
|
|
10716
|
+
var objKeysLength = objKeys.length;
|
|
10717
|
+
for (var i = 0; i < objKeysLength; i++) {
|
|
10718
|
+
if (hasUndefined(obj[objKeys[i]])) {
|
|
10719
|
+
return true;
|
|
10720
|
+
}
|
|
10721
|
+
}
|
|
10722
|
+
}
|
|
10723
|
+
}
|
|
10724
|
+
return false;
|
|
10725
|
+
}
|
|
10726
|
+
function patchErrorMessageFormatter(message, args) {
|
|
10727
|
+
var messageParts = [message];
|
|
10728
|
+
for (var key in args) {
|
|
10729
|
+
var value = typeof args[key] === 'object' ? JSON.stringify(args[key], null, 2) : args[key]; // pretty print
|
|
10730
|
+
if (typeof value !== 'undefined') {
|
|
10731
|
+
messageParts.push(key + ": " + value);
|
|
10732
|
+
}
|
|
10733
|
+
}
|
|
10734
|
+
return messageParts.join('\n');
|
|
10735
|
+
}
|
|
10736
|
+
var PatchError = /** @class */ (function (_super) {
|
|
10737
|
+
__extends(PatchError, _super);
|
|
10738
|
+
function PatchError(message, name, index, operation, tree) {
|
|
10739
|
+
var _newTarget = this.constructor;
|
|
10740
|
+
var _this = _super.call(this, patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree })) || this;
|
|
10741
|
+
_this.name = name;
|
|
10742
|
+
_this.index = index;
|
|
10743
|
+
_this.operation = operation;
|
|
10744
|
+
_this.tree = tree;
|
|
10745
|
+
Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain, see https://stackoverflow.com/a/48342359
|
|
10746
|
+
_this.message = patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree });
|
|
10747
|
+
return _this;
|
|
10748
|
+
}
|
|
10749
|
+
return PatchError;
|
|
10750
|
+
}(Error));
|
|
10751
|
+
|
|
10752
|
+
var JsonPatchError = PatchError;
|
|
10753
|
+
var deepClone = _deepClone;
|
|
10754
|
+
/* We use a Javascript hash to store each
|
|
10755
|
+
function. Each hash entry (property) uses
|
|
10756
|
+
the operation identifiers specified in rfc6902.
|
|
10757
|
+
In this way, we can map each patch operation
|
|
10758
|
+
to its dedicated function in efficient way.
|
|
10759
|
+
*/
|
|
10760
|
+
/* The operations applicable to an object */
|
|
10761
|
+
var objOps = {
|
|
10762
|
+
add: function (obj, key, document) {
|
|
10763
|
+
obj[key] = this.value;
|
|
10764
|
+
return { newDocument: document };
|
|
10765
|
+
},
|
|
10766
|
+
remove: function (obj, key, document) {
|
|
10767
|
+
var removed = obj[key];
|
|
10768
|
+
delete obj[key];
|
|
10769
|
+
return { newDocument: document, removed: removed };
|
|
10770
|
+
},
|
|
10771
|
+
replace: function (obj, key, document) {
|
|
10772
|
+
var removed = obj[key];
|
|
10773
|
+
obj[key] = this.value;
|
|
10774
|
+
return { newDocument: document, removed: removed };
|
|
10775
|
+
},
|
|
10776
|
+
move: function (obj, key, document) {
|
|
10777
|
+
/* in case move target overwrites an existing value,
|
|
10778
|
+
return the removed value, this can be taxing performance-wise,
|
|
10779
|
+
and is potentially unneeded */
|
|
10780
|
+
var removed = getValueByPointer(document, this.path);
|
|
10781
|
+
if (removed) {
|
|
10782
|
+
removed = _deepClone(removed);
|
|
10783
|
+
}
|
|
10784
|
+
var originalValue = applyOperation(document, { op: "remove", path: this.from }).removed;
|
|
10785
|
+
applyOperation(document, { op: "add", path: this.path, value: originalValue });
|
|
10786
|
+
return { newDocument: document, removed: removed };
|
|
10787
|
+
},
|
|
10788
|
+
copy: function (obj, key, document) {
|
|
10789
|
+
var valueToCopy = getValueByPointer(document, this.from);
|
|
10790
|
+
// enforce copy by value so further operations don't affect source (see issue #177)
|
|
10791
|
+
applyOperation(document, { op: "add", path: this.path, value: _deepClone(valueToCopy) });
|
|
10792
|
+
return { newDocument: document };
|
|
10793
|
+
},
|
|
10794
|
+
test: function (obj, key, document) {
|
|
10795
|
+
return { newDocument: document, test: _areEquals(obj[key], this.value) };
|
|
10796
|
+
},
|
|
10797
|
+
_get: function (obj, key, document) {
|
|
10798
|
+
this.value = obj[key];
|
|
10799
|
+
return { newDocument: document };
|
|
10800
|
+
}
|
|
10801
|
+
};
|
|
10802
|
+
/* The operations applicable to an array. Many are the same as for the object */
|
|
10803
|
+
var arrOps = {
|
|
10804
|
+
add: function (arr, i, document) {
|
|
10805
|
+
if (isInteger(i)) {
|
|
10806
|
+
arr.splice(i, 0, this.value);
|
|
10807
|
+
}
|
|
10808
|
+
else { // array props
|
|
10809
|
+
arr[i] = this.value;
|
|
10810
|
+
}
|
|
10811
|
+
// this may be needed when using '-' in an array
|
|
10812
|
+
return { newDocument: document, index: i };
|
|
10813
|
+
},
|
|
10814
|
+
remove: function (arr, i, document) {
|
|
10815
|
+
var removedList = arr.splice(i, 1);
|
|
10816
|
+
return { newDocument: document, removed: removedList[0] };
|
|
10817
|
+
},
|
|
10818
|
+
replace: function (arr, i, document) {
|
|
10819
|
+
var removed = arr[i];
|
|
10820
|
+
arr[i] = this.value;
|
|
10821
|
+
return { newDocument: document, removed: removed };
|
|
10822
|
+
},
|
|
10823
|
+
move: objOps.move,
|
|
10824
|
+
copy: objOps.copy,
|
|
10825
|
+
test: objOps.test,
|
|
10826
|
+
_get: objOps._get
|
|
10827
|
+
};
|
|
10828
|
+
/**
|
|
10829
|
+
* Retrieves a value from a JSON document by a JSON pointer.
|
|
10830
|
+
* Returns the value.
|
|
10831
|
+
*
|
|
10832
|
+
* @param document The document to get the value from
|
|
10833
|
+
* @param pointer an escaped JSON pointer
|
|
10834
|
+
* @return The retrieved value
|
|
10835
|
+
*/
|
|
10836
|
+
function getValueByPointer(document, pointer) {
|
|
10837
|
+
if (pointer == '') {
|
|
10838
|
+
return document;
|
|
10839
|
+
}
|
|
10840
|
+
var getOriginalDestination = { op: "_get", path: pointer };
|
|
10841
|
+
applyOperation(document, getOriginalDestination);
|
|
10842
|
+
return getOriginalDestination.value;
|
|
10843
|
+
}
|
|
10844
|
+
/**
|
|
10845
|
+
* Apply a single JSON Patch Operation on a JSON document.
|
|
10846
|
+
* Returns the {newDocument, result} of the operation.
|
|
10847
|
+
* It modifies the `document` and `operation` objects - it gets the values by reference.
|
|
10848
|
+
* If you would like to avoid touching your values, clone them:
|
|
10849
|
+
* `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`.
|
|
10850
|
+
*
|
|
10851
|
+
* @param document The document to patch
|
|
10852
|
+
* @param operation The operation to apply
|
|
10853
|
+
* @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.
|
|
10854
|
+
* @param mutateDocument Whether to mutate the original document or clone it before applying
|
|
10855
|
+
* @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.
|
|
10856
|
+
* @return `{newDocument, result}` after the operation
|
|
10857
|
+
*/
|
|
10858
|
+
function applyOperation(document, operation, validateOperation, mutateDocument, banPrototypeModifications, index) {
|
|
10859
|
+
if (validateOperation === void 0) { validateOperation = false; }
|
|
10860
|
+
if (mutateDocument === void 0) { mutateDocument = true; }
|
|
10861
|
+
if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }
|
|
10862
|
+
if (index === void 0) { index = 0; }
|
|
10863
|
+
if (validateOperation) {
|
|
10864
|
+
if (typeof validateOperation == 'function') {
|
|
10865
|
+
validateOperation(operation, 0, document, operation.path);
|
|
10866
|
+
}
|
|
10867
|
+
else {
|
|
10868
|
+
validator$1(operation, 0);
|
|
10869
|
+
}
|
|
10870
|
+
}
|
|
10871
|
+
/* ROOT OPERATIONS */
|
|
10872
|
+
if (operation.path === "") {
|
|
10873
|
+
var returnValue = { newDocument: document };
|
|
10874
|
+
if (operation.op === 'add') {
|
|
10875
|
+
returnValue.newDocument = operation.value;
|
|
10876
|
+
return returnValue;
|
|
10877
|
+
}
|
|
10878
|
+
else if (operation.op === 'replace') {
|
|
10879
|
+
returnValue.newDocument = operation.value;
|
|
10880
|
+
returnValue.removed = document; //document we removed
|
|
10881
|
+
return returnValue;
|
|
10882
|
+
}
|
|
10883
|
+
else if (operation.op === 'move' || operation.op === 'copy') { // it's a move or copy to root
|
|
10884
|
+
returnValue.newDocument = getValueByPointer(document, operation.from); // get the value by json-pointer in `from` field
|
|
10885
|
+
if (operation.op === 'move') { // report removed item
|
|
10886
|
+
returnValue.removed = document;
|
|
10887
|
+
}
|
|
10888
|
+
return returnValue;
|
|
10889
|
+
}
|
|
10890
|
+
else if (operation.op === 'test') {
|
|
10891
|
+
returnValue.test = _areEquals(document, operation.value);
|
|
10892
|
+
if (returnValue.test === false) {
|
|
10893
|
+
throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
|
|
10894
|
+
}
|
|
10895
|
+
returnValue.newDocument = document;
|
|
10896
|
+
return returnValue;
|
|
10897
|
+
}
|
|
10898
|
+
else if (operation.op === 'remove') { // a remove on root
|
|
10899
|
+
returnValue.removed = document;
|
|
10900
|
+
returnValue.newDocument = null;
|
|
10901
|
+
return returnValue;
|
|
10902
|
+
}
|
|
10903
|
+
else if (operation.op === '_get') {
|
|
10904
|
+
operation.value = document;
|
|
10905
|
+
return returnValue;
|
|
10906
|
+
}
|
|
10907
|
+
else { /* bad operation */
|
|
10908
|
+
if (validateOperation) {
|
|
10909
|
+
throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);
|
|
10910
|
+
}
|
|
10911
|
+
else {
|
|
10912
|
+
return returnValue;
|
|
10913
|
+
}
|
|
10914
|
+
}
|
|
10915
|
+
} /* END ROOT OPERATIONS */
|
|
10916
|
+
else {
|
|
10917
|
+
if (!mutateDocument) {
|
|
10918
|
+
document = _deepClone(document);
|
|
10919
|
+
}
|
|
10920
|
+
var path = operation.path || "";
|
|
10921
|
+
var keys = path.split('/');
|
|
10922
|
+
var obj = document;
|
|
10923
|
+
var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift
|
|
10924
|
+
var len = keys.length;
|
|
10925
|
+
var existingPathFragment = undefined;
|
|
10926
|
+
var key = void 0;
|
|
10927
|
+
var validateFunction = void 0;
|
|
10928
|
+
if (typeof validateOperation == 'function') {
|
|
10929
|
+
validateFunction = validateOperation;
|
|
10930
|
+
}
|
|
10931
|
+
else {
|
|
10932
|
+
validateFunction = validator$1;
|
|
10933
|
+
}
|
|
10934
|
+
while (true) {
|
|
10935
|
+
key = keys[t];
|
|
10936
|
+
if (key && key.indexOf('~') != -1) {
|
|
10937
|
+
key = unescapePathComponent(key);
|
|
10938
|
+
}
|
|
10939
|
+
if (banPrototypeModifications &&
|
|
10940
|
+
(key == '__proto__' ||
|
|
10941
|
+
(key == 'prototype' && t > 0 && keys[t - 1] == 'constructor'))) {
|
|
10942
|
+
throw new TypeError('JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README');
|
|
10943
|
+
}
|
|
10944
|
+
if (validateOperation) {
|
|
10945
|
+
if (existingPathFragment === undefined) {
|
|
10946
|
+
if (obj[key] === undefined) {
|
|
10947
|
+
existingPathFragment = keys.slice(0, t).join('/');
|
|
10948
|
+
}
|
|
10949
|
+
else if (t == len - 1) {
|
|
10950
|
+
existingPathFragment = operation.path;
|
|
10951
|
+
}
|
|
10952
|
+
if (existingPathFragment !== undefined) {
|
|
10953
|
+
validateFunction(operation, 0, document, existingPathFragment);
|
|
10954
|
+
}
|
|
10955
|
+
}
|
|
10956
|
+
}
|
|
10957
|
+
t++;
|
|
10958
|
+
if (Array.isArray(obj)) {
|
|
10959
|
+
if (key === '-') {
|
|
10960
|
+
key = obj.length;
|
|
10961
|
+
}
|
|
10962
|
+
else {
|
|
10963
|
+
if (validateOperation && !isInteger(key)) {
|
|
10964
|
+
throw new JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", index, operation, document);
|
|
10965
|
+
} // only parse key when it's an integer for `arr.prop` to work
|
|
10966
|
+
else if (isInteger(key)) {
|
|
10967
|
+
key = ~~key;
|
|
10968
|
+
}
|
|
10969
|
+
}
|
|
10970
|
+
if (t >= len) {
|
|
10971
|
+
if (validateOperation && operation.op === "add" && key > obj.length) {
|
|
10972
|
+
throw new JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", index, operation, document);
|
|
10973
|
+
}
|
|
10974
|
+
var returnValue = arrOps[operation.op].call(operation, obj, key, document); // Apply patch
|
|
10975
|
+
if (returnValue.test === false) {
|
|
10976
|
+
throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
|
|
10977
|
+
}
|
|
10978
|
+
return returnValue;
|
|
10979
|
+
}
|
|
10980
|
+
}
|
|
10981
|
+
else {
|
|
10982
|
+
if (t >= len) {
|
|
10983
|
+
var returnValue = objOps[operation.op].call(operation, obj, key, document); // Apply patch
|
|
10984
|
+
if (returnValue.test === false) {
|
|
10985
|
+
throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
|
|
10986
|
+
}
|
|
10987
|
+
return returnValue;
|
|
10988
|
+
}
|
|
10989
|
+
}
|
|
10990
|
+
obj = obj[key];
|
|
10991
|
+
// If we have more keys in the path, but the next value isn't a non-null object,
|
|
10992
|
+
// throw an OPERATION_PATH_UNRESOLVABLE error instead of iterating again.
|
|
10993
|
+
if (validateOperation && t < len && (!obj || typeof obj !== "object")) {
|
|
10994
|
+
throw new JsonPatchError('Cannot perform operation at the desired path', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);
|
|
10995
|
+
}
|
|
10996
|
+
}
|
|
10997
|
+
}
|
|
10998
|
+
}
|
|
10999
|
+
/**
|
|
11000
|
+
* Apply a full JSON Patch array on a JSON document.
|
|
11001
|
+
* Returns the {newDocument, result} of the patch.
|
|
11002
|
+
* It modifies the `document` object and `patch` - it gets the values by reference.
|
|
11003
|
+
* If you would like to avoid touching your values, clone them:
|
|
11004
|
+
* `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`.
|
|
11005
|
+
*
|
|
11006
|
+
* @param document The document to patch
|
|
11007
|
+
* @param patch The patch to apply
|
|
11008
|
+
* @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.
|
|
11009
|
+
* @param mutateDocument Whether to mutate the original document or clone it before applying
|
|
11010
|
+
* @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.
|
|
11011
|
+
* @return An array of `{newDocument, result}` after the patch
|
|
11012
|
+
*/
|
|
11013
|
+
function applyPatch(document, patch, validateOperation, mutateDocument, banPrototypeModifications) {
|
|
11014
|
+
if (mutateDocument === void 0) { mutateDocument = true; }
|
|
11015
|
+
if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }
|
|
11016
|
+
if (validateOperation) {
|
|
11017
|
+
if (!Array.isArray(patch)) {
|
|
11018
|
+
throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');
|
|
11019
|
+
}
|
|
11020
|
+
}
|
|
11021
|
+
if (!mutateDocument) {
|
|
11022
|
+
document = _deepClone(document);
|
|
11023
|
+
}
|
|
11024
|
+
var results = new Array(patch.length);
|
|
11025
|
+
for (var i = 0, length_1 = patch.length; i < length_1; i++) {
|
|
11026
|
+
// we don't need to pass mutateDocument argument because if it was true, we already deep cloned the object, we'll just pass `true`
|
|
11027
|
+
results[i] = applyOperation(document, patch[i], validateOperation, true, banPrototypeModifications, i);
|
|
11028
|
+
document = results[i].newDocument; // in case root was replaced
|
|
11029
|
+
}
|
|
11030
|
+
results.newDocument = document;
|
|
11031
|
+
return results;
|
|
11032
|
+
}
|
|
11033
|
+
/**
|
|
11034
|
+
* Apply a single JSON Patch Operation on a JSON document.
|
|
11035
|
+
* Returns the updated document.
|
|
11036
|
+
* Suitable as a reducer.
|
|
11037
|
+
*
|
|
11038
|
+
* @param document The document to patch
|
|
11039
|
+
* @param operation The operation to apply
|
|
11040
|
+
* @return The updated document
|
|
11041
|
+
*/
|
|
11042
|
+
function applyReducer(document, operation, index) {
|
|
11043
|
+
var operationResult = applyOperation(document, operation);
|
|
11044
|
+
if (operationResult.test === false) { // failed test
|
|
11045
|
+
throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
|
|
11046
|
+
}
|
|
11047
|
+
return operationResult.newDocument;
|
|
11048
|
+
}
|
|
11049
|
+
/**
|
|
11050
|
+
* Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.
|
|
11051
|
+
* @param {object} operation - operation object (patch)
|
|
11052
|
+
* @param {number} index - index of operation in the sequence
|
|
11053
|
+
* @param {object} [document] - object where the operation is supposed to be applied
|
|
11054
|
+
* @param {string} [existingPathFragment] - comes along with `document`
|
|
11055
|
+
*/
|
|
11056
|
+
function validator$1(operation, index, document, existingPathFragment) {
|
|
11057
|
+
if (typeof operation !== 'object' || operation === null || Array.isArray(operation)) {
|
|
11058
|
+
throw new JsonPatchError('Operation is not an object', 'OPERATION_NOT_AN_OBJECT', index, operation, document);
|
|
11059
|
+
}
|
|
11060
|
+
else if (!objOps[operation.op]) {
|
|
11061
|
+
throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);
|
|
11062
|
+
}
|
|
11063
|
+
else if (typeof operation.path !== 'string') {
|
|
11064
|
+
throw new JsonPatchError('Operation `path` property is not a string', 'OPERATION_PATH_INVALID', index, operation, document);
|
|
11065
|
+
}
|
|
11066
|
+
else if (operation.path.indexOf('/') !== 0 && operation.path.length > 0) {
|
|
11067
|
+
// paths that aren't empty string should start with "/"
|
|
11068
|
+
throw new JsonPatchError('Operation `path` property must start with "/"', 'OPERATION_PATH_INVALID', index, operation, document);
|
|
11069
|
+
}
|
|
11070
|
+
else if ((operation.op === 'move' || operation.op === 'copy') && typeof operation.from !== 'string') {
|
|
11071
|
+
throw new JsonPatchError('Operation `from` property is not present (applicable in `move` and `copy` operations)', 'OPERATION_FROM_REQUIRED', index, operation, document);
|
|
11072
|
+
}
|
|
11073
|
+
else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && operation.value === undefined) {
|
|
11074
|
+
throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_REQUIRED', index, operation, document);
|
|
11075
|
+
}
|
|
11076
|
+
else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && hasUndefined(operation.value)) {
|
|
11077
|
+
throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED', index, operation, document);
|
|
11078
|
+
}
|
|
11079
|
+
else if (document) {
|
|
11080
|
+
if (operation.op == "add") {
|
|
11081
|
+
var pathLen = operation.path.split("/").length;
|
|
11082
|
+
var existingPathLen = existingPathFragment.split("/").length;
|
|
11083
|
+
if (pathLen !== existingPathLen + 1 && pathLen !== existingPathLen) {
|
|
11084
|
+
throw new JsonPatchError('Cannot perform an `add` operation at the desired path', 'OPERATION_PATH_CANNOT_ADD', index, operation, document);
|
|
11085
|
+
}
|
|
11086
|
+
}
|
|
11087
|
+
else if (operation.op === 'replace' || operation.op === 'remove' || operation.op === '_get') {
|
|
11088
|
+
if (operation.path !== existingPathFragment) {
|
|
11089
|
+
throw new JsonPatchError('Cannot perform the operation at a path that does not exist', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);
|
|
11090
|
+
}
|
|
11091
|
+
}
|
|
11092
|
+
else if (operation.op === 'move' || operation.op === 'copy') {
|
|
11093
|
+
var existingValue = { op: "_get", path: operation.from, value: undefined };
|
|
11094
|
+
var error = validate([existingValue], document);
|
|
11095
|
+
if (error && error.name === 'OPERATION_PATH_UNRESOLVABLE') {
|
|
11096
|
+
throw new JsonPatchError('Cannot perform the operation from a path that does not exist', 'OPERATION_FROM_UNRESOLVABLE', index, operation, document);
|
|
11097
|
+
}
|
|
11098
|
+
}
|
|
11099
|
+
}
|
|
11100
|
+
}
|
|
11101
|
+
/**
|
|
11102
|
+
* Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document.
|
|
11103
|
+
* If error is encountered, returns a JsonPatchError object
|
|
11104
|
+
* @param sequence
|
|
11105
|
+
* @param document
|
|
11106
|
+
* @returns {JsonPatchError|undefined}
|
|
11107
|
+
*/
|
|
11108
|
+
function validate(sequence, document, externalValidator) {
|
|
11109
|
+
try {
|
|
11110
|
+
if (!Array.isArray(sequence)) {
|
|
11111
|
+
throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');
|
|
11112
|
+
}
|
|
11113
|
+
if (document) {
|
|
11114
|
+
//clone document and sequence so that we can safely try applying operations
|
|
11115
|
+
applyPatch(_deepClone(document), _deepClone(sequence), externalValidator || true);
|
|
11116
|
+
}
|
|
11117
|
+
else {
|
|
11118
|
+
externalValidator = externalValidator || validator$1;
|
|
11119
|
+
for (var i = 0; i < sequence.length; i++) {
|
|
11120
|
+
externalValidator(sequence[i], i, document, undefined);
|
|
11121
|
+
}
|
|
11122
|
+
}
|
|
11123
|
+
}
|
|
11124
|
+
catch (e) {
|
|
11125
|
+
if (e instanceof JsonPatchError) {
|
|
11126
|
+
return e;
|
|
11127
|
+
}
|
|
11128
|
+
else {
|
|
11129
|
+
throw e;
|
|
11130
|
+
}
|
|
11131
|
+
}
|
|
11132
|
+
}
|
|
11133
|
+
// based on https://github.com/epoberezkin/fast-deep-equal
|
|
11134
|
+
// MIT License
|
|
11135
|
+
// Copyright (c) 2017 Evgeny Poberezkin
|
|
11136
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11137
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
11138
|
+
// in the Software without restriction, including without limitation the rights
|
|
11139
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11140
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
11141
|
+
// furnished to do so, subject to the following conditions:
|
|
11142
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
11143
|
+
// copies or substantial portions of the Software.
|
|
11144
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11145
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
11146
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
11147
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
11148
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
11149
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
11150
|
+
// SOFTWARE.
|
|
11151
|
+
function _areEquals(a, b) {
|
|
11152
|
+
if (a === b)
|
|
11153
|
+
return true;
|
|
11154
|
+
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
11155
|
+
var arrA = Array.isArray(a), arrB = Array.isArray(b), i, length, key;
|
|
11156
|
+
if (arrA && arrB) {
|
|
11157
|
+
length = a.length;
|
|
11158
|
+
if (length != b.length)
|
|
11159
|
+
return false;
|
|
11160
|
+
for (i = length; i-- !== 0;)
|
|
11161
|
+
if (!_areEquals(a[i], b[i]))
|
|
11162
|
+
return false;
|
|
11163
|
+
return true;
|
|
11164
|
+
}
|
|
11165
|
+
if (arrA != arrB)
|
|
11166
|
+
return false;
|
|
11167
|
+
var keys = Object.keys(a);
|
|
11168
|
+
length = keys.length;
|
|
11169
|
+
if (length !== Object.keys(b).length)
|
|
11170
|
+
return false;
|
|
11171
|
+
for (i = length; i-- !== 0;)
|
|
11172
|
+
if (!b.hasOwnProperty(keys[i]))
|
|
11173
|
+
return false;
|
|
11174
|
+
for (i = length; i-- !== 0;) {
|
|
11175
|
+
key = keys[i];
|
|
11176
|
+
if (!_areEquals(a[key], b[key]))
|
|
11177
|
+
return false;
|
|
11178
|
+
}
|
|
11179
|
+
return true;
|
|
11180
|
+
}
|
|
11181
|
+
return a !== a && b !== b;
|
|
11182
|
+
}
|
|
11183
|
+
|
|
11184
|
+
var core = /*#__PURE__*/Object.freeze({
|
|
11185
|
+
__proto__: null,
|
|
11186
|
+
JsonPatchError: JsonPatchError,
|
|
11187
|
+
_areEquals: _areEquals,
|
|
11188
|
+
applyOperation: applyOperation,
|
|
11189
|
+
applyPatch: applyPatch,
|
|
11190
|
+
applyReducer: applyReducer,
|
|
11191
|
+
deepClone: deepClone,
|
|
11192
|
+
getValueByPointer: getValueByPointer,
|
|
11193
|
+
validate: validate,
|
|
11194
|
+
validator: validator$1
|
|
11195
|
+
});
|
|
11196
|
+
|
|
11197
|
+
/*!
|
|
11198
|
+
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
11199
|
+
* (c) 2017-2021 Joachim Wester
|
|
11200
|
+
* MIT license
|
|
11201
|
+
*/
|
|
11202
|
+
var beforeDict = new WeakMap();
|
|
11203
|
+
var Mirror = /** @class */ (function () {
|
|
11204
|
+
function Mirror(obj) {
|
|
11205
|
+
this.observers = new Map();
|
|
11206
|
+
this.obj = obj;
|
|
11207
|
+
}
|
|
11208
|
+
return Mirror;
|
|
11209
|
+
}());
|
|
11210
|
+
var ObserverInfo = /** @class */ (function () {
|
|
11211
|
+
function ObserverInfo(callback, observer) {
|
|
11212
|
+
this.callback = callback;
|
|
11213
|
+
this.observer = observer;
|
|
11214
|
+
}
|
|
11215
|
+
return ObserverInfo;
|
|
11216
|
+
}());
|
|
11217
|
+
function getMirror(obj) {
|
|
11218
|
+
return beforeDict.get(obj);
|
|
11219
|
+
}
|
|
11220
|
+
function getObserverFromMirror(mirror, callback) {
|
|
11221
|
+
return mirror.observers.get(callback);
|
|
11222
|
+
}
|
|
11223
|
+
function removeObserverFromMirror(mirror, observer) {
|
|
11224
|
+
mirror.observers.delete(observer.callback);
|
|
11225
|
+
}
|
|
11226
|
+
/**
|
|
11227
|
+
* Detach an observer from an object
|
|
11228
|
+
*/
|
|
11229
|
+
function unobserve(root, observer) {
|
|
11230
|
+
observer.unobserve();
|
|
11231
|
+
}
|
|
11232
|
+
/**
|
|
11233
|
+
* Observes changes made to an object, which can then be retrieved using generate
|
|
11234
|
+
*/
|
|
11235
|
+
function observe(obj, callback) {
|
|
11236
|
+
var patches = [];
|
|
11237
|
+
var observer;
|
|
11238
|
+
var mirror = getMirror(obj);
|
|
11239
|
+
if (!mirror) {
|
|
11240
|
+
mirror = new Mirror(obj);
|
|
11241
|
+
beforeDict.set(obj, mirror);
|
|
11242
|
+
}
|
|
11243
|
+
else {
|
|
11244
|
+
var observerInfo = getObserverFromMirror(mirror, callback);
|
|
11245
|
+
observer = observerInfo && observerInfo.observer;
|
|
11246
|
+
}
|
|
11247
|
+
if (observer) {
|
|
11248
|
+
return observer;
|
|
11249
|
+
}
|
|
11250
|
+
observer = {};
|
|
11251
|
+
mirror.value = _deepClone(obj);
|
|
11252
|
+
if (callback) {
|
|
11253
|
+
observer.callback = callback;
|
|
11254
|
+
observer.next = null;
|
|
11255
|
+
var dirtyCheck = function () {
|
|
11256
|
+
generate(observer);
|
|
11257
|
+
};
|
|
11258
|
+
var fastCheck = function () {
|
|
11259
|
+
clearTimeout(observer.next);
|
|
11260
|
+
observer.next = setTimeout(dirtyCheck);
|
|
11261
|
+
};
|
|
11262
|
+
if (typeof window !== 'undefined') { //not Node
|
|
11263
|
+
window.addEventListener('mouseup', fastCheck);
|
|
11264
|
+
window.addEventListener('keyup', fastCheck);
|
|
11265
|
+
window.addEventListener('mousedown', fastCheck);
|
|
11266
|
+
window.addEventListener('keydown', fastCheck);
|
|
11267
|
+
window.addEventListener('change', fastCheck);
|
|
11268
|
+
}
|
|
11269
|
+
}
|
|
11270
|
+
observer.patches = patches;
|
|
11271
|
+
observer.object = obj;
|
|
11272
|
+
observer.unobserve = function () {
|
|
11273
|
+
generate(observer);
|
|
11274
|
+
clearTimeout(observer.next);
|
|
11275
|
+
removeObserverFromMirror(mirror, observer);
|
|
11276
|
+
if (typeof window !== 'undefined') {
|
|
11277
|
+
window.removeEventListener('mouseup', fastCheck);
|
|
11278
|
+
window.removeEventListener('keyup', fastCheck);
|
|
11279
|
+
window.removeEventListener('mousedown', fastCheck);
|
|
11280
|
+
window.removeEventListener('keydown', fastCheck);
|
|
11281
|
+
window.removeEventListener('change', fastCheck);
|
|
11282
|
+
}
|
|
11283
|
+
};
|
|
11284
|
+
mirror.observers.set(callback, new ObserverInfo(callback, observer));
|
|
11285
|
+
return observer;
|
|
11286
|
+
}
|
|
11287
|
+
/**
|
|
11288
|
+
* Generate an array of patches from an observer
|
|
11289
|
+
*/
|
|
11290
|
+
function generate(observer, invertible) {
|
|
11291
|
+
if (invertible === void 0) { invertible = false; }
|
|
11292
|
+
var mirror = beforeDict.get(observer.object);
|
|
11293
|
+
_generate(mirror.value, observer.object, observer.patches, "", invertible);
|
|
11294
|
+
if (observer.patches.length) {
|
|
11295
|
+
applyPatch(mirror.value, observer.patches);
|
|
11296
|
+
}
|
|
11297
|
+
var temp = observer.patches;
|
|
11298
|
+
if (temp.length > 0) {
|
|
11299
|
+
observer.patches = [];
|
|
11300
|
+
if (observer.callback) {
|
|
11301
|
+
observer.callback(temp);
|
|
11302
|
+
}
|
|
11303
|
+
}
|
|
11304
|
+
return temp;
|
|
11305
|
+
}
|
|
11306
|
+
// Dirty check if obj is different from mirror, generate patches and update mirror
|
|
11307
|
+
function _generate(mirror, obj, patches, path, invertible) {
|
|
11308
|
+
if (obj === mirror) {
|
|
11309
|
+
return;
|
|
11310
|
+
}
|
|
11311
|
+
if (typeof obj.toJSON === "function") {
|
|
11312
|
+
obj = obj.toJSON();
|
|
11313
|
+
}
|
|
11314
|
+
var newKeys = _objectKeys(obj);
|
|
11315
|
+
var oldKeys = _objectKeys(mirror);
|
|
11316
|
+
var deleted = false;
|
|
11317
|
+
//if ever "move" operation is implemented here, make sure this test runs OK: "should not generate the same patch twice (move)"
|
|
11318
|
+
for (var t = oldKeys.length - 1; t >= 0; t--) {
|
|
11319
|
+
var key = oldKeys[t];
|
|
11320
|
+
var oldVal = mirror[key];
|
|
11321
|
+
if (hasOwnProperty$b(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {
|
|
11322
|
+
var newVal = obj[key];
|
|
11323
|
+
if (typeof oldVal == "object" && oldVal != null && typeof newVal == "object" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) {
|
|
11324
|
+
_generate(oldVal, newVal, patches, path + "/" + escapePathComponent(key), invertible);
|
|
11325
|
+
}
|
|
11326
|
+
else {
|
|
11327
|
+
if (oldVal !== newVal) {
|
|
11328
|
+
if (invertible) {
|
|
11329
|
+
patches.push({ op: "test", path: path + "/" + escapePathComponent(key), value: _deepClone(oldVal) });
|
|
11330
|
+
}
|
|
11331
|
+
patches.push({ op: "replace", path: path + "/" + escapePathComponent(key), value: _deepClone(newVal) });
|
|
11332
|
+
}
|
|
11333
|
+
}
|
|
11334
|
+
}
|
|
11335
|
+
else if (Array.isArray(mirror) === Array.isArray(obj)) {
|
|
11336
|
+
if (invertible) {
|
|
11337
|
+
patches.push({ op: "test", path: path + "/" + escapePathComponent(key), value: _deepClone(oldVal) });
|
|
11338
|
+
}
|
|
11339
|
+
patches.push({ op: "remove", path: path + "/" + escapePathComponent(key) });
|
|
11340
|
+
deleted = true; // property has been deleted
|
|
11341
|
+
}
|
|
11342
|
+
else {
|
|
11343
|
+
if (invertible) {
|
|
11344
|
+
patches.push({ op: "test", path: path, value: mirror });
|
|
11345
|
+
}
|
|
11346
|
+
patches.push({ op: "replace", path: path, value: obj });
|
|
11347
|
+
}
|
|
11348
|
+
}
|
|
11349
|
+
if (!deleted && newKeys.length == oldKeys.length) {
|
|
11350
|
+
return;
|
|
11351
|
+
}
|
|
11352
|
+
for (var t = 0; t < newKeys.length; t++) {
|
|
11353
|
+
var key = newKeys[t];
|
|
11354
|
+
if (!hasOwnProperty$b(mirror, key) && obj[key] !== undefined) {
|
|
11355
|
+
patches.push({ op: "add", path: path + "/" + escapePathComponent(key), value: _deepClone(obj[key]) });
|
|
11356
|
+
}
|
|
11357
|
+
}
|
|
11358
|
+
}
|
|
11359
|
+
/**
|
|
11360
|
+
* Create an array of patches from the differences in two objects
|
|
11361
|
+
*/
|
|
11362
|
+
function compare(tree1, tree2, invertible) {
|
|
11363
|
+
if (invertible === void 0) { invertible = false; }
|
|
11364
|
+
var patches = [];
|
|
11365
|
+
_generate(tree1, tree2, patches, '', invertible);
|
|
11366
|
+
return patches;
|
|
11367
|
+
}
|
|
11368
|
+
|
|
11369
|
+
var duplex = /*#__PURE__*/Object.freeze({
|
|
11370
|
+
__proto__: null,
|
|
11371
|
+
compare: compare,
|
|
11372
|
+
generate: generate,
|
|
11373
|
+
observe: observe,
|
|
11374
|
+
unobserve: unobserve
|
|
11375
|
+
});
|
|
11376
|
+
|
|
11377
|
+
Object.assign({}, core, duplex, {
|
|
11378
|
+
JsonPatchError: PatchError,
|
|
11379
|
+
deepClone: _deepClone,
|
|
11380
|
+
escapePathComponent,
|
|
11381
|
+
unescapePathComponent
|
|
11382
|
+
});
|
|
11383
|
+
|
|
9867
11384
|
toast.configure({
|
|
9868
11385
|
autoClose: 3000,
|
|
9869
11386
|
hideProgressBar: true,
|
|
@@ -10261,7 +11778,83 @@ var getUrlWithSearchParams = function (url, params) {
|
|
|
10261
11778
|
/**
|
|
10262
11779
|
* Custom exception logger function for logging errors to sentry
|
|
10263
11780
|
*/
|
|
10264
|
-
var logExceptionToSentry = captureException.bind(window);
|
|
11781
|
+
var logExceptionToSentry = captureException.bind(window);
|
|
11782
|
+
var customStyles = {
|
|
11783
|
+
control: function (base, state) { return (__assign(__assign({}, base), { minHeight: '32px', boxShadow: 'none', border: 'none', cursor: 'pointer', background: 'transparent' })); },
|
|
11784
|
+
indicatorSeparator: function (base, state) { return (__assign(__assign({}, base), { width: 0 })); },
|
|
11785
|
+
valueContainer: function (base, state) { return (__assign(__assign({}, base), { padding: '0', fontSize: '13px', fontWeight: '600' })); },
|
|
11786
|
+
dropdownIndicator: function (base, state) { return (__assign(__assign({}, base), { color: 'var(--N400)', padding: '0 8px', transition: 'all .2s ease', transform: state.selectProps.menuIsOpen ? 'rotate(180deg)' : 'rotate(0deg)' })); },
|
|
11787
|
+
};
|
|
11788
|
+
var getFilteredChartVersions = function (charts, selectedChartType) {
|
|
11789
|
+
// Filter chart versions based on selected chart type
|
|
11790
|
+
return charts
|
|
11791
|
+
.filter(function (item) { return (item === null || item === void 0 ? void 0 : item.chartType) === selectedChartType.value; })
|
|
11792
|
+
.map(function (item) { return ({
|
|
11793
|
+
value: item === null || item === void 0 ? void 0 : item.chartVersion,
|
|
11794
|
+
label: item === null || item === void 0 ? void 0 : item.chartVersion,
|
|
11795
|
+
chartRefId: item.chartRefId,
|
|
11796
|
+
}); });
|
|
11797
|
+
};
|
|
11798
|
+
function removeEmptyObjectKeysAndNullValues(obj) {
|
|
11799
|
+
// It recursively removes empty object keys and array values that are null
|
|
11800
|
+
for (var key in obj) {
|
|
11801
|
+
if (Array.isArray(obj[key])) {
|
|
11802
|
+
if (obj[key].length === 0)
|
|
11803
|
+
continue;
|
|
11804
|
+
obj[key] = obj[key].filter(function (item) { return item !== null; });
|
|
11805
|
+
// Check if the array is empty
|
|
11806
|
+
if (obj[key].length === 0) {
|
|
11807
|
+
delete obj[key]; // Delete the key if the array is empty
|
|
11808
|
+
}
|
|
11809
|
+
}
|
|
11810
|
+
else if (obj[key] && typeof obj[key] === 'object') {
|
|
11811
|
+
if (removeEmptyObjectKeysAndNullValues(obj[key])) {
|
|
11812
|
+
delete obj[key];
|
|
11813
|
+
}
|
|
11814
|
+
}
|
|
11815
|
+
else if (obj[key] === undefined) {
|
|
11816
|
+
delete obj[key];
|
|
11817
|
+
}
|
|
11818
|
+
}
|
|
11819
|
+
return Object.keys(obj).length === 0;
|
|
11820
|
+
}
|
|
11821
|
+
function getUnlockedJSON(json, jsonPathArray) {
|
|
11822
|
+
var jsonCopy = JSON.parse(JSON.stringify(json));
|
|
11823
|
+
var patches = jsonPathArray.flatMap(function (jsonPath) {
|
|
11824
|
+
var pathsToRemove = JSONPath({ path: jsonPath, json: jsonCopy, resultType: 'all' });
|
|
11825
|
+
return pathsToRemove.map(function (result) {
|
|
11826
|
+
return Array.isArray(result.parent)
|
|
11827
|
+
? { op: 'replace', path: result.pointer, value: null }
|
|
11828
|
+
: { op: 'remove', path: result.pointer };
|
|
11829
|
+
});
|
|
11830
|
+
});
|
|
11831
|
+
var newDocument = applyPatch(jsonCopy, patches).newDocument;
|
|
11832
|
+
removeEmptyObjectKeysAndNullValues(newDocument);
|
|
11833
|
+
return newDocument;
|
|
11834
|
+
}
|
|
11835
|
+
function getLockedJSON(json, jsonPathArray) {
|
|
11836
|
+
var jsonCopy = JSON.parse(JSON.stringify(json));
|
|
11837
|
+
var resultJson = {};
|
|
11838
|
+
jsonPathArray.forEach(function (jsonPath) {
|
|
11839
|
+
var elements = JSONPath({ path: jsonPath, json: jsonCopy, resultType: 'all' });
|
|
11840
|
+
elements.forEach(function (element) {
|
|
11841
|
+
var _a;
|
|
11842
|
+
var pathArray = JSONPath.toPathArray(element.path);
|
|
11843
|
+
var lastPath = pathArray.pop();
|
|
11844
|
+
var current = resultJson;
|
|
11845
|
+
for (var i = 0; i < pathArray.length; i++) {
|
|
11846
|
+
var key_1 = isNaN(Number(pathArray[i])) ? pathArray[i] : parseInt(pathArray[i]);
|
|
11847
|
+
if (!current[key_1]) {
|
|
11848
|
+
current[key_1] = isNaN(Number((_a = pathArray[i + 1]) !== null && _a !== void 0 ? _a : lastPath)) ? {} : [];
|
|
11849
|
+
}
|
|
11850
|
+
current = current[key_1];
|
|
11851
|
+
}
|
|
11852
|
+
var key = isNaN(Number(lastPath)) ? lastPath : parseInt(lastPath);
|
|
11853
|
+
current[key] = element.value;
|
|
11854
|
+
});
|
|
11855
|
+
});
|
|
11856
|
+
return resultJson['$'];
|
|
11857
|
+
}
|
|
10265
11858
|
|
|
10266
11859
|
function Progressing(_a) {
|
|
10267
11860
|
var pageLoader = _a.pageLoader, size = _a.size, theme = _a.theme, styles = _a.styles, fillColor = _a.fillColor;
|
|
@@ -10274,7 +11867,7 @@ function DetailsProgressing(_a) {
|
|
|
10274
11867
|
}
|
|
10275
11868
|
|
|
10276
11869
|
var VisibleModal = /** @class */ (function (_super) {
|
|
10277
|
-
__extends(VisibleModal, _super);
|
|
11870
|
+
__extends$1(VisibleModal, _super);
|
|
10278
11871
|
function VisibleModal(props) {
|
|
10279
11872
|
var _this = _super.call(this, props) || this;
|
|
10280
11873
|
_this.modalRef = document.getElementById('visible-modal');
|
|
@@ -10405,7 +11998,7 @@ var SvgIcCross = function SvgIcCross(props) {
|
|
|
10405
11998
|
var close = "data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M19.2803%205.78033C19.5732%205.48744%2019.5732%205.01256%2019.2803%204.71967C18.9874%204.42678%2018.5126%204.42678%2018.2197%204.71967L19.2803%205.78033ZM4.71967%2018.2197C4.42678%2018.5126%204.42678%2018.9874%204.71967%2019.2803C5.01256%2019.5732%205.48744%2019.5732%205.78033%2019.2803L4.71967%2018.2197ZM18.2197%2019.2803C18.5126%2019.5732%2018.9874%2019.5732%2019.2803%2019.2803C19.5732%2018.9874%2019.5732%2018.5126%2019.2803%2018.2197L18.2197%2019.2803ZM5.78033%204.71967C5.48744%204.42678%205.01256%204.42678%204.71967%204.71967C4.42678%205.01256%204.42678%205.48744%204.71967%205.78033L5.78033%204.71967ZM18.2197%204.71967L11.4697%2011.4697L12.5303%2012.5303L19.2803%205.78033L18.2197%204.71967ZM11.4697%2011.4697L4.71967%2018.2197L5.78033%2019.2803L12.5303%2012.5303L11.4697%2011.4697ZM19.2803%2018.2197L12.5303%2011.4697L11.4697%2012.5303L18.2197%2019.2803L19.2803%2018.2197ZM12.5303%2011.4697L5.78033%204.71967L4.71967%205.78033L11.4697%2012.5303L12.5303%2011.4697Z%22%20fill%3D%22%23596168%22%2F%3E%3C%2Fsvg%3E";
|
|
10406
11999
|
|
|
10407
12000
|
var OpaqueModal = /** @class */ (function (_super) {
|
|
10408
|
-
__extends(OpaqueModal, _super);
|
|
12001
|
+
__extends$1(OpaqueModal, _super);
|
|
10409
12002
|
function OpaqueModal() {
|
|
10410
12003
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
10411
12004
|
_this.modalRef = document.getElementById('full-screen-modal');
|
|
@@ -10429,7 +12022,7 @@ var OpaqueModal = /** @class */ (function (_super) {
|
|
|
10429
12022
|
}(React.Component));
|
|
10430
12023
|
|
|
10431
12024
|
var VisibleModal2 = /** @class */ (function (_super) {
|
|
10432
|
-
__extends(VisibleModal2, _super);
|
|
12025
|
+
__extends$1(VisibleModal2, _super);
|
|
10433
12026
|
function VisibleModal2(props) {
|
|
10434
12027
|
var _this = _super.call(this, props) || this;
|
|
10435
12028
|
_this.modalRef = document.getElementById('visible-modal-2');
|
|
@@ -10540,7 +12133,7 @@ var BreadCrumb = function (_a) {
|
|
|
10540
12133
|
|
|
10541
12134
|
var RadioGroupContext = React.createContext({ name: '', value: '', disabled: false, onChange: function (event) { } });
|
|
10542
12135
|
var RadioGroupItem = /** @class */ (function (_super) {
|
|
10543
|
-
__extends(RadioGroupItem, _super);
|
|
12136
|
+
__extends$1(RadioGroupItem, _super);
|
|
10544
12137
|
function RadioGroupItem() {
|
|
10545
12138
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
10546
12139
|
}
|
|
@@ -10553,7 +12146,7 @@ var RadioGroupItem = /** @class */ (function (_super) {
|
|
|
10553
12146
|
return RadioGroupItem;
|
|
10554
12147
|
}(React.Component));
|
|
10555
12148
|
var RadioGroup$1 = /** @class */ (function (_super) {
|
|
10556
|
-
__extends(RadioGroup, _super);
|
|
12149
|
+
__extends$1(RadioGroup, _super);
|
|
10557
12150
|
function RadioGroup() {
|
|
10558
12151
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
10559
12152
|
}
|
|
@@ -15134,7 +16727,7 @@ DeleteDialog.Description = DeleteDialogDescription;
|
|
|
15134
16727
|
//TODO: may not need context
|
|
15135
16728
|
var DialogFormContext = React.createContext({ title: '', isLoading: false, close: function (event) { }, onSave: function (event) { } });
|
|
15136
16729
|
var DialogForm = /** @class */ (function (_super) {
|
|
15137
|
-
__extends(DialogForm, _super);
|
|
16730
|
+
__extends$1(DialogForm, _super);
|
|
15138
16731
|
function DialogForm(props) {
|
|
15139
16732
|
var _this = _super.call(this, props) || this;
|
|
15140
16733
|
_this.escFunction = _this.escFunction.bind(_this);
|
|
@@ -15170,7 +16763,7 @@ var DialogForm = /** @class */ (function (_super) {
|
|
|
15170
16763
|
return DialogForm;
|
|
15171
16764
|
}(React.Component));
|
|
15172
16765
|
var DialogFormSubmit = /** @class */ (function (_super) {
|
|
15173
|
-
__extends(DialogFormSubmit, _super);
|
|
16766
|
+
__extends$1(DialogFormSubmit, _super);
|
|
15174
16767
|
function DialogFormSubmit() {
|
|
15175
16768
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
15176
16769
|
}
|
|
@@ -22937,6 +24530,9 @@ function createGitCommitUrl(url, revision) {
|
|
|
22937
24530
|
}
|
|
22938
24531
|
}
|
|
22939
24532
|
return "NA";
|
|
24533
|
+
}
|
|
24534
|
+
function fetchChartTemplateVersions() {
|
|
24535
|
+
return get("".concat(ROUTES.DEPLOYMENT_TEMPLATE_LIST, "?appId=-1&envId=-1"));
|
|
22940
24536
|
}
|
|
22941
24537
|
|
|
22942
24538
|
/*
|
|
@@ -22949,7 +24545,7 @@ Valid States of Checkbox:
|
|
|
22949
24545
|
6. disabled: false, checked: true, value: CHECKED
|
|
22950
24546
|
*/
|
|
22951
24547
|
var Checkbox$1 = /** @class */ (function (_super) {
|
|
22952
|
-
__extends(Checkbox, _super);
|
|
24548
|
+
__extends$1(Checkbox, _super);
|
|
22953
24549
|
function Checkbox() {
|
|
22954
24550
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
22955
24551
|
}
|
|
@@ -26651,6 +28247,53 @@ function DevtronProgressing(_a) {
|
|
|
26651
28247
|
return (jsxRuntime.jsx("div", __assign({ className: parentClasses ? parentClasses : '' }, { children: jsxRuntime.jsx(SvgIcRotateDevtron, { className: classes ? classes : '' }) })));
|
|
26652
28248
|
}
|
|
26653
28249
|
|
|
28250
|
+
// @TODO: Generalize this component to be used in CodeEditor as Chart selector toolbar
|
|
28251
|
+
// when the Code Editor is moved to the fe-common-lib
|
|
28252
|
+
var ChartVersionAndTypeSelector = function (_a) {
|
|
28253
|
+
var setSelectedChartRefId = _a.setSelectedChartRefId;
|
|
28254
|
+
var _b = __read(React.useState([]), 2), charts = _b[0], setCharts = _b[1];
|
|
28255
|
+
var _c = __read(React.useState(null), 2), selectedChartType = _c[0], setSelectedChartType = _c[1];
|
|
28256
|
+
var _d = __read(React.useState([]), 2), chartVersionOptions = _d[0], setChartVersionOptions = _d[1];
|
|
28257
|
+
var _e = __read(React.useState([]), 2), chartTypeOptions = _e[0], setChartTypeOptions = _e[1];
|
|
28258
|
+
var _f = __read(React.useState(null), 2), selectedChartVersion = _f[0], setSelectedChartVersion = _f[1];
|
|
28259
|
+
React.useEffect(function () {
|
|
28260
|
+
fetchChartTemplateVersions()
|
|
28261
|
+
.then(function (res) {
|
|
28262
|
+
var charts = (res === null || res === void 0 ? void 0 : res.result) || [];
|
|
28263
|
+
setCharts(charts);
|
|
28264
|
+
// Extract unique chart types from the data
|
|
28265
|
+
var chartTypeOptions = __spreadArray([], __read(new Set(charts.map(function (item) { return item.chartType; }))), false).map(function (type) { return ({
|
|
28266
|
+
value: type,
|
|
28267
|
+
label: type,
|
|
28268
|
+
}); });
|
|
28269
|
+
setChartTypeOptions(chartTypeOptions);
|
|
28270
|
+
var filteredVersions = getFilteredChartVersions(charts, chartTypeOptions[0]);
|
|
28271
|
+
selectFirstChartVersion(filteredVersions);
|
|
28272
|
+
})
|
|
28273
|
+
.catch(function (err) {
|
|
28274
|
+
showError(err);
|
|
28275
|
+
});
|
|
28276
|
+
}, []);
|
|
28277
|
+
var selectFirstChartVersion = function (filteredVersions) {
|
|
28278
|
+
var _a;
|
|
28279
|
+
setChartVersionOptions(filteredVersions);
|
|
28280
|
+
setSelectedChartVersion(filteredVersions[0]); // Select the first chart version by default
|
|
28281
|
+
setSelectedChartRefId((_a = filteredVersions[0]) === null || _a === void 0 ? void 0 : _a.chartRefId);
|
|
28282
|
+
};
|
|
28283
|
+
// Function to update chart version options based on selected chart type
|
|
28284
|
+
var handleChartTypeChange = function (selectedOption) {
|
|
28285
|
+
setSelectedChartType(selectedOption);
|
|
28286
|
+
var filteredVersions = getFilteredChartVersions(charts, selectedOption);
|
|
28287
|
+
selectFirstChartVersion(filteredVersions);
|
|
28288
|
+
};
|
|
28289
|
+
// Function to handle the change of the selected chart version
|
|
28290
|
+
var handleChartVersionChange = function (selectedOption) {
|
|
28291
|
+
setSelectedChartVersion(selectedOption);
|
|
28292
|
+
setSelectedChartRefId(selectedOption.chartRefId);
|
|
28293
|
+
};
|
|
28294
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "chart-type-options flex", "data-testid": "chart-type-options" }, { children: [jsxRuntime.jsx("span", __assign({ className: "chart-type-options-label mr-4" }, { children: "Chart Type" })), jsxRuntime.jsx(ReactSelect, { value: selectedChartType !== null && selectedChartType !== void 0 ? selectedChartType : chartTypeOptions[0], options: chartTypeOptions, onChange: handleChartTypeChange, styles: customStyles })] })), jsxRuntime.jsxs("div", __assign({ className: "chart-version-options flex", "data-testid": "chart-version-options" }, { children: [jsxRuntime.jsx("span", __assign({ className: "chart-version-options-label mr-4" }, { children: "Chart Version" })), jsxRuntime.jsx(ReactSelect, { value: selectedChartVersion !== null && selectedChartVersion !== void 0 ? selectedChartVersion : chartVersionOptions[0], options: chartVersionOptions, onChange: handleChartVersionChange, styles: customStyles })] }))] })));
|
|
28295
|
+
};
|
|
28296
|
+
|
|
26654
28297
|
function TooltipContent(_a) {
|
|
26655
28298
|
var tooltipContent = _a.tooltipContent;
|
|
26656
28299
|
if (tooltipContent) {
|
|
@@ -26694,7 +28337,7 @@ var handleAddCD = function (_a) {
|
|
|
26694
28337
|
};
|
|
26695
28338
|
|
|
26696
28339
|
function CustomInput(_a) {
|
|
26697
|
-
var name = _a.name, value = _a.value, error = _a.error, onChange = _a.onChange, _b = _a.onFocus, onFocus = _b === void 0 ? function (e) { } : _b, label = _a.label, _c = _a.type, type = _c === void 0 ? 'text' : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.labelClassName, labelClassName = _e === void 0 ? '' : _e, _f = _a.placeholder, placeholder = _f === void 0 ? '' : _f, _g = _a.tabIndex, tabIndex = _g === void 0 ? 1 : _g, _h = _a.dataTestid, dataTestid = _h === void 0 ? '' : _h, _j = _a.isRequiredField, isRequiredField = _j === void 0 ? false : _j, _k = _a.autoFocus, autoFocus = _k === void 0 ? false : _k, _l = _a.rootClassName, rootClassName = _l === void 0 ? '' : _l, _m = _a.autoComplete, autoComplete = _m === void 0 ? 'off' : _m, _o = _a.helperText, helperText = _o === void 0 ? '' : _o, handleOnBlur = _a.handleOnBlur, _p = _a.readOnly, readOnly = _p === void 0 ? false : _p, _q = _a.noTrim, noTrim = _q === void 0 ? false : _q, ref = _a.ref, onKeyPress = _a.onKeyPress, defaultValue = _a.defaultValue, onKeyDown = _a.onKeyDown, required = _a.required, additionalErrorInfo = _a.additionalErrorInfo;
|
|
28340
|
+
var name = _a.name, value = _a.value, error = _a.error, onChange = _a.onChange, _b = _a.onFocus, onFocus = _b === void 0 ? function (e) { } : _b, label = _a.label, _c = _a.type, type = _c === void 0 ? 'text' : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.labelClassName, labelClassName = _e === void 0 ? '' : _e, _f = _a.placeholder, placeholder = _f === void 0 ? '' : _f, _g = _a.tabIndex, tabIndex = _g === void 0 ? 1 : _g, _h = _a.dataTestid, dataTestid = _h === void 0 ? '' : _h, _j = _a.isRequiredField, isRequiredField = _j === void 0 ? false : _j, _k = _a.autoFocus, autoFocus = _k === void 0 ? false : _k, _l = _a.rootClassName, rootClassName = _l === void 0 ? '' : _l, _m = _a.autoComplete, autoComplete = _m === void 0 ? 'off' : _m, _o = _a.helperText, helperText = _o === void 0 ? '' : _o, handleOnBlur = _a.handleOnBlur, _p = _a.readOnly, readOnly = _p === void 0 ? false : _p, _q = _a.noTrim, noTrim = _q === void 0 ? false : _q, ref = _a.ref, onKeyPress = _a.onKeyPress, defaultValue = _a.defaultValue, onKeyDown = _a.onKeyDown, required = _a.required, additionalErrorInfo = _a.additionalErrorInfo, _r = _a.inputWrapClassname, inputWrapClassname = _r === void 0 ? '' : _r;
|
|
26698
28341
|
function handleError(error) {
|
|
26699
28342
|
if (!Array.isArray(error)) {
|
|
26700
28343
|
return [error];
|
|
@@ -26743,7 +28386,7 @@ function CustomInput(_a) {
|
|
|
26743
28386
|
return (jsxRuntime.jsx("label", __assign({ className: "form__label ".concat(labelClassName), "data-testid": "label-".concat(dataTestid) }, { children: renderInputLabelConditionally() })));
|
|
26744
28387
|
}
|
|
26745
28388
|
};
|
|
26746
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flex column left top" }, { children: [renderInputLabel(), jsxRuntime.jsx("input", { "data-testid": dataTestid, type: type, name: name, autoComplete: autoComplete, className: "form__input ".concat(rootClassName), onChange: function (e) {
|
|
28389
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex column left top ".concat(inputWrapClassname) }, { children: [renderInputLabel(), jsxRuntime.jsx("input", { "data-testid": dataTestid, type: type, name: name, autoComplete: autoComplete, className: "form__input ".concat(rootClassName), onChange: function (e) {
|
|
26747
28390
|
e.persist();
|
|
26748
28391
|
onChange(e);
|
|
26749
28392
|
}, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, value: value, disabled: disabled, tabIndex: tabIndex, autoFocus: autoFocus, readOnly: readOnly, ref: ref, onKeyPress: onKeyPress, defaultValue: defaultValue, onKeyDown: onKeyDown, required: required }), getInputError(), helperText && (jsxRuntime.jsxs("div", __assign({ className: "form__text-field-info" }, { children: [jsxRuntime.jsx(SvgIcInfoFilled, { className: "form__icon form__icon--info" }), jsxRuntime.jsx("p", __assign({ className: "sentence-case" }, { children: helperText }))] })))] })));
|
|
@@ -26755,6 +28398,7 @@ exports.BreadCrumb = BreadCrumb;
|
|
|
26755
28398
|
exports.BreadcrumbStore = Store;
|
|
26756
28399
|
exports.BuildStageVariable = BuildStageVariable;
|
|
26757
28400
|
exports.CDModalTab = CDModalTab;
|
|
28401
|
+
exports.ChartVersionAndTypeSelector = ChartVersionAndTypeSelector;
|
|
26758
28402
|
exports.Checkbox = Checkbox$1;
|
|
26759
28403
|
exports.ClearIndicator = ClearIndicator;
|
|
26760
28404
|
exports.ClipboardButton = ClipboardButton;
|
|
@@ -26827,17 +28471,22 @@ exports.VisibleModal2 = VisibleModal2;
|
|
|
26827
28471
|
exports.closeOnEscKeyPressed = closeOnEscKeyPressed;
|
|
26828
28472
|
exports.copyToClipboard = copyToClipboard;
|
|
26829
28473
|
exports.createGitCommitUrl = createGitCommitUrl;
|
|
28474
|
+
exports.customStyles = customStyles;
|
|
26830
28475
|
exports.extractImage = extractImage;
|
|
28476
|
+
exports.fetchChartTemplateVersions = fetchChartTemplateVersions;
|
|
26831
28477
|
exports.genericCDMaterialsService = genericCDMaterialsService;
|
|
26832
28478
|
exports.get = get;
|
|
26833
28479
|
exports.getAlphabetIcon = getAlphabetIcon;
|
|
26834
28480
|
exports.getCookie = getCookie;
|
|
26835
28481
|
exports.getEmptyArrayOfLength = getEmptyArrayOfLength;
|
|
28482
|
+
exports.getFilteredChartVersions = getFilteredChartVersions;
|
|
26836
28483
|
exports.getInferredTypeFromValueType = getInferredTypeFromValueType;
|
|
28484
|
+
exports.getLockedJSON = getLockedJSON;
|
|
26837
28485
|
exports.getLoginInfo = getLoginInfo;
|
|
26838
28486
|
exports.getRandomColor = getRandomColor;
|
|
26839
28487
|
exports.getRedirectionProps = getRedirectionProps;
|
|
26840
28488
|
exports.getTeamListMin = getTeamListMin;
|
|
28489
|
+
exports.getUnlockedJSON = getUnlockedJSON;
|
|
26841
28490
|
exports.getUrlWithSearchParams = getUrlWithSearchParams;
|
|
26842
28491
|
exports.getUserRole = getUserRole;
|
|
26843
28492
|
exports.handleAddCD = handleAddCD;
|