@cyberskill/shared 1.46.0 → 1.48.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.
Files changed (134) hide show
  1. package/README.md +12 -18
  2. package/dist/_tsup-dts-rollup.d.cts +413 -31
  3. package/dist/_tsup-dts-rollup.d.ts +413 -31
  4. package/dist/cli.cjs +2136 -1
  5. package/dist/cli.d.cts +2 -1
  6. package/dist/cli.d.ts +2 -1
  7. package/dist/cli.js +2056 -1
  8. package/dist/configs/commitlint/base.cjs +64 -1
  9. package/dist/configs/commitlint/base.js +7 -1
  10. package/dist/configs/eslint/base.cjs +121 -1
  11. package/dist/configs/eslint/base.js +52 -1
  12. package/dist/configs/eslint/nestjs.cjs +155 -1
  13. package/dist/configs/eslint/nestjs.js +85 -1
  14. package/dist/configs/eslint/nextjs.cjs +155 -1
  15. package/dist/configs/eslint/nextjs.js +85 -1
  16. package/dist/configs/eslint/nodejs.cjs +156 -1
  17. package/dist/configs/eslint/nodejs.js +86 -1
  18. package/dist/configs/eslint/vite-react.cjs +159 -1
  19. package/dist/configs/eslint/vite-react.js +89 -1
  20. package/dist/configs/graphql/graphql-codegen.cjs +125 -1
  21. package/dist/configs/graphql/graphql-codegen.js +64 -1
  22. package/dist/configs/graphql/index.cjs +126 -1
  23. package/dist/configs/graphql/index.js +64 -1
  24. package/dist/configs/i18n/react/i18next.cjs +80 -1
  25. package/dist/configs/i18n/react/i18next.js +7 -1
  26. package/dist/configs/i18n/react/index.cjs +81 -1
  27. package/dist/configs/i18n/react/index.js +7 -1
  28. package/dist/configs/index.cjs +232 -1
  29. package/dist/configs/index.js +166 -1
  30. package/dist/configs/lint-staged/base.cjs +64 -1
  31. package/dist/configs/lint-staged/base.js +7 -1
  32. package/dist/configs/vitest/react/e2e.cjs +128 -1
  33. package/dist/configs/vitest/react/e2e.js +59 -1
  34. package/dist/configs/vitest/react/unit.cjs +305 -1
  35. package/dist/configs/vitest/react/unit.js +228 -1
  36. package/dist/configs/vitest/react/unit.setup.cjs +60 -1
  37. package/dist/configs/vitest/react/unit.setup.js +8 -1
  38. package/dist/constants/index.cjs +678 -1
  39. package/dist/constants/index.d.cts +31 -1
  40. package/dist/constants/index.d.ts +31 -1
  41. package/dist/constants/index.js +469 -1
  42. package/dist/constants/path.cjs +423 -1
  43. package/dist/constants/path.d.cts +31 -1
  44. package/dist/constants/path.d.ts +31 -1
  45. package/dist/constants/path.js +218 -1
  46. package/dist/constants/response-status.cjs +313 -1
  47. package/dist/constants/response-status.js +252 -1
  48. package/dist/index.cjs +4546 -1
  49. package/dist/index.d.cts +51 -6
  50. package/dist/index.d.ts +51 -6
  51. package/dist/index.js +4133 -1
  52. package/dist/nodejs/index.cjs +2138 -1
  53. package/dist/nodejs/index.js +2054 -1
  54. package/dist/nodejs/mongo.cjs +2137 -1
  55. package/dist/nodejs/mongo.js +2054 -1
  56. package/dist/react/apollo-client.cjs +177 -1
  57. package/dist/react/apollo-client.js +116 -1
  58. package/dist/react/index.cjs +990 -1
  59. package/dist/react/index.js +876 -1
  60. package/dist/react/loading.cjs +301 -1
  61. package/dist/react/loading.js +216 -1
  62. package/dist/react/next-intl.cjs +744 -1
  63. package/dist/react/next-intl.js +655 -1
  64. package/dist/react/storage.cjs +631 -1
  65. package/dist/react/storage.js +558 -1
  66. package/dist/typescript/api-response.cjs +48 -1
  67. package/dist/typescript/apollo.cjs +48 -1
  68. package/dist/typescript/command.cjs +68 -1
  69. package/dist/typescript/command.d.cts +4 -0
  70. package/dist/typescript/command.d.ts +4 -0
  71. package/dist/typescript/command.js +7 -1
  72. package/dist/typescript/config.cjs +48 -1
  73. package/dist/typescript/fs.cjs +48 -0
  74. package/dist/typescript/fs.d.cts +1 -0
  75. package/dist/typescript/fs.d.ts +1 -0
  76. package/dist/typescript/fs.js +0 -0
  77. package/dist/typescript/graphql-codegen.cjs +48 -1
  78. package/dist/typescript/index.cjs +175 -1
  79. package/dist/typescript/index.d.cts +5 -0
  80. package/dist/typescript/index.d.ts +5 -0
  81. package/dist/typescript/index.js +151 -1
  82. package/dist/typescript/loading.cjs +48 -1
  83. package/dist/typescript/log.cjs +48 -1
  84. package/dist/typescript/mongo.cjs +164 -1
  85. package/dist/typescript/mongo.js +145 -1
  86. package/dist/typescript/next-intl.cjs +48 -1
  87. package/dist/typescript/react.cjs +48 -1
  88. package/dist/typescript/serializer.cjs +48 -1
  89. package/dist/typescript/string.cjs +48 -1
  90. package/dist/utils/command.cjs +1387 -1
  91. package/dist/utils/command.d.cts +2 -0
  92. package/dist/utils/command.d.ts +2 -0
  93. package/dist/utils/command.js +1287 -1
  94. package/dist/utils/common.cjs +300 -1
  95. package/dist/utils/common.js +219 -1
  96. package/dist/utils/config.cjs +146 -1
  97. package/dist/utils/config.js +89 -1
  98. package/dist/utils/fs.cjs +118 -1
  99. package/dist/utils/fs.d.cts +4 -1
  100. package/dist/utils/fs.d.ts +4 -1
  101. package/dist/utils/fs.js +37 -1
  102. package/dist/utils/index-nodejs.cjs +1738 -1
  103. package/dist/utils/index-nodejs.d.cts +15 -5
  104. package/dist/utils/index-nodejs.d.ts +15 -5
  105. package/dist/utils/index-nodejs.js +1571 -1
  106. package/dist/utils/index.cjs +727 -1
  107. package/dist/utils/index.js +625 -1
  108. package/dist/utils/log.cjs +330 -1
  109. package/dist/utils/log.js +269 -1
  110. package/dist/utils/package.cjs +941 -0
  111. package/dist/utils/package.d.cts +3 -0
  112. package/dist/utils/package.d.ts +3 -0
  113. package/dist/utils/package.js +857 -0
  114. package/dist/utils/path.cjs +291 -0
  115. package/dist/utils/path.d.cts +6 -0
  116. package/dist/utils/path.d.ts +6 -0
  117. package/dist/utils/path.js +191 -0
  118. package/dist/utils/serializer.cjs +91 -1
  119. package/dist/utils/serializer.js +30 -1
  120. package/dist/utils/storage-client.cjs +349 -1
  121. package/dist/utils/storage-client.js +276 -1
  122. package/dist/utils/storage-server.cjs +636 -1
  123. package/dist/utils/storage-server.d.cts +1 -1
  124. package/dist/utils/storage-server.d.ts +1 -1
  125. package/dist/utils/storage-server.js +550 -1
  126. package/dist/utils/string.cjs +152 -1
  127. package/dist/utils/string.js +75 -1
  128. package/dist/utils/validate.cjs +90 -1
  129. package/dist/utils/validate.js +33 -1
  130. package/package.json +19 -16
  131. package/dist/utils/npm-package.cjs +0 -1
  132. package/dist/utils/npm-package.d.cts +0 -4
  133. package/dist/utils/npm-package.d.ts +0 -4
  134. package/dist/utils/npm-package.js +0 -1
@@ -1 +1,349 @@
1
- "use strict";function e(e,r,t,n,o,u,a){try{var c=e[u](a);var s=c.value}catch(e){t(e);return}if(c.done){r(s)}else{Promise.resolve(s).then(n,o)}}function r(r){return function(){var t=this,n=arguments;return new Promise(function(o,u){var a=r.apply(t,n);function c(r){e(a,o,u,c,s,"next",r)}function s(r){e(a,o,u,c,s,"throw",r)}c(undefined)})}}function t(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function n(e,r){var t,n,o,u,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return u={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(e){return function(r){return s([e,r])}}function s(u){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:a.label++;return{value:u[1],done:false};case 5:a.label++;n=u[1];u=[0];continue;case 7:u=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){a=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(u[0]===6&&a.label<o[1]){a.label=o[1];o=u;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(u);break}if(o[2])a.ops.pop();a.trys.pop();continue}u=r.call(e,a)}catch(e){u=[6,e];n=0}finally{t=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}var o=Object.create;var u=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var s=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty;var l=function(e,r){for(var t in r)u(e,t,{get:r[t],enumerable:!0})},f=function(e,r,n,o){var s=true,l=false,f=undefined;if(r&&(typeof r==="undefined"?"undefined":t(r))=="object"||typeof r=="function")try{var y=function(){var t=v.value;!i.call(e,t)&&t!==n&&u(e,t,{get:function(){return r[t]},enumerable:!(o=a(r,t))||o.enumerable})};for(var p=c(r)[Symbol.iterator](),v;!(s=(v=p.next()).done);s=true)y()}catch(e){l=true;f=e}finally{try{if(!s&&p.return!=null){p.return()}}finally{if(l){throw f}}}return e};var y=function(e,r,t){return t=e!=null?o(s(e)):{},f(r||!e||!e.__esModule?u(t,"default",{value:e,enumerable:!0}):t,e)},p=function(e){return f(u({},"__esModule",{value:!0}),e)};var v={};l(v,{storageClient:function(){return h}});module.exports=p(v);var b=y(require("localforage"),1),h={get:function e(e){return r(function(){var r;return n(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,b.default.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,t){return r(function(){var r;return n(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,b.default.setItem(e,t)];case 1:n.sent();return[3,3];case 2:r=n.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},remove:function e(e){return r(function(){var r;return n(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,b.default.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},keys:function e(){return r(function(){var e,r;return n(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,b.default.keys()];case 1:return[2,(e=t.sent())!==null&&e!==void 0?e:[]];case 2:r=t.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",r),[])];case 3:return[2]}})})()}};0&&(module.exports={storageClient:storageClient});
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
- function e(e,r,t,n,o,u,s){try{var a=e[u](s);var c=a.value}catch(e){t(e);return}if(a.done){r(c)}else{Promise.resolve(c).then(n,o)}}function r(r){return function(){var t=this,n=arguments;return new Promise(function(o,u){var s=r.apply(t,n);function a(r){e(s,o,u,a,c,"next",r)}function c(r){e(s,o,u,a,c,"throw",r)}a(undefined)})}}function t(e,r){var t,n,o,u,s={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return u={next:a(0),"throw":a(1),"return":a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(e){return function(r){return c([e,r])}}function c(u){if(t)throw new TypeError("Generator is already executing.");while(s)try{if(t=1,n&&(o=u[0]&2?n["return"]:u[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;if(n=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:s.label++;return{value:u[1],done:false};case 5:s.label++;n=u[1];u=[0];continue;case 7:u=s.ops.pop();s.trys.pop();continue;default:if(!(o=s.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){s=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){s.label=u[1];break}if(u[0]===6&&s.label<o[1]){s.label=o[1];o=u;break}if(o&&s.label<o[2]){s.label=o[2];s.ops.push(u);break}if(o[2])s.ops.pop();s.trys.pop();continue}u=r.call(e,s)}catch(e){u=[6,e];n=0}finally{t=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}import n from"localforage";var o={get:function e(e){return r(function(){var r;return t(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,n.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,o){return r(function(){var r;return t(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,n.setItem(e,o)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},remove:function e(e){return r(function(){var r;return t(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,n.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},keys:function e(){return r(function(){var e,r;return t(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,n.keys()];case 1:return[2,(e=t.sent())!==null&&e!==void 0?e:[]];case 2:r=t.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",r),[])];case 3:return[2]}})})()}};export{o as storageClient};
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 };