@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.js
CHANGED
|
@@ -4073,6 +4073,7 @@ var AbortPlugin = /*#__PURE__*/ function() {
|
|
|
4073
4073
|
* 5. Sets up timeout timer if `abortTimeout` configured
|
|
4074
4074
|
* 6. Injects abort signal into configuration
|
|
4075
4075
|
*
|
|
4076
|
+
* @override
|
|
4076
4077
|
* @param context - Executor context containing parameters and metadata
|
|
4077
4078
|
*
|
|
4078
4079
|
* @example Configuration in context
|
|
@@ -4125,6 +4126,7 @@ var AbortPlugin = /*#__PURE__*/ function() {
|
|
|
4125
4126
|
* Cleans up resources (controller and timeout) for completed operation
|
|
4126
4127
|
* Ensures no memory leaks from successful operations
|
|
4127
4128
|
*
|
|
4129
|
+
* @override
|
|
4128
4130
|
* @param context - Executor context containing parameters and metadata
|
|
4129
4131
|
*
|
|
4130
4132
|
* @example
|
|
@@ -4154,6 +4156,7 @@ var AbortPlugin = /*#__PURE__*/ function() {
|
|
|
4154
4156
|
* 2. If abort error: Extract reason from signal, cleanup resources, return `AbortError`
|
|
4155
4157
|
* 3. If other error: Still cleanup resources to prevent leaks
|
|
4156
4158
|
*
|
|
4159
|
+
* @override
|
|
4157
4160
|
* @param context - Executor context containing error, parameters, and metadata
|
|
4158
4161
|
* @returns `AbortError` if error is abort-related, `void` otherwise
|
|
4159
4162
|
*
|
|
@@ -4540,6 +4543,7 @@ var RetryPlugin = /*#__PURE__*/ function() {
|
|
|
4540
4543
|
* This method intercepts task execution to add retry capability,
|
|
4541
4544
|
* executing the task with the configured retry logic.
|
|
4542
4545
|
*
|
|
4546
|
+
* @override
|
|
4543
4547
|
* @template T - Type of task return value
|
|
4544
4548
|
* @param task - Task to be executed with retry support
|
|
4545
4549
|
* @returns Promise resolving to task result
|
|
@@ -4715,7 +4719,9 @@ var RequestAdapterFetch = /*#__PURE__*/ function() {
|
|
|
4715
4719
|
}
|
|
4716
4720
|
_create_class(RequestAdapterFetch, [
|
|
4717
4721
|
{
|
|
4718
|
-
|
|
4722
|
+
/**
|
|
4723
|
+
* @override
|
|
4724
|
+
*/ key: "getConfig",
|
|
4719
4725
|
value: function getConfig() {
|
|
4720
4726
|
return this.config;
|
|
4721
4727
|
}
|
|
@@ -4854,14 +4860,18 @@ var RequestAdapterAxios = /*#__PURE__*/ function() {
|
|
|
4854
4860
|
}
|
|
4855
4861
|
_create_class(RequestAdapterAxios, [
|
|
4856
4862
|
{
|
|
4857
|
-
|
|
4863
|
+
/**
|
|
4864
|
+
* @override
|
|
4865
|
+
*/ key: "getConfig",
|
|
4858
4866
|
value: function getConfig() {
|
|
4859
4867
|
return this.config;
|
|
4860
4868
|
}
|
|
4861
4869
|
},
|
|
4862
4870
|
{
|
|
4863
4871
|
key: "request",
|
|
4864
|
-
value:
|
|
4872
|
+
value: /**
|
|
4873
|
+
* @override
|
|
4874
|
+
*/ function request(config) {
|
|
4865
4875
|
var _this = this;
|
|
4866
4876
|
return _async_to_generator(function() {
|
|
4867
4877
|
return _ts_generator(this, function(_state) {
|
|
@@ -4916,6 +4926,7 @@ var FetchAbortPlugin = /*#__PURE__*/ function() {
|
|
|
4916
4926
|
* Pre-request hook that sets up abort handling
|
|
4917
4927
|
* Creates new AbortController and cancels any existing request with same key
|
|
4918
4928
|
*
|
|
4929
|
+
* @override
|
|
4919
4930
|
* @param config - Request configuration
|
|
4920
4931
|
* @returns Modified configuration with abort control
|
|
4921
4932
|
*
|
|
@@ -4937,7 +4948,9 @@ var FetchAbortPlugin = /*#__PURE__*/ function() {
|
|
|
4937
4948
|
}
|
|
4938
4949
|
},
|
|
4939
4950
|
{
|
|
4940
|
-
|
|
4951
|
+
/**
|
|
4952
|
+
* @override
|
|
4953
|
+
*/ key: "onSuccess",
|
|
4941
4954
|
value: function onSuccess(param) {
|
|
4942
4955
|
var parameters = param.parameters;
|
|
4943
4956
|
if (parameters) {
|
|
@@ -4950,6 +4963,7 @@ var FetchAbortPlugin = /*#__PURE__*/ function() {
|
|
|
4950
4963
|
* Error handling hook for abort scenarios
|
|
4951
4964
|
* Processes different types of abort errors and cleans up resources
|
|
4952
4965
|
*
|
|
4966
|
+
* @override
|
|
4953
4967
|
* @param error - Original error
|
|
4954
4968
|
* @param config - Request configuration
|
|
4955
4969
|
* @returns RequestError or void
|
|
@@ -5161,6 +5175,7 @@ var FetchURLPlugin = /*#__PURE__*/ function() {
|
|
|
5161
5175
|
/**
|
|
5162
5176
|
* Pre-request hook that builds complete URL
|
|
5163
5177
|
*
|
|
5178
|
+
* @override
|
|
5164
5179
|
* @param config - Request configuration
|
|
5165
5180
|
*
|
|
5166
5181
|
* @example
|
|
@@ -5178,6 +5193,7 @@ var FetchURLPlugin = /*#__PURE__*/ function() {
|
|
|
5178
5193
|
* Success hook that validates response status
|
|
5179
5194
|
* Throws error for non-OK responses
|
|
5180
5195
|
*
|
|
5196
|
+
* @override
|
|
5181
5197
|
* @param result - Fetch response
|
|
5182
5198
|
* @returns Response if OK
|
|
5183
5199
|
* @throws {RequestError} If response is not OK
|
|
@@ -5202,6 +5218,7 @@ var FetchURLPlugin = /*#__PURE__*/ function() {
|
|
|
5202
5218
|
* Error handling hook
|
|
5203
5219
|
* Wraps non-RequestError errors
|
|
5204
5220
|
*
|
|
5221
|
+
* @override
|
|
5205
5222
|
* @param error - Original error
|
|
5206
5223
|
* @returns RequestError
|
|
5207
5224
|
*
|
|
@@ -5519,6 +5536,7 @@ var RequestTransaction = /*#__PURE__*/ function(RequestManager) {
|
|
|
5519
5536
|
{
|
|
5520
5537
|
/**
|
|
5521
5538
|
* Makes an HTTP request with flexible type definitions
|
|
5539
|
+
* @override
|
|
5522
5540
|
* @template Transaction - Can be either the direct response data type or a RequestTransactionInterface
|
|
5523
5541
|
* @param config - Request configuration object
|
|
5524
5542
|
* @returns Promise of response data
|
|
@@ -5914,58 +5932,49 @@ var Base64Serializer = /*#__PURE__*/ function() {
|
|
|
5914
5932
|
]);
|
|
5915
5933
|
return Base64Serializer;
|
|
5916
5934
|
}();
|
|
5917
|
-
// src/storage/
|
|
5918
|
-
var
|
|
5935
|
+
// src/storage/impl/KeyStorage.ts
|
|
5936
|
+
var KeyStorage = /*#__PURE__*/ function() {
|
|
5919
5937
|
"use strict";
|
|
5920
|
-
function
|
|
5938
|
+
function KeyStorage(key) {
|
|
5921
5939
|
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
5922
|
-
_class_call_check(this,
|
|
5923
|
-
var _options_storage;
|
|
5940
|
+
_class_call_check(this, KeyStorage);
|
|
5924
5941
|
this.key = key;
|
|
5925
5942
|
this.options = options;
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5943
|
+
try {
|
|
5944
|
+
var _options_storage;
|
|
5945
|
+
var localValue = (_options_storage = options.storage) === null || _options_storage === void 0 ? void 0 : _options_storage.getItem(key);
|
|
5946
|
+
this.value = localValue !== null && localValue !== void 0 ? localValue : null;
|
|
5947
|
+
} catch (e) {
|
|
5948
|
+
this.value = null;
|
|
5949
|
+
}
|
|
5929
5950
|
}
|
|
5930
|
-
_create_class(
|
|
5951
|
+
_create_class(KeyStorage, [
|
|
5931
5952
|
{
|
|
5932
|
-
key: "
|
|
5953
|
+
key: "mergeOptions",
|
|
5954
|
+
value: function mergeOptions(options) {
|
|
5955
|
+
return _object_spread({}, this.options, options);
|
|
5956
|
+
}
|
|
5957
|
+
},
|
|
5958
|
+
{
|
|
5959
|
+
/**
|
|
5960
|
+
* @override
|
|
5961
|
+
*/ key: "getKey",
|
|
5933
5962
|
value: function getKey() {
|
|
5934
5963
|
return this.key;
|
|
5935
5964
|
}
|
|
5936
5965
|
},
|
|
5937
5966
|
{
|
|
5938
|
-
|
|
5967
|
+
/**
|
|
5968
|
+
* @override
|
|
5969
|
+
*/ key: "getValue",
|
|
5939
5970
|
value: function getValue() {
|
|
5940
|
-
return this.
|
|
5941
|
-
}
|
|
5942
|
-
}
|
|
5943
|
-
]);
|
|
5944
|
-
return KeyStorageInterface;
|
|
5945
|
-
}();
|
|
5946
|
-
// src/storage/impl/KeyStorage.ts
|
|
5947
|
-
var KeyStorage = /*#__PURE__*/ function(KeyStorageInterface) {
|
|
5948
|
-
"use strict";
|
|
5949
|
-
_inherits(KeyStorage, KeyStorageInterface);
|
|
5950
|
-
var _super = _create_super(KeyStorage);
|
|
5951
|
-
function KeyStorage() {
|
|
5952
|
-
_class_call_check(this, KeyStorage);
|
|
5953
|
-
var _this;
|
|
5954
|
-
_this = _super.call.apply(_super, [
|
|
5955
|
-
this
|
|
5956
|
-
].concat(Array.prototype.slice.call(arguments)));
|
|
5957
|
-
_this.value = null;
|
|
5958
|
-
return _this;
|
|
5959
|
-
}
|
|
5960
|
-
_create_class(KeyStorage, [
|
|
5961
|
-
{
|
|
5962
|
-
key: "mergeOptions",
|
|
5963
|
-
value: function mergeOptions(options) {
|
|
5964
|
-
return _object_spread({}, this.options, options);
|
|
5971
|
+
return this.value;
|
|
5965
5972
|
}
|
|
5966
5973
|
},
|
|
5967
5974
|
{
|
|
5968
|
-
|
|
5975
|
+
/**
|
|
5976
|
+
* @override
|
|
5977
|
+
*/ key: "get",
|
|
5969
5978
|
value: function get(options) {
|
|
5970
5979
|
var _this_mergeOptions = this.mergeOptions(options), storage = _this_mergeOptions.storage, reset = _object_without_properties(_this_mergeOptions, [
|
|
5971
5980
|
"storage"
|
|
@@ -5986,7 +5995,9 @@ var KeyStorage = /*#__PURE__*/ function(KeyStorageInterface) {
|
|
|
5986
5995
|
}
|
|
5987
5996
|
},
|
|
5988
5997
|
{
|
|
5989
|
-
|
|
5998
|
+
/**
|
|
5999
|
+
* @override
|
|
6000
|
+
*/ key: "set",
|
|
5990
6001
|
value: function set(token, options) {
|
|
5991
6002
|
var _this_mergeOptions = this.mergeOptions(options), storage = _this_mergeOptions.storage, reset = _object_without_properties(_this_mergeOptions, [
|
|
5992
6003
|
"storage"
|
|
@@ -5998,7 +6009,9 @@ var KeyStorage = /*#__PURE__*/ function(KeyStorageInterface) {
|
|
|
5998
6009
|
}
|
|
5999
6010
|
},
|
|
6000
6011
|
{
|
|
6001
|
-
|
|
6012
|
+
/**
|
|
6013
|
+
* @override
|
|
6014
|
+
*/ key: "remove",
|
|
6002
6015
|
value: function remove(options) {
|
|
6003
6016
|
var _this_mergeOptions = this.mergeOptions(options), storage = _this_mergeOptions.storage, reset = _object_without_properties(_this_mergeOptions, [
|
|
6004
6017
|
"storage"
|
|
@@ -6009,7 +6022,7 @@ var KeyStorage = /*#__PURE__*/ function(KeyStorageInterface) {
|
|
|
6009
6022
|
}
|
|
6010
6023
|
]);
|
|
6011
6024
|
return KeyStorage;
|
|
6012
|
-
}(
|
|
6025
|
+
}();
|
|
6013
6026
|
// src/storage/impl/ObjectStorage.ts
|
|
6014
6027
|
var ObjectStorage = /*#__PURE__*/ function() {
|
|
6015
6028
|
"use strict";
|
|
@@ -6120,7 +6133,9 @@ var ObjectStorage = /*#__PURE__*/ function() {
|
|
|
6120
6133
|
}
|
|
6121
6134
|
},
|
|
6122
6135
|
{
|
|
6123
|
-
|
|
6136
|
+
/**
|
|
6137
|
+
* @override
|
|
6138
|
+
*/ key: "getRawValue",
|
|
6124
6139
|
value: function getRawValue(value, defaultValue) {
|
|
6125
6140
|
if (this.isStorageValue(value)) {
|
|
6126
6141
|
if (this.isExpired(value)) {
|
|
@@ -6318,13 +6333,17 @@ var SyncStorage = /*#__PURE__*/ function() {
|
|
|
6318
6333
|
{
|
|
6319
6334
|
key: "length",
|
|
6320
6335
|
get: /**
|
|
6321
|
-
|
|
6322
|
-
|
|
6336
|
+
* Get the number of storage items
|
|
6337
|
+
|
|
6338
|
+
* @override
|
|
6339
|
+
*/ function get() {
|
|
6323
6340
|
return this.storage.length;
|
|
6324
6341
|
}
|
|
6325
6342
|
},
|
|
6326
6343
|
{
|
|
6327
|
-
|
|
6344
|
+
/**
|
|
6345
|
+
* @override
|
|
6346
|
+
*/ key: "setItem",
|
|
6328
6347
|
value: function setItem(key, value, options) {
|
|
6329
6348
|
var processedValue = value;
|
|
6330
6349
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -6362,7 +6381,9 @@ var SyncStorage = /*#__PURE__*/ function() {
|
|
|
6362
6381
|
}
|
|
6363
6382
|
},
|
|
6364
6383
|
{
|
|
6365
|
-
|
|
6384
|
+
/**
|
|
6385
|
+
* @override
|
|
6386
|
+
*/ key: "getItem",
|
|
6366
6387
|
value: function getItem(key, defaultValue, options) {
|
|
6367
6388
|
var processedValue = this.storage.getItem(key, defaultValue, options);
|
|
6368
6389
|
if (processedValue == null) {
|
|
@@ -6440,6 +6461,7 @@ var SyncStorage = /*#__PURE__*/ function() {
|
|
|
6440
6461
|
/**
|
|
6441
6462
|
* Delete data items, delete from all storage layers
|
|
6442
6463
|
*
|
|
6464
|
+
* @override
|
|
6443
6465
|
* @param key - Storage key
|
|
6444
6466
|
* @param options - Delete options
|
|
6445
6467
|
*/ key: "removeItem",
|
|
@@ -6454,8 +6476,10 @@ var SyncStorage = /*#__PURE__*/ function() {
|
|
|
6454
6476
|
},
|
|
6455
6477
|
{
|
|
6456
6478
|
/**
|
|
6457
|
-
|
|
6458
|
-
|
|
6479
|
+
* Clear all data, including storage in the pipeline
|
|
6480
|
+
|
|
6481
|
+
* @override
|
|
6482
|
+
*/ key: "clear",
|
|
6459
6483
|
value: function clear() {
|
|
6460
6484
|
this.storage.clear();
|
|
6461
6485
|
this.pipes.filter(function(p) {
|
|
@@ -6468,4 +6492,4 @@ var SyncStorage = /*#__PURE__*/ function() {
|
|
|
6468
6492
|
]);
|
|
6469
6493
|
return SyncStorage;
|
|
6470
6494
|
}();
|
|
6471
|
-
export { ABORT_ERROR_ID, AbortError, AbortPlugin, AsyncExecutor, Base64Serializer, Executor, ExecutorError, FetchAbortPlugin, FetchURLPlugin, JSONSerializer, KeyStorage,
|
|
6495
|
+
export { ABORT_ERROR_ID, AbortError, AbortPlugin, AsyncExecutor, Base64Serializer, Executor, ExecutorError, FetchAbortPlugin, FetchURLPlugin, JSONSerializer, KeyStorage, ObjectStorage, RequestAdapterAxios, RequestAdapterFetch, RequestError, RequestErrorID, RequestManager, RequestScheduler, RequestTransaction, RetryPlugin, SyncExecutor, SyncStorage };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qlover/fe-corekit",
|
|
3
3
|
"description": "A corekit for frontwork",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.3.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@types/lodash": "^4.17.12",
|
|
45
45
|
"axios": "^1.7.9",
|
|
46
|
-
"@qlover/logger": "0.
|
|
46
|
+
"@qlover/logger": "0.3.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"lodash": "^4.17.21"
|