@rushstack/rush-sdk 5.144.0-pr5031.0 → 5.144.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,21 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { type RequestOptions } from 'node:https';
2
+ import * as fetch from 'node-fetch';
4
3
  /**
5
4
  * For use with {@link WebClient}.
6
5
  */
7
- export interface IWebClientResponse {
8
- ok: boolean;
9
- status: number;
10
- statusText?: string;
11
- redirected: boolean;
12
- getTextAsync: () => Promise<string>;
13
- getJsonAsync: <TJson>() => Promise<TJson>;
14
- getBufferAsync: () => Promise<Buffer>;
15
- }
6
+ export type WebClientResponse = fetch.Response;
7
+ /**
8
+ * For use with {@link WebClient}.
9
+ */
10
+ export type WebClientHeaders = fetch.Headers;
11
+ export declare const WebClientHeaders: typeof fetch.Headers;
16
12
  /**
17
13
  * For use with {@link WebClient}.
18
14
  */
19
15
  export interface IWebFetchOptionsBase {
20
16
  timeoutMs?: number;
21
- headers?: Record<string, string>;
22
- redirect?: 'follow' | 'error' | 'manual';
17
+ headers?: WebClientHeaders | Record<string, string>;
18
+ redirect?: fetch.RequestInit['redirect'];
23
19
  }
24
20
  /**
25
21
  * For use with {@link WebClient}.
@@ -42,23 +38,19 @@ export declare enum WebClientProxy {
42
38
  Detect = 1,
43
39
  Fiddler = 2
44
40
  }
45
- export interface IRequestOptions extends RequestOptions, Pick<IFetchOptionsWithBody, 'body' | 'redirect'> {
46
- }
47
- export type FetchFn = (url: string, options: IRequestOptions, isRedirect?: boolean) => Promise<IWebClientResponse>;
48
- export declare const AUTHORIZATION_HEADER_NAME: 'Authorization';
49
41
  /**
50
42
  * A helper for issuing HTTP requests.
51
43
  */
52
44
  export declare class WebClient {
53
45
  private static _requestFn;
54
- readonly standardHeaders: Record<string, string>;
46
+ readonly standardHeaders: fetch.Headers;
55
47
  accept: string | undefined;
56
48
  userAgent: string | undefined;
57
49
  proxy: WebClientProxy;
58
- static mockRequestFn(fn: FetchFn): void;
50
+ static mockRequestFn(fn: typeof fetch.default): void;
59
51
  static resetMockRequestFn(): void;
60
- static mergeHeaders(target: Record<string, string>, source: Record<string, string>): void;
52
+ static mergeHeaders(target: fetch.Headers, source: fetch.Headers | Record<string, string>): void;
61
53
  addBasicAuthHeader(userName: string, password: string): void;
62
- fetchAsync(url: string, options?: IGetFetchOptions | IFetchOptionsWithBody): Promise<IWebClientResponse>;
54
+ fetchAsync(url: string, options?: IGetFetchOptions | IFetchOptionsWithBody): Promise<WebClientResponse>;
63
55
  }
64
56
  //# sourceMappingURL=WebClient.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/rush-sdk",
3
- "version": "5.144.0-pr5031.0",
3
+ "version": "5.144.1",
4
4
  "description": "An API for interacting with the Rush engine",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,22 +33,23 @@
33
33
  },
34
34
  "license": "MIT",
35
35
  "dependencies": {
36
+ "@types/node-fetch": "2.6.2",
36
37
  "tapable": "2.2.1",
37
- "@rushstack/lookup-by-path": "0.4.5",
38
- "@rushstack/package-deps-hash": "4.2.10",
38
+ "@rushstack/lookup-by-path": "0.4.6",
39
39
  "@rushstack/node-core-library": "5.10.0",
40
+ "@rushstack/package-deps-hash": "4.2.11",
40
41
  "@rushstack/terminal": "0.14.3"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@types/semver": "7.5.0",
44
45
  "@types/webpack-env": "1.18.0",
45
46
  "webpack": "~5.95.0",
46
- "@microsoft/rush-lib": "5.144.0-pr5031.0",
47
- "@rushstack/heft": "0.68.9",
48
- "@rushstack/heft-webpack5-plugin": "0.11.7",
49
47
  "local-node-rig": "1.0.0",
50
- "@rushstack/stream-collator": "4.1.77",
51
- "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.76",
48
+ "@rushstack/heft-webpack5-plugin": "0.11.8",
49
+ "@rushstack/heft": "0.68.10",
50
+ "@rushstack/stream-collator": "4.1.78",
51
+ "@microsoft/rush-lib": "5.144.1",
52
+ "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.77",
52
53
  "@rushstack/ts-command-line": "4.23.1"
53
54
  },
54
55
  "scripts": {