@uniformdev/tms-sdk 20.72.3-alpha.14 → 20.72.3-alpha.23

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/index.esm.js CHANGED
@@ -936,6 +936,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
936
936
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
937
937
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
938
938
  var defaultLimitPolicy = (0, import_p_limit.default)(6);
939
+ var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
939
940
  var ApiClientError = class _ApiClientError extends Error {
940
941
  constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
941
942
  super(
@@ -951,6 +952,12 @@ var ApiClientError = class _ApiClientError extends Error {
951
952
  Object.setPrototypeOf(this, _ApiClientError.prototype);
952
953
  }
953
954
  };
955
+ var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
956
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
957
+ super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
958
+ Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
959
+ }
960
+ };
954
961
  var ApiClient = class _ApiClient {
955
962
  constructor(options) {
956
963
  __publicField(this, "options");
@@ -984,7 +991,7 @@ var ApiClient = class _ApiClient {
984
991
  }
985
992
  async apiClientWithResponse(fetchUri, options) {
986
993
  return this.options.limitPolicy(async () => {
987
- var _a;
994
+ var _a, _b;
988
995
  const coreHeaders = this.options.apiKey ? {
989
996
  "x-api-key": this.options.apiKey
990
997
  } : {
@@ -1020,9 +1027,19 @@ var ApiClient = class _ApiClient {
1020
1027
  } catch (e) {
1021
1028
  message = `General error`;
1022
1029
  }
1030
+ if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
1031
+ throw new BearerTokenNotValidOrExpiredError(
1032
+ message,
1033
+ (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
1034
+ fetchUri.toString(),
1035
+ apiResponse.status,
1036
+ apiResponse.statusText,
1037
+ _ApiClient.getRequestId(apiResponse)
1038
+ );
1039
+ }
1023
1040
  throw new ApiClientError(
1024
1041
  message,
1025
- (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
1042
+ (_b = options == null ? void 0 : options.method) != null ? _b : "GET",
1026
1043
  fetchUri.toString(),
1027
1044
  apiResponse.status,
1028
1045
  apiResponse.statusText,
package/dist/index.js CHANGED
@@ -949,6 +949,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
949
949
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
950
950
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
951
951
  var defaultLimitPolicy = (0, import_p_limit.default)(6);
952
+ var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
952
953
  var ApiClientError = class _ApiClientError extends Error {
953
954
  constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
954
955
  super(
@@ -964,6 +965,12 @@ var ApiClientError = class _ApiClientError extends Error {
964
965
  Object.setPrototypeOf(this, _ApiClientError.prototype);
965
966
  }
966
967
  };
968
+ var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
969
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
970
+ super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
971
+ Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
972
+ }
973
+ };
967
974
  var ApiClient = class _ApiClient {
968
975
  constructor(options) {
969
976
  __publicField(this, "options");
@@ -997,7 +1004,7 @@ var ApiClient = class _ApiClient {
997
1004
  }
998
1005
  async apiClientWithResponse(fetchUri, options) {
999
1006
  return this.options.limitPolicy(async () => {
1000
- var _a;
1007
+ var _a, _b;
1001
1008
  const coreHeaders = this.options.apiKey ? {
1002
1009
  "x-api-key": this.options.apiKey
1003
1010
  } : {
@@ -1033,9 +1040,19 @@ var ApiClient = class _ApiClient {
1033
1040
  } catch (e) {
1034
1041
  message = `General error`;
1035
1042
  }
1043
+ if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
1044
+ throw new BearerTokenNotValidOrExpiredError(
1045
+ message,
1046
+ (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
1047
+ fetchUri.toString(),
1048
+ apiResponse.status,
1049
+ apiResponse.statusText,
1050
+ _ApiClient.getRequestId(apiResponse)
1051
+ );
1052
+ }
1036
1053
  throw new ApiClientError(
1037
1054
  message,
1038
- (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
1055
+ (_b = options == null ? void 0 : options.method) != null ? _b : "GET",
1039
1056
  fetchUri.toString(),
1040
1057
  apiResponse.status,
1041
1058
  apiResponse.statusText,
package/dist/index.mjs CHANGED
@@ -936,6 +936,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
936
936
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
937
937
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
938
938
  var defaultLimitPolicy = (0, import_p_limit.default)(6);
939
+ var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
939
940
  var ApiClientError = class _ApiClientError extends Error {
940
941
  constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
941
942
  super(
@@ -951,6 +952,12 @@ var ApiClientError = class _ApiClientError extends Error {
951
952
  Object.setPrototypeOf(this, _ApiClientError.prototype);
952
953
  }
953
954
  };
955
+ var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
956
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
957
+ super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
958
+ Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
959
+ }
960
+ };
954
961
  var ApiClient = class _ApiClient {
955
962
  constructor(options) {
956
963
  __publicField(this, "options");
@@ -984,7 +991,7 @@ var ApiClient = class _ApiClient {
984
991
  }
985
992
  async apiClientWithResponse(fetchUri, options) {
986
993
  return this.options.limitPolicy(async () => {
987
- var _a;
994
+ var _a, _b;
988
995
  const coreHeaders = this.options.apiKey ? {
989
996
  "x-api-key": this.options.apiKey
990
997
  } : {
@@ -1020,9 +1027,19 @@ var ApiClient = class _ApiClient {
1020
1027
  } catch (e) {
1021
1028
  message = `General error`;
1022
1029
  }
1030
+ if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
1031
+ throw new BearerTokenNotValidOrExpiredError(
1032
+ message,
1033
+ (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
1034
+ fetchUri.toString(),
1035
+ apiResponse.status,
1036
+ apiResponse.statusText,
1037
+ _ApiClient.getRequestId(apiResponse)
1038
+ );
1039
+ }
1023
1040
  throw new ApiClientError(
1024
1041
  message,
1025
- (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
1042
+ (_b = options == null ? void 0 : options.method) != null ? _b : "GET",
1026
1043
  fetchUri.toString(),
1027
1044
  apiResponse.status,
1028
1045
  apiResponse.statusText,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/tms-sdk",
3
- "version": "20.72.3-alpha.14+1e232e59cd",
3
+ "version": "20.72.3-alpha.23+cbe06f1e8a",
4
4
  "description": "Uniform Translation Management System SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -32,12 +32,12 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@uniformdev/canvas": "20.72.3-alpha.14+1e232e59cd",
36
- "@uniformdev/mesh-sdk": "20.72.3-alpha.14+1e232e59cd",
37
- "@uniformdev/richtext": "20.72.3-alpha.14+1e232e59cd",
35
+ "@uniformdev/canvas": "20.72.3-alpha.23+cbe06f1e8a",
36
+ "@uniformdev/mesh-sdk": "20.72.3-alpha.23+cbe06f1e8a",
37
+ "@uniformdev/richtext": "20.72.3-alpha.23+cbe06f1e8a",
38
38
  "dequal": "2.0.3",
39
39
  "fast-xml-parser": "4.5.5",
40
- "immer": "11.1.8"
40
+ "immer": "10.2.0"
41
41
  },
42
- "gitHead": "1e232e59cd3ded97b85b063986cc95e954b8c937"
42
+ "gitHead": "cbe06f1e8a5bb93b0e3cae6b1c8774f21c10506e"
43
43
  }