@malevich-studio/strapi-sdk-typescript 1.2.26 → 1.2.28
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/cli.cjs +251 -268
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +251 -268
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +249 -267
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +249 -267
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -2
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var require$$0 = require('util');
|
|
4
|
-
var require$$1 = require('tty');
|
|
5
|
-
var require$$0$1 = require('os');
|
|
4
|
+
var require$$0$1 = require('tty');
|
|
6
5
|
|
|
7
6
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
8
7
|
|
|
@@ -17539,13 +17538,16 @@ function requireObjectInspect () {
|
|
|
17539
17538
|
return $replace.call(String(s), /"/g, '"');
|
|
17540
17539
|
}
|
|
17541
17540
|
|
|
17542
|
-
function
|
|
17543
|
-
|
|
17544
|
-
|
|
17545
|
-
function
|
|
17546
|
-
function
|
|
17547
|
-
function
|
|
17548
|
-
function
|
|
17541
|
+
function canTrustToString(obj) {
|
|
17542
|
+
return !toStringTag || !(typeof obj === 'object' && (toStringTag in obj || typeof obj[toStringTag] !== 'undefined'));
|
|
17543
|
+
}
|
|
17544
|
+
function isArray(obj) { return toStr(obj) === '[object Array]' && canTrustToString(obj); }
|
|
17545
|
+
function isDate(obj) { return toStr(obj) === '[object Date]' && canTrustToString(obj); }
|
|
17546
|
+
function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && canTrustToString(obj); }
|
|
17547
|
+
function isError(obj) { return toStr(obj) === '[object Error]' && canTrustToString(obj); }
|
|
17548
|
+
function isString(obj) { return toStr(obj) === '[object String]' && canTrustToString(obj); }
|
|
17549
|
+
function isNumber(obj) { return toStr(obj) === '[object Number]' && canTrustToString(obj); }
|
|
17550
|
+
function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && canTrustToString(obj); }
|
|
17549
17551
|
|
|
17550
17552
|
// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
|
|
17551
17553
|
function isSymbol(obj) {
|
|
@@ -18434,7 +18436,7 @@ function requireCallBindApplyHelpers () {
|
|
|
18434
18436
|
var $call = requireFunctionCall();
|
|
18435
18437
|
var $actualApply = requireActualApply();
|
|
18436
18438
|
|
|
18437
|
-
/** @type {import('.')
|
|
18439
|
+
/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
|
|
18438
18440
|
callBindApplyHelpers = function callBindBasic(args) {
|
|
18439
18441
|
if (args.length < 1 || typeof args[0] !== 'function') {
|
|
18440
18442
|
throw new $TypeError('a function is required');
|
|
@@ -18630,6 +18632,7 @@ function requireGetIntrinsic () {
|
|
|
18630
18632
|
'%Error%': $Error,
|
|
18631
18633
|
'%eval%': eval, // eslint-disable-line no-eval
|
|
18632
18634
|
'%EvalError%': $EvalError,
|
|
18635
|
+
'%Float16Array%': typeof Float16Array === 'undefined' ? undefined$1 : Float16Array,
|
|
18633
18636
|
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
|
|
18634
18637
|
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
|
|
18635
18638
|
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
|
|
@@ -18934,10 +18937,11 @@ function requireCallBound () {
|
|
|
18934
18937
|
|
|
18935
18938
|
/** @type {import('.')} */
|
|
18936
18939
|
callBound = function callBoundIntrinsic(name, allowMissing) {
|
|
18937
|
-
|
|
18938
|
-
|
|
18940
|
+
/* eslint no-extra-parens: 0 */
|
|
18941
|
+
|
|
18942
|
+
var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing));
|
|
18939
18943
|
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
|
18940
|
-
return callBindBasic([intrinsic]);
|
|
18944
|
+
return callBindBasic(/** @type {const} */ ([intrinsic]));
|
|
18941
18945
|
}
|
|
18942
18946
|
return intrinsic;
|
|
18943
18947
|
};
|
|
@@ -19201,7 +19205,7 @@ function requireUtils () {
|
|
|
19201
19205
|
if (hasRequiredUtils) return utils;
|
|
19202
19206
|
hasRequiredUtils = 1;
|
|
19203
19207
|
|
|
19204
|
-
var formats = requireFormats();
|
|
19208
|
+
var formats = /*@__PURE__*/ requireFormats();
|
|
19205
19209
|
|
|
19206
19210
|
var has = Object.prototype.hasOwnProperty;
|
|
19207
19211
|
var isArray = Array.isArray;
|
|
@@ -19235,7 +19239,7 @@ function requireUtils () {
|
|
|
19235
19239
|
};
|
|
19236
19240
|
|
|
19237
19241
|
var arrayToObject = function arrayToObject(source, options) {
|
|
19238
|
-
var obj = options && options.plainObjects ?
|
|
19242
|
+
var obj = options && options.plainObjects ? { __proto__: null } : {};
|
|
19239
19243
|
for (var i = 0; i < source.length; ++i) {
|
|
19240
19244
|
if (typeof source[i] !== 'undefined') {
|
|
19241
19245
|
obj[i] = source[i];
|
|
@@ -19251,11 +19255,14 @@ function requireUtils () {
|
|
|
19251
19255
|
return target;
|
|
19252
19256
|
}
|
|
19253
19257
|
|
|
19254
|
-
if (typeof source !== 'object') {
|
|
19258
|
+
if (typeof source !== 'object' && typeof source !== 'function') {
|
|
19255
19259
|
if (isArray(target)) {
|
|
19256
19260
|
target.push(source);
|
|
19257
19261
|
} else if (target && typeof target === 'object') {
|
|
19258
|
-
if (
|
|
19262
|
+
if (
|
|
19263
|
+
(options && (options.plainObjects || options.allowPrototypes))
|
|
19264
|
+
|| !has.call(Object.prototype, source)
|
|
19265
|
+
) {
|
|
19259
19266
|
target[source] = true;
|
|
19260
19267
|
}
|
|
19261
19268
|
} else {
|
|
@@ -19309,7 +19316,7 @@ function requireUtils () {
|
|
|
19309
19316
|
}, target);
|
|
19310
19317
|
};
|
|
19311
19318
|
|
|
19312
|
-
var decode = function (str,
|
|
19319
|
+
var decode = function (str, defaultDecoder, charset) {
|
|
19313
19320
|
var strWithoutPlus = str.replace(/\+/g, ' ');
|
|
19314
19321
|
if (charset === 'iso-8859-1') {
|
|
19315
19322
|
// unescape never throws, no try...catch needed:
|
|
@@ -19323,6 +19330,10 @@ function requireUtils () {
|
|
|
19323
19330
|
}
|
|
19324
19331
|
};
|
|
19325
19332
|
|
|
19333
|
+
var limit = 1024;
|
|
19334
|
+
|
|
19335
|
+
/* eslint operator-linebreak: [2, "before"] */
|
|
19336
|
+
|
|
19326
19337
|
var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
|
19327
19338
|
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
|
|
19328
19339
|
// It has been adapted here for stricter adherence to RFC 3986
|
|
@@ -19344,45 +19355,54 @@ function requireUtils () {
|
|
|
19344
19355
|
}
|
|
19345
19356
|
|
|
19346
19357
|
var out = '';
|
|
19347
|
-
for (var
|
|
19348
|
-
var
|
|
19349
|
-
|
|
19350
|
-
|
|
19351
|
-
|
|
19352
|
-
|
|
19353
|
-
|
|
19354
|
-
|
|
19355
|
-
|
|
19356
|
-
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19358
|
+
for (var j = 0; j < string.length; j += limit) {
|
|
19359
|
+
var segment = string.length >= limit ? string.slice(j, j + limit) : string;
|
|
19360
|
+
var arr = [];
|
|
19361
|
+
|
|
19362
|
+
for (var i = 0; i < segment.length; ++i) {
|
|
19363
|
+
var c = segment.charCodeAt(i);
|
|
19364
|
+
if (
|
|
19365
|
+
c === 0x2D // -
|
|
19366
|
+
|| c === 0x2E // .
|
|
19367
|
+
|| c === 0x5F // _
|
|
19368
|
+
|| c === 0x7E // ~
|
|
19369
|
+
|| (c >= 0x30 && c <= 0x39) // 0-9
|
|
19370
|
+
|| (c >= 0x41 && c <= 0x5A) // a-z
|
|
19371
|
+
|| (c >= 0x61 && c <= 0x7A) // A-Z
|
|
19372
|
+
|| (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
|
19373
|
+
) {
|
|
19374
|
+
arr[arr.length] = segment.charAt(i);
|
|
19375
|
+
continue;
|
|
19376
|
+
}
|
|
19363
19377
|
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19367
|
-
|
|
19378
|
+
if (c < 0x80) {
|
|
19379
|
+
arr[arr.length] = hexTable[c];
|
|
19380
|
+
continue;
|
|
19381
|
+
}
|
|
19368
19382
|
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
|
|
19383
|
+
if (c < 0x800) {
|
|
19384
|
+
arr[arr.length] = hexTable[0xC0 | (c >> 6)]
|
|
19385
|
+
+ hexTable[0x80 | (c & 0x3F)];
|
|
19386
|
+
continue;
|
|
19387
|
+
}
|
|
19373
19388
|
|
|
19374
|
-
|
|
19375
|
-
|
|
19376
|
-
|
|
19389
|
+
if (c < 0xD800 || c >= 0xE000) {
|
|
19390
|
+
arr[arr.length] = hexTable[0xE0 | (c >> 12)]
|
|
19391
|
+
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
|
19392
|
+
+ hexTable[0x80 | (c & 0x3F)];
|
|
19393
|
+
continue;
|
|
19394
|
+
}
|
|
19395
|
+
|
|
19396
|
+
i += 1;
|
|
19397
|
+
c = 0x10000 + (((c & 0x3FF) << 10) | (segment.charCodeAt(i) & 0x3FF));
|
|
19398
|
+
|
|
19399
|
+
arr[arr.length] = hexTable[0xF0 | (c >> 18)]
|
|
19400
|
+
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
|
19401
|
+
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
|
19402
|
+
+ hexTable[0x80 | (c & 0x3F)];
|
|
19377
19403
|
}
|
|
19378
19404
|
|
|
19379
|
-
|
|
19380
|
-
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
|
19381
|
-
/* eslint operator-linebreak: [2, "before"] */
|
|
19382
|
-
out += hexTable[0xF0 | (c >> 18)]
|
|
19383
|
-
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
|
19384
|
-
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
|
19385
|
-
+ hexTable[0x80 | (c & 0x3F)];
|
|
19405
|
+
out += arr.join('');
|
|
19386
19406
|
}
|
|
19387
19407
|
|
|
19388
19408
|
return out;
|
|
@@ -19462,8 +19482,8 @@ function requireStringify () {
|
|
|
19462
19482
|
hasRequiredStringify = 1;
|
|
19463
19483
|
|
|
19464
19484
|
var getSideChannel = requireSideChannel();
|
|
19465
|
-
var utils = requireUtils();
|
|
19466
|
-
var formats = requireFormats();
|
|
19485
|
+
var utils = /*@__PURE__*/ requireUtils();
|
|
19486
|
+
var formats = /*@__PURE__*/ requireFormats();
|
|
19467
19487
|
var has = Object.prototype.hasOwnProperty;
|
|
19468
19488
|
|
|
19469
19489
|
var arrayPrefixGenerators = {
|
|
@@ -19491,12 +19511,17 @@ function requireStringify () {
|
|
|
19491
19511
|
var defaults = {
|
|
19492
19512
|
addQueryPrefix: false,
|
|
19493
19513
|
allowDots: false,
|
|
19514
|
+
allowEmptyArrays: false,
|
|
19515
|
+
arrayFormat: 'indices',
|
|
19494
19516
|
charset: 'utf-8',
|
|
19495
19517
|
charsetSentinel: false,
|
|
19518
|
+
commaRoundTrip: false,
|
|
19496
19519
|
delimiter: '&',
|
|
19497
19520
|
encode: true,
|
|
19521
|
+
encodeDotInKeys: false,
|
|
19498
19522
|
encoder: utils.encode,
|
|
19499
19523
|
encodeValuesOnly: false,
|
|
19524
|
+
filter: void 0,
|
|
19500
19525
|
format: defaultFormat,
|
|
19501
19526
|
formatter: formats.formatters[defaultFormat],
|
|
19502
19527
|
// deprecated
|
|
@@ -19523,8 +19548,10 @@ function requireStringify () {
|
|
|
19523
19548
|
prefix,
|
|
19524
19549
|
generateArrayPrefix,
|
|
19525
19550
|
commaRoundTrip,
|
|
19551
|
+
allowEmptyArrays,
|
|
19526
19552
|
strictNullHandling,
|
|
19527
19553
|
skipNulls,
|
|
19554
|
+
encodeDotInKeys,
|
|
19528
19555
|
encoder,
|
|
19529
19556
|
filter,
|
|
19530
19557
|
sort,
|
|
@@ -19606,19 +19633,28 @@ function requireStringify () {
|
|
|
19606
19633
|
objKeys = sort ? keys.sort(sort) : keys;
|
|
19607
19634
|
}
|
|
19608
19635
|
|
|
19609
|
-
var
|
|
19636
|
+
var encodedPrefix = encodeDotInKeys ? String(prefix).replace(/\./g, '%2E') : String(prefix);
|
|
19637
|
+
|
|
19638
|
+
var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + '[]' : encodedPrefix;
|
|
19639
|
+
|
|
19640
|
+
if (allowEmptyArrays && isArray(obj) && obj.length === 0) {
|
|
19641
|
+
return adjustedPrefix + '[]';
|
|
19642
|
+
}
|
|
19610
19643
|
|
|
19611
19644
|
for (var j = 0; j < objKeys.length; ++j) {
|
|
19612
19645
|
var key = objKeys[j];
|
|
19613
|
-
var value = typeof key === 'object' && typeof key.value !== 'undefined'
|
|
19646
|
+
var value = typeof key === 'object' && key && typeof key.value !== 'undefined'
|
|
19647
|
+
? key.value
|
|
19648
|
+
: obj[key];
|
|
19614
19649
|
|
|
19615
19650
|
if (skipNulls && value === null) {
|
|
19616
19651
|
continue;
|
|
19617
19652
|
}
|
|
19618
19653
|
|
|
19654
|
+
var encodedKey = allowDots && encodeDotInKeys ? String(key).replace(/\./g, '%2E') : String(key);
|
|
19619
19655
|
var keyPrefix = isArray(obj)
|
|
19620
|
-
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix,
|
|
19621
|
-
: adjustedPrefix + (allowDots ? '.' +
|
|
19656
|
+
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix
|
|
19657
|
+
: adjustedPrefix + (allowDots ? '.' + encodedKey : '[' + encodedKey + ']');
|
|
19622
19658
|
|
|
19623
19659
|
sideChannel.set(object, step);
|
|
19624
19660
|
var valueSideChannel = getSideChannel();
|
|
@@ -19628,8 +19664,10 @@ function requireStringify () {
|
|
|
19628
19664
|
keyPrefix,
|
|
19629
19665
|
generateArrayPrefix,
|
|
19630
19666
|
commaRoundTrip,
|
|
19667
|
+
allowEmptyArrays,
|
|
19631
19668
|
strictNullHandling,
|
|
19632
19669
|
skipNulls,
|
|
19670
|
+
encodeDotInKeys,
|
|
19633
19671
|
generateArrayPrefix === 'comma' && encodeValuesOnly && isArray(obj) ? null : encoder,
|
|
19634
19672
|
filter,
|
|
19635
19673
|
sort,
|
|
@@ -19651,6 +19689,14 @@ function requireStringify () {
|
|
|
19651
19689
|
return defaults;
|
|
19652
19690
|
}
|
|
19653
19691
|
|
|
19692
|
+
if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
|
|
19693
|
+
throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
|
|
19694
|
+
}
|
|
19695
|
+
|
|
19696
|
+
if (typeof opts.encodeDotInKeys !== 'undefined' && typeof opts.encodeDotInKeys !== 'boolean') {
|
|
19697
|
+
throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided');
|
|
19698
|
+
}
|
|
19699
|
+
|
|
19654
19700
|
if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
|
|
19655
19701
|
throw new TypeError('Encoder has to be a function.');
|
|
19656
19702
|
}
|
|
@@ -19674,13 +19720,32 @@ function requireStringify () {
|
|
|
19674
19720
|
filter = opts.filter;
|
|
19675
19721
|
}
|
|
19676
19722
|
|
|
19723
|
+
var arrayFormat;
|
|
19724
|
+
if (opts.arrayFormat in arrayPrefixGenerators) {
|
|
19725
|
+
arrayFormat = opts.arrayFormat;
|
|
19726
|
+
} else if ('indices' in opts) {
|
|
19727
|
+
arrayFormat = opts.indices ? 'indices' : 'repeat';
|
|
19728
|
+
} else {
|
|
19729
|
+
arrayFormat = defaults.arrayFormat;
|
|
19730
|
+
}
|
|
19731
|
+
|
|
19732
|
+
if ('commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
|
19733
|
+
throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
|
19734
|
+
}
|
|
19735
|
+
|
|
19736
|
+
var allowDots = typeof opts.allowDots === 'undefined' ? opts.encodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
|
|
19737
|
+
|
|
19677
19738
|
return {
|
|
19678
19739
|
addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,
|
|
19679
|
-
allowDots:
|
|
19740
|
+
allowDots: allowDots,
|
|
19741
|
+
allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
|
|
19742
|
+
arrayFormat: arrayFormat,
|
|
19680
19743
|
charset: charset,
|
|
19681
19744
|
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
19745
|
+
commaRoundTrip: !!opts.commaRoundTrip,
|
|
19682
19746
|
delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,
|
|
19683
19747
|
encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,
|
|
19748
|
+
encodeDotInKeys: typeof opts.encodeDotInKeys === 'boolean' ? opts.encodeDotInKeys : defaults.encodeDotInKeys,
|
|
19684
19749
|
encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
|
|
19685
19750
|
encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
|
|
19686
19751
|
filter: filter,
|
|
@@ -19714,20 +19779,8 @@ function requireStringify () {
|
|
|
19714
19779
|
return '';
|
|
19715
19780
|
}
|
|
19716
19781
|
|
|
19717
|
-
var arrayFormat;
|
|
19718
|
-
|
|
19719
|
-
arrayFormat = opts.arrayFormat;
|
|
19720
|
-
} else if (opts && 'indices' in opts) {
|
|
19721
|
-
arrayFormat = opts.indices ? 'indices' : 'repeat';
|
|
19722
|
-
} else {
|
|
19723
|
-
arrayFormat = 'indices';
|
|
19724
|
-
}
|
|
19725
|
-
|
|
19726
|
-
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
|
|
19727
|
-
if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
|
19728
|
-
throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
|
19729
|
-
}
|
|
19730
|
-
var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
|
|
19782
|
+
var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat];
|
|
19783
|
+
var commaRoundTrip = generateArrayPrefix === 'comma' && options.commaRoundTrip;
|
|
19731
19784
|
|
|
19732
19785
|
if (!objKeys) {
|
|
19733
19786
|
objKeys = Object.keys(obj);
|
|
@@ -19740,17 +19793,20 @@ function requireStringify () {
|
|
|
19740
19793
|
var sideChannel = getSideChannel();
|
|
19741
19794
|
for (var i = 0; i < objKeys.length; ++i) {
|
|
19742
19795
|
var key = objKeys[i];
|
|
19796
|
+
var value = obj[key];
|
|
19743
19797
|
|
|
19744
|
-
if (options.skipNulls &&
|
|
19798
|
+
if (options.skipNulls && value === null) {
|
|
19745
19799
|
continue;
|
|
19746
19800
|
}
|
|
19747
19801
|
pushToArray(keys, stringify(
|
|
19748
|
-
|
|
19802
|
+
value,
|
|
19749
19803
|
key,
|
|
19750
19804
|
generateArrayPrefix,
|
|
19751
19805
|
commaRoundTrip,
|
|
19806
|
+
options.allowEmptyArrays,
|
|
19752
19807
|
options.strictNullHandling,
|
|
19753
19808
|
options.skipNulls,
|
|
19809
|
+
options.encodeDotInKeys,
|
|
19754
19810
|
options.encode ? options.encoder : null,
|
|
19755
19811
|
options.filter,
|
|
19756
19812
|
options.sort,
|
|
@@ -19789,28 +19845,33 @@ function requireParse () {
|
|
|
19789
19845
|
if (hasRequiredParse) return parse;
|
|
19790
19846
|
hasRequiredParse = 1;
|
|
19791
19847
|
|
|
19792
|
-
var utils = requireUtils();
|
|
19848
|
+
var utils = /*@__PURE__*/ requireUtils();
|
|
19793
19849
|
|
|
19794
19850
|
var has = Object.prototype.hasOwnProperty;
|
|
19795
19851
|
var isArray = Array.isArray;
|
|
19796
19852
|
|
|
19797
19853
|
var defaults = {
|
|
19798
19854
|
allowDots: false,
|
|
19855
|
+
allowEmptyArrays: false,
|
|
19799
19856
|
allowPrototypes: false,
|
|
19800
19857
|
allowSparse: false,
|
|
19801
19858
|
arrayLimit: 20,
|
|
19802
19859
|
charset: 'utf-8',
|
|
19803
19860
|
charsetSentinel: false,
|
|
19804
19861
|
comma: false,
|
|
19862
|
+
decodeDotInKeys: false,
|
|
19805
19863
|
decoder: utils.decode,
|
|
19806
19864
|
delimiter: '&',
|
|
19807
19865
|
depth: 5,
|
|
19866
|
+
duplicates: 'combine',
|
|
19808
19867
|
ignoreQueryPrefix: false,
|
|
19809
19868
|
interpretNumericEntities: false,
|
|
19810
19869
|
parameterLimit: 1000,
|
|
19811
19870
|
parseArrays: true,
|
|
19812
19871
|
plainObjects: false,
|
|
19813
|
-
|
|
19872
|
+
strictDepth: false,
|
|
19873
|
+
strictNullHandling: false,
|
|
19874
|
+
throwOnLimitExceeded: false
|
|
19814
19875
|
};
|
|
19815
19876
|
|
|
19816
19877
|
var interpretNumericEntities = function (str) {
|
|
@@ -19819,11 +19880,15 @@ function requireParse () {
|
|
|
19819
19880
|
});
|
|
19820
19881
|
};
|
|
19821
19882
|
|
|
19822
|
-
var parseArrayValue = function (val, options) {
|
|
19883
|
+
var parseArrayValue = function (val, options, currentArrayLength) {
|
|
19823
19884
|
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
|
|
19824
19885
|
return val.split(',');
|
|
19825
19886
|
}
|
|
19826
19887
|
|
|
19888
|
+
if (options.throwOnLimitExceeded && currentArrayLength >= options.arrayLimit) {
|
|
19889
|
+
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
19890
|
+
}
|
|
19891
|
+
|
|
19827
19892
|
return val;
|
|
19828
19893
|
};
|
|
19829
19894
|
|
|
@@ -19838,10 +19903,21 @@ function requireParse () {
|
|
|
19838
19903
|
var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
|
|
19839
19904
|
|
|
19840
19905
|
var parseValues = function parseQueryStringValues(str, options) {
|
|
19841
|
-
var obj = {};
|
|
19906
|
+
var obj = { __proto__: null };
|
|
19907
|
+
|
|
19842
19908
|
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
|
19909
|
+
cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
|
|
19910
|
+
|
|
19843
19911
|
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
|
19844
|
-
var parts = cleanStr.split(
|
|
19912
|
+
var parts = cleanStr.split(
|
|
19913
|
+
options.delimiter,
|
|
19914
|
+
options.throwOnLimitExceeded ? limit + 1 : limit
|
|
19915
|
+
);
|
|
19916
|
+
|
|
19917
|
+
if (options.throwOnLimitExceeded && parts.length > limit) {
|
|
19918
|
+
throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
|
|
19919
|
+
}
|
|
19920
|
+
|
|
19845
19921
|
var skipIndex = -1; // Keep track of where the utf8 sentinel was found
|
|
19846
19922
|
var i;
|
|
19847
19923
|
|
|
@@ -19869,14 +19945,20 @@ function requireParse () {
|
|
|
19869
19945
|
var bracketEqualsPos = part.indexOf(']=');
|
|
19870
19946
|
var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
|
|
19871
19947
|
|
|
19872
|
-
var key
|
|
19948
|
+
var key;
|
|
19949
|
+
var val;
|
|
19873
19950
|
if (pos === -1) {
|
|
19874
19951
|
key = options.decoder(part, defaults.decoder, charset, 'key');
|
|
19875
19952
|
val = options.strictNullHandling ? null : '';
|
|
19876
19953
|
} else {
|
|
19877
19954
|
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
|
|
19955
|
+
|
|
19878
19956
|
val = utils.maybeMap(
|
|
19879
|
-
parseArrayValue(
|
|
19957
|
+
parseArrayValue(
|
|
19958
|
+
part.slice(pos + 1),
|
|
19959
|
+
options,
|
|
19960
|
+
isArray(obj[key]) ? obj[key].length : 0
|
|
19961
|
+
),
|
|
19880
19962
|
function (encodedVal) {
|
|
19881
19963
|
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
|
|
19882
19964
|
}
|
|
@@ -19884,16 +19966,17 @@ function requireParse () {
|
|
|
19884
19966
|
}
|
|
19885
19967
|
|
|
19886
19968
|
if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
|
|
19887
|
-
val = interpretNumericEntities(val);
|
|
19969
|
+
val = interpretNumericEntities(String(val));
|
|
19888
19970
|
}
|
|
19889
19971
|
|
|
19890
19972
|
if (part.indexOf('[]=') > -1) {
|
|
19891
19973
|
val = isArray(val) ? [val] : val;
|
|
19892
19974
|
}
|
|
19893
19975
|
|
|
19894
|
-
|
|
19976
|
+
var existing = has.call(obj, key);
|
|
19977
|
+
if (existing && options.duplicates === 'combine') {
|
|
19895
19978
|
obj[key] = utils.combine(obj[key], val);
|
|
19896
|
-
} else {
|
|
19979
|
+
} else if (!existing || options.duplicates === 'last') {
|
|
19897
19980
|
obj[key] = val;
|
|
19898
19981
|
}
|
|
19899
19982
|
}
|
|
@@ -19902,31 +19985,40 @@ function requireParse () {
|
|
|
19902
19985
|
};
|
|
19903
19986
|
|
|
19904
19987
|
var parseObject = function (chain, val, options, valuesParsed) {
|
|
19905
|
-
var
|
|
19988
|
+
var currentArrayLength = 0;
|
|
19989
|
+
if (chain.length > 0 && chain[chain.length - 1] === '[]') {
|
|
19990
|
+
var parentKey = chain.slice(0, -1).join('');
|
|
19991
|
+
currentArrayLength = Array.isArray(val) && val[parentKey] ? val[parentKey].length : 0;
|
|
19992
|
+
}
|
|
19993
|
+
|
|
19994
|
+
var leaf = valuesParsed ? val : parseArrayValue(val, options, currentArrayLength);
|
|
19906
19995
|
|
|
19907
19996
|
for (var i = chain.length - 1; i >= 0; --i) {
|
|
19908
19997
|
var obj;
|
|
19909
19998
|
var root = chain[i];
|
|
19910
19999
|
|
|
19911
20000
|
if (root === '[]' && options.parseArrays) {
|
|
19912
|
-
obj =
|
|
20001
|
+
obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))
|
|
20002
|
+
? []
|
|
20003
|
+
: utils.combine([], leaf);
|
|
19913
20004
|
} else {
|
|
19914
|
-
obj = options.plainObjects ?
|
|
20005
|
+
obj = options.plainObjects ? { __proto__: null } : {};
|
|
19915
20006
|
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
|
19916
|
-
var
|
|
19917
|
-
|
|
20007
|
+
var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot;
|
|
20008
|
+
var index = parseInt(decodedRoot, 10);
|
|
20009
|
+
if (!options.parseArrays && decodedRoot === '') {
|
|
19918
20010
|
obj = { 0: leaf };
|
|
19919
20011
|
} else if (
|
|
19920
20012
|
!isNaN(index)
|
|
19921
|
-
&& root !==
|
|
19922
|
-
&& String(index) ===
|
|
20013
|
+
&& root !== decodedRoot
|
|
20014
|
+
&& String(index) === decodedRoot
|
|
19923
20015
|
&& index >= 0
|
|
19924
20016
|
&& (options.parseArrays && index <= options.arrayLimit)
|
|
19925
20017
|
) {
|
|
19926
20018
|
obj = [];
|
|
19927
20019
|
obj[index] = leaf;
|
|
19928
|
-
} else if (
|
|
19929
|
-
obj[
|
|
20020
|
+
} else if (decodedRoot !== '__proto__') {
|
|
20021
|
+
obj[decodedRoot] = leaf;
|
|
19930
20022
|
}
|
|
19931
20023
|
}
|
|
19932
20024
|
|
|
@@ -19981,9 +20073,12 @@ function requireParse () {
|
|
|
19981
20073
|
keys.push(segment[1]);
|
|
19982
20074
|
}
|
|
19983
20075
|
|
|
19984
|
-
// If there's a remainder, just add whatever is left
|
|
20076
|
+
// If there's a remainder, check strictDepth option for throw, else just add whatever is left
|
|
19985
20077
|
|
|
19986
20078
|
if (segment) {
|
|
20079
|
+
if (options.strictDepth === true) {
|
|
20080
|
+
throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
|
|
20081
|
+
}
|
|
19987
20082
|
keys.push('[' + key.slice(segment.index) + ']');
|
|
19988
20083
|
}
|
|
19989
20084
|
|
|
@@ -19995,33 +20090,59 @@ function requireParse () {
|
|
|
19995
20090
|
return defaults;
|
|
19996
20091
|
}
|
|
19997
20092
|
|
|
19998
|
-
if (
|
|
20093
|
+
if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
|
|
20094
|
+
throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
|
|
20095
|
+
}
|
|
20096
|
+
|
|
20097
|
+
if (typeof opts.decodeDotInKeys !== 'undefined' && typeof opts.decodeDotInKeys !== 'boolean') {
|
|
20098
|
+
throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided');
|
|
20099
|
+
}
|
|
20100
|
+
|
|
20101
|
+
if (opts.decoder !== null && typeof opts.decoder !== 'undefined' && typeof opts.decoder !== 'function') {
|
|
19999
20102
|
throw new TypeError('Decoder has to be a function.');
|
|
20000
20103
|
}
|
|
20001
20104
|
|
|
20002
20105
|
if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
|
|
20003
20106
|
throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
|
|
20004
20107
|
}
|
|
20108
|
+
|
|
20109
|
+
if (typeof opts.throwOnLimitExceeded !== 'undefined' && typeof opts.throwOnLimitExceeded !== 'boolean') {
|
|
20110
|
+
throw new TypeError('`throwOnLimitExceeded` option must be a boolean');
|
|
20111
|
+
}
|
|
20112
|
+
|
|
20005
20113
|
var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
|
|
20006
20114
|
|
|
20115
|
+
var duplicates = typeof opts.duplicates === 'undefined' ? defaults.duplicates : opts.duplicates;
|
|
20116
|
+
|
|
20117
|
+
if (duplicates !== 'combine' && duplicates !== 'first' && duplicates !== 'last') {
|
|
20118
|
+
throw new TypeError('The duplicates option must be either combine, first, or last');
|
|
20119
|
+
}
|
|
20120
|
+
|
|
20121
|
+
var allowDots = typeof opts.allowDots === 'undefined' ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
|
|
20122
|
+
|
|
20007
20123
|
return {
|
|
20008
|
-
allowDots:
|
|
20124
|
+
allowDots: allowDots,
|
|
20125
|
+
allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
|
|
20009
20126
|
allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
|
|
20010
20127
|
allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
|
|
20011
20128
|
arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
|
|
20012
20129
|
charset: charset,
|
|
20013
20130
|
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
20014
20131
|
comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
|
|
20132
|
+
decodeDotInKeys: typeof opts.decodeDotInKeys === 'boolean' ? opts.decodeDotInKeys : defaults.decodeDotInKeys,
|
|
20015
20133
|
decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
|
|
20016
20134
|
delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
|
|
20017
20135
|
// eslint-disable-next-line no-implicit-coercion, no-extra-parens
|
|
20018
20136
|
depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
|
|
20137
|
+
duplicates: duplicates,
|
|
20019
20138
|
ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
|
|
20020
20139
|
interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
|
|
20021
20140
|
parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
|
|
20022
20141
|
parseArrays: opts.parseArrays !== false,
|
|
20023
20142
|
plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
|
|
20024
|
-
|
|
20143
|
+
strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth,
|
|
20144
|
+
strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling,
|
|
20145
|
+
throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === 'boolean' ? opts.throwOnLimitExceeded : false
|
|
20025
20146
|
};
|
|
20026
20147
|
};
|
|
20027
20148
|
|
|
@@ -20029,11 +20150,11 @@ function requireParse () {
|
|
|
20029
20150
|
var options = normalizeParseOptions(opts);
|
|
20030
20151
|
|
|
20031
20152
|
if (str === '' || str === null || typeof str === 'undefined') {
|
|
20032
|
-
return options.plainObjects ?
|
|
20153
|
+
return options.plainObjects ? { __proto__: null } : {};
|
|
20033
20154
|
}
|
|
20034
20155
|
|
|
20035
20156
|
var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
|
|
20036
|
-
var obj = options.plainObjects ?
|
|
20157
|
+
var obj = options.plainObjects ? { __proto__: null } : {};
|
|
20037
20158
|
|
|
20038
20159
|
// Iterate over the keys and setup the new object
|
|
20039
20160
|
|
|
@@ -20060,9 +20181,9 @@ function requireLib () {
|
|
|
20060
20181
|
if (hasRequiredLib) return lib;
|
|
20061
20182
|
hasRequiredLib = 1;
|
|
20062
20183
|
|
|
20063
|
-
var stringify = requireStringify();
|
|
20064
|
-
var parse = requireParse();
|
|
20065
|
-
var formats = requireFormats();
|
|
20184
|
+
var stringify = /*@__PURE__*/ requireStringify();
|
|
20185
|
+
var parse = /*@__PURE__*/ requireParse();
|
|
20186
|
+
var formats = /*@__PURE__*/ requireFormats();
|
|
20066
20187
|
|
|
20067
20188
|
lib = {
|
|
20068
20189
|
formats: formats,
|
|
@@ -20072,7 +20193,7 @@ function requireLib () {
|
|
|
20072
20193
|
return lib;
|
|
20073
20194
|
}
|
|
20074
20195
|
|
|
20075
|
-
var libExports = requireLib();
|
|
20196
|
+
var libExports = /*@__PURE__*/ requireLib();
|
|
20076
20197
|
var qs = /*@__PURE__*/getDefaultExportFromCjs(libExports);
|
|
20077
20198
|
|
|
20078
20199
|
var src = {exports: {}};
|
|
@@ -20834,165 +20955,6 @@ function requireBrowser () {
|
|
|
20834
20955
|
|
|
20835
20956
|
var node = {exports: {}};
|
|
20836
20957
|
|
|
20837
|
-
var hasFlag;
|
|
20838
|
-
var hasRequiredHasFlag;
|
|
20839
|
-
|
|
20840
|
-
function requireHasFlag () {
|
|
20841
|
-
if (hasRequiredHasFlag) return hasFlag;
|
|
20842
|
-
hasRequiredHasFlag = 1;
|
|
20843
|
-
|
|
20844
|
-
hasFlag = (flag, argv = process.argv) => {
|
|
20845
|
-
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
|
20846
|
-
const position = argv.indexOf(prefix + flag);
|
|
20847
|
-
const terminatorPosition = argv.indexOf('--');
|
|
20848
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
20849
|
-
};
|
|
20850
|
-
return hasFlag;
|
|
20851
|
-
}
|
|
20852
|
-
|
|
20853
|
-
var supportsColor_1;
|
|
20854
|
-
var hasRequiredSupportsColor;
|
|
20855
|
-
|
|
20856
|
-
function requireSupportsColor () {
|
|
20857
|
-
if (hasRequiredSupportsColor) return supportsColor_1;
|
|
20858
|
-
hasRequiredSupportsColor = 1;
|
|
20859
|
-
const os = require$$0$1;
|
|
20860
|
-
const tty = require$$1;
|
|
20861
|
-
const hasFlag = requireHasFlag();
|
|
20862
|
-
|
|
20863
|
-
const {env} = process;
|
|
20864
|
-
|
|
20865
|
-
let forceColor;
|
|
20866
|
-
if (hasFlag('no-color') ||
|
|
20867
|
-
hasFlag('no-colors') ||
|
|
20868
|
-
hasFlag('color=false') ||
|
|
20869
|
-
hasFlag('color=never')) {
|
|
20870
|
-
forceColor = 0;
|
|
20871
|
-
} else if (hasFlag('color') ||
|
|
20872
|
-
hasFlag('colors') ||
|
|
20873
|
-
hasFlag('color=true') ||
|
|
20874
|
-
hasFlag('color=always')) {
|
|
20875
|
-
forceColor = 1;
|
|
20876
|
-
}
|
|
20877
|
-
|
|
20878
|
-
if ('FORCE_COLOR' in env) {
|
|
20879
|
-
if (env.FORCE_COLOR === 'true') {
|
|
20880
|
-
forceColor = 1;
|
|
20881
|
-
} else if (env.FORCE_COLOR === 'false') {
|
|
20882
|
-
forceColor = 0;
|
|
20883
|
-
} else {
|
|
20884
|
-
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
20885
|
-
}
|
|
20886
|
-
}
|
|
20887
|
-
|
|
20888
|
-
function translateLevel(level) {
|
|
20889
|
-
if (level === 0) {
|
|
20890
|
-
return false;
|
|
20891
|
-
}
|
|
20892
|
-
|
|
20893
|
-
return {
|
|
20894
|
-
level,
|
|
20895
|
-
hasBasic: true,
|
|
20896
|
-
has256: level >= 2,
|
|
20897
|
-
has16m: level >= 3
|
|
20898
|
-
};
|
|
20899
|
-
}
|
|
20900
|
-
|
|
20901
|
-
function supportsColor(haveStream, streamIsTTY) {
|
|
20902
|
-
if (forceColor === 0) {
|
|
20903
|
-
return 0;
|
|
20904
|
-
}
|
|
20905
|
-
|
|
20906
|
-
if (hasFlag('color=16m') ||
|
|
20907
|
-
hasFlag('color=full') ||
|
|
20908
|
-
hasFlag('color=truecolor')) {
|
|
20909
|
-
return 3;
|
|
20910
|
-
}
|
|
20911
|
-
|
|
20912
|
-
if (hasFlag('color=256')) {
|
|
20913
|
-
return 2;
|
|
20914
|
-
}
|
|
20915
|
-
|
|
20916
|
-
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
20917
|
-
return 0;
|
|
20918
|
-
}
|
|
20919
|
-
|
|
20920
|
-
const min = forceColor || 0;
|
|
20921
|
-
|
|
20922
|
-
if (env.TERM === 'dumb') {
|
|
20923
|
-
return min;
|
|
20924
|
-
}
|
|
20925
|
-
|
|
20926
|
-
if (process.platform === 'win32') {
|
|
20927
|
-
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
|
20928
|
-
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
|
20929
|
-
const osRelease = os.release().split('.');
|
|
20930
|
-
if (
|
|
20931
|
-
Number(osRelease[0]) >= 10 &&
|
|
20932
|
-
Number(osRelease[2]) >= 10586
|
|
20933
|
-
) {
|
|
20934
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
20935
|
-
}
|
|
20936
|
-
|
|
20937
|
-
return 1;
|
|
20938
|
-
}
|
|
20939
|
-
|
|
20940
|
-
if ('CI' in env) {
|
|
20941
|
-
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
20942
|
-
return 1;
|
|
20943
|
-
}
|
|
20944
|
-
|
|
20945
|
-
return min;
|
|
20946
|
-
}
|
|
20947
|
-
|
|
20948
|
-
if ('TEAMCITY_VERSION' in env) {
|
|
20949
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
20950
|
-
}
|
|
20951
|
-
|
|
20952
|
-
if (env.COLORTERM === 'truecolor') {
|
|
20953
|
-
return 3;
|
|
20954
|
-
}
|
|
20955
|
-
|
|
20956
|
-
if ('TERM_PROGRAM' in env) {
|
|
20957
|
-
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
20958
|
-
|
|
20959
|
-
switch (env.TERM_PROGRAM) {
|
|
20960
|
-
case 'iTerm.app':
|
|
20961
|
-
return version >= 3 ? 3 : 2;
|
|
20962
|
-
case 'Apple_Terminal':
|
|
20963
|
-
return 2;
|
|
20964
|
-
// No default
|
|
20965
|
-
}
|
|
20966
|
-
}
|
|
20967
|
-
|
|
20968
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
20969
|
-
return 2;
|
|
20970
|
-
}
|
|
20971
|
-
|
|
20972
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
20973
|
-
return 1;
|
|
20974
|
-
}
|
|
20975
|
-
|
|
20976
|
-
if ('COLORTERM' in env) {
|
|
20977
|
-
return 1;
|
|
20978
|
-
}
|
|
20979
|
-
|
|
20980
|
-
return min;
|
|
20981
|
-
}
|
|
20982
|
-
|
|
20983
|
-
function getSupportLevel(stream) {
|
|
20984
|
-
const level = supportsColor(stream, stream && stream.isTTY);
|
|
20985
|
-
return translateLevel(level);
|
|
20986
|
-
}
|
|
20987
|
-
|
|
20988
|
-
supportsColor_1 = {
|
|
20989
|
-
supportsColor: getSupportLevel,
|
|
20990
|
-
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
20991
|
-
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
20992
|
-
};
|
|
20993
|
-
return supportsColor_1;
|
|
20994
|
-
}
|
|
20995
|
-
|
|
20996
20958
|
/**
|
|
20997
20959
|
* Module dependencies.
|
|
20998
20960
|
*/
|
|
@@ -21003,7 +20965,7 @@ function requireNode () {
|
|
|
21003
20965
|
if (hasRequiredNode) return node.exports;
|
|
21004
20966
|
hasRequiredNode = 1;
|
|
21005
20967
|
(function (module, exports) {
|
|
21006
|
-
const tty = require$$1;
|
|
20968
|
+
const tty = require$$0$1;
|
|
21007
20969
|
const util = require$$0;
|
|
21008
20970
|
|
|
21009
20971
|
/**
|
|
@@ -21030,7 +20992,7 @@ function requireNode () {
|
|
|
21030
20992
|
try {
|
|
21031
20993
|
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
|
21032
20994
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
21033
|
-
const supportsColor =
|
|
20995
|
+
const supportsColor = require('supports-color');
|
|
21034
20996
|
|
|
21035
20997
|
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
21036
20998
|
exports.colors = [
|
|
@@ -21449,14 +21411,34 @@ class Strapi {
|
|
|
21449
21411
|
log(data);
|
|
21450
21412
|
return data;
|
|
21451
21413
|
}
|
|
21414
|
+
mergePermissionsPreferChild(parentPermissions, childPermissions) {
|
|
21415
|
+
// Child permissions should override parent on conflicts; missing entries inherit from parent
|
|
21416
|
+
return _.merge({}, parentPermissions, childPermissions);
|
|
21417
|
+
}
|
|
21418
|
+
async fetchRolePermissions(roleId) {
|
|
21419
|
+
const response = await this.fetchData(`users-permissions/roles/${roleId}`);
|
|
21420
|
+
const parentId = typeof response.role.parent === 'number' ? response.role.parent : response.role.parent?.id;
|
|
21421
|
+
return { permissions: response.role.permissions, parentId };
|
|
21422
|
+
}
|
|
21423
|
+
async collectRolePermissions(roleId) {
|
|
21424
|
+
// Start with the immediate role's permissions, then walk up parents, merging so child overrides parent
|
|
21425
|
+
const { permissions: initialPermissions, parentId: initialParentId } = await this.fetchRolePermissions(roleId);
|
|
21426
|
+
let accumulatedPermissions = _.cloneDeep(initialPermissions);
|
|
21427
|
+
let currentParentId = initialParentId;
|
|
21428
|
+
while (currentParentId) {
|
|
21429
|
+
const { permissions: parentPermissions, parentId } = await this.fetchRolePermissions(currentParentId);
|
|
21430
|
+
accumulatedPermissions = this.mergePermissionsPreferChild(parentPermissions, accumulatedPermissions);
|
|
21431
|
+
currentParentId = parentId;
|
|
21432
|
+
}
|
|
21433
|
+
return accumulatedPermissions;
|
|
21434
|
+
}
|
|
21452
21435
|
async can(uid, controller, action) {
|
|
21453
21436
|
if (!this.permissionsList) {
|
|
21454
21437
|
const user = await this.baseMe({ populate: { role: { fields: ["id"] } } });
|
|
21455
21438
|
if (user.error) {
|
|
21456
21439
|
return false;
|
|
21457
21440
|
}
|
|
21458
|
-
|
|
21459
|
-
this.permissionsList = response.role.permissions;
|
|
21441
|
+
this.permissionsList = await this.collectRolePermissions(user.role.id);
|
|
21460
21442
|
}
|
|
21461
21443
|
if (!this.permissionsList[uid]) {
|
|
21462
21444
|
throw new Error(`Permissions for ${uid} not found!`);
|