Commit Graph

2230 Commits

Author SHA1 Message Date
José Varela
cc343fdf91 Improve cache performance by compressing records (#14833)
* Utils to compress/decompress data
Gzip was chosen because we want smaller data but quick algorithm since this will be ran for every request

* Compress system cache

* Decompress system cache

* Set/Get compressed cache for individual requests

* Switch from gzip to snappy, use json compression too

* Fix cache exp set/get

* Remove unused import

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-08-04 17:35:27 -04:00
ian
3dedf1cb3f Check for allowed filter operators when applying filter (#14829)
* Check for allowed filter operators when applying filter

* Add hash type to GraphQL

* Add tests

* Specify text type
2022-08-03 14:14:19 -04:00
Azri Kahar
5d96d752f4 Support custom aspect ratios in image editor (#14786)
* Support custom aspect ratios in image editor

* Add custom aspect ratios in file items as well

* Revert file item custom-aspect-ratio changes

* Use globally configured custom aspect ratios

* Remove previos custom-aspect-ratio logic

* code style tweak

* use migration instead of seed

* rename field to custom_aspect_ratios

* keep defaults + change icon

Co-authored-by: qborisb <boris@qdentity.nl>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-08-03 22:25:25 +08:00
Erick Torres
791854ab08 Move serializers option to the right place for pino-http (#14803) 2022-08-03 08:43:45 -04:00
rijkvanzanten
73d31b7c53 Fix location of head return call 2022-08-02 14:39:11 -04:00
rijkvanzanten
8085b0d788 Don't crash on invalid file storage paths 2022-08-02 13:21:44 -04:00
Brainslug
eaec9b1f63 500 error when using scoped fields query when not applicable (#14627)
* Initial hacky fix for invalid field formats

* preventing parseFields from recursively parsing fields for non applicable relations

* removed unneeded parsefields exception
2022-08-01 12:10:58 -04:00
Azri Kahar
ab8be3621a Change notifications timestamp to nullable & default to now (#14323)
* Change notifications timestamp to nullable

* check special flags that generate data

* create and use new updateType helper

* update migration identifier

* use changeToType() where applicable

* fix method name used in new migration

* bump identifier again

* Remove changeToString

* update migrations

* add conditional text/string type for compatibility

* bump migration identifier

* bump

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: ian <licitdev@gmail.com>
2022-08-01 21:05:38 +08:00
Azri Kahar
ab045cffce Fix Emit Events for item CRUD operations in Flows (#14741) 2022-07-29 10:52:28 -04:00
Rijk van Zanten
15be1c60b0 Support running prod locally through ./api/cli.js (#14728) 2022-07-28 15:17:31 -04:00
ian
732b49f482 Replace functions within arrays in GraphQL (#14705) 2022-07-27 12:32:39 -04:00
Phillip Wheatley
c8188e3ea1 Extend OpenAPI schemas for JSON-backed fields (#14581)
* Confirm issue with test case

* Generate schema for json field types when nested fields are specified

* Return untyped schema for json fields

* Fix linter warnings

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-07-25 18:03:24 -04:00
Aiden Foxx
28d60131a3 Handle not unique errors during auto-registration (#14625)
* Handle RecordNotUniqueException in oauth

* Handle RecordNotUniqueException in openid

* Added RecordNotUniqueException handling for ldap

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

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

* Add LDAP unique user log

* Added unique user log to oauth

* Added unique user log to OpenID

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

* Update api/src/auth/drivers/oauth2.ts
2022-07-25 14:09:51 -04:00
Nicola Krumschmidt
81cd748c6d Add support for operation extensions to the Extensions SDK (#14410)
* Clean up extensions build logging

* Expose defineOperation* helpers through extensions-sdk

* Add support for scaffolding operation extensions

* Refactor extension type constants

* Improve extension-related tests in shared

* Improve wording when scaffolding extension fails due to wrong type

* Make spinner text bold when scaffolding extensions

* Add support for building operation extensions

* Fix operations tile name

* Make extension config type spacing consistent

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2022-07-25 11:36:52 -04:00
rijkvanzanten
6e4738e4c0 v9.14.5 2022-07-22 14:45:15 -04:00
rijkvanzanten
aec37f6198 v9.14.4 2022-07-22 10:38:33 -04:00
Azri Kahar
7d62a70007 Fix GraphQL aggregate query (#14560)
* FIx aggregate query in GraphQL

* change type to Query and alter previous logic

* test
2022-07-22 09:55:51 -04:00
rijkvanzanten
cf41b07100 v9.14.3 2022-07-21 16:16:14 -04:00
Rijk van Zanten
e223a9d1cd Remove oracledb from package.json (#14556) 2022-07-21 15:55:51 -04:00
rijkvanzanten
6d1e5b3432 v9.14.2 2022-07-21 15:17:56 -04:00
ian
9f9ef45846 Disable foreign check on SQLite when deleting fields (#14512)
* Disable foreign check on SQLite when deleting fields

* Add default on_delete constraint

* Add test

* Rename methods

* Fix test sequence
2022-07-21 14:44:05 -04:00
ian
8d9991abe3 Process relational collection's permissions in functions (#13870)
* Process relational collection's permissions in functions

* Fix deep usage of functions in GraphQL

* Add unit test for updated SQL query with permissions

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-07-21 14:42:22 -04:00
ian
40d71f309b Fix filter column aliasing (#14423)
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-07-21 14:37:08 -04:00
Rijk van Zanten
600f55e4a2 Resolve lintw arnings (#14555) 2022-07-21 12:44:16 -04:00
Ian Pirro
23912e5232 Fix: Error applying schemas with nested collection(s) (#13949)
* Fix nested collection creation when parent exists

* tests

* desc | comments

* typo

* minor tweak

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2022-07-21 15:29:12 +08:00
Danilo Polani
8b116f6deb Add "security" commands to api CLI (#9400)
* add command to generate app key

* add command to generate secret

* group security commands under the security group

* add new security commands to cli docs

* add disclaimer on deploy secret generation

* remove duplicate hubspot embed code

* remove .env overwrite feature to security commands

* update the cli docs for security commands

* return key generation directly in output

* restore package-lock.json

* Write secret directly

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-07-20 16:44:35 -04:00
Rijk van Zanten
931a7bde46 Add missing _between/_nbetween filter operators to GQL (#14540)
Fixes #13782
2022-07-20 16:42:59 -04:00
Jay Cammarano
820457690f Optimize media loading across app (#10592)
* v-image and "lazy load" working

* fixed vars

* all the other img uses

* No longer require access token in url for files

* Add lazy loading and size limits

* Rename map-component source prop

* Fix lint warning

* Update app/src/views/public/public-view.vue

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

* Fix lint

* Fix missing file type icon

* Fix null imageInfo error

* Use video.js for media playback

* Fix .js file display

* Update package-lock.json

* Update package-lock.json

* update package.json

* Update pnpm-lock.yaml

* Remove unrelated addition on VDatePicker

* Remove folder abstraction

* Use image data based aspect ratio on preview

* Base app rate throttle on API rate limit config

* Configure app rate limit throttle based on api config

* Convert v-image to script[setup]

* Convert v-media to script[setup]

* Cleanup v-media

* Remove unneeded addTokenToUrl usages

* Remove video.js

It doesn't do authorization headers for mp4/mp3, so it's pointless

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
Co-authored-by: ian <licitdev@gmail.com>
2022-07-20 15:52:38 -04:00
José Varela
f7a8c36ee6 Do not try to convert Dates (considered an object) (#14520) 2022-07-19 17:54:14 -04:00
Clayton Gulick
ec77b0a203 Enable extensions cache (#14499)
* enable caching for extension assets with ASSETS_CACHE_TTL setting

* simplify implementation
2022-07-19 11:51:32 -04:00
Azri Kahar
f9826afd87 Fix apply snapshot for UUID primary keys (#14506)
* fix apply snapshot for char to uuid primary keys

* account for is_primary_key
2022-07-19 11:24:34 -04:00
Christopher Kapic
090671ea1e Update Knex version to fix CockroachDB relationships showing multiple times (#14509)
* update knex version

* Update all knex uses

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-07-19 10:44:14 -04:00
Rijk van Zanten
27cc3e1bec Move repo to pnpm based workflow (#14350)
* Use pnpm instead of npm

* Setup workspace

* Replace scripts / lerna root stuff

* Add todo file

* Update lock, start updating packages

* Update todo

* [WIP] Keep going on module resolution in pnpm

* Fix final missing deps/types for complete build

* [WIP] Replace npm commands with pnpm alternatives

* Update jest config for v28

* Fix missing package under schema

* Update workflow

* Run CI on fork

* Use local reference

* Remove version from local workflow

* Add build to prepare

* Add Node's max old space size flag to linter

* Idemdito for codeql

* Hyphens? Underscores?

* Bang

* Only build one thing at a time

* Underscores after all?

* Match 7gb of GH

* Set env on prepare

* Jest is driving me nuts

* Downgrade jest

* Add root jest

* We'll get there, eventually.

* 🥳

* Het houdt niet op, niet vanzelf

* attempt to fix e2e

* fix unit test & shared import

* add `debug: true` to CodeQL action

* Fix dev call in shared

* Add missing cross-env

* Add missing geo-json dependency for app

* add flag to prepare action to skip build

* remove debug flag from codeql action

* fix invalid env syntax

* add tslib to app dependencies for tests

* another attempt

* Added missing rimraf dependency for the api prebuild/cleanup scripts

* Added missing ts-node dependency for the api cli script

* update E2E tests readme to use pnpm

* Undo move of extensions sdk

* Fixes nested groups in accordions not rendering fields (#14369)

* initial fix for nested groups in accordions

* removed debug code

* Fix strict relative dates showing "incorrect" (#14390)

* Set rounding method of relative formatted date to floor when strict option is selected

* Add round fn as an option

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

* Don't use locales in generated camelCased values from env (#14401)

Ref https://github.com/directus/directus/discussions/14122

* Fix list panel descending sort (#14396)

* fix list panel descending sort

* Handle missing or explicit desc value

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

* Fix query primary field for system tables (#14402)

* New Crowdin updates (#14403)

* Update source file en-US.yaml

* New translations en-US.yaml (Spanish, Chile)

* New translations en-US.yaml (Spanish, Latin America)

* New translations en-US.yaml (Greek)

* New translations en-US.yaml (Italian)

* New translations en-US.yaml (French, Canada)

* Fix/wysiwyg context menu (#14404)

* New translations en-US.yaml (Polish) (#14407)

* Encoded the url using encodeURIComponent, so that the url gets sanitzed and so, we did not get 404 error. (#14418)

* Encoded the url using encodeURIComponent, so that the url gets sanitized and we did not get 404 error.

* Added required changes as stated by the reviewer

* Used encodeURI instead of encodeURIComponent to encode the params only

* Solved linting error

* Solved linting errors

* checked with npm run lint, no linting errors found

* fix generateJoi error due to empty permissions when creating new role (#14416)

* fix empty permissions when creating new role

* basic test

* move logic up

* additional test

* Update api/tests/utils/filter-items.test.ts

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

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

* Recreate lockfile

* Fix build of extensions-sdk

* Add missing dependency

* Add some more missing deps

* Update blackbox to use pnpm

* Update workflow to use main

* Update pack to work with pnpm

* Simplify commands

* Remove todo file (completed)

* ADd missing types dep

* Use local test version

* Remove version from local reference

* Call super with context

* Add missing dep

* Simplify workflows

Ref https://github.com/directus/organization/issues/135

* Simplify some more

* Linter is on root

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: brainslug <tim@brainslug.nl>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Gerard Lamusse <gerardlamo@gmail.com>
Co-authored-by: José Varela <joselcvarela@gmail.com>
Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Zeel Pathak <60271095+zeel-pathak@users.noreply.github.com>
2022-07-15 17:41:49 -04:00
José Varela
dc850c115e Use same types as count for countDistinct (#14460) 2022-07-15 13:13:45 -04:00
Rijk van Zanten
47e660cb76 Update knex-schema-inspector to 2.0.3 (#14437) 2022-07-14 16:22:41 -04:00
Rijk van Zanten
838770b2be Add GraphQL query POST caching (#14371)
* Add GraphQL query POST caching

Followup to #11462

* Fix condition check
2022-07-14 12:48:47 -04:00
Azri Kahar
64acd2fdb3 fix generateJoi error due to empty permissions when creating new role (#14416)
* fix empty permissions when creating new role

* basic test

* move logic up

* additional test

* Update api/tests/utils/filter-items.test.ts

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

Co-authored-by: ian <licitdev@gmail.com>
2022-07-14 09:14:59 -04:00
Zeel Pathak
4127db78ea Encoded the url using encodeURIComponent, so that the url gets sanitzed and so, we did not get 404 error. (#14418)
* Encoded the url using encodeURIComponent, so that the url gets sanitized and we did not get 404 error.

* Added required changes as stated by the reviewer

* Used encodeURI instead of encodeURIComponent to encode the params only

* Solved linting error

* Solved linting errors

* checked with npm run lint, no linting errors found
2022-07-14 12:43:53 +02:00
Rijk van Zanten
e0a7162931 Don't use locales in generated camelCased values from env (#14401)
Ref https://github.com/directus/directus/discussions/14122
2022-07-12 15:53:03 +02:00
Jay Cammarano
d57ea95e52 Generate joi merge (#13596)
* branch init tests and stuff

* types changed

* added '@' to modules mapper

* removed unneeded dotenv import

* tests passing

* forgot to save before committing

* remove app/generate-joi

* Skip validation if permissions filter is empty

* Remove another generate-joi api util

* Default allowUnknown to true

* Remove wrapping nested filter as Joi.object()

* Remove duplicate nested field from unit test

* Fix between operator for float values

* Removed unused allowUnknown option

Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-07-11 19:09:47 +02:00
brainslug
398839be6e v9.14.1 2022-07-08 11:13:22 +02:00
Aiden Foxx
c3a19c44cb Terminate Directus if OpenID discovery fails (#14287) 2022-07-07 11:19:50 +02:00
Azri Kahar
9d094efce9 Fix filename charset for uploaded files (#14286) 2022-07-05 10:37:08 -04:00
Jay Cammarano
c21ea3a41f Unit tests for migrations/run.ts (#10485)
* base neg tests

* more tests for migrations run()

* tests passing

* updated test

Co-authored-by: Jay Cammarano <jaycammarano@gmail.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-06-30 19:00:34 -04:00
Nicola Krumschmidt
49f386f729 Enable caching for App assets (#9191)
All assets transformed by Vite are fingerprinted, so they can be cached indefinitely.
The html entrypoint should never be cached to always import the latest assets.
The only downside to this is that files from the "public/" folder are also cached for at least a year.

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-06-30 16:29:41 -04:00
Brainslug
227bfa816d Check if a date string is valid ISO8601 before parsing it (#14127)
* add datetime format check

* updated error message thrown

* removed unneeded "T" from date format

* updated date validation and parsing to use the date-fns functions
2022-06-30 16:04:48 -04:00
ian
e14a6ea401 Emitter emits event in the meta (#14203)
* Emitter emits event in the meta

* Update unit test
2022-06-30 10:12:42 -04:00
Brainslug
49aab29eb7 prevent parseJSON converting strings to numbers (#14057) 2022-06-28 18:08:25 -04:00
Rijk van Zanten
f971eb4f1d Add emitEvents flag to item reads in service (#14164)
* Add emitEvents flag to ItemsService.read*

* Add emitEvents flag to item-read flow operation
2022-06-28 17:32:01 -04:00
Jay Cammarano
2607037ffe Fixes: No notification being created when sendmail fails. (#14131)
* notifications still being made when email fails

* moved try/catch into sendmail

* double checked it works this time

* Add newline for consistency

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-06-28 17:01:31 -04:00