cdk-common 2.0.249 → 2.0.252
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/cfnspec/tsconfig.tsbuildinfo +38 -6
- package/node_modules/@aws-cdk/cloudformation-diff/package.json +4 -4
- 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
|
@@ -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
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "promise",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "Bare bones Promises/A+ implementation",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
7
|
+
"build": "node build",
|
|
8
8
|
"pretest": "node build",
|
|
9
9
|
"pretest-resolve": "node build",
|
|
10
10
|
"pretest-extensions": "node build",
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"asap": "~2.0.6"
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
}
|
|
@@ -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
|
setImmediate(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
|
|
|
@@ -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);
|
package/package.json
CHANGED
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"eslint-plugin-import": "^2.26.0",
|
|
51
51
|
"jest": "^27",
|
|
52
52
|
"jest-junit": "^13",
|
|
53
|
-
"jsii": "^1.
|
|
54
|
-
"jsii-diff": "^1.
|
|
53
|
+
"jsii": "^1.66.0",
|
|
54
|
+
"jsii-diff": "^1.66.0",
|
|
55
55
|
"jsii-docgen": "^3.8.31",
|
|
56
|
-
"jsii-pacmak": "^1.
|
|
56
|
+
"jsii-pacmak": "^1.66.0",
|
|
57
57
|
"json-schema": "^0.4.0",
|
|
58
58
|
"npm-check-updates": "^15",
|
|
59
|
-
"projen": "0.61.
|
|
59
|
+
"projen": "0.61.41",
|
|
60
60
|
"standard-version": "^9",
|
|
61
61
|
"ts-jest": "^27",
|
|
62
62
|
"typescript": "^4.8.2"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"constructs": "^10.0.5"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@aws-cdk/assert": "^2.
|
|
69
|
+
"@aws-cdk/assert": "^2.40.0",
|
|
70
70
|
"case": "^1.6.3",
|
|
71
71
|
"sync-request": "^6.1.0"
|
|
72
72
|
},
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
],
|
|
85
85
|
"main": "lib/index.js",
|
|
86
86
|
"license": "Apache-2.0",
|
|
87
|
-
"version": "2.0.
|
|
87
|
+
"version": "2.0.252",
|
|
88
88
|
"jest": {
|
|
89
89
|
"testMatch": [
|
|
90
90
|
"<rootDir>/src/**/__tests__/**/*.ts?(x)",
|