Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/webapp/app/services/events/deliverEvent.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export class DeliverEventService {
const possibleEventDispatchers = await tx.eventDispatcher.findMany({
where: {
environmentId: eventRecord.environmentId,
event: eventRecord.name,
event: {
has: eventRecord.name,
},
source: eventRecord.source,
enabled: true,
manual: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "EventDispatcher" DROP COLUMN "event",
ADD COLUMN "event" TEXT[];
2 changes: 1 addition & 1 deletion packages/database/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ enum DynamicTriggerType {

model EventDispatcher {
id String @id @default(cuid())
event String
event String[]
source String
payloadFilter Json?
contextFilter Json?
Expand Down
2 changes: 1 addition & 1 deletion packages/internal/src/schemas/eventFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion packages/internal/src/schemas/triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
4 changes: 2 additions & 2 deletions packages/trigger-sdk/src/triggers/eventTrigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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`.
* */
Expand Down
4 changes: 2 additions & 2 deletions packages/trigger-sdk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down