@devbro/pashmak 0.1.48 → 0.1.51
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 +5 -2
- package/dist/DatabaseServiceProvider.mjs +10 -3
- package/dist/DatabaseServiceProvider.mjs.map +1 -1
- package/dist/app/console/StartCommand.d.mts +1 -0
- package/dist/app/console/StartCommand.mjs +5 -2
- package/dist/app/console/StartCommand.mjs.map +1 -1
- package/dist/app/console/generate/GenerateApiDocsCommand.d.mts +34 -2
- package/dist/app/console/generate/GenerateApiDocsCommand.mjs +183 -100
- package/dist/app/console/generate/GenerateApiDocsCommand.mjs.map +1 -1
- package/dist/app/console/project/base_project/src/config/storages.ts.tpl +2 -2
- package/dist/bin/DatabaseServiceProvider.cjs +12 -2
- package/dist/bin/app/console/DefaultCommand.cjs +136 -69
- package/dist/bin/app/console/KeyGenerateCommand.cjs +136 -69
- package/dist/bin/app/console/StartCommand.cjs +141 -71
- package/dist/bin/app/console/generate/GenerateApiDocsCommand.cjs +320 -170
- package/dist/bin/app/console/generate/GenerateControllerCommand.cjs +136 -69
- package/dist/bin/app/console/generate/index.cjs +320 -170
- package/dist/bin/app/console/index.cjs +325 -172
- package/dist/bin/app/console/migrate/GenerateMigrateCommand.cjs +136 -69
- package/dist/bin/app/console/migrate/MigrateCommand.cjs +136 -69
- package/dist/bin/app/console/migrate/MigrateRollbackCommand.cjs +136 -69
- package/dist/bin/app/console/migrate/index.cjs +136 -69
- package/dist/bin/app/console/queue/GenerateQueueMigrateCommand.cjs +136 -69
- package/dist/bin/cache.cjs +136 -69
- package/dist/bin/facades.cjs +136 -69
- package/dist/bin/factories.cjs +136 -69
- package/dist/bin/http.cjs +136 -69
- package/dist/bin/index.cjs +338 -178
- package/dist/bin/middlewares.cjs +136 -69
- package/dist/bin/queue.cjs +136 -69
- package/dist/bin/router.cjs +3 -5
- package/dist/facades.d.mts +6 -6
- package/dist/facades.mjs +97 -58
- package/dist/facades.mjs.map +1 -1
- package/dist/factories.mjs +45 -2
- package/dist/factories.mjs.map +1 -1
- package/dist/http.mjs +1 -1
- package/dist/http.mjs.map +1 -1
- package/dist/queue.d.mts +1 -1
- package/dist/queue.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -78,6 +78,7 @@ var MiddlewareFactory = class {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
// ../neko-router/dist/CompiledRoute.mjs
|
|
81
|
+
var import_neko_helper = require("@devbro/neko-helper");
|
|
81
82
|
var CompiledRoute = class {
|
|
82
83
|
static {
|
|
83
84
|
__name(this, "CompiledRoute");
|
|
@@ -98,7 +99,7 @@ var CompiledRoute = class {
|
|
|
98
99
|
for (const middleware of [...this.globalMiddlewares, ...this.route.getMiddlewares()]) {
|
|
99
100
|
if (middleware instanceof Middleware) {
|
|
100
101
|
this.middlewares.push(middleware);
|
|
101
|
-
} else if (
|
|
102
|
+
} else if ((0, import_neko_helper.isClass)(middleware)) {
|
|
102
103
|
this.middlewares.push(middleware.getInstance({}));
|
|
103
104
|
} else if (typeof middleware === "function") {
|
|
104
105
|
this.middlewares.push(MiddlewareFactory.create(middleware));
|
|
@@ -107,9 +108,6 @@ var CompiledRoute = class {
|
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
|
-
isClass(func) {
|
|
111
|
-
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
112
|
-
}
|
|
113
111
|
async run() {
|
|
114
112
|
return await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
115
113
|
}
|
|
@@ -245,7 +243,7 @@ var Route = class {
|
|
|
245
243
|
i = start;
|
|
246
244
|
} else if (char === "*") {
|
|
247
245
|
let start = i + 1;
|
|
248
|
-
while (start < path2.length && /[a-zA-Z0-9_
|
|
246
|
+
while (start < path2.length && /[a-zA-Z0-9_]/.test(path2[start])) {
|
|
249
247
|
start++;
|
|
250
248
|
}
|
|
251
249
|
tokens.push({ type: "WILDCARD", value: path2.slice(i + 1, start) });
|
|
@@ -456,7 +454,7 @@ var Router = class {
|
|
|
456
454
|
|
|
457
455
|
// src/facades.mts
|
|
458
456
|
var import_neko_scheduler = require("@devbro/neko-scheduler");
|
|
459
|
-
var
|
|
457
|
+
var import_neko_helper3 = require("@devbro/neko-helper");
|
|
460
458
|
var import_neko_context3 = require("@devbro/neko-context");
|
|
461
459
|
var import_neko_storage2 = require("@devbro/neko-storage");
|
|
462
460
|
var import_neko_mailer2 = require("@devbro/neko-mailer");
|
|
@@ -497,7 +495,7 @@ __export(queue_exports, {
|
|
|
497
495
|
DatabaseTransport: () => DatabaseTransport
|
|
498
496
|
});
|
|
499
497
|
__reExport(queue_exports, require("@devbro/neko-queue"));
|
|
500
|
-
var
|
|
498
|
+
var import_neko_helper2 = require("@devbro/neko-helper");
|
|
501
499
|
var import_neko_context2 = require("@devbro/neko-context");
|
|
502
500
|
var DatabaseTransport = class {
|
|
503
501
|
static {
|
|
@@ -558,7 +556,7 @@ var DatabaseTransport = class {
|
|
|
558
556
|
}, "processMessage");
|
|
559
557
|
constructor(config2 = {}) {
|
|
560
558
|
this.config = { ...this.config, ...config2 };
|
|
561
|
-
this.repeater = (0,
|
|
559
|
+
this.repeater = (0, import_neko_helper2.createRepeater)(
|
|
562
560
|
this.processMessage,
|
|
563
561
|
this.config.listen_interval * 1e3
|
|
564
562
|
);
|
|
@@ -626,6 +624,24 @@ import_neko_queue.QueueTransportFactory.register("database", (opt) => {
|
|
|
626
624
|
import_neko_queue.QueueTransportFactory.register("memory", (opt) => {
|
|
627
625
|
return new import_neko_queue.MemoryTransport(opt);
|
|
628
626
|
});
|
|
627
|
+
import_neko_queue.QueueTransportFactory.register("sqs", (opt) => {
|
|
628
|
+
return new import_neko_queue.AwsSqsTransport(opt);
|
|
629
|
+
});
|
|
630
|
+
import_neko_queue.QueueTransportFactory.register("amqp", (opt) => {
|
|
631
|
+
return new import_neko_queue.AmqpTransport(opt);
|
|
632
|
+
});
|
|
633
|
+
import_neko_queue.QueueTransportFactory.register("redis", (opt) => {
|
|
634
|
+
return new import_neko_queue.RedisTransport(opt);
|
|
635
|
+
});
|
|
636
|
+
import_neko_queue.QueueTransportFactory.register("async", (opt) => {
|
|
637
|
+
return new import_neko_queue.AsyncTransport();
|
|
638
|
+
});
|
|
639
|
+
import_neko_queue.QueueTransportFactory.register("azure_service_bus", (opt) => {
|
|
640
|
+
return new import_neko_queue.AzureServiceBusTransport(opt);
|
|
641
|
+
});
|
|
642
|
+
import_neko_queue.QueueTransportFactory.register("google_pubsub", (opt) => {
|
|
643
|
+
return new import_neko_queue.GooglePubSubTransport(opt);
|
|
644
|
+
});
|
|
629
645
|
var CacheProviderFactory = class _CacheProviderFactory {
|
|
630
646
|
static {
|
|
631
647
|
__name(this, "CacheProviderFactory");
|
|
@@ -656,32 +672,75 @@ import_neko_storage.StorageProviderFactory.register("local", (opt) => {
|
|
|
656
672
|
import_neko_storage.StorageProviderFactory.register("s3", (opt) => {
|
|
657
673
|
return new import_neko_storage.AWSS3StorageProvider(opt);
|
|
658
674
|
});
|
|
675
|
+
import_neko_storage.StorageProviderFactory.register("gcp", (opt) => {
|
|
676
|
+
return new import_neko_storage.GCPStorageProvider(opt);
|
|
677
|
+
});
|
|
678
|
+
import_neko_storage.StorageProviderFactory.register("azure", (opt) => {
|
|
679
|
+
return new import_neko_storage.AzureBlobStorageProvider(opt);
|
|
680
|
+
});
|
|
681
|
+
import_neko_storage.StorageProviderFactory.register("ftp", (opt) => {
|
|
682
|
+
return new import_neko_storage.FTPStorageProvider(opt);
|
|
683
|
+
});
|
|
684
|
+
import_neko_storage.StorageProviderFactory.register("sftp", (opt) => {
|
|
685
|
+
return new import_neko_storage.SFTPStorageProvider(opt);
|
|
686
|
+
});
|
|
659
687
|
|
|
660
688
|
// src/facades.mts
|
|
661
689
|
var import_neko_cache2 = require("@devbro/neko-cache");
|
|
662
690
|
var import_neko_queue2 = require("@devbro/neko-queue");
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
691
|
+
function wrapSingletonWithAccessors(singletonFn) {
|
|
692
|
+
let methodsInitialized = false;
|
|
693
|
+
const initializeMethods = /* @__PURE__ */ __name(() => {
|
|
694
|
+
if (methodsInitialized) return;
|
|
695
|
+
const defaultInstance = singletonFn();
|
|
696
|
+
const prototype = Object.getPrototypeOf(defaultInstance);
|
|
697
|
+
const methodNames = Object.getOwnPropertyNames(prototype).filter(
|
|
698
|
+
(name) => name !== "constructor" && typeof prototype[name] === "function"
|
|
699
|
+
);
|
|
700
|
+
for (const methodName of methodNames) {
|
|
701
|
+
singletonFn[methodName] = (...args) => {
|
|
702
|
+
const instance = singletonFn();
|
|
703
|
+
return instance[methodName](...args);
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
methodsInitialized = true;
|
|
707
|
+
}, "initializeMethods");
|
|
708
|
+
return new Proxy(singletonFn, {
|
|
709
|
+
get(target, prop, receiver) {
|
|
710
|
+
if (typeof prop === "string" && !Reflect.has(target, prop)) {
|
|
711
|
+
initializeMethods();
|
|
712
|
+
}
|
|
713
|
+
return Reflect.get(target, prop, receiver);
|
|
714
|
+
}
|
|
672
715
|
});
|
|
673
|
-
|
|
674
|
-
|
|
716
|
+
}
|
|
717
|
+
__name(wrapSingletonWithAccessors, "wrapSingletonWithAccessors");
|
|
718
|
+
var router = (0, import_neko_helper3.createSingleton)(() => new Router());
|
|
719
|
+
var scheduler = wrapSingletonWithAccessors(
|
|
720
|
+
(0, import_neko_helper3.createSingleton)(() => {
|
|
721
|
+
const rc = new import_neko_scheduler.Scheduler();
|
|
722
|
+
rc.setErrorHandler((err, job) => {
|
|
723
|
+
logger().error({
|
|
724
|
+
msg: "Scheduled job error",
|
|
725
|
+
err,
|
|
726
|
+
job_name: job.getName()
|
|
727
|
+
});
|
|
728
|
+
});
|
|
729
|
+
return rc;
|
|
730
|
+
})
|
|
731
|
+
);
|
|
675
732
|
var db = /* @__PURE__ */ __name((label = "default") => (0, import_neko_context3.ctx)().getOrThrow(["database", label]), "db");
|
|
676
|
-
var storage = (
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
733
|
+
var storage = wrapSingletonWithAccessors(
|
|
734
|
+
(0, import_neko_helper3.createSingleton)((label = "default") => {
|
|
735
|
+
let storage_config = import_neko_config.config.get(["storages", label].join("."));
|
|
736
|
+
const provider = import_neko_storage2.StorageProviderFactory.create(
|
|
737
|
+
storage_config.provider,
|
|
738
|
+
storage_config.config
|
|
739
|
+
);
|
|
740
|
+
return new import_neko_storage2.Storage(provider);
|
|
741
|
+
})
|
|
742
|
+
);
|
|
743
|
+
var cli = (0, import_neko_helper3.createSingleton)(() => {
|
|
685
744
|
const [node, app, ...args] = process.argv;
|
|
686
745
|
return new import_clipanion.Cli({
|
|
687
746
|
binaryLabel: `My Application`,
|
|
@@ -689,52 +748,60 @@ var cli = (0, import_neko_helper2.createSingleton)(() => {
|
|
|
689
748
|
binaryVersion: `1.0.0`
|
|
690
749
|
});
|
|
691
750
|
});
|
|
692
|
-
var httpServer = (0,
|
|
751
|
+
var httpServer = (0, import_neko_helper3.createSingleton)(() => {
|
|
693
752
|
const server = new http_exports.HttpServer();
|
|
694
753
|
server.setErrorHandler(handleHttpErrors);
|
|
695
754
|
server.setRouter(router());
|
|
696
755
|
return server;
|
|
697
756
|
});
|
|
698
|
-
var logger = (
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
mailer_config.config
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
queue_config.
|
|
723
|
-
queue_config
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
});
|
|
757
|
+
var logger = wrapSingletonWithAccessors(
|
|
758
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
759
|
+
const logger_config = import_neko_config.config.get(["loggers", label].join("."));
|
|
760
|
+
const rc = new import_neko_logger.Logger(logger_config);
|
|
761
|
+
rc.setExtrasFunction((message) => {
|
|
762
|
+
message.requestId = (0, import_neko_context3.ctxSafe)()?.get("requestId") || "N/A";
|
|
763
|
+
return message;
|
|
764
|
+
});
|
|
765
|
+
return rc;
|
|
766
|
+
})
|
|
767
|
+
);
|
|
768
|
+
var mailer = wrapSingletonWithAccessors(
|
|
769
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
770
|
+
const mailer_config = import_neko_config.config.get(["mailer", label].join("."));
|
|
771
|
+
const provider = import_neko_mailer2.MailerProviderFactory.create(
|
|
772
|
+
mailer_config.provider,
|
|
773
|
+
mailer_config.config
|
|
774
|
+
);
|
|
775
|
+
const rc = new import_neko_mailer2.Mailer(provider);
|
|
776
|
+
return rc;
|
|
777
|
+
})
|
|
778
|
+
);
|
|
779
|
+
var queue = wrapSingletonWithAccessors(
|
|
780
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
781
|
+
const queue_config = import_neko_config.config.get(["queues", label].join("."));
|
|
782
|
+
if (!queue_config) {
|
|
783
|
+
throw new Error(`Queue configuration for '${label}' not found`);
|
|
784
|
+
}
|
|
785
|
+
const provider = import_neko_queue2.QueueTransportFactory.create(
|
|
786
|
+
queue_config.provider,
|
|
787
|
+
queue_config.config
|
|
788
|
+
);
|
|
789
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
790
|
+
})
|
|
791
|
+
);
|
|
792
|
+
var cache = wrapSingletonWithAccessors(
|
|
793
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
794
|
+
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
795
|
+
if (!cache_config) {
|
|
796
|
+
throw new Error(`Cache configuration for '${label}' not found`);
|
|
797
|
+
}
|
|
798
|
+
const provider = CacheProviderFactory.create(
|
|
799
|
+
cache_config.provider,
|
|
800
|
+
cache_config.config
|
|
801
|
+
);
|
|
802
|
+
return new import_neko_cache2.Cache(provider);
|
|
803
|
+
})
|
|
804
|
+
);
|
|
738
805
|
|
|
739
806
|
// src/app/console/DefaultCommand.mts
|
|
740
807
|
var DefaultCommand = class extends import_clipanion2.Command {
|
|
@@ -81,6 +81,7 @@ var MiddlewareFactory = class {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
// ../neko-router/dist/CompiledRoute.mjs
|
|
84
|
+
var import_neko_helper = require("@devbro/neko-helper");
|
|
84
85
|
var CompiledRoute = class {
|
|
85
86
|
static {
|
|
86
87
|
__name(this, "CompiledRoute");
|
|
@@ -101,7 +102,7 @@ var CompiledRoute = class {
|
|
|
101
102
|
for (const middleware of [...this.globalMiddlewares, ...this.route.getMiddlewares()]) {
|
|
102
103
|
if (middleware instanceof Middleware) {
|
|
103
104
|
this.middlewares.push(middleware);
|
|
104
|
-
} else if (
|
|
105
|
+
} else if ((0, import_neko_helper.isClass)(middleware)) {
|
|
105
106
|
this.middlewares.push(middleware.getInstance({}));
|
|
106
107
|
} else if (typeof middleware === "function") {
|
|
107
108
|
this.middlewares.push(MiddlewareFactory.create(middleware));
|
|
@@ -110,9 +111,6 @@ var CompiledRoute = class {
|
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
|
-
isClass(func) {
|
|
114
|
-
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
115
|
-
}
|
|
116
114
|
async run() {
|
|
117
115
|
return await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
118
116
|
}
|
|
@@ -248,7 +246,7 @@ var Route = class {
|
|
|
248
246
|
i = start;
|
|
249
247
|
} else if (char === "*") {
|
|
250
248
|
let start = i + 1;
|
|
251
|
-
while (start < path3.length && /[a-zA-Z0-9_
|
|
249
|
+
while (start < path3.length && /[a-zA-Z0-9_]/.test(path3[start])) {
|
|
252
250
|
start++;
|
|
253
251
|
}
|
|
254
252
|
tokens.push({ type: "WILDCARD", value: path3.slice(i + 1, start) });
|
|
@@ -459,7 +457,7 @@ var Router = class {
|
|
|
459
457
|
|
|
460
458
|
// src/facades.mts
|
|
461
459
|
var import_neko_scheduler = require("@devbro/neko-scheduler");
|
|
462
|
-
var
|
|
460
|
+
var import_neko_helper3 = require("@devbro/neko-helper");
|
|
463
461
|
var import_neko_context3 = require("@devbro/neko-context");
|
|
464
462
|
var import_neko_storage2 = require("@devbro/neko-storage");
|
|
465
463
|
var import_neko_mailer2 = require("@devbro/neko-mailer");
|
|
@@ -500,7 +498,7 @@ __export(queue_exports, {
|
|
|
500
498
|
DatabaseTransport: () => DatabaseTransport
|
|
501
499
|
});
|
|
502
500
|
__reExport(queue_exports, require("@devbro/neko-queue"));
|
|
503
|
-
var
|
|
501
|
+
var import_neko_helper2 = require("@devbro/neko-helper");
|
|
504
502
|
var import_neko_context2 = require("@devbro/neko-context");
|
|
505
503
|
var DatabaseTransport = class {
|
|
506
504
|
static {
|
|
@@ -561,7 +559,7 @@ var DatabaseTransport = class {
|
|
|
561
559
|
}, "processMessage");
|
|
562
560
|
constructor(config2 = {}) {
|
|
563
561
|
this.config = { ...this.config, ...config2 };
|
|
564
|
-
this.repeater = (0,
|
|
562
|
+
this.repeater = (0, import_neko_helper2.createRepeater)(
|
|
565
563
|
this.processMessage,
|
|
566
564
|
this.config.listen_interval * 1e3
|
|
567
565
|
);
|
|
@@ -629,6 +627,24 @@ import_neko_queue.QueueTransportFactory.register("database", (opt) => {
|
|
|
629
627
|
import_neko_queue.QueueTransportFactory.register("memory", (opt) => {
|
|
630
628
|
return new import_neko_queue.MemoryTransport(opt);
|
|
631
629
|
});
|
|
630
|
+
import_neko_queue.QueueTransportFactory.register("sqs", (opt) => {
|
|
631
|
+
return new import_neko_queue.AwsSqsTransport(opt);
|
|
632
|
+
});
|
|
633
|
+
import_neko_queue.QueueTransportFactory.register("amqp", (opt) => {
|
|
634
|
+
return new import_neko_queue.AmqpTransport(opt);
|
|
635
|
+
});
|
|
636
|
+
import_neko_queue.QueueTransportFactory.register("redis", (opt) => {
|
|
637
|
+
return new import_neko_queue.RedisTransport(opt);
|
|
638
|
+
});
|
|
639
|
+
import_neko_queue.QueueTransportFactory.register("async", (opt) => {
|
|
640
|
+
return new import_neko_queue.AsyncTransport();
|
|
641
|
+
});
|
|
642
|
+
import_neko_queue.QueueTransportFactory.register("azure_service_bus", (opt) => {
|
|
643
|
+
return new import_neko_queue.AzureServiceBusTransport(opt);
|
|
644
|
+
});
|
|
645
|
+
import_neko_queue.QueueTransportFactory.register("google_pubsub", (opt) => {
|
|
646
|
+
return new import_neko_queue.GooglePubSubTransport(opt);
|
|
647
|
+
});
|
|
632
648
|
var CacheProviderFactory = class _CacheProviderFactory {
|
|
633
649
|
static {
|
|
634
650
|
__name(this, "CacheProviderFactory");
|
|
@@ -659,32 +675,75 @@ import_neko_storage.StorageProviderFactory.register("local", (opt) => {
|
|
|
659
675
|
import_neko_storage.StorageProviderFactory.register("s3", (opt) => {
|
|
660
676
|
return new import_neko_storage.AWSS3StorageProvider(opt);
|
|
661
677
|
});
|
|
678
|
+
import_neko_storage.StorageProviderFactory.register("gcp", (opt) => {
|
|
679
|
+
return new import_neko_storage.GCPStorageProvider(opt);
|
|
680
|
+
});
|
|
681
|
+
import_neko_storage.StorageProviderFactory.register("azure", (opt) => {
|
|
682
|
+
return new import_neko_storage.AzureBlobStorageProvider(opt);
|
|
683
|
+
});
|
|
684
|
+
import_neko_storage.StorageProviderFactory.register("ftp", (opt) => {
|
|
685
|
+
return new import_neko_storage.FTPStorageProvider(opt);
|
|
686
|
+
});
|
|
687
|
+
import_neko_storage.StorageProviderFactory.register("sftp", (opt) => {
|
|
688
|
+
return new import_neko_storage.SFTPStorageProvider(opt);
|
|
689
|
+
});
|
|
662
690
|
|
|
663
691
|
// src/facades.mts
|
|
664
692
|
var import_neko_cache2 = require("@devbro/neko-cache");
|
|
665
693
|
var import_neko_queue2 = require("@devbro/neko-queue");
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
694
|
+
function wrapSingletonWithAccessors(singletonFn) {
|
|
695
|
+
let methodsInitialized = false;
|
|
696
|
+
const initializeMethods = /* @__PURE__ */ __name(() => {
|
|
697
|
+
if (methodsInitialized) return;
|
|
698
|
+
const defaultInstance = singletonFn();
|
|
699
|
+
const prototype = Object.getPrototypeOf(defaultInstance);
|
|
700
|
+
const methodNames = Object.getOwnPropertyNames(prototype).filter(
|
|
701
|
+
(name) => name !== "constructor" && typeof prototype[name] === "function"
|
|
702
|
+
);
|
|
703
|
+
for (const methodName of methodNames) {
|
|
704
|
+
singletonFn[methodName] = (...args) => {
|
|
705
|
+
const instance = singletonFn();
|
|
706
|
+
return instance[methodName](...args);
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
methodsInitialized = true;
|
|
710
|
+
}, "initializeMethods");
|
|
711
|
+
return new Proxy(singletonFn, {
|
|
712
|
+
get(target, prop, receiver) {
|
|
713
|
+
if (typeof prop === "string" && !Reflect.has(target, prop)) {
|
|
714
|
+
initializeMethods();
|
|
715
|
+
}
|
|
716
|
+
return Reflect.get(target, prop, receiver);
|
|
717
|
+
}
|
|
675
718
|
});
|
|
676
|
-
|
|
677
|
-
|
|
719
|
+
}
|
|
720
|
+
__name(wrapSingletonWithAccessors, "wrapSingletonWithAccessors");
|
|
721
|
+
var router = (0, import_neko_helper3.createSingleton)(() => new Router());
|
|
722
|
+
var scheduler = wrapSingletonWithAccessors(
|
|
723
|
+
(0, import_neko_helper3.createSingleton)(() => {
|
|
724
|
+
const rc = new import_neko_scheduler.Scheduler();
|
|
725
|
+
rc.setErrorHandler((err, job) => {
|
|
726
|
+
logger().error({
|
|
727
|
+
msg: "Scheduled job error",
|
|
728
|
+
err,
|
|
729
|
+
job_name: job.getName()
|
|
730
|
+
});
|
|
731
|
+
});
|
|
732
|
+
return rc;
|
|
733
|
+
})
|
|
734
|
+
);
|
|
678
735
|
var db = /* @__PURE__ */ __name((label = "default") => (0, import_neko_context3.ctx)().getOrThrow(["database", label]), "db");
|
|
679
|
-
var storage = (
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
736
|
+
var storage = wrapSingletonWithAccessors(
|
|
737
|
+
(0, import_neko_helper3.createSingleton)((label = "default") => {
|
|
738
|
+
let storage_config = import_neko_config.config.get(["storages", label].join("."));
|
|
739
|
+
const provider = import_neko_storage2.StorageProviderFactory.create(
|
|
740
|
+
storage_config.provider,
|
|
741
|
+
storage_config.config
|
|
742
|
+
);
|
|
743
|
+
return new import_neko_storage2.Storage(provider);
|
|
744
|
+
})
|
|
745
|
+
);
|
|
746
|
+
var cli = (0, import_neko_helper3.createSingleton)(() => {
|
|
688
747
|
const [node, app, ...args] = process.argv;
|
|
689
748
|
return new import_clipanion.Cli({
|
|
690
749
|
binaryLabel: `My Application`,
|
|
@@ -692,52 +751,60 @@ var cli = (0, import_neko_helper2.createSingleton)(() => {
|
|
|
692
751
|
binaryVersion: `1.0.0`
|
|
693
752
|
});
|
|
694
753
|
});
|
|
695
|
-
var httpServer = (0,
|
|
754
|
+
var httpServer = (0, import_neko_helper3.createSingleton)(() => {
|
|
696
755
|
const server = new http_exports.HttpServer();
|
|
697
756
|
server.setErrorHandler(handleHttpErrors);
|
|
698
757
|
server.setRouter(router());
|
|
699
758
|
return server;
|
|
700
759
|
});
|
|
701
|
-
var logger = (
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
mailer_config.config
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
queue_config.
|
|
726
|
-
queue_config
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
});
|
|
760
|
+
var logger = wrapSingletonWithAccessors(
|
|
761
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
762
|
+
const logger_config = import_neko_config.config.get(["loggers", label].join("."));
|
|
763
|
+
const rc = new import_neko_logger.Logger(logger_config);
|
|
764
|
+
rc.setExtrasFunction((message) => {
|
|
765
|
+
message.requestId = (0, import_neko_context3.ctxSafe)()?.get("requestId") || "N/A";
|
|
766
|
+
return message;
|
|
767
|
+
});
|
|
768
|
+
return rc;
|
|
769
|
+
})
|
|
770
|
+
);
|
|
771
|
+
var mailer = wrapSingletonWithAccessors(
|
|
772
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
773
|
+
const mailer_config = import_neko_config.config.get(["mailer", label].join("."));
|
|
774
|
+
const provider = import_neko_mailer2.MailerProviderFactory.create(
|
|
775
|
+
mailer_config.provider,
|
|
776
|
+
mailer_config.config
|
|
777
|
+
);
|
|
778
|
+
const rc = new import_neko_mailer2.Mailer(provider);
|
|
779
|
+
return rc;
|
|
780
|
+
})
|
|
781
|
+
);
|
|
782
|
+
var queue = wrapSingletonWithAccessors(
|
|
783
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
784
|
+
const queue_config = import_neko_config.config.get(["queues", label].join("."));
|
|
785
|
+
if (!queue_config) {
|
|
786
|
+
throw new Error(`Queue configuration for '${label}' not found`);
|
|
787
|
+
}
|
|
788
|
+
const provider = import_neko_queue2.QueueTransportFactory.create(
|
|
789
|
+
queue_config.provider,
|
|
790
|
+
queue_config.config
|
|
791
|
+
);
|
|
792
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
793
|
+
})
|
|
794
|
+
);
|
|
795
|
+
var cache = wrapSingletonWithAccessors(
|
|
796
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
797
|
+
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
798
|
+
if (!cache_config) {
|
|
799
|
+
throw new Error(`Cache configuration for '${label}' not found`);
|
|
800
|
+
}
|
|
801
|
+
const provider = CacheProviderFactory.create(
|
|
802
|
+
cache_config.provider,
|
|
803
|
+
cache_config.config
|
|
804
|
+
);
|
|
805
|
+
return new import_neko_cache2.Cache(provider);
|
|
806
|
+
})
|
|
807
|
+
);
|
|
741
808
|
|
|
742
809
|
// src/app/console/KeyGenerateCommand.mts
|
|
743
810
|
var KeyGenerateCommand = class extends import_clipanion2.Command {
|