@livechat/developer-studio-api 2.3.0 → 2.3.1
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 +219 -256
- package/dist/index.d.ts +219 -256
- package/dist/index.js +286 -294
- package/dist/index.mjs +286 -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
|
|
@@ -3102,14 +3107,16 @@ function getPlatformDpsClientAuthorization(req) {
|
|
|
3102
3107
|
};
|
|
3103
3108
|
}
|
|
3104
3109
|
function getPlatformDpsAdminClientAuthorization() {
|
|
3105
|
-
|
|
3110
|
+
var _a, _b;
|
|
3111
|
+
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
3112
|
return {
|
|
3107
|
-
token: btoa(
|
|
3113
|
+
token: btoa(`apps@livechatinc.com:${token}`),
|
|
3108
3114
|
tokenType: "Basic"
|
|
3109
3115
|
};
|
|
3110
3116
|
}
|
|
3111
3117
|
function getPlatformDpsClientConfig(options = {}) {
|
|
3112
|
-
const
|
|
3118
|
+
const currentHeaders = platformDpsClientInstance.defaults.headers;
|
|
3119
|
+
const defaultAuthorization = currentHeaders.Authorization;
|
|
3113
3120
|
const headers = {
|
|
3114
3121
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
3115
3122
|
};
|
|
@@ -3118,19 +3125,20 @@ function getPlatformDpsClientConfig(options = {}) {
|
|
|
3118
3125
|
};
|
|
3119
3126
|
}
|
|
3120
3127
|
function initPlatformDpsClientInstance(baseUrl, token) {
|
|
3128
|
+
const headers = platformDpsClientInstance.defaults.headers;
|
|
3121
3129
|
if (baseUrl) {
|
|
3122
3130
|
platformDpsClientInstance.interceptors.request.use(
|
|
3123
|
-
(config) =>
|
|
3131
|
+
(config) => {
|
|
3124
3132
|
config.baseURL = baseUrl;
|
|
3125
3133
|
return config;
|
|
3126
|
-
}
|
|
3134
|
+
},
|
|
3127
3135
|
(error) => Promise.reject(error)
|
|
3128
3136
|
);
|
|
3129
3137
|
}
|
|
3130
3138
|
if (token) {
|
|
3131
|
-
|
|
3139
|
+
headers.Authorization = `Bearer ${token}`;
|
|
3132
3140
|
} else {
|
|
3133
|
-
delete
|
|
3141
|
+
delete headers.Authorization;
|
|
3134
3142
|
}
|
|
3135
3143
|
}
|
|
3136
3144
|
|
|
@@ -3535,17 +3543,16 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3535
3543
|
},
|
|
3536
3544
|
updateBlocks(appId, payload, authorization) {
|
|
3537
3545
|
return __async(this, null, function* () {
|
|
3538
|
-
|
|
3546
|
+
yield platformDpsClientInstance.patch(
|
|
3539
3547
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3540
3548
|
payload,
|
|
3541
3549
|
getPlatformDpsClientConfig(authorization)
|
|
3542
3550
|
);
|
|
3543
|
-
return response.data;
|
|
3544
3551
|
});
|
|
3545
3552
|
},
|
|
3546
3553
|
updateRepository(appId, payload, authorization) {
|
|
3547
3554
|
return __async(this, null, function* () {
|
|
3548
|
-
|
|
3555
|
+
yield platformDpsClientInstance.patch(
|
|
3549
3556
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3550
3557
|
{
|
|
3551
3558
|
appId,
|
|
@@ -3555,13 +3562,12 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3555
3562
|
},
|
|
3556
3563
|
getPlatformDpsClientConfig(authorization)
|
|
3557
3564
|
);
|
|
3558
|
-
return response.data;
|
|
3559
3565
|
});
|
|
3560
3566
|
},
|
|
3561
3567
|
updateDeployment(appId, payload, authorization) {
|
|
3562
3568
|
return __async(this, null, function* () {
|
|
3563
3569
|
const config = payload.customUrl ? { custom: { url: payload.customUrl } } : { custom: null };
|
|
3564
|
-
|
|
3570
|
+
yield platformDpsClientInstance.patch(
|
|
3565
3571
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3566
3572
|
{
|
|
3567
3573
|
appId,
|
|
@@ -3573,12 +3579,11 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3573
3579
|
},
|
|
3574
3580
|
getPlatformDpsClientConfig(authorization)
|
|
3575
3581
|
);
|
|
3576
|
-
return response.data;
|
|
3577
3582
|
});
|
|
3578
3583
|
},
|
|
3579
3584
|
updateStorage(appId, payload, authorization) {
|
|
3580
3585
|
return __async(this, null, function* () {
|
|
3581
|
-
|
|
3586
|
+
yield platformDpsClientInstance.patch(
|
|
3582
3587
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3583
3588
|
{
|
|
3584
3589
|
appId,
|
|
@@ -3588,12 +3593,11 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3588
3593
|
},
|
|
3589
3594
|
getPlatformDpsClientConfig(authorization)
|
|
3590
3595
|
);
|
|
3591
|
-
return response.data;
|
|
3592
3596
|
});
|
|
3593
3597
|
},
|
|
3594
3598
|
updateLogger(appId, payload, authorization) {
|
|
3595
3599
|
return __async(this, null, function* () {
|
|
3596
|
-
|
|
3600
|
+
yield platformDpsClientInstance.post(
|
|
3597
3601
|
`/v2/applications/${appId}/infrastructure/blocks`,
|
|
3598
3602
|
{
|
|
3599
3603
|
appId,
|
|
@@ -3603,7 +3607,6 @@ var platformDpsApplicationInfrastructureBlocksApi = {
|
|
|
3603
3607
|
},
|
|
3604
3608
|
getPlatformDpsClientConfig(authorization)
|
|
3605
3609
|
);
|
|
3606
|
-
return response.data;
|
|
3607
3610
|
});
|
|
3608
3611
|
}
|
|
3609
3612
|
};
|
|
@@ -4311,8 +4314,8 @@ var platformDpsDeveloperApi = {
|
|
|
4311
4314
|
return __async(this, null, function* () {
|
|
4312
4315
|
try {
|
|
4313
4316
|
const { startAt, endAt, size, page } = options;
|
|
4314
|
-
const withRange =
|
|
4315
|
-
const withPagination =
|
|
4317
|
+
const withRange = Boolean(startAt && endAt);
|
|
4318
|
+
const withPagination = Boolean(size && typeof page === "number");
|
|
4316
4319
|
let params = withRange || withPagination ? `?` : "";
|
|
4317
4320
|
if (withRange) {
|
|
4318
4321
|
params += `from=${startAt}&to=${endAt}`;
|
|
@@ -4492,7 +4495,7 @@ var dpsResearchDictionaryApi = {
|
|
|
4492
4495
|
try {
|
|
4493
4496
|
const params = new URLSearchParams(options);
|
|
4494
4497
|
const response = yield platformDpsClientInstance.get(
|
|
4495
|
-
`/v2/research/dictionary?${params}`,
|
|
4498
|
+
`/v2/research/dictionary?${params.toString()}`,
|
|
4496
4499
|
getPlatformDpsClientConfig(authorization)
|
|
4497
4500
|
);
|
|
4498
4501
|
return response.data;
|
|
@@ -4515,7 +4518,7 @@ var dpsResearchMarketplaceApi = {
|
|
|
4515
4518
|
try {
|
|
4516
4519
|
const params = new URLSearchParams(options);
|
|
4517
4520
|
const response = yield platformDpsClientInstance.get(
|
|
4518
|
-
`/v2/research/marketplace/apps?${params}`,
|
|
4521
|
+
`/v2/research/marketplace/apps?${params.toString()}`,
|
|
4519
4522
|
getPlatformDpsClientConfig(authorization)
|
|
4520
4523
|
);
|
|
4521
4524
|
return response.data;
|
|
@@ -4534,7 +4537,7 @@ var dpsResearchMarketplaceApi = {
|
|
|
4534
4537
|
try {
|
|
4535
4538
|
const params = new URLSearchParams(options);
|
|
4536
4539
|
const response = yield platformDpsClientInstance.get(
|
|
4537
|
-
`/v2/research/marketplace/views?${params}`,
|
|
4540
|
+
`/v2/research/marketplace/views?${params.toString()}`,
|
|
4538
4541
|
getPlatformDpsClientConfig(authorization)
|
|
4539
4542
|
);
|
|
4540
4543
|
return response.data;
|
|
@@ -4557,7 +4560,7 @@ var dpsResearchTrafficApi = {
|
|
|
4557
4560
|
try {
|
|
4558
4561
|
const params = new URLSearchParams(options);
|
|
4559
4562
|
const response = yield platformDpsClientInstance.get(
|
|
4560
|
-
`/v2/research/traffic/agents?${params}`,
|
|
4563
|
+
`/v2/research/traffic/agents?${params.toString()}`,
|
|
4561
4564
|
getPlatformDpsClientConfig(authorization)
|
|
4562
4565
|
);
|
|
4563
4566
|
return response.data;
|
|
@@ -4576,7 +4579,7 @@ var dpsResearchTrafficApi = {
|
|
|
4576
4579
|
try {
|
|
4577
4580
|
const params = new URLSearchParams(options);
|
|
4578
4581
|
const response = yield platformDpsClientInstance.get(
|
|
4579
|
-
`/v2/research/traffic/chats?${params}`,
|
|
4582
|
+
`/v2/research/traffic/chats?${params.toString()}`,
|
|
4580
4583
|
getPlatformDpsClientConfig(authorization)
|
|
4581
4584
|
);
|
|
4582
4585
|
return response.data;
|
|
@@ -4632,35 +4635,29 @@ var platformDpsUserApi = {
|
|
|
4632
4635
|
},
|
|
4633
4636
|
updateUserIntegrations(payload, authorization) {
|
|
4634
4637
|
return __async(this, null, function* () {
|
|
4635
|
-
|
|
4638
|
+
yield platformDpsClientInstance.patch(
|
|
4636
4639
|
`/v2/me/integrations`,
|
|
4637
4640
|
payload,
|
|
4638
4641
|
getPlatformDpsClientConfig(authorization)
|
|
4639
4642
|
);
|
|
4640
|
-
return response.data;
|
|
4641
4643
|
});
|
|
4642
4644
|
},
|
|
4643
4645
|
updateUserFeatures(payload, authorization) {
|
|
4644
4646
|
return __async(this, null, function* () {
|
|
4645
|
-
|
|
4647
|
+
yield platformDpsClientInstance.put(
|
|
4646
4648
|
"/v2/features",
|
|
4647
4649
|
payload,
|
|
4648
4650
|
getPlatformDpsClientConfig(authorization)
|
|
4649
4651
|
);
|
|
4650
|
-
return response.data;
|
|
4651
4652
|
});
|
|
4652
4653
|
},
|
|
4653
4654
|
removeUserGitHubIntegrationByInstallationId(installationId, authorization) {
|
|
4654
4655
|
return __async(this, null, function* () {
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
}
|
|
4661
|
-
})
|
|
4662
|
-
);
|
|
4663
|
-
return response.data;
|
|
4656
|
+
yield platformDpsClientInstance.delete(`/v2/me/integrations/github`, __spreadProps(__spreadValues({}, getPlatformDpsClientConfig(authorization)), {
|
|
4657
|
+
data: {
|
|
4658
|
+
githubInstallationId: installationId
|
|
4659
|
+
}
|
|
4660
|
+
}));
|
|
4664
4661
|
});
|
|
4665
4662
|
},
|
|
4666
4663
|
updateUserNetlifyIntegration(userNetlifyIntegration, authorization) {
|
|
@@ -4714,8 +4711,11 @@ platformAdapterClientInstance.interceptors.response.use(
|
|
|
4714
4711
|
(error) => {
|
|
4715
4712
|
var _a;
|
|
4716
4713
|
if (axios13.isAxiosError(error)) {
|
|
4717
|
-
if (((_a = error.response) == null ? void 0 : _a.status) === 401
|
|
4718
|
-
|
|
4714
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
4715
|
+
const source = error.response.data.error.source;
|
|
4716
|
+
if (source) {
|
|
4717
|
+
throw new UnauthorizeApiError(source);
|
|
4718
|
+
}
|
|
4719
4719
|
}
|
|
4720
4720
|
}
|
|
4721
4721
|
throw error;
|
|
@@ -4723,19 +4723,20 @@ platformAdapterClientInstance.interceptors.response.use(
|
|
|
4723
4723
|
);
|
|
4724
4724
|
function getPlatformAdapterClientConfig(options = {}) {
|
|
4725
4725
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
4726
|
+
const currentHeaders = platformAdapterClientInstance.defaults.headers;
|
|
4726
4727
|
const headers = {
|
|
4727
4728
|
platform: {
|
|
4728
|
-
dps: (_b =
|
|
4729
|
+
dps: (_b = currentHeaders["platform-dps-token"]) != null ? _b : (_a = options.platform) == null ? void 0 : _a.dps
|
|
4729
4730
|
},
|
|
4730
4731
|
integrations: {
|
|
4731
4732
|
github: {
|
|
4732
|
-
app: (_d =
|
|
4733
|
-
oauth: (_f =
|
|
4733
|
+
app: (_d = currentHeaders["github-app-token"]) != null ? _d : (_c = options.github) == null ? void 0 : _c.app,
|
|
4734
|
+
oauth: (_f = currentHeaders["github-oauth-token"]) != null ? _f : (_e = options.github) == null ? void 0 : _e.oauth
|
|
4734
4735
|
},
|
|
4735
|
-
netlify: (_g =
|
|
4736
|
-
vercel: (_h =
|
|
4737
|
-
planetscale: (_i =
|
|
4738
|
-
sentry: (_j =
|
|
4736
|
+
netlify: (_g = currentHeaders["netlify-token"]) != null ? _g : options.netlify,
|
|
4737
|
+
vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
|
|
4738
|
+
planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
|
|
4739
|
+
sentry: (_j = currentHeaders["sentry-token"]) != null ? _j : options.sentry
|
|
4739
4740
|
}
|
|
4740
4741
|
};
|
|
4741
4742
|
if (((_l = (_k = options.ensureAuthorizationToken) == null ? void 0 : _k.platform) == null ? void 0 : _l.dps) && !headers.platform.dps) {
|
|
@@ -4763,10 +4764,10 @@ function getPlatformAdapterClientConfig(options = {}) {
|
|
|
4763
4764
|
function initPlatformAdapterClientInstance(baseUrl, tokens) {
|
|
4764
4765
|
if (baseUrl) {
|
|
4765
4766
|
platformAdapterClientInstance.interceptors.request.use(
|
|
4766
|
-
(config) =>
|
|
4767
|
+
(config) => {
|
|
4767
4768
|
config.baseURL = baseUrl;
|
|
4768
4769
|
return config;
|
|
4769
|
-
}
|
|
4770
|
+
},
|
|
4770
4771
|
(error) => Promise.reject(error)
|
|
4771
4772
|
);
|
|
4772
4773
|
}
|
|
@@ -4776,26 +4777,27 @@ function initPlatformAdapterClientInstance(baseUrl, tokens) {
|
|
|
4776
4777
|
}
|
|
4777
4778
|
function updatePlatformAdapterClientInstance(tokens) {
|
|
4778
4779
|
var _a;
|
|
4780
|
+
const headers = platformAdapterClientInstance.defaults.headers;
|
|
4779
4781
|
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.dps) {
|
|
4780
|
-
|
|
4782
|
+
headers["platform-dps-token"] = tokens.platform.dps;
|
|
4781
4783
|
}
|
|
4782
4784
|
if (tokens == null ? void 0 : tokens.github.app) {
|
|
4783
|
-
|
|
4785
|
+
headers["github-app-token"] = tokens.github.app;
|
|
4784
4786
|
}
|
|
4785
4787
|
if (tokens == null ? void 0 : tokens.github.oauth) {
|
|
4786
|
-
|
|
4788
|
+
headers["github-oauth-token"] = tokens.github.oauth;
|
|
4787
4789
|
}
|
|
4788
4790
|
if (tokens == null ? void 0 : tokens.netlify) {
|
|
4789
|
-
|
|
4791
|
+
headers["netlify-token"] = tokens.netlify;
|
|
4790
4792
|
}
|
|
4791
4793
|
if (tokens == null ? void 0 : tokens.vercel) {
|
|
4792
|
-
|
|
4794
|
+
headers["vercel-token"] = tokens.vercel;
|
|
4793
4795
|
}
|
|
4794
4796
|
if (tokens == null ? void 0 : tokens.planetscale) {
|
|
4795
|
-
|
|
4797
|
+
headers["planetscale-token"] = tokens.planetscale;
|
|
4796
4798
|
}
|
|
4797
4799
|
if (tokens == null ? void 0 : tokens.sentry) {
|
|
4798
|
-
|
|
4800
|
+
headers["sentry-token"] = tokens.sentry;
|
|
4799
4801
|
}
|
|
4800
4802
|
}
|
|
4801
4803
|
|
|
@@ -4834,7 +4836,7 @@ var platformAdapterAppDeploymentApi = {
|
|
|
4834
4836
|
},
|
|
4835
4837
|
unlink(payload, authorization) {
|
|
4836
4838
|
return __async(this, null, function* () {
|
|
4837
|
-
|
|
4839
|
+
yield platformAdapterClientInstance.post(
|
|
4838
4840
|
`/console/app/${payload.appId}/blocks/deployment/unlink`,
|
|
4839
4841
|
payload,
|
|
4840
4842
|
getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -4845,12 +4847,11 @@ var platformAdapterAppDeploymentApi = {
|
|
|
4845
4847
|
}
|
|
4846
4848
|
}))
|
|
4847
4849
|
);
|
|
4848
|
-
return response.data;
|
|
4849
4850
|
});
|
|
4850
4851
|
},
|
|
4851
4852
|
installSentry(appId, authorization) {
|
|
4852
4853
|
return __async(this, null, function* () {
|
|
4853
|
-
|
|
4854
|
+
yield platformAdapterClientInstance.post(
|
|
4854
4855
|
`/console/app/${appId}/blocks/deployment/install/sentry`,
|
|
4855
4856
|
{},
|
|
4856
4857
|
getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -4861,7 +4862,6 @@ var platformAdapterAppDeploymentApi = {
|
|
|
4861
4862
|
}
|
|
4862
4863
|
}))
|
|
4863
4864
|
);
|
|
4864
|
-
return response.data;
|
|
4865
4865
|
});
|
|
4866
4866
|
}
|
|
4867
4867
|
};
|
|
@@ -4879,22 +4879,20 @@ var platformAdapterAppSentryLoggerApi = {
|
|
|
4879
4879
|
},
|
|
4880
4880
|
link(payload, authorization) {
|
|
4881
4881
|
return __async(this, null, function* () {
|
|
4882
|
-
|
|
4882
|
+
yield platformAdapterClientInstance.post(
|
|
4883
4883
|
"/console/app/blocks/logger/providers/sentry/link",
|
|
4884
4884
|
payload,
|
|
4885
4885
|
getPlatformAdapterClientConfig(authorization)
|
|
4886
4886
|
);
|
|
4887
|
-
return response.data;
|
|
4888
4887
|
});
|
|
4889
4888
|
},
|
|
4890
4889
|
unlink(payload, authorization) {
|
|
4891
4890
|
return __async(this, null, function* () {
|
|
4892
|
-
|
|
4891
|
+
yield platformAdapterClientInstance.post(
|
|
4893
4892
|
"/console/app/blocks/logger/providers/sentry/unlink",
|
|
4894
4893
|
payload,
|
|
4895
4894
|
getPlatformAdapterClientConfig(authorization)
|
|
4896
4895
|
);
|
|
4897
|
-
return response.data;
|
|
4898
4896
|
});
|
|
4899
4897
|
},
|
|
4900
4898
|
reauthorizeSentryApp(userId, sentryInstallationId, sentryRefreshToken, authorization) {
|
|
@@ -4967,7 +4965,7 @@ var platformAdapterAppRepositoryApi = {
|
|
|
4967
4965
|
},
|
|
4968
4966
|
unlink(payload, authorization) {
|
|
4969
4967
|
return __async(this, null, function* () {
|
|
4970
|
-
|
|
4968
|
+
yield platformAdapterClientInstance.post(
|
|
4971
4969
|
`/console/app/${payload.appId}/blocks/repository/unlink`,
|
|
4972
4970
|
payload,
|
|
4973
4971
|
getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -4978,7 +4976,6 @@ var platformAdapterAppRepositoryApi = {
|
|
|
4978
4976
|
}
|
|
4979
4977
|
}))
|
|
4980
4978
|
);
|
|
4981
|
-
return response.data;
|
|
4982
4979
|
});
|
|
4983
4980
|
},
|
|
4984
4981
|
seed(payload, authorization) {
|
|
@@ -5033,7 +5030,7 @@ var platformAdapterAppStorageApi = {
|
|
|
5033
5030
|
},
|
|
5034
5031
|
unlink(payload, authorization) {
|
|
5035
5032
|
return __async(this, null, function* () {
|
|
5036
|
-
|
|
5033
|
+
yield platformAdapterClientInstance.post(
|
|
5037
5034
|
`/console/app/${payload.appId}/blocks/storage/unlink`,
|
|
5038
5035
|
payload,
|
|
5039
5036
|
getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -5044,7 +5041,6 @@ var platformAdapterAppStorageApi = {
|
|
|
5044
5041
|
}
|
|
5045
5042
|
}))
|
|
5046
5043
|
);
|
|
5047
|
-
return response.data;
|
|
5048
5044
|
});
|
|
5049
5045
|
}
|
|
5050
5046
|
};
|
|
@@ -5083,40 +5079,36 @@ var platformAdapterAppVariablesApi = {
|
|
|
5083
5079
|
},
|
|
5084
5080
|
syncVariable(appId, key, payload, authorization) {
|
|
5085
5081
|
return __async(this, null, function* () {
|
|
5086
|
-
|
|
5082
|
+
yield platformAdapterClientInstance.post(
|
|
5087
5083
|
`/console/app/${appId}/variables/${key}/sync`,
|
|
5088
5084
|
payload,
|
|
5089
5085
|
getPlatformAdapterClientConfig(authorization)
|
|
5090
5086
|
);
|
|
5091
|
-
return response.data;
|
|
5092
5087
|
});
|
|
5093
5088
|
},
|
|
5094
5089
|
createVariable(appId, data, authorization) {
|
|
5095
5090
|
return __async(this, null, function* () {
|
|
5096
|
-
|
|
5091
|
+
yield platformAdapterClientInstance.post(
|
|
5097
5092
|
`/console/app/${appId}/variables/${data.key}`,
|
|
5098
5093
|
data,
|
|
5099
5094
|
getPlatformAdapterClientConfig(authorization)
|
|
5100
5095
|
);
|
|
5101
|
-
return response.data;
|
|
5102
5096
|
});
|
|
5103
5097
|
},
|
|
5104
5098
|
editVariable(appId, data, authorization) {
|
|
5105
5099
|
return __async(this, null, function* () {
|
|
5106
|
-
|
|
5100
|
+
yield platformAdapterClientInstance.post(
|
|
5107
5101
|
`/console/app/${appId}/variables/${data.key}/edit`,
|
|
5108
5102
|
data,
|
|
5109
5103
|
getPlatformAdapterClientConfig(authorization)
|
|
5110
5104
|
);
|
|
5111
|
-
return response.data;
|
|
5112
5105
|
});
|
|
5113
5106
|
},
|
|
5114
5107
|
deleteVariable(data) {
|
|
5115
5108
|
return __async(this, null, function* () {
|
|
5116
|
-
|
|
5109
|
+
yield platformAdapterClientInstance.delete(
|
|
5117
5110
|
`/console/app/${data.appId}/variables/${data.key}`
|
|
5118
5111
|
);
|
|
5119
|
-
return response.data;
|
|
5120
5112
|
});
|
|
5121
5113
|
}
|
|
5122
5114
|
};
|