@dmitrymin/eventmapper-common
TypeScript icon, indicating that this package has built-in type declarations

2.6.102 • Public • Published

EventMapper Common

Common types and utilities shared across EventMapper applications.

Publish

npm run relase # trigger automatic version change and push to github
npm publish

Installation

npm install eventmapper-common

Data schema, types, validation

GraphQL

GraphQL -> Resolvers -> |Domain Boundary| -> Services -> Loaders -> Data Sources (Postgres/Redis/Elasticsearch)

https://2ality.com/2020/06/validating-data-typescript.html#approaches-for-data-validation-in-typescript

OpenAPI - https://www.npmjs.com/package/@openapi-contrib/json-schema-to-openapi-schema

Schema

To provide a common entity interface shareable across applications, entities are defined using JSON Schema DSL. JSON schema is then used to define the validator.

Types / Interfaces

TypeScript types are derived from the JSON Schema DSL with the help of TypeBox

The typing can be augmented using the TypeBox modifiers. This produces:

External vs. internal representation of data...

Validation

Validation is handled by AJV

https://www.npmjs.com/package/ajv/v/6.12.6 https://ajv.js.org/packages/ajv-formats.html https://github.com/ajv-validator/ajv-errors https://caoslab.psy.cmu.edu:32443/developers/jsexperimentslayout/-/tree/homepage_full/client/node_modules/babel-loader/node_modules/ajv https://opensourcelibs.com/lib/typebox

Parsing / serialization -

https://ajv.js.org/guide/getting-started.html#parsing-and-serializing-json

https://levelup.gitconnected.com/typescript-validation-with-ajv-1b70a76dd678 https://code.tutsplus.com/tutorials/validating-data-with-json-schema-part-1--cms-25343 https://spin.atomicobject.com/2018/03/26/typescript-data-validation/

Resources

Project setup

Versioning

TSLint

Alternatives

Readme

Keywords

none

Package Sidebar

Install

npm i @dmitrymin/eventmapper-common

Weekly Downloads

100

Version

2.6.102

License

none

Unpacked Size

290 kB

Total Files

545

Last publish

Collaborators

  • dmitrymin