@livechat/developer-studio-api 2.3.37 → 2.3.39

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.d.mts CHANGED
@@ -1237,6 +1237,7 @@ interface PlatformAdapterClientInstanceAuthorization {
1237
1237
  vercel?: string;
1238
1238
  planetscale?: string;
1239
1239
  sentry?: string;
1240
+ openai?: string;
1240
1241
  }
1241
1242
  type PlatformAdapterClientInstanceOptions = PlatformAdapterClientInstanceAuthorization & {
1242
1243
  ensureAuthorizationToken?: {
@@ -1248,6 +1249,7 @@ type PlatformAdapterClientInstanceOptions = PlatformAdapterClientInstanceAuthori
1248
1249
  vercel?: boolean;
1249
1250
  planetscale?: boolean;
1250
1251
  sentry?: boolean;
1252
+ openai?: boolean;
1251
1253
  };
1252
1254
  };
1253
1255
  declare function getPlatformAdapterClientAuthorization(req: {
@@ -1267,6 +1269,7 @@ declare function initPlatformAdapterClientInstance(baseUrl?: string, tokens?: {
1267
1269
  vercel?: string;
1268
1270
  planetscale?: string;
1269
1271
  sentry?: string;
1272
+ openai?: string;
1270
1273
  }): void;
1271
1274
  declare function updatePlatformAdapterClientInstance(tokens?: {
1272
1275
  platform?: {
@@ -1280,6 +1283,7 @@ declare function updatePlatformAdapterClientInstance(tokens?: {
1280
1283
  vercel?: string;
1281
1284
  planetscale?: string;
1282
1285
  sentry?: string;
1286
+ openai?: string;
1283
1287
  }): void;
1284
1288
 
1285
1289
  interface ApplicationPaymentDto {
@@ -2279,7 +2283,7 @@ declare const api: {
2279
2283
  };
2280
2284
  webhooks: {
2281
2285
  updateAppWebhooks(appId: string, payload: UpdateApplicationWebhookPayload, authorization?: PlatformDpsClientInstanceAuthorization | undefined): Promise<void>;
2282
- getChatWebhook(appId: string, authorization?: PlatformDpsClientInstanceAuthorization | undefined): Promise<void>;
2286
+ getChatWebhook(appId: string, authorization?: PlatformDpsClientInstanceAuthorization | undefined): Promise<axios.AxiosResponse<any>>;
2283
2287
  updateChatWebhook(appId: string, payload: UpdateChatWebhookPayload, authorization?: PlatformDpsClientInstanceAuthorization | undefined): Promise<void>;
2284
2288
  deleteChatWebhook(appId: string, authorization?: PlatformDpsClientInstanceAuthorization | undefined): Promise<void>;
2285
2289
  };
@@ -2645,7 +2649,7 @@ declare const API_NOTIFICATIONS: {
2645
2649
  };
2646
2650
  };
2647
2651
 
2648
- type UnauthorizeApiErrorSource = "dps" | "github" | "vercel" | "netlify" | "sentry" | "planetscale";
2652
+ type UnauthorizeApiErrorSource = "dps" | "github" | "vercel" | "netlify" | "sentry" | "planetscale" | "openai";
2649
2653
  interface ApiError {
2650
2654
  message: string;
2651
2655
  }
package/dist/index.d.ts CHANGED
@@ -1237,6 +1237,7 @@ interface PlatformAdapterClientInstanceAuthorization {
1237
1237
  vercel?: string;
1238
1238
  planetscale?: string;
1239
1239
  sentry?: string;
1240
+ openai?: string;
1240
1241
  }
1241
1242
  type PlatformAdapterClientInstanceOptions = PlatformAdapterClientInstanceAuthorization & {
1242
1243
  ensureAuthorizationToken?: {
@@ -1248,6 +1249,7 @@ type PlatformAdapterClientInstanceOptions = PlatformAdapterClientInstanceAuthori
1248
1249
  vercel?: boolean;
1249
1250
  planetscale?: boolean;
1250
1251
  sentry?: boolean;
1252
+ openai?: boolean;
1251
1253
  };
1252
1254
  };
1253
1255
  declare function getPlatformAdapterClientAuthorization(req: {
@@ -1267,6 +1269,7 @@ declare function initPlatformAdapterClientInstance(baseUrl?: string, tokens?: {
1267
1269
  vercel?: string;
1268
1270
  planetscale?: string;
1269
1271
  sentry?: string;
1272
+ openai?: string;
1270
1273
  }): void;
1271
1274
  declare function updatePlatformAdapterClientInstance(tokens?: {
1272
1275
  platform?: {
@@ -1280,6 +1283,7 @@ declare function updatePlatformAdapterClientInstance(tokens?: {
1280
1283
  vercel?: string;
1281
1284
  planetscale?: string;
1282
1285
  sentry?: string;
1286
+ openai?: string;
1283
1287
  }): void;
1284
1288
 
1285
1289
  interface ApplicationPaymentDto {
@@ -2279,7 +2283,7 @@ declare const api: {
2279
2283
  };
2280
2284
  webhooks: {
2281
2285
  updateAppWebhooks(appId: string, payload: UpdateApplicationWebhookPayload, authorization?: PlatformDpsClientInstanceAuthorization | undefined): Promise<void>;
2282
- getChatWebhook(appId: string, authorization?: PlatformDpsClientInstanceAuthorization | undefined): Promise<void>;
2286
+ getChatWebhook(appId: string, authorization?: PlatformDpsClientInstanceAuthorization | undefined): Promise<axios.AxiosResponse<any>>;
2283
2287
  updateChatWebhook(appId: string, payload: UpdateChatWebhookPayload, authorization?: PlatformDpsClientInstanceAuthorization | undefined): Promise<void>;
2284
2288
  deleteChatWebhook(appId: string, authorization?: PlatformDpsClientInstanceAuthorization | undefined): Promise<void>;
2285
2289
  };
@@ -2645,7 +2649,7 @@ declare const API_NOTIFICATIONS: {
2645
2649
  };
2646
2650
  };
2647
2651
 
2648
- type UnauthorizeApiErrorSource = "dps" | "github" | "vercel" | "netlify" | "sentry" | "planetscale";
2652
+ type UnauthorizeApiErrorSource = "dps" | "github" | "vercel" | "netlify" | "sentry" | "planetscale" | "openai";
2649
2653
  interface ApiError {
2650
2654
  message: string;
2651
2655
  }
package/dist/index.js CHANGED
@@ -4271,7 +4271,7 @@ var platformDpsApplicationWebhooksApi = {
4271
4271
  getChatWebhook(appId, authorization) {
4272
4272
  return __async(this, null, function* () {
4273
4273
  try {
4274
- yield platformDpsClientInstance.get(
4274
+ return yield platformDpsClientInstance.get(
4275
4275
  `/v2/applications/${appId}/chat-webhooks`,
4276
4276
  getPlatformDpsClientConfig(authorization)
4277
4277
  );
@@ -4993,7 +4993,8 @@ function getPlatformAdapterClientAuthorization(req) {
4993
4993
  netlify: req.headers["netlify-token"],
4994
4994
  vercel: req.headers["vercel-token"],
4995
4995
  planetscale: req.headers["planetscale-token"],
4996
- sentry: req.headers["sentry-token"]
4996
+ sentry: req.headers["sentry-token"],
4997
+ openai: req.headers["openai-token"]
4997
4998
  };
4998
4999
  }
4999
5000
  var platformAdapterClientInstance = import_axios13.default.create({
@@ -5018,7 +5019,7 @@ platformAdapterClientInstance.interceptors.response.use(
5018
5019
  }
5019
5020
  );
5020
5021
  function getPlatformAdapterClientConfig(options = {}) {
5021
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
5022
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
5022
5023
  const currentHeaders = platformAdapterClientInstance.defaults.headers;
5023
5024
  const headers = {
5024
5025
  platform: {
@@ -5032,32 +5033,36 @@ function getPlatformAdapterClientConfig(options = {}) {
5032
5033
  netlify: (_g = currentHeaders["netlify-token"]) != null ? _g : options.netlify,
5033
5034
  vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
5034
5035
  planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
5035
- sentry: (_j = currentHeaders["sentry-token"]) != null ? _j : options.sentry
5036
+ sentry: (_j = currentHeaders["sentry-token"]) != null ? _j : options.sentry,
5037
+ openai: (_k = currentHeaders["openai-token"]) != null ? _k : options.openai
5036
5038
  }
5037
5039
  };
5038
5040
  if (currentHeaders["platform-dps-token"]) {
5039
- currentHeaders["X-Region"] = (_k = getRegion2(currentHeaders["platform-dps-token"])) != null ? _k : void 0;
5041
+ currentHeaders["X-Region"] = (_l = getRegion2(currentHeaders["platform-dps-token"])) != null ? _l : void 0;
5040
5042
  }
5041
- if (((_m = (_l = options.ensureAuthorizationToken) == null ? void 0 : _l.platform) == null ? void 0 : _m.dps) && !headers.platform.dps) {
5043
+ if (((_n = (_m = options.ensureAuthorizationToken) == null ? void 0 : _m.platform) == null ? void 0 : _n.dps) && !headers.platform.dps) {
5042
5044
  throw new UnauthorizeApiError("dps");
5043
5045
  }
5044
- if (((_n = options.ensureAuthorizationToken) == null ? void 0 : _n.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5046
+ if (((_o = options.ensureAuthorizationToken) == null ? void 0 : _o.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5045
5047
  throw new UnauthorizeApiError("github");
5046
5048
  }
5047
- if (((_o = options.ensureAuthorizationToken) == null ? void 0 : _o.vercel) && !headers.integrations.vercel) {
5049
+ if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.vercel) && !headers.integrations.vercel) {
5048
5050
  throw new UnauthorizeApiError("vercel");
5049
5051
  }
5050
- if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.netlify) && !headers.integrations.netlify) {
5052
+ if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.netlify) && !headers.integrations.netlify) {
5051
5053
  throw new UnauthorizeApiError("netlify");
5052
5054
  }
5053
- if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.planetscale) && !headers.integrations.planetscale) {
5055
+ if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.planetscale) && !headers.integrations.planetscale) {
5054
5056
  throw new UnauthorizeApiError("planetscale");
5055
5057
  }
5056
- if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.sentry) && !headers.integrations.sentry) {
5058
+ if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.sentry) && !headers.integrations.sentry) {
5057
5059
  throw new UnauthorizeApiError("sentry");
5058
5060
  }
5061
+ if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.openai) && !headers.integrations.openai) {
5062
+ throw new UnauthorizeApiError("openai");
5063
+ }
5059
5064
  return {
5060
- headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.dps ? { "platform-dps-token": headers.platform.dps } : {}), headers.integrations.github.app ? { "github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.sentry ? { "sentry-token": headers.integrations.sentry } : {})
5065
+ headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.dps ? { "platform-dps-token": headers.platform.dps } : {}), headers.integrations.github.app ? { "github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.sentry ? { "sentry-token": headers.integrations.sentry } : {}), headers.integrations.openai ? { "openai-token": headers.integrations.openai } : {})
5061
5066
  };
5062
5067
  }
5063
5068
  function initPlatformAdapterClientInstance(baseUrl, tokens) {
@@ -5098,6 +5103,9 @@ function updatePlatformAdapterClientInstance(tokens) {
5098
5103
  if (tokens == null ? void 0 : tokens.sentry) {
5099
5104
  headers["sentry-token"] = tokens.sentry;
5100
5105
  }
5106
+ if (tokens == null ? void 0 : tokens.openai) {
5107
+ headers["openai-token"] = tokens.openai;
5108
+ }
5101
5109
  }
5102
5110
 
5103
5111
  // src/apis/platform/adapter/app/blocks/deployment/api.ts
package/dist/index.mjs CHANGED
@@ -4180,7 +4180,7 @@ var platformDpsApplicationWebhooksApi = {
4180
4180
  getChatWebhook(appId, authorization) {
4181
4181
  return __async(this, null, function* () {
4182
4182
  try {
4183
- yield platformDpsClientInstance.get(
4183
+ return yield platformDpsClientInstance.get(
4184
4184
  `/v2/applications/${appId}/chat-webhooks`,
4185
4185
  getPlatformDpsClientConfig(authorization)
4186
4186
  );
@@ -4902,7 +4902,8 @@ function getPlatformAdapterClientAuthorization(req) {
4902
4902
  netlify: req.headers["netlify-token"],
4903
4903
  vercel: req.headers["vercel-token"],
4904
4904
  planetscale: req.headers["planetscale-token"],
4905
- sentry: req.headers["sentry-token"]
4905
+ sentry: req.headers["sentry-token"],
4906
+ openai: req.headers["openai-token"]
4906
4907
  };
4907
4908
  }
4908
4909
  var platformAdapterClientInstance = axios13.create({
@@ -4927,7 +4928,7 @@ platformAdapterClientInstance.interceptors.response.use(
4927
4928
  }
4928
4929
  );
4929
4930
  function getPlatformAdapterClientConfig(options = {}) {
4930
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
4931
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
4931
4932
  const currentHeaders = platformAdapterClientInstance.defaults.headers;
4932
4933
  const headers = {
4933
4934
  platform: {
@@ -4941,32 +4942,36 @@ function getPlatformAdapterClientConfig(options = {}) {
4941
4942
  netlify: (_g = currentHeaders["netlify-token"]) != null ? _g : options.netlify,
4942
4943
  vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
4943
4944
  planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
4944
- sentry: (_j = currentHeaders["sentry-token"]) != null ? _j : options.sentry
4945
+ sentry: (_j = currentHeaders["sentry-token"]) != null ? _j : options.sentry,
4946
+ openai: (_k = currentHeaders["openai-token"]) != null ? _k : options.openai
4945
4947
  }
4946
4948
  };
4947
4949
  if (currentHeaders["platform-dps-token"]) {
4948
- currentHeaders["X-Region"] = (_k = getRegion2(currentHeaders["platform-dps-token"])) != null ? _k : void 0;
4950
+ currentHeaders["X-Region"] = (_l = getRegion2(currentHeaders["platform-dps-token"])) != null ? _l : void 0;
4949
4951
  }
4950
- if (((_m = (_l = options.ensureAuthorizationToken) == null ? void 0 : _l.platform) == null ? void 0 : _m.dps) && !headers.platform.dps) {
4952
+ if (((_n = (_m = options.ensureAuthorizationToken) == null ? void 0 : _m.platform) == null ? void 0 : _n.dps) && !headers.platform.dps) {
4951
4953
  throw new UnauthorizeApiError("dps");
4952
4954
  }
4953
- if (((_n = options.ensureAuthorizationToken) == null ? void 0 : _n.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
4955
+ if (((_o = options.ensureAuthorizationToken) == null ? void 0 : _o.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
4954
4956
  throw new UnauthorizeApiError("github");
4955
4957
  }
4956
- if (((_o = options.ensureAuthorizationToken) == null ? void 0 : _o.vercel) && !headers.integrations.vercel) {
4958
+ if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.vercel) && !headers.integrations.vercel) {
4957
4959
  throw new UnauthorizeApiError("vercel");
4958
4960
  }
4959
- if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.netlify) && !headers.integrations.netlify) {
4961
+ if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.netlify) && !headers.integrations.netlify) {
4960
4962
  throw new UnauthorizeApiError("netlify");
4961
4963
  }
4962
- if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.planetscale) && !headers.integrations.planetscale) {
4964
+ if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.planetscale) && !headers.integrations.planetscale) {
4963
4965
  throw new UnauthorizeApiError("planetscale");
4964
4966
  }
4965
- if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.sentry) && !headers.integrations.sentry) {
4967
+ if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.sentry) && !headers.integrations.sentry) {
4966
4968
  throw new UnauthorizeApiError("sentry");
4967
4969
  }
4970
+ if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.openai) && !headers.integrations.openai) {
4971
+ throw new UnauthorizeApiError("openai");
4972
+ }
4968
4973
  return {
4969
- headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.dps ? { "platform-dps-token": headers.platform.dps } : {}), headers.integrations.github.app ? { "github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.sentry ? { "sentry-token": headers.integrations.sentry } : {})
4974
+ headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.dps ? { "platform-dps-token": headers.platform.dps } : {}), headers.integrations.github.app ? { "github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.sentry ? { "sentry-token": headers.integrations.sentry } : {}), headers.integrations.openai ? { "openai-token": headers.integrations.openai } : {})
4970
4975
  };
4971
4976
  }
4972
4977
  function initPlatformAdapterClientInstance(baseUrl, tokens) {
@@ -5007,6 +5012,9 @@ function updatePlatformAdapterClientInstance(tokens) {
5007
5012
  if (tokens == null ? void 0 : tokens.sentry) {
5008
5013
  headers["sentry-token"] = tokens.sentry;
5009
5014
  }
5015
+ if (tokens == null ? void 0 : tokens.openai) {
5016
+ headers["openai-token"] = tokens.openai;
5017
+ }
5010
5018
  }
5011
5019
 
5012
5020
  // src/apis/platform/adapter/app/blocks/deployment/api.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "2.3.37",
3
+ "version": "2.3.39",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -11,15 +11,16 @@
11
11
  "author": "",
12
12
  "license": "ISC",
13
13
  "dependencies": {
14
- "axios": "0.21.1"
14
+ "axios": "0.21.1",
15
+ "openai": "^4.24.2"
15
16
  },
16
17
  "devDependencies": {
17
18
  "@types/node": "^17.0.12",
18
19
  "tsup": "^7.1.0",
19
20
  "typescript": "^5.1.6",
20
21
  "config": "0.0.1",
21
- "eslint-config-custom": "0.0.2",
22
- "tsconfig": "0.0.1"
22
+ "tsconfig": "0.0.1",
23
+ "eslint-config-custom": "0.0.2"
23
24
  },
24
25
  "scripts": {
25
26
  "build": "tsup src/index.ts --format esm,cjs --dts",