renovate 44.105.1 → 44.105.2
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/config/presets/forgejo/index.js +2 -34
- package/dist/config/presets/forgejo/index.js.map +1 -1
- package/dist/config/presets/gitea/common.js +52 -0
- package/dist/config/presets/gitea/common.js.map +1 -0
- package/dist/config/presets/gitea/index.js +2 -34
- package/dist/config/presets/gitea/index.js.map +1 -1
- package/dist/modules/datasource/api.js +3 -3
- package/dist/modules/datasource/forgejo-releases/index.js +9 -58
- package/dist/modules/datasource/forgejo-releases/index.js.map +1 -1
- package/dist/modules/datasource/forgejo-tags/index.js +9 -72
- package/dist/modules/datasource/forgejo-tags/index.js.map +1 -1
- package/dist/modules/datasource/gitea-releases/index.js +17 -53
- package/dist/modules/datasource/gitea-releases/index.js.map +1 -1
- package/dist/modules/datasource/gitea-tags/base.js +93 -0
- package/dist/modules/datasource/gitea-tags/base.js.map +1 -0
- package/dist/modules/datasource/gitea-tags/index.js +17 -67
- package/dist/modules/datasource/gitea-tags/index.js.map +1 -1
- package/dist/modules/datasource/gitea-tags/util.js +24 -0
- package/dist/modules/datasource/gitea-tags/util.js.map +1 -0
- package/dist/modules/datasource/go/base.js +1 -1
- package/dist/modules/datasource/go/common.js +1 -1
- package/dist/modules/datasource/go/index.js +1 -1
- package/dist/modules/datasource/go/releases-direct.js +1 -1
- package/dist/modules/manager/github-actions/extract.js +1 -1
- package/dist/modules/manager/renovate-config/extract.js +1 -1
- package/dist/modules/manager/terragrunt/index.js +1 -1
- package/dist/modules/manager/terragrunt/modules.js +1 -1
- package/dist/workers/repository/dependency-dashboard.js +8 -1
- package/dist/workers/repository/dependency-dashboard.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/api.js +1 -1
- package/dist/workers/repository/update/pr/changelog/forgejo/index.js +2 -41
- package/dist/workers/repository/update/pr/changelog/forgejo/index.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/forgejo/source.js +6 -11
- package/dist/workers/repository/update/pr/changelog/forgejo/source.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/gitea/common.js +56 -0
- package/dist/workers/repository/update/pr/changelog/gitea/common.js.map +1 -0
- package/dist/workers/repository/update/pr/changelog/gitea/index.js +2 -41
- package/dist/workers/repository/update/pr/changelog/gitea/index.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/gitea/source.js +3 -2
- package/dist/workers/repository/update/pr/changelog/gitea/source.js.map +1 -1
- package/package.json +1 -1
- package/renovate-schema.json +2 -2
- package/dist/modules/datasource/forgejo-releases/schema.js +0 -15
- package/dist/modules/datasource/forgejo-releases/schema.js.map +0 -1
- package/dist/modules/datasource/forgejo-tags/schema.js +0 -18
- package/dist/modules/datasource/forgejo-tags/schema.js.map +0 -1
|
@@ -1,40 +1,8 @@
|
|
|
1
|
-
import { logger } from "../../../logger/index.js";
|
|
2
|
-
import { ExternalHostError } from "../../../types/errors/external-host-error.js";
|
|
3
|
-
import { PRESET_DEP_NOT_FOUND, PRESET_INVALID, fetchPreset, parsePreset } from "../util.js";
|
|
4
|
-
import { getRepoContents } from "../../../modules/platform/gitea/gitea-helper.js";
|
|
5
1
|
import { forgejoHttp } from "../../../modules/platform/forgejo/index.js";
|
|
2
|
+
import { createPresetSource } from "../gitea/common.js";
|
|
6
3
|
//#region lib/config/presets/forgejo/index.ts
|
|
7
4
|
const Endpoint = "https://code.forgejo.org/";
|
|
8
|
-
|
|
9
|
-
let res;
|
|
10
|
-
try {
|
|
11
|
-
res = await getRepoContents(forgejoHttp, repo, fileName, tag, { baseUrl: endpoint });
|
|
12
|
-
} catch (err) {
|
|
13
|
-
if (err instanceof ExternalHostError) throw err;
|
|
14
|
-
logger.debug(`Preset file ${fileName} not found in ${repo}: ${err.message}`);
|
|
15
|
-
throw new Error(PRESET_DEP_NOT_FOUND);
|
|
16
|
-
}
|
|
17
|
-
let contentString;
|
|
18
|
-
if (res.type === "file") contentString = res.contentString;
|
|
19
|
-
else {
|
|
20
|
-
logger.debug(`Preset ${fileName} has unexpected type '${res.type}'. Only \`file\` is supported`);
|
|
21
|
-
throw new Error(PRESET_INVALID);
|
|
22
|
-
}
|
|
23
|
-
return parsePreset(contentString, fileName);
|
|
24
|
-
}
|
|
25
|
-
function getPresetFromEndpoint(repo, filePreset, presetPath, endpoint = Endpoint, tag) {
|
|
26
|
-
return fetchPreset({
|
|
27
|
-
repo,
|
|
28
|
-
filePreset,
|
|
29
|
-
presetPath,
|
|
30
|
-
endpoint,
|
|
31
|
-
tag,
|
|
32
|
-
fetch: fetchJSONFile
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function getPreset({ repo, presetName = "default", presetPath, tag }) {
|
|
36
|
-
return getPresetFromEndpoint(repo, presetName, presetPath, Endpoint, tag);
|
|
37
|
-
}
|
|
5
|
+
const { fetchJSONFile, getPresetFromEndpoint, getPreset } = createPresetSource(forgejoHttp, Endpoint);
|
|
38
6
|
//#endregion
|
|
39
7
|
export { Endpoint, fetchJSONFile, getPreset, getPresetFromEndpoint };
|
|
40
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/config/presets/forgejo/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/config/presets/forgejo/index.ts"],"sourcesContent":["import { forgejoHttp } from '../../../modules/platform/forgejo/index.ts';\nimport { createPresetSource } from '../gitea/common.ts';\n\nexport const Endpoint = 'https://code.forgejo.org/';\n\nexport const { fetchJSONFile, getPresetFromEndpoint, getPreset } =\n createPresetSource(forgejoHttp, Endpoint);\n"],"mappings":";;;AAGA,MAAa,WAAW;AAExB,MAAa,EAAE,eAAe,uBAAuB,cACnD,mBAAmB,aAAa,QAAQ"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { logger } from "../../../logger/index.js";
|
|
2
|
+
import { ExternalHostError } from "../../../types/errors/external-host-error.js";
|
|
3
|
+
import { PRESET_DEP_NOT_FOUND, PRESET_INVALID, fetchPreset, parsePreset } from "../util.js";
|
|
4
|
+
import { getRepoContents } from "../../../modules/platform/gitea/gitea-helper.js";
|
|
5
|
+
//#region lib/config/presets/gitea/common.ts
|
|
6
|
+
/**
|
|
7
|
+
* Builds the preset source of a platform which speaks the Gitea API.
|
|
8
|
+
*
|
|
9
|
+
* Forgejo is a fork of Gitea and serves the same contents API, so the Gitea
|
|
10
|
+
* and Forgejo sources only differ in their Http client and default endpoint.
|
|
11
|
+
*/
|
|
12
|
+
function createPresetSource(http, defaultEndpoint) {
|
|
13
|
+
async function fetchJSONFile(repo, fileName, endpoint, tag) {
|
|
14
|
+
let res;
|
|
15
|
+
try {
|
|
16
|
+
res = await getRepoContents(http, repo, fileName, tag, { baseUrl: endpoint });
|
|
17
|
+
} catch (err) {
|
|
18
|
+
if (err instanceof ExternalHostError) throw err;
|
|
19
|
+
logger.debug(`Preset file ${fileName} not found in ${repo}: ${err.message}`);
|
|
20
|
+
throw new Error(PRESET_DEP_NOT_FOUND);
|
|
21
|
+
}
|
|
22
|
+
let contentString;
|
|
23
|
+
if (res.type === "file") contentString = res.contentString;
|
|
24
|
+
else {
|
|
25
|
+
logger.debug(`Preset ${fileName} has unexpected type '${res.type}'. Only \`file\` is supported`);
|
|
26
|
+
throw new Error(PRESET_INVALID);
|
|
27
|
+
}
|
|
28
|
+
return parsePreset(contentString, fileName);
|
|
29
|
+
}
|
|
30
|
+
function getPresetFromEndpoint(repo, filePreset, presetPath, endpoint = defaultEndpoint, tag) {
|
|
31
|
+
return fetchPreset({
|
|
32
|
+
repo,
|
|
33
|
+
filePreset,
|
|
34
|
+
presetPath,
|
|
35
|
+
endpoint,
|
|
36
|
+
tag,
|
|
37
|
+
fetch: fetchJSONFile
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function getPreset({ repo, presetName = "default", presetPath, tag }) {
|
|
41
|
+
return getPresetFromEndpoint(repo, presetName, presetPath, defaultEndpoint, tag);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
fetchJSONFile,
|
|
45
|
+
getPresetFromEndpoint,
|
|
46
|
+
getPreset
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { createPresetSource };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","names":[],"sources":["../../../../lib/config/presets/gitea/common.ts"],"sourcesContent":["import { logger } from '../../../logger/index.ts';\nimport { getRepoContents } from '../../../modules/platform/gitea/gitea-helper.ts';\nimport type { RepoContents } from '../../../modules/platform/gitea/schema.ts';\nimport { ExternalHostError } from '../../../types/errors/external-host-error.ts';\nimport type { Nullish } from '../../../types/index.ts';\nimport type { GiteaHttp } from '../../../util/http/gitea.ts';\nimport type { Preset, PresetConfig } from '../types.ts';\nimport {\n PRESET_DEP_NOT_FOUND,\n PRESET_INVALID,\n fetchPreset,\n parsePreset,\n} from '../util.ts';\n\nexport interface GiteaPresetSource {\n fetchJSONFile: (\n repo: string,\n fileName: string,\n endpoint: string,\n tag?: string | null,\n ) => Promise<Nullish<Preset>>;\n getPresetFromEndpoint: (\n repo: string,\n filePreset: string,\n presetPath?: string,\n endpoint?: string,\n tag?: string,\n ) => Promise<Nullish<Preset>>;\n getPreset: (config: PresetConfig) => Promise<Nullish<Preset>>;\n}\n\n/**\n * Builds the preset source of a platform which speaks the Gitea API.\n *\n * Forgejo is a fork of Gitea and serves the same contents API, so the Gitea\n * and Forgejo sources only differ in their Http client and default endpoint.\n */\nexport function createPresetSource(\n http: GiteaHttp,\n defaultEndpoint: string,\n): GiteaPresetSource {\n async function fetchJSONFile(\n repo: string,\n fileName: string,\n endpoint: string,\n tag?: string | null,\n ): Promise<Nullish<Preset>> {\n let res: RepoContents;\n try {\n res = await getRepoContents(http, repo, fileName, tag, {\n baseUrl: endpoint,\n });\n } catch (err) {\n if (err instanceof ExternalHostError) {\n throw err;\n }\n logger.debug(\n `Preset file ${fileName} not found in ${repo}: ${err.message}`,\n );\n throw new Error(PRESET_DEP_NOT_FOUND);\n }\n\n let contentString: string;\n if (res.type === 'file') {\n contentString = res.contentString;\n } else {\n logger.debug(\n `Preset ${fileName} has unexpected type '${res.type}'. Only \\`file\\` is supported`,\n );\n throw new Error(PRESET_INVALID);\n }\n return parsePreset(contentString, fileName);\n }\n\n function getPresetFromEndpoint(\n repo: string,\n filePreset: string,\n presetPath?: string,\n endpoint = defaultEndpoint,\n tag?: string,\n ): Promise<Nullish<Preset>> {\n return fetchPreset({\n repo,\n filePreset,\n presetPath,\n endpoint,\n tag,\n fetch: fetchJSONFile,\n });\n }\n\n function getPreset({\n repo,\n presetName = 'default',\n presetPath,\n tag,\n }: PresetConfig): Promise<Nullish<Preset>> {\n return getPresetFromEndpoint(\n repo,\n presetName,\n presetPath,\n defaultEndpoint,\n tag,\n );\n }\n\n return { fetchJSONFile, getPresetFromEndpoint, getPreset };\n}\n"],"mappings":";;;;;;;;;;;AAqCA,SAAgB,mBACd,MACA,iBACmB;CACnB,eAAe,cACb,MACA,UACA,UACA,KAC0B;EAC1B,IAAI;EACJ,IAAI;GACF,MAAM,MAAM,gBAAgB,MAAM,MAAM,UAAU,KAAK,EACrD,SAAS,SACX,CAAC;EACH,SAAS,KAAK;GACZ,IAAI,eAAe,mBACjB,MAAM;GAER,OAAO,MACL,eAAe,SAAS,gBAAgB,KAAK,IAAI,IAAI,SACvD;GACA,MAAM,IAAI,MAAM,oBAAoB;EACtC;EAEA,IAAI;EACJ,IAAI,IAAI,SAAS,QACf,gBAAgB,IAAI;OACf;GACL,OAAO,MACL,UAAU,SAAS,wBAAwB,IAAI,KAAK,8BACtD;GACA,MAAM,IAAI,MAAM,cAAc;EAChC;EACA,OAAO,YAAY,eAAe,QAAQ;CAC5C;CAEA,SAAS,sBACP,MACA,YACA,YACA,WAAW,iBACX,KAC0B;EAC1B,OAAO,YAAY;GACjB;GACA;GACA;GACA;GACA;GACA,OAAO;EACT,CAAC;CACH;CAEA,SAAS,UAAU,EACjB,MACA,aAAa,WACb,YACA,OACyC;EACzC,OAAO,sBACL,MACA,YACA,YACA,iBACA,GACF;CACF;CAEA,OAAO;EAAE;EAAe;EAAuB;CAAU;AAC3D"}
|
|
@@ -1,40 +1,8 @@
|
|
|
1
|
-
import { logger } from "../../../logger/index.js";
|
|
2
|
-
import { ExternalHostError } from "../../../types/errors/external-host-error.js";
|
|
3
|
-
import { PRESET_DEP_NOT_FOUND, PRESET_INVALID, fetchPreset, parsePreset } from "../util.js";
|
|
4
|
-
import { getRepoContents } from "../../../modules/platform/gitea/gitea-helper.js";
|
|
5
1
|
import { giteaHttp } from "../../../modules/platform/gitea/index.js";
|
|
2
|
+
import { createPresetSource } from "./common.js";
|
|
6
3
|
//#region lib/config/presets/gitea/index.ts
|
|
7
4
|
const Endpoint = "https://gitea.com/";
|
|
8
|
-
|
|
9
|
-
let res;
|
|
10
|
-
try {
|
|
11
|
-
res = await getRepoContents(giteaHttp, repo, fileName, tag, { baseUrl: endpoint });
|
|
12
|
-
} catch (err) {
|
|
13
|
-
if (err instanceof ExternalHostError) throw err;
|
|
14
|
-
logger.debug(`Preset file ${fileName} not found in ${repo}: ${err.message}`);
|
|
15
|
-
throw new Error(PRESET_DEP_NOT_FOUND);
|
|
16
|
-
}
|
|
17
|
-
let contentString;
|
|
18
|
-
if (res.type === "file") contentString = res.contentString;
|
|
19
|
-
else {
|
|
20
|
-
logger.debug(`Preset ${fileName} has unexpected type '${res.type}'. Only \`file\` is supported`);
|
|
21
|
-
throw new Error(PRESET_INVALID);
|
|
22
|
-
}
|
|
23
|
-
return parsePreset(contentString, fileName);
|
|
24
|
-
}
|
|
25
|
-
function getPresetFromEndpoint(repo, filePreset, presetPath, endpoint = Endpoint, tag) {
|
|
26
|
-
return fetchPreset({
|
|
27
|
-
repo,
|
|
28
|
-
filePreset,
|
|
29
|
-
presetPath,
|
|
30
|
-
endpoint,
|
|
31
|
-
tag,
|
|
32
|
-
fetch: fetchJSONFile
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function getPreset({ repo, presetName = "default", presetPath, tag }) {
|
|
36
|
-
return getPresetFromEndpoint(repo, presetName, presetPath, Endpoint, tag);
|
|
37
|
-
}
|
|
5
|
+
const { fetchJSONFile, getPresetFromEndpoint, getPreset } = createPresetSource(giteaHttp, Endpoint);
|
|
38
6
|
//#endregion
|
|
39
7
|
export { Endpoint, fetchJSONFile, getPreset, getPresetFromEndpoint };
|
|
40
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/config/presets/gitea/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/config/presets/gitea/index.ts"],"sourcesContent":["import { giteaHttp } from '../../../modules/platform/gitea/index.ts';\nimport { createPresetSource } from './common.ts';\n\nexport const Endpoint = 'https://gitea.com/';\n\nexport const { fetchJSONFile, getPresetFromEndpoint, getPreset } =\n createPresetSource(giteaHttp, Endpoint);\n"],"mappings":";;;AAGA,MAAa,WAAW;AAExB,MAAa,EAAE,eAAe,uBAAuB,cACnD,mBAAmB,WAAW,QAAQ"}
|
|
@@ -29,14 +29,14 @@ import { DotnetVersionDatasource } from "./dotnet-version/index.js";
|
|
|
29
29
|
import { ElmPackageDatasource } from "./elm-package/index.js";
|
|
30
30
|
import { EndoflifeDateDatasource } from "./endoflife-date/index.js";
|
|
31
31
|
import { FlutterVersionDatasource } from "./flutter-version/index.js";
|
|
32
|
-
import {
|
|
32
|
+
import { GiteaReleasesDatasource } from "./gitea-releases/index.js";
|
|
33
33
|
import { ForgejoReleasesDatasource } from "./forgejo-releases/index.js";
|
|
34
|
+
import { GiteaTagsDatasource } from "./gitea-tags/index.js";
|
|
35
|
+
import { ForgejoTagsDatasource } from "./forgejo-tags/index.js";
|
|
34
36
|
import { GalaxyDatasource } from "./galaxy/index.js";
|
|
35
37
|
import { GalaxyCollectionDatasource } from "./galaxy-collection/index.js";
|
|
36
38
|
import { GitRefsDatasource } from "./git-refs/index.js";
|
|
37
39
|
import { GitTagsDatasource } from "./git-tags/index.js";
|
|
38
|
-
import { GiteaTagsDatasource } from "./gitea-tags/index.js";
|
|
39
|
-
import { GiteaReleasesDatasource } from "./gitea-releases/index.js";
|
|
40
40
|
import { GithubDigestDatasource } from "./github-digest/index.js";
|
|
41
41
|
import { GithubReleaseAttachmentsDatasource } from "./github-release-attachments/index.js";
|
|
42
42
|
import { GithubReleasesDatasource } from "./github-releases/index.js";
|
|
@@ -1,68 +1,19 @@
|
|
|
1
|
-
import { withCache } from "../../../util/cache/package/with-cache.js";
|
|
2
|
-
import { Datasource } from "../datasource.js";
|
|
3
1
|
import { ForgejoHttp } from "../../../util/http/forgejo.js";
|
|
4
|
-
import {
|
|
5
|
-
import { ForgejoTagsDatasource } from "../forgejo-tags/index.js";
|
|
6
|
-
import { Releases } from "./schema.js";
|
|
2
|
+
import { GiteaReleasesDatasource } from "../gitea-releases/index.js";
|
|
7
3
|
//#region lib/modules/datasource/forgejo-releases/index.ts
|
|
8
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Forgejo is a fork of Gitea and serves the same API, so the lookup is
|
|
6
|
+
* inherited and only the identity of the datasource differs.
|
|
7
|
+
*/
|
|
8
|
+
var ForgejoReleasesDatasource = class ForgejoReleasesDatasource extends GiteaReleasesDatasource {
|
|
9
9
|
static id = "forgejo-releases";
|
|
10
|
-
http = new ForgejoHttp(ForgejoReleasesDatasource.id);
|
|
11
10
|
static defaultRegistryUrls = ["https://code.forgejo.org"];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
sourceUrlSupport = "package";
|
|
16
|
-
sourceUrlNote = "The source URL is determined by using the `packageName` and `registryUrl`.";
|
|
11
|
+
defaultRegistryUrls = ForgejoReleasesDatasource.defaultRegistryUrls;
|
|
12
|
+
cacheNamespace = "datasource-forgejo-releases";
|
|
13
|
+
http = new ForgejoHttp(ForgejoReleasesDatasource.id);
|
|
17
14
|
constructor() {
|
|
18
15
|
super(ForgejoReleasesDatasource.id);
|
|
19
16
|
}
|
|
20
|
-
async _getReleases({ registryUrl, packageName: repo }) {
|
|
21
|
-
const url = `${ForgejoTagsDatasource.getApiUrl(registryUrl)}repos/${repo}/releases?draft=false`;
|
|
22
|
-
const tags = (await this.http.getJson(url, { paginate: true }, Releases)).body;
|
|
23
|
-
return {
|
|
24
|
-
sourceUrl: ForgejoTagsDatasource.getSourceUrl(repo, registryUrl),
|
|
25
|
-
registryUrl: ForgejoTagsDatasource.getRegistryURL(registryUrl),
|
|
26
|
-
releases: tags.map(({ tag_name, published_at, prerelease }) => ({
|
|
27
|
-
version: tag_name,
|
|
28
|
-
gitRef: tag_name,
|
|
29
|
-
releaseTimestamp: published_at,
|
|
30
|
-
isStable: !prerelease
|
|
31
|
-
}))
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
getReleases(config) {
|
|
35
|
-
return withCache({
|
|
36
|
-
namespace: ForgejoReleasesDatasource.cacheNamespace,
|
|
37
|
-
key: ForgejoTagsDatasource.getCacheKey(config.registryUrl, config.packageName, "releases"),
|
|
38
|
-
fallback: true
|
|
39
|
-
}, () => this._getReleases(config));
|
|
40
|
-
}
|
|
41
|
-
async _getTagCommit(registryUrl, repo, tag) {
|
|
42
|
-
const url = `${ForgejoTagsDatasource.getApiUrl(registryUrl)}repos/${repo}/tags/${tag}`;
|
|
43
|
-
const { body } = await this.http.getJson(url, Tag);
|
|
44
|
-
return body.commit.sha;
|
|
45
|
-
}
|
|
46
|
-
getTagCommit(registryUrl, repo, tag) {
|
|
47
|
-
return withCache({
|
|
48
|
-
namespace: ForgejoReleasesDatasource.cacheNamespace,
|
|
49
|
-
key: ForgejoTagsDatasource.getCacheKey(registryUrl, repo, `tag-${tag}`)
|
|
50
|
-
}, () => this._getTagCommit(registryUrl, repo, tag));
|
|
51
|
-
}
|
|
52
|
-
async _getDigest({ packageName: repo, registryUrl }, newValue) {
|
|
53
|
-
if (newValue?.length) return this.getTagCommit(registryUrl, repo, newValue);
|
|
54
|
-
const url = `${ForgejoTagsDatasource.getApiUrl(registryUrl)}repos/${repo}/commits?stat=false&verification=false&files=false&page=1&limit=1`;
|
|
55
|
-
const { body } = await this.http.getJson(url, Commits);
|
|
56
|
-
if (body.length === 0) return null;
|
|
57
|
-
return body[0].sha;
|
|
58
|
-
}
|
|
59
|
-
getDigest(config, newValue) {
|
|
60
|
-
return withCache({
|
|
61
|
-
namespace: ForgejoReleasesDatasource.cacheNamespace,
|
|
62
|
-
key: ForgejoTagsDatasource.getCacheKey(config.registryUrl, config.packageName, "digest"),
|
|
63
|
-
fallback: true
|
|
64
|
-
}, () => this._getDigest(config, newValue));
|
|
65
|
-
}
|
|
66
17
|
};
|
|
67
18
|
//#endregion
|
|
68
19
|
export { ForgejoReleasesDatasource };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/datasource/forgejo-releases/index.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/datasource/forgejo-releases/index.ts"],"sourcesContent":["import type { DatasourceName } from '../../../datasource-list.generated.ts';\nimport type { PackageCacheNamespace } from '../../../util/cache/package/types.ts';\nimport { ForgejoHttp } from '../../../util/http/forgejo.ts';\nimport { GiteaReleasesDatasource } from '../gitea-releases/index.ts';\n\n/**\n * Forgejo is a fork of Gitea and serves the same API, so the lookup is\n * inherited and only the identity of the datasource differs.\n */\nexport class ForgejoReleasesDatasource extends GiteaReleasesDatasource {\n static override readonly id: DatasourceName = 'forgejo-releases';\n\n static override readonly defaultRegistryUrls = ['https://code.forgejo.org'];\n\n override readonly defaultRegistryUrls =\n ForgejoReleasesDatasource.defaultRegistryUrls;\n\n protected override readonly cacheNamespace: PackageCacheNamespace =\n 'datasource-forgejo-releases';\n\n override http = new ForgejoHttp(ForgejoReleasesDatasource.id);\n\n constructor() {\n super(ForgejoReleasesDatasource.id);\n }\n}\n"],"mappings":";;;;;;;AASA,IAAa,4BAAb,MAAa,kCAAkC,wBAAwB;CACrE,OAAyB,KAAqB;CAE9C,OAAyB,sBAAsB,CAAC,0BAA0B;CAE1E,sBACE,0BAA0B;CAE5B,iBACE;CAEF,OAAgB,IAAI,YAAY,0BAA0B,EAAE;CAE5D,cAAc;EACZ,MAAM,0BAA0B,EAAE;CACpC;AACF"}
|
|
@@ -1,82 +1,19 @@
|
|
|
1
|
-
import { regEx } from "../../../util/regex.js";
|
|
2
|
-
import { ensureTrailingSlash } from "../../../util/url.js";
|
|
3
|
-
import { withCache } from "../../../util/cache/package/with-cache.js";
|
|
4
|
-
import { Datasource } from "../datasource.js";
|
|
5
1
|
import { ForgejoHttp } from "../../../util/http/forgejo.js";
|
|
6
|
-
import {
|
|
2
|
+
import { GiteaTagsDatasource } from "../gitea-tags/index.js";
|
|
7
3
|
//#region lib/modules/datasource/forgejo-tags/index.ts
|
|
8
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Forgejo is a fork of Gitea and serves the same API, so the lookup is
|
|
6
|
+
* inherited and only the identity of the datasource differs.
|
|
7
|
+
*/
|
|
8
|
+
var ForgejoTagsDatasource = class ForgejoTagsDatasource extends GiteaTagsDatasource {
|
|
9
9
|
static id = "forgejo-tags";
|
|
10
|
-
http = new ForgejoHttp(ForgejoTagsDatasource.id);
|
|
11
10
|
static defaultRegistryUrls = ["https://code.forgejo.org"];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
sourceUrlSupport = "package";
|
|
16
|
-
sourceUrlNote = "The source URL is determined by using the `packageName` and `registryUrl`.";
|
|
11
|
+
defaultRegistryUrls = ForgejoTagsDatasource.defaultRegistryUrls;
|
|
12
|
+
cacheNamespace = "datasource-forgejo-tags";
|
|
13
|
+
http = new ForgejoHttp(ForgejoTagsDatasource.id);
|
|
17
14
|
constructor() {
|
|
18
15
|
super(ForgejoTagsDatasource.id);
|
|
19
16
|
}
|
|
20
|
-
static getRegistryURL(registryUrl) {
|
|
21
|
-
return registryUrl ?? this.defaultRegistryUrls[0];
|
|
22
|
-
}
|
|
23
|
-
static getApiUrl(registryUrl) {
|
|
24
|
-
const res = ForgejoTagsDatasource.getRegistryURL(registryUrl).replace(regEx(/\/api\/v1$/), "");
|
|
25
|
-
return `${ensureTrailingSlash(res)}api/v1/`;
|
|
26
|
-
}
|
|
27
|
-
static getCacheKey(registryUrl, repo, type) {
|
|
28
|
-
return `${ForgejoTagsDatasource.getRegistryURL(registryUrl)}:${repo}:${type}`;
|
|
29
|
-
}
|
|
30
|
-
static getSourceUrl(packageName, registryUrl) {
|
|
31
|
-
const url = ForgejoTagsDatasource.getRegistryURL(registryUrl);
|
|
32
|
-
return `${ensureTrailingSlash(url)}${packageName}`;
|
|
33
|
-
}
|
|
34
|
-
async _getReleases({ registryUrl, packageName: repo }) {
|
|
35
|
-
const url = `${ForgejoTagsDatasource.getApiUrl(registryUrl)}repos/${repo}/tags`;
|
|
36
|
-
const tags = (await this.http.getJson(url, { paginate: true }, Tags)).body;
|
|
37
|
-
return {
|
|
38
|
-
sourceUrl: ForgejoTagsDatasource.getSourceUrl(repo, registryUrl),
|
|
39
|
-
registryUrl: ForgejoTagsDatasource.getRegistryURL(registryUrl),
|
|
40
|
-
releases: tags.map(({ name, commit }) => ({
|
|
41
|
-
version: name,
|
|
42
|
-
gitRef: name,
|
|
43
|
-
newDigest: commit.sha,
|
|
44
|
-
releaseTimestamp: commit.created
|
|
45
|
-
}))
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
getReleases(config) {
|
|
49
|
-
return withCache({
|
|
50
|
-
namespace: ForgejoTagsDatasource.cacheNamespace,
|
|
51
|
-
key: ForgejoTagsDatasource.getCacheKey(config.registryUrl, config.packageName, "tags"),
|
|
52
|
-
fallback: true
|
|
53
|
-
}, () => this._getReleases(config));
|
|
54
|
-
}
|
|
55
|
-
async _getTagCommit(registryUrl, repo, tag) {
|
|
56
|
-
const url = `${ForgejoTagsDatasource.getApiUrl(registryUrl)}repos/${repo}/tags/${tag}`;
|
|
57
|
-
const { body } = await this.http.getJson(url, Tag);
|
|
58
|
-
return body.commit.sha;
|
|
59
|
-
}
|
|
60
|
-
getTagCommit(registryUrl, repo, tag) {
|
|
61
|
-
return withCache({
|
|
62
|
-
namespace: ForgejoTagsDatasource.cacheNamespace,
|
|
63
|
-
key: ForgejoTagsDatasource.getCacheKey(registryUrl, repo, `tag-${tag}`)
|
|
64
|
-
}, () => this._getTagCommit(registryUrl, repo, tag));
|
|
65
|
-
}
|
|
66
|
-
async _getDigest({ packageName: repo, registryUrl }, newValue) {
|
|
67
|
-
if (newValue?.length) return this.getTagCommit(registryUrl, repo, newValue);
|
|
68
|
-
const url = `${ForgejoTagsDatasource.getApiUrl(registryUrl)}repos/${repo}/commits?stat=false&verification=false&files=false&page=1&limit=1`;
|
|
69
|
-
const { body } = await this.http.getJson(url, Commits);
|
|
70
|
-
if (body.length === 0) return null;
|
|
71
|
-
return body[0].sha;
|
|
72
|
-
}
|
|
73
|
-
getDigest(config, newValue) {
|
|
74
|
-
return withCache({
|
|
75
|
-
namespace: ForgejoTagsDatasource.cacheNamespace,
|
|
76
|
-
key: ForgejoTagsDatasource.getCacheKey(config.registryUrl, config.packageName, "digest"),
|
|
77
|
-
fallback: true
|
|
78
|
-
}, () => this._getDigest(config, newValue));
|
|
79
|
-
}
|
|
80
17
|
};
|
|
81
18
|
//#endregion
|
|
82
19
|
export { ForgejoTagsDatasource };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/datasource/forgejo-tags/index.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/datasource/forgejo-tags/index.ts"],"sourcesContent":["import type { DatasourceName } from '../../../datasource-list.generated.ts';\nimport type { PackageCacheNamespace } from '../../../util/cache/package/types.ts';\nimport { ForgejoHttp } from '../../../util/http/forgejo.ts';\nimport { GiteaTagsDatasource } from '../gitea-tags/index.ts';\n\n/**\n * Forgejo is a fork of Gitea and serves the same API, so the lookup is\n * inherited and only the identity of the datasource differs.\n */\nexport class ForgejoTagsDatasource extends GiteaTagsDatasource {\n static override readonly id: DatasourceName = 'forgejo-tags';\n\n static override readonly defaultRegistryUrls = ['https://code.forgejo.org'];\n\n override readonly defaultRegistryUrls =\n ForgejoTagsDatasource.defaultRegistryUrls;\n\n protected override readonly cacheNamespace: PackageCacheNamespace =\n 'datasource-forgejo-tags';\n\n override http = new ForgejoHttp(ForgejoTagsDatasource.id);\n\n constructor() {\n super(ForgejoTagsDatasource.id);\n }\n}\n"],"mappings":";;;;;;;AASA,IAAa,wBAAb,MAAa,8BAA8B,oBAAoB;CAC7D,OAAyB,KAAqB;CAE9C,OAAyB,sBAAsB,CAAC,0BAA0B;CAE1E,sBACE,sBAAsB;CAExB,iBACE;CAEF,OAAgB,IAAI,YAAY,sBAAsB,EAAE;CAExD,cAAc;EACZ,MAAM,sBAAsB,EAAE;CAChC;AACF"}
|
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { GiteaHttp } from "../../../util/http/gitea.js";
|
|
4
|
-
import { Commits, Tag } from "../gitea-tags/schema.js";
|
|
5
|
-
import { GiteaTagsDatasource } from "../gitea-tags/index.js";
|
|
1
|
+
import { getApiUrl, getSourceUrl } from "../gitea-tags/util.js";
|
|
2
|
+
import { GiteaDatasource } from "../gitea-tags/base.js";
|
|
6
3
|
import { Releases } from "./schema.js";
|
|
7
4
|
//#region lib/modules/datasource/gitea-releases/index.ts
|
|
8
|
-
var GiteaReleasesDatasource = class GiteaReleasesDatasource extends
|
|
5
|
+
var GiteaReleasesDatasource = class GiteaReleasesDatasource extends GiteaDatasource {
|
|
9
6
|
static id = "gitea-releases";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
super(GiteaReleasesDatasource.id);
|
|
7
|
+
defaultRegistryUrls = GiteaReleasesDatasource.defaultRegistryUrls;
|
|
8
|
+
cacheNamespace = "datasource-gitea-releases";
|
|
9
|
+
/** Subclasses for other Gitea-compatible hosts pass their own id. */
|
|
10
|
+
constructor(id = GiteaReleasesDatasource.id) {
|
|
11
|
+
super(id, {
|
|
12
|
+
cacheKeyType: "releases",
|
|
13
|
+
releaseTimestampField: "published_at"
|
|
14
|
+
});
|
|
19
15
|
}
|
|
20
|
-
async _getReleases(
|
|
21
|
-
const url = `${
|
|
22
|
-
const
|
|
16
|
+
async _getReleases(registryUrl, repo) {
|
|
17
|
+
const url = `${getApiUrl(registryUrl)}repos/${repo}/releases?draft=false`;
|
|
18
|
+
const releases = (await this.http.getJson(url, { paginate: true }, Releases)).body;
|
|
23
19
|
return {
|
|
24
|
-
sourceUrl:
|
|
25
|
-
registryUrl
|
|
26
|
-
releases:
|
|
20
|
+
sourceUrl: getSourceUrl(repo, registryUrl),
|
|
21
|
+
registryUrl,
|
|
22
|
+
releases: releases.map(({ tag_name, published_at, prerelease }) => ({
|
|
27
23
|
version: tag_name,
|
|
28
24
|
gitRef: tag_name,
|
|
29
25
|
releaseTimestamp: published_at,
|
|
@@ -31,38 +27,6 @@ var GiteaReleasesDatasource = class GiteaReleasesDatasource extends Datasource {
|
|
|
31
27
|
}))
|
|
32
28
|
};
|
|
33
29
|
}
|
|
34
|
-
getReleases(config) {
|
|
35
|
-
return withCache({
|
|
36
|
-
namespace: GiteaReleasesDatasource.cacheNamespace,
|
|
37
|
-
key: GiteaTagsDatasource.getCacheKey(config.registryUrl, config.packageName, "releases"),
|
|
38
|
-
fallback: true
|
|
39
|
-
}, () => this._getReleases(config));
|
|
40
|
-
}
|
|
41
|
-
async _getTagCommit(registryUrl, repo, tag) {
|
|
42
|
-
const url = `${GiteaTagsDatasource.getApiUrl(registryUrl)}repos/${repo}/tags/${tag}`;
|
|
43
|
-
const { body } = await this.http.getJson(url, Tag);
|
|
44
|
-
return body.commit.sha;
|
|
45
|
-
}
|
|
46
|
-
getTagCommit(registryUrl, repo, tag) {
|
|
47
|
-
return withCache({
|
|
48
|
-
namespace: GiteaReleasesDatasource.cacheNamespace,
|
|
49
|
-
key: GiteaTagsDatasource.getCacheKey(registryUrl, repo, `tag-${tag}`)
|
|
50
|
-
}, () => this._getTagCommit(registryUrl, repo, tag));
|
|
51
|
-
}
|
|
52
|
-
async _getDigest({ packageName: repo, registryUrl }, newValue) {
|
|
53
|
-
if (newValue?.length) return this.getTagCommit(registryUrl, repo, newValue);
|
|
54
|
-
const url = `${GiteaTagsDatasource.getApiUrl(registryUrl)}repos/${repo}/commits?stat=false&verification=false&files=false&page=1&limit=1`;
|
|
55
|
-
const { body } = await this.http.getJson(url, Commits);
|
|
56
|
-
if (body.length === 0) return null;
|
|
57
|
-
return body[0].sha;
|
|
58
|
-
}
|
|
59
|
-
getDigest(config, newValue) {
|
|
60
|
-
return withCache({
|
|
61
|
-
namespace: GiteaReleasesDatasource.cacheNamespace,
|
|
62
|
-
key: GiteaTagsDatasource.getCacheKey(config.registryUrl, config.packageName, "digest"),
|
|
63
|
-
fallback: true
|
|
64
|
-
}, () => this._getDigest(config, newValue));
|
|
65
|
-
}
|
|
66
30
|
};
|
|
67
31
|
//#endregion
|
|
68
32
|
export { GiteaReleasesDatasource };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/datasource/gitea-releases/index.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/modules/datasource/gitea-releases/index.ts"],"sourcesContent":["import type { DatasourceName } from '../../../datasource-list.generated.ts';\nimport type { PackageCacheNamespace } from '../../../util/cache/package/types.ts';\nimport { GiteaDatasource } from '../gitea-tags/base.ts';\nimport { getApiUrl, getSourceUrl } from '../gitea-tags/util.ts';\nimport type { ReleaseResult } from '../types.ts';\nimport { Releases } from './schema.ts';\n\nexport class GiteaReleasesDatasource extends GiteaDatasource {\n static readonly id: DatasourceName = 'gitea-releases';\n\n override readonly defaultRegistryUrls =\n GiteaReleasesDatasource.defaultRegistryUrls;\n\n protected readonly cacheNamespace: PackageCacheNamespace =\n 'datasource-gitea-releases';\n\n /** Subclasses for other Gitea-compatible hosts pass their own id. */\n constructor(id: string = GiteaReleasesDatasource.id) {\n super(id, {\n cacheKeyType: 'releases',\n releaseTimestampField: 'published_at',\n });\n }\n\n // _getReleases fetches list of releases for the repository\n protected async _getReleases(\n registryUrl: string,\n repo: string,\n ): Promise<ReleaseResult | null> {\n const url = `${getApiUrl(registryUrl)}repos/${repo}/releases?draft=false`;\n const releases = (\n await this.http.getJson(\n url,\n {\n paginate: true,\n },\n Releases,\n )\n ).body;\n\n const dependency: ReleaseResult = {\n sourceUrl: getSourceUrl(repo, registryUrl),\n registryUrl,\n releases: releases.map(({ tag_name, published_at, prerelease }) => ({\n version: tag_name,\n gitRef: tag_name,\n releaseTimestamp: published_at,\n isStable: !prerelease,\n })),\n };\n\n return dependency;\n }\n}\n"],"mappings":";;;;AAOA,IAAa,0BAAb,MAAa,gCAAgC,gBAAgB;CAC3D,OAAgB,KAAqB;CAErC,sBACE,wBAAwB;CAE1B,iBACE;;CAGF,YAAY,KAAa,wBAAwB,IAAI;EACnD,MAAM,IAAI;GACR,cAAc;GACd,uBAAuB;EACzB,CAAC;CACH;CAGA,MAAgB,aACd,aACA,MAC+B;EAC/B,MAAM,MAAM,GAAG,UAAU,WAAW,EAAE,QAAQ,KAAK;EACnD,MAAM,YACJ,MAAM,KAAK,KAAK,QACd,KACA,EACE,UAAU,KACZ,GACA,QACF,EAAA,CACA;EAaF,OAAO;GAVL,WAAW,aAAa,MAAM,WAAW;GACzC;GACA,UAAU,SAAS,KAAK,EAAE,UAAU,cAAc,kBAAkB;IAClE,SAAS;IACT,QAAQ;IACR,kBAAkB;IAClB,UAAU,CAAC;GACb,EAAE;EAGY;CAClB;AACF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { parseUrl } from "../../../util/url.js";
|
|
2
|
+
import { withCache } from "../../../util/cache/package/with-cache.js";
|
|
3
|
+
import { Datasource } from "../datasource.js";
|
|
4
|
+
import { GiteaHttp } from "../../../util/http/gitea.js";
|
|
5
|
+
import { Commits, Tag } from "./schema.js";
|
|
6
|
+
import { getApiUrl, getCacheKey, getSourceUrl } from "./util.js";
|
|
7
|
+
//#region lib/modules/datasource/gitea-tags/base.ts
|
|
8
|
+
/**
|
|
9
|
+
* Shared implementation of the datasources which speak the Gitea API.
|
|
10
|
+
*
|
|
11
|
+
* Forgejo is a fork of Gitea and serves the same API, so the Forgejo
|
|
12
|
+
* datasources extend the Gitea ones and only differ in their id, their default
|
|
13
|
+
* registry URL and their cache namespace. The digest lookup and the caching of
|
|
14
|
+
* `getReleases()` are the same for tags and releases, so they live here and a
|
|
15
|
+
* subclass only fetches and maps the releases of its own endpoint.
|
|
16
|
+
*/
|
|
17
|
+
var GiteaDatasource = class extends Datasource {
|
|
18
|
+
static defaultRegistryUrls = ["https://gitea.com"];
|
|
19
|
+
http = new GiteaHttp(this.id);
|
|
20
|
+
releaseTimestampSupport = true;
|
|
21
|
+
releaseTimestampNote;
|
|
22
|
+
sourceUrlSupport = "package";
|
|
23
|
+
sourceUrlNote = "The source URL is determined by using the `packageName` and `registryUrl`.";
|
|
24
|
+
/** Discriminates the cache keys of the two endpoints. */
|
|
25
|
+
cacheKeyType;
|
|
26
|
+
/**
|
|
27
|
+
* @param endpoint describes the endpoint `getReleases()` reads: the
|
|
28
|
+
* discriminator of its cache keys, and the field the release timestamp comes
|
|
29
|
+
* from, which is rendered into the generated documentation.
|
|
30
|
+
*/
|
|
31
|
+
constructor(id, endpoint) {
|
|
32
|
+
super(id);
|
|
33
|
+
this.cacheKeyType = endpoint.cacheKeyType;
|
|
34
|
+
this.releaseTimestampNote = `The release timestamp is determined from the \`${endpoint.releaseTimestampField}\` field in the results.`;
|
|
35
|
+
}
|
|
36
|
+
static getSourceUrl(packageName, registryUrl) {
|
|
37
|
+
return getSourceUrl(packageName, registryUrl ?? this.defaultRegistryUrls[0]);
|
|
38
|
+
}
|
|
39
|
+
/** Falls back to the default registry URL when none is configured. */
|
|
40
|
+
getRegistryUrl(registryUrl) {
|
|
41
|
+
return registryUrl ?? this.defaultRegistryUrls[0];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Only results from the public default instance may be written to the
|
|
45
|
+
* shared package cache; a self-hosted instance may serve private
|
|
46
|
+
* repositories.
|
|
47
|
+
*/
|
|
48
|
+
isPublicRegistry(registryUrl) {
|
|
49
|
+
return parseUrl(registryUrl)?.hostname === parseUrl(this.defaultRegistryUrls[0])?.hostname;
|
|
50
|
+
}
|
|
51
|
+
getReleases({ registryUrl, packageName: repo }) {
|
|
52
|
+
const resolvedUrl = this.getRegistryUrl(registryUrl);
|
|
53
|
+
return withCache({
|
|
54
|
+
namespace: this.cacheNamespace,
|
|
55
|
+
key: getCacheKey(resolvedUrl, repo, this.cacheKeyType),
|
|
56
|
+
fallback: true,
|
|
57
|
+
cacheable: this.isPublicRegistry(resolvedUrl)
|
|
58
|
+
}, () => this._getReleases(resolvedUrl, repo));
|
|
59
|
+
}
|
|
60
|
+
async _getTagCommit(registryUrl, repo, tag) {
|
|
61
|
+
const url = `${getApiUrl(registryUrl)}repos/${repo}/tags/${tag}`;
|
|
62
|
+
const { body } = await this.http.getJson(url, Tag);
|
|
63
|
+
return body.commit.sha;
|
|
64
|
+
}
|
|
65
|
+
getTagCommit(registryUrl, repo, tag) {
|
|
66
|
+
const resolvedUrl = this.getRegistryUrl(registryUrl);
|
|
67
|
+
return withCache({
|
|
68
|
+
namespace: this.cacheNamespace,
|
|
69
|
+
key: getCacheKey(resolvedUrl, repo, `tag-${tag}`),
|
|
70
|
+
cacheable: this.isPublicRegistry(resolvedUrl)
|
|
71
|
+
}, () => this._getTagCommit(resolvedUrl, repo, tag));
|
|
72
|
+
}
|
|
73
|
+
async _getDigest(registryUrl, repo, newValue) {
|
|
74
|
+
if (newValue?.length) return this.getTagCommit(registryUrl, repo, newValue);
|
|
75
|
+
const url = `${getApiUrl(registryUrl)}repos/${repo}/commits?stat=false&verification=false&files=false&page=1&limit=1`;
|
|
76
|
+
const { body } = await this.http.getJson(url, Commits);
|
|
77
|
+
if (body.length === 0) return null;
|
|
78
|
+
return body[0].sha;
|
|
79
|
+
}
|
|
80
|
+
getDigest({ packageName: repo, registryUrl }, newValue) {
|
|
81
|
+
const resolvedUrl = this.getRegistryUrl(registryUrl);
|
|
82
|
+
return withCache({
|
|
83
|
+
namespace: this.cacheNamespace,
|
|
84
|
+
key: getCacheKey(resolvedUrl, repo, "digest"),
|
|
85
|
+
fallback: true,
|
|
86
|
+
cacheable: this.isPublicRegistry(resolvedUrl)
|
|
87
|
+
}, () => this._getDigest(resolvedUrl, repo, newValue));
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
//#endregion
|
|
91
|
+
export { GiteaDatasource };
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=base.js.map
|