1.11.4 (2024-05-13)
1.11.3 (2024-04-19)
1.11.2 (2024-04-18)
1.11.1 (2024-04-17)
1.11.0 (2024-04-08)
1.10.1 (2024-04-06)
- bump for PR (173364f)
1.10.0 (2024-03-21)
1.9.1 (2023-10-11)
1.9.0 (2023-09-04)
1.8.1 (2023-08-10)
1.8.0 (2022-09-30)
1.7.0 (2022-08-05)
- c5a8201: Add customisable relationship names
- d5cd4d1: Updated dependencies
- bd4c358: Add
relatorDataCache
in serialize method to avoid duplicate lookups duringrecurseRelators
call
- e81d1b1: Adds assertions to issue-23 test (testing depth > 1)
- Fixes #24
- Fixes #23
- 3dc7c4c: Allow null for empty to-one relationships
- Added an
isErrorDocument
function to detect JSON:API Error documents. This function allows you to treat the argument as if it were an error document (there is obviously no way to know if it really is a JSON:API error document at runtime). - Added an
isLikeJapiError
function to detect JSON:API Error. This function allows you to treat the argument as if it were an JSON:API error (there is obviously no way to know if it really is a JSON:API error at runtime).
- Exported a
isPlainObject
andisObjectObject
functions from internal.
- Fix for #10
- Fix for #11
- Changed user-level repo to org-level repo.
- Links have been fixed in docs and README
- Exported interfaces related to JSON:API.
- The Error and Data document interfaces now require the "errors" and "data" properties respectively.
- The Base document interface has been abstracted further by removing the "meta" property.
- A new Meta document interface is now available for type-checking.
- Smaller packaging
- Updated license to Apache 2.0
- Fixed some grammatical errors in README
- A new
Cache
class is now available to use for caching. You can set this in thecache
option for aSerializer
(usetrue
if you want the built in cache). - With caching, there is a ~586% speed improvement (412,768 ops/sec over the previous 70,435 ops/sec). Without-caching rates have stayed the same.
- More keywords to
package.json
to help user search for this package.
So, ts-japi
has only been released a few days, but after some significant use in my APIs, I have
realized a few things:
- Linkers and certain classes should be allowed to parse
nullish
data (nullish
meaningundefined
ornull
). - The
relationships object
should be allowed to have custom keys, not dependent on therelators
optionsRelator
s should always have aSerializer
; otherwise, they wouldn't relate to anyresource
per se.
- Projections should be "choose included" or "choose excluded" similar to MongoDB's.
- The code can be faster.
With this in mind, here are the changes.
- [Breaking Change] Every relator must define a
Serializer
as the second argument in its constructor (as opposed to the relator's options. Options can go in the third argument.- It may be subtle, but the reason for this lies in the fact
relationships object
must be keyed by the related object. If the relator has no serializer, then the relator has no related name, hence there is no canonical way to key the relationship. - We will now allow objects of relators to be defined as an option for
relators
onSerializer
s. By using objects, the key for the relationship generated by the relator will correspond to the same key for that of the relator's.
- It may be subtle, but the reason for this lies in the fact
- Several functional options now allow for
nullish
(null
orundefined
) arguments:- Resource Linkers can now type-safely use
nullish
arguments. - Resource Metaizers can now type-safely use
nullish
arguments.
- Resource Linkers can now type-safely use
- Several plain options now allow for
nullish
(null
orundefined
):- Serializer
projection
option has changed significantly (see the option itself) withnullish
values.
- Serializer
- There is a ~33% speed improvement. (70,435 ops/sec over 52,843 ops/sec on a low-end Macbook Pro 15")
- Started a CHANGELOG to keep users updated.
I want to say this IS unusual to have a breaking change without depreciation, but given the fact this package is only a few days old, I want to apologize if you are bothered by the above break. However, I will guarantee that API changes will go through depreciation before removal, so happy coding :)