Merge branch 'main' into aggregation

This commit is contained in:
rijkvanzanten
2021-06-18 09:45:35 -04:00
4 changed files with 28 additions and 25 deletions

View File

@@ -165,7 +165,7 @@
"@types/inquirer": "7.3.1",
"@types/js-yaml": "4.0.1",
"@types/json2csv": "5.0.2",
"@types/jsonwebtoken": "8.5.1",
"@types/jsonwebtoken": "8.5.2",
"@types/keyv": "3.1.1",
"@types/lodash": "4.14.170",
"@types/mime-types": "2.1.0",

View File

@@ -74,7 +74,7 @@
"mime": "2.5.2",
"mitt": "2.1.0",
"nanoid": "3.1.23",
"pinia": "2.0.0-beta.2",
"pinia": "2.0.0-beta.3",
"prettier": "2.3.1",
"pretty-ms": "7.0.1",
"qrcode": "1.4.4",

View File

@@ -111,6 +111,8 @@ provide a cron statement in the event scope as follows: `cron(<statement>)`, for
on day-of-month 1) or `cron(5 4 * * sun)` (at 04:05 on Sunday). See example below:
```js
const axios = require('axios');
module.exports = function registerHook() {
return {
'cron(*/15 * * * *)': async function () {
@@ -125,6 +127,8 @@ module.exports = function registerHook() {
Each custom hook is registered to its event scope using a function with the following format:
```js
const axios = require('axios');
module.exports = function registerHook() {
return {
'items.create': function () {
@@ -188,10 +192,12 @@ To deploy your hook, simply restart the API by running:
npx directus start
```
## Full Example:
## Full Example
`extensions/hooks/sync-with-external/index.js`:
```js
// extensions/hooks/sync-with-external/index.js
const axios = require('axios');
module.exports = function registerHook({ services, exceptions }) {
const { MailService } = services;

39
package-lock.json generated
View File

@@ -143,7 +143,7 @@
"@types/inquirer": "7.3.1",
"@types/js-yaml": "4.0.1",
"@types/json2csv": "5.0.2",
"@types/jsonwebtoken": "8.5.1",
"@types/jsonwebtoken": "8.5.2",
"@types/keyv": "3.1.1",
"@types/lodash": "4.14.170",
"@types/mime-types": "2.1.0",
@@ -495,11 +495,8 @@
"mime": "2.5.2",
"mitt": "2.1.0",
"nanoid": "3.1.23",
"pinia": "2.0.0-beta.2",
"prettier": "2.3.1",
"pretty-ms": "7.0.1",
"pinia": "2.0.0-beta.3",
"qrcode": "1.4.4",
"rimraf": "3.0.2",
"sass": "1.35.1",
"tinymce": "5.8.1",
"typescript": "4.3.4",
@@ -7956,9 +7953,9 @@
"peer": true
},
"node_modules/@types/jsonwebtoken": {
"version": "8.5.1",
"resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz",
"integrity": "sha512-rNAPdomlIUX0i0cg2+I+Q1wOUr531zHBQ+cV/28PJ39bSPKjahatZZ2LMuhiguETkCgLVzfruw/ZvNMNkKoSzw==",
"version": "8.5.2",
"resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.2.tgz",
"integrity": "sha512-X8BOCkp+WJVNYCYIBugREtVZa4Y09Or9HDx6xqRZem5F8jJV8FuJgNessXyMuv9+U8pjnvdezASwU28uw+1scw==",
"dev": true,
"dependencies": {
"@types/node": "*"
@@ -36843,12 +36840,12 @@
}
},
"node_modules/pinia": {
"version": "2.0.0-beta.2",
"resolved": "https://registry.npmjs.org/pinia/-/pinia-2.0.0-beta.2.tgz",
"integrity": "sha512-fzjzS5gaZyWNFfQBL60Bn967Jwy3nbYuVCjzpqCCbI/wzrIN/NqLRy9ACRaZvAf+T/VEv5+A0J87UkWalSJY0w==",
"version": "2.0.0-beta.3",
"resolved": "https://registry.npmjs.org/pinia/-/pinia-2.0.0-beta.3.tgz",
"integrity": "sha512-4ygKhe9FrYD69tJ7nSdgHm9Ldb0aM/Nzyb8Qz/RZuzOyOr85jWHNmCAhCytWy0l9C4/ypGJYCEJ3vuZfyWjcZA==",
"dev": true,
"dependencies": {
"@vue/devtools-api": "^6.0.0-beta.12"
"@vue/devtools-api": "^6.0.0-beta.14"
}
},
"node_modules/pinkie": {
@@ -57263,7 +57260,7 @@
"mime": "2.5.2",
"mitt": "2.1.0",
"nanoid": "3.1.23",
"pinia": "2.0.0-beta.2",
"pinia": "2.0.0-beta.3",
"prettier": "2.3.1",
"pretty-ms": "7.0.1",
"qrcode": "1.4.4",
@@ -65306,9 +65303,9 @@
"peer": true
},
"@types/jsonwebtoken": {
"version": "8.5.1",
"resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz",
"integrity": "sha512-rNAPdomlIUX0i0cg2+I+Q1wOUr531zHBQ+cV/28PJ39bSPKjahatZZ2LMuhiguETkCgLVzfruw/ZvNMNkKoSzw==",
"version": "8.5.2",
"resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.5.2.tgz",
"integrity": "sha512-X8BOCkp+WJVNYCYIBugREtVZa4Y09Or9HDx6xqRZem5F8jJV8FuJgNessXyMuv9+U8pjnvdezASwU28uw+1scw==",
"dev": true,
"requires": {
"@types/node": "*"
@@ -72847,7 +72844,7 @@
"@types/inquirer": "7.3.1",
"@types/js-yaml": "4.0.1",
"@types/json2csv": "5.0.2",
"@types/jsonwebtoken": "8.5.1",
"@types/jsonwebtoken": "8.5.2",
"@types/keyv": "3.1.1",
"@types/lodash": "4.14.170",
"@types/mime-types": "2.1.0",
@@ -88571,12 +88568,12 @@
"dev": true
},
"pinia": {
"version": "2.0.0-beta.2",
"resolved": "https://registry.npmjs.org/pinia/-/pinia-2.0.0-beta.2.tgz",
"integrity": "sha512-fzjzS5gaZyWNFfQBL60Bn967Jwy3nbYuVCjzpqCCbI/wzrIN/NqLRy9ACRaZvAf+T/VEv5+A0J87UkWalSJY0w==",
"version": "2.0.0-beta.3",
"resolved": "https://registry.npmjs.org/pinia/-/pinia-2.0.0-beta.3.tgz",
"integrity": "sha512-4ygKhe9FrYD69tJ7nSdgHm9Ldb0aM/Nzyb8Qz/RZuzOyOr85jWHNmCAhCytWy0l9C4/ypGJYCEJ3vuZfyWjcZA==",
"dev": true,
"requires": {
"@vue/devtools-api": "^6.0.0-beta.12"
"@vue/devtools-api": "^6.0.0-beta.14"
}
},
"pinkie": {