|
| 1 | +type EventSubscriptionEvent< |
| 2 | + Service extends string, |
| 3 | + Type extends string, |
| 4 | + Source, |
| 5 | + Payload = {}, |
| 6 | +> = { |
| 7 | + type: `cf.${Service}.${Type}`; |
| 8 | + source: { service: Service } & Source; |
| 9 | + payload: Payload; |
| 10 | + metadata: { |
| 11 | + accountId: string; |
| 12 | + eventId: string; |
| 13 | + eventSubscriptionId: string; |
| 14 | + eventTimestamp: string; // RFC3339 timestamp |
| 15 | + eventSchemaVersion: 1; |
| 16 | + }; |
| 17 | +}; |
| 18 | + |
| 19 | +// Super Slurper |
| 20 | +export type EventMessageSuperSlurper = |
| 21 | + | EventSubscriptionEvent<"slurper", "jobStarted", { jobId: string }> |
| 22 | + | EventSubscriptionEvent<"slurper", "jobPaused", { jobId: string }> |
| 23 | + | EventSubscriptionEvent<"slurper", "jobResumed", { jobId: string }> |
| 24 | + | EventSubscriptionEvent< |
| 25 | + "slurper", |
| 26 | + "jobFinished", |
| 27 | + { jobId: string }, |
| 28 | + { |
| 29 | + totalObjectsCount: number; |
| 30 | + migratedObjectsCount: number; |
| 31 | + failedObjectsCount: number; |
| 32 | + } |
| 33 | + > |
| 34 | + | EventSubscriptionEvent<"slurper", "jobAborted", { jobId: string }>; |
| 35 | + |
| 36 | +// Workflows |
| 37 | +type SubscriptionEventSourceWorkflows = { |
| 38 | + workflowId: string; |
| 39 | + workflowName: string; |
| 40 | + versionId: string; |
| 41 | + instanceId: string; |
| 42 | +}; |
| 43 | +export type EventMessageWorkflows = |
| 44 | + | EventSubscriptionEvent< |
| 45 | + "workflows", |
| 46 | + "instanceQueued", |
| 47 | + SubscriptionEventSourceWorkflows |
| 48 | + > |
| 49 | + | EventSubscriptionEvent< |
| 50 | + "workflows", |
| 51 | + "instanceStarted", |
| 52 | + SubscriptionEventSourceWorkflows |
| 53 | + > |
| 54 | + | EventSubscriptionEvent< |
| 55 | + "workflows", |
| 56 | + "instancePaused", |
| 57 | + SubscriptionEventSourceWorkflows |
| 58 | + > |
| 59 | + | EventSubscriptionEvent< |
| 60 | + "workflows", |
| 61 | + "instanceResumed", |
| 62 | + SubscriptionEventSourceWorkflows |
| 63 | + > |
| 64 | + | EventSubscriptionEvent< |
| 65 | + "workflows", |
| 66 | + "instanceErrored", |
| 67 | + SubscriptionEventSourceWorkflows |
| 68 | + > |
| 69 | + | EventSubscriptionEvent< |
| 70 | + "workflows", |
| 71 | + "instanceTerminated", |
| 72 | + SubscriptionEventSourceWorkflows |
| 73 | + > |
| 74 | + | EventSubscriptionEvent< |
| 75 | + "workflows", |
| 76 | + "instanceFinished", |
| 77 | + SubscriptionEventSourceWorkflows |
| 78 | + >; |
| 79 | + |
| 80 | +export type EventMessage = EventMessageSuperSlurper | EventMessageWorkflows; |
0 commit comments