@rushstack/rush-sdk 5.144.1 → 5.145.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.
@@ -1,21 +1,30 @@
1
1
  /// <reference types="node" />
2
- import * as fetch from 'node-fetch';
3
- /**
4
- * For use with {@link WebClient}.
5
- */
6
- export type WebClientResponse = fetch.Response;
2
+ /// <reference types="node" />
3
+ import { type RequestOptions } from 'node:https';
7
4
  /**
8
5
  * For use with {@link WebClient}.
9
6
  */
10
- export type WebClientHeaders = fetch.Headers;
11
- export declare const WebClientHeaders: typeof fetch.Headers;
7
+ export interface IWebClientResponse {
8
+ ok: boolean;
9
+ status: number;
10
+ statusText?: string;
11
+ redirected: boolean;
12
+ headers: Record<string, string | string[] | undefined>;
13
+ getTextAsync: () => Promise<string>;
14
+ getJsonAsync: <TJson>() => Promise<TJson>;
15
+ getBufferAsync: () => Promise<Buffer>;
16
+ }
12
17
  /**
13
18
  * For use with {@link WebClient}.
14
19
  */
15
20
  export interface IWebFetchOptionsBase {
16
21
  timeoutMs?: number;
17
- headers?: WebClientHeaders | Record<string, string>;
18
- redirect?: fetch.RequestInit['redirect'];
22
+ headers?: Record<string, string>;
23
+ redirect?: 'follow' | 'error' | 'manual';
24
+ /**
25
+ * If true, the response will not be decoded if a Content-Encoding header is present.
26
+ */
27
+ noDecode?: boolean;
19
28
  }
20
29
  /**
21
30
  * For use with {@link WebClient}.
@@ -38,19 +47,23 @@ export declare enum WebClientProxy {
38
47
  Detect = 1,
39
48
  Fiddler = 2
40
49
  }
50
+ export interface IRequestOptions extends RequestOptions, Pick<IFetchOptionsWithBody, 'body' | 'redirect' | 'noDecode'> {
51
+ }
52
+ export type FetchFn = (url: string, options: IRequestOptions, isRedirect?: boolean) => Promise<IWebClientResponse>;
53
+ export declare const AUTHORIZATION_HEADER_NAME: 'Authorization';
41
54
  /**
42
55
  * A helper for issuing HTTP requests.
43
56
  */
44
57
  export declare class WebClient {
45
58
  private static _requestFn;
46
- readonly standardHeaders: fetch.Headers;
59
+ readonly standardHeaders: Record<string, string>;
47
60
  accept: string | undefined;
48
61
  userAgent: string | undefined;
49
62
  proxy: WebClientProxy;
50
- static mockRequestFn(fn: typeof fetch.default): void;
63
+ static mockRequestFn(fn: FetchFn): void;
51
64
  static resetMockRequestFn(): void;
52
- static mergeHeaders(target: fetch.Headers, source: fetch.Headers | Record<string, string>): void;
65
+ static mergeHeaders(target: Record<string, string>, source: Record<string, string>): void;
53
66
  addBasicAuthHeader(userName: string, password: string): void;
54
- fetchAsync(url: string, options?: IGetFetchOptions | IFetchOptionsWithBody): Promise<WebClientResponse>;
67
+ fetchAsync(url: string, options?: IGetFetchOptions | IFetchOptionsWithBody): Promise<IWebClientResponse>;
55
68
  }
56
69
  //# 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.1",
3
+ "version": "5.145.0",
4
4
  "description": "An API for interacting with the Rush engine",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,7 +33,6 @@
33
33
  },
34
34
  "license": "MIT",
35
35
  "dependencies": {
36
- "@types/node-fetch": "2.6.2",
37
36
  "tapable": "2.2.1",
38
37
  "@rushstack/lookup-by-path": "0.4.6",
39
38
  "@rushstack/node-core-library": "5.10.0",
@@ -44,13 +43,13 @@
44
43
  "@types/semver": "7.5.0",
45
44
  "@types/webpack-env": "1.18.0",
46
45
  "webpack": "~5.95.0",
47
- "local-node-rig": "1.0.0",
46
+ "@microsoft/rush-lib": "5.145.0",
48
47
  "@rushstack/heft-webpack5-plugin": "0.11.8",
48
+ "local-node-rig": "1.0.0",
49
49
  "@rushstack/heft": "0.68.10",
50
50
  "@rushstack/stream-collator": "4.1.78",
51
- "@microsoft/rush-lib": "5.144.1",
52
- "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.77",
53
- "@rushstack/ts-command-line": "4.23.1"
51
+ "@rushstack/ts-command-line": "4.23.1",
52
+ "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.77"
54
53
  },
55
54
  "scripts": {
56
55
  "build": "heft build --clean",