@cyberskill/shared 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) 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.js +1 -1
  7. package/dist/controllers/mongoose.cjs +1 -1
  8. package/dist/controllers/mongoose.js +1 -1
  9. package/dist/hooks/react/index.cjs +1 -1
  10. package/dist/hooks/react/index.js +1 -1
  11. package/dist/hooks/react/useLocalStorage.cjs +1 -1
  12. package/dist/hooks/react/useLocalStorage.js +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.d.cts +7 -2
  15. package/dist/index.d.ts +7 -2
  16. package/dist/index.js +1 -1
  17. package/dist/typescript/command.d.cts +7 -1
  18. package/dist/typescript/command.d.ts +7 -1
  19. package/dist/typescript/index.d.cts +1 -1
  20. package/dist/typescript/index.d.ts +1 -1
  21. package/dist/utils/command-error.cjs +1 -0
  22. package/dist/utils/command-error.d.cts +18 -0
  23. package/dist/utils/command-error.d.ts +18 -0
  24. package/dist/utils/command-error.js +1 -0
  25. package/dist/utils/command-log.cjs +1 -0
  26. package/dist/utils/command-log.d.cts +3 -0
  27. package/dist/utils/command-log.d.ts +3 -0
  28. package/dist/utils/command-log.js +1 -0
  29. package/dist/utils/command-spinner.cjs +1 -0
  30. package/dist/utils/command-spinner.d.cts +11 -0
  31. package/dist/utils/command-spinner.d.ts +11 -0
  32. package/dist/utils/command-spinner.js +1 -0
  33. package/dist/utils/command.cjs +1 -0
  34. package/dist/utils/command.d.cts +5 -0
  35. package/dist/utils/command.d.ts +5 -0
  36. package/dist/utils/command.js +1 -0
  37. package/dist/utils/index.cjs +1 -1
  38. package/dist/utils/index.d.cts +7 -1
  39. package/dist/utils/index.d.ts +7 -1
  40. package/dist/utils/index.js +1 -1
  41. package/dist/utils/npm-package.cjs +1 -0
  42. package/dist/utils/npm-package.d.cts +15 -0
  43. package/dist/utils/npm-package.d.ts +15 -0
  44. package/dist/utils/npm-package.js +1 -0
  45. package/package.json +1 -2
  46. package/dist/cyberskill-shared-1.6.0.tgz +0 -0
  47. /package/dist/utils/{localStorage.cjs → local-storage.cjs} +0 -0
  48. /package/dist/utils/{localStorage.d.cts → local-storage.d.cts} +0 -0
  49. /package/dist/utils/{localStorage.d.ts → local-storage.d.ts} +0 -0
  50. /package/dist/utils/{localStorage.js → local-storage.js} +0 -0
@@ -31,5 +31,11 @@ interface I_EslintError {
31
31
  ruleId: string;
32
32
  }>;
33
33
  }
34
+ interface I_SpinnerOptions {
35
+ successMessage?: string;
36
+ failureMessage?: string;
37
+ errorList?: unknown[];
38
+ exitOnError?: boolean;
39
+ }
34
40
 
35
- export { E_ErrorType, E_SpinnerMessage, type I_ErrorEntry, type I_EslintError };
41
+ export { E_ErrorType, E_SpinnerMessage, type I_ErrorEntry, type I_EslintError, type I_SpinnerOptions };
@@ -31,5 +31,11 @@ interface I_EslintError {
31
31
  ruleId: string;
32
32
  }>;
33
33
  }
34
+ interface I_SpinnerOptions {
35
+ successMessage?: string;
36
+ failureMessage?: string;
37
+ errorList?: unknown[];
38
+ exitOnError?: boolean;
39
+ }
34
40
 
35
- export { E_ErrorType, E_SpinnerMessage, type I_ErrorEntry, type I_EslintError };
41
+ export { E_ErrorType, E_SpinnerMessage, type I_ErrorEntry, type I_EslintError, type I_SpinnerOptions };
@@ -1,4 +1,4 @@
1
- export { E_ErrorType, E_SpinnerMessage, I_ErrorEntry, I_EslintError } from './command.cjs';
1
+ export { E_ErrorType, E_SpinnerMessage, I_ErrorEntry, I_EslintError, I_SpinnerOptions } from './command.cjs';
2
2
  export { I_Config } from './config.cjs';
3
3
  export { T_ThrowResponseArgs } from './log.cjs';
4
4
  export { C_Collection, C_Db, C_Document, C_Model, I_DeleteOptionsExtended, I_ExtendedModel, I_GenerateModelOptions, I_GenerateSchemaOptions, I_GenericDocument, I_HookNextFunction, I_Input_CreateMany, I_Input_CreateOne, I_Input_DeleteMany, I_Input_DeleteOne, I_Input_FindAll, I_Input_FindOne, I_Input_FindPaging, I_Input_FindPagingAggregate, I_Input_UpdateMany, I_Input_UpdateOne, I_MongooseModelMiddleware, I_MongooseOptions, I_Return, I_ReturnFailure, I_ReturnSuccess, I_SlugifyOptions, I_UpdateOptionsExtended, T_AggregatePaginateResult, T_DeleteResult, T_Filter, T_FilterQuery, T_GenerateSlugQueryResponse, T_Input_MongooseSchema, T_Input_Populate, T_InsertManyOptions, T_InsertManyResult, T_InsertOneResult, T_MiddlewareContext, T_MongooseModelMiddlewareFunction, T_MongoosePlugin, T_MongooseShema, T_OptionalUnlessRequiredId, T_PaginateOptions, T_PaginateOptionsWithPopulate, T_PaginateResult, T_PipelineStage, T_PopulateOption, T_PopulateOptions, T_ProjectionType, T_QueryOptions, T_UpdateQuery, T_UpdateResult, T_WithId } from './mongoose.cjs';
@@ -1,4 +1,4 @@
1
- export { E_ErrorType, E_SpinnerMessage, I_ErrorEntry, I_EslintError } from './command.js';
1
+ export { E_ErrorType, E_SpinnerMessage, I_ErrorEntry, I_EslintError, I_SpinnerOptions } from './command.js';
2
2
  export { I_Config } from './config.js';
3
3
  export { T_ThrowResponseArgs } from './log.js';
4
4
  export { C_Collection, C_Db, C_Document, C_Model, I_DeleteOptionsExtended, I_ExtendedModel, I_GenerateModelOptions, I_GenerateSchemaOptions, I_GenericDocument, I_HookNextFunction, I_Input_CreateMany, I_Input_CreateOne, I_Input_DeleteMany, I_Input_DeleteOne, I_Input_FindAll, I_Input_FindOne, I_Input_FindPaging, I_Input_FindPagingAggregate, I_Input_UpdateMany, I_Input_UpdateOne, I_MongooseModelMiddleware, I_MongooseOptions, I_Return, I_ReturnFailure, I_ReturnSuccess, I_SlugifyOptions, I_UpdateOptionsExtended, T_AggregatePaginateResult, T_DeleteResult, T_Filter, T_FilterQuery, T_GenerateSlugQueryResponse, T_Input_MongooseSchema, T_Input_Populate, T_InsertManyOptions, T_InsertManyResult, T_InsertOneResult, T_MiddlewareContext, T_MongooseModelMiddlewareFunction, T_MongoosePlugin, T_MongooseShema, T_OptionalUnlessRequiredId, T_PaginateOptions, T_PaginateOptionsWithPopulate, T_PaginateResult, T_PipelineStage, T_PopulateOption, T_PopulateOptions, T_ProjectionType, T_QueryOptions, T_UpdateQuery, T_UpdateResult, T_WithId } from './mongoose.js';
@@ -0,0 +1 @@
1
+ "use strict";function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(e){if(Array.isArray(e))return r(e)}function t(r,e,t,n,u,o,s){try{var a=r[o](s);var c=a.value}catch(r){t(r);return}if(a.done){e(c)}else{Promise.resolve(c).then(n,u)}}function n(r){return function(){var e=this,n=arguments;return new Promise(function(u,o){var s=r.apply(e,n);function a(r){t(s,u,o,a,c,"next",r)}function c(r){t(s,u,o,a,c,"throw",r)}a(undefined)})}}function u(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function o(){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 s(r){return e(r)||u(r)||c(r)||o()}function a(r){"@swc/helpers - typeof";return r&&typeof Symbol!=="undefined"&&r.constructor===Symbol?"symbol":typeof r}function c(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.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 r(e,t)}function i(r,e){var t,n,u,o,s={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]};return o={next:a(0),"throw":a(1),"return":a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(r){return function(e){return c([r,e])}}function c(o){if(t)throw new TypeError("Generator is already executing.");while(s)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:s.label++;return{value:o[1],done:false};case 5:s.label++;n=o[1];o=[0];continue;case 7:o=s.ops.pop();s.trys.pop();continue;default:if(!(u=s.trys,u=u.length>0&&u[u.length-1])&&(o[0]===6||o[0]===2)){s=0;continue}if(o[0]===3&&(!u||o[1]>u[0]&&o[1]<u[3])){s.label=o[1];break}if(o[0]===6&&s.label<u[1]){s.label=u[1];u=o;break}if(u&&s.label<u[2]){s.label=u[2];s.ops.push(o);break}if(u[2])s.ops.pop();s.trys.pop();continue}o=e.call(r,s)}catch(r){o=[6,r];n=0}finally{t=u=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var l=Object.create;var f=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var b=function(r,e){for(var t in e)f(r,t,{get:e[t],enumerable:!0})},v=function(r,e,t,n){var u=true,o=false,s=undefined;if(e&&(typeof e==="undefined"?"undefined":a(e))=="object"||typeof e=="function")try{var c=function(){var u=l.value;!d.call(r,u)&&u!==t&&f(r,u,{get:function(){return e[u]},enumerable:!(n=y(e,u))||n.enumerable})};for(var i=h(e)[Symbol.iterator](),l;!(u=(l=i.next()).done);u=true)c()}catch(r){o=true;s=r}finally{try{if(!u&&i.return!=null){i.return()}}finally{if(o){throw s}}}return r};var g=function(r,e,t){return t=r!=null?l(p(r)):{},v(e||!r||!r.__esModule?f(t,"default",{value:r,enumerable:!0}):t,r)},m=function(r){return v(f({},"__esModule",{value:!0}),r)};var w={};b(w,{clearExpiredErrorLists:function(){return P},getStoredErrorLists:function(){return L},saveErrorListToStorage:function(){return O}});module.exports=m(w);var E=g(require("localforage"),1),S={get:function r(r){return n(function(){var e;return i(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,E.default.getItem(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error('Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return n(function(){var t;return i(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,E.default.setItem(r,e)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(r,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function r(r){return n(function(){var e;return i(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,E.default.removeItem(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},clear:function r(){return n(function(){var r;return i(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,E.default.clear()];case 1:e.sent();return[3,3];case 2:r=e.sent();console.error("Error clearing storage:",r);return[3,3];case 3:return[2]}})})()},key:function r(r){return n(function(){var e;return i(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,E.default.key(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error("Error getting key at index ".concat(r,":"),e),null)];case 3:return[2]}})})()},keys:function r(){return n(function(){var r;return i(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,E.default.keys()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting keys:",r),[])];case 3:return[2]}})})()},length:function r(){return n(function(){var r;return i(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,E.default.length()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting storage length:",r),0)];case 3:return[2]}})})()},iterate:function r(r){return n(function(){var e;return i(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,E.default.iterate(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error("Error iterating storage:",e);return[3,3];case 3:return[2]}})})()}};var k=function(r){return"error_list:".concat(r)},x=24*60*60*1e3;function O(r){return j.apply(this,arguments)}function j(){j=n(function(r){var e,t,n;return i(this,function(u){switch(u.label){case 0:if(!r.length)return[2];e=Date.now(),t=k(e);u.label=1;case 1:u.trys.push([1,3,,4]);return[4,S.set(t,{errors:r,timestamp:e})];case 2:u.sent(),console.log("✅ Saved ".concat(r.length," errors to storage with key: ").concat(t));return[3,4];case 3:n=u.sent();console.error("❌ Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return j.apply(this,arguments)}function L(){return A.apply(this,arguments)}function A(){A=n(function(){var r,e,t,n,u,o,a,c,l,f,y,h;return i(this,function(i){switch(i.label){case 0:i.trys.push([0,10,,11]);return[4,S.keys()];case 1:r=i.sent().filter(function(r){return r.startsWith("error_list:")}),e=[];t=true,n=false,u=undefined;i.label=2;case 2:i.trys.push([2,7,8,9]);o=r[Symbol.iterator]();i.label=3;case 3:if(!!(t=(a=o.next()).done))return[3,6];c=a.value;return[4,S.get(c)];case 4:f=i.sent();f&&(l=e).push.apply(l,s(f.errors));i.label=5;case 5:t=true;return[3,3];case 6:return[3,9];case 7:y=i.sent();n=true;u=y;return[3,9];case 8:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw u}}return[7];case 9:return[2,e];case 10:h=i.sent();return[2,(console.error("❌ Failed to retrieve stored errors: ".concat(h.message)),[])];case 11:return[2]}})});return A.apply(this,arguments)}function P(){return _.apply(this,arguments)}function _(){_=n(function(){var r,e,t,n,u,o,s,a,c,l,f,y;return i(this,function(i){switch(i.label){case 0:i.trys.push([0,12,,13]);return[4,S.keys()];case 1:r=i.sent(),e=Date.now();t=true,n=false,u=undefined;i.label=2;case 2:i.trys.push([2,9,10,11]);o=r[Symbol.iterator]();i.label=3;case 3:if(!!(t=(s=o.next()).done))return[3,8];a=s.value;if(!a.startsWith("error_list:"))return[3,7];return[4,S.get(a)];case 4:c=i.sent();l=c&&e-c.timestamp>x;if(!l)return[3,6];return[4,S.remove(a)];case 5:l=(i.sent(),console.log("\uD83D\uDDD1️ Removed expired error list: ".concat(a)));i.label=6;case 6:l;i.label=7;case 7:t=true;return[3,3];case 8:return[3,11];case 9:f=i.sent();n=true;u=f;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw u}}return[7];case 11:return[3,13];case 12:y=i.sent();console.error("❌ Failed to clear expired error lists: ".concat(y.message));return[3,13];case 13:return[2]}})});return _.apply(this,arguments)}0&&(module.exports={clearExpiredErrorLists:clearExpiredErrorLists,getStoredErrorLists:getStoredErrorLists,saveErrorListToStorage:saveErrorListToStorage});
@@ -0,0 +1,18 @@
1
+ import { I_ErrorEntry } from '../typescript/command.cjs';
2
+
3
+ /**
4
+ * Save the entire error list to local 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 expired error lists from storage.
15
+ */
16
+ declare function clearExpiredErrorLists(): Promise<void>;
17
+
18
+ export { clearExpiredErrorLists, getStoredErrorLists, saveErrorListToStorage };
@@ -0,0 +1,18 @@
1
+ import { I_ErrorEntry } from '../typescript/command.js';
2
+
3
+ /**
4
+ * Save the entire error list to local 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 expired error lists from storage.
15
+ */
16
+ declare function clearExpiredErrorLists(): Promise<void>;
17
+
18
+ export { clearExpiredErrorLists, getStoredErrorLists, saveErrorListToStorage };
@@ -0,0 +1 @@
1
+ function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(e){if(Array.isArray(e))return r(e)}function t(r,e,t,n,s,a,o){try{var u=r[a](o);var c=u.value}catch(r){t(r);return}if(u.done){e(c)}else{Promise.resolve(c).then(n,s)}}function n(r){return function(){var e=this,n=arguments;return new Promise(function(s,a){var o=r.apply(e,n);function u(r){t(o,s,a,u,c,"next",r)}function c(r){t(o,s,a,u,c,"throw",r)}u(undefined)})}}function s(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}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 o(r){return e(r)||s(r)||u(r)||a()}function u(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.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 r(e,t)}function c(r,e){var t,n,s,a,o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]};return a={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(r){return function(e){return c([r,e])}}function c(a){if(t)throw new TypeError("Generator is already executing.");while(o)try{if(t=1,n&&(s=a[0]&2?n["return"]:a[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;if(n=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;n=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){o.label=a[1];break}if(a[0]===6&&o.label<s[1]){o.label=s[1];s=a;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(a);break}if(s[2])o.ops.pop();o.trys.pop();continue}a=e.call(r,o)}catch(r){a=[6,r];n=0}finally{t=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}import i from"localforage";var l={get:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,i.getItem(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error('Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return n(function(){var t;return c(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,i.setItem(r,e)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(r,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,i.removeItem(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},clear:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,i.clear()];case 1:e.sent();return[3,3];case 2:r=e.sent();console.error("Error clearing storage:",r);return[3,3];case 3:return[2]}})})()},key:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,i.key(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error("Error getting key at index ".concat(r,":"),e),null)];case 3:return[2]}})})()},keys:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,i.keys()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting keys:",r),[])];case 3:return[2]}})})()},length:function r(){return n(function(){var r;return c(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,i.length()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting storage length:",r),0)];case 3:return[2]}})})()},iterate:function r(r){return n(function(){var e;return c(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,i.iterate(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error("Error iterating storage:",e);return[3,3];case 3:return[2]}})})()}};var f=function(r){return"error_list:".concat(r)},h=24*60*60*1e3;function y(r){return p.apply(this,arguments)}function p(){p=n(function(r){var e,t,n;return c(this,function(s){switch(s.label){case 0:if(!r.length)return[2];e=Date.now(),t=f(e);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,l.set(t,{errors:r,timestamp:e})];case 2:s.sent(),console.log("✅ Saved ".concat(r.length," errors to storage with key: ").concat(t));return[3,4];case 3:n=s.sent();console.error("❌ Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return p.apply(this,arguments)}function b(){return g.apply(this,arguments)}function g(){g=n(function(){var r,e,t,n,s,a,u,i,f,h,y,p;return c(this,function(c){switch(c.label){case 0:c.trys.push([0,10,,11]);return[4,l.keys()];case 1:r=c.sent().filter(function(r){return r.startsWith("error_list:")}),e=[];t=true,n=false,s=undefined;c.label=2;case 2:c.trys.push([2,7,8,9]);a=r[Symbol.iterator]();c.label=3;case 3:if(!!(t=(u=a.next()).done))return[3,6];i=u.value;return[4,l.get(i)];case 4:h=c.sent();h&&(f=e).push.apply(f,o(h.errors));c.label=5;case 5:t=true;return[3,3];case 6:return[3,9];case 7:y=c.sent();n=true;s=y;return[3,9];case 8:try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw s}}return[7];case 9:return[2,e];case 10:p=c.sent();return[2,(console.error("❌ Failed to retrieve stored errors: ".concat(p.message)),[])];case 11:return[2]}})});return g.apply(this,arguments)}function v(){return m.apply(this,arguments)}function m(){m=n(function(){var r,e,t,n,s,a,o,u,i,f,y,p;return c(this,function(c){switch(c.label){case 0:c.trys.push([0,12,,13]);return[4,l.keys()];case 1:r=c.sent(),e=Date.now();t=true,n=false,s=undefined;c.label=2;case 2:c.trys.push([2,9,10,11]);a=r[Symbol.iterator]();c.label=3;case 3:if(!!(t=(o=a.next()).done))return[3,8];u=o.value;if(!u.startsWith("error_list:"))return[3,7];return[4,l.get(u)];case 4:i=c.sent();f=i&&e-i.timestamp>h;if(!f)return[3,6];return[4,l.remove(u)];case 5:f=(c.sent(),console.log("\uD83D\uDDD1️ Removed expired error list: ".concat(u)));c.label=6;case 6:f;c.label=7;case 7:t=true;return[3,3];case 8:return[3,11];case 9:y=c.sent();n=true;s=y;return[3,11];case 10:try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw s}}return[7];case 11:return[3,13];case 12:p=c.sent();console.error("❌ Failed to clear expired error lists: ".concat(p.message));return[3,13];case 13:return[2]}})});return m.apply(this,arguments)}export{v as clearExpiredErrorLists,b as getStoredErrorLists,y as saveErrorListToStorage};
@@ -0,0 +1 @@
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,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 n(e){return function(){var r=this,n=arguments;return new Promise(function(o,u){var a=e.apply(r,n);function c(e){t(a,o,u,c,s,"next",e)}function s(e){t(a,o,u,c,s,"throw",e)}c(undefined)})}}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function u(){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)||s(e)||u()}function c(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}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 l(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 i=Object.create;var f=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var d=function(e,r){for(var t in r)f(e,t,{get:r[t],enumerable:!0})},g=function(e,r,t,n){var o=true,u=false,a=undefined;if(r&&(typeof r==="undefined"?"undefined":c(r))=="object"||typeof r=="function")try{var s=function(){var o=i.value;!b.call(e,o)&&o!==t&&f(e,o,{get:function(){return r[o]},enumerable:!(n=y(r,o))||n.enumerable})};for(var l=p(r)[Symbol.iterator](),i;!(o=(i=l.next()).done);o=true)s()}catch(e){u=true;a=e}finally{try{if(!o&&l.return!=null){l.return()}}finally{if(u){throw a}}}return e};var v=function(e,r,t){return t=e!=null?i(h(e)):{},g(r||!e||!e.__esModule?f(t,"default",{value:e,enumerable:!0}):t,e)},m=function(e){return g(f({},"__esModule",{value:!0}),e)};var w={};d(w,{displayResults:function(){return U}});module.exports=m(w);var k=v(require("boxen"),1),O=v(require("chalk"),1);var S=v(require("localforage"),1),E={get:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,S.default.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error('Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return n(function(){var t;return l(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,S.default.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,S.default.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},clear:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,S.default.clear()];case 1:r.sent();return[3,3];case 2:e=r.sent();console.error("Error clearing storage:",e);return[3,3];case 3:return[2]}})})()},key:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,S.default.key(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error("Error getting key at index ".concat(e,":"),r),null)];case 3:return[2]}})})()},keys:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,S.default.keys()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting keys:",e),[])];case 3:return[2]}})})()},length:function e(){return n(function(){var e;return l(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,S.default.length()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting storage length:",e),0)];case 3:return[2]}})})()},iterate:function e(e){return n(function(){var r;return l(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,S.default.iterate(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error("Error iterating storage:",r);return[3,3];case 3:return[2]}})})()}};var j=24*60*60*1e3;function x(){return A.apply(this,arguments)}function A(){A=n(function(){var e,r,t,n,o,u,c,s,i,f,y,p;return l(this,function(l){switch(l.label){case 0:l.trys.push([0,10,,11]);return[4,E.keys()];case 1:e=l.sent().filter(function(e){return e.startsWith("error_list:")}),r=[];t=true,n=false,o=undefined;l.label=2;case 2:l.trys.push([2,7,8,9]);u=e[Symbol.iterator]();l.label=3;case 3:if(!!(t=(c=u.next()).done))return[3,6];s=c.value;return[4,E.get(s)];case 4:f=l.sent();f&&(i=r).push.apply(i,a(f.errors));l.label=5;case 5:t=true;return[3,3];case 6:return[3,9];case 7:y=l.sent();n=true;o=y;return[3,9];case 8:try{if(!t&&u.return!=null){u.return()}}finally{if(n){throw o}}return[7];case 9:return[2,r];case 10:p=l.sent();return[2,(console.error("❌ Failed to retrieve stored errors: ".concat(p.message)),[])];case 11:return[2]}})});return A.apply(this,arguments)}var I=O.default,P=I.blue,M=I.red,_=I.yellow,R=I.green,q=I.gray,F=I.bold;function N(e,r){var t=new Map([[M,"red"],[_,"yellow"],[R,"green"]]).get(r)||"green";return(0,k.default)(F(r(e)),{padding:1,margin:1,borderStyle:"arrow",borderColor:t})}function T(e,r,t,n){e.length&&(e.forEach(function(e){var n=e.file,o=e.position,u=e.rule,a=e.message;console.log("".concat(r("".concat(t," File:"))," ").concat(P("".concat(n).concat(o?":".concat(o):"")))),u&&console.log(" ".concat(r("Rule:")," ").concat(r(u))),console.log(" ".concat(r("Message:")," ").concat(r(a)))}),console.log(N(F(r("".concat(t," Total ").concat(n,": ").concat(e.length))),r)),console.log(q("─".repeat(40))))}function U(){return C.apply(this,arguments)}function C(){C=n(function(){var e,r;return l(this,function(t){switch(t.label){case 0:return[4,x()];case 1:e=t.sent().filter(function(e){return e.type==="error"});return[4,x()];case 2:r=t.sent().filter(function(e){return e.type==="warning"});!e.length&&!r.length?console.log(N(F(R("✔ NO ISSUE FOUND!")),R)):(T(r,_,"⚠","Warnings"),T(e,M,"✖","Errors"));return[2]}})});return C.apply(this,arguments)}0&&(module.exports={displayResults:displayResults});
@@ -0,0 +1,3 @@
1
+ declare function displayResults(): Promise<void>;
2
+
3
+ export { displayResults };
@@ -0,0 +1,3 @@
1
+ declare function displayResults(): Promise<void>;
2
+
3
+ export { displayResults };
@@ -0,0 +1 @@
1
+ function r(r,e){if(e==null||e>r.length)e=r.length;for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(e){if(Array.isArray(e))return r(e)}function t(r,e,t,n,o,c,a){try{var u=r[c](a);var s=u.value}catch(r){t(r);return}if(u.done){e(s)}else{Promise.resolve(s).then(n,o)}}function n(r){return function(){var e=this,n=arguments;return new Promise(function(o,c){var a=r.apply(e,n);function u(r){t(a,o,c,u,s,"next",r)}function s(r){t(a,o,c,u,s,"throw",r)}u(undefined)})}}function o(r){if(typeof Symbol!=="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}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(r){return e(r)||o(r)||u(r)||c()}function u(e,t){if(!e)return;if(typeof e==="string")return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.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 r(e,t)}function s(r,e){var t,n,o,c,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return c={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(r){return function(e){return s([r,e])}}function s(c){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,n&&(o=c[0]&2?n["return"]:c[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;if(n=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++;n=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=e.call(r,a)}catch(r){c=[6,r];n=0}finally{t=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}import i from"boxen";import l from"chalk";import f from"localforage";var h={get:function r(r){return n(function(){var e;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,f.getItem(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error('Error getting key "'.concat(r,'":'),e),null)];case 3:return[2]}})})()},set:function r(r,e){return n(function(){var t;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,f.setItem(r,e)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(r,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function r(r){return n(function(){var e;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,f.removeItem(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error('Error removing key "'.concat(r,'":'),e);return[3,3];case 3:return[2]}})})()},clear:function r(){return n(function(){var r;return s(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,f.clear()];case 1:e.sent();return[3,3];case 2:r=e.sent();console.error("Error clearing storage:",r);return[3,3];case 3:return[2]}})})()},key:function r(r){return n(function(){var e;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,f.key(r)];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error("Error getting key at index ".concat(r,":"),e),null)];case 3:return[2]}})})()},keys:function r(){return n(function(){var r;return s(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,f.keys()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting keys:",r),[])];case 3:return[2]}})})()},length:function r(){return n(function(){var r;return s(this,function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4,f.length()];case 1:return[2,e.sent()];case 2:r=e.sent();return[2,(console.error("Error getting storage length:",r),0)];case 3:return[2]}})})()},iterate:function r(r){return n(function(){var e;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,f.iterate(r)];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error("Error iterating storage:",e);return[3,3];case 3:return[2]}})})()}};var y=24*60*60*1e3;function p(){return g.apply(this,arguments)}function g(){g=n(function(){var r,e,t,n,o,c,u,i,l,f,y,p;return s(this,function(s){switch(s.label){case 0:s.trys.push([0,10,,11]);return[4,h.keys()];case 1:r=s.sent().filter(function(r){return r.startsWith("error_list:")}),e=[];t=true,n=false,o=undefined;s.label=2;case 2:s.trys.push([2,7,8,9]);c=r[Symbol.iterator]();s.label=3;case 3:if(!!(t=(u=c.next()).done))return[3,6];i=u.value;return[4,h.get(i)];case 4:f=s.sent();f&&(l=e).push.apply(l,a(f.errors));s.label=5;case 5:t=true;return[3,3];case 6:return[3,9];case 7:y=s.sent();n=true;o=y;return[3,9];case 8:try{if(!t&&c.return!=null){c.return()}}finally{if(n){throw o}}return[7];case 9:return[2,e];case 10:p=s.sent();return[2,(console.error("❌ Failed to retrieve stored errors: ".concat(p.message)),[])];case 11:return[2]}})});return g.apply(this,arguments)}var b=l.blue,v=l.red,m=l.yellow,d=l.green,w=l.gray,k=l.bold;function E(r,e){var t=new Map([[v,"red"],[m,"yellow"],[d,"green"]]).get(e)||"green";return i(k(e(r)),{padding:1,margin:1,borderStyle:"arrow",borderColor:t})}function S(r,e,t,n){r.length&&(r.forEach(function(r){var n=r.file,o=r.position,c=r.rule,a=r.message;console.log("".concat(e("".concat(t," File:"))," ").concat(b("".concat(n).concat(o?":".concat(o):"")))),c&&console.log(" ".concat(e("Rule:")," ").concat(e(c))),console.log(" ".concat(e("Message:")," ").concat(e(a)))}),console.log(E(k(e("".concat(t," Total ").concat(n,": ").concat(r.length))),e)),console.log(w("─".repeat(40))))}function x(){return A.apply(this,arguments)}function A(){A=n(function(){var r,e;return s(this,function(t){switch(t.label){case 0:return[4,p()];case 1:r=t.sent().filter(function(r){return r.type==="error"});return[4,p()];case 2:e=t.sent().filter(function(r){return r.type==="warning"});!r.length&&!e.length?console.log(E(k(d("✔ NO ISSUE FOUND!")),d)):(S(e,m,"⚠","Warnings"),S(r,v,"✖","Errors"));return[2]}})});return A.apply(this,arguments)}export{x as displayResults};
@@ -0,0 +1 @@
1
+ "use strict";function e(e,r,t,n,o,u,a){try{var i=e[u](a);var l=i.value}catch(e){t(e);return}if(i.done){r(l)}else{Promise.resolve(l).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 i(r){e(a,o,u,i,l,"next",r)}function l(r){e(a,o,u,i,l,"throw",r)}i(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:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function i(e){return function(r){return l([e,r])}}function l(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 i=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var f=function(e,r){for(var t in r)u(e,t,{get:r[t],enumerable:!0})},s=function(e,r,n,o){var l=true,f=false,s=undefined;if(r&&(typeof r==="undefined"?"undefined":t(r))=="object"||typeof r=="function")try{var p=function(){var t=v.value;!c.call(e,t)&&t!==n&&u(e,t,{get:function(){return r[t]},enumerable:!(o=a(r,t))||o.enumerable})};for(var y=i(r)[Symbol.iterator](),v;!(l=(v=y.next()).done);l=true)p()}catch(e){f=true;s=e}finally{try{if(!l&&y.return!=null){y.return()}}finally{if(f){throw s}}}return e};var p=function(e,r,t){return t=e!=null?o(l(e)):{},s(r||!e||!e.__esModule?u(t,"default",{value:e,enumerable:!0}):t,e)},y=function(e){return s(u({},"__esModule",{value:!0}),e)};var v={};f(v,{runWithSpinner:function(){return h}});module.exports=y(v);var d=p(require("process"),1),b=p(require("ora"),1);function h(e,r){return w.apply(this,arguments)}function w(){w=r(function(e,r){var t,o,u,a,i,l,c,f,s;var p=arguments;return n(this,function(n){switch(n.label){case 0:t=p.length>2&&p[2]!==void 0?p[2]:{};o=t.successMessage,u=t.failureMessage,a=t.errorList,i=a===void 0?[]:a,l=t.exitOnError,c=l===void 0?!0:l,f=(0,b.default)({text:e,color:"cyan",spinner:"dots"}).start();n.label=1;case 1:n.trys.push([1,3,,4]);return[4,r()];case 2:n.sent(),i.length?c?(f.fail(u||"".concat(e," ❌")),d.default.exit(1)):f.fail(u||"".concat(e," ❌")):f.succeed(o||"".concat(e," ✅"));return[3,4];case 3:s=n.sent();if(f.fail(u||"".concat(e," ❌")),c)d.default.exit(1);else throw s;return[3,4];case 4:return[2]}})});return w.apply(this,arguments)}0&&(module.exports={runWithSpinner:runWithSpinner});
@@ -0,0 +1,11 @@
1
+ import { I_SpinnerOptions } from '../typescript/command.cjs';
2
+
3
+ /**
4
+ * Wraps an async function with a loading spinner.
5
+ * @param message Message to display in the spinner.
6
+ * @param action Async action to perform.
7
+ * @param options Additional options.
8
+ */
9
+ declare function runWithSpinner(message: string, action: () => Promise<void>, options?: I_SpinnerOptions): Promise<void>;
10
+
11
+ export { runWithSpinner };
@@ -0,0 +1,11 @@
1
+ import { I_SpinnerOptions } from '../typescript/command.js';
2
+
3
+ /**
4
+ * Wraps an async function with a loading spinner.
5
+ * @param message Message to display in the spinner.
6
+ * @param action Async action to perform.
7
+ * @param options Additional options.
8
+ */
9
+ declare function runWithSpinner(message: string, action: () => Promise<void>, options?: I_SpinnerOptions): Promise<void>;
10
+
11
+ export { runWithSpinner };
@@ -0,0 +1 @@
1
+ function e(e,t,r,n,o,i,a){try{var c=e[i](a);var u=c.value}catch(e){r(e);return}if(c.done){t(u)}else{Promise.resolve(u).then(n,o)}}function t(t){return function(){var r=this,n=arguments;return new Promise(function(o,i){var a=t.apply(r,n);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(undefined)})}}function r(e,t){var r,n,o,i,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(e){return function(t){return u([e,t])}}function u(i){if(r)throw new TypeError("Generator is already executing.");while(a)try{if(r=1,n&&(o=i[0]&2?n["return"]:i[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;if(n=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:a.label++;return{value:i[1],done:false};case 5:a.label++;n=i[1];i=[0];continue;case 7:i=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){a=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(i[0]===6&&a.label<o[1]){a.label=o[1];o=i;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(i);break}if(o[2])a.ops.pop();a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e];n=0}finally{r=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}import n from"node:process";import o from"ora";function i(e,t){return a.apply(this,arguments)}function a(){a=t(function(e,t){var i,a,c,u,l,s,f,p,h;var y=arguments;return r(this,function(r){switch(r.label){case 0:i=y.length>2&&y[2]!==void 0?y[2]:{};a=i.successMessage,c=i.failureMessage,u=i.errorList,l=u===void 0?[]:u,s=i.exitOnError,f=s===void 0?!0:s,p=o({text:e,color:"cyan",spinner:"dots"}).start();r.label=1;case 1:r.trys.push([1,3,,4]);return[4,t()];case 2:r.sent(),l.length?f?(p.fail(c||"".concat(e," ❌")),n.exit(1)):p.fail(c||"".concat(e," ❌")):p.succeed(a||"".concat(e," ✅"));return[3,4];case 3:h=r.sent();if(p.fail(c||"".concat(e," ❌")),f)n.exit(1);else throw h;return[3,4];case 4:return[2]}})});return a.apply(this,arguments)}export{i as runWithSpinner};
@@ -0,0 +1 @@
1
+ "use strict";function e(e,r,t,n,o,s,a){try{var u=e[s](a);var c=u.value}catch(e){t(e);return}if(u.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,s){var a=r.apply(t,n);function u(r){e(a,o,s,u,c,"next",r)}function c(r){e(a,o,s,u,c,"throw",r)}u(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,s,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return s={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(e){return function(r){return c([e,r])}}function c(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}}}var o=Object.create;var s=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty;var l=function(e,r){for(var t in r)s(e,t,{get:r[t],enumerable:!0})},f=function(e,r,n,o){var c=true,l=false,f=undefined;if(r&&(typeof r==="undefined"?"undefined":t(r))=="object"||typeof r=="function")try{var h=function(){var t=y.value;!i.call(e,t)&&t!==n&&s(e,t,{get:function(){return r[t]},enumerable:!(o=a(r,t))||o.enumerable})};for(var p=u(r)[Symbol.iterator](),y;!(c=(y=p.next()).done);c=true)h()}catch(e){l=true;f=e}finally{try{if(!c&&p.return!=null){p.return()}}finally{if(l){throw f}}}return e};var h=function(e,r,t){return t=e!=null?o(c(e)):{},f(r||!e||!e.__esModule?s(t,"default",{value:e,enumerable:!0}):t,e)},p=function(e){return f(s({},"__esModule",{value:!0}),e)};var y={};l(y,{executeCommand:function(){return D},logProcessStep:function(){return q}});module.exports=p(y);var g=h(require("chalk"),1),v=require("child_process"),d=h(require("process"),1),m=h(require("util"),1);var b=h(require("localforage"),1),w={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('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('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('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},clear:function e(){return r(function(){var e;return n(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,b.default.clear()];case 1:r.sent();return[3,3];case 2:e=r.sent();console.error("Error clearing storage:",e);return[3,3];case 3:return[2]}})})()},key: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.key(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error("Error getting key at index ".concat(e,":"),r),null)];case 3:return[2]}})})()},keys:function e(){return r(function(){var e;return n(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,b.default.keys()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting keys:",e),[])];case 3:return[2]}})})()},length:function e(){return r(function(){var e;return n(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,b.default.length()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting storage length:",e),0)];case 3:return[2]}})})()},iterate: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.iterate(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error("Error iterating storage:",r);return[3,3];case 3:return[2]}})})()}};var x=function(e){return"error_list:".concat(e)},S=24*60*60*1e3;function k(e){return E.apply(this,arguments)}function E(){E=r(function(e){var r,t,o;return n(this,function(n){switch(n.label){case 0:if(!e.length)return[2];r=Date.now(),t=x(r);n.label=1;case 1:n.trys.push([1,3,,4]);return[4,w.set(t,{errors:e,timestamp:r})];case 2:n.sent(),console.log("✅ Saved ".concat(e.length," errors to storage with key: ").concat(t));return[3,4];case 3:o=n.sent();console.error("❌ Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return E.apply(this,arguments)}var O=m.promisify(v.exec),P=g.default,j=P.gray,I=P.white,_=[];function q(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";var t=new Date().toLocaleString();console.log("".concat(r," [").concat(t,"] ").concat(I(e)))}function C(e){var r=/^\s*(\d+):(\d+)\s+(error|warning)\s+(\S+)\s+(\S+)$/,t=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,n=/^✖\s+(.*?)\s+\[(.*?)\]$/,o=[],s="";e.split("\n").forEach(function(e){if(e.startsWith("/"))s=e.trim();else{var a=r.exec(e);if(a&&s)_.push({file:s,position:"".concat(a[1],":").concat(a[2]),type:a[3]==="error"?"error":"warning",message:a[4].trim(),rule:a[5].trim()});else{var u=t.exec(e);if(u)_.push({file:u[1],position:"".concat(u[2],":").concat(u[3]),type:u[4],message:u[5].trim()});else{var c=n.exec(e);c?_.push({file:"commitlint",type:"error",message:c[1].trim(),rule:c[2].trim()}):o.push(e.trim())}}}}),o.length>0&&(console.log(j("Unmatched lines:")),o.forEach(function(e){return console.info(e)}))}function T(e){try{JSON.parse(e).forEach(function(e){var r=e.filePath,t=e.messages;t.forEach(function(e){var t=e.severity,n=e.line,o=e.column,s=e.ruleId,a=e.message;_.push({type:t===2?"error":"warning",file:r,position:"".concat(n,":").concat(o),rule:s,message:a})})})}catch(r){C(e)}}function D(e,r){return N.apply(this,arguments)}function N(){N=r(function(e,r){var t,o,s,a,u,c,i;var l=arguments;return n(this,function(n){switch(n.label){case 0:t=l.length>2&&l[2]!==void 0?l[2]:T;q(r);o=new AbortController;d.default.on("SIGINT",function(){console.log("Terminating process..."),o.abort(),d.default.exit()});n.label=1;case 1:n.trys.push([1,5,,6]);return[4,O(e,{maxBuffer:0x6400000,signal:o.signal})];case 2:s=n.sent(),a=s.stdout,u=s.stderr;[a,u].forEach(function(e){return e&&t(e)});c=_.length;if(!c)return[3,4];return[4,k(_)];case 3:c=n.sent();n.label=4;case 4:c;return[3,6];case 5:i=n.sent();console.error("Command failed: ".concat(i.message));return[3,6];case 6:return[2]}})});return N.apply(this,arguments)}0&&(module.exports={executeCommand:executeCommand,logProcessStep:logProcessStep});
@@ -0,0 +1,5 @@
1
+ declare function logProcessStep(message: string, icon?: string): void;
2
+ declare function parseCommandOutput(output: string): void;
3
+ declare function executeCommand(command: string, description: string, parser?: typeof parseCommandOutput): Promise<void>;
4
+
5
+ export { executeCommand, logProcessStep };
@@ -0,0 +1,5 @@
1
+ declare function logProcessStep(message: string, icon?: string): void;
2
+ declare function parseCommandOutput(output: string): void;
3
+ declare function executeCommand(command: string, description: string, parser?: typeof parseCommandOutput): Promise<void>;
4
+
5
+ export { executeCommand, logProcessStep };
@@ -0,0 +1 @@
1
+ function e(e,r,t,n,o,s,c){try{var a=e[s](c);var i=a.value}catch(e){t(e);return}if(a.done){r(i)}else{Promise.resolve(i).then(n,o)}}function r(r){return function(){var t=this,n=arguments;return new Promise(function(o,s){var c=r.apply(t,n);function a(r){e(c,o,s,a,i,"next",r)}function i(r){e(c,o,s,a,i,"throw",r)}a(undefined)})}}function t(e,r){var t,n,o,s,c={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return s={next:a(0),"throw":a(1),"return":a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(r){return i([e,r])}}function i(s){if(t)throw new TypeError("Generator is already executing.");while(c)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:c.label++;return{value:s[1],done:false};case 5:c.label++;n=s[1];s=[0];continue;case 7:s=c.ops.pop();c.trys.pop();continue;default:if(!(o=c.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){c=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){c.label=s[1];break}if(s[0]===6&&c.label<o[1]){c.label=o[1];o=s;break}if(o&&c.label<o[2]){c.label=o[2];c.ops.push(s);break}if(o[2])c.ops.pop();c.trys.pop();continue}s=r.call(e,c)}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 n from"chalk";import{exec as o}from"node:child_process";import s from"node:process";import*as c from"node:util";import a from"localforage";var i={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,a.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error('Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,n){return r(function(){var r;return t(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,a.setItem(e,n)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('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,a.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},clear:function e(){return r(function(){var e;return t(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,a.clear()];case 1:r.sent();return[3,3];case 2:e=r.sent();console.error("Error clearing storage:",e);return[3,3];case 3:return[2]}})})()},key: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,a.key(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error("Error getting key at index ".concat(e,":"),r),null)];case 3:return[2]}})})()},keys:function e(){return r(function(){var e;return t(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,a.keys()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting keys:",e),[])];case 3:return[2]}})})()},length:function e(){return r(function(){var e;return t(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,a.length()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting storage length:",e),0)];case 3:return[2]}})})()},iterate: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,a.iterate(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error("Error iterating storage:",r);return[3,3];case 3:return[2]}})})()}};var u=function(e){return"error_list:".concat(e)},l=24*60*60*1e3;function f(e){return h.apply(this,arguments)}function h(){h=r(function(e){var r,n,o;return t(this,function(t){switch(t.label){case 0:if(!e.length)return[2];r=Date.now(),n=u(r);t.label=1;case 1:t.trys.push([1,3,,4]);return[4,i.set(n,{errors:e,timestamp:r})];case 2:t.sent(),console.log("✅ Saved ".concat(e.length," errors to storage with key: ").concat(n));return[3,4];case 3:o=t.sent();console.error("❌ Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return h.apply(this,arguments)}var p=c.promisify(o),g=n.gray,m=n.white,y=[];function v(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";var t=new Date().toLocaleString();console.log("".concat(r," [").concat(t,"] ").concat(m(e)))}function d(e){var r=/^\s*(\d+):(\d+)\s+(error|warning)\s+(\S+)\s+(\S+)$/,t=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,n=/^✖\s+(.*?)\s+\[(.*?)\]$/,o=[],s="";e.split("\n").forEach(function(e){if(e.startsWith("/"))s=e.trim();else{var c=r.exec(e);if(c&&s)y.push({file:s,position:"".concat(c[1],":").concat(c[2]),type:c[3]==="error"?"error":"warning",message:c[4].trim(),rule:c[5].trim()});else{var a=t.exec(e);if(a)y.push({file:a[1],position:"".concat(a[2],":").concat(a[3]),type:a[4],message:a[5].trim()});else{var i=n.exec(e);i?y.push({file:"commitlint",type:"error",message:i[1].trim(),rule:i[2].trim()}):o.push(e.trim())}}}}),o.length>0&&(console.log(g("Unmatched lines:")),o.forEach(function(e){return console.info(e)}))}function b(e){try{JSON.parse(e).forEach(function(e){var r=e.filePath,t=e.messages;t.forEach(function(e){var t=e.severity,n=e.line,o=e.column,s=e.ruleId,c=e.message;y.push({type:t===2?"error":"warning",file:r,position:"".concat(n,":").concat(o),rule:s,message:c})})})}catch(r){d(e)}}function w(e,r){return k.apply(this,arguments)}function k(){k=r(function(e,r){var n,o,c,a,i,u,l;var h=arguments;return t(this,function(t){switch(t.label){case 0:n=h.length>2&&h[2]!==void 0?h[2]:b;v(r);o=new AbortController;s.on("SIGINT",function(){console.log("Terminating process..."),o.abort(),s.exit()});t.label=1;case 1:t.trys.push([1,5,,6]);return[4,p(e,{maxBuffer:0x6400000,signal:o.signal})];case 2:c=t.sent(),a=c.stdout,i=c.stderr;[a,i].forEach(function(e){return e&&n(e)});u=y.length;if(!u)return[3,4];return[4,f(y)];case 3:u=t.sent();t.label=4;case 4:u;return[3,6];case 5:l=t.sent();console.error("Command failed: ".concat(l.message));return[3,6];case 6:return[2]}})});return k.apply(this,arguments)}export{w as executeCommand,v as logProcessStep};
@@ -1 +1 @@
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 i=e[a](u);var c=i.value}catch(e){t(e);return}if(i.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 i(e){t(u,o,a,i,c,"next",e)}function c(e){t(u,o,a,i,c,"throw",e)}i(undefined)})}}function o(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function a(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function u(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(){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 c(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}n.forEach(function(r){o(e,r,t[r])})}return e}function E(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function s(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{E(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function l(e,r){if(e==null)return{};var t=f(e,r);var n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++){n=a[o];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function f(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var o,a;for(a=0;a<n.length;a++){o=n[a];if(r.indexOf(o)>=0)continue;t[o]=e[o]}return t}function S(e){return r(e)||u(e)||d(e)||i()}function O(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function d(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 p(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:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(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 A=Object.create;var g=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var R=function(e,r){for(var t in r)g(e,t,{get:r[t],enumerable:!0})},T=function(e,r,t,n){var o=true,a=false,u=undefined;if(r&&(typeof r==="undefined"?"undefined":O(r))=="object"||typeof r=="function")try{var i=function(){var o=E.value;!D.call(e,o)&&o!==t&&g(e,o,{get:function(){return r[o]},enumerable:!(n=y(r,o))||n.enumerable})};for(var c=h(r)[Symbol.iterator](),E;!(o=(E=c.next()).done);o=true)i()}catch(e){a=true;u=e}finally{try{if(!o&&c.return!=null){c.return()}}finally{if(a){throw u}}}return e};var _=function(e,r,t){return t=e!=null?A(v(e)):{},T(r||!e||!e.__esModule?g(t,"default",{value:e,enumerable:!0}):t,e)},m=function(e){return T(g({},"__esModule",{value:!0}),e)};var M={};R(M,{aggregatePaginate:function(){return x.default},deepMerge:function(){return et},generateModel:function(){return W},generateSchema:function(){return J},generateShortId:function(){return X},generateSlug:function(){return $},generateSlugQuery:function(){return Z},isJson:function(){return en},localStorage:function(){return P},mongoosePaginate:function(){return k.default},regexSearchMapper:function(){return eo},removeAccent:function(){return ea},serializer:function(){return ee},throwResponse:function(){return F},validate:function(){return er}});module.exports=m(M);var I=function(){return(typeof document==="undefined"?"undefined":O(document))>"u"?new URL("file:".concat(__filename)).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href},C=I();var b=_(require("unorm"),1);var N=_(require("localforage"),1),P={get:function e(e){return n(function(){var r;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,N.default.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error('Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return n(function(){var t;return p(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,N.default.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return n(function(){var r;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,N.default.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},clear:function e(){return n(function(){var e;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,N.default.clear()];case 1:r.sent();return[3,3];case 2:e=r.sent();console.error("Error clearing storage:",e);return[3,3];case 3:return[2]}})})()},key:function e(e){return n(function(){var r;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,N.default.key(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error("Error getting key at index ".concat(e,":"),r),null)];case 3:return[2]}})})()},keys:function e(){return n(function(){var e;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,N.default.keys()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting keys:",e),[])];case 3:return[2]}})})()},length:function e(){return n(function(){var e;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,N.default.length()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting storage length:",e),0)];case 3:return[2]}})})()},iterate:function e(e){return n(function(){var r;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,N.default.iterate(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error("Error iterating storage:",r);return[3,3];case 3:return[2]}})})()}};var G=require("graphql");var w=require("path"),U=require("url"),L=(0,U.fileURLToPath)(C),q=(0,w.dirname)(L);var j={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};function F(e){var r=e.message,t=e.status,n=t===void 0?j.INTERNAL_SERVER_ERROR:t,o=e.type,a=o===void 0?"graphql":o;var u;var i=(u=r!==null&&r!==void 0?r:n.MESSAGE)!==null&&u!==void 0?u:"Internal server error";throw a==="graphql"?new G.GraphQLError(i,{extensions:{code:n.CODE}}):new Error(i)}var Q=_(require("crypto-js"),1),x=_(require("mongoose-aggregate-paginate-v2"),1),k=_(require("mongoose-paginate-v2"),1),H=_(require("slugify"),1),Y=require("uuid");function V(e,r){r.filter(function(e){return typeof e=="function"}).forEach(function(r){return e.plugin(r)})}function B(e,r){r.forEach(function(r){var t=r.method,n=r.fn;return e.pre(t,n)})}function z(e){return new e.Schema({id:{type:String,default:Y.v4,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})}function J(e){var r=e.mongoose,t=e.schema,n=e.virtuals,o=n===void 0?[]:n,a=e.standalone,u=a===void 0?!1:a;var i=new r.Schema(t,{strict:!0});return o.forEach(function(e){var r=e.name,t=e.options,n=e.get;var o=i.virtual(r,t);n&&o.get(n)}),u||i.add(z(r)),i}function W(e){var r=e.mongoose,t=e.name,n=e.schema,o=e.pagination,a=o===void 0?!1:o,u=e.aggregate,i=u===void 0?!1:u,c=e.virtuals,E=c===void 0?[]:c,s=e.middlewares,l=s===void 0?[]:s;if(!t)throw new Error("Model name is required.");if(r.models[t])return r.models[t];var f=J({mongoose:r,schema:n,virtuals:E});return V(f,[a&&k.default,i&&x.default]),B(f,l),r.model(t,f)}var K=H.default.default||H.default;function $(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;var t=r||{},n=t.lower,o=n===void 0?!0:n,a=t.locale,u=a===void 0?"vi":a,i=l(t,["lower","locale"]);return K(e,c({lower:o,locale:u},i))}function X(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return Q.default.SHA256(e).toString(Q.default.enc.Hex).slice(0,r)}function Z(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;return s(c({},r,t&&{id:{$ne:t}}),{$or:[{slug:e},{slugHistory:e}]})}var ee={serialize:function(e){return JSON.stringify(e,function(e,r){return a(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})}};var er={common:{isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":O(e))=="object"?a(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1},isEmptyValidator:function e(){return /*#__PURE__*/function(){var e=n(function(e){return p(this,function(r){return[2,!er.common.isEmpty(e)]})});return function(r){return e.apply(this,arguments)}}()},isUniqueValidator:function e(e){return /*#__PURE__*/function(){var r=n(function(r){var t;return p(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");t={$or:e.map(function(e){return o({},e,r)})};return[4,this.constructor.findOne(t)];case 1:return[2,!n.sent()]}})});return function(e){return r.apply(this,arguments)}}()},matchesRegexValidator:function e(e){return /*#__PURE__*/function(){var r=n(function(r){return p(this,function(t){if(!Array.isArray(e)||e.some(function(e){return!a(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(r)})]})});return function(e){return r.apply(this,arguments)}}()}}};function et(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n=function(e,r){return Object.keys(r).forEach(function(t){var o=r[t],a=e[t];Array.isArray(o)?e[t]=S(new Set(S(Array.isArray(a)?a:[]).concat(S(o)))):(typeof o==="undefined"?"undefined":O(o))=="object"&&o!==null&&!Array.isArray(o)?e[t]=n((typeof a==="undefined"?"undefined":O(a))=="object"&&!Array.isArray(a)?a:{},o):e[t]=o}),e};return r.flatMap(function(e){return Array.isArray(e)?e:[e]}).reduce(function(e,r){return n(e,r)},{})}function en(e){try{return JSON.parse(e),!0}catch(e){return!1}}function eo(e){return e=b.default.nfkc(e),e=e.replace(/[aàáạảãâầấậẩẫăằắặẳẵ]/g,"(a|\xe0|\xe1|ạ|ả|\xe3|\xe2|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)"),e=e.replace(/[eèéẹẻẽêềếệểễ]/g,"(e|\xe8|\xe9|ẹ|ẻ|ẽ|\xea|ề|ế|ệ|ể|ễ)"),e=e.replace(/[iìíịỉĩ]/g,"(i|\xec|\xed|ị|ỉ|ĩ)"),e=e.replace(/[oòóọỏõôồốộổỗơờớợởỡ]/g,"(o|\xf2|\xf3|ọ|ỏ|\xf5|\xf4|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)"),e=e.replace(/[uùúụủũưừứựửữ]/g,"(u|\xf9|\xfa|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)"),e=e.replace(/[yỳýỵỷỹ]/g,"(y|ỳ|\xfd|ỵ|ỷ|ỹ)"),e=e.replace(/d|đ/g,"(d|đ)"),e=e.replace(/[AÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴ]/g,"(A|\xc0|\xc1|Ạ|Ả|\xc3|\xc2|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ)"),e=e.replace(/[EÈÉẸẺẼÊỀẾỆỂỄ]/g,"(E|\xc8|\xc9|Ẹ|Ẻ|Ẽ|\xca|Ề|Ế|Ệ|Ể|Ễ)"),e=e.replace(/[IÌÍỊỈĨ]/g,"(I|\xcc|\xcd|Ị|Ỉ|Ĩ)"),e=e.replace(/[OÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠ]/g,"(O|\xd2|\xd3|Ọ|Ỏ|\xd5|\xd4|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ)"),e=e.replace(/[UÙÚỤỦŨƯỪỨỰỬỮ]/g,"(U|\xd9|\xda|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)"),e=e.replace(/[YỲÝỴỶỸ]/g,"(Y|Ỳ|\xdd|Ỵ|Ỷ|Ỹ)"),e=e.replace(/D|Đ/g,"(D|Đ)"),e}var ea=function(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")};0&&(module.exports={aggregatePaginate:aggregatePaginate,deepMerge:deepMerge,generateModel:generateModel,generateSchema:generateSchema,generateShortId:generateShortId,generateSlug:generateSlug,generateSlugQuery:generateSlugQuery,isJson:isJson,localStorage:localStorage,mongoosePaginate:mongoosePaginate,regexSearchMapper:regexSearchMapper,removeAccent:removeAccent,serializer:serializer,throwResponse:throwResponse,validate:validate});
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,i){try{var u=e[a](i);var c=u.value}catch(e){t(e);return}if(u.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 i=e.apply(r,n);function u(e){t(i,o,a,u,c,"next",e)}function c(e){t(i,o,a,u,c,"throw",e)}u(undefined)})}}function o(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function a(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function i(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function u(){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 c(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}n.forEach(function(r){o(e,r,t[r])})}return e}function s(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function l(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{s(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function f(e,r){if(e==null)return{};var t=E(e,r);var n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++){n=a[o];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function E(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var o,a;for(a=0;a<n.length;a++){o=n[a];if(r.indexOf(o)>=0)continue;t[o]=e[o]}return t}function d(e){return r(e)||i(e)||g(e)||u()}function p(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(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,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),"throw":u(1),"return":u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(r){return c([e,r])}}function c(a){if(t)throw new TypeError("Generator is already executing.");while(i)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:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=r.call(e,i)}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 h=Object.create;var y=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var D=function(e,r){for(var t in r)y(e,t,{get:r[t],enumerable:!0})},R=function(e,r,t,n){var o=true,a=false,i=undefined;if(r&&(typeof r==="undefined"?"undefined":p(r))=="object"||typeof r=="function")try{var u=function(){var o=s.value;!m.call(e,o)&&o!==t&&y(e,o,{get:function(){return r[o]},enumerable:!(n=v(r,o))||n.enumerable})};for(var c=O(r)[Symbol.iterator](),s;!(o=(s=c.next()).done);o=true)u()}catch(e){a=true;i=e}finally{try{if(!o&&c.return!=null){c.return()}}finally{if(a){throw i}}}return e};var T=function(e,r,t){return t=e!=null?h(A(e)):{},R(r||!e||!e.__esModule?y(t,"default",{value:e,enumerable:!0}):t,e)},b=function(e){return R(y({},"__esModule",{value:!0}),e)};var _={};D(_,{aggregatePaginate:function(){return eb.default},clearExpiredErrorLists:function(){return F},deepMerge:function(){return e0},displayResults:function(){return X},executeCommand:function(){return eS},generateModel:function(){return eG},generateSchema:function(){return eP},generateShortId:function(){return ex},generateSlug:function(){return eL},generateSlugQuery:function(){return eq},getLatestPackageVersion:function(){return eV},getStoredErrorLists:function(){return x},isJson:function(){return e1},isPackageOutdated:function(){return eJ},localStorage:function(){return N},logProcessStep:function(){return ed},mongoosePaginate:function(){return e_.default},regexSearchMapper:function(){return e2},removeAccent:function(){return e3},runWithSpinner:function(){return et},saveErrorListToStorage:function(){return U},serializer:function(){return eX},throwResponse:function(){return eR},updatePackage:function(){return e$},validate:function(){return eZ}});module.exports=b(_);var M=function(){return(typeof document==="undefined"?"undefined":p(document))>"u"?new URL("file:".concat(__filename)).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href},I=M();var w=T(require("unorm"),1);var C=T(require("localforage"),1),N={get:function e(e){return n(function(){var r;return S(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,C.default.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error('Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return n(function(){var t;return S(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,C.default.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return n(function(){var r;return S(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,C.default.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},clear:function e(){return n(function(){var e;return S(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,C.default.clear()];case 1:r.sent();return[3,3];case 2:e=r.sent();console.error("Error clearing storage:",e);return[3,3];case 3:return[2]}})})()},key:function e(e){return n(function(){var r;return S(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,C.default.key(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error("Error getting key at index ".concat(e,":"),r),null)];case 3:return[2]}})})()},keys:function e(){return n(function(){var e;return S(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,C.default.keys()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting keys:",e),[])];case 3:return[2]}})})()},length:function e(){return n(function(){var e;return S(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,C.default.length()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting storage length:",e),0)];case 3:return[2]}})})()},iterate:function e(e){return n(function(){var r;return S(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,C.default.iterate(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error("Error iterating storage:",r);return[3,3];case 3:return[2]}})})()}};var P=function(e){return"error_list:".concat(e)},G=24*60*60*1e3;function U(e){return L.apply(this,arguments)}function L(){L=n(function(e){var r,t,n;return S(this,function(o){switch(o.label){case 0:if(!e.length)return[2];r=Date.now(),t=P(r);o.label=1;case 1:o.trys.push([1,3,,4]);return[4,N.set(t,{errors:e,timestamp:r})];case 2:o.sent(),console.log("✅ Saved ".concat(e.length," errors to storage with key: ").concat(t));return[3,4];case 3:n=o.sent();console.error("❌ Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return L.apply(this,arguments)}function x(){return q.apply(this,arguments)}function q(){q=n(function(){var e,r,t,n,o,a,i,u,c,s,l,f;return S(this,function(E){switch(E.label){case 0:E.trys.push([0,10,,11]);return[4,N.keys()];case 1:e=E.sent().filter(function(e){return e.startsWith("error_list:")}),r=[];t=true,n=false,o=undefined;E.label=2;case 2:E.trys.push([2,7,8,9]);a=e[Symbol.iterator]();E.label=3;case 3:if(!!(t=(i=a.next()).done))return[3,6];u=i.value;return[4,N.get(u)];case 4:s=E.sent();s&&(c=r).push.apply(c,d(s.errors));E.label=5;case 5:t=true;return[3,3];case 6:return[3,9];case 7:l=E.sent();n=true;o=l;return[3,9];case 8:try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw o}}return[7];case 9:return[2,r];case 10:f=E.sent();return[2,(console.error("❌ Failed to retrieve stored errors: ".concat(f.message)),[])];case 11:return[2]}})});return q.apply(this,arguments)}function F(){return j.apply(this,arguments)}function j(){j=n(function(){var e,r,t,n,o,a,i,u,c,s,l,f;return S(this,function(E){switch(E.label){case 0:E.trys.push([0,12,,13]);return[4,N.keys()];case 1:e=E.sent(),r=Date.now();t=true,n=false,o=undefined;E.label=2;case 2:E.trys.push([2,9,10,11]);a=e[Symbol.iterator]();E.label=3;case 3:if(!!(t=(i=a.next()).done))return[3,8];u=i.value;if(!u.startsWith("error_list:"))return[3,7];return[4,N.get(u)];case 4:c=E.sent();s=c&&r-c.timestamp>G;if(!s)return[3,6];return[4,N.remove(u)];case 5:s=(E.sent(),console.log("\uD83D\uDDD1️ Removed expired error list: ".concat(u)));E.label=6;case 6:s;E.label=7;case 7:t=true;return[3,3];case 8:return[3,11];case 9:l=E.sent();n=true;o=l;return[3,11];case 10:try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw o}}return[7];case 11:return[3,13];case 12:f=E.sent();console.error("❌ Failed to clear expired error lists: ".concat(f.message));return[3,13];case 13:return[2]}})});return j.apply(this,arguments)}var k=T(require("boxen"),1),Q=T(require("chalk"),1);var H=Q.default,V=H.blue,Y=H.red,B=H.yellow,W=H.green,J=H.gray,z=H.bold;function $(e,r){var t=new Map([[Y,"red"],[B,"yellow"],[W,"green"]]).get(r)||"green";return(0,k.default)(z(r(e)),{padding:1,margin:1,borderStyle:"arrow",borderColor:t})}function K(e,r,t,n){e.length&&(e.forEach(function(e){var n=e.file,o=e.position,a=e.rule,i=e.message;console.log("".concat(r("".concat(t," File:"))," ").concat(V("".concat(n).concat(o?":".concat(o):"")))),a&&console.log(" ".concat(r("Rule:")," ").concat(r(a))),console.log(" ".concat(r("Message:")," ").concat(r(i)))}),console.log($(z(r("".concat(t," Total ").concat(n,": ").concat(e.length))),r)),console.log(J("─".repeat(40))))}function X(){return Z.apply(this,arguments)}function Z(){Z=n(function(){var e,r;return S(this,function(t){switch(t.label){case 0:return[4,x()];case 1:e=t.sent().filter(function(e){return e.type==="error"});return[4,x()];case 2:r=t.sent().filter(function(e){return e.type==="warning"});!e.length&&!r.length?console.log($(z(W("✔ NO ISSUE FOUND!")),W)):(K(r,B,"⚠","Warnings"),K(e,Y,"✖","Errors"));return[2]}})});return Z.apply(this,arguments)}var ee=T(require("process"),1),er=T(require("ora"),1);function et(e,r){return en.apply(this,arguments)}function en(){en=n(function(e,r){var t,n,o,a,i,u,c,s,l;var f=arguments;return S(this,function(E){switch(E.label){case 0:t=f.length>2&&f[2]!==void 0?f[2]:{};n=t.successMessage,o=t.failureMessage,a=t.errorList,i=a===void 0?[]:a,u=t.exitOnError,c=u===void 0?!0:u,s=(0,er.default)({text:e,color:"cyan",spinner:"dots"}).start();E.label=1;case 1:E.trys.push([1,3,,4]);return[4,r()];case 2:E.sent(),i.length?c?(s.fail(o||"".concat(e," ❌")),ee.default.exit(1)):s.fail(o||"".concat(e," ❌")):s.succeed(n||"".concat(e," ✅"));return[3,4];case 3:l=E.sent();if(s.fail(o||"".concat(e," ❌")),c)ee.default.exit(1);else throw l;return[3,4];case 4:return[2]}})});return en.apply(this,arguments)}var eo=T(require("chalk"),1),ea=require("child_process"),ei=T(require("process"),1),eu=T(require("util"),1);var ec=eu.promisify(ea.exec),es=eo.default,el=es.gray,ef=es.white,eE=[];function ed(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";var t=new Date().toLocaleString();console.log("".concat(r," [").concat(t,"] ").concat(ef(e)))}function ep(e){var r=/^\s*(\d+):(\d+)\s+(error|warning)\s+(\S+)\s+(\S+)$/,t=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,n=/^✖\s+(.*?)\s+\[(.*?)\]$/,o=[],a="";e.split("\n").forEach(function(e){if(e.startsWith("/"))a=e.trim();else{var i=r.exec(e);if(i&&a)eE.push({file:a,position:"".concat(i[1],":").concat(i[2]),type:i[3]==="error"?"error":"warning",message:i[4].trim(),rule:i[5].trim()});else{var u=t.exec(e);if(u)eE.push({file:u[1],position:"".concat(u[2],":").concat(u[3]),type:u[4],message:u[5].trim()});else{var c=n.exec(e);c?eE.push({file:"commitlint",type:"error",message:c[1].trim(),rule:c[2].trim()}):o.push(e.trim())}}}}),o.length>0&&(console.log(el("Unmatched lines:")),o.forEach(function(e){return console.info(e)}))}function eg(e){try{JSON.parse(e).forEach(function(e){var r=e.filePath,t=e.messages;t.forEach(function(e){var t=e.severity,n=e.line,o=e.column,a=e.ruleId,i=e.message;eE.push({type:t===2?"error":"warning",file:r,position:"".concat(n,":").concat(o),rule:a,message:i})})})}catch(r){ep(e)}}function eS(e,r){return eh.apply(this,arguments)}function eh(){eh=n(function(e,r){var t,n,o,a,i,u,c;var s=arguments;return S(this,function(l){switch(l.label){case 0:t=s.length>2&&s[2]!==void 0?s[2]:eg;ed(r);n=new AbortController;ei.default.on("SIGINT",function(){console.log("Terminating process..."),n.abort(),ei.default.exit()});l.label=1;case 1:l.trys.push([1,5,,6]);return[4,ec(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:o=l.sent(),a=o.stdout,i=o.stderr;[a,i].forEach(function(e){return e&&t(e)});u=eE.length;if(!u)return[3,4];return[4,U(eE)];case 3:u=l.sent();l.label=4;case 4:u;return[3,6];case 5:c=l.sent();console.error("Command failed: ".concat(c.message));return[3,6];case 6:return[2]}})});return eh.apply(this,arguments)}var ey=require("graphql");var ev=require("path"),eO=require("url"),eA=(0,eO.fileURLToPath)(I),em=(0,ev.dirname)(eA);var eD={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};function eR(e){var r=e.message,t=e.status,n=t===void 0?eD.INTERNAL_SERVER_ERROR:t,o=e.type,a=o===void 0?"graphql":o;var i;var u=(i=r!==null&&r!==void 0?r:n.MESSAGE)!==null&&i!==void 0?i:"Internal server error";throw a==="graphql"?new ey.GraphQLError(u,{extensions:{code:n.CODE}}):new Error(u)}var eT=T(require("crypto-js"),1),eb=T(require("mongoose-aggregate-paginate-v2"),1),e_=T(require("mongoose-paginate-v2"),1),eM=T(require("slugify"),1),eI=require("uuid");function ew(e,r){r.filter(function(e){return typeof e=="function"}).forEach(function(r){return e.plugin(r)})}function eC(e,r){r.forEach(function(r){var t=r.method,n=r.fn;return e.pre(t,n)})}function eN(e){return new e.Schema({id:{type:String,default:eI.v4,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})}function eP(e){var r=e.mongoose,t=e.schema,n=e.virtuals,o=n===void 0?[]:n,a=e.standalone,i=a===void 0?!1:a;var u=new r.Schema(t,{strict:!0});return o.forEach(function(e){var r=e.name,t=e.options,n=e.get;var o=u.virtual(r,t);n&&o.get(n)}),i||u.add(eN(r)),u}function eG(e){var r=e.mongoose,t=e.name,n=e.schema,o=e.pagination,a=o===void 0?!1:o,i=e.aggregate,u=i===void 0?!1:i,c=e.virtuals,s=c===void 0?[]:c,l=e.middlewares,f=l===void 0?[]:l;if(!t)throw new Error("Model name is required.");if(r.models[t])return r.models[t];var E=eP({mongoose:r,schema:n,virtuals:s});return ew(E,[a&&e_.default,u&&eb.default]),eC(E,f),r.model(t,E)}var eU=eM.default.default||eM.default;function eL(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;var t=r||{},n=t.lower,o=n===void 0?!0:n,a=t.locale,i=a===void 0?"vi":a,u=f(t,["lower","locale"]);return eU(e,c({lower:o,locale:i},u))}function ex(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return eT.default.SHA256(e).toString(eT.default.enc.Hex).slice(0,r)}function eq(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;return l(c({},r,t&&{id:{$ne:t}}),{$or:[{slug:e},{slugHistory:e}]})}var eF=T(require("node-fetch"),1),ej=T(require("fs"),1),ek=T(require("path"),1),eQ=T(require("process"),1);var eH=24*60*60*1e3;function eV(e){return eY.apply(this,arguments)}function eY(){eY=n(function(e){var r,t,n,o,a,i,u,c,s,l;var f=arguments;return S(this,function(E){switch(E.label){case 0:r=f.length>1&&f[1]!==void 0?f[1]:!1;t="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,N.get(t)];case 1:o=E.sent();return[4,N.get(n)];case 2:a=E.sent(),i=o&&Date.now()-o.timestamp<eH;if(!r&&i)return[2,(console.log("Using cached version for ".concat(e,": ").concat(o.version)),o.version)];u={};(a===null||a===void 0?void 0:a.etag)&&(u["If-None-Match"]=a.etag),(a===null||a===void 0?void 0:a.lastModified)&&(u["If-Modified-Since"]=a.lastModified);E.label=3;case 3:E.trys.push([3,8,,9]);console.log("Fetching latest version for ".concat(e,"..."));return[4,(0,eF.default)("https://registry.npmjs.org/".concat(e,"/latest"),{headers:u})];case 4:c=E.sent();if(c.status===304&&o)return[2,(console.log("Cache is still valid for ".concat(e,": ").concat(o.version)),o.version)];if(!c.ok)throw new Error("Failed to fetch latest version: ".concat(c.statusText));return[4,c.json()];case 5:s=E.sent().version;return[4,N.set(t,{version:s,timestamp:Date.now()})];case 6:E.sent();return[4,N.set(n,{etag:c.headers.get("ETag")||void 0,lastModified:c.headers.get("Last-Modified")||void 0})];case 7:return[2,(E.sent(),console.log("Cached latest version for ".concat(e,": ").concat(s)),s)];case 8:l=E.sent();if(console.error("Error fetching latest version for ".concat(e,": ").concat(l.message)),o)return[2,(console.warn("Falling back to cached version for ".concat(e,": ").concat(o.version)),o.version)];throw l;case 9:return[2]}})});return eY.apply(this,arguments)}function eB(e){return ek.default.join(eQ.default.cwd(),"node_modules",e,"package.json")}function eW(){return ek.default.join(eQ.default.cwd(),"package.json")}function eJ(e){return ez.apply(this,arguments)}function ez(){ez=n(function(e){var r,t,n,o,a;var i=arguments;return S(this,function(u){switch(u.label){case 0:r=i.length>1&&i[1]!==void 0?i[1]:!0;u.label=1;case 1:u.trys.push([1,3,,4]);t=eB(e);if(!ej.default.existsSync(t))return[2,(console.log("".concat(e," is not installed.")),!0)];n=JSON.parse(ej.default.readFileSync(t,"utf-8")).version;return[4,eV(e,r)];case 2:o=u.sent();return[2,(console.log("Installed version of ".concat(e,": ").concat(n)),console.log("Latest version of ".concat(e,": ").concat(o)),n!==o)];case 3:a=u.sent();return[2,(console.warn("Failed to check version for ".concat(e,": ").concat(a.message)),!0)];case 4:return[2]}})});return ez.apply(this,arguments)}function e$(e){return eK.apply(this,arguments)}function eK(){eK=n(function(e){var r,t,n,a;return S(this,function(i){switch(i.label){case 0:i.trys.push([0,4,,5]);return[4,eV(e,!0)];case 1:r=i.sent(),t=eW(),n=JSON.parse(ej.default.readFileSync(t,"utf-8"));n.dependencies=l(c({},n.dependencies),o({},e,r)),ej.default.writeFileSync(t,JSON.stringify(n,null,2)),console.log("Updated ".concat(e," to version ").concat(r));return[4,eS("npm i -f","Installing all dependencies with updated ".concat(e,"..."))];case 2:i.sent();return[4,eS("npm run lint:fix","Fixing lint issues for ".concat(e,"..."))];case 3:i.sent(),console.log("".concat(e," updated successfully."));return[3,5];case 4:a=i.sent();throw console.error("Failed to update ".concat(e,": ").concat(a.message)),a;case 5:return[2]}})});return eK.apply(this,arguments)}var eX={serialize:function(e){return JSON.stringify(e,function(e,r){return a(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})}};var eZ={common:{isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":p(e))=="object"?a(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1},isEmptyValidator:function e(){return /*#__PURE__*/function(){var e=n(function(e){return S(this,function(r){return[2,!eZ.common.isEmpty(e)]})});return function(r){return e.apply(this,arguments)}}()},isUniqueValidator:function e(e){return /*#__PURE__*/function(){var r=n(function(r){var t;return S(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");t={$or:e.map(function(e){return o({},e,r)})};return[4,this.constructor.findOne(t)];case 1:return[2,!n.sent()]}})});return function(e){return r.apply(this,arguments)}}()},matchesRegexValidator:function e(e){return /*#__PURE__*/function(){var r=n(function(r){return S(this,function(t){if(!Array.isArray(e)||e.some(function(e){return!a(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(r)})]})});return function(e){return r.apply(this,arguments)}}()}}};function e0(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n=function(e,r){return Object.keys(r).forEach(function(t){var o=r[t],a=e[t];Array.isArray(o)?e[t]=d(new Set(d(Array.isArray(a)?a:[]).concat(d(o)))):(typeof o==="undefined"?"undefined":p(o))=="object"&&o!==null&&!Array.isArray(o)?e[t]=n((typeof a==="undefined"?"undefined":p(a))=="object"&&!Array.isArray(a)?a:{},o):e[t]=o}),e};return r.flatMap(function(e){return Array.isArray(e)?e:[e]}).reduce(function(e,r){return n(e,r)},{})}function e1(e){try{return JSON.parse(e),!0}catch(e){return!1}}function e2(e){return e=w.default.nfkc(e),e=e.replace(/[aàáạảãâầấậẩẫăằắặẳẵ]/g,"(a|\xe0|\xe1|ạ|ả|\xe3|\xe2|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)"),e=e.replace(/[eèéẹẻẽêềếệểễ]/g,"(e|\xe8|\xe9|ẹ|ẻ|ẽ|\xea|ề|ế|ệ|ể|ễ)"),e=e.replace(/[iìíịỉĩ]/g,"(i|\xec|\xed|ị|ỉ|ĩ)"),e=e.replace(/[oòóọỏõôồốộổỗơờớợởỡ]/g,"(o|\xf2|\xf3|ọ|ỏ|\xf5|\xf4|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)"),e=e.replace(/[uùúụủũưừứựửữ]/g,"(u|\xf9|\xfa|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)"),e=e.replace(/[yỳýỵỷỹ]/g,"(y|ỳ|\xfd|ỵ|ỷ|ỹ)"),e=e.replace(/d|đ/g,"(d|đ)"),e=e.replace(/[AÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴ]/g,"(A|\xc0|\xc1|Ạ|Ả|\xc3|\xc2|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ)"),e=e.replace(/[EÈÉẸẺẼÊỀẾỆỂỄ]/g,"(E|\xc8|\xc9|Ẹ|Ẻ|Ẽ|\xca|Ề|Ế|Ệ|Ể|Ễ)"),e=e.replace(/[IÌÍỊỈĨ]/g,"(I|\xcc|\xcd|Ị|Ỉ|Ĩ)"),e=e.replace(/[OÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠ]/g,"(O|\xd2|\xd3|Ọ|Ỏ|\xd5|\xd4|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ)"),e=e.replace(/[UÙÚỤỦŨƯỪỨỰỬỮ]/g,"(U|\xd9|\xda|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)"),e=e.replace(/[YỲÝỴỶỸ]/g,"(Y|Ỳ|\xdd|Ỵ|Ỷ|Ỹ)"),e=e.replace(/D|Đ/g,"(D|Đ)"),e}var e3=function(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")};0&&(module.exports={aggregatePaginate:aggregatePaginate,clearExpiredErrorLists:clearExpiredErrorLists,deepMerge:deepMerge,displayResults:displayResults,executeCommand:executeCommand,generateModel:generateModel,generateSchema:generateSchema,generateShortId:generateShortId,generateSlug:generateSlug,generateSlugQuery:generateSlugQuery,getLatestPackageVersion:getLatestPackageVersion,getStoredErrorLists:getStoredErrorLists,isJson:isJson,isPackageOutdated:isPackageOutdated,localStorage:localStorage,logProcessStep:logProcessStep,mongoosePaginate:mongoosePaginate,regexSearchMapper:regexSearchMapper,removeAccent:removeAccent,runWithSpinner:runWithSpinner,saveErrorListToStorage:saveErrorListToStorage,serializer:serializer,throwResponse:throwResponse,updatePackage:updatePackage,validate:validate});
@@ -1,11 +1,17 @@
1
1
  import { I_Config } from '../typescript/config.cjs';
2
- export { localStorage } from './localStorage.cjs';
2
+ export { clearExpiredErrorLists, getStoredErrorLists, saveErrorListToStorage } from './command-error.cjs';
3
+ export { displayResults } from './command-log.cjs';
4
+ export { runWithSpinner } from './command-spinner.cjs';
5
+ export { executeCommand, logProcessStep } from './command.cjs';
6
+ export { localStorage } from './local-storage.cjs';
3
7
  export { throwResponse } from './log.cjs';
4
8
  export { generateModel, generateSchema, generateShortId, generateSlug, generateSlugQuery } from './mongoose.cjs';
9
+ export { getLatestPackageVersion, isPackageOutdated, updatePackage } from './npm-package.cjs';
5
10
  export { serializer } from './serializer.cjs';
6
11
  export { validate } from './validate.cjs';
7
12
  export { default as aggregatePaginate } from 'mongoose-aggregate-paginate-v2';
8
13
  export { default as mongoosePaginate } from 'mongoose-paginate-v2';
14
+ import '../typescript/command.cjs';
9
15
  import '../typescript/log.cjs';
10
16
  import '../typescript/mongoose.cjs';
11
17
  import 'mongodb';
@@ -1,11 +1,17 @@
1
1
  import { I_Config } from '../typescript/config.js';
2
- export { localStorage } from './localStorage.js';
2
+ export { clearExpiredErrorLists, getStoredErrorLists, saveErrorListToStorage } from './command-error.js';
3
+ export { displayResults } from './command-log.js';
4
+ export { runWithSpinner } from './command-spinner.js';
5
+ export { executeCommand, logProcessStep } from './command.js';
6
+ export { localStorage } from './local-storage.js';
3
7
  export { throwResponse } from './log.js';
4
8
  export { generateModel, generateSchema, generateShortId, generateSlug, generateSlugQuery } from './mongoose.js';
9
+ export { getLatestPackageVersion, isPackageOutdated, updatePackage } from './npm-package.js';
5
10
  export { serializer } from './serializer.js';
6
11
  export { validate } from './validate.js';
7
12
  export { default as aggregatePaginate } from 'mongoose-aggregate-paginate-v2';
8
13
  export { default as mongoosePaginate } from 'mongoose-paginate-v2';
14
+ import '../typescript/command.js';
9
15
  import '../typescript/log.js';
10
16
  import '../typescript/mongoose.js';
11
17
  import 'mongodb';
@@ -1 +1 @@
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,a,i){try{var E=e[a](i);var u=E.value}catch(e){t(e);return}if(E.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,a){var i=e.apply(r,n);function E(e){t(i,o,a,E,u,"next",e)}function u(e){t(i,o,a,E,u,"throw",e)}E(undefined)})}}function o(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function a(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function i(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function E(){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){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}n.forEach(function(r){o(e,r,t[r])})}return e}function s(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function c(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{s(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function l(e,r){if(e==null)return{};var t=S(e,r);var n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++){n=a[o];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function S(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var o,a;for(a=0;a<n.length;a++){o=n[a];if(r.indexOf(o)>=0)continue;t[o]=e[o]}return t}function f(e){return r(e)||i(e)||A(e)||E()}function O(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function A(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 p(e,r){var t,n,o,a,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:E(0),"throw":E(1),"return":E(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function E(e){return function(r){return u([e,r])}}function u(a){if(t)throw new TypeError("Generator is already executing.");while(i)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:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=r.call(e,i)}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}}}import d from"unorm";import y from"localforage";var h={get:function e(e){return n(function(){var r;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error('Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return n(function(){var t;return p(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,y.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return n(function(){var r;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},clear:function e(){return n(function(){var e;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,y.clear()];case 1:r.sent();return[3,3];case 2:e=r.sent();console.error("Error clearing storage:",e);return[3,3];case 3:return[2]}})})()},key:function e(e){return n(function(){var r;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.key(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error("Error getting key at index ".concat(e,":"),r),null)];case 3:return[2]}})})()},keys:function e(){return n(function(){var e;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,y.keys()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting keys:",e),[])];case 3:return[2]}})})()},length:function e(){return n(function(){var e;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,y.length()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting storage length:",e),0)];case 3:return[2]}})})()},iterate:function e(e){return n(function(){var r;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.iterate(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error("Error iterating storage:",r);return[3,3];case 3:return[2]}})})()}};import{GraphQLError as g}from"graphql";import{dirname as D}from"node:path";import{fileURLToPath as T}from"node:url";var R=T(import.meta.url),m=D(R);var v={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};function _(e){var r=e.message,t=e.status,n=t===void 0?v.INTERNAL_SERVER_ERROR:t,o=e.type,a=o===void 0?"graphql":o;var i;var E=(i=r!==null&&r!==void 0?r:n.MESSAGE)!==null&&i!==void 0?i:"Internal server error";throw a==="graphql"?new g(E,{extensions:{code:n.CODE}}):new Error(E)}import C from"crypto-js";import I from"mongoose-aggregate-paginate-v2";import M from"mongoose-paginate-v2";import N from"slugify";import{v4 as b}from"uuid";function G(e,r){r.filter(function(e){return typeof e=="function"}).forEach(function(r){return e.plugin(r)})}function P(e,r){r.forEach(function(r){var t=r.method,n=r.fn;return e.pre(t,n)})}function U(e){return new e.Schema({id:{type:String,default:b,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})}function w(e){var r=e.mongoose,t=e.schema,n=e.virtuals,o=n===void 0?[]:n,a=e.standalone,i=a===void 0?!1:a;var E=new r.Schema(t,{strict:!0});return o.forEach(function(e){var r=e.name,t=e.options,n=e.get;var o=E.virtual(r,t);n&&o.get(n)}),i||E.add(U(r)),E}function L(e){var r=e.mongoose,t=e.name,n=e.schema,o=e.pagination,a=o===void 0?!1:o,i=e.aggregate,E=i===void 0?!1:i,u=e.virtuals,s=u===void 0?[]:u,c=e.middlewares,l=c===void 0?[]:c;if(!t)throw new Error("Model name is required.");if(r.models[t])return r.models[t];var S=w({mongoose:r,schema:n,virtuals:s});return G(S,[a&&M,E&&I]),P(S,l),r.model(t,S)}var F=N.default||N;function j(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;var t=r||{},n=t.lower,o=n===void 0?!0:n,a=t.locale,i=a===void 0?"vi":a,E=l(t,["lower","locale"]);return F(e,u({lower:o,locale:i},E))}function q(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return C.SHA256(e).toString(C.enc.Hex).slice(0,r)}function Q(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;return c(u({},r,t&&{id:{$ne:t}}),{$or:[{slug:e},{slugHistory:e}]})}var x={serialize:function(e){return JSON.stringify(e,function(e,r){return a(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})}};var k={common:{isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":O(e))=="object"?a(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1},isEmptyValidator:function e(){return /*#__PURE__*/function(){var e=n(function(e){return p(this,function(r){return[2,!k.common.isEmpty(e)]})});return function(r){return e.apply(this,arguments)}}()},isUniqueValidator:function e(e){return /*#__PURE__*/function(){var r=n(function(r){var t;return p(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");t={$or:e.map(function(e){return o({},e,r)})};return[4,this.constructor.findOne(t)];case 1:return[2,!n.sent()]}})});return function(e){return r.apply(this,arguments)}}()},matchesRegexValidator:function e(e){return /*#__PURE__*/function(){var r=n(function(r){return p(this,function(t){if(!Array.isArray(e)||e.some(function(e){return!a(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(r)})]})});return function(e){return r.apply(this,arguments)}}()}}};function H(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n=function(e,r){return Object.keys(r).forEach(function(t){var o=r[t],a=e[t];Array.isArray(o)?e[t]=f(new Set(f(Array.isArray(a)?a:[]).concat(f(o)))):(typeof o==="undefined"?"undefined":O(o))=="object"&&o!==null&&!Array.isArray(o)?e[t]=n((typeof a==="undefined"?"undefined":O(a))=="object"&&!Array.isArray(a)?a:{},o):e[t]=o}),e};return r.flatMap(function(e){return Array.isArray(e)?e:[e]}).reduce(function(e,r){return n(e,r)},{})}function Y(e){try{return JSON.parse(e),!0}catch(e){return!1}}function V(e){return e=d.nfkc(e),e=e.replace(/[aàáạảãâầấậẩẫăằắặẳẵ]/g,"(a|\xe0|\xe1|ạ|ả|\xe3|\xe2|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)"),e=e.replace(/[eèéẹẻẽêềếệểễ]/g,"(e|\xe8|\xe9|ẹ|ẻ|ẽ|\xea|ề|ế|ệ|ể|ễ)"),e=e.replace(/[iìíịỉĩ]/g,"(i|\xec|\xed|ị|ỉ|ĩ)"),e=e.replace(/[oòóọỏõôồốộổỗơờớợởỡ]/g,"(o|\xf2|\xf3|ọ|ỏ|\xf5|\xf4|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)"),e=e.replace(/[uùúụủũưừứựửữ]/g,"(u|\xf9|\xfa|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)"),e=e.replace(/[yỳýỵỷỹ]/g,"(y|ỳ|\xfd|ỵ|ỷ|ỹ)"),e=e.replace(/d|đ/g,"(d|đ)"),e=e.replace(/[AÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴ]/g,"(A|\xc0|\xc1|Ạ|Ả|\xc3|\xc2|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ)"),e=e.replace(/[EÈÉẸẺẼÊỀẾỆỂỄ]/g,"(E|\xc8|\xc9|Ẹ|Ẻ|Ẽ|\xca|Ề|Ế|Ệ|Ể|Ễ)"),e=e.replace(/[IÌÍỊỈĨ]/g,"(I|\xcc|\xcd|Ị|Ỉ|Ĩ)"),e=e.replace(/[OÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠ]/g,"(O|\xd2|\xd3|Ọ|Ỏ|\xd5|\xd4|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ)"),e=e.replace(/[UÙÚỤỦŨƯỪỨỰỬỮ]/g,"(U|\xd9|\xda|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)"),e=e.replace(/[YỲÝỴỶỸ]/g,"(Y|Ỳ|\xdd|Ỵ|Ỷ|Ỹ)"),e=e.replace(/D|Đ/g,"(D|Đ)"),e}var B=function(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")};export{I as aggregatePaginate,H as deepMerge,L as generateModel,w as generateSchema,q as generateShortId,j as generateSlug,Q as generateSlugQuery,Y as isJson,h as localStorage,M as mongoosePaginate,V as regexSearchMapper,B as removeAccent,x as serializer,_ as throwResponse,k as validate};
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,a,s){try{var i=e[a](s);var c=i.value}catch(e){t(e);return}if(i.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 s=e.apply(r,n);function i(e){t(s,o,a,i,c,"next",e)}function c(e){t(s,o,a,i,c,"throw",e)}i(undefined)})}}function o(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function a(e,r){if(r!=null&&typeof Symbol!=="undefined"&&r[Symbol.hasInstance]){return!!r[Symbol.hasInstance](e)}else{return e instanceof r}}function s(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(){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 c(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};var n=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}n.forEach(function(r){o(e,r,t[r])})}return e}function u(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function l(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{u(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function E(e,r){if(e==null)return{};var t=f(e,r);var n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++){n=a[o];if(r.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;t[n]=e[n]}}return t}function f(e,r){if(e==null)return{};var t={};var n=Object.keys(e);var o,a;for(a=0;a<n.length;a++){o=n[a];if(r.indexOf(o)>=0)continue;t[o]=e[o]}return t}function p(e){return r(e)||s(e)||S(e)||i()}function d(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}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 h(e,r){var t,n,o,a,s={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(e){return function(r){return c([e,r])}}function c(a){if(t)throw new TypeError("Generator is already executing.");while(s)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:s.label++;return{value:a[1],done:false};case 5:s.label++;n=a[1];a=[0];continue;case 7:a=s.ops.pop();s.trys.pop();continue;default:if(!(o=s.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){s=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(a[0]===6&&s.label<o[1]){s.label=o[1];o=a;break}if(o&&s.label<o[2]){s.label=o[2];s.ops.push(a);break}if(o[2])s.ops.pop();s.trys.pop();continue}a=r.call(e,s)}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}}}import g from"unorm";import y from"localforage";var O={get:function e(e){return n(function(){var r;return h(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.getItem(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error('Error getting key "'.concat(e,'":'),r),null)];case 3:return[2]}})})()},set:function e(e,r){return n(function(){var t;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,y.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return n(function(){var r;return h(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.removeItem(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error('Error removing key "'.concat(e,'":'),r);return[3,3];case 3:return[2]}})})()},clear:function e(){return n(function(){var e;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,y.clear()];case 1:r.sent();return[3,3];case 2:e=r.sent();console.error("Error clearing storage:",e);return[3,3];case 3:return[2]}})})()},key:function e(e){return n(function(){var r;return h(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.key(e)];case 1:return[2,t.sent()];case 2:r=t.sent();return[2,(console.error("Error getting key at index ".concat(e,":"),r),null)];case 3:return[2]}})})()},keys:function e(){return n(function(){var e;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,y.keys()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting keys:",e),[])];case 3:return[2]}})})()},length:function e(){return n(function(){var e;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,y.length()];case 1:return[2,r.sent()];case 2:e=r.sent();return[2,(console.error("Error getting storage length:",e),0)];case 3:return[2]}})})()},iterate:function e(e){return n(function(){var r;return h(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,y.iterate(e)];case 1:t.sent();return[3,3];case 2:r=t.sent();console.error("Error iterating storage:",r);return[3,3];case 3:return[2]}})})()}};var m=function(e){return"error_list:".concat(e)},v=24*60*60*1e3;function A(e){return D.apply(this,arguments)}function D(){D=n(function(e){var r,t,n;return h(this,function(o){switch(o.label){case 0:if(!e.length)return[2];r=Date.now(),t=m(r);o.label=1;case 1:o.trys.push([1,3,,4]);return[4,O.set(t,{errors:e,timestamp:r})];case 2:o.sent(),console.log("✅ Saved ".concat(e.length," errors to storage with key: ").concat(t));return[3,4];case 3:n=o.sent();console.error("❌ Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return D.apply(this,arguments)}function T(){return R.apply(this,arguments)}function R(){R=n(function(){var e,r,t,n,o,a,s,i,c,u,l,E;return h(this,function(f){switch(f.label){case 0:f.trys.push([0,10,,11]);return[4,O.keys()];case 1:e=f.sent().filter(function(e){return e.startsWith("error_list:")}),r=[];t=true,n=false,o=undefined;f.label=2;case 2:f.trys.push([2,7,8,9]);a=e[Symbol.iterator]();f.label=3;case 3:if(!!(t=(s=a.next()).done))return[3,6];i=s.value;return[4,O.get(i)];case 4:u=f.sent();u&&(c=r).push.apply(c,p(u.errors));f.label=5;case 5:t=true;return[3,3];case 6:return[3,9];case 7:l=f.sent();n=true;o=l;return[3,9];case 8:try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw o}}return[7];case 9:return[2,r];case 10:E=f.sent();return[2,(console.error("❌ Failed to retrieve stored errors: ".concat(E.message)),[])];case 11:return[2]}})});return R.apply(this,arguments)}function _(){return b.apply(this,arguments)}function b(){b=n(function(){var e,r,t,n,o,a,s,i,c,u,l,E;return h(this,function(f){switch(f.label){case 0:f.trys.push([0,12,,13]);return[4,O.keys()];case 1:e=f.sent(),r=Date.now();t=true,n=false,o=undefined;f.label=2;case 2:f.trys.push([2,9,10,11]);a=e[Symbol.iterator]();f.label=3;case 3:if(!!(t=(s=a.next()).done))return[3,8];i=s.value;if(!i.startsWith("error_list:"))return[3,7];return[4,O.get(i)];case 4:c=f.sent();u=c&&r-c.timestamp>v;if(!u)return[3,6];return[4,O.remove(i)];case 5:u=(f.sent(),console.log("\uD83D\uDDD1️ Removed expired error list: ".concat(i)));f.label=6;case 6:u;f.label=7;case 7:t=true;return[3,3];case 8:return[3,11];case 9:l=f.sent();n=true;o=l;return[3,11];case 10:try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw o}}return[7];case 11:return[3,13];case 12:E=f.sent();console.error("❌ Failed to clear expired error lists: ".concat(E.message));return[3,13];case 13:return[2]}})});return b.apply(this,arguments)}import I from"boxen";import C from"chalk";var M=C.blue,N=C.red,w=C.yellow,G=C.green,P=C.gray,U=C.bold;function L(e,r){var t=new Map([[N,"red"],[w,"yellow"],[G,"green"]]).get(r)||"green";return I(U(r(e)),{padding:1,margin:1,borderStyle:"arrow",borderColor:t})}function F(e,r,t,n){e.length&&(e.forEach(function(e){var n=e.file,o=e.position,a=e.rule,s=e.message;console.log("".concat(r("".concat(t," File:"))," ").concat(M("".concat(n).concat(o?":".concat(o):"")))),a&&console.log(" ".concat(r("Rule:")," ").concat(r(a))),console.log(" ".concat(r("Message:")," ").concat(r(s)))}),console.log(L(U(r("".concat(t," Total ").concat(n,": ").concat(e.length))),r)),console.log(P("─".repeat(40))))}function x(){return j.apply(this,arguments)}function j(){j=n(function(){var e,r;return h(this,function(t){switch(t.label){case 0:return[4,T()];case 1:e=t.sent().filter(function(e){return e.type==="error"});return[4,T()];case 2:r=t.sent().filter(function(e){return e.type==="warning"});!e.length&&!r.length?console.log(L(U(G("✔ NO ISSUE FOUND!")),G)):(F(r,w,"⚠","Warnings"),F(e,N,"✖","Errors"));return[2]}})});return j.apply(this,arguments)}import k from"node:process";import q from"ora";function Q(e,r){return H.apply(this,arguments)}function H(){H=n(function(e,r){var t,n,o,a,s,i,c,u,l;var E=arguments;return h(this,function(f){switch(f.label){case 0:t=E.length>2&&E[2]!==void 0?E[2]:{};n=t.successMessage,o=t.failureMessage,a=t.errorList,s=a===void 0?[]:a,i=t.exitOnError,c=i===void 0?!0:i,u=q({text:e,color:"cyan",spinner:"dots"}).start();f.label=1;case 1:f.trys.push([1,3,,4]);return[4,r()];case 2:f.sent(),s.length?c?(u.fail(o||"".concat(e," ❌")),k.exit(1)):u.fail(o||"".concat(e," ❌")):u.succeed(n||"".concat(e," ✅"));return[3,4];case 3:l=f.sent();if(u.fail(o||"".concat(e," ❌")),c)k.exit(1);else throw l;return[3,4];case 4:return[2]}})});return H.apply(this,arguments)}import Y from"chalk";import{exec as V}from"node:child_process";import B from"node:process";import*as W from"node:util";var J=W.promisify(V),$=Y.gray,z=Y.white,K=[];function X(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";var t=new Date().toLocaleString();console.log("".concat(r," [").concat(t,"] ").concat(z(e)))}function Z(e){var r=/^\s*(\d+):(\d+)\s+(error|warning)\s+(\S+)\s+(\S+)$/,t=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,n=/^✖\s+(.*?)\s+\[(.*?)\]$/,o=[],a="";e.split("\n").forEach(function(e){if(e.startsWith("/"))a=e.trim();else{var s=r.exec(e);if(s&&a)K.push({file:a,position:"".concat(s[1],":").concat(s[2]),type:s[3]==="error"?"error":"warning",message:s[4].trim(),rule:s[5].trim()});else{var i=t.exec(e);if(i)K.push({file:i[1],position:"".concat(i[2],":").concat(i[3]),type:i[4],message:i[5].trim()});else{var c=n.exec(e);c?K.push({file:"commitlint",type:"error",message:c[1].trim(),rule:c[2].trim()}):o.push(e.trim())}}}}),o.length>0&&(console.log($("Unmatched lines:")),o.forEach(function(e){return console.info(e)}))}function ee(e){try{JSON.parse(e).forEach(function(e){var r=e.filePath,t=e.messages;t.forEach(function(e){var t=e.severity,n=e.line,o=e.column,a=e.ruleId,s=e.message;K.push({type:t===2?"error":"warning",file:r,position:"".concat(n,":").concat(o),rule:a,message:s})})})}catch(r){Z(e)}}function er(e,r){return et.apply(this,arguments)}function et(){et=n(function(e,r){var t,n,o,a,s,i,c;var u=arguments;return h(this,function(l){switch(l.label){case 0:t=u.length>2&&u[2]!==void 0?u[2]:ee;X(r);n=new AbortController;B.on("SIGINT",function(){console.log("Terminating process..."),n.abort(),B.exit()});l.label=1;case 1:l.trys.push([1,5,,6]);return[4,J(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:o=l.sent(),a=o.stdout,s=o.stderr;[a,s].forEach(function(e){return e&&t(e)});i=K.length;if(!i)return[3,4];return[4,A(K)];case 3:i=l.sent();l.label=4;case 4:i;return[3,6];case 5:c=l.sent();console.error("Command failed: ".concat(c.message));return[3,6];case 6:return[2]}})});return et.apply(this,arguments)}import{GraphQLError as en}from"graphql";import{dirname as eo}from"node:path";import{fileURLToPath as ea}from"node:url";var es=ea(import.meta.url),ei=eo(es);var ec={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};function eu(e){var r=e.message,t=e.status,n=t===void 0?ec.INTERNAL_SERVER_ERROR:t,o=e.type,a=o===void 0?"graphql":o;var s;var i=(s=r!==null&&r!==void 0?r:n.MESSAGE)!==null&&s!==void 0?s:"Internal server error";throw a==="graphql"?new en(i,{extensions:{code:n.CODE}}):new Error(i)}import el from"crypto-js";import eE from"mongoose-aggregate-paginate-v2";import ef from"mongoose-paginate-v2";import ep from"slugify";import{v4 as ed}from"uuid";function eS(e,r){r.filter(function(e){return typeof e=="function"}).forEach(function(r){return e.plugin(r)})}function eh(e,r){r.forEach(function(r){var t=r.method,n=r.fn;return e.pre(t,n)})}function eg(e){return new e.Schema({id:{type:String,default:ed,required:!0,unique:!0},isDel:{type:Boolean,default:!1,required:!0}},{timestamps:!0})}function ey(e){var r=e.mongoose,t=e.schema,n=e.virtuals,o=n===void 0?[]:n,a=e.standalone,s=a===void 0?!1:a;var i=new r.Schema(t,{strict:!0});return o.forEach(function(e){var r=e.name,t=e.options,n=e.get;var o=i.virtual(r,t);n&&o.get(n)}),s||i.add(eg(r)),i}function eO(e){var r=e.mongoose,t=e.name,n=e.schema,o=e.pagination,a=o===void 0?!1:o,s=e.aggregate,i=s===void 0?!1:s,c=e.virtuals,u=c===void 0?[]:c,l=e.middlewares,E=l===void 0?[]:l;if(!t)throw new Error("Model name is required.");if(r.models[t])return r.models[t];var f=ey({mongoose:r,schema:n,virtuals:u});return eS(f,[a&&ef,i&&eE]),eh(f,E),r.model(t,f)}var em=ep.default||ep;function ev(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;var t=r||{},n=t.lower,o=n===void 0?!0:n,a=t.locale,s=a===void 0?"vi":a,i=E(t,["lower","locale"]);return em(e,c({lower:o,locale:s},i))}function eA(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:4;return el.SHA256(e).toString(el.enc.Hex).slice(0,r)}function eD(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;return l(c({},r,t&&{id:{$ne:t}}),{$or:[{slug:e},{slugHistory:e}]})}import eT from"node-fetch";import eR from"node:fs";import e_ from"node:path";import eb from"node:process";var eI=24*60*60*1e3;function eC(e){return eM.apply(this,arguments)}function eM(){eM=n(function(e){var r,t,n,o,a,s,i,c,u,l;var E=arguments;return h(this,function(f){switch(f.label){case 0:r=E.length>1&&E[1]!==void 0?E[1]:!1;t="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,O.get(t)];case 1:o=f.sent();return[4,O.get(n)];case 2:a=f.sent(),s=o&&Date.now()-o.timestamp<eI;if(!r&&s)return[2,(console.log("Using cached version for ".concat(e,": ").concat(o.version)),o.version)];i={};(a===null||a===void 0?void 0:a.etag)&&(i["If-None-Match"]=a.etag),(a===null||a===void 0?void 0:a.lastModified)&&(i["If-Modified-Since"]=a.lastModified);f.label=3;case 3:f.trys.push([3,8,,9]);console.log("Fetching latest version for ".concat(e,"..."));return[4,eT("https://registry.npmjs.org/".concat(e,"/latest"),{headers:i})];case 4:c=f.sent();if(c.status===304&&o)return[2,(console.log("Cache is still valid for ".concat(e,": ").concat(o.version)),o.version)];if(!c.ok)throw new Error("Failed to fetch latest version: ".concat(c.statusText));return[4,c.json()];case 5:u=f.sent().version;return[4,O.set(t,{version:u,timestamp:Date.now()})];case 6:f.sent();return[4,O.set(n,{etag:c.headers.get("ETag")||void 0,lastModified:c.headers.get("Last-Modified")||void 0})];case 7:return[2,(f.sent(),console.log("Cached latest version for ".concat(e,": ").concat(u)),u)];case 8:l=f.sent();if(console.error("Error fetching latest version for ".concat(e,": ").concat(l.message)),o)return[2,(console.warn("Falling back to cached version for ".concat(e,": ").concat(o.version)),o.version)];throw l;case 9:return[2]}})});return eM.apply(this,arguments)}function eN(e){return e_.join(eb.cwd(),"node_modules",e,"package.json")}function ew(){return e_.join(eb.cwd(),"package.json")}function eG(e){return eP.apply(this,arguments)}function eP(){eP=n(function(e){var r,t,n,o,a;var s=arguments;return h(this,function(i){switch(i.label){case 0:r=s.length>1&&s[1]!==void 0?s[1]:!0;i.label=1;case 1:i.trys.push([1,3,,4]);t=eN(e);if(!eR.existsSync(t))return[2,(console.log("".concat(e," is not installed.")),!0)];n=JSON.parse(eR.readFileSync(t,"utf-8")).version;return[4,eC(e,r)];case 2:o=i.sent();return[2,(console.log("Installed version of ".concat(e,": ").concat(n)),console.log("Latest version of ".concat(e,": ").concat(o)),n!==o)];case 3:a=i.sent();return[2,(console.warn("Failed to check version for ".concat(e,": ").concat(a.message)),!0)];case 4:return[2]}})});return eP.apply(this,arguments)}function eU(e){return eL.apply(this,arguments)}function eL(){eL=n(function(e){var r,t,n,a;return h(this,function(s){switch(s.label){case 0:s.trys.push([0,4,,5]);return[4,eC(e,!0)];case 1:r=s.sent(),t=ew(),n=JSON.parse(eR.readFileSync(t,"utf-8"));n.dependencies=l(c({},n.dependencies),o({},e,r)),eR.writeFileSync(t,JSON.stringify(n,null,2)),console.log("Updated ".concat(e," to version ").concat(r));return[4,er("npm i -f","Installing all dependencies with updated ".concat(e,"..."))];case 2:s.sent();return[4,er("npm run lint:fix","Fixing lint issues for ".concat(e,"..."))];case 3:s.sent(),console.log("".concat(e," updated successfully."));return[3,5];case 4:a=s.sent();throw console.error("Failed to update ".concat(e,": ").concat(a.message)),a;case 5:return[2]}})});return eL.apply(this,arguments)}var eF={serialize:function(e){return JSON.stringify(e,function(e,r){return a(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})}};var ex={common:{isEmpty:function e(e){return e==null?!0:Array.isArray(e)?e.length===0:(typeof e==="undefined"?"undefined":d(e))=="object"?a(e,Date)?!1:Object.keys(e).length===0:typeof e=="string"?e.trim().length===0:!1},isEmptyValidator:function e(){return /*#__PURE__*/function(){var e=n(function(e){return h(this,function(r){return[2,!ex.common.isEmpty(e)]})});return function(r){return e.apply(this,arguments)}}()},isUniqueValidator:function e(e){return /*#__PURE__*/function(){var r=n(function(r){var t;return h(this,function(n){switch(n.label){case 0:if(!Array.isArray(e)||e.length===0)throw new Error("Fields must be a non-empty array of strings.");t={$or:e.map(function(e){return o({},e,r)})};return[4,this.constructor.findOne(t)];case 1:return[2,!n.sent()]}})});return function(e){return r.apply(this,arguments)}}()},matchesRegexValidator:function e(e){return /*#__PURE__*/function(){var r=n(function(r){return h(this,function(t){if(!Array.isArray(e)||e.some(function(e){return!a(e,RegExp)}))throw new Error("regexArray must be an array of valid RegExp objects.");return[2,e.every(function(e){return e.test(r)})]})});return function(e){return r.apply(this,arguments)}}()}}};function ej(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++){r[t]=arguments[t]}var n=function(e,r){return Object.keys(r).forEach(function(t){var o=r[t],a=e[t];Array.isArray(o)?e[t]=p(new Set(p(Array.isArray(a)?a:[]).concat(p(o)))):(typeof o==="undefined"?"undefined":d(o))=="object"&&o!==null&&!Array.isArray(o)?e[t]=n((typeof a==="undefined"?"undefined":d(a))=="object"&&!Array.isArray(a)?a:{},o):e[t]=o}),e};return r.flatMap(function(e){return Array.isArray(e)?e:[e]}).reduce(function(e,r){return n(e,r)},{})}function ek(e){try{return JSON.parse(e),!0}catch(e){return!1}}function eq(e){return e=g.nfkc(e),e=e.replace(/[aàáạảãâầấậẩẫăằắặẳẵ]/g,"(a|\xe0|\xe1|ạ|ả|\xe3|\xe2|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)"),e=e.replace(/[eèéẹẻẽêềếệểễ]/g,"(e|\xe8|\xe9|ẹ|ẻ|ẽ|\xea|ề|ế|ệ|ể|ễ)"),e=e.replace(/[iìíịỉĩ]/g,"(i|\xec|\xed|ị|ỉ|ĩ)"),e=e.replace(/[oòóọỏõôồốộổỗơờớợởỡ]/g,"(o|\xf2|\xf3|ọ|ỏ|\xf5|\xf4|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)"),e=e.replace(/[uùúụủũưừứựửữ]/g,"(u|\xf9|\xfa|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)"),e=e.replace(/[yỳýỵỷỹ]/g,"(y|ỳ|\xfd|ỵ|ỷ|ỹ)"),e=e.replace(/d|đ/g,"(d|đ)"),e=e.replace(/[AÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴ]/g,"(A|\xc0|\xc1|Ạ|Ả|\xc3|\xc2|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ)"),e=e.replace(/[EÈÉẸẺẼÊỀẾỆỂỄ]/g,"(E|\xc8|\xc9|Ẹ|Ẻ|Ẽ|\xca|Ề|Ế|Ệ|Ể|Ễ)"),e=e.replace(/[IÌÍỊỈĨ]/g,"(I|\xcc|\xcd|Ị|Ỉ|Ĩ)"),e=e.replace(/[OÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠ]/g,"(O|\xd2|\xd3|Ọ|Ỏ|\xd5|\xd4|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ)"),e=e.replace(/[UÙÚỤỦŨƯỪỨỰỬỮ]/g,"(U|\xd9|\xda|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)"),e=e.replace(/[YỲÝỴỶỸ]/g,"(Y|Ỳ|\xdd|Ỵ|Ỷ|Ỹ)"),e=e.replace(/D|Đ/g,"(D|Đ)"),e}var eQ=function(e){return e.normalize("NFD").replace(RegExp("\\p{Diacritic}","gu"),"")};export{eE as aggregatePaginate,_ as clearExpiredErrorLists,ej as deepMerge,x as displayResults,er as executeCommand,eO as generateModel,ey as generateSchema,eA as generateShortId,ev as generateSlug,eD as generateSlugQuery,eC as getLatestPackageVersion,T as getStoredErrorLists,ek as isJson,eG as isPackageOutdated,O as localStorage,X as logProcessStep,ef as mongoosePaginate,eq as regexSearchMapper,eQ as removeAccent,Q as runWithSpinner,A as saveErrorListToStorage,eF as serializer,eu as throwResponse,eU as updatePackage,ex as validate};
@@ -0,0 +1 @@
1
+ "use strict";function e(e,t,r,n,o,a,c){try{var s=e[a](c);var i=s.value}catch(e){r(e);return}if(s.done){t(i)}else{Promise.resolve(i).then(n,o)}}function t(t){return function(){var r=this,n=arguments;return new Promise(function(o,a){var c=t.apply(r,n);function s(t){e(c,o,a,s,i,"next",t)}function i(t){e(c,o,a,s,i,"throw",t)}s(undefined)})}}function r(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function n(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var o=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}o.forEach(function(t){r(e,t,n[t])})}return e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function a(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{o(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function c(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function s(e,t){var r,n,o,a,c={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(t){return i([e,t])}}function i(a){if(r)throw new TypeError("Generator is already executing.");while(c)try{if(r=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:c.label++;return{value:a[1],done:false};case 5:c.label++;n=a[1];a=[0];continue;case 7:a=c.ops.pop();c.trys.pop();continue;default:if(!(o=c.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){c=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){c.label=a[1];break}if(a[0]===6&&c.label<o[1]){c.label=o[1];o=a;break}if(o&&c.label<o[2]){c.label=o[2];c.ops.push(a);break}if(o[2])c.ops.pop();c.trys.pop();continue}a=t.call(e,c)}catch(e){a=[6,e];n=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var i=Object.create;var u=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var h=function(e,t){for(var r in t)u(e,r,{get:t[r],enumerable:!0})},g=function(e,t,r,n){var o=true,a=false,s=undefined;if(t&&(typeof t==="undefined"?"undefined":c(t))=="object"||typeof t=="function")try{var i=function(){var o=h.value;!d.call(e,o)&&o!==r&&u(e,o,{get:function(){return t[o]},enumerable:!(n=l(t,o))||n.enumerable})};for(var p=f(t)[Symbol.iterator](),h;!(o=(h=p.next()).done);o=true)i()}catch(e){a=true;s=e}finally{try{if(!o&&p.return!=null){p.return()}}finally{if(a){throw s}}}return e};var v=function(e,t,r){return r=e!=null?i(p(e)):{},g(t||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e)},y=function(e){return g(u({},"__esModule",{value:!0}),e)};var b={};h(b,{getLatestPackageVersion:function(){return B},isPackageOutdated:function(){return K},updatePackage:function(){return R}});module.exports=y(b);var m=v(require("node-fetch"),1),w=v(require("fs"),1),O=v(require("path"),1),k=v(require("process"),1);var P=v(require("chalk"),1),j=require("child_process"),S=v(require("process"),1),x=v(require("util"),1);var E=v(require("localforage"),1),D={get:function e(e){return t(function(){var t;return s(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,E.default.getItem(e)];case 1:return[2,r.sent()];case 2:t=r.sent();return[2,(console.error('Error getting key "'.concat(e,'":'),t),null)];case 3:return[2]}})})()},set:function e(e,r){return t(function(){var t;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,E.default.setItem(e,r)];case 1:n.sent();return[3,3];case 2:t=n.sent();console.error('Error setting key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},remove:function e(e){return t(function(){var t;return s(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,E.default.removeItem(e)];case 1:r.sent();return[3,3];case 2:t=r.sent();console.error('Error removing key "'.concat(e,'":'),t);return[3,3];case 3:return[2]}})})()},clear:function e(){return t(function(){var e;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,E.default.clear()];case 1:t.sent();return[3,3];case 2:e=t.sent();console.error("Error clearing storage:",e);return[3,3];case 3:return[2]}})})()},key:function e(e){return t(function(){var t;return s(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,E.default.key(e)];case 1:return[2,r.sent()];case 2:t=r.sent();return[2,(console.error("Error getting key at index ".concat(e,":"),t),null)];case 3:return[2]}})})()},keys:function e(){return t(function(){var e;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,E.default.keys()];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error("Error getting keys:",e),[])];case 3:return[2]}})})()},length:function e(){return t(function(){var e;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,E.default.length()];case 1:return[2,t.sent()];case 2:e=t.sent();return[2,(console.error("Error getting storage length:",e),0)];case 3:return[2]}})})()},iterate:function e(e){return t(function(){var t;return s(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,E.default.iterate(e)];case 1:r.sent();return[3,3];case 2:t=r.sent();console.error("Error iterating storage:",t);return[3,3];case 3:return[2]}})})()}};var F=function(e){return"error_list:".concat(e)},I=24*60*60*1e3;function q(e){return _.apply(this,arguments)}function _(){_=t(function(e){var t,r,n;return s(this,function(o){switch(o.label){case 0:if(!e.length)return[2];t=Date.now(),r=F(t);o.label=1;case 1:o.trys.push([1,3,,4]);return[4,D.set(r,{errors:e,timestamp:t})];case 2:o.sent(),console.log("✅ Saved ".concat(e.length," errors to storage with key: ").concat(r));return[3,4];case 3:n=o.sent();console.error("❌ Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return _.apply(this,arguments)}var M=x.promisify(j.exec),N=P.default,L=N.gray,T=N.white,C=[];function J(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";var r=new Date().toLocaleString();console.log("".concat(t," [").concat(r,"] ").concat(T(e)))}function U(e){var t=/^\s*(\d+):(\d+)\s+(error|warning)\s+(\S+)\s+(\S+)$/,r=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,n=/^✖\s+(.*?)\s+\[(.*?)\]$/,o=[],a="";e.split("\n").forEach(function(e){if(e.startsWith("/"))a=e.trim();else{var c=t.exec(e);if(c&&a)C.push({file:a,position:"".concat(c[1],":").concat(c[2]),type:c[3]==="error"?"error":"warning",message:c[4].trim(),rule:c[5].trim()});else{var s=r.exec(e);if(s)C.push({file:s[1],position:"".concat(s[2],":").concat(s[3]),type:s[4],message:s[5].trim()});else{var i=n.exec(e);i?C.push({file:"commitlint",type:"error",message:i[1].trim(),rule:i[2].trim()}):o.push(e.trim())}}}}),o.length>0&&(console.log(L("Unmatched lines:")),o.forEach(function(e){return console.info(e)}))}function V(e){try{JSON.parse(e).forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,n=e.line,o=e.column,a=e.ruleId,c=e.message;C.push({type:r===2?"error":"warning",file:t,position:"".concat(n,":").concat(o),rule:a,message:c})})})}catch(t){U(e)}}function $(e,t){return G.apply(this,arguments)}function G(){G=t(function(e,t){var r,n,o,a,c,i,u;var l=arguments;return s(this,function(s){switch(s.label){case 0:r=l.length>2&&l[2]!==void 0?l[2]:V;J(t);n=new AbortController;S.default.on("SIGINT",function(){console.log("Terminating process..."),n.abort(),S.default.exit()});s.label=1;case 1:s.trys.push([1,5,,6]);return[4,M(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:o=s.sent(),a=o.stdout,c=o.stderr;[a,c].forEach(function(e){return e&&r(e)});i=C.length;if(!i)return[3,4];return[4,q(C)];case 3:i=s.sent();s.label=4;case 4:i;return[3,6];case 5:u=s.sent();console.error("Command failed: ".concat(u.message));return[3,6];case 6:return[2]}})});return G.apply(this,arguments)}var A=24*60*60*1e3;function B(e){return W.apply(this,arguments)}function W(){W=t(function(e){var t,r,n,o,a,c,i,u,l,f;var p=arguments;return s(this,function(s){switch(s.label){case 0:t=p.length>1&&p[1]!==void 0?p[1]:!1;r="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,D.get(r)];case 1:o=s.sent();return[4,D.get(n)];case 2:a=s.sent(),c=o&&Date.now()-o.timestamp<A;if(!t&&c)return[2,(console.log("Using cached version for ".concat(e,": ").concat(o.version)),o.version)];i={};(a===null||a===void 0?void 0:a.etag)&&(i["If-None-Match"]=a.etag),(a===null||a===void 0?void 0:a.lastModified)&&(i["If-Modified-Since"]=a.lastModified);s.label=3;case 3:s.trys.push([3,8,,9]);console.log("Fetching latest version for ".concat(e,"..."));return[4,(0,m.default)("https://registry.npmjs.org/".concat(e,"/latest"),{headers:i})];case 4:u=s.sent();if(u.status===304&&o)return[2,(console.log("Cache is still valid for ".concat(e,": ").concat(o.version)),o.version)];if(!u.ok)throw new Error("Failed to fetch latest version: ".concat(u.statusText));return[4,u.json()];case 5:l=s.sent().version;return[4,D.set(r,{version:l,timestamp:Date.now()})];case 6:s.sent();return[4,D.set(n,{etag:u.headers.get("ETag")||void 0,lastModified:u.headers.get("Last-Modified")||void 0})];case 7:return[2,(s.sent(),console.log("Cached latest version for ".concat(e,": ").concat(l)),l)];case 8:f=s.sent();if(console.error("Error fetching latest version for ".concat(e,": ").concat(f.message)),o)return[2,(console.warn("Falling back to cached version for ".concat(e,": ").concat(o.version)),o.version)];throw f;case 9:return[2]}})});return W.apply(this,arguments)}function z(e){return O.default.join(k.default.cwd(),"node_modules",e,"package.json")}function H(){return O.default.join(k.default.cwd(),"package.json")}function K(e){return Q.apply(this,arguments)}function Q(){Q=t(function(e){var t,r,n,o,a;var c=arguments;return s(this,function(s){switch(s.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:!0;s.label=1;case 1:s.trys.push([1,3,,4]);r=z(e);if(!w.default.existsSync(r))return[2,(console.log("".concat(e," is not installed.")),!0)];n=JSON.parse(w.default.readFileSync(r,"utf-8")).version;return[4,B(e,t)];case 2:o=s.sent();return[2,(console.log("Installed version of ".concat(e,": ").concat(n)),console.log("Latest version of ".concat(e,": ").concat(o)),n!==o)];case 3:a=s.sent();return[2,(console.warn("Failed to check version for ".concat(e,": ").concat(a.message)),!0)];case 4:return[2]}})});return Q.apply(this,arguments)}function R(e){return X.apply(this,arguments)}function X(){X=t(function(e){var t,o,c,i;return s(this,function(s){switch(s.label){case 0:s.trys.push([0,4,,5]);return[4,B(e,!0)];case 1:t=s.sent(),o=H(),c=JSON.parse(w.default.readFileSync(o,"utf-8"));c.dependencies=a(n({},c.dependencies),r({},e,t)),w.default.writeFileSync(o,JSON.stringify(c,null,2)),console.log("Updated ".concat(e," to version ").concat(t));return[4,$("npm i -f","Installing all dependencies with updated ".concat(e,"..."))];case 2:s.sent();return[4,$("npm run lint:fix","Fixing lint issues for ".concat(e,"..."))];case 3:s.sent(),console.log("".concat(e," updated successfully."));return[3,5];case 4:i=s.sent();throw console.error("Failed to update ".concat(e,": ").concat(i.message)),i;case 5:return[2]}})});return X.apply(this,arguments)}0&&(module.exports={getLatestPackageVersion:getLatestPackageVersion,isPackageOutdated:isPackageOutdated,updatePackage:updatePackage});