@aligent/cdk-prerender-proxy 0.2.9-alpha → 2.0.2-alpha

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.
Files changed (209) hide show
  1. package/index.ts +29 -0
  2. package/lib/error-response-construct.ts +54 -0
  3. package/lib/handlers/cache-control.ts +1 -4
  4. package/lib/handlers/error-response.ts +0 -1
  5. package/lib/handlers/prerender.ts +2 -2
  6. package/lib/prerender-cf-cache-control-construct.ts +58 -0
  7. package/lib/prerender-check-construct.ts +43 -0
  8. package/lib/prerender-construct.ts +55 -0
  9. package/lib/prerender-lambda-construct.ts +48 -0
  10. package/package.json +17 -26
  11. package/index.d.ts +0 -6
  12. package/lib/error-response-construct.d.ts +0 -9
  13. package/lib/error-response-construct.js +0 -32
  14. package/lib/handlers/node_modules/.package-lock.json +0 -55
  15. package/lib/handlers/node_modules/@types/aws-lambda/LICENSE +0 -21
  16. package/lib/handlers/node_modules/@types/aws-lambda/README.md +0 -16
  17. package/lib/handlers/node_modules/@types/aws-lambda/common/api-gateway.d.ts +0 -79
  18. package/lib/handlers/node_modules/@types/aws-lambda/common/cloudfront.d.ts +0 -79
  19. package/lib/handlers/node_modules/@types/aws-lambda/handler.d.ts +0 -171
  20. package/lib/handlers/node_modules/@types/aws-lambda/index.d.ts +0 -85
  21. package/lib/handlers/node_modules/@types/aws-lambda/package.json +0 -210
  22. package/lib/handlers/node_modules/@types/aws-lambda/trigger/alb.d.ts +0 -48
  23. package/lib/handlers/node_modules/@types/aws-lambda/trigger/api-gateway-authorizer.d.ts +0 -174
  24. package/lib/handlers/node_modules/@types/aws-lambda/trigger/api-gateway-proxy.d.ts +0 -187
  25. package/lib/handlers/node_modules/@types/aws-lambda/trigger/appsync-resolver.d.ts +0 -51
  26. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudformation-custom-resource.d.ts +0 -68
  27. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudfront-request.d.ts +0 -20
  28. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudfront-response.d.ts +0 -21
  29. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudwatch-events.d.ts +0 -8
  30. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cloudwatch-logs.d.ts +0 -37
  31. package/lib/handlers/node_modules/@types/aws-lambda/trigger/codebuild-cloudwatch-state.d.ts +0 -104
  32. package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-action.d.ts +0 -31
  33. package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-pipeline.d.ts +0 -32
  34. package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch-stage.d.ts +0 -23
  35. package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline-cloudwatch.d.ts +0 -11
  36. package/lib/handlers/node_modules/@types/aws-lambda/trigger/codepipeline.d.ts +0 -55
  37. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/_common.d.ts +0 -41
  38. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/create-auth-challenge.d.ts +0 -22
  39. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-email-sender.d.ts +0 -86
  40. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/custom-message.d.ts +0 -44
  41. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/define-auth-challenge.d.ts +0 -21
  42. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/index.d.ts +0 -119
  43. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/post-authentication.d.ts +0 -15
  44. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/post-confirmation.d.ts +0 -22
  45. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-authentication.d.ts +0 -15
  46. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-signup.d.ts +0 -31
  47. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-token-generation.d.ts +0 -45
  48. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/user-migration.d.ts +0 -39
  49. package/lib/handlers/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/verify-auth-challenge-response.d.ts +0 -20
  50. package/lib/handlers/node_modules/@types/aws-lambda/trigger/connect-contact-flow.d.ts +0 -65
  51. package/lib/handlers/node_modules/@types/aws-lambda/trigger/dynamodb-stream.d.ts +0 -45
  52. package/lib/handlers/node_modules/@types/aws-lambda/trigger/eventbridge.d.ts +0 -18
  53. package/lib/handlers/node_modules/@types/aws-lambda/trigger/iot.d.ts +0 -28
  54. package/lib/handlers/node_modules/@types/aws-lambda/trigger/kinesis-firehose-transformation.d.ts +0 -45
  55. package/lib/handlers/node_modules/@types/aws-lambda/trigger/kinesis-stream.d.ts +0 -28
  56. package/lib/handlers/node_modules/@types/aws-lambda/trigger/lex.d.ts +0 -116
  57. package/lib/handlers/node_modules/@types/aws-lambda/trigger/msk.d.ts +0 -21
  58. package/lib/handlers/node_modules/@types/aws-lambda/trigger/s3-batch.d.ts +0 -41
  59. package/lib/handlers/node_modules/@types/aws-lambda/trigger/s3.d.ts +0 -60
  60. package/lib/handlers/node_modules/@types/aws-lambda/trigger/ses.d.ts +0 -103
  61. package/lib/handlers/node_modules/@types/aws-lambda/trigger/sns.d.ts +0 -38
  62. package/lib/handlers/node_modules/@types/aws-lambda/trigger/sqs.d.ts +0 -46
  63. package/lib/handlers/node_modules/@types/node/LICENSE +0 -21
  64. package/lib/handlers/node_modules/@types/node/README.md +0 -16
  65. package/lib/handlers/node_modules/@types/node/assert/strict.d.ts +0 -4
  66. package/lib/handlers/node_modules/@types/node/assert.d.ts +0 -124
  67. package/lib/handlers/node_modules/@types/node/async_hooks.d.ts +0 -226
  68. package/lib/handlers/node_modules/@types/node/base.d.ts +0 -19
  69. package/lib/handlers/node_modules/@types/node/buffer.d.ts +0 -84
  70. package/lib/handlers/node_modules/@types/node/child_process.d.ts +0 -526
  71. package/lib/handlers/node_modules/@types/node/cluster.d.ts +0 -262
  72. package/lib/handlers/node_modules/@types/node/console.d.ts +0 -133
  73. package/lib/handlers/node_modules/@types/node/constants.d.ts +0 -13
  74. package/lib/handlers/node_modules/@types/node/crypto.d.ts +0 -1580
  75. package/lib/handlers/node_modules/@types/node/dgram.d.ts +0 -141
  76. package/lib/handlers/node_modules/@types/node/diagnostic_channel.d.ts +0 -34
  77. package/lib/handlers/node_modules/@types/node/dns/promises.d.ts +0 -97
  78. package/lib/handlers/node_modules/@types/node/dns.d.ts +0 -322
  79. package/lib/handlers/node_modules/@types/node/domain.d.ts +0 -24
  80. package/lib/handlers/node_modules/@types/node/events.d.ts +0 -93
  81. package/lib/handlers/node_modules/@types/node/fs/promises.d.ts +0 -592
  82. package/lib/handlers/node_modules/@types/node/fs.d.ts +0 -2239
  83. package/lib/handlers/node_modules/@types/node/globals.d.ts +0 -655
  84. package/lib/handlers/node_modules/@types/node/globals.global.d.ts +0 -1
  85. package/lib/handlers/node_modules/@types/node/http.d.ts +0 -434
  86. package/lib/handlers/node_modules/@types/node/http2.d.ts +0 -976
  87. package/lib/handlers/node_modules/@types/node/https.d.ts +0 -36
  88. package/lib/handlers/node_modules/@types/node/index.d.ts +0 -58
  89. package/lib/handlers/node_modules/@types/node/inspector.d.ts +0 -3041
  90. package/lib/handlers/node_modules/@types/node/module.d.ts +0 -52
  91. package/lib/handlers/node_modules/@types/node/net.d.ts +0 -326
  92. package/lib/handlers/node_modules/@types/node/os.d.ts +0 -239
  93. package/lib/handlers/node_modules/@types/node/package.json +0 -232
  94. package/lib/handlers/node_modules/@types/node/path.d.ts +0 -163
  95. package/lib/handlers/node_modules/@types/node/perf_hooks.d.ts +0 -310
  96. package/lib/handlers/node_modules/@types/node/process.d.ts +0 -461
  97. package/lib/handlers/node_modules/@types/node/punycode.d.ts +0 -75
  98. package/lib/handlers/node_modules/@types/node/querystring.d.ts +0 -28
  99. package/lib/handlers/node_modules/@types/node/readline.d.ts +0 -192
  100. package/lib/handlers/node_modules/@types/node/repl.d.ts +0 -395
  101. package/lib/handlers/node_modules/@types/node/stream/promises.d.ts +0 -67
  102. package/lib/handlers/node_modules/@types/node/stream.d.ts +0 -471
  103. package/lib/handlers/node_modules/@types/node/string_decoder.d.ts +0 -7
  104. package/lib/handlers/node_modules/@types/node/timers/promises.d.ts +0 -21
  105. package/lib/handlers/node_modules/@types/node/timers.d.ts +0 -27
  106. package/lib/handlers/node_modules/@types/node/tls.d.ts +0 -793
  107. package/lib/handlers/node_modules/@types/node/trace_events.d.ts +0 -61
  108. package/lib/handlers/node_modules/@types/node/ts3.6/assert.d.ts +0 -98
  109. package/lib/handlers/node_modules/@types/node/ts3.6/base.d.ts +0 -68
  110. package/lib/handlers/node_modules/@types/node/ts3.6/index.d.ts +0 -7
  111. package/lib/handlers/node_modules/@types/node/tty.d.ts +0 -66
  112. package/lib/handlers/node_modules/@types/node/url.d.ts +0 -116
  113. package/lib/handlers/node_modules/@types/node/util/types.d.ts +0 -53
  114. package/lib/handlers/node_modules/@types/node/util.d.ts +0 -156
  115. package/lib/handlers/node_modules/@types/node/v8.d.ts +0 -198
  116. package/lib/handlers/node_modules/@types/node/vm.d.ts +0 -152
  117. package/lib/handlers/node_modules/@types/node/wasi.d.ts +0 -86
  118. package/lib/handlers/node_modules/@types/node/worker_threads.d.ts +0 -282
  119. package/lib/handlers/node_modules/@types/node/zlib.d.ts +0 -361
  120. package/lib/handlers/node_modules/axios/CHANGELOG.md +0 -685
  121. package/lib/handlers/node_modules/axios/LICENSE +0 -19
  122. package/lib/handlers/node_modules/axios/README.md +0 -800
  123. package/lib/handlers/node_modules/axios/UPGRADE_GUIDE.md +0 -162
  124. package/lib/handlers/node_modules/axios/dist/axios.js +0 -1756
  125. package/lib/handlers/node_modules/axios/dist/axios.map +0 -1
  126. package/lib/handlers/node_modules/axios/dist/axios.min.js +0 -3
  127. package/lib/handlers/node_modules/axios/dist/axios.min.map +0 -1
  128. package/lib/handlers/node_modules/axios/index.d.ts +0 -161
  129. package/lib/handlers/node_modules/axios/index.js +0 -1
  130. package/lib/handlers/node_modules/axios/lib/adapters/README.md +0 -37
  131. package/lib/handlers/node_modules/axios/lib/adapters/http.js +0 -303
  132. package/lib/handlers/node_modules/axios/lib/adapters/xhr.js +0 -179
  133. package/lib/handlers/node_modules/axios/lib/axios.js +0 -56
  134. package/lib/handlers/node_modules/axios/lib/cancel/Cancel.js +0 -19
  135. package/lib/handlers/node_modules/axios/lib/cancel/CancelToken.js +0 -57
  136. package/lib/handlers/node_modules/axios/lib/cancel/isCancel.js +0 -5
  137. package/lib/handlers/node_modules/axios/lib/core/Axios.js +0 -95
  138. package/lib/handlers/node_modules/axios/lib/core/InterceptorManager.js +0 -52
  139. package/lib/handlers/node_modules/axios/lib/core/README.md +0 -7
  140. package/lib/handlers/node_modules/axios/lib/core/buildFullPath.js +0 -20
  141. package/lib/handlers/node_modules/axios/lib/core/createError.js +0 -18
  142. package/lib/handlers/node_modules/axios/lib/core/dispatchRequest.js +0 -79
  143. package/lib/handlers/node_modules/axios/lib/core/enhanceError.js +0 -42
  144. package/lib/handlers/node_modules/axios/lib/core/mergeConfig.js +0 -87
  145. package/lib/handlers/node_modules/axios/lib/core/settle.js +0 -25
  146. package/lib/handlers/node_modules/axios/lib/core/transformData.js +0 -20
  147. package/lib/handlers/node_modules/axios/lib/defaults.js +0 -98
  148. package/lib/handlers/node_modules/axios/lib/helpers/README.md +0 -7
  149. package/lib/handlers/node_modules/axios/lib/helpers/bind.js +0 -11
  150. package/lib/handlers/node_modules/axios/lib/helpers/buildURL.js +0 -70
  151. package/lib/handlers/node_modules/axios/lib/helpers/combineURLs.js +0 -14
  152. package/lib/handlers/node_modules/axios/lib/helpers/cookies.js +0 -53
  153. package/lib/handlers/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -24
  154. package/lib/handlers/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -14
  155. package/lib/handlers/node_modules/axios/lib/helpers/isAxiosError.js +0 -11
  156. package/lib/handlers/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -68
  157. package/lib/handlers/node_modules/axios/lib/helpers/normalizeHeaderName.js +0 -12
  158. package/lib/handlers/node_modules/axios/lib/helpers/parseHeaders.js +0 -53
  159. package/lib/handlers/node_modules/axios/lib/helpers/spread.js +0 -27
  160. package/lib/handlers/node_modules/axios/lib/utils.js +0 -351
  161. package/lib/handlers/node_modules/axios/package.json +0 -86
  162. package/lib/handlers/node_modules/buffer-from/LICENSE +0 -21
  163. package/lib/handlers/node_modules/buffer-from/index.js +0 -69
  164. package/lib/handlers/node_modules/buffer-from/package.json +0 -19
  165. package/lib/handlers/node_modules/buffer-from/readme.md +0 -69
  166. package/lib/handlers/node_modules/follow-redirects/LICENSE +0 -18
  167. package/lib/handlers/node_modules/follow-redirects/README.md +0 -148
  168. package/lib/handlers/node_modules/follow-redirects/debug.js +0 -14
  169. package/lib/handlers/node_modules/follow-redirects/http.js +0 -1
  170. package/lib/handlers/node_modules/follow-redirects/https.js +0 -1
  171. package/lib/handlers/node_modules/follow-redirects/index.js +0 -531
  172. package/lib/handlers/node_modules/follow-redirects/package.json +0 -59
  173. package/lib/handlers/node_modules/source-map/CHANGELOG.md +0 -301
  174. package/lib/handlers/node_modules/source-map/LICENSE +0 -28
  175. package/lib/handlers/node_modules/source-map/README.md +0 -742
  176. package/lib/handlers/node_modules/source-map/dist/source-map.debug.js +0 -3234
  177. package/lib/handlers/node_modules/source-map/dist/source-map.js +0 -3233
  178. package/lib/handlers/node_modules/source-map/dist/source-map.min.js +0 -2
  179. package/lib/handlers/node_modules/source-map/dist/source-map.min.js.map +0 -1
  180. package/lib/handlers/node_modules/source-map/lib/array-set.js +0 -121
  181. package/lib/handlers/node_modules/source-map/lib/base64-vlq.js +0 -140
  182. package/lib/handlers/node_modules/source-map/lib/base64.js +0 -67
  183. package/lib/handlers/node_modules/source-map/lib/binary-search.js +0 -111
  184. package/lib/handlers/node_modules/source-map/lib/mapping-list.js +0 -79
  185. package/lib/handlers/node_modules/source-map/lib/quick-sort.js +0 -114
  186. package/lib/handlers/node_modules/source-map/lib/source-map-consumer.js +0 -1145
  187. package/lib/handlers/node_modules/source-map/lib/source-map-generator.js +0 -425
  188. package/lib/handlers/node_modules/source-map/lib/source-node.js +0 -413
  189. package/lib/handlers/node_modules/source-map/lib/util.js +0 -488
  190. package/lib/handlers/node_modules/source-map/package.json +0 -73
  191. package/lib/handlers/node_modules/source-map/source-map.d.ts +0 -98
  192. package/lib/handlers/node_modules/source-map/source-map.js +0 -8
  193. package/lib/handlers/node_modules/source-map-support/LICENSE.md +0 -21
  194. package/lib/handlers/node_modules/source-map-support/README.md +0 -284
  195. package/lib/handlers/node_modules/source-map-support/browser-source-map-support.js +0 -114
  196. package/lib/handlers/node_modules/source-map-support/package.json +0 -31
  197. package/lib/handlers/node_modules/source-map-support/register.js +0 -1
  198. package/lib/handlers/node_modules/source-map-support/source-map-support.js +0 -604
  199. package/lib/handlers/package-lock.json +0 -108
  200. package/lib/handlers/package.json +0 -13
  201. package/lib/handlers/tsconfig.json +0 -22
  202. package/lib/prerender-cf-cache-control-construct.d.ts +0 -10
  203. package/lib/prerender-cf-cache-control-construct.js +0 -33
  204. package/lib/prerender-check-construct.d.ts +0 -6
  205. package/lib/prerender-check-construct.js +0 -25
  206. package/lib/prerender-construct.d.ts +0 -11
  207. package/lib/prerender-construct.js +0 -34
  208. package/lib/prerender-lambda-construct.d.ts +0 -17
  209. package/lib/prerender-lambda-construct.js +0 -19
@@ -1,161 +0,0 @@
1
- export interface AxiosTransformer {
2
- (data: any, headers?: any): any;
3
- }
4
-
5
- export interface AxiosAdapter {
6
- (config: AxiosRequestConfig): AxiosPromise<any>;
7
- }
8
-
9
- export interface AxiosBasicCredentials {
10
- username: string;
11
- password: string;
12
- }
13
-
14
- export interface AxiosProxyConfig {
15
- host: string;
16
- port: number;
17
- auth?: {
18
- username: string;
19
- password:string;
20
- };
21
- protocol?: string;
22
- }
23
-
24
- export type Method =
25
- | 'get' | 'GET'
26
- | 'delete' | 'DELETE'
27
- | 'head' | 'HEAD'
28
- | 'options' | 'OPTIONS'
29
- | 'post' | 'POST'
30
- | 'put' | 'PUT'
31
- | 'patch' | 'PATCH'
32
- | 'purge' | 'PURGE'
33
- | 'link' | 'LINK'
34
- | 'unlink' | 'UNLINK'
35
-
36
- export type ResponseType =
37
- | 'arraybuffer'
38
- | 'blob'
39
- | 'document'
40
- | 'json'
41
- | 'text'
42
- | 'stream'
43
-
44
- export interface AxiosRequestConfig {
45
- url?: string;
46
- method?: Method;
47
- baseURL?: string;
48
- transformRequest?: AxiosTransformer | AxiosTransformer[];
49
- transformResponse?: AxiosTransformer | AxiosTransformer[];
50
- headers?: any;
51
- params?: any;
52
- paramsSerializer?: (params: any) => string;
53
- data?: any;
54
- timeout?: number;
55
- timeoutErrorMessage?: string;
56
- withCredentials?: boolean;
57
- adapter?: AxiosAdapter;
58
- auth?: AxiosBasicCredentials;
59
- responseType?: ResponseType;
60
- xsrfCookieName?: string;
61
- xsrfHeaderName?: string;
62
- onUploadProgress?: (progressEvent: any) => void;
63
- onDownloadProgress?: (progressEvent: any) => void;
64
- maxContentLength?: number;
65
- validateStatus?: ((status: number) => boolean) | null;
66
- maxBodyLength?: number;
67
- maxRedirects?: number;
68
- socketPath?: string | null;
69
- httpAgent?: any;
70
- httpsAgent?: any;
71
- proxy?: AxiosProxyConfig | false;
72
- cancelToken?: CancelToken;
73
- decompress?: boolean;
74
- }
75
-
76
- export interface AxiosResponse<T = any> {
77
- data: T;
78
- status: number;
79
- statusText: string;
80
- headers: any;
81
- config: AxiosRequestConfig;
82
- request?: any;
83
- }
84
-
85
- export interface AxiosError<T = any> extends Error {
86
- config: AxiosRequestConfig;
87
- code?: string;
88
- request?: any;
89
- response?: AxiosResponse<T>;
90
- isAxiosError: boolean;
91
- toJSON: () => object;
92
- }
93
-
94
- export interface AxiosPromise<T = any> extends Promise<AxiosResponse<T>> {
95
- }
96
-
97
- export interface CancelStatic {
98
- new (message?: string): Cancel;
99
- }
100
-
101
- export interface Cancel {
102
- message: string;
103
- }
104
-
105
- export interface Canceler {
106
- (message?: string): void;
107
- }
108
-
109
- export interface CancelTokenStatic {
110
- new (executor: (cancel: Canceler) => void): CancelToken;
111
- source(): CancelTokenSource;
112
- }
113
-
114
- export interface CancelToken {
115
- promise: Promise<Cancel>;
116
- reason?: Cancel;
117
- throwIfRequested(): void;
118
- }
119
-
120
- export interface CancelTokenSource {
121
- token: CancelToken;
122
- cancel: Canceler;
123
- }
124
-
125
- export interface AxiosInterceptorManager<V> {
126
- use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: any) => any): number;
127
- eject(id: number): void;
128
- }
129
-
130
- export interface AxiosInstance {
131
- (config: AxiosRequestConfig): AxiosPromise;
132
- (url: string, config?: AxiosRequestConfig): AxiosPromise;
133
- defaults: AxiosRequestConfig;
134
- interceptors: {
135
- request: AxiosInterceptorManager<AxiosRequestConfig>;
136
- response: AxiosInterceptorManager<AxiosResponse>;
137
- };
138
- getUri(config?: AxiosRequestConfig): string;
139
- request<T = any, R = AxiosResponse<T>> (config: AxiosRequestConfig): Promise<R>;
140
- get<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
141
- delete<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
142
- head<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
143
- options<T = any, R = AxiosResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
144
- post<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
145
- put<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
146
- patch<T = any, R = AxiosResponse<T>>(url: string, data?: any, config?: AxiosRequestConfig): Promise<R>;
147
- }
148
-
149
- export interface AxiosStatic extends AxiosInstance {
150
- create(config?: AxiosRequestConfig): AxiosInstance;
151
- Cancel: CancelStatic;
152
- CancelToken: CancelTokenStatic;
153
- isCancel(value: any): boolean;
154
- all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
155
- spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
156
- isAxiosError(payload: any): payload is AxiosError;
157
- }
158
-
159
- declare const axios: AxiosStatic;
160
-
161
- export default axios;
@@ -1 +0,0 @@
1
- module.exports = require('./lib/axios');
@@ -1,37 +0,0 @@
1
- # axios // adapters
2
-
3
- The modules under `adapters/` are modules that handle dispatching a request and settling a returned `Promise` once a response is received.
4
-
5
- ## Example
6
-
7
- ```js
8
- var settle = require('./../core/settle');
9
-
10
- module.exports = function myAdapter(config) {
11
- // At this point:
12
- // - config has been merged with defaults
13
- // - request transformers have already run
14
- // - request interceptors have already run
15
-
16
- // Make the request using config provided
17
- // Upon response settle the Promise
18
-
19
- return new Promise(function(resolve, reject) {
20
-
21
- var response = {
22
- data: responseData,
23
- status: request.status,
24
- statusText: request.statusText,
25
- headers: responseHeaders,
26
- config: config,
27
- request: request
28
- };
29
-
30
- settle(resolve, reject, response);
31
-
32
- // From here:
33
- // - response transformers will run
34
- // - response interceptors will run
35
- });
36
- }
37
- ```
@@ -1,303 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('./../utils');
4
- var settle = require('./../core/settle');
5
- var buildFullPath = require('../core/buildFullPath');
6
- var buildURL = require('./../helpers/buildURL');
7
- var http = require('http');
8
- var https = require('https');
9
- var httpFollow = require('follow-redirects').http;
10
- var httpsFollow = require('follow-redirects').https;
11
- var url = require('url');
12
- var zlib = require('zlib');
13
- var pkg = require('./../../package.json');
14
- var createError = require('../core/createError');
15
- var enhanceError = require('../core/enhanceError');
16
-
17
- var isHttps = /https:?/;
18
-
19
- /**
20
- *
21
- * @param {http.ClientRequestArgs} options
22
- * @param {AxiosProxyConfig} proxy
23
- * @param {string} location
24
- */
25
- function setProxy(options, proxy, location) {
26
- options.hostname = proxy.host;
27
- options.host = proxy.host;
28
- options.port = proxy.port;
29
- options.path = location;
30
-
31
- // Basic proxy authorization
32
- if (proxy.auth) {
33
- var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
34
- options.headers['Proxy-Authorization'] = 'Basic ' + base64;
35
- }
36
-
37
- // If a proxy is used, any redirects must also pass through the proxy
38
- options.beforeRedirect = function beforeRedirect(redirection) {
39
- redirection.headers.host = redirection.host;
40
- setProxy(redirection, proxy, redirection.href);
41
- };
42
- }
43
-
44
- /*eslint consistent-return:0*/
45
- module.exports = function httpAdapter(config) {
46
- return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
47
- var resolve = function resolve(value) {
48
- resolvePromise(value);
49
- };
50
- var reject = function reject(value) {
51
- rejectPromise(value);
52
- };
53
- var data = config.data;
54
- var headers = config.headers;
55
-
56
- // Set User-Agent (required by some servers)
57
- // Only set header if it hasn't been set in config
58
- // See https://github.com/axios/axios/issues/69
59
- if (!headers['User-Agent'] && !headers['user-agent']) {
60
- headers['User-Agent'] = 'axios/' + pkg.version;
61
- }
62
-
63
- if (data && !utils.isStream(data)) {
64
- if (Buffer.isBuffer(data)) {
65
- // Nothing to do...
66
- } else if (utils.isArrayBuffer(data)) {
67
- data = Buffer.from(new Uint8Array(data));
68
- } else if (utils.isString(data)) {
69
- data = Buffer.from(data, 'utf-8');
70
- } else {
71
- return reject(createError(
72
- 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
73
- config
74
- ));
75
- }
76
-
77
- // Add Content-Length header if data exists
78
- headers['Content-Length'] = data.length;
79
- }
80
-
81
- // HTTP basic authentication
82
- var auth = undefined;
83
- if (config.auth) {
84
- var username = config.auth.username || '';
85
- var password = config.auth.password || '';
86
- auth = username + ':' + password;
87
- }
88
-
89
- // Parse url
90
- var fullPath = buildFullPath(config.baseURL, config.url);
91
- var parsed = url.parse(fullPath);
92
- var protocol = parsed.protocol || 'http:';
93
-
94
- if (!auth && parsed.auth) {
95
- var urlAuth = parsed.auth.split(':');
96
- var urlUsername = urlAuth[0] || '';
97
- var urlPassword = urlAuth[1] || '';
98
- auth = urlUsername + ':' + urlPassword;
99
- }
100
-
101
- if (auth) {
102
- delete headers.Authorization;
103
- }
104
-
105
- var isHttpsRequest = isHttps.test(protocol);
106
- var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
107
-
108
- var options = {
109
- path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
110
- method: config.method.toUpperCase(),
111
- headers: headers,
112
- agent: agent,
113
- agents: { http: config.httpAgent, https: config.httpsAgent },
114
- auth: auth
115
- };
116
-
117
- if (config.socketPath) {
118
- options.socketPath = config.socketPath;
119
- } else {
120
- options.hostname = parsed.hostname;
121
- options.port = parsed.port;
122
- }
123
-
124
- var proxy = config.proxy;
125
- if (!proxy && proxy !== false) {
126
- var proxyEnv = protocol.slice(0, -1) + '_proxy';
127
- var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
128
- if (proxyUrl) {
129
- var parsedProxyUrl = url.parse(proxyUrl);
130
- var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
131
- var shouldProxy = true;
132
-
133
- if (noProxyEnv) {
134
- var noProxy = noProxyEnv.split(',').map(function trim(s) {
135
- return s.trim();
136
- });
137
-
138
- shouldProxy = !noProxy.some(function proxyMatch(proxyElement) {
139
- if (!proxyElement) {
140
- return false;
141
- }
142
- if (proxyElement === '*') {
143
- return true;
144
- }
145
- if (proxyElement[0] === '.' &&
146
- parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) {
147
- return true;
148
- }
149
-
150
- return parsed.hostname === proxyElement;
151
- });
152
- }
153
-
154
- if (shouldProxy) {
155
- proxy = {
156
- host: parsedProxyUrl.hostname,
157
- port: parsedProxyUrl.port,
158
- protocol: parsedProxyUrl.protocol
159
- };
160
-
161
- if (parsedProxyUrl.auth) {
162
- var proxyUrlAuth = parsedProxyUrl.auth.split(':');
163
- proxy.auth = {
164
- username: proxyUrlAuth[0],
165
- password: proxyUrlAuth[1]
166
- };
167
- }
168
- }
169
- }
170
- }
171
-
172
- if (proxy) {
173
- options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
174
- setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
175
- }
176
-
177
- var transport;
178
- var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
179
- if (config.transport) {
180
- transport = config.transport;
181
- } else if (config.maxRedirects === 0) {
182
- transport = isHttpsProxy ? https : http;
183
- } else {
184
- if (config.maxRedirects) {
185
- options.maxRedirects = config.maxRedirects;
186
- }
187
- transport = isHttpsProxy ? httpsFollow : httpFollow;
188
- }
189
-
190
- if (config.maxBodyLength > -1) {
191
- options.maxBodyLength = config.maxBodyLength;
192
- }
193
-
194
- // Create the request
195
- var req = transport.request(options, function handleResponse(res) {
196
- if (req.aborted) return;
197
-
198
- // uncompress the response body transparently if required
199
- var stream = res;
200
-
201
- // return the last request in case of redirects
202
- var lastRequest = res.req || req;
203
-
204
-
205
- // if no content, is HEAD request or decompress disabled we should not decompress
206
- if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) {
207
- switch (res.headers['content-encoding']) {
208
- /*eslint default-case:0*/
209
- case 'gzip':
210
- case 'compress':
211
- case 'deflate':
212
- // add the unzipper to the body stream processing pipeline
213
- stream = stream.pipe(zlib.createUnzip());
214
-
215
- // remove the content-encoding in order to not confuse downstream operations
216
- delete res.headers['content-encoding'];
217
- break;
218
- }
219
- }
220
-
221
- var response = {
222
- status: res.statusCode,
223
- statusText: res.statusMessage,
224
- headers: res.headers,
225
- config: config,
226
- request: lastRequest
227
- };
228
-
229
- if (config.responseType === 'stream') {
230
- response.data = stream;
231
- settle(resolve, reject, response);
232
- } else {
233
- var responseBuffer = [];
234
- stream.on('data', function handleStreamData(chunk) {
235
- responseBuffer.push(chunk);
236
-
237
- // make sure the content length is not over the maxContentLength if specified
238
- if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) {
239
- stream.destroy();
240
- reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
241
- config, null, lastRequest));
242
- }
243
- });
244
-
245
- stream.on('error', function handleStreamError(err) {
246
- if (req.aborted) return;
247
- reject(enhanceError(err, config, null, lastRequest));
248
- });
249
-
250
- stream.on('end', function handleStreamEnd() {
251
- var responseData = Buffer.concat(responseBuffer);
252
- if (config.responseType !== 'arraybuffer') {
253
- responseData = responseData.toString(config.responseEncoding);
254
- if (!config.responseEncoding || config.responseEncoding === 'utf8') {
255
- responseData = utils.stripBOM(responseData);
256
- }
257
- }
258
-
259
- response.data = responseData;
260
- settle(resolve, reject, response);
261
- });
262
- }
263
- });
264
-
265
- // Handle errors
266
- req.on('error', function handleRequestError(err) {
267
- if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return;
268
- reject(enhanceError(err, config, null, req));
269
- });
270
-
271
- // Handle request timeout
272
- if (config.timeout) {
273
- // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
274
- // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
275
- // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
276
- // And then these socket which be hang up will devoring CPU little by little.
277
- // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
278
- req.setTimeout(config.timeout, function handleRequestTimeout() {
279
- req.abort();
280
- reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req));
281
- });
282
- }
283
-
284
- if (config.cancelToken) {
285
- // Handle cancellation
286
- config.cancelToken.promise.then(function onCanceled(cancel) {
287
- if (req.aborted) return;
288
-
289
- req.abort();
290
- reject(cancel);
291
- });
292
- }
293
-
294
- // Send the request
295
- if (utils.isStream(data)) {
296
- data.on('error', function handleStreamError(err) {
297
- reject(enhanceError(err, config, null, req));
298
- }).pipe(req);
299
- } else {
300
- req.end(data);
301
- }
302
- });
303
- };
@@ -1,179 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('./../utils');
4
- var settle = require('./../core/settle');
5
- var cookies = require('./../helpers/cookies');
6
- var buildURL = require('./../helpers/buildURL');
7
- var buildFullPath = require('../core/buildFullPath');
8
- var parseHeaders = require('./../helpers/parseHeaders');
9
- var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
10
- var createError = require('../core/createError');
11
-
12
- module.exports = function xhrAdapter(config) {
13
- return new Promise(function dispatchXhrRequest(resolve, reject) {
14
- var requestData = config.data;
15
- var requestHeaders = config.headers;
16
-
17
- if (utils.isFormData(requestData)) {
18
- delete requestHeaders['Content-Type']; // Let the browser set it
19
- }
20
-
21
- var request = new XMLHttpRequest();
22
-
23
- // HTTP basic authentication
24
- if (config.auth) {
25
- var username = config.auth.username || '';
26
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
27
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
28
- }
29
-
30
- var fullPath = buildFullPath(config.baseURL, config.url);
31
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
32
-
33
- // Set the request timeout in MS
34
- request.timeout = config.timeout;
35
-
36
- // Listen for ready state
37
- request.onreadystatechange = function handleLoad() {
38
- if (!request || request.readyState !== 4) {
39
- return;
40
- }
41
-
42
- // The request errored out and we didn't get a response, this will be
43
- // handled by onerror instead
44
- // With one exception: request that using file: protocol, most browsers
45
- // will return status as 0 even though it's a successful request
46
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
47
- return;
48
- }
49
-
50
- // Prepare the response
51
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
52
- var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
53
- var response = {
54
- data: responseData,
55
- status: request.status,
56
- statusText: request.statusText,
57
- headers: responseHeaders,
58
- config: config,
59
- request: request
60
- };
61
-
62
- settle(resolve, reject, response);
63
-
64
- // Clean up request
65
- request = null;
66
- };
67
-
68
- // Handle browser request cancellation (as opposed to a manual cancellation)
69
- request.onabort = function handleAbort() {
70
- if (!request) {
71
- return;
72
- }
73
-
74
- reject(createError('Request aborted', config, 'ECONNABORTED', request));
75
-
76
- // Clean up request
77
- request = null;
78
- };
79
-
80
- // Handle low level network errors
81
- request.onerror = function handleError() {
82
- // Real errors are hidden from us by the browser
83
- // onerror should only fire if it's a network error
84
- reject(createError('Network Error', config, null, request));
85
-
86
- // Clean up request
87
- request = null;
88
- };
89
-
90
- // Handle timeout
91
- request.ontimeout = function handleTimeout() {
92
- var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
93
- if (config.timeoutErrorMessage) {
94
- timeoutErrorMessage = config.timeoutErrorMessage;
95
- }
96
- reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
97
- request));
98
-
99
- // Clean up request
100
- request = null;
101
- };
102
-
103
- // Add xsrf header
104
- // This is only done if running in a standard browser environment.
105
- // Specifically not if we're in a web worker, or react-native.
106
- if (utils.isStandardBrowserEnv()) {
107
- // Add xsrf header
108
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
109
- cookies.read(config.xsrfCookieName) :
110
- undefined;
111
-
112
- if (xsrfValue) {
113
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
114
- }
115
- }
116
-
117
- // Add headers to the request
118
- if ('setRequestHeader' in request) {
119
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
120
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
121
- // Remove Content-Type if data is undefined
122
- delete requestHeaders[key];
123
- } else {
124
- // Otherwise add header to the request
125
- request.setRequestHeader(key, val);
126
- }
127
- });
128
- }
129
-
130
- // Add withCredentials to request if needed
131
- if (!utils.isUndefined(config.withCredentials)) {
132
- request.withCredentials = !!config.withCredentials;
133
- }
134
-
135
- // Add responseType to request if needed
136
- if (config.responseType) {
137
- try {
138
- request.responseType = config.responseType;
139
- } catch (e) {
140
- // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
141
- // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
142
- if (config.responseType !== 'json') {
143
- throw e;
144
- }
145
- }
146
- }
147
-
148
- // Handle progress if needed
149
- if (typeof config.onDownloadProgress === 'function') {
150
- request.addEventListener('progress', config.onDownloadProgress);
151
- }
152
-
153
- // Not all browsers support upload events
154
- if (typeof config.onUploadProgress === 'function' && request.upload) {
155
- request.upload.addEventListener('progress', config.onUploadProgress);
156
- }
157
-
158
- if (config.cancelToken) {
159
- // Handle cancellation
160
- config.cancelToken.promise.then(function onCanceled(cancel) {
161
- if (!request) {
162
- return;
163
- }
164
-
165
- request.abort();
166
- reject(cancel);
167
- // Clean up request
168
- request = null;
169
- });
170
- }
171
-
172
- if (!requestData) {
173
- requestData = null;
174
- }
175
-
176
- // Send the request
177
- request.send(requestData);
178
- });
179
- };