Skip to content

Commit 390bed0

Browse files
committed
Some tweaks to the Event Filter guide
1 parent e3e3dab commit 390bed0

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

docs/documentation/guides/event-filter.mdx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Effectively, each array is an OR condition, and the entire event pattern is an A
4545

4646
So the above event filter will match because `status == "ACCEPTED"`, and it would also match if `status == "REJECTED"`.
4747

48-
### String Filters
48+
## String Filters
4949

5050
String filters are used to match string values within the event payload. You can filter events based on exact string matches, case-insensitive matches, starts-with, ends-with, and more.
5151

@@ -56,7 +56,7 @@ String filters are used to match string values within the event payload. You can
5656
- `name: [{ $endsWith: "hn" }]`: Triggers the job if the name field ends with "hn".
5757
- `name: [{ $ignoreCaseEquals: "john" }]` : Triggers the job if the name field is equal to "john" regardless of case.
5858

59-
#### Examples of string filters used in a Trigger.
59+
### Examples
6060

6161
```ts
6262
client.defineJob({
@@ -98,7 +98,7 @@ client.defineJob({
9898
});
9999
```
100100

101-
### Boolean Filters
101+
## Boolean Filters
102102

103103
Boolean filters are used to filter events based on boolean values within the event payload.
104104

@@ -107,7 +107,7 @@ Boolean filters are used to filter events based on boolean values within the eve
107107
- `paidPlan: [true]`: Triggers the job if the `PaidPlan` field in the event payload is `true`.
108108
- `isAdmin: [false]`: Triggers the job if the `isAdmin` field in the event payload is `false`.
109109

110-
#### Examples of boolean filters used in a Trigger.
110+
### Examples
111111

112112
```ts
113113
client.defineJob({
@@ -150,7 +150,7 @@ client.defineJob({
150150
});
151151
```
152152

153-
### Number Filters
153+
## Number Filters
154154

155155
Number filters are used to filter events based on numeric values within the event payload. It can also be used to perform numeric comparisons on values within the event payload.
156156

@@ -164,7 +164,7 @@ Number filters are used to filter events based on numeric values within the even
164164
- `age: [{ $gt: 20 }, { $lt: 40 }]`: Triggers the job if the `age` field is greater than 20 and less than 40.
165165
- `score: [{ $between: [90, 110] }]`: Triggers the job if the `score` field is between 90 and 110.
166166

167-
#### Examples of number filters used in a Trigger.
167+
### Examples
168168

169169
```ts
170170
client.defineJob({
@@ -242,15 +242,15 @@ client.defineJob({
242242
});
243243
```
244244

245-
### Array Filters
245+
## Array Filters
246246

247247
Array filters are used to filter events based on the content of arrays within the event payload.
248248

249249
**Examples:**
250250

251251
- `hobbies: [{ $includes: "reading" }]`: Triggers the job if the hobbies array includes the value "reading".
252252

253-
#### Example of content filters being used in a Trigger.
253+
### Examples
254254

255255
```ts
256256
client.defineJob({
@@ -273,7 +273,7 @@ client.defineJob({
273273
});
274274
```
275275

276-
### Existence Filters
276+
## Existence Filters
277277

278278
Existence filters are used to filter events based on the presence or absence of certain keys within the event payload.
279279

@@ -282,7 +282,7 @@ Existence filters are used to filter events based on the presence or absence of
282282
- `name: [{ $exists: true }]` : Triggers the job if the `name` field exists in the event payload.
283283
- `foo: [{ $exists: false }]` : Triggers the job if the foo field does not exist in the event payload.
284284

285-
#### Examples of existence filters used in a Trigger.
285+
### Examples
286286

287287
```ts
288288
client.defineJob({
@@ -323,7 +323,7 @@ client.defineJob({
323323
});
324324
```
325325

326-
### Combining Filters
326+
## Combining Filters
327327

328328
Filters can be combined to create more complex conditions for triggering jobs.
329329

@@ -334,7 +334,7 @@ Filters can be combined to create more complex conditions for triggering jobs.
334334
- `name: ["Alice", "Bob"]` : Triggers the job if the name is either "Alice" or "Bob".
335335
- `name: ["Alice", "Bob"], age: [30]` : Triggers the job if the name is either "Alice" or "Bob" and the age is 30.
336336

337-
#### Examples of combining filters used in a Trigger.
337+
### Examples
338338

339339
```ts
340340
client.defineJob({
@@ -380,7 +380,7 @@ client.defineJob({
380380
});
381381
```
382382

383-
### Stripe Trigger with Event Filter
383+
## Using with Stripe triggers
384384

385385
Here is an example of a Stripe Trigger with an Event Filter:
386386

@@ -404,7 +404,7 @@ The job is triggered by the `onCustomerSubscriptionCreated` event from Stripe. I
404404

405405
- Currency: Only subscriptions with the currency "USD" will trigger this job.
406406

407-
### Supabase trigger with Event Filter
407+
## Using with Supabase triggers
408408

409409
Here is an example of a Supabase Trigger with an Event Filter:
410410

docs/mint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@
117117
"documentation/guides/cli",
118118
"documentation/guides/manual",
119119
"documentation/guides/running-jobs",
120-
"documentation/guides/event-filter",
121120
{
122121
"group": "Using the Dashboard",
123122
"pages": [
@@ -145,6 +144,7 @@
145144
"documentation/guides/deployment-automatic"
146145
]
147146
},
147+
"documentation/guides/event-filter",
148148
"documentation/guides/zod",
149149
{
150150
"group": "Self hosting",

0 commit comments

Comments
 (0)