temporal-explorer 0.0.0-mvp
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 +21 -0
- package/README.md +149 -0
- package/dist/api/index.js +4322 -0
- package/dist/cli/index.js +5292 -0
- package/dist/schemas/index.js +612 -0
- package/package.json +108 -0
- package/packages/schemas/json-schema/temporal-analysis.v1.schema.json +372 -0
- package/packages/schemas/json-schema/temporal-overlay.v1.schema.json +246 -0
- package/packages/schemas/json-schema/temporal-trace.v1.schema.json +607 -0
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/schemas/src/temporal-analysis.ts
|
|
3
|
+
import { z as z2 } from "zod";
|
|
4
|
+
|
|
5
|
+
// packages/schemas/src/common.ts
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
var confidenceSchema = z.union([
|
|
8
|
+
z.literal("exact"),
|
|
9
|
+
z.literal("inferred"),
|
|
10
|
+
z.literal("partial"),
|
|
11
|
+
z.literal("ambiguous"),
|
|
12
|
+
z.literal("dynamic"),
|
|
13
|
+
z.literal("unknown")
|
|
14
|
+
]);
|
|
15
|
+
var sourcePositionSchema = z.object({
|
|
16
|
+
line: z.number().int().positive(),
|
|
17
|
+
column: z.number().int().positive(),
|
|
18
|
+
offset: z.number().int().nonnegative()
|
|
19
|
+
}).strict();
|
|
20
|
+
var sourceLocationSchema = z.object({
|
|
21
|
+
path: z.string().min(1),
|
|
22
|
+
pathKind: z.union([z.literal("project-relative"), z.literal("absolute")]),
|
|
23
|
+
start: sourcePositionSchema,
|
|
24
|
+
end: sourcePositionSchema,
|
|
25
|
+
symbolName: z.string().min(1).optional()
|
|
26
|
+
}).strict();
|
|
27
|
+
var diagnosticSchema = z.object({
|
|
28
|
+
code: z.string().min(1),
|
|
29
|
+
category: z.union([
|
|
30
|
+
z.literal("configuration"),
|
|
31
|
+
z.literal("discovery"),
|
|
32
|
+
z.literal("type-extraction"),
|
|
33
|
+
z.literal("control-flow"),
|
|
34
|
+
z.literal("determinism"),
|
|
35
|
+
z.literal("history"),
|
|
36
|
+
z.literal("mapping"),
|
|
37
|
+
z.literal("rendering"),
|
|
38
|
+
z.literal("privacy"),
|
|
39
|
+
z.literal("compatibility")
|
|
40
|
+
]),
|
|
41
|
+
severity: z.union([z.literal("error"), z.literal("warning"), z.literal("info")]),
|
|
42
|
+
message: z.string().min(1),
|
|
43
|
+
source: sourceLocationSchema.optional(),
|
|
44
|
+
relatedSources: z.array(sourceLocationSchema).optional(),
|
|
45
|
+
confidence: confidenceSchema,
|
|
46
|
+
documentationUrl: z.string().url().optional()
|
|
47
|
+
}).strict();
|
|
48
|
+
var artifactMetadataSchema = z.object({
|
|
49
|
+
temporalExplorerVersion: z.string().min(1),
|
|
50
|
+
schemaVersion: z.string().min(1),
|
|
51
|
+
generatedAt: z.string().datetime().optional(),
|
|
52
|
+
inputs: z.object({
|
|
53
|
+
projectRoot: z.string(),
|
|
54
|
+
configHash: z.string(),
|
|
55
|
+
tsconfigHash: z.string().optional(),
|
|
56
|
+
packageMetadataHash: z.string().optional(),
|
|
57
|
+
lockfileHash: z.string().optional(),
|
|
58
|
+
sourceFileHashes: z.record(z.string(), z.string()),
|
|
59
|
+
temporalSdkVersions: z.record(z.string(), z.string())
|
|
60
|
+
}).strict()
|
|
61
|
+
}).strict();
|
|
62
|
+
|
|
63
|
+
// packages/schemas/src/temporal-analysis.ts
|
|
64
|
+
var typeShapeSchema = z2.lazy(() => z2.object({
|
|
65
|
+
id: z2.string().min(1),
|
|
66
|
+
display: z2.string().min(1),
|
|
67
|
+
displayName: z2.string().min(1).optional(),
|
|
68
|
+
fullyQualifiedName: z2.string().min(1).optional(),
|
|
69
|
+
kind: z2.union([
|
|
70
|
+
z2.literal("primitive"),
|
|
71
|
+
z2.literal("object"),
|
|
72
|
+
z2.literal("array"),
|
|
73
|
+
z2.literal("tuple"),
|
|
74
|
+
z2.literal("union"),
|
|
75
|
+
z2.literal("intersection"),
|
|
76
|
+
z2.literal("literal"),
|
|
77
|
+
z2.literal("enum"),
|
|
78
|
+
z2.literal("function"),
|
|
79
|
+
z2.literal("promise"),
|
|
80
|
+
z2.literal("external"),
|
|
81
|
+
z2.literal("unknown")
|
|
82
|
+
]),
|
|
83
|
+
nullable: z2.boolean().optional(),
|
|
84
|
+
optional: z2.boolean().optional(),
|
|
85
|
+
properties: z2.record(z2.string(), typeShapeSchema).optional(),
|
|
86
|
+
items: typeShapeSchema.optional(),
|
|
87
|
+
tupleItems: z2.array(typeShapeSchema).optional(),
|
|
88
|
+
union: z2.array(typeShapeSchema).optional(),
|
|
89
|
+
intersection: z2.array(typeShapeSchema).optional(),
|
|
90
|
+
source: sourceLocationSchema.optional(),
|
|
91
|
+
module: z2.string().min(1).optional(),
|
|
92
|
+
declaration: sourceLocationSchema.optional(),
|
|
93
|
+
typeArguments: z2.array(typeShapeSchema).optional(),
|
|
94
|
+
references: z2.array(z2.string().min(1)).optional(),
|
|
95
|
+
recursive: z2.boolean().optional(),
|
|
96
|
+
confidence: confidenceSchema
|
|
97
|
+
}).strict());
|
|
98
|
+
var workflowSignatureSchema = z2.object({
|
|
99
|
+
args: z2.array(typeShapeSchema),
|
|
100
|
+
result: typeShapeSchema
|
|
101
|
+
}).strict();
|
|
102
|
+
var temporalCommandSchema = z2.object({
|
|
103
|
+
id: z2.string().min(1),
|
|
104
|
+
kind: z2.union([
|
|
105
|
+
z2.literal("activity"),
|
|
106
|
+
z2.literal("workflow-lifecycle"),
|
|
107
|
+
z2.literal("timer"),
|
|
108
|
+
z2.literal("condition"),
|
|
109
|
+
z2.literal("signal"),
|
|
110
|
+
z2.literal("query"),
|
|
111
|
+
z2.literal("update"),
|
|
112
|
+
z2.literal("child-workflow"),
|
|
113
|
+
z2.literal("external-workflow"),
|
|
114
|
+
z2.literal("continue-as-new"),
|
|
115
|
+
z2.literal("patch"),
|
|
116
|
+
z2.literal("cancellation-scope"),
|
|
117
|
+
z2.literal("dynamic")
|
|
118
|
+
]),
|
|
119
|
+
name: z2.string().min(1),
|
|
120
|
+
source: sourceLocationSchema,
|
|
121
|
+
confidence: confidenceSchema,
|
|
122
|
+
staticOrder: z2.number().int().nonnegative()
|
|
123
|
+
}).strict();
|
|
124
|
+
var signalDefinitionSchema = z2.object({
|
|
125
|
+
id: z2.string().min(1),
|
|
126
|
+
name: z2.string().min(1),
|
|
127
|
+
source: sourceLocationSchema,
|
|
128
|
+
args: z2.array(typeShapeSchema),
|
|
129
|
+
handlerSource: sourceLocationSchema.optional(),
|
|
130
|
+
confidence: confidenceSchema
|
|
131
|
+
}).strict();
|
|
132
|
+
var queryDefinitionSchema = z2.object({
|
|
133
|
+
id: z2.string().min(1),
|
|
134
|
+
name: z2.string().min(1),
|
|
135
|
+
source: sourceLocationSchema,
|
|
136
|
+
args: z2.array(typeShapeSchema),
|
|
137
|
+
result: typeShapeSchema.optional(),
|
|
138
|
+
handlerSource: sourceLocationSchema.optional(),
|
|
139
|
+
confidence: confidenceSchema
|
|
140
|
+
}).strict();
|
|
141
|
+
var updateDefinitionSchema = z2.object({
|
|
142
|
+
id: z2.string().min(1),
|
|
143
|
+
name: z2.string().min(1),
|
|
144
|
+
source: sourceLocationSchema,
|
|
145
|
+
args: z2.array(typeShapeSchema),
|
|
146
|
+
result: typeShapeSchema.optional(),
|
|
147
|
+
handlerSource: sourceLocationSchema.optional(),
|
|
148
|
+
validatorSource: sourceLocationSchema.optional(),
|
|
149
|
+
confidence: confidenceSchema
|
|
150
|
+
}).strict();
|
|
151
|
+
var workflowDependencySchema = z2.object({
|
|
152
|
+
kind: z2.literal("type-import"),
|
|
153
|
+
name: z2.string().min(1),
|
|
154
|
+
module: z2.string().min(1)
|
|
155
|
+
}).strict();
|
|
156
|
+
var workflowDefinitionSchema = z2.object({
|
|
157
|
+
id: z2.string().min(1),
|
|
158
|
+
name: z2.string().min(1),
|
|
159
|
+
source: sourceLocationSchema,
|
|
160
|
+
exported: z2.boolean(),
|
|
161
|
+
signature: workflowSignatureSchema,
|
|
162
|
+
messageSurface: z2.object({
|
|
163
|
+
signals: z2.array(signalDefinitionSchema),
|
|
164
|
+
queries: z2.array(queryDefinitionSchema),
|
|
165
|
+
updates: z2.array(updateDefinitionSchema)
|
|
166
|
+
}).strict(),
|
|
167
|
+
state: z2.object({
|
|
168
|
+
variables: z2.array(z2.unknown())
|
|
169
|
+
}).strict(),
|
|
170
|
+
body: z2.object({
|
|
171
|
+
nodes: z2.array(z2.unknown())
|
|
172
|
+
}).strict(),
|
|
173
|
+
temporalCommands: z2.array(temporalCommandSchema),
|
|
174
|
+
dependencies: z2.array(workflowDependencySchema),
|
|
175
|
+
diagnostics: z2.array(diagnosticSchema)
|
|
176
|
+
}).strict();
|
|
177
|
+
var activityDefinitionSchema = z2.object({
|
|
178
|
+
id: z2.string().min(1),
|
|
179
|
+
name: z2.string().min(1),
|
|
180
|
+
source: sourceLocationSchema.optional(),
|
|
181
|
+
implementationSource: sourceLocationSchema.optional(),
|
|
182
|
+
confidence: confidenceSchema
|
|
183
|
+
}).strict();
|
|
184
|
+
var temporalAnalysisDocumentSchema = z2.object({
|
|
185
|
+
schemaVersion: z2.literal("temporal-analysis/v1"),
|
|
186
|
+
artifactId: z2.string().min(1),
|
|
187
|
+
metadata: artifactMetadataSchema,
|
|
188
|
+
project: z2.object({
|
|
189
|
+
root: z2.string().min(1),
|
|
190
|
+
tsconfig: z2.string().min(1),
|
|
191
|
+
packageManager: z2.union([z2.literal("bun"), z2.literal("npm"), z2.literal("pnpm"), z2.literal("yarn")]).optional()
|
|
192
|
+
}).strict(),
|
|
193
|
+
sdk: z2.object({
|
|
194
|
+
temporalTypeScriptVersion: z2.string().min(1).optional(),
|
|
195
|
+
detectedPackages: z2.array(z2.string().min(1))
|
|
196
|
+
}).strict(),
|
|
197
|
+
workers: z2.array(z2.unknown()),
|
|
198
|
+
workflows: z2.array(workflowDefinitionSchema),
|
|
199
|
+
activities: z2.array(activityDefinitionSchema),
|
|
200
|
+
clients: z2.array(z2.unknown()),
|
|
201
|
+
diagnostics: z2.array(diagnosticSchema)
|
|
202
|
+
}).strict();
|
|
203
|
+
|
|
204
|
+
// packages/schemas/src/temporal-overlay.ts
|
|
205
|
+
import { z as z3 } from "zod";
|
|
206
|
+
var staticOverlayNodeSchema = z3.object({
|
|
207
|
+
id: z3.string().min(1),
|
|
208
|
+
kind: z3.union([
|
|
209
|
+
z3.literal("workflow"),
|
|
210
|
+
z3.literal("activity"),
|
|
211
|
+
z3.literal("signal"),
|
|
212
|
+
z3.literal("timer"),
|
|
213
|
+
z3.literal("condition"),
|
|
214
|
+
z3.literal("query"),
|
|
215
|
+
z3.literal("update"),
|
|
216
|
+
z3.literal("child-workflow"),
|
|
217
|
+
z3.literal("external-workflow"),
|
|
218
|
+
z3.literal("continue-as-new"),
|
|
219
|
+
z3.literal("patch"),
|
|
220
|
+
z3.literal("cancellation-scope"),
|
|
221
|
+
z3.literal("dynamic")
|
|
222
|
+
]),
|
|
223
|
+
name: z3.string().min(1),
|
|
224
|
+
observed: z3.boolean(),
|
|
225
|
+
source: sourceLocationSchema.optional()
|
|
226
|
+
}).strict();
|
|
227
|
+
var mappingEvidenceSchema = z3.object({
|
|
228
|
+
kind: z3.union([
|
|
229
|
+
z3.literal("activity-type"),
|
|
230
|
+
z3.literal("command-order"),
|
|
231
|
+
z3.literal("workflow-type"),
|
|
232
|
+
z3.literal("signal-name"),
|
|
233
|
+
z3.literal("timer-order"),
|
|
234
|
+
z3.literal("update-name"),
|
|
235
|
+
z3.literal("child-workflow-type"),
|
|
236
|
+
z3.literal("external-signal-name"),
|
|
237
|
+
z3.literal("patch-id"),
|
|
238
|
+
z3.literal("continue-as-new"),
|
|
239
|
+
z3.literal("scope-containment"),
|
|
240
|
+
z3.literal("dynamic-dispatch"),
|
|
241
|
+
z3.literal("replay-command-sequence"),
|
|
242
|
+
z3.literal("event-reference"),
|
|
243
|
+
z3.literal("source-location"),
|
|
244
|
+
z3.literal("unmapped")
|
|
245
|
+
]),
|
|
246
|
+
description: z3.string().min(1),
|
|
247
|
+
eventIds: z3.array(z3.number().int().positive()).optional(),
|
|
248
|
+
staticNodeId: z3.string().min(1).optional()
|
|
249
|
+
}).strict();
|
|
250
|
+
var runtimeNodeMappingSchema = z3.object({
|
|
251
|
+
runtimeOperationId: z3.string().min(1),
|
|
252
|
+
staticNodeId: z3.string().min(1).optional(),
|
|
253
|
+
confidence: confidenceSchema,
|
|
254
|
+
reason: z3.string().min(1),
|
|
255
|
+
evidence: z3.array(mappingEvidenceSchema)
|
|
256
|
+
}).strict();
|
|
257
|
+
var executionOverlayDocumentSchema = z3.object({
|
|
258
|
+
schemaVersion: z3.literal("temporal-overlay/v1"),
|
|
259
|
+
artifactId: z3.string().min(1),
|
|
260
|
+
staticAnalysisId: z3.string().min(1),
|
|
261
|
+
runtimeTraceId: z3.string().min(1),
|
|
262
|
+
workflow: z3.string().min(1),
|
|
263
|
+
staticNodes: z3.array(staticOverlayNodeSchema),
|
|
264
|
+
mappings: z3.array(runtimeNodeMappingSchema),
|
|
265
|
+
branchOutcomes: z3.array(z3.unknown()),
|
|
266
|
+
coverage: z3.object({
|
|
267
|
+
nodes: z3.object({
|
|
268
|
+
total: z3.number().int().nonnegative(),
|
|
269
|
+
observed: z3.number().int().nonnegative(),
|
|
270
|
+
skipped: z3.number().int().nonnegative(),
|
|
271
|
+
unmappedRuntimeOperations: z3.number().int().nonnegative()
|
|
272
|
+
}).strict(),
|
|
273
|
+
activities: z3.object({
|
|
274
|
+
staticTotal: z3.number().int().nonnegative(),
|
|
275
|
+
observed: z3.number().int().nonnegative(),
|
|
276
|
+
retried: z3.number().int().nonnegative(),
|
|
277
|
+
failed: z3.number().int().nonnegative()
|
|
278
|
+
}).strict(),
|
|
279
|
+
messages: z3.object({
|
|
280
|
+
staticSignals: z3.number().int().nonnegative(),
|
|
281
|
+
receivedSignals: z3.array(z3.string()),
|
|
282
|
+
staticUpdates: z3.number().int().nonnegative(),
|
|
283
|
+
receivedUpdates: z3.array(z3.string()),
|
|
284
|
+
staticQueries: z3.number().int().nonnegative()
|
|
285
|
+
}).strict(),
|
|
286
|
+
timers: z3.object({
|
|
287
|
+
staticTotal: z3.number().int().nonnegative(),
|
|
288
|
+
fired: z3.number().int().nonnegative(),
|
|
289
|
+
canceled: z3.number().int().nonnegative(),
|
|
290
|
+
pending: z3.number().int().nonnegative()
|
|
291
|
+
}).strict()
|
|
292
|
+
}).strict(),
|
|
293
|
+
diagnostics: z3.array(diagnosticSchema)
|
|
294
|
+
}).strict();
|
|
295
|
+
|
|
296
|
+
// packages/schemas/src/temporal-trace.ts
|
|
297
|
+
import { z as z4 } from "zod";
|
|
298
|
+
var eventReferenceSchema = z4.object({
|
|
299
|
+
eventId: z4.number().int().positive(),
|
|
300
|
+
eventType: z4.string().min(1)
|
|
301
|
+
}).strict();
|
|
302
|
+
var payloadReferenceSchema = z4.object({
|
|
303
|
+
id: z4.string().min(1),
|
|
304
|
+
eventId: z4.number().int().positive(),
|
|
305
|
+
kind: z4.union([
|
|
306
|
+
z4.literal("input"),
|
|
307
|
+
z4.literal("result"),
|
|
308
|
+
z4.literal("failure"),
|
|
309
|
+
z4.literal("signal"),
|
|
310
|
+
z4.literal("update")
|
|
311
|
+
]),
|
|
312
|
+
decoded: z4.boolean(),
|
|
313
|
+
preview: z4.unknown().optional(),
|
|
314
|
+
redacted: z4.boolean()
|
|
315
|
+
}).strict();
|
|
316
|
+
var activityAttemptSchema = z4.object({
|
|
317
|
+
attempt: z4.number().int().positive(),
|
|
318
|
+
scheduledEventId: z4.number().int().positive(),
|
|
319
|
+
startedEventId: z4.number().int().positive().optional(),
|
|
320
|
+
closedEventId: z4.number().int().positive().optional(),
|
|
321
|
+
status: z4.union([
|
|
322
|
+
z4.literal("completed"),
|
|
323
|
+
z4.literal("failed"),
|
|
324
|
+
z4.literal("timedOut"),
|
|
325
|
+
z4.literal("canceled"),
|
|
326
|
+
z4.literal("pending")
|
|
327
|
+
])
|
|
328
|
+
}).strict();
|
|
329
|
+
var workflowLifecycleOperationSchema = z4.object({
|
|
330
|
+
id: z4.string().min(1),
|
|
331
|
+
kind: z4.literal("workflow-lifecycle"),
|
|
332
|
+
status: z4.union([
|
|
333
|
+
z4.literal("started"),
|
|
334
|
+
z4.literal("completed"),
|
|
335
|
+
z4.literal("failed"),
|
|
336
|
+
z4.literal("canceled"),
|
|
337
|
+
z4.literal("terminated"),
|
|
338
|
+
z4.literal("timedOut"),
|
|
339
|
+
z4.literal("continued-as-new")
|
|
340
|
+
]),
|
|
341
|
+
eventReferences: z4.array(eventReferenceSchema),
|
|
342
|
+
payloadReferences: z4.array(z4.string().min(1))
|
|
343
|
+
}).strict();
|
|
344
|
+
var activityExecutionOperationSchema = z4.object({
|
|
345
|
+
id: z4.string().min(1),
|
|
346
|
+
kind: z4.literal("activity"),
|
|
347
|
+
activityType: z4.string().min(1),
|
|
348
|
+
activityId: z4.string().min(1),
|
|
349
|
+
status: z4.union([
|
|
350
|
+
z4.literal("completed"),
|
|
351
|
+
z4.literal("failed"),
|
|
352
|
+
z4.literal("timedOut"),
|
|
353
|
+
z4.literal("canceled"),
|
|
354
|
+
z4.literal("pending")
|
|
355
|
+
]),
|
|
356
|
+
attempts: z4.array(activityAttemptSchema),
|
|
357
|
+
firstScheduledAt: z4.string().datetime(),
|
|
358
|
+
closedAt: z4.string().datetime().optional(),
|
|
359
|
+
durationMs: z4.number().nonnegative().optional(),
|
|
360
|
+
eventReferences: z4.array(eventReferenceSchema),
|
|
361
|
+
payloadReferences: z4.array(z4.string().min(1))
|
|
362
|
+
}).strict();
|
|
363
|
+
var signalDeliveryOperationSchema = z4.object({
|
|
364
|
+
id: z4.string().min(1),
|
|
365
|
+
kind: z4.literal("signal"),
|
|
366
|
+
signalName: z4.string().min(1),
|
|
367
|
+
receivedAt: z4.string().datetime(),
|
|
368
|
+
eventReferences: z4.array(eventReferenceSchema),
|
|
369
|
+
payloadReferences: z4.array(z4.string().min(1))
|
|
370
|
+
}).strict();
|
|
371
|
+
var timerOperationSchema = z4.object({
|
|
372
|
+
id: z4.string().min(1),
|
|
373
|
+
kind: z4.literal("timer"),
|
|
374
|
+
timerId: z4.string().min(1),
|
|
375
|
+
status: z4.union([z4.literal("fired"), z4.literal("canceled"), z4.literal("pending")]),
|
|
376
|
+
startedAt: z4.string().datetime(),
|
|
377
|
+
closedAt: z4.string().datetime().optional(),
|
|
378
|
+
durationText: z4.string().min(1).optional(),
|
|
379
|
+
eventReferences: z4.array(eventReferenceSchema)
|
|
380
|
+
}).strict();
|
|
381
|
+
var updateOperationSchema = z4.object({
|
|
382
|
+
id: z4.string().min(1),
|
|
383
|
+
kind: z4.literal("update"),
|
|
384
|
+
updateId: z4.string().min(1),
|
|
385
|
+
updateName: z4.string().min(1),
|
|
386
|
+
status: z4.union([z4.literal("accepted"), z4.literal("completed"), z4.literal("failed")]),
|
|
387
|
+
acceptedAt: z4.string().datetime(),
|
|
388
|
+
closedAt: z4.string().datetime().optional(),
|
|
389
|
+
eventReferences: z4.array(eventReferenceSchema),
|
|
390
|
+
payloadReferences: z4.array(z4.string().min(1))
|
|
391
|
+
}).strict();
|
|
392
|
+
var childWorkflowOperationSchema = z4.object({
|
|
393
|
+
id: z4.string().min(1),
|
|
394
|
+
kind: z4.literal("child-workflow"),
|
|
395
|
+
workflowType: z4.string().min(1),
|
|
396
|
+
childWorkflowId: z4.string().min(1),
|
|
397
|
+
childRunId: z4.string().min(1).optional(),
|
|
398
|
+
status: z4.union([
|
|
399
|
+
z4.literal("initiated"),
|
|
400
|
+
z4.literal("startFailed"),
|
|
401
|
+
z4.literal("started"),
|
|
402
|
+
z4.literal("completed"),
|
|
403
|
+
z4.literal("failed"),
|
|
404
|
+
z4.literal("canceled"),
|
|
405
|
+
z4.literal("timedOut"),
|
|
406
|
+
z4.literal("terminated")
|
|
407
|
+
]),
|
|
408
|
+
initiatedAt: z4.string().datetime(),
|
|
409
|
+
closedAt: z4.string().datetime().optional(),
|
|
410
|
+
eventReferences: z4.array(eventReferenceSchema),
|
|
411
|
+
payloadReferences: z4.array(z4.string().min(1))
|
|
412
|
+
}).strict();
|
|
413
|
+
var externalSignalOperationSchema = z4.object({
|
|
414
|
+
id: z4.string().min(1),
|
|
415
|
+
kind: z4.literal("external-signal"),
|
|
416
|
+
signalName: z4.string().min(1),
|
|
417
|
+
targetWorkflowId: z4.string().min(1),
|
|
418
|
+
targetRunId: z4.string().min(1).optional(),
|
|
419
|
+
status: z4.union([z4.literal("initiated"), z4.literal("signaled"), z4.literal("failed")]),
|
|
420
|
+
initiatedAt: z4.string().datetime(),
|
|
421
|
+
closedAt: z4.string().datetime().optional(),
|
|
422
|
+
eventReferences: z4.array(eventReferenceSchema),
|
|
423
|
+
payloadReferences: z4.array(z4.string().min(1))
|
|
424
|
+
}).strict();
|
|
425
|
+
var markerOperationSchema = z4.object({
|
|
426
|
+
id: z4.string().min(1),
|
|
427
|
+
kind: z4.literal("marker"),
|
|
428
|
+
markerName: z4.string().min(1),
|
|
429
|
+
patchId: z4.string().min(1).optional(),
|
|
430
|
+
deprecated: z4.boolean().optional(),
|
|
431
|
+
recordedAt: z4.string().datetime(),
|
|
432
|
+
eventReferences: z4.array(eventReferenceSchema)
|
|
433
|
+
}).strict();
|
|
434
|
+
var continueAsNewOperationSchema = z4.object({
|
|
435
|
+
id: z4.string().min(1),
|
|
436
|
+
kind: z4.literal("continue-as-new"),
|
|
437
|
+
newRunId: z4.string().min(1).optional(),
|
|
438
|
+
occurredAt: z4.string().datetime(),
|
|
439
|
+
eventReferences: z4.array(eventReferenceSchema),
|
|
440
|
+
payloadReferences: z4.array(z4.string().min(1))
|
|
441
|
+
}).strict();
|
|
442
|
+
var cancelRequestOperationSchema = z4.object({
|
|
443
|
+
id: z4.string().min(1),
|
|
444
|
+
kind: z4.literal("cancel-request"),
|
|
445
|
+
requestedAt: z4.string().datetime(),
|
|
446
|
+
eventReferences: z4.array(eventReferenceSchema)
|
|
447
|
+
}).strict();
|
|
448
|
+
var unmappedHistoryOperationSchema = z4.object({
|
|
449
|
+
id: z4.string().min(1),
|
|
450
|
+
kind: z4.literal("unmapped"),
|
|
451
|
+
eventReferences: z4.array(eventReferenceSchema),
|
|
452
|
+
reason: z4.string().min(1)
|
|
453
|
+
}).strict();
|
|
454
|
+
var runtimeOperationSchema = z4.discriminatedUnion("kind", [
|
|
455
|
+
workflowLifecycleOperationSchema,
|
|
456
|
+
activityExecutionOperationSchema,
|
|
457
|
+
signalDeliveryOperationSchema,
|
|
458
|
+
timerOperationSchema,
|
|
459
|
+
updateOperationSchema,
|
|
460
|
+
childWorkflowOperationSchema,
|
|
461
|
+
externalSignalOperationSchema,
|
|
462
|
+
markerOperationSchema,
|
|
463
|
+
continueAsNewOperationSchema,
|
|
464
|
+
cancelRequestOperationSchema,
|
|
465
|
+
unmappedHistoryOperationSchema
|
|
466
|
+
]);
|
|
467
|
+
var runtimeTimelineEntrySchema = z4.object({
|
|
468
|
+
id: z4.string().min(1),
|
|
469
|
+
operationId: z4.string().min(1),
|
|
470
|
+
at: z4.string().datetime(),
|
|
471
|
+
label: z4.string().min(1),
|
|
472
|
+
eventIds: z4.array(z4.number().int().positive())
|
|
473
|
+
}).strict();
|
|
474
|
+
var runtimeTraceDocumentSchema = z4.object({
|
|
475
|
+
schemaVersion: z4.literal("temporal-trace/v1"),
|
|
476
|
+
artifactId: z4.string().min(1),
|
|
477
|
+
metadata: artifactMetadataSchema,
|
|
478
|
+
execution: z4.object({
|
|
479
|
+
workflowType: z4.string().min(1),
|
|
480
|
+
workflowId: z4.string().min(1),
|
|
481
|
+
runId: z4.string().min(1),
|
|
482
|
+
status: z4.union([
|
|
483
|
+
z4.literal("running"),
|
|
484
|
+
z4.literal("completed"),
|
|
485
|
+
z4.literal("failed"),
|
|
486
|
+
z4.literal("canceled"),
|
|
487
|
+
z4.literal("terminated"),
|
|
488
|
+
z4.literal("timedOut"),
|
|
489
|
+
z4.literal("continued-as-new")
|
|
490
|
+
]),
|
|
491
|
+
startedAt: z4.string().datetime(),
|
|
492
|
+
closedAt: z4.string().datetime().optional(),
|
|
493
|
+
durationMs: z4.number().nonnegative().optional()
|
|
494
|
+
}).strict(),
|
|
495
|
+
source: z4.object({
|
|
496
|
+
namespace: z4.string().min(1).optional(),
|
|
497
|
+
taskQueue: z4.string().min(1).optional(),
|
|
498
|
+
eventCount: z4.number().int().nonnegative(),
|
|
499
|
+
importedFrom: z4.union([z4.literal("file"), z4.literal("api"), z4.literal("cli")])
|
|
500
|
+
}).strict(),
|
|
501
|
+
operations: z4.array(runtimeOperationSchema),
|
|
502
|
+
timeline: z4.array(runtimeTimelineEntrySchema),
|
|
503
|
+
payloads: z4.array(payloadReferenceSchema),
|
|
504
|
+
diagnostics: z4.array(diagnosticSchema)
|
|
505
|
+
}).strict();
|
|
506
|
+
|
|
507
|
+
// packages/schemas/src/index.ts
|
|
508
|
+
var artifactSchemaVersions = {
|
|
509
|
+
analysis: "temporal-analysis/v1",
|
|
510
|
+
trace: "temporal-trace/v1",
|
|
511
|
+
overlay: "temporal-overlay/v1"
|
|
512
|
+
};
|
|
513
|
+
var artifactSchemaVersionValues = new Set(Object.values(artifactSchemaVersions));
|
|
514
|
+
function isTemporalExplorerArtifactSchemaVersion(value) {
|
|
515
|
+
return artifactSchemaVersionValues.has(value);
|
|
516
|
+
}
|
|
517
|
+
var artifactSchemasByVersion = {
|
|
518
|
+
[artifactSchemaVersions.analysis]: temporalAnalysisDocumentSchema,
|
|
519
|
+
[artifactSchemaVersions.trace]: runtimeTraceDocumentSchema,
|
|
520
|
+
[artifactSchemaVersions.overlay]: executionOverlayDocumentSchema
|
|
521
|
+
};
|
|
522
|
+
function getSchemaVersion(value) {
|
|
523
|
+
if (!value || typeof value !== "object" || !("schemaVersion" in value)) {
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
const candidate = value.schemaVersion;
|
|
527
|
+
return typeof candidate === "string" ? candidate : undefined;
|
|
528
|
+
}
|
|
529
|
+
function formatZodIssue(issue) {
|
|
530
|
+
return {
|
|
531
|
+
path: issue.path.length > 0 ? issue.path.join(".") : "<root>",
|
|
532
|
+
message: issue.message
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
function validateArtifact(value) {
|
|
536
|
+
const schemaVersion = getSchemaVersion(value);
|
|
537
|
+
if (!schemaVersion) {
|
|
538
|
+
return {
|
|
539
|
+
success: false,
|
|
540
|
+
code: "TES_MISSING_SCHEMA_VERSION",
|
|
541
|
+
issues: [{ path: "schemaVersion", message: "Artifact is missing schemaVersion." }]
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
if (!isTemporalExplorerArtifactSchemaVersion(schemaVersion)) {
|
|
545
|
+
return {
|
|
546
|
+
success: false,
|
|
547
|
+
code: "TES_UNSUPPORTED_SCHEMA_VERSION",
|
|
548
|
+
issues: [
|
|
549
|
+
{
|
|
550
|
+
path: "schemaVersion",
|
|
551
|
+
message: `Unsupported artifact schema version: ${schemaVersion}. This build supports ${Object.values(artifactSchemaVersions).join(", ")}; newer artifacts require upgrading temporal-explorer.`
|
|
552
|
+
}
|
|
553
|
+
]
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
const result = artifactSchemasByVersion[schemaVersion].safeParse(value);
|
|
557
|
+
if (!result.success) {
|
|
558
|
+
return {
|
|
559
|
+
success: false,
|
|
560
|
+
code: "TES_SCHEMA_VALIDATION_FAILED",
|
|
561
|
+
schemaVersion,
|
|
562
|
+
issues: result.error.issues.map(formatZodIssue)
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
return {
|
|
566
|
+
success: true,
|
|
567
|
+
schemaVersion,
|
|
568
|
+
value: result.data,
|
|
569
|
+
issues: []
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
export {
|
|
573
|
+
workflowSignatureSchema,
|
|
574
|
+
workflowLifecycleOperationSchema,
|
|
575
|
+
workflowDependencySchema,
|
|
576
|
+
workflowDefinitionSchema,
|
|
577
|
+
validateArtifact,
|
|
578
|
+
updateOperationSchema,
|
|
579
|
+
updateDefinitionSchema,
|
|
580
|
+
unmappedHistoryOperationSchema,
|
|
581
|
+
timerOperationSchema,
|
|
582
|
+
temporalCommandSchema,
|
|
583
|
+
temporalAnalysisDocumentSchema,
|
|
584
|
+
staticOverlayNodeSchema,
|
|
585
|
+
sourcePositionSchema,
|
|
586
|
+
sourceLocationSchema,
|
|
587
|
+
signalDeliveryOperationSchema,
|
|
588
|
+
signalDefinitionSchema,
|
|
589
|
+
runtimeTraceDocumentSchema,
|
|
590
|
+
runtimeTimelineEntrySchema,
|
|
591
|
+
runtimeOperationSchema,
|
|
592
|
+
runtimeNodeMappingSchema,
|
|
593
|
+
queryDefinitionSchema,
|
|
594
|
+
payloadReferenceSchema,
|
|
595
|
+
markerOperationSchema,
|
|
596
|
+
mappingEvidenceSchema,
|
|
597
|
+
isTemporalExplorerArtifactSchemaVersion,
|
|
598
|
+
externalSignalOperationSchema,
|
|
599
|
+
executionOverlayDocumentSchema,
|
|
600
|
+
eventReferenceSchema,
|
|
601
|
+
diagnosticSchema,
|
|
602
|
+
continueAsNewOperationSchema,
|
|
603
|
+
confidenceSchema,
|
|
604
|
+
childWorkflowOperationSchema,
|
|
605
|
+
cancelRequestOperationSchema,
|
|
606
|
+
artifactSchemasByVersion,
|
|
607
|
+
artifactSchemaVersions,
|
|
608
|
+
artifactMetadataSchema,
|
|
609
|
+
activityExecutionOperationSchema,
|
|
610
|
+
activityDefinitionSchema,
|
|
611
|
+
activityAttemptSchema
|
|
612
|
+
};
|