nmtjs 0.16.0-beta.9 → 0.16.1
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/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/entrypoints/worker.js +9 -9
- package/dist/entrypoints/worker.js.map +1 -1
- package/dist/index.d.ts +58 -15
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/runtime/application/index.d.ts +1 -5
- package/dist/runtime/application/index.js +1 -5
- package/dist/runtime/application/index.js.map +1 -1
- package/dist/runtime/enums.d.ts +1 -12
- package/dist/runtime/enums.js +1 -14
- package/dist/runtime/enums.js.map +1 -1
- package/dist/runtime/hooks.d.ts +1 -4
- package/dist/runtime/hooks.js +1 -3
- package/dist/runtime/hooks.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -3
- package/dist/runtime/index.js +1 -3
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/injectables.d.ts +48 -7
- package/dist/runtime/injectables.js +19 -3
- package/dist/runtime/injectables.js.map +1 -1
- package/dist/runtime/jobs/job.d.ts +1 -2
- package/dist/runtime/jobs/job.js.map +1 -1
- package/dist/runtime/jobs/router.d.ts +2 -5
- package/dist/runtime/jobs/router.js +2 -3
- package/dist/runtime/jobs/router.js.map +1 -1
- package/dist/runtime/jobs/runner.d.ts +1 -1
- package/dist/runtime/jobs/runner.js +1 -1
- package/dist/runtime/jobs/runner.js.map +1 -1
- package/dist/runtime/jobs/types.d.ts +1 -1
- package/dist/runtime/metrics/metric.d.ts +2 -2
- package/dist/runtime/metrics/metric.js +1 -1
- package/dist/runtime/metrics/metric.js.map +1 -1
- package/dist/runtime/metrics/registry.d.ts +3 -3
- package/dist/runtime/metrics/registry.js +1 -1
- package/dist/runtime/metrics/registry.js.map +1 -1
- package/dist/runtime/metrics/server.js +1 -1
- package/dist/runtime/metrics/server.js.map +1 -1
- package/dist/runtime/plugin.d.ts +2 -8
- package/dist/runtime/plugin.js +1 -3
- package/dist/runtime/plugin.js.map +1 -1
- package/dist/runtime/runtime.d.ts +2 -2
- package/dist/runtime/runtime.js +1 -2
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/server/applications.js +3 -0
- package/dist/runtime/server/applications.js.map +1 -1
- package/dist/runtime/server/config.d.ts +15 -12
- package/dist/runtime/server/config.js.map +1 -1
- package/dist/runtime/server/jobs.d.ts +6 -7
- package/dist/runtime/server/jobs.js +44 -30
- package/dist/runtime/server/jobs.js.map +1 -1
- package/dist/runtime/subscription/manager.d.ts +3 -3
- package/dist/runtime/subscription/manager.js +8 -8
- package/dist/runtime/subscription/manager.js.map +1 -1
- package/dist/runtime/subscription/redis.d.ts +1 -1
- package/dist/runtime/subscription/redis.js +16 -17
- package/dist/runtime/subscription/redis.js.map +1 -1
- package/dist/runtime/types.d.ts +3 -11
- package/dist/runtime/workers/application.d.ts +15 -33
- package/dist/runtime/workers/application.js +46 -139
- package/dist/runtime/workers/application.js.map +1 -1
- package/dist/runtime/workers/base.d.ts +0 -2
- package/dist/runtime/workers/base.js +3 -8
- package/dist/runtime/workers/base.js.map +1 -1
- package/dist/runtime/workers/job.js +2 -1
- package/dist/runtime/workers/job.js.map +1 -1
- package/dist/vite/server.js +1 -1
- package/dist/vite/server.js.map +1 -1
- package/package.json +19 -14
- package/src/cli.ts +2 -3
- package/src/entrypoints/worker.ts +11 -9
- package/src/index.ts +12 -5
- package/src/runtime/application/index.ts +1 -5
- package/src/runtime/enums.ts +2 -14
- package/src/runtime/hooks.ts +1 -5
- package/src/runtime/index.ts +2 -3
- package/src/runtime/injectables.ts +35 -6
- package/src/runtime/jobs/job.ts +1 -2
- package/src/runtime/jobs/router.ts +12 -15
- package/src/runtime/jobs/runner.ts +2 -2
- package/src/runtime/jobs/types.ts +1 -1
- package/src/runtime/metrics/metric.ts +2 -2
- package/src/runtime/metrics/registry.ts +5 -1
- package/src/runtime/metrics/server.ts +1 -1
- package/src/runtime/plugin.ts +2 -13
- package/src/runtime/runtime.ts +2 -4
- package/src/runtime/server/applications.ts +6 -0
- package/src/runtime/server/config.ts +27 -21
- package/src/runtime/server/jobs.ts +58 -34
- package/src/runtime/subscription/manager.ts +11 -14
- package/src/runtime/subscription/redis.ts +25 -23
- package/src/runtime/types.ts +3 -12
- package/src/runtime/workers/application.ts +76 -160
- package/src/runtime/workers/base.ts +9 -15
- package/src/runtime/workers/job.ts +3 -6
- package/src/vite/server.ts +1 -1
- package/dist/runtime/application/api/api.d.ts +0 -55
- package/dist/runtime/application/api/api.js +0 -252
- package/dist/runtime/application/api/api.js.map +0 -1
- package/dist/runtime/application/api/config.d.ts +0 -14
- package/dist/runtime/application/api/config.js +0 -6
- package/dist/runtime/application/api/config.js.map +0 -1
- package/dist/runtime/application/api/constants.d.ts +0 -14
- package/dist/runtime/application/api/constants.js +0 -8
- package/dist/runtime/application/api/constants.js.map +0 -1
- package/dist/runtime/application/api/filters.d.ts +0 -14
- package/dist/runtime/application/api/filters.js +0 -11
- package/dist/runtime/application/api/filters.js.map +0 -1
- package/dist/runtime/application/api/guards.d.ts +0 -15
- package/dist/runtime/application/api/guards.js +0 -8
- package/dist/runtime/application/api/guards.js.map +0 -1
- package/dist/runtime/application/api/index.d.ts +0 -23
- package/dist/runtime/application/api/index.js +0 -17
- package/dist/runtime/application/api/index.js.map +0 -1
- package/dist/runtime/application/api/logging.d.ts +0 -14
- package/dist/runtime/application/api/logging.js +0 -77
- package/dist/runtime/application/api/logging.js.map +0 -1
- package/dist/runtime/application/api/meta.d.ts +0 -21
- package/dist/runtime/application/api/meta.js +0 -2
- package/dist/runtime/application/api/meta.js.map +0 -1
- package/dist/runtime/application/api/middlewares.d.ts +0 -14
- package/dist/runtime/application/api/middlewares.js +0 -12
- package/dist/runtime/application/api/middlewares.js.map +0 -1
- package/dist/runtime/application/api/procedure.d.ts +0 -71
- package/dist/runtime/application/api/procedure.js +0 -41
- package/dist/runtime/application/api/procedure.js.map +0 -1
- package/dist/runtime/application/api/router.d.ts +0 -93
- package/dist/runtime/application/api/router.js +0 -55
- package/dist/runtime/application/api/router.js.map +0 -1
- package/dist/runtime/application/api/types.d.ts +0 -38
- package/dist/runtime/application/api/types.js +0 -2
- package/dist/runtime/application/api/types.js.map +0 -1
- package/dist/runtime/application/config.d.ts +0 -28
- package/dist/runtime/application/config.js +0 -25
- package/dist/runtime/application/config.js.map +0 -1
- package/dist/runtime/application/constants.d.ts +0 -2
- package/dist/runtime/application/constants.js +0 -2
- package/dist/runtime/application/constants.js.map +0 -1
- package/dist/runtime/application/hook.d.ts +0 -19
- package/dist/runtime/application/hook.js +0 -11
- package/dist/runtime/application/hook.js.map +0 -1
- package/dist/runtime/application/hooks.d.ts +0 -3
- package/dist/runtime/application/hooks.js +0 -4
- package/dist/runtime/application/hooks.js.map +0 -1
- package/src/runtime/application/api/api.ts +0 -406
- package/src/runtime/application/api/config.ts +0 -18
- package/src/runtime/application/api/constants.ts +0 -22
- package/src/runtime/application/api/filters.ts +0 -39
- package/src/runtime/application/api/guards.ts +0 -33
- package/src/runtime/application/api/index.ts +0 -69
- package/src/runtime/application/api/logging.ts +0 -110
- package/src/runtime/application/api/meta.ts +0 -37
- package/src/runtime/application/api/middlewares.ts +0 -37
- package/src/runtime/application/api/procedure.ts +0 -224
- package/src/runtime/application/api/router.ts +0 -247
- package/src/runtime/application/api/types.ts +0 -138
- package/src/runtime/application/config.ts +0 -82
- package/src/runtime/application/constants.ts +0 -4
- package/src/runtime/application/hook.ts +0 -51
- package/src/runtime/application/hooks.ts +0 -3
|
@@ -50,8 +50,9 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
50
50
|
var e = new Error(message);
|
|
51
51
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
52
|
});
|
|
53
|
+
import { LifecycleHook } from '@nmtjs/application';
|
|
53
54
|
import { UnrecoverableError } from 'bullmq';
|
|
54
|
-
import {
|
|
55
|
+
import { WorkerType } from '../enums.js';
|
|
55
56
|
import { jobWorkerPool } from '../injectables.js';
|
|
56
57
|
import { ApplicationWorkerJobRunner } from '../jobs/runner.js';
|
|
57
58
|
import { BaseWorkerRuntime } from './base.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job.js","sourceRoot":"","sources":["../../../src/runtime/workers/job.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"job.js","sourceRoot":"","sources":["../../../src/runtime/workers/job.ts"],"names":[],"mappings":"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"}
|
package/dist/vite/server.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createServer as createViteServer } from 'vite';
|
|
|
3
3
|
// When externalized, Vite's ModuleRunner uses native Node import() which has
|
|
4
4
|
// a separate module cache from Vite's cache, causing the same module to be
|
|
5
5
|
// loaded twice with different object references.
|
|
6
|
-
const noExternalPackages = ['nmtjs', /^@nmtjs
|
|
6
|
+
const noExternalPackages = ['nmtjs', /^@nmtjs\/(?!prom-client$)/];
|
|
7
7
|
export function createServer(options, config, dev = {}) {
|
|
8
8
|
const usePolling = !!process.env.CI;
|
|
9
9
|
return createViteServer({
|
package/dist/vite/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/vite/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAA;AAIvD,wEAAwE;AACxE,6EAA6E;AAC7E,2EAA2E;AAC3E,iDAAiD;AACjD,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/vite/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAA;AAIvD,wEAAwE;AACxE,6EAA6E;AAC7E,2EAA2E;AAC3E,iDAAiD;AACjD,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,2BAA2B,CAAC,CAAA;AAEjE,MAAM,UAAU,YAAY,CAC1B,OAA0B,EAC1B,MAAkB,EAClB,GAAG,GAA0B,EAAE;IAE/B,MAAM,UAAU,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAA;IAEnC,OAAO,gBAAgB,CAAC;QACtB,GAAG,MAAM;QACT,MAAM,EAAE;YACN,cAAc,EAAE,IAAI;YACpB,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;SACrD;QACD,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE;QACnD,YAAY,EAAE;YACZ,OAAO,EAAE;gBACP,QAAQ,EAAE,QAAQ;gBAClB,GAAG;gBACH,OAAO,EAAE;oBACP,iEAAiE;oBACjE,UAAU,EAAE,kBAAkB;iBAC/B;gBACD,MAAM,EAAE;oBACN,eAAe,EAAE,IAAI,CAAC,SAAS,CAC7B,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAC/C;oBACD,uBAAuB,EAAE,IAAI,CAAC,SAAS,CACrC,IAAI,CAAC,SAAS,CACZ,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAC5C,CAAC,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;wBAC7B,OAAO;wBACP,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE;qBAC1B,CACF,CACF,CACF,CACF;iBACF;aACF;SACF;KACF,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -33,25 +33,26 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"
|
|
36
|
+
"@nmtjs/prom-client": "1.0.1",
|
|
37
|
+
"bullmq": "5.77.0",
|
|
37
38
|
"citty": "0.2.2",
|
|
38
39
|
"dedent": "^1.7.2",
|
|
39
40
|
"dotenv": "^17.4.2",
|
|
40
41
|
"ioredis": "^5.10.1",
|
|
41
42
|
"iovalkey": "^0.3.3",
|
|
42
43
|
"oxc-resolver": "11.19.1",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"@nmtjs/
|
|
46
|
-
"@nmtjs/
|
|
47
|
-
"@nmtjs/
|
|
48
|
-
"@nmtjs/
|
|
49
|
-
"@nmtjs/
|
|
50
|
-
"@nmtjs/
|
|
51
|
-
"@nmtjs/json-format": "0.16.
|
|
52
|
-
"@nmtjs/
|
|
53
|
-
"@nmtjs/
|
|
54
|
-
"@nmtjs/
|
|
44
|
+
"vite": "8.0.14",
|
|
45
|
+
"@nmtjs/application": "0.16.1",
|
|
46
|
+
"@nmtjs/contract": "0.16.1",
|
|
47
|
+
"@nmtjs/common": "0.16.1",
|
|
48
|
+
"@nmtjs/core": "0.16.1",
|
|
49
|
+
"@nmtjs/gateway": "0.16.1",
|
|
50
|
+
"@nmtjs/protocol": "0.16.1",
|
|
51
|
+
"@nmtjs/http-transport": "0.16.1",
|
|
52
|
+
"@nmtjs/json-format": "0.16.1",
|
|
53
|
+
"@nmtjs/type": "0.16.1",
|
|
54
|
+
"@nmtjs/msgpack-format": "0.16.1",
|
|
55
|
+
"@nmtjs/ws-transport": "0.16.1"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@nmtjs/proxy": "1.0.0-beta.6",
|
|
@@ -74,7 +75,11 @@
|
|
|
74
75
|
"LICENSE.md",
|
|
75
76
|
"README.md"
|
|
76
77
|
],
|
|
77
|
-
"version": "0.16.
|
|
78
|
+
"version": "0.16.1",
|
|
79
|
+
"repository": {
|
|
80
|
+
"type": "git",
|
|
81
|
+
"url": "https://github.com/neematajs/neemata"
|
|
82
|
+
},
|
|
78
83
|
"scripts": {
|
|
79
84
|
"clean-build": "rm -rf ./dist"
|
|
80
85
|
}
|
package/src/cli.ts
CHANGED
|
@@ -75,9 +75,8 @@ const mainCommand = defineCommand({
|
|
|
75
75
|
applicationImports = {}
|
|
76
76
|
const currentPkg = resolver.sync(process.cwd(), './package.json')
|
|
77
77
|
|
|
78
|
-
for (const [appName,
|
|
79
|
-
|
|
80
|
-
)) {
|
|
78
|
+
for (const [appName, application] of Object.entries(config.applications)) {
|
|
79
|
+
const { specifier: appSpecifier, type } = application
|
|
81
80
|
const resolution = resolver.sync(process.cwd(), appSpecifier)
|
|
82
81
|
if (resolution.error)
|
|
83
82
|
throw new Error(
|
|
@@ -4,7 +4,7 @@ import type { ServerConfig } from '../runtime/index.ts'
|
|
|
4
4
|
import type { RunWorkerOptions } from './thread.ts'
|
|
5
5
|
import {
|
|
6
6
|
ApplicationWorkerRuntime,
|
|
7
|
-
|
|
7
|
+
isApplicationHostDefinition,
|
|
8
8
|
JobWorkerRuntime,
|
|
9
9
|
} from '../runtime/index.ts'
|
|
10
10
|
|
|
@@ -38,21 +38,21 @@ async function initializeApplicationWorker(
|
|
|
38
38
|
) {
|
|
39
39
|
const { name, path, transportsData } = options
|
|
40
40
|
|
|
41
|
-
// Load initial application
|
|
42
|
-
const
|
|
41
|
+
// Load initial application host definition
|
|
42
|
+
const hostDefinition = await import(
|
|
43
43
|
/* @vite-ignore */
|
|
44
44
|
path
|
|
45
45
|
).then((m) => m.default)
|
|
46
46
|
|
|
47
|
-
if (!
|
|
48
|
-
throw new Error(`Invalid application
|
|
47
|
+
if (!isApplicationHostDefinition(hostDefinition)) {
|
|
48
|
+
throw new Error(`Invalid application host definition: ${name}`)
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// Create runtime
|
|
52
52
|
const runtime = new ApplicationWorkerRuntime(
|
|
53
53
|
serverConfig,
|
|
54
54
|
{ name, path, transports: transportsData },
|
|
55
|
-
|
|
55
|
+
hostDefinition,
|
|
56
56
|
)
|
|
57
57
|
|
|
58
58
|
// Set up HMR with supersede logic
|
|
@@ -62,7 +62,7 @@ async function initializeApplicationWorker(
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
* Set up HMR acceptance for application
|
|
65
|
+
* Set up HMR acceptance for application host definition changes with supersede logic.
|
|
66
66
|
*
|
|
67
67
|
* When a reload is in progress and another HMR event arrives, the pending
|
|
68
68
|
* reload is superseded - only the most recent config is applied.
|
|
@@ -147,8 +147,10 @@ function setupApplicationHMR(runtime: ApplicationWorkerRuntime) {
|
|
|
147
147
|
logger.debug('Received HMR update')
|
|
148
148
|
if (!module) return
|
|
149
149
|
|
|
150
|
-
if (!
|
|
151
|
-
logger.error(
|
|
150
|
+
if (!isApplicationHostDefinition(module.default)) {
|
|
151
|
+
logger.error(
|
|
152
|
+
new Error('Invalid application host definition during HMR reload'),
|
|
153
|
+
)
|
|
152
154
|
return
|
|
153
155
|
}
|
|
154
156
|
|
package/src/index.ts
CHANGED
|
@@ -15,19 +15,22 @@ import {
|
|
|
15
15
|
createContractProcedure,
|
|
16
16
|
createContractRouter,
|
|
17
17
|
createFilter,
|
|
18
|
+
defineApplicationHost,
|
|
18
19
|
createGuard,
|
|
19
20
|
createHook,
|
|
20
|
-
createJob,
|
|
21
|
-
createJobRouterOperation,
|
|
22
|
-
createJobsRouter,
|
|
23
21
|
createMeta,
|
|
24
22
|
createMiddleware,
|
|
25
23
|
createPlugin,
|
|
26
24
|
createProcedure,
|
|
27
25
|
createRootRouter,
|
|
28
26
|
createRouter,
|
|
29
|
-
createStep,
|
|
30
27
|
defineApplication,
|
|
28
|
+
} from '@nmtjs/application'
|
|
29
|
+
import {
|
|
30
|
+
createJob,
|
|
31
|
+
createJobRouterOperation,
|
|
32
|
+
createJobsRouter,
|
|
33
|
+
createStep,
|
|
31
34
|
defineServer,
|
|
32
35
|
RuntimeInjectables,
|
|
33
36
|
} from './runtime/index.ts'
|
|
@@ -40,6 +43,7 @@ import {
|
|
|
40
43
|
|
|
41
44
|
export namespace neemata {
|
|
42
45
|
export const app = defineApplication
|
|
46
|
+
export const host = defineApplicationHost
|
|
43
47
|
export const server = defineServer
|
|
44
48
|
export const injectables = Object.freeze({
|
|
45
49
|
...CoreInjectables,
|
|
@@ -90,9 +94,12 @@ export { t } from '@nmtjs/type'
|
|
|
90
94
|
|
|
91
95
|
export {
|
|
92
96
|
ApiError,
|
|
97
|
+
defineApplicationHost,
|
|
93
98
|
defineApplication,
|
|
94
|
-
JobWorkerPool,
|
|
95
99
|
LifecycleHook,
|
|
100
|
+
} from '@nmtjs/application'
|
|
101
|
+
|
|
102
|
+
export {
|
|
96
103
|
StoreType,
|
|
97
104
|
WorkerType,
|
|
98
105
|
} from './runtime/index.ts'
|
package/src/runtime/enums.ts
CHANGED
|
@@ -3,22 +3,10 @@ export enum StoreType {
|
|
|
3
3
|
Valkey = 'Valkey',
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
export enum JobWorkerPool {
|
|
7
|
-
Io = 'Io',
|
|
8
|
-
Compute = 'Compute',
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export enum LifecycleHook {
|
|
12
|
-
BeforeInitialize = 'lifecycle:beforeInitialize',
|
|
13
|
-
AfterInitialize = 'lifecycle:afterInitialize',
|
|
14
|
-
BeforeDispose = 'lifecycle:beforeDispose',
|
|
15
|
-
AfterDispose = 'lifecycle:afterDispose',
|
|
16
|
-
Stop = 'lifecycle:stop',
|
|
17
|
-
Start = 'lifecycle:start',
|
|
18
|
-
}
|
|
19
|
-
|
|
20
6
|
export enum WorkerType {
|
|
21
7
|
Application = 'Application',
|
|
22
8
|
Job = 'Job',
|
|
23
9
|
Command = 'Command',
|
|
24
10
|
}
|
|
11
|
+
|
|
12
|
+
export { LifecycleHook } from '@nmtjs/application'
|
package/src/runtime/hooks.ts
CHANGED
package/src/runtime/index.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from '@nmtjs/application'
|
|
2
|
+
|
|
2
3
|
export * from './constants.ts'
|
|
3
4
|
export * from './enums.ts'
|
|
4
|
-
export * from './hooks.ts'
|
|
5
5
|
export * from './injectables.ts'
|
|
6
6
|
export * from './jobs/job.ts'
|
|
7
7
|
export * from './jobs/manager.ts'
|
|
8
8
|
export * from './jobs/router.ts'
|
|
9
9
|
export * from './jobs/step.ts'
|
|
10
10
|
export * from './jobs/types.ts'
|
|
11
|
-
export * from './plugin.ts'
|
|
12
11
|
export * from './runtime.ts'
|
|
13
12
|
export * from './scheduler/index.ts'
|
|
14
13
|
export * from './server/config.ts'
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
CoreInjectables,
|
|
3
|
+
createFactoryInjectable,
|
|
4
|
+
createLazyInjectable,
|
|
5
|
+
Scope,
|
|
6
|
+
} from '@nmtjs/core'
|
|
2
7
|
|
|
3
|
-
import type {
|
|
8
|
+
import type { WorkerType } from './enums.ts'
|
|
4
9
|
import type { JobManagerInstance } from './jobs/manager.ts'
|
|
5
10
|
import type { JobExecutionContext, SaveJobProgress } from './jobs/types.ts'
|
|
6
11
|
import type { ServerStoreConfig } from './server/config.ts'
|
|
@@ -9,6 +14,7 @@ import type {
|
|
|
9
14
|
SubscribeFn,
|
|
10
15
|
SubscriptionAdapterType,
|
|
11
16
|
} from './subscription/manager.ts'
|
|
17
|
+
import { SubscriptionManager } from './subscription/manager.ts'
|
|
12
18
|
|
|
13
19
|
export const subscriptionAdapter =
|
|
14
20
|
createLazyInjectable<SubscriptionAdapterType>(
|
|
@@ -16,10 +22,32 @@ export const subscriptionAdapter =
|
|
|
16
22
|
'SubscriptionAdapter',
|
|
17
23
|
)
|
|
18
24
|
|
|
19
|
-
export const
|
|
25
|
+
export const subscriptionManager = createFactoryInjectable(
|
|
26
|
+
{
|
|
27
|
+
dependencies: {
|
|
28
|
+
adapter: subscriptionAdapter,
|
|
29
|
+
logger: CoreInjectables.logger,
|
|
30
|
+
},
|
|
31
|
+
factory: ({ adapter, logger }) =>
|
|
32
|
+
new SubscriptionManager({ logger, adapter }),
|
|
33
|
+
dispose: (manager) => manager.dispose(),
|
|
34
|
+
},
|
|
35
|
+
'SubscriptionManager',
|
|
36
|
+
)
|
|
20
37
|
|
|
21
|
-
export const
|
|
22
|
-
|
|
38
|
+
export const publish = createFactoryInjectable(
|
|
39
|
+
{
|
|
40
|
+
dependencies: { manager: subscriptionManager },
|
|
41
|
+
factory: ({ manager }): PublishFn => manager.publish.bind(manager),
|
|
42
|
+
},
|
|
43
|
+
'Publish',
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
export const subscribe = createFactoryInjectable(
|
|
47
|
+
{
|
|
48
|
+
dependencies: { manager: subscriptionManager },
|
|
49
|
+
factory: ({ manager }): SubscribeFn => manager.subscribe.bind(manager),
|
|
50
|
+
},
|
|
23
51
|
'Subscribe',
|
|
24
52
|
)
|
|
25
53
|
|
|
@@ -38,7 +66,7 @@ export const workerType = createLazyInjectable<WorkerType>(
|
|
|
38
66
|
'WorkerType',
|
|
39
67
|
)
|
|
40
68
|
|
|
41
|
-
export const jobWorkerPool = createLazyInjectable<
|
|
69
|
+
export const jobWorkerPool = createLazyInjectable<string>(
|
|
42
70
|
Scope.Global,
|
|
43
71
|
'JobWorkerPool',
|
|
44
72
|
)
|
|
@@ -60,6 +88,7 @@ export const currentJobInfo = createLazyInjectable<JobExecutionContext>(
|
|
|
60
88
|
|
|
61
89
|
export const RuntimeInjectables = {
|
|
62
90
|
subscriptionAdapter,
|
|
91
|
+
subscriptionManager,
|
|
63
92
|
publish,
|
|
64
93
|
subscribe,
|
|
65
94
|
jobManager,
|
package/src/runtime/jobs/job.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { t } from '@nmtjs/type'
|
|
|
4
4
|
import type { AnyObjectLikeType, ObjectType } from '@nmtjs/type/object'
|
|
5
5
|
import { tryCaptureStackTrace } from '@nmtjs/common'
|
|
6
6
|
|
|
7
|
-
import type { JobWorkerPool } from '../enums.ts'
|
|
8
7
|
import type { AnyJobStep, JobStep } from './step.ts'
|
|
9
8
|
import { kJobKey } from '../constants.ts'
|
|
10
9
|
import { isJobStep } from './step.ts'
|
|
@@ -200,7 +199,7 @@ export interface JobOptions<
|
|
|
200
199
|
Data = any,
|
|
201
200
|
> {
|
|
202
201
|
name: Name
|
|
203
|
-
pool:
|
|
202
|
+
pool: string
|
|
204
203
|
input: Input
|
|
205
204
|
output: Output
|
|
206
205
|
progress?: Progress
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AnyGuard,
|
|
3
|
+
AnyMiddleware,
|
|
4
|
+
AnyProcedure,
|
|
5
|
+
AnyRouter,
|
|
6
|
+
AnyRouterMetaBinding,
|
|
7
|
+
ProcedureMetaBinding,
|
|
8
|
+
Router,
|
|
9
|
+
} from '@nmtjs/application'
|
|
1
10
|
import type { MaybePromise } from '@nmtjs/common'
|
|
2
11
|
import type { TProcedureContract, TRouterContract } from '@nmtjs/contract'
|
|
3
12
|
import type { Dependencies, DependencyContext } from '@nmtjs/core'
|
|
4
13
|
import type { NullableType, OptionalType } from '@nmtjs/type'
|
|
5
14
|
import type { NeverType } from '@nmtjs/type/never'
|
|
15
|
+
import { createProcedure, createRouter } from '@nmtjs/application'
|
|
6
16
|
import { CoreInjectables } from '@nmtjs/core'
|
|
7
17
|
import { t } from '@nmtjs/type'
|
|
8
18
|
|
|
9
|
-
import type { AnyGuard } from '../application/api/guards.ts'
|
|
10
|
-
import type { AnyMiddleware } from '../application/api/middlewares.ts'
|
|
11
|
-
import type {
|
|
12
|
-
AnyProcedure,
|
|
13
|
-
ProcedureMetaBinding,
|
|
14
|
-
} from '../application/api/procedure.ts'
|
|
15
|
-
import type {
|
|
16
|
-
AnyRouter,
|
|
17
|
-
AnyRouterMetaBinding,
|
|
18
|
-
Router,
|
|
19
|
-
} from '../application/api/router.ts'
|
|
20
19
|
import type { AnyJob } from './job.ts'
|
|
21
20
|
import type { JobStatus } from './types.ts'
|
|
22
|
-
import { createProcedure } from '../application/api/procedure.ts'
|
|
23
|
-
import { createRouter } from '../application/api/router.ts'
|
|
24
21
|
import { jobManager } from '../injectables.ts'
|
|
25
22
|
|
|
26
23
|
// ============================================================================
|
|
@@ -196,7 +193,7 @@ type JobItemSchemaType<T extends AnyJob> = t.ObjectType<{
|
|
|
196
193
|
startedAt: OptionalType<t.NumberType>
|
|
197
194
|
completedAt: OptionalType<t.NumberType>
|
|
198
195
|
error: OptionalType<t.StringType>
|
|
199
|
-
stacktrace:
|
|
196
|
+
stacktrace: NullableType<t.ArrayType<t.StringType>>
|
|
200
197
|
}>
|
|
201
198
|
|
|
202
199
|
/** Type-level representation of createListOutputSchema output */
|
|
@@ -326,7 +323,7 @@ function createJobItemSchema<T extends AnyJob>(job: T): JobItemSchemaType<T> {
|
|
|
326
323
|
startedAt: t.number().optional(),
|
|
327
324
|
completedAt: t.number().optional(),
|
|
328
325
|
error: t.string().optional(),
|
|
329
|
-
stacktrace: t.array(t.string()).
|
|
326
|
+
stacktrace: t.array(t.string()).nullable(),
|
|
330
327
|
})
|
|
331
328
|
}
|
|
332
329
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { LifecycleHooks } from '@nmtjs/application'
|
|
1
2
|
import type { Container, Logger, LoggingOptions } from '@nmtjs/core'
|
|
2
3
|
import type { Job } from 'bullmq'
|
|
4
|
+
import { LifecycleHook } from '@nmtjs/application'
|
|
3
5
|
import { anyAbortSignal } from '@nmtjs/common'
|
|
4
6
|
import { Scope } from '@nmtjs/core'
|
|
5
7
|
import { UnrecoverableError } from 'bullmq'
|
|
6
8
|
|
|
7
|
-
import type { LifecycleHooks } from '../hooks.ts'
|
|
8
9
|
import type { AnyJob } from './job.ts'
|
|
9
10
|
import type { AnyJobStep } from './step.ts'
|
|
10
11
|
import type {
|
|
@@ -12,7 +13,6 @@ import type {
|
|
|
12
13
|
JobProgressCheckpoint,
|
|
13
14
|
StepResultEntry,
|
|
14
15
|
} from './types.ts'
|
|
15
|
-
import { LifecycleHook } from '../enums.ts'
|
|
16
16
|
import {
|
|
17
17
|
currentJobInfo,
|
|
18
18
|
jobAbortSignal,
|
|
@@ -105,7 +105,7 @@ export interface JobItem<TInput = unknown, TOutput = unknown> {
|
|
|
105
105
|
/** Error message if job failed */
|
|
106
106
|
error?: string
|
|
107
107
|
/** Stack trace if job failed */
|
|
108
|
-
stacktrace
|
|
108
|
+
stacktrace: string[] | null
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
// ============================================================================
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClassConstructorArgs } from '@nmtjs/common'
|
|
2
|
-
import type { Metric, MetricConfiguration } from 'prom-client'
|
|
3
|
-
import { Counter, Gauge, Histogram, Summary } from 'prom-client'
|
|
2
|
+
import type { Metric, MetricConfiguration } from '@nmtjs/prom-client'
|
|
3
|
+
import { Counter, Gauge, Histogram, Summary } from '@nmtjs/prom-client'
|
|
4
4
|
|
|
5
5
|
import { registry } from './registry.ts'
|
|
6
6
|
|
package/src/runtime/plugin.ts
CHANGED
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { LifecycleHooks } from './hooks.ts'
|
|
4
|
-
|
|
5
|
-
export interface RuntimePlugin {
|
|
6
|
-
name: string
|
|
7
|
-
hooks?: LifecycleHooks['_']['config']
|
|
8
|
-
injections?: Provision[]
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function createPlugin<T extends RuntimePlugin>(plugin: T): T {
|
|
12
|
-
return plugin
|
|
13
|
-
}
|
|
1
|
+
export type { RuntimePlugin } from '@nmtjs/application'
|
|
2
|
+
export { createPlugin } from '@nmtjs/application'
|
package/src/runtime/runtime.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { RuntimePlugin } from '@nmtjs/application'
|
|
1
2
|
import type {
|
|
2
3
|
AnyInjectable,
|
|
3
4
|
Dependant,
|
|
4
5
|
Logger,
|
|
5
6
|
LoggingOptions,
|
|
6
7
|
} from '@nmtjs/core'
|
|
8
|
+
import { LifecycleHook, LifecycleHooks } from '@nmtjs/application'
|
|
7
9
|
import {
|
|
8
10
|
Container,
|
|
9
11
|
createLogger,
|
|
@@ -11,10 +13,6 @@ import {
|
|
|
11
13
|
Scope,
|
|
12
14
|
} from '@nmtjs/core'
|
|
13
15
|
|
|
14
|
-
import type { RuntimePlugin } from './plugin.ts'
|
|
15
|
-
import { LifecycleHook } from './enums.ts'
|
|
16
|
-
import { LifecycleHooks } from './hooks.ts'
|
|
17
|
-
|
|
18
16
|
export type BaseRuntimeOptions = {
|
|
19
17
|
logger?: LoggingOptions
|
|
20
18
|
container?: Container
|
|
@@ -120,6 +120,12 @@ export class ApplicationServerApplications extends EventEmitter<{
|
|
|
120
120
|
|
|
121
121
|
// Add workers to the pool
|
|
122
122
|
for (let i = 0; i < threadsConfig.length; i++) {
|
|
123
|
+
if (applicationPath.type !== 'neemata') {
|
|
124
|
+
throw new Error(
|
|
125
|
+
`Unsupported custom application worker: ${applicationName}`,
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
123
129
|
const workerData = {
|
|
124
130
|
runtime: {
|
|
125
131
|
type: 'application',
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ApplicationHost,
|
|
3
|
+
ApplicationHostDefinition,
|
|
4
|
+
TransportOptionsOf,
|
|
5
|
+
} from '@nmtjs/application'
|
|
1
6
|
import type { LoggingOptions } from '@nmtjs/core'
|
|
2
|
-
import type { Transport } from '@nmtjs/gateway'
|
|
3
7
|
import type { ApplicationOptions } from '@nmtjs/proxy'
|
|
4
8
|
import type { Applications } from 'nmtjs/runtime/types'
|
|
5
9
|
|
|
6
|
-
import type {
|
|
7
|
-
import type { JobWorkerPool, StoreType } from '../enums.ts'
|
|
10
|
+
import type { StoreType } from '../enums.ts'
|
|
8
11
|
import type { AnyJob } from '../jobs/job.ts'
|
|
9
12
|
import type { JobsSchedulerOptions } from '../scheduler/index.ts'
|
|
10
13
|
import type { SubscriptionAdapterType } from '../subscription/manager.ts'
|
|
@@ -26,25 +29,23 @@ export type ServerStoreConfig =
|
|
|
26
29
|
| { type: StoreType.Redis; options: StoreTypeOptions[StoreType.Redis] }
|
|
27
30
|
| { type: StoreType.Valkey; options: StoreTypeOptions[StoreType.Valkey] }
|
|
28
31
|
|
|
29
|
-
export type ServerApplicationConfig<T =
|
|
30
|
-
T extends
|
|
32
|
+
export type ServerApplicationConfig<T = ApplicationHostDefinition> =
|
|
33
|
+
T extends ApplicationHostDefinition<any, infer Transports>
|
|
31
34
|
? {
|
|
32
35
|
threads: {
|
|
33
|
-
[K in keyof Transports]: Transports[K]
|
|
34
|
-
any,
|
|
35
|
-
infer Options
|
|
36
|
-
>
|
|
37
|
-
? Options
|
|
38
|
-
: never
|
|
36
|
+
[K in keyof Transports]: TransportOptionsOf<Transports[K]>
|
|
39
37
|
}[]
|
|
40
38
|
}
|
|
41
|
-
:
|
|
39
|
+
: T extends ApplicationHost<infer Transports>
|
|
40
|
+
? {
|
|
41
|
+
threads: {
|
|
42
|
+
[K in keyof Transports]: TransportOptionsOf<Transports[K]>
|
|
43
|
+
}[]
|
|
44
|
+
}
|
|
45
|
+
: any
|
|
42
46
|
|
|
43
47
|
export type ServerJobsConfig = {
|
|
44
|
-
pools:
|
|
45
|
-
[JobWorkerPool.Io]: ServerPoolOptions
|
|
46
|
-
[JobWorkerPool.Compute]: ServerPoolOptions
|
|
47
|
-
}
|
|
48
|
+
pools: Record<string, ServerPoolOptions>
|
|
48
49
|
jobs?: AnyJob[]
|
|
49
50
|
/**
|
|
50
51
|
* @deprecated Scheduler is currently being refactored and is not available.
|
|
@@ -53,14 +54,19 @@ export type ServerJobsConfig = {
|
|
|
53
54
|
scheduler?: JobsSchedulerOptions
|
|
54
55
|
}
|
|
55
56
|
|
|
57
|
+
type ServerApplicationDefinitionConfig<T> = T extends {
|
|
58
|
+
type: 'neemata'
|
|
59
|
+
definition: infer Definition
|
|
60
|
+
}
|
|
61
|
+
? ServerApplicationConfig<Definition>
|
|
62
|
+
: ServerApplicationConfig<any>
|
|
63
|
+
|
|
56
64
|
export interface ServerConfigInit {
|
|
57
65
|
logger: LoggingOptions
|
|
58
66
|
applications: {
|
|
59
|
-
[K in keyof Applications]:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
>
|
|
63
|
-
: ServerApplicationConfig<any>
|
|
67
|
+
[K in keyof Applications]: ServerApplicationDefinitionConfig<
|
|
68
|
+
Applications[K]
|
|
69
|
+
>
|
|
64
70
|
}
|
|
65
71
|
store?: ServerStoreConfig
|
|
66
72
|
/**
|