@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
|
@@ -688,27 +688,58 @@ import_neko_storage.StorageProviderFactory.register("sftp", (opt) => {
|
|
|
688
688
|
// src/facades.mts
|
|
689
689
|
var import_neko_cache2 = require("@devbro/neko-cache");
|
|
690
690
|
var import_neko_queue2 = require("@devbro/neko-queue");
|
|
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
|
+
}
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
__name(wrapSingletonWithAccessors, "wrapSingletonWithAccessors");
|
|
691
718
|
var router = (0, import_neko_helper3.createSingleton)(() => new Router());
|
|
692
|
-
var scheduler = (
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
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
|
+
});
|
|
699
728
|
});
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
729
|
+
return rc;
|
|
730
|
+
})
|
|
731
|
+
);
|
|
703
732
|
var db = /* @__PURE__ */ __name((label = "default") => (0, import_neko_context3.ctx)().getOrThrow(["database", label]), "db");
|
|
704
|
-
var storage = (
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
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
|
+
);
|
|
712
743
|
var cli = (0, import_neko_helper3.createSingleton)(() => {
|
|
713
744
|
const [node, app, ...args] = process.argv;
|
|
714
745
|
return new import_clipanion.Cli({
|
|
@@ -723,46 +754,54 @@ var httpServer = (0, import_neko_helper3.createSingleton)(() => {
|
|
|
723
754
|
server.setRouter(router());
|
|
724
755
|
return server;
|
|
725
756
|
});
|
|
726
|
-
var logger = (
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
mailer_config.config
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
queue_config.
|
|
751
|
-
queue_config
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
});
|
|
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
|
+
);
|
|
766
805
|
|
|
767
806
|
// src/app/console/generate/GenerateControllerCommand.mts
|
|
768
807
|
var import_clipanion2 = require("clipanion");
|
|
@@ -832,7 +871,7 @@ var GenerateApiDocsCommand = class extends import_clipanion3.Command {
|
|
|
832
871
|
static {
|
|
833
872
|
__name(this, "GenerateApiDocsCommand");
|
|
834
873
|
}
|
|
835
|
-
static paths = [[`generate`, `
|
|
874
|
+
static paths = [[`generate`, `apidocs`]];
|
|
836
875
|
static usage = import_clipanion3.Command.Usage({
|
|
837
876
|
category: `Generate`,
|
|
838
877
|
description: `Generate OpenAPI documentation from routes`,
|
|
@@ -872,14 +911,14 @@ api_docs: {
|
|
|
872
911
|
examples: [
|
|
873
912
|
[
|
|
874
913
|
`Generate from routes`,
|
|
875
|
-
`$0 generate
|
|
914
|
+
`$0 generate apidocs generate-from-routes --output path/to/output.json`
|
|
876
915
|
],
|
|
877
916
|
[
|
|
878
917
|
`Generate base spec`,
|
|
879
|
-
`$0 generate
|
|
918
|
+
`$0 generate apidocs generate-base --output path/to/output.json`
|
|
880
919
|
],
|
|
881
|
-
[`Merge files`, `$0 generate
|
|
882
|
-
[`Show help`, `$0 generate
|
|
920
|
+
[`Merge files`, `$0 generate apidocs merge-files`],
|
|
921
|
+
[`Show help`, `$0 generate apidocs --help`]
|
|
883
922
|
]
|
|
884
923
|
});
|
|
885
924
|
subcommand = import_clipanion3.Option.String({ required: false });
|
|
@@ -1851,27 +1851,58 @@ import_neko_storage.StorageProviderFactory.register("sftp", (opt) => {
|
|
|
1851
1851
|
// src/facades.mts
|
|
1852
1852
|
var import_neko_cache2 = require("@devbro/neko-cache");
|
|
1853
1853
|
var import_neko_queue2 = require("@devbro/neko-queue");
|
|
1854
|
+
function wrapSingletonWithAccessors(singletonFn) {
|
|
1855
|
+
let methodsInitialized = false;
|
|
1856
|
+
const initializeMethods = /* @__PURE__ */ __name(() => {
|
|
1857
|
+
if (methodsInitialized) return;
|
|
1858
|
+
const defaultInstance = singletonFn();
|
|
1859
|
+
const prototype = Object.getPrototypeOf(defaultInstance);
|
|
1860
|
+
const methodNames = Object.getOwnPropertyNames(prototype).filter(
|
|
1861
|
+
(name) => name !== "constructor" && typeof prototype[name] === "function"
|
|
1862
|
+
);
|
|
1863
|
+
for (const methodName of methodNames) {
|
|
1864
|
+
singletonFn[methodName] = (...args) => {
|
|
1865
|
+
const instance = singletonFn();
|
|
1866
|
+
return instance[methodName](...args);
|
|
1867
|
+
};
|
|
1868
|
+
}
|
|
1869
|
+
methodsInitialized = true;
|
|
1870
|
+
}, "initializeMethods");
|
|
1871
|
+
return new Proxy(singletonFn, {
|
|
1872
|
+
get(target, prop, receiver) {
|
|
1873
|
+
if (typeof prop === "string" && !Reflect.has(target, prop)) {
|
|
1874
|
+
initializeMethods();
|
|
1875
|
+
}
|
|
1876
|
+
return Reflect.get(target, prop, receiver);
|
|
1877
|
+
}
|
|
1878
|
+
});
|
|
1879
|
+
}
|
|
1880
|
+
__name(wrapSingletonWithAccessors, "wrapSingletonWithAccessors");
|
|
1854
1881
|
var router = (0, import_neko_helper3.createSingleton)(() => new Router());
|
|
1855
|
-
var scheduler = (
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1882
|
+
var scheduler = wrapSingletonWithAccessors(
|
|
1883
|
+
(0, import_neko_helper3.createSingleton)(() => {
|
|
1884
|
+
const rc = new import_neko_scheduler.Scheduler();
|
|
1885
|
+
rc.setErrorHandler((err, job) => {
|
|
1886
|
+
logger().error({
|
|
1887
|
+
msg: "Scheduled job error",
|
|
1888
|
+
err,
|
|
1889
|
+
job_name: job.getName()
|
|
1890
|
+
});
|
|
1862
1891
|
});
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1892
|
+
return rc;
|
|
1893
|
+
})
|
|
1894
|
+
);
|
|
1866
1895
|
var db = /* @__PURE__ */ __name((label = "default") => (0, import_neko_context3.ctx)().getOrThrow(["database", label]), "db");
|
|
1867
|
-
var storage = (
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1896
|
+
var storage = wrapSingletonWithAccessors(
|
|
1897
|
+
(0, import_neko_helper3.createSingleton)((label = "default") => {
|
|
1898
|
+
let storage_config = import_neko_config.config.get(["storages", label].join("."));
|
|
1899
|
+
const provider = import_neko_storage2.StorageProviderFactory.create(
|
|
1900
|
+
storage_config.provider,
|
|
1901
|
+
storage_config.config
|
|
1902
|
+
);
|
|
1903
|
+
return new import_neko_storage2.Storage(provider);
|
|
1904
|
+
})
|
|
1905
|
+
);
|
|
1875
1906
|
var cli = (0, import_neko_helper3.createSingleton)(() => {
|
|
1876
1907
|
const [node, app, ...args] = process.argv;
|
|
1877
1908
|
return new import_clipanion.Cli({
|
|
@@ -1886,46 +1917,54 @@ var httpServer = (0, import_neko_helper3.createSingleton)(() => {
|
|
|
1886
1917
|
server.setRouter(router());
|
|
1887
1918
|
return server;
|
|
1888
1919
|
});
|
|
1889
|
-
var logger = (
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
mailer_config.config
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
queue_config.
|
|
1914
|
-
queue_config
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
}
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
});
|
|
1920
|
+
var logger = wrapSingletonWithAccessors(
|
|
1921
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
1922
|
+
const logger_config = import_neko_config.config.get(["loggers", label].join("."));
|
|
1923
|
+
const rc = new import_neko_logger.Logger(logger_config);
|
|
1924
|
+
rc.setExtrasFunction((message) => {
|
|
1925
|
+
message.requestId = (0, import_neko_context3.ctxSafe)()?.get("requestId") || "N/A";
|
|
1926
|
+
return message;
|
|
1927
|
+
});
|
|
1928
|
+
return rc;
|
|
1929
|
+
})
|
|
1930
|
+
);
|
|
1931
|
+
var mailer = wrapSingletonWithAccessors(
|
|
1932
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
1933
|
+
const mailer_config = import_neko_config.config.get(["mailer", label].join("."));
|
|
1934
|
+
const provider = import_neko_mailer2.MailerProviderFactory.create(
|
|
1935
|
+
mailer_config.provider,
|
|
1936
|
+
mailer_config.config
|
|
1937
|
+
);
|
|
1938
|
+
const rc = new import_neko_mailer2.Mailer(provider);
|
|
1939
|
+
return rc;
|
|
1940
|
+
})
|
|
1941
|
+
);
|
|
1942
|
+
var queue = wrapSingletonWithAccessors(
|
|
1943
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
1944
|
+
const queue_config = import_neko_config.config.get(["queues", label].join("."));
|
|
1945
|
+
if (!queue_config) {
|
|
1946
|
+
throw new Error(`Queue configuration for '${label}' not found`);
|
|
1947
|
+
}
|
|
1948
|
+
const provider = import_neko_queue2.QueueTransportFactory.create(
|
|
1949
|
+
queue_config.provider,
|
|
1950
|
+
queue_config.config
|
|
1951
|
+
);
|
|
1952
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
1953
|
+
})
|
|
1954
|
+
);
|
|
1955
|
+
var cache = wrapSingletonWithAccessors(
|
|
1956
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
1957
|
+
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
1958
|
+
if (!cache_config) {
|
|
1959
|
+
throw new Error(`Cache configuration for '${label}' not found`);
|
|
1960
|
+
}
|
|
1961
|
+
const provider = CacheProviderFactory.create(
|
|
1962
|
+
cache_config.provider,
|
|
1963
|
+
cache_config.config
|
|
1964
|
+
);
|
|
1965
|
+
return new import_neko_cache2.Cache(provider);
|
|
1966
|
+
})
|
|
1967
|
+
);
|
|
1929
1968
|
|
|
1930
1969
|
// src/app/console/migrate/MigrateCommand.mts
|
|
1931
1970
|
var import_clipanion2 = require("clipanion");
|
|
@@ -2361,7 +2400,7 @@ var GenerateApiDocsCommand = class extends import_clipanion9.Command {
|
|
|
2361
2400
|
static {
|
|
2362
2401
|
__name(this, "GenerateApiDocsCommand");
|
|
2363
2402
|
}
|
|
2364
|
-
static paths = [[`generate`, `
|
|
2403
|
+
static paths = [[`generate`, `apidocs`]];
|
|
2365
2404
|
static usage = import_clipanion9.Command.Usage({
|
|
2366
2405
|
category: `Generate`,
|
|
2367
2406
|
description: `Generate OpenAPI documentation from routes`,
|
|
@@ -2401,14 +2440,14 @@ api_docs: {
|
|
|
2401
2440
|
examples: [
|
|
2402
2441
|
[
|
|
2403
2442
|
`Generate from routes`,
|
|
2404
|
-
`$0 generate
|
|
2443
|
+
`$0 generate apidocs generate-from-routes --output path/to/output.json`
|
|
2405
2444
|
],
|
|
2406
2445
|
[
|
|
2407
2446
|
`Generate base spec`,
|
|
2408
|
-
`$0 generate
|
|
2447
|
+
`$0 generate apidocs generate-base --output path/to/output.json`
|
|
2409
2448
|
],
|
|
2410
|
-
[`Merge files`, `$0 generate
|
|
2411
|
-
[`Show help`, `$0 generate
|
|
2449
|
+
[`Merge files`, `$0 generate apidocs merge-files`],
|
|
2450
|
+
[`Show help`, `$0 generate apidocs --help`]
|
|
2412
2451
|
]
|
|
2413
2452
|
});
|
|
2414
2453
|
subcommand = import_clipanion9.Option.String({ required: false });
|
|
@@ -687,27 +687,58 @@ import_neko_storage.StorageProviderFactory.register("sftp", (opt) => {
|
|
|
687
687
|
// src/facades.mts
|
|
688
688
|
var import_neko_cache2 = require("@devbro/neko-cache");
|
|
689
689
|
var import_neko_queue2 = require("@devbro/neko-queue");
|
|
690
|
+
function wrapSingletonWithAccessors(singletonFn) {
|
|
691
|
+
let methodsInitialized = false;
|
|
692
|
+
const initializeMethods = /* @__PURE__ */ __name(() => {
|
|
693
|
+
if (methodsInitialized) return;
|
|
694
|
+
const defaultInstance = singletonFn();
|
|
695
|
+
const prototype = Object.getPrototypeOf(defaultInstance);
|
|
696
|
+
const methodNames = Object.getOwnPropertyNames(prototype).filter(
|
|
697
|
+
(name) => name !== "constructor" && typeof prototype[name] === "function"
|
|
698
|
+
);
|
|
699
|
+
for (const methodName of methodNames) {
|
|
700
|
+
singletonFn[methodName] = (...args) => {
|
|
701
|
+
const instance = singletonFn();
|
|
702
|
+
return instance[methodName](...args);
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
methodsInitialized = true;
|
|
706
|
+
}, "initializeMethods");
|
|
707
|
+
return new Proxy(singletonFn, {
|
|
708
|
+
get(target, prop, receiver) {
|
|
709
|
+
if (typeof prop === "string" && !Reflect.has(target, prop)) {
|
|
710
|
+
initializeMethods();
|
|
711
|
+
}
|
|
712
|
+
return Reflect.get(target, prop, receiver);
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
__name(wrapSingletonWithAccessors, "wrapSingletonWithAccessors");
|
|
690
717
|
var router = (0, import_neko_helper3.createSingleton)(() => new Router());
|
|
691
|
-
var scheduler = (
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
718
|
+
var scheduler = wrapSingletonWithAccessors(
|
|
719
|
+
(0, import_neko_helper3.createSingleton)(() => {
|
|
720
|
+
const rc = new import_neko_scheduler.Scheduler();
|
|
721
|
+
rc.setErrorHandler((err, job) => {
|
|
722
|
+
logger().error({
|
|
723
|
+
msg: "Scheduled job error",
|
|
724
|
+
err,
|
|
725
|
+
job_name: job.getName()
|
|
726
|
+
});
|
|
698
727
|
});
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
728
|
+
return rc;
|
|
729
|
+
})
|
|
730
|
+
);
|
|
702
731
|
var db = /* @__PURE__ */ __name((label = "default") => (0, import_neko_context3.ctx)().getOrThrow(["database", label]), "db");
|
|
703
|
-
var storage = (
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
732
|
+
var storage = wrapSingletonWithAccessors(
|
|
733
|
+
(0, import_neko_helper3.createSingleton)((label = "default") => {
|
|
734
|
+
let storage_config = import_neko_config.config.get(["storages", label].join("."));
|
|
735
|
+
const provider = import_neko_storage2.StorageProviderFactory.create(
|
|
736
|
+
storage_config.provider,
|
|
737
|
+
storage_config.config
|
|
738
|
+
);
|
|
739
|
+
return new import_neko_storage2.Storage(provider);
|
|
740
|
+
})
|
|
741
|
+
);
|
|
711
742
|
var cli = (0, import_neko_helper3.createSingleton)(() => {
|
|
712
743
|
const [node, app, ...args] = process.argv;
|
|
713
744
|
return new import_clipanion.Cli({
|
|
@@ -722,46 +753,54 @@ var httpServer = (0, import_neko_helper3.createSingleton)(() => {
|
|
|
722
753
|
server.setRouter(router());
|
|
723
754
|
return server;
|
|
724
755
|
});
|
|
725
|
-
var logger = (
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
mailer_config.config
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
queue_config.
|
|
750
|
-
queue_config
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
});
|
|
756
|
+
var logger = wrapSingletonWithAccessors(
|
|
757
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
758
|
+
const logger_config = import_neko_config.config.get(["loggers", label].join("."));
|
|
759
|
+
const rc = new import_neko_logger.Logger(logger_config);
|
|
760
|
+
rc.setExtrasFunction((message) => {
|
|
761
|
+
message.requestId = (0, import_neko_context3.ctxSafe)()?.get("requestId") || "N/A";
|
|
762
|
+
return message;
|
|
763
|
+
});
|
|
764
|
+
return rc;
|
|
765
|
+
})
|
|
766
|
+
);
|
|
767
|
+
var mailer = wrapSingletonWithAccessors(
|
|
768
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
769
|
+
const mailer_config = import_neko_config.config.get(["mailer", label].join("."));
|
|
770
|
+
const provider = import_neko_mailer2.MailerProviderFactory.create(
|
|
771
|
+
mailer_config.provider,
|
|
772
|
+
mailer_config.config
|
|
773
|
+
);
|
|
774
|
+
const rc = new import_neko_mailer2.Mailer(provider);
|
|
775
|
+
return rc;
|
|
776
|
+
})
|
|
777
|
+
);
|
|
778
|
+
var queue = wrapSingletonWithAccessors(
|
|
779
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
780
|
+
const queue_config = import_neko_config.config.get(["queues", label].join("."));
|
|
781
|
+
if (!queue_config) {
|
|
782
|
+
throw new Error(`Queue configuration for '${label}' not found`);
|
|
783
|
+
}
|
|
784
|
+
const provider = import_neko_queue2.QueueTransportFactory.create(
|
|
785
|
+
queue_config.provider,
|
|
786
|
+
queue_config.config
|
|
787
|
+
);
|
|
788
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
789
|
+
})
|
|
790
|
+
);
|
|
791
|
+
var cache = wrapSingletonWithAccessors(
|
|
792
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
793
|
+
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
794
|
+
if (!cache_config) {
|
|
795
|
+
throw new Error(`Cache configuration for '${label}' not found`);
|
|
796
|
+
}
|
|
797
|
+
const provider = CacheProviderFactory.create(
|
|
798
|
+
cache_config.provider,
|
|
799
|
+
cache_config.config
|
|
800
|
+
);
|
|
801
|
+
return new import_neko_cache2.Cache(provider);
|
|
802
|
+
})
|
|
803
|
+
);
|
|
765
804
|
|
|
766
805
|
// src/app/console/migrate/GenerateMigrateCommand.mts
|
|
767
806
|
var import_clipanion2 = require("clipanion");
|