Skip to content

About

The primitives every AntelopeJS interface is built from, including proxies, decorators, module lifecycle events, logging and configuration.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

114 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

INTERFACE · CORE: part of AntelopeJS, hexagonal architecture beyond your own code. A glowing button reads Star AntelopeJS.

@antelopejs/interface-core

npm License Discord Docs Star AntelopeJS

The primitives every AntelopeJS interface is built from, including proxies, decorators, module lifecycle events, logging and configuration.

Documentation · Implementations · All interfaces and providers

This package holds the primitives every AntelopeJS interface is built from. It provides proxies that cross module boundaries, decorator factories, module lifecycle events, structured logging, and project configuration.

What it offers

  • InterfaceFunction declares a contract function. ImplementInterface attaches a module's implementation to it, typed by InterfaceToImpl. Calls made before the implementation attaches wait in a queue.
  • AsyncProxy, EventProxy and RegisteringProxy carry calls, events and registrations between modules, and detach when a module unloads.
  • @antelopejs/interface-core/decorators builds typed class, method, property and parameter decorators.
  • @antelopejs/interface-core/modules exposes lifecycle events and module management functions.
  • @antelopejs/interface-core/logging writes structured logs on named channels.
  • @antelopejs/interface-core/config provides defineConfig for antelope.config.ts.

Implementations

Module Notes
@antelopejs/core The AntelopeJS runtime and ajs CLI implement this interface

Install

Add the package to every module that declares or implements an interface:

pnpm add @antelopejs/interface-core

You need no extra module, because @antelopejs/core provides the implementation.

Quick start

Declare a contract:

// src/interface/index.ts
import { InterfaceFunction } from "@antelopejs/interface-core";

export const GetGreeting = InterfaceFunction<(name: string) => string>();

Implement it and call it from a module:

// src/index.ts
import { ImplementInterface } from "@antelopejs/interface-core";
import { Logging } from "@antelopejs/interface-core/logging";
import * as Greeting from "./interface";

export function construct() {
  ImplementInterface(Greeting, {
    GetGreeting: (name: string) => `Hello, ${name}`,
  });
}

export async function start() {
  Logging.Info(await Greeting.GetGreeting("Ada"));
}

An interface function always returns a promise, even when the implementation is synchronous.

Documentation

Compatibility

@antelopejs/core implements this package. Each core release declares the @antelopejs/interface-core range it works with in the dependencies of its package.json.

Contributing

Read CONTRIBUTING.md before you open a pull request. The local checks are:

pnpm install
pnpm lint
pnpm test

Part of AntelopeJS

AntelopeJS is a TypeScript framework where modules depend on contracts and the application chooses the provider that implements each one, and the open-source back office AntelopeJS DMS is built on it.

Area Contracts Providers
API interface-api · interface-api-util · interface-data-api api
Auth interface-auth auth-jwt
Database interface-database · interface-database-decorators · interface-database-catalog · interface-mongodb · interface-rethinkdb postgres · mysql · mongodb · rethinkdb
Redis interface-redis · interface-redis-scheduler redis
Email interface-email nodemailer · brevo
File storage interface-file-storage file-storage-local · file-storage-s3
Payments interface-payment · interface-subscriptions · interface-stripe stripe · mollie · checkout-com · payment-subscriptions

License

Apache-2.0

About

The primitives every AntelopeJS interface is built from, including proxies, decorators, module lifecycle events, logging and configuration.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages