@devbro/pashmak 0.1.55 → 0.1.57

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 (64) hide show
  1. package/dist/cjs/app/console/DefaultCommand.js +52 -0
  2. package/dist/cjs/app/console/KeyGenerateCommand.js +52 -0
  3. package/dist/cjs/app/console/StartCommand.js +52 -0
  4. package/dist/cjs/app/console/generate/GenerateApiDocsCommand.js +52 -0
  5. package/dist/cjs/app/console/generate/GenerateControllerCommand.js +52 -0
  6. package/dist/cjs/app/console/generate/index.js +52 -0
  7. package/dist/cjs/app/console/index.js +320 -70
  8. package/dist/cjs/app/console/migrate/GenerateMigrateCommand.js +52 -0
  9. package/dist/cjs/app/console/migrate/MigrateCommand.js +52 -0
  10. package/dist/cjs/app/console/migrate/MigrateRollbackCommand.js +52 -0
  11. package/dist/cjs/app/console/migrate/index.js +52 -0
  12. package/dist/cjs/app/console/project/CreateProjectCommand.js +263 -65
  13. package/dist/cjs/app/console/project/base_project/src/config/caches.ts.tpl +11 -1
  14. package/dist/cjs/app/console/project/base_project/src/config/databases.ts.tpl +8 -6
  15. package/dist/cjs/app/console/project/base_project/src/config/default.mts.tpl +13 -20
  16. package/dist/cjs/app/console/project/base_project/src/config/loggers.ts.tpl +13 -3
  17. package/dist/cjs/app/console/project/base_project/src/config/storages.ts.tpl +1 -2
  18. package/dist/cjs/app/console/project/base_project/src/initialize.ts.tpl +48 -16
  19. package/dist/cjs/app/console/project/base_project/src/routes.ts.tpl +2 -2
  20. package/dist/cjs/app/console/queue/GenerateQueueMigrateCommand.js +52 -0
  21. package/dist/cjs/bin/pashmak_cli.js +265 -66
  22. package/dist/cjs/cache/MultiCache.js +71 -0
  23. package/dist/cjs/{cache.js → cache/cache.js} +54 -2
  24. package/dist/cjs/facades.js +52 -0
  25. package/dist/cjs/factories.js +52 -0
  26. package/dist/cjs/http.js +52 -0
  27. package/dist/cjs/index.js +1900 -2056
  28. package/dist/cjs/middlewares.js +112 -2
  29. package/dist/cjs/queue.js +52 -0
  30. package/dist/esm/app/console/project/CreateProjectCommand.d.mts +15 -2
  31. package/dist/esm/app/console/project/CreateProjectCommand.mjs +265 -67
  32. package/dist/esm/app/console/project/CreateProjectCommand.mjs.map +1 -1
  33. package/dist/esm/app/console/project/base_project/src/config/caches.ts.tpl +11 -1
  34. package/dist/esm/app/console/project/base_project/src/config/databases.ts.tpl +8 -6
  35. package/dist/esm/app/console/project/base_project/src/config/default.mts.tpl +13 -20
  36. package/dist/esm/app/console/project/base_project/src/config/loggers.ts.tpl +13 -3
  37. package/dist/esm/app/console/project/base_project/src/config/storages.ts.tpl +1 -2
  38. package/dist/esm/app/console/project/base_project/src/initialize.ts.tpl +48 -16
  39. package/dist/esm/app/console/project/base_project/src/routes.ts.tpl +2 -2
  40. package/dist/esm/bin/pashmak_cli.mjs +2 -1
  41. package/dist/esm/bin/pashmak_cli.mjs.map +1 -1
  42. package/dist/esm/cache/MultiCache.d.mts +14 -0
  43. package/dist/esm/cache/MultiCache.mjs +47 -0
  44. package/dist/esm/cache/MultiCache.mjs.map +1 -0
  45. package/dist/esm/{cache.mjs → cache/cache.mjs} +1 -1
  46. package/dist/esm/cache/cache.mjs.map +1 -0
  47. package/dist/esm/config.mjs.map +1 -1
  48. package/dist/esm/factories.mjs +9 -0
  49. package/dist/esm/factories.mjs.map +1 -1
  50. package/dist/esm/index.d.mts +1 -7
  51. package/dist/esm/index.mjs +1 -32
  52. package/dist/esm/index.mjs.map +1 -1
  53. package/dist/esm/middlewares.d.mts +12 -1
  54. package/dist/esm/middlewares.mjs +52 -0
  55. package/dist/esm/middlewares.mjs.map +1 -1
  56. package/package.json +4 -2
  57. package/dist/cjs/app/console/project/base_project/package.json.tpl +0 -74
  58. package/dist/cjs/app/console/project/base_project/src/config/test.ts.tpl +0 -1
  59. package/dist/esm/app/console/project/base_project/package.json.tpl +0 -74
  60. package/dist/esm/app/console/project/base_project/src/config/test.ts.tpl +0 -1
  61. package/dist/esm/cache.mjs.map +0 -1
  62. /package/dist/cjs/app/console/project/base_project/src/config/{mailer.ts.tpl → mailers.ts.tpl} +0 -0
  63. /package/dist/esm/app/console/project/base_project/src/config/{mailer.ts.tpl → mailers.ts.tpl} +0 -0
  64. /package/dist/esm/{cache.d.mts → cache/cache.d.mts} +0 -0
@@ -709,6 +709,51 @@ var DatabaseTransport = class {
709
709
  // src/factories.mts
710
710
  var import_neko_cache2 = require("@devbro/neko-cache");
711
711
  var import_neko_storage2 = require("@devbro/neko-storage");
712
+
713
+ // src/cache/MultiCache.mts
714
+ var MultiCache = class {
715
+ constructor(caches) {
716
+ this.caches = caches;
717
+ }
718
+ static {
719
+ __name(this, "MultiCache");
720
+ }
721
+ async get(key) {
722
+ for (const cache2 of this.caches) {
723
+ const value = await cache2.get(key);
724
+ if (value !== void 0) {
725
+ return value;
726
+ }
727
+ }
728
+ return void 0;
729
+ }
730
+ async put(key, value, ttl) {
731
+ await Promise.all(this.caches.map((cache2) => cache2.put(key, value, ttl)));
732
+ }
733
+ async delete(key) {
734
+ await Promise.all(this.caches.map((cache2) => cache2.delete(key)));
735
+ }
736
+ async has(key) {
737
+ for (const cache2 of this.caches) {
738
+ if (await cache2.has(key)) {
739
+ return true;
740
+ }
741
+ }
742
+ return false;
743
+ }
744
+ async increment(key, amount) {
745
+ let rc = void 0;
746
+ for (const cache2 of this.caches) {
747
+ let rc2 = await cache2.increment(key, amount);
748
+ if (rc === void 0) {
749
+ rc = rc2;
750
+ }
751
+ }
752
+ return rc;
753
+ }
754
+ };
755
+
756
+ // src/factories.mts
712
757
  var FlexibleFactory = class {
713
758
  static {
714
759
  __name(this, "FlexibleFactory");
@@ -779,6 +824,13 @@ CacheProviderFactory.register("redis", (opt) => {
779
824
  CacheProviderFactory.register("file", (opt) => {
780
825
  return new import_neko_cache2.FileCacheProvider(opt);
781
826
  });
827
+ CacheProviderFactory.register("multi", (opt) => {
828
+ const caches = [];
829
+ for (const c of opt.caches) {
830
+ caches.push(cache(c));
831
+ }
832
+ return new MultiCache(caches);
833
+ });
782
834
  CacheProviderFactory.register("disabled", (opt) => {
783
835
  return new import_neko_cache2.DisabledCacheProvider();
784
836
  });
package/dist/cjs/http.js CHANGED
@@ -570,6 +570,51 @@ var DatabaseTransport = class {
570
570
  // src/factories.mts
571
571
  var import_neko_cache = require("@devbro/neko-cache");
572
572
  var import_neko_storage = require("@devbro/neko-storage");
573
+
574
+ // src/cache/MultiCache.mts
575
+ var MultiCache = class {
576
+ constructor(caches) {
577
+ this.caches = caches;
578
+ }
579
+ static {
580
+ __name(this, "MultiCache");
581
+ }
582
+ async get(key) {
583
+ for (const cache2 of this.caches) {
584
+ const value = await cache2.get(key);
585
+ if (value !== void 0) {
586
+ return value;
587
+ }
588
+ }
589
+ return void 0;
590
+ }
591
+ async put(key, value, ttl) {
592
+ await Promise.all(this.caches.map((cache2) => cache2.put(key, value, ttl)));
593
+ }
594
+ async delete(key) {
595
+ await Promise.all(this.caches.map((cache2) => cache2.delete(key)));
596
+ }
597
+ async has(key) {
598
+ for (const cache2 of this.caches) {
599
+ if (await cache2.has(key)) {
600
+ return true;
601
+ }
602
+ }
603
+ return false;
604
+ }
605
+ async increment(key, amount) {
606
+ let rc = void 0;
607
+ for (const cache2 of this.caches) {
608
+ let rc2 = await cache2.increment(key, amount);
609
+ if (rc === void 0) {
610
+ rc = rc2;
611
+ }
612
+ }
613
+ return rc;
614
+ }
615
+ };
616
+
617
+ // src/factories.mts
573
618
  var FlexibleFactory = class {
574
619
  static {
575
620
  __name(this, "FlexibleFactory");
@@ -640,6 +685,13 @@ CacheProviderFactory.register("redis", (opt) => {
640
685
  CacheProviderFactory.register("file", (opt) => {
641
686
  return new import_neko_cache.FileCacheProvider(opt);
642
687
  });
688
+ CacheProviderFactory.register("multi", (opt) => {
689
+ const caches = [];
690
+ for (const c of opt.caches) {
691
+ caches.push(cache(c));
692
+ }
693
+ return new MultiCache(caches);
694
+ });
643
695
  CacheProviderFactory.register("disabled", (opt) => {
644
696
  return new import_neko_cache.DisabledCacheProvider();
645
697
  });