nmtjs 0.16.1 → 0.17.0-beta.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/LICENSE.md +1 -1
- package/README.md +41 -1
- package/dist/index.d.ts +22 -161
- package/dist/index.js +24 -53
- package/dist/index.js.map +1 -1
- package/package.json +11 -63
- package/src/index.ts +71 -91
- package/bin/cli.js +0 -2
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -137
- package/dist/cli.js.map +0 -1
- package/dist/codegen.d.ts +0 -5
- package/dist/codegen.js +0 -18
- package/dist/codegen.js.map +0 -1
- package/dist/config.d.ts +0 -47
- package/dist/config.js +0 -16
- package/dist/config.js.map +0 -1
- package/dist/entrypoints/cli.d.ts +0 -1
- package/dist/entrypoints/cli.js +0 -12
- package/dist/entrypoints/cli.js.map +0 -1
- package/dist/entrypoints/main.d.ts +0 -5
- package/dist/entrypoints/main.js +0 -248
- package/dist/entrypoints/main.js.map +0 -1
- package/dist/entrypoints/thread.d.ts +0 -16
- package/dist/entrypoints/thread.js +0 -182
- package/dist/entrypoints/thread.js.map +0 -1
- package/dist/entrypoints/worker.d.ts +0 -9
- package/dist/entrypoints/worker.js +0 -143
- package/dist/entrypoints/worker.js.map +0 -1
- package/dist/resolver.d.ts +0 -2
- package/dist/resolver.js +0 -7
- package/dist/resolver.js.map +0 -1
- package/dist/runtime/application/index.d.ts +0 -1
- package/dist/runtime/application/index.js +0 -2
- package/dist/runtime/application/index.js.map +0 -1
- package/dist/runtime/constants.d.ts +0 -8
- package/dist/runtime/constants.js +0 -5
- package/dist/runtime/constants.js.map +0 -1
- package/dist/runtime/enums.d.ts +0 -10
- package/dist/runtime/enums.js +0 -13
- package/dist/runtime/enums.js.map +0 -1
- package/dist/runtime/hooks.d.ts +0 -1
- package/dist/runtime/hooks.js +0 -2
- package/dist/runtime/hooks.js.map +0 -1
- package/dist/runtime/index.d.ts +0 -28
- package/dist/runtime/index.js +0 -29
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/injectables.d.ts +0 -69
- package/dist/runtime/injectables.js +0 -40
- package/dist/runtime/injectables.js.map +0 -1
- package/dist/runtime/jobs/job.d.ts +0 -146
- package/dist/runtime/jobs/job.js +0 -89
- package/dist/runtime/jobs/job.js.map +0 -1
- package/dist/runtime/jobs/manager.d.ts +0 -131
- package/dist/runtime/jobs/manager.js +0 -309
- package/dist/runtime/jobs/manager.js.map +0 -1
- package/dist/runtime/jobs/router.d.ts +0 -296
- package/dist/runtime/jobs/router.js +0 -458
- package/dist/runtime/jobs/router.js.map +0 -1
- package/dist/runtime/jobs/runner.d.ts +0 -103
- package/dist/runtime/jobs/runner.js +0 -425
- package/dist/runtime/jobs/runner.js.map +0 -1
- package/dist/runtime/jobs/step.d.ts +0 -26
- package/dist/runtime/jobs/step.js +0 -18
- package/dist/runtime/jobs/step.js.map +0 -1
- package/dist/runtime/jobs/types.d.ts +0 -86
- package/dist/runtime/jobs/types.js +0 -5
- package/dist/runtime/jobs/types.js.map +0 -1
- package/dist/runtime/metrics/metric.d.ts +0 -8
- package/dist/runtime/metrics/metric.js +0 -11
- package/dist/runtime/metrics/metric.js.map +0 -1
- package/dist/runtime/metrics/registry.d.ts +0 -3
- package/dist/runtime/metrics/registry.js +0 -5
- package/dist/runtime/metrics/registry.js.map +0 -1
- package/dist/runtime/metrics/server.d.ts +0 -7
- package/dist/runtime/metrics/server.js +0 -53
- package/dist/runtime/metrics/server.js.map +0 -1
- package/dist/runtime/plugin.d.ts +0 -2
- package/dist/runtime/plugin.js +0 -2
- package/dist/runtime/plugin.js.map +0 -1
- package/dist/runtime/runtime.d.ts +0 -27
- package/dist/runtime/runtime.js +0 -77
- package/dist/runtime/runtime.js.map +0 -1
- package/dist/runtime/scheduler/index.d.ts +0 -22
- package/dist/runtime/scheduler/index.js +0 -20
- package/dist/runtime/scheduler/index.js.map +0 -1
- package/dist/runtime/server/applications.d.ts +0 -91
- package/dist/runtime/server/applications.js +0 -171
- package/dist/runtime/server/applications.js.map +0 -1
- package/dist/runtime/server/config.d.ts +0 -148
- package/dist/runtime/server/config.js +0 -33
- package/dist/runtime/server/config.js.map +0 -1
- package/dist/runtime/server/environment.d.ts +0 -43
- package/dist/runtime/server/environment.js +0 -33
- package/dist/runtime/server/environment.js.map +0 -1
- package/dist/runtime/server/error-policy.d.ts +0 -62
- package/dist/runtime/server/error-policy.js +0 -73
- package/dist/runtime/server/error-policy.js.map +0 -1
- package/dist/runtime/server/hmr-coordinator.d.ts +0 -37
- package/dist/runtime/server/hmr-coordinator.js +0 -94
- package/dist/runtime/server/hmr-coordinator.js.map +0 -1
- package/dist/runtime/server/jobs.d.ts +0 -54
- package/dist/runtime/server/jobs.js +0 -176
- package/dist/runtime/server/jobs.js.map +0 -1
- package/dist/runtime/server/lifecycle.d.ts +0 -85
- package/dist/runtime/server/lifecycle.js +0 -177
- package/dist/runtime/server/lifecycle.js.map +0 -1
- package/dist/runtime/server/managed-worker.d.ts +0 -158
- package/dist/runtime/server/managed-worker.js +0 -420
- package/dist/runtime/server/managed-worker.js.map +0 -1
- package/dist/runtime/server/pool-manager.d.ts +0 -85
- package/dist/runtime/server/pool-manager.js +0 -129
- package/dist/runtime/server/pool-manager.js.map +0 -1
- package/dist/runtime/server/proxy.d.ts +0 -21
- package/dist/runtime/server/proxy.js +0 -76
- package/dist/runtime/server/proxy.js.map +0 -1
- package/dist/runtime/server/server.d.ts +0 -60
- package/dist/runtime/server/server.js +0 -163
- package/dist/runtime/server/server.js.map +0 -1
- package/dist/runtime/server/types.d.ts +0 -31
- package/dist/runtime/server/types.js +0 -2
- package/dist/runtime/server/types.js.map +0 -1
- package/dist/runtime/server/worker-pool.d.ts +0 -121
- package/dist/runtime/server/worker-pool.js +0 -171
- package/dist/runtime/server/worker-pool.js.map +0 -1
- package/dist/runtime/store/index.d.ts +0 -3
- package/dist/runtime/store/index.js +0 -23
- package/dist/runtime/store/index.js.map +0 -1
- package/dist/runtime/subscription/manager.d.ts +0 -49
- package/dist/runtime/subscription/manager.js +0 -170
- package/dist/runtime/subscription/manager.js.map +0 -1
- package/dist/runtime/subscription/redis.d.ts +0 -18
- package/dist/runtime/subscription/redis.js +0 -119
- package/dist/runtime/subscription/redis.js.map +0 -1
- package/dist/runtime/types.d.ts +0 -95
- package/dist/runtime/types.js +0 -2
- package/dist/runtime/types.js.map +0 -1
- package/dist/runtime/workers/application.d.ts +0 -29
- package/dist/runtime/workers/application.js +0 -77
- package/dist/runtime/workers/application.js.map +0 -1
- package/dist/runtime/workers/base.d.ts +0 -14
- package/dist/runtime/workers/base.js +0 -41
- package/dist/runtime/workers/base.js.map +0 -1
- package/dist/runtime/workers/cli.d.ts +0 -1
- package/dist/runtime/workers/cli.js +0 -2
- package/dist/runtime/workers/cli.js.map +0 -1
- package/dist/runtime/workers/job.d.ts +0 -20
- package/dist/runtime/workers/job.js +0 -170
- package/dist/runtime/workers/job.js.map +0 -1
- package/dist/vite/builder.d.ts +0 -5
- package/dist/vite/builder.js +0 -79
- package/dist/vite/builder.js.map +0 -1
- package/dist/vite/config.d.ts +0 -28
- package/dist/vite/config.js +0 -22
- package/dist/vite/config.js.map +0 -1
- package/dist/vite/plugins.d.ts +0 -2
- package/dist/vite/plugins.js +0 -43
- package/dist/vite/plugins.js.map +0 -1
- package/dist/vite/runners/worker.d.ts +0 -3
- package/dist/vite/runners/worker.js +0 -34
- package/dist/vite/runners/worker.js.map +0 -1
- package/dist/vite/server.d.ts +0 -3
- package/dist/vite/server.js +0 -36
- package/dist/vite/server.js.map +0 -1
- package/dist/vite/servers/main.d.ts +0 -8
- package/dist/vite/servers/main.js +0 -24
- package/dist/vite/servers/main.js.map +0 -1
- package/dist/vite/servers/worker.d.ts +0 -13
- package/dist/vite/servers/worker.js +0 -124
- package/dist/vite/servers/worker.js.map +0 -1
- package/src/cli.ts +0 -162
- package/src/codegen.ts +0 -30
- package/src/config.ts +0 -69
- package/src/entrypoints/cli.ts +0 -13
- package/src/entrypoints/main.ts +0 -317
- package/src/entrypoints/thread.ts +0 -223
- package/src/entrypoints/worker.ts +0 -174
- package/src/resolver.ts +0 -7
- package/src/runtime/application/index.ts +0 -1
- package/src/runtime/constants.ts +0 -13
- package/src/runtime/enums.ts +0 -12
- package/src/runtime/hooks.ts +0 -1
- package/src/runtime/index.ts +0 -29
- package/src/runtime/injectables.ts +0 -101
- package/src/runtime/jobs/job.ts +0 -467
- package/src/runtime/jobs/manager.ts +0 -454
- package/src/runtime/jobs/router.ts +0 -967
- package/src/runtime/jobs/runner.ts +0 -583
- package/src/runtime/jobs/step.ts +0 -66
- package/src/runtime/jobs/types.ts +0 -116
- package/src/runtime/metrics/metric.ts +0 -18
- package/src/runtime/metrics/registry.ts +0 -11
- package/src/runtime/metrics/server.ts +0 -69
- package/src/runtime/plugin.ts +0 -2
- package/src/runtime/runtime.ts +0 -103
- package/src/runtime/scheduler/index.ts +0 -39
- package/src/runtime/server/applications.ts +0 -264
- package/src/runtime/server/config.ts +0 -199
- package/src/runtime/server/environment.ts +0 -71
- package/src/runtime/server/error-policy.ts +0 -132
- package/src/runtime/server/hmr-coordinator.ts +0 -116
- package/src/runtime/server/jobs.ts +0 -266
- package/src/runtime/server/lifecycle.ts +0 -234
- package/src/runtime/server/managed-worker.ts +0 -546
- package/src/runtime/server/pool-manager.ts +0 -187
- package/src/runtime/server/proxy.ts +0 -119
- package/src/runtime/server/server.ts +0 -218
- package/src/runtime/server/types.ts +0 -32
- package/src/runtime/server/worker-pool.ts +0 -275
- package/src/runtime/store/index.ts +0 -30
- package/src/runtime/subscription/manager.ts +0 -307
- package/src/runtime/subscription/redis.ts +0 -159
- package/src/runtime/types.ts +0 -84
- package/src/runtime/workers/application.ts +0 -133
- package/src/runtime/workers/base.ts +0 -65
- package/src/runtime/workers/cli.ts +0 -0
- package/src/runtime/workers/job.ts +0 -142
- package/src/vite/builder.ts +0 -94
- package/src/vite/config.ts +0 -45
- package/src/vite/plugins.ts +0 -53
- package/src/vite/runners/worker.ts +0 -55
- package/src/vite/server.ts +0 -55
- package/src/vite/servers/main.ts +0 -41
- package/src/vite/servers/worker.ts +0 -177
|
@@ -1,425 +0,0 @@
|
|
|
1
|
-
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
-
if (value !== null && value !== void 0) {
|
|
3
|
-
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
-
var dispose, inner;
|
|
5
|
-
if (async) {
|
|
6
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
-
dispose = value[Symbol.asyncDispose];
|
|
8
|
-
}
|
|
9
|
-
if (dispose === void 0) {
|
|
10
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
-
dispose = value[Symbol.dispose];
|
|
12
|
-
if (async) inner = dispose;
|
|
13
|
-
}
|
|
14
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
-
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
-
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
-
}
|
|
18
|
-
else if (async) {
|
|
19
|
-
env.stack.push({ async: true });
|
|
20
|
-
}
|
|
21
|
-
return value;
|
|
22
|
-
};
|
|
23
|
-
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
-
return function (env) {
|
|
25
|
-
function fail(e) {
|
|
26
|
-
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
-
env.hasError = true;
|
|
28
|
-
}
|
|
29
|
-
var r, s = 0;
|
|
30
|
-
function next() {
|
|
31
|
-
while (r = env.stack.pop()) {
|
|
32
|
-
try {
|
|
33
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
-
if (r.dispose) {
|
|
35
|
-
var result = r.dispose.call(r.value);
|
|
36
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
-
}
|
|
38
|
-
else s |= 1;
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
fail(e);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
-
if (env.hasError) throw env.error;
|
|
46
|
-
}
|
|
47
|
-
return next();
|
|
48
|
-
};
|
|
49
|
-
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
-
var e = new Error(message);
|
|
51
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
-
});
|
|
53
|
-
import { LifecycleHook } from '@nmtjs/application';
|
|
54
|
-
import { anyAbortSignal } from '@nmtjs/common';
|
|
55
|
-
import { Scope } from '@nmtjs/core';
|
|
56
|
-
import { UnrecoverableError } from 'bullmq';
|
|
57
|
-
import { currentJobInfo, jobAbortSignal, saveJobProgress, } from '../injectables.js';
|
|
58
|
-
export class JobRunner {
|
|
59
|
-
runtime;
|
|
60
|
-
logger;
|
|
61
|
-
constructor(runtime) {
|
|
62
|
-
this.runtime = runtime;
|
|
63
|
-
this.logger = runtime.logger.child({ $group: JobRunner.name });
|
|
64
|
-
}
|
|
65
|
-
get container() {
|
|
66
|
-
return this.runtime.container;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Creates a function that saves the current job progress state.
|
|
70
|
-
* Override in subclasses to implement actual persistence.
|
|
71
|
-
*/
|
|
72
|
-
createSaveProgressFn(_context) {
|
|
73
|
-
// No-op in base runner - subclasses implement actual persistence
|
|
74
|
-
return async () => { };
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Creates the current job info object.
|
|
78
|
-
* Override in subclasses to include additional info (e.g., BullMQ job ID).
|
|
79
|
-
*/
|
|
80
|
-
createJobInfo(job, _options) {
|
|
81
|
-
return { name: job.options.name };
|
|
82
|
-
}
|
|
83
|
-
async runJob(job, data, options = {}) {
|
|
84
|
-
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
85
|
-
try {
|
|
86
|
-
const { signal: runSignal, result: runResult = {}, stepResults: runStepResults = [], progress: runProgress = {}, currentStepIndex = 0, ...rest } = options;
|
|
87
|
-
const { input, output, jobSteps: steps } = job;
|
|
88
|
-
const result = { ...runResult };
|
|
89
|
-
const decodedInput = input.decode(data);
|
|
90
|
-
// Initialize progress: decode from checkpoint or start fresh
|
|
91
|
-
const progress = job.progress
|
|
92
|
-
? job.progress.decode(runProgress)
|
|
93
|
-
: { ...runProgress };
|
|
94
|
-
const stopListener = __addDisposableResource(env_1, this.runtime.lifecycleHooks.once(LifecycleHook.BeforeDispose), false);
|
|
95
|
-
const signal = anyAbortSignal(runSignal, stopListener.signal);
|
|
96
|
-
const container = __addDisposableResource(env_1, this.container.fork(Scope.Global), true);
|
|
97
|
-
container.provide(jobAbortSignal, signal);
|
|
98
|
-
container.provide(currentJobInfo, this.createJobInfo(job, options));
|
|
99
|
-
// Create mutable state context for saveProgress
|
|
100
|
-
const progressContext = {
|
|
101
|
-
job,
|
|
102
|
-
progress,
|
|
103
|
-
result,
|
|
104
|
-
stepResults: null, // Will be set below
|
|
105
|
-
currentStepIndex,
|
|
106
|
-
options: null, // Will be set below
|
|
107
|
-
};
|
|
108
|
-
// Provide saveProgress injectable
|
|
109
|
-
container.provide(saveJobProgress, this.createSaveProgressFn(progressContext));
|
|
110
|
-
const jobDependencyContext = await container.createContext(job.dependencies);
|
|
111
|
-
const jobData = job.options.data
|
|
112
|
-
? await job.options.data(jobDependencyContext, decodedInput, progress)
|
|
113
|
-
: undefined;
|
|
114
|
-
const stepResults = Array.from({ length: steps.length });
|
|
115
|
-
// Restore previous step results and reconstruct accumulated result
|
|
116
|
-
for (let stepIndex = 0; stepIndex < runStepResults.length; stepIndex++) {
|
|
117
|
-
const entry = runStepResults[stepIndex];
|
|
118
|
-
stepResults[stepIndex] = entry;
|
|
119
|
-
if (entry?.data)
|
|
120
|
-
Object.assign(result, entry.data);
|
|
121
|
-
}
|
|
122
|
-
// @ts-expect-error
|
|
123
|
-
const runOptions = {
|
|
124
|
-
signal,
|
|
125
|
-
result,
|
|
126
|
-
stepResults,
|
|
127
|
-
currentStepIndex: currentStepIndex,
|
|
128
|
-
progress,
|
|
129
|
-
...rest,
|
|
130
|
-
};
|
|
131
|
-
// Update mutable context references
|
|
132
|
-
progressContext.stepResults = stepResults;
|
|
133
|
-
progressContext.options = runOptions;
|
|
134
|
-
for (let stepIndex = currentStepIndex; stepIndex < steps.length;) {
|
|
135
|
-
if (signal.aborted) {
|
|
136
|
-
const { reason } = signal;
|
|
137
|
-
if (reason instanceof UnrecoverableError)
|
|
138
|
-
throw reason;
|
|
139
|
-
throw new UnrecoverableError('Job cancelled');
|
|
140
|
-
}
|
|
141
|
-
const groupStart = job.parallelGroupByStepIndex.get(stepIndex);
|
|
142
|
-
if (groupStart !== undefined) {
|
|
143
|
-
const groupEnd = job.parallelGroups.get(groupStart) ?? groupStart + 1;
|
|
144
|
-
const resultSnapshot = Object.freeze(Object.assign({}, decodedInput, result));
|
|
145
|
-
const pending = [];
|
|
146
|
-
for (let index = groupStart; index < groupEnd; index++) {
|
|
147
|
-
if (!stepResults[index])
|
|
148
|
-
pending.push(index);
|
|
149
|
-
}
|
|
150
|
-
if (pending.length > 0) {
|
|
151
|
-
const settled = await Promise.all(pending.map(async (index) => {
|
|
152
|
-
const step = steps[index];
|
|
153
|
-
try {
|
|
154
|
-
const produced = await this.runStep({
|
|
155
|
-
job,
|
|
156
|
-
step,
|
|
157
|
-
stepIndex: index,
|
|
158
|
-
result,
|
|
159
|
-
resultSnapshot,
|
|
160
|
-
decodedInput,
|
|
161
|
-
progress,
|
|
162
|
-
stepResults,
|
|
163
|
-
options: runOptions,
|
|
164
|
-
jobDependencyContext,
|
|
165
|
-
jobData,
|
|
166
|
-
container,
|
|
167
|
-
applyResult: false,
|
|
168
|
-
});
|
|
169
|
-
return { index, produced };
|
|
170
|
-
}
|
|
171
|
-
catch (error) {
|
|
172
|
-
return { index, error };
|
|
173
|
-
}
|
|
174
|
-
}));
|
|
175
|
-
const errors = settled.filter((entry) => 'error' in entry);
|
|
176
|
-
if (errors.length > 0) {
|
|
177
|
-
throw new Error(`Error during parallel step group [${groupStart}-${groupEnd - 1}]`, { cause: errors[0].error });
|
|
178
|
-
}
|
|
179
|
-
const keyOwners = new Map();
|
|
180
|
-
for (const entry of settled) {
|
|
181
|
-
if (!('produced' in entry) || !entry.produced)
|
|
182
|
-
continue;
|
|
183
|
-
for (const key of Object.keys(entry.produced)) {
|
|
184
|
-
const owner = keyOwners.get(key);
|
|
185
|
-
if (owner !== undefined && owner !== entry.index) {
|
|
186
|
-
throw new Error(`Parallel step key conflict for "${key}" between steps [${owner}] and [${entry.index}]`);
|
|
187
|
-
}
|
|
188
|
-
keyOwners.set(key, entry.index);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
for (let index = groupStart; index < groupEnd; index++) {
|
|
192
|
-
const entry = settled.find((item) => item.index === index && 'produced' in item);
|
|
193
|
-
if (entry?.produced) {
|
|
194
|
-
Object.assign(result, entry.produced);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
stepIndex = groupEnd;
|
|
199
|
-
continue;
|
|
200
|
-
}
|
|
201
|
-
const step = steps[stepIndex];
|
|
202
|
-
const resultSnapshot = Object.freeze(Object.assign({}, decodedInput, result));
|
|
203
|
-
await this.runStep({
|
|
204
|
-
job,
|
|
205
|
-
step,
|
|
206
|
-
stepIndex,
|
|
207
|
-
result,
|
|
208
|
-
resultSnapshot,
|
|
209
|
-
decodedInput,
|
|
210
|
-
progress,
|
|
211
|
-
stepResults,
|
|
212
|
-
options: runOptions,
|
|
213
|
-
jobDependencyContext,
|
|
214
|
-
jobData,
|
|
215
|
-
container,
|
|
216
|
-
applyResult: true,
|
|
217
|
-
});
|
|
218
|
-
stepIndex++;
|
|
219
|
-
}
|
|
220
|
-
const finalPayload = await job.returnHandler({
|
|
221
|
-
context: jobDependencyContext,
|
|
222
|
-
data: jobData,
|
|
223
|
-
input: decodedInput,
|
|
224
|
-
result,
|
|
225
|
-
progress,
|
|
226
|
-
});
|
|
227
|
-
return output.encode(finalPayload);
|
|
228
|
-
}
|
|
229
|
-
catch (e_1) {
|
|
230
|
-
env_1.error = e_1;
|
|
231
|
-
env_1.hasError = true;
|
|
232
|
-
}
|
|
233
|
-
finally {
|
|
234
|
-
const result_1 = __disposeResources(env_1);
|
|
235
|
-
if (result_1)
|
|
236
|
-
await result_1;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
async runStep(params) {
|
|
240
|
-
const { job, step, stepIndex, result, resultSnapshot, decodedInput, progress, stepResults, options, jobDependencyContext, jobData, container, applyResult, } = params;
|
|
241
|
-
try {
|
|
242
|
-
const condition = job.conditions.get(stepIndex);
|
|
243
|
-
if (condition) {
|
|
244
|
-
const shouldRun = await condition({
|
|
245
|
-
context: jobDependencyContext,
|
|
246
|
-
data: jobData,
|
|
247
|
-
input: decodedInput,
|
|
248
|
-
result: resultSnapshot,
|
|
249
|
-
progress,
|
|
250
|
-
});
|
|
251
|
-
if (!shouldRun) {
|
|
252
|
-
const now = Date.now();
|
|
253
|
-
const skippedResult = {
|
|
254
|
-
data: null,
|
|
255
|
-
startedAt: now,
|
|
256
|
-
completedAt: now,
|
|
257
|
-
duration: 0,
|
|
258
|
-
};
|
|
259
|
-
stepResults[stepIndex] = skippedResult;
|
|
260
|
-
await this.afterStep({
|
|
261
|
-
job,
|
|
262
|
-
step,
|
|
263
|
-
stepIndex,
|
|
264
|
-
result,
|
|
265
|
-
stepResult: skippedResult,
|
|
266
|
-
stepResults,
|
|
267
|
-
options,
|
|
268
|
-
});
|
|
269
|
-
return null;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
const stepStartedAt = Date.now();
|
|
273
|
-
await this.beforeStep({
|
|
274
|
-
job,
|
|
275
|
-
step,
|
|
276
|
-
stepIndex,
|
|
277
|
-
result,
|
|
278
|
-
options,
|
|
279
|
-
stepResults,
|
|
280
|
-
});
|
|
281
|
-
const stepContext = await container.createContext(step.dependencies);
|
|
282
|
-
const stepInput = step.input.decode(resultSnapshot);
|
|
283
|
-
await job.beforeEachHandler?.({
|
|
284
|
-
context: jobDependencyContext,
|
|
285
|
-
data: jobData,
|
|
286
|
-
input: decodedInput,
|
|
287
|
-
result: resultSnapshot,
|
|
288
|
-
progress,
|
|
289
|
-
step,
|
|
290
|
-
stepIndex,
|
|
291
|
-
});
|
|
292
|
-
const handlerReturn = await step.handler(stepContext, stepInput, jobData);
|
|
293
|
-
const produced = step.output.encode(handlerReturn ?? {});
|
|
294
|
-
const stepCompletedAt = Date.now();
|
|
295
|
-
const stepResult = {
|
|
296
|
-
data: produced,
|
|
297
|
-
startedAt: stepStartedAt,
|
|
298
|
-
completedAt: stepCompletedAt,
|
|
299
|
-
duration: stepCompletedAt - stepStartedAt,
|
|
300
|
-
};
|
|
301
|
-
stepResults[stepIndex] = stepResult;
|
|
302
|
-
if (applyResult) {
|
|
303
|
-
Object.assign(result, produced);
|
|
304
|
-
}
|
|
305
|
-
await job.afterEachHandler?.({
|
|
306
|
-
context: jobDependencyContext,
|
|
307
|
-
data: jobData,
|
|
308
|
-
input: decodedInput,
|
|
309
|
-
result: applyResult ? result : Object.assign({}, result, produced),
|
|
310
|
-
progress,
|
|
311
|
-
step,
|
|
312
|
-
stepIndex,
|
|
313
|
-
});
|
|
314
|
-
await this.afterStep({
|
|
315
|
-
job,
|
|
316
|
-
step,
|
|
317
|
-
stepIndex,
|
|
318
|
-
result,
|
|
319
|
-
stepResult,
|
|
320
|
-
stepResults,
|
|
321
|
-
options,
|
|
322
|
-
});
|
|
323
|
-
return produced;
|
|
324
|
-
}
|
|
325
|
-
catch (error) {
|
|
326
|
-
const wrapped = new Error(`Error during step [${stepIndex}]`, {
|
|
327
|
-
cause: error,
|
|
328
|
-
});
|
|
329
|
-
this.logger.error(wrapped);
|
|
330
|
-
const allowRetry = await job.onErrorHandler?.({
|
|
331
|
-
context: jobDependencyContext,
|
|
332
|
-
data: jobData,
|
|
333
|
-
input: decodedInput,
|
|
334
|
-
result,
|
|
335
|
-
progress,
|
|
336
|
-
step,
|
|
337
|
-
stepIndex,
|
|
338
|
-
error,
|
|
339
|
-
});
|
|
340
|
-
if (allowRetry === false) {
|
|
341
|
-
throw new UnrecoverableError('Job failed (unrecoverable)');
|
|
342
|
-
}
|
|
343
|
-
throw wrapped;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
nextStepIndex(stepResults) {
|
|
347
|
-
const missingIndex = stepResults.findIndex((entry) => !entry);
|
|
348
|
-
return missingIndex === -1 ? stepResults.length : missingIndex;
|
|
349
|
-
}
|
|
350
|
-
async beforeStep(params) {
|
|
351
|
-
this.logger.debug({
|
|
352
|
-
job: params.job.name,
|
|
353
|
-
step: params.step.label || params.stepIndex + 1,
|
|
354
|
-
stepIndex: params.stepIndex,
|
|
355
|
-
}, 'Executing job step');
|
|
356
|
-
}
|
|
357
|
-
async afterStep(params) {
|
|
358
|
-
this.logger.debug({
|
|
359
|
-
job: params.job.name,
|
|
360
|
-
step: params.step.label || params.stepIndex + 1,
|
|
361
|
-
stepIndex: params.stepIndex,
|
|
362
|
-
}, 'Completed job step');
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
export class ApplicationWorkerJobRunner extends JobRunner {
|
|
366
|
-
runtime;
|
|
367
|
-
constructor(runtime) {
|
|
368
|
-
super(runtime);
|
|
369
|
-
this.runtime = runtime;
|
|
370
|
-
}
|
|
371
|
-
createJobInfo(job, options) {
|
|
372
|
-
const { queueJob } = options;
|
|
373
|
-
return {
|
|
374
|
-
name: job.options.name,
|
|
375
|
-
id: queueJob?.id,
|
|
376
|
-
queue: queueJob?.queueName,
|
|
377
|
-
attempts: queueJob?.attemptsMade,
|
|
378
|
-
stepIndex: options.stepResults
|
|
379
|
-
? this.nextStepIndex(options.stepResults)
|
|
380
|
-
: options.currentStepIndex,
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
createSaveProgressFn(context) {
|
|
384
|
-
return async () => {
|
|
385
|
-
const { job, progress, result, stepResults, options } = context;
|
|
386
|
-
if (!options || !stepResults)
|
|
387
|
-
return;
|
|
388
|
-
const { queueJob } = options;
|
|
389
|
-
const currentStepIndex = this.nextStepIndex(stepResults);
|
|
390
|
-
// Encode progress before persisting if schema is defined
|
|
391
|
-
const encodedProgress = job.progress
|
|
392
|
-
? job.progress.encode(progress)
|
|
393
|
-
: progress;
|
|
394
|
-
const checkpoint = {
|
|
395
|
-
stepIndex: currentStepIndex,
|
|
396
|
-
stepLabel: job.jobSteps[currentStepIndex]?.label,
|
|
397
|
-
result,
|
|
398
|
-
stepResults,
|
|
399
|
-
progress: encodedProgress,
|
|
400
|
-
};
|
|
401
|
-
await queueJob.updateProgress(checkpoint);
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
async afterStep(params) {
|
|
405
|
-
await super.afterStep(params);
|
|
406
|
-
const { job, step, result, stepResult, stepResults, stepIndex, options: { queueJob, progress }, } = params;
|
|
407
|
-
const nextStepIndex = this.nextStepIndex(stepResults);
|
|
408
|
-
// Encode progress before persisting if schema is defined
|
|
409
|
-
const encodedProgress = job.progress
|
|
410
|
-
? job.progress.encode(progress)
|
|
411
|
-
: progress;
|
|
412
|
-
const checkpoint = {
|
|
413
|
-
stepIndex: nextStepIndex,
|
|
414
|
-
stepLabel: job.jobSteps[nextStepIndex]?.label,
|
|
415
|
-
result,
|
|
416
|
-
stepResults,
|
|
417
|
-
progress: encodedProgress,
|
|
418
|
-
};
|
|
419
|
-
await Promise.all([
|
|
420
|
-
queueJob.log(`Step ${step.label || stepIndex + 1} completed in ${(stepResult.duration / 1000).toFixed(3)}s`),
|
|
421
|
-
queueJob.updateProgress(checkpoint),
|
|
422
|
-
]);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
//# sourceMappingURL=runner.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X,QAAQ,EAAE,eAAe;aAC1B,CAAA;YAED,MAAM,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;QAC3C,CAAC,CAAA;IACH,CAAC;IAES,KAAK,CAAC,SAAS,CACvB,MAEC;QAED,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QAC7B,MAAM,EACJ,GAAG,EACH,IAAI,EACJ,MAAM,EACN,UAAU,EACV,WAAW,EACX,SAAS,EACT,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAChC,GAAG,MAAM,CAAA;QACV,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;QAErD,yDAAyD;QACzD,MAAM,eAAe,GAAG,GAAG,CAAC,QAAQ;YAClC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;YAC/B,CAAC,CAAC,QAAQ,CAAA;QAEZ,MAAM,UAAU,GAA0B;YACxC,SAAS,EAAE,aAAa;YACxB,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK;YAC7C,MAAM;YACN,WAAW;YACX,QAAQ,EAAE,eAAe;SAC1B,CAAA;QAED,MAAM,OAAO,CAAC,GAAG,CAAC;YAChB,QAAQ,CAAC,GAAG,CACV,QAAQ,IAAI,CAAC,KAAK,IAAI,SAAS,GAAG,CAAC,iBAAiB,CAAC,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAC/F;YACD,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC;SACpC,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { MaybePromise } from '@nmtjs/common';
|
|
2
|
-
import type { Dependant, Dependencies, DependencyContext } from '@nmtjs/core';
|
|
3
|
-
import type { AnyObjectLikeType, ObjectType } from '@nmtjs/type/object';
|
|
4
|
-
import { t } from '@nmtjs/type';
|
|
5
|
-
import { kJobStepKey } from '../constants.ts';
|
|
6
|
-
export type AnyJobStep = JobStep<any, any, any, any, any>;
|
|
7
|
-
export type JobStepHandler<Deps extends Dependencies, Input extends AnyObjectLikeType, Output extends AnyObjectLikeType, Data = any> = (context: DependencyContext<Deps>, input: t.infer.decode.output<Input>, data: Data) => MaybePromise<t.infer.encode.input<Output>>;
|
|
8
|
-
export interface JobStep<Input extends AnyObjectLikeType = AnyObjectLikeType, Output extends AnyObjectLikeType = AnyObjectLikeType, Deps extends Dependencies = Dependencies, Return = unknown, Data = any> extends Dependant {
|
|
9
|
-
[kJobStepKey]: any;
|
|
10
|
-
_?: {
|
|
11
|
-
return: Return;
|
|
12
|
-
};
|
|
13
|
-
label?: string;
|
|
14
|
-
input: Input;
|
|
15
|
-
output: Output;
|
|
16
|
-
dependencies: Deps;
|
|
17
|
-
handler: JobStepHandler<Deps, Input, Output, Data>;
|
|
18
|
-
}
|
|
19
|
-
export declare function createStep<Input extends AnyObjectLikeType, Output extends AnyObjectLikeType = ObjectType<{}>, Deps extends Dependencies = {}, Return = unknown, Data = any>(step: {
|
|
20
|
-
label?: string;
|
|
21
|
-
input: Input;
|
|
22
|
-
output?: Output;
|
|
23
|
-
dependencies?: Deps;
|
|
24
|
-
handler: JobStepHandler<Deps, Input, Output, Data>;
|
|
25
|
-
}): JobStep<Input, Output, Deps, Return, Data>;
|
|
26
|
-
export declare function isJobStep(value: unknown): value is AnyJobStep;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { tryCaptureStackTrace } from '@nmtjs/common';
|
|
2
|
-
import { t } from '@nmtjs/type';
|
|
3
|
-
import { kJobStepKey } from '../constants.js';
|
|
4
|
-
export function createStep(step) {
|
|
5
|
-
return Object.freeze({
|
|
6
|
-
[kJobStepKey]: true,
|
|
7
|
-
output: t.object({}),
|
|
8
|
-
dependencies: {},
|
|
9
|
-
stack: tryCaptureStackTrace(),
|
|
10
|
-
...step,
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
export function isJobStep(value) {
|
|
14
|
-
return (typeof value === 'object' &&
|
|
15
|
-
value !== null &&
|
|
16
|
-
value[kJobStepKey] === true);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=step.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"step.js","sourceRoot":"","sources":["../../../src/runtime/jobs/step.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAA;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AA+B7C,MAAM,UAAU,UAAU,CAMxB,IAMD;IACC,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,CAAC,WAAW,CAAC,EAAE,IAAI;QACnB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAsB;QACzC,YAAY,EAAE,EAAU;QACxB,KAAK,EAAE,oBAAoB,EAAE;QAC7B,GAAG,IAAI;KACR,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAoB,CAAC,WAAW,CAAC,KAAK,IAAI,CAC5C,CAAA;AACH,CAAC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/** Metadata about a job step in a job definition */
|
|
2
|
-
export interface JobStepInfo {
|
|
3
|
-
/** Optional human-readable label for the step */
|
|
4
|
-
label?: string;
|
|
5
|
-
/** Whether this step has a condition that may skip it */
|
|
6
|
-
conditional: boolean;
|
|
7
|
-
/** Whether this step executes in a parallel group */
|
|
8
|
-
parallel: boolean;
|
|
9
|
-
}
|
|
10
|
-
/** Metadata about a job definition (not a running job instance) */
|
|
11
|
-
export interface JobDefinitionInfo {
|
|
12
|
-
/** Job name from definition */
|
|
13
|
-
name: string;
|
|
14
|
-
/** Information about each step in the job */
|
|
15
|
-
steps: JobStepInfo[];
|
|
16
|
-
}
|
|
17
|
-
/** Result of a single step execution */
|
|
18
|
-
export interface StepResultEntry {
|
|
19
|
-
/** Output data produced by the step, or null if skipped */
|
|
20
|
-
data: Record<string, unknown> | null;
|
|
21
|
-
/** Timestamp when step started (ms since epoch) */
|
|
22
|
-
startedAt: number;
|
|
23
|
-
/** Timestamp when step completed (ms since epoch) */
|
|
24
|
-
completedAt: number;
|
|
25
|
-
/** Duration in milliseconds (completedAt - startedAt) */
|
|
26
|
-
duration: number;
|
|
27
|
-
}
|
|
28
|
-
/** Checkpoint data persisted for job resume support */
|
|
29
|
-
export interface JobProgressCheckpoint {
|
|
30
|
-
/** Index of the next step to execute (0 = not started, length = completed) */
|
|
31
|
-
stepIndex: number;
|
|
32
|
-
/** Label of the next step to execute, if labeled */
|
|
33
|
-
stepLabel?: string;
|
|
34
|
-
/** Accumulated result from all completed steps */
|
|
35
|
-
result: Record<string, unknown>;
|
|
36
|
-
/** Results of each individual step */
|
|
37
|
-
stepResults: StepResultEntry[];
|
|
38
|
-
/** User-defined progress state */
|
|
39
|
-
progress: Record<string, unknown>;
|
|
40
|
-
}
|
|
41
|
-
/** Information about the currently executing job, available via injectable */
|
|
42
|
-
export interface JobExecutionContext {
|
|
43
|
-
/** Job definition name */
|
|
44
|
-
name: string;
|
|
45
|
-
/** Queue job ID */
|
|
46
|
-
id?: string;
|
|
47
|
-
/** Queue name */
|
|
48
|
-
queue?: string;
|
|
49
|
-
/** Number of attempts made so far */
|
|
50
|
-
attempts?: number;
|
|
51
|
-
/** Current step index being executed */
|
|
52
|
-
stepIndex?: number;
|
|
53
|
-
}
|
|
54
|
-
/** Vendor-agnostic job status */
|
|
55
|
-
export type JobStatus = 'pending' | 'active' | 'completed' | 'failed' | 'delayed' | 'cancelled' | 'unknown';
|
|
56
|
-
/** A job instance retrieved from the queue */
|
|
57
|
-
export interface JobItem<TInput = unknown, TOutput = unknown> {
|
|
58
|
-
/** Unique job instance ID */
|
|
59
|
-
id: string;
|
|
60
|
-
/** Job definition name */
|
|
61
|
-
name: string;
|
|
62
|
-
/** Queue name this job belongs to */
|
|
63
|
-
queue: string;
|
|
64
|
-
/** Input data passed to the job */
|
|
65
|
-
data: TInput;
|
|
66
|
-
/** Output produced by the job (if completed) */
|
|
67
|
-
output?: TOutput | null;
|
|
68
|
-
/** Current job status */
|
|
69
|
-
status: JobStatus;
|
|
70
|
-
/** Job priority (lower = higher priority) */
|
|
71
|
-
priority?: number;
|
|
72
|
-
/** Job progress checkpoint (includes step state and user progress) */
|
|
73
|
-
progress?: JobProgressCheckpoint;
|
|
74
|
-
/** Number of execution attempts */
|
|
75
|
-
attempts: number;
|
|
76
|
-
/** Timestamp when job started processing (ms) */
|
|
77
|
-
startedAt?: number;
|
|
78
|
-
/** Timestamp when job completed (ms) */
|
|
79
|
-
completedAt?: number;
|
|
80
|
-
/** Error message if job failed */
|
|
81
|
-
error?: string;
|
|
82
|
-
/** Stack trace if job failed */
|
|
83
|
-
stacktrace: string[] | null;
|
|
84
|
-
}
|
|
85
|
-
/** Function to manually trigger saving job progress state */
|
|
86
|
-
export type SaveJobProgress = () => Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/jobs/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,sDAAsD;AACtD,+EAA+E"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ClassConstructorArgs } from '@nmtjs/common';
|
|
2
|
-
import type { Metric, MetricConfiguration } from '@nmtjs/prom-client';
|
|
3
|
-
import { Counter, Gauge, Histogram, Summary } from '@nmtjs/prom-client';
|
|
4
|
-
export declare const createMetric: <T extends Metric>(contructor: new (config: MetricConfiguration<any>) => T) => (config: ClassConstructorArgs<T>[0]) => T;
|
|
5
|
-
export declare const createCounterMetric: (config: never) => Counter<any>;
|
|
6
|
-
export declare const createGaugeMetric: (config: never) => Gauge<any>;
|
|
7
|
-
export declare const createHistogramMetric: (config: never) => Histogram<any>;
|
|
8
|
-
export declare const createSummaryMetric: (config: never) => Summary<any>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Counter, Gauge, Histogram, Summary } from '@nmtjs/prom-client';
|
|
2
|
-
import { registry } from './registry.js';
|
|
3
|
-
export const createMetric = (contructor) => (config) => new contructor({
|
|
4
|
-
...config,
|
|
5
|
-
registers: [...(config.registers ?? []), registry],
|
|
6
|
-
});
|
|
7
|
-
export const createCounterMetric = createMetric(Counter);
|
|
8
|
-
export const createGaugeMetric = createMetric(Gauge);
|
|
9
|
-
export const createHistogramMetric = createMetric(Histogram);
|
|
10
|
-
export const createSummaryMetric = createMetric(Summary);
|
|
11
|
-
//# sourceMappingURL=metric.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metric.js","sourceRoot":"","sources":["../../../src/runtime/metrics/metric.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,CAAC,MAAM,YAAY,GACvB,CAAmB,UAAuD,EAAE,EAAE,CAC9E,CAAC,MAAkC,EAAK,EAAE,CACxC,IAAI,UAAU,CAAC;IACb,GAAG,MAAM;IACT,SAAS,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC;CACnD,CAAC,CAAA;AAEN,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;AACxD,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;AACpD,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,CAAC,SAAS,CAAC,CAAA;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/runtime/metrics/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,QAAQ,EACR,cAAc,GACf,MAAM,oBAAoB,CAAA;AAE3B,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAA;AAElD,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAA;AAEhC,qBAAqB,EAAE,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Logger } from '@nmtjs/core';
|
|
2
|
-
import type { ServerConfig } from '../server/config.ts';
|
|
3
|
-
export declare function createMetricsServer(logger: Logger, config: Exclude<ServerConfig['metrics'], undefined>): Promise<{
|
|
4
|
-
start: () => Promise<void>;
|
|
5
|
-
stop: () => Promise<void>;
|
|
6
|
-
}>;
|
|
7
|
-
export type MetricsServer = Awaited<ReturnType<typeof createMetricsServer>>;
|