@acmedinotech/dinoframe
TypeScript icon, indicating that this package has built-in type declarations

0.1.2023082-4.4 • Public • Published

dinoframe

dinoframe is a decorator framework that makes wiring complex web apps in TypeScript easier. At its core, it provides libraries to make it easy to write and apply new decorators along wth a core set of decorators to make it easy to orchestrate application startup. In general, it should be pretty simple to integrate with and get moving.

Quick note on discover()

The JS engine will only process a class when a concrete reference is made to it -- simply importing it won't do anything. To get around that, we've adopted the following convention: entrypoints into your code should contain discover(): string, either as a module member or static class member. This function should:

  1. directly reference the classes you want to process
    • e.g. simply having a line like [Class1, Class2] is enough
  2. optionally return a bundle identifier
    • explained in bundle submodule

This is only a suggestion, but we tend to prefer explicit entrypoints to avoid any confusion.

decorator

TS doesn't make decorators instrinsic metadata on a class. If you like Java-style annotations that are accessible as class metadata, it's on you to implement that functionality yourself. However, even that has its limitations if you're interested in what other decorators are applied.

The decorator module changes that. It provides an easy way to:

  1. collect decorator metadata into a convenient and hierarchical structure (grouping metadata by providers);
  2. uniquely and consistently identify a class across arbitrary decorator providers;
  3. package decorated classes into uniquely defined bundles (grouping metadata by concern);
  4. introspect decorations from other providers using the collection library;

service-container, http

Building on decorator, and inspired by Apache Sling, service-container makes it quick and simple to declare services and their dependencies purely through decorators. Dependency management ensures no service starts up until all its dependencies are fulfilled, interfaces provide inversion-of-control, and flexible access pattern works seamlessly with your existing code.

A companion to the container is http, which makes it easy to declare routes and middleware in an Express-friendly way while also supporting service container integration.

morph

The morph module is a lightweight and flexible serialization/deserialization library that makes it easy to validate and convert external data into a concrete class instance. See the morph readme for in-depth examples and explanation.

Package Sidebar

Install

npm i @acmedinotech/dinoframe

Weekly Downloads

2

Version

0.1.2023082-4.4

License

GPL-3.0-or-later

Unpacked Size

84.5 kB

Total Files

27

Last publish

Collaborators

  • kaisershahid