36 Commits

Author SHA1 Message Date
NilsBaumgartner1994
fd93b850e0 Update BaseStorage (#9985)
* 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>
2021-12-01 20:20:27 +00:00
José Varela
2fa2a75b60 SDK: Fix type arrays on filter (#10133)
* support arrays as types for _in, _nin, etc.

* improve type definition on filters
2021-12-01 14:04:55 -05:00
Oreille
f920196c18 Add logical operators to the SDK's Filter type (#9965)
* Add logical filter operator to the Filter type

* Removed unnecessary ?

* Reverted import from `@directus/shared`

* Handle many-to-many field filters
2021-11-22 13:05:22 -05:00
Joe Innes
ff002443f0 SDK: Start auth refresh job when constructor is initialised (#9777)
* 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>
2021-11-22 11:11:09 -05:00
José Varela
da0676fefc Fix pass options to transport (#9725) 2021-11-11 15:34:14 +00:00
José Varela
23f6baa4db SDK: refactor constructors (#9080)
* 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>
2021-11-04 13:30:30 -04:00
Daniil Yastremskiy
752689d32a Add geo operators to FilterOperators type (#8863) 2021-10-16 21:38:58 +00:00
renovate[bot]
b2ec182493 Update typescript-eslint monorepo to v5 (major) (#8702)
* Update typescript-eslint monorepo to v5

* Fix linter warnings

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-10-12 11:07:46 -04:00
renovate[bot]
b8d4a24958 Update dependency axios to v0.22.0 (#8483)
* 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>
2021-10-01 12:41:18 -04:00
Azri Kahar
b125cd2837 fix type for deep query with underscore prefix (#7815) 2021-09-03 12:01:34 -04:00
Nicola Krumschmidt
d64ca14348 Explicitly set catch parameters to any type (#7654)
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.
2021-08-27 10:33:30 -04:00
Nicola Krumschmidt
ba43e3139e Add create-directus-extension package (#7329)
* 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>
2021-08-26 17:32:27 -04:00
Sam Milledge
e1cbfc4ca4 Fix SDK request url in fields update one request (#7514)
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2021-08-20 09:59:58 -04:00
Pascal Jufer
cacd4f4ff1 Fix HTTP method for collections.createMany in SDK (#7304)
* Fix HTTP method for collections.createMany in SDK

* Post collections in data body

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-08-10 09:30:24 -04:00
Jay Cammarano
1e16065bb0 Updated routes for SDK Settings, Relations, Collections, and Fields (#7192)
* draft

* enpoints tested(manually) and working

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

* removed optional params

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
2021-08-04 16:00:05 -04:00
Bart van der Meeren
3a9475fba5 Fix SDK invite accept (#6925)
Post instead of patch.
2021-07-22 09:20:29 -04:00
Matteo Gazzoni
25fa4f12bc add updateByQuery to js sdk (#6824)
* add updateByQuery to js sdk

https://github.com/directus/directus/discussions/6822

* Update items.ts
2021-07-15 10:11:02 -04:00
Pascal Jufer
c599c076c0 Support invite_url in SDK invite method (#6742)
Fixes #6731
2021-07-11 09:52:20 +02:00
masterwendu
07e3cb1767 add full tfa support to sdk (#6621) 2021-07-04 13:55:12 +02:00
WoLfulus
043ae13e40 Adds request and response interceptors on Axios transport (#6538) 2021-06-28 18:44:38 +00:00
Mirko
09a9f5659e Pass onUploadProgress function through to the axios request (#6007)
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>
2021-06-03 12:44:06 -04:00
rijkvanzanten
c3589d138f Remove remaining leftovers from deprecated single query param 2021-05-25 11:38:33 -04:00
João
4366194ac3 fix sdk server info type (#5584) 2021-05-10 12:50:19 -04:00
Rijk van Zanten
b6964fa1a1 Add XML export (#5526) 2021-05-07 12:55:03 -04:00
João
b20a394f51 Update SDK docs and code to match API (#5437) 2021-05-03 14:46:05 -04:00
João
c62d30b816 Fix weird authentication/refresh flow in the SDK (#5399) 2021-04-30 13:33:24 -04:00
rijkvanzanten
801e868554 Fix remaining eslint errors
h/t @paescuj
2021-04-29 15:55:12 -04:00
Pascal Jufer
acd41eb0be Syntax fixes (#5367)
* 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)
2021-04-29 12:11:43 -04:00
WoLfulus
48fbb6f255 Fix expiration check on the SDK 2021-04-23 08:05:10 -03:00
João
af13cfe18e Change token and auth handling behavior. (#5203)
* change tokens and authentication handling/refresh

* update sdk docs
2021-04-22 17:54:30 -04:00
João
070df173d7 Add payloads to delete requests (#5187) 2021-04-21 21:01:36 +00:00
João
90f878b26f export base storage, fix singleton handler location (#5169) 2021-04-20 13:54:29 -04:00
WoLfulus
1898be9424 Add withCredentials to axios (#4886)
* add no cache and credentials to axios

* remove cache
2021-04-07 12:32:26 -04:00
WoLfulus
3db8b9a1b3 Updated SDK docs and typing fixes (#4787)
* typing fixes

* docs update

* ignore compiled test dir

* use top level await syntax
2021-03-31 14:43:29 -04:00
rijkvanzanten
a5eadd1ec4 Fix reset url parameter in password request
Fixes #4739
2021-03-30 18:30:56 -04:00
WoLfulus
3c1204b928 SDK 2.0 (#4510)
* add new sdk

* update version

* fixes and sdk documentation

* typing updates, documentation

* added missing endpoints

* targeting minified version for unpkg

* removed unused types file

* fixed non minified versions

* fix sdk exports

* fix the fix

* Remove old sdk

* Remove old sdk docs

* Install types for Jest, add npm test

* Rely on npm exclusively

* Remove examples folder

* Move typescript down

* Update sdk.md

* added auto refresh and requested changes

added more http test calls
fixed typing issue in customized types

* remove unused endpoint

* updated docs

* added singletons, fixed typing issues, added password handlers

* rename graphql function and fixed system endpoint

* Remove unused imports, fix build

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
Co-authored-by: Ben Haynes <ben@rngr.org>
2021-03-30 18:23:23 -04:00