ay functions (Alias: fns)
Lokale Entwicklung, Deployment und Verwaltung von Custom Functions (FaaS). Sandbox via isolated-vm, 5 Trigger-Types.
Subcommands
| Subcommand | Zweck |
|---|---|
list |
Deployed Functions mit Version, Status, letzter Aufruf |
get <name> |
Function-Details + Code + Config |
create <name> |
Scaffold lokal + Remote-Stub anlegen |
deploy <name> |
Code + Config hochladen, neue Version aktivieren |
invoke <name> |
Ad-hoc-Aufruf mit --data '<json>' |
delete <name> |
Function entfernen |
rollback <name> <version> |
Auf frühere Version zurück |
versions <name> |
Version-History |
logs <name> |
Letzte N Execution-Logs streamen |
Beispiel: Neue Function
ay functions create welcome-mail
# ➜ tooling/functions/welcome-mail/{index.ts, config.yaml}
# Code editieren, dann:
ay functions deploy welcome-mail
ay functions invoke welcome-mail --data '{"consumerId":"..."}'
ay functions logs welcome-mail --follow
Function-Config
# config.yaml
name: welcome-mail
description: Sendet Willkommens-Email an neuen Consumer
trigger:
type: event # oder: cron, webhook, manual, scheduled
topic: consumers.created
runtime: node20
timeout: 10s
memory: 128MB
secrets:
- SMTP_PASSWORD # Credentials-Vault-Key
allowedEntities:
- Consumers
- Emails
Trigger-Types
| Type | Auslöser |
|---|---|
event |
Platform-Event (z.B. orders.paid) |
cron |
Repeatable-Schedule (Cron-Expression) |
webhook |
Externer HTTP-Aufruf |
manual |
Per ay functions invoke |
scheduled |
Einmaliger Zeitpunkt |
Platform-SDK
Inside einer Function steht ay.* zur Verfügung:
export default async function({ event, ay }) {
const consumer = await ay.db('Consumers').findById(event.consumerId);
await ay.email.send({ to: consumer.email, template: 'welcome' });
}
Der SDK ist opt-in-scoped: nur Entities in allowedEntities + mit availableInSDK=true in modelsAndRights.ts sind erreichbar (Stand 2026-04: 26 kuratierte Entries).
Siehe auch
- credentials — Secrets verwalten
- jobs — Function-Queues beobachten