@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.mjs
CHANGED
|
@@ -41,70 +41,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
41
41
|
// src/apis/integrations/github/api.ts
|
|
42
42
|
import axios2 from "axios";
|
|
43
43
|
|
|
44
|
-
// src/apis/integrations/github/instance.ts
|
|
45
|
-
import axios from "axios";
|
|
46
|
-
|
|
47
|
-
// src/types/errors/api.ts
|
|
48
|
-
var UnauthorizeApiError = class extends Error {
|
|
49
|
-
constructor(source) {
|
|
50
|
-
super("Unauthorized API call");
|
|
51
|
-
this.source = source;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// src/apis/integrations/github/instance.ts
|
|
56
|
-
var githubClientInstance = axios.create({
|
|
57
|
-
baseURL: "https://api.github.com",
|
|
58
|
-
headers: {
|
|
59
|
-
["Accept"]: "application/vnd.github+json",
|
|
60
|
-
["Content-Type"]: "application/json"
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
githubClientInstance.interceptors.response.use(
|
|
64
|
-
(r) => r,
|
|
65
|
-
(error) => {
|
|
66
|
-
var _a;
|
|
67
|
-
if (axios.isAxiosError(error)) {
|
|
68
|
-
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
69
|
-
error = new UnauthorizeApiError("github");
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
throw error;
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
function getGitHubClientAuthorization(req) {
|
|
76
|
-
return {
|
|
77
|
-
tokens: {
|
|
78
|
-
app: req.headers["github-app-token"],
|
|
79
|
-
oauth: req.headers["github-oauth-token"]
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function getGithubClientRequestConfig(options = {}) {
|
|
84
|
-
const defaultAuthorization = githubClientInstance.defaults.headers["Authorization"];
|
|
85
|
-
const headers = {
|
|
86
|
-
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
87
|
-
};
|
|
88
|
-
if (options.ensureAuthorizationToken && !headers.authorization) {
|
|
89
|
-
throw new UnauthorizeApiError("github");
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
function initGithubClientInstance(token) {
|
|
96
|
-
if (token) {
|
|
97
|
-
updateGithubClientInstance(token);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function updateGithubClientInstance(token) {
|
|
101
|
-
if (token) {
|
|
102
|
-
githubClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
|
|
103
|
-
} else {
|
|
104
|
-
delete githubClientInstance.defaults.headers["Authorization"];
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
44
|
// ../../private/config/src/integrations/github.ts
|
|
109
45
|
var GITHUB_CONFIG = {
|
|
110
46
|
url: "https://github.com/login/oauth/authorize",
|
|
@@ -200,6 +136,72 @@ var VERCEL_CONFIG = {
|
|
|
200
136
|
}
|
|
201
137
|
};
|
|
202
138
|
|
|
139
|
+
// src/apis/integrations/github/instance.ts
|
|
140
|
+
import axios from "axios";
|
|
141
|
+
|
|
142
|
+
// src/types/errors/api.ts
|
|
143
|
+
var UnauthorizeApiError = class extends Error {
|
|
144
|
+
constructor(source) {
|
|
145
|
+
super("Unauthorized API call");
|
|
146
|
+
this.source = source;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// src/apis/integrations/github/instance.ts
|
|
151
|
+
var githubClientInstance = axios.create({
|
|
152
|
+
baseURL: "https://api.github.com",
|
|
153
|
+
headers: {
|
|
154
|
+
Accept: "application/vnd.github+json",
|
|
155
|
+
"Content-Type": "application/json"
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
githubClientInstance.interceptors.response.use(
|
|
159
|
+
(r) => r,
|
|
160
|
+
(error) => {
|
|
161
|
+
var _a;
|
|
162
|
+
if (axios.isAxiosError(error)) {
|
|
163
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
164
|
+
throw new UnauthorizeApiError("github");
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
function getGitHubClientAuthorization(req) {
|
|
171
|
+
return {
|
|
172
|
+
tokens: {
|
|
173
|
+
app: req.headers["github-app-token"],
|
|
174
|
+
oauth: req.headers["github-oauth-token"]
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function getGithubClientRequestConfig(options = {}) {
|
|
179
|
+
const currentHeaders = githubClientInstance.defaults.headers;
|
|
180
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
181
|
+
const headers = {
|
|
182
|
+
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
183
|
+
};
|
|
184
|
+
if (options.ensureAuthorizationToken && !headers.authorization) {
|
|
185
|
+
throw new UnauthorizeApiError("github");
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function initGithubClientInstance(token) {
|
|
192
|
+
if (token) {
|
|
193
|
+
updateGithubClientInstance(token);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function updateGithubClientInstance(token) {
|
|
197
|
+
const headers = githubClientInstance.defaults.headers;
|
|
198
|
+
if (token) {
|
|
199
|
+
headers.Authorization = `Bearer ${token}`;
|
|
200
|
+
} else {
|
|
201
|
+
delete headers.Authorization;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
203
205
|
// src/apis/integrations/github/installation/api.ts
|
|
204
206
|
var gitHubInstallationApi = {
|
|
205
207
|
getInstallation(account, authorization) {
|
|
@@ -277,7 +279,7 @@ var gitHubRepositoryApi = {
|
|
|
277
279
|
})
|
|
278
280
|
);
|
|
279
281
|
const branch = response.data.find(
|
|
280
|
-
(
|
|
282
|
+
(innerBranch) => innerBranch.name === repositoryBranch
|
|
281
283
|
);
|
|
282
284
|
if (!branch) {
|
|
283
285
|
throw new Error("Branch not found");
|
|
@@ -393,18 +395,18 @@ var gitHubRepositoryApi = {
|
|
|
393
395
|
);
|
|
394
396
|
return response.data.content;
|
|
395
397
|
});
|
|
396
|
-
let seed
|
|
398
|
+
let seed;
|
|
397
399
|
try {
|
|
398
400
|
seed = yield this.getRepositorySeed(repositoryName, authorization);
|
|
399
401
|
} catch (e) {
|
|
400
402
|
}
|
|
401
|
-
return
|
|
403
|
+
return upsert(seed == null ? void 0 : seed.sha);
|
|
402
404
|
});
|
|
403
405
|
},
|
|
404
406
|
deleteRepository(repositoryName, authorization) {
|
|
405
407
|
return __async(this, null, function* () {
|
|
406
408
|
var _a;
|
|
407
|
-
return
|
|
409
|
+
return githubClientInstance.delete(
|
|
408
410
|
`/repos/${repositoryName}`,
|
|
409
411
|
getGithubClientRequestConfig({
|
|
410
412
|
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
|
|
@@ -580,7 +582,7 @@ var gitHubApi = {
|
|
|
580
582
|
}
|
|
581
583
|
}
|
|
582
584
|
);
|
|
583
|
-
|
|
585
|
+
const params = new URLSearchParams(response.data);
|
|
584
586
|
return (_a = params.get("access_token")) != null ? _a : "";
|
|
585
587
|
});
|
|
586
588
|
}
|
|
@@ -591,7 +593,7 @@ import axios3 from "axios";
|
|
|
591
593
|
var netlifyClientInstance = axios3.create({
|
|
592
594
|
baseURL: "https://api.netlify.com/api/v1",
|
|
593
595
|
headers: {
|
|
594
|
-
|
|
596
|
+
"Content-Type": "application/json"
|
|
595
597
|
}
|
|
596
598
|
});
|
|
597
599
|
netlifyClientInstance.interceptors.response.use(
|
|
@@ -600,7 +602,7 @@ netlifyClientInstance.interceptors.response.use(
|
|
|
600
602
|
var _a;
|
|
601
603
|
if (axios3.isAxiosError(error)) {
|
|
602
604
|
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
603
|
-
|
|
605
|
+
throw new UnauthorizeApiError("netlify");
|
|
604
606
|
}
|
|
605
607
|
}
|
|
606
608
|
throw error;
|
|
@@ -612,7 +614,8 @@ function getNetlifyClientAuthorization(req) {
|
|
|
612
614
|
};
|
|
613
615
|
}
|
|
614
616
|
function getNetlifyClientConfig(options = {}) {
|
|
615
|
-
const
|
|
617
|
+
const currentHeaders = netlifyClientInstance.defaults.headers;
|
|
618
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
616
619
|
const headers = {
|
|
617
620
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
618
621
|
};
|
|
@@ -629,10 +632,11 @@ function initNetlifyClientInstance(token) {
|
|
|
629
632
|
}
|
|
630
633
|
}
|
|
631
634
|
function updateNetlifyClientInstance(token) {
|
|
635
|
+
const headers = netlifyClientInstance.defaults.headers;
|
|
632
636
|
if (token) {
|
|
633
|
-
|
|
637
|
+
headers.Authorization = `Bearer ${token}`;
|
|
634
638
|
} else {
|
|
635
|
-
delete
|
|
639
|
+
delete headers.Authorization;
|
|
636
640
|
}
|
|
637
641
|
}
|
|
638
642
|
|
|
@@ -651,14 +655,15 @@ var netlifyAccountApi = {
|
|
|
651
655
|
},
|
|
652
656
|
getAccountEnvs(accountId, siteId, authorization) {
|
|
653
657
|
return __async(this, null, function* () {
|
|
654
|
-
|
|
655
|
-
|
|
658
|
+
let targetAccountId = accountId;
|
|
659
|
+
if (!targetAccountId) {
|
|
660
|
+
targetAccountId = yield this.getAccount(authorization);
|
|
656
661
|
}
|
|
657
|
-
if (!
|
|
662
|
+
if (!targetAccountId) {
|
|
658
663
|
throw new Error("No account");
|
|
659
664
|
}
|
|
660
665
|
const { data: envs } = yield netlifyClientInstance.get(
|
|
661
|
-
`/accounts/${
|
|
666
|
+
`/accounts/${targetAccountId}/env?site_id=${siteId}&scope=all&context=all&level=all`,
|
|
662
667
|
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
663
668
|
ensureAuthorizationToken: true
|
|
664
669
|
}))
|
|
@@ -668,14 +673,15 @@ var netlifyAccountApi = {
|
|
|
668
673
|
},
|
|
669
674
|
getAccountEnv(accountId, siteId, envKey, authorization) {
|
|
670
675
|
return __async(this, null, function* () {
|
|
671
|
-
|
|
672
|
-
|
|
676
|
+
let targetAccountId = accountId;
|
|
677
|
+
if (!targetAccountId) {
|
|
678
|
+
targetAccountId = yield this.getAccount(authorization);
|
|
673
679
|
}
|
|
674
|
-
if (!
|
|
680
|
+
if (!targetAccountId) {
|
|
675
681
|
throw new Error("No account");
|
|
676
682
|
}
|
|
677
683
|
const { data: envs } = yield netlifyClientInstance.get(
|
|
678
|
-
`/accounts/${
|
|
684
|
+
`/accounts/${targetAccountId}/env/${envKey}?site_id=${siteId}`,
|
|
679
685
|
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
680
686
|
ensureAuthorizationToken: true
|
|
681
687
|
}))
|
|
@@ -685,25 +691,27 @@ var netlifyAccountApi = {
|
|
|
685
691
|
},
|
|
686
692
|
createAccountEnv(accountId, siteId, envName, envValue, envs, authorization) {
|
|
687
693
|
return __async(this, null, function* () {
|
|
688
|
-
|
|
689
|
-
|
|
694
|
+
let targetAccountId = accountId;
|
|
695
|
+
let targetEnvs = envs;
|
|
696
|
+
if (!targetAccountId) {
|
|
697
|
+
targetAccountId = yield this.getAccount(authorization);
|
|
690
698
|
}
|
|
691
|
-
if (!
|
|
699
|
+
if (!targetAccountId) {
|
|
692
700
|
throw new Error("No account");
|
|
693
701
|
}
|
|
694
|
-
if (!
|
|
702
|
+
if (!targetEnvs) {
|
|
695
703
|
const response = yield netlifyClientInstance.get(
|
|
696
|
-
`/accounts/${
|
|
704
|
+
`/accounts/${targetAccountId}/env?site_id=${siteId}&scope=all&context=all&level=all`,
|
|
697
705
|
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
698
706
|
ensureAuthorizationToken: true
|
|
699
707
|
}))
|
|
700
708
|
);
|
|
701
|
-
|
|
709
|
+
targetEnvs = response.data;
|
|
702
710
|
}
|
|
703
|
-
const existingEnv =
|
|
711
|
+
const existingEnv = targetEnvs.find((env) => env.key === envName);
|
|
704
712
|
if (existingEnv) {
|
|
705
713
|
yield netlifyClientInstance.put(
|
|
706
|
-
`/accounts/${
|
|
714
|
+
`/accounts/${targetAccountId}/env/${existingEnv.key}?site_id=${siteId}`,
|
|
707
715
|
{
|
|
708
716
|
key: existingEnv.key,
|
|
709
717
|
scopes: ["builds", "functions", "runtime", "post_processing"],
|
|
@@ -715,7 +723,7 @@ var netlifyAccountApi = {
|
|
|
715
723
|
);
|
|
716
724
|
} else {
|
|
717
725
|
yield netlifyClientInstance.post(
|
|
718
|
-
`/accounts/${
|
|
726
|
+
`/accounts/${targetAccountId}/env?site_id=${siteId}`,
|
|
719
727
|
[
|
|
720
728
|
{
|
|
721
729
|
key: envName,
|
|
@@ -751,19 +759,19 @@ var netlifyAccountApi = {
|
|
|
751
759
|
},
|
|
752
760
|
removeAccountEnv(accountId, siteId, envKey, authorization) {
|
|
753
761
|
return __async(this, null, function* () {
|
|
754
|
-
|
|
755
|
-
|
|
762
|
+
let targetAccountId = accountId;
|
|
763
|
+
if (!targetAccountId) {
|
|
764
|
+
targetAccountId = yield this.getAccount(authorization);
|
|
756
765
|
}
|
|
757
766
|
if (!accountId) {
|
|
758
767
|
throw new Error("No account");
|
|
759
768
|
}
|
|
760
|
-
|
|
761
|
-
`/accounts/${
|
|
769
|
+
yield netlifyClientInstance.delete(
|
|
770
|
+
`/accounts/${targetAccountId}/env/${envKey}?site_id=${siteId}`,
|
|
762
771
|
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
763
772
|
ensureAuthorizationToken: true
|
|
764
773
|
}))
|
|
765
774
|
);
|
|
766
|
-
return response.data;
|
|
767
775
|
});
|
|
768
776
|
}
|
|
769
777
|
};
|
|
@@ -773,7 +781,7 @@ var netlifyHookApi = {
|
|
|
773
781
|
addBuildHooks(siteId, authorization) {
|
|
774
782
|
return __async(this, null, function* () {
|
|
775
783
|
try {
|
|
776
|
-
netlifyClientInstance.post(
|
|
784
|
+
yield netlifyClientInstance.post(
|
|
777
785
|
"/hooks",
|
|
778
786
|
{
|
|
779
787
|
site_id: siteId,
|
|
@@ -790,7 +798,7 @@ var netlifyHookApi = {
|
|
|
790
798
|
} catch (e) {
|
|
791
799
|
}
|
|
792
800
|
try {
|
|
793
|
-
netlifyClientInstance.post(
|
|
801
|
+
yield netlifyClientInstance.post(
|
|
794
802
|
"/hooks",
|
|
795
803
|
{
|
|
796
804
|
site_id: siteId,
|
|
@@ -807,7 +815,7 @@ var netlifyHookApi = {
|
|
|
807
815
|
} catch (e) {
|
|
808
816
|
}
|
|
809
817
|
try {
|
|
810
|
-
netlifyClientInstance.post(
|
|
818
|
+
yield netlifyClientInstance.post(
|
|
811
819
|
"/hooks",
|
|
812
820
|
{
|
|
813
821
|
site_id: siteId,
|
|
@@ -876,7 +884,7 @@ var netlifySiteApi = {
|
|
|
876
884
|
}))
|
|
877
885
|
);
|
|
878
886
|
const deploy = deploys.filter(
|
|
879
|
-
(
|
|
887
|
+
(innerDeploy) => innerDeploy.context === "production"
|
|
880
888
|
)[0];
|
|
881
889
|
const { data: pluginRuns } = yield netlifyClientInstance.get(
|
|
882
890
|
`/deploys/${deploy.id}/plugin_runs`,
|
|
@@ -912,20 +920,23 @@ var netlifySiteApi = {
|
|
|
912
920
|
},
|
|
913
921
|
createSiteByInstallationId(name, repositoryFullName, target, installationId, branch, authorization) {
|
|
914
922
|
return __async(this, null, function* () {
|
|
915
|
-
const config =
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
923
|
+
const config = (
|
|
924
|
+
// eslint-disable-next-line no-nested-ternary -- fix me
|
|
925
|
+
target === "nextjs" ? {
|
|
926
|
+
plugins: ["@netlify/plugin-nextjs"],
|
|
927
|
+
packages: [{ package: "@netlify/plugin-nextjs" }],
|
|
928
|
+
dir: ".next",
|
|
929
|
+
cmd: "npm run build"
|
|
930
|
+
} : target === "node" ? {
|
|
931
|
+
plugins: [],
|
|
932
|
+
dir: "dist",
|
|
933
|
+
cmd: "npm run build"
|
|
934
|
+
} : {
|
|
935
|
+
plugin: [],
|
|
936
|
+
dir: ".",
|
|
937
|
+
cmd: ""
|
|
938
|
+
}
|
|
939
|
+
);
|
|
929
940
|
const response = yield netlifyClientInstance.post(
|
|
930
941
|
`/sites`,
|
|
931
942
|
{
|
|
@@ -956,19 +967,22 @@ var netlifySiteApi = {
|
|
|
956
967
|
},
|
|
957
968
|
createSiteByDeployKey(name, repositoryFullName, target, deployKeyId, branch, authorization) {
|
|
958
969
|
return __async(this, null, function* () {
|
|
959
|
-
const config =
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
970
|
+
const config = (
|
|
971
|
+
// eslint-disable-next-line no-nested-ternary -- fix me
|
|
972
|
+
target === "nextjs" ? {
|
|
973
|
+
packages: [{ package: "@netlify/plugin-nextjs" }],
|
|
974
|
+
dir: ".next",
|
|
975
|
+
cmd: "npm run build"
|
|
976
|
+
} : target === "node" ? {
|
|
977
|
+
packages: [],
|
|
978
|
+
dir: "dist",
|
|
979
|
+
cmd: "npm run build"
|
|
980
|
+
} : {
|
|
981
|
+
packages: [],
|
|
982
|
+
dir: ".",
|
|
983
|
+
cmd: ""
|
|
984
|
+
}
|
|
985
|
+
);
|
|
972
986
|
const response = yield netlifyClientInstance.post(
|
|
973
987
|
`/sites`,
|
|
974
988
|
{
|
|
@@ -997,13 +1011,12 @@ var netlifySiteApi = {
|
|
|
997
1011
|
},
|
|
998
1012
|
removeSite(siteId, authorization) {
|
|
999
1013
|
return __async(this, null, function* () {
|
|
1000
|
-
|
|
1014
|
+
yield netlifyClientInstance.delete(
|
|
1001
1015
|
`/sites/${siteId}`,
|
|
1002
1016
|
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1003
1017
|
ensureAuthorizationToken: true
|
|
1004
1018
|
}))
|
|
1005
1019
|
);
|
|
1006
|
-
return response.data;
|
|
1007
1020
|
});
|
|
1008
1021
|
},
|
|
1009
1022
|
triggerSiteBuild(siteId, authorization) {
|
|
@@ -1116,14 +1129,12 @@ var netlifySiteApi = {
|
|
|
1116
1129
|
{
|
|
1117
1130
|
general_position: "footer",
|
|
1118
1131
|
title: "sentry",
|
|
1119
|
-
// eslint-disable-next-line no-useless-escape
|
|
1120
1132
|
general: `<script src='https://js.sentry-cdn.com/${projectKey}.min.js' crossorigin="anonymous"></script>`
|
|
1121
1133
|
},
|
|
1122
1134
|
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1123
1135
|
ensureAuthorizationToken: true
|
|
1124
1136
|
}))
|
|
1125
1137
|
);
|
|
1126
|
-
return;
|
|
1127
1138
|
});
|
|
1128
1139
|
}
|
|
1129
1140
|
};
|
|
@@ -1150,7 +1161,7 @@ planetScaleClientInstance.interceptors.response.use(
|
|
|
1150
1161
|
var _a;
|
|
1151
1162
|
if (axios4.isAxiosError(error)) {
|
|
1152
1163
|
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
1153
|
-
|
|
1164
|
+
throw new UnauthorizeApiError("planetscale");
|
|
1154
1165
|
}
|
|
1155
1166
|
}
|
|
1156
1167
|
throw error;
|
|
@@ -1162,7 +1173,8 @@ function getPlanetScaleClientAuthorization(req) {
|
|
|
1162
1173
|
};
|
|
1163
1174
|
}
|
|
1164
1175
|
function getPlanetScaleClientConfig(options = {}) {
|
|
1165
|
-
const
|
|
1176
|
+
const currentHeaders = planetScaleClientInstance.defaults.headers;
|
|
1177
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
1166
1178
|
const headers = {
|
|
1167
1179
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `${options.token}` : void 0
|
|
1168
1180
|
};
|
|
@@ -1179,10 +1191,11 @@ function initPlanetScaleClientInstance(token) {
|
|
|
1179
1191
|
}
|
|
1180
1192
|
}
|
|
1181
1193
|
function updatePlanetScaleClientInstance(token) {
|
|
1194
|
+
const headers = planetScaleClientInstance.defaults.headers;
|
|
1182
1195
|
if (token) {
|
|
1183
|
-
|
|
1196
|
+
headers.Authorization = `${token}`;
|
|
1184
1197
|
} else {
|
|
1185
|
-
delete
|
|
1198
|
+
delete headers.Authorization;
|
|
1186
1199
|
}
|
|
1187
1200
|
}
|
|
1188
1201
|
|
|
@@ -1366,7 +1379,7 @@ import axios6 from "axios";
|
|
|
1366
1379
|
var sentryClientInstance = axios6.create({
|
|
1367
1380
|
baseURL: "https://sentry.io/api/0/",
|
|
1368
1381
|
headers: {
|
|
1369
|
-
|
|
1382
|
+
"Content-Type": "application/json"
|
|
1370
1383
|
}
|
|
1371
1384
|
});
|
|
1372
1385
|
sentryClientInstance.interceptors.response.use(
|
|
@@ -1375,7 +1388,7 @@ sentryClientInstance.interceptors.response.use(
|
|
|
1375
1388
|
var _a;
|
|
1376
1389
|
if (axios6.isAxiosError(error)) {
|
|
1377
1390
|
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
1378
|
-
|
|
1391
|
+
throw new UnauthorizeApiError("sentry");
|
|
1379
1392
|
}
|
|
1380
1393
|
}
|
|
1381
1394
|
throw error;
|
|
@@ -1387,7 +1400,8 @@ function getSentryClientAuthorization(req) {
|
|
|
1387
1400
|
};
|
|
1388
1401
|
}
|
|
1389
1402
|
function getSentryClientConfig(options = {}) {
|
|
1390
|
-
const
|
|
1403
|
+
const currentHeaders = sentryClientInstance.defaults.headers;
|
|
1404
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
1391
1405
|
const headers = {
|
|
1392
1406
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
1393
1407
|
};
|
|
@@ -1405,10 +1419,11 @@ function initSentryClientInstance(token) {
|
|
|
1405
1419
|
}
|
|
1406
1420
|
}
|
|
1407
1421
|
function updateSentryClientInstance(token) {
|
|
1422
|
+
const headers = sentryClientInstance.defaults.headers;
|
|
1408
1423
|
if (token) {
|
|
1409
|
-
|
|
1424
|
+
headers.Authorization = `Bearer ${token}`;
|
|
1410
1425
|
} else {
|
|
1411
|
-
delete
|
|
1426
|
+
delete headers.Authorization;
|
|
1412
1427
|
}
|
|
1413
1428
|
}
|
|
1414
1429
|
|
|
@@ -1541,7 +1556,7 @@ var sentryApi = {
|
|
|
1541
1556
|
},
|
|
1542
1557
|
createRepo(organizationSlug, projectId, repositoryFullName, repositoryBranch, githubIntegrationId, authorization) {
|
|
1543
1558
|
return __async(this, null, function* () {
|
|
1544
|
-
var _a, _b
|
|
1559
|
+
var _a, _b;
|
|
1545
1560
|
let repository;
|
|
1546
1561
|
try {
|
|
1547
1562
|
const response = yield sentryClientInstance.post(
|
|
@@ -1558,7 +1573,7 @@ var sentryApi = {
|
|
|
1558
1573
|
repository = response.data;
|
|
1559
1574
|
} catch (err) {
|
|
1560
1575
|
const error = err;
|
|
1561
|
-
if (((
|
|
1576
|
+
if (((_a = error.response) == null ? void 0 : _a.data.error_type) === "validation" || ((_b = error.response) == null ? void 0 : _b.data.error_type) === "unknown") {
|
|
1562
1577
|
throw error;
|
|
1563
1578
|
}
|
|
1564
1579
|
const response = yield sentryClientInstance.get(
|
|
@@ -1618,10 +1633,7 @@ var sentryApi = {
|
|
|
1618
1633
|
);
|
|
1619
1634
|
} catch (error) {
|
|
1620
1635
|
if (((_a = error.response) == null ? void 0 : _a.status) === 409) {
|
|
1621
|
-
return
|
|
1622
|
-
`${organizationSlug}/${name}`,
|
|
1623
|
-
authorization
|
|
1624
|
-
);
|
|
1636
|
+
return this.getProject(`${organizationSlug}/${name}`, authorization);
|
|
1625
1637
|
}
|
|
1626
1638
|
throw error;
|
|
1627
1639
|
}
|
|
@@ -1629,13 +1641,12 @@ var sentryApi = {
|
|
|
1629
1641
|
},
|
|
1630
1642
|
deleteProject(projectFullName, authorization) {
|
|
1631
1643
|
return __async(this, null, function* () {
|
|
1632
|
-
|
|
1644
|
+
yield sentryClientInstance.delete(
|
|
1633
1645
|
`/projects/${projectFullName}/`,
|
|
1634
1646
|
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1635
1647
|
ensureAuthorizationToken: true
|
|
1636
1648
|
}))
|
|
1637
1649
|
);
|
|
1638
|
-
return response.data;
|
|
1639
1650
|
});
|
|
1640
1651
|
}
|
|
1641
1652
|
};
|
|
@@ -1652,7 +1663,8 @@ function getTextClientAuthorization(req) {
|
|
|
1652
1663
|
};
|
|
1653
1664
|
}
|
|
1654
1665
|
function getTextClientConfig(option = {}) {
|
|
1655
|
-
const
|
|
1666
|
+
const currentHeaders = textClientInstance.defaults.headers;
|
|
1667
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
1656
1668
|
const headers = {
|
|
1657
1669
|
authorization: defaultAuthorization != null ? defaultAuthorization : option.token ? `Bearer ${option.token}` : void 0
|
|
1658
1670
|
};
|
|
@@ -1661,19 +1673,20 @@ function getTextClientConfig(option = {}) {
|
|
|
1661
1673
|
};
|
|
1662
1674
|
}
|
|
1663
1675
|
function initTextClientInstance(baseUrl, token) {
|
|
1676
|
+
const headers = textClientInstance.defaults.headers;
|
|
1664
1677
|
if (baseUrl) {
|
|
1665
1678
|
textClientInstance.interceptors.request.use(
|
|
1666
|
-
(config) =>
|
|
1679
|
+
(config) => {
|
|
1667
1680
|
config.baseURL = baseUrl;
|
|
1668
1681
|
return config;
|
|
1669
|
-
}
|
|
1682
|
+
},
|
|
1670
1683
|
(error) => Promise.reject(error)
|
|
1671
1684
|
);
|
|
1672
1685
|
}
|
|
1673
1686
|
if (token) {
|
|
1674
|
-
|
|
1687
|
+
headers.Authorization = `Bearer ${token}`;
|
|
1675
1688
|
} else {
|
|
1676
|
-
delete
|
|
1689
|
+
delete headers.Authorization;
|
|
1677
1690
|
}
|
|
1678
1691
|
}
|
|
1679
1692
|
|
|
@@ -1714,12 +1727,11 @@ var textAppMonitoringEventsApi = {
|
|
|
1714
1727
|
upsertEvent(appId, event, authorization) {
|
|
1715
1728
|
return __async(this, null, function* () {
|
|
1716
1729
|
try {
|
|
1717
|
-
|
|
1730
|
+
yield textClientInstance.post(
|
|
1718
1731
|
`/app_monitoring/${appId}/events/${event.key}`,
|
|
1719
1732
|
event,
|
|
1720
1733
|
getTextClientConfig(authorization)
|
|
1721
1734
|
);
|
|
1722
|
-
return response.data;
|
|
1723
1735
|
} catch (error) {
|
|
1724
1736
|
if (error instanceof Error) {
|
|
1725
1737
|
throw new Error(`Couldn't upsert event. [${error.message}]`);
|
|
@@ -1731,11 +1743,10 @@ var textAppMonitoringEventsApi = {
|
|
|
1731
1743
|
deleteEvent(appId, eventKey, authorization) {
|
|
1732
1744
|
return __async(this, null, function* () {
|
|
1733
1745
|
try {
|
|
1734
|
-
|
|
1746
|
+
yield textClientInstance.delete(
|
|
1735
1747
|
`/app_monitoring/${appId}/events/${eventKey}`,
|
|
1736
1748
|
getTextClientConfig(authorization)
|
|
1737
1749
|
);
|
|
1738
|
-
return response.data;
|
|
1739
1750
|
} catch (error) {
|
|
1740
1751
|
if (error instanceof Error) {
|
|
1741
1752
|
throw new Error(`Couldn't delete event. [${error.message}]`);
|
|
@@ -1747,12 +1758,11 @@ var textAppMonitoringEventsApi = {
|
|
|
1747
1758
|
sendEvent(appId, data, authorization) {
|
|
1748
1759
|
return __async(this, null, function* () {
|
|
1749
1760
|
try {
|
|
1750
|
-
|
|
1761
|
+
yield textClientInstance.post(
|
|
1751
1762
|
`/app_monitoring/${appId}/events`,
|
|
1752
1763
|
data,
|
|
1753
1764
|
getTextClientConfig(authorization)
|
|
1754
1765
|
);
|
|
1755
|
-
return response.data;
|
|
1756
1766
|
} catch (error) {
|
|
1757
1767
|
if (error instanceof Error) {
|
|
1758
1768
|
throw new Error(`Couldn't send events. [${error.message}]`);
|
|
@@ -1770,7 +1780,9 @@ var textAppMonitoringEventsApi = {
|
|
|
1770
1780
|
search: (_b = payload.search) != null ? _b : ""
|
|
1771
1781
|
});
|
|
1772
1782
|
if (payload.type) {
|
|
1773
|
-
payload.type.forEach((type) =>
|
|
1783
|
+
payload.type.forEach((type) => {
|
|
1784
|
+
searchParams.append("type[]", type);
|
|
1785
|
+
});
|
|
1774
1786
|
}
|
|
1775
1787
|
const response = yield textClientInstance.get(
|
|
1776
1788
|
`/app_monitoring/${appId}/events?${searchParams.toString()}`,
|
|
@@ -1882,12 +1894,11 @@ var textAppMonitoringReportsApi = {
|
|
|
1882
1894
|
createCustomReport(appId, customReport, authorization) {
|
|
1883
1895
|
return __async(this, null, function* () {
|
|
1884
1896
|
try {
|
|
1885
|
-
|
|
1897
|
+
yield textClientInstance.post(
|
|
1886
1898
|
`/app_monitoring/${appId}/reports/custom`,
|
|
1887
1899
|
customReport,
|
|
1888
1900
|
getTextClientConfig(authorization)
|
|
1889
1901
|
);
|
|
1890
|
-
return response.data;
|
|
1891
1902
|
} catch (error) {
|
|
1892
1903
|
if (error instanceof Error) {
|
|
1893
1904
|
throw new Error(`Couldn't create custom report. [${error.message}]`);
|
|
@@ -1899,12 +1910,11 @@ var textAppMonitoringReportsApi = {
|
|
|
1899
1910
|
updateCustomReport(appId, customReport, authorization) {
|
|
1900
1911
|
return __async(this, null, function* () {
|
|
1901
1912
|
try {
|
|
1902
|
-
|
|
1913
|
+
yield textClientInstance.post(
|
|
1903
1914
|
`/app_monitoring/${appId}/reports/custom/${customReport.id}`,
|
|
1904
1915
|
customReport,
|
|
1905
1916
|
getTextClientConfig(authorization)
|
|
1906
1917
|
);
|
|
1907
|
-
return response.data;
|
|
1908
1918
|
} catch (error) {
|
|
1909
1919
|
if (error instanceof Error) {
|
|
1910
1920
|
throw new Error(`Couldn't update custom report. [${error.message}]`);
|
|
@@ -1916,11 +1926,10 @@ var textAppMonitoringReportsApi = {
|
|
|
1916
1926
|
deleteCustomReport(appId, customReportId, authorization) {
|
|
1917
1927
|
return __async(this, null, function* () {
|
|
1918
1928
|
try {
|
|
1919
|
-
|
|
1929
|
+
yield textClientInstance.delete(
|
|
1920
1930
|
`/app_monitoring/${appId}/reports/custom/${customReportId}`,
|
|
1921
1931
|
getTextClientConfig(authorization)
|
|
1922
1932
|
);
|
|
1923
|
-
return response.data;
|
|
1924
1933
|
} catch (error) {
|
|
1925
1934
|
if (error instanceof Error) {
|
|
1926
1935
|
throw new Error(`Couldn't delete custom report. [${error.message}]`);
|
|
@@ -1961,7 +1970,7 @@ vercelClientInstance.interceptors.response.use(
|
|
|
1961
1970
|
var _a;
|
|
1962
1971
|
if (axios8.isAxiosError(error)) {
|
|
1963
1972
|
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
1964
|
-
|
|
1973
|
+
throw new UnauthorizeApiError("vercel");
|
|
1965
1974
|
}
|
|
1966
1975
|
}
|
|
1967
1976
|
throw error;
|
|
@@ -1973,7 +1982,8 @@ function getVercelClientAuthorization(req) {
|
|
|
1973
1982
|
};
|
|
1974
1983
|
}
|
|
1975
1984
|
function getVercelClientConfig(options = {}) {
|
|
1976
|
-
const
|
|
1985
|
+
const currentHeaders = vercelClientInstance.defaults.headers;
|
|
1986
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
1977
1987
|
const headers = {
|
|
1978
1988
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
1979
1989
|
};
|
|
@@ -1990,10 +2000,11 @@ function initVercelClientInstance(token) {
|
|
|
1990
2000
|
}
|
|
1991
2001
|
}
|
|
1992
2002
|
function updateVercelClientInstance(token) {
|
|
2003
|
+
const headers = vercelClientInstance.defaults.headers;
|
|
1993
2004
|
if (token) {
|
|
1994
|
-
|
|
2005
|
+
headers.Authorization = `Bearer ${token}`;
|
|
1995
2006
|
} else {
|
|
1996
|
-
delete
|
|
2007
|
+
delete headers.Authorization;
|
|
1997
2008
|
}
|
|
1998
2009
|
}
|
|
1999
2010
|
|
|
@@ -2036,7 +2047,7 @@ var vercelIntegrationApi = {
|
|
|
2036
2047
|
var _a;
|
|
2037
2048
|
try {
|
|
2038
2049
|
const response = yield vercelClientInstance.get(
|
|
2039
|
-
`/v1/integrations/search-repo?provider=github${repositoryName ?
|
|
2050
|
+
`/v1/integrations/search-repo?provider=github${repositoryName ? `&query=${repositoryName}` : ""}${namespaceId ? `&namespaceId=${namespaceId}` : ""}`,
|
|
2040
2051
|
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2041
2052
|
ensureAuthorizationToken: true
|
|
2042
2053
|
}))
|
|
@@ -2059,7 +2070,6 @@ var vercelIntegrationApi = {
|
|
|
2059
2070
|
},
|
|
2060
2071
|
isRepositoryAccessible(repositoryName, authorization) {
|
|
2061
2072
|
return __async(this, null, function* () {
|
|
2062
|
-
var _a;
|
|
2063
2073
|
try {
|
|
2064
2074
|
const namespaces = yield this.getGitNamespaces(authorization);
|
|
2065
2075
|
const accessibleNamespaceId = namespaces.length > 0 ? (yield Promise.all(
|
|
@@ -2068,9 +2078,9 @@ var vercelIntegrationApi = {
|
|
|
2068
2078
|
)
|
|
2069
2079
|
)).map(
|
|
2070
2080
|
(repositories) => repositories.repos.length > 0 ? repositories.namespaceId : void 0
|
|
2071
|
-
)[0] : (
|
|
2081
|
+
)[0] : (yield this.getGitRepos(repositoryName, void 0, authorization)).namespaceId;
|
|
2072
2082
|
return {
|
|
2073
|
-
isAccessible:
|
|
2083
|
+
isAccessible: Boolean(accessibleNamespaceId),
|
|
2074
2084
|
installationId: accessibleNamespaceId
|
|
2075
2085
|
};
|
|
2076
2086
|
} catch (err) {
|
|
@@ -2177,15 +2187,16 @@ var vercelProjectApi = {
|
|
|
2177
2187
|
getProjectEnvByKey(projectId, envKey, authorization) {
|
|
2178
2188
|
return __async(this, null, function* () {
|
|
2179
2189
|
const envs = yield this.getProjectEnvs(projectId, authorization);
|
|
2180
|
-
const env = envs.find((
|
|
2190
|
+
const env = envs.find((innerEnv) => envKey === innerEnv.key);
|
|
2181
2191
|
if (!env) {
|
|
2182
2192
|
return;
|
|
2183
2193
|
}
|
|
2184
|
-
return
|
|
2194
|
+
return this.getProjectEnv(projectId, env.id, authorization);
|
|
2185
2195
|
});
|
|
2186
2196
|
},
|
|
2187
|
-
createProjectEnv(projectId, key, value,
|
|
2197
|
+
createProjectEnv(projectId, key, value, projectEnvs, authorization) {
|
|
2188
2198
|
return __async(this, null, function* () {
|
|
2199
|
+
let envs = projectEnvs;
|
|
2189
2200
|
if (!envs) {
|
|
2190
2201
|
const response = yield vercelClientInstance.get(`/v9/projects/${projectId}/env`, getVercelClientConfig(authorization));
|
|
2191
2202
|
envs = response.data.envs;
|
|
@@ -2193,7 +2204,7 @@ var vercelProjectApi = {
|
|
|
2193
2204
|
const existingEnv = envs.find((env) => env.key === key);
|
|
2194
2205
|
if (existingEnv) {
|
|
2195
2206
|
const { data: editedEnv } = yield vercelClientInstance.patch(
|
|
2196
|
-
`/v9/projects/${projectId}/env/${existingEnv
|
|
2207
|
+
`/v9/projects/${projectId}/env/${existingEnv.id}`,
|
|
2197
2208
|
{
|
|
2198
2209
|
key,
|
|
2199
2210
|
value,
|
|
@@ -2205,32 +2216,30 @@ var vercelProjectApi = {
|
|
|
2205
2216
|
}))
|
|
2206
2217
|
);
|
|
2207
2218
|
return editedEnv;
|
|
2208
|
-
} else {
|
|
2209
|
-
const { data: createdEnv } = yield vercelClientInstance.post(
|
|
2210
|
-
`/v9/projects/${projectId}/env`,
|
|
2211
|
-
{
|
|
2212
|
-
key,
|
|
2213
|
-
value,
|
|
2214
|
-
type: "encrypted",
|
|
2215
|
-
target: ["production", "preview", "development"]
|
|
2216
|
-
},
|
|
2217
|
-
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2218
|
-
ensureAuthorizationToken: true
|
|
2219
|
-
}))
|
|
2220
|
-
);
|
|
2221
|
-
return createdEnv;
|
|
2222
2219
|
}
|
|
2220
|
+
const { data: createdEnv } = yield vercelClientInstance.post(
|
|
2221
|
+
`/v9/projects/${projectId}/env`,
|
|
2222
|
+
{
|
|
2223
|
+
key,
|
|
2224
|
+
value,
|
|
2225
|
+
type: "encrypted",
|
|
2226
|
+
target: ["production", "preview", "development"]
|
|
2227
|
+
},
|
|
2228
|
+
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2229
|
+
ensureAuthorizationToken: true
|
|
2230
|
+
}))
|
|
2231
|
+
);
|
|
2232
|
+
return createdEnv;
|
|
2223
2233
|
});
|
|
2224
2234
|
},
|
|
2225
2235
|
removeProjectEnv(projectId, envId, authorization) {
|
|
2226
2236
|
return __async(this, null, function* () {
|
|
2227
|
-
|
|
2237
|
+
yield vercelClientInstance.delete(
|
|
2228
2238
|
`/v9/projects/${projectId}/env/${envId}`,
|
|
2229
2239
|
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2230
2240
|
ensureAuthorizationToken: true
|
|
2231
2241
|
}))
|
|
2232
2242
|
);
|
|
2233
|
-
return response.data;
|
|
2234
2243
|
});
|
|
2235
2244
|
}
|
|
2236
2245
|
};
|
|
@@ -2248,15 +2257,11 @@ var vercelApi = {
|
|
|
2248
2257
|
client_secret: clientSecret,
|
|
2249
2258
|
redirect_uri: redirectUrl
|
|
2250
2259
|
});
|
|
2251
|
-
const response = yield axios9.post(
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
{
|
|
2255
|
-
headers: {
|
|
2256
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
2257
|
-
}
|
|
2260
|
+
const response = yield axios9.post("https://api.vercel.com/v2/oauth/access_token", data, {
|
|
2261
|
+
headers: {
|
|
2262
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
2258
2263
|
}
|
|
2259
|
-
);
|
|
2264
|
+
});
|
|
2260
2265
|
return {
|
|
2261
2266
|
token: response.data.access_token,
|
|
2262
2267
|
installationId: response.data.installation_id,
|
|
@@ -2291,7 +2296,6 @@ var getRegion = (token) => {
|
|
|
2291
2296
|
if (supportedRegions.includes(region)) {
|
|
2292
2297
|
return region;
|
|
2293
2298
|
}
|
|
2294
|
-
return void 0;
|
|
2295
2299
|
};
|
|
2296
2300
|
var livechatClientInstance = axios10.create({
|
|
2297
2301
|
baseURL: "https://api.labs.livechatinc.com"
|
|
@@ -2302,7 +2306,8 @@ function getLiveChatClientAuthorization(req) {
|
|
|
2302
2306
|
};
|
|
2303
2307
|
}
|
|
2304
2308
|
function getLiveChatClientConfig(options = {}) {
|
|
2305
|
-
const
|
|
2309
|
+
const currentHeaders = livechatClientInstance.defaults.headers;
|
|
2310
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
2306
2311
|
const headers = {
|
|
2307
2312
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
2308
2313
|
};
|
|
@@ -2312,22 +2317,23 @@ function getLiveChatClientConfig(options = {}) {
|
|
|
2312
2317
|
}
|
|
2313
2318
|
function initLiveChatClientInstance(baseUrl, token) {
|
|
2314
2319
|
const region = token ? getRegion(token) : void 0;
|
|
2320
|
+
const headers = livechatClientInstance.defaults.headers;
|
|
2315
2321
|
if (baseUrl) {
|
|
2316
2322
|
livechatClientInstance.interceptors.request.use(
|
|
2317
|
-
(config) =>
|
|
2323
|
+
(config) => {
|
|
2318
2324
|
config.baseURL = baseUrl;
|
|
2319
2325
|
return config;
|
|
2320
|
-
}
|
|
2326
|
+
},
|
|
2321
2327
|
(error) => Promise.reject(error)
|
|
2322
2328
|
);
|
|
2323
2329
|
}
|
|
2324
2330
|
if (region) {
|
|
2325
|
-
|
|
2331
|
+
headers["X-Region"] = region;
|
|
2326
2332
|
}
|
|
2327
2333
|
if (token) {
|
|
2328
|
-
|
|
2334
|
+
headers.Authorization = `Bearer ${token}`;
|
|
2329
2335
|
} else {
|
|
2330
|
-
delete
|
|
2336
|
+
delete headers.Authorization;
|
|
2331
2337
|
}
|
|
2332
2338
|
}
|
|
2333
2339
|
|
|
@@ -2475,7 +2481,7 @@ var livechatPropertyApi = {
|
|
|
2475
2481
|
try {
|
|
2476
2482
|
const response = yield Promise.all(
|
|
2477
2483
|
properties.filter((property) => property.public_access).map((property) => __async(this, null, function* () {
|
|
2478
|
-
return
|
|
2484
|
+
return livechatClientInstance.post(
|
|
2479
2485
|
`/v3.3/configuration/action/publish_property`,
|
|
2480
2486
|
{
|
|
2481
2487
|
name: property.name,
|
|
@@ -2500,7 +2506,7 @@ var livechatPropertyApi = {
|
|
|
2500
2506
|
try {
|
|
2501
2507
|
const response = yield Promise.all(
|
|
2502
2508
|
properties.map((property) => __async(this, null, function* () {
|
|
2503
|
-
return
|
|
2509
|
+
return livechatClientInstance.post(
|
|
2504
2510
|
`/v3.3/configuration/action/register_property`,
|
|
2505
2511
|
{
|
|
2506
2512
|
name: property.name,
|
|
@@ -2531,7 +2537,7 @@ var livechatPropertyApi = {
|
|
|
2531
2537
|
yield Promise.all(
|
|
2532
2538
|
Object.keys(properties).map((property) => __async(this, null, function* () {
|
|
2533
2539
|
if (Object.keys(properties[property]).indexOf("public_access") <= 0) {
|
|
2534
|
-
return
|
|
2540
|
+
return livechatClientInstance.post(
|
|
2535
2541
|
`/v3.3/configuration/action/unregister_property`,
|
|
2536
2542
|
{
|
|
2537
2543
|
name: property,
|
|
@@ -2608,7 +2614,7 @@ var livechatWebhookApi = {
|
|
|
2608
2614
|
const { data: webhooks } = yield this.getWebhooks(clientId);
|
|
2609
2615
|
yield Promise.all(
|
|
2610
2616
|
webhooks.map((webhook) => __async(this, null, function* () {
|
|
2611
|
-
return
|
|
2617
|
+
return livechatClientInstance.post(
|
|
2612
2618
|
`/v3.5/configuration/action/unregister_webhook`,
|
|
2613
2619
|
{
|
|
2614
2620
|
id: webhook.id,
|
|
@@ -2631,10 +2637,10 @@ var livechatWebhookApi = {
|
|
|
2631
2637
|
registerWebhooks(webhooks) {
|
|
2632
2638
|
return __async(this, null, function* () {
|
|
2633
2639
|
try {
|
|
2634
|
-
yield this.unregisterWebhooks(webhooks[0]
|
|
2640
|
+
yield this.unregisterWebhooks(webhooks[0].owner_client_id);
|
|
2635
2641
|
yield Promise.all(
|
|
2636
2642
|
webhooks.map((webhook) => __async(this, null, function* () {
|
|
2637
|
-
return
|
|
2643
|
+
return livechatClientInstance.post(
|
|
2638
2644
|
`/v${webhook.api_version || "3.5"}/configuration/action/register_webhook`,
|
|
2639
2645
|
{
|
|
2640
2646
|
url: webhook.url,
|
|
@@ -2669,10 +2675,9 @@ var livechatWebhookApi = {
|
|
|
2669
2675
|
filters: webhook.filters
|
|
2670
2676
|
};
|
|
2671
2677
|
});
|
|
2672
|
-
const { data: verifiedWebhooks } = yield livechatClientInstance.post(
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
);
|
|
2678
|
+
const { data: verifiedWebhooks } = yield livechatClientInstance.post(`/v3.3/configuration/action/check_webhooks_migration`, [
|
|
2679
|
+
...webhooksToCheck
|
|
2680
|
+
]);
|
|
2676
2681
|
const updatedWebhooks = webhooks.map((webhook, index) => {
|
|
2677
2682
|
return __spreadProps(__spreadValues({}, webhook), {
|
|
2678
2683
|
action: verifiedWebhooks[index].action
|
|
@@ -2794,6 +2799,58 @@ function initPlatformAccountsClientInstance(baseUrl, token) {
|
|
|
2794
2799
|
}
|
|
2795
2800
|
}
|
|
2796
2801
|
|
|
2802
|
+
// src/apis/platform/accounts/accounts/api.ts
|
|
2803
|
+
var platformAccountsAccountApi = {
|
|
2804
|
+
getAccounts(authorization) {
|
|
2805
|
+
return __async(this, null, function* () {
|
|
2806
|
+
try {
|
|
2807
|
+
return yield platformAccountsClientInstance.get(
|
|
2808
|
+
`/v2/accounts`,
|
|
2809
|
+
getPlatformAccountsClientConfig(authorization)
|
|
2810
|
+
);
|
|
2811
|
+
} catch (error) {
|
|
2812
|
+
if (error instanceof Error) {
|
|
2813
|
+
throw new Error(`Accounts couldn't be fetched. [${error.message}]`);
|
|
2814
|
+
} else {
|
|
2815
|
+
throw error;
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
});
|
|
2819
|
+
},
|
|
2820
|
+
getAccount(accountId, authorization) {
|
|
2821
|
+
return __async(this, null, function* () {
|
|
2822
|
+
try {
|
|
2823
|
+
return yield platformAccountsClientInstance.get(
|
|
2824
|
+
`/v2/accounts/${accountId}`,
|
|
2825
|
+
getPlatformAccountsClientConfig(authorization)
|
|
2826
|
+
);
|
|
2827
|
+
} catch (error) {
|
|
2828
|
+
if (error instanceof Error) {
|
|
2829
|
+
throw new Error(`Account couldn't be fetched. [${error.message}]`);
|
|
2830
|
+
} else {
|
|
2831
|
+
throw error;
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
});
|
|
2835
|
+
},
|
|
2836
|
+
getMeAccount(authorization) {
|
|
2837
|
+
return __async(this, null, function* () {
|
|
2838
|
+
try {
|
|
2839
|
+
return yield platformAccountsClientInstance.get(
|
|
2840
|
+
`/v2/accounts/me`,
|
|
2841
|
+
getPlatformAccountsClientConfig(authorization)
|
|
2842
|
+
);
|
|
2843
|
+
} catch (error) {
|
|
2844
|
+
if (error instanceof Error) {
|
|
2845
|
+
throw new Error(`Account couldn't be fetched. [${error.message}]`);
|
|
2846
|
+
} else {
|
|
2847
|
+
throw error;
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
});
|
|
2851
|
+
}
|
|
2852
|
+
};
|
|
2853
|
+
|
|
2797
2854
|
// src/apis/platform/accounts/client/api.ts
|
|
2798
2855
|
var platformAccountsClientApi = {
|
|
2799
2856
|
getClients(authorization) {
|
|
@@ -3082,6 +3139,7 @@ var platformAccountsSessionsApi = {
|
|
|
3082
3139
|
|
|
3083
3140
|
// src/apis/platform/accounts/api.ts
|
|
3084
3141
|
var platformAccountsApi = {
|
|
3142
|
+
account: platformAccountsAccountApi,
|
|
3085
3143
|
client: platformAccountsClientApi,
|
|
3086
3144
|
pat: platformAccountsPersonalAccessTokenApi,
|
|
3087
3145
|
products: platformAccountsProductsApi,
|
|
@@ -3102,14 +3160,16 @@ function getPlatformDpsClientAuthorization(req) {
|
|
|
3102
3160
|
};
|
|
3103
3161
|
}
|
|
3104
3162
|
function getPlatformDpsAdminClientAuthorization() {
|
|
3105
|
-
|
|
3163
|
+
var _a, _b;
|
|
3164
|
+
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 : "";
|
|
3106
3165
|
return {
|
|
3107
|
-
token: btoa(
|
|
3166
|
+
token: btoa(`apps@livechatinc.com:${token}`),
|
|
3108
3167
|
tokenType: "Basic"
|
|
3109
3168
|
};
|
|
3110
3169
|
}
|
|
3111
3170
|
function getPlatformDpsClientConfig(options = {}) {
|
|
3112
|
-
const
|
|
3171
|
+
const currentHeaders = platformDpsClientInstance.defaults.headers;
|
|
3172
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
3113
3173
|
const headers = {
|
|
3114
3174
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
3115
3175
|
};
|
|
@@ -3118,19 +3178,20 @@ function getPlatformDpsClientConfig(options = {}) {
|
|
|
3118
3178
|
};
|
|
3119
3179
|
}
|
|
3120
3180
|
function initPlatformDpsClientInstance(baseUrl, token) {
|
|
3181
|
+
const headers = platformDpsClientInstance.defaults.headers;
|
|
3121
3182
|
if (baseUrl) {
|
|
3122
3183
|
platformDpsClientInstance.interceptors.request.use(
|
|
3123
|
-
(config) =>
|
|
3184
|
+
(config) => {
|
|
3124
3185
|
config.baseURL = baseUrl;
|
|
3125
3186
|
return config;
|
|
3126
|
-
}
|
|
3187
|
+
},
|
|
3127
3188
|
(error) => Promise.reject(error)
|
|
3128
3189
|
);
|
|
3129
3190
|
}
|
|
3130
3191
|
if (token) {
|
|
3131
|
-
|
|
3192
|
+
headers.Authorization = `Bearer ${token}`;
|
|
3132
3193
|
} else {
|
|
3133
|
-
delete
|
|
3194
|
+
delete headers.Authorization;
|
|
3134
3195
|
}
|
|
3135
3196
|
}
|
|
3136
3197
|
|
|
@@ -3535,17 +3596,16 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3535
3596
|
},
|
|
3536
3597
|
updateBlocks(appId, payload, authorization) {
|
|
3537
3598
|
return __async(this, null, function* () {
|
|
3538
|
-
|
|
3599
|
+
yield platformDpsClientInstance.patch(
|
|
3539
3600
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3540
3601
|
payload,
|
|
3541
3602
|
getPlatformDpsClientConfig(authorization)
|
|
3542
3603
|
);
|
|
3543
|
-
return response.data;
|
|
3544
3604
|
});
|
|
3545
3605
|
},
|
|
3546
3606
|
updateRepository(appId, payload, authorization) {
|
|
3547
3607
|
return __async(this, null, function* () {
|
|
3548
|
-
|
|
3608
|
+
yield platformDpsClientInstance.patch(
|
|
3549
3609
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3550
3610
|
{
|
|
3551
3611
|
appId,
|
|
@@ -3555,13 +3615,12 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3555
3615
|
},
|
|
3556
3616
|
getPlatformDpsClientConfig(authorization)
|
|
3557
3617
|
);
|
|
3558
|
-
return response.data;
|
|
3559
3618
|
});
|
|
3560
3619
|
},
|
|
3561
3620
|
updateDeployment(appId, payload, authorization) {
|
|
3562
3621
|
return __async(this, null, function* () {
|
|
3563
3622
|
const config = payload.customUrl ? { custom: { url: payload.customUrl } } : { custom: null };
|
|
3564
|
-
|
|
3623
|
+
yield platformDpsClientInstance.patch(
|
|
3565
3624
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3566
3625
|
{
|
|
3567
3626
|
appId,
|
|
@@ -3573,12 +3632,11 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3573
3632
|
},
|
|
3574
3633
|
getPlatformDpsClientConfig(authorization)
|
|
3575
3634
|
);
|
|
3576
|
-
return response.data;
|
|
3577
3635
|
});
|
|
3578
3636
|
},
|
|
3579
3637
|
updateStorage(appId, payload, authorization) {
|
|
3580
3638
|
return __async(this, null, function* () {
|
|
3581
|
-
|
|
3639
|
+
yield platformDpsClientInstance.patch(
|
|
3582
3640
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3583
3641
|
{
|
|
3584
3642
|
appId,
|
|
@@ -3588,12 +3646,11 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3588
3646
|
},
|
|
3589
3647
|
getPlatformDpsClientConfig(authorization)
|
|
3590
3648
|
);
|
|
3591
|
-
return response.data;
|
|
3592
3649
|
});
|
|
3593
3650
|
},
|
|
3594
3651
|
updateLogger(appId, payload, authorization) {
|
|
3595
3652
|
return __async(this, null, function* () {
|
|
3596
|
-
|
|
3653
|
+
yield platformDpsClientInstance.post(
|
|
3597
3654
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3598
3655
|
{
|
|
3599
3656
|
appId,
|
|
@@ -3603,7 +3660,6 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3603
3660
|
},
|
|
3604
3661
|
getPlatformDpsClientConfig(authorization)
|
|
3605
3662
|
);
|
|
3606
|
-
return response.data;
|
|
3607
3663
|
});
|
|
3608
3664
|
}
|
|
3609
3665
|
};
|
|
@@ -4311,8 +4367,8 @@ var platformDpsDeveloperApi = {
|
|
|
4311
4367
|
return __async(this, null, function* () {
|
|
4312
4368
|
try {
|
|
4313
4369
|
const { startAt, endAt, size, page } = options;
|
|
4314
|
-
const withRange =
|
|
4315
|
-
const withPagination =
|
|
4370
|
+
const withRange = Boolean(startAt && endAt);
|
|
4371
|
+
const withPagination = Boolean(size && typeof page === "number");
|
|
4316
4372
|
let params = withRange || withPagination ? `?` : "";
|
|
4317
4373
|
if (withRange) {
|
|
4318
4374
|
params += `from=${startAt}&to=${endAt}`;
|
|
@@ -4492,7 +4548,7 @@ var dpsResearchDictionaryApi = {
|
|
|
4492
4548
|
try {
|
|
4493
4549
|
const params = new URLSearchParams(options);
|
|
4494
4550
|
const response = yield platformDpsClientInstance.get(
|
|
4495
|
-
`/v2/research/dictionary?${params}`,
|
|
4551
|
+
`/v2/research/dictionary?${params.toString()}`,
|
|
4496
4552
|
getPlatformDpsClientConfig(authorization)
|
|
4497
4553
|
);
|
|
4498
4554
|
return response.data;
|
|
@@ -4515,7 +4571,7 @@ var dpsResearchMarketplaceApi = {
|
|
|
4515
4571
|
try {
|
|
4516
4572
|
const params = new URLSearchParams(options);
|
|
4517
4573
|
const response = yield platformDpsClientInstance.get(
|
|
4518
|
-
`/v2/research/marketplace/apps?${params}`,
|
|
4574
|
+
`/v2/research/marketplace/apps?${params.toString()}`,
|
|
4519
4575
|
getPlatformDpsClientConfig(authorization)
|
|
4520
4576
|
);
|
|
4521
4577
|
return response.data;
|
|
@@ -4534,7 +4590,7 @@ var dpsResearchMarketplaceApi = {
|
|
|
4534
4590
|
try {
|
|
4535
4591
|
const params = new URLSearchParams(options);
|
|
4536
4592
|
const response = yield platformDpsClientInstance.get(
|
|
4537
|
-
`/v2/research/marketplace/views?${params}`,
|
|
4593
|
+
`/v2/research/marketplace/views?${params.toString()}`,
|
|
4538
4594
|
getPlatformDpsClientConfig(authorization)
|
|
4539
4595
|
);
|
|
4540
4596
|
return response.data;
|
|
@@ -4557,7 +4613,7 @@ var dpsResearchTrafficApi = {
|
|
|
4557
4613
|
try {
|
|
4558
4614
|
const params = new URLSearchParams(options);
|
|
4559
4615
|
const response = yield platformDpsClientInstance.get(
|
|
4560
|
-
`/v2/research/traffic/agents?${params}`,
|
|
4616
|
+
`/v2/research/traffic/agents?${params.toString()}`,
|
|
4561
4617
|
getPlatformDpsClientConfig(authorization)
|
|
4562
4618
|
);
|
|
4563
4619
|
return response.data;
|
|
@@ -4576,7 +4632,7 @@ var dpsResearchTrafficApi = {
|
|
|
4576
4632
|
try {
|
|
4577
4633
|
const params = new URLSearchParams(options);
|
|
4578
4634
|
const response = yield platformDpsClientInstance.get(
|
|
4579
|
-
`/v2/research/traffic/chats?${params}`,
|
|
4635
|
+
`/v2/research/traffic/chats?${params.toString()}`,
|
|
4580
4636
|
getPlatformDpsClientConfig(authorization)
|
|
4581
4637
|
);
|
|
4582
4638
|
return response.data;
|
|
@@ -4632,35 +4688,29 @@ var platformDpsUserApi = {
|
|
|
4632
4688
|
},
|
|
4633
4689
|
updateUserIntegrations(payload, authorization) {
|
|
4634
4690
|
return __async(this, null, function* () {
|
|
4635
|
-
|
|
4691
|
+
yield platformDpsClientInstance.patch(
|
|
4636
4692
|
`/v2/me/integrations`,
|
|
4637
4693
|
payload,
|
|
4638
4694
|
getPlatformDpsClientConfig(authorization)
|
|
4639
4695
|
);
|
|
4640
|
-
return response.data;
|
|
4641
4696
|
});
|
|
4642
4697
|
},
|
|
4643
4698
|
updateUserFeatures(payload, authorization) {
|
|
4644
4699
|
return __async(this, null, function* () {
|
|
4645
|
-
|
|
4700
|
+
yield platformDpsClientInstance.put(
|
|
4646
4701
|
"/v2/features",
|
|
4647
4702
|
payload,
|
|
4648
4703
|
getPlatformDpsClientConfig(authorization)
|
|
4649
4704
|
);
|
|
4650
|
-
return response.data;
|
|
4651
4705
|
});
|
|
4652
4706
|
},
|
|
4653
4707
|
removeUserGitHubIntegrationByInstallationId(installationId, authorization) {
|
|
4654
4708
|
return __async(this, null, function* () {
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
}
|
|
4661
|
-
})
|
|
4662
|
-
);
|
|
4663
|
-
return response.data;
|
|
4709
|
+
yield platformDpsClientInstance.delete(`/v2/me/integrations/github`, __spreadProps(__spreadValues({}, getPlatformDpsClientConfig(authorization)), {
|
|
4710
|
+
data: {
|
|
4711
|
+
githubInstallationId: installationId
|
|
4712
|
+
}
|
|
4713
|
+
}));
|
|
4664
4714
|
});
|
|
4665
4715
|
},
|
|
4666
4716
|
updateUserNetlifyIntegration(userNetlifyIntegration, authorization) {
|
|
@@ -4714,8 +4764,11 @@ platformAdapterClientInstance.interceptors.response.use(
|
|
|
4714
4764
|
(error) => {
|
|
4715
4765
|
var _a;
|
|
4716
4766
|
if (axios13.isAxiosError(error)) {
|
|
4717
|
-
if (((_a = error.response) == null ? void 0 : _a.status) === 401
|
|
4718
|
-
|
|
4767
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
4768
|
+
const source = error.response.data.error.source;
|
|
4769
|
+
if (source) {
|
|
4770
|
+
throw new UnauthorizeApiError(source);
|
|
4771
|
+
}
|
|
4719
4772
|
}
|
|
4720
4773
|
}
|
|
4721
4774
|
throw error;
|
|
@@ -4723,19 +4776,20 @@ platformAdapterClientInstance.interceptors.response.use(
|
|
|
4723
4776
|
);
|
|
4724
4777
|
function getPlatformAdapterClientConfig(options = {}) {
|
|
4725
4778
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
4779
|
+
const currentHeaders = platformAdapterClientInstance.defaults.headers;
|
|
4726
4780
|
const headers = {
|
|
4727
4781
|
platform: {
|
|
4728
|
-
dps: (_b =
|
|
4782
|
+
dps: (_b = currentHeaders["platform-dps-token"]) != null ? _b : (_a = options.platform) == null ? void 0 : _a.dps
|
|
4729
4783
|
},
|
|
4730
4784
|
integrations: {
|
|
4731
4785
|
github: {
|
|
4732
|
-
app: (_d =
|
|
4733
|
-
oauth: (_f =
|
|
4786
|
+
app: (_d = currentHeaders["github-app-token"]) != null ? _d : (_c = options.github) == null ? void 0 : _c.app,
|
|
4787
|
+
oauth: (_f = currentHeaders["github-oauth-token"]) != null ? _f : (_e = options.github) == null ? void 0 : _e.oauth
|
|
4734
4788
|
},
|
|
4735
|
-
netlify: (_g =
|
|
4736
|
-
vercel: (_h =
|
|
4737
|
-
planetscale: (_i =
|
|
4738
|
-
sentry: (_j =
|
|
4789
|
+
netlify: (_g = currentHeaders["netlify-token"]) != null ? _g : options.netlify,
|
|
4790
|
+
vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
|
|
4791
|
+
planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
|
|
4792
|
+
sentry: (_j = currentHeaders["sentry-token"]) != null ? _j : options.sentry
|
|
4739
4793
|
}
|
|
4740
4794
|
};
|
|
4741
4795
|
if (((_l = (_k = options.ensureAuthorizationToken) == null ? void 0 : _k.platform) == null ? void 0 : _l.dps) && !headers.platform.dps) {
|
|
@@ -4763,10 +4817,10 @@ function getPlatformAdapterClientConfig(options = {}) {
|
|
|
4763
4817
|
function initPlatformAdapterClientInstance(baseUrl, tokens) {
|
|
4764
4818
|
if (baseUrl) {
|
|
4765
4819
|
platformAdapterClientInstance.interceptors.request.use(
|
|
4766
|
-
(config) =>
|
|
4820
|
+
(config) => {
|
|
4767
4821
|
config.baseURL = baseUrl;
|
|
4768
4822
|
return config;
|
|
4769
|
-
}
|
|
4823
|
+
},
|
|
4770
4824
|
(error) => Promise.reject(error)
|
|
4771
4825
|
);
|
|
4772
4826
|
}
|
|
@@ -4776,26 +4830,27 @@ function initPlatformAdapterClientInstance(baseUrl, tokens) {
|
|
|
4776
4830
|
}
|
|
4777
4831
|
function updatePlatformAdapterClientInstance(tokens) {
|
|
4778
4832
|
var _a;
|
|
4833
|
+
const headers = platformAdapterClientInstance.defaults.headers;
|
|
4779
4834
|
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.dps) {
|
|
4780
|
-
|
|
4835
|
+
headers["platform-dps-token"] = tokens.platform.dps;
|
|
4781
4836
|
}
|
|
4782
4837
|
if (tokens == null ? void 0 : tokens.github.app) {
|
|
4783
|
-
|
|
4838
|
+
headers["github-app-token"] = tokens.github.app;
|
|
4784
4839
|
}
|
|
4785
4840
|
if (tokens == null ? void 0 : tokens.github.oauth) {
|
|
4786
|
-
|
|
4841
|
+
headers["github-oauth-token"] = tokens.github.oauth;
|
|
4787
4842
|
}
|
|
4788
4843
|
if (tokens == null ? void 0 : tokens.netlify) {
|
|
4789
|
-
|
|
4844
|
+
headers["netlify-token"] = tokens.netlify;
|
|
4790
4845
|
}
|
|
4791
4846
|
if (tokens == null ? void 0 : tokens.vercel) {
|
|
4792
|
-
|
|
4847
|
+
headers["vercel-token"] = tokens.vercel;
|
|
4793
4848
|
}
|
|
4794
4849
|
if (tokens == null ? void 0 : tokens.planetscale) {
|
|
4795
|
-
|
|
4850
|
+
headers["planetscale-token"] = tokens.planetscale;
|
|
4796
4851
|
}
|
|
4797
4852
|
if (tokens == null ? void 0 : tokens.sentry) {
|
|
4798
|
-
|
|
4853
|
+
headers["sentry-token"] = tokens.sentry;
|
|
4799
4854
|
}
|
|
4800
4855
|
}
|
|
4801
4856
|
|
|
@@ -4834,7 +4889,7 @@ var platformAdapterAppDeploymentApi = {
|
|
|
4834
4889
|
},
|
|
4835
4890
|
unlink(payload, authorization) {
|
|
4836
4891
|
return __async(this, null, function* () {
|
|
4837
|
-
|
|
4892
|
+
yield platformAdapterClientInstance.post(
|
|
4838
4893
|
`/console/app/${payload.appId}/blocks/deployment/unlink`,
|
|
4839
4894
|
payload,
|
|
4840
4895
|
getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -4845,12 +4900,11 @@ var platformAdapterAppDeploymentApi = {
|
|
|
4845
4900
|
}
|
|
4846
4901
|
}))
|
|
4847
4902
|
);
|
|
4848
|
-
return response.data;
|
|
4849
4903
|
});
|
|
4850
4904
|
},
|
|
4851
4905
|
installSentry(appId, authorization) {
|
|
4852
4906
|
return __async(this, null, function* () {
|
|
4853
|
-
|
|
4907
|
+
yield platformAdapterClientInstance.post(
|
|
4854
4908
|
`/console/app/${appId}/blocks/deployment/install/sentry`,
|
|
4855
4909
|
{},
|
|
4856
4910
|
getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -4861,7 +4915,6 @@ var platformAdapterAppDeploymentApi = {
|
|
|
4861
4915
|
}
|
|
4862
4916
|
}))
|
|
4863
4917
|
);
|
|
4864
|
-
return response.data;
|
|
4865
4918
|
});
|
|
4866
4919
|
}
|
|
4867
4920
|
};
|
|
@@ -4879,22 +4932,20 @@ var platformAdapterAppSentryLoggerApi = {
|
|
|
4879
4932
|
},
|
|
4880
4933
|
link(payload, authorization) {
|
|
4881
4934
|
return __async(this, null, function* () {
|
|
4882
|
-
|
|
4935
|
+
yield platformAdapterClientInstance.post(
|
|
4883
4936
|
"/console/app/blocks/logger/providers/sentry/link",
|
|
4884
4937
|
payload,
|
|
4885
4938
|
getPlatformAdapterClientConfig(authorization)
|
|
4886
4939
|
);
|
|
4887
|
-
return response.data;
|
|
4888
4940
|
});
|
|
4889
4941
|
},
|
|
4890
4942
|
unlink(payload, authorization) {
|
|
4891
4943
|
return __async(this, null, function* () {
|
|
4892
|
-
|
|
4944
|
+
yield platformAdapterClientInstance.post(
|
|
4893
4945
|
"/console/app/blocks/logger/providers/sentry/unlink",
|
|
4894
4946
|
payload,
|
|
4895
4947
|
getPlatformAdapterClientConfig(authorization)
|
|
4896
4948
|
);
|
|
4897
|
-
return response.data;
|
|
4898
4949
|
});
|
|
4899
4950
|
},
|
|
4900
4951
|
reauthorizeSentryApp(userId, sentryInstallationId, sentryRefreshToken, authorization) {
|
|
@@ -4967,7 +5018,7 @@ var platformAdapterAppRepositoryApi = {
|
|
|
4967
5018
|
},
|
|
4968
5019
|
unlink(payload, authorization) {
|
|
4969
5020
|
return __async(this, null, function* () {
|
|
4970
|
-
|
|
5021
|
+
yield platformAdapterClientInstance.post(
|
|
4971
5022
|
`/console/app/${payload.appId}/blocks/repository/unlink`,
|
|
4972
5023
|
payload,
|
|
4973
5024
|
getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -4978,7 +5029,6 @@ var platformAdapterAppRepositoryApi = {
|
|
|
4978
5029
|
}
|
|
4979
5030
|
}))
|
|
4980
5031
|
);
|
|
4981
|
-
return response.data;
|
|
4982
5032
|
});
|
|
4983
5033
|
},
|
|
4984
5034
|
seed(payload, authorization) {
|
|
@@ -5033,7 +5083,7 @@ var platformAdapterAppStorageApi = {
|
|
|
5033
5083
|
},
|
|
5034
5084
|
unlink(payload, authorization) {
|
|
5035
5085
|
return __async(this, null, function* () {
|
|
5036
|
-
|
|
5086
|
+
yield platformAdapterClientInstance.post(
|
|
5037
5087
|
`/console/app/${payload.appId}/blocks/storage/unlink`,
|
|
5038
5088
|
payload,
|
|
5039
5089
|
getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -5044,7 +5094,6 @@ var platformAdapterAppStorageApi = {
|
|
|
5044
5094
|
}
|
|
5045
5095
|
}))
|
|
5046
5096
|
);
|
|
5047
|
-
return response.data;
|
|
5048
5097
|
});
|
|
5049
5098
|
}
|
|
5050
5099
|
};
|
|
@@ -5083,40 +5132,36 @@ var platformAdapterAppVariablesApi = {
|
|
|
5083
5132
|
},
|
|
5084
5133
|
syncVariable(appId, key, payload, authorization) {
|
|
5085
5134
|
return __async(this, null, function* () {
|
|
5086
|
-
|
|
5135
|
+
yield platformAdapterClientInstance.post(
|
|
5087
5136
|
`/console/app/${appId}/variables/${key}/sync`,
|
|
5088
5137
|
payload,
|
|
5089
5138
|
getPlatformAdapterClientConfig(authorization)
|
|
5090
5139
|
);
|
|
5091
|
-
return response.data;
|
|
5092
5140
|
});
|
|
5093
5141
|
},
|
|
5094
5142
|
createVariable(appId, data, authorization) {
|
|
5095
5143
|
return __async(this, null, function* () {
|
|
5096
|
-
|
|
5144
|
+
yield platformAdapterClientInstance.post(
|
|
5097
5145
|
`/console/app/${appId}/variables/${data.key}`,
|
|
5098
5146
|
data,
|
|
5099
5147
|
getPlatformAdapterClientConfig(authorization)
|
|
5100
5148
|
);
|
|
5101
|
-
return response.data;
|
|
5102
5149
|
});
|
|
5103
5150
|
},
|
|
5104
5151
|
editVariable(appId, data, authorization) {
|
|
5105
5152
|
return __async(this, null, function* () {
|
|
5106
|
-
|
|
5153
|
+
yield platformAdapterClientInstance.post(
|
|
5107
5154
|
`/console/app/${appId}/variables/${data.key}/edit`,
|
|
5108
5155
|
data,
|
|
5109
5156
|
getPlatformAdapterClientConfig(authorization)
|
|
5110
5157
|
);
|
|
5111
|
-
return response.data;
|
|
5112
5158
|
});
|
|
5113
5159
|
},
|
|
5114
5160
|
deleteVariable(data) {
|
|
5115
5161
|
return __async(this, null, function* () {
|
|
5116
|
-
|
|
5162
|
+
yield platformAdapterClientInstance.delete(
|
|
5117
5163
|
`/console/app/${data.appId}/variables/${data.key}`
|
|
5118
5164
|
);
|
|
5119
|
-
return response.data;
|
|
5120
5165
|
});
|
|
5121
5166
|
}
|
|
5122
5167
|
};
|