Skip to content

Commit fbefe07

Browse files
Merge branch 'main' of https://github.com/directus/directus into main
2 parents be19268 + cad0e7b commit fbefe07

357 files changed

Lines changed: 13392 additions & 3727 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
* @rijkvanzanten
2+
/docs/*.md @benhaynes
3+
4+
/packages/cli @WoLfulus
5+
/packages/sdk @WoLfulus
6+
/packages/gatsby-source-directus @WoLfulus

.github/workflows/e2e-tests.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
db: ['mssql', 'mysql', 'postgres', 'maria', 'sqlite3']
16-
node-version: [ '12-alpine', '14-alpine', '15-alpine' ]
16+
node-version: ['12-alpine', '14-alpine', '15-alpine']
1717
env:
1818
CACHED_IMAGE: ghcr.io/directus/directus-e2e-test-cache:${{ matrix.node-version }}
1919
steps:
20+
- name: Cancel Previous Runs
21+
uses: styfle/cancel-workflow-action@0.9.0
22+
with:
23+
access_token: ${{ secrets.GITHUB_TOKEN }}
2024
- name: Login to GitHub Container Registry
2125
uses: docker/login-action@v1
2226
with:

.github/workflows/lint.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16+
- name: Cancel Previous Runs
17+
uses: styfle/cancel-workflow-action@0.9.0
18+
with:
19+
access_token: ${{ secrets.GITHUB_TOKEN }}
20+
1621
- uses: actions/checkout@v2
1722

1823
- uses: actions/setup-node@v2

api/example.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,7 @@ EMAIL_SENDMAIL_PATH="/usr/sbin/sendmail"
145145
# EMAIL_SMTP_SECURE=false # Use TLS
146146
# EMAIL_SMTP_USER="username"
147147
# EMAIL_SMTP_PASSWORD="password"
148+
149+
## Email (Mailgun Transport)
150+
# EMAIL_MAILGUN_API_KEY="key-1234123412341234"
151+
# EMAIL_MAILGUN_DOMAIN="a domain name from https://app.mailgun.com/app/sending/domains"

api/package.json

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "directus",
3-
"version": "9.0.0-rc.62",
3+
"version": "9.0.0-rc.66",
44
"license": "GPL-3.0-only",
55
"homepage": "https://github.com/directus/directus#readme",
66
"description": "Directus is a real-time API and App dashboard for managing SQL database content.",
@@ -65,28 +65,31 @@
6565
"example.env"
6666
],
6767
"dependencies": {
68-
"@directus/app": "9.0.0-rc.62",
69-
"@directus/drive": "9.0.0-rc.62",
70-
"@directus/drive-azure": "9.0.0-rc.62",
71-
"@directus/drive-gcs": "9.0.0-rc.62",
72-
"@directus/drive-s3": "9.0.0-rc.62",
73-
"@directus/format-title": "9.0.0-rc.62",
74-
"@directus/schema": "9.0.0-rc.62",
75-
"@directus/specs": "9.0.0-rc.62",
76-
"@godaddy/terminus": "^4.4.1",
68+
"@directus/app": "9.0.0-rc.66",
69+
"@directus/drive": "9.0.0-rc.66",
70+
"@directus/drive-azure": "9.0.0-rc.66",
71+
"@directus/drive-gcs": "9.0.0-rc.66",
72+
"@directus/drive-s3": "9.0.0-rc.66",
73+
"@directus/format-title": "9.0.0-rc.66",
74+
"@directus/schema": "9.0.0-rc.66",
75+
"@directus/specs": "9.0.0-rc.66",
76+
"@godaddy/terminus": "^4.7.2",
7777
"argon2": "^0.27.0",
78+
"async": "^3.2.0",
7879
"atob": "^2.1.2",
7980
"axios": "^0.21.0",
8081
"body-parser": "^1.19.0",
8182
"busboy": "^0.3.1",
8283
"camelcase": "^6.2.0",
8384
"chalk": "^4.1.1",
84-
"commander": "^6.2.0",
85+
"commander": "^7.2.0",
8586
"cookie-parser": "^1.4.5",
8687
"cors": "^2.8.5",
88+
"csv-parser": "^3.0.0",
8789
"date-fns": "^2.21.1",
8890
"deep-map": "^2.0.0",
89-
"dotenv": "^8.2.0",
91+
"destroy": "^1.0.4",
92+
"dotenv": "^9.0.2",
9093
"eventemitter2": "^6.4.3",
9194
"execa": "^4.1.0",
9295
"exif-reader": "^1.0.3",
@@ -96,11 +99,12 @@
9699
"fs-extra": "^9.1.0",
97100
"grant": "^5.4.5",
98101
"graphql": "^15.5.0",
99-
"graphql-compose": "^7.25.1",
102+
"graphql-compose": "^8.1.0",
100103
"icc": "^2.0.0",
101-
"inquirer": "^7.3.3",
104+
"inquirer": "^8.0.0",
102105
"joi": "^17.3.0",
103106
"js-yaml": "^4.1.0",
107+
"js2xmlparser": "^4.0.1",
104108
"json2csv": "^5.0.3",
105109
"jsonwebtoken": "^8.5.1",
106110
"keyv": "^4.0.3",
@@ -113,16 +117,17 @@
113117
"ms": "^2.1.2",
114118
"nanoid": "^3.1.16",
115119
"node-machine-id": "^1.1.12",
116-
"nodemailer": "^6.4.14",
120+
"nodemailer": "^6.6.0",
117121
"openapi3-ts": "^2.0.0",
118-
"ora": "^5.1.0",
122+
"ora": "^5.4.0",
119123
"otplib": "^12.0.1",
120124
"pino": "^6.7.0",
121125
"pino-colada": "^2.1.0",
122126
"qs": "^6.9.4",
123-
"rate-limiter-flexible": "^2.1.13",
127+
"rate-limiter-flexible": "^2.2.2",
124128
"resolve-cwd": "^3.0.0",
125129
"sharp": "^0.27.1",
130+
"stream-json": "^1.7.1",
126131
"uuid": "^8.3.2",
127132
"uuid-validate": "0.0.3"
128133
},
@@ -135,39 +140,43 @@
135140
"keyv-memcache": "^1.0.1",
136141
"memcached": "^2.2.2",
137142
"mysql": "^2.18.1",
143+
"nodemailer-mailgun-transport": "^2.1.3",
138144
"oracledb": "^5.0.0",
139-
"pg": "^8.4.2",
145+
"pg": "^8.6.0",
140146
"sqlite3": "^5.0.2",
141-
"tedious": "^11.0.5"
147+
"tedious": "^11.0.8"
142148
},
143-
"gitHead": "71bf628955b5da15ce3070dc09478bc558f243a4",
149+
"gitHead": "24621f3934dc77eb23441331040ed13c676ceffd",
144150
"devDependencies": {
151+
"@types/async": "^3.2.6",
145152
"@types/atob": "^2.1.2",
146153
"@types/body-parser": "^1.19.0",
147154
"@types/busboy": "^0.2.3",
148155
"@types/cookie-parser": "^1.4.2",
149156
"@types/cors": "^2.8.10",
157+
"@types/destroy": "^1.0.0",
150158
"@types/express": "^4.17.11",
151159
"@types/express-pino-logger": "^4.0.2",
152160
"@types/express-session": "^1.17.3",
153161
"@types/fs-extra": "^9.0.11",
154162
"@types/inquirer": "^7.3.1",
155163
"@types/js-yaml": "^4.0.1",
156-
"@types/json2csv": "^5.0.1",
164+
"@types/json2csv": "^5.0.2",
157165
"@types/jsonwebtoken": "^8.5.1",
158166
"@types/keyv": "^3.1.1",
159167
"@types/lodash": "^4.14.168",
160168
"@types/mime-types": "^2.1.0",
161169
"@types/ms": "^0.7.31",
162-
"@types/node": "^15.0.1",
170+
"@types/node": "^15.0.2",
163171
"@types/nodemailer": "^6.4.1",
164172
"@types/qs": "^6.9.6",
165173
"@types/sharp": "^0.28.0",
174+
"@types/stream-json": "^1.7.0",
166175
"@types/uuid": "^8.3.0",
167176
"@types/uuid-validate": "^0.0.1",
168177
"copyfiles": "^2.4.0",
169178
"cross-env": "^7.0.2",
170179
"ts-node-dev": "^1.0.0",
171180
"typescript": "^4.0.5"
172181
}
173-
}
182+
}

api/src/cli/commands/roles/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getSchema } from '../../../utils/get-schema';
22

3-
export default async function rolesCreate({ name, admin }: { name: string; admin: boolean }): Promise<void> {
3+
export default async function rolesCreate({ role: name, admin }: { role: string; admin: boolean }): Promise<void> {
44
const { default: database } = require('../../../database/index');
55
const { RolesService } = require('../../../services/roles');
66

api/src/cli/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ dbCommand
3535
.action(() => dbMigrate('down'));
3636

3737
const usersCommand = program.command('users');
38+
3839
usersCommand
3940
.command('create')
4041
.description('Create a new user')
4142
.option('--email <value>', `user's email`)
4243
.option('--password <value>', `user's password`)
4344
.option('--role <value>', `user's role`)
4445
.action(usersCreate);
46+
4547
usersCommand
4648
.command('passwd')
4749
.description('Set user password')
@@ -52,10 +54,8 @@ usersCommand
5254
const rolesCommand = program.command('roles');
5355
rolesCommand
5456
.command('create')
55-
.storeOptionsAsProperties(false)
56-
.passCommandToAction(false)
5757
.description('Create a new role')
58-
.option('--name <value>', `name for the role`)
58+
.option('--role <value>', `name for the role`)
5959
.option('--admin', `whether or not the role has admin access`)
6060
.action(rolesCreate);
6161

api/src/controllers/auth.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ router.post(
146146

147147
if (req.cookies.directus_refresh_token) {
148148
res.clearCookie('directus_refresh_token', {
149+
httpOnly: true,
149150
domain: env.REFRESH_TOKEN_COOKIE_DOMAIN,
151+
secure: env.REFRESH_TOKEN_COOKIE_SECURE ?? false,
152+
sameSite: (env.REFRESH_TOKEN_COOKIE_SAME_SITE as 'lax' | 'strict' | 'none') || 'strict',
150153
});
151154
}
152155

api/src/controllers/not-found.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import { RouteNotFoundException } from '../exceptions';
1515
*/
1616
const notFound: RequestHandler = async (req, res, next) => {
1717
try {
18-
const ret = await emitter.emitAsync('request.not_found', req, res);
19-
if (ret.reduce((prev, current) => current || prev, false)) {
18+
const hooksResult = await emitter.emitAsync('request.not_found', req, res);
19+
if (hooksResult.reduce((prev, current) => current || prev, false)) {
2020
return next();
2121
}
2222
next(new RouteNotFoundException(req.path));

api/src/controllers/utils.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import { nanoid } from 'nanoid';
55
import { InvalidPayloadException, InvalidQueryException } from '../exceptions';
66
import collectionExists from '../middleware/collection-exists';
77
import { respond } from '../middleware/respond';
8-
import { RevisionsService, UtilsService } from '../services';
8+
import { RevisionsService, UtilsService, ImportService } from '../services';
99
import asyncHandler from '../utils/async-handler';
10+
import Busboy from 'busboy';
1011

1112
const router = Router();
1213

@@ -87,4 +88,31 @@ router.post(
8788
respond
8889
);
8990

91+
router.post(
92+
'/import/:collection',
93+
collectionExists,
94+
asyncHandler(async (req, res, next) => {
95+
const service = new ImportService({
96+
accountability: req.accountability,
97+
schema: req.schema,
98+
});
99+
100+
const busboy = new Busboy({ headers: req.headers });
101+
102+
busboy.on('file', async (fieldname, fileStream, filename, encoding, mimetype) => {
103+
try {
104+
await service.import(req.params.collection, mimetype, fileStream);
105+
} catch (err) {
106+
return next(err);
107+
}
108+
109+
return res.status(200).end();
110+
});
111+
112+
busboy.on('error', (err: Error) => next(err));
113+
114+
req.pipe(busboy);
115+
})
116+
);
117+
90118
export default router;

0 commit comments

Comments
 (0)