mobbdev 0.0.112 → 0.0.114
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.mjs +20 -18
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1107,6 +1107,7 @@ var parseScmURL = (scmURL, scmType) => {
|
|
|
1107
1107
|
projectPath,
|
|
1108
1108
|
repoName,
|
|
1109
1109
|
projectName,
|
|
1110
|
+
protocol: url.protocol,
|
|
1110
1111
|
pathElements: projectPath.split("/")
|
|
1111
1112
|
};
|
|
1112
1113
|
} catch (e) {
|
|
@@ -2843,16 +2844,18 @@ var SCMLib = class {
|
|
|
2843
2844
|
if (!accessToken) {
|
|
2844
2845
|
return trimmedUrl;
|
|
2845
2846
|
}
|
|
2846
|
-
console.log(
|
|
2847
|
-
"this instanceof BitbucketSCMLib",
|
|
2848
|
-
this instanceof BitbucketSCMLib
|
|
2849
|
-
);
|
|
2850
2847
|
const scmLibType = this.getScmLibType();
|
|
2851
2848
|
if (scmLibType === "ADO" /* ADO */) {
|
|
2852
2849
|
return `https://${accessToken}@${trimmedUrl.toLowerCase().replace("https://", "")}`;
|
|
2853
2850
|
}
|
|
2854
2851
|
if (this instanceof BitbucketSCMLib) {
|
|
2855
2852
|
const authData = this.getAuthData();
|
|
2853
|
+
const parseScmURLRes = parseScmURL(trimmedUrl, "Bitbucket" /* Bitbucket */);
|
|
2854
|
+
if (!parseScmURLRes) {
|
|
2855
|
+
throw new InvalidRepoUrlError("invalid repo url");
|
|
2856
|
+
}
|
|
2857
|
+
const { protocol, hostname, organization, repoName } = parseScmURLRes;
|
|
2858
|
+
const url = `${protocol}//${hostname}/${organization}/${repoName}`;
|
|
2856
2859
|
switch (authData.authType) {
|
|
2857
2860
|
case "public": {
|
|
2858
2861
|
return trimmedUrl;
|
|
@@ -2861,14 +2864,14 @@ var SCMLib = class {
|
|
|
2861
2864
|
const { token } = authData;
|
|
2862
2865
|
const username2 = await this._getUsernameForAuthUrl();
|
|
2863
2866
|
return buildAuthrizedRepoUrl({
|
|
2864
|
-
url
|
|
2867
|
+
url,
|
|
2865
2868
|
username: username2,
|
|
2866
2869
|
password: token
|
|
2867
2870
|
});
|
|
2868
2871
|
}
|
|
2869
2872
|
case "basic": {
|
|
2870
2873
|
const { username: username2, password } = authData;
|
|
2871
|
-
return buildAuthrizedRepoUrl({ url
|
|
2874
|
+
return buildAuthrizedRepoUrl({ url, username: username2, password });
|
|
2872
2875
|
}
|
|
2873
2876
|
}
|
|
2874
2877
|
}
|
|
@@ -3918,19 +3921,19 @@ function getBitbucketSdk(params) {
|
|
|
3918
3921
|
ref,
|
|
3919
3922
|
url
|
|
3920
3923
|
}) {
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
]
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
if (
|
|
3924
|
+
return Promise.allSettled([
|
|
3925
|
+
this.getTagRef({ repoUrl: url, tagName: ref }),
|
|
3926
|
+
this.getBranchRef({ repoUrl: url, branchName: ref }),
|
|
3927
|
+
this.getCommitRef({ repoUrl: url, commitSha: ref })
|
|
3928
|
+
]).then((promisesResult) => {
|
|
3929
|
+
const [refPromise] = promisesResult.filter(
|
|
3930
|
+
(promise) => promise.status === "fulfilled"
|
|
3931
|
+
);
|
|
3932
|
+
if (!refPromise) {
|
|
3930
3933
|
throw new RefNotFoundError(`Invalid reference ${ref} for ${url}`);
|
|
3931
3934
|
}
|
|
3932
|
-
|
|
3933
|
-
}
|
|
3935
|
+
return refPromise.value;
|
|
3936
|
+
});
|
|
3934
3937
|
},
|
|
3935
3938
|
async getTagRef(params2) {
|
|
3936
3939
|
const { tagName, repoUrl } = params2;
|
|
@@ -3984,7 +3987,6 @@ function getBitbucketSdk(params) {
|
|
|
3984
3987
|
async function validateBitbucketParams(params) {
|
|
3985
3988
|
const { bitbucketClient } = params;
|
|
3986
3989
|
const authType = bitbucketClient.getAuthType();
|
|
3987
|
-
console.log("authType", authType, params.url);
|
|
3988
3990
|
try {
|
|
3989
3991
|
if (authType !== "public") {
|
|
3990
3992
|
await bitbucketClient.getUser();
|