@livechat/developer-studio-api 2.3.31 → 2.3.34

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.js CHANGED
@@ -4968,6 +4968,19 @@ var platformDpsApi = {
4968
4968
 
4969
4969
  // src/apis/platform/adapter/instance.ts
4970
4970
  var import_axios13 = __toESM(require("axios"));
4971
+ var REGION2 = {
4972
+ FRA: "fra",
4973
+ DAL: "dal",
4974
+ FRA_A: "fra-a",
4975
+ FRA_B: "fra-b"
4976
+ };
4977
+ var supportedRegions2 = Object.values(REGION2);
4978
+ var getRegion2 = (token) => {
4979
+ const region = token.split(":")[0];
4980
+ if (supportedRegions2.includes(region)) {
4981
+ return region;
4982
+ }
4983
+ };
4971
4984
  function getPlatformAdapterClientAuthorization(req) {
4972
4985
  return {
4973
4986
  platform: {
@@ -5005,7 +5018,7 @@ platformAdapterClientInstance.interceptors.response.use(
5005
5018
  }
5006
5019
  );
5007
5020
  function getPlatformAdapterClientConfig(options = {}) {
5008
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
5021
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
5009
5022
  const currentHeaders = platformAdapterClientInstance.defaults.headers;
5010
5023
  const headers = {
5011
5024
  platform: {
@@ -5022,22 +5035,25 @@ function getPlatformAdapterClientConfig(options = {}) {
5022
5035
  sentry: (_j = currentHeaders["sentry-token"]) != null ? _j : options.sentry
5023
5036
  }
5024
5037
  };
5025
- if (((_l = (_k = options.ensureAuthorizationToken) == null ? void 0 : _k.platform) == null ? void 0 : _l.dps) && !headers.platform.dps) {
5038
+ if (currentHeaders["platform-dps-token"]) {
5039
+ currentHeaders["X-Region"] = (_k = getRegion2(currentHeaders["platform-dps-token"])) != null ? _k : void 0;
5040
+ }
5041
+ if (((_m = (_l = options.ensureAuthorizationToken) == null ? void 0 : _l.platform) == null ? void 0 : _m.dps) && !headers.platform.dps) {
5026
5042
  throw new UnauthorizeApiError("dps");
5027
5043
  }
5028
- if (((_m = options.ensureAuthorizationToken) == null ? void 0 : _m.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5044
+ if (((_n = options.ensureAuthorizationToken) == null ? void 0 : _n.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5029
5045
  throw new UnauthorizeApiError("github");
5030
5046
  }
5031
- if (((_n = options.ensureAuthorizationToken) == null ? void 0 : _n.vercel) && !headers.integrations.vercel) {
5047
+ if (((_o = options.ensureAuthorizationToken) == null ? void 0 : _o.vercel) && !headers.integrations.vercel) {
5032
5048
  throw new UnauthorizeApiError("vercel");
5033
5049
  }
5034
- if (((_o = options.ensureAuthorizationToken) == null ? void 0 : _o.netlify) && !headers.integrations.netlify) {
5050
+ if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.netlify) && !headers.integrations.netlify) {
5035
5051
  throw new UnauthorizeApiError("netlify");
5036
5052
  }
5037
- if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.planetscale) && !headers.integrations.planetscale) {
5053
+ if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.planetscale) && !headers.integrations.planetscale) {
5038
5054
  throw new UnauthorizeApiError("planetscale");
5039
5055
  }
5040
- if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.sentry) && !headers.integrations.sentry) {
5056
+ if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.sentry) && !headers.integrations.sentry) {
5041
5057
  throw new UnauthorizeApiError("sentry");
5042
5058
  }
5043
5059
  return {
package/dist/index.mjs CHANGED
@@ -4877,6 +4877,19 @@ var platformDpsApi = {
4877
4877
 
4878
4878
  // src/apis/platform/adapter/instance.ts
4879
4879
  import axios13 from "axios";
4880
+ var REGION2 = {
4881
+ FRA: "fra",
4882
+ DAL: "dal",
4883
+ FRA_A: "fra-a",
4884
+ FRA_B: "fra-b"
4885
+ };
4886
+ var supportedRegions2 = Object.values(REGION2);
4887
+ var getRegion2 = (token) => {
4888
+ const region = token.split(":")[0];
4889
+ if (supportedRegions2.includes(region)) {
4890
+ return region;
4891
+ }
4892
+ };
4880
4893
  function getPlatformAdapterClientAuthorization(req) {
4881
4894
  return {
4882
4895
  platform: {
@@ -4914,7 +4927,7 @@ platformAdapterClientInstance.interceptors.response.use(
4914
4927
  }
4915
4928
  );
4916
4929
  function getPlatformAdapterClientConfig(options = {}) {
4917
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
4930
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
4918
4931
  const currentHeaders = platformAdapterClientInstance.defaults.headers;
4919
4932
  const headers = {
4920
4933
  platform: {
@@ -4931,22 +4944,25 @@ function getPlatformAdapterClientConfig(options = {}) {
4931
4944
  sentry: (_j = currentHeaders["sentry-token"]) != null ? _j : options.sentry
4932
4945
  }
4933
4946
  };
4934
- if (((_l = (_k = options.ensureAuthorizationToken) == null ? void 0 : _k.platform) == null ? void 0 : _l.dps) && !headers.platform.dps) {
4947
+ if (currentHeaders["platform-dps-token"]) {
4948
+ currentHeaders["X-Region"] = (_k = getRegion2(currentHeaders["platform-dps-token"])) != null ? _k : void 0;
4949
+ }
4950
+ if (((_m = (_l = options.ensureAuthorizationToken) == null ? void 0 : _l.platform) == null ? void 0 : _m.dps) && !headers.platform.dps) {
4935
4951
  throw new UnauthorizeApiError("dps");
4936
4952
  }
4937
- if (((_m = options.ensureAuthorizationToken) == null ? void 0 : _m.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
4953
+ if (((_n = options.ensureAuthorizationToken) == null ? void 0 : _n.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
4938
4954
  throw new UnauthorizeApiError("github");
4939
4955
  }
4940
- if (((_n = options.ensureAuthorizationToken) == null ? void 0 : _n.vercel) && !headers.integrations.vercel) {
4956
+ if (((_o = options.ensureAuthorizationToken) == null ? void 0 : _o.vercel) && !headers.integrations.vercel) {
4941
4957
  throw new UnauthorizeApiError("vercel");
4942
4958
  }
4943
- if (((_o = options.ensureAuthorizationToken) == null ? void 0 : _o.netlify) && !headers.integrations.netlify) {
4959
+ if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.netlify) && !headers.integrations.netlify) {
4944
4960
  throw new UnauthorizeApiError("netlify");
4945
4961
  }
4946
- if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.planetscale) && !headers.integrations.planetscale) {
4962
+ if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.planetscale) && !headers.integrations.planetscale) {
4947
4963
  throw new UnauthorizeApiError("planetscale");
4948
4964
  }
4949
- if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.sentry) && !headers.integrations.sentry) {
4965
+ if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.sentry) && !headers.integrations.sentry) {
4950
4966
  throw new UnauthorizeApiError("sentry");
4951
4967
  }
4952
4968
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "2.3.31",
3
+ "version": "2.3.34",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -17,9 +17,9 @@
17
17
  "@types/node": "^17.0.12",
18
18
  "tsup": "^7.1.0",
19
19
  "typescript": "^5.1.6",
20
+ "config": "0.0.1",
20
21
  "eslint-config-custom": "0.0.2",
21
- "tsconfig": "0.0.1",
22
- "config": "0.0.1"
22
+ "tsconfig": "0.0.1"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "tsup src/index.ts --format esm,cjs --dts",