* Update BaseStorage
remove dublicate strings into variables
* Apply suggestions from code review
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
* Use enum types in keys
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
* Refresh auth when SDK is initialised
If autorefresh is enabled, then this will cause the SDK to refresh tokens whenever it's loaded. This fixes bug #9639 (discussion #9720)
* start autoRefreshJob on constructor and on refresh
* preserve refresh_token before clear it on refresh
Co-authored-by: Jose Varela <joselcvarela@gmail.com>
* refactor: more intuitive interfaces
* refactor: simpler refresh
before: on every request we were debouncing a refresh request
after: call refresh only once before now() + 'expires'
* refactor: prefix on base storage
* fixup! refactor: simpler refresh before: on every request we were debouncing a refresh request after: call refresh only once before now() + 'expires'
* refactor: simpler axios transport
before: handle auth headers
after: auth headers are handled on directus instance
* refactor: simpler usage of Directus constructor
* fixup! refactor: simpler refresh before: on every request we were debouncing a refresh request after: call refresh only once before now() + 'expires'
* refactor: fix tests based on previous changes
* refactor: better auth constructor
before: depends on SDK instance
after: depends on Transport and Storage instance
* accept staticToken from auth
* make transport and storage as optional on options
* fix type auth refresh
* simplify transport
* fix test for previous changes
* improve auth class
* revert some IAuth props because tests
* allow to force memory of localstorage on storage
* add tests for previous change
* document everything and simplify some things
* fix override headers on request
* better name typing
* fix private axios
* removed boolean from CLI auth.refresh()
* fix missing url in some examples
* soem grammar updates
Co-authored-by: Jay Cammarano <jay.cammarano@gmail.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
* Update dependency axios to v0.22.0
* Fix shared type
* Use any type in axios
* Adjust for axios type breaking change
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This fixes not being able to build the repo due to type issues
introduced by the Typescript 4.4 option "useUnknownInCatchVariables",
which is enabled by default in strict mode.
* Make spinner success message bold in extension cli
* Expose extension-sdk cli functions
* Add create-directus-extension package
* Bump version
* Fix type fun times
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
The AxiosRequest config allows for an onUploadProgress function to be passed in. This is useful, if we want to
give users some kind of feedback about the progress of a potential file transfer. Currently, the sdk is only supporting
this via direct access to the transport method.
Co-authored-by: Mirko Nitschke <mnitscke93@gmail.com>
* Declare return types on functions
And a very few other type related minor fixes
* Minor syntax fixes
* Remove unnecessary escape chars in regexes
* Remove unnecessary awaits
* Replace deprecated req.connection with req.socket
* Replace deprecated upload with uploadOne
* Remove unnecessary eslint-disable-next-line comments
* Comment empty functions / catch or finally clauses
* Fix irregular whitespaces
* Add missing returns (null)
* Remove unreachable code
* A few logical fixes
* Remove / Handle non-null assertions which are certainly unnecessary (e.g. in
tests)