@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.es.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 _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
|
@@ -373,6 +373,15 @@ function storeValueInWindow(key, value, options = {}) {
|
|
|
373
373
|
* @returns The stored value or `undefined` if the key is not found.
|
|
374
374
|
*/
|
|
375
375
|
const getValueFromWindow = (key) => { var _a; return (_a = window === null || window === void 0 ? void 0 : window[sdkWindowKey]) === null || _a === void 0 ? void 0 : _a[key]; };
|
|
376
|
+
/**
|
|
377
|
+
* Check if an array includes a string value
|
|
378
|
+
* @param arr - The array to check
|
|
379
|
+
* @param key - The string to search for
|
|
380
|
+
* @returns boolean indicating if the string is found in the array
|
|
381
|
+
*/
|
|
382
|
+
const arrayIncludesString = (arr, key) => {
|
|
383
|
+
return arr.some(item => typeof item === 'string' && item === key);
|
|
384
|
+
};
|
|
376
385
|
/**
|
|
377
386
|
* Check if the document is currently in fullscreen mode
|
|
378
387
|
*/
|
|
@@ -468,7 +477,6 @@ const calculateVisibleElementData = (element) => {
|
|
|
468
477
|
* the embedded app
|
|
469
478
|
* @group Authentication / Init
|
|
470
479
|
*/
|
|
471
|
-
// eslint-disable-next-line no-shadow
|
|
472
480
|
var AuthType;
|
|
473
481
|
(function (AuthType) {
|
|
474
482
|
/**
|
|
@@ -682,7 +690,6 @@ var HomeLeftNavItem;
|
|
|
682
690
|
/**
|
|
683
691
|
* A map of the supported runtime filter operations
|
|
684
692
|
*/
|
|
685
|
-
// eslint-disable-next-line no-shadow
|
|
686
693
|
var RuntimeFilterOp;
|
|
687
694
|
(function (RuntimeFilterOp) {
|
|
688
695
|
/**
|
|
@@ -753,7 +760,6 @@ var RuntimeFilterOp;
|
|
|
753
760
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
754
761
|
* @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw
|
|
755
762
|
*/
|
|
756
|
-
// eslint-disable-next-line no-shadow
|
|
757
763
|
var HomepageModule;
|
|
758
764
|
(function (HomepageModule) {
|
|
759
765
|
/**
|
|
@@ -786,7 +792,6 @@ var HomepageModule;
|
|
|
786
792
|
* **Note**: This option is applicable to full app embedding only.
|
|
787
793
|
* @version SDK: 1.38.0 | ThoughtSpot: 10.9.0.cl
|
|
788
794
|
*/
|
|
789
|
-
// eslint-disable-next-line no-shadow
|
|
790
795
|
var ListPageColumns;
|
|
791
796
|
(function (ListPageColumns) {
|
|
792
797
|
/**
|
|
@@ -849,7 +854,6 @@ var ListPageColumns;
|
|
|
849
854
|
* ```
|
|
850
855
|
* @group Events
|
|
851
856
|
*/
|
|
852
|
-
// eslint-disable-next-line no-shadow
|
|
853
857
|
var EmbedEvent;
|
|
854
858
|
(function (EmbedEvent) {
|
|
855
859
|
/**
|
|
@@ -1491,6 +1495,11 @@ var EmbedEvent;
|
|
|
1491
1495
|
* @hidden
|
|
1492
1496
|
*/
|
|
1493
1497
|
EmbedEvent["APP_INIT"] = "appInit";
|
|
1498
|
+
/**
|
|
1499
|
+
* Internal event to clear the cached info
|
|
1500
|
+
* @hidden
|
|
1501
|
+
*/
|
|
1502
|
+
EmbedEvent["CLEAR_INFO_CACHE"] = "clearInfoCache";
|
|
1494
1503
|
/**
|
|
1495
1504
|
* Emitted when a user clicks **Show Liveboard details** on a Liveboard
|
|
1496
1505
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
@@ -1959,6 +1968,17 @@ var EmbedEvent;
|
|
|
1959
1968
|
* ```
|
|
1960
1969
|
*/
|
|
1961
1970
|
EmbedEvent["EmbedListenerReady"] = "EmbedListenerReady";
|
|
1971
|
+
/**
|
|
1972
|
+
* Emitted when the organization is switched.
|
|
1973
|
+
* @example
|
|
1974
|
+
* ```js
|
|
1975
|
+
* appEmbed.on(EmbedEvent.OrgSwitched, (payload) => {
|
|
1976
|
+
* console.log('payload', payload);
|
|
1977
|
+
* })
|
|
1978
|
+
* ```
|
|
1979
|
+
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
1980
|
+
*/
|
|
1981
|
+
EmbedEvent["OrgSwitched"] = "orgSwitched";
|
|
1962
1982
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
1963
1983
|
/**
|
|
1964
1984
|
* Event types that can be triggered by the host application
|
|
@@ -2013,7 +2033,6 @@ var EmbedEvent;
|
|
|
2013
2033
|
* ```
|
|
2014
2034
|
* @group Events
|
|
2015
2035
|
*/
|
|
2016
|
-
// eslint-disable-next-line no-shadow
|
|
2017
2036
|
var HostEvent;
|
|
2018
2037
|
(function (HostEvent) {
|
|
2019
2038
|
/**
|
|
@@ -3228,7 +3247,6 @@ var HostEvent;
|
|
|
3228
3247
|
* The different visual modes that the data sources panel within
|
|
3229
3248
|
* search could appear in, such as hidden, collapsed, or expanded.
|
|
3230
3249
|
*/
|
|
3231
|
-
// eslint-disable-next-line no-shadow
|
|
3232
3250
|
var DataSourceVisualMode;
|
|
3233
3251
|
(function (DataSourceVisualMode) {
|
|
3234
3252
|
/**
|
|
@@ -3248,7 +3266,6 @@ var DataSourceVisualMode;
|
|
|
3248
3266
|
* The query params passed down to the embedded ThoughtSpot app
|
|
3249
3267
|
* containing configuration and/or visual information.
|
|
3250
3268
|
*/
|
|
3251
|
-
// eslint-disable-next-line no-shadow
|
|
3252
3269
|
var Param;
|
|
3253
3270
|
(function (Param) {
|
|
3254
3271
|
Param["EmbedApp"] = "embedApp";
|
|
@@ -3370,6 +3387,7 @@ var Param;
|
|
|
3370
3387
|
Param["IsLiveboardStylingAndGroupingEnabled"] = "isLiveboardStylingAndGroupingEnabled";
|
|
3371
3388
|
Param["IsLazyLoadingForEmbedEnabled"] = "isLazyLoadingForEmbedEnabled";
|
|
3372
3389
|
Param["RootMarginForLazyLoad"] = "rootMarginForLazyLoad";
|
|
3390
|
+
Param["LiveboardXLSXCSVDownload"] = "isLiveboardXLSXCSVDownloadEnabled";
|
|
3373
3391
|
})(Param || (Param = {}));
|
|
3374
3392
|
/**
|
|
3375
3393
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -3398,7 +3416,6 @@ var Param;
|
|
|
3398
3416
|
* ```
|
|
3399
3417
|
* See also link:https://developers.thoughtspot.com/docs/actions[Action IDs in the SDK]
|
|
3400
3418
|
*/
|
|
3401
|
-
// eslint-disable-next-line no-shadow
|
|
3402
3419
|
var Action;
|
|
3403
3420
|
(function (Action) {
|
|
3404
3421
|
/**
|
|
@@ -3943,7 +3960,7 @@ var Action;
|
|
|
3943
3960
|
* The Favorites icon (*) for Answers,
|
|
3944
3961
|
* Liveboard, and data objects like Worksheet, Model,
|
|
3945
3962
|
* Tables and Views.
|
|
3946
|
-
* Allows adding an object to the user
|
|
3963
|
+
* Allows adding an object to the user's favorites list.
|
|
3947
3964
|
* @example
|
|
3948
3965
|
* ```js
|
|
3949
3966
|
* disabledActions: [Action.AddToFavorites]
|
|
@@ -4670,6 +4687,26 @@ var ContextMenuTriggerOptions;
|
|
|
4670
4687
|
ContextMenuTriggerOptions["RIGHT_CLICK"] = "right-click";
|
|
4671
4688
|
ContextMenuTriggerOptions["BOTH_CLICKS"] = "both-clicks";
|
|
4672
4689
|
})(ContextMenuTriggerOptions || (ContextMenuTriggerOptions = {}));
|
|
4690
|
+
/**
|
|
4691
|
+
* Enum options to show custom actions at different
|
|
4692
|
+
* positions in the application.
|
|
4693
|
+
*/
|
|
4694
|
+
var CustomActionsPosition;
|
|
4695
|
+
(function (CustomActionsPosition) {
|
|
4696
|
+
CustomActionsPosition["PRIMARY"] = "PRIMARY";
|
|
4697
|
+
CustomActionsPosition["MENU"] = "MENU";
|
|
4698
|
+
CustomActionsPosition["CONTEXTMENU"] = "CONTEXTMENU";
|
|
4699
|
+
})(CustomActionsPosition || (CustomActionsPosition = {}));
|
|
4700
|
+
/**
|
|
4701
|
+
* Enum options to mention the target of the custom action.
|
|
4702
|
+
*/
|
|
4703
|
+
var CustomActionTarget;
|
|
4704
|
+
(function (CustomActionTarget) {
|
|
4705
|
+
CustomActionTarget["LIVEBOARD"] = "LIVEBOARD";
|
|
4706
|
+
CustomActionTarget["VIZ"] = "VIZ";
|
|
4707
|
+
CustomActionTarget["ANSWER"] = "ANSWER";
|
|
4708
|
+
CustomActionTarget["SPOTTER"] = "SPOTTER";
|
|
4709
|
+
})(CustomActionTarget || (CustomActionTarget = {}));
|
|
4673
4710
|
/**
|
|
4674
4711
|
* Enum options to show or suppress Visual Embed SDK and
|
|
4675
4712
|
* ThoughtSpot application logs in the console output.
|
|
@@ -5826,8 +5863,8 @@ function cacheHas(cache, key) {
|
|
|
5826
5863
|
var _cacheHas = cacheHas;
|
|
5827
5864
|
|
|
5828
5865
|
/** Used to compose bitmasks for value comparisons. */
|
|
5829
|
-
var COMPARE_PARTIAL_FLAG$
|
|
5830
|
-
COMPARE_UNORDERED_FLAG$
|
|
5866
|
+
var COMPARE_PARTIAL_FLAG$5 = 1,
|
|
5867
|
+
COMPARE_UNORDERED_FLAG$3 = 2;
|
|
5831
5868
|
|
|
5832
5869
|
/**
|
|
5833
5870
|
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
@@ -5843,7 +5880,7 @@ var COMPARE_PARTIAL_FLAG$3 = 1,
|
|
|
5843
5880
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
5844
5881
|
*/
|
|
5845
5882
|
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
5846
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
5883
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,
|
|
5847
5884
|
arrLength = array.length,
|
|
5848
5885
|
othLength = other.length;
|
|
5849
5886
|
|
|
@@ -5858,7 +5895,7 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
|
5858
5895
|
}
|
|
5859
5896
|
var index = -1,
|
|
5860
5897
|
result = true,
|
|
5861
|
-
seen = (bitmask & COMPARE_UNORDERED_FLAG$
|
|
5898
|
+
seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new _SetCache : undefined;
|
|
5862
5899
|
|
|
5863
5900
|
stack.set(array, other);
|
|
5864
5901
|
stack.set(other, array);
|
|
@@ -5950,8 +5987,8 @@ function setToArray(set) {
|
|
|
5950
5987
|
var _setToArray = setToArray;
|
|
5951
5988
|
|
|
5952
5989
|
/** Used to compose bitmasks for value comparisons. */
|
|
5953
|
-
var COMPARE_PARTIAL_FLAG$
|
|
5954
|
-
COMPARE_UNORDERED_FLAG = 2;
|
|
5990
|
+
var COMPARE_PARTIAL_FLAG$4 = 1,
|
|
5991
|
+
COMPARE_UNORDERED_FLAG$2 = 2;
|
|
5955
5992
|
|
|
5956
5993
|
/** `Object#toString` result references. */
|
|
5957
5994
|
var boolTag$1 = '[object Boolean]',
|
|
@@ -5962,14 +5999,14 @@ var boolTag$1 = '[object Boolean]',
|
|
|
5962
5999
|
regexpTag$1 = '[object RegExp]',
|
|
5963
6000
|
setTag$3 = '[object Set]',
|
|
5964
6001
|
stringTag$1 = '[object String]',
|
|
5965
|
-
symbolTag = '[object Symbol]';
|
|
6002
|
+
symbolTag$1 = '[object Symbol]';
|
|
5966
6003
|
|
|
5967
6004
|
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
5968
6005
|
dataViewTag$2 = '[object DataView]';
|
|
5969
6006
|
|
|
5970
6007
|
/** Used to convert symbols to primitives and strings. */
|
|
5971
|
-
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
5972
|
-
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
6008
|
+
var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined,
|
|
6009
|
+
symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
|
|
5973
6010
|
|
|
5974
6011
|
/**
|
|
5975
6012
|
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
@@ -6026,7 +6063,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
6026
6063
|
var convert = _mapToArray;
|
|
6027
6064
|
|
|
6028
6065
|
case setTag$3:
|
|
6029
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
6066
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
|
|
6030
6067
|
convert || (convert = _setToArray);
|
|
6031
6068
|
|
|
6032
6069
|
if (object.size != other.size && !isPartial) {
|
|
@@ -6037,7 +6074,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
6037
6074
|
if (stacked) {
|
|
6038
6075
|
return stacked == other;
|
|
6039
6076
|
}
|
|
6040
|
-
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
6077
|
+
bitmask |= COMPARE_UNORDERED_FLAG$2;
|
|
6041
6078
|
|
|
6042
6079
|
// Recursively compare objects (susceptible to call stack limits).
|
|
6043
6080
|
stack.set(object, other);
|
|
@@ -6045,7 +6082,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
6045
6082
|
stack['delete'](object);
|
|
6046
6083
|
return result;
|
|
6047
6084
|
|
|
6048
|
-
case symbolTag:
|
|
6085
|
+
case symbolTag$1:
|
|
6049
6086
|
if (symbolValueOf) {
|
|
6050
6087
|
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
6051
6088
|
}
|
|
@@ -6736,7 +6773,7 @@ function getAllKeys(object) {
|
|
|
6736
6773
|
var _getAllKeys = getAllKeys;
|
|
6737
6774
|
|
|
6738
6775
|
/** Used to compose bitmasks for value comparisons. */
|
|
6739
|
-
var COMPARE_PARTIAL_FLAG$
|
|
6776
|
+
var COMPARE_PARTIAL_FLAG$3 = 1;
|
|
6740
6777
|
|
|
6741
6778
|
/** Used for built-in method references. */
|
|
6742
6779
|
var objectProto$2 = Object.prototype;
|
|
@@ -6758,7 +6795,7 @@ var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
|
|
|
6758
6795
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
6759
6796
|
*/
|
|
6760
6797
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
6761
|
-
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$
|
|
6798
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
|
|
6762
6799
|
objProps = _getAllKeys(object),
|
|
6763
6800
|
objLength = objProps.length,
|
|
6764
6801
|
othProps = _getAllKeys(other),
|
|
@@ -6896,7 +6933,7 @@ if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
|
6896
6933
|
var _getTag = getTag;
|
|
6897
6934
|
|
|
6898
6935
|
/** Used to compose bitmasks for value comparisons. */
|
|
6899
|
-
var COMPARE_PARTIAL_FLAG = 1;
|
|
6936
|
+
var COMPARE_PARTIAL_FLAG$2 = 1;
|
|
6900
6937
|
|
|
6901
6938
|
/** `Object#toString` result references. */
|
|
6902
6939
|
var argsTag = '[object Arguments]',
|
|
@@ -6949,7 +6986,7 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
6949
6986
|
? _equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
|
6950
6987
|
: _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
6951
6988
|
}
|
|
6952
|
-
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
6989
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
|
|
6953
6990
|
var objIsWrapped = objIsObj && hasOwnProperty$2.call(object, '__wrapped__'),
|
|
6954
6991
|
othIsWrapped = othIsObj && hasOwnProperty$2.call(other, '__wrapped__');
|
|
6955
6992
|
|
|
@@ -7119,6 +7156,16 @@ const ERROR_MESSAGE = {
|
|
|
7119
7156
|
MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
|
|
7120
7157
|
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',
|
|
7121
7158
|
SPOTTER_AGENT_NOT_INITIALIZED: 'SpotterAgent not initialized',
|
|
7159
|
+
};
|
|
7160
|
+
const CUSTOM_ACTIONS_ERROR_MESSAGE = {
|
|
7161
|
+
INVALID_ACTION_OBJECT: 'Custom Action Validation Error: Invalid action object provided',
|
|
7162
|
+
MISSING_REQUIRED_FIELDS: (id, missingFields) => `Custom Action Validation Error for '${id}': Missing required fields: ${missingFields.join(', ')}`,
|
|
7163
|
+
UNSUPPORTED_TARGET: (id, targetType) => `Custom Action Validation Error for '${id}': Target type '${targetType}' is not supported`,
|
|
7164
|
+
INVALID_POSITION: (position, targetType, supportedPositions) => `Position '${position}' is not supported for ${targetType.toLowerCase()}-level custom actions. Supported positions: ${supportedPositions}`,
|
|
7165
|
+
INVALID_METADATA_IDS: (targetType, invalidIds, supportedIds) => `Invalid metadata IDs for ${targetType.toLowerCase()}-level custom actions: ${invalidIds.join(', ')}. Supported metadata IDs: ${supportedIds}`,
|
|
7166
|
+
INVALID_DATA_MODEL_IDS: (targetType, invalidIds, supportedIds) => `Invalid data model IDs for ${targetType.toLowerCase()}-level custom actions: ${invalidIds.join(', ')}. Supported data model IDs: ${supportedIds}`,
|
|
7167
|
+
INVALID_FIELDS: (targetType, invalidFields, supportedFields) => `Invalid fields for ${targetType.toLowerCase()}-level custom actions: ${invalidFields.join(', ')}. Supported fields: ${supportedFields}`,
|
|
7168
|
+
DUPLICATE_IDS: (id, duplicateNames, keptName) => `Duplicate custom action ID '${id}' found. Actions with names '${duplicateNames.join("', '")}' will be ignored. Keeping '${keptName}'.`,
|
|
7122
7169
|
};
|
|
7123
7170
|
|
|
7124
7171
|
const EndPoints = {
|
|
@@ -7971,141 +8018,1571 @@ class AnswerService {
|
|
|
7971
8018
|
if (columnsToRemove.length) {
|
|
7972
8019
|
await unaggAnswerSession.removeColumns(columnsToRemove);
|
|
7973
8020
|
}
|
|
7974
|
-
return unaggAnswerSession;
|
|
7975
|
-
}
|
|
7976
|
-
/**
|
|
7977
|
-
* Execute a custom graphql query in the context of the answer.
|
|
7978
|
-
* @param query graphql query
|
|
7979
|
-
* @param variables graphql variables
|
|
7980
|
-
* @returns
|
|
7981
|
-
*/
|
|
7982
|
-
async executeQuery(query, variables) {
|
|
7983
|
-
const data = await graphqlQuery({
|
|
7984
|
-
query,
|
|
7985
|
-
variables: {
|
|
7986
|
-
session: this.session,
|
|
7987
|
-
...variables,
|
|
7988
|
-
},
|
|
7989
|
-
thoughtSpotHost: this.thoughtSpotHost,
|
|
7990
|
-
isCompositeQuery: false,
|
|
7991
|
-
});
|
|
7992
|
-
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
7993
|
-
return data;
|
|
7994
|
-
}
|
|
7995
|
-
/**
|
|
7996
|
-
* Get the internal session details for the answer.
|
|
7997
|
-
* @returns
|
|
7998
|
-
*/
|
|
7999
|
-
getSession() {
|
|
8000
|
-
return this.session;
|
|
8021
|
+
return unaggAnswerSession;
|
|
8022
|
+
}
|
|
8023
|
+
/**
|
|
8024
|
+
* Execute a custom graphql query in the context of the answer.
|
|
8025
|
+
* @param query graphql query
|
|
8026
|
+
* @param variables graphql variables
|
|
8027
|
+
* @returns
|
|
8028
|
+
*/
|
|
8029
|
+
async executeQuery(query, variables) {
|
|
8030
|
+
const data = await graphqlQuery({
|
|
8031
|
+
query,
|
|
8032
|
+
variables: {
|
|
8033
|
+
session: this.session,
|
|
8034
|
+
...variables,
|
|
8035
|
+
},
|
|
8036
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
8037
|
+
isCompositeQuery: false,
|
|
8038
|
+
});
|
|
8039
|
+
this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
|
|
8040
|
+
return data;
|
|
8041
|
+
}
|
|
8042
|
+
/**
|
|
8043
|
+
* Get the internal session details for the answer.
|
|
8044
|
+
* @returns
|
|
8045
|
+
*/
|
|
8046
|
+
getSession() {
|
|
8047
|
+
return this.session;
|
|
8048
|
+
}
|
|
8049
|
+
async getAnswer() {
|
|
8050
|
+
if (this.answer) {
|
|
8051
|
+
return this.answer;
|
|
8052
|
+
}
|
|
8053
|
+
this.answer = this.executeQuery(getAnswer, {}).then((data) => data === null || data === void 0 ? void 0 : data.answer);
|
|
8054
|
+
return this.answer;
|
|
8055
|
+
}
|
|
8056
|
+
async getTML() {
|
|
8057
|
+
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
8058
|
+
const edoc = object[0].edoc;
|
|
8059
|
+
const YAML = await import('./index-BICLzyVL.js');
|
|
8060
|
+
const parsedDoc = YAML.parse(edoc);
|
|
8061
|
+
return {
|
|
8062
|
+
answer: {
|
|
8063
|
+
...parsedDoc.answer,
|
|
8064
|
+
...this.tmlOverride,
|
|
8065
|
+
},
|
|
8066
|
+
};
|
|
8067
|
+
}
|
|
8068
|
+
async addDisplayedVizToLiveboard(liveboardId) {
|
|
8069
|
+
const { displayMode, visualizations } = await this.getAnswer();
|
|
8070
|
+
const viz = getDisplayedViz(visualizations, displayMode);
|
|
8071
|
+
return this.executeQuery(addVizToLiveboard, {
|
|
8072
|
+
liveboardId,
|
|
8073
|
+
vizId: viz.id,
|
|
8074
|
+
});
|
|
8075
|
+
}
|
|
8076
|
+
setTMLOverride(override) {
|
|
8077
|
+
this.tmlOverride = override;
|
|
8078
|
+
}
|
|
8079
|
+
}
|
|
8080
|
+
/**
|
|
8081
|
+
*
|
|
8082
|
+
* @param sourceDetail
|
|
8083
|
+
* @param colNames
|
|
8084
|
+
*/
|
|
8085
|
+
function getGuidsFromColumnNames(sourceDetail, colNames) {
|
|
8086
|
+
const cols = sourceDetail.columns.reduce((colSet, col) => {
|
|
8087
|
+
colSet[col.name.toLowerCase()] = col;
|
|
8088
|
+
return colSet;
|
|
8089
|
+
}, {});
|
|
8090
|
+
return new Set(colNames.map((colName) => {
|
|
8091
|
+
const col = cols[colName.toLowerCase()];
|
|
8092
|
+
return col.id;
|
|
8093
|
+
}));
|
|
8094
|
+
}
|
|
8095
|
+
/**
|
|
8096
|
+
*
|
|
8097
|
+
* @param selectedPoints
|
|
8098
|
+
*/
|
|
8099
|
+
function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
|
|
8100
|
+
const underlyingDataPoint = [];
|
|
8101
|
+
/**
|
|
8102
|
+
*
|
|
8103
|
+
* @param colVal
|
|
8104
|
+
*/
|
|
8105
|
+
function addPointFromColVal(colVal) {
|
|
8106
|
+
var _a;
|
|
8107
|
+
const dataType = colVal.column.dataType;
|
|
8108
|
+
colVal.column.id;
|
|
8109
|
+
let dataValue;
|
|
8110
|
+
if (dataType === 'DATE') {
|
|
8111
|
+
if (Number.isFinite(colVal.value)) {
|
|
8112
|
+
dataValue = [{
|
|
8113
|
+
epochRange: {
|
|
8114
|
+
startEpoch: colVal.value,
|
|
8115
|
+
},
|
|
8116
|
+
}];
|
|
8117
|
+
// Case for custom calendar.
|
|
8118
|
+
}
|
|
8119
|
+
else if ((_a = colVal.value) === null || _a === void 0 ? void 0 : _a.v) {
|
|
8120
|
+
dataValue = [{
|
|
8121
|
+
epochRange: {
|
|
8122
|
+
startEpoch: colVal.value.v.s,
|
|
8123
|
+
endEpoch: colVal.value.v.e,
|
|
8124
|
+
},
|
|
8125
|
+
}];
|
|
8126
|
+
}
|
|
8127
|
+
}
|
|
8128
|
+
else {
|
|
8129
|
+
dataValue = [{ value: colVal.value }];
|
|
8130
|
+
}
|
|
8131
|
+
underlyingDataPoint.push({
|
|
8132
|
+
columnId: colVal.column.id,
|
|
8133
|
+
dataValue,
|
|
8134
|
+
});
|
|
8135
|
+
}
|
|
8136
|
+
selectedPoints.forEach((p) => {
|
|
8137
|
+
p.selectedAttributes.forEach(addPointFromColVal);
|
|
8138
|
+
});
|
|
8139
|
+
return underlyingDataPoint;
|
|
8140
|
+
}
|
|
8141
|
+
/**
|
|
8142
|
+
*
|
|
8143
|
+
* @param visualizations
|
|
8144
|
+
* @param displayMode
|
|
8145
|
+
*/
|
|
8146
|
+
function getDisplayedViz(visualizations, displayMode) {
|
|
8147
|
+
if (displayMode === 'CHART_MODE') {
|
|
8148
|
+
return visualizations.find(
|
|
8149
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
8150
|
+
(viz) => viz.__typename === 'ChartViz');
|
|
8151
|
+
}
|
|
8152
|
+
return visualizations.find(
|
|
8153
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
8154
|
+
(viz) => viz.__typename === 'TableViz');
|
|
8155
|
+
}
|
|
8156
|
+
|
|
8157
|
+
/** Built-in value references. */
|
|
8158
|
+
var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined;
|
|
8159
|
+
|
|
8160
|
+
/**
|
|
8161
|
+
* Checks if `value` is a flattenable `arguments` object or array.
|
|
8162
|
+
*
|
|
8163
|
+
* @private
|
|
8164
|
+
* @param {*} value The value to check.
|
|
8165
|
+
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
|
8166
|
+
*/
|
|
8167
|
+
function isFlattenable(value) {
|
|
8168
|
+
return isArray_1(value) || isArguments_1(value) ||
|
|
8169
|
+
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
8170
|
+
}
|
|
8171
|
+
|
|
8172
|
+
var _isFlattenable = isFlattenable;
|
|
8173
|
+
|
|
8174
|
+
/**
|
|
8175
|
+
* The base implementation of `_.flatten` with support for restricting flattening.
|
|
8176
|
+
*
|
|
8177
|
+
* @private
|
|
8178
|
+
* @param {Array} array The array to flatten.
|
|
8179
|
+
* @param {number} depth The maximum recursion depth.
|
|
8180
|
+
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
|
8181
|
+
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
|
8182
|
+
* @param {Array} [result=[]] The initial result value.
|
|
8183
|
+
* @returns {Array} Returns the new flattened array.
|
|
8184
|
+
*/
|
|
8185
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
8186
|
+
var index = -1,
|
|
8187
|
+
length = array.length;
|
|
8188
|
+
|
|
8189
|
+
predicate || (predicate = _isFlattenable);
|
|
8190
|
+
result || (result = []);
|
|
8191
|
+
|
|
8192
|
+
while (++index < length) {
|
|
8193
|
+
var value = array[index];
|
|
8194
|
+
if (depth > 0 && predicate(value)) {
|
|
8195
|
+
if (depth > 1) {
|
|
8196
|
+
// Recursively flatten arrays (susceptible to call stack limits).
|
|
8197
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
8198
|
+
} else {
|
|
8199
|
+
_arrayPush(result, value);
|
|
8200
|
+
}
|
|
8201
|
+
} else if (!isStrict) {
|
|
8202
|
+
result[result.length] = value;
|
|
8203
|
+
}
|
|
8204
|
+
}
|
|
8205
|
+
return result;
|
|
8206
|
+
}
|
|
8207
|
+
|
|
8208
|
+
var _baseFlatten = baseFlatten;
|
|
8209
|
+
|
|
8210
|
+
/**
|
|
8211
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
8212
|
+
* shorthands.
|
|
8213
|
+
*
|
|
8214
|
+
* @private
|
|
8215
|
+
* @param {Array} [array] The array to iterate over.
|
|
8216
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8217
|
+
* @returns {Array} Returns the new mapped array.
|
|
8218
|
+
*/
|
|
8219
|
+
function arrayMap(array, iteratee) {
|
|
8220
|
+
var index = -1,
|
|
8221
|
+
length = array == null ? 0 : array.length,
|
|
8222
|
+
result = Array(length);
|
|
8223
|
+
|
|
8224
|
+
while (++index < length) {
|
|
8225
|
+
result[index] = iteratee(array[index], index, array);
|
|
8226
|
+
}
|
|
8227
|
+
return result;
|
|
8228
|
+
}
|
|
8229
|
+
|
|
8230
|
+
var _arrayMap = arrayMap;
|
|
8231
|
+
|
|
8232
|
+
/** `Object#toString` result references. */
|
|
8233
|
+
var symbolTag = '[object Symbol]';
|
|
8234
|
+
|
|
8235
|
+
/**
|
|
8236
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
8237
|
+
*
|
|
8238
|
+
* @static
|
|
8239
|
+
* @memberOf _
|
|
8240
|
+
* @since 4.0.0
|
|
8241
|
+
* @category Lang
|
|
8242
|
+
* @param {*} value The value to check.
|
|
8243
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
8244
|
+
* @example
|
|
8245
|
+
*
|
|
8246
|
+
* _.isSymbol(Symbol.iterator);
|
|
8247
|
+
* // => true
|
|
8248
|
+
*
|
|
8249
|
+
* _.isSymbol('abc');
|
|
8250
|
+
* // => false
|
|
8251
|
+
*/
|
|
8252
|
+
function isSymbol(value) {
|
|
8253
|
+
return typeof value == 'symbol' ||
|
|
8254
|
+
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
|
8255
|
+
}
|
|
8256
|
+
|
|
8257
|
+
var isSymbol_1 = isSymbol;
|
|
8258
|
+
|
|
8259
|
+
/** Used to match property names within property paths. */
|
|
8260
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
8261
|
+
reIsPlainProp = /^\w*$/;
|
|
8262
|
+
|
|
8263
|
+
/**
|
|
8264
|
+
* Checks if `value` is a property name and not a property path.
|
|
8265
|
+
*
|
|
8266
|
+
* @private
|
|
8267
|
+
* @param {*} value The value to check.
|
|
8268
|
+
* @param {Object} [object] The object to query keys on.
|
|
8269
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
8270
|
+
*/
|
|
8271
|
+
function isKey(value, object) {
|
|
8272
|
+
if (isArray_1(value)) {
|
|
8273
|
+
return false;
|
|
8274
|
+
}
|
|
8275
|
+
var type = typeof value;
|
|
8276
|
+
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
8277
|
+
value == null || isSymbol_1(value)) {
|
|
8278
|
+
return true;
|
|
8279
|
+
}
|
|
8280
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
8281
|
+
(object != null && value in Object(object));
|
|
8282
|
+
}
|
|
8283
|
+
|
|
8284
|
+
var _isKey = isKey;
|
|
8285
|
+
|
|
8286
|
+
/** Error message constants. */
|
|
8287
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
8288
|
+
|
|
8289
|
+
/**
|
|
8290
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
8291
|
+
* provided, it determines the cache key for storing the result based on the
|
|
8292
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
8293
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
8294
|
+
* is invoked with the `this` binding of the memoized function.
|
|
8295
|
+
*
|
|
8296
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
8297
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
8298
|
+
* constructor with one whose instances implement the
|
|
8299
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
8300
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
8301
|
+
*
|
|
8302
|
+
* @static
|
|
8303
|
+
* @memberOf _
|
|
8304
|
+
* @since 0.1.0
|
|
8305
|
+
* @category Function
|
|
8306
|
+
* @param {Function} func The function to have its output memoized.
|
|
8307
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
8308
|
+
* @returns {Function} Returns the new memoized function.
|
|
8309
|
+
* @example
|
|
8310
|
+
*
|
|
8311
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
8312
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
8313
|
+
*
|
|
8314
|
+
* var values = _.memoize(_.values);
|
|
8315
|
+
* values(object);
|
|
8316
|
+
* // => [1, 2]
|
|
8317
|
+
*
|
|
8318
|
+
* values(other);
|
|
8319
|
+
* // => [3, 4]
|
|
8320
|
+
*
|
|
8321
|
+
* object.a = 2;
|
|
8322
|
+
* values(object);
|
|
8323
|
+
* // => [1, 2]
|
|
8324
|
+
*
|
|
8325
|
+
* // Modify the result cache.
|
|
8326
|
+
* values.cache.set(object, ['a', 'b']);
|
|
8327
|
+
* values(object);
|
|
8328
|
+
* // => ['a', 'b']
|
|
8329
|
+
*
|
|
8330
|
+
* // Replace `_.memoize.Cache`.
|
|
8331
|
+
* _.memoize.Cache = WeakMap;
|
|
8332
|
+
*/
|
|
8333
|
+
function memoize(func, resolver) {
|
|
8334
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
8335
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
8336
|
+
}
|
|
8337
|
+
var memoized = function() {
|
|
8338
|
+
var args = arguments,
|
|
8339
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
8340
|
+
cache = memoized.cache;
|
|
8341
|
+
|
|
8342
|
+
if (cache.has(key)) {
|
|
8343
|
+
return cache.get(key);
|
|
8344
|
+
}
|
|
8345
|
+
var result = func.apply(this, args);
|
|
8346
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
8347
|
+
return result;
|
|
8348
|
+
};
|
|
8349
|
+
memoized.cache = new (memoize.Cache || _MapCache);
|
|
8350
|
+
return memoized;
|
|
8351
|
+
}
|
|
8352
|
+
|
|
8353
|
+
// Expose `MapCache`.
|
|
8354
|
+
memoize.Cache = _MapCache;
|
|
8355
|
+
|
|
8356
|
+
var memoize_1 = memoize;
|
|
8357
|
+
|
|
8358
|
+
/** Used as the maximum memoize cache size. */
|
|
8359
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
8360
|
+
|
|
8361
|
+
/**
|
|
8362
|
+
* A specialized version of `_.memoize` which clears the memoized function's
|
|
8363
|
+
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
8364
|
+
*
|
|
8365
|
+
* @private
|
|
8366
|
+
* @param {Function} func The function to have its output memoized.
|
|
8367
|
+
* @returns {Function} Returns the new memoized function.
|
|
8368
|
+
*/
|
|
8369
|
+
function memoizeCapped(func) {
|
|
8370
|
+
var result = memoize_1(func, function(key) {
|
|
8371
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
8372
|
+
cache.clear();
|
|
8373
|
+
}
|
|
8374
|
+
return key;
|
|
8375
|
+
});
|
|
8376
|
+
|
|
8377
|
+
var cache = result.cache;
|
|
8378
|
+
return result;
|
|
8379
|
+
}
|
|
8380
|
+
|
|
8381
|
+
var _memoizeCapped = memoizeCapped;
|
|
8382
|
+
|
|
8383
|
+
/** Used to match property names within property paths. */
|
|
8384
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
8385
|
+
|
|
8386
|
+
/** Used to match backslashes in property paths. */
|
|
8387
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
8388
|
+
|
|
8389
|
+
/**
|
|
8390
|
+
* Converts `string` to a property path array.
|
|
8391
|
+
*
|
|
8392
|
+
* @private
|
|
8393
|
+
* @param {string} string The string to convert.
|
|
8394
|
+
* @returns {Array} Returns the property path array.
|
|
8395
|
+
*/
|
|
8396
|
+
var stringToPath = _memoizeCapped(function(string) {
|
|
8397
|
+
var result = [];
|
|
8398
|
+
if (string.charCodeAt(0) === 46 /* . */) {
|
|
8399
|
+
result.push('');
|
|
8400
|
+
}
|
|
8401
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
8402
|
+
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
8403
|
+
});
|
|
8404
|
+
return result;
|
|
8405
|
+
});
|
|
8406
|
+
|
|
8407
|
+
var _stringToPath = stringToPath;
|
|
8408
|
+
|
|
8409
|
+
/** Used as references for various `Number` constants. */
|
|
8410
|
+
var INFINITY$1 = 1 / 0;
|
|
8411
|
+
|
|
8412
|
+
/** Used to convert symbols to primitives and strings. */
|
|
8413
|
+
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
8414
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
8415
|
+
|
|
8416
|
+
/**
|
|
8417
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
8418
|
+
* values to empty strings.
|
|
8419
|
+
*
|
|
8420
|
+
* @private
|
|
8421
|
+
* @param {*} value The value to process.
|
|
8422
|
+
* @returns {string} Returns the string.
|
|
8423
|
+
*/
|
|
8424
|
+
function baseToString(value) {
|
|
8425
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
8426
|
+
if (typeof value == 'string') {
|
|
8427
|
+
return value;
|
|
8428
|
+
}
|
|
8429
|
+
if (isArray_1(value)) {
|
|
8430
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
8431
|
+
return _arrayMap(value, baseToString) + '';
|
|
8432
|
+
}
|
|
8433
|
+
if (isSymbol_1(value)) {
|
|
8434
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
8435
|
+
}
|
|
8436
|
+
var result = (value + '');
|
|
8437
|
+
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
8438
|
+
}
|
|
8439
|
+
|
|
8440
|
+
var _baseToString = baseToString;
|
|
8441
|
+
|
|
8442
|
+
/**
|
|
8443
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
8444
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
8445
|
+
*
|
|
8446
|
+
* @static
|
|
8447
|
+
* @memberOf _
|
|
8448
|
+
* @since 4.0.0
|
|
8449
|
+
* @category Lang
|
|
8450
|
+
* @param {*} value The value to convert.
|
|
8451
|
+
* @returns {string} Returns the converted string.
|
|
8452
|
+
* @example
|
|
8453
|
+
*
|
|
8454
|
+
* _.toString(null);
|
|
8455
|
+
* // => ''
|
|
8456
|
+
*
|
|
8457
|
+
* _.toString(-0);
|
|
8458
|
+
* // => '-0'
|
|
8459
|
+
*
|
|
8460
|
+
* _.toString([1, 2, 3]);
|
|
8461
|
+
* // => '1,2,3'
|
|
8462
|
+
*/
|
|
8463
|
+
function toString$1(value) {
|
|
8464
|
+
return value == null ? '' : _baseToString(value);
|
|
8465
|
+
}
|
|
8466
|
+
|
|
8467
|
+
var toString_1 = toString$1;
|
|
8468
|
+
|
|
8469
|
+
/**
|
|
8470
|
+
* Casts `value` to a path array if it's not one.
|
|
8471
|
+
*
|
|
8472
|
+
* @private
|
|
8473
|
+
* @param {*} value The value to inspect.
|
|
8474
|
+
* @param {Object} [object] The object to query keys on.
|
|
8475
|
+
* @returns {Array} Returns the cast property path array.
|
|
8476
|
+
*/
|
|
8477
|
+
function castPath(value, object) {
|
|
8478
|
+
if (isArray_1(value)) {
|
|
8479
|
+
return value;
|
|
8480
|
+
}
|
|
8481
|
+
return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
|
|
8482
|
+
}
|
|
8483
|
+
|
|
8484
|
+
var _castPath = castPath;
|
|
8485
|
+
|
|
8486
|
+
/** Used as references for various `Number` constants. */
|
|
8487
|
+
var INFINITY = 1 / 0;
|
|
8488
|
+
|
|
8489
|
+
/**
|
|
8490
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
8491
|
+
*
|
|
8492
|
+
* @private
|
|
8493
|
+
* @param {*} value The value to inspect.
|
|
8494
|
+
* @returns {string|symbol} Returns the key.
|
|
8495
|
+
*/
|
|
8496
|
+
function toKey(value) {
|
|
8497
|
+
if (typeof value == 'string' || isSymbol_1(value)) {
|
|
8498
|
+
return value;
|
|
8499
|
+
}
|
|
8500
|
+
var result = (value + '');
|
|
8501
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
8502
|
+
}
|
|
8503
|
+
|
|
8504
|
+
var _toKey = toKey;
|
|
8505
|
+
|
|
8506
|
+
/**
|
|
8507
|
+
* The base implementation of `_.get` without support for default values.
|
|
8508
|
+
*
|
|
8509
|
+
* @private
|
|
8510
|
+
* @param {Object} object The object to query.
|
|
8511
|
+
* @param {Array|string} path The path of the property to get.
|
|
8512
|
+
* @returns {*} Returns the resolved value.
|
|
8513
|
+
*/
|
|
8514
|
+
function baseGet(object, path) {
|
|
8515
|
+
path = _castPath(path, object);
|
|
8516
|
+
|
|
8517
|
+
var index = 0,
|
|
8518
|
+
length = path.length;
|
|
8519
|
+
|
|
8520
|
+
while (object != null && index < length) {
|
|
8521
|
+
object = object[_toKey(path[index++])];
|
|
8522
|
+
}
|
|
8523
|
+
return (index && index == length) ? object : undefined;
|
|
8524
|
+
}
|
|
8525
|
+
|
|
8526
|
+
var _baseGet = baseGet;
|
|
8527
|
+
|
|
8528
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
8529
|
+
var COMPARE_PARTIAL_FLAG$1 = 1,
|
|
8530
|
+
COMPARE_UNORDERED_FLAG$1 = 2;
|
|
8531
|
+
|
|
8532
|
+
/**
|
|
8533
|
+
* The base implementation of `_.isMatch` without support for iteratee shorthands.
|
|
8534
|
+
*
|
|
8535
|
+
* @private
|
|
8536
|
+
* @param {Object} object The object to inspect.
|
|
8537
|
+
* @param {Object} source The object of property values to match.
|
|
8538
|
+
* @param {Array} matchData The property names, values, and compare flags to match.
|
|
8539
|
+
* @param {Function} [customizer] The function to customize comparisons.
|
|
8540
|
+
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
8541
|
+
*/
|
|
8542
|
+
function baseIsMatch(object, source, matchData, customizer) {
|
|
8543
|
+
var index = matchData.length,
|
|
8544
|
+
length = index,
|
|
8545
|
+
noCustomizer = !customizer;
|
|
8546
|
+
|
|
8547
|
+
if (object == null) {
|
|
8548
|
+
return !length;
|
|
8549
|
+
}
|
|
8550
|
+
object = Object(object);
|
|
8551
|
+
while (index--) {
|
|
8552
|
+
var data = matchData[index];
|
|
8553
|
+
if ((noCustomizer && data[2])
|
|
8554
|
+
? data[1] !== object[data[0]]
|
|
8555
|
+
: !(data[0] in object)
|
|
8556
|
+
) {
|
|
8557
|
+
return false;
|
|
8558
|
+
}
|
|
8559
|
+
}
|
|
8560
|
+
while (++index < length) {
|
|
8561
|
+
data = matchData[index];
|
|
8562
|
+
var key = data[0],
|
|
8563
|
+
objValue = object[key],
|
|
8564
|
+
srcValue = data[1];
|
|
8565
|
+
|
|
8566
|
+
if (noCustomizer && data[2]) {
|
|
8567
|
+
if (objValue === undefined && !(key in object)) {
|
|
8568
|
+
return false;
|
|
8569
|
+
}
|
|
8570
|
+
} else {
|
|
8571
|
+
var stack = new _Stack;
|
|
8572
|
+
if (customizer) {
|
|
8573
|
+
var result = customizer(objValue, srcValue, key, object, source, stack);
|
|
8574
|
+
}
|
|
8575
|
+
if (!(result === undefined
|
|
8576
|
+
? _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack)
|
|
8577
|
+
: result
|
|
8578
|
+
)) {
|
|
8579
|
+
return false;
|
|
8580
|
+
}
|
|
8581
|
+
}
|
|
8582
|
+
}
|
|
8583
|
+
return true;
|
|
8584
|
+
}
|
|
8585
|
+
|
|
8586
|
+
var _baseIsMatch = baseIsMatch;
|
|
8587
|
+
|
|
8588
|
+
/**
|
|
8589
|
+
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
|
|
8590
|
+
*
|
|
8591
|
+
* @private
|
|
8592
|
+
* @param {*} value The value to check.
|
|
8593
|
+
* @returns {boolean} Returns `true` if `value` if suitable for strict
|
|
8594
|
+
* equality comparisons, else `false`.
|
|
8595
|
+
*/
|
|
8596
|
+
function isStrictComparable(value) {
|
|
8597
|
+
return value === value && !isObject_1(value);
|
|
8598
|
+
}
|
|
8599
|
+
|
|
8600
|
+
var _isStrictComparable = isStrictComparable;
|
|
8601
|
+
|
|
8602
|
+
/**
|
|
8603
|
+
* Gets the property names, values, and compare flags of `object`.
|
|
8604
|
+
*
|
|
8605
|
+
* @private
|
|
8606
|
+
* @param {Object} object The object to query.
|
|
8607
|
+
* @returns {Array} Returns the match data of `object`.
|
|
8608
|
+
*/
|
|
8609
|
+
function getMatchData(object) {
|
|
8610
|
+
var result = keys_1(object),
|
|
8611
|
+
length = result.length;
|
|
8612
|
+
|
|
8613
|
+
while (length--) {
|
|
8614
|
+
var key = result[length],
|
|
8615
|
+
value = object[key];
|
|
8616
|
+
|
|
8617
|
+
result[length] = [key, value, _isStrictComparable(value)];
|
|
8618
|
+
}
|
|
8619
|
+
return result;
|
|
8620
|
+
}
|
|
8621
|
+
|
|
8622
|
+
var _getMatchData = getMatchData;
|
|
8623
|
+
|
|
8624
|
+
/**
|
|
8625
|
+
* A specialized version of `matchesProperty` for source values suitable
|
|
8626
|
+
* for strict equality comparisons, i.e. `===`.
|
|
8627
|
+
*
|
|
8628
|
+
* @private
|
|
8629
|
+
* @param {string} key The key of the property to get.
|
|
8630
|
+
* @param {*} srcValue The value to match.
|
|
8631
|
+
* @returns {Function} Returns the new spec function.
|
|
8632
|
+
*/
|
|
8633
|
+
function matchesStrictComparable(key, srcValue) {
|
|
8634
|
+
return function(object) {
|
|
8635
|
+
if (object == null) {
|
|
8636
|
+
return false;
|
|
8637
|
+
}
|
|
8638
|
+
return object[key] === srcValue &&
|
|
8639
|
+
(srcValue !== undefined || (key in Object(object)));
|
|
8640
|
+
};
|
|
8641
|
+
}
|
|
8642
|
+
|
|
8643
|
+
var _matchesStrictComparable = matchesStrictComparable;
|
|
8644
|
+
|
|
8645
|
+
/**
|
|
8646
|
+
* The base implementation of `_.matches` which doesn't clone `source`.
|
|
8647
|
+
*
|
|
8648
|
+
* @private
|
|
8649
|
+
* @param {Object} source The object of property values to match.
|
|
8650
|
+
* @returns {Function} Returns the new spec function.
|
|
8651
|
+
*/
|
|
8652
|
+
function baseMatches(source) {
|
|
8653
|
+
var matchData = _getMatchData(source);
|
|
8654
|
+
if (matchData.length == 1 && matchData[0][2]) {
|
|
8655
|
+
return _matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
|
8656
|
+
}
|
|
8657
|
+
return function(object) {
|
|
8658
|
+
return object === source || _baseIsMatch(object, source, matchData);
|
|
8659
|
+
};
|
|
8660
|
+
}
|
|
8661
|
+
|
|
8662
|
+
var _baseMatches = baseMatches;
|
|
8663
|
+
|
|
8664
|
+
/**
|
|
8665
|
+
* Gets the value at `path` of `object`. If the resolved value is
|
|
8666
|
+
* `undefined`, the `defaultValue` is returned in its place.
|
|
8667
|
+
*
|
|
8668
|
+
* @static
|
|
8669
|
+
* @memberOf _
|
|
8670
|
+
* @since 3.7.0
|
|
8671
|
+
* @category Object
|
|
8672
|
+
* @param {Object} object The object to query.
|
|
8673
|
+
* @param {Array|string} path The path of the property to get.
|
|
8674
|
+
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
8675
|
+
* @returns {*} Returns the resolved value.
|
|
8676
|
+
* @example
|
|
8677
|
+
*
|
|
8678
|
+
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
8679
|
+
*
|
|
8680
|
+
* _.get(object, 'a[0].b.c');
|
|
8681
|
+
* // => 3
|
|
8682
|
+
*
|
|
8683
|
+
* _.get(object, ['a', '0', 'b', 'c']);
|
|
8684
|
+
* // => 3
|
|
8685
|
+
*
|
|
8686
|
+
* _.get(object, 'a.b.c', 'default');
|
|
8687
|
+
* // => 'default'
|
|
8688
|
+
*/
|
|
8689
|
+
function get(object, path, defaultValue) {
|
|
8690
|
+
var result = object == null ? undefined : _baseGet(object, path);
|
|
8691
|
+
return result === undefined ? defaultValue : result;
|
|
8692
|
+
}
|
|
8693
|
+
|
|
8694
|
+
var get_1 = get;
|
|
8695
|
+
|
|
8696
|
+
/**
|
|
8697
|
+
* The base implementation of `_.hasIn` without support for deep paths.
|
|
8698
|
+
*
|
|
8699
|
+
* @private
|
|
8700
|
+
* @param {Object} [object] The object to query.
|
|
8701
|
+
* @param {Array|string} key The key to check.
|
|
8702
|
+
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
8703
|
+
*/
|
|
8704
|
+
function baseHasIn(object, key) {
|
|
8705
|
+
return object != null && key in Object(object);
|
|
8706
|
+
}
|
|
8707
|
+
|
|
8708
|
+
var _baseHasIn = baseHasIn;
|
|
8709
|
+
|
|
8710
|
+
/**
|
|
8711
|
+
* Checks if `path` exists on `object`.
|
|
8712
|
+
*
|
|
8713
|
+
* @private
|
|
8714
|
+
* @param {Object} object The object to query.
|
|
8715
|
+
* @param {Array|string} path The path to check.
|
|
8716
|
+
* @param {Function} hasFunc The function to check properties.
|
|
8717
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
8718
|
+
*/
|
|
8719
|
+
function hasPath(object, path, hasFunc) {
|
|
8720
|
+
path = _castPath(path, object);
|
|
8721
|
+
|
|
8722
|
+
var index = -1,
|
|
8723
|
+
length = path.length,
|
|
8724
|
+
result = false;
|
|
8725
|
+
|
|
8726
|
+
while (++index < length) {
|
|
8727
|
+
var key = _toKey(path[index]);
|
|
8728
|
+
if (!(result = object != null && hasFunc(object, key))) {
|
|
8729
|
+
break;
|
|
8730
|
+
}
|
|
8731
|
+
object = object[key];
|
|
8732
|
+
}
|
|
8733
|
+
if (result || ++index != length) {
|
|
8734
|
+
return result;
|
|
8735
|
+
}
|
|
8736
|
+
length = object == null ? 0 : object.length;
|
|
8737
|
+
return !!length && isLength_1(length) && _isIndex(key, length) &&
|
|
8738
|
+
(isArray_1(object) || isArguments_1(object));
|
|
8739
|
+
}
|
|
8740
|
+
|
|
8741
|
+
var _hasPath = hasPath;
|
|
8742
|
+
|
|
8743
|
+
/**
|
|
8744
|
+
* Checks if `path` is a direct or inherited property of `object`.
|
|
8745
|
+
*
|
|
8746
|
+
* @static
|
|
8747
|
+
* @memberOf _
|
|
8748
|
+
* @since 4.0.0
|
|
8749
|
+
* @category Object
|
|
8750
|
+
* @param {Object} object The object to query.
|
|
8751
|
+
* @param {Array|string} path The path to check.
|
|
8752
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
8753
|
+
* @example
|
|
8754
|
+
*
|
|
8755
|
+
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
8756
|
+
*
|
|
8757
|
+
* _.hasIn(object, 'a');
|
|
8758
|
+
* // => true
|
|
8759
|
+
*
|
|
8760
|
+
* _.hasIn(object, 'a.b');
|
|
8761
|
+
* // => true
|
|
8762
|
+
*
|
|
8763
|
+
* _.hasIn(object, ['a', 'b']);
|
|
8764
|
+
* // => true
|
|
8765
|
+
*
|
|
8766
|
+
* _.hasIn(object, 'b');
|
|
8767
|
+
* // => false
|
|
8768
|
+
*/
|
|
8769
|
+
function hasIn(object, path) {
|
|
8770
|
+
return object != null && _hasPath(object, path, _baseHasIn);
|
|
8771
|
+
}
|
|
8772
|
+
|
|
8773
|
+
var hasIn_1 = hasIn;
|
|
8774
|
+
|
|
8775
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
8776
|
+
var COMPARE_PARTIAL_FLAG = 1,
|
|
8777
|
+
COMPARE_UNORDERED_FLAG = 2;
|
|
8778
|
+
|
|
8779
|
+
/**
|
|
8780
|
+
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
|
8781
|
+
*
|
|
8782
|
+
* @private
|
|
8783
|
+
* @param {string} path The path of the property to get.
|
|
8784
|
+
* @param {*} srcValue The value to match.
|
|
8785
|
+
* @returns {Function} Returns the new spec function.
|
|
8786
|
+
*/
|
|
8787
|
+
function baseMatchesProperty(path, srcValue) {
|
|
8788
|
+
if (_isKey(path) && _isStrictComparable(srcValue)) {
|
|
8789
|
+
return _matchesStrictComparable(_toKey(path), srcValue);
|
|
8790
|
+
}
|
|
8791
|
+
return function(object) {
|
|
8792
|
+
var objValue = get_1(object, path);
|
|
8793
|
+
return (objValue === undefined && objValue === srcValue)
|
|
8794
|
+
? hasIn_1(object, path)
|
|
8795
|
+
: _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
8796
|
+
};
|
|
8797
|
+
}
|
|
8798
|
+
|
|
8799
|
+
var _baseMatchesProperty = baseMatchesProperty;
|
|
8800
|
+
|
|
8801
|
+
/**
|
|
8802
|
+
* This method returns the first argument it receives.
|
|
8803
|
+
*
|
|
8804
|
+
* @static
|
|
8805
|
+
* @since 0.1.0
|
|
8806
|
+
* @memberOf _
|
|
8807
|
+
* @category Util
|
|
8808
|
+
* @param {*} value Any value.
|
|
8809
|
+
* @returns {*} Returns `value`.
|
|
8810
|
+
* @example
|
|
8811
|
+
*
|
|
8812
|
+
* var object = { 'a': 1 };
|
|
8813
|
+
*
|
|
8814
|
+
* console.log(_.identity(object) === object);
|
|
8815
|
+
* // => true
|
|
8816
|
+
*/
|
|
8817
|
+
function identity(value) {
|
|
8818
|
+
return value;
|
|
8819
|
+
}
|
|
8820
|
+
|
|
8821
|
+
var identity_1 = identity;
|
|
8822
|
+
|
|
8823
|
+
/**
|
|
8824
|
+
* The base implementation of `_.property` without support for deep paths.
|
|
8825
|
+
*
|
|
8826
|
+
* @private
|
|
8827
|
+
* @param {string} key The key of the property to get.
|
|
8828
|
+
* @returns {Function} Returns the new accessor function.
|
|
8829
|
+
*/
|
|
8830
|
+
function baseProperty(key) {
|
|
8831
|
+
return function(object) {
|
|
8832
|
+
return object == null ? undefined : object[key];
|
|
8833
|
+
};
|
|
8834
|
+
}
|
|
8835
|
+
|
|
8836
|
+
var _baseProperty = baseProperty;
|
|
8837
|
+
|
|
8838
|
+
/**
|
|
8839
|
+
* A specialized version of `baseProperty` which supports deep paths.
|
|
8840
|
+
*
|
|
8841
|
+
* @private
|
|
8842
|
+
* @param {Array|string} path The path of the property to get.
|
|
8843
|
+
* @returns {Function} Returns the new accessor function.
|
|
8844
|
+
*/
|
|
8845
|
+
function basePropertyDeep(path) {
|
|
8846
|
+
return function(object) {
|
|
8847
|
+
return _baseGet(object, path);
|
|
8848
|
+
};
|
|
8849
|
+
}
|
|
8850
|
+
|
|
8851
|
+
var _basePropertyDeep = basePropertyDeep;
|
|
8852
|
+
|
|
8853
|
+
/**
|
|
8854
|
+
* Creates a function that returns the value at `path` of a given object.
|
|
8855
|
+
*
|
|
8856
|
+
* @static
|
|
8857
|
+
* @memberOf _
|
|
8858
|
+
* @since 2.4.0
|
|
8859
|
+
* @category Util
|
|
8860
|
+
* @param {Array|string} path The path of the property to get.
|
|
8861
|
+
* @returns {Function} Returns the new accessor function.
|
|
8862
|
+
* @example
|
|
8863
|
+
*
|
|
8864
|
+
* var objects = [
|
|
8865
|
+
* { 'a': { 'b': 2 } },
|
|
8866
|
+
* { 'a': { 'b': 1 } }
|
|
8867
|
+
* ];
|
|
8868
|
+
*
|
|
8869
|
+
* _.map(objects, _.property('a.b'));
|
|
8870
|
+
* // => [2, 1]
|
|
8871
|
+
*
|
|
8872
|
+
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
|
|
8873
|
+
* // => [1, 2]
|
|
8874
|
+
*/
|
|
8875
|
+
function property(path) {
|
|
8876
|
+
return _isKey(path) ? _baseProperty(_toKey(path)) : _basePropertyDeep(path);
|
|
8877
|
+
}
|
|
8878
|
+
|
|
8879
|
+
var property_1 = property;
|
|
8880
|
+
|
|
8881
|
+
/**
|
|
8882
|
+
* The base implementation of `_.iteratee`.
|
|
8883
|
+
*
|
|
8884
|
+
* @private
|
|
8885
|
+
* @param {*} [value=_.identity] The value to convert to an iteratee.
|
|
8886
|
+
* @returns {Function} Returns the iteratee.
|
|
8887
|
+
*/
|
|
8888
|
+
function baseIteratee(value) {
|
|
8889
|
+
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
|
8890
|
+
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
|
8891
|
+
if (typeof value == 'function') {
|
|
8892
|
+
return value;
|
|
8893
|
+
}
|
|
8894
|
+
if (value == null) {
|
|
8895
|
+
return identity_1;
|
|
8896
|
+
}
|
|
8897
|
+
if (typeof value == 'object') {
|
|
8898
|
+
return isArray_1(value)
|
|
8899
|
+
? _baseMatchesProperty(value[0], value[1])
|
|
8900
|
+
: _baseMatches(value);
|
|
8901
|
+
}
|
|
8902
|
+
return property_1(value);
|
|
8903
|
+
}
|
|
8904
|
+
|
|
8905
|
+
var _baseIteratee = baseIteratee;
|
|
8906
|
+
|
|
8907
|
+
/**
|
|
8908
|
+
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
|
8909
|
+
*
|
|
8910
|
+
* @private
|
|
8911
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
8912
|
+
* @returns {Function} Returns the new base function.
|
|
8913
|
+
*/
|
|
8914
|
+
function createBaseFor(fromRight) {
|
|
8915
|
+
return function(object, iteratee, keysFunc) {
|
|
8916
|
+
var index = -1,
|
|
8917
|
+
iterable = Object(object),
|
|
8918
|
+
props = keysFunc(object),
|
|
8919
|
+
length = props.length;
|
|
8920
|
+
|
|
8921
|
+
while (length--) {
|
|
8922
|
+
var key = props[fromRight ? length : ++index];
|
|
8923
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
|
8924
|
+
break;
|
|
8925
|
+
}
|
|
8926
|
+
}
|
|
8927
|
+
return object;
|
|
8928
|
+
};
|
|
8929
|
+
}
|
|
8930
|
+
|
|
8931
|
+
var _createBaseFor = createBaseFor;
|
|
8932
|
+
|
|
8933
|
+
/**
|
|
8934
|
+
* The base implementation of `baseForOwn` which iterates over `object`
|
|
8935
|
+
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
|
8936
|
+
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
8937
|
+
*
|
|
8938
|
+
* @private
|
|
8939
|
+
* @param {Object} object The object to iterate over.
|
|
8940
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8941
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
8942
|
+
* @returns {Object} Returns `object`.
|
|
8943
|
+
*/
|
|
8944
|
+
var baseFor = _createBaseFor();
|
|
8945
|
+
|
|
8946
|
+
var _baseFor = baseFor;
|
|
8947
|
+
|
|
8948
|
+
/**
|
|
8949
|
+
* The base implementation of `_.forOwn` without support for iteratee shorthands.
|
|
8950
|
+
*
|
|
8951
|
+
* @private
|
|
8952
|
+
* @param {Object} object The object to iterate over.
|
|
8953
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8954
|
+
* @returns {Object} Returns `object`.
|
|
8955
|
+
*/
|
|
8956
|
+
function baseForOwn(object, iteratee) {
|
|
8957
|
+
return object && _baseFor(object, iteratee, keys_1);
|
|
8958
|
+
}
|
|
8959
|
+
|
|
8960
|
+
var _baseForOwn = baseForOwn;
|
|
8961
|
+
|
|
8962
|
+
/**
|
|
8963
|
+
* Creates a `baseEach` or `baseEachRight` function.
|
|
8964
|
+
*
|
|
8965
|
+
* @private
|
|
8966
|
+
* @param {Function} eachFunc The function to iterate over a collection.
|
|
8967
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
8968
|
+
* @returns {Function} Returns the new base function.
|
|
8969
|
+
*/
|
|
8970
|
+
function createBaseEach(eachFunc, fromRight) {
|
|
8971
|
+
return function(collection, iteratee) {
|
|
8972
|
+
if (collection == null) {
|
|
8973
|
+
return collection;
|
|
8974
|
+
}
|
|
8975
|
+
if (!isArrayLike_1(collection)) {
|
|
8976
|
+
return eachFunc(collection, iteratee);
|
|
8977
|
+
}
|
|
8978
|
+
var length = collection.length,
|
|
8979
|
+
index = fromRight ? length : -1,
|
|
8980
|
+
iterable = Object(collection);
|
|
8981
|
+
|
|
8982
|
+
while ((fromRight ? index-- : ++index < length)) {
|
|
8983
|
+
if (iteratee(iterable[index], index, iterable) === false) {
|
|
8984
|
+
break;
|
|
8985
|
+
}
|
|
8986
|
+
}
|
|
8987
|
+
return collection;
|
|
8988
|
+
};
|
|
8989
|
+
}
|
|
8990
|
+
|
|
8991
|
+
var _createBaseEach = createBaseEach;
|
|
8992
|
+
|
|
8993
|
+
/**
|
|
8994
|
+
* The base implementation of `_.forEach` without support for iteratee shorthands.
|
|
8995
|
+
*
|
|
8996
|
+
* @private
|
|
8997
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
8998
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
8999
|
+
* @returns {Array|Object} Returns `collection`.
|
|
9000
|
+
*/
|
|
9001
|
+
var baseEach = _createBaseEach(_baseForOwn);
|
|
9002
|
+
|
|
9003
|
+
var _baseEach = baseEach;
|
|
9004
|
+
|
|
9005
|
+
/**
|
|
9006
|
+
* The base implementation of `_.map` without support for iteratee shorthands.
|
|
9007
|
+
*
|
|
9008
|
+
* @private
|
|
9009
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9010
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
9011
|
+
* @returns {Array} Returns the new mapped array.
|
|
9012
|
+
*/
|
|
9013
|
+
function baseMap(collection, iteratee) {
|
|
9014
|
+
var index = -1,
|
|
9015
|
+
result = isArrayLike_1(collection) ? Array(collection.length) : [];
|
|
9016
|
+
|
|
9017
|
+
_baseEach(collection, function(value, key, collection) {
|
|
9018
|
+
result[++index] = iteratee(value, key, collection);
|
|
9019
|
+
});
|
|
9020
|
+
return result;
|
|
9021
|
+
}
|
|
9022
|
+
|
|
9023
|
+
var _baseMap = baseMap;
|
|
9024
|
+
|
|
9025
|
+
/**
|
|
9026
|
+
* The base implementation of `_.sortBy` which uses `comparer` to define the
|
|
9027
|
+
* sort order of `array` and replaces criteria objects with their corresponding
|
|
9028
|
+
* values.
|
|
9029
|
+
*
|
|
9030
|
+
* @private
|
|
9031
|
+
* @param {Array} array The array to sort.
|
|
9032
|
+
* @param {Function} comparer The function to define sort order.
|
|
9033
|
+
* @returns {Array} Returns `array`.
|
|
9034
|
+
*/
|
|
9035
|
+
function baseSortBy(array, comparer) {
|
|
9036
|
+
var length = array.length;
|
|
9037
|
+
|
|
9038
|
+
array.sort(comparer);
|
|
9039
|
+
while (length--) {
|
|
9040
|
+
array[length] = array[length].value;
|
|
9041
|
+
}
|
|
9042
|
+
return array;
|
|
9043
|
+
}
|
|
9044
|
+
|
|
9045
|
+
var _baseSortBy = baseSortBy;
|
|
9046
|
+
|
|
9047
|
+
/**
|
|
9048
|
+
* Compares values to sort them in ascending order.
|
|
9049
|
+
*
|
|
9050
|
+
* @private
|
|
9051
|
+
* @param {*} value The value to compare.
|
|
9052
|
+
* @param {*} other The other value to compare.
|
|
9053
|
+
* @returns {number} Returns the sort order indicator for `value`.
|
|
9054
|
+
*/
|
|
9055
|
+
function compareAscending(value, other) {
|
|
9056
|
+
if (value !== other) {
|
|
9057
|
+
var valIsDefined = value !== undefined,
|
|
9058
|
+
valIsNull = value === null,
|
|
9059
|
+
valIsReflexive = value === value,
|
|
9060
|
+
valIsSymbol = isSymbol_1(value);
|
|
9061
|
+
|
|
9062
|
+
var othIsDefined = other !== undefined,
|
|
9063
|
+
othIsNull = other === null,
|
|
9064
|
+
othIsReflexive = other === other,
|
|
9065
|
+
othIsSymbol = isSymbol_1(other);
|
|
9066
|
+
|
|
9067
|
+
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
|
9068
|
+
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
|
9069
|
+
(valIsNull && othIsDefined && othIsReflexive) ||
|
|
9070
|
+
(!valIsDefined && othIsReflexive) ||
|
|
9071
|
+
!valIsReflexive) {
|
|
9072
|
+
return 1;
|
|
9073
|
+
}
|
|
9074
|
+
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
|
|
9075
|
+
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
|
|
9076
|
+
(othIsNull && valIsDefined && valIsReflexive) ||
|
|
9077
|
+
(!othIsDefined && valIsReflexive) ||
|
|
9078
|
+
!othIsReflexive) {
|
|
9079
|
+
return -1;
|
|
9080
|
+
}
|
|
9081
|
+
}
|
|
9082
|
+
return 0;
|
|
9083
|
+
}
|
|
9084
|
+
|
|
9085
|
+
var _compareAscending = compareAscending;
|
|
9086
|
+
|
|
9087
|
+
/**
|
|
9088
|
+
* Used by `_.orderBy` to compare multiple properties of a value to another
|
|
9089
|
+
* and stable sort them.
|
|
9090
|
+
*
|
|
9091
|
+
* If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
|
|
9092
|
+
* specify an order of "desc" for descending or "asc" for ascending sort order
|
|
9093
|
+
* of corresponding values.
|
|
9094
|
+
*
|
|
9095
|
+
* @private
|
|
9096
|
+
* @param {Object} object The object to compare.
|
|
9097
|
+
* @param {Object} other The other object to compare.
|
|
9098
|
+
* @param {boolean[]|string[]} orders The order to sort by for each property.
|
|
9099
|
+
* @returns {number} Returns the sort order indicator for `object`.
|
|
9100
|
+
*/
|
|
9101
|
+
function compareMultiple(object, other, orders) {
|
|
9102
|
+
var index = -1,
|
|
9103
|
+
objCriteria = object.criteria,
|
|
9104
|
+
othCriteria = other.criteria,
|
|
9105
|
+
length = objCriteria.length,
|
|
9106
|
+
ordersLength = orders.length;
|
|
9107
|
+
|
|
9108
|
+
while (++index < length) {
|
|
9109
|
+
var result = _compareAscending(objCriteria[index], othCriteria[index]);
|
|
9110
|
+
if (result) {
|
|
9111
|
+
if (index >= ordersLength) {
|
|
9112
|
+
return result;
|
|
9113
|
+
}
|
|
9114
|
+
var order = orders[index];
|
|
9115
|
+
return result * (order == 'desc' ? -1 : 1);
|
|
9116
|
+
}
|
|
9117
|
+
}
|
|
9118
|
+
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
|
|
9119
|
+
// that causes it, under certain circumstances, to provide the same value for
|
|
9120
|
+
// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
|
|
9121
|
+
// for more details.
|
|
9122
|
+
//
|
|
9123
|
+
// This also ensures a stable sort in V8 and other engines.
|
|
9124
|
+
// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
|
|
9125
|
+
return object.index - other.index;
|
|
9126
|
+
}
|
|
9127
|
+
|
|
9128
|
+
var _compareMultiple = compareMultiple;
|
|
9129
|
+
|
|
9130
|
+
/**
|
|
9131
|
+
* The base implementation of `_.orderBy` without param guards.
|
|
9132
|
+
*
|
|
9133
|
+
* @private
|
|
9134
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9135
|
+
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
|
9136
|
+
* @param {string[]} orders The sort orders of `iteratees`.
|
|
9137
|
+
* @returns {Array} Returns the new sorted array.
|
|
9138
|
+
*/
|
|
9139
|
+
function baseOrderBy(collection, iteratees, orders) {
|
|
9140
|
+
if (iteratees.length) {
|
|
9141
|
+
iteratees = _arrayMap(iteratees, function(iteratee) {
|
|
9142
|
+
if (isArray_1(iteratee)) {
|
|
9143
|
+
return function(value) {
|
|
9144
|
+
return _baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
|
|
9145
|
+
}
|
|
9146
|
+
}
|
|
9147
|
+
return iteratee;
|
|
9148
|
+
});
|
|
9149
|
+
} else {
|
|
9150
|
+
iteratees = [identity_1];
|
|
9151
|
+
}
|
|
9152
|
+
|
|
9153
|
+
var index = -1;
|
|
9154
|
+
iteratees = _arrayMap(iteratees, _baseUnary(_baseIteratee));
|
|
9155
|
+
|
|
9156
|
+
var result = _baseMap(collection, function(value, key, collection) {
|
|
9157
|
+
var criteria = _arrayMap(iteratees, function(iteratee) {
|
|
9158
|
+
return iteratee(value);
|
|
9159
|
+
});
|
|
9160
|
+
return { 'criteria': criteria, 'index': ++index, 'value': value };
|
|
9161
|
+
});
|
|
9162
|
+
|
|
9163
|
+
return _baseSortBy(result, function(object, other) {
|
|
9164
|
+
return _compareMultiple(object, other, orders);
|
|
9165
|
+
});
|
|
9166
|
+
}
|
|
9167
|
+
|
|
9168
|
+
var _baseOrderBy = baseOrderBy;
|
|
9169
|
+
|
|
9170
|
+
/**
|
|
9171
|
+
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
9172
|
+
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
9173
|
+
*
|
|
9174
|
+
* @private
|
|
9175
|
+
* @param {Function} func The function to invoke.
|
|
9176
|
+
* @param {*} thisArg The `this` binding of `func`.
|
|
9177
|
+
* @param {Array} args The arguments to invoke `func` with.
|
|
9178
|
+
* @returns {*} Returns the result of `func`.
|
|
9179
|
+
*/
|
|
9180
|
+
function apply(func, thisArg, args) {
|
|
9181
|
+
switch (args.length) {
|
|
9182
|
+
case 0: return func.call(thisArg);
|
|
9183
|
+
case 1: return func.call(thisArg, args[0]);
|
|
9184
|
+
case 2: return func.call(thisArg, args[0], args[1]);
|
|
9185
|
+
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
9186
|
+
}
|
|
9187
|
+
return func.apply(thisArg, args);
|
|
9188
|
+
}
|
|
9189
|
+
|
|
9190
|
+
var _apply = apply;
|
|
9191
|
+
|
|
9192
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
9193
|
+
var nativeMax = Math.max;
|
|
9194
|
+
|
|
9195
|
+
/**
|
|
9196
|
+
* A specialized version of `baseRest` which transforms the rest array.
|
|
9197
|
+
*
|
|
9198
|
+
* @private
|
|
9199
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
9200
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
9201
|
+
* @param {Function} transform The rest array transform.
|
|
9202
|
+
* @returns {Function} Returns the new function.
|
|
9203
|
+
*/
|
|
9204
|
+
function overRest(func, start, transform) {
|
|
9205
|
+
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
|
9206
|
+
return function() {
|
|
9207
|
+
var args = arguments,
|
|
9208
|
+
index = -1,
|
|
9209
|
+
length = nativeMax(args.length - start, 0),
|
|
9210
|
+
array = Array(length);
|
|
9211
|
+
|
|
9212
|
+
while (++index < length) {
|
|
9213
|
+
array[index] = args[start + index];
|
|
9214
|
+
}
|
|
9215
|
+
index = -1;
|
|
9216
|
+
var otherArgs = Array(start + 1);
|
|
9217
|
+
while (++index < start) {
|
|
9218
|
+
otherArgs[index] = args[index];
|
|
9219
|
+
}
|
|
9220
|
+
otherArgs[start] = transform(array);
|
|
9221
|
+
return _apply(func, this, otherArgs);
|
|
9222
|
+
};
|
|
9223
|
+
}
|
|
9224
|
+
|
|
9225
|
+
var _overRest = overRest;
|
|
9226
|
+
|
|
9227
|
+
/**
|
|
9228
|
+
* Creates a function that returns `value`.
|
|
9229
|
+
*
|
|
9230
|
+
* @static
|
|
9231
|
+
* @memberOf _
|
|
9232
|
+
* @since 2.4.0
|
|
9233
|
+
* @category Util
|
|
9234
|
+
* @param {*} value The value to return from the new function.
|
|
9235
|
+
* @returns {Function} Returns the new constant function.
|
|
9236
|
+
* @example
|
|
9237
|
+
*
|
|
9238
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
9239
|
+
*
|
|
9240
|
+
* console.log(objects);
|
|
9241
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
9242
|
+
*
|
|
9243
|
+
* console.log(objects[0] === objects[1]);
|
|
9244
|
+
* // => true
|
|
9245
|
+
*/
|
|
9246
|
+
function constant(value) {
|
|
9247
|
+
return function() {
|
|
9248
|
+
return value;
|
|
9249
|
+
};
|
|
9250
|
+
}
|
|
9251
|
+
|
|
9252
|
+
var constant_1 = constant;
|
|
9253
|
+
|
|
9254
|
+
var defineProperty = (function() {
|
|
9255
|
+
try {
|
|
9256
|
+
var func = _getNative(Object, 'defineProperty');
|
|
9257
|
+
func({}, '', {});
|
|
9258
|
+
return func;
|
|
9259
|
+
} catch (e) {}
|
|
9260
|
+
}());
|
|
9261
|
+
|
|
9262
|
+
var _defineProperty = defineProperty;
|
|
9263
|
+
|
|
9264
|
+
/**
|
|
9265
|
+
* The base implementation of `setToString` without support for hot loop shorting.
|
|
9266
|
+
*
|
|
9267
|
+
* @private
|
|
9268
|
+
* @param {Function} func The function to modify.
|
|
9269
|
+
* @param {Function} string The `toString` result.
|
|
9270
|
+
* @returns {Function} Returns `func`.
|
|
9271
|
+
*/
|
|
9272
|
+
var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
|
|
9273
|
+
return _defineProperty(func, 'toString', {
|
|
9274
|
+
'configurable': true,
|
|
9275
|
+
'enumerable': false,
|
|
9276
|
+
'value': constant_1(string),
|
|
9277
|
+
'writable': true
|
|
9278
|
+
});
|
|
9279
|
+
};
|
|
9280
|
+
|
|
9281
|
+
var _baseSetToString = baseSetToString;
|
|
9282
|
+
|
|
9283
|
+
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
9284
|
+
var HOT_COUNT = 800,
|
|
9285
|
+
HOT_SPAN = 16;
|
|
9286
|
+
|
|
9287
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
9288
|
+
var nativeNow = Date.now;
|
|
9289
|
+
|
|
9290
|
+
/**
|
|
9291
|
+
* Creates a function that'll short out and invoke `identity` instead
|
|
9292
|
+
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
9293
|
+
* milliseconds.
|
|
9294
|
+
*
|
|
9295
|
+
* @private
|
|
9296
|
+
* @param {Function} func The function to restrict.
|
|
9297
|
+
* @returns {Function} Returns the new shortable function.
|
|
9298
|
+
*/
|
|
9299
|
+
function shortOut(func) {
|
|
9300
|
+
var count = 0,
|
|
9301
|
+
lastCalled = 0;
|
|
9302
|
+
|
|
9303
|
+
return function() {
|
|
9304
|
+
var stamp = nativeNow(),
|
|
9305
|
+
remaining = HOT_SPAN - (stamp - lastCalled);
|
|
9306
|
+
|
|
9307
|
+
lastCalled = stamp;
|
|
9308
|
+
if (remaining > 0) {
|
|
9309
|
+
if (++count >= HOT_COUNT) {
|
|
9310
|
+
return arguments[0];
|
|
9311
|
+
}
|
|
9312
|
+
} else {
|
|
9313
|
+
count = 0;
|
|
9314
|
+
}
|
|
9315
|
+
return func.apply(undefined, arguments);
|
|
9316
|
+
};
|
|
9317
|
+
}
|
|
9318
|
+
|
|
9319
|
+
var _shortOut = shortOut;
|
|
9320
|
+
|
|
9321
|
+
/**
|
|
9322
|
+
* Sets the `toString` method of `func` to return `string`.
|
|
9323
|
+
*
|
|
9324
|
+
* @private
|
|
9325
|
+
* @param {Function} func The function to modify.
|
|
9326
|
+
* @param {Function} string The `toString` result.
|
|
9327
|
+
* @returns {Function} Returns `func`.
|
|
9328
|
+
*/
|
|
9329
|
+
var setToString = _shortOut(_baseSetToString);
|
|
9330
|
+
|
|
9331
|
+
var _setToString = setToString;
|
|
9332
|
+
|
|
9333
|
+
/**
|
|
9334
|
+
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
|
9335
|
+
*
|
|
9336
|
+
* @private
|
|
9337
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
9338
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
9339
|
+
* @returns {Function} Returns the new function.
|
|
9340
|
+
*/
|
|
9341
|
+
function baseRest(func, start) {
|
|
9342
|
+
return _setToString(_overRest(func, start, identity_1), func + '');
|
|
9343
|
+
}
|
|
9344
|
+
|
|
9345
|
+
var _baseRest = baseRest;
|
|
9346
|
+
|
|
9347
|
+
/**
|
|
9348
|
+
* Checks if the given arguments are from an iteratee call.
|
|
9349
|
+
*
|
|
9350
|
+
* @private
|
|
9351
|
+
* @param {*} value The potential iteratee value argument.
|
|
9352
|
+
* @param {*} index The potential iteratee index or key argument.
|
|
9353
|
+
* @param {*} object The potential iteratee object argument.
|
|
9354
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
9355
|
+
* else `false`.
|
|
9356
|
+
*/
|
|
9357
|
+
function isIterateeCall(value, index, object) {
|
|
9358
|
+
if (!isObject_1(object)) {
|
|
9359
|
+
return false;
|
|
9360
|
+
}
|
|
9361
|
+
var type = typeof index;
|
|
9362
|
+
if (type == 'number'
|
|
9363
|
+
? (isArrayLike_1(object) && _isIndex(index, object.length))
|
|
9364
|
+
: (type == 'string' && index in object)
|
|
9365
|
+
) {
|
|
9366
|
+
return eq_1(object[index], value);
|
|
9367
|
+
}
|
|
9368
|
+
return false;
|
|
9369
|
+
}
|
|
9370
|
+
|
|
9371
|
+
var _isIterateeCall = isIterateeCall;
|
|
9372
|
+
|
|
9373
|
+
/**
|
|
9374
|
+
* Creates an array of elements, sorted in ascending order by the results of
|
|
9375
|
+
* running each element in a collection thru each iteratee. This method
|
|
9376
|
+
* performs a stable sort, that is, it preserves the original sort order of
|
|
9377
|
+
* equal elements. The iteratees are invoked with one argument: (value).
|
|
9378
|
+
*
|
|
9379
|
+
* @static
|
|
9380
|
+
* @memberOf _
|
|
9381
|
+
* @since 0.1.0
|
|
9382
|
+
* @category Collection
|
|
9383
|
+
* @param {Array|Object} collection The collection to iterate over.
|
|
9384
|
+
* @param {...(Function|Function[])} [iteratees=[_.identity]]
|
|
9385
|
+
* The iteratees to sort by.
|
|
9386
|
+
* @returns {Array} Returns the new sorted array.
|
|
9387
|
+
* @example
|
|
9388
|
+
*
|
|
9389
|
+
* var users = [
|
|
9390
|
+
* { 'user': 'fred', 'age': 48 },
|
|
9391
|
+
* { 'user': 'barney', 'age': 36 },
|
|
9392
|
+
* { 'user': 'fred', 'age': 30 },
|
|
9393
|
+
* { 'user': 'barney', 'age': 34 }
|
|
9394
|
+
* ];
|
|
9395
|
+
*
|
|
9396
|
+
* _.sortBy(users, [function(o) { return o.user; }]);
|
|
9397
|
+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
|
|
9398
|
+
*
|
|
9399
|
+
* _.sortBy(users, ['user', 'age']);
|
|
9400
|
+
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
|
|
9401
|
+
*/
|
|
9402
|
+
var sortBy = _baseRest(function(collection, iteratees) {
|
|
9403
|
+
if (collection == null) {
|
|
9404
|
+
return [];
|
|
9405
|
+
}
|
|
9406
|
+
var length = iteratees.length;
|
|
9407
|
+
if (length > 1 && _isIterateeCall(collection, iteratees[0], iteratees[1])) {
|
|
9408
|
+
iteratees = [];
|
|
9409
|
+
} else if (length > 2 && _isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
|
9410
|
+
iteratees = [iteratees[0]];
|
|
9411
|
+
}
|
|
9412
|
+
return _baseOrderBy(collection, _baseFlatten(iteratees, 1), []);
|
|
9413
|
+
});
|
|
9414
|
+
|
|
9415
|
+
var sortBy_1 = sortBy;
|
|
9416
|
+
|
|
9417
|
+
/**
|
|
9418
|
+
* Configuration for custom action validation rules.
|
|
9419
|
+
* Defines allowed positions, metadata IDs, data model IDs, and fields for each target
|
|
9420
|
+
* type.
|
|
9421
|
+
*
|
|
9422
|
+
*/
|
|
9423
|
+
const customActionValidationConfig = {
|
|
9424
|
+
[CustomActionTarget.LIVEBOARD]: {
|
|
9425
|
+
positions: [CustomActionsPosition.PRIMARY, CustomActionsPosition.MENU],
|
|
9426
|
+
allowedMetadataIds: ['liveboardIds'],
|
|
9427
|
+
allowedDataModelIds: [],
|
|
9428
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds'],
|
|
9429
|
+
},
|
|
9430
|
+
[CustomActionTarget.VIZ]: {
|
|
9431
|
+
positions: [CustomActionsPosition.MENU, CustomActionsPosition.PRIMARY, CustomActionsPosition.CONTEXTMENU],
|
|
9432
|
+
allowedMetadataIds: ['liveboardIds', 'vizIds', 'answerIds'],
|
|
9433
|
+
allowedDataModelIds: ['modelIds', 'modelColumnNames'],
|
|
9434
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9435
|
+
},
|
|
9436
|
+
[CustomActionTarget.ANSWER]: {
|
|
9437
|
+
positions: [CustomActionsPosition.MENU, CustomActionsPosition.PRIMARY, CustomActionsPosition.CONTEXTMENU],
|
|
9438
|
+
allowedMetadataIds: ['answerIds'],
|
|
9439
|
+
allowedDataModelIds: ['modelIds', 'modelColumnNames'],
|
|
9440
|
+
allowedFields: ['name', 'id', 'position', 'target', 'metadataIds', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9441
|
+
},
|
|
9442
|
+
[CustomActionTarget.SPOTTER]: {
|
|
9443
|
+
positions: [CustomActionsPosition.MENU, CustomActionsPosition.CONTEXTMENU],
|
|
9444
|
+
allowedMetadataIds: [],
|
|
9445
|
+
allowedDataModelIds: ['modelIds'],
|
|
9446
|
+
allowedFields: ['name', 'id', 'position', 'target', 'orgIds', 'groupIds', 'dataModelIds'],
|
|
9447
|
+
},
|
|
9448
|
+
};
|
|
9449
|
+
/**
|
|
9450
|
+
* Validates a single custom action based on its target type
|
|
9451
|
+
* @param action - The custom action to validate
|
|
9452
|
+
* @param primaryActionsPerTarget - Map to track primary actions per target
|
|
9453
|
+
* @returns CustomActionValidation with isValid flag and reason string
|
|
9454
|
+
*
|
|
9455
|
+
* @hidden
|
|
9456
|
+
*/
|
|
9457
|
+
const validateCustomAction = (action, primaryActionsPerTarget) => {
|
|
9458
|
+
const { id: actionId, target: targetType, position, metadataIds, dataModelIds } = action;
|
|
9459
|
+
// Check if target type is supported
|
|
9460
|
+
if (!customActionValidationConfig[targetType]) {
|
|
9461
|
+
const errorMessage = CUSTOM_ACTIONS_ERROR_MESSAGE.UNSUPPORTED_TARGET(actionId, targetType);
|
|
9462
|
+
return { isValid: false, errors: [errorMessage] };
|
|
9463
|
+
}
|
|
9464
|
+
const config = customActionValidationConfig[targetType];
|
|
9465
|
+
const errors = [];
|
|
9466
|
+
// Validate position
|
|
9467
|
+
if (!arrayIncludesString(config.positions, position)) {
|
|
9468
|
+
const supportedPositions = config.positions.join(', ');
|
|
9469
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_POSITION(position, targetType, supportedPositions));
|
|
9470
|
+
}
|
|
9471
|
+
// Validate metadata IDs
|
|
9472
|
+
if (metadataIds) {
|
|
9473
|
+
const invalidMetadataIds = Object.keys(metadataIds).filter((key) => !arrayIncludesString(config.allowedMetadataIds, key));
|
|
9474
|
+
if (invalidMetadataIds.length > 0) {
|
|
9475
|
+
const supportedMetadataIds = config.allowedMetadataIds.length > 0 ? config.allowedMetadataIds.join(', ') : 'none';
|
|
9476
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_METADATA_IDS(targetType, invalidMetadataIds, supportedMetadataIds));
|
|
9477
|
+
}
|
|
8001
9478
|
}
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
9479
|
+
// Validate data model IDs
|
|
9480
|
+
if (dataModelIds) {
|
|
9481
|
+
const invalidDataModelIds = Object.keys(dataModelIds).filter((key) => !arrayIncludesString(config.allowedDataModelIds, key));
|
|
9482
|
+
if (invalidDataModelIds.length > 0) {
|
|
9483
|
+
const supportedDataModelIds = config.allowedDataModelIds.length > 0 ? config.allowedDataModelIds.join(', ') : 'none';
|
|
9484
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_DATA_MODEL_IDS(targetType, invalidDataModelIds, supportedDataModelIds));
|
|
8005
9485
|
}
|
|
8006
|
-
this.answer = this.executeQuery(getAnswer, {}).then((data) => data === null || data === void 0 ? void 0 : data.answer);
|
|
8007
|
-
return this.answer;
|
|
8008
|
-
}
|
|
8009
|
-
async getTML() {
|
|
8010
|
-
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
8011
|
-
const edoc = object[0].edoc;
|
|
8012
|
-
const YAML = await import('./index-P5YjBOuJ.js');
|
|
8013
|
-
const parsedDoc = YAML.parse(edoc);
|
|
8014
|
-
return {
|
|
8015
|
-
answer: {
|
|
8016
|
-
...parsedDoc.answer,
|
|
8017
|
-
...this.tmlOverride,
|
|
8018
|
-
},
|
|
8019
|
-
};
|
|
8020
|
-
}
|
|
8021
|
-
async addDisplayedVizToLiveboard(liveboardId) {
|
|
8022
|
-
const { displayMode, visualizations } = await this.getAnswer();
|
|
8023
|
-
const viz = getDisplayedViz(visualizations, displayMode);
|
|
8024
|
-
return this.executeQuery(addVizToLiveboard, {
|
|
8025
|
-
liveboardId,
|
|
8026
|
-
vizId: viz.id,
|
|
8027
|
-
});
|
|
8028
9486
|
}
|
|
8029
|
-
|
|
8030
|
-
|
|
9487
|
+
// Validate allowed fields
|
|
9488
|
+
const actionKeys = Object.keys(action);
|
|
9489
|
+
const invalidFields = actionKeys.filter((key) => !arrayIncludesString(config.allowedFields, key));
|
|
9490
|
+
if (invalidFields.length > 0) {
|
|
9491
|
+
const supportedFields = config.allowedFields.join(', ');
|
|
9492
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_FIELDS(targetType, invalidFields, supportedFields));
|
|
8031
9493
|
}
|
|
8032
|
-
|
|
9494
|
+
return {
|
|
9495
|
+
isValid: errors.length === 0,
|
|
9496
|
+
errors,
|
|
9497
|
+
};
|
|
9498
|
+
};
|
|
8033
9499
|
/**
|
|
9500
|
+
* Validates basic action structure and required fields
|
|
9501
|
+
* @param action - The action to validate
|
|
9502
|
+
* @returns Object containing validation result and missing fields
|
|
8034
9503
|
*
|
|
8035
|
-
* @
|
|
8036
|
-
* @param colNames
|
|
9504
|
+
* @hidden
|
|
8037
9505
|
*/
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
}));
|
|
8047
|
-
}
|
|
9506
|
+
const validateActionStructure = (action) => {
|
|
9507
|
+
if (!action || typeof action !== 'object') {
|
|
9508
|
+
return { isValid: false, missingFields: [] };
|
|
9509
|
+
}
|
|
9510
|
+
// Check for all missing required fields
|
|
9511
|
+
const missingFields = ['id', 'name', 'target', 'position'].filter(field => !action[field]);
|
|
9512
|
+
return { isValid: missingFields.length === 0, missingFields };
|
|
9513
|
+
};
|
|
8048
9514
|
/**
|
|
9515
|
+
* Checks for duplicate IDs among actions
|
|
9516
|
+
* @param actions - Array of actions to check
|
|
9517
|
+
* @returns Object containing filtered actions and duplicate errors
|
|
8049
9518
|
*
|
|
8050
|
-
* @
|
|
9519
|
+
* @hidden
|
|
8051
9520
|
*/
|
|
8052
|
-
|
|
8053
|
-
const
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
let dataValue;
|
|
8063
|
-
if (dataType === 'DATE') {
|
|
8064
|
-
if (Number.isFinite(colVal.value)) {
|
|
8065
|
-
dataValue = [{
|
|
8066
|
-
epochRange: {
|
|
8067
|
-
startEpoch: colVal.value,
|
|
8068
|
-
},
|
|
8069
|
-
}];
|
|
8070
|
-
// Case for custom calendar.
|
|
8071
|
-
}
|
|
8072
|
-
else if ((_a = colVal.value) === null || _a === void 0 ? void 0 : _a.v) {
|
|
8073
|
-
dataValue = [{
|
|
8074
|
-
epochRange: {
|
|
8075
|
-
startEpoch: colVal.value.v.s,
|
|
8076
|
-
endEpoch: colVal.value.v.e,
|
|
8077
|
-
},
|
|
8078
|
-
}];
|
|
8079
|
-
}
|
|
9521
|
+
const filterDuplicateIds = (actions) => {
|
|
9522
|
+
const idMap = actions.reduce((map, action) => {
|
|
9523
|
+
const list = map.get(action.id) || [];
|
|
9524
|
+
list.push(action);
|
|
9525
|
+
map.set(action.id, list);
|
|
9526
|
+
return map;
|
|
9527
|
+
}, new Map());
|
|
9528
|
+
const { actions: actionsWithUniqueIds, errors } = Array.from(idMap.entries()).reduce((acc, [id, actionsWithSameId]) => {
|
|
9529
|
+
if (actionsWithSameId.length === 1) {
|
|
9530
|
+
acc.actions.push(actionsWithSameId[0]);
|
|
8080
9531
|
}
|
|
8081
9532
|
else {
|
|
8082
|
-
|
|
9533
|
+
// Keep the first action and add error for duplicates
|
|
9534
|
+
acc.actions.push(actionsWithSameId[0]);
|
|
9535
|
+
const duplicateNames = actionsWithSameId.slice(1).map(action => action.name);
|
|
9536
|
+
acc.errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.DUPLICATE_IDS(id, duplicateNames, actionsWithSameId[0].name));
|
|
8083
9537
|
}
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
}
|
|
8089
|
-
selectedPoints.forEach((p) => {
|
|
8090
|
-
p.selectedAttributes.forEach(addPointFromColVal);
|
|
8091
|
-
});
|
|
8092
|
-
return underlyingDataPoint;
|
|
8093
|
-
}
|
|
9538
|
+
return acc;
|
|
9539
|
+
}, { actions: [], errors: [] });
|
|
9540
|
+
return { actions: actionsWithUniqueIds, errors };
|
|
9541
|
+
};
|
|
8094
9542
|
/**
|
|
8095
|
-
*
|
|
8096
|
-
* @param
|
|
8097
|
-
* @
|
|
9543
|
+
* Validates and processes custom actions
|
|
9544
|
+
* @param customActions - Array of custom actions to validate
|
|
9545
|
+
* @returns Object containing valid actions and any validation errors
|
|
8098
9546
|
*/
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
9547
|
+
const getCustomActions = (customActions) => {
|
|
9548
|
+
const errors = [];
|
|
9549
|
+
if (!customActions || !Array.isArray(customActions)) {
|
|
9550
|
+
return { actions: [], errors: [] };
|
|
9551
|
+
}
|
|
9552
|
+
// Step 1: Handle invalid actions first (null, undefined, missing required
|
|
9553
|
+
// fields)
|
|
9554
|
+
const validActions = customActions.filter(action => {
|
|
9555
|
+
const validation = validateActionStructure(action);
|
|
9556
|
+
if (!validation.isValid) {
|
|
9557
|
+
if (!action || typeof action !== 'object') {
|
|
9558
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_ACTION_OBJECT);
|
|
9559
|
+
}
|
|
9560
|
+
else {
|
|
9561
|
+
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.MISSING_REQUIRED_FIELDS(action.id, validation.missingFields));
|
|
9562
|
+
}
|
|
9563
|
+
return false;
|
|
9564
|
+
}
|
|
9565
|
+
return true;
|
|
9566
|
+
});
|
|
9567
|
+
// Step 2: Check for duplicate IDs among valid actions
|
|
9568
|
+
const { actions: actionsWithUniqueIds, errors: duplicateErrors } = filterDuplicateIds(validActions);
|
|
9569
|
+
// Add duplicate errors to the errors array
|
|
9570
|
+
duplicateErrors.forEach(error => errors.push(error));
|
|
9571
|
+
// Step 3: Validate actions with unique IDs
|
|
9572
|
+
const finalValidActions = [];
|
|
9573
|
+
actionsWithUniqueIds.forEach((action) => {
|
|
9574
|
+
const { isValid, errors: validationErrors } = validateCustomAction(action);
|
|
9575
|
+
validationErrors.forEach(error => errors.push(error));
|
|
9576
|
+
if (isValid) {
|
|
9577
|
+
finalValidActions.push(action);
|
|
9578
|
+
}
|
|
9579
|
+
});
|
|
9580
|
+
const sortedActions = sortBy_1(finalValidActions, (a) => a.name.toLocaleLowerCase());
|
|
9581
|
+
return {
|
|
9582
|
+
actions: sortedActions,
|
|
9583
|
+
errors: errors,
|
|
9584
|
+
};
|
|
9585
|
+
};
|
|
8109
9586
|
|
|
8110
9587
|
/**
|
|
8111
9588
|
* Copyright (c) 2023
|
|
@@ -15799,6 +17276,13 @@ function processExitPresentMode(e) {
|
|
|
15799
17276
|
handleExitPresentMode();
|
|
15800
17277
|
}
|
|
15801
17278
|
}
|
|
17279
|
+
/**
|
|
17280
|
+
* Clears the cached preauth and session info.
|
|
17281
|
+
*/
|
|
17282
|
+
function processClearInfoCache() {
|
|
17283
|
+
resetCachedPreauthInfo();
|
|
17284
|
+
resetCachedSessionInfo();
|
|
17285
|
+
}
|
|
15802
17286
|
/**
|
|
15803
17287
|
*
|
|
15804
17288
|
* @param e
|
|
@@ -15905,11 +17389,13 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
|
15905
17389
|
return processAuthLogout(e, containerEl);
|
|
15906
17390
|
case EmbedEvent.ExitPresentMode:
|
|
15907
17391
|
return processExitPresentMode();
|
|
17392
|
+
case EmbedEvent.CLEAR_INFO_CACHE:
|
|
17393
|
+
return processClearInfoCache();
|
|
15908
17394
|
}
|
|
15909
17395
|
return e;
|
|
15910
17396
|
}
|
|
15911
17397
|
|
|
15912
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.40.
|
|
17398
|
+
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={".":{"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,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};
|
|
15913
17399
|
|
|
15914
17400
|
/**
|
|
15915
17401
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -16434,6 +17920,16 @@ class TsEmbed {
|
|
|
16434
17920
|
async getDefaultAppInitData() {
|
|
16435
17921
|
var _a, _b;
|
|
16436
17922
|
const authToken = await this.getAuthTokenForCookielessInit();
|
|
17923
|
+
const customActionsResult = getCustomActions([
|
|
17924
|
+
...(this.viewConfig.customActions || []),
|
|
17925
|
+
...(this.embedConfig.customActions || [])
|
|
17926
|
+
]);
|
|
17927
|
+
if (customActionsResult.errors.length > 0) {
|
|
17928
|
+
this.handleError({
|
|
17929
|
+
type: 'CUSTOM_ACTION_VALIDATION',
|
|
17930
|
+
message: customActionsResult.errors,
|
|
17931
|
+
});
|
|
17932
|
+
}
|
|
16437
17933
|
return {
|
|
16438
17934
|
customisations: getCustomisations(this.embedConfig, this.viewConfig),
|
|
16439
17935
|
authToken,
|
|
@@ -16451,6 +17947,7 @@ class TsEmbed {
|
|
|
16451
17947
|
: [],
|
|
16452
17948
|
customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
|
|
16453
17949
|
hiddenListColumns: this.viewConfig.hiddenListColumns || [],
|
|
17950
|
+
customActions: customActionsResult.actions,
|
|
16454
17951
|
};
|
|
16455
17952
|
}
|
|
16456
17953
|
async getAppInitData() {
|
|
@@ -17565,7 +19062,7 @@ class AppEmbed extends V1Embed {
|
|
|
17565
19062
|
* embedded Liveboard or visualization.
|
|
17566
19063
|
*/
|
|
17567
19064
|
getEmbedParams() {
|
|
17568
|
-
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 = DataPanelCustomColumnGroupsAccordionState$1.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
19065
|
+
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 = DataPanelCustomColumnGroupsAccordionState$1.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;
|
|
17569
19066
|
let params = {};
|
|
17570
19067
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
17571
19068
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
@@ -17582,6 +19079,7 @@ class AppEmbed extends V1Embed {
|
|
|
17582
19079
|
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
17583
19080
|
params[Param.IsUnifiedSearchExperienceEnabled] = isUnifiedSearchExperienceEnabled;
|
|
17584
19081
|
params[Param.CoverAndFilterOptionInPDF] = !!coverAndFilterOptionInPDF;
|
|
19082
|
+
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
|
|
17585
19083
|
params = this.getBaseQueryParams(params);
|
|
17586
19084
|
if (hideObjectSearch) {
|
|
17587
19085
|
params[Param.HideObjectSearch] = !!hideObjectSearch;
|
|
@@ -17652,6 +19150,9 @@ class AppEmbed extends V1Embed {
|
|
|
17652
19150
|
// Set homePageVersion to v2 by default to reset the LD flag value
|
|
17653
19151
|
// for the homepageVersion.
|
|
17654
19152
|
params[Param.HomepageVersion] = 'v2';
|
|
19153
|
+
// Set listpageVersion to v2 by default to reset the LD flag value
|
|
19154
|
+
// for the listpageVersion.
|
|
19155
|
+
params[Param.ListPageVersion] = ListPage.List;
|
|
17655
19156
|
if (discoveryExperience) {
|
|
17656
19157
|
// primaryNavbarVersion v3 will enabled the new left navigation
|
|
17657
19158
|
if (discoveryExperience.primaryNavbarVersion === PrimaryNavbarVersion.Sliding) {
|
|
@@ -17975,7 +19476,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
17975
19476
|
getEmbedParams() {
|
|
17976
19477
|
let params = {};
|
|
17977
19478
|
params = this.getBaseQueryParams(params);
|
|
17978
|
-
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;
|
|
19479
|
+
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;
|
|
17979
19480
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
17980
19481
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
17981
19482
|
if (fullHeight === true) {
|
|
@@ -18042,6 +19543,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
18042
19543
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
18043
19544
|
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
18044
19545
|
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
19546
|
+
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
|
|
18045
19547
|
const queryParams = getQueryParamString(params, true);
|
|
18046
19548
|
return queryParams;
|
|
18047
19549
|
}
|
|
@@ -19697,4 +21199,4 @@ const createLiveboardWithAnswers = async (answers, name) => {
|
|
|
19697
21199
|
return result;
|
|
19698
21200
|
};
|
|
19699
21201
|
|
|
19700
|
-
export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ConversationEmbed, DataPanelCustomColumnGroupsAccordionState$1 as DataPanelCustomColumnGroupsAccordionState, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomePage, HomePageSearchBarMode, HomepageModule, HostEvent, ListPage, ListPageColumns, LiveboardEmbed, LogLevel, MIXPANEL_EVENT, Page, PinboardEmbed, PrefetchFeatures, PrimaryNavbarVersion, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, SpotterAgentEmbed, SpotterEmbed, UIPassthroughEvent, createLiveboardWithAnswers, executeTML, exportTML, getAnswerFromQuery, getEmbedConfig as getInitConfig, getSessionInfo, init, logout, prefetch, resetCachedAuthToken, tokenizedFetch, uploadMixpanelEvent };
|
|
21202
|
+
export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ConversationEmbed, CustomActionTarget, CustomActionsPosition, DataPanelCustomColumnGroupsAccordionState$1 as DataPanelCustomColumnGroupsAccordionState, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomePage, HomePageSearchBarMode, HomepageModule, HostEvent, ListPage, ListPageColumns, LiveboardEmbed, LogLevel, MIXPANEL_EVENT, Page, PinboardEmbed, PrefetchFeatures, PrimaryNavbarVersion, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, SpotterAgentEmbed, SpotterEmbed, UIPassthroughEvent, createLiveboardWithAnswers, executeTML, exportTML, getAnswerFromQuery, getEmbedConfig as getInitConfig, getSessionInfo, init, logout, prefetch, resetCachedAuthToken, tokenizedFetch, uploadMixpanelEvent };
|