mobbdev 0.0.179 → 0.0.181

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.
Files changed (2) hide show
  1. package/dist/index.mjs +18 -7
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -4954,9 +4954,6 @@ var AdoSCMLib = class extends SCMLib {
4954
4954
  repoUrl: this.url
4955
4955
  });
4956
4956
  }
4957
- async getUsername() {
4958
- throw new Error("getUsername() is not relevant for ADO");
4959
- }
4960
4957
  async getSubmitRequestStatus(scmSubmitRequestId) {
4961
4958
  this._validateAccessTokenAndUrl();
4962
4959
  const adoSdk = await this.getAdoSdk();
@@ -5603,6 +5600,9 @@ var AdoAuthResultZ = z16.object({
5603
5600
  token_type: z16.string().min(1),
5604
5601
  refresh_token: z16.string().min(1)
5605
5602
  });
5603
+ var AdoAuthResultWithOrgsZ = AdoAuthResultZ.extend({
5604
+ scmOrgs: z16.array(z16.string())
5605
+ });
5606
5606
  var profileZ = z16.object({
5607
5607
  displayName: z16.string(),
5608
5608
  publicAlias: z16.string().min(1),
@@ -5667,6 +5667,17 @@ function parseAdoOwnerAndRepo(adoUrl) {
5667
5667
  origin: `${protocol}//${hostname}`
5668
5668
  };
5669
5669
  }
5670
+ function isValidAdoRepo(url) {
5671
+ if (!url) {
5672
+ return false;
5673
+ }
5674
+ try {
5675
+ const parsed = parseAdoOwnerAndRepo(url);
5676
+ return Boolean(parsed.repo && parsed.projectName);
5677
+ } catch (e) {
5678
+ return false;
5679
+ }
5680
+ }
5670
5681
  async function getAdoConnectData({
5671
5682
  url,
5672
5683
  tokenOrg,
@@ -5688,7 +5699,7 @@ async function getAdoConnectData({
5688
5699
  }
5689
5700
  if (!tokenOrg) {
5690
5701
  if (adoTokenInfo.type === "OAUTH" /* OAUTH */) {
5691
- const [org] = await _getOrgsForOauthToken({
5702
+ const [org] = await getOrgsForOauthToken({
5692
5703
  oauthToken: adoTokenInfo.accessToken
5693
5704
  });
5694
5705
  return {
@@ -5795,7 +5806,7 @@ async function adoValidateParams({
5795
5806
  await getAdoClientParams({ url, accessToken, tokenOrg })
5796
5807
  );
5797
5808
  await api2.connect();
5798
- if (url) {
5809
+ if (isValidAdoRepo(url)) {
5799
5810
  const git = await api2.getGitApi();
5800
5811
  await validateAdoRepo({ git, repoUrl: url });
5801
5812
  }
@@ -5813,7 +5824,7 @@ async function adoValidateParams({
5813
5824
  throw e;
5814
5825
  }
5815
5826
  }
5816
- async function _getOrgsForOauthToken({
5827
+ async function getOrgsForOauthToken({
5817
5828
  oauthToken
5818
5829
  }) {
5819
5830
  const profileRes = await fetch(
@@ -6087,7 +6098,7 @@ async function getAdoRepoList({
6087
6098
  return [];
6088
6099
  }
6089
6100
  if (adoTokenInfo.type === "OAUTH" /* OAUTH */) {
6090
- orgs = await _getOrgsForOauthToken({ oauthToken: accessToken });
6101
+ orgs = await getOrgsForOauthToken({ oauthToken: accessToken });
6091
6102
  }
6092
6103
  if (orgs.length === 0 && !orgName) {
6093
6104
  throw new Error(`no orgs for ADO`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobbdev",
3
- "version": "0.0.179",
3
+ "version": "0.0.181",
4
4
  "description": "Automated secure code remediation tool",
5
5
  "repository": "git+https://github.com/mobb-dev/bugsy.git",
6
6
  "main": "dist/index.js",