Chore: Modified eventTrigger to accept a string and an array of strings.
This commit is contained in:
@@ -19,7 +19,7 @@ export const EventFilterSchema: z.ZodType<EventFilter> = z.lazy(() =>
|
||||
);
|
||||
|
||||
export const EventRuleSchema = z.object({
|
||||
event: z.string(),
|
||||
event: z.union([z.string(), z.array(z.string())]),
|
||||
source: z.string(),
|
||||
payload: EventFilterSchema.optional(),
|
||||
context: EventFilterSchema.optional(),
|
||||
|
||||
@@ -30,7 +30,7 @@ export const DynamicTriggerMetadataSchema = z.object({
|
||||
|
||||
export const StaticTriggerMetadataSchema = z.object({
|
||||
type: z.literal("static"),
|
||||
title: z.string(),
|
||||
title: z.union([z.string(), z.array(z.string())]),
|
||||
properties: z.array(DisplayPropertySchema).optional(),
|
||||
rule: EventRuleSchema,
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ import { EventSpecification, Trigger } from "../types";
|
||||
type EventTriggerOptions<TEventSpecification extends EventSpecification<any>> =
|
||||
{
|
||||
event: TEventSpecification;
|
||||
name?: string;
|
||||
name?: string | string[];
|
||||
source?: string;
|
||||
filter?: EventFilter;
|
||||
};
|
||||
@@ -57,7 +57,7 @@ export class EventTrigger<TEventSpecification extends EventSpecification<any>>
|
||||
/** Configuration options for an EventTrigger */
|
||||
type TriggerOptions<TEvent> = {
|
||||
/** The name of the event you are subscribing to. Must be an exact match (case sensitive). */
|
||||
name: string;
|
||||
name: string | string[];
|
||||
/** A [Zod](https://trigger.dev/docs/documentation/guides/zod) schema that defines the shape of the event payload.
|
||||
* The default is `z.any()` which is `any`.
|
||||
* */
|
||||
|
||||
@@ -69,13 +69,13 @@ export interface Trigger<TEventSpec extends EventSpecification<any>> {
|
||||
|
||||
export type EventSpecificationExample = {
|
||||
id: string;
|
||||
name: string;
|
||||
name: string | string[];
|
||||
icon?: string;
|
||||
payload: any;
|
||||
};
|
||||
|
||||
export interface EventSpecification<TEvent extends any> {
|
||||
name: string;
|
||||
name: string | string[];
|
||||
title: string;
|
||||
source: string;
|
||||
icon: string;
|
||||
|
||||
Reference in New Issue
Block a user