Commit Graph

1079 Commits

Author SHA1 Message Date
Pascal Jufer
a2a35aaab5 Add support for _FILE environment variables (#6101)
* Add support for _FILE environment variables

* Enhance processing of _FILE env vars

* Same processing as with other env vars (do not simply treat as string)
- tested successfully
* Warn if both variables are set (EXAMPLE and EXAMPLE_FILE)
* Add comments to make it easier to understand the code

* Set newKey only after file read was successful

* Don't convert value > MAX_SAFE_INTEGER to number

Thanks to @skizer!

As stated by @skizer (from #6119):
  Altho it seems that we do have a numerical value
  it can happen that its outside of Number.MAX_SAFE_INTEGER
  thus resulting in a change of the original intended value
  e.g oauth -> discord -> client_id

* Fix recursive logger-env import

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-06-09 14:08:26 -04:00
Rijk van Zanten
61f2e48ced Allow any of grant's (nested) configuration parameters (oAuth) (#6155)
* Allow underscore configuration extraction

* Allow any of grants config properties
2021-06-09 12:08:48 -04:00
skizer
ad8bd3e7cd Don't treat numbers larger than the JS max number size as number values in environment variables (#6119)
* Incorrect parsing of numeric values in env.

* Fixes incorrect parsing of the env. file with numeric values that are outside of Number.MAX_SAFE_INTEGER resulting in unwanted behaviour.
- Like wrong client_ids for oauth. (tested with discord oauth)
* Removed unnecessary multiple "IF" statements since value can only be ether one of the listed values.

* Implements custom_param for OAUTH via grant

According to grants documentation you can provide additionally custom parameters to supported OAUTH provider with ```custom_params```.
This change allows to add them in JSON format and thus adding multiple parameters.

* Fix linter warnings, remove JSON support in favor of nested Grant support

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-06-09 11:53:57 -04:00
Rijk van Zanten
bc8370d084 Add item duplicate fields configuration option to directus_collections (#6140)
* Add item_duplication_fields field

* Add types for item duplicate fields
2021-06-08 17:57:28 -04:00
Rijk van Zanten
1e4850f53a Add support for CRON hooks (interval) (#6116)
* Install node-cron

* Support CRON hooks

* Document interval hook

* Fix package-lokc
2021-06-07 16:57:32 -04:00
rijkvanzanten
91253a241d Fix linter warning 2021-06-04 12:44:10 -04:00
Rijk van Zanten
68add053b7 Fixed issue that would prevent the corresponding o2m field from being created on m2o relational setup (#6060)
Fixes #6009
2021-06-03 23:56:22 -04:00
Rijk van Zanten
9c49c4eb46 Fixed unique constraint violation error extraction for MySQL 5.7 (#6059)
* Add MySQL 5.7 docker debug instance

* Fix unique error constraint extraction in MySQL 5.7

Fixes #5719
2021-06-03 23:33:31 -04:00
Rijk van Zanten
85d33d9ffc Fixed an issue that would cause "text" fields to show up as varchar with length -1 in MS SQL (#6055)
Fixes #5944
2021-06-03 22:35:07 -04:00
Rijk van Zanten
babe6cdc08 Fixed issue that would prevent usage of limit -1 on deep limit (#6054)
Fixes #5960
2021-06-03 21:47:58 -04:00
Rijk van Zanten
5067410e09 Fixed issue that could trigger update actions of children on manual sorting of a parent o2m instance (#6048)
Fixes #6041
2021-06-03 21:02:47 -04:00
Rijk van Zanten
e1926ba5f7 Fix query during transaction in fk creation (#6045)
Fixes #6034
2021-06-03 17:48:13 -04:00
Rijk van Zanten
2270d870f9 Prevent foreign key constraint names from exceeding 64 characters (#6043)
* Add index name generator function

* Ensure foreign keys are 64 chars or less
2021-06-03 17:31:58 -04:00
Rijk van Zanten
0964b42ba4 Drop FK based on constraint name instead of column (#6042)
Fixes #6029
2021-06-03 16:32:39 -04:00
Rijk van Zanten
1cdbc91593 Handle illegal/corrupt relational rows better (#6040)
Fixes #6013
2021-06-03 15:26:02 -04:00
Oreille
22f2e4662f Add support for adding a collection accent color (#5818)
* Added icon_color to directus_collections
Added migrations
Added color property to select-icon
Fixed select-icon placeholder

* Use icon color in collection header bar.

* Set `collection` and `note` fields to hald witdh

* Rename icon_color->color

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-06-03 13:04:19 -04:00
Rijk van Zanten
e6364d99a4 Extract IPTC title and keywords (#6035)
* Fix title IPTC extraction

* Pull IPTC keywords as tags
2021-06-03 12:37:50 -04:00
dependabot[bot]
f03b4e64de Bump @types/node from 15.6.0 to 15.9.0 (#6018)
* Bump @types/node from 15.6.0 to 15.9.0

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 15.6.0 to 15.9.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix type issues

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-06-03 11:07:03 -04:00
Rijk van Zanten
45730c6860 Resolve linter warnings (#6008) 2021-06-02 13:21:13 -04:00
nichols-green
e1e47453ef Changed PORT type from number to string (#6001) 2021-06-02 11:47:12 -04:00
Rijk van Zanten
77e00b7db4 Don't initialize database on file require (#6003) 2021-06-02 11:41:42 -04:00
Rijk van Zanten
02fc696c53 Fix env var validation in database loading step (#6002)
Fixes #5980
2021-06-02 11:17:50 -04:00
rijkvanzanten
c4b4e3586f Cleanup FK indexes in MySQL uses 2021-06-01 18:49:52 -04:00
rijkvanzanten
65240fff3b Make DB migrations for FK constraints safer 2021-06-01 16:44:10 -04:00
Rijk van Zanten
02089a6227 Tweak default cache ttl 2021-05-26 10:52:16 -04:00
rijkvanzanten
c3589d138f Remove remaining leftovers from deprecated single query param 2021-05-25 11:38:33 -04:00
rijkvanzanten
95307cee97 Fix o2m updates not saving revisions nested 2021-05-24 21:05:50 -04:00
rijkvanzanten
1bbc8535a5 Move nodemailer setup to src root 2021-05-24 13:36:12 -04:00
Rijk van Zanten
ce59ce0d2f Support top-level filter through relational m2a items (#5855)
Fixes #5850
2021-05-24 12:20:15 -04:00
rijkvanzanten
246c55266b Don't use NonNull for update input types
Fixes #5723
2021-05-21 21:32:42 -04:00
rijkvanzanten
e2c9e15a98 Throw 503 instead of 500 on file upload failure 2021-05-21 21:17:19 -04:00
Rijk van Zanten
ba2e56e43c Fix collection delete for collections w/ m2o to them (#5809)
* Fix new-collection relational field creation

* Fix collection delete for collections w/ m2o to them

Fixes #5793
2021-05-21 13:57:42 -04:00
Rijk van Zanten
bc8399c362 Fix validation short circuit on _or (#5806)
* Fix _or validation step when in nested context

Fixes #5405

* Add changeset
2021-05-21 12:30:13 -04:00
Oreille
bb14309b9c Add support for mssql uniqueidentifier type (#5804) 2021-05-21 10:08:02 -04:00
Rijk van Zanten
8d3102fbad Add max concurrency and max image transform size support (#5795)
* Add assets concurrency and max size controls

* Render no-thumbnail images nicer in app

* Document new asset environment variables

* Update package-lock
2021-05-20 18:18:10 -04:00
Rijk van Zanten
9335372400 Foreign Key Constraints (#5615)
* Bump knex-schema-inspector

* Fix cli role name attr

* Update relation type

* Restructure relations

* Restructure relations table

* Update api type for relation record

* Fetch relations in new structure

* Update schema-inspector

* Use new relations schema structure in api

* Update relations GETters

* Add default value to one deselect

* Add create relationship on existing field

* Add updating existing relationship

* Add delete relations

* Add relations query resolver

* Add graphql mutations for relations

* Fix reading from wrong name

* Fix wrong method name

* No idea why this flip flops every install

* Update relation type

* Accept null in use-collection composable

* Use new relations structure in translations

* Use new relations structure in new-collection

* Start updating field detail store

* Renames for new relations structure

* Silently ignore passed collection/field in relation update

* Fix setting pk field in m2o relational setup

* Small tweaks in o2m setup

* Fix m2m setup

* Tweak m2o setup

* Fix m2a setup

* Allow null for related collection (m2a)

* Fix languages code name

* Fix migration default value

* Fix relational cleanup in collections/fields

* Fix transaction problem in field delete

* Fix inserting relational o2m items

* Don't execute updateByQuery on empty item set

Fixes #5710, fixes #5070

* Show referential action input on m2o

* Finish language for m2o

* Show triggers config on o2m

* Delete items on one_deselect_item delete

* Fix naming, show relational trigger config on m2m

* Tweak language, add setup to m2a

* Fix linter warnings

* Add trigger setup for translations

* fix Edit non-schema relationship issue

* Sync existing on_delete triggers in o2m setup

* Add migration to setup foreign key constraints

* Update illegal FK values before setting constraint

* Fix MySQL unsigned vs not-unsigned in FK creation

* Use pretty names for labels in relational triggers

* Prefix auto-junction when system table

Fixes #5493

* Add system foreign key triggers

Fixes #5749

* Update docs
2021-05-19 12:29:16 -04:00
MiniDigger | Martin
1cc9900317 fix occasional typeerror in payload service (#5763) 2021-05-19 14:51:06 +00:00
rijkvanzanten
f06ac03755 Don't execute updateByQuery on empty item set
Fixes #5710, fixes #5070
2021-05-17 15:49:39 -04:00
Matteo Gazzoni
c84c002c7b Makes primary key always not nullable (#5731) 2021-05-17 19:11:39 +00:00
rijkvanzanten
b84d3be981 Use items service directly instead of super
Fixes callstack order problem, fixes #5538 pt 2
2021-05-17 11:50:48 -04:00
rijkvanzanten
e8ac74bb4c Fix issue on login when no hooks are registered
Fixes #5688
2021-05-14 18:52:20 -04:00
rijkvanzanten
7b6bff1692 Use correct interface for collection module nav setup 2021-05-14 16:26:45 -04:00
rijkvanzanten
1ea544b261 Fix mfa-setup interface name 2021-05-14 16:10:19 -04:00
José Varela
4d242ab5bf api: pass user object to auth hooks (#5251)
* api: pass user object to auth hooks
The motivation for this is the ability to migrate from
bcrypt passwords to argon2 seamlessly.

Fixes #4718
Fixes #4335

* receive user from `auth.login.before` hook

* pass `otp` as well on `auth.login` hooks

* api: last registered hook should have priority
When registering multiple hooks for a single event,
the last hook should have priority on return value.

* Fix linter warning

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-05-14 12:33:51 -04:00
Aiden Foxx
e8e295ef6a Fix string to text migrations for Oracle (#5462)
* Disabled string to text migrations for Oracle

* Added oracle specific alter table migrations

* Added notNull parameter to Oracle alter function

* Wrapped notNull in if

* Removed public oracle column alter function
2021-05-14 12:30:17 -04:00
Pierre
28ef6418fc [TS] Improve EmailOptions def (#5563)
* [TS] Improve EmailOptions def

See https://nodemailer.com/message/

* Update index.ts

* Update index.ts

* [Mailer] pass nodemailer options

* fix missing comma

* [TS] Use SendMailOptions of nodemailer

* Use const instead of let

* fix lint

* Rename nodeMailerOptions -> emailOptions

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-05-14 12:25:19 -04:00
Christian Rendl
7133df2d56 Fixed issues with template overriding (#5671)
* Fixed issues with template overriding

* Remove `system` flag from email templates

* Remove usage of system in user services

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-05-14 12:20:42 -04:00
mcarlson
c0446cb379 Add support for mailgun transport (#5613)
* Add support for mailgun transport

* eslint fix

* Add nodemailer-mailgun-transport as optional dependency

* Add docs, rename APIKEY -> API_KEY

Co-authored-by: Max Carlson <>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-05-14 12:20:18 -04:00
Robert Gieseke
61761135ee Sort custom and internal migrations by version prefix (#5685)
See discussion #5675
2021-05-14 15:34:53 +00:00
Rijk van Zanten
9ac9a8d44b Add JSON/CSV Import (#5660)
* Add async/destroy packages

* Target node 12+

* Return payload data in json export

* Import JSON from Stream

* Add CSV import support

* Add CSV Import

* Add docs

* Add missing types
2021-05-14 11:03:12 -04:00