@evergis/api 3.0.201 → 3.0.203
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/Api.d.ts +0 -1
- package/dist/__generated__/AccountService.d.ts +1 -1
- package/dist/__generated__/LayersService.d.ts +2 -2
- package/dist/__generated__/ProjectsService.d.ts +2 -2
- package/dist/__generated__/StatisticService.d.ts +2 -2
- package/dist/__generated__/TablesService.d.ts +2 -2
- package/dist/__generated__/WmsServerService.d.ts +2 -2
- package/dist/__generated__/data-contracts.d.ts +5 -5
- package/dist/api.cjs.development.js +22 -31
- 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 +20 -32
- package/dist/api.esm.js.map +1 -1
- package/dist/constants.d.ts +2 -0
- package/dist/index.d.ts +10 -9
- package/dist/services/Account.d.ts +1 -1
- package/dist/services/Statistic.d.ts +2 -2
- package/dist/utils/index.d.ts +10 -9
- package/package.json +2 -2
- package/dist/services/constants.d.ts +0 -2
package/dist/api.esm.js
CHANGED
|
@@ -175,6 +175,7 @@ function _get(target, property, receiver) {
|
|
|
175
175
|
return _get(target, property, receiver || target);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
const API_USER_INFO_KEY = '@evergis/user-info';
|
|
178
179
|
const STORAGE_TOKEN_KEY = "evergis-jwt-token";
|
|
179
180
|
const STORAGE_REFRESH_TOKEN_KEY = "evergis-refresh-token";
|
|
180
181
|
|
|
@@ -1178,7 +1179,7 @@ let AccountService = /*#__PURE__*/function (_Service) {
|
|
|
1178
1179
|
}, {
|
|
1179
1180
|
key: "refreshToken",
|
|
1180
1181
|
value: function refreshToken(data) {
|
|
1181
|
-
return this.http.post("/account/refresh-token", data).
|
|
1182
|
+
return this.http.post("/account/refresh-token", data).json();
|
|
1182
1183
|
}
|
|
1183
1184
|
/**
|
|
1184
1185
|
* No description
|
|
@@ -1409,8 +1410,6 @@ let AccountService = /*#__PURE__*/function (_Service) {
|
|
|
1409
1410
|
return AccountService;
|
|
1410
1411
|
}(Service);
|
|
1411
1412
|
|
|
1412
|
-
const API_USER_INFO_KEY = '@evergis/user-info';
|
|
1413
|
-
|
|
1414
1413
|
const getUserInfo = () => JSON.parse(localStorage.getItem(API_USER_INFO_KEY) || 'null') || void 0;
|
|
1415
1414
|
const updateUserInfo = newUserInfo => {
|
|
1416
1415
|
if (newUserInfo) {
|
|
@@ -1434,18 +1433,18 @@ let Account = /*#__PURE__*/function (_AccountService) {
|
|
|
1434
1433
|
|
|
1435
1434
|
_createClass(Account, [{
|
|
1436
1435
|
key: "login",
|
|
1437
|
-
value: function login(params, authParams) {
|
|
1436
|
+
value: async function login(params, authParams) {
|
|
1438
1437
|
if (authParams === void 0) {
|
|
1439
1438
|
authParams = {};
|
|
1440
1439
|
}
|
|
1441
1440
|
|
|
1442
1441
|
if (params) {
|
|
1443
|
-
_get(_getPrototypeOf(Account.prototype), "authenticate", this).call(this, authParams, params)
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
}
|
|
1442
|
+
const response = await _get(_getPrototypeOf(Account.prototype), "authenticate", this).call(this, authParams, params);
|
|
1443
|
+
|
|
1444
|
+
if (response) {
|
|
1445
|
+
window.localStorage.setItem(STORAGE_TOKEN_KEY, response.token);
|
|
1446
|
+
window.localStorage.setItem(STORAGE_REFRESH_TOKEN_KEY, response.refreshToken);
|
|
1447
|
+
}
|
|
1449
1448
|
}
|
|
1450
1449
|
}
|
|
1451
1450
|
}, {
|
|
@@ -4683,6 +4682,13 @@ function isString(v) {
|
|
|
4683
4682
|
|
|
4684
4683
|
const addSubDomainToLocation = subDomain => window.location.protocol + "//" + subDomain + "." + window.location.host;
|
|
4685
4684
|
|
|
4685
|
+
const parseJwt = token => {
|
|
4686
|
+
const base64Url = token.split(".")[1];
|
|
4687
|
+
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
4688
|
+
const jsonPayload = decodeURIComponent(atob(base64).split("").map(c => "%" + "00".concat(c.charCodeAt(0).toString(16)).slice(-2)).join(""));
|
|
4689
|
+
return JSON.parse(jsonPayload);
|
|
4690
|
+
};
|
|
4691
|
+
|
|
4686
4692
|
function unique(value, index, array) {
|
|
4687
4693
|
return array.indexOf(value) === index;
|
|
4688
4694
|
}
|
|
@@ -7489,13 +7495,6 @@ let VectorTiles = /*#__PURE__*/function (_VectorTileService) {
|
|
|
7489
7495
|
return VectorTiles;
|
|
7490
7496
|
}(VectorTileService);
|
|
7491
7497
|
|
|
7492
|
-
const parseJwt = token => {
|
|
7493
|
-
const base64Url = token.split(".")[1];
|
|
7494
|
-
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
7495
|
-
const jsonPayload = decodeURIComponent(atob(base64).split("").map(c => "%" + "00".concat(c.charCodeAt(0).toString(16)).slice(-2)).join(""));
|
|
7496
|
-
return JSON.parse(jsonPayload);
|
|
7497
|
-
};
|
|
7498
|
-
|
|
7499
7498
|
var UrlPath;
|
|
7500
7499
|
|
|
7501
7500
|
(function (UrlPath) {
|
|
@@ -7540,23 +7539,12 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
|
|
|
7540
7539
|
timeout: false
|
|
7541
7540
|
}, httpOptions || {}, {
|
|
7542
7541
|
hooks: _extends({}, hooks || {}, {
|
|
7543
|
-
beforeRequest: [
|
|
7542
|
+
beforeRequest: [request => {
|
|
7544
7543
|
const token = window.localStorage.getItem(STORAGE_TOKEN_KEY);
|
|
7545
|
-
const refreshToken = window.localStorage.getItem(STORAGE_REFRESH_TOKEN_KEY);
|
|
7546
7544
|
|
|
7547
|
-
if (token
|
|
7545
|
+
if (token) {
|
|
7548
7546
|
var _request$headers;
|
|
7549
7547
|
|
|
7550
|
-
const {
|
|
7551
|
-
exp
|
|
7552
|
-
} = parseJwt(token) || {};
|
|
7553
|
-
|
|
7554
|
-
if (typeof exp === 'number' && exp - new Date().getTime() < 60 * 1000) {
|
|
7555
|
-
await _this.account.refreshToken({
|
|
7556
|
-
refreshToken
|
|
7557
|
-
});
|
|
7558
|
-
}
|
|
7559
|
-
|
|
7560
7548
|
(_request$headers = request.headers) == null ? void 0 : _request$headers.set('Authorization', "Bearer " + (token || ''));
|
|
7561
7549
|
}
|
|
7562
7550
|
}, ...((_hooks$beforeRequest = hooks == null ? void 0 : hooks.beforeRequest) != null ? _hooks$beforeRequest : [])],
|
|
@@ -7631,7 +7619,7 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
|
|
|
7631
7619
|
} = _ref2;
|
|
7632
7620
|
|
|
7633
7621
|
try {
|
|
7634
|
-
this.account.login(authParams, authQueryParams);
|
|
7622
|
+
await this.account.login(authParams, authQueryParams);
|
|
7635
7623
|
|
|
7636
7624
|
if (fetchUser) {
|
|
7637
7625
|
await this.account.fetchCurrentUser();
|
|
@@ -9067,5 +9055,5 @@ var TextVerticalAlignment;
|
|
|
9067
9055
|
TextVerticalAlignment["Middle"] = "middle";
|
|
9068
9056
|
})(TextVerticalAlignment || (TextVerticalAlignment = {}));
|
|
9069
9057
|
|
|
9070
|
-
export { Account, AccountPreview, AggregationFunction, Api, ApiEvent, AttributeIconType, AttributeSelectorType, AttributeType, AuthorizationGrant, BulkOperations, Cameras, CatalogResourceType, ClassificationType, ClassifyAttributeType, ClientSettings, ConfigurationErrorEnum, ConnectionStatus, DataSourceType, DependencyType, Eql, ErrorDetailsType, ErrorReason, ErrorType, EvergisDynamicLayer, EvergisTileLayer, External, FeatureType, Feedback, FileUpload, Filters, FontStyle, FontWeight, GEOCODE_PROVIDER, General, Geocode, GeometryType, Group, HttpClient, IceRouter, Import, Layers, LayersManager, LineCapStyle, LineEndingType, LineJoinType, Names, Namespace, Notification, NotificationEvent, Operation, OwnerFilter, PbfSchema, Permissions, PolicyType, PortalSettings, Print, Projects, Quality, ResourceCatalog, ResourceSeparator, ResourceSubTypeFilter, ResourceType, ResourceTypeFilter, ResourceTypeLink, Resources, ResponseType, Scheduler, Security, ServerTaskStatus, SimplifyType, SpatialProcessor, Statistic, StringSubType, Styles, Tables, TaskGroup, TextAlignment, TextVerticalAlignment, Tools, UrlPath, VectorTiles, addSubDomainToLocation, errorHandler, formDataFromFile, generateId, isEvergisDynamicLayer, isEvergisTileLayer, isFeatureLayer, isHTTPError, isHandledError, isLayer, isProjectContentItems, isString, isTileLayerService, promiseAllIgnoreErrors, stripUselessSlashes, toFormData, unique };
|
|
9058
|
+
export { Account, AccountPreview, AggregationFunction, Api, ApiEvent, AttributeIconType, AttributeSelectorType, AttributeType, AuthorizationGrant, BulkOperations, Cameras, CatalogResourceType, ClassificationType, ClassifyAttributeType, ClientSettings, ConfigurationErrorEnum, ConnectionStatus, DataSourceType, DependencyType, Eql, ErrorDetailsType, ErrorReason, ErrorType, EvergisDynamicLayer, EvergisTileLayer, External, FeatureType, Feedback, FileUpload, Filters, FontStyle, FontWeight, GEOCODE_PROVIDER, General, Geocode, GeometryType, Group, HttpClient, IceRouter, Import, Layers, LayersManager, LineCapStyle, LineEndingType, LineJoinType, Names, Namespace, Notification, NotificationEvent, Operation, OwnerFilter, PbfSchema, Permissions, PolicyType, PortalSettings, Print, Projects, Quality, ResourceCatalog, ResourceSeparator, ResourceSubTypeFilter, ResourceType, ResourceTypeFilter, ResourceTypeLink, Resources, ResponseType, STORAGE_REFRESH_TOKEN_KEY, STORAGE_TOKEN_KEY, Scheduler, Security, ServerTaskStatus, SimplifyType, SpatialProcessor, Statistic, StringSubType, Styles, Tables, TaskGroup, TextAlignment, TextVerticalAlignment, Tools, UrlPath, VectorTiles, addSubDomainToLocation, errorHandler, formDataFromFile, generateId, isEvergisDynamicLayer, isEvergisTileLayer, isFeatureLayer, isHTTPError, isHandledError, isLayer, isProjectContentItems, isString, isTileLayerService, parseJwt, promiseAllIgnoreErrors, stripUselessSlashes, toFormData, unique };
|
|
9071
9059
|
//# sourceMappingURL=api.esm.js.map
|