* Speed query up by reusing existing aliases which reduces table joins
* Use subquery in top level m2o to remove duplicates
* Fix linting
* Apply distinct on primary key field in subqueries
* Use distinct instead as there are only primary keys
* Apply subquery on top level
* Try remove sub sub query
* Test if working for all vendors
* Add support for _none and _some
* Use subquery only when field depth > 1
* Add tests
* Use original table names for columns with functions (#14690)
* Use original table names for columns with functions
* Extract filter function path parsing as shared util
* Fix filter function path when adding node
* Pass the originalCollectionName into filter functions
* Update unit test
* Replace functions within deep GraphQL
* Fix invalid operator error for _none and _some
* Add filter function tests
* Revert triggering for all vendors
* Simplify aliasMap
* Replace functions in filter within GraphQL aggregate query
* Add API support for filtering of alias field
* Mark schema as optional
* Shift logical operators upwards
* Separate recursive parseFilter
* Rework shifting of logical operators
* Error on invalid usage of _none and _some
* Use inner join to preserve sort order
* Run tests for all vendors
* Reuse aliasMap for sort and filter
* Sort on top level query
* Remove unnecessary limit on wrapper query
* Refactor applyQuery options
* Remove duplicates from nested multi relational sort
* Fix offset in MSSQL requiring OrderBy
* Disable schema cache
* Use inner query only for nested sort or multi relational filter
* Fix MSSQL duplicate order column
* Use inner query only for multi relational
* Additional integration tests
* Order within partition for multi relational sorts
* Rename to directus_row_number
* Fix unit test
* Add base sort and filter tests
* Fix Oracle uppercased rowNumber column
* Fix unit test
* Fix top level query sort with function
* Parse functions in inner query
* Increase clarity with knex.ref()
* Remove sort filter for top level primary key
* Fix unit test
* Bypass queries with groupBy
* Add collection to aliasMap to fix functions in nested sort
* Fix multi relational sort with functions
* Add tests for filter and sort with functions
* Fix accidental deletion of brackets
* Fix top level alias filter node interface
* Update M2M sort tests
* Add M2A tests
* Cast m2a primary key as varchar2 for oracle
* Enable filtering tests for M2A
* Fix prototype polluting assignment in aliasMap
* Remove unnecessary currentKey
* Simplify code to increase readability
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
* Fix linting and missing 'this' error
* Revert optional chaining
* Add mysql5 to tests
* Fix mysql5 missing rowNumber()
* Overcome indexing delays in MySQL5
* Verify MySQL5 sorting is in order as the result count varies between runs
* Skip joining when sorting field already exists
* Simplify variable assignment
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
* Fix linting
* Reduce duplicate logic with vars
* Transform _func fields in GraphQL only for valid functions
* Fix unit test
* Fix unsupported date_part() in CrDB
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Roger Stringer <roger@directus.io>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
* Refactor storage logic to testable setup
* Add tests to get storage config
* Add tests for register drivers
* Tests for index
* Organize imports
* Add missing getStorage
* Setup boilerplate for cloudinary drive
* Add build script
* Add cloudinary configuration
* WIP tweaks for R&D
* Start storage abstraction v2
* Make storage manager single file
* Add test coverage
* Organize imports
* Setup local driver boilerplate
* [WIP] Start on local driver 2.0
* Add more methods
* Lunchtime
* Add put method
* Add list method
* [WIP] Try using storage in api
* Use node16 module-resolution
* Lets not mess with apply-query rn
* I love CJS. Death to CJS.
* Use dynamic imports
* Make things work
* Add path normalizer
* Add azure storage driver
* Update lock
* Start on tests
* Add getBuffer test
* Add getStat tests
* Add tests for exists
* Add tests for move
* Add tests for copy
* Add tests for put
* Add tests for delete
* Add test coverage for list
* Add removeLeading option to normalizePath
* Use removeLeading option
* Start on gcs
* Add fullpath test
* Add getStream
* Add getBuffer
* Add getStat
* Add exists
* Add move
* Add copy
* Add put
* Add delete
* Finish DriverGCS
* Cleanup tests a bit
* Start s3
* Add getStream
* Add getBuffer
* Please Wryn
* Add #exists
* Use randomize data
* No more hardcoded values 🙅♀️
* Add tests for copy
* Add tests for put
* Add put/copy/delete
* Add tests for delete
* WIP list
* Remove duplicate fullPath check
* Finish AWS tests
* Listen to wryn
* Mission critical tweak
* Add randomization, cleanup tests
* Check src vs dest full path
* Start on Cloudinary
* Add parameter signature helper
* Fix ESM building of shared
* Fix ESM building of shared
* Improve tests
* Update pnpm
* Remove old build commands
* Generated d.ts files
* Fix export naming
* Move ESM only utils to new @directus/utils
* Update lockfile
* Fix type exports
* Implement getStream
* Cleanup tests
* Simplify api
* Simplify API
* Simplify api
* Simplify API
* Add read/stat
* Cleanup / add exists
* Add move
* Add write
* Move uploadChunk to separate method
* Add test for #uploadChunk
* Add tests for write
* Add copy
* Add delete
* Add list
* Add list error handling
* Remove old drive packages
* Start updating API usage of storage
* Use Readable instead of NodeJS.ReadableStream
* Use readable instead of buffer
* Restore shared to main
* Update lockfile
* Use a streaming pipeline for sharp metadata
* Add basic e2e test for local upload and delete
* Fix integer filesize in SQLite
* fixed environment mocking in unit tests
* applied the same env mocking to other tests
* Update api/src/storage/register-drivers.ts
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
* Use sha256 by default
* Add base read test for /assets
* Replace exifr with exif-reader
* Fix tests for storage/index
* Install faking lib for tests
* Add test for register-drivers
* Add tests for register-locations
* Finish tests
* Organize imports
* Resolve Azris comments
* Fix outdated tests
Certainly not the cleanest, but I need to do a bigger pass on all these tests to get them up to date with the latest team requirements. Gonna do that in a separate PR..
* Test for sha256
* Attempt 1 at fixing toString errorr
I'm not seeing this issue locally, so we'll spam a couple commits here to get things going
* Use node 18 in tests?!
* Fix localhost resolution with 127.0.0.1
* Mock getEnv()
* Use @directus/tsconfig instead of duplicated conf
* Does this fix it?
* OK fun detour
* Recreate lockfile
* Update config files
* Use multipart uploads in S3
* Cleanup imports
* File Storage 2.0: Make metadata extraction backward-compatible (#16868)
* Reinstall packages using pnpm instead of manually removing them (#16871)
* Added extra environment setting for sharp processing of invalid images (#16811)
* Added extra environment setting for sharp processing of invalid images
* renamed environment var to `ASSETS_INVALID_IMAGE_SENSITIVITY_LEVEL`
* Remove unused excludes from tsconfig
* Remove copy/paste leftover
* Update packages/utils/readme.md
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
* Update packages/utils/package.json
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Brainslug <tim@brainslug.nl>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
* add embed hook definitions
* inject embeds in the App html
* fixed typo
* removed unnecessary env parameter
* Added comment marking the custom embeds
* attempt to add test for createApp
* mock db in app test
* temporarily set log style to raw in test
* one more round
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
* add forced uppercase for UUIDs in MS SQL
* test whether mssql returned uuid is uppercase
* use once just for slight better correctness
* once is actually not enough
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: ian <licitdev@gmail.com>
* applied the same role fix too users invite
* added same fix when saving permissions
* Prevent loading users unecessarily on the permission page
* Added proper `deep` query typing
* fixed typing for tests
* apply similar fix for navigation folder
* fix: adds missing Query and x-metadata to /components/schemas
* test: adds Query and x-metadata to specifications.test.ts
* refactor: moves oas schemas to be always included to constants.ts
* refactor: renames OAS_INCLUDE_SCHEMAS to OAS_REQUIRED_SCHEMAS
Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
* Use node16 module-resolution
* Lets not mess with apply-query rn
* I love CJS. Death to CJS.
* Use CJS require in hook import
* Fix type export in schema
* Clean up defaults usage
* Use require instead of import for migrations
* Use a vitest compatible dynamic import
* Uno mas
* Cleanup type export
* force logger in sync mode when running on the CLI
* using the sync logger for all cli commands
* using cli logger for app initialization
* using pino pretty for log formatting
* installed deps
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
* Propagate mutation options for schema apply
* Fix unit test
* Add bypassCache flag and remove flushCaches calls
* remove accountability option from getSchema
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
* Remove relation for legacy permission without allowed field
* Remove deprecated formatError and improve error handling
* Add unit test
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
* Update monorepo root
* Update API dependencies
* Use unranged version
* Update app deps
* Upgrade packages dependencies
* Fix shared build
* Fix type warning in api
* Fix test runner
* Get rekt by ya boy comma-,
* Fix missing unit deprecation for sass color.mix()
Co-authored-by: ian <licitdev@gmail.com>
* Add bundle type to constants and types
* Add support for API bundle extensions
* Rename generateExtensionsEntry to generateExtensionsEntrypoint
* Add support for App bundle extensions
* Refactor App extension registration
* Replace extensions inject with useExtensions()
* Replace getInterfaces() with useExtensions()
* Replace getDisplays() with useExtensions()
* Replace getLayouts() with useExtensions()
* Replace getModules() with useExtensions()
* Replace getPanels() with useExtensions()
* Replace getOperations() with useExtensions()
* Add useExtension() composable
* Replace useExtensions() with useExtension() where applicable
* Remove interface getters
* Remove display getters
* Remove layout getters
* Remove module getter
* Remove panel getters
* Remove operation getters
* Rename extension register.ts files to index.ts
* Perform module pre register check in parallel
* Remove Refs from AppExtensionConfigs type
* Remove old extension shims
* Ensure registration of modules is awaited when hydrating
* Add support for scaffolding package extensions
* Add support for building bundle extensions
* Add JsonValue type
* Use json for complex command line flags
* Load internal extensions if custom ones are not available
* Fix extension manifest validation for pack extensions
* Fix tests in shared
* Add SplitEntrypoint type
* Move command specific utils to helpers
* Add SDK version getter
* Move extension dev deps generation to helpers
* Move template path to getter util
* Move template copying to a helper
* Only rename copied template files
* Add directus-extension add command
* Convert provided extension source path to url
* Replace deprecated import.meta.globEager
* Mock URL.createObjectURL to make App unit tests pass
* Update rollup-plugin-typescript2
* indentation
* sort vite glob imported modules
* fix unintentional wrong commit
* Simplify app extension import logic
* reinstall @rollup/plugin-virtual
* add test for getInterfaces() expected sort order
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
* Exclude unnecessary files from packages
* Add back 'copyfiles' in api to copy yaml and liquid files to dist
* Exclude declaration maps and all declaration files for drive packages
Excluding all declaration map files from published packages
Since the "drive" packages are only expected to be used internally, it's
enough to have the declaration files present when developing locally - no
need to include the types in the published packages
* Remove unnecessary entries in "files" field of app/package.json
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
* 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>
* allow admin to update `provider` & `external_id`
* remove unused external_id field
* test for provider and external_identifier
* remove unused test code
* 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>
* 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>
* 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>
* 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>
* 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
* 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