@devtron-labs/devtron-fe-common-lib 0.0.47-beta-5 → 0.0.48
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/AddCDButton/AddCDButton.d.ts +3 -0
- package/dist/Common/AddCDButton/index.d.ts +2 -0
- package/dist/Common/AddCDButton/types.d.ts +26 -0
- package/dist/Common/AddCDButton/utils.d.ts +2 -0
- package/dist/Common/Common.service.d.ts +0 -1
- package/dist/Common/Constants.d.ts +0 -1
- package/dist/Common/Dialogs/Types.d.ts +1 -0
- package/dist/Common/Helper.d.ts +0 -9
- package/dist/Common/Types.d.ts +43 -60
- package/dist/Common/index.d.ts +1 -1
- package/dist/index.js +86 -1646
- package/package.json +1 -3
- package/src/Common/AddCDButton/AddCDButton.tsx +68 -0
- package/src/Common/AddCDButton/index.ts +2 -0
- package/src/Common/AddCDButton/types.ts +38 -0
- package/src/Common/AddCDButton/utils.tsx +35 -0
- package/src/Common/Common.service.ts +0 -4
- package/src/Common/Constants.ts +1 -2
- package/src/Common/Dialogs/DeleteDialog.tsx +1 -1
- package/src/Common/Dialogs/Types.ts +1 -0
- package/src/Common/Helper.tsx +0 -98
- package/src/Common/Types.ts +49 -63
- package/src/Common/index.ts +1 -1
- package/dist/Common/ChartVersionAndTypeSelector.d.ts +0 -4
- package/src/Common/ChartVersionAndTypeSelector.tsx +0 -78
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ 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');
|
|
8
7
|
var RJSF = require('@rjsf/core');
|
|
9
8
|
var RJSFValidator = require('@rjsf/validator-ajv8');
|
|
10
9
|
var utils = require('@rjsf/utils');
|
|
@@ -48,8 +47,7 @@ var ROUTES = {
|
|
|
48
47
|
PROJECT_LIST_MIN: 'team/autocomplete',
|
|
49
48
|
USER_CHECK_ROLE: 'user/check/roles',
|
|
50
49
|
IMAGE_TAGGING: 'app/image-tagging',
|
|
51
|
-
CD_MATERIAL_GET: 'app/cd-pipeline'
|
|
52
|
-
DEPLOYMENT_TEMPLATE_LIST: 'app/template/list'
|
|
50
|
+
CD_MATERIAL_GET: 'app/cd-pipeline'
|
|
53
51
|
};
|
|
54
52
|
exports.KEY_VALUE = void 0;
|
|
55
53
|
(function (KEY_VALUE) {
|
|
@@ -281,7 +279,7 @@ var extendStatics = function(d, b) {
|
|
|
281
279
|
return extendStatics(d, b);
|
|
282
280
|
};
|
|
283
281
|
|
|
284
|
-
function __extends
|
|
282
|
+
function __extends(d, b) {
|
|
285
283
|
if (typeof b !== "function" && b !== null)
|
|
286
284
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
287
285
|
extendStatics(d, b);
|
|
@@ -387,7 +385,7 @@ var ServerError = /** @class */ (function () {
|
|
|
387
385
|
return ServerError;
|
|
388
386
|
}());
|
|
389
387
|
var ServerErrors = /** @class */ (function (_super) {
|
|
390
|
-
__extends
|
|
388
|
+
__extends(ServerErrors, _super);
|
|
391
389
|
function ServerErrors(obj) {
|
|
392
390
|
var _this = _super.call(this) || this;
|
|
393
391
|
_this.code = obj.code;
|
|
@@ -465,7 +463,33 @@ exports.FilterConditionType = void 0;
|
|
|
465
463
|
(function (FilterConditionType) {
|
|
466
464
|
FilterConditionType[FilterConditionType["PASS"] = 1] = "PASS";
|
|
467
465
|
FilterConditionType[FilterConditionType["FAIL"] = 0] = "FAIL";
|
|
468
|
-
})(exports.FilterConditionType || (exports.FilterConditionType = {}));
|
|
466
|
+
})(exports.FilterConditionType || (exports.FilterConditionType = {}));
|
|
467
|
+
exports.PipelineType = void 0;
|
|
468
|
+
(function (PipelineType) {
|
|
469
|
+
PipelineType["CI_PIPELINE"] = "CI_PIPELINE";
|
|
470
|
+
PipelineType["CD_PIPELINE"] = "CD_PIPELINE";
|
|
471
|
+
PipelineType["WEBHOOK"] = "WEBHOOK";
|
|
472
|
+
PipelineType["LINKED_CD"] = "LINKED_CD";
|
|
473
|
+
})(exports.PipelineType || (exports.PipelineType = {}));
|
|
474
|
+
exports.WorkflowNodeType = void 0;
|
|
475
|
+
(function (WorkflowNodeType) {
|
|
476
|
+
WorkflowNodeType["GIT"] = "GIT";
|
|
477
|
+
WorkflowNodeType["CI"] = "CI";
|
|
478
|
+
WorkflowNodeType["WEBHOOK"] = "WEBHOOK";
|
|
479
|
+
WorkflowNodeType["PRE_CD"] = "PRECD";
|
|
480
|
+
WorkflowNodeType["CD"] = "CD";
|
|
481
|
+
WorkflowNodeType["POST_CD"] = "POSTCD";
|
|
482
|
+
})(exports.WorkflowNodeType || (exports.WorkflowNodeType = {}));
|
|
483
|
+
exports.AddCDPositions = void 0;
|
|
484
|
+
(function (AddCDPositions) {
|
|
485
|
+
AddCDPositions["LEFT"] = "left";
|
|
486
|
+
AddCDPositions["RIGHT"] = "right";
|
|
487
|
+
})(exports.AddCDPositions || (exports.AddCDPositions = {}));
|
|
488
|
+
exports.AddPipelineType = void 0;
|
|
489
|
+
(function (AddPipelineType) {
|
|
490
|
+
AddPipelineType["SEQUENTIAL"] = "SEQUENTIAL";
|
|
491
|
+
AddPipelineType["PARALLEL"] = "PARALLEL";
|
|
492
|
+
})(exports.AddPipelineType || (exports.AddPipelineType = {}));
|
|
469
493
|
|
|
470
494
|
var responseMessages = {
|
|
471
495
|
100: 'Continue',
|
|
@@ -2149,7 +2173,7 @@ eventManager.on(2
|
|
|
2149
2173
|
});
|
|
2150
2174
|
|
|
2151
2175
|
var ToastBody = /** @class */ (function (_super) {
|
|
2152
|
-
__extends
|
|
2176
|
+
__extends(ToastBody, _super);
|
|
2153
2177
|
function ToastBody() {
|
|
2154
2178
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2155
2179
|
}
|
|
@@ -2159,7 +2183,7 @@ var ToastBody = /** @class */ (function (_super) {
|
|
|
2159
2183
|
return ToastBody;
|
|
2160
2184
|
}(React.Component));
|
|
2161
2185
|
var ToastBody3 = /** @class */ (function (_super) {
|
|
2162
|
-
__extends
|
|
2186
|
+
__extends(ToastBody3, _super);
|
|
2163
2187
|
function ToastBody3() {
|
|
2164
2188
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2165
2189
|
}
|
|
@@ -2169,7 +2193,7 @@ var ToastBody3 = /** @class */ (function (_super) {
|
|
|
2169
2193
|
return ToastBody3;
|
|
2170
2194
|
}(React.Component));
|
|
2171
2195
|
var ToastBodyWithButton = /** @class */ (function (_super) {
|
|
2172
|
-
__extends
|
|
2196
|
+
__extends(ToastBodyWithButton, _super);
|
|
2173
2197
|
function ToastBodyWithButton() {
|
|
2174
2198
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2175
2199
|
}
|
|
@@ -2218,7 +2242,7 @@ function ErrorScreenNotFound() {
|
|
|
2218
2242
|
}
|
|
2219
2243
|
|
|
2220
2244
|
var ErrorScreenManager = /** @class */ (function (_super) {
|
|
2221
|
-
__extends
|
|
2245
|
+
__extends(ErrorScreenManager, _super);
|
|
2222
2246
|
function ErrorScreenManager() {
|
|
2223
2247
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2224
2248
|
}
|
|
@@ -2249,7 +2273,7 @@ var ErrorScreenManager = /** @class */ (function (_super) {
|
|
|
2249
2273
|
return ErrorScreenManager;
|
|
2250
2274
|
}(React.Component));
|
|
2251
2275
|
var ErrorScreenNotAuthorized = /** @class */ (function (_super) {
|
|
2252
|
-
__extends
|
|
2276
|
+
__extends(ErrorScreenNotAuthorized, _super);
|
|
2253
2277
|
function ErrorScreenNotAuthorized() {
|
|
2254
2278
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
2255
2279
|
}
|
|
@@ -9838,1506 +9862,6 @@ var moment$1 = {
|
|
|
9838
9862
|
|
|
9839
9863
|
var moment = momentExports;
|
|
9840
9864
|
|
|
9841
|
-
const {
|
|
9842
|
-
hasOwnProperty: hasOwnProp
|
|
9843
|
-
} = Object.prototype;
|
|
9844
|
-
/**
|
|
9845
|
-
* @typedef {null|boolean|number|string|PlainObject|GenericArray} JSONObject
|
|
9846
|
-
*/
|
|
9847
|
-
|
|
9848
|
-
/**
|
|
9849
|
-
* @typedef {any} AnyItem
|
|
9850
|
-
*/
|
|
9851
|
-
|
|
9852
|
-
/**
|
|
9853
|
-
* @typedef {any} AnyResult
|
|
9854
|
-
*/
|
|
9855
|
-
|
|
9856
|
-
/**
|
|
9857
|
-
* Copies array and then pushes item into it.
|
|
9858
|
-
* @param {GenericArray} arr Array to copy and into which to push
|
|
9859
|
-
* @param {AnyItem} item Array item to add (to end)
|
|
9860
|
-
* @returns {GenericArray} Copy of the original array
|
|
9861
|
-
*/
|
|
9862
|
-
|
|
9863
|
-
function push(arr, item) {
|
|
9864
|
-
arr = arr.slice();
|
|
9865
|
-
arr.push(item);
|
|
9866
|
-
return arr;
|
|
9867
|
-
}
|
|
9868
|
-
/**
|
|
9869
|
-
* Copies array and then unshifts item into it.
|
|
9870
|
-
* @param {AnyItem} item Array item to add (to beginning)
|
|
9871
|
-
* @param {GenericArray} arr Array to copy and into which to unshift
|
|
9872
|
-
* @returns {GenericArray} Copy of the original array
|
|
9873
|
-
*/
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
function unshift(item, arr) {
|
|
9877
|
-
arr = arr.slice();
|
|
9878
|
-
arr.unshift(item);
|
|
9879
|
-
return arr;
|
|
9880
|
-
}
|
|
9881
|
-
/**
|
|
9882
|
-
* Caught when JSONPath is used without `new` but rethrown if with `new`
|
|
9883
|
-
* @extends Error
|
|
9884
|
-
*/
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
class NewError extends Error {
|
|
9888
|
-
/**
|
|
9889
|
-
* @param {AnyResult} value The evaluated scalar value
|
|
9890
|
-
*/
|
|
9891
|
-
constructor(value) {
|
|
9892
|
-
super('JSONPath should not be called with "new" (it prevents return ' + 'of (unwrapped) scalar values)');
|
|
9893
|
-
this.avoidNew = true;
|
|
9894
|
-
this.value = value;
|
|
9895
|
-
this.name = 'NewError';
|
|
9896
|
-
}
|
|
9897
|
-
|
|
9898
|
-
}
|
|
9899
|
-
/**
|
|
9900
|
-
* @typedef {PlainObject} ReturnObject
|
|
9901
|
-
* @property {string} path
|
|
9902
|
-
* @property {JSONObject} value
|
|
9903
|
-
* @property {PlainObject|GenericArray} parent
|
|
9904
|
-
* @property {string} parentProperty
|
|
9905
|
-
*/
|
|
9906
|
-
|
|
9907
|
-
/**
|
|
9908
|
-
* @callback JSONPathCallback
|
|
9909
|
-
* @param {string|PlainObject} preferredOutput
|
|
9910
|
-
* @param {"value"|"property"} type
|
|
9911
|
-
* @param {ReturnObject} fullRetObj
|
|
9912
|
-
* @returns {void}
|
|
9913
|
-
*/
|
|
9914
|
-
|
|
9915
|
-
/**
|
|
9916
|
-
* @callback OtherTypeCallback
|
|
9917
|
-
* @param {JSONObject} val
|
|
9918
|
-
* @param {string} path
|
|
9919
|
-
* @param {PlainObject|GenericArray} parent
|
|
9920
|
-
* @param {string} parentPropName
|
|
9921
|
-
* @returns {boolean}
|
|
9922
|
-
*/
|
|
9923
|
-
|
|
9924
|
-
/* eslint-disable max-len -- Can make multiline type after https://github.com/syavorsky/comment-parser/issues/109 */
|
|
9925
|
-
|
|
9926
|
-
/**
|
|
9927
|
-
* @typedef {PlainObject} JSONPathOptions
|
|
9928
|
-
* @property {JSON} json
|
|
9929
|
-
* @property {string|string[]} path
|
|
9930
|
-
* @property {"value"|"path"|"pointer"|"parent"|"parentProperty"|"all"} [resultType="value"]
|
|
9931
|
-
* @property {boolean} [flatten=false]
|
|
9932
|
-
* @property {boolean} [wrap=true]
|
|
9933
|
-
* @property {PlainObject} [sandbox={}]
|
|
9934
|
-
* @property {boolean} [preventEval=false]
|
|
9935
|
-
* @property {PlainObject|GenericArray|null} [parent=null]
|
|
9936
|
-
* @property {string|null} [parentProperty=null]
|
|
9937
|
-
* @property {JSONPathCallback} [callback]
|
|
9938
|
-
* @property {OtherTypeCallback} [otherTypeCallback] Defaults to
|
|
9939
|
-
* function which throws on encountering `@other`
|
|
9940
|
-
* @property {boolean} [autostart=true]
|
|
9941
|
-
*/
|
|
9942
|
-
|
|
9943
|
-
/* eslint-enable max-len -- Can make multiline type after https://github.com/syavorsky/comment-parser/issues/109 */
|
|
9944
|
-
|
|
9945
|
-
/**
|
|
9946
|
-
* @param {string|JSONPathOptions} opts If a string, will be treated as `expr`
|
|
9947
|
-
* @param {string} [expr] JSON path to evaluate
|
|
9948
|
-
* @param {JSON} [obj] JSON object to evaluate against
|
|
9949
|
-
* @param {JSONPathCallback} [callback] Passed 3 arguments: 1) desired payload
|
|
9950
|
-
* per `resultType`, 2) `"value"|"property"`, 3) Full returned object with
|
|
9951
|
-
* all payloads
|
|
9952
|
-
* @param {OtherTypeCallback} [otherTypeCallback] If `@other()` is at the end
|
|
9953
|
-
* of one's query, this will be invoked with the value of the item, its
|
|
9954
|
-
* path, its parent, and its parent's property name, and it should return
|
|
9955
|
-
* a boolean indicating whether the supplied value belongs to the "other"
|
|
9956
|
-
* type or not (or it may handle transformations and return `false`).
|
|
9957
|
-
* @returns {JSONPath}
|
|
9958
|
-
* @class
|
|
9959
|
-
*/
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
function JSONPath(opts, expr, obj, callback, otherTypeCallback) {
|
|
9963
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
9964
|
-
if (!(this instanceof JSONPath)) {
|
|
9965
|
-
try {
|
|
9966
|
-
return new JSONPath(opts, expr, obj, callback, otherTypeCallback);
|
|
9967
|
-
} catch (e) {
|
|
9968
|
-
if (!e.avoidNew) {
|
|
9969
|
-
throw e;
|
|
9970
|
-
}
|
|
9971
|
-
|
|
9972
|
-
return e.value;
|
|
9973
|
-
}
|
|
9974
|
-
}
|
|
9975
|
-
|
|
9976
|
-
if (typeof opts === 'string') {
|
|
9977
|
-
otherTypeCallback = callback;
|
|
9978
|
-
callback = obj;
|
|
9979
|
-
obj = expr;
|
|
9980
|
-
expr = opts;
|
|
9981
|
-
opts = null;
|
|
9982
|
-
}
|
|
9983
|
-
|
|
9984
|
-
const optObj = opts && typeof opts === 'object';
|
|
9985
|
-
opts = opts || {};
|
|
9986
|
-
this.json = opts.json || obj;
|
|
9987
|
-
this.path = opts.path || expr;
|
|
9988
|
-
this.resultType = opts.resultType || 'value';
|
|
9989
|
-
this.flatten = opts.flatten || false;
|
|
9990
|
-
this.wrap = hasOwnProp.call(opts, 'wrap') ? opts.wrap : true;
|
|
9991
|
-
this.sandbox = opts.sandbox || {};
|
|
9992
|
-
this.preventEval = opts.preventEval || false;
|
|
9993
|
-
this.parent = opts.parent || null;
|
|
9994
|
-
this.parentProperty = opts.parentProperty || null;
|
|
9995
|
-
this.callback = opts.callback || callback || null;
|
|
9996
|
-
|
|
9997
|
-
this.otherTypeCallback = opts.otherTypeCallback || otherTypeCallback || function () {
|
|
9998
|
-
throw new TypeError('You must supply an otherTypeCallback callback option ' + 'with the @other() operator.');
|
|
9999
|
-
};
|
|
10000
|
-
|
|
10001
|
-
if (opts.autostart !== false) {
|
|
10002
|
-
const args = {
|
|
10003
|
-
path: optObj ? opts.path : expr
|
|
10004
|
-
};
|
|
10005
|
-
|
|
10006
|
-
if (!optObj) {
|
|
10007
|
-
args.json = obj;
|
|
10008
|
-
} else if ('json' in opts) {
|
|
10009
|
-
args.json = opts.json;
|
|
10010
|
-
}
|
|
10011
|
-
|
|
10012
|
-
const ret = this.evaluate(args);
|
|
10013
|
-
|
|
10014
|
-
if (!ret || typeof ret !== 'object') {
|
|
10015
|
-
throw new NewError(ret);
|
|
10016
|
-
}
|
|
10017
|
-
|
|
10018
|
-
return ret;
|
|
10019
|
-
}
|
|
10020
|
-
} // PUBLIC METHODS
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
JSONPath.prototype.evaluate = function (expr, json, callback, otherTypeCallback) {
|
|
10024
|
-
let currParent = this.parent,
|
|
10025
|
-
currParentProperty = this.parentProperty;
|
|
10026
|
-
let {
|
|
10027
|
-
flatten,
|
|
10028
|
-
wrap
|
|
10029
|
-
} = this;
|
|
10030
|
-
this.currResultType = this.resultType;
|
|
10031
|
-
this.currPreventEval = this.preventEval;
|
|
10032
|
-
this.currSandbox = this.sandbox;
|
|
10033
|
-
callback = callback || this.callback;
|
|
10034
|
-
this.currOtherTypeCallback = otherTypeCallback || this.otherTypeCallback;
|
|
10035
|
-
json = json || this.json;
|
|
10036
|
-
expr = expr || this.path;
|
|
10037
|
-
|
|
10038
|
-
if (expr && typeof expr === 'object' && !Array.isArray(expr)) {
|
|
10039
|
-
if (!expr.path && expr.path !== '') {
|
|
10040
|
-
throw new TypeError('You must supply a "path" property when providing an object ' + 'argument to JSONPath.evaluate().');
|
|
10041
|
-
}
|
|
10042
|
-
|
|
10043
|
-
if (!hasOwnProp.call(expr, 'json')) {
|
|
10044
|
-
throw new TypeError('You must supply a "json" property when providing an object ' + 'argument to JSONPath.evaluate().');
|
|
10045
|
-
}
|
|
10046
|
-
|
|
10047
|
-
({
|
|
10048
|
-
json
|
|
10049
|
-
} = expr);
|
|
10050
|
-
flatten = hasOwnProp.call(expr, 'flatten') ? expr.flatten : flatten;
|
|
10051
|
-
this.currResultType = hasOwnProp.call(expr, 'resultType') ? expr.resultType : this.currResultType;
|
|
10052
|
-
this.currSandbox = hasOwnProp.call(expr, 'sandbox') ? expr.sandbox : this.currSandbox;
|
|
10053
|
-
wrap = hasOwnProp.call(expr, 'wrap') ? expr.wrap : wrap;
|
|
10054
|
-
this.currPreventEval = hasOwnProp.call(expr, 'preventEval') ? expr.preventEval : this.currPreventEval;
|
|
10055
|
-
callback = hasOwnProp.call(expr, 'callback') ? expr.callback : callback;
|
|
10056
|
-
this.currOtherTypeCallback = hasOwnProp.call(expr, 'otherTypeCallback') ? expr.otherTypeCallback : this.currOtherTypeCallback;
|
|
10057
|
-
currParent = hasOwnProp.call(expr, 'parent') ? expr.parent : currParent;
|
|
10058
|
-
currParentProperty = hasOwnProp.call(expr, 'parentProperty') ? expr.parentProperty : currParentProperty;
|
|
10059
|
-
expr = expr.path;
|
|
10060
|
-
}
|
|
10061
|
-
|
|
10062
|
-
currParent = currParent || null;
|
|
10063
|
-
currParentProperty = currParentProperty || null;
|
|
10064
|
-
|
|
10065
|
-
if (Array.isArray(expr)) {
|
|
10066
|
-
expr = JSONPath.toPathString(expr);
|
|
10067
|
-
}
|
|
10068
|
-
|
|
10069
|
-
if (!expr && expr !== '' || !json) {
|
|
10070
|
-
return undefined;
|
|
10071
|
-
}
|
|
10072
|
-
|
|
10073
|
-
const exprList = JSONPath.toPathArray(expr);
|
|
10074
|
-
|
|
10075
|
-
if (exprList[0] === '$' && exprList.length > 1) {
|
|
10076
|
-
exprList.shift();
|
|
10077
|
-
}
|
|
10078
|
-
|
|
10079
|
-
this._hasParentSelector = null;
|
|
10080
|
-
|
|
10081
|
-
const result = this._trace(exprList, json, ['$'], currParent, currParentProperty, callback).filter(function (ea) {
|
|
10082
|
-
return ea && !ea.isParentSelector;
|
|
10083
|
-
});
|
|
10084
|
-
|
|
10085
|
-
if (!result.length) {
|
|
10086
|
-
return wrap ? [] : undefined;
|
|
10087
|
-
}
|
|
10088
|
-
|
|
10089
|
-
if (!wrap && result.length === 1 && !result[0].hasArrExpr) {
|
|
10090
|
-
return this._getPreferredOutput(result[0]);
|
|
10091
|
-
}
|
|
10092
|
-
|
|
10093
|
-
return result.reduce((rslt, ea) => {
|
|
10094
|
-
const valOrPath = this._getPreferredOutput(ea);
|
|
10095
|
-
|
|
10096
|
-
if (flatten && Array.isArray(valOrPath)) {
|
|
10097
|
-
rslt = rslt.concat(valOrPath);
|
|
10098
|
-
} else {
|
|
10099
|
-
rslt.push(valOrPath);
|
|
10100
|
-
}
|
|
10101
|
-
|
|
10102
|
-
return rslt;
|
|
10103
|
-
}, []);
|
|
10104
|
-
}; // PRIVATE METHODS
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
JSONPath.prototype._getPreferredOutput = function (ea) {
|
|
10108
|
-
const resultType = this.currResultType;
|
|
10109
|
-
|
|
10110
|
-
switch (resultType) {
|
|
10111
|
-
case 'all':
|
|
10112
|
-
{
|
|
10113
|
-
const path = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);
|
|
10114
|
-
ea.pointer = JSONPath.toPointer(path);
|
|
10115
|
-
ea.path = typeof ea.path === 'string' ? ea.path : JSONPath.toPathString(ea.path);
|
|
10116
|
-
return ea;
|
|
10117
|
-
}
|
|
10118
|
-
|
|
10119
|
-
case 'value':
|
|
10120
|
-
case 'parent':
|
|
10121
|
-
case 'parentProperty':
|
|
10122
|
-
return ea[resultType];
|
|
10123
|
-
|
|
10124
|
-
case 'path':
|
|
10125
|
-
return JSONPath.toPathString(ea[resultType]);
|
|
10126
|
-
|
|
10127
|
-
case 'pointer':
|
|
10128
|
-
return JSONPath.toPointer(ea.path);
|
|
10129
|
-
|
|
10130
|
-
default:
|
|
10131
|
-
throw new TypeError('Unknown result type');
|
|
10132
|
-
}
|
|
10133
|
-
};
|
|
10134
|
-
|
|
10135
|
-
JSONPath.prototype._handleCallback = function (fullRetObj, callback, type) {
|
|
10136
|
-
if (callback) {
|
|
10137
|
-
const preferredOutput = this._getPreferredOutput(fullRetObj);
|
|
10138
|
-
|
|
10139
|
-
fullRetObj.path = typeof fullRetObj.path === 'string' ? fullRetObj.path : JSONPath.toPathString(fullRetObj.path); // eslint-disable-next-line n/callback-return
|
|
10140
|
-
|
|
10141
|
-
callback(preferredOutput, type, fullRetObj);
|
|
10142
|
-
}
|
|
10143
|
-
};
|
|
10144
|
-
/**
|
|
10145
|
-
*
|
|
10146
|
-
* @param {string} expr
|
|
10147
|
-
* @param {JSONObject} val
|
|
10148
|
-
* @param {string} path
|
|
10149
|
-
* @param {PlainObject|GenericArray} parent
|
|
10150
|
-
* @param {string} parentPropName
|
|
10151
|
-
* @param {JSONPathCallback} callback
|
|
10152
|
-
* @param {boolean} hasArrExpr
|
|
10153
|
-
* @param {boolean} literalPriority
|
|
10154
|
-
* @returns {ReturnObject|ReturnObject[]}
|
|
10155
|
-
*/
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {
|
|
10159
|
-
// No expr to follow? return path and value as the result of
|
|
10160
|
-
// this trace branch
|
|
10161
|
-
let retObj;
|
|
10162
|
-
|
|
10163
|
-
if (!expr.length) {
|
|
10164
|
-
retObj = {
|
|
10165
|
-
path,
|
|
10166
|
-
value: val,
|
|
10167
|
-
parent,
|
|
10168
|
-
parentProperty: parentPropName,
|
|
10169
|
-
hasArrExpr
|
|
10170
|
-
};
|
|
10171
|
-
|
|
10172
|
-
this._handleCallback(retObj, callback, 'value');
|
|
10173
|
-
|
|
10174
|
-
return retObj;
|
|
10175
|
-
}
|
|
10176
|
-
|
|
10177
|
-
const loc = expr[0],
|
|
10178
|
-
x = expr.slice(1); // We need to gather the return value of recursive trace calls in order to
|
|
10179
|
-
// do the parent sel computation.
|
|
10180
|
-
|
|
10181
|
-
const ret = [];
|
|
10182
|
-
/**
|
|
10183
|
-
*
|
|
10184
|
-
* @param {ReturnObject|ReturnObject[]} elems
|
|
10185
|
-
* @returns {void}
|
|
10186
|
-
*/
|
|
10187
|
-
|
|
10188
|
-
function addRet(elems) {
|
|
10189
|
-
if (Array.isArray(elems)) {
|
|
10190
|
-
// This was causing excessive stack size in Node (with or
|
|
10191
|
-
// without Babel) against our performance test:
|
|
10192
|
-
// `ret.push(...elems);`
|
|
10193
|
-
elems.forEach(t => {
|
|
10194
|
-
ret.push(t);
|
|
10195
|
-
});
|
|
10196
|
-
} else {
|
|
10197
|
-
ret.push(elems);
|
|
10198
|
-
}
|
|
10199
|
-
}
|
|
10200
|
-
|
|
10201
|
-
if ((typeof loc !== 'string' || literalPriority) && val && hasOwnProp.call(val, loc)) {
|
|
10202
|
-
// simple case--directly follow property
|
|
10203
|
-
addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr)); // eslint-disable-next-line unicorn/prefer-switch -- Part of larger `if`
|
|
10204
|
-
} else if (loc === '*') {
|
|
10205
|
-
// all child properties
|
|
10206
|
-
this._walk(val, m => {
|
|
10207
|
-
addRet(this._trace(x, val[m], push(path, m), val, m, callback, true, true));
|
|
10208
|
-
});
|
|
10209
|
-
} else if (loc === '..') {
|
|
10210
|
-
// all descendent parent properties
|
|
10211
|
-
// Check remaining expression with val's immediate children
|
|
10212
|
-
addRet(this._trace(x, val, path, parent, parentPropName, callback, hasArrExpr));
|
|
10213
|
-
|
|
10214
|
-
this._walk(val, m => {
|
|
10215
|
-
// We don't join m and x here because we only want parents,
|
|
10216
|
-
// not scalar values
|
|
10217
|
-
if (typeof val[m] === 'object') {
|
|
10218
|
-
// Keep going with recursive descent on val's
|
|
10219
|
-
// object children
|
|
10220
|
-
addRet(this._trace(expr.slice(), val[m], push(path, m), val, m, callback, true));
|
|
10221
|
-
}
|
|
10222
|
-
}); // The parent sel computation is handled in the frame above using the
|
|
10223
|
-
// ancestor object of val
|
|
10224
|
-
|
|
10225
|
-
} else if (loc === '^') {
|
|
10226
|
-
// This is not a final endpoint, so we do not invoke the callback here
|
|
10227
|
-
this._hasParentSelector = true;
|
|
10228
|
-
return {
|
|
10229
|
-
path: path.slice(0, -1),
|
|
10230
|
-
expr: x,
|
|
10231
|
-
isParentSelector: true
|
|
10232
|
-
};
|
|
10233
|
-
} else if (loc === '~') {
|
|
10234
|
-
// property name
|
|
10235
|
-
retObj = {
|
|
10236
|
-
path: push(path, loc),
|
|
10237
|
-
value: parentPropName,
|
|
10238
|
-
parent,
|
|
10239
|
-
parentProperty: null
|
|
10240
|
-
};
|
|
10241
|
-
|
|
10242
|
-
this._handleCallback(retObj, callback, 'property');
|
|
10243
|
-
|
|
10244
|
-
return retObj;
|
|
10245
|
-
} else if (loc === '$') {
|
|
10246
|
-
// root only
|
|
10247
|
-
addRet(this._trace(x, val, path, null, null, callback, hasArrExpr));
|
|
10248
|
-
} else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(loc)) {
|
|
10249
|
-
// [start:end:step] Python slice syntax
|
|
10250
|
-
addRet(this._slice(loc, x, val, path, parent, parentPropName, callback));
|
|
10251
|
-
} else if (loc.indexOf('?(') === 0) {
|
|
10252
|
-
// [?(expr)] (filtering)
|
|
10253
|
-
if (this.currPreventEval) {
|
|
10254
|
-
throw new Error('Eval [?(expr)] prevented in JSONPath expression.');
|
|
10255
|
-
}
|
|
10256
|
-
|
|
10257
|
-
const safeLoc = loc.replace(/^\?\((.*?)\)$/u, '$1');
|
|
10258
|
-
|
|
10259
|
-
this._walk(val, m => {
|
|
10260
|
-
if (this._eval(safeLoc, val[m], m, path, parent, parentPropName)) {
|
|
10261
|
-
addRet(this._trace(x, val[m], push(path, m), val, m, callback, true));
|
|
10262
|
-
}
|
|
10263
|
-
});
|
|
10264
|
-
} else if (loc[0] === '(') {
|
|
10265
|
-
// [(expr)] (dynamic property/index)
|
|
10266
|
-
if (this.currPreventEval) {
|
|
10267
|
-
throw new Error('Eval [(expr)] prevented in JSONPath expression.');
|
|
10268
|
-
} // As this will resolve to a property name (but we don't know it
|
|
10269
|
-
// yet), property and parent information is relative to the
|
|
10270
|
-
// parent of the property to which this expression will resolve
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
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));
|
|
10274
|
-
} else if (loc[0] === '@') {
|
|
10275
|
-
// value type: @boolean(), etc.
|
|
10276
|
-
let addType = false;
|
|
10277
|
-
const valueType = loc.slice(1, -2);
|
|
10278
|
-
|
|
10279
|
-
switch (valueType) {
|
|
10280
|
-
case 'scalar':
|
|
10281
|
-
if (!val || !['object', 'function'].includes(typeof val)) {
|
|
10282
|
-
addType = true;
|
|
10283
|
-
}
|
|
10284
|
-
|
|
10285
|
-
break;
|
|
10286
|
-
|
|
10287
|
-
case 'boolean':
|
|
10288
|
-
case 'string':
|
|
10289
|
-
case 'undefined':
|
|
10290
|
-
case 'function':
|
|
10291
|
-
// eslint-disable-next-line valid-typeof
|
|
10292
|
-
if (typeof val === valueType) {
|
|
10293
|
-
addType = true;
|
|
10294
|
-
}
|
|
10295
|
-
|
|
10296
|
-
break;
|
|
10297
|
-
|
|
10298
|
-
case 'integer':
|
|
10299
|
-
if (Number.isFinite(val) && !(val % 1)) {
|
|
10300
|
-
addType = true;
|
|
10301
|
-
}
|
|
10302
|
-
|
|
10303
|
-
break;
|
|
10304
|
-
|
|
10305
|
-
case 'number':
|
|
10306
|
-
if (Number.isFinite(val)) {
|
|
10307
|
-
addType = true;
|
|
10308
|
-
}
|
|
10309
|
-
|
|
10310
|
-
break;
|
|
10311
|
-
|
|
10312
|
-
case 'nonFinite':
|
|
10313
|
-
if (typeof val === 'number' && !Number.isFinite(val)) {
|
|
10314
|
-
addType = true;
|
|
10315
|
-
}
|
|
10316
|
-
|
|
10317
|
-
break;
|
|
10318
|
-
|
|
10319
|
-
case 'object':
|
|
10320
|
-
// eslint-disable-next-line valid-typeof
|
|
10321
|
-
if (val && typeof val === valueType) {
|
|
10322
|
-
addType = true;
|
|
10323
|
-
}
|
|
10324
|
-
|
|
10325
|
-
break;
|
|
10326
|
-
|
|
10327
|
-
case 'array':
|
|
10328
|
-
if (Array.isArray(val)) {
|
|
10329
|
-
addType = true;
|
|
10330
|
-
}
|
|
10331
|
-
|
|
10332
|
-
break;
|
|
10333
|
-
|
|
10334
|
-
case 'other':
|
|
10335
|
-
addType = this.currOtherTypeCallback(val, path, parent, parentPropName);
|
|
10336
|
-
break;
|
|
10337
|
-
|
|
10338
|
-
case 'null':
|
|
10339
|
-
if (val === null) {
|
|
10340
|
-
addType = true;
|
|
10341
|
-
}
|
|
10342
|
-
|
|
10343
|
-
break;
|
|
10344
|
-
|
|
10345
|
-
/* c8 ignore next 2 */
|
|
10346
|
-
|
|
10347
|
-
default:
|
|
10348
|
-
throw new TypeError('Unknown value type ' + valueType);
|
|
10349
|
-
}
|
|
10350
|
-
|
|
10351
|
-
if (addType) {
|
|
10352
|
-
retObj = {
|
|
10353
|
-
path,
|
|
10354
|
-
value: val,
|
|
10355
|
-
parent,
|
|
10356
|
-
parentProperty: parentPropName
|
|
10357
|
-
};
|
|
10358
|
-
|
|
10359
|
-
this._handleCallback(retObj, callback, 'value');
|
|
10360
|
-
|
|
10361
|
-
return retObj;
|
|
10362
|
-
} // `-escaped property
|
|
10363
|
-
|
|
10364
|
-
} else if (loc[0] === '`' && val && hasOwnProp.call(val, loc.slice(1))) {
|
|
10365
|
-
const locProp = loc.slice(1);
|
|
10366
|
-
addRet(this._trace(x, val[locProp], push(path, locProp), val, locProp, callback, hasArrExpr, true));
|
|
10367
|
-
} else if (loc.includes(',')) {
|
|
10368
|
-
// [name1,name2,...]
|
|
10369
|
-
const parts = loc.split(',');
|
|
10370
|
-
|
|
10371
|
-
for (const part of parts) {
|
|
10372
|
-
addRet(this._trace(unshift(part, x), val, path, parent, parentPropName, callback, true));
|
|
10373
|
-
} // simple case--directly follow property
|
|
10374
|
-
|
|
10375
|
-
} else if (!literalPriority && val && hasOwnProp.call(val, loc)) {
|
|
10376
|
-
addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr, true));
|
|
10377
|
-
} // We check the resulting values for parent selections. For parent
|
|
10378
|
-
// selections we discard the value object and continue the trace with the
|
|
10379
|
-
// current val object
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
if (this._hasParentSelector) {
|
|
10383
|
-
for (let t = 0; t < ret.length; t++) {
|
|
10384
|
-
const rett = ret[t];
|
|
10385
|
-
|
|
10386
|
-
if (rett && rett.isParentSelector) {
|
|
10387
|
-
const tmp = this._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
|
|
10388
|
-
|
|
10389
|
-
if (Array.isArray(tmp)) {
|
|
10390
|
-
ret[t] = tmp[0];
|
|
10391
|
-
const tl = tmp.length;
|
|
10392
|
-
|
|
10393
|
-
for (let tt = 1; tt < tl; tt++) {
|
|
10394
|
-
t++;
|
|
10395
|
-
ret.splice(t, 0, tmp[tt]);
|
|
10396
|
-
}
|
|
10397
|
-
} else {
|
|
10398
|
-
ret[t] = tmp;
|
|
10399
|
-
}
|
|
10400
|
-
}
|
|
10401
|
-
}
|
|
10402
|
-
}
|
|
10403
|
-
|
|
10404
|
-
return ret;
|
|
10405
|
-
};
|
|
10406
|
-
|
|
10407
|
-
JSONPath.prototype._walk = function (val, f) {
|
|
10408
|
-
if (Array.isArray(val)) {
|
|
10409
|
-
const n = val.length;
|
|
10410
|
-
|
|
10411
|
-
for (let i = 0; i < n; i++) {
|
|
10412
|
-
f(i);
|
|
10413
|
-
}
|
|
10414
|
-
} else if (val && typeof val === 'object') {
|
|
10415
|
-
Object.keys(val).forEach(m => {
|
|
10416
|
-
f(m);
|
|
10417
|
-
});
|
|
10418
|
-
}
|
|
10419
|
-
};
|
|
10420
|
-
|
|
10421
|
-
JSONPath.prototype._slice = function (loc, expr, val, path, parent, parentPropName, callback) {
|
|
10422
|
-
if (!Array.isArray(val)) {
|
|
10423
|
-
return undefined;
|
|
10424
|
-
}
|
|
10425
|
-
|
|
10426
|
-
const len = val.length,
|
|
10427
|
-
parts = loc.split(':'),
|
|
10428
|
-
step = parts[2] && Number.parseInt(parts[2]) || 1;
|
|
10429
|
-
let start = parts[0] && Number.parseInt(parts[0]) || 0,
|
|
10430
|
-
end = parts[1] && Number.parseInt(parts[1]) || len;
|
|
10431
|
-
start = start < 0 ? Math.max(0, start + len) : Math.min(len, start);
|
|
10432
|
-
end = end < 0 ? Math.max(0, end + len) : Math.min(len, end);
|
|
10433
|
-
const ret = [];
|
|
10434
|
-
|
|
10435
|
-
for (let i = start; i < end; i += step) {
|
|
10436
|
-
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
|
|
10437
|
-
// ``unshift(i, expr)` passed in above would not be empty, nor `~`,
|
|
10438
|
-
// nor begin with `@` (as could return objects)
|
|
10439
|
-
// This was causing excessive stack size in Node (with or
|
|
10440
|
-
// without Babel) against our performance test: `ret.push(...tmp);`
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
tmp.forEach(t => {
|
|
10444
|
-
ret.push(t);
|
|
10445
|
-
});
|
|
10446
|
-
}
|
|
10447
|
-
|
|
10448
|
-
return ret;
|
|
10449
|
-
};
|
|
10450
|
-
|
|
10451
|
-
JSONPath.prototype._eval = function (code, _v, _vname, path, parent, parentPropName) {
|
|
10452
|
-
this.currSandbox._$_parentProperty = parentPropName;
|
|
10453
|
-
this.currSandbox._$_parent = parent;
|
|
10454
|
-
this.currSandbox._$_property = _vname;
|
|
10455
|
-
this.currSandbox._$_root = this.json;
|
|
10456
|
-
this.currSandbox._$_v = _v;
|
|
10457
|
-
const containsPath = code.includes('@path');
|
|
10458
|
-
|
|
10459
|
-
if (containsPath) {
|
|
10460
|
-
this.currSandbox._$_path = JSONPath.toPathString(path.concat([_vname]));
|
|
10461
|
-
}
|
|
10462
|
-
|
|
10463
|
-
const scriptCacheKey = 'script:' + code;
|
|
10464
|
-
|
|
10465
|
-
if (!JSONPath.cache[scriptCacheKey]) {
|
|
10466
|
-
let script = code.replace(/@parentProperty/gu, '_$_parentProperty').replace(/@parent/gu, '_$_parent').replace(/@property/gu, '_$_property').replace(/@root/gu, '_$_root').replace(/@([.\s)[])/gu, '_$_v$1');
|
|
10467
|
-
|
|
10468
|
-
if (containsPath) {
|
|
10469
|
-
script = script.replace(/@path/gu, '_$_path');
|
|
10470
|
-
}
|
|
10471
|
-
|
|
10472
|
-
JSONPath.cache[scriptCacheKey] = new this.vm.Script(script);
|
|
10473
|
-
}
|
|
10474
|
-
|
|
10475
|
-
try {
|
|
10476
|
-
return JSONPath.cache[scriptCacheKey].runInNewContext(this.currSandbox);
|
|
10477
|
-
} catch (e) {
|
|
10478
|
-
throw new Error('jsonPath: ' + e.message + ': ' + code);
|
|
10479
|
-
}
|
|
10480
|
-
}; // PUBLIC CLASS PROPERTIES AND METHODS
|
|
10481
|
-
// Could store the cache object itself
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
JSONPath.cache = {};
|
|
10485
|
-
/**
|
|
10486
|
-
* @param {string[]} pathArr Array to convert
|
|
10487
|
-
* @returns {string} The path string
|
|
10488
|
-
*/
|
|
10489
|
-
|
|
10490
|
-
JSONPath.toPathString = function (pathArr) {
|
|
10491
|
-
const x = pathArr,
|
|
10492
|
-
n = x.length;
|
|
10493
|
-
let p = '$';
|
|
10494
|
-
|
|
10495
|
-
for (let i = 1; i < n; i++) {
|
|
10496
|
-
if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
|
|
10497
|
-
p += /^[0-9*]+$/u.test(x[i]) ? '[' + x[i] + ']' : "['" + x[i] + "']";
|
|
10498
|
-
}
|
|
10499
|
-
}
|
|
10500
|
-
|
|
10501
|
-
return p;
|
|
10502
|
-
};
|
|
10503
|
-
/**
|
|
10504
|
-
* @param {string} pointer JSON Path
|
|
10505
|
-
* @returns {string} JSON Pointer
|
|
10506
|
-
*/
|
|
10507
|
-
|
|
10508
|
-
|
|
10509
|
-
JSONPath.toPointer = function (pointer) {
|
|
10510
|
-
const x = pointer,
|
|
10511
|
-
n = x.length;
|
|
10512
|
-
let p = '';
|
|
10513
|
-
|
|
10514
|
-
for (let i = 1; i < n; i++) {
|
|
10515
|
-
if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
|
|
10516
|
-
p += '/' + x[i].toString().replace(/~/gu, '~0').replace(/\//gu, '~1');
|
|
10517
|
-
}
|
|
10518
|
-
}
|
|
10519
|
-
|
|
10520
|
-
return p;
|
|
10521
|
-
};
|
|
10522
|
-
/**
|
|
10523
|
-
* @param {string} expr Expression to convert
|
|
10524
|
-
* @returns {string[]}
|
|
10525
|
-
*/
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
JSONPath.toPathArray = function (expr) {
|
|
10529
|
-
const {
|
|
10530
|
-
cache
|
|
10531
|
-
} = JSONPath;
|
|
10532
|
-
|
|
10533
|
-
if (cache[expr]) {
|
|
10534
|
-
return cache[expr].concat();
|
|
10535
|
-
}
|
|
10536
|
-
|
|
10537
|
-
const subx = [];
|
|
10538
|
-
const normalized = expr // Properties
|
|
10539
|
-
.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ';$&;') // Parenthetical evaluations (filtering and otherwise), directly
|
|
10540
|
-
// within brackets or single quotes
|
|
10541
|
-
.replace(/[['](\??\(.*?\))[\]']/gu, function ($0, $1) {
|
|
10542
|
-
return '[#' + (subx.push($1) - 1) + ']';
|
|
10543
|
-
}) // Escape periods and tildes within properties
|
|
10544
|
-
.replace(/\[['"]([^'\]]*)['"]\]/gu, function ($0, prop) {
|
|
10545
|
-
return "['" + prop.replace(/\./gu, '%@%').replace(/~/gu, '%%@@%%') + "']";
|
|
10546
|
-
}) // Properties operator
|
|
10547
|
-
.replace(/~/gu, ';~;') // Split by property boundaries
|
|
10548
|
-
.replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu, ';') // Reinsert periods within properties
|
|
10549
|
-
.replace(/%@%/gu, '.') // Reinsert tildes within properties
|
|
10550
|
-
.replace(/%%@@%%/gu, '~') // Parent
|
|
10551
|
-
.replace(/(?:;)?(\^+)(?:;)?/gu, function ($0, ups) {
|
|
10552
|
-
return ';' + ups.split('').join(';') + ';';
|
|
10553
|
-
}) // Descendents
|
|
10554
|
-
.replace(/;;;|;;/gu, ';..;') // Remove trailing
|
|
10555
|
-
.replace(/;$|'?\]|'$/gu, '');
|
|
10556
|
-
const exprList = normalized.split(';').map(function (exp) {
|
|
10557
|
-
const match = exp.match(/#(\d+)/u);
|
|
10558
|
-
return !match || !match[1] ? exp : subx[match[1]];
|
|
10559
|
-
});
|
|
10560
|
-
cache[expr] = exprList;
|
|
10561
|
-
return cache[expr].concat();
|
|
10562
|
-
};
|
|
10563
|
-
|
|
10564
|
-
JSONPath.prototype.vm = vm;
|
|
10565
|
-
|
|
10566
|
-
/*!
|
|
10567
|
-
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
10568
|
-
* (c) 2017-2022 Joachim Wester
|
|
10569
|
-
* MIT licensed
|
|
10570
|
-
*/
|
|
10571
|
-
var __extends = (undefined && undefined.__extends) || (function () {
|
|
10572
|
-
var extendStatics = function (d, b) {
|
|
10573
|
-
extendStatics = Object.setPrototypeOf ||
|
|
10574
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
10575
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
10576
|
-
return extendStatics(d, b);
|
|
10577
|
-
};
|
|
10578
|
-
return function (d, b) {
|
|
10579
|
-
extendStatics(d, b);
|
|
10580
|
-
function __() { this.constructor = d; }
|
|
10581
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
10582
|
-
};
|
|
10583
|
-
})();
|
|
10584
|
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
10585
|
-
function hasOwnProperty$b(obj, key) {
|
|
10586
|
-
return _hasOwnProperty.call(obj, key);
|
|
10587
|
-
}
|
|
10588
|
-
function _objectKeys(obj) {
|
|
10589
|
-
if (Array.isArray(obj)) {
|
|
10590
|
-
var keys_1 = new Array(obj.length);
|
|
10591
|
-
for (var k = 0; k < keys_1.length; k++) {
|
|
10592
|
-
keys_1[k] = "" + k;
|
|
10593
|
-
}
|
|
10594
|
-
return keys_1;
|
|
10595
|
-
}
|
|
10596
|
-
if (Object.keys) {
|
|
10597
|
-
return Object.keys(obj);
|
|
10598
|
-
}
|
|
10599
|
-
var keys = [];
|
|
10600
|
-
for (var i in obj) {
|
|
10601
|
-
if (hasOwnProperty$b(obj, i)) {
|
|
10602
|
-
keys.push(i);
|
|
10603
|
-
}
|
|
10604
|
-
}
|
|
10605
|
-
return keys;
|
|
10606
|
-
}
|
|
10607
|
-
/**
|
|
10608
|
-
* Deeply clone the object.
|
|
10609
|
-
* https://jsperf.com/deep-copy-vs-json-stringify-json-parse/25 (recursiveDeepCopy)
|
|
10610
|
-
* @param {any} obj value to clone
|
|
10611
|
-
* @return {any} cloned obj
|
|
10612
|
-
*/
|
|
10613
|
-
function _deepClone(obj) {
|
|
10614
|
-
switch (typeof obj) {
|
|
10615
|
-
case "object":
|
|
10616
|
-
return JSON.parse(JSON.stringify(obj)); //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5
|
|
10617
|
-
case "undefined":
|
|
10618
|
-
return null; //this is how JSON.stringify behaves for array items
|
|
10619
|
-
default:
|
|
10620
|
-
return obj; //no need to clone primitives
|
|
10621
|
-
}
|
|
10622
|
-
}
|
|
10623
|
-
//3x faster than cached /^\d+$/.test(str)
|
|
10624
|
-
function isInteger(str) {
|
|
10625
|
-
var i = 0;
|
|
10626
|
-
var len = str.length;
|
|
10627
|
-
var charCode;
|
|
10628
|
-
while (i < len) {
|
|
10629
|
-
charCode = str.charCodeAt(i);
|
|
10630
|
-
if (charCode >= 48 && charCode <= 57) {
|
|
10631
|
-
i++;
|
|
10632
|
-
continue;
|
|
10633
|
-
}
|
|
10634
|
-
return false;
|
|
10635
|
-
}
|
|
10636
|
-
return true;
|
|
10637
|
-
}
|
|
10638
|
-
/**
|
|
10639
|
-
* Escapes a json pointer path
|
|
10640
|
-
* @param path The raw pointer
|
|
10641
|
-
* @return the Escaped path
|
|
10642
|
-
*/
|
|
10643
|
-
function escapePathComponent(path) {
|
|
10644
|
-
if (path.indexOf('/') === -1 && path.indexOf('~') === -1)
|
|
10645
|
-
return path;
|
|
10646
|
-
return path.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
10647
|
-
}
|
|
10648
|
-
/**
|
|
10649
|
-
* Unescapes a json pointer path
|
|
10650
|
-
* @param path The escaped pointer
|
|
10651
|
-
* @return The unescaped path
|
|
10652
|
-
*/
|
|
10653
|
-
function unescapePathComponent(path) {
|
|
10654
|
-
return path.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
10655
|
-
}
|
|
10656
|
-
/**
|
|
10657
|
-
* Recursively checks whether an object has any undefined values inside.
|
|
10658
|
-
*/
|
|
10659
|
-
function hasUndefined(obj) {
|
|
10660
|
-
if (obj === undefined) {
|
|
10661
|
-
return true;
|
|
10662
|
-
}
|
|
10663
|
-
if (obj) {
|
|
10664
|
-
if (Array.isArray(obj)) {
|
|
10665
|
-
for (var i_1 = 0, len = obj.length; i_1 < len; i_1++) {
|
|
10666
|
-
if (hasUndefined(obj[i_1])) {
|
|
10667
|
-
return true;
|
|
10668
|
-
}
|
|
10669
|
-
}
|
|
10670
|
-
}
|
|
10671
|
-
else if (typeof obj === "object") {
|
|
10672
|
-
var objKeys = _objectKeys(obj);
|
|
10673
|
-
var objKeysLength = objKeys.length;
|
|
10674
|
-
for (var i = 0; i < objKeysLength; i++) {
|
|
10675
|
-
if (hasUndefined(obj[objKeys[i]])) {
|
|
10676
|
-
return true;
|
|
10677
|
-
}
|
|
10678
|
-
}
|
|
10679
|
-
}
|
|
10680
|
-
}
|
|
10681
|
-
return false;
|
|
10682
|
-
}
|
|
10683
|
-
function patchErrorMessageFormatter(message, args) {
|
|
10684
|
-
var messageParts = [message];
|
|
10685
|
-
for (var key in args) {
|
|
10686
|
-
var value = typeof args[key] === 'object' ? JSON.stringify(args[key], null, 2) : args[key]; // pretty print
|
|
10687
|
-
if (typeof value !== 'undefined') {
|
|
10688
|
-
messageParts.push(key + ": " + value);
|
|
10689
|
-
}
|
|
10690
|
-
}
|
|
10691
|
-
return messageParts.join('\n');
|
|
10692
|
-
}
|
|
10693
|
-
var PatchError = /** @class */ (function (_super) {
|
|
10694
|
-
__extends(PatchError, _super);
|
|
10695
|
-
function PatchError(message, name, index, operation, tree) {
|
|
10696
|
-
var _newTarget = this.constructor;
|
|
10697
|
-
var _this = _super.call(this, patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree })) || this;
|
|
10698
|
-
_this.name = name;
|
|
10699
|
-
_this.index = index;
|
|
10700
|
-
_this.operation = operation;
|
|
10701
|
-
_this.tree = tree;
|
|
10702
|
-
Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain, see https://stackoverflow.com/a/48342359
|
|
10703
|
-
_this.message = patchErrorMessageFormatter(message, { name: name, index: index, operation: operation, tree: tree });
|
|
10704
|
-
return _this;
|
|
10705
|
-
}
|
|
10706
|
-
return PatchError;
|
|
10707
|
-
}(Error));
|
|
10708
|
-
|
|
10709
|
-
var JsonPatchError = PatchError;
|
|
10710
|
-
var deepClone = _deepClone;
|
|
10711
|
-
/* We use a Javascript hash to store each
|
|
10712
|
-
function. Each hash entry (property) uses
|
|
10713
|
-
the operation identifiers specified in rfc6902.
|
|
10714
|
-
In this way, we can map each patch operation
|
|
10715
|
-
to its dedicated function in efficient way.
|
|
10716
|
-
*/
|
|
10717
|
-
/* The operations applicable to an object */
|
|
10718
|
-
var objOps = {
|
|
10719
|
-
add: function (obj, key, document) {
|
|
10720
|
-
obj[key] = this.value;
|
|
10721
|
-
return { newDocument: document };
|
|
10722
|
-
},
|
|
10723
|
-
remove: function (obj, key, document) {
|
|
10724
|
-
var removed = obj[key];
|
|
10725
|
-
delete obj[key];
|
|
10726
|
-
return { newDocument: document, removed: removed };
|
|
10727
|
-
},
|
|
10728
|
-
replace: function (obj, key, document) {
|
|
10729
|
-
var removed = obj[key];
|
|
10730
|
-
obj[key] = this.value;
|
|
10731
|
-
return { newDocument: document, removed: removed };
|
|
10732
|
-
},
|
|
10733
|
-
move: function (obj, key, document) {
|
|
10734
|
-
/* in case move target overwrites an existing value,
|
|
10735
|
-
return the removed value, this can be taxing performance-wise,
|
|
10736
|
-
and is potentially unneeded */
|
|
10737
|
-
var removed = getValueByPointer(document, this.path);
|
|
10738
|
-
if (removed) {
|
|
10739
|
-
removed = _deepClone(removed);
|
|
10740
|
-
}
|
|
10741
|
-
var originalValue = applyOperation(document, { op: "remove", path: this.from }).removed;
|
|
10742
|
-
applyOperation(document, { op: "add", path: this.path, value: originalValue });
|
|
10743
|
-
return { newDocument: document, removed: removed };
|
|
10744
|
-
},
|
|
10745
|
-
copy: function (obj, key, document) {
|
|
10746
|
-
var valueToCopy = getValueByPointer(document, this.from);
|
|
10747
|
-
// enforce copy by value so further operations don't affect source (see issue #177)
|
|
10748
|
-
applyOperation(document, { op: "add", path: this.path, value: _deepClone(valueToCopy) });
|
|
10749
|
-
return { newDocument: document };
|
|
10750
|
-
},
|
|
10751
|
-
test: function (obj, key, document) {
|
|
10752
|
-
return { newDocument: document, test: _areEquals(obj[key], this.value) };
|
|
10753
|
-
},
|
|
10754
|
-
_get: function (obj, key, document) {
|
|
10755
|
-
this.value = obj[key];
|
|
10756
|
-
return { newDocument: document };
|
|
10757
|
-
}
|
|
10758
|
-
};
|
|
10759
|
-
/* The operations applicable to an array. Many are the same as for the object */
|
|
10760
|
-
var arrOps = {
|
|
10761
|
-
add: function (arr, i, document) {
|
|
10762
|
-
if (isInteger(i)) {
|
|
10763
|
-
arr.splice(i, 0, this.value);
|
|
10764
|
-
}
|
|
10765
|
-
else { // array props
|
|
10766
|
-
arr[i] = this.value;
|
|
10767
|
-
}
|
|
10768
|
-
// this may be needed when using '-' in an array
|
|
10769
|
-
return { newDocument: document, index: i };
|
|
10770
|
-
},
|
|
10771
|
-
remove: function (arr, i, document) {
|
|
10772
|
-
var removedList = arr.splice(i, 1);
|
|
10773
|
-
return { newDocument: document, removed: removedList[0] };
|
|
10774
|
-
},
|
|
10775
|
-
replace: function (arr, i, document) {
|
|
10776
|
-
var removed = arr[i];
|
|
10777
|
-
arr[i] = this.value;
|
|
10778
|
-
return { newDocument: document, removed: removed };
|
|
10779
|
-
},
|
|
10780
|
-
move: objOps.move,
|
|
10781
|
-
copy: objOps.copy,
|
|
10782
|
-
test: objOps.test,
|
|
10783
|
-
_get: objOps._get
|
|
10784
|
-
};
|
|
10785
|
-
/**
|
|
10786
|
-
* Retrieves a value from a JSON document by a JSON pointer.
|
|
10787
|
-
* Returns the value.
|
|
10788
|
-
*
|
|
10789
|
-
* @param document The document to get the value from
|
|
10790
|
-
* @param pointer an escaped JSON pointer
|
|
10791
|
-
* @return The retrieved value
|
|
10792
|
-
*/
|
|
10793
|
-
function getValueByPointer(document, pointer) {
|
|
10794
|
-
if (pointer == '') {
|
|
10795
|
-
return document;
|
|
10796
|
-
}
|
|
10797
|
-
var getOriginalDestination = { op: "_get", path: pointer };
|
|
10798
|
-
applyOperation(document, getOriginalDestination);
|
|
10799
|
-
return getOriginalDestination.value;
|
|
10800
|
-
}
|
|
10801
|
-
/**
|
|
10802
|
-
* Apply a single JSON Patch Operation on a JSON document.
|
|
10803
|
-
* Returns the {newDocument, result} of the operation.
|
|
10804
|
-
* It modifies the `document` and `operation` objects - it gets the values by reference.
|
|
10805
|
-
* If you would like to avoid touching your values, clone them:
|
|
10806
|
-
* `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`.
|
|
10807
|
-
*
|
|
10808
|
-
* @param document The document to patch
|
|
10809
|
-
* @param operation The operation to apply
|
|
10810
|
-
* @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.
|
|
10811
|
-
* @param mutateDocument Whether to mutate the original document or clone it before applying
|
|
10812
|
-
* @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.
|
|
10813
|
-
* @return `{newDocument, result}` after the operation
|
|
10814
|
-
*/
|
|
10815
|
-
function applyOperation(document, operation, validateOperation, mutateDocument, banPrototypeModifications, index) {
|
|
10816
|
-
if (validateOperation === void 0) { validateOperation = false; }
|
|
10817
|
-
if (mutateDocument === void 0) { mutateDocument = true; }
|
|
10818
|
-
if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }
|
|
10819
|
-
if (index === void 0) { index = 0; }
|
|
10820
|
-
if (validateOperation) {
|
|
10821
|
-
if (typeof validateOperation == 'function') {
|
|
10822
|
-
validateOperation(operation, 0, document, operation.path);
|
|
10823
|
-
}
|
|
10824
|
-
else {
|
|
10825
|
-
validator$1(operation, 0);
|
|
10826
|
-
}
|
|
10827
|
-
}
|
|
10828
|
-
/* ROOT OPERATIONS */
|
|
10829
|
-
if (operation.path === "") {
|
|
10830
|
-
var returnValue = { newDocument: document };
|
|
10831
|
-
if (operation.op === 'add') {
|
|
10832
|
-
returnValue.newDocument = operation.value;
|
|
10833
|
-
return returnValue;
|
|
10834
|
-
}
|
|
10835
|
-
else if (operation.op === 'replace') {
|
|
10836
|
-
returnValue.newDocument = operation.value;
|
|
10837
|
-
returnValue.removed = document; //document we removed
|
|
10838
|
-
return returnValue;
|
|
10839
|
-
}
|
|
10840
|
-
else if (operation.op === 'move' || operation.op === 'copy') { // it's a move or copy to root
|
|
10841
|
-
returnValue.newDocument = getValueByPointer(document, operation.from); // get the value by json-pointer in `from` field
|
|
10842
|
-
if (operation.op === 'move') { // report removed item
|
|
10843
|
-
returnValue.removed = document;
|
|
10844
|
-
}
|
|
10845
|
-
return returnValue;
|
|
10846
|
-
}
|
|
10847
|
-
else if (operation.op === 'test') {
|
|
10848
|
-
returnValue.test = _areEquals(document, operation.value);
|
|
10849
|
-
if (returnValue.test === false) {
|
|
10850
|
-
throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
|
|
10851
|
-
}
|
|
10852
|
-
returnValue.newDocument = document;
|
|
10853
|
-
return returnValue;
|
|
10854
|
-
}
|
|
10855
|
-
else if (operation.op === 'remove') { // a remove on root
|
|
10856
|
-
returnValue.removed = document;
|
|
10857
|
-
returnValue.newDocument = null;
|
|
10858
|
-
return returnValue;
|
|
10859
|
-
}
|
|
10860
|
-
else if (operation.op === '_get') {
|
|
10861
|
-
operation.value = document;
|
|
10862
|
-
return returnValue;
|
|
10863
|
-
}
|
|
10864
|
-
else { /* bad operation */
|
|
10865
|
-
if (validateOperation) {
|
|
10866
|
-
throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);
|
|
10867
|
-
}
|
|
10868
|
-
else {
|
|
10869
|
-
return returnValue;
|
|
10870
|
-
}
|
|
10871
|
-
}
|
|
10872
|
-
} /* END ROOT OPERATIONS */
|
|
10873
|
-
else {
|
|
10874
|
-
if (!mutateDocument) {
|
|
10875
|
-
document = _deepClone(document);
|
|
10876
|
-
}
|
|
10877
|
-
var path = operation.path || "";
|
|
10878
|
-
var keys = path.split('/');
|
|
10879
|
-
var obj = document;
|
|
10880
|
-
var t = 1; //skip empty element - http://jsperf.com/to-shift-or-not-to-shift
|
|
10881
|
-
var len = keys.length;
|
|
10882
|
-
var existingPathFragment = undefined;
|
|
10883
|
-
var key = void 0;
|
|
10884
|
-
var validateFunction = void 0;
|
|
10885
|
-
if (typeof validateOperation == 'function') {
|
|
10886
|
-
validateFunction = validateOperation;
|
|
10887
|
-
}
|
|
10888
|
-
else {
|
|
10889
|
-
validateFunction = validator$1;
|
|
10890
|
-
}
|
|
10891
|
-
while (true) {
|
|
10892
|
-
key = keys[t];
|
|
10893
|
-
if (key && key.indexOf('~') != -1) {
|
|
10894
|
-
key = unescapePathComponent(key);
|
|
10895
|
-
}
|
|
10896
|
-
if (banPrototypeModifications &&
|
|
10897
|
-
(key == '__proto__' ||
|
|
10898
|
-
(key == 'prototype' && t > 0 && keys[t - 1] == 'constructor'))) {
|
|
10899
|
-
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');
|
|
10900
|
-
}
|
|
10901
|
-
if (validateOperation) {
|
|
10902
|
-
if (existingPathFragment === undefined) {
|
|
10903
|
-
if (obj[key] === undefined) {
|
|
10904
|
-
existingPathFragment = keys.slice(0, t).join('/');
|
|
10905
|
-
}
|
|
10906
|
-
else if (t == len - 1) {
|
|
10907
|
-
existingPathFragment = operation.path;
|
|
10908
|
-
}
|
|
10909
|
-
if (existingPathFragment !== undefined) {
|
|
10910
|
-
validateFunction(operation, 0, document, existingPathFragment);
|
|
10911
|
-
}
|
|
10912
|
-
}
|
|
10913
|
-
}
|
|
10914
|
-
t++;
|
|
10915
|
-
if (Array.isArray(obj)) {
|
|
10916
|
-
if (key === '-') {
|
|
10917
|
-
key = obj.length;
|
|
10918
|
-
}
|
|
10919
|
-
else {
|
|
10920
|
-
if (validateOperation && !isInteger(key)) {
|
|
10921
|
-
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);
|
|
10922
|
-
} // only parse key when it's an integer for `arr.prop` to work
|
|
10923
|
-
else if (isInteger(key)) {
|
|
10924
|
-
key = ~~key;
|
|
10925
|
-
}
|
|
10926
|
-
}
|
|
10927
|
-
if (t >= len) {
|
|
10928
|
-
if (validateOperation && operation.op === "add" && key > obj.length) {
|
|
10929
|
-
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);
|
|
10930
|
-
}
|
|
10931
|
-
var returnValue = arrOps[operation.op].call(operation, obj, key, document); // Apply patch
|
|
10932
|
-
if (returnValue.test === false) {
|
|
10933
|
-
throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
|
|
10934
|
-
}
|
|
10935
|
-
return returnValue;
|
|
10936
|
-
}
|
|
10937
|
-
}
|
|
10938
|
-
else {
|
|
10939
|
-
if (t >= len) {
|
|
10940
|
-
var returnValue = objOps[operation.op].call(operation, obj, key, document); // Apply patch
|
|
10941
|
-
if (returnValue.test === false) {
|
|
10942
|
-
throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
|
|
10943
|
-
}
|
|
10944
|
-
return returnValue;
|
|
10945
|
-
}
|
|
10946
|
-
}
|
|
10947
|
-
obj = obj[key];
|
|
10948
|
-
// If we have more keys in the path, but the next value isn't a non-null object,
|
|
10949
|
-
// throw an OPERATION_PATH_UNRESOLVABLE error instead of iterating again.
|
|
10950
|
-
if (validateOperation && t < len && (!obj || typeof obj !== "object")) {
|
|
10951
|
-
throw new JsonPatchError('Cannot perform operation at the desired path', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);
|
|
10952
|
-
}
|
|
10953
|
-
}
|
|
10954
|
-
}
|
|
10955
|
-
}
|
|
10956
|
-
/**
|
|
10957
|
-
* Apply a full JSON Patch array on a JSON document.
|
|
10958
|
-
* Returns the {newDocument, result} of the patch.
|
|
10959
|
-
* It modifies the `document` object and `patch` - it gets the values by reference.
|
|
10960
|
-
* If you would like to avoid touching your values, clone them:
|
|
10961
|
-
* `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`.
|
|
10962
|
-
*
|
|
10963
|
-
* @param document The document to patch
|
|
10964
|
-
* @param patch The patch to apply
|
|
10965
|
-
* @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.
|
|
10966
|
-
* @param mutateDocument Whether to mutate the original document or clone it before applying
|
|
10967
|
-
* @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.
|
|
10968
|
-
* @return An array of `{newDocument, result}` after the patch
|
|
10969
|
-
*/
|
|
10970
|
-
function applyPatch(document, patch, validateOperation, mutateDocument, banPrototypeModifications) {
|
|
10971
|
-
if (mutateDocument === void 0) { mutateDocument = true; }
|
|
10972
|
-
if (banPrototypeModifications === void 0) { banPrototypeModifications = true; }
|
|
10973
|
-
if (validateOperation) {
|
|
10974
|
-
if (!Array.isArray(patch)) {
|
|
10975
|
-
throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');
|
|
10976
|
-
}
|
|
10977
|
-
}
|
|
10978
|
-
if (!mutateDocument) {
|
|
10979
|
-
document = _deepClone(document);
|
|
10980
|
-
}
|
|
10981
|
-
var results = new Array(patch.length);
|
|
10982
|
-
for (var i = 0, length_1 = patch.length; i < length_1; i++) {
|
|
10983
|
-
// we don't need to pass mutateDocument argument because if it was true, we already deep cloned the object, we'll just pass `true`
|
|
10984
|
-
results[i] = applyOperation(document, patch[i], validateOperation, true, banPrototypeModifications, i);
|
|
10985
|
-
document = results[i].newDocument; // in case root was replaced
|
|
10986
|
-
}
|
|
10987
|
-
results.newDocument = document;
|
|
10988
|
-
return results;
|
|
10989
|
-
}
|
|
10990
|
-
/**
|
|
10991
|
-
* Apply a single JSON Patch Operation on a JSON document.
|
|
10992
|
-
* Returns the updated document.
|
|
10993
|
-
* Suitable as a reducer.
|
|
10994
|
-
*
|
|
10995
|
-
* @param document The document to patch
|
|
10996
|
-
* @param operation The operation to apply
|
|
10997
|
-
* @return The updated document
|
|
10998
|
-
*/
|
|
10999
|
-
function applyReducer(document, operation, index) {
|
|
11000
|
-
var operationResult = applyOperation(document, operation);
|
|
11001
|
-
if (operationResult.test === false) { // failed test
|
|
11002
|
-
throw new JsonPatchError("Test operation failed", 'TEST_OPERATION_FAILED', index, operation, document);
|
|
11003
|
-
}
|
|
11004
|
-
return operationResult.newDocument;
|
|
11005
|
-
}
|
|
11006
|
-
/**
|
|
11007
|
-
* Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.
|
|
11008
|
-
* @param {object} operation - operation object (patch)
|
|
11009
|
-
* @param {number} index - index of operation in the sequence
|
|
11010
|
-
* @param {object} [document] - object where the operation is supposed to be applied
|
|
11011
|
-
* @param {string} [existingPathFragment] - comes along with `document`
|
|
11012
|
-
*/
|
|
11013
|
-
function validator$1(operation, index, document, existingPathFragment) {
|
|
11014
|
-
if (typeof operation !== 'object' || operation === null || Array.isArray(operation)) {
|
|
11015
|
-
throw new JsonPatchError('Operation is not an object', 'OPERATION_NOT_AN_OBJECT', index, operation, document);
|
|
11016
|
-
}
|
|
11017
|
-
else if (!objOps[operation.op]) {
|
|
11018
|
-
throw new JsonPatchError('Operation `op` property is not one of operations defined in RFC-6902', 'OPERATION_OP_INVALID', index, operation, document);
|
|
11019
|
-
}
|
|
11020
|
-
else if (typeof operation.path !== 'string') {
|
|
11021
|
-
throw new JsonPatchError('Operation `path` property is not a string', 'OPERATION_PATH_INVALID', index, operation, document);
|
|
11022
|
-
}
|
|
11023
|
-
else if (operation.path.indexOf('/') !== 0 && operation.path.length > 0) {
|
|
11024
|
-
// paths that aren't empty string should start with "/"
|
|
11025
|
-
throw new JsonPatchError('Operation `path` property must start with "/"', 'OPERATION_PATH_INVALID', index, operation, document);
|
|
11026
|
-
}
|
|
11027
|
-
else if ((operation.op === 'move' || operation.op === 'copy') && typeof operation.from !== 'string') {
|
|
11028
|
-
throw new JsonPatchError('Operation `from` property is not present (applicable in `move` and `copy` operations)', 'OPERATION_FROM_REQUIRED', index, operation, document);
|
|
11029
|
-
}
|
|
11030
|
-
else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && operation.value === undefined) {
|
|
11031
|
-
throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_REQUIRED', index, operation, document);
|
|
11032
|
-
}
|
|
11033
|
-
else if ((operation.op === 'add' || operation.op === 'replace' || operation.op === 'test') && hasUndefined(operation.value)) {
|
|
11034
|
-
throw new JsonPatchError('Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)', 'OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED', index, operation, document);
|
|
11035
|
-
}
|
|
11036
|
-
else if (document) {
|
|
11037
|
-
if (operation.op == "add") {
|
|
11038
|
-
var pathLen = operation.path.split("/").length;
|
|
11039
|
-
var existingPathLen = existingPathFragment.split("/").length;
|
|
11040
|
-
if (pathLen !== existingPathLen + 1 && pathLen !== existingPathLen) {
|
|
11041
|
-
throw new JsonPatchError('Cannot perform an `add` operation at the desired path', 'OPERATION_PATH_CANNOT_ADD', index, operation, document);
|
|
11042
|
-
}
|
|
11043
|
-
}
|
|
11044
|
-
else if (operation.op === 'replace' || operation.op === 'remove' || operation.op === '_get') {
|
|
11045
|
-
if (operation.path !== existingPathFragment) {
|
|
11046
|
-
throw new JsonPatchError('Cannot perform the operation at a path that does not exist', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);
|
|
11047
|
-
}
|
|
11048
|
-
}
|
|
11049
|
-
else if (operation.op === 'move' || operation.op === 'copy') {
|
|
11050
|
-
var existingValue = { op: "_get", path: operation.from, value: undefined };
|
|
11051
|
-
var error = validate([existingValue], document);
|
|
11052
|
-
if (error && error.name === 'OPERATION_PATH_UNRESOLVABLE') {
|
|
11053
|
-
throw new JsonPatchError('Cannot perform the operation from a path that does not exist', 'OPERATION_FROM_UNRESOLVABLE', index, operation, document);
|
|
11054
|
-
}
|
|
11055
|
-
}
|
|
11056
|
-
}
|
|
11057
|
-
}
|
|
11058
|
-
/**
|
|
11059
|
-
* Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document.
|
|
11060
|
-
* If error is encountered, returns a JsonPatchError object
|
|
11061
|
-
* @param sequence
|
|
11062
|
-
* @param document
|
|
11063
|
-
* @returns {JsonPatchError|undefined}
|
|
11064
|
-
*/
|
|
11065
|
-
function validate(sequence, document, externalValidator) {
|
|
11066
|
-
try {
|
|
11067
|
-
if (!Array.isArray(sequence)) {
|
|
11068
|
-
throw new JsonPatchError('Patch sequence must be an array', 'SEQUENCE_NOT_AN_ARRAY');
|
|
11069
|
-
}
|
|
11070
|
-
if (document) {
|
|
11071
|
-
//clone document and sequence so that we can safely try applying operations
|
|
11072
|
-
applyPatch(_deepClone(document), _deepClone(sequence), externalValidator || true);
|
|
11073
|
-
}
|
|
11074
|
-
else {
|
|
11075
|
-
externalValidator = externalValidator || validator$1;
|
|
11076
|
-
for (var i = 0; i < sequence.length; i++) {
|
|
11077
|
-
externalValidator(sequence[i], i, document, undefined);
|
|
11078
|
-
}
|
|
11079
|
-
}
|
|
11080
|
-
}
|
|
11081
|
-
catch (e) {
|
|
11082
|
-
if (e instanceof JsonPatchError) {
|
|
11083
|
-
return e;
|
|
11084
|
-
}
|
|
11085
|
-
else {
|
|
11086
|
-
throw e;
|
|
11087
|
-
}
|
|
11088
|
-
}
|
|
11089
|
-
}
|
|
11090
|
-
// based on https://github.com/epoberezkin/fast-deep-equal
|
|
11091
|
-
// MIT License
|
|
11092
|
-
// Copyright (c) 2017 Evgeny Poberezkin
|
|
11093
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11094
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
11095
|
-
// in the Software without restriction, including without limitation the rights
|
|
11096
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11097
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
11098
|
-
// furnished to do so, subject to the following conditions:
|
|
11099
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
11100
|
-
// copies or substantial portions of the Software.
|
|
11101
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11102
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
11103
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
11104
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
11105
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
11106
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
11107
|
-
// SOFTWARE.
|
|
11108
|
-
function _areEquals(a, b) {
|
|
11109
|
-
if (a === b)
|
|
11110
|
-
return true;
|
|
11111
|
-
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
11112
|
-
var arrA = Array.isArray(a), arrB = Array.isArray(b), i, length, key;
|
|
11113
|
-
if (arrA && arrB) {
|
|
11114
|
-
length = a.length;
|
|
11115
|
-
if (length != b.length)
|
|
11116
|
-
return false;
|
|
11117
|
-
for (i = length; i-- !== 0;)
|
|
11118
|
-
if (!_areEquals(a[i], b[i]))
|
|
11119
|
-
return false;
|
|
11120
|
-
return true;
|
|
11121
|
-
}
|
|
11122
|
-
if (arrA != arrB)
|
|
11123
|
-
return false;
|
|
11124
|
-
var keys = Object.keys(a);
|
|
11125
|
-
length = keys.length;
|
|
11126
|
-
if (length !== Object.keys(b).length)
|
|
11127
|
-
return false;
|
|
11128
|
-
for (i = length; i-- !== 0;)
|
|
11129
|
-
if (!b.hasOwnProperty(keys[i]))
|
|
11130
|
-
return false;
|
|
11131
|
-
for (i = length; i-- !== 0;) {
|
|
11132
|
-
key = keys[i];
|
|
11133
|
-
if (!_areEquals(a[key], b[key]))
|
|
11134
|
-
return false;
|
|
11135
|
-
}
|
|
11136
|
-
return true;
|
|
11137
|
-
}
|
|
11138
|
-
return a !== a && b !== b;
|
|
11139
|
-
}
|
|
11140
|
-
|
|
11141
|
-
var core = /*#__PURE__*/Object.freeze({
|
|
11142
|
-
__proto__: null,
|
|
11143
|
-
JsonPatchError: JsonPatchError,
|
|
11144
|
-
_areEquals: _areEquals,
|
|
11145
|
-
applyOperation: applyOperation,
|
|
11146
|
-
applyPatch: applyPatch,
|
|
11147
|
-
applyReducer: applyReducer,
|
|
11148
|
-
deepClone: deepClone,
|
|
11149
|
-
getValueByPointer: getValueByPointer,
|
|
11150
|
-
validate: validate,
|
|
11151
|
-
validator: validator$1
|
|
11152
|
-
});
|
|
11153
|
-
|
|
11154
|
-
/*!
|
|
11155
|
-
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
11156
|
-
* (c) 2017-2021 Joachim Wester
|
|
11157
|
-
* MIT license
|
|
11158
|
-
*/
|
|
11159
|
-
var beforeDict = new WeakMap();
|
|
11160
|
-
var Mirror = /** @class */ (function () {
|
|
11161
|
-
function Mirror(obj) {
|
|
11162
|
-
this.observers = new Map();
|
|
11163
|
-
this.obj = obj;
|
|
11164
|
-
}
|
|
11165
|
-
return Mirror;
|
|
11166
|
-
}());
|
|
11167
|
-
var ObserverInfo = /** @class */ (function () {
|
|
11168
|
-
function ObserverInfo(callback, observer) {
|
|
11169
|
-
this.callback = callback;
|
|
11170
|
-
this.observer = observer;
|
|
11171
|
-
}
|
|
11172
|
-
return ObserverInfo;
|
|
11173
|
-
}());
|
|
11174
|
-
function getMirror(obj) {
|
|
11175
|
-
return beforeDict.get(obj);
|
|
11176
|
-
}
|
|
11177
|
-
function getObserverFromMirror(mirror, callback) {
|
|
11178
|
-
return mirror.observers.get(callback);
|
|
11179
|
-
}
|
|
11180
|
-
function removeObserverFromMirror(mirror, observer) {
|
|
11181
|
-
mirror.observers.delete(observer.callback);
|
|
11182
|
-
}
|
|
11183
|
-
/**
|
|
11184
|
-
* Detach an observer from an object
|
|
11185
|
-
*/
|
|
11186
|
-
function unobserve(root, observer) {
|
|
11187
|
-
observer.unobserve();
|
|
11188
|
-
}
|
|
11189
|
-
/**
|
|
11190
|
-
* Observes changes made to an object, which can then be retrieved using generate
|
|
11191
|
-
*/
|
|
11192
|
-
function observe(obj, callback) {
|
|
11193
|
-
var patches = [];
|
|
11194
|
-
var observer;
|
|
11195
|
-
var mirror = getMirror(obj);
|
|
11196
|
-
if (!mirror) {
|
|
11197
|
-
mirror = new Mirror(obj);
|
|
11198
|
-
beforeDict.set(obj, mirror);
|
|
11199
|
-
}
|
|
11200
|
-
else {
|
|
11201
|
-
var observerInfo = getObserverFromMirror(mirror, callback);
|
|
11202
|
-
observer = observerInfo && observerInfo.observer;
|
|
11203
|
-
}
|
|
11204
|
-
if (observer) {
|
|
11205
|
-
return observer;
|
|
11206
|
-
}
|
|
11207
|
-
observer = {};
|
|
11208
|
-
mirror.value = _deepClone(obj);
|
|
11209
|
-
if (callback) {
|
|
11210
|
-
observer.callback = callback;
|
|
11211
|
-
observer.next = null;
|
|
11212
|
-
var dirtyCheck = function () {
|
|
11213
|
-
generate(observer);
|
|
11214
|
-
};
|
|
11215
|
-
var fastCheck = function () {
|
|
11216
|
-
clearTimeout(observer.next);
|
|
11217
|
-
observer.next = setTimeout(dirtyCheck);
|
|
11218
|
-
};
|
|
11219
|
-
if (typeof window !== 'undefined') { //not Node
|
|
11220
|
-
window.addEventListener('mouseup', fastCheck);
|
|
11221
|
-
window.addEventListener('keyup', fastCheck);
|
|
11222
|
-
window.addEventListener('mousedown', fastCheck);
|
|
11223
|
-
window.addEventListener('keydown', fastCheck);
|
|
11224
|
-
window.addEventListener('change', fastCheck);
|
|
11225
|
-
}
|
|
11226
|
-
}
|
|
11227
|
-
observer.patches = patches;
|
|
11228
|
-
observer.object = obj;
|
|
11229
|
-
observer.unobserve = function () {
|
|
11230
|
-
generate(observer);
|
|
11231
|
-
clearTimeout(observer.next);
|
|
11232
|
-
removeObserverFromMirror(mirror, observer);
|
|
11233
|
-
if (typeof window !== 'undefined') {
|
|
11234
|
-
window.removeEventListener('mouseup', fastCheck);
|
|
11235
|
-
window.removeEventListener('keyup', fastCheck);
|
|
11236
|
-
window.removeEventListener('mousedown', fastCheck);
|
|
11237
|
-
window.removeEventListener('keydown', fastCheck);
|
|
11238
|
-
window.removeEventListener('change', fastCheck);
|
|
11239
|
-
}
|
|
11240
|
-
};
|
|
11241
|
-
mirror.observers.set(callback, new ObserverInfo(callback, observer));
|
|
11242
|
-
return observer;
|
|
11243
|
-
}
|
|
11244
|
-
/**
|
|
11245
|
-
* Generate an array of patches from an observer
|
|
11246
|
-
*/
|
|
11247
|
-
function generate(observer, invertible) {
|
|
11248
|
-
if (invertible === void 0) { invertible = false; }
|
|
11249
|
-
var mirror = beforeDict.get(observer.object);
|
|
11250
|
-
_generate(mirror.value, observer.object, observer.patches, "", invertible);
|
|
11251
|
-
if (observer.patches.length) {
|
|
11252
|
-
applyPatch(mirror.value, observer.patches);
|
|
11253
|
-
}
|
|
11254
|
-
var temp = observer.patches;
|
|
11255
|
-
if (temp.length > 0) {
|
|
11256
|
-
observer.patches = [];
|
|
11257
|
-
if (observer.callback) {
|
|
11258
|
-
observer.callback(temp);
|
|
11259
|
-
}
|
|
11260
|
-
}
|
|
11261
|
-
return temp;
|
|
11262
|
-
}
|
|
11263
|
-
// Dirty check if obj is different from mirror, generate patches and update mirror
|
|
11264
|
-
function _generate(mirror, obj, patches, path, invertible) {
|
|
11265
|
-
if (obj === mirror) {
|
|
11266
|
-
return;
|
|
11267
|
-
}
|
|
11268
|
-
if (typeof obj.toJSON === "function") {
|
|
11269
|
-
obj = obj.toJSON();
|
|
11270
|
-
}
|
|
11271
|
-
var newKeys = _objectKeys(obj);
|
|
11272
|
-
var oldKeys = _objectKeys(mirror);
|
|
11273
|
-
var deleted = false;
|
|
11274
|
-
//if ever "move" operation is implemented here, make sure this test runs OK: "should not generate the same patch twice (move)"
|
|
11275
|
-
for (var t = oldKeys.length - 1; t >= 0; t--) {
|
|
11276
|
-
var key = oldKeys[t];
|
|
11277
|
-
var oldVal = mirror[key];
|
|
11278
|
-
if (hasOwnProperty$b(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {
|
|
11279
|
-
var newVal = obj[key];
|
|
11280
|
-
if (typeof oldVal == "object" && oldVal != null && typeof newVal == "object" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) {
|
|
11281
|
-
_generate(oldVal, newVal, patches, path + "/" + escapePathComponent(key), invertible);
|
|
11282
|
-
}
|
|
11283
|
-
else {
|
|
11284
|
-
if (oldVal !== newVal) {
|
|
11285
|
-
if (invertible) {
|
|
11286
|
-
patches.push({ op: "test", path: path + "/" + escapePathComponent(key), value: _deepClone(oldVal) });
|
|
11287
|
-
}
|
|
11288
|
-
patches.push({ op: "replace", path: path + "/" + escapePathComponent(key), value: _deepClone(newVal) });
|
|
11289
|
-
}
|
|
11290
|
-
}
|
|
11291
|
-
}
|
|
11292
|
-
else if (Array.isArray(mirror) === Array.isArray(obj)) {
|
|
11293
|
-
if (invertible) {
|
|
11294
|
-
patches.push({ op: "test", path: path + "/" + escapePathComponent(key), value: _deepClone(oldVal) });
|
|
11295
|
-
}
|
|
11296
|
-
patches.push({ op: "remove", path: path + "/" + escapePathComponent(key) });
|
|
11297
|
-
deleted = true; // property has been deleted
|
|
11298
|
-
}
|
|
11299
|
-
else {
|
|
11300
|
-
if (invertible) {
|
|
11301
|
-
patches.push({ op: "test", path: path, value: mirror });
|
|
11302
|
-
}
|
|
11303
|
-
patches.push({ op: "replace", path: path, value: obj });
|
|
11304
|
-
}
|
|
11305
|
-
}
|
|
11306
|
-
if (!deleted && newKeys.length == oldKeys.length) {
|
|
11307
|
-
return;
|
|
11308
|
-
}
|
|
11309
|
-
for (var t = 0; t < newKeys.length; t++) {
|
|
11310
|
-
var key = newKeys[t];
|
|
11311
|
-
if (!hasOwnProperty$b(mirror, key) && obj[key] !== undefined) {
|
|
11312
|
-
patches.push({ op: "add", path: path + "/" + escapePathComponent(key), value: _deepClone(obj[key]) });
|
|
11313
|
-
}
|
|
11314
|
-
}
|
|
11315
|
-
}
|
|
11316
|
-
/**
|
|
11317
|
-
* Create an array of patches from the differences in two objects
|
|
11318
|
-
*/
|
|
11319
|
-
function compare(tree1, tree2, invertible) {
|
|
11320
|
-
if (invertible === void 0) { invertible = false; }
|
|
11321
|
-
var patches = [];
|
|
11322
|
-
_generate(tree1, tree2, patches, '', invertible);
|
|
11323
|
-
return patches;
|
|
11324
|
-
}
|
|
11325
|
-
|
|
11326
|
-
var duplex = /*#__PURE__*/Object.freeze({
|
|
11327
|
-
__proto__: null,
|
|
11328
|
-
compare: compare,
|
|
11329
|
-
generate: generate,
|
|
11330
|
-
observe: observe,
|
|
11331
|
-
unobserve: unobserve
|
|
11332
|
-
});
|
|
11333
|
-
|
|
11334
|
-
Object.assign({}, core, duplex, {
|
|
11335
|
-
JsonPatchError: PatchError,
|
|
11336
|
-
deepClone: _deepClone,
|
|
11337
|
-
escapePathComponent,
|
|
11338
|
-
unescapePathComponent
|
|
11339
|
-
});
|
|
11340
|
-
|
|
11341
9865
|
toast.configure({
|
|
11342
9866
|
autoClose: 3000,
|
|
11343
9867
|
hideProgressBar: true,
|
|
@@ -11735,79 +10259,7 @@ var getUrlWithSearchParams = function (url, params) {
|
|
|
11735
10259
|
/**
|
|
11736
10260
|
* Custom exception logger function for logging errors to sentry
|
|
11737
10261
|
*/
|
|
11738
|
-
var logExceptionToSentry = captureException.bind(window);
|
|
11739
|
-
var customStyles = {
|
|
11740
|
-
control: function (base, state) { return (__assign(__assign({}, base), { minHeight: '32px', boxShadow: 'none', border: 'none', cursor: 'pointer', background: 'transparent' })); },
|
|
11741
|
-
indicatorSeparator: function (base, state) { return (__assign(__assign({}, base), { width: 0 })); },
|
|
11742
|
-
valueContainer: function (base, state) { return (__assign(__assign({}, base), { padding: '0', fontSize: '13px', fontWeight: '600' })); },
|
|
11743
|
-
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)' })); },
|
|
11744
|
-
};
|
|
11745
|
-
var getFilteredChartVersions = function (charts, selectedChartType) {
|
|
11746
|
-
// Filter chart versions based on selected chart type
|
|
11747
|
-
return charts
|
|
11748
|
-
.filter(function (item) { return (item === null || item === void 0 ? void 0 : item.chartType) === selectedChartType.value; })
|
|
11749
|
-
.map(function (item) { return ({
|
|
11750
|
-
value: item === null || item === void 0 ? void 0 : item.chartVersion,
|
|
11751
|
-
label: item === null || item === void 0 ? void 0 : item.chartVersion,
|
|
11752
|
-
chartRefId: item.chartRefId,
|
|
11753
|
-
}); });
|
|
11754
|
-
};
|
|
11755
|
-
function removeEmptyObjectKeysAndNullValues(obj) {
|
|
11756
|
-
//it recursively removes empty object keys and array values that are null
|
|
11757
|
-
for (var key in obj) {
|
|
11758
|
-
if (Array.isArray(obj[key]))
|
|
11759
|
-
obj[key] = obj[key].filter(function (item) { return item !== null; });
|
|
11760
|
-
if (obj[key].length === 0) {
|
|
11761
|
-
// Check if the array is empty
|
|
11762
|
-
delete obj[key]; // Delete the key if the array is empty
|
|
11763
|
-
}
|
|
11764
|
-
else if (obj[key] && typeof obj[key] === 'object') {
|
|
11765
|
-
if (removeEmptyObjectKeysAndNullValues(obj[key])) {
|
|
11766
|
-
delete obj[key];
|
|
11767
|
-
}
|
|
11768
|
-
}
|
|
11769
|
-
else if (obj[key] === null || obj[key] === undefined) {
|
|
11770
|
-
delete obj[key];
|
|
11771
|
-
}
|
|
11772
|
-
}
|
|
11773
|
-
return Object.keys(obj).length === 0;
|
|
11774
|
-
}
|
|
11775
|
-
function getUnlockedJSON(json, jsonPathArray) {
|
|
11776
|
-
var jsonCopy = JSON.parse(JSON.stringify(json));
|
|
11777
|
-
var patches = jsonPathArray.flatMap(function (jsonPath) {
|
|
11778
|
-
var pathsToRemove = JSONPath({ path: jsonPath, json: jsonCopy, resultType: 'all' });
|
|
11779
|
-
return pathsToRemove.map(function (result) {
|
|
11780
|
-
return Array.isArray(result.parent)
|
|
11781
|
-
? { op: 'replace', path: result.pointer, value: null }
|
|
11782
|
-
: { op: 'remove', path: result.pointer };
|
|
11783
|
-
});
|
|
11784
|
-
});
|
|
11785
|
-
var newDocument = applyPatch(jsonCopy, patches).newDocument;
|
|
11786
|
-
removeEmptyObjectKeysAndNullValues(newDocument);
|
|
11787
|
-
return newDocument;
|
|
11788
|
-
}
|
|
11789
|
-
function getLockedJSON(json, jsonPathArray) {
|
|
11790
|
-
var jsonCopy = JSON.parse(JSON.stringify(json));
|
|
11791
|
-
var resultJson = {};
|
|
11792
|
-
jsonPathArray.forEach(function (jsonPath) {
|
|
11793
|
-
var elements = JSONPath({ path: jsonPath, json: jsonCopy, resultType: 'all' });
|
|
11794
|
-
elements.forEach(function (element) {
|
|
11795
|
-
var pathArray = JSONPath.toPathArray(element.path);
|
|
11796
|
-
var lastPath = pathArray.pop();
|
|
11797
|
-
var current = resultJson;
|
|
11798
|
-
for (var i = 0; i < pathArray.length; i++) {
|
|
11799
|
-
var key_1 = isNaN(Number(pathArray[i])) ? pathArray[i] : parseInt(pathArray[i]);
|
|
11800
|
-
if (!current[key_1]) {
|
|
11801
|
-
current[key_1] = isNaN(Number(pathArray[i + 1])) ? {} : [];
|
|
11802
|
-
}
|
|
11803
|
-
current = current[key_1];
|
|
11804
|
-
}
|
|
11805
|
-
var key = isNaN(Number(lastPath)) ? lastPath : parseInt(lastPath);
|
|
11806
|
-
current[key] = element.value;
|
|
11807
|
-
});
|
|
11808
|
-
});
|
|
11809
|
-
return resultJson['$'];
|
|
11810
|
-
}
|
|
10262
|
+
var logExceptionToSentry = captureException.bind(window);
|
|
11811
10263
|
|
|
11812
10264
|
function Progressing(_a) {
|
|
11813
10265
|
var pageLoader = _a.pageLoader, size = _a.size, theme = _a.theme, styles = _a.styles, fillColor = _a.fillColor;
|
|
@@ -11820,7 +10272,7 @@ function DetailsProgressing(_a) {
|
|
|
11820
10272
|
}
|
|
11821
10273
|
|
|
11822
10274
|
var VisibleModal = /** @class */ (function (_super) {
|
|
11823
|
-
__extends
|
|
10275
|
+
__extends(VisibleModal, _super);
|
|
11824
10276
|
function VisibleModal(props) {
|
|
11825
10277
|
var _this = _super.call(this, props) || this;
|
|
11826
10278
|
_this.modalRef = document.getElementById('visible-modal');
|
|
@@ -11951,7 +10403,7 @@ var SvgIcCross = function SvgIcCross(props) {
|
|
|
11951
10403
|
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";
|
|
11952
10404
|
|
|
11953
10405
|
var OpaqueModal = /** @class */ (function (_super) {
|
|
11954
|
-
__extends
|
|
10406
|
+
__extends(OpaqueModal, _super);
|
|
11955
10407
|
function OpaqueModal() {
|
|
11956
10408
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
11957
10409
|
_this.modalRef = document.getElementById('full-screen-modal');
|
|
@@ -11975,7 +10427,7 @@ var OpaqueModal = /** @class */ (function (_super) {
|
|
|
11975
10427
|
}(React.Component));
|
|
11976
10428
|
|
|
11977
10429
|
var VisibleModal2 = /** @class */ (function (_super) {
|
|
11978
|
-
__extends
|
|
10430
|
+
__extends(VisibleModal2, _super);
|
|
11979
10431
|
function VisibleModal2(props) {
|
|
11980
10432
|
var _this = _super.call(this, props) || this;
|
|
11981
10433
|
_this.modalRef = document.getElementById('visible-modal-2');
|
|
@@ -12086,7 +10538,7 @@ var BreadCrumb = function (_a) {
|
|
|
12086
10538
|
|
|
12087
10539
|
var RadioGroupContext = React.createContext({ name: '', value: '', disabled: false, onChange: function (event) { } });
|
|
12088
10540
|
var RadioGroupItem = /** @class */ (function (_super) {
|
|
12089
|
-
__extends
|
|
10541
|
+
__extends(RadioGroupItem, _super);
|
|
12090
10542
|
function RadioGroupItem() {
|
|
12091
10543
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
12092
10544
|
}
|
|
@@ -12099,7 +10551,7 @@ var RadioGroupItem = /** @class */ (function (_super) {
|
|
|
12099
10551
|
return RadioGroupItem;
|
|
12100
10552
|
}(React.Component));
|
|
12101
10553
|
var RadioGroup$1 = /** @class */ (function (_super) {
|
|
12102
|
-
__extends
|
|
10554
|
+
__extends(RadioGroup, _super);
|
|
12103
10555
|
function RadioGroup() {
|
|
12104
10556
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
12105
10557
|
}
|
|
@@ -16670,7 +15122,7 @@ var DeleteDialog = function (props) {
|
|
|
16670
15122
|
}
|
|
16671
15123
|
props.closeDelete();
|
|
16672
15124
|
};
|
|
16673
|
-
return (jsxRuntime.jsxs(ConfirmationDialog, __assign({ className: "confirmation-dialog__body--w-400" }, { children: [jsxRuntime.jsx(ConfirmationDialog.Icon, { src: warn }), jsxRuntime.jsx(ConfirmationDialog.Body, __assign({ title: props.title }, { children: jsxRuntime.jsxs("div", __assign({ className: "fs-13 cn-7 lh-1-54 w-100" }, { children: [props.description ? props.description : null, props.children] })) })), jsxRuntime.jsx(ConfirmationDialog.ButtonGroup, { children: jsxRuntime.jsxs("div", __assign({ className: "flex right" }, { children: [jsxRuntime.jsx("button", __assign({ type: "button", className: "cta cancel cta-cd-delete-modal ml-16", onClick: handleModalClose, disabled: props.apiCallInProgress, "data-testid": "dialog-cancel" }, { children: "Cancel" })), jsxRuntime.jsx("button", __assign({ type: "button", className: "cta delete cta-cd-delete-modal ml-16", onClick: handleDelete, disabled: props.apiCallInProgress, "data-testid": "dialog-delete" }, { children: props.apiCallInProgress ? (jsxRuntime.jsx(Progressing, {})) : ("".concat(props.deletePrefix || '').concat(props.buttonPrimaryText ? props.buttonPrimaryText : 'Delete').concat(props.deletePostfix || '')) }))] })) })] })));
|
|
15125
|
+
return (jsxRuntime.jsxs(ConfirmationDialog, __assign({ className: "confirmation-dialog__body--w-400" }, { children: [jsxRuntime.jsx(ConfirmationDialog.Icon, { src: warn }), jsxRuntime.jsx(ConfirmationDialog.Body, __assign({ title: props.title }, { children: jsxRuntime.jsxs("div", __assign({ className: "fs-13 cn-7 lh-1-54 w-100" }, { children: [props.description ? props.description : null, props.children] })) })), jsxRuntime.jsx(ConfirmationDialog.ButtonGroup, { children: jsxRuntime.jsxs("div", __assign({ className: "flex right" }, { children: [jsxRuntime.jsx("button", __assign({ type: "button", className: "cta cancel cta-cd-delete-modal ml-16", onClick: handleModalClose, disabled: props.apiCallInProgress, "data-testid": "dialog-cancel" }, { children: "Cancel" })), jsxRuntime.jsx("button", __assign({ type: "button", className: "cta delete cta-cd-delete-modal ml-16", onClick: handleDelete, disabled: props.apiCallInProgress || props.disabled, "data-testid": "dialog-delete" }, { children: props.apiCallInProgress ? (jsxRuntime.jsx(Progressing, {})) : ("".concat(props.deletePrefix || '').concat(props.buttonPrimaryText ? props.buttonPrimaryText : 'Delete').concat(props.deletePostfix || '')) }))] })) })] })));
|
|
16674
15126
|
};
|
|
16675
15127
|
function DeleteDialogDescription(props) {
|
|
16676
15128
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children });
|
|
@@ -16680,7 +15132,7 @@ DeleteDialog.Description = DeleteDialogDescription;
|
|
|
16680
15132
|
//TODO: may not need context
|
|
16681
15133
|
var DialogFormContext = React.createContext({ title: '', isLoading: false, close: function (event) { }, onSave: function (event) { } });
|
|
16682
15134
|
var DialogForm = /** @class */ (function (_super) {
|
|
16683
|
-
__extends
|
|
15135
|
+
__extends(DialogForm, _super);
|
|
16684
15136
|
function DialogForm(props) {
|
|
16685
15137
|
var _this = _super.call(this, props) || this;
|
|
16686
15138
|
_this.escFunction = _this.escFunction.bind(_this);
|
|
@@ -16716,7 +15168,7 @@ var DialogForm = /** @class */ (function (_super) {
|
|
|
16716
15168
|
return DialogForm;
|
|
16717
15169
|
}(React.Component));
|
|
16718
15170
|
var DialogFormSubmit = /** @class */ (function (_super) {
|
|
16719
|
-
__extends
|
|
15171
|
+
__extends(DialogFormSubmit, _super);
|
|
16720
15172
|
function DialogFormSubmit() {
|
|
16721
15173
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
16722
15174
|
}
|
|
@@ -24483,9 +22935,6 @@ function createGitCommitUrl(url, revision) {
|
|
|
24483
22935
|
}
|
|
24484
22936
|
}
|
|
24485
22937
|
return "NA";
|
|
24486
|
-
}
|
|
24487
|
-
function fetchChartTemplateVersions() {
|
|
24488
|
-
return get("".concat(ROUTES.DEPLOYMENT_TEMPLATE_LIST, "?appId=-1&envId=-1"));
|
|
24489
22938
|
}
|
|
24490
22939
|
|
|
24491
22940
|
/*
|
|
@@ -24498,7 +22947,7 @@ Valid States of Checkbox:
|
|
|
24498
22947
|
6. disabled: false, checked: true, value: CHECKED
|
|
24499
22948
|
*/
|
|
24500
22949
|
var Checkbox$1 = /** @class */ (function (_super) {
|
|
24501
|
-
__extends
|
|
22950
|
+
__extends(Checkbox, _super);
|
|
24502
22951
|
function Checkbox() {
|
|
24503
22952
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
24504
22953
|
}
|
|
@@ -28200,51 +26649,46 @@ function DevtronProgressing(_a) {
|
|
|
28200
26649
|
return (jsxRuntime.jsx("div", __assign({ className: parentClasses ? parentClasses : '' }, { children: jsxRuntime.jsx(SvgIcRotateDevtron, { className: classes ? classes : '' }) })));
|
|
28201
26650
|
}
|
|
28202
26651
|
|
|
28203
|
-
|
|
28204
|
-
|
|
28205
|
-
|
|
28206
|
-
|
|
28207
|
-
|
|
28208
|
-
|
|
28209
|
-
|
|
28210
|
-
|
|
28211
|
-
var
|
|
28212
|
-
|
|
28213
|
-
|
|
28214
|
-
|
|
28215
|
-
var charts = (res === null || res === void 0 ? void 0 : res.result) || [];
|
|
28216
|
-
setCharts(charts);
|
|
28217
|
-
// Extract unique chart types from the data
|
|
28218
|
-
var chartTypeOptions = __spreadArray([], __read(new Set(charts.map(function (item) { return item.chartType; }))), false).map(function (type) { return ({
|
|
28219
|
-
value: type,
|
|
28220
|
-
label: type,
|
|
28221
|
-
}); });
|
|
28222
|
-
setChartTypeOptions(chartTypeOptions);
|
|
28223
|
-
var filteredVersions = getFilteredChartVersions(charts, chartTypeOptions[0]);
|
|
28224
|
-
selectFirstChartVersion(filteredVersions);
|
|
28225
|
-
})
|
|
28226
|
-
.catch(function (err) {
|
|
28227
|
-
showError(err);
|
|
28228
|
-
});
|
|
28229
|
-
}, []);
|
|
28230
|
-
var selectFirstChartVersion = function (filteredVersions) {
|
|
28231
|
-
var _a;
|
|
28232
|
-
setChartVersionOptions(filteredVersions);
|
|
28233
|
-
setSelectedChartVersion(filteredVersions[0]); // Select the first chart version by default
|
|
28234
|
-
setSelectedChartRefId((_a = filteredVersions[0]) === null || _a === void 0 ? void 0 : _a.chartRefId);
|
|
28235
|
-
};
|
|
28236
|
-
// Function to update chart version options based on selected chart type
|
|
28237
|
-
var handleChartTypeChange = function (selectedOption) {
|
|
28238
|
-
setSelectedChartType(selectedOption);
|
|
28239
|
-
var filteredVersions = getFilteredChartVersions(charts, selectedOption);
|
|
28240
|
-
selectFirstChartVersion(filteredVersions);
|
|
28241
|
-
};
|
|
28242
|
-
// Function to handle the change of the selected chart version
|
|
28243
|
-
var handleChartVersionChange = function (selectedOption) {
|
|
28244
|
-
setSelectedChartVersion(selectedOption);
|
|
28245
|
-
setSelectedChartRefId(selectedOption.chartRefId);
|
|
26652
|
+
function TooltipContent(_a) {
|
|
26653
|
+
var tooltipContent = _a.tooltipContent;
|
|
26654
|
+
if (tooltipContent) {
|
|
26655
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "dc__white-space-pre-wrap" }, { children: [jsxRuntime.jsx("p", __assign({ className: "m-0 cn-0 fs-12 fw-6 lh-18" }, { children: "Click to add" })), tooltipContent] })));
|
|
26656
|
+
}
|
|
26657
|
+
return jsxRuntime.jsx("div", __assign({ className: "dc__white-space-pre-wrap" }, { children: "Click to add here" }));
|
|
26658
|
+
}
|
|
26659
|
+
function AddCDButton(_a) {
|
|
26660
|
+
var position = _a.position, addCDButtons = _a.addCDButtons, endNode = _a.endNode, startNode = _a.startNode, handleAddCD = _a.handleAddCD, tooltipContent = _a.tooltipContent;
|
|
26661
|
+
var referenceNode = position === exports.AddCDPositions.RIGHT ? endNode : startNode;
|
|
26662
|
+
var handleAddCDClick = function () {
|
|
26663
|
+
handleAddCD(position);
|
|
28246
26664
|
};
|
|
28247
|
-
|
|
26665
|
+
if (addCDButtons === null || addCDButtons === void 0 ? void 0 : addCDButtons.includes(position)) {
|
|
26666
|
+
return (jsxRuntime.jsx(Tippy, __assign({ placement: "top", content: jsxRuntime.jsx(TooltipContent, { tooltipContent: tooltipContent }), className: "default-tt", arrow: false }, { children: jsxRuntime.jsxs("svg", __assign({ x: referenceNode.x + (position === exports.AddCDPositions.RIGHT ? -20 - 5 : referenceNode.width + 5),
|
|
26667
|
+
// Here 10 is the height of the button / 2
|
|
26668
|
+
y: referenceNode.y + referenceNode.height / 2 - 10, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", "data-testid": "add-cd-to-".concat(position), onClick: handleAddCDClick, className: "dc__outline-none-imp" }, { children: [jsxRuntime.jsx("rect", { width: "20", height: "20", rx: "10", fill: "#664BEE", className: "add-cd-edge-btn" }), jsxRuntime.jsx("path", { d: "M6.5 10H13.5M10 6.5V13.5", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })) })));
|
|
26669
|
+
}
|
|
26670
|
+
return null;
|
|
26671
|
+
}
|
|
26672
|
+
|
|
26673
|
+
var getPipelineType = function (_a) {
|
|
26674
|
+
var isWebhookCD = _a.isWebhookCD, startNode = _a.startNode;
|
|
26675
|
+
if (isWebhookCD) {
|
|
26676
|
+
return exports.PipelineType.WEBHOOK;
|
|
26677
|
+
}
|
|
26678
|
+
if (startNode.type === exports.WorkflowNodeType.CI) {
|
|
26679
|
+
return exports.PipelineType.CI_PIPELINE;
|
|
26680
|
+
}
|
|
26681
|
+
return exports.PipelineType.CD_PIPELINE;
|
|
26682
|
+
};
|
|
26683
|
+
var handleAddCD = function (_a) {
|
|
26684
|
+
var position = _a.position, handleCDSelect = _a.handleCDSelect, startNode = _a.startNode, endNode = _a.endNode, workflowId = _a.workflowId, ciPipelineId = _a.ciPipelineId, isWebhookCD = _a.isWebhookCD, isParallelEdge = _a.isParallelEdge;
|
|
26685
|
+
if (!handleCDSelect) {
|
|
26686
|
+
return;
|
|
26687
|
+
}
|
|
26688
|
+
var pipelineType = getPipelineType({ isWebhookCD: isWebhookCD, startNode: startNode });
|
|
26689
|
+
var addPipelineType = isParallelEdge && position === exports.AddCDPositions.RIGHT ? exports.AddPipelineType.PARALLEL : exports.AddPipelineType.SEQUENTIAL;
|
|
26690
|
+
var endNodeId = !isParallelEdge && position === exports.AddCDPositions.RIGHT ? endNode.id : null;
|
|
26691
|
+
handleCDSelect(workflowId, ciPipelineId, pipelineType, startNode.id, isWebhookCD, endNodeId, addPipelineType);
|
|
28248
26692
|
};
|
|
28249
26693
|
|
|
28250
26694
|
function CustomInput(_a) {
|
|
@@ -28303,12 +26747,12 @@ function CustomInput(_a) {
|
|
|
28303
26747
|
}, 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 }))] })))] })));
|
|
28304
26748
|
}
|
|
28305
26749
|
|
|
26750
|
+
exports.AddCDButton = AddCDButton;
|
|
28306
26751
|
exports.AppStatus = AppStatus;
|
|
28307
26752
|
exports.BreadCrumb = BreadCrumb;
|
|
28308
26753
|
exports.BreadcrumbStore = Store;
|
|
28309
26754
|
exports.BuildStageVariable = BuildStageVariable;
|
|
28310
26755
|
exports.CDModalTab = CDModalTab;
|
|
28311
|
-
exports.ChartVersionAndTypeSelector = ChartVersionAndTypeSelector;
|
|
28312
26756
|
exports.Checkbox = Checkbox$1;
|
|
28313
26757
|
exports.ClearIndicator = ClearIndicator;
|
|
28314
26758
|
exports.ClipboardButton = ClipboardButton;
|
|
@@ -28381,24 +26825,20 @@ exports.VisibleModal2 = VisibleModal2;
|
|
|
28381
26825
|
exports.closeOnEscKeyPressed = closeOnEscKeyPressed;
|
|
28382
26826
|
exports.copyToClipboard = copyToClipboard;
|
|
28383
26827
|
exports.createGitCommitUrl = createGitCommitUrl;
|
|
28384
|
-
exports.customStyles = customStyles;
|
|
28385
26828
|
exports.extractImage = extractImage;
|
|
28386
|
-
exports.fetchChartTemplateVersions = fetchChartTemplateVersions;
|
|
28387
26829
|
exports.genericCDMaterialsService = genericCDMaterialsService;
|
|
28388
26830
|
exports.get = get;
|
|
28389
26831
|
exports.getAlphabetIcon = getAlphabetIcon;
|
|
28390
26832
|
exports.getCookie = getCookie;
|
|
28391
26833
|
exports.getEmptyArrayOfLength = getEmptyArrayOfLength;
|
|
28392
|
-
exports.getFilteredChartVersions = getFilteredChartVersions;
|
|
28393
26834
|
exports.getInferredTypeFromValueType = getInferredTypeFromValueType;
|
|
28394
|
-
exports.getLockedJSON = getLockedJSON;
|
|
28395
26835
|
exports.getLoginInfo = getLoginInfo;
|
|
28396
26836
|
exports.getRandomColor = getRandomColor;
|
|
28397
26837
|
exports.getRedirectionProps = getRedirectionProps;
|
|
28398
26838
|
exports.getTeamListMin = getTeamListMin;
|
|
28399
|
-
exports.getUnlockedJSON = getUnlockedJSON;
|
|
28400
26839
|
exports.getUrlWithSearchParams = getUrlWithSearchParams;
|
|
28401
26840
|
exports.getUserRole = getUserRole;
|
|
26841
|
+
exports.handleAddCD = handleAddCD;
|
|
28402
26842
|
exports.handleUTCTime = handleUTCTime;
|
|
28403
26843
|
exports.logExceptionToSentry = logExceptionToSentry;
|
|
28404
26844
|
exports.multiSelectStyles = multiSelectStyles;
|