@kontent-ai/core-sdk 10.6.0 → 10.7.0
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/cjs/sdk-info.generated.js +1 -1
- package/dist/es6/sdk-info.generated.js +1 -1
- package/dist/esnext/sdk-info.generated.js +1 -1
- package/dist/umd/kontent-core.umd.js +154 -78
- package/dist/umd/kontent-core.umd.js.map +1 -1
- package/dist/umd/kontent-core.umd.min.js +1 -1
- package/dist/umd/kontent-core.umd.min.js.map +1 -1
- package/dist/umd/report.json +1 -1
- package/dist/umd/report.min.json +1 -1
- package/dist/umd/stats.json +27 -27
- package/dist/umd/stats.min.json +27 -27
- package/lib/sdk-info.generated.ts +1 -1
- package/package.json +19 -15
|
@@ -899,7 +899,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
899
899
|
\***************************************************/
|
|
900
900
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
901
901
|
|
|
902
|
-
// Axios v1.7.
|
|
902
|
+
// Axios v1.7.4 Copyright (c) 2024 Matt Zabriskie and contributors
|
|
903
903
|
|
|
904
904
|
|
|
905
905
|
function bind(fn, thisArg) {
|
|
@@ -1575,6 +1575,36 @@ const isAsyncFn = kindOfTest('AsyncFunction');
|
|
|
1575
1575
|
const isThenable = (thing) =>
|
|
1576
1576
|
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
1577
1577
|
|
|
1578
|
+
// original code
|
|
1579
|
+
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
1580
|
+
|
|
1581
|
+
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
1582
|
+
if (setImmediateSupported) {
|
|
1583
|
+
return setImmediate;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
return postMessageSupported ? ((token, callbacks) => {
|
|
1587
|
+
_global.addEventListener("message", ({source, data}) => {
|
|
1588
|
+
if (source === _global && data === token) {
|
|
1589
|
+
callbacks.length && callbacks.shift()();
|
|
1590
|
+
}
|
|
1591
|
+
}, false);
|
|
1592
|
+
|
|
1593
|
+
return (cb) => {
|
|
1594
|
+
callbacks.push(cb);
|
|
1595
|
+
_global.postMessage(token, "*");
|
|
1596
|
+
}
|
|
1597
|
+
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
1598
|
+
})(
|
|
1599
|
+
typeof setImmediate === 'function',
|
|
1600
|
+
isFunction(_global.postMessage)
|
|
1601
|
+
);
|
|
1602
|
+
|
|
1603
|
+
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
1604
|
+
queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
|
|
1605
|
+
|
|
1606
|
+
// *********************
|
|
1607
|
+
|
|
1578
1608
|
var utils$1 = {
|
|
1579
1609
|
isArray,
|
|
1580
1610
|
isArrayBuffer,
|
|
@@ -1630,7 +1660,9 @@ var utils$1 = {
|
|
|
1630
1660
|
isSpecCompliantForm,
|
|
1631
1661
|
toJSONObject,
|
|
1632
1662
|
isAsyncFn,
|
|
1633
|
-
isThenable
|
|
1663
|
+
isThenable,
|
|
1664
|
+
setImmediate: _setImmediate,
|
|
1665
|
+
asap
|
|
1634
1666
|
};
|
|
1635
1667
|
|
|
1636
1668
|
/**
|
|
@@ -2941,31 +2973,42 @@ function speedometer(samplesCount, min) {
|
|
|
2941
2973
|
*/
|
|
2942
2974
|
function throttle(fn, freq) {
|
|
2943
2975
|
let timestamp = 0;
|
|
2944
|
-
|
|
2945
|
-
let
|
|
2946
|
-
|
|
2947
|
-
|
|
2976
|
+
let threshold = 1000 / freq;
|
|
2977
|
+
let lastArgs;
|
|
2978
|
+
let timer;
|
|
2979
|
+
|
|
2980
|
+
const invoke = (args, now = Date.now()) => {
|
|
2981
|
+
timestamp = now;
|
|
2982
|
+
lastArgs = null;
|
|
2983
|
+
if (timer) {
|
|
2984
|
+
clearTimeout(timer);
|
|
2985
|
+
timer = null;
|
|
2986
|
+
}
|
|
2987
|
+
fn.apply(null, args);
|
|
2988
|
+
};
|
|
2948
2989
|
|
|
2990
|
+
const throttled = (...args) => {
|
|
2949
2991
|
const now = Date.now();
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2992
|
+
const passed = now - timestamp;
|
|
2993
|
+
if ( passed >= threshold) {
|
|
2994
|
+
invoke(args, now);
|
|
2995
|
+
} else {
|
|
2996
|
+
lastArgs = args;
|
|
2997
|
+
if (!timer) {
|
|
2998
|
+
timer = setTimeout(() => {
|
|
2999
|
+
timer = null;
|
|
3000
|
+
invoke(lastArgs);
|
|
3001
|
+
}, threshold - passed);
|
|
2954
3002
|
}
|
|
2955
|
-
timestamp = now;
|
|
2956
|
-
return fn.apply(null, arguments);
|
|
2957
|
-
}
|
|
2958
|
-
if (!timer) {
|
|
2959
|
-
timer = setTimeout(() => {
|
|
2960
|
-
timer = null;
|
|
2961
|
-
timestamp = Date.now();
|
|
2962
|
-
return fn.apply(null, arguments);
|
|
2963
|
-
}, threshold - (now - timestamp));
|
|
2964
3003
|
}
|
|
2965
3004
|
};
|
|
3005
|
+
|
|
3006
|
+
const flush = () => lastArgs && invoke(lastArgs);
|
|
3007
|
+
|
|
3008
|
+
return [throttled, flush];
|
|
2966
3009
|
}
|
|
2967
3010
|
|
|
2968
|
-
|
|
3011
|
+
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
2969
3012
|
let bytesNotified = 0;
|
|
2970
3013
|
const _speedometer = speedometer(50, 250);
|
|
2971
3014
|
|
|
@@ -2986,15 +3029,26 @@ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
2986
3029
|
rate: rate ? rate : undefined,
|
|
2987
3030
|
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
2988
3031
|
event: e,
|
|
2989
|
-
lengthComputable: total != null
|
|
3032
|
+
lengthComputable: total != null,
|
|
3033
|
+
[isDownloadStream ? 'download' : 'upload']: true
|
|
2990
3034
|
};
|
|
2991
3035
|
|
|
2992
|
-
data[isDownloadStream ? 'download' : 'upload'] = true;
|
|
2993
|
-
|
|
2994
3036
|
listener(data);
|
|
2995
3037
|
}, freq);
|
|
2996
3038
|
};
|
|
2997
3039
|
|
|
3040
|
+
const progressEventDecorator = (total, throttled) => {
|
|
3041
|
+
const lengthComputable = total != null;
|
|
3042
|
+
|
|
3043
|
+
return [(loaded) => throttled[0]({
|
|
3044
|
+
lengthComputable,
|
|
3045
|
+
total,
|
|
3046
|
+
loaded
|
|
3047
|
+
}), throttled[1]];
|
|
3048
|
+
};
|
|
3049
|
+
|
|
3050
|
+
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
3051
|
+
|
|
2998
3052
|
var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
|
2999
3053
|
|
|
3000
3054
|
// Standard browser envs have full support of the APIs needed to test
|
|
@@ -3299,16 +3353,18 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
3299
3353
|
const _config = resolveConfig(config);
|
|
3300
3354
|
let requestData = _config.data;
|
|
3301
3355
|
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
3302
|
-
let {responseType} = _config;
|
|
3356
|
+
let {responseType, onUploadProgress, onDownloadProgress} = _config;
|
|
3303
3357
|
let onCanceled;
|
|
3358
|
+
let uploadThrottled, downloadThrottled;
|
|
3359
|
+
let flushUpload, flushDownload;
|
|
3360
|
+
|
|
3304
3361
|
function done() {
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
}
|
|
3362
|
+
flushUpload && flushUpload(); // flush events
|
|
3363
|
+
flushDownload && flushDownload(); // flush events
|
|
3308
3364
|
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3365
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
3366
|
+
|
|
3367
|
+
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
|
3312
3368
|
}
|
|
3313
3369
|
|
|
3314
3370
|
let request = new XMLHttpRequest();
|
|
@@ -3378,7 +3434,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
3378
3434
|
return;
|
|
3379
3435
|
}
|
|
3380
3436
|
|
|
3381
|
-
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED,
|
|
3437
|
+
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
3382
3438
|
|
|
3383
3439
|
// Clean up request
|
|
3384
3440
|
request = null;
|
|
@@ -3388,7 +3444,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
3388
3444
|
request.onerror = function handleError() {
|
|
3389
3445
|
// Real errors are hidden from us by the browser
|
|
3390
3446
|
// onerror should only fire if it's a network error
|
|
3391
|
-
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK,
|
|
3447
|
+
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
|
|
3392
3448
|
|
|
3393
3449
|
// Clean up request
|
|
3394
3450
|
request = null;
|
|
@@ -3404,7 +3460,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
3404
3460
|
reject(new AxiosError(
|
|
3405
3461
|
timeoutErrorMessage,
|
|
3406
3462
|
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
3407
|
-
|
|
3463
|
+
config,
|
|
3408
3464
|
request));
|
|
3409
3465
|
|
|
3410
3466
|
// Clean up request
|
|
@@ -3432,13 +3488,18 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
3432
3488
|
}
|
|
3433
3489
|
|
|
3434
3490
|
// Handle progress if needed
|
|
3435
|
-
if (
|
|
3436
|
-
|
|
3491
|
+
if (onDownloadProgress) {
|
|
3492
|
+
([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
|
|
3493
|
+
request.addEventListener('progress', downloadThrottled);
|
|
3437
3494
|
}
|
|
3438
3495
|
|
|
3439
3496
|
// Not all browsers support upload events
|
|
3440
|
-
if (
|
|
3441
|
-
|
|
3497
|
+
if (onUploadProgress && request.upload) {
|
|
3498
|
+
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
|
3499
|
+
|
|
3500
|
+
request.upload.addEventListener('progress', uploadThrottled);
|
|
3501
|
+
|
|
3502
|
+
request.upload.addEventListener('loadend', flushUpload);
|
|
3442
3503
|
}
|
|
3443
3504
|
|
|
3444
3505
|
if (_config.cancelToken || _config.signal) {
|
|
@@ -3544,25 +3605,38 @@ const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
|
|
|
3544
3605
|
const iterator = readBytes(stream, chunkSize, encode);
|
|
3545
3606
|
|
|
3546
3607
|
let bytes = 0;
|
|
3608
|
+
let done;
|
|
3609
|
+
let _onFinish = (e) => {
|
|
3610
|
+
if (!done) {
|
|
3611
|
+
done = true;
|
|
3612
|
+
onFinish && onFinish(e);
|
|
3613
|
+
}
|
|
3614
|
+
};
|
|
3547
3615
|
|
|
3548
3616
|
return new ReadableStream({
|
|
3549
|
-
type: 'bytes',
|
|
3550
|
-
|
|
3551
3617
|
async pull(controller) {
|
|
3552
|
-
|
|
3618
|
+
try {
|
|
3619
|
+
const {done, value} = await iterator.next();
|
|
3553
3620
|
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3621
|
+
if (done) {
|
|
3622
|
+
_onFinish();
|
|
3623
|
+
controller.close();
|
|
3624
|
+
return;
|
|
3625
|
+
}
|
|
3559
3626
|
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3627
|
+
let len = value.byteLength;
|
|
3628
|
+
if (onProgress) {
|
|
3629
|
+
let loadedBytes = bytes += len;
|
|
3630
|
+
onProgress(loadedBytes);
|
|
3631
|
+
}
|
|
3632
|
+
controller.enqueue(new Uint8Array(value));
|
|
3633
|
+
} catch (err) {
|
|
3634
|
+
_onFinish(err);
|
|
3635
|
+
throw err;
|
|
3636
|
+
}
|
|
3563
3637
|
},
|
|
3564
3638
|
cancel(reason) {
|
|
3565
|
-
|
|
3639
|
+
_onFinish(reason);
|
|
3566
3640
|
return iterator.return();
|
|
3567
3641
|
}
|
|
3568
3642
|
}, {
|
|
@@ -3570,15 +3644,6 @@ const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
|
|
|
3570
3644
|
})
|
|
3571
3645
|
};
|
|
3572
3646
|
|
|
3573
|
-
const fetchProgressDecorator = (total, fn) => {
|
|
3574
|
-
const lengthComputable = total != null;
|
|
3575
|
-
return (loaded) => setTimeout(() => fn({
|
|
3576
|
-
lengthComputable,
|
|
3577
|
-
total,
|
|
3578
|
-
loaded
|
|
3579
|
-
}));
|
|
3580
|
-
};
|
|
3581
|
-
|
|
3582
3647
|
const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
|
|
3583
3648
|
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
|
|
3584
3649
|
|
|
@@ -3588,7 +3653,15 @@ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
|
3588
3653
|
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
3589
3654
|
);
|
|
3590
3655
|
|
|
3591
|
-
const
|
|
3656
|
+
const test = (fn, ...args) => {
|
|
3657
|
+
try {
|
|
3658
|
+
return !!fn(...args);
|
|
3659
|
+
} catch (e) {
|
|
3660
|
+
return false
|
|
3661
|
+
}
|
|
3662
|
+
};
|
|
3663
|
+
|
|
3664
|
+
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
3592
3665
|
let duplexAccessed = false;
|
|
3593
3666
|
|
|
3594
3667
|
const hasContentType = new Request(platform.origin, {
|
|
@@ -3601,17 +3674,13 @@ const supportsRequestStream = isReadableStreamSupported && (() => {
|
|
|
3601
3674
|
}).headers.has('Content-Type');
|
|
3602
3675
|
|
|
3603
3676
|
return duplexAccessed && !hasContentType;
|
|
3604
|
-
})
|
|
3677
|
+
});
|
|
3605
3678
|
|
|
3606
3679
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3607
3680
|
|
|
3608
|
-
const supportsResponseStream = isReadableStreamSupported &&
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
} catch(err) {
|
|
3612
|
-
// return undefined
|
|
3613
|
-
}
|
|
3614
|
-
})();
|
|
3681
|
+
const supportsResponseStream = isReadableStreamSupported &&
|
|
3682
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
3683
|
+
|
|
3615
3684
|
|
|
3616
3685
|
const resolvers = {
|
|
3617
3686
|
stream: supportsResponseStream && ((res) => res.body)
|
|
@@ -3639,7 +3708,7 @@ const getBodyLength = async (body) => {
|
|
|
3639
3708
|
return (await new Request(body).arrayBuffer()).byteLength;
|
|
3640
3709
|
}
|
|
3641
3710
|
|
|
3642
|
-
if(utils$1.isArrayBufferView(body)) {
|
|
3711
|
+
if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
3643
3712
|
return body.byteLength;
|
|
3644
3713
|
}
|
|
3645
3714
|
|
|
@@ -3709,15 +3778,17 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
3709
3778
|
}
|
|
3710
3779
|
|
|
3711
3780
|
if (_request.body) {
|
|
3712
|
-
|
|
3781
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
3713
3782
|
requestContentLength,
|
|
3714
|
-
progressEventReducer(onUploadProgress)
|
|
3715
|
-
)
|
|
3783
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
3784
|
+
);
|
|
3785
|
+
|
|
3786
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText);
|
|
3716
3787
|
}
|
|
3717
3788
|
}
|
|
3718
3789
|
|
|
3719
3790
|
if (!utils$1.isString(withCredentials)) {
|
|
3720
|
-
withCredentials = withCredentials ? '
|
|
3791
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
3721
3792
|
}
|
|
3722
3793
|
|
|
3723
3794
|
request = new Request(url, {
|
|
@@ -3727,7 +3798,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
3727
3798
|
headers: headers.normalize().toJSON(),
|
|
3728
3799
|
body: data,
|
|
3729
3800
|
duplex: "half",
|
|
3730
|
-
withCredentials
|
|
3801
|
+
credentials: withCredentials
|
|
3731
3802
|
});
|
|
3732
3803
|
|
|
3733
3804
|
let response = await fetch(request);
|
|
@@ -3743,11 +3814,16 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
3743
3814
|
|
|
3744
3815
|
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
3745
3816
|
|
|
3817
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
3818
|
+
responseContentLength,
|
|
3819
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
3820
|
+
) || [];
|
|
3821
|
+
|
|
3746
3822
|
response = new Response(
|
|
3747
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE,
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3823
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
3824
|
+
flush && flush();
|
|
3825
|
+
isStreamResponse && onFinish();
|
|
3826
|
+
}, encodeText),
|
|
3751
3827
|
options
|
|
3752
3828
|
);
|
|
3753
3829
|
}
|
|
@@ -3933,7 +4009,7 @@ function dispatchRequest(config) {
|
|
|
3933
4009
|
});
|
|
3934
4010
|
}
|
|
3935
4011
|
|
|
3936
|
-
const VERSION = "1.7.
|
|
4012
|
+
const VERSION = "1.7.4";
|
|
3937
4013
|
|
|
3938
4014
|
const validators$1 = {};
|
|
3939
4015
|
|