@thoughtspot/visual-embed-sdk 1.40.1 → 1.40.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/package.json +1 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +5 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +33 -3
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +2 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +22 -0
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +12 -0
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +122 -0
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/errors.d.ts +10 -0
- package/cjs/src/errors.d.ts.map +1 -1
- package/cjs/src/errors.js +11 -1
- package/cjs/src/errors.js.map +1 -1
- package/cjs/src/index.d.ts +2 -2
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +3 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/react/index.d.ts +1 -1
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +2 -1
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/types.d.ts +131 -5
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +39 -11
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/custom-actions.d.ts +12 -0
- package/cjs/src/utils/custom-actions.d.ts.map +1 -0
- package/cjs/src/utils/custom-actions.js +180 -0
- package/cjs/src/utils/custom-actions.js.map +1 -0
- package/cjs/src/utils/custom-actions.spec.d.ts +2 -0
- package/cjs/src/utils/custom-actions.spec.d.ts.map +1 -0
- package/cjs/src/utils/custom-actions.spec.js +399 -0
- package/cjs/src/utils/custom-actions.spec.js.map +1 -0
- package/cjs/src/utils/processData.d.ts.map +1 -1
- package/cjs/src/utils/processData.js +10 -0
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +11 -0
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/cjs/src/utils.d.ts +7 -0
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +11 -1
- package/cjs/src/utils.js.map +1 -1
- package/cjs/src/utils.spec.js +28 -0
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/{index-P5YjBOuJ.js → index-BICLzyVL.js} +1 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/dist/src/errors.d.ts +10 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +1 -1
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +131 -5
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/custom-actions.d.ts +12 -0
- package/dist/src/utils/custom-actions.d.ts.map +1 -0
- package/dist/src/utils/custom-actions.spec.d.ts +2 -0
- package/dist/src/utils/custom-actions.spec.d.ts.map +1 -0
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/src/utils.d.ts +7 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +1705 -203
- package/dist/tsembed-react.js +1704 -202
- package/dist/tsembed.es.js +1653 -151
- package/dist/tsembed.js +1652 -150
- package/dist/visual-embed-sdk-react-full.d.ts +132 -6
- package/dist/visual-embed-sdk-react.d.ts +132 -6
- package/dist/visual-embed-sdk.d.ts +132 -6
- package/lib/package.json +1 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +5 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +33 -3
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +2 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +22 -0
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +12 -0
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +123 -1
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts +10 -0
- package/lib/src/errors.d.ts.map +1 -1
- package/lib/src/errors.js +10 -0
- package/lib/src/errors.js.map +1 -1
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/react/index.d.ts +1 -1
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +1 -1
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/types.d.ts +131 -5
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +38 -10
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/custom-actions.d.ts +12 -0
- package/lib/src/utils/custom-actions.d.ts.map +1 -0
- package/lib/src/utils/custom-actions.js +175 -0
- package/lib/src/utils/custom-actions.js.map +1 -0
- package/lib/src/utils/custom-actions.spec.d.ts +2 -0
- package/lib/src/utils/custom-actions.spec.d.ts.map +1 -0
- package/lib/src/utils/custom-actions.spec.js +397 -0
- package/lib/src/utils/custom-actions.spec.js.map +1 -0
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +10 -0
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +11 -0
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils.d.ts +7 -0
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +9 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +29 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +133 -7
- package/package.json +1 -1
- package/src/embed/app.spec.ts +48 -3
- package/src/embed/app.ts +5 -0
- package/src/embed/liveboard.spec.ts +30 -0
- package/src/embed/liveboard.ts +2 -0
- package/src/embed/ts-embed.spec.ts +135 -1
- package/src/embed/ts-embed.ts +12 -0
- package/src/errors.ts +11 -0
- package/src/index.ts +4 -0
- package/src/react/index.tsx +1 -0
- package/src/types.ts +147 -16
- package/src/utils/custom-actions.spec.ts +431 -0
- package/src/utils/custom-actions.ts +217 -0
- package/src/utils/processData.spec.ts +12 -0
- package/src/utils/processData.ts +10 -0
- package/src/utils.spec.ts +34 -0
- package/src/utils.ts +10 -0
package/dist/tsembed.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.40.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.40.3 */
|
|
2
2
|
'use client';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -379,6 +379,15 @@
|
|
|
379
379
|
* @returns The stored value or `undefined` if the key is not found.
|
|
380
380
|
*/
|
|
381
381
|
const getValueFromWindow = (key) => { var _a; return (_a = window === null || window === void 0 ? void 0 : window[sdkWindowKey]) === null || _a === void 0 ? void 0 : _a[key]; };
|
|
382
|
+
/**
|
|
383
|
+
* Check if an array includes a string value
|
|
384
|
+
* @param arr - The array to check
|
|
385
|
+
* @param key - The string to search for
|
|
386
|
+
* @returns boolean indicating if the string is found in the array
|
|
387
|
+
*/
|
|
388
|
+
const arrayIncludesString = (arr, key) => {
|
|
389
|
+
return arr.some(item => typeof item === 'string' && item === key);
|
|
390
|
+
};
|
|
382
391
|
/**
|
|
383
392
|
* Check if the document is currently in fullscreen mode
|
|
384
393
|
*/
|
|
@@ -474,7 +483,6 @@
|
|
|
474
483
|
* the embedded app
|
|
475
484
|
* @group Authentication / Init
|
|
476
485
|
*/
|
|
477
|
-
// eslint-disable-next-line no-shadow
|
|
478
486
|
exports.AuthType = void 0;
|
|
479
487
|
(function (AuthType) {
|
|
480
488
|
/**
|
|
@@ -688,7 +696,6 @@
|
|
|
688
696
|
/**
|
|
689
697
|
* A map of the supported runtime filter operations
|
|
690
698
|
*/
|
|
691
|
-
// eslint-disable-next-line no-shadow
|
|
692
699
|
exports.RuntimeFilterOp = void 0;
|
|
693
700
|
(function (RuntimeFilterOp) {
|
|
694
701
|
/**
|
|
@@ -759,7 +766,6 @@
|
|
|
759
766
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
760
767
|
* @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw
|
|
761
768
|
*/
|
|
762
|
-
// eslint-disable-next-line no-shadow
|
|
763
769
|
exports.HomepageModule = void 0;
|
|
764
770
|
(function (HomepageModule) {
|
|
765
771
|
/**
|
|
@@ -792,7 +798,6 @@
|
|
|
792
798
|
* **Note**: This option is applicable to full app embedding only.
|
|
793
799
|
* @version SDK: 1.38.0 | ThoughtSpot: 10.9.0.cl
|
|
794
800
|
*/
|
|
795
|
-
// eslint-disable-next-line no-shadow
|
|
796
801
|
exports.ListPageColumns = void 0;
|
|
797
802
|
(function (ListPageColumns) {
|
|
798
803
|
/**
|
|
@@ -855,7 +860,6 @@
|
|
|
855
860
|
* ```
|
|
856
861
|
* @group Events
|
|
857
862
|
*/
|
|
858
|
-
// eslint-disable-next-line no-shadow
|
|
859
863
|
exports.EmbedEvent = void 0;
|
|
860
864
|
(function (EmbedEvent) {
|
|
861
865
|
/**
|
|
@@ -1497,6 +1501,11 @@
|
|
|
1497
1501
|
* @hidden
|
|
1498
1502
|
*/
|
|
1499
1503
|
EmbedEvent["APP_INIT"] = "appInit";
|
|
1504
|
+
/**
|
|
1505
|
+
* Internal event to clear the cached info
|
|
1506
|
+
* @hidden
|
|
1507
|
+
*/
|
|
1508
|
+
EmbedEvent["CLEAR_INFO_CACHE"] = "clearInfoCache";
|
|
1500
1509
|
/**
|
|
1501
1510
|
* Emitted when a user clicks **Show Liveboard details** on a Liveboard
|
|
1502
1511
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
@@ -1965,6 +1974,17 @@
|
|
|
1965
1974
|
* ```
|
|
1966
1975
|
*/
|
|
1967
1976
|
EmbedEvent["EmbedListenerReady"] = "EmbedListenerReady";
|
|
1977
|
+
/**
|
|
1978
|
+
* Emitted when the organization is switched.
|
|
1979
|
+
* @example
|
|
1980
|
+
* ```js
|
|
1981
|
+
* appEmbed.on(EmbedEvent.OrgSwitched, (payload) => {
|
|
1982
|
+
* console.log('payload', payload);
|
|
1983
|
+
* })
|
|
1984
|
+
* ```
|
|
1985
|
+
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
1986
|
+
*/
|
|
1987
|
+
EmbedEvent["OrgSwitched"] = "orgSwitched";
|
|
1968
1988
|
})(exports.EmbedEvent || (exports.EmbedEvent = {}));
|
|
1969
1989
|
/**
|
|
1970
1990
|
* Event types that can be triggered by the host application
|
|
@@ -2019,7 +2039,6 @@
|
|
|
2019
2039
|
* ```
|
|
2020
2040
|
* @group Events
|
|
2021
2041
|
*/
|
|
2022
|
-
// eslint-disable-next-line no-shadow
|
|
2023
2042
|
exports.HostEvent = void 0;
|
|
2024
2043
|
(function (HostEvent) {
|
|
2025
2044
|
/**
|
|
@@ -3234,7 +3253,6 @@
|
|
|
3234
3253
|
* The different visual modes that the data sources panel within
|
|
3235
3254
|
* search could appear in, such as hidden, collapsed, or expanded.
|
|
3236
3255
|
*/
|
|
3237
|
-
// eslint-disable-next-line no-shadow
|
|
3238
3256
|
exports.DataSourceVisualMode = void 0;
|
|
3239
3257
|
(function (DataSourceVisualMode) {
|
|
3240
3258
|
/**
|
|
@@ -3254,7 +3272,6 @@
|
|
|
3254
3272
|
* The query params passed down to the embedded ThoughtSpot app
|
|
3255
3273
|
* containing configuration and/or visual information.
|
|
3256
3274
|
*/
|
|
3257
|
-
// eslint-disable-next-line no-shadow
|
|
3258
3275
|
var Param;
|
|
3259
3276
|
(function (Param) {
|
|
3260
3277
|
Param["EmbedApp"] = "embedApp";
|
|
@@ -3376,6 +3393,7 @@
|
|
|
3376
3393
|
Param["IsLiveboardStylingAndGroupingEnabled"] = "isLiveboardStylingAndGroupingEnabled";
|
|
3377
3394
|
Param["IsLazyLoadingForEmbedEnabled"] = "isLazyLoadingForEmbedEnabled";
|
|
3378
3395
|
Param["RootMarginForLazyLoad"] = "rootMarginForLazyLoad";
|
|
3396
|
+
Param["LiveboardXLSXCSVDownload"] = "isLiveboardXLSXCSVDownloadEnabled";
|
|
3379
3397
|
})(Param || (Param = {}));
|
|
3380
3398
|
/**
|
|
3381
3399
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -3404,7 +3422,6 @@
|
|
|
3404
3422
|
* ```
|
|
3405
3423
|
* See also link:https://developers.thoughtspot.com/docs/actions[Action IDs in the SDK]
|
|
3406
3424
|
*/
|
|
3407
|
-
// eslint-disable-next-line no-shadow
|
|
3408
3425
|
exports.Action = void 0;
|
|
3409
3426
|
(function (Action) {
|
|
3410
3427
|
/**
|
|
@@ -3949,7 +3966,7 @@
|
|
|
3949
3966
|
* The Favorites icon (*) for Answers,
|
|
3950
3967
|
* Liveboard, and data objects like Worksheet, Model,
|
|
3951
3968
|
* Tables and Views.
|
|
3952
|
-
* Allows adding an object to the user
|
|
3969
|
+
* Allows adding an object to the user's favorites list.
|
|
3953
3970
|
* @example
|
|
3954
3971
|
* ```js
|
|
3955
3972
|
* disabledActions: [Action.AddToFavorites]
|
|
@@ -4676,6 +4693,26 @@
|
|
|
4676
4693
|
ContextMenuTriggerOptions["RIGHT_CLICK"] = "right-click";
|
|
4677
4694
|
ContextMenuTriggerOptions["BOTH_CLICKS"] = "both-clicks";
|
|
4678
4695
|
})(exports.ContextMenuTriggerOptions || (exports.ContextMenuTriggerOptions = {}));
|
|
4696
|
+
/**
|
|
4697
|
+
* Enum options to show custom actions at different
|
|
4698
|
+
* positions in the application.
|
|
4699
|
+
*/
|
|
4700
|
+
exports.CustomActionsPosition = void 0;
|
|
4701
|
+
(function (CustomActionsPosition) {
|
|
4702
|
+
CustomActionsPosition["PRIMARY"] = "PRIMARY";
|
|
4703
|
+
CustomActionsPosition["MENU"] = "MENU";
|
|
4704
|
+
CustomActionsPosition["CONTEXTMENU"] = "CONTEXTMENU";
|
|
4705
|
+
})(exports.CustomActionsPosition || (exports.CustomActionsPosition = {}));
|
|
4706
|
+
/**
|
|
4707
|
+
* Enum options to mention the target of the custom action.
|
|
4708
|
+
*/
|
|
4709
|
+
exports.CustomActionTarget = void 0;
|
|
4710
|
+
(function (CustomActionTarget) {
|
|
4711
|
+
CustomActionTarget["LIVEBOARD"] = "LIVEBOARD";
|
|
4712
|
+
CustomActionTarget["VIZ"] = "VIZ";
|
|
4713
|
+
CustomActionTarget["ANSWER"] = "ANSWER";
|
|
4714
|
+
CustomActionTarget["SPOTTER"] = "SPOTTER";
|
|
4715
|
+
})(exports.CustomActionTarget || (exports.CustomActionTarget = {}));
|
|
4679
4716
|
/**
|
|
4680
4717
|
* Enum options to show or suppress Visual Embed SDK and
|
|
4681
4718
|
* ThoughtSpot application logs in the console output.
|
|
@@ -5832,8 +5869,8 @@
|
|
|
5832
5869
|
var _cacheHas = cacheHas;
|
|
5833
5870
|
|
|
5834
5871
|
/** Used to compose bitmasks for value comparisons. */
|
|
5835
|
-
var COMPARE_PARTIAL_FLAG$
|
|
5836
|
-
COMPARE_UNORDERED_FLAG$
|
|
5872
|
+
var COMPARE_PARTIAL_FLAG$5 = 1,
|
|
5873
|
+
COMPARE_UNORDERED_FLAG$3 = 2;
|
|
5837
5874
|
|
|
5838
5875
|
/**
|
|
5839
5876
|
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
@@ -5849,7 +5886,7 @@
|
|
|
5849
5886
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
5850
5887
|
*/
|
|
5851
5888
|
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
5852
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
5889
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,
|
|
5853
5890
|
arrLength = array.length,
|
|
5854
5891
|
othLength = other.length;
|
|
5855
5892
|
|
|
@@ -5864,7 +5901,7 @@
|
|
|
5864
5901
|
}
|
|
5865
5902
|
var index = -1,
|
|
5866
5903
|
result = true,
|
|
5867
|
-
seen = (bitmask & COMPARE_UNORDERED_FLAG$
|
|
5904
|
+
seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new _SetCache : undefined;
|
|
5868
5905
|
|
|
5869
5906
|
stack.set(array, other);
|
|
5870
5907
|
stack.set(other, array);
|
|
@@ -5956,8 +5993,8 @@
|
|
|
5956
5993
|
var _setToArray = setToArray;
|
|
5957
5994
|
|
|
5958
5995
|
/** Used to compose bitmasks for value comparisons. */
|
|
5959
|
-
var COMPARE_PARTIAL_FLAG$
|
|
5960
|
-
COMPARE_UNORDERED_FLAG = 2;
|
|
5996
|
+
var COMPARE_PARTIAL_FLAG$4 = 1,
|
|
5997
|
+
COMPARE_UNORDERED_FLAG$2 = 2;
|
|
5961
5998
|
|
|
5962
5999
|
/** `Object#toString` result references. */
|
|
5963
6000
|
var boolTag$2 = '[object Boolean]',
|
|
@@ -5968,14 +6005,14 @@
|
|
|
5968
6005
|
regexpTag$1 = '[object RegExp]',
|
|
5969
6006
|
setTag$3 = '[object Set]',
|
|
5970
6007
|
stringTag$1 = '[object String]',
|
|
5971
|
-
symbolTag = '[object Symbol]';
|
|
6008
|
+
symbolTag$1 = '[object Symbol]';
|
|
5972
6009
|
|
|
5973
6010
|
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
5974
6011
|
dataViewTag$2 = '[object DataView]';
|
|
5975
6012
|
|
|
5976
6013
|
/** Used to convert symbols to primitives and strings. */
|
|
5977
|
-
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
5978
|
-
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
6014
|
+
var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined,
|
|
6015
|
+
symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
|
|
5979
6016
|
|
|
5980
6017
|
/**
|
|
5981
6018
|
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
@@ -6032,7 +6069,7 @@
|
|
|
6032
6069
|
var convert = _mapToArray;
|
|
6033
6070
|
|
|
6034
6071
|
case setTag$3:
|
|
6035
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
6072
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
|
|
6036
6073
|
convert || (convert = _setToArray);
|
|
6037
6074
|
|
|
6038
6075
|
if (object.size != other.size && !isPartial) {
|
|
@@ -6043,7 +6080,7 @@
|
|
|
6043
6080
|
if (stacked) {
|
|
6044
6081
|
return stacked == other;
|
|
6045
6082
|
}
|
|
6046
|
-
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
6083
|
+
bitmask |= COMPARE_UNORDERED_FLAG$2;
|
|
6047
6084
|
|
|
6048
6085
|
// Recursively compare objects (susceptible to call stack limits).
|
|
6049
6086
|
stack.set(object, other);
|
|
@@ -6051,7 +6088,7 @@
|
|
|
6051
6088
|
stack['delete'](object);
|
|
6052
6089
|
return result;
|
|
6053
6090
|
|
|
6054
|
-
case symbolTag:
|
|
6091
|
+
case symbolTag$1:
|
|
6055
6092
|
if (symbolValueOf) {
|
|
6056
6093
|
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
6057
6094
|
}
|
|
@@ -6742,7 +6779,7 @@
|
|
|
6742
6779
|
var _getAllKeys = getAllKeys;
|
|
6743
6780
|
|
|
6744
6781
|
/** Used to compose bitmasks for value comparisons. */
|
|
6745
|
-
var COMPARE_PARTIAL_FLAG$
|
|
6782
|
+
var COMPARE_PARTIAL_FLAG$3 = 1;
|
|
6746
6783
|
|
|
6747
6784
|
/** Used for built-in method references. */
|
|
6748
6785
|
var objectProto$2 = Object.prototype;
|
|
@@ -6764,7 +6801,7 @@
|
|
|
6764
6801
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
6765
6802
|
*/
|
|
6766
6803
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
6767
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
6804
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
|
|
6768
6805
|
objProps = _getAllKeys(object),
|
|
6769
6806
|
objLength = objProps.length,
|
|
6770
6807
|
othProps = _getAllKeys(other),
|
|
@@ -6902,7 +6939,7 @@
|
|
|
6902
6939
|
var _getTag = getTag;
|
|
6903
6940
|
|
|
6904
6941
|
/** Used to compose bitmasks for value comparisons. */
|
|
6905
|
-
var COMPARE_PARTIAL_FLAG = 1;
|
|
6942
|
+
var COMPARE_PARTIAL_FLAG$2 = 1;
|
|
6906
6943
|
|
|
6907
6944
|
/** `Object#toString` result references. */
|
|
6908
6945
|
var argsTag = '[object Arguments]',
|
|
@@ -6955,7 +6992,7 @@
|
|
|
6955
6992
|
? _equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
|
6956
6993
|
: _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
6957
6994
|
}
|
|
6958
|
-
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
6995
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
|
|
6959
6996
|
var objIsWrapped = objIsObj && hasOwnProperty$2.call(object, '__wrapped__'),
|
|
6960
6997
|
othIsWrapped = othIsObj && hasOwnProperty$2.call(other, '__wrapped__');
|
|
6961
6998
|
|
|
@@ -7125,6 +7162,16 @@
|
|
|
7125
7162
|
MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
|
|
7126
7163
|
RENDER_CALLED_BEFORE_INIT: 'Looks like render was called before calling init, the render won\'t start until init is called.\nFor more info check\n1. https://developers.thoughtspot.com/docs/Function_init#_init\n2.https://developers.thoughtspot.com/docs/getting-started#initSdk',
|
|
7127
7164
|
SPOTTER_AGENT_NOT_INITIALIZED: 'SpotterAgent not initialized',
|
|
7165
|
+
};
|
|
7166
|
+
const CUSTOM_ACTIONS_ERROR_MESSAGE = {
|
|
7167
|
+
INVALID_ACTION_OBJECT: 'Custom Action Validation Error: Invalid action object provided',
|
|
7168
|
+
MISSING_REQUIRED_FIELDS: (id, missingFields) => `Custom Action Validation Error for '${id}': Missing required fields: ${missingFields.join(', ')}`,
|
|
7169
|
+
UNSUPPORTED_TARGET: (id, targetType) => `Custom Action Validation Error for '${id}': Target type '${targetType}' is not supported`,
|
|
7170
|
+
INVALID_POSITION: (position, targetType, supportedPositions) => `Position '${position}' is not supported for ${targetType.toLowerCase()}-level custom actions. Supported positions: ${supportedPositions}`,
|
|
7171
|
+
INVALID_METADATA_IDS: (targetType, invalidIds, supportedIds) => `Invalid metadata IDs for ${targetType.toLowerCase()}-level custom actions: ${invalidIds.join(', ')}. Supported metadata IDs: ${supportedIds}`,
|
|
7172
|
+
INVALID_DATA_MODEL_IDS: (targetType, invalidIds, supportedIds) => `Invalid data model IDs for ${targetType.toLowerCase()}-level custom actions: ${invalidIds.join(', ')}. Supported data model IDs: ${supportedIds}`,
|
|
7173
|
+
INVALID_FIELDS: (targetType, invalidFields, supportedFields) => `Invalid fields for ${targetType.toLowerCase()}-level custom actions: ${invalidFields.join(', ')}. Supported fields: ${supportedFields}`,
|
|
7174
|
+
DUPLICATE_IDS: (id, duplicateNames, keptName) => `Duplicate custom action ID '${id}' found. Actions with names '${duplicateNames.join("', '")}' will be ignored. Keeping '${keptName}'.`,
|
|
7128
7175
|
};
|
|
7129
7176
|
|
|
7130
7177
|
const EndPoints = {
|
|
@@ -7977,141 +8024,1571 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
7977
8024
|
if (columnsToRemove.length) {
|
|
7978
8025
|
await unaggAnswerSession.removeColumns(columnsToRemove);
|
|
7979
8026
|
}
|
|
7980
|
-
return unaggAnswerSession;
|
|
7981
|
-
}
|
|
7982
|
-
/**
|
|
7983
|
-
* Execute a custom graphql query in the context of the answer.
|
|
7984
|
-
* @param query graphql query
|
|
7985
|
-
* @param variables graphql variables
|
|
7986
|
-
* @returns
|
|
7987
|
-
*/
|
|
7988
|
-
async executeQuery(query, variables) {
|
|
7989
|
-
const data = await graphqlQuery({
|
|
7990
|
-
query,
|
|
7991
|
-
variables: {
|
|
7992
|
-
session: this.session,
|
|
7993
|
-
...variables,
|
|
7994
|
-
},
|
|
7995
|
-
thoughtSpotHost: this.thoughtSpotHost,
|
|
7996
|
-
isCompositeQuery: false,
|
|
7997
|
-
});
|
|
7998
|
-
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
7999
|
-
return data;
|
|
8000
|
-
}
|
|
8001
|
-
/**
|
|
8002
|
-
* Get the internal session details for the answer.
|
|
8003
|
-
* @returns
|
|
8004
|
-
*/
|
|
8005
|
-
getSession() {
|
|
8006
|
-
return this.session;
|
|
8027
|
+
return unaggAnswerSession;
|
|
8028
|
+
}
|
|
8029
|
+
/**
|
|
8030
|
+
* Execute a custom graphql query in the context of the answer.
|
|
8031
|
+
* @param query graphql query
|
|
8032
|
+
* @param variables graphql variables
|
|
8033
|
+
* @returns
|
|
8034
|
+
*/
|
|
8035
|
+
async executeQuery(query, variables) {
|
|
8036
|
+
const data = await graphqlQuery({
|
|
8037
|
+
query,
|
|
8038
|
+
variables: {
|
|
8039
|
+
session: this.session,
|
|
8040
|
+
...variables,
|
|
8041
|
+
},
|
|
8042
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
8043
|
+
isCompositeQuery: false,
|
|
8044
|
+
});
|
|
8045
|
+
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
8046
|
+
return data;
|
|
8047
|
+
}
|
|
8048
|
+
/**
|
|
8049
|
+
* Get the internal session details for the answer.
|
|
8050
|
+
* @returns
|
|
8051
|
+
*/
|
|
8052
|
+
getSession() {
|
|
8053
|
+
return this.session;
|
|
8054
|
+
}
|
|
8055
|
+
async getAnswer() {
|
|
8056
|
+
if (this.answer) {
|
|
8057
|
+
return this.answer;
|
|
8058
|
+
}
|
|
8059
|
+
this.answer = this.executeQuery(getAnswer, {}).then((data) => data === null || data === void 0 ? void 0 : data.answer);
|
|
8060
|
+
return this.answer;
|
|
8061
|
+
}
|
|
8062
|
+
async getTML() {
|
|
8063
|
+
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
8064
|
+
const edoc = object[0].edoc;
|
|
8065
|
+
const YAML = await Promise.resolve().then(function () { return index; });
|
|
8066
|
+
const parsedDoc = YAML.parse(edoc);
|
|
8067
|
+
return {
|
|
8068
|
+
answer: {
|
|
8069
|
+
...parsedDoc.answer,
|
|
8070
|
+
...this.tmlOverride,
|
|
8071
|
+
},
|
|
8072
|
+
};
|
|
8073
|
+
}
|
|
8074
|
+
async addDisplayedVizToLiveboard(liveboardId) {
|
|
8075
|
+
const { displayMode, visualizations } = await this.getAnswer();
|
|
8076
|
+
const viz = getDisplayedViz(visualizations, displayMode);
|
|
8077
|
+
return this.executeQuery(addVizToLiveboard, {
|
|
8078
|
+
liveboardId,
|
|
8079
|
+
vizId: viz.id,
|
|
8080
|
+
});
|
|
8081
|
+
}
|
|
8082
|
+
setTMLOverride(override) {
|
|
8083
|
+
this.tmlOverride = override;
|
|
8084
|
+
}
|
|
8085
|
+
}
|
|
8086
|
+
/**
|
|
8087
|
+
*
|
|
8088
|
+
* @param sourceDetail
|
|
8089
|
+
* @param colNames
|
|
8090
|
+
*/
|
|
8091
|
+
function getGuidsFromColumnNames(sourceDetail, colNames) {
|
|
8092
|
+
const cols = sourceDetail.columns.reduce((colSet, col) => {
|
|
8093
|
+
colSet[col.name.toLowerCase()] = col;
|
|
8094
|
+
return colSet;
|
|
8095
|
+
}, {});
|
|
8096
|
+
return new Set(colNames.map((colName) => {
|
|
8097
|
+
const col = cols[colName.toLowerCase()];
|
|
8098
|
+
return col.id;
|
|
8099
|
+
}));
|
|
8100
|
+
}
|
|
8101
|
+
/**
|
|
8102
|
+
*
|
|
8103
|
+
* @param selectedPoints
|
|
8104
|
+
*/
|
|
8105
|
+
function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
|
|
8106
|
+
const underlyingDataPoint = [];
|
|
8107
|
+
/**
|
|
8108
|
+
*
|
|
8109
|
+
* @param colVal
|
|
8110
|
+
*/
|
|
8111
|
+
function addPointFromColVal(colVal) {
|
|
8112
|
+
var _a;
|
|
8113
|
+
const dataType = colVal.column.dataType;
|
|
8114
|
+
colVal.column.id;
|
|
8115
|
+
let dataValue;
|
|
8116
|
+
if (dataType === 'DATE') {
|
|
8117
|
+
if (Number.isFinite(colVal.value)) {
|
|
8118
|
+
dataValue = [{
|
|
8119
|
+
epochRange: {
|
|
8120
|
+
startEpoch: colVal.value,
|
|
8121
|
+
},
|
|
8122
|
+
}];
|
|
8123
|
+
// Case for custom calendar.
|
|
8124
|
+
}
|
|
8125
|
+
else if ((_a = colVal.value) === null || _a === void 0 ? void 0 : _a.v) {
|
|
8126
|
+
dataValue = [{
|
|
8127
|
+
epochRange: {
|
|
8128
|
+
startEpoch: colVal.value.v.s,
|
|
8129
|
+
endEpoch: colVal.value.v.e,
|
|
8130
|
+
},
|
|
8131
|
+
}];
|
|
8132
|
+
}
|
|
8133
|
+
}
|
|
8134
|
+
else {
|
|
8135
|
+
dataValue = [{ value: colVal.value }];
|
|
8136
|
+
}
|
|
8137
|
+
underlyingDataPoint.push({
|
|
8138
|
+
columnId: colVal.column.id,
|
|
8139
|
+
dataValue,
|
|
8140
|
+
});
|
|
8141
|
+
}
|
|
8142
|
+
selectedPoints.forEach((p) => {
|
|
8143
|
+
p.selectedAttributes.forEach(addPointFromColVal);
|
|
8144
|
+
});
|
|
8145
|
+
return underlyingDataPoint;
|
|
8146
|
+
}
|
|
8147
|
+
/**
|
|
8148
|
+
*
|
|
8149
|
+
* @param visualizations
|
|
8150
|
+
* @param displayMode
|
|
8151
|
+
*/
|
|
8152
|
+
function getDisplayedViz(visualizations, displayMode) {
|
|
8153
|
+
if (displayMode === 'CHART_MODE') {
|
|
8154
|
+
return visualizations.find(
|
|
8155
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
8156
|
+
(viz) => viz.__typename === 'ChartViz');
|
|
8157
|
+
}
|
|
8158
|
+
return visualizations.find(
|
|
8159
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
8160
|
+
(viz) => viz.__typename === 'TableViz');
|
|
8161
|
+
}
|
|
8162
|
+
|
|
8163
|
+
/** Built-in value references. */
|
|
8164
|
+
var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined;
|
|
8165
|
+
|
|
8166
|
+
/**
|
|
8167
|
+
* Checks if `value` is a flattenable `arguments` object or array.
|
|
8168
|
+
*
|
|
8169
|
+
* @private
|
|
8170
|
+
* @param {*} value The value to check.
|
|
8171
|
+
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
|
8172
|
+
*/
|
|
8173
|
+
function isFlattenable(value) {
|
|
8174
|
+
return isArray_1(value) || isArguments_1(value) ||
|
|
8175
|
+
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
8176
|
+
}
|
|
8177
|
+
|
|
8178
|
+
var _isFlattenable = isFlattenable;
|
|
8179
|
+
|
|
8180
|
+
/**
|
|
8181
|
+
* The base implementation of `_.flatten` with support for restricting flattening.
|
|
8182
|
+
*
|
|
8183
|
+
* @private
|
|
8184
|
+
* @param {Array} array The array to flatten.
|
|
8185
|
+
* @param {number} depth The maximum recursion depth.
|
|
8186
|
+
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
|
8187
|
+
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
|
8188
|
+
* @param {Array} [result=[]] The initial result value.
|
|
8189
|
+
* @returns {Array} Returns the new flattened array.
|
|
8190
|
+
*/
|
|
8191
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
8192
|
+
var index = -1,
|
|
8193
|
+
length = array.length;
|
|
8194
|
+
|
|
8195
|
+
predicate || (predicate = _isFlattenable);
|
|
8196
|
+
result || (result = []);
|
|
8197
|
+
|
|
8198
|
+
while (++index < length) {
|
|
8199
|
+
var value = array[index];
|
|
8200
|
+
if (depth > 0 && predicate(value)) {
|
|
8201
|
+
if (depth > 1) {
|
|
8202
|
+
// Recursively flatten arrays (susceptible to call stack limits).
|
|
8203
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
8204
|
+
} else {
|
|
8205
|
+
_arrayPush(result, value);
|
|
8206
|
+
}
|
|
8207
|
+
} else if (!isStrict) {
|
|
8208
|
+
result[result.length] = value;
|
|
8209
|
+
}
|
|
8210
|
+
}
|
|
8211
|
+
return result;
|
|
8212
|
+
}
|
|
8213
|
+
|
|
8214
|
+
var _baseFlatten = baseFlatten;
|
|
8215
|
+
|
|
8216
|
+
/**
|
|
8217
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
8218
|
+
* shorthands.
|
|
8219
|
+
*
|
|
8220
|
+
* @private
|
|
8221
|
+
* @param {Array} [array] The array to iterate over.
|
|
8222
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8223
|
+
* @returns {Array} Returns the new mapped array.
|
|
8224
|
+
*/
|
|
8225
|
+
function arrayMap(array, iteratee) {
|
|
8226
|
+
var index = -1,
|
|
8227
|
+
length = array == null ? 0 : array.length,
|
|
8228
|
+
result = Array(length);
|
|
8229
|
+
|
|
8230
|
+
while (++index < length) {
|
|
8231
|
+
result[index] = iteratee(array[index], index, array);
|
|
8232
|
+
}
|
|
8233
|
+
return result;
|
|
8234
|
+
}
|
|
8235
|
+
|
|
8236
|
+
var _arrayMap = arrayMap;
|
|
8237
|
+
|
|
8238
|
+
/** `Object#toString` result references. */
|
|
8239
|
+
var symbolTag = '[object Symbol]';
|
|
8240
|
+
|
|
8241
|
+
/**
|
|
8242
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
8243
|
+
*
|
|
8244
|
+
* @static
|
|
8245
|
+
* @memberOf _
|
|
8246
|
+
* @since 4.0.0
|
|
8247
|
+
* @category Lang
|
|
8248
|
+
* @param {*} value The value to check.
|
|
8249
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
8250
|
+
* @example
|
|
8251
|
+
*
|
|
8252
|
+
* _.isSymbol(Symbol.iterator);
|
|
8253
|
+
* // => true
|
|
8254
|
+
*
|
|
8255
|
+
* _.isSymbol('abc');
|
|
8256
|
+
* // => false
|
|
8257
|
+
*/
|
|
8258
|
+
function isSymbol(value) {
|
|
8259
|
+
return typeof value == 'symbol' ||
|
|
8260
|
+
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
|
8261
|
+
}
|
|
8262
|
+
|
|
8263
|
+
var isSymbol_1 = isSymbol;
|
|
8264
|
+
|
|
8265
|
+
/** Used to match property names within property paths. */
|
|
8266
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
8267
|
+
reIsPlainProp = /^\w*$/;
|
|
8268
|
+
|
|
8269
|
+
/**
|
|
8270
|
+
* Checks if `value` is a property name and not a property path.
|
|
8271
|
+
*
|
|
8272
|
+
* @private
|
|
8273
|
+
* @param {*} value The value to check.
|
|
8274
|
+
* @param {Object} [object] The object to query keys on.
|
|
8275
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
8276
|
+
*/
|
|
8277
|
+
function isKey(value, object) {
|
|
8278
|
+
if (isArray_1(value)) {
|
|
8279
|
+
return false;
|
|
8280
|
+
}
|
|
8281
|
+
var type = typeof value;
|
|
8282
|
+
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
8283
|
+
value == null || isSymbol_1(value)) {
|
|
8284
|
+
return true;
|
|
8285
|
+
}
|
|
8286
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
8287
|
+
(object != null && value in Object(object));
|
|
8288
|
+
}
|
|
8289
|
+
|
|
8290
|
+
var _isKey = isKey;
|
|
8291
|
+
|
|
8292
|
+
/** Error message constants. */
|
|
8293
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
8294
|
+
|
|
8295
|
+
/**
|
|
8296
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
8297
|
+
* provided, it determines the cache key for storing the result based on the
|
|
8298
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
8299
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
8300
|
+
* is invoked with the `this` binding of the memoized function.
|
|
8301
|
+
*
|
|
8302
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
8303
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
8304
|
+
* constructor with one whose instances implement the
|
|
8305
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
8306
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
8307
|
+
*
|
|
8308
|
+
* @static
|
|
8309
|
+
* @memberOf _
|
|
8310
|
+
* @since 0.1.0
|
|
8311
|
+
* @category Function
|
|
8312
|
+
* @param {Function} func The function to have its output memoized.
|
|
8313
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
8314
|
+
* @returns {Function} Returns the new memoized function.
|
|
8315
|
+
* @example
|
|
8316
|
+
*
|
|
8317
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
8318
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
8319
|
+
*
|
|
8320
|
+
* var values = _.memoize(_.values);
|
|
8321
|
+
* values(object);
|
|
8322
|
+
* // => [1, 2]
|
|
8323
|
+
*
|
|
8324
|
+
* values(other);
|
|
8325
|
+
* // => [3, 4]
|
|
8326
|
+
*
|
|
8327
|
+
* object.a = 2;
|
|
8328
|
+
* values(object);
|
|
8329
|
+
* // => [1, 2]
|
|
8330
|
+
*
|
|
8331
|
+
* // Modify the result cache.
|
|
8332
|
+
* values.cache.set(object, ['a', 'b']);
|
|
8333
|
+
* values(object);
|
|
8334
|
+
* // => ['a', 'b']
|
|
8335
|
+
*
|
|
8336
|
+
* // Replace `_.memoize.Cache`.
|
|
8337
|
+
* _.memoize.Cache = WeakMap;
|
|
8338
|
+
*/
|
|
8339
|
+
function memoize(func, resolver) {
|
|
8340
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
8341
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
8342
|
+
}
|
|
8343
|
+
var memoized = function() {
|
|
8344
|
+
var args = arguments,
|
|
8345
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
8346
|
+
cache = memoized.cache;
|
|
8347
|
+
|
|
8348
|
+
if (cache.has(key)) {
|
|
8349
|
+
return cache.get(key);
|
|
8350
|
+
}
|
|
8351
|
+
var result = func.apply(this, args);
|
|
8352
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
8353
|
+
return result;
|
|
8354
|
+
};
|
|
8355
|
+
memoized.cache = new (memoize.Cache || _MapCache);
|
|
8356
|
+
return memoized;
|
|
8357
|
+
}
|
|
8358
|
+
|
|
8359
|
+
// Expose `MapCache`.
|
|
8360
|
+
memoize.Cache = _MapCache;
|
|
8361
|
+
|
|
8362
|
+
var memoize_1 = memoize;
|
|
8363
|
+
|
|
8364
|
+
/** Used as the maximum memoize cache size. */
|
|
8365
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
8366
|
+
|
|
8367
|
+
/**
|
|
8368
|
+
* A specialized version of `_.memoize` which clears the memoized function's
|
|
8369
|
+
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
8370
|
+
*
|
|
8371
|
+
* @private
|
|
8372
|
+
* @param {Function} func The function to have its output memoized.
|
|
8373
|
+
* @returns {Function} Returns the new memoized function.
|
|
8374
|
+
*/
|
|
8375
|
+
function memoizeCapped(func) {
|
|
8376
|
+
var result = memoize_1(func, function(key) {
|
|
8377
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
8378
|
+
cache.clear();
|
|
8379
|
+
}
|
|
8380
|
+
return key;
|
|
8381
|
+
});
|
|
8382
|
+
|
|
8383
|
+
var cache = result.cache;
|
|
8384
|
+
return result;
|
|
8385
|
+
}
|
|
8386
|
+
|
|
8387
|
+
var _memoizeCapped = memoizeCapped;
|
|
8388
|
+
|
|
8389
|
+
/** Used to match property names within property paths. */
|
|
8390
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
8391
|
+
|
|
8392
|
+
/** Used to match backslashes in property paths. */
|
|
8393
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
8394
|
+
|
|
8395
|
+
/**
|
|
8396
|
+
* Converts `string` to a property path array.
|
|
8397
|
+
*
|
|
8398
|
+
* @private
|
|
8399
|
+
* @param {string} string The string to convert.
|
|
8400
|
+
* @returns {Array} Returns the property path array.
|
|
8401
|
+
*/
|
|
8402
|
+
var stringToPath = _memoizeCapped(function(string) {
|
|
8403
|
+
var result = [];
|
|
8404
|
+
if (string.charCodeAt(0) === 46 /* . */) {
|
|
8405
|
+
result.push('');
|
|
8406
|
+
}
|
|
8407
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
8408
|
+
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
8409
|
+
});
|
|
8410
|
+
return result;
|
|
8411
|
+
});
|
|
8412
|
+
|
|
8413
|
+
var _stringToPath = stringToPath;
|
|
8414
|
+
|
|
8415
|
+
/** Used as references for various `Number` constants. */
|
|
8416
|
+
var INFINITY$1 = 1 / 0;
|
|
8417
|
+
|
|
8418
|
+
/** Used to convert symbols to primitives and strings. */
|
|
8419
|
+
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
8420
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
8421
|
+
|
|
8422
|
+
/**
|
|
8423
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
8424
|
+
* values to empty strings.
|
|
8425
|
+
*
|
|
8426
|
+
* @private
|
|
8427
|
+
* @param {*} value The value to process.
|
|
8428
|
+
* @returns {string} Returns the string.
|
|
8429
|
+
*/
|
|
8430
|
+
function baseToString(value) {
|
|
8431
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
8432
|
+
if (typeof value == 'string') {
|
|
8433
|
+
return value;
|
|
8434
|
+
}
|
|
8435
|
+
if (isArray_1(value)) {
|
|
8436
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
8437
|
+
return _arrayMap(value, baseToString) + '';
|
|
8438
|
+
}
|
|
8439
|
+
if (isSymbol_1(value)) {
|
|
8440
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
8441
|
+
}
|
|
8442
|
+
var result = (value + '');
|
|
8443
|
+
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
8444
|
+
}
|
|
8445
|
+
|
|
8446
|
+
var _baseToString = baseToString;
|
|
8447
|
+
|
|
8448
|
+
/**
|
|
8449
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
8450
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
8451
|
+
*
|
|
8452
|
+
* @static
|
|
8453
|
+
* @memberOf _
|
|
8454
|
+
* @since 4.0.0
|
|
8455
|
+
* @category Lang
|
|
8456
|
+
* @param {*} value The value to convert.
|
|
8457
|
+
* @returns {string} Returns the converted string.
|
|
8458
|
+
* @example
|
|
8459
|
+
*
|
|
8460
|
+
* _.toString(null);
|
|
8461
|
+
* // => ''
|
|
8462
|
+
*
|
|
8463
|
+
* _.toString(-0);
|
|
8464
|
+
* // => '-0'
|
|
8465
|
+
*
|
|
8466
|
+
* _.toString([1, 2, 3]);
|
|
8467
|
+
* // => '1,2,3'
|
|
8468
|
+
*/
|
|
8469
|
+
function toString$1(value) {
|
|
8470
|
+
return value == null ? '' : _baseToString(value);
|
|
8471
|
+
}
|
|
8472
|
+
|
|
8473
|
+
var toString_1 = toString$1;
|
|
8474
|
+
|
|
8475
|
+
/**
|
|
8476
|
+
* Casts `value` to a path array if it's not one.
|
|
8477
|
+
*
|
|
8478
|
+
* @private
|
|
8479
|
+
* @param {*} value The value to inspect.
|
|
8480
|
+
* @param {Object} [object] The object to query keys on.
|
|
8481
|
+
* @returns {Array} Returns the cast property path array.
|
|
8482
|
+
*/
|
|
8483
|
+
function castPath(value, object) {
|
|
8484
|
+
if (isArray_1(value)) {
|
|
8485
|
+
return value;
|
|
8486
|
+
}
|
|
8487
|
+
return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
|
|
8488
|
+
}
|
|
8489
|
+
|
|
8490
|
+
var _castPath = castPath;
|
|
8491
|
+
|
|
8492
|
+
/** Used as references for various `Number` constants. */
|
|
8493
|
+
var INFINITY = 1 / 0;
|
|
8494
|
+
|
|
8495
|
+
/**
|
|
8496
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
8497
|
+
*
|
|
8498
|
+
* @private
|
|
8499
|
+
* @param {*} value The value to inspect.
|
|
8500
|
+
* @returns {string|symbol} Returns the key.
|
|
8501
|
+
*/
|
|
8502
|
+
function toKey(value) {
|
|
8503
|
+
if (typeof value == 'string' || isSymbol_1(value)) {
|
|
8504
|
+
return value;
|
|
8505
|
+
}
|
|
8506
|
+
var result = (value + '');
|
|
8507
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
8508
|
+
}
|
|
8509
|
+
|
|
8510
|
+
var _toKey = toKey;
|
|
8511
|
+
|
|
8512
|
+
/**
|
|
8513
|
+
* The base implementation of `_.get` without support for default values.
|
|
8514
|
+
*
|
|
8515
|
+
* @private
|
|
8516
|
+
* @param {Object} object The object to query.
|
|
8517
|
+
* @param {Array|string} path The path of the property to get.
|
|
8518
|
+
* @returns {*} Returns the resolved value.
|
|
8519
|
+
*/
|
|
8520
|
+
function baseGet(object, path) {
|
|
8521
|
+
path = _castPath(path, object);
|
|
8522
|
+
|
|
8523
|
+
var index = 0,
|
|
8524
|
+
length = path.length;
|
|
8525
|
+
|
|
8526
|
+
while (object != null && index < length) {
|
|
8527
|
+
object = object[_toKey(path[index++])];
|
|
8528
|
+
}
|
|
8529
|
+
return (index && index == length) ? object : undefined;
|
|
8530
|
+
}
|
|
8531
|
+
|
|
8532
|
+
var _baseGet = baseGet;
|
|
8533
|
+
|
|
8534
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
8535
|
+
var COMPARE_PARTIAL_FLAG$1 = 1,
|
|
8536
|
+
COMPARE_UNORDERED_FLAG$1 = 2;
|
|
8537
|
+
|
|
8538
|
+
/**
|
|
8539
|
+
* The base implementation of `_.isMatch` without support for iteratee shorthands.
|
|
8540
|
+
*
|
|
8541
|
+
* @private
|
|
8542
|
+
* @param {Object} object The object to inspect.
|
|
8543
|
+
* @param {Object} source The object of property values to match.
|
|
8544
|
+
* @param {Array} matchData The property names, values, and compare flags to match.
|
|
8545
|
+
* @param {Function} [customizer] The function to customize comparisons.
|
|
8546
|
+
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
8547
|
+
*/
|
|
8548
|
+
function baseIsMatch(object, source, matchData, customizer) {
|
|
8549
|
+
var index = matchData.length,
|
|
8550
|
+
length = index,
|
|
8551
|
+
noCustomizer = !customizer;
|
|
8552
|
+
|
|
8553
|
+
if (object == null) {
|
|
8554
|
+
return !length;
|
|
8555
|
+
}
|
|
8556
|
+
object = Object(object);
|
|
8557
|
+
while (index--) {
|
|
8558
|
+
var data = matchData[index];
|
|
8559
|
+
if ((noCustomizer && data[2])
|
|
8560
|
+
? data[1] !== object[data[0]]
|
|
8561
|
+
: !(data[0] in object)
|
|
8562
|
+
) {
|
|
8563
|
+
return false;
|
|
8564
|
+
}
|
|
8565
|
+
}
|
|
8566
|
+
while (++index < length) {
|
|
8567
|
+
data = matchData[index];
|
|
8568
|
+
var key = data[0],
|
|
8569
|
+
objValue = object[key],
|
|
8570
|
+
srcValue = data[1];
|
|
8571
|
+
|
|
8572
|
+
if (noCustomizer && data[2]) {
|
|
8573
|
+
if (objValue === undefined && !(key in object)) {
|
|
8574
|
+
return false;
|
|
8575
|
+
}
|
|
8576
|
+
} else {
|
|
8577
|
+
var stack = new _Stack;
|
|
8578
|
+
if (customizer) {
|
|
8579
|
+
var result = customizer(objValue, srcValue, key, object, source, stack);
|
|
8580
|
+
}
|
|
8581
|
+
if (!(result === undefined
|
|
8582
|
+
? _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack)
|
|
8583
|
+
: result
|
|
8584
|
+
)) {
|
|
8585
|
+
return false;
|
|
8586
|
+
}
|
|
8587
|
+
}
|
|
8588
|
+
}
|
|
8589
|
+
return true;
|
|
8590
|
+
}
|
|
8591
|
+
|
|
8592
|
+
var _baseIsMatch = baseIsMatch;
|
|
8593
|
+
|
|
8594
|
+
/**
|
|
8595
|
+
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
|
|
8596
|
+
*
|
|
8597
|
+
* @private
|
|
8598
|
+
* @param {*} value The value to check.
|
|
8599
|
+
* @returns {boolean} Returns `true` if `value` if suitable for strict
|
|
8600
|
+
* equality comparisons, else `false`.
|
|
8601
|
+
*/
|
|
8602
|
+
function isStrictComparable(value) {
|
|
8603
|
+
return value === value && !isObject_1(value);
|
|
8604
|
+
}
|
|
8605
|
+
|
|
8606
|
+
var _isStrictComparable = isStrictComparable;
|
|
8607
|
+
|
|
8608
|
+
/**
|
|
8609
|
+
* Gets the property names, values, and compare flags of `object`.
|
|
8610
|
+
*
|
|
8611
|
+
* @private
|
|
8612
|
+
* @param {Object} object The object to query.
|
|
8613
|
+
* @returns {Array} Returns the match data of `object`.
|
|
8614
|
+
*/
|
|
8615
|
+
function getMatchData(object) {
|
|
8616
|
+
var result = keys_1(object),
|
|
8617
|
+
length = result.length;
|
|
8618
|
+
|
|
8619
|
+
while (length--) {
|
|
8620
|
+
var key = result[length],
|
|
8621
|
+
value = object[key];
|
|
8622
|
+
|
|
8623
|
+
result[length] = [key, value, _isStrictComparable(value)];
|
|
8624
|
+
}
|
|
8625
|
+
return result;
|
|
8626
|
+
}
|
|
8627
|
+
|
|
8628
|
+
var _getMatchData = getMatchData;
|
|
8629
|
+
|
|
8630
|
+
/**
|
|
8631
|
+
* A specialized version of `matchesProperty` for source values suitable
|
|
8632
|
+
* for strict equality comparisons, i.e. `===`.
|
|
8633
|
+
*
|
|
8634
|
+
* @private
|
|
8635
|
+
* @param {string} key The key of the property to get.
|
|
8636
|
+
* @param {*} srcValue The value to match.
|
|
8637
|
+
* @returns {Function} Returns the new spec function.
|
|
8638
|
+
*/
|
|
8639
|
+
function matchesStrictComparable(key, srcValue) {
|
|
8640
|
+
return function(object) {
|
|
8641
|
+
if (object == null) {
|
|
8642
|
+
return false;
|
|
8643
|
+
}
|
|
8644
|
+
return object[key] === srcValue &&
|
|
8645
|
+
(srcValue !== undefined || (key in Object(object)));
|
|
8646
|
+
};
|
|
8647
|
+
}
|
|
8648
|
+
|
|
8649
|
+
var _matchesStrictComparable = matchesStrictComparable;
|
|
8650
|
+
|
|
8651
|
+
/**
|
|
8652
|
+
* The base implementation of `_.matches` which doesn't clone `source`.
|
|
8653
|
+
*
|
|
8654
|
+
* @private
|
|
8655
|
+
* @param {Object} source The object of property values to match.
|
|
8656
|
+
* @returns {Function} Returns the new spec function.
|
|
8657
|
+
*/
|
|
8658
|
+
function baseMatches(source) {
|
|
8659
|
+
var matchData = _getMatchData(source);
|
|
8660
|
+
if (matchData.length == 1 && matchData[0][2]) {
|
|
8661
|
+
return _matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
|
8662
|
+
}
|
|
8663
|
+
return function(object) {
|
|
8664
|
+
return object === source || _baseIsMatch(object, source, matchData);
|
|
8665
|
+
};
|
|
8666
|
+
}
|
|
8667
|
+
|
|
8668
|
+
var _baseMatches = baseMatches;
|
|
8669
|
+
|
|
8670
|
+
/**
|
|
8671
|
+
* Gets the value at `path` of `object`. If the resolved value is
|
|
8672
|
+
* `undefined`, the `defaultValue` is returned in its place.
|
|
8673
|
+
*
|
|
8674
|
+
* @static
|
|
8675
|
+
* @memberOf _
|
|
8676
|
+
* @since 3.7.0
|
|
8677
|
+
* @category Object
|
|
8678
|
+
* @param {Object} object The object to query.
|
|
8679
|
+
* @param {Array|string} path The path of the property to get.
|
|
8680
|
+
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
8681
|
+
* @returns {*} Returns the resolved value.
|
|
8682
|
+
* @example
|
|
8683
|
+
*
|
|
8684
|
+
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
8685
|
+
*
|
|
8686
|
+
* _.get(object, 'a[0].b.c');
|
|
8687
|
+
* // => 3
|
|
8688
|
+
*
|
|
8689
|
+
* _.get(object, ['a', '0', 'b', 'c']);
|
|
8690
|
+
* // => 3
|
|
8691
|
+
*
|
|
8692
|
+
* _.get(object, 'a.b.c', 'default');
|
|
8693
|
+
* // => 'default'
|
|
8694
|
+
*/
|
|
8695
|
+
function get(object, path, defaultValue) {
|
|
8696
|
+
var result = object == null ? undefined : _baseGet(object, path);
|
|
8697
|
+
return result === undefined ? defaultValue : result;
|
|
8698
|
+
}
|
|
8699
|
+
|
|
8700
|
+
var get_1 = get;
|
|
8701
|
+
|
|
8702
|
+
/**
|
|
8703
|
+
* The base implementation of `_.hasIn` without support for deep paths.
|
|
8704
|
+
*
|
|
8705
|
+
* @private
|
|
8706
|
+
* @param {Object} [object] The object to query.
|
|
8707
|
+
* @param {Array|string} key The key to check.
|
|
8708
|
+
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
8709
|
+
*/
|
|
8710
|
+
function baseHasIn(object, key) {
|
|
8711
|
+
return object != null && key in Object(object);
|
|
8712
|
+
}
|
|
8713
|
+
|
|
8714
|
+
var _baseHasIn = baseHasIn;
|
|
8715
|
+
|
|
8716
|
+
/**
|
|
8717
|
+
* Checks if `path` exists on `object`.
|
|
8718
|
+
*
|
|
8719
|
+
* @private
|
|
8720
|
+
* @param {Object} object The object to query.
|
|
8721
|
+
* @param {Array|string} path The path to check.
|
|
8722
|
+
* @param {Function} hasFunc The function to check properties.
|
|
8723
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
8724
|
+
*/
|
|
8725
|
+
function hasPath(object, path, hasFunc) {
|
|
8726
|
+
path = _castPath(path, object);
|
|
8727
|
+
|
|
8728
|
+
var index = -1,
|
|
8729
|
+
length = path.length,
|
|
8730
|
+
result = false;
|
|
8731
|
+
|
|
8732
|
+
while (++index < length) {
|
|
8733
|
+
var key = _toKey(path[index]);
|
|
8734
|
+
if (!(result = object != null && hasFunc(object, key))) {
|
|
8735
|
+
break;
|
|
8736
|
+
}
|
|
8737
|
+
object = object[key];
|
|
8738
|
+
}
|
|
8739
|
+
if (result || ++index != length) {
|
|
8740
|
+
return result;
|
|
8741
|
+
}
|
|
8742
|
+
length = object == null ? 0 : object.length;
|
|
8743
|
+
return !!length && isLength_1(length) && _isIndex(key, length) &&
|
|
8744
|
+
(isArray_1(object) || isArguments_1(object));
|
|
8745
|
+
}
|
|
8746
|
+
|
|
8747
|
+
var _hasPath = hasPath;
|
|
8748
|
+
|
|
8749
|
+
/**
|
|
8750
|
+
* Checks if `path` is a direct or inherited property of `object`.
|
|
8751
|
+
*
|
|
8752
|
+
* @static
|
|
8753
|
+
* @memberOf _
|
|
8754
|
+
* @since 4.0.0
|
|
8755
|
+
* @category Object
|
|
8756
|
+
* @param {Object} object The object to query.
|
|
8757
|
+
* @param {Array|string} path The path to check.
|
|
8758
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
8759
|
+
* @example
|
|
8760
|
+
*
|
|
8761
|
+
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
8762
|
+
*
|
|
8763
|
+
* _.hasIn(object, 'a');
|
|
8764
|
+
* // => true
|
|
8765
|
+
*
|
|
8766
|
+
* _.hasIn(object, 'a.b');
|
|
8767
|
+
* // => true
|
|
8768
|
+
*
|
|
8769
|
+
* _.hasIn(object, ['a', 'b']);
|
|
8770
|
+
* // => true
|
|
8771
|
+
*
|
|
8772
|
+
* _.hasIn(object, 'b');
|
|
8773
|
+
* // => false
|
|
8774
|
+
*/
|
|
8775
|
+
function hasIn(object, path) {
|
|
8776
|
+
return object != null && _hasPath(object, path, _baseHasIn);
|
|
8777
|
+
}
|
|
8778
|
+
|
|
8779
|
+
var hasIn_1 = hasIn;
|
|
8780
|
+
|
|
8781
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
8782
|
+
var COMPARE_PARTIAL_FLAG = 1,
|
|
8783
|
+
COMPARE_UNORDERED_FLAG = 2;
|
|
8784
|
+
|
|
8785
|
+
/**
|
|
8786
|
+
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
|
8787
|
+
*
|
|
8788
|
+
* @private
|
|
8789
|
+
* @param {string} path The path of the property to get.
|
|
8790
|
+
* @param {*} srcValue The value to match.
|
|
8791
|
+
* @returns {Function} Returns the new spec function.
|
|
8792
|
+
*/
|
|
8793
|
+
function baseMatchesProperty(path, srcValue) {
|
|
8794
|
+
if (_isKey(path) && _isStrictComparable(srcValue)) {
|
|
8795
|
+
return _matchesStrictComparable(_toKey(path), srcValue);
|
|
8796
|
+
}
|
|
8797
|
+
return function(object) {
|
|
8798
|
+
var objValue = get_1(object, path);
|
|
8799
|
+
return (objValue === undefined && objValue === srcValue)
|
|
8800
|
+
? hasIn_1(object, path)
|
|
8801
|
+
: _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
8802
|
+
};
|
|
8803
|
+
}
|
|
8804
|
+
|
|
8805
|
+
var _baseMatchesProperty = baseMatchesProperty;
|
|
8806
|
+
|
|
8807
|
+
/**
|
|
8808
|
+
* This method returns the first argument it receives.
|
|
8809
|
+
*
|
|
8810
|
+
* @static
|
|
8811
|
+
* @since 0.1.0
|
|
8812
|
+
* @memberOf _
|
|
8813
|
+
* @category Util
|
|
8814
|
+
* @param {*} value Any value.
|
|
8815
|
+
* @returns {*} Returns `value`.
|
|
8816
|
+
* @example
|
|
8817
|
+
*
|
|
8818
|
+
* var object = { 'a': 1 };
|
|
8819
|
+
*
|
|
8820
|
+
* console.log(_.identity(object) === object);
|
|
8821
|
+
* // => true
|
|
8822
|
+
*/
|
|
8823
|
+
function identity(value) {
|
|
8824
|
+
return value;
|
|
8825
|
+
}
|
|
8826
|
+
|
|
8827
|
+
var identity_1 = identity;
|
|
8828
|
+
|
|
8829
|
+
/**
|
|
8830
|
+
* The base implementation of `_.property` without support for deep paths.
|
|
8831
|
+
*
|
|
8832
|
+
* @private
|
|
8833
|
+
* @param {string} key The key of the property to get.
|
|
8834
|
+
* @returns {Function} Returns the new accessor function.
|
|
8835
|
+
*/
|
|
8836
|
+
function baseProperty(key) {
|
|
8837
|
+
return function(object) {
|
|
8838
|
+
return object == null ? undefined : object[key];
|
|
8839
|
+
};
|
|
8840
|
+
}
|
|
8841
|
+
|
|
8842
|
+
var _baseProperty = baseProperty;
|
|
8843
|
+
|
|
8844
|
+
/**
|
|
8845
|
+
* A specialized version of `baseProperty` which supports deep paths.
|
|
8846
|
+
*
|
|
8847
|
+
* @private
|
|
8848
|
+
* @param {Array|string} path The path of the property to get.
|
|
8849
|
+
* @returns {Function} Returns the new accessor function.
|
|
8850
|
+
*/
|
|
8851
|
+
function basePropertyDeep(path) {
|
|
8852
|
+
return function(object) {
|
|
8853
|
+
return _baseGet(object, path);
|
|
8854
|
+
};
|
|
8855
|
+
}
|
|
8856
|
+
|
|
8857
|
+
var _basePropertyDeep = basePropertyDeep;
|
|
8858
|
+
|
|
8859
|
+
/**
|
|
8860
|
+
* Creates a function that returns the value at `path` of a given object.
|
|
8861
|
+
*
|
|
8862
|
+
* @static
|
|
8863
|
+
* @memberOf _
|
|
8864
|
+
* @since 2.4.0
|
|
8865
|
+
* @category Util
|
|
8866
|
+
* @param {Array|string} path The path of the property to get.
|
|
8867
|
+
* @returns {Function} Returns the new accessor function.
|
|
8868
|
+
* @example
|
|
8869
|
+
*
|
|
8870
|
+
* var objects = [
|
|
8871
|
+
* { 'a': { 'b': 2 } },
|
|
8872
|
+
* { 'a': { 'b': 1 } }
|
|
8873
|
+
* ];
|
|
8874
|
+
*
|
|
8875
|
+
* _.map(objects, _.property('a.b'));
|
|
8876
|
+
* // => [2, 1]
|
|
8877
|
+
*
|
|
8878
|
+
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
|
|
8879
|
+
* // => [1, 2]
|
|
8880
|
+
*/
|
|
8881
|
+
function property(path) {
|
|
8882
|
+
return _isKey(path) ? _baseProperty(_toKey(path)) : _basePropertyDeep(path);
|
|
8883
|
+
}
|
|
8884
|
+
|
|
8885
|
+
var property_1 = property;
|
|
8886
|
+
|
|
8887
|
+
/**
|
|
8888
|
+
* The base implementation of `_.iteratee`.
|
|
8889
|
+
*
|
|
8890
|
+
* @private
|
|
8891
|
+
* @param {*} [value=_.identity] The value to convert to an iteratee.
|
|
8892
|
+
* @returns {Function} Returns the iteratee.
|
|
8893
|
+
*/
|
|
8894
|
+
function baseIteratee(value) {
|
|
8895
|
+
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
|
8896
|
+
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
|
8897
|
+
if (typeof value == 'function') {
|
|
8898
|
+
return value;
|
|
8899
|
+
}
|
|
8900
|
+
if (value == null) {
|
|
8901
|
+
return identity_1;
|
|
8902
|
+
}
|
|
8903
|
+
if (typeof value == 'object') {
|
|
8904
|
+
return isArray_1(value)
|
|
8905
|
+
? _baseMatchesProperty(value[0], value[1])
|
|
8906
|
+
: _baseMatches(value);
|
|
8907
|
+
}
|
|
8908
|
+
return property_1(value);
|
|
8909
|
+
}
|
|
8910
|
+
|
|
8911
|
+
var _baseIteratee = baseIteratee;
|
|
8912
|
+
|
|
8913
|
+
/**
|
|
8914
|
+
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
|
8915
|
+
*
|
|
8916
|
+
* @private
|
|
8917
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
8918
|
+
* @returns {Function} Returns the new base function.
|
|
8919
|
+
*/
|
|
8920
|
+
function createBaseFor(fromRight) {
|
|
8921
|
+
return function(object, iteratee, keysFunc) {
|
|
8922
|
+
var index = -1,
|
|
8923
|
+
iterable = Object(object),
|
|
8924
|
+
props = keysFunc(object),
|
|
8925
|
+
length = props.length;
|
|
8926
|
+
|
|
8927
|
+
while (length--) {
|
|
8928
|
+
var key = props[fromRight ? length : ++index];
|
|
8929
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
|
8930
|
+
break;
|
|
8931
|
+
}
|
|
8932
|
+
}
|
|
8933
|
+
return object;
|
|
8934
|
+
};
|
|
8935
|
+
}
|
|
8936
|
+
|
|
8937
|
+
var _createBaseFor = createBaseFor;
|
|
8938
|
+
|
|
8939
|
+
/**
|
|
8940
|
+
* The base implementation of `baseForOwn` which iterates over `object`
|
|
8941
|
+
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
|
8942
|
+
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
8943
|
+
*
|
|
8944
|
+
* @private
|
|
8945
|
+
* @param {Object} object The object to iterate over.
|
|
8946
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8947
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
8948
|
+
* @returns {Object} Returns `object`.
|
|
8949
|
+
*/
|
|
8950
|
+
var baseFor = _createBaseFor();
|
|
8951
|
+
|
|
8952
|
+
var _baseFor = baseFor;
|
|
8953
|
+
|
|
8954
|
+
/**
|
|
8955
|
+
* The base implementation of `_.forOwn` without support for iteratee shorthands.
|
|
8956
|
+
*
|
|
8957
|
+
* @private
|
|
8958
|
+
* @param {Object} object The object to iterate over.
|
|
8959
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8960
|
+
* @returns {Object} Returns `object`.
|
|
8961
|
+
*/
|
|
8962
|
+
function baseForOwn(object, iteratee) {
|
|
8963
|
+
return object && _baseFor(object, iteratee, keys_1);
|
|
8964
|
+
}
|
|
8965
|
+
|
|
8966
|
+
var _baseForOwn = baseForOwn;
|
|
8967
|
+
|
|
8968
|
+
/**
|
|
8969
|
+
* Creates a `baseEach` or `baseEachRight` function.
|
|
8970
|
+
*
|
|
8971
|
+
* @private
|
|
8972
|
+
* @param {Function} eachFunc The function to iterate over a collection.
|
|
8973
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
8974
|
+
* @returns {Function} Returns the new base function.
|
|
8975
|
+
*/
|
|
8976
|
+
function createBaseEach(eachFunc, fromRight) {
|
|
8977
|
+
return function(collection, iteratee) {
|
|
8978
|
+
if (collection == null) {
|
|
8979
|
+
return collection;
|
|
8980
|
+
}
|
|
8981
|
+
if (!isArrayLike_1(collection)) {
|
|
8982
|
+
return eachFunc(collection, iteratee);
|
|
8983
|
+
}
|
|
8984
|
+
var length = collection.length,
|
|
8985
|
+
index = fromRight ? length : -1,
|
|
8986
|
+
iterable = Object(collection);
|
|
8987
|
+
|
|
8988
|
+
while ((fromRight ? index-- : ++index < length)) {
|
|
8989
|
+
if (iteratee(iterable[index], index, iterable) === false) {
|
|
8990
|
+
break;
|
|
8991
|
+
}
|
|
8992
|
+
}
|
|
8993
|
+
return collection;
|
|
8994
|
+
};
|
|
8995
|
+
}
|
|
8996
|
+
|
|
8997
|
+
var _createBaseEach = createBaseEach;
|
|
8998
|
+
|
|
8999
|
+
/**
|
|
9000
|
+
* The base implementation of `_.forEach` without support for iteratee shorthands.
|
|
9001
|
+
*
|
|
9002
|
+
* @private
|
|
9003
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9004
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
9005
|
+
* @returns {Array|Object} Returns `collection`.
|
|
9006
|
+
*/
|
|
9007
|
+
var baseEach = _createBaseEach(_baseForOwn);
|
|
9008
|
+
|
|
9009
|
+
var _baseEach = baseEach;
|
|
9010
|
+
|
|
9011
|
+
/**
|
|
9012
|
+
* The base implementation of `_.map` without support for iteratee shorthands.
|
|
9013
|
+
*
|
|
9014
|
+
* @private
|
|
9015
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9016
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
9017
|
+
* @returns {Array} Returns the new mapped array.
|
|
9018
|
+
*/
|
|
9019
|
+
function baseMap(collection, iteratee) {
|
|
9020
|
+
var index = -1,
|
|
9021
|
+
result = isArrayLike_1(collection) ? Array(collection.length) : [];
|
|
9022
|
+
|
|
9023
|
+
_baseEach(collection, function(value, key, collection) {
|
|
9024
|
+
result[++index] = iteratee(value, key, collection);
|
|
9025
|
+
});
|
|
9026
|
+
return result;
|
|
9027
|
+
}
|
|
9028
|
+
|
|
9029
|
+
var _baseMap = baseMap;
|
|
9030
|
+
|
|
9031
|
+
/**
|
|
9032
|
+
* The base implementation of `_.sortBy` which uses `comparer` to define the
|
|
9033
|
+
* sort order of `array` and replaces criteria objects with their corresponding
|
|
9034
|
+
* values.
|
|
9035
|
+
*
|
|
9036
|
+
* @private
|
|
9037
|
+
* @param {Array} array The array to sort.
|
|
9038
|
+
* @param {Function} comparer The function to define sort order.
|
|
9039
|
+
* @returns {Array} Returns `array`.
|
|
9040
|
+
*/
|
|
9041
|
+
function baseSortBy(array, comparer) {
|
|
9042
|
+
var length = array.length;
|
|
9043
|
+
|
|
9044
|
+
array.sort(comparer);
|
|
9045
|
+
while (length--) {
|
|
9046
|
+
array[length] = array[length].value;
|
|
9047
|
+
}
|
|
9048
|
+
return array;
|
|
9049
|
+
}
|
|
9050
|
+
|
|
9051
|
+
var _baseSortBy = baseSortBy;
|
|
9052
|
+
|
|
9053
|
+
/**
|
|
9054
|
+
* Compares values to sort them in ascending order.
|
|
9055
|
+
*
|
|
9056
|
+
* @private
|
|
9057
|
+
* @param {*} value The value to compare.
|
|
9058
|
+
* @param {*} other The other value to compare.
|
|
9059
|
+
* @returns {number} Returns the sort order indicator for `value`.
|
|
9060
|
+
*/
|
|
9061
|
+
function compareAscending(value, other) {
|
|
9062
|
+
if (value !== other) {
|
|
9063
|
+
var valIsDefined = value !== undefined,
|
|
9064
|
+
valIsNull = value === null,
|
|
9065
|
+
valIsReflexive = value === value,
|
|
9066
|
+
valIsSymbol = isSymbol_1(value);
|
|
9067
|
+
|
|
9068
|
+
var othIsDefined = other !== undefined,
|
|
9069
|
+
othIsNull = other === null,
|
|
9070
|
+
othIsReflexive = other === other,
|
|
9071
|
+
othIsSymbol = isSymbol_1(other);
|
|
9072
|
+
|
|
9073
|
+
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
|
9074
|
+
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
|
9075
|
+
(valIsNull && othIsDefined && othIsReflexive) ||
|
|
9076
|
+
(!valIsDefined && othIsReflexive) ||
|
|
9077
|
+
!valIsReflexive) {
|
|
9078
|
+
return 1;
|
|
9079
|
+
}
|
|
9080
|
+
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
|
|
9081
|
+
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
|
|
9082
|
+
(othIsNull && valIsDefined && valIsReflexive) ||
|
|
9083
|
+
(!othIsDefined && valIsReflexive) ||
|
|
9084
|
+
!othIsReflexive) {
|
|
9085
|
+
return -1;
|
|
9086
|
+
}
|
|
9087
|
+
}
|
|
9088
|
+
return 0;
|
|
9089
|
+
}
|
|
9090
|
+
|
|
9091
|
+
var _compareAscending = compareAscending;
|
|
9092
|
+
|
|
9093
|
+
/**
|
|
9094
|
+
* Used by `_.orderBy` to compare multiple properties of a value to another
|
|
9095
|
+
* and stable sort them.
|
|
9096
|
+
*
|
|
9097
|
+
* If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
|
|
9098
|
+
* specify an order of "desc" for descending or "asc" for ascending sort order
|
|
9099
|
+
* of corresponding values.
|
|
9100
|
+
*
|
|
9101
|
+
* @private
|
|
9102
|
+
* @param {Object} object The object to compare.
|
|
9103
|
+
* @param {Object} other The other object to compare.
|
|
9104
|
+
* @param {boolean[]|string[]} orders The order to sort by for each property.
|
|
9105
|
+
* @returns {number} Returns the sort order indicator for `object`.
|
|
9106
|
+
*/
|
|
9107
|
+
function compareMultiple(object, other, orders) {
|
|
9108
|
+
var index = -1,
|
|
9109
|
+
objCriteria = object.criteria,
|
|
9110
|
+
othCriteria = other.criteria,
|
|
9111
|
+
length = objCriteria.length,
|
|
9112
|
+
ordersLength = orders.length;
|
|
9113
|
+
|
|
9114
|
+
while (++index < length) {
|
|
9115
|
+
var result = _compareAscending(objCriteria[index], othCriteria[index]);
|
|
9116
|
+
if (result) {
|
|
9117
|
+
if (index >= ordersLength) {
|
|
9118
|
+
return result;
|
|
9119
|
+
}
|
|
9120
|
+
var order = orders[index];
|
|
9121
|
+
return result * (order == 'desc' ? -1 : 1);
|
|
9122
|
+
}
|
|
9123
|
+
}
|
|
9124
|
+
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
|
|
9125
|
+
// that causes it, under certain circumstances, to provide the same value for
|
|
9126
|
+
// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
|
|
9127
|
+
// for more details.
|
|
9128
|
+
//
|
|
9129
|
+
// This also ensures a stable sort in V8 and other engines.
|
|
9130
|
+
// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
|
|
9131
|
+
return object.index - other.index;
|
|
9132
|
+
}
|
|
9133
|
+
|
|
9134
|
+
var _compareMultiple = compareMultiple;
|
|
9135
|
+
|
|
9136
|
+
/**
|
|
9137
|
+
* The base implementation of `_.orderBy` without param guards.
|
|
9138
|
+
*
|
|
9139
|
+
* @private
|
|
9140
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9141
|
+
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
|
9142
|
+
* @param {string[]} orders The sort orders of `iteratees`.
|
|
9143
|
+
* @returns {Array} Returns the new sorted array.
|
|
9144
|
+
*/
|
|
9145
|
+
function baseOrderBy(collection, iteratees, orders) {
|
|
9146
|
+
if (iteratees.length) {
|
|
9147
|
+
iteratees = _arrayMap(iteratees, function(iteratee) {
|
|
9148
|
+
if (isArray_1(iteratee)) {
|
|
9149
|
+
return function(value) {
|
|
9150
|
+
return _baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
|
|
9151
|
+
}
|
|
9152
|
+
}
|
|
9153
|
+
return iteratee;
|
|
9154
|
+
});
|
|
9155
|
+
} else {
|
|
9156
|
+
iteratees = [identity_1];
|
|
9157
|
+
}
|
|
9158
|
+
|
|
9159
|
+
var index = -1;
|
|
9160
|
+
iteratees = _arrayMap(iteratees, _baseUnary(_baseIteratee));
|
|
9161
|
+
|
|
9162
|
+
var result = _baseMap(collection, function(value, key, collection) {
|
|
9163
|
+
var criteria = _arrayMap(iteratees, function(iteratee) {
|
|
9164
|
+
return iteratee(value);
|
|
9165
|
+
});
|
|
9166
|
+
return { 'criteria': criteria, 'index': ++index, 'value': value };
|
|
9167
|
+
});
|
|
9168
|
+
|
|
9169
|
+
return _baseSortBy(result, function(object, other) {
|
|
9170
|
+
return _compareMultiple(object, other, orders);
|
|
9171
|
+
});
|
|
9172
|
+
}
|
|
9173
|
+
|
|
9174
|
+
var _baseOrderBy = baseOrderBy;
|
|
9175
|
+
|
|
9176
|
+
/**
|
|
9177
|
+
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
9178
|
+
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
9179
|
+
*
|
|
9180
|
+
* @private
|
|
9181
|
+
* @param {Function} func The function to invoke.
|
|
9182
|
+
* @param {*} thisArg The `this` binding of `func`.
|
|
9183
|
+
* @param {Array} args The arguments to invoke `func` with.
|
|
9184
|
+
* @returns {*} Returns the result of `func`.
|
|
9185
|
+
*/
|
|
9186
|
+
function apply(func, thisArg, args) {
|
|
9187
|
+
switch (args.length) {
|
|
9188
|
+
case 0: return func.call(thisArg);
|
|
9189
|
+
case 1: return func.call(thisArg, args[0]);
|
|
9190
|
+
case 2: return func.call(thisArg, args[0], args[1]);
|
|
9191
|
+
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
9192
|
+
}
|
|
9193
|
+
return func.apply(thisArg, args);
|
|
9194
|
+
}
|
|
9195
|
+
|
|
9196
|
+
var _apply = apply;
|
|
9197
|
+
|
|
9198
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
9199
|
+
var nativeMax = Math.max;
|
|
9200
|
+
|
|
9201
|
+
/**
|
|
9202
|
+
* A specialized version of `baseRest` which transforms the rest array.
|
|
9203
|
+
*
|
|
9204
|
+
* @private
|
|
9205
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
9206
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
9207
|
+
* @param {Function} transform The rest array transform.
|
|
9208
|
+
* @returns {Function} Returns the new function.
|
|
9209
|
+
*/
|
|
9210
|
+
function overRest(func, start, transform) {
|
|
9211
|
+
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
|
9212
|
+
return function() {
|
|
9213
|
+
var args = arguments,
|
|
9214
|
+
index = -1,
|
|
9215
|
+
length = nativeMax(args.length - start, 0),
|
|
9216
|
+
array = Array(length);
|
|
9217
|
+
|
|
9218
|
+
while (++index < length) {
|
|
9219
|
+
array[index] = args[start + index];
|
|
9220
|
+
}
|
|
9221
|
+
index = -1;
|
|
9222
|
+
var otherArgs = Array(start + 1);
|
|
9223
|
+
while (++index < start) {
|
|
9224
|
+
otherArgs[index] = args[index];
|
|
9225
|
+
}
|
|
9226
|
+
otherArgs[start] = transform(array);
|
|
9227
|
+
return _apply(func, this, otherArgs);
|
|
9228
|
+
};
|
|
9229
|
+
}
|
|
9230
|
+
|
|
9231
|
+
var _overRest = overRest;
|
|
9232
|
+
|
|
9233
|
+
/**
|
|
9234
|
+
* Creates a function that returns `value`.
|
|
9235
|
+
*
|
|
9236
|
+
* @static
|
|
9237
|
+
* @memberOf _
|
|
9238
|
+
* @since 2.4.0
|
|
9239
|
+
* @category Util
|
|
9240
|
+
* @param {*} value The value to return from the new function.
|
|
9241
|
+
* @returns {Function} Returns the new constant function.
|
|
9242
|
+
* @example
|
|
9243
|
+
*
|
|
9244
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
9245
|
+
*
|
|
9246
|
+
* console.log(objects);
|
|
9247
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
9248
|
+
*
|
|
9249
|
+
* console.log(objects[0] === objects[1]);
|
|
9250
|
+
* // => true
|
|
9251
|
+
*/
|
|
9252
|
+
function constant(value) {
|
|
9253
|
+
return function() {
|
|
9254
|
+
return value;
|
|
9255
|
+
};
|
|
9256
|
+
}
|
|
9257
|
+
|
|
9258
|
+
var constant_1 = constant;
|
|
9259
|
+
|
|
9260
|
+
var defineProperty = (function() {
|
|
9261
|
+
try {
|
|
9262
|
+
var func = _getNative(Object, 'defineProperty');
|
|
9263
|
+
func({}, '', {});
|
|
9264
|
+
return func;
|
|
9265
|
+
} catch (e) {}
|
|
9266
|
+
}());
|
|
9267
|
+
|
|
9268
|
+
var _defineProperty = defineProperty;
|
|
9269
|
+
|
|
9270
|
+
/**
|
|
9271
|
+
* The base implementation of `setToString` without support for hot loop shorting.
|
|
9272
|
+
*
|
|
9273
|
+
* @private
|
|
9274
|
+
* @param {Function} func The function to modify.
|
|
9275
|
+
* @param {Function} string The `toString` result.
|
|
9276
|
+
* @returns {Function} Returns `func`.
|
|
9277
|
+
*/
|
|
9278
|
+
var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
|
|
9279
|
+
return _defineProperty(func, 'toString', {
|
|
9280
|
+
'configurable': true,
|
|
9281
|
+
'enumerable': false,
|
|
9282
|
+
'value': constant_1(string),
|
|
9283
|
+
'writable': true
|
|
9284
|
+
});
|
|
9285
|
+
};
|
|
9286
|
+
|
|
9287
|
+
var _baseSetToString = baseSetToString;
|
|
9288
|
+
|
|
9289
|
+
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
9290
|
+
var HOT_COUNT = 800,
|
|
9291
|
+
HOT_SPAN = 16;
|
|
9292
|
+
|
|
9293
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
9294
|
+
var nativeNow = Date.now;
|
|
9295
|
+
|
|
9296
|
+
/**
|
|
9297
|
+
* Creates a function that'll short out and invoke `identity` instead
|
|
9298
|
+
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
9299
|
+
* milliseconds.
|
|
9300
|
+
*
|
|
9301
|
+
* @private
|
|
9302
|
+
* @param {Function} func The function to restrict.
|
|
9303
|
+
* @returns {Function} Returns the new shortable function.
|
|
9304
|
+
*/
|
|
9305
|
+
function shortOut(func) {
|
|
9306
|
+
var count = 0,
|
|
9307
|
+
lastCalled = 0;
|
|
9308
|
+
|
|
9309
|
+
return function() {
|
|
9310
|
+
var stamp = nativeNow(),
|
|
9311
|
+
remaining = HOT_SPAN - (stamp - lastCalled);
|
|
9312
|
+
|
|
9313
|
+
lastCalled = stamp;
|
|
9314
|
+
if (remaining > 0) {
|
|
9315
|
+
if (++count >= HOT_COUNT) {
|
|
9316
|
+
return arguments[0];
|
|
9317
|
+
}
|
|
9318
|
+
} else {
|
|
9319
|
+
count = 0;
|
|
9320
|
+
}
|
|
9321
|
+
return func.apply(undefined, arguments);
|
|
9322
|
+
};
|
|
9323
|
+
}
|
|
9324
|
+
|
|
9325
|
+
var _shortOut = shortOut;
|
|
9326
|
+
|
|
9327
|
+
/**
|
|
9328
|
+
* Sets the `toString` method of `func` to return `string`.
|
|
9329
|
+
*
|
|
9330
|
+
* @private
|
|
9331
|
+
* @param {Function} func The function to modify.
|
|
9332
|
+
* @param {Function} string The `toString` result.
|
|
9333
|
+
* @returns {Function} Returns `func`.
|
|
9334
|
+
*/
|
|
9335
|
+
var setToString = _shortOut(_baseSetToString);
|
|
9336
|
+
|
|
9337
|
+
var _setToString = setToString;
|
|
9338
|
+
|
|
9339
|
+
/**
|
|
9340
|
+
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
|
9341
|
+
*
|
|
9342
|
+
* @private
|
|
9343
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
9344
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
9345
|
+
* @returns {Function} Returns the new function.
|
|
9346
|
+
*/
|
|
9347
|
+
function baseRest(func, start) {
|
|
9348
|
+
return _setToString(_overRest(func, start, identity_1), func + '');
|
|
9349
|
+
}
|
|
9350
|
+
|
|
9351
|
+
var _baseRest = baseRest;
|
|
9352
|
+
|
|
9353
|
+
/**
|
|
9354
|
+
* Checks if the given arguments are from an iteratee call.
|
|
9355
|
+
*
|
|
9356
|
+
* @private
|
|
9357
|
+
* @param {*} value The potential iteratee value argument.
|
|
9358
|
+
* @param {*} index The potential iteratee index or key argument.
|
|
9359
|
+
* @param {*} object The potential iteratee object argument.
|
|
9360
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
9361
|
+
* else `false`.
|
|
9362
|
+
*/
|
|
9363
|
+
function isIterateeCall(value, index, object) {
|
|
9364
|
+
if (!isObject_1(object)) {
|
|
9365
|
+
return false;
|
|
9366
|
+
}
|
|
9367
|
+
var type = typeof index;
|
|
9368
|
+
if (type == 'number'
|
|
9369
|
+
? (isArrayLike_1(object) && _isIndex(index, object.length))
|
|
9370
|
+
: (type == 'string' && index in object)
|
|
9371
|
+
) {
|
|
9372
|
+
return eq_1(object[index], value);
|
|
9373
|
+
}
|
|
9374
|
+
return false;
|
|
9375
|
+
}
|
|
9376
|
+
|
|
9377
|
+
var _isIterateeCall = isIterateeCall;
|
|
9378
|
+
|
|
9379
|
+
/**
|
|
9380
|
+
* Creates an array of elements, sorted in ascending order by the results of
|
|
9381
|
+
* running each element in a collection thru each iteratee. This method
|
|
9382
|
+
* performs a stable sort, that is, it preserves the original sort order of
|
|
9383
|
+
* equal elements. The iteratees are invoked with one argument: (value).
|
|
9384
|
+
*
|
|
9385
|
+
* @static
|
|
9386
|
+
* @memberOf _
|
|
9387
|
+
* @since 0.1.0
|
|
9388
|
+
* @category Collection
|
|
9389
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9390
|
+
* @param {...(Function|Function[])} [iteratees=[_.identity]]
|
|
9391
|
+
* The iteratees to sort by.
|
|
9392
|
+
* @returns {Array} Returns the new sorted array.
|
|
9393
|
+
* @example
|
|
9394
|
+
*
|
|
9395
|
+
* var users = [
|
|
9396
|
+
* { 'user': 'fred', 'age': 48 },
|
|
9397
|
+
* { 'user': 'barney', 'age': 36 },
|
|
9398
|
+
* { 'user': 'fred', 'age': 30 },
|
|
9399
|
+
* { 'user': 'barney', 'age': 34 }
|
|
9400
|
+
* ];
|
|
9401
|
+
*
|
|
9402
|
+
* _.sortBy(users, [function(o) { return o.user; }]);
|
|
9403
|
+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
|
|
9404
|
+
*
|
|
9405
|
+
* _.sortBy(users, ['user', 'age']);
|
|
9406
|
+
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
|
|
9407
|
+
*/
|
|
9408
|
+
var sortBy = _baseRest(function(collection, iteratees) {
|
|
9409
|
+
if (collection == null) {
|
|
9410
|
+
return [];
|
|
9411
|
+
}
|
|
9412
|
+
var length = iteratees.length;
|
|
9413
|
+
if (length > 1 && _isIterateeCall(collection, iteratees[0], iteratees[1])) {
|
|
9414
|
+
iteratees = [];
|
|
9415
|
+
} else if (length > 2 && _isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
|
9416
|
+
iteratees = [iteratees[0]];
|
|
9417
|
+
}
|
|
9418
|
+
return _baseOrderBy(collection, _baseFlatten(iteratees, 1), []);
|
|
9419
|
+
});
|
|
9420
|
+
|
|
9421
|
+
var sortBy_1 = sortBy;
|
|
9422
|
+
|
|
9423
|
+
/**
|
|
9424
|
+
* Configuration for custom action validation rules.
|
|
9425
|
+
* Defines allowed positions, metadata IDs, data model IDs, and fields for each target
|
|
9426
|
+
* type.
|
|
9427
|
+
*
|
|
9428
|
+
*/
|
|
9429
|
+
const customActionValidationConfig = {
|
|
9430
|
+
[exports.CustomActionTarget.LIVEBOARD]: {
|
|
9431
|
+
positions: [exports.CustomActionsPosition.PRIMARY, exports.CustomActionsPosition.MENU],
|
|
9432
|
+
allowedMetadataIds: ['liveboardIds'],
|
|
9433
|
+
allowedDataModelIds: [],
|
|
9434
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds'],
|
|
9435
|
+
},
|
|
9436
|
+
[exports.CustomActionTarget.VIZ]: {
|
|
9437
|
+
positions: [exports.CustomActionsPosition.MENU, exports.CustomActionsPosition.PRIMARY, exports.CustomActionsPosition.CONTEXTMENU],
|
|
9438
|
+
allowedMetadataIds: ['liveboardIds', 'vizIds', 'answerIds'],
|
|
9439
|
+
allowedDataModelIds: ['modelIds', 'modelColumnNames'],
|
|
9440
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9441
|
+
},
|
|
9442
|
+
[exports.CustomActionTarget.ANSWER]: {
|
|
9443
|
+
positions: [exports.CustomActionsPosition.MENU, exports.CustomActionsPosition.PRIMARY, exports.CustomActionsPosition.CONTEXTMENU],
|
|
9444
|
+
allowedMetadataIds: ['answerIds'],
|
|
9445
|
+
allowedDataModelIds: ['modelIds', 'modelColumnNames'],
|
|
9446
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9447
|
+
},
|
|
9448
|
+
[exports.CustomActionTarget.SPOTTER]: {
|
|
9449
|
+
positions: [exports.CustomActionsPosition.MENU, exports.CustomActionsPosition.CONTEXTMENU],
|
|
9450
|
+
allowedMetadataIds: [],
|
|
9451
|
+
allowedDataModelIds: ['modelIds'],
|
|
9452
|
+
allowedFields: ['name', 'id', 'position', 'target', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9453
|
+
},
|
|
9454
|
+
};
|
|
9455
|
+
/**
|
|
9456
|
+
* Validates a single custom action based on its target type
|
|
9457
|
+
* @param action - The custom action to validate
|
|
9458
|
+
* @param primaryActionsPerTarget - Map to track primary actions per target
|
|
9459
|
+
* @returns CustomActionValidation with isValid flag and reason string
|
|
9460
|
+
*
|
|
9461
|
+
* @hidden
|
|
9462
|
+
*/
|
|
9463
|
+
const validateCustomAction = (action, primaryActionsPerTarget) => {
|
|
9464
|
+
const { id: actionId, target: targetType, position, metadataIds, dataModelIds } = action;
|
|
9465
|
+
// Check if target type is supported
|
|
9466
|
+
if (!customActionValidationConfig[targetType]) {
|
|
9467
|
+
const errorMessage = CUSTOM_ACTIONS_ERROR_MESSAGE.UNSUPPORTED_TARGET(actionId, targetType);
|
|
9468
|
+
return { isValid: false, errors: [errorMessage] };
|
|
9469
|
+
}
|
|
9470
|
+
const config = customActionValidationConfig[targetType];
|
|
9471
|
+
const errors = [];
|
|
9472
|
+
// Validate position
|
|
9473
|
+
if (!arrayIncludesString(config.positions, position)) {
|
|
9474
|
+
const supportedPositions = config.positions.join(', ');
|
|
9475
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_POSITION(position, targetType, supportedPositions));
|
|
9476
|
+
}
|
|
9477
|
+
// Validate metadata IDs
|
|
9478
|
+
if (metadataIds) {
|
|
9479
|
+
const invalidMetadataIds = Object.keys(metadataIds).filter((key) => !arrayIncludesString(config.allowedMetadataIds, key));
|
|
9480
|
+
if (invalidMetadataIds.length > 0) {
|
|
9481
|
+
const supportedMetadataIds = config.allowedMetadataIds.length > 0 ? config.allowedMetadataIds.join(', ') : 'none';
|
|
9482
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_METADATA_IDS(targetType, invalidMetadataIds, supportedMetadataIds));
|
|
9483
|
+
}
|
|
8007
9484
|
}
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
9485
|
+
// Validate data model IDs
|
|
9486
|
+
if (dataModelIds) {
|
|
9487
|
+
const invalidDataModelIds = Object.keys(dataModelIds).filter((key) => !arrayIncludesString(config.allowedDataModelIds, key));
|
|
9488
|
+
if (invalidDataModelIds.length > 0) {
|
|
9489
|
+
const supportedDataModelIds = config.allowedDataModelIds.length > 0 ? config.allowedDataModelIds.join(', ') : 'none';
|
|
9490
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_DATA_MODEL_IDS(targetType, invalidDataModelIds, supportedDataModelIds));
|
|
8011
9491
|
}
|
|
8012
|
-
this.answer = this.executeQuery(getAnswer, {}).then((data) => data === null || data === void 0 ? void 0 : data.answer);
|
|
8013
|
-
return this.answer;
|
|
8014
|
-
}
|
|
8015
|
-
async getTML() {
|
|
8016
|
-
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
8017
|
-
const edoc = object[0].edoc;
|
|
8018
|
-
const YAML = await Promise.resolve().then(function () { return index; });
|
|
8019
|
-
const parsedDoc = YAML.parse(edoc);
|
|
8020
|
-
return {
|
|
8021
|
-
answer: {
|
|
8022
|
-
...parsedDoc.answer,
|
|
8023
|
-
...this.tmlOverride,
|
|
8024
|
-
},
|
|
8025
|
-
};
|
|
8026
|
-
}
|
|
8027
|
-
async addDisplayedVizToLiveboard(liveboardId) {
|
|
8028
|
-
const { displayMode, visualizations } = await this.getAnswer();
|
|
8029
|
-
const viz = getDisplayedViz(visualizations, displayMode);
|
|
8030
|
-
return this.executeQuery(addVizToLiveboard, {
|
|
8031
|
-
liveboardId,
|
|
8032
|
-
vizId: viz.id,
|
|
8033
|
-
});
|
|
8034
9492
|
}
|
|
8035
|
-
|
|
8036
|
-
|
|
9493
|
+
// Validate allowed fields
|
|
9494
|
+
const actionKeys = Object.keys(action);
|
|
9495
|
+
const invalidFields = actionKeys.filter((key) => !arrayIncludesString(config.allowedFields, key));
|
|
9496
|
+
if (invalidFields.length > 0) {
|
|
9497
|
+
const supportedFields = config.allowedFields.join(', ');
|
|
9498
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_FIELDS(targetType, invalidFields, supportedFields));
|
|
8037
9499
|
}
|
|
8038
|
-
|
|
9500
|
+
return {
|
|
9501
|
+
isValid: errors.length === 0,
|
|
9502
|
+
errors,
|
|
9503
|
+
};
|
|
9504
|
+
};
|
|
8039
9505
|
/**
|
|
9506
|
+
* Validates basic action structure and required fields
|
|
9507
|
+
* @param action - The action to validate
|
|
9508
|
+
* @returns Object containing validation result and missing fields
|
|
8040
9509
|
*
|
|
8041
|
-
* @
|
|
8042
|
-
* @param colNames
|
|
9510
|
+
* @hidden
|
|
8043
9511
|
*/
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
}));
|
|
8053
|
-
}
|
|
9512
|
+
const validateActionStructure = (action) => {
|
|
9513
|
+
if (!action || typeof action !== 'object') {
|
|
9514
|
+
return { isValid: false, missingFields: [] };
|
|
9515
|
+
}
|
|
9516
|
+
// Check for all missing required fields
|
|
9517
|
+
const missingFields = ['id', 'name', 'target', 'position'].filter(field => !action[field]);
|
|
9518
|
+
return { isValid: missingFields.length === 0, missingFields };
|
|
9519
|
+
};
|
|
8054
9520
|
/**
|
|
9521
|
+
* Checks for duplicate IDs among actions
|
|
9522
|
+
* @param actions - Array of actions to check
|
|
9523
|
+
* @returns Object containing filtered actions and duplicate errors
|
|
8055
9524
|
*
|
|
8056
|
-
* @
|
|
9525
|
+
* @hidden
|
|
8057
9526
|
*/
|
|
8058
|
-
|
|
8059
|
-
const
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
let dataValue;
|
|
8069
|
-
if (dataType === 'DATE') {
|
|
8070
|
-
if (Number.isFinite(colVal.value)) {
|
|
8071
|
-
dataValue = [{
|
|
8072
|
-
epochRange: {
|
|
8073
|
-
startEpoch: colVal.value,
|
|
8074
|
-
},
|
|
8075
|
-
}];
|
|
8076
|
-
// Case for custom calendar.
|
|
8077
|
-
}
|
|
8078
|
-
else if ((_a = colVal.value) === null || _a === void 0 ? void 0 : _a.v) {
|
|
8079
|
-
dataValue = [{
|
|
8080
|
-
epochRange: {
|
|
8081
|
-
startEpoch: colVal.value.v.s,
|
|
8082
|
-
endEpoch: colVal.value.v.e,
|
|
8083
|
-
},
|
|
8084
|
-
}];
|
|
8085
|
-
}
|
|
9527
|
+
const filterDuplicateIds = (actions) => {
|
|
9528
|
+
const idMap = actions.reduce((map, action) => {
|
|
9529
|
+
const list = map.get(action.id) || [];
|
|
9530
|
+
list.push(action);
|
|
9531
|
+
map.set(action.id, list);
|
|
9532
|
+
return map;
|
|
9533
|
+
}, new Map());
|
|
9534
|
+
const { actions: actionsWithUniqueIds, errors } = Array.from(idMap.entries()).reduce((acc, [id, actionsWithSameId]) => {
|
|
9535
|
+
if (actionsWithSameId.length === 1) {
|
|
9536
|
+
acc.actions.push(actionsWithSameId[0]);
|
|
8086
9537
|
}
|
|
8087
9538
|
else {
|
|
8088
|
-
|
|
9539
|
+
// Keep the first action and add error for duplicates
|
|
9540
|
+
acc.actions.push(actionsWithSameId[0]);
|
|
9541
|
+
const duplicateNames = actionsWithSameId.slice(1).map(action => action.name);
|
|
9542
|
+
acc.errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.DUPLICATE_IDS(id, duplicateNames, actionsWithSameId[0].name));
|
|
8089
9543
|
}
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
}
|
|
8095
|
-
selectedPoints.forEach((p) => {
|
|
8096
|
-
p.selectedAttributes.forEach(addPointFromColVal);
|
|
8097
|
-
});
|
|
8098
|
-
return underlyingDataPoint;
|
|
8099
|
-
}
|
|
9544
|
+
return acc;
|
|
9545
|
+
}, { actions: [], errors: [] });
|
|
9546
|
+
return { actions: actionsWithUniqueIds, errors };
|
|
9547
|
+
};
|
|
8100
9548
|
/**
|
|
8101
|
-
*
|
|
8102
|
-
* @param
|
|
8103
|
-
* @
|
|
9549
|
+
* Validates and processes custom actions
|
|
9550
|
+
* @param customActions - Array of custom actions to validate
|
|
9551
|
+
* @returns Object containing valid actions and any validation errors
|
|
8104
9552
|
*/
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
9553
|
+
const getCustomActions = (customActions) => {
|
|
9554
|
+
const errors = [];
|
|
9555
|
+
if (!customActions || !Array.isArray(customActions)) {
|
|
9556
|
+
return { actions: [], errors: [] };
|
|
9557
|
+
}
|
|
9558
|
+
// Step 1: Handle invalid actions first (null, undefined, missing required
|
|
9559
|
+
// fields)
|
|
9560
|
+
const validActions = customActions.filter(action => {
|
|
9561
|
+
const validation = validateActionStructure(action);
|
|
9562
|
+
if (!validation.isValid) {
|
|
9563
|
+
if (!action || typeof action !== 'object') {
|
|
9564
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_ACTION_OBJECT);
|
|
9565
|
+
}
|
|
9566
|
+
else {
|
|
9567
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.MISSING_REQUIRED_FIELDS(action.id, validation.missingFields));
|
|
9568
|
+
}
|
|
9569
|
+
return false;
|
|
9570
|
+
}
|
|
9571
|
+
return true;
|
|
9572
|
+
});
|
|
9573
|
+
// Step 2: Check for duplicate IDs among valid actions
|
|
9574
|
+
const { actions: actionsWithUniqueIds, errors: duplicateErrors } = filterDuplicateIds(validActions);
|
|
9575
|
+
// Add duplicate errors to the errors array
|
|
9576
|
+
duplicateErrors.forEach(error => errors.push(error));
|
|
9577
|
+
// Step 3: Validate actions with unique IDs
|
|
9578
|
+
const finalValidActions = [];
|
|
9579
|
+
actionsWithUniqueIds.forEach((action) => {
|
|
9580
|
+
const { isValid, errors: validationErrors } = validateCustomAction(action);
|
|
9581
|
+
validationErrors.forEach(error => errors.push(error));
|
|
9582
|
+
if (isValid) {
|
|
9583
|
+
finalValidActions.push(action);
|
|
9584
|
+
}
|
|
9585
|
+
});
|
|
9586
|
+
const sortedActions = sortBy_1(finalValidActions, (a) => a.name.toLocaleLowerCase());
|
|
9587
|
+
return {
|
|
9588
|
+
actions: sortedActions,
|
|
9589
|
+
errors: errors,
|
|
9590
|
+
};
|
|
9591
|
+
};
|
|
8115
9592
|
|
|
8116
9593
|
/**
|
|
8117
9594
|
* Copyright (c) 2023
|
|
@@ -15805,6 +17282,13 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15805
17282
|
handleExitPresentMode();
|
|
15806
17283
|
}
|
|
15807
17284
|
}
|
|
17285
|
+
/**
|
|
17286
|
+
* Clears the cached preauth and session info.
|
|
17287
|
+
*/
|
|
17288
|
+
function processClearInfoCache() {
|
|
17289
|
+
resetCachedPreauthInfo();
|
|
17290
|
+
resetCachedSessionInfo();
|
|
17291
|
+
}
|
|
15808
17292
|
/**
|
|
15809
17293
|
*
|
|
15810
17294
|
* @param e
|
|
@@ -15911,11 +17395,13 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15911
17395
|
return processAuthLogout(e, containerEl);
|
|
15912
17396
|
case exports.EmbedEvent.ExitPresentMode:
|
|
15913
17397
|
return processExitPresentMode();
|
|
17398
|
+
case exports.EmbedEvent.CLEAR_INFO_CACHE:
|
|
17399
|
+
return processClearInfoCache();
|
|
15914
17400
|
}
|
|
15915
17401
|
return e;
|
|
15916
17402
|
}
|
|
15917
17403
|
|
|
15918
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.40.
|
|
17404
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.40.3";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | npx coveralls-next","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^11.2.0","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",ajv:"^8.17.1",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1","coveralls-next":"^5.0.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^2.0.0",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"32 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
15919
17405
|
|
|
15920
17406
|
/**
|
|
15921
17407
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -16440,6 +17926,16 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16440
17926
|
async getDefaultAppInitData() {
|
|
16441
17927
|
var _a, _b;
|
|
16442
17928
|
const authToken = await this.getAuthTokenForCookielessInit();
|
|
17929
|
+
const customActionsResult = getCustomActions([
|
|
17930
|
+
...(this.viewConfig.customActions || []),
|
|
17931
|
+
...(this.embedConfig.customActions || [])
|
|
17932
|
+
]);
|
|
17933
|
+
if (customActionsResult.errors.length > 0) {
|
|
17934
|
+
this.handleError({
|
|
17935
|
+
type: 'CUSTOM_ACTION_VALIDATION',
|
|
17936
|
+
message: customActionsResult.errors,
|
|
17937
|
+
});
|
|
17938
|
+
}
|
|
16443
17939
|
return {
|
|
16444
17940
|
customisations: getCustomisations(this.embedConfig, this.viewConfig),
|
|
16445
17941
|
authToken,
|
|
@@ -16457,6 +17953,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
16457
17953
|
: [],
|
|
16458
17954
|
customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
|
|
16459
17955
|
hiddenListColumns: this.viewConfig.hiddenListColumns || [],
|
|
17956
|
+
customActions: customActionsResult.actions,
|
|
16460
17957
|
};
|
|
16461
17958
|
}
|
|
16462
17959
|
async getAppInitData() {
|
|
@@ -17571,7 +19068,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17571
19068
|
* embedded Liveboard or visualization.
|
|
17572
19069
|
*/
|
|
17573
19070
|
getEmbedParams() {
|
|
17574
|
-
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = exports.DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
19071
|
+
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = exports.DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
17575
19072
|
let params = {};
|
|
17576
19073
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
17577
19074
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
@@ -17588,6 +19085,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17588
19085
|
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
17589
19086
|
params[Param.IsUnifiedSearchExperienceEnabled] = isUnifiedSearchExperienceEnabled;
|
|
17590
19087
|
params[Param.CoverAndFilterOptionInPDF] = !!coverAndFilterOptionInPDF;
|
|
19088
|
+
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
|
|
17591
19089
|
params = this.getBaseQueryParams(params);
|
|
17592
19090
|
if (hideObjectSearch) {
|
|
17593
19091
|
params[Param.HideObjectSearch] = !!hideObjectSearch;
|
|
@@ -17658,6 +19156,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17658
19156
|
// Set homePageVersion to v2 by default to reset the LD flag value
|
|
17659
19157
|
// for the homepageVersion.
|
|
17660
19158
|
params[Param.HomepageVersion] = 'v2';
|
|
19159
|
+
// Set listpageVersion to v2 by default to reset the LD flag value
|
|
19160
|
+
// for the listpageVersion.
|
|
19161
|
+
params[Param.ListPageVersion] = exports.ListPage.List;
|
|
17661
19162
|
if (discoveryExperience) {
|
|
17662
19163
|
// primaryNavbarVersion v3 will enabled the new left navigation
|
|
17663
19164
|
if (discoveryExperience.primaryNavbarVersion === exports.PrimaryNavbarVersion.Sliding) {
|
|
@@ -17981,7 +19482,7 @@ query GetEurekaVizSnapshots(
|
|
|
17981
19482
|
getEmbedParams() {
|
|
17982
19483
|
let params = {};
|
|
17983
19484
|
params = this.getBaseQueryParams(params);
|
|
17984
|
-
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, isLiveboardHeaderSticky = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, enableAskSage, enable2ColumnLayout, dataPanelV2 = false, enableCustomColumnGroups = false, oAuthPollingInterval, isForceRedirect, dataSourceId, coverAndFilterOptionInPDF = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
19485
|
+
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, isLiveboardHeaderSticky = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, enableAskSage, enable2ColumnLayout, dataPanelV2 = false, enableCustomColumnGroups = false, oAuthPollingInterval, isForceRedirect, dataSourceId, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
17985
19486
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
17986
19487
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
17987
19488
|
if (fullHeight === true) {
|
|
@@ -18048,6 +19549,7 @@ query GetEurekaVizSnapshots(
|
|
|
18048
19549
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
18049
19550
|
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
18050
19551
|
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
19552
|
+
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
|
|
18051
19553
|
const queryParams = getQueryParamString(params, true);
|
|
18052
19554
|
return queryParams;
|
|
18053
19555
|
}
|