@tachybase/module-multi-app 0.23.40 → 0.23.47

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.
@@ -0,0 +1,268 @@
1
+ 'use strict';
2
+
3
+ var formats = require('./formats');
4
+
5
+ var has = Object.prototype.hasOwnProperty;
6
+ var isArray = Array.isArray;
7
+
8
+ var hexTable = (function () {
9
+ var array = [];
10
+ for (var i = 0; i < 256; ++i) {
11
+ array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
12
+ }
13
+
14
+ return array;
15
+ }());
16
+
17
+ var compactQueue = function compactQueue(queue) {
18
+ while (queue.length > 1) {
19
+ var item = queue.pop();
20
+ var obj = item.obj[item.prop];
21
+
22
+ if (isArray(obj)) {
23
+ var compacted = [];
24
+
25
+ for (var j = 0; j < obj.length; ++j) {
26
+ if (typeof obj[j] !== 'undefined') {
27
+ compacted.push(obj[j]);
28
+ }
29
+ }
30
+
31
+ item.obj[item.prop] = compacted;
32
+ }
33
+ }
34
+ };
35
+
36
+ var arrayToObject = function arrayToObject(source, options) {
37
+ var obj = options && options.plainObjects ? { __proto__: null } : {};
38
+ for (var i = 0; i < source.length; ++i) {
39
+ if (typeof source[i] !== 'undefined') {
40
+ obj[i] = source[i];
41
+ }
42
+ }
43
+
44
+ return obj;
45
+ };
46
+
47
+ var merge = function merge(target, source, options) {
48
+ /* eslint no-param-reassign: 0 */
49
+ if (!source) {
50
+ return target;
51
+ }
52
+
53
+ if (typeof source !== 'object' && typeof source !== 'function') {
54
+ if (isArray(target)) {
55
+ target.push(source);
56
+ } else if (target && typeof target === 'object') {
57
+ if (
58
+ (options && (options.plainObjects || options.allowPrototypes))
59
+ || !has.call(Object.prototype, source)
60
+ ) {
61
+ target[source] = true;
62
+ }
63
+ } else {
64
+ return [target, source];
65
+ }
66
+
67
+ return target;
68
+ }
69
+
70
+ if (!target || typeof target !== 'object') {
71
+ return [target].concat(source);
72
+ }
73
+
74
+ var mergeTarget = target;
75
+ if (isArray(target) && !isArray(source)) {
76
+ mergeTarget = arrayToObject(target, options);
77
+ }
78
+
79
+ if (isArray(target) && isArray(source)) {
80
+ source.forEach(function (item, i) {
81
+ if (has.call(target, i)) {
82
+ var targetItem = target[i];
83
+ if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
84
+ target[i] = merge(targetItem, item, options);
85
+ } else {
86
+ target.push(item);
87
+ }
88
+ } else {
89
+ target[i] = item;
90
+ }
91
+ });
92
+ return target;
93
+ }
94
+
95
+ return Object.keys(source).reduce(function (acc, key) {
96
+ var value = source[key];
97
+
98
+ if (has.call(acc, key)) {
99
+ acc[key] = merge(acc[key], value, options);
100
+ } else {
101
+ acc[key] = value;
102
+ }
103
+ return acc;
104
+ }, mergeTarget);
105
+ };
106
+
107
+ var assign = function assignSingleSource(target, source) {
108
+ return Object.keys(source).reduce(function (acc, key) {
109
+ acc[key] = source[key];
110
+ return acc;
111
+ }, target);
112
+ };
113
+
114
+ var decode = function (str, defaultDecoder, charset) {
115
+ var strWithoutPlus = str.replace(/\+/g, ' ');
116
+ if (charset === 'iso-8859-1') {
117
+ // unescape never throws, no try...catch needed:
118
+ return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
119
+ }
120
+ // utf-8
121
+ try {
122
+ return decodeURIComponent(strWithoutPlus);
123
+ } catch (e) {
124
+ return strWithoutPlus;
125
+ }
126
+ };
127
+
128
+ var limit = 1024;
129
+
130
+ /* eslint operator-linebreak: [2, "before"] */
131
+
132
+ var encode = function encode(str, defaultEncoder, charset, kind, format) {
133
+ // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
134
+ // It has been adapted here for stricter adherence to RFC 3986
135
+ if (str.length === 0) {
136
+ return str;
137
+ }
138
+
139
+ var string = str;
140
+ if (typeof str === 'symbol') {
141
+ string = Symbol.prototype.toString.call(str);
142
+ } else if (typeof str !== 'string') {
143
+ string = String(str);
144
+ }
145
+
146
+ if (charset === 'iso-8859-1') {
147
+ return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
148
+ return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
149
+ });
150
+ }
151
+
152
+ var out = '';
153
+ for (var j = 0; j < string.length; j += limit) {
154
+ var segment = string.length >= limit ? string.slice(j, j + limit) : string;
155
+ var arr = [];
156
+
157
+ for (var i = 0; i < segment.length; ++i) {
158
+ var c = segment.charCodeAt(i);
159
+ if (
160
+ c === 0x2D // -
161
+ || c === 0x2E // .
162
+ || c === 0x5F // _
163
+ || c === 0x7E // ~
164
+ || (c >= 0x30 && c <= 0x39) // 0-9
165
+ || (c >= 0x41 && c <= 0x5A) // a-z
166
+ || (c >= 0x61 && c <= 0x7A) // A-Z
167
+ || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
168
+ ) {
169
+ arr[arr.length] = segment.charAt(i);
170
+ continue;
171
+ }
172
+
173
+ if (c < 0x80) {
174
+ arr[arr.length] = hexTable[c];
175
+ continue;
176
+ }
177
+
178
+ if (c < 0x800) {
179
+ arr[arr.length] = hexTable[0xC0 | (c >> 6)]
180
+ + hexTable[0x80 | (c & 0x3F)];
181
+ continue;
182
+ }
183
+
184
+ if (c < 0xD800 || c >= 0xE000) {
185
+ arr[arr.length] = hexTable[0xE0 | (c >> 12)]
186
+ + hexTable[0x80 | ((c >> 6) & 0x3F)]
187
+ + hexTable[0x80 | (c & 0x3F)];
188
+ continue;
189
+ }
190
+
191
+ i += 1;
192
+ c = 0x10000 + (((c & 0x3FF) << 10) | (segment.charCodeAt(i) & 0x3FF));
193
+
194
+ arr[arr.length] = hexTable[0xF0 | (c >> 18)]
195
+ + hexTable[0x80 | ((c >> 12) & 0x3F)]
196
+ + hexTable[0x80 | ((c >> 6) & 0x3F)]
197
+ + hexTable[0x80 | (c & 0x3F)];
198
+ }
199
+
200
+ out += arr.join('');
201
+ }
202
+
203
+ return out;
204
+ };
205
+
206
+ var compact = function compact(value) {
207
+ var queue = [{ obj: { o: value }, prop: 'o' }];
208
+ var refs = [];
209
+
210
+ for (var i = 0; i < queue.length; ++i) {
211
+ var item = queue[i];
212
+ var obj = item.obj[item.prop];
213
+
214
+ var keys = Object.keys(obj);
215
+ for (var j = 0; j < keys.length; ++j) {
216
+ var key = keys[j];
217
+ var val = obj[key];
218
+ if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
219
+ queue.push({ obj: obj, prop: key });
220
+ refs.push(val);
221
+ }
222
+ }
223
+ }
224
+
225
+ compactQueue(queue);
226
+
227
+ return value;
228
+ };
229
+
230
+ var isRegExp = function isRegExp(obj) {
231
+ return Object.prototype.toString.call(obj) === '[object RegExp]';
232
+ };
233
+
234
+ var isBuffer = function isBuffer(obj) {
235
+ if (!obj || typeof obj !== 'object') {
236
+ return false;
237
+ }
238
+
239
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
240
+ };
241
+
242
+ var combine = function combine(a, b) {
243
+ return [].concat(a, b);
244
+ };
245
+
246
+ var maybeMap = function maybeMap(val, fn) {
247
+ if (isArray(val)) {
248
+ var mapped = [];
249
+ for (var i = 0; i < val.length; i += 1) {
250
+ mapped.push(fn(val[i]));
251
+ }
252
+ return mapped;
253
+ }
254
+ return fn(val);
255
+ };
256
+
257
+ module.exports = {
258
+ arrayToObject: arrayToObject,
259
+ assign: assign,
260
+ combine: combine,
261
+ compact: compact,
262
+ decode: decode,
263
+ encode: encode,
264
+ isBuffer: isBuffer,
265
+ isRegExp: isRegExp,
266
+ maybeMap: maybeMap,
267
+ merge: merge
268
+ };
@@ -0,0 +1 @@
1
+ {"name":"qs","description":"A querystring parser that supports nesting and arrays, with a depth limit","homepage":"https://github.com/ljharb/qs","version":"6.13.1","repository":{"type":"git","url":"https://github.com/ljharb/qs.git"},"funding":{"url":"https://github.com/sponsors/ljharb"},"main":"lib/index.js","sideEffects":false,"contributors":[{"name":"Jordan Harband","email":"ljharb@gmail.com","url":"http://ljharb.codes"}],"keywords":["querystring","qs","query","url","parse","stringify"],"engines":{"node":">=0.6"},"dependencies":{"side-channel":"^1.0.6"},"devDependencies":{"@browserify/envify":"^6.0.0","@browserify/uglifyify":"^6.0.0","@ljharb/eslint-config":"^21.1.1","browserify":"^16.5.2","bundle-collapser":"^1.4.0","common-shakeify":"~1.0.0","eclint":"^2.8.1","es-value-fixtures":"^1.5.0","eslint":"=8.8.0","evalmd":"^0.0.19","for-each":"^0.3.3","glob":"=10.3.7","has-bigints":"^1.0.2","has-override-mistake":"^1.0.1","has-property-descriptors":"^1.0.2","has-proto":"^1.0.3","has-symbols":"^1.0.3","iconv-lite":"^0.5.1","in-publish":"^2.0.1","jackspeak":"=2.1.1","mkdirp":"^0.5.5","mock-property":"^1.1.0","module-deps":"^6.2.3","npmignore":"^0.3.1","nyc":"^10.3.2","object-inspect":"^1.13.3","qs-iconv":"^1.0.4","safe-publish-latest":"^2.0.0","safer-buffer":"^2.1.2","tape":"^5.9.0","unassertify":"^3.0.1"},"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated && npm run dist","prepublishOnly":"safe-publish-latest","prepublish":"not-in-publish || npm run prepublishOnly","pretest":"npm run --silent readme && npm run --silent lint","test":"npm run tests-only","tests-only":"nyc tape 'test/**/*.js'","posttest":"npx npm@'>=10.2' audit --production","readme":"evalmd README.md","postlint":"eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)","lint":"eslint --ext=js,mjs .","dist":"mkdirp dist && browserify --standalone Qs -g unassertify -g @browserify/envify -g [@browserify/uglifyify --mangle.keep_fnames --compress.keep_fnames --format.indent_level=1 --compress.arrows=false --compress.passes=4 --compress.typeofs=false] -p common-shakeify -p bundle-collapser/plugin lib/index.js > dist/qs.js"},"license":"BSD-3-Clause","publishConfig":{"ignore":["!dist/*","bower.json","component.json",".github/workflows","logos","tea.yaml"]},"_lastModified":"2025-02-21T02:26:49.659Z"}
@@ -0,0 +1,267 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ emptyTestCases: [
5
+ {
6
+ input: '&',
7
+ withEmptyKeys: {},
8
+ stringifyOutput: {
9
+ brackets: '',
10
+ indices: '',
11
+ repeat: ''
12
+ },
13
+ noEmptyKeys: {}
14
+ },
15
+ {
16
+ input: '&&',
17
+ withEmptyKeys: {},
18
+ stringifyOutput: {
19
+ brackets: '',
20
+ indices: '',
21
+ repeat: ''
22
+ },
23
+ noEmptyKeys: {}
24
+ },
25
+ {
26
+ input: '&=',
27
+ withEmptyKeys: { '': '' },
28
+ stringifyOutput: {
29
+ brackets: '=',
30
+ indices: '=',
31
+ repeat: '='
32
+ },
33
+ noEmptyKeys: {}
34
+ },
35
+ {
36
+ input: '&=&',
37
+ withEmptyKeys: { '': '' },
38
+ stringifyOutput: {
39
+ brackets: '=',
40
+ indices: '=',
41
+ repeat: '='
42
+ },
43
+ noEmptyKeys: {}
44
+ },
45
+ {
46
+ input: '&=&=',
47
+ withEmptyKeys: { '': ['', ''] },
48
+ stringifyOutput: {
49
+ brackets: '[]=&[]=',
50
+ indices: '[0]=&[1]=',
51
+ repeat: '=&='
52
+ },
53
+ noEmptyKeys: {}
54
+ },
55
+ {
56
+ input: '&=&=&',
57
+ withEmptyKeys: { '': ['', ''] },
58
+ stringifyOutput: {
59
+ brackets: '[]=&[]=',
60
+ indices: '[0]=&[1]=',
61
+ repeat: '=&='
62
+ },
63
+ noEmptyKeys: {}
64
+ },
65
+ {
66
+ input: '=',
67
+ withEmptyKeys: { '': '' },
68
+ noEmptyKeys: {},
69
+ stringifyOutput: {
70
+ brackets: '=',
71
+ indices: '=',
72
+ repeat: '='
73
+ }
74
+ },
75
+ {
76
+ input: '=&',
77
+ withEmptyKeys: { '': '' },
78
+ stringifyOutput: {
79
+ brackets: '=',
80
+ indices: '=',
81
+ repeat: '='
82
+ },
83
+ noEmptyKeys: {}
84
+ },
85
+ {
86
+ input: '=&&&',
87
+ withEmptyKeys: { '': '' },
88
+ stringifyOutput: {
89
+ brackets: '=',
90
+ indices: '=',
91
+ repeat: '='
92
+ },
93
+ noEmptyKeys: {}
94
+ },
95
+ {
96
+ input: '=&=&=&',
97
+ withEmptyKeys: { '': ['', '', ''] },
98
+ stringifyOutput: {
99
+ brackets: '[]=&[]=&[]=',
100
+ indices: '[0]=&[1]=&[2]=',
101
+ repeat: '=&=&='
102
+ },
103
+ noEmptyKeys: {}
104
+ },
105
+ {
106
+ input: '=&a[]=b&a[1]=c',
107
+ withEmptyKeys: { '': '', a: ['b', 'c'] },
108
+ stringifyOutput: {
109
+ brackets: '=&a[]=b&a[]=c',
110
+ indices: '=&a[0]=b&a[1]=c',
111
+ repeat: '=&a=b&a=c'
112
+ },
113
+ noEmptyKeys: { a: ['b', 'c'] }
114
+ },
115
+ {
116
+ input: '=a',
117
+ withEmptyKeys: { '': 'a' },
118
+ noEmptyKeys: {},
119
+ stringifyOutput: {
120
+ brackets: '=a',
121
+ indices: '=a',
122
+ repeat: '=a'
123
+ }
124
+ },
125
+ {
126
+ input: 'a==a',
127
+ withEmptyKeys: { a: '=a' },
128
+ noEmptyKeys: { a: '=a' },
129
+ stringifyOutput: {
130
+ brackets: 'a==a',
131
+ indices: 'a==a',
132
+ repeat: 'a==a'
133
+ }
134
+ },
135
+ {
136
+ input: '=&a[]=b',
137
+ withEmptyKeys: { '': '', a: ['b'] },
138
+ stringifyOutput: {
139
+ brackets: '=&a[]=b',
140
+ indices: '=&a[0]=b',
141
+ repeat: '=&a=b'
142
+ },
143
+ noEmptyKeys: { a: ['b'] }
144
+ },
145
+ {
146
+ input: '=&a[]=b&a[]=c&a[2]=d',
147
+ withEmptyKeys: { '': '', a: ['b', 'c', 'd'] },
148
+ stringifyOutput: {
149
+ brackets: '=&a[]=b&a[]=c&a[]=d',
150
+ indices: '=&a[0]=b&a[1]=c&a[2]=d',
151
+ repeat: '=&a=b&a=c&a=d'
152
+ },
153
+ noEmptyKeys: { a: ['b', 'c', 'd'] }
154
+ },
155
+ {
156
+ input: '=a&=b',
157
+ withEmptyKeys: { '': ['a', 'b'] },
158
+ stringifyOutput: {
159
+ brackets: '[]=a&[]=b',
160
+ indices: '[0]=a&[1]=b',
161
+ repeat: '=a&=b'
162
+ },
163
+ noEmptyKeys: {}
164
+ },
165
+ {
166
+ input: '=a&foo=b',
167
+ withEmptyKeys: { '': 'a', foo: 'b' },
168
+ noEmptyKeys: { foo: 'b' },
169
+ stringifyOutput: {
170
+ brackets: '=a&foo=b',
171
+ indices: '=a&foo=b',
172
+ repeat: '=a&foo=b'
173
+ }
174
+ },
175
+ {
176
+ input: 'a[]=b&a=c&=',
177
+ withEmptyKeys: { '': '', a: ['b', 'c'] },
178
+ stringifyOutput: {
179
+ brackets: '=&a[]=b&a[]=c',
180
+ indices: '=&a[0]=b&a[1]=c',
181
+ repeat: '=&a=b&a=c'
182
+ },
183
+ noEmptyKeys: { a: ['b', 'c'] }
184
+ },
185
+ {
186
+ input: 'a[]=b&a=c&=',
187
+ withEmptyKeys: { '': '', a: ['b', 'c'] },
188
+ stringifyOutput: {
189
+ brackets: '=&a[]=b&a[]=c',
190
+ indices: '=&a[0]=b&a[1]=c',
191
+ repeat: '=&a=b&a=c'
192
+ },
193
+ noEmptyKeys: { a: ['b', 'c'] }
194
+ },
195
+ {
196
+ input: 'a[0]=b&a=c&=',
197
+ withEmptyKeys: { '': '', a: ['b', 'c'] },
198
+ stringifyOutput: {
199
+ brackets: '=&a[]=b&a[]=c',
200
+ indices: '=&a[0]=b&a[1]=c',
201
+ repeat: '=&a=b&a=c'
202
+ },
203
+ noEmptyKeys: { a: ['b', 'c'] }
204
+ },
205
+ {
206
+ input: 'a=b&a[]=c&=',
207
+ withEmptyKeys: { '': '', a: ['b', 'c'] },
208
+ stringifyOutput: {
209
+ brackets: '=&a[]=b&a[]=c',
210
+ indices: '=&a[0]=b&a[1]=c',
211
+ repeat: '=&a=b&a=c'
212
+ },
213
+ noEmptyKeys: { a: ['b', 'c'] }
214
+ },
215
+ {
216
+ input: 'a=b&a[0]=c&=',
217
+ withEmptyKeys: { '': '', a: ['b', 'c'] },
218
+ stringifyOutput: {
219
+ brackets: '=&a[]=b&a[]=c',
220
+ indices: '=&a[0]=b&a[1]=c',
221
+ repeat: '=&a=b&a=c'
222
+ },
223
+ noEmptyKeys: { a: ['b', 'c'] }
224
+ },
225
+ {
226
+ input: '[]=a&[]=b& []=1',
227
+ withEmptyKeys: { '': ['a', 'b'], ' ': ['1'] },
228
+ stringifyOutput: {
229
+ brackets: '[]=a&[]=b& []=1',
230
+ indices: '[0]=a&[1]=b& [0]=1',
231
+ repeat: '=a&=b& =1'
232
+ },
233
+ noEmptyKeys: { 0: 'a', 1: 'b', ' ': ['1'] }
234
+ },
235
+ {
236
+ input: '[0]=a&[1]=b&a[0]=1&a[1]=2',
237
+ withEmptyKeys: { '': ['a', 'b'], a: ['1', '2'] },
238
+ noEmptyKeys: { 0: 'a', 1: 'b', a: ['1', '2'] },
239
+ stringifyOutput: {
240
+ brackets: '[]=a&[]=b&a[]=1&a[]=2',
241
+ indices: '[0]=a&[1]=b&a[0]=1&a[1]=2',
242
+ repeat: '=a&=b&a=1&a=2'
243
+ }
244
+ },
245
+ {
246
+ input: '[deep]=a&[deep]=2',
247
+ withEmptyKeys: { '': { deep: ['a', '2'] }
248
+ },
249
+ stringifyOutput: {
250
+ brackets: '[deep][]=a&[deep][]=2',
251
+ indices: '[deep][0]=a&[deep][1]=2',
252
+ repeat: '[deep]=a&[deep]=2'
253
+ },
254
+ noEmptyKeys: { deep: ['a', '2'] }
255
+ },
256
+ {
257
+ input: '%5B0%5D=a&%5B1%5D=b',
258
+ withEmptyKeys: { '': ['a', 'b'] },
259
+ stringifyOutput: {
260
+ brackets: '[]=a&[]=b',
261
+ indices: '[0]=a&[1]=b',
262
+ repeat: '=a&=b'
263
+ },
264
+ noEmptyKeys: { 0: 'a', 1: 'b' }
265
+ }
266
+ ]
267
+ };