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.
InterfaceFunctiondeclares a contract function.ImplementInterfaceattaches a module's implementation to it, typed byInterfaceToImpl. Calls made before the implementation attaches wait in a queue.AsyncProxy,EventProxyandRegisteringProxycarry calls, events and registrations between modules, and detach when a module unloads.@antelopejs/interface-core/decoratorsbuilds typed class, method, property and parameter decorators.@antelopejs/interface-core/modulesexposes lifecycle events and module management functions.@antelopejs/interface-core/loggingwrites structured logs on named channels.@antelopejs/interface-core/configprovidesdefineConfigforantelope.config.ts.
| Module | Notes |
|---|---|
@antelopejs/core |
The AntelopeJS runtime and ajs CLI implement this interface |
Add the package to every module that declares or implements an interface:
pnpm add @antelopejs/interface-coreYou need no extra module, because @antelopejs/core provides the implementation.
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.
- Introduction
- Proxies, attachment leases and errors
- Decorators
- Metadata
- Modules
- Logging
- Configuration
- Runtime
@antelopejs/core implements this package. Each core release declares the @antelopejs/interface-core range it works with in the dependencies of its package.json.
Read CONTRIBUTING.md before you open a pull request. The local checks are:
pnpm install
pnpm lint
pnpm testAntelopeJS 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 |
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 |