@bringg/dashboard-sdk 5.6.3 → 5.6.4

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.
@@ -1,6 +1,5 @@
1
1
  import { Run, RoutesMonitoringRequest, GetAllRoutesMonitoring } from '@bringg/types';
2
2
  import Session from '../../Services/Identity/Session';
3
- import { RunsResponse } from '../runs.consts';
4
3
  import { RunQueryOptions } from '../run-types';
5
4
  import { CommonOptions } from '../../Core/RouteGenerator';
6
5
  export default class RunsApi {
@@ -10,7 +9,7 @@ export default class RunsApi {
10
9
  constructor(session: Session);
11
10
  getAll(): Run[];
12
11
  getByIds(ids: number[]): Run[];
13
- loadAll(options: RunQueryOptions, commonOptions?: CommonOptions): Promise<RunsResponse>;
12
+ loadAll(options: RunQueryOptions, commonOptions?: CommonOptions): Promise<Run[]>;
14
13
  loadRunsData(payload: RoutesMonitoringRequest, commonOptions?: CommonOptions): Promise<GetAllRoutesMonitoring>;
15
14
  private createOrUpdateRun;
16
15
  private deleteRun;
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -66,18 +77,25 @@ var RunsApi = /** @class */ (function () {
66
77
  RunsApi.prototype.loadAll = function (options, commonOptions) {
67
78
  if (commonOptions === void 0) { commonOptions = {}; }
68
79
  return __awaiter(this, void 0, void 0, function () {
69
- var response, runIds, runs;
80
+ var idsToFetch, runs_1, runs;
81
+ var _this = this;
70
82
  return __generator(this, function (_a) {
71
83
  switch (_a.label) {
72
- case 0: return [4 /*yield*/, this.runsService.getAll(options, commonOptions)];
84
+ case 0:
85
+ if (!options.ids) return [3 /*break*/, 3];
86
+ idsToFetch = options.ids.filter(function (id) { return !_this.runsStore.get(id); });
87
+ if (!idsToFetch.length) return [3 /*break*/, 2];
88
+ return [4 /*yield*/, this.runsService.loadAll(__assign(__assign({}, options), { ids: idsToFetch }), commonOptions)];
73
89
  case 1:
74
- response = _a.sent();
75
- runIds = response.runs.map(function (run) { return run.id; });
76
- return [4 /*yield*/, this.runsService.loadAll({ ids: runIds }, commonOptions)];
77
- case 2:
90
+ runs_1 = _a.sent();
91
+ this.runsStore.setAll(runs_1.map(function (run) { return ({ current: run }); }));
92
+ _a.label = 2;
93
+ case 2: return [2 /*return*/, this.getByIds(options.ids)];
94
+ case 3: return [4 /*yield*/, this.runsService.loadAll(options, commonOptions)];
95
+ case 4:
78
96
  runs = _a.sent();
79
97
  this.runsStore.setAll(runs.map(function (run) { return ({ current: run }); }));
80
- return [2 /*return*/, response];
98
+ return [2 /*return*/, runs];
81
99
  }
82
100
  });
83
101
  });
@@ -1 +1 @@
1
- {"version":3,"file":"runs-api.js","sourceRoot":"","sources":["../../../src/Run/v2/runs-api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAyC;AAEzC,8CAAyD;AACzD,wDAAsD;AAEtD,uEAAiE;AAGjE;IAKC,iBAAY,OAAgB;QAA5B,iBAQC;QAyBO,sBAAiB,GAAG,UAAC,OAAqB;YACjD,KAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC,CAAC;QAEM,cAAS,GAAG,UAAC,OAAuB;YAC3C,KAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACnC,CAAC,CAAC;QAtCD,IAAI,CAAC,SAAS,GAAG,I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A;;wBAA7D,IAAI,GAAG,SAAsD;wBAEnE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,GAAG,IAAK,OAAA,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAlB,CAAkB,CAAC,CAAC,CAAC;wBAE7D,sBAAO,IAAI,EAAC;;;;KACZ;IAEY,8BAAY,GAAzB,UACC,OAAgC,EAChC,aAAiC;QAAjC,8BAAA,EAAA,kBAAiC;;;;4BAE1B,qBAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,EAAA;4BAAlE,sBAAO,SAA2D,EAAC;;;;KACnE;IASF,cAAC;AAAD,CAAC,AAzDD,IAyDC"}
@@ -53,7 +53,7 @@ var Logger_1 = require("../Core/Logger");
53
53
  var lodash_1 = require("lodash");
54
54
  var BringgException_1 = require("../Core/BringgException");
55
55
  var abort_1 = require("../utils/abort");
56
- var version = '5.6.3';
56
+ var version = '5.6.4';
57
57
  function logErrorResponse(response) {
58
58
  var data = response.data, status = response.status;
59
59
  try {
@@ -35599,7 +35599,7 @@ var Logger_1 = __webpack_require__(48);
35599
35599
  var lodash_1 = __webpack_require__(11);
35600
35600
  var BringgException_1 = __webpack_require__(15);
35601
35601
  var abort_1 = __webpack_require__(169);
35602
- var version = '5.6.3';
35602
+ var version = '5.6.4';
35603
35603
  function logErrorResponse(response) {
35604
35604
  var data = response.data, status = response.status;
35605
35605
  try {
@@ -49727,6 +49727,17 @@ exports.default = TaskRejectReasonsApi;
49727
49727
 
49728
49728
  "use strict";
49729
49729
 
49730
+ var __assign = (this && this.__assign) || function () {
49731
+ __assign = Object.assign || function(t) {
49732
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
49733
+ s = arguments[i];
49734
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
49735
+ t[p] = s[p];
49736
+ }
49737
+ return t;
49738
+ };
49739
+ return __assign.apply(this, arguments);
49740
+ };
49730
49741
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
49731
49742
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
49732
49743
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -49794,18 +49805,25 @@ var RunsApi = /** @class */ (function () {
49794
49805
  RunsApi.prototype.loadAll = function (options, commonOptions) {
49795
49806
  if (commonOptions === void 0) { commonOptions = {}; }
49796
49807
  return __awaiter(this, void 0, void 0, function () {
49797
- var response, runIds, runs;
49808
+ var idsToFetch, runs_1, runs;
49809
+ var _this = this;
49798
49810
  return __generator(this, function (_a) {
49799
49811
  switch (_a.label) {
49800
- case 0: return [4 /*yield*/, this.runsService.getAll(options, commonOptions)];
49812
+ case 0:
49813
+ if (!options.ids) return [3 /*break*/, 3];
49814
+ idsToFetch = options.ids.filter(function (id) { return !_this.runsStore.get(id); });
49815
+ if (!idsToFetch.length) return [3 /*break*/, 2];
49816
+ return [4 /*yield*/, this.runsService.loadAll(__assign(__assign({}, options), { ids: idsToFetch }), commonOptions)];
49801
49817
  case 1:
49802
- response = _a.sent();
49803
- runIds = response.runs.map(function (run) { return run.id; });
49804
- return [4 /*yield*/, this.runsService.loadAll({ ids: runIds }, commonOptions)];
49805
- case 2:
49818
+ runs_1 = _a.sent();
49819
+ this.runsStore.setAll(runs_1.map(function (run) { return ({ current: run }); }));
49820
+ _a.label = 2;
49821
+ case 2: return [2 /*return*/, this.getByIds(options.ids)];
49822
+ case 3: return [4 /*yield*/, this.runsService.loadAll(options, commonOptions)];
49823
+ case 4:
49806
49824
  runs = _a.sent();
49807
49825
  this.runsStore.setAll(runs.map(function (run) { return ({ current: run }); }));
49808
- return [2 /*return*/, response];
49826
+ return [2 /*return*/, runs];
49809
49827
  }
49810
49828
  });
49811
49829
  });