@types/node 12.12.43 → 12.12.47

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.
node v12.12/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v12.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 01 Jun 2020 22:58:54 GMT
11
+ * Last updated: Tue, 09 Jun 2020 20:57:18 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `Buffer`, `NodeJS`, `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
14
14
 
@@ -7,6 +7,20 @@ declare module "async_hooks" {
7
7
  */
8
8
  function executionAsyncId(): number;
9
9
 
10
+ /**
11
+ * The resource representing the current execution.
12
+ * Useful to store data within the resource.
13
+ *
14
+ * Resource objects returned by `executionAsyncResource()` are most often internal
15
+ * Node.js handle objects with undocumented APIs. Using any functions or properties
16
+ * on the object is likely to crash your application and should be avoided.
17
+ *
18
+ * Using `executionAsyncResource()` in the top-level execution context will
19
+ * return an empty object as there is no handle or request object to use,
20
+ * but having an object representing the top-level can be helpful.
21
+ */
22
+ function executionAsyncResource(): object;
23
+
10
24
  /**
11
25
  * Returns the ID of the resource responsible for calling the callback that is currently being executed.
12
26
  */
@@ -20,7 +34,7 @@ declare module "async_hooks" {
20
34
  * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
21
35
  * @param resource reference to the resource representing the async operation, needs to be released during destroy
22
36
  */
23
- init?(asyncId: number, type: string, triggerAsyncId: number, resource: Object): void;
37
+ init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
24
38
 
25
39
  /**
26
40
  * When an asynchronous operation is initiated or completes a callback is called to notify the user.
@@ -129,4 +143,105 @@ declare module "async_hooks" {
129
143
  */
130
144
  triggerAsyncId(): number;
131
145
  }
146
+
147
+ /**
148
+ * When having multiple instances of `AsyncLocalStorage`, they are independent
149
+ * from each other. It is safe to instantiate this class multiple times.
150
+ */
151
+ class AsyncLocalStorage<T> {
152
+ /**
153
+ * This method disables the instance of `AsyncLocalStorage`. All subsequent calls
154
+ * to `asyncLocalStorage.getStore()` will return `undefined` until
155
+ * `asyncLocalStorage.run()` or `asyncLocalStorage.runSyncAndReturn()`
156
+ * is called again.
157
+ *
158
+ * When calling `asyncLocalStorage.disable()`, all current contexts linked to the
159
+ * instance will be exited.
160
+ *
161
+ * Calling `asyncLocalStorage.disable()` is required before the
162
+ * `asyncLocalStorage` can be garbage collected. This does not apply to stores
163
+ * provided by the `asyncLocalStorage`, as those objects are garbage collected
164
+ * along with the corresponding async resources.
165
+ *
166
+ * This method is to be used when the `asyncLocalStorage` is not in use anymore
167
+ * in the current process.
168
+ */
169
+ disable(): void;
170
+
171
+ /**
172
+ * This method returns the current store.
173
+ * If this method is called outside of an asynchronous context initialized by
174
+ * calling `asyncLocalStorage.run` or `asyncLocalStorage.runAndReturn`, it will
175
+ * return `undefined`.
176
+ */
177
+ getStore(): T | undefined;
178
+
179
+ /**
180
+ * Calling `asyncLocalStorage.run(callback)` will create a new asynchronous
181
+ * context.
182
+ * Within the callback function and the asynchronous operations from the callback,
183
+ * `asyncLocalStorage.getStore()` will return an instance of `Map` known as
184
+ * "the store". This store will be persistent through the following
185
+ * asynchronous calls.
186
+ *
187
+ * The callback will be ran asynchronously. Optionally, arguments can be passed
188
+ * to the function. They will be passed to the callback function.
189
+ *
190
+ * If an error is thrown by the callback function, it will not be caught by
191
+ * a `try/catch` block as the callback is ran in a new asynchronous resource.
192
+ * Also, the stacktrace will be impacted by the asynchronous call.
193
+ */
194
+ // TODO: Apply generic vararg once available
195
+ run(store: T, callback: (...args: any[]) => void, ...args: any[]): void;
196
+
197
+ /**
198
+ * Calling `asyncLocalStorage.exit(callback)` will create a new asynchronous
199
+ * context.
200
+ * Within the callback function and the asynchronous operations from the callback,
201
+ * `asyncLocalStorage.getStore()` will return `undefined`.
202
+ *
203
+ * The callback will be ran asynchronously. Optionally, arguments can be passed
204
+ * to the function. They will be passed to the callback function.
205
+ *
206
+ * If an error is thrown by the callback function, it will not be caught by
207
+ * a `try/catch` block as the callback is ran in a new asynchronous resource.
208
+ * Also, the stacktrace will be impacted by the asynchronous call.
209
+ */
210
+ exit(callback: (...args: any[]) => void, ...args: any[]): void;
211
+
212
+ /**
213
+ * This methods runs a function synchronously within a context and return its
214
+ * return value. The store is not accessible outside of the callback function or
215
+ * the asynchronous operations created within the callback.
216
+ *
217
+ * Optionally, arguments can be passed to the function. They will be passed to
218
+ * the callback function.
219
+ *
220
+ * If the callback function throws an error, it will be thrown by
221
+ * `runSyncAndReturn` too. The stacktrace will not be impacted by this call and
222
+ * the context will be exited.
223
+ */
224
+ runSyncAndReturn<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
225
+
226
+ /**
227
+ * This methods runs a function synchronously outside of a context and return its
228
+ * return value. The store is not accessible within the callback function or
229
+ * the asynchronous operations created within the callback.
230
+ *
231
+ * Optionally, arguments can be passed to the function. They will be passed to
232
+ * the callback function.
233
+ *
234
+ * If the callback function throws an error, it will be thrown by
235
+ * `exitSyncAndReturn` too. The stacktrace will not be impacted by this call and
236
+ * the context will be re-entered.
237
+ */
238
+ exitSyncAndReturn<R>(callback: (...args: any[]) => R, ...args: any[]): R;
239
+
240
+ /**
241
+ * Calling `asyncLocalStorage.enterWith(store)` will transition into the context
242
+ * for the remainder of the current synchronous execution and will persist
243
+ * through any following asynchronous calls.
244
+ */
245
+ enterWith(store: T): void;
246
+ }
132
247
  }
node v12.12/base.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // base definnitions for all NodeJS modules that are not specific to any version of TypeScript
1
+ // base definitions for all NodeJS modules that are not specific to any version of TypeScript
2
2
  /// <reference path="globals.d.ts" />
3
3
  /// <reference path="async_hooks.d.ts" />
4
4
  /// <reference path="buffer.d.ts" />
node v12.12/http.d.ts CHANGED
@@ -16,6 +16,8 @@ declare module "http" {
16
16
  'access-control-allow-origin'?: string;
17
17
  'access-control-expose-headers'?: string;
18
18
  'access-control-max-age'?: string;
19
+ 'access-control-request-headers'?: string;
20
+ 'access-control-request-method'?: string;
19
21
  'age'?: string;
20
22
  'allow'?: string;
21
23
  'alt-svc'?: string;
@@ -42,6 +44,7 @@ declare module "http" {
42
44
  'if-unmodified-since'?: string;
43
45
  'last-modified'?: string;
44
46
  'location'?: string;
47
+ 'origin'?: string;
45
48
  'pragma'?: string;
46
49
  'proxy-authenticate'?: string;
47
50
  'proxy-authorization'?: string;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "12.12.43",
3
+ "version": "12.12.47",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -241,6 +241,6 @@
241
241
  },
242
242
  "scripts": {},
243
243
  "dependencies": {},
244
- "typesPublisherContentHash": "fb7bece2ac1ec6ed15b100b43e1f0f046bf2a6554c3cdc55af1aa500ae48a59a",
244
+ "typesPublisherContentHash": "7234b5a248054f8d7a228c5b12c721f7fd956aa9308f5cb88ae2cf9078c5704f",
245
245
  "typeScriptVersion": "3.0"
246
246
  }
node v12.12/stream.d.ts CHANGED
@@ -24,6 +24,8 @@ declare module "stream" {
24
24
  static from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable;
25
25
 
26
26
  readable: boolean;
27
+ readonly readableEncoding: BufferEncoding | null;
28
+ readonly readableEnded: boolean;
27
29
  readonly readableHighWaterMark: number;
28
30
  readonly readableLength: number;
29
31
  readonly readableObjectMode: boolean;