@cyberskill/shared 1.47.0 → 1.49.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/_tsup-dts-rollup.d.cts +415 -30
- package/dist/_tsup-dts-rollup.d.ts +415 -30
- package/dist/cli.cjs +2144 -1
- package/dist/cli.d.cts +2 -1
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +2064 -1
- package/dist/configs/commitlint/base.cjs +64 -1
- package/dist/configs/commitlint/base.js +7 -1
- package/dist/configs/eslint/base.cjs +121 -1
- package/dist/configs/eslint/base.js +52 -1
- package/dist/configs/eslint/nestjs.cjs +155 -1
- package/dist/configs/eslint/nestjs.js +85 -1
- package/dist/configs/eslint/nextjs.cjs +155 -1
- package/dist/configs/eslint/nextjs.js +85 -1
- package/dist/configs/eslint/nodejs.cjs +156 -1
- package/dist/configs/eslint/nodejs.js +86 -1
- package/dist/configs/eslint/vite-react.cjs +159 -1
- package/dist/configs/eslint/vite-react.js +89 -1
- package/dist/configs/graphql/graphql-codegen.cjs +125 -1
- package/dist/configs/graphql/graphql-codegen.js +64 -1
- package/dist/configs/graphql/index.cjs +126 -1
- package/dist/configs/graphql/index.js +64 -1
- package/dist/configs/i18n/react/i18next.cjs +80 -1
- package/dist/configs/i18n/react/i18next.js +7 -1
- package/dist/configs/i18n/react/index.cjs +81 -1
- package/dist/configs/i18n/react/index.js +7 -1
- package/dist/configs/index.cjs +232 -1
- package/dist/configs/index.js +166 -1
- package/dist/configs/lint-staged/base.cjs +64 -1
- package/dist/configs/lint-staged/base.js +7 -1
- package/dist/configs/vitest/react/e2e.cjs +128 -1
- package/dist/configs/vitest/react/e2e.js +59 -1
- package/dist/configs/vitest/react/unit.cjs +305 -1
- package/dist/configs/vitest/react/unit.js +228 -1
- package/dist/configs/vitest/react/unit.setup.cjs +60 -1
- package/dist/configs/vitest/react/unit.setup.js +8 -1
- package/dist/constants/index.cjs +678 -1
- package/dist/constants/index.d.cts +31 -1
- package/dist/constants/index.d.ts +31 -1
- package/dist/constants/index.js +469 -1
- package/dist/constants/path.cjs +423 -1
- package/dist/constants/path.d.cts +31 -1
- package/dist/constants/path.d.ts +31 -1
- package/dist/constants/path.js +218 -1
- package/dist/constants/response-status.cjs +313 -1
- package/dist/constants/response-status.js +252 -1
- package/dist/index.cjs +4560 -1
- package/dist/index.d.cts +52 -7
- package/dist/index.d.ts +52 -7
- package/dist/index.js +4143 -1
- package/dist/nodejs/index.cjs +2138 -1
- package/dist/nodejs/index.js +2054 -1
- package/dist/nodejs/mongo.cjs +2137 -1
- package/dist/nodejs/mongo.js +2054 -1
- package/dist/react/apollo-client.cjs +177 -1
- package/dist/react/apollo-client.js +116 -1
- package/dist/react/index.cjs +990 -1
- package/dist/react/index.js +876 -1
- package/dist/react/loading.cjs +301 -1
- package/dist/react/loading.js +216 -1
- package/dist/react/next-intl.cjs +744 -1
- package/dist/react/next-intl.js +655 -1
- package/dist/react/storage.cjs +631 -1
- package/dist/react/storage.js +558 -1
- package/dist/typescript/api-response.cjs +48 -1
- package/dist/typescript/apollo.cjs +48 -1
- package/dist/typescript/command.cjs +68 -1
- package/dist/typescript/command.d.cts +4 -0
- package/dist/typescript/command.d.ts +4 -0
- package/dist/typescript/command.js +7 -1
- package/dist/typescript/config.cjs +48 -1
- package/dist/typescript/fs.cjs +48 -0
- package/dist/typescript/fs.d.cts +1 -0
- package/dist/typescript/fs.d.ts +1 -0
- package/dist/typescript/fs.js +0 -0
- package/dist/typescript/graphql-codegen.cjs +48 -1
- package/dist/typescript/index.cjs +175 -1
- package/dist/typescript/index.d.cts +5 -0
- package/dist/typescript/index.d.ts +5 -0
- package/dist/typescript/index.js +151 -1
- package/dist/typescript/loading.cjs +48 -1
- package/dist/typescript/log.cjs +48 -1
- package/dist/typescript/mongo.cjs +164 -1
- package/dist/typescript/mongo.js +145 -1
- package/dist/typescript/next-intl.cjs +48 -1
- package/dist/typescript/react.cjs +48 -1
- package/dist/typescript/serializer.cjs +48 -1
- package/dist/typescript/string.cjs +48 -1
- package/dist/utils/command.cjs +1387 -1
- package/dist/utils/command.d.cts +2 -0
- package/dist/utils/command.d.ts +2 -0
- package/dist/utils/command.js +1287 -1
- package/dist/utils/common.cjs +300 -1
- package/dist/utils/common.js +219 -1
- package/dist/utils/config.cjs +146 -1
- package/dist/utils/config.js +89 -1
- package/dist/utils/fs.cjs +132 -1
- package/dist/utils/fs.d.cts +5 -1
- package/dist/utils/fs.d.ts +5 -1
- package/dist/utils/fs.js +47 -1
- package/dist/utils/index-nodejs.cjs +1752 -1
- package/dist/utils/index-nodejs.d.cts +16 -6
- package/dist/utils/index-nodejs.d.ts +16 -6
- package/dist/utils/index-nodejs.js +1581 -1
- package/dist/utils/index.cjs +727 -1
- package/dist/utils/index.js +625 -1
- package/dist/utils/log.cjs +330 -1
- package/dist/utils/log.js +269 -1
- package/dist/utils/package.cjs +941 -0
- package/dist/utils/package.d.cts +3 -0
- package/dist/utils/package.d.ts +3 -0
- package/dist/utils/package.js +857 -0
- package/dist/utils/path.cjs +291 -0
- package/dist/utils/path.d.cts +6 -0
- package/dist/utils/path.d.ts +6 -0
- package/dist/utils/path.js +191 -0
- package/dist/utils/serializer.cjs +91 -1
- package/dist/utils/serializer.js +30 -1
- package/dist/utils/storage-client.cjs +349 -1
- package/dist/utils/storage-client.js +276 -1
- package/dist/utils/storage-server.cjs +636 -1
- package/dist/utils/storage-server.d.cts +1 -1
- package/dist/utils/storage-server.d.ts +1 -1
- package/dist/utils/storage-server.js +550 -1
- package/dist/utils/string.cjs +152 -1
- package/dist/utils/string.js +75 -1
- package/dist/utils/validate.cjs +90 -1
- package/dist/utils/validate.js +33 -1
- package/package.json +11 -12
- package/dist/utils/npm-package.cjs +0 -1
- package/dist/utils/npm-package.d.cts +0 -5
- package/dist/utils/npm-package.d.ts +0 -5
- package/dist/utils/npm-package.js +0 -1
|
@@ -1 +1,349 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3
|
+
try {
|
|
4
|
+
var info = gen[key](arg);
|
|
5
|
+
var value = info.value;
|
|
6
|
+
} catch (error) {
|
|
7
|
+
reject(error);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (info.done) {
|
|
11
|
+
resolve(value);
|
|
12
|
+
} else {
|
|
13
|
+
Promise.resolve(value).then(_next, _throw);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _async_to_generator(fn) {
|
|
17
|
+
return function() {
|
|
18
|
+
var self = this, args = arguments;
|
|
19
|
+
return new Promise(function(resolve, reject) {
|
|
20
|
+
var gen = fn.apply(self, args);
|
|
21
|
+
function _next(value) {
|
|
22
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
23
|
+
}
|
|
24
|
+
function _throw(err) {
|
|
25
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
26
|
+
}
|
|
27
|
+
_next(undefined);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function _type_of(obj) {
|
|
32
|
+
"@swc/helpers - typeof";
|
|
33
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
34
|
+
}
|
|
35
|
+
function _ts_generator(thisArg, body) {
|
|
36
|
+
var f, y, t, g, _ = {
|
|
37
|
+
label: 0,
|
|
38
|
+
sent: function() {
|
|
39
|
+
if (t[0] & 1) throw t[1];
|
|
40
|
+
return t[1];
|
|
41
|
+
},
|
|
42
|
+
trys: [],
|
|
43
|
+
ops: []
|
|
44
|
+
};
|
|
45
|
+
return g = {
|
|
46
|
+
next: verb(0),
|
|
47
|
+
"throw": verb(1),
|
|
48
|
+
"return": verb(2)
|
|
49
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
50
|
+
return this;
|
|
51
|
+
}), g;
|
|
52
|
+
function verb(n) {
|
|
53
|
+
return function(v) {
|
|
54
|
+
return step([
|
|
55
|
+
n,
|
|
56
|
+
v
|
|
57
|
+
]);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function step(op) {
|
|
61
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
62
|
+
while(_)try {
|
|
63
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
64
|
+
if (y = 0, t) op = [
|
|
65
|
+
op[0] & 2,
|
|
66
|
+
t.value
|
|
67
|
+
];
|
|
68
|
+
switch(op[0]){
|
|
69
|
+
case 0:
|
|
70
|
+
case 1:
|
|
71
|
+
t = op;
|
|
72
|
+
break;
|
|
73
|
+
case 4:
|
|
74
|
+
_.label++;
|
|
75
|
+
return {
|
|
76
|
+
value: op[1],
|
|
77
|
+
done: false
|
|
78
|
+
};
|
|
79
|
+
case 5:
|
|
80
|
+
_.label++;
|
|
81
|
+
y = op[1];
|
|
82
|
+
op = [
|
|
83
|
+
0
|
|
84
|
+
];
|
|
85
|
+
continue;
|
|
86
|
+
case 7:
|
|
87
|
+
op = _.ops.pop();
|
|
88
|
+
_.trys.pop();
|
|
89
|
+
continue;
|
|
90
|
+
default:
|
|
91
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
92
|
+
_ = 0;
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
96
|
+
_.label = op[1];
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
100
|
+
_.label = t[1];
|
|
101
|
+
t = op;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (t && _.label < t[2]) {
|
|
105
|
+
_.label = t[2];
|
|
106
|
+
_.ops.push(op);
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
if (t[2]) _.ops.pop();
|
|
110
|
+
_.trys.pop();
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
op = body.call(thisArg, _);
|
|
114
|
+
} catch (e) {
|
|
115
|
+
op = [
|
|
116
|
+
6,
|
|
117
|
+
e
|
|
118
|
+
];
|
|
119
|
+
y = 0;
|
|
120
|
+
} finally{
|
|
121
|
+
f = t = 0;
|
|
122
|
+
}
|
|
123
|
+
if (op[0] & 5) throw op[1];
|
|
124
|
+
return {
|
|
125
|
+
value: op[0] ? op[1] : void 0,
|
|
126
|
+
done: true
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
var __create = Object.create;
|
|
131
|
+
var __defProp = Object.defineProperty;
|
|
132
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
133
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
134
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
135
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
136
|
+
var __export = function(target, all) {
|
|
137
|
+
for(var name in all)__defProp(target, name, {
|
|
138
|
+
get: all[name],
|
|
139
|
+
enumerable: true
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
var __copyProps = function(to, from, except, desc) {
|
|
143
|
+
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
144
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
145
|
+
try {
|
|
146
|
+
var _loop = function() {
|
|
147
|
+
var key = _step.value;
|
|
148
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
149
|
+
get: function() {
|
|
150
|
+
return from[key];
|
|
151
|
+
},
|
|
152
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
156
|
+
} catch (err) {
|
|
157
|
+
_didIteratorError = true;
|
|
158
|
+
_iteratorError = err;
|
|
159
|
+
} finally{
|
|
160
|
+
try {
|
|
161
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
162
|
+
_iterator.return();
|
|
163
|
+
}
|
|
164
|
+
} finally{
|
|
165
|
+
if (_didIteratorError) {
|
|
166
|
+
throw _iteratorError;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return to;
|
|
172
|
+
};
|
|
173
|
+
var __toESM = function(mod, isNodeMode, target) {
|
|
174
|
+
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
175
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
176
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
177
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
178
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
179
|
+
value: mod,
|
|
180
|
+
enumerable: true
|
|
181
|
+
}) : target, mod);
|
|
182
|
+
};
|
|
183
|
+
var __toCommonJS = function(mod) {
|
|
184
|
+
return __copyProps(__defProp({}, "__esModule", {
|
|
185
|
+
value: true
|
|
186
|
+
}), mod);
|
|
187
|
+
};
|
|
188
|
+
// src/utils/storage-client.ts
|
|
189
|
+
var storage_client_exports = {};
|
|
190
|
+
__export(storage_client_exports, {
|
|
191
|
+
storageClient: function() {
|
|
192
|
+
return storageClient;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
module.exports = __toCommonJS(storage_client_exports);
|
|
196
|
+
var import_localforage = __toESM(require("localforage"), 1);
|
|
197
|
+
var storageClient = {
|
|
198
|
+
get: function get(key) {
|
|
199
|
+
return _async_to_generator(function() {
|
|
200
|
+
var error;
|
|
201
|
+
return _ts_generator(this, function(_state) {
|
|
202
|
+
switch(_state.label){
|
|
203
|
+
case 0:
|
|
204
|
+
_state.trys.push([
|
|
205
|
+
0,
|
|
206
|
+
2,
|
|
207
|
+
,
|
|
208
|
+
3
|
|
209
|
+
]);
|
|
210
|
+
return [
|
|
211
|
+
4,
|
|
212
|
+
import_localforage.default.getItem(key)
|
|
213
|
+
];
|
|
214
|
+
case 1:
|
|
215
|
+
return [
|
|
216
|
+
2,
|
|
217
|
+
_state.sent()
|
|
218
|
+
];
|
|
219
|
+
case 2:
|
|
220
|
+
error = _state.sent();
|
|
221
|
+
console.error('❌ [Storage:get] Error getting key "'.concat(key, '":'), error);
|
|
222
|
+
return [
|
|
223
|
+
2,
|
|
224
|
+
null
|
|
225
|
+
];
|
|
226
|
+
case 3:
|
|
227
|
+
return [
|
|
228
|
+
2
|
|
229
|
+
];
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
})();
|
|
233
|
+
},
|
|
234
|
+
set: function set(key, value) {
|
|
235
|
+
return _async_to_generator(function() {
|
|
236
|
+
var error;
|
|
237
|
+
return _ts_generator(this, function(_state) {
|
|
238
|
+
switch(_state.label){
|
|
239
|
+
case 0:
|
|
240
|
+
_state.trys.push([
|
|
241
|
+
0,
|
|
242
|
+
2,
|
|
243
|
+
,
|
|
244
|
+
3
|
|
245
|
+
]);
|
|
246
|
+
return [
|
|
247
|
+
4,
|
|
248
|
+
import_localforage.default.setItem(key, value)
|
|
249
|
+
];
|
|
250
|
+
case 1:
|
|
251
|
+
_state.sent();
|
|
252
|
+
return [
|
|
253
|
+
3,
|
|
254
|
+
3
|
|
255
|
+
];
|
|
256
|
+
case 2:
|
|
257
|
+
error = _state.sent();
|
|
258
|
+
console.error('❌ [Storage:set] Error setting key "'.concat(key, '":'), error);
|
|
259
|
+
return [
|
|
260
|
+
3,
|
|
261
|
+
3
|
|
262
|
+
];
|
|
263
|
+
case 3:
|
|
264
|
+
return [
|
|
265
|
+
2
|
|
266
|
+
];
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
})();
|
|
270
|
+
},
|
|
271
|
+
remove: function remove(key) {
|
|
272
|
+
return _async_to_generator(function() {
|
|
273
|
+
var error;
|
|
274
|
+
return _ts_generator(this, function(_state) {
|
|
275
|
+
switch(_state.label){
|
|
276
|
+
case 0:
|
|
277
|
+
_state.trys.push([
|
|
278
|
+
0,
|
|
279
|
+
2,
|
|
280
|
+
,
|
|
281
|
+
3
|
|
282
|
+
]);
|
|
283
|
+
return [
|
|
284
|
+
4,
|
|
285
|
+
import_localforage.default.removeItem(key)
|
|
286
|
+
];
|
|
287
|
+
case 1:
|
|
288
|
+
_state.sent();
|
|
289
|
+
return [
|
|
290
|
+
3,
|
|
291
|
+
3
|
|
292
|
+
];
|
|
293
|
+
case 2:
|
|
294
|
+
error = _state.sent();
|
|
295
|
+
console.error('❌ [Storage:remove] Error removing key "'.concat(key, '":'), error);
|
|
296
|
+
return [
|
|
297
|
+
3,
|
|
298
|
+
3
|
|
299
|
+
];
|
|
300
|
+
case 3:
|
|
301
|
+
return [
|
|
302
|
+
2
|
|
303
|
+
];
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
})();
|
|
307
|
+
},
|
|
308
|
+
keys: function keys() {
|
|
309
|
+
return _async_to_generator(function() {
|
|
310
|
+
var keys, error;
|
|
311
|
+
return _ts_generator(this, function(_state) {
|
|
312
|
+
switch(_state.label){
|
|
313
|
+
case 0:
|
|
314
|
+
_state.trys.push([
|
|
315
|
+
0,
|
|
316
|
+
2,
|
|
317
|
+
,
|
|
318
|
+
3
|
|
319
|
+
]);
|
|
320
|
+
return [
|
|
321
|
+
4,
|
|
322
|
+
import_localforage.default.keys()
|
|
323
|
+
];
|
|
324
|
+
case 1:
|
|
325
|
+
keys = _state.sent();
|
|
326
|
+
return [
|
|
327
|
+
2,
|
|
328
|
+
keys !== null && keys !== void 0 ? keys : []
|
|
329
|
+
];
|
|
330
|
+
case 2:
|
|
331
|
+
error = _state.sent();
|
|
332
|
+
console.error("❌ [Storage:keys] Error getting keys:", error);
|
|
333
|
+
return [
|
|
334
|
+
2,
|
|
335
|
+
[]
|
|
336
|
+
];
|
|
337
|
+
case 3:
|
|
338
|
+
return [
|
|
339
|
+
2
|
|
340
|
+
];
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
})();
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
347
|
+
0 && (module.exports = {
|
|
348
|
+
storageClient: storageClient
|
|
349
|
+
});
|
|
@@ -1 +1,276 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/storage-client.ts
|
|
2
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3
|
+
try {
|
|
4
|
+
var info = gen[key](arg);
|
|
5
|
+
var value = info.value;
|
|
6
|
+
} catch (error) {
|
|
7
|
+
reject(error);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (info.done) {
|
|
11
|
+
resolve(value);
|
|
12
|
+
} else {
|
|
13
|
+
Promise.resolve(value).then(_next, _throw);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _async_to_generator(fn) {
|
|
17
|
+
return function() {
|
|
18
|
+
var self = this, args = arguments;
|
|
19
|
+
return new Promise(function(resolve, reject) {
|
|
20
|
+
var gen = fn.apply(self, args);
|
|
21
|
+
function _next(value) {
|
|
22
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
23
|
+
}
|
|
24
|
+
function _throw(err) {
|
|
25
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
26
|
+
}
|
|
27
|
+
_next(undefined);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function _ts_generator(thisArg, body) {
|
|
32
|
+
var f, y, t, g, _ = {
|
|
33
|
+
label: 0,
|
|
34
|
+
sent: function() {
|
|
35
|
+
if (t[0] & 1) throw t[1];
|
|
36
|
+
return t[1];
|
|
37
|
+
},
|
|
38
|
+
trys: [],
|
|
39
|
+
ops: []
|
|
40
|
+
};
|
|
41
|
+
return g = {
|
|
42
|
+
next: verb(0),
|
|
43
|
+
"throw": verb(1),
|
|
44
|
+
"return": verb(2)
|
|
45
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
46
|
+
return this;
|
|
47
|
+
}), g;
|
|
48
|
+
function verb(n) {
|
|
49
|
+
return function(v) {
|
|
50
|
+
return step([
|
|
51
|
+
n,
|
|
52
|
+
v
|
|
53
|
+
]);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function step(op) {
|
|
57
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
+
while(_)try {
|
|
59
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
60
|
+
if (y = 0, t) op = [
|
|
61
|
+
op[0] & 2,
|
|
62
|
+
t.value
|
|
63
|
+
];
|
|
64
|
+
switch(op[0]){
|
|
65
|
+
case 0:
|
|
66
|
+
case 1:
|
|
67
|
+
t = op;
|
|
68
|
+
break;
|
|
69
|
+
case 4:
|
|
70
|
+
_.label++;
|
|
71
|
+
return {
|
|
72
|
+
value: op[1],
|
|
73
|
+
done: false
|
|
74
|
+
};
|
|
75
|
+
case 5:
|
|
76
|
+
_.label++;
|
|
77
|
+
y = op[1];
|
|
78
|
+
op = [
|
|
79
|
+
0
|
|
80
|
+
];
|
|
81
|
+
continue;
|
|
82
|
+
case 7:
|
|
83
|
+
op = _.ops.pop();
|
|
84
|
+
_.trys.pop();
|
|
85
|
+
continue;
|
|
86
|
+
default:
|
|
87
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
88
|
+
_ = 0;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
92
|
+
_.label = op[1];
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
96
|
+
_.label = t[1];
|
|
97
|
+
t = op;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
if (t && _.label < t[2]) {
|
|
101
|
+
_.label = t[2];
|
|
102
|
+
_.ops.push(op);
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
if (t[2]) _.ops.pop();
|
|
106
|
+
_.trys.pop();
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
op = body.call(thisArg, _);
|
|
110
|
+
} catch (e) {
|
|
111
|
+
op = [
|
|
112
|
+
6,
|
|
113
|
+
e
|
|
114
|
+
];
|
|
115
|
+
y = 0;
|
|
116
|
+
} finally{
|
|
117
|
+
f = t = 0;
|
|
118
|
+
}
|
|
119
|
+
if (op[0] & 5) throw op[1];
|
|
120
|
+
return {
|
|
121
|
+
value: op[0] ? op[1] : void 0,
|
|
122
|
+
done: true
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
import localForage from "localforage";
|
|
127
|
+
var storageClient = {
|
|
128
|
+
get: function get(key) {
|
|
129
|
+
return _async_to_generator(function() {
|
|
130
|
+
var error;
|
|
131
|
+
return _ts_generator(this, function(_state) {
|
|
132
|
+
switch(_state.label){
|
|
133
|
+
case 0:
|
|
134
|
+
_state.trys.push([
|
|
135
|
+
0,
|
|
136
|
+
2,
|
|
137
|
+
,
|
|
138
|
+
3
|
|
139
|
+
]);
|
|
140
|
+
return [
|
|
141
|
+
4,
|
|
142
|
+
localForage.getItem(key)
|
|
143
|
+
];
|
|
144
|
+
case 1:
|
|
145
|
+
return [
|
|
146
|
+
2,
|
|
147
|
+
_state.sent()
|
|
148
|
+
];
|
|
149
|
+
case 2:
|
|
150
|
+
error = _state.sent();
|
|
151
|
+
console.error('❌ [Storage:get] Error getting key "'.concat(key, '":'), error);
|
|
152
|
+
return [
|
|
153
|
+
2,
|
|
154
|
+
null
|
|
155
|
+
];
|
|
156
|
+
case 3:
|
|
157
|
+
return [
|
|
158
|
+
2
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
})();
|
|
163
|
+
},
|
|
164
|
+
set: function set(key, value) {
|
|
165
|
+
return _async_to_generator(function() {
|
|
166
|
+
var error;
|
|
167
|
+
return _ts_generator(this, function(_state) {
|
|
168
|
+
switch(_state.label){
|
|
169
|
+
case 0:
|
|
170
|
+
_state.trys.push([
|
|
171
|
+
0,
|
|
172
|
+
2,
|
|
173
|
+
,
|
|
174
|
+
3
|
|
175
|
+
]);
|
|
176
|
+
return [
|
|
177
|
+
4,
|
|
178
|
+
localForage.setItem(key, value)
|
|
179
|
+
];
|
|
180
|
+
case 1:
|
|
181
|
+
_state.sent();
|
|
182
|
+
return [
|
|
183
|
+
3,
|
|
184
|
+
3
|
|
185
|
+
];
|
|
186
|
+
case 2:
|
|
187
|
+
error = _state.sent();
|
|
188
|
+
console.error('❌ [Storage:set] Error setting key "'.concat(key, '":'), error);
|
|
189
|
+
return [
|
|
190
|
+
3,
|
|
191
|
+
3
|
|
192
|
+
];
|
|
193
|
+
case 3:
|
|
194
|
+
return [
|
|
195
|
+
2
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
})();
|
|
200
|
+
},
|
|
201
|
+
remove: function remove(key) {
|
|
202
|
+
return _async_to_generator(function() {
|
|
203
|
+
var error;
|
|
204
|
+
return _ts_generator(this, function(_state) {
|
|
205
|
+
switch(_state.label){
|
|
206
|
+
case 0:
|
|
207
|
+
_state.trys.push([
|
|
208
|
+
0,
|
|
209
|
+
2,
|
|
210
|
+
,
|
|
211
|
+
3
|
|
212
|
+
]);
|
|
213
|
+
return [
|
|
214
|
+
4,
|
|
215
|
+
localForage.removeItem(key)
|
|
216
|
+
];
|
|
217
|
+
case 1:
|
|
218
|
+
_state.sent();
|
|
219
|
+
return [
|
|
220
|
+
3,
|
|
221
|
+
3
|
|
222
|
+
];
|
|
223
|
+
case 2:
|
|
224
|
+
error = _state.sent();
|
|
225
|
+
console.error('❌ [Storage:remove] Error removing key "'.concat(key, '":'), error);
|
|
226
|
+
return [
|
|
227
|
+
3,
|
|
228
|
+
3
|
|
229
|
+
];
|
|
230
|
+
case 3:
|
|
231
|
+
return [
|
|
232
|
+
2
|
|
233
|
+
];
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
})();
|
|
237
|
+
},
|
|
238
|
+
keys: function keys() {
|
|
239
|
+
return _async_to_generator(function() {
|
|
240
|
+
var keys, error;
|
|
241
|
+
return _ts_generator(this, function(_state) {
|
|
242
|
+
switch(_state.label){
|
|
243
|
+
case 0:
|
|
244
|
+
_state.trys.push([
|
|
245
|
+
0,
|
|
246
|
+
2,
|
|
247
|
+
,
|
|
248
|
+
3
|
|
249
|
+
]);
|
|
250
|
+
return [
|
|
251
|
+
4,
|
|
252
|
+
localForage.keys()
|
|
253
|
+
];
|
|
254
|
+
case 1:
|
|
255
|
+
keys = _state.sent();
|
|
256
|
+
return [
|
|
257
|
+
2,
|
|
258
|
+
keys !== null && keys !== void 0 ? keys : []
|
|
259
|
+
];
|
|
260
|
+
case 2:
|
|
261
|
+
error = _state.sent();
|
|
262
|
+
console.error("❌ [Storage:keys] Error getting keys:", error);
|
|
263
|
+
return [
|
|
264
|
+
2,
|
|
265
|
+
[]
|
|
266
|
+
];
|
|
267
|
+
case 3:
|
|
268
|
+
return [
|
|
269
|
+
2
|
|
270
|
+
];
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
})();
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
export { storageClient };
|