@livechat/developer-studio-api 2.3.71 → 3.0.0-beta.2

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
@@ -68,8 +68,18 @@ var __async = (__this, __arguments, generator) => {
68
68
  var src_exports = {};
69
69
  __export(src_exports, {
70
70
  API_NOTIFICATIONS: () => API_NOTIFICATIONS,
71
+ AccountsApiError: () => AccountsApiError,
72
+ AdapterApiError: () => AdapterApiError,
73
+ ApiErrorBase: () => ApiErrorBase,
74
+ DpsApiError: () => DpsApiError,
71
75
  UnauthorizeApiError: () => UnauthorizeApiError,
76
+ allAppTemplates: () => allAppTemplates,
72
77
  api: () => api,
78
+ appBaseTemplates: () => appBaseTemplates,
79
+ appRepositoryTemplates: () => appRepositoryTemplates,
80
+ appRepositoryTemplatesMap: () => appRepositoryTemplatesMap,
81
+ appTemplates: () => appTemplates,
82
+ appTemplatesMap: () => appTemplatesMap,
73
83
  getAppAutoReviewPayload: () => getAppAutoReviewPayload,
74
84
  getEmptyAppAutoReview: () => getEmptyAppAutoReview,
75
85
  getGitHubClientAuthorization: () => getGitHubClientAuthorization,
@@ -86,14 +96,13 @@ __export(src_exports, {
86
96
  getPlatformAccountsClientConfig: () => getPlatformAccountsClientConfig,
87
97
  getPlatformAdapterClientAuthorization: () => getPlatformAdapterClientAuthorization,
88
98
  getPlatformAdapterClientConfig: () => getPlatformAdapterClientConfig,
99
+ getPlatformAdapterClientDefaultConfig: () => getPlatformAdapterClientDefaultConfig,
89
100
  getPlatformBillingClientAuthorization: () => getPlatformBillingClientAuthorization,
90
101
  getPlatformBillingClientConfig: () => getPlatformBillingClientConfig,
91
102
  getPlatformDpsAdminClientAuthorization: () => getPlatformDpsAdminClientAuthorization,
92
103
  getPlatformDpsClientAuthorization: () => getPlatformDpsClientAuthorization,
93
104
  getPlatformDpsClientConfig: () => getPlatformDpsClientConfig,
94
105
  getRegion: () => getRegion,
95
- getSentryClientAuthorization: () => getSentryClientAuthorization,
96
- getSentryClientConfig: () => getSentryClientConfig,
97
106
  getTextClientAuthorization: () => getTextClientAuthorization,
98
107
  getTextClientConfig: () => getTextClientConfig,
99
108
  getVercelClientAuthorization: () => getVercelClientAuthorization,
@@ -109,7 +118,6 @@ __export(src_exports, {
109
118
  initPlatformAdapterClientInstance: () => initPlatformAdapterClientInstance,
110
119
  initPlatformBillingClientInstance: () => initPlatformBillingClientInstance,
111
120
  initPlatformDpsClientInstance: () => initPlatformDpsClientInstance,
112
- initSentryClientInstance: () => initSentryClientInstance,
113
121
  initTextClientInstance: () => initTextClientInstance,
114
122
  initVercelClientInstance: () => initVercelClientInstance,
115
123
  livechatClientInstance: () => livechatClientInstance,
@@ -120,14 +128,12 @@ __export(src_exports, {
120
128
  platformAdapterClientInstance: () => platformAdapterClientInstance,
121
129
  platformBillingClientInstance: () => platformBillingClientInstance,
122
130
  platformDpsClientInstance: () => platformDpsClientInstance,
123
- sentryClientInstance: () => sentryClientInstance,
124
131
  textClientInstance: () => textClientInstance,
125
132
  updateGithubClientInstance: () => updateGithubClientInstance,
126
133
  updateNeonClientInstance: () => updateNeonClientInstance,
127
134
  updateNetlifyClientInstance: () => updateNetlifyClientInstance,
128
135
  updatePlanetScaleClientInstance: () => updatePlanetScaleClientInstance,
129
136
  updatePlatformAdapterClientInstance: () => updatePlatformAdapterClientInstance,
130
- updateSentryClientInstance: () => updateSentryClientInstance,
131
137
  updateVercelClientInstance: () => updateVercelClientInstance,
132
138
  vercelClientInstance: () => vercelClientInstance
133
139
  });
@@ -201,20 +207,6 @@ var PLANETSCALE_CONFIG = {
201
207
  }
202
208
  };
203
209
 
204
- // ../../private/config/src/integrations/sentry.ts
205
- var SENTRY_CONFIG = {
206
- github_app_client_name: "sentry-io",
207
- app: process.env.NEXT_PUBLIC_PLATFORM_ENV === "prod" ? {
208
- client_id: "8c8296fe87cb446e9ded22f8b6f4b078363500062155476490d4583b5406d30a",
209
- client_secret: process.env.SENTRY_CLIENT_SECRET,
210
- redirect_uri: "https://platform.text.com/console-adapter/integrations/sentry/callbacks/oauth"
211
- } : {
212
- client_id: "d35803a39bab43b3b6dbe0b89cb99dc54689c35a74dd442baaef0f5b9b0d70bc",
213
- client_secret: process.env.SENTRY_CLIENT_SECRET_LABS,
214
- redirect_uri: "https://platform.labs.text.com/console-adapter/integrations/sentry/callbacks/oauth"
215
- }
216
- };
217
-
218
210
  // ../../private/config/src/integrations/vercel.ts
219
211
  var VERCEL_CONFIG = {
220
212
  github_app_client_name: "vercel",
@@ -235,10 +227,25 @@ var VERCEL_CONFIG = {
235
227
  var import_axios = __toESM(require("axios"));
236
228
 
237
229
  // src/types/errors/api.ts
230
+ var ApiErrorBase = class extends Error {
231
+ constructor(message, data, code) {
232
+ super(message);
233
+ this.message = message;
234
+ this.data = data;
235
+ this.code = code;
236
+ this.kind = "error";
237
+ }
238
+ withCustomMessage(message) {
239
+ return new this.constructor(message, this.data, this.code);
240
+ }
241
+ };
238
242
  var UnauthorizeApiError = class extends Error {
239
- constructor(source) {
240
- super("Unauthorized API call");
243
+ constructor(source, message = "Unauthorized API call") {
244
+ super(message);
241
245
  this.source = source;
246
+ this.message = message;
247
+ this.kind = "unauthorized";
248
+ this.code = 401;
242
249
  }
243
250
  };
244
251
 
@@ -373,13 +380,9 @@ var gitHubRepositoryApi = {
373
380
  ensureAuthorizationToken: true
374
381
  })
375
382
  );
376
- const branch = response.data.find(
383
+ return response.data.find(
377
384
  (innerBranch) => innerBranch.name === repositoryBranch
378
385
  );
379
- if (!branch) {
380
- throw new Error("Branch not found");
381
- }
382
- return branch;
383
386
  });
384
387
  },
385
388
  getRepositorySeed(repositoryName, authorization) {
@@ -835,25 +838,6 @@ var netlifyAccountApi = {
835
838
  }
836
839
  });
837
840
  },
838
- addAccountSentryTokenEnv(siteId, token, authorization) {
839
- return __async(this, null, function* () {
840
- const accounts = yield netlifyClientInstance.get(
841
- `/accounts`,
842
- getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
843
- ensureAuthorizationToken: true
844
- }))
845
- );
846
- const accountId = accounts.data[0].id;
847
- yield this.createAccountEnv(
848
- accountId,
849
- siteId,
850
- "SENTRY_AUTH_TOKEN",
851
- token,
852
- void 0,
853
- authorization
854
- );
855
- });
856
- },
857
841
  removeAccountEnv(accountId, siteId, envKey, authorization) {
858
842
  return __async(this, null, function* () {
859
843
  let targetAccountId = accountId;
@@ -1017,23 +1001,20 @@ var netlifySiteApi = {
1017
1001
  },
1018
1002
  createSiteByInstallationId(name, repositoryFullName, target, installationId, branch, authorization) {
1019
1003
  return __async(this, null, function* () {
1020
- const config = (
1021
- // eslint-disable-next-line no-nested-ternary -- fix me
1022
- target === "nextjs" ? {
1023
- plugins: ["@netlify/plugin-nextjs"],
1024
- packages: [{ package: "@netlify/plugin-nextjs" }],
1025
- dir: ".next",
1026
- cmd: "npm run build"
1027
- } : target === "node" ? {
1028
- plugins: [],
1029
- dir: "dist",
1030
- cmd: "npm run build"
1031
- } : {
1032
- plugin: [],
1033
- dir: ".",
1034
- cmd: ""
1035
- }
1036
- );
1004
+ const config = target === "nextjs" ? {
1005
+ plugins: ["@netlify/plugin-nextjs"],
1006
+ packages: [{ package: "@netlify/plugin-nextjs" }],
1007
+ dir: ".next",
1008
+ cmd: "npm run build"
1009
+ } : target === "node" ? {
1010
+ plugins: [],
1011
+ dir: "dist",
1012
+ cmd: "npm run build"
1013
+ } : {
1014
+ plugin: [],
1015
+ dir: ".",
1016
+ cmd: ""
1017
+ };
1037
1018
  const response = yield netlifyClientInstance.post(
1038
1019
  `/sites`,
1039
1020
  {
@@ -1064,22 +1045,19 @@ var netlifySiteApi = {
1064
1045
  },
1065
1046
  createSiteByDeployKey(name, repositoryFullName, target, deployKeyId, branch, authorization) {
1066
1047
  return __async(this, null, function* () {
1067
- const config = (
1068
- // eslint-disable-next-line no-nested-ternary -- fix me
1069
- target === "nextjs" ? {
1070
- packages: [{ package: "@netlify/plugin-nextjs" }],
1071
- dir: ".next",
1072
- cmd: "npm run build"
1073
- } : target === "node" ? {
1074
- packages: [],
1075
- dir: "dist",
1076
- cmd: "npm run build"
1077
- } : {
1078
- packages: [],
1079
- dir: ".",
1080
- cmd: ""
1081
- }
1082
- );
1048
+ const config = target === "nextjs" ? {
1049
+ packages: [{ package: "@netlify/plugin-nextjs" }],
1050
+ dir: ".next",
1051
+ cmd: "npm run build"
1052
+ } : target === "node" ? {
1053
+ packages: [],
1054
+ dir: "dist",
1055
+ cmd: "npm run build"
1056
+ } : {
1057
+ packages: [],
1058
+ dir: ".",
1059
+ cmd: ""
1060
+ };
1083
1061
  const response = yield netlifyClientInstance.post(
1084
1062
  `/sites`,
1085
1063
  {
@@ -1155,84 +1133,6 @@ var netlifySiteApi = {
1155
1133
  }))
1156
1134
  );
1157
1135
  });
1158
- },
1159
- addSentryPluginToSite(siteId, projectOrg, projectName, projectKey, token, authorization) {
1160
- return __async(this, null, function* () {
1161
- yield netlifyClientInstance.put(
1162
- `/sites/${siteId}`,
1163
- {
1164
- plugins: [
1165
- {
1166
- package: "@netlify/plugin-nextjs"
1167
- },
1168
- {
1169
- package: "@sentry/netlify-build-plugin"
1170
- }
1171
- ]
1172
- },
1173
- getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1174
- ensureAuthorizationToken: true
1175
- }))
1176
- );
1177
- const accountId = yield netlifyAccountApi.getAccount(authorization);
1178
- if (!accountId) {
1179
- throw new Error("Account is missing");
1180
- }
1181
- const snippets = yield this.getSiteSnippets(siteId, authorization);
1182
- const envs = yield netlifyAccountApi.getAccountEnvs(
1183
- accountId,
1184
- siteId,
1185
- authorization
1186
- );
1187
- if (token) {
1188
- yield netlifyAccountApi.createAccountEnv(
1189
- accountId,
1190
- siteId,
1191
- "SENTRY_AUTH_TOKEN",
1192
- token,
1193
- envs,
1194
- authorization
1195
- );
1196
- }
1197
- yield netlifyAccountApi.createAccountEnv(
1198
- accountId,
1199
- siteId,
1200
- "SENTRY_ORG",
1201
- projectOrg,
1202
- envs,
1203
- authorization
1204
- );
1205
- yield netlifyAccountApi.createAccountEnv(
1206
- accountId,
1207
- siteId,
1208
- "SENTRY_PROJECT",
1209
- projectName,
1210
- envs,
1211
- authorization
1212
- );
1213
- const currentSnippet = snippets.find(
1214
- (snippet) => snippet.title === "sentry"
1215
- );
1216
- if (currentSnippet) {
1217
- yield netlifyClientInstance.delete(
1218
- `sites/${siteId}/snippets/${currentSnippet.id}`,
1219
- getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1220
- ensureAuthorizationToken: true
1221
- }))
1222
- );
1223
- }
1224
- yield netlifyClientInstance.post(
1225
- `sites/${siteId}/snippets`,
1226
- {
1227
- general_position: "footer",
1228
- title: "sentry",
1229
- general: `<script src='https://js.sentry-cdn.com/${projectKey}.min.js' crossorigin="anonymous"></script>`
1230
- },
1231
- getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1232
- ensureAuthorizationToken: true
1233
- }))
1234
- );
1235
- });
1236
1136
  }
1237
1137
  };
1238
1138
 
@@ -1471,286 +1371,9 @@ var planetscaleApi = {
1471
1371
  }
1472
1372
  };
1473
1373
 
1474
- // src/apis/integrations/sentry/instance.ts
1475
- var import_axios6 = __toESM(require("axios"));
1476
- var sentryClientInstance = import_axios6.default.create({
1477
- baseURL: "https://sentry.io/api/0/",
1478
- headers: {
1479
- "Content-Type": "application/json"
1480
- }
1481
- });
1482
- sentryClientInstance.interceptors.response.use(
1483
- (r) => r,
1484
- (error) => {
1485
- var _a;
1486
- if (import_axios6.default.isAxiosError(error)) {
1487
- if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
1488
- throw new UnauthorizeApiError("sentry");
1489
- }
1490
- }
1491
- throw error;
1492
- }
1493
- );
1494
- function getSentryClientAuthorization(req) {
1495
- return {
1496
- token: req.headers["sentry-token"]
1497
- };
1498
- }
1499
- function getSentryClientConfig(options = {}) {
1500
- const currentHeaders = sentryClientInstance.defaults.headers;
1501
- const defaultAuthorization = currentHeaders.Authorization;
1502
- const headers = {
1503
- authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
1504
- };
1505
- if (options.ensureAuthorizationToken && !headers.authorization) {
1506
- throw new UnauthorizeApiError("sentry");
1507
- }
1508
- return {
1509
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
1510
- };
1511
- }
1512
- function initSentryClientInstance(token) {
1513
- updateSentryClientInstance(token);
1514
- if (token) {
1515
- updateSentryClientInstance(token);
1516
- }
1517
- }
1518
- function updateSentryClientInstance(token) {
1519
- const headers = sentryClientInstance.defaults.headers;
1520
- if (token) {
1521
- headers.Authorization = `Bearer ${token}`;
1522
- } else {
1523
- delete headers.Authorization;
1524
- }
1525
- }
1526
-
1527
- // src/apis/integrations/sentry/api.ts
1528
- var sentryApi = {
1529
- getTeam(teamSlug, authorization) {
1530
- return __async(this, null, function* () {
1531
- const response = yield sentryClientInstance.get(
1532
- `/teams/${teamSlug}/`,
1533
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1534
- ensureAuthorizationToken: true
1535
- }))
1536
- );
1537
- return response.data;
1538
- });
1539
- },
1540
- getOrganizations(authorization) {
1541
- return __async(this, null, function* () {
1542
- const response = yield sentryClientInstance.get(
1543
- "/organizations/",
1544
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1545
- ensureAuthorizationToken: true
1546
- }))
1547
- );
1548
- return response.data;
1549
- });
1550
- },
1551
- getOrganization(organizationSlug, authorization) {
1552
- return __async(this, null, function* () {
1553
- const response = yield sentryClientInstance.get(
1554
- `/organizations/${organizationSlug}/`,
1555
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1556
- ensureAuthorizationToken: true
1557
- }))
1558
- );
1559
- return response.data;
1560
- });
1561
- },
1562
- getOrganizationRepos(organizationSlug, authorization) {
1563
- return __async(this, null, function* () {
1564
- const response = yield sentryClientInstance.get(
1565
- `/organizations/${organizationSlug}/repos/`,
1566
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1567
- ensureAuthorizationToken: true
1568
- }))
1569
- );
1570
- return response.data;
1571
- });
1572
- },
1573
- getOrganizationIntegrations(organizationSlug, authorization) {
1574
- return __async(this, null, function* () {
1575
- const response = yield sentryClientInstance.get(
1576
- `/organizations/${organizationSlug}/integrations/`,
1577
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1578
- ensureAuthorizationToken: true
1579
- }))
1580
- );
1581
- return response.data;
1582
- });
1583
- },
1584
- getProjects(authorization) {
1585
- return __async(this, null, function* () {
1586
- const response = yield sentryClientInstance.get(
1587
- "/projects/",
1588
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1589
- ensureAuthorizationToken: true
1590
- }))
1591
- );
1592
- return response.data;
1593
- });
1594
- },
1595
- getProject(projectFullName, authorization) {
1596
- return __async(this, null, function* () {
1597
- const response = yield sentryClientInstance.get(
1598
- `/projects/${projectFullName}/`,
1599
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1600
- ensureAuthorizationToken: true
1601
- }))
1602
- );
1603
- return response.data;
1604
- });
1605
- },
1606
- getProjectIssues(projectFullName, authorization) {
1607
- return __async(this, null, function* () {
1608
- const response = yield sentryClientInstance.get(
1609
- `/projects/${projectFullName}/issues/`,
1610
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1611
- ensureAuthorizationToken: true
1612
- }))
1613
- );
1614
- return response.data;
1615
- });
1616
- },
1617
- getProjectIssueLatestEvent(issueId, authorization) {
1618
- return __async(this, null, function* () {
1619
- const response = yield sentryClientInstance.get(
1620
- `/issues/${issueId}/events/latest/`,
1621
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1622
- ensureAuthorizationToken: true
1623
- }))
1624
- );
1625
- return response.data;
1626
- });
1627
- },
1628
- getProjectKeys(projectFullName, authorization) {
1629
- return __async(this, null, function* () {
1630
- const response = yield sentryClientInstance.get(
1631
- `/projects/${projectFullName}/keys/`,
1632
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1633
- ensureAuthorizationToken: true
1634
- }))
1635
- );
1636
- return response.data;
1637
- });
1638
- },
1639
- createTeam(organizationSlug, teamName, authorization) {
1640
- return __async(this, null, function* () {
1641
- const { data: team } = yield sentryClientInstance.post(
1642
- `/organizations/${organizationSlug}/teams/`,
1643
- {
1644
- name: teamName,
1645
- slug: teamName
1646
- },
1647
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1648
- ensureAuthorizationToken: true
1649
- }))
1650
- );
1651
- return team;
1652
- });
1653
- },
1654
- createRepo(organizationSlug, projectId, repositoryFullName, repositoryBranch, githubIntegrationId, authorization) {
1655
- return __async(this, null, function* () {
1656
- var _a, _b;
1657
- let repository;
1658
- try {
1659
- const response = yield sentryClientInstance.post(
1660
- `/organizations/${organizationSlug}/repos/`,
1661
- {
1662
- installation: githubIntegrationId,
1663
- identifier: repositoryFullName,
1664
- provider: "integrations:github"
1665
- },
1666
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1667
- ensureAuthorizationToken: true
1668
- }))
1669
- );
1670
- repository = response.data;
1671
- } catch (err) {
1672
- const error = err;
1673
- if (((_a = error.response) == null ? void 0 : _a.data.error_type) === "validation" || ((_b = error.response) == null ? void 0 : _b.data.error_type) === "unknown") {
1674
- throw error;
1675
- }
1676
- const response = yield sentryClientInstance.get(
1677
- `/organizations/${organizationSlug}/repos/`,
1678
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1679
- ensureAuthorizationToken: true
1680
- }))
1681
- );
1682
- repository = response.data.find(
1683
- (repo) => repo.externalSlug === repositoryFullName
1684
- );
1685
- }
1686
- if (!repository) {
1687
- throw new Error("Couldn't get repository");
1688
- }
1689
- try {
1690
- yield sentryClientInstance.post(
1691
- `/organizations/${organizationSlug}/code-mappings/`,
1692
- {
1693
- defaultBranch: repositoryBranch,
1694
- stackRoot: "",
1695
- sourceRoot: "",
1696
- repositoryId: repository.id,
1697
- integrationId: githubIntegrationId,
1698
- projectId
1699
- },
1700
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1701
- ensureAuthorizationToken: true
1702
- }))
1703
- );
1704
- } catch (e) {
1705
- }
1706
- });
1707
- },
1708
- createProject(organizationSlug, appName, authorization) {
1709
- return __async(this, null, function* () {
1710
- var _a;
1711
- const name = appName.toLowerCase();
1712
- try {
1713
- yield this.createTeam(organizationSlug, name, authorization);
1714
- } catch (e) {
1715
- }
1716
- try {
1717
- const response = yield sentryClientInstance.post(
1718
- `/teams/${organizationSlug}/${name}/projects/`,
1719
- {
1720
- name,
1721
- slug: name
1722
- },
1723
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1724
- ensureAuthorizationToken: true
1725
- }))
1726
- );
1727
- return yield this.getProject(
1728
- `${organizationSlug}/${response.data.slug}`,
1729
- authorization
1730
- );
1731
- } catch (error) {
1732
- if (((_a = error.response) == null ? void 0 : _a.status) === 409) {
1733
- return this.getProject(`${organizationSlug}/${name}`, authorization);
1734
- }
1735
- throw error;
1736
- }
1737
- });
1738
- },
1739
- deleteProject(projectFullName, authorization) {
1740
- return __async(this, null, function* () {
1741
- yield sentryClientInstance.delete(
1742
- `/projects/${projectFullName}/`,
1743
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1744
- ensureAuthorizationToken: true
1745
- }))
1746
- );
1747
- });
1748
- }
1749
- };
1750
-
1751
1374
  // src/apis/integrations/text/instance.ts
1752
- var import_axios7 = __toESM(require("axios"));
1753
- var textClientInstance = import_axios7.default.create({
1375
+ var import_axios6 = __toESM(require("axios"));
1376
+ var textClientInstance = import_axios6.default.create({
1754
1377
  baseURL: "https://api.labs.text.com"
1755
1378
  });
1756
1379
  function getTextClientAuthorization(req) {
@@ -2153,18 +1776,18 @@ var textApi = {
2153
1776
  };
2154
1777
 
2155
1778
  // src/apis/integrations/vercel/api.ts
2156
- var import_axios9 = __toESM(require("axios"));
1779
+ var import_axios8 = __toESM(require("axios"));
2157
1780
 
2158
1781
  // src/apis/integrations/vercel/instance.ts
2159
- var import_axios8 = __toESM(require("axios"));
2160
- var vercelClientInstance = import_axios8.default.create({
1782
+ var import_axios7 = __toESM(require("axios"));
1783
+ var vercelClientInstance = import_axios7.default.create({
2161
1784
  baseURL: "https://api.vercel.com"
2162
1785
  });
2163
1786
  vercelClientInstance.interceptors.response.use(
2164
1787
  (r) => r,
2165
1788
  (error) => {
2166
1789
  var _a, _b;
2167
- if (import_axios8.default.isAxiosError(error)) {
1790
+ if (import_axios7.default.isAxiosError(error)) {
2168
1791
  if (((_a = error.response) == null ? void 0 : _a.status) === 401 || ((_b = error.response) == null ? void 0 : _b.status) === 403) {
2169
1792
  throw new UnauthorizeApiError("vercel");
2170
1793
  }
@@ -2453,7 +2076,7 @@ var vercelApi = {
2453
2076
  client_secret: clientSecret,
2454
2077
  redirect_uri: redirectUrl
2455
2078
  });
2456
- const response = yield import_axios9.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
2079
+ const response = yield import_axios8.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
2457
2080
  headers: {
2458
2081
  "Content-Type": "application/x-www-form-urlencoded"
2459
2082
  }
@@ -2469,18 +2092,18 @@ var vercelApi = {
2469
2092
  };
2470
2093
 
2471
2094
  // src/apis/integrations/neon/api.ts
2472
- var import_axios11 = __toESM(require("axios"));
2095
+ var import_axios10 = __toESM(require("axios"));
2473
2096
 
2474
2097
  // src/apis/integrations/neon/instance.ts
2475
- var import_axios10 = __toESM(require("axios"));
2476
- var neonClientInstance = import_axios10.default.create({
2098
+ var import_axios9 = __toESM(require("axios"));
2099
+ var neonClientInstance = import_axios9.default.create({
2477
2100
  baseURL: "https://console.neon.tech/api/v2/"
2478
2101
  });
2479
2102
  neonClientInstance.interceptors.response.use(
2480
2103
  (r) => r,
2481
2104
  (error) => {
2482
2105
  var _a;
2483
- if (import_axios10.default.isAxiosError(error)) {
2106
+ if (import_axios9.default.isAxiosError(error)) {
2484
2107
  if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2485
2108
  throw new UnauthorizeApiError("neon");
2486
2109
  }
@@ -2693,7 +2316,7 @@ var neonApi = {
2693
2316
  redirect_uri: redirectUri,
2694
2317
  grant_type: "authorization_code"
2695
2318
  });
2696
- const response = yield import_axios11.default.post(
2319
+ const response = yield import_axios10.default.post(
2697
2320
  "https://oauth2.neon.tech/oauth2/token",
2698
2321
  data,
2699
2322
  {
@@ -2718,7 +2341,7 @@ var neonApi = {
2718
2341
  client_secret: clientSecret,
2719
2342
  grant_type: "refresh_token"
2720
2343
  });
2721
- const response = yield import_axios11.default.post("https://oauth2.neon.tech/oauth2/token", data, {
2344
+ const response = yield import_axios10.default.post("https://oauth2.neon.tech/oauth2/token", data, {
2722
2345
  headers: {
2723
2346
  "Content-Type": "application/x-www-form-urlencoded"
2724
2347
  }
@@ -2739,12 +2362,11 @@ var integrationsApi = {
2739
2362
  vercel: vercelApi,
2740
2363
  neon: neonApi,
2741
2364
  planetscale: planetscaleApi,
2742
- sentry: sentryApi,
2743
2365
  text: textApi
2744
2366
  };
2745
2367
 
2746
2368
  // src/apis/products/livechat/instance.ts
2747
- var import_axios12 = __toESM(require("axios"));
2369
+ var import_axios11 = __toESM(require("axios"));
2748
2370
  var REGION = {
2749
2371
  FRA: "fra",
2750
2372
  DAL: "dal",
@@ -2758,7 +2380,7 @@ var getRegion = (token) => {
2758
2380
  return region;
2759
2381
  }
2760
2382
  };
2761
- var livechatClientInstance = import_axios12.default.create({
2383
+ var livechatClientInstance = import_axios11.default.create({
2762
2384
  baseURL: "https://api.labs.livechatinc.com"
2763
2385
  });
2764
2386
  function getLiveChatClientAuthorization(req) {
@@ -3256,17 +2878,39 @@ var productsApi = {
3256
2878
  };
3257
2879
 
3258
2880
  // src/apis/platform/accounts/instance.ts
3259
- var import_axios13 = __toESM(require("axios"));
3260
- var platformAccountsClientInstance = import_axios13.default.create({
2881
+ var import_axios12 = __toESM(require("axios"));
2882
+ var AccountsApiError = class extends ApiErrorBase {
2883
+ constructor() {
2884
+ super(...arguments);
2885
+ this.name = "accounts";
2886
+ }
2887
+ };
2888
+ var platformAccountsClientInstance = import_axios12.default.create({
3261
2889
  baseURL: "https://accounts.labs.livechatinc.com"
3262
2890
  });
2891
+ platformAccountsClientInstance.interceptors.response.use(
2892
+ (response) => response,
2893
+ (error) => {
2894
+ var _a, _b, _c, _d;
2895
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2896
+ return Promise.reject(new UnauthorizeApiError("accounts"));
2897
+ }
2898
+ return Promise.reject(
2899
+ new AccountsApiError(
2900
+ error.message,
2901
+ (_b = error.response) == null ? void 0 : _b.data,
2902
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
2903
+ )
2904
+ );
2905
+ }
2906
+ );
3263
2907
  function getPlatformAccountsClientAuthorization(req) {
3264
2908
  return {
3265
2909
  token: req.headers["platform-accounts-token"]
3266
2910
  };
3267
2911
  }
3268
2912
  function getPlatformAccountsClientConfig(options = {}) {
3269
- const defaultAuthorization = platformAccountsClientInstance.defaults.headers["Authorization"];
2913
+ const defaultAuthorization = platformAccountsClientInstance.defaults.headers.Authorization;
3270
2914
  const headers = {
3271
2915
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
3272
2916
  };
@@ -3277,17 +2921,17 @@ function getPlatformAccountsClientConfig(options = {}) {
3277
2921
  function initPlatformAccountsClientInstance(baseUrl, token) {
3278
2922
  if (baseUrl) {
3279
2923
  platformAccountsClientInstance.interceptors.request.use(
3280
- (config) => __async(this, null, function* () {
2924
+ (config) => {
3281
2925
  config.baseURL = baseUrl;
3282
2926
  return config;
3283
- }),
2927
+ },
3284
2928
  (error) => Promise.reject(error)
3285
2929
  );
3286
2930
  }
3287
2931
  if (token) {
3288
- platformAccountsClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
2932
+ platformAccountsClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
3289
2933
  } else {
3290
- delete platformAccountsClientInstance.defaults.headers["Authorization"];
2934
+ delete platformAccountsClientInstance.defaults.headers.Authorization;
3291
2935
  }
3292
2936
  }
3293
2937
 
@@ -3295,50 +2939,32 @@ function initPlatformAccountsClientInstance(baseUrl, token) {
3295
2939
  var platformAccountsAccountApi = {
3296
2940
  getAccounts(authorization) {
3297
2941
  return __async(this, null, function* () {
3298
- try {
3299
- return yield platformAccountsClientInstance.get(
3300
- `/v2/accounts`,
3301
- getPlatformAccountsClientConfig(authorization)
3302
- );
3303
- } catch (error) {
3304
- if (error instanceof Error) {
3305
- throw new Error(`Accounts couldn't be fetched. [${error.message}]`);
3306
- } else {
3307
- throw error;
3308
- }
3309
- }
2942
+ return platformAccountsClientInstance.get(
2943
+ `/v2/accounts`,
2944
+ getPlatformAccountsClientConfig(authorization)
2945
+ ).catch((error) => {
2946
+ throw error.withCustomMessage("Accounts couldn't be fetched.");
2947
+ });
3310
2948
  });
3311
2949
  },
3312
2950
  getAccount(accountId, authorization) {
3313
2951
  return __async(this, null, function* () {
3314
- try {
3315
- return yield platformAccountsClientInstance.get(
3316
- `/v2/accounts/${accountId}`,
3317
- getPlatformAccountsClientConfig(authorization)
3318
- );
3319
- } catch (error) {
3320
- if (error instanceof Error) {
3321
- throw new Error(`Account couldn't be fetched. [${error.message}]`);
3322
- } else {
3323
- throw error;
3324
- }
3325
- }
2952
+ return platformAccountsClientInstance.get(
2953
+ `/v2/accounts/${accountId}`,
2954
+ getPlatformAccountsClientConfig(authorization)
2955
+ ).catch((error) => {
2956
+ throw error.withCustomMessage("Account couldn't be fetched.");
2957
+ });
3326
2958
  });
3327
2959
  },
3328
2960
  getMeAccount(authorization) {
3329
2961
  return __async(this, null, function* () {
3330
- try {
3331
- return yield platformAccountsClientInstance.get(
3332
- `/v2/accounts/me`,
3333
- getPlatformAccountsClientConfig(authorization)
3334
- );
3335
- } catch (error) {
3336
- if (error instanceof Error) {
3337
- throw new Error(`Account couldn't be fetched. [${error.message}]`);
3338
- } else {
3339
- throw error;
3340
- }
3341
- }
2962
+ return platformAccountsClientInstance.get(
2963
+ `/v2/accounts/me`,
2964
+ getPlatformAccountsClientConfig(authorization)
2965
+ ).catch((error) => {
2966
+ throw error.withCustomMessage("Account couldn't be fetched.");
2967
+ });
3342
2968
  });
3343
2969
  }
3344
2970
  };
@@ -3347,141 +2973,90 @@ var platformAccountsAccountApi = {
3347
2973
  var platformAccountsClientApi = {
3348
2974
  getClients(authorization) {
3349
2975
  return __async(this, null, function* () {
3350
- try {
3351
- return yield platformAccountsClientInstance.get(
3352
- `/v2/clients`,
3353
- getPlatformAccountsClientConfig(authorization)
3354
- );
3355
- } catch (error) {
3356
- if (error instanceof Error) {
3357
- throw new Error(`Clients couldn't be fetched. [${error.message}]`);
3358
- } else {
3359
- throw error;
3360
- }
3361
- }
2976
+ return platformAccountsClientInstance.get(
2977
+ `/v2/clients`,
2978
+ getPlatformAccountsClientConfig(authorization)
2979
+ ).catch((error) => {
2980
+ throw error.withCustomMessage("Clients couldn't be fetched.");
2981
+ });
3362
2982
  });
3363
2983
  },
3364
2984
  getClient(clientId, authorization) {
3365
2985
  return __async(this, null, function* () {
3366
- try {
3367
- return yield platformAccountsClientInstance.get(
3368
- `/v2/clients/${clientId}`,
3369
- getPlatformAccountsClientConfig(authorization)
3370
- );
3371
- } catch (error) {
3372
- if (error instanceof Error) {
3373
- throw new Error(`Client couldn't be fetched. [${error.message}]`);
3374
- } else {
3375
- throw error;
3376
- }
3377
- }
2986
+ return platformAccountsClientInstance.get(
2987
+ `/v2/clients/${clientId}`,
2988
+ getPlatformAccountsClientConfig(authorization)
2989
+ ).catch((error) => {
2990
+ throw error.withCustomMessage("Client couldn't be fetched.");
2991
+ });
3378
2992
  });
3379
2993
  },
3380
2994
  createClient(payload, authorization) {
3381
2995
  return __async(this, null, function* () {
3382
- try {
3383
- return yield platformAccountsClientInstance.post(
3384
- `/v2/clients`,
3385
- payload,
3386
- getPlatformAccountsClientConfig(authorization)
3387
- );
3388
- } catch (error) {
3389
- if (error instanceof Error) {
3390
- throw new Error(`Client couldn't be created. [${error.message}]`);
3391
- } else {
3392
- throw error;
3393
- }
3394
- }
2996
+ return platformAccountsClientInstance.post(
2997
+ `/v2/clients`,
2998
+ payload,
2999
+ getPlatformAccountsClientConfig(authorization)
3000
+ ).catch((error) => {
3001
+ throw error.withCustomMessage("Client couldn't be created.");
3002
+ });
3395
3003
  });
3396
3004
  },
3397
3005
  updateClient(clientId, payload, authorization) {
3398
3006
  return __async(this, null, function* () {
3399
- try {
3400
- return yield platformAccountsClientInstance.patch(
3401
- `/v2/clients/${clientId}`,
3402
- payload,
3403
- getPlatformAccountsClientConfig(authorization)
3404
- );
3405
- } catch (error) {
3406
- if (error instanceof Error) {
3407
- throw new Error(`Client couldn't be updated. [${error.message}]`);
3408
- } else {
3409
- throw error;
3410
- }
3411
- }
3007
+ return platformAccountsClientInstance.patch(
3008
+ `/v2/clients/${clientId}`,
3009
+ payload,
3010
+ getPlatformAccountsClientConfig(authorization)
3011
+ ).catch((error) => {
3012
+ throw error.withCustomMessage("Client couldn't be updated.");
3013
+ });
3412
3014
  });
3413
3015
  },
3414
3016
  deleteClient(clientId, authorization) {
3415
3017
  return __async(this, null, function* () {
3416
- try {
3417
- return yield platformAccountsClientInstance.delete(
3418
- `/v2/clients/${clientId}`,
3419
- getPlatformAccountsClientConfig(authorization)
3420
- );
3421
- } catch (error) {
3422
- if (error instanceof Error) {
3423
- throw new Error(`Client couldn't be deleted. [${error.message}]`);
3424
- } else {
3425
- throw error;
3426
- }
3427
- }
3018
+ return platformAccountsClientInstance.delete(
3019
+ `/v2/clients/${clientId}`,
3020
+ getPlatformAccountsClientConfig(authorization)
3021
+ ).catch((error) => {
3022
+ throw error.withCustomMessage("Clients couldn't be deleted.");
3023
+ });
3428
3024
  });
3429
3025
  },
3430
3026
  updateClientScopes(clientId, scopes, authorization) {
3431
3027
  return __async(this, null, function* () {
3432
- try {
3433
- return yield platformAccountsClientInstance.put(
3434
- `/v2/clients/${clientId}/scopes`,
3435
- scopes.map((scope) => ({
3436
- scope: scope.scope,
3437
- required: scope.required
3438
- })),
3439
- getPlatformAccountsClientConfig(authorization)
3440
- );
3441
- } catch (error) {
3442
- if (error instanceof Error) {
3443
- throw new Error(`Scopes couldn't be updated. [${error.message}]`);
3444
- } else {
3445
- throw error;
3446
- }
3447
- }
3028
+ return platformAccountsClientInstance.put(
3029
+ `/v2/clients/${clientId}/scopes`,
3030
+ scopes.map((scope) => ({
3031
+ scope: scope.scope,
3032
+ required: scope.required
3033
+ })),
3034
+ getPlatformAccountsClientConfig(authorization)
3035
+ ).catch((error) => {
3036
+ throw error.withCustomMessage("Client scopes couldn't be updated.");
3037
+ });
3448
3038
  });
3449
3039
  },
3450
3040
  deleteClientScopes(clientId, scopes, authorization) {
3451
3041
  return __async(this, null, function* () {
3452
- try {
3453
- return yield platformAccountsClientInstance.delete(
3454
- `/v2/clients/${clientId}/scopes`,
3455
- __spreadValues({
3456
- data: scopes.map((scope) => ({
3457
- scope: scope.scope,
3458
- required: scope.required
3459
- }))
3460
- }, getPlatformAccountsClientConfig(authorization))
3461
- );
3462
- } catch (error) {
3463
- if (error instanceof Error) {
3464
- throw new Error(`Scopes couldn't be updated. [${error.message}]`);
3465
- } else {
3466
- throw error;
3467
- }
3468
- }
3042
+ return platformAccountsClientInstance.delete(`/v2/clients/${clientId}/scopes`, __spreadValues({
3043
+ data: scopes.map((scope) => ({
3044
+ scope: scope.scope,
3045
+ required: scope.required
3046
+ }))
3047
+ }, getPlatformAccountsClientConfig(authorization))).catch((error) => {
3048
+ throw error.withCustomMessage("Client scopes couldn't be deleted.");
3049
+ });
3469
3050
  });
3470
3051
  },
3471
3052
  getInfo(authorization) {
3472
3053
  return __async(this, null, function* () {
3473
- try {
3474
- return yield platformAccountsClientInstance.get(
3475
- `/v2/info`,
3476
- getPlatformAccountsClientConfig(authorization)
3477
- );
3478
- } catch (error) {
3479
- if (error instanceof Error) {
3480
- throw new Error(`Info couldn't be fetched. [${error.message}]`);
3481
- } else {
3482
- throw error;
3483
- }
3484
- }
3054
+ return platformAccountsClientInstance.get(
3055
+ `/v2/info`,
3056
+ getPlatformAccountsClientConfig(authorization)
3057
+ ).catch((error) => {
3058
+ throw error.withCustomMessage("Client info couldn't be fetched.");
3059
+ });
3485
3060
  });
3486
3061
  }
3487
3062
  };
@@ -3490,34 +3065,22 @@ var platformAccountsClientApi = {
3490
3065
  var platformAccountsOrganizationApi = {
3491
3066
  getOrganizations(authorization) {
3492
3067
  return __async(this, null, function* () {
3493
- try {
3494
- const response = yield platformAccountsClientInstance.get(`/v2/organizations`, getPlatformAccountsClientConfig(authorization));
3495
- return response.data || [];
3496
- } catch (error) {
3497
- if (error instanceof Error) {
3498
- throw new Error(
3499
- `Organizations couldn't be fetched. [${error.message}]`
3500
- );
3501
- } else {
3502
- throw error;
3503
- }
3504
- }
3068
+ return platformAccountsClientInstance.get(
3069
+ `/v2/organizations`,
3070
+ getPlatformAccountsClientConfig(authorization)
3071
+ ).catch((error) => {
3072
+ throw error.withCustomMessage("Organizations couldn't be fetched.");
3073
+ });
3505
3074
  });
3506
3075
  },
3507
3076
  getMyOrganization(authorization) {
3508
3077
  return __async(this, null, function* () {
3509
- try {
3510
- return yield platformAccountsClientInstance.get(
3511
- `/v2/organizations/my`,
3512
- getPlatformAccountsClientConfig(authorization)
3513
- );
3514
- } catch (error) {
3515
- if (error instanceof Error) {
3516
- throw new Error(`Organization couldn't be fetched. [${error.message}]`);
3517
- } else {
3518
- throw error;
3519
- }
3520
- }
3078
+ return platformAccountsClientInstance.get(
3079
+ `/v2/organizations/my`,
3080
+ getPlatformAccountsClientConfig(authorization)
3081
+ ).catch((error) => {
3082
+ throw error.withCustomMessage("Organization couldn't be fetched.");
3083
+ });
3521
3084
  });
3522
3085
  }
3523
3086
  };
@@ -3526,62 +3089,39 @@ var platformAccountsOrganizationApi = {
3526
3089
  var platformAccountsPersonalAccessTokenApi = {
3527
3090
  getPersonalAccessTokens(authorization) {
3528
3091
  return __async(this, null, function* () {
3529
- try {
3530
- const response = yield platformAccountsClientInstance.get(
3531
- `/v2/personal_token`,
3532
- __spreadValues({}, getPlatformAccountsClientConfig(authorization))
3092
+ return platformAccountsClientInstance.get(`/v2/personal_token`, __spreadValues({}, getPlatformAccountsClientConfig(authorization))).catch((error) => {
3093
+ throw error.withCustomMessage(
3094
+ "Personal Access Tokens couldn't be fetched."
3533
3095
  );
3534
- return response.data;
3535
- } catch (error) {
3536
- if (error instanceof Error) {
3537
- throw new Error(
3538
- `Personal Access Token couldn't be fetched. [${error.message}]`
3539
- );
3540
- } else {
3541
- throw error;
3542
- }
3543
- }
3096
+ });
3544
3097
  });
3545
3098
  },
3546
3099
  createPersonalAccessToken(name, scopes, authorization) {
3547
3100
  return __async(this, null, function* () {
3548
- try {
3549
- const response = yield platformAccountsClientInstance.post(
3550
- `/v2/personal_token`,
3551
- {
3552
- name,
3553
- scope: scopes && scopes.map((item) => item.name).filter((el) => el).join(",")
3554
- },
3555
- getPlatformAccountsClientConfig(authorization)
3101
+ return platformAccountsClientInstance.post(
3102
+ `/v2/personal_token`,
3103
+ {
3104
+ name,
3105
+ scope: scopes.map((item) => item.name).filter((el) => el).join(",")
3106
+ },
3107
+ getPlatformAccountsClientConfig(authorization)
3108
+ ).catch((error) => {
3109
+ throw error.withCustomMessage(
3110
+ "Personal Access Tokens couldn't be created."
3556
3111
  );
3557
- return response.data;
3558
- } catch (error) {
3559
- if (error instanceof Error) {
3560
- throw new Error(
3561
- `Personal Access Token couldn't be created. [${error.message}]`
3562
- );
3563
- } else {
3564
- throw error;
3565
- }
3566
- }
3112
+ });
3567
3113
  });
3568
3114
  },
3569
3115
  deletePersonalAccessToken(id, authorization) {
3570
3116
  return __async(this, null, function* () {
3571
- try {
3572
- yield platformAccountsClientInstance.delete(
3573
- `/v2/personal_token/${id}`,
3574
- getPlatformAccountsClientConfig(authorization)
3117
+ return platformAccountsClientInstance.delete(
3118
+ `/v2/personal_token/${id}`,
3119
+ getPlatformAccountsClientConfig(authorization)
3120
+ ).catch((error) => {
3121
+ throw error.withCustomMessage(
3122
+ "Personal Access Tokens couldn't be deleted."
3575
3123
  );
3576
- } catch (error) {
3577
- if (error instanceof Error) {
3578
- throw new Error(
3579
- `Personal Access Token couldn't be deleted. [${error.message}]`
3580
- );
3581
- } else {
3582
- throw error;
3583
- }
3584
- }
3124
+ });
3585
3125
  });
3586
3126
  }
3587
3127
  };
@@ -3590,37 +3130,23 @@ var platformAccountsPersonalAccessTokenApi = {
3590
3130
  var platformAccountsProductsApi = {
3591
3131
  getOrganizationProducts(authorization) {
3592
3132
  return __async(this, null, function* () {
3593
- try {
3594
- const response = yield platformAccountsClientInstance.get(
3595
- `/v2/organizations/my/products`,
3596
- getPlatformAccountsClientConfig(authorization)
3597
- );
3598
- return response.data;
3599
- } catch (error) {
3600
- if (error instanceof Error) {
3601
- throw new Error(`Products couldn't be fetched. [${error.message}]`);
3602
- } else {
3603
- throw error;
3604
- }
3605
- }
3133
+ return platformAccountsClientInstance.get(
3134
+ `/v2/organizations/my/products`,
3135
+ getPlatformAccountsClientConfig(authorization)
3136
+ ).catch((error) => {
3137
+ throw error.withCustomMessage("Products couldn't be fetched.");
3138
+ });
3606
3139
  });
3607
3140
  },
3608
3141
  updateOrganizationProducts(payload, authorization) {
3609
3142
  return __async(this, null, function* () {
3610
- try {
3611
- const response = yield platformAccountsClientInstance.post(
3612
- `/v2/organizations/my/products`,
3613
- payload,
3614
- getPlatformAccountsClientConfig(authorization)
3615
- );
3616
- return response.data;
3617
- } catch (error) {
3618
- if (error instanceof Error) {
3619
- throw new Error(`Products couldn't be updated. [${error.message}]`);
3620
- } else {
3621
- throw error;
3622
- }
3623
- }
3143
+ return platformAccountsClientInstance.post(
3144
+ `/v2/organizations/my/products`,
3145
+ payload,
3146
+ getPlatformAccountsClientConfig(authorization)
3147
+ ).catch((error) => {
3148
+ throw error.withCustomMessage("Products couldn't be updated.");
3149
+ });
3624
3150
  });
3625
3151
  }
3626
3152
  };
@@ -3629,19 +3155,12 @@ var platformAccountsProductsApi = {
3629
3155
  var platformAccountsScopesApi = {
3630
3156
  getScopes(authorization) {
3631
3157
  return __async(this, null, function* () {
3632
- try {
3633
- const response = yield platformAccountsClientInstance.get(
3634
- `/v2/scopes`,
3635
- getPlatformAccountsClientConfig(authorization)
3636
- );
3637
- return response.data || [];
3638
- } catch (error) {
3639
- if (error instanceof Error) {
3640
- throw new Error(`Scopes couldn't be fetched. [${error.message}]`);
3641
- } else {
3642
- throw error;
3643
- }
3644
- }
3158
+ return platformAccountsClientInstance.get(
3159
+ `/v2/scopes`,
3160
+ getPlatformAccountsClientConfig(authorization)
3161
+ ).catch((error) => {
3162
+ throw error.withCustomMessage("Scopes couldn't be fetched.");
3163
+ });
3645
3164
  });
3646
3165
  }
3647
3166
  };
@@ -3650,18 +3169,12 @@ var platformAccountsScopesApi = {
3650
3169
  var platformAccountsSessionsApi = {
3651
3170
  deleteSessions(authorization) {
3652
3171
  return __async(this, null, function* () {
3653
- try {
3654
- return yield platformAccountsClientInstance.delete(
3655
- `/v2/sessions`,
3656
- getPlatformAccountsClientConfig(authorization)
3657
- );
3658
- } catch (error) {
3659
- if (error instanceof Error) {
3660
- throw new Error(`Sessions couldn't be deleted. [${error.message}]`);
3661
- } else {
3662
- throw error;
3663
- }
3664
- }
3172
+ return platformAccountsClientInstance.delete(
3173
+ `/v2/sessions`,
3174
+ getPlatformAccountsClientConfig(authorization)
3175
+ ).catch((error) => {
3176
+ throw error.withCustomMessage("Sessions couldn't be fetched.");
3177
+ });
3665
3178
  });
3666
3179
  }
3667
3180
  };
@@ -3677,23 +3190,13 @@ var platformAccountsTokenApi = {
3677
3190
  client_secret: clientSecret,
3678
3191
  redirect_uri: redirectUrl
3679
3192
  });
3680
- try {
3681
- return yield platformAccountsClientInstance.post(
3682
- `/v2/token`,
3683
- data,
3684
- {
3685
- headers: {
3686
- "Content-Type": "application/x-www-form-urlencoded"
3687
- }
3688
- }
3689
- );
3690
- } catch (error) {
3691
- if (error instanceof Error) {
3692
- throw new Error(`Couldn't exchange code for token. [${error.message}]`);
3693
- } else {
3694
- throw error;
3193
+ return platformAccountsClientInstance.post(`/v2/token`, data, {
3194
+ headers: {
3195
+ "Content-Type": "application/x-www-form-urlencoded"
3695
3196
  }
3696
- }
3197
+ }).catch((error) => {
3198
+ throw error.withCustomMessage("Couldn't exchange code for token.");
3199
+ });
3697
3200
  });
3698
3201
  }
3699
3202
  };
@@ -3711,10 +3214,32 @@ var platformAccountsApi = {
3711
3214
  };
3712
3215
 
3713
3216
  // src/apis/platform/dps/instance.ts
3714
- var import_axios14 = __toESM(require("axios"));
3715
- var platformDpsClientInstance = import_axios14.default.create({
3217
+ var import_axios13 = __toESM(require("axios"));
3218
+ var DpsApiError = class extends ApiErrorBase {
3219
+ constructor() {
3220
+ super(...arguments);
3221
+ this.name = "dps";
3222
+ }
3223
+ };
3224
+ var platformDpsClientInstance = import_axios13.default.create({
3716
3225
  baseURL: "https://dev-platform.labs.livechatinc.com"
3717
3226
  });
3227
+ platformDpsClientInstance.interceptors.response.use(
3228
+ (response) => response,
3229
+ (error) => {
3230
+ var _a, _b, _c, _d;
3231
+ if (((_a = error.response) == null ? void 0 : _a.status) === 403) {
3232
+ return Promise.reject(new UnauthorizeApiError("accounts"));
3233
+ }
3234
+ return Promise.reject(
3235
+ new DpsApiError(
3236
+ error.message,
3237
+ (_b = error.response) == null ? void 0 : _b.data,
3238
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
3239
+ )
3240
+ );
3241
+ }
3242
+ );
3718
3243
  function getPlatformDpsClientAuthorization(req) {
3719
3244
  var _a;
3720
3245
  return {
@@ -3777,6 +3302,23 @@ var platformDpsApplicationAuthorizationApi = {
3777
3302
  throw error;
3778
3303
  }
3779
3304
  });
3305
+ },
3306
+ deleteAuth(appId, authorization) {
3307
+ return __async(this, null, function* () {
3308
+ try {
3309
+ yield platformDpsClientInstance.delete(
3310
+ `/v2/applications/${appId}/authorization`,
3311
+ getPlatformDpsClientConfig(authorization)
3312
+ );
3313
+ } catch (error) {
3314
+ if (error instanceof Error) {
3315
+ throw new Error(
3316
+ `Authorization couldn't be created. [${error.message}]`
3317
+ );
3318
+ }
3319
+ throw error;
3320
+ }
3321
+ });
3780
3322
  }
3781
3323
  };
3782
3324
 
@@ -3886,24 +3428,227 @@ var platformDpsApplicationAutoReviewApi = {
3886
3428
  }
3887
3429
  };
3888
3430
 
3889
- // src/apis/platform/dps/applications/application/chatActions/api.ts
3890
- var platformDpsApplicationChatActionsApi = {
3891
- createChatAction(appId, payload, authorization) {
3892
- return __async(this, null, function* () {
3893
- try {
3894
- yield platformDpsClientInstance.put(
3895
- `/v2/applications/${appId}/chat-actions/${payload.id}`,
3896
- payload,
3897
- getPlatformDpsClientConfig(authorization)
3898
- );
3899
- } catch (error) {
3900
- if (error instanceof Error) {
3901
- throw new Error(
3902
- `${API_NOTIFICATIONS.BUILDING_BLOCKS.FAILURE.CREATED} [${error.message}]`
3903
- );
3904
- }
3905
- throw error;
3906
- }
3431
+ // src/constants/app/templates/repository.ts
3432
+ var appRepositoryTemplatesMap = {
3433
+ "livechat/developer-app-template-nextjs": "nextjs",
3434
+ "livechat/developer-app-template-vite": "vite",
3435
+ "livechat/developer-app-template-saas": "saas"
3436
+ };
3437
+ var appRepositoryTemplates = {
3438
+ nextjs: {
3439
+ id: "nextjs",
3440
+ description: "Uses the most popular and versatile features from our SDKs:",
3441
+ tags: ["Auth", "Webhooks", "Agent App SDK", "Moments"],
3442
+ name: "Fullstack Next.js template",
3443
+ repository: {
3444
+ name: "livechat/developer-app-template-nextjs",
3445
+ target: "nextjs"
3446
+ }
3447
+ },
3448
+ vite: {
3449
+ id: "vite",
3450
+ name: "Vite template",
3451
+ description: "Implements the same base functionalities as the Next.js template except for webhooks:",
3452
+ tags: ["Auth", "Agent App SDK", "Moments"],
3453
+ repository: {
3454
+ name: "livechat/developer-app-template-vite",
3455
+ target: "node"
3456
+ }
3457
+ },
3458
+ saas: {
3459
+ id: "saas",
3460
+ name: "saas",
3461
+ description: "saas",
3462
+ tags: [],
3463
+ repository: {
3464
+ name: "livechat/developer-app-template-saas",
3465
+ target: "nextjs"
3466
+ }
3467
+ }
3468
+ };
3469
+
3470
+ // src/constants/app/templates/app.ts
3471
+ var appTemplatesMap = {
3472
+ "livechat/developer-app-template-saas": "saas"
3473
+ };
3474
+ var appBaseTemplates = {
3475
+ "tag-master": {
3476
+ id: "tag-master",
3477
+ name: "Tag Master",
3478
+ category: { name: "Agent App Widget" },
3479
+ description: "Create, view, and delete tags and canned responses in an easy and predictable way.",
3480
+ tags: ["Accounts SDK", "NextJS", "Configuration API"],
3481
+ link: "https://github.com/bstopyra/tag-master-template",
3482
+ icons: {},
3483
+ repository: {
3484
+ name: "bstopyra/tag-master-template",
3485
+ target: "node"
3486
+ }
3487
+ },
3488
+ progress: {
3489
+ id: "progress",
3490
+ name: "Progress",
3491
+ category: { name: "Agent App Widget" },
3492
+ description: "Creates reports based on data from chats: ratings, chatting time, response time.",
3493
+ tags: ["Accounts SDK", "NextJS", "Reports API"],
3494
+ link: "https://github.com/livechat/progress-app",
3495
+ icons: {},
3496
+ repository: {
3497
+ name: "livechat/progress-app",
3498
+ target: "node"
3499
+ }
3500
+ },
3501
+ supervisor: {
3502
+ id: "supervisor",
3503
+ name: "Supervisor",
3504
+ category: { name: "Agent App Widget" },
3505
+ description: "Monitor statistics of your team, such as chat ratings, response times, and chatting times.",
3506
+ tags: ["Accounts SDK", "NextJS", "Reports API"],
3507
+ link: "https://github.com/livechat/supervisor-app",
3508
+ icons: {},
3509
+ repository: {
3510
+ name: "livechat/supervisor-app",
3511
+ target: "node"
3512
+ }
3513
+ },
3514
+ popup: {
3515
+ id: "popup",
3516
+ name: "Popup app",
3517
+ category: { name: "Agent App Widget" },
3518
+ description: "Learn the ropes of the popup authorization flow from the Accounts SDK.",
3519
+ tags: ["Accounts SDK", "Popup flow", "Widget"],
3520
+ link: "https://github.com/livechat/sample-app-popup-auth",
3521
+ icons: {},
3522
+ repository: {
3523
+ name: "livechat/sample-app-popup-auth",
3524
+ target: "node"
3525
+ }
3526
+ },
3527
+ redirect: {
3528
+ id: "redirect",
3529
+ name: "Redirect app",
3530
+ category: { name: "Agent App Widget" },
3531
+ description: "See how to implement the redirect authorization flow from the Accounts SDK.",
3532
+ tags: ["Accounts SDK", "Redirect flow", "Widget"],
3533
+ link: "https://github.com/livechat/sample-app-redirect-auth",
3534
+ icons: {},
3535
+ repository: {
3536
+ name: "livechat/sample-app-redirect-auth",
3537
+ target: "node"
3538
+ }
3539
+ }
3540
+ };
3541
+ var appTemplates = {
3542
+ saas: {
3543
+ id: "saas",
3544
+ name: "Nextjs SaaS boilerplate",
3545
+ category: { name: "Agent App Widget" },
3546
+ description: "CRM-like app with key-value storage and simple UI. Authorization and payments fully set up.",
3547
+ tags: ["UI", "Auth", "Storage", "Payments", "Analytics"],
3548
+ template: true,
3549
+ manifest: {
3550
+ name: "Nextjs SaaS boilerplate",
3551
+ product: "livechat",
3552
+ blocks: {
3553
+ repository: {
3554
+ provider: "github",
3555
+ name: "livechat/developer-app-template-saas",
3556
+ branch: "main",
3557
+ target: "nextjs"
3558
+ },
3559
+ deployment: {
3560
+ provider: "netlify",
3561
+ url: ""
3562
+ },
3563
+ // storage: {
3564
+ // provider: "neon",
3565
+ // databaseName: "",
3566
+ // isSeeded: false,
3567
+ // },
3568
+ authorization: {
3569
+ scopes: [
3570
+ { scope: "properties.configuration:rw", required: true },
3571
+ {
3572
+ scope: "properties.license.value--all:rw",
3573
+ required: true
3574
+ }
3575
+ ],
3576
+ type: "javascript_app",
3577
+ redirectUri: "/"
3578
+ },
3579
+ widgets: {
3580
+ "chat-details": {
3581
+ placement: "plugin",
3582
+ url: "/livechat/chat-details"
3583
+ },
3584
+ fullscreen: {
3585
+ placement: "fullscreen",
3586
+ url: "/livechat/fullscreen"
3587
+ }
3588
+ },
3589
+ properties: {
3590
+ "123-456-789": {
3591
+ type: "string",
3592
+ default_value: "Mike;mike@yahoo.com",
3593
+ description: "123-456-789",
3594
+ access: {
3595
+ license: {
3596
+ agent: ["read"]
3597
+ }
3598
+ }
3599
+ },
3600
+ "111-222-333": {
3601
+ type: "string",
3602
+ default_value: "Dwight;dwight@yahoo.com",
3603
+ description: "111-222-333",
3604
+ access: {
3605
+ license: {
3606
+ agent: ["read"]
3607
+ }
3608
+ }
3609
+ },
3610
+ "333-555-777": {
3611
+ type: "string",
3612
+ default_value: "Pam;pam@yahoo.com",
3613
+ description: "333-555-777",
3614
+ access: {
3615
+ license: {
3616
+ agent: ["read"]
3617
+ }
3618
+ }
3619
+ }
3620
+ },
3621
+ monetization: {
3622
+ frequency: "monthly",
3623
+ charge: "organization",
3624
+ creditCardRequired: true,
3625
+ price: 500,
3626
+ trialDays: 7
3627
+ }
3628
+ }
3629
+ }
3630
+ }
3631
+ };
3632
+ var allAppTemplates = __spreadValues(__spreadValues(__spreadValues({}, appRepositoryTemplates), appBaseTemplates), appTemplates);
3633
+
3634
+ // src/apis/platform/dps/applications/application/chatActions/api.ts
3635
+ var platformDpsApplicationChatActionsApi = {
3636
+ createChatAction(appId, payload, authorization) {
3637
+ return __async(this, null, function* () {
3638
+ try {
3639
+ yield platformDpsClientInstance.put(
3640
+ `/v2/applications/${appId}/chat-actions/${payload.id}`,
3641
+ payload,
3642
+ getPlatformDpsClientConfig(authorization)
3643
+ );
3644
+ } catch (error) {
3645
+ if (error instanceof Error) {
3646
+ throw new Error(
3647
+ `${API_NOTIFICATIONS.BUILDING_BLOCKS.FAILURE.CREATED} [${error.message}]`
3648
+ );
3649
+ }
3650
+ throw error;
3651
+ }
3907
3652
  });
3908
3653
  },
3909
3654
  updateChatAction(appId, payload, authorization) {
@@ -4031,6 +3776,24 @@ var platformDpsApplicationDisplayApi = {
4031
3776
  }
4032
3777
  });
4033
3778
  },
3779
+ patchBasicDetails(appId, basicDetails, authorization) {
3780
+ return __async(this, null, function* () {
3781
+ try {
3782
+ yield platformDpsClientInstance.patch(
3783
+ `/v2/applications/${appId}/display`,
3784
+ basicDetails,
3785
+ getPlatformDpsClientConfig(authorization)
3786
+ );
3787
+ } catch (error) {
3788
+ if (error instanceof Error) {
3789
+ throw new Error(
3790
+ `Listing details couldn't be updated. [${error.message}]`
3791
+ );
3792
+ }
3793
+ throw error;
3794
+ }
3795
+ });
3796
+ },
4034
3797
  updateOverview(appId, data, authorization) {
4035
3798
  return __async(this, null, function* () {
4036
3799
  try {
@@ -4169,6 +3932,7 @@ var platformDpsApplicationInfrastructureBlocksApi = {
4169
3932
  `/v2/applications/${appId}/infrastructure/blocks`,
4170
3933
  getPlatformDpsClientConfig(authorization)
4171
3934
  );
3935
+ delete response.data.appId;
4172
3936
  return response.data;
4173
3937
  });
4174
3938
  },
@@ -4233,20 +3997,6 @@ var platformDpsApplicationInfrastructureBlocksApi = {
4233
3997
  getPlatformDpsClientConfig(authorization)
4234
3998
  );
4235
3999
  });
4236
- },
4237
- updateLogger(appId, payload, authorization) {
4238
- return __async(this, null, function* () {
4239
- yield platformDpsClientInstance.post(
4240
- `/v2/applications/${appId}/infrastructure/blocks`,
4241
- {
4242
- appId,
4243
- logger: {
4244
- provider: payload.provider
4245
- }
4246
- },
4247
- getPlatformDpsClientConfig(authorization)
4248
- );
4249
- });
4250
4000
  }
4251
4001
  };
4252
4002
 
@@ -4633,6 +4383,23 @@ var platformDpsApplicationWebhooksApi = {
4633
4383
  }
4634
4384
  });
4635
4385
  },
4386
+ deleteAppWebhooks(appId, authorization) {
4387
+ return __async(this, null, function* () {
4388
+ try {
4389
+ yield platformDpsClientInstance.delete(
4390
+ `/v2/applications/${appId}/webhook`,
4391
+ getPlatformDpsClientConfig(authorization)
4392
+ );
4393
+ } catch (error) {
4394
+ if (error instanceof Error) {
4395
+ throw new Error(
4396
+ `${API_NOTIFICATIONS.BUILDING_BLOCKS.FAILURE.DELETED} [${error.message}]`
4397
+ );
4398
+ }
4399
+ throw error;
4400
+ }
4401
+ });
4402
+ },
4636
4403
  getChatWebhook(appId, authorization) {
4637
4404
  return __async(this, null, function* () {
4638
4405
  try {
@@ -4770,8 +4537,10 @@ var platformDpsApplicationApi = {
4770
4537
  );
4771
4538
  return response.data;
4772
4539
  } catch (error) {
4773
- if (error instanceof Error) {
4774
- throw new Error(`App couldn't be fetched. [${error.message}]`);
4540
+ if (error instanceof DpsApiError) {
4541
+ throw error.withCustomMessage(
4542
+ `App couldn't be fetched. [${error.message}]`
4543
+ );
4775
4544
  }
4776
4545
  throw error;
4777
4546
  }
@@ -5350,7 +5119,7 @@ var platformDpsApi = {
5350
5119
  };
5351
5120
 
5352
5121
  // src/apis/platform/adapter/instance.ts
5353
- var import_axios15 = __toESM(require("axios"));
5122
+ var import_axios14 = __toESM(require("axios"));
5354
5123
  var REGION2 = {
5355
5124
  FRA: "fra",
5356
5125
  DAL: "dal",
@@ -5364,6 +5133,12 @@ var getRegion2 = (token) => {
5364
5133
  return region;
5365
5134
  }
5366
5135
  };
5136
+ var AdapterApiError = class extends ApiErrorBase {
5137
+ constructor() {
5138
+ super(...arguments);
5139
+ this.name = "adapter";
5140
+ }
5141
+ };
5367
5142
  function getPlatformAdapterClientAuthorization(req) {
5368
5143
  return {
5369
5144
  platform: {
@@ -5377,33 +5152,33 @@ function getPlatformAdapterClientAuthorization(req) {
5377
5152
  vercel: req.headers["vercel-token"],
5378
5153
  planetscale: req.headers["planetscale-token"],
5379
5154
  neon: req.headers["neon-token"],
5380
- sentry: req.headers["sentry-token"],
5381
5155
  openai: req.headers["openai-token"]
5382
5156
  };
5383
5157
  }
5384
- var platformAdapterClientInstance = import_axios15.default.create({
5158
+ var platformAdapterClientInstance = import_axios14.default.create({
5385
5159
  baseURL: "https://platform.labs.text.com/console-adapter/api",
5386
5160
  headers: {
5387
5161
  "Content-Type": "application/json"
5388
5162
  }
5389
5163
  });
5390
5164
  platformAdapterClientInstance.interceptors.response.use(
5391
- (r) => r,
5165
+ (response) => response,
5392
5166
  (error) => {
5393
- var _a;
5394
- if (import_axios15.default.isAxiosError(error)) {
5395
- if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
5396
- const source = error.response.data.error.source;
5397
- if (source) {
5398
- throw new UnauthorizeApiError(source);
5399
- }
5400
- }
5167
+ var _a, _b;
5168
+ const apiError = (_a = error.response) == null ? void 0 : _a.data;
5169
+ if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
5170
+ return Promise.reject(new UnauthorizeApiError(apiError.source));
5171
+ } else if ((apiError == null ? void 0 : apiError.kind) === "error") {
5172
+ const data = (_b = error.response) == null ? void 0 : _b.data;
5173
+ return Promise.reject(
5174
+ new AdapterApiError(data.message, data.data, data.code)
5175
+ );
5401
5176
  }
5402
- throw error;
5177
+ return Promise.reject(error);
5403
5178
  }
5404
5179
  );
5405
5180
  function getPlatformAdapterClientConfig(options = {}) {
5406
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
5181
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
5407
5182
  const currentHeaders = platformAdapterClientInstance.defaults.headers;
5408
5183
  const headers = {
5409
5184
  platform: {
@@ -5418,41 +5193,44 @@ function getPlatformAdapterClientConfig(options = {}) {
5418
5193
  vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
5419
5194
  planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
5420
5195
  neon: (_j = currentHeaders["neon-token"]) != null ? _j : options.neon,
5421
- sentry: (_k = currentHeaders["sentry-token"]) != null ? _k : options.sentry,
5422
- openai: (_l = currentHeaders["openai-token"]) != null ? _l : options.openai
5196
+ openai: (_k = currentHeaders["openai-token"]) != null ? _k : options.openai
5423
5197
  }
5424
5198
  };
5425
5199
  if (currentHeaders["platform-dps-token"]) {
5426
- currentHeaders["X-Region"] = (_m = getRegion2(currentHeaders["platform-dps-token"])) != null ? _m : void 0;
5200
+ currentHeaders["X-Region"] = (_l = getRegion2(currentHeaders["platform-dps-token"])) != null ? _l : void 0;
5427
5201
  }
5428
- if (((_o = (_n = options.ensureAuthorizationToken) == null ? void 0 : _n.platform) == null ? void 0 : _o.dps) && !headers.platform.dps) {
5429
- throw new UnauthorizeApiError("dps");
5202
+ if (((_n = (_m = options.ensureAuthorizationToken) == null ? void 0 : _m.platform) == null ? void 0 : _n.dps) && !headers.platform.dps) {
5203
+ throw new UnauthorizeApiError("accounts");
5430
5204
  }
5431
- if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5205
+ if (((_o = options.ensureAuthorizationToken) == null ? void 0 : _o.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5432
5206
  throw new UnauthorizeApiError("github");
5433
5207
  }
5434
- if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.vercel) && !headers.integrations.vercel) {
5208
+ if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.vercel) && !headers.integrations.vercel) {
5435
5209
  throw new UnauthorizeApiError("vercel");
5436
5210
  }
5437
- if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.netlify) && !headers.integrations.netlify) {
5211
+ if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.netlify) && !headers.integrations.netlify) {
5438
5212
  throw new UnauthorizeApiError("netlify");
5439
5213
  }
5440
- if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.planetscale) && !headers.integrations.planetscale) {
5214
+ if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.planetscale) && !headers.integrations.planetscale) {
5441
5215
  throw new UnauthorizeApiError("planetscale");
5442
5216
  }
5443
- if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.neon) && !headers.integrations.neon) {
5217
+ if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.neon) && !headers.integrations.neon) {
5444
5218
  throw new UnauthorizeApiError("neon");
5445
5219
  }
5446
- if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.sentry) && !headers.integrations.sentry) {
5447
- throw new UnauthorizeApiError("sentry");
5448
- }
5449
- if (((_v = options.ensureAuthorizationToken) == null ? void 0 : _v.openai) && !headers.integrations.openai) {
5220
+ if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.openai) && !headers.integrations.openai) {
5450
5221
  throw new UnauthorizeApiError("openai");
5451
5222
  }
5452
5223
  return {
5453
- headers: __spreadValues(__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.neon ? { "neon-token": headers.integrations.neon } : {}), headers.integrations.sentry ? { "sentry-token": headers.integrations.sentry } : {}), headers.integrations.openai ? { "openai-token": headers.integrations.openai } : {})
5224
+ 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.neon ? { "neon-token": headers.integrations.neon } : {}), headers.integrations.openai ? { "openai-token": headers.integrations.openai } : {})
5454
5225
  };
5455
5226
  }
5227
+ var getPlatformAdapterClientDefaultConfig = (authorization) => getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5228
+ ensureAuthorizationToken: {
5229
+ platform: {
5230
+ dps: true
5231
+ }
5232
+ }
5233
+ }));
5456
5234
  function initPlatformAdapterClientInstance(baseUrl, tokens) {
5457
5235
  if (baseUrl) {
5458
5236
  platformAdapterClientInstance.interceptors.request.use(
@@ -5491,253 +5269,344 @@ function updatePlatformAdapterClientInstance(tokens) {
5491
5269
  if (tokens == null ? void 0 : tokens.neon) {
5492
5270
  headers["neon-token"] = tokens.neon;
5493
5271
  }
5494
- if (tokens == null ? void 0 : tokens.sentry) {
5495
- headers["sentry-token"] = tokens.sentry;
5496
- }
5497
5272
  if (tokens == null ? void 0 : tokens.openai) {
5498
5273
  headers["openai-token"] = tokens.openai;
5499
5274
  }
5500
5275
  }
5501
5276
 
5277
+ // src/apis/platform/adapter/app/blocks/authorization/api.ts
5278
+ var platformAdapterAppAuthorizationApi = {
5279
+ get(appId, authorization) {
5280
+ return __async(this, null, function* () {
5281
+ return platformAdapterClientInstance.get(
5282
+ `/console/app/${appId}/blocks/authorization`,
5283
+ getPlatformAdapterClientDefaultConfig(authorization)
5284
+ );
5285
+ });
5286
+ },
5287
+ add(payload, authorization) {
5288
+ return __async(this, null, function* () {
5289
+ return platformAdapterClientInstance.post(
5290
+ `/console/app/${payload.appId}/blocks/authorization`,
5291
+ payload,
5292
+ getPlatformAdapterClientDefaultConfig(authorization)
5293
+ );
5294
+ });
5295
+ },
5296
+ update(payload, authorization) {
5297
+ return __async(this, null, function* () {
5298
+ return platformAdapterClientInstance.put(
5299
+ `/console/app/${payload.appId}/blocks/authorization`,
5300
+ payload,
5301
+ getPlatformAdapterClientDefaultConfig(authorization)
5302
+ );
5303
+ });
5304
+ },
5305
+ remove(payload, authorization) {
5306
+ return __async(this, null, function* () {
5307
+ return platformAdapterClientInstance.delete(
5308
+ `/console/app/${payload.appId}/blocks/authorization`,
5309
+ getPlatformAdapterClientDefaultConfig(authorization)
5310
+ );
5311
+ });
5312
+ }
5313
+ };
5314
+
5502
5315
  // src/apis/platform/adapter/app/blocks/deployment/api.ts
5503
5316
  var platformAdapterAppDeploymentApi = {
5317
+ getAggregate(appId, authorization) {
5318
+ return __async(this, null, function* () {
5319
+ return platformAdapterClientInstance.get(
5320
+ `/console/app/${appId}/blocks/deployment/aggregate`,
5321
+ getPlatformAdapterClientDefaultConfig(authorization)
5322
+ );
5323
+ });
5324
+ },
5504
5325
  get(appId, authorization) {
5505
5326
  return __async(this, null, function* () {
5506
- const response = yield platformAdapterClientInstance.get(
5327
+ return platformAdapterClientInstance.get(
5507
5328
  `/console/app/${appId}/blocks/deployment`,
5508
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5509
- ensureAuthorizationToken: {
5510
- platform: {
5511
- dps: true
5512
- }
5513
- }
5514
- }))
5329
+ getPlatformAdapterClientDefaultConfig(authorization)
5515
5330
  );
5516
- return response.data;
5517
5331
  });
5518
5332
  },
5519
5333
  link(payload, authorization) {
5520
5334
  return __async(this, null, function* () {
5521
- const response = yield platformAdapterClientInstance.post(
5522
- `/console/app/${payload.appId}/blocks/deployment/link`,
5335
+ return platformAdapterClientInstance.put(
5336
+ `/console/app/${payload.appId}/blocks/deployment`,
5523
5337
  payload,
5524
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5525
- ensureAuthorizationToken: {
5526
- platform: {
5527
- dps: true
5528
- }
5529
- }
5530
- }))
5338
+ getPlatformAdapterClientDefaultConfig(authorization)
5531
5339
  );
5532
- return response.data;
5533
5340
  });
5534
5341
  },
5535
5342
  unlink(payload, authorization) {
5536
5343
  return __async(this, null, function* () {
5537
- yield platformAdapterClientInstance.post(
5538
- `/console/app/${payload.appId}/blocks/deployment/unlink`,
5539
- payload,
5540
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5541
- ensureAuthorizationToken: {
5542
- platform: {
5543
- dps: true
5544
- }
5545
- }
5546
- }))
5344
+ return platformAdapterClientInstance.delete(
5345
+ `/console/app/${payload.appId}/blocks/deployment?${new URLSearchParams(
5346
+ payload
5347
+ ).toString()}`,
5348
+ getPlatformAdapterClientDefaultConfig(authorization)
5547
5349
  );
5548
5350
  });
5549
5351
  },
5550
- installSentry(appId, authorization) {
5352
+ upsert(payload, authorization) {
5551
5353
  return __async(this, null, function* () {
5552
- yield platformAdapterClientInstance.post(
5553
- `/console/app/${appId}/blocks/deployment/install/sentry`,
5554
- {},
5555
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5556
- ensureAuthorizationToken: {
5557
- platform: {
5558
- dps: true
5559
- }
5560
- }
5561
- }))
5354
+ return platformAdapterClientInstance.patch(
5355
+ `/console/app/${payload.appId}/blocks/deployment`,
5356
+ payload,
5357
+ getPlatformAdapterClientDefaultConfig(authorization)
5562
5358
  );
5563
5359
  });
5564
5360
  }
5565
5361
  };
5566
5362
 
5567
- // src/apis/platform/adapter/app/blocks/logger/providers/sentry/api.ts
5568
- var platformAdapterAppSentryLoggerApi = {
5569
- get(projectSlug, authorization) {
5363
+ // src/apis/platform/adapter/app/blocks/monetization/api.ts
5364
+ var platformAdapterAppMonetizationApi = {
5365
+ get(appId, authorization) {
5570
5366
  return __async(this, null, function* () {
5571
- const response = yield platformAdapterClientInstance.get(
5572
- `/console/app/blocks/logger/providers/sentry/get?projectSlug=${projectSlug}`,
5573
- getPlatformAdapterClientConfig(authorization)
5367
+ return platformAdapterClientInstance.get(
5368
+ `/console/app/${appId}/blocks/monetization`,
5369
+ getPlatformAdapterClientDefaultConfig(authorization)
5574
5370
  );
5575
- return response.data;
5576
5371
  });
5577
5372
  },
5578
- link(payload, authorization) {
5373
+ upsert(payload, authorization) {
5579
5374
  return __async(this, null, function* () {
5580
- yield platformAdapterClientInstance.post(
5581
- "/console/app/blocks/logger/providers/sentry/link",
5375
+ return platformAdapterClientInstance.post(
5376
+ `/console/app/${payload.appId}/blocks/monetization`,
5582
5377
  payload,
5583
- getPlatformAdapterClientConfig(authorization)
5378
+ getPlatformAdapterClientDefaultConfig(authorization)
5584
5379
  );
5585
5380
  });
5586
5381
  },
5587
- unlink(payload, authorization) {
5382
+ remove(payload, authorization) {
5588
5383
  return __async(this, null, function* () {
5589
- yield platformAdapterClientInstance.post(
5590
- "/console/app/blocks/logger/providers/sentry/unlink",
5591
- payload,
5592
- getPlatformAdapterClientConfig(authorization)
5384
+ return platformAdapterClientInstance.delete(
5385
+ `/console/app/${payload.appId}/blocks/monetization`,
5386
+ getPlatformAdapterClientDefaultConfig(authorization)
5387
+ );
5388
+ });
5389
+ }
5390
+ };
5391
+
5392
+ // src/apis/platform/adapter/app/blocks/properties/property/api.ts
5393
+ var platformAdapterAppPropertyApi = {
5394
+ get(appId, propertyId, authorization) {
5395
+ return __async(this, null, function* () {
5396
+ return platformAdapterClientInstance.get(
5397
+ `/console/app/${appId}/blocks/properties/${propertyId}`,
5398
+ getPlatformAdapterClientDefaultConfig(authorization)
5593
5399
  );
5594
5400
  });
5595
5401
  },
5596
- reauthorizeSentryApp(userId, sentryInstallationId, sentryRefreshToken, authorization) {
5402
+ upsert(payload, authorization) {
5597
5403
  return __async(this, null, function* () {
5598
- const response = yield platformAdapterClientInstance.post(
5599
- "/integrations/sentry/refresh",
5600
- {
5601
- userId,
5602
- sentryInstallationId,
5603
- sentryRefreshToken
5604
- },
5605
- getPlatformAdapterClientConfig(authorization)
5404
+ return platformAdapterClientInstance.post(
5405
+ `/console/app/${payload.appId}/blocks/properties/${payload.propertyId}`,
5406
+ payload,
5407
+ getPlatformAdapterClientDefaultConfig(authorization)
5606
5408
  );
5607
- return response.data;
5608
5409
  });
5609
5410
  },
5610
- requestSentryIssueSolution(stacktrace, authorization) {
5411
+ remove(payload, authorization) {
5611
5412
  return __async(this, null, function* () {
5612
- const response = yield platformAdapterClientInstance.post(
5613
- "/integrations/openai/issues/solution",
5614
- {
5615
- stacktrace
5616
- },
5617
- getPlatformAdapterClientConfig(authorization)
5413
+ return platformAdapterClientInstance.delete(
5414
+ `/console/app/${payload.appId}/blocks/properties/${payload.propertyId}`,
5415
+ getPlatformAdapterClientDefaultConfig(authorization)
5618
5416
  );
5619
- return response.data;
5620
5417
  });
5621
5418
  }
5622
5419
  };
5623
5420
 
5624
- // src/apis/platform/adapter/app/blocks/logger/api.ts
5625
- var platformAdapterAppLoggerApi = {
5626
- providers: {
5627
- sentry: platformAdapterAppSentryLoggerApi
5421
+ // src/apis/platform/adapter/app/blocks/properties/api.ts
5422
+ var platformAdapterAppPropertiesApi = {
5423
+ property: platformAdapterAppPropertyApi,
5424
+ get(appId, authorization) {
5425
+ return __async(this, null, function* () {
5426
+ return platformAdapterClientInstance.get(
5427
+ `/console/app/${appId}/blocks/properties`,
5428
+ getPlatformAdapterClientDefaultConfig(authorization)
5429
+ );
5430
+ });
5431
+ },
5432
+ upsert(payload, authorization) {
5433
+ return __async(this, null, function* () {
5434
+ return platformAdapterClientInstance.post(
5435
+ `/console/app/${payload.appId}/blocks/properties`,
5436
+ payload,
5437
+ getPlatformAdapterClientDefaultConfig(authorization)
5438
+ );
5439
+ });
5440
+ },
5441
+ remove(payload, authorization) {
5442
+ return __async(this, null, function* () {
5443
+ return platformAdapterClientInstance.delete(
5444
+ `/console/app/${payload.appId}/blocks/properties`,
5445
+ getPlatformAdapterClientDefaultConfig(authorization)
5446
+ );
5447
+ });
5628
5448
  }
5629
5449
  };
5630
5450
 
5631
5451
  // src/apis/platform/adapter/app/blocks/repository/api.ts
5632
5452
  var platformAdapterAppRepositoryApi = {
5453
+ getAggregate(appId, authorization) {
5454
+ return __async(this, null, function* () {
5455
+ return platformAdapterClientInstance.get(
5456
+ `/console/app/${appId}/blocks/repository/aggregate`,
5457
+ getPlatformAdapterClientDefaultConfig(authorization)
5458
+ );
5459
+ });
5460
+ },
5633
5461
  get(appId, authorization) {
5634
5462
  return __async(this, null, function* () {
5635
- const response = yield platformAdapterClientInstance.get(
5463
+ return platformAdapterClientInstance.get(
5636
5464
  `/console/app/${appId}/blocks/repository`,
5637
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5638
- ensureAuthorizationToken: {
5639
- platform: {
5640
- dps: true
5641
- }
5642
- }
5643
- }))
5465
+ getPlatformAdapterClientDefaultConfig(authorization)
5644
5466
  );
5645
- return response.data;
5646
5467
  });
5647
5468
  },
5648
5469
  link(payload, authorization) {
5649
5470
  return __async(this, null, function* () {
5650
- const response = yield platformAdapterClientInstance.post(
5651
- `/console/app/${payload.appId}/blocks/repository/link`,
5471
+ return platformAdapterClientInstance.put(
5472
+ `/console/app/${payload.appId}/blocks/repository`,
5652
5473
  payload,
5653
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5654
- ensureAuthorizationToken: {
5655
- platform: {
5656
- dps: true
5657
- }
5658
- }
5659
- }))
5474
+ getPlatformAdapterClientDefaultConfig(authorization)
5660
5475
  );
5661
- return response.data;
5662
5476
  });
5663
5477
  },
5664
5478
  unlink(payload, authorization) {
5665
5479
  return __async(this, null, function* () {
5666
- yield platformAdapterClientInstance.post(
5667
- `/console/app/${payload.appId}/blocks/repository/unlink`,
5480
+ return platformAdapterClientInstance.delete(
5481
+ `/console/app/${payload.appId}/blocks/repository?${new URLSearchParams(
5482
+ payload
5483
+ ).toString()}`,
5484
+ getPlatformAdapterClientDefaultConfig(authorization)
5485
+ );
5486
+ });
5487
+ },
5488
+ upsert(payload, authorization) {
5489
+ return __async(this, null, function* () {
5490
+ return platformAdapterClientInstance.patch(
5491
+ `/console/app/${payload.appId}/blocks/repository`,
5668
5492
  payload,
5669
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5670
- ensureAuthorizationToken: {
5671
- platform: {
5672
- dps: true
5673
- }
5674
- }
5675
- }))
5493
+ getPlatformAdapterClientDefaultConfig(authorization)
5676
5494
  );
5677
5495
  });
5678
5496
  },
5679
5497
  seed(payload, authorization) {
5680
5498
  return __async(this, null, function* () {
5681
- const response = yield platformAdapterClientInstance.post(
5499
+ return platformAdapterClientInstance.post(
5682
5500
  `/console/app/${payload.appId}/blocks/repository/seed`,
5683
5501
  payload,
5684
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5685
- ensureAuthorizationToken: {
5686
- platform: {
5687
- dps: true
5688
- }
5689
- }
5690
- }))
5502
+ getPlatformAdapterClientDefaultConfig(authorization)
5691
5503
  );
5692
- return response.data;
5693
5504
  });
5694
5505
  }
5695
5506
  };
5696
5507
 
5697
5508
  // src/apis/platform/adapter/app/blocks/storage/api.ts
5698
5509
  var platformAdapterAppStorageApi = {
5510
+ getAggregate(appId, authorization) {
5511
+ return __async(this, null, function* () {
5512
+ return platformAdapterClientInstance.get(
5513
+ `/console/app/${appId}/blocks/storage/aggregate`,
5514
+ getPlatformAdapterClientDefaultConfig(authorization)
5515
+ );
5516
+ });
5517
+ },
5699
5518
  get(appId, authorization) {
5700
5519
  return __async(this, null, function* () {
5701
- const response = yield platformAdapterClientInstance.get(
5520
+ return platformAdapterClientInstance.get(
5702
5521
  `/console/app/${appId}/blocks/storage`,
5703
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5704
- ensureAuthorizationToken: {
5705
- platform: {
5706
- dps: true
5707
- }
5708
- }
5709
- }))
5522
+ getPlatformAdapterClientDefaultConfig(authorization)
5710
5523
  );
5711
- return response.data;
5712
5524
  });
5713
5525
  },
5714
5526
  link(payload, authorization) {
5715
5527
  return __async(this, null, function* () {
5716
- yield platformAdapterClientInstance.post(
5717
- `/console/app/${payload.appId}/blocks/storage/link`,
5528
+ return platformAdapterClientInstance.put(
5529
+ `/console/app/${payload.appId}/blocks/storage`,
5718
5530
  payload,
5719
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5720
- ensureAuthorizationToken: {
5721
- platform: {
5722
- dps: true
5723
- }
5724
- }
5725
- }))
5531
+ getPlatformAdapterClientDefaultConfig(authorization)
5726
5532
  );
5727
5533
  });
5728
5534
  },
5729
5535
  unlink(payload, authorization) {
5730
5536
  return __async(this, null, function* () {
5731
- yield platformAdapterClientInstance.post(
5732
- `/console/app/${payload.appId}/blocks/storage/unlink`,
5537
+ return platformAdapterClientInstance.delete(
5538
+ `/console/app/${payload.appId}/blocks/storage?${new URLSearchParams(
5539
+ payload
5540
+ ).toString()}`,
5541
+ getPlatformAdapterClientDefaultConfig(authorization)
5542
+ );
5543
+ });
5544
+ },
5545
+ upsert(payload, authorization) {
5546
+ return __async(this, null, function* () {
5547
+ return platformAdapterClientInstance.patch(
5548
+ `/console/app/${payload.appId}/blocks/storage`,
5733
5549
  payload,
5734
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5735
- ensureAuthorizationToken: {
5736
- platform: {
5737
- dps: true
5738
- }
5739
- }
5740
- }))
5550
+ getPlatformAdapterClientDefaultConfig(authorization)
5551
+ );
5552
+ });
5553
+ }
5554
+ };
5555
+
5556
+ // src/apis/platform/adapter/app/blocks/widgets/widget/api.ts
5557
+ var platformAdapterAppWidgetApi = {
5558
+ get(appId, widgetId, authorization) {
5559
+ return __async(this, null, function* () {
5560
+ return platformAdapterClientInstance.get(
5561
+ `/console/app/${appId}/blocks/widgets/${widgetId}`,
5562
+ getPlatformAdapterClientDefaultConfig(authorization)
5563
+ );
5564
+ });
5565
+ },
5566
+ upsert(payload, authorization) {
5567
+ return __async(this, null, function* () {
5568
+ return platformAdapterClientInstance.post(
5569
+ `/console/app/${payload.appId}/blocks/widgets/${payload.widgetId}`,
5570
+ payload,
5571
+ getPlatformAdapterClientDefaultConfig(authorization)
5572
+ );
5573
+ });
5574
+ },
5575
+ remove(payload, authorization) {
5576
+ return __async(this, null, function* () {
5577
+ return platformAdapterClientInstance.delete(
5578
+ `/console/app/${payload.appId}/blocks/widgets/${payload.widgetId}`,
5579
+ getPlatformAdapterClientDefaultConfig(authorization)
5580
+ );
5581
+ });
5582
+ }
5583
+ };
5584
+
5585
+ // src/apis/platform/adapter/app/blocks/widgets/api.ts
5586
+ var platformAdapterAppWidgetsApi = {
5587
+ widget: platformAdapterAppWidgetApi,
5588
+ get(appId, authorization) {
5589
+ return __async(this, null, function* () {
5590
+ return platformAdapterClientInstance.get(
5591
+ `/console/app/${appId}/blocks/widgets`,
5592
+ getPlatformAdapterClientDefaultConfig(authorization)
5593
+ );
5594
+ });
5595
+ },
5596
+ upsert(payload, authorization) {
5597
+ return __async(this, null, function* () {
5598
+ return platformAdapterClientInstance.post(
5599
+ `/console/app/${payload.appId}/blocks/widgets`,
5600
+ payload,
5601
+ getPlatformAdapterClientDefaultConfig(authorization)
5602
+ );
5603
+ });
5604
+ },
5605
+ remove(payload, authorization) {
5606
+ return __async(this, null, function* () {
5607
+ return platformAdapterClientInstance.delete(
5608
+ `/console/app/${payload.appId}/blocks/widgets`,
5609
+ getPlatformAdapterClientDefaultConfig(authorization)
5741
5610
  );
5742
5611
  });
5743
5612
  }
@@ -5745,10 +5614,13 @@ var platformAdapterAppStorageApi = {
5745
5614
 
5746
5615
  // src/apis/platform/adapter/app/blocks/api.ts
5747
5616
  var platformAdapterAppBlocksApi = {
5617
+ authorization: platformAdapterAppAuthorizationApi,
5618
+ monetization: platformAdapterAppMonetizationApi,
5748
5619
  repository: platformAdapterAppRepositoryApi,
5749
5620
  deployment: platformAdapterAppDeploymentApi,
5750
5621
  storage: platformAdapterAppStorageApi,
5751
- logger: platformAdapterAppLoggerApi
5622
+ properties: platformAdapterAppPropertiesApi,
5623
+ widgets: platformAdapterAppWidgetsApi
5752
5624
  };
5753
5625
 
5754
5626
  // src/apis/platform/adapter/app/variables/api.ts
@@ -5761,7 +5633,7 @@ var platformAdapterAppVariablesApi = {
5761
5633
  params: {
5762
5634
  decrypted
5763
5635
  }
5764
- }, getPlatformAdapterClientConfig(authorization))
5636
+ }, getPlatformAdapterClientDefaultConfig(authorization))
5765
5637
  );
5766
5638
  return response.data;
5767
5639
  });
@@ -5770,7 +5642,7 @@ var platformAdapterAppVariablesApi = {
5770
5642
  return __async(this, null, function* () {
5771
5643
  const response = yield platformAdapterClientInstance.get(
5772
5644
  `/console/app/${appId}/variables/${key}`,
5773
- getPlatformAdapterClientConfig(authorization)
5645
+ getPlatformAdapterClientDefaultConfig(authorization)
5774
5646
  );
5775
5647
  return response.data;
5776
5648
  });
@@ -5780,7 +5652,7 @@ var platformAdapterAppVariablesApi = {
5780
5652
  yield platformAdapterClientInstance.post(
5781
5653
  `/console/app/${appId}/variables/${key}/sync`,
5782
5654
  payload,
5783
- getPlatformAdapterClientConfig(authorization)
5655
+ getPlatformAdapterClientDefaultConfig(authorization)
5784
5656
  );
5785
5657
  });
5786
5658
  },
@@ -5789,7 +5661,7 @@ var platformAdapterAppVariablesApi = {
5789
5661
  yield platformAdapterClientInstance.post(
5790
5662
  `/console/app/${appId}/variables/${data.key}`,
5791
5663
  data,
5792
- getPlatformAdapterClientConfig(authorization)
5664
+ getPlatformAdapterClientDefaultConfig(authorization)
5793
5665
  );
5794
5666
  });
5795
5667
  },
@@ -5798,7 +5670,7 @@ var platformAdapterAppVariablesApi = {
5798
5670
  yield platformAdapterClientInstance.post(
5799
5671
  `/console/app/${appId}/variables/${data.key}/edit`,
5800
5672
  data,
5801
- getPlatformAdapterClientConfig(authorization)
5673
+ getPlatformAdapterClientDefaultConfig(authorization)
5802
5674
  );
5803
5675
  });
5804
5676
  },
@@ -5811,284 +5683,87 @@ var platformAdapterAppVariablesApi = {
5811
5683
  }
5812
5684
  };
5813
5685
 
5814
- // src/apis/platform/adapter/app/creator/api.ts
5815
- var platformAdapterAppCreatorApi = {
5816
- app(payload, authorization) {
5817
- return __async(this, null, function* () {
5818
- try {
5819
- const response = yield platformAdapterClientInstance.post(
5820
- `/console/app/new/app`,
5821
- payload,
5822
- getPlatformAdapterClientConfig(authorization)
5823
- );
5824
- return response.data;
5825
- } catch (error) {
5826
- if (error instanceof Error) {
5827
- throw new Error(`App couldn't be created. [${error.message}]`);
5828
- }
5829
- throw error;
5830
- }
5831
- });
5832
- },
5833
- repository(payload, authorization) {
5834
- return __async(this, null, function* () {
5835
- try {
5836
- const response = yield platformAdapterClientInstance.post(
5837
- `/console/app/new/repository`,
5838
- payload,
5839
- getPlatformAdapterClientConfig(authorization)
5840
- );
5841
- return response.data;
5842
- } catch (error) {
5843
- if (error instanceof Error) {
5844
- throw new Error(`Repository couldn't be created. [${error.message}]`);
5845
- }
5846
- throw error;
5847
- }
5848
- });
5849
- },
5850
- seed(payload, authorization) {
5851
- return __async(this, null, function* () {
5852
- try {
5853
- const response = yield platformAdapterClientInstance.post(
5854
- `/console/app/new/seed`,
5855
- payload,
5856
- getPlatformAdapterClientConfig(authorization)
5857
- );
5858
- return response.data;
5859
- } catch (error) {
5860
- if (error instanceof Error) {
5861
- throw new Error(`Seed couldn't be created. [${error.message}]`);
5862
- }
5863
- throw error;
5864
- }
5865
- });
5866
- },
5867
- deployment(payload, authorization) {
5868
- return __async(this, null, function* () {
5869
- try {
5870
- const response = yield platformAdapterClientInstance.post(
5871
- `/console/app/new/deployment`,
5872
- payload,
5873
- getPlatformAdapterClientConfig(authorization)
5874
- );
5875
- return response.data;
5876
- } catch (error) {
5877
- if (error instanceof Error) {
5878
- throw new Error(`Deployment couldn't be created. [${error.message}]`);
5879
- }
5880
- throw error;
5881
- }
5882
- });
5883
- },
5884
- deployment_accessible(payload, authorization) {
5686
+ // src/apis/platform/adapter/app/templates/api.ts
5687
+ var platformAdapterAppTemplatesApi = {
5688
+ getTemplates(authorization) {
5885
5689
  return __async(this, null, function* () {
5886
5690
  try {
5887
- const response = yield platformAdapterClientInstance.post(
5888
- `/console/app/new/deployment_accessible`,
5889
- payload,
5890
- getPlatformAdapterClientConfig(authorization)
5691
+ const response = yield platformAdapterClientInstance.get(
5692
+ `/console/app/templates`,
5693
+ getPlatformAdapterClientDefaultConfig(authorization)
5891
5694
  );
5892
5695
  return response.data;
5893
5696
  } catch (error) {
5894
5697
  if (error instanceof Error) {
5895
5698
  throw new Error(
5896
- `Deployment accessibility couldn't be checked. [${error.message}]`
5699
+ `App templates couldn't be fetched. [${error.message}]`
5897
5700
  );
5898
5701
  }
5899
5702
  throw error;
5900
5703
  }
5901
5704
  });
5902
5705
  },
5903
- storage(payload, authorization) {
5706
+ getRepositoryTemplates(authorization) {
5904
5707
  return __async(this, null, function* () {
5905
5708
  try {
5906
- const response = yield platformAdapterClientInstance.post(
5907
- `/console/app/new/storage`,
5908
- payload,
5909
- getPlatformAdapterClientConfig(authorization)
5910
- );
5911
- return response.data;
5912
- } catch (error) {
5913
- if (error instanceof Error) {
5914
- throw new Error(`Storage couldn't be created. [${error.message}]`);
5915
- }
5916
- throw error;
5917
- }
5918
- });
5919
- },
5920
- authorization(payload, authorization) {
5921
- return __async(this, null, function* () {
5922
- try {
5923
- const response = yield platformAdapterClientInstance.post(
5924
- `/console/app/new/authorization`,
5925
- payload,
5926
- getPlatformAdapterClientConfig(authorization)
5709
+ const response = yield platformAdapterClientInstance.get(
5710
+ `/console/app/templates/repository`,
5711
+ getPlatformAdapterClientDefaultConfig(authorization)
5927
5712
  );
5928
5713
  return response.data;
5929
5714
  } catch (error) {
5930
5715
  if (error instanceof Error) {
5931
5716
  throw new Error(
5932
- `Authorization couldn't be created. [${error.message}]`
5717
+ `App repository templates couldn't be fetched. [${error.message}]`
5933
5718
  );
5934
5719
  }
5935
5720
  throw error;
5936
5721
  }
5937
5722
  });
5938
- },
5939
- widgets(payload, authorization) {
5940
- return __async(this, null, function* () {
5941
- try {
5942
- const response = yield platformAdapterClientInstance.post(
5943
- `/console/app/new/widgets`,
5944
- payload,
5945
- getPlatformAdapterClientConfig(authorization)
5946
- );
5947
- return response.data;
5948
- } catch (error) {
5949
- if (error instanceof Error) {
5950
- throw new Error(`Widgets couldn't be created. [${error.message}]`);
5951
- }
5952
- throw error;
5953
- }
5954
- });
5955
- },
5956
- properties(payload, authorization) {
5957
- return __async(this, null, function* () {
5958
- try {
5959
- const response = yield platformAdapterClientInstance.post(
5960
- `/console/app/new/properties`,
5961
- payload,
5962
- getPlatformAdapterClientConfig(authorization)
5963
- );
5964
- return response.data;
5965
- } catch (error) {
5966
- if (error instanceof Error) {
5967
- throw new Error(`Properties couldn't be created. [${error.message}]`);
5968
- }
5969
- throw error;
5970
- }
5971
- });
5972
- },
5973
- monetization(payload, authorization) {
5974
- return __async(this, null, function* () {
5975
- try {
5976
- const response = yield platformAdapterClientInstance.post(
5977
- `/console/app/new/monetization`,
5978
- payload,
5979
- getPlatformAdapterClientConfig(authorization)
5980
- );
5981
- return response.data;
5982
- } catch (error) {
5983
- if (error instanceof Error) {
5984
- throw new Error(`Monetization couldn't be created. [${error.message}]`);
5985
- }
5986
- throw error;
5987
- }
5988
- });
5989
5723
  }
5990
5724
  };
5991
5725
 
5992
- // src/apis/platform/adapter/app/manifest/api.ts
5993
- var platformAdapterAppManifestApi = {
5994
- getManifest(appId, authorization) {
5726
+ // src/apis/platform/adapter/app/api.ts
5727
+ var platformAdapterAppApi = {
5728
+ blocks: platformAdapterAppBlocksApi,
5729
+ variables: platformAdapterAppVariablesApi,
5730
+ templates: platformAdapterAppTemplatesApi,
5731
+ push(payload, authorization) {
5995
5732
  return __async(this, null, function* () {
5996
- try {
5997
- const response = yield platformAdapterClientInstance.get(
5998
- `/console/app/${appId}/manifest`,
5999
- getPlatformAdapterClientConfig(authorization)
6000
- );
6001
- return response.data;
6002
- } catch (error) {
6003
- if (error instanceof Error) {
6004
- throw new Error(`App manifest couldn't be created. [${error.message}]`);
6005
- }
6006
- throw error;
6007
- }
5733
+ return platformAdapterClientInstance.post(
5734
+ `/console/app${payload.manifest.id ? `/${payload.manifest.id}` : ""}`,
5735
+ payload,
5736
+ getPlatformAdapterClientDefaultConfig(authorization)
5737
+ );
6008
5738
  });
6009
5739
  },
6010
- pushManifest(manifest, authorization) {
5740
+ pull(appId, authorization) {
6011
5741
  return __async(this, null, function* () {
6012
- try {
6013
- yield platformAdapterClientInstance.post(
6014
- `/console/app/${manifest.id}/manifest`,
6015
- manifest,
6016
- getPlatformAdapterClientConfig(authorization)
6017
- );
6018
- } catch (error) {
6019
- if (error instanceof Error) {
6020
- throw new Error(`App manifest couldn't be pushed. [${error.message}]`);
6021
- }
6022
- throw error;
6023
- }
5742
+ return platformAdapterClientInstance.get(
5743
+ `/console/app/${appId}`,
5744
+ getPlatformAdapterClientDefaultConfig(authorization)
5745
+ );
6024
5746
  });
6025
5747
  },
6026
- verifyManifest(manifest, authorization) {
6027
- return __async(this, null, function* () {
6028
- try {
6029
- const response = yield platformAdapterClientInstance.post(
6030
- `/console/app/${manifest.id}/manifest/verify`,
6031
- manifest,
6032
- getPlatformAdapterClientConfig(authorization)
6033
- );
6034
- return response.data;
6035
- } catch (error) {
6036
- if (error instanceof Error) {
6037
- throw new Error(
6038
- `App manifest couldn't be verified. [${error.message}]`
6039
- );
6040
- }
6041
- throw error;
6042
- }
6043
- });
6044
- }
6045
- };
6046
-
6047
- // src/apis/platform/adapter/app/api.ts
6048
- var platformAdapterAppApi = {
6049
- creator: platformAdapterAppCreatorApi,
6050
- blocks: platformAdapterAppBlocksApi,
6051
- variables: platformAdapterAppVariablesApi,
6052
- manifest: platformAdapterAppManifestApi,
6053
- create(payload, authorization) {
5748
+ verify(payload, authorization) {
6054
5749
  return __async(this, null, function* () {
6055
- const response = yield platformAdapterClientInstance.post(
6056
- `/console/app/new`,
5750
+ return platformAdapterClientInstance.post(
5751
+ `/console/app/${payload.appId}/verify`,
6057
5752
  payload,
6058
- getPlatformAdapterClientConfig(authorization)
5753
+ getPlatformAdapterClientDefaultConfig(authorization)
6059
5754
  );
6060
- return response.data;
6061
5755
  });
6062
5756
  },
6063
- createStatus(sagaId, authorization) {
5757
+ status(sagaId, authorization) {
6064
5758
  return __async(this, null, function* () {
6065
- const response = yield platformAdapterClientInstance.get(
6066
- `/console/app/new/status`,
5759
+ return platformAdapterClientInstance.get(
5760
+ `/console/app/status`,
6067
5761
  __spreadValues({
6068
5762
  params: {
6069
5763
  sagaId
6070
5764
  }
6071
- }, getPlatformAdapterClientConfig(authorization))
5765
+ }, getPlatformAdapterClientDefaultConfig(authorization))
6072
5766
  );
6073
- return response.data;
6074
- });
6075
- },
6076
- getTemplates(authorization) {
6077
- return __async(this, null, function* () {
6078
- try {
6079
- const response = yield platformAdapterClientInstance.get(
6080
- `/console/app/templates`,
6081
- getPlatformAdapterClientConfig(authorization)
6082
- );
6083
- return response.data;
6084
- } catch (error) {
6085
- if (error instanceof Error) {
6086
- throw new Error(
6087
- `App templates couldn't be created. [${error.message}]`
6088
- );
6089
- }
6090
- throw error;
6091
- }
6092
5767
  });
6093
5768
  }
6094
5769
  };
@@ -6108,8 +5783,8 @@ var platformAdapterConductorApi = {
6108
5783
  };
6109
5784
 
6110
5785
  // src/apis/platform/billing/instance.ts
6111
- var import_axios16 = __toESM(require("axios"));
6112
- var platformBillingClientInstance = import_axios16.default.create({
5786
+ var import_axios15 = __toESM(require("axios"));
5787
+ var platformBillingClientInstance = import_axios15.default.create({
6113
5788
  baseURL: "https://billing.labs.livechatinc.com"
6114
5789
  });
6115
5790
  function getPlatformBillingClientAuthorization(req) {
@@ -6129,10 +5804,10 @@ function getPlatformBillingClientConfig(options = {}) {
6129
5804
  function initPlatformBillingClientInstance(baseUrl, token) {
6130
5805
  if (baseUrl) {
6131
5806
  platformBillingClientInstance.interceptors.request.use(
6132
- (config) => __async(this, null, function* () {
5807
+ (config) => {
6133
5808
  config.baseURL = baseUrl;
6134
5809
  return config;
6135
- }),
5810
+ },
6136
5811
  (error) => Promise.reject(error)
6137
5812
  );
6138
5813
  }
@@ -6298,7 +5973,7 @@ var api = {
6298
5973
  isInitialized: false
6299
5974
  };
6300
5975
  function initApi(config, tokens) {
6301
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
5976
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
6302
5977
  initPlatformAccountsClientInstance(
6303
5978
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
6304
5979
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.dps
@@ -6324,28 +5999,36 @@ function initApi(config, tokens) {
6324
5999
  netlify: (_k = tokens.netlify) == null ? void 0 : _k.token,
6325
6000
  vercel: (_l = tokens.vercel) == null ? void 0 : _l.token,
6326
6001
  neon: (_m = tokens.neon) == null ? void 0 : _m.token,
6327
- planetscale: (_n = tokens.planetscale) == null ? void 0 : _n.token,
6328
- sentry: (_o = tokens.sentry) == null ? void 0 : _o.token
6002
+ planetscale: (_n = tokens.planetscale) == null ? void 0 : _n.token
6329
6003
  } : void 0
6330
6004
  );
6331
6005
  initLiveChatClientInstance(
6332
- (_p = config.urls.products) == null ? void 0 : _p.livechat,
6333
- (_q = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _q.dps
6006
+ (_o = config.urls.products) == null ? void 0 : _o.livechat,
6007
+ (_p = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _p.dps
6334
6008
  );
6335
- initTextClientInstance((_r = config.urls.integrations) == null ? void 0 : _r.text, (_s = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _s.dps);
6336
- initGithubClientInstance((_t = tokens == null ? void 0 : tokens.github) == null ? void 0 : _t.apps);
6337
- initNetlifyClientInstance((_u = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _u.token);
6338
- initVercelClientInstance((_v = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _v.token);
6339
- initNeonClientInstance((_w = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _w.token);
6340
- initPlanetScaleClientInstance((_x = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _x.token);
6341
- initSentryClientInstance((_y = tokens == null ? void 0 : tokens.sentry) == null ? void 0 : _y.token);
6009
+ initTextClientInstance((_q = config.urls.integrations) == null ? void 0 : _q.text, (_r = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _r.dps);
6010
+ initGithubClientInstance((_s = tokens == null ? void 0 : tokens.github) == null ? void 0 : _s.apps);
6011
+ initNetlifyClientInstance((_t = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _t.token);
6012
+ initVercelClientInstance((_u = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _u.token);
6013
+ initNeonClientInstance((_v = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _v.token);
6014
+ initPlanetScaleClientInstance((_w = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _w.token);
6342
6015
  api.isInitialized = true;
6343
6016
  }
6344
6017
  // Annotate the CommonJS export names for ESM import in node:
6345
6018
  0 && (module.exports = {
6346
6019
  API_NOTIFICATIONS,
6020
+ AccountsApiError,
6021
+ AdapterApiError,
6022
+ ApiErrorBase,
6023
+ DpsApiError,
6347
6024
  UnauthorizeApiError,
6025
+ allAppTemplates,
6348
6026
  api,
6027
+ appBaseTemplates,
6028
+ appRepositoryTemplates,
6029
+ appRepositoryTemplatesMap,
6030
+ appTemplates,
6031
+ appTemplatesMap,
6349
6032
  getAppAutoReviewPayload,
6350
6033
  getEmptyAppAutoReview,
6351
6034
  getGitHubClientAuthorization,
@@ -6362,14 +6045,13 @@ function initApi(config, tokens) {
6362
6045
  getPlatformAccountsClientConfig,
6363
6046
  getPlatformAdapterClientAuthorization,
6364
6047
  getPlatformAdapterClientConfig,
6048
+ getPlatformAdapterClientDefaultConfig,
6365
6049
  getPlatformBillingClientAuthorization,
6366
6050
  getPlatformBillingClientConfig,
6367
6051
  getPlatformDpsAdminClientAuthorization,
6368
6052
  getPlatformDpsClientAuthorization,
6369
6053
  getPlatformDpsClientConfig,
6370
6054
  getRegion,
6371
- getSentryClientAuthorization,
6372
- getSentryClientConfig,
6373
6055
  getTextClientAuthorization,
6374
6056
  getTextClientConfig,
6375
6057
  getVercelClientAuthorization,
@@ -6385,7 +6067,6 @@ function initApi(config, tokens) {
6385
6067
  initPlatformAdapterClientInstance,
6386
6068
  initPlatformBillingClientInstance,
6387
6069
  initPlatformDpsClientInstance,
6388
- initSentryClientInstance,
6389
6070
  initTextClientInstance,
6390
6071
  initVercelClientInstance,
6391
6072
  livechatClientInstance,
@@ -6396,14 +6077,12 @@ function initApi(config, tokens) {
6396
6077
  platformAdapterClientInstance,
6397
6078
  platformBillingClientInstance,
6398
6079
  platformDpsClientInstance,
6399
- sentryClientInstance,
6400
6080
  textClientInstance,
6401
6081
  updateGithubClientInstance,
6402
6082
  updateNeonClientInstance,
6403
6083
  updateNetlifyClientInstance,
6404
6084
  updatePlanetScaleClientInstance,
6405
6085
  updatePlatformAdapterClientInstance,
6406
- updateSentryClientInstance,
6407
6086
  updateVercelClientInstance,
6408
6087
  vercelClientInstance
6409
6088
  });