@openclaw/googlechat 2026.7.1-beta.1 → 2026.7.1-beta.4
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/{actions-BaygKCqu.js → actions-BacnMHv0.js} +2 -2
- package/dist/api.js +2 -2
- package/dist/{approval-auth-BxSuKX1J.js → approval-auth-C_BVZZFA.js} +2 -2
- package/dist/{approval-handler.runtime-AQl0xUss.js → approval-handler.runtime-BnkufknT.js} +7 -5
- package/dist/{channel-BQMTDOKw.js → channel-_o671C-U.js} +9 -8
- package/dist/{channel-base-Qh87GFW_.js → channel-base-DJICAvKH.js} +7 -6
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.adapters-CFEUpRK6.js → channel.adapters-FEj7zUjh.js} +53 -3
- package/dist/{channel.runtime-BBH8WHto.js → channel.runtime-CYmt7Ybo.js} +2 -8
- package/dist/directory-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/gaxios/build/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/node_modules/gaxios/build/esm/tsconfig.tsbuildinfo +1 -1
- package/node_modules/gaxios/package.json +7 -9
- package/node_modules/google-auth-library/build/src/auth/gdchclient.d.ts +47 -0
- package/node_modules/google-auth-library/build/src/auth/gdchclient.js +307 -0
- package/node_modules/google-auth-library/build/src/auth/googleauth.d.ts +5 -4
- package/node_modules/google-auth-library/build/src/auth/googleauth.js +18 -1
- package/node_modules/google-auth-library/build/src/index.d.ts +1 -0
- package/node_modules/google-auth-library/build/src/index.js +4 -1
- package/node_modules/google-auth-library/package.json +5 -7
- package/npm-shrinkwrap.json +11 -39
- package/package.json +6 -6
- package/node_modules/gcp-metadata/node_modules/gaxios/LICENSE +0 -202
- package/node_modules/gcp-metadata/node_modules/gaxios/README.md +0 -240
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/browser-test/browser-test-runner.d.ts +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/browser-test/browser-test-runner.js +0 -109
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/browser-test/browser-test-runner.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/browser-test/test.browser.d.ts +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/browser-test/test.browser.js +0 -81
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/browser-test/test.browser.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/common.d.ts +0 -329
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/common.js +0 -311
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/common.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/gaxios.d.ts +0 -104
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/gaxios.js +0 -564
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/gaxios.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/index.d.ts +0 -15
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/index.js +0 -48
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/index.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/interceptor.d.ts +0 -25
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/interceptor.js +0 -22
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/interceptor.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/retry.d.ts +0 -8
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/retry.js +0 -165
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/retry.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/util.cjs +0 -16
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/util.cjs.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/src/util.d.cts +0 -7
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/system-test/test.install.d.ts +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/system-test/test.install.js +0 -128
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/system-test/test.install.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/test/test.getch.d.ts +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/test/test.getch.js +0 -1444
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/test/test.getch.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/test/test.index.d.ts +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/test/test.index.js +0 -61
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/test/test.index.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/test/test.retry.d.ts +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/test/test.retry.js +0 -367
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/test/test.retry.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/cjs/tsconfig.cjs.tsbuildinfo +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/browser-test/browser-test-runner.d.ts +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/browser-test/browser-test-runner.js +0 -71
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/browser-test/browser-test-runner.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/browser-test/test.browser.d.ts +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/browser-test/test.browser.js +0 -76
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/browser-test/test.browser.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/package.json +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/common.d.ts +0 -329
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/common.js +0 -303
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/common.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/gaxios.d.ts +0 -104
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/gaxios.js +0 -557
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/gaxios.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/index.d.ts +0 -15
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/index.js +0 -29
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/index.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/interceptor.d.ts +0 -25
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/interceptor.js +0 -18
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/interceptor.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/retry.d.ts +0 -8
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/retry.js +0 -162
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/retry.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/util.cjs +0 -15
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/util.cjs.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/src/util.d.cts +0 -7
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/system-test/test.install.d.ts +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/system-test/test.install.js +0 -123
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/system-test/test.install.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/test/test.getch.d.ts +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/test/test.getch.js +0 -1406
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/test/test.getch.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/test/test.index.d.ts +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/test/test.index.js +0 -23
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/test/test.index.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/test/test.retry.d.ts +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/test/test.retry.js +0 -362
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/test/test.retry.js.map +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/build/esm/tsconfig.tsbuildinfo +0 -1
- package/node_modules/gcp-metadata/node_modules/gaxios/package.json +0 -105
- package/node_modules/google-auth-library/node_modules/gaxios/LICENSE +0 -202
- package/node_modules/google-auth-library/node_modules/gaxios/README.md +0 -240
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/browser-test/browser-test-runner.d.ts +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/browser-test/browser-test-runner.js +0 -109
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/browser-test/browser-test-runner.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/browser-test/test.browser.d.ts +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/browser-test/test.browser.js +0 -81
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/browser-test/test.browser.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/common.d.ts +0 -329
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/common.js +0 -311
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/common.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/gaxios.d.ts +0 -104
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/gaxios.js +0 -564
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/gaxios.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/index.d.ts +0 -15
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/index.js +0 -48
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/index.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/interceptor.d.ts +0 -25
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/interceptor.js +0 -22
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/interceptor.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/retry.d.ts +0 -8
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/retry.js +0 -165
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/retry.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/util.cjs +0 -16
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/util.cjs.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/src/util.d.cts +0 -7
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/system-test/test.install.d.ts +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/system-test/test.install.js +0 -128
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/system-test/test.install.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/test/test.getch.d.ts +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/test/test.getch.js +0 -1444
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/test/test.getch.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/test/test.index.d.ts +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/test/test.index.js +0 -61
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/test/test.index.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/test/test.retry.d.ts +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/test/test.retry.js +0 -367
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/test/test.retry.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/cjs/tsconfig.cjs.tsbuildinfo +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/browser-test/browser-test-runner.d.ts +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/browser-test/browser-test-runner.js +0 -71
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/browser-test/browser-test-runner.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/browser-test/test.browser.d.ts +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/browser-test/test.browser.js +0 -76
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/browser-test/test.browser.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/package.json +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/common.d.ts +0 -329
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/common.js +0 -303
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/common.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/gaxios.d.ts +0 -104
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/gaxios.js +0 -557
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/gaxios.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/index.d.ts +0 -15
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/index.js +0 -29
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/index.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/interceptor.d.ts +0 -25
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/interceptor.js +0 -18
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/interceptor.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/retry.d.ts +0 -8
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/retry.js +0 -162
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/retry.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/util.cjs +0 -15
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/util.cjs.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/src/util.d.cts +0 -7
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/system-test/test.install.d.ts +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/system-test/test.install.js +0 -123
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/system-test/test.install.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/test/test.getch.d.ts +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/test/test.getch.js +0 -1406
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/test/test.getch.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/test/test.index.d.ts +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/test/test.index.js +0 -23
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/test/test.index.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/test/test.retry.d.ts +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/test/test.retry.js +0 -362
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/test/test.retry.js.map +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/build/esm/tsconfig.tsbuildinfo +0 -1
- package/node_modules/google-auth-library/node_modules/gaxios/package.json +0 -105
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
import { Agent } from 'http';
|
|
2
|
-
import { Readable } from 'stream';
|
|
3
|
-
/**
|
|
4
|
-
* TypeScript does not have this type available globally - however `@types/node` includes `undici-types`, which has it:
|
|
5
|
-
* - https://www.npmjs.com/package/@types/node/v/18.19.59?activeTab=dependencies
|
|
6
|
-
*
|
|
7
|
-
* Additionally, this is the TypeScript pattern for type sniffing and `import("undici-types")` is pretty common:
|
|
8
|
-
* - https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/globals.d.ts
|
|
9
|
-
*/
|
|
10
|
-
type _BodyInit = typeof globalThis extends {
|
|
11
|
-
BodyInit: infer T;
|
|
12
|
-
} ? T : import('undici-types').BodyInit;
|
|
13
|
-
/**
|
|
14
|
-
* An AIP-193 conforming error interface.
|
|
15
|
-
*
|
|
16
|
-
* @see {@link https://google.aip.dev/193#http11json-representation AIP-193}
|
|
17
|
-
*
|
|
18
|
-
* @param res the response object
|
|
19
|
-
* @returns the extracted error information
|
|
20
|
-
*/
|
|
21
|
-
export interface AIPErrorInterface {
|
|
22
|
-
error: {
|
|
23
|
-
code: number;
|
|
24
|
-
message: string;
|
|
25
|
-
status: string;
|
|
26
|
-
details?: {}[];
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Support `instanceof` operator for `GaxiosError`s in different versions of this library.
|
|
31
|
-
*
|
|
32
|
-
* @see {@link GaxiosError[Symbol.hasInstance]}
|
|
33
|
-
*/
|
|
34
|
-
export declare const GAXIOS_ERROR_SYMBOL: unique symbol;
|
|
35
|
-
export declare class GaxiosError<T = ReturnType<JSON['parse']>> extends Error {
|
|
36
|
-
config: GaxiosOptionsPrepared;
|
|
37
|
-
response?: GaxiosResponse<T> | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* An error code.
|
|
40
|
-
* Can be a system error code, DOMException error name, or any error's 'code' property where it is a `string`.
|
|
41
|
-
*
|
|
42
|
-
* It is only a `number` when the cause is sourced from an API-level error (AIP-193).
|
|
43
|
-
*
|
|
44
|
-
* @see {@link https://nodejs.org/api/errors.html#errorcode error.code}
|
|
45
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException#error_names DOMException#error_names}
|
|
46
|
-
* @see {@link https://google.aip.dev/193#http11json-representation AIP-193}
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* 'ECONNRESET'
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* 'TimeoutError'
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* 500
|
|
56
|
-
*/
|
|
57
|
-
code?: string | number;
|
|
58
|
-
/**
|
|
59
|
-
* An HTTP Status code.
|
|
60
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Response/status Response#status}
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* 500
|
|
64
|
-
*/
|
|
65
|
-
status?: number;
|
|
66
|
-
/**
|
|
67
|
-
* @deprecated use {@link GaxiosError.cause} instead.
|
|
68
|
-
*
|
|
69
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause Error#cause}
|
|
70
|
-
*
|
|
71
|
-
* @privateRemarks
|
|
72
|
-
*
|
|
73
|
-
* We will want to remove this property later as the modern `cause` property is better suited
|
|
74
|
-
* for displaying and relaying nested errors. Keeping this here makes the resulting
|
|
75
|
-
* error log larger than it needs to be.
|
|
76
|
-
*
|
|
77
|
-
*/
|
|
78
|
-
error?: Error | NodeJS.ErrnoException;
|
|
79
|
-
/**
|
|
80
|
-
* Support `instanceof` operator for `GaxiosError` across builds/duplicated files.
|
|
81
|
-
*
|
|
82
|
-
* @see {@link GAXIOS_ERROR_SYMBOL}
|
|
83
|
-
* @see {@link GaxiosError[Symbol.hasInstance]}
|
|
84
|
-
* @see {@link https://github.com/microsoft/TypeScript/issues/13965#issuecomment-278570200}
|
|
85
|
-
* @see {@link https://stackoverflow.com/questions/46618852/require-and-instanceof}
|
|
86
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/@@hasInstance#reverting_to_default_instanceof_behavior}
|
|
87
|
-
*/
|
|
88
|
-
[GAXIOS_ERROR_SYMBOL]: string;
|
|
89
|
-
/**
|
|
90
|
-
* Support `instanceof` operator for `GaxiosError` across builds/duplicated files.
|
|
91
|
-
*
|
|
92
|
-
* @see {@link GAXIOS_ERROR_SYMBOL}
|
|
93
|
-
* @see {@link GaxiosError[GAXIOS_ERROR_SYMBOL]}
|
|
94
|
-
*/
|
|
95
|
-
static [Symbol.hasInstance](instance: unknown): boolean;
|
|
96
|
-
constructor(message: string, config: GaxiosOptionsPrepared, response?: GaxiosResponse<T> | undefined, cause?: unknown);
|
|
97
|
-
}
|
|
98
|
-
type GaxiosResponseData = ReturnType<JSON['parse']> | GaxiosOptionsPrepared['data'];
|
|
99
|
-
export type GaxiosPromise<T = GaxiosResponseData> = Promise<GaxiosResponse<T>>;
|
|
100
|
-
export interface GaxiosResponse<T = GaxiosResponseData> extends Response {
|
|
101
|
-
config: GaxiosOptionsPrepared;
|
|
102
|
-
data: T;
|
|
103
|
-
}
|
|
104
|
-
export interface GaxiosMultipartOptions {
|
|
105
|
-
headers: Headers;
|
|
106
|
-
content: string | Readable;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Request options that are used to form the request.
|
|
110
|
-
*/
|
|
111
|
-
export interface GaxiosOptions extends RequestInit {
|
|
112
|
-
/**
|
|
113
|
-
* Optional method to override making the actual HTTP request. Useful
|
|
114
|
-
* for writing tests.
|
|
115
|
-
*/
|
|
116
|
-
adapter?: <T = GaxiosResponseData>(options: GaxiosOptionsPrepared, defaultAdapter: (options: GaxiosOptionsPrepared) => GaxiosPromise<T>) => GaxiosPromise<T>;
|
|
117
|
-
url?: string | URL;
|
|
118
|
-
baseURL?: string | URL;
|
|
119
|
-
/**
|
|
120
|
-
* The data to send in the {@link RequestInit.body} of the request. Objects will be
|
|
121
|
-
* serialized as JSON, except for:
|
|
122
|
-
* - `ArrayBuffer`
|
|
123
|
-
* - `Blob`
|
|
124
|
-
* - `Buffer` (Node.js)
|
|
125
|
-
* - `DataView`
|
|
126
|
-
* - `File`
|
|
127
|
-
* - `FormData`
|
|
128
|
-
* - `ReadableStream`
|
|
129
|
-
* - `stream.Readable` (Node.js)
|
|
130
|
-
* - strings
|
|
131
|
-
* - `TypedArray` (e.g. `Uint8Array`, `BigInt64Array`)
|
|
132
|
-
* - `URLSearchParams`
|
|
133
|
-
* - all other objects where:
|
|
134
|
-
* - headers['Content-Type'] === 'application/x-www-form-urlencoded' (serialized as `URLSearchParams`)
|
|
135
|
-
*
|
|
136
|
-
* In all other cases, if you would like to prevent `application/json` as the
|
|
137
|
-
* default `Content-Type` header you must provide a string or readable stream
|
|
138
|
-
* rather than an object, e.g.:
|
|
139
|
-
*
|
|
140
|
-
* ```ts
|
|
141
|
-
* {data: JSON.stringify({some: 'data'})}
|
|
142
|
-
* {data: fs.readFile('./some-data.jpeg')}
|
|
143
|
-
* ```
|
|
144
|
-
*/
|
|
145
|
-
data?: _BodyInit | ArrayBuffer | Blob | Buffer | DataView | File | FormData | ReadableStream | Readable | string | ArrayBufferView | URLSearchParams | {};
|
|
146
|
-
/**
|
|
147
|
-
* The maximum size of the http response `Content-Length` in bytes allowed.
|
|
148
|
-
*/
|
|
149
|
-
maxContentLength?: number;
|
|
150
|
-
/**
|
|
151
|
-
* The maximum number of redirects to follow. Defaults to 20.
|
|
152
|
-
*
|
|
153
|
-
* @deprecated non-spec. Should use `20` if enabled per-spec: https://fetch.spec.whatwg.org/#http-redirect-fetch
|
|
154
|
-
*/
|
|
155
|
-
maxRedirects?: number;
|
|
156
|
-
/**
|
|
157
|
-
* @deprecated non-spec. Should use `20` if enabled per-spec: https://fetch.spec.whatwg.org/#http-redirect-fetch
|
|
158
|
-
*/
|
|
159
|
-
follow?: number;
|
|
160
|
-
/**
|
|
161
|
-
* A collection of parts to send as a `Content-Type: multipart/related` request.
|
|
162
|
-
*
|
|
163
|
-
* This is passed to {@link RequestInit.body}.
|
|
164
|
-
*/
|
|
165
|
-
multipart?: GaxiosMultipartOptions[];
|
|
166
|
-
params?: GaxiosResponseData;
|
|
167
|
-
/**
|
|
168
|
-
* @deprecated Use {@link URLSearchParams} instead and pass this directly to {@link GaxiosOptions.data `data`}.
|
|
169
|
-
*/
|
|
170
|
-
paramsSerializer?: (params: {
|
|
171
|
-
[index: string]: string | number;
|
|
172
|
-
}) => string;
|
|
173
|
-
/**
|
|
174
|
-
* A timeout for the request, in milliseconds. No timeout by default.
|
|
175
|
-
*/
|
|
176
|
-
timeout?: number;
|
|
177
|
-
/**
|
|
178
|
-
* @deprecated ignored
|
|
179
|
-
*/
|
|
180
|
-
onUploadProgress?: (progressEvent: GaxiosResponseData) => void;
|
|
181
|
-
/**
|
|
182
|
-
* If the `fetchImplementation` is native `fetch`, the
|
|
183
|
-
* stream is a `ReadableStream`, otherwise `readable.Stream`
|
|
184
|
-
*/
|
|
185
|
-
responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'stream' | 'unknown';
|
|
186
|
-
agent?: Agent | ((parsedUrl: URL) => Agent);
|
|
187
|
-
validateStatus?: (status: number) => boolean;
|
|
188
|
-
retryConfig?: RetryConfig;
|
|
189
|
-
retry?: boolean;
|
|
190
|
-
/**
|
|
191
|
-
* @deprecated non-spec. https://github.com/node-fetch/node-fetch/issues/1438
|
|
192
|
-
*/
|
|
193
|
-
size?: number;
|
|
194
|
-
/**
|
|
195
|
-
* Implementation of `fetch` to use when making the API call. Will use `fetch` by default.
|
|
196
|
-
*
|
|
197
|
-
* @example
|
|
198
|
-
*
|
|
199
|
-
* let customFetchCalled = false;
|
|
200
|
-
* const myFetch = (...args: Parameters<typeof fetch>) => {
|
|
201
|
-
* customFetchCalled = true;
|
|
202
|
-
* return fetch(...args);
|
|
203
|
-
* };
|
|
204
|
-
*
|
|
205
|
-
* {fetchImplementation: myFetch};
|
|
206
|
-
*/
|
|
207
|
-
fetchImplementation?: typeof fetch;
|
|
208
|
-
cert?: string;
|
|
209
|
-
key?: string;
|
|
210
|
-
/**
|
|
211
|
-
* An optional proxy to use for requests.
|
|
212
|
-
* Available via `process.env.HTTP_PROXY` and `process.env.HTTPS_PROXY` as well - with a preference for the this config option when multiple are available.
|
|
213
|
-
* The {@link GaxiosOptions.agent `agent`} option overrides this.
|
|
214
|
-
*
|
|
215
|
-
* @see {@link GaxiosOptions.noProxy}
|
|
216
|
-
* @see {@link GaxiosOptions.agent}
|
|
217
|
-
*/
|
|
218
|
-
proxy?: string | URL;
|
|
219
|
-
/**
|
|
220
|
-
* A list for excluding traffic for proxies.
|
|
221
|
-
* Available via `process.env.NO_PROXY` as well as a common-separated list of strings - merged with any local `noProxy` rules.
|
|
222
|
-
*
|
|
223
|
-
* - When provided a string, it is matched by
|
|
224
|
-
* - Wildcard `*.` and `.` matching are available. (e.g. `.example.com` or `*.example.com`)
|
|
225
|
-
* - When provided a URL, it is matched by the `.origin` property.
|
|
226
|
-
* - For example, requesting `https://example.com` with the following `noProxy`s would result in a no proxy use:
|
|
227
|
-
* - new URL('https://example.com')
|
|
228
|
-
* - new URL('https://example.com:443')
|
|
229
|
-
* - The following would be used with a proxy:
|
|
230
|
-
* - new URL('http://example.com:80')
|
|
231
|
-
* - new URL('https://example.com:8443')
|
|
232
|
-
* - When provided a regular expression it is used to match the stringified URL
|
|
233
|
-
*
|
|
234
|
-
* @see {@link GaxiosOptions.proxy}
|
|
235
|
-
*/
|
|
236
|
-
noProxy?: (string | URL | RegExp)[];
|
|
237
|
-
/**
|
|
238
|
-
* An experimental error redactor.
|
|
239
|
-
*
|
|
240
|
-
* @remarks
|
|
241
|
-
*
|
|
242
|
-
* This does not replace the requirement for an active Data Loss Prevention (DLP) provider. For DLP suggestions, see:
|
|
243
|
-
* - https://cloud.google.com/sensitive-data-protection/docs/redacting-sensitive-data#dlp_deidentify_replace_infotype-nodejs
|
|
244
|
-
* - https://cloud.google.com/sensitive-data-protection/docs/infotypes-reference#credentials_and_secrets
|
|
245
|
-
*
|
|
246
|
-
* @experimental
|
|
247
|
-
*/
|
|
248
|
-
errorRedactor?: typeof defaultErrorRedactor | false;
|
|
249
|
-
}
|
|
250
|
-
export interface GaxiosOptionsPrepared extends GaxiosOptions {
|
|
251
|
-
headers: Headers;
|
|
252
|
-
url: URL;
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Gaxios retry configuration.
|
|
256
|
-
*/
|
|
257
|
-
export interface RetryConfig {
|
|
258
|
-
/**
|
|
259
|
-
* The number of times to retry the request. Defaults to 3.
|
|
260
|
-
*/
|
|
261
|
-
retry?: number;
|
|
262
|
-
/**
|
|
263
|
-
* The number of retries already attempted.
|
|
264
|
-
*/
|
|
265
|
-
currentRetryAttempt?: number;
|
|
266
|
-
/**
|
|
267
|
-
* The amount of time to initially delay the retry, in ms. Defaults to 100ms.
|
|
268
|
-
*/
|
|
269
|
-
retryDelay?: number;
|
|
270
|
-
/**
|
|
271
|
-
* The HTTP Methods that will be automatically retried.
|
|
272
|
-
* Defaults to ['GET','PUT','HEAD','OPTIONS','DELETE']
|
|
273
|
-
*/
|
|
274
|
-
httpMethodsToRetry?: string[];
|
|
275
|
-
/**
|
|
276
|
-
* The HTTP response status codes that will automatically be retried.
|
|
277
|
-
* Defaults to: [[100, 199], [408, 408], [429, 429], [500, 599]]
|
|
278
|
-
*/
|
|
279
|
-
statusCodesToRetry?: number[][];
|
|
280
|
-
/**
|
|
281
|
-
* Function to invoke when a retry attempt is made.
|
|
282
|
-
*/
|
|
283
|
-
onRetryAttempt?: (err: GaxiosError) => Promise<void> | void;
|
|
284
|
-
/**
|
|
285
|
-
* Function to invoke which determines if you should retry
|
|
286
|
-
*/
|
|
287
|
-
shouldRetry?: (err: GaxiosError) => Promise<boolean> | boolean;
|
|
288
|
-
/**
|
|
289
|
-
* When there is no response, the number of retries to attempt. Defaults to 2.
|
|
290
|
-
*/
|
|
291
|
-
noResponseRetries?: number;
|
|
292
|
-
/**
|
|
293
|
-
* Function to invoke which returns a promise. After the promise resolves,
|
|
294
|
-
* the retry will be triggered. If provided, this will be used in-place of
|
|
295
|
-
* the `retryDelay`
|
|
296
|
-
*/
|
|
297
|
-
retryBackoff?: (err: GaxiosError, defaultBackoffMs: number) => Promise<void>;
|
|
298
|
-
/**
|
|
299
|
-
* Time that the initial request was made. Users should not set this directly.
|
|
300
|
-
*/
|
|
301
|
-
timeOfFirstRequest?: number;
|
|
302
|
-
/**
|
|
303
|
-
* The length of time to keep retrying in ms. The last sleep period will
|
|
304
|
-
* be shortened as necessary, so that the last retry runs at deadline (and not
|
|
305
|
-
* considerably beyond it). The total time starting from when the initial
|
|
306
|
-
* request is sent, after which an error will be returned, regardless of the
|
|
307
|
-
* retrying attempts made meanwhile. Defaults to Number.MAX_SAFE_INTEGER indicating to effectively
|
|
308
|
-
* ignore totalTimeout.
|
|
309
|
-
*/
|
|
310
|
-
totalTimeout?: number;
|
|
311
|
-
maxRetryDelay?: number;
|
|
312
|
-
retryDelayMultiplier?: number;
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* An experimental error redactor.
|
|
316
|
-
*
|
|
317
|
-
* @param config Config to potentially redact properties of
|
|
318
|
-
* @param response Config to potentially redact properties of
|
|
319
|
-
*
|
|
320
|
-
* @experimental
|
|
321
|
-
*/
|
|
322
|
-
export declare function defaultErrorRedactor<O extends GaxiosOptionsPrepared, R extends GaxiosResponse<GaxiosResponseData>>(data: {
|
|
323
|
-
config?: O;
|
|
324
|
-
response?: R;
|
|
325
|
-
}): {
|
|
326
|
-
config?: O;
|
|
327
|
-
response?: R;
|
|
328
|
-
};
|
|
329
|
-
export {};
|
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2018 Google LLC
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.GaxiosError = exports.GAXIOS_ERROR_SYMBOL = void 0;
|
|
19
|
-
exports.defaultErrorRedactor = defaultErrorRedactor;
|
|
20
|
-
const extend_1 = __importDefault(require("extend"));
|
|
21
|
-
const util_cjs_1 = __importDefault(require("./util.cjs"));
|
|
22
|
-
const pkg = util_cjs_1.default.pkg;
|
|
23
|
-
/**
|
|
24
|
-
* Support `instanceof` operator for `GaxiosError`s in different versions of this library.
|
|
25
|
-
*
|
|
26
|
-
* @see {@link GaxiosError[Symbol.hasInstance]}
|
|
27
|
-
*/
|
|
28
|
-
exports.GAXIOS_ERROR_SYMBOL = Symbol.for(`${pkg.name}-gaxios-error`);
|
|
29
|
-
class GaxiosError extends Error {
|
|
30
|
-
config;
|
|
31
|
-
response;
|
|
32
|
-
/**
|
|
33
|
-
* An error code.
|
|
34
|
-
* Can be a system error code, DOMException error name, or any error's 'code' property where it is a `string`.
|
|
35
|
-
*
|
|
36
|
-
* It is only a `number` when the cause is sourced from an API-level error (AIP-193).
|
|
37
|
-
*
|
|
38
|
-
* @see {@link https://nodejs.org/api/errors.html#errorcode error.code}
|
|
39
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException#error_names DOMException#error_names}
|
|
40
|
-
* @see {@link https://google.aip.dev/193#http11json-representation AIP-193}
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* 'ECONNRESET'
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* 'TimeoutError'
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* 500
|
|
50
|
-
*/
|
|
51
|
-
code;
|
|
52
|
-
/**
|
|
53
|
-
* An HTTP Status code.
|
|
54
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Response/status Response#status}
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* 500
|
|
58
|
-
*/
|
|
59
|
-
status;
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated use {@link GaxiosError.cause} instead.
|
|
62
|
-
*
|
|
63
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause Error#cause}
|
|
64
|
-
*
|
|
65
|
-
* @privateRemarks
|
|
66
|
-
*
|
|
67
|
-
* We will want to remove this property later as the modern `cause` property is better suited
|
|
68
|
-
* for displaying and relaying nested errors. Keeping this here makes the resulting
|
|
69
|
-
* error log larger than it needs to be.
|
|
70
|
-
*
|
|
71
|
-
*/
|
|
72
|
-
error;
|
|
73
|
-
/**
|
|
74
|
-
* Support `instanceof` operator for `GaxiosError` across builds/duplicated files.
|
|
75
|
-
*
|
|
76
|
-
* @see {@link GAXIOS_ERROR_SYMBOL}
|
|
77
|
-
* @see {@link GaxiosError[Symbol.hasInstance]}
|
|
78
|
-
* @see {@link https://github.com/microsoft/TypeScript/issues/13965#issuecomment-278570200}
|
|
79
|
-
* @see {@link https://stackoverflow.com/questions/46618852/require-and-instanceof}
|
|
80
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/@@hasInstance#reverting_to_default_instanceof_behavior}
|
|
81
|
-
*/
|
|
82
|
-
[exports.GAXIOS_ERROR_SYMBOL] = pkg.version;
|
|
83
|
-
/**
|
|
84
|
-
* Support `instanceof` operator for `GaxiosError` across builds/duplicated files.
|
|
85
|
-
*
|
|
86
|
-
* @see {@link GAXIOS_ERROR_SYMBOL}
|
|
87
|
-
* @see {@link GaxiosError[GAXIOS_ERROR_SYMBOL]}
|
|
88
|
-
*/
|
|
89
|
-
static [Symbol.hasInstance](instance) {
|
|
90
|
-
if (instance &&
|
|
91
|
-
typeof instance === 'object' &&
|
|
92
|
-
exports.GAXIOS_ERROR_SYMBOL in instance &&
|
|
93
|
-
instance[exports.GAXIOS_ERROR_SYMBOL] === pkg.version) {
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
// fallback to native
|
|
97
|
-
return Function.prototype[Symbol.hasInstance].call(GaxiosError, instance);
|
|
98
|
-
}
|
|
99
|
-
constructor(message, config, response, cause) {
|
|
100
|
-
super(message, { cause });
|
|
101
|
-
this.config = config;
|
|
102
|
-
this.response = response;
|
|
103
|
-
this.error = cause instanceof Error ? cause : undefined;
|
|
104
|
-
// deep-copy config as we do not want to mutate
|
|
105
|
-
// the existing config for future retries/use
|
|
106
|
-
this.config = (0, extend_1.default)(true, {}, config);
|
|
107
|
-
if (this.response) {
|
|
108
|
-
this.response.config = (0, extend_1.default)(true, {}, this.response.config);
|
|
109
|
-
}
|
|
110
|
-
if (this.response) {
|
|
111
|
-
try {
|
|
112
|
-
this.response.data = translateData(this.config.responseType,
|
|
113
|
-
// workaround for `node-fetch`'s `.data` deprecation...
|
|
114
|
-
this.response?.bodyUsed ? this.response?.data : undefined);
|
|
115
|
-
}
|
|
116
|
-
catch {
|
|
117
|
-
// best effort - don't throw an error within an error
|
|
118
|
-
// we could set `this.response.config.responseType = 'unknown'`, but
|
|
119
|
-
// that would mutate future calls with this config object.
|
|
120
|
-
}
|
|
121
|
-
this.status = this.response.status;
|
|
122
|
-
}
|
|
123
|
-
if (cause instanceof DOMException) {
|
|
124
|
-
// The DOMException's equivalent to code is its name
|
|
125
|
-
// E.g.: name = `TimeoutError`, code = number
|
|
126
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/DOMException/name
|
|
127
|
-
this.code = cause.name;
|
|
128
|
-
}
|
|
129
|
-
else if (cause &&
|
|
130
|
-
typeof cause === 'object' &&
|
|
131
|
-
'code' in cause &&
|
|
132
|
-
(typeof cause.code === 'string' || typeof cause.code === 'number')) {
|
|
133
|
-
this.code = cause.code;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* An AIP-193 conforming error extractor.
|
|
138
|
-
*
|
|
139
|
-
* @see {@link https://google.aip.dev/193#http11json-representation AIP-193}
|
|
140
|
-
*
|
|
141
|
-
* @internal
|
|
142
|
-
* @expiremental
|
|
143
|
-
*
|
|
144
|
-
* @param res the response object
|
|
145
|
-
* @returns the extracted error information
|
|
146
|
-
*/
|
|
147
|
-
static extractAPIErrorFromResponse(res, defaultErrorMessage = 'The request failed') {
|
|
148
|
-
let message = defaultErrorMessage;
|
|
149
|
-
// Use res.data as the error message
|
|
150
|
-
if (typeof res.data === 'string') {
|
|
151
|
-
message = res.data;
|
|
152
|
-
}
|
|
153
|
-
if (res.data &&
|
|
154
|
-
typeof res.data === 'object' &&
|
|
155
|
-
'error' in res.data &&
|
|
156
|
-
res.data.error &&
|
|
157
|
-
!res.ok) {
|
|
158
|
-
if (typeof res.data.error === 'string') {
|
|
159
|
-
return {
|
|
160
|
-
message: res.data.error,
|
|
161
|
-
code: res.status,
|
|
162
|
-
status: res.statusText,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
if (typeof res.data.error === 'object') {
|
|
166
|
-
// extract status from data.message
|
|
167
|
-
message =
|
|
168
|
-
'message' in res.data.error &&
|
|
169
|
-
typeof res.data.error.message === 'string'
|
|
170
|
-
? res.data.error.message
|
|
171
|
-
: message;
|
|
172
|
-
// extract status from data.error
|
|
173
|
-
const status = 'status' in res.data.error &&
|
|
174
|
-
typeof res.data.error.status === 'string'
|
|
175
|
-
? res.data.error.status
|
|
176
|
-
: res.statusText;
|
|
177
|
-
// extract code from data.error
|
|
178
|
-
const code = 'code' in res.data.error && typeof res.data.error.code === 'number'
|
|
179
|
-
? res.data.error.code
|
|
180
|
-
: res.status;
|
|
181
|
-
if ('errors' in res.data.error &&
|
|
182
|
-
Array.isArray(res.data.error.errors)) {
|
|
183
|
-
const errorMessages = [];
|
|
184
|
-
for (const e of res.data.error.errors) {
|
|
185
|
-
if (typeof e === 'object' &&
|
|
186
|
-
'message' in e &&
|
|
187
|
-
typeof e.message === 'string') {
|
|
188
|
-
errorMessages.push(e.message);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return Object.assign({
|
|
192
|
-
message: errorMessages.join('\n') || message,
|
|
193
|
-
code,
|
|
194
|
-
status,
|
|
195
|
-
}, res.data.error);
|
|
196
|
-
}
|
|
197
|
-
return Object.assign({
|
|
198
|
-
message,
|
|
199
|
-
code,
|
|
200
|
-
status,
|
|
201
|
-
}, res.data.error);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return {
|
|
205
|
-
message,
|
|
206
|
-
code: res.status,
|
|
207
|
-
status: res.statusText,
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
exports.GaxiosError = GaxiosError;
|
|
212
|
-
function translateData(responseType, data) {
|
|
213
|
-
switch (responseType) {
|
|
214
|
-
case 'stream':
|
|
215
|
-
return data;
|
|
216
|
-
case 'json':
|
|
217
|
-
return JSON.parse(JSON.stringify(data));
|
|
218
|
-
case 'arraybuffer':
|
|
219
|
-
return JSON.parse(Buffer.from(data).toString('utf8'));
|
|
220
|
-
case 'blob':
|
|
221
|
-
return JSON.parse(data.text());
|
|
222
|
-
default:
|
|
223
|
-
return data;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* An experimental error redactor.
|
|
228
|
-
*
|
|
229
|
-
* @param config Config to potentially redact properties of
|
|
230
|
-
* @param response Config to potentially redact properties of
|
|
231
|
-
*
|
|
232
|
-
* @experimental
|
|
233
|
-
*/
|
|
234
|
-
function defaultErrorRedactor(data) {
|
|
235
|
-
const REDACT = '<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.';
|
|
236
|
-
function redactHeaders(headers) {
|
|
237
|
-
if (!headers)
|
|
238
|
-
return;
|
|
239
|
-
headers.forEach((_, key) => {
|
|
240
|
-
// any casing of `Authentication`
|
|
241
|
-
// any casing of `Authorization`
|
|
242
|
-
// anything containing secret, such as 'client secret'
|
|
243
|
-
if (/^authentication$/i.test(key) ||
|
|
244
|
-
/^authorization$/i.test(key) ||
|
|
245
|
-
/secret/i.test(key))
|
|
246
|
-
headers.set(key, REDACT);
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
function redactString(obj, key) {
|
|
250
|
-
if (typeof obj === 'object' &&
|
|
251
|
-
obj !== null &&
|
|
252
|
-
typeof obj[key] === 'string') {
|
|
253
|
-
const text = obj[key];
|
|
254
|
-
if (/grant_type=/i.test(text) ||
|
|
255
|
-
/assertion=/i.test(text) ||
|
|
256
|
-
/secret/i.test(text)) {
|
|
257
|
-
obj[key] = REDACT;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
function redactObject(obj) {
|
|
262
|
-
if (!obj || typeof obj !== 'object') {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
else if (obj instanceof FormData ||
|
|
266
|
-
obj instanceof URLSearchParams ||
|
|
267
|
-
// support `node-fetch` FormData/URLSearchParams
|
|
268
|
-
('forEach' in obj && 'set' in obj)) {
|
|
269
|
-
obj.forEach((_, key) => {
|
|
270
|
-
if (['grant_type', 'assertion'].includes(key) || /secret/.test(key)) {
|
|
271
|
-
obj.set(key, REDACT);
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
if ('grant_type' in obj) {
|
|
277
|
-
obj['grant_type'] = REDACT;
|
|
278
|
-
}
|
|
279
|
-
if ('assertion' in obj) {
|
|
280
|
-
obj['assertion'] = REDACT;
|
|
281
|
-
}
|
|
282
|
-
if ('client_secret' in obj) {
|
|
283
|
-
obj['client_secret'] = REDACT;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
if (data.config) {
|
|
288
|
-
redactHeaders(data.config.headers);
|
|
289
|
-
redactString(data.config, 'data');
|
|
290
|
-
redactObject(data.config.data);
|
|
291
|
-
redactString(data.config, 'body');
|
|
292
|
-
redactObject(data.config.body);
|
|
293
|
-
if (data.config.url.searchParams.has('token')) {
|
|
294
|
-
data.config.url.searchParams.set('token', REDACT);
|
|
295
|
-
}
|
|
296
|
-
if (data.config.url.searchParams.has('client_secret')) {
|
|
297
|
-
data.config.url.searchParams.set('client_secret', REDACT);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
if (data.response) {
|
|
301
|
-
defaultErrorRedactor({ config: data.response.config });
|
|
302
|
-
redactHeaders(data.response.headers);
|
|
303
|
-
// workaround for `node-fetch`'s `.data` deprecation...
|
|
304
|
-
if (data.response.bodyUsed) {
|
|
305
|
-
redactString(data.response, 'data');
|
|
306
|
-
redactObject(data.response.data);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
return data;
|
|
310
|
-
}
|
|
311
|
-
//# sourceMappingURL=common.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;;AAujBjC,oDAoGC;AAtpBD,oDAA4B;AAE5B,0DAA8B;AAE9B,MAAM,GAAG,GAAG,kBAAI,CAAC,GAAG,CAAC;AA8BrB;;;;GAIG;AACU,QAAA,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,eAAe,CAAC,CAAC;AAE1E,MAAa,WAA2C,SAAQ,KAAK;IA6E1D;IACA;IA7ET;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,CAAmB;IACvB;;;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