@cyberskill/shared 1.21.0 → 1.23.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 (75) hide show
  1. package/dist/commands.cjs +1 -1
  2. package/dist/commands.js +1 -1
  3. package/dist/configs/index.cjs +1 -1
  4. package/dist/configs/index.js +1 -1
  5. package/dist/controllers/index.cjs +1 -1
  6. package/dist/controllers/index.d.cts +1 -1
  7. package/dist/controllers/index.d.ts +1 -1
  8. package/dist/controllers/index.js +1 -1
  9. package/dist/controllers/mongo-migration.cjs +1 -0
  10. package/dist/controllers/mongo-migration.js +1 -0
  11. package/dist/controllers/mongoose.cjs +1 -1
  12. package/dist/controllers/mongoose.js +1 -1
  13. package/dist/hooks/react/index.cjs +1 -1
  14. package/dist/hooks/react/index.js +1 -1
  15. package/dist/hooks/react/use-storage.cjs +1 -1
  16. package/dist/hooks/react/use-storage.js +1 -1
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.cts +9 -9
  19. package/dist/index.d.ts +9 -9
  20. package/dist/index.js +1 -1
  21. package/dist/typescript/command.cjs +1 -1
  22. package/dist/typescript/command.d.cts +8 -12
  23. package/dist/typescript/command.d.ts +8 -12
  24. package/dist/typescript/command.js +1 -1
  25. package/dist/typescript/index.cjs +1 -1
  26. package/dist/typescript/index.d.cts +1 -1
  27. package/dist/typescript/index.d.ts +1 -1
  28. package/dist/typescript/index.js +1 -1
  29. package/dist/typescript/mongoose.cjs +1 -1
  30. package/dist/typescript/mongoose.js +1 -1
  31. package/dist/utils/command.cjs +1 -1
  32. package/dist/utils/command.d.cts +14 -1
  33. package/dist/utils/command.d.ts +14 -1
  34. package/dist/utils/command.js +1 -1
  35. package/dist/utils/config.cjs +1 -0
  36. package/dist/utils/config.d.cts +5 -0
  37. package/dist/utils/config.d.ts +5 -0
  38. package/dist/utils/config.js +1 -0
  39. package/dist/utils/datetime.cjs +1 -0
  40. package/dist/utils/datetime.d.cts +3 -0
  41. package/dist/utils/datetime.d.ts +3 -0
  42. package/dist/utils/datetime.js +1 -0
  43. package/dist/utils/fs.cjs +1 -0
  44. package/dist/utils/fs.d.cts +3 -0
  45. package/dist/utils/fs.d.ts +3 -0
  46. package/dist/utils/fs.js +1 -0
  47. package/dist/utils/index.cjs +1 -1
  48. package/dist/utils/index.d.cts +8 -9
  49. package/dist/utils/index.d.ts +8 -9
  50. package/dist/utils/index.js +1 -1
  51. package/dist/utils/log.cjs +1 -1
  52. package/dist/utils/log.js +1 -1
  53. package/dist/utils/mongoose.cjs +1 -1
  54. package/dist/utils/mongoose.d.cts +7 -1
  55. package/dist/utils/mongoose.d.ts +7 -1
  56. package/dist/utils/mongoose.js +1 -1
  57. package/dist/utils/npm-package.cjs +1 -1
  58. package/dist/utils/npm-package.js +1 -1
  59. package/dist/utils/storage.cjs +1 -1
  60. package/dist/utils/storage.d.cts +2 -5
  61. package/dist/utils/storage.d.ts +2 -5
  62. package/dist/utils/storage.js +1 -1
  63. package/package.json +4 -3
  64. package/dist/controllers/migration.cjs +0 -1
  65. package/dist/controllers/migration.js +0 -1
  66. package/dist/utils/command-error.cjs +0 -1
  67. package/dist/utils/command-error.d.cts +0 -18
  68. package/dist/utils/command-error.d.ts +0 -18
  69. package/dist/utils/command-error.js +0 -1
  70. package/dist/utils/command-log.cjs +0 -1
  71. package/dist/utils/command-log.d.cts +0 -17
  72. package/dist/utils/command-log.d.ts +0 -17
  73. package/dist/utils/command-log.js +0 -1
  74. /package/dist/controllers/{migration.d.cts → mongo-migration.d.cts} +0 -0
  75. /package/dist/controllers/{migration.d.ts → mongo-migration.d.ts} +0 -0
@@ -1 +0,0 @@
1
- "use strict";function e(e,t,n,s,r,u,c){try{var a=e[u](c);var o=a.value}catch(e){n(e);return}if(a.done){t(o)}else{Promise.resolve(o).then(s,r)}}function t(t){return function(){var n=this,s=arguments;return new Promise(function(r,u){var c=t.apply(n,s);function a(t){e(c,r,u,a,o,"next",t)}function o(t){e(c,r,u,a,o,"throw",t)}a(undefined)})}}function n(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function s(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||false;s.configurable=true;if("value"in s)s.writable=true;Object.defineProperty(e,s.key,s)}}function r(e,t,n){if(t)s(e.prototype,t);if(n)s(e,n);return e}function u(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function c(e,t){var n,s,r,u,c={label:0,sent:function(){if(r[0]&1)throw r[1];return r[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(t){return o([e,t])}}function o(u){if(n)throw new TypeError("Generator is already executing.");while(c)try{if(n=1,s&&(r=u[0]&2?s["return"]:u[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,u[1])).done)return r;if(s=0,r)u=[u[0]&2,r.value];switch(u[0]){case 0:case 1:r=u;break;case 4:c.label++;return{value:u[1],done:false};case 5:c.label++;s=u[1];u=[0];continue;case 7:u=c.ops.pop();c.trys.pop();continue;default:if(!(r=c.trys,r=r.length>0&&r[r.length-1])&&(u[0]===6||u[0]===2)){c=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){c.label=u[1];break}if(u[0]===6&&c.label<r[1]){c.label=r[1];r=u;break}if(r&&c.label<r[2]){c.label=r[2];c.ops.push(u);break}if(r[2])c.ops.pop();c.trys.pop();continue}u=t.call(e,c)}catch(e){u=[6,e];s=0}finally{n=r=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}var a=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=function(e,t){for(var n in t)a(e,n,{get:t[n],enumerable:!0})},h=function(e,t,n,s){var r=true,c=false,f=undefined;if(t&&(typeof t==="undefined"?"undefined":u(t))=="object"||typeof t=="function")try{var h=function(){var r=m.value;!l.call(e,r)&&r!==n&&a(e,r,{get:function(){return t[r]},enumerable:!(s=o(t,r))||s.enumerable})};for(var d=i(t)[Symbol.iterator](),m;!(r=(m=d.next()).done);r=true)h()}catch(e){c=true;f=e}finally{try{if(!r&&d.return!=null){d.return()}}finally{if(c){throw f}}}return e};var d=function(e){return h(a({},"__esModule",{value:!0}),e)};var m={};f(m,{MigrationController:function(){return y}});module.exports=d(m);var y=/*#__PURE__*/function(){function e(t,s){n(this,e);this.collection=t.collection(s)}r(e,[{key:"createOne",value:function e(e){var n=this;return t(function(){var t,s;return c(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);t={success:!0,message:"Document created successfully"};return[4,n.collection.insertOne(e)];case 1:return[2,(t.result=r.sent(),t)];case 2:s=r.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var n=this;return t(function(){var t,s;return c(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,n.collection.insertMany(e)];case 1:t=r.sent();return[2,t.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(t.insertedCount," documents created successfully"),result:t}];case 2:s=r.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"findOne",value:function e(e){var n=this;return t(function(){var t,s;return c(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,n.collection.findOne(e)];case 1:t=r.sent();return[2,t?{success:!0,message:"Document found",result:t}:{success:!1,message:"Document not found"}];case 2:s=r.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var n=this;return t(function(){var t,s;return c(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);t={success:!0,message:"Documents retrieved successfully"};return[4,n.collection.find(e).toArray()];case 1:return[2,(t.result=r.sent(),t)];case 2:s=r.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var n=this;return t(function(){var t,s;return c(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);t={success:!0,message:"Count retrieved successfully"};return[4,n.collection.countDocuments(e)];case 1:return[2,(t.result=r.sent(),t)];case 2:s=r.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(e,n){var s=this;return t(function(){var t,r;return c(this,function(u){switch(u.label){case 0:u.trys.push([0,2,,3]);return[4,s.collection.updateOne(e,{$set:n})];case 1:t=u.sent();return[2,t.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:t}];case 2:r=u.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(e,n){var s=this;return t(function(){var t,r;return c(this,function(u){switch(u.label){case 0:u.trys.push([0,2,,3]);return[4,s.collection.updateMany(e,{$set:n})];case 1:t=u.sent();return[2,t.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:t}];case 2:r=u.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(e){var n=this;return t(function(){var t,s;return c(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,n.collection.deleteOne(e)];case 1:t=r.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:t}];case 2:s=r.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(e){var n=this;return t(function(){var t,s;return c(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,n.collection.deleteMany(e)];case 1:t=r.sent();return[2,t.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:t}];case 2:s=r.sent();return[2,{success:!1,message:s.message}];case 3:return[2]}})})()}}]);return e}();0&&(module.exports={MigrationController:MigrationController});
@@ -1 +0,0 @@
1
- function e(e,s,t,n,r,u,c){try{var a=e[u](c);var o=a.value}catch(e){t(e);return}if(a.done){s(o)}else{Promise.resolve(o).then(n,r)}}function s(s){return function(){var t=this,n=arguments;return new Promise(function(r,u){var c=s.apply(t,n);function a(s){e(c,r,u,a,o,"next",s)}function o(s){e(c,r,u,a,o,"throw",s)}a(undefined)})}}function t(e,s){if(!(e instanceof s)){throw new TypeError("Cannot call a class as a function")}}function n(e,s){for(var t=0;t<s.length;t++){var n=s[t];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function r(e,s,t){if(s)n(e.prototype,s);if(t)n(e,t);return e}function u(e,s){var t,n,r,u,c={label:0,sent:function(){if(r[0]&1)throw r[1];return r[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(s){return o([e,s])}}function o(u){if(t)throw new TypeError("Generator is already executing.");while(c)try{if(t=1,n&&(r=u[0]&2?n["return"]:u[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,u[1])).done)return r;if(n=0,r)u=[u[0]&2,r.value];switch(u[0]){case 0:case 1:r=u;break;case 4:c.label++;return{value:u[1],done:false};case 5:c.label++;n=u[1];u=[0];continue;case 7:u=c.ops.pop();c.trys.pop();continue;default:if(!(r=c.trys,r=r.length>0&&r[r.length-1])&&(u[0]===6||u[0]===2)){c=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]<r[3])){c.label=u[1];break}if(u[0]===6&&c.label<r[1]){c.label=r[1];r=u;break}if(r&&c.label<r[2]){c.label=r[2];c.ops.push(u);break}if(r[2])c.ops.pop();c.trys.pop();continue}u=s.call(e,c)}catch(e){u=[6,e];n=0}finally{t=r=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}var c=/*#__PURE__*/function(){"use strict";function e(s,n){t(this,e);this.collection=s.collection(n)}r(e,[{key:"createOne",value:function e(e){var t=this;return s(function(){var s,n;return u(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);s={success:!0,message:"Document created successfully"};return[4,t.collection.insertOne(e)];case 1:return[2,(s.result=r.sent(),s)];case 2:n=r.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"createMany",value:function e(e){var t=this;return s(function(){var s,n;return u(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,t.collection.insertMany(e)];case 1:s=r.sent();return[2,s.insertedCount===0?{success:!1,message:"No documents were inserted"}:{success:!0,message:"".concat(s.insertedCount," documents created successfully"),result:s}];case 2:n=r.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"findOne",value:function e(e){var t=this;return s(function(){var s,n;return u(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,t.collection.findOne(e)];case 1:s=r.sent();return[2,s?{success:!0,message:"Document found",result:s}:{success:!1,message:"Document not found"}];case 2:n=r.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"findAll",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return s(function(){var s,n;return u(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);s={success:!0,message:"Documents retrieved successfully"};return[4,t.collection.find(e).toArray()];case 1:return[2,(s.result=r.sent(),s)];case 2:n=r.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"count",value:function e(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};var t=this;return s(function(){var s,n;return u(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);s={success:!0,message:"Count retrieved successfully"};return[4,t.collection.countDocuments(e)];case 1:return[2,(s.result=r.sent(),s)];case 2:n=r.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"updateOne",value:function e(e,t){var n=this;return s(function(){var s,r;return u(this,function(u){switch(u.label){case 0:u.trys.push([0,2,,3]);return[4,n.collection.updateOne(e,{$set:t})];case 1:s=u.sent();return[2,s.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document updated successfully",result:s}];case 2:r=u.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"updateMany",value:function e(e,t){var n=this;return s(function(){var s,r;return u(this,function(u){switch(u.label){case 0:u.trys.push([0,2,,3]);return[4,n.collection.updateMany(e,{$set:t})];case 1:s=u.sent();return[2,s.matchedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents updated successfully",result:s}];case 2:r=u.sent();return[2,{success:!1,message:r.message}];case 3:return[2]}})})()}},{key:"deleteOne",value:function e(e){var t=this;return s(function(){var s,n;return u(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,t.collection.deleteOne(e)];case 1:s=r.sent();return[2,s.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Document deleted successfully",result:s}];case 2:n=r.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}},{key:"deleteMany",value:function e(e){var t=this;return s(function(){var s,n;return u(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,t.collection.deleteMany(e)];case 1:s=r.sent();return[2,s.deletedCount===0?{success:!1,message:"No documents matched the filter"}:{success:!0,message:"Documents deleted successfully",result:s}];case 2:n=r.sent();return[2,{success:!1,message:n.message}];case 3:return[2]}})})()}}]);return e}();export{c as MigrationController};
@@ -1 +0,0 @@
1
- "use strict";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(r){if(Array.isArray(r))return e(r)}function t(e,r,t,n,o,a,u){try{var s=e[a](u);var c=s.value}catch(e){t(e);return}if(s.done){r(c)}else{Promise.resolve(c).then(n,o)}}function n(e){return function(){var r=this,n=arguments;return new Promise(function(o,a){var u=e.apply(r,n);function s(e){t(u,o,a,s,c,"next",e)}function c(e){t(u,o,a,s,c,"throw",e)}s(undefined)})}}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e){return r(e)||o(e)||c(e)||a()}function s(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function c(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 l(e,r){var t,n,o,a,u={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(r){return c([e,r])}}function c(a){if(t)throw new TypeError("Generator is already executing.");while(u)try{if(t=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:u.label++;return{value:a[1],done:false};case 5:u.label++;n=a[1];a=[0];continue;case 7:a=u.ops.pop();u.trys.pop();continue;default:if(!(o=u.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){u=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(a[0]===6&&u.label<o[1]){u.label=o[1];o=a;break}if(o&&u.label<o[2]){u.label=o[2];u.ops.push(a);break}if(o[2])u.ops.pop();u.trys.pop();continue}a=r.call(e,u)}catch(e){a=[6,e];n=0}finally{t=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var i=Object.create;var f=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var h=function(e,r){for(var t in r)f(e,t,{get:r[t],enumerable:!0})},v=function(e,r,t,n){var o=true,a=false,u=undefined;if(r&&(typeof r==="undefined"?"undefined":s(r))=="object"||typeof r=="function")try{var c=function(){var o=i.value;!p.call(e,o)&&o!==t&&f(e,o,{get:function(){return r[o]},enumerable:!(n=y(r,o))||n.enumerable})};for(var l=d(r)[Symbol.iterator](),i;!(o=(i=l.next()).done);o=true)c()}catch(e){a=true;u=e}finally{try{if(!o&&l.return!=null){l.return()}}finally{if(a){throw u}}}return e};var b=function(e,r,t){return t=e!=null?i(g(e)):{},v(r||!e||!e.__esModule?f(t,"default",{value:e,enumerable:!0}):t,e)},m=function(e){return v(f({},"__esModule",{value:!0}),e)};var w={};h(w,{clearAllErrorLists:function(){return Y},getStoredErrorLists:function(){return B},saveErrorListToStorage:function(){return G}});module.exports=m(w);var S=b(require("boxen"),1),E=b(require("chalk"),1);var k=E.default,O=k.green,A=k.yellow,I=k.red,L=k.gray,_=k.bold,R=k.blue,x={step:function(e,r,t){var n=new Date().toLocaleTimeString(),o=e!==null&&r!==null?"STEP [".concat(e,"/").concat(r,"]"):"STEP";console.log("".concat(O(o)," ").concat(L("[".concat(n,"]"))," ").concat(_(t)))},success:function(e){console.log("".concat(O("✔ SUCCESS")," ").concat(e))},error:function(e){console.log("".concat(I("✖ ERROR")," ").concat(e))},warning:function(e){console.log("".concat(A("⚠ WARNING")," ").concat(e))},info:function(e){console.log("".concat(L("ℹ INFO")," ").concat(e))},boxedResult:function(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:O;console.log((0,S.default)(_(t("".concat(e,"\n").concat(r))),{padding:1,margin:1,borderStyle:"round",borderColor:t===I?"red":t===A?"yellow":"green"}))},logResults:function(e,r,t,n){e.length&&(e.forEach(function(e){var n=e.file,o=e.position,a=e.rule,u=e.message;console.log("".concat(r("".concat(t," File:"))," ").concat(R("".concat(n).concat(o?":".concat(o):"")))),a&&console.log(" ".concat(r("Rule:")," ").concat(r(a))),console.log(" ".concat(r("Message:")," ").concat(r(u)))}),console.log((0,S.default)(_(r("".concat(t," Total ").concat(n,": ").concat(e.length))),{padding:1,margin:1,borderStyle:"round",borderColor:r===I?"red":r===A?"yellow":"green"})),console.log(L("─".repeat(40))))},displayResults:/*#__PURE__*/n(function(){var e,r,t;return l(this,function(n){switch(n.label){case 0:return[4,B()];case 1:e=n.sent(),r=e.filter(function(e){return e.type==="error"}),t=e.filter(function(e){return e.type==="warning"});!r.length&&!t.length?x.boxedResult("✔ NO ISSUES FOUND","",O):(x.logResults(t,A,"⚠","Warnings"),x.logResults(r,I,"✖","Errors"));return[2]}})})};var P=b(require("localforage"),1),j=b(require("node-persist"),1),T=b(require("os"),1),N=b(require("path"),1),q=b(require("process"),1),C=(typeof window==="undefined"?"undefined":s(window))<"u",F=q.default.env.CYBERSKILL_STORAGE_DIR||N.default.join(T.default.homedir(),".cyberskill-storage");function U(){return D.apply(this,arguments)}function D(){D=n(function(){var e;return l(this,function(r){switch(r.label){case 0:e=!C&&!j.default.defaultInstance;if(!e)return[3,2];return[4,j.default.init({dir:F,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return D.apply(this,arguments)}var M={get:function e(e){return n(function(){var r,t,n;return l(this,function(o){switch(o.label){case 0:o.trys.push([0,6,,7]);if(!C)return[3,2];return[4,P.default.getItem(e)];case 1:t=o.sent();return[3,5];case 2:return[4,U()];case 3:o.sent();return[4,j.default.getItem(e)];case 4:t=(r=o.sent())!==null&&r!==void 0?r:null;o.label=5;case 5:return[2,t];case 6:n=o.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 7:return[2]}})})()},set:function e(e,r){return n(function(){var t,n;return l(this,function(o){switch(o.label){case 0:o.trys.push([0,6,,7]);if(!C)return[3,2];return[4,P.default.setItem(e,r)];case 1:t=o.sent();return[3,5];case 2:return[4,U()];case 3:o.sent();return[4,j.default.setItem(e,r)];case 4:t=o.sent();o.label=5;case 5:t;return[3,7];case 6:n=o.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),n);return[3,7];case 7:return[2]}})})()},remove:function e(e){return n(function(){var r,t;return l(this,function(n){switch(n.label){case 0:n.trys.push([0,6,,7]);if(!C)return[3,2];return[4,P.default.removeItem(e)];case 1:r=n.sent();return[3,5];case 2:return[4,U()];case 3:n.sent();return[4,j.default.removeItem(e)];case 4:r=n.sent();n.label=5;case 5:r;return[3,7];case 6:t=n.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,7];case 7:return[2]}})})()},keys:function e(){return n(function(){var e,r,t;return l(this,function(n){switch(n.label){case 0:n.trys.push([0,5,,6]);if(!C)return[3,2];return[4,P.default.keys()];case 1:return[2,(e=n.sent())!==null&&e!==void 0?e:[]];case 2:return[4,U()];case 3:n.sent();return[4,j.default.keys()];case 4:r=n.sent();return[2,Array.isArray(r)?r:(console.warn("⚠️ [Storage:keys] Invalid keys response:",r),[])];case 5:t=n.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",t),[])];case 6:return[2]}})})()},getLogLink:function e(e){return n(function(){return l(this,function(r){try{return[2,"".concat(F," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var W=function(e){return"error_list:".concat(e)};function G(e){return J.apply(this,arguments)}function J(){J=n(function(e){var r,t,o;return l(this,function(a){switch(a.label){case 0:if(!e.length)return[2];r=Date.now(),t=W(r);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,M.set(t,{errors:e,timestamp:r})];case 2:a.sent(),setTimeout(/*#__PURE__*/n(function(){var e;return l(this,function(r){switch(r.label){case 0:return[4,M.getLogLink(t)];case 1:e=r.sent();e&&x.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:o=a.sent();x.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return J.apply(this,arguments)}function B(){return K.apply(this,arguments)}function K(){K=n(function(){var e,r,t,n,o,a,s,c,i,f,y,d,g;return l(this,function(l){switch(l.label){case 0:l.trys.push([0,10,,11]);return[4,M.keys()];case 1:e=l.sent();if(!Array.isArray(e))return[2,(x.warning("Invalid response from storage.keys(): ".concat(e)),[])];r=e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}),t=[];n=true,o=false,a=undefined;l.label=2;case 2:l.trys.push([2,7,8,9]);s=r[Symbol.iterator]();l.label=3;case 3:if(!!(n=(c=s.next()).done))return[3,6];i=c.value;return[4,M.get(i)];case 4:y=l.sent();y&&(f=t).push.apply(f,u(y.errors));l.label=5;case 5:n=true;return[3,3];case 6:return[3,9];case 7:d=l.sent();o=true;a=d;return[3,9];case 8:try{if(!n&&s.return!=null){s.return()}}finally{if(o){throw a}}return[7];case 9:return[2,t];case 10:g=l.sent();return[2,(x.error("Failed to retrieve stored errors: ".concat(g.message)),[])];case 11:return[2]}})});return K.apply(this,arguments)}function Y(){return $.apply(this,arguments)}function $(){$=n(function(){var e,r,t,n,o,a,u,s,c,i;return l(this,function(l){switch(l.label){case 0:l.trys.push([0,10,,11]);return[4,M.keys()];case 1:e=l.sent();if(!Array.isArray(e)){x.warning("Invalid response from storage.keys(): ".concat(e));return[2]}r=e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")});t=true,n=false,o=undefined;l.label=2;case 2:l.trys.push([2,7,8,9]);a=r[Symbol.iterator]();l.label=3;case 3:if(!!(t=(u=a.next()).done))return[3,6];s=u.value;return[4,M.remove(s)];case 4:l.sent();l.label=5;case 5:t=true;return[3,3];case 6:return[3,9];case 7:c=l.sent();n=true;o=c;return[3,9];case 8:try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw o}}return[7];case 9:return[3,11];case 10:i=l.sent();x.error("Failed to clear error lists: ".concat(i.message));return[3,11];case 11:return[2]}})});return $.apply(this,arguments)}0&&(module.exports={clearAllErrorLists:clearAllErrorLists,getStoredErrorLists:getStoredErrorLists,saveErrorListToStorage:saveErrorListToStorage});
@@ -1,18 +0,0 @@
1
- import { I_ErrorEntry } from '../typescript/command.cjs';
2
-
3
- /**
4
- * Save the entire error list to storage.
5
- * @param errorList Array of I_ErrorEntry objects.
6
- */
7
- declare function saveErrorListToStorage(errorList: I_ErrorEntry[]): Promise<void>;
8
- /**
9
- * Get all stored error lists.
10
- * @returns An array of stored error objects.
11
- */
12
- declare function getStoredErrorLists(): Promise<I_ErrorEntry[]>;
13
- /**
14
- * Clear all stored error lists.
15
- */
16
- declare function clearAllErrorLists(): Promise<void>;
17
-
18
- export { clearAllErrorLists, getStoredErrorLists, saveErrorListToStorage };
@@ -1,18 +0,0 @@
1
- import { I_ErrorEntry } from '../typescript/command.js';
2
-
3
- /**
4
- * Save the entire error list to storage.
5
- * @param errorList Array of I_ErrorEntry objects.
6
- */
7
- declare function saveErrorListToStorage(errorList: I_ErrorEntry[]): Promise<void>;
8
- /**
9
- * Get all stored error lists.
10
- * @returns An array of stored error objects.
11
- */
12
- declare function getStoredErrorLists(): Promise<I_ErrorEntry[]>;
13
- /**
14
- * Clear all stored error lists.
15
- */
16
- declare function clearAllErrorLists(): Promise<void>;
17
-
18
- export { clearAllErrorLists, getStoredErrorLists, saveErrorListToStorage };
@@ -1 +0,0 @@
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(r){if(Array.isArray(r))return e(r)}function t(e,r,t,n,o,s,a){try{var c=e[s](a);var u=c.value}catch(e){t(e);return}if(c.done){r(u)}else{Promise.resolve(u).then(n,o)}}function n(e){return function(){var r=this,n=arguments;return new Promise(function(o,s){var a=e.apply(r,n);function c(e){t(a,o,s,c,u,"next",e)}function u(e){t(a,o,s,c,u,"throw",e)}c(undefined)})}}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(e){return r(e)||o(e)||u(e)||s()}function c(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function u(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 i(e,r){var t,n,o,s,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return s={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(r){return u([e,r])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,n&&(o=s[0]&2?n["return"]:s[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;if(n=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:a.label++;return{value:s[1],done:false};case 5:a.label++;n=s[1];s=[0];continue;case 7:s=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){a=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(s[0]===6&&a.label<o[1]){a.label=o[1];o=s;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(s);break}if(o[2])a.ops.pop();a.trys.pop();continue}s=r.call(e,a)}catch(e){s=[6,e];n=0}finally{t=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}}import l from"boxen";import f from"chalk";var y=f.green,g=f.yellow,p=f.red,h=f.gray,d=f.bold,v=f.blue,m={step:function(e,r,t){var n=new Date().toLocaleTimeString(),o=e!==null&&r!==null?"STEP [".concat(e,"/").concat(r,"]"):"STEP";console.log("".concat(y(o)," ").concat(h("[".concat(n,"]"))," ").concat(d(t)))},success:function(e){console.log("".concat(y("✔ SUCCESS")," ").concat(e))},error:function(e){console.log("".concat(p("✖ ERROR")," ").concat(e))},warning:function(e){console.log("".concat(g("⚠ WARNING")," ").concat(e))},info:function(e){console.log("".concat(h("ℹ INFO")," ").concat(e))},boxedResult:function(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y;console.log(l(d(t("".concat(e,"\n").concat(r))),{padding:1,margin:1,borderStyle:"round",borderColor:t===p?"red":t===g?"yellow":"green"}))},logResults:function(e,r,t,n){e.length&&(e.forEach(function(e){var n=e.file,o=e.position,s=e.rule,a=e.message;console.log("".concat(r("".concat(t," File:"))," ").concat(v("".concat(n).concat(o?":".concat(o):"")))),s&&console.log(" ".concat(r("Rule:")," ").concat(r(s))),console.log(" ".concat(r("Message:")," ").concat(r(a)))}),console.log(l(d(r("".concat(t," Total ").concat(n,": ").concat(e.length))),{padding:1,margin:1,borderStyle:"round",borderColor:r===p?"red":r===g?"yellow":"green"})),console.log(h("─".repeat(40))))},displayResults:/*#__PURE__*/n(function(){var e,r,t;return i(this,function(n){switch(n.label){case 0:return[4,N()];case 1:e=n.sent(),r=e.filter(function(e){return e.type==="error"}),t=e.filter(function(e){return e.type==="warning"});!r.length&&!t.length?m.boxedResult("✔ NO ISSUES FOUND","",y):(m.logResults(t,g,"⚠","Warnings"),m.logResults(r,p,"✖","Errors"));return[2]}})})};import b from"localforage";import w from"node-persist";import S from"node:os";import k from"node:path";import E from"node:process";var I=(typeof window==="undefined"?"undefined":c(window))<"u",A=E.env.CYBERSKILL_STORAGE_DIR||k.join(S.homedir(),".cyberskill-storage");function R(){return _.apply(this,arguments)}function _(){_=n(function(){var e;return i(this,function(r){switch(r.label){case 0:e=!I&&!w.defaultInstance;if(!e)return[3,2];return[4,w.init({dir:A,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return _.apply(this,arguments)}var L={get:function e(e){return n(function(){var r,t,n;return i(this,function(o){switch(o.label){case 0:o.trys.push([0,6,,7]);if(!I)return[3,2];return[4,b.getItem(e)];case 1:t=o.sent();return[3,5];case 2:return[4,R()];case 3:o.sent();return[4,w.getItem(e)];case 4:t=(r=o.sent())!==null&&r!==void 0?r:null;o.label=5;case 5:return[2,t];case 6:n=o.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 7:return[2]}})})()},set:function e(e,r){return n(function(){var t,n;return i(this,function(o){switch(o.label){case 0:o.trys.push([0,6,,7]);if(!I)return[3,2];return[4,b.setItem(e,r)];case 1:t=o.sent();return[3,5];case 2:return[4,R()];case 3:o.sent();return[4,w.setItem(e,r)];case 4:t=o.sent();o.label=5;case 5:t;return[3,7];case 6:n=o.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),n);return[3,7];case 7:return[2]}})})()},remove:function e(e){return n(function(){var r,t;return i(this,function(n){switch(n.label){case 0:n.trys.push([0,6,,7]);if(!I)return[3,2];return[4,b.removeItem(e)];case 1:r=n.sent();return[3,5];case 2:return[4,R()];case 3:n.sent();return[4,w.removeItem(e)];case 4:r=n.sent();n.label=5;case 5:r;return[3,7];case 6:t=n.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,7];case 7:return[2]}})})()},keys:function e(){return n(function(){var e,r,t;return i(this,function(n){switch(n.label){case 0:n.trys.push([0,5,,6]);if(!I)return[3,2];return[4,b.keys()];case 1:return[2,(e=n.sent())!==null&&e!==void 0?e:[]];case 2:return[4,R()];case 3:n.sent();return[4,w.keys()];case 4:r=n.sent();return[2,Array.isArray(r)?r:(console.warn("⚠️ [Storage:keys] Invalid keys response:",r),[])];case 5:t=n.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",t),[])];case 6:return[2]}})})()},getLogLink:function e(e){return n(function(){return i(this,function(r){try{return[2,"".concat(A," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var x=function(e){return"error_list:".concat(e)};function O(e){return T.apply(this,arguments)}function T(){T=n(function(e){var r,t,o;return i(this,function(s){switch(s.label){case 0:if(!e.length)return[2];r=Date.now(),t=x(r);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,L.set(t,{errors:e,timestamp:r})];case 2:s.sent(),setTimeout(/*#__PURE__*/n(function(){var e;return i(this,function(r){switch(r.label){case 0:return[4,L.getLogLink(t)];case 1:e=r.sent();e&&m.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:o=s.sent();m.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return T.apply(this,arguments)}function N(){return P.apply(this,arguments)}function P(){P=n(function(){var e,r,t,n,o,s,c,u,l,f,y,g,p;return i(this,function(i){switch(i.label){case 0:i.trys.push([0,10,,11]);return[4,L.keys()];case 1:e=i.sent();if(!Array.isArray(e))return[2,(m.warning("Invalid response from storage.keys(): ".concat(e)),[])];r=e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}),t=[];n=true,o=false,s=undefined;i.label=2;case 2:i.trys.push([2,7,8,9]);c=r[Symbol.iterator]();i.label=3;case 3:if(!!(n=(u=c.next()).done))return[3,6];l=u.value;return[4,L.get(l)];case 4:y=i.sent();y&&(f=t).push.apply(f,a(y.errors));i.label=5;case 5:n=true;return[3,3];case 6:return[3,9];case 7:g=i.sent();o=true;s=g;return[3,9];case 8:try{if(!n&&c.return!=null){c.return()}}finally{if(o){throw s}}return[7];case 9:return[2,t];case 10:p=i.sent();return[2,(m.error("Failed to retrieve stored errors: ".concat(p.message)),[])];case 11:return[2]}})});return P.apply(this,arguments)}function C(){return F.apply(this,arguments)}function F(){F=n(function(){var e,r,t,n,o,s,a,c,u,l;return i(this,function(i){switch(i.label){case 0:i.trys.push([0,10,,11]);return[4,L.keys()];case 1:e=i.sent();if(!Array.isArray(e)){m.warning("Invalid response from storage.keys(): ".concat(e));return[2]}r=e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")});t=true,n=false,o=undefined;i.label=2;case 2:i.trys.push([2,7,8,9]);s=r[Symbol.iterator]();i.label=3;case 3:if(!!(t=(a=s.next()).done))return[3,6];c=a.value;return[4,L.remove(c)];case 4:i.sent();i.label=5;case 5:t=true;return[3,3];case 6:return[3,9];case 7:u=i.sent();n=true;o=u;return[3,9];case 8:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw o}}return[7];case 9:return[3,11];case 10:l=i.sent();m.error("Failed to clear error lists: ".concat(l.message));return[3,11];case 11:return[2]}})});return F.apply(this,arguments)}export{C as clearAllErrorLists,N as getStoredErrorLists,O as saveErrorListToStorage};
@@ -1 +0,0 @@
1
- "use strict";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(r){if(Array.isArray(r))return e(r)}function t(e,r,t,n,o,a,u){try{var c=e[a](u);var l=c.value}catch(e){t(e);return}if(c.done){r(l)}else{Promise.resolve(l).then(n,o)}}function n(e){return function(){var r=this,n=arguments;return new Promise(function(o,a){var u=e.apply(r,n);function c(e){t(u,o,a,c,l,"next",e)}function l(e){t(u,o,a,c,l,"throw",e)}c(undefined)})}}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e){return r(e)||o(e)||l(e)||a()}function c(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(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 s(e,r){var t,n,o,a,u={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(e){return function(r){return l([e,r])}}function l(a){if(t)throw new TypeError("Generator is already executing.");while(u)try{if(t=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:u.label++;return{value:a[1],done:false};case 5:u.label++;n=a[1];a=[0];continue;case 7:a=u.ops.pop();u.trys.pop();continue;default:if(!(o=u.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){u=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(a[0]===6&&u.label<o[1]){u.label=o[1];o=a;break}if(o&&u.label<o[2]){u.label=o[2];u.ops.push(a);break}if(o[2])u.ops.pop();u.trys.pop();continue}a=r.call(e,u)}catch(e){a=[6,e];n=0}finally{t=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var i=Object.create;var f=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var v=function(e,r){for(var t in r)f(e,t,{get:r[t],enumerable:!0})},b=function(e,r,t,n){var o=true,a=false,u=undefined;if(r&&(typeof r==="undefined"?"undefined":c(r))=="object"||typeof r=="function")try{var l=function(){var o=i.value;!p.call(e,o)&&o!==t&&f(e,o,{get:function(){return r[o]},enumerable:!(n=y(r,o))||n.enumerable})};for(var s=d(r)[Symbol.iterator](),i;!(o=(i=s.next()).done);o=true)l()}catch(e){a=true;u=e}finally{try{if(!o&&s.return!=null){s.return()}}finally{if(a){throw u}}}return e};var h=function(e,r,t){return t=e!=null?i(g(e)):{},b(r||!e||!e.__esModule?f(t,"default",{value:e,enumerable:!0}):t,e)},m=function(e){return b(f({},"__esModule",{value:!0}),e)};var w={};v(w,{log:function(){return W}});module.exports=m(w);var S=h(require("boxen"),1),k=h(require("chalk"),1);var O=h(require("localforage"),1),E=h(require("node-persist"),1),I=h(require("os"),1),R=h(require("path"),1),A=h(require("process"),1),j=(typeof window==="undefined"?"undefined":c(window))<"u",x=A.default.env.CYBERSKILL_STORAGE_DIR||R.default.join(I.default.homedir(),".cyberskill-storage");function P(){return _.apply(this,arguments)}function _(){_=n(function(){var e;return s(this,function(r){switch(r.label){case 0:e=!j&&!E.default.defaultInstance;if(!e)return[3,2];return[4,E.default.init({dir:x,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return _.apply(this,arguments)}var N={get:function e(e){return n(function(){var r,t,n;return s(this,function(o){switch(o.label){case 0:o.trys.push([0,6,,7]);if(!j)return[3,2];return[4,O.default.getItem(e)];case 1:t=o.sent();return[3,5];case 2:return[4,P()];case 3:o.sent();return[4,E.default.getItem(e)];case 4:t=(r=o.sent())!==null&&r!==void 0?r:null;o.label=5;case 5:return[2,t];case 6:n=o.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 7:return[2]}})})()},set:function e(e,r){return n(function(){var t,n;return s(this,function(o){switch(o.label){case 0:o.trys.push([0,6,,7]);if(!j)return[3,2];return[4,O.default.setItem(e,r)];case 1:t=o.sent();return[3,5];case 2:return[4,P()];case 3:o.sent();return[4,E.default.setItem(e,r)];case 4:t=o.sent();o.label=5;case 5:t;return[3,7];case 6:n=o.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),n);return[3,7];case 7:return[2]}})})()},remove:function e(e){return n(function(){var r,t;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,6,,7]);if(!j)return[3,2];return[4,O.default.removeItem(e)];case 1:r=n.sent();return[3,5];case 2:return[4,P()];case 3:n.sent();return[4,E.default.removeItem(e)];case 4:r=n.sent();n.label=5;case 5:r;return[3,7];case 6:t=n.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,7];case 7:return[2]}})})()},keys:function e(){return n(function(){var e,r,t;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,5,,6]);if(!j)return[3,2];return[4,O.default.keys()];case 1:return[2,(e=n.sent())!==null&&e!==void 0?e:[]];case 2:return[4,P()];case 3:n.sent();return[4,E.default.keys()];case 4:r=n.sent();return[2,Array.isArray(r)?r:(console.warn("⚠️ [Storage:keys] Invalid keys response:",r),[])];case 5:t=n.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",t),[])];case 6:return[2]}})})()},getLogLink:function e(e){return n(function(){return s(this,function(r){try{return[2,"".concat(x," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};function q(){return L.apply(this,arguments)}function L(){L=n(function(){var e,r,t,n,o,a,c,l,i,f,y,d,g;return s(this,function(s){switch(s.label){case 0:s.trys.push([0,10,,11]);return[4,N.keys()];case 1:e=s.sent();if(!Array.isArray(e))return[2,(W.warning("Invalid response from storage.keys(): ".concat(e)),[])];r=e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}),t=[];n=true,o=false,a=undefined;s.label=2;case 2:s.trys.push([2,7,8,9]);c=r[Symbol.iterator]();s.label=3;case 3:if(!!(n=(l=c.next()).done))return[3,6];i=l.value;return[4,N.get(i)];case 4:y=s.sent();y&&(f=t).push.apply(f,u(y.errors));s.label=5;case 5:n=true;return[3,3];case 6:return[3,9];case 7:d=s.sent();o=true;a=d;return[3,9];case 8:try{if(!n&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 9:return[2,t];case 10:g=s.sent();return[2,(W.error("Failed to retrieve stored errors: ".concat(g.message)),[])];case 11:return[2]}})});return L.apply(this,arguments)}var T=k.default,C=T.green,U=T.yellow,D=T.red,F=T.gray,M=T.bold,G=T.blue,W={step:function(e,r,t){var n=new Date().toLocaleTimeString(),o=e!==null&&r!==null?"STEP [".concat(e,"/").concat(r,"]"):"STEP";console.log("".concat(C(o)," ").concat(F("[".concat(n,"]"))," ").concat(M(t)))},success:function(e){console.log("".concat(C("✔ SUCCESS")," ").concat(e))},error:function(e){console.log("".concat(D("✖ ERROR")," ").concat(e))},warning:function(e){console.log("".concat(U("⚠ WARNING")," ").concat(e))},info:function(e){console.log("".concat(F("ℹ INFO")," ").concat(e))},boxedResult:function(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:C;console.log((0,S.default)(M(t("".concat(e,"\n").concat(r))),{padding:1,margin:1,borderStyle:"round",borderColor:t===D?"red":t===U?"yellow":"green"}))},logResults:function(e,r,t,n){e.length&&(e.forEach(function(e){var n=e.file,o=e.position,a=e.rule,u=e.message;console.log("".concat(r("".concat(t," File:"))," ").concat(G("".concat(n).concat(o?":".concat(o):"")))),a&&console.log(" ".concat(r("Rule:")," ").concat(r(a))),console.log(" ".concat(r("Message:")," ").concat(r(u)))}),console.log((0,S.default)(M(r("".concat(t," Total ").concat(n,": ").concat(e.length))),{padding:1,margin:1,borderStyle:"round",borderColor:r===D?"red":r===U?"yellow":"green"})),console.log(F("─".repeat(40))))},displayResults:/*#__PURE__*/n(function(){var e,r,t;return s(this,function(n){switch(n.label){case 0:return[4,q()];case 1:e=n.sent(),r=e.filter(function(e){return e.type==="error"}),t=e.filter(function(e){return e.type==="warning"});!r.length&&!t.length?W.boxedResult("✔ NO ISSUES FOUND","",C):(W.logResults(t,U,"⚠","Warnings"),W.logResults(r,D,"✖","Errors"));return[2]}})})};0&&(module.exports={log:log});
@@ -1,17 +0,0 @@
1
- import * as chalk from 'chalk';
2
- import { I_ErrorEntry } from '../typescript/command.cjs';
3
-
4
- declare const yellow: chalk.ChalkInstance;
5
- declare const red: chalk.ChalkInstance;
6
- declare const log: {
7
- step: (current: number | null, total: number | null, message: string) => void;
8
- success: (message: string) => void;
9
- error: (message: string) => void;
10
- warning: (message: string) => void;
11
- info: (message: string) => void;
12
- boxedResult: (title: string, message: string, color?: chalk.ChalkInstance) => void;
13
- logResults: (entries: I_ErrorEntry[], color: typeof yellow | typeof red, icon: string, groupName: string) => void;
14
- displayResults: () => Promise<void>;
15
- };
16
-
17
- export { log };
@@ -1,17 +0,0 @@
1
- import * as chalk from 'chalk';
2
- import { I_ErrorEntry } from '../typescript/command.js';
3
-
4
- declare const yellow: chalk.ChalkInstance;
5
- declare const red: chalk.ChalkInstance;
6
- declare const log: {
7
- step: (current: number | null, total: number | null, message: string) => void;
8
- success: (message: string) => void;
9
- error: (message: string) => void;
10
- warning: (message: string) => void;
11
- info: (message: string) => void;
12
- boxedResult: (title: string, message: string, color?: chalk.ChalkInstance) => void;
13
- logResults: (entries: I_ErrorEntry[], color: typeof yellow | typeof red, icon: string, groupName: string) => void;
14
- displayResults: () => Promise<void>;
15
- };
16
-
17
- export { log };
@@ -1 +0,0 @@
1
- function e(e,r){if(r==null||r>e.length)r=e.length;for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function r(r){if(Array.isArray(r))return e(r)}function n(e,r,n,t,o,c,a){try{var s=e[c](a);var u=s.value}catch(e){n(e);return}if(s.done){r(u)}else{Promise.resolve(u).then(t,o)}}function t(e){return function(){var r=this,t=arguments;return new Promise(function(o,c){var a=e.apply(r,t);function s(e){n(a,o,c,s,u,"next",e)}function u(e){n(a,o,c,s,u,"throw",e)}s(undefined)})}}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(e){return r(e)||o(e)||u(e)||c()}function s(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function u(r,n){if(!r)return;if(typeof r==="string")return e(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor)t=r.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return e(r,n)}function i(e,r){var n,t,o,c,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return c={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function s(e){return function(r){return u([e,r])}}function u(c){if(n)throw new TypeError("Generator is already executing.");while(a)try{if(n=1,t&&(o=c[0]&2?t["return"]:c[0]?t["throw"]||((o=t["return"])&&o.call(t),0):t.next)&&!(o=o.call(t,c[1])).done)return o;if(t=0,o)c=[c[0]&2,o.value];switch(c[0]){case 0:case 1:o=c;break;case 4:a.label++;return{value:c[1],done:false};case 5:a.label++;t=c[1];c=[0];continue;case 7:c=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){a=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(c[0]===6&&a.label<o[1]){a.label=o[1];o=c;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(c);break}if(o[2])a.ops.pop();a.trys.pop();continue}c=r.call(e,a)}catch(e){c=[6,e];t=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}import l from"boxen";import f from"chalk";import g from"localforage";import y from"node-persist";import p from"node:os";import d from"node:path";import h from"node:process";var b=(typeof window==="undefined"?"undefined":s(window))<"u",m=h.env.CYBERSKILL_STORAGE_DIR||d.join(p.homedir(),".cyberskill-storage");function v(){return w.apply(this,arguments)}function w(){w=t(function(){var e;return i(this,function(r){switch(r.label){case 0:e=!b&&!y.defaultInstance;if(!e)return[3,2];return[4,y.init({dir:m,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return w.apply(this,arguments)}var S={get:function e(e){return t(function(){var r,n,t;return i(this,function(o){switch(o.label){case 0:o.trys.push([0,6,,7]);if(!b)return[3,2];return[4,g.getItem(e)];case 1:n=o.sent();return[3,5];case 2:return[4,v()];case 3:o.sent();return[4,y.getItem(e)];case 4:n=(r=o.sent())!==null&&r!==void 0?r:null;o.label=5;case 5:return[2,n];case 6:t=o.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 7:return[2]}})})()},set:function e(e,r){return t(function(){var n,t;return i(this,function(o){switch(o.label){case 0:o.trys.push([0,6,,7]);if(!b)return[3,2];return[4,g.setItem(e,r)];case 1:n=o.sent();return[3,5];case 2:return[4,v()];case 3:o.sent();return[4,y.setItem(e,r)];case 4:n=o.sent();o.label=5;case 5:n;return[3,7];case 6:t=o.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),t);return[3,7];case 7:return[2]}})})()},remove:function e(e){return t(function(){var r,n;return i(this,function(t){switch(t.label){case 0:t.trys.push([0,6,,7]);if(!b)return[3,2];return[4,g.removeItem(e)];case 1:r=t.sent();return[3,5];case 2:return[4,v()];case 3:t.sent();return[4,y.removeItem(e)];case 4:r=t.sent();t.label=5;case 5:r;return[3,7];case 6:n=t.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),n);return[3,7];case 7:return[2]}})})()},keys:function e(){return t(function(){var e,r,n;return i(this,function(t){switch(t.label){case 0:t.trys.push([0,5,,6]);if(!b)return[3,2];return[4,g.keys()];case 1:return[2,(e=t.sent())!==null&&e!==void 0?e:[]];case 2:return[4,v()];case 3:t.sent();return[4,y.keys()];case 4:r=t.sent();return[2,Array.isArray(r)?r:(console.warn("⚠️ [Storage:keys] Invalid keys response:",r),[])];case 5:n=t.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",n),[])];case 6:return[2]}})})()},getLogLink:function e(e){return t(function(){return i(this,function(r){try{return[2,"".concat(m," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};function k(){return E.apply(this,arguments)}function E(){E=t(function(){var e,r,n,t,o,c,s,u,l,f,g,y,p;return i(this,function(i){switch(i.label){case 0:i.trys.push([0,10,,11]);return[4,S.keys()];case 1:e=i.sent();if(!Array.isArray(e))return[2,(N.warning("Invalid response from storage.keys(): ".concat(e)),[])];r=e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}),n=[];t=true,o=false,c=undefined;i.label=2;case 2:i.trys.push([2,7,8,9]);s=r[Symbol.iterator]();i.label=3;case 3:if(!!(t=(u=s.next()).done))return[3,6];l=u.value;return[4,S.get(l)];case 4:g=i.sent();g&&(f=n).push.apply(f,a(g.errors));i.label=5;case 5:t=true;return[3,3];case 6:return[3,9];case 7:y=i.sent();o=true;c=y;return[3,9];case 8:try{if(!t&&s.return!=null){s.return()}}finally{if(o){throw c}}return[7];case 9:return[2,n];case 10:p=i.sent();return[2,(N.error("Failed to retrieve stored errors: ".concat(p.message)),[])];case 11:return[2]}})});return E.apply(this,arguments)}var I=f.green,R=f.yellow,A=f.red,x=f.gray,O=f.bold,L=f.blue,N={step:function(e,r,n){var t=new Date().toLocaleTimeString(),o=e!==null&&r!==null?"STEP [".concat(e,"/").concat(r,"]"):"STEP";console.log("".concat(I(o)," ").concat(x("[".concat(t,"]"))," ").concat(O(n)))},success:function(e){console.log("".concat(I("✔ SUCCESS")," ").concat(e))},error:function(e){console.log("".concat(A("✖ ERROR")," ").concat(e))},warning:function(e){console.log("".concat(R("⚠ WARNING")," ").concat(e))},info:function(e){console.log("".concat(x("ℹ INFO")," ").concat(e))},boxedResult:function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:I;console.log(l(O(n("".concat(e,"\n").concat(r))),{padding:1,margin:1,borderStyle:"round",borderColor:n===A?"red":n===R?"yellow":"green"}))},logResults:function(e,r,n,t){e.length&&(e.forEach(function(e){var t=e.file,o=e.position,c=e.rule,a=e.message;console.log("".concat(r("".concat(n," File:"))," ").concat(L("".concat(t).concat(o?":".concat(o):"")))),c&&console.log(" ".concat(r("Rule:")," ").concat(r(c))),console.log(" ".concat(r("Message:")," ").concat(r(a)))}),console.log(l(O(r("".concat(n," Total ").concat(t,": ").concat(e.length))),{padding:1,margin:1,borderStyle:"round",borderColor:r===A?"red":r===R?"yellow":"green"})),console.log(x("─".repeat(40))))},displayResults:/*#__PURE__*/t(function(){var e,r,n;return i(this,function(t){switch(t.label){case 0:return[4,k()];case 1:e=t.sent(),r=e.filter(function(e){return e.type==="error"}),n=e.filter(function(e){return e.type==="warning"});!r.length&&!n.length?N.boxedResult("✔ NO ISSUES FOUND","",I):(N.logResults(n,R,"⚠","Warnings"),N.logResults(r,A,"✖","Errors"));return[2]}})})};export{N as log};