// showcase's provisioner — how a consumer is given an instance of what this module provides. // // **A provider ships the provisioner that creates instances of the resource it offers** (ADR // 0040). The mesh asks; this adapts that request to whatever the software actually needs, and // hands back what the consumer is given. import { provisioner } from "@novox/mesh-sdk/provisioner"; await provisioner({ provision: "greeting", async create({ consumer }: { consumer: string }) { // A real provider would create something here — a database, a vhost, an account. This one has // nothing to create, so it returns what a consumer is told, which is the half that matters: // the mesh seals it and delivers it, and the consumer never sees this code. return { serves: { greeting: `hello ${consumer}` } }; }, async remove() { // Removal is not optional. A provider that cannot take an instance back leaves the mesh unable // to unassign a consumer without leaking whatever it was given. }, });