@nocobase/plugin-multi-keyword-filter 2.2.17 → 2.2.18

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 (46) hide show
  1. package/dist/client/103.b39ee70786cb13a7.js +10 -0
  2. package/dist/client/index.js +1 -1
  3. package/dist/client-v2/103.dfed67c95bcd8a1d.js +10 -0
  4. package/dist/client-v2/index.js +1 -1
  5. package/dist/externalVersion.js +4 -4
  6. package/dist/node_modules/qs/.editorconfig +4 -1
  7. package/dist/node_modules/qs/.github/SECURITY.md +11 -0
  8. package/dist/node_modules/qs/.github/THREAT_MODEL.md +78 -0
  9. package/dist/node_modules/qs/dist/qs.js +90 -2036
  10. package/dist/node_modules/qs/lib/index.js +1 -1
  11. package/dist/node_modules/qs/lib/parse.js +215 -66
  12. package/dist/node_modules/qs/lib/stringify.js +90 -32
  13. package/dist/node_modules/qs/lib/utils.js +189 -53
  14. package/dist/node_modules/qs/node_modules/es-define-property/.eslintrc +13 -0
  15. package/dist/node_modules/qs/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  16. package/dist/node_modules/qs/node_modules/es-define-property/.nycrc +9 -0
  17. package/dist/node_modules/qs/node_modules/es-define-property/index.d.ts +3 -0
  18. package/dist/node_modules/qs/node_modules/es-define-property/index.js +14 -0
  19. package/dist/node_modules/qs/node_modules/es-define-property/package.json +81 -0
  20. package/dist/node_modules/qs/node_modules/es-define-property/test/index.js +56 -0
  21. package/dist/node_modules/qs/node_modules/side-channel/.editorconfig +9 -0
  22. package/dist/node_modules/qs/node_modules/side-channel/.eslintrc +12 -0
  23. package/dist/node_modules/qs/node_modules/side-channel/.github/FUNDING.yml +12 -0
  24. package/dist/node_modules/qs/node_modules/side-channel/.nycrc +13 -0
  25. package/dist/node_modules/qs/node_modules/side-channel/index.d.ts +14 -0
  26. package/dist/node_modules/qs/node_modules/side-channel/index.js +46 -0
  27. package/dist/node_modules/qs/node_modules/side-channel/package.json +85 -0
  28. package/dist/node_modules/qs/node_modules/side-channel/test/index.js +120 -0
  29. package/dist/node_modules/qs/node_modules/side-channel-list/.editorconfig +9 -0
  30. package/dist/node_modules/qs/node_modules/side-channel-list/.eslintrc +11 -0
  31. package/dist/node_modules/qs/node_modules/side-channel-list/.github/FUNDING.yml +12 -0
  32. package/dist/node_modules/qs/node_modules/side-channel-list/.nycrc +13 -0
  33. package/dist/node_modules/qs/node_modules/side-channel-list/index.d.ts +13 -0
  34. package/dist/node_modules/qs/node_modules/side-channel-list/index.js +111 -0
  35. package/dist/node_modules/qs/node_modules/side-channel-list/list.d.ts +14 -0
  36. package/dist/node_modules/qs/node_modules/side-channel-list/package.json +77 -0
  37. package/dist/node_modules/qs/node_modules/side-channel-list/test/index.js +154 -0
  38. package/dist/node_modules/qs/package.json +1 -1
  39. package/dist/node_modules/qs/test/empty-keys-cases.js +261 -31
  40. package/dist/node_modules/qs/test/parse.js +1281 -57
  41. package/dist/node_modules/qs/test/stringify.js +851 -58
  42. package/dist/node_modules/qs/test/utils.js +505 -3
  43. package/package.json +5 -2
  44. package/dist/client/103.513149b773e262dc.js +0 -10
  45. package/dist/client-v2/103.8bcbf628d0af8457.js +0 -10
  46. package/dist/node_modules/qs/.eslintrc +0 -38
@@ -7,21 +7,27 @@ var isArray = Array.isArray;
7
7
 
8
8
  var defaults = {
9
9
  allowDots: false,
10
+ allowEmptyArrays: false,
10
11
  allowPrototypes: false,
11
12
  allowSparse: false,
12
13
  arrayLimit: 20,
13
14
  charset: 'utf-8',
14
15
  charsetSentinel: false,
15
16
  comma: false,
17
+ decodeDotInKeys: false,
16
18
  decoder: utils.decode,
17
19
  delimiter: '&',
18
20
  depth: 5,
21
+ duplicates: 'combine',
19
22
  ignoreQueryPrefix: false,
20
23
  interpretNumericEntities: false,
21
24
  parameterLimit: 1000,
22
25
  parseArrays: true,
23
26
  plainObjects: false,
24
- strictNullHandling: false
27
+ strictDepth: false,
28
+ strictMerge: true,
29
+ strictNullHandling: false,
30
+ throwOnLimitExceeded: false
25
31
  };
26
32
 
27
33
  var interpretNumericEntities = function (str) {
@@ -30,11 +36,26 @@ var interpretNumericEntities = function (str) {
30
36
  });
31
37
  };
32
38
 
33
- var parseArrayValue = function (val, options) {
39
+ var parseArrayValue = function (val, options, currentArrayLength) {
34
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
+ }
35
52
  return val.split(',');
36
53
  }
37
54
 
55
+ if (options.throwOnLimitExceeded && currentArrayLength >= options.arrayLimit) {
56
+ throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
57
+ }
58
+
38
59
  return val;
39
60
  };
40
61
 
@@ -52,8 +73,18 @@ var parseValues = function parseQueryStringValues(str, options) {
52
73
  var obj = { __proto__: null };
53
74
 
54
75
  var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
55
- var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
56
- var parts = cleanStr.split(options.delimiter, limit);
76
+ cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
77
+
78
+ var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
79
+ var parts = cleanStr.split(
80
+ options.delimiter,
81
+ options.throwOnLimitExceeded && typeof limit !== 'undefined' ? limit + 1 : limit
82
+ );
83
+
84
+ if (options.throwOnLimitExceeded && typeof limit !== 'undefined' && parts.length > limit) {
85
+ throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
86
+ }
87
+
57
88
  var skipIndex = -1; // Keep track of where the utf8 sentinel was found
58
89
  var i;
59
90
 
@@ -81,32 +112,53 @@ var parseValues = function parseQueryStringValues(str, options) {
81
112
  var bracketEqualsPos = part.indexOf(']=');
82
113
  var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
83
114
 
84
- var key, val;
115
+ var key;
116
+ var val;
85
117
  if (pos === -1) {
86
118
  key = options.decoder(part, defaults.decoder, charset, 'key');
87
119
  val = options.strictNullHandling ? null : '';
88
120
  } else {
89
121
  key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
90
- val = utils.maybeMap(
91
- parseArrayValue(part.slice(pos + 1), options),
92
- function (encodedVal) {
93
- return options.decoder(encodedVal, defaults.decoder, charset, 'value');
94
- }
95
- );
122
+
123
+ if (key !== null) {
124
+ val = utils.maybeMap(
125
+ parseArrayValue(
126
+ part.slice(pos + 1),
127
+ options,
128
+ isArray(obj[key]) ? obj[key].length : 0
129
+ ),
130
+ function (encodedVal) {
131
+ return options.decoder(encodedVal, defaults.decoder, charset, 'value');
132
+ }
133
+ );
134
+ }
96
135
  }
97
136
 
98
137
  if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
99
- val = interpretNumericEntities(val);
138
+ val = interpretNumericEntities(String(val));
100
139
  }
101
140
 
102
141
  if (part.indexOf('[]=') > -1) {
103
142
  val = isArray(val) ? [val] : val;
104
143
  }
105
144
 
106
- if (has.call(obj, key)) {
107
- obj[key] = utils.combine(obj[key], val);
108
- } else {
109
- obj[key] = val;
145
+ if (options.comma && isArray(val) && val.length > options.arrayLimit) {
146
+ val = utils.combine([], val, options.arrayLimit, options.plainObjects, options.throwOnLimitExceeded);
147
+ }
148
+
149
+ if (key !== null) {
150
+ var existing = has.call(obj, key);
151
+ if (existing && (options.duplicates === 'combine' || part.indexOf('[]=') > -1)) {
152
+ obj[key] = utils.combine(
153
+ obj[key],
154
+ val,
155
+ options.arrayLimit,
156
+ options.plainObjects,
157
+ options.throwOnLimitExceeded
158
+ );
159
+ } else if (!existing || options.duplicates === 'last') {
160
+ obj[key] = val;
161
+ }
110
162
  }
111
163
  }
112
164
 
@@ -114,31 +166,55 @@ var parseValues = function parseQueryStringValues(str, options) {
114
166
  };
115
167
 
116
168
  var parseObject = function (chain, val, options, valuesParsed) {
117
- var leaf = valuesParsed ? val : parseArrayValue(val, options);
169
+ var currentArrayLength = 0;
170
+ if (chain.length > 0 && chain[chain.length - 1] === '[]') {
171
+ var parentKey = chain.slice(0, -1).join('');
172
+ currentArrayLength = Array.isArray(val) && val[parentKey] ? val[parentKey].length : 0;
173
+ }
174
+
175
+ var leaf = valuesParsed ? val : parseArrayValue(val, options, currentArrayLength);
118
176
 
119
177
  for (var i = chain.length - 1; i >= 0; --i) {
120
178
  var obj;
121
179
  var root = chain[i];
122
180
 
123
181
  if (root === '[]' && options.parseArrays) {
124
- obj = [].concat(leaf);
182
+ if (utils.isOverflow(leaf)) {
183
+ // leaf is already an overflow object, preserve it
184
+ obj = leaf;
185
+ } else {
186
+ obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))
187
+ ? []
188
+ : utils.combine(
189
+ [],
190
+ leaf,
191
+ options.arrayLimit,
192
+ options.plainObjects,
193
+ options.throwOnLimitExceeded
194
+ );
195
+ }
125
196
  } else {
126
- obj = options.plainObjects ? Object.create(null) : {};
197
+ obj = options.plainObjects ? { __proto__: null } : {};
127
198
  var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
128
- var index = parseInt(cleanRoot, 10);
129
- if (!options.parseArrays && cleanRoot === '') {
130
- obj = { 0: leaf };
131
- } else if (
132
- !isNaN(index)
133
- && root !== cleanRoot
134
- && String(index) === cleanRoot
199
+ var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot;
200
+ var index = parseInt(decodedRoot, 10);
201
+ var isValidArrayIndex = !isNaN(index)
202
+ && root !== decodedRoot
203
+ && String(index) === decodedRoot
135
204
  && index >= 0
136
- && (options.parseArrays && index <= options.arrayLimit)
137
- ) {
205
+ && options.parseArrays;
206
+ if (!options.parseArrays && decodedRoot === '') {
207
+ obj = { 0: leaf };
208
+ } else if (isValidArrayIndex && index < options.arrayLimit) {
138
209
  obj = [];
139
210
  obj[index] = leaf;
140
- } else if (cleanRoot !== '__proto__') {
141
- obj[cleanRoot] = leaf;
211
+ } else if (isValidArrayIndex && options.throwOnLimitExceeded) {
212
+ throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
213
+ } else if (isValidArrayIndex) {
214
+ obj[index] = leaf;
215
+ utils.markOverflow(obj, index);
216
+ } else if (decodedRoot !== '__proto__') {
217
+ obj[decodedRoot] = leaf;
142
218
  }
143
219
  }
144
220
 
@@ -148,55 +224,101 @@ var parseObject = function (chain, val, options, valuesParsed) {
148
224
  return leaf;
149
225
  };
150
226
 
151
- var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
152
- if (!givenKey) {
153
- return;
154
- }
227
+ // Split a key like "a[b][c[]]" into ['a', '[b]', '[c[]]'] while preserving
228
+ // qs parse semantics for depth/prototype guards.
229
+ var splitKeyIntoSegments = function splitKeyIntoSegments(originalKey, options) {
230
+ var key = options.allowDots ? originalKey.replace(/\.([^.[]+)/g, '[$1]') : originalKey;
155
231
 
156
- // Transform dot notation to bracket notation
157
- var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
158
-
159
- // The regex chunks
160
-
161
- var brackets = /(\[[^[\]]*])/;
162
- var child = /(\[[^[\]]*])/g;
163
-
164
- // Get the parent
232
+ // depth <= 0 keeps the whole key as one segment
233
+ if (options.depth <= 0) {
234
+ if (!options.plainObjects && has.call(Object.prototype, key)) {
235
+ if (!options.allowPrototypes) {
236
+ return;
237
+ }
238
+ }
165
239
 
166
- var segment = options.depth > 0 && brackets.exec(key);
167
- var parent = segment ? key.slice(0, segment.index) : key;
240
+ return [key];
241
+ }
168
242
 
169
- // Stash the parent if it exists
243
+ var segments = [];
170
244
 
171
- var keys = [];
245
+ // parent before the first '[' (may be empty if key starts with '[')
246
+ var first = key.indexOf('[');
247
+ var parent = first >= 0 ? key.slice(0, first) : key;
172
248
  if (parent) {
173
- // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
174
249
  if (!options.plainObjects && has.call(Object.prototype, parent)) {
175
250
  if (!options.allowPrototypes) {
176
251
  return;
177
252
  }
178
253
  }
179
254
 
180
- keys.push(parent);
255
+ segments[segments.length] = parent;
181
256
  }
182
257
 
183
- // Loop through children appending to the array until we hit depth
184
-
185
- var i = 0;
186
- while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
187
- i += 1;
188
- if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
189
- if (!options.allowPrototypes) {
190
- return;
258
+ var n = key.length;
259
+ var open = first;
260
+ var collected = 0;
261
+
262
+ while (open >= 0 && collected < options.depth) {
263
+ var level = 1;
264
+ var i = open + 1;
265
+ var close = -1;
266
+
267
+ // balance nested '[' and ']' inside this bracket group using a nesting level counter
268
+ while (i < n && close < 0) {
269
+ var cu = key.charCodeAt(i);
270
+ if (cu === 0x5B) { // '['
271
+ level += 1;
272
+ } else if (cu === 0x5D) { // ']'
273
+ level -= 1;
274
+ if (level === 0) {
275
+ close = i; // found matching close; loop will exit by condition
276
+ }
191
277
  }
278
+ i += 1;
192
279
  }
193
- keys.push(segment[1]);
280
+
281
+ if (close < 0) {
282
+ // Unterminated group: wrap the raw remainder in one bracket pair so it stays
283
+ // a single literal segment (e.g. "[[]b" -> "[[]b]"); we do not infer missing ']'.
284
+ segments[segments.length] = '[' + key.slice(open) + ']';
285
+ return segments;
286
+ }
287
+
288
+ var seg = key.slice(open, close + 1);
289
+ // prototype guard for the content of this group
290
+ var content = seg.slice(1, -1);
291
+ if (!options.plainObjects && has.call(Object.prototype, content) && !options.allowPrototypes) {
292
+ return;
293
+ }
294
+
295
+ segments[segments.length] = seg;
296
+ collected += 1;
297
+
298
+ // find the next '[' after this balanced group
299
+ open = key.indexOf('[', close + 1);
194
300
  }
195
301
 
196
- // If there's a remainder, just add whatever is left
302
+ if (open >= 0) {
303
+ if (options.strictDepth === true) {
304
+ throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
305
+ }
197
306
 
198
- if (segment) {
199
- keys.push('[' + key.slice(segment.index) + ']');
307
+ segments[segments.length] = '[' + key.slice(open) + ']';
308
+ }
309
+
310
+ return segments;
311
+ };
312
+
313
+ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
314
+ if (!givenKey) {
315
+ return;
316
+ }
317
+
318
+ var keys = splitKeyIntoSegments(givenKey, options);
319
+
320
+ if (!keys) {
321
+ return;
200
322
  }
201
323
 
202
324
  return parseObject(keys, val, options, valuesParsed);
@@ -207,33 +329,60 @@ var normalizeParseOptions = function normalizeParseOptions(opts) {
207
329
  return defaults;
208
330
  }
209
331
 
210
- if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
332
+ if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
333
+ throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
334
+ }
335
+
336
+ if (typeof opts.decodeDotInKeys !== 'undefined' && typeof opts.decodeDotInKeys !== 'boolean') {
337
+ throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided');
338
+ }
339
+
340
+ if (opts.decoder !== null && typeof opts.decoder !== 'undefined' && typeof opts.decoder !== 'function') {
211
341
  throw new TypeError('Decoder has to be a function.');
212
342
  }
213
343
 
214
344
  if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
215
345
  throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
216
346
  }
347
+
348
+ if (typeof opts.throwOnLimitExceeded !== 'undefined' && typeof opts.throwOnLimitExceeded !== 'boolean') {
349
+ throw new TypeError('`throwOnLimitExceeded` option must be a boolean');
350
+ }
351
+
217
352
  var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
218
353
 
354
+ var duplicates = typeof opts.duplicates === 'undefined' ? defaults.duplicates : opts.duplicates;
355
+
356
+ if (duplicates !== 'combine' && duplicates !== 'first' && duplicates !== 'last') {
357
+ throw new TypeError('The duplicates option must be either combine, first, or last');
358
+ }
359
+
360
+ var allowDots = typeof opts.allowDots === 'undefined' ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
361
+
219
362
  return {
220
- allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
363
+ allowDots: allowDots,
364
+ allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
221
365
  allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
222
366
  allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
223
367
  arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
224
368
  charset: charset,
225
369
  charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
226
370
  comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
371
+ decodeDotInKeys: typeof opts.decodeDotInKeys === 'boolean' ? opts.decodeDotInKeys : defaults.decodeDotInKeys,
227
372
  decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
228
373
  delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
229
374
  // eslint-disable-next-line no-implicit-coercion, no-extra-parens
230
375
  depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
376
+ duplicates: duplicates,
231
377
  ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
232
378
  interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
233
379
  parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
234
380
  parseArrays: opts.parseArrays !== false,
235
381
  plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
236
- strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
382
+ strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth,
383
+ strictMerge: typeof opts.strictMerge === 'boolean' ? !!opts.strictMerge : defaults.strictMerge,
384
+ strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling,
385
+ throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === 'boolean' ? opts.throwOnLimitExceeded : false
237
386
  };
238
387
  };
239
388
 
@@ -241,11 +390,11 @@ module.exports = function (str, opts) {
241
390
  var options = normalizeParseOptions(opts);
242
391
 
243
392
  if (str === '' || str === null || typeof str === 'undefined') {
244
- return options.plainObjects ? Object.create(null) : {};
393
+ return options.plainObjects ? { __proto__: null } : {};
245
394
  }
246
395
 
247
396
  var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
248
- var obj = options.plainObjects ? Object.create(null) : {};
397
+ var obj = options.plainObjects ? { __proto__: null } : {};
249
398
 
250
399
  // Iterate over the keys and setup the new object
251
400