@nocobase/plugin-multi-keyword-filter 2.2.17 â 2.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/103.b39ee70786cb13a7.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/103.dfed67c95bcd8a1d.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +4 -4
- package/dist/node_modules/qs/.editorconfig +4 -1
- package/dist/node_modules/qs/.github/SECURITY.md +11 -0
- package/dist/node_modules/qs/.github/THREAT_MODEL.md +78 -0
- package/dist/node_modules/qs/dist/qs.js +90 -2036
- package/dist/node_modules/qs/lib/index.js +1 -1
- package/dist/node_modules/qs/lib/parse.js +215 -66
- package/dist/node_modules/qs/lib/stringify.js +90 -32
- package/dist/node_modules/qs/lib/utils.js +189 -53
- package/dist/node_modules/qs/node_modules/es-define-property/.eslintrc +13 -0
- package/dist/node_modules/qs/node_modules/es-define-property/.github/FUNDING.yml +12 -0
- package/dist/node_modules/qs/node_modules/es-define-property/.nycrc +9 -0
- package/dist/node_modules/qs/node_modules/es-define-property/index.d.ts +3 -0
- package/dist/node_modules/qs/node_modules/es-define-property/index.js +14 -0
- package/dist/node_modules/qs/node_modules/es-define-property/package.json +81 -0
- package/dist/node_modules/qs/node_modules/es-define-property/test/index.js +56 -0
- package/dist/node_modules/qs/node_modules/side-channel/.editorconfig +9 -0
- package/dist/node_modules/qs/node_modules/side-channel/.eslintrc +12 -0
- package/dist/node_modules/qs/node_modules/side-channel/.github/FUNDING.yml +12 -0
- package/dist/node_modules/qs/node_modules/side-channel/.nycrc +13 -0
- package/dist/node_modules/qs/node_modules/side-channel/index.d.ts +14 -0
- package/dist/node_modules/qs/node_modules/side-channel/index.js +46 -0
- package/dist/node_modules/qs/node_modules/side-channel/package.json +85 -0
- package/dist/node_modules/qs/node_modules/side-channel/test/index.js +120 -0
- package/dist/node_modules/qs/node_modules/side-channel-list/.editorconfig +9 -0
- package/dist/node_modules/qs/node_modules/side-channel-list/.eslintrc +11 -0
- package/dist/node_modules/qs/node_modules/side-channel-list/.github/FUNDING.yml +12 -0
- package/dist/node_modules/qs/node_modules/side-channel-list/.nycrc +13 -0
- package/dist/node_modules/qs/node_modules/side-channel-list/index.d.ts +13 -0
- package/dist/node_modules/qs/node_modules/side-channel-list/index.js +111 -0
- package/dist/node_modules/qs/node_modules/side-channel-list/list.d.ts +14 -0
- package/dist/node_modules/qs/node_modules/side-channel-list/package.json +77 -0
- package/dist/node_modules/qs/node_modules/side-channel-list/test/index.js +154 -0
- package/dist/node_modules/qs/package.json +1 -1
- package/dist/node_modules/qs/test/empty-keys-cases.js +261 -31
- package/dist/node_modules/qs/test/parse.js +1281 -57
- package/dist/node_modules/qs/test/stringify.js +851 -58
- package/dist/node_modules/qs/test/utils.js +505 -3
- package/package.json +5 -2
- package/dist/client/103.513149b773e262dc.js +0 -10
- package/dist/client-v2/103.8bcbf628d0af8457.js +0 -10
- package/dist/node_modules/qs/.eslintrc +0 -38
|
@@ -4,6 +4,8 @@ var test = require('tape');
|
|
|
4
4
|
var inspect = require('object-inspect');
|
|
5
5
|
var SaferBuffer = require('safer-buffer').Buffer;
|
|
6
6
|
var forEach = require('for-each');
|
|
7
|
+
var v = require('es-value-fixtures');
|
|
8
|
+
|
|
7
9
|
var utils = require('../lib/utils');
|
|
8
10
|
|
|
9
11
|
test('merge()', function (t) {
|
|
@@ -28,6 +30,21 @@ test('merge()', function (t) {
|
|
|
28
30
|
var noOptionsNonObjectSource = utils.merge({ foo: 'baz' }, 'bar');
|
|
29
31
|
t.deepEqual(noOptionsNonObjectSource, { foo: 'baz', bar: true });
|
|
30
32
|
|
|
33
|
+
var func = function f() {};
|
|
34
|
+
func();
|
|
35
|
+
t.deepEqual(
|
|
36
|
+
utils.merge(func, { foo: 'bar' }),
|
|
37
|
+
[func, { foo: 'bar' }],
|
|
38
|
+
'functions can not be merged into'
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
func.bar = 'baz';
|
|
42
|
+
t.deepEqual(
|
|
43
|
+
utils.merge({ foo: 'bar' }, func),
|
|
44
|
+
{ foo: 'bar', bar: 'baz' },
|
|
45
|
+
'functions can be merge sources'
|
|
46
|
+
);
|
|
47
|
+
|
|
31
48
|
t.test(
|
|
32
49
|
'avoids invoking array setters unnecessarily',
|
|
33
50
|
{ skip: typeof Object.defineProperty !== 'function' },
|
|
@@ -48,10 +65,177 @@ test('merge()', function (t) {
|
|
|
48
65
|
observed[0] = observed[0]; // eslint-disable-line no-self-assign
|
|
49
66
|
st.equal(setCount, 1);
|
|
50
67
|
st.equal(getCount, 2);
|
|
68
|
+
|
|
51
69
|
st.end();
|
|
52
70
|
}
|
|
53
71
|
);
|
|
54
72
|
|
|
73
|
+
t.test('with overflow objects (from arrayLimit)', function (st) {
|
|
74
|
+
// arrayLimit is max index, so with limit 0, max index 0 is allowed (1 element)
|
|
75
|
+
// To create overflow, need 2+ elements with limit 0, or 3+ with limit 1, etc.
|
|
76
|
+
st.test('merges primitive into overflow object at next index', function (s2t) {
|
|
77
|
+
// Create an overflow object via combine: 3 elements (indices 0-2) with limit 0
|
|
78
|
+
var overflow = utils.combine(['a', 'b'], 'c', 0, false);
|
|
79
|
+
s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
|
|
80
|
+
var merged = utils.merge(overflow, 'd');
|
|
81
|
+
s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c', 3: 'd' }, 'adds primitive at next numeric index');
|
|
82
|
+
|
|
83
|
+
s2t.end();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
st.test('merges primitive into regular object with numeric keys normally', function (s2t) {
|
|
87
|
+
var obj = { 0: 'a', 1: 'b' };
|
|
88
|
+
s2t.notOk(utils.isOverflow(obj), 'plain object is not marked as overflow');
|
|
89
|
+
var merged = utils.merge(obj, 'c');
|
|
90
|
+
s2t.deepEqual(merged, { 0: 'a', 1: 'b', c: true }, 'adds primitive as key (not at next index)');
|
|
91
|
+
s2t.end();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
st.test('merges primitive into object with non-numeric keys normally', function (s2t) {
|
|
95
|
+
var obj = { foo: 'bar' };
|
|
96
|
+
var merged = utils.merge(obj, 'baz');
|
|
97
|
+
s2t.deepEqual(merged, { foo: 'bar', baz: true }, 'adds primitive as key with value true');
|
|
98
|
+
|
|
99
|
+
s2t.end();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
st.test('with strictMerge, wraps object and primitive in array', function (s2t) {
|
|
103
|
+
var obj = { foo: 'bar' };
|
|
104
|
+
var merged = utils.merge(obj, 'baz', { strictMerge: true });
|
|
105
|
+
s2t.deepEqual(merged, [{ foo: 'bar' }, 'baz'], 'wraps in array with strictMerge');
|
|
106
|
+
s2t.end();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
st.test('merges overflow object into primitive', function (s2t) {
|
|
110
|
+
// Create an overflow object via combine: 2 elements (indices 0-1) with limit 0
|
|
111
|
+
var overflow = utils.combine(['a'], 'b', 0, false);
|
|
112
|
+
s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
|
|
113
|
+
var merged = utils.merge('c', overflow);
|
|
114
|
+
s2t.ok(utils.isOverflow(merged), 'result is also marked as overflow');
|
|
115
|
+
s2t.deepEqual(merged, { 0: 'c', 1: 'a', 2: 'b' }, 'creates object with primitive at 0, source values shifted');
|
|
116
|
+
|
|
117
|
+
s2t.end();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
st.test('merges overflow object into primitive with plainObjects', function (s2t) {
|
|
121
|
+
var overflow = utils.combine(['a'], 'b', 0, false);
|
|
122
|
+
s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
|
|
123
|
+
var merged = utils.merge('c', overflow, { plainObjects: true });
|
|
124
|
+
s2t.ok(utils.isOverflow(merged), 'result is also marked as overflow');
|
|
125
|
+
s2t.deepEqual(merged, { __proto__: null, 0: 'c', 1: 'a', 2: 'b' }, 'creates null-proto object with primitive at 0');
|
|
126
|
+
|
|
127
|
+
s2t.end();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
st.test('merges overflow object with multiple values into primitive', function (s2t) {
|
|
131
|
+
// Create an overflow object via combine: 3 elements (indices 0-2) with limit 0
|
|
132
|
+
var overflow = utils.combine(['b', 'c'], 'd', 0, false);
|
|
133
|
+
s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
|
|
134
|
+
var merged = utils.merge('a', overflow);
|
|
135
|
+
s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c', 3: 'd' }, 'shifts all source indices by 1');
|
|
136
|
+
|
|
137
|
+
s2t.end();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
st.test('merges regular object into primitive as array', function (s2t) {
|
|
141
|
+
var obj = { foo: 'bar' };
|
|
142
|
+
var merged = utils.merge('a', obj);
|
|
143
|
+
s2t.deepEqual(merged, ['a', { foo: 'bar' }], 'creates array with primitive and object');
|
|
144
|
+
|
|
145
|
+
s2t.end();
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
st.test('merges primitive into array that exceeds arrayLimit', function (s2t) {
|
|
149
|
+
var arr = ['a', 'b', 'c'];
|
|
150
|
+
var merged = utils.merge(arr, 'd', { arrayLimit: 1 });
|
|
151
|
+
s2t.ok(utils.isOverflow(merged), 'result is marked as overflow');
|
|
152
|
+
s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c', 3: 'd' }, 'converts to overflow object with primitive appended');
|
|
153
|
+
|
|
154
|
+
s2t.end();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
st.test('merges array into primitive that exceeds arrayLimit', function (s2t) {
|
|
158
|
+
var merged = utils.merge('a', ['b', 'c'], { arrayLimit: 1 });
|
|
159
|
+
s2t.ok(utils.isOverflow(merged), 'result is marked as overflow');
|
|
160
|
+
s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c' }, 'converts to overflow object');
|
|
161
|
+
|
|
162
|
+
s2t.end();
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
st.test('merges primitive into array at the arrayLimit boundary, consistently with combine', function (s2t) {
|
|
166
|
+
var merged = utils.merge(['a'], 'b', { arrayLimit: 1 });
|
|
167
|
+
s2t.ok(utils.isOverflow(merged), 'result is marked as overflow at the boundary');
|
|
168
|
+
s2t.deepEqual(merged, { 0: 'a', 1: 'b' }, 'converts to overflow object instead of a length-2 array');
|
|
169
|
+
|
|
170
|
+
s2t.end();
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
st.test('merges two arrays that exceed arrayLimit into an overflow object', function (s2t) {
|
|
174
|
+
var merged = utils.merge(['a'], ['b'], { arrayLimit: 1 });
|
|
175
|
+
s2t.ok(utils.isOverflow(merged), 'result is marked as overflow');
|
|
176
|
+
s2t.deepEqual(merged, { 0: 'a', 1: 'b' }, 'array-into-array merge enforces arrayLimit like combine');
|
|
177
|
+
|
|
178
|
+
s2t.end();
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
st.test('throws at the arrayLimit boundary when merging a primitive into an array with throwOnLimitExceeded', function (s2t) {
|
|
182
|
+
s2t['throws'](
|
|
183
|
+
function () { utils.merge(['a'], 'b', { arrayLimit: 1, throwOnLimitExceeded: true }); },
|
|
184
|
+
new RangeError('Array limit exceeded. Only 1 element allowed in an array.'),
|
|
185
|
+
'throws when the resulting length would exceed arrayLimit'
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
s2t.end();
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
st.test('throws when merging two arrays past arrayLimit with throwOnLimitExceeded', function (s2t) {
|
|
192
|
+
s2t['throws'](
|
|
193
|
+
function () { utils.merge(['a'], ['b'], { arrayLimit: 1, throwOnLimitExceeded: true }); },
|
|
194
|
+
new RangeError('Array limit exceeded. Only 1 element allowed in an array.'),
|
|
195
|
+
'array-into-array merge throws rather than silently exceeding arrayLimit'
|
|
196
|
+
);
|
|
197
|
+
s2t['throws'](
|
|
198
|
+
function () { utils.merge(['a', 'b', 'c'], ['d', 'e', 'f'], { arrayLimit: 2, throwOnLimitExceeded: true }); },
|
|
199
|
+
new RangeError('Array limit exceeded. Only 2 elements allowed in an array.'),
|
|
200
|
+
'uses the plural message when arrayLimit is not 1'
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
s2t.end();
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
st.test('throws instead of merging primitive into over-limit array when throwOnLimitExceeded is set', function (s2t) {
|
|
207
|
+
s2t['throws'](
|
|
208
|
+
function () { utils.merge(['a', 'b', 'c'], 'd', { arrayLimit: 1, throwOnLimitExceeded: true }); },
|
|
209
|
+
new RangeError('Array limit exceeded. Only 1 element allowed in an array.'),
|
|
210
|
+
'throws rather than converting to an overflow object'
|
|
211
|
+
);
|
|
212
|
+
s2t['throws'](
|
|
213
|
+
function () { utils.merge(['a', 'b', 'c'], 'd', { arrayLimit: 2, throwOnLimitExceeded: true }); },
|
|
214
|
+
new RangeError('Array limit exceeded. Only 2 elements allowed in an array.'),
|
|
215
|
+
'uses the plural message when arrayLimit is not 1'
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
s2t.end();
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
st.test('throws instead of merging array into primitive when throwOnLimitExceeded is set', function (s2t) {
|
|
222
|
+
s2t['throws'](
|
|
223
|
+
function () { utils.merge('a', ['b', 'c'], { arrayLimit: 1, throwOnLimitExceeded: true }); },
|
|
224
|
+
new RangeError('Array limit exceeded. Only 1 element allowed in an array.'),
|
|
225
|
+
'throws rather than converting to an overflow object'
|
|
226
|
+
);
|
|
227
|
+
s2t['throws'](
|
|
228
|
+
function () { utils.merge('a', ['b', 'c', 'd'], { arrayLimit: 2, throwOnLimitExceeded: true }); },
|
|
229
|
+
new RangeError('Array limit exceeded. Only 2 elements allowed in an array.'),
|
|
230
|
+
'uses the plural message when arrayLimit is not 1'
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
s2t.end();
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
st.end();
|
|
237
|
+
});
|
|
238
|
+
|
|
55
239
|
t.end();
|
|
56
240
|
});
|
|
57
241
|
|
|
@@ -116,21 +300,339 @@ test('combine()', function (t) {
|
|
|
116
300
|
st.end();
|
|
117
301
|
});
|
|
118
302
|
|
|
303
|
+
t.test('with arrayLimit', function (st) {
|
|
304
|
+
st.test('under the limit', function (s2t) {
|
|
305
|
+
var combined = utils.combine(['a', 'b'], 'c', 10, false);
|
|
306
|
+
s2t.deepEqual(combined, ['a', 'b', 'c'], 'returns array when under limit');
|
|
307
|
+
s2t.ok(Array.isArray(combined), 'result is an array');
|
|
308
|
+
s2t.end();
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
st.test('exactly at the limit stays as array', function (s2t) {
|
|
312
|
+
var combined = utils.combine(['a', 'b'], 'c', 3, false);
|
|
313
|
+
s2t.deepEqual(combined, ['a', 'b', 'c'], 'stays as array when count equals limit');
|
|
314
|
+
s2t.ok(Array.isArray(combined), 'result is an array');
|
|
315
|
+
s2t.end();
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
st.test('over the limit', function (s2t) {
|
|
319
|
+
var combined = utils.combine(['a', 'b', 'c'], 'd', 3, false);
|
|
320
|
+
s2t.deepEqual(combined, { 0: 'a', 1: 'b', 2: 'c', 3: 'd' }, 'converts to object when over limit');
|
|
321
|
+
s2t.notOk(Array.isArray(combined), 'result is not an array');
|
|
322
|
+
s2t.end();
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
st.test('with arrayLimit 1', function (s2t) {
|
|
326
|
+
var combined = utils.combine([], 'a', 1, false);
|
|
327
|
+
s2t.deepEqual(combined, ['a'], 'stays as array when count equals limit');
|
|
328
|
+
s2t.ok(Array.isArray(combined), 'result is an array');
|
|
329
|
+
s2t.end();
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
st.test('with arrayLimit 0 converts single element to object', function (s2t) {
|
|
333
|
+
var combined = utils.combine([], 'a', 0, false);
|
|
334
|
+
s2t.deepEqual(combined, { 0: 'a' }, 'converts to object when count exceeds limit');
|
|
335
|
+
s2t.notOk(Array.isArray(combined), 'result is not an array');
|
|
336
|
+
s2t.end();
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
st.test('with arrayLimit 0 and two elements converts to object', function (s2t) {
|
|
340
|
+
var combined = utils.combine(['a'], 'b', 0, false);
|
|
341
|
+
s2t.deepEqual(combined, { 0: 'a', 1: 'b' }, 'converts to object when count exceeds limit');
|
|
342
|
+
s2t.notOk(Array.isArray(combined), 'result is not an array');
|
|
343
|
+
s2t.end();
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
st.test('with plainObjects option', function (s2t) {
|
|
347
|
+
var combined = utils.combine(['a', 'b'], 'c', 1, true);
|
|
348
|
+
var expected = { __proto__: null, 0: 'a', 1: 'b', 2: 'c' };
|
|
349
|
+
s2t.deepEqual(combined, expected, 'converts to object with null prototype');
|
|
350
|
+
s2t.equal(Object.getPrototypeOf(combined), null, 'result has null prototype when plainObjects is true');
|
|
351
|
+
s2t.end();
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
st.end();
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
t.test('with throwOnLimitExceeded', function (st) {
|
|
358
|
+
st.test('throws when concatenation exceeds the limit', function (s2t) {
|
|
359
|
+
s2t['throws'](
|
|
360
|
+
function () { utils.combine(['a', 'b', 'c'], 'd', 3, false, true); },
|
|
361
|
+
new RangeError('Array limit exceeded. Only 3 elements allowed in an array.'),
|
|
362
|
+
'throws instead of converting to an overflow object'
|
|
363
|
+
);
|
|
364
|
+
s2t['throws'](
|
|
365
|
+
function () { utils.combine([], 'a', 0, false, true); },
|
|
366
|
+
new RangeError('Array limit exceeded. Only 0 elements allowed in an array.'),
|
|
367
|
+
'throws with the correct count at arrayLimit 0'
|
|
368
|
+
);
|
|
369
|
+
s2t.end();
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
st.test('throws when adding to an existing overflow object', function (s2t) {
|
|
373
|
+
var overflow = utils.combine(['a', 'b'], 'c', 0, false);
|
|
374
|
+
s2t.ok(utils.isOverflow(overflow), 'initial object is marked as overflow');
|
|
375
|
+
|
|
376
|
+
s2t['throws'](
|
|
377
|
+
function () { utils.combine(overflow, 'd', 0, false, true); },
|
|
378
|
+
new RangeError('Array limit exceeded. Only 0 elements allowed in an array.'),
|
|
379
|
+
'throws rather than appending to the overflow object'
|
|
380
|
+
);
|
|
381
|
+
s2t['throws'](
|
|
382
|
+
function () { utils.combine(overflow, 'd', 1, false, true); },
|
|
383
|
+
new RangeError('Array limit exceeded. Only 1 element allowed in an array.'),
|
|
384
|
+
'uses the singular message at arrayLimit 1'
|
|
385
|
+
);
|
|
386
|
+
s2t.end();
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
st.test('does not throw when within the limit', function (s2t) {
|
|
390
|
+
var combined = utils.combine(['a'], 'b', 5, false, true);
|
|
391
|
+
s2t.deepEqual(combined, ['a', 'b'], 'returns the array unchanged when under the limit');
|
|
392
|
+
s2t.end();
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
st.end();
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
t.test('with existing overflow object', function (st) {
|
|
399
|
+
st.test('adds to existing overflow object at next index', function (s2t) {
|
|
400
|
+
// Create overflow object first via combine: 3 elements (indices 0-2) with limit 0
|
|
401
|
+
var overflow = utils.combine(['a', 'b'], 'c', 0, false);
|
|
402
|
+
s2t.ok(utils.isOverflow(overflow), 'initial object is marked as overflow');
|
|
403
|
+
|
|
404
|
+
var combined = utils.combine(overflow, 'd', 10, false);
|
|
405
|
+
s2t.equal(combined, overflow, 'returns the same object (mutated)');
|
|
406
|
+
s2t.deepEqual(combined, { 0: 'a', 1: 'b', 2: 'c', 3: 'd' }, 'adds value at next numeric index');
|
|
407
|
+
s2t.end();
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
st.test('does not treat plain object with numeric keys as overflow', function (s2t) {
|
|
411
|
+
var plainObj = { 0: 'a', 1: 'b' };
|
|
412
|
+
s2t.notOk(utils.isOverflow(plainObj), 'plain object is not marked as overflow');
|
|
413
|
+
|
|
414
|
+
// combine treats this as a regular value, not an overflow object to append to
|
|
415
|
+
var combined = utils.combine(plainObj, 'c', 10, false);
|
|
416
|
+
s2t.deepEqual(combined, [{ 0: 'a', 1: 'b' }, 'c'], 'concatenates as regular values');
|
|
417
|
+
s2t.end();
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
st.end();
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
t.end();
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
test('decode', function (t) {
|
|
427
|
+
t.equal(
|
|
428
|
+
utils.decode('a+b'),
|
|
429
|
+
'a b',
|
|
430
|
+
'decodes + to space'
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
t.equal(
|
|
434
|
+
utils.decode('name%2Eobj'),
|
|
435
|
+
'name.obj',
|
|
436
|
+
'decodes a string'
|
|
437
|
+
);
|
|
438
|
+
t.equal(
|
|
439
|
+
utils.decode('name%2Eobj%2Efoo', null, 'iso-8859-1'),
|
|
440
|
+
'name.obj.foo',
|
|
441
|
+
'decodes a string in iso-8859-1'
|
|
442
|
+
);
|
|
443
|
+
|
|
444
|
+
t.end();
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
test('encode', function (t) {
|
|
448
|
+
forEach(v.nullPrimitives, function (nullish) {
|
|
449
|
+
t['throws'](
|
|
450
|
+
function () { utils.encode(nullish); },
|
|
451
|
+
TypeError,
|
|
452
|
+
inspect(nullish) + ' is not a string'
|
|
453
|
+
);
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
t.equal(utils.encode(''), '', 'empty string returns itself');
|
|
457
|
+
t.deepEqual(utils.encode([]), [], 'empty array returns itself');
|
|
458
|
+
t.deepEqual(utils.encode({ length: 0 }), { length: 0 }, 'empty arraylike returns itself');
|
|
459
|
+
|
|
460
|
+
t.test('symbols', { skip: !v.hasSymbols }, function (st) {
|
|
461
|
+
st.equal(utils.encode(Symbol('x')), 'Symbol%28x%29', 'symbol is encoded');
|
|
462
|
+
|
|
463
|
+
st.end();
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
t.equal(
|
|
467
|
+
utils.encode('(abc)'),
|
|
468
|
+
'%28abc%29',
|
|
469
|
+
'encodes parentheses'
|
|
470
|
+
);
|
|
471
|
+
t.equal(
|
|
472
|
+
utils.encode({ toString: function () { return '(abc)'; } }),
|
|
473
|
+
'%28abc%29',
|
|
474
|
+
'toStrings and encodes parentheses'
|
|
475
|
+
);
|
|
476
|
+
|
|
477
|
+
t.equal(
|
|
478
|
+
utils.encode('abc 123 ðĐ', null, 'iso-8859-1'),
|
|
479
|
+
'abc%20123%20%26%2355357%3B%26%2356489%3B',
|
|
480
|
+
'encodes in iso-8859-1'
|
|
481
|
+
);
|
|
482
|
+
|
|
483
|
+
var longString = '';
|
|
484
|
+
var expectedString = '';
|
|
485
|
+
for (var i = 0; i < 1500; i++) {
|
|
486
|
+
longString += ' ';
|
|
487
|
+
expectedString += '%20';
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
t.equal(
|
|
491
|
+
utils.encode(longString),
|
|
492
|
+
expectedString,
|
|
493
|
+
'encodes a long string'
|
|
494
|
+
);
|
|
495
|
+
|
|
496
|
+
var boundary = '';
|
|
497
|
+
var expected = '';
|
|
498
|
+
for (var j = 0; j < 1023; j++) {
|
|
499
|
+
boundary += 'a';
|
|
500
|
+
expected += 'a';
|
|
501
|
+
}
|
|
502
|
+
boundary += 'ð';
|
|
503
|
+
expected += '%F0%9F%98%80';
|
|
504
|
+
|
|
505
|
+
t.equal(
|
|
506
|
+
utils.encode(boundary),
|
|
507
|
+
expected,
|
|
508
|
+
'encodes a surrogate pair split across long-string chunks'
|
|
509
|
+
);
|
|
510
|
+
|
|
511
|
+
var laterBoundary = '';
|
|
512
|
+
var laterExpected = '';
|
|
513
|
+
for (var k = 0; k < 2047; k++) {
|
|
514
|
+
laterBoundary += 'a';
|
|
515
|
+
laterExpected += 'a';
|
|
516
|
+
}
|
|
517
|
+
laterBoundary += 'ð';
|
|
518
|
+
laterExpected += '%F0%9F%98%80';
|
|
519
|
+
|
|
520
|
+
t.equal(
|
|
521
|
+
utils.encode(laterBoundary),
|
|
522
|
+
laterExpected,
|
|
523
|
+
'encodes a surrogate pair split across a later chunk boundary'
|
|
524
|
+
);
|
|
525
|
+
|
|
526
|
+
var twoPairs = '';
|
|
527
|
+
for (k = 0; k < 1023; k++) {
|
|
528
|
+
twoPairs += 'a';
|
|
529
|
+
}
|
|
530
|
+
twoPairs += 'ð';
|
|
531
|
+
for (k = 0; k < 1022; k++) {
|
|
532
|
+
twoPairs += 'b';
|
|
533
|
+
}
|
|
534
|
+
twoPairs += 'ð';
|
|
535
|
+
|
|
536
|
+
t.equal(
|
|
537
|
+
(utils.encode(twoPairs).match(/%F0%9F%98%80/g) || []).length,
|
|
538
|
+
2,
|
|
539
|
+
'encodes two surrogate pairs each split across a chunk boundary'
|
|
540
|
+
);
|
|
541
|
+
|
|
542
|
+
var roundTrip = '';
|
|
543
|
+
for (k = 0; k < 1023; k++) {
|
|
544
|
+
roundTrip += 'a';
|
|
545
|
+
}
|
|
546
|
+
roundTrip += 'ð';
|
|
547
|
+
|
|
548
|
+
t.equal(
|
|
549
|
+
decodeURIComponent(utils.encode(roundTrip)),
|
|
550
|
+
roundTrip,
|
|
551
|
+
'a boundary-split surrogate pair round-trips through decodeURIComponent'
|
|
552
|
+
);
|
|
553
|
+
|
|
554
|
+
var loneBoundary = '';
|
|
555
|
+
var loneExpected = '';
|
|
556
|
+
for (k = 0; k < 1023; k++) {
|
|
557
|
+
loneBoundary += 'a';
|
|
558
|
+
loneExpected += 'a';
|
|
559
|
+
}
|
|
560
|
+
loneBoundary += '\uD83DX';
|
|
561
|
+
loneExpected += '%F0%9F%91%98';
|
|
562
|
+
|
|
563
|
+
t.equal(
|
|
564
|
+
utils.encode(loneBoundary),
|
|
565
|
+
loneExpected,
|
|
566
|
+
'a lone high surrogate at a chunk boundary encodes the same as mid-chunk'
|
|
567
|
+
);
|
|
568
|
+
|
|
569
|
+
t.equal(
|
|
570
|
+
utils.encode('\x28\x29'),
|
|
571
|
+
'%28%29',
|
|
572
|
+
'encodes parens normally'
|
|
573
|
+
);
|
|
574
|
+
t.equal(
|
|
575
|
+
utils.encode('\x28\x29', null, null, null, 'RFC1738'),
|
|
576
|
+
'()',
|
|
577
|
+
'does not encode parens in RFC1738'
|
|
578
|
+
);
|
|
579
|
+
|
|
580
|
+
// todo RFC1738 format
|
|
581
|
+
|
|
582
|
+
t.equal(
|
|
583
|
+
utils.encode('ÄáïĪ'),
|
|
584
|
+
'%C4%80%E1%80%80%EF%A4%80',
|
|
585
|
+
'encodes multibyte chars'
|
|
586
|
+
);
|
|
587
|
+
|
|
588
|
+
t.equal(
|
|
589
|
+
utils.encode('\uD83D \uDCA9'),
|
|
590
|
+
'%F0%9F%90%A0%F0%BA%90%80',
|
|
591
|
+
'encodes lone surrogates'
|
|
592
|
+
);
|
|
593
|
+
|
|
119
594
|
t.end();
|
|
120
595
|
});
|
|
121
596
|
|
|
122
597
|
test('isBuffer()', function (t) {
|
|
123
|
-
|
|
598
|
+
var fn = function () {};
|
|
599
|
+
fn();
|
|
600
|
+
forEach([null, undefined, true, false, '', 'abc', 42, 0, NaN, {}, [], fn, /a/g], function (x) {
|
|
124
601
|
t.equal(utils.isBuffer(x), false, inspect(x) + ' is not a buffer');
|
|
125
602
|
});
|
|
126
603
|
|
|
127
604
|
var fakeBuffer = { constructor: Buffer };
|
|
128
605
|
t.equal(utils.isBuffer(fakeBuffer), false, 'fake buffer is not a buffer');
|
|
129
606
|
|
|
607
|
+
forEach(['x', 1, true, {}, [], { isBuffer: true }], function (notCallable) {
|
|
608
|
+
var obj = { constructor: { isBuffer: notCallable } };
|
|
609
|
+
t.doesNotThrow(function () { utils.isBuffer(obj); }, 'non-callable `constructor.isBuffer` (' + inspect(notCallable) + ') does not throw');
|
|
610
|
+
t.equal(utils.isBuffer(obj), false, 'non-callable `constructor.isBuffer` (' + inspect(notCallable) + ') is not a buffer');
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
var nullObject = { __proto__: null, constructor: { __proto__: null, isBuffer: 'y' } };
|
|
614
|
+
t.equal(utils.isBuffer(nullObject), false, 'null object with non-callable `constructor.isBuffer` is not a buffer');
|
|
615
|
+
|
|
616
|
+
var duckBuffer = { constructor: { isBuffer: function () { return true; } } };
|
|
617
|
+
t.equal(utils.isBuffer(duckBuffer), true, 'callable `constructor.isBuffer` is still honored');
|
|
618
|
+
|
|
130
619
|
var saferBuffer = SaferBuffer.from('abc');
|
|
131
620
|
t.equal(utils.isBuffer(saferBuffer), true, 'SaferBuffer instance is a buffer');
|
|
132
621
|
|
|
133
|
-
var buffer =
|
|
134
|
-
t.
|
|
622
|
+
var buffer = SaferBuffer.from('abc');
|
|
623
|
+
t.notEqual(saferBuffer, buffer, 'different buffer instances');
|
|
624
|
+
t.equal(utils.isBuffer(buffer), true, 'another Buffer instance is a buffer');
|
|
625
|
+
t.end();
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
test('isRegExp()', function (t) {
|
|
629
|
+
t.equal(utils.isRegExp(/a/g), true, 'RegExp is a RegExp');
|
|
630
|
+
t.equal(utils.isRegExp(new RegExp('a', 'g')), true, 'new RegExp is a RegExp');
|
|
631
|
+
t.equal(utils.isRegExp(new Date()), false, 'Date is not a RegExp');
|
|
632
|
+
|
|
633
|
+
forEach(v.primitives, function (primitive) {
|
|
634
|
+
t.equal(utils.isRegExp(primitive), false, inspect(primitive) + ' is not a RegExp');
|
|
635
|
+
});
|
|
636
|
+
|
|
135
637
|
t.end();
|
|
136
638
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-multi-keyword-filter",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.19",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
5
|
"displayName": "Multi-keyword filter",
|
|
6
6
|
"displayName.zh-CN": "åĪå
ģéŪčŊįé",
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
],
|
|
19
19
|
"editionLevel": 0
|
|
20
20
|
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"qs": "^6.16.0"
|
|
23
|
+
},
|
|
21
24
|
"devDependencies": {
|
|
22
25
|
"antd": "5.x",
|
|
23
26
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
|
|
@@ -29,5 +32,5 @@
|
|
|
29
32
|
"@nocobase/test": "2.x"
|
|
30
33
|
},
|
|
31
34
|
"license": "Apache-2.0",
|
|
32
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "0d4e2dc07729c32533e35c8e8e16c57815d6242a"
|
|
33
36
|
}
|