npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sincpro/client-framework

v3.4.1

Published

The client side of sincpro_framework, for every platform: Feature and ApplicationService traced and reported by default, applications made of domains, and the typed client generated from a service's contract. No React, no DOM.

Readme

@sincpro/client-framework

The client side of sincpro_framework, for the web, React Native, scripts and tests: the same application layer as the backend — Commands, Features, ApplicationServices and a bounded context that is their bus —, observed the same way, and a typed client generated from a service's contract. No React, no DOM, no platform storage: what a platform must give, it gives through a port.

A bounded context

Laid out as a backend's context (sincpro_mcp_odoo/domains/helpdesk): what its services count on (dependencies.ts), its bases and its instance (framework.ts), and one file per use case.

// domains/sales/infrastructure/dependencies.ts — the backend's DependencyContextType
export interface SalesDependencies {
  prices: PriceList;
  taxRate: number;
}
export function registerDependencies(boundedContext: BoundedContext<SalesDependencies>) {
  boundedContext.addDependency("prices", new PriceList());
  boundedContext.addDependency("taxRate", 0.13);
  return boundedContext;
}

// domains/sales/infrastructure/framework.ts — the bases inherit every dependency, typed
export const { Feature, ApplicationService } = servicesWith<SalesDependencies>();
export const salesBoundedContext = registerDependencies(
  new BoundedContext<SalesDependencies>("sales"),
);

// domains/sales/services/quote/total.feature.ts
export class CommandTotal extends Command<ResponseTotal> {
  constructor(
    readonly sku: string,
    readonly quantity: number,
  ) {
    super();
  }
}

@salesBoundedContext.feature(CommandTotal)
export class Total extends Feature<CommandTotal, ResponseTotal> {
  execute(command: CommandTotal): ResponseTotal {
    this.logger.info("Totalling", { quantity: command.quantity });
    const unit = this.prices.of(command.sku) * (1 + this.taxRate); // declared nowhere else
    return new ResponseTotal(unit * command.quantity);
  }
}

// domains/sales/services/quote/quote.app-service.ts
@salesBoundedContext.appService(CommandQuote)
export class Quote extends ApplicationService<CommandQuote, ResponseTotal> {
  execute(command: CommandQuote): Promise<ResponseTotal> {
    return this.featureBus.execute(new CommandTotal(command.sku, command.quantity));
  }
}

const answer = await salesBoundedContext.execute(new CommandQuote("a1", 3)); // ResponseTotal

A Command names, by its type, the Response it answers: execute infers it, with no second argument (the backend's bus(dto, ResponseType) is accepted too, and checked in TypeScript only). A Response may be a class, a plain object, a page, a primitive or void.

  • Dependencies are the context's, never a service's. servicesWith<SalesDependencies>() gives the bases every dependency typed on this — the backend's class Feature(_Feature, DependencyContextType) —; addDependency supplies them, and reading one never supplied fails. A replacement names what it replaces: addDependency(name, next, { replaces: previous }).
  • The framework names a service when it registers it: the name the registration gives ({ name: "Total" }), else its class, as the code wrote it — a standard decorator hands the name over before any minifier runs —, else the class's name. A production build keeps class names (keep_classnames in Metro's minifier, keepNames in esbuild and Vite) or names each service (Names that survive a minifier). Nothing on the class declares it.
  • One service, N DTOs. feature([CommandX, EventY]) registers one service for each, as the backend's DTORegistration; a DTO still has one service, across both layers, dispatched by its exact class — or, generated, by its identity.
  • A service is a singleton of its generation, one instance whatever the number of DTOs it takes. What belongs to one request goes in the Command or the context, never on this. Use TypeScript private, not #private: a run sees the instance through a view of its own.
  • Generations. The first call (or buildRootBus()) builds one; what is registered later answers from the next call, and a running call keeps its own. fresh() copies the registrations; scoped({ company_id: 2 }) runs with more context and the same instances.
  • Composition. An ApplicationService runs its context's Features through this.featureBus, as children of its own execution; never another ApplicationService. A bounded context injected into another's services (the backend's common_mcp) is bound to the run: what it executes is a child of it.

Registering: a decorator, or a call

The same functions work as standard decorators, as legacy ones (experimentalDecorators), and called: salesBoundedContext.feature(CommandTotal)(Total). No DI library and no reflect-metadata. The tests compile both decorator forms with TypeScript; a bundler's transform (Vite, Metro/Babel) is each application's to configure and test. A service registers itself where it is written; services/index.ts exports each one's Command and Response, as a Python __init__.py names them — whoever uses a Command loads its module, which registers it. An index only exports: never a declaration, never an import for its effect (sincpro-client check).

Names that survive a minifier

A service's name is what its spans, logs and reports say (cursos/LeerCursos), and what its bounded context keys it by; an event handler's is also the consumer a stored queue acknowledges (app/OnCursoCreado). Taken from the class, it is only as stable as the build: a production minifier renames classes, so the same service reads cursos/c5, and two services renamed alike collide — Service name already registered: l — and the application does not start.

A standard decorator hands over the name as written (context.name), and Vite and Metro can keep class names. Next.js can do neither: its compiler lowers standard decorators in a version this package does not read, so an application on Next uses legacy decorators (experimentalDecorators), which hand over no name, and it has no keepNames. There — or anywhere a build renames classes — the registration gives the name, a string literal no minifier touches:

@cursosBoundedContext.feature(CommandLeerCursos, { name: "LeerCursos" })
class LeerCursos extends Feature<CommandLeerCursos, ResponseCursos> { … }

@cursosBoundedContext.appService(CommandInscribir, { name: "Inscribir" })
class Inscribir extends ApplicationService<CommandInscribir, ResponseInscripcion> { … }

@appSubscriber.handler([CursoCreado], { name: "AvisarCursoCreado" })
class AvisarCursoCreado extends EventHandler<CursoCreado> { … }

class CommandLeerCursos extends Command<ResponseCursos> {
  static readonly commandName = "cursos.CommandLeerCursos"; // its identity, likewise
}
  • Precedence: { name }, then a standard decorator's context.name, then the class's name. Without { name } nothing changes, in any of the three forms (standard decorator, legacy decorator, a call).
  • It is a class's name: an identifier (LeerCursos, AñadirCurso) — never cursos/leer or leer cursos —, unique in its bounded context or subscriber, as a class's is; refused where the registration is written otherwise. With replaces, the replacement says the name it replaced.
  • The same in every realm. It is a string in the module, nothing read from the platform: a browser and a server rendering the same modules (SSR, React server components) name the service alike.
  • A Command's identity comes from its class's name too (<context>.<Command>): a Command that must keep it under a minifier — two renamed alike collide as Command identity already registered — declares static commandName. An event's wire name is always declared (eventName).

The tests lower legacy decorators with TypeScript and minify with Vite's own minifier, and read the names back from the spans.

Replacing a service

An application takes the place of a service a module registered, as the backend's replaces=:

@printingBoundedContext.feature(CommandPrint, { replaces: Print })
class PrintOnBixolon extends Print {
  override execute(command: CommandPrint) { … }
}
printingBoundedContext.handlerOf(CommandPrint); // PrintOnBixolon

replaces names the service registered now for each DTO listed, or the registration is refused — all of them or none. The next call answers with the new one; its spans say which it replaced (sincpro.replaces). A dependency is replaced the same way.

Commands and events: two DTOs that travel differently

| | A Command | An event | | -------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | | Is | a request to one bus | a fact N buses hear | | Known on the wire by | its identity, <context>.<Command> — given by the bounded context that registers it (the backend's registered_name) | its wire name, static eventName = "billing.invoice.v1.issued" — required, dotted | | Travels as | CloudEvents 1.0, type = its identity | CloudEvents 1.0, type = its name; data repeats name | | Written / read with | commandMessageOf(command, cause?) / commandFrom(type, data) | eventMessageOf(event, envelope) / eventFrom(type, data) |

Both travel as the backend writes them on every queue — CloudEvents 1.0: id, source, type, time, correlationid, causationid, traceparent, and the DTO's JSON as data —; what differs is the route. readMessage reads one structured, or in a broker's binary mode (the attributes as ce_, ce- or cloudEvents: headers, the type falling back to sincpro-event), as the backend's Envelope.of. A delivered message continues its flow and its trace: the run's span is a child of its traceparent. An event's name is declared — the contract other processes read, with its version; a Command's identity is the framework's, the one a generated contract's operations carry (static commandName fixes another). A value that is not JSON (Money, Decimal, a day) comes back as such through the class's static fromJSON.

class InvoiceIssued extends DomainEvent {
  static readonly eventName = "billing.invoice.v1.issued";
  static fromJSON(values: {
    invoice_id: string;
    total: { amount: string; currency: string };
  }) {
    return new InvoiceIssued(
      values.invoice_id,
      new Money(values.total.amount, values.total.currency),
    );
  }
  constructor(
    readonly invoice_id: string,
    readonly total: Money,
  ) {
    super();
  }
}

event.name reads eventName; name is reserved, and a subclass cannot make it a field.

What the generator writes is recognized on the bus

A contract's Commands and events are generated as types and data, never classes. The bus takes their entries — operations.X (an identity), events.X (a wire name) — as what a service is registered for, and executes them as data:

import { events, operations } from "../adapters/generated/client";
import type * as remote from "../domain/generated";

@projectBoundedContext.feature([events.IssueClosed, operations.CommandArchiveIssue])
class Archive extends Feature<remote.IssueClosed | RemoteCommand<remote.CommandArchiveIssue>, void> {
  execute(input: remote.IssueClosed | RemoteCommand<remote.CommandArchiveIssue>) { … }
}

await projectBoundedContext.execute(issueClosed); // the event's data: its `name` says which
await projectBoundedContext.execute(commandOf(operations.CommandArchiveIssue, { issue_id }));

commandOf tags the input with the operation's identity — never serialized with its data.

Domain events

An event reaches a use case registered for it — the backend's @accounting.feature(InvoiceIssued), when the event is that use case's input — or an event handler, the entrypoint that translates it into Commands (see the Subscriber below). Several bounded contexts may register it; each consumer gets it once.

@accountingBoundedContext.feature(InvoiceIssued)
class Book extends Feature<InvoiceIssued, void> { … }

@billingBoundedContext.feature([CommandIssueInvoice, OrderPaid]) // a screen, or the event
class IssueInvoice extends Feature<CommandIssueInvoice | OrderPaid, ResponseInvoice> { … }

A use case of an event runs through the same pipeline (span <context>/<Service> with sincpro.event, log lines, error handlers, report). An ApplicationService may take the event and compose Features; execute(event) answers whatever its use case returns (unknown).

The Subscriber: the queue's entrypoint, composite

One per queue — the backend's Subscriber(*buses) and QueueGateway, never one per handler. It pulls what the queue delivers, rebuilds it (an event by its name, a Command by its identity) and hands it to every consumer subscribed to it. An event has three kinds of consumers, all registered the same way, with or without a decorator:

| Consumer | Registered with | It finds on this | Acknowledged as | | -------------------------------- | -------------------------------------------- | ------------------------------------------------ | --------------------- | | a use case of a bus | @salesBoundedContext.feature([Cmd, Evt]) | the bus's dependencies | sales | | an event handler of a bus | @salesBoundedContext.handler([EvtA, EvtB]) | the bus's dependencies and this.boundedContext | sales/OnSaleChanged | | an event handler of a subscriber | @appSubscriber.handler([EvtA]) | the subscriber's dependencies | app/NotifySalePaid |

// entrypoints/queue/framework.ts — once, like a bounded context's framework.ts
export const { EventHandler } = handlersWith<AppSubscriberDependencies>();
export const appSubscriber = new Subscriber<AppSubscriberDependencies>("app", {
  commands: [CommandIssueInvoice], // consumed from the queue: only when declared
});
appSubscriber.addDependency("invoicingBoundedContext", invoicingBoundedContext); // to call it
appSubscriber.addDependency("notifier", notifier);
appSubscriber.addBus(salesBoundedContext); // to deliver to its use cases and handlers

// entrypoints/queue/sale_paid.handler.ts — events → handler; it decides nothing
@appSubscriber.handler([SalePaid, SaleCancelled])
export class NotifySaleChanged extends EventHandler<SalePaid | SaleCancelled> {
  async handle(event: SalePaid | SaleCancelled) {
    await this.invoicingBoundedContext.execute(new CommandIssueInvoice(event.saleId));
  }
}
appSubscriber.handler([InvoiceVoided])(OnInvoiceVoided); // the same, without a decorator

// entrypoints/queue/sale_paid.handler.ts of the sales context — a handler of the bus, an entrypoint
export const { Feature, ApplicationService, EventHandler } =
  servicesWith<SalesDependencies>();
@salesBoundedContext.handler([SalePaid])
export class OnSalePaid extends EventHandler<SalePaid> {
  async handle(event: SalePaid) {
    await this.boundedContext.execute(new CommandCloseSale(event.saleId)); // its own bus
  }
}

const queue = storedQueue({ store, subscriber: appSubscriber });
await appSubscriber.receive(message); // CloudEvents, structured or { headers, body }
  • Two levels, never mixed. addDependency("x", value) is what its handlers find on this — a bus they call is a dependency like any other —; addBus(bus), with no name to write (the bus's own namespace), is a bus it delivers to. The same bus added again changes nothing; another bus of the same name is delivered to as well, under its own key (sales#2).
  • An event reaches every consumer subscribed to it — the subscriber's handlers, then each bus in the order added (its use case, then its handlers); one that fails does not stop the others, and each is acknowledged under its key — which a stored queue keeps, so a redelivery runs only the ones that do not have it yet.
  • A handler runs in the pipeline of a use case, in its own layer (event_handler): its span <owner>/<Handler>, this.logger, this.execution.causationId (the message's id), and what it executes is its child. <owner>/<Handler> is the key a stored queue keeps: a build that renames classes names it (handler([SalePaid], { name: "OnSalePaid" })). A handler takes N events: its type is their union, and TypeScript checks it accepts every event listed.
  • A Command is executed by the one bounded context that registered it, continuing the message's flow — only when declared (commands). A bus never hands all its Commands to whoever can publish on a queue: an undeclared one fails CommandNotConsumed (permission_denied).
  • new Subscriber(...boundedContexts) and new Subscriber({ boundedContexts, events, commands }) still build one that delivers to those buses only.

Publishing

const queue = syncQueue(new Subscriber(mailBoundedContext, stockBoundedContext)); // or storedQueue
shopBoundedContext.addDependency("publisher", new Publisher(queue));

@shopBoundedContext.feature(CommandPay)
class Pay extends Feature<CommandPay, string> {
  async execute(command: CommandPay) {
    await this.publisher.publish(new OrderPaid(command.order_id)); // its Envelope
    return command.order_id;
  }
}

The Publisher is bound to the run that holds it, so the event joins that run's flow: its envelope carries the run's correlationId and names the run as its cause, and every use case that hears it continues that flow.

What is defined here, and what each platform plugs behind the ports:

| Piece | Here | The platform's | | ------------------- | -------------------------------------------------------------- | -------------------------------------- | | DomainEvent | the class, its eventName, its messages | — | | Command | its identity (given at registration), its messages | — | | Envelope | name, id, correlationId, causationId, publishedAt | storing it beside the event | | MessageQueue port | syncQueue (in the call); storedQueue (store, then deliver) | a broker's queue, BroadcastChannel | | MessageStore port | memoryMessageStore() | mobile: a SQLite table; web: IndexedDB | | Subscriber | pull, rebuild, deliver to every consumer; Commands declared | where messages come from (a socket) |

Stored messages: events and Commands, one way to carry them, any store

const queue = storedQueue({
  store: sqliteMessageStore(db), // the platform's MessageStore; memoryMessageStore() in a tab or a test
  subscriber: new Subscriber(
    salesBoundedContext,
    stockBoundedContext,
    printingBoundedContext,
  ),
  ready: (stored) => connectivity.online || !needsNetwork(stored.envelope.name),
  policyOf: (stored) => policies[stored.envelope.name], // what its class or the app says
  onSettled: (stored) => activity.show(stored.envelope.name, stored.state),
});
shopBoundedContext.addDependency("publisher", new Publisher(queue));
connectivity.onBack(() => queue.drain()); // and on coming back to the foreground

await publisher.publish(new OrderPaid(order.id)); // a fact: every bounded context that hears it
await publisher.send(new CommandSendMessage(chat, text)); // an intention: the bus that consumes it

publish and send return once the message is stored. Then the queue delivers what waits, in the order stored — the backend's store-and-forward, over whatever store the platform plugs. An event goes to everyone who hears it and does not have it yet; a Command, to the bus that consumes it (named in the subscriber's commands), and its answer is kept. What follows each delivery is its verdict (verdictOf, the backend's queue verdicts), with its policy:

| What happened | Verdict | | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- | | every consumer has it | delivered | | it is not ready (no connection, no session) | waits | | it goes over the network and the other side is not there now (WAITING_KINDS: unavailable, out of quota, an open circuit, sent with no answer) | wait — as long as it takes, until maxAttempts | | a failure every attempt would repeat (PERMANENT_KINDS) | set_aside | | any other failure (a bug, a device that did not answer) | retry while it has retries, else set_aside |

  • Sent once by default (DEFAULT_DELIVERY_POLICY: retries: 0, maxAttempts: Infinity, requiresNetwork: false): a failure is set aside — the dead-letter queue — for a person.
  • A message waiting never holds the line: what is due goes on.
  • Sent again with the same key. A Command's envelope id is its key: its use case sends it as the Idempotency-Key (this.execution.causationId), so one that went out with no answer is sent again and the backend runs it once. A server without keys is verified by the use case.
  • Open for extension. policy and policyOf set the rules per queue and per message; a platform adds its own by wrapping the verdict — verdict: (delivery) => mine(delivery) ?? verdictOf(delivery) —, never by changing the queue.

The port only keeps records — add, next(skip), save — so a SQLite table, IndexedDB or memory carry events the same way, with the same rules.

Three things a platform keeps in mind:

  • At least once. A process that stops after a context executed an event and before the store saved it runs it there again. What must not act twice keys what it does by the message's id — this.execution.causationId in the use case that received it — or by what the event names (the entity's own id).
  • One drainer per store. Two tabs over one IndexedDB claim it first (the Web Locks API).
  • Values come back as JSON. An event that carries a Money, a Decimal or a date declares static fromJSON to read them back as such.

The events a remote service publishes arrive as generated types (DomainEvent in domain/generated/events.ts, a union narrowed by name); a local event is a class, like a local Command.

Extending the pipeline

The flow of a run is the core's — context, chain, span, log lines, outcome, report, handlers —, and an application changes or hears it from outside, as the backend's bus_pipeline:

// control: around the service — look, veto (throw), adjust (same class), or answer
shopBoundedContext.interceptor(CommandPay)(async (command, next, run) => {
  if (!credit.allows(command.customer_id)) throw new NoCredit();
  return next(command);
});
shopBoundedContext.interceptor()((executable, next, run) => next(executable)); // every class

// observation: never changes the answer
shopBoundedContext.onStart((started) => activity.running(started.execution.useCase));
shopBoundedContext.onCompletion(
  (done) => activity.succeeded(done.execution.useCase),
  CommandPay,
);
shopBoundedContext.onFailure((failed) =>
  activity.failed(failed.execution?.useCase, failed.outcome),
);

// composition: a module or plugin wires its pieces in one place
shopBoundedContext.extend(auditing);
  • Interceptors run inside the run, outermost first in the order registered: a veto is the use case's failure — observed, answered by the error handlers. What an interceptor passes on keeps its class (the bus routes by class); run gives it the use case, the execution and its logger. withoutInterceptor(fn) stops one; registered later, it wraps from the next call.
  • Listeners hear each run start and each service that answered, filtered by class when named; a failure is heard once, when it escapes the call after every handler, from where it first failed. One that throws is ignored. Each on… answers how to stop. processListeners.onStart / onCompletion / onFailure hear every bounded context at once — a progress bar, a toast —, after each one's own.
  • extend(fn) is fn(context), said as composition; fresh() copies everything an extension registered.

Errors

As the backend's, a bounded context has three chains of error handlers, run first-registered-first. A handler returns the answer, or throws to hand the error on; the last one's throw reaches the caller:

salesBoundedContext.addFeatureErrorHandler((error) => {
  if (error instanceof PriceNotFound) return new ResponseTotal(0); // the answer
  throw error; // the next handler, or the caller
});
salesBoundedContext.addAppServiceErrorHandler(toBusinessError);
salesBoundedContext.addGlobalErrorHandler(toProblem); // what reaches salesBoundedContext.execute or a scope

salesBoundedContext.expectErrors(QuoteExpired); // the business answering: `refused`, never reported

A failure is observed where it happened, before any handler runs: its span closes with its outcome, its log line is written and, when unexpected, it is reported once. A handler decides the answer, not whether the failure is seen; an answered one adds an error.handled line. A feature handler answers wherever the Feature ran, inside an ApplicationService too; the global chain wraps only execute and scoped(...).execute.

What kind of failure it is

failureOf(error) says what any error is, in the backend's words (FailureKind, NextStep from @sincpro/criteria), whatever raised it:

const failure = failureOf(error);
failure.kind; // "conflict", "unavailable", "domain", "unknown_outcome"…
failure.nextStep; // "refresh_and_retry", "retry_later", "authenticate", "do_not_retry"…
failure.retryable; // may sending it again succeed
failure.retryAfter; // seconds to wait first
failure.permanent; // every attempt fails the same way: set it aside
failure.fault; // the system's problem: reported
failure.aborted; // whoever asked stopped waiting

It reads, in order: an AbortError; what the error declares (failureKind, reason, retryAfter — on itself or as a static of its class, as the backend's errors do); the Problem the server sent, the same over REST, JSON-RPC and gRPC; a REST status. Not every wire is REST: a JSON-RPC or gRPC transport — or another backend's adapter, such as Odoo's — makes errors that declare their kind, with the backend's own tables:

class RpcError extends Error {
  constructor(
    readonly code: number,
    message: string,
  ) {
    super(message);
  }
  get failureKind() {
    return kindOfJsonRpcCode(this.code); // kindOfGrpcCode, kindOfHttpStatus
  }
}

How an error ended a use case follows from it (outcomeOf):

| Outcome | When | Reported | | --------- | -------------------------------------------------------------------------- | -------- | | ok | it answered | — | | refused | the caller's answer: a 4xx, a declared kind (domain…), or expectErrors | no | | aborted | whoever asked stopped waiting: an AbortError, a cancelled run | no | | failed | a fault: a bug, a 5xx, a server nobody reached | yes |

configureProcess({ outcomeOf }) replaces the process-wide rule. reportError(error, where) reports what fails outside a use case — a view, a worker —, with the same rule.

Cancelling a run

const screen = new AbortController();
const answer = salesBoundedContext.execute(new CommandQuote(3), { signal: screen.signal });
screen.abort(); // the run ends `aborted` at once; nothing is reported

Its Features inherit the signal, a service reads it as this.signal, and every request its bound transport or generated client sends is cancelled with it — with nothing passed by hand.

A circuit breaker

const odoo = new CircuitBreaker("odoo", { failures: 5, openFor: 30_000 });
const transport = guardedTransport(rpcTransport, odoo); // every call through the circuit
await odoo.call(() => printer.print(receipt)); // or one call; odoo.wrap(fn) for a function

The backend's CircuitBreaker, in this process's memory. After failures counted failures in a row — the dependency did not answer (unavailable, unknown_outcome, exhausted, internal) — it opens: calls fail at once with CircuitOpen, unavailable with the time left as its retryAfter, so failureOf, a stored queue (which waits that long) and a screen already know what to do. After openFor, one call tries: an answer closes it, a counted failure opens it again. A refusal is an answer and never counts. Put it where the dependency is — the transport, an adapter —, not in each Feature.

Observability

The platform plugs the implementations once, at startup; nothing breaks without them:

import { configureProcess, memoryContexts } from "@sincpro/client-framework";
import { openTelemetryTracer } from "@sincpro/client-framework/opentelemetry";
import { sentryReporter } from "@sincpro/client-framework/sentry";

configureProcess({
  identity: { release: "forge-web:1.4.0" }, // + tenant, when the deployment serves one
  timeZone: { keys: ["timezone"] }, // where a run's zone is read from — the backend's key, the default
  tracer: openTelemetryTracer(provider.getTracer("forge-web")), // the app's provider
  reporter: sentryReporter(client), // the app's Sentry or GlitchTip client
  logger: { mode: production ? "production" : "development" },
  context: memoryContexts(),
});

Every execution opens a span <bounded context>/<Service>; an ApplicationService's Features are its children, on the same trace. Each span, log record and report says who was running, with sincpro_framework's keys: release (<name>:<version>, the backend's APP_RELEASE) and, when there is one, tenant — the run's context's, else the deployment's. processIdentity() gives release, serviceName and serviceVersion (read out of the release with the backend's rules) to a platform's tracer resource and log labels; nothing else of the context is copied. A dependency that says it can be bound — a generated client, or one of the framework's transports (restTransport, restOperations, jsonRpcOperations, guardedTransport; bindableTransport/bindableOperations for a platform's own) — is bound to the run, so each request carries traceparent (and tracestate) and sincpro-context — the backend continues the trace. Nothing is guessed from a method's name: an application's own object (an Odoo client with a call) reaches its use cases as it is. A tracer, reporter or logger that fails is ignored: telling about a use case never changes its answer.

The vendor entries wrap what the application built — they initialize nothing, read no environment and register nothing global. No context manager is needed: the trace reaches the wire through the transport. On the web, leave the backend's origin out of OpenTelemetry's automatic fetch instrumentation (ignoreUrls), or it writes a traceparent of a trace of its own over this one.

One trace from a server render

A run's parent is the run above it, or the message it continues — never what is active in OpenTelemetry's context —, so a use case with neither starts a trace of its own. A server that renders pages (Next.js) keeps a span of its own active while it renders; to have the use cases the render runs start under it — one trace: render → use case → API —, opt in:

import { context } from "@opentelemetry/api";
import { AsyncLocalStorageContextManager } from "@opentelemetry/context-async-hooks";

// once, where the server registers its provider — NodeSDK and @vercel/otel already do this
context.setGlobalContextManager(new AsyncLocalStorageContextManager().enable());

configureProcess({
  tracer: openTelemetryTracer(provider.getTracer("forge-web"), { adoptActiveSpan: true }),
});
  • Only a run with no parent reads the active span. A Feature under its ApplicationService, a bounded context injected into a run, a run continuing a delivered message keep the parent they are given — the active span is never mixed in —, and the framework never makes its own spans active, so two renders at once never take each other's use cases. It is the backend's rule at its root: sincpro_framework's use case is a child of the span active in its process.
  • It reads what the application registered, and registers nothing. On Node that is a context manager: NodeSDK and @vercel/otel register one; a bare TracerProvider does not, and then the application registers AsyncLocalStorageContextManager itself, as above. Without one the active context is the root and the option changes nothing.
  • In a browser it is harmless. With no context manager registered (browserTracer registers none) every root run starts its own trace, as without the option.
  • Off by default. openTelemetryTracer(tracer) behaves as it always has.

A failure's detail: in the trace, or in the error tracker

A failed run's span carries its exception — an exception event with its type, message and stack — and its message as the status. Where errors go to an error tracker with their trace id (GlitchTip, through sentryReporter), keep the detail there:

openTelemetryTracer(provider.getTracer("forge-web"), { recordExceptions: false });

The failed span still says what failed — error.type, sincpro.outcome, sincpro.fault and an ERROR status —, and the error tracker holds the message and the stack under its access rules, not every backend that stores traces: in an ERP a failure's message can name a customer or an amount. OpenTelemetry, too, moves away from exceptions as span events (2026). Default true: a span keeps its exception, as it always has.

Logging

The application layer imports no logger. Two are predefined, for the code around the use cases:

import { logger, loggerAdapter } from "@sincpro/client-framework";

logger.info("Database opened"); // infrastructure — the global logger
loggerAdapter.warn("Printer is slow", { ms: 900 }); // an adapter
salesBoundedContext.logger.info("Catalog preloaded"); // a bounded context, outside a use case
this.logger.info("Totalling"); // inside a Feature or ApplicationService

| Logger | Layer | Each line carries | | ---------------------------- | --------------------- | ---------------------------------------------- | | logger | infrastructure | — | | loggerAdapter | adapter | the run, when injected as a dependency | | salesBoundedContext.logger | bounded_context | its bounded context | | this.logger, Feature | feature | bounded context, use case, execution and trace | | this.logger, AppService | application_service | the same |

this.logger keeps its run across awaits and concurrent calls, without a global stack. An adapter that imports loggerAdapter at module level writes without the run; inject it (salesBoundedContext.addDependency("log", loggerAdapter)) or pass this.logger when a line must carry it.

One configuration, two doors — configureProcess({ logger }) replaces every process port, configureLogger(...) only logging (an in-app debug switch):

configureLogger({ mode: "development", level: "info", layers: { adapter: false } }); // the console
configureLogger({ mode: "production" }); // the console, silent
configureLogger({ engine: combineLoggers(consoleLogger({ mode }), lokiLogger) }); // other sinks
configureLogger({ engine: false }); // no logs

// Which INFO and DEBUG lines speak — by level, layer and bounded context; WARN and ERROR always.
// Spans are never filtered: a quiet line still has its span.
const production = {
  level: "info",
  layers: { adapter: false },
  boundedContexts: { common: false },
};
configureLogger({
  engine: filteredLogger(combineLoggers(consoleSink, lokiSink), () =>
    debugging ? {} : production,
  ),
});

The console is the default engine. In production it is silent; in development it prints everything, and level and layers hide only INFO/DEBUG. A supplied engine owns its own policy, and each sink of combineLoggers keeps its own — the console's silence never silences another. Every execution writes execution.started (DEBUG) and execution.finished with its outcome and duration (INFO, also when refused or aborted; ERROR when failed). No line carries a DTO, a result, an error body or the session's context unless the author writes it. Delivery, buffering and credentials (Loki, a phone's queue) are the platform's.

In development each record is one line for a person — time, level, layer, use case, message, its attributes as key=value, and the run's short id — never the record object after it:

10:20:30.045 DEBUG [feature] ▶ shop.Pay #0193a1
10:20:30.051 INFO  [feature] shop.Pay Paying order=A-1 note="two words" #0193a1
10:20:30.057 INFO  [feature] ✔ shop.Pay 12ms #0193a1
10:20:31.002 INFO  [feature] ✖ shop.Pay refused: domain 3ms #0193b7
10:20:32.118 ERROR [feature] ✖ shop.Pay TypeError: card is undefined 4ms #0193c2   + the Error, with its stack

An unexpected failure also prints its Error, so LogBox, Expo's terminal and a browser show its code frame. consoleLogger({ mode, colors }) colors the lines of the levels named (true: every one) with ANSI codes: the platform knows where its console renders them — a terminal does, React Native's LogBox (WARN and ERROR in the app) does not. prettyLine(record) is the same line, for a sink of one's own.

Context

The values every use case runs with — the tenant, the company —, in levels: the process's, the bounded context's, a scope's. A root execution reads them once; its Features inherit that snapshot, and what travels goes to the server in sincpro-context.

processContext.set({ tenant_id: "acme" });
salesBoundedContext.context.set({ warehouse_id: 4 });
await salesBoundedContext.scoped({ company_id: 2 }).execute(new CommandQuote(1));

Where the values live is a port (ContextStore): synchronous reads, a version per change and an optional watch. memoryContexts() is the default; a browser, a phone or a server render plugs its own. values is the same object until it changes, so a screen can hand it to React's useSyncExternalStore.

The time zone of a run

A run reads days and times in the zone its context says, not in the device's: a user in La Paz looking at a company in Madrid sees «today» as Madrid's. The zone is the context's timezone — the key sincpro_framework reads to cut today and period —; with none, the process's zone (installTimeZone, else the platform's).

await salesBoundedContext.scoped({ timezone: "Europe/Madrid" }).execute(new CommandQuote(1));

const zone = timeZoneOf(this.execution); // or timeZoneOf(context)
dayOf(instant, zone); // «today» for that company

The context travels to the server in sincpro-context, so under timezone the backend cuts days the same way. An application that keeps the zone under another key names it — configureProcess({ timeZone: { keys: ["company_zone", "timezone"] } }), the first found wins —, but the backend reads only timezone: a zone under another key is the client's alone, and the server cuts in UTC.

Talking to a server

A remote service is reached through a port. The generated client never names a wire: it says which operation, with what input, and the adapter the application injects decides how it travels.

import { clientOf } from "./adapters/generated/client";

// pick the wire; the client, the Features and the tests stay the same
const forge = clientOf(restOperations(restTransport({ base: "/v1", headers: session })));
// or clientOf(jsonRpcOperations({ endpoint: "/rpc", headers: session }))
// or clientOf(grpcOperations(channel)) — a platform's adapter, the same port

await forge.issue.send({ issue_id: "acme-3", message: "hola" }); // ResponseSendIssue
await forge.project.list({ criteria }); // a group per entity; the context's own at the top

The generated file holds no method: operations is the contract as typed data (operation<CommandSendIssue, ResponseSendIssue>({…})), api groups them by the entity they work on — named by the operation without the entity's name, CommandSendIssue → issue.send —, and apiOf implements that description. A method is changed where the client is made, keeping its signature; the original carries the run like any other call:

const forge = clientOf(transport, {
  issue: { get: (original) => (input, options) => kept(input) ?? original(input, options) },
});

| Piece | What it does | | --------------------------------- | ---------------------------------------------------------------------------------------- | | OperationTransport port | call(operation, input, options): an operation by who it is, over any wire | | apiOf(description, transport) | a description of operations, implemented: each a typed method; overrides replace one | | restOperations(transport) | over REST: the path from the input, a Query's and a DELETE's query, a Command's body | | jsonRpcOperations({ endpoint }) | over JSON-RPC 2.0: one POST, the operation's method, its input as named params | | restTransport({ base }) | REST over fetch: Idempotency-Key, the server's Problem, model versions, Parquet | | memoryTransport(tables) | the same REST server in memory, copying by the wire's rules — for tests and demos | | assignableValues(route, values) | an Edit's values as the server reads them, for a memory handle | | entity(key, operations) | an index over a model's operations by role, and its Commands — a generated entities.ts | | readPage(t, entity, criteria) | a page of an entity through its search, grouped or not, over any wire | | readRecord(t, entity, id) | one record through its get, with the caller's draft when the entity keeps them | | retryKeys() | one Idempotency-Key per gesture, kept while a retry may repeat it | | guardedTransport(t, breaker) | every call of a transport through a circuit breaker | | screensOperations(transport) | every operation a screen calls runs as a use case of screens: traced and reported | | markedAs(wrapper, inner) | a wrapper of the screens' operations keeps their mark: one screens context, not two | | parquetDecoder (./parquet) | large pages read as Parquet through the same transport |

Inside a Feature, inject the generated client as it is: the run binds it, so every call carries its trace (traceparent), its context (sincpro-context) and its signal — as headers over HTTP, as metadata where a platform's adapter puts them.

A screen reads and writes through the same operations, never through a route. An entity is an index over them — which is its search, its get, its edit, its trash, its history, its export, and its Commands by name — read off the contract by the generator, so an entity exists over JSON-RPC as over REST. readPage asks its search with the criteria as plain JSON (REST writes it in ?criteria=, JSON-RPC as its params) and reads the answer as pageFrom reads any page; readRecord asks its get with the id in the field the operation names, and reads the one field of its own beside the envelope (recordOf). The definition of the model is the contract's (metasOf) or one a platform keeps, given as meta: an answer says only its version.

const operations = screensOperations(restOperations(restTransport({ base: "/v1" })), "web");
const page = await readPage(operations, issues, criteria<Issue>().limit(20), { meta });
const { record, draft } = await readRecord(operations, projects, "acme");
await operations.call(
  issues.operations.commands.send,
  targeted(issues, send, "acme-3", { message }),
);

An edit — the backend's Edit, role edit — creates a record under the key its caller names. Its generated method mints one when the input names none (newEntityId, a UUID v7, as the server would), so forge.project.edit({ values, action: "save" }) creates a project over any wire, REST's PUT /projects/{id}/edit included. A screen that keeps a draft of a new record names its key once, so every save of the draft reaches the same record. A Command that answers nothing — a DELETE's 204 — resolves null, never undefined, over REST and in memory alike.

A DELETE — the backend's Delete, role delete, an entity's delete — is read from its URL, never from a body. restTransport sends its fields in the query string, as the server decodes them (plain values as text, anything else as JSON): DELETE /projects/acme?dry_run=true answers the Preview of what would go, and origin_version refuses a delete of a record that moved on. Sent in a body they are dropped, and a rehearsal would run the real delete.

A trash — the backend's Archive, Restore and Purge, roles archive, restore and purge — is three more operations of an entity: archive and restore by the record's key, purge over the whole collection (older_than, a duration as the contract writes it: "P30D"). Each answers nothing — null — or, with dry_run: true, the Preview of what it would do; a purge's says how many would go (data: { count }). The trash itself is the entity's list asked for what is archived (archived_at not null), which every other reading leaves out.

Which of the ways a screen reaches the backend fits a call — an entity's screens, the generated client over the screens' operations, or a Command and its Feature — is in docs/WEB.md.

A wrapper over the screens' operations — a cache, a guard — keeps their mark, so the screens are not made twice: guardedTransport does it, and a platform's own wrapper calls markedAs(wrapper, inner). One span then answers each screen call, whether the wrapper answered it from its own memory or not.

What a write changed

A client keeps what it read — a cache, a list on screen, a record — and every one of them goes stale when a write lands, whoever wrote it. So every write says so: restOperations and jsonRpcOperations announce each Command on the process's change feed (processChanges), whether it came from a screen or from a use case's generated client, answered or refused. A Query, a preview and a dry run announce nothing. A change is said in the contract's words — the operation, its entities, the keys of the records it named —, the same over every wire. A reader follows the feed, never the writer's transport:

import { processChanges } from "@sincpro/client-framework";

// { operation: "shop.CommandPayOrder", entities: ["Order"], keys: { Order: ["O-7"] } }
const stop = processChanges.follow((change) => forget(change.entities, change.keys));
stop();

What a change touches is each reader's to decide: the records it named, or every reading of an entity when it named none (a Command that creates). An adapter given changes announces there instead (a test, one that must not be heard), and a platform's own adapter (gRPC) wraps its call in announced(feed, operation, input, call).

Sending a file

A file never travels inside a Command — sincpro_framework takes none (#364). A Command asks the backend for an upload id, the file's bytes go to it, and the next Command names the id: the same request whether the bytes land on the service (PUT /files/uploads/{id}) or on a bucket's presigned URL. uploadTo sends them raw — never a form, never base64 — with the progress a screen draws and the signal that cancels it:

import { uploadTo } from "@sincpro/client-framework";

const kept = await uploadTo(transport, `/files/uploads/${id}`, file, signal, {
  onProgress: ({ loaded, total }) => setProgress(loaded / total),
}); // { key, size, content_type } — null from a bucket

restTransport sends it over XMLHttpRequest where the platform has one (a browser, React Native), the only way to watch a body leave, and over fetch elsewhere, telling the progress once at the end. A link that is a path is the service's, at the origin of base, and gets its headers — the token, the trace —; a full URL of another origin (a bucket) gets none of them. Inside a use case the bound transport carries the run's trace and signal, as every other call.

A refusal is a TransportError whose problem says why by reason: FILE_TOO_LARGE (413, max_bytes), FILE_TYPE_NOT_ALLOWED (422, allowed, found), FILE_EMPTY (422), PUBLICATION_EXPIRED / PUBLICATION_USED_UP (410: ask for a new id), PUBLICATION_FORGED / PUBLICATION_WRONG_ACCESS (403), PUBLICATION_UNKNOWN (404). What a file may be is read from problem.extensions, never written in a screen.

Acting on many records

What a person chose — or a script found — is a Selection: a value, plain data, never a store. THESE records by their keys (chosen(keys)), or EVERY ONE a question matches but some (allMatching(question, total), then toggled unticks one). criteriaOf is the one question that asks for exactly them; keysOf reads their keys when someone needs them, as one page of references, and refuses past a ceiling (SelectionTooLarge) instead of answering a part.

const recipients = toggled(
  allMatching({ field: "company", operator: "=", value: "SINCPRO" }, 37),
  "C-9",
);
sizeOf(recipients); // 36
const keys = await keysOf(recipients, {
  transport: operations,
  entity: contacts,
  identity: "id",
  limit: 200,
});

runBatch is for rec in self: — a step once per item, one outcome per item, a failure that item's and never the batch's. The step is any work for one item; through a bounded context each item is its own use case (span, context, error handling):

const result = await runBatch(
  keys,
  (key, { signal }) =>
    billingBoundedContext.execute(new CommandConfirmInvoice(key), { signal }),
  {
    concurrency: 1,
    signal,
    onOutcome: (outcome, { settled, total }) => progress(settled, total),
  },
);
result.outcomes; // [done F-1, failed F-7 (conflict: ALREADY_CANCELLED), done F-9]

In order by default; concurrency runs more at once, the outcomes still in the items' order. stopOnFailure starts nothing after a failure; a cancelled batch skips what had not started and hands its signal to what runs. BatchResult is sincpro_framework's (#185, «per index, the answer or the problem»): a batch the server runs at once, when the backend has one, answers the same.

Writing an adapter for another wire

An adapter is one function: read the operation's binding for its wire, send the input, answer the answer, and fail with errors failureOf reads.

function grpcOperations(channel: Channel): OperationTransport {
  return {
    async call(operation, input, options) {
      const method = operation.grpc?.method;
      if (!method) throw new OperationNotPublished(operation.identity, "gRPC");
      try {
        return await channel.unary(method, input, {
          metadata: options?.headers, // traceparent, sincpro-context
          signal: options?.signal,
        });
      } catch (error) {
        const code = (error as { code: number }).code;
        throw Object.assign(error as Error, { failureKind: kindOfGrpcCode(code) });
      }
    },
  };
}

Every operation in operations carries its identity and each wire's binding (rest, rpc, grpc, mcp); an operation the adapter's wire does not publish is OperationNotPublished (not_found), never guessed.

Generated code

python -m sincpro_framework.entrypoints export-client-contract app.http:gateways contracts [--events]
sincpro-client generate contracts/project.contract.json --out src/domains/project --domain project
sincpro-client scaffold contracts/project.contract.json --out src/domains/project
sincpro-client check --root src

generate writes, from the contract the backend exports — never edited, written again whole —, each file in the layer it belongs to, under the bounded context's folder (--out):

| File | What | | -------------------------------- | ------------------------------------------------------------------------------------------------ | | domain/generated/models.ts | the entities and value objects: a type per model, and the definitions they hold | | domain/generated/commands.ts | every operation's Command and Response, and the <Name>Input a caller sends | | domain/generated/events.ts | the domain events and DomainEvent, their union — when the contract carries them | | domain/generated/index.ts | the three, re-exported: import type * as remote from "../domain/generated" | | adapters/generated/client.ts | operations (typed data), api (by entity), Api, clientOf(transport, overrides?), events | | adapters/generated/entities.ts | each entity's operations by role — search, get, edit, trash, export, history — and its Commands |

The backend keeps them apart — the domain's words, the application layer's DTOs, the facts, the adapters to another system —, and so does the application: each beside its own code of that layer. A shared definition goes with the first kind that names it (the models, then the operations, then the events), and a file that names one written elsewhere imports it from there.

Each method takes the operation's input and answers its answer, as commands.ts types them — a search answers its Response… with its records and cursor, as the backend's callers get it, on every wire. scaffold writes, once, the application's own files: its dependencies (the client over the operations the application exports — --operations <module> —), its framework.ts (the service bases with every dependency typed, and the instance), services/index.ts and entrypoints/index.ts — the context's door. check enforces the application's layers, the bounded-context boundaries (a context is entered by its entrypoints/ only; its root holds no file) and that an index only exports.

Domain events, on demand. A backend leaves its events out of the contract unless it is exported with --events. Then each event is a type as it is received — every field present, name its wire name as a literal — and DomainEvent, their union, narrows by name:

import type * as remote from "./domain/generated";

function subjectOf(event: remote.DomainEvent): string {
  switch (event.name) {
    case "project.issue.v1.closed":
      return event.issue_id; // remote.IssueClosed
    // …
  }
}

events in adapters/generated/client.ts says, per event, its wire name and whether the bounded context records it (its aggregates' own) or handles it (a Feature subscribes).

The words of each event's fields are in the contract too (sincpro_framework 3.37.1 or later): eventMetasOf(contract) reads the snapshot (domain/generated/contract.json) into one definition per event, by its wire name, as metasOf does for the entities. What one occurrence says — what happened, the record, who — travels in the event itself (label, entity_display, actor).

const metas = eventMetasOf(contract);
labelOf(metas["project.issue.v1.closed"], "reason", "es"); // "Motivo"

Types, not classes

What is generated is the remote service's contract and an adapter over it, so it is written as types; the application's own Commands are classes, written by hand.

  • The wire is JSON, and a type says it exactly. A decimal is text, a day is text, a page is { items, count, cursor }. A class around that JSON would claim more than it holds unless every field had a reader; a type claims nothing it does not hold.
  • The local bus routes by class, and the remote contract must not reach it. A generated class extending Command could be registered and executed locally — the confusion between a remote operation and a local use case this package keeps apart. A remote call happens inside a local Feature, through the injected client.
  • Events read best as a union. A stream of facts — a queue, a history page — is narrowed by name, with no registry of constructors to rebuild each one.
  • Nothing runs. domain/generated/ adds no byte to a bundle and no side effect; a contract of three hundred models costs nothing at runtime.

A local class takes the contract's shape and stays checked against it:

import type * as remote from "../domain/generated";

class CommandCancelIssue
  extends Command<ResponseCancelIssue>
  implements remote.CommandCancelIssue
{
  constructor(readonly issue_id: string) {
    super();
  }
}

The generated name and the local one may be the same — the backend's —, so the generated ones are imported under their own (remote). Validating and converting what arrives (a decimal into Decimal) is a reader's job, not a class's: generated readers are the next step, when a use needs them.

Values on the wire

| Value | Travels as | API | | ---------- | -------------------------------------- | ---------------------------------------------- | | Decimal | exact text, "10.50" | Decimal | | Money | { amount: "10.50", currency: "BOB" } | Money | | Day | "2026-10-02", never an instant | isDay, dayOf | | Instant | ISO text | wallTimeOf, instantOf, timeZoneOf | | ID | UUID v7 as 32 hex | newEntityId, isEntityId, momentOf | | Entity ref | "billing.Invoice:0192…" | EntityRef, parseEntityRef, entityRefOf | | Bytes | { "$bytes": "<base64>" } | valuesOf, readValues | | Collection | items, count and cursor | collectionOf, isPartial, relatedCriteria | | Export | Parquet, Arrow or JSON Lines | an entity's export (streamed), Download | | Upload | raw bytes to an upload id, never JSON | uploadTo |

Decimal and Money compute exactly, on BigInt; a decimal never becomes a number and a day never a Date. valuesOf/pack write; readValues reads tagged values back; rebuilt/unpack use a reader given explicitly. Cycles, functions and non-finite numbers are refused. How a value is shown, typed or stored is the platform's.

An entity ref — the backend's EntityRef — names a record of any bounded context by one text, bounded_context.Entity:key: what a payment's metadata, a webhook or a notification carries to say which record it is about. It is a text on the wire, so it is a text here, typed by its form: the generator types a field published as format: "entity-ref" as EntityRef, parseEntityRef reads one (refusing what the backend refuses), isEntityRef checks a string read from outside, and entityRefOf({ boundedContext, entity, key }) writes one. Resolving it is the backend's Resolve — GET …/refs?refs=[…] — a generated operation of whichever bounded context publishes it, never a route of this package.

An application's layout

An application is laid out as a sincpro_framework service is — the entrypoints call the bus, the bus runs the use cases, the use cases use the adapters:

src/
  entrypoints/main.ts(x)               configureProcess, the stored queue
  entrypoints/queue/                   the Subscriber (framework.ts) and its event handlers
  domains/
    common/infrastructure/operations.ts  export const operations — the wire every client uses
    <bounded context>/
      domain/                          local Commands, Responses, DomainEvents, value rules
        generated/                       sincpro-client generate: models, commands, events — never edited
      adapters/                        repositories, printers, other systems
        generated/                       sincpro-client generate: the client and the entities
      services/                        the use cases, one folder per aggregate or entity
        <aggregate>/                     sale_order/: its Features and ApplicationServices
          confirm-quotation.feature.ts
          <entity of the aggregate>/     payments/: a related entity with use cases of its own
            register-payment.feature.ts
            reconcile-payments.app-service.ts
        index.ts                         exports each use case's Command and Response
      infrastructure/
        dependencies.ts                  <Context>Dependencies and registerDependencies
        framework.ts                     servicesWith<…>() bases, and <context>BoundedContext
      entrypoints/                     the only way in: they translate, they decide nothing
        index.ts                         the door: <context>BoundedContext and its Commands — exports only
        react.ts                         web: what other contexts and faces embed — exports only
        <face>/                          web: what one face (admin, sitio, portal) draws — its main components
        queue/                           the bus's event handlers: event → Command → bus
        cron/                            mobile only — its scheduler: tick → Command → bus
  • Services by aggregate. A simple entity is one folder with its Features (a CRUD). When an aggregate holds related entities with use cases of their own — the payments of a sale order —, they get a folder inside it, and its Features and ApplicationServices live there, grouped by what they are about.
  • Entrypoints translate. A screen and a cron build a Command and execute it; what a queue carries goes through the one Subscriber (entrypoints/main.ts). A workflow of several use cases is an ApplicationService. sincpro-client check refuses a service that imports an entrypoint.
  • A cron is a platform's door, and only where the platform has a scheduler. A phone wakes a closed app on a schedule (mobile's CronWorker); a browser does not — Periodic Background Sync is Chromium-only, for an installed PWA, and the browser decides when. On the web, refreshing what a screen shows is the screen's (a query's refetch interval), not a cron, and work on a schedule is the backend's (Crons). This package has no cron: the day web needs one, its registry and a Scheduler port come here.
  • A bounded context is named for what it is: `salesBoundedConte