Adapters
Azure Functions
Azure Functions v4 invokes an HTTP-triggered function with a Web-standard HttpRequest and expects an HttpResponseInit back. @stone-js/azure-functions-http-adapter maps that request to an intention, runs your kernel, and builds the response object the host writes, so your routes run on Azure Functions unchanged.
#Install
npm i @stone-js/azure-functions-http-adapter#Enable it
Add the decorator (or the blueprint) to the manifest. Because Azure v4 is Web-standard, the request normalization is the same one the Fetch adapter uses; only the response differs (an HttpResponseInit object rather than a Response).
import { StoneApp } from '@stone-js/core'
import { Routing } from '@stone-js/router'
import { AzureFunctionsHttp } from '@stone-js/azure-functions-http-adapter'
@AzureFunctionsHttp() // Azure Functions v4 HTTP trigger
@Routing()
@StoneApp({ name: 'tasks' })
export class Application {}import { defineStoneApp } from '@stone-js/core'
import { routerBlueprint } from '@stone-js/router'
import { azureFunctionsHttpAdapterBlueprint } from '@stone-js/azure-functions-http-adapter'
export const App = defineStoneApp(
{ name: 'tasks' },
[routerBlueprint, azureFunctionsHttpAdapterBlueprint]
)#Register the handler
run() returns the handler you register with @azure/functions. Use a catch-all route so the universal router owns matching.
import { app } from '@azure/functions'
app.http('stone', {
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
authLevel: 'anonymous',
route: '{*path}',
handler: await stoneApp.run()
})#Generic (non-HTTP) triggers
For triggers that are not HTTP, a Queue Storage or Service Bus message, an Event Grid or Event Hub event, a Timer or a Blob, use the generic @stone-js/azure-functions-adapter with @AzureFunctions(). The host invokes your function with a trigger input and an InvocationContext; the adapter normalizes it into an intention whose metadata carries the trigger payload and context.triggerMetadata, so one handler can dispatch on the trigger.
import { AzureFunctions } from '@stone-js/azure-functions-adapter'
@AzureFunctions()
@StoneApp({ name: 'workers' })
export class Application {}Register the returned handler with the matching binding, e.g. app.storageQueue(...) or app.serviceBusQueue(...). On a thrown error the adapter rethrows by default so Azure applies the trigger's retry / poison-queue policy; opt out with stone.adapter.rethrowOnError = false.
#Deploy
Build the function output and deploy with the Azure Functions Core Tools or your IaC of choice. The per-invocation model matches the Continuum's per-event context exactly.
npm run build
func azure functionapp publish <your-app-name>#Which adapter
| Package | Type | Description |
|---|---|---|
| @stone-js/azure-functions-http-adapter | @AzureFunctionsHttp | HTTP-triggered functions (v4 HttpRequest → HttpResponseInit). Use with @Routing. |
| @stone-js/azure-functions-adapter | @AzureFunctions | Generic non-HTTP triggers (Queue Storage, Service Bus, Event Grid, Timer, Blob). |