renovate 44.142.0 → 44.142.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/modules/datasource/api.js +1 -1
- package/dist/modules/datasource/azure-tags/index.js +11 -26
- package/dist/modules/datasource/azure-tags/index.js.map +1 -1
- package/dist/modules/datasource/bitbucket-server-tags/index.js +38 -81
- package/dist/modules/datasource/bitbucket-server-tags/index.js.map +1 -1
- package/dist/modules/datasource/bitbucket-tags/index.js +22 -50
- package/dist/modules/datasource/bitbucket-tags/index.js.map +1 -1
- package/dist/modules/datasource/bitrise/index.js +1 -3
- package/dist/modules/datasource/bitrise/index.js.map +1 -1
- package/dist/modules/datasource/buildpacks-registry/index.js +10 -18
- package/dist/modules/datasource/buildpacks-registry/index.js.map +1 -1
- package/dist/modules/datasource/cdnjs/index.js +17 -33
- package/dist/modules/datasource/cdnjs/index.js.map +1 -1
- package/dist/modules/datasource/dart/index.js +18 -29
- package/dist/modules/datasource/dart/index.js.map +1 -1
- package/dist/modules/datasource/datasource.js +51 -2
- package/dist/modules/datasource/datasource.js.map +1 -1
- package/dist/modules/datasource/dotnet-version/index.js +1 -6
- package/dist/modules/datasource/dotnet-version/index.js.map +1 -1
- package/dist/modules/datasource/elm-package/index.js +2 -15
- package/dist/modules/datasource/elm-package/index.js.map +1 -1
- package/dist/modules/datasource/endoflife-date/index.js +3 -7
- package/dist/modules/datasource/endoflife-date/index.js.map +1 -1
- package/dist/modules/datasource/flutter-version/index.js +9 -13
- package/dist/modules/datasource/flutter-version/index.js.map +1 -1
- package/dist/modules/datasource/forgejo-releases/index.js +1 -2
- package/dist/modules/datasource/forgejo-releases/index.js.map +1 -1
- package/dist/modules/datasource/forgejo-tags/index.js +1 -2
- package/dist/modules/datasource/forgejo-tags/index.js.map +1 -1
- package/dist/modules/datasource/galaxy/index.js +1 -6
- package/dist/modules/datasource/galaxy/index.js.map +1 -1
- package/dist/modules/datasource/galaxy-collection/index.js +9 -35
- package/dist/modules/datasource/galaxy-collection/index.js.map +1 -1
- package/dist/modules/datasource/git-host-tags.js +61 -0
- package/dist/modules/datasource/git-host-tags.js.map +1 -0
- package/dist/modules/datasource/gitea-releases/index.js +3 -3
- package/dist/modules/datasource/gitea-releases/index.js.map +1 -1
- package/dist/modules/datasource/gitea-tags/base.js +4 -3
- package/dist/modules/datasource/gitea-tags/base.js.map +1 -1
- package/dist/modules/datasource/gitea-tags/index.js +3 -3
- package/dist/modules/datasource/gitea-tags/index.js.map +1 -1
- package/dist/modules/datasource/github-digest/index.js +1 -3
- package/dist/modules/datasource/github-digest/index.js.map +1 -1
- package/dist/modules/datasource/github-release-attachments/index.js +4 -40
- package/dist/modules/datasource/github-release-attachments/index.js.map +1 -1
- package/dist/modules/datasource/github-releases/index.js +9 -5
- package/dist/modules/datasource/github-releases/index.js.map +1 -1
- package/dist/modules/datasource/github-tags/index.js +1 -3
- package/dist/modules/datasource/github-tags/index.js.map +1 -1
- package/dist/modules/datasource/gitlab-packages/index.js +6 -5
- package/dist/modules/datasource/gitlab-packages/index.js.map +1 -1
- package/dist/modules/datasource/gitlab-releases/index.js +18 -20
- package/dist/modules/datasource/gitlab-releases/index.js.map +1 -1
- package/dist/modules/datasource/gitlab-tags/index.js +7 -10
- package/dist/modules/datasource/gitlab-tags/index.js.map +1 -1
- package/dist/modules/datasource/go/common.js +1 -1
- package/dist/modules/datasource/go/common.js.map +1 -1
- package/dist/modules/datasource/gradle-version/index.js +3 -9
- package/dist/modules/datasource/gradle-version/index.js.map +1 -1
- package/dist/modules/datasource/hermit/index.js +1 -2
- package/dist/modules/datasource/hermit/index.js.map +1 -1
- package/dist/modules/datasource/hex/index.js +1 -10
- package/dist/modules/datasource/hex/index.js.map +1 -1
- package/dist/modules/datasource/index.d.ts +2 -2
- package/dist/modules/datasource/jsr/index.js +2 -7
- package/dist/modules/datasource/jsr/index.js.map +1 -1
- package/dist/modules/datasource/maven/index.js +2 -2
- package/dist/modules/datasource/maven/index.js.map +1 -1
- package/dist/modules/datasource/node-version/index.js +6 -10
- package/dist/modules/datasource/node-version/index.js.map +1 -1
- package/dist/modules/datasource/orb/index.js +11 -16
- package/dist/modules/datasource/orb/index.js.map +1 -1
- package/dist/modules/datasource/puppet-forge/index.js +1 -6
- package/dist/modules/datasource/puppet-forge/index.js.map +1 -1
- package/dist/modules/datasource/rubygems/index.js +1 -2
- package/dist/modules/datasource/rubygems/index.js.map +1 -1
- package/dist/modules/datasource/sbt-package/index.js +1 -2
- package/dist/modules/datasource/sbt-package/index.js.map +1 -1
- package/dist/modules/datasource/sbt-plugin/index.js +1 -2
- package/dist/modules/datasource/sbt-plugin/index.js.map +1 -1
- package/dist/modules/datasource/types.d.ts +13 -0
- package/dist/util/check-token.js +1 -1
- package/dist/util/gitlab/url.js +26 -0
- package/dist/util/gitlab/url.js.map +1 -0
- package/dist/workers/repository/update/pr/body/changelogs.js +1 -1
- package/dist/workers/repository/update/pr/body/changelogs.js.map +1 -1
- package/package.json +1 -1
- package/renovate-schema.json +2 -2
- package/dist/modules/datasource/gitlab-tags/util.js +0 -15
- package/dist/modules/datasource/gitlab-tags/util.js.map +0 -1
- package/dist/modules/datasource/schema.js +0 -14
- package/dist/modules/datasource/schema.js.map +0 -1
|
@@ -38,8 +38,8 @@ import { GalaxyCollectionDatasource } from "./galaxy-collection/index.js";
|
|
|
38
38
|
import { GitRefsDatasource } from "./git-refs/index.js";
|
|
39
39
|
import { GitTagsDatasource } from "./git-tags/index.js";
|
|
40
40
|
import { GithubDigestDatasource } from "./github-digest/index.js";
|
|
41
|
-
import { GithubReleaseAttachmentsDatasource } from "./github-release-attachments/index.js";
|
|
42
41
|
import { GithubReleasesDatasource } from "./github-releases/index.js";
|
|
42
|
+
import { GithubReleaseAttachmentsDatasource } from "./github-release-attachments/index.js";
|
|
43
43
|
import { GithubRunnersDatasource } from "./github-runners/index.js";
|
|
44
44
|
import { GithubTagsDatasource } from "./github-tags/index.js";
|
|
45
45
|
import { GitlabPackagesDatasource } from "./gitlab-packages/index.js";
|
|
@@ -1,38 +1,23 @@
|
|
|
1
1
|
import { ensureTrailingSlash } from "../../../util/url.js";
|
|
2
|
-
import { withCache } from "../../../util/cache/package/with-cache.js";
|
|
3
|
-
import { Datasource } from "../datasource.js";
|
|
4
2
|
import { gitApi } from "../../platform/azure/azure-got-wrapper.js";
|
|
3
|
+
import { GitHostTagsDatasource } from "../git-host-tags.js";
|
|
5
4
|
//#region lib/modules/datasource/azure-tags/index.ts
|
|
6
|
-
var AzureTagsDatasource = class AzureTagsDatasource extends
|
|
5
|
+
var AzureTagsDatasource = class AzureTagsDatasource extends GitHostTagsDatasource {
|
|
7
6
|
static id = "azure-tags";
|
|
8
|
-
static cacheNamespace = `datasource-${AzureTagsDatasource.id}`;
|
|
9
7
|
constructor() {
|
|
10
8
|
super(AzureTagsDatasource.id);
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
return
|
|
10
|
+
getRegistryUrl(registryUrl) {
|
|
11
|
+
return registryUrl;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
return `${ensureTrailingSlash(registryUrl)}_git/${packageName}`;
|
|
13
|
+
getSourceUrl(packageName, registryUrl) {
|
|
14
|
+
return `${ensureTrailingSlash(this.getRegistryUrl(registryUrl))}_git/${packageName}`;
|
|
17
15
|
}
|
|
18
|
-
async
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
releases: filteredTags.map((tag) => ({
|
|
24
|
-
version: tag.name,
|
|
25
|
-
gitRef: tag.name,
|
|
26
|
-
releaseTimestamp: null
|
|
27
|
-
}))
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
getReleases(config) {
|
|
31
|
-
return withCache({
|
|
32
|
-
namespace: AzureTagsDatasource.cacheNamespace,
|
|
33
|
-
key: AzureTagsDatasource.getCacheKey(config.registryUrl, config.packageName, "tags"),
|
|
34
|
-
fallback: true
|
|
35
|
-
}, () => this._getReleases(config));
|
|
16
|
+
async fetchTags({ packageName: repo }) {
|
|
17
|
+
return (await (await gitApi()).getRefs(repo, void 0, "tags")).filter((tag) => tag.name).map((tag) => ({
|
|
18
|
+
version: tag.name,
|
|
19
|
+
releaseTimestamp: null
|
|
20
|
+
}));
|
|
36
21
|
}
|
|
37
22
|
};
|
|
38
23
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["azureApi.gitApi"],"sources":["../../../../lib/modules/datasource/azure-tags/index.ts"],"sourcesContent":["import type { GitRef } from 'azure-devops-node-api/interfaces/GitInterfaces.js';\nimport
|
|
1
|
+
{"version":3,"file":"index.js","names":["azureApi.gitApi"],"sources":["../../../../lib/modules/datasource/azure-tags/index.ts"],"sourcesContent":["import type { GitRef } from 'azure-devops-node-api/interfaces/GitInterfaces.js';\nimport { ensureTrailingSlash } from '../../../util/url.ts';\nimport * as azureApi from '../../platform/azure/azure-got-wrapper.ts';\nimport { GitHostTagsDatasource } from '../git-host-tags.ts';\nimport type { GetReleasesConfig, GitHostTag } from '../types.ts';\n\nexport class AzureTagsDatasource extends GitHostTagsDatasource {\n static readonly id = 'azure-tags';\n\n constructor() {\n super(AzureTagsDatasource.id);\n }\n\n protected getRegistryUrl(registryUrl?: string): string {\n // the Azure DevOps organization URL is always known\n return registryUrl!;\n }\n\n protected getSourceUrl(packageName: string, registryUrl?: string): string {\n const normalizedUrl = ensureTrailingSlash(this.getRegistryUrl(registryUrl));\n return `${normalizedUrl}_git/${packageName}`;\n }\n\n protected async fetchTags({\n packageName: repo,\n }: GetReleasesConfig): Promise<GitHostTag[]> {\n const azureApiGit = await azureApi.gitApi();\n\n const azureTags = await azureApiGit.getRefs(repo, undefined, 'tags');\n\n // Filter out tags that do not have a name\n const filteredTags = azureTags.filter((tag: GitRef) => tag.name);\n\n return filteredTags.map((tag: GitRef) => ({\n version: tag.name!,\n releaseTimestamp: null,\n }));\n }\n}\n"],"mappings":";;;;AAMA,IAAa,sBAAb,MAAa,4BAA4B,sBAAsB;CAC7D,OAAgB,KAAK;CAErB,cAAc;EACZ,MAAM,oBAAoB,EAAE;CAC9B;CAEA,eAAyB,aAA8B;EAErD,OAAO;CACT;CAEA,aAAuB,aAAqB,aAA8B;EAExE,OAAO,GADe,oBAAoB,KAAK,eAAe,WAAW,CACnD,EAAE,OAAO;CACjC;CAEA,MAAgB,UAAU,EACxB,aAAa,QAC8B;EAQ3C,QAFqB,OAHG,MAFEA,OAAgB,EAAA,CAEN,QAAQ,MAAM,KAAA,GAAW,MAAM,EAAA,CAGpC,QAAQ,QAAgB,IAAI,IAEzC,CAAC,CAAC,KAAK,SAAiB;GACxC,SAAS,IAAI;GACb,kBAAkB;EACpB,EAAE;CACJ;AACF"}
|
|
@@ -1,113 +1,70 @@
|
|
|
1
1
|
import { regEx } from "../../../util/regex.js";
|
|
2
2
|
import { logger } from "../../../logger/index.js";
|
|
3
|
-
import { ensureTrailingSlash } from "../../../util/url.js";
|
|
4
|
-
import {
|
|
5
|
-
import { Result } from "../../../util/result.js";
|
|
6
|
-
import { Datasource } from "../datasource.js";
|
|
3
|
+
import { ensureTrailingSlash, joinUrlParts } from "../../../util/url.js";
|
|
4
|
+
import { GitHostTagsDigestDatasource } from "../git-host-tags.js";
|
|
7
5
|
import { BitbucketServerHttp } from "../../../util/http/bitbucket-server.js";
|
|
8
|
-
import { DigestsConfig, ReleasesConfig } from "../schema.js";
|
|
9
6
|
import { BitbucketServerCommits, BitbucketServerTag, BitbucketServerTags } from "./schema.js";
|
|
10
|
-
import { ZodError } from "zod/v4";
|
|
11
7
|
//#region lib/modules/datasource/bitbucket-server-tags/index.ts
|
|
12
|
-
var BitbucketServerTagsDatasource = class BitbucketServerTagsDatasource extends
|
|
8
|
+
var BitbucketServerTagsDatasource = class BitbucketServerTagsDatasource extends GitHostTagsDigestDatasource {
|
|
13
9
|
static id = "bitbucket-server-tags";
|
|
14
|
-
http = new BitbucketServerHttp(BitbucketServerTagsDatasource.id);
|
|
15
|
-
static cacheNamespace = `datasource-${BitbucketServerTagsDatasource.id}`;
|
|
16
10
|
constructor() {
|
|
17
|
-
super(BitbucketServerTagsDatasource.id);
|
|
11
|
+
super(BitbucketServerTagsDatasource.id, new BitbucketServerHttp(BitbucketServerTagsDatasource.id));
|
|
18
12
|
}
|
|
19
13
|
sourceUrlSupport = "package";
|
|
20
14
|
sourceUrlNote = "The source URL is determined by using the `packageName` and `registryUrl`.";
|
|
21
15
|
static getRegistryURL(registryUrl) {
|
|
22
16
|
return registryUrl?.replace(regEx(/\/rest\/api\/1.0$/), "");
|
|
23
17
|
}
|
|
24
|
-
static getSourceUrl(projectKey, repositorySlug, registryUrl) {
|
|
25
|
-
const url = BitbucketServerTagsDatasource.getRegistryURL(registryUrl);
|
|
26
|
-
return `${ensureTrailingSlash(url)}projects/${projectKey}/repos/${repositorySlug}`;
|
|
27
|
-
}
|
|
28
18
|
static getApiUrl(registryUrl) {
|
|
29
19
|
const res = BitbucketServerTagsDatasource.getRegistryURL(registryUrl);
|
|
30
20
|
return `${ensureTrailingSlash(res)}rest/api/1.0/`;
|
|
31
21
|
}
|
|
32
|
-
|
|
33
|
-
return
|
|
22
|
+
getRegistryUrl(registryUrl) {
|
|
23
|
+
return BitbucketServerTagsDatasource.getRegistryURL(registryUrl ?? "");
|
|
34
24
|
}
|
|
35
|
-
|
|
36
|
-
const { registryUrl, packageName } = config;
|
|
25
|
+
getSourceUrl(packageName, registryUrl) {
|
|
37
26
|
const [projectKey, repositorySlug] = packageName.split("/");
|
|
27
|
+
const url = this.getRegistryUrl(registryUrl);
|
|
28
|
+
return joinUrlParts(url, "projects", projectKey, "repos", repositorySlug);
|
|
29
|
+
}
|
|
30
|
+
/** REST API base URL of the repository. */
|
|
31
|
+
getRepoApiUrl(registryUrl, packageName) {
|
|
32
|
+
const [projectKey, repositorySlug] = packageName.split("/");
|
|
33
|
+
return joinUrlParts(BitbucketServerTagsDatasource.getApiUrl(registryUrl), "projects", projectKey, "repos", repositorySlug);
|
|
34
|
+
}
|
|
35
|
+
async fetchTags(config) {
|
|
36
|
+
const { registryUrl, packageName } = config;
|
|
38
37
|
if (!registryUrl) {
|
|
39
38
|
logger.debug("Missing registryUrl");
|
|
40
39
|
return null;
|
|
41
40
|
}
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
const url = joinUrlParts(this.getRepoApiUrl(registryUrl, packageName), "tags");
|
|
42
|
+
const tags = await this.fetchJsonOrNull(url, BitbucketServerTags, { paginate: true });
|
|
43
|
+
if (!tags) return null;
|
|
44
|
+
return tags.map(({ displayId, hash }) => ({
|
|
46
45
|
version: displayId,
|
|
47
|
-
gitRef: displayId,
|
|
48
46
|
newDigest: hash ?? void 0
|
|
49
|
-
}))
|
|
50
|
-
return {
|
|
51
|
-
sourceUrl: BitbucketServerTagsDatasource.getSourceUrl(projectKey, repositorySlug, registryUrl),
|
|
52
|
-
registryUrl: BitbucketServerTagsDatasource.getRegistryURL(registryUrl),
|
|
53
|
-
releases: versions
|
|
54
|
-
};
|
|
55
|
-
}).unwrap();
|
|
56
|
-
if (err instanceof ZodError) {
|
|
57
|
-
logger.debug({ err }, "bitbucket-server-tags: validation error");
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
if (err) this.handleGenericErrors(err);
|
|
61
|
-
return val;
|
|
62
|
-
}
|
|
63
|
-
getReleases(config) {
|
|
64
|
-
return withCache({
|
|
65
|
-
namespace: BitbucketServerTagsDatasource.cacheNamespace,
|
|
66
|
-
key: BitbucketServerTagsDatasource.getCacheKey(config.registryUrl, config.packageName, "tags"),
|
|
67
|
-
fallback: true
|
|
68
|
-
}, () => this._getReleases(config));
|
|
47
|
+
}));
|
|
69
48
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
getTagCommit(baseUrl, tag, config) {
|
|
74
|
-
return withCache({
|
|
75
|
-
namespace: BitbucketServerTagsDatasource.cacheNamespace,
|
|
76
|
-
key: BitbucketServerTagsDatasource.getCacheKey(config.registryUrl, config.packageName, `tag-${tag}`)
|
|
77
|
-
}, () => this._getTagCommit(baseUrl, tag));
|
|
78
|
-
}
|
|
79
|
-
async _getDigest(config, newValue) {
|
|
80
|
-
const { registryUrl, packageName } = config;
|
|
81
|
-
const [projectKey, repositorySlug] = packageName.split("/");
|
|
82
|
-
if (!registryUrl) {
|
|
49
|
+
fetchDigest(config, newValue) {
|
|
50
|
+
if (!config.registryUrl) {
|
|
83
51
|
logger.debug("Missing registryUrl");
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
const baseUrl = `${BitbucketServerTagsDatasource.getApiUrl(registryUrl)}projects/${projectKey}/repos/${repositorySlug}`;
|
|
87
|
-
if (newValue?.length) return this.getTagCommit(baseUrl, newValue, config);
|
|
88
|
-
const { val = null, err } = await Result.parse(config, DigestsConfig).transform(() => {
|
|
89
|
-
const url = `${baseUrl}/commits?ignoreMissing=true`;
|
|
90
|
-
return this.http.getJsonSafe(url, {
|
|
91
|
-
paginate: true,
|
|
92
|
-
limit: 1,
|
|
93
|
-
maxPages: 1
|
|
94
|
-
}, BitbucketServerCommits);
|
|
95
|
-
}).transform((commits) => {
|
|
96
|
-
return commits[0]?.id;
|
|
97
|
-
}).unwrap();
|
|
98
|
-
if (err instanceof ZodError) {
|
|
99
|
-
logger.debug({ err }, "bitbucket-server-tags: validation error");
|
|
100
|
-
return null;
|
|
52
|
+
return Promise.resolve(null);
|
|
101
53
|
}
|
|
102
|
-
|
|
103
|
-
|
|
54
|
+
return super.fetchDigest(config, newValue);
|
|
55
|
+
}
|
|
56
|
+
async fetchTagCommit(registryUrl, repo, tag) {
|
|
57
|
+
const baseUrl = this.getRepoApiUrl(registryUrl, repo);
|
|
58
|
+
return (await this.http.getJson(joinUrlParts(baseUrl, "tags", tag), BitbucketServerTag)).body.hash ?? null;
|
|
104
59
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
60
|
+
async fetchLatestCommit(registryUrl, repo) {
|
|
61
|
+
const baseUrl = this.getRepoApiUrl(registryUrl, repo);
|
|
62
|
+
const url = joinUrlParts(baseUrl, "commits?ignoreMissing=true");
|
|
63
|
+
return (await this.fetchJsonOrNull(url, BitbucketServerCommits, {
|
|
64
|
+
paginate: true,
|
|
65
|
+
limit: 1,
|
|
66
|
+
maxPages: 1
|
|
67
|
+
}))?.[0]?.id ?? null;
|
|
111
68
|
}
|
|
112
69
|
};
|
|
113
70
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/datasource/bitbucket-server-tags/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/datasource/bitbucket-server-tags/index.ts"],"sourcesContent":["import { logger } from '../../../logger/index.ts';\nimport { BitbucketServerHttp } from '../../../util/http/bitbucket-server.ts';\nimport { regEx } from '../../../util/regex.ts';\nimport { ensureTrailingSlash, joinUrlParts } from '../../../util/url.ts';\nimport { GitHostTagsDigestDatasource } from '../git-host-tags.ts';\nimport type { DigestConfig, GetReleasesConfig, GitHostTag } from '../types.ts';\nimport {\n BitbucketServerCommits,\n BitbucketServerTag,\n BitbucketServerTags,\n} from './schema.ts';\n\nexport class BitbucketServerTagsDatasource extends GitHostTagsDigestDatasource<BitbucketServerHttp> {\n static readonly id = 'bitbucket-server-tags';\n\n constructor() {\n super(\n BitbucketServerTagsDatasource.id,\n new BitbucketServerHttp(BitbucketServerTagsDatasource.id),\n );\n }\n\n override readonly sourceUrlSupport = 'package';\n override readonly sourceUrlNote =\n 'The source URL is determined by using the `packageName` and `registryUrl`.';\n\n static getRegistryURL(registryUrl: string): string {\n return registryUrl?.replace(regEx(/\\/rest\\/api\\/1.0$/), '');\n }\n\n static getApiUrl(registryUrl: string): string {\n const res = BitbucketServerTagsDatasource.getRegistryURL(registryUrl);\n return `${ensureTrailingSlash(res)}rest/api/1.0/`;\n }\n\n protected getRegistryUrl(registryUrl?: string): string {\n return BitbucketServerTagsDatasource.getRegistryURL(registryUrl ?? '');\n }\n\n protected getSourceUrl(packageName: string, registryUrl?: string): string {\n const [projectKey, repositorySlug] = packageName.split('/');\n const url = this.getRegistryUrl(registryUrl);\n return joinUrlParts(url, 'projects', projectKey, 'repos', repositorySlug);\n }\n\n /** REST API base URL of the repository. */\n private getRepoApiUrl(registryUrl: string, packageName: string): string {\n const [projectKey, repositorySlug] = packageName.split('/');\n return joinUrlParts(\n BitbucketServerTagsDatasource.getApiUrl(registryUrl),\n 'projects',\n projectKey,\n 'repos',\n repositorySlug,\n );\n }\n\n // fetchTags fetches list of tags for the repository\n protected async fetchTags(\n config: GetReleasesConfig,\n ): Promise<GitHostTag[] | null> {\n const { registryUrl, packageName } = config;\n if (!registryUrl) {\n logger.debug('Missing registryUrl');\n return null;\n }\n\n const url = joinUrlParts(\n this.getRepoApiUrl(registryUrl, packageName),\n 'tags',\n );\n\n const tags = await this.fetchJsonOrNull(url, BitbucketServerTags, {\n paginate: true,\n });\n if (!tags) {\n return null;\n }\n\n return tags.map(({ displayId, hash }) => ({\n version: displayId,\n newDigest: hash ?? undefined,\n }));\n }\n\n protected override fetchDigest(\n config: DigestConfig,\n newValue?: string,\n ): Promise<string | null> {\n if (!config.registryUrl) {\n logger.debug('Missing registryUrl');\n return Promise.resolve(null);\n }\n\n return super.fetchDigest(config, newValue);\n }\n\n // fetchTagCommit fetches the commit hash for the specified tag\n protected async fetchTagCommit(\n registryUrl: string | undefined,\n repo: string,\n tag: string,\n ): Promise<string | null> {\n const baseUrl = this.getRepoApiUrl(registryUrl!, repo);\n const bitbucketServerTag = (\n await this.http.getJson(\n joinUrlParts(baseUrl, 'tags', tag),\n BitbucketServerTag,\n )\n ).body;\n\n return bitbucketServerTag.hash ?? null;\n }\n\n // fetchLatestCommit fetches the latest commit for the repository main branch\n protected async fetchLatestCommit(\n registryUrl: string | undefined,\n repo: string,\n ): Promise<string | null> {\n const baseUrl = this.getRepoApiUrl(registryUrl!, repo);\n\n const url = joinUrlParts(baseUrl, 'commits?ignoreMissing=true');\n\n const commits = await this.fetchJsonOrNull(url, BitbucketServerCommits, {\n paginate: true,\n limit: 1,\n maxPages: 1,\n });\n\n return commits?.[0]?.id ?? null;\n }\n}\n"],"mappings":";;;;;;;AAYA,IAAa,gCAAb,MAAa,sCAAsC,4BAAiD;CAClG,OAAgB,KAAK;CAErB,cAAc;EACZ,MACE,8BAA8B,IAC9B,IAAI,oBAAoB,8BAA8B,EAAE,CAC1D;CACF;CAEA,mBAAqC;CACrC,gBACE;CAEF,OAAO,eAAe,aAA6B;EACjD,OAAO,aAAa,QAAQ,MAAM,mBAAmB,GAAG,EAAE;CAC5D;CAEA,OAAO,UAAU,aAA6B;EAC5C,MAAM,MAAM,8BAA8B,eAAe,WAAW;EACpE,OAAO,GAAG,oBAAoB,GAAG,EAAE;CACrC;CAEA,eAAyB,aAA8B;EACrD,OAAO,8BAA8B,eAAe,eAAe,EAAE;CACvE;CAEA,aAAuB,aAAqB,aAA8B;EACxE,MAAM,CAAC,YAAY,kBAAkB,YAAY,MAAM,GAAG;EAC1D,MAAM,MAAM,KAAK,eAAe,WAAW;EAC3C,OAAO,aAAa,KAAK,YAAY,YAAY,SAAS,cAAc;CAC1E;;CAGA,cAAsB,aAAqB,aAA6B;EACtE,MAAM,CAAC,YAAY,kBAAkB,YAAY,MAAM,GAAG;EAC1D,OAAO,aACL,8BAA8B,UAAU,WAAW,GACnD,YACA,YACA,SACA,cACF;CACF;CAGA,MAAgB,UACd,QAC8B;EAC9B,MAAM,EAAE,aAAa,gBAAgB;EACrC,IAAI,CAAC,aAAa;GAChB,OAAO,MAAM,qBAAqB;GAClC,OAAO;EACT;EAEA,MAAM,MAAM,aACV,KAAK,cAAc,aAAa,WAAW,GAC3C,MACF;EAEA,MAAM,OAAO,MAAM,KAAK,gBAAgB,KAAK,qBAAqB,EAChE,UAAU,KACZ,CAAC;EACD,IAAI,CAAC,MACH,OAAO;EAGT,OAAO,KAAK,KAAK,EAAE,WAAW,YAAY;GACxC,SAAS;GACT,WAAW,QAAQ,KAAA;EACrB,EAAE;CACJ;CAEA,YACE,QACA,UACwB;EACxB,IAAI,CAAC,OAAO,aAAa;GACvB,OAAO,MAAM,qBAAqB;GAClC,OAAO,QAAQ,QAAQ,IAAI;EAC7B;EAEA,OAAO,MAAM,YAAY,QAAQ,QAAQ;CAC3C;CAGA,MAAgB,eACd,aACA,MACA,KACwB;EACxB,MAAM,UAAU,KAAK,cAAc,aAAc,IAAI;EAQrD,QANE,MAAM,KAAK,KAAK,QACd,aAAa,SAAS,QAAQ,GAAG,GACjC,kBACF,EAAA,CACA,KAEwB,QAAQ;CACpC;CAGA,MAAgB,kBACd,aACA,MACwB;EACxB,MAAM,UAAU,KAAK,cAAc,aAAc,IAAI;EAErD,MAAM,MAAM,aAAa,SAAS,4BAA4B;EAQ9D,QAAO,MANe,KAAK,gBAAgB,KAAK,wBAAwB;GACtE,UAAU;GACV,OAAO;GACP,UAAU;EACZ,CAAC,EAAA,GAEgB,EAAE,EAAE,MAAM;CAC7B;AACF"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { ensureTrailingSlash } from "../../../util/url.js";
|
|
2
|
-
import { withCache } from "../../../util/cache/package/with-cache.js";
|
|
3
2
|
import { asTimestamp } from "../../../util/timestamp.js";
|
|
4
|
-
import {
|
|
3
|
+
import { GitHostTagsDigestDatasource } from "../git-host-tags.js";
|
|
5
4
|
import { BitbucketHttp } from "../../../util/http/bitbucket.js";
|
|
6
5
|
import { RepoInfo } from "../../platform/bitbucket/schema.js";
|
|
7
6
|
import { BitbucketCommits, BitbucketTag, BitbucketTags } from "./schema.js";
|
|
8
7
|
//#region lib/modules/datasource/bitbucket-tags/index.ts
|
|
9
|
-
var BitbucketTagsDatasource = class BitbucketTagsDatasource extends
|
|
8
|
+
var BitbucketTagsDatasource = class BitbucketTagsDatasource extends GitHostTagsDigestDatasource {
|
|
10
9
|
static id = "bitbucket-tags";
|
|
11
|
-
bitbucketHttp = new BitbucketHttp(BitbucketTagsDatasource.id);
|
|
12
10
|
static defaultRegistryUrls = ["https://bitbucket.org"];
|
|
13
|
-
static cacheNamespace = `datasource-${BitbucketTagsDatasource.id}`;
|
|
14
11
|
constructor() {
|
|
15
|
-
super(BitbucketTagsDatasource.id);
|
|
12
|
+
super(BitbucketTagsDatasource.id, new BitbucketHttp(BitbucketTagsDatasource.id));
|
|
16
13
|
}
|
|
17
14
|
getDefaultRegistryUrls(_packageName) {
|
|
18
15
|
return BitbucketTagsDatasource.defaultRegistryUrls;
|
|
@@ -24,67 +21,42 @@ var BitbucketTagsDatasource = class BitbucketTagsDatasource extends Datasource {
|
|
|
24
21
|
static getRegistryURL(registryUrl) {
|
|
25
22
|
return registryUrl ?? this.defaultRegistryUrls[0];
|
|
26
23
|
}
|
|
27
|
-
static getCacheKey(registryUrl, repo, type) {
|
|
28
|
-
return `${BitbucketTagsDatasource.getRegistryURL(registryUrl)}:${repo}:${type}`;
|
|
29
|
-
}
|
|
30
24
|
static getSourceUrl(packageName, registryUrl) {
|
|
31
25
|
const url = BitbucketTagsDatasource.getRegistryURL(registryUrl);
|
|
32
26
|
return `${ensureTrailingSlash(url)}${packageName}`;
|
|
33
27
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const bitbucketTags = (await this.bitbucketHttp.getJson(url, { paginate: true }, BitbucketTags)).body;
|
|
37
|
-
return {
|
|
38
|
-
sourceUrl: BitbucketTagsDatasource.getSourceUrl(repo, registryUrl),
|
|
39
|
-
registryUrl: BitbucketTagsDatasource.getRegistryURL(registryUrl),
|
|
40
|
-
releases: bitbucketTags.map(({ name, target }) => ({
|
|
41
|
-
version: name,
|
|
42
|
-
gitRef: name,
|
|
43
|
-
releaseTimestamp: asTimestamp(target?.date)
|
|
44
|
-
}))
|
|
45
|
-
};
|
|
28
|
+
getRegistryUrl(registryUrl) {
|
|
29
|
+
return BitbucketTagsDatasource.getRegistryURL(registryUrl);
|
|
46
30
|
}
|
|
47
|
-
|
|
48
|
-
return
|
|
49
|
-
namespace: BitbucketTagsDatasource.cacheNamespace,
|
|
50
|
-
key: BitbucketTagsDatasource.getCacheKey(config.registryUrl, config.packageName, "tags"),
|
|
51
|
-
fallback: true
|
|
52
|
-
}, () => this._getReleases(config));
|
|
31
|
+
getSourceUrl(packageName, registryUrl) {
|
|
32
|
+
return BitbucketTagsDatasource.getSourceUrl(packageName, registryUrl);
|
|
53
33
|
}
|
|
54
|
-
async
|
|
55
|
-
const url = `/2.0/repositories/${repo}/refs/tags
|
|
56
|
-
return (await this.
|
|
34
|
+
async fetchTags({ packageName: repo }) {
|
|
35
|
+
const url = `/2.0/repositories/${repo}/refs/tags`;
|
|
36
|
+
return (await this.http.getJson(url, { paginate: true }, BitbucketTags)).body.map(({ name, target }) => ({
|
|
37
|
+
version: name,
|
|
38
|
+
releaseTimestamp: asTimestamp(target?.date)
|
|
39
|
+
}));
|
|
57
40
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
key: BitbucketTagsDatasource.getCacheKey(registryUrl, repo, `tag-${tag}`)
|
|
62
|
-
}, () => this._getTagCommit(registryUrl, repo, tag));
|
|
41
|
+
async fetchTagCommit(_registryUrl, repo, tag) {
|
|
42
|
+
const url = `/2.0/repositories/${repo}/refs/tags/${tag}`;
|
|
43
|
+
return (await this.http.getJson(url, BitbucketTag)).body.target?.hash ?? null;
|
|
63
44
|
}
|
|
64
45
|
async _getMainBranch(_registryUrl, repo) {
|
|
65
|
-
return (await this.
|
|
46
|
+
return (await this.http.getJson(`/2.0/repositories/${repo}`, RepoInfo)).body.mainbranch;
|
|
66
47
|
}
|
|
67
48
|
getMainBranch(registryUrl, repo) {
|
|
68
|
-
return
|
|
69
|
-
|
|
70
|
-
key: BitbucketTagsDatasource.getCacheKey(registryUrl, repo, "mainbranch"),
|
|
49
|
+
return this.cached({
|
|
50
|
+
key: this.getCacheKey(registryUrl, repo, "mainbranch"),
|
|
71
51
|
ttlMinutes: 60
|
|
72
52
|
}, () => this._getMainBranch(registryUrl, repo));
|
|
73
53
|
}
|
|
74
|
-
async
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
const bitbucketCommits = (await this.bitbucketHttp.getJson(url, BitbucketCommits)).body;
|
|
54
|
+
async fetchLatestCommit(registryUrl, repo) {
|
|
55
|
+
const url = `/2.0/repositories/${repo}/commits/${await this.getMainBranch(this.getRegistryUrl(registryUrl), repo)}`;
|
|
56
|
+
const bitbucketCommits = (await this.http.getJson(url, BitbucketCommits)).body;
|
|
78
57
|
if (bitbucketCommits.length === 0) return null;
|
|
79
58
|
return bitbucketCommits[0].hash;
|
|
80
59
|
}
|
|
81
|
-
getDigest(config, newValue) {
|
|
82
|
-
return withCache({
|
|
83
|
-
namespace: BitbucketTagsDatasource.cacheNamespace,
|
|
84
|
-
key: BitbucketTagsDatasource.getCacheKey(config.registryUrl, config.packageName, "digest"),
|
|
85
|
-
fallback: true
|
|
86
|
-
}, () => this._getDigest(config, newValue));
|
|
87
|
-
}
|
|
88
60
|
};
|
|
89
61
|
//#endregion
|
|
90
62
|
export { BitbucketTagsDatasource };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/datasource/bitbucket-tags/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/datasource/bitbucket-tags/index.ts"],"sourcesContent":["import { BitbucketHttp } from '../../../util/http/bitbucket.ts';\nimport { asTimestamp } from '../../../util/timestamp.ts';\nimport { ensureTrailingSlash } from '../../../util/url.ts';\nimport { RepoInfo } from '../../platform/bitbucket/schema.ts';\nimport { GitHostTagsDigestDatasource } from '../git-host-tags.ts';\nimport type { GetReleasesConfig, GitHostTag } from '../types.ts';\nimport { BitbucketCommits, BitbucketTag, BitbucketTags } from './schema.ts';\n\nexport class BitbucketTagsDatasource extends GitHostTagsDigestDatasource<BitbucketHttp> {\n static readonly id = 'bitbucket-tags';\n\n static readonly defaultRegistryUrls = ['https://bitbucket.org'];\n\n constructor() {\n super(\n BitbucketTagsDatasource.id,\n new BitbucketHttp(BitbucketTagsDatasource.id),\n );\n }\n\n override getDefaultRegistryUrls(_packageName: string): string[] {\n return BitbucketTagsDatasource.defaultRegistryUrls;\n }\n\n override readonly releaseTimestampSupport = true;\n override readonly releaseTimestampNote =\n 'The release timestamp is determined from the `date` field in the results.';\n override readonly sourceUrlSupport = 'package';\n override readonly sourceUrlNote =\n 'The source URL is determined by using the `packageName` and `registryUrl`.';\n\n static getRegistryURL(registryUrl?: string): string {\n // fallback to default API endpoint if custom not provided\n return registryUrl ?? this.defaultRegistryUrls[0];\n }\n\n static getSourceUrl(packageName: string, registryUrl?: string): string {\n const url = BitbucketTagsDatasource.getRegistryURL(registryUrl);\n const normalizedUrl = ensureTrailingSlash(url);\n return `${normalizedUrl}${packageName}`;\n }\n\n protected getRegistryUrl(registryUrl?: string): string {\n return BitbucketTagsDatasource.getRegistryURL(registryUrl);\n }\n\n protected getSourceUrl(packageName: string, registryUrl?: string): string {\n return BitbucketTagsDatasource.getSourceUrl(packageName, registryUrl);\n }\n\n // fetchTags fetches list of tags for the repository\n protected async fetchTags({\n packageName: repo,\n }: GetReleasesConfig): Promise<GitHostTag[]> {\n const url = `/2.0/repositories/${repo}/refs/tags`;\n const bitbucketTags = (\n await this.http.getJson(url, { paginate: true }, BitbucketTags)\n ).body;\n\n return bitbucketTags.map(({ name, target }) => ({\n version: name,\n releaseTimestamp: asTimestamp(target?.date),\n }));\n }\n\n // fetchTagCommit fetches the commit hash for the specified tag\n protected async fetchTagCommit(\n _registryUrl: string | undefined,\n repo: string,\n tag: string,\n ): Promise<string | null> {\n const url = `/2.0/repositories/${repo}/refs/tags/${tag}`;\n\n const bitbucketTag = (await this.http.getJson(url, BitbucketTag)).body;\n\n return bitbucketTag.target?.hash ?? null;\n }\n\n private async _getMainBranch(\n _registryUrl: string,\n repo: string,\n ): Promise<string> {\n return (await this.http.getJson(`/2.0/repositories/${repo}`, RepoInfo)).body\n .mainbranch;\n }\n\n getMainBranch(registryUrl: string, repo: string): Promise<string> {\n return this.cached(\n {\n key: this.getCacheKey(registryUrl, repo, 'mainbranch'),\n ttlMinutes: 60,\n },\n () => this._getMainBranch(registryUrl, repo),\n );\n }\n\n // fetchLatestCommit fetches the latest commit for the repository main branch\n protected async fetchLatestCommit(\n registryUrl: string | undefined,\n repo: string,\n ): Promise<string | null> {\n const mainBranch = await this.getMainBranch(\n this.getRegistryUrl(registryUrl),\n repo,\n );\n\n const url = `/2.0/repositories/${repo}/commits/${mainBranch}`;\n const bitbucketCommits = (await this.http.getJson(url, BitbucketCommits))\n .body;\n\n if (bitbucketCommits.length === 0) {\n return null;\n }\n\n return bitbucketCommits[0].hash;\n }\n}\n"],"mappings":";;;;;;;AAQA,IAAa,0BAAb,MAAa,gCAAgC,4BAA2C;CACtF,OAAgB,KAAK;CAErB,OAAgB,sBAAsB,CAAC,uBAAuB;CAE9D,cAAc;EACZ,MACE,wBAAwB,IACxB,IAAI,cAAc,wBAAwB,EAAE,CAC9C;CACF;CAEA,uBAAgC,cAAgC;EAC9D,OAAO,wBAAwB;CACjC;CAEA,0BAA4C;CAC5C,uBACE;CACF,mBAAqC;CACrC,gBACE;CAEF,OAAO,eAAe,aAA8B;EAElD,OAAO,eAAe,KAAK,oBAAoB;CACjD;CAEA,OAAO,aAAa,aAAqB,aAA8B;EACrE,MAAM,MAAM,wBAAwB,eAAe,WAAW;EAE9D,OAAO,GADe,oBAAoB,GACpB,IAAI;CAC5B;CAEA,eAAyB,aAA8B;EACrD,OAAO,wBAAwB,eAAe,WAAW;CAC3D;CAEA,aAAuB,aAAqB,aAA8B;EACxE,OAAO,wBAAwB,aAAa,aAAa,WAAW;CACtE;CAGA,MAAgB,UAAU,EACxB,aAAa,QAC8B;EAC3C,MAAM,MAAM,qBAAqB,KAAK;EAKtC,QAHE,MAAM,KAAK,KAAK,QAAQ,KAAK,EAAE,UAAU,KAAK,GAAG,aAAa,EAAA,CAC9D,KAEmB,KAAK,EAAE,MAAM,cAAc;GAC9C,SAAS;GACT,kBAAkB,YAAY,QAAQ,IAAI;EAC5C,EAAE;CACJ;CAGA,MAAgB,eACd,cACA,MACA,KACwB;EACxB,MAAM,MAAM,qBAAqB,KAAK,aAAa;EAInD,QAFsB,MAAM,KAAK,KAAK,QAAQ,KAAK,YAAY,EAAA,CAAG,KAE9C,QAAQ,QAAQ;CACtC;CAEA,MAAc,eACZ,cACA,MACiB;EACjB,QAAQ,MAAM,KAAK,KAAK,QAAQ,qBAAqB,QAAQ,QAAQ,EAAA,CAAG,KACrE;CACL;CAEA,cAAc,aAAqB,MAA+B;EAChE,OAAO,KAAK,OACV;GACE,KAAK,KAAK,YAAY,aAAa,MAAM,YAAY;GACrD,YAAY;EACd,SACM,KAAK,eAAe,aAAa,IAAI,CAC7C;CACF;CAGA,MAAgB,kBACd,aACA,MACwB;EAMxB,MAAM,MAAM,qBAAqB,KAAK,WAAW,MALxB,KAAK,cAC5B,KAAK,eAAe,WAAW,GAC/B,IACF;EAGA,MAAM,oBAAoB,MAAM,KAAK,KAAK,QAAQ,KAAK,gBAAgB,EAAA,CACpE;EAEH,IAAI,iBAAiB,WAAW,GAC9B,OAAO;EAGT,OAAO,iBAAiB,EAAE,CAAC;CAC7B;AACF"}
|
|
@@ -12,10 +12,8 @@ import { isArray } from "@sindresorhus/is";
|
|
|
12
12
|
//#region lib/modules/datasource/bitrise/index.ts
|
|
13
13
|
var BitriseDatasource = class BitriseDatasource extends Datasource {
|
|
14
14
|
static id = "bitrise";
|
|
15
|
-
http;
|
|
16
15
|
constructor() {
|
|
17
|
-
super(BitriseDatasource.id);
|
|
18
|
-
this.http = new GithubHttp(this.id);
|
|
16
|
+
super(BitriseDatasource.id, new GithubHttp(BitriseDatasource.id));
|
|
19
17
|
}
|
|
20
18
|
supportsCustomRegistry(_packageName) {
|
|
21
19
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["semver"],"sources":["../../../../lib/modules/datasource/bitrise/index.ts"],"sourcesContent":["import { isArray } from '@sindresorhus/is';\nimport { logger } from '../../../logger/index.ts';\nimport { detectPlatform } from '../../../util/common.ts';\nimport { parseGitUrl } from '../../../util/git/url.ts';\nimport { GithubHttp } from '../../../util/http/github.ts';\nimport { fromBase64 } from '../../../util/string.ts';\nimport { joinUrlParts } from '../../../util/url.ts';\nimport { GithubContentResponse } from '../../platform/github/schema.ts';\nimport semver from '../../versioning/semver/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport type { GetReleasesConfig, ReleaseResult } from '../types.ts';\nimport { BitriseStepFile } from './schema.ts';\n\nexport class BitriseDatasource extends Datasource {\n static readonly id = 'bitrise';\n\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["semver"],"sources":["../../../../lib/modules/datasource/bitrise/index.ts"],"sourcesContent":["import { isArray } from '@sindresorhus/is';\nimport { logger } from '../../../logger/index.ts';\nimport { detectPlatform } from '../../../util/common.ts';\nimport { parseGitUrl } from '../../../util/git/url.ts';\nimport { GithubHttp } from '../../../util/http/github.ts';\nimport { fromBase64 } from '../../../util/string.ts';\nimport { joinUrlParts } from '../../../util/url.ts';\nimport { GithubContentResponse } from '../../platform/github/schema.ts';\nimport semver from '../../versioning/semver/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport type { GetReleasesConfig, ReleaseResult } from '../types.ts';\nimport { BitriseStepFile } from './schema.ts';\n\nexport class BitriseDatasource extends Datasource<GithubHttp> {\n static readonly id = 'bitrise';\n\n constructor() {\n super(BitriseDatasource.id, new GithubHttp(BitriseDatasource.id));\n }\n\n override supportsCustomRegistry(_packageName: string): boolean {\n return true;\n }\n\n override getDefaultRegistryUrls(_packageName: string): string[] {\n return ['https://github.com/bitrise-io/bitrise-steplib.git'];\n }\n\n override readonly releaseTimestampSupport = true;\n override readonly releaseTimestampNote =\n 'The release timestamp is determined from the `published_at` field in the results.';\n override readonly sourceUrlSupport = 'release';\n override readonly sourceUrlNote =\n 'The source URL is determined from the `source_code_url` field of the release object in the results.';\n\n private async fetchReleases({\n packageName,\n registryUrl,\n }: GetReleasesConfig): Promise<ReleaseResult | null> {\n /* v8 ignore next -- should never happen */\n if (!registryUrl) {\n return null;\n }\n\n const parsedUrl = parseGitUrl(registryUrl);\n if (detectPlatform(registryUrl) !== 'github') {\n logger.once.warn(\n { source: parsedUrl.source },\n 'Unsupported Git hoster for this datasource',\n );\n return null;\n }\n\n const result: ReleaseResult = {\n releases: [],\n };\n\n const massagedPackageName = encodeURIComponent(packageName);\n const baseApiURL =\n parsedUrl.resource === 'github.com'\n ? 'https://api.github.com'\n : `https://${parsedUrl.resource}/api/v3`;\n const packageUrl = joinUrlParts(\n baseApiURL,\n 'repos',\n parsedUrl.full_name,\n 'contents/steps',\n massagedPackageName,\n );\n\n const { body: packageRaw } = await this.http.getJson(\n packageUrl,\n GithubContentResponse,\n );\n\n if (!isArray(packageRaw)) {\n logger.warn(\n { data: packageRaw, url: packageUrl },\n 'Got unexpected response for Bitrise package location',\n );\n return null;\n }\n\n for (const versionDir of packageRaw.filter((element) =>\n semver.isValid(element.name),\n )) {\n const stepUrl = joinUrlParts(packageUrl, versionDir.name, 'step.yml');\n // TODO use getRawFile when ready #30155\n const { body } = await this.http.getJson(stepUrl, GithubContentResponse);\n if (!('content' in body)) {\n logger.warn(\n { data: body, url: stepUrl },\n 'Got unexpected response for Bitrise step location',\n );\n return null;\n }\n if (body.encoding !== 'base64') {\n logger.warn(\n { encoding: body.encoding, data: body, url: stepUrl },\n `Got unexpected encoding for Bitrise step location`,\n );\n return null;\n }\n\n const content = fromBase64(body.content);\n const { published_at, source_code_url } = BitriseStepFile.parse(content);\n\n result.releases.push({\n version: versionDir.name,\n releaseTimestamp: published_at,\n sourceUrl: source_code_url,\n });\n }\n\n // if we have no releases return null\n if (!result.releases.length) {\n return null;\n }\n\n return {\n ...result,\n homepage: `https://bitrise.io/integrations/steps/${packageName}`,\n };\n }\n\n getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> {\n return this.cached(\n {\n key: `${config.registryUrl}/${config.packageName}`,\n fallback: true,\n },\n () => this.fetchReleases(config),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAaA,IAAa,oBAAb,MAAa,0BAA0B,WAAuB;CAC5D,OAAgB,KAAK;CAErB,cAAc;EACZ,MAAM,kBAAkB,IAAI,IAAI,WAAW,kBAAkB,EAAE,CAAC;CAClE;CAEA,uBAAgC,cAA+B;EAC7D,OAAO;CACT;CAEA,uBAAgC,cAAgC;EAC9D,OAAO,CAAC,mDAAmD;CAC7D;CAEA,0BAA4C;CAC5C,uBACE;CACF,mBAAqC;CACrC,gBACE;CAEF,MAAc,cAAc,EAC1B,aACA,eACmD;;EAEnD,IAAI,CAAC,aACH,OAAO;EAGT,MAAM,YAAY,YAAY,WAAW;EACzC,IAAI,eAAe,WAAW,MAAM,UAAU;GAC5C,OAAO,KAAK,KACV,EAAE,QAAQ,UAAU,OAAO,GAC3B,4CACF;GACA,OAAO;EACT;EAEA,MAAM,SAAwB,EAC5B,UAAU,CAAC,EACb;EAEA,MAAM,sBAAsB,mBAAmB,WAAW;EAC1D,MAAM,aACJ,UAAU,aAAa,eACnB,2BACA,WAAW,UAAU,SAAS;EACpC,MAAM,aAAa,aACjB,YACA,SACA,UAAU,WACV,kBACA,mBACF;EAEA,MAAM,EAAE,MAAM,eAAe,MAAM,KAAK,KAAK,QAC3C,YACA,qBACF;EAEA,IAAI,CAAC,QAAQ,UAAU,GAAG;GACxB,OAAO,KACL;IAAE,MAAM;IAAY,KAAK;GAAW,GACpC,sDACF;GACA,OAAO;EACT;EAEA,KAAK,MAAM,cAAc,WAAW,QAAQ,YAC1CA,IAAO,QAAQ,QAAQ,IAAI,CAC7B,GAAG;GACD,MAAM,UAAU,aAAa,YAAY,WAAW,MAAM,UAAU;GAEpE,MAAM,EAAE,SAAS,MAAM,KAAK,KAAK,QAAQ,SAAS,qBAAqB;GACvE,IAAI,EAAE,aAAa,OAAO;IACxB,OAAO,KACL;KAAE,MAAM;KAAM,KAAK;IAAQ,GAC3B,mDACF;IACA,OAAO;GACT;GACA,IAAI,KAAK,aAAa,UAAU;IAC9B,OAAO,KACL;KAAE,UAAU,KAAK;KAAU,MAAM;KAAM,KAAK;IAAQ,GACpD,mDACF;IACA,OAAO;GACT;GAEA,MAAM,UAAU,WAAW,KAAK,OAAO;GACvC,MAAM,EAAE,cAAc,oBAAoB,gBAAgB,MAAM,OAAO;GAEvE,OAAO,SAAS,KAAK;IACnB,SAAS,WAAW;IACpB,kBAAkB;IAClB,WAAW;GACb,CAAC;EACH;EAGA,IAAI,CAAC,OAAO,SAAS,QACnB,OAAO;EAGT,OAAO;GACL,GAAG;GACH,UAAU,yCAAyC;EACrD;CACF;CAEA,YAAY,QAA0D;EACpE,OAAO,KAAK,OACV;GACE,KAAK,GAAG,OAAO,YAAY,GAAG,OAAO;GACrC,UAAU;EACZ,SACM,KAAK,cAAc,MAAM,CACjC;CACF;AACF"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { logger } from "../../../logger/index.js";
|
|
2
1
|
import { withCache } from "../../../util/cache/package/with-cache.js";
|
|
3
|
-
import { Result } from "../../../util/result.js";
|
|
4
2
|
import { Datasource } from "../datasource.js";
|
|
5
|
-
import { ReleasesConfig } from "../schema.js";
|
|
6
3
|
import { BuildpacksRegistryResponse } from "./schema.js";
|
|
7
|
-
import { ZodError } from "zod/v4";
|
|
8
4
|
import urlJoin from "url-join";
|
|
9
5
|
//#region lib/modules/datasource/buildpacks-registry/index.ts
|
|
10
6
|
var BuildpacksRegistryDatasource = class BuildpacksRegistryDatasource extends Datasource {
|
|
@@ -23,20 +19,16 @@ var BuildpacksRegistryDatasource = class BuildpacksRegistryDatasource extends Da
|
|
|
23
19
|
sourceUrlSupport = "release";
|
|
24
20
|
sourceUrlNote = "The source URL is determined from the `source_code_url` field of the release object in the results.";
|
|
25
21
|
async _getReleases(config) {
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
if (err) this.handleGenericErrors(err);
|
|
39
|
-
return val;
|
|
22
|
+
const { packageName, registryUrl } = config;
|
|
23
|
+
/* v8 ignore next -- should never happen */
|
|
24
|
+
if (!registryUrl) return null;
|
|
25
|
+
const url = urlJoin(registryUrl, "api", "v1", "buildpacks", packageName);
|
|
26
|
+
const body = await this.fetchJsonOrNull(url, BuildpacksRegistryResponse);
|
|
27
|
+
if (!body) return null;
|
|
28
|
+
const { versions, latest } = body;
|
|
29
|
+
const res = { releases: versions };
|
|
30
|
+
if (latest?.homepage) res.homepage = latest.homepage;
|
|
31
|
+
return res;
|
|
40
32
|
}
|
|
41
33
|
getReleases(config) {
|
|
42
34
|
return withCache({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/datasource/buildpacks-registry/index.ts"],"sourcesContent":["import urlJoin from 'url-join';\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/datasource/buildpacks-registry/index.ts"],"sourcesContent":["import urlJoin from 'url-join';\nimport { withCache } from '../../../util/cache/package/with-cache.ts';\nimport { Datasource } from '../datasource.ts';\nimport type { GetReleasesConfig, Release, ReleaseResult } from '../types.ts';\nimport { BuildpacksRegistryResponse } from './schema.ts';\n\nexport class BuildpacksRegistryDatasource extends Datasource {\n static readonly id = 'buildpacks-registry';\n\n constructor() {\n super(BuildpacksRegistryDatasource.id);\n }\n\n override supportsCustomRegistry(_packageName: string): boolean {\n return false;\n }\n\n override getDefaultRegistryUrls(_packageName: string): string[] {\n return ['https://registry.buildpacks.io'];\n }\n\n override readonly releaseTimestampSupport = true;\n override readonly releaseTimestampNote =\n 'The release timestamp is determined from the `published_at` field in the results.';\n override readonly sourceUrlSupport = 'release';\n override readonly sourceUrlNote =\n 'The source URL is determined from the `source_code_url` field of the release object in the results.';\n\n private async _getReleases(\n config: GetReleasesConfig,\n ): Promise<ReleaseResult | null> {\n const { packageName, registryUrl } = config;\n /* v8 ignore next -- should never happen */\n if (!registryUrl) {\n return null;\n }\n\n const url = urlJoin(registryUrl, 'api', 'v1', 'buildpacks', packageName);\n\n const body = await this.fetchJsonOrNull(url, BuildpacksRegistryResponse);\n if (!body) {\n return null;\n }\n\n const { versions, latest } = body;\n const releases: Release[] = versions;\n\n const res: ReleaseResult = { releases };\n\n if (latest?.homepage) {\n res.homepage = latest.homepage;\n }\n\n return res;\n }\n\n getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> {\n return withCache(\n {\n namespace: `datasource-${BuildpacksRegistryDatasource.id}`,\n key: `${config.registryUrl}:${config.packageName}`,\n cacheable: true,\n fallback: true,\n },\n () => this._getReleases(config),\n );\n }\n}\n"],"mappings":";;;;;AAMA,IAAa,+BAAb,MAAa,qCAAqC,WAAW;CAC3D,OAAgB,KAAK;CAErB,cAAc;EACZ,MAAM,6BAA6B,EAAE;CACvC;CAEA,uBAAgC,cAA+B;EAC7D,OAAO;CACT;CAEA,uBAAgC,cAAgC;EAC9D,OAAO,CAAC,gCAAgC;CAC1C;CAEA,0BAA4C;CAC5C,uBACE;CACF,mBAAqC;CACrC,gBACE;CAEF,MAAc,aACZ,QAC+B;EAC/B,MAAM,EAAE,aAAa,gBAAgB;;EAErC,IAAI,CAAC,aACH,OAAO;EAGT,MAAM,MAAM,QAAQ,aAAa,OAAO,MAAM,cAAc,WAAW;EAEvE,MAAM,OAAO,MAAM,KAAK,gBAAgB,KAAK,0BAA0B;EACvE,IAAI,CAAC,MACH,OAAO;EAGT,MAAM,EAAE,UAAU,WAAW;EAG7B,MAAM,MAAqB,EAAE,UAAA,SAAS;EAEtC,IAAI,QAAQ,UACV,IAAI,WAAW,OAAO;EAGxB,OAAO;CACT;CAEA,YAAY,QAA0D;EACpE,OAAO,UACL;GACE,WAAW,cAAc,6BAA6B;GACtD,KAAK,GAAG,OAAO,YAAY,GAAG,OAAO;GACrC,WAAW;GACX,UAAU;EACZ,SACM,KAAK,aAAa,MAAM,CAChC;CACF;AACF"}
|