2.0.0 • Published 9 months ago

@ty-ras/state v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Typesafe REST API Specification - State Definition Skeleton Implementation

Coverage

This folder contains library which refines the types defined in TyRAS data-backend library. While the state definition higher-kinded type (HKT) in data-backend leaves out all the details, and does so on purpose, this library adds some main guidelines to the HKT.

The guidelines added are the following:

  • The state type itself is an object, each property containing some specific aspect definable by user code,
  • Each such property either is authenticated or not authenticated state.
    • Example of authenticated state could be e.g. username extracted from JWT token.
  • The state specification type is an object, each property containing information about whether the target state type object property is optional or required.
  • The state information type is an array of property names of state specification object.

With the guidelines above, using the state concept in TyRAS should be suitable for vast majority of the cases. The remaining usecases can have their own state usage definition utilising the data-backend base types.