2022 Commits

Author SHA1 Message Date
Brainslug
243eed781b Merge pull request from GHSA-hmgw-9jrg-hf2m
* Add extra error handling for invalid messages

* added description and logging

* renamed fix function

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-09-19 13:12:42 -04:00
José Varela
9819049f0c Assets: Handle transformation timeout errors (#19684)
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-09-15 13:32:50 +00:00
Pascal Jufer
9854a2174f Import config.js file as ESM (#19654)
Co-authored-by: Brainslug <tim@brainslug.nl>
2023-09-13 13:19:34 +00:00
Pascal Jufer
0c56c46fdf Attempt to make "require shares fields" migration safer/more reliable (#19619)
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2023-09-12 21:10:58 +02:00
Jan Arends
5c8d3d22c6 Reset auto increment sequence (#19328)
Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-09-08 11:19:14 +02:00
Azeem Haider
f770fefc96 Ignore extra envs for mysql (#19589)
* fix #7420 ignore extra envs for mysql

* Update contributors.yml

* Run formatter

* Add changeset

---------

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2023-09-05 07:33:32 -07:00
Azri Kahar
1857340bcd Add email body for completed exports to file library (#19550)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-08-31 15:08:48 +02:00
Pascal Jufer
425cdd64cc Fix decompression in file import endpoint (#19524)
* Fix decompression in file import endpoint

* Add changeset

* Clean-up decompressResponse function

* Align fn name
2023-08-29 22:57:27 +08:00
Daniel Biegler
284156426f Replace vm2 with isolated-vm (#19332)
* add isolated-vm@4.6.0

* add mvp replacing vm2 with isolated-vm, two env vars

* make copying async and add tests

* add env vars to docs

* remove isolate-logging function

* update docs for FLOWS_EXEC_ALLOWED_MODULES removal

* further removal of allowed module usage

* rename env vars and their usage, remove script "compiling" and replace Reference with ExternalCopy

* remove logging and catching, let the outer executeOperation function do it

* remove vm2 from dependencies

* remove unused var

* run prettier formatting

* run eslint

* create changeset

* rename env var without unit suffix, add minimum to doc

* add two tests for config testing

* fix 'mb' spelling

* update changeset

* Mark it as major change for `@directus/api`

* Breaking change copy

* add logging from the operation

* run linting

* Update docs/releases/breaking-changes.md

* Update docs/releases/breaking-changes.md

* run linting, make operation cursive

* Mention HTTP requests in breaking changes

* make linter happy

* changed cursive to bold (asked kevin)

* add to the test for timeouts

* run linter

* Update api/src/operations/exec/index.ts

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

* Update api/src/operations/exec/index.ts

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

* Update note on run script modules

* Update breaking changes

* Update docs/app/flows/operations.md

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

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Kevin Lewis <kvn@lws.io>
Co-authored-by: ian <licitdev@gmail.com>
2023-08-25 14:11:17 +00:00
ian
7aedf763c0 Redact env values in logs for Flows (#19513)
* Redact env values in revisions for Flows

* Add unit tests

* Create cold-maps-teach.md

* Redact string type envs only

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>

* Fix linting

* Update test for non-string env

* Ignore zero length strings

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>

* Add replacementFn to include key of redacted value

* Update cold-maps-teach.md

* Remove case insensitivity

* Update changeset

* Rework

* Add utils to changeset

* Add unit test

* Rename to getRedactedString and add REDACTED_TEXT

* Consistent naming

---------

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-08-25 10:14:35 +02:00
Pascal Jufer
940545dbfe Fix condition for collection & item data in notification operation (#19521)
* Fix condition for collection & item data in notification operation

* Add changeset
2023-08-24 21:22:34 -04:00
Gerard Lamusse
7de52e6720 Fix deep sanitizeQuery (#19436)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-08-24 17:18:18 +02:00
PlanB
e6230ebd84 Docs: Update CACHE_NAMESPACE default value (#19496) 2023-08-23 10:00:02 +02:00
ian
88d4f7cfb1 Add JSON Web Token (JWT) operation (#19434)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-08-16 10:34:18 +00:00
Nitwel
e7ba4b4058 Add missing endpoints to openapi spec (#19390)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-08-16 12:00:57 +02:00
Nitwel
ebb018a5e8 Fix using wrong type for default values (#19439)
* Fix using wrong type for default values

* fix for readAll

* Format file

* Add changeset

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-08-15 12:16:43 -04:00
Pascal Jufer
d6d6cf4b38 Fix "require shares fields" migration for strict MySQL (#19407)
* Fix "require shares fields" migration for strict MySQL

* Add changeset
2023-08-11 09:23:33 -04:00
Pascal Jufer
479c5b55b7 Fix URL seralizing of trailing slashes after adding paths (#19252)
* Fix URL seralizing of trailing slashes after adding paths

* Create rare-shrimps-rescue.md

* Clean-up

* More precise changeset summary
2023-07-26 10:28:21 -04:00
Matthew Rollinson
f9635ac287 Supabase - Storage driver (#19135)
* Initial commit to add supabase as a storage driver

* Working supabase implementation

* Slight cleanup

* Started working on tests for storage-driver-supabase

* Updates

* Initial commit to add supabase as a storage driver

* Working supabase implementation

* Slight cleanup

* Started working on tests for storage-driver-supabase

* Updates

* Nicer working tests

* More working tests

* Readable stream

* Working version with all passing tests and types

* Update contributors.yml

* added documentation

* Ran prettier to fix formatting issues

* Ran linter and added Supabase to dictionary

* Fix tsconfig reference

* Organize imports

* Start at v0

* Add changeset

* Lock versions

* storage-driver-supabse: Added fullpath for move and copy arguments

* storage-driver-supabase: Removed resumable uploads

* Update lockfile

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-07-25 11:01:24 -04:00
José Varela
3a54f0db56 API: Do count distinct since left join duplicates results (#19208)
* Do count distinct since `left join` duplicates results

* Add changeset

* Correctly access count property

* Update .changeset/angry-suits-compete.md

* Optimize for simple filters

* Add tests

* Workaround broken 'as' for countDistinct in SQLite3

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: ian <licitdev@gmail.com>
2023-07-24 13:32:28 +02:00
Pascal Jufer
08f6953822 Require 'collection' & 'item' fields for shares (#19220) 2023-07-24 13:31:43 +02:00
Gerard Lamusse
ad1207a2f9 Remove res.status calculation as it is set later (#19214)
* Remove res.status calculation as it is set later

* Ensure 500 is thrown on multiple errors of different types

* Add changeset

---------

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2023-07-21 09:56:22 -04:00
Amer @ ValueHeads
174c9fab9c [Bug Fix] utils/url.js removing trailing slashes (#19210)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-07-20 12:26:04 +02:00
Brainslug
4cc55b86ba Using the same data fetching logic for rest and graphql (#19155)
* Using the same data fetching logic for rest and graphql

* Create fresh-snails-knock.md

* checked and tested data fetching code

* always fetch a single result for gql subscriptions

* removed unused import

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-07-20 08:12:17 +02:00
Brainslug
56c03e843b Updated websocket registered events (#19189)
* added unused events

* Create plenty-paws-turn.md

* ran prettier
2023-07-18 12:05:05 -04:00
Rijk van Zanten
f1ac443298 Use projectColor for links in emails (#19171)
Fixes #18927
2023-07-14 22:14:29 +02:00
Rijk van Zanten
ea146c3e11 Include PK as secondary sort in batch exports (#19143)
Fixes #19133
2023-07-12 11:46:25 +02:00
Rijk van Zanten
39fc2915c1 Use warn log levels for unexpected oid/oa2 errors (#19121)
Closes #19003
2023-07-11 10:45:34 +02:00
Connor
77b95e08dd Add Auto Cache Purging to Sorting Utility (#19115)
* add cache purging to sort utility

* update should clear to fail faster

* use shouldClearCache

* clean logic

* Create nervous-onions-relate.md

* fix formatting

* Update api/src/services/utils.ts

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

* Update changeset/

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-07-11 10:32:57 +02:00
Connor
eefde53a86 Add Options to Flow Notification Operation (#19033)
* add collection and item options to notification opperation

* Create stale-tips-relax.md

* fix formatting

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-07-09 17:38:03 +02:00
Connor
92621429ee Linting and Formatting Upgrade (#18892)
* add docs to eslint

* update prettier ignore

* fix vitepress linting

* eslint ignore fixes

* prettier run

* update prettier ignore

* fix formatting

* enable linting of markdown files

* revert format command change

* fix irregular whitespace

* update dictionary

* (Changelog) Create four-boxes-shake.md

* Rework ESLint / Prettier setup

- Disable js/ts/vue files for Prettier to ensure linting/formatting is
  only happening via ESLint
- Rework formatting of code blocks in md files
  - Disable formatting of code blocks in md files under '/docs' by Prettier
  - Instead use "eslint-plugin-markdown" to format & __lint__ js*/ts*/vue such code blocks
  - Replace unmaintained "eslint-plugin-md" plugin by official "eslint-plugin-markdown" plugin
  - I'll check whether we can use this to format other code blocks
    (json, html, ...) as well
- Restructure, clean-up and apply some fixes to the ESLint config
  (Note: Not ready for flat config yet since not supported by
  vscode-eslint)
- Enable cache for ESLint / Prettier in scripts
- Clean-up ignore file
  - Explicit folder declaration (.../)
  - Don't ignore all 'extensions' folders in ESLint (only
    '/api/extensions/')
  - Enable formatting in '/.github' folder

* Fix all formatting issues with Prettier

* Update md files under /docs/.typedocs

* Fix lint issues in vue/js files

* ESLint / Prettier config revision v2

Enable Prettier for md code blocks, but only as warnings since it can
get into the way with Vitepress md extensions like '[!code ...]'
comments

* Remove prettier-ignore comments

* Make spellchecker happy

* Remove changeset

* Revert lint setup for code blocks

There are many cases in the docs where linting / formatting of code
blocks doesn't make
sense:
- Code block is only an excerpt - linter fails
- Code block contains special comments (e.g. markdown extensions) which
  needs to remain at the same place - formatting would break it
- ...

* Apply lint issues / formatting from temp lint setup

* Run formatter

* Fix merge failure

* Simplify & modernize ESLint / Prettier setup

No longer run Prettier via ESLint. Nowadays, this is the recommended
setup. There's no real need to run it this way, it's just an additional
layer.

Add VS Code settings to make the work with the new setup easier.

* Remove unused eslint disable directives

* Make editorconfig more useful

* Fix formatting issues reported by editorconfig

* Format files with Prettier

* Enable formatting of source translations file

* Format source translations file

* Remove unnecessary console error

* Remove unnecessary line

* Only ignore md files under .changeset

* Add CI reporter for Prettier

* Fail job on wrongly formatted files

* Fix format

* Test Prettier action on changed/added file

* Use simple CI format check for now & no cache

* Revert "Test Prettier action on changed/added file"

This reverts commit 4f7d8826ad.

* Introduce code blocks check for docs

* Fix code block issues

* Ignore auto-generated packages dir

* Fix comment position

* Also lint `/app/.storybook`

* Reformat modified files

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-06-29 11:54:01 +02:00
Azri Kahar
c80fa6d6b9 Assign sort number when creating field(s) (#18877)
Co-authored-by: Jan Arends <jan.arends@mailbox.org>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-06-28 13:47:15 +00: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
Rijk van Zanten
63069bd688 Consolidate Redis environment variables (#19010)
* Remove individual redis configurations

* Use shared redis config

* Update stub

* Add changeset

* Update .changeset/grumpy-rice-film.md

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

* Remove RATE_LIMITER_REDIS_ ref in docs

* Update REDIS config in docker compose example

* Readd missing param

* Fix mention of namespace ind ocs

* Undo moving of cache store env

* Update blackbox tests & docs

* Update api/src/env.ts

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

* Fix casing of wEbSoCkEtS

* Remove redis namespace from env check

* Add global store back in

* Tweak phrasing

* Readd supplementary note 5

* Bring back CACHE_STORE in docs / tests

* Forgot one CACHE_STORE

* Consistent order

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: ian <licitdev@gmail.com>
2023-06-27 13:34:49 -04:00
GitStart
16ed93c9b9 Expose case-insensitive variants of _starts_with and _ends_with (#18941)
Co-authored-by: RubensRafael <rubensrafael2@live.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-06-27 17:48:29 +02:00
ian
757a5914af Flush cache when applying diff (#18986)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-06-27 15:13:54 +02:00
Rijk van Zanten
513a739b33 Drop support for Memcached (#18980) 2023-06-23 08:54:43 -04:00
Rijk van Zanten
3b52f2d59d Fix custom migrations running not validating against documented file path requirement (#18971)
* Require - to exist in custom migration filepath

* Update docs to mention shared helpers

* Add changeset
2023-06-22 19:00:01 -04:00
Rijk van Zanten
654e09ed5c Improve range type signature (#18970)
* Improve range type signature

Fixes #18793

* Add changeset

* Fix gcs test
2023-06-22 18:41:02 -04:00
Pascal Jufer
baceedf201 Allow plain query flags for boolean & geo filter operators (#18888)
* Allow plain query flags for boolean & geo filter operators

* Create blue-wolves-tell.md

---------

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
2023-06-20 11:20:56 -04:00
Brainslug
562bcdfcb5 Expose WebSocketService for extensions (#18943) 2023-06-20 10:25:51 +02:00
Brainslug
9d27e95686 Fix websocket with $CURRENT_USER permissions (#18901) 2023-06-14 14:24:44 +00:00
Rijk van Zanten
7f961d51ec Fix creating new relation when applying snapshot diff (#18879)
* Fix creating new relation when applying snapshot diff (#18692)

* Update apply-diff.ts

Collection and field might not be part of the dif but are mandatory

* Update contributors.yml

* Update apply-diff.ts

* prettier

* Add changeset

---------

Co-authored-by: gkielwasser <gkielwasser@gmail.com>
2023-06-13 10:51:58 -04:00
Agustin
57747f0c7e Fix reversing of _null, _nnull, _empty and _nempty (#18801)
* Fix reversing of _null, _nnull, _empty and _nempty

When the value given is false, at the moment both `IS NULL` and `IS NOT NULL` are added to the query which means there are never results.

* Update contributors.yml

* Add test for applyFilter with boolean operators

* Revert unnecessary line break

* Create chilled-wolves-double.md

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2023-06-13 10:18:50 -04:00
Pascal Jufer
c0f595ed3b Fix Websocket GraphQL public auth (#18851) 2023-06-09 13:12:54 +02:00
Brainslug
cfddabd9ee Integrating Websockets in Directus 🕸️🧦 (#14737)
* added emitter context

* partial items tests

* updated items handler tests

* fixed test after merge

* forgot the event context

* fixed auth message parsing for graphql subscriptions

* fixed type strictness

* fixed graphql subscription bug

* bumped websocket dependencies

* touched up some dangling code

* updated itemsservice usage

* disabled overkill logs

* double checked environment type processing

* fixed missed capitalization

* fixed subscription payloads

* Added explicit string type casting

* removed obsolete "trimUpper" utility

* using the parseJSON utility consistently

* pinned dependencies

* parse environment variables

* fixed pnpm-lock

* GraphQL Subscriptions for all events

* fixed typo

* added event data to the graphql definition

* fix payload for delete events

* Added optional chaining for type to prevent fatal crashes on invalid messages

* fix failing on getting type from undefined

* Update api/src/websocket/exceptions.ts

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

* Add proper ZodError handling

* added the zod-validation-error parser

* allow disabling the rate limiter

* Update api/src/websocket/controllers/base.ts

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

* updated starting logs

* fixed email/password expiration logic

* added tests for getMessageType

* simplified message parsing and dropped capitalization

* updated authenticate test

* switched to lower cased message.type to prevent spreading "toUpperCase" around

* cleaned up debug logs

* cast enabled config to boolean

* Update api/src/websocket/controllers/rest.ts

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

* Update api/src/websocket/handlers/subscribe.ts

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

* Update api/src/websocket/handlers/subscribe.ts

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

* Update api/src/websocket/handlers/items.ts

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

* Update api/src/websocket/controllers/base.ts

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

* Update api/src/websocket/handlers/heartbeat.ts

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

* Suggested fixes by Azri

* removed redundant try-catch

* fixed authentication timeout
added returning the refresh token when authenticating

* updated pnpm lock after merge

* Fixed authentication modes for GraphQL according to best practices

* implement useFakeTimers in heartbeat unit test

* implement useFakeTimers in items unit test

* Update api/src/services/server.ts

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

* removed obsolete authentication.verbose toggle

* added email flag to message validation

* switched to ternary for consistency

* moved getSchema out of for loop

* added singleton logic to items handler

* close the socket after failed auth for non-public connections

* disabled system collections for rest subscriptions

* re-ran pnpm i

* allow for multiple subscripitions in the memory messenger

* - fixed system collection subscriptions
- abstracted hook message bus
- fixed graphql horizontal scaling

* remove logic from root context for tests

* fix reading created item

* fix linter

* typo and extra safe guard suggested by azri

* prevent setting long timeouts in favor of a shared interval

* prevent unsubscribing all existing subscriptions when omitting "uid"

* - extracted getService utility
- block system collections mutation in the items handler
- implemented the correct services for system collections

* allow numeric uid's to be used

* fixed the types for numeric uid's to be used

* added missing await's

* fixed type imports after merge

* removed unused imports

* Update api/src/websocket/controllers/hooks.ts

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

* Update api/src/websocket/controllers/hooks.ts

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

* Update api/src/messenger.ts

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

* improved error for graphql subscriptions

* fixed TS Modernization conflicts

* fixed TS Modernization conflicts

* fixed conflicts after merge

* removed unused name property

* abstracxted environment configuration

* respond to ping messages when heartbeat disabled

* something something merge

* moved toBoolean to it's own util file

* replaced old socket naming

* removed old exception

* fixed typo

* Update api/src/env.ts

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

* Update api/src/websocket/handlers/heartbeat.test.ts

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

* Update api/src/websocket/handlers/heartbeat.ts

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

* Update api/src/services/server.ts

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

* fixed for linter

* add server_info_websocket in graphql

* Add base REST websocket tests

* do merge things

* fixing things

* fixed failing unit test

* Update dependencies

* Move tests

* Update lockfile

* Use new paths when spawning

* return websockets to opt-in

* Enable websockets for tests

* Test with ephemeral access token

* no camelcasing gql subscriptions

* use underscore for gql event

* Remove unused import

* Add base GraphQL subscription tests

* Fix accidental comment

* Add some relational tests

* Organize imports

Using VS Code's default organize import

* Run ESlint formatting

* One more opinionated formatting change

* Formatting

* Fix message sequence not in order

* Remove relational batch update tests

* Test horizontal scaling

* using toboolean util for server_info

* removed unneeded type cast

* found the gql request type

* extra usage of the toBoolean util

* merge the authentication middleware and get-account-for-token util

* updated utility test

* fixed middleware unit test

* Add return

* Remove user filtering and close conns

* Fix reused accountability

* fixed failing util test

* added subscription unit tests

* added missing mock

* trigger workflow

* Revert "trigger workflow"

This reverts commit 4f544b0c1b.

* Trigger testing for all vendors

* add unsubscription confirmation

* Wait for unsubscription confirmation

* Fix incorrect sending of unsubscription confirmation

* updated ubsubscribe logic

* Update count for unsubscription message

* Fix sequence for UUID pktype in MSSQL

* Increase auth timeout

* Add start index when getting messages

* Fix subscription retrieval and cast uid to string

* Remove nested ternary

* Revert "Increase auth timeout"

This reverts commit 10707409c4.

* Terminate connection instead of close

* fixed merge

* re-added missing packages after merge resolve

* fixed type imports

* Create lazy-cows-happen.md

Added changeset

* Minor bump for "directus" package as well

* fixed "strict" auth mode for graphql subscriptions

* removed nested ternary

* Add websocket tests to sequential flow

* Disable pressure limiter for blackbox tests

* fix merge

* WebSockets Documentation (#18254)

* Small repsonsive styling fix on Card

* REST getting started guide

* Authentication guide

* REST subscription guides

* JS Chat guide

* Sidebar websocket guides section

* Added config options

* Respoinding to brainslug's review

* Fixed incorrect header on guides/rt/subs

* Fixed spellchecker

* Correct full code example on guides/rt/chat/js

* Fixed JS chat tut

* Order of steps in js chat guide updated for easier following-along

* Realtime chat Vue Guide

* feat: create react.js file

* feat: add set up for directus project

* docs: create react boilder plate

* docs: initialize connection

* docs: set up submission methods

* docs: establish websocket connection

* docs: subscribe to messages

* docs: create new messages

* docs: display new messages

* docs: display historical messages

* docs: next steps

* docs: full code sample

* docs: clean up

* docs: add name to contributors

* docs: add react card

* docs: updates to react chat

* Added live poll result guide

* docs: intro

* docs: before you begin

* docs: install packages

* docs: authenticate connection

* docs: query and mutation

* docs: utilize hooks

* docs: subscribe to changes

* docs: create helper functions

* docs: display messages

* docs: summary

* docs: full sample code

* chore: add card for webscockets with graphql

* docs: intro

* docs: subscribe to changes

* docs: handling changes

* docs: crud operations

* docs: unsubscribing from changes

* docs: updates

* chore: add card

* chore: updates to graphql docs

* chore: updates to getting started

* chore: updates to subscription

* chore: updates to real chat guide

* Added WebSockets Operations Guide

* Consistent titles

* Contributors component for docs

* Triggering Netlify

* Add operations to sidebar

* Fix operations link

* Small formatting changes

* Clarity around property values

* Removed unused values in Contributors component

* Prompt for default choice

* Tabs & lowercase doctypes

* Semicolons

* Event overwerites -> event listeners

* Spacing

* Flipped order of websockets guide to match GQL

---------

Co-authored-by: Esther Agbaje <folasadeagbaje@gmail.com>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>

* fixed typo

* removed unused import

* added tests for "to-boolean" and "exceptions"

* added websocket service tests

* quote environment variable to satisfy dictionary

* GraphQL Subscriptions update (#18804)

* updated graphql subscription structure

* updated graphql examples

* Create hungry-points-rescue.md

* using `key` instead of `ID` on the toplevel

* removed changeset

* fixed the graphql type after the rename to `key`

* retrun data null for delete events to prevent non-nullable gql error

* updated missed ID reference in the docs

* updated missed ID reference in the docs

* renamed "payload" to "data" in the REST Subscription response

* fixed missed reference to payload

* added optional event filter for REST subscriptions

* updated docs for event filter

* Update docs/guides/real-time/subscriptions/websockets.md

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

---------

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

* added messenger unit test

* always send subscription confirmation

* Add event to subscription options

* Update tests

* Add tests for event filtering

* Revert testing for all vendors

* Remove obsolete console comment

* Update comment

* Correct event in JS WS guide

* Fix collection name to match name used in subscription

* Fix collection name in other guides

* Fix diffs in doc & enhance chart example

* Complete sentence in GraphQL guide

* Small update to config description

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Nitwel <mail@nitwel.de>
Co-authored-by: Kevin Lewis <kvn@lws.io>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Esther Agbaje <folasadeagbaje@gmail.com>
2023-06-08 18:54:50 +00:00
Brainslug
9d8f29b792 Add extra type check in apply-diff (#18783) 2023-06-05 15:05:00 +02:00
ian
cd344baac4 Fix parsing of Error objects when redacting (#18777)
* Fix parsing of Error objects when redacting

* Create perfect-ducks-add.md

* Move errorReplacer into redact util

* Use unknown instead of any

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

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-05-31 08:40:32 -04:00
Brainslug
f96dcc361f Translation string performance (#18097)
* broken migration

* fixed migration

* created new endpoints for translation strings

* updated to use core endpoint

* bad attempts at making the endpoints sensible

* merge changes

* implemented translation strings service

* re-integrating app logic part 1

* re-integrating app logic part 2

* fixed bad lodash import

* re-integrating app logic part 3

* removed obsolete tests

* make the linter happy

* Create tender-trees-buy.md

* added option to search-input

* implementing search

* fixed resizing and sidebar

* Fix linting

* Remove unused translations update into project settings

* Fix missing translations

* Require read permissions for app access

* Fetch translation strings only when authenticated

* Fix project default language not used when user has default language

* Remove commented line

* Rename variable as content has been changed

* Make the current user check more specific

* Remove translation_string from Settings type

* Remove settings reference in docs

* Update changeset

* Rename migration file to ensure date order

* Rename collection, route, service, controller

* Rename migration

* Adjust collection in settings route

* Fix translations service

* Use new `shouldClearCache` util

* Drop translation_strings column in migration

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

* Added basic api docs

* updated dictionary

* updated dictionary

* Update app/src/interfaces/_system/system-input-translated-string/input-translated-string.vue

Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de>

* Update app/src/modules/settings/routes/translation-strings/collection.vue

Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de>

* extracted getCurrentLanguage utility

* Use regular collections/items

* Use regular controller

* Fix item view

* Set correct system field config for translations

* Tweaks

* Use UUID

* Finish placeholders

* Use drawer-item

* Add create to the store

* Remove composables

* Add new placeholder

* Fix saving behavior

* Remove previous take

* Rename migration after merge of live preview

* Generate uuid when migrating

* Remove unused showFilter

* Fix linting

* Fix type warnings

* Not needed as settings no longer contain translation_strings

* Remove leftover blank line

* Update getCurrentLanguage with server default and use in hydrate

* Shift getCurrentLanguage to lang folder to be alongside setLanguage

* add elipsis to placeholder

* Remove slug from key, so you can use dots etc in the key

* updated translation value to be type text again

* Rehydrate fields for updated translation values

* Add tooltip

* updated documentation

* enforce key/language uniqueness in the TranslationService

* updated error message

* updated docs menu item to "custom translations"

* Dynamically fetch translation keys for input-translated-string interface

* use get current language in refresh

* Update docs/reference/system/translations.md

* Update docs/reference/system/translations.md

* Update .changeset/tender-trees-buy.md

* Fetch translation keys when new key is created

* Update api/src/services/translations.ts

* Remove translation_strings remnant

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

* mark key, language and value as required

* correctly mark fields as required

* Catch duplicate key error when creating from input

* Translate translations :-)

* Update tender-trees-buy.md

---------

Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2023-05-26 12:35:44 -04:00
Pascal Jufer
bce32d90a7 Implement update notifier in directus package (#18738)
* Include update notifier in `directus`

* Don't bundle

* Move updateCheck function to `update-check` package

* Create kind-shoes-jam.md

* Update kind-shoes-jam.md

* Remove wrong dep
2023-05-26 09:55:23 -04:00