@appbaseio/reactivesearch-vue 1.23.2 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +305 -91
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/DataSearch.js +2 -2
- package/dist/cjs/{DropDown-59a7971b.js → DropDown-6815b9b6.js} +1 -1
- package/dist/cjs/DynamicRangeSlider.js +1 -1
- package/dist/cjs/MultiDropdownList.js +2 -2
- package/dist/cjs/MultiList.js +1 -1
- package/dist/cjs/MultiRange.js +1 -1
- package/dist/cjs/RangeInput.js +1 -1
- package/dist/cjs/RangeSlider.js +1 -1
- package/dist/cjs/ReactiveBase.js +14 -8
- package/dist/cjs/ReactiveComponent.js +1 -1
- package/dist/cjs/ReactiveList.js +52 -53
- package/dist/cjs/ResultCard.js +1 -1
- package/dist/cjs/ResultList.js +1 -1
- package/dist/cjs/SelectedFilters.js +1 -1
- package/dist/cjs/SingleDropdownList.js +2 -2
- package/dist/cjs/SingleList.js +1 -1
- package/dist/cjs/SingleRange.js +1 -1
- package/dist/cjs/ToggleButton.js +1 -1
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/initReactivesearch.js +3 -2
- package/dist/cjs/install.js +3 -3
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-22b4fd3a.js → vueTypes-4c19b4c8.js} +5 -1
- package/dist/es/DataSearch.js +2 -2
- package/dist/es/{DropDown-db7fe433.js → DropDown-035c804f.js} +1 -1
- package/dist/es/DynamicRangeSlider.js +1 -1
- package/dist/es/MultiDropdownList.js +2 -2
- package/dist/es/MultiList.js +1 -1
- package/dist/es/MultiRange.js +1 -1
- package/dist/es/RangeInput.js +1 -1
- package/dist/es/RangeSlider.js +1 -1
- package/dist/es/ReactiveBase.js +14 -8
- package/dist/es/ReactiveComponent.js +1 -1
- package/dist/es/ReactiveList.js +52 -53
- package/dist/es/ResultCard.js +1 -1
- package/dist/es/ResultList.js +1 -1
- package/dist/es/SelectedFilters.js +1 -1
- package/dist/es/SingleDropdownList.js +2 -2
- package/dist/es/SingleList.js +1 -1
- package/dist/es/SingleRange.js +1 -1
- package/dist/es/ToggleButton.js +1 -1
- package/dist/es/index.js +3 -3
- package/dist/es/initReactivesearch.js +3 -2
- package/dist/es/install.js +3 -3
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-e89c8a3c.js → vueTypes-fb61bb7b.js} +5 -1
- package/package.json +3 -3
|
@@ -5517,7 +5517,7 @@
|
|
|
5517
5517
|
}, size > 0 ? {
|
|
5518
5518
|
numberOfPages: Math.ceil(total / size)
|
|
5519
5519
|
} : null, {
|
|
5520
|
-
time: time,
|
|
5520
|
+
time: time || 0,
|
|
5521
5521
|
hidden: hidden,
|
|
5522
5522
|
promoted: promotedResults && promotedResults.length
|
|
5523
5523
|
});
|
|
@@ -8398,6 +8398,11 @@
|
|
|
8398
8398
|
var value = internalValue && internalValue.value || '';
|
|
8399
8399
|
|
|
8400
8400
|
if (isAppbaseEnabled && (componentProps.enablePopularSuggestions || componentProps.enableQuerySuggestions)) {
|
|
8401
|
+
if (config.mongodb) {
|
|
8402
|
+
dispatch((0, misc.setDefaultPopularSuggestions)([], componentId.split('__internal')[0]));
|
|
8403
|
+
return;
|
|
8404
|
+
}
|
|
8405
|
+
|
|
8401
8406
|
var suggQuery = (0, utils.getSuggestionQuery)(getState, componentId);
|
|
8402
8407
|
appbaseRef.getQuerySuggestions(suggQuery).then(function (suggestions) {
|
|
8403
8408
|
var querySuggestion = suggestions[(0, utils.getQuerySuggestionsId)(componentId)];
|
|
@@ -8721,8 +8726,9 @@
|
|
|
8721
8726
|
}
|
|
8722
8727
|
}
|
|
8723
8728
|
} else {
|
|
8729
|
+
var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + '_' + component : component;
|
|
8724
8730
|
finalQuery = [].concat(_toConsumableArray(finalQuery), [{
|
|
8725
|
-
preference:
|
|
8731
|
+
preference: preference
|
|
8726
8732
|
}, currentQuery]);
|
|
8727
8733
|
}
|
|
8728
8734
|
}
|
|
@@ -8927,8 +8933,9 @@
|
|
|
8927
8933
|
appendToAggs: appendToAggs
|
|
8928
8934
|
}));
|
|
8929
8935
|
} else {
|
|
8936
|
+
var preference = store.config && store.config.analyticsConfig && store.config.analyticsConfig.userId ? store.config.analyticsConfig.userId + '_' + component : component;
|
|
8930
8937
|
var _finalQuery = [{
|
|
8931
|
-
preference:
|
|
8938
|
+
preference: preference
|
|
8932
8939
|
}, currentQuery];
|
|
8933
8940
|
dispatch(msearch(_finalQuery, [component], appendToHits, false, appendToAggs));
|
|
8934
8941
|
}
|
|
@@ -9126,7 +9133,8 @@
|
|
|
9126
9133
|
protocol = _getState$appbaseRef.protocol,
|
|
9127
9134
|
credentials = _getState$appbaseRef.credentials;
|
|
9128
9135
|
|
|
9129
|
-
var app = config.app
|
|
9136
|
+
var app = config.app,
|
|
9137
|
+
mongodb = config.mongodb;
|
|
9130
9138
|
var esURL = protocol + '://' + url;
|
|
9131
9139
|
var parsedURL = (esURL || '').replace(/\/+$/, '');
|
|
9132
9140
|
var requestOptions = {
|
|
@@ -9173,7 +9181,14 @@
|
|
|
9173
9181
|
}
|
|
9174
9182
|
}
|
|
9175
9183
|
|
|
9176
|
-
|
|
9184
|
+
if (mongodb) {
|
|
9185
|
+
return dispatch({
|
|
9186
|
+
type: constants.RECENT_SEARCHES_SUCCESS,
|
|
9187
|
+
data: []
|
|
9188
|
+
});
|
|
9189
|
+
}
|
|
9190
|
+
|
|
9191
|
+
return fetch(parsedURL + '/_analytics/' + app + '/recent-searches?' + queryString, requestOptions).then(function (res) {
|
|
9177
9192
|
if (res.status >= 500 || res.status >= 400) {
|
|
9178
9193
|
return dispatch({
|
|
9179
9194
|
type: constants.RECENT_SEARCHES_ERROR,
|
|
@@ -12778,7 +12793,11 @@
|
|
|
12778
12793
|
userId: VueTypes.string,
|
|
12779
12794
|
customEvents: VueTypes.object,
|
|
12780
12795
|
enableTelemetry: VueTypes.bool.def(true)
|
|
12781
|
-
}).def({})
|
|
12796
|
+
}).def({}),
|
|
12797
|
+
mongodb: VueTypes.shape({
|
|
12798
|
+
db: VueTypes.string,
|
|
12799
|
+
collection: VueTypes.string
|
|
12800
|
+
})
|
|
12782
12801
|
};
|
|
12783
12802
|
|
|
12784
12803
|
var getClassName = lib_8.getClassName,
|
|
@@ -13882,18 +13901,17 @@
|
|
|
13882
13901
|
ResultCardsWrapper: ResultCardsWrapper
|
|
13883
13902
|
},
|
|
13884
13903
|
data: function data() {
|
|
13885
|
-
var props = this.$props;
|
|
13886
13904
|
var currentPageState = 0;
|
|
13905
|
+
var defaultPage = this.defaultPage || -1;
|
|
13887
13906
|
|
|
13888
|
-
if (
|
|
13889
|
-
currentPageState =
|
|
13890
|
-
} else if (
|
|
13891
|
-
currentPageState = Math.max(
|
|
13907
|
+
if (defaultPage >= 0) {
|
|
13908
|
+
currentPageState = defaultPage;
|
|
13909
|
+
} else if (this.currentPage) {
|
|
13910
|
+
currentPageState = Math.max(this.currentPage - 1, 0);
|
|
13892
13911
|
}
|
|
13893
13912
|
|
|
13894
13913
|
this.__state = {
|
|
13895
|
-
from: currentPageState *
|
|
13896
|
-
isLoading: true,
|
|
13914
|
+
from: currentPageState * this.size,
|
|
13897
13915
|
currentPageState: currentPageState
|
|
13898
13916
|
};
|
|
13899
13917
|
return this.__state;
|
|
@@ -13922,8 +13940,10 @@
|
|
|
13922
13940
|
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
13923
13941
|
}
|
|
13924
13942
|
|
|
13925
|
-
|
|
13926
|
-
|
|
13943
|
+
var defaultPage = this.defaultPage || -1;
|
|
13944
|
+
|
|
13945
|
+
if (defaultPage >= 0) {
|
|
13946
|
+
this.currentPageState = defaultPage;
|
|
13927
13947
|
this.from = this.currentPageState * this.$props.size;
|
|
13928
13948
|
}
|
|
13929
13949
|
|
|
@@ -13990,12 +14010,9 @@
|
|
|
13990
14010
|
return this.$listeners && this.$listeners.resultStats;
|
|
13991
14011
|
},
|
|
13992
14012
|
stats: function stats() {
|
|
13993
|
-
var _this$getAllData = this.getAllData(),
|
|
13994
|
-
filteredResults = _this$getAllData.filteredResults;
|
|
13995
|
-
|
|
13996
14013
|
return _extends({}, getResultStats(this), {
|
|
13997
14014
|
currentPage: this.currentPageState,
|
|
13998
|
-
displayedResults:
|
|
14015
|
+
displayedResults: this.data.length
|
|
13999
14016
|
});
|
|
14000
14017
|
},
|
|
14001
14018
|
hasCustomRender: function hasCustomRender() {
|
|
@@ -14004,6 +14021,27 @@
|
|
|
14004
14021
|
showInfiniteScroll: function showInfiniteScroll() {
|
|
14005
14022
|
// Pagination has higher priority then infinite scroll
|
|
14006
14023
|
return this.infiniteScroll && !this.shouldRenderPagination;
|
|
14024
|
+
},
|
|
14025
|
+
data: function data() {
|
|
14026
|
+
var results = parseHits(this.hits) || [];
|
|
14027
|
+
var parsedPromotedResults = parseHits(this.promotedResults) || [];
|
|
14028
|
+
var filteredResults = results;
|
|
14029
|
+
|
|
14030
|
+
if (parsedPromotedResults.length) {
|
|
14031
|
+
var ids = parsedPromotedResults.map(function (item) {
|
|
14032
|
+
return item._id;
|
|
14033
|
+
}).filter(Boolean);
|
|
14034
|
+
|
|
14035
|
+
if (ids) {
|
|
14036
|
+
filteredResults = filteredResults.filter(function (item) {
|
|
14037
|
+
return !ids.includes(item._id);
|
|
14038
|
+
});
|
|
14039
|
+
}
|
|
14040
|
+
|
|
14041
|
+
filteredResults = [].concat(parsedPromotedResults, filteredResults);
|
|
14042
|
+
}
|
|
14043
|
+
|
|
14044
|
+
return helper_2(filteredResults);
|
|
14007
14045
|
}
|
|
14008
14046
|
},
|
|
14009
14047
|
watch: {
|
|
@@ -14085,7 +14123,7 @@
|
|
|
14085
14123
|
}
|
|
14086
14124
|
},
|
|
14087
14125
|
hits: function hits(newVal, oldVal) {
|
|
14088
|
-
this.$emit('data', this.
|
|
14126
|
+
this.$emit('data', this.getData());
|
|
14089
14127
|
|
|
14090
14128
|
if (this.shouldRenderPagination) {
|
|
14091
14129
|
// called when page is changed
|
|
@@ -14270,13 +14308,10 @@
|
|
|
14270
14308
|
|
|
14271
14309
|
var h = this.$createElement;
|
|
14272
14310
|
var size = this.$props.size;
|
|
14273
|
-
var hits = this.$data.hits;
|
|
14274
|
-
var results = parseHits(hits) || [];
|
|
14275
|
-
var filteredResults = results;
|
|
14276
14311
|
var renderItem = this.$scopedSlots.renderItem || this.$props.renderItem;
|
|
14277
14312
|
var element = this.hasCustomRender ? this.getComponent() : h("div", {
|
|
14278
14313
|
"class": this.$props.listClass + " " + getClassName$1(this.$props.innerClass, 'list')
|
|
14279
|
-
}, [
|
|
14314
|
+
}, [this.data.map(function (item, index) {
|
|
14280
14315
|
return renderItem({
|
|
14281
14316
|
item: item,
|
|
14282
14317
|
triggerClickAnalytics: function triggerClickAnalytics() {
|
|
@@ -14287,7 +14322,7 @@
|
|
|
14287
14322
|
|
|
14288
14323
|
return this.analytics ? h(ImpressionTracker$1, {
|
|
14289
14324
|
"attrs": {
|
|
14290
|
-
"hits":
|
|
14325
|
+
"hits": this.data
|
|
14291
14326
|
}
|
|
14292
14327
|
}, [element]) : element;
|
|
14293
14328
|
},
|
|
@@ -14391,7 +14426,7 @@
|
|
|
14391
14426
|
if (this.stats.numberOfResults) {
|
|
14392
14427
|
return h("p", {
|
|
14393
14428
|
"class": resultStats + " " + getClassName$1(this.$props.innerClass, 'resultStats')
|
|
14394
|
-
}, [this.stats.numberOfResults, " results found in ", this.stats.time, "ms"]);
|
|
14429
|
+
}, [this.stats.numberOfResults, " results found in ", this.stats.time || 0, "ms"]);
|
|
14395
14430
|
}
|
|
14396
14431
|
|
|
14397
14432
|
return null;
|
|
@@ -14467,8 +14502,8 @@
|
|
|
14467
14502
|
})]);
|
|
14468
14503
|
},
|
|
14469
14504
|
withClickIds: function withClickIds(results) {
|
|
14470
|
-
var _this$
|
|
14471
|
-
base = _this$
|
|
14505
|
+
var _this$getAllData = this.getAllData(),
|
|
14506
|
+
base = _this$getAllData.base;
|
|
14472
14507
|
|
|
14473
14508
|
return results.map(function (result, index) {
|
|
14474
14509
|
return _extends({}, result, {
|
|
@@ -14486,26 +14521,9 @@
|
|
|
14486
14521
|
hits = this.hits;
|
|
14487
14522
|
var results = parseHits(hits) || [];
|
|
14488
14523
|
var parsedPromotedResults = parseHits(promotedResults) || [];
|
|
14489
|
-
var filteredResults = results;
|
|
14490
14524
|
var base = currentPage * size;
|
|
14491
|
-
|
|
14492
|
-
if (parsedPromotedResults.length) {
|
|
14493
|
-
var ids = parsedPromotedResults.map(function (item) {
|
|
14494
|
-
return item._id;
|
|
14495
|
-
}).filter(Boolean);
|
|
14496
|
-
|
|
14497
|
-
if (ids) {
|
|
14498
|
-
filteredResults = filteredResults.filter(function (item) {
|
|
14499
|
-
return !ids.includes(item._id);
|
|
14500
|
-
});
|
|
14501
|
-
}
|
|
14502
|
-
|
|
14503
|
-
filteredResults = [].concat(parsedPromotedResults, filteredResults);
|
|
14504
|
-
}
|
|
14505
|
-
|
|
14506
14525
|
return {
|
|
14507
14526
|
results: results,
|
|
14508
|
-
filteredResults: filteredResults,
|
|
14509
14527
|
customData: customData || {},
|
|
14510
14528
|
promotedResults: parsedPromotedResults,
|
|
14511
14529
|
aggregationData: aggregationData,
|
|
@@ -14515,16 +14533,15 @@
|
|
|
14515
14533
|
};
|
|
14516
14534
|
},
|
|
14517
14535
|
getData: function getData() {
|
|
14518
|
-
var _this$
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
customData = _this$getAllData3.customData;
|
|
14536
|
+
var _this$getAllData2 = this.getAllData(),
|
|
14537
|
+
promotedResults = _this$getAllData2.promotedResults,
|
|
14538
|
+
aggregationData = _this$getAllData2.aggregationData,
|
|
14539
|
+
customData = _this$getAllData2.customData;
|
|
14523
14540
|
|
|
14524
14541
|
return {
|
|
14525
|
-
data: this.
|
|
14542
|
+
data: this.data,
|
|
14526
14543
|
aggregationData: this.withClickIds(aggregationData || []),
|
|
14527
|
-
promotedData: this.withClickIds(promotedResults),
|
|
14544
|
+
promotedData: this.withClickIds(promotedResults || []),
|
|
14528
14545
|
rawData: this.rawData,
|
|
14529
14546
|
resultStats: this.stats,
|
|
14530
14547
|
customData: customData
|
|
@@ -14536,7 +14553,7 @@
|
|
|
14536
14553
|
|
|
14537
14554
|
var data = _extends({
|
|
14538
14555
|
error: error,
|
|
14539
|
-
loading: isLoading,
|
|
14556
|
+
loading: isLoading || false,
|
|
14540
14557
|
loadMore: this.loadMore,
|
|
14541
14558
|
// TODO: Remove in v2
|
|
14542
14559
|
triggerAnalytics: this.triggerClickAnalytics,
|
|
@@ -14551,13 +14568,13 @@
|
|
|
14551
14568
|
|
|
14552
14569
|
var mapStateToProps$1 = function mapStateToProps(state, props) {
|
|
14553
14570
|
return {
|
|
14554
|
-
defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1
|
|
14571
|
+
defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1,
|
|
14555
14572
|
hits: state.hits[props.componentId] && state.hits[props.componentId].hits,
|
|
14556
14573
|
rawData: state.rawData[props.componentId],
|
|
14557
|
-
aggregationData: state.compositeAggregations[props.componentId]
|
|
14558
|
-
promotedResults: state.promotedResults[props.componentId]
|
|
14574
|
+
aggregationData: state.compositeAggregations[props.componentId],
|
|
14575
|
+
promotedResults: state.promotedResults[props.componentId],
|
|
14559
14576
|
customData: state.customData[props.componentId],
|
|
14560
|
-
time: state.hits[props.componentId] && state.hits[props.componentId].time
|
|
14577
|
+
time: state.hits[props.componentId] && state.hits[props.componentId].time,
|
|
14561
14578
|
total: state.hits[props.componentId] && state.hits[props.componentId].total,
|
|
14562
14579
|
hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
|
|
14563
14580
|
analytics: state.config && state.config.analytics,
|
|
@@ -14566,7 +14583,7 @@
|
|
|
14566
14583
|
error: state.error[props.componentId],
|
|
14567
14584
|
afterKey: state.aggregations[props.componentId] && state.aggregations[props.componentId][props.aggregationField] && state.aggregations[props.componentId][props.aggregationField].after_key,
|
|
14568
14585
|
componentProps: state.props[props.componentId],
|
|
14569
|
-
isLoading: state.isLoading[props.componentId]
|
|
14586
|
+
isLoading: state.isLoading[props.componentId]
|
|
14570
14587
|
};
|
|
14571
14588
|
};
|
|
14572
14589
|
|
|
@@ -15405,8 +15422,33 @@
|
|
|
15405
15422
|
return encodedHeaders;
|
|
15406
15423
|
}
|
|
15407
15424
|
|
|
15408
|
-
function
|
|
15425
|
+
function getMongoRequest(app, mongo) {
|
|
15426
|
+
var mongodb = {};
|
|
15427
|
+
|
|
15428
|
+
if (app) {
|
|
15429
|
+
mongodb.index = app;
|
|
15430
|
+
}
|
|
15431
|
+
|
|
15432
|
+
if (mongo) {
|
|
15433
|
+
if (mongo.db) {
|
|
15434
|
+
mongodb.db = mongo.db;
|
|
15435
|
+
}
|
|
15436
|
+
|
|
15437
|
+
if (mongo.collection) {
|
|
15438
|
+
mongodb.collection = mongo.collection;
|
|
15439
|
+
}
|
|
15440
|
+
}
|
|
15441
|
+
|
|
15442
|
+
return mongodb;
|
|
15443
|
+
}
|
|
15444
|
+
|
|
15445
|
+
function getTelemetryHeaders(enableTelemetry, shouldSetHeaders) {
|
|
15409
15446
|
var headers = {};
|
|
15447
|
+
|
|
15448
|
+
if (!shouldSetHeaders) {
|
|
15449
|
+
return headers;
|
|
15450
|
+
}
|
|
15451
|
+
|
|
15410
15452
|
Object.assign(headers, {
|
|
15411
15453
|
'X-Search-Client': 'Appbase JS'
|
|
15412
15454
|
});
|
|
@@ -15419,6 +15461,133 @@
|
|
|
15419
15461
|
|
|
15420
15462
|
return headers;
|
|
15421
15463
|
}
|
|
15464
|
+
|
|
15465
|
+
var backendAlias = {
|
|
15466
|
+
MONGODB: 'mongodb',
|
|
15467
|
+
// mongodb
|
|
15468
|
+
ELASTICSEARCH: 'elasticsearch' // elasticsearch
|
|
15469
|
+
|
|
15470
|
+
};
|
|
15471
|
+
var dataTypes = {
|
|
15472
|
+
ARRAY: 'array',
|
|
15473
|
+
FUNCTION: 'function',
|
|
15474
|
+
OBJECT: 'object',
|
|
15475
|
+
NUMBER: 'number',
|
|
15476
|
+
BOOLEAN: 'boolean',
|
|
15477
|
+
STRING: 'string'
|
|
15478
|
+
};
|
|
15479
|
+
|
|
15480
|
+
var checkDataType = function checkDataType(temp) {
|
|
15481
|
+
// eslint-disable-next-line
|
|
15482
|
+
if ((typeof temp === 'undefined' ? 'undefined' : _typeof$1(temp)) === dataTypes.OBJECT) {
|
|
15483
|
+
if (Array.isArray(temp)) {
|
|
15484
|
+
return dataTypes.ARRAY;
|
|
15485
|
+
}
|
|
15486
|
+
|
|
15487
|
+
return dataTypes.OBJECT;
|
|
15488
|
+
}
|
|
15489
|
+
|
|
15490
|
+
return typeof temp === 'undefined' ? 'undefined' : _typeof$1(temp);
|
|
15491
|
+
};
|
|
15492
|
+
|
|
15493
|
+
function validateSchema() {
|
|
15494
|
+
var passedProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
15495
|
+
var schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
15496
|
+
var backendName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
15497
|
+
var passedPropertiesKeys = Object.keys(passedProperties).filter(function (propertyKey) {
|
|
15498
|
+
return !!passedProperties[propertyKey];
|
|
15499
|
+
});
|
|
15500
|
+
var acceptedProperties = Object.keys(schema);
|
|
15501
|
+
var requiredProperties = []; // fetch required properties
|
|
15502
|
+
|
|
15503
|
+
acceptedProperties.forEach(function (propName) {
|
|
15504
|
+
var currentProperty = schema[propName];
|
|
15505
|
+
|
|
15506
|
+
if (currentProperty.required) {
|
|
15507
|
+
requiredProperties.push(propName);
|
|
15508
|
+
}
|
|
15509
|
+
}); // check for required properties
|
|
15510
|
+
|
|
15511
|
+
requiredProperties.forEach(function (requiredProperty) {
|
|
15512
|
+
if (!passedPropertiesKeys.includes(requiredProperty)) {
|
|
15513
|
+
throw new Error(requiredProperty + ' is required when using the ' + backendName + ' Search backend.');
|
|
15514
|
+
}
|
|
15515
|
+
}); // check for accepted properties
|
|
15516
|
+
|
|
15517
|
+
passedPropertiesKeys.forEach(function (passedPropertyKey) {
|
|
15518
|
+
if (!acceptedProperties.includes(passedPropertyKey)) {
|
|
15519
|
+
throw new Error(passedPropertyKey + ' property isn\'t accepted property by ' + backendName + ' backend.');
|
|
15520
|
+
}
|
|
15521
|
+
|
|
15522
|
+
var acceptedTypes = Array.isArray(schema[passedPropertyKey].type) ? schema[passedPropertyKey].type : [].concat(schema[passedPropertyKey].type);
|
|
15523
|
+
var receivedPropertyType = checkDataType(passedProperties[passedPropertyKey]);
|
|
15524
|
+
|
|
15525
|
+
if (!acceptedTypes.includes(receivedPropertyType)) {
|
|
15526
|
+
throw new Error('The property ' + passedPropertyKey + ' is expected with type(s) [' + acceptedTypes.join(', ') + '], but type was set as ' + receivedPropertyType + '.');
|
|
15527
|
+
}
|
|
15528
|
+
});
|
|
15529
|
+
}
|
|
15530
|
+
|
|
15531
|
+
var mongodb = {
|
|
15532
|
+
url: {
|
|
15533
|
+
type: dataTypes.STRING,
|
|
15534
|
+
required: true
|
|
15535
|
+
},
|
|
15536
|
+
app: {
|
|
15537
|
+
type: dataTypes.STRING,
|
|
15538
|
+
required: false
|
|
15539
|
+
},
|
|
15540
|
+
credentials: {
|
|
15541
|
+
type: dataTypes.STRING,
|
|
15542
|
+
required: false
|
|
15543
|
+
},
|
|
15544
|
+
enableTelemetry: {
|
|
15545
|
+
type: dataTypes.BOOLEAN,
|
|
15546
|
+
required: false
|
|
15547
|
+
},
|
|
15548
|
+
mongodb: {
|
|
15549
|
+
type: dataTypes.OBJECT,
|
|
15550
|
+
required: true
|
|
15551
|
+
},
|
|
15552
|
+
username: {
|
|
15553
|
+
type: dataTypes.STRING,
|
|
15554
|
+
required: false
|
|
15555
|
+
},
|
|
15556
|
+
password: {
|
|
15557
|
+
type: dataTypes.STRING,
|
|
15558
|
+
required: false
|
|
15559
|
+
}
|
|
15560
|
+
};
|
|
15561
|
+
var elasticsearch = {
|
|
15562
|
+
url: {
|
|
15563
|
+
type: dataTypes.STRING,
|
|
15564
|
+
required: true
|
|
15565
|
+
},
|
|
15566
|
+
app: {
|
|
15567
|
+
type: dataTypes.STRING,
|
|
15568
|
+
required: true
|
|
15569
|
+
},
|
|
15570
|
+
credentials: {
|
|
15571
|
+
type: dataTypes.STRING,
|
|
15572
|
+
required: false
|
|
15573
|
+
},
|
|
15574
|
+
enableTelemetry: {
|
|
15575
|
+
type: dataTypes.BOOLEAN,
|
|
15576
|
+
required: false
|
|
15577
|
+
},
|
|
15578
|
+
username: {
|
|
15579
|
+
type: dataTypes.STRING,
|
|
15580
|
+
required: false
|
|
15581
|
+
},
|
|
15582
|
+
password: {
|
|
15583
|
+
type: dataTypes.STRING,
|
|
15584
|
+
required: false
|
|
15585
|
+
}
|
|
15586
|
+
};
|
|
15587
|
+
var SCHEMA = {
|
|
15588
|
+
mongodb: mongodb,
|
|
15589
|
+
elasticsearch: elasticsearch
|
|
15590
|
+
};
|
|
15422
15591
|
/**
|
|
15423
15592
|
* Returns an instance of Appbase client
|
|
15424
15593
|
* @param {Object} config To configure properties
|
|
@@ -15428,10 +15597,10 @@
|
|
|
15428
15597
|
* @param {String} config.username
|
|
15429
15598
|
* @param {String} config.password
|
|
15430
15599
|
* @param {Boolean} config.enableTelemetry
|
|
15600
|
+
* @param {Object} config.mongodb
|
|
15431
15601
|
* A callback function which will be invoked before a fetch request made
|
|
15432
15602
|
*/
|
|
15433
15603
|
|
|
15434
|
-
|
|
15435
15604
|
function AppBase(config) {
|
|
15436
15605
|
var _URL = urlParserLite(config.url || ''),
|
|
15437
15606
|
_URL$auth = _URL.auth,
|
|
@@ -15443,30 +15612,42 @@
|
|
|
15443
15612
|
_URL$protocol = _URL.protocol,
|
|
15444
15613
|
protocol = _URL$protocol === undefined ? '' : _URL$protocol;
|
|
15445
15614
|
|
|
15446
|
-
var url =
|
|
15615
|
+
var url = config.url;
|
|
15616
|
+
url = host + path; // Parse url
|
|
15447
15617
|
|
|
15448
|
-
if (
|
|
15449
|
-
|
|
15618
|
+
if (url.slice(-1) === '/') {
|
|
15619
|
+
url = url.slice(0, -1);
|
|
15450
15620
|
}
|
|
15451
15621
|
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
|
|
15622
|
+
var backendName = backendAlias[config.mongodb ? 'MONGODB' : 'ELASTICSEARCH']; // eslint-disable-next-line
|
|
15623
|
+
|
|
15624
|
+
var schema = SCHEMA[backendName];
|
|
15625
|
+
validateSchema({
|
|
15626
|
+
url: config.url,
|
|
15627
|
+
app: config.app,
|
|
15628
|
+
credentials: config.credentials,
|
|
15629
|
+
username: config.username,
|
|
15630
|
+
password: config.password,
|
|
15631
|
+
enableTelemetry: config.enableTelemetry,
|
|
15632
|
+
mongodb: config.mongodb
|
|
15633
|
+
}, schema, backendName);
|
|
15455
15634
|
|
|
15456
15635
|
if (typeof protocol !== 'string' || protocol === '') {
|
|
15457
15636
|
throw new Error('Protocol is not present in url. URL should be of the form https://appbase-demo-ansible-abxiydt-arc.searchbase.io');
|
|
15458
|
-
} // Parse url
|
|
15459
|
-
|
|
15460
|
-
|
|
15461
|
-
if (url.slice(-1) === '/') {
|
|
15462
|
-
url = url.slice(0, -1);
|
|
15463
15637
|
}
|
|
15464
15638
|
|
|
15465
15639
|
var credentials = auth || null;
|
|
15640
|
+
|
|
15641
|
+
if (!config.mongodb) {
|
|
15642
|
+
if (isAppbase(url) && credentials === null) {
|
|
15643
|
+
throw new Error('Authentication information is not present. Did you add credentials?');
|
|
15644
|
+
}
|
|
15645
|
+
}
|
|
15466
15646
|
/**
|
|
15467
15647
|
* Credentials can be provided as a part of the URL,
|
|
15468
15648
|
* as username, password args or as a credentials argument directly */
|
|
15469
15649
|
|
|
15650
|
+
|
|
15470
15651
|
if (typeof config.credentials === 'string' && config.credentials !== '') {
|
|
15471
15652
|
// eslint-disable-next-line
|
|
15472
15653
|
credentials = config.credentials;
|
|
@@ -15474,15 +15655,15 @@
|
|
|
15474
15655
|
credentials = config.username + ':' + config.password;
|
|
15475
15656
|
}
|
|
15476
15657
|
|
|
15477
|
-
if (isAppbase(url) && credentials === null) {
|
|
15478
|
-
throw new Error('Authentication information is not present. Did you add credentials?');
|
|
15479
|
-
}
|
|
15480
|
-
|
|
15481
15658
|
this.url = url;
|
|
15482
15659
|
this.protocol = protocol;
|
|
15483
15660
|
this.app = config.app;
|
|
15484
15661
|
this.credentials = credentials;
|
|
15485
15662
|
|
|
15663
|
+
if (config.mongodb) {
|
|
15664
|
+
this.mongodb = config.mongodb;
|
|
15665
|
+
}
|
|
15666
|
+
|
|
15486
15667
|
if (typeof config.enableTelemetry === 'boolean') {
|
|
15487
15668
|
this.enableTelemetry = config.enableTelemetry;
|
|
15488
15669
|
}
|
|
@@ -15511,7 +15692,9 @@
|
|
|
15511
15692
|
params = parsedArgs.params,
|
|
15512
15693
|
body = parsedArgs.body,
|
|
15513
15694
|
isRSAPI = parsedArgs.isRSAPI,
|
|
15514
|
-
isSuggestionsAPI = parsedArgs.isSuggestionsAPI
|
|
15695
|
+
isSuggestionsAPI = parsedArgs.isSuggestionsAPI,
|
|
15696
|
+
_parsedArgs$isMongoRe = parsedArgs.isMongoRequest,
|
|
15697
|
+
isMongoRequest = _parsedArgs$isMongoRe === undefined ? false : _parsedArgs$isMongoRe;
|
|
15515
15698
|
var app = isSuggestionsAPI ? '.suggestions' : _this.app;
|
|
15516
15699
|
var bodyCopy = body;
|
|
15517
15700
|
var contentType = path.endsWith('msearch') || path.endsWith('bulk') ? 'application/x-ndjson' : 'application/json';
|
|
@@ -15562,7 +15745,7 @@
|
|
|
15562
15745
|
paramsString = '?' + querystring.stringify(params);
|
|
15563
15746
|
}
|
|
15564
15747
|
|
|
15565
|
-
var finalURL = _this.protocol + '://' + _this.url + '/' + app + '/' + path + paramsString;
|
|
15748
|
+
var finalURL = _this.mongodb ? _this.protocol + '://' + _this.url : _this.protocol + '://' + _this.url + '/' + app + '/' + path + paramsString;
|
|
15566
15749
|
return handleTransformRequest(Object.assign({}, {
|
|
15567
15750
|
url: finalURL
|
|
15568
15751
|
}, requestOptions)).then(function (ts) {
|
|
@@ -15571,7 +15754,7 @@
|
|
|
15571
15754
|
delete transformedRequest.url;
|
|
15572
15755
|
return browserPonyfill$1(url || finalURL, Object.assign({}, transformedRequest, {
|
|
15573
15756
|
// apply timestamp header for RS API
|
|
15574
|
-
headers: isRSAPI ? Object.assign({}, transformedRequest.headers, {
|
|
15757
|
+
headers: isRSAPI && !isMongoRequest ? Object.assign({}, transformedRequest.headers, {
|
|
15575
15758
|
'x-timestamp': new Date().getTime()
|
|
15576
15759
|
}) : transformedRequest.headers
|
|
15577
15760
|
})).then(function (res) {
|
|
@@ -15936,12 +16119,20 @@
|
|
|
15936
16119
|
settings: parsedSettings,
|
|
15937
16120
|
query: query
|
|
15938
16121
|
};
|
|
16122
|
+
|
|
16123
|
+
if (this.mongodb) {
|
|
16124
|
+
Object.assign(body, {
|
|
16125
|
+
mongodb: getMongoRequest(this.app, this.mongodb)
|
|
16126
|
+
});
|
|
16127
|
+
}
|
|
16128
|
+
|
|
15939
16129
|
return this.performFetchRequest({
|
|
15940
16130
|
method: 'POST',
|
|
15941
16131
|
path: '_reactivesearch',
|
|
15942
16132
|
body: body,
|
|
15943
|
-
headers: getTelemetryHeaders(this.enableTelemetry),
|
|
15944
|
-
isRSAPI: true
|
|
16133
|
+
headers: getTelemetryHeaders(this.enableTelemetry, !this.mongodb),
|
|
16134
|
+
isRSAPI: true,
|
|
16135
|
+
isMongoRequest: !!this.mongodb
|
|
15945
16136
|
});
|
|
15946
16137
|
}
|
|
15947
16138
|
/**
|
|
@@ -15968,12 +16159,20 @@
|
|
|
15968
16159
|
settings: parsedSettings,
|
|
15969
16160
|
query: query
|
|
15970
16161
|
};
|
|
16162
|
+
|
|
16163
|
+
if (this.mongodb) {
|
|
16164
|
+
Object.assign(body, {
|
|
16165
|
+
mongodb: getMongoRequest(this.app, this.mongodb)
|
|
16166
|
+
});
|
|
16167
|
+
}
|
|
16168
|
+
|
|
15971
16169
|
return this.performFetchRequest({
|
|
15972
16170
|
method: 'POST',
|
|
15973
16171
|
path: '_reactivesearch.v3',
|
|
15974
16172
|
body: body,
|
|
15975
|
-
headers: getTelemetryHeaders(this.enableTelemetry),
|
|
15976
|
-
isRSAPI: true
|
|
16173
|
+
headers: getTelemetryHeaders(this.enableTelemetry, !this.mongodb),
|
|
16174
|
+
isRSAPI: true,
|
|
16175
|
+
isMongoRequest: !!this.mongodb
|
|
15977
16176
|
});
|
|
15978
16177
|
}
|
|
15979
16178
|
/**
|
|
@@ -16011,13 +16210,21 @@
|
|
|
16011
16210
|
settings: parsedSettings,
|
|
16012
16211
|
query: query
|
|
16013
16212
|
};
|
|
16213
|
+
|
|
16214
|
+
if (this.mongodb) {
|
|
16215
|
+
Object.assign(body, {
|
|
16216
|
+
mongodb: getMongoRequest(this.app, this.mongodb)
|
|
16217
|
+
});
|
|
16218
|
+
}
|
|
16219
|
+
|
|
16014
16220
|
return this.performFetchRequest({
|
|
16015
16221
|
method: 'POST',
|
|
16016
16222
|
path: '_reactivesearch.v3',
|
|
16017
16223
|
body: body,
|
|
16018
16224
|
headers: getTelemetryHeaders(this.enableTelemetry),
|
|
16019
16225
|
isRSAPI: true,
|
|
16020
|
-
isSuggestionsAPI: true
|
|
16226
|
+
isSuggestionsAPI: true,
|
|
16227
|
+
isMongoRequest: !!this.mongodb
|
|
16021
16228
|
});
|
|
16022
16229
|
}
|
|
16023
16230
|
|
|
@@ -16749,7 +16956,7 @@
|
|
|
16749
16956
|
}
|
|
16750
16957
|
},
|
|
16751
16958
|
props: {
|
|
16752
|
-
app: types.
|
|
16959
|
+
app: types.string,
|
|
16753
16960
|
analytics: VueTypes.bool,
|
|
16754
16961
|
analyticsConfig: types.analyticsConfig,
|
|
16755
16962
|
appbaseConfig: types.appbaseConfig,
|
|
@@ -16769,7 +16976,8 @@
|
|
|
16769
16976
|
transformResponse: types.func,
|
|
16770
16977
|
as: VueTypes.string.def('div'),
|
|
16771
16978
|
getSearchParams: types.func,
|
|
16772
|
-
setSearchParams: types.func
|
|
16979
|
+
setSearchParams: types.func,
|
|
16980
|
+
mongodb: types.mongodb
|
|
16773
16981
|
},
|
|
16774
16982
|
provide: function provide() {
|
|
16775
16983
|
return {
|
|
@@ -16809,6 +17017,9 @@
|
|
|
16809
17017
|
this.store.dispatch(analytics_3$1(newVal));
|
|
16810
17018
|
}
|
|
16811
17019
|
}
|
|
17020
|
+
},
|
|
17021
|
+
mongodb: function mongodb() {
|
|
17022
|
+
this.updateState(this.$props);
|
|
16812
17023
|
}
|
|
16813
17024
|
},
|
|
16814
17025
|
computed: {
|
|
@@ -16816,12 +17027,13 @@
|
|
|
16816
17027
|
var _this$$props = this.$props,
|
|
16817
17028
|
enableAppbase = _this$$props.enableAppbase,
|
|
16818
17029
|
headers = _this$$props.headers,
|
|
16819
|
-
appbaseConfig = _this$$props.appbaseConfig
|
|
17030
|
+
appbaseConfig = _this$$props.appbaseConfig,
|
|
17031
|
+
mongodb = _this$$props.mongodb;
|
|
16820
17032
|
|
|
16821
17033
|
var _ref = appbaseConfig || {},
|
|
16822
17034
|
enableTelemetry = _ref.enableTelemetry;
|
|
16823
17035
|
|
|
16824
|
-
return _extends({}, enableAppbase && _extends({
|
|
17036
|
+
return _extends({}, enableAppbase && !mongodb && _extends({
|
|
16825
17037
|
'X-Search-Client': X_SEARCH_CLIENT
|
|
16826
17038
|
}, enableTelemetry === false && {
|
|
16827
17039
|
'X-Enable-Telemetry': false
|
|
@@ -16839,7 +17051,7 @@
|
|
|
16839
17051
|
var appbaseConfig = _extends({}, props.analyticsConfig, props.appbaseConfig);
|
|
16840
17052
|
|
|
16841
17053
|
var config = {
|
|
16842
|
-
url: props.url && props.url.trim() !== '' ? props.url : '
|
|
17054
|
+
url: props.url && props.url.trim() !== '' ? props.url : '',
|
|
16843
17055
|
app: props.app,
|
|
16844
17056
|
credentials: credentials,
|
|
16845
17057
|
type: props.type ? props.type : '*',
|
|
@@ -16847,7 +17059,8 @@
|
|
|
16847
17059
|
transformResponse: props.transformResponse,
|
|
16848
17060
|
enableAppbase: props.enableAppbase,
|
|
16849
17061
|
analytics: props.appbaseConfig ? props.appbaseConfig.recordAnalytics : props.analytics,
|
|
16850
|
-
analyticsConfig: appbaseConfig
|
|
17062
|
+
analyticsConfig: appbaseConfig,
|
|
17063
|
+
mongodb: props.mongodb
|
|
16851
17064
|
};
|
|
16852
17065
|
var queryParams = '';
|
|
16853
17066
|
|
|
@@ -25939,8 +26152,9 @@
|
|
|
25939
26152
|
appbaseQuery = _extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), transform_1(state, component.componentId, orderOfQueries));
|
|
25940
26153
|
}
|
|
25941
26154
|
} else {
|
|
26155
|
+
var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + "_" + component : component;
|
|
25942
26156
|
finalQuery = [].concat(finalQuery, [{
|
|
25943
|
-
preference:
|
|
26157
|
+
preference: preference
|
|
25944
26158
|
}, currentQuery]);
|
|
25945
26159
|
}
|
|
25946
26160
|
}
|
|
@@ -26094,7 +26308,7 @@
|
|
|
26094
26308
|
});
|
|
26095
26309
|
}
|
|
26096
26310
|
|
|
26097
|
-
var version = "1.
|
|
26311
|
+
var version = "1.24.0";
|
|
26098
26312
|
|
|
26099
26313
|
var _templateObject$n, _templateObject2$a;
|
|
26100
26314
|
|