@lucaapp/service-utils 4.11.0 → 4.13.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/lib/api/endpoint.js
CHANGED
package/dist/lib/jobs/index.d.ts
CHANGED
package/dist/lib/jobs/index.js
CHANGED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Schema for job execution parameters
|
|
4
|
+
*/
|
|
5
|
+
export declare const parametersSchema: z.ZodObject<{
|
|
6
|
+
job: z.ZodString;
|
|
7
|
+
method: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
method: string;
|
|
10
|
+
job: string;
|
|
11
|
+
}, {
|
|
12
|
+
method: string;
|
|
13
|
+
job: string;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Schema for job ID parameters
|
|
17
|
+
*/
|
|
18
|
+
export declare const jobIdParametersSchema: z.ZodObject<{
|
|
19
|
+
jobId: z.ZodString;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
jobId: string;
|
|
22
|
+
}, {
|
|
23
|
+
jobId: string;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Schema for JSON request/response bodies
|
|
27
|
+
* Allows any object structure to pass through
|
|
28
|
+
*/
|
|
29
|
+
export declare const jsonSchema: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
|
|
30
|
+
export type JsonSchema = z.infer<typeof jsonSchema>;
|
|
31
|
+
/**
|
|
32
|
+
* Schema for running job information
|
|
33
|
+
*/
|
|
34
|
+
export declare const runningJobSchema: z.ZodObject<{
|
|
35
|
+
jobId: z.ZodString;
|
|
36
|
+
jobName: z.ZodString;
|
|
37
|
+
method: z.ZodString;
|
|
38
|
+
status: z.ZodEnum<["running", "completed", "failed"]>;
|
|
39
|
+
startedAt: z.ZodString;
|
|
40
|
+
completedAt: z.ZodOptional<z.ZodString>;
|
|
41
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
error: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
status: "running" | "completed" | "failed";
|
|
45
|
+
method: string;
|
|
46
|
+
jobId: string;
|
|
47
|
+
jobName: string;
|
|
48
|
+
startedAt: string;
|
|
49
|
+
completedAt?: string | undefined;
|
|
50
|
+
duration?: number | undefined;
|
|
51
|
+
error?: string | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
status: "running" | "completed" | "failed";
|
|
54
|
+
method: string;
|
|
55
|
+
jobId: string;
|
|
56
|
+
jobName: string;
|
|
57
|
+
startedAt: string;
|
|
58
|
+
completedAt?: string | undefined;
|
|
59
|
+
duration?: number | undefined;
|
|
60
|
+
error?: string | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Schema for job completion information
|
|
64
|
+
*/
|
|
65
|
+
export declare const jobCompletionSchema: z.ZodObject<{
|
|
66
|
+
completedAt: z.ZodString;
|
|
67
|
+
status: z.ZodEnum<["completed", "failed"]>;
|
|
68
|
+
error: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
status: "completed" | "failed";
|
|
71
|
+
completedAt: string;
|
|
72
|
+
error?: string | undefined;
|
|
73
|
+
}, {
|
|
74
|
+
status: "completed" | "failed";
|
|
75
|
+
completedAt: string;
|
|
76
|
+
error?: string | undefined;
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* Schema for job metadata (path and methods)
|
|
80
|
+
*/
|
|
81
|
+
export declare const jobMetadataSchema: z.ZodObject<{
|
|
82
|
+
path: z.ZodString;
|
|
83
|
+
methods: z.ZodArray<z.ZodString, "many">;
|
|
84
|
+
lastExecution: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
85
|
+
startedAt: z.ZodString;
|
|
86
|
+
completedAt: z.ZodString;
|
|
87
|
+
duration: z.ZodNumber;
|
|
88
|
+
error: z.ZodNullable<z.ZodString>;
|
|
89
|
+
}, "strip", z.ZodTypeAny, {
|
|
90
|
+
error: string | null;
|
|
91
|
+
startedAt: string;
|
|
92
|
+
completedAt: string;
|
|
93
|
+
duration: number;
|
|
94
|
+
}, {
|
|
95
|
+
error: string | null;
|
|
96
|
+
startedAt: string;
|
|
97
|
+
completedAt: string;
|
|
98
|
+
duration: number;
|
|
99
|
+
}>>>;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
path: string;
|
|
102
|
+
methods: string[];
|
|
103
|
+
lastExecution?: {
|
|
104
|
+
error: string | null;
|
|
105
|
+
startedAt: string;
|
|
106
|
+
completedAt: string;
|
|
107
|
+
duration: number;
|
|
108
|
+
} | null | undefined;
|
|
109
|
+
}, {
|
|
110
|
+
path: string;
|
|
111
|
+
methods: string[];
|
|
112
|
+
lastExecution?: {
|
|
113
|
+
error: string | null;
|
|
114
|
+
startedAt: string;
|
|
115
|
+
completedAt: string;
|
|
116
|
+
duration: number;
|
|
117
|
+
} | null | undefined;
|
|
118
|
+
}>;
|
|
119
|
+
/**
|
|
120
|
+
* Schema for the complete jobs response
|
|
121
|
+
*/
|
|
122
|
+
export declare const jobsSchema: z.ZodObject<{
|
|
123
|
+
jobs: z.ZodArray<z.ZodObject<{
|
|
124
|
+
path: z.ZodString;
|
|
125
|
+
methods: z.ZodArray<z.ZodString, "many">;
|
|
126
|
+
lastExecution: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
127
|
+
startedAt: z.ZodString;
|
|
128
|
+
completedAt: z.ZodString;
|
|
129
|
+
duration: z.ZodNumber;
|
|
130
|
+
error: z.ZodNullable<z.ZodString>;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
error: string | null;
|
|
133
|
+
startedAt: string;
|
|
134
|
+
completedAt: string;
|
|
135
|
+
duration: number;
|
|
136
|
+
}, {
|
|
137
|
+
error: string | null;
|
|
138
|
+
startedAt: string;
|
|
139
|
+
completedAt: string;
|
|
140
|
+
duration: number;
|
|
141
|
+
}>>>;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
path: string;
|
|
144
|
+
methods: string[];
|
|
145
|
+
lastExecution?: {
|
|
146
|
+
error: string | null;
|
|
147
|
+
startedAt: string;
|
|
148
|
+
completedAt: string;
|
|
149
|
+
duration: number;
|
|
150
|
+
} | null | undefined;
|
|
151
|
+
}, {
|
|
152
|
+
path: string;
|
|
153
|
+
methods: string[];
|
|
154
|
+
lastExecution?: {
|
|
155
|
+
error: string | null;
|
|
156
|
+
startedAt: string;
|
|
157
|
+
completedAt: string;
|
|
158
|
+
duration: number;
|
|
159
|
+
} | null | undefined;
|
|
160
|
+
}>, "many">;
|
|
161
|
+
runningJobs: z.ZodArray<z.ZodObject<{
|
|
162
|
+
jobId: z.ZodString;
|
|
163
|
+
jobName: z.ZodString;
|
|
164
|
+
method: z.ZodString;
|
|
165
|
+
status: z.ZodEnum<["running", "completed", "failed"]>;
|
|
166
|
+
startedAt: z.ZodString;
|
|
167
|
+
completedAt: z.ZodOptional<z.ZodString>;
|
|
168
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
169
|
+
error: z.ZodOptional<z.ZodString>;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
status: "running" | "completed" | "failed";
|
|
172
|
+
method: string;
|
|
173
|
+
jobId: string;
|
|
174
|
+
jobName: string;
|
|
175
|
+
startedAt: string;
|
|
176
|
+
completedAt?: string | undefined;
|
|
177
|
+
duration?: number | undefined;
|
|
178
|
+
error?: string | undefined;
|
|
179
|
+
}, {
|
|
180
|
+
status: "running" | "completed" | "failed";
|
|
181
|
+
method: string;
|
|
182
|
+
jobId: string;
|
|
183
|
+
jobName: string;
|
|
184
|
+
startedAt: string;
|
|
185
|
+
completedAt?: string | undefined;
|
|
186
|
+
duration?: number | undefined;
|
|
187
|
+
error?: string | undefined;
|
|
188
|
+
}>, "many">;
|
|
189
|
+
jobCompletions: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
190
|
+
completedAt: z.ZodString;
|
|
191
|
+
status: z.ZodEnum<["completed", "failed"]>;
|
|
192
|
+
error: z.ZodOptional<z.ZodString>;
|
|
193
|
+
}, "strip", z.ZodTypeAny, {
|
|
194
|
+
status: "completed" | "failed";
|
|
195
|
+
completedAt: string;
|
|
196
|
+
error?: string | undefined;
|
|
197
|
+
}, {
|
|
198
|
+
status: "completed" | "failed";
|
|
199
|
+
completedAt: string;
|
|
200
|
+
error?: string | undefined;
|
|
201
|
+
}>>;
|
|
202
|
+
}, "strip", z.ZodTypeAny, {
|
|
203
|
+
jobs: {
|
|
204
|
+
path: string;
|
|
205
|
+
methods: string[];
|
|
206
|
+
lastExecution?: {
|
|
207
|
+
error: string | null;
|
|
208
|
+
startedAt: string;
|
|
209
|
+
completedAt: string;
|
|
210
|
+
duration: number;
|
|
211
|
+
} | null | undefined;
|
|
212
|
+
}[];
|
|
213
|
+
runningJobs: {
|
|
214
|
+
status: "running" | "completed" | "failed";
|
|
215
|
+
method: string;
|
|
216
|
+
jobId: string;
|
|
217
|
+
jobName: string;
|
|
218
|
+
startedAt: string;
|
|
219
|
+
completedAt?: string | undefined;
|
|
220
|
+
duration?: number | undefined;
|
|
221
|
+
error?: string | undefined;
|
|
222
|
+
}[];
|
|
223
|
+
jobCompletions: Record<string, {
|
|
224
|
+
status: "completed" | "failed";
|
|
225
|
+
completedAt: string;
|
|
226
|
+
error?: string | undefined;
|
|
227
|
+
}>;
|
|
228
|
+
}, {
|
|
229
|
+
jobs: {
|
|
230
|
+
path: string;
|
|
231
|
+
methods: string[];
|
|
232
|
+
lastExecution?: {
|
|
233
|
+
error: string | null;
|
|
234
|
+
startedAt: string;
|
|
235
|
+
completedAt: string;
|
|
236
|
+
duration: number;
|
|
237
|
+
} | null | undefined;
|
|
238
|
+
}[];
|
|
239
|
+
runningJobs: {
|
|
240
|
+
status: "running" | "completed" | "failed";
|
|
241
|
+
method: string;
|
|
242
|
+
jobId: string;
|
|
243
|
+
jobName: string;
|
|
244
|
+
startedAt: string;
|
|
245
|
+
completedAt?: string | undefined;
|
|
246
|
+
duration?: number | undefined;
|
|
247
|
+
error?: string | undefined;
|
|
248
|
+
}[];
|
|
249
|
+
jobCompletions: Record<string, {
|
|
250
|
+
status: "completed" | "failed";
|
|
251
|
+
completedAt: string;
|
|
252
|
+
error?: string | undefined;
|
|
253
|
+
}>;
|
|
254
|
+
}>;
|
|
255
|
+
export type JobsSchema = z.infer<typeof jobsSchema>;
|
|
256
|
+
export type RunningJobSchema = z.infer<typeof runningJobSchema>;
|
|
257
|
+
export type JobCompletionSchema = z.infer<typeof jobCompletionSchema>;
|
|
258
|
+
export type JobMetadataSchema = z.infer<typeof jobMetadataSchema>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jobsSchema = exports.jobMetadataSchema = exports.jobCompletionSchema = exports.runningJobSchema = exports.jsonSchema = exports.jobIdParametersSchema = exports.parametersSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Schema for job execution parameters
|
|
7
|
+
*/
|
|
8
|
+
exports.parametersSchema = zod_1.z.object({
|
|
9
|
+
job: zod_1.z.string(),
|
|
10
|
+
method: zod_1.z.string(),
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Schema for job ID parameters
|
|
14
|
+
*/
|
|
15
|
+
exports.jobIdParametersSchema = zod_1.z.object({
|
|
16
|
+
jobId: zod_1.z.string(),
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Schema for JSON request/response bodies
|
|
20
|
+
* Allows any object structure to pass through
|
|
21
|
+
*/
|
|
22
|
+
exports.jsonSchema = zod_1.z.object({}).passthrough();
|
|
23
|
+
/**
|
|
24
|
+
* Schema for running job information
|
|
25
|
+
*/
|
|
26
|
+
exports.runningJobSchema = zod_1.z.object({
|
|
27
|
+
jobId: zod_1.z.string(),
|
|
28
|
+
jobName: zod_1.z.string(),
|
|
29
|
+
method: zod_1.z.string(),
|
|
30
|
+
status: zod_1.z.enum(['running', 'completed', 'failed']),
|
|
31
|
+
startedAt: zod_1.z.string(),
|
|
32
|
+
completedAt: zod_1.z.string().optional(),
|
|
33
|
+
duration: zod_1.z.number().optional(),
|
|
34
|
+
error: zod_1.z.string().optional(),
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Schema for job completion information
|
|
38
|
+
*/
|
|
39
|
+
exports.jobCompletionSchema = zod_1.z.object({
|
|
40
|
+
completedAt: zod_1.z.string(),
|
|
41
|
+
status: zod_1.z.enum(['completed', 'failed']),
|
|
42
|
+
error: zod_1.z.string().optional(),
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Schema for job metadata (path and methods)
|
|
46
|
+
*/
|
|
47
|
+
exports.jobMetadataSchema = zod_1.z.object({
|
|
48
|
+
path: zod_1.z.string(),
|
|
49
|
+
methods: zod_1.z.array(zod_1.z.string()),
|
|
50
|
+
lastExecution: zod_1.z
|
|
51
|
+
.object({
|
|
52
|
+
startedAt: zod_1.z.string(),
|
|
53
|
+
completedAt: zod_1.z.string(),
|
|
54
|
+
duration: zod_1.z.number(),
|
|
55
|
+
error: zod_1.z.string().nullable(),
|
|
56
|
+
})
|
|
57
|
+
.nullable()
|
|
58
|
+
.optional(),
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* Schema for the complete jobs response
|
|
62
|
+
*/
|
|
63
|
+
exports.jobsSchema = zod_1.z.object({
|
|
64
|
+
jobs: zod_1.z.array(exports.jobMetadataSchema),
|
|
65
|
+
runningJobs: zod_1.z.array(exports.runningJobSchema),
|
|
66
|
+
jobCompletions: zod_1.z.record(exports.jobCompletionSchema),
|
|
67
|
+
});
|