9 Commits

Author SHA1 Message Date
Nitwel
3c2efc1fb6 Improve build times using tsdown’s oxc-transform (#26604)
* start supporting isolatedDeclarations

* add errors and storage package

* add utils, and storage-driver-local

* fix rest of packages

* fix types/collab import

* hardcode "isolatedDeclarations": true in all configs for now

* Revert "hardcode "isolatedDeclarations": true in all configs for now"

This reverts commit ac71582159.

* fix formatting

* undo readme change

* remove link

* fix lockfile

* dont do a js string cast here I guess

* use tsc over tsdown because of failing tests

* last fixes

* use tsdown --clean instead of rimraf

* fmt and fixes

* re add weird space

* add run as entry

* undo api using tsdown

* switch back to tsdown again now with unbundle 🥳

* more ts fixes

* build with tsdown in @directus/themes

* fix bb tests

* undo spaces

* another space

* fix collab import

* add changeset

* Apply suggestion from @ComfortablyCoding

* Apply suggestion from @ComfortablyCoding

* Update .changeset/hungry-yaks-enter.md

Co-authored-by: judda <44623501+ComfortablyCoding@users.noreply.github.com>

---------

Co-authored-by: judda <44623501+ComfortablyCoding@users.noreply.github.com>
2026-03-11 14:56:12 -04:00
Gaetan SENN
cb89e81b2c Improve error reporting for data imports (#25862)
* feat: improve CSV import error handling with limits and structured responses

- Add configurable error limits (MAX_IMPORT_ERRORS: 1000, MAX_DISPLAY_ERRORS: 50)
- Stop processing when error limit reached to prevent memory issues and front end payload
- Group similar errors by field/reason/code with row ranges for better UX
- Return structured error format with ImportValidationError type
- Support custom validation messages from directus_fields.validation_message
- Add frontend translation support for $t: keys in validation messages
- Optimize stream handling to stop CSV parsing when limit reached
- Remove redundant type validations and legacy error handling code
- Add comprehensive i18n translations for import errors for en-US
- Improve error grouping to reduce API payload size

Breaking changes:
- API error response format changed to include structured rows with ranges
- Error limit will stop import processing to prevent performance issues

* feat: add changeset

* refactor: handle linter

* feat: clean up code and optimize font end

* feat: optimize errors and fix linter

* feat: handle some feedback

* Apply suggestion from @formfcw

Co-authored-by: Florian C. Wachmann <dev@formfcw.com>

* refactor: handle feedbacks

* fix: restore removed translation

* build: fix formating

* fix: clean up code

* refactor: remove types package change

* feat: add MAX_IMPORT_ERRORS to env

* fix: remove unusde files

* refactor: create type for multi use

* refactor: optimize range function

* fix: fix formating

* fix: move components to private section

* feat: handle feedback

* fix: fix formating

* fix: remove unused param

* fix: add missing changeset

* feat: handle feedback

* refactor: clean up code

* fix: use i18n inside composable

* refactoring: handle json type

* refactor: handle case with no field/type

* Clarify import error limit comment in env-stub.liquid

* fix: fix format

* refactor: clean up code

* fix: handle feedback

* fix: fix feedbacks

* fix: fix error key generation from extensions (substring/valid/invalid)

* fix: fix lint

* fix: fix lint

* fix: remove mock log

* fix: resolve html/css

* fix: fix concurency and backpressure

* fix: fix feedbacks

* fix: use backpressure to json import

* fix: remove export typing

* fix: handle some feedback

* fix: remove toRef type

* Update app/src/composables/use-validation-error-details.ts

Co-authored-by: Florian C. Wachmann <dev@formfcw.com>

* fix: revert backpressure

* fix: handle feedback

* fix: resolve feedbacks

* fix: optimize error conversion

* fix: fix some issues and handle forbiden case

* feat: display forbiden details

* refactor: revert modal case for forbiden

* feat: display generic error in a modal

* fix: clean up linter

* fix: fix tests and optimize code

* fix: fix linter

* fix: clean up tmp file for empty csv file

* fix: fix lint

* feat: remove notif

* fix: clean up unused te function

* fix: clean up unused te function

* test: test import service

* fix: fix lint

* fix: fix lint

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Florian C. Wachmann <dev@formfcw.com>
Co-authored-by: daedalus <44623501+ComfortablyCoding@users.noreply.github.com>
2025-10-28 15:46:37 -04:00
Nitwel
111d27321b Add path information to validation errors (#24751)
* add path information to validation errors

* fmt

* fix tests

* fmt

* fix more tests

* fix throwing all errors

* more targeted try catch

* fmt

* use class params instead of catching errors

* fmt

* fix order and forking

---------

Co-authored-by: daedalus <44623501+ComfortablyCoding@users.noreply.github.com>
2025-03-12 13:30:36 -04:00
Pascal Jufer
81c9156508 Update Vitest to v1 (#20694) 2023-12-10 19:49:45 +01:00
Pascal Jufer
ba7fac402e Update Prettier v3.1.0 (#20481) 2023-11-20 16:23:22 +01:00
Rijk van Zanten
8a62031362 Add email validation on user create/update (#19794)
* Add email validation message error

* Validate emails on user create/update

* Add translation for app display
2023-09-25 09:54:56 -04:00
Rijk van Zanten
41d2008203 Fix missing value error not being converted (#19185)
Fixes #19183
2023-07-17 14:43:54 -04:00
Brainslug
0fac13ab53 Fix errors thrown for starts_with and ends_with variations (#19021)
* catch starts_with errors

* accept all filter types in validations

* basic joi regex error matching

* Create nasty-turtles-impress.md

* updated unit tests

* Add todo

* Fix format

* Remove unnecessary type addition

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

* Catch inverted patterns too

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

* Ooops

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2023-07-06 21:16:19 +08:00
Rijk van Zanten
ca3e7f521f Upgrade previous "Extensions" system to new "Errors" model (#18797)
* Typecheck across packages that are built with esbuild

* Boilerplate new Errors package

* No need, tsup checks with --dts

* Switch to tsup

* Setup dev script

* Add readme

* More boilerplaty things

* Finish createError function

* Install @directus/random

* Downgrade node types

* Add utility function to check if an error is a DirectusError

* Use new is-error check

* Install errors package

* Add failed validation common error

* Export common errors

* Move joi convertion to utils

* Export failed validation

* Use new failed validation error in validate-batch

* Enhance typing output of createError

* Remove outdir (handled by tsup now)

* Replace Exception with Error

* Replace exception in test

* Remove exceptions from app

* Remove exceptions from app

* Remove failed validation exception from users service

* Remove old failed validation exception from shared

* Remove exceptions package in favor of errors

* Uninstall exceptions

* Replace baseexception check

* Migrate content too large error

* Critical detail

* Replace ForbiddenException

* WIP remove exceptions

* Add ForbiddenError to errors

* HitRateLimitError

* Move validation related error/helper to new validation package

* Add index

* Add docs

* Install random

* Convert TokenExpired

* Convert user-suspended

* Convert invalid-credentials

* Move UnsupportedMediaType

* Replace wrong imports for forbidden

* Convert invalid-ip

* Move invalid provider

* Move InvalidOtp

* Convert InvalidToken

* Move MethodNotAllowed

* Convert range not satisfiable

* Move unexpect response

* Move UnprocessableContent

* Move IllegalAssetTransformation

* Move RouteNotFound

* Finalize not found

* Various db errors

* Move value too long

* Move not null

* Move record-not-unique

* Move value out of range

* Finish db errors

* Service unavailable

* GQL errors

* Update packages/validation/src/errors/failed-validation.ts

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

* Update packages/validation/src/errors/failed-validation.ts

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

* InvalidQuery

* Add test for invalid query message constructor

* Invalid Payload

* Finalize exceptions move

* Improve type of isDirectusError

* Various fixes

* Fix build in api

* Update websocket exceptions use

* Allow optional reason for invalid config

* Update errors usage in utils

* Remove unused package from errors

* Update lockfile

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

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

* Update packages/validation/src/utils/joi-to-error-extensions.ts

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

* Put error codes in shared enum

* Replace instanceof checks in api

* Fix tests I think

* Tweak override names

* Fix linter warnings

* Set snapshots

* Start fixing BB tests

* Fix blackbox tests

* Add changeset

* Update changeset

* Update extension docs to use new createError abstraction

* 🙄

* Fix graphql validation error name

* 🥳

* use ErrorCode.Forbidden

* fix blackbox auth login test

* Add license files

* Rename preMutationException to preMutationError

* Remove unused ms dep & sort package.json

* Remove periods from error messages for consistency

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

* Add optional code check

* Use updated error code checker

* Rename InvalidConfigError to InvalidProviderConfigError

---------

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: ian <licitdev@gmail.com>
2023-06-27 17:22:26 -04:00