cdk-common 2.0.1072 → 2.0.1073
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 +2 -2
- package/lib/main.js +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/module.d.ts +2 -2
- 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/module.d.ts +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/qs/README.md +1 -1
- package/node_modules/@types/qs/index.d.ts +1 -1
- package/node_modules/@types/qs/package.json +3 -3
- package/node_modules/es-object-atoms/CHANGELOG.md +15 -0
- package/node_modules/es-object-atoms/README.md +7 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +2 -2
- package/node_modules/es-object-atoms/ToObject.d.ts +2 -2
- package/node_modules/es-object-atoms/isObject.d.ts +3 -0
- package/node_modules/es-object-atoms/isObject.js +6 -0
- package/node_modules/es-object-atoms/package.json +9 -8
- package/node_modules/es-object-atoms/test/index.js +8 -1
- package/node_modules/qs/CHANGELOG.md +20 -10
- package/node_modules/qs/README.md +24 -0
- package/node_modules/qs/dist/qs.js +93 -42
- package/node_modules/qs/lib/parse.js +38 -7
- package/node_modules/qs/package.json +6 -6
- package/node_modules/qs/test/parse.js +103 -14
- package/node_modules/qs/test/utils.js +112 -0
- package/package.json +1 -1
|
@@ -118,7 +118,7 @@ test('parse()', function (t) {
|
|
|
118
118
|
st.end();
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
t.test('
|
|
121
|
+
t.test('decodes dot in key of object, and allow enabling dot notation when decodeDotInKeys is set to true and allowDots is undefined', function (st) {
|
|
122
122
|
st.deepEqual(
|
|
123
123
|
qs.parse(
|
|
124
124
|
'name%252Eobj%252Esubobject.first%252Egodly%252Ename=John&name%252Eobj%252Esubobject.last=Doe',
|
|
@@ -131,7 +131,7 @@ test('parse()', function (t) {
|
|
|
131
131
|
st.end();
|
|
132
132
|
});
|
|
133
133
|
|
|
134
|
-
t.test('
|
|
134
|
+
t.test('throws when decodeDotInKeys is not of type boolean', function (st) {
|
|
135
135
|
st['throws'](
|
|
136
136
|
function () { qs.parse('foo[]&bar=baz', { decodeDotInKeys: 'foobar' }); },
|
|
137
137
|
TypeError
|
|
@@ -161,7 +161,7 @@ test('parse()', function (t) {
|
|
|
161
161
|
st.end();
|
|
162
162
|
});
|
|
163
163
|
|
|
164
|
-
t.test('
|
|
164
|
+
t.test('throws when allowEmptyArrays is not of type boolean', function (st) {
|
|
165
165
|
st['throws'](
|
|
166
166
|
function () { qs.parse('foo[]&bar=baz', { allowEmptyArrays: 'foobar' }); },
|
|
167
167
|
TypeError
|
|
@@ -444,7 +444,7 @@ test('parse()', function (t) {
|
|
|
444
444
|
st.end();
|
|
445
445
|
});
|
|
446
446
|
|
|
447
|
-
t.test('
|
|
447
|
+
t.test('does not throw when a native prototype has an enumerable property', function (st) {
|
|
448
448
|
st.intercept(Object.prototype, 'crash', { value: '' });
|
|
449
449
|
st.intercept(Array.prototype, 'crash', { value: '' });
|
|
450
450
|
|
|
@@ -965,7 +965,7 @@ test('parse()', function (t) {
|
|
|
965
965
|
st.end();
|
|
966
966
|
});
|
|
967
967
|
|
|
968
|
-
t.test('
|
|
968
|
+
t.test('ignores an utf8 sentinel with an unknown value', function (st) {
|
|
969
969
|
st.deepEqual(qs.parse('utf8=foo&' + urlEncodedOSlashInUtf8 + '=' + urlEncodedOSlashInUtf8, { charsetSentinel: true, charset: 'utf-8' }), { ø: 'ø' });
|
|
970
970
|
st.end();
|
|
971
971
|
});
|
|
@@ -1035,6 +1035,95 @@ test('parse()', function (t) {
|
|
|
1035
1035
|
st.end();
|
|
1036
1036
|
});
|
|
1037
1037
|
|
|
1038
|
+
t.test('parameter limit tests', function (st) {
|
|
1039
|
+
st.test('does not throw error when within parameter limit', function (sst) {
|
|
1040
|
+
var result = qs.parse('a=1&b=2&c=3', { parameterLimit: 5, throwOnLimitExceeded: true });
|
|
1041
|
+
sst.deepEqual(result, { a: '1', b: '2', c: '3' }, 'parses without errors');
|
|
1042
|
+
sst.end();
|
|
1043
|
+
});
|
|
1044
|
+
|
|
1045
|
+
st.test('throws error when throwOnLimitExceeded is present but not boolean', function (sst) {
|
|
1046
|
+
sst['throws'](
|
|
1047
|
+
function () {
|
|
1048
|
+
qs.parse('a=1&b=2&c=3&d=4&e=5&f=6', { parameterLimit: 3, throwOnLimitExceeded: 'true' });
|
|
1049
|
+
},
|
|
1050
|
+
new TypeError('`throwOnLimitExceeded` option must be a boolean'),
|
|
1051
|
+
'throws error when throwOnLimitExceeded is present and not boolean'
|
|
1052
|
+
);
|
|
1053
|
+
sst.end();
|
|
1054
|
+
});
|
|
1055
|
+
|
|
1056
|
+
st.test('throws error when parameter limit exceeded', function (sst) {
|
|
1057
|
+
sst['throws'](
|
|
1058
|
+
function () {
|
|
1059
|
+
qs.parse('a=1&b=2&c=3&d=4&e=5&f=6', { parameterLimit: 3, throwOnLimitExceeded: true });
|
|
1060
|
+
},
|
|
1061
|
+
new RangeError('Parameter limit exceeded. Only 3 parameters allowed.'),
|
|
1062
|
+
'throws error when parameter limit is exceeded'
|
|
1063
|
+
);
|
|
1064
|
+
sst.end();
|
|
1065
|
+
});
|
|
1066
|
+
|
|
1067
|
+
st.test('silently truncates when throwOnLimitExceeded is not given', function (sst) {
|
|
1068
|
+
var result = qs.parse('a=1&b=2&c=3&d=4&e=5', { parameterLimit: 3 });
|
|
1069
|
+
sst.deepEqual(result, { a: '1', b: '2', c: '3' }, 'parses and truncates silently');
|
|
1070
|
+
sst.end();
|
|
1071
|
+
});
|
|
1072
|
+
|
|
1073
|
+
st.test('silently truncates when parameter limit exceeded without error', function (sst) {
|
|
1074
|
+
var result = qs.parse('a=1&b=2&c=3&d=4&e=5', { parameterLimit: 3, throwOnLimitExceeded: false });
|
|
1075
|
+
sst.deepEqual(result, { a: '1', b: '2', c: '3' }, 'parses and truncates silently');
|
|
1076
|
+
sst.end();
|
|
1077
|
+
});
|
|
1078
|
+
|
|
1079
|
+
st.test('allows unlimited parameters when parameterLimit set to Infinity', function (sst) {
|
|
1080
|
+
var result = qs.parse('a=1&b=2&c=3&d=4&e=5&f=6', { parameterLimit: Infinity });
|
|
1081
|
+
sst.deepEqual(result, { a: '1', b: '2', c: '3', d: '4', e: '5', f: '6' }, 'parses all parameters without truncation');
|
|
1082
|
+
sst.end();
|
|
1083
|
+
});
|
|
1084
|
+
|
|
1085
|
+
st.end();
|
|
1086
|
+
});
|
|
1087
|
+
|
|
1088
|
+
t.test('array limit tests', function (st) {
|
|
1089
|
+
st.test('does not throw error when array is within limit', function (sst) {
|
|
1090
|
+
var result = qs.parse('a[]=1&a[]=2&a[]=3', { arrayLimit: 5, throwOnLimitExceeded: true });
|
|
1091
|
+
sst.deepEqual(result, { a: ['1', '2', '3'] }, 'parses array without errors');
|
|
1092
|
+
sst.end();
|
|
1093
|
+
});
|
|
1094
|
+
|
|
1095
|
+
st.test('throws error when throwOnLimitExceeded is present but not boolean for array limit', function (sst) {
|
|
1096
|
+
sst['throws'](
|
|
1097
|
+
function () {
|
|
1098
|
+
qs.parse('a[]=1&a[]=2&a[]=3&a[]=4', { arrayLimit: 3, throwOnLimitExceeded: 'true' });
|
|
1099
|
+
},
|
|
1100
|
+
new TypeError('`throwOnLimitExceeded` option must be a boolean'),
|
|
1101
|
+
'throws error when throwOnLimitExceeded is present and not boolean for array limit'
|
|
1102
|
+
);
|
|
1103
|
+
sst.end();
|
|
1104
|
+
});
|
|
1105
|
+
|
|
1106
|
+
st.test('throws error when array limit exceeded', function (sst) {
|
|
1107
|
+
sst['throws'](
|
|
1108
|
+
function () {
|
|
1109
|
+
qs.parse('a[]=1&a[]=2&a[]=3&a[]=4', { arrayLimit: 3, throwOnLimitExceeded: true });
|
|
1110
|
+
},
|
|
1111
|
+
new RangeError('Array limit exceeded. Only 3 elements allowed in an array.'),
|
|
1112
|
+
'throws error when array limit is exceeded'
|
|
1113
|
+
);
|
|
1114
|
+
sst.end();
|
|
1115
|
+
});
|
|
1116
|
+
|
|
1117
|
+
st.test('converts array to object if length is greater than limit', function (sst) {
|
|
1118
|
+
var result = qs.parse('a[1]=1&a[2]=2&a[3]=3&a[4]=4&a[5]=5&a[6]=6', { arrayLimit: 5 });
|
|
1119
|
+
|
|
1120
|
+
sst.deepEqual(result, { a: { 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6' } }, 'parses into object if array length is greater than limit');
|
|
1121
|
+
sst.end();
|
|
1122
|
+
});
|
|
1123
|
+
|
|
1124
|
+
st.end();
|
|
1125
|
+
});
|
|
1126
|
+
|
|
1038
1127
|
t.end();
|
|
1039
1128
|
});
|
|
1040
1129
|
|
|
@@ -1093,7 +1182,7 @@ test('qs strictDepth option - throw cases', function (t) {
|
|
|
1093
1182
|
qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1, strictDepth: true });
|
|
1094
1183
|
},
|
|
1095
1184
|
RangeError,
|
|
1096
|
-
'
|
|
1185
|
+
'throws RangeError'
|
|
1097
1186
|
);
|
|
1098
1187
|
st.end();
|
|
1099
1188
|
});
|
|
@@ -1104,7 +1193,7 @@ test('qs strictDepth option - throw cases', function (t) {
|
|
|
1104
1193
|
qs.parse('a[0][1][2][3][4]=b', { depth: 3, strictDepth: true });
|
|
1105
1194
|
},
|
|
1106
1195
|
RangeError,
|
|
1107
|
-
'
|
|
1196
|
+
'throws RangeError'
|
|
1108
1197
|
);
|
|
1109
1198
|
st.end();
|
|
1110
1199
|
});
|
|
@@ -1115,7 +1204,7 @@ test('qs strictDepth option - throw cases', function (t) {
|
|
|
1115
1204
|
qs.parse('a[b][c][0][d][e]=f', { depth: 3, strictDepth: true });
|
|
1116
1205
|
},
|
|
1117
1206
|
RangeError,
|
|
1118
|
-
'
|
|
1207
|
+
'throws RangeError'
|
|
1119
1208
|
);
|
|
1120
1209
|
st.end();
|
|
1121
1210
|
});
|
|
@@ -1126,7 +1215,7 @@ test('qs strictDepth option - throw cases', function (t) {
|
|
|
1126
1215
|
qs.parse('a[b][c][d][e]=true&a[b][c][d][f]=42', { depth: 3, strictDepth: true });
|
|
1127
1216
|
},
|
|
1128
1217
|
RangeError,
|
|
1129
|
-
'
|
|
1218
|
+
'throws RangeError'
|
|
1130
1219
|
);
|
|
1131
1220
|
st.end();
|
|
1132
1221
|
});
|
|
@@ -1140,7 +1229,7 @@ test('qs strictDepth option - non-throw cases', function (t) {
|
|
|
1140
1229
|
qs.parse('a[b][c][d][e]=true&a[b][c][d][f]=42', { depth: 0, strictDepth: true });
|
|
1141
1230
|
},
|
|
1142
1231
|
RangeError,
|
|
1143
|
-
'
|
|
1232
|
+
'does not throw RangeError'
|
|
1144
1233
|
);
|
|
1145
1234
|
st.end();
|
|
1146
1235
|
});
|
|
@@ -1149,7 +1238,7 @@ test('qs strictDepth option - non-throw cases', function (t) {
|
|
|
1149
1238
|
st.doesNotThrow(
|
|
1150
1239
|
function () {
|
|
1151
1240
|
var result = qs.parse('a[b]=c', { depth: 1, strictDepth: true });
|
|
1152
|
-
st.deepEqual(result, { a: { b: 'c' } }, '
|
|
1241
|
+
st.deepEqual(result, { a: { b: 'c' } }, 'parses correctly');
|
|
1153
1242
|
}
|
|
1154
1243
|
);
|
|
1155
1244
|
st.end();
|
|
@@ -1159,7 +1248,7 @@ test('qs strictDepth option - non-throw cases', function (t) {
|
|
|
1159
1248
|
st.doesNotThrow(
|
|
1160
1249
|
function () {
|
|
1161
1250
|
var result = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 });
|
|
1162
|
-
st.deepEqual(result, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }, '
|
|
1251
|
+
st.deepEqual(result, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }, 'parses with depth limit');
|
|
1163
1252
|
}
|
|
1164
1253
|
);
|
|
1165
1254
|
st.end();
|
|
@@ -1169,7 +1258,7 @@ test('qs strictDepth option - non-throw cases', function (t) {
|
|
|
1169
1258
|
st.doesNotThrow(
|
|
1170
1259
|
function () {
|
|
1171
1260
|
var result = qs.parse('a[b]=c', { depth: 1 });
|
|
1172
|
-
st.deepEqual(result, { a: { b: 'c' } }, '
|
|
1261
|
+
st.deepEqual(result, { a: { b: 'c' } }, 'parses correctly');
|
|
1173
1262
|
}
|
|
1174
1263
|
);
|
|
1175
1264
|
st.end();
|
|
@@ -1179,7 +1268,7 @@ test('qs strictDepth option - non-throw cases', function (t) {
|
|
|
1179
1268
|
st.doesNotThrow(
|
|
1180
1269
|
function () {
|
|
1181
1270
|
var result = qs.parse('a[b][c]=d', { depth: 2, strictDepth: true });
|
|
1182
|
-
st.deepEqual(result, { a: { b: { c: 'd' } } }, '
|
|
1271
|
+
st.deepEqual(result, { a: { b: { c: 'd' } } }, 'parses correctly');
|
|
1183
1272
|
}
|
|
1184
1273
|
);
|
|
1185
1274
|
st.end();
|
|
@@ -4,6 +4,8 @@ var test = require('tape');
|
|
|
4
4
|
var inspect = require('object-inspect');
|
|
5
5
|
var SaferBuffer = require('safer-buffer').Buffer;
|
|
6
6
|
var forEach = require('for-each');
|
|
7
|
+
var v = require('es-value-fixtures');
|
|
8
|
+
|
|
7
9
|
var utils = require('../lib/utils');
|
|
8
10
|
|
|
9
11
|
test('merge()', function (t) {
|
|
@@ -133,6 +135,104 @@ test('combine()', function (t) {
|
|
|
133
135
|
t.end();
|
|
134
136
|
});
|
|
135
137
|
|
|
138
|
+
test('decode', function (t) {
|
|
139
|
+
t.equal(
|
|
140
|
+
utils.decode('a+b'),
|
|
141
|
+
'a b',
|
|
142
|
+
'decodes + to space'
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
t.equal(
|
|
146
|
+
utils.decode('name%2Eobj'),
|
|
147
|
+
'name.obj',
|
|
148
|
+
'decodes a string'
|
|
149
|
+
);
|
|
150
|
+
t.equal(
|
|
151
|
+
utils.decode('name%2Eobj%2Efoo', null, 'iso-8859-1'),
|
|
152
|
+
'name.obj.foo',
|
|
153
|
+
'decodes a string in iso-8859-1'
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
t.end();
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test('encode', function (t) {
|
|
160
|
+
forEach(v.nullPrimitives, function (nullish) {
|
|
161
|
+
t['throws'](
|
|
162
|
+
function () { utils.encode(nullish); },
|
|
163
|
+
TypeError,
|
|
164
|
+
inspect(nullish) + ' is not a string'
|
|
165
|
+
);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
t.equal(utils.encode(''), '', 'empty string returns itself');
|
|
169
|
+
t.deepEqual(utils.encode([]), [], 'empty array returns itself');
|
|
170
|
+
t.deepEqual(utils.encode({ length: 0 }), { length: 0 }, 'empty arraylike returns itself');
|
|
171
|
+
|
|
172
|
+
t.test('symbols', { skip: !v.hasSymbols }, function (st) {
|
|
173
|
+
st.equal(utils.encode(Symbol('x')), 'Symbol%28x%29', 'symbol is encoded');
|
|
174
|
+
|
|
175
|
+
st.end();
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
t.equal(
|
|
179
|
+
utils.encode('(abc)'),
|
|
180
|
+
'%28abc%29',
|
|
181
|
+
'encodes parentheses'
|
|
182
|
+
);
|
|
183
|
+
t.equal(
|
|
184
|
+
utils.encode({ toString: function () { return '(abc)'; } }),
|
|
185
|
+
'%28abc%29',
|
|
186
|
+
'toStrings and encodes parentheses'
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
t.equal(
|
|
190
|
+
utils.encode('abc 123 💩', null, 'iso-8859-1'),
|
|
191
|
+
'abc%20123%20%26%2355357%3B%26%2356489%3B',
|
|
192
|
+
'encodes in iso-8859-1'
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
var longString = '';
|
|
196
|
+
var expectedString = '';
|
|
197
|
+
for (var i = 0; i < 1500; i++) {
|
|
198
|
+
longString += ' ';
|
|
199
|
+
expectedString += '%20';
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
t.equal(
|
|
203
|
+
utils.encode(longString),
|
|
204
|
+
expectedString,
|
|
205
|
+
'encodes a long string'
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
t.equal(
|
|
209
|
+
utils.encode('\x28\x29'),
|
|
210
|
+
'%28%29',
|
|
211
|
+
'encodes parens normally'
|
|
212
|
+
);
|
|
213
|
+
t.equal(
|
|
214
|
+
utils.encode('\x28\x29', null, null, null, 'RFC1738'),
|
|
215
|
+
'()',
|
|
216
|
+
'does not encode parens in RFC1738'
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
// todo RFC1738 format
|
|
220
|
+
|
|
221
|
+
t.equal(
|
|
222
|
+
utils.encode('Āက豈'),
|
|
223
|
+
'%C4%80%E1%80%80%EF%A4%80',
|
|
224
|
+
'encodes multibyte chars'
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
t.equal(
|
|
228
|
+
utils.encode('\uD83D \uDCA9'),
|
|
229
|
+
'%F0%9F%90%A0%F0%BA%90%80',
|
|
230
|
+
'encodes lone surrogates'
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
t.end();
|
|
234
|
+
});
|
|
235
|
+
|
|
136
236
|
test('isBuffer()', function (t) {
|
|
137
237
|
forEach([null, undefined, true, false, '', 'abc', 42, 0, NaN, {}, [], function () {}, /a/g], function (x) {
|
|
138
238
|
t.equal(utils.isBuffer(x), false, inspect(x) + ' is not a buffer');
|
|
@@ -148,3 +248,15 @@ test('isBuffer()', function (t) {
|
|
|
148
248
|
t.equal(utils.isBuffer(buffer), true, 'real Buffer instance is a buffer');
|
|
149
249
|
t.end();
|
|
150
250
|
});
|
|
251
|
+
|
|
252
|
+
test('isRegExp()', function (t) {
|
|
253
|
+
t.equal(utils.isRegExp(/a/g), true, 'RegExp is a RegExp');
|
|
254
|
+
t.equal(utils.isRegExp(new RegExp('a', 'g')), true, 'new RegExp is a RegExp');
|
|
255
|
+
t.equal(utils.isRegExp(new Date()), false, 'Date is not a RegExp');
|
|
256
|
+
|
|
257
|
+
forEach(v.primitives, function (primitive) {
|
|
258
|
+
t.equal(utils.isRegExp(primitive), false, inspect(primitive) + ' is not a RegExp');
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
t.end();
|
|
262
|
+
});
|