@cloudnux/local-cloud-provider 0.17.0 → 0.19.0
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/dev-console-plugin/index.d.ts +76 -6
- package/dist/dev-console-plugin/index.js +1023 -2031
- package/dist/dev-console-plugin/index.js.map +1 -1
- package/dist/index.d.ts +19 -4
- package/dist/index.js +161 -195
- package/dist/index.js.map +1 -1
- package/dist/queue-plugin/index.d.ts +36 -9
- package/dist/queue-plugin/index.js +363 -1422
- package/dist/queue-plugin/index.js.map +1 -1
- package/dist/schedule-plugin/index.d.ts +49 -21
- package/dist/schedule-plugin/index.js +529 -1590
- package/dist/schedule-plugin/index.js.map +1 -1
- package/dist/websocket-plugin/index.d.ts +18 -0
- package/dist/websocket-plugin/index.js +21 -1031
- package/dist/websocket-plugin/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { FastifyRequest, FastifyReply, FastifyInstance } from 'fastify';
|
|
2
|
-
import { EventBatchItemResult } from '@cloudnux/core-cloud-provider';
|
|
2
|
+
import { LoggerService, LogEntry, EventBatchItemResult } from '@cloudnux/core-cloud-provider';
|
|
3
3
|
import { WebSocket } from 'ws';
|
|
4
4
|
|
|
5
|
+
type LogContext = {
|
|
6
|
+
module?: string;
|
|
7
|
+
reqId?: string;
|
|
8
|
+
};
|
|
9
|
+
type LogListener = (entry: LogEntry) => void;
|
|
10
|
+
type RunWithLogContext = <T>(context: LogContext, fn: () => T) => T;
|
|
11
|
+
type SubscribeToLogs = (listener: LogListener) => () => void;
|
|
12
|
+
type LoggingContext = LoggerService & {
|
|
13
|
+
runWithLogContext: RunWithLogContext;
|
|
14
|
+
subscribeToLogs: SubscribeToLogs;
|
|
15
|
+
};
|
|
16
|
+
declare module "fastify" {
|
|
17
|
+
interface FastifyInstance {
|
|
18
|
+
logging: LoggingContext;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
5
22
|
interface QueueMessage {
|
|
6
23
|
id: string;
|
|
7
24
|
timestamp: Date;
|
|
@@ -20,7 +37,6 @@ interface QueueService {
|
|
|
20
37
|
incoming: QueueMessage[];
|
|
21
38
|
processing: QueueMessage[];
|
|
22
39
|
dlq: QueueMessage[];
|
|
23
|
-
timeoutId: NodeJS.Timeout | null;
|
|
24
40
|
processingBatch: boolean;
|
|
25
41
|
module?: string;
|
|
26
42
|
}
|
|
@@ -31,12 +47,12 @@ interface QueueConfig {
|
|
|
31
47
|
parallel: boolean;
|
|
32
48
|
maxConcurrent: number;
|
|
33
49
|
retryBackoff: boolean;
|
|
50
|
+
tickIntervalMs: number;
|
|
34
51
|
persistence: {
|
|
35
52
|
enabled?: boolean;
|
|
36
53
|
directory: string;
|
|
37
54
|
saveInterval?: number;
|
|
38
55
|
saveOnShutdown?: boolean;
|
|
39
|
-
loadOnStartup?: boolean;
|
|
40
56
|
};
|
|
41
57
|
}
|
|
42
58
|
interface QueueSummary {
|
|
@@ -51,6 +67,17 @@ interface QueueSummary {
|
|
|
51
67
|
maxConcurrent: number;
|
|
52
68
|
};
|
|
53
69
|
}
|
|
70
|
+
interface QueueMessageHistoryEntry {
|
|
71
|
+
id: string;
|
|
72
|
+
queueName: string;
|
|
73
|
+
status: 'completed' | 'failed';
|
|
74
|
+
timestamp: Date;
|
|
75
|
+
completedAt: Date;
|
|
76
|
+
attempts: number;
|
|
77
|
+
payload: any;
|
|
78
|
+
attributes: Record<string, any>;
|
|
79
|
+
error?: string;
|
|
80
|
+
}
|
|
54
81
|
interface QueueManager {
|
|
55
82
|
addQueue: (queueName: string, handler: EventHandler, module?: string) => Promise<void>;
|
|
56
83
|
removeQueue: (queueName: string) => Promise<void>;
|
|
@@ -82,6 +109,7 @@ interface QueueManager {
|
|
|
82
109
|
message: string;
|
|
83
110
|
purged: number;
|
|
84
111
|
} | null>;
|
|
112
|
+
getMessageHistory: (queueName: string, limit?: number) => QueueMessageHistoryEntry[];
|
|
85
113
|
}
|
|
86
114
|
declare module 'fastify' {
|
|
87
115
|
interface FastifyInstance {
|
|
@@ -114,13 +142,12 @@ interface JobExecution {
|
|
|
114
142
|
error?: string;
|
|
115
143
|
result?: any;
|
|
116
144
|
}
|
|
145
|
+
type JobHandler = (job: ScheduledJob, execution: JobExecution) => Promise<void>;
|
|
117
146
|
interface SchedulerService {
|
|
118
147
|
job: ScheduledJob;
|
|
119
148
|
handler: JobHandler;
|
|
120
|
-
timerId?: NodeJS.Timeout;
|
|
121
149
|
isRunning: boolean;
|
|
122
150
|
}
|
|
123
|
-
type JobHandler = (job: ScheduledJob, execution: JobExecution) => Promise<void>;
|
|
124
151
|
interface JobDefinition {
|
|
125
152
|
name: string;
|
|
126
153
|
cronExpression?: string;
|
|
@@ -133,16 +160,59 @@ interface JobDefinition {
|
|
|
133
160
|
timezone?: string;
|
|
134
161
|
module?: string;
|
|
135
162
|
}
|
|
163
|
+
interface SchedulerConfig {
|
|
164
|
+
tickIntervalMs: number;
|
|
165
|
+
persistence: {
|
|
166
|
+
enabled?: boolean;
|
|
167
|
+
directory: string;
|
|
168
|
+
saveInterval?: number;
|
|
169
|
+
saveOnShutdown?: boolean;
|
|
170
|
+
};
|
|
171
|
+
execution: {
|
|
172
|
+
maxConcurrent: number;
|
|
173
|
+
defaultTimeout: number;
|
|
174
|
+
};
|
|
175
|
+
cleanup: {
|
|
176
|
+
maxExecutionHistory: number;
|
|
177
|
+
cleanupInterval: number;
|
|
178
|
+
};
|
|
179
|
+
restartBehavior: {
|
|
180
|
+
preserveNaturalTiming: boolean;
|
|
181
|
+
skipMissedRuns: boolean;
|
|
182
|
+
maxTimingDrift: number;
|
|
183
|
+
rapidRestartThreshold: number;
|
|
184
|
+
};
|
|
185
|
+
cron: {
|
|
186
|
+
defaultTimezone?: string;
|
|
187
|
+
logCronDetails: boolean;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
interface SchedulerDashboardJob extends ScheduledJob {
|
|
191
|
+
isRunning: boolean;
|
|
192
|
+
timeUntilNextRun: number;
|
|
193
|
+
upcomingExecutions: Date[];
|
|
194
|
+
cronDescription?: string;
|
|
195
|
+
}
|
|
136
196
|
interface SchedulerManager {
|
|
137
197
|
addJob: (jobDefinition: JobDefinition) => Promise<string>;
|
|
138
198
|
removeJob: (jobName: string) => Promise<void>;
|
|
139
199
|
hasJob: (jobName: string) => boolean;
|
|
140
200
|
listJobs: (module?: string) => string[];
|
|
141
201
|
getJobStats: (jobName: string) => SchedulerService | null;
|
|
202
|
+
getJobsMap: () => Record<string, SchedulerService>;
|
|
203
|
+
getConfig: () => SchedulerConfig;
|
|
142
204
|
enableJob: (jobName: string) => Promise<void>;
|
|
143
205
|
disableJob: (jobName: string) => Promise<void>;
|
|
144
206
|
triggerJob: (jobName: string) => Promise<void>;
|
|
145
|
-
|
|
207
|
+
getDashboardSummary: () => {
|
|
208
|
+
jobs: SchedulerDashboardJob[];
|
|
209
|
+
runningExecutions: number;
|
|
210
|
+
};
|
|
211
|
+
getExecutionsSummary: () => {
|
|
212
|
+
executions: JobExecution[];
|
|
213
|
+
running: JobExecution[];
|
|
214
|
+
};
|
|
215
|
+
getJobExecutionHistory: (jobName: string, limit?: number) => JobExecution[];
|
|
146
216
|
}
|
|
147
217
|
declare module 'fastify' {
|
|
148
218
|
interface FastifyInstance {
|