@aimee-blue/ab-contracts
v2.0.5
Published
Transport layer types and schemas shared by clients, services and serverless functions
Downloads
762
Readme
Aimee-Blue Client/Server/Functions Contract
Structure
schemas
{feature}
funcParam1.ts <-- types specific to function params
action1.ts <-- types specific to actions
type1.ts <-- types specific to entity (e.g. re-used by params/actions ^ above)
...
api.ts <-- all types above collected into API interface
index.ts <-- reexport all dir types for namespacing
...
index.ts <-- reexport all features
Examples?
Looking for examples - dig deeper into code.
Conventions
Do not put code that is specific only to
Functions
or only toClient
. The purpose of this repo is to define a contract between them.Do not share code between feature modules. Subsequent changes to contract of a module should not break other module contracts. Copy-paste is good in this case.
Difference between
Action
andParams
:Action
- received in PubSub stream by clientParams
- received as parameter to function
Please try to suffix your types with
Shape
. Suffix your schemas withSchema
. Suffix function params withParams
and suffix action schemas withActionSchema
.Typically whenever a feature is being developed by more than one dev - any changes to
schemas
directory should be approved by both FE and BE devs developing the feature