renovate 39.236.2 → 39.237.0
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/constants/platforms.js +5 -1
- package/dist/constants/platforms.js.map +1 -1
- package/dist/modules/datasource/api.js +2 -0
- package/dist/modules/datasource/api.js.map +1 -1
- package/dist/modules/datasource/bitbucket-server-tags/index.d.ts +19 -0
- package/dist/modules/datasource/bitbucket-server-tags/index.js +133 -0
- package/dist/modules/datasource/bitbucket-server-tags/index.js.map +1 -0
- package/dist/modules/datasource/bitbucket-server-tags/schema.d.ts +28 -0
- package/dist/modules/datasource/bitbucket-server-tags/schema.js +13 -0
- package/dist/modules/datasource/bitbucket-server-tags/schema.js.map +1 -0
- package/dist/modules/datasource/custom/schema.d.ts +3 -3
- package/dist/modules/platform/bitbucket-server/schema.d.ts +1 -0
- package/dist/modules/platform/bitbucket-server/schema.js +2 -1
- package/dist/modules/platform/bitbucket-server/schema.js.map +1 -1
- package/dist/util/cache/package/types.d.ts +1 -1
- package/dist/util/cache/package/types.js.map +1 -1
- package/dist/util/http/bitbucket-server.d.ts +2 -1
- package/dist/util/http/bitbucket-server.js +5 -3
- package/dist/util/http/bitbucket-server.js.map +1 -1
- package/dist/util/http/host-rules.js +12 -0
- package/dist/util/http/host-rules.js.map +1 -1
- package/dist/workers/repository/update/pr/body/index.js +14 -10
- package/dist/workers/repository/update/pr/body/index.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/api.js +8 -6
- package/dist/workers/repository/update/pr/changelog/api.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/bitbucket-server/index.d.ts +3 -0
- package/dist/workers/repository/update/pr/changelog/bitbucket-server/index.js +39 -0
- package/dist/workers/repository/update/pr/changelog/bitbucket-server/index.js.map +1 -0
- package/dist/workers/repository/update/pr/changelog/bitbucket-server/source.d.ts +8 -0
- package/dist/workers/repository/update/pr/changelog/bitbucket-server/source.js +31 -0
- package/dist/workers/repository/update/pr/changelog/bitbucket-server/source.js.map +1 -0
- package/dist/workers/repository/update/pr/changelog/release-notes.js +12 -8
- package/dist/workers/repository/update/pr/changelog/release-notes.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/source.d.ts +1 -1
- package/dist/workers/repository/update/pr/changelog/source.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/types.d.ts +1 -1
- package/dist/workers/repository/update/pr/changelog/types.js.map +1 -1
- package/package.json +1 -1
@@ -41,5 +41,9 @@ exports.BITBUCKET_API_USING_HOST_TYPES = [
|
|
41
41
|
'bitbucket-changelog',
|
42
42
|
'bitbucket-tags',
|
43
43
|
];
|
44
|
-
exports.BITBUCKET_SERVER_API_USING_HOST_TYPES = [
|
44
|
+
exports.BITBUCKET_SERVER_API_USING_HOST_TYPES = [
|
45
|
+
'bitbucket-server',
|
46
|
+
'bitbucket-server-changelog',
|
47
|
+
'bitbucket-server-tags',
|
48
|
+
];
|
45
49
|
//# sourceMappingURL=platforms.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"platforms.js","sourceRoot":"","sources":["../../lib/constants/platforms.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG;IACjC,OAAO;IACP,WAAW;IACX,kBAAkB;IAClB,YAAY;IACZ,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,OAAO;CACC,CAAC;AAIE,QAAA,0BAA0B,GAAG;IACxC,OAAO;IACP,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;CACb,CAAC;AAEW,QAAA,2BAA2B,GAAG;IACzC,QAAQ;IACR,iBAAiB;IACjB,4BAA4B;IAC5B,aAAa;IACb,KAAK;IACL,QAAQ;IACR,kBAAkB;IAClB,OAAO;CACR,CAAC;AAEW,QAAA,2BAA2B,GAAG;IACzC,QAAQ;IACR,iBAAiB;IACjB,aAAa;IACb,iBAAiB;IACjB,kBAAkB;IAClB,MAAM;CACP,CAAC;AAEW,QAAA,8BAA8B,GAAG;IAC5C,WAAW;IACX,qBAAqB;IACrB,gBAAgB;CACjB,CAAC;AAEW,QAAA,qCAAqC,GAAG,
|
1
|
+
{"version":3,"file":"platforms.js","sourceRoot":"","sources":["../../lib/constants/platforms.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG;IACjC,OAAO;IACP,WAAW;IACX,kBAAkB;IAClB,YAAY;IACZ,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,OAAO;CACC,CAAC;AAIE,QAAA,0BAA0B,GAAG;IACxC,OAAO;IACP,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;CACb,CAAC;AAEW,QAAA,2BAA2B,GAAG;IACzC,QAAQ;IACR,iBAAiB;IACjB,4BAA4B;IAC5B,aAAa;IACb,KAAK;IACL,QAAQ;IACR,kBAAkB;IAClB,OAAO;CACR,CAAC;AAEW,QAAA,2BAA2B,GAAG;IACzC,QAAQ;IACR,iBAAiB;IACjB,aAAa;IACb,iBAAiB;IACjB,kBAAkB;IAClB,MAAM;CACP,CAAC;AAEW,QAAA,8BAA8B,GAAG;IAC5C,WAAW;IACX,qBAAqB;IACrB,gBAAgB;CACjB,CAAC;AAEW,QAAA,qCAAqC,GAAG;IACnD,kBAAkB;IAClB,4BAA4B;IAC5B,uBAAuB;CACxB,CAAC","sourcesContent":["export const PLATFORM_HOST_TYPES = [\n 'azure',\n 'bitbucket',\n 'bitbucket-server',\n 'codecommit',\n 'gerrit',\n 'gitea',\n 'github',\n 'gitlab',\n 'local',\n] as const;\n\nexport type PlatformId = (typeof PLATFORM_HOST_TYPES)[number];\n\nexport const GITEA_API_USING_HOST_TYPES = [\n 'gitea',\n 'gitea-changelog',\n 'gitea-releases',\n 'gitea-tags',\n];\n\nexport const GITHUB_API_USING_HOST_TYPES = [\n 'github',\n 'github-releases',\n 'github-release-attachments',\n 'github-tags',\n 'pod',\n 'hermit',\n 'github-changelog',\n 'conan',\n];\n\nexport const GITLAB_API_USING_HOST_TYPES = [\n 'gitlab',\n 'gitlab-releases',\n 'gitlab-tags',\n 'gitlab-packages',\n 'gitlab-changelog',\n 'pypi',\n];\n\nexport const BITBUCKET_API_USING_HOST_TYPES = [\n 'bitbucket',\n 'bitbucket-changelog',\n 'bitbucket-tags',\n];\n\nexport const BITBUCKET_SERVER_API_USING_HOST_TYPES = [\n 'bitbucket-server',\n 'bitbucket-server-changelog',\n 'bitbucket-server-tags',\n];\n"]}
|
@@ -7,6 +7,7 @@ const aws_rds_1 = require("./aws-rds");
|
|
7
7
|
const azure_bicep_resource_1 = require("./azure-bicep-resource");
|
8
8
|
const azure_pipelines_tasks_1 = require("./azure-pipelines-tasks");
|
9
9
|
const bazel_1 = require("./bazel");
|
10
|
+
const bitbucket_server_tags_1 = require("./bitbucket-server-tags");
|
10
11
|
const bitbucket_tags_1 = require("./bitbucket-tags");
|
11
12
|
const bitrise_1 = require("./bitrise");
|
12
13
|
const buildpacks_registry_1 = require("./buildpacks-registry");
|
@@ -78,6 +79,7 @@ api.set(aws_rds_1.AwsRdsDatasource.id, new aws_rds_1.AwsRdsDatasource());
|
|
78
79
|
api.set(azure_bicep_resource_1.AzureBicepResourceDatasource.id, new azure_bicep_resource_1.AzureBicepResourceDatasource());
|
79
80
|
api.set(azure_pipelines_tasks_1.AzurePipelinesTasksDatasource.id, new azure_pipelines_tasks_1.AzurePipelinesTasksDatasource());
|
80
81
|
api.set(bazel_1.BazelDatasource.id, new bazel_1.BazelDatasource());
|
82
|
+
api.set(bitbucket_server_tags_1.BitbucketServerTagsDatasource.id, new bitbucket_server_tags_1.BitbucketServerTagsDatasource());
|
81
83
|
api.set(bitbucket_tags_1.BitbucketTagsDatasource.id, new bitbucket_tags_1.BitbucketTagsDatasource());
|
82
84
|
api.set(bitrise_1.BitriseDatasource.id, new bitrise_1.BitriseDatasource());
|
83
85
|
api.set(buildpacks_registry_1.BuildpacksRegistryDatasource.id, new buildpacks_registry_1.BuildpacksRegistryDatasource());
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"api.js","s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C,+BAAmB,CAAC,EAAE,EAAE,IAAI,+BAAmB,EAAE,CAAC,CAAC;AAC3D,GAAG,CAAC,GAAG,CAAC,mBAAa,CAAC,EAAE,EAAE,IAAI,mBAAa,EAAE,CAAC,CAAC;AAC/C,GAAG,CAAC,GAAG,CAAC,oCAAqB,CAAC,EAAE,EAAE,IAAI,oCAAqB,EAAE,CAAC,CAAC;AAC/D,GAAG,CAAC,GAAG,CAAC,qBAAc,CAAC,EAAE,EAAE,IAAI,qBAAc,EAAE,CAAC,CAAC;AACjD,GAAG,CAAC,GAAG,CAAC,wCAAuB,CAAC,EAAE,EAAE,IAAI,wCAAuB,EAAE,CAAC,CAAC;AACnE,GAAG,CAAC,GAAG,CAAC,6BAAkB,CAAC,EAAE,EAAE,IAAI,6BAAkB,EAAE,CAAC,CAAC;AACzD,GAAG,CAAC,GAAG,CAAC,oCAAqB,CAAC,EAAE,EAAE,IAAI,oCAAqB,EAAE,CAAC,CAAC;AAC/D,GAAG,CAAC,GAAG,CAAC,6BAAkB,CAAC,EAAE,EAAE,IAAI,6BAAkB,EAAE,CAAC,CAAC;AACzD,GAAG,CAAC,GAAG,CAAC,kCAAoB,CAAC,EAAE,EAAE,IAAI,kCAAoB,EAAE,CAAC,CAAC;AAC7D,GAAG,CAAC,GAAG,CAAC,gCAAmB,CAAC,EAAE,EAAE,IAAI,gCAAmB,EAAE,CAAC,CAAC;AAC3D,GAAG,CAAC,GAAG,CAAC,4CAAyB,CAAC,EAAE,EAAE,IAAI,4CAAyB,EAAE,CAAC,CAAC;AACvE,GAAG,CAAC,GAAG,CAAC,gDAA2B,CAAC,EAAE,EAAE,IAAI,gDAA2B,EAAE,CAAC,CAAC;AAC3E,GAAG,CAAC,GAAG,CAAC,2BAAiB,CAAC,EAAE,EAAE,IAAI,2BAAiB,EAAE,CAAC,CAAC","sourcesContent":["import { ArtifactoryDatasource } from './artifactory';\nimport { AwsEKSAddonDataSource } from './aws-eks-addon';\nimport { AwsMachineImageDatasource } from './aws-machine-image';\nimport { AwsRdsDatasource } from './aws-rds';\nimport { AzureBicepResourceDatasource } from './azure-bicep-resource';\nimport { AzurePipelinesTasksDatasource } from './azure-pipelines-tasks';\nimport { BazelDatasource } from './bazel';\nimport { BitbucketTagsDatasource } from './bitbucket-tags';\nimport { BitriseDatasource } from './bitrise';\nimport { BuildpacksRegistryDatasource } from './buildpacks-registry';\nimport { CdnjsDatasource } from './cdnjs';\nimport { ClojureDatasource } from './clojure';\nimport { ConanDatasource } from './conan';\nimport { CondaDatasource } from './conda';\nimport { CpanDatasource } from './cpan';\nimport { CrateDatasource } from './crate';\nimport { CustomDatasource } from './custom';\nimport { DartDatasource } from './dart';\nimport { DartVersionDatasource } from './dart-version';\nimport { DebDatasource } from './deb';\nimport { DenoDatasource } from './deno';\nimport { DevboxDatasource } from './devbox';\nimport { DockerDatasource } from './docker';\nimport { DotnetVersionDatasource } from './dotnet-version';\nimport { EndoflifeDateDatasource } from './endoflife-date';\nimport { FlutterVersionDatasource } from './flutter-version';\nimport { GalaxyDatasource } from './galaxy';\nimport { GalaxyCollectionDatasource } from './galaxy-collection';\nimport { GitRefsDatasource } from './git-refs';\nimport { GitTagsDatasource } from './git-tags';\nimport { GiteaReleasesDatasource } from './gitea-releases';\nimport { GiteaTagsDatasource } from './gitea-tags';\nimport { GithubReleaseAttachmentsDatasource } from './github-release-attachments';\nimport { GithubReleasesDatasource } from './github-releases';\nimport { GithubRunnersDatasource } from './github-runners';\nimport { GithubTagsDatasource } from './github-tags';\nimport { GitlabPackagesDatasource } from './gitlab-packages';\nimport { GitlabReleasesDatasource } from './gitlab-releases';\nimport { GitlabTagsDatasource } from './gitlab-tags';\nimport { GlasskubePackagesDatasource } from './glasskube-packages';\nimport { GoDatasource } from './go';\nimport { GolangVersionDatasource } from './golang-version';\nimport { GradleVersionDatasource } from './gradle-version';\nimport { HackageDatasource } from './hackage';\nimport { HelmDatasource } from './helm';\nimport { HermitDatasource } from './hermit';\nimport { HexDatasource } from './hex';\nimport { HexpmBobDatasource } from './hexpm-bob';\nimport { JavaVersionDatasource } from './java-version';\nimport { JenkinsPluginsDatasource } from './jenkins-plugins';\nimport { KubernetesApiDatasource } from './kubernetes-api';\nimport { MavenDatasource } from './maven';\nimport { NodeVersionDatasource } from './node-version';\nimport { NpmDatasource } from './npm';\nimport { NugetDatasource } from './nuget';\nimport { OrbDatasource } from './orb';\nimport { PackagistDatasource } from './packagist';\nimport { PodDatasource } from './pod';\nimport { PuppetForgeDatasource } from './puppet-forge';\nimport { PypiDatasource } from './pypi';\nimport { PythonVersionDatasource } from './python-version';\nimport { RepologyDatasource } from './repology';\nimport { RubyVersionDatasource } from './ruby-version';\nimport { RubygemsDatasource } from './rubygems';\nimport { SbtPackageDatasource } from './sbt-package';\nimport { SbtPluginDatasource } from './sbt-plugin';\nimport { TerraformModuleDatasource } from './terraform-module';\nimport { TerraformProviderDatasource } from './terraform-provider';\nimport type { DatasourceApi } from './types';\nimport { Unity3dDatasource } from './unity3d';\n\nconst api = new Map<string, DatasourceApi>();\nexport default api;\n\napi.set(ArtifactoryDatasource.id, new ArtifactoryDatasource());\napi.set(AwsEKSAddonDataSource.id, new AwsEKSAddonDataSource());\napi.set(AwsMachineImageDatasource.id, new AwsMachineImageDatasource());\napi.set(AwsRdsDatasource.id, new AwsRdsDatasource());\napi.set(AzureBicepResourceDatasource.id, new AzureBicepResourceDatasource());\napi.set(AzurePipelinesTasksDatasource.id, new AzurePipelinesTasksDatasource());\napi.set(BazelDatasource.id, new BazelDatasource());\napi.set(BitbucketTagsDatasource.id, new BitbucketTagsDatasource());\napi.set(BitriseDatasource.id, new BitriseDatasource());\napi.set(BuildpacksRegistryDatasource.id, new BuildpacksRegistryDatasource());\napi.set(CdnjsDatasource.id, new CdnjsDatasource());\napi.set(ClojureDatasource.id, new ClojureDatasource());\napi.set(ConanDatasource.id, new ConanDatasource());\napi.set(CondaDatasource.id, new CondaDatasource());\napi.set(CpanDatasource.id, new CpanDatasource());\napi.set(CrateDatasource.id, new CrateDatasource());\napi.set(CustomDatasource.id, new CustomDatasource());\napi.set(DartDatasource.id, new DartDatasource());\napi.set(DartVersionDatasource.id, new DartVersionDatasource());\napi.set(DebDatasource.id, new DebDatasource());\napi.set(DenoDatasource.id, new DenoDatasource());\napi.set(DevboxDatasource.id, new DevboxDatasource());\napi.set(DockerDatasource.id, new DockerDatasource());\napi.set(DotnetVersionDatasource.id, new DotnetVersionDatasource());\napi.set(EndoflifeDateDatasource.id, new EndoflifeDateDatasource());\napi.set(FlutterVersionDatasource.id, new FlutterVersionDatasource());\napi.set(GalaxyDatasource.id, new GalaxyDatasource());\napi.set(GalaxyCollectionDatasource.id, new GalaxyCollectionDatasource());\napi.set(GitRefsDatasource.id, new GitRefsDatasource());\napi.set(GitTagsDatasource.id, new GitTagsDatasource());\napi.set(GiteaReleasesDatasource.id, new GiteaReleasesDatasource());\napi.set(GiteaTagsDatasource.id, new GiteaTagsDatasource());\napi.set(\n GithubReleaseAttachmentsDatasource.id,\n new GithubReleaseAttachmentsDatasource(),\n);\napi.set(GithubReleasesDatasource.id, new GithubReleasesDatasource());\napi.set(GithubRunnersDatasource.id, new GithubRunnersDatasource());\napi.set(GithubTagsDatasource.id, new GithubTagsDatasource());\napi.set(GitlabPackagesDatasource.id, new GitlabPackagesDatasource());\napi.set(GitlabReleasesDatasource.id, new GitlabReleasesDatasource());\napi.set(GitlabTagsDatasource.id, new GitlabTagsDatasource());\napi.set(GlasskubePackagesDatasource.id, new GlasskubePackagesDatasource());\napi.set(GoDatasource.id, new GoDatasource());\napi.set(GolangVersionDatasource.id, new GolangVersionDatasource());\napi.set(GradleVersionDatasource.id, new GradleVersionDatasource());\napi.set(HackageDatasource.id, new HackageDatasource());\napi.set(HelmDatasource.id, new HelmDatasource());\napi.set(HermitDatasource.id, new HermitDatasource());\napi.set(HexDatasource.id, new HexDatasource());\napi.set(HexpmBobDatasource.id, new HexpmBobDatasource());\napi.set(JavaVersionDatasource.id, new JavaVersionDatasource());\napi.set(JenkinsPluginsDatasource.id, new JenkinsPluginsDatasource());\napi.set(KubernetesApiDatasource.id, new KubernetesApiDatasource());\napi.set(MavenDatasource.id, new MavenDatasource());\napi.set(NodeVersionDatasource.id, new NodeVersionDatasource());\napi.set(NpmDatasource.id, new NpmDatasource());\napi.set(NugetDatasource.id, new NugetDatasource());\napi.set(OrbDatasource.id, new OrbDatasource());\napi.set(PackagistDatasource.id, new PackagistDatasource());\napi.set(PodDatasource.id, new PodDatasource());\napi.set(PuppetForgeDatasource.id, new PuppetForgeDatasource());\napi.set(PypiDatasource.id, new PypiDatasource());\napi.set(PythonVersionDatasource.id, new PythonVersionDatasource());\napi.set(RepologyDatasource.id, new RepologyDatasource());\napi.set(RubyVersionDatasource.id, new RubyVersionDatasource());\napi.set(RubygemsDatasource.id, new RubygemsDatasource());\napi.set(SbtPackageDatasource.id, new SbtPackageDatasource());\napi.set(SbtPluginDatasource.id, new SbtPluginDatasource());\napi.set(TerraformModuleDatasource.id, new TerraformModuleDatasource());\napi.set(TerraformProviderDatasource.id, new TerraformProviderDatasource());\napi.set(Unity3dDatasource.id, new Unity3dDatasource());\n"]}
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../lib/modules/datasource/api.ts"],"names":[],"mappings":";;AAAA,+CAAsD;AACtD,mDAAwD;AACxD,2DAAgE;AAChE,uCAA6C;AAC7C,iEAAsE;AACtE,mEAAwE;AACxE,mCAA0C;AAC1C,mEAAwE;AACxE,qDAA2D;AAC3D,uCAA8C;AAC9C,+DAAqE;AACrE,mCAA0C;AAC1C,uCAA8C;AAC9C,mCAA0C;AAC1C,mCAA0C;AAC1C,iCAAwC;AACxC,mCAA0C;AAC1C,qCAA4C;AAC5C,iCAAwC;AACxC,iDAAuD;AACvD,+BAAsC;AACtC,iCAAwC;AACxC,qCAA4C;AAC5C,qCAA4C;AAC5C,qDAA2D;AAC3D,qDAA2D;AAC3D,uDAA6D;AAC7D,qCAA4C;AAC5C,2DAAiE;AACjE,yCAA+C;AA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E,CAAC,CAAC;AACnE,GAAG,CAAC,GAAG,CAAC,6BAAkB,CAAC,EAAE,EAAE,IAAI,6BAAkB,EAAE,CAAC,CAAC;AACzD,GAAG,CAAC,GAAG,CAAC,oCAAqB,CAAC,EAAE,EAAE,IAAI,oCAAqB,EAAE,CAAC,CAAC;AAC/D,GAAG,CAAC,GAAG,CAAC,6BAAkB,CAAC,EAAE,EAAE,IAAI,6BAAkB,EAAE,CAAC,CAAC;AACzD,GAAG,CAAC,GAAG,CAAC,kCAAoB,CAAC,EAAE,EAAE,IAAI,kCAAoB,EAAE,CAAC,CAAC;AAC7D,GAAG,CAAC,GAAG,CAAC,gCAAmB,CAAC,EAAE,EAAE,IAAI,gCAAmB,EAAE,CAAC,CAAC;AAC3D,GAAG,CAAC,GAAG,CAAC,4CAAyB,CAAC,EAAE,EAAE,IAAI,4CAAyB,EAAE,CAAC,CAAC;AACvE,GAAG,CAAC,GAAG,CAAC,gDAA2B,CAAC,EAAE,EAAE,IAAI,gDAA2B,EAAE,CAAC,CAAC;AAC3E,GAAG,CAAC,GAAG,CAAC,2BAAiB,CAAC,EAAE,EAAE,IAAI,2BAAiB,EAAE,CAAC,CAAC","sourcesContent":["import { ArtifactoryDatasource } from './artifactory';\nimport { AwsEKSAddonDataSource } from './aws-eks-addon';\nimport { AwsMachineImageDatasource } from './aws-machine-image';\nimport { AwsRdsDatasource } from './aws-rds';\nimport { AzureBicepResourceDatasource } from './azure-bicep-resource';\nimport { AzurePipelinesTasksDatasource } from './azure-pipelines-tasks';\nimport { BazelDatasource } from './bazel';\nimport { BitbucketServerTagsDatasource } from './bitbucket-server-tags';\nimport { BitbucketTagsDatasource } from './bitbucket-tags';\nimport { BitriseDatasource } from './bitrise';\nimport { BuildpacksRegistryDatasource } from './buildpacks-registry';\nimport { CdnjsDatasource } from './cdnjs';\nimport { ClojureDatasource } from './clojure';\nimport { ConanDatasource } from './conan';\nimport { CondaDatasource } from './conda';\nimport { CpanDatasource } from './cpan';\nimport { CrateDatasource } from './crate';\nimport { CustomDatasource } from './custom';\nimport { DartDatasource } from './dart';\nimport { DartVersionDatasource } from './dart-version';\nimport { DebDatasource } from './deb';\nimport { DenoDatasource } from './deno';\nimport { DevboxDatasource } from './devbox';\nimport { DockerDatasource } from './docker';\nimport { DotnetVersionDatasource } from './dotnet-version';\nimport { EndoflifeDateDatasource } from './endoflife-date';\nimport { FlutterVersionDatasource } from './flutter-version';\nimport { GalaxyDatasource } from './galaxy';\nimport { GalaxyCollectionDatasource } from './galaxy-collection';\nimport { GitRefsDatasource } from './git-refs';\nimport { GitTagsDatasource } from './git-tags';\nimport { GiteaReleasesDatasource } from './gitea-releases';\nimport { GiteaTagsDatasource } from './gitea-tags';\nimport { GithubReleaseAttachmentsDatasource } from './github-release-attachments';\nimport { GithubReleasesDatasource } from './github-releases';\nimport { GithubRunnersDatasource } from './github-runners';\nimport { GithubTagsDatasource } from './github-tags';\nimport { GitlabPackagesDatasource } from './gitlab-packages';\nimport { GitlabReleasesDatasource } from './gitlab-releases';\nimport { GitlabTagsDatasource } from './gitlab-tags';\nimport { GlasskubePackagesDatasource } from './glasskube-packages';\nimport { GoDatasource } from './go';\nimport { GolangVersionDatasource } from './golang-version';\nimport { GradleVersionDatasource } from './gradle-version';\nimport { HackageDatasource } from './hackage';\nimport { HelmDatasource } from './helm';\nimport { HermitDatasource } from './hermit';\nimport { HexDatasource } from './hex';\nimport { HexpmBobDatasource } from './hexpm-bob';\nimport { JavaVersionDatasource } from './java-version';\nimport { JenkinsPluginsDatasource } from './jenkins-plugins';\nimport { KubernetesApiDatasource } from './kubernetes-api';\nimport { MavenDatasource } from './maven';\nimport { NodeVersionDatasource } from './node-version';\nimport { NpmDatasource } from './npm';\nimport { NugetDatasource } from './nuget';\nimport { OrbDatasource } from './orb';\nimport { PackagistDatasource } from './packagist';\nimport { PodDatasource } from './pod';\nimport { PuppetForgeDatasource } from './puppet-forge';\nimport { PypiDatasource } from './pypi';\nimport { PythonVersionDatasource } from './python-version';\nimport { RepologyDatasource } from './repology';\nimport { RubyVersionDatasource } from './ruby-version';\nimport { RubygemsDatasource } from './rubygems';\nimport { SbtPackageDatasource } from './sbt-package';\nimport { SbtPluginDatasource } from './sbt-plugin';\nimport { TerraformModuleDatasource } from './terraform-module';\nimport { TerraformProviderDatasource } from './terraform-provider';\nimport type { DatasourceApi } from './types';\nimport { Unity3dDatasource } from './unity3d';\n\nconst api = new Map<string, DatasourceApi>();\nexport default api;\n\napi.set(ArtifactoryDatasource.id, new ArtifactoryDatasource());\napi.set(AwsEKSAddonDataSource.id, new AwsEKSAddonDataSource());\napi.set(AwsMachineImageDatasource.id, new AwsMachineImageDatasource());\napi.set(AwsRdsDatasource.id, new AwsRdsDatasource());\napi.set(AzureBicepResourceDatasource.id, new AzureBicepResourceDatasource());\napi.set(AzurePipelinesTasksDatasource.id, new AzurePipelinesTasksDatasource());\napi.set(BazelDatasource.id, new BazelDatasource());\napi.set(BitbucketServerTagsDatasource.id, new BitbucketServerTagsDatasource());\napi.set(BitbucketTagsDatasource.id, new BitbucketTagsDatasource());\napi.set(BitriseDatasource.id, new BitriseDatasource());\napi.set(BuildpacksRegistryDatasource.id, new BuildpacksRegistryDatasource());\napi.set(CdnjsDatasource.id, new CdnjsDatasource());\napi.set(ClojureDatasource.id, new ClojureDatasource());\napi.set(ConanDatasource.id, new ConanDatasource());\napi.set(CondaDatasource.id, new CondaDatasource());\napi.set(CpanDatasource.id, new CpanDatasource());\napi.set(CrateDatasource.id, new CrateDatasource());\napi.set(CustomDatasource.id, new CustomDatasource());\napi.set(DartDatasource.id, new DartDatasource());\napi.set(DartVersionDatasource.id, new DartVersionDatasource());\napi.set(DebDatasource.id, new DebDatasource());\napi.set(DenoDatasource.id, new DenoDatasource());\napi.set(DevboxDatasource.id, new DevboxDatasource());\napi.set(DockerDatasource.id, new DockerDatasource());\napi.set(DotnetVersionDatasource.id, new DotnetVersionDatasource());\napi.set(EndoflifeDateDatasource.id, new EndoflifeDateDatasource());\napi.set(FlutterVersionDatasource.id, new FlutterVersionDatasource());\napi.set(GalaxyDatasource.id, new GalaxyDatasource());\napi.set(GalaxyCollectionDatasource.id, new GalaxyCollectionDatasource());\napi.set(GitRefsDatasource.id, new GitRefsDatasource());\napi.set(GitTagsDatasource.id, new GitTagsDatasource());\napi.set(GiteaReleasesDatasource.id, new GiteaReleasesDatasource());\napi.set(GiteaTagsDatasource.id, new GiteaTagsDatasource());\napi.set(\n GithubReleaseAttachmentsDatasource.id,\n new GithubReleaseAttachmentsDatasource(),\n);\napi.set(GithubReleasesDatasource.id, new GithubReleasesDatasource());\napi.set(GithubRunnersDatasource.id, new GithubRunnersDatasource());\napi.set(GithubTagsDatasource.id, new GithubTagsDatasource());\napi.set(GitlabPackagesDatasource.id, new GitlabPackagesDatasource());\napi.set(GitlabReleasesDatasource.id, new GitlabReleasesDatasource());\napi.set(GitlabTagsDatasource.id, new GitlabTagsDatasource());\napi.set(GlasskubePackagesDatasource.id, new GlasskubePackagesDatasource());\napi.set(GoDatasource.id, new GoDatasource());\napi.set(GolangVersionDatasource.id, new GolangVersionDatasource());\napi.set(GradleVersionDatasource.id, new GradleVersionDatasource());\napi.set(HackageDatasource.id, new HackageDatasource());\napi.set(HelmDatasource.id, new HelmDatasource());\napi.set(HermitDatasource.id, new HermitDatasource());\napi.set(HexDatasource.id, new HexDatasource());\napi.set(HexpmBobDatasource.id, new HexpmBobDatasource());\napi.set(JavaVersionDatasource.id, new JavaVersionDatasource());\napi.set(JenkinsPluginsDatasource.id, new JenkinsPluginsDatasource());\napi.set(KubernetesApiDatasource.id, new KubernetesApiDatasource());\napi.set(MavenDatasource.id, new MavenDatasource());\napi.set(NodeVersionDatasource.id, new NodeVersionDatasource());\napi.set(NpmDatasource.id, new NpmDatasource());\napi.set(NugetDatasource.id, new NugetDatasource());\napi.set(OrbDatasource.id, new OrbDatasource());\napi.set(PackagistDatasource.id, new PackagistDatasource());\napi.set(PodDatasource.id, new PodDatasource());\napi.set(PuppetForgeDatasource.id, new PuppetForgeDatasource());\napi.set(PypiDatasource.id, new PypiDatasource());\napi.set(PythonVersionDatasource.id, new PythonVersionDatasource());\napi.set(RepologyDatasource.id, new RepologyDatasource());\napi.set(RubyVersionDatasource.id, new RubyVersionDatasource());\napi.set(RubygemsDatasource.id, new RubygemsDatasource());\napi.set(SbtPackageDatasource.id, new SbtPackageDatasource());\napi.set(SbtPluginDatasource.id, new SbtPluginDatasource());\napi.set(TerraformModuleDatasource.id, new TerraformModuleDatasource());\napi.set(TerraformProviderDatasource.id, new TerraformProviderDatasource());\napi.set(Unity3dDatasource.id, new Unity3dDatasource());\n"]}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import type { PackageCacheNamespace } from '../../../util/cache/package/types';
|
2
|
+
import { BitbucketServerHttp } from '../../../util/http/bitbucket-server';
|
3
|
+
import { Datasource } from '../datasource';
|
4
|
+
import type { DigestConfig, GetReleasesConfig, ReleaseResult } from '../types';
|
5
|
+
export declare class BitbucketServerTagsDatasource extends Datasource {
|
6
|
+
static readonly id = "bitbucket-server-tags";
|
7
|
+
http: BitbucketServerHttp;
|
8
|
+
static readonly sourceUrlSupport = "package";
|
9
|
+
static readonly sourceUrlNote = "The source URL is determined by using the `packageName` and `registryUrl`.";
|
10
|
+
static readonly cacheNamespace: PackageCacheNamespace;
|
11
|
+
constructor();
|
12
|
+
static getRegistryURL(registryUrl: string): string;
|
13
|
+
static getSourceUrl(projectKey: string, repositorySlug: string, registryUrl: string): string;
|
14
|
+
static getApiUrl(registryUrl: string): string;
|
15
|
+
static getCacheKey(registryUrl: string | undefined, repo: string, type: string): string;
|
16
|
+
getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null>;
|
17
|
+
getTagCommit(baseUrl: string, tag: string): Promise<string | null>;
|
18
|
+
getDigest(config: DigestConfig, newValue?: string): Promise<string | null>;
|
19
|
+
}
|
@@ -0,0 +1,133 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.BitbucketServerTagsDatasource = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const zod_1 = require("zod");
|
6
|
+
const logger_1 = require("../../../logger");
|
7
|
+
const decorator_1 = require("../../../util/cache/package/decorator");
|
8
|
+
const bitbucket_server_1 = require("../../../util/http/bitbucket-server");
|
9
|
+
const regex_1 = require("../../../util/regex");
|
10
|
+
const result_1 = require("../../../util/result");
|
11
|
+
const url_1 = require("../../../util/url");
|
12
|
+
const datasource_1 = require("../datasource");
|
13
|
+
const schema_1 = require("../schema");
|
14
|
+
const schema_2 = require("./schema");
|
15
|
+
class BitbucketServerTagsDatasource extends datasource_1.Datasource {
|
16
|
+
static id = 'bitbucket-server-tags';
|
17
|
+
http = new bitbucket_server_1.BitbucketServerHttp(BitbucketServerTagsDatasource.id);
|
18
|
+
static sourceUrlSupport = 'package';
|
19
|
+
static sourceUrlNote = 'The source URL is determined by using the `packageName` and `registryUrl`.';
|
20
|
+
static cacheNamespace = `datasource-${BitbucketServerTagsDatasource.id}`;
|
21
|
+
constructor() {
|
22
|
+
super(BitbucketServerTagsDatasource.id);
|
23
|
+
}
|
24
|
+
static getRegistryURL(registryUrl) {
|
25
|
+
return registryUrl?.replace((0, regex_1.regEx)(/\/rest\/api\/1.0$/), '');
|
26
|
+
}
|
27
|
+
static getSourceUrl(projectKey, repositorySlug, registryUrl) {
|
28
|
+
const url = BitbucketServerTagsDatasource.getRegistryURL(registryUrl);
|
29
|
+
return `${(0, url_1.ensureTrailingSlash)(url)}projects/${projectKey}/repos/${repositorySlug}`;
|
30
|
+
}
|
31
|
+
static getApiUrl(registryUrl) {
|
32
|
+
const res = BitbucketServerTagsDatasource.getRegistryURL(registryUrl);
|
33
|
+
return `${(0, url_1.ensureTrailingSlash)(res)}rest/api/1.0/`;
|
34
|
+
}
|
35
|
+
static getCacheKey(registryUrl, repo, type) {
|
36
|
+
return `${BitbucketServerTagsDatasource.getRegistryURL(registryUrl ?? '')}:${repo}:${type}`;
|
37
|
+
}
|
38
|
+
// getReleases fetches list of tags for the repository
|
39
|
+
async getReleases(config) {
|
40
|
+
const { registryUrl, packageName } = config;
|
41
|
+
const [projectKey, repositorySlug] = packageName.split('/');
|
42
|
+
if (!registryUrl) {
|
43
|
+
logger_1.logger.debug('Missing registryUrl');
|
44
|
+
return null;
|
45
|
+
}
|
46
|
+
const result = result_1.Result.parse(config, schema_1.ReleasesConfig)
|
47
|
+
.transform(({ registryUrl }) => {
|
48
|
+
const url = `${BitbucketServerTagsDatasource.getApiUrl(registryUrl)}projects/${projectKey}/repos/${repositorySlug}/tags`;
|
49
|
+
return this.http.getJsonSafe(url, { paginate: true }, schema_2.BitbucketServerTags);
|
50
|
+
})
|
51
|
+
.transform((tags) => tags.map(({ displayId, hash }) => ({
|
52
|
+
version: displayId,
|
53
|
+
gitRef: displayId,
|
54
|
+
newDigest: hash ?? undefined,
|
55
|
+
})))
|
56
|
+
.transform((versions) => {
|
57
|
+
return {
|
58
|
+
sourceUrl: BitbucketServerTagsDatasource.getSourceUrl(projectKey, repositorySlug, registryUrl),
|
59
|
+
registryUrl: BitbucketServerTagsDatasource.getRegistryURL(registryUrl),
|
60
|
+
releases: versions,
|
61
|
+
};
|
62
|
+
});
|
63
|
+
const { val, err } = await result.unwrap();
|
64
|
+
if (err instanceof zod_1.ZodError) {
|
65
|
+
logger_1.logger.debug({ err }, 'bitbucket-server-tags: validation error');
|
66
|
+
return null;
|
67
|
+
}
|
68
|
+
if (err) {
|
69
|
+
this.handleGenericErrors(err);
|
70
|
+
}
|
71
|
+
return val;
|
72
|
+
}
|
73
|
+
// getTagCommit fetches the commit hash for the specified tag
|
74
|
+
async getTagCommit(baseUrl, tag) {
|
75
|
+
const bitbucketServerTag = (await this.http.getJson(`${baseUrl}/tags/${tag}`, schema_2.BitbucketServerTag)).body;
|
76
|
+
return bitbucketServerTag.hash ?? null;
|
77
|
+
}
|
78
|
+
// getDigest fetches the latest commit for repository main branch.
|
79
|
+
// If newValue is provided, then getTagCommit is called
|
80
|
+
async getDigest(config, newValue) {
|
81
|
+
const { registryUrl, packageName } = config;
|
82
|
+
const [projectKey, repositorySlug] = packageName.split('/');
|
83
|
+
if (!registryUrl) {
|
84
|
+
logger_1.logger.debug('Missing registryUrl');
|
85
|
+
return null;
|
86
|
+
}
|
87
|
+
const baseUrl = `${BitbucketServerTagsDatasource.getApiUrl(registryUrl)}projects/${projectKey}/repos/${repositorySlug}`;
|
88
|
+
if (newValue?.length) {
|
89
|
+
return this.getTagCommit(baseUrl, newValue);
|
90
|
+
}
|
91
|
+
const result = result_1.Result.parse(config, schema_1.DigestsConfig)
|
92
|
+
.transform(() => {
|
93
|
+
const url = `${baseUrl}/commits?ignoreMissing=true`;
|
94
|
+
return this.http.getJsonSafe(url, {
|
95
|
+
paginate: true,
|
96
|
+
limit: 1,
|
97
|
+
maxPages: 1,
|
98
|
+
}, schema_2.BitbucketServerCommits);
|
99
|
+
})
|
100
|
+
.transform((commits) => {
|
101
|
+
return commits[0]?.id;
|
102
|
+
});
|
103
|
+
const { val = null, err } = await result.unwrap();
|
104
|
+
if (err instanceof zod_1.ZodError) {
|
105
|
+
logger_1.logger.debug({ err }, 'bitbucket-server-tags: validation error');
|
106
|
+
return null;
|
107
|
+
}
|
108
|
+
if (err) {
|
109
|
+
this.handleGenericErrors(err);
|
110
|
+
}
|
111
|
+
return val;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
exports.BitbucketServerTagsDatasource = BitbucketServerTagsDatasource;
|
115
|
+
tslib_1.__decorate([
|
116
|
+
(0, decorator_1.cache)({
|
117
|
+
namespace: BitbucketServerTagsDatasource.cacheNamespace,
|
118
|
+
key: ({ registryUrl, packageName }) => BitbucketServerTagsDatasource.getCacheKey(registryUrl, packageName, 'tags'),
|
119
|
+
})
|
120
|
+
], BitbucketServerTagsDatasource.prototype, "getReleases", null);
|
121
|
+
tslib_1.__decorate([
|
122
|
+
(0, decorator_1.cache)({
|
123
|
+
namespace: BitbucketServerTagsDatasource.cacheNamespace,
|
124
|
+
key: ({ registryUrl, packageName }, tag) => BitbucketServerTagsDatasource.getCacheKey(registryUrl, packageName, `tag-${tag}`),
|
125
|
+
})
|
126
|
+
], BitbucketServerTagsDatasource.prototype, "getTagCommit", null);
|
127
|
+
tslib_1.__decorate([
|
128
|
+
(0, decorator_1.cache)({
|
129
|
+
namespace: BitbucketServerTagsDatasource.cacheNamespace,
|
130
|
+
key: ({ registryUrl, packageName }) => BitbucketServerTagsDatasource.getCacheKey(registryUrl, packageName, 'digest'),
|
131
|
+
})
|
132
|
+
], BitbucketServerTagsDatasource.prototype, "getDigest", null);
|
133
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/modules/datasource/bitbucket-server-tags/index.ts"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAC/B,4CAAyC;AACzC,qEAA8D;AAE9D,0EAA0E;AAC1E,+CAA4C;AAC5C,iDAA8C;AAC9C,2CAAwD;AACxD,8CAA2C;AAC3C,sCAA0D;AAE1D,qCAIkB;AAElB,MAAa,6BAA8B,SAAQ,uBAAU;IAC3D,MAAM,CAAU,EAAE,GAAG,uBAAuB,CAAC;IAEpC,IAAI,GAAG,IAAI,sCAAmB,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC;IAE1E,MAAM,CAAU,gBAAgB,GAAG,SAAS,CAAC;IAC7C,MAAM,CAAU,aAAa,GAC3B,4EAA4E,CAAC;IAE/E,MAAM,CAAU,cAAc,GAA0B,cAAc,6BAA6B,CAAC,EAAE,EAAE,CAAC;IAEzG;QACE,KAAK,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,WAAmB;QACvC,OAAO,WAAW,EAAE,OAAO,CAAC,IAAA,aAAK,EAAC,mBAAmB,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,CAAC,YAAY,CACjB,UAAk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,IAAI,GAAG,EAAE,CAAC;YACR,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;;AAlLH,sEAmLC;AAhIO;IATL,IAAA,iBAAK,EAAC;QACL,SAAS,EAAE,6BAA6B,CAAC,cAAc;QACvD,GAAG,EAAE,CAAC,EAAE,WAAW,EAAE,WAAW,EAAqB,EAAE,EAAE,CACvD,6BAA6B,CAAC,WAAW,CACvC,WAAW,EACX,WAAW,EACX,MAAM,CACP;KACJ,CAAC;gEAkDD;AAYK;IATL,IAAA,iBAAK,EAAC;QACL,SAAS,EAAE,6BAA6B,CAAC,cAAc;QACvD,GAAG,EAAE,CAAC,EAAE,WAAW,EAAE,WAAW,EAAgB,EAAE,GAAW,EAAE,EAAE,CAC/D,6BAA6B,CAAC,WAAW,CACvC,WAAW,EACX,WAAW,EACX,OAAO,GAAG,EAAE,CACb;KACJ,CAAC;iEAOD;AAac;IATd,IAAA,iBAAK,EAAC;QACL,SAAS,EAAE,6BAA6B,CAAC,cAAc;QACvD,GAAG,EAAE,CAAC,EAAE,WAAW,EAAE,WAAW,EAAgB,EAAE,EAAE,CAClD,6BAA6B,CAAC,WAAW,CACvC,WAAW,EACX,WAAW,EACX,QAAQ,CACT;KACJ,CAAC;8DAgDD","sourcesContent":["import { ZodError } from 'zod';\nimport { logger } from '../../../logger';\nimport { cache } from '../../../util/cache/package/decorator';\nimport type { PackageCacheNamespace } from '../../../util/cache/package/types';\nimport { BitbucketServerHttp } from '../../../util/http/bitbucket-server';\nimport { regEx } from '../../../util/regex';\nimport { Result } from '../../../util/result';\nimport { ensureTrailingSlash } from '../../../util/url';\nimport { Datasource } from '../datasource';\nimport { DigestsConfig, ReleasesConfig } from '../schema';\nimport type { DigestConfig, GetReleasesConfig, ReleaseResult } from '../types';\nimport {\n BitbucketServerCommits,\n BitbucketServerTag,\n BitbucketServerTags,\n} from './schema';\n\nexport class BitbucketServerTagsDatasource extends Datasource {\n static readonly id = 'bitbucket-server-tags';\n\n override http = new BitbucketServerHttp(BitbucketServerTagsDatasource.id);\n\n static readonly sourceUrlSupport = 'package';\n static readonly sourceUrlNote =\n 'The source URL is determined by using the `packageName` and `registryUrl`.';\n\n static readonly cacheNamespace: PackageCacheNamespace = `datasource-${BitbucketServerTagsDatasource.id}`;\n\n constructor() {\n super(BitbucketServerTagsDatasource.id);\n }\n\n static getRegistryURL(registryUrl: string): string {\n return registryUrl?.replace(regEx(/\\/rest\\/api\\/1.0$/), '');\n }\n\n static getSourceUrl(\n projectKey: string,\n repositorySlug: string,\n registryUrl: string,\n ): string {\n const url = BitbucketServerTagsDatasource.getRegistryURL(registryUrl);\n return `${ensureTrailingSlash(url)}projects/${projectKey}/repos/${repositorySlug}`;\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 static getCacheKey(\n registryUrl: string | undefined,\n repo: string,\n type: string,\n ): string {\n return `${BitbucketServerTagsDatasource.getRegistryURL(registryUrl ?? '')}:${repo}:${type}`;\n }\n\n // getReleases fetches list of tags for the repository\n @cache({\n namespace: BitbucketServerTagsDatasource.cacheNamespace,\n key: ({ registryUrl, packageName }: GetReleasesConfig) =>\n BitbucketServerTagsDatasource.getCacheKey(\n registryUrl,\n packageName,\n 'tags',\n ),\n })\n async getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> {\n const { registryUrl, packageName } = config;\n const [projectKey, repositorySlug] = packageName.split('/');\n if (!registryUrl) {\n logger.debug('Missing registryUrl');\n return null;\n }\n\n const result = Result.parse(config, ReleasesConfig)\n .transform(({ registryUrl }) => {\n const url = `${BitbucketServerTagsDatasource.getApiUrl(registryUrl)}projects/${projectKey}/repos/${repositorySlug}/tags`;\n\n return this.http.getJsonSafe(\n url,\n { paginate: true },\n BitbucketServerTags,\n );\n })\n .transform((tags) =>\n tags.map(({ displayId, hash }) => ({\n version: displayId,\n gitRef: displayId,\n newDigest: hash ?? undefined,\n })),\n )\n .transform((versions): ReleaseResult => {\n return {\n sourceUrl: BitbucketServerTagsDatasource.getSourceUrl(\n projectKey,\n repositorySlug,\n registryUrl,\n ),\n registryUrl:\n BitbucketServerTagsDatasource.getRegistryURL(registryUrl),\n releases: versions,\n };\n });\n const { val, err } = await result.unwrap();\n\n if (err instanceof ZodError) {\n logger.debug({ err }, 'bitbucket-server-tags: validation error');\n return null;\n }\n\n if (err) {\n this.handleGenericErrors(err);\n }\n\n return val;\n }\n\n // getTagCommit fetches the commit hash for the specified tag\n @cache({\n namespace: BitbucketServerTagsDatasource.cacheNamespace,\n key: ({ registryUrl, packageName }: DigestConfig, tag: string) =>\n BitbucketServerTagsDatasource.getCacheKey(\n registryUrl,\n packageName,\n `tag-${tag}`,\n ),\n })\n async getTagCommit(baseUrl: string, tag: string): Promise<string | null> {\n const bitbucketServerTag = (\n await this.http.getJson(`${baseUrl}/tags/${tag}`, BitbucketServerTag)\n ).body;\n\n return bitbucketServerTag.hash ?? null;\n }\n\n // getDigest fetches the latest commit for repository main branch.\n // If newValue is provided, then getTagCommit is called\n @cache({\n namespace: BitbucketServerTagsDatasource.cacheNamespace,\n key: ({ registryUrl, packageName }: DigestConfig) =>\n BitbucketServerTagsDatasource.getCacheKey(\n registryUrl,\n packageName,\n 'digest',\n ),\n })\n override async getDigest(\n config: DigestConfig,\n newValue?: string,\n ): Promise<string | null> {\n const { registryUrl, packageName } = config;\n const [projectKey, repositorySlug] = packageName.split('/');\n if (!registryUrl) {\n logger.debug('Missing registryUrl');\n return null;\n }\n\n const baseUrl = `${BitbucketServerTagsDatasource.getApiUrl(registryUrl)}projects/${projectKey}/repos/${repositorySlug}`;\n\n if (newValue?.length) {\n return this.getTagCommit(baseUrl, newValue);\n }\n\n const result = Result.parse(config, DigestsConfig)\n .transform(() => {\n const url = `${baseUrl}/commits?ignoreMissing=true`;\n\n return this.http.getJsonSafe(\n url,\n {\n paginate: true,\n limit: 1,\n maxPages: 1,\n },\n BitbucketServerCommits,\n );\n })\n .transform((commits) => {\n return commits[0]?.id;\n });\n\n const { val = null, err } = await result.unwrap();\n\n if (err instanceof ZodError) {\n logger.debug({ err }, 'bitbucket-server-tags: validation error');\n return null;\n }\n\n if (err) {\n this.handleGenericErrors(err);\n }\n\n return val;\n }\n}\n"]}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
export declare const BitbucketServerTag: z.ZodObject<{
|
3
|
+
displayId: z.ZodString;
|
4
|
+
hash: z.ZodNullable<z.ZodString>;
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
6
|
+
displayId: string;
|
7
|
+
hash: string | null;
|
8
|
+
}, {
|
9
|
+
displayId: string;
|
10
|
+
hash: string | null;
|
11
|
+
}>;
|
12
|
+
export declare const BitbucketServerTags: z.ZodArray<z.ZodObject<{
|
13
|
+
displayId: z.ZodString;
|
14
|
+
hash: z.ZodNullable<z.ZodString>;
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
16
|
+
displayId: string;
|
17
|
+
hash: string | null;
|
18
|
+
}, {
|
19
|
+
displayId: string;
|
20
|
+
hash: string | null;
|
21
|
+
}>, "many">;
|
22
|
+
export declare const BitbucketServerCommits: z.ZodArray<z.ZodObject<{
|
23
|
+
id: z.ZodString;
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
25
|
+
id: string;
|
26
|
+
}, {
|
27
|
+
id: string;
|
28
|
+
}>, "many">;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.BitbucketServerCommits = exports.BitbucketServerTags = exports.BitbucketServerTag = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
exports.BitbucketServerTag = zod_1.z.object({
|
6
|
+
displayId: zod_1.z.string(),
|
7
|
+
hash: zod_1.z.string().nullable(),
|
8
|
+
});
|
9
|
+
exports.BitbucketServerTags = zod_1.z.array(exports.BitbucketServerTag);
|
10
|
+
exports.BitbucketServerCommits = zod_1.z.array(zod_1.z.object({
|
11
|
+
id: zod_1.z.string(),
|
12
|
+
}));
|
13
|
+
//# sourceMappingURL=schema.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../lib/modules/datasource/bitbucket-server-tags/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,OAAC,CAAC,KAAK,CAAC,0BAAkB,CAAC,CAAC;AAElD,QAAA,sBAAsB,GAAG,OAAC,CAAC,KAAK,CAC3C,OAAC,CAAC,MAAM,CAAC;IACP,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;CACf,CAAC,CACH,CAAC","sourcesContent":["import { z } from 'zod';\n\nexport const BitbucketServerTag = z.object({\n displayId: z.string(),\n hash: z.string().nullable(),\n});\n\nexport const BitbucketServerTags = z.array(BitbucketServerTag);\n\nexport const BitbucketServerCommits = z.array(\n z.object({\n id: z.string(),\n }),\n);\n"]}
|
@@ -23,8 +23,8 @@ export declare const ReleaseResultZodSchema: z.ZodObject<{
|
|
23
23
|
digest?: string | undefined;
|
24
24
|
changelogUrl?: string | undefined;
|
25
25
|
sourceUrl?: string | undefined;
|
26
|
-
releaseTimestamp?: unknown;
|
27
26
|
sourceDirectory?: string | undefined;
|
27
|
+
releaseTimestamp?: unknown;
|
28
28
|
isStable?: boolean | undefined;
|
29
29
|
isDeprecated?: boolean | undefined;
|
30
30
|
}>, {
|
@@ -42,8 +42,8 @@ export declare const ReleaseResultZodSchema: z.ZodObject<{
|
|
42
42
|
digest?: string | undefined;
|
43
43
|
changelogUrl?: string | undefined;
|
44
44
|
sourceUrl?: string | undefined;
|
45
|
-
releaseTimestamp?: unknown;
|
46
45
|
sourceDirectory?: string | undefined;
|
46
|
+
releaseTimestamp?: unknown;
|
47
47
|
isStable?: boolean | undefined;
|
48
48
|
isDeprecated?: boolean | undefined;
|
49
49
|
}>, "many">;
|
@@ -75,8 +75,8 @@ export declare const ReleaseResultZodSchema: z.ZodObject<{
|
|
75
75
|
digest?: string | undefined;
|
76
76
|
changelogUrl?: string | undefined;
|
77
77
|
sourceUrl?: string | undefined;
|
78
|
-
releaseTimestamp?: unknown;
|
79
78
|
sourceDirectory?: string | undefined;
|
79
|
+
releaseTimestamp?: unknown;
|
80
80
|
isStable?: boolean | undefined;
|
81
81
|
isDeprecated?: boolean | undefined;
|
82
82
|
}[];
|
@@ -1,11 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.PullRequestActivity = exports.PullRequestCommentActivity = exports.Comment = exports.UserSchema = void 0;
|
3
|
+
exports.PullRequestActivity = exports.PullRequestCommentActivity = exports.Comment = exports.Files = exports.UserSchema = void 0;
|
4
4
|
const zod_1 = require("zod");
|
5
5
|
exports.UserSchema = zod_1.z.object({
|
6
6
|
displayName: zod_1.z.string(),
|
7
7
|
emailAddress: zod_1.z.string(),
|
8
8
|
});
|
9
|
+
exports.Files = zod_1.z.array(zod_1.z.string());
|
9
10
|
exports.Comment = zod_1.z.object({
|
10
11
|
text: zod_1.z.string(),
|
11
12
|
id: zod_1.z.number(),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../lib/modules/platform/bitbucket-server/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,UAAU,GAAG,OAAC,CAAC,MAAM,CAAC;IACjC,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAC;AAEU,QAAA,OAAO,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;CACf,CAAC,CAAC;AAIU,QAAA,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,MAAM,EAAE,OAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAC9B,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;IACzB,OAAO,EAAE,eAAO;CACjB,CAAC,CAAC;AAMU,QAAA,mBAAmB,GAAG,OAAC,CAAC,KAAK,CAAC;IACzC,OAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IAChC,kCAA0B;CAC3B,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\n\nexport const UserSchema = z.object({\n displayName: z.string(),\n emailAddress: z.string(),\n});\n\nexport const Comment = z.object({\n text: z.string(),\n id: z.number(),\n});\n\nexport type Comment = z.infer<typeof Comment>;\n\nexport const PullRequestCommentActivity = z.object({\n action: z.literal('COMMENTED'),\n commentAction: z.string(),\n comment: Comment,\n});\n\nexport type PullRequestCommentActivity = z.infer<\n typeof PullRequestCommentActivity\n>;\n\nexport const PullRequestActivity = z.union([\n z.object({ action: z.string() }),\n PullRequestCommentActivity,\n]);\n\nexport type PullRequestActivity = z.infer<typeof PullRequestActivity>;\n"]}
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../lib/modules/platform/bitbucket-server/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,UAAU,GAAG,OAAC,CAAC,MAAM,CAAC;IACjC,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAC;AAEU,QAAA,KAAK,GAAG,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AAE5B,QAAA,OAAO,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;CACf,CAAC,CAAC;AAIU,QAAA,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,MAAM,EAAE,OAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAC9B,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;IACzB,OAAO,EAAE,eAAO;CACjB,CAAC,CAAC;AAMU,QAAA,mBAAmB,GAAG,OAAC,CAAC,KAAK,CAAC;IACzC,OAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IAChC,kCAA0B;CAC3B,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\n\nexport const UserSchema = z.object({\n displayName: z.string(),\n emailAddress: z.string(),\n});\n\nexport const Files = z.array(z.string());\n\nexport const Comment = z.object({\n text: z.string(),\n id: z.number(),\n});\n\nexport type Comment = z.infer<typeof Comment>;\n\nexport const PullRequestCommentActivity = z.object({\n action: z.literal('COMMENTED'),\n commentAction: z.string(),\n comment: Comment,\n});\n\nexport type PullRequestCommentActivity = z.infer<\n typeof PullRequestCommentActivity\n>;\n\nexport const PullRequestActivity = z.union([\n z.object({ action: z.string() }),\n PullRequestCommentActivity,\n]);\n\nexport type PullRequestActivity = z.infer<typeof PullRequestActivity>;\n"]}
|
@@ -7,5 +7,5 @@ export interface DecoratorCachedRecord {
|
|
7
7
|
value: unknown;
|
8
8
|
cachedAt: string;
|
9
9
|
}
|
10
|
-
export type PackageCacheNamespace = '_test-namespace' | 'changelog-bitbucket-notes@v2' | 'changelog-bitbucket-release' | 'changelog-gitea-notes@v2' | 'changelog-gitea-release' | 'changelog-github-notes@v2' | 'changelog-github-release' | 'changelog-gitlab-notes@v2' | 'changelog-gitlab-release' | 'datasource-artifactory' | 'datasource-aws-machine-image' | 'datasource-aws-rds' | 'datasource-aws-eks-addon' | 'datasource-azure-bicep-resource' | 'datasource-azure-pipelines-tasks' | 'datasource-bazel' | 'datasource-bitbucket-tags' | 'datasource-bitrise' | 'datasource-buildpacks-registry' | 'datasource-cdnjs' | 'datasource-conan' | 'datasource-conda' | 'datasource-cpan' | 'datasource-crate-metadata' | 'datasource-crate' | 'datasource-deb' | 'datasource-deno' | 'datasource-docker-architecture' | 'datasource-docker-hub-cache' | 'datasource-docker-digest' | 'datasource-docker-hub-tags' | 'datasource-docker-imageconfig' | 'datasource-docker-labels' | 'datasource-docker-releases-v2' | 'datasource-docker-tags' | 'datasource-dotnet-version' | 'datasource-endoflife-date' | 'datasource-galaxy-collection' | 'datasource-galaxy' | 'datasource-git-refs' | 'datasource-git-tags' | 'datasource-git' | 'datasource-gitea-releases' | 'datasource-gitea-tags' | 'datasource-github-release-attachments' | 'datasource-gitlab-packages' | 'datasource-gitlab-releases' | 'datasource-gitlab-tags' | 'datasource-glasskube-packages' | 'datasource-go-direct' | 'datasource-go-proxy' | 'datasource-go' | 'datasource-golang-version' | 'datasource-gradle-version' | 'datasource-helm' | 'datasource-hermit' | 'datasource-hex' | 'datasource-hexpm-bob' | 'datasource-java-version' | 'datasource-jenkins-plugins' | 'datasource-maven' | 'datasource-maven:head-requests-timeout' | 'datasource-maven:head-requests' | 'datasource-maven:metadata-xml' | 'datasource-node-version' | 'datasource-npm:data' | 'datasource-nuget-v3' | 'datasource-orb' | 'datasource-packagist' | 'datasource-pod' | 'datasource-python-version' | 'datasource-releases' | 'datasource-repology' | 'datasource-ruby-version' | 'datasource-rubygems' | 'datasource-sbt-package' | 'datasource-terraform-module' | 'datasource-terraform-provider' | 'datasource-terraform' | 'datasource-unity3d' | 'github-releases-datasource-v2' | 'github-tags-datasource-v2' | 'merge-confidence' | 'preset' | 'terraform-provider-hash' | 'url-sha256';
|
10
|
+
export type PackageCacheNamespace = '_test-namespace' | 'changelog-bitbucket-notes@v2' | 'changelog-bitbucket-release' | 'changelog-bitbucket-server-notes@v2' | 'changelog-bitbucket-server-release' | 'changelog-gitea-notes@v2' | 'changelog-gitea-release' | 'changelog-github-notes@v2' | 'changelog-github-release' | 'changelog-gitlab-notes@v2' | 'changelog-gitlab-release' | 'datasource-artifactory' | 'datasource-aws-machine-image' | 'datasource-aws-rds' | 'datasource-aws-eks-addon' | 'datasource-azure-bicep-resource' | 'datasource-azure-pipelines-tasks' | 'datasource-bazel' | 'datasource-bitbucket-tags' | 'datasource-bitbucket-server-tags' | 'datasource-bitrise' | 'datasource-buildpacks-registry' | 'datasource-cdnjs' | 'datasource-conan' | 'datasource-conda' | 'datasource-cpan' | 'datasource-crate-metadata' | 'datasource-crate' | 'datasource-deb' | 'datasource-deno' | 'datasource-docker-architecture' | 'datasource-docker-hub-cache' | 'datasource-docker-digest' | 'datasource-docker-hub-tags' | 'datasource-docker-imageconfig' | 'datasource-docker-labels' | 'datasource-docker-releases-v2' | 'datasource-docker-tags' | 'datasource-dotnet-version' | 'datasource-endoflife-date' | 'datasource-galaxy-collection' | 'datasource-galaxy' | 'datasource-git-refs' | 'datasource-git-tags' | 'datasource-git' | 'datasource-gitea-releases' | 'datasource-gitea-tags' | 'datasource-github-release-attachments' | 'datasource-gitlab-packages' | 'datasource-gitlab-releases' | 'datasource-gitlab-tags' | 'datasource-glasskube-packages' | 'datasource-go-direct' | 'datasource-go-proxy' | 'datasource-go' | 'datasource-golang-version' | 'datasource-gradle-version' | 'datasource-helm' | 'datasource-hermit' | 'datasource-hex' | 'datasource-hexpm-bob' | 'datasource-java-version' | 'datasource-jenkins-plugins' | 'datasource-maven' | 'datasource-maven:head-requests-timeout' | 'datasource-maven:head-requests' | 'datasource-maven:metadata-xml' | 'datasource-node-version' | 'datasource-npm:data' | 'datasource-nuget-v3' | 'datasource-orb' | 'datasource-packagist' | 'datasource-pod' | 'datasource-python-version' | 'datasource-releases' | 'datasource-repology' | 'datasource-ruby-version' | 'datasource-rubygems' | 'datasource-sbt-package' | 'datasource-terraform-module' | 'datasource-terraform-provider' | 'datasource-terraform' | 'datasource-unity3d' | 'github-releases-datasource-v2' | 'github-tags-datasource-v2' | 'merge-confidence' | 'preset' | 'terraform-provider-hash' | 'url-sha256';
|
11
11
|
export type CombinedKey = `global%%${PackageCacheNamespace}%%${string}`;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../lib/util/cache/package/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface PackageCache {\n get<T = any>(namespace: string, key: string): Promise<T | undefined>;\n\n set<T = any>(\n namespace: string,\n key: string,\n value: T,\n ttlMinutes?: number,\n ): Promise<void>;\n\n cleanup?(): Promise<void>;\n}\n\nexport interface DecoratorCachedRecord {\n value: unknown;\n cachedAt: string;\n}\n\nexport type PackageCacheNamespace =\n | '_test-namespace'\n | 'changelog-bitbucket-notes@v2'\n | 'changelog-bitbucket-release'\n | 'changelog-gitea-notes@v2'\n | 'changelog-gitea-release'\n | 'changelog-github-notes@v2'\n | 'changelog-github-release'\n | 'changelog-gitlab-notes@v2'\n | 'changelog-gitlab-release'\n | 'datasource-artifactory'\n | 'datasource-aws-machine-image'\n | 'datasource-aws-rds'\n | 'datasource-aws-eks-addon'\n | 'datasource-azure-bicep-resource'\n | 'datasource-azure-pipelines-tasks'\n | 'datasource-bazel'\n | 'datasource-bitbucket-tags'\n | 'datasource-bitrise'\n | 'datasource-buildpacks-registry'\n | 'datasource-cdnjs'\n | 'datasource-conan'\n | 'datasource-conda'\n | 'datasource-cpan'\n | 'datasource-crate-metadata'\n | 'datasource-crate'\n | 'datasource-deb'\n | 'datasource-deno'\n | 'datasource-docker-architecture'\n | 'datasource-docker-hub-cache'\n | 'datasource-docker-digest'\n | 'datasource-docker-hub-tags'\n | 'datasource-docker-imageconfig'\n | 'datasource-docker-labels'\n | 'datasource-docker-releases-v2'\n | 'datasource-docker-tags'\n | 'datasource-dotnet-version'\n | 'datasource-endoflife-date'\n | 'datasource-galaxy-collection'\n | 'datasource-galaxy'\n | 'datasource-git-refs'\n | 'datasource-git-tags'\n | 'datasource-git'\n | 'datasource-gitea-releases'\n | 'datasource-gitea-tags'\n | 'datasource-github-release-attachments'\n | 'datasource-gitlab-packages'\n | 'datasource-gitlab-releases'\n | 'datasource-gitlab-tags'\n | 'datasource-glasskube-packages'\n | 'datasource-go-direct'\n | 'datasource-go-proxy'\n | 'datasource-go'\n | 'datasource-golang-version'\n | 'datasource-gradle-version'\n | 'datasource-helm'\n | 'datasource-hermit'\n | 'datasource-hex'\n | 'datasource-hexpm-bob'\n | 'datasource-java-version'\n | 'datasource-jenkins-plugins'\n | 'datasource-maven'\n | 'datasource-maven:head-requests-timeout'\n | 'datasource-maven:head-requests'\n | 'datasource-maven:metadata-xml'\n | 'datasource-node-version'\n | 'datasource-npm:data'\n | 'datasource-nuget-v3'\n | 'datasource-orb'\n | 'datasource-packagist'\n | 'datasource-pod'\n | 'datasource-python-version'\n | 'datasource-releases'\n | 'datasource-repology'\n | 'datasource-ruby-version'\n | 'datasource-rubygems'\n | 'datasource-sbt-package'\n | 'datasource-terraform-module'\n | 'datasource-terraform-provider'\n | 'datasource-terraform'\n | 'datasource-unity3d'\n | 'github-releases-datasource-v2'\n | 'github-tags-datasource-v2'\n | 'merge-confidence'\n | 'preset'\n | 'terraform-provider-hash'\n | 'url-sha256';\n\nexport type CombinedKey = `global%%${PackageCacheNamespace}%%${string}`;\n"]}
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../lib/util/cache/package/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface PackageCache {\n get<T = any>(namespace: string, key: string): Promise<T | undefined>;\n\n set<T = any>(\n namespace: string,\n key: string,\n value: T,\n ttlMinutes?: number,\n ): Promise<void>;\n\n cleanup?(): Promise<void>;\n}\n\nexport interface DecoratorCachedRecord {\n value: unknown;\n cachedAt: string;\n}\n\nexport type PackageCacheNamespace =\n | '_test-namespace'\n | 'changelog-bitbucket-notes@v2'\n | 'changelog-bitbucket-release'\n | 'changelog-bitbucket-server-notes@v2'\n | 'changelog-bitbucket-server-release'\n | 'changelog-gitea-notes@v2'\n | 'changelog-gitea-release'\n | 'changelog-github-notes@v2'\n | 'changelog-github-release'\n | 'changelog-gitlab-notes@v2'\n | 'changelog-gitlab-release'\n | 'datasource-artifactory'\n | 'datasource-aws-machine-image'\n | 'datasource-aws-rds'\n | 'datasource-aws-eks-addon'\n | 'datasource-azure-bicep-resource'\n | 'datasource-azure-pipelines-tasks'\n | 'datasource-bazel'\n | 'datasource-bitbucket-tags'\n | 'datasource-bitbucket-server-tags'\n | 'datasource-bitrise'\n | 'datasource-buildpacks-registry'\n | 'datasource-cdnjs'\n | 'datasource-conan'\n | 'datasource-conda'\n | 'datasource-cpan'\n | 'datasource-crate-metadata'\n | 'datasource-crate'\n | 'datasource-deb'\n | 'datasource-deno'\n | 'datasource-docker-architecture'\n | 'datasource-docker-hub-cache'\n | 'datasource-docker-digest'\n | 'datasource-docker-hub-tags'\n | 'datasource-docker-imageconfig'\n | 'datasource-docker-labels'\n | 'datasource-docker-releases-v2'\n | 'datasource-docker-tags'\n | 'datasource-dotnet-version'\n | 'datasource-endoflife-date'\n | 'datasource-galaxy-collection'\n | 'datasource-galaxy'\n | 'datasource-git-refs'\n | 'datasource-git-tags'\n | 'datasource-git'\n | 'datasource-gitea-releases'\n | 'datasource-gitea-tags'\n | 'datasource-github-release-attachments'\n | 'datasource-gitlab-packages'\n | 'datasource-gitlab-releases'\n | 'datasource-gitlab-tags'\n | 'datasource-glasskube-packages'\n | 'datasource-go-direct'\n | 'datasource-go-proxy'\n | 'datasource-go'\n | 'datasource-golang-version'\n | 'datasource-gradle-version'\n | 'datasource-helm'\n | 'datasource-hermit'\n | 'datasource-hex'\n | 'datasource-hexpm-bob'\n | 'datasource-java-version'\n | 'datasource-jenkins-plugins'\n | 'datasource-maven'\n | 'datasource-maven:head-requests-timeout'\n | 'datasource-maven:head-requests'\n | 'datasource-maven:metadata-xml'\n | 'datasource-node-version'\n | 'datasource-npm:data'\n | 'datasource-nuget-v3'\n | 'datasource-orb'\n | 'datasource-packagist'\n | 'datasource-pod'\n | 'datasource-python-version'\n | 'datasource-releases'\n | 'datasource-repology'\n | 'datasource-ruby-version'\n | 'datasource-rubygems'\n | 'datasource-sbt-package'\n | 'datasource-terraform-module'\n | 'datasource-terraform-provider'\n | 'datasource-terraform'\n | 'datasource-unity3d'\n | 'github-releases-datasource-v2'\n | 'github-tags-datasource-v2'\n | 'merge-confidence'\n | 'preset'\n | 'terraform-provider-hash'\n | 'url-sha256';\n\nexport type CombinedKey = `global%%${PackageCacheNamespace}%%${string}`;\n"]}
|
@@ -4,9 +4,10 @@ export declare const setBaseUrl: (url: string) => void;
|
|
4
4
|
export interface BitbucketServerHttpOptions extends HttpOptions {
|
5
5
|
paginate?: boolean;
|
6
6
|
limit?: number;
|
7
|
+
maxPages?: number;
|
7
8
|
}
|
8
9
|
export declare class BitbucketServerHttp extends HttpBase<BitbucketServerHttpOptions> {
|
9
10
|
protected get baseUrl(): string | undefined;
|
10
|
-
constructor(options?:
|
11
|
+
constructor(type?: string, options?: BitbucketServerHttpOptions);
|
11
12
|
protected requestJsonUnsafe<T>(method: HttpMethod, options: InternalJsonUnsafeOptions<BitbucketServerHttpOptions>): Promise<HttpResponse<T>>;
|
12
13
|
}
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
5
5
|
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
|
6
6
|
const http_1 = require("./http");
|
7
7
|
const MAX_LIMIT = 100;
|
8
|
+
const MAX_PAGES = 100;
|
8
9
|
let baseUrl;
|
9
10
|
const setBaseUrl = (url) => {
|
10
11
|
baseUrl = url;
|
@@ -14,8 +15,8 @@ class BitbucketServerHttp extends http_1.HttpBase {
|
|
14
15
|
get baseUrl() {
|
15
16
|
return baseUrl;
|
16
17
|
}
|
17
|
-
constructor(options) {
|
18
|
-
super(
|
18
|
+
constructor(type = 'bitbucket-server', options) {
|
19
|
+
super(type, options);
|
19
20
|
}
|
20
21
|
async requestJsonUnsafe(method, options) {
|
21
22
|
const resolvedUrl = this.resolveUrl(options.url, options.httpOptions);
|
@@ -36,7 +37,8 @@ class BitbucketServerHttp extends http_1.HttpBase {
|
|
36
37
|
}
|
37
38
|
const collectedValues = [...result.body.values];
|
38
39
|
let nextPageStart = result.body.nextPageStart;
|
39
|
-
|
40
|
+
let maxPages = opts.httpOptions.maxPages ?? MAX_PAGES;
|
41
|
+
while (nextPageStart && --maxPages > 0) {
|
40
42
|
resolvedUrl.searchParams.set('start', nextPageStart.toString());
|
41
43
|
const nextResult = await super.requestJsonUnsafe(method, opts);
|
42
44
|
collectedValues.push(...nextResult.body.values);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"bitbucket-server.js","sourceRoot":"","sources":["../../../lib/util/http/bitbucket-server.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAClC,iCAAkE;AAGlE,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,IAAI,OAAe,CAAC;AACb,MAAM,UAAU,GAAG,CAAC,GAAW,EAAQ,EAAE;IAC9C,OAAO,GAAG,GAAG,CAAC;AAChB,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;
|
1
|
+
{"version":3,"file":"bitbucket-server.js","sourceRoot":"","sources":["../../../lib/util/http/bitbucket-server.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAClC,iCAAkE;AAGlE,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,IAAI,OAAe,CAAC;AACb,MAAM,UAAU,GAAG,CAAC,GAAW,EAAQ,EAAE;IAC9C,OAAO,GAAG,GAAG,CAAC;AAChB,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAaF,MAAa,mBAAoB,SAAQ,eAAoC;IAC3E,IAAuB,OAAO;QAC5B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,YAAY,IAAI,GAAG,kBAAkB,EAA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IAAI,CAAC,WAAW,CAAC,QAAQ,IAAI,SAAS,CAAC;YACtD,OAAO,aAAa,IAAI,EAAE,QAAQ,GAAG,CAAC,EAAE,CAAC;gBACvC,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAEhE,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,iBAAiB,CAC9C,MAAM,EACN,IAAI,CACL,CAAC;gBACF,eAAe,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAChD,aAAa,GAAG,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC;YAChD,CAAC;YAED,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,eAAoB,EAAE,CAAC;QACnD,CAAC;QAED,OAAO,MAAyB,CAAC;IACnC,CAAC;CACF;AAxDD,kDAwDC;AAED,SAAS,aAAa,CAAC,GAAY;IACjC,OAAO,YAAE,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,YAAE,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { HttpBase, type InternalJsonUnsafeOptions } from './http';\nimport type { HttpMethod, HttpOptions, HttpResponse } from './types';\n\nconst MAX_LIMIT = 100;\nconst MAX_PAGES = 100;\n\nlet baseUrl: string;\nexport const setBaseUrl = (url: string): void => {\n baseUrl = url;\n};\n\nexport interface BitbucketServerHttpOptions extends HttpOptions {\n paginate?: boolean;\n limit?: number;\n maxPages?: number;\n}\n\ninterface PagedResult<T = unknown> {\n nextPageStart?: number;\n values: T[];\n}\n\nexport class BitbucketServerHttp extends HttpBase<BitbucketServerHttpOptions> {\n protected override get baseUrl(): string | undefined {\n return baseUrl;\n }\n\n constructor(type = 'bitbucket-server', options?: BitbucketServerHttpOptions) {\n super(type, options);\n }\n\n protected override async requestJsonUnsafe<T>(\n method: HttpMethod,\n options: InternalJsonUnsafeOptions<BitbucketServerHttpOptions>,\n ): Promise<HttpResponse<T>> {\n const resolvedUrl = this.resolveUrl(options.url, options.httpOptions);\n const opts = { ...options, url: resolvedUrl };\n opts.httpOptions ??= {};\n opts.httpOptions.headers ??= {};\n opts.httpOptions.headers['X-Atlassian-Token'] = 'no-check';\n\n const paginate = opts.httpOptions.paginate;\n if (paginate) {\n const limit = opts.httpOptions.limit ?? MAX_LIMIT;\n resolvedUrl.searchParams.set('limit', limit.toString());\n }\n\n const result = await super.requestJsonUnsafe<T | PagedResult<T>>(\n method,\n opts,\n );\n\n if (paginate && isPagedResult(result.body)) {\n if (opts.httpOptions) {\n delete opts.httpOptions.cacheProvider;\n opts.httpOptions.memCache = false;\n }\n\n const collectedValues = [...result.body.values];\n let nextPageStart = result.body.nextPageStart;\n\n let maxPages = opts.httpOptions.maxPages ?? MAX_PAGES;\n while (nextPageStart && --maxPages > 0) {\n resolvedUrl.searchParams.set('start', nextPageStart.toString());\n\n const nextResult = await super.requestJsonUnsafe<PagedResult<T>>(\n method,\n opts,\n );\n collectedValues.push(...nextResult.body.values);\n nextPageStart = nextResult.body.nextPageStart;\n }\n\n return { ...result, body: collectedValues as T };\n }\n\n return result as HttpResponse<T>;\n }\n}\n\nfunction isPagedResult(obj: unknown): obj is PagedResult {\n return is.nonEmptyObject(obj) && is.array(obj.values);\n}\n"]}
|
@@ -57,6 +57,18 @@ function findMatchingRule(url, options) {
|
|
57
57
|
...res,
|
58
58
|
};
|
59
59
|
}
|
60
|
+
// Fallback to `bitbucket-server` hostType
|
61
|
+
if (hostType &&
|
62
|
+
constants_1.BITBUCKET_SERVER_API_USING_HOST_TYPES.includes(hostType) &&
|
63
|
+
hostType !== 'bitbucket-server') {
|
64
|
+
res = {
|
65
|
+
...hostRules.find({
|
66
|
+
hostType: 'bitbucket-server',
|
67
|
+
url,
|
68
|
+
}),
|
69
|
+
...res,
|
70
|
+
};
|
71
|
+
}
|
60
72
|
// Fallback to `gitea` hostType
|
61
73
|
if (hostType &&
|
62
74
|
constants_1.GITEA_API_USING_HOST_TYPES.includes(hostType) &&
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"host-rules.js","sourceRoot":"","sources":["../../../lib/util/http/host-rules.ts"],"names":[],"mappings":";;AAuCA,4CA6EC;AAGD,sCAkGC;;AAzND,kEAAkC;AAClC,gDAAmD;AACnD,+CAKyB;AACzB,yCAAsC;AACtC,uCAAuC;AAEvC,iEAA2C;AAC3C,kDAAuD;AACvD,gCAAkC;AAElC,6CAA+C;AAwB/C,SAAgB,gBAAgB,CAC9B,GAAW,EACX,OAAmB;IAEnB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IACvC,IAAI,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;IAEtD,IACE,YAAE,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC;QAC5B,YAAE,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC/B,YAAE,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,EAC/B,CAAC;QACD,gDAAgD;QAChD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,gCAAgC;IAChC,IACE,QAAQ;QACR,uCAA2B,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC9C,QAAQ,KAAK,QAAQ,EACrB,CAAC;QACD,GAAG,GAAG;YACJ,GAAG,SAAS,CAAC,IAAI,CAAC;gBAChB,QAAQ,EAAE,QAAQ;gBAClB,GAAG;aACJ,CAAC;YACF,GAAG,GAAG;SACP,CAAC;IACJ,CAAC;IAED,gCAAgC;IAChC,IACE,QAAQ;QACR,uCAA2B,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC9C,QAAQ,KAAK,QAAQ,EACrB,CAAC;QACD,GAAG,GAAG;YACJ,GAAG,SAAS,CAAC,IAAI,CAAC;gBAChB,QA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C,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;QAChD,OAAO,CAAC,KAAK,GAAG;YACd,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;YACxB,GAAG,EAAE,QAAQ,CAAC,eAAe;SAC9B,CAAC;IACJ,CAAC;IAED,IAAI,YAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,KAAK,GAAG;YACd,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;YACxB,WAAW,EAAE,QAAQ,CAAC,gBAAgB;SACvC,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { GlobalConfig } from '../../config/global';\nimport {\n BITBUCKET_API_USING_HOST_TYPES,\n GITEA_API_USING_HOST_TYPES,\n GITHUB_API_USING_HOST_TYPES,\n GITLAB_API_USING_HOST_TYPES,\n} from '../../constants';\nimport { logger } from '../../logger';\nimport { hasProxy } from '../../proxy';\nimport type { HostRule } from '../../types';\nimport * as hostRules from '../host-rules';\nimport { matchRegexOrGlobList } from '../string-match';\nimport { parseUrl } from '../url';\nimport type { InternalHttpOptions } from './http';\nimport { keepAliveAgents } from './keep-alive';\nimport type { GotOptions } from './types';\n\nexport type HostRulesGotOptions = Pick<\n GotOptions & InternalHttpOptions,\n | 'hostType'\n | 'url'\n | 'noAuth'\n | 'headers'\n | 'token'\n | 'username'\n | 'password'\n | 'context'\n | 'enabled'\n | 'abortOnError'\n | 'abortIgnoreStatusCodes'\n | 'timeout'\n | 'lookup'\n | 'agent'\n | 'http2'\n | 'https'\n | 'readOnly'\n>;\n\nexport function findMatchingRule<GotOptions extends HostRulesGotOptions>(\n url: string,\n options: GotOptions,\n): HostRule {\n const { hostType, readOnly } = options;\n let res = hostRules.find({ hostType, url, readOnly });\n\n if (\n is.nonEmptyString(res.token) ||\n is.nonEmptyString(res.username) ||\n is.nonEmptyString(res.password)\n ) {\n // do not fallback if we already have auth infos\n return res;\n }\n\n // Fallback to `github` hostType\n if (\n hostType &&\n GITHUB_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'github'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'github',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `gitlab` hostType\n if (\n hostType &&\n GITLAB_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'gitlab'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'gitlab',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `bitbucket` hostType\n if (\n hostType &&\n BITBUCKET_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'bitbucket'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'bitbucket',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `gitea` hostType\n if (\n hostType &&\n GITEA_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'gitea'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'gitea',\n url,\n }),\n ...res,\n };\n }\n\n return res;\n}\n\n// Apply host rules to requests\nexport function applyHostRule<GotOptions extends HostRulesGotOptions>(\n url: string,\n options: GotOptions,\n hostRule: HostRule,\n): GotOptions {\n if (hostRule.enabled === false) {\n options.enabled = false;\n return options;\n }\n\n const { username, password, token, authType } = hostRule;\n const host = parseUrl(url)?.host;\n if (options.noAuth) {\n logger.trace({ url }, `Authorization disabled`);\n } else if (\n is.nonEmptyString(options.headers?.authorization) ||\n is.nonEmptyString(options.password) ||\n is.nonEmptyString(options.token)\n ) {\n logger.once.debug(`hostRules: authentication already set for ${host}`);\n logger.trace({ url }, `Authorization already set`);\n } else if (password !== undefined) {\n logger.once.debug(`hostRules: applying Basic authentication for ${host}`);\n logger.trace({ url }, `Applying Basic authentication`);\n options.username = username;\n options.password = password;\n } else if (token) {\n logger.once.debug(`hostRules: applying Bearer authentication for ${host}`);\n logger.trace({ url }, `Applying Bearer authentication`);\n options.token = token;\n options.context = { ...options.context, authType };\n } else {\n logger.once.debug(`hostRules: no authentication for ${host}`);\n }\n // Apply optional params\n if (hostRule.abortOnError) {\n options.abortOnError = hostRule.abortOnError;\n }\n\n if (hostRule.abortIgnoreStatusCodes) {\n options.abortIgnoreStatusCodes = hostRule.abortIgnoreStatusCodes;\n }\n\n if (hostRule.timeout) {\n options.timeout = hostRule.timeout;\n }\n\n if (hostRule.headers) {\n const allowedHeaders = GlobalConfig.get('allowedHeaders', []);\n const filteredHeaders: Record<string, string> = {};\n\n for (const [header, value] of Object.entries(hostRule.headers)) {\n if (matchRegexOrGlobList(header, allowedHeaders)) {\n filteredHeaders[header] = value;\n } else {\n logger.once.error(\n { allowedHeaders, header },\n 'Disallowed hostRules headers',\n );\n }\n }\n\n options.headers = {\n ...options.headers,\n ...filteredHeaders,\n };\n }\n\n if (hostRule.keepAlive) {\n options.agent = keepAliveAgents;\n }\n\n if (!hasProxy() && hostRule.enableHttp2 === true) {\n options.http2 = true;\n }\n\n if (is.nonEmptyString(hostRule.httpsCertificateAuthority)) {\n options.https = {\n ...(options.https ?? {}),\n certificateAuthority: hostRule.httpsCertificateAuthority,\n };\n }\n\n if (is.nonEmptyString(hostRule.httpsPrivateKey)) {\n options.https = {\n ...(options.https ?? {}),\n key: hostRule.httpsPrivateKey,\n };\n }\n\n if (is.nonEmptyString(hostRule.httpsCertificate)) {\n options.https = {\n ...(options.https ?? {}),\n certificate: hostRule.httpsCertificate,\n };\n }\n\n return options;\n}\n"]}
|
1
|
+
{"version":3,"file":"host-rules.js","sourceRoot":"","sources":["../../../lib/util/http/host-rules.ts"],"names":[],"mappings":";;AAwCA,4CA4FC;AAGD,sCAkGC;;AAzOD,kEAAkC;AAClC,gDAAmD;AACnD,+CAMyB;AACzB,yCAAsC;AACtC,uCAAuC;AAEvC,iEAA2C;AAC3C,kDAAuD;AACvD,gCAAkC;AAElC,6CAA+C;AAwB/C,SAAgB,gBAAgB,CAC9B,GAAW,EACX,OAAmB;IAEnB,MAA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AG,EAAE,QAAQ,CAAC,eAAe;SAC9B,CAAC;IACJ,CAAC;IAED,IAAI,YAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,KAAK,GAAG;YACd,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;YACxB,WAAW,EAAE,QAAQ,CAAC,gBAAgB;SACvC,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { GlobalConfig } from '../../config/global';\nimport {\n BITBUCKET_API_USING_HOST_TYPES,\n BITBUCKET_SERVER_API_USING_HOST_TYPES,\n GITEA_API_USING_HOST_TYPES,\n GITHUB_API_USING_HOST_TYPES,\n GITLAB_API_USING_HOST_TYPES,\n} from '../../constants';\nimport { logger } from '../../logger';\nimport { hasProxy } from '../../proxy';\nimport type { HostRule } from '../../types';\nimport * as hostRules from '../host-rules';\nimport { matchRegexOrGlobList } from '../string-match';\nimport { parseUrl } from '../url';\nimport type { InternalHttpOptions } from './http';\nimport { keepAliveAgents } from './keep-alive';\nimport type { GotOptions } from './types';\n\nexport type HostRulesGotOptions = Pick<\n GotOptions & InternalHttpOptions,\n | 'hostType'\n | 'url'\n | 'noAuth'\n | 'headers'\n | 'token'\n | 'username'\n | 'password'\n | 'context'\n | 'enabled'\n | 'abortOnError'\n | 'abortIgnoreStatusCodes'\n | 'timeout'\n | 'lookup'\n | 'agent'\n | 'http2'\n | 'https'\n | 'readOnly'\n>;\n\nexport function findMatchingRule<GotOptions extends HostRulesGotOptions>(\n url: string,\n options: GotOptions,\n): HostRule {\n const { hostType, readOnly } = options;\n let res = hostRules.find({ hostType, url, readOnly });\n\n if (\n is.nonEmptyString(res.token) ||\n is.nonEmptyString(res.username) ||\n is.nonEmptyString(res.password)\n ) {\n // do not fallback if we already have auth infos\n return res;\n }\n\n // Fallback to `github` hostType\n if (\n hostType &&\n GITHUB_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'github'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'github',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `gitlab` hostType\n if (\n hostType &&\n GITLAB_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'gitlab'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'gitlab',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `bitbucket` hostType\n if (\n hostType &&\n BITBUCKET_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'bitbucket'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'bitbucket',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `bitbucket-server` hostType\n if (\n hostType &&\n BITBUCKET_SERVER_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'bitbucket-server'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'bitbucket-server',\n url,\n }),\n ...res,\n };\n }\n\n // Fallback to `gitea` hostType\n if (\n hostType &&\n GITEA_API_USING_HOST_TYPES.includes(hostType) &&\n hostType !== 'gitea'\n ) {\n res = {\n ...hostRules.find({\n hostType: 'gitea',\n url,\n }),\n ...res,\n };\n }\n\n return res;\n}\n\n// Apply host rules to requests\nexport function applyHostRule<GotOptions extends HostRulesGotOptions>(\n url: string,\n options: GotOptions,\n hostRule: HostRule,\n): GotOptions {\n if (hostRule.enabled === false) {\n options.enabled = false;\n return options;\n }\n\n const { username, password, token, authType } = hostRule;\n const host = parseUrl(url)?.host;\n if (options.noAuth) {\n logger.trace({ url }, `Authorization disabled`);\n } else if (\n is.nonEmptyString(options.headers?.authorization) ||\n is.nonEmptyString(options.password) ||\n is.nonEmptyString(options.token)\n ) {\n logger.once.debug(`hostRules: authentication already set for ${host}`);\n logger.trace({ url }, `Authorization already set`);\n } else if (password !== undefined) {\n logger.once.debug(`hostRules: applying Basic authentication for ${host}`);\n logger.trace({ url }, `Applying Basic authentication`);\n options.username = username;\n options.password = password;\n } else if (token) {\n logger.once.debug(`hostRules: applying Bearer authentication for ${host}`);\n logger.trace({ url }, `Applying Bearer authentication`);\n options.token = token;\n options.context = { ...options.context, authType };\n } else {\n logger.once.debug(`hostRules: no authentication for ${host}`);\n }\n // Apply optional params\n if (hostRule.abortOnError) {\n options.abortOnError = hostRule.abortOnError;\n }\n\n if (hostRule.abortIgnoreStatusCodes) {\n options.abortIgnoreStatusCodes = hostRule.abortIgnoreStatusCodes;\n }\n\n if (hostRule.timeout) {\n options.timeout = hostRule.timeout;\n }\n\n if (hostRule.headers) {\n const allowedHeaders = GlobalConfig.get('allowedHeaders', []);\n const filteredHeaders: Record<string, string> = {};\n\n for (const [header, value] of Object.entries(hostRule.headers)) {\n if (matchRegexOrGlobList(header, allowedHeaders)) {\n filteredHeaders[header] = value;\n } else {\n logger.once.error(\n { allowedHeaders, header },\n 'Disallowed hostRules headers',\n );\n }\n }\n\n options.headers = {\n ...options.headers,\n ...filteredHeaders,\n };\n }\n\n if (hostRule.keepAlive) {\n options.agent = keepAliveAgents;\n }\n\n if (!hasProxy() && hostRule.enableHttp2 === true) {\n options.http2 = true;\n }\n\n if (is.nonEmptyString(hostRule.httpsCertificateAuthority)) {\n options.https = {\n ...(options.https ?? {}),\n certificateAuthority: hostRule.httpsCertificateAuthority,\n };\n }\n\n if (is.nonEmptyString(hostRule.httpsPrivateKey)) {\n options.https = {\n ...(options.https ?? {}),\n key: hostRule.httpsPrivateKey,\n };\n }\n\n if (is.nonEmptyString(hostRule.httpsCertificate)) {\n options.https = {\n ...(options.https ?? {}),\n certificate: hostRule.httpsCertificate,\n };\n }\n\n return options;\n}\n"]}
|
@@ -25,18 +25,19 @@ function massageUpdateMetadata(config) {
|
|
25
25
|
if (primaryLink) {
|
26
26
|
depNameLinked = `[${depNameLinked}](${primaryLink})`;
|
27
27
|
}
|
28
|
-
let sourceRootPath = 'tree';
|
28
|
+
let sourceRootPath = 'tree/HEAD';
|
29
29
|
if (sourceUrl) {
|
30
30
|
const sourcePlatform = (0, common_1.detectPlatform)(sourceUrl);
|
31
31
|
if (sourcePlatform === 'bitbucket') {
|
32
|
-
sourceRootPath = 'src';
|
32
|
+
sourceRootPath = 'src/HEAD';
|
33
|
+
}
|
34
|
+
else if (sourcePlatform === 'bitbucket-server') {
|
35
|
+
sourceRootPath = 'browse';
|
33
36
|
}
|
34
37
|
}
|
35
38
|
const otherLinks = [];
|
36
39
|
if (sourceUrl && (!!sourceDirectory || homepage)) {
|
37
|
-
otherLinks.push(`[source](${sourceDirectory
|
38
|
-
? (0, url_1.joinUrlParts)(sourceUrl, sourceRootPath, 'HEAD', sourceDirectory)
|
39
|
-
: sourceUrl})`);
|
40
|
+
otherLinks.push(`[source](${getFullSourceUrl(sourceUrl, sourceRootPath, sourceDirectory)})`);
|
40
41
|
}
|
41
42
|
if (changelogUrl) {
|
42
43
|
otherLinks.push(`[changelog](${changelogUrl})`);
|
@@ -50,11 +51,7 @@ function massageUpdateMetadata(config) {
|
|
50
51
|
references.push(`[homepage](${homepage})`);
|
51
52
|
}
|
52
53
|
if (sourceUrl) {
|
53
|
-
|
54
|
-
if (sourceDirectory) {
|
55
|
-
fullUrl = (0, url_1.joinUrlParts)(sourceUrl, sourceRootPath, 'HEAD', sourceDirectory);
|
56
|
-
}
|
57
|
-
references.push(`[source](${fullUrl})`);
|
54
|
+
references.push(`[source](${getFullSourceUrl(sourceUrl, sourceRootPath, sourceDirectory)})`);
|
58
55
|
}
|
59
56
|
if (changelogUrl) {
|
60
57
|
references.push(`[changelog](${changelogUrl})`);
|
@@ -62,6 +59,13 @@ function massageUpdateMetadata(config) {
|
|
62
59
|
upgrade.references = references.join(', ');
|
63
60
|
});
|
64
61
|
}
|
62
|
+
function getFullSourceUrl(sourceUrl, sourceRootPath, sourceDirectory) {
|
63
|
+
let fullUrl = sourceUrl;
|
64
|
+
if (sourceDirectory) {
|
65
|
+
fullUrl = (0, url_1.joinUrlParts)(sourceUrl, sourceRootPath, sourceDirectory);
|
66
|
+
}
|
67
|
+
return fullUrl;
|
68
|
+
}
|
65
69
|
const rebasingRegex = (0, regex_1.regEx)(/\*\*Rebasing\*\*: .*/);
|
66
70
|
function getPrBody(branchConfig, prBodyConfig, config) {
|
67
71
|
massageUpdateMetadata(branchConfig);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lib/workers/repository/update/pr/body/index.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lib/workers/repository/update/pr/body/index.ts"],"names":[],"mappings":";;AA8FA,8BA4CC;;AAxID,8DAA2D;AAC3D,uDAA4D;AAC5D,qDAAkD;AAClD,uDAAsD;AACtD,+EAAyD;AACzD,iDAAuD;AAEvD,8DAAyE;AACzE,6CAA6C;AAC7C,6DAA8D;AAC9D,yCAAyC;AACzC,qCAAuC;AACvC,qCAAuC;AACvC,mCAAsD;AACtD,mDAAoD;AAEpD,SAAS,qBAAqB,CAAC,MAAoB;IACjD,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAClC,MAAM,EACJ,QAAQ,EACR,SAAS,EACT,eAAe,EACf,YAAY,EACZ,aAAa,GACd,GAAG,OAAO,CAAC;QACZ,uBAAuB;QACvB,IAAI,aAAa,GAAG,OAAO,CAAC,OAAQ,CAAC;QACrC,MAAM,WAAW,GAAG,QAAQ,IAAI,SAAS,IAAI,aAAa,CAAC;QAC3D,IAAI,WAAW,EAAE,CAAC;YAChB,aAAa,GAAG,IAAI,aAAa,KAAK,WAAW,GAAG,CAAC;QACvD,CAAC;QAED,IAAI,cAAc,GAAG,WAAW,CAAC;QACjC,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,cAAc,GAAG,IAAA,uBAAc,EAAC,SAAS,CAAC,CAAC;YACjD,IAAI,cAAc,KAAK,WAAW,EAAE,CAAC;gBACnC,cAAc,GAAG,UAAU,CAAC;YAC9B,CAAC;iBAAM,IAAI,cAAc,KAAK,kBA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,IAAA,aAAK,EAAC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC;QACnD,MAAM,aAAa,GAAG,IAAA,iBAAQ,EAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;QACvE,MAAM,IAAI,wBAAwB,aAAa,OAAO,CAAC;QACvD,MAAM,GAAG,mBAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAE1C,IAAI,YAAY,EAAE,cAAc,EAAE,CAAC;YACjC,MAAM,GAAG,MAAM,CAAC,OAAO,CACrB,aAAa,EACb,iBAAiB,YAAY,CAAC,cAAc,EAAE,CAC/C,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { RenovateConfig } from '../../../../../config/types';\nimport type { PrDebugData } from '../../../../../modules/platform';\nimport { platform } from '../../../../../modules/platform';\nimport { detectPlatform } from '../../../../../util/common';\nimport { regEx } from '../../../../../util/regex';\nimport { toBase64 } from '../../../../../util/string';\nimport * as template from '../../../../../util/template';\nimport { joinUrlParts } from '../../../../../util/url';\nimport type { BranchConfig } from '../../../../types';\nimport { getDepWarningsPR, getWarnings } from '../../../errors-warnings';\nimport { getChangelogs } from './changelogs';\nimport { getPrConfigDescription } from './config-description';\nimport { getControls } from './controls';\nimport { getPrFooter } from './footer';\nimport { getPrHeader } from './header';\nimport { getPrExtraNotes, getPrNotes } from './notes';\nimport { getPrUpdatesTable } from './updates-table';\n\nfunction massageUpdateMetadata(config: BranchConfig): void {\n config.upgrades.forEach((upgrade) => {\n const {\n homepage,\n sourceUrl,\n sourceDirectory,\n changelogUrl,\n dependencyUrl,\n } = upgrade;\n // TODO: types (#22198)\n let depNameLinked = upgrade.depName!;\n const primaryLink = homepage ?? sourceUrl ?? dependencyUrl;\n if (primaryLink) {\n depNameLinked = `[${depNameLinked}](${primaryLink})`;\n }\n\n let sourceRootPath = 'tree/HEAD';\n if (sourceUrl) {\n const sourcePlatform = detectPlatform(sourceUrl);\n if (sourcePlatform === 'bitbucket') {\n sourceRootPath = 'src/HEAD';\n } else if (sourcePlatform === 'bitbucket-server') {\n sourceRootPath = 'browse';\n }\n }\n\n const otherLinks = [];\n if (sourceUrl && (!!sourceDirectory || homepage)) {\n otherLinks.push(\n `[source](${getFullSourceUrl(sourceUrl, sourceRootPath, sourceDirectory)})`,\n );\n }\n if (changelogUrl) {\n otherLinks.push(`[changelog](${changelogUrl})`);\n }\n if (otherLinks.length) {\n depNameLinked += ` (${otherLinks.join(', ')})`;\n }\n upgrade.depNameLinked = depNameLinked;\n const references: string[] = [];\n if (homepage) {\n references.push(`[homepage](${homepage})`);\n }\n if (sourceUrl) {\n references.push(\n `[source](${getFullSourceUrl(sourceUrl, sourceRootPath, sourceDirectory)})`,\n );\n }\n if (changelogUrl) {\n references.push(`[changelog](${changelogUrl})`);\n }\n upgrade.references = references.join(', ');\n });\n}\n\nfunction getFullSourceUrl(\n sourceUrl: string,\n sourceRootPath: string,\n sourceDirectory?: string,\n): string {\n let fullUrl = sourceUrl;\n if (sourceDirectory) {\n fullUrl = joinUrlParts(sourceUrl, sourceRootPath, sourceDirectory);\n }\n\n return fullUrl;\n}\n\ninterface PrBodyConfig {\n appendExtra?: string | null | undefined;\n rebasingNotice?: string;\n debugData: PrDebugData;\n}\n\nconst rebasingRegex = regEx(/\\*\\*Rebasing\\*\\*: .*/);\n\nexport function getPrBody(\n branchConfig: BranchConfig,\n prBodyConfig: PrBodyConfig,\n config: RenovateConfig,\n): string {\n massageUpdateMetadata(branchConfig);\n let warnings = '';\n warnings += getWarnings(branchConfig);\n if (branchConfig.packageFiles) {\n warnings += getDepWarningsPR(\n branchConfig.packageFiles,\n config,\n branchConfig.dependencyDashboard,\n );\n }\n const content = {\n header: getPrHeader(branchConfig),\n table: getPrUpdatesTable(branchConfig),\n warnings,\n notes: getPrNotes(branchConfig) + getPrExtraNotes(branchConfig),\n changelogs: getChangelogs(branchConfig),\n configDescription: getPrConfigDescription(branchConfig),\n controls: getControls(),\n footer: getPrFooter(branchConfig),\n };\n\n let prBody = '';\n if (branchConfig.prBodyTemplate) {\n const prBodyTemplate = branchConfig.prBodyTemplate;\n prBody = template.compile(prBodyTemplate, content, false);\n prBody = prBody.trim();\n prBody = prBody.replace(regEx(/\\n\\n\\n+/g), '\\n\\n');\n const prDebugData64 = toBase64(JSON.stringify(prBodyConfig.debugData));\n prBody += `\\n<!--renovate-debug:${prDebugData64}-->\\n`;\n prBody = platform.massageMarkdown(prBody);\n\n if (prBodyConfig?.rebasingNotice) {\n prBody = prBody.replace(\n rebasingRegex,\n `**Rebasing**: ${prBodyConfig.rebasingNotice}`,\n );\n }\n }\n return prBody;\n}\n"]}
|
@@ -1,13 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const source_1 = require("./bitbucket/source");
|
4
|
-
const source_2 = require("./
|
5
|
-
const source_3 = require("./
|
6
|
-
const source_4 = require("./
|
4
|
+
const source_2 = require("./bitbucket-server/source");
|
5
|
+
const source_3 = require("./gitea/source");
|
6
|
+
const source_4 = require("./github/source");
|
7
|
+
const source_5 = require("./gitlab/source");
|
7
8
|
const api = new Map();
|
8
9
|
exports.default = api;
|
9
10
|
api.set('bitbucket', new source_1.BitbucketChangeLogSource());
|
10
|
-
api.set('
|
11
|
-
api.set('
|
12
|
-
api.set('
|
11
|
+
api.set('bitbucket-server', new source_2.BitbucketServerChangeLogSource());
|
12
|
+
api.set('gitea', new source_3.GiteaChangeLogSource());
|
13
|
+
api.set('github', new source_4.GitHubChangeLogSource());
|
14
|
+
api.set('gitlab', new source_5.GitLabChangeLogSource());
|
13
15
|
//# sourceMappingURL=api.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../../../lib/workers/repository/update/pr/changelog/api.ts"],"names":[],"mappings":";;AAAA,+CAA8D;AAC9D,2CAAsD;AACtD,4CAAwD;AACxD,4CAAwD;AAGxD,MAAM,GAAG,GAAG,IAAI,GAAG,EAA2B,CAAC;AAC/C,kBAAe,GAAG,CAAC;AAEnB,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,iCAAwB,EAAE,CAAC,CAAC;AACrD,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,6BAAoB,EAAE,CAAC,CAAC;AAC7C,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,8BAAqB,EAAE,CAAC,CAAC;AAC/C,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,8BAAqB,EAAE,CAAC,CAAC","sourcesContent":["import { BitbucketChangeLogSource } from './bitbucket/source';\nimport { GiteaChangeLogSource } from './gitea/source';\nimport { GitHubChangeLogSource } from './github/source';\nimport { GitLabChangeLogSource } from './gitlab/source';\nimport type { ChangeLogSource } from './source';\n\nconst api = new Map<string, ChangeLogSource>();\nexport default api;\n\napi.set('bitbucket', new BitbucketChangeLogSource());\napi.set('gitea', new GiteaChangeLogSource());\napi.set('github', new GitHubChangeLogSource());\napi.set('gitlab', new GitLabChangeLogSource());\n"]}
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../../../lib/workers/repository/update/pr/changelog/api.ts"],"names":[],"mappings":";;AAAA,+CAA8D;AAC9D,sDAA2E;AAC3E,2CAAsD;AACtD,4CAAwD;AACxD,4CAAwD;AAGxD,MAAM,GAAG,GAAG,IAAI,GAAG,EAA2B,CAAC;AAC/C,kBAAe,GAAG,CAAC;AAEnB,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,iCAAwB,EAAE,CAAC,CAAC;AACrD,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE,IAAI,uCAA8B,EAAE,CAAC,CAAC;AAClE,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,6BAAoB,EAAE,CAAC,CAAC;AAC7C,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,8BAAqB,EAAE,CAAC,CAAC;AAC/C,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,8BAAqB,EAAE,CAAC,CAAC","sourcesContent":["import { BitbucketChangeLogSource } from './bitbucket/source';\nimport { BitbucketServerChangeLogSource } from './bitbucket-server/source';\nimport { GiteaChangeLogSource } from './gitea/source';\nimport { GitHubChangeLogSource } from './github/source';\nimport { GitLabChangeLogSource } from './gitlab/source';\nimport type { ChangeLogSource } from './source';\n\nconst api = new Map<string, ChangeLogSource>();\nexport default api;\n\napi.set('bitbucket', new BitbucketChangeLogSource());\napi.set('bitbucket-server', new BitbucketServerChangeLogSource());\napi.set('gitea', new GiteaChangeLogSource());\napi.set('github', new GitHubChangeLogSource());\napi.set('gitlab', new GitLabChangeLogSource());\n"]}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.id = void 0;
|
4
|
+
exports.getReleaseNotesMd = getReleaseNotesMd;
|
5
|
+
const tslib_1 = require("tslib");
|
6
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
7
|
+
const changelog_filename_regex_1 = tslib_1.__importDefault(require("changelog-filename-regex"));
|
8
|
+
const logger_1 = require("../../../../../../logger");
|
9
|
+
const schema_1 = require("../../../../../../modules/platform/bitbucket-server/schema");
|
10
|
+
const bitbucket_server_1 = require("../../../../../../util/http/bitbucket-server");
|
11
|
+
const url_1 = require("../../../../../../util/url");
|
12
|
+
const common_1 = require("../common");
|
13
|
+
exports.id = 'bitbucket-server-changelog';
|
14
|
+
const http = new bitbucket_server_1.BitbucketServerHttp(exports.id);
|
15
|
+
async function getReleaseNotesMd(repository, apiBaseUrl, sourceDirectory) {
|
16
|
+
logger_1.logger.info('bitbucketServer.getReleaseNotesMd()');
|
17
|
+
const [projectKey, repositorySlug] = repository.split('/');
|
18
|
+
const apiRepoBaseUrl = (0, url_1.joinUrlParts)(apiBaseUrl, `projects`, projectKey, 'repos', repositorySlug);
|
19
|
+
const repositorySourceURl = (0, url_1.joinUrlParts)(apiRepoBaseUrl, 'files', sourceDirectory ?? '');
|
20
|
+
const allFiles = (await http.getJson(repositorySourceURl, {
|
21
|
+
paginate: true,
|
22
|
+
}, schema_1.Files)).body;
|
23
|
+
const changelogFiles = allFiles.filter((f) => changelog_filename_regex_1.default.test(node_path_1.default.basename(f)));
|
24
|
+
let changelogFile = changelogFiles
|
25
|
+
.sort((a, b) => (0, common_1.compareChangelogFilePath)(a, b))
|
26
|
+
.shift();
|
27
|
+
if (!changelogFile) {
|
28
|
+
logger_1.logger.trace('no changelog file found');
|
29
|
+
return null;
|
30
|
+
}
|
31
|
+
changelogFile = `${sourceDirectory ? (0, url_1.ensureTrailingSlash)(sourceDirectory) : ''}${changelogFile}`;
|
32
|
+
if (changelogFiles.length !== 0) {
|
33
|
+
logger_1.logger.debug(`Multiple candidates for changelog file, using ${changelogFile}`);
|
34
|
+
}
|
35
|
+
const fileRes = await http.getText((0, url_1.joinUrlParts)(apiRepoBaseUrl, 'raw', changelogFile));
|
36
|
+
const changelogMd = `${fileRes.body}\n#\n##`;
|
37
|
+
return { changelogFile, changelogMd };
|
38
|
+
}
|
39
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../lib/workers/repository/update/pr/changelog/bitbucket-server/index.ts"],"names":[],"mappings":";;;AAYA,8CAwDC;;AApED,kEAA6B;AAC7B,gGAA8D;AAC9D,qDAAkD;AAClD,uFAAmF;AACnF,mFAAmF;AACnF,oDAA+E;AAC/E,sCAAqD;AAGxC,QAAA,EAAE,GAAG,4BAA4B,CAAC;AAC/C,MAAM,IAAI,GAAG,IAAI,sCAAmB,CAAC,UAAE,CAAC,CAAC;AAElC,KAAK,UAAU,iBAAiB,CACrC,UAAkB,EAClB,UAAkB,EAClB,eAAwB;IAExB,eAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;IAE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E,aAAa,CAAC,CACnD,CAAC;IACF,MAAM,WAAW,GAAG,GAAG,OAAO,CAAC,IAAI,SAAS,CAAC;IAE7C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;AACxC,CAAC","sourcesContent":["import path from 'node:path';\nimport changelogFilenameRegex from 'changelog-filename-regex';\nimport { logger } from '../../../../../../logger';\nimport { Files } from '../../../../../../modules/platform/bitbucket-server/schema';\nimport { BitbucketServerHttp } from '../../../../../../util/http/bitbucket-server';\nimport { ensureTrailingSlash, joinUrlParts } from '../../../../../../util/url';\nimport { compareChangelogFilePath } from '../common';\nimport type { ChangeLogFile } from '../types';\n\nexport const id = 'bitbucket-server-changelog';\nconst http = new BitbucketServerHttp(id);\n\nexport async function getReleaseNotesMd(\n repository: string,\n apiBaseUrl: string,\n sourceDirectory?: string,\n): Promise<ChangeLogFile | null> {\n logger.info('bitbucketServer.getReleaseNotesMd()');\n\n const [projectKey, repositorySlug] = repository.split('/');\n const apiRepoBaseUrl = joinUrlParts(\n apiBaseUrl,\n `projects`,\n projectKey,\n 'repos',\n repositorySlug,\n );\n\n const repositorySourceURl = joinUrlParts(\n apiRepoBaseUrl,\n 'files',\n sourceDirectory ?? '',\n );\n const allFiles = (\n await http.getJson(\n repositorySourceURl,\n {\n paginate: true,\n },\n Files,\n )\n ).body;\n\n const changelogFiles = allFiles.filter((f) =>\n changelogFilenameRegex.test(path.basename(f)),\n );\n\n let changelogFile = changelogFiles\n .sort((a, b) => compareChangelogFilePath(a, b))\n .shift();\n if (!changelogFile) {\n logger.trace('no changelog file found');\n return null;\n }\n\n changelogFile = `${sourceDirectory ? ensureTrailingSlash(sourceDirectory) : ''}${changelogFile}`;\n if (changelogFiles.length !== 0) {\n logger.debug(\n `Multiple candidates for changelog file, using ${changelogFile}`,\n );\n }\n\n const fileRes = await http.getText(\n joinUrlParts(apiRepoBaseUrl, 'raw', changelogFile),\n );\n const changelogMd = `${fileRes.body}\\n#\\n##`;\n\n return { changelogFile, changelogMd };\n}\n"]}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { BranchUpgradeConfig } from '../../../../../types';
|
2
|
+
import { ChangeLogSource } from '../source';
|
3
|
+
export declare class BitbucketServerChangeLogSource extends ChangeLogSource {
|
4
|
+
constructor();
|
5
|
+
getAPIBaseUrl(config: BranchUpgradeConfig): string;
|
6
|
+
getCompareURL(baseUrl: string, repository: string, prevHead: string, nextHead: string): string;
|
7
|
+
getRepositoryFromUrl(config: BranchUpgradeConfig): string;
|
8
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.BitbucketServerChangeLogSource = void 0;
|
4
|
+
const regex_1 = require("../../../../../../util/regex");
|
5
|
+
const url_1 = require("../../../../../../util/url");
|
6
|
+
const source_1 = require("../source");
|
7
|
+
const repositoryRegex = (0, regex_1.regEx)('^/(?:scm|projects)?/?(?<project>[^\\/]+)/(?:repos/)?(?<repo>[^\\/]+?)(?:\\.git|/.*|$)');
|
8
|
+
class BitbucketServerChangeLogSource extends source_1.ChangeLogSource {
|
9
|
+
constructor() {
|
10
|
+
super('bitbucket-server', 'bitbucket-server-tags');
|
11
|
+
}
|
12
|
+
getAPIBaseUrl(config) {
|
13
|
+
return `${this.getBaseUrl(config)}rest/api/1.0/`;
|
14
|
+
}
|
15
|
+
getCompareURL(baseUrl, repository, prevHead, nextHead) {
|
16
|
+
const [projectKey, repositorySlug] = repository.split('/');
|
17
|
+
return `${baseUrl}projects/${projectKey}/repos/${repositorySlug}/compare/commits?sourceBranch=${nextHead}&targetBranch=${prevHead}`;
|
18
|
+
}
|
19
|
+
getRepositoryFromUrl(config) {
|
20
|
+
const parsedUrl = (0, url_1.parseUrl)(config.sourceUrl);
|
21
|
+
if (parsedUrl) {
|
22
|
+
const match = repositoryRegex.exec(parsedUrl.pathname);
|
23
|
+
if (match?.groups) {
|
24
|
+
return `${match.groups.project}/${match.groups.repo}`;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
return '';
|
28
|
+
}
|
29
|
+
}
|
30
|
+
exports.BitbucketServerChangeLogSource = BitbucketServerChangeLogSource;
|
31
|
+
//# sourceMappingURL=source.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../../../../../../lib/workers/repository/update/pr/changelog/bitbucket-server/source.ts"],"names":[],"mappings":";;;AAAA,wDAAqD;AACrD,oDAAsD;AAEtD,sCAA4C;AAE5C,MAAM,eAAe,GAAG,IAAA,aAAK,EAC3B,uFAAuF,CACxF,CAAC;AAEF,MAAa,8BAA+B,SAAQ,wBAAe;IACjE;QACE,KAAK,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,CAAC;IACrD,CAAC;IAED,aAAa,CAAC,MAA2B;QACvC,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC;IACnD,CAAC;IAED,aAAa,CACX,OAAe,EACf,UAAkB,EAClB,QAAgB,EAChB,QAAgB;QAEhB,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3D,OAAO,GAAG,OAAO,YAAY,UAAU,UAAU,cAAc,iCAAiC,QAAQ,iBAAiB,QAAQ,EAAE,CAAC;IACtI,CAAC;IAEQ,oBAAoB,CAAC,MAA2B;QACvD,MAAM,SAAS,GAAG,IAAA,cAAQ,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YACvD,IAAI,KAAK,EAAE,MAAM,EAAE,CAAC;gBAClB,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACxD,CAAC;QACH,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AA9BD,wEA8BC","sourcesContent":["import { regEx } from '../../../../../../util/regex';\nimport { parseUrl } from '../../../../../../util/url';\nimport type { BranchUpgradeConfig } from '../../../../../types';\nimport { ChangeLogSource } from '../source';\n\nconst repositoryRegex = regEx(\n '^/(?:scm|projects)?/?(?<project>[^\\\\/]+)/(?:repos/)?(?<repo>[^\\\\/]+?)(?:\\\\.git|/.*|$)',\n);\n\nexport class BitbucketServerChangeLogSource extends ChangeLogSource {\n constructor() {\n super('bitbucket-server', 'bitbucket-server-tags');\n }\n\n getAPIBaseUrl(config: BranchUpgradeConfig): string {\n return `${this.getBaseUrl(config)}rest/api/1.0/`;\n }\n\n getCompareURL(\n baseUrl: string,\n repository: string,\n prevHead: string,\n nextHead: string,\n ): string {\n const [projectKey, repositorySlug] = repository.split('/');\n return `${baseUrl}projects/${projectKey}/repos/${repositorySlug}/compare/commits?sourceBranch=${nextHead}&targetBranch=${prevHead}`;\n }\n\n override getRepositoryFromUrl(config: BranchUpgradeConfig): string {\n const parsedUrl = parseUrl(config.sourceUrl);\n if (parsedUrl) {\n const match = repositoryRegex.exec(parsedUrl.pathname);\n if (match?.groups) {\n return `${match.groups.project}/${match.groups.repo}`;\n }\n }\n\n return '';\n }\n}\n"]}
|
@@ -24,6 +24,7 @@ const regex_1 = require("../../../../../util/regex");
|
|
24
24
|
const string_1 = require("../../../../../util/string");
|
25
25
|
const url_1 = require("../../../../../util/url");
|
26
26
|
const bitbucket = tslib_1.__importStar(require("./bitbucket"));
|
27
|
+
const bitbucketServer = tslib_1.__importStar(require("./bitbucket-server"));
|
27
28
|
const gitea = tslib_1.__importStar(require("./gitea"));
|
28
29
|
const github = tslib_1.__importStar(require("./github"));
|
29
30
|
const gitlab = tslib_1.__importStar(require("./gitlab"));
|
@@ -43,6 +44,9 @@ async function getReleaseList(project, release) {
|
|
43
44
|
return await github.getReleaseList(project, release);
|
44
45
|
case 'bitbucket':
|
45
46
|
return bitbucket.getReleaseList(project, release);
|
47
|
+
case 'bitbucket-server':
|
48
|
+
logger_1.logger.trace('Unsupported Bitbucket Server feature. Skipping release fetching.');
|
49
|
+
return [];
|
46
50
|
default:
|
47
51
|
logger_1.logger.warn({ apiBaseUrl, repository, type }, 'Invalid project type');
|
48
52
|
return [];
|
@@ -205,6 +209,8 @@ async function getReleaseNotesMdFileInner(project) {
|
|
205
209
|
return await github.getReleaseNotesMd(repository, apiBaseUrl, sourceDirectory);
|
206
210
|
case 'bitbucket':
|
207
211
|
return await bitbucket.getReleaseNotesMd(repository, apiBaseUrl, sourceDirectory);
|
212
|
+
case 'bitbucket-server':
|
213
|
+
return await bitbucketServer.getReleaseNotesMd(repository, apiBaseUrl, sourceDirectory);
|
208
214
|
default:
|
209
215
|
logger_1.logger.warn({ apiBaseUrl, repository, type }, 'Invalid project type');
|
210
216
|
return null;
|
@@ -264,8 +270,7 @@ async function getReleaseNotesMd(project, release) {
|
|
264
270
|
for (const word of title) {
|
265
271
|
if (word.includes(version) && !(0, url_1.isHttpUrl)(word)) {
|
266
272
|
logger_1.logger.trace({ body }, 'Found release notes for v' + version);
|
267
|
-
|
268
|
-
const notesSourceUrl = (0, url_1.joinUrlParts)(baseUrl, repository, getSourceRootPath(project.type), 'HEAD', changelogFile);
|
273
|
+
const notesSourceUrl = getNotesSourceUrl(baseUrl, repository, project, changelogFile);
|
269
274
|
const mdHeadingLink = title
|
270
275
|
.filter((word) => !(0, url_1.isHttpUrl)(word))
|
271
276
|
.join('-')
|
@@ -364,12 +369,11 @@ async function addReleaseNotes(input, config) {
|
|
364
369
|
function shouldSkipChangelogMd(repository) {
|
365
370
|
return repositoriesToSkipMdFetching.includes(repository);
|
366
371
|
}
|
367
|
-
function
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
default:
|
372
|
-
return 'blob';
|
372
|
+
function getNotesSourceUrl(baseUrl, repository, project, changelogFile) {
|
373
|
+
if (project.type === 'bitbucket-server') {
|
374
|
+
const [projectKey, repositorySlug] = repository.split('/');
|
375
|
+
return (0, url_1.joinUrlParts)(baseUrl, 'projects', projectKey, 'repos', repositorySlug, 'browse', changelogFile, '?at=HEAD');
|
373
376
|
}
|
377
|
+
return (0, url_1.joinUrlParts)(baseUrl, repository, project.type === 'bitbucket' ? 'src' : 'blob', 'HEAD', changelogFile);
|
374
378
|
}
|
375
379
|
//# sourceMappingURL=release-notes.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"release-notes.js","sourceRoot":"","sources":["../../../../../../lib/workers/repository/update/pr/changelog/release-notes.ts"],"names":[],"mappings":";;AA+BA,wCA+BC;AAED,oDAeC;AAED,kCA6BC;AAED,kCAgBC;AAED,0CA0CC;AA+ED,gEAkDC;AAED,sDAgBC;AAED,8CAkFC;AASD,4DAgBC;AAED,0CAiDC;AAMD,sDAEC;;AAveD,kEAAkC;AAClC,iCAAiC;AACjC,sEAAqC;AACrC,kDAA+C;AAC/C,mFAA6D;AAC7D,wFAAkE;AAElE,uDAA4D;AAC5D,2DAAuD;AACvD,qDAAgE;AAChE,uDAA0D;AAC1D,iDAAkE;AAElE,+DAAyC;AACzC,uDAAiC;AACjC,yDAAmC;AACnC,yDAAmC;AAUnC,MAAM,QAAQ,GAAG,IAAI,qBAAU,CAAC,MAAM,CAAC,CAAC;AACxC,QAAQ,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAEzC,MAAM,4BAA4B,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAExD,KAAK,UAAU,cAAc,CAClC,OAAyB,EACzB,OAAyB;IAEzB,eAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACjC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACjD,IAAI,CAAC;QACH,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,OAAO;gBACV,OAAO,MAAM,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACtD,K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AG,MAAM,YAAY,CAAC,GAAG,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;QAChE,YAAY,KAAK,MAAM,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC3D,YAAY,KAAK,MAAM,eAAe,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QAEjE,qEAAqE;QACrE,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;YACnC,YAAY,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;QAC5D,CAAC;QAED,MAAM,YAAY,GAAG,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACtD,MAAM,YAAY,CAAC,GAAG,CACpB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,YAAY,CACb,CAAC;QACF,MAAM,CAAC,QAAS,CAAC,IAAI,CAAC;YACpB,GAAG,CAAC;YACJ,YAAY,EAAE,YAAa;SAC5B,CAAC,CAAC;QAEH,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;QAChC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,UAAkB;IACtD,OAAO,4BAA4B,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAuB;IAChD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,WAAW;YACd,OAAO,KAAK,CAAC;QACf;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { DateTime } from 'luxon';\nimport MarkdownIt from 'markdown-it';\nimport { logger } from '../../../../../logger';\nimport * as memCache from '../../../../../util/cache/memory';\nimport * as packageCache from '../../../../../util/cache/package';\nimport type { PackageCacheNamespace } from '../../../../../util/cache/package/types';\nimport { detectPlatform } from '../../../../../util/common';\nimport { linkify } from '../../../../../util/markdown';\nimport { newlineRegex, regEx } from '../../../../../util/regex';\nimport { coerceString } from '../../../../../util/string';\nimport { isHttpUrl, joinUrlParts } from '../../../../../util/url';\nimport type { BranchUpgradeConfig } from '../../../../types';\nimport * as bitbucket from './bitbucket';\nimport * as gitea from './gitea';\nimport * as github from './github';\nimport * as gitlab from './gitlab';\nimport type {\n ChangeLogFile,\n ChangeLogNotes,\n ChangeLogPlatform,\n ChangeLogProject,\n ChangeLogRelease,\n ChangeLogResult,\n} from './types';\n\nconst markdown = new MarkdownIt('zero');\nmarkdown.enable(['heading', 'lheading']);\n\nconst repositoriesToSkipMdFetching = ['facebook/react-native'];\n\nexport async function getReleaseList(\n project: ChangeLogProject,\n release: ChangeLogRelease,\n): Promise<ChangeLogNotes[]> {\n logger.trace('getReleaseList()');\n const { apiBaseUrl, repository, type } = project;\n try {\n switch (type) {\n case 'gitea':\n return await gitea.getReleaseList(project, release);\n case 'gitlab':\n return await gitlab.getReleaseList(project, release);\n case 'github':\n return await github.getReleaseList(project, release);\n case 'bitbucket':\n return bitbucket.getReleaseList(project, release);\n default:\n logger.warn({ apiBaseUrl, repository, type }, 'Invalid project type');\n return [];\n }\n } catch (err) /* istanbul ignore next */ {\n if (err.statusCode === 404) {\n logger.debug({ repository, type, apiBaseUrl }, 'getReleaseList 404');\n } else {\n logger.debug(\n { repository, type, apiBaseUrl, err },\n 'getReleaseList error',\n );\n }\n }\n return [];\n}\n\nexport function getCachedReleaseList(\n project: ChangeLogProject,\n release: ChangeLogRelease,\n): Promise<ChangeLogNotes[]> {\n const { repository, apiBaseUrl } = project;\n // TODO: types (#22198)\n const cacheKey = `getReleaseList-${apiBaseUrl}-${repository}`;\n const cachedResult = memCache.get<Promise<ChangeLogNotes[]>>(cacheKey);\n // istanbul ignore if\n if (cachedResult !== undefined) {\n return cachedResult;\n }\n const promisedRes = getReleaseList(project, release);\n memCache.set(cacheKey, promisedRes);\n return promisedRes;\n}\n\nexport function massageBody(\n input: string | undefined | null,\n baseUrl: string,\n): string {\n let body = coerceString(input);\n // Convert line returns\n body = body.replace(regEx(/\\r\\n/g), '\\n');\n // semantic-release cleanup\n body = body.replace(regEx(/^<a name=\"[^\"]*\"><\\/a>\\n/), '');\n body = body.replace(\n regEx(\n `^##? \\\\[[^\\\\]]*\\\\]\\\\(${baseUrl}[^/]*/[^/]*/compare/.*?\\\\n`,\n undefined,\n false,\n ),\n '',\n );\n // Clean-up unnecessary commits link\n body = `\\n${body}\\n`.replace(\n regEx(`\\\\n${baseUrl}[^/]+/[^/]+/compare/[^\\\\n]+(\\\\n|$)`),\n '\\n',\n );\n // Reduce headings size\n body = body\n .replace(regEx(/\\n\\s*####? /g), '\\n##### ')\n .replace(regEx(/\\n\\s*## /g), '\\n#### ')\n .replace(regEx(/\\n\\s*# /g), '\\n### ');\n // Trim whitespace\n return body.trim();\n}\n\nexport function massageName(\n input: string | undefined | null,\n version: string | undefined,\n): string | undefined {\n let name = input ?? '';\n\n if (version) {\n name = name.replace(RegExp(`^(Release )?v?${version}`, 'i'), '').trim();\n }\n\n name = name.trim();\n if (!name.length) {\n return undefined;\n }\n\n return name;\n}\n\nexport async function getReleaseNotes(\n project: ChangeLogProject,\n release: ChangeLogRelease,\n config: BranchUpgradeConfig,\n): Promise<ChangeLogNotes | null> {\n const { packageName, depName, repository } = project;\n const { version, gitRef } = release;\n // TODO: types (#22198)\n logger.trace(\n `getReleaseNotes(${repository}, ${version}, ${packageName!}, ${depName!})`,\n );\n const releases = await getCachedReleaseList(project, release);\n logger.trace({ releases }, 'Release list from getReleaseList');\n let releaseNotes: ChangeLogNotes | null = null;\n\n let matchedRelease = getExactReleaseMatch(\n packageName!,\n depName!,\n version,\n releases,\n );\n if (is.undefined(matchedRelease)) {\n // no exact match of a release then check other cases\n matchedRelease = releases.find(\n (r) =>\n r.tag === version ||\n r.tag === `v${version}` ||\n r.tag === gitRef ||\n r.tag === `v${gitRef}`,\n );\n }\n if (is.undefined(matchedRelease) && config.extractVersion) {\n const extractVersionRegEx = regEx(config.extractVersion);\n matchedRelease = releases.find((r) => {\n const extractedVersion = extractVersionRegEx.exec(r.tag!)?.groups\n ?.version;\n return version === extractedVersion;\n });\n }\n releaseNotes = await releaseNotesResult(matchedRelease, project);\n logger.trace({ releaseNotes });\n return releaseNotes;\n}\n\nfunction getExactReleaseMatch(\n packageName: string,\n depName: string,\n version: string,\n releases: ChangeLogNotes[],\n): ChangeLogNotes | undefined {\n const exactReleaseReg = regEx(\n `(?:^|/)(?:${packageName}|${depName})[@_-]v?${version}`,\n );\n const candidateReleases = releases.filter((r) => r.tag?.endsWith(version));\n const matchedRelease = candidateReleases.find((r) =>\n exactReleaseReg.test(r.tag!),\n );\n return matchedRelease;\n}\n\nasync function releaseNotesResult(\n releaseMatch: ChangeLogNotes | undefined,\n project: ChangeLogProject,\n): Promise<ChangeLogNotes | null> {\n if (!releaseMatch) {\n return null;\n }\n const { baseUrl, repository } = project;\n const releaseNotes: ChangeLogNotes = releaseMatch;\n if (detectPlatform(baseUrl) === 'gitlab') {\n releaseNotes.url = `${baseUrl}${repository}/tags/${releaseMatch.tag!}`;\n } else {\n releaseNotes.url = releaseMatch.url\n ? releaseMatch.url\n : /* istanbul ignore next */\n `${baseUrl}${repository}/releases/${releaseMatch.tag!}`;\n }\n // set body for release notes\n releaseNotes.body = massageBody(releaseNotes.body, baseUrl);\n releaseNotes.name = massageName(releaseNotes.name, releaseNotes.tag);\n if (releaseNotes.body.length || releaseNotes.name?.length) {\n try {\n if (baseUrl !== 'https://gitlab.com/') {\n releaseNotes.body = await linkify(releaseNotes.body, {\n repository: `${baseUrl}${repository}`,\n });\n }\n } catch (err) /* istanbul ignore next */ {\n logger.warn({ err, baseUrl, repository }, 'Error linkifying');\n }\n } else {\n return null;\n }\n\n return releaseNotes;\n}\n\nfunction sectionize(text: string, level: number): string[] {\n const sections: [number, number][] = [];\n const lines = text.split(newlineRegex);\n const tokens = markdown.parse(text, undefined);\n tokens.forEach((token) => {\n if (token.type === 'heading_open') {\n const lev = +token.tag.substring(1);\n if (lev <= level) {\n sections.push([lev, token.map![0]]);\n }\n }\n });\n sections.push([-1, lines.length]);\n const result: string[] = [];\n for (let i = 1; i < sections.length; i += 1) {\n const [lev, start] = sections[i - 1];\n const [, end] = sections[i];\n if (lev === level) {\n result.push(lines.slice(start, end).join('\\n'));\n }\n }\n return result;\n}\n\nexport async function getReleaseNotesMdFileInner(\n project: ChangeLogProject,\n): Promise<ChangeLogFile | null> {\n const { repository, type } = project;\n const apiBaseUrl = project.apiBaseUrl;\n const sourceDirectory = project.sourceDirectory!;\n try {\n switch (type) {\n case 'gitea':\n return await gitea.getReleaseNotesMd(\n repository,\n apiBaseUrl,\n sourceDirectory,\n );\n case 'gitlab':\n return await gitlab.getReleaseNotesMd(\n repository,\n apiBaseUrl,\n sourceDirectory,\n );\n case 'github':\n return await github.getReleaseNotesMd(\n repository,\n apiBaseUrl,\n sourceDirectory,\n );\n case 'bitbucket':\n return await bitbucket.getReleaseNotesMd(\n repository,\n apiBaseUrl,\n sourceDirectory,\n );\n default:\n logger.warn({ apiBaseUrl, repository, type }, 'Invalid project type');\n return null;\n }\n } catch (err) /* istanbul ignore next */ {\n if (err.statusCode === 404) {\n logger.debug(\n { repository, type, apiBaseUrl },\n 'Error 404 getting changelog md',\n );\n } else {\n logger.debug(\n { err, repository, type, apiBaseUrl },\n 'Error getting changelog md',\n );\n }\n }\n return null;\n}\n\nexport function getReleaseNotesMdFile(\n project: ChangeLogProject,\n): Promise<ChangeLogFile | null> {\n const { sourceDirectory, repository, apiBaseUrl } = project;\n // TODO: types (#22198)\n const cacheKey = sourceDirectory\n ? `getReleaseNotesMdFile@v2-${repository}-${sourceDirectory}-${apiBaseUrl}`\n : `getReleaseNotesMdFile@v2-${repository}-${apiBaseUrl}`;\n const cachedResult = memCache.get<Promise<ChangeLogFile | null>>(cacheKey);\n // istanbul ignore if\n if (cachedResult !== undefined) {\n return cachedResult;\n }\n const promisedRes = getReleaseNotesMdFileInner(project);\n memCache.set(cacheKey, promisedRes);\n return promisedRes;\n}\n\nexport async function getReleaseNotesMd(\n project: ChangeLogProject,\n release: ChangeLogRelease,\n): Promise<ChangeLogNotes | null> {\n const { baseUrl, repository } = project;\n const version = release.version;\n logger.trace(`getReleaseNotesMd(${repository}, ${version})`);\n\n if (shouldSkipChangelogMd(repository)) {\n return null;\n }\n\n const changelog = await getReleaseNotesMdFile(project);\n if (!changelog) {\n return null;\n }\n const { changelogFile } = changelog;\n const changelogMd = changelog.changelogMd.replace(\n regEx(/\\n\\s*<a name=\"[^\"]*\">.*?<\\/a>\\n/g),\n '\\n',\n );\n for (const level of [1, 2, 3, 4, 5, 6, 7]) {\n const changelogParsed = sectionize(changelogMd, level);\n if (changelogParsed.length >= 2) {\n for (const section of changelogParsed) {\n try {\n // replace brackets and parenthesis with space\n const deParenthesizedSection = section.replace(\n regEx(/[[\\]()]/g),\n ' ',\n );\n const [heading] = deParenthesizedSection.split(newlineRegex);\n const title = heading\n .replace(regEx(/^\\s*#*\\s*/), '')\n .split(' ')\n .filter(Boolean);\n let body = section.replace(regEx(/.*?\\n(-{3,}\\n)?/), '').trim();\n for (const word of title) {\n if (word.includes(version) && !isHttpUrl(word)) {\n logger.trace({ body }, 'Found release notes for v' + version);\n // TODO: fix url\n const notesSourceUrl = joinUrlParts(\n baseUrl,\n repository,\n getSourceRootPath(project.type),\n 'HEAD',\n changelogFile,\n );\n const mdHeadingLink = title\n .filter((word) => !isHttpUrl(word))\n .join('-')\n .replace(regEx(/[^A-Za-z0-9-]/g), '');\n const url = `${notesSourceUrl}#${mdHeadingLink}`;\n body = massageBody(body, baseUrl);\n if (body?.length) {\n try {\n body = await linkify(body, {\n repository: `${baseUrl}${repository}`,\n });\n } catch (err) /* istanbul ignore next */ {\n logger.warn({ body, err }, 'linkify error');\n }\n }\n return {\n body,\n url,\n notesSourceUrl,\n };\n }\n }\n } catch (err) /* istanbul ignore next */ {\n logger.warn(\n { file: changelogFile, err },\n `Error parsing changelog file`,\n );\n }\n }\n }\n logger.trace({ repository }, `No level ${level} changelogs headings found`);\n }\n logger.trace({ repository, version }, `No entry found in ${changelogFile}`);\n return null;\n}\n\n/**\n * Determine how long to cache release notes based on when the version was released.\n *\n * It's not uncommon for release notes to be updated shortly after the release itself,\n * so only cache for about an hour when the release is less than a week old. Otherwise,\n * cache for days.\n */\nexport function releaseNotesCacheMinutes(releaseDate?: string | Date): number {\n const dt = is.date(releaseDate)\n ? DateTime.fromJSDate(releaseDate)\n : DateTime.fromISO(releaseDate!);\n\n const now = DateTime.local();\n\n if (!dt.isValid || now.diff(dt, 'days').days < 7) {\n return 55;\n }\n\n if (now.diff(dt, 'months').months < 6) {\n return 1435; // 5 minutes shy of one day\n }\n\n return 14495; // 5 minutes shy of 10 days\n}\n\nexport async function addReleaseNotes(\n input: ChangeLogResult | null | undefined,\n config: BranchUpgradeConfig,\n): Promise<ChangeLogResult | null> {\n if (!input?.versions || !input.project?.type) {\n logger.debug('Missing project or versions');\n return input ?? null;\n }\n const output: ChangeLogResult = {\n ...input,\n versions: [],\n hasReleaseNotes: false,\n };\n\n const { repository, sourceDirectory, type: projectType } = input.project;\n const cacheNamespace: PackageCacheNamespace = `changelog-${projectType}-notes@v2`;\n const cacheKeyPrefix = sourceDirectory\n ? `${repository}:${sourceDirectory}`\n : `${repository}`;\n\n for (const v of input.versions) {\n let releaseNotes: ChangeLogNotes | null | undefined;\n const cacheKey = `${cacheKeyPrefix}:${v.version}`;\n releaseNotes = await packageCache.get(cacheNamespace, cacheKey);\n releaseNotes ??= await getReleaseNotesMd(input.project, v);\n releaseNotes ??= await getReleaseNotes(input.project, v, config);\n\n // If there is no release notes, at least try to show the compare URL\n if (!releaseNotes && v.compare.url) {\n releaseNotes = { url: v.compare.url, notesSourceUrl: '' };\n }\n\n const cacheMinutes = releaseNotesCacheMinutes(v.date);\n await packageCache.set(\n cacheNamespace,\n cacheKey,\n releaseNotes,\n cacheMinutes,\n );\n output.versions!.push({\n ...v,\n releaseNotes: releaseNotes!,\n });\n\n if (releaseNotes) {\n output.hasReleaseNotes = true;\n }\n }\n return output;\n}\n\n/**\n * Skip fetching changelog/release-notes markdown files.\n * Will force a fallback to using GitHub release notes\n */\nexport function shouldSkipChangelogMd(repository: string): boolean {\n return repositoriesToSkipMdFetching.includes(repository);\n}\n\nfunction getSourceRootPath(type: ChangeLogPlatform): string {\n switch (type) {\n case 'bitbucket':\n return 'src';\n default:\n return 'blob';\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"release-notes.js","sourceRoot":"","sources":["../../../../../../lib/workers/repository/update/pr/changelog/release-notes.ts"],"names":[],"mappings":";;AA+BA,wCAoCC;AAED,oDAeC;AAED,kCA6BC;AAED,kCAgBC;AAED,0CA0CC;AA+ED,gEAwDC;AAED,sDAgBC;AAED,8CAgFC;AASD,4DAgBC;AAED,0CAiDC;AAMD,sDAEC;;AAhfD,kEAAkC;AAClC,iCAAiC;AACjC,sEAAqC;AACrC,kDAA+C;AAC/C,mFAA6D;AAC7D,wFAAkE;AAElE,uDAA4D;AAC5D,2DAAuD;AACvD,qDAAgE;AAChE,uDAA0D;AAC1D,iDAAkE;AAElE,+DAAyC;AACzC,4EAAsD;AACtD,uDAAiC;AACjC,yDAAmC;AACnC,yDAAmC;AASnC,MAAM,QAAQ,GAAG,IAAI,qBAAU,CAAC,MAAM,CAAC,CAAC;AACxC,QAAQ,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAEzC,MAAM,4BAA4B,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAExD,KAAK,UAAU,cAAc,CAClC,OAAyB,EACzB,OAAyB;IAEzB,eAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACjC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,OAAO,C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AED,SAAS,iBAAiB,CACxB,OAAe,EACf,UAAkB,EAClB,OAAyB,EACzB,aAAqB;IAErB,IAAI,OAAO,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;QACxC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3D,OAAO,IAAA,kBAAY,EACjB,OAAO,EACP,UAAU,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,QAAQ,EACR,aAAa,EACb,UAAU,CACX,CAAC;IACJ,CAAC;IAED,OAAO,IAAA,kBAAY,EACjB,OAAO,EACP,UAAU,EACV,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAC7C,MAAM,EACN,aAAa,CACd,CAAC;AACJ,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { DateTime } from 'luxon';\nimport MarkdownIt from 'markdown-it';\nimport { logger } from '../../../../../logger';\nimport * as memCache from '../../../../../util/cache/memory';\nimport * as packageCache from '../../../../../util/cache/package';\nimport type { PackageCacheNamespace } from '../../../../../util/cache/package/types';\nimport { detectPlatform } from '../../../../../util/common';\nimport { linkify } from '../../../../../util/markdown';\nimport { newlineRegex, regEx } from '../../../../../util/regex';\nimport { coerceString } from '../../../../../util/string';\nimport { isHttpUrl, joinUrlParts } from '../../../../../util/url';\nimport type { BranchUpgradeConfig } from '../../../../types';\nimport * as bitbucket from './bitbucket';\nimport * as bitbucketServer from './bitbucket-server';\nimport * as gitea from './gitea';\nimport * as github from './github';\nimport * as gitlab from './gitlab';\nimport type {\n ChangeLogFile,\n ChangeLogNotes,\n ChangeLogProject,\n ChangeLogRelease,\n ChangeLogResult,\n} from './types';\n\nconst markdown = new MarkdownIt('zero');\nmarkdown.enable(['heading', 'lheading']);\n\nconst repositoriesToSkipMdFetching = ['facebook/react-native'];\n\nexport async function getReleaseList(\n project: ChangeLogProject,\n release: ChangeLogRelease,\n): Promise<ChangeLogNotes[]> {\n logger.trace('getReleaseList()');\n const { apiBaseUrl, repository, type } = project;\n try {\n switch (type) {\n case 'gitea':\n return await gitea.getReleaseList(project, release);\n case 'gitlab':\n return await gitlab.getReleaseList(project, release);\n case 'github':\n return await github.getReleaseList(project, release);\n case 'bitbucket':\n return bitbucket.getReleaseList(project, release);\n case 'bitbucket-server':\n logger.trace(\n 'Unsupported Bitbucket Server feature. Skipping release fetching.',\n );\n return [];\n default:\n logger.warn({ apiBaseUrl, repository, type }, 'Invalid project type');\n return [];\n }\n } catch (err) /* istanbul ignore next */ {\n if (err.statusCode === 404) {\n logger.debug({ repository, type, apiBaseUrl }, 'getReleaseList 404');\n } else {\n logger.debug(\n { repository, type, apiBaseUrl, err },\n 'getReleaseList error',\n );\n }\n }\n return [];\n}\n\nexport function getCachedReleaseList(\n project: ChangeLogProject,\n release: ChangeLogRelease,\n): Promise<ChangeLogNotes[]> {\n const { repository, apiBaseUrl } = project;\n // TODO: types (#22198)\n const cacheKey = `getReleaseList-${apiBaseUrl}-${repository}`;\n const cachedResult = memCache.get<Promise<ChangeLogNotes[]>>(cacheKey);\n // istanbul ignore if\n if (cachedResult !== undefined) {\n return cachedResult;\n }\n const promisedRes = getReleaseList(project, release);\n memCache.set(cacheKey, promisedRes);\n return promisedRes;\n}\n\nexport function massageBody(\n input: string | undefined | null,\n baseUrl: string,\n): string {\n let body = coerceString(input);\n // Convert line returns\n body = body.replace(regEx(/\\r\\n/g), '\\n');\n // semantic-release cleanup\n body = body.replace(regEx(/^<a name=\"[^\"]*\"><\\/a>\\n/), '');\n body = body.replace(\n regEx(\n `^##? \\\\[[^\\\\]]*\\\\]\\\\(${baseUrl}[^/]*/[^/]*/compare/.*?\\\\n`,\n undefined,\n false,\n ),\n '',\n );\n // Clean-up unnecessary commits link\n body = `\\n${body}\\n`.replace(\n regEx(`\\\\n${baseUrl}[^/]+/[^/]+/compare/[^\\\\n]+(\\\\n|$)`),\n '\\n',\n );\n // Reduce headings size\n body = body\n .replace(regEx(/\\n\\s*####? /g), '\\n##### ')\n .replace(regEx(/\\n\\s*## /g), '\\n#### ')\n .replace(regEx(/\\n\\s*# /g), '\\n### ');\n // Trim whitespace\n return body.trim();\n}\n\nexport function massageName(\n input: string | undefined | null,\n version: string | undefined,\n): string | undefined {\n let name = input ?? '';\n\n if (version) {\n name = name.replace(RegExp(`^(Release )?v?${version}`, 'i'), '').trim();\n }\n\n name = name.trim();\n if (!name.length) {\n return undefined;\n }\n\n return name;\n}\n\nexport async function getReleaseNotes(\n project: ChangeLogProject,\n release: ChangeLogRelease,\n config: BranchUpgradeConfig,\n): Promise<ChangeLogNotes | null> {\n const { packageName, depName, repository } = project;\n const { version, gitRef } = release;\n // TODO: types (#22198)\n logger.trace(\n `getReleaseNotes(${repository}, ${version}, ${packageName!}, ${depName!})`,\n );\n const releases = await getCachedReleaseList(project, release);\n logger.trace({ releases }, 'Release list from getReleaseList');\n let releaseNotes: ChangeLogNotes | null = null;\n\n let matchedRelease = getExactReleaseMatch(\n packageName!,\n depName!,\n version,\n releases,\n );\n if (is.undefined(matchedRelease)) {\n // no exact match of a release then check other cases\n matchedRelease = releases.find(\n (r) =>\n r.tag === version ||\n r.tag === `v${version}` ||\n r.tag === gitRef ||\n r.tag === `v${gitRef}`,\n );\n }\n if (is.undefined(matchedRelease) && config.extractVersion) {\n const extractVersionRegEx = regEx(config.extractVersion);\n matchedRelease = releases.find((r) => {\n const extractedVersion = extractVersionRegEx.exec(r.tag!)?.groups\n ?.version;\n return version === extractedVersion;\n });\n }\n releaseNotes = await releaseNotesResult(matchedRelease, project);\n logger.trace({ releaseNotes });\n return releaseNotes;\n}\n\nfunction getExactReleaseMatch(\n packageName: string,\n depName: string,\n version: string,\n releases: ChangeLogNotes[],\n): ChangeLogNotes | undefined {\n const exactReleaseReg = regEx(\n `(?:^|/)(?:${packageName}|${depName})[@_-]v?${version}`,\n );\n const candidateReleases = releases.filter((r) => r.tag?.endsWith(version));\n const matchedRelease = candidateReleases.find((r) =>\n exactReleaseReg.test(r.tag!),\n );\n return matchedRelease;\n}\n\nasync function releaseNotesResult(\n releaseMatch: ChangeLogNotes | undefined,\n project: ChangeLogProject,\n): Promise<ChangeLogNotes | null> {\n if (!releaseMatch) {\n return null;\n }\n const { baseUrl, repository } = project;\n const releaseNotes: ChangeLogNotes = releaseMatch;\n if (detectPlatform(baseUrl) === 'gitlab') {\n releaseNotes.url = `${baseUrl}${repository}/tags/${releaseMatch.tag!}`;\n } else {\n releaseNotes.url = releaseMatch.url\n ? releaseMatch.url\n : /* istanbul ignore next */\n `${baseUrl}${repository}/releases/${releaseMatch.tag!}`;\n }\n // set body for release notes\n releaseNotes.body = massageBody(releaseNotes.body, baseUrl);\n releaseNotes.name = massageName(releaseNotes.name, releaseNotes.tag);\n if (releaseNotes.body.length || releaseNotes.name?.length) {\n try {\n if (baseUrl !== 'https://gitlab.com/') {\n releaseNotes.body = await linkify(releaseNotes.body, {\n repository: `${baseUrl}${repository}`,\n });\n }\n } catch (err) /* istanbul ignore next */ {\n logger.warn({ err, baseUrl, repository }, 'Error linkifying');\n }\n } else {\n return null;\n }\n\n return releaseNotes;\n}\n\nfunction sectionize(text: string, level: number): string[] {\n const sections: [number, number][] = [];\n const lines = text.split(newlineRegex);\n const tokens = markdown.parse(text, undefined);\n tokens.forEach((token) => {\n if (token.type === 'heading_open') {\n const lev = +token.tag.substring(1);\n if (lev <= level) {\n sections.push([lev, token.map![0]]);\n }\n }\n });\n sections.push([-1, lines.length]);\n const result: string[] = [];\n for (let i = 1; i < sections.length; i += 1) {\n const [lev, start] = sections[i - 1];\n const [, end] = sections[i];\n if (lev === level) {\n result.push(lines.slice(start, end).join('\\n'));\n }\n }\n return result;\n}\n\nexport async function getReleaseNotesMdFileInner(\n project: ChangeLogProject,\n): Promise<ChangeLogFile | null> {\n const { repository, type } = project;\n const apiBaseUrl = project.apiBaseUrl;\n const sourceDirectory = project.sourceDirectory!;\n try {\n switch (type) {\n case 'gitea':\n return await gitea.getReleaseNotesMd(\n repository,\n apiBaseUrl,\n sourceDirectory,\n );\n case 'gitlab':\n return await gitlab.getReleaseNotesMd(\n repository,\n apiBaseUrl,\n sourceDirectory,\n );\n case 'github':\n return await github.getReleaseNotesMd(\n repository,\n apiBaseUrl,\n sourceDirectory,\n );\n case 'bitbucket':\n return await bitbucket.getReleaseNotesMd(\n repository,\n apiBaseUrl,\n sourceDirectory,\n );\n case 'bitbucket-server':\n return await bitbucketServer.getReleaseNotesMd(\n repository,\n apiBaseUrl,\n sourceDirectory,\n );\n default:\n logger.warn({ apiBaseUrl, repository, type }, 'Invalid project type');\n return null;\n }\n } catch (err) /* istanbul ignore next */ {\n if (err.statusCode === 404) {\n logger.debug(\n { repository, type, apiBaseUrl },\n 'Error 404 getting changelog md',\n );\n } else {\n logger.debug(\n { err, repository, type, apiBaseUrl },\n 'Error getting changelog md',\n );\n }\n }\n return null;\n}\n\nexport function getReleaseNotesMdFile(\n project: ChangeLogProject,\n): Promise<ChangeLogFile | null> {\n const { sourceDirectory, repository, apiBaseUrl } = project;\n // TODO: types (#22198)\n const cacheKey = sourceDirectory\n ? `getReleaseNotesMdFile@v2-${repository}-${sourceDirectory}-${apiBaseUrl}`\n : `getReleaseNotesMdFile@v2-${repository}-${apiBaseUrl}`;\n const cachedResult = memCache.get<Promise<ChangeLogFile | null>>(cacheKey);\n // istanbul ignore if\n if (cachedResult !== undefined) {\n return cachedResult;\n }\n const promisedRes = getReleaseNotesMdFileInner(project);\n memCache.set(cacheKey, promisedRes);\n return promisedRes;\n}\n\nexport async function getReleaseNotesMd(\n project: ChangeLogProject,\n release: ChangeLogRelease,\n): Promise<ChangeLogNotes | null> {\n const { baseUrl, repository } = project;\n const version = release.version;\n logger.trace(`getReleaseNotesMd(${repository}, ${version})`);\n\n if (shouldSkipChangelogMd(repository)) {\n return null;\n }\n\n const changelog = await getReleaseNotesMdFile(project);\n if (!changelog) {\n return null;\n }\n const { changelogFile } = changelog;\n const changelogMd = changelog.changelogMd.replace(\n regEx(/\\n\\s*<a name=\"[^\"]*\">.*?<\\/a>\\n/g),\n '\\n',\n );\n for (const level of [1, 2, 3, 4, 5, 6, 7]) {\n const changelogParsed = sectionize(changelogMd, level);\n if (changelogParsed.length >= 2) {\n for (const section of changelogParsed) {\n try {\n // replace brackets and parenthesis with space\n const deParenthesizedSection = section.replace(\n regEx(/[[\\]()]/g),\n ' ',\n );\n const [heading] = deParenthesizedSection.split(newlineRegex);\n const title = heading\n .replace(regEx(/^\\s*#*\\s*/), '')\n .split(' ')\n .filter(Boolean);\n let body = section.replace(regEx(/.*?\\n(-{3,}\\n)?/), '').trim();\n for (const word of title) {\n if (word.includes(version) && !isHttpUrl(word)) {\n logger.trace({ body }, 'Found release notes for v' + version);\n const notesSourceUrl = getNotesSourceUrl(\n baseUrl,\n repository,\n project,\n changelogFile,\n );\n const mdHeadingLink = title\n .filter((word) => !isHttpUrl(word))\n .join('-')\n .replace(regEx(/[^A-Za-z0-9-]/g), '');\n const url = `${notesSourceUrl}#${mdHeadingLink}`;\n body = massageBody(body, baseUrl);\n if (body?.length) {\n try {\n body = await linkify(body, {\n repository: `${baseUrl}${repository}`,\n });\n } catch (err) /* istanbul ignore next */ {\n logger.warn({ body, err }, 'linkify error');\n }\n }\n return {\n body,\n url,\n notesSourceUrl,\n };\n }\n }\n } catch (err) /* istanbul ignore next */ {\n logger.warn(\n { file: changelogFile, err },\n `Error parsing changelog file`,\n );\n }\n }\n }\n logger.trace({ repository }, `No level ${level} changelogs headings found`);\n }\n logger.trace({ repository, version }, `No entry found in ${changelogFile}`);\n return null;\n}\n\n/**\n * Determine how long to cache release notes based on when the version was released.\n *\n * It's not uncommon for release notes to be updated shortly after the release itself,\n * so only cache for about an hour when the release is less than a week old. Otherwise,\n * cache for days.\n */\nexport function releaseNotesCacheMinutes(releaseDate?: string | Date): number {\n const dt = is.date(releaseDate)\n ? DateTime.fromJSDate(releaseDate)\n : DateTime.fromISO(releaseDate!);\n\n const now = DateTime.local();\n\n if (!dt.isValid || now.diff(dt, 'days').days < 7) {\n return 55;\n }\n\n if (now.diff(dt, 'months').months < 6) {\n return 1435; // 5 minutes shy of one day\n }\n\n return 14495; // 5 minutes shy of 10 days\n}\n\nexport async function addReleaseNotes(\n input: ChangeLogResult | null | undefined,\n config: BranchUpgradeConfig,\n): Promise<ChangeLogResult | null> {\n if (!input?.versions || !input.project?.type) {\n logger.debug('Missing project or versions');\n return input ?? null;\n }\n const output: ChangeLogResult = {\n ...input,\n versions: [],\n hasReleaseNotes: false,\n };\n\n const { repository, sourceDirectory, type: projectType } = input.project;\n const cacheNamespace: PackageCacheNamespace = `changelog-${projectType}-notes@v2`;\n const cacheKeyPrefix = sourceDirectory\n ? `${repository}:${sourceDirectory}`\n : `${repository}`;\n\n for (const v of input.versions) {\n let releaseNotes: ChangeLogNotes | null | undefined;\n const cacheKey = `${cacheKeyPrefix}:${v.version}`;\n releaseNotes = await packageCache.get(cacheNamespace, cacheKey);\n releaseNotes ??= await getReleaseNotesMd(input.project, v);\n releaseNotes ??= await getReleaseNotes(input.project, v, config);\n\n // If there is no release notes, at least try to show the compare URL\n if (!releaseNotes && v.compare.url) {\n releaseNotes = { url: v.compare.url, notesSourceUrl: '' };\n }\n\n const cacheMinutes = releaseNotesCacheMinutes(v.date);\n await packageCache.set(\n cacheNamespace,\n cacheKey,\n releaseNotes,\n cacheMinutes,\n );\n output.versions!.push({\n ...v,\n releaseNotes: releaseNotes!,\n });\n\n if (releaseNotes) {\n output.hasReleaseNotes = true;\n }\n }\n return output;\n}\n\n/**\n * Skip fetching changelog/release-notes markdown files.\n * Will force a fallback to using GitHub release notes\n */\nexport function shouldSkipChangelogMd(repository: string): boolean {\n return repositoriesToSkipMdFetching.includes(repository);\n}\n\nfunction getNotesSourceUrl(\n baseUrl: string,\n repository: string,\n project: ChangeLogProject,\n changelogFile: string,\n): string {\n if (project.type === 'bitbucket-server') {\n const [projectKey, repositorySlug] = repository.split('/');\n return joinUrlParts(\n baseUrl,\n 'projects',\n projectKey,\n 'repos',\n repositorySlug,\n 'browse',\n changelogFile,\n '?at=HEAD',\n );\n }\n\n return joinUrlParts(\n baseUrl,\n repository,\n project.type === 'bitbucket' ? 'src' : 'blob',\n 'HEAD',\n changelogFile,\n );\n}\n"]}
|
@@ -4,7 +4,7 @@ export declare abstract class ChangeLogSource {
|
|
4
4
|
private readonly platform;
|
5
5
|
private readonly datasource;
|
6
6
|
private readonly cacheNamespace;
|
7
|
-
constructor(platform: ChangeLogPlatform, datasource: 'bitbucket-tags' | 'gitea-tags' | 'github-tags' | 'gitlab-tags');
|
7
|
+
constructor(platform: ChangeLogPlatform, datasource: 'bitbucket-tags' | 'bitbucket-server-tags' | 'gitea-tags' | 'github-tags' | 'gitlab-tags');
|
8
8
|
abstract getCompareURL(baseUrl: string, repository: string, prevHead: string, nextHead: string): string;
|
9
9
|
abstract getAPIBaseUrl(config: BranchUpgradeConfig): string;
|
10
10
|
getAllTags(endpoint: string, repository: string): Promise<string[]>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../../../../../lib/workers/repository/update/pr/changelog/source.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAClC,kDAA+C;AAC/C,kEAAmE;AAEnE,yFAAmE;AACnE,wFAAkE;AAElE,yDAAsD;AACtD,qDAAkD;AAClD,iDAAgE;AAEhE,qCAAsC;AACtC,mDAAkD;AAClD,yCAAgD;AAQhD,MAAsB,eAAe;IAIhB;IACA;IAJF,cAAc,CAAwB;IAEvD,YACmB,QAA2B,EAC3B,UAIA;QALA,aAAQ,GAAR,QAAQ,CAAmB;QAC3B,eAAU,GAAV,UAAU,CAIV;QAEjB,IAAI,CAAC,cAAc,GAAG,aAAa,QAAQ,UAAU,CAAC;IACxD,CAAC;IAWD,KAAK,CAAC,UAAU,CAAC,QAAgB,EAAE,UAAkB;QACnD,MAAM,IAAI,GAAG,CACX,MAAM,IAAA,2BAAc,EAAC;YACnB,YAAY,EAAE,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S,CAAC,IAAI,WAAW,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;IACnE,CAAC;IAED,UAAU,CAAC,MAA2B;QACpC,MAAM,SAAS,GAAG,IAAA,cAAQ,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,YAAE,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC;YAClC,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAA,aAAK,EAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;QAC5B,OAAO,GAAG,QAAQ,KAAK,IAAI,GAAG,CAAC;IACjC,CAAC;IAED,oBAAoB,CAAC,MAA2B;QAC9C,MAAM,SAAS,GAAG,IAAA,cAAQ,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,YAAE,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC;YAClC,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;QACpC,OAAO,IAAA,iBAAW,EAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAA,aAAK,EAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5D,CAAC;IAES,aAAa,CAAC,MAA2B;QAIjD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAES,iBAAiB,CAAC,MAA2B;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,kBAAkB,CAAC,UAAkB;QACnC,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IAC5C,CAAC;CACF;AAzQD,0CAyQC","sourcesContent":["import is from '@sindresorhus/is';\nimport { logger } from '../../../../../logger';\nimport { getPkgReleases } from '../../../../../modules/datasource';\nimport type { Release } from '../../../../../modules/datasource/types';\nimport * as allVersioning from '../../../../../modules/versioning';\nimport * as packageCache from '../../../../../util/cache/package';\nimport type { PackageCacheNamespace } from '../../../../../util/cache/package/types';\nimport { memoize } from '../../../../../util/memoize';\nimport { regEx } from '../../../../../util/regex';\nimport { parseUrl, trimSlashes } from '../../../../../util/url';\nimport type { BranchUpgradeConfig } from '../../../../types';\nimport { slugifyUrl } from './common';\nimport { addReleaseNotes } from './release-notes';\nimport { getInRangeReleases } from './releases';\nimport type {\n ChangeLogError,\n ChangeLogPlatform,\n ChangeLogRelease,\n ChangeLogResult,\n} from './types';\n\nexport abstract class ChangeLogSource {\n private readonly cacheNamespace: PackageCacheNamespace;\n\n constructor(\n private readonly platform: ChangeLogPlatform,\n private readonly datasource:\n | 'bitbucket-tags'\n | 'gitea-tags'\n | 'github-tags'\n | 'gitlab-tags',\n ) {\n this.cacheNamespace = `changelog-${platform}-release`;\n }\n\n abstract getCompareURL(\n baseUrl: string,\n repository: string,\n prevHead: string,\n nextHead: string,\n ): string;\n\n abstract getAPIBaseUrl(config: BranchUpgradeConfig): string;\n\n async getAllTags(endpoint: string, repository: string): Promise<string[]> {\n const tags = (\n await getPkgReleases({\n registryUrls: [endpoint],\n datasource: this.datasource,\n packageName: repository,\n versioning:\n 'regex:(?<major>\\\\d+)(\\\\.(?<minor>\\\\d+))?(\\\\.(?<patch>\\\\d+))?',\n })\n )?.releases;\n\n if (is.nullOrUndefined(tags) || is.emptyArray(tags)) {\n logger.debug(\n `No ${this.datasource} tags found for repository: ${repository}`,\n );\n\n return [];\n }\n\n return tags.map(({ version }) => version);\n }\n\n public async getChangeLogJSON(\n config: BranchUpgradeConfig,\n ): Promise<ChangeLogResult | null> {\n logger.trace(`getChangeLogJSON for ${this.platform}`);\n\n const versioning = config.versioning!;\n const currentVersion = config.currentVersion!;\n const newVersion = config.newVersion!;\n const sourceUrl = config.sourceUrl!;\n const packageName = config.packageName!;\n const depName = config.depName!;\n const sourceDirectory = config.sourceDirectory;\n const versioningApi = allVersioning.get(versioning);\n\n if (this.shouldSkipPackage(config)) {\n return null;\n }\n\n const baseUrl = this.getBaseUrl(config);\n const apiBaseUrl = this.getAPIBaseUrl(config);\n const repository = this.getRepositoryFromUrl(config);\n\n const tokenResponse = this.hasValidToken(config);\n if (!tokenResponse.isValid) {\n if (tokenResponse.error) {\n return {\n error: tokenResponse.error,\n };\n }\n return null;\n }\n\n if (is.falsy(this.hasValidRepository(repository))) {\n logger.debug(`Invalid ${this.platform} URL found: ${sourceUrl}`);\n return null;\n }\n\n const releases = config.releases ?? (await getInRangeReleases(config));\n if (!releases?.length) {\n logger.debug('No releases');\n return null;\n }\n // This extra filter/sort should not be necessary, but better safe than sorry\n const validReleases = [...releases]\n .filter((release) => versioningApi.isVersion(release.version))\n .sort((a, b) => versioningApi.sortVersions(a.version, b.version));\n\n if (validReleases.length < 2) {\n logger.debug(\n `Not enough valid releases for dep ${depName} (${packageName})`,\n );\n return null;\n }\n\n const changelogReleases: ChangeLogRelease[] = [];\n\n // Check if `v` belongs to the range (currentVersion, newVersion]\n const inRange = (v: string): boolean =>\n versioningApi.isGreaterThan(v, currentVersion) &&\n !versioningApi.isGreaterThan(v, newVersion);\n\n const getTags = memoize(() => this.getAllTags(apiBaseUrl, repository));\n for (let i = 1; i < validReleases.length; i += 1) {\n const prev = validReleases[i - 1];\n const next = validReleases[i];\n if (!inRange(next.version)) {\n continue;\n }\n let release = await packageCache.get(\n this.cacheNamespace,\n this.getCacheKey(sourceUrl, packageName, prev.version, next.version),\n );\n if (!release) {\n release = {\n version: next.version,\n date: next.releaseTimestamp,\n gitRef: next.gitRef,\n // put empty changes so that existing templates won't break\n changes: [],\n compare: {},\n };\n const tags = await getTags();\n const prevHead = this.getRef(\n versioningApi,\n packageName,\n depName,\n prev,\n tags,\n );\n const nextHead = this.getRef(\n versioningApi,\n packageName,\n depName,\n next,\n tags,\n );\n if (is.nonEmptyString(prevHead) && is.nonEmptyString(nextHead)) {\n release.compare.url = this.getCompareURL(\n baseUrl,\n repository,\n prevHead,\n nextHead,\n );\n }\n const cacheMinutes = 55;\n await packageCache.set(\n this.cacheNamespace,\n this.getCacheKey(sourceUrl, packageName, prev.version, next.version),\n release,\n cacheMinutes,\n );\n }\n changelogReleases.unshift(release);\n }\n\n let res: ChangeLogResult | null = {\n project: {\n apiBaseUrl,\n baseUrl,\n type: this.platform,\n repository,\n sourceUrl,\n sourceDirectory,\n packageName,\n depName,\n },\n versions: changelogReleases,\n };\n\n res = await addReleaseNotes(res, config);\n\n return res;\n }\n\n private findTagOfRelease(\n versioningApi: allVersioning.VersioningApi,\n packageName: string,\n depName: string,\n depNewVersion: string,\n tags: string[],\n ): string | undefined {\n const releaseRegexPrefix = `^(?:${packageName}|${depName}|release)[@_-]v?`;\n const regex = regEx(releaseRegexPrefix, undefined, false);\n const exactReleaseRegex = regEx(`${releaseRegexPrefix}${depNewVersion}`);\n const exactTagsList = tags.filter((tag) => {\n return exactReleaseRegex.test(tag);\n });\n const tagList = exactTagsList.length ? exactTagsList : tags;\n return tagList\n .filter((tag) => versioningApi.isVersion(tag.replace(regex, '')))\n .find((tag) =>\n versioningApi.equals(tag.replace(regex, ''), depNewVersion),\n );\n }\n\n private getRef(\n versioningApi: allVersioning.VersioningApi,\n packageName: string,\n depName: string,\n release: Release,\n tags: string[],\n ): string | null {\n const tagName = this.findTagOfRelease(\n versioningApi,\n packageName,\n depName,\n release.version,\n tags,\n );\n if (is.nonEmptyString(tagName)) {\n return tagName;\n }\n if (is.nonEmptyString(release.gitRef)) {\n return release.gitRef;\n }\n return null;\n }\n\n private getCacheKey(\n sourceUrl: string,\n packageName: string,\n prev: string,\n next: string,\n ): string {\n return `${slugifyUrl(sourceUrl)}:${packageName}:${prev}:${next}`;\n }\n\n getBaseUrl(config: BranchUpgradeConfig): string {\n const parsedUrl = parseUrl(config.sourceUrl);\n if (is.nullOrUndefined(parsedUrl)) {\n return '';\n }\n const protocol = parsedUrl.protocol.replace(regEx(/^git\\+/), '');\n const host = parsedUrl.host;\n return `${protocol}//${host}/`;\n }\n\n getRepositoryFromUrl(config: BranchUpgradeConfig): string {\n const parsedUrl = parseUrl(config.sourceUrl);\n if (is.nullOrUndefined(parsedUrl)) {\n return '';\n }\n const pathname = parsedUrl.pathname;\n return trimSlashes(pathname).replace(regEx(/\\.git$/), '');\n }\n\n protected hasValidToken(config: BranchUpgradeConfig): {\n isValid: boolean;\n error?: ChangeLogError;\n } {\n return { isValid: true };\n }\n\n protected shouldSkipPackage(config: BranchUpgradeConfig): boolean {\n return false;\n }\n\n hasValidRepository(repository: string): boolean {\n return repository.split('/').length === 2;\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../../../../../lib/workers/repository/update/pr/changelog/source.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAClC,kDAA+C;AAC/C,kEAAmE;AAEnE,yFAAmE;AACnE,wFAAkE;AAElE,yDAAsD;AACtD,qDAAkD;AAClD,iDAAgE;AAEhE,qCAAsC;AACtC,mDAAkD;AAClD,yCAAgD;AAQhD,MAAsB,eAAe;IAIhB;IACA;IAJF,cAAc,CAAwB;IAEvD,YACmB,QAA2B,EAC3B,UAKA;QANA,aAAQ,GAAR,QAAQ,CAAmB;QAC3B,eAAU,GAAV,UAAU,CAKV;QAEjB,IAAI,CAAC,cAAc,GAAG,aAAa,QAAQ,UAAU,CAAC;IACxD,CAAC;IAWD,KAAK,CAAC,UAAU,CAAC,QAAgB,EAAE,UAAkB;QACnD,MAAM,IAAI,GAAG,CACX,MAAM,IAAA,2BAAc,EAAC;YACnB,YAAY,EAAE,CAAC,QAAQ,CAAC;YACxB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,WAAW,EAAE,UAAU;YACvB,UAAU,EACR,8DAA8D;SACjE,CAAC,CACH,EAAE,QAAQ,CAAC;QAEZ,IAAI,YAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,YAAE,CAAC,UAAU,CAA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E,CAAC;YAClC,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAA,aAAK,EAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;QAC5B,OAAO,GAAG,QAAQ,KAAK,IAAI,GAAG,CAAC;IACjC,CAAC;IAED,oBAAoB,CAAC,MAA2B;QAC9C,MAAM,SAAS,GAAG,IAAA,cAAQ,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,YAAE,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC;YAClC,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;QACpC,OAAO,IAAA,iBAAW,EAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAA,aAAK,EAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5D,CAAC;IAES,aAAa,CAAC,MAA2B;QAIjD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAES,iBAAiB,CAAC,MAA2B;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,kBAAkB,CAAC,UAAkB;QACnC,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IAC5C,CAAC;CACF;AA1QD,0CA0QC","sourcesContent":["import is from '@sindresorhus/is';\nimport { logger } from '../../../../../logger';\nimport { getPkgReleases } from '../../../../../modules/datasource';\nimport type { Release } from '../../../../../modules/datasource/types';\nimport * as allVersioning from '../../../../../modules/versioning';\nimport * as packageCache from '../../../../../util/cache/package';\nimport type { PackageCacheNamespace } from '../../../../../util/cache/package/types';\nimport { memoize } from '../../../../../util/memoize';\nimport { regEx } from '../../../../../util/regex';\nimport { parseUrl, trimSlashes } from '../../../../../util/url';\nimport type { BranchUpgradeConfig } from '../../../../types';\nimport { slugifyUrl } from './common';\nimport { addReleaseNotes } from './release-notes';\nimport { getInRangeReleases } from './releases';\nimport type {\n ChangeLogError,\n ChangeLogPlatform,\n ChangeLogRelease,\n ChangeLogResult,\n} from './types';\n\nexport abstract class ChangeLogSource {\n private readonly cacheNamespace: PackageCacheNamespace;\n\n constructor(\n private readonly platform: ChangeLogPlatform,\n private readonly datasource:\n | 'bitbucket-tags'\n | 'bitbucket-server-tags'\n | 'gitea-tags'\n | 'github-tags'\n | 'gitlab-tags',\n ) {\n this.cacheNamespace = `changelog-${platform}-release`;\n }\n\n abstract getCompareURL(\n baseUrl: string,\n repository: string,\n prevHead: string,\n nextHead: string,\n ): string;\n\n abstract getAPIBaseUrl(config: BranchUpgradeConfig): string;\n\n async getAllTags(endpoint: string, repository: string): Promise<string[]> {\n const tags = (\n await getPkgReleases({\n registryUrls: [endpoint],\n datasource: this.datasource,\n packageName: repository,\n versioning:\n 'regex:(?<major>\\\\d+)(\\\\.(?<minor>\\\\d+))?(\\\\.(?<patch>\\\\d+))?',\n })\n )?.releases;\n\n if (is.nullOrUndefined(tags) || is.emptyArray(tags)) {\n logger.debug(\n `No ${this.datasource} tags found for repository: ${repository}`,\n );\n\n return [];\n }\n\n return tags.map(({ version }) => version);\n }\n\n public async getChangeLogJSON(\n config: BranchUpgradeConfig,\n ): Promise<ChangeLogResult | null> {\n logger.trace(`getChangeLogJSON for ${this.platform}`);\n\n const versioning = config.versioning!;\n const currentVersion = config.currentVersion!;\n const newVersion = config.newVersion!;\n const sourceUrl = config.sourceUrl!;\n const packageName = config.packageName!;\n const depName = config.depName!;\n const sourceDirectory = config.sourceDirectory;\n const versioningApi = allVersioning.get(versioning);\n\n if (this.shouldSkipPackage(config)) {\n return null;\n }\n\n const baseUrl = this.getBaseUrl(config);\n const apiBaseUrl = this.getAPIBaseUrl(config);\n const repository = this.getRepositoryFromUrl(config);\n\n const tokenResponse = this.hasValidToken(config);\n if (!tokenResponse.isValid) {\n if (tokenResponse.error) {\n return {\n error: tokenResponse.error,\n };\n }\n return null;\n }\n\n if (is.falsy(this.hasValidRepository(repository))) {\n logger.debug(`Invalid ${this.platform} URL found: ${sourceUrl}`);\n return null;\n }\n\n const releases = config.releases ?? (await getInRangeReleases(config));\n if (!releases?.length) {\n logger.debug('No releases');\n return null;\n }\n // This extra filter/sort should not be necessary, but better safe than sorry\n const validReleases = [...releases]\n .filter((release) => versioningApi.isVersion(release.version))\n .sort((a, b) => versioningApi.sortVersions(a.version, b.version));\n\n if (validReleases.length < 2) {\n logger.debug(\n `Not enough valid releases for dep ${depName} (${packageName})`,\n );\n return null;\n }\n\n const changelogReleases: ChangeLogRelease[] = [];\n\n // Check if `v` belongs to the range (currentVersion, newVersion]\n const inRange = (v: string): boolean =>\n versioningApi.isGreaterThan(v, currentVersion) &&\n !versioningApi.isGreaterThan(v, newVersion);\n\n const getTags = memoize(() => this.getAllTags(apiBaseUrl, repository));\n for (let i = 1; i < validReleases.length; i += 1) {\n const prev = validReleases[i - 1];\n const next = validReleases[i];\n if (!inRange(next.version)) {\n continue;\n }\n let release = await packageCache.get(\n this.cacheNamespace,\n this.getCacheKey(sourceUrl, packageName, prev.version, next.version),\n );\n if (!release) {\n release = {\n version: next.version,\n date: next.releaseTimestamp,\n gitRef: next.gitRef,\n // put empty changes so that existing templates won't break\n changes: [],\n compare: {},\n };\n const tags = await getTags();\n const prevHead = this.getRef(\n versioningApi,\n packageName,\n depName,\n prev,\n tags,\n );\n const nextHead = this.getRef(\n versioningApi,\n packageName,\n depName,\n next,\n tags,\n );\n if (is.nonEmptyString(prevHead) && is.nonEmptyString(nextHead)) {\n release.compare.url = this.getCompareURL(\n baseUrl,\n repository,\n prevHead,\n nextHead,\n );\n }\n const cacheMinutes = 55;\n await packageCache.set(\n this.cacheNamespace,\n this.getCacheKey(sourceUrl, packageName, prev.version, next.version),\n release,\n cacheMinutes,\n );\n }\n changelogReleases.unshift(release);\n }\n\n let res: ChangeLogResult | null = {\n project: {\n apiBaseUrl,\n baseUrl,\n type: this.platform,\n repository,\n sourceUrl,\n sourceDirectory,\n packageName,\n depName,\n },\n versions: changelogReleases,\n };\n\n res = await addReleaseNotes(res, config);\n\n return res;\n }\n\n private findTagOfRelease(\n versioningApi: allVersioning.VersioningApi,\n packageName: string,\n depName: string,\n depNewVersion: string,\n tags: string[],\n ): string | undefined {\n const releaseRegexPrefix = `^(?:${packageName}|${depName}|release)[@_-]v?`;\n const regex = regEx(releaseRegexPrefix, undefined, false);\n const exactReleaseRegex = regEx(`${releaseRegexPrefix}${depNewVersion}`);\n const exactTagsList = tags.filter((tag) => {\n return exactReleaseRegex.test(tag);\n });\n const tagList = exactTagsList.length ? exactTagsList : tags;\n return tagList\n .filter((tag) => versioningApi.isVersion(tag.replace(regex, '')))\n .find((tag) =>\n versioningApi.equals(tag.replace(regex, ''), depNewVersion),\n );\n }\n\n private getRef(\n versioningApi: allVersioning.VersioningApi,\n packageName: string,\n depName: string,\n release: Release,\n tags: string[],\n ): string | null {\n const tagName = this.findTagOfRelease(\n versioningApi,\n packageName,\n depName,\n release.version,\n tags,\n );\n if (is.nonEmptyString(tagName)) {\n return tagName;\n }\n if (is.nonEmptyString(release.gitRef)) {\n return release.gitRef;\n }\n return null;\n }\n\n private getCacheKey(\n sourceUrl: string,\n packageName: string,\n prev: string,\n next: string,\n ): string {\n return `${slugifyUrl(sourceUrl)}:${packageName}:${prev}:${next}`;\n }\n\n getBaseUrl(config: BranchUpgradeConfig): string {\n const parsedUrl = parseUrl(config.sourceUrl);\n if (is.nullOrUndefined(parsedUrl)) {\n return '';\n }\n const protocol = parsedUrl.protocol.replace(regEx(/^git\\+/), '');\n const host = parsedUrl.host;\n return `${protocol}//${host}/`;\n }\n\n getRepositoryFromUrl(config: BranchUpgradeConfig): string {\n const parsedUrl = parseUrl(config.sourceUrl);\n if (is.nullOrUndefined(parsedUrl)) {\n return '';\n }\n const pathname = parsedUrl.pathname;\n return trimSlashes(pathname).replace(regEx(/\\.git$/), '');\n }\n\n protected hasValidToken(config: BranchUpgradeConfig): {\n isValid: boolean;\n error?: ChangeLogError;\n } {\n return { isValid: true };\n }\n\n protected shouldSkipPackage(config: BranchUpgradeConfig): boolean {\n return false;\n }\n\n hasValidRepository(repository: string): boolean {\n return repository.split('/').length === 2;\n }\n}\n"]}
|
@@ -21,7 +21,7 @@ export interface ChangeLogRelease {
|
|
21
21
|
version: string;
|
22
22
|
gitRef: string;
|
23
23
|
}
|
24
|
-
export type ChangeLogPlatform = 'bitbucket' | 'gitea' | 'github' | 'gitlab';
|
24
|
+
export type ChangeLogPlatform = 'bitbucket' | 'bitbucket-server' | 'gitea' | 'github' | 'gitlab';
|
25
25
|
export interface ChangeLogProject {
|
26
26
|
packageName?: string;
|
27
27
|
depName?: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../lib/workers/repository/update/pr/changelog/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface ChangeLogNotes {\n body?: string;\n id?: number;\n name?: string;\n tag?: string;\n // url to changelog.md file or github/gitlab release api\n notesSourceUrl: string;\n url: string;\n}\n\nexport interface ChangeLogChange {\n date: Date;\n message: string;\n sha: string;\n}\n\nexport interface ChangeLogRelease {\n changes: ChangeLogChange[];\n compare: { url?: string };\n date: string | Date;\n releaseNotes?: ChangeLogNotes;\n version: string;\n gitRef: string;\n}\n\nexport type ChangeLogPlatform
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../lib/workers/repository/update/pr/changelog/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface ChangeLogNotes {\n body?: string;\n id?: number;\n name?: string;\n tag?: string;\n // url to changelog.md file or github/gitlab release api\n notesSourceUrl: string;\n url: string;\n}\n\nexport interface ChangeLogChange {\n date: Date;\n message: string;\n sha: string;\n}\n\nexport interface ChangeLogRelease {\n changes: ChangeLogChange[];\n compare: { url?: string };\n date: string | Date;\n releaseNotes?: ChangeLogNotes;\n version: string;\n gitRef: string;\n}\n\nexport type ChangeLogPlatform =\n | 'bitbucket'\n | 'bitbucket-server'\n | 'gitea'\n | 'github'\n | 'gitlab';\n\nexport interface ChangeLogProject {\n packageName?: string;\n depName?: string;\n type: ChangeLogPlatform;\n apiBaseUrl: string;\n baseUrl: string;\n repository: string;\n sourceUrl: string;\n sourceDirectory?: string;\n}\n\nexport type ChangeLogError =\n | 'MissingBitbucketToken'\n | 'MissingGithubToken'\n | 'MissingGitlabToken';\n\nexport interface ChangeLogResult {\n hasReleaseNotes?: boolean;\n project?: ChangeLogProject;\n versions?: ChangeLogRelease[];\n error?: ChangeLogError;\n}\n\nexport interface ChangeLogFile {\n changelogFile: string;\n changelogMd: string;\n}\n"]}
|