@livechat/developer-studio-api 2.3.0 → 2.3.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.d.mts +233 -250
- package/dist/index.d.ts +233 -250
- package/dist/index.js +339 -294
- package/dist/index.mjs +339 -294
- package/package.json +4 -5
package/dist/index.js
CHANGED
|
@@ -128,70 +128,6 @@ module.exports = __toCommonJS(src_exports);
|
|
|
128
128
|
// src/apis/integrations/github/api.ts
|
|
129
129
|
var import_axios2 = __toESM(require("axios"));
|
|
130
130
|
|
|
131
|
-
// src/apis/integrations/github/instance.ts
|
|
132
|
-
var import_axios = __toESM(require("axios"));
|
|
133
|
-
|
|
134
|
-
// src/types/errors/api.ts
|
|
135
|
-
var UnauthorizeApiError = class extends Error {
|
|
136
|
-
constructor(source) {
|
|
137
|
-
super("Unauthorized API call");
|
|
138
|
-
this.source = source;
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
// src/apis/integrations/github/instance.ts
|
|
143
|
-
var githubClientInstance = import_axios.default.create({
|
|
144
|
-
baseURL: "https://api.github.com",
|
|
145
|
-
headers: {
|
|
146
|
-
["Accept"]: "application/vnd.github+json",
|
|
147
|
-
["Content-Type"]: "application/json"
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
githubClientInstance.interceptors.response.use(
|
|
151
|
-
(r) => r,
|
|
152
|
-
(error) => {
|
|
153
|
-
var _a;
|
|
154
|
-
if (import_axios.default.isAxiosError(error)) {
|
|
155
|
-
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
156
|
-
error = new UnauthorizeApiError("github");
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
throw error;
|
|
160
|
-
}
|
|
161
|
-
);
|
|
162
|
-
function getGitHubClientAuthorization(req) {
|
|
163
|
-
return {
|
|
164
|
-
tokens: {
|
|
165
|
-
app: req.headers["github-app-token"],
|
|
166
|
-
oauth: req.headers["github-oauth-token"]
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
function getGithubClientRequestConfig(options = {}) {
|
|
171
|
-
const defaultAuthorization = githubClientInstance.defaults.headers["Authorization"];
|
|
172
|
-
const headers = {
|
|
173
|
-
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
174
|
-
};
|
|
175
|
-
if (options.ensureAuthorizationToken && !headers.authorization) {
|
|
176
|
-
throw new UnauthorizeApiError("github");
|
|
177
|
-
}
|
|
178
|
-
return {
|
|
179
|
-
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
function initGithubClientInstance(token) {
|
|
183
|
-
if (token) {
|
|
184
|
-
updateGithubClientInstance(token);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
function updateGithubClientInstance(token) {
|
|
188
|
-
if (token) {
|
|
189
|
-
githubClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
|
|
190
|
-
} else {
|
|
191
|
-
delete githubClientInstance.defaults.headers["Authorization"];
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
131
|
// ../../private/config/src/integrations/github.ts
|
|
196
132
|
var GITHUB_CONFIG = {
|
|
197
133
|
url: "https://github.com/login/oauth/authorize",
|
|
@@ -287,6 +223,72 @@ var VERCEL_CONFIG = {
|
|
|
287
223
|
}
|
|
288
224
|
};
|
|
289
225
|
|
|
226
|
+
// src/apis/integrations/github/instance.ts
|
|
227
|
+
var import_axios = __toESM(require("axios"));
|
|
228
|
+
|
|
229
|
+
// src/types/errors/api.ts
|
|
230
|
+
var UnauthorizeApiError = class extends Error {
|
|
231
|
+
constructor(source) {
|
|
232
|
+
super("Unauthorized API call");
|
|
233
|
+
this.source = source;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// src/apis/integrations/github/instance.ts
|
|
238
|
+
var githubClientInstance = import_axios.default.create({
|
|
239
|
+
baseURL: "https://api.github.com",
|
|
240
|
+
headers: {
|
|
241
|
+
Accept: "application/vnd.github+json",
|
|
242
|
+
"Content-Type": "application/json"
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
githubClientInstance.interceptors.response.use(
|
|
246
|
+
(r) => r,
|
|
247
|
+
(error) => {
|
|
248
|
+
var _a;
|
|
249
|
+
if (import_axios.default.isAxiosError(error)) {
|
|
250
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
251
|
+
throw new UnauthorizeApiError("github");
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
throw error;
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
function getGitHubClientAuthorization(req) {
|
|
258
|
+
return {
|
|
259
|
+
tokens: {
|
|
260
|
+
app: req.headers["github-app-token"],
|
|
261
|
+
oauth: req.headers["github-oauth-token"]
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
function getGithubClientRequestConfig(options = {}) {
|
|
266
|
+
const currentHeaders = githubClientInstance.defaults.headers;
|
|
267
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
268
|
+
const headers = {
|
|
269
|
+
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
270
|
+
};
|
|
271
|
+
if (options.ensureAuthorizationToken && !headers.authorization) {
|
|
272
|
+
throw new UnauthorizeApiError("github");
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function initGithubClientInstance(token) {
|
|
279
|
+
if (token) {
|
|
280
|
+
updateGithubClientInstance(token);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function updateGithubClientInstance(token) {
|
|
284
|
+
const headers = githubClientInstance.defaults.headers;
|
|
285
|
+
if (token) {
|
|
286
|
+
headers.Authorization = `Bearer ${token}`;
|
|
287
|
+
} else {
|
|
288
|
+
delete headers.Authorization;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
290
292
|
// src/apis/integrations/github/installation/api.ts
|
|
291
293
|
var gitHubInstallationApi = {
|
|
292
294
|
getInstallation(account, authorization) {
|
|
@@ -364,7 +366,7 @@ var gitHubRepositoryApi = {
|
|
|
364
366
|
})
|
|
365
367
|
);
|
|
366
368
|
const branch = response.data.find(
|
|
367
|
-
(
|
|
369
|
+
(innerBranch) => innerBranch.name === repositoryBranch
|
|
368
370
|
);
|
|
369
371
|
if (!branch) {
|
|
370
372
|
throw new Error("Branch not found");
|
|
@@ -480,18 +482,18 @@ var gitHubRepositoryApi = {
|
|
|
480
482
|
);
|
|
481
483
|
return response.data.content;
|
|
482
484
|
});
|
|
483
|
-
let seed
|
|
485
|
+
let seed;
|
|
484
486
|
try {
|
|
485
487
|
seed = yield this.getRepositorySeed(repositoryName, authorization);
|
|
486
488
|
} catch (e) {
|
|
487
489
|
}
|
|
488
|
-
return
|
|
490
|
+
return upsert(seed == null ? void 0 : seed.sha);
|
|
489
491
|
});
|
|
490
492
|
},
|
|
491
493
|
deleteRepository(repositoryName, authorization) {
|
|
492
494
|
return __async(this, null, function* () {
|
|
493
495
|
var _a;
|
|
494
|
-
return
|
|
496
|
+
return githubClientInstance.delete(
|
|
495
497
|
`/repos/${repositoryName}`,
|
|
496
498
|
getGithubClientRequestConfig({
|
|
497
499
|
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
|
|
@@ -667,7 +669,7 @@ var gitHubApi = {
|
|
|
667
669
|
}
|
|
668
670
|
}
|
|
669
671
|
);
|
|
670
|
-
|
|
672
|
+
const params = new URLSearchParams(response.data);
|
|
671
673
|
return (_a = params.get("access_token")) != null ? _a : "";
|
|
672
674
|
});
|
|
673
675
|
}
|
|
@@ -678,7 +680,7 @@ var import_axios3 = __toESM(require("axios"));
|
|
|
678
680
|
var netlifyClientInstance = import_axios3.default.create({
|
|
679
681
|
baseURL: "https://api.netlify.com/api/v1",
|
|
680
682
|
headers: {
|
|
681
|
-
|
|
683
|
+
"Content-Type": "application/json"
|
|
682
684
|
}
|
|
683
685
|
});
|
|
684
686
|
netlifyClientInstance.interceptors.response.use(
|
|
@@ -687,7 +689,7 @@ netlifyClientInstance.interceptors.response.use(
|
|
|
687
689
|
var _a;
|
|
688
690
|
if (import_axios3.default.isAxiosError(error)) {
|
|
689
691
|
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
690
|
-
|
|
692
|
+
throw new UnauthorizeApiError("netlify");
|
|
691
693
|
}
|
|
692
694
|
}
|
|
693
695
|
throw error;
|
|
@@ -699,7 +701,8 @@ function getNetlifyClientAuthorization(req) {
|
|
|
699
701
|
};
|
|
700
702
|
}
|
|
701
703
|
function getNetlifyClientConfig(options = {}) {
|
|
702
|
-
const
|
|
704
|
+
const currentHeaders = netlifyClientInstance.defaults.headers;
|
|
705
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
703
706
|
const headers = {
|
|
704
707
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
705
708
|
};
|
|
@@ -716,10 +719,11 @@ function initNetlifyClientInstance(token) {
|
|
|
716
719
|
}
|
|
717
720
|
}
|
|
718
721
|
function updateNetlifyClientInstance(token) {
|
|
722
|
+
const headers = netlifyClientInstance.defaults.headers;
|
|
719
723
|
if (token) {
|
|
720
|
-
|
|
724
|
+
headers.Authorization = `Bearer ${token}`;
|
|
721
725
|
} else {
|
|
722
|
-
delete
|
|
726
|
+
delete headers.Authorization;
|
|
723
727
|
}
|
|
724
728
|
}
|
|
725
729
|
|
|
@@ -738,14 +742,15 @@ var netlifyAccountApi = {
|
|
|
738
742
|
},
|
|
739
743
|
getAccountEnvs(accountId, siteId, authorization) {
|
|
740
744
|
return __async(this, null, function* () {
|
|
741
|
-
|
|
742
|
-
|
|
745
|
+
let targetAccountId = accountId;
|
|
746
|
+
if (!targetAccountId) {
|
|
747
|
+
targetAccountId = yield this.getAccount(authorization);
|
|
743
748
|
}
|
|
744
|
-
if (!
|
|
749
|
+
if (!targetAccountId) {
|
|
745
750
|
throw new Error("No account");
|
|
746
751
|
}
|
|
747
752
|
const { data: envs } = yield netlifyClientInstance.get(
|
|
748
|
-
`/accounts/${
|
|
753
|
+
`/accounts/${targetAccountId}/env?site_id=${siteId}&scope=all&context=all&level=all`,
|
|
749
754
|
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
750
755
|
ensureAuthorizationToken: true
|
|
751
756
|
}))
|
|
@@ -755,14 +760,15 @@ var netlifyAccountApi = {
|
|
|
755
760
|
},
|
|
756
761
|
getAccountEnv(accountId, siteId, envKey, authorization) {
|
|
757
762
|
return __async(this, null, function* () {
|
|
758
|
-
|
|
759
|
-
|
|
763
|
+
let targetAccountId = accountId;
|
|
764
|
+
if (!targetAccountId) {
|
|
765
|
+
targetAccountId = yield this.getAccount(authorization);
|
|
760
766
|
}
|
|
761
|
-
if (!
|
|
767
|
+
if (!targetAccountId) {
|
|
762
768
|
throw new Error("No account");
|
|
763
769
|
}
|
|
764
770
|
const { data: envs } = yield netlifyClientInstance.get(
|
|
765
|
-
`/accounts/${
|
|
771
|
+
`/accounts/${targetAccountId}/env/${envKey}?site_id=${siteId}`,
|
|
766
772
|
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
767
773
|
ensureAuthorizationToken: true
|
|
768
774
|
}))
|
|
@@ -772,25 +778,27 @@ var netlifyAccountApi = {
|
|
|
772
778
|
},
|
|
773
779
|
createAccountEnv(accountId, siteId, envName, envValue, envs, authorization) {
|
|
774
780
|
return __async(this, null, function* () {
|
|
775
|
-
|
|
776
|
-
|
|
781
|
+
let targetAccountId = accountId;
|
|
782
|
+
let targetEnvs = envs;
|
|
783
|
+
if (!targetAccountId) {
|
|
784
|
+
targetAccountId = yield this.getAccount(authorization);
|
|
777
785
|
}
|
|
778
|
-
if (!
|
|
786
|
+
if (!targetAccountId) {
|
|
779
787
|
throw new Error("No account");
|
|
780
788
|
}
|
|
781
|
-
if (!
|
|
789
|
+
if (!targetEnvs) {
|
|
782
790
|
const response = yield netlifyClientInstance.get(
|
|
783
|
-
`/accounts/${
|
|
791
|
+
`/accounts/${targetAccountId}/env?site_id=${siteId}&scope=all&context=all&level=all`,
|
|
784
792
|
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
785
793
|
ensureAuthorizationToken: true
|
|
786
794
|
}))
|
|
787
795
|
);
|
|
788
|
-
|
|
796
|
+
targetEnvs = response.data;
|
|
789
797
|
}
|
|
790
|
-
const existingEnv =
|
|
798
|
+
const existingEnv = targetEnvs.find((env) => env.key === envName);
|
|
791
799
|
if (existingEnv) {
|
|
792
800
|
yield netlifyClientInstance.put(
|
|
793
|
-
`/accounts/${
|
|
801
|
+
`/accounts/${targetAccountId}/env/${existingEnv.key}?site_id=${siteId}`,
|
|
794
802
|
{
|
|
795
803
|
key: existingEnv.key,
|
|
796
804
|
scopes: ["builds", "functions", "runtime", "post_processing"],
|
|
@@ -802,7 +810,7 @@ var netlifyAccountApi = {
|
|
|
802
810
|
);
|
|
803
811
|
} else {
|
|
804
812
|
yield netlifyClientInstance.post(
|
|
805
|
-
`/accounts/${
|
|
813
|
+
`/accounts/${targetAccountId}/env?site_id=${siteId}`,
|
|
806
814
|
[
|
|
807
815
|
{
|
|
808
816
|
key: envName,
|
|
@@ -838,19 +846,19 @@ var netlifyAccountApi = {
|
|
|
838
846
|
},
|
|
839
847
|
removeAccountEnv(accountId, siteId, envKey, authorization) {
|
|
840
848
|
return __async(this, null, function* () {
|
|
841
|
-
|
|
842
|
-
|
|
849
|
+
let targetAccountId = accountId;
|
|
850
|
+
if (!targetAccountId) {
|
|
851
|
+
targetAccountId = yield this.getAccount(authorization);
|
|
843
852
|
}
|
|
844
853
|
if (!accountId) {
|
|
845
854
|
throw new Error("No account");
|
|
846
855
|
}
|
|
847
|
-
|
|
848
|
-
`/accounts/${
|
|
856
|
+
yield netlifyClientInstance.delete(
|
|
857
|
+
`/accounts/${targetAccountId}/env/${envKey}?site_id=${siteId}`,
|
|
849
858
|
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
850
859
|
ensureAuthorizationToken: true
|
|
851
860
|
}))
|
|
852
861
|
);
|
|
853
|
-
return response.data;
|
|
854
862
|
});
|
|
855
863
|
}
|
|
856
864
|
};
|
|
@@ -860,7 +868,7 @@ var netlifyHookApi = {
|
|
|
860
868
|
addBuildHooks(siteId, authorization) {
|
|
861
869
|
return __async(this, null, function* () {
|
|
862
870
|
try {
|
|
863
|
-
netlifyClientInstance.post(
|
|
871
|
+
yield netlifyClientInstance.post(
|
|
864
872
|
"/hooks",
|
|
865
873
|
{
|
|
866
874
|
site_id: siteId,
|
|
@@ -877,7 +885,7 @@ var netlifyHookApi = {
|
|
|
877
885
|
} catch (e) {
|
|
878
886
|
}
|
|
879
887
|
try {
|
|
880
|
-
netlifyClientInstance.post(
|
|
888
|
+
yield netlifyClientInstance.post(
|
|
881
889
|
"/hooks",
|
|
882
890
|
{
|
|
883
891
|
site_id: siteId,
|
|
@@ -894,7 +902,7 @@ var netlifyHookApi = {
|
|
|
894
902
|
} catch (e) {
|
|
895
903
|
}
|
|
896
904
|
try {
|
|
897
|
-
netlifyClientInstance.post(
|
|
905
|
+
yield netlifyClientInstance.post(
|
|
898
906
|
"/hooks",
|
|
899
907
|
{
|
|
900
908
|
site_id: siteId,
|
|
@@ -963,7 +971,7 @@ var netlifySiteApi = {
|
|
|
963
971
|
}))
|
|
964
972
|
);
|
|
965
973
|
const deploy = deploys.filter(
|
|
966
|
-
(
|
|
974
|
+
(innerDeploy) => innerDeploy.context === "production"
|
|
967
975
|
)[0];
|
|
968
976
|
const { data: pluginRuns } = yield netlifyClientInstance.get(
|
|
969
977
|
`/deploys/${deploy.id}/plugin_runs`,
|
|
@@ -999,20 +1007,23 @@ var netlifySiteApi = {
|
|
|
999
1007
|
},
|
|
1000
1008
|
createSiteByInstallationId(name, repositoryFullName, target, installationId, branch, authorization) {
|
|
1001
1009
|
return __async(this, null, function* () {
|
|
1002
|
-
const config =
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1010
|
+
const config = (
|
|
1011
|
+
// eslint-disable-next-line no-nested-ternary -- fix me
|
|
1012
|
+
target === "nextjs" ? {
|
|
1013
|
+
plugins: ["@netlify/plugin-nextjs"],
|
|
1014
|
+
packages: [{ package: "@netlify/plugin-nextjs" }],
|
|
1015
|
+
dir: ".next",
|
|
1016
|
+
cmd: "npm run build"
|
|
1017
|
+
} : target === "node" ? {
|
|
1018
|
+
plugins: [],
|
|
1019
|
+
dir: "dist",
|
|
1020
|
+
cmd: "npm run build"
|
|
1021
|
+
} : {
|
|
1022
|
+
plugin: [],
|
|
1023
|
+
dir: ".",
|
|
1024
|
+
cmd: ""
|
|
1025
|
+
}
|
|
1026
|
+
);
|
|
1016
1027
|
const response = yield netlifyClientInstance.post(
|
|
1017
1028
|
`/sites`,
|
|
1018
1029
|
{
|
|
@@ -1043,19 +1054,22 @@ var netlifySiteApi = {
|
|
|
1043
1054
|
},
|
|
1044
1055
|
createSiteByDeployKey(name, repositoryFullName, target, deployKeyId, branch, authorization) {
|
|
1045
1056
|
return __async(this, null, function* () {
|
|
1046
|
-
const config =
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1057
|
+
const config = (
|
|
1058
|
+
// eslint-disable-next-line no-nested-ternary -- fix me
|
|
1059
|
+
target === "nextjs" ? {
|
|
1060
|
+
packages: [{ package: "@netlify/plugin-nextjs" }],
|
|
1061
|
+
dir: ".next",
|
|
1062
|
+
cmd: "npm run build"
|
|
1063
|
+
} : target === "node" ? {
|
|
1064
|
+
packages: [],
|
|
1065
|
+
dir: "dist",
|
|
1066
|
+
cmd: "npm run build"
|
|
1067
|
+
} : {
|
|
1068
|
+
packages: [],
|
|
1069
|
+
dir: ".",
|
|
1070
|
+
cmd: ""
|
|
1071
|
+
}
|
|
1072
|
+
);
|
|
1059
1073
|
const response = yield netlifyClientInstance.post(
|
|
1060
1074
|
`/sites`,
|
|
1061
1075
|
{
|
|
@@ -1084,13 +1098,12 @@ var netlifySiteApi = {
|
|
|
1084
1098
|
},
|
|
1085
1099
|
removeSite(siteId, authorization) {
|
|
1086
1100
|
return __async(this, null, function* () {
|
|
1087
|
-
|
|
1101
|
+
yield netlifyClientInstance.delete(
|
|
1088
1102
|
`/sites/${siteId}`,
|
|
1089
1103
|
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1090
1104
|
ensureAuthorizationToken: true
|
|
1091
1105
|
}))
|
|
1092
1106
|
);
|
|
1093
|
-
return response.data;
|
|
1094
1107
|
});
|
|
1095
1108
|
},
|
|
1096
1109
|
triggerSiteBuild(siteId, authorization) {
|
|
@@ -1203,14 +1216,12 @@ var netlifySiteApi = {
|
|
|
1203
1216
|
{
|
|
1204
1217
|
general_position: "footer",
|
|
1205
1218
|
title: "sentry",
|
|
1206
|
-
// eslint-disable-next-line no-useless-escape
|
|
1207
1219
|
general: `<script src='https://js.sentry-cdn.com/${projectKey}.min.js' crossorigin="anonymous"></script>`
|
|
1208
1220
|
},
|
|
1209
1221
|
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1210
1222
|
ensureAuthorizationToken: true
|
|
1211
1223
|
}))
|
|
1212
1224
|
);
|
|
1213
|
-
return;
|
|
1214
1225
|
});
|
|
1215
1226
|
}
|
|
1216
1227
|
};
|
|
@@ -1237,7 +1248,7 @@ planetScaleClientInstance.interceptors.response.use(
|
|
|
1237
1248
|
var _a;
|
|
1238
1249
|
if (import_axios4.default.isAxiosError(error)) {
|
|
1239
1250
|
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
1240
|
-
|
|
1251
|
+
throw new UnauthorizeApiError("planetscale");
|
|
1241
1252
|
}
|
|
1242
1253
|
}
|
|
1243
1254
|
throw error;
|
|
@@ -1249,7 +1260,8 @@ function getPlanetScaleClientAuthorization(req) {
|
|
|
1249
1260
|
};
|
|
1250
1261
|
}
|
|
1251
1262
|
function getPlanetScaleClientConfig(options = {}) {
|
|
1252
|
-
const
|
|
1263
|
+
const currentHeaders = planetScaleClientInstance.defaults.headers;
|
|
1264
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
1253
1265
|
const headers = {
|
|
1254
1266
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `${options.token}` : void 0
|
|
1255
1267
|
};
|
|
@@ -1266,10 +1278,11 @@ function initPlanetScaleClientInstance(token) {
|
|
|
1266
1278
|
}
|
|
1267
1279
|
}
|
|
1268
1280
|
function updatePlanetScaleClientInstance(token) {
|
|
1281
|
+
const headers = planetScaleClientInstance.defaults.headers;
|
|
1269
1282
|
if (token) {
|
|
1270
|
-
|
|
1283
|
+
headers.Authorization = `${token}`;
|
|
1271
1284
|
} else {
|
|
1272
|
-
delete
|
|
1285
|
+
delete headers.Authorization;
|
|
1273
1286
|
}
|
|
1274
1287
|
}
|
|
1275
1288
|
|
|
@@ -1453,7 +1466,7 @@ var import_axios6 = __toESM(require("axios"));
|
|
|
1453
1466
|
var sentryClientInstance = import_axios6.default.create({
|
|
1454
1467
|
baseURL: "https://sentry.io/api/0/",
|
|
1455
1468
|
headers: {
|
|
1456
|
-
|
|
1469
|
+
"Content-Type": "application/json"
|
|
1457
1470
|
}
|
|
1458
1471
|
});
|
|
1459
1472
|
sentryClientInstance.interceptors.response.use(
|
|
@@ -1462,7 +1475,7 @@ sentryClientInstance.interceptors.response.use(
|
|
|
1462
1475
|
var _a;
|
|
1463
1476
|
if (import_axios6.default.isAxiosError(error)) {
|
|
1464
1477
|
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
1465
|
-
|
|
1478
|
+
throw new UnauthorizeApiError("sentry");
|
|
1466
1479
|
}
|
|
1467
1480
|
}
|
|
1468
1481
|
throw error;
|
|
@@ -1474,7 +1487,8 @@ function getSentryClientAuthorization(req) {
|
|
|
1474
1487
|
};
|
|
1475
1488
|
}
|
|
1476
1489
|
function getSentryClientConfig(options = {}) {
|
|
1477
|
-
const
|
|
1490
|
+
const currentHeaders = sentryClientInstance.defaults.headers;
|
|
1491
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
1478
1492
|
const headers = {
|
|
1479
1493
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
1480
1494
|
};
|
|
@@ -1492,10 +1506,11 @@ function initSentryClientInstance(token) {
|
|
|
1492
1506
|
}
|
|
1493
1507
|
}
|
|
1494
1508
|
function updateSentryClientInstance(token) {
|
|
1509
|
+
const headers = sentryClientInstance.defaults.headers;
|
|
1495
1510
|
if (token) {
|
|
1496
|
-
|
|
1511
|
+
headers.Authorization = `Bearer ${token}`;
|
|
1497
1512
|
} else {
|
|
1498
|
-
delete
|
|
1513
|
+
delete headers.Authorization;
|
|
1499
1514
|
}
|
|
1500
1515
|
}
|
|
1501
1516
|
|
|
@@ -1628,7 +1643,7 @@ var sentryApi = {
|
|
|
1628
1643
|
},
|
|
1629
1644
|
createRepo(organizationSlug, projectId, repositoryFullName, repositoryBranch, githubIntegrationId, authorization) {
|
|
1630
1645
|
return __async(this, null, function* () {
|
|
1631
|
-
var _a, _b
|
|
1646
|
+
var _a, _b;
|
|
1632
1647
|
let repository;
|
|
1633
1648
|
try {
|
|
1634
1649
|
const response = yield sentryClientInstance.post(
|
|
@@ -1645,7 +1660,7 @@ var sentryApi = {
|
|
|
1645
1660
|
repository = response.data;
|
|
1646
1661
|
} catch (err) {
|
|
1647
1662
|
const error = err;
|
|
1648
|
-
if (((
|
|
1663
|
+
if (((_a = error.response) == null ? void 0 : _a.data.error_type) === "validation" || ((_b = error.response) == null ? void 0 : _b.data.error_type) === "unknown") {
|
|
1649
1664
|
throw error;
|
|
1650
1665
|
}
|
|
1651
1666
|
const response = yield sentryClientInstance.get(
|
|
@@ -1705,10 +1720,7 @@ var sentryApi = {
|
|
|
1705
1720
|
);
|
|
1706
1721
|
} catch (error) {
|
|
1707
1722
|
if (((_a = error.response) == null ? void 0 : _a.status) === 409) {
|
|
1708
|
-
return
|
|
1709
|
-
`${organizationSlug}/${name}`,
|
|
1710
|
-
authorization
|
|
1711
|
-
);
|
|
1723
|
+
return this.getProject(`${organizationSlug}/${name}`, authorization);
|
|
1712
1724
|
}
|
|
1713
1725
|
throw error;
|
|
1714
1726
|
}
|
|
@@ -1716,13 +1728,12 @@ var sentryApi = {
|
|
|
1716
1728
|
},
|
|
1717
1729
|
deleteProject(projectFullName, authorization) {
|
|
1718
1730
|
return __async(this, null, function* () {
|
|
1719
|
-
|
|
1731
|
+
yield sentryClientInstance.delete(
|
|
1720
1732
|
`/projects/${projectFullName}/`,
|
|
1721
1733
|
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1722
1734
|
ensureAuthorizationToken: true
|
|
1723
1735
|
}))
|
|
1724
1736
|
);
|
|
1725
|
-
return response.data;
|
|
1726
1737
|
});
|
|
1727
1738
|
}
|
|
1728
1739
|
};
|
|
@@ -1739,7 +1750,8 @@ function getTextClientAuthorization(req) {
|
|
|
1739
1750
|
};
|
|
1740
1751
|
}
|
|
1741
1752
|
function getTextClientConfig(option = {}) {
|
|
1742
|
-
const
|
|
1753
|
+
const currentHeaders = textClientInstance.defaults.headers;
|
|
1754
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
1743
1755
|
const headers = {
|
|
1744
1756
|
authorization: defaultAuthorization != null ? defaultAuthorization : option.token ? `Bearer ${option.token}` : void 0
|
|
1745
1757
|
};
|
|
@@ -1748,19 +1760,20 @@ function getTextClientConfig(option = {}) {
|
|
|
1748
1760
|
};
|
|
1749
1761
|
}
|
|
1750
1762
|
function initTextClientInstance(baseUrl, token) {
|
|
1763
|
+
const headers = textClientInstance.defaults.headers;
|
|
1751
1764
|
if (baseUrl) {
|
|
1752
1765
|
textClientInstance.interceptors.request.use(
|
|
1753
|
-
(config) =>
|
|
1766
|
+
(config) => {
|
|
1754
1767
|
config.baseURL = baseUrl;
|
|
1755
1768
|
return config;
|
|
1756
|
-
}
|
|
1769
|
+
},
|
|
1757
1770
|
(error) => Promise.reject(error)
|
|
1758
1771
|
);
|
|
1759
1772
|
}
|
|
1760
1773
|
if (token) {
|
|
1761
|
-
|
|
1774
|
+
headers.Authorization = `Bearer ${token}`;
|
|
1762
1775
|
} else {
|
|
1763
|
-
delete
|
|
1776
|
+
delete headers.Authorization;
|
|
1764
1777
|
}
|
|
1765
1778
|
}
|
|
1766
1779
|
|
|
@@ -1801,12 +1814,11 @@ var textAppMonitoringEventsApi = {
|
|
|
1801
1814
|
upsertEvent(appId, event, authorization) {
|
|
1802
1815
|
return __async(this, null, function* () {
|
|
1803
1816
|
try {
|
|
1804
|
-
|
|
1817
|
+
yield textClientInstance.post(
|
|
1805
1818
|
`/app_monitoring/${appId}/events/${event.key}`,
|
|
1806
1819
|
event,
|
|
1807
1820
|
getTextClientConfig(authorization)
|
|
1808
1821
|
);
|
|
1809
|
-
return response.data;
|
|
1810
1822
|
} catch (error) {
|
|
1811
1823
|
if (error instanceof Error) {
|
|
1812
1824
|
throw new Error(`Couldn't upsert event. [${error.message}]`);
|
|
@@ -1818,11 +1830,10 @@ var textAppMonitoringEventsApi = {
|
|
|
1818
1830
|
deleteEvent(appId, eventKey, authorization) {
|
|
1819
1831
|
return __async(this, null, function* () {
|
|
1820
1832
|
try {
|
|
1821
|
-
|
|
1833
|
+
yield textClientInstance.delete(
|
|
1822
1834
|
`/app_monitoring/${appId}/events/${eventKey}`,
|
|
1823
1835
|
getTextClientConfig(authorization)
|
|
1824
1836
|
);
|
|
1825
|
-
return response.data;
|
|
1826
1837
|
} catch (error) {
|
|
1827
1838
|
if (error instanceof Error) {
|
|
1828
1839
|
throw new Error(`Couldn't delete event. [${error.message}]`);
|
|
@@ -1834,12 +1845,11 @@ var textAppMonitoringEventsApi = {
|
|
|
1834
1845
|
sendEvent(appId, data, authorization) {
|
|
1835
1846
|
return __async(this, null, function* () {
|
|
1836
1847
|
try {
|
|
1837
|
-
|
|
1848
|
+
yield textClientInstance.post(
|
|
1838
1849
|
`/app_monitoring/${appId}/events`,
|
|
1839
1850
|
data,
|
|
1840
1851
|
getTextClientConfig(authorization)
|
|
1841
1852
|
);
|
|
1842
|
-
return response.data;
|
|
1843
1853
|
} catch (error) {
|
|
1844
1854
|
if (error instanceof Error) {
|
|
1845
1855
|
throw new Error(`Couldn't send events. [${error.message}]`);
|
|
@@ -1857,7 +1867,9 @@ var textAppMonitoringEventsApi = {
|
|
|
1857
1867
|
search: (_b = payload.search) != null ? _b : ""
|
|
1858
1868
|
});
|
|
1859
1869
|
if (payload.type) {
|
|
1860
|
-
payload.type.forEach((type) =>
|
|
1870
|
+
payload.type.forEach((type) => {
|
|
1871
|
+
searchParams.append("type[]", type);
|
|
1872
|
+
});
|
|
1861
1873
|
}
|
|
1862
1874
|
const response = yield textClientInstance.get(
|
|
1863
1875
|
`/app_monitoring/${appId}/events?${searchParams.toString()}`,
|
|
@@ -1969,12 +1981,11 @@ var textAppMonitoringReportsApi = {
|
|
|
1969
1981
|
createCustomReport(appId, customReport, authorization) {
|
|
1970
1982
|
return __async(this, null, function* () {
|
|
1971
1983
|
try {
|
|
1972
|
-
|
|
1984
|
+
yield textClientInstance.post(
|
|
1973
1985
|
`/app_monitoring/${appId}/reports/custom`,
|
|
1974
1986
|
customReport,
|
|
1975
1987
|
getTextClientConfig(authorization)
|
|
1976
1988
|
);
|
|
1977
|
-
return response.data;
|
|
1978
1989
|
} catch (error) {
|
|
1979
1990
|
if (error instanceof Error) {
|
|
1980
1991
|
throw new Error(`Couldn't create custom report. [${error.message}]`);
|
|
@@ -1986,12 +1997,11 @@ var textAppMonitoringReportsApi = {
|
|
|
1986
1997
|
updateCustomReport(appId, customReport, authorization) {
|
|
1987
1998
|
return __async(this, null, function* () {
|
|
1988
1999
|
try {
|
|
1989
|
-
|
|
2000
|
+
yield textClientInstance.post(
|
|
1990
2001
|
`/app_monitoring/${appId}/reports/custom/${customReport.id}`,
|
|
1991
2002
|
customReport,
|
|
1992
2003
|
getTextClientConfig(authorization)
|
|
1993
2004
|
);
|
|
1994
|
-
return response.data;
|
|
1995
2005
|
} catch (error) {
|
|
1996
2006
|
if (error instanceof Error) {
|
|
1997
2007
|
throw new Error(`Couldn't update custom report. [${error.message}]`);
|
|
@@ -2003,11 +2013,10 @@ var textAppMonitoringReportsApi = {
|
|
|
2003
2013
|
deleteCustomReport(appId, customReportId, authorization) {
|
|
2004
2014
|
return __async(this, null, function* () {
|
|
2005
2015
|
try {
|
|
2006
|
-
|
|
2016
|
+
yield textClientInstance.delete(
|
|
2007
2017
|
`/app_monitoring/${appId}/reports/custom/${customReportId}`,
|
|
2008
2018
|
getTextClientConfig(authorization)
|
|
2009
2019
|
);
|
|
2010
|
-
return response.data;
|
|
2011
2020
|
} catch (error) {
|
|
2012
2021
|
if (error instanceof Error) {
|
|
2013
2022
|
throw new Error(`Couldn't delete custom report. [${error.message}]`);
|
|
@@ -2048,7 +2057,7 @@ vercelClientInstance.interceptors.response.use(
|
|
|
2048
2057
|
var _a;
|
|
2049
2058
|
if (import_axios8.default.isAxiosError(error)) {
|
|
2050
2059
|
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
2051
|
-
|
|
2060
|
+
throw new UnauthorizeApiError("vercel");
|
|
2052
2061
|
}
|
|
2053
2062
|
}
|
|
2054
2063
|
throw error;
|
|
@@ -2060,7 +2069,8 @@ function getVercelClientAuthorization(req) {
|
|
|
2060
2069
|
};
|
|
2061
2070
|
}
|
|
2062
2071
|
function getVercelClientConfig(options = {}) {
|
|
2063
|
-
const
|
|
2072
|
+
const currentHeaders = vercelClientInstance.defaults.headers;
|
|
2073
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
2064
2074
|
const headers = {
|
|
2065
2075
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
2066
2076
|
};
|
|
@@ -2077,10 +2087,11 @@ function initVercelClientInstance(token) {
|
|
|
2077
2087
|
}
|
|
2078
2088
|
}
|
|
2079
2089
|
function updateVercelClientInstance(token) {
|
|
2090
|
+
const headers = vercelClientInstance.defaults.headers;
|
|
2080
2091
|
if (token) {
|
|
2081
|
-
|
|
2092
|
+
headers.Authorization = `Bearer ${token}`;
|
|
2082
2093
|
} else {
|
|
2083
|
-
delete
|
|
2094
|
+
delete headers.Authorization;
|
|
2084
2095
|
}
|
|
2085
2096
|
}
|
|
2086
2097
|
|
|
@@ -2123,7 +2134,7 @@ var vercelIntegrationApi = {
|
|
|
2123
2134
|
var _a;
|
|
2124
2135
|
try {
|
|
2125
2136
|
const response = yield vercelClientInstance.get(
|
|
2126
|
-
`/v1/integrations/search-repo?provider=github${repositoryName ?
|
|
2137
|
+
`/v1/integrations/search-repo?provider=github${repositoryName ? `&query=${repositoryName}` : ""}${namespaceId ? `&namespaceId=${namespaceId}` : ""}`,
|
|
2127
2138
|
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2128
2139
|
ensureAuthorizationToken: true
|
|
2129
2140
|
}))
|
|
@@ -2146,7 +2157,6 @@ var vercelIntegrationApi = {
|
|
|
2146
2157
|
},
|
|
2147
2158
|
isRepositoryAccessible(repositoryName, authorization) {
|
|
2148
2159
|
return __async(this, null, function* () {
|
|
2149
|
-
var _a;
|
|
2150
2160
|
try {
|
|
2151
2161
|
const namespaces = yield this.getGitNamespaces(authorization);
|
|
2152
2162
|
const accessibleNamespaceId = namespaces.length > 0 ? (yield Promise.all(
|
|
@@ -2155,9 +2165,9 @@ var vercelIntegrationApi = {
|
|
|
2155
2165
|
)
|
|
2156
2166
|
)).map(
|
|
2157
2167
|
(repositories) => repositories.repos.length > 0 ? repositories.namespaceId : void 0
|
|
2158
|
-
)[0] : (
|
|
2168
|
+
)[0] : (yield this.getGitRepos(repositoryName, void 0, authorization)).namespaceId;
|
|
2159
2169
|
return {
|
|
2160
|
-
isAccessible:
|
|
2170
|
+
isAccessible: Boolean(accessibleNamespaceId),
|
|
2161
2171
|
installationId: accessibleNamespaceId
|
|
2162
2172
|
};
|
|
2163
2173
|
} catch (err) {
|
|
@@ -2264,15 +2274,16 @@ var vercelProjectApi = {
|
|
|
2264
2274
|
getProjectEnvByKey(projectId, envKey, authorization) {
|
|
2265
2275
|
return __async(this, null, function* () {
|
|
2266
2276
|
const envs = yield this.getProjectEnvs(projectId, authorization);
|
|
2267
|
-
const env = envs.find((
|
|
2277
|
+
const env = envs.find((innerEnv) => envKey === innerEnv.key);
|
|
2268
2278
|
if (!env) {
|
|
2269
2279
|
return;
|
|
2270
2280
|
}
|
|
2271
|
-
return
|
|
2281
|
+
return this.getProjectEnv(projectId, env.id, authorization);
|
|
2272
2282
|
});
|
|
2273
2283
|
},
|
|
2274
|
-
createProjectEnv(projectId, key, value,
|
|
2284
|
+
createProjectEnv(projectId, key, value, projectEnvs, authorization) {
|
|
2275
2285
|
return __async(this, null, function* () {
|
|
2286
|
+
let envs = projectEnvs;
|
|
2276
2287
|
if (!envs) {
|
|
2277
2288
|
const response = yield vercelClientInstance.get(`/v9/projects/${projectId}/env`, getVercelClientConfig(authorization));
|
|
2278
2289
|
envs = response.data.envs;
|
|
@@ -2280,7 +2291,7 @@ var vercelProjectApi = {
|
|
|
2280
2291
|
const existingEnv = envs.find((env) => env.key === key);
|
|
2281
2292
|
if (existingEnv) {
|
|
2282
2293
|
const { data: editedEnv } = yield vercelClientInstance.patch(
|
|
2283
|
-
`/v9/projects/${projectId}/env/${existingEnv
|
|
2294
|
+
`/v9/projects/${projectId}/env/${existingEnv.id}`,
|
|
2284
2295
|
{
|
|
2285
2296
|
key,
|
|
2286
2297
|
value,
|
|
@@ -2292,32 +2303,30 @@ var vercelProjectApi = {
|
|
|
2292
2303
|
}))
|
|
2293
2304
|
);
|
|
2294
2305
|
return editedEnv;
|
|
2295
|
-
} else {
|
|
2296
|
-
const { data: createdEnv } = yield vercelClientInstance.post(
|
|
2297
|
-
`/v9/projects/${projectId}/env`,
|
|
2298
|
-
{
|
|
2299
|
-
key,
|
|
2300
|
-
value,
|
|
2301
|
-
type: "encrypted",
|
|
2302
|
-
target: ["production", "preview", "development"]
|
|
2303
|
-
},
|
|
2304
|
-
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2305
|
-
ensureAuthorizationToken: true
|
|
2306
|
-
}))
|
|
2307
|
-
);
|
|
2308
|
-
return createdEnv;
|
|
2309
2306
|
}
|
|
2307
|
+
const { data: createdEnv } = yield vercelClientInstance.post(
|
|
2308
|
+
`/v9/projects/${projectId}/env`,
|
|
2309
|
+
{
|
|
2310
|
+
key,
|
|
2311
|
+
value,
|
|
2312
|
+
type: "encrypted",
|
|
2313
|
+
target: ["production", "preview", "development"]
|
|
2314
|
+
},
|
|
2315
|
+
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2316
|
+
ensureAuthorizationToken: true
|
|
2317
|
+
}))
|
|
2318
|
+
);
|
|
2319
|
+
return createdEnv;
|
|
2310
2320
|
});
|
|
2311
2321
|
},
|
|
2312
2322
|
removeProjectEnv(projectId, envId, authorization) {
|
|
2313
2323
|
return __async(this, null, function* () {
|
|
2314
|
-
|
|
2324
|
+
yield vercelClientInstance.delete(
|
|
2315
2325
|
`/v9/projects/${projectId}/env/${envId}`,
|
|
2316
2326
|
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2317
2327
|
ensureAuthorizationToken: true
|
|
2318
2328
|
}))
|
|
2319
2329
|
);
|
|
2320
|
-
return response.data;
|
|
2321
2330
|
});
|
|
2322
2331
|
}
|
|
2323
2332
|
};
|
|
@@ -2335,15 +2344,11 @@ var vercelApi = {
|
|
|
2335
2344
|
client_secret: clientSecret,
|
|
2336
2345
|
redirect_uri: redirectUrl
|
|
2337
2346
|
});
|
|
2338
|
-
const response = yield import_axios9.default.post(
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
{
|
|
2342
|
-
headers: {
|
|
2343
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
2344
|
-
}
|
|
2347
|
+
const response = yield import_axios9.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
|
|
2348
|
+
headers: {
|
|
2349
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
2345
2350
|
}
|
|
2346
|
-
);
|
|
2351
|
+
});
|
|
2347
2352
|
return {
|
|
2348
2353
|
token: response.data.access_token,
|
|
2349
2354
|
installationId: response.data.installation_id,
|
|
@@ -2378,7 +2383,6 @@ var getRegion = (token) => {
|
|
|
2378
2383
|
if (supportedRegions.includes(region)) {
|
|
2379
2384
|
return region;
|
|
2380
2385
|
}
|
|
2381
|
-
return void 0;
|
|
2382
2386
|
};
|
|
2383
2387
|
var livechatClientInstance = import_axios10.default.create({
|
|
2384
2388
|
baseURL: "https://api.labs.livechatinc.com"
|
|
@@ -2389,7 +2393,8 @@ function getLiveChatClientAuthorization(req) {
|
|
|
2389
2393
|
};
|
|
2390
2394
|
}
|
|
2391
2395
|
function getLiveChatClientConfig(options = {}) {
|
|
2392
|
-
const
|
|
2396
|
+
const currentHeaders = livechatClientInstance.defaults.headers;
|
|
2397
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
2393
2398
|
const headers = {
|
|
2394
2399
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
2395
2400
|
};
|
|
@@ -2399,22 +2404,23 @@ function getLiveChatClientConfig(options = {}) {
|
|
|
2399
2404
|
}
|
|
2400
2405
|
function initLiveChatClientInstance(baseUrl, token) {
|
|
2401
2406
|
const region = token ? getRegion(token) : void 0;
|
|
2407
|
+
const headers = livechatClientInstance.defaults.headers;
|
|
2402
2408
|
if (baseUrl) {
|
|
2403
2409
|
livechatClientInstance.interceptors.request.use(
|
|
2404
|
-
(config) =>
|
|
2410
|
+
(config) => {
|
|
2405
2411
|
config.baseURL = baseUrl;
|
|
2406
2412
|
return config;
|
|
2407
|
-
}
|
|
2413
|
+
},
|
|
2408
2414
|
(error) => Promise.reject(error)
|
|
2409
2415
|
);
|
|
2410
2416
|
}
|
|
2411
2417
|
if (region) {
|
|
2412
|
-
|
|
2418
|
+
headers["X-Region"] = region;
|
|
2413
2419
|
}
|
|
2414
2420
|
if (token) {
|
|
2415
|
-
|
|
2421
|
+
headers.Authorization = `Bearer ${token}`;
|
|
2416
2422
|
} else {
|
|
2417
|
-
delete
|
|
2423
|
+
delete headers.Authorization;
|
|
2418
2424
|
}
|
|
2419
2425
|
}
|
|
2420
2426
|
|
|
@@ -2562,7 +2568,7 @@ var livechatPropertyApi = {
|
|
|
2562
2568
|
try {
|
|
2563
2569
|
const response = yield Promise.all(
|
|
2564
2570
|
properties.filter((property) => property.public_access).map((property) => __async(this, null, function* () {
|
|
2565
|
-
return
|
|
2571
|
+
return livechatClientInstance.post(
|
|
2566
2572
|
`/v3.3/configuration/action/publish_property`,
|
|
2567
2573
|
{
|
|
2568
2574
|
name: property.name,
|
|
@@ -2587,7 +2593,7 @@ var livechatPropertyApi = {
|
|
|
2587
2593
|
try {
|
|
2588
2594
|
const response = yield Promise.all(
|
|
2589
2595
|
properties.map((property) => __async(this, null, function* () {
|
|
2590
|
-
return
|
|
2596
|
+
return livechatClientInstance.post(
|
|
2591
2597
|
`/v3.3/configuration/action/register_property`,
|
|
2592
2598
|
{
|
|
2593
2599
|
name: property.name,
|
|
@@ -2618,7 +2624,7 @@ var livechatPropertyApi = {
|
|
|
2618
2624
|
yield Promise.all(
|
|
2619
2625
|
Object.keys(properties).map((property) => __async(this, null, function* () {
|
|
2620
2626
|
if (Object.keys(properties[property]).indexOf("public_access") <= 0) {
|
|
2621
|
-
return
|
|
2627
|
+
return livechatClientInstance.post(
|
|
2622
2628
|
`/v3.3/configuration/action/unregister_property`,
|
|
2623
2629
|
{
|
|
2624
2630
|
name: property,
|
|
@@ -2695,7 +2701,7 @@ var livechatWebhookApi = {
|
|
|
2695
2701
|
const { data: webhooks } = yield this.getWebhooks(clientId);
|
|
2696
2702
|
yield Promise.all(
|
|
2697
2703
|
webhooks.map((webhook) => __async(this, null, function* () {
|
|
2698
|
-
return
|
|
2704
|
+
return livechatClientInstance.post(
|
|
2699
2705
|
`/v3.5/configuration/action/unregister_webhook`,
|
|
2700
2706
|
{
|
|
2701
2707
|
id: webhook.id,
|
|
@@ -2718,10 +2724,10 @@ var livechatWebhookApi = {
|
|
|
2718
2724
|
registerWebhooks(webhooks) {
|
|
2719
2725
|
return __async(this, null, function* () {
|
|
2720
2726
|
try {
|
|
2721
|
-
yield this.unregisterWebhooks(webhooks[0]
|
|
2727
|
+
yield this.unregisterWebhooks(webhooks[0].owner_client_id);
|
|
2722
2728
|
yield Promise.all(
|
|
2723
2729
|
webhooks.map((webhook) => __async(this, null, function* () {
|
|
2724
|
-
return
|
|
2730
|
+
return livechatClientInstance.post(
|
|
2725
2731
|
`/v${webhook.api_version || "3.5"}/configuration/action/register_webhook`,
|
|
2726
2732
|
{
|
|
2727
2733
|
url: webhook.url,
|
|
@@ -2756,10 +2762,9 @@ var livechatWebhookApi = {
|
|
|
2756
2762
|
filters: webhook.filters
|
|
2757
2763
|
};
|
|
2758
2764
|
});
|
|
2759
|
-
const { data: verifiedWebhooks } = yield livechatClientInstance.post(
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
);
|
|
2765
|
+
const { data: verifiedWebhooks } = yield livechatClientInstance.post(`/v3.3/configuration/action/check_webhooks_migration`, [
|
|
2766
|
+
...webhooksToCheck
|
|
2767
|
+
]);
|
|
2763
2768
|
const updatedWebhooks = webhooks.map((webhook, index) => {
|
|
2764
2769
|
return __spreadProps(__spreadValues({}, webhook), {
|
|
2765
2770
|
action: verifiedWebhooks[index].action
|
|
@@ -2881,6 +2886,58 @@ function initPlatformAccountsClientInstance(baseUrl, token) {
|
|
|
2881
2886
|
}
|
|
2882
2887
|
}
|
|
2883
2888
|
|
|
2889
|
+
// src/apis/platform/accounts/accounts/api.ts
|
|
2890
|
+
var platformAccountsAccountApi = {
|
|
2891
|
+
getAccounts(authorization) {
|
|
2892
|
+
return __async(this, null, function* () {
|
|
2893
|
+
try {
|
|
2894
|
+
return yield platformAccountsClientInstance.get(
|
|
2895
|
+
`/v2/accounts`,
|
|
2896
|
+
getPlatformAccountsClientConfig(authorization)
|
|
2897
|
+
);
|
|
2898
|
+
} catch (error) {
|
|
2899
|
+
if (error instanceof Error) {
|
|
2900
|
+
throw new Error(`Accounts couldn't be fetched. [${error.message}]`);
|
|
2901
|
+
} else {
|
|
2902
|
+
throw error;
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
});
|
|
2906
|
+
},
|
|
2907
|
+
getAccount(accountId, authorization) {
|
|
2908
|
+
return __async(this, null, function* () {
|
|
2909
|
+
try {
|
|
2910
|
+
return yield platformAccountsClientInstance.get(
|
|
2911
|
+
`/v2/accounts/${accountId}`,
|
|
2912
|
+
getPlatformAccountsClientConfig(authorization)
|
|
2913
|
+
);
|
|
2914
|
+
} catch (error) {
|
|
2915
|
+
if (error instanceof Error) {
|
|
2916
|
+
throw new Error(`Account couldn't be fetched. [${error.message}]`);
|
|
2917
|
+
} else {
|
|
2918
|
+
throw error;
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
});
|
|
2922
|
+
},
|
|
2923
|
+
getMeAccount(authorization) {
|
|
2924
|
+
return __async(this, null, function* () {
|
|
2925
|
+
try {
|
|
2926
|
+
return yield platformAccountsClientInstance.get(
|
|
2927
|
+
`/v2/accounts/me`,
|
|
2928
|
+
getPlatformAccountsClientConfig(authorization)
|
|
2929
|
+
);
|
|
2930
|
+
} catch (error) {
|
|
2931
|
+
if (error instanceof Error) {
|
|
2932
|
+
throw new Error(`Account couldn't be fetched. [${error.message}]`);
|
|
2933
|
+
} else {
|
|
2934
|
+
throw error;
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
});
|
|
2938
|
+
}
|
|
2939
|
+
};
|
|
2940
|
+
|
|
2884
2941
|
// src/apis/platform/accounts/client/api.ts
|
|
2885
2942
|
var platformAccountsClientApi = {
|
|
2886
2943
|
getClients(authorization) {
|
|
@@ -3169,6 +3226,7 @@ var platformAccountsSessionsApi = {
|
|
|
3169
3226
|
|
|
3170
3227
|
// src/apis/platform/accounts/api.ts
|
|
3171
3228
|
var platformAccountsApi = {
|
|
3229
|
+
account: platformAccountsAccountApi,
|
|
3172
3230
|
client: platformAccountsClientApi,
|
|
3173
3231
|
pat: platformAccountsPersonalAccessTokenApi,
|
|
3174
3232
|
products: platformAccountsProductsApi,
|
|
@@ -3189,14 +3247,16 @@ function getPlatformDpsClientAuthorization(req) {
|
|
|
3189
3247
|
};
|
|
3190
3248
|
}
|
|
3191
3249
|
function getPlatformDpsAdminClientAuthorization() {
|
|
3192
|
-
|
|
3250
|
+
var _a, _b;
|
|
3251
|
+
const token = process.env.NEXT_PUBLIC_PLATFORM_ENV === "prod" ? (_a = process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB) != null ? _a : "" : (_b = process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB_LABS) != null ? _b : "";
|
|
3193
3252
|
return {
|
|
3194
|
-
token: btoa(
|
|
3253
|
+
token: btoa(`apps@livechatinc.com:${token}`),
|
|
3195
3254
|
tokenType: "Basic"
|
|
3196
3255
|
};
|
|
3197
3256
|
}
|
|
3198
3257
|
function getPlatformDpsClientConfig(options = {}) {
|
|
3199
|
-
const
|
|
3258
|
+
const currentHeaders = platformDpsClientInstance.defaults.headers;
|
|
3259
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
3200
3260
|
const headers = {
|
|
3201
3261
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
3202
3262
|
};
|
|
@@ -3205,19 +3265,20 @@ function getPlatformDpsClientConfig(options = {}) {
|
|
|
3205
3265
|
};
|
|
3206
3266
|
}
|
|
3207
3267
|
function initPlatformDpsClientInstance(baseUrl, token) {
|
|
3268
|
+
const headers = platformDpsClientInstance.defaults.headers;
|
|
3208
3269
|
if (baseUrl) {
|
|
3209
3270
|
platformDpsClientInstance.interceptors.request.use(
|
|
3210
|
-
(config) =>
|
|
3271
|
+
(config) => {
|
|
3211
3272
|
config.baseURL = baseUrl;
|
|
3212
3273
|
return config;
|
|
3213
|
-
}
|
|
3274
|
+
},
|
|
3214
3275
|
(error) => Promise.reject(error)
|
|
3215
3276
|
);
|
|
3216
3277
|
}
|
|
3217
3278
|
if (token) {
|
|
3218
|
-
|
|
3279
|
+
headers.Authorization = `Bearer ${token}`;
|
|
3219
3280
|
} else {
|
|
3220
|
-
delete
|
|
3281
|
+
delete headers.Authorization;
|
|
3221
3282
|
}
|
|
3222
3283
|
}
|
|
3223
3284
|
|
|
@@ -3622,17 +3683,16 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3622
3683
|
},
|
|
3623
3684
|
updateBlocks(appId, payload, authorization) {
|
|
3624
3685
|
return __async(this, null, function* () {
|
|
3625
|
-
|
|
3686
|
+
yield platformDpsClientInstance.patch(
|
|
3626
3687
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3627
3688
|
payload,
|
|
3628
3689
|
getPlatformDpsClientConfig(authorization)
|
|
3629
3690
|
);
|
|
3630
|
-
return response.data;
|
|
3631
3691
|
});
|
|
3632
3692
|
},
|
|
3633
3693
|
updateRepository(appId, payload, authorization) {
|
|
3634
3694
|
return __async(this, null, function* () {
|
|
3635
|
-
|
|
3695
|
+
yield platformDpsClientInstance.patch(
|
|
3636
3696
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3637
3697
|
{
|
|
3638
3698
|
appId,
|
|
@@ -3642,13 +3702,12 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3642
3702
|
},
|
|
3643
3703
|
getPlatformDpsClientConfig(authorization)
|
|
3644
3704
|
);
|
|
3645
|
-
return response.data;
|
|
3646
3705
|
});
|
|
3647
3706
|
},
|
|
3648
3707
|
updateDeployment(appId, payload, authorization) {
|
|
3649
3708
|
return __async(this, null, function* () {
|
|
3650
3709
|
const config = payload.customUrl ? { custom: { url: payload.customUrl } } : { custom: null };
|
|
3651
|
-
|
|
3710
|
+
yield platformDpsClientInstance.patch(
|
|
3652
3711
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3653
3712
|
{
|
|
3654
3713
|
appId,
|
|
@@ -3660,12 +3719,11 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3660
3719
|
},
|
|
3661
3720
|
getPlatformDpsClientConfig(authorization)
|
|
3662
3721
|
);
|
|
3663
|
-
return response.data;
|
|
3664
3722
|
});
|
|
3665
3723
|
},
|
|
3666
3724
|
updateStorage(appId, payload, authorization) {
|
|
3667
3725
|
return __async(this, null, function* () {
|
|
3668
|
-
|
|
3726
|
+
yield platformDpsClientInstance.patch(
|
|
3669
3727
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3670
3728
|
{
|
|
3671
3729
|
appId,
|
|
@@ -3675,12 +3733,11 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3675
3733
|
},
|
|
3676
3734
|
getPlatformDpsClientConfig(authorization)
|
|
3677
3735
|
);
|
|
3678
|
-
return response.data;
|
|
3679
3736
|
});
|
|
3680
3737
|
},
|
|
3681
3738
|
updateLogger(appId, payload, authorization) {
|
|
3682
3739
|
return __async(this, null, function* () {
|
|
3683
|
-
|
|
3740
|
+
yield platformDpsClientInstance.post(
|
|
3684
3741
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3685
3742
|
{
|
|
3686
3743
|
appId,
|
|
@@ -3690,7 +3747,6 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3690
3747
|
},
|
|
3691
3748
|
getPlatformDpsClientConfig(authorization)
|
|
3692
3749
|
);
|
|
3693
|
-
return response.data;
|
|
3694
3750
|
});
|
|
3695
3751
|
}
|
|
3696
3752
|
};
|
|
@@ -4398,8 +4454,8 @@ var platformDpsDeveloperApi = {
|
|
|
4398
4454
|
return __async(this, null, function* () {
|
|
4399
4455
|
try {
|
|
4400
4456
|
const { startAt, endAt, size, page } = options;
|
|
4401
|
-
const withRange =
|
|
4402
|
-
const withPagination =
|
|
4457
|
+
const withRange = Boolean(startAt && endAt);
|
|
4458
|
+
const withPagination = Boolean(size && typeof page === "number");
|
|
4403
4459
|
let params = withRange || withPagination ? `?` : "";
|
|
4404
4460
|
if (withRange) {
|
|
4405
4461
|
params += `from=${startAt}&to=${endAt}`;
|
|
@@ -4579,7 +4635,7 @@ var dpsResearchDictionaryApi = {
|
|
|
4579
4635
|
try {
|
|
4580
4636
|
const params = new URLSearchParams(options);
|
|
4581
4637
|
const response = yield platformDpsClientInstance.get(
|
|
4582
|
-
`/v2/research/dictionary?${params}`,
|
|
4638
|
+
`/v2/research/dictionary?${params.toString()}`,
|
|
4583
4639
|
getPlatformDpsClientConfig(authorization)
|
|
4584
4640
|
);
|
|
4585
4641
|
return response.data;
|
|
@@ -4602,7 +4658,7 @@ var dpsResearchMarketplaceApi = {
|
|
|
4602
4658
|
try {
|
|
4603
4659
|
const params = new URLSearchParams(options);
|
|
4604
4660
|
const response = yield platformDpsClientInstance.get(
|
|
4605
|
-
`/v2/research/marketplace/apps?${params}`,
|
|
4661
|
+
`/v2/research/marketplace/apps?${params.toString()}`,
|
|
4606
4662
|
getPlatformDpsClientConfig(authorization)
|
|
4607
4663
|
);
|
|
4608
4664
|
return response.data;
|
|
@@ -4621,7 +4677,7 @@ var dpsResearchMarketplaceApi = {
|
|
|
4621
4677
|
try {
|
|
4622
4678
|
const params = new URLSearchParams(options);
|
|
4623
4679
|
const response = yield platformDpsClientInstance.get(
|
|
4624
|
-
`/v2/research/marketplace/views?${params}`,
|
|
4680
|
+
`/v2/research/marketplace/views?${params.toString()}`,
|
|
4625
4681
|
getPlatformDpsClientConfig(authorization)
|
|
4626
4682
|
);
|
|
4627
4683
|
return response.data;
|
|
@@ -4644,7 +4700,7 @@ var dpsResearchTrafficApi = {
|
|
|
4644
4700
|
try {
|
|
4645
4701
|
const params = new URLSearchParams(options);
|
|
4646
4702
|
const response = yield platformDpsClientInstance.get(
|
|
4647
|
-
`/v2/research/traffic/agents?${params}`,
|
|
4703
|
+
`/v2/research/traffic/agents?${params.toString()}`,
|
|
4648
4704
|
getPlatformDpsClientConfig(authorization)
|
|
4649
4705
|
);
|
|
4650
4706
|
return response.data;
|
|
@@ -4663,7 +4719,7 @@ var dpsResearchTrafficApi = {
|
|
|
4663
4719
|
try {
|
|
4664
4720
|
const params = new URLSearchParams(options);
|
|
4665
4721
|
const response = yield platformDpsClientInstance.get(
|
|
4666
|
-
`/v2/research/traffic/chats?${params}`,
|
|
4722
|
+
`/v2/research/traffic/chats?${params.toString()}`,
|
|
4667
4723
|
getPlatformDpsClientConfig(authorization)
|
|
4668
4724
|
);
|
|
4669
4725
|
return response.data;
|
|
@@ -4719,35 +4775,29 @@ var platformDpsUserApi = {
|
|
|
4719
4775
|
},
|
|
4720
4776
|
updateUserIntegrations(payload, authorization) {
|
|
4721
4777
|
return __async(this, null, function* () {
|
|
4722
|
-
|
|
4778
|
+
yield platformDpsClientInstance.patch(
|
|
4723
4779
|
`/v2/me/integrations`,
|
|
4724
4780
|
payload,
|
|
4725
4781
|
getPlatformDpsClientConfig(authorization)
|
|
4726
4782
|
);
|
|
4727
|
-
return response.data;
|
|
4728
4783
|
});
|
|
4729
4784
|
},
|
|
4730
4785
|
updateUserFeatures(payload, authorization) {
|
|
4731
4786
|
return __async(this, null, function* () {
|
|
4732
|
-
|
|
4787
|
+
yield platformDpsClientInstance.put(
|
|
4733
4788
|
"/v2/features",
|
|
4734
4789
|
payload,
|
|
4735
4790
|
getPlatformDpsClientConfig(authorization)
|
|
4736
4791
|
);
|
|
4737
|
-
return response.data;
|
|
4738
4792
|
});
|
|
4739
4793
|
},
|
|
4740
4794
|
removeUserGitHubIntegrationByInstallationId(installationId, authorization) {
|
|
4741
4795
|
return __async(this, null, function* () {
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
}
|
|
4748
|
-
})
|
|
4749
|
-
);
|
|
4750
|
-
return response.data;
|
|
4796
|
+
yield platformDpsClientInstance.delete(`/v2/me/integrations/github`, __spreadProps(__spreadValues({}, getPlatformDpsClientConfig(authorization)), {
|
|
4797
|
+
data: {
|
|
4798
|
+
githubInstallationId: installationId
|
|
4799
|
+
}
|
|
4800
|
+
}));
|
|
4751
4801
|
});
|
|
4752
4802
|
},
|
|
4753
4803
|
updateUserNetlifyIntegration(userNetlifyIntegration, authorization) {
|
|
@@ -4801,8 +4851,11 @@ platformAdapterClientInstance.interceptors.response.use(
|
|
|
4801
4851
|
(error) => {
|
|
4802
4852
|
var _a;
|
|
4803
4853
|
if (import_axios13.default.isAxiosError(error)) {
|
|
4804
|
-
if (((_a = error.response) == null ? void 0 : _a.status) === 401
|
|
4805
|
-
|
|
4854
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
4855
|
+
const source = error.response.data.error.source;
|
|
4856
|
+
if (source) {
|
|
4857
|
+
throw new UnauthorizeApiError(source);
|
|
4858
|
+
}
|
|
4806
4859
|
}
|
|
4807
4860
|
}
|
|
4808
4861
|
throw error;
|
|
@@ -4810,19 +4863,20 @@ platformAdapterClientInstance.interceptors.response.use(
|
|
|
4810
4863
|
);
|
|
4811
4864
|
function getPlatformAdapterClientConfig(options = {}) {
|
|
4812
4865
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
4866
|
+
const currentHeaders = platformAdapterClientInstance.defaults.headers;
|
|
4813
4867
|
const headers = {
|
|
4814
4868
|
platform: {
|
|
4815
|
-
dps: (_b =
|
|
4869
|
+
dps: (_b = currentHeaders["platform-dps-token"]) != null ? _b : (_a = options.platform) == null ? void 0 : _a.dps
|
|
4816
4870
|
},
|
|
4817
4871
|
integrations: {
|
|
4818
4872
|
github: {
|
|
4819
|
-
app: (_d =
|
|
4820
|
-
oauth: (_f =
|
|
4873
|
+
app: (_d = currentHeaders["github-app-token"]) != null ? _d : (_c = options.github) == null ? void 0 : _c.app,
|
|
4874
|
+
oauth: (_f = currentHeaders["github-oauth-token"]) != null ? _f : (_e = options.github) == null ? void 0 : _e.oauth
|
|
4821
4875
|
},
|
|
4822
|
-
netlify: (_g =
|
|
4823
|
-
vercel: (_h =
|
|
4824
|
-
planetscale: (_i =
|
|
4825
|
-
sentry: (_j =
|
|
4876
|
+
netlify: (_g = currentHeaders["netlify-token"]) != null ? _g : options.netlify,
|
|
4877
|
+
vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
|
|
4878
|
+
planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
|
|
4879
|
+
sentry: (_j = currentHeaders["sentry-token"]) != null ? _j : options.sentry
|
|
4826
4880
|
}
|
|
4827
4881
|
};
|
|
4828
4882
|
if (((_l = (_k = options.ensureAuthorizationToken) == null ? void 0 : _k.platform) == null ? void 0 : _l.dps) && !headers.platform.dps) {
|
|
@@ -4850,10 +4904,10 @@ function getPlatformAdapterClientConfig(options = {}) {
|
|
|
4850
4904
|
function initPlatformAdapterClientInstance(baseUrl, tokens) {
|
|
4851
4905
|
if (baseUrl) {
|
|
4852
4906
|
platformAdapterClientInstance.interceptors.request.use(
|
|
4853
|
-
(config) =>
|
|
4907
|
+
(config) => {
|
|
4854
4908
|
config.baseURL = baseUrl;
|
|
4855
4909
|
return config;
|
|
4856
|
-
}
|
|
4910
|
+
},
|
|
4857
4911
|
(error) => Promise.reject(error)
|
|
4858
4912
|
);
|
|
4859
4913
|
}
|
|
@@ -4863,26 +4917,27 @@ function initPlatformAdapterClientInstance(baseUrl, tokens) {
|
|
|
4863
4917
|
}
|
|
4864
4918
|
function updatePlatformAdapterClientInstance(tokens) {
|
|
4865
4919
|
var _a;
|
|
4920
|
+
const headers = platformAdapterClientInstance.defaults.headers;
|
|
4866
4921
|
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.dps) {
|
|
4867
|
-
|
|
4922
|
+
headers["platform-dps-token"] = tokens.platform.dps;
|
|
4868
4923
|
}
|
|
4869
4924
|
if (tokens == null ? void 0 : tokens.github.app) {
|
|
4870
|
-
|
|
4925
|
+
headers["github-app-token"] = tokens.github.app;
|
|
4871
4926
|
}
|
|
4872
4927
|
if (tokens == null ? void 0 : tokens.github.oauth) {
|
|
4873
|
-
|
|
4928
|
+
headers["github-oauth-token"] = tokens.github.oauth;
|
|
4874
4929
|
}
|
|
4875
4930
|
if (tokens == null ? void 0 : tokens.netlify) {
|
|
4876
|
-
|
|
4931
|
+
headers["netlify-token"] = tokens.netlify;
|
|
4877
4932
|
}
|
|
4878
4933
|
if (tokens == null ? void 0 : tokens.vercel) {
|
|
4879
|
-
|
|
4934
|
+
headers["vercel-token"] = tokens.vercel;
|
|
4880
4935
|
}
|
|
4881
4936
|
if (tokens == null ? void 0 : tokens.planetscale) {
|
|
4882
|
-
|
|
4937
|
+
headers["planetscale-token"] = tokens.planetscale;
|
|
4883
4938
|
}
|
|
4884
4939
|
if (tokens == null ? void 0 : tokens.sentry) {
|
|
4885
|
-
|
|
4940
|
+
headers["sentry-token"] = tokens.sentry;
|
|
4886
4941
|
}
|
|
4887
4942
|
}
|
|
4888
4943
|
|
|
@@ -4921,7 +4976,7 @@ var platformAdapterAppDeploymentApi = {
|
|
|
4921
4976
|
},
|
|
4922
4977
|
unlink(payload, authorization) {
|
|
4923
4978
|
return __async(this, null, function* () {
|
|
4924
|
-
|
|
4979
|
+
yield platformAdapterClientInstance.post(
|
|
4925
4980
|
`/console/app/${payload.appId}/blocks/deployment/unlink`,
|
|
4926
4981
|
payload,
|
|
4927
4982
|
getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -4932,12 +4987,11 @@ var platformAdapterAppDeploymentApi = {
|
|
|
4932
4987
|
}
|
|
4933
4988
|
}))
|
|
4934
4989
|
);
|
|
4935
|
-
return response.data;
|
|
4936
4990
|
});
|
|
4937
4991
|
},
|
|
4938
4992
|
installSentry(appId, authorization) {
|
|
4939
4993
|
return __async(this, null, function* () {
|
|
4940
|
-
|
|
4994
|
+
yield platformAdapterClientInstance.post(
|
|
4941
4995
|
`/console/app/${appId}/blocks/deployment/install/sentry`,
|
|
4942
4996
|
{},
|
|
4943
4997
|
getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -4948,7 +5002,6 @@ var platformAdapterAppDeploymentApi = {
|
|
|
4948
5002
|
}
|
|
4949
5003
|
}))
|
|
4950
5004
|
);
|
|
4951
|
-
return response.data;
|
|
4952
5005
|
});
|
|
4953
5006
|
}
|
|
4954
5007
|
};
|
|
@@ -4966,22 +5019,20 @@ var platformAdapterAppSentryLoggerApi = {
|
|
|
4966
5019
|
},
|
|
4967
5020
|
link(payload, authorization) {
|
|
4968
5021
|
return __async(this, null, function* () {
|
|
4969
|
-
|
|
5022
|
+
yield platformAdapterClientInstance.post(
|
|
4970
5023
|
"/console/app/blocks/logger/providers/sentry/link",
|
|
4971
5024
|
payload,
|
|
4972
5025
|
getPlatformAdapterClientConfig(authorization)
|
|
4973
5026
|
);
|
|
4974
|
-
return response.data;
|
|
4975
5027
|
});
|
|
4976
5028
|
},
|
|
4977
5029
|
unlink(payload, authorization) {
|
|
4978
5030
|
return __async(this, null, function* () {
|
|
4979
|
-
|
|
5031
|
+
yield platformAdapterClientInstance.post(
|
|
4980
5032
|
"/console/app/blocks/logger/providers/sentry/unlink",
|
|
4981
5033
|
payload,
|
|
4982
5034
|
getPlatformAdapterClientConfig(authorization)
|
|
4983
5035
|
);
|
|
4984
|
-
return response.data;
|
|
4985
5036
|
});
|
|
4986
5037
|
},
|
|
4987
5038
|
reauthorizeSentryApp(userId, sentryInstallationId, sentryRefreshToken, authorization) {
|
|
@@ -5054,7 +5105,7 @@ var platformAdapterAppRepositoryApi = {
|
|
|
5054
5105
|
},
|
|
5055
5106
|
unlink(payload, authorization) {
|
|
5056
5107
|
return __async(this, null, function* () {
|
|
5057
|
-
|
|
5108
|
+
yield platformAdapterClientInstance.post(
|
|
5058
5109
|
`/console/app/${payload.appId}/blocks/repository/unlink`,
|
|
5059
5110
|
payload,
|
|
5060
5111
|
getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -5065,7 +5116,6 @@ var platformAdapterAppRepositoryApi = {
|
|
|
5065
5116
|
}
|
|
5066
5117
|
}))
|
|
5067
5118
|
);
|
|
5068
|
-
return response.data;
|
|
5069
5119
|
});
|
|
5070
5120
|
},
|
|
5071
5121
|
seed(payload, authorization) {
|
|
@@ -5120,7 +5170,7 @@ var platformAdapterAppStorageApi = {
|
|
|
5120
5170
|
},
|
|
5121
5171
|
unlink(payload, authorization) {
|
|
5122
5172
|
return __async(this, null, function* () {
|
|
5123
|
-
|
|
5173
|
+
yield platformAdapterClientInstance.post(
|
|
5124
5174
|
`/console/app/${payload.appId}/blocks/storage/unlink`,
|
|
5125
5175
|
payload,
|
|
5126
5176
|
getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -5131,7 +5181,6 @@ var platformAdapterAppStorageApi = {
|
|
|
5131
5181
|
}
|
|
5132
5182
|
}))
|
|
5133
5183
|
);
|
|
5134
|
-
return response.data;
|
|
5135
5184
|
});
|
|
5136
5185
|
}
|
|
5137
5186
|
};
|
|
@@ -5170,40 +5219,36 @@ var platformAdapterAppVariablesApi = {
|
|
|
5170
5219
|
},
|
|
5171
5220
|
syncVariable(appId, key, payload, authorization) {
|
|
5172
5221
|
return __async(this, null, function* () {
|
|
5173
|
-
|
|
5222
|
+
yield platformAdapterClientInstance.post(
|
|
5174
5223
|
`/console/app/${appId}/variables/${key}/sync`,
|
|
5175
5224
|
payload,
|
|
5176
5225
|
getPlatformAdapterClientConfig(authorization)
|
|
5177
5226
|
);
|
|
5178
|
-
return response.data;
|
|
5179
5227
|
});
|
|
5180
5228
|
},
|
|
5181
5229
|
createVariable(appId, data, authorization) {
|
|
5182
5230
|
return __async(this, null, function* () {
|
|
5183
|
-
|
|
5231
|
+
yield platformAdapterClientInstance.post(
|
|
5184
5232
|
`/console/app/${appId}/variables/${data.key}`,
|
|
5185
5233
|
data,
|
|
5186
5234
|
getPlatformAdapterClientConfig(authorization)
|
|
5187
5235
|
);
|
|
5188
|
-
return response.data;
|
|
5189
5236
|
});
|
|
5190
5237
|
},
|
|
5191
5238
|
editVariable(appId, data, authorization) {
|
|
5192
5239
|
return __async(this, null, function* () {
|
|
5193
|
-
|
|
5240
|
+
yield platformAdapterClientInstance.post(
|
|
5194
5241
|
`/console/app/${appId}/variables/${data.key}/edit`,
|
|
5195
5242
|
data,
|
|
5196
5243
|
getPlatformAdapterClientConfig(authorization)
|
|
5197
5244
|
);
|
|
5198
|
-
return response.data;
|
|
5199
5245
|
});
|
|
5200
5246
|
},
|
|
5201
5247
|
deleteVariable(data) {
|
|
5202
5248
|
return __async(this, null, function* () {
|
|
5203
|
-
|
|
5249
|
+
yield platformAdapterClientInstance.delete(
|
|
5204
5250
|
`/console/app/${data.appId}/variables/${data.key}`
|
|
5205
5251
|
);
|
|
5206
|
-
return response.data;
|
|
5207
5252
|
});
|
|
5208
5253
|
}
|
|
5209
5254
|
};
|