@bringg/dashboard-sdk 9.0.0 → 9.1.0-pre.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.
@@ -2754,6 +2754,7 @@ var BringgDashboardSDK = /** @class */ (function () {
2754
2754
  this.vehicleTypes = null;
2755
2755
  this.vehicles = null;
2756
2756
  this.session = session;
2757
+ this.session.sdk = this;
2757
2758
  }
2758
2759
  BringgDashboardSDK.setConfigurations = function (apiEndpointURL, monitorEndpointURL, generalEnvApiEndpoint) {
2759
2760
  configurationProvider.getApiEndpoint = function () { return apiEndpointURL; };
@@ -14634,9 +14635,6 @@ var OptimizationConfigurationV2 = /** @class */ (function () {
14634
14635
  OptimizationConfigurationV2.prototype.delete = function (id) {
14635
14636
  return this.optimizationConfigurationService.delete(id);
14636
14637
  };
14637
- OptimizationConfigurationV2.prototype.getConfigurationAttributes = function () {
14638
- return this.optimizationConfigurationService.getConfigurationAttributes();
14639
- };
14640
14638
  OptimizationConfigurationV2.prototype.batchDelete = function (configurationIds) {
14641
14639
  return this.optimizationConfigurationService.batchDelete(configurationIds);
14642
14640
  };
@@ -14767,13 +14765,6 @@ var OptimizationConfigurationsEntity = /** @class */ (function (_super) {
14767
14765
  });
14768
14766
  });
14769
14767
  };
14770
- OptimizationConfigurationsEntity.prototype.getConfigurationAttributes = function () {
14771
- return __awaiter(this, void 0, void 0, function () {
14772
- return __generator(this, function (_a) {
14773
- return [2 /*return*/, this.routeGenerator.get(Routes.GET_CONFIGURATION_ATTRIBUTES).invoke()];
14774
- });
14775
- });
14776
- };
14777
14768
  OptimizationConfigurationsEntity.prototype.batchDelete = function (configurationIds) {
14778
14769
  return __awaiter(this, void 0, void 0, function () {
14779
14770
  return __generator(this, function (_a) {
@@ -17859,21 +17850,6 @@ var OptimizationEvents;
17859
17850
 
17860
17851
  "use strict";
17861
17852
 
17862
- var __extends = (this && this.__extends) || (function () {
17863
- var extendStatics = function (d, b) {
17864
- extendStatics = Object.setPrototypeOf ||
17865
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
17866
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
17867
- return extendStatics(d, b);
17868
- };
17869
- return function (d, b) {
17870
- if (typeof b !== "function" && b !== null)
17871
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
17872
- extendStatics(d, b);
17873
- function __() { this.constructor = d; }
17874
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17875
- };
17876
- })();
17877
17853
  var __assign = (this && this.__assign) || function () {
17878
17854
  __assign = Object.assign || function(t) {
17879
17855
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -17885,30 +17861,78 @@ var __assign = (this && this.__assign) || function () {
17885
17861
  };
17886
17862
  return __assign.apply(this, arguments);
17887
17863
  };
17864
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17865
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17866
+ return new (P || (P = Promise))(function (resolve, reject) {
17867
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17868
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17869
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17870
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
17871
+ });
17872
+ };
17873
+ var __generator = (this && this.__generator) || function (thisArg, body) {
17874
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
17875
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
17876
+ function verb(n) { return function (v) { return step([n, v]); }; }
17877
+ function step(op) {
17878
+ if (f) throw new TypeError("Generator is already executing.");
17879
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17880
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
17881
+ if (y = 0, t) op = [op[0] & 2, t.value];
17882
+ switch (op[0]) {
17883
+ case 0: case 1: t = op; break;
17884
+ case 4: _.label++; return { value: op[1], done: false };
17885
+ case 5: _.label++; y = op[1]; op = [0]; continue;
17886
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
17887
+ default:
17888
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
17889
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
17890
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
17891
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
17892
+ if (t[2]) _.ops.pop();
17893
+ _.trys.pop(); continue;
17894
+ }
17895
+ op = body.call(thisArg, _);
17896
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
17897
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
17898
+ }
17899
+ };
17900
+ var __rest = (this && this.__rest) || function (s, e) {
17901
+ var t = {};
17902
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
17903
+ t[p] = s[p];
17904
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17905
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17906
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17907
+ t[p[i]] = s[p[i]];
17908
+ }
17909
+ return t;
17910
+ };
17911
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17912
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17913
+ };
17888
17914
  Object.defineProperty(exports, "__esModule", ({ value: true }));
17889
17915
  var BringgException_1 = __webpack_require__(43605);
17916
+ var CrudService_1 = __importDefault(__webpack_require__(14809));
17890
17917
  var RouteGenerator_1 = __webpack_require__(84075);
17891
17918
  var Route_1 = __webpack_require__(92641);
17892
- var SessionBasedService_1 = __webpack_require__(27826);
17893
- var RouteOptimizationApi = /** @class */ (function (_super) {
17894
- __extends(RouteOptimizationApi, _super);
17919
+ var RouteOptimizationApi = /** @class */ (function () {
17895
17920
  function RouteOptimizationApi(session) {
17896
- var _this = _super.call(this, session.config.getApiEndpoint(), session) || this;
17897
- _this.optimization = new Route_1.Route('/route_optimizations/optimize', 1 /* HttpMethod.POST */);
17898
- _this.optimization_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/optimize', 1 /* HttpMethod.POST */);
17899
- _this.get_optimization_result = new Route_1.Route('/route_optimizations/get_optimization_result/{:request_uuid}', 0 /* HttpMethod.GET */);
17900
- _this.get_optimization_result_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/get_optimization_result/{:request_uuid}', 0 /* HttpMethod.GET */);
17901
- _this.cancel_requests = new Route_1.Route('/route_optimizations/optimization', 4 /* HttpMethod.DELETE */);
17902
- _this.cancel_requests_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/optimization', 4 /* HttpMethod.DELETE */);
17903
- _this.assign_users_by_ids = new Route_1.Route('/route_optimizations/assign_users_by_ids', 1 /* HttpMethod.POST */);
17904
- _this.update_user_modified_data = new Route_1.Route('/route_optimizations/update_user_modified_data', 1 /* HttpMethod.POST */);
17905
- _this.update_user_modified_data_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/update_user_modified_data', 1 /* HttpMethod.POST */);
17906
- _this.assign_user_manual_optimization = new Route_1.Route('/route_optimizations/assign_user_manual_optimization', 1 /* HttpMethod.POST */);
17907
- return _this;
17921
+ this.optimization = new Route_1.Route('/route_optimizations/optimize', 1 /* HttpMethod.POST */);
17922
+ this.optimization_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/optimize', 1 /* HttpMethod.POST */);
17923
+ this.get_optimization_result = new Route_1.Route('/route_optimizations/get_optimization_result/{:request_uuid}', 0 /* HttpMethod.GET */);
17924
+ this.get_optimization_result_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/get_optimization_result/{:request_uuid}', 0 /* HttpMethod.GET */);
17925
+ this.cancel_requests = new Route_1.Route('/route_optimizations/optimization', 4 /* HttpMethod.DELETE */);
17926
+ this.cancel_requests_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/optimization', 4 /* HttpMethod.DELETE */);
17927
+ this.assign_users_by_ids = new Route_1.Route('/route_optimizations/assign_users_by_ids', 1 /* HttpMethod.POST */);
17928
+ this.update_user_modified_data = new Route_1.Route('/route_optimizations/update_user_modified_data', 1 /* HttpMethod.POST */);
17929
+ this.update_user_modified_data_v2 = new Route_1.Route('/own-fleet-optimization-service/route_optimization/update_user_modified_data', 1 /* HttpMethod.POST */);
17930
+ this.assign_user_manual_optimization = new Route_1.Route('/route_optimizations/assign_user_manual_optimization', 1 /* HttpMethod.POST */);
17931
+ this.service = new CrudService_1.default(session, '');
17908
17932
  }
17909
17933
  RouteOptimizationApi.prototype.cancelRequests = function (requestUuids, v2) {
17910
17934
  if (v2 === void 0) { v2 = false; }
17911
- return this.handleAuthorizedRequest({
17935
+ return this.service.handleAuthorizedRequest({
17912
17936
  route: v2 ? this.cancel_requests_v2 : this.cancel_requests,
17913
17937
  extractor: RouteGenerator_1.defaultExtractor,
17914
17938
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to call cancel optimization requests'),
@@ -17917,7 +17941,7 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
17917
17941
  };
17918
17942
  RouteOptimizationApi.prototype.optimize = function (optimizationProps, v2) {
17919
17943
  if (v2 === void 0) { v2 = false; }
17920
- return this.handleAuthorizedRequest({
17944
+ return this.service.handleAuthorizedRequest({
17921
17945
  route: v2 ? this.optimization_v2 : this.optimization,
17922
17946
  extractor: RouteGenerator_1.defaultExtractor,
17923
17947
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to call optimization requests'),
@@ -17926,7 +17950,7 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
17926
17950
  };
17927
17951
  RouteOptimizationApi.prototype.optimizationResult = function (request_uuid, v2) {
17928
17952
  if (v2 === void 0) { v2 = false; }
17929
- return this.handleAuthorizedRequest({
17953
+ return this.service.handleAuthorizedRequest({
17930
17954
  route: v2 ? this.get_optimization_result_v2 : this.get_optimization_result,
17931
17955
  extractor: RouteGenerator_1.defaultExtractor,
17932
17956
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to get optimization results'),
@@ -17934,7 +17958,7 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
17934
17958
  });
17935
17959
  };
17936
17960
  RouteOptimizationApi.prototype.assignUsersByIds = function (teams) {
17937
- return this.handleAuthorizedRequest({
17961
+ return this.service.handleAuthorizedRequest({
17938
17962
  route: this.assign_users_by_ids,
17939
17963
  extractor: RouteGenerator_1.defaultExtractor,
17940
17964
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to assign users by id'),
@@ -17943,7 +17967,7 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
17943
17967
  };
17944
17968
  RouteOptimizationApi.prototype.updateOptimizationModifiedData = function (updateData, v2) {
17945
17969
  if (v2 === void 0) { v2 = false; }
17946
- return this.handleAuthorizedRequest({
17970
+ return this.service.handleAuthorizedRequest({
17947
17971
  route: v2 ? this.update_user_modified_data_v2 : this.update_user_modified_data,
17948
17972
  extractor: RouteGenerator_1.defaultExtractor,
17949
17973
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to update optimization user data'),
@@ -17952,7 +17976,7 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
17952
17976
  };
17953
17977
  RouteOptimizationApi.prototype.assignUserManualOptimization = function (updateData) {
17954
17978
  var fiveMinutesInMs = 1000 * 60 * 5;
17955
- return this.handleAuthorizedRequest({
17979
+ return this.service.handleAuthorizedRequest({
17956
17980
  route: this.assign_user_manual_optimization,
17957
17981
  extractor: RouteGenerator_1.defaultExtractor,
17958
17982
  exceptionProducer: BringgException_1.BringgException.serviceException('Failed to assign user manual optimization data'),
@@ -17960,8 +17984,40 @@ var RouteOptimizationApi = /** @class */ (function (_super) {
17960
17984
  timeout: fiveMinutesInMs
17961
17985
  });
17962
17986
  };
17987
+ RouteOptimizationApi.prototype.calculatePlannedEta = function (data, _a) {
17988
+ if (_a === void 0) { _a = {}; }
17989
+ var _b = _a.timeout, timeout = _b === void 0 ? 10000 : _b, options = __rest(_a, ["timeout"]);
17990
+ return __awaiter(this, void 0, void 0, function () {
17991
+ var payload, result, asyncResult;
17992
+ return __generator(this, function (_c) {
17993
+ switch (_c.label) {
17994
+ case 0:
17995
+ payload = {
17996
+ team_id: data.team_id,
17997
+ data: __assign(__assign({}, data), { deadline: Date.now() + timeout })
17998
+ };
17999
+ return [4 /*yield*/, this.service.routeGenerator
18000
+ .post('/own-fleet-optimization-service/route_optimization/calculate_planned_eta')
18001
+ .withPayload(payload)
18002
+ .setException('Failed to calculate planned eta')
18003
+ .withCommonOptions(options)
18004
+ .invoke()];
18005
+ case 1:
18006
+ result = _c.sent();
18007
+ return [4 /*yield*/, this.service.session.sdk.asyncOperationStatus.waitForResponse({
18008
+ requestId: result.uuid,
18009
+ timeoutInMs: timeout,
18010
+ signal: options.signal
18011
+ })];
18012
+ case 2:
18013
+ asyncResult = _c.sent();
18014
+ return [2 /*return*/, asyncResult.data];
18015
+ }
18016
+ });
18017
+ });
18018
+ };
17963
18019
  return RouteOptimizationApi;
17964
- }(SessionBasedService_1.SessionBasedService));
18020
+ }());
17965
18021
  exports["default"] = RouteOptimizationApi;
17966
18022
  //# sourceMappingURL=RouteOptimizationApi.js.map
17967
18023
 
@@ -21971,7 +22027,7 @@ var lodash_1 = __webpack_require__(96486);
21971
22027
  var BringgException_1 = __webpack_require__(43605);
21972
22028
  var Logger_1 = __importDefault(__webpack_require__(55860));
21973
22029
  var abort_1 = __webpack_require__(34179);
21974
- var version = '9.0.0';
22030
+ var version = '9.1.0-pre.0';
21975
22031
  function logErrorResponse(response) {
21976
22032
  var data = response.data, status = response.status;
21977
22033
  try {