nmtjs 0.15.3 → 0.16.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/dist/cli.js.map +1 -1
- package/dist/codegen.js.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/entrypoints/main.js.map +1 -1
- package/dist/entrypoints/thread.js.map +1 -1
- package/dist/entrypoints/worker.js.map +1 -1
- package/dist/index.d.ts +32 -21
- package/dist/index.js +8 -6
- 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 +3 -20
- 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 +3 -5
- package/dist/runtime/index.js +3 -5
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/injectables.d.ts +10 -10
- package/dist/runtime/injectables.js +6 -6
- package/dist/runtime/injectables.js.map +1 -1
- package/dist/runtime/jobs/job.d.ts +4 -4
- package/dist/runtime/jobs/job.js.map +1 -1
- package/dist/runtime/jobs/manager.js.map +1 -1
- package/dist/runtime/jobs/router.d.ts +31 -13
- package/dist/runtime/jobs/router.js +14 -11
- 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/step.js.map +1 -1
- package/dist/runtime/metrics/server.js +21 -9
- 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/scheduler/index.js.map +1 -1
- package/dist/runtime/server/applications.js.map +1 -1
- package/dist/runtime/server/config.d.ts +8 -19
- package/dist/runtime/server/config.js +2 -3
- package/dist/runtime/server/config.js.map +1 -1
- package/dist/runtime/server/environment.js.map +1 -1
- package/dist/runtime/server/error-policy.js.map +1 -1
- package/dist/runtime/server/hmr-coordinator.js.map +1 -1
- package/dist/runtime/server/jobs.d.ts +7 -11
- package/dist/runtime/server/jobs.js +45 -71
- package/dist/runtime/server/jobs.js.map +1 -1
- package/dist/runtime/server/lifecycle.js.map +1 -1
- package/dist/runtime/server/managed-worker.js.map +1 -1
- package/dist/runtime/server/pool-manager.js.map +1 -1
- package/dist/runtime/server/proxy.js.map +1 -1
- package/dist/runtime/server/server.js.map +1 -1
- package/dist/runtime/server/worker-pool.js.map +1 -1
- package/dist/runtime/store/index.js.map +1 -1
- package/dist/runtime/{pubsub → subscription}/manager.d.ts +15 -14
- package/dist/runtime/{pubsub → subscription}/manager.js +59 -8
- package/dist/runtime/subscription/manager.js.map +1 -0
- package/dist/runtime/subscription/redis.d.ts +18 -0
- package/dist/runtime/{pubsub → subscription}/redis.js +37 -14
- package/dist/runtime/subscription/redis.js.map +1 -0
- package/dist/runtime/types.d.ts +2 -10
- package/dist/runtime/workers/application.d.ts +4 -7
- package/dist/runtime/workers/application.js +9 -4
- package/dist/runtime/workers/application.js.map +1 -1
- package/dist/runtime/workers/base.d.ts +2 -2
- package/dist/runtime/workers/base.js +5 -5
- 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/builder.js.map +1 -1
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/plugins.js.map +1 -1
- package/dist/vite/runners/worker.js.map +1 -1
- package/dist/vite/server.js.map +1 -1
- package/dist/vite/servers/main.js.map +1 -1
- package/dist/vite/servers/worker.js.map +1 -1
- package/package.json +19 -23
- package/src/index.ts +14 -8
- 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 +4 -5
- package/src/runtime/injectables.ts +18 -20
- package/src/runtime/jobs/job.ts +1 -2
- package/src/runtime/jobs/router.ts +52 -24
- package/src/runtime/jobs/runner.ts +2 -2
- package/src/runtime/metrics/server.ts +21 -18
- package/src/runtime/plugin.ts +2 -13
- package/src/runtime/runtime.ts +2 -4
- package/src/runtime/server/config.ts +12 -18
- package/src/runtime/server/jobs.ts +59 -88
- package/src/runtime/{pubsub → subscription}/manager.ts +118 -26
- package/src/runtime/subscription/redis.ts +157 -0
- package/src/runtime/types.ts +2 -11
- package/src/runtime/workers/application.ts +29 -17
- package/src/runtime/workers/base.ts +7 -7
- package/src/runtime/workers/job.ts +3 -6
- package/dist/runtime/application/api/api.d.ts +0 -50
- package/dist/runtime/application/api/api.js +0 -196
- package/dist/runtime/application/api/api.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 -16
- package/dist/runtime/application/api/guards.js +0 -11
- package/dist/runtime/application/api/guards.js.map +0 -1
- package/dist/runtime/application/api/index.d.ts +0 -9
- package/dist/runtime/application/api/index.js +0 -10
- package/dist/runtime/application/api/index.js.map +0 -1
- package/dist/runtime/application/api/logging.d.ts +0 -19
- package/dist/runtime/application/api/logging.js +0 -77
- package/dist/runtime/application/api/logging.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 -67
- package/dist/runtime/application/api/procedure.js +0 -50
- package/dist/runtime/application/api/procedure.js.map +0 -1
- package/dist/runtime/application/api/router.d.ts +0 -80
- package/dist/runtime/application/api/router.js +0 -50
- 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 -26
- package/dist/runtime/application/config.js +0 -21
- 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/dist/runtime/jobs/ui.d.ts +0 -3
- package/dist/runtime/jobs/ui.js +0 -20
- package/dist/runtime/jobs/ui.js.map +0 -1
- package/dist/runtime/pubsub/manager.js.map +0 -1
- package/dist/runtime/pubsub/redis.d.ts +0 -16
- package/dist/runtime/pubsub/redis.js.map +0 -1
- package/src/runtime/application/api/api.ts +0 -274
- 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 -42
- package/src/runtime/application/api/index.ts +0 -9
- package/src/runtime/application/api/logging.ts +0 -110
- package/src/runtime/application/api/middlewares.ts +0 -37
- package/src/runtime/application/api/procedure.ts +0 -231
- package/src/runtime/application/api/router.ts +0 -220
- package/src/runtime/application/api/types.ts +0 -138
- package/src/runtime/application/config.ts +0 -69
- package/src/runtime/application/constants.ts +0 -4
- package/src/runtime/application/hook.ts +0 -51
- package/src/runtime/application/hooks.ts +0 -3
- package/src/runtime/jobs/ui.ts +0 -27
- package/src/runtime/pubsub/redis.ts +0 -106
package/dist/vite/plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/vite/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAInD,MAAM,CAAC,MAAM,OAAO,GAAa;IAC/B;QACE,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,KAAK;QAEd,KAAK,CAAC,IAAI,CAAC,EAAE
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/vite/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAInD,MAAM,CAAC,MAAM,OAAO,GAAa;IAC/B;QACE,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,KAAK;QAEd,KAAK,CAAC,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC;oBAC1B,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;oBAClB,MAAM,EAAE,MAAM,QAAQ,CAAC,EAAE,CAAC;iBAC3B,CAAC,CAAA;gBACF,MAAM,WAAW,GAAG,KAAK,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAA;gBAClD,OAAO,CACL,cAAc,IAAI,CAAC,SAAS,CAAC,WAAW,CA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Aa;YACpB,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE;YACrD,CAAC,CAAC,KAAK;KACZ,EACD,IAAI,kBAAkB,EAAE,CACzB,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
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,WAAW,CAAC,CAAA;AAEjD,MAAM,UAAU,YAAY,CAC1B,OAA0B,EAC1B,MAAkB,EAClB,GAAG,GAA0B,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,WAAW,CAAC,CAAA;AAEjD,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/vite/servers/main.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAI5D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAA0B,EAC1B,IAAkC,EAClC,EAAE,IAAI,EAAiB
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/vite/servers/main.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAI5D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAA0B,EAC1B,IAAkC,EAClC,EAAE,IAAI,EAAiB;IAEvB,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IACpC,MAAM,MAAM,GAAG,MAAM,YAAY,CAC/B,OAAO,EACP,WAAW,CACT;QACE,OAAO,EAAE,QAAQ;QACjB,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,cAAc,CAAC,EAAE;QAC5D,IAAI;QACJ,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;QACrB,YAAY,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;KACf,EACtB,IAAI,CACL,CACF,CAAA;IACD,MAAM,WAAW,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAA;IAE/C,MAAM,MAAM,GAAG,wBAAwB,CAAC,WAAW,EAAE;QACnD,GAAG,EACD,IAAI,KAAK,aAAa;YACpB,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE;YACrD,CAAC,CAAC,KAAK;KACZ,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AAC3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/vite/servers/worker.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CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;oBACrC,IAAI,CAAC,SAAS;wBAAE,OAAM;oBACtB,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;oBACzB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;wBACpB,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;oBACxB,CAAC;gBACH,CAAC;aACF,CAAA;YAED,OAAO,IAAI,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE;gBACtC,GAAG,EAAE,IAAI,KAAK,aAAa;gBAC3B,SAAS;aACV,CAAC,CAAA;QACJ,CAAC;KACF,CACF,CAAA;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -33,38 +33,34 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"@bull-board/ui": "6.20.6",
|
|
39
|
-
"bullmq": "5.71.0",
|
|
40
|
-
"citty": "0.2.1",
|
|
36
|
+
"bullmq": "5.74.1",
|
|
37
|
+
"citty": "0.2.2",
|
|
41
38
|
"dedent": "^1.7.2",
|
|
42
|
-
"dotenv": "^17.
|
|
43
|
-
"ejs": "3.1.10",
|
|
44
|
-
"h3": "1.15.9",
|
|
39
|
+
"dotenv": "^17.4.2",
|
|
45
40
|
"ioredis": "^5.10.1",
|
|
46
41
|
"iovalkey": "^0.3.3",
|
|
47
42
|
"oxc-resolver": "11.19.1",
|
|
48
43
|
"prom-client": "git@github.com:siimon/prom-client.git#d4d2dcb366384833951e0116caca707b5f62aa5e",
|
|
49
|
-
"vite": "8.0.
|
|
50
|
-
"@nmtjs/common": "0.
|
|
51
|
-
"@nmtjs/
|
|
52
|
-
"@nmtjs/
|
|
53
|
-
"@nmtjs/
|
|
54
|
-
"@nmtjs/
|
|
55
|
-
"@nmtjs/
|
|
56
|
-
"@nmtjs/
|
|
57
|
-
"@nmtjs/
|
|
58
|
-
"@nmtjs/
|
|
59
|
-
"@nmtjs/
|
|
44
|
+
"vite": "8.0.8",
|
|
45
|
+
"@nmtjs/common": "0.16.0-beta.10",
|
|
46
|
+
"@nmtjs/application": "0.16.0-beta.10",
|
|
47
|
+
"@nmtjs/contract": "0.16.0-beta.10",
|
|
48
|
+
"@nmtjs/gateway": "0.16.0-beta.10",
|
|
49
|
+
"@nmtjs/json-format": "0.16.0-beta.10",
|
|
50
|
+
"@nmtjs/msgpack-format": "0.16.0-beta.10",
|
|
51
|
+
"@nmtjs/http-transport": "0.16.0-beta.10",
|
|
52
|
+
"@nmtjs/protocol": "0.16.0-beta.10",
|
|
53
|
+
"@nmtjs/type": "0.16.0-beta.10",
|
|
54
|
+
"@nmtjs/core": "0.16.0-beta.10",
|
|
55
|
+
"@nmtjs/ws-transport": "0.16.0-beta.10"
|
|
60
56
|
},
|
|
61
57
|
"devDependencies": {
|
|
62
|
-
"@nmtjs/proxy": "1.0.0-beta.
|
|
63
|
-
"pino": "10.3.
|
|
58
|
+
"@nmtjs/proxy": "1.0.0-beta.6",
|
|
59
|
+
"pino": "10.3.1",
|
|
64
60
|
"zod": "^4.0.0"
|
|
65
61
|
},
|
|
66
62
|
"peerDependencies": {
|
|
67
|
-
"@nmtjs/proxy": "1.0.0-beta.
|
|
63
|
+
"@nmtjs/proxy": "1.0.0-beta.6",
|
|
68
64
|
"zod": "^4.0.0"
|
|
69
65
|
},
|
|
70
66
|
"peerDependenciesMeta": {
|
|
@@ -79,7 +75,7 @@
|
|
|
79
75
|
"LICENSE.md",
|
|
80
76
|
"README.md"
|
|
81
77
|
],
|
|
82
|
-
"version": "0.
|
|
78
|
+
"version": "0.16.0-beta.10",
|
|
83
79
|
"scripts": {
|
|
84
80
|
"clean-build": "rm -rf ./dist"
|
|
85
81
|
}
|
package/src/index.ts
CHANGED
|
@@ -11,22 +11,25 @@ import {
|
|
|
11
11
|
import { createTransport, GatewayInjectables } from '@nmtjs/gateway'
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
|
+
config as runtimeConfig,
|
|
14
15
|
createContractProcedure,
|
|
15
16
|
createContractRouter,
|
|
16
17
|
createFilter,
|
|
17
18
|
createGuard,
|
|
18
|
-
createGuardFactory,
|
|
19
19
|
createHook,
|
|
20
|
-
|
|
21
|
-
createJobRouterOperation,
|
|
22
|
-
createJobsRouter,
|
|
20
|
+
createMeta,
|
|
23
21
|
createMiddleware,
|
|
24
22
|
createPlugin,
|
|
25
23
|
createProcedure,
|
|
26
24
|
createRootRouter,
|
|
27
25
|
createRouter,
|
|
28
|
-
createStep,
|
|
29
26
|
defineApplication,
|
|
27
|
+
} from '@nmtjs/application'
|
|
28
|
+
import {
|
|
29
|
+
createJob,
|
|
30
|
+
createJobRouterOperation,
|
|
31
|
+
createJobsRouter,
|
|
32
|
+
createStep,
|
|
30
33
|
defineServer,
|
|
31
34
|
RuntimeInjectables,
|
|
32
35
|
} from './runtime/index.ts'
|
|
@@ -62,8 +65,9 @@ export namespace neemata {
|
|
|
62
65
|
export const procedure = createProcedure
|
|
63
66
|
export const contractProcedure = createContractProcedure
|
|
64
67
|
export const middleware = createMiddleware
|
|
68
|
+
export const meta = createMeta
|
|
69
|
+
export const config = runtimeConfig
|
|
65
70
|
export const guard = createGuard
|
|
66
|
-
export const guardFactory = createGuardFactory
|
|
67
71
|
export const filter = createFilter
|
|
68
72
|
export const job = createJob
|
|
69
73
|
export const step = createStep
|
|
@@ -77,7 +81,7 @@ export namespace neemata {
|
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
export { c } from '@nmtjs/contract'
|
|
80
|
-
export { Scope } from '@nmtjs/core'
|
|
84
|
+
export { MetadataKind, Scope } from '@nmtjs/core'
|
|
81
85
|
export {
|
|
82
86
|
type ConnectionIdentityType,
|
|
83
87
|
GatewayHook,
|
|
@@ -89,8 +93,10 @@ export { t } from '@nmtjs/type'
|
|
|
89
93
|
export {
|
|
90
94
|
ApiError,
|
|
91
95
|
defineApplication,
|
|
92
|
-
JobWorkerPool,
|
|
93
96
|
LifecycleHook,
|
|
97
|
+
} from '@nmtjs/application'
|
|
98
|
+
|
|
99
|
+
export {
|
|
94
100
|
StoreType,
|
|
95
101
|
WorkerType,
|
|
96
102
|
} 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,16 +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
|
-
export * from './pubsub/manager.ts'
|
|
13
|
-
export * from './pubsub/redis.ts'
|
|
14
11
|
export * from './runtime.ts'
|
|
15
12
|
export * from './scheduler/index.ts'
|
|
16
13
|
export * from './server/config.ts'
|
|
@@ -24,6 +21,8 @@ export * from './server/server.ts'
|
|
|
24
21
|
export * from './server/types.ts'
|
|
25
22
|
export * from './server/worker-pool.ts'
|
|
26
23
|
export * from './store/index.ts'
|
|
24
|
+
export * from './subscription/manager.ts'
|
|
25
|
+
export * from './subscription/redis.ts'
|
|
27
26
|
export * from './types.ts'
|
|
28
27
|
export * from './workers/application.ts'
|
|
29
28
|
export * from './workers/base.ts'
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
import { createLazyInjectable, Scope } from '@nmtjs/core'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { WorkerType } from './enums.ts'
|
|
4
4
|
import type { JobManagerInstance } from './jobs/manager.ts'
|
|
5
5
|
import type { JobExecutionContext, SaveJobProgress } from './jobs/types.ts'
|
|
6
|
-
import type {
|
|
7
|
-
PubSubAdapterType,
|
|
8
|
-
PubSubPublish,
|
|
9
|
-
PubSubSubscribe,
|
|
10
|
-
} from './pubsub/manager.ts'
|
|
11
6
|
import type { ServerStoreConfig } from './server/config.ts'
|
|
7
|
+
import type {
|
|
8
|
+
PublishFn,
|
|
9
|
+
SubscribeFn,
|
|
10
|
+
SubscriptionAdapterType,
|
|
11
|
+
} from './subscription/manager.ts'
|
|
12
12
|
|
|
13
|
-
export const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export const subscriptionAdapter =
|
|
14
|
+
createLazyInjectable<SubscriptionAdapterType>(
|
|
15
|
+
Scope.Global,
|
|
16
|
+
'SubscriptionAdapter',
|
|
17
|
+
)
|
|
17
18
|
|
|
18
|
-
export const
|
|
19
|
-
Scope.Global,
|
|
20
|
-
'PubSubPublish',
|
|
21
|
-
)
|
|
19
|
+
export const publish = createLazyInjectable<PublishFn>(Scope.Global, 'Publish')
|
|
22
20
|
|
|
23
|
-
export const
|
|
21
|
+
export const subscribe = createLazyInjectable<SubscribeFn>(
|
|
24
22
|
Scope.Global,
|
|
25
|
-
'
|
|
23
|
+
'Subscribe',
|
|
26
24
|
)
|
|
27
25
|
|
|
28
26
|
export const jobManager = createLazyInjectable<JobManagerInstance>(
|
|
@@ -40,7 +38,7 @@ export const workerType = createLazyInjectable<WorkerType>(
|
|
|
40
38
|
'WorkerType',
|
|
41
39
|
)
|
|
42
40
|
|
|
43
|
-
export const jobWorkerPool = createLazyInjectable<
|
|
41
|
+
export const jobWorkerPool = createLazyInjectable<string>(
|
|
44
42
|
Scope.Global,
|
|
45
43
|
'JobWorkerPool',
|
|
46
44
|
)
|
|
@@ -61,9 +59,9 @@ export const currentJobInfo = createLazyInjectable<JobExecutionContext>(
|
|
|
61
59
|
)
|
|
62
60
|
|
|
63
61
|
export const RuntimeInjectables = {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
subscriptionAdapter,
|
|
63
|
+
publish,
|
|
64
|
+
subscribe,
|
|
67
65
|
jobManager,
|
|
68
66
|
storeConfig,
|
|
69
67
|
workerType,
|
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,45 +1,65 @@
|
|
|
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
|
-
import type { Dependencies, DependencyContext
|
|
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 { AnyProcedure } from '../application/api/procedure.ts'
|
|
12
|
-
import type { AnyRouter, Router } from '../application/api/router.ts'
|
|
13
19
|
import type { AnyJob } from './job.ts'
|
|
14
20
|
import type { JobStatus } from './types.ts'
|
|
15
|
-
import { createProcedure } from '../application/api/procedure.ts'
|
|
16
|
-
import { createRouter } from '../application/api/router.ts'
|
|
17
21
|
import { jobManager } from '../injectables.ts'
|
|
18
22
|
|
|
19
23
|
// ============================================================================
|
|
20
24
|
// Configuration Types
|
|
21
25
|
// ============================================================================
|
|
22
26
|
|
|
27
|
+
type ListOperationInput = { page?: number; limit?: number; status?: string[] }
|
|
28
|
+
|
|
29
|
+
type IdOperationInput = { id: string }
|
|
30
|
+
|
|
31
|
+
type RetryOperationInput = { id: string; clearState?: boolean }
|
|
32
|
+
|
|
33
|
+
type AddOperationInput<T extends AnyJob> = {
|
|
34
|
+
data: T['_']['input']
|
|
35
|
+
jobId?: string
|
|
36
|
+
priority?: number
|
|
37
|
+
delay?: number
|
|
38
|
+
}
|
|
39
|
+
|
|
23
40
|
/** Base operation config shared by all operations */
|
|
24
|
-
export type BaseOperationConfig<
|
|
41
|
+
export type BaseOperationConfig<
|
|
42
|
+
Input = unknown,
|
|
43
|
+
Deps extends Dependencies = {},
|
|
44
|
+
> = {
|
|
25
45
|
dependencies?: Deps
|
|
26
46
|
guards?: AnyGuard[]
|
|
27
47
|
middlewares?: AnyMiddleware[]
|
|
28
|
-
|
|
48
|
+
meta?: ProcedureMetaBinding<Input>[]
|
|
29
49
|
timeout?: number
|
|
30
50
|
}
|
|
31
51
|
|
|
32
52
|
/** List operation config (read-only, no hooks) */
|
|
33
53
|
export type ListOperationConfig<Deps extends Dependencies = {}> =
|
|
34
|
-
BaseOperationConfig<Deps>
|
|
54
|
+
BaseOperationConfig<ListOperationInput, Deps>
|
|
35
55
|
|
|
36
56
|
/** Get operation config (read-only, no hooks) */
|
|
37
57
|
export type GetOperationConfig<Deps extends Dependencies = {}> =
|
|
38
|
-
BaseOperationConfig<Deps>
|
|
58
|
+
BaseOperationConfig<IdOperationInput, Deps>
|
|
39
59
|
|
|
40
60
|
/** Info operation config (read-only, no hooks) */
|
|
41
61
|
export type InfoOperationConfig<Deps extends Dependencies = {}> =
|
|
42
|
-
BaseOperationConfig<Deps>
|
|
62
|
+
BaseOperationConfig<unknown, Deps>
|
|
43
63
|
|
|
44
64
|
/** Add queue options */
|
|
45
65
|
export type AddQueueOptions = {
|
|
@@ -52,7 +72,7 @@ export type AddQueueOptions = {
|
|
|
52
72
|
export type AddOperationConfig<
|
|
53
73
|
T extends AnyJob = AnyJob,
|
|
54
74
|
Deps extends Dependencies = {},
|
|
55
|
-
> = BaseOperationConfig<Deps> & {
|
|
75
|
+
> = BaseOperationConfig<AddOperationInput<T>, Deps> & {
|
|
56
76
|
beforeAdd?: (
|
|
57
77
|
ctx: DependencyContext<Deps>,
|
|
58
78
|
input: T['_']['input'],
|
|
@@ -67,7 +87,7 @@ export type AddOperationConfig<
|
|
|
67
87
|
|
|
68
88
|
/** Remove operation config with before/after hooks */
|
|
69
89
|
export type RemoveOperationConfig<Deps extends Dependencies = {}> =
|
|
70
|
-
BaseOperationConfig<Deps> & {
|
|
90
|
+
BaseOperationConfig<IdOperationInput, Deps> & {
|
|
71
91
|
beforeRemove?: (
|
|
72
92
|
ctx: DependencyContext<Deps>,
|
|
73
93
|
params: { id: string },
|
|
@@ -80,7 +100,7 @@ export type RemoveOperationConfig<Deps extends Dependencies = {}> =
|
|
|
80
100
|
|
|
81
101
|
/** Retry operation config with before/after hooks */
|
|
82
102
|
export type RetryOperationConfig<Deps extends Dependencies = {}> =
|
|
83
|
-
BaseOperationConfig<Deps> & {
|
|
103
|
+
BaseOperationConfig<RetryOperationInput, Deps> & {
|
|
84
104
|
clearState?: boolean
|
|
85
105
|
beforeRetry?: (
|
|
86
106
|
ctx: DependencyContext<Deps>,
|
|
@@ -94,7 +114,7 @@ export type RetryOperationConfig<Deps extends Dependencies = {}> =
|
|
|
94
114
|
|
|
95
115
|
/** Cancel operation config with before/after hooks */
|
|
96
116
|
export type CancelOperationConfig<Deps extends Dependencies = {}> =
|
|
97
|
-
BaseOperationConfig<Deps> & {
|
|
117
|
+
BaseOperationConfig<IdOperationInput, Deps> & {
|
|
98
118
|
beforeCancel?: (
|
|
99
119
|
ctx: DependencyContext<Deps>,
|
|
100
120
|
params: { id: string },
|
|
@@ -132,6 +152,7 @@ export type CreateJobsRouterOptions<Jobs extends Record<string, AnyJob>> = {
|
|
|
132
152
|
jobs: Jobs
|
|
133
153
|
guards?: AnyGuard[]
|
|
134
154
|
middlewares?: AnyMiddleware[]
|
|
155
|
+
meta?: JobsRouterMetaBinding[]
|
|
135
156
|
defaults?: DefaultOperations
|
|
136
157
|
overrides?: {
|
|
137
158
|
[K in keyof Jobs]?: JobOperations<Jobs[K]>
|
|
@@ -219,6 +240,8 @@ type JobsRouterContract<Jobs extends Record<string, AnyJob>> = TRouterContract<{
|
|
|
219
240
|
[K in keyof Jobs]: JobRouterContract<Jobs[K]>
|
|
220
241
|
}>
|
|
221
242
|
|
|
243
|
+
export type JobsRouterMetaBinding = AnyRouterMetaBinding
|
|
244
|
+
|
|
222
245
|
/** Return type for createJobsRouter */
|
|
223
246
|
export type JobsRouter<Jobs extends Record<string, AnyJob>> = Router<
|
|
224
247
|
JobsRouterContract<Jobs>
|
|
@@ -431,7 +454,7 @@ function createInfoProcedure(
|
|
|
431
454
|
dependencies: { ...deps, ...(config.dependencies ?? {}) },
|
|
432
455
|
guards: allGuards,
|
|
433
456
|
middlewares: allMiddlewares,
|
|
434
|
-
|
|
457
|
+
meta: config.meta,
|
|
435
458
|
timeout: config.timeout,
|
|
436
459
|
handler: (ctx: DependencyContext<JobManagerDeps>) => {
|
|
437
460
|
ctx.logger.trace({ jobName: job.options.name }, 'Getting job info')
|
|
@@ -459,7 +482,7 @@ function createListProcedure(
|
|
|
459
482
|
dependencies: { ...deps, ...(config.dependencies ?? {}) },
|
|
460
483
|
guards: allGuards,
|
|
461
484
|
middlewares: allMiddlewares,
|
|
462
|
-
|
|
485
|
+
meta: config.meta,
|
|
463
486
|
timeout: config.timeout,
|
|
464
487
|
handler: async (ctx: DependencyContext<JobManagerDeps>, input) => {
|
|
465
488
|
ctx.logger.trace(
|
|
@@ -504,7 +527,7 @@ function createGetProcedure(
|
|
|
504
527
|
dependencies: { ...deps, ...(config.dependencies ?? {}) },
|
|
505
528
|
guards: allGuards,
|
|
506
529
|
middlewares: allMiddlewares,
|
|
507
|
-
|
|
530
|
+
meta: config.meta,
|
|
508
531
|
timeout: config.timeout,
|
|
509
532
|
handler: async (ctx: DependencyContext<JobManagerDeps>, input) => {
|
|
510
533
|
ctx.logger.trace(
|
|
@@ -540,7 +563,7 @@ function createAddProcedure(
|
|
|
540
563
|
dependencies: { ...deps, ...(config.dependencies ?? {}) },
|
|
541
564
|
guards: allGuards,
|
|
542
565
|
middlewares: allMiddlewares,
|
|
543
|
-
|
|
566
|
+
meta: config.meta,
|
|
544
567
|
timeout: config.timeout,
|
|
545
568
|
handler: async (ctx: DependencyContext<JobManagerDeps>, input) => {
|
|
546
569
|
let jobData = input.data
|
|
@@ -606,7 +629,7 @@ function createRetryProcedure(
|
|
|
606
629
|
dependencies: { ...deps, ...(config.dependencies ?? {}) },
|
|
607
630
|
guards: allGuards,
|
|
608
631
|
middlewares: allMiddlewares,
|
|
609
|
-
|
|
632
|
+
meta: config.meta,
|
|
610
633
|
timeout: config.timeout,
|
|
611
634
|
handler: async (ctx: DependencyContext<JobManagerDeps>, input) => {
|
|
612
635
|
const clearState = input.clearState ?? config.clearState
|
|
@@ -662,7 +685,7 @@ function createCancelProcedure(
|
|
|
662
685
|
dependencies: { ...deps, ...(config.dependencies ?? {}) },
|
|
663
686
|
guards: allGuards,
|
|
664
687
|
middlewares: allMiddlewares,
|
|
665
|
-
|
|
688
|
+
meta: config.meta,
|
|
666
689
|
timeout: config.timeout,
|
|
667
690
|
handler: async (ctx: DependencyContext<JobManagerDeps>, input) => {
|
|
668
691
|
ctx.logger.debug(
|
|
@@ -716,7 +739,7 @@ function createRemoveProcedure(
|
|
|
716
739
|
dependencies: { ...deps, ...(config.dependencies ?? {}) },
|
|
717
740
|
guards: allGuards,
|
|
718
741
|
middlewares: allMiddlewares,
|
|
719
|
-
|
|
742
|
+
meta: config.meta,
|
|
720
743
|
timeout: config.timeout,
|
|
721
744
|
handler: async (ctx: DependencyContext<JobManagerDeps>, input) => {
|
|
722
745
|
ctx.logger.trace(
|
|
@@ -799,6 +822,10 @@ function mergeOperations(
|
|
|
799
822
|
...((defaultOp as any).middlewares ?? []),
|
|
800
823
|
...((override as any).middlewares ?? []),
|
|
801
824
|
],
|
|
825
|
+
meta: [
|
|
826
|
+
...((defaultOp as any).meta ?? []),
|
|
827
|
+
...((override as any).meta ?? []),
|
|
828
|
+
],
|
|
802
829
|
} as any
|
|
803
830
|
} else {
|
|
804
831
|
result[op] = override as any
|
|
@@ -856,6 +883,7 @@ export function createJobsRouter<const Jobs extends Record<string, AnyJob>>(
|
|
|
856
883
|
jobs,
|
|
857
884
|
guards: sharedGuards = [],
|
|
858
885
|
middlewares: sharedMiddlewares = [],
|
|
886
|
+
meta = [],
|
|
859
887
|
defaults = {},
|
|
860
888
|
overrides = {},
|
|
861
889
|
} = options
|
|
@@ -935,5 +963,5 @@ export function createJobsRouter<const Jobs extends Record<string, AnyJob>>(
|
|
|
935
963
|
}
|
|
936
964
|
|
|
937
965
|
// Return router containing all job routers
|
|
938
|
-
return createRouter({ routes }) as JobsRouter<Jobs>
|
|
966
|
+
return createRouter({ routes, meta }) as JobsRouter<Jobs>
|
|
939
967
|
}
|
|
@@ -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,
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { createServer } from 'node:http'
|
|
2
2
|
|
|
3
3
|
import type { Logger } from '@nmtjs/core'
|
|
4
|
-
import {
|
|
5
|
-
createApp,
|
|
6
|
-
createRouter,
|
|
7
|
-
eventHandler,
|
|
8
|
-
setHeader,
|
|
9
|
-
toNodeListener,
|
|
10
|
-
} from 'h3'
|
|
11
4
|
import { Pushgateway } from 'prom-client'
|
|
12
5
|
|
|
13
6
|
import type { ServerConfig } from '../server/config.ts'
|
|
@@ -33,17 +26,27 @@ export async function createMetricsServer(
|
|
|
33
26
|
}, interval)
|
|
34
27
|
}
|
|
35
28
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
29
|
+
const server = createServer((req, res) => {
|
|
30
|
+
const url = new URL(`http://${req.headers.host || 'localhost'}${req.url}`)
|
|
31
|
+
if (url.pathname === path) {
|
|
32
|
+
res.setHeader('Content-Type', registry.contentType)
|
|
33
|
+
registry
|
|
34
|
+
.workerMetrics()
|
|
35
|
+
.then((metrics) => {
|
|
36
|
+
res.writeHead(200)
|
|
37
|
+
res.end(metrics)
|
|
38
|
+
})
|
|
39
|
+
.catch((cause) => {
|
|
40
|
+
logger.error(new Error('Metrics collection error', { cause }))
|
|
41
|
+
res.writeHead(500)
|
|
42
|
+
res.end('Internal Server Error')
|
|
43
|
+
})
|
|
44
|
+
} else {
|
|
45
|
+
res.writeHead(404)
|
|
46
|
+
res.end('Not Found')
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
47
50
|
return {
|
|
48
51
|
start: () =>
|
|
49
52
|
new Promise<void>((resolve) =>
|
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'
|