* add docs to eslint
* update prettier ignore
* fix vitepress linting
* eslint ignore fixes
* prettier run
* update prettier ignore
* fix formatting
* enable linting of markdown files
* revert format command change
* fix irregular whitespace
* update dictionary
* (Changelog) Create four-boxes-shake.md
* Rework ESLint / Prettier setup
- Disable js/ts/vue files for Prettier to ensure linting/formatting is
only happening via ESLint
- Rework formatting of code blocks in md files
- Disable formatting of code blocks in md files under '/docs' by Prettier
- Instead use "eslint-plugin-markdown" to format & __lint__ js*/ts*/vue such code blocks
- Replace unmaintained "eslint-plugin-md" plugin by official "eslint-plugin-markdown" plugin
- I'll check whether we can use this to format other code blocks
(json, html, ...) as well
- Restructure, clean-up and apply some fixes to the ESLint config
(Note: Not ready for flat config yet since not supported by
vscode-eslint)
- Enable cache for ESLint / Prettier in scripts
- Clean-up ignore file
- Explicit folder declaration (.../)
- Don't ignore all 'extensions' folders in ESLint (only
'/api/extensions/')
- Enable formatting in '/.github' folder
* Fix all formatting issues with Prettier
* Update md files under /docs/.typedocs
* Fix lint issues in vue/js files
* ESLint / Prettier config revision v2
Enable Prettier for md code blocks, but only as warnings since it can
get into the way with Vitepress md extensions like '[!code ...]'
comments
* Remove prettier-ignore comments
* Make spellchecker happy
* Remove changeset
* Revert lint setup for code blocks
There are many cases in the docs where linting / formatting of code
blocks doesn't make
sense:
- Code block is only an excerpt - linter fails
- Code block contains special comments (e.g. markdown extensions) which
needs to remain at the same place - formatting would break it
- ...
* Apply lint issues / formatting from temp lint setup
* Run formatter
* Fix merge failure
* Simplify & modernize ESLint / Prettier setup
No longer run Prettier via ESLint. Nowadays, this is the recommended
setup. There's no real need to run it this way, it's just an additional
layer.
Add VS Code settings to make the work with the new setup easier.
* Remove unused eslint disable directives
* Make editorconfig more useful
* Fix formatting issues reported by editorconfig
* Format files with Prettier
* Enable formatting of source translations file
* Format source translations file
* Remove unnecessary console error
* Remove unnecessary line
* Only ignore md files under .changeset
* Add CI reporter for Prettier
* Fail job on wrongly formatted files
* Fix format
* Test Prettier action on changed/added file
* Use simple CI format check for now & no cache
* Revert "Test Prettier action on changed/added file"
This reverts commit 4f7d8826ad.
* Introduce code blocks check for docs
* Fix code block issues
* Ignore auto-generated packages dir
* Fix comment position
* Also lint `/app/.storybook`
* Reformat modified files
---------
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
8.1 KiB
description, readTime, pageClass
| description | readTime | pageClass |
|---|---|---|
| REST and GraphQL API documentation on the Operations collection in Directus. | 5 min read | page-reference |
Operations
Operations are the building blocks of Data Flows within Directus.
The Operation Object
id uuid
Primary key of the operation.
name string
Name for the operation.
key string
Key for the operation. Must be unique within a given flow.
type string
Type of operation. One of log, mail, notification, create, read, request, sleep, transform, trigger, condition,
or any type of custom operation extensions.
options json
Options depending on the type of the operation.
position_x integer
Position of the operation on the X axis within the flow workspace.
position_y integer
Position of the operation on the Y axis within the flow workspace.
date_created timestamp
Timestamp in ISO8601 when the operation was created.
user_created many-to-one
The user who created the operation. Many-to-one to users.
resolve uuid
The operation triggered when the current operation succeeds (or then logic of a condition operation). Primary key of an
operation.
reject uuid
The operation triggered when the current operation fails (or otherwise logic of a condition operation). Primary key of
an operation.
flow many-to-one
The flow containing this operation. Many-to-one to flows.
{
"id": "585b04cd-2821-4dcc-a563-ae5d29ecace2",
"name": "Log a Message",
"key": "log_message",
"type": "log",
"position_x": 12,
"position_y": 24,
"date_created": "2022-05-11T13:14:52Z",
"user_created": "12e62fd0-29c7-4fd3-b3d3-c7a39933e8af",
"resolve": "bf4099c0-c54c-4736-ab4e-95e2487595e4",
"reject": null,
"flow": "22544db5-93f7-48e2-a028-7ae02c8fe49a"
}
List Operations
List all operations that exist in Directus.
Query Parameters
Supports all global query parameters.
Returns
An array of up to limit operation objects. If no items are available, data will be an empty array.
REST API
GET /operations
SEARCH /operations
GraphQL
POST /graphql/system
type Query {
operations: [directus_operations]
}
Example
query {
operations {
id
name
key
}
}
Retrieve an operation
List an existing operation by primary key.
Query Parameters
Supports all global query parameters.
Returns
Returns the requested operation object.
REST API
GET /operations/:id
Example
GET /operations/3c636d1c-4eb2-49cd-8a6d-3ec571ab3390
GraphQL
POST /graphql/system
type Query {
operations_by_id(id: ID!): directus_operations
}
Example
query {
operations_by_id(id: 42) {
id
name
key
}
}
Create an Operation
Create a new operation.
Query Parameters
Supports all global query parameters.
Request Body
A partial operation object.
Returns
Returns the operation object for the created operation.
REST API
POST /operations
Example
// POST /operations
{
"name": "My Log",
"key": "my_log",
"type": "log"
}
GraphQL
POST /graphql/system
type Mutation {
create_operations_item(data: create_directus_operations_input!): directus_operations
}
Example
mutation {
create_operations_item(data: { name: "My Log", key: "my_log", type: "log" }) {
id
name
key
}
}
Create Multiple Operations
Create multiple new operations.
Query Parameters
Supports all global query parameters.
Request Body
An array of partial operation objects.
Returns
Returns the operation object for the created operation.
REST API
POST /operations
Example
// POST /operations
[
{
"name": "My Log",
"key": "my_log",
"type": "log"
},
{
"name": "Send Notification",
"key": "send_notification",
"type": "notification"
}
]
GraphQL
POST /graphql/system
type Mutation {
create_operations_items(data: [create_directus_operations_input!]!): [directus_operations]
}
Example
mutation {
create_operations_items(
data: [
{ name: "My Log", key: "my_log", type: "log" }
{ name: "Send Notification", key: "send_notification", type: "notification" }
]
) {
id
name
key
}
}
Update an Operation
Update an existing operation.
Query Parameters
Supports all global query parameters.
Request Body
A partial operation object.
Returns
Returns the operation object for the updated operation.
REST API
PATCH /operation/:id
Example
// PATCH /operation/7d62f1e9-a83f-407b-84f8-1c184f014501
{
"name": "My Updated Operation"
}
GraphQL
POST /graphql/system
type Mutation {
update_operations_item(id: ID!, data: update_directus_operations_input): directus_operations
}
Example
mutation {
update_operations_item(id: "7d62f1e9-a83f-407b-84f8-1c184f014501", data: { name: "My Updated Operation" }) {
id
name
}
}
Update Multiple Operations
Update multiple existing operations.
Query Parameters
Supports all global query parameters.
Request Body
keys Required
Array of primary keys of the operations you'd like to update.
data Required
Any of the operation object's properties.
Returns
Returns the operation objects for the updated operations.
REST API
PATCH /operations
Example
// PATCH /operations
{
"keys": ["6a25fb7c-26a4-4dcb-a474-d47b6a203a38", "07ac467e-1900-4c62-9637-8dac2ab97f71"],
"data": {
"name": "Updated Operations"
}
}
GraphQL
POST /graphql/system
type Mutation {
update_operations_items(ids: [ID!]!, data: update_directus_operations_input): [directus_operations]
}
Example
mutation {
update_operations_items(
ids: ["6a25fb7c-26a4-4dcb-a474-d47b6a203a38", "07ac467e-1900-4c62-9637-8dac2ab97f71"]
data: { name: "Updated Operations" }
) {
id
name
key
}
}
Delete an Operation
Delete an existing operation.
Returns
Empty body.
REST API
DELETE /operations/:id
Example
DELETE /operations/07ac467e-1900-4c62-9637-8dac2ab97f71
GraphQL
POST /graphql/system
type Mutation {
delete_operations_item(id: ID!): delete_one
}
Example
mutation {
delete_operations_item(id: "07ac467e-1900-4c62-9637-8dac2ab97f71") {
id
}
}
Delete Multiple Operations
Delete multiple existing operations.
Request Body
An array of operations primary keys
Returns
Empty body.
REST API
DELETE /operations
Example
// DELETE /operations
["a791ce73-41a2-4fb7-8f67-c7ba176cc719", "4e57ab0e-f4ec-47b5-9dad-e36f08a25642", "5fe0a6f6-18ad-4bb3-94c6-2e033246c784"]
GraphQL
POST /graphql/system
type Mutation {
delete_operations_items(ids: [ID!]!): delete_many
}
Example
mutation {
delete_operations_items(
ids: [
"a791ce73-41a2-4fb7-8f67-c7ba176cc719"
"4e57ab0e-f4ec-47b5-9dad-e36f08a25642"
"5fe0a6f6-18ad-4bb3-94c6-2e033246c784"
]
) {
ids
}
}
Triggering an operation
Trigger an operation based on primary key.
Request Body
Payload for the operation, if needed.
Returns
Result of the operation, if any.
REST API
POST /operations/trigger/:operation_uuid
Example
// POST /flows/trigger/202a940b-a00b-47df-b832-369c53f13122
// Payload here