@evergis/api 3.0.212 → 3.0.214
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/LICENSE +20 -20
- package/README.md +21 -21
- package/dist/__generated__/data-contracts.d.ts +213 -213
- package/dist/api.cjs.development.js +53 -24
- package/dist/api.cjs.development.js.map +1 -1
- package/dist/api.cjs.production.min.js +1 -1
- package/dist/api.cjs.production.min.js.map +1 -1
- package/dist/api.esm.js +264 -236
- package/dist/api.esm.js.map +1 -1
- package/dist/utils/location.d.ts +1 -0
- package/package.json +3 -3
|
@@ -36,9 +36,6 @@ function _defineProperties(target, props) {
|
|
|
36
36
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
37
37
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
38
38
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
39
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
40
|
-
writable: false
|
|
41
|
-
});
|
|
42
39
|
return Constructor;
|
|
43
40
|
}
|
|
44
41
|
|
|
@@ -72,9 +69,6 @@ function _inherits(subClass, superClass) {
|
|
|
72
69
|
configurable: true
|
|
73
70
|
}
|
|
74
71
|
});
|
|
75
|
-
Object.defineProperty(subClass, "prototype", {
|
|
76
|
-
writable: false
|
|
77
|
-
});
|
|
78
72
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
79
73
|
}
|
|
80
74
|
|
|
@@ -133,8 +127,6 @@ function _assertThisInitialized(self) {
|
|
|
133
127
|
function _possibleConstructorReturn(self, call) {
|
|
134
128
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
135
129
|
return call;
|
|
136
|
-
} else if (call !== void 0) {
|
|
137
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
138
130
|
}
|
|
139
131
|
|
|
140
132
|
return _assertThisInitialized(self);
|
|
@@ -168,7 +160,7 @@ function _superPropBase(object, property) {
|
|
|
168
160
|
return object;
|
|
169
161
|
}
|
|
170
162
|
|
|
171
|
-
function _get() {
|
|
163
|
+
function _get(target, property, receiver) {
|
|
172
164
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
173
165
|
_get = Reflect.get;
|
|
174
166
|
} else {
|
|
@@ -179,17 +171,17 @@ function _get() {
|
|
|
179
171
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
180
172
|
|
|
181
173
|
if (desc.get) {
|
|
182
|
-
return desc.get.call(
|
|
174
|
+
return desc.get.call(receiver);
|
|
183
175
|
}
|
|
184
176
|
|
|
185
177
|
return desc.value;
|
|
186
178
|
};
|
|
187
179
|
}
|
|
188
180
|
|
|
189
|
-
return _get
|
|
181
|
+
return _get(target, property, receiver || target);
|
|
190
182
|
}
|
|
191
183
|
|
|
192
|
-
const API_USER_INFO_KEY =
|
|
184
|
+
const API_USER_INFO_KEY = "@evergis/user-info";
|
|
193
185
|
const STORAGE_TOKEN_KEY = "evergis-jwt-token";
|
|
194
186
|
const STORAGE_REFRESH_TOKEN_KEY = "evergis-refresh-token";
|
|
195
187
|
|
|
@@ -4850,6 +4842,7 @@ function isString(v) {
|
|
|
4850
4842
|
}
|
|
4851
4843
|
|
|
4852
4844
|
const addSubDomainToLocation = subDomain => window.location.protocol + "//" + subDomain + "." + window.location.host;
|
|
4845
|
+
const getFetchingUrlPath = urlPath => urlPath === exports.UrlPath.Presentation ? exports.UrlPath.Base : urlPath;
|
|
4853
4846
|
|
|
4854
4847
|
const parseJwt = token => {
|
|
4855
4848
|
const base64Url = token.split(".")[1];
|
|
@@ -5228,8 +5221,8 @@ let Notification = /*#__PURE__*/function (_NotificationService) {
|
|
|
5228
5221
|
|| event.code === 4002
|
|
5229
5222
|
/* InvalidSession */
|
|
5230
5223
|
) {
|
|
5231
|
-
|
|
5232
|
-
|
|
5224
|
+
_this.connectStatus = exports.ConnectionStatus.SessionClosed;
|
|
5225
|
+
} else if (_this.reconnectTries < _this.MAX_WS_RECONNECT_TRIES) {
|
|
5233
5226
|
_this.connectStatus = exports.ConnectionStatus.Break;
|
|
5234
5227
|
_this.reconnectTries++;
|
|
5235
5228
|
|
|
@@ -6083,12 +6076,12 @@ let Resources = /*#__PURE__*/function () {
|
|
|
6083
6076
|
}, {
|
|
6084
6077
|
key: "getDependentNames",
|
|
6085
6078
|
value: function getDependentNames(deps, depType) {
|
|
6086
|
-
return deps.filter(_ref => {
|
|
6079
|
+
return deps.filter((_ref) => {
|
|
6087
6080
|
let {
|
|
6088
6081
|
type
|
|
6089
6082
|
} = _ref;
|
|
6090
6083
|
return type === depType;
|
|
6091
|
-
}).map(_ref2 => {
|
|
6084
|
+
}).map((_ref2) => {
|
|
6092
6085
|
let {
|
|
6093
6086
|
name
|
|
6094
6087
|
} = _ref2;
|
|
@@ -6544,7 +6537,7 @@ let Scheduler = /*#__PURE__*/function (_SchedulerService) {
|
|
|
6544
6537
|
const taskProgress = await this.getTaskProgress(id);
|
|
6545
6538
|
this.resolveTaskStatus(taskProgress, resolve, reject);
|
|
6546
6539
|
|
|
6547
|
-
const taskResultCallback = async _ref => {
|
|
6540
|
+
const taskResultCallback = async (_ref) => {
|
|
6548
6541
|
let {
|
|
6549
6542
|
data
|
|
6550
6543
|
} = _ref;
|
|
@@ -7722,7 +7715,12 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
|
|
|
7722
7715
|
} = httpOptions || {};
|
|
7723
7716
|
_this.http = http || new HttpClient(_extends({
|
|
7724
7717
|
prefixUrl: url,
|
|
7725
|
-
timeout: false
|
|
7718
|
+
timeout: false,
|
|
7719
|
+
retry: {
|
|
7720
|
+
methods: ["get", "post", "delete"],
|
|
7721
|
+
limit: 5,
|
|
7722
|
+
statusCodes: [401]
|
|
7723
|
+
}
|
|
7726
7724
|
}, httpOptions || {}, {
|
|
7727
7725
|
hooks: _extends({}, hooks || {}, {
|
|
7728
7726
|
beforeRequest: [request => {
|
|
@@ -7731,14 +7729,44 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
|
|
|
7731
7729
|
if (token) {
|
|
7732
7730
|
var _request$headers;
|
|
7733
7731
|
|
|
7734
|
-
(_request$headers = request.headers) == null ? void 0 : _request$headers.set(
|
|
7732
|
+
(_request$headers = request.headers) == null ? void 0 : _request$headers.set("Authorization", "Bearer " + (token || ""));
|
|
7735
7733
|
}
|
|
7736
7734
|
}, ...((_hooks$beforeRequest = hooks == null ? void 0 : hooks.beforeRequest) != null ? _hooks$beforeRequest : [])],
|
|
7737
|
-
|
|
7735
|
+
beforeRetry: [async (_ref2) => {
|
|
7736
|
+
let {
|
|
7737
|
+
request,
|
|
7738
|
+
error,
|
|
7739
|
+
retryCount
|
|
7740
|
+
} = _ref2;
|
|
7741
|
+
|
|
7742
|
+
if (error instanceof ky.HTTPError && error.response.status === 401 && retryCount === 1) {
|
|
7743
|
+
try {
|
|
7744
|
+
const refreshToken = window.localStorage.getItem(STORAGE_REFRESH_TOKEN_KEY);
|
|
7745
|
+
|
|
7746
|
+
if (refreshToken) {
|
|
7747
|
+
var _request$headers2;
|
|
7748
|
+
|
|
7749
|
+
const refreshTokenResponse = await _this.account.refreshToken({
|
|
7750
|
+
refreshToken
|
|
7751
|
+
});
|
|
7752
|
+
|
|
7753
|
+
if (refreshTokenResponse) {
|
|
7754
|
+
window.localStorage.setItem(STORAGE_TOKEN_KEY, refreshTokenResponse.token);
|
|
7755
|
+
window.localStorage.setItem(STORAGE_REFRESH_TOKEN_KEY, refreshTokenResponse.refreshToken);
|
|
7756
|
+
}
|
|
7757
|
+
|
|
7758
|
+
(_request$headers2 = request.headers) == null ? void 0 : _request$headers2.set("Authorization", "Bearer " + (refreshTokenResponse.token || ""));
|
|
7759
|
+
}
|
|
7760
|
+
} catch (error) {
|
|
7761
|
+
throw new Error("Failed to refresh token");
|
|
7762
|
+
}
|
|
7763
|
+
}
|
|
7764
|
+
}],
|
|
7765
|
+
afterResponse: [(request, options, response) => {
|
|
7738
7766
|
const apiEvent = apiEventsByResponseStatus[response.status];
|
|
7739
7767
|
|
|
7740
7768
|
if (apiEvent) {
|
|
7741
|
-
_this.emit(apiEvent, errorHandler(new ky.HTTPError(response)));
|
|
7769
|
+
_this.emit(apiEvent, errorHandler(new ky.HTTPError(response, request, options)));
|
|
7742
7770
|
}
|
|
7743
7771
|
|
|
7744
7772
|
return response;
|
|
@@ -7795,7 +7823,7 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
|
|
|
7795
7823
|
|
|
7796
7824
|
_createClass(Api, [{
|
|
7797
7825
|
key: "init",
|
|
7798
|
-
value: async function init(
|
|
7826
|
+
value: async function init(_ref3) {
|
|
7799
7827
|
let {
|
|
7800
7828
|
authParams,
|
|
7801
7829
|
authQueryParams,
|
|
@@ -7804,7 +7832,7 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
|
|
|
7804
7832
|
fetchSettings,
|
|
7805
7833
|
fetchUser,
|
|
7806
7834
|
useJwt
|
|
7807
|
-
} =
|
|
7835
|
+
} = _ref3;
|
|
7808
7836
|
|
|
7809
7837
|
try {
|
|
7810
7838
|
await this.account.login(authParams, authQueryParams, useJwt);
|
|
@@ -7823,7 +7851,7 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
|
|
|
7823
7851
|
|
|
7824
7852
|
if (fetchSettings) {
|
|
7825
7853
|
await this.clientSettings.fetchClientSettings({
|
|
7826
|
-
urlPath: this.urlPath
|
|
7854
|
+
urlPath: getFetchingUrlPath(this.urlPath)
|
|
7827
7855
|
});
|
|
7828
7856
|
}
|
|
7829
7857
|
|
|
@@ -8671,6 +8699,7 @@ exports.addSubDomainToLocation = addSubDomainToLocation;
|
|
|
8671
8699
|
exports.errorHandler = errorHandler;
|
|
8672
8700
|
exports.formDataFromFile = formDataFromFile;
|
|
8673
8701
|
exports.generateId = generateId;
|
|
8702
|
+
exports.getFetchingUrlPath = getFetchingUrlPath;
|
|
8674
8703
|
exports.isEvergisDynamicLayer = isEvergisDynamicLayer;
|
|
8675
8704
|
exports.isEvergisTileLayer = isEvergisTileLayer;
|
|
8676
8705
|
exports.isFeatureLayer = isFeatureLayer;
|