renovate 42.66.11 → 42.66.12
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/error-messages.d.ts +0 -2
- package/dist/constants/error-messages.js +0 -2
- package/dist/constants/error-messages.js.map +1 -1
- package/dist/util/cache/package/namespaces.d.ts +1 -1
- package/dist/util/cache/package/namespaces.js +1 -0
- package/dist/util/cache/package/namespaces.js.map +1 -1
- package/dist/util/github/graphql/cache-strategies/abstract-cache-strategy.d.ts +2 -1
- package/dist/util/github/graphql/cache-strategies/abstract-cache-strategy.js +7 -2
- package/dist/util/github/graphql/cache-strategies/abstract-cache-strategy.js.map +1 -1
- package/dist/util/github/graphql/datasource-fetcher.js +10 -2
- package/dist/util/github/graphql/datasource-fetcher.js.map +1 -1
- package/dist/util/github/graphql/index.d.ts +2 -1
- package/dist/util/github/graphql/index.js +6 -0
- package/dist/util/github/graphql/index.js.map +1 -1
- package/dist/util/github/graphql/query-adapters/branches-query-adapter.d.ts +40 -0
- package/dist/util/github/graphql/query-adapters/branches-query-adapter.js +48 -0
- package/dist/util/github/graphql/query-adapters/branches-query-adapter.js.map +1 -0
- package/dist/util/github/graphql/types.d.ts +13 -0
- package/dist/util/github/graphql/types.js.map +1 -1
- package/package.json +5 -5
- package/renovate-schema.json +2 -2
|
@@ -8,7 +8,6 @@ export declare const PLATFORM_INTEGRATION_UNAUTHORIZED = "integration-unauthoriz
|
|
|
8
8
|
export declare const PLATFORM_NOT_FOUND = "platform-not-found";
|
|
9
9
|
export declare const PLATFORM_RATE_LIMIT_EXCEEDED = "rate-limit-exceeded";
|
|
10
10
|
export declare const PLATFORM_UNKNOWN_ERROR = "platform-unknown-error";
|
|
11
|
-
/** cause repo to be considered as disabled */
|
|
12
11
|
export declare const PlatformErrors: readonly ["authentication-error", "bad-credentials", "gpg-failed", "integration-unauthorized", "platform-not-found", "rate-limit-exceeded", "platform-unknown-error"];
|
|
13
12
|
export declare const CONFIG_VALIDATION = "config-validation";
|
|
14
13
|
export declare const CONFIG_PRESETS_INVALID = "config-presets-invalid";
|
|
@@ -18,7 +17,6 @@ export declare const CONFIG_VARIABLES_INVALID = "config-variables-invalid";
|
|
|
18
17
|
export declare const CONFIG_GIT_URL_UNAVAILABLE = "config-git-url-unavailable";
|
|
19
18
|
export declare const CONFIG_INHERIT_NOT_FOUND = "config-inherit-not-found";
|
|
20
19
|
export declare const CONFIG_INHERIT_PARSE_ERROR = "config-inherit-parse-error";
|
|
21
|
-
/** cause repo to be considered as disabled */
|
|
22
20
|
export declare const ConfigErrors: readonly ["config-validation", "config-presets-invalid", "config-secrets-exposed", "config-secrets-invalid", "config-variables-invalid", "config-git-url-unavailable", "config-inherit-not-found", "config-inherit-parse-error"];
|
|
23
21
|
export declare const REPOSITORY_ACCESS_FORBIDDEN = "forbidden";
|
|
24
22
|
export declare const REPOSITORY_ARCHIVED = "archived";
|
|
@@ -17,7 +17,6 @@ exports.PLATFORM_INTEGRATION_UNAUTHORIZED = 'integration-unauthorized';
|
|
|
17
17
|
exports.PLATFORM_NOT_FOUND = 'platform-not-found';
|
|
18
18
|
exports.PLATFORM_RATE_LIMIT_EXCEEDED = 'rate-limit-exceeded';
|
|
19
19
|
exports.PLATFORM_UNKNOWN_ERROR = 'platform-unknown-error';
|
|
20
|
-
/** cause repo to be considered as disabled */
|
|
21
20
|
exports.PlatformErrors = [
|
|
22
21
|
exports.PLATFORM_AUTHENTICATION_ERROR,
|
|
23
22
|
exports.PLATFORM_BAD_CREDENTIALS,
|
|
@@ -36,7 +35,6 @@ exports.CONFIG_VARIABLES_INVALID = 'config-variables-invalid';
|
|
|
36
35
|
exports.CONFIG_GIT_URL_UNAVAILABLE = 'config-git-url-unavailable';
|
|
37
36
|
exports.CONFIG_INHERIT_NOT_FOUND = 'config-inherit-not-found';
|
|
38
37
|
exports.CONFIG_INHERIT_PARSE_ERROR = 'config-inherit-parse-error';
|
|
39
|
-
/** cause repo to be considered as disabled */
|
|
40
38
|
exports.ConfigErrors = [
|
|
41
39
|
exports.CONFIG_VALIDATION,
|
|
42
40
|
exports.CONFIG_PRESETS_INVALID,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-messages.js","sourceRoot":"","sources":["../../lib/constants/error-messages.ts"],"names":[],"mappings":";;;;AAAA,eAAe;AACF,QAAA,8BAA8B,GAAG,YAAY,CAAC;AAC9C,QAAA,0BAA0B,GAAG,eAAe,CAAC;AAE7C,QAAA,YAAY,GAAG;IAC1B,sCAA8B;IAC9B,kCAA0B;CAClB,CAAC;AAEX,iBAAiB;AACJ,QAAA,6BAA6B,GAAG,sBAAsB,CAAC;AACvD,QAAA,wBAAwB,GAAG,iBAAiB,CAAC;AAC7C,QAAA,mBAAmB,GAAG,YAAY,CAAC;AACnC,QAAA,iCAAiC,GAAG,0BAA0B,CAAC;AAC/D,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,4BAA4B,GAAG,qBAAqB,CAAC;AACrD,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"error-messages.js","sourceRoot":"","sources":["../../lib/constants/error-messages.ts"],"names":[],"mappings":";;;;AAAA,eAAe;AACF,QAAA,8BAA8B,GAAG,YAAY,CAAC;AAC9C,QAAA,0BAA0B,GAAG,eAAe,CAAC;AAE7C,QAAA,YAAY,GAAG;IAC1B,sCAA8B;IAC9B,kCAA0B;CAClB,CAAC;AAEX,iBAAiB;AACJ,QAAA,6BAA6B,GAAG,sBAAsB,CAAC;AACvD,QAAA,wBAAwB,GAAG,iBAAiB,CAAC;AAC7C,QAAA,mBAAmB,GAAG,YAAY,CAAC;AACnC,QAAA,iCAAiC,GAAG,0BAA0B,CAAC;AAC/D,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,4BAA4B,GAAG,qBAAqB,CAAC;AACrD,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAElD,QAAA,cAAc,GAAG;IAC5B,qC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\nexport const SystemErrors = [\n SYSTEM_INSUFFICIENT_DISK_SPACE,\n SYSTEM_INSUFFICIENT_MEMORY,\n] as const;\n\n// Platform Error\nexport const PLATFORM_AUTHENTICATION_ERROR = 'authentication-error';\nexport const PLATFORM_BAD_CREDENTIALS = 'bad-credentials';\nexport const PLATFORM_GPG_FAILED = 'gpg-failed';\nexport const PLATFORM_INTEGRATION_UNAUTHORIZED = 'integration-unauthorized';\nexport const PLATFORM_NOT_FOUND = 'platform-not-found';\nexport const PLATFORM_RATE_LIMIT_EXCEEDED = 'rate-limit-exceeded';\nexport const PLATFORM_UNKNOWN_ERROR = 'platform-unknown-error';\n\nexport const PlatformErrors = [\n PLATFORM_AUTHENTICATION_ERROR,\n PLATFORM_BAD_CREDENTIALS,\n PLATFORM_GPG_FAILED,\n PLATFORM_INTEGRATION_UNAUTHORIZED,\n PLATFORM_NOT_FOUND,\n PLATFORM_RATE_LIMIT_EXCEEDED,\n PLATFORM_UNKNOWN_ERROR,\n] as const;\n\n// Config Error\nexport const CONFIG_VALIDATION = 'config-validation';\nexport const CONFIG_PRESETS_INVALID = 'config-presets-invalid';\nexport const CONFIG_SECRETS_EXPOSED = 'config-secrets-exposed';\nexport const CONFIG_SECRETS_INVALID = 'config-secrets-invalid';\nexport const CONFIG_VARIABLES_INVALID = 'config-variables-invalid';\nexport const CONFIG_GIT_URL_UNAVAILABLE = 'config-git-url-unavailable';\nexport const CONFIG_INHERIT_NOT_FOUND = 'config-inherit-not-found';\nexport const CONFIG_INHERIT_PARSE_ERROR = 'config-inherit-parse-error';\n\nexport const ConfigErrors = [\n CONFIG_VALIDATION,\n CONFIG_PRESETS_INVALID,\n CONFIG_SECRETS_EXPOSED,\n CONFIG_SECRETS_INVALID,\n CONFIG_VARIABLES_INVALID,\n CONFIG_GIT_URL_UNAVAILABLE,\n CONFIG_INHERIT_NOT_FOUND,\n CONFIG_INHERIT_PARSE_ERROR,\n] as const;\n\n// Repository Errors - causes repo to be considered as disabled\nexport const REPOSITORY_ACCESS_FORBIDDEN = 'forbidden';\nexport const REPOSITORY_ARCHIVED = 'archived';\nexport const REPOSITORY_BLOCKED = 'blocked';\nexport const REPOSITORY_CANNOT_FORK = 'cannot-fork';\nexport const REPOSITORY_DISABLED = 'disabled';\nexport const REPOSITORY_CLOSED_ONBOARDING = 'disabled-closed-onboarding';\nexport const REPOSITORY_DISABLED_BY_CONFIG = 'disabled-by-config';\nexport const REPOSITORY_NO_CONFIG = 'disabled-no-config';\nexport const REPOSITORY_EMPTY = 'empty';\nexport const REPOSITORY_FORK_MISSING = 'fork-missing';\nexport const REPOSITORY_FORK_MODE_FORKED = 'fork-mode-forked';\nexport const REPOSITORY_FORKED = 'fork';\nexport const REPOSITORY_MIRRORED = 'mirror';\nexport const REPOSITORY_NOT_FOUND = 'not-found';\nexport const REPOSITORY_NO_PACKAGE_FILES = 'no-package-files';\nexport const REPOSITORY_RENAMED = 'renamed';\nexport const REPOSITORY_UNINITIATED = 'uninitiated';\n\n/** cause repo to be considered as disabled */\nexport const RepositoryErrors = [\n REPOSITORY_ACCESS_FORBIDDEN,\n REPOSITORY_ARCHIVED,\n REPOSITORY_BLOCKED,\n REPOSITORY_CANNOT_FORK,\n REPOSITORY_DISABLED,\n REPOSITORY_CLOSED_ONBOARDING,\n REPOSITORY_DISABLED_BY_CONFIG,\n REPOSITORY_NO_CONFIG,\n REPOSITORY_EMPTY,\n REPOSITORY_FORK_MISSING,\n REPOSITORY_FORK_MODE_FORKED,\n REPOSITORY_FORKED,\n REPOSITORY_MIRRORED,\n REPOSITORY_NOT_FOUND,\n REPOSITORY_NO_PACKAGE_FILES,\n REPOSITORY_RENAMED,\n REPOSITORY_UNINITIATED,\n] as const;\n\n// Temporary Error\nexport const REPOSITORY_CHANGED = 'repository-changed';\nexport const TEMPORARY_ERROR = 'temporary-error';\nexport const NO_VULNERABILITY_ALERTS = 'no-vulnerability-alerts';\n\nexport const TemporaryErrors = [\n REPOSITORY_CHANGED,\n TEMPORARY_ERROR,\n NO_VULNERABILITY_ALERTS,\n] as const;\n\n// Manager Error\nexport const MANAGER_LOCKFILE_ERROR = 'lockfile-error';\nexport const FILE_ACCESS_VIOLATION_ERROR = 'file-access-violation-error';\n\n// Host error\nexport const EXTERNAL_HOST_ERROR = 'external-host-error';\nexport const IGNORABLE_HOST_ERROR = 'ignorable-host-error';\nexport const HOST_DISABLED = 'host-disabled';\n\n// Worker Error\nexport const WORKER_FILE_UPDATE_FAILED = 'update-failure';\n\n// Bundler Error\nexport const BUNDLER_INVALID_CREDENTIALS = 'bundler-credentials';\n\n// Unknown Error\nexport const UNKNOWN_ERROR = 'unknown-error';\n\n// PATH Error\nexport const INVALID_PATH = 'invalid-path';\n\n// PAGE NOT FOUND\nexport const PAGE_NOT_FOUND_ERROR = 'page-not-found';\n\n// Missing API required credentials\nexport const MISSING_API_CREDENTIALS = 'missing-api-credentials';\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const packageCacheNamespaces: readonly ["_test-namespace", "changelog-bitbucket-notes@v2", "changelog-bitbucket-release", "changelog-bitbucket-server-notes@v2", "changelog-bitbucket-server-release", "changelog-forgejo-notes@v2", "changelog-forgejo-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-azure-tags", "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-forgejo-releases", "datasource-forgejo-tags", "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-jsr", "datasource-maven:cache-provider", "datasource-maven:postprocess-reject", "datasource-nextcloud", "datasource-node-version", "datasource-npm:cache-provider", "datasource-nuget-v3", "datasource-orb", "datasource-packagist", "datasource-pod", "datasource-python-version", "datasource-repology", "datasource-rpm", "datasource-ruby-version", "datasource-rubygems", "datasource-sbt-package", "datasource-terraform-module", "datasource-terraform-provider", "datasource-terraform", "datasource-typst:cache-provider", "datasource-typst:releases", "datasource-unity3d", "datasource-unity3d-packages", "github-releases-datasource-v2", "github-tags-datasource-v2", "merge-confidence", "preset", "terraform-provider-hash", "url-sha256"];
|
|
1
|
+
export declare const packageCacheNamespaces: readonly ["_test-namespace", "changelog-bitbucket-notes@v2", "changelog-bitbucket-release", "changelog-bitbucket-server-notes@v2", "changelog-bitbucket-server-release", "changelog-forgejo-notes@v2", "changelog-forgejo-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-azure-tags", "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-forgejo-releases", "datasource-forgejo-tags", "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-jsr", "datasource-maven:cache-provider", "datasource-maven:postprocess-reject", "datasource-nextcloud", "datasource-node-version", "datasource-npm:cache-provider", "datasource-nuget-v3", "datasource-orb", "datasource-packagist", "datasource-pod", "datasource-python-version", "datasource-repology", "datasource-rpm", "datasource-ruby-version", "datasource-rubygems", "datasource-sbt-package", "datasource-terraform-module", "datasource-terraform-provider", "datasource-terraform", "datasource-typst:cache-provider", "datasource-typst:releases", "datasource-unity3d", "datasource-unity3d-packages", "github-branches-datasource-v1", "github-releases-datasource-v2", "github-tags-datasource-v2", "merge-confidence", "preset", "terraform-provider-hash", "url-sha256"];
|
|
2
2
|
export type PackageCacheNamespace = (typeof packageCacheNamespaces)[number] | `datasource-releases-${string}`;
|
|
3
3
|
export type CombinedKey = `datasource-mem:pkg-fetch:${PackageCacheNamespace}:${string}`;
|
|
@@ -99,6 +99,7 @@ exports.packageCacheNamespaces = [
|
|
|
99
99
|
'datasource-typst:releases',
|
|
100
100
|
'datasource-unity3d',
|
|
101
101
|
'datasource-unity3d-packages',
|
|
102
|
+
'github-branches-datasource-v1',
|
|
102
103
|
'github-releases-datasource-v2',
|
|
103
104
|
'github-tags-datasource-v2',
|
|
104
105
|
'merge-confidence',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespaces.js","sourceRoot":"","sources":["../../../../lib/util/cache/package/namespaces.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,iFAAiF;AACpE,QAAA,sBAAsB,GAAG;IACpC,iBAAiB;IACjB,8BAA8B;IAC9B,6BAA6B;IAC7B,qCAAqC;IACrC,oCAAoC;IACpC,4BAA4B;IAC5B,2BAA2B;IAC3B,0BAA0B;IAC1B,yBAAyB;IACzB,2BAA2B;IAC3B,0BAA0B;IAC1B,2BAA2B;IAC3B,0BAA0B;IAC1B,wBAAwB;IACxB,8BAA8B;IAC9B,oBAAoB;IACpB,0BAA0B;IAC1B,iCAAiC;IACjC,kCAAkC;IAClC,uBAAuB;IACvB,kBAAkB;IAClB,2BAA2B;IAC3B,kCAAkC;IAClC,oBAAoB;IACpB,gCAAgC;IAChC,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;IAClB,iBAAiB;IACjB,2BAA2B;IAC3B,kBAAkB;IAClB,gBAAgB;IAChB,iBAAiB;IACjB,gCAAgC;IAChC,6BAA6B;IAC7B,0BAA0B;IAC1B,4BAA4B;IAC5B,+BAA+B;IAC/B,0BAA0B;IAC1B,+BAA+B;IAC/B,wBAAwB;IACxB,2BAA2B;IAC3B,2BAA2B;IAC3B,8BAA8B;IAC9B,mBAAmB;IACnB,qBAAqB;IACrB,qBAAqB;IACrB,gBAAgB;IAChB,6BAA6B;IAC7B,yBAAyB;IACzB,2BAA2B;IAC3B,uBAAuB;IACvB,uCAAuC;IACvC,4BAA4B;IAC5B,4BAA4B;IAC5B,wBAAwB;IACxB,+BAA+B;IAC/B,sBAAsB;IACtB,qBAAqB;IACrB,eAAe;IACf,2BAA2B;IAC3B,2BAA2B;IAC3B,iBAAiB;IACjB,mBAAmB;IACnB,gBAAgB;IAChB,sBAAsB;IACtB,yBAAyB;IACzB,4BAA4B;IAC5B,gBAAgB;IAChB,iCAAiC;IACjC,qCAAqC;IACrC,sBAAsB;IACtB,yBAAyB;IACzB,+BAA+B;IAC/B,qBAAqB;IACrB,gBAAgB;IAChB,sBAAsB;IACtB,gBAAgB;IAChB,2BAA2B;IAC3B,qBAAqB;IACrB,gBAAgB;IAChB,yBAAyB;IACzB,qBAAqB;IACrB,wBAAwB;IACxB,6BAA6B;IAC7B,+BAA+B;IAC/B,sBAAsB;IACtB,iCAAiC;IACjC,2BAA2B;IAC3B,oBAAoB;IACpB,6BAA6B;IAC7B,+BAA+B;IAC/B,2BAA2B;IAC3B,kBAAkB;IAClB,QAAQ;IACR,yBAAyB;IACzB,YAAY;CACJ,CAAC,CAAC,iFAAiF","sourcesContent":["/* IMPORTANT:\n * These namespaces below are used as part of the cacheTtlOverride feature\n * It's OK to add to them (e.g. for new datasources) but we should avoid\n * backwards-incompatible changes in non-major releases\n */\n\n/* v8 ignore next -- BTW don't forget to update `self-hosted-configuration.md` */\nexport const packageCacheNamespaces = [\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-forgejo-notes@v2',\n 'changelog-forgejo-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-azure-tags',\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-forgejo-releases',\n 'datasource-forgejo-tags',\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-jsr',\n 'datasource-maven:cache-provider',\n 'datasource-maven:postprocess-reject',\n 'datasource-nextcloud',\n 'datasource-node-version',\n 'datasource-npm:cache-provider',\n 'datasource-nuget-v3',\n 'datasource-orb',\n 'datasource-packagist',\n 'datasource-pod',\n 'datasource-python-version',\n 'datasource-repology',\n 'datasource-rpm',\n 'datasource-ruby-version',\n 'datasource-rubygems',\n 'datasource-sbt-package',\n 'datasource-terraform-module',\n 'datasource-terraform-provider',\n 'datasource-terraform',\n 'datasource-typst:cache-provider',\n 'datasource-typst:releases',\n 'datasource-unity3d',\n 'datasource-unity3d-packages',\n 'github-releases-datasource-v2',\n 'github-tags-datasource-v2',\n 'merge-confidence',\n 'preset',\n 'terraform-provider-hash',\n 'url-sha256',\n] as const; /* v8 ignore stop -- BTW don't forget to update `self-hosted-configuration.md` */\n\nexport type PackageCacheNamespace =\n | (typeof packageCacheNamespaces)[number]\n | `datasource-releases-${string}`;\n\nexport type CombinedKey =\n `datasource-mem:pkg-fetch:${PackageCacheNamespace}:${string}`;\n"]}
|
|
1
|
+
{"version":3,"file":"namespaces.js","sourceRoot":"","sources":["../../../../lib/util/cache/package/namespaces.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,iFAAiF;AACpE,QAAA,sBAAsB,GAAG;IACpC,iBAAiB;IACjB,8BAA8B;IAC9B,6BAA6B;IAC7B,qCAAqC;IACrC,oCAAoC;IACpC,4BAA4B;IAC5B,2BAA2B;IAC3B,0BAA0B;IAC1B,yBAAyB;IACzB,2BAA2B;IAC3B,0BAA0B;IAC1B,2BAA2B;IAC3B,0BAA0B;IAC1B,wBAAwB;IACxB,8BAA8B;IAC9B,oBAAoB;IACpB,0BAA0B;IAC1B,iCAAiC;IACjC,kCAAkC;IAClC,uBAAuB;IACvB,kBAAkB;IAClB,2BAA2B;IAC3B,kCAAkC;IAClC,oBAAoB;IACpB,gCAAgC;IAChC,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;IAClB,iBAAiB;IACjB,2BAA2B;IAC3B,kBAAkB;IAClB,gBAAgB;IAChB,iBAAiB;IACjB,gCAAgC;IAChC,6BAA6B;IAC7B,0BAA0B;IAC1B,4BAA4B;IAC5B,+BAA+B;IAC/B,0BAA0B;IAC1B,+BAA+B;IAC/B,wBAAwB;IACxB,2BAA2B;IAC3B,2BAA2B;IAC3B,8BAA8B;IAC9B,mBAAmB;IACnB,qBAAqB;IACrB,qBAAqB;IACrB,gBAAgB;IAChB,6BAA6B;IAC7B,yBAAyB;IACzB,2BAA2B;IAC3B,uBAAuB;IACvB,uCAAuC;IACvC,4BAA4B;IAC5B,4BAA4B;IAC5B,wBAAwB;IACxB,+BAA+B;IAC/B,sBAAsB;IACtB,qBAAqB;IACrB,eAAe;IACf,2BAA2B;IAC3B,2BAA2B;IAC3B,iBAAiB;IACjB,mBAAmB;IACnB,gBAAgB;IAChB,sBAAsB;IACtB,yBAAyB;IACzB,4BAA4B;IAC5B,gBAAgB;IAChB,iCAAiC;IACjC,qCAAqC;IACrC,sBAAsB;IACtB,yBAAyB;IACzB,+BAA+B;IAC/B,qBAAqB;IACrB,gBAAgB;IAChB,sBAAsB;IACtB,gBAAgB;IAChB,2BAA2B;IAC3B,qBAAqB;IACrB,gBAAgB;IAChB,yBAAyB;IACzB,qBAAqB;IACrB,wBAAwB;IACxB,6BAA6B;IAC7B,+BAA+B;IAC/B,sBAAsB;IACtB,iCAAiC;IACjC,2BAA2B;IAC3B,oBAAoB;IACpB,6BAA6B;IAC7B,+BAA+B;IAC/B,+BAA+B;IAC/B,2BAA2B;IAC3B,kBAAkB;IAClB,QAAQ;IACR,yBAAyB;IACzB,YAAY;CACJ,CAAC,CAAC,iFAAiF","sourcesContent":["/* IMPORTANT:\n * These namespaces below are used as part of the cacheTtlOverride feature\n * It's OK to add to them (e.g. for new datasources) but we should avoid\n * backwards-incompatible changes in non-major releases\n */\n\n/* v8 ignore next -- BTW don't forget to update `self-hosted-configuration.md` */\nexport const packageCacheNamespaces = [\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-forgejo-notes@v2',\n 'changelog-forgejo-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-azure-tags',\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-forgejo-releases',\n 'datasource-forgejo-tags',\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-jsr',\n 'datasource-maven:cache-provider',\n 'datasource-maven:postprocess-reject',\n 'datasource-nextcloud',\n 'datasource-node-version',\n 'datasource-npm:cache-provider',\n 'datasource-nuget-v3',\n 'datasource-orb',\n 'datasource-packagist',\n 'datasource-pod',\n 'datasource-python-version',\n 'datasource-repology',\n 'datasource-rpm',\n 'datasource-ruby-version',\n 'datasource-rubygems',\n 'datasource-sbt-package',\n 'datasource-terraform-module',\n 'datasource-terraform-provider',\n 'datasource-terraform',\n 'datasource-typst:cache-provider',\n 'datasource-typst:releases',\n 'datasource-unity3d',\n 'datasource-unity3d-packages',\n 'github-branches-datasource-v1',\n 'github-releases-datasource-v2',\n 'github-tags-datasource-v2',\n 'merge-confidence',\n 'preset',\n 'terraform-provider-hash',\n 'url-sha256',\n] as const; /* v8 ignore stop -- BTW don't forget to update `self-hosted-configuration.md` */\n\nexport type PackageCacheNamespace =\n | (typeof packageCacheNamespaces)[number]\n | `datasource-releases-${string}`;\n\nexport type CombinedKey =\n `datasource-mem:pkg-fetch:${PackageCacheNamespace}:${string}`;\n"]}
|
|
@@ -8,6 +8,7 @@ import type { GithubDatasourceItem, GithubGraphqlCacheRecord, GithubGraphqlCache
|
|
|
8
8
|
export declare abstract class AbstractGithubGraphqlCacheStrategy<GithubItem extends GithubDatasourceItem> implements GithubGraphqlCacheStrategy<GithubItem> {
|
|
9
9
|
protected readonly cacheNs: PackageCacheNamespace;
|
|
10
10
|
protected readonly cacheKey: string;
|
|
11
|
+
protected readonly skipStabilization: boolean;
|
|
11
12
|
/**
|
|
12
13
|
* Time period after which a cache record is considered expired.
|
|
13
14
|
*/
|
|
@@ -35,7 +36,7 @@ export declare abstract class AbstractGithubGraphqlCacheStrategy<GithubItem exte
|
|
|
35
36
|
*/
|
|
36
37
|
abstract load(): Promise<GithubGraphqlCacheRecord<GithubItem> | undefined>;
|
|
37
38
|
abstract persist(cacheRecord: GithubGraphqlCacheRecord<GithubItem>): Promise<void>;
|
|
38
|
-
constructor(cacheNs: PackageCacheNamespace, cacheKey: string);
|
|
39
|
+
constructor(cacheNs: PackageCacheNamespace, cacheKey: string, skipStabilization?: boolean);
|
|
39
40
|
/**
|
|
40
41
|
* Load data previously persisted by this strategy
|
|
41
42
|
* for given `cacheNs` and `cacheKey`.
|
|
@@ -11,6 +11,7 @@ const util_1 = require("../util");
|
|
|
11
11
|
class AbstractGithubGraphqlCacheStrategy {
|
|
12
12
|
cacheNs;
|
|
13
13
|
cacheKey;
|
|
14
|
+
skipStabilization;
|
|
14
15
|
/**
|
|
15
16
|
* Time period after which a cache record is considered expired.
|
|
16
17
|
*/
|
|
@@ -33,9 +34,10 @@ class AbstractGithubGraphqlCacheStrategy {
|
|
|
33
34
|
* This flag indicates whether there is any new or updated items
|
|
34
35
|
*/
|
|
35
36
|
hasNovelty = false;
|
|
36
|
-
constructor(cacheNs, cacheKey) {
|
|
37
|
+
constructor(cacheNs, cacheKey, skipStabilization = false) {
|
|
37
38
|
this.cacheNs = cacheNs;
|
|
38
39
|
this.cacheKey = cacheKey;
|
|
40
|
+
this.skipStabilization = skipStabilization;
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
41
43
|
* Load data previously persisted by this strategy
|
|
@@ -90,7 +92,10 @@ class AbstractGithubGraphqlCacheStrategy {
|
|
|
90
92
|
// the entire page of items. This protects us from unusual cases
|
|
91
93
|
// when release authors intentionally break the timeline. Therefore,
|
|
92
94
|
// while it feels appealing to break early, please don't do that.
|
|
93
|
-
|
|
95
|
+
//
|
|
96
|
+
// Skip this optimization if skipStabilization is set (e.g. for branches
|
|
97
|
+
// where we can't rely on date-based ordering).
|
|
98
|
+
if (!this.skipStabilization && oldItem && this.isStabilized(oldItem)) {
|
|
94
99
|
isPaginationDone = true;
|
|
95
100
|
}
|
|
96
101
|
// Check if item is new or updated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-cache-strategy.js","sourceRoot":"","sources":["../../../../../lib/util/github/graphql/cache-strategies/abstract-cache-strategy.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,iCAAiC;AAOjC,kCAAwC;AAExC;;;GAGG;AACH,MAAsB,kCAAkC;IAwCjC;IACA;
|
|
1
|
+
{"version":3,"file":"abstract-cache-strategy.js","sourceRoot":"","sources":["../../../../../lib/util/github/graphql/cache-strategies/abstract-cache-strategy.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,iCAAiC;AAOjC,kCAAwC;AAExC;;;GAGG;AACH,MAAsB,kCAAkC;IAwCjC;IACA;IACA;IAtCrB;;OAEG;IACO,MAAM,CAAU,YAAY,GAAG,EAAE,CAAC;IAE5C;;OAEG;IACgB,GAAG,GAAG,gBAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC;IAEhD;;;OAGG;IACK,kBAAkB,CAA0B;IAEpD;;OAEG;IACK,KAAK,CAAyC;IAC5C,SAAS,GAAa,IAAI,CAAC,GAAG,CAAC;IAEzC;;OAEG;IACO,UAAU,GAAG,KAAK,CAAC;IAU7B,YACqB,OAA8B,EAC9B,QAAgB,EAChB,oBAAoB,KAAK;QAFzB,YAAO,GAAP,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AAC,WAAW,CAAC,EAAE,CAAC;gBAC1D,IAAI,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;oBACpE,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;gBAC9B,CAAC;qBAAM,CAAC;oBACN,eAAe,GAAG,IAAI,CAAC;gBACzB,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,WAAW,GAAG,WAAW,CAAC;QAC5B,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,IAAI,eAAe,EAAE,CAAC;YACvC,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACpC,CAAC;IAEO,KAAK,CAAC,KAAK,CAAC,WAAuC;QACzD,MAAM,WAAW,GAAyC;YACxD,KAAK,EAAE,WAAW;YAClB,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAG;SACnC,CAAC;QACF,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;;AAjKH,gFAkKC","sourcesContent":["import { dequal } from 'dequal';\nimport { DateTime } from 'luxon';\nimport type { PackageCacheNamespace } from '../../../cache/package/types';\nimport type {\n GithubDatasourceItem,\n GithubGraphqlCacheRecord,\n GithubGraphqlCacheStrategy,\n} from '../types';\nimport { isDateExpired } from '../util';\n\n/**\n * Cache strategy handles the caching Github GraphQL items\n * and reconciling them with newly obtained ones from paginated queries.\n */\nexport abstract class AbstractGithubGraphqlCacheStrategy<\n GithubItem extends GithubDatasourceItem,\n> implements GithubGraphqlCacheStrategy<GithubItem>\n{\n /**\n * Time period after which a cache record is considered expired.\n */\n protected static readonly cacheTTLDays = 30;\n\n /**\n * The time which is used during single cache access cycle.\n */\n protected readonly now = DateTime.now().toUTC();\n\n /**\n * Set of all versions which were reconciled\n * during the current cache access cycle.\n */\n private reconciledVersions: Set<string> | undefined;\n\n /**\n * These fields will be persisted.\n */\n private items: Record<string, GithubItem> | undefined;\n protected createdAt: DateTime = this.now;\n\n /**\n * This flag indicates whether there is any new or updated items\n */\n protected hasNovelty = false;\n\n /**\n * Loading and persisting data is delegated to the concrete strategy.\n */\n abstract load(): Promise<GithubGraphqlCacheRecord<GithubItem> | undefined>;\n abstract persist(\n cacheRecord: GithubGraphqlCacheRecord<GithubItem>,\n ): Promise<void>;\n\n constructor(\n protected readonly cacheNs: PackageCacheNamespace,\n protected readonly cacheKey: string,\n protected readonly skipStabilization = false,\n ) {}\n\n /**\n * Load data previously persisted by this strategy\n * for given `cacheNs` and `cacheKey`.\n */\n private async getItems(): Promise<Record<string, GithubItem>> {\n if (this.items) {\n return this.items;\n }\n\n let result: GithubGraphqlCacheRecord<GithubItem> = {\n items: {},\n createdAt: this.createdAt.toISO()!,\n };\n\n const storedData = await this.load();\n if (storedData) {\n const cacheTTLDuration = {\n hours: AbstractGithubGraphqlCacheStrategy.cacheTTLDays * 24,\n };\n if (!isDateExpired(this.now, storedData.createdAt, cacheTTLDuration)) {\n result = storedData;\n }\n }\n\n this.createdAt = DateTime.fromISO(result.createdAt).toUTC();\n this.items = result.items;\n return this.items;\n }\n\n /**\n * If package release exists longer than this cache can exist,\n * we assume it won't updated/removed on the Github side.\n */\n private isStabilized(item: GithubItem): boolean {\n const unstableDuration = {\n hours: AbstractGithubGraphqlCacheStrategy.cacheTTLDays * 24,\n };\n return isDateExpired(this.now, item.releaseTimestamp, unstableDuration);\n }\n\n /**\n * Process items received from GraphQL page\n * ordered by `releaseTimestamp` in descending order\n * (fresh versions go first).\n */\n async reconcile(items: GithubItem[]): Promise<boolean> {\n const cachedItems = await this.getItems();\n\n let isPaginationDone = false;\n for (const item of items) {\n const { version } = item;\n const oldItem = cachedItems[version];\n\n // If we reached previously stored item that is stabilized,\n // we assume the further pagination will not yield any new items.\n //\n // However, we don't break the loop here, allowing to reconcile\n // the entire page of items. This protects us from unusual cases\n // when release authors intentionally break the timeline. Therefore,\n // while it feels appealing to break early, please don't do that.\n //\n // Skip this optimization if skipStabilization is set (e.g. for branches\n // where we can't rely on date-based ordering).\n if (!this.skipStabilization && oldItem && this.isStabilized(oldItem)) {\n isPaginationDone = true;\n }\n\n // Check if item is new or updated\n if (!oldItem || !dequal(oldItem, item)) {\n this.hasNovelty = true;\n }\n\n cachedItems[version] = item;\n this.reconciledVersions ??= new Set();\n this.reconciledVersions.add(version);\n }\n\n this.items = cachedItems;\n return isPaginationDone;\n }\n\n /**\n * Handle removed items for packages that are not stabilized\n * and return the list of all items.\n */\n async finalizeAndReturn(): Promise<GithubItem[]> {\n const cachedItems = await this.getItems();\n let resultItems: Record<string, GithubItem>;\n\n let hasDeletedItems = false;\n if (this.reconciledVersions) {\n resultItems = {};\n for (const [version, item] of Object.entries(cachedItems)) {\n if (this.reconciledVersions.has(version) || this.isStabilized(item)) {\n resultItems[version] = item;\n } else {\n hasDeletedItems = true;\n }\n }\n } else {\n resultItems = cachedItems;\n }\n\n if (this.hasNovelty || hasDeletedItems) {\n await this.store(resultItems);\n }\n\n return Object.values(resultItems);\n }\n\n private async store(cachedItems: Record<string, GithubItem>): Promise<void> {\n const cacheRecord: GithubGraphqlCacheRecord<GithubItem> = {\n items: cachedItems,\n createdAt: this.createdAt.toISO()!,\n };\n await this.persist(cacheRecord);\n }\n}\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GithubGraphqlDatasourceFetcher = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
|
|
5
6
|
const global_1 = require("../../../config/global");
|
|
6
7
|
const logger_1 = require("../../../logger");
|
|
7
8
|
const external_host_error_1 = require("../../../types/errors/external-host-error");
|
|
@@ -155,10 +156,11 @@ class GithubGraphqlDatasourceFetcher {
|
|
|
155
156
|
const cacheNs = this.getCacheNs();
|
|
156
157
|
const cacheKey = this.getCacheKey();
|
|
157
158
|
const cachePrivatePackages = global_1.GlobalConfig.get('cachePrivatePackages', false);
|
|
159
|
+
const skipStabilization = !is_1.default.undefined(this.datasourceAdapter.maxItems);
|
|
158
160
|
this._cacheStrategy =
|
|
159
161
|
cachePrivatePackages || this.isPersistent
|
|
160
|
-
? new package_cache_strategy_1.GithubGraphqlPackageCacheStrategy(cacheNs, cacheKey)
|
|
161
|
-
: new memory_cache_strategy_1.GithubGraphqlMemoryCacheStrategy(cacheNs, cacheKey);
|
|
162
|
+
? new package_cache_strategy_1.GithubGraphqlPackageCacheStrategy(cacheNs, cacheKey, skipStabilization)
|
|
163
|
+
: new memory_cache_strategy_1.GithubGraphqlMemoryCacheStrategy(cacheNs, cacheKey, skipStabilization);
|
|
162
164
|
return this._cacheStrategy;
|
|
163
165
|
}
|
|
164
166
|
/**
|
|
@@ -169,7 +171,12 @@ class GithubGraphqlDatasourceFetcher {
|
|
|
169
171
|
let hasNextPage = true;
|
|
170
172
|
let isPaginationDone = false;
|
|
171
173
|
let nextCursor;
|
|
174
|
+
let itemCount = 0;
|
|
175
|
+
const maxItems = this.datasourceAdapter.maxItems;
|
|
172
176
|
while (hasNextPage && !isPaginationDone && !this.hasReachedQueryLimit()) {
|
|
177
|
+
if (!is_1.default.undefined(maxItems) && itemCount >= maxItems) {
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
173
180
|
const queryResult = await this.doShrinkableQuery();
|
|
174
181
|
const resultItems = [];
|
|
175
182
|
for (const node of queryResult.nodes) {
|
|
@@ -183,6 +190,7 @@ class GithubGraphqlDatasourceFetcher {
|
|
|
183
190
|
}
|
|
184
191
|
resultItems.push(item);
|
|
185
192
|
}
|
|
193
|
+
itemCount += resultItems.length;
|
|
186
194
|
// It's important to call `getCacheStrategy()` after `doShrinkableQuery()`
|
|
187
195
|
// because `doShrinkableQuery()` may change `this.isCacheable`.
|
|
188
196
|
//
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasource-fetcher.js","sourceRoot":"","sources":["../../../../lib/util/github/graphql/datasource-fetcher.ts"],"names":[],"mappings":";;;;AAAA,mDAAsD;AACtD,4CAAyC;AACzC,mFAA8E;AAC9E,qEAA+C;AAC/C,0EAAoD;AAQpD,gCAAuC;AACvC,oFAA4F;AAC5F,sFAA8F;AAY9F;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,GAAU;IACvC,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC;IACxB,OAAO,OAAO,CAAC,UAAU,CAAC,kDAAkD,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAU;IACxC,MAAM,MAAM,GAAY,GAAG,YAAY,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC3E,OAAO,MAAM,CAAC,IAAI,CAChB,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,YAAY,uCAAiB,IAAI,qBAAqB,CAAC,CAAC,CAAC,CACpE,CAAC;AACJ,CAAC;AAED,MAAa,8BAA8B;IAgC/B;IACA;IA7BV,MAAM,CAAC,KAAK,CAAC,KAAK,CAChB,MAA2B,EAC3B,IAAgB,EAChB,OAA6C;QAE7C,MAAM,QAAQ,GAAG,IAAI,8BAA8B,CACjD,MAAM,EACN,IAAI,EACJ,OAAO,CACR,CAAC;QACF,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IAEgB,OAAO,CAAS;IAChB,SAAS,CAAS;IAClB,QAAQ,CAAS;IAE1B,aAAa,GAAkB,GAAG,CAAC;IAEnC,UAAU,GAAG,CAAC,CAAC;IAEf,MAAM,GAAkB,IAAI,CAAC;IAE7B,YAAY,CAAsB;IAE1C,YACE,aAAkC,EAC1B,IAAgB,EAChB,iBAGP;QAJO,S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AE,CAAC;QACvC,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AA3RD,wEA2RC","sourcesContent":["import { GlobalConfig } from '../../../config/global';\nimport { logger } from '../../../logger';\nimport { ExternalHostError } from '../../../types/errors/external-host-error';\nimport * as memCache from '../../cache/memory';\nimport * as packageCache from '../../cache/package';\nimport type { PackageCacheNamespace } from '../../cache/package/types';\nimport type {\n GithubGraphqlResponse,\n GithubHttp,\n GithubHttpOptions,\n} from '../../http/github';\nimport type { HttpResponse } from '../../http/types';\nimport { getApiBaseUrl } from '../url';\nimport { GithubGraphqlMemoryCacheStrategy } from './cache-strategies/memory-cache-strategy';\nimport { GithubGraphqlPackageCacheStrategy } from './cache-strategies/package-cache-strategy';\nimport type {\n GithubDatasourceItem,\n GithubGraphqlCacheStrategy,\n GithubGraphqlDatasourceAdapter,\n GithubGraphqlPayload,\n GithubGraphqlRepoParams,\n GithubGraphqlRepoResponse,\n GithubPackageConfig,\n RawQueryResponse,\n} from './types';\n\n/**\n * We know empirically that certain type of GraphQL errors\n * can be fixed by shrinking page size.\n *\n * @see https://github.com/renovatebot/renovate/issues/16343\n */\nfunction isUnknownGraphqlError(err: Error): boolean {\n const { message } = err;\n return message.startsWith('Something went wrong while executing your query.');\n}\n\nfunction canBeSolvedByShrinking(err: Error): boolean {\n const errors: Error[] = err instanceof AggregateError ? err.errors : [err];\n return errors.some(\n (e) => err instanceof ExternalHostError || isUnknownGraphqlError(e),\n );\n}\n\nexport class GithubGraphqlDatasourceFetcher<\n GraphqlItem,\n ResultItem extends GithubDatasourceItem,\n> {\n static async query<T, U extends GithubDatasourceItem>(\n config: GithubPackageConfig,\n http: GithubHttp,\n adapter: GithubGraphqlDatasourceAdapter<T, U>,\n ): Promise<U[]> {\n const instance = new GithubGraphqlDatasourceFetcher<T, U>(\n config,\n http,\n adapter,\n );\n const items = await instance.getItems();\n return items;\n }\n\n private readonly baseUrl: string;\n private readonly repoOwner: string;\n private readonly repoName: string;\n\n private itemsPerQuery: 100 | 50 | 25 = 100;\n\n private queryCount = 0;\n\n private cursor: string | null = null;\n\n private isPersistent: boolean | undefined;\n\n constructor(\n packageConfig: GithubPackageConfig,\n private http: GithubHttp,\n private datasourceAdapter: GithubGraphqlDatasourceAdapter<\n GraphqlItem,\n ResultItem\n >,\n ) {\n const { packageName, registryUrl } = packageConfig;\n [this.repoOwner, this.repoName] = packageName.split('/');\n this.baseUrl = getApiBaseUrl(registryUrl).replace(/\\/v3\\/$/, '/'); // Replace for GHE\n }\n\n private getCacheNs(): PackageCacheNamespace {\n return this.datasourceAdapter.key;\n }\n\n private getCacheKey(): string {\n return [this.baseUrl, this.repoOwner, this.repoName].join(':');\n }\n\n private getRawQueryOptions(): GithubHttpOptions {\n const baseUrl = this.baseUrl;\n const repository = `${this.repoOwner}/${this.repoName}`;\n const query = this.datasourceAdapter.query;\n const variables: GithubGraphqlRepoParams = {\n owner: this.repoOwner,\n name: this.repoName,\n count: this.itemsPerQuery,\n cursor: this.cursor,\n };\n\n return {\n baseUrl,\n repository,\n readOnly: true,\n body: { query, variables },\n };\n }\n\n private async doRawQuery(): Promise<\n RawQueryResponse<GithubGraphqlPayload<GraphqlItem>>\n > {\n const requestOptions = this.getRawQueryOptions();\n\n type GraphqlData = GithubGraphqlRepoResponse<GraphqlItem>;\n type HttpBody = GithubGraphqlResponse<GraphqlData>;\n let httpRes: HttpResponse<HttpBody>;\n try {\n httpRes = await this.http.postJson<HttpBody>('/graphql', requestOptions);\n } catch (err) {\n return [null, err];\n }\n\n const { body } = httpRes;\n const { data, errors } = body;\n\n if (errors?.length) {\n if (errors.length === 1) {\n const { message } = errors[0];\n const err = new Error(message);\n return [null, err];\n } else {\n const errorInstances = errors.map(({ message }) => new Error(message));\n const err = new AggregateError(errorInstances);\n return [null, err];\n }\n }\n\n if (!data) {\n const msg = 'GitHub GraphQL datasource: failed to obtain data';\n const err = new Error(msg);\n return [null, err];\n }\n\n if (!data.repository) {\n const msg = 'GitHub GraphQL datasource: failed to obtain repository data';\n const err = new Error(msg);\n return [null, err];\n }\n\n if (!data.repository.payload) {\n const msg =\n 'GitHub GraphQL datasource: failed to obtain repository payload data';\n const err = new Error(msg);\n return [null, err];\n }\n\n this.queryCount += 1;\n\n // For values other than explicit `false`,\n // we assume that items can not be cached.\n this.isPersistent ??= data.repository.isRepoPrivate === false;\n\n const res = data.repository.payload;\n return [res, null];\n }\n\n private shrinkPageSize(): boolean {\n if (this.itemsPerQuery === 100) {\n this.itemsPerQuery = 50;\n return true;\n }\n\n if (this.itemsPerQuery === 50) {\n this.itemsPerQuery = 25;\n return true;\n }\n\n return false;\n }\n\n private hasReachedQueryLimit(): boolean {\n return this.queryCount >= 100;\n }\n\n private async doShrinkableQuery(): Promise<\n GithubGraphqlPayload<GraphqlItem>\n > {\n let res: GithubGraphqlPayload<GraphqlItem> | null = null;\n let err: Error | null = null;\n\n while (!res) {\n [res, err] = await this.doRawQuery();\n if (err) {\n if (!canBeSolvedByShrinking(err)) {\n throw err;\n }\n\n const shrinkResult = this.shrinkPageSize();\n if (!shrinkResult) {\n throw err;\n }\n const { body, ...options } = this.getRawQueryOptions();\n logger.debug(\n { options, newSize: this.itemsPerQuery },\n 'Shrinking GitHub GraphQL page size after error',\n );\n }\n }\n\n return res;\n }\n\n private _cacheStrategy: GithubGraphqlCacheStrategy<ResultItem> | undefined;\n\n private cacheStrategy(): GithubGraphqlCacheStrategy<ResultItem> {\n if (this._cacheStrategy) {\n return this._cacheStrategy;\n }\n const cacheNs = this.getCacheNs();\n const cacheKey = this.getCacheKey();\n const cachePrivatePackages = GlobalConfig.get(\n 'cachePrivatePackages',\n false,\n );\n this._cacheStrategy =\n cachePrivatePackages || this.isPersistent\n ? new GithubGraphqlPackageCacheStrategy<ResultItem>(cacheNs, cacheKey)\n : new GithubGraphqlMemoryCacheStrategy<ResultItem>(cacheNs, cacheKey);\n return this._cacheStrategy;\n }\n\n /**\n * This method is responsible for data synchronization.\n * It also detects persistence of the package, based on the first page result.\n */\n private async doPaginatedFetch(): Promise<void> {\n let hasNextPage = true;\n let isPaginationDone = false;\n let nextCursor: string | undefined;\n while (hasNextPage && !isPaginationDone && !this.hasReachedQueryLimit()) {\n const queryResult = await this.doShrinkableQuery();\n\n const resultItems: ResultItem[] = [];\n for (const node of queryResult.nodes) {\n const item = this.datasourceAdapter.transform(node);\n if (!item) {\n logger.once.info(\n {\n packageName: `${this.repoOwner}/${this.repoName}`,\n baseUrl: this.baseUrl,\n },\n `GitHub GraphQL datasource: skipping empty item`,\n );\n continue;\n }\n resultItems.push(item);\n }\n\n // It's important to call `getCacheStrategy()` after `doShrinkableQuery()`\n // because `doShrinkableQuery()` may change `this.isCacheable`.\n //\n // Otherwise, cache items for public packages will never be persisted\n // in long-term cache.\n isPaginationDone = await this.cacheStrategy().reconcile(resultItems);\n\n hasNextPage = !!queryResult?.pageInfo?.hasNextPage;\n nextCursor = queryResult?.pageInfo?.endCursor;\n if (hasNextPage && nextCursor) {\n this.cursor = nextCursor;\n }\n }\n\n if (this.isPersistent) {\n await this.storePersistenceFlag(30);\n }\n }\n\n private async doCachedQuery(): Promise<ResultItem[]> {\n await this.loadPersistenceFlag();\n if (!this.isPersistent) {\n await this.doPaginatedFetch();\n }\n\n const res = await this.cacheStrategy().finalizeAndReturn();\n if (res.length) {\n return res;\n }\n\n delete this.isPersistent;\n await this.doPaginatedFetch();\n return this.cacheStrategy().finalizeAndReturn();\n }\n\n async loadPersistenceFlag(): Promise<void> {\n const ns = this.getCacheNs();\n const key = `${this.getCacheKey()}:is-persistent`;\n this.isPersistent = await packageCache.get<true>(ns, key);\n }\n\n async storePersistenceFlag(minutes: number): Promise<void> {\n const ns = this.getCacheNs();\n const key = `${this.getCacheKey()}:is-persistent`;\n await packageCache.set(ns, key, true, minutes);\n }\n\n /**\n * This method ensures the only one query is executed\n * to a particular package during single run.\n */\n private doUniqueQuery(): Promise<ResultItem[]> {\n const cacheKey = `github-pending:${this.getCacheNs()}:${this.getCacheKey()}`;\n let resultPromise = memCache.get<Promise<ResultItem[]>>(cacheKey);\n resultPromise ??= this.doCachedQuery();\n memCache.set(cacheKey, resultPromise);\n return resultPromise;\n }\n\n async getItems(): Promise<ResultItem[]> {\n const res = await this.doUniqueQuery();\n return res;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"datasource-fetcher.js","sourceRoot":"","sources":["../../../../lib/util/github/graphql/datasource-fetcher.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAClC,mDAAsD;AACtD,4CAAyC;AACzC,mFAA8E;AAC9E,qEAA+C;AAC/C,0EAAoD;AAQpD,gCAAuC;AACvC,oFAA4F;AAC5F,sFAA8F;AAY9F;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,GAAU;IACvC,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC;IACxB,OAAO,OAAO,CAAC,UAAU,CAAC,kDAAkD,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAU;IACxC,MAAM,MAAM,GAAY,GAAG,YAAY,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC3E,OAAO,MAAM,CAAC,IAAI,CAChB,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,YAAY,uCAAiB,IAAI,qBAAqB,CAAC,CAAC,CAAC,CACpE,CAAC;AACJ,CAAC;AAED,MAAa,8BAA8B;IAgC/B;IACA;IA7BV,MAAM,CAAC,KAAK,CAAC,KAAK,CAChB,MAA2B,EAC3B,IAAgB,EAChB,OAA6C;QAE7C,MAAM,QAAQ,GAAG,IAAI,8BAA8B,CACjD,MAAM,EACN,IAAI,EACJ,OAAO,CACR,CAAC;QACF,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IAEgB,OAAO,CAAS;IAChB,SAAS,CAAS;IAClB,QAAQ,CAAS;IAE1B,aAAa,GAAkB,GAAG,CAAC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C;QAClD,MAAM,YAAY,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACK,aAAa;QACnB,MAAM,QAAQ,GAAG,kBAAkB,IAAI,CAAC,UAAU,EAAE,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QAC7E,IAAI,aAAa,GAAG,QAAQ,CAAC,GAAG,CAAwB,QAAQ,CAAC,CAAC;QAClE,aAAa,KAAK,IAAI,CAAC,aAAa,EAAE,CAAC;QACvC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QACtC,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QACvC,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AA1SD,wEA0SC","sourcesContent":["import is from '@sindresorhus/is';\nimport { GlobalConfig } from '../../../config/global';\nimport { logger } from '../../../logger';\nimport { ExternalHostError } from '../../../types/errors/external-host-error';\nimport * as memCache from '../../cache/memory';\nimport * as packageCache from '../../cache/package';\nimport type { PackageCacheNamespace } from '../../cache/package/types';\nimport type {\n GithubGraphqlResponse,\n GithubHttp,\n GithubHttpOptions,\n} from '../../http/github';\nimport type { HttpResponse } from '../../http/types';\nimport { getApiBaseUrl } from '../url';\nimport { GithubGraphqlMemoryCacheStrategy } from './cache-strategies/memory-cache-strategy';\nimport { GithubGraphqlPackageCacheStrategy } from './cache-strategies/package-cache-strategy';\nimport type {\n GithubDatasourceItem,\n GithubGraphqlCacheStrategy,\n GithubGraphqlDatasourceAdapter,\n GithubGraphqlPayload,\n GithubGraphqlRepoParams,\n GithubGraphqlRepoResponse,\n GithubPackageConfig,\n RawQueryResponse,\n} from './types';\n\n/**\n * We know empirically that certain type of GraphQL errors\n * can be fixed by shrinking page size.\n *\n * @see https://github.com/renovatebot/renovate/issues/16343\n */\nfunction isUnknownGraphqlError(err: Error): boolean {\n const { message } = err;\n return message.startsWith('Something went wrong while executing your query.');\n}\n\nfunction canBeSolvedByShrinking(err: Error): boolean {\n const errors: Error[] = err instanceof AggregateError ? err.errors : [err];\n return errors.some(\n (e) => err instanceof ExternalHostError || isUnknownGraphqlError(e),\n );\n}\n\nexport class GithubGraphqlDatasourceFetcher<\n GraphqlItem,\n ResultItem extends GithubDatasourceItem,\n> {\n static async query<T, U extends GithubDatasourceItem>(\n config: GithubPackageConfig,\n http: GithubHttp,\n adapter: GithubGraphqlDatasourceAdapter<T, U>,\n ): Promise<U[]> {\n const instance = new GithubGraphqlDatasourceFetcher<T, U>(\n config,\n http,\n adapter,\n );\n const items = await instance.getItems();\n return items;\n }\n\n private readonly baseUrl: string;\n private readonly repoOwner: string;\n private readonly repoName: string;\n\n private itemsPerQuery: 100 | 50 | 25 = 100;\n\n private queryCount = 0;\n\n private cursor: string | null = null;\n\n private isPersistent: boolean | undefined;\n\n constructor(\n packageConfig: GithubPackageConfig,\n private http: GithubHttp,\n private datasourceAdapter: GithubGraphqlDatasourceAdapter<\n GraphqlItem,\n ResultItem\n >,\n ) {\n const { packageName, registryUrl } = packageConfig;\n [this.repoOwner, this.repoName] = packageName.split('/');\n this.baseUrl = getApiBaseUrl(registryUrl).replace(/\\/v3\\/$/, '/'); // Replace for GHE\n }\n\n private getCacheNs(): PackageCacheNamespace {\n return this.datasourceAdapter.key;\n }\n\n private getCacheKey(): string {\n return [this.baseUrl, this.repoOwner, this.repoName].join(':');\n }\n\n private getRawQueryOptions(): GithubHttpOptions {\n const baseUrl = this.baseUrl;\n const repository = `${this.repoOwner}/${this.repoName}`;\n const query = this.datasourceAdapter.query;\n const variables: GithubGraphqlRepoParams = {\n owner: this.repoOwner,\n name: this.repoName,\n count: this.itemsPerQuery,\n cursor: this.cursor,\n };\n\n return {\n baseUrl,\n repository,\n readOnly: true,\n body: { query, variables },\n };\n }\n\n private async doRawQuery(): Promise<\n RawQueryResponse<GithubGraphqlPayload<GraphqlItem>>\n > {\n const requestOptions = this.getRawQueryOptions();\n\n type GraphqlData = GithubGraphqlRepoResponse<GraphqlItem>;\n type HttpBody = GithubGraphqlResponse<GraphqlData>;\n let httpRes: HttpResponse<HttpBody>;\n try {\n httpRes = await this.http.postJson<HttpBody>('/graphql', requestOptions);\n } catch (err) {\n return [null, err];\n }\n\n const { body } = httpRes;\n const { data, errors } = body;\n\n if (errors?.length) {\n if (errors.length === 1) {\n const { message } = errors[0];\n const err = new Error(message);\n return [null, err];\n } else {\n const errorInstances = errors.map(({ message }) => new Error(message));\n const err = new AggregateError(errorInstances);\n return [null, err];\n }\n }\n\n if (!data) {\n const msg = 'GitHub GraphQL datasource: failed to obtain data';\n const err = new Error(msg);\n return [null, err];\n }\n\n if (!data.repository) {\n const msg = 'GitHub GraphQL datasource: failed to obtain repository data';\n const err = new Error(msg);\n return [null, err];\n }\n\n if (!data.repository.payload) {\n const msg =\n 'GitHub GraphQL datasource: failed to obtain repository payload data';\n const err = new Error(msg);\n return [null, err];\n }\n\n this.queryCount += 1;\n\n // For values other than explicit `false`,\n // we assume that items can not be cached.\n this.isPersistent ??= data.repository.isRepoPrivate === false;\n\n const res = data.repository.payload;\n return [res, null];\n }\n\n private shrinkPageSize(): boolean {\n if (this.itemsPerQuery === 100) {\n this.itemsPerQuery = 50;\n return true;\n }\n\n if (this.itemsPerQuery === 50) {\n this.itemsPerQuery = 25;\n return true;\n }\n\n return false;\n }\n\n private hasReachedQueryLimit(): boolean {\n return this.queryCount >= 100;\n }\n\n private async doShrinkableQuery(): Promise<\n GithubGraphqlPayload<GraphqlItem>\n > {\n let res: GithubGraphqlPayload<GraphqlItem> | null = null;\n let err: Error | null = null;\n\n while (!res) {\n [res, err] = await this.doRawQuery();\n if (err) {\n if (!canBeSolvedByShrinking(err)) {\n throw err;\n }\n\n const shrinkResult = this.shrinkPageSize();\n if (!shrinkResult) {\n throw err;\n }\n const { body, ...options } = this.getRawQueryOptions();\n logger.debug(\n { options, newSize: this.itemsPerQuery },\n 'Shrinking GitHub GraphQL page size after error',\n );\n }\n }\n\n return res;\n }\n\n private _cacheStrategy: GithubGraphqlCacheStrategy<ResultItem> | undefined;\n\n private cacheStrategy(): GithubGraphqlCacheStrategy<ResultItem> {\n if (this._cacheStrategy) {\n return this._cacheStrategy;\n }\n const cacheNs = this.getCacheNs();\n const cacheKey = this.getCacheKey();\n const cachePrivatePackages = GlobalConfig.get(\n 'cachePrivatePackages',\n false,\n );\n const skipStabilization = !is.undefined(this.datasourceAdapter.maxItems);\n this._cacheStrategy =\n cachePrivatePackages || this.isPersistent\n ? new GithubGraphqlPackageCacheStrategy<ResultItem>(\n cacheNs,\n cacheKey,\n skipStabilization,\n )\n : new GithubGraphqlMemoryCacheStrategy<ResultItem>(\n cacheNs,\n cacheKey,\n skipStabilization,\n );\n return this._cacheStrategy;\n }\n\n /**\n * This method is responsible for data synchronization.\n * It also detects persistence of the package, based on the first page result.\n */\n private async doPaginatedFetch(): Promise<void> {\n let hasNextPage = true;\n let isPaginationDone = false;\n let nextCursor: string | undefined;\n let itemCount = 0;\n const maxItems = this.datasourceAdapter.maxItems;\n while (hasNextPage && !isPaginationDone && !this.hasReachedQueryLimit()) {\n if (!is.undefined(maxItems) && itemCount >= maxItems) {\n break;\n }\n const queryResult = await this.doShrinkableQuery();\n\n const resultItems: ResultItem[] = [];\n for (const node of queryResult.nodes) {\n const item = this.datasourceAdapter.transform(node);\n if (!item) {\n logger.once.info(\n {\n packageName: `${this.repoOwner}/${this.repoName}`,\n baseUrl: this.baseUrl,\n },\n `GitHub GraphQL datasource: skipping empty item`,\n );\n continue;\n }\n resultItems.push(item);\n }\n itemCount += resultItems.length;\n\n // It's important to call `getCacheStrategy()` after `doShrinkableQuery()`\n // because `doShrinkableQuery()` may change `this.isCacheable`.\n //\n // Otherwise, cache items for public packages will never be persisted\n // in long-term cache.\n isPaginationDone = await this.cacheStrategy().reconcile(resultItems);\n\n hasNextPage = !!queryResult?.pageInfo?.hasNextPage;\n nextCursor = queryResult?.pageInfo?.endCursor;\n if (hasNextPage && nextCursor) {\n this.cursor = nextCursor;\n }\n }\n\n if (this.isPersistent) {\n await this.storePersistenceFlag(30);\n }\n }\n\n private async doCachedQuery(): Promise<ResultItem[]> {\n await this.loadPersistenceFlag();\n if (!this.isPersistent) {\n await this.doPaginatedFetch();\n }\n\n const res = await this.cacheStrategy().finalizeAndReturn();\n if (res.length) {\n return res;\n }\n\n delete this.isPersistent;\n await this.doPaginatedFetch();\n return this.cacheStrategy().finalizeAndReturn();\n }\n\n async loadPersistenceFlag(): Promise<void> {\n const ns = this.getCacheNs();\n const key = `${this.getCacheKey()}:is-persistent`;\n this.isPersistent = await packageCache.get<true>(ns, key);\n }\n\n async storePersistenceFlag(minutes: number): Promise<void> {\n const ns = this.getCacheNs();\n const key = `${this.getCacheKey()}:is-persistent`;\n await packageCache.set(ns, key, true, minutes);\n }\n\n /**\n * This method ensures the only one query is executed\n * to a particular package during single run.\n */\n private doUniqueQuery(): Promise<ResultItem[]> {\n const cacheKey = `github-pending:${this.getCacheNs()}:${this.getCacheKey()}`;\n let resultPromise = memCache.get<Promise<ResultItem[]>>(cacheKey);\n resultPromise ??= this.doCachedQuery();\n memCache.set(cacheKey, resultPromise);\n return resultPromise;\n }\n\n async getItems(): Promise<ResultItem[]> {\n const res = await this.doUniqueQuery();\n return res;\n }\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GithubHttp } from '../../http/github';
|
|
2
|
-
import type { GithubPackageConfig, GithubReleaseItem, GithubTagItem } from './types';
|
|
2
|
+
import type { GithubBranchItem, GithubPackageConfig, GithubReleaseItem, GithubTagItem } from './types';
|
|
3
3
|
export declare function queryTags(config: GithubPackageConfig, http: GithubHttp): Promise<GithubTagItem[]>;
|
|
4
4
|
export declare function queryReleases(config: GithubPackageConfig, http: GithubHttp): Promise<GithubReleaseItem[]>;
|
|
5
|
+
export declare function queryBranches(config: GithubPackageConfig, http: GithubHttp): Promise<GithubBranchItem[]>;
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.queryTags = queryTags;
|
|
4
4
|
exports.queryReleases = queryReleases;
|
|
5
|
+
exports.queryBranches = queryBranches;
|
|
5
6
|
const datasource_fetcher_1 = require("./datasource-fetcher");
|
|
7
|
+
const branches_query_adapter_1 = require("./query-adapters/branches-query-adapter");
|
|
6
8
|
const releases_query_adapter_1 = require("./query-adapters/releases-query-adapter");
|
|
7
9
|
const tags_query_adapter_1 = require("./query-adapters/tags-query-adapter");
|
|
8
10
|
async function queryTags(config, http) {
|
|
@@ -13,4 +15,8 @@ async function queryReleases(config, http) {
|
|
|
13
15
|
const res = await datasource_fetcher_1.GithubGraphqlDatasourceFetcher.query(config, http, releases_query_adapter_1.adapter);
|
|
14
16
|
return res;
|
|
15
17
|
}
|
|
18
|
+
async function queryBranches(config, http) {
|
|
19
|
+
const res = await datasource_fetcher_1.GithubGraphqlDatasourceFetcher.query(config, http, branches_query_adapter_1.adapter);
|
|
20
|
+
return res;
|
|
21
|
+
}
|
|
16
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/util/github/graphql/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/util/github/graphql/index.ts"],"names":[],"mappings":";;AAYA,8BAUC;AAED,sCAUC;AAED,sCAUC;AA7CD,6DAAsE;AACtE,oFAAqF;AACrF,oFAAqF;AACrF,4EAA6E;AAQtE,KAAK,UAAU,SAAS,CAC7B,MAA2B,EAC3B,IAAgB;IAEhB,MAAM,GAAG,GAAG,MAAM,mDAA8B,CAAC,KAAK,CACpD,MAAM,EACN,IAAI,EACJ,4BAAW,CACZ,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC;AAEM,KAAK,UAAU,aAAa,CACjC,MAA2B,EAC3B,IAAgB;IAEhB,MAAM,GAAG,GAAG,MAAM,mDAA8B,CAAC,KAAK,CACpD,MAAM,EACN,IAAI,EACJ,gCAAe,CAChB,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC;AAEM,KAAK,UAAU,aAAa,CACjC,MAA2B,EAC3B,IAAgB;IAEhB,MAAM,GAAG,GAAG,MAAM,mDAA8B,CAAC,KAAK,CACpD,MAAM,EACN,IAAI,EACJ,gCAAe,CAChB,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import type { GithubHttp } from '../../http/github';\nimport { GithubGraphqlDatasourceFetcher } from './datasource-fetcher';\nimport { adapter as branchesAdapter } from './query-adapters/branches-query-adapter';\nimport { adapter as releasesAdapter } from './query-adapters/releases-query-adapter';\nimport { adapter as tagsAdapter } from './query-adapters/tags-query-adapter';\nimport type {\n GithubBranchItem,\n GithubPackageConfig,\n GithubReleaseItem,\n GithubTagItem,\n} from './types';\n\nexport async function queryTags(\n config: GithubPackageConfig,\n http: GithubHttp,\n): Promise<GithubTagItem[]> {\n const res = await GithubGraphqlDatasourceFetcher.query(\n config,\n http,\n tagsAdapter,\n );\n return res;\n}\n\nexport async function queryReleases(\n config: GithubPackageConfig,\n http: GithubHttp,\n): Promise<GithubReleaseItem[]> {\n const res = await GithubGraphqlDatasourceFetcher.query(\n config,\n http,\n releasesAdapter,\n );\n return res;\n}\n\nexport async function queryBranches(\n config: GithubPackageConfig,\n http: GithubHttp,\n): Promise<GithubBranchItem[]> {\n const res = await GithubGraphqlDatasourceFetcher.query(\n config,\n http,\n branchesAdapter,\n );\n return res;\n}\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Timestamp } from '../../../timestamp';
|
|
3
|
+
import type { GithubBranchItem, GithubGraphqlDatasourceAdapter } from '../types';
|
|
4
|
+
declare const GithubGraphqlBranch: z.ZodObject<{
|
|
5
|
+
version: z.ZodString;
|
|
6
|
+
target: z.ZodObject<{
|
|
7
|
+
type: z.ZodLiteral<"Commit">;
|
|
8
|
+
oid: z.ZodString;
|
|
9
|
+
releaseTimestamp: z.ZodEffects<z.ZodUnknown, Timestamp, unknown>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
type: "Commit";
|
|
12
|
+
releaseTimestamp: string & {
|
|
13
|
+
__timestamp: never;
|
|
14
|
+
};
|
|
15
|
+
oid: string;
|
|
16
|
+
}, {
|
|
17
|
+
type: "Commit";
|
|
18
|
+
oid: string;
|
|
19
|
+
releaseTimestamp?: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
version: string;
|
|
23
|
+
target: {
|
|
24
|
+
type: "Commit";
|
|
25
|
+
releaseTimestamp: string & {
|
|
26
|
+
__timestamp: never;
|
|
27
|
+
};
|
|
28
|
+
oid: string;
|
|
29
|
+
};
|
|
30
|
+
}, {
|
|
31
|
+
version: string;
|
|
32
|
+
target: {
|
|
33
|
+
type: "Commit";
|
|
34
|
+
oid: string;
|
|
35
|
+
releaseTimestamp?: unknown;
|
|
36
|
+
};
|
|
37
|
+
}>;
|
|
38
|
+
export type GithubGraphqlBranch = z.infer<typeof GithubGraphqlBranch>;
|
|
39
|
+
export declare const adapter: GithubGraphqlDatasourceAdapter<GithubGraphqlBranch, GithubBranchItem>;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.adapter = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const timestamp_1 = require("../../../timestamp");
|
|
6
|
+
const util_1 = require("../util");
|
|
7
|
+
const key = 'github-branches-datasource-v1';
|
|
8
|
+
const GithubGraphqlBranch = zod_1.z.object({
|
|
9
|
+
version: zod_1.z.string(),
|
|
10
|
+
target: zod_1.z.object({
|
|
11
|
+
type: zod_1.z.literal('Commit'),
|
|
12
|
+
oid: zod_1.z.string(),
|
|
13
|
+
releaseTimestamp: timestamp_1.Timestamp,
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
const query = (0, util_1.prepareQuery)(`
|
|
17
|
+
refs(
|
|
18
|
+
first: $count
|
|
19
|
+
after: $cursor
|
|
20
|
+
refPrefix: "refs/heads/"
|
|
21
|
+
) {
|
|
22
|
+
pageInfo {
|
|
23
|
+
hasNextPage
|
|
24
|
+
endCursor
|
|
25
|
+
}
|
|
26
|
+
nodes {
|
|
27
|
+
version: name
|
|
28
|
+
target {
|
|
29
|
+
type: __typename
|
|
30
|
+
... on Commit {
|
|
31
|
+
oid
|
|
32
|
+
releaseTimestamp: committedDate
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}`);
|
|
37
|
+
function transform(item) {
|
|
38
|
+
const res = GithubGraphqlBranch.safeParse(item);
|
|
39
|
+
if (!res.success) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const { version, target } = item;
|
|
43
|
+
const releaseTimestamp = target.releaseTimestamp;
|
|
44
|
+
const hash = target.oid;
|
|
45
|
+
return { version, gitRef: version, hash, releaseTimestamp };
|
|
46
|
+
}
|
|
47
|
+
exports.adapter = { key, query, transform, maxItems: 300 };
|
|
48
|
+
//# sourceMappingURL=branches-query-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branches-query-adapter.js","sourceRoot":"","sources":["../../../../../lib/util/github/graphql/query-adapters/branches-query-adapter.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,kDAA+C;AAK/C,kCAAuC;AAEvC,MAAM,GAAG,GAAG,+BAA+B,CAAC;AAE5C,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QACzB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;QACf,gBAAgB,EAAE,qBAAS;KAC5B,CAAC;CACH,CAAC,CAAC;AAGH,MAAM,KAAK,GAAG,IAAA,mBAAY,EAAC;;;;;;;;;;;;;;;;;;;;IAoBvB,CAAC,CAAC;AAEN,SAAS,SAAS,CAAC,IAAyB;IAC1C,MAAM,GAAG,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACjC,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IACjD,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC;IACxB,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;AAC9D,CAAC;AAEY,QAAA,OAAO,GAGhB,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC","sourcesContent":["import { z } from 'zod';\nimport { Timestamp } from '../../../timestamp';\nimport type {\n GithubBranchItem,\n GithubGraphqlDatasourceAdapter,\n} from '../types';\nimport { prepareQuery } from '../util';\n\nconst key = 'github-branches-datasource-v1';\n\nconst GithubGraphqlBranch = z.object({\n version: z.string(),\n target: z.object({\n type: z.literal('Commit'),\n oid: z.string(),\n releaseTimestamp: Timestamp,\n }),\n});\nexport type GithubGraphqlBranch = z.infer<typeof GithubGraphqlBranch>;\n\nconst query = prepareQuery(`\n refs(\n first: $count\n after: $cursor\n refPrefix: \"refs/heads/\"\n ) {\n pageInfo {\n hasNextPage\n endCursor\n }\n nodes {\n version: name\n target {\n type: __typename\n ... on Commit {\n oid\n releaseTimestamp: committedDate\n }\n }\n }\n }`);\n\nfunction transform(item: GithubGraphqlBranch): GithubBranchItem | null {\n const res = GithubGraphqlBranch.safeParse(item);\n if (!res.success) {\n return null;\n }\n\n const { version, target } = item;\n const releaseTimestamp = target.releaseTimestamp;\n const hash = target.oid;\n return { version, gitRef: version, hash, releaseTimestamp };\n}\n\nexport const adapter: GithubGraphqlDatasourceAdapter<\n GithubGraphqlBranch,\n GithubBranchItem\n> = { key, query, transform, maxItems: 300 };\n"]}
|
|
@@ -23,6 +23,12 @@ export interface GithubGraphqlDatasourceAdapter<Input, Output extends GithubData
|
|
|
23
23
|
* @param input GraphQL node data
|
|
24
24
|
*/
|
|
25
25
|
transform(input: Input): Output | null;
|
|
26
|
+
/**
|
|
27
|
+
* Maximum number of items to fetch. Undefined means unlimited.
|
|
28
|
+
* When set, disables early termination based on stabilization.
|
|
29
|
+
* Useful for refs that can't be sorted by date (e.g. branches).
|
|
30
|
+
*/
|
|
31
|
+
maxItems?: number;
|
|
26
32
|
}
|
|
27
33
|
export type RawQueryResponse<Payload> = [Payload, null] | [null, Error];
|
|
28
34
|
export interface GithubGraphqlPayload<T> {
|
|
@@ -65,6 +71,13 @@ export interface GithubTagItem extends GithubDatasourceItem {
|
|
|
65
71
|
hash: string;
|
|
66
72
|
gitRef: string;
|
|
67
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Result of GraphQL response transformation for branches
|
|
76
|
+
*/
|
|
77
|
+
export interface GithubBranchItem extends GithubDatasourceItem {
|
|
78
|
+
hash: string;
|
|
79
|
+
gitRef: string;
|
|
80
|
+
}
|
|
68
81
|
/**
|
|
69
82
|
* Parameters being passed as GraphQL variables
|
|
70
83
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../lib/util/github/graphql/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { PackageCacheNamespace } from '../../cache/package/types';\nimport type { Timestamp } from '../../timestamp';\n\nexport interface GithubDatasourceItem {\n version: string;\n releaseTimestamp: Timestamp;\n}\n\n/**\n * Datasource-specific structure\n */\nexport interface GithubGraphqlDatasourceAdapter<\n Input,\n Output extends GithubDatasourceItem,\n> {\n /**\n * Used for creating datasource-unique cache key\n */\n key: PackageCacheNamespace;\n\n /**\n * Used to define datasource-unique GraphQL query\n */\n query: string;\n\n /**\n * Used for transforming GraphQL nodes to objects\n * that have `version` and `releaseTimestamp` fields.\n *\n * @param input GraphQL node data\n */\n transform(input: Input): Output | null;\n}\n\nexport type RawQueryResponse<Payload> = [Payload, null] | [null, Error];\n\nexport interface GithubGraphqlPayload<T> {\n nodes: T[];\n pageInfo?: {\n hasNextPage?: boolean;\n endCursor?: string;\n };\n}\n\nexport interface GithubGraphqlRepoResponse<T> {\n repository: {\n isRepoPrivate?: boolean;\n payload: GithubGraphqlPayload<T>;\n };\n}\n\nexport interface GithubPackageConfig {\n /**\n * Example: renovatebot/renovate\n */\n packageName: string;\n\n /**\n * Default: https://api.github.com\n */\n registryUrl?: string | undefined;\n}\n\n/**\n * Result of GraphQL response transformation for releases (via adapter)\n */\nexport interface GithubReleaseItem extends GithubDatasourceItem {\n isStable?: boolean;\n url: string;\n id?: number;\n name?: string;\n description?: string;\n}\n\n/**\n * Result of GraphQL response transformation for tags (via tags)\n */\nexport interface GithubTagItem extends GithubDatasourceItem {\n hash: string;\n gitRef: string;\n}\n\n/**\n * Parameters being passed as GraphQL variables\n */\nexport interface GithubGraphqlRepoParams {\n owner: string;\n name: string;\n cursor: string | null;\n count: number;\n}\n\nexport interface GithubGraphqlCacheRecord<\n GithubItem extends GithubDatasourceItem,\n> {\n items: Record<string, GithubItem>;\n createdAt: string;\n}\n\nexport interface GithubGraphqlCacheStrategy<\n GithubItem extends GithubDatasourceItem,\n> {\n reconcile(items: GithubItem[]): Promise<boolean>;\n finalizeAndReturn(): Promise<GithubItem[]>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../lib/util/github/graphql/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { PackageCacheNamespace } from '../../cache/package/types';\nimport type { Timestamp } from '../../timestamp';\n\nexport interface GithubDatasourceItem {\n version: string;\n releaseTimestamp: Timestamp;\n}\n\n/**\n * Datasource-specific structure\n */\nexport interface GithubGraphqlDatasourceAdapter<\n Input,\n Output extends GithubDatasourceItem,\n> {\n /**\n * Used for creating datasource-unique cache key\n */\n key: PackageCacheNamespace;\n\n /**\n * Used to define datasource-unique GraphQL query\n */\n query: string;\n\n /**\n * Used for transforming GraphQL nodes to objects\n * that have `version` and `releaseTimestamp` fields.\n *\n * @param input GraphQL node data\n */\n transform(input: Input): Output | null;\n\n /**\n * Maximum number of items to fetch. Undefined means unlimited.\n * When set, disables early termination based on stabilization.\n * Useful for refs that can't be sorted by date (e.g. branches).\n */\n maxItems?: number;\n}\n\nexport type RawQueryResponse<Payload> = [Payload, null] | [null, Error];\n\nexport interface GithubGraphqlPayload<T> {\n nodes: T[];\n pageInfo?: {\n hasNextPage?: boolean;\n endCursor?: string;\n };\n}\n\nexport interface GithubGraphqlRepoResponse<T> {\n repository: {\n isRepoPrivate?: boolean;\n payload: GithubGraphqlPayload<T>;\n };\n}\n\nexport interface GithubPackageConfig {\n /**\n * Example: renovatebot/renovate\n */\n packageName: string;\n\n /**\n * Default: https://api.github.com\n */\n registryUrl?: string | undefined;\n}\n\n/**\n * Result of GraphQL response transformation for releases (via adapter)\n */\nexport interface GithubReleaseItem extends GithubDatasourceItem {\n isStable?: boolean;\n url: string;\n id?: number;\n name?: string;\n description?: string;\n}\n\n/**\n * Result of GraphQL response transformation for tags (via tags)\n */\nexport interface GithubTagItem extends GithubDatasourceItem {\n hash: string;\n gitRef: string;\n}\n\n/**\n * Result of GraphQL response transformation for branches\n */\nexport interface GithubBranchItem extends GithubDatasourceItem {\n hash: string;\n gitRef: string;\n}\n\n/**\n * Parameters being passed as GraphQL variables\n */\nexport interface GithubGraphqlRepoParams {\n owner: string;\n name: string;\n cursor: string | null;\n count: number;\n}\n\nexport interface GithubGraphqlCacheRecord<\n GithubItem extends GithubDatasourceItem,\n> {\n items: Record<string, GithubItem>;\n createdAt: string;\n}\n\nexport interface GithubGraphqlCacheStrategy<\n GithubItem extends GithubDatasourceItem,\n> {\n reconcile(items: GithubItem[]): Promise<boolean>;\n finalizeAndReturn(): Promise<GithubItem[]>;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "renovate",
|
|
3
3
|
"description": "Automated dependency updates. Flexible so you don't need to be.",
|
|
4
|
-
"version": "42.66.
|
|
4
|
+
"version": "42.66.12",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"renovate": "dist/renovate.js",
|
|
@@ -217,9 +217,9 @@
|
|
|
217
217
|
"re2": "1.23.0"
|
|
218
218
|
},
|
|
219
219
|
"devDependencies": {
|
|
220
|
-
"@containerbase/eslint-plugin": "1.1.
|
|
221
|
-
"@containerbase/istanbul-reports-html": "1.1.
|
|
222
|
-
"@containerbase/semantic-release-pnpm": "1.3.
|
|
220
|
+
"@containerbase/eslint-plugin": "1.1.24",
|
|
221
|
+
"@containerbase/istanbul-reports-html": "1.1.21",
|
|
222
|
+
"@containerbase/semantic-release-pnpm": "1.3.12",
|
|
223
223
|
"@eslint/js": "9.39.2",
|
|
224
224
|
"@hyrious/marshal": "0.3.3",
|
|
225
225
|
"@ls-lint/ls-lint": "2.3.1",
|
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
"tsx": "4.21.0",
|
|
298
298
|
"type-fest": "5.3.1",
|
|
299
299
|
"typescript": "5.9.3",
|
|
300
|
-
"typescript-eslint": "8.50.
|
|
300
|
+
"typescript-eslint": "8.50.1",
|
|
301
301
|
"unified": "11.0.5",
|
|
302
302
|
"vite": "8.0.0-beta.2",
|
|
303
303
|
"vite-tsconfig-paths": "5.1.4",
|
package/renovate-schema.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"title": "JSON schema for Renovate 42.66.
|
|
2
|
+
"title": "JSON schema for Renovate 42.66.12 config files (https://renovatebot.com/)",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
-
"x-renovate-version": "42.66.
|
|
4
|
+
"x-renovate-version": "42.66.12",
|
|
5
5
|
"allowComments": true,
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|