forked from inngest/inngest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.json
254 lines (254 loc) · 9.67 KB
/
schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/Function",
"required": ["id", "name", "triggers"],
"title": "Inngest Config",
"description": "An Inngest config file to deploy and run functions.",
"definitions": {
"Function": {
"type": "object",
"additionalProperties": false,
"properties": {
"$schema": {
"type": "string",
"description": "The schema used for the Inngest config file."
},
"name": {
"type": "string",
"description": "The friendly name of the function as it will appear in the Inngest Cloud dashboard.",
"minLength": 1
},
"id": {
"type": "string",
"description": "A unique ID for the function.",
"minLength": 1
},
"triggers": {
"description": "An array of methods by which the defined steps are invoked.",
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/Trigger"
}
},
"steps": {
"type": "object",
"description": "A function can have > 1 step, which is an individual \"action\" called in a DAG.",
"additionalProperties": { "$ref": "#/definitions/Step" }
},
"idempotency": {
"type": "string",
"description": "Idempotency allows the specification of an idempotency key using event data.\n\nIf specified, this overrides the throttle object."
},
"throttle": {
"type": "object",
"description": "Allows you to throttle workflows, only running them a given number of times (count) per period. THis can optionally incldue a throttle key, which is used to further constrain throttling similar to idempotency.",
"additionalProperties": false,
"properties": {
"key": { "type": "string" },
"count": { "type": "integer", "minimum": 1, "default": 1 },
"period": { "type": "string" }
},
"required": ["count", "period"]
}
},
"title": "Function"
},
"Step": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"path": {
"type": "string",
"default": "",
"description": "Represents the location on disk for the step definition. A single function may have >1 Docker-based step. This lists the directory which contains the step.",
"format": "^file://",
"minLength": 8,
"examples": ["file://./steps/step-1"]
},
"name": {
"type": "string",
"default": ""
},
"runtime": {
"$ref": "#/definitions/Runtime",
"description": "Represents how the function is executed. Each runtime specifies data necessary for executing the image, e.g. if this is an externally-hosted, serverless function via an API, this will include the URL to use in order to invoke the function."
},
"after": {
"type": "array",
"items": { "$ref": "#/definitions/After" },
"description": "Specifies that this step should run after each of the following steps. If more than one item is supplied in this array, the step will run multiple times after each preceeding step finishes."
},
"version": {
"type": "object",
"description": "An optional version constraint for the step when resolving the action to run.",
"properties": {
"major": { "type": "integer", "minimum": 1 },
"minor": { "type": "integer", "minimum": 1 }
}
},
"retries": {
"type": "object",
"description": "Configuration for retrying this particular step if it fails.",
"properties": {
"attempts": {
"type": "integer",
"minimum": 0,
"maximum": 20,
"default": 3,
"description": "The number of retry attempts before the function run is considered failed. Defaults to 3."
}
}
}
},
"required": ["id", "runtime", "after"],
"title": "Step",
"description": "A step is a single action within a function. An action is an individual unit of code which is scheduled as part of the function execution."
},
"After": {
"title": "After",
"type": "object",
"properties": {
"step": {
"oneOf": [{ "type": "string" }],
"description": "The step that must complete in order to run the next step, or \"$trigger\" if this step runs immediately upon receiving a trigger.",
"examples": ["$trigger"]
},
"if": {
"type": "string",
"description": "An expression used to conditionally run this step, allowing you to write complex logic to manage your function execution.",
"examples": [
"event.data.status == 200",
"steps['step-1'].body.email == '[email protected]'",
"async.user.id == event.user.id"
]
},
"wait": {
"type": "string",
"description": "Delay a step from running for a set amount of time, e.g. to delay a step from running you can set wait to \"10m\". This will enqueue the step to run after 10 minutes.",
"examples": ["5ms", "10s", "20m", "24h", "2d", "1w"]
},
"async": {
"description": "Specify an event that must be received within a specific amount of time (`ttl`) to continue with the specified step.",
"type": "object",
"properties": {
"ttl": {
"type": "string",
"examples": ["5ms", "10s", "20m", "24h", "2d", "1w"]
},
"event": { "type": "string", "examples": ["test/event.sent"] },
"match": { "type": "string" },
"onTimeout": {
"type": "boolean",
"description": "Specify that this edge should be traversed on timeout only, i.e. if the event is not received within the `ttl`."
}
},
"required": ["event", "ttl"]
}
},
"required": ["step"]
},
"Runtime": {
"oneOf": [
{ "$ref": "#/definitions/RuntimeDocker" },
{ "$ref": "#/definitions/RuntimeHTTP" }
],
"title": "Runtime"
},
"RuntimeDocker": {
"title": "RuntimeDocker",
"type": "object",
"additionalProperties": false,
"properties": {
"type": { "const": "docker" },
"image": { "type": "string" },
"memory": { "type": "integer", "minimum": 64, "maximum": 8096 },
"entrypoint": { "type": "array", "items": { "type": "string" } },
"dockerfile": {
"type": "string",
"description": "The path of the Dockerfile to use to build this step, relative to the step's root directory. Defaults to './Dockerfile'.",
"default": "./Dockerfile"
}
},
"required": ["type"]
},
"RuntimeHTTP": {
"title": "RuntimeHTTP",
"type": "object",
"additionalProperties": false,
"properties": {
"type": { "const": "http" },
"url": { "type": "string" }
},
"required": ["type", "url"]
},
"Trigger": {
"oneOf": [
{ "$ref": "#/definitions/EventTrigger" },
{ "$ref": "#/definitions/CronTrigger" }
],
"title": "Trigger"
},
"EventTrigger": {
"title": "EventTrigger",
"type": "object",
"additionalProperties": false,
"properties": {
"event": {
"type": "string",
"description": "Event is the name of the event that triggers the function."
},
"expression": {
"type": "string",
"description": "Expression allows you to write custom expressions for specifying conditions for the trigger. For example, you may want a function to run if an order is above a specific value (eg. `\"event.data.total >= 500\"`), or if the event is a specific version (eg. `\"event.version >= '2'\"`)."
},
"definition": {
"$ref": "#/definitions/EventDefinition"
}
},
"required": ["event"]
},
"CronTrigger": {
"title": "CronTrigger",
"type": "object",
"properties": {
"cron": {
"type": "string"
}
},
"required": ["cron"]
},
"EventDefinition": {
"type": "object",
"description": "Definition stores the type definitions for the event. Inngest is fully typed, and events may come from integrations with built-in event schemas or from your own API. In many cases you'll write functions with events which are not yet stored within Inngest. We allow you to store a type for the event directly here.",
"additionalProperties": false,
"properties": {
"format": {
"oneOf": [{ "const": "cue" }, { "const": "json-schema" }]
},
"synced": {
"type": "boolean",
"description": "Whether this is synced within Inngest. This allows us to always fetch the latest version of an event."
},
"def": {
"oneOf": [
{ "type": "string", "pattern": "^file://" },
{
"type": "object",
"additionalProperties": true
}
],
"description": "The definition may be a cue type embedded within the definition, or it may be a JSON object representing a JSON schema. If this is a string, it is assumed that this represents a filepath to load the definition from."
}
},
"dependentRequired": {
"def": ["format"]
},
"required": ["format", "def", "synced"],
"title": "EventDefinition"
}
}
}