@devbro/pashmak 0.1.49 → 0.1.52
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.
- package/dist/DatabaseServiceProvider.d.mts +2 -2
- package/dist/DatabaseServiceProvider.mjs +5 -1
- package/dist/DatabaseServiceProvider.mjs.map +1 -1
- package/dist/app/console/generate/GenerateApiDocsCommand.mjs +5 -5
- package/dist/app/console/generate/GenerateApiDocsCommand.mjs.map +1 -1
- package/dist/app/console/project/base_project/src/config/default.mts.tpl +16 -1
- package/dist/bin/DatabaseServiceProvider.cjs +4 -0
- package/dist/bin/app/console/DefaultCommand.cjs +97 -58
- package/dist/bin/app/console/KeyGenerateCommand.cjs +97 -58
- package/dist/bin/app/console/StartCommand.cjs +97 -58
- package/dist/bin/app/console/generate/GenerateApiDocsCommand.cjs +102 -63
- package/dist/bin/app/console/generate/GenerateControllerCommand.cjs +97 -58
- package/dist/bin/app/console/generate/index.cjs +102 -63
- package/dist/bin/app/console/index.cjs +102 -63
- package/dist/bin/app/console/migrate/GenerateMigrateCommand.cjs +97 -58
- package/dist/bin/app/console/migrate/MigrateCommand.cjs +97 -58
- package/dist/bin/app/console/migrate/MigrateRollbackCommand.cjs +97 -58
- package/dist/bin/app/console/migrate/index.cjs +97 -58
- package/dist/bin/app/console/queue/GenerateQueueMigrateCommand.cjs +97 -58
- package/dist/bin/cache.cjs +97 -58
- package/dist/bin/facades.cjs +97 -58
- package/dist/bin/factories.cjs +97 -58
- package/dist/bin/http.cjs +97 -58
- package/dist/bin/index.cjs +106 -63
- package/dist/bin/middlewares.cjs +97 -58
- package/dist/bin/queue.cjs +97 -58
- package/dist/facades.d.mts +6 -6
- package/dist/facades.mjs +97 -58
- package/dist/facades.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bin/factories.cjs
CHANGED
|
@@ -495,27 +495,58 @@ __name(handleHttpErrors, "handleHttpErrors");
|
|
|
495
495
|
var import_neko_logger = require("@devbro/neko-logger");
|
|
496
496
|
var import_neko_cache = require("@devbro/neko-cache");
|
|
497
497
|
var import_neko_queue = require("@devbro/neko-queue");
|
|
498
|
+
function wrapSingletonWithAccessors(singletonFn) {
|
|
499
|
+
let methodsInitialized = false;
|
|
500
|
+
const initializeMethods = /* @__PURE__ */ __name(() => {
|
|
501
|
+
if (methodsInitialized) return;
|
|
502
|
+
const defaultInstance = singletonFn();
|
|
503
|
+
const prototype = Object.getPrototypeOf(defaultInstance);
|
|
504
|
+
const methodNames = Object.getOwnPropertyNames(prototype).filter(
|
|
505
|
+
(name) => name !== "constructor" && typeof prototype[name] === "function"
|
|
506
|
+
);
|
|
507
|
+
for (const methodName of methodNames) {
|
|
508
|
+
singletonFn[methodName] = (...args) => {
|
|
509
|
+
const instance = singletonFn();
|
|
510
|
+
return instance[methodName](...args);
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
methodsInitialized = true;
|
|
514
|
+
}, "initializeMethods");
|
|
515
|
+
return new Proxy(singletonFn, {
|
|
516
|
+
get(target, prop, receiver) {
|
|
517
|
+
if (typeof prop === "string" && !Reflect.has(target, prop)) {
|
|
518
|
+
initializeMethods();
|
|
519
|
+
}
|
|
520
|
+
return Reflect.get(target, prop, receiver);
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
__name(wrapSingletonWithAccessors, "wrapSingletonWithAccessors");
|
|
498
525
|
var router = (0, import_neko_helper2.createSingleton)(() => new Router());
|
|
499
|
-
var scheduler = (
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
526
|
+
var scheduler = wrapSingletonWithAccessors(
|
|
527
|
+
(0, import_neko_helper2.createSingleton)(() => {
|
|
528
|
+
const rc = new import_neko_scheduler.Scheduler();
|
|
529
|
+
rc.setErrorHandler((err, job) => {
|
|
530
|
+
logger().error({
|
|
531
|
+
msg: "Scheduled job error",
|
|
532
|
+
err,
|
|
533
|
+
job_name: job.getName()
|
|
534
|
+
});
|
|
506
535
|
});
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
536
|
+
return rc;
|
|
537
|
+
})
|
|
538
|
+
);
|
|
510
539
|
var db = /* @__PURE__ */ __name((label = "default") => (0, import_neko_context2.ctx)().getOrThrow(["database", label]), "db");
|
|
511
|
-
var storage = (
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
540
|
+
var storage = wrapSingletonWithAccessors(
|
|
541
|
+
(0, import_neko_helper2.createSingleton)((label = "default") => {
|
|
542
|
+
let storage_config = import_neko_config.config.get(["storages", label].join("."));
|
|
543
|
+
const provider = import_neko_storage.StorageProviderFactory.create(
|
|
544
|
+
storage_config.provider,
|
|
545
|
+
storage_config.config
|
|
546
|
+
);
|
|
547
|
+
return new import_neko_storage.Storage(provider);
|
|
548
|
+
})
|
|
549
|
+
);
|
|
519
550
|
var cli = (0, import_neko_helper2.createSingleton)(() => {
|
|
520
551
|
const [node, app, ...args] = process.argv;
|
|
521
552
|
return new import_clipanion.Cli({
|
|
@@ -530,46 +561,54 @@ var httpServer = (0, import_neko_helper2.createSingleton)(() => {
|
|
|
530
561
|
server.setRouter(router());
|
|
531
562
|
return server;
|
|
532
563
|
});
|
|
533
|
-
var logger = (
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
mailer_config.config
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
queue_config.
|
|
558
|
-
queue_config
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
});
|
|
564
|
+
var logger = wrapSingletonWithAccessors(
|
|
565
|
+
(0, import_neko_helper2.createSingleton)((label) => {
|
|
566
|
+
const logger_config = import_neko_config.config.get(["loggers", label].join("."));
|
|
567
|
+
const rc = new import_neko_logger.Logger(logger_config);
|
|
568
|
+
rc.setExtrasFunction((message) => {
|
|
569
|
+
message.requestId = (0, import_neko_context2.ctxSafe)()?.get("requestId") || "N/A";
|
|
570
|
+
return message;
|
|
571
|
+
});
|
|
572
|
+
return rc;
|
|
573
|
+
})
|
|
574
|
+
);
|
|
575
|
+
var mailer = wrapSingletonWithAccessors(
|
|
576
|
+
(0, import_neko_helper2.createSingleton)((label) => {
|
|
577
|
+
const mailer_config = import_neko_config.config.get(["mailer", label].join("."));
|
|
578
|
+
const provider = import_neko_mailer.MailerProviderFactory.create(
|
|
579
|
+
mailer_config.provider,
|
|
580
|
+
mailer_config.config
|
|
581
|
+
);
|
|
582
|
+
const rc = new import_neko_mailer.Mailer(provider);
|
|
583
|
+
return rc;
|
|
584
|
+
})
|
|
585
|
+
);
|
|
586
|
+
var queue = wrapSingletonWithAccessors(
|
|
587
|
+
(0, import_neko_helper2.createSingleton)((label) => {
|
|
588
|
+
const queue_config = import_neko_config.config.get(["queues", label].join("."));
|
|
589
|
+
if (!queue_config) {
|
|
590
|
+
throw new Error(`Queue configuration for '${label}' not found`);
|
|
591
|
+
}
|
|
592
|
+
const provider = import_neko_queue.QueueTransportFactory.create(
|
|
593
|
+
queue_config.provider,
|
|
594
|
+
queue_config.config
|
|
595
|
+
);
|
|
596
|
+
return new import_neko_queue.QueueConnection(provider);
|
|
597
|
+
})
|
|
598
|
+
);
|
|
599
|
+
var cache = wrapSingletonWithAccessors(
|
|
600
|
+
(0, import_neko_helper2.createSingleton)((label) => {
|
|
601
|
+
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
602
|
+
if (!cache_config) {
|
|
603
|
+
throw new Error(`Cache configuration for '${label}' not found`);
|
|
604
|
+
}
|
|
605
|
+
const provider = CacheProviderFactory.create(
|
|
606
|
+
cache_config.provider,
|
|
607
|
+
cache_config.config
|
|
608
|
+
);
|
|
609
|
+
return new import_neko_cache.Cache(provider);
|
|
610
|
+
})
|
|
611
|
+
);
|
|
573
612
|
|
|
574
613
|
// src/queue.mts
|
|
575
614
|
var import_neko_helper3 = require("@devbro/neko-helper");
|
package/dist/bin/http.cjs
CHANGED
|
@@ -665,27 +665,58 @@ import_neko_storage.StorageProviderFactory.register("sftp", (opt) => {
|
|
|
665
665
|
// src/facades.mts
|
|
666
666
|
var import_neko_cache2 = require("@devbro/neko-cache");
|
|
667
667
|
var import_neko_queue2 = require("@devbro/neko-queue");
|
|
668
|
+
function wrapSingletonWithAccessors(singletonFn) {
|
|
669
|
+
let methodsInitialized = false;
|
|
670
|
+
const initializeMethods = /* @__PURE__ */ __name(() => {
|
|
671
|
+
if (methodsInitialized) return;
|
|
672
|
+
const defaultInstance = singletonFn();
|
|
673
|
+
const prototype = Object.getPrototypeOf(defaultInstance);
|
|
674
|
+
const methodNames = Object.getOwnPropertyNames(prototype).filter(
|
|
675
|
+
(name) => name !== "constructor" && typeof prototype[name] === "function"
|
|
676
|
+
);
|
|
677
|
+
for (const methodName of methodNames) {
|
|
678
|
+
singletonFn[methodName] = (...args) => {
|
|
679
|
+
const instance = singletonFn();
|
|
680
|
+
return instance[methodName](...args);
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
methodsInitialized = true;
|
|
684
|
+
}, "initializeMethods");
|
|
685
|
+
return new Proxy(singletonFn, {
|
|
686
|
+
get(target, prop, receiver) {
|
|
687
|
+
if (typeof prop === "string" && !Reflect.has(target, prop)) {
|
|
688
|
+
initializeMethods();
|
|
689
|
+
}
|
|
690
|
+
return Reflect.get(target, prop, receiver);
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
__name(wrapSingletonWithAccessors, "wrapSingletonWithAccessors");
|
|
668
695
|
var router = (0, import_neko_helper3.createSingleton)(() => new Router());
|
|
669
|
-
var scheduler = (
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
696
|
+
var scheduler = wrapSingletonWithAccessors(
|
|
697
|
+
(0, import_neko_helper3.createSingleton)(() => {
|
|
698
|
+
const rc = new import_neko_scheduler.Scheduler();
|
|
699
|
+
rc.setErrorHandler((err, job) => {
|
|
700
|
+
logger().error({
|
|
701
|
+
msg: "Scheduled job error",
|
|
702
|
+
err,
|
|
703
|
+
job_name: job.getName()
|
|
704
|
+
});
|
|
676
705
|
});
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
706
|
+
return rc;
|
|
707
|
+
})
|
|
708
|
+
);
|
|
680
709
|
var db = /* @__PURE__ */ __name((label = "default") => (0, import_neko_context3.ctx)().getOrThrow(["database", label]), "db");
|
|
681
|
-
var storage = (
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
710
|
+
var storage = wrapSingletonWithAccessors(
|
|
711
|
+
(0, import_neko_helper3.createSingleton)((label = "default") => {
|
|
712
|
+
let storage_config = import_neko_config.config.get(["storages", label].join("."));
|
|
713
|
+
const provider = import_neko_storage2.StorageProviderFactory.create(
|
|
714
|
+
storage_config.provider,
|
|
715
|
+
storage_config.config
|
|
716
|
+
);
|
|
717
|
+
return new import_neko_storage2.Storage(provider);
|
|
718
|
+
})
|
|
719
|
+
);
|
|
689
720
|
var cli = (0, import_neko_helper3.createSingleton)(() => {
|
|
690
721
|
const [node, app, ...args] = process.argv;
|
|
691
722
|
return new import_clipanion.Cli({
|
|
@@ -700,46 +731,54 @@ var httpServer = (0, import_neko_helper3.createSingleton)(() => {
|
|
|
700
731
|
server.setRouter(router());
|
|
701
732
|
return server;
|
|
702
733
|
});
|
|
703
|
-
var logger = (
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
mailer_config.config
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
queue_config.
|
|
728
|
-
queue_config
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
});
|
|
734
|
+
var logger = wrapSingletonWithAccessors(
|
|
735
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
736
|
+
const logger_config = import_neko_config.config.get(["loggers", label].join("."));
|
|
737
|
+
const rc = new import_neko_logger.Logger(logger_config);
|
|
738
|
+
rc.setExtrasFunction((message) => {
|
|
739
|
+
message.requestId = (0, import_neko_context3.ctxSafe)()?.get("requestId") || "N/A";
|
|
740
|
+
return message;
|
|
741
|
+
});
|
|
742
|
+
return rc;
|
|
743
|
+
})
|
|
744
|
+
);
|
|
745
|
+
var mailer = wrapSingletonWithAccessors(
|
|
746
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
747
|
+
const mailer_config = import_neko_config.config.get(["mailer", label].join("."));
|
|
748
|
+
const provider = import_neko_mailer2.MailerProviderFactory.create(
|
|
749
|
+
mailer_config.provider,
|
|
750
|
+
mailer_config.config
|
|
751
|
+
);
|
|
752
|
+
const rc = new import_neko_mailer2.Mailer(provider);
|
|
753
|
+
return rc;
|
|
754
|
+
})
|
|
755
|
+
);
|
|
756
|
+
var queue = wrapSingletonWithAccessors(
|
|
757
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
758
|
+
const queue_config = import_neko_config.config.get(["queues", label].join("."));
|
|
759
|
+
if (!queue_config) {
|
|
760
|
+
throw new Error(`Queue configuration for '${label}' not found`);
|
|
761
|
+
}
|
|
762
|
+
const provider = import_neko_queue2.QueueTransportFactory.create(
|
|
763
|
+
queue_config.provider,
|
|
764
|
+
queue_config.config
|
|
765
|
+
);
|
|
766
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
767
|
+
})
|
|
768
|
+
);
|
|
769
|
+
var cache = wrapSingletonWithAccessors(
|
|
770
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
771
|
+
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
772
|
+
if (!cache_config) {
|
|
773
|
+
throw new Error(`Cache configuration for '${label}' not found`);
|
|
774
|
+
}
|
|
775
|
+
const provider = CacheProviderFactory.create(
|
|
776
|
+
cache_config.provider,
|
|
777
|
+
cache_config.config
|
|
778
|
+
);
|
|
779
|
+
return new import_neko_cache2.Cache(provider);
|
|
780
|
+
})
|
|
781
|
+
);
|
|
743
782
|
|
|
744
783
|
// src/http.mts
|
|
745
784
|
__reExport(http_exports, require("@devbro/neko-http"), module.exports);
|
package/dist/bin/index.cjs
CHANGED
|
@@ -792,6 +792,32 @@ var init_factories = __esm({
|
|
|
792
792
|
});
|
|
793
793
|
|
|
794
794
|
// src/facades.mts
|
|
795
|
+
function wrapSingletonWithAccessors(singletonFn) {
|
|
796
|
+
let methodsInitialized = false;
|
|
797
|
+
const initializeMethods = /* @__PURE__ */ __name(() => {
|
|
798
|
+
if (methodsInitialized) return;
|
|
799
|
+
const defaultInstance = singletonFn();
|
|
800
|
+
const prototype = Object.getPrototypeOf(defaultInstance);
|
|
801
|
+
const methodNames = Object.getOwnPropertyNames(prototype).filter(
|
|
802
|
+
(name) => name !== "constructor" && typeof prototype[name] === "function"
|
|
803
|
+
);
|
|
804
|
+
for (const methodName of methodNames) {
|
|
805
|
+
singletonFn[methodName] = (...args) => {
|
|
806
|
+
const instance = singletonFn();
|
|
807
|
+
return instance[methodName](...args);
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
methodsInitialized = true;
|
|
811
|
+
}, "initializeMethods");
|
|
812
|
+
return new Proxy(singletonFn, {
|
|
813
|
+
get(target, prop, receiver) {
|
|
814
|
+
if (typeof prop === "string" && !Reflect.has(target, prop)) {
|
|
815
|
+
initializeMethods();
|
|
816
|
+
}
|
|
817
|
+
return Reflect.get(target, prop, receiver);
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
}
|
|
795
821
|
var import_neko_scheduler, import_neko_helper3, import_neko_context3, import_neko_storage2, import_neko_mailer2, import_neko_config, import_clipanion, import_neko_logger, import_neko_cache2, import_neko_queue2, router, scheduler, db, storage, cli, httpServer, logger, mailer, queue, cache;
|
|
796
822
|
var init_facades = __esm({
|
|
797
823
|
"src/facades.mts"() {
|
|
@@ -809,27 +835,32 @@ var init_facades = __esm({
|
|
|
809
835
|
init_factories();
|
|
810
836
|
import_neko_cache2 = require("@devbro/neko-cache");
|
|
811
837
|
import_neko_queue2 = require("@devbro/neko-queue");
|
|
838
|
+
__name(wrapSingletonWithAccessors, "wrapSingletonWithAccessors");
|
|
812
839
|
router = (0, import_neko_helper3.createSingleton)(() => new Router());
|
|
813
|
-
scheduler = (
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
840
|
+
scheduler = wrapSingletonWithAccessors(
|
|
841
|
+
(0, import_neko_helper3.createSingleton)(() => {
|
|
842
|
+
const rc = new import_neko_scheduler.Scheduler();
|
|
843
|
+
rc.setErrorHandler((err, job) => {
|
|
844
|
+
logger().error({
|
|
845
|
+
msg: "Scheduled job error",
|
|
846
|
+
err,
|
|
847
|
+
job_name: job.getName()
|
|
848
|
+
});
|
|
820
849
|
});
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
850
|
+
return rc;
|
|
851
|
+
})
|
|
852
|
+
);
|
|
824
853
|
db = /* @__PURE__ */ __name((label = "default") => (0, import_neko_context3.ctx)().getOrThrow(["database", label]), "db");
|
|
825
|
-
storage = (
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
854
|
+
storage = wrapSingletonWithAccessors(
|
|
855
|
+
(0, import_neko_helper3.createSingleton)((label = "default") => {
|
|
856
|
+
let storage_config = import_neko_config.config.get(["storages", label].join("."));
|
|
857
|
+
const provider = import_neko_storage2.StorageProviderFactory.create(
|
|
858
|
+
storage_config.provider,
|
|
859
|
+
storage_config.config
|
|
860
|
+
);
|
|
861
|
+
return new import_neko_storage2.Storage(provider);
|
|
862
|
+
})
|
|
863
|
+
);
|
|
833
864
|
cli = (0, import_neko_helper3.createSingleton)(() => {
|
|
834
865
|
const [node, app, ...args] = process.argv;
|
|
835
866
|
return new import_clipanion.Cli({
|
|
@@ -844,46 +875,54 @@ var init_facades = __esm({
|
|
|
844
875
|
server.setRouter(router());
|
|
845
876
|
return server;
|
|
846
877
|
});
|
|
847
|
-
logger = (
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
mailer_config.config
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
queue_config.
|
|
872
|
-
queue_config
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
878
|
+
logger = wrapSingletonWithAccessors(
|
|
879
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
880
|
+
const logger_config = import_neko_config.config.get(["loggers", label].join("."));
|
|
881
|
+
const rc = new import_neko_logger.Logger(logger_config);
|
|
882
|
+
rc.setExtrasFunction((message) => {
|
|
883
|
+
message.requestId = (0, import_neko_context3.ctxSafe)()?.get("requestId") || "N/A";
|
|
884
|
+
return message;
|
|
885
|
+
});
|
|
886
|
+
return rc;
|
|
887
|
+
})
|
|
888
|
+
);
|
|
889
|
+
mailer = wrapSingletonWithAccessors(
|
|
890
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
891
|
+
const mailer_config = import_neko_config.config.get(["mailer", label].join("."));
|
|
892
|
+
const provider = import_neko_mailer2.MailerProviderFactory.create(
|
|
893
|
+
mailer_config.provider,
|
|
894
|
+
mailer_config.config
|
|
895
|
+
);
|
|
896
|
+
const rc = new import_neko_mailer2.Mailer(provider);
|
|
897
|
+
return rc;
|
|
898
|
+
})
|
|
899
|
+
);
|
|
900
|
+
queue = wrapSingletonWithAccessors(
|
|
901
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
902
|
+
const queue_config = import_neko_config.config.get(["queues", label].join("."));
|
|
903
|
+
if (!queue_config) {
|
|
904
|
+
throw new Error(`Queue configuration for '${label}' not found`);
|
|
905
|
+
}
|
|
906
|
+
const provider = import_neko_queue2.QueueTransportFactory.create(
|
|
907
|
+
queue_config.provider,
|
|
908
|
+
queue_config.config
|
|
909
|
+
);
|
|
910
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
911
|
+
})
|
|
912
|
+
);
|
|
913
|
+
cache = wrapSingletonWithAccessors(
|
|
914
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
915
|
+
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
916
|
+
if (!cache_config) {
|
|
917
|
+
throw new Error(`Cache configuration for '${label}' not found`);
|
|
918
|
+
}
|
|
919
|
+
const provider = CacheProviderFactory.create(
|
|
920
|
+
cache_config.provider,
|
|
921
|
+
cache_config.config
|
|
922
|
+
);
|
|
923
|
+
return new import_neko_cache2.Cache(provider);
|
|
924
|
+
})
|
|
925
|
+
);
|
|
887
926
|
}
|
|
888
927
|
});
|
|
889
928
|
|
|
@@ -2541,7 +2580,7 @@ var init_GenerateApiDocsCommand = __esm({
|
|
|
2541
2580
|
static {
|
|
2542
2581
|
__name(this, "GenerateApiDocsCommand");
|
|
2543
2582
|
}
|
|
2544
|
-
static paths = [[`generate`, `
|
|
2583
|
+
static paths = [[`generate`, `apidocs`]];
|
|
2545
2584
|
static usage = import_clipanion9.Command.Usage({
|
|
2546
2585
|
category: `Generate`,
|
|
2547
2586
|
description: `Generate OpenAPI documentation from routes`,
|
|
@@ -2581,14 +2620,14 @@ api_docs: {
|
|
|
2581
2620
|
examples: [
|
|
2582
2621
|
[
|
|
2583
2622
|
`Generate from routes`,
|
|
2584
|
-
`$0 generate
|
|
2623
|
+
`$0 generate apidocs generate-from-routes --output path/to/output.json`
|
|
2585
2624
|
],
|
|
2586
2625
|
[
|
|
2587
2626
|
`Generate base spec`,
|
|
2588
|
-
`$0 generate
|
|
2627
|
+
`$0 generate apidocs generate-base --output path/to/output.json`
|
|
2589
2628
|
],
|
|
2590
|
-
[`Merge files`, `$0 generate
|
|
2591
|
-
[`Show help`, `$0 generate
|
|
2629
|
+
[`Merge files`, `$0 generate apidocs merge-files`],
|
|
2630
|
+
[`Show help`, `$0 generate apidocs --help`]
|
|
2592
2631
|
]
|
|
2593
2632
|
});
|
|
2594
2633
|
subcommand = import_clipanion9.Option.String({ required: false });
|
|
@@ -3124,6 +3163,10 @@ var init_DatabaseServiceProvider = __esm({
|
|
|
3124
3163
|
const conn = new import_neko_sql2.PostgresqlConnection(db_config.config);
|
|
3125
3164
|
return conn;
|
|
3126
3165
|
}
|
|
3166
|
+
if (db_config.provider === "sqlite") {
|
|
3167
|
+
const conn = new import_neko_sql2.SqliteConnection(db_config.config);
|
|
3168
|
+
return conn;
|
|
3169
|
+
}
|
|
3127
3170
|
throw new Error(`Unsupported database provider: ${db_config.provider}`);
|
|
3128
3171
|
}
|
|
3129
3172
|
};
|