cdk-common 2.0.248 → 2.0.251
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/.jsii +10 -4
- package/API.md +5 -0
- package/lib/main.js +1 -1
- package/lib/managed-policies.d.ts +1 -0
- package/lib/managed-policies.js +2 -1
- package/node_modules/@aws-cdk/assert/package.json +8 -8
- package/node_modules/@aws-cdk/cfnspec/package.json +3 -3
- package/node_modules/@aws-cdk/cloudformation-diff/package.json +4 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/crypto.d.ts +4 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/crypto.d.ts +4 -4
- package/node_modules/@types/form-data/node_modules/@types/node/package.json +2 -2
- package/node_modules/promise/Readme.md +17 -13
- package/node_modules/promise/domains/core.js +39 -39
- package/node_modules/promise/domains/es6-extensions.js +30 -7
- package/node_modules/promise/domains/rejection-tracking.js +14 -14
- package/node_modules/promise/domains/synchronous.js +10 -10
- package/node_modules/promise/index.d.ts +93 -1
- package/node_modules/promise/lib/core.js +39 -39
- package/node_modules/promise/lib/es6-extensions.js +30 -7
- package/node_modules/promise/lib/rejection-tracking.js +14 -14
- package/node_modules/promise/lib/synchronous.js +10 -10
- package/node_modules/promise/package.json +3 -3
- package/node_modules/promise/setimmediate/core.js +39 -39
- package/node_modules/promise/setimmediate/es6-extensions.js +30 -7
- package/node_modules/promise/setimmediate/rejection-tracking.js +14 -14
- package/node_modules/promise/setimmediate/synchronous.js +10 -10
- package/node_modules/promise/src/es6-extensions.js +23 -0
- package/package.json +6 -6
- package/node_modules/promise/.github/FUNDING.yml +0 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-cdk/assert",
|
|
3
|
-
"version": "2.39.
|
|
3
|
+
"version": "2.39.1",
|
|
4
4
|
"description": "An assertion library for use with CDK Apps",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -34,21 +34,21 @@
|
|
|
34
34
|
},
|
|
35
35
|
"license": "Apache-2.0",
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@aws-cdk/assert-internal": "2.39.
|
|
38
|
-
"@aws-cdk/cdk-build-tools": "2.39.
|
|
39
|
-
"@aws-cdk/pkglint": "2.39.
|
|
37
|
+
"@aws-cdk/assert-internal": "2.39.1",
|
|
38
|
+
"@aws-cdk/cdk-build-tools": "2.39.1",
|
|
39
|
+
"@aws-cdk/pkglint": "2.39.1",
|
|
40
40
|
"@types/jest": "^27.5.2",
|
|
41
|
-
"aws-cdk-lib": "2.39.
|
|
42
|
-
"aws-cdk-migration": "2.39.
|
|
41
|
+
"aws-cdk-lib": "2.39.1",
|
|
42
|
+
"aws-cdk-migration": "2.39.1",
|
|
43
43
|
"constructs": "^10.0.0",
|
|
44
44
|
"jest": "^27.3.1",
|
|
45
45
|
"ts-jest": "^27.1.5"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@aws-cdk/cloudformation-diff": "2.39.
|
|
48
|
+
"@aws-cdk/cloudformation-diff": "2.39.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"aws-cdk-lib": "^2.39.
|
|
51
|
+
"aws-cdk-lib": "^2.39.1",
|
|
52
52
|
"constructs": "^10.0.0",
|
|
53
53
|
"jest": ">=26.6.3"
|
|
54
54
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-cdk/cfnspec",
|
|
3
3
|
"description": "The CloudFormation resource specification used by @aws-cdk packages",
|
|
4
|
-
"version": "2.39.
|
|
4
|
+
"version": "2.39.1",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "cdk-build && /bin/bash build-tools/update.sh && /bin/bash build-tools/update-cfnlint.sh",
|
|
7
7
|
"update-metrics": "/bin/bash build-tools/update-metrics.sh",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"main": "lib/index.js",
|
|
31
31
|
"types": "lib/index.d.ts",
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@aws-cdk/cdk-build-tools": "2.39.
|
|
34
|
-
"@aws-cdk/pkglint": "2.39.
|
|
33
|
+
"@aws-cdk/cdk-build-tools": "2.39.1",
|
|
34
|
+
"@aws-cdk/pkglint": "2.39.1",
|
|
35
35
|
"@types/fs-extra": "^8.1.2",
|
|
36
36
|
"@types/jest": "^27.5.2",
|
|
37
37
|
"@types/md5": "^2.3.2",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-cdk/cloudformation-diff",
|
|
3
|
-
"version": "2.39.
|
|
3
|
+
"version": "2.39.1",
|
|
4
4
|
"description": "Utilities to diff CDK stacks against CloudFormation templates",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@aws-cdk/cfnspec": "2.39.
|
|
26
|
+
"@aws-cdk/cfnspec": "2.39.1",
|
|
27
27
|
"@types/node": "^14.18.26",
|
|
28
28
|
"chalk": "^4",
|
|
29
29
|
"diff": "^5.1.0",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"table": "^6.8.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@aws-cdk/cdk-build-tools": "2.39.
|
|
36
|
-
"@aws-cdk/pkglint": "2.39.
|
|
35
|
+
"@aws-cdk/cdk-build-tools": "2.39.1",
|
|
36
|
+
"@aws-cdk/pkglint": "2.39.1",
|
|
37
37
|
"@types/jest": "^27.5.2",
|
|
38
38
|
"@types/string-width": "^4.0.1",
|
|
39
39
|
"fast-check": "^2.25.0",
|
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Mon, 29 Aug 2022 23:32:43 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
|
14
14
|
|
|
@@ -1478,10 +1478,10 @@ declare module 'crypto' {
|
|
|
1478
1478
|
* @param [generator=2]
|
|
1479
1479
|
* @param generatorEncoding The `encoding` of the `generator` string.
|
|
1480
1480
|
*/
|
|
1481
|
-
function createDiffieHellman(primeLength: number, generator?: number
|
|
1482
|
-
function createDiffieHellman(prime: NodeJS.ArrayBufferView): DiffieHellman;
|
|
1483
|
-
function createDiffieHellman(prime: string,
|
|
1484
|
-
function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator
|
|
1481
|
+
function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman;
|
|
1482
|
+
function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman;
|
|
1483
|
+
function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman;
|
|
1484
|
+
function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman;
|
|
1485
1485
|
function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman;
|
|
1486
1486
|
/**
|
|
1487
1487
|
* The `DiffieHellman` class is a utility for creating Diffie-Hellman key
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "18.7.
|
|
3
|
+
"version": "18.7.14",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -220,6 +220,6 @@
|
|
|
220
220
|
},
|
|
221
221
|
"scripts": {},
|
|
222
222
|
"dependencies": {},
|
|
223
|
-
"typesPublisherContentHash": "
|
|
223
|
+
"typesPublisherContentHash": "db81534897d076e115cb9949512e2c2a419c694de07c7e2d4142c42471fc69ce",
|
|
224
224
|
"typeScriptVersion": "4.0"
|
|
225
225
|
}
|
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Mon, 29 Aug 2022 23:32:43 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
|
14
14
|
|
|
@@ -1478,10 +1478,10 @@ declare module 'crypto' {
|
|
|
1478
1478
|
* @param [generator=2]
|
|
1479
1479
|
* @param generatorEncoding The `encoding` of the `generator` string.
|
|
1480
1480
|
*/
|
|
1481
|
-
function createDiffieHellman(primeLength: number, generator?: number
|
|
1482
|
-
function createDiffieHellman(prime: NodeJS.ArrayBufferView): DiffieHellman;
|
|
1483
|
-
function createDiffieHellman(prime: string,
|
|
1484
|
-
function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator
|
|
1481
|
+
function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman;
|
|
1482
|
+
function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman;
|
|
1483
|
+
function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman;
|
|
1484
|
+
function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman;
|
|
1485
1485
|
function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman;
|
|
1486
1486
|
/**
|
|
1487
1487
|
* The `DiffieHellman` class is a utility for creating Diffie-Hellman key
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "18.7.
|
|
3
|
+
"version": "18.7.14",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -220,6 +220,6 @@
|
|
|
220
220
|
},
|
|
221
221
|
"scripts": {},
|
|
222
222
|
"dependencies": {},
|
|
223
|
-
"typesPublisherContentHash": "
|
|
223
|
+
"typesPublisherContentHash": "db81534897d076e115cb9949512e2c2a419c694de07c7e2d4142c42471fc69ce",
|
|
224
224
|
"typeScriptVersion": "4.0"
|
|
225
225
|
}
|
|
@@ -7,19 +7,10 @@ For detailed tutorials on its use, see www.promisejs.org
|
|
|
7
7
|
|
|
8
8
|
**N.B.** This promise exposes internals via underscore (`_`) prefixed properties. If you use these, your code will break with each new release.
|
|
9
9
|
|
|
10
|
-
[![
|
|
11
|
-
[![
|
|
12
|
-
[![
|
|
13
|
-
[![
|
|
14
|
-
|
|
15
|
-
[travis-image]: https://img.shields.io/travis/then/promise.svg?style=flat
|
|
16
|
-
[travis-url]: https://travis-ci.org/then/promise
|
|
17
|
-
[dep-image]: https://img.shields.io/david/then/promise.svg?style=flat
|
|
18
|
-
[dep-url]: https://david-dm.org/then/promise
|
|
19
|
-
[npm-image]: https://img.shields.io/npm/v/promise.svg?style=flat
|
|
20
|
-
[npm-url]: https://npmjs.org/package/promise
|
|
21
|
-
[downloads-image]: https://img.shields.io/npm/dm/promise.svg?style=flat
|
|
22
|
-
[downloads-url]: https://npmjs.org/package/promise
|
|
10
|
+
[](https://github.com/then/promise/actions?query=workflow%3APublish%20Canary+branch%3Amaster)
|
|
11
|
+
[](https://rollingversions.com/then/promise)
|
|
12
|
+
[](https://www.npmjs.com/package/promise)
|
|
13
|
+
[](https://www.npmjs.org/package/promise)
|
|
23
14
|
|
|
24
15
|
## Installation
|
|
25
16
|
|
|
@@ -150,6 +141,19 @@ Promise.all([Promise.resolve('a'), 'b', Promise.resolve('c')])
|
|
|
150
141
|
})
|
|
151
142
|
```
|
|
152
143
|
|
|
144
|
+
#### Promise.allSettled(array)
|
|
145
|
+
|
|
146
|
+
Returns a promise that resolves after all of the given promises have either fulfilled or rejected, with an array of objects that each describes the outcome of each promise.
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
Promise.allSettled([Promise.resolve('a'), Promise.reject('error'), Promise.resolve('c')])
|
|
150
|
+
.then(function (res) {
|
|
151
|
+
res[0] // { status: "fulfilled", value: 'a' }
|
|
152
|
+
res[1] // { status: "rejected", reason: 'error' }
|
|
153
|
+
res[2] // { status: "fulfilled", value: 'c' }
|
|
154
|
+
})
|
|
155
|
+
```
|
|
156
|
+
|
|
153
157
|
#### Promise.race(array)
|
|
154
158
|
|
|
155
159
|
Returns a promise that resolves or rejects with the result of the first promise to resolve/reject, e.g.
|
|
@@ -58,16 +58,16 @@ function Promise(fn) {
|
|
|
58
58
|
if (typeof fn !== 'function') {
|
|
59
59
|
throw new TypeError('Promise constructor\'s argument is not a function');
|
|
60
60
|
}
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
61
|
+
this._1 = 0;
|
|
62
|
+
this._2 = 0;
|
|
63
|
+
this._3 = null;
|
|
64
|
+
this._4 = null;
|
|
65
65
|
if (fn === noop) return;
|
|
66
66
|
doResolve(fn, this);
|
|
67
67
|
}
|
|
68
|
-
Promise.
|
|
69
|
-
Promise.
|
|
70
|
-
Promise.
|
|
68
|
+
Promise._5 = null;
|
|
69
|
+
Promise._6 = null;
|
|
70
|
+
Promise._7 = noop;
|
|
71
71
|
|
|
72
72
|
Promise.prototype.then = function(onFulfilled, onRejected) {
|
|
73
73
|
if (this.constructor !== Promise) {
|
|
@@ -86,24 +86,24 @@ function safeThen(self, onFulfilled, onRejected) {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
function handle(self, deferred) {
|
|
89
|
-
while (self.
|
|
90
|
-
self = self.
|
|
89
|
+
while (self._2 === 3) {
|
|
90
|
+
self = self._3;
|
|
91
91
|
}
|
|
92
|
-
if (Promise.
|
|
93
|
-
Promise.
|
|
92
|
+
if (Promise._5) {
|
|
93
|
+
Promise._5(self);
|
|
94
94
|
}
|
|
95
|
-
if (self.
|
|
96
|
-
if (self.
|
|
97
|
-
self.
|
|
98
|
-
self.
|
|
95
|
+
if (self._2 === 0) {
|
|
96
|
+
if (self._1 === 0) {
|
|
97
|
+
self._1 = 1;
|
|
98
|
+
self._4 = deferred;
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
if (self.
|
|
102
|
-
self.
|
|
103
|
-
self.
|
|
101
|
+
if (self._1 === 1) {
|
|
102
|
+
self._1 = 2;
|
|
103
|
+
self._4 = [self._4, deferred];
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
-
self.
|
|
106
|
+
self._4.push(deferred);
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
handleResolved(self, deferred);
|
|
@@ -111,16 +111,16 @@ function handle(self, deferred) {
|
|
|
111
111
|
|
|
112
112
|
function handleResolved(self, deferred) {
|
|
113
113
|
asap(function() {
|
|
114
|
-
var cb = self.
|
|
114
|
+
var cb = self._2 === 1 ? deferred.onFulfilled : deferred.onRejected;
|
|
115
115
|
if (cb === null) {
|
|
116
|
-
if (self.
|
|
117
|
-
resolve(deferred.promise, self.
|
|
116
|
+
if (self._2 === 1) {
|
|
117
|
+
resolve(deferred.promise, self._3);
|
|
118
118
|
} else {
|
|
119
|
-
reject(deferred.promise, self.
|
|
119
|
+
reject(deferred.promise, self._3);
|
|
120
120
|
}
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
var ret = tryCallOne(cb, self.
|
|
123
|
+
var ret = tryCallOne(cb, self._3);
|
|
124
124
|
if (ret === IS_ERROR) {
|
|
125
125
|
reject(deferred.promise, LAST_ERROR);
|
|
126
126
|
} else {
|
|
@@ -148,8 +148,8 @@ function resolve(self, newValue) {
|
|
|
148
148
|
then === self.then &&
|
|
149
149
|
newValue instanceof Promise
|
|
150
150
|
) {
|
|
151
|
-
self.
|
|
152
|
-
self.
|
|
151
|
+
self._2 = 3;
|
|
152
|
+
self._3 = newValue;
|
|
153
153
|
finale(self);
|
|
154
154
|
return;
|
|
155
155
|
} else if (typeof then === 'function') {
|
|
@@ -157,29 +157,29 @@ function resolve(self, newValue) {
|
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
self.
|
|
161
|
-
self.
|
|
160
|
+
self._2 = 1;
|
|
161
|
+
self._3 = newValue;
|
|
162
162
|
finale(self);
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
function reject(self, newValue) {
|
|
166
|
-
self.
|
|
167
|
-
self.
|
|
168
|
-
if (Promise.
|
|
169
|
-
Promise.
|
|
166
|
+
self._2 = 2;
|
|
167
|
+
self._3 = newValue;
|
|
168
|
+
if (Promise._6) {
|
|
169
|
+
Promise._6(self, newValue);
|
|
170
170
|
}
|
|
171
171
|
finale(self);
|
|
172
172
|
}
|
|
173
173
|
function finale(self) {
|
|
174
|
-
if (self.
|
|
175
|
-
handle(self, self.
|
|
176
|
-
self.
|
|
174
|
+
if (self._1 === 1) {
|
|
175
|
+
handle(self, self._4);
|
|
176
|
+
self._4 = null;
|
|
177
177
|
}
|
|
178
|
-
if (self.
|
|
179
|
-
for (var i = 0; i < self.
|
|
180
|
-
handle(self, self.
|
|
178
|
+
if (self._1 === 2) {
|
|
179
|
+
for (var i = 0; i < self._4.length; i++) {
|
|
180
|
+
handle(self, self._4[i]);
|
|
181
181
|
}
|
|
182
|
-
self.
|
|
182
|
+
self._4 = null;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
|
|
@@ -16,9 +16,9 @@ var ZERO = valuePromise(0);
|
|
|
16
16
|
var EMPTYSTRING = valuePromise('');
|
|
17
17
|
|
|
18
18
|
function valuePromise(value) {
|
|
19
|
-
var p = new Promise(Promise.
|
|
20
|
-
p.
|
|
21
|
-
p.
|
|
19
|
+
var p = new Promise(Promise._7);
|
|
20
|
+
p._2 = 1;
|
|
21
|
+
p._3 = value;
|
|
22
22
|
return p;
|
|
23
23
|
}
|
|
24
24
|
Promise.resolve = function (value) {
|
|
@@ -67,11 +67,11 @@ Promise.all = function (arr) {
|
|
|
67
67
|
function res(i, val) {
|
|
68
68
|
if (val && (typeof val === 'object' || typeof val === 'function')) {
|
|
69
69
|
if (val instanceof Promise && val.then === Promise.prototype.then) {
|
|
70
|
-
while (val.
|
|
71
|
-
val = val.
|
|
70
|
+
while (val._2 === 3) {
|
|
71
|
+
val = val._3;
|
|
72
72
|
}
|
|
73
|
-
if (val.
|
|
74
|
-
if (val.
|
|
73
|
+
if (val._2 === 1) return res(i, val._3);
|
|
74
|
+
if (val._2 === 2) reject(val._3);
|
|
75
75
|
val.then(function (val) {
|
|
76
76
|
res(i, val);
|
|
77
77
|
}, reject);
|
|
@@ -98,6 +98,29 @@ Promise.all = function (arr) {
|
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
+
function onSettledFulfill(value) {
|
|
102
|
+
return { status: 'fulfilled', value: value };
|
|
103
|
+
}
|
|
104
|
+
function onSettledReject(reason) {
|
|
105
|
+
return { status: 'rejected', reason: reason };
|
|
106
|
+
}
|
|
107
|
+
function mapAllSettled(item) {
|
|
108
|
+
if(item && (typeof item === 'object' || typeof item === 'function')){
|
|
109
|
+
if(item instanceof Promise && item.then === Promise.prototype.then){
|
|
110
|
+
return item.then(onSettledFulfill, onSettledReject);
|
|
111
|
+
}
|
|
112
|
+
var then = item.then;
|
|
113
|
+
if (typeof then === 'function') {
|
|
114
|
+
return new Promise(then.bind(item)).then(onSettledFulfill, onSettledReject)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return onSettledFulfill(item);
|
|
119
|
+
}
|
|
120
|
+
Promise.allSettled = function (iterable) {
|
|
121
|
+
return Promise.all(iterableToArray(iterable).map(mapAllSettled));
|
|
122
|
+
};
|
|
123
|
+
|
|
101
124
|
Promise.reject = function (value) {
|
|
102
125
|
return new Promise(function (resolve, reject) {
|
|
103
126
|
reject(value);
|
|
@@ -12,8 +12,8 @@ var enabled = false;
|
|
|
12
12
|
exports.disable = disable;
|
|
13
13
|
function disable() {
|
|
14
14
|
enabled = false;
|
|
15
|
-
Promise.
|
|
16
|
-
Promise.
|
|
15
|
+
Promise._5 = null;
|
|
16
|
+
Promise._6 = null;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
exports.enable = enable;
|
|
@@ -24,27 +24,27 @@ function enable(options) {
|
|
|
24
24
|
var id = 0;
|
|
25
25
|
var displayId = 0;
|
|
26
26
|
var rejections = {};
|
|
27
|
-
Promise.
|
|
27
|
+
Promise._5 = function (promise) {
|
|
28
28
|
if (
|
|
29
|
-
promise.
|
|
30
|
-
rejections[promise.
|
|
29
|
+
promise._2 === 2 && // IS REJECTED
|
|
30
|
+
rejections[promise._8]
|
|
31
31
|
) {
|
|
32
|
-
if (rejections[promise.
|
|
33
|
-
onHandled(promise.
|
|
32
|
+
if (rejections[promise._8].logged) {
|
|
33
|
+
onHandled(promise._8);
|
|
34
34
|
} else {
|
|
35
|
-
clearTimeout(rejections[promise.
|
|
35
|
+
clearTimeout(rejections[promise._8].timeout);
|
|
36
36
|
}
|
|
37
|
-
delete rejections[promise.
|
|
37
|
+
delete rejections[promise._8];
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
Promise.
|
|
41
|
-
if (promise.
|
|
42
|
-
promise.
|
|
43
|
-
rejections[promise.
|
|
40
|
+
Promise._6 = function (promise, err) {
|
|
41
|
+
if (promise._1 === 0) { // not yet handled
|
|
42
|
+
promise._8 = id++;
|
|
43
|
+
rejections[promise._8] = {
|
|
44
44
|
displayId: null,
|
|
45
45
|
error: err,
|
|
46
46
|
timeout: setTimeout(
|
|
47
|
-
onUnhandled.bind(null, promise.
|
|
47
|
+
onUnhandled.bind(null, promise._8),
|
|
48
48
|
// For reference errors and type errors, this almost always
|
|
49
49
|
// means the programmer made a mistake, so log them after just
|
|
50
50
|
// 100ms
|
|
@@ -17,38 +17,38 @@ Promise.enableSynchronous = function () {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
Promise.prototype.getValue = function () {
|
|
20
|
-
if (this.
|
|
21
|
-
return this.
|
|
20
|
+
if (this._2 === 3) {
|
|
21
|
+
return this._3.getValue();
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (!this.isFulfilled()) {
|
|
25
25
|
throw new Error('Cannot get a value of an unfulfilled promise.');
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
return this.
|
|
28
|
+
return this._3;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
Promise.prototype.getReason = function () {
|
|
32
|
-
if (this.
|
|
33
|
-
return this.
|
|
32
|
+
if (this._2 === 3) {
|
|
33
|
+
return this._3.getReason();
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
if (!this.isRejected()) {
|
|
37
37
|
throw new Error('Cannot get a rejection reason of a non-rejected promise.');
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
return this.
|
|
40
|
+
return this._3;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
Promise.prototype.getState = function () {
|
|
44
|
-
if (this.
|
|
45
|
-
return this.
|
|
44
|
+
if (this._2 === 3) {
|
|
45
|
+
return this._3.getState();
|
|
46
46
|
}
|
|
47
|
-
if (this.
|
|
47
|
+
if (this._2 === -1 || this._2 === -2) {
|
|
48
48
|
return 0;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
return this.
|
|
51
|
+
return this._2;
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
54
|
|
|
@@ -34,6 +34,18 @@ interface ThenPromise<T> extends Promise<T> {
|
|
|
34
34
|
nodeify(callback: (err: Error, value: T) => void): void;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
interface PromiseFulfilledResult<T> {
|
|
38
|
+
status: "fulfilled";
|
|
39
|
+
value: T;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface PromiseRejectedResult {
|
|
43
|
+
status: "rejected";
|
|
44
|
+
reason: any;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type PromiseSettledResult<T> = PromiseFulfilledResult<T> | PromiseRejectedResult;
|
|
48
|
+
|
|
37
49
|
interface ThenPromiseConstructor {
|
|
38
50
|
/**
|
|
39
51
|
* A reference to the prototype.
|
|
@@ -48,6 +60,86 @@ interface ThenPromiseConstructor {
|
|
|
48
60
|
*/
|
|
49
61
|
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => any): ThenPromise<T>;
|
|
50
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Creates a Promise that is resolved with an array of results when all
|
|
65
|
+
* of the provided Promises resolve or reject.
|
|
66
|
+
* @param values An array of Promises.
|
|
67
|
+
* @returns A new Promise.
|
|
68
|
+
*/
|
|
69
|
+
allSettled<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): ThenPromise<[PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>, PromiseSettledResult<T5>, PromiseSettledResult<T6>, PromiseSettledResult<T7>, PromiseSettledResult<T8>, PromiseSettledResult<T9>, PromiseSettledResult<T10>]>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Creates a Promise that is resolved with an array of results when all
|
|
73
|
+
* of the provided Promises resolve or reject.
|
|
74
|
+
* @param values An array of Promises.
|
|
75
|
+
* @returns A new Promise.
|
|
76
|
+
*/
|
|
77
|
+
allSettled<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): ThenPromise<[PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>, PromiseSettledResult<T5>, PromiseSettledResult<T6>, PromiseSettledResult<T7>, PromiseSettledResult<T8>, PromiseSettledResult<T9>]>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Creates a Promise that is resolved with an array of results when all
|
|
81
|
+
* of the provided Promises resolve or reject.
|
|
82
|
+
* @param values An array of Promises.
|
|
83
|
+
* @returns A new Promise.
|
|
84
|
+
*/
|
|
85
|
+
allSettled<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): ThenPromise<[PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>, PromiseSettledResult<T5>, PromiseSettledResult<T6>, PromiseSettledResult<T7>, PromiseSettledResult<T8>]>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Creates a Promise that is resolved with an array of results when all
|
|
89
|
+
* of the provided Promises resolve or reject.
|
|
90
|
+
* @param values An array of Promises.
|
|
91
|
+
* @returns A new Promise.
|
|
92
|
+
*/
|
|
93
|
+
allSettled<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): ThenPromise<[PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>, PromiseSettledResult<T5>, PromiseSettledResult<T6>, PromiseSettledResult<T7>]>;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Creates a Promise that is resolved with an array of results when all
|
|
97
|
+
* of the provided Promises resolve or reject.
|
|
98
|
+
* @param values An array of Promises.
|
|
99
|
+
* @returns A new Promise.
|
|
100
|
+
*/
|
|
101
|
+
allSettled<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): ThenPromise<[PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>, PromiseSettledResult<T5>, PromiseSettledResult<T6>]>;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Creates a Promise that is resolved with an array of results when all
|
|
105
|
+
* of the provided Promises resolve or reject.
|
|
106
|
+
* @param values An array of Promises.
|
|
107
|
+
* @returns A new Promise.
|
|
108
|
+
*/
|
|
109
|
+
allSettled<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): ThenPromise<[PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>, PromiseSettledResult<T5>]>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Creates a Promise that is resolved with an array of results when all
|
|
113
|
+
* of the provided Promises resolve or reject.
|
|
114
|
+
* @param values An array of Promises.
|
|
115
|
+
* @returns A new Promise.
|
|
116
|
+
*/
|
|
117
|
+
allSettled<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): ThenPromise<[PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>, PromiseSettledResult<T4>]>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Creates a Promise that is resolved with an array of results when all
|
|
121
|
+
* of the provided Promises resolve or reject.
|
|
122
|
+
* @param values An array of Promises.
|
|
123
|
+
* @returns A new Promise.
|
|
124
|
+
*/
|
|
125
|
+
allSettled<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): ThenPromise<[PromiseSettledResult<T1>, PromiseSettledResult<T2>, PromiseSettledResult<T3>]>;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Creates a Promise that is resolved with an array of results when all
|
|
129
|
+
* of the provided Promises resolve or reject.
|
|
130
|
+
* @param values An array of Promises.
|
|
131
|
+
* @returns A new Promise.
|
|
132
|
+
*/
|
|
133
|
+
allSettled<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): ThenPromise<[PromiseSettledResult<T1>, PromiseSettledResult<T2>]>;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Creates a Promise that is resolved with an array of results when all
|
|
137
|
+
* of the provided Promises resolve or reject.
|
|
138
|
+
* @param values An array of Promises.
|
|
139
|
+
* @returns A new Promise.
|
|
140
|
+
*/
|
|
141
|
+
allSettled<T>(values: (T | PromiseLike<T>)[]): ThenPromise<PromiseSettledResult<T>[]>;
|
|
142
|
+
|
|
51
143
|
/**
|
|
52
144
|
* Creates a ThenPromise that is resolved with an array of results when all of the provided Promises
|
|
53
145
|
* resolve, or rejected when any ThenPromise is rejected.
|
|
@@ -243,4 +335,4 @@ interface ThenPromiseConstructor {
|
|
|
243
335
|
|
|
244
336
|
declare var ThenPromise: ThenPromiseConstructor;
|
|
245
337
|
|
|
246
|
-
export = ThenPromise;
|
|
338
|
+
export = ThenPromise;
|