nmtjs 0.14.5 → 0.15.0-beta.10
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/LICENSE.md +1 -1
- package/README.md +1 -1
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +122 -1
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +51 -0
- package/dist/config.js +14 -0
- package/dist/config.js.map +1 -0
- package/dist/entrypoints/cli.d.ts +1 -0
- package/dist/entrypoints/cli.js +12 -0
- package/dist/entrypoints/cli.js.map +1 -0
- package/dist/entrypoints/main.d.ts +5 -0
- package/dist/entrypoints/main.js +84 -0
- package/dist/entrypoints/main.js.map +1 -0
- package/dist/entrypoints/thread.d.ts +14 -0
- package/dist/entrypoints/thread.js +56 -0
- package/dist/entrypoints/thread.js.map +1 -0
- package/dist/entrypoints/worker.d.ts +3 -0
- package/dist/entrypoints/worker.js +42 -0
- package/dist/entrypoints/worker.js.map +1 -0
- package/dist/index.d.ts +36 -71
- package/dist/index.js +15 -18
- package/dist/index.js.map +1 -0
- package/dist/resolver.d.ts +2 -0
- package/dist/resolver.js +15 -0
- package/dist/resolver.js.map +1 -0
- package/dist/runtime/application/api/api.d.ts +48 -0
- package/dist/runtime/application/api/api.js +189 -0
- package/dist/runtime/application/api/api.js.map +1 -0
- package/dist/runtime/application/api/constants.d.ts +12 -0
- package/dist/runtime/application/api/constants.js +7 -0
- package/dist/runtime/application/api/constants.js.map +1 -0
- package/dist/runtime/application/api/filters.d.ts +14 -0
- package/dist/runtime/application/api/filters.js +11 -0
- package/dist/runtime/application/api/filters.js.map +1 -0
- package/dist/runtime/application/api/guards.d.ts +13 -0
- package/dist/runtime/application/api/guards.js +8 -0
- package/dist/runtime/application/api/guards.js.map +1 -0
- package/dist/runtime/application/api/index.d.ts +8 -0
- package/dist/runtime/application/api/index.js +9 -0
- package/dist/runtime/application/api/index.js.map +1 -0
- package/dist/runtime/application/api/middlewares.d.ts +14 -0
- package/dist/runtime/application/api/middlewares.js +12 -0
- package/dist/runtime/application/api/middlewares.js.map +1 -0
- package/dist/runtime/application/api/procedure.d.ts +67 -0
- package/dist/runtime/application/api/procedure.js +50 -0
- package/dist/runtime/application/api/procedure.js.map +1 -0
- package/dist/runtime/application/api/router.d.ts +68 -0
- package/dist/runtime/application/api/router.js +47 -0
- package/dist/runtime/application/api/router.js.map +1 -0
- package/dist/runtime/application/api/types.d.ts +32 -0
- package/dist/runtime/application/api/types.js +2 -0
- package/dist/runtime/application/api/types.js.map +1 -0
- package/dist/runtime/application/config.d.ts +26 -0
- package/dist/runtime/application/config.js +21 -0
- package/dist/runtime/application/config.js.map +1 -0
- package/dist/runtime/application/constants.d.ts +2 -0
- package/dist/runtime/application/constants.js +2 -0
- package/dist/runtime/application/constants.js.map +1 -0
- package/dist/runtime/application/hook.d.ts +19 -0
- package/dist/runtime/application/hook.js +11 -0
- package/dist/runtime/application/hook.js.map +1 -0
- package/dist/runtime/application/hooks.d.ts +3 -0
- package/dist/runtime/application/hooks.js +4 -0
- package/dist/runtime/application/hooks.js.map +1 -0
- package/dist/runtime/application/index.d.ts +5 -0
- package/dist/runtime/application/index.js +6 -0
- package/dist/runtime/application/index.js.map +1 -0
- package/dist/runtime/constants.d.ts +6 -0
- package/dist/runtime/constants.js +4 -0
- package/dist/runtime/constants.js.map +1 -0
- package/dist/runtime/core/hooks.d.ts +4 -0
- package/dist/runtime/core/hooks.js +4 -0
- package/dist/runtime/core/hooks.js.map +1 -0
- package/dist/runtime/core/plugin.d.ts +8 -0
- package/dist/runtime/core/plugin.js +4 -0
- package/dist/runtime/core/plugin.js.map +1 -0
- package/dist/runtime/core/runtime.d.ts +27 -0
- package/dist/runtime/core/runtime.js +81 -0
- package/dist/runtime/core/runtime.js.map +1 -0
- package/dist/runtime/enums.d.ts +21 -0
- package/dist/runtime/enums.js +26 -0
- package/dist/runtime/enums.js.map +1 -0
- package/dist/runtime/index.d.ts +19 -0
- package/dist/runtime/index.js +20 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/injectables.d.ts +21 -0
- package/dist/runtime/injectables.js +18 -0
- package/dist/runtime/injectables.js.map +1 -0
- package/dist/runtime/jobs/job.d.ts +73 -0
- package/dist/runtime/jobs/job.js +43 -0
- package/dist/runtime/jobs/job.js.map +1 -0
- package/dist/runtime/jobs/manager.d.ts +88 -0
- package/dist/runtime/jobs/manager.js +167 -0
- package/dist/runtime/jobs/manager.js.map +1 -0
- package/dist/runtime/jobs/runner.d.ts +58 -0
- package/dist/runtime/jobs/runner.js +176 -0
- package/dist/runtime/jobs/runner.js.map +1 -0
- package/dist/runtime/jobs/ui.d.ts +2 -0
- package/dist/runtime/jobs/ui.js +18 -0
- package/dist/runtime/jobs/ui.js.map +1 -0
- package/dist/runtime/pubsub/manager.d.ts +48 -0
- package/dist/runtime/pubsub/manager.js +119 -0
- package/dist/runtime/pubsub/manager.js.map +1 -0
- package/dist/runtime/pubsub/redis.d.ts +16 -0
- package/dist/runtime/pubsub/redis.js +98 -0
- package/dist/runtime/pubsub/redis.js.map +1 -0
- package/dist/runtime/scheduler/index.d.ts +22 -0
- package/dist/runtime/scheduler/index.js +20 -0
- package/dist/runtime/scheduler/index.js.map +1 -0
- package/dist/runtime/server/applications.d.ts +48 -0
- package/dist/runtime/server/applications.js +114 -0
- package/dist/runtime/server/applications.js.map +1 -0
- package/dist/runtime/server/config.d.ts +87 -0
- package/dist/runtime/server/config.js +18 -0
- package/dist/runtime/server/config.js.map +1 -0
- package/dist/runtime/server/jobs.d.ts +40 -0
- package/dist/runtime/server/jobs.js +146 -0
- package/dist/runtime/server/jobs.js.map +1 -0
- package/dist/runtime/server/pool.d.ts +52 -0
- package/dist/runtime/server/pool.js +123 -0
- package/dist/runtime/server/pool.js.map +1 -0
- package/dist/runtime/server/proxy.d.ts +21 -0
- package/dist/runtime/server/proxy.js +54 -0
- package/dist/runtime/server/proxy.js.map +1 -0
- package/dist/runtime/server/server.d.ts +37 -0
- package/dist/runtime/server/server.js +84 -0
- package/dist/runtime/server/server.js.map +1 -0
- package/dist/runtime/store/index.d.ts +3 -0
- package/dist/runtime/store/index.js +23 -0
- package/dist/runtime/store/index.js.map +1 -0
- package/dist/runtime/types.d.ts +93 -0
- package/dist/runtime/types.js +2 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/runtime/workers/application.d.ts +47 -0
- package/dist/runtime/workers/application.js +153 -0
- package/dist/runtime/workers/application.js.map +1 -0
- package/dist/runtime/workers/base.d.ts +16 -0
- package/dist/runtime/workers/base.js +39 -0
- package/dist/runtime/workers/base.js.map +1 -0
- package/dist/runtime/workers/cli.d.ts +1 -0
- package/dist/runtime/workers/cli.js +2 -0
- package/dist/runtime/workers/cli.js.map +1 -0
- package/dist/runtime/workers/job.d.ts +20 -0
- package/dist/runtime/workers/job.js +151 -0
- package/dist/runtime/workers/job.js.map +1 -0
- package/dist/typings.d.ts +5 -0
- package/dist/typings.js +18 -0
- package/dist/typings.js.map +1 -0
- package/dist/vite/builder.d.ts +5 -0
- package/dist/vite/builder.js +113 -0
- package/dist/vite/builder.js.map +1 -0
- package/dist/vite/config.d.ts +28 -0
- package/dist/vite/config.js +22 -0
- package/dist/vite/config.js.map +1 -0
- package/dist/vite/plugins.d.ts +2 -0
- package/dist/vite/plugins.js +18 -0
- package/dist/vite/plugins.js.map +1 -0
- package/dist/vite/runners/worker.d.ts +4 -0
- package/dist/vite/runners/worker.js +33 -0
- package/dist/vite/runners/worker.js.map +1 -0
- package/dist/vite/server.d.ts +3 -0
- package/dist/vite/server.js +22 -0
- package/dist/vite/server.js.map +1 -0
- package/dist/vite/servers/main.d.ts +8 -0
- package/dist/vite/servers/main.js +23 -0
- package/dist/vite/servers/main.js.map +1 -0
- package/dist/vite/servers/worker.d.ts +8 -0
- package/dist/vite/servers/worker.js +79 -0
- package/dist/vite/servers/worker.js.map +1 -0
- package/package.json +47 -23
- package/src/cli.ts +144 -0
- package/src/config.ts +64 -0
- package/src/entrypoints/cli.ts +13 -0
- package/src/entrypoints/main.ts +113 -0
- package/src/entrypoints/thread.ts +74 -0
- package/src/entrypoints/worker.ts +47 -0
- package/src/index.ts +77 -0
- package/src/resolver.ts +16 -0
- package/src/runtime/application/api/api.ts +256 -0
- package/src/runtime/application/api/constants.ts +17 -0
- package/src/runtime/application/api/filters.ts +39 -0
- package/src/runtime/application/api/guards.ts +26 -0
- package/src/runtime/application/api/index.ts +8 -0
- package/src/runtime/application/api/middlewares.ts +37 -0
- package/src/runtime/application/api/procedure.ts +229 -0
- package/src/runtime/application/api/router.ts +183 -0
- package/src/runtime/application/api/types.ts +124 -0
- package/src/runtime/application/config.ts +69 -0
- package/src/runtime/application/constants.ts +4 -0
- package/src/runtime/application/hook.ts +51 -0
- package/src/runtime/application/hooks.ts +3 -0
- package/src/runtime/application/index.ts +5 -0
- package/src/runtime/constants.ts +8 -0
- package/src/runtime/core/hooks.ts +5 -0
- package/src/runtime/core/plugin.ts +13 -0
- package/src/runtime/core/runtime.ts +109 -0
- package/src/runtime/enums.ts +24 -0
- package/src/runtime/index.ts +19 -0
- package/src/runtime/injectables.ts +55 -0
- package/src/runtime/jobs/job.ts +193 -0
- package/src/runtime/jobs/manager.ts +283 -0
- package/src/runtime/jobs/runner.ts +198 -0
- package/src/runtime/jobs/ui.ts +19 -0
- package/src/runtime/pubsub/manager.ts +211 -0
- package/src/runtime/pubsub/redis.ts +108 -0
- package/src/runtime/scheduler/index.ts +39 -0
- package/src/runtime/server/applications.ts +174 -0
- package/src/runtime/server/config.ts +108 -0
- package/src/runtime/server/jobs.ts +203 -0
- package/src/runtime/server/pool.ts +183 -0
- package/src/runtime/server/proxy.ts +88 -0
- package/src/runtime/server/server.ts +125 -0
- package/src/runtime/store/index.ts +30 -0
- package/src/runtime/types.ts +78 -0
- package/src/runtime/workers/application.ts +194 -0
- package/src/runtime/workers/base.ts +54 -0
- package/src/runtime/workers/cli.ts +0 -0
- package/src/runtime/workers/job.ts +119 -0
- package/src/typings.ts +30 -0
- package/src/vite/builder.ts +122 -0
- package/src/vite/config.ts +45 -0
- package/src/vite/plugins.ts +26 -0
- package/src/vite/runners/worker.ts +57 -0
- package/src/vite/server.ts +39 -0
- package/src/vite/servers/main.ts +34 -0
- package/src/vite/servers/worker.ts +107 -0
- package/dist/api.d.ts +0 -1
- package/dist/api.js +0 -1
- package/dist/application.d.ts +0 -1
- package/dist/application.js +0 -1
- package/dist/common.d.ts +0 -1
- package/dist/common.js +0 -1
- package/dist/contract.d.ts +0 -2
- package/dist/contract.js +0 -2
- package/dist/core.d.ts +0 -1
- package/dist/core.js +0 -1
- package/dist/json-format.d.ts +0 -1
- package/dist/json-format.js +0 -1
- package/dist/protocol/client.d.ts +0 -1
- package/dist/protocol/client.js +0 -1
- package/dist/protocol/server.d.ts +0 -1
- package/dist/protocol/server.js +0 -1
- package/dist/protocol.d.ts +0 -1
- package/dist/protocol.js +0 -1
- package/dist/server.d.ts +0 -1
- package/dist/server.js +0 -1
- package/dist/type.d.ts +0 -2
- package/dist/type.js +0 -2
- package/dist/ws-transport/bun.d.ts +0 -1
- package/dist/ws-transport/bun.js +0 -1
- package/dist/ws-transport/deno.d.ts +0 -1
- package/dist/ws-transport/deno.js +0 -1
- package/dist/ws-transport/node.d.ts +0 -1
- package/dist/ws-transport/node.js +0 -1
- package/dist/ws-transport.d.ts +0 -1
- package/dist/ws-transport.js +0 -1
package/LICENSE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2025 Denys Ilchyshyn
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
package/README.md
CHANGED
package/dist/cli.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node --enable-source-maps
|
|
2
|
+
export {};
|
package/dist/cli.js
CHANGED
|
@@ -1 +1,122 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node --enable-source-maps
|
|
2
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
3
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
4
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
5
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
return path;
|
|
9
|
+
};
|
|
10
|
+
import { once } from 'node:events';
|
|
11
|
+
import { relative, resolve } from 'node:path';
|
|
12
|
+
import process from 'node:process';
|
|
13
|
+
import { defineCommand, runMain } from 'citty';
|
|
14
|
+
import { config as dotenv } from 'dotenv';
|
|
15
|
+
import { resolver } from "./resolver.js";
|
|
16
|
+
import { generateTypings } from "./typings.js";
|
|
17
|
+
import { createBuilder } from "./vite/builder.js";
|
|
18
|
+
import { baseViteConfigOptions } from "./vite/config.js";
|
|
19
|
+
import { createMainServer } from "./vite/servers/main.js";
|
|
20
|
+
// import { createMainRunner } from './vite/runner.ts'
|
|
21
|
+
const commonArgs = {
|
|
22
|
+
config: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
alias: 'c',
|
|
25
|
+
default: './neemata.config.ts',
|
|
26
|
+
description: 'Path to Neemata config file',
|
|
27
|
+
required: false,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
let config;
|
|
31
|
+
let viteConfigOptions;
|
|
32
|
+
let applicationImports;
|
|
33
|
+
const mainCommand = defineCommand({
|
|
34
|
+
meta: { description: 'Neemata CLI' },
|
|
35
|
+
args: { ...commonArgs },
|
|
36
|
+
async setup(ctx) {
|
|
37
|
+
const configPath = resolve(ctx.args.config);
|
|
38
|
+
config = await import(__rewriteRelativeImportExtension(configPath)).then((m) => m.default);
|
|
39
|
+
for (const env of config.env) {
|
|
40
|
+
if (typeof env === 'string') {
|
|
41
|
+
const { error } = dotenv({ path: env });
|
|
42
|
+
if (error)
|
|
43
|
+
console.warn(error);
|
|
44
|
+
}
|
|
45
|
+
else if (typeof env === 'object') {
|
|
46
|
+
for (const key in env) {
|
|
47
|
+
process.env[key] = env[key];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// const applicationEntryPaths: Record<string, string> = {}
|
|
52
|
+
applicationImports = {};
|
|
53
|
+
const currentPkg = resolver.sync(process.cwd(), './package.json');
|
|
54
|
+
for (const [appName, { specifier: appSpecifier, type }] of Object.entries(config.applications)) {
|
|
55
|
+
const resolution = resolver.sync(process.cwd(), appSpecifier);
|
|
56
|
+
if (resolution.error)
|
|
57
|
+
throw new Error(`Failed to resolve application path for ${appName}: ${resolution.error}`);
|
|
58
|
+
if (!resolution.path)
|
|
59
|
+
throw new Error(`Failed to resolve application path for ${appName}: no path found`);
|
|
60
|
+
const specifier = resolution.packageJsonPath === currentPkg.path
|
|
61
|
+
? relative(resolve('.neemata'), resolution.path)
|
|
62
|
+
: appSpecifier;
|
|
63
|
+
applicationImports[appName] = { path: resolution.path, specifier, type };
|
|
64
|
+
}
|
|
65
|
+
viteConfigOptions = {
|
|
66
|
+
applicationImports,
|
|
67
|
+
serverEntryPath: resolve(config.serverPath),
|
|
68
|
+
...baseViteConfigOptions,
|
|
69
|
+
configPath,
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
subCommands: {
|
|
73
|
+
prepare: defineCommand({
|
|
74
|
+
async run(ctx) {
|
|
75
|
+
await generateTypings(applicationImports);
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
dev: defineCommand({
|
|
79
|
+
async run(ctx) {
|
|
80
|
+
const { runner } = await createMainServer(viteConfigOptions, 'development', config);
|
|
81
|
+
await runner.import(viteConfigOptions.entrypointMainPath);
|
|
82
|
+
await once(process, 'beforeExit');
|
|
83
|
+
},
|
|
84
|
+
}),
|
|
85
|
+
preview: defineCommand({
|
|
86
|
+
async run(ctx) {
|
|
87
|
+
const { runner } = await createMainServer(viteConfigOptions, 'production', config);
|
|
88
|
+
await runner.import(viteConfigOptions.entrypointMainPath);
|
|
89
|
+
await once(process, 'beforeExit');
|
|
90
|
+
},
|
|
91
|
+
}),
|
|
92
|
+
build: defineCommand({
|
|
93
|
+
async run(ctx) {
|
|
94
|
+
const builder = await createBuilder(viteConfigOptions, config);
|
|
95
|
+
await builder.build();
|
|
96
|
+
},
|
|
97
|
+
}),
|
|
98
|
+
// command: defineCommand({
|
|
99
|
+
// async run(ctx) {
|
|
100
|
+
// const runner = await createRunner(
|
|
101
|
+
// viteConfigOptions,
|
|
102
|
+
// 'production',
|
|
103
|
+
// config,
|
|
104
|
+
// )
|
|
105
|
+
// const workerModule = await runner.import<
|
|
106
|
+
// typeof import('./entrypoints/worker.ts')
|
|
107
|
+
// >(import.meta.resolve('./entrypoints/worker.js'))
|
|
108
|
+
// const commandModule = await runner.import<
|
|
109
|
+
// typeof import('./command.ts')
|
|
110
|
+
// >(import.meta.resolve('./command.js'))
|
|
111
|
+
// const worker = await workerModule.default({
|
|
112
|
+
// applicationWorkerData: undefined,
|
|
113
|
+
// type: ApplicationType.Command,
|
|
114
|
+
// workerType: ApplicationWorkerType.Command,
|
|
115
|
+
// })
|
|
116
|
+
// await runMain(commandModule.default(worker), { rawArgs: ctx.rawArgs })
|
|
117
|
+
// },
|
|
118
|
+
// }),
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
runMain(mainCommand);
|
|
122
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EA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SACF,CAAC;QACF,2BAA2B;QAC3B,qBAAqB;QACrB,yCAAyC;QACzC,2BAA2B;QAC3B,sBAAsB;QACtB,gBAAgB;QAChB,QAAQ;QACR,gDAAgD;QAChD,iDAAiD;QACjD,wDAAwD;QACxD,iDAAiD;QACjD,sCAAsC;QACtC,6CAA6C;QAC7C,kDAAkD;QAClD,0CAA0C;QAC1C,uCAAuC;QACvC,mDAAmD;QACnD,SAAS;QACT,6EAA6E;QAC7E,OAAO;QACP,MAAM;KACP;CACF,CAAC,CAAA;AAEF,OAAO,CAAC,WAAW,CAAC,CAAA"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Plugin as VitePlugin } from 'vite';
|
|
2
|
+
export type ExtrernalDependency = string | RegExp;
|
|
3
|
+
type DeepPartial<T> = {
|
|
4
|
+
[P in keyof T]?: T[P] extends Record<any, unknown> ? DeepPartial<T[P]> : T[P];
|
|
5
|
+
};
|
|
6
|
+
export interface NeemataConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Path to application entry point
|
|
9
|
+
*/
|
|
10
|
+
applications: {
|
|
11
|
+
/**
|
|
12
|
+
* Application name
|
|
13
|
+
*/
|
|
14
|
+
[appName: string]: {
|
|
15
|
+
type: 'neemata' | 'custom';
|
|
16
|
+
specifier: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Path to server entry point
|
|
21
|
+
*/
|
|
22
|
+
serverPath: string;
|
|
23
|
+
/**
|
|
24
|
+
* External dependencies to exclude from application bundle
|
|
25
|
+
*
|
|
26
|
+
* 'prod' - exclude production dependencies from package.json
|
|
27
|
+
*
|
|
28
|
+
* 'all' - exclude all dependencies from package.json
|
|
29
|
+
*
|
|
30
|
+
* ExtrernalDependency[] - array of package names or regular expressions to match package names
|
|
31
|
+
*/
|
|
32
|
+
externalDependencies: 'prod' | 'all' | ExtrernalDependency[];
|
|
33
|
+
/**
|
|
34
|
+
* Timeout in milliseconds for graceful shutdown of application workers
|
|
35
|
+
*/
|
|
36
|
+
timeout: number;
|
|
37
|
+
/**
|
|
38
|
+
* Environment variables to set for application workers
|
|
39
|
+
*
|
|
40
|
+
* Strings are paths to .env files
|
|
41
|
+
* Records are key-value pairs to set directly
|
|
42
|
+
*/
|
|
43
|
+
env: (Record<string, string> | string)[];
|
|
44
|
+
build: {
|
|
45
|
+
outDir: string;
|
|
46
|
+
minify: boolean;
|
|
47
|
+
};
|
|
48
|
+
plugins: VitePlugin[];
|
|
49
|
+
}
|
|
50
|
+
export declare function defineConfig(config?: DeepPartial<NeemataConfig>): NeemataConfig;
|
|
51
|
+
export {};
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function defineConfig(config = {}) {
|
|
2
|
+
return {
|
|
3
|
+
serverPath: './src/server.ts',
|
|
4
|
+
externalDependencies: 'prod',
|
|
5
|
+
timeout: 10000,
|
|
6
|
+
env: [],
|
|
7
|
+
plugins: [],
|
|
8
|
+
...config,
|
|
9
|
+
// @ts-expect-error
|
|
10
|
+
applications: config.applications || {},
|
|
11
|
+
build: { outDir: './dist', minify: true, ...config.build },
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAiDA,MAAM,UAAU,YAAY,CAC1B,SAAqC,EAAE;IAEvC,OAAO;QACL,UAAU,EAAE,iBAAiB;QAC7B,oBAAoB,EAAE,MAAM;QAC5B,OAAO,EAAE,KAAK;QACd,GAAG,EAAE,EAAE;QACP,OAAO,EAAE,EAAE;QACX,GAAG,MAAM;QACT,mBAAmB;QACnB,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,EAAE;QACvC,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE;KAC3D,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// // import { ApplicationType, ApplicationWorkerType } from '@nmtjs/application'
|
|
2
|
+
// import { runMain } from 'citty'
|
|
3
|
+
export {};
|
|
4
|
+
// import command from '../command.ts'
|
|
5
|
+
// import createWorker from './worker.ts'
|
|
6
|
+
// const worker = await createWorker({
|
|
7
|
+
// applicationWorkerData: undefined,
|
|
8
|
+
// // type: ApplicationType.Command,
|
|
9
|
+
// // workerType: ApplicationWorkerType.Command,
|
|
10
|
+
// })
|
|
11
|
+
// runMain(command(worker))
|
|
12
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/entrypoints/cli.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,kCAAkC;;AAElC,sCAAsC;AACtC,yCAAyC;AAEzC,sCAAsC;AACtC,sCAAsC;AACtC,sCAAsC;AACtC,kDAAkD;AAClD,KAAK;AAEL,2BAA2B"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import EventEmitter from 'node:events';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
import { ApplicationServer, isServerConfig } from "../runtime/index.js";
|
|
12
|
+
class InvalidServerConfigError extends Error {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(`Server config file does not have a default export, or it not a valid application. Please, make sure the application is defined using defineApplication().`);
|
|
15
|
+
this.name = 'InvalidServerConfigError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const _ext = new URL(import.meta.url).pathname.endsWith('.ts') ? '.ts' : '.js';
|
|
19
|
+
const _vite = __VITE_CONFIG__ ? JSON.parse(__VITE_CONFIG__) : undefined;
|
|
20
|
+
const applicationsConfig = __APPLICATIONS_CONFIG__ ? JSON.parse(__APPLICATIONS_CONFIG__) : {};
|
|
21
|
+
let _viteServerEvents;
|
|
22
|
+
let _viteWorkerServer;
|
|
23
|
+
let server;
|
|
24
|
+
if (import.meta.env.DEV && import.meta.hot) {
|
|
25
|
+
import.meta.hot.accept('#server', async (module) => {
|
|
26
|
+
await server.stop();
|
|
27
|
+
await createServer(module?.default);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (_vite) {
|
|
31
|
+
const { createWorkerServer } = await import("../vite/servers/worker.js");
|
|
32
|
+
const neemataConfig = await import(__rewriteRelativeImportExtension(
|
|
33
|
+
/* @vite-ignore */
|
|
34
|
+
_vite.options.configPath)).then((m) => m.default);
|
|
35
|
+
_viteServerEvents = new EventEmitter();
|
|
36
|
+
_viteWorkerServer = await createWorkerServer(_vite.options, _vite.mode, neemataConfig, _viteServerEvents);
|
|
37
|
+
}
|
|
38
|
+
async function createServer(config) {
|
|
39
|
+
if (!isServerConfig(config))
|
|
40
|
+
throw new InvalidServerConfigError();
|
|
41
|
+
server = new ApplicationServer(config, applicationsConfig, {
|
|
42
|
+
path: fileURLToPath(import.meta.resolve(`./thread${_ext}`)),
|
|
43
|
+
workerData: { vite: _vite?.mode },
|
|
44
|
+
worker: _viteServerEvents
|
|
45
|
+
? (worker) => {
|
|
46
|
+
_viteServerEvents.emit('worker', worker);
|
|
47
|
+
}
|
|
48
|
+
: undefined,
|
|
49
|
+
});
|
|
50
|
+
await server.start();
|
|
51
|
+
}
|
|
52
|
+
let isTerminating = false;
|
|
53
|
+
async function handleTermination() {
|
|
54
|
+
if (isTerminating)
|
|
55
|
+
return;
|
|
56
|
+
isTerminating = true;
|
|
57
|
+
await server?.stop();
|
|
58
|
+
_viteWorkerServer?.close();
|
|
59
|
+
process.exit(0);
|
|
60
|
+
}
|
|
61
|
+
function handleUnexpectedError(error) {
|
|
62
|
+
console.error(new Error('Unexpected Error:', { cause: error }));
|
|
63
|
+
}
|
|
64
|
+
process.once('SIGTERM', handleTermination);
|
|
65
|
+
process.once('SIGINT', handleTermination);
|
|
66
|
+
process.on('uncaughtException', handleUnexpectedError);
|
|
67
|
+
process.on('unhandledRejection', handleUnexpectedError);
|
|
68
|
+
await createServer(await import(
|
|
69
|
+
// @ts-expect-error
|
|
70
|
+
'#server').then((m) => m.default));
|
|
71
|
+
const { format } = Intl.NumberFormat('en', {
|
|
72
|
+
notation: 'compact',
|
|
73
|
+
maximumFractionDigits: 2,
|
|
74
|
+
unit: 'byte',
|
|
75
|
+
});
|
|
76
|
+
const printMem = () => {
|
|
77
|
+
globalThis.gc?.();
|
|
78
|
+
// print memory usage every 10 seconds
|
|
79
|
+
const memoryUsage = process.memoryUsage();
|
|
80
|
+
console.log(`Memory Usage: RSS=${format(memoryUsage.rss)}, HeapTotal=${format(memoryUsage.heapTotal)}, HeapUsed=${format(memoryUsage.heapUsed)}, External=${format(memoryUsage.external)}, ArrayBuffers=${format(memoryUsage.arrayBuffers)}`);
|
|
81
|
+
};
|
|
82
|
+
// printMem()
|
|
83
|
+
// setInterval(printMem, 5000)
|
|
84
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/entrypoints/main.ts"],"names":[],"mappings":";;;;;;;;AACA,OAAO,YAAY,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAKxC,OAAO,EAAE,iBAAiB,EA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O,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAA;AAC1C,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAA;AACzC,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAAA;AACtD,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,qBAAqB,CAAC,CAAA;AAEvD,MAAM,YAAY,CAChB,MAAM,MAAM;AACV,mBAAmB;AACnB,SAAS,CACV,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CACzB,CAAA;AAED,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;IACzC,QAAQ,EAAE,SAAS;IACnB,qBAAqB,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM;CACb,CAAC,CAAA;AAEF,MAAM,QAAQ,GAAG,GAAG,EAAE;IACpB,UAAU,CAAC,EAAE,EAAE,EAAE,CAAA;IACjB,sCAAsC;IACtC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAA;IACzC,OAAO,CAAC,GAAG,CACT,qBAAqB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,kBAAkB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE,CACjO,CAAA;AACH,CAAC,CAAA;AACD,aAAa;AACb,8BAA8B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MessagePort } from 'node:worker_threads';
|
|
2
|
+
export type RunWorkerOptions = {
|
|
3
|
+
port: MessagePort;
|
|
4
|
+
runtime: {
|
|
5
|
+
type: 'application';
|
|
6
|
+
name: string;
|
|
7
|
+
path: string;
|
|
8
|
+
transportsData: any;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'jobs';
|
|
11
|
+
jobWorkerPool: string;
|
|
12
|
+
};
|
|
13
|
+
vite?: 'development' | 'production';
|
|
14
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { workerData as _workerData } from 'node:worker_threads';
|
|
11
|
+
const workerData = _workerData;
|
|
12
|
+
const ext = new URL(import.meta.url).pathname.endsWith('.ts') ? '.ts' : '.js';
|
|
13
|
+
const workerPath = fileURLToPath(import.meta.resolve(`./worker${ext}`));
|
|
14
|
+
process.on('uncaughtException', (error) => {
|
|
15
|
+
console.error(new Error('Uncaught Exception:', { cause: error }));
|
|
16
|
+
});
|
|
17
|
+
process.on('unhandledRejection', (error) => {
|
|
18
|
+
console.error(new Error('Unhandled Promise Rejection:', { cause: error }));
|
|
19
|
+
});
|
|
20
|
+
process.on('exit', async (code) => {
|
|
21
|
+
await runner?.close();
|
|
22
|
+
});
|
|
23
|
+
let runner;
|
|
24
|
+
let workerModule;
|
|
25
|
+
try {
|
|
26
|
+
if (workerData.vite) {
|
|
27
|
+
const { createModuleRunner } = (await import("../vite/runners/worker.js"));
|
|
28
|
+
runner = createModuleRunner(workerData.vite);
|
|
29
|
+
workerModule = await runner.import(workerPath);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
runner = undefined;
|
|
33
|
+
workerModule = await import(__rewriteRelativeImportExtension(
|
|
34
|
+
/* @vite-ignore */
|
|
35
|
+
workerPath));
|
|
36
|
+
}
|
|
37
|
+
const runtime = await workerModule.run(workerData.runtime);
|
|
38
|
+
process.on('exit', async () => {
|
|
39
|
+
await runtime.stop();
|
|
40
|
+
});
|
|
41
|
+
workerData.port.on('message', async (msg) => {
|
|
42
|
+
if (msg.type === 'stop') {
|
|
43
|
+
await runtime.stop();
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const hosts = (await runtime?.start()) || undefined;
|
|
48
|
+
workerData.port.postMessage({
|
|
49
|
+
type: 'ready',
|
|
50
|
+
data: { hosts },
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
console.error(new Error('Worker thread error:', { cause: error }));
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=thread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread.js","sourceRoot":"","sources":["../../src/entrypoints/thread.ts"],"names":[],"mappings":";;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAc/D,MAAM,UAAU,GAAG,WAA+B,CAAA;AAElD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AAC7E,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC,CAAA;AAEvE,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;IACxC,OAAO,CAAC,KAAK,CAAC,IAAI,KA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,KAAK,MAAM,EAAE,CAAC;YACxB,MAAM,OAAO,CAAC,IAAI,EAAE,CAAA;YACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,KAAK,GAAG,CAAC,MAAM,OAAO,EAAE,KAAK,EAAE,CAAC,IAAI,SAAS,CAAA;IAEnD,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC;QAC1B,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,EAAE,KAAK,EAAE;KACY,CAAC,CAAA;AAChC,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,sBAAsB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;AACpE,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { workerData } from 'node:worker_threads';
|
|
10
|
+
import { ApplicationWorkerRuntime, isApplicationConfig, JobWorkerRuntime, } from "../runtime/index.js";
|
|
11
|
+
export async function run(options) {
|
|
12
|
+
const serverConfig = await import(
|
|
13
|
+
// @ts-expect-error
|
|
14
|
+
'#server').then((m) => m.default);
|
|
15
|
+
if (options.type === 'application') {
|
|
16
|
+
globalThis._hotAccept = (module) => {
|
|
17
|
+
if (module) {
|
|
18
|
+
if (!isApplicationConfig(module.default))
|
|
19
|
+
throw new Error('Invalid application config');
|
|
20
|
+
runtime.reload(module.default);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const { name, path, transportsData } = options;
|
|
24
|
+
const appConfig = await import(__rewriteRelativeImportExtension(
|
|
25
|
+
/* @vite-ignore */
|
|
26
|
+
path)).then((m) => m.default);
|
|
27
|
+
const runtime = new ApplicationWorkerRuntime(serverConfig, { name, path, transports: transportsData }, appConfig);
|
|
28
|
+
return runtime;
|
|
29
|
+
}
|
|
30
|
+
else if (options.type === 'jobs') {
|
|
31
|
+
const { jobWorkerPool } = options;
|
|
32
|
+
const runtime = new JobWorkerRuntime(serverConfig, {
|
|
33
|
+
poolName: jobWorkerPool,
|
|
34
|
+
port: workerData.port,
|
|
35
|
+
});
|
|
36
|
+
return runtime;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
throw new Error(`Unknown runtime type: ${workerData.runtime.type}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/entrypoints/worker.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAIhD,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,qBAAqB,CAAA;AAE5B,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,OAAoC;IAC5D,MAAM,YAAY,GAAiB,MAAM,MAAM;IAC7C,mBAAmB;IACnB,SAAS,CACV,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IACxB,IAAI,OAAO,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;QACnC,UAAU,CAAC,UAAU,GAAG,CAAC,MAAW,EAAE,EAAE;YACtC,IAAI,MAAM,EAAE,CAAC;gBACX,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,OAAO,CAAC;oBACtC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;gBAC/C,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YAChC,CAAC;QACH,CAAC,CAAA;QAED,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,OAAO,CAAA;QAC9C,MAAM,SAAS,GAAG,MAAM,MAAM;QAC5B,kBAAkB;QAClB,IAAI,EACL,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;QAExB,MAAM,OAAO,GAAG,IAAI,wBAAwB,CAC1C,YAAY,EACZ,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,EAC1C,SAAS,CACV,CAAA;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;SAAM,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACnC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAA;QACjC,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,YAAY,EAAE;YACjD,QAAQ,EAAE,aAAa;YACvB,IAAI,EAAE,UAAU,CAAC,IAAI;SACtB,CAAC,CAAA;QACF,OAAO,OAAO,CAAA;IAChB,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,yBAA0B,UAAU,CAAC,OAAe,CAAC,IAAI,EAAE,CAAC,CAAA;IAC9E,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,99 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { createContractProcedure, createContractRouter, createProcedure, createRouter } from '
|
|
4
|
-
import { createConsolePrettyDestination, createExtendableClassInjectable, createFactoryInjectable, createLazyInjectable, createOptionalInjectable, createValueInjectable } from '@nmtjs/core';
|
|
5
|
-
import { createServer } from '@nmtjs/server';
|
|
1
|
+
import { createConsolePrettyDestination, createFactoryInjectable, createLazyInjectable, createValueInjectable } from '@nmtjs/core';
|
|
2
|
+
import { createTransport } from '@nmtjs/gateway';
|
|
3
|
+
import { createContractProcedure, createContractRouter, createFilter, createGuard, createHook, createJob, createMiddleware, createPlugin, createProcedure, createRootRouter, createRouter, defineApplication, defineServer } from './runtime/index.ts';
|
|
6
4
|
export declare const neemata: {
|
|
7
|
-
app: typeof
|
|
8
|
-
server: typeof
|
|
5
|
+
app: typeof defineApplication;
|
|
6
|
+
server: typeof defineServer;
|
|
9
7
|
injectables: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
pubSubAdapter: import("@nmtjs/core").LazyInjectable<import("./runtime/index.ts").PubSubAdapterType, import("@nmtjs/core").Scope.Global>;
|
|
9
|
+
pubSubPublish: import("@nmtjs/core").LazyInjectable<import("./runtime/index.ts").PubSubPublish, import("@nmtjs/core").Scope.Global>;
|
|
10
|
+
pubSubSubscribe: import("@nmtjs/core").LazyInjectable<import("./runtime/index.ts").PubSubSubscribe, import("@nmtjs/core").Scope.Global>;
|
|
11
|
+
jobManager: import("@nmtjs/core").LazyInjectable<import("./runtime/index.ts").JobManagerInstance, import("@nmtjs/core").Scope.Global>;
|
|
12
|
+
storeConfig: import("@nmtjs/core").LazyInjectable<import("./runtime/index.ts").ServerStoreConfig, import("@nmtjs/core").Scope.Global>;
|
|
13
|
+
workerType: import("@nmtjs/core").LazyInjectable<import("./runtime/enums.ts").WorkerType, import("@nmtjs/core").Scope.Global>;
|
|
14
|
+
jobWorkerPool: import("@nmtjs/core").LazyInjectable<import("./runtime/enums.ts").JobWorkerPool, import("@nmtjs/core").Scope.Global>;
|
|
15
|
+
connection: import("@nmtjs/core").LazyInjectable<import("@nmtjs/gateway").GatewayConnection, import("@nmtjs/core").Scope.Connection>;
|
|
16
|
+
connectionId: import("@nmtjs/core").LazyInjectable<string, import("@nmtjs/core").Scope.Connection>;
|
|
17
|
+
connectionData: import("@nmtjs/core").LazyInjectable<unknown, import("@nmtjs/core").Scope.Connection>;
|
|
18
18
|
connectionAbortSignal: import("@nmtjs/core").LazyInjectable<AbortSignal, import("@nmtjs/core").Scope.Connection>;
|
|
19
19
|
rpcClientAbortSignal: import("@nmtjs/core").LazyInjectable<AbortSignal, import("@nmtjs/core").Scope.Call>;
|
|
20
|
-
|
|
20
|
+
rpcStreamAbortSignal: import("@nmtjs/core").LazyInjectable<AbortSignal, import("@nmtjs/core").Scope.Call>;
|
|
21
21
|
rpcAbortSignal: import("@nmtjs/core").FactoryInjectable<AbortSignal, {
|
|
22
|
-
rpcTimeoutSignal: import("@nmtjs/core").LazyInjectable<AbortSignal, import("@nmtjs/core").Scope.Call>;
|
|
23
22
|
rpcClientAbortSignal: import("@nmtjs/core").LazyInjectable<AbortSignal, import("@nmtjs/core").Scope.Call>;
|
|
24
23
|
connectionAbortSignal: import("@nmtjs/core").LazyInjectable<AbortSignal, import("@nmtjs/core").Scope.Connection>;
|
|
24
|
+
rpcStreamAbortSignal: import("@nmtjs/core").DependencyOptional<import("@nmtjs/core").LazyInjectable<AbortSignal, import("@nmtjs/core").Scope.Call>>;
|
|
25
25
|
}, import("@nmtjs/core").Scope.Global, AbortSignal>;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
createBlob: import("@nmtjs/core").LazyInjectable<(source: import("stream").Readable | globalThis.ReadableStream | File | Blob | string | ArrayBuffer | Uint8Array, metadata?: import("@nmtjs/protocol").ProtocolBlobMetadata) => import("@nmtjs/protocol").ProtocolBlobInterface, import("@nmtjs/core").Scope.Call>;
|
|
27
|
+
logger: ((label: string) => import("@nmtjs/core").FactoryInjectable<import("@nmtjs/core").Logger, {
|
|
28
|
+
logger: import("@nmtjs/core").LazyInjectable<import("@nmtjs/core").Logger>;
|
|
29
|
+
}>) & import("@nmtjs/core").LazyInjectable<import("@nmtjs/core").Logger, import("@nmtjs/core").Scope.Global>;
|
|
30
|
+
inject: import("@nmtjs/core").LazyInjectable<(<T extends import("@nmtjs/core").AnyInjectable>(injectable: T, context: { [K in keyof T["dependencies"]]?: import("@nmtjs/core").ResolveInjectableType<T["dependencies"][K]> | import("@nmtjs/core").AnyInjectable<import("@nmtjs/core").ResolveInjectableType<T["dependencies"][K]>> | undefined; }, scope?: Exclude<import("@nmtjs/core").Scope, import("@nmtjs/core").Scope.Transient>) => Promise<import("@nmtjs/core").ResolveInjectableType<T>>) & {
|
|
31
|
+
explicit: <T extends import("@nmtjs/core").AnyInjectable>(injectable: T, context: { [K in keyof T["dependencies"]]?: import("@nmtjs/core").ResolveInjectableType<T["dependencies"][K]> | import("@nmtjs/core").AnyInjectable<import("@nmtjs/core").ResolveInjectableType<T["dependencies"][K]>> | undefined; }, scope?: Exclude<import("@nmtjs/core").Scope, import("@nmtjs/core").Scope.Transient>) => Promise<{
|
|
32
|
+
instance: Awaited<import("@nmtjs/core").ResolveInjectableType<T>>;
|
|
30
33
|
[Symbol.asyncDispose]: () => Promise<void>;
|
|
31
34
|
}>;
|
|
32
35
|
}, import("@nmtjs/core").Scope.Global>;
|
|
33
36
|
dispose: import("@nmtjs/core").LazyInjectable<(<T extends import("@nmtjs/core").AnyInjectable>(injectable: T, instance?: any) => Promise<void>), import("@nmtjs/core").Scope.Global>;
|
|
34
|
-
hook: import("@nmtjs/core").FactoryInjectable<(<T extends import("@nmtjs/core").Hook>(name: T, callback: import("@nmtjs/core").HookType[T]) => () => void), {
|
|
35
|
-
registry: import("@nmtjs/core").LazyInjectable<import("@nmtjs/core").Registry, import("@nmtjs/core").Scope.Global>;
|
|
36
|
-
}, import("@nmtjs/core").Scope.Transient, {
|
|
37
|
-
hooks: import("@nmtjs/core").Hooks;
|
|
38
|
-
on: <T extends import("@nmtjs/core").Hook>(name: T, callback: import("@nmtjs/core").HookType[T]) => () => void;
|
|
39
|
-
}>;
|
|
40
37
|
};
|
|
41
|
-
transport:
|
|
42
|
-
plugin:
|
|
38
|
+
transport: typeof createTransport;
|
|
39
|
+
plugin: typeof createPlugin;
|
|
43
40
|
logging: {
|
|
44
41
|
console: typeof createConsolePrettyDestination;
|
|
45
42
|
};
|
|
46
|
-
optional: typeof createOptionalInjectable;
|
|
47
43
|
value: typeof createValueInjectable;
|
|
48
44
|
lazy: typeof createLazyInjectable;
|
|
49
45
|
factory: typeof createFactoryInjectable;
|
|
50
|
-
|
|
51
|
-
new ($context: import("@nmtjs/core").DependencyContext<D>): {
|
|
52
|
-
$context: import("@nmtjs/core").DependencyContext<D>;
|
|
53
|
-
[kClassInjectableCreate](): Promise<void>;
|
|
54
|
-
[kClassInjectableDispose](): Promise<void>;
|
|
55
|
-
};
|
|
56
|
-
dependencies: D;
|
|
57
|
-
scope: S;
|
|
58
|
-
stack: string | undefined;
|
|
59
|
-
get label(): string;
|
|
60
|
-
[kInjectable]: boolean;
|
|
61
|
-
[kClassInjectable]: boolean;
|
|
62
|
-
}>, D, S>;
|
|
63
|
-
extendClass: typeof createExtendableClassInjectable;
|
|
64
|
-
task: typeof createTask;
|
|
46
|
+
rootRouter: typeof createRootRouter;
|
|
65
47
|
router: typeof createRouter;
|
|
66
48
|
contractRouter: typeof createContractRouter;
|
|
67
49
|
procedure: typeof createProcedure;
|
|
68
50
|
contractProcedure: typeof createContractProcedure;
|
|
69
|
-
middleware:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
dispose?: import("@nmtjs/core").InjectableDisposeType<import("@nmtjs/api").MiddlewareLike, D> | undefined;
|
|
75
|
-
}, label?: string | undefined, stackTraceDepth?: number | undefined) => import("@nmtjs/core").FactoryInjectable<import("@nmtjs/api").MiddlewareLike, D, S, import("@nmtjs/api").MiddlewareLike>;
|
|
76
|
-
guard: <D extends import("@nmtjs/core").Dependencies = {}, S extends import("@nmtjs/core").Scope = import("@nmtjs/core").Scope.Global>(paramsOrFactory: import("@nmtjs/core").InjectableFactoryType<import("@nmtjs/api").GuardLike, D> | {
|
|
77
|
-
dependencies?: D | undefined;
|
|
78
|
-
scope?: S | undefined;
|
|
79
|
-
pick?: import("@nmtjs/core").InjectablePickType<import("@nmtjs/api").GuardLike, import("@nmtjs/api").GuardLike> | undefined;
|
|
80
|
-
factory: import("@nmtjs/core").InjectableFactoryType<import("@nmtjs/api").GuardLike, D>;
|
|
81
|
-
dispose?: import("@nmtjs/core").InjectableDisposeType<import("@nmtjs/api").GuardLike, D> | undefined;
|
|
82
|
-
}, label?: string | undefined, stackTraceDepth?: number | undefined) => import("@nmtjs/core").FactoryInjectable<import("@nmtjs/api").GuardLike, D, S, import("@nmtjs/api").GuardLike>;
|
|
83
|
-
filter: <D extends import("@nmtjs/core").Dependencies = {}, S extends import("@nmtjs/core").Scope = import("@nmtjs/core").Scope.Global>(paramsOrFactory: import("@nmtjs/core").InjectableFactoryType<import("@nmtjs/api").FilterLike<import("@nmtjs/common").ErrorClass>, D> | {
|
|
84
|
-
dependencies?: D | undefined;
|
|
85
|
-
scope?: S | undefined;
|
|
86
|
-
pick?: import("@nmtjs/core").InjectablePickType<import("@nmtjs/api").FilterLike<import("@nmtjs/common").ErrorClass>, import("@nmtjs/api").FilterLike<import("@nmtjs/common").ErrorClass>> | undefined;
|
|
87
|
-
factory: import("@nmtjs/core").InjectableFactoryType<import("@nmtjs/api").FilterLike<import("@nmtjs/common").ErrorClass>, D>;
|
|
88
|
-
dispose?: import("@nmtjs/core").InjectableDisposeType<import("@nmtjs/api").FilterLike<import("@nmtjs/common").ErrorClass>, D> | undefined;
|
|
89
|
-
}, label?: string | undefined, stackTraceDepth?: number | undefined) => import("@nmtjs/core").FactoryInjectable<import("@nmtjs/api").FilterLike<import("@nmtjs/common").ErrorClass>, D, S, import("@nmtjs/api").FilterLike<import("@nmtjs/common").ErrorClass>>;
|
|
51
|
+
middleware: typeof createMiddleware;
|
|
52
|
+
guard: typeof createGuard;
|
|
53
|
+
filter: typeof createFilter;
|
|
54
|
+
job: typeof createJob;
|
|
55
|
+
hook: typeof createHook;
|
|
90
56
|
};
|
|
91
|
-
export { ApiError } from '@nmtjs/api';
|
|
92
|
-
export { WorkerType } from '@nmtjs/application';
|
|
93
57
|
export { c } from '@nmtjs/contract';
|
|
94
|
-
export {
|
|
95
|
-
export {
|
|
96
|
-
export {
|
|
58
|
+
export { Scope } from '@nmtjs/core';
|
|
59
|
+
export { type ConnectionIdentityType, GatewayHook, ProxyableTransportType, } from '@nmtjs/gateway';
|
|
60
|
+
export { ConnectionType, ErrorCode, ProtocolBlob } from '@nmtjs/protocol';
|
|
97
61
|
export { t } from '@nmtjs/type';
|
|
62
|
+
export { ApiError, defineApplication, JobWorkerPool, LifecycleHook, StoreType, WorkerType, } from './runtime/index.ts';
|
|
98
63
|
export { neemata as n };
|
|
99
64
|
export default neemata;
|