Chore: Modified eventTrigger to accept a string and an array of strings.

This commit is contained in:
Chigala
2023-07-27 00:09:03 +01:00
parent 8ac83f1d59
commit e0a2cec978
4 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -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(),
+1 -1
View File
@@ -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`.
* */
+2 -2
View File
@@ -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;