@cyberskill/shared 1.47.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 (133) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +410 -30
  2. package/dist/_tsup-dts-rollup.d.ts +410 -30
  3. package/dist/cli.cjs +2136 -1
  4. package/dist/cli.d.cts +2 -1
  5. package/dist/cli.d.ts +2 -1
  6. package/dist/cli.js +2056 -1
  7. package/dist/configs/commitlint/base.cjs +64 -1
  8. package/dist/configs/commitlint/base.js +7 -1
  9. package/dist/configs/eslint/base.cjs +121 -1
  10. package/dist/configs/eslint/base.js +52 -1
  11. package/dist/configs/eslint/nestjs.cjs +155 -1
  12. package/dist/configs/eslint/nestjs.js +85 -1
  13. package/dist/configs/eslint/nextjs.cjs +155 -1
  14. package/dist/configs/eslint/nextjs.js +85 -1
  15. package/dist/configs/eslint/nodejs.cjs +156 -1
  16. package/dist/configs/eslint/nodejs.js +86 -1
  17. package/dist/configs/eslint/vite-react.cjs +159 -1
  18. package/dist/configs/eslint/vite-react.js +89 -1
  19. package/dist/configs/graphql/graphql-codegen.cjs +125 -1
  20. package/dist/configs/graphql/graphql-codegen.js +64 -1
  21. package/dist/configs/graphql/index.cjs +126 -1
  22. package/dist/configs/graphql/index.js +64 -1
  23. package/dist/configs/i18n/react/i18next.cjs +80 -1
  24. package/dist/configs/i18n/react/i18next.js +7 -1
  25. package/dist/configs/i18n/react/index.cjs +81 -1
  26. package/dist/configs/i18n/react/index.js +7 -1
  27. package/dist/configs/index.cjs +232 -1
  28. package/dist/configs/index.js +166 -1
  29. package/dist/configs/lint-staged/base.cjs +64 -1
  30. package/dist/configs/lint-staged/base.js +7 -1
  31. package/dist/configs/vitest/react/e2e.cjs +128 -1
  32. package/dist/configs/vitest/react/e2e.js +59 -1
  33. package/dist/configs/vitest/react/unit.cjs +305 -1
  34. package/dist/configs/vitest/react/unit.js +228 -1
  35. package/dist/configs/vitest/react/unit.setup.cjs +60 -1
  36. package/dist/configs/vitest/react/unit.setup.js +8 -1
  37. package/dist/constants/index.cjs +678 -1
  38. package/dist/constants/index.d.cts +31 -1
  39. package/dist/constants/index.d.ts +31 -1
  40. package/dist/constants/index.js +469 -1
  41. package/dist/constants/path.cjs +423 -1
  42. package/dist/constants/path.d.cts +31 -1
  43. package/dist/constants/path.d.ts +31 -1
  44. package/dist/constants/path.js +218 -1
  45. package/dist/constants/response-status.cjs +313 -1
  46. package/dist/constants/response-status.js +252 -1
  47. package/dist/index.cjs +4546 -1
  48. package/dist/index.d.cts +51 -7
  49. package/dist/index.d.ts +51 -7
  50. package/dist/index.js +4133 -1
  51. package/dist/nodejs/index.cjs +2138 -1
  52. package/dist/nodejs/index.js +2054 -1
  53. package/dist/nodejs/mongo.cjs +2137 -1
  54. package/dist/nodejs/mongo.js +2054 -1
  55. package/dist/react/apollo-client.cjs +177 -1
  56. package/dist/react/apollo-client.js +116 -1
  57. package/dist/react/index.cjs +990 -1
  58. package/dist/react/index.js +876 -1
  59. package/dist/react/loading.cjs +301 -1
  60. package/dist/react/loading.js +216 -1
  61. package/dist/react/next-intl.cjs +744 -1
  62. package/dist/react/next-intl.js +655 -1
  63. package/dist/react/storage.cjs +631 -1
  64. package/dist/react/storage.js +558 -1
  65. package/dist/typescript/api-response.cjs +48 -1
  66. package/dist/typescript/apollo.cjs +48 -1
  67. package/dist/typescript/command.cjs +68 -1
  68. package/dist/typescript/command.d.cts +4 -0
  69. package/dist/typescript/command.d.ts +4 -0
  70. package/dist/typescript/command.js +7 -1
  71. package/dist/typescript/config.cjs +48 -1
  72. package/dist/typescript/fs.cjs +48 -0
  73. package/dist/typescript/fs.d.cts +1 -0
  74. package/dist/typescript/fs.d.ts +1 -0
  75. package/dist/typescript/fs.js +0 -0
  76. package/dist/typescript/graphql-codegen.cjs +48 -1
  77. package/dist/typescript/index.cjs +175 -1
  78. package/dist/typescript/index.d.cts +5 -0
  79. package/dist/typescript/index.d.ts +5 -0
  80. package/dist/typescript/index.js +151 -1
  81. package/dist/typescript/loading.cjs +48 -1
  82. package/dist/typescript/log.cjs +48 -1
  83. package/dist/typescript/mongo.cjs +164 -1
  84. package/dist/typescript/mongo.js +145 -1
  85. package/dist/typescript/next-intl.cjs +48 -1
  86. package/dist/typescript/react.cjs +48 -1
  87. package/dist/typescript/serializer.cjs +48 -1
  88. package/dist/typescript/string.cjs +48 -1
  89. package/dist/utils/command.cjs +1387 -1
  90. package/dist/utils/command.d.cts +2 -0
  91. package/dist/utils/command.d.ts +2 -0
  92. package/dist/utils/command.js +1287 -1
  93. package/dist/utils/common.cjs +300 -1
  94. package/dist/utils/common.js +219 -1
  95. package/dist/utils/config.cjs +146 -1
  96. package/dist/utils/config.js +89 -1
  97. package/dist/utils/fs.cjs +118 -1
  98. package/dist/utils/fs.d.cts +4 -1
  99. package/dist/utils/fs.d.ts +4 -1
  100. package/dist/utils/fs.js +37 -1
  101. package/dist/utils/index-nodejs.cjs +1738 -1
  102. package/dist/utils/index-nodejs.d.cts +15 -6
  103. package/dist/utils/index-nodejs.d.ts +15 -6
  104. package/dist/utils/index-nodejs.js +1571 -1
  105. package/dist/utils/index.cjs +727 -1
  106. package/dist/utils/index.js +625 -1
  107. package/dist/utils/log.cjs +330 -1
  108. package/dist/utils/log.js +269 -1
  109. package/dist/utils/package.cjs +941 -0
  110. package/dist/utils/package.d.cts +3 -0
  111. package/dist/utils/package.d.ts +3 -0
  112. package/dist/utils/package.js +857 -0
  113. package/dist/utils/path.cjs +291 -0
  114. package/dist/utils/path.d.cts +6 -0
  115. package/dist/utils/path.d.ts +6 -0
  116. package/dist/utils/path.js +191 -0
  117. package/dist/utils/serializer.cjs +91 -1
  118. package/dist/utils/serializer.js +30 -1
  119. package/dist/utils/storage-client.cjs +349 -1
  120. package/dist/utils/storage-client.js +276 -1
  121. package/dist/utils/storage-server.cjs +636 -1
  122. package/dist/utils/storage-server.d.cts +1 -1
  123. package/dist/utils/storage-server.d.ts +1 -1
  124. package/dist/utils/storage-server.js +550 -1
  125. package/dist/utils/string.cjs +152 -1
  126. package/dist/utils/string.js +75 -1
  127. package/dist/utils/validate.cjs +90 -1
  128. package/dist/utils/validate.js +33 -1
  129. package/package.json +11 -11
  130. package/dist/utils/npm-package.cjs +0 -1
  131. package/dist/utils/npm-package.d.cts +0 -5
  132. package/dist/utils/npm-package.d.ts +0 -5
  133. package/dist/utils/npm-package.js +0 -1
@@ -1 +1,558 @@
1
- function e(e,r){if(r==null||r>e.length)r=e.length;for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function r(e){if(Array.isArray(e))return e}function t(e,r,t,n,u,o,a){try{var i=e[o](a);var s=i.value}catch(e){t(e);return}if(i.done){r(s)}else{Promise.resolve(s).then(n,u)}}function n(e){return function(){var r=this,n=arguments;return new Promise(function(u,o){var a=e.apply(r,n);function i(e){t(a,u,o,i,s,"next",e)}function s(e){t(a,u,o,i,s,"throw",e)}i(undefined)})}}function u(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function o(e,r){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var n=[];var u=true;var o=false;var a,i;try{for(t=t.call(e);!(u=(a=t.next()).done);u=true){n.push(a.value);if(r&&n.length===r)break}}catch(e){o=true;i=e}finally{try{if(!u&&t["return"]!=null)t["return"]()}finally{if(o)throw i}}return n}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){return r(e)||o(e,t)||s(e,t)||a()}function s(r,t){if(!r)return;if(typeof r==="string")return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor)n=r.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}function c(e,r){var t,n,u,o,a={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]};return o={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function i(e){return function(r){return s([e,r])}}function s(o){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,n&&(u=o[0]&2?n["return"]:o[0]?n["throw"]||((u=n["return"])&&u.call(n),0):n.next)&&!(u=u.call(n,o[1])).done)return u;if(n=0,u)o=[o[0]&2,u.value];switch(o[0]){case 0:case 1:u=o;break;case 4:a.label++;return{value:o[1],done:false};case 5:a.label++;n=o[1];o=[0];continue;case 7:o=a.ops.pop();a.trys.pop();continue;default:if(!(u=a.trys,u=u.length>0&&u[u.length-1])&&(o[0]===6||o[0]===2)){a=0;continue}if(o[0]===3&&(!u||o[1]>u[0]&&o[1]<u[3])){a.label=o[1];break}if(o[0]===6&&a.label<u[1]){a.label=u[1];u=o;break}if(u&&a.label<u[2]){a.label=u[2];a.ops.push(o);break}if(u[2])a.ops.pop();a.trys.pop();continue}o=r.call(e,a)}catch(e){o=[6,e];n=0}finally{t=u=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}import{useCallback as l,useEffect as f,useState as v}from"react";var y={serialize:function(e){return JSON.stringify(e,function(e,r){return u(r,Date)?{__type:"Date",value:r.toISOString()}:r})},deserialize:function(e){return JSON.parse(e,function(e,r){return(r===null||r===void 0?void 0:r.__type)==="Date"?new Date(r.value):r})}};import h from"localforage";var p={get:function e(e){return n(function(){var r;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,h.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,r){return n(function(){var t;return c(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,h.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return n(function(){var r;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,h.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 n(function(){var e,r;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,h.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]}})})()}};function b(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y;var u=i(v(r),2),o=u[0],a=u[1],s=i(v(!1),2),h=s[0],b=s[1];f(function(){var u=!0;return n(function(){var n,o,i,s;return c(this,function(c){switch(c.label){case 0:c.trys.push([0,6,7,8]);return[4,p.get(e)];case 1:n=c.sent();if(!u)return[3,5];if(!(n!==null))return[3,2];o=t.deserialize(n);a(o);return[3,5];case 2:if(!(r!==void 0))return[3,4];i=t.serialize(r);return[4,p.set(e,i)];case 3:c.sent(),a(r);return[3,5];case 4:a(void 0);c.label=5;case 5:return[3,8];case 6:s=c.sent();console.error('Error loading value for key "'.concat(e,'":'),s),u&&a(r);return[3,8];case 7:u&&b(!0);return[7];case 8:return[2]}})})(),function(){u=!1,b(!1)}},[e,r,t]),f(function(){if(!h)return;n(function(){var r,n;return c(this,function(u){switch(u.label){case 0:u.trys.push([0,3,,4]);if(!(o!==void 0))return[3,2];r=t.serialize(o);return[4,p.set(e,r)];case 1:u.sent();u.label=2;case 2:return[3,4];case 3:n=u.sent();console.error('Error saving value for key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},[o,e,t,h]);var g=l(function(e){a(function(r){return typeof e=="function"?e(r):e})},[]),m=l(/*#__PURE__*/n(function(){var r;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,p.remove(e)];case 1:t.sent(),a(void 0);return[3,3];case 2:r=t.sent();console.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})}),[e]);return{value:o,set:g,remove:m}}export{b as useStorage};
1
+ // src/react/storage.tsx
2
+ function _array_like_to_array(arr, len) {
3
+ if (len == null || len > arr.length) len = arr.length;
4
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5
+ return arr2;
6
+ }
7
+ function _array_with_holes(arr) {
8
+ if (Array.isArray(arr)) return arr;
9
+ }
10
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
11
+ try {
12
+ var info = gen[key](arg);
13
+ var value = info.value;
14
+ } catch (error) {
15
+ reject(error);
16
+ return;
17
+ }
18
+ if (info.done) {
19
+ resolve(value);
20
+ } else {
21
+ Promise.resolve(value).then(_next, _throw);
22
+ }
23
+ }
24
+ function _async_to_generator(fn) {
25
+ return function() {
26
+ var self = this, args = arguments;
27
+ return new Promise(function(resolve, reject) {
28
+ var gen = fn.apply(self, args);
29
+ function _next(value) {
30
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
31
+ }
32
+ function _throw(err) {
33
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
34
+ }
35
+ _next(undefined);
36
+ });
37
+ };
38
+ }
39
+ function _instanceof(left, right) {
40
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
41
+ return !!right[Symbol.hasInstance](left);
42
+ } else {
43
+ return left instanceof right;
44
+ }
45
+ }
46
+ function _iterable_to_array_limit(arr, i) {
47
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
48
+ if (_i == null) return;
49
+ var _arr = [];
50
+ var _n = true;
51
+ var _d = false;
52
+ var _s, _e;
53
+ try {
54
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
55
+ _arr.push(_s.value);
56
+ if (i && _arr.length === i) break;
57
+ }
58
+ } catch (err) {
59
+ _d = true;
60
+ _e = err;
61
+ } finally{
62
+ try {
63
+ if (!_n && _i["return"] != null) _i["return"]();
64
+ } finally{
65
+ if (_d) throw _e;
66
+ }
67
+ }
68
+ return _arr;
69
+ }
70
+ function _non_iterable_rest() {
71
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
72
+ }
73
+ function _sliced_to_array(arr, i) {
74
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
75
+ }
76
+ function _unsupported_iterable_to_array(o, minLen) {
77
+ if (!o) return;
78
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
79
+ var n = Object.prototype.toString.call(o).slice(8, -1);
80
+ if (n === "Object" && o.constructor) n = o.constructor.name;
81
+ if (n === "Map" || n === "Set") return Array.from(n);
82
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
83
+ }
84
+ function _ts_generator(thisArg, body) {
85
+ var f, y, t, g, _ = {
86
+ label: 0,
87
+ sent: function() {
88
+ if (t[0] & 1) throw t[1];
89
+ return t[1];
90
+ },
91
+ trys: [],
92
+ ops: []
93
+ };
94
+ return g = {
95
+ next: verb(0),
96
+ "throw": verb(1),
97
+ "return": verb(2)
98
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
99
+ return this;
100
+ }), g;
101
+ function verb(n) {
102
+ return function(v) {
103
+ return step([
104
+ n,
105
+ v
106
+ ]);
107
+ };
108
+ }
109
+ function step(op) {
110
+ if (f) throw new TypeError("Generator is already executing.");
111
+ while(_)try {
112
+ 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;
113
+ if (y = 0, t) op = [
114
+ op[0] & 2,
115
+ t.value
116
+ ];
117
+ switch(op[0]){
118
+ case 0:
119
+ case 1:
120
+ t = op;
121
+ break;
122
+ case 4:
123
+ _.label++;
124
+ return {
125
+ value: op[1],
126
+ done: false
127
+ };
128
+ case 5:
129
+ _.label++;
130
+ y = op[1];
131
+ op = [
132
+ 0
133
+ ];
134
+ continue;
135
+ case 7:
136
+ op = _.ops.pop();
137
+ _.trys.pop();
138
+ continue;
139
+ default:
140
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
141
+ _ = 0;
142
+ continue;
143
+ }
144
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
145
+ _.label = op[1];
146
+ break;
147
+ }
148
+ if (op[0] === 6 && _.label < t[1]) {
149
+ _.label = t[1];
150
+ t = op;
151
+ break;
152
+ }
153
+ if (t && _.label < t[2]) {
154
+ _.label = t[2];
155
+ _.ops.push(op);
156
+ break;
157
+ }
158
+ if (t[2]) _.ops.pop();
159
+ _.trys.pop();
160
+ continue;
161
+ }
162
+ op = body.call(thisArg, _);
163
+ } catch (e) {
164
+ op = [
165
+ 6,
166
+ e
167
+ ];
168
+ y = 0;
169
+ } finally{
170
+ f = t = 0;
171
+ }
172
+ if (op[0] & 5) throw op[1];
173
+ return {
174
+ value: op[0] ? op[1] : void 0,
175
+ done: true
176
+ };
177
+ }
178
+ }
179
+ import { useCallback, useEffect, useState } from "react";
180
+ // src/utils/serializer.ts
181
+ var serializer = {
182
+ serialize: function(value) {
183
+ return JSON.stringify(value, function(_, v) {
184
+ if (_instanceof(v, Date)) {
185
+ return {
186
+ __type: "Date",
187
+ value: v.toISOString()
188
+ };
189
+ }
190
+ return v;
191
+ });
192
+ },
193
+ deserialize: function(value) {
194
+ return JSON.parse(value, function(_, v) {
195
+ if ((v === null || v === void 0 ? void 0 : v.__type) === "Date") {
196
+ return new Date(v.value);
197
+ }
198
+ return v;
199
+ });
200
+ }
201
+ };
202
+ // src/utils/storage-client.ts
203
+ import localForage from "localforage";
204
+ var storageClient = {
205
+ get: function get(key) {
206
+ return _async_to_generator(function() {
207
+ var error;
208
+ return _ts_generator(this, function(_state) {
209
+ switch(_state.label){
210
+ case 0:
211
+ _state.trys.push([
212
+ 0,
213
+ 2,
214
+ ,
215
+ 3
216
+ ]);
217
+ return [
218
+ 4,
219
+ localForage.getItem(key)
220
+ ];
221
+ case 1:
222
+ return [
223
+ 2,
224
+ _state.sent()
225
+ ];
226
+ case 2:
227
+ error = _state.sent();
228
+ console.error('❌ [Storage:get] Error getting key "'.concat(key, '":'), error);
229
+ return [
230
+ 2,
231
+ null
232
+ ];
233
+ case 3:
234
+ return [
235
+ 2
236
+ ];
237
+ }
238
+ });
239
+ })();
240
+ },
241
+ set: function set(key, value) {
242
+ return _async_to_generator(function() {
243
+ var error;
244
+ return _ts_generator(this, function(_state) {
245
+ switch(_state.label){
246
+ case 0:
247
+ _state.trys.push([
248
+ 0,
249
+ 2,
250
+ ,
251
+ 3
252
+ ]);
253
+ return [
254
+ 4,
255
+ localForage.setItem(key, value)
256
+ ];
257
+ case 1:
258
+ _state.sent();
259
+ return [
260
+ 3,
261
+ 3
262
+ ];
263
+ case 2:
264
+ error = _state.sent();
265
+ console.error('❌ [Storage:set] Error setting key "'.concat(key, '":'), error);
266
+ return [
267
+ 3,
268
+ 3
269
+ ];
270
+ case 3:
271
+ return [
272
+ 2
273
+ ];
274
+ }
275
+ });
276
+ })();
277
+ },
278
+ remove: function remove(key) {
279
+ return _async_to_generator(function() {
280
+ var error;
281
+ return _ts_generator(this, function(_state) {
282
+ switch(_state.label){
283
+ case 0:
284
+ _state.trys.push([
285
+ 0,
286
+ 2,
287
+ ,
288
+ 3
289
+ ]);
290
+ return [
291
+ 4,
292
+ localForage.removeItem(key)
293
+ ];
294
+ case 1:
295
+ _state.sent();
296
+ return [
297
+ 3,
298
+ 3
299
+ ];
300
+ case 2:
301
+ error = _state.sent();
302
+ console.error('❌ [Storage:remove] Error removing key "'.concat(key, '":'), error);
303
+ return [
304
+ 3,
305
+ 3
306
+ ];
307
+ case 3:
308
+ return [
309
+ 2
310
+ ];
311
+ }
312
+ });
313
+ })();
314
+ },
315
+ keys: function keys() {
316
+ return _async_to_generator(function() {
317
+ var keys, error;
318
+ return _ts_generator(this, function(_state) {
319
+ switch(_state.label){
320
+ case 0:
321
+ _state.trys.push([
322
+ 0,
323
+ 2,
324
+ ,
325
+ 3
326
+ ]);
327
+ return [
328
+ 4,
329
+ localForage.keys()
330
+ ];
331
+ case 1:
332
+ keys = _state.sent();
333
+ return [
334
+ 2,
335
+ keys !== null && keys !== void 0 ? keys : []
336
+ ];
337
+ case 2:
338
+ error = _state.sent();
339
+ console.error("❌ [Storage:keys] Error getting keys:", error);
340
+ return [
341
+ 2,
342
+ []
343
+ ];
344
+ case 3:
345
+ return [
346
+ 2
347
+ ];
348
+ }
349
+ });
350
+ })();
351
+ }
352
+ };
353
+ // src/react/storage.tsx
354
+ function useStorage(key, initialValue) {
355
+ var serializer2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : serializer;
356
+ var _useState = _sliced_to_array(useState(initialValue), 2), value = _useState[0], setValue = _useState[1];
357
+ var _useState1 = _sliced_to_array(useState(false), 2), isLoaded = _useState1[0], setIsLoaded = _useState1[1];
358
+ useEffect(function() {
359
+ var isMounted = true;
360
+ var loadValue = /*#__PURE__*/ function() {
361
+ var _ref = _async_to_generator(function() {
362
+ var valueFound, parsedValue, serialized, error;
363
+ return _ts_generator(this, function(_state) {
364
+ switch(_state.label){
365
+ case 0:
366
+ _state.trys.push([
367
+ 0,
368
+ 6,
369
+ 7,
370
+ 8
371
+ ]);
372
+ return [
373
+ 4,
374
+ storageClient.get(key)
375
+ ];
376
+ case 1:
377
+ valueFound = _state.sent();
378
+ if (!isMounted) return [
379
+ 3,
380
+ 5
381
+ ];
382
+ if (!(valueFound !== null)) return [
383
+ 3,
384
+ 2
385
+ ];
386
+ parsedValue = serializer2.deserialize(valueFound);
387
+ setValue(parsedValue);
388
+ return [
389
+ 3,
390
+ 5
391
+ ];
392
+ case 2:
393
+ if (!(initialValue !== void 0)) return [
394
+ 3,
395
+ 4
396
+ ];
397
+ serialized = serializer2.serialize(initialValue);
398
+ return [
399
+ 4,
400
+ storageClient.set(key, serialized)
401
+ ];
402
+ case 3:
403
+ _state.sent();
404
+ setValue(initialValue);
405
+ return [
406
+ 3,
407
+ 5
408
+ ];
409
+ case 4:
410
+ setValue(void 0);
411
+ _state.label = 5;
412
+ case 5:
413
+ return [
414
+ 3,
415
+ 8
416
+ ];
417
+ case 6:
418
+ error = _state.sent();
419
+ console.error('Error loading value for key "'.concat(key, '":'), error);
420
+ if (isMounted) {
421
+ setValue(initialValue);
422
+ }
423
+ return [
424
+ 3,
425
+ 8
426
+ ];
427
+ case 7:
428
+ if (isMounted) setIsLoaded(true);
429
+ return [
430
+ 7
431
+ ];
432
+ case 8:
433
+ return [
434
+ 2
435
+ ];
436
+ }
437
+ });
438
+ });
439
+ return function loadValue() {
440
+ return _ref.apply(this, arguments);
441
+ };
442
+ }();
443
+ loadValue();
444
+ return function() {
445
+ isMounted = false;
446
+ setIsLoaded(false);
447
+ };
448
+ }, [
449
+ key,
450
+ initialValue,
451
+ serializer2
452
+ ]);
453
+ useEffect(function() {
454
+ if (!isLoaded) return;
455
+ var saveValue = /*#__PURE__*/ function() {
456
+ var _ref = _async_to_generator(function() {
457
+ var serialized, error;
458
+ return _ts_generator(this, function(_state) {
459
+ switch(_state.label){
460
+ case 0:
461
+ _state.trys.push([
462
+ 0,
463
+ 3,
464
+ ,
465
+ 4
466
+ ]);
467
+ if (!(value !== void 0)) return [
468
+ 3,
469
+ 2
470
+ ];
471
+ serialized = serializer2.serialize(value);
472
+ return [
473
+ 4,
474
+ storageClient.set(key, serialized)
475
+ ];
476
+ case 1:
477
+ _state.sent();
478
+ _state.label = 2;
479
+ case 2:
480
+ return [
481
+ 3,
482
+ 4
483
+ ];
484
+ case 3:
485
+ error = _state.sent();
486
+ console.error('Error saving value for key "'.concat(key, '":'), error);
487
+ return [
488
+ 3,
489
+ 4
490
+ ];
491
+ case 4:
492
+ return [
493
+ 2
494
+ ];
495
+ }
496
+ });
497
+ });
498
+ return function saveValue() {
499
+ return _ref.apply(this, arguments);
500
+ };
501
+ }();
502
+ saveValue();
503
+ }, [
504
+ value,
505
+ key,
506
+ serializer2,
507
+ isLoaded
508
+ ]);
509
+ var set = useCallback(function(newValue) {
510
+ setValue(function(prev) {
511
+ return typeof newValue === "function" ? newValue(prev) : newValue;
512
+ });
513
+ }, []);
514
+ var remove = useCallback(/*#__PURE__*/ _async_to_generator(function() {
515
+ var error;
516
+ return _ts_generator(this, function(_state) {
517
+ switch(_state.label){
518
+ case 0:
519
+ _state.trys.push([
520
+ 0,
521
+ 2,
522
+ ,
523
+ 3
524
+ ]);
525
+ return [
526
+ 4,
527
+ storageClient.remove(key)
528
+ ];
529
+ case 1:
530
+ _state.sent();
531
+ setValue(void 0);
532
+ return [
533
+ 3,
534
+ 3
535
+ ];
536
+ case 2:
537
+ error = _state.sent();
538
+ console.error('Error removing key "'.concat(key, '":'), error);
539
+ return [
540
+ 3,
541
+ 3
542
+ ];
543
+ case 3:
544
+ return [
545
+ 2
546
+ ];
547
+ }
548
+ });
549
+ }), [
550
+ key
551
+ ]);
552
+ return {
553
+ value: value,
554
+ set: set,
555
+ remove: remove
556
+ };
557
+ }
558
+ export { useStorage };
@@ -1 +1,48 @@
1
- "use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var r=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var u=function(u,a,f,l){var c=true,i=false,y=undefined;if(a&&(typeof a==="undefined"?"undefined":e(a))=="object"||typeof a=="function")try{var p=function(){var e=d.value;!o.call(u,e)&&e!==f&&r(u,e,{get:function(){return a[e]},enumerable:!(l=t(a,e))||l.enumerable})};for(var v=n(a)[Symbol.iterator](),d;!(c=(d=v.next()).done);c=true)p()}catch(e){i=true;y=e}finally{try{if(!c&&v.return!=null){v.return()}}finally{if(i){throw y}}}return u};var a=function(e){return u(r({},"__esModule",{value:!0}),e)};var f={};module.exports=a(f);
1
+ "use strict";
2
+ function _type_of(obj) {
3
+ "@swc/helpers - typeof";
4
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
5
+ }
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __copyProps = function(to, from, except, desc) {
11
+ if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
12
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
13
+ try {
14
+ var _loop = function() {
15
+ var key = _step.value;
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: function() {
18
+ return from[key];
19
+ },
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ };
23
+ for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
24
+ } catch (err) {
25
+ _didIteratorError = true;
26
+ _iteratorError = err;
27
+ } finally{
28
+ try {
29
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
30
+ _iterator.return();
31
+ }
32
+ } finally{
33
+ if (_didIteratorError) {
34
+ throw _iteratorError;
35
+ }
36
+ }
37
+ }
38
+ }
39
+ return to;
40
+ };
41
+ var __toCommonJS = function(mod) {
42
+ return __copyProps(__defProp({}, "__esModule", {
43
+ value: true
44
+ }), mod);
45
+ };
46
+ // src/typescript/api-response.ts
47
+ var api_response_exports = {};
48
+ module.exports = __toCommonJS(api_response_exports);
@@ -1 +1,48 @@
1
- "use strict";function e(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}var r=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var u=function(u,a,f,l){var c=true,i=false,y=undefined;if(a&&(typeof a==="undefined"?"undefined":e(a))=="object"||typeof a=="function")try{var p=function(){var e=d.value;!o.call(u,e)&&e!==f&&r(u,e,{get:function(){return a[e]},enumerable:!(l=t(a,e))||l.enumerable})};for(var v=n(a)[Symbol.iterator](),d;!(c=(d=v.next()).done);c=true)p()}catch(e){i=true;y=e}finally{try{if(!c&&v.return!=null){v.return()}}finally{if(i){throw y}}}return u};var a=function(e){return u(r({},"__esModule",{value:!0}),e)};var f={};module.exports=a(f);
1
+ "use strict";
2
+ function _type_of(obj) {
3
+ "@swc/helpers - typeof";
4
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
5
+ }
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __copyProps = function(to, from, except, desc) {
11
+ if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
12
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
13
+ try {
14
+ var _loop = function() {
15
+ var key = _step.value;
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: function() {
18
+ return from[key];
19
+ },
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ };
23
+ for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
24
+ } catch (err) {
25
+ _didIteratorError = true;
26
+ _iteratorError = err;
27
+ } finally{
28
+ try {
29
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
30
+ _iterator.return();
31
+ }
32
+ } finally{
33
+ if (_didIteratorError) {
34
+ throw _iteratorError;
35
+ }
36
+ }
37
+ }
38
+ }
39
+ return to;
40
+ };
41
+ var __toCommonJS = function(mod) {
42
+ return __copyProps(__defProp({}, "__esModule", {
43
+ value: true
44
+ }), mod);
45
+ };
46
+ // src/typescript/apollo.ts
47
+ var apollo_exports = {};
48
+ module.exports = __toCommonJS(apollo_exports);