@livechat/developer-studio-api 1.0.3 → 1.0.5
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 +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +215 -68
- package/dist/index.mjs +215 -68
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -85,6 +85,9 @@ function getGithubClientRequestConfig(options = {}) {
|
|
|
85
85
|
const headers = {
|
|
86
86
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
87
87
|
};
|
|
88
|
+
if (options.ensureAuthorizationToken && !headers.authorization) {
|
|
89
|
+
throw new UnauthorizeApiError("github");
|
|
90
|
+
}
|
|
88
91
|
return {
|
|
89
92
|
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
90
93
|
};
|
|
@@ -213,16 +216,22 @@ var gitHubInstallationApi = {
|
|
|
213
216
|
const response = yield githubClientInstance.get(
|
|
214
217
|
`/user/installations?timestamp=${(/* @__PURE__ */ new Date()).getTime()}`,
|
|
215
218
|
getGithubClientRequestConfig({
|
|
216
|
-
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
|
|
219
|
+
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
|
|
220
|
+
ensureAuthorizationToken: true
|
|
217
221
|
})
|
|
218
222
|
);
|
|
219
223
|
return response.data.installations;
|
|
220
224
|
});
|
|
221
225
|
},
|
|
222
|
-
getInstallationRepositories(installationId) {
|
|
226
|
+
getInstallationRepositories(installationId, authorization) {
|
|
223
227
|
return __async(this, null, function* () {
|
|
228
|
+
var _a;
|
|
224
229
|
const response = yield githubClientInstance.get(
|
|
225
|
-
`/user/installations/${installationId}/repositories?timestamp=${(/* @__PURE__ */ new Date()).getTime()}&per_page=100
|
|
230
|
+
`/user/installations/${installationId}/repositories?timestamp=${(/* @__PURE__ */ new Date()).getTime()}&per_page=100`,
|
|
231
|
+
getGithubClientRequestConfig({
|
|
232
|
+
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
|
|
233
|
+
ensureAuthorizationToken: true
|
|
234
|
+
})
|
|
226
235
|
);
|
|
227
236
|
return response.data.repositories;
|
|
228
237
|
});
|
|
@@ -237,7 +246,8 @@ var gitHubRepositoryApi = {
|
|
|
237
246
|
const response = yield githubClientInstance.get(
|
|
238
247
|
`/repos/${repositoryName}`,
|
|
239
248
|
getGithubClientRequestConfig({
|
|
240
|
-
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
|
|
249
|
+
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
|
|
250
|
+
ensureAuthorizationToken: true
|
|
241
251
|
})
|
|
242
252
|
);
|
|
243
253
|
return response.data;
|
|
@@ -249,7 +259,8 @@ var gitHubRepositoryApi = {
|
|
|
249
259
|
const response = yield githubClientInstance.get(
|
|
250
260
|
`/repos/${repositoryName}/branches`,
|
|
251
261
|
getGithubClientRequestConfig({
|
|
252
|
-
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
|
|
262
|
+
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
|
|
263
|
+
ensureAuthorizationToken: true
|
|
253
264
|
})
|
|
254
265
|
);
|
|
255
266
|
return response.data;
|
|
@@ -261,7 +272,8 @@ var gitHubRepositoryApi = {
|
|
|
261
272
|
const response = yield githubClientInstance.get(
|
|
262
273
|
`/repos/${repositoryName}/branches`,
|
|
263
274
|
getGithubClientRequestConfig({
|
|
264
|
-
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
|
|
275
|
+
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
|
|
276
|
+
ensureAuthorizationToken: true
|
|
265
277
|
})
|
|
266
278
|
);
|
|
267
279
|
const branch = response.data.find(
|
|
@@ -279,7 +291,8 @@ var gitHubRepositoryApi = {
|
|
|
279
291
|
const { data } = yield githubClientInstance.get(
|
|
280
292
|
`/repos/${repositoryName}/contents/livechat.config.json`,
|
|
281
293
|
getGithubClientRequestConfig({
|
|
282
|
-
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
|
|
294
|
+
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
|
|
295
|
+
ensureAuthorizationToken: true
|
|
283
296
|
})
|
|
284
297
|
);
|
|
285
298
|
return data;
|
|
@@ -301,7 +314,8 @@ var gitHubRepositoryApi = {
|
|
|
301
314
|
include_all_branches: false
|
|
302
315
|
},
|
|
303
316
|
getGithubClientRequestConfig({
|
|
304
|
-
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.oauth
|
|
317
|
+
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.oauth,
|
|
318
|
+
ensureAuthorizationToken: true
|
|
305
319
|
})
|
|
306
320
|
);
|
|
307
321
|
repository = response2.data;
|
|
@@ -316,7 +330,8 @@ var gitHubRepositoryApi = {
|
|
|
316
330
|
is_template: false
|
|
317
331
|
},
|
|
318
332
|
getGithubClientRequestConfig({
|
|
319
|
-
token: (_b = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _b.oauth
|
|
333
|
+
token: (_b = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _b.oauth,
|
|
334
|
+
ensureAuthorizationToken: true
|
|
320
335
|
})
|
|
321
336
|
);
|
|
322
337
|
repository = response2.data;
|
|
@@ -327,7 +342,8 @@ var gitHubRepositoryApi = {
|
|
|
327
342
|
private: true
|
|
328
343
|
},
|
|
329
344
|
getGithubClientRequestConfig({
|
|
330
|
-
token: (_c = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _c.oauth
|
|
345
|
+
token: (_c = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _c.oauth,
|
|
346
|
+
ensureAuthorizationToken: true
|
|
331
347
|
})
|
|
332
348
|
);
|
|
333
349
|
return repository;
|
|
@@ -342,7 +358,8 @@ var gitHubRepositoryApi = {
|
|
|
342
358
|
is_template: false
|
|
343
359
|
},
|
|
344
360
|
getGithubClientRequestConfig({
|
|
345
|
-
token: (_d = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _d.app
|
|
361
|
+
token: (_d = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _d.app,
|
|
362
|
+
ensureAuthorizationToken: true
|
|
346
363
|
})
|
|
347
364
|
);
|
|
348
365
|
return response.data;
|
|
@@ -370,7 +387,10 @@ var gitHubRepositoryApi = {
|
|
|
370
387
|
)
|
|
371
388
|
)
|
|
372
389
|
},
|
|
373
|
-
getGithubClientRequestConfig({
|
|
390
|
+
getGithubClientRequestConfig({
|
|
391
|
+
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
|
|
392
|
+
ensureAuthorizationToken: true
|
|
393
|
+
})
|
|
374
394
|
);
|
|
375
395
|
return response.data.content;
|
|
376
396
|
});
|
|
@@ -388,7 +408,8 @@ var gitHubRepositoryApi = {
|
|
|
388
408
|
return yield githubClientInstance.delete(
|
|
389
409
|
`/repos/${repositoryName}`,
|
|
390
410
|
getGithubClientRequestConfig({
|
|
391
|
-
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
|
|
411
|
+
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
|
|
412
|
+
ensureAuthorizationToken: true
|
|
392
413
|
})
|
|
393
414
|
);
|
|
394
415
|
});
|
|
@@ -403,7 +424,8 @@ var gitHubRepositoryApi = {
|
|
|
403
424
|
key: deployKey
|
|
404
425
|
},
|
|
405
426
|
getGithubClientRequestConfig({
|
|
406
|
-
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
|
|
427
|
+
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
|
|
428
|
+
ensureAuthorizationToken: true
|
|
407
429
|
})
|
|
408
430
|
);
|
|
409
431
|
return response.data;
|
|
@@ -433,7 +455,8 @@ var gitHubRepositoryApi = {
|
|
|
433
455
|
}
|
|
434
456
|
},
|
|
435
457
|
getGithubClientRequestConfig({
|
|
436
|
-
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
|
|
458
|
+
token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
|
|
459
|
+
ensureAuthorizationToken: true
|
|
437
460
|
})
|
|
438
461
|
);
|
|
439
462
|
return response.data;
|
|
@@ -501,6 +524,9 @@ function getNetlifyClientConfig(options = {}) {
|
|
|
501
524
|
const headers = {
|
|
502
525
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
503
526
|
};
|
|
527
|
+
if (options.ensureAuthorizationToken && !headers.authorization) {
|
|
528
|
+
throw new UnauthorizeApiError("netlify");
|
|
529
|
+
}
|
|
504
530
|
return {
|
|
505
531
|
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
506
532
|
};
|
|
@@ -522,7 +548,12 @@ function updateNetlifyClientInstance(token) {
|
|
|
522
548
|
var netlifyAccountApi = {
|
|
523
549
|
getAccount(authorization) {
|
|
524
550
|
return __async(this, null, function* () {
|
|
525
|
-
const { data: accounts } = yield netlifyClientInstance.get(
|
|
551
|
+
const { data: accounts } = yield netlifyClientInstance.get(
|
|
552
|
+
`/accounts`,
|
|
553
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
554
|
+
ensureAuthorizationToken: true
|
|
555
|
+
}))
|
|
556
|
+
);
|
|
526
557
|
return accounts[0].id;
|
|
527
558
|
});
|
|
528
559
|
},
|
|
@@ -536,7 +567,9 @@ var netlifyAccountApi = {
|
|
|
536
567
|
}
|
|
537
568
|
const { data: envs } = yield netlifyClientInstance.get(
|
|
538
569
|
`/accounts/${accountId}/env?site_id=${siteId}&scope=all&context=all&level=all`,
|
|
539
|
-
getNetlifyClientConfig(authorization)
|
|
570
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
571
|
+
ensureAuthorizationToken: true
|
|
572
|
+
}))
|
|
540
573
|
);
|
|
541
574
|
return envs;
|
|
542
575
|
});
|
|
@@ -551,7 +584,9 @@ var netlifyAccountApi = {
|
|
|
551
584
|
}
|
|
552
585
|
const { data: envs } = yield netlifyClientInstance.get(
|
|
553
586
|
`/accounts/${accountId}/env/${envKey}?site_id=${siteId}`,
|
|
554
|
-
getNetlifyClientConfig(authorization)
|
|
587
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
588
|
+
ensureAuthorizationToken: true
|
|
589
|
+
}))
|
|
555
590
|
);
|
|
556
591
|
return envs;
|
|
557
592
|
});
|
|
@@ -567,7 +602,9 @@ var netlifyAccountApi = {
|
|
|
567
602
|
if (!envs) {
|
|
568
603
|
const response = yield netlifyClientInstance.get(
|
|
569
604
|
`/accounts/${accountId}/env?site_id=${siteId}&scope=all&context=all&level=all`,
|
|
570
|
-
getNetlifyClientConfig(authorization)
|
|
605
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
606
|
+
ensureAuthorizationToken: true
|
|
607
|
+
}))
|
|
571
608
|
);
|
|
572
609
|
envs = response.data;
|
|
573
610
|
}
|
|
@@ -580,7 +617,9 @@ var netlifyAccountApi = {
|
|
|
580
617
|
scopes: ["builds", "functions", "runtime", "post_processing"],
|
|
581
618
|
values: [{ context: "all", value: envValue }]
|
|
582
619
|
},
|
|
583
|
-
getNetlifyClientConfig(authorization)
|
|
620
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
621
|
+
ensureAuthorizationToken: true
|
|
622
|
+
}))
|
|
584
623
|
);
|
|
585
624
|
} else {
|
|
586
625
|
yield netlifyClientInstance.post(
|
|
@@ -592,7 +631,9 @@ var netlifyAccountApi = {
|
|
|
592
631
|
values: [{ context: "all", value: envValue }]
|
|
593
632
|
}
|
|
594
633
|
],
|
|
595
|
-
getNetlifyClientConfig(authorization)
|
|
634
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
635
|
+
ensureAuthorizationToken: true
|
|
636
|
+
}))
|
|
596
637
|
);
|
|
597
638
|
}
|
|
598
639
|
});
|
|
@@ -601,7 +642,9 @@ var netlifyAccountApi = {
|
|
|
601
642
|
return __async(this, null, function* () {
|
|
602
643
|
const accounts = yield netlifyClientInstance.get(
|
|
603
644
|
`/accounts`,
|
|
604
|
-
getNetlifyClientConfig(authorization)
|
|
645
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
646
|
+
ensureAuthorizationToken: true
|
|
647
|
+
}))
|
|
605
648
|
);
|
|
606
649
|
const accountId = accounts.data[0].id;
|
|
607
650
|
yield this.createAccountEnv(
|
|
@@ -631,7 +674,9 @@ var netlifyHookApi = {
|
|
|
631
674
|
url: `${process.env.NEXT_PUBLIC_PLATFORM_DEVELOPER_CONSOLE_ADAPTER_APP_URL}${process.env.NEXT_PUBLIC_PLATFORM_DEVELOPER_CONSOLE_ADAPTER_BASE_PATH}/api/integrations/netlify/webhook`
|
|
632
675
|
}
|
|
633
676
|
},
|
|
634
|
-
getNetlifyClientConfig(authorization)
|
|
677
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
678
|
+
ensureAuthorizationToken: true
|
|
679
|
+
}))
|
|
635
680
|
);
|
|
636
681
|
} catch (e) {
|
|
637
682
|
}
|
|
@@ -646,7 +691,9 @@ var netlifyHookApi = {
|
|
|
646
691
|
url: `${process.env.NEXT_PUBLIC_PLATFORM_DEVELOPER_CONSOLE_ADAPTER_APP_URL}${process.env.NEXT_PUBLIC_PLATFORM_DEVELOPER_CONSOLE_ADAPTER_BASE_PATH}/api/integrations/netlify/webhook`
|
|
647
692
|
}
|
|
648
693
|
},
|
|
649
|
-
getNetlifyClientConfig(authorization)
|
|
694
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
695
|
+
ensureAuthorizationToken: true
|
|
696
|
+
}))
|
|
650
697
|
);
|
|
651
698
|
} catch (e) {
|
|
652
699
|
}
|
|
@@ -661,7 +708,9 @@ var netlifyHookApi = {
|
|
|
661
708
|
url: `${process.env.NEXT_PUBLIC_PLATFORM_DEVELOPER_CONSOLE_ADAPTER_APP_URL}${process.env.NEXT_PUBLIC_PLATFORM_DEVELOPER_CONSOLE_ADAPTER_BASE_PATH}/api/integrations/netlify/webhook`
|
|
662
709
|
}
|
|
663
710
|
},
|
|
664
|
-
getNetlifyClientConfig(authorization)
|
|
711
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
712
|
+
ensureAuthorizationToken: true
|
|
713
|
+
}))
|
|
665
714
|
);
|
|
666
715
|
} catch (e) {
|
|
667
716
|
}
|
|
@@ -676,7 +725,9 @@ var netlifyKeyApi = {
|
|
|
676
725
|
const response = yield netlifyClientInstance.post(
|
|
677
726
|
"/deploy_keys",
|
|
678
727
|
void 0,
|
|
679
|
-
getNetlifyClientConfig(authorization)
|
|
728
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
729
|
+
ensureAuthorizationToken: true
|
|
730
|
+
}))
|
|
680
731
|
);
|
|
681
732
|
return response.data;
|
|
682
733
|
});
|
|
@@ -689,7 +740,9 @@ var netlifySiteApi = {
|
|
|
689
740
|
return __async(this, null, function* () {
|
|
690
741
|
const response = yield netlifyClientInstance.get(
|
|
691
742
|
"/sites",
|
|
692
|
-
getNetlifyClientConfig(authorization)
|
|
743
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
744
|
+
ensureAuthorizationToken: true
|
|
745
|
+
}))
|
|
693
746
|
);
|
|
694
747
|
return response.data;
|
|
695
748
|
});
|
|
@@ -698,7 +751,9 @@ var netlifySiteApi = {
|
|
|
698
751
|
return __async(this, null, function* () {
|
|
699
752
|
const response = yield netlifyClientInstance.get(
|
|
700
753
|
`/sites/${siteId}`,
|
|
701
|
-
getNetlifyClientConfig(authorization)
|
|
754
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
755
|
+
ensureAuthorizationToken: true
|
|
756
|
+
}))
|
|
702
757
|
);
|
|
703
758
|
return response.data;
|
|
704
759
|
});
|
|
@@ -707,14 +762,18 @@ var netlifySiteApi = {
|
|
|
707
762
|
return __async(this, null, function* () {
|
|
708
763
|
const { data: deploys } = yield netlifyClientInstance.get(
|
|
709
764
|
`/sites/${siteId}/deploys/`,
|
|
710
|
-
getNetlifyClientConfig(authorization)
|
|
765
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
766
|
+
ensureAuthorizationToken: true
|
|
767
|
+
}))
|
|
711
768
|
);
|
|
712
769
|
const deploy = deploys.filter(
|
|
713
770
|
(deploy2) => deploy2.context === "production"
|
|
714
771
|
)[0];
|
|
715
772
|
const { data: pluginRuns } = yield netlifyClientInstance.get(
|
|
716
773
|
`/deploys/${deploy.id}/plugin_runs`,
|
|
717
|
-
getNetlifyClientConfig(authorization)
|
|
774
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
775
|
+
ensureAuthorizationToken: true
|
|
776
|
+
}))
|
|
718
777
|
);
|
|
719
778
|
deploy.plugin_runs = pluginRuns;
|
|
720
779
|
return deploy;
|
|
@@ -724,14 +783,21 @@ var netlifySiteApi = {
|
|
|
724
783
|
return __async(this, null, function* () {
|
|
725
784
|
const { data: deploys } = yield netlifyClientInstance.get(
|
|
726
785
|
`/sites/${siteId}/deploys`,
|
|
727
|
-
getNetlifyClientConfig(authorization)
|
|
786
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
787
|
+
ensureAuthorizationToken: true
|
|
788
|
+
}))
|
|
728
789
|
);
|
|
729
790
|
return deploys;
|
|
730
791
|
});
|
|
731
792
|
},
|
|
732
793
|
getSiteSnippets(siteId, authorization) {
|
|
733
794
|
return __async(this, null, function* () {
|
|
734
|
-
const { data: snippets } = yield netlifyClientInstance.get(
|
|
795
|
+
const { data: snippets } = yield netlifyClientInstance.get(
|
|
796
|
+
`sites/${siteId}/snippets`,
|
|
797
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
798
|
+
ensureAuthorizationToken: true
|
|
799
|
+
}))
|
|
800
|
+
);
|
|
735
801
|
return snippets;
|
|
736
802
|
});
|
|
737
803
|
},
|
|
@@ -757,7 +823,9 @@ var netlifySiteApi = {
|
|
|
757
823
|
plugins: [{ package: "@netlify/plugin-nextjs" }],
|
|
758
824
|
created_via: ""
|
|
759
825
|
},
|
|
760
|
-
getNetlifyClientConfig(authorization)
|
|
826
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
827
|
+
ensureAuthorizationToken: true
|
|
828
|
+
}))
|
|
761
829
|
);
|
|
762
830
|
yield netlifyHookApi.addBuildHooks(response.data.id, authorization);
|
|
763
831
|
return response.data;
|
|
@@ -791,7 +859,9 @@ var netlifySiteApi = {
|
|
|
791
859
|
],
|
|
792
860
|
created_via: ""
|
|
793
861
|
},
|
|
794
|
-
getNetlifyClientConfig(authorization)
|
|
862
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
863
|
+
ensureAuthorizationToken: true
|
|
864
|
+
}))
|
|
795
865
|
);
|
|
796
866
|
yield netlifyHookApi.addBuildHooks(response.data.id, authorization);
|
|
797
867
|
return response.data;
|
|
@@ -801,7 +871,9 @@ var netlifySiteApi = {
|
|
|
801
871
|
return __async(this, null, function* () {
|
|
802
872
|
const response = yield netlifyClientInstance.delete(
|
|
803
873
|
`/sites/${siteId}`,
|
|
804
|
-
getNetlifyClientConfig(authorization)
|
|
874
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
875
|
+
ensureAuthorizationToken: true
|
|
876
|
+
}))
|
|
805
877
|
);
|
|
806
878
|
return response.data;
|
|
807
879
|
});
|
|
@@ -811,7 +883,9 @@ var netlifySiteApi = {
|
|
|
811
883
|
yield netlifyClientInstance.post(
|
|
812
884
|
`/sites/${siteId}/builds`,
|
|
813
885
|
{},
|
|
814
|
-
getNetlifyClientConfig(authorization)
|
|
886
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
887
|
+
ensureAuthorizationToken: true
|
|
888
|
+
}))
|
|
815
889
|
);
|
|
816
890
|
});
|
|
817
891
|
},
|
|
@@ -819,7 +893,9 @@ var netlifySiteApi = {
|
|
|
819
893
|
return __async(this, null, function* () {
|
|
820
894
|
const site = yield netlifyClientInstance.get(
|
|
821
895
|
`/sites/${siteId}`,
|
|
822
|
-
getNetlifyClientConfig(authorization)
|
|
896
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
897
|
+
ensureAuthorizationToken: true
|
|
898
|
+
}))
|
|
823
899
|
);
|
|
824
900
|
yield netlifyClientInstance.put(
|
|
825
901
|
`/sites/${siteId}`,
|
|
@@ -836,7 +912,9 @@ var netlifySiteApi = {
|
|
|
836
912
|
cmd: site.data.build_settings.cmd
|
|
837
913
|
}
|
|
838
914
|
},
|
|
839
|
-
getNetlifyClientConfig(authorization)
|
|
915
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
916
|
+
ensureAuthorizationToken: true
|
|
917
|
+
}))
|
|
840
918
|
);
|
|
841
919
|
});
|
|
842
920
|
},
|
|
@@ -854,7 +932,9 @@ var netlifySiteApi = {
|
|
|
854
932
|
}
|
|
855
933
|
]
|
|
856
934
|
},
|
|
857
|
-
getNetlifyClientConfig(authorization)
|
|
935
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
936
|
+
ensureAuthorizationToken: true
|
|
937
|
+
}))
|
|
858
938
|
);
|
|
859
939
|
const accountId = yield netlifyAccountApi.getAccount(authorization);
|
|
860
940
|
if (!accountId) {
|
|
@@ -898,7 +978,9 @@ var netlifySiteApi = {
|
|
|
898
978
|
if (currentSnippet) {
|
|
899
979
|
yield netlifyClientInstance.delete(
|
|
900
980
|
`sites/${siteId}/snippets/${currentSnippet.id}`,
|
|
901
|
-
getNetlifyClientConfig(authorization)
|
|
981
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
982
|
+
ensureAuthorizationToken: true
|
|
983
|
+
}))
|
|
902
984
|
);
|
|
903
985
|
}
|
|
904
986
|
yield netlifyClientInstance.post(
|
|
@@ -909,7 +991,9 @@ var netlifySiteApi = {
|
|
|
909
991
|
// eslint-disable-next-line no-useless-escape
|
|
910
992
|
general: `<script src='https://js.sentry-cdn.com/${projectKey}.min.js' crossorigin="anonymous"></script>`
|
|
911
993
|
},
|
|
912
|
-
getNetlifyClientConfig(authorization)
|
|
994
|
+
getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
995
|
+
ensureAuthorizationToken: true
|
|
996
|
+
}))
|
|
913
997
|
);
|
|
914
998
|
return;
|
|
915
999
|
});
|
|
@@ -1179,6 +1263,9 @@ function getSentryClientConfig(options = {}) {
|
|
|
1179
1263
|
const headers = {
|
|
1180
1264
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
1181
1265
|
};
|
|
1266
|
+
if (options.ensureAuthorizationToken && !headers.authorization) {
|
|
1267
|
+
throw new UnauthorizeApiError("sentry");
|
|
1268
|
+
}
|
|
1182
1269
|
return {
|
|
1183
1270
|
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
1184
1271
|
};
|
|
@@ -1203,7 +1290,9 @@ var sentryApi = {
|
|
|
1203
1290
|
return __async(this, null, function* () {
|
|
1204
1291
|
const response = yield sentryClientInstance.get(
|
|
1205
1292
|
`/teams/${teamSlug}/`,
|
|
1206
|
-
getSentryClientConfig(authorization)
|
|
1293
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1294
|
+
ensureAuthorizationToken: true
|
|
1295
|
+
}))
|
|
1207
1296
|
);
|
|
1208
1297
|
return response.data;
|
|
1209
1298
|
});
|
|
@@ -1212,7 +1301,9 @@ var sentryApi = {
|
|
|
1212
1301
|
return __async(this, null, function* () {
|
|
1213
1302
|
const response = yield sentryClientInstance.get(
|
|
1214
1303
|
"/organizations/",
|
|
1215
|
-
getSentryClientConfig(authorization)
|
|
1304
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1305
|
+
ensureAuthorizationToken: true
|
|
1306
|
+
}))
|
|
1216
1307
|
);
|
|
1217
1308
|
return response.data;
|
|
1218
1309
|
});
|
|
@@ -1221,7 +1312,9 @@ var sentryApi = {
|
|
|
1221
1312
|
return __async(this, null, function* () {
|
|
1222
1313
|
const response = yield sentryClientInstance.get(
|
|
1223
1314
|
`/organizations/${organizationSlug}/`,
|
|
1224
|
-
getSentryClientConfig(authorization)
|
|
1315
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1316
|
+
ensureAuthorizationToken: true
|
|
1317
|
+
}))
|
|
1225
1318
|
);
|
|
1226
1319
|
return response.data;
|
|
1227
1320
|
});
|
|
@@ -1230,7 +1323,9 @@ var sentryApi = {
|
|
|
1230
1323
|
return __async(this, null, function* () {
|
|
1231
1324
|
const response = yield sentryClientInstance.get(
|
|
1232
1325
|
`/organizations/${organizationSlug}/repos/`,
|
|
1233
|
-
getSentryClientConfig(authorization)
|
|
1326
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1327
|
+
ensureAuthorizationToken: true
|
|
1328
|
+
}))
|
|
1234
1329
|
);
|
|
1235
1330
|
return response.data;
|
|
1236
1331
|
});
|
|
@@ -1239,7 +1334,9 @@ var sentryApi = {
|
|
|
1239
1334
|
return __async(this, null, function* () {
|
|
1240
1335
|
const response = yield sentryClientInstance.get(
|
|
1241
1336
|
`/organizations/${organizationSlug}/integrations/`,
|
|
1242
|
-
getSentryClientConfig(authorization)
|
|
1337
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1338
|
+
ensureAuthorizationToken: true
|
|
1339
|
+
}))
|
|
1243
1340
|
);
|
|
1244
1341
|
return response.data;
|
|
1245
1342
|
});
|
|
@@ -1248,7 +1345,9 @@ var sentryApi = {
|
|
|
1248
1345
|
return __async(this, null, function* () {
|
|
1249
1346
|
const response = yield sentryClientInstance.get(
|
|
1250
1347
|
"/projects/",
|
|
1251
|
-
getSentryClientConfig(authorization)
|
|
1348
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1349
|
+
ensureAuthorizationToken: true
|
|
1350
|
+
}))
|
|
1252
1351
|
);
|
|
1253
1352
|
return response.data;
|
|
1254
1353
|
});
|
|
@@ -1257,7 +1356,9 @@ var sentryApi = {
|
|
|
1257
1356
|
return __async(this, null, function* () {
|
|
1258
1357
|
const response = yield sentryClientInstance.get(
|
|
1259
1358
|
`/projects/${projectFullName}/`,
|
|
1260
|
-
getSentryClientConfig(authorization)
|
|
1359
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1360
|
+
ensureAuthorizationToken: true
|
|
1361
|
+
}))
|
|
1261
1362
|
);
|
|
1262
1363
|
return response.data;
|
|
1263
1364
|
});
|
|
@@ -1266,7 +1367,9 @@ var sentryApi = {
|
|
|
1266
1367
|
return __async(this, null, function* () {
|
|
1267
1368
|
const response = yield sentryClientInstance.get(
|
|
1268
1369
|
`/projects/${projectFullName}/issues/`,
|
|
1269
|
-
getSentryClientConfig(authorization)
|
|
1370
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1371
|
+
ensureAuthorizationToken: true
|
|
1372
|
+
}))
|
|
1270
1373
|
);
|
|
1271
1374
|
return response.data;
|
|
1272
1375
|
});
|
|
@@ -1275,7 +1378,9 @@ var sentryApi = {
|
|
|
1275
1378
|
return __async(this, null, function* () {
|
|
1276
1379
|
const response = yield sentryClientInstance.get(
|
|
1277
1380
|
`/issues/${issueId}/events/latest/`,
|
|
1278
|
-
getSentryClientConfig(authorization)
|
|
1381
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1382
|
+
ensureAuthorizationToken: true
|
|
1383
|
+
}))
|
|
1279
1384
|
);
|
|
1280
1385
|
return response.data;
|
|
1281
1386
|
});
|
|
@@ -1284,7 +1389,9 @@ var sentryApi = {
|
|
|
1284
1389
|
return __async(this, null, function* () {
|
|
1285
1390
|
const response = yield sentryClientInstance.get(
|
|
1286
1391
|
`/projects/${projectFullName}/keys/`,
|
|
1287
|
-
getSentryClientConfig(authorization)
|
|
1392
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1393
|
+
ensureAuthorizationToken: true
|
|
1394
|
+
}))
|
|
1288
1395
|
);
|
|
1289
1396
|
return response.data;
|
|
1290
1397
|
});
|
|
@@ -1297,7 +1404,9 @@ var sentryApi = {
|
|
|
1297
1404
|
name: teamName,
|
|
1298
1405
|
slug: teamName
|
|
1299
1406
|
},
|
|
1300
|
-
getSentryClientConfig(authorization)
|
|
1407
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1408
|
+
ensureAuthorizationToken: true
|
|
1409
|
+
}))
|
|
1301
1410
|
);
|
|
1302
1411
|
return team;
|
|
1303
1412
|
});
|
|
@@ -1314,7 +1423,9 @@ var sentryApi = {
|
|
|
1314
1423
|
identifier: repositoryFullName,
|
|
1315
1424
|
provider: "integrations:github"
|
|
1316
1425
|
},
|
|
1317
|
-
getSentryClientConfig(authorization)
|
|
1426
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1427
|
+
ensureAuthorizationToken: true
|
|
1428
|
+
}))
|
|
1318
1429
|
);
|
|
1319
1430
|
repository = response.data;
|
|
1320
1431
|
} catch (err) {
|
|
@@ -1324,7 +1435,9 @@ var sentryApi = {
|
|
|
1324
1435
|
}
|
|
1325
1436
|
const response = yield sentryClientInstance.get(
|
|
1326
1437
|
`/organizations/${organizationSlug}/repos/`,
|
|
1327
|
-
getSentryClientConfig(authorization)
|
|
1438
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1439
|
+
ensureAuthorizationToken: true
|
|
1440
|
+
}))
|
|
1328
1441
|
);
|
|
1329
1442
|
repository = response.data.find(
|
|
1330
1443
|
(repo) => repo.externalSlug === repositoryFullName
|
|
@@ -1344,7 +1457,9 @@ var sentryApi = {
|
|
|
1344
1457
|
integrationId: githubIntegrationId,
|
|
1345
1458
|
projectId
|
|
1346
1459
|
},
|
|
1347
|
-
getSentryClientConfig(authorization)
|
|
1460
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1461
|
+
ensureAuthorizationToken: true
|
|
1462
|
+
}))
|
|
1348
1463
|
);
|
|
1349
1464
|
} catch (e) {
|
|
1350
1465
|
}
|
|
@@ -1365,7 +1480,9 @@ var sentryApi = {
|
|
|
1365
1480
|
name,
|
|
1366
1481
|
slug: name
|
|
1367
1482
|
},
|
|
1368
|
-
getSentryClientConfig(authorization)
|
|
1483
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1484
|
+
ensureAuthorizationToken: true
|
|
1485
|
+
}))
|
|
1369
1486
|
);
|
|
1370
1487
|
return yield this.getProject(
|
|
1371
1488
|
`${organizationSlug}/${response.data.slug}`,
|
|
@@ -1386,7 +1503,9 @@ var sentryApi = {
|
|
|
1386
1503
|
return __async(this, null, function* () {
|
|
1387
1504
|
const response = yield sentryClientInstance.delete(
|
|
1388
1505
|
`/projects/${projectFullName}/`,
|
|
1389
|
-
getSentryClientConfig(authorization)
|
|
1506
|
+
getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1507
|
+
ensureAuthorizationToken: true
|
|
1508
|
+
}))
|
|
1390
1509
|
);
|
|
1391
1510
|
return response.data;
|
|
1392
1511
|
});
|
|
@@ -1423,6 +1542,9 @@ function getVercelClientConfig(options = {}) {
|
|
|
1423
1542
|
const headers = {
|
|
1424
1543
|
authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
|
|
1425
1544
|
};
|
|
1545
|
+
if (options.ensureAuthorizationToken && !headers.authorization) {
|
|
1546
|
+
throw new UnauthorizeApiError("vercel");
|
|
1547
|
+
}
|
|
1426
1548
|
return {
|
|
1427
1549
|
headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
|
|
1428
1550
|
};
|
|
@@ -1452,7 +1574,9 @@ var vercelDeployApi = {
|
|
|
1452
1574
|
target: "production",
|
|
1453
1575
|
source: "import"
|
|
1454
1576
|
},
|
|
1455
|
-
getVercelClientConfig(authorization)
|
|
1577
|
+
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1578
|
+
ensureAuthorizationToken: true
|
|
1579
|
+
}))
|
|
1456
1580
|
);
|
|
1457
1581
|
return response.data;
|
|
1458
1582
|
});
|
|
@@ -1465,7 +1589,9 @@ var vercelIntegrationApi = {
|
|
|
1465
1589
|
return __async(this, null, function* () {
|
|
1466
1590
|
const response = yield vercelClientInstance.get(
|
|
1467
1591
|
`/v1/integrations/git-namespaces?provider=github`,
|
|
1468
|
-
getVercelClientConfig(authorization)
|
|
1592
|
+
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1593
|
+
ensureAuthorizationToken: true
|
|
1594
|
+
}))
|
|
1469
1595
|
);
|
|
1470
1596
|
return response.data;
|
|
1471
1597
|
});
|
|
@@ -1476,7 +1602,9 @@ var vercelIntegrationApi = {
|
|
|
1476
1602
|
try {
|
|
1477
1603
|
const response = yield vercelClientInstance.get(
|
|
1478
1604
|
`/v1/integrations/search-repo?provider=github${repositoryName ? "&query=" + repositoryName : ""}${namespaceId ? "&namespaceId=" + namespaceId : ""}`,
|
|
1479
|
-
getVercelClientConfig(authorization)
|
|
1605
|
+
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1606
|
+
ensureAuthorizationToken: true
|
|
1607
|
+
}))
|
|
1480
1608
|
);
|
|
1481
1609
|
return {
|
|
1482
1610
|
provider: response.data.gitAccount.provider,
|
|
@@ -1539,7 +1667,9 @@ var vercelProjectApi = {
|
|
|
1539
1667
|
return __async(this, null, function* () {
|
|
1540
1668
|
const response = yield vercelClientInstance.get(
|
|
1541
1669
|
"/v9/projects",
|
|
1542
|
-
getVercelClientConfig(authorization)
|
|
1670
|
+
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1671
|
+
ensureAuthorizationToken: true
|
|
1672
|
+
}))
|
|
1543
1673
|
);
|
|
1544
1674
|
return response.data;
|
|
1545
1675
|
});
|
|
@@ -1548,7 +1678,9 @@ var vercelProjectApi = {
|
|
|
1548
1678
|
return __async(this, null, function* () {
|
|
1549
1679
|
const response = yield vercelClientInstance.get(
|
|
1550
1680
|
`/v9/projects/${projectId}`,
|
|
1551
|
-
getVercelClientConfig(authorization)
|
|
1681
|
+
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1682
|
+
ensureAuthorizationToken: true
|
|
1683
|
+
}))
|
|
1552
1684
|
);
|
|
1553
1685
|
return response.data;
|
|
1554
1686
|
});
|
|
@@ -1566,7 +1698,9 @@ var vercelProjectApi = {
|
|
|
1566
1698
|
},
|
|
1567
1699
|
framework: "nextjs"
|
|
1568
1700
|
},
|
|
1569
|
-
getVercelClientConfig(authorization)
|
|
1701
|
+
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1702
|
+
ensureAuthorizationToken: true
|
|
1703
|
+
}))
|
|
1570
1704
|
);
|
|
1571
1705
|
return response.data;
|
|
1572
1706
|
});
|
|
@@ -1575,7 +1709,9 @@ var vercelProjectApi = {
|
|
|
1575
1709
|
return __async(this, null, function* () {
|
|
1576
1710
|
yield vercelClientInstance.delete(
|
|
1577
1711
|
`/projects/${projectId}`,
|
|
1578
|
-
getVercelClientConfig(authorization)
|
|
1712
|
+
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1713
|
+
ensureAuthorizationToken: true
|
|
1714
|
+
}))
|
|
1579
1715
|
);
|
|
1580
1716
|
});
|
|
1581
1717
|
},
|
|
@@ -1583,7 +1719,12 @@ var vercelProjectApi = {
|
|
|
1583
1719
|
return __async(this, null, function* () {
|
|
1584
1720
|
const {
|
|
1585
1721
|
data: { envs }
|
|
1586
|
-
} = yield vercelClientInstance.get(
|
|
1722
|
+
} = yield vercelClientInstance.get(
|
|
1723
|
+
`/v9/projects/${projectId}/env`,
|
|
1724
|
+
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1725
|
+
ensureAuthorizationToken: true
|
|
1726
|
+
}))
|
|
1727
|
+
);
|
|
1587
1728
|
return envs;
|
|
1588
1729
|
});
|
|
1589
1730
|
},
|
|
@@ -1591,7 +1732,9 @@ var vercelProjectApi = {
|
|
|
1591
1732
|
return __async(this, null, function* () {
|
|
1592
1733
|
const { data } = yield vercelClientInstance.get(
|
|
1593
1734
|
`/v9/projects/${projectId}/env/${envId}`,
|
|
1594
|
-
getVercelClientConfig(authorization)
|
|
1735
|
+
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1736
|
+
ensureAuthorizationToken: true
|
|
1737
|
+
}))
|
|
1595
1738
|
);
|
|
1596
1739
|
return data;
|
|
1597
1740
|
});
|
|
@@ -1622,7 +1765,9 @@ var vercelProjectApi = {
|
|
|
1622
1765
|
type: "encrypted",
|
|
1623
1766
|
target: ["production", "preview", "development"]
|
|
1624
1767
|
},
|
|
1625
|
-
getVercelClientConfig(authorization)
|
|
1768
|
+
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1769
|
+
ensureAuthorizationToken: true
|
|
1770
|
+
}))
|
|
1626
1771
|
);
|
|
1627
1772
|
return editedEnv;
|
|
1628
1773
|
} else {
|
|
@@ -1634,7 +1779,9 @@ var vercelProjectApi = {
|
|
|
1634
1779
|
type: "encrypted",
|
|
1635
1780
|
target: ["production", "preview", "development"]
|
|
1636
1781
|
},
|
|
1637
|
-
getVercelClientConfig(authorization)
|
|
1782
|
+
getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
1783
|
+
ensureAuthorizationToken: true
|
|
1784
|
+
}))
|
|
1638
1785
|
);
|
|
1639
1786
|
return createdEnv;
|
|
1640
1787
|
}
|