@ashlr/hub 3.2.7 → 3.3.2

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 (192) hide show
  1. package/CHANGELOG.md +314 -2
  2. package/README.md +54 -38
  3. package/dist/build-identity.json +2 -2
  4. package/dist/cli/audit.js +18 -0
  5. package/dist/cli/audit.js.map +1 -1
  6. package/dist/cli/backlog.d.ts +0 -5
  7. package/dist/cli/backlog.js +18 -0
  8. package/dist/cli/backlog.js.map +1 -1
  9. package/dist/cli/comms.js +20 -0
  10. package/dist/cli/comms.js.map +1 -1
  11. package/dist/cli/completions.d.ts +6 -1
  12. package/dist/cli/completions.js +33 -10
  13. package/dist/cli/completions.js.map +1 -1
  14. package/dist/cli/daemon.js +10 -3
  15. package/dist/cli/daemon.js.map +1 -1
  16. package/dist/cli/dashboard.js +5 -4
  17. package/dist/cli/dashboard.js.map +1 -1
  18. package/dist/cli/demo.d.ts +0 -27
  19. package/dist/cli/demo.js +17 -0
  20. package/dist/cli/demo.js.map +1 -1
  21. package/dist/cli/help.js +22 -9
  22. package/dist/cli/help.js.map +1 -1
  23. package/dist/cli/inbox.d.ts +14 -2
  24. package/dist/cli/inbox.js +137 -23
  25. package/dist/cli/inbox.js.map +1 -1
  26. package/dist/cli/onboard.d.ts +0 -13
  27. package/dist/cli/onboard.js +20 -0
  28. package/dist/cli/onboard.js.map +1 -1
  29. package/dist/cli/resources.js +15 -0
  30. package/dist/cli/resources.js.map +1 -1
  31. package/dist/cli/run.js +1 -1
  32. package/dist/cli/run.js.map +1 -1
  33. package/dist/cli/sandbox.js +43 -0
  34. package/dist/cli/sandbox.js.map +1 -1
  35. package/dist/cli/serve.js +7 -3
  36. package/dist/cli/serve.js.map +1 -1
  37. package/dist/cli/setup.d.ts +5 -3
  38. package/dist/cli/setup.js +14 -7
  39. package/dist/cli/setup.js.map +1 -1
  40. package/dist/cli/tui.d.ts +0 -6
  41. package/dist/cli/tui.js +14 -0
  42. package/dist/cli/tui.js.map +1 -1
  43. package/dist/cli/update.js +3 -1
  44. package/dist/cli/update.js.map +1 -1
  45. package/dist/core/config.js +70 -0
  46. package/dist/core/config.js.map +1 -1
  47. package/dist/core/daemon/loop.js +83 -3
  48. package/dist/core/daemon/loop.js.map +1 -1
  49. package/dist/core/daemon/runtime-activation-resident-start-protocol.d.ts +141 -0
  50. package/dist/core/daemon/runtime-activation-resident-start-protocol.js +462 -0
  51. package/dist/core/daemon/runtime-activation-resident-start-protocol.js.map +1 -0
  52. package/dist/core/daemon/runtime-activation-resident-start-runtime.d.ts +27 -0
  53. package/dist/core/daemon/runtime-activation-resident-start-runtime.js +28 -0
  54. package/dist/core/daemon/runtime-activation-resident-start-runtime.js.map +1 -0
  55. package/dist/core/daemon/runtime-activation-stopped-consumer.d.ts +139 -0
  56. package/dist/core/daemon/runtime-activation-stopped-consumer.js +995 -0
  57. package/dist/core/daemon/runtime-activation-stopped-consumer.js.map +1 -0
  58. package/dist/core/daemon/runtime-activation-stopped-runtime.d.ts +36 -0
  59. package/dist/core/daemon/runtime-activation-stopped-runtime.js +134 -0
  60. package/dist/core/daemon/runtime-activation-stopped-runtime.js.map +1 -0
  61. package/dist/core/daemon/runtime-activation-transaction.d.ts +41 -17
  62. package/dist/core/daemon/runtime-activation-transaction.js +80 -11
  63. package/dist/core/daemon/runtime-activation-transaction.js.map +1 -1
  64. package/dist/core/daemon/runtime-release-dependency-inventory.js +1 -0
  65. package/dist/core/daemon/runtime-release-dependency-inventory.js.map +1 -1
  66. package/dist/core/daemon/service-install-authority.d.ts +1 -1
  67. package/dist/core/daemon/service-install-authority.js +4 -2
  68. package/dist/core/daemon/service-install-authority.js.map +1 -1
  69. package/dist/core/dashboard.d.ts +10 -0
  70. package/dist/core/dashboard.js +103 -28
  71. package/dist/core/dashboard.js.map +1 -1
  72. package/dist/core/effective-config.js +7 -0
  73. package/dist/core/effective-config.js.map +1 -1
  74. package/dist/core/fleet/automerge-pass.js +57 -73
  75. package/dist/core/fleet/automerge-pass.js.map +1 -1
  76. package/dist/core/fleet/decisions-ledger.js +36 -13
  77. package/dist/core/fleet/decisions-ledger.js.map +1 -1
  78. package/dist/core/fleet/external-skill-git-capture.js +9 -1
  79. package/dist/core/fleet/external-skill-git-capture.js.map +1 -1
  80. package/dist/core/fleet/judge-decision-metadata.d.ts +8 -1
  81. package/dist/core/fleet/judge-decision-metadata.js +14 -1
  82. package/dist/core/fleet/judge-decision-metadata.js.map +1 -1
  83. package/dist/core/fleet/judge-trace.js +2 -1
  84. package/dist/core/fleet/judge-trace.js.map +1 -1
  85. package/dist/core/fleet/manager.d.ts +21 -1
  86. package/dist/core/fleet/manager.js +137 -41
  87. package/dist/core/fleet/manager.js.map +1 -1
  88. package/dist/core/fleet/post-merge-credit-label.d.ts +10 -0
  89. package/dist/core/fleet/post-merge-credit-label.js +13 -0
  90. package/dist/core/fleet/post-merge-credit-label.js.map +1 -0
  91. package/dist/core/fleet/post-merge-credit.d.ts +119 -12
  92. package/dist/core/fleet/post-merge-credit.js +353 -14
  93. package/dist/core/fleet/post-merge-credit.js.map +1 -1
  94. package/dist/core/fleet/self-improve.d.ts +38 -5
  95. package/dist/core/fleet/self-improve.js +201 -12
  96. package/dist/core/fleet/self-improve.js.map +1 -1
  97. package/dist/core/fleet/skill-library.d.ts +21 -2
  98. package/dist/core/fleet/skill-library.js +54 -12
  99. package/dist/core/fleet/skill-library.js.map +1 -1
  100. package/dist/core/fleet/worked-ledger.d.ts +22 -0
  101. package/dist/core/fleet/worked-ledger.js +32 -0
  102. package/dist/core/fleet/worked-ledger.js.map +1 -1
  103. package/dist/core/goals/store.js +60 -6
  104. package/dist/core/goals/store.js.map +1 -1
  105. package/dist/core/inbox/apply.js +2 -1
  106. package/dist/core/inbox/apply.js.map +1 -1
  107. package/dist/core/inbox/merge.d.ts +10 -1
  108. package/dist/core/inbox/merge.js +97 -18
  109. package/dist/core/inbox/merge.js.map +1 -1
  110. package/dist/core/integrations/github.d.ts +2 -0
  111. package/dist/core/integrations/github.js +2 -1
  112. package/dist/core/integrations/github.js.map +1 -1
  113. package/dist/core/learn/reflect.d.ts +42 -4
  114. package/dist/core/learn/reflect.js +66 -5
  115. package/dist/core/learn/reflect.js.map +1 -1
  116. package/dist/core/onboard.d.ts +2 -0
  117. package/dist/core/onboard.js +9 -3
  118. package/dist/core/onboard.js.map +1 -1
  119. package/dist/core/run/engines.d.ts +8 -0
  120. package/dist/core/run/engines.js +9 -1
  121. package/dist/core/run/engines.js.map +1 -1
  122. package/dist/core/run/learned-router.js +28 -3
  123. package/dist/core/run/learned-router.js.map +1 -1
  124. package/dist/core/run/orchestrator.d.ts +7 -2
  125. package/dist/core/run/orchestrator.js +88 -60
  126. package/dist/core/run/orchestrator.js.map +1 -1
  127. package/dist/core/swarm/rollback.d.ts +11 -0
  128. package/dist/core/swarm/rollback.js +54 -0
  129. package/dist/core/swarm/rollback.js.map +1 -1
  130. package/dist/core/swarm/runner.js +94 -8
  131. package/dist/core/swarm/runner.js.map +1 -1
  132. package/dist/core/types.d.ts +103 -3
  133. package/dist/core/types.js.map +1 -1
  134. package/dist/core/web/api.d.ts +6 -0
  135. package/dist/core/web/api.js +174 -18
  136. package/dist/core/web/api.js.map +1 -1
  137. package/dist/core/web/control.d.ts +20 -0
  138. package/dist/core/web/control.js +44 -32
  139. package/dist/core/web/control.js.map +1 -1
  140. package/dist/core/web/fleet-status-cache.d.ts +68 -0
  141. package/dist/core/web/fleet-status-cache.js +120 -0
  142. package/dist/core/web/fleet-status-cache.js.map +1 -0
  143. package/dist/core/web/public/app.js +5 -1
  144. package/dist/core/web/public/next/assets/index-CDHQraxS.css +1 -0
  145. package/dist/core/web/public/next/assets/index-zVKD9krw.js +69 -0
  146. package/dist/core/web/public/next/assets/index-zVKD9krw.js.map +1 -0
  147. package/dist/core/web/public/next/index.html +15 -0
  148. package/dist/core/web/read-session-revocations.d.ts +26 -0
  149. package/dist/core/web/read-session-revocations.js +48 -0
  150. package/dist/core/web/read-session-revocations.js.map +1 -0
  151. package/dist/core/web/server.js +73 -27
  152. package/dist/core/web/server.js.map +1 -1
  153. package/dist/core/web/static.d.ts +1 -1
  154. package/dist/core/web/static.js +54 -20
  155. package/dist/core/web/static.js.map +1 -1
  156. package/dist/release-dependency-inventory.json +1 -1
  157. package/docs/RUNTIME_ACTIVATION_AUTHORITY.md +115 -21
  158. package/docs/contracts/CONTRACT-M521.md +102 -0
  159. package/node_modules/fast-uri/index.js +201 -48
  160. package/node_modules/fast-uri/lib/schemes.js +9 -4
  161. package/node_modules/fast-uri/lib/utils.js +388 -91
  162. package/node_modules/fast-uri/package.json +1 -1
  163. package/node_modules/fast-uri/test/component-safe-serialization.test.js +105 -0
  164. package/node_modules/fast-uri/test/equal.test.js +31 -3
  165. package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +2 -0
  166. package/node_modules/fast-uri/test/ipv6-canonical.test.js +34 -0
  167. package/node_modules/fast-uri/test/ipv6-validation.test.js +90 -0
  168. package/node_modules/fast-uri/test/malformed-percent.test.js +77 -0
  169. package/node_modules/fast-uri/test/malformed-urn.test.js +61 -0
  170. package/node_modules/fast-uri/test/parse.test.js +7 -3
  171. package/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
  172. package/node_modules/fast-uri/test/reserved-path-normalization.test.js +109 -0
  173. package/node_modules/fast-uri/test/scheme-validation.test.js +124 -0
  174. package/node_modules/fast-uri/test/security-normalization.test.js +101 -0
  175. package/node_modules/fast-uri/test/security.test.js +75 -3
  176. package/node_modules/fast-uri/test/urn-full-input.test.js +29 -0
  177. package/node_modules/fast-uri/test/websocket-query-preservation.test.js +24 -0
  178. package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
  179. package/node_modules/qs/CHANGELOG.md +26 -0
  180. package/node_modules/qs/README.md +19 -1
  181. package/node_modules/qs/dist/qs.js +25 -25
  182. package/node_modules/qs/eslint.config.mjs +1 -1
  183. package/node_modules/qs/lib/parse.js +16 -6
  184. package/node_modules/qs/lib/stringify.js +23 -8
  185. package/node_modules/qs/lib/utils.js +57 -11
  186. package/node_modules/qs/package.json +8 -7
  187. package/node_modules/qs/test/parse.js +419 -0
  188. package/node_modules/qs/test/stringify.js +317 -0
  189. package/node_modules/qs/test/utils.js +206 -0
  190. package/package.json +24 -6
  191. package/schema/config.schema.json +800 -5
  192. package/node_modules/which/CHANGELOG.md +0 -166
@@ -37,3 +37,104 @@ test('equal does not treat reserved path escapes as live path syntax', (t) => {
37
37
 
38
38
  t.end()
39
39
  })
40
+
41
+ test('serialize preserves literal RFC 3986 reserved path characters', (t) => {
42
+ // GHSA-7mh8-fcmq-x23c: literal reserved path chars must not be rewritten to
43
+ // percent escapes by the escape()-style safe set.
44
+ const cases = [
45
+ 'http://example.com/a;b',
46
+ 'http://example.com/a=b',
47
+ 'http://example.com/a&b',
48
+ 'http://example.com/a$b',
49
+ 'http://example.com/a:b',
50
+ 'http://example.com/a@b'
51
+ ]
52
+
53
+ t.plan(cases.length)
54
+
55
+ cases.forEach((uri) => {
56
+ t.equal(fastURI.serialize(fastURI.parse(uri)), uri, uri)
57
+ })
58
+ t.end()
59
+ })
60
+
61
+ test('serialize preserves existing reserved path escapes as data', (t) => {
62
+ // GHSA-7mh8-fcmq-x23c: an existing %3A escape must stay %3A instead of being
63
+ // rewritten into a live colon.
64
+ const cases = [
65
+ 'http://example.com/a%3Ab',
66
+ 'http://example.com/a%3Bb',
67
+ 'http://example.com/a%3D%3D'
68
+ ]
69
+
70
+ t.plan(cases.length)
71
+
72
+ cases.forEach((uri) => {
73
+ t.equal(fastURI.serialize(fastURI.parse(uri)), uri, uri)
74
+ })
75
+ t.end()
76
+ })
77
+
78
+ test('serialize keeps path-noscheme colon escaping', (t) => {
79
+ // Without a scheme a literal colon would be reparsed as a scheme separator,
80
+ // so it must stay percent-escaped while an existing %3A is preserved.
81
+ t.equal(fastURI.serialize({ path: 'foo:bar' }), 'foo%3Abar')
82
+ t.equal(fastURI.serialize({ path: 'a%3Ab' }), 'a%3Ab')
83
+ t.end()
84
+ })
85
+
86
+ test('hostname normalization never decodes an escape more than once', (t) => {
87
+ const encodedLocalhost = 'http://%256c%256f%2563%2561%256c%2568%256f%2573%2574/'
88
+ const encodedLoopback = '//127%252e0%252e0%252e1/private'
89
+ const encodedMetadataAddress = '//169%252E254%252E169%252E254/latest/meta-data/'
90
+
91
+ t.equal(fastURI.normalize(encodedLocalhost), encodedLocalhost, 'nested hostname letters remain encoded')
92
+ t.equal(fastURI.normalize(encodedLoopback), encodedLoopback, 'nested IPv4 dots remain encoded')
93
+ t.equal(
94
+ fastURI.resolve('https://safe.example/', encodedLoopback),
95
+ 'https://127%252e0%252e0%252e1/private',
96
+ 'resolve does not turn nested dots into a loopback address'
97
+ )
98
+ t.equal(
99
+ fastURI.resolve('https://allowed.com/api/v1/', encodedMetadataAddress),
100
+ 'https://169%252e254%252e169%252e254/latest/meta-data/',
101
+ 'resolve does not turn nested dots into a metadata address'
102
+ )
103
+ t.equal(
104
+ fastURI.normalize('http://allowed.com%255Cevil.com/'),
105
+ 'http://allowed.com%255Cevil.com/',
106
+ 'normalize does not activate a nested backslash'
107
+ )
108
+ t.equal(
109
+ fastURI.serialize({ scheme: 'http', host: '%256cocalhost', path: '/' }),
110
+ 'http://%256cocalhost/',
111
+ 'component serialization preserves an encoded percent sign'
112
+ )
113
+ t.equal(
114
+ fastURI.equal(encodedLocalhost, 'http://localhost/', {}),
115
+ false,
116
+ 'nested escapes do not compare equal to their twice-decoded target'
117
+ )
118
+ t.end()
119
+ })
120
+
121
+ test('hostname normalization decodes only current unreserved escapes', (t) => {
122
+ t.equal(fastURI.normalize('x://%6cocalhost/'), 'x://localhost/', 'a current unreserved escape is decoded')
123
+ t.equal(fastURI.normalize('x://%256cocalhost/'), 'x://%256cocalhost/', 'an encoded percent is preserved')
124
+ t.equal(fastURI.normalize('x://host%2540evil/'), 'x://host%2540evil/', 'a nested authority delimiter stays inert')
125
+ t.equal(fastURI.normalize('x://%2525/'), 'x://%2525/', 'nested encoded percent signs stay encoded')
126
+ t.end()
127
+ })
128
+
129
+ test('host conversion failures are not treated as comparable URLs', (t) => {
130
+ const malformedHost = 'http://trusted.test%2540evil.test/'
131
+
132
+ t.equal(fastURI.normalize(malformedHost), malformedHost, 'normalization preserves the failing input')
133
+ t.equal(fastURI.equal(malformedHost, malformedHost, {}), false, 'equal rejects a failed host conversion')
134
+ t.throws(
135
+ () => fastURI.resolve(malformedHost, 'child', { domainHost: true }),
136
+ /Host's domain name can not be converted to ASCII/,
137
+ 'resolve propagates a host conversion failure'
138
+ )
139
+ t.end()
140
+ })
@@ -125,11 +125,13 @@ test('serialize escapes authority delimiters in host field', (t) => {
125
125
  })
126
126
 
127
127
  test('normalize does not double-decode %2540 into a live @', (t) => {
128
- const result = fastURI.normalize('http://trusted.com%2540evil.com/')
128
+ const input = 'http://trusted.com%2540evil.com/'
129
+ const result = fastURI.normalize(input)
129
130
  const parsed = fastURI.parse(result)
130
131
 
131
- t.plan(1)
132
- t.notEqual(parsed.host, 'trusted.com@evil.com', 'http://trusted.com%2540evil.com/')
132
+ t.plan(2)
133
+ t.equal(result, input, 'the encoded percent sign is preserved')
134
+ t.notEqual(parsed.host, 'trusted.com@evil.com', input)
133
135
  })
134
136
 
135
137
  test('parse canonicalises IDN / Unicode hosts to their ASCII form', (t) => {
@@ -160,6 +162,76 @@ test('parse canonicalises IDN / Unicode hosts to their ASCII form', (t) => {
160
162
  })
161
163
  })
162
164
 
165
+ test('resolve canonicalises the host using the final resolved scheme', (t) => {
166
+ const cases = [
167
+ {
168
+ base: 'http://trusted.example/base',
169
+ relative: '//127\u30020\u30020\u30021/private',
170
+ expected: 'http://127.0.0.1/private',
171
+ expectedHost: '127.0.0.1',
172
+ description: 'scheme-relative loopback host'
173
+ },
174
+ {
175
+ base: 'https://ex\u00ADample.com/base',
176
+ relative: 'child',
177
+ expected: 'https://example.com/child',
178
+ expectedHost: 'example.com',
179
+ description: 'host inherited from the base'
180
+ },
181
+ {
182
+ base: 'http://trusted.example/base',
183
+ relative: 'http://ex\u200Bample.com/',
184
+ expected: 'http://example.com/',
185
+ expectedHost: 'example.com',
186
+ description: 'absolute relative reference'
187
+ }
188
+ ]
189
+
190
+ t.plan(cases.length * 2)
191
+
192
+ cases.forEach(({ base, relative, expected, expectedHost, description }) => {
193
+ const resolved = fastURI.resolve(base, relative)
194
+ t.equal(resolved, expected, description)
195
+ t.equal(fastURI.parse(resolved).host, expectedHost, `${description} reparses consistently`)
196
+ })
197
+ })
198
+
199
+ test('resolve applies domain canonicalisation only when the effective scheme opts in', (t) => {
200
+ const host = 'ex\u00ADample.com'
201
+
202
+ t.plan(2)
203
+ t.equal(
204
+ fastURI.resolve('uri://trusted.example/', `//${host}/`),
205
+ `uri://${host}/`,
206
+ 'an unsupported scheme preserves the host'
207
+ )
208
+ t.equal(
209
+ fastURI.resolve('http://trusted.example/', `//${host}/`, { unicodeSupport: true }),
210
+ `http://${host}/`,
211
+ 'unicodeSupport preserves the Unicode host'
212
+ )
213
+ })
214
+
215
+ test('resolve throws when the final scheme cannot canonicalise the host', (t) => {
216
+ const invalidHost = '\u200D.example'
217
+ const cases = [
218
+ ['http://trusted.example/', `//${invalidHost}/`],
219
+ [`https://${invalidHost}/base`, 'child'],
220
+ ['http://trusted.example/', `http://${invalidHost}/`],
221
+ ['http://trusted.example/', `//${invalidHost}%2Etest/`]
222
+ ]
223
+
224
+ t.plan(cases.length)
225
+
226
+ cases.forEach(([base, relative]) => {
227
+ t.throws(
228
+ () => fastURI.resolve(base, relative),
229
+ /Host's domain name can not be converted to ASCII/,
230
+ `${base} + ${relative}`
231
+ )
232
+ })
233
+ })
234
+
163
235
  test('parse rejects a literal backslash in the authority as malformed (RFC 3986)', (t) => {
164
236
  // Regression for the host-confusion bypass: a literal "\" is invalid RFC 3986
165
237
  // syntax and must be flagged malformed, not silently rewritten. Otherwise "\"
@@ -0,0 +1,29 @@
1
+ 'use strict'
2
+
3
+ const test = require('tape')
4
+ const fastURI = require('..')
5
+
6
+ test('URN parsing validates the complete scheme-specific input', (t) => {
7
+ const embedded = fastURI.parse('urn:x|foo:bar')
8
+ t.equal(embedded.error, 'URN can not be parsed.', 'does not search for a later nid:nss substring')
9
+ t.equal(embedded.nid, undefined, 'does not adopt the later nid')
10
+ t.equal(embedded.nss, undefined, 'does not adopt the later nss')
11
+
12
+ const trailing = fastURI.parse('urn:foo:bar|ignored')
13
+ t.equal(trailing.error, 'URN can not be parsed.', 'rejects trailing input outside the RFC 2141 NSS grammar')
14
+ t.equal(trailing.nid, undefined, 'does not return an nid from a partial match')
15
+ t.equal(trailing.nss, undefined, 'does not return a truncated nss')
16
+
17
+ t.end()
18
+ })
19
+
20
+ test('URN parsing preserves the complete RFC 2141 NSS', (t) => {
21
+ const parsed = fastURI.parse('urn:foo:allowed/evil')
22
+ t.equal(parsed.error, undefined, 'accepts slash in an RFC 2141 NSS')
23
+ t.equal(parsed.nid, 'foo', 'parses the nid')
24
+ t.equal(parsed.nss, 'allowed/evil', 'preserves the complete NSS')
25
+ t.equal(fastURI.normalize('urn:foo:allowed/evil'), 'urn:foo:allowed/evil', 'normalization retains slash data')
26
+ t.equal(fastURI.equal('urn:foo:allowed/evil', 'urn:foo:allowed'), false, 'distinct NSS values do not compare equal')
27
+
28
+ t.end()
29
+ })
@@ -0,0 +1,24 @@
1
+ 'use strict'
2
+
3
+ const test = require('tape')
4
+ const fastURI = require('..')
5
+
6
+ test('WebSocket queries preserve additional question marks', (t) => {
7
+ for (const scheme of ['ws', 'wss']) {
8
+ const uri = `${scheme}://example.com/chat?a?b`
9
+ const truncatedURI = `${scheme}://example.com/chat?a`
10
+ const parsed = fastURI.parse(uri)
11
+
12
+ t.equal(parsed.resourceName, '/chat?a?b', `${scheme} parse preserves the resource name`)
13
+ t.equal(fastURI.serialize(parsed), uri, `${scheme} parsed components round-trip`)
14
+ t.equal(
15
+ fastURI.serialize({ scheme, host: 'example.com', resourceName: '/chat?a?b' }),
16
+ uri,
17
+ `${scheme} resource name serializes without truncation`
18
+ )
19
+ t.equal(fastURI.normalize(uri), uri, `${scheme} normalization preserves the full query`)
20
+ t.equal(fastURI.equal(uri, truncatedURI), false, `${scheme} equality distinguishes the full query`)
21
+ }
22
+
23
+ t.end()
24
+ })
@@ -25,7 +25,7 @@ Caller Application → qs.stringify(obj, options) → Stringifying Engine → Ou
25
25
 
26
26
  **Trust Boundaries:**
27
27
  - **Input string (parse):** May come from untrusted sources (e.g., user input, network requests)
28
- - **Input object (stringify):** May contain cycles, which can lead to infinite loops during stringification
28
+ - **Input object (stringify):** The calling application's own data, not a direct untrusted channel. May contain cycles (handled by the cycle detector). Deeply-nested non-cyclic input surfaces as a catchable synchronous `RangeError` (stack overflow), not unbounded resource consumption; callers that serialize externally-influenced objects should bound their depth/size beforehand.
29
29
  - **Options:** Provided by the caller
30
30
  - **Cycle Tracking:** Used only during stringification to detect and handle circular references
31
31
 
@@ -58,7 +58,7 @@ Caller Application → qs.stringify(obj, options) → Stringifying Engine → Ou
58
58
  |---------------------------------------------------|---------------------|
59
59
  | Tampering (malicious input, prototype pollution) | Strict input validation; keep `allowPrototypes: false` by default; use `plainObjects` for output; ensure builtins/globals are never modified by parse[4][8]. |
60
60
  | Information Disclosure (error messages) | Generic error messages without stack traces or internal paths. |
61
- | Denial of Service (memory/CPU exhaustion) | Enforce `arrayLimit` and `parameterLimit` with safe defaults; enable `throwOnLimitExceeded`; limit nesting depth[7]. |
61
+ | Denial of Service (memory/CPU exhaustion) | `arrayLimit`, `parameterLimit`, and depth limiting apply with safe defaults. Note that `arrayLimit` is a representation threshold (array vs. object), and `parameterLimit` bounds only the number of `&`-delimited parameters - neither caps the elements produced by `comma: true` splitting. For a hard cap that rejects oversized untrusted input, opt in to `throwOnLimitExceeded: true` (default `false`), and always bound input size at the transport layer[7]. On the `stringify` side, the input is the caller's own object rather than an untrusted string, so unbounded nesting manifests as a catchable `RangeError` (stack overflow) rather than exhaustion; callers serializing externally-influenced objects should bound depth/size beforehand, and may opt into `stringify`'s `depth` option (default `Infinity`) for a deterministic, catchable error. |
62
62
  | Elevation of Privilege (prototype pollution) | Keep `allowPrototypes: false`; validate options against allowlist; use `plainObjects` to avoid prototype pollution[4][8]. |
63
63
 
64
64
  ### 7. Risk Ranking
@@ -70,7 +70,7 @@ Caller Application → qs.stringify(obj, options) → Stringifying Engine → Ou
70
70
  ### 8. Next Steps & Review
71
71
 
72
72
  1. **Audit option validation logic.**
73
- 2. **Add depth limiting to nested parsing and stringification.**
73
+ 2. **Depth limiting:** `parse` enforces a `depth` bound by default (with `strictDepth` to throw); `stringify` offers an opt-in `depth` bound (default `Infinity`, since its input is caller-produced) for defense-in-depth.
74
74
  3. **Implement fuzz testing for parser and stringifier edge cases.**
75
75
  4. **Regularly review dependencies for vulnerabilities.**
76
76
  5. **Keep documentation and threat model up to date.**
@@ -1,3 +1,29 @@
1
+ ## **6.16.0**
2
+ - [New] `stringify`: add a `depth` option to bound recursion depth (default `Infinity`)
3
+ - [Fix] stringify: serialize Date values when a filter is provided
4
+ - [Fix] `parse`: enforce `arrayLimit` on comma groups under `[]=` when `throwOnLimitExceeded` is set
5
+ - [Fix] `parse`: flatten a collection appended to an overflowed array (#571)
6
+ - [Fix] `utils`: `isBuffer`: do not invoke a non-callable `constructor.isBuffer`
7
+ - [Fix] `stringify`: do not let `allowEmptyArrays` skip cycle detection (or drop own keys) on an empty array with own properties
8
+ - [Fix] `stringify`: encode dots in a top-level key with a primitive value when encodeDotInKeys is set (#562)
9
+ - [Docs] threat model: clarify `stringify` deep-nesting DoS is caller-bounded
10
+ - [Docs] clarify `arrayLimit` is a representation threshold, not an element-count cap
11
+ - [Tests] `parse`: remove a test that pinned `[]=` comma groups escaping `arrayLimit`
12
+ - [Tests] `stringify`: pin current `encodeDotInKeys` separator-dot behavior
13
+ - [Dev Deps] update `@ljharb/eslint-config`, `eslint`
14
+ - [Dev Deps] update `eslint`, `evalmd`
15
+
16
+ ## **6.15.3**
17
+ - [Fix] `parse`: enforce `throwOnLimitExceeded` for cumulative array growth via `combine`/`merge`
18
+ - [Fix] `utils`: respect encoding of surrogate pairs across chunks (#559)
19
+ - [Robustness] `parse`: throw the `arrayLimit` error before splitting oversized comma values
20
+ - [Robustness] `utils.merge` / `utils.assign`: avoid invoking `__proto__` setter when copying own properties
21
+ - [Robustness] `utils`: enforce `arrayLimit` consistently across `merge`'s array paths
22
+ - [Perf] `utils`: make `compact` O(n) via a side-channel visited-set instead of `Array.indexOf`
23
+ - [Deps] update `side-channel`
24
+ - [Dev Deps] update `eslint`, `mock-property`, `tape`
25
+ - [Tests] `parse`: characterize current lenient handling of unbalanced bracket keys (#558)
26
+
1
27
  ## **6.15.2**
2
28
  - [Fix] `stringify`: skip null/undefined entries in `arrayFormat: 'comma'` + `encodeValuesOnly` instead of crashing in `encoder`
3
29
  - [Fix] `stringify`: use configured `delimiter` after `charsetSentinel` (#555)
@@ -147,6 +147,8 @@ try {
147
147
 
148
148
  When `throwOnLimitExceeded` is set to `false` (default), **qs** will parse up to the specified `parameterLimit` and ignore the rest without throwing an error.
149
149
 
150
+ Note that `parameterLimit` only bounds the number of `&`-delimited parameters; it does not limit how many values a single parameter expands into. In particular, when `comma: true` is enabled, a single parameter's value is split on commas into arbitrarily many elements, which `parameterLimit` does not constrain. To bound the total element count from untrusted input, set `throwOnLimitExceeded: true` (see `arrayLimit` below), and always bound the input size at the transport layer (e.g. an HTTP body-size limit).
151
+
150
152
  To bypass the leading question mark, use `ignoreQueryPrefix`:
151
153
 
152
154
  ```javascript
@@ -313,7 +315,9 @@ try {
313
315
  }
314
316
  ```
315
317
 
316
- When `throwOnLimitExceeded` is set to `false` (default), **qs** will parse up to the specified `arrayLimit` and if the limit is exceeded, the array will instead be converted to an object with the index as the key
318
+ When `throwOnLimitExceeded` is set to `false` (default), **qs** will parse up to the specified `arrayLimit` and if the limit is exceeded, the array will instead be converted to an object with the index as the key.
319
+
320
+ Note that `arrayLimit` is a *representation* threshold that controls when a numerically-indexed collection switches from an array to an object — it is **not** a hard cap on the total number of elements parsed. With the default `throwOnLimitExceeded: false`, exceeding `arrayLimit` never rejects or truncates input; it only changes the container type, and the resulting object still holds every element (so its size stays proportional to the input). This conversion is itself a safeguard: it avoids allocating a huge sparse array for input like `a[999999999]`. If you need a hard limit that rejects oversized input from untrusted sources, set `throwOnLimitExceeded: true`.
317
321
 
318
322
  To prevent array syntax (`a[]`, `a[0]`) from being parsed as arrays, set `parseArrays` to `false`.
319
323
  Note that duplicate keys (e.g. `a=b&a=c`) may still produce arrays when `duplicates` is `'combine'` (the default).
@@ -410,6 +414,20 @@ var encoded = qs.stringify({ a: { b: 'c' } }, { encoder: function (str) {
410
414
 
411
415
  _(Note: the `encoder` option does not apply if `encode` is `false`)_
412
416
 
417
+ By default, `qs.stringify` serializes an object of any nesting depth.
418
+ For backwards compatibility, and because its input is the caller's own object rather than a query string parsed by **qs**, this is unbounded.
419
+ If you serialize objects whose nesting can be influenced by untrusted input, bound it with the numeric `depth` option (default `Infinity`);
420
+ exceeding it throws a catchable `RangeError` instead of eventually overflowing the call stack:
421
+
422
+ ```javascript
423
+ try {
424
+ qs.stringify({ a: { b: { c: { d: 'e' } } } }, { depth: 2 });
425
+ } catch (err) {
426
+ assert(err instanceof RangeError);
427
+ assert.strictEqual(err.message, 'Input depth exceeded depth option of 2');
428
+ }
429
+ ```
430
+
413
431
  Analogue to the `encoder` there is a `decoder` option for `parse` to override decoding of properties and values:
414
432
 
415
433
  ```javascript
@@ -5,28 +5,31 @@
5
5
  "use strict";var stringify=require(4),parse=require(3),formats=require(1);module.exports={formats:formats,parse:parse,stringify:stringify};
6
6
 
7
7
  },{"1":1,"3":3,"4":4}],3:[function(require,module,exports){
8
- "use strict";var utils=require(5),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,defaults={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:utils.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},parseArrayValue=function(e,t,r){if(e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1)return e.split(",");if(t.throwOnLimitExceeded&&r>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function parseQueryStringValues(e,t){var r={__proto__:null},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var a=t.parameterLimit===1/0?void 0:t.parameterLimit,o=i.split(t.delimiter,t.throwOnLimitExceeded&&void 0!==a?a+1:a);if(t.throwOnLimitExceeded&&void 0!==a&&o.length>a)throw new RangeError("Parameter limit exceeded. Only "+a+" parameter"+(1===a?"":"s")+" allowed.");var l,n=-1,s=t.charset;if(t.charsetSentinel)for(l=0;l<o.length;++l)0===o[l].indexOf("utf8=")&&(o[l]===charsetSentinel?s="utf-8":o[l]===isoSentinel&&(s="iso-8859-1"),n=l,l=o.length);for(l=0;l<o.length;++l)if(l!==n){var d,c,p=o[l],u=p.indexOf("]="),y=-1===u?p.indexOf("="):u+1;if(-1===y?(d=t.decoder(p,defaults.decoder,s,"key"),c=t.strictNullHandling?null:""):null!==(d=t.decoder(p.slice(0,y),defaults.decoder,s,"key"))&&(c=utils.maybeMap(parseArrayValue(p.slice(y+1),t,isArray(r[d])?r[d].length:0),function(e){return t.decoder(e,defaults.decoder,s,"value")})),c&&t.interpretNumericEntities&&"iso-8859-1"===s&&(c=interpretNumericEntities(String(c))),p.indexOf("[]=")>-1&&(c=isArray(c)?[c]:c),t.comma&&isArray(c)&&c.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");c=utils.combine([],c,t.arrayLimit,t.plainObjects)}if(null!==d){var f=has.call(r,d);f&&("combine"===t.duplicates||p.indexOf("[]=")>-1)?r[d]=utils.combine(r[d],c,t.arrayLimit,t.plainObjects):f&&"last"!==t.duplicates||(r[d]=c)}}return r},parseObject=function(e,t,r,i){var a=0;if(e.length>0&&"[]"===e[e.length-1]){var o=e.slice(0,-1).join("");a=Array.isArray(t)&&t[o]?t[o].length:0}for(var l=i?t:parseArrayValue(t,r,a),n=e.length-1;n>=0;--n){var s,d=e[n];if("[]"===d&&r.parseArrays)s=utils.isOverflow(l)?l:r.allowEmptyArrays&&(""===l||r.strictNullHandling&&null===l)?[]:utils.combine([],l,r.arrayLimit,r.plainObjects);else{s=r.plainObjects?{__proto__:null}:{};var c="["===d.charAt(0)&&"]"===d.charAt(d.length-1)?d.slice(1,-1):d,p=r.decodeDotInKeys?c.replace(/%2E/g,"."):c,u=parseInt(p,10),y=!isNaN(u)&&d!==p&&String(u)===p&&u>=0&&r.parseArrays;if(r.parseArrays||""!==p)if(y&&u<r.arrayLimit)(s=[])[u]=l;else{if(y&&r.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+r.arrayLimit+" element"+(1===r.arrayLimit?"":"s")+" allowed in an array.");y?(s[u]=l,utils.markOverflow(s,u)):"__proto__"!==p&&(s[p]=l)}else s={0:l}}l=s}return l},splitKeyIntoSegments=function splitKeyIntoSegments(e,t){var r=t.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(t.depth<=0){if(!t.plainObjects&&has.call(Object.prototype,r)&&!t.allowPrototypes)return;return[r]}var i=[],a=r.indexOf("["),o=a>=0?r.slice(0,a):r;if(o){if(!t.plainObjects&&has.call(Object.prototype,o)&&!t.allowPrototypes)return;i[i.length]=o}for(var l=r.length,n=a,s=0;n>=0&&s<t.depth;){for(var d=1,c=n+1,p=-1;c<l&&p<0;){var u=r.charCodeAt(c);91===u?d+=1:93===u&&0==(d-=1)&&(p=c),c+=1}if(p<0)return i[i.length]="["+r.slice(n)+"]",i;var y=r.slice(n,p+1),f=y.slice(1,-1);if(!t.plainObjects&&has.call(Object.prototype,f)&&!t.allowPrototypes)return;i[i.length]=y,s+=1,n=r.indexOf("[",p+1)}if(n>=0){if(!0===t.strictDepth)throw new RangeError("Input depth exceeded depth option of "+t.depth+" and strictDepth is true");i[i.length]="["+r.slice(n)+"]"}return i},parseKeys=function parseQueryStringKeys(e,t,r,i){if(e){var a=splitKeyIntoSegments(e,r);if(a)return parseObject(a,t,r,i)}},normalizeParseOptions=function normalizeParseOptions(e){if(!e)return defaults;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(void 0!==e.throwOnLimitExceeded&&"boolean"!=typeof e.throwOnLimitExceeded)throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var t=void 0===e.charset?defaults.charset:e.charset,r=void 0===e.duplicates?defaults.duplicates:e.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||defaults.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:defaults.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:defaults.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:defaults.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:defaults.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:defaults.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:defaults.decoder,delimiter:"string"==typeof e.delimiter||utils.isRegExp(e.delimiter)?e.delimiter:defaults.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:defaults.depth,duplicates:r,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:defaults.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:defaults.plainObjects,strictDepth:"boolean"==typeof e.strictDepth?!!e.strictDepth:defaults.strictDepth,strictMerge:"boolean"==typeof e.strictMerge?!!e.strictMerge:defaults.strictMerge,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof e.throwOnLimitExceeded&&e.throwOnLimitExceeded}};module.exports=function(e,t){var r=normalizeParseOptions(t);if(""===e||null==e)return r.plainObjects?{__proto__:null}:{};for(var i="string"==typeof e?parseValues(e,r):e,a=r.plainObjects?{__proto__:null}:{},o=Object.keys(i),l=0;l<o.length;++l){var n=o[l],s=parseKeys(n,i[n],r,"string"==typeof e);a=utils.merge(a,s,r)}return!0===r.allowSparse?a:utils.compact(a)};
8
+ "use strict";var utils=require(5),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,defaults={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:utils.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},parseArrayValue=function(e,t,r){if(e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1){if(t.throwOnLimitExceeded)for(var i=0,a=e.indexOf(",");a>-1;){if((i+=1)>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");a=e.indexOf(",",a+1)}return e.split(",")}if(t.throwOnLimitExceeded&&r>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function parseQueryStringValues(e,t){var r={__proto__:null},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var a=t.parameterLimit===1/0?void 0:t.parameterLimit,o=i.split(t.delimiter,t.throwOnLimitExceeded&&void 0!==a?a+1:a);if(t.throwOnLimitExceeded&&void 0!==a&&o.length>a)throw new RangeError("Parameter limit exceeded. Only "+a+" parameter"+(1===a?"":"s")+" allowed.");var l,n=-1,s=t.charset;if(t.charsetSentinel)for(l=0;l<o.length;++l)0===o[l].indexOf("utf8=")&&(o[l]===charsetSentinel?s="utf-8":o[l]===isoSentinel&&(s="iso-8859-1"),n=l,l=o.length);for(l=0;l<o.length;++l)if(l!==n){var d,c,p=o[l],u=p.indexOf("]="),y=-1===u?p.indexOf("="):u+1;if(-1===y?(d=t.decoder(p,defaults.decoder,s,"key"),c=t.strictNullHandling?null:""):null!==(d=t.decoder(p.slice(0,y),defaults.decoder,s,"key"))&&(c=utils.maybeMap(parseArrayValue(p.slice(y+1),t,isArray(r[d])?r[d].length:0),function(e){return t.decoder(e,defaults.decoder,s,"value")})),c&&t.interpretNumericEntities&&"iso-8859-1"===s&&(c=interpretNumericEntities(String(c))),p.indexOf("[]=")>-1&&(c=isArray(c)?[c]:c),t.comma&&isArray(c)&&c.length>t.arrayLimit&&(c=utils.combine([],c,t.arrayLimit,t.plainObjects,t.throwOnLimitExceeded)),null!==d){var f=has.call(r,d);f&&("combine"===t.duplicates||p.indexOf("[]=")>-1)?r[d]=utils.combine(r[d],c,t.arrayLimit,t.plainObjects,t.throwOnLimitExceeded):f&&"last"!==t.duplicates||(r[d]=c)}}return r},parseObject=function(e,t,r,i){var a=0;if(e.length>0&&"[]"===e[e.length-1]){var o=e.slice(0,-1).join("");a=Array.isArray(t)&&t[o]?t[o].length:0}for(var l=i?t:parseArrayValue(t,r,a),n=e.length-1;n>=0;--n){var s,d=e[n];if("[]"===d&&r.parseArrays)s=utils.isOverflow(l)?l:r.allowEmptyArrays&&(""===l||r.strictNullHandling&&null===l)?[]:utils.combine([],l,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded);else{s=r.plainObjects?{__proto__:null}:{};var c="["===d.charAt(0)&&"]"===d.charAt(d.length-1)?d.slice(1,-1):d,p=r.decodeDotInKeys?c.replace(/%2E/g,"."):c,u=parseInt(p,10),y=!isNaN(u)&&d!==p&&String(u)===p&&u>=0&&r.parseArrays;if(r.parseArrays||""!==p)if(y&&u<r.arrayLimit)(s=[])[u]=l;else{if(y&&r.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+r.arrayLimit+" element"+(1===r.arrayLimit?"":"s")+" allowed in an array.");y?(s[u]=l,utils.markOverflow(s,u)):"__proto__"!==p&&(s[p]=l)}else s={0:l}}l=s}return l},splitKeyIntoSegments=function splitKeyIntoSegments(e,t){var r=t.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(t.depth<=0){if(!t.plainObjects&&has.call(Object.prototype,r)&&!t.allowPrototypes)return;return[r]}var i=[],a=r.indexOf("["),o=a>=0?r.slice(0,a):r;if(o){if(!t.plainObjects&&has.call(Object.prototype,o)&&!t.allowPrototypes)return;i[i.length]=o}for(var l=r.length,n=a,s=0;n>=0&&s<t.depth;){for(var d=1,c=n+1,p=-1;c<l&&p<0;){var u=r.charCodeAt(c);91===u?d+=1:93===u&&0==(d-=1)&&(p=c),c+=1}if(p<0)return i[i.length]="["+r.slice(n)+"]",i;var y=r.slice(n,p+1),f=y.slice(1,-1);if(!t.plainObjects&&has.call(Object.prototype,f)&&!t.allowPrototypes)return;i[i.length]=y,s+=1,n=r.indexOf("[",p+1)}if(n>=0){if(!0===t.strictDepth)throw new RangeError("Input depth exceeded depth option of "+t.depth+" and strictDepth is true");i[i.length]="["+r.slice(n)+"]"}return i},parseKeys=function parseQueryStringKeys(e,t,r,i){if(e){var a=splitKeyIntoSegments(e,r);if(a)return parseObject(a,t,r,i)}},normalizeParseOptions=function normalizeParseOptions(e){if(!e)return defaults;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(void 0!==e.throwOnLimitExceeded&&"boolean"!=typeof e.throwOnLimitExceeded)throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var t=void 0===e.charset?defaults.charset:e.charset,r=void 0===e.duplicates?defaults.duplicates:e.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||defaults.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:defaults.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:defaults.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:defaults.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:defaults.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:defaults.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:defaults.decoder,delimiter:"string"==typeof e.delimiter||utils.isRegExp(e.delimiter)?e.delimiter:defaults.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:defaults.depth,duplicates:r,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:defaults.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:defaults.plainObjects,strictDepth:"boolean"==typeof e.strictDepth?!!e.strictDepth:defaults.strictDepth,strictMerge:"boolean"==typeof e.strictMerge?!!e.strictMerge:defaults.strictMerge,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof e.throwOnLimitExceeded&&e.throwOnLimitExceeded}};module.exports=function(e,t){var r=normalizeParseOptions(t);if(""===e||null==e)return r.plainObjects?{__proto__:null}:{};for(var i="string"==typeof e?parseValues(e,r):e,a=r.plainObjects?{__proto__:null}:{},o=Object.keys(i),l=0;l<o.length;++l){var n=o[l],s=parseKeys(n,i[n],r,"string"==typeof e);a=utils.merge(a,s,r)}return!0===r.allowSparse?a:utils.compact(a)};
9
9
 
10
10
  },{"5":5}],4:[function(require,module,exports){
11
- "use strict";var getSideChannel=require(46),utils=require(5),formats=require(1),has=Object.prototype.hasOwnProperty,arrayPrefixGenerators={brackets:function brackets(e){return e+"[]"},comma:"comma",indices:function indices(e,r){return e+"["+r+"]"},repeat:function repeat(e){return e}},isArray=Array.isArray,push=Array.prototype.push,pushToArray=function(e,r){push.apply(e,isArray(r)?r:[r])},toISO=Date.prototype.toISOString,defaultFormat=formats.default,defaults={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:utils.encode,encodeValuesOnly:!1,filter:void 0,format:defaultFormat,formatter:formats.formatters[defaultFormat],indices:!1,serializeDate:function serializeDate(e){return toISO.call(e)},skipNulls:!1,strictNullHandling:!1},isNonNullishPrimitive=function isNonNullishPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e},sentinel={},stringify=function stringify(e,r,t,o,a,n,i,l,s,f,u,d,y,c,p,m,h,v){for(var g=e,w=v,b=0,A=!1;void 0!==(w=w.get(sentinel))&&!A;){var D=w.get(e);if(b+=1,void 0!==D){if(D===b)throw new RangeError("Cyclic object value");A=!0}void 0===w.get(sentinel)&&(b=0)}if("function"==typeof f?g=f(r,g):g instanceof Date?g=y(g):"comma"===t&&isArray(g)&&(g=utils.maybeMap(g,function(e){return e instanceof Date?y(e):e})),null===g){if(n)return p(s&&!m?s(r,defaults.encoder,h,"key",c):r);g=""}if(isNonNullishPrimitive(g)||utils.isBuffer(g))return s?[p(m?r:s(r,defaults.encoder,h,"key",c))+"="+p(s(g,defaults.encoder,h,"value",c))]:[p(r)+"="+p(String(g))];var S,E=[];if(void 0===g)return E;if("comma"===t&&isArray(g))m&&s&&(g=utils.maybeMap(g,function(e){return null==e?e:s(e)})),S=[{value:g.length>0?g.join(",")||null:void 0}];else if(isArray(f))S=f;else{var N=Object.keys(g);S=u?N.sort(u):N}var T=l?String(r).replace(/\./g,"%2E"):String(r),O=o&&isArray(g)&&1===g.length?T+"[]":T;if(a&&isArray(g)&&0===g.length)return O+"[]";for(var k=0;k<S.length;++k){var I=S[k],P="object"==typeof I&&I&&void 0!==I.value?I.value:g[I];if(!i||null!==P){var x=d&&l?String(I).replace(/\./g,"%2E"):String(I),z=isArray(g)?"function"==typeof t?t(O,x):O:O+(d?"."+x:"["+x+"]");v.set(e,b);var K=getSideChannel();K.set(sentinel,v),pushToArray(E,stringify(P,z,t,o,a,n,i,l,"comma"===t&&m&&isArray(g)?null:s,f,u,d,y,c,p,m,h,K))}}return E},normalizeStringifyOptions=function normalizeStringifyOptions(e){if(!e)return defaults;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var r=e.charset||defaults.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=formats.default;if(void 0!==e.format){if(!has.call(formats.formatters,e.format))throw new TypeError("Unknown format option provided.");t=e.format}var o,a=formats.formatters[t],n=defaults.filter;if(("function"==typeof e.filter||isArray(e.filter))&&(n=e.filter),o=e.arrayFormat in arrayPrefixGenerators?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":defaults.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var i=void 0===e.allowDots?!0===e.encodeDotInKeys||defaults.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:defaults.addQueryPrefix,allowDots:i,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?defaults.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:defaults.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:defaults.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:defaults.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:defaults.encodeValuesOnly,filter:n,format:t,formatter:a,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:defaults.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:defaults.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling}};module.exports=function(e,r){var t,o=e,a=normalizeStringifyOptions(r);"function"==typeof a.filter?o=(0,a.filter)("",o):isArray(a.filter)&&(t=a.filter);var n=[];if("object"!=typeof o||null===o)return"";var i=arrayPrefixGenerators[a.arrayFormat],l="comma"===i&&a.commaRoundTrip;t||(t=Object.keys(o)),a.sort&&t.sort(a.sort);for(var s=getSideChannel(),f=0;f<t.length;++f){var u=t[f];if(null!=u){var d=o[u];a.skipNulls&&null===d||pushToArray(n,stringify(d,u,i,l,a.allowEmptyArrays,a.strictNullHandling,a.skipNulls,a.encodeDotInKeys,a.encode?a.encoder:null,a.filter,a.sort,a.allowDots,a.serializeDate,a.format,a.formatter,a.encodeValuesOnly,a.charset,s))}}var y=n.join(a.delimiter),c=!0===a.addQueryPrefix?"?":"";return a.charsetSentinel&&("iso-8859-1"===a.charset?c+="utf8=%26%2310003%3B"+a.delimiter:c+="utf8=%E2%9C%93"+a.delimiter),y.length>0?c+y:""};
11
+ "use strict";var getSideChannel=require(46),utils=require(5),formats=require(1),has=Object.prototype.hasOwnProperty,arrayPrefixGenerators={brackets:function brackets(e){return e+"[]"},comma:"comma",indices:function indices(e,r){return e+"["+r+"]"},repeat:function repeat(e){return e}},isArray=Array.isArray,push=Array.prototype.push,pushToArray=function(e,r){push.apply(e,isArray(r)?r:[r])},toISO=Date.prototype.toISOString,defaultFormat=formats.default,defaults={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",depth:1/0,encode:!0,encodeDotInKeys:!1,encoder:utils.encode,encodeValuesOnly:!1,filter:void 0,format:defaultFormat,formatter:formats.formatters[defaultFormat],indices:!1,serializeDate:function serializeDate(e){return toISO.call(e)},skipNulls:!1,strictNullHandling:!1},isNonNullishPrimitive=function isNonNullishPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e},sentinel={},stringify=function stringify(e,r,t,o,n,a,i,l,s,f,u,d,y,c,p,m,h,v,g,w){var b=e;if(w>g)throw new RangeError("Input depth exceeded depth option of "+g);for(var D=v,A=0,S=!1;void 0!==(D=D.get(sentinel))&&!S;){var E=D.get(e);if(A+=1,void 0!==E){if(E===A)throw new RangeError("Cyclic object value");S=!0}void 0===D.get(sentinel)&&(A=0)}if((b="function"==typeof f?f(r,b):b)instanceof Date?b=y(b):"comma"===t&&isArray(b)&&(b=utils.maybeMap(b,function(e){return e instanceof Date?y(e):e})),null===b){if(a)return p(s&&!m?s(r,defaults.encoder,h,"key",c):r);b=""}if(isNonNullishPrimitive(b)||utils.isBuffer(b))return s?[p(m?r:s(r,defaults.encoder,h,"key",c))+"="+p(s(b,defaults.encoder,h,"value",c))]:[p(r)+"="+p(String(b))];var N,O=[];if(void 0===b)return O;if("comma"===t&&isArray(b))m&&s&&(b=utils.maybeMap(b,function(e){return null==e?e:s(e)})),N=[{value:b.length>0?b.join(",")||null:void 0}];else if(isArray(f))N=f;else{var T=Object.keys(b);N=u?T.sort(u):T}var k=l?String(r).replace(/\./g,"%2E"):String(r),I=o&&isArray(b)&&1===b.length?k+"[]":k;if(n&&isArray(b)&&0===b.length&&0===Object.keys(b).length)return I+"[]";for(var P=0;P<N.length;++P){var x=N[P],K="object"==typeof x&&x&&void 0!==x.value?x.value:b[x];if(!i||null!==K){var z=d&&l?String(x).replace(/\./g,"%2E"):String(x),j=isArray(b)?"function"==typeof t?t(I,z):I:I+(d?"."+z:"["+z+"]");v.set(e,A);var F=getSideChannel();F.set(sentinel,v),pushToArray(O,stringify(K,j,t,o,n,a,i,l,"comma"===t&&m&&isArray(b)?null:s,f,u,d,y,c,p,m,h,F,g,w+1))}}return O},normalizeStringifyOptions=function normalizeStringifyOptions(e){if(!e)return defaults;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var r=e.charset||defaults.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=formats.default;if(void 0!==e.format){if(!has.call(formats.formatters,e.format))throw new TypeError("Unknown format option provided.");t=e.format}var o,n=formats.formatters[t],a=defaults.filter;if(("function"==typeof e.filter||isArray(e.filter))&&(a=e.filter),o=e.arrayFormat in arrayPrefixGenerators?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":defaults.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var i=void 0===e.allowDots?!0===e.encodeDotInKeys||defaults.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:defaults.addQueryPrefix,allowDots:i,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?defaults.delimiter:e.delimiter,depth:"number"==typeof e.depth?e.depth:defaults.depth,encode:"boolean"==typeof e.encode?e.encode:defaults.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:defaults.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:defaults.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:defaults.encodeValuesOnly,filter:a,format:t,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:defaults.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:defaults.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling}};module.exports=function(e,r){var t,o=e,n=normalizeStringifyOptions(r);"function"==typeof n.filter?o=(0,n.filter)("",o):isArray(n.filter)&&(t=n.filter);var a=[];if("object"!=typeof o||null===o)return"";var i=arrayPrefixGenerators[n.arrayFormat],l="comma"===i&&n.commaRoundTrip;t||(t=Object.keys(o)),n.sort&&t.sort(n.sort);for(var s=getSideChannel(),f=0;f<t.length;++f){var u=t[f];if(null!=u){var d=o[u];if(!n.skipNulls||null!==d){var y=n.encodeDotInKeys?String(u).replace(/\./g,"%2E"):String(u);pushToArray(a,stringify(d,y,i,l,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,s,n.depth,0))}}}var c=a.join(n.delimiter),p=!0===n.addQueryPrefix?"?":"";return n.charsetSentinel&&("iso-8859-1"===n.charset?p+="utf8=%26%2310003%3B"+n.delimiter:p+="utf8=%E2%9C%93"+n.delimiter),c.length>0?p+c:""};
12
12
 
13
13
  },{"1":1,"46":46,"5":5}],5:[function(require,module,exports){
14
- "use strict";var formats=require(1),getSideChannel=require(46),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,overflowChannel=getSideChannel(),markOverflow=function markOverflow(e,r){return overflowChannel.set(e,r),e},isOverflow=function isOverflow(e){return overflowChannel.has(e)},getMaxIndex=function getMaxIndex(e){return overflowChannel.get(e)},setMaxIndex=function setMaxIndex(e,r){overflowChannel.set(e,r)},hexTable=function(){for(var e=[],r=0;r<256;++r)e[e.length]="%"+((r<16?"0":"")+r.toString(16)).toUpperCase();return e}(),compactQueue=function compactQueue(e){for(;e.length>1;){var r=e.pop(),t=r.obj[r.prop];if(isArray(t)){for(var n=[],o=0;o<t.length;++o)void 0!==t[o]&&(n[n.length]=t[o]);r.obj[r.prop]=n}}},arrayToObject=function arrayToObject(e,r){for(var t=r&&r.plainObjects?{__proto__:null}:{},n=0;n<e.length;++n)void 0!==e[n]&&(t[n]=e[n]);return t},merge=function merge(e,r,t){if(!r)return e;if("object"!=typeof r&&"function"!=typeof r){if(isArray(e)){var n=e.length;if(t&&"number"==typeof t.arrayLimit&&n>t.arrayLimit)return markOverflow(arrayToObject(e.concat(r),t),n);e[n]=r}else{if(!e||"object"!=typeof e)return[e,r];if(isOverflow(e)){var o=getMaxIndex(e)+1;e[o]=r,setMaxIndex(e,o)}else{if(t&&t.strictMerge)return[e,r];(t&&(t.plainObjects||t.allowPrototypes)||!has.call(Object.prototype,r))&&(e[r]=!0)}}return e}if(!e||"object"!=typeof e){if(isOverflow(r)){for(var a=Object.keys(r),i=t&&t.plainObjects?{__proto__:null,0:e}:{0:e},c=0;c<a.length;c++)i[parseInt(a[c],10)+1]=r[a[c]];return markOverflow(i,getMaxIndex(r)+1)}var l=[e].concat(r);return t&&"number"==typeof t.arrayLimit&&l.length>t.arrayLimit?markOverflow(arrayToObject(l,t),l.length-1):l}var f=e;return isArray(e)&&!isArray(r)&&(f=arrayToObject(e,t)),isArray(e)&&isArray(r)?(r.forEach(function(r,n){if(has.call(e,n)){var o=e[n];o&&"object"==typeof o&&r&&"object"==typeof r?e[n]=merge(o,r,t):e[e.length]=r}else e[n]=r}),e):Object.keys(r).reduce(function(e,n){var o=r[n];if(has.call(e,n)?e[n]=merge(e[n],o,t):e[n]=o,isOverflow(r)&&!isOverflow(e)&&markOverflow(e,getMaxIndex(r)),isOverflow(e)){var a=parseInt(n,10);String(a)===n&&a>=0&&a>getMaxIndex(e)&&setMaxIndex(e,a)}return e},f)},assign=function assignSingleSource(e,r){return Object.keys(r).reduce(function(e,t){return e[t]=r[t],e},e)},decode=function(e,r,t){var n=e.replace(/\+/g," ");if("iso-8859-1"===t)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},limit=1024,encode=function encode(e,r,t,n,o){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===t)return escape(a).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var i="",c=0;c<a.length;c+=limit){for(var l=a.length>=limit?a.slice(c,c+limit):a,f=[],s=0;s<l.length;++s){var u=l.charCodeAt(s);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||o===formats.RFC1738&&(40===u||41===u)?f[f.length]=l.charAt(s):u<128?f[f.length]=hexTable[u]:u<2048?f[f.length]=hexTable[192|u>>6]+hexTable[128|63&u]:u<55296||u>=57344?f[f.length]=hexTable[224|u>>12]+hexTable[128|u>>6&63]+hexTable[128|63&u]:(s+=1,u=65536+((1023&u)<<10|1023&l.charCodeAt(s)),f[f.length]=hexTable[240|u>>18]+hexTable[128|u>>12&63]+hexTable[128|u>>6&63]+hexTable[128|63&u])}i+=f.join("")}return i},compact=function compact(e){for(var r=[{obj:{o:e},prop:"o"}],t=[],n=0;n<r.length;++n)for(var o=r[n],a=o.obj[o.prop],i=Object.keys(a),c=0;c<i.length;++c){var l=i[c],f=a[l];"object"==typeof f&&null!==f&&-1===t.indexOf(f)&&(r[r.length]={obj:a,prop:l},t[t.length]=f)}return compactQueue(r),e},isRegExp=function isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)},isBuffer=function isBuffer(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},combine=function combine(e,r,t,n){if(isOverflow(e)){var o=getMaxIndex(e)+1;return e[o]=r,setMaxIndex(e,o),e}var a=[].concat(e,r);return a.length>t?markOverflow(arrayToObject(a,{plainObjects:n}),a.length-1):a},maybeMap=function maybeMap(e,r){if(isArray(e)){for(var t=[],n=0;n<e.length;n+=1)t[t.length]=r(e[n]);return t}return r(e)};module.exports={/* common-shake removed: arrayToObject:arrayToObject *//* common-shake removed: assign:assign */combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isOverflow:isOverflow,isRegExp:isRegExp,markOverflow:markOverflow,maybeMap:maybeMap,merge:merge};
14
+ "use strict";var formats=require(1),getSideChannel=require(46),defineProperty=require(14),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,overflowChannel=getSideChannel(),markOverflow=function markOverflow(e,r){return overflowChannel.set(e,r),e},isOverflow=function isOverflow(e){return overflowChannel.has(e)},getMaxIndex=function getMaxIndex(e){return overflowChannel.get(e)},setMaxIndex=function setMaxIndex(e,r){overflowChannel.set(e,r)},hexTable=function(){for(var e=[],r=0;r<256;++r)e[e.length]="%"+((r<16?"0":"")+r.toString(16)).toUpperCase();return e}(),compactQueue=function compactQueue(e){for(;e.length>1;){var r=e.pop(),t=r.obj[r.prop];if(isArray(t)){for(var n=[],a=0;a<t.length;++a)void 0!==t[a]&&(n[n.length]=t[a]);r.obj[r.prop]=n}}},arrayToObject=function arrayToObject(e,r){for(var t=r&&r.plainObjects?{__proto__:null}:{},n=0;n<e.length;++n)void 0!==e[n]&&(t[n]=e[n]);return t},setProperty=function setProperty(e,r,t){"__proto__"===r&&defineProperty?defineProperty(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t},merge=function merge(e,r,t){if(!r)return e;if("object"!=typeof r&&"function"!=typeof r){if(isArray(e)){var n=e.length;if(t&&"number"==typeof t.arrayLimit&&n>=t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(e.concat(r),t),n)}e[n]=r}else{if(!e||"object"!=typeof e)return[e,r];if(isOverflow(e)){var a=getMaxIndex(e)+1;e[a]=r,setMaxIndex(e,a)}else{if(t&&t.strictMerge)return[e,r];(t&&(t.plainObjects||t.allowPrototypes)||!has.call(Object.prototype,r))&&(e[r]=!0)}}return e}if(!e||"object"!=typeof e){if(isOverflow(r)){for(var o=Object.keys(r),i=t&&t.plainObjects?{__proto__:null,0:e}:{0:e},l=0;l<o.length;l++)i[parseInt(o[l],10)+1]=r[o[l]];return markOverflow(i,getMaxIndex(r)+1)}var c=[e].concat(r);if(t&&"number"==typeof t.arrayLimit&&c.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(c,t),c.length-1)}return c}var f=e;if(isArray(e)&&!isArray(r)&&(f=arrayToObject(e,t)),isArray(e)&&isArray(r)){if(r.forEach(function(r,n){if(has.call(e,n)){var a=e[n];a&&"object"==typeof a&&r&&"object"==typeof r?e[n]=merge(a,r,t):e[e.length]=r}else e[n]=r}),t&&"number"==typeof t.arrayLimit&&e.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(e,t),e.length-1)}return e}return Object.keys(r).reduce(function(e,n){var a=r[n];if(has.call(e,n)?setProperty(e,n,merge(e[n],a,t)):setProperty(e,n,a),isOverflow(r)&&!isOverflow(e)&&markOverflow(e,getMaxIndex(r)),isOverflow(e)){var o=parseInt(n,10);String(o)===n&&o>=0&&o>getMaxIndex(e)&&setMaxIndex(e,o)}return e},f)},assign=function assignSingleSource(e,r){return Object.keys(r).reduce(function(e,t){return setProperty(e,t,r[t]),e},e)},decode=function(e,r,t){var n=e.replace(/\+/g," ");if("iso-8859-1"===t)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},limit=1024,encode=function encode(e,r,t,n,a){if(0===e.length)return e;var o=e;if("symbol"==typeof e?o=Symbol.prototype.toString.call(e):"string"!=typeof e&&(o=String(e)),"iso-8859-1"===t)return escape(o).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var i="",l=0;l<o.length;l+=limit){var c=o.length>=limit?o.slice(l,l+limit):o;if(l+limit<o.length){var f=c.charCodeAt(c.length-1);f>=55296&&f<=56319&&(c=c.slice(0,-1),l-=1)}for(var s=[],u=0;u<c.length;++u){var y=c.charCodeAt(u);45===y||46===y||95===y||126===y||y>=48&&y<=57||y>=65&&y<=90||y>=97&&y<=122||a===formats.RFC1738&&(40===y||41===y)?s[s.length]=c.charAt(u):y<128?s[s.length]=hexTable[y]:y<2048?s[s.length]=hexTable[192|y>>6]+hexTable[128|63&y]:y<55296||y>=57344?s[s.length]=hexTable[224|y>>12]+hexTable[128|y>>6&63]+hexTable[128|63&y]:(u+=1,y=65536+((1023&y)<<10|1023&c.charCodeAt(u)),s[s.length]=hexTable[240|y>>18]+hexTable[128|y>>12&63]+hexTable[128|y>>6&63]+hexTable[128|63&y])}i+=s.join("")}return i},compact=function compact(e){for(var r=[{obj:{o:e},prop:"o"}],t=getSideChannel(),n=0;n<r.length;++n)for(var a=r[n],o=a.obj[a.prop],i=Object.keys(o),l=0;l<i.length;++l){var c=i[l],f=o[c];"object"!=typeof f||null===f||t.has(f)||(r[r.length]={obj:o,prop:c},t.set(f,!0))}return compactQueue(r),e},isRegExp=function isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)},isBuffer=function isBuffer(e){return!(!e||"object"!=typeof e||!e.constructor||"function"!=typeof e.constructor.isBuffer||!e.constructor.isBuffer(e))},combine=function combine(e,r,t,n,a){if(isOverflow(e)){if(a)throw new RangeError("Array limit exceeded. Only "+t+" element"+(1===t?"":"s")+" allowed in an array.");for(var o=isArray(r)?r:[r],i=getMaxIndex(e),l=0;l<o.length;++l)e[i+=1]=o[l];return setMaxIndex(e,i),e}var c=[].concat(e,r);if(c.length>t){if(a)throw new RangeError("Array limit exceeded. Only "+t+" element"+(1===t?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(c,{plainObjects:n}),c.length-1)}return c},maybeMap=function maybeMap(e,r){if(isArray(e)){for(var t=[],n=0;n<e.length;n+=1)t[t.length]=r(e[n]);return t}return r(e)};module.exports={/* common-shake removed: arrayToObject:arrayToObject *//* common-shake removed: assign:assign */combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isOverflow:isOverflow,isRegExp:isRegExp,markOverflow:markOverflow,maybeMap:maybeMap,merge:merge};
15
15
 
16
- },{"1":1,"46":46}],46:[function(require,module,exports){
17
- "use strict";var $TypeError=require(20),inspect=require(42),getSideChannelList=require(43),getSideChannelMap=require(44),getSideChannelWeakMap=require(45),makeChannel=getSideChannelWeakMap||getSideChannelMap||getSideChannelList;module.exports=function getSideChannel(){var e,n={assert:function(e){if(!n.has(e))throw new $TypeError("Side channel does not contain "+inspect(e))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,t){e||(e=makeChannel()),e.set(n,t)}};return n};
16
+ },{"1":1,"14":14,"46":46}],46:[function(require,module,exports){
17
+ "use strict";var $TypeError=require(20),inspect=require(42),getSideChannelList=require(43),getSideChannelMap=require(44),getSideChannelWeakMap=require(45),makeChannel=getSideChannelWeakMap||getSideChannelMap||getSideChannelList;module.exports=function getSideChannel(){var e,n={assert:function(e){if(!n.has(e)){var t=e&&Object(e)===e?"the given object key":inspect(e);throw new $TypeError("Side channel does not contain "+t)}},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,t){e||(e=makeChannel()),e.set(n,t)}};return n};
18
18
 
19
- },{"20":20,"42":42,"43":43,"44":44,"45":45}],6:[function(require,module,exports){
19
+ },{"20":20,"42":42,"43":43,"44":44,"45":45}],14:[function(require,module,exports){
20
+ "use strict";var $defineProperty=Object.defineProperty||!1;if($defineProperty)try{$defineProperty({},"a",{value:1})}catch(e){$defineProperty=!1}module.exports=$defineProperty;
21
+
22
+ },{}],6:[function(require,module,exports){
20
23
 
21
24
  },{}],7:[function(require,module,exports){
22
25
  "use strict";var bind=require(24),$apply=require(8),$call=require(9),$reflectApply=require(11);module.exports=$reflectApply||bind.call($call,$apply);
23
26
 
24
- },{"11":11,"24":24,"8":8,"9":9}],9:[function(require,module,exports){
25
- "use strict";module.exports=Function.prototype.call;
26
-
27
- },{}],8:[function(require,module,exports){
27
+ },{"11":11,"24":24,"8":8,"9":9}],8:[function(require,module,exports){
28
28
  "use strict";module.exports=Function.prototype.apply;
29
29
 
30
+ },{}],9:[function(require,module,exports){
31
+ "use strict";module.exports=Function.prototype.call;
32
+
30
33
  },{}],24:[function(require,module,exports){
31
34
  "use strict";var implementation=require(23);module.exports=Function.prototype.bind||implementation;
32
35
 
@@ -51,10 +54,7 @@
51
54
  },{"10":10,"30":30}],30:[function(require,module,exports){
52
55
  "use strict";var $gOPD=require(29);if($gOPD)try{$gOPD([],"length")}catch(g){$gOPD=null}module.exports=$gOPD;
53
56
 
54
- },{"29":29}],14:[function(require,module,exports){
55
- "use strict";var $defineProperty=Object.defineProperty||!1;if($defineProperty)try{$defineProperty({},"a",{value:1})}catch(e){$defineProperty=!1}module.exports=$defineProperty;
56
-
57
- },{}],15:[function(require,module,exports){
57
+ },{"29":29}],15:[function(require,module,exports){
58
58
  "use strict";module.exports=EvalError;
59
59
 
60
60
  },{}],16:[function(require,module,exports){
@@ -84,31 +84,31 @@
84
84
  },{}],34:[function(require,module,exports){
85
85
  "use strict";module.exports=Math.abs;
86
86
 
87
- },{}],38:[function(require,module,exports){
88
- "use strict";module.exports=Math.min;
89
-
90
- },{}],40:[function(require,module,exports){
91
- "use strict";module.exports=Math.round;
92
-
93
87
  },{}],37:[function(require,module,exports){
94
88
  "use strict";module.exports=Math.max;
95
89
 
96
90
  },{}],39:[function(require,module,exports){
97
91
  "use strict";module.exports=Math.pow;
98
92
 
93
+ },{}],40:[function(require,module,exports){
94
+ "use strict";module.exports=Math.round;
95
+
96
+ },{}],38:[function(require,module,exports){
97
+ "use strict";module.exports=Math.min;
98
+
99
99
  },{}],27:[function(require,module,exports){
100
100
  "use strict";module.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null;
101
101
 
102
102
  },{}],26:[function(require,module,exports){
103
103
  "use strict";var $Object=require(22);module.exports=$Object.getPrototypeOf||null;
104
104
 
105
- },{"22":22}],33:[function(require,module,exports){
106
- "use strict";var call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind=require(24);module.exports=bind.call(call,$hasOwn);
107
-
108
- },{"24":24}],41:[function(require,module,exports){
105
+ },{"22":22}],41:[function(require,module,exports){
109
106
  "use strict";var $isNaN=require(36);module.exports=function sign(i){return $isNaN(i)||0===i?i:i<0?-1:1};
110
107
 
111
- },{"36":36}],31:[function(require,module,exports){
108
+ },{"36":36}],33:[function(require,module,exports){
109
+ "use strict";var call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind=require(24);module.exports=bind.call(call,$hasOwn);
110
+
111
+ },{"24":24}],31:[function(require,module,exports){
112
112
  "use strict";var origSymbol="undefined"!=typeof Symbol&&Symbol,hasSymbolSham=require(32);module.exports=function hasNativeSymbols(){return"function"==typeof origSymbol&&"function"==typeof Symbol&&"symbol"==typeof origSymbol("foo")&&"symbol"==typeof Symbol("bar")&&hasSymbolSham()};
113
113
 
114
114
  },{"32":32}],28:[function(require,module,exports){
@@ -27,7 +27,7 @@ export default [
27
27
  'error',
28
28
  { max: 150 },
29
29
  ],
30
- 'max-params': ['error', 18],
30
+ 'max-params': ['error', 20],
31
31
  'max-statements': ['error', 100],
32
32
  'multiline-comment-style': 'off',
33
33
  'no-continue': 'warn',
@@ -38,6 +38,17 @@ var interpretNumericEntities = function (str) {
38
38
 
39
39
  var parseArrayValue = function (val, options, currentArrayLength) {
40
40
  if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
41
+ if (options.throwOnLimitExceeded) {
42
+ var commaCount = 0;
43
+ var commaIndex = val.indexOf(',');
44
+ while (commaIndex > -1) {
45
+ commaCount += 1;
46
+ if (commaCount >= options.arrayLimit) {
47
+ throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
48
+ }
49
+ commaIndex = val.indexOf(',', commaIndex + 1);
50
+ }
51
+ }
41
52
  return val.split(',');
42
53
  }
43
54
 
@@ -132,10 +143,7 @@ var parseValues = function parseQueryStringValues(str, options) {
132
143
  }
133
144
 
134
145
  if (options.comma && isArray(val) && val.length > options.arrayLimit) {
135
- if (options.throwOnLimitExceeded) {
136
- throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
137
- }
138
- val = utils.combine([], val, options.arrayLimit, options.plainObjects);
146
+ val = utils.combine([], val, options.arrayLimit, options.plainObjects, options.throwOnLimitExceeded);
139
147
  }
140
148
 
141
149
  if (key !== null) {
@@ -145,7 +153,8 @@ var parseValues = function parseQueryStringValues(str, options) {
145
153
  obj[key],
146
154
  val,
147
155
  options.arrayLimit,
148
- options.plainObjects
156
+ options.plainObjects,
157
+ options.throwOnLimitExceeded
149
158
  );
150
159
  } else if (!existing || options.duplicates === 'last') {
151
160
  obj[key] = val;
@@ -180,7 +189,8 @@ var parseObject = function (chain, val, options, valuesParsed) {
180
189
  [],
181
190
  leaf,
182
191
  options.arrayLimit,
183
- options.plainObjects
192
+ options.plainObjects,
193
+ options.throwOnLimitExceeded
184
194
  );
185
195
  }
186
196
  } else {