Files
directus/api/package.json
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

230 lines
5.8 KiB
JSON

{
"name": "@directus/api",
"version": "11.0.1",
"description": "Directus is a real-time API and App dashboard for managing SQL database content",
"keywords": [
"directus",
"realtime",
"database",
"content",
"api",
"rest",
"graphql",
"app",
"dashboard",
"headless",
"cms",
"mysql",
"postgresql",
"cockroachdb",
"sqlite",
"framework",
"vue"
],
"homepage": "https://directus.io",
"repository": {
"type": "git",
"url": "https://github.com/directus/directus.git",
"directory": "api"
},
"funding": "https://github.com/directus/directus?sponsor=1",
"license": "BUSL-1.1",
"author": {
"name": "Monospace Inc",
"email": "info@monospace.io",
"url": "https://monospace.io"
},
"maintainers": [
{
"name": "Rijk van Zanten",
"email": "rijkvanzanten@me.com",
"url": "https://github.com/rijkvanzanten"
},
{
"name": "Ben Haynes",
"email": "ben@rngr.org",
"url": "https://github.com/benhaynes"
}
],
"type": "module",
"exports": {
".": "./dist/index.js",
"./*": "./dist/*.js",
"./cli/run.js": "./dist/cli/run.js",
"./package.json": "./package.json"
},
"main": "dist/index.js",
"files": [
"dist"
],
"scripts": {
"build": "tsc --project tsconfig.prod.json && copyfiles \"src/**/*.{yaml,liquid}\" -u 1 dist",
"cli": "NODE_ENV=development SERVE_APP=false tsx src/cli/run.ts",
"dev": "NODE_ENV=development SERVE_APP=false tsx watch --clear-screen=false src/start.ts",
"test": "vitest --watch=false"
},
"dependencies": {
"@authenio/samlify-node-xmllint": "2.0.0",
"@aws-sdk/client-ses": "3.332.0",
"@directus/app": "workspace:*",
"@directus/constants": "workspace:*",
"@directus/exceptions": "workspace:*",
"@directus/extensions-sdk": "workspace:*",
"@directus/format-title": "10.0.0",
"@directus/pressure": "workspace:*",
"@directus/schema": "workspace:*",
"@directus/specs": "workspace:*",
"@directus/storage": "workspace:*",
"@directus/storage-driver-azure": "workspace:*",
"@directus/storage-driver-cloudinary": "workspace:*",
"@directus/storage-driver-gcs": "workspace:*",
"@directus/storage-driver-local": "workspace:*",
"@directus/storage-driver-s3": "workspace:*",
"@directus/utils": "workspace:*",
"@godaddy/terminus": "4.12.0",
"@rollup/plugin-alias": "5.0.0",
"@rollup/plugin-node-resolve": "15.0.2",
"@rollup/plugin-virtual": "3.0.1",
"argon2": "0.30.3",
"async": "3.2.4",
"axios": "1.4.0",
"busboy": "1.6.0",
"bytes": "3.1.2",
"camelcase": "7.0.1",
"chalk": "5.2.0",
"chokidar": "3.5.3",
"commander": "10.0.1",
"content-disposition": "0.5.4",
"cookie-parser": "1.4.6",
"cors": "2.8.5",
"cron-parser": "4.8.1",
"csv-parser": "3.0.0",
"date-fns": "2.30.0",
"deep-diff": "1.0.2",
"destroy": "1.2.0",
"dotenv": "16.0.3",
"encodeurl": "1.0.2",
"eventemitter2": "6.4.9",
"execa": "7.1.1",
"exif-reader": "1.2.0",
"express": "4.18.2",
"flat": "5.0.2",
"fs-extra": "11.1.1",
"graphql": "16.6.0",
"graphql-compose": "9.0.10",
"graphql-ws": "5.12.0",
"helmet": "7.0.0",
"icc": "3.0.0",
"inquirer": "9.2.4",
"ioredis": "5.3.2",
"joi": "17.9.2",
"js-yaml": "4.1.0",
"js2xmlparser": "5.0.0",
"json2csv": "5.0.7",
"jsonwebtoken": "9.0.0",
"keyv": "4.5.2",
"knex": "2.4.2",
"ldapjs": "2.3.3",
"liquidjs": "10.7.1",
"lodash-es": "4.17.21",
"marked": "5.0.2",
"micromustache": "8.0.3",
"mime-types": "2.1.35",
"minimatch": "9.0.1",
"ms": "2.1.3",
"nanoid": "4.0.2",
"node-machine-id": "1.1.12",
"node-schedule": "2.1.1",
"nodemailer": "6.9.2",
"object-hash": "3.0.0",
"openapi3-ts": "4.1.2",
"openid-client": "5.4.2",
"ora": "6.3.1",
"otplib": "12.0.1",
"pino": "8.14.1",
"pino-http": "8.3.3",
"pino-http-print": "3.1.0",
"pino-pretty": "10.0.0",
"qs": "6.11.2",
"rate-limiter-flexible": "2.4.1",
"rollup": "3.22.0",
"samlify": "2.8.10",
"sanitize-html": "2.10.0",
"sharp": "0.32.1",
"snappy": "7.2.2",
"stream-json": "1.7.5",
"strip-bom-stream": "5.0.0",
"tmp-promise": "3.0.3",
"tsx": "3.12.7",
"uuid": "9.0.0",
"uuid-validate": "0.0.3",
"vm2": "3.9.19",
"wellknown": "0.5.0",
"ws": "8.12.1",
"zod": "3.21.4",
"zod-validation-error": "1.0.1"
},
"devDependencies": {
"@directus/tsconfig": "workspace:*",
"@directus/types": "workspace:*",
"@ngneat/falso": "6.4.0",
"@types/async": "3.2.20",
"@types/busboy": "1.5.0",
"@types/bytes": "3.1.1",
"@types/content-disposition": "0.5.5",
"@types/cookie-parser": "1.4.3",
"@types/cors": "2.8.13",
"@types/deep-diff": "1.0.2",
"@types/destroy": "1.0.0",
"@types/encodeurl": "1.0.0",
"@types/exif-reader": "1.0.0",
"@types/express": "4.17.17",
"@types/express-serve-static-core": "4.17.35",
"@types/flat": "5.0.2",
"@types/fs-extra": "11.0.1",
"@types/inquirer": "9.0.3",
"@types/js-yaml": "4.0.5",
"@types/json2csv": "5.0.3",
"@types/jsonwebtoken": "9.0.2",
"@types/keyv": "4.2.0",
"@types/ldapjs": "2.2.5",
"@types/lodash-es": "4.17.7",
"@types/marked": "4.3.0",
"@types/mime-types": "2.1.1",
"@types/ms": "0.7.31",
"@types/node": "18.16.12",
"@types/node-schedule": "2.1.0",
"@types/nodemailer": "6.4.7",
"@types/object-hash": "3.0.2",
"@types/qs": "6.9.7",
"@types/sanitize-html": "2.9.0",
"@types/stream-json": "1.7.3",
"@types/supertest": "2.0.12",
"@types/uuid": "9.0.1",
"@types/uuid-validate": "0.0.1",
"@types/wellknown": "0.5.4",
"@types/ws": "8.5.4",
"@vitest/coverage-c8": "0.31.1",
"copyfiles": "2.4.1",
"form-data": "4.0.0",
"knex-mock-client": "2.0.0",
"supertest": "6.3.3",
"typescript": "5.0.4",
"vitest": "0.31.1"
},
"optionalDependencies": {
"@keyv/redis": "2.5.8",
"keyv-memcache": "1.3.3",
"memcached": "2.2.2",
"mysql": "2.18.1",
"nodemailer-mailgun-transport": "2.1.5",
"nodemailer-sendgrid": "1.0.3",
"pg": "8.11.0",
"sqlite3": "5.1.6",
"tedious": "16.1.0"
},
"engines": {
"node": ">=18.0.0"
}
}