Commit Graph

1792 Commits

Author SHA1 Message Date
Pascal Jufer
c303bdcf10 Finish switch from Jest to Vitest in API (#16263)
* build:  add vitest and update test scripts

* build: 🔧 add vitest config

* build:  Migrate tests to vitest

Remove jest references from test api test files and replace with vitest equivalents.

Tests: 13 tests are failing.

* build: 🚚 move vite.config.ts to api/src folder

* build: 🔥 remove unused vitest.config from api root

* build:  import vitest modules for tests

* build:  add type conversion for actual object

* Finish switch from Jest to Vitest in API

* Replace some leftovers

* Load "sharp" before tests

* Try with cjs

* Temporary enable verbose reporter

* Try with globalSetup

* Fix path to globalSetup

* Provide default export in globalSetup

* Final clean-up

* Remove @vitest/ui & update vitest to 0.25.0

* Add vitest c8 coverage dependency

* Update vitest to v0.25.1

* Replace unnecessary Vitest workaround

* Rework new tests

* Resolve build errors

Co-authored-by: Dorian C Brown <brown.3794@gmail.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-11-14 16:09:47 -05:00
Azri Kahar
0fc4c501c3 Allow admin to update Directus User provider and external_identifier (#16436)
* allow admin to update `provider` & `external_id`

* remove unused external_id field

* test for provider and external_identifier

* remove unused test code
2022-11-14 09:46:22 -05:00
Azri Kahar
d3388eb139 fix cast-csv read action for csv field's revisions (#16438)
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-11-14 14:44:47 +00:00
ian
4dfc00cf74 Fix limit in nested a2o queries (#16435)
* Set the limit into the correct query for a2o

* Revert -1 limit and set foreignIds size as limit
2022-11-14 09:41:36 -05:00
ian
6cf77668d1 Check original field name when aliased (#16234)
* Check original field name when aliased

* Rename to aliasMap

* Extract original field name

* Refactor for legibility

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>

* Fix linting

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-11-14 09:40:15 -05:00
ian
282d5ae54e Fix date functions for databases not in UTC timezone (#16027)
* Fix date functions for databases not in UTC timezone

* Fix passing raw date objects to DB

* Add unit test

* Use global timezone for mysql and maria

* Fix unit test timezone inconsistency as date object is in local timezone

* Date and datetime fields should be in local timezone

* Fix missing padStart in local string

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-11-14 09:38:40 -05:00
Brainslug
692b8c4807 CockroachDB can't recreate constraints with the same name (#15984)
* use a different constraint name whyen recreating constraints for cockroachdb

* implement cockroach specific logic in the appropriate helper

Co-authored-by: ian <licitdev@gmail.com>
2022-11-14 13:21:23 +01:00
ian
8e400504ea Fix __typename selection for functions in GraphQL (#16413) 2022-11-11 17:32:00 -08:00
Azri Kahar
cc55d5608e Fix "create an item" requestBody schema in OAS (#16294) 2022-11-09 19:50:01 -08:00
Azri Kahar
24f1e539ba Fix base email template footer link & logo aspect ratio (#16233)
* fix email base template footer link

* fix logo box to be square

* clean up unused classes & attributes

* only add url if user has app access

* add test for notifications service

* re-add database mock

* attempt to fix mock in test

* mock PUBLIC_URL

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-11-09 07:52:44 -08:00
Azri Kahar
f1448e2e73 fix numeric precision and scale default value (#16368) 2022-11-09 07:49:44 -08:00
keesvanbemmel
37894fd71b Returns the nodemailer promise (#16099)
* Returns the nodemailer promise

* Requested change

* Added code to add type to return value
2022-11-09 07:47:12 -08:00
ian
6e730956af Update last value when triggering nested flows with array values (#16180)
* Update last payload when triggering array values

* Reuse keyedData when triggering other flows

* Expose flows data chain variables in run script operation

* Fix unit test

* Separate context for child flows

* Remove global variables from run script operation

* Simplify by using omit
2022-11-08 17:37:12 -08:00
ian
adff255d91 Skip checking of virtual alias fields (#16320)
* Default virtual fields as alias type

* Make the condition more verbose instead of defaulting

* Remove unnecessary optional chaining

* Add tests

* Revert to alias defaulting in #d06d62

* Shift condition up
2022-11-08 15:49:49 -08:00
ian
64bffa60e9 Skip serialization for empty or string bigint values in GraphQL (#16297) 2022-11-03 18:37:56 +08:00
José Varela
0dce20c0b8 Fix check for alias fields (#16282)
They do not exist on fields definition
2022-11-03 00:10:28 +08:00
ian
ca2c761bde Skip alias type change check when type is not updated (#16270) 2022-11-02 08:54:35 -04:00
Roger Stringer
53a3194d5c Add support for SAML Part 2 (#16145)
* new saml branch

* put saml info back in

* put saml info back in

* clean up code

* validate saml config

* validate schema

* Add saml auth flow tests

* use RelayState for redirects

* Update tests for RelayState

* Fix linting

* remove validateMeta as samlify does it already

* Fix linting

* change catch on login

* Update api/src/auth/drivers/saml.ts

Co-authored-by: Aiden Foxx <aiden.foxx.mail@gmail.com>

* remove login since not needed here

* clear cookie if set on logout

* empty login method

* invalidate logout in db

* if relayState and login failed, redirect back with a reason

* Cleanup linter warnings

* Remove range from packages

* Opinions opinions opinions opinions

Just a couple personal opinion cleanup pieces

Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Aiden Foxx <aiden.foxx.mail@gmail.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-11-01 22:09:31 +00:00
rijkvanzanten
8c5cda446a Use urlencoded thru express instead 2022-11-01 16:52:06 -04:00
Aiden Foxx
05c045e9ff Handle "form_post" OAuth and OpenID responses (#16231)
* Allow both POST and GET responses in OAuth flow

* Be more explicit about which method we fetch OAuth data from

* Removed unnecessary error handling in OAuth router

* Fixed method check in OAuth router

* Simplified method check

* Added POST support to OpenID flow

* Prefer redirect on OpenID POST to retain LAX cookie policy

* Prefer redirect on OAuth2 POST to retain LAX cookie policy

* Update api/src/auth/drivers/oauth2.ts

* Update api/src/auth/drivers/openid.ts
2022-11-01 16:44:17 -04:00
Azri Kahar
5780bb174f Fix custom hook mocked path in api cli test (#15271)
* fix custom hook mocked path in api cli test

* update @types/jest

* update to latest

* update and pin dependencies

* correct pnpm lock

* remove unrelated changes
2022-11-01 12:12:31 -04:00
Azri Kahar
17c0ef9182 Remove Content-Type header check in Files POST requests (#16176)
* remove request header check in files POST

* basic test

* it's filename_download instead of file_download

* unused vars begone

* make type required when creating file via JSON

* fix blackbox test

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-11-01 12:06:09 -04:00
Aiden Foxx
2adbb3bfd2 Convert some trace logs to warnings in OAuth flows (#16213)
* Less trace, more warn in OpenID provider

* Less trace, more warn in OAuth provider
2022-10-29 15:59:50 -04:00
Brainslug
9106fc78d6 strip function from fieldnames for validation (#16179) 2022-10-27 15:17:09 +08:00
ian
c996accb00 Fix recursive fields on existing columns (#15621)
* Prevent changing to or from alias type

* Prevent infinite delete loop

* Display error when saving

* More validation for M2M and M2A

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
2022-10-26 11:51:01 -04:00
ian
e7a57827f5 Add GraphQLBigInt type (#16157) 2022-10-25 17:04:45 -04:00
Azri Kahar
10082ccbaf Fix field/collection translated name not resetting after being removed (#16131)
* reset existing field translations

* remove unused and malformed settings translations

* reset existing collection translations

* safer handling in case translations isn't an array

* inverse locales to reset logic for correctness

* add tests

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-10-25 15:08:09 -04:00
Rijk van Zanten
2d104e933b Patch Tuesday 🐸 (#16052)
* Update API non-majors

* Update major changes

* Temp fix for type warning in sdk

* Resolve missing new keyword in GraphQLNonNull use

* Lock versions in api

* Update and lock versions in shared

* Update lockfile

* Fix build type errors in api

* Update app patches/minors

* Upgrade major versions

* Lock versions

* Upgrade root deps

* Update packages

* Switch from pino-colada to pino-pretty

* Update snapshots

* Fix globby sync usage

* Remove globals from jest config

* No ranges

* Revert "Remove globals from jest config"

This reverts commit e249e2c8fe.

* Revert "Upgrade root deps"

This reverts commit 62add28a85.

* Update non-jest stuff

* We'll keep trying

* Update globby to latest minor only

* Test on all vendors

* Revert test on all vendors

* Fix linting

* Preserve request log format

* Preserve existing timestamp format and allow configuration

* Use lodash merge to allow for nested objects

Co-authored-by: ian <licitdev@gmail.com>
2022-10-20 09:31:17 -04:00
ian
193844c106 Update MAX_PAYLOAD_SIZE env stub to 1mb (#16057) 2022-10-19 13:14:01 -04:00
ian
0f6ed82953 Optimise data model sorting (#16039)
* Add collections batch update endpoint

* Use collections batch update when sorting in data model

* Add autoPurgeSystemCache option

* Change type to false for consistency

* Refactor to InvalidPayloadException

* Add collection batch update test

* Bump default max payload size to 1mb

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-10-18 19:19:36 +00:00
ian
def580dad5 Skip parsing of date strings that only contain zeros (#16015)
* Skip parsing of date strings that only contain zeros

* Allow dot in case of sub seconds and set min length as 10

* Add unit test to confirm parsing as null

* Fix timezone differences when running unit tests
2022-10-15 16:30:02 -04:00
Ling
24f76abe41 Remove property="og:url" from email base template (#16016) 2022-10-15 16:29:02 -04:00
Gerard Lamusse
e4df9b09ba Throw nicer error if field does not exist on collection (#15803)
* Throw nicer error if field does not exist on collection

* Simplify type signature and shift to be consistent with validateFilterOperator

Co-authored-by: ian <licitdev@gmail.com>
2022-10-15 17:25:30 +08:00
José Varela
da2998a7e7 Allow custom label for auth provider (#15673)
* Allow to pass custom label for auth provider

* Add tests

* Update api/src/cli/utils/create-env/env-stub.liquid

* Fix tests

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2022-10-14 23:14:00 -04:00
ian
ef895fb784 Cast special in system fields as array (#15644) 2022-10-14 23:10:28 -04:00
Azri Kahar
d0ff4e7922 Fix non-admin role creation via cli for SQLite (#15723)
* fix non-admin role creation via cli

* use the more objectively correct solution

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
2022-10-14 22:55:17 -04:00
ian
9edf9f9ce0 Process page only when merging with parent items (#16010) 2022-10-14 14:18:27 -04:00
ian
6cdd0eead4 Fix CodeQL threadflow steps (#15873)
* Upload SARIF artifact

* Test removal of empty object

* Fix polynomial-redos

* Revert fail-fast change

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-10-12 16:01:13 -04:00
Brainslug
5fcb3c84c7 Update ioredis to fix connection uri options (#15876)
* updated ioredis to 5.2.3

* type fixes

* removed obsolete @types/ioredis package
2022-10-12 15:56:22 -04:00
Rémi Peron
33d5f86937 Add support for s3 ServerSideEncryption (#15952) 2022-10-12 13:05:04 -04:00
Nitwel
d5a161fb72 add alias to always have the same name (#15960) 2022-10-12 11:47:29 -04:00
Brainslug
3c2125f646 public_url_file in .env causes server start error (#15898)
* allow *_FILE environment vars to overwrite default values

* added test

* added mock for fs

* removed test
2022-10-11 16:47:33 -04:00
Roger Stringer
3761abf1f0 adds missing graphQL operators (#15760)
* missing icontains for strings, missing eq, neq for geo, missing in, nin for dates

* fix unit test

* fix unit test part 2

* Update packages/shared/src/utils/get-filter-operators-for-type.ts

Co-authored-by: ian <licitdev@gmail.com>

* fix tests?

* fix tests?

Co-authored-by: ian <licitdev@gmail.com>
2022-09-27 10:16:37 -07:00
José Varela
fae5ed1c08 Graphql: Fix required PK on create / update (#15693)
* Do not require primary key on data on create / update

* Do not put fields non nullable if they have default value

* Handle manually entered primary keys (don't have default value)

* Allow uuid PK to be nullable

Co-authored-by: ian <licitdev@gmail.com>
2022-09-22 22:57:40 +08:00
Maxim
efdeded18a Implemented an option to filter m2a fields using graphql. (#15162)
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-09-22 13:00:52 +02:00
mtgerb
d6fce8d92a Add support for <collection>.items.query filter hook (#15611)
* fix items.query filtering for a collection

* fix linter error

Co-authored-by: Matthias Gerbershagen <m_gerbersh09@informatik.uni-kl.de>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
2022-09-20 14:40:55 +02:00
José Varela
54cd2d47da Cache: Fix check if endpoint is /graphql or not (#15599) 2022-09-16 09:12:00 -04:00
Azri Kahar
f940b6a1fc correct the documented default type for argon2 (#15594) 2022-09-15 22:15:52 +08:00
Rafly Maulana
e13c8e36b0 Allow user to send a WYSIWYG email body (#15514)
* Allow user to send a WYSIWYG email body

* Revert "Allow user to send a WYSIWYG email body"

This reverts commit b65aeb4efc.

* Use a dropdown to select between WYSIWYG and Markdown Editor

* Change input-rich-text-* to wysiwyg or markdown

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2022-09-15 13:53:19 +08:00
Nicola Krumschmidt
d68a8768fa Add a pathToRelativeUrl util function (#15578) 2022-09-14 15:01:31 -04:00