@livechat/developer-studio-api 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -169,6 +169,9 @@ function getGithubClientRequestConfig(options = {}) {
169
169
  const headers = {
170
170
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
171
171
  };
172
+ if (options.ensureAuthorizationToken && !headers.authorization) {
173
+ throw new UnauthorizeApiError("vercel");
174
+ }
172
175
  return {
173
176
  headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
174
177
  };
@@ -297,16 +300,22 @@ var gitHubInstallationApi = {
297
300
  const response = yield githubClientInstance.get(
298
301
  `/user/installations?timestamp=${(/* @__PURE__ */ new Date()).getTime()}`,
299
302
  getGithubClientRequestConfig({
300
- token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
303
+ token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
304
+ ensureAuthorizationToken: true
301
305
  })
302
306
  );
303
307
  return response.data.installations;
304
308
  });
305
309
  },
306
- getInstallationRepositories(installationId) {
310
+ getInstallationRepositories(installationId, authorization) {
307
311
  return __async(this, null, function* () {
312
+ var _a;
308
313
  const response = yield githubClientInstance.get(
309
- `/user/installations/${installationId}/repositories?timestamp=${(/* @__PURE__ */ new Date()).getTime()}&per_page=100`
314
+ `/user/installations/${installationId}/repositories?timestamp=${(/* @__PURE__ */ new Date()).getTime()}&per_page=100`,
315
+ getGithubClientRequestConfig({
316
+ token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
317
+ ensureAuthorizationToken: true
318
+ })
310
319
  );
311
320
  return response.data.repositories;
312
321
  });
@@ -321,7 +330,8 @@ var gitHubRepositoryApi = {
321
330
  const response = yield githubClientInstance.get(
322
331
  `/repos/${repositoryName}`,
323
332
  getGithubClientRequestConfig({
324
- token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
333
+ token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
334
+ ensureAuthorizationToken: true
325
335
  })
326
336
  );
327
337
  return response.data;
@@ -333,7 +343,8 @@ var gitHubRepositoryApi = {
333
343
  const response = yield githubClientInstance.get(
334
344
  `/repos/${repositoryName}/branches`,
335
345
  getGithubClientRequestConfig({
336
- token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
346
+ token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
347
+ ensureAuthorizationToken: true
337
348
  })
338
349
  );
339
350
  return response.data;
@@ -345,7 +356,8 @@ var gitHubRepositoryApi = {
345
356
  const response = yield githubClientInstance.get(
346
357
  `/repos/${repositoryName}/branches`,
347
358
  getGithubClientRequestConfig({
348
- token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
359
+ token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
360
+ ensureAuthorizationToken: true
349
361
  })
350
362
  );
351
363
  const branch = response.data.find(
@@ -363,7 +375,8 @@ var gitHubRepositoryApi = {
363
375
  const { data } = yield githubClientInstance.get(
364
376
  `/repos/${repositoryName}/contents/livechat.config.json`,
365
377
  getGithubClientRequestConfig({
366
- token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
378
+ token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
379
+ ensureAuthorizationToken: true
367
380
  })
368
381
  );
369
382
  return data;
@@ -385,7 +398,8 @@ var gitHubRepositoryApi = {
385
398
  include_all_branches: false
386
399
  },
387
400
  getGithubClientRequestConfig({
388
- token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.oauth
401
+ token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.oauth,
402
+ ensureAuthorizationToken: true
389
403
  })
390
404
  );
391
405
  repository = response2.data;
@@ -400,7 +414,8 @@ var gitHubRepositoryApi = {
400
414
  is_template: false
401
415
  },
402
416
  getGithubClientRequestConfig({
403
- token: (_b = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _b.oauth
417
+ token: (_b = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _b.oauth,
418
+ ensureAuthorizationToken: true
404
419
  })
405
420
  );
406
421
  repository = response2.data;
@@ -411,7 +426,8 @@ var gitHubRepositoryApi = {
411
426
  private: true
412
427
  },
413
428
  getGithubClientRequestConfig({
414
- token: (_c = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _c.oauth
429
+ token: (_c = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _c.oauth,
430
+ ensureAuthorizationToken: true
415
431
  })
416
432
  );
417
433
  return repository;
@@ -426,7 +442,8 @@ var gitHubRepositoryApi = {
426
442
  is_template: false
427
443
  },
428
444
  getGithubClientRequestConfig({
429
- token: (_d = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _d.app
445
+ token: (_d = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _d.app,
446
+ ensureAuthorizationToken: true
430
447
  })
431
448
  );
432
449
  return response.data;
@@ -454,7 +471,10 @@ var gitHubRepositoryApi = {
454
471
  )
455
472
  )
456
473
  },
457
- getGithubClientRequestConfig({ token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app })
474
+ getGithubClientRequestConfig({
475
+ token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
476
+ ensureAuthorizationToken: true
477
+ })
458
478
  );
459
479
  return response.data.content;
460
480
  });
@@ -472,7 +492,8 @@ var gitHubRepositoryApi = {
472
492
  return yield githubClientInstance.delete(
473
493
  `/repos/${repositoryName}`,
474
494
  getGithubClientRequestConfig({
475
- token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
495
+ token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
496
+ ensureAuthorizationToken: true
476
497
  })
477
498
  );
478
499
  });
@@ -487,7 +508,8 @@ var gitHubRepositoryApi = {
487
508
  key: deployKey
488
509
  },
489
510
  getGithubClientRequestConfig({
490
- token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
511
+ token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
512
+ ensureAuthorizationToken: true
491
513
  })
492
514
  );
493
515
  return response.data;
@@ -517,7 +539,8 @@ var gitHubRepositoryApi = {
517
539
  }
518
540
  },
519
541
  getGithubClientRequestConfig({
520
- token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app
542
+ token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
543
+ ensureAuthorizationToken: true
521
544
  })
522
545
  );
523
546
  return response.data;
@@ -585,6 +608,9 @@ function getNetlifyClientConfig(options = {}) {
585
608
  const headers = {
586
609
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
587
610
  };
611
+ if (options.ensureAuthorizationToken && !headers.authorization) {
612
+ throw new UnauthorizeApiError("netlify");
613
+ }
588
614
  return {
589
615
  headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
590
616
  };
@@ -606,7 +632,12 @@ function updateNetlifyClientInstance(token) {
606
632
  var netlifyAccountApi = {
607
633
  getAccount(authorization) {
608
634
  return __async(this, null, function* () {
609
- const { data: accounts } = yield netlifyClientInstance.get(`/accounts`, getNetlifyClientConfig(authorization));
635
+ const { data: accounts } = yield netlifyClientInstance.get(
636
+ `/accounts`,
637
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
638
+ ensureAuthorizationToken: true
639
+ }))
640
+ );
610
641
  return accounts[0].id;
611
642
  });
612
643
  },
@@ -620,7 +651,9 @@ var netlifyAccountApi = {
620
651
  }
621
652
  const { data: envs } = yield netlifyClientInstance.get(
622
653
  `/accounts/${accountId}/env?site_id=${siteId}&scope=all&context=all&level=all`,
623
- getNetlifyClientConfig(authorization)
654
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
655
+ ensureAuthorizationToken: true
656
+ }))
624
657
  );
625
658
  return envs;
626
659
  });
@@ -635,7 +668,9 @@ var netlifyAccountApi = {
635
668
  }
636
669
  const { data: envs } = yield netlifyClientInstance.get(
637
670
  `/accounts/${accountId}/env/${envKey}?site_id=${siteId}`,
638
- getNetlifyClientConfig(authorization)
671
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
672
+ ensureAuthorizationToken: true
673
+ }))
639
674
  );
640
675
  return envs;
641
676
  });
@@ -651,7 +686,9 @@ var netlifyAccountApi = {
651
686
  if (!envs) {
652
687
  const response = yield netlifyClientInstance.get(
653
688
  `/accounts/${accountId}/env?site_id=${siteId}&scope=all&context=all&level=all`,
654
- getNetlifyClientConfig(authorization)
689
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
690
+ ensureAuthorizationToken: true
691
+ }))
655
692
  );
656
693
  envs = response.data;
657
694
  }
@@ -664,7 +701,9 @@ var netlifyAccountApi = {
664
701
  scopes: ["builds", "functions", "runtime", "post_processing"],
665
702
  values: [{ context: "all", value: envValue }]
666
703
  },
667
- getNetlifyClientConfig(authorization)
704
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
705
+ ensureAuthorizationToken: true
706
+ }))
668
707
  );
669
708
  } else {
670
709
  yield netlifyClientInstance.post(
@@ -676,7 +715,9 @@ var netlifyAccountApi = {
676
715
  values: [{ context: "all", value: envValue }]
677
716
  }
678
717
  ],
679
- getNetlifyClientConfig(authorization)
718
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
719
+ ensureAuthorizationToken: true
720
+ }))
680
721
  );
681
722
  }
682
723
  });
@@ -685,7 +726,9 @@ var netlifyAccountApi = {
685
726
  return __async(this, null, function* () {
686
727
  const accounts = yield netlifyClientInstance.get(
687
728
  `/accounts`,
688
- getNetlifyClientConfig(authorization)
729
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
730
+ ensureAuthorizationToken: true
731
+ }))
689
732
  );
690
733
  const accountId = accounts.data[0].id;
691
734
  yield this.createAccountEnv(
@@ -715,7 +758,9 @@ var netlifyHookApi = {
715
758
  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`
716
759
  }
717
760
  },
718
- getNetlifyClientConfig(authorization)
761
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
762
+ ensureAuthorizationToken: true
763
+ }))
719
764
  );
720
765
  } catch (e) {
721
766
  }
@@ -730,7 +775,9 @@ var netlifyHookApi = {
730
775
  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`
731
776
  }
732
777
  },
733
- getNetlifyClientConfig(authorization)
778
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
779
+ ensureAuthorizationToken: true
780
+ }))
734
781
  );
735
782
  } catch (e) {
736
783
  }
@@ -745,7 +792,9 @@ var netlifyHookApi = {
745
792
  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`
746
793
  }
747
794
  },
748
- getNetlifyClientConfig(authorization)
795
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
796
+ ensureAuthorizationToken: true
797
+ }))
749
798
  );
750
799
  } catch (e) {
751
800
  }
@@ -760,7 +809,9 @@ var netlifyKeyApi = {
760
809
  const response = yield netlifyClientInstance.post(
761
810
  "/deploy_keys",
762
811
  void 0,
763
- getNetlifyClientConfig(authorization)
812
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
813
+ ensureAuthorizationToken: true
814
+ }))
764
815
  );
765
816
  return response.data;
766
817
  });
@@ -773,7 +824,9 @@ var netlifySiteApi = {
773
824
  return __async(this, null, function* () {
774
825
  const response = yield netlifyClientInstance.get(
775
826
  "/sites",
776
- getNetlifyClientConfig(authorization)
827
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
828
+ ensureAuthorizationToken: true
829
+ }))
777
830
  );
778
831
  return response.data;
779
832
  });
@@ -782,7 +835,9 @@ var netlifySiteApi = {
782
835
  return __async(this, null, function* () {
783
836
  const response = yield netlifyClientInstance.get(
784
837
  `/sites/${siteId}`,
785
- getNetlifyClientConfig(authorization)
838
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
839
+ ensureAuthorizationToken: true
840
+ }))
786
841
  );
787
842
  return response.data;
788
843
  });
@@ -791,14 +846,18 @@ var netlifySiteApi = {
791
846
  return __async(this, null, function* () {
792
847
  const { data: deploys } = yield netlifyClientInstance.get(
793
848
  `/sites/${siteId}/deploys/`,
794
- getNetlifyClientConfig(authorization)
849
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
850
+ ensureAuthorizationToken: true
851
+ }))
795
852
  );
796
853
  const deploy = deploys.filter(
797
854
  (deploy2) => deploy2.context === "production"
798
855
  )[0];
799
856
  const { data: pluginRuns } = yield netlifyClientInstance.get(
800
857
  `/deploys/${deploy.id}/plugin_runs`,
801
- getNetlifyClientConfig(authorization)
858
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
859
+ ensureAuthorizationToken: true
860
+ }))
802
861
  );
803
862
  deploy.plugin_runs = pluginRuns;
804
863
  return deploy;
@@ -808,14 +867,21 @@ var netlifySiteApi = {
808
867
  return __async(this, null, function* () {
809
868
  const { data: deploys } = yield netlifyClientInstance.get(
810
869
  `/sites/${siteId}/deploys`,
811
- getNetlifyClientConfig(authorization)
870
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
871
+ ensureAuthorizationToken: true
872
+ }))
812
873
  );
813
874
  return deploys;
814
875
  });
815
876
  },
816
877
  getSiteSnippets(siteId, authorization) {
817
878
  return __async(this, null, function* () {
818
- const { data: snippets } = yield netlifyClientInstance.get(`sites/${siteId}/snippets`, getNetlifyClientConfig(authorization));
879
+ const { data: snippets } = yield netlifyClientInstance.get(
880
+ `sites/${siteId}/snippets`,
881
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
882
+ ensureAuthorizationToken: true
883
+ }))
884
+ );
819
885
  return snippets;
820
886
  });
821
887
  },
@@ -841,7 +907,9 @@ var netlifySiteApi = {
841
907
  plugins: [{ package: "@netlify/plugin-nextjs" }],
842
908
  created_via: ""
843
909
  },
844
- getNetlifyClientConfig(authorization)
910
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
911
+ ensureAuthorizationToken: true
912
+ }))
845
913
  );
846
914
  yield netlifyHookApi.addBuildHooks(response.data.id, authorization);
847
915
  return response.data;
@@ -875,7 +943,9 @@ var netlifySiteApi = {
875
943
  ],
876
944
  created_via: ""
877
945
  },
878
- getNetlifyClientConfig(authorization)
946
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
947
+ ensureAuthorizationToken: true
948
+ }))
879
949
  );
880
950
  yield netlifyHookApi.addBuildHooks(response.data.id, authorization);
881
951
  return response.data;
@@ -885,7 +955,9 @@ var netlifySiteApi = {
885
955
  return __async(this, null, function* () {
886
956
  const response = yield netlifyClientInstance.delete(
887
957
  `/sites/${siteId}`,
888
- getNetlifyClientConfig(authorization)
958
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
959
+ ensureAuthorizationToken: true
960
+ }))
889
961
  );
890
962
  return response.data;
891
963
  });
@@ -895,7 +967,9 @@ var netlifySiteApi = {
895
967
  yield netlifyClientInstance.post(
896
968
  `/sites/${siteId}/builds`,
897
969
  {},
898
- getNetlifyClientConfig(authorization)
970
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
971
+ ensureAuthorizationToken: true
972
+ }))
899
973
  );
900
974
  });
901
975
  },
@@ -903,7 +977,9 @@ var netlifySiteApi = {
903
977
  return __async(this, null, function* () {
904
978
  const site = yield netlifyClientInstance.get(
905
979
  `/sites/${siteId}`,
906
- getNetlifyClientConfig(authorization)
980
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
981
+ ensureAuthorizationToken: true
982
+ }))
907
983
  );
908
984
  yield netlifyClientInstance.put(
909
985
  `/sites/${siteId}`,
@@ -920,7 +996,9 @@ var netlifySiteApi = {
920
996
  cmd: site.data.build_settings.cmd
921
997
  }
922
998
  },
923
- getNetlifyClientConfig(authorization)
999
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1000
+ ensureAuthorizationToken: true
1001
+ }))
924
1002
  );
925
1003
  });
926
1004
  },
@@ -938,7 +1016,9 @@ var netlifySiteApi = {
938
1016
  }
939
1017
  ]
940
1018
  },
941
- getNetlifyClientConfig(authorization)
1019
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1020
+ ensureAuthorizationToken: true
1021
+ }))
942
1022
  );
943
1023
  const accountId = yield netlifyAccountApi.getAccount(authorization);
944
1024
  if (!accountId) {
@@ -982,7 +1062,9 @@ var netlifySiteApi = {
982
1062
  if (currentSnippet) {
983
1063
  yield netlifyClientInstance.delete(
984
1064
  `sites/${siteId}/snippets/${currentSnippet.id}`,
985
- getNetlifyClientConfig(authorization)
1065
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1066
+ ensureAuthorizationToken: true
1067
+ }))
986
1068
  );
987
1069
  }
988
1070
  yield netlifyClientInstance.post(
@@ -993,7 +1075,9 @@ var netlifySiteApi = {
993
1075
  // eslint-disable-next-line no-useless-escape
994
1076
  general: `<script src='https://js.sentry-cdn.com/${projectKey}.min.js' crossorigin="anonymous"></script>`
995
1077
  },
996
- getNetlifyClientConfig(authorization)
1078
+ getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1079
+ ensureAuthorizationToken: true
1080
+ }))
997
1081
  );
998
1082
  return;
999
1083
  });
@@ -1263,6 +1347,9 @@ function getSentryClientConfig(options = {}) {
1263
1347
  const headers = {
1264
1348
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
1265
1349
  };
1350
+ if (options.ensureAuthorizationToken && !headers.authorization) {
1351
+ throw new UnauthorizeApiError("sentry");
1352
+ }
1266
1353
  return {
1267
1354
  headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
1268
1355
  };
@@ -1287,7 +1374,9 @@ var sentryApi = {
1287
1374
  return __async(this, null, function* () {
1288
1375
  const response = yield sentryClientInstance.get(
1289
1376
  `/teams/${teamSlug}/`,
1290
- getSentryClientConfig(authorization)
1377
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1378
+ ensureAuthorizationToken: true
1379
+ }))
1291
1380
  );
1292
1381
  return response.data;
1293
1382
  });
@@ -1296,7 +1385,9 @@ var sentryApi = {
1296
1385
  return __async(this, null, function* () {
1297
1386
  const response = yield sentryClientInstance.get(
1298
1387
  "/organizations/",
1299
- getSentryClientConfig(authorization)
1388
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1389
+ ensureAuthorizationToken: true
1390
+ }))
1300
1391
  );
1301
1392
  return response.data;
1302
1393
  });
@@ -1305,7 +1396,9 @@ var sentryApi = {
1305
1396
  return __async(this, null, function* () {
1306
1397
  const response = yield sentryClientInstance.get(
1307
1398
  `/organizations/${organizationSlug}/`,
1308
- getSentryClientConfig(authorization)
1399
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1400
+ ensureAuthorizationToken: true
1401
+ }))
1309
1402
  );
1310
1403
  return response.data;
1311
1404
  });
@@ -1314,7 +1407,9 @@ var sentryApi = {
1314
1407
  return __async(this, null, function* () {
1315
1408
  const response = yield sentryClientInstance.get(
1316
1409
  `/organizations/${organizationSlug}/repos/`,
1317
- getSentryClientConfig(authorization)
1410
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1411
+ ensureAuthorizationToken: true
1412
+ }))
1318
1413
  );
1319
1414
  return response.data;
1320
1415
  });
@@ -1323,7 +1418,9 @@ var sentryApi = {
1323
1418
  return __async(this, null, function* () {
1324
1419
  const response = yield sentryClientInstance.get(
1325
1420
  `/organizations/${organizationSlug}/integrations/`,
1326
- getSentryClientConfig(authorization)
1421
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1422
+ ensureAuthorizationToken: true
1423
+ }))
1327
1424
  );
1328
1425
  return response.data;
1329
1426
  });
@@ -1332,7 +1429,9 @@ var sentryApi = {
1332
1429
  return __async(this, null, function* () {
1333
1430
  const response = yield sentryClientInstance.get(
1334
1431
  "/projects/",
1335
- getSentryClientConfig(authorization)
1432
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1433
+ ensureAuthorizationToken: true
1434
+ }))
1336
1435
  );
1337
1436
  return response.data;
1338
1437
  });
@@ -1341,7 +1440,9 @@ var sentryApi = {
1341
1440
  return __async(this, null, function* () {
1342
1441
  const response = yield sentryClientInstance.get(
1343
1442
  `/projects/${projectFullName}/`,
1344
- getSentryClientConfig(authorization)
1443
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1444
+ ensureAuthorizationToken: true
1445
+ }))
1345
1446
  );
1346
1447
  return response.data;
1347
1448
  });
@@ -1350,7 +1451,9 @@ var sentryApi = {
1350
1451
  return __async(this, null, function* () {
1351
1452
  const response = yield sentryClientInstance.get(
1352
1453
  `/projects/${projectFullName}/issues/`,
1353
- getSentryClientConfig(authorization)
1454
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1455
+ ensureAuthorizationToken: true
1456
+ }))
1354
1457
  );
1355
1458
  return response.data;
1356
1459
  });
@@ -1359,7 +1462,9 @@ var sentryApi = {
1359
1462
  return __async(this, null, function* () {
1360
1463
  const response = yield sentryClientInstance.get(
1361
1464
  `/issues/${issueId}/events/latest/`,
1362
- getSentryClientConfig(authorization)
1465
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1466
+ ensureAuthorizationToken: true
1467
+ }))
1363
1468
  );
1364
1469
  return response.data;
1365
1470
  });
@@ -1368,7 +1473,9 @@ var sentryApi = {
1368
1473
  return __async(this, null, function* () {
1369
1474
  const response = yield sentryClientInstance.get(
1370
1475
  `/projects/${projectFullName}/keys/`,
1371
- getSentryClientConfig(authorization)
1476
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1477
+ ensureAuthorizationToken: true
1478
+ }))
1372
1479
  );
1373
1480
  return response.data;
1374
1481
  });
@@ -1381,7 +1488,9 @@ var sentryApi = {
1381
1488
  name: teamName,
1382
1489
  slug: teamName
1383
1490
  },
1384
- getSentryClientConfig(authorization)
1491
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1492
+ ensureAuthorizationToken: true
1493
+ }))
1385
1494
  );
1386
1495
  return team;
1387
1496
  });
@@ -1398,7 +1507,9 @@ var sentryApi = {
1398
1507
  identifier: repositoryFullName,
1399
1508
  provider: "integrations:github"
1400
1509
  },
1401
- getSentryClientConfig(authorization)
1510
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1511
+ ensureAuthorizationToken: true
1512
+ }))
1402
1513
  );
1403
1514
  repository = response.data;
1404
1515
  } catch (err) {
@@ -1408,7 +1519,9 @@ var sentryApi = {
1408
1519
  }
1409
1520
  const response = yield sentryClientInstance.get(
1410
1521
  `/organizations/${organizationSlug}/repos/`,
1411
- getSentryClientConfig(authorization)
1522
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1523
+ ensureAuthorizationToken: true
1524
+ }))
1412
1525
  );
1413
1526
  repository = response.data.find(
1414
1527
  (repo) => repo.externalSlug === repositoryFullName
@@ -1428,7 +1541,9 @@ var sentryApi = {
1428
1541
  integrationId: githubIntegrationId,
1429
1542
  projectId
1430
1543
  },
1431
- getSentryClientConfig(authorization)
1544
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1545
+ ensureAuthorizationToken: true
1546
+ }))
1432
1547
  );
1433
1548
  } catch (e) {
1434
1549
  }
@@ -1449,7 +1564,9 @@ var sentryApi = {
1449
1564
  name,
1450
1565
  slug: name
1451
1566
  },
1452
- getSentryClientConfig(authorization)
1567
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1568
+ ensureAuthorizationToken: true
1569
+ }))
1453
1570
  );
1454
1571
  return yield this.getProject(
1455
1572
  `${organizationSlug}/${response.data.slug}`,
@@ -1470,7 +1587,9 @@ var sentryApi = {
1470
1587
  return __async(this, null, function* () {
1471
1588
  const response = yield sentryClientInstance.delete(
1472
1589
  `/projects/${projectFullName}/`,
1473
- getSentryClientConfig(authorization)
1590
+ getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1591
+ ensureAuthorizationToken: true
1592
+ }))
1474
1593
  );
1475
1594
  return response.data;
1476
1595
  });
@@ -1507,6 +1626,9 @@ function getVercelClientConfig(options = {}) {
1507
1626
  const headers = {
1508
1627
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
1509
1628
  };
1629
+ if (options.ensureAuthorizationToken && !headers.authorization) {
1630
+ throw new UnauthorizeApiError("vercel");
1631
+ }
1510
1632
  return {
1511
1633
  headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
1512
1634
  };
@@ -1536,7 +1658,9 @@ var vercelDeployApi = {
1536
1658
  target: "production",
1537
1659
  source: "import"
1538
1660
  },
1539
- getVercelClientConfig(authorization)
1661
+ getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
1662
+ ensureAuthorizationToken: true
1663
+ }))
1540
1664
  );
1541
1665
  return response.data;
1542
1666
  });
@@ -1549,7 +1673,9 @@ var vercelIntegrationApi = {
1549
1673
  return __async(this, null, function* () {
1550
1674
  const response = yield vercelClientInstance.get(
1551
1675
  `/v1/integrations/git-namespaces?provider=github`,
1552
- getVercelClientConfig(authorization)
1676
+ getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
1677
+ ensureAuthorizationToken: true
1678
+ }))
1553
1679
  );
1554
1680
  return response.data;
1555
1681
  });
@@ -1560,7 +1686,9 @@ var vercelIntegrationApi = {
1560
1686
  try {
1561
1687
  const response = yield vercelClientInstance.get(
1562
1688
  `/v1/integrations/search-repo?provider=github${repositoryName ? "&query=" + repositoryName : ""}${namespaceId ? "&namespaceId=" + namespaceId : ""}`,
1563
- getVercelClientConfig(authorization)
1689
+ getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
1690
+ ensureAuthorizationToken: true
1691
+ }))
1564
1692
  );
1565
1693
  return {
1566
1694
  provider: response.data.gitAccount.provider,
@@ -1623,7 +1751,9 @@ var vercelProjectApi = {
1623
1751
  return __async(this, null, function* () {
1624
1752
  const response = yield vercelClientInstance.get(
1625
1753
  "/v9/projects",
1626
- getVercelClientConfig(authorization)
1754
+ getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
1755
+ ensureAuthorizationToken: true
1756
+ }))
1627
1757
  );
1628
1758
  return response.data;
1629
1759
  });
@@ -1632,7 +1762,9 @@ var vercelProjectApi = {
1632
1762
  return __async(this, null, function* () {
1633
1763
  const response = yield vercelClientInstance.get(
1634
1764
  `/v9/projects/${projectId}`,
1635
- getVercelClientConfig(authorization)
1765
+ getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
1766
+ ensureAuthorizationToken: true
1767
+ }))
1636
1768
  );
1637
1769
  return response.data;
1638
1770
  });
@@ -1650,7 +1782,9 @@ var vercelProjectApi = {
1650
1782
  },
1651
1783
  framework: "nextjs"
1652
1784
  },
1653
- getVercelClientConfig(authorization)
1785
+ getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
1786
+ ensureAuthorizationToken: true
1787
+ }))
1654
1788
  );
1655
1789
  return response.data;
1656
1790
  });
@@ -1659,7 +1793,9 @@ var vercelProjectApi = {
1659
1793
  return __async(this, null, function* () {
1660
1794
  yield vercelClientInstance.delete(
1661
1795
  `/projects/${projectId}`,
1662
- getVercelClientConfig(authorization)
1796
+ getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
1797
+ ensureAuthorizationToken: true
1798
+ }))
1663
1799
  );
1664
1800
  });
1665
1801
  },
@@ -1667,7 +1803,12 @@ var vercelProjectApi = {
1667
1803
  return __async(this, null, function* () {
1668
1804
  const {
1669
1805
  data: { envs }
1670
- } = yield vercelClientInstance.get(`/v9/projects/${projectId}/env`, getVercelClientConfig(authorization));
1806
+ } = yield vercelClientInstance.get(
1807
+ `/v9/projects/${projectId}/env`,
1808
+ getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
1809
+ ensureAuthorizationToken: true
1810
+ }))
1811
+ );
1671
1812
  return envs;
1672
1813
  });
1673
1814
  },
@@ -1675,7 +1816,9 @@ var vercelProjectApi = {
1675
1816
  return __async(this, null, function* () {
1676
1817
  const { data } = yield vercelClientInstance.get(
1677
1818
  `/v9/projects/${projectId}/env/${envId}`,
1678
- getVercelClientConfig(authorization)
1819
+ getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
1820
+ ensureAuthorizationToken: true
1821
+ }))
1679
1822
  );
1680
1823
  return data;
1681
1824
  });
@@ -1706,7 +1849,9 @@ var vercelProjectApi = {
1706
1849
  type: "encrypted",
1707
1850
  target: ["production", "preview", "development"]
1708
1851
  },
1709
- getVercelClientConfig(authorization)
1852
+ getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
1853
+ ensureAuthorizationToken: true
1854
+ }))
1710
1855
  );
1711
1856
  return editedEnv;
1712
1857
  } else {
@@ -1718,7 +1863,9 @@ var vercelProjectApi = {
1718
1863
  type: "encrypted",
1719
1864
  target: ["production", "preview", "development"]
1720
1865
  },
1721
- getVercelClientConfig(authorization)
1866
+ getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
1867
+ ensureAuthorizationToken: true
1868
+ }))
1722
1869
  );
1723
1870
  return createdEnv;
1724
1871
  }