Commit Graph

1905 Commits

Author SHA1 Message Date
Brainslug
bc8457e996 Windows compatibility for running migrations (#18082)
* Prepend the file:// prefix for windows compatibility in migrations

* cla
2023-04-06 09:04:18 -04:00
Nitwel
3219bfe38f Fix status on shutdown (#18010)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Brainslug <tim@brainslug.nl>
2023-04-05 14:50:15 +00:00
Rijk van Zanten
2983e61870 The Great TypeScript Modernization Program Season 3 Episode 6: The Big One (#18014)
* Step 1

* Step 2

* False sense of confidence

* Couple more before dinner

* Update schema package

* Update format-title

* Upgrade specs file

* Close

* Replace ts-node-dev with tsx, and various others

* Replace lodash with lodash-es

* Add lodash-es types

* Update knex import

* More fun is had

* FSE

* Consolidate repos

* Various tweaks and fixes

* Fix specs

* Remove dependency on knex-schema-inspector

* Fix wrong imports of inspector

* Move shared exceptions to new package

* Move constants to separate module

* Move types to new types package

* Use directus/types

* I believe this is no longer needed

* [WIP] Start moving utils to esm

* ESMify Shared

* Move shared utils to  @directus/utils

* Use @directus/utils instead of @directus/shared/utils

* It runs!

* Use correct schemaoverview type

* Fix imports

* Fix the thing

* Start on new update-checker lib

* Use new update-check package

* Swap out directus/shared in app

* Pushing through the last bits now

* Dangerously make extensions SDK ESM

* Use @directus/types in tests

* Copy util function to test

* Fix linter config

* Add missing import

* Hot takes

* Fix build

* Curse these default exports

* No tests in constants

* Add tests

* Remove tests from types

* Add tests for exceptions

* Fix test

* Fix app tests

* Fix import in test

* Fix various tests

* Fix specs export

* Some more tests

* Remove broken integration tests

These were broken beyond repair.. They were also written before we really knew what we we're doing with tests, so I think it's better to say goodbye and start over with these

* Regenerate lockfile

* Fix imports from merge

* I create my own problems

* Make sharp play nice

* Add vitest config

* Install missing blackbox dep

* Consts shouldn't be in types

tsk tsk tsk tsk

* Fix type/const usage in extensions-sdk

* cursed.default

* Reduce circular deps

* Fix circular dep in items service

* vvv

* Trigger testing for all vendors

* Add workaround for rollup

* Prepend the file protocol for the ESM loader to be compatible with Windows
"WARN: Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'"

* Fix postgres

* Schema package updates

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>

* Resolve cjs/mjs extensions

* Clean-up eslint config

* fixed extension concatination

* using string interpolation for consistency

* Revert MySQL optimisation

* Revert testing for all vendors

* Replace tsx with esbuild-kit/esm-loader

Is a bit faster and we can rely on the built-in `watch` and `inspect`
functionalities of Node.js

Note: The possibility to watch other files (.env in our case) might be
added in the future, see https://github.com/nodejs/node/issues/45467

* Use exact version for esbuild-kit/esm-loader

* Fix import

---------

Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Brainslug <tim@brainslug.nl>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-04-04 17:41:56 -04:00
rijkvanzanten
952da7b898 Simplify util 2023-04-04 17:07:02 -04:00
Azri Kahar
f900e59dcb Add missing fields to GraphQL server info (#17922)
* add rate limiter, rate limiter global and flows

* fix project fields in server info

* add graphql for /utils/random/string

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-04-03 18:07:52 -04:00
ian
f705fedf09 Fix cache skipping when PUBLIC_URL is relative (#18029)
* Fix cache skipping when PUBLIC_URL is relative

* Add test

* Update api/src/utils/should-skip-cache.test.ts

---------

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2023-04-03 09:59:21 -04:00
Azri Kahar
b8dc4cde9c add missing .toString() password reset url (#18032) 2023-04-03 09:58:46 -04:00
Nitwel
ba69f30a01 Do not override metadata (#17972)
* Do not override metadata

* Update test

---------

Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-03-28 11:20:21 -04:00
Nitwel
529b9aaa67 Only check for undefined and null (#17976)
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-03-28 10:53:45 -04:00
Rijk van Zanten
cb74665693 noUnusedParameters: true (#17935) 2023-03-24 16:56:18 -04:00
Rijk van Zanten
2bc039607b TS Config Modernization Program Part 4 of almost done (#17934)
* noUncheckedIndexedAccess: true !!!!!!!?!!!!!!!!!!?

* Fix duplicate non-null assertion
2023-03-24 16:43:54 -04:00
Azri Kahar
e0cf496797 Fix auth expires value larger than 32-bit integer for GraphQL (#17908)
* verify blackbox test catches this error

* use GraphQLBigInt for auth expires field

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-03-24 10:18:59 -04:00
Brainslug
73bbfaf058 Fix cookie redaction in logs (#17914)
* removed incorrect redaction logic

* updated paths that werent working

* Added new redaction function

* Reverting unintentional change

* don't force lowercase provider names

* extracted cookieNames

* set cookie based on driver settings suggested by ian

* add unit test

* redact the entire cookie header

* updated the tests

* move redact text to constants

---------

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-03-24 14:04:22 +00:00
Rijk van Zanten
80f4807a09 TS Config Modernization Program Part 3 of many (#17904)
* noImplicitOverride: true

* noImplicitReturns: true

* noPropertyAccessFromIndexSignature: true
2023-03-23 16:47:55 -04:00
Brainslug
8b0c5f1250 Fixed boolean logic mistake in the _nempty operator (#17903) 2023-03-23 16:24:13 -04:00
John Hillegass
3495363039 Merge pull request from GHSA-8vg2-wf3q-mwv7
* fix(api): redact header cookie

This is a quick PoC for a fix. I am not sure if it's the best answer and have not added tests yet. If we feel good about it, I can add tests and open a PR. Please let me know how you'd like to proceed!

* cleaner

* rework to handle multiple inputs and add unit tests

* Added same redacting logic for teh response set-cookie

---------

Co-authored-by: Brainslug <tim@brainslug.nl>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
2023-03-23 18:54:02 +01:00
ian
cce33436d1 Rework schema caching to use memory (#17763)
Co-authored-by: Nitwel <mail@nitwel.de>
Co-authored-by: Jan Arends <jaads@users.noreply.github.com>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-03-23 12:52:06 +01:00
rijkvanzanten
fa44632c71 Update snapshot 2023-03-22 17:48:17 -04:00
rijkvanzanten
fbb4da2e77 Fix test 2023-03-22 17:27:39 -04:00
rijkvanzanten
5247b68afa Updates 6 of 6 2023-03-22 17:23:30 -04:00
rijkvanzanten
fe74c43bc0 Updates 5 of many 2023-03-22 17:02:18 -04:00
rijkvanzanten
f0e0508dd2 Updates 4 of many
This was my favorite so far
2023-03-22 16:55:46 -04:00
rijkvanzanten
71060a51f7 Updates 3 of many 2023-03-22 16:29:36 -04:00
rijkvanzanten
0a137551a8 Updates 2 of many 2023-03-22 16:23:25 -04:00
rijkvanzanten
05034d0e17 Updates 1 of many 2023-03-22 16:13:54 -04:00
Rijk van Zanten
1a5f06c791 TSConfig Modernization: Set importsNotUsedAsValues (#17887)
* Set importsNotUsedAsValues

* Fix import
2023-03-22 14:51:27 -04:00
ian
7b256e769c Fix built-in modules for flows exec operation (#17866)
* Fix built-in modules in flows exec

* Tiny ocd patch
2023-03-21 16:46:03 +01:00
Nitwel
022d77d5d9 Fix keep folder on reupload (#17744)
* Fix deleting data on reupload

* only update folder when necessary

* run linter

* fix replacing filename_download and title

* run linter

* fix if statement

* clean up code

* Remove unused import of 'File'

* cleanup code

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-03-21 16:17:19 +01:00
rijkvanzanten
c938e4be34 Remove comment 2023-03-20 16:53:11 -04:00
Nitwel
a9a5e2a26d Fix options being null (#17847) 2023-03-20 13:54:27 +01:00
Pascal Jufer
0293c88aa3 Patch Tuesday 🐸 (#17811)
* Update root deps

* Update `directus` deps

* Update `@directus/app` deps

* Update usage of knex-mock-client

* Update `@directus/shared` deps

* Update `extensions-sdk` deps

* Update `@directus/specs` deps

* Update `@directus/storage` deps

* Update `@directus/storage-driver-azure` deps

* Update `@directus/storage-driver-cloudinary` deps

* Update `@directus/storage-driver-gcs` deps

* Update `@directus/storage-driver-local` deps

* Update `@directus/storage-driver-s3` deps

* Update `@directus/utils` deps

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2023-03-17 15:15:03 +08:00
Azri Kahar
251927a765 Require value in project settings' fields (#17771)
* support required fields in system-modules

* update settings fields to required
2023-03-16 11:47:01 +01:00
ian
3ff37b0f32 Sanitize query in updateByQuery and deleteByQuery (#17649)
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
2023-03-15 15:25:12 +01:00
Connor
34acd97a01 Fix Flow Error Handling (#17519)
* Validate Operation Result is Serializable

* Enumerate Flow Error Object so it gets logged

* Add ability for error to be a JSON string and parse it

* Make the request operation throw useful error

* Revert DockerCompose in "Validate Operation Result is Serializable"

This partially reverts commit c7e76716a5.

* Fix Typescript Errors

* Move isValidJSON to Shared Util and add Tests

* return the error message excluding stack trace

* allow for non-exception errors

* Apply suggestions from code review

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>

* Clean-up after wrong suggestion

* Clean-up processing of error data

* Use content-type json if body is object

* Reformat error data check

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Brainslug <tim@brainslug.nl>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-03-15 08:29:55 +00:00
Nitwel
6943f70a39 Only load defined fields in m2a (#17710)
Co-authored-by: ian <licitdev@gmail.com>
2023-03-14 17:17:31 +01:00
Nitwel
bbb387fe86 Write full item to revisions (#17729)
* Write full item to revisions

* Get revision data/delta in single call

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-03-09 14:50:04 -06:00
Brainslug
77cffa6849 Require value for dropdown choices (#17732)
* updated value to be required

* applied to other interfaces

* Made dropdown labels required too

* added required fields for other interfaces

* added required fields for field/collection translations
2023-03-10 00:14:39 +08:00
Rijk van Zanten
0154878f27 Improve assets performance (#17734)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: ian <licitdev@gmail.com>
2023-03-08 18:28:36 +01:00
Pascal Jufer
7b89a11ebe Include schema components in OAS (#17712)
* Add missing schema components to required list

* Update expected schema & switch to inline snapshot

---------

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
2023-03-06 15:33:53 +01:00
Azri Kahar
d466204732 Add ability to limit requests from using the Cache-Control header to skip cache (#17642)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-03-02 13:19:30 +01:00
Brainslug
ee7fca3e31 Global rate limiter (#17296)
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2023-03-02 13:04:22 +01:00
Azri Kahar
512ca48680 Allow null for related_collection in applyJoiSchema (#17665)
* allow null for related_collection

* Add M2A to schema tests

* Trigger testing for all vendors

* Standardize naming convention

* Update deleted collections assertion

* Fix typo

* Revert testing for all vendors

---------

Co-authored-by: ian <licitdev@gmail.com>
2023-03-02 08:23:13 +01:00
Azri Kahar
1f6a8e57ad Additionally check for varchar when casting UUID in apply diff (#17615)
* check for varchar when casting UUID in apply diff

* add test

---------

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
2023-02-28 11:33:25 +01:00
ian
fb41eee1ed Catch IPTC and XMP extraction errors (#17633)
* Catch IPTC and XMP extraction errors

* Add autoPurgeCache option to uploadOne

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>

---------

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2023-02-27 11:05:00 +00:00
Thierry Kühni
9856019c3a Catch ICC parse errors to avoid server crash (#17622)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-02-27 08:21:20 +01:00
Pascal Jufer
1cceeaf637 Update request unit test (#17624) 2023-02-25 21:32:43 -05:00
rijkvanzanten
6dce1a2f8a Update request
Squashed commit of the following:

commit 5afeab357b73494d690c33952efd41b29367fab5
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Fri Feb 24 15:39:15 2023 -0500

    Add dns pre-resolve

commit 68e0e8c8099b5463297185f220e80b2b6d5b980a
Author: rijkvanzanten <rijkvanzanten@me.com>
Date:   Fri Feb 24 12:28:18 2023 -0500

    Start on request interceptor
2023-02-24 15:40:25 -05:00
Rijk van Zanten
ee59646b8c Use example.com instead of directus.io (#17600) 2023-02-22 15:19:55 -05:00
Rijk van Zanten
6cb92ea06a Add support for ASSET_TRANSFORM_TIMEOUT env var (#17596)
* Add support for ASSET_TRANSFORM_TIMEOUT env var

* Use string based config

* Timeout on overall promise
2023-02-22 14:39:02 -05:00
Norbert Fodor
3e80260a49 Remove hardcoded package extension path (#17525)
* Remove hardcoded package extension path

* Rename PACKAGE_EXTENSIONS_PATH env variable to PACKAGE_FILE_LOCATION

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
2023-02-21 17:22:18 +01:00