renovate 39.183.0 → 39.185.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/config/options/index.js +1 -1
- package/dist/config/options/index.js.map +1 -1
- package/dist/config/presets/gitlab/index.js +1 -1
- package/dist/config/presets/gitlab/index.js.map +1 -1
- package/dist/config/presets/http/index.js +1 -1
- package/dist/config/presets/http/index.js.map +1 -1
- package/dist/modules/datasource/artifactory/index.js +1 -1
- package/dist/modules/datasource/artifactory/index.js.map +1 -1
- package/dist/modules/datasource/crate/index.js +1 -1
- package/dist/modules/datasource/crate/index.js.map +1 -1
- package/dist/modules/datasource/custom/formats/html.js +1 -1
- package/dist/modules/datasource/custom/formats/html.js.map +1 -1
- package/dist/modules/datasource/custom/formats/yaml.js +1 -1
- package/dist/modules/datasource/custom/formats/yaml.js.map +1 -1
- package/dist/modules/datasource/deb/index.js +1 -1
- package/dist/modules/datasource/deb/index.js.map +1 -1
- package/dist/modules/datasource/docker/index.js +1 -1
- package/dist/modules/datasource/docker/index.js.map +1 -1
- package/dist/modules/datasource/github-release-attachments/index.js +2 -2
- package/dist/modules/datasource/github-release-attachments/index.js.map +1 -1
- package/dist/modules/datasource/go/base.js +1 -1
- package/dist/modules/datasource/go/base.js.map +1 -1
- package/dist/modules/datasource/go/releases-goproxy.js +1 -1
- package/dist/modules/datasource/go/releases-goproxy.js.map +1 -1
- package/dist/modules/datasource/golang-version/index.js +1 -1
- package/dist/modules/datasource/golang-version/index.js.map +1 -1
- package/dist/modules/datasource/hexpm-bob/index.js +1 -1
- package/dist/modules/datasource/hexpm-bob/index.js.map +1 -1
- package/dist/modules/datasource/maven/util.js +1 -1
- package/dist/modules/datasource/maven/util.js.map +1 -1
- package/dist/modules/datasource/nuget/v2.js +1 -1
- package/dist/modules/datasource/nuget/v2.js.map +1 -1
- package/dist/modules/datasource/nuget/v3.js +1 -1
- package/dist/modules/datasource/nuget/v3.js.map +1 -1
- package/dist/modules/datasource/pod/index.js +1 -1
- package/dist/modules/datasource/pod/index.js.map +1 -1
- package/dist/modules/datasource/pypi/index.js +1 -1
- package/dist/modules/datasource/pypi/index.js.map +1 -1
- package/dist/modules/datasource/ruby-version/index.js +1 -1
- package/dist/modules/datasource/ruby-version/index.js.map +1 -1
- package/dist/modules/datasource/rubygems/index.js +1 -1
- package/dist/modules/datasource/rubygems/index.js.map +1 -1
- package/dist/modules/datasource/rubygems/versions-endpoint-cache.js +2 -2
- package/dist/modules/datasource/rubygems/versions-endpoint-cache.js.map +1 -1
- package/dist/modules/datasource/terraform-provider/index.js +1 -1
- package/dist/modules/datasource/terraform-provider/index.js.map +1 -1
- package/dist/modules/manager/batect-wrapper/artifacts.js +1 -1
- package/dist/modules/manager/batect-wrapper/artifacts.js.map +1 -1
- package/dist/modules/manager/gradle-wrapper/artifacts.js +1 -1
- package/dist/modules/manager/gradle-wrapper/artifacts.js.map +1 -1
- package/dist/modules/manager/terraform/lockfile/hash.d.ts +1 -1
- package/dist/modules/platform/bitbucket/index.js +1 -1
- package/dist/modules/platform/bitbucket/index.js.map +1 -1
- package/dist/modules/platform/gerrit/client.js +1 -1
- package/dist/modules/platform/gerrit/client.js.map +1 -1
- package/dist/modules/platform/github/common.d.ts +2 -0
- package/dist/modules/platform/github/common.js +16 -0
- package/dist/modules/platform/github/common.js.map +1 -1
- package/dist/modules/platform/github/index.d.ts +1 -1
- package/dist/modules/platform/github/index.js +6 -4
- package/dist/modules/platform/github/index.js.map +1 -1
- package/dist/util/http/auth.js +0 -1
- package/dist/util/http/auth.js.map +1 -1
- package/dist/util/http/bitbucket-server.d.ts +5 -4
- package/dist/util/http/bitbucket-server.js +17 -20
- package/dist/util/http/bitbucket-server.js.map +1 -1
- package/dist/util/http/bitbucket.d.ts +6 -5
- package/dist/util/http/bitbucket.js +28 -32
- package/dist/util/http/bitbucket.js.map +1 -1
- package/dist/util/http/cache/abstract-http-cache-provider.js +1 -1
- package/dist/util/http/cache/abstract-http-cache-provider.js.map +1 -1
- package/dist/util/http/errors.d.ts +2 -0
- package/dist/util/http/errors.js +8 -0
- package/dist/util/http/errors.js.map +1 -0
- package/dist/util/http/gerrit.d.ts +6 -4
- package/dist/util/http/gerrit.js +11 -12
- package/dist/util/http/gerrit.js.map +1 -1
- package/dist/util/http/gitea.d.ts +5 -4
- package/dist/util/http/gitea.js +12 -13
- package/dist/util/http/gitea.js.map +1 -1
- package/dist/util/http/github.d.ts +14 -8
- package/dist/util/http/github.js +64 -60
- package/dist/util/http/github.js.map +1 -1
- package/dist/util/http/gitlab.d.ts +7 -5
- package/dist/util/http/gitlab.js +56 -46
- package/dist/util/http/gitlab.js.map +1 -1
- package/dist/util/http/got.d.ts +9 -0
- package/dist/util/http/got.js +54 -0
- package/dist/util/http/got.js.map +1 -0
- package/dist/util/http/host-rules.d.ts +2 -1
- package/dist/util/http/host-rules.js.map +1 -1
- package/dist/util/http/http.d.ts +93 -0
- package/dist/util/http/http.js +339 -0
- package/dist/util/http/http.js.map +1 -0
- package/dist/util/http/index.d.ts +6 -74
- package/dist/util/http/index.js +5 -359
- package/dist/util/http/index.js.map +1 -1
- package/dist/util/http/types.d.ts +9 -16
- package/dist/util/http/types.js.map +1 -1
- package/dist/util/url.js +3 -8
- package/dist/util/url.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/bitbucket/index.js +1 -1
- package/dist/workers/repository/update/pr/changelog/bitbucket/index.js.map +1 -1
- package/dist/workers/repository/update/pr/changelog/gitlab/index.js +1 -1
- package/dist/workers/repository/update/pr/changelog/gitlab/index.js.map +1 -1
- package/package.json +3 -3
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../lib/util/http/auth.ts"],"names":[],"mappings":";;AAoBA,gDAiEC;AAgBD,
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../lib/util/http/auth.ts"],"names":[],"mappings":";;AAoBA,gDAiEC;AAgBD,kDAsBC;;AA3HD,kEAAkC;AAElC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sindresorhus/is';\nimport type { Options } from 'got';\nimport {\n GITEA_API_USING_HOST_TYPES,\n GITHUB_API_USING_HOST_TYPES,\n GITLAB_API_USING_HOST_TYPES,\n} from '../../constants';\nimport type { GotOptions } from './types';\n\nexport type AuthGotOptions = Pick<\n GotOptions,\n | 'hostType'\n | 'headers'\n | 'noAuth'\n | 'context'\n | 'token'\n | 'username'\n | 'password'\n>;\n\nexport function applyAuthorization<GotOptions extends AuthGotOptions>(\n inOptions: GotOptions,\n): GotOptions {\n const options: GotOptions = { ...inOptions };\n\n if (is.nonEmptyString(options.headers?.authorization) || options.noAuth) {\n return options;\n }\n\n options.headers ??= {};\n if (options.token) {\n const authType = options.context?.authType;\n if (authType) {\n if (authType === 'Token-Only') {\n options.headers.authorization = options.token;\n } else {\n options.headers.authorization = `${authType} ${options.token}`;\n }\n } else if (\n options.hostType &&\n GITEA_API_USING_HOST_TYPES.includes(options.hostType)\n ) {\n // Gitea v1.8.0 and later support `Bearer` as alternate to `token`\n // https://github.com/go-gitea/gitea/pull/5378\n options.headers.authorization = `Bearer ${options.token}`;\n } else if (\n options.hostType &&\n GITHUB_API_USING_HOST_TYPES.includes(options.hostType)\n ) {\n options.headers.authorization = `token ${options.token}`;\n if (options.token.startsWith('x-access-token:')) {\n const appToken = options.token.replace('x-access-token:', '');\n options.headers.authorization = `token ${appToken}`;\n if (is.string(options.headers.accept)) {\n options.headers.accept = options.headers.accept.replace(\n 'application/vnd.github.v3+json',\n 'application/vnd.github.machine-man-preview+json',\n );\n }\n }\n } else if (\n options.hostType &&\n GITLAB_API_USING_HOST_TYPES.includes(options.hostType)\n ) {\n // GitLab versions earlier than 12.2 only support authentication with\n // a personal access token, which is 20 characters long.\n if (options.token.length === 20) {\n options.headers['Private-token'] = options.token;\n } else {\n options.headers.authorization = `Bearer ${options.token}`;\n }\n } else {\n options.headers.authorization = `Bearer ${options.token}`;\n }\n delete options.token;\n } else if (options.password !== undefined) {\n // Otherwise got will add username and password to url and header\n const auth = Buffer.from(\n `${options.username ?? ''}:${options.password}`,\n ).toString('base64');\n options.headers.authorization = `Basic ${auth}`;\n delete options.username;\n delete options.password;\n }\n return options;\n}\n\n// isAmazon return true if request options contains Amazon related headers\nfunction isAmazon(options: Options): boolean {\n return !!options.search?.includes('X-Amz-Algorithm');\n}\n\n// isAzureBlob return true if request options contains Azure container registry related data\nfunction isAzureBlob(options: Options): boolean {\n return !!(\n options.hostname?.endsWith('.blob.core.windows.net') && // lgtm [js/incomplete-url-substring-sanitization]\n options.href?.includes('/docker/registry')\n );\n}\n\n// removeAuthorization from the redirect options\nexport function removeAuthorization(options: Options): void {\n if (!options.password && !options.headers?.authorization) {\n return;\n }\n\n // Check if request has been redirected to Amazon or an Azure blob (ACR)\n if (isAmazon(options) || isAzureBlob(options)) {\n // if there is no port in the redirect URL string, then delete it from the redirect options.\n // This can be evaluated for removal after upgrading to Got v10\n const portInUrl = options.href?.split?.('/')?.[2]?.split(':')?.[1];\n if (!portInUrl) {\n delete options.port; // Redirect will instead use 80 or 443 for HTTP or HTTPS respectively\n }\n\n // registry is hosted on Amazon or Azure blob, redirect url includes\n // authentication which is not required and should be removed\n if (options?.headers?.authorization) {\n delete options.headers.authorization;\n }\n delete options.username;\n delete options.password;\n }\n}\n"]}
|
@@ -1,11 +1,12 @@
|
|
1
|
-
import
|
2
|
-
import {
|
1
|
+
import { HttpBase, type InternalJsonUnsafeOptions } from './http';
|
2
|
+
import type { HttpMethod, HttpOptions, HttpResponse } from './types';
|
3
3
|
export declare const setBaseUrl: (url: string) => void;
|
4
4
|
export interface BitbucketServerHttpOptions extends HttpOptions {
|
5
5
|
paginate?: boolean;
|
6
6
|
limit?: number;
|
7
7
|
}
|
8
|
-
export declare class BitbucketServerHttp extends
|
8
|
+
export declare class BitbucketServerHttp extends HttpBase<BitbucketServerHttpOptions> {
|
9
|
+
protected get baseUrl(): string | undefined;
|
9
10
|
constructor(options?: HttpOptions);
|
10
|
-
protected
|
11
|
+
protected requestJsonUnsafe<T>(method: HttpMethod, options: InternalJsonUnsafeOptions<BitbucketServerHttpOptions>): Promise<HttpResponse<T>>;
|
11
12
|
}
|
@@ -3,41 +3,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BitbucketServerHttp = exports.setBaseUrl = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
|
6
|
-
const
|
7
|
-
const url_1 = require("../url");
|
8
|
-
const _1 = require(".");
|
6
|
+
const http_1 = require("./http");
|
9
7
|
const MAX_LIMIT = 100;
|
10
8
|
let baseUrl;
|
11
9
|
const setBaseUrl = (url) => {
|
12
10
|
baseUrl = url;
|
13
11
|
};
|
14
12
|
exports.setBaseUrl = setBaseUrl;
|
15
|
-
class BitbucketServerHttp extends
|
13
|
+
class BitbucketServerHttp extends http_1.HttpBase {
|
14
|
+
get baseUrl() {
|
15
|
+
return baseUrl;
|
16
|
+
}
|
16
17
|
constructor(options) {
|
17
18
|
super('bitbucket-server', options);
|
18
19
|
}
|
19
|
-
async
|
20
|
-
const
|
21
|
-
opts
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
const
|
26
|
-
if (
|
27
|
-
|
28
|
-
throw new Error(`Bitbucket Server: cannot parse path ${path}`);
|
29
|
-
}
|
30
|
-
if (opts.paginate) {
|
31
|
-
const limit = opts.limit ?? MAX_LIMIT;
|
20
|
+
async requestJsonUnsafe(method, options) {
|
21
|
+
const resolvedUrl = this.resolveUrl(options.url, options.httpOptions);
|
22
|
+
const opts = { ...options, url: resolvedUrl };
|
23
|
+
opts.httpOptions ??= {};
|
24
|
+
opts.httpOptions.headers ??= {};
|
25
|
+
opts.httpOptions.headers['X-Atlassian-Token'] = 'no-check';
|
26
|
+
const paginate = opts.httpOptions.paginate;
|
27
|
+
if (paginate) {
|
28
|
+
const limit = opts.httpOptions.limit ?? MAX_LIMIT;
|
32
29
|
resolvedUrl.searchParams.set('limit', limit.toString());
|
33
30
|
}
|
34
|
-
const result = await super.
|
35
|
-
if (
|
31
|
+
const result = await super.requestJsonUnsafe(method, opts);
|
32
|
+
if (paginate && isPagedResult(result.body)) {
|
36
33
|
const collectedValues = [...result.body.values];
|
37
34
|
let nextPageStart = result.body.nextPageStart;
|
38
35
|
while (nextPageStart) {
|
39
36
|
resolvedUrl.searchParams.set('start', nextPageStart.toString());
|
40
|
-
const nextResult = await super.
|
37
|
+
const nextResult = await super.requestJsonUnsafe(method, opts);
|
41
38
|
collectedValues.push(...nextResult.body.values);
|
42
39
|
nextPageStart = nextResult.body.nextPageStart;
|
43
40
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"bitbucket-server.js","sourceRoot":"","sources":["../../../lib/util/http/bitbucket-server.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAClC,
|
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;AAYF,MAAa,mBAAoB,SAAQ,eAAoC;IAC3E,IAAuB,OAAO;QAC5B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,YAAY,OAAqB;QAC/B,KAAK,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IAEkB,KAAK,CAAC,iBAAiB,CACxC,MAAkB,EAClB,OAA8D;QAE9D,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QACtE,MAAM,IAAI,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC;QAC9C,I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AS,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;\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}\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(options?: HttpOptions) {\n super('bitbucket-server', 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 const collectedValues = [...result.body.values];\n let nextPageStart = result.body.nextPageStart;\n\n while (nextPageStart) {\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"]}
|
@@ -1,11 +1,12 @@
|
|
1
|
-
import
|
2
|
-
import {
|
3
|
-
export declare
|
1
|
+
import { HttpBase, type InternalJsonUnsafeOptions } from './http';
|
2
|
+
import type { HttpMethod, HttpOptions, HttpResponse } from './types';
|
3
|
+
export declare function setBaseUrl(url: string): void;
|
4
4
|
export interface BitbucketHttpOptions extends HttpOptions {
|
5
5
|
paginate?: boolean;
|
6
6
|
pagelen?: number;
|
7
7
|
}
|
8
|
-
export declare class BitbucketHttp extends
|
8
|
+
export declare class BitbucketHttp extends HttpBase<BitbucketHttpOptions> {
|
9
|
+
protected get baseUrl(): string | undefined;
|
9
10
|
constructor(type?: string, options?: BitbucketHttpOptions);
|
10
|
-
protected
|
11
|
+
protected requestJsonUnsafe<T>(method: HttpMethod, options: InternalJsonUnsafeOptions<BitbucketHttpOptions>): Promise<HttpResponse<T>>;
|
11
12
|
}
|
@@ -1,53 +1,49 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.BitbucketHttp =
|
3
|
+
exports.BitbucketHttp = void 0;
|
4
|
+
exports.setBaseUrl = setBaseUrl;
|
4
5
|
const tslib_1 = require("tslib");
|
5
6
|
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
|
6
|
-
const
|
7
|
-
const url_1 = require("../url");
|
8
|
-
const _1 = require(".");
|
7
|
+
const http_1 = require("./http");
|
9
8
|
const MAX_PAGES = 100;
|
10
9
|
const MAX_PAGELEN = 100;
|
11
10
|
let baseUrl = 'https://api.bitbucket.org/';
|
12
|
-
|
11
|
+
function setBaseUrl(url) {
|
13
12
|
baseUrl = url;
|
14
|
-
}
|
15
|
-
|
16
|
-
|
13
|
+
}
|
14
|
+
class BitbucketHttp extends http_1.HttpBase {
|
15
|
+
get baseUrl() {
|
16
|
+
return baseUrl;
|
17
|
+
}
|
17
18
|
constructor(type = 'bitbucket', options) {
|
18
19
|
super(type, options);
|
19
20
|
}
|
20
|
-
async
|
21
|
-
const
|
22
|
-
const
|
23
|
-
|
24
|
-
if (
|
25
|
-
|
26
|
-
|
27
|
-
}
|
28
|
-
if (opts.paginate && !hasPagelen(resolvedURL)) {
|
29
|
-
const pagelen = opts.pagelen ?? MAX_PAGELEN;
|
30
|
-
resolvedURL.searchParams.set('pagelen', pagelen.toString());
|
21
|
+
async requestJsonUnsafe(method, options) {
|
22
|
+
const resolvedUrl = this.resolveUrl(options.url, options.httpOptions);
|
23
|
+
const opts = { ...options, url: resolvedUrl };
|
24
|
+
const paginate = opts.httpOptions?.paginate;
|
25
|
+
if (paginate && !hasPagelen(resolvedUrl)) {
|
26
|
+
const pagelen = opts.httpOptions.pagelen ?? MAX_PAGELEN;
|
27
|
+
resolvedUrl.searchParams.set('pagelen', pagelen.toString());
|
31
28
|
}
|
32
|
-
const result = await super.
|
33
|
-
if (
|
29
|
+
const result = await super.requestJsonUnsafe(method, opts);
|
30
|
+
if (paginate && isPagedResult(result.body)) {
|
34
31
|
const resultBody = result.body;
|
35
|
-
let
|
36
|
-
let
|
37
|
-
|
38
|
-
|
32
|
+
let nextURL = result.body.next;
|
33
|
+
let page = 2;
|
34
|
+
for (; nextURL && page <= MAX_PAGES; page++) {
|
35
|
+
resolvedUrl.searchParams.set('page', page.toString());
|
36
|
+
const nextResult = await super.requestJsonUnsafe(method, opts);
|
39
37
|
resultBody.values.push(...nextResult.body.values);
|
40
|
-
nextURL = nextResult.body
|
41
|
-
page += 1;
|
38
|
+
nextURL = nextResult.body.next;
|
42
39
|
}
|
43
40
|
// Override other page-related attributes
|
44
41
|
resultBody.pagelen = resultBody.values.length;
|
42
|
+
/* v8 ignore start: hard to test all branches */
|
45
43
|
resultBody.size =
|
46
|
-
page <= MAX_PAGES
|
47
|
-
|
48
|
-
|
49
|
-
resultBody.next =
|
50
|
-
page <= MAX_PAGES ? nextURL : /* istanbul ignore next */ undefined;
|
44
|
+
page <= MAX_PAGES ? resultBody.values.length : undefined;
|
45
|
+
resultBody.next = page <= MAX_PAGES ? nextURL : undefined;
|
46
|
+
/* v8 ignore stop */
|
51
47
|
}
|
52
48
|
return result;
|
53
49
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"bitbucket.js","sourceRoot":"","sources":["../../../lib/util/http/bitbucket.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"bitbucket.js","sourceRoot":"","sources":["../../../lib/util/http/bitbucket.ts"],"names":[],"mappings":";;;AAUA,gCAEC;;AAZD,kEAAkC;AAElC,iCAAkE;AAGlE,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,IAAI,OAAO,GAAG,4BAA4B,CAAC;AAE3C,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,GAAG,CAAC;AAChB,CAAC;AAOD,MAAa,aAAc,SAAQ,eAA8B;IAC/D,IAAuB,OAAO;QAC5B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,YAAY,IAAI,GAAG,WAAW,EAAE,OAA8B;QAC5D,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvB,CAAC;IAEkB,KAAK,CAAC,iBAAiB,CACxC,MAAkB,EAClB,OAAwD;QAExD,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QACtE,MAAM,IAAI,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC;QAE5C,IAAI,QAAQ,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YACzC,MAAM,OAAO,GAAG,IAAI,CAAC,WAAY,CAAC,OAAO,IAAI,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D,sCAsDC;AAED,SAAS,UAAU,CAAC,GAAQ;IAC1B,OAAO,CAAC,YAAE,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,aAAa,CAAI,GAAQ;IAChC,OAAO,YAAE,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport type { PagedResult } from '../../modules/platform/bitbucket/types';\nimport { HttpBase, type InternalJsonUnsafeOptions } from './http';\nimport type { HttpMethod, HttpOptions, HttpResponse } from './types';\n\nconst MAX_PAGES = 100;\nconst MAX_PAGELEN = 100;\n\nlet baseUrl = 'https://api.bitbucket.org/';\n\nexport function setBaseUrl(url: string): void {\n baseUrl = url;\n}\n\nexport interface BitbucketHttpOptions extends HttpOptions {\n paginate?: boolean;\n pagelen?: number;\n}\n\nexport class BitbucketHttp extends HttpBase<BitbucketHttpOptions> {\n protected override get baseUrl(): string | undefined {\n return baseUrl;\n }\n\n constructor(type = 'bitbucket', options?: BitbucketHttpOptions) {\n super(type, options);\n }\n\n protected override async requestJsonUnsafe<T>(\n method: HttpMethod,\n options: InternalJsonUnsafeOptions<BitbucketHttpOptions>,\n ): Promise<HttpResponse<T>> {\n const resolvedUrl = this.resolveUrl(options.url, options.httpOptions);\n const opts = { ...options, url: resolvedUrl };\n const paginate = opts.httpOptions?.paginate;\n\n if (paginate && !hasPagelen(resolvedUrl)) {\n const pagelen = opts.httpOptions!.pagelen ?? MAX_PAGELEN;\n resolvedUrl.searchParams.set('pagelen', pagelen.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 const resultBody = result.body;\n let nextURL = result.body.next;\n let page = 2;\n\n for (; nextURL && page <= MAX_PAGES; page++) {\n resolvedUrl.searchParams.set('page', page.toString());\n const nextResult = await super.requestJsonUnsafe<PagedResult<T>>(\n method,\n opts,\n );\n\n resultBody.values.push(...nextResult.body.values);\n nextURL = nextResult.body.next;\n }\n\n // Override other page-related attributes\n resultBody.pagelen = resultBody.values.length;\n /* v8 ignore start: hard to test all branches */\n resultBody.size =\n page <= MAX_PAGES ? resultBody.values.length : undefined;\n resultBody.next = page <= MAX_PAGES ? nextURL : undefined;\n /* v8 ignore stop */\n }\n\n return result as HttpResponse<T>;\n }\n}\n\nfunction hasPagelen(url: URL): boolean {\n return !is.nullOrUndefined(url.searchParams.get('pagelen'));\n}\n\nfunction isPagedResult<T>(obj: any): obj is PagedResult<T> {\n return is.nonEmptyObject(obj) && Array.isArray(obj.values);\n}\n"]}
|
@@ -43,7 +43,7 @@ class AbstractHttpCacheProvider {
|
|
43
43
|
httpResponse,
|
44
44
|
timestamp,
|
45
45
|
});
|
46
|
-
|
46
|
+
/* v8 ignore next 4: should never happen */
|
47
47
|
if (!newHttpCache) {
|
48
48
|
logger_1.logger.debug(`http cache: failed to persist cache for ${url}`);
|
49
49
|
return resp;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"abstract-http-cache-provider.js","sourceRoot":"","sources":["../../../../lib/util/http/cache/abstract-http-cache-provider.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,uCAA6C;AAE7C,kCAAuC;AACvC,qCAA2D;AAG3D,MAAsB,yBAAyB;IAI7C,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,SAAS,GAAG,wBAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,SAAsB,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,GAAW,EACX,IAAO;QAEP,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QAED,IAAI,CAAC,OAAO,KAAK,EAAE,CAAC;QAEpB,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC;QACjD,CAAC;QAED,IAAI,SAAS,CAAC,YAAY,EAAE,CAAC;YAC3B,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,YAAY,CACV,IAAY,EACZ,cAAuB;QAEvB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,GAAW,EACX,IAAqB;QAErB,IAAI,IAAI,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC;YAChC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,eAAe,CAAC,CAAC;YAErD,sBAAc,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;YAEpC,MAAM,YAAY,GAAG,IAAA,mBAAY,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC9C,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YAE3C,MAAM,YAAY,GAAG,wBAAe,CAAC,KAAK,CAAC;gBACzC,IAAI;gBACJ,YAAY;gBACZ,YAAY;gBACZ,SAAS;aACV,CAAC,CAAC;YAEH,
|
1
|
+
{"version":3,"file":"abstract-http-cache-provider.js","sourceRoot":"","sources":["../../../../lib/util/http/cache/abstract-http-cache-provider.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,uCAA6C;AA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port type { GotOptions, HttpResponse } from '../types';\nimport { copyResponse } from '../util';\nimport { type HttpCache, HttpCacheSchema } from './schema';\nimport type { HttpCacheProvider } from './types';\n\nexport abstract class AbstractHttpCacheProvider implements HttpCacheProvider {\n protected abstract load(url: string): Promise<unknown>;\n protected abstract persist(url: string, data: HttpCache): Promise<void>;\n\n async get(url: string): Promise<HttpCache | null> {\n const cache = await this.load(url);\n const httpCache = HttpCacheSchema.parse(cache);\n if (!httpCache) {\n return null;\n }\n\n return httpCache as HttpCache;\n }\n\n async setCacheHeaders<T extends Pick<GotOptions, 'headers'>>(\n url: string,\n opts: T,\n ): Promise<void> {\n const httpCache = await this.get(url);\n if (!httpCache) {\n return;\n }\n\n opts.headers ??= {};\n\n if (httpCache.etag) {\n opts.headers['If-None-Match'] = httpCache.etag;\n }\n\n if (httpCache.lastModified) {\n opts.headers['If-Modified-Since'] = httpCache.lastModified;\n }\n }\n\n bypassServer<T>(\n _url: string,\n _ignoreSoftTtl: boolean,\n ): Promise<HttpResponse<T> | null> {\n return Promise.resolve(null);\n }\n\n async wrapServerResponse<T>(\n url: string,\n resp: HttpResponse<T>,\n ): Promise<HttpResponse<T>> {\n if (resp.statusCode === 200) {\n const etag = resp.headers?.etag;\n const lastModified = resp.headers?.['last-modified'];\n\n HttpCacheStats.incRemoteMisses(url);\n\n const httpResponse = copyResponse(resp, true);\n const timestamp = new Date().toISOString();\n\n const newHttpCache = HttpCacheSchema.parse({\n etag,\n lastModified,\n httpResponse,\n timestamp,\n });\n\n /* v8 ignore next 4: should never happen */\n if (!newHttpCache) {\n logger.debug(`http cache: failed to persist cache for ${url}`);\n return resp;\n }\n\n logger.debug(\n `http cache: saving ${url} (etag=${etag}, lastModified=${lastModified})`,\n );\n await this.persist(url, newHttpCache as HttpCache);\n return resp;\n }\n\n if (resp.statusCode === 304) {\n const httpCache = await this.get(url);\n if (!httpCache) {\n return resp;\n }\n\n const timestamp = httpCache.timestamp;\n logger.debug(\n `http cache: Using cached response: ${url} from ${timestamp}`,\n );\n HttpCacheStats.incRemoteHits(url);\n const cachedResp = copyResponse(\n httpCache.httpResponse as HttpResponse<T>,\n true,\n );\n cachedResp.authorization = resp.authorization;\n return cachedResp;\n }\n\n return resp;\n }\n}\n"]}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.EmptyResultError = void 0;
|
4
|
+
// required for zod type safety with `Result.wrap`
|
5
|
+
class EmptyResultError extends Error {
|
6
|
+
}
|
7
|
+
exports.EmptyResultError = EmptyResultError;
|
8
|
+
//# sourceMappingURL=errors.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../lib/util/http/errors.ts"],"names":[],"mappings":";;;AAAA,kDAAkD;AAClD,MAAa,gBAAiB,SAAQ,KAAK;CAAG;AAA9C,4CAA8C","sourcesContent":["// required for zod type safety with `Result.wrap`\nexport class EmptyResultError extends Error {}\n"]}
|
@@ -1,12 +1,14 @@
|
|
1
|
-
import
|
2
|
-
import {
|
1
|
+
import { HttpBase, type InternalHttpOptions } from './http';
|
2
|
+
import type { HttpOptions } from './types';
|
3
3
|
export declare function setBaseUrl(url: string): void;
|
4
4
|
/**
|
5
5
|
* Access Gerrit REST-API and strip-of the "magic prefix" from responses.
|
6
6
|
* @see https://gerrit-review.googlesource.com/Documentation/rest-api.html
|
7
7
|
*/
|
8
|
-
export declare class GerritHttp extends
|
8
|
+
export declare class GerritHttp extends HttpBase {
|
9
9
|
private static magicPrefix;
|
10
|
+
protected get baseUrl(): string | undefined;
|
10
11
|
constructor(options?: HttpOptions);
|
11
|
-
protected
|
12
|
+
protected resolveUrl(requestUrl: string | URL, options: HttpOptions | undefined): URL;
|
13
|
+
protected processOptions(url: URL, options: InternalHttpOptions): void;
|
12
14
|
}
|
package/dist/util/http/gerrit.js
CHANGED
@@ -5,7 +5,7 @@ exports.setBaseUrl = setBaseUrl;
|
|
5
5
|
const common_1 = require("../common");
|
6
6
|
const regex_1 = require("../regex");
|
7
7
|
const url_1 = require("../url");
|
8
|
-
const
|
8
|
+
const http_1 = require("./http");
|
9
9
|
let baseUrl;
|
10
10
|
function setBaseUrl(url) {
|
11
11
|
baseUrl = url;
|
@@ -14,21 +14,20 @@ function setBaseUrl(url) {
|
|
14
14
|
* Access Gerrit REST-API and strip-of the "magic prefix" from responses.
|
15
15
|
* @see https://gerrit-review.googlesource.com/Documentation/rest-api.html
|
16
16
|
*/
|
17
|
-
class GerritHttp extends
|
17
|
+
class GerritHttp extends http_1.HttpBase {
|
18
18
|
static magicPrefix = (0, regex_1.regEx)(/^\)]}'\n/g);
|
19
|
+
get baseUrl() {
|
20
|
+
return baseUrl;
|
21
|
+
}
|
19
22
|
constructor(options) {
|
20
23
|
super('gerrit', options);
|
21
24
|
}
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
opts.headers = {
|
29
|
-
...opts.headers,
|
30
|
-
};
|
31
|
-
return await super.request(url, opts);
|
25
|
+
resolveUrl(requestUrl, options) {
|
26
|
+
// ensure trailing slash for gerrit
|
27
|
+
return super.resolveUrl((0, url_1.isHttpUrl)(requestUrl) ? requestUrl : `${baseUrl}${requestUrl}`, options);
|
28
|
+
}
|
29
|
+
processOptions(url, options) {
|
30
|
+
options.parseJson = (text) => (0, common_1.parseJson)(text.replace(GerritHttp.magicPrefix, ''), url.pathname);
|
32
31
|
}
|
33
32
|
}
|
34
33
|
exports.GerritHttp = GerritHttp;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"gerrit.js","sourceRoot":"","sources":["../../../lib/util/http/gerrit.ts"],"names":[],"mappings":";;;AAOA,gCAEC;AATD,sCAAsC;AACtC,oCAAiC;AACjC,gCAAmC;
|
1
|
+
{"version":3,"file":"gerrit.js","sourceRoot":"","sources":["../../../lib/util/http/gerrit.ts"],"names":[],"mappings":";;;AAOA,gCAEC;AATD,sCAAsC;AACtC,oCAAiC;AACjC,gCAAmC;AACnC,iCAA4D;AAG5D,IAAI,OAAe,CAAC;AACpB,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,GAAG,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAa,UAAW,SAAQ,eAAQ;IAC9B,MAAM,CAAC,WAAW,GAAG,IAAA,aAAK,EAAC,WAAW,CAAC,CAAC;IAEhD,IAAuB,OAAO;QAC5B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,YAAY,OAAqB;QAC/B,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3B,CAAC;IAEkB,UAAU,CAC3B,UAAwB,EACxB,OAAgC;QAEhC,mCAAmC;QACnC,OAAO,KAAK,CAAC,UAAU,CACrB,IAAA,eAAS,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,UAAU,EAAE,EAC9D,OAAO,CACR,CAAC;IACJ,CAAC;IAEkB,cAAc,CAC/B,GAAQ,EACR,OAA4B;QAE5B,OAAO,CAAC,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE,CACnC,IAAA,kBAAS,EAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtE,CAAC;;AA5BH,gCA6BC","sourcesContent":["import { parseJson } from '../common';\nimport { regEx } from '../regex';\nimport { isHttpUrl } from '../url';\nimport { HttpBase, type InternalHttpOptions } from './http';\nimport type { HttpOptions } from './types';\n\nlet baseUrl: string;\nexport function setBaseUrl(url: string): void {\n baseUrl = url;\n}\n\n/**\n * Access Gerrit REST-API and strip-of the \"magic prefix\" from responses.\n * @see https://gerrit-review.googlesource.com/Documentation/rest-api.html\n */\nexport class GerritHttp extends HttpBase {\n private static magicPrefix = regEx(/^\\)]}'\\n/g);\n\n protected override get baseUrl(): string | undefined {\n return baseUrl;\n }\n\n constructor(options?: HttpOptions) {\n super('gerrit', options);\n }\n\n protected override resolveUrl(\n requestUrl: string | URL,\n options: HttpOptions | undefined,\n ): URL {\n // ensure trailing slash for gerrit\n return super.resolveUrl(\n isHttpUrl(requestUrl) ? requestUrl : `${baseUrl}${requestUrl}`,\n options,\n );\n }\n\n protected override processOptions(\n url: URL,\n options: InternalHttpOptions,\n ): void {\n options.parseJson = (text: string) =>\n parseJson(text.replace(GerritHttp.magicPrefix, ''), url.pathname);\n }\n}\n"]}
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import
|
2
|
-
import {
|
1
|
+
import { HttpBase, type InternalJsonUnsafeOptions } from './http';
|
2
|
+
import type { HttpMethod, HttpOptions, HttpResponse } from './types';
|
3
3
|
export declare const setBaseUrl: (newBaseUrl: string) => void;
|
4
4
|
export interface GiteaHttpOptions extends HttpOptions {
|
5
5
|
paginate?: boolean;
|
6
6
|
}
|
7
|
-
export declare class GiteaHttp extends
|
7
|
+
export declare class GiteaHttp extends HttpBase<GiteaHttpOptions> {
|
8
|
+
protected get baseUrl(): string | undefined;
|
8
9
|
constructor(hostType?: string, options?: HttpOptions);
|
9
|
-
protected
|
10
|
+
protected requestJsonUnsafe<T = unknown>(method: HttpMethod, options: InternalJsonUnsafeOptions<GiteaHttpOptions>): Promise<HttpResponse<T>>;
|
10
11
|
}
|
package/dist/util/http/gitea.js
CHANGED
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GiteaHttp = exports.setBaseUrl = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
|
6
|
-
const
|
7
|
-
const _1 = require(".");
|
6
|
+
const http_1 = require("./http");
|
8
7
|
let baseUrl;
|
9
8
|
const setBaseUrl = (newBaseUrl) => {
|
10
9
|
baseUrl = newBaseUrl.replace(/\/*$/, '/'); // TODO #12875
|
@@ -19,29 +18,29 @@ function getPaginationContainer(body) {
|
|
19
18
|
}
|
20
19
|
return null;
|
21
20
|
}
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
}
|
26
|
-
class GiteaHttp extends _1.Http {
|
21
|
+
class GiteaHttp extends http_1.HttpBase {
|
22
|
+
get baseUrl() {
|
23
|
+
return baseUrl;
|
24
|
+
}
|
27
25
|
constructor(hostType, options) {
|
28
26
|
super(hostType ?? 'gitea', options);
|
29
27
|
}
|
30
|
-
async
|
31
|
-
const resolvedUrl = resolveUrl(
|
28
|
+
async requestJsonUnsafe(method, options) {
|
29
|
+
const resolvedUrl = this.resolveUrl(options.url, options.httpOptions);
|
32
30
|
const opts = {
|
33
|
-
baseUrl,
|
34
31
|
...options,
|
32
|
+
url: resolvedUrl,
|
35
33
|
};
|
36
|
-
const res = await super.
|
34
|
+
const res = await super.requestJsonUnsafe(method, opts);
|
37
35
|
const pc = getPaginationContainer(res.body);
|
38
|
-
if (opts.paginate && pc) {
|
36
|
+
if (opts.httpOptions?.paginate && pc) {
|
37
|
+
delete opts.httpOptions.paginate;
|
39
38
|
const total = parseInt(res.headers['x-total-count'], 10);
|
40
39
|
let nextPage = parseInt(resolvedUrl.searchParams.get('page') ?? '1', 10);
|
41
40
|
while (total && pc.length < total) {
|
42
41
|
nextPage += 1;
|
43
42
|
resolvedUrl.searchParams.set('page', nextPage.toString());
|
44
|
-
const nextRes = await super.
|
43
|
+
const nextRes = await super.requestJsonUnsafe(method, opts);
|
45
44
|
const nextPc = getPaginationContainer(nextRes.body);
|
46
45
|
if (nextPc === null) {
|
47
46
|
break;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"gitea.js","sourceRoot":"","sources":["../../../lib/util/http/gitea.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAClC,
|
1
|
+
{"version":3,"file":"gitea.js","sourceRoot":"","sources":["../../../lib/util/http/gitea.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAClC,iCAAkE;AAGlE,IAAI,OAAe,CAAC;AACb,MAAM,U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AC,QAAQ,CAAC;YACjC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAW,EAAE,EAAE,CAAC,CAAC;YACnE,IAAI,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC,CAAC;YAEzE,OAAO,KAAK,IAAI,EAAE,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;gBAClC,QAAQ,IAAI,CAAC,CAAC;gBACd,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAE1D,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,iBAAiB,CAAI,MAAM,EAAE,IAAI,CAAC,CAAC;gBAC/D,MAAM,MAAM,GAAG,sBAAsB,CAAI,OAAO,CAAC,IAAI,CAAC,CAAC;gBACvD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;oBACpB,MAAM;gBACR,CAAC;gBAED,EAAE,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAzCD,8BAyCC","sourcesContent":["import is from '@sindresorhus/is';\nimport { HttpBase, type InternalJsonUnsafeOptions } from './http';\nimport type { HttpMethod, HttpOptions, HttpResponse } from './types';\n\nlet baseUrl: string;\nexport const setBaseUrl = (newBaseUrl: string): void => {\n baseUrl = newBaseUrl.replace(/\\/*$/, '/'); // TODO #12875\n};\n\nexport interface GiteaHttpOptions extends HttpOptions {\n paginate?: boolean;\n}\n\nfunction getPaginationContainer<T = unknown>(body: unknown): T[] | null {\n if (is.array(body) && body.length) {\n return body as T[];\n }\n\n if (is.plainObject(body) && is.array(body?.data) && body.data.length) {\n return body.data as T[];\n }\n\n return null;\n}\n\nexport class GiteaHttp extends HttpBase<GiteaHttpOptions> {\n protected override get baseUrl(): string | undefined {\n return baseUrl;\n }\n\n constructor(hostType?: string, options?: HttpOptions) {\n super(hostType ?? 'gitea', options);\n }\n\n protected override async requestJsonUnsafe<T = unknown>(\n method: HttpMethod,\n options: InternalJsonUnsafeOptions<GiteaHttpOptions>,\n ): Promise<HttpResponse<T>> {\n const resolvedUrl = this.resolveUrl(options.url, options.httpOptions);\n const opts = {\n ...options,\n url: resolvedUrl,\n };\n const res = await super.requestJsonUnsafe<T>(method, opts);\n const pc = getPaginationContainer<T>(res.body);\n if (opts.httpOptions?.paginate && pc) {\n delete opts.httpOptions.paginate;\n const total = parseInt(res.headers['x-total-count'] as string, 10);\n let nextPage = parseInt(resolvedUrl.searchParams.get('page') ?? '1', 10);\n\n while (total && pc.length < total) {\n nextPage += 1;\n resolvedUrl.searchParams.set('page', nextPage.toString());\n\n const nextRes = await super.requestJsonUnsafe<T>(method, opts);\n const nextPc = getPaginationContainer<T>(nextRes.body);\n if (nextPc === null) {\n break;\n }\n\n pc.push(...nextPc);\n }\n }\n\n return res;\n }\n}\n"]}
|
@@ -1,11 +1,14 @@
|
|
1
|
-
import
|
2
|
-
import {
|
1
|
+
import { HttpBase, type InternalHttpOptions, type InternalJsonUnsafeOptions } from './http';
|
2
|
+
import type { GotLegacyError } from './legacy';
|
3
|
+
import type { GraphqlOptions, HttpMethod, HttpOptions, HttpResponse } from './types';
|
3
4
|
export declare const setBaseUrl: (url: string) => void;
|
4
|
-
export interface
|
5
|
+
export interface GithubBaseHttpOptions extends HttpOptions {
|
6
|
+
repository?: string;
|
7
|
+
}
|
8
|
+
export interface GithubHttpOptions extends GithubBaseHttpOptions {
|
5
9
|
paginate?: boolean | string;
|
6
10
|
paginationField?: string;
|
7
11
|
pageLimit?: number;
|
8
|
-
repository?: string;
|
9
12
|
}
|
10
13
|
export type GithubGraphqlResponse<T = unknown> = {
|
11
14
|
data: T;
|
@@ -22,9 +25,12 @@ interface GraphqlPageCacheItem {
|
|
22
25
|
pageSize: number;
|
23
26
|
}
|
24
27
|
export type GraphqlPageCache = Record<string, GraphqlPageCacheItem>;
|
25
|
-
export declare class GithubHttp extends
|
26
|
-
|
27
|
-
|
28
|
+
export declare class GithubHttp extends HttpBase<GithubHttpOptions> {
|
29
|
+
protected get baseUrl(): string | undefined;
|
30
|
+
constructor(hostType?: string, options?: HttpOptions);
|
31
|
+
protected processOptions(url: URL, opts: InternalHttpOptions & GithubBaseHttpOptions): void;
|
32
|
+
protected handleError(url: string | URL, opts: HttpOptions, err: GotLegacyError): never;
|
33
|
+
protected requestJsonUnsafe<T>(method: HttpMethod, options: InternalJsonUnsafeOptions<GithubHttpOptions>): Promise<HttpResponse<T>>;
|
28
34
|
requestGraphql<T = unknown>(query: string, options?: GraphqlOptions): Promise<GithubGraphqlResponse<T> | null>;
|
29
35
|
queryRepoField<T = Record<string, unknown>>(query: string, fieldName: string, options?: GraphqlOptions): Promise<T[]>;
|
30
36
|
/**
|
@@ -38,6 +44,6 @@ export declare class GithubHttp extends Http<GithubHttpOptions> {
|
|
38
44
|
* @example url = 'renovatebot/renovate/contents/package.json'
|
39
45
|
* @example url = 'package.json' & options.repository = 'renovatebot/renovate'
|
40
46
|
*/
|
41
|
-
getRawTextFile(url: string, options?: InternalHttpOptions &
|
47
|
+
getRawTextFile(url: string, options?: InternalHttpOptions & GithubBaseHttpOptions): Promise<HttpResponse>;
|
42
48
|
}
|
43
49
|
export {};
|