@qlover/fe-corekit 2.2.0 → 2.3.1
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/index.cjs +75 -54
- package/dist/index.d.ts +350 -16
- package/dist/index.iife.js +75 -53
- package/dist/index.iife.min.js +1 -1
- package/dist/index.js +76 -52
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2511,9 +2511,6 @@ __export(index_exports, {
|
|
|
2511
2511
|
KeyStorage: function() {
|
|
2512
2512
|
return KeyStorage;
|
|
2513
2513
|
},
|
|
2514
|
-
KeyStorageInterface: function() {
|
|
2515
|
-
return KeyStorageInterface;
|
|
2516
|
-
},
|
|
2517
2514
|
ObjectStorage: function() {
|
|
2518
2515
|
return ObjectStorage;
|
|
2519
2516
|
},
|
|
@@ -4152,6 +4149,7 @@ var AbortPlugin = /*#__PURE__*/ function() {
|
|
|
4152
4149
|
* 5. Sets up timeout timer if `abortTimeout` configured
|
|
4153
4150
|
* 6. Injects abort signal into configuration
|
|
4154
4151
|
*
|
|
4152
|
+
* @override
|
|
4155
4153
|
* @param context - Executor context containing parameters and metadata
|
|
4156
4154
|
*
|
|
4157
4155
|
* @example Configuration in context
|
|
@@ -4204,6 +4202,7 @@ var AbortPlugin = /*#__PURE__*/ function() {
|
|
|
4204
4202
|
* Cleans up resources (controller and timeout) for completed operation
|
|
4205
4203
|
* Ensures no memory leaks from successful operations
|
|
4206
4204
|
*
|
|
4205
|
+
* @override
|
|
4207
4206
|
* @param context - Executor context containing parameters and metadata
|
|
4208
4207
|
*
|
|
4209
4208
|
* @example
|
|
@@ -4233,6 +4232,7 @@ var AbortPlugin = /*#__PURE__*/ function() {
|
|
|
4233
4232
|
* 2. If abort error: Extract reason from signal, cleanup resources, return `AbortError`
|
|
4234
4233
|
* 3. If other error: Still cleanup resources to prevent leaks
|
|
4235
4234
|
*
|
|
4235
|
+
* @override
|
|
4236
4236
|
* @param context - Executor context containing error, parameters, and metadata
|
|
4237
4237
|
* @returns `AbortError` if error is abort-related, `void` otherwise
|
|
4238
4238
|
*
|
|
@@ -4618,6 +4618,7 @@ var RetryPlugin = /*#__PURE__*/ function() {
|
|
|
4618
4618
|
* This method intercepts task execution to add retry capability,
|
|
4619
4619
|
* executing the task with the configured retry logic.
|
|
4620
4620
|
*
|
|
4621
|
+
* @override
|
|
4621
4622
|
* @template T - Type of task return value
|
|
4622
4623
|
* @param task - Task to be executed with retry support
|
|
4623
4624
|
* @returns Promise resolving to task result
|
|
@@ -4791,7 +4792,9 @@ var RequestAdapterFetch = /*#__PURE__*/ function() {
|
|
|
4791
4792
|
}
|
|
4792
4793
|
_create_class(RequestAdapterFetch, [
|
|
4793
4794
|
{
|
|
4794
|
-
|
|
4795
|
+
/**
|
|
4796
|
+
* @override
|
|
4797
|
+
*/ key: "getConfig",
|
|
4795
4798
|
value: function getConfig() {
|
|
4796
4799
|
return this.config;
|
|
4797
4800
|
}
|
|
@@ -4929,14 +4932,18 @@ var RequestAdapterAxios = /*#__PURE__*/ function() {
|
|
|
4929
4932
|
}
|
|
4930
4933
|
_create_class(RequestAdapterAxios, [
|
|
4931
4934
|
{
|
|
4932
|
-
|
|
4935
|
+
/**
|
|
4936
|
+
* @override
|
|
4937
|
+
*/ key: "getConfig",
|
|
4933
4938
|
value: function getConfig() {
|
|
4934
4939
|
return this.config;
|
|
4935
4940
|
}
|
|
4936
4941
|
},
|
|
4937
4942
|
{
|
|
4938
4943
|
key: "request",
|
|
4939
|
-
value:
|
|
4944
|
+
value: /**
|
|
4945
|
+
* @override
|
|
4946
|
+
*/ function request(config) {
|
|
4940
4947
|
var _this = this;
|
|
4941
4948
|
return _async_to_generator(function() {
|
|
4942
4949
|
return _ts_generator(this, function(_state) {
|
|
@@ -4990,6 +4997,7 @@ var FetchAbortPlugin = /*#__PURE__*/ function() {
|
|
|
4990
4997
|
* Pre-request hook that sets up abort handling
|
|
4991
4998
|
* Creates new AbortController and cancels any existing request with same key
|
|
4992
4999
|
*
|
|
5000
|
+
* @override
|
|
4993
5001
|
* @param config - Request configuration
|
|
4994
5002
|
* @returns Modified configuration with abort control
|
|
4995
5003
|
*
|
|
@@ -5011,7 +5019,9 @@ var FetchAbortPlugin = /*#__PURE__*/ function() {
|
|
|
5011
5019
|
}
|
|
5012
5020
|
},
|
|
5013
5021
|
{
|
|
5014
|
-
|
|
5022
|
+
/**
|
|
5023
|
+
* @override
|
|
5024
|
+
*/ key: "onSuccess",
|
|
5015
5025
|
value: function onSuccess(param) {
|
|
5016
5026
|
var parameters = param.parameters;
|
|
5017
5027
|
if (parameters) {
|
|
@@ -5024,6 +5034,7 @@ var FetchAbortPlugin = /*#__PURE__*/ function() {
|
|
|
5024
5034
|
* Error handling hook for abort scenarios
|
|
5025
5035
|
* Processes different types of abort errors and cleans up resources
|
|
5026
5036
|
*
|
|
5037
|
+
* @override
|
|
5027
5038
|
* @param error - Original error
|
|
5028
5039
|
* @param config - Request configuration
|
|
5029
5040
|
* @returns RequestError or void
|
|
@@ -5234,6 +5245,7 @@ var FetchURLPlugin = /*#__PURE__*/ function() {
|
|
|
5234
5245
|
/**
|
|
5235
5246
|
* Pre-request hook that builds complete URL
|
|
5236
5247
|
*
|
|
5248
|
+
* @override
|
|
5237
5249
|
* @param config - Request configuration
|
|
5238
5250
|
*
|
|
5239
5251
|
* @example
|
|
@@ -5251,6 +5263,7 @@ var FetchURLPlugin = /*#__PURE__*/ function() {
|
|
|
5251
5263
|
* Success hook that validates response status
|
|
5252
5264
|
* Throws error for non-OK responses
|
|
5253
5265
|
*
|
|
5266
|
+
* @override
|
|
5254
5267
|
* @param result - Fetch response
|
|
5255
5268
|
* @returns Response if OK
|
|
5256
5269
|
* @throws {RequestError} If response is not OK
|
|
@@ -5275,6 +5288,7 @@ var FetchURLPlugin = /*#__PURE__*/ function() {
|
|
|
5275
5288
|
* Error handling hook
|
|
5276
5289
|
* Wraps non-RequestError errors
|
|
5277
5290
|
*
|
|
5291
|
+
* @override
|
|
5278
5292
|
* @param error - Original error
|
|
5279
5293
|
* @returns RequestError
|
|
5280
5294
|
*
|
|
@@ -5589,6 +5603,7 @@ var RequestTransaction = /*#__PURE__*/ function(RequestManager) {
|
|
|
5589
5603
|
{
|
|
5590
5604
|
/**
|
|
5591
5605
|
* Makes an HTTP request with flexible type definitions
|
|
5606
|
+
* @override
|
|
5592
5607
|
* @template Transaction - Can be either the direct response data type or a RequestTransactionInterface
|
|
5593
5608
|
* @param config - Request configuration object
|
|
5594
5609
|
* @returns Promise of response data
|
|
@@ -5982,56 +5997,48 @@ var Base64Serializer = /*#__PURE__*/ function() {
|
|
|
5982
5997
|
]);
|
|
5983
5998
|
return Base64Serializer;
|
|
5984
5999
|
}();
|
|
5985
|
-
// src/storage/
|
|
5986
|
-
var
|
|
5987
|
-
function
|
|
6000
|
+
// src/storage/impl/KeyStorage.ts
|
|
6001
|
+
var KeyStorage = /*#__PURE__*/ function() {
|
|
6002
|
+
function KeyStorage(key) {
|
|
5988
6003
|
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
5989
|
-
_class_call_check(this,
|
|
5990
|
-
var _options_storage;
|
|
6004
|
+
_class_call_check(this, KeyStorage);
|
|
5991
6005
|
this.key = key;
|
|
5992
6006
|
this.options = options;
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
6007
|
+
try {
|
|
6008
|
+
var _options_storage;
|
|
6009
|
+
var localValue = (_options_storage = options.storage) === null || _options_storage === void 0 ? void 0 : _options_storage.getItem(key);
|
|
6010
|
+
this.value = localValue !== null && localValue !== void 0 ? localValue : null;
|
|
6011
|
+
} catch (e) {
|
|
6012
|
+
this.value = null;
|
|
6013
|
+
}
|
|
5996
6014
|
}
|
|
5997
|
-
_create_class(
|
|
6015
|
+
_create_class(KeyStorage, [
|
|
5998
6016
|
{
|
|
5999
|
-
key: "
|
|
6017
|
+
key: "mergeOptions",
|
|
6018
|
+
value: function mergeOptions(options) {
|
|
6019
|
+
return _object_spread({}, this.options, options);
|
|
6020
|
+
}
|
|
6021
|
+
},
|
|
6022
|
+
{
|
|
6023
|
+
/**
|
|
6024
|
+
* @override
|
|
6025
|
+
*/ key: "getKey",
|
|
6000
6026
|
value: function getKey() {
|
|
6001
6027
|
return this.key;
|
|
6002
6028
|
}
|
|
6003
6029
|
},
|
|
6004
6030
|
{
|
|
6005
|
-
|
|
6031
|
+
/**
|
|
6032
|
+
* @override
|
|
6033
|
+
*/ key: "getValue",
|
|
6006
6034
|
value: function getValue() {
|
|
6007
|
-
return this.
|
|
6008
|
-
}
|
|
6009
|
-
}
|
|
6010
|
-
]);
|
|
6011
|
-
return KeyStorageInterface;
|
|
6012
|
-
}();
|
|
6013
|
-
// src/storage/impl/KeyStorage.ts
|
|
6014
|
-
var KeyStorage = /*#__PURE__*/ function(KeyStorageInterface) {
|
|
6015
|
-
_inherits(KeyStorage, KeyStorageInterface);
|
|
6016
|
-
var _super = _create_super(KeyStorage);
|
|
6017
|
-
function KeyStorage() {
|
|
6018
|
-
_class_call_check(this, KeyStorage);
|
|
6019
|
-
var _this;
|
|
6020
|
-
_this = _super.call.apply(_super, [
|
|
6021
|
-
this
|
|
6022
|
-
].concat(Array.prototype.slice.call(arguments)));
|
|
6023
|
-
_this.value = null;
|
|
6024
|
-
return _this;
|
|
6025
|
-
}
|
|
6026
|
-
_create_class(KeyStorage, [
|
|
6027
|
-
{
|
|
6028
|
-
key: "mergeOptions",
|
|
6029
|
-
value: function mergeOptions(options) {
|
|
6030
|
-
return _object_spread({}, this.options, options);
|
|
6035
|
+
return this.value;
|
|
6031
6036
|
}
|
|
6032
6037
|
},
|
|
6033
6038
|
{
|
|
6034
|
-
|
|
6039
|
+
/**
|
|
6040
|
+
* @override
|
|
6041
|
+
*/ key: "get",
|
|
6035
6042
|
value: function get(options) {
|
|
6036
6043
|
var _this_mergeOptions = this.mergeOptions(options), storage = _this_mergeOptions.storage, reset = _object_without_properties(_this_mergeOptions, [
|
|
6037
6044
|
"storage"
|
|
@@ -6052,7 +6059,9 @@ var KeyStorage = /*#__PURE__*/ function(KeyStorageInterface) {
|
|
|
6052
6059
|
}
|
|
6053
6060
|
},
|
|
6054
6061
|
{
|
|
6055
|
-
|
|
6062
|
+
/**
|
|
6063
|
+
* @override
|
|
6064
|
+
*/ key: "set",
|
|
6056
6065
|
value: function set(token, options) {
|
|
6057
6066
|
var _this_mergeOptions = this.mergeOptions(options), storage = _this_mergeOptions.storage, reset = _object_without_properties(_this_mergeOptions, [
|
|
6058
6067
|
"storage"
|
|
@@ -6064,7 +6073,9 @@ var KeyStorage = /*#__PURE__*/ function(KeyStorageInterface) {
|
|
|
6064
6073
|
}
|
|
6065
6074
|
},
|
|
6066
6075
|
{
|
|
6067
|
-
|
|
6076
|
+
/**
|
|
6077
|
+
* @override
|
|
6078
|
+
*/ key: "remove",
|
|
6068
6079
|
value: function remove(options) {
|
|
6069
6080
|
var _this_mergeOptions = this.mergeOptions(options), storage = _this_mergeOptions.storage, reset = _object_without_properties(_this_mergeOptions, [
|
|
6070
6081
|
"storage"
|
|
@@ -6075,7 +6086,7 @@ var KeyStorage = /*#__PURE__*/ function(KeyStorageInterface) {
|
|
|
6075
6086
|
}
|
|
6076
6087
|
]);
|
|
6077
6088
|
return KeyStorage;
|
|
6078
|
-
}(
|
|
6089
|
+
}();
|
|
6079
6090
|
// src/storage/impl/ObjectStorage.ts
|
|
6080
6091
|
var ObjectStorage = /*#__PURE__*/ function() {
|
|
6081
6092
|
function ObjectStorage(serializer) {
|
|
@@ -6185,7 +6196,9 @@ var ObjectStorage = /*#__PURE__*/ function() {
|
|
|
6185
6196
|
}
|
|
6186
6197
|
},
|
|
6187
6198
|
{
|
|
6188
|
-
|
|
6199
|
+
/**
|
|
6200
|
+
* @override
|
|
6201
|
+
*/ key: "getRawValue",
|
|
6189
6202
|
value: function getRawValue(value, defaultValue) {
|
|
6190
6203
|
if (this.isStorageValue(value)) {
|
|
6191
6204
|
if (this.isExpired(value)) {
|
|
@@ -6382,13 +6395,17 @@ var SyncStorage = /*#__PURE__*/ function() {
|
|
|
6382
6395
|
{
|
|
6383
6396
|
key: "length",
|
|
6384
6397
|
get: /**
|
|
6385
|
-
|
|
6386
|
-
|
|
6398
|
+
* Get the number of storage items
|
|
6399
|
+
|
|
6400
|
+
* @override
|
|
6401
|
+
*/ function get() {
|
|
6387
6402
|
return this.storage.length;
|
|
6388
6403
|
}
|
|
6389
6404
|
},
|
|
6390
6405
|
{
|
|
6391
|
-
|
|
6406
|
+
/**
|
|
6407
|
+
* @override
|
|
6408
|
+
*/ key: "setItem",
|
|
6392
6409
|
value: function setItem(key, value, options) {
|
|
6393
6410
|
var processedValue = value;
|
|
6394
6411
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -6426,7 +6443,9 @@ var SyncStorage = /*#__PURE__*/ function() {
|
|
|
6426
6443
|
}
|
|
6427
6444
|
},
|
|
6428
6445
|
{
|
|
6429
|
-
|
|
6446
|
+
/**
|
|
6447
|
+
* @override
|
|
6448
|
+
*/ key: "getItem",
|
|
6430
6449
|
value: function getItem(key, defaultValue, options) {
|
|
6431
6450
|
var processedValue = this.storage.getItem(key, defaultValue, options);
|
|
6432
6451
|
if (processedValue == null) {
|
|
@@ -6504,6 +6523,7 @@ var SyncStorage = /*#__PURE__*/ function() {
|
|
|
6504
6523
|
/**
|
|
6505
6524
|
* Delete data items, delete from all storage layers
|
|
6506
6525
|
*
|
|
6526
|
+
* @override
|
|
6507
6527
|
* @param key - Storage key
|
|
6508
6528
|
* @param options - Delete options
|
|
6509
6529
|
*/ key: "removeItem",
|
|
@@ -6518,8 +6538,10 @@ var SyncStorage = /*#__PURE__*/ function() {
|
|
|
6518
6538
|
},
|
|
6519
6539
|
{
|
|
6520
6540
|
/**
|
|
6521
|
-
|
|
6522
|
-
|
|
6541
|
+
* Clear all data, including storage in the pipeline
|
|
6542
|
+
|
|
6543
|
+
* @override
|
|
6544
|
+
*/ key: "clear",
|
|
6523
6545
|
value: function clear() {
|
|
6524
6546
|
this.storage.clear();
|
|
6525
6547
|
this.pipes.filter(function(p) {
|
|
@@ -6545,7 +6567,6 @@ var SyncStorage = /*#__PURE__*/ function() {
|
|
|
6545
6567
|
FetchURLPlugin: FetchURLPlugin,
|
|
6546
6568
|
JSONSerializer: JSONSerializer,
|
|
6547
6569
|
KeyStorage: KeyStorage,
|
|
6548
|
-
KeyStorageInterface: KeyStorageInterface,
|
|
6549
6570
|
ObjectStorage: ObjectStorage,
|
|
6550
6571
|
RequestAdapterAxios: RequestAdapterAxios,
|
|
6551
6572
|
RequestAdapterFetch: RequestAdapterFetch,
|