@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
|
@@ -1232,6 +1232,7 @@ var MiddlewareFactory = class {
|
|
|
1232
1232
|
};
|
|
1233
1233
|
|
|
1234
1234
|
// ../neko-router/dist/CompiledRoute.mjs
|
|
1235
|
+
var import_neko_helper = require("@devbro/neko-helper");
|
|
1235
1236
|
var CompiledRoute = class {
|
|
1236
1237
|
static {
|
|
1237
1238
|
__name(this, "CompiledRoute");
|
|
@@ -1252,7 +1253,7 @@ var CompiledRoute = class {
|
|
|
1252
1253
|
for (const middleware of [...this.globalMiddlewares, ...this.route.getMiddlewares()]) {
|
|
1253
1254
|
if (middleware instanceof Middleware) {
|
|
1254
1255
|
this.middlewares.push(middleware);
|
|
1255
|
-
} else if (
|
|
1256
|
+
} else if ((0, import_neko_helper.isClass)(middleware)) {
|
|
1256
1257
|
this.middlewares.push(middleware.getInstance({}));
|
|
1257
1258
|
} else if (typeof middleware === "function") {
|
|
1258
1259
|
this.middlewares.push(MiddlewareFactory.create(middleware));
|
|
@@ -1261,9 +1262,6 @@ var CompiledRoute = class {
|
|
|
1261
1262
|
}
|
|
1262
1263
|
}
|
|
1263
1264
|
}
|
|
1264
|
-
isClass(func) {
|
|
1265
|
-
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
1266
|
-
}
|
|
1267
1265
|
async run() {
|
|
1268
1266
|
return await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
1269
1267
|
}
|
|
@@ -1399,7 +1397,7 @@ var Route = class {
|
|
|
1399
1397
|
i = start;
|
|
1400
1398
|
} else if (char === "*") {
|
|
1401
1399
|
let start = i + 1;
|
|
1402
|
-
while (start < path3.length && /[a-zA-Z0-9_
|
|
1400
|
+
while (start < path3.length && /[a-zA-Z0-9_]/.test(path3[start])) {
|
|
1403
1401
|
start++;
|
|
1404
1402
|
}
|
|
1405
1403
|
tokens.push({ type: "WILDCARD", value: path3.slice(i + 1, start) });
|
|
@@ -1610,7 +1608,7 @@ var Router = class {
|
|
|
1610
1608
|
|
|
1611
1609
|
// src/facades.mts
|
|
1612
1610
|
var import_neko_scheduler = require("@devbro/neko-scheduler");
|
|
1613
|
-
var
|
|
1611
|
+
var import_neko_helper3 = require("@devbro/neko-helper");
|
|
1614
1612
|
var import_neko_context3 = require("@devbro/neko-context");
|
|
1615
1613
|
var import_neko_storage2 = require("@devbro/neko-storage");
|
|
1616
1614
|
var import_neko_mailer2 = require("@devbro/neko-mailer");
|
|
@@ -1651,7 +1649,7 @@ __export(queue_exports, {
|
|
|
1651
1649
|
DatabaseTransport: () => DatabaseTransport
|
|
1652
1650
|
});
|
|
1653
1651
|
__reExport(queue_exports, require("@devbro/neko-queue"));
|
|
1654
|
-
var
|
|
1652
|
+
var import_neko_helper2 = require("@devbro/neko-helper");
|
|
1655
1653
|
var import_neko_context2 = require("@devbro/neko-context");
|
|
1656
1654
|
var DatabaseTransport = class {
|
|
1657
1655
|
static {
|
|
@@ -1712,7 +1710,7 @@ var DatabaseTransport = class {
|
|
|
1712
1710
|
}, "processMessage");
|
|
1713
1711
|
constructor(config3 = {}) {
|
|
1714
1712
|
this.config = { ...this.config, ...config3 };
|
|
1715
|
-
this.repeater = (0,
|
|
1713
|
+
this.repeater = (0, import_neko_helper2.createRepeater)(
|
|
1716
1714
|
this.processMessage,
|
|
1717
1715
|
this.config.listen_interval * 1e3
|
|
1718
1716
|
);
|
|
@@ -1780,6 +1778,24 @@ import_neko_queue.QueueTransportFactory.register("database", (opt) => {
|
|
|
1780
1778
|
import_neko_queue.QueueTransportFactory.register("memory", (opt) => {
|
|
1781
1779
|
return new import_neko_queue.MemoryTransport(opt);
|
|
1782
1780
|
});
|
|
1781
|
+
import_neko_queue.QueueTransportFactory.register("sqs", (opt) => {
|
|
1782
|
+
return new import_neko_queue.AwsSqsTransport(opt);
|
|
1783
|
+
});
|
|
1784
|
+
import_neko_queue.QueueTransportFactory.register("amqp", (opt) => {
|
|
1785
|
+
return new import_neko_queue.AmqpTransport(opt);
|
|
1786
|
+
});
|
|
1787
|
+
import_neko_queue.QueueTransportFactory.register("redis", (opt) => {
|
|
1788
|
+
return new import_neko_queue.RedisTransport(opt);
|
|
1789
|
+
});
|
|
1790
|
+
import_neko_queue.QueueTransportFactory.register("async", (opt) => {
|
|
1791
|
+
return new import_neko_queue.AsyncTransport();
|
|
1792
|
+
});
|
|
1793
|
+
import_neko_queue.QueueTransportFactory.register("azure_service_bus", (opt) => {
|
|
1794
|
+
return new import_neko_queue.AzureServiceBusTransport(opt);
|
|
1795
|
+
});
|
|
1796
|
+
import_neko_queue.QueueTransportFactory.register("google_pubsub", (opt) => {
|
|
1797
|
+
return new import_neko_queue.GooglePubSubTransport(opt);
|
|
1798
|
+
});
|
|
1783
1799
|
var CacheProviderFactory = class _CacheProviderFactory {
|
|
1784
1800
|
static {
|
|
1785
1801
|
__name(this, "CacheProviderFactory");
|
|
@@ -1810,32 +1826,75 @@ import_neko_storage.StorageProviderFactory.register("local", (opt) => {
|
|
|
1810
1826
|
import_neko_storage.StorageProviderFactory.register("s3", (opt) => {
|
|
1811
1827
|
return new import_neko_storage.AWSS3StorageProvider(opt);
|
|
1812
1828
|
});
|
|
1829
|
+
import_neko_storage.StorageProviderFactory.register("gcp", (opt) => {
|
|
1830
|
+
return new import_neko_storage.GCPStorageProvider(opt);
|
|
1831
|
+
});
|
|
1832
|
+
import_neko_storage.StorageProviderFactory.register("azure", (opt) => {
|
|
1833
|
+
return new import_neko_storage.AzureBlobStorageProvider(opt);
|
|
1834
|
+
});
|
|
1835
|
+
import_neko_storage.StorageProviderFactory.register("ftp", (opt) => {
|
|
1836
|
+
return new import_neko_storage.FTPStorageProvider(opt);
|
|
1837
|
+
});
|
|
1838
|
+
import_neko_storage.StorageProviderFactory.register("sftp", (opt) => {
|
|
1839
|
+
return new import_neko_storage.SFTPStorageProvider(opt);
|
|
1840
|
+
});
|
|
1813
1841
|
|
|
1814
1842
|
// src/facades.mts
|
|
1815
1843
|
var import_neko_cache2 = require("@devbro/neko-cache");
|
|
1816
1844
|
var import_neko_queue2 = require("@devbro/neko-queue");
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
const
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1845
|
+
function wrapSingletonWithAccessors(singletonFn) {
|
|
1846
|
+
let methodsInitialized = false;
|
|
1847
|
+
const initializeMethods = /* @__PURE__ */ __name(() => {
|
|
1848
|
+
if (methodsInitialized) return;
|
|
1849
|
+
const defaultInstance = singletonFn();
|
|
1850
|
+
const prototype = Object.getPrototypeOf(defaultInstance);
|
|
1851
|
+
const methodNames = Object.getOwnPropertyNames(prototype).filter(
|
|
1852
|
+
(name) => name !== "constructor" && typeof prototype[name] === "function"
|
|
1853
|
+
);
|
|
1854
|
+
for (const methodName of methodNames) {
|
|
1855
|
+
singletonFn[methodName] = (...args) => {
|
|
1856
|
+
const instance = singletonFn();
|
|
1857
|
+
return instance[methodName](...args);
|
|
1858
|
+
};
|
|
1859
|
+
}
|
|
1860
|
+
methodsInitialized = true;
|
|
1861
|
+
}, "initializeMethods");
|
|
1862
|
+
return new Proxy(singletonFn, {
|
|
1863
|
+
get(target, prop, receiver) {
|
|
1864
|
+
if (typeof prop === "string" && !Reflect.has(target, prop)) {
|
|
1865
|
+
initializeMethods();
|
|
1866
|
+
}
|
|
1867
|
+
return Reflect.get(target, prop, receiver);
|
|
1868
|
+
}
|
|
1826
1869
|
});
|
|
1827
|
-
|
|
1828
|
-
|
|
1870
|
+
}
|
|
1871
|
+
__name(wrapSingletonWithAccessors, "wrapSingletonWithAccessors");
|
|
1872
|
+
var router = (0, import_neko_helper3.createSingleton)(() => new Router());
|
|
1873
|
+
var scheduler = wrapSingletonWithAccessors(
|
|
1874
|
+
(0, import_neko_helper3.createSingleton)(() => {
|
|
1875
|
+
const rc = new import_neko_scheduler.Scheduler();
|
|
1876
|
+
rc.setErrorHandler((err, job) => {
|
|
1877
|
+
logger().error({
|
|
1878
|
+
msg: "Scheduled job error",
|
|
1879
|
+
err,
|
|
1880
|
+
job_name: job.getName()
|
|
1881
|
+
});
|
|
1882
|
+
});
|
|
1883
|
+
return rc;
|
|
1884
|
+
})
|
|
1885
|
+
);
|
|
1829
1886
|
var db = /* @__PURE__ */ __name((label = "default") => (0, import_neko_context3.ctx)().getOrThrow(["database", label]), "db");
|
|
1830
|
-
var storage = (
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1887
|
+
var storage = wrapSingletonWithAccessors(
|
|
1888
|
+
(0, import_neko_helper3.createSingleton)((label = "default") => {
|
|
1889
|
+
let storage_config = import_neko_config.config.get(["storages", label].join("."));
|
|
1890
|
+
const provider = import_neko_storage2.StorageProviderFactory.create(
|
|
1891
|
+
storage_config.provider,
|
|
1892
|
+
storage_config.config
|
|
1893
|
+
);
|
|
1894
|
+
return new import_neko_storage2.Storage(provider);
|
|
1895
|
+
})
|
|
1896
|
+
);
|
|
1897
|
+
var cli = (0, import_neko_helper3.createSingleton)(() => {
|
|
1839
1898
|
const [node, app, ...args] = process.argv;
|
|
1840
1899
|
return new import_clipanion.Cli({
|
|
1841
1900
|
binaryLabel: `My Application`,
|
|
@@ -1843,52 +1902,60 @@ var cli = (0, import_neko_helper2.createSingleton)(() => {
|
|
|
1843
1902
|
binaryVersion: `1.0.0`
|
|
1844
1903
|
});
|
|
1845
1904
|
});
|
|
1846
|
-
var httpServer = (0,
|
|
1905
|
+
var httpServer = (0, import_neko_helper3.createSingleton)(() => {
|
|
1847
1906
|
const server = new http_exports.HttpServer();
|
|
1848
1907
|
server.setErrorHandler(handleHttpErrors);
|
|
1849
1908
|
server.setRouter(router());
|
|
1850
1909
|
return server;
|
|
1851
1910
|
});
|
|
1852
|
-
var logger = (
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
mailer_config.config
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
queue_config.
|
|
1877
|
-
queue_config
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
});
|
|
1911
|
+
var logger = wrapSingletonWithAccessors(
|
|
1912
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
1913
|
+
const logger_config = import_neko_config.config.get(["loggers", label].join("."));
|
|
1914
|
+
const rc = new import_neko_logger.Logger(logger_config);
|
|
1915
|
+
rc.setExtrasFunction((message) => {
|
|
1916
|
+
message.requestId = (0, import_neko_context3.ctxSafe)()?.get("requestId") || "N/A";
|
|
1917
|
+
return message;
|
|
1918
|
+
});
|
|
1919
|
+
return rc;
|
|
1920
|
+
})
|
|
1921
|
+
);
|
|
1922
|
+
var mailer = wrapSingletonWithAccessors(
|
|
1923
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
1924
|
+
const mailer_config = import_neko_config.config.get(["mailer", label].join("."));
|
|
1925
|
+
const provider = import_neko_mailer2.MailerProviderFactory.create(
|
|
1926
|
+
mailer_config.provider,
|
|
1927
|
+
mailer_config.config
|
|
1928
|
+
);
|
|
1929
|
+
const rc = new import_neko_mailer2.Mailer(provider);
|
|
1930
|
+
return rc;
|
|
1931
|
+
})
|
|
1932
|
+
);
|
|
1933
|
+
var queue = wrapSingletonWithAccessors(
|
|
1934
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
1935
|
+
const queue_config = import_neko_config.config.get(["queues", label].join("."));
|
|
1936
|
+
if (!queue_config) {
|
|
1937
|
+
throw new Error(`Queue configuration for '${label}' not found`);
|
|
1938
|
+
}
|
|
1939
|
+
const provider = import_neko_queue2.QueueTransportFactory.create(
|
|
1940
|
+
queue_config.provider,
|
|
1941
|
+
queue_config.config
|
|
1942
|
+
);
|
|
1943
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
1944
|
+
})
|
|
1945
|
+
);
|
|
1946
|
+
var cache = wrapSingletonWithAccessors(
|
|
1947
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
1948
|
+
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
1949
|
+
if (!cache_config) {
|
|
1950
|
+
throw new Error(`Cache configuration for '${label}' not found`);
|
|
1951
|
+
}
|
|
1952
|
+
const provider = CacheProviderFactory.create(
|
|
1953
|
+
cache_config.provider,
|
|
1954
|
+
cache_config.config
|
|
1955
|
+
);
|
|
1956
|
+
return new import_neko_cache2.Cache(provider);
|
|
1957
|
+
})
|
|
1958
|
+
);
|
|
1892
1959
|
|
|
1893
1960
|
// src/app/console/migrate/MigrateRollbackCommand.mts
|
|
1894
1961
|
var import_clipanion2 = require("clipanion");
|
|
@@ -1234,6 +1234,7 @@ var MiddlewareFactory = class {
|
|
|
1234
1234
|
};
|
|
1235
1235
|
|
|
1236
1236
|
// ../neko-router/dist/CompiledRoute.mjs
|
|
1237
|
+
var import_neko_helper = require("@devbro/neko-helper");
|
|
1237
1238
|
var CompiledRoute = class {
|
|
1238
1239
|
static {
|
|
1239
1240
|
__name(this, "CompiledRoute");
|
|
@@ -1254,7 +1255,7 @@ var CompiledRoute = class {
|
|
|
1254
1255
|
for (const middleware of [...this.globalMiddlewares, ...this.route.getMiddlewares()]) {
|
|
1255
1256
|
if (middleware instanceof Middleware) {
|
|
1256
1257
|
this.middlewares.push(middleware);
|
|
1257
|
-
} else if (
|
|
1258
|
+
} else if ((0, import_neko_helper.isClass)(middleware)) {
|
|
1258
1259
|
this.middlewares.push(middleware.getInstance({}));
|
|
1259
1260
|
} else if (typeof middleware === "function") {
|
|
1260
1261
|
this.middlewares.push(MiddlewareFactory.create(middleware));
|
|
@@ -1263,9 +1264,6 @@ var CompiledRoute = class {
|
|
|
1263
1264
|
}
|
|
1264
1265
|
}
|
|
1265
1266
|
}
|
|
1266
|
-
isClass(func) {
|
|
1267
|
-
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
1268
|
-
}
|
|
1269
1267
|
async run() {
|
|
1270
1268
|
return await this.runMiddlewares(this.middlewares, this.request, this.response);
|
|
1271
1269
|
}
|
|
@@ -1401,7 +1399,7 @@ var Route = class {
|
|
|
1401
1399
|
i = start;
|
|
1402
1400
|
} else if (char === "*") {
|
|
1403
1401
|
let start = i + 1;
|
|
1404
|
-
while (start < path5.length && /[a-zA-Z0-9_
|
|
1402
|
+
while (start < path5.length && /[a-zA-Z0-9_]/.test(path5[start])) {
|
|
1405
1403
|
start++;
|
|
1406
1404
|
}
|
|
1407
1405
|
tokens.push({ type: "WILDCARD", value: path5.slice(i + 1, start) });
|
|
@@ -1612,7 +1610,7 @@ var Router = class {
|
|
|
1612
1610
|
|
|
1613
1611
|
// src/facades.mts
|
|
1614
1612
|
var import_neko_scheduler = require("@devbro/neko-scheduler");
|
|
1615
|
-
var
|
|
1613
|
+
var import_neko_helper3 = require("@devbro/neko-helper");
|
|
1616
1614
|
var import_neko_context3 = require("@devbro/neko-context");
|
|
1617
1615
|
var import_neko_storage2 = require("@devbro/neko-storage");
|
|
1618
1616
|
var import_neko_mailer2 = require("@devbro/neko-mailer");
|
|
@@ -1653,7 +1651,7 @@ __export(queue_exports, {
|
|
|
1653
1651
|
DatabaseTransport: () => DatabaseTransport
|
|
1654
1652
|
});
|
|
1655
1653
|
__reExport(queue_exports, require("@devbro/neko-queue"));
|
|
1656
|
-
var
|
|
1654
|
+
var import_neko_helper2 = require("@devbro/neko-helper");
|
|
1657
1655
|
var import_neko_context2 = require("@devbro/neko-context");
|
|
1658
1656
|
var DatabaseTransport = class {
|
|
1659
1657
|
static {
|
|
@@ -1714,7 +1712,7 @@ var DatabaseTransport = class {
|
|
|
1714
1712
|
}, "processMessage");
|
|
1715
1713
|
constructor(config5 = {}) {
|
|
1716
1714
|
this.config = { ...this.config, ...config5 };
|
|
1717
|
-
this.repeater = (0,
|
|
1715
|
+
this.repeater = (0, import_neko_helper2.createRepeater)(
|
|
1718
1716
|
this.processMessage,
|
|
1719
1717
|
this.config.listen_interval * 1e3
|
|
1720
1718
|
);
|
|
@@ -1782,6 +1780,24 @@ import_neko_queue.QueueTransportFactory.register("database", (opt) => {
|
|
|
1782
1780
|
import_neko_queue.QueueTransportFactory.register("memory", (opt) => {
|
|
1783
1781
|
return new import_neko_queue.MemoryTransport(opt);
|
|
1784
1782
|
});
|
|
1783
|
+
import_neko_queue.QueueTransportFactory.register("sqs", (opt) => {
|
|
1784
|
+
return new import_neko_queue.AwsSqsTransport(opt);
|
|
1785
|
+
});
|
|
1786
|
+
import_neko_queue.QueueTransportFactory.register("amqp", (opt) => {
|
|
1787
|
+
return new import_neko_queue.AmqpTransport(opt);
|
|
1788
|
+
});
|
|
1789
|
+
import_neko_queue.QueueTransportFactory.register("redis", (opt) => {
|
|
1790
|
+
return new import_neko_queue.RedisTransport(opt);
|
|
1791
|
+
});
|
|
1792
|
+
import_neko_queue.QueueTransportFactory.register("async", (opt) => {
|
|
1793
|
+
return new import_neko_queue.AsyncTransport();
|
|
1794
|
+
});
|
|
1795
|
+
import_neko_queue.QueueTransportFactory.register("azure_service_bus", (opt) => {
|
|
1796
|
+
return new import_neko_queue.AzureServiceBusTransport(opt);
|
|
1797
|
+
});
|
|
1798
|
+
import_neko_queue.QueueTransportFactory.register("google_pubsub", (opt) => {
|
|
1799
|
+
return new import_neko_queue.GooglePubSubTransport(opt);
|
|
1800
|
+
});
|
|
1785
1801
|
var CacheProviderFactory = class _CacheProviderFactory {
|
|
1786
1802
|
static {
|
|
1787
1803
|
__name(this, "CacheProviderFactory");
|
|
@@ -1812,32 +1828,75 @@ import_neko_storage.StorageProviderFactory.register("local", (opt) => {
|
|
|
1812
1828
|
import_neko_storage.StorageProviderFactory.register("s3", (opt) => {
|
|
1813
1829
|
return new import_neko_storage.AWSS3StorageProvider(opt);
|
|
1814
1830
|
});
|
|
1831
|
+
import_neko_storage.StorageProviderFactory.register("gcp", (opt) => {
|
|
1832
|
+
return new import_neko_storage.GCPStorageProvider(opt);
|
|
1833
|
+
});
|
|
1834
|
+
import_neko_storage.StorageProviderFactory.register("azure", (opt) => {
|
|
1835
|
+
return new import_neko_storage.AzureBlobStorageProvider(opt);
|
|
1836
|
+
});
|
|
1837
|
+
import_neko_storage.StorageProviderFactory.register("ftp", (opt) => {
|
|
1838
|
+
return new import_neko_storage.FTPStorageProvider(opt);
|
|
1839
|
+
});
|
|
1840
|
+
import_neko_storage.StorageProviderFactory.register("sftp", (opt) => {
|
|
1841
|
+
return new import_neko_storage.SFTPStorageProvider(opt);
|
|
1842
|
+
});
|
|
1815
1843
|
|
|
1816
1844
|
// src/facades.mts
|
|
1817
1845
|
var import_neko_cache2 = require("@devbro/neko-cache");
|
|
1818
1846
|
var import_neko_queue2 = require("@devbro/neko-queue");
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
const
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1847
|
+
function wrapSingletonWithAccessors(singletonFn) {
|
|
1848
|
+
let methodsInitialized = false;
|
|
1849
|
+
const initializeMethods = /* @__PURE__ */ __name(() => {
|
|
1850
|
+
if (methodsInitialized) return;
|
|
1851
|
+
const defaultInstance = singletonFn();
|
|
1852
|
+
const prototype = Object.getPrototypeOf(defaultInstance);
|
|
1853
|
+
const methodNames = Object.getOwnPropertyNames(prototype).filter(
|
|
1854
|
+
(name) => name !== "constructor" && typeof prototype[name] === "function"
|
|
1855
|
+
);
|
|
1856
|
+
for (const methodName of methodNames) {
|
|
1857
|
+
singletonFn[methodName] = (...args) => {
|
|
1858
|
+
const instance = singletonFn();
|
|
1859
|
+
return instance[methodName](...args);
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
methodsInitialized = true;
|
|
1863
|
+
}, "initializeMethods");
|
|
1864
|
+
return new Proxy(singletonFn, {
|
|
1865
|
+
get(target, prop, receiver) {
|
|
1866
|
+
if (typeof prop === "string" && !Reflect.has(target, prop)) {
|
|
1867
|
+
initializeMethods();
|
|
1868
|
+
}
|
|
1869
|
+
return Reflect.get(target, prop, receiver);
|
|
1870
|
+
}
|
|
1828
1871
|
});
|
|
1829
|
-
|
|
1830
|
-
|
|
1872
|
+
}
|
|
1873
|
+
__name(wrapSingletonWithAccessors, "wrapSingletonWithAccessors");
|
|
1874
|
+
var router = (0, import_neko_helper3.createSingleton)(() => new Router());
|
|
1875
|
+
var scheduler = wrapSingletonWithAccessors(
|
|
1876
|
+
(0, import_neko_helper3.createSingleton)(() => {
|
|
1877
|
+
const rc = new import_neko_scheduler.Scheduler();
|
|
1878
|
+
rc.setErrorHandler((err, job) => {
|
|
1879
|
+
logger().error({
|
|
1880
|
+
msg: "Scheduled job error",
|
|
1881
|
+
err,
|
|
1882
|
+
job_name: job.getName()
|
|
1883
|
+
});
|
|
1884
|
+
});
|
|
1885
|
+
return rc;
|
|
1886
|
+
})
|
|
1887
|
+
);
|
|
1831
1888
|
var db = /* @__PURE__ */ __name((label = "default") => (0, import_neko_context3.ctx)().getOrThrow(["database", label]), "db");
|
|
1832
|
-
var storage = (
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1889
|
+
var storage = wrapSingletonWithAccessors(
|
|
1890
|
+
(0, import_neko_helper3.createSingleton)((label = "default") => {
|
|
1891
|
+
let storage_config = import_neko_config.config.get(["storages", label].join("."));
|
|
1892
|
+
const provider = import_neko_storage2.StorageProviderFactory.create(
|
|
1893
|
+
storage_config.provider,
|
|
1894
|
+
storage_config.config
|
|
1895
|
+
);
|
|
1896
|
+
return new import_neko_storage2.Storage(provider);
|
|
1897
|
+
})
|
|
1898
|
+
);
|
|
1899
|
+
var cli = (0, import_neko_helper3.createSingleton)(() => {
|
|
1841
1900
|
const [node, app, ...args] = process.argv;
|
|
1842
1901
|
return new import_clipanion.Cli({
|
|
1843
1902
|
binaryLabel: `My Application`,
|
|
@@ -1845,52 +1904,60 @@ var cli = (0, import_neko_helper2.createSingleton)(() => {
|
|
|
1845
1904
|
binaryVersion: `1.0.0`
|
|
1846
1905
|
});
|
|
1847
1906
|
});
|
|
1848
|
-
var httpServer = (0,
|
|
1907
|
+
var httpServer = (0, import_neko_helper3.createSingleton)(() => {
|
|
1849
1908
|
const server = new http_exports.HttpServer();
|
|
1850
1909
|
server.setErrorHandler(handleHttpErrors);
|
|
1851
1910
|
server.setRouter(router());
|
|
1852
1911
|
return server;
|
|
1853
1912
|
});
|
|
1854
|
-
var logger = (
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
mailer_config.config
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
queue_config.
|
|
1879
|
-
queue_config
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
});
|
|
1913
|
+
var logger = wrapSingletonWithAccessors(
|
|
1914
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
1915
|
+
const logger_config = import_neko_config.config.get(["loggers", label].join("."));
|
|
1916
|
+
const rc = new import_neko_logger.Logger(logger_config);
|
|
1917
|
+
rc.setExtrasFunction((message) => {
|
|
1918
|
+
message.requestId = (0, import_neko_context3.ctxSafe)()?.get("requestId") || "N/A";
|
|
1919
|
+
return message;
|
|
1920
|
+
});
|
|
1921
|
+
return rc;
|
|
1922
|
+
})
|
|
1923
|
+
);
|
|
1924
|
+
var mailer = wrapSingletonWithAccessors(
|
|
1925
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
1926
|
+
const mailer_config = import_neko_config.config.get(["mailer", label].join("."));
|
|
1927
|
+
const provider = import_neko_mailer2.MailerProviderFactory.create(
|
|
1928
|
+
mailer_config.provider,
|
|
1929
|
+
mailer_config.config
|
|
1930
|
+
);
|
|
1931
|
+
const rc = new import_neko_mailer2.Mailer(provider);
|
|
1932
|
+
return rc;
|
|
1933
|
+
})
|
|
1934
|
+
);
|
|
1935
|
+
var queue = wrapSingletonWithAccessors(
|
|
1936
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
1937
|
+
const queue_config = import_neko_config.config.get(["queues", label].join("."));
|
|
1938
|
+
if (!queue_config) {
|
|
1939
|
+
throw new Error(`Queue configuration for '${label}' not found`);
|
|
1940
|
+
}
|
|
1941
|
+
const provider = import_neko_queue2.QueueTransportFactory.create(
|
|
1942
|
+
queue_config.provider,
|
|
1943
|
+
queue_config.config
|
|
1944
|
+
);
|
|
1945
|
+
return new import_neko_queue2.QueueConnection(provider);
|
|
1946
|
+
})
|
|
1947
|
+
);
|
|
1948
|
+
var cache = wrapSingletonWithAccessors(
|
|
1949
|
+
(0, import_neko_helper3.createSingleton)((label) => {
|
|
1950
|
+
const cache_config = import_neko_config.config.get(["caches", label].join("."));
|
|
1951
|
+
if (!cache_config) {
|
|
1952
|
+
throw new Error(`Cache configuration for '${label}' not found`);
|
|
1953
|
+
}
|
|
1954
|
+
const provider = CacheProviderFactory.create(
|
|
1955
|
+
cache_config.provider,
|
|
1956
|
+
cache_config.config
|
|
1957
|
+
);
|
|
1958
|
+
return new import_neko_cache2.Cache(provider);
|
|
1959
|
+
})
|
|
1960
|
+
);
|
|
1894
1961
|
|
|
1895
1962
|
// src/app/console/migrate/MigrateCommand.mts
|
|
1896
1963
|
var import_clipanion2 = require("clipanion");
|