13 Commits

Author SHA1 Message Date
Rijk van Zanten
b8cc796f4c Upgrade Node.js runtime version to 22 (#24140)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2025-01-08 13:26:14 +01:00
Pascal Jufer
82b23a57d4 Add the Directus Marketplace (#21674)
* Add support for MIGRATIONS_PATH (#20627)

* Deprecate "local" extension types (#20624)

* No longer resolve local non-package extensions

* Remove local extensions from watcher

* Install fs-extra for app dev

* Replace usage of get-extensions

* Rename create functions to match behavior

* Drop extensions prefix from cli create

* Drop name requirement from cli add

* Drop extensions name regex checks

* Don't rely on regex for extension identification

* Add changeset

* Fix build for @directus/extensions

* Don't ensure nested dirs

* Load npm dependency by name prefix

* Throw more helpful error when pkg json is missing

* Fix dependency loading paths

* Only load local extensions if extensions path exists

* Fix merge conflict

* Remove unused fs-extra

* Only sync extensions if location is defined

* `extensions` -> `localExtensions`

* Fix resolving of package extensions

- consistent usage of term "package extensions"
- enhance error messages

* Fix syncing extension from storage

* Revert-revert change from #20627

---------

Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>

* Add back `MIGRATIONS_PATH` to `@directus/env` (#21053)

* Setup browse endpoint for browsing Directus extensions (#21033)

* Rename tag directus-custom to directus-extension

* Devil's in the details

* [WIP] Start on search lib

* Setup extensions-registry package

* Update pnpm lock

* Move registry search fn to new package

* Squash bugs

* Remove unused deps

* Remove unused dep in `extensions`

* Add tests for validate-limit

* Finish test coverage

* Remove unused constant

* Add back lodash-es 😇

* Install extensions-registry

* Add default keywords

* Expose registry endpoint in rest api

* Add describe module

* Reinstal pnpm

* Drop reliance on author field

The problem is that there's no requirement for it to be a valid(ated) user. Publisher is the only field we can rely on being an existing NPM user.

* Update convertSearchResult test after author change

* Format

* Allow anything after the route

To support packages with scopes

* Add test for describe

* Add more tests

* Throw unprocessablecontenterror instead of error

* Install errors pkg

* Finish test coverage

* Don't require description

* Don't wrap individual keywords

* Run formatter

* Add changeset

* Update packages/extensions-registry/src/modules/search/utils/validate-text.ts

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

* Return sandbox information

* Drop support for directus-custom keyword

* Set type to null for multiple tags

* Restart api for new registry

* Add version utility

* Add out-of-date error

* Add assertion for api versions

* Finish new list method

* Add describe

* Use updated registry functions

* Fix controller usage

* Return output in data flag to be consistent

* Add tests for the describe module

* Add tests for list module

* Finish tests for extensions-registry package

* Remove vscode shenanigans

---------

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

* Project Forum: Browse UX (#21276)

* Render marketplace route in-app

* Update api list integration

* Add support for limit/offset in list

* Boilerplate route for drawer

* Render extension readme in drawer

* Render extension detail as separate page

* Setup markup for extension banner

* Render readme with markdown styling

* Boilerplate metadata block

* Use v-list for extension metadata metrics

* Render compatibility metric

* Show downloads and publish date

* Refactor to individual files

* Fix missing import

* Add size metric

* Show author on metadat

* Show verified badge

* Finish metadata

* Run formatter

* Style forum detail banner (#21290)

* Style banner contents

* Add background art

* Add banner styles to default dark mode theme

* Undo base style change to avoid conflict

* Add beta chip badge to settings nav (#21296)

* Add layout styling for detail page (#21297)

* Render metadata as grid if size allows

* Finish layout for detail page

* Fix alignment of count

* Fix search-input active state

* Finalize forum header

* Add marketplace banner

* Style registry filter

* Change v-list-item height to min-height

Allows rows for forum registry to grow

* Finalize styling for extension list item

* Finalize styling for registry

* Don't rely on format util

* Forum account detail page (#21299)

* Add support for author describe endpoint

* Boilerplate author page

* Add author endpoint

* Update naming to account

* Render github name on registry list

* Render user's name + avatar on detail

* Load account data on account page

* Restructure module

* Render account banner on account page

* Render account metadata

* Finish account detail page

* Run formatter

* Add sidebar info detail sections

* install extensions from registry (#21070)

* added an endpoint to install extensions from registries

* add changeset

* Revert format/lint scripts

* Update pnpm-lock

* Remove unused dependency

* Add download module to extensions-registry abstraction

* Download from extension registry instead of direct npm

* Throw on error

* Install based on version ID rather than name

* Install based on ID in body

Allows us to extend it in the future if need be

* Download to tmp path instead of extensions

* Save to extensions manager flattened

* Use const for package folder name

* Run more in try/catch to avoid server exit

* Remove changeset

* Undo docs updates

We'll do all docs in a single PR :)

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>

* Manage extensions by directus_extensions primary key instead of npm package name (#21300)

* Add marketplace migration

* Include bundle info

* Rename name to folder

* Store name as folder

* [WIP] Change name to ID

* Update API to use UUIDs for extensions

* Update app to use extensions id

* Run formatter

* Add changeset

* Update generate-app-entrypoint to use updated format

* Fix graphql usage

* Format

* Add forum uninstall endpoint (#21301)

* Bootstrap uninstall

* Finish uninstall endpoint

* Use shared extensions store state for managing extensions in settings (#21317)

* Use extensionsstore for extensions management

* Use shared store for extensions state and modification

* Remove unused emit

* Adds install/uninstall GUI elements for project forum (#21319)

* Use warning color for incompatible

* Styling tweaks

* Transition optional background color

* Add keys for installing

* Add install button to extension detail

* Finish install button

* Add uninstall option to extensions item

* Empty local cached extensions on start

* Add (hopefully) temporary hack to await reload

* Add install / uninstall buttons

* Update lockfile

* Fix bundle entries not rendering properly

* Clean up spinner styling

* Properly wait for reload to be done

* Run formatter

* Fix registry name

* Fix local extension loading

* Render location/company in byline

* Rearchitect metadata to unstyled listitems

* Add max-width to page container

* Only allow admins to install/uninstall extensions

* Remove unused link

* Disable eslint for map use

* Run formatter

* Add no-results indicator (#21389)

* Add no-results indicator

* add error state as well

* Standardize trailing slash

* Standardize pk check

* Resolve unnecessary check

* Move all deps to dev deps in app

* Optimize exec order

* Pull data from top level package

* Redesign filter bar

* Reset page count on filter change

* Use default padding on top of page

Feels weird now, but there's a theme-update coming that'll make this make sense :)

* Show first/last in pagination

* Auto-format package name

* Use updated registry api return names

* Add sorting by total downloads

* Add sparkline for downloads

* Add a bit of padding

* Finalize sparkline styling

* Run formatterg

* Add sandbox flag in list call

* Add MARKETPLACE_TRUST env var

* Set sandbox requirement on download

* Render list item badge

* Fix padding

* Show license in gui

* Add support for multiple maintainers

* Add activity tracking for install

* Make incompatibility notice friendlier

* Tweak margin of sparkline

* Update default CSP headers to include github content

* Make extension readme selectable

* Consistent icon, add tooltips

* Reduce size of install button

* Run formatter

* Render readme anchors with target blank

* Add min width to v-select components

* Fix background on search input

* Reduce padding on marketplace pages

* Fix showing no results

* Be consistent

* Render type filter menu in full height

* Clean up compatibility notice

* Hide count result when search count is 0

* Use v-show instead

* Bump no results notice down a bit

* Cleanup size of install buttons

* Use buttons for install / author

* Fix sparkline rendering

* Add better loading state for extension detail page

* Add spinners

* Render proper error message in case readme is missing

* Use heart logo for marketplace

* Add image border shadow

* Add loading banner on account page

* Show reload warning as persistent notification

* Only show one notification

* Update snapshot

* Add padding to verified icon

* Base extensions id on package id, show installed badge

* Sync pagination / search / filter with URL

Special shoutout to Tim

* Next max ext (#21541)

* Add limit exceeded error

* Add limit exceeded translation

* Add extensions_limit env var

* Load extensions limit in app

* Don't allow installing unknown versions

* Don't require installed flag

* Return bundled entries in describe

* Update chip to match style

* Prevent install on limit reached

* Run formatter

* Fix bundle loading

* Resolve npm extensions by package manifest (#21478)

* Merge main into next (#21669)

* Clean-up deps

* Don't export type (as long as not used anywhere)

* Update semver to latest

* Relax compatibility notice

* Use more suitable icon for version

* Re-render download charts on color-scheme change

* Link extensions to marketplace

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Mahendra Kumar <22556323+mahendraHegde@users.noreply.github.com>
2024-03-04 14:34:59 -05:00
Rijk van Zanten
2c18b543d2 Move environment variable handling to new @directus/env package (#20985)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2024-01-07 04:35:58 +01:00
Rijk van Zanten
b0f5baa394 Add @directus/memory package (#20514)
* Add analytics table

* Setup memory package boilerplate

* Bootstrap library

* [WIP] setup serialize/deserialize for data

* Finish compress/serialize utils

* Add get/set for local

* Add increments method

* Add delete + comments

* Add pub/sub methods

* Remove erroneous files

* Add has, setMax

* Restructure to 3 subclasses

* WIP add Redis cache

* Add set-max

* Add cacheMulti

* Add tests for redis cache

* Don't compress small values

* Only decompress values that are compressed

* Add test for arr-to-buf

* Add tests for multi-stage cache

* Add test for create

* Finish redis based messenger bus

* Add redis bus to createBus

* Resolve lock file conflict

* Align dev deps versions

* Format files

* Update packages/memory/package.json

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

* It's okay, ESLint

* Add local rate limiter

* Add redis limiter

* Add simple readme

* Add changeset

* 'key value' -> 'key-value'

* Sort package.json

* Remove leftovers

* Move timer calls to corresponding test

* Add KV asbraction based on previous "cache"

* Update cache to use kv

* Add more specific console logs

* Only define setMax if not exists

* Run formatter

* Use parseJSON util

* Fix typo in class docs

* Install directus/utils

* Default to Map if LRU config isn't set

* Ignore errors thrown in handlers

* Create process-id util

* Use pubsub in multi-stage handler

* WIP Update tests

* Update package lock

* Fix formatting errors

* Fix timestamp in test

* Uno mas

* Fix mock order

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-12-13 11:29:22 -05:00
Pascal Jufer
ba7fac402e Update Prettier v3.1.0 (#20481) 2023-11-20 16:23:22 +01:00
Rijk van Zanten
1383e85fe9 Cleanup extensions dependencies (#19922)
* Setup boilerplate for extensions page

* Allow reading all extensions from the root endpoint

* Add basic sidebar info detail

* Render list of extensions

* Move extensions manager to folder

* Move stuff related to extensions to @directus/extensions

* Import extensions utils/types/etc from ext. package

* Resolve last imports

* Temp remove settings pane

Different PR!

* Add changeset

* Run formatter

* Fix import in test
2023-10-05 19:20:26 -04:00
José Varela
f96eda89e1 Import: Do task in a separate worker (#19691)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: ian <licitdev@gmail.com>
2023-10-04 11:39:40 +02:00
Pascal Jufer
1fd9259efd Bundle @directus/utils (#19714) 2023-09-20 22:38:00 +02:00
Rijk van Zanten
50e2c4220d Standardize TSConfig use (#18538)
* Use tsconfig.prod.json in packages

* Use prod tsconfig in api

* Install node types in storage
2023-05-10 13:22:30 -04:00
Rijk van Zanten
2bc226d16f Change license to BSL-1.1 (#18330)
* Change license to BSL1.1

* Mark major version

* Fix formatting

* Remove duplicate heading

* Update formatting

* Copy paste error

* Update license

* Update license

* Format covenants

* Update readme.md

* Update licenses for packages

* Update readme.md

* Update contributors.yml

OG... but to be clear, rijkvanzanten is the one who really built all of this ❤️

* Tweak license in openapi

* Update packages/specs/src/openapi.yaml

* Add MIT license headers

* Use v10 in examples

* Update additional examples

* Update generate-extensions-entrypoint.test.ts

* Update tests to use latest v9 and v10 versions

* use lowercase for naming consistency

* change casing for api license

* Update migrations doc

* Update dictionary

* Consistent ordering of license field in app/package.json

* Use major version in specs again (but as string)

So it's valid for all v10 versions

* Consolidate readme's

---------

Co-authored-by: Ben Haynes <ben@directus.io>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2023-04-26 14:10:42 -04:00
Pascal Jufer
17afb9a3bc Patch Tuesday 🐸 (#18260)
* Update `@directus/api` deps (minor)

 @aws-sdk/client-ses          3.292.0  →   3.316.0
 @godaddy/terminus             4.11.2  →    4.12.0
 @rollup/plugin-alias           4.0.3  →     4.0.4
 @rollup/plugin-node-resolve   15.0.1  →    15.0.2
 @types/node                  18.15.3  →  18.15.11
 @vitest/coverage-c8           0.29.3  →    0.30.1
 axios                          1.3.4  →     1.3.6
 fs-extra                      11.1.0  →    11.1.1
 helmet                         6.0.1  →     6.1.5
 ioredis                        5.3.1  →     5.3.2
 joi                           17.8.4  →    17.9.1
 liquidjs                      10.6.1  →    10.7.0
 marked                        4.2.12  →     4.3.0
 nanoid                         3.3.4  →     3.3.6
 rollup                        3.19.1  →    3.20.6
 sharp                         0.31.3  →    0.32.0
 vitest                        0.29.3  →    0.30.1
 vm2                           3.9.16  →    3.9.17

* Update `@directus/api` deps (major)

 @rollup/plugin-alias     4.0.4  →     5.0.0
 @types/inquirer          8.2.6  →     9.0.3
 @types/node           18.15.11  →  18.15.12
 camelcase                6.3.0  →     7.0.1
 chalk                    4.1.2  →     5.2.0
 commander                9.5.0  →    10.0.1
 execa                    5.1.1  →     7.1.1
 icc                      2.0.0  →     3.0.0
 inquirer                 8.2.5  →     9.1.5
 ~ldapjs                   2.3.3  →     3.0.2~
 nanoid                   3.3.6  →     4.0.2
 ~openapi3-ts              3.2.0  →     4.1.1~
 ora                      5.4.1  →     6.3.0
 strip-bom-stream         4.0.0  →     5.0.0
 tedious                 15.1.3  →    16.0.0
 typescript               4.9.5  →     5.0.4

* Update `@directus/app` deps

 @babel/core                             7.21.3  →    7.21.4
 @babel/preset-env                       7.20.2  →    7.21.4
 @fortawesome/fontawesome-svg-core        6.3.0  →     6.4.0
 @fortawesome/free-brands-svg-icons       6.3.0  →     6.4.0
 @fullcalendar/core                       6.1.4  →     6.1.5
 @fullcalendar/daygrid                    6.1.4  →     6.1.5
 @fullcalendar/interaction                6.1.4  →     6.1.5
 @fullcalendar/list                       6.1.4  →     6.1.5
 @fullcalendar/timegrid                   6.1.4  →     6.1.5
 @pinia/testing                          0.0.15  →    0.0.16
 @popperjs/core                          2.11.6  →    2.11.7
 @storybook/addon-actions            7.0.0-rc.4  →     7.0.6
 @storybook/addon-backgrounds        7.0.0-rc.4  →     7.0.6
 @storybook/addon-docs               7.0.0-rc.4  →     7.0.6
 @storybook/addon-essentials         7.0.0-rc.4  →     7.0.6
 @storybook/addon-links              7.0.0-rc.4  →     7.0.6
 @storybook/addon-mdx-gfm            7.0.0-rc.4  →     7.0.6
 @storybook/addon-measure            7.0.0-rc.4  →     7.0.6
 @storybook/addon-outline            7.0.0-rc.4  →     7.0.6
 @storybook/client-api               7.0.0-rc.4  →     7.0.6
 @storybook/client-logger            7.0.0-rc.4  →     7.0.6
 @storybook/vue3                     7.0.0-rc.4  →     7.0.6
 @storybook/vue3-vite                7.0.0-rc.4  →     7.0.6
 @types/diff                              5.0.2  →     5.0.3
 @types/dompurify                         3.0.0  →     3.0.2
 @types/lodash                         4.14.191  →  4.14.194
 @vitejs/plugin-vue                       4.0.0  →     4.1.0
 @vue/test-utils                          2.3.1  →     2.3.2
 apexcharts                              3.37.1  →    3.39.0
 axios                                    1.3.4  →     1.3.6
 dompurify                                3.0.1  →     3.0.2
 happy-dom                                8.9.0  →     9.8.4
 marked                                  4.2.12  →     4.3.0
 nanoid                                   4.0.1  →     4.0.2
 pinia                                   2.0.33  →    2.0.34
 sass                                    1.59.3  →    1.62.0
 storybook                           7.0.0-rc.4  →     7.0.6
 typescript                               4.9.5  →     5.0.4
 vite                                     4.1.4  →     4.2.2
 vitest                                  0.29.3  →    0.30.1
 webpack                                 5.76.2  →    5.80.0

* Update root deps

* Update `@directus/composables` deps

* Update `@directus/constant` deps

* Update `create-directus-extension` deps

* Update `@directus/exceptions` deps

* tsconfig workaround: ignoreDeprecations

* Update `@directus/extensions-sdk` deps

* Update `@directus/schema` deps

* Update `@directus/storage` deps

* Update `@directus/storage-driver-azure` deps

* Update `@directus/storage-driver-cloudinary` deps

* Update `@directus/storage-driver-gcs` deps

* Update `@directus/storage-driver-local` deps

* Update `@directus/storage-driver-s3` deps

* Update `@directus/types` deps

* Update `@directus/update-check` deps

* Update `@directus/utils` deps

* tsconfig workaround in schema: ignoreDeprecations

* tsconfig workaround in remaining packages: ignoreDeprecations

* Update `tests-blackbox` deps

* Revert "tsconfig workaround: ignoreDeprecations"

This reverts commit 5d97da55e3.

* Revert tsconfig override

* Update tsconfig

* Fix imports in @directus/utils

* Fix imports in composables

* Fix imports in extensions-sdk

* Fix imports in @directus/api

* Move RateLimiterAbstract to types import as well

* Bump pnpm to 8.3.1

* Update `docs` deps

> [...] the @vueuse/head package will be deprecated. If you're setting up this package on a new project, you should use the @unhead/vue package directly [...]

* Remove obselete dep `concurrently` from extensions-sdk

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

* New day, new updates

Also forgot to include minor updates of deps in `tests-blackbox` in previous
commit

* Fix `api` tests

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
2023-04-21 12:59:27 -04:00
rijkvanzanten
37658802b7 One more 2023-04-14 17:30:56 -04:00
Rijk van Zanten
2983e61870 The Great TypeScript Modernization Program Season 3 Episode 6: The Big One (#18014)
* Step 1

* Step 2

* False sense of confidence

* Couple more before dinner

* Update schema package

* Update format-title

* Upgrade specs file

* Close

* Replace ts-node-dev with tsx, and various others

* Replace lodash with lodash-es

* Add lodash-es types

* Update knex import

* More fun is had

* FSE

* Consolidate repos

* Various tweaks and fixes

* Fix specs

* Remove dependency on knex-schema-inspector

* Fix wrong imports of inspector

* Move shared exceptions to new package

* Move constants to separate module

* Move types to new types package

* Use directus/types

* I believe this is no longer needed

* [WIP] Start moving utils to esm

* ESMify Shared

* Move shared utils to  @directus/utils

* Use @directus/utils instead of @directus/shared/utils

* It runs!

* Use correct schemaoverview type

* Fix imports

* Fix the thing

* Start on new update-checker lib

* Use new update-check package

* Swap out directus/shared in app

* Pushing through the last bits now

* Dangerously make extensions SDK ESM

* Use @directus/types in tests

* Copy util function to test

* Fix linter config

* Add missing import

* Hot takes

* Fix build

* Curse these default exports

* No tests in constants

* Add tests

* Remove tests from types

* Add tests for exceptions

* Fix test

* Fix app tests

* Fix import in test

* Fix various tests

* Fix specs export

* Some more tests

* Remove broken integration tests

These were broken beyond repair.. They were also written before we really knew what we we're doing with tests, so I think it's better to say goodbye and start over with these

* Regenerate lockfile

* Fix imports from merge

* I create my own problems

* Make sharp play nice

* Add vitest config

* Install missing blackbox dep

* Consts shouldn't be in types

tsk tsk tsk tsk

* Fix type/const usage in extensions-sdk

* cursed.default

* Reduce circular deps

* Fix circular dep in items service

* vvv

* Trigger testing for all vendors

* Add workaround for rollup

* Prepend the file protocol for the ESM loader to be compatible with Windows
"WARN: Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'"

* Fix postgres

* Schema package updates

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

* Resolve cjs/mjs extensions

* Clean-up eslint config

* fixed extension concatination

* using string interpolation for consistency

* Revert MySQL optimisation

* Revert testing for all vendors

* Replace tsx with esbuild-kit/esm-loader

Is a bit faster and we can rely on the built-in `watch` and `inspect`
functionalities of Node.js

Note: The possibility to watch other files (.env in our case) might be
added in the future, see https://github.com/nodejs/node/issues/45467

* Use exact version for esbuild-kit/esm-loader

* Fix import

---------

Co-authored-by: ian <licitdev@gmail.com>
Co-authored-by: Brainslug <tim@brainslug.nl>
Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
2023-04-04 17:41:56 -04:00