javascript
javascript copied to clipboard
Fix return types for backend resource deletions
Description
When deleting resources, for example an Organization, the backend client is typed to return Organization
, whereas the actual HTTP API returns a DeletedObject
, resulting in a type mismatch. This PR:
- updates
DeletedObjectJSON
to accept a generic that extendsstring
, with a default ofstring
- i initially wanted this to extend
ObjectType
but then that would breakDeletedObject.fromJSON()
- i initially wanted this to extend
- changes the generics passed into
this.request()
for the following resource delete methods:-
Allowlist
-
Domain
-
EmailAddress
-
Organization
-
PhoneNumber
-
RedirectUrl
-
SamlConnection
- for this one i'm just assuming
ObjectType.SamlAccount
is the correct type, as there's noSamlConnection
- for this one i'm just assuming
-
User
-
I'm not sure what the convention would be for handling this DeletedObjectJSON
type
property so this just seemed like the most straight forward way that wouldn't break anything 😅
Checklist
- [x]
npm test
runs as expected. - [x]
npm run build
runs as expected. - [ ] (If applicable) JSDoc comments have been added or updated for any package exports
- [ ] (If applicable) Documentation has been updated
Type of change
- [x] 🐛 Bug fix
- [ ] 🌟 New feature
- [ ] 🔨 Breaking change
- [ ] 📖 Refactoring / dependency upgrade / documentation
- [ ] other: