cdk-common 2.0.494 → 2.0.496

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.
Files changed (35) hide show
  1. package/.jsii +8 -2
  2. package/API.md +5 -0
  3. package/lib/main.js +1 -1
  4. package/lib/managed-policies.d.ts +1 -0
  5. package/lib/managed-policies.js +2 -1
  6. package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
  7. package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.d.ts +2 -2
  8. package/node_modules/@types/concat-stream/node_modules/@types/node/globals.d.ts +1 -0
  9. package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +2 -2
  10. package/node_modules/@types/concat-stream/node_modules/@types/node/test.d.ts +12 -17
  11. package/node_modules/@types/concat-stream/node_modules/@types/node/ts4.8/buffer.d.ts +2 -2
  12. package/node_modules/@types/concat-stream/node_modules/@types/node/ts4.8/globals.d.ts +1 -0
  13. package/node_modules/@types/concat-stream/node_modules/@types/node/ts4.8/url.d.ts +3 -3
  14. package/node_modules/@types/concat-stream/node_modules/@types/node/ts4.8/util.d.ts +1 -1
  15. package/node_modules/@types/concat-stream/node_modules/@types/node/url.d.ts +3 -3
  16. package/node_modules/@types/concat-stream/node_modules/@types/node/util.d.ts +1 -1
  17. package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
  18. package/node_modules/@types/form-data/node_modules/@types/node/buffer.d.ts +2 -2
  19. package/node_modules/@types/form-data/node_modules/@types/node/globals.d.ts +1 -0
  20. package/node_modules/@types/form-data/node_modules/@types/node/package.json +2 -2
  21. package/node_modules/@types/form-data/node_modules/@types/node/test.d.ts +12 -17
  22. package/node_modules/@types/form-data/node_modules/@types/node/ts4.8/buffer.d.ts +2 -2
  23. package/node_modules/@types/form-data/node_modules/@types/node/ts4.8/globals.d.ts +1 -0
  24. package/node_modules/@types/form-data/node_modules/@types/node/ts4.8/url.d.ts +3 -3
  25. package/node_modules/@types/form-data/node_modules/@types/node/ts4.8/util.d.ts +1 -1
  26. package/node_modules/@types/form-data/node_modules/@types/node/url.d.ts +3 -3
  27. package/node_modules/@types/form-data/node_modules/@types/node/util.d.ts +1 -1
  28. package/node_modules/qs/CHANGELOG.md +4 -0
  29. package/node_modules/qs/dist/qs.js +43 -22
  30. package/node_modules/qs/lib/parse.js +2 -1
  31. package/node_modules/qs/package.json +4 -1
  32. package/node_modules/qs/test/empty-keys-cases.js +37 -0
  33. package/node_modules/qs/test/parse.js +45 -2
  34. package/node_modules/qs/test/stringify.js +18 -0
  35. package/package.json +2 -2
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ emptyTestCases: [
5
+ { input: '&', withEmptyKeys: {}, stringifyOutput: '', noEmptyKeys: {} },
6
+ { input: '&&', withEmptyKeys: {}, stringifyOutput: '', noEmptyKeys: {} },
7
+ { input: '&=', withEmptyKeys: { '': '' }, stringifyOutput: '=', noEmptyKeys: {} },
8
+ { input: '&=&', withEmptyKeys: { '': '' }, stringifyOutput: '=', noEmptyKeys: {} },
9
+ { input: '&=&=', withEmptyKeys: { '': ['', ''] }, stringifyOutput: '[0]=&[1]=', noEmptyKeys: {} },
10
+ { input: '&=&=&', withEmptyKeys: { '': ['', ''] }, stringifyOutput: '[0]=&[1]=', noEmptyKeys: {} },
11
+
12
+ { input: '=', withEmptyKeys: { '': '' }, noEmptyKeys: {}, stringifyOutput: '=' },
13
+ { input: '=&', withEmptyKeys: { '': '' }, stringifyOutput: '=', noEmptyKeys: {} },
14
+ { input: '=&&&', withEmptyKeys: { '': '' }, stringifyOutput: '=', noEmptyKeys: {} },
15
+ { input: '=&=&=&', withEmptyKeys: { '': ['', '', ''] }, stringifyOutput: '[0]=&[1]=&[2]=', noEmptyKeys: {} },
16
+ { input: '=&a[]=b&a[1]=c', withEmptyKeys: { '': '', a: ['b', 'c'] }, stringifyOutput: '=&a[0]=b&a[1]=c', noEmptyKeys: { a: ['b', 'c'] } },
17
+ { input: '=a', withEmptyKeys: { '': 'a' }, noEmptyKeys: {}, stringifyOutput: '=a' },
18
+ { input: '=a', withEmptyKeys: { '': 'a' }, noEmptyKeys: {}, stringifyOutput: '=a' },
19
+ { input: 'a==a', withEmptyKeys: { a: '=a' }, noEmptyKeys: { a: '=a' }, stringifyOutput: 'a==a' },
20
+
21
+ { input: '=&a[]=b', withEmptyKeys: { '': '', a: ['b'] }, stringifyOutput: '=&a[0]=b', noEmptyKeys: { a: ['b'] } },
22
+ { input: '=&a[]=b&a[]=c&a[2]=d', withEmptyKeys: { '': '', a: ['b', 'c', 'd'] }, stringifyOutput: '=&a[0]=b&a[1]=c&a[2]=d', noEmptyKeys: { a: ['b', 'c', 'd'] } },
23
+ { input: '=a&=b', withEmptyKeys: { '': ['a', 'b'] }, stringifyOutput: '[0]=a&[1]=b', noEmptyKeys: {} },
24
+ { input: '=a&foo=b', withEmptyKeys: { '': 'a', foo: 'b' }, noEmptyKeys: { foo: 'b' }, stringifyOutput: '=a&foo=b' },
25
+
26
+ { input: 'a[]=b&a=c&=', withEmptyKeys: { '': '', a: ['b', 'c'] }, stringifyOutput: '=&a[0]=b&a[1]=c', noEmptyKeys: { a: ['b', 'c'] } },
27
+ { input: 'a[]=b&a=c&=', withEmptyKeys: { '': '', a: ['b', 'c'] }, stringifyOutput: '=&a[0]=b&a[1]=c', noEmptyKeys: { a: ['b', 'c'] } },
28
+ { input: 'a[0]=b&a=c&=', withEmptyKeys: { '': '', a: ['b', 'c'] }, stringifyOutput: '=&a[0]=b&a[1]=c', noEmptyKeys: { a: ['b', 'c'] } },
29
+ { input: 'a=b&a[]=c&=', withEmptyKeys: { '': '', a: ['b', 'c'] }, stringifyOutput: '=&a[0]=b&a[1]=c', noEmptyKeys: { a: ['b', 'c'] } },
30
+ { input: 'a=b&a[0]=c&=', withEmptyKeys: { '': '', a: ['b', 'c'] }, stringifyOutput: '=&a[0]=b&a[1]=c', noEmptyKeys: { a: ['b', 'c'] } },
31
+
32
+ { input: '[]=a&[]=b& []=1', withEmptyKeys: { '': ['a', 'b'], ' ': ['1'] }, stringifyOutput: '[0]=a&[1]=b& [0]=1', noEmptyKeys: { 0: 'a', 1: 'b', ' ': ['1'] } },
33
+ { input: '[0]=a&[1]=b&a[0]=1&a[1]=2', withEmptyKeys: { '': ['a', 'b'], a: ['1', '2'] }, noEmptyKeys: { 0: 'a', 1: 'b', a: ['1', '2'] }, stringifyOutput: '[0]=a&[1]=b&a[0]=1&a[1]=2' },
34
+ { input: '[deep]=a&[deep]=2', withEmptyKeys: { '': { deep: ['a', '2'] } }, stringifyOutput: '[deep][0]=a&[deep][1]=2', noEmptyKeys: { deep: ['a', '2'] } },
35
+ { input: '%5B0%5D=a&%5B1%5D=b', withEmptyKeys: { '': ['a', 'b'] }, stringifyOutput: '[0]=a&[1]=b', noEmptyKeys: { 0: 'a', 1: 'b' } }
36
+ ]
37
+ };
@@ -1,10 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  var test = require('tape');
4
- var qs = require('../');
5
- var utils = require('../lib/utils');
4
+ var hasPropertyDescriptors = require('has-property-descriptors')();
6
5
  var iconv = require('iconv-lite');
6
+ var mockProperty = require('mock-property');
7
+ var hasOverrideMistake = require('has-override-mistake')();
7
8
  var SaferBuffer = require('safer-buffer').Buffer;
9
+ var emptyTestCases = require('./empty-keys-cases').emptyTestCases;
10
+
11
+ var qs = require('../');
12
+ var utils = require('../lib/utils');
8
13
 
9
14
  test('parse()', function (t) {
10
15
  t.test('parses a simple string', function (st) {
@@ -601,6 +606,34 @@ test('parse()', function (t) {
601
606
  st.end();
602
607
  });
603
608
 
609
+ t.test('does not crash when the global Object prototype is frozen', { skip: !hasPropertyDescriptors || !hasOverrideMistake }, function (st) {
610
+ // We can't actually freeze the global Object prototype as that will interfere with other tests, and once an object is frozen, it
611
+ // can't be unfrozen. Instead, we add a new non-writable property to simulate this.
612
+ st.teardown(mockProperty(Object.prototype, 'frozenProp', { value: 'foo', nonWritable: true, nonEnumerable: true }));
613
+
614
+ st['throws'](
615
+ function () {
616
+ var obj = {};
617
+ obj.frozenProp = 'bar';
618
+ },
619
+ // node < 6 has a different error message
620
+ /^TypeError: Cannot assign to read only property 'frozenProp' of (?:object '#<Object>'|#<Object>)/,
621
+ 'regular assignment of an inherited non-writable property throws'
622
+ );
623
+
624
+ var parsed;
625
+ st.doesNotThrow(
626
+ function () {
627
+ parsed = qs.parse('frozenProp', { allowPrototypes: false });
628
+ },
629
+ 'parsing a nonwritable Object.prototype property does not throw'
630
+ );
631
+
632
+ st.deepEqual(parsed, {}, 'bare "frozenProp" results in {}');
633
+
634
+ st.end();
635
+ });
636
+
604
637
  t.test('params starting with a closing bracket', function (st) {
605
638
  st.deepEqual(qs.parse(']=toString'), { ']': 'toString' });
606
639
  st.deepEqual(qs.parse(']]=toString'), { ']]': 'toString' });
@@ -853,3 +886,13 @@ test('parse()', function (t) {
853
886
 
854
887
  t.end();
855
888
  });
889
+
890
+ test('parses empty keys', function (t) {
891
+ emptyTestCases.forEach(function (testCase) {
892
+ t.test('skips empty string key with ' + testCase.input, function (st) {
893
+ st.deepEqual(qs.parse(testCase.input), testCase.noEmptyKeys);
894
+
895
+ st.end();
896
+ });
897
+ });
898
+ });
@@ -6,6 +6,7 @@ var utils = require('../lib/utils');
6
6
  var iconv = require('iconv-lite');
7
7
  var SaferBuffer = require('safer-buffer').Buffer;
8
8
  var hasSymbols = require('has-symbols');
9
+ var emptyTestCases = require('./empty-keys-cases').emptyTestCases;
9
10
  var hasBigInt = typeof BigInt === 'function';
10
11
 
11
12
  test('stringify()', function (t) {
@@ -952,3 +953,20 @@ test('stringify()', function (t) {
952
953
 
953
954
  t.end();
954
955
  });
956
+
957
+ test('stringifies empty keys', function (t) {
958
+ emptyTestCases.forEach(function (testCase) {
959
+ t.test('stringifies an object with empty string key with ' + testCase.input, function (st) {
960
+ st.deepEqual(qs.stringify(testCase.withEmptyKeys, { encode: false }), testCase.stringifyOutput);
961
+
962
+ st.end();
963
+ });
964
+ });
965
+
966
+ t.test('edge case with object/arrays', function (st) {
967
+ st.deepEqual(qs.stringify({ '': { '': [2, 3] } }, { encode: false }), '[][0]=2&[][1]=3');
968
+ st.deepEqual(qs.stringify({ '': { '': [2, 3], a: 2 } }, { encode: false }), '[][0]=2&[][1]=3&[a]=2');
969
+
970
+ st.end();
971
+ });
972
+ });
package/package.json CHANGED
@@ -54,7 +54,7 @@
54
54
  "jsii-docgen": "^3.8.31",
55
55
  "jsii-pacmak": "^1.81.0",
56
56
  "npm-check-updates": "^16",
57
- "projen": "0.71.55",
57
+ "projen": "0.71.57",
58
58
  "standard-version": "^9",
59
59
  "ts-jest": "^27",
60
60
  "typescript": "^4.9"
@@ -86,7 +86,7 @@
86
86
  ],
87
87
  "main": "lib/index.js",
88
88
  "license": "Apache-2.0",
89
- "version": "2.0.494",
89
+ "version": "2.0.496",
90
90
  "jest": {
91
91
  "testMatch": [
92
92
  "<rootDir>/src/**/__tests__/**/*.ts?(x)",