cdk-common 2.0.774 → 2.0.776
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 +8 -2
- package/API.md +5 -0
- package/lib/main.js +1 -1
- package/lib/managed-policies.d.ts +2 -1
- package/lib/managed-policies.js +2 -1
- package/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/node/package.json +2 -7
- package/node_modules/qs/.eslintrc +1 -1
- package/node_modules/qs/CHANGELOG.md +23 -0
- package/node_modules/qs/README.md +84 -50
- package/node_modules/qs/dist/qs.js +56 -2053
- package/node_modules/qs/lib/parse.js +35 -11
- package/node_modules/qs/lib/stringify.js +49 -18
- package/node_modules/qs/package.json +25 -14
- package/node_modules/qs/test/empty-keys-cases.js +261 -31
- package/node_modules/qs/test/parse.js +179 -30
- package/node_modules/qs/test/stringify.js +331 -48
- package/package.json +4 -4
|
@@ -6,6 +6,8 @@ var iconv = require('iconv-lite');
|
|
|
6
6
|
var mockProperty = require('mock-property');
|
|
7
7
|
var hasOverrideMistake = require('has-override-mistake')();
|
|
8
8
|
var SaferBuffer = require('safer-buffer').Buffer;
|
|
9
|
+
var v = require('es-value-fixtures');
|
|
10
|
+
var inspect = require('object-inspect');
|
|
9
11
|
var emptyTestCases = require('./empty-keys-cases').emptyTestCases;
|
|
10
12
|
|
|
11
13
|
var qs = require('../');
|
|
@@ -37,41 +39,142 @@ test('parse()', function (t) {
|
|
|
37
39
|
st.end();
|
|
38
40
|
});
|
|
39
41
|
|
|
40
|
-
t.test('
|
|
41
|
-
st.deepEqual(qs.parse('a[]=b&a[]=c'
|
|
42
|
-
st.deepEqual(qs.parse('a[0]=b&a[1]=c'
|
|
43
|
-
st.deepEqual(qs.parse('a=b,c'
|
|
44
|
-
st.deepEqual(qs.parse('a=b&a=c'
|
|
42
|
+
t.test('comma: false', function (st) {
|
|
43
|
+
st.deepEqual(qs.parse('a[]=b&a[]=c'), { a: ['b', 'c'] });
|
|
44
|
+
st.deepEqual(qs.parse('a[0]=b&a[1]=c'), { a: ['b', 'c'] });
|
|
45
|
+
st.deepEqual(qs.parse('a=b,c'), { a: 'b,c' });
|
|
46
|
+
st.deepEqual(qs.parse('a=b&a=c'), { a: ['b', 'c'] });
|
|
45
47
|
st.end();
|
|
46
48
|
});
|
|
47
49
|
|
|
48
|
-
t.test('
|
|
49
|
-
st.deepEqual(qs.parse('a[]=b&a[]=c', {
|
|
50
|
-
st.deepEqual(qs.parse('a[0]=b&a[1]=c', {
|
|
51
|
-
st.deepEqual(qs.parse('a=b,c', {
|
|
52
|
-
st.deepEqual(qs.parse('a=b&a=c', {
|
|
50
|
+
t.test('comma: true', function (st) {
|
|
51
|
+
st.deepEqual(qs.parse('a[]=b&a[]=c', { comma: true }), { a: ['b', 'c'] });
|
|
52
|
+
st.deepEqual(qs.parse('a[0]=b&a[1]=c', { comma: true }), { a: ['b', 'c'] });
|
|
53
|
+
st.deepEqual(qs.parse('a=b,c', { comma: true }), { a: ['b', 'c'] });
|
|
54
|
+
st.deepEqual(qs.parse('a=b&a=c', { comma: true }), { a: ['b', 'c'] });
|
|
53
55
|
st.end();
|
|
54
56
|
});
|
|
55
57
|
|
|
56
|
-
t.test('
|
|
57
|
-
st.deepEqual(qs.parse('a
|
|
58
|
-
st.deepEqual(qs.parse('a
|
|
59
|
-
|
|
60
|
-
st.deepEqual(qs.parse('a=b&a=c', { arrayFormat: 'comma' }), { a: ['b', 'c'] });
|
|
58
|
+
t.test('allows enabling dot notation', function (st) {
|
|
59
|
+
st.deepEqual(qs.parse('a.b=c'), { 'a.b': 'c' });
|
|
60
|
+
st.deepEqual(qs.parse('a.b=c', { allowDots: true }), { a: { b: 'c' } });
|
|
61
|
+
|
|
61
62
|
st.end();
|
|
62
63
|
});
|
|
63
64
|
|
|
64
|
-
t.test('
|
|
65
|
-
st.deepEqual(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
t.test('decode dot keys correctly', function (st) {
|
|
66
|
+
st.deepEqual(
|
|
67
|
+
qs.parse('name%252Eobj.first=John&name%252Eobj.last=Doe', { allowDots: false, decodeDotInKeys: false }),
|
|
68
|
+
{ 'name%2Eobj.first': 'John', 'name%2Eobj.last': 'Doe' },
|
|
69
|
+
'with allowDots false and decodeDotInKeys false'
|
|
70
|
+
);
|
|
71
|
+
st.deepEqual(
|
|
72
|
+
qs.parse('name.obj.first=John&name.obj.last=Doe', { allowDots: true, decodeDotInKeys: false }),
|
|
73
|
+
{ name: { obj: { first: 'John', last: 'Doe' } } },
|
|
74
|
+
'with allowDots false and decodeDotInKeys false'
|
|
75
|
+
);
|
|
76
|
+
st.deepEqual(
|
|
77
|
+
qs.parse('name%252Eobj.first=John&name%252Eobj.last=Doe', { allowDots: true, decodeDotInKeys: false }),
|
|
78
|
+
{ 'name%2Eobj': { first: 'John', last: 'Doe' } },
|
|
79
|
+
'with allowDots true and decodeDotInKeys false'
|
|
80
|
+
);
|
|
81
|
+
st.deepEqual(
|
|
82
|
+
qs.parse('name%252Eobj.first=John&name%252Eobj.last=Doe', { allowDots: true, decodeDotInKeys: true }),
|
|
83
|
+
{ 'name.obj': { first: 'John', last: 'Doe' } },
|
|
84
|
+
'with allowDots true and decodeDotInKeys true'
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
st.deepEqual(
|
|
88
|
+
qs.parse(
|
|
89
|
+
'name%252Eobj%252Esubobject.first%252Egodly%252Ename=John&name%252Eobj%252Esubobject.last=Doe',
|
|
90
|
+
{ allowDots: false, decodeDotInKeys: false }
|
|
91
|
+
),
|
|
92
|
+
{ 'name%2Eobj%2Esubobject.first%2Egodly%2Ename': 'John', 'name%2Eobj%2Esubobject.last': 'Doe' },
|
|
93
|
+
'with allowDots false and decodeDotInKeys false'
|
|
94
|
+
);
|
|
95
|
+
st.deepEqual(
|
|
96
|
+
qs.parse(
|
|
97
|
+
'name.obj.subobject.first.godly.name=John&name.obj.subobject.last=Doe',
|
|
98
|
+
{ allowDots: true, decodeDotInKeys: false }
|
|
99
|
+
),
|
|
100
|
+
{ name: { obj: { subobject: { first: { godly: { name: 'John' } }, last: 'Doe' } } } },
|
|
101
|
+
'with allowDots true and decodeDotInKeys false'
|
|
102
|
+
);
|
|
103
|
+
st.deepEqual(
|
|
104
|
+
qs.parse(
|
|
105
|
+
'name%252Eobj%252Esubobject.first%252Egodly%252Ename=John&name%252Eobj%252Esubobject.last=Doe',
|
|
106
|
+
{ allowDots: true, decodeDotInKeys: true }
|
|
107
|
+
),
|
|
108
|
+
{ 'name.obj.subobject': { 'first.godly.name': 'John', last: 'Doe' } },
|
|
109
|
+
'with allowDots true and decodeDotInKeys true'
|
|
110
|
+
);
|
|
111
|
+
|
|
69
112
|
st.end();
|
|
70
113
|
});
|
|
71
114
|
|
|
72
|
-
t.test('
|
|
73
|
-
st.deepEqual(
|
|
74
|
-
|
|
115
|
+
t.test('should decode dot in key of object, and allow enabling dot notation when decodeDotInKeys is set to true and allowDots is undefined', function (st) {
|
|
116
|
+
st.deepEqual(
|
|
117
|
+
qs.parse(
|
|
118
|
+
'name%252Eobj%252Esubobject.first%252Egodly%252Ename=John&name%252Eobj%252Esubobject.last=Doe',
|
|
119
|
+
{ decodeDotInKeys: true }
|
|
120
|
+
),
|
|
121
|
+
{ 'name.obj.subobject': { 'first.godly.name': 'John', last: 'Doe' } },
|
|
122
|
+
'with allowDots undefined and decodeDotInKeys true'
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
st.end();
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
t.test('should throw when decodeDotInKeys is not of type boolean', function (st) {
|
|
129
|
+
st['throws'](
|
|
130
|
+
function () { qs.parse('foo[]&bar=baz', { decodeDotInKeys: 'foobar' }); },
|
|
131
|
+
TypeError
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
st['throws'](
|
|
135
|
+
function () { qs.parse('foo[]&bar=baz', { decodeDotInKeys: 0 }); },
|
|
136
|
+
TypeError
|
|
137
|
+
);
|
|
138
|
+
st['throws'](
|
|
139
|
+
function () { qs.parse('foo[]&bar=baz', { decodeDotInKeys: NaN }); },
|
|
140
|
+
TypeError
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
st['throws'](
|
|
144
|
+
function () { qs.parse('foo[]&bar=baz', { decodeDotInKeys: null }); },
|
|
145
|
+
TypeError
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
st.end();
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
t.test('allows empty arrays in obj values', function (st) {
|
|
152
|
+
st.deepEqual(qs.parse('foo[]&bar=baz', { allowEmptyArrays: true }), { foo: [], bar: 'baz' });
|
|
153
|
+
st.deepEqual(qs.parse('foo[]&bar=baz', { allowEmptyArrays: false }), { foo: [''], bar: 'baz' });
|
|
154
|
+
|
|
155
|
+
st.end();
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
t.test('should throw when allowEmptyArrays is not of type boolean', function (st) {
|
|
159
|
+
st['throws'](
|
|
160
|
+
function () { qs.parse('foo[]&bar=baz', { allowEmptyArrays: 'foobar' }); },
|
|
161
|
+
TypeError
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
st['throws'](
|
|
165
|
+
function () { qs.parse('foo[]&bar=baz', { allowEmptyArrays: 0 }); },
|
|
166
|
+
TypeError
|
|
167
|
+
);
|
|
168
|
+
st['throws'](
|
|
169
|
+
function () { qs.parse('foo[]&bar=baz', { allowEmptyArrays: NaN }); },
|
|
170
|
+
TypeError
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
st['throws'](
|
|
174
|
+
function () { qs.parse('foo[]&bar=baz', { allowEmptyArrays: null }); },
|
|
175
|
+
TypeError
|
|
176
|
+
);
|
|
177
|
+
|
|
75
178
|
st.end();
|
|
76
179
|
});
|
|
77
180
|
|
|
@@ -327,14 +430,14 @@ test('parse()', function (t) {
|
|
|
327
430
|
});
|
|
328
431
|
|
|
329
432
|
t.test('should not throw when a native prototype has an enumerable property', function (st) {
|
|
330
|
-
Object.prototype
|
|
331
|
-
Array.prototype
|
|
433
|
+
st.intercept(Object.prototype, 'crash', { value: '' });
|
|
434
|
+
st.intercept(Array.prototype, 'crash', { value: '' });
|
|
435
|
+
|
|
332
436
|
st.doesNotThrow(qs.parse.bind(null, 'a=b'));
|
|
333
437
|
st.deepEqual(qs.parse('a=b'), { a: 'b' });
|
|
334
438
|
st.doesNotThrow(qs.parse.bind(null, 'a[][b]=c'));
|
|
335
439
|
st.deepEqual(qs.parse('a[][b]=c'), { a: [{ b: 'c' }] });
|
|
336
|
-
|
|
337
|
-
delete Array.prototype.crash;
|
|
440
|
+
|
|
338
441
|
st.end();
|
|
339
442
|
});
|
|
340
443
|
|
|
@@ -365,8 +468,14 @@ test('parse()', function (t) {
|
|
|
365
468
|
|
|
366
469
|
t.test('allows overriding array limit', function (st) {
|
|
367
470
|
st.deepEqual(qs.parse('a[0]=b', { arrayLimit: -1 }), { a: { 0: 'b' } });
|
|
471
|
+
st.deepEqual(qs.parse('a[0]=b', { arrayLimit: 0 }), { a: ['b'] });
|
|
472
|
+
|
|
368
473
|
st.deepEqual(qs.parse('a[-1]=b', { arrayLimit: -1 }), { a: { '-1': 'b' } });
|
|
474
|
+
st.deepEqual(qs.parse('a[-1]=b', { arrayLimit: 0 }), { a: { '-1': 'b' } });
|
|
475
|
+
|
|
476
|
+
st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayLimit: -1 }), { a: { 0: 'b', 1: 'c' } });
|
|
369
477
|
st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayLimit: 0 }), { a: { 0: 'b', 1: 'c' } });
|
|
478
|
+
|
|
370
479
|
st.end();
|
|
371
480
|
});
|
|
372
481
|
|
|
@@ -504,10 +613,12 @@ test('parse()', function (t) {
|
|
|
504
613
|
});
|
|
505
614
|
|
|
506
615
|
t.test('does not blow up when Buffer global is missing', function (st) {
|
|
507
|
-
var
|
|
508
|
-
|
|
616
|
+
var restore = mockProperty(global, 'Buffer', { 'delete': true });
|
|
617
|
+
|
|
509
618
|
var result = qs.parse('a=b&c=d');
|
|
510
|
-
|
|
619
|
+
|
|
620
|
+
restore();
|
|
621
|
+
|
|
511
622
|
st.deepEqual(result, { a: 'b', c: 'd' });
|
|
512
623
|
st.end();
|
|
513
624
|
});
|
|
@@ -896,3 +1007,41 @@ test('parses empty keys', function (t) {
|
|
|
896
1007
|
});
|
|
897
1008
|
});
|
|
898
1009
|
});
|
|
1010
|
+
|
|
1011
|
+
test('`duplicates` option', function (t) {
|
|
1012
|
+
v.nonStrings.concat('not a valid option').forEach(function (invalidOption) {
|
|
1013
|
+
if (typeof invalidOption !== 'undefined') {
|
|
1014
|
+
t['throws'](
|
|
1015
|
+
function () { qs.parse('', { duplicates: invalidOption }); },
|
|
1016
|
+
TypeError,
|
|
1017
|
+
'throws on invalid option: ' + inspect(invalidOption)
|
|
1018
|
+
);
|
|
1019
|
+
}
|
|
1020
|
+
});
|
|
1021
|
+
|
|
1022
|
+
t.deepEqual(
|
|
1023
|
+
qs.parse('foo=bar&foo=baz'),
|
|
1024
|
+
{ foo: ['bar', 'baz'] },
|
|
1025
|
+
'duplicates: default, combine'
|
|
1026
|
+
);
|
|
1027
|
+
|
|
1028
|
+
t.deepEqual(
|
|
1029
|
+
qs.parse('foo=bar&foo=baz', { duplicates: 'combine' }),
|
|
1030
|
+
{ foo: ['bar', 'baz'] },
|
|
1031
|
+
'duplicates: combine'
|
|
1032
|
+
);
|
|
1033
|
+
|
|
1034
|
+
t.deepEqual(
|
|
1035
|
+
qs.parse('foo=bar&foo=baz', { duplicates: 'first' }),
|
|
1036
|
+
{ foo: 'bar' },
|
|
1037
|
+
'duplicates: first'
|
|
1038
|
+
);
|
|
1039
|
+
|
|
1040
|
+
t.deepEqual(
|
|
1041
|
+
qs.parse('foo=bar&foo=baz', { duplicates: 'last' }),
|
|
1042
|
+
{ foo: 'baz' },
|
|
1043
|
+
'duplicates: last'
|
|
1044
|
+
);
|
|
1045
|
+
|
|
1046
|
+
t.end();
|
|
1047
|
+
});
|