Rayfin

rayfin functions

rayfin functions init scaffolds a serverless TypeScript Functions project under rayfin/functions/ that shares entity types with your Rayfin data model.

Note

The rayfin functions command group and rayfin up functions deploy are only registered when services.functions.enabled: true in rayfin.yml (or RAYFIN_FEATURE_FLAGS includes functions).

rayfin functions scaffolds and maintains a serverless Functions project that shares entity types with your data model.

functions init

npx rayfin functions init [directory]

Scaffolds rayfin/functions/ with:

  • package.json and tsconfig.json (wired as a TypeScript project reference to the parent rayfin/ project, so Functions code can import type entity types directly from rayfin/data/)
  • host.json and local.settings.json
  • src/function_app.ts and src/types.ts
  • .vscode/settings.json and .vscode/launch.json (a Node debugger attach config)
  • .gitignore (excludes host.json, local.settings.json, and build output)

On a fresh scaffold, it also enables services.functions.enabled: true in rayfin.yml. On every run — fresh scaffold or not — it installs dependencies, builds, and regenerates rayfin/functions/src/types.ts from your function source files. Regeneration is a one-shot pass, not a background watcher; re-run functions init (without --force) any time you want to refresh types.ts without touching your scaffolded code.

FlagDescription
--forceOverwrite an existing rayfin/functions/ scaffold. Without it, an existing scaffold is left untouched and the command only reinstalls dependencies, rebuilds, and regenerates types.ts.

Note

Scaffolding installs @microsoft/fabric-user-data-functions from the npm registry, so functions init requires network access.

Deploying

rayfin up functions deploy (experimental) builds, packages, and deploys Functions to the remote Rayfin item. A plain rayfin up also deploys Functions automatically when the service is enabled.

PromptScaffold a Functions project
Enable Functions in my Rayfin project (set services.functions.enabled: true if not already), then run `npx rayfin functions init` to scaffold rayfin/functions/. Show me the generated src/function_app.ts and explain how to add a new HTTP-triggered function that reads from one of my existing entities.
Something wrong on this page?Report an issueEdit this page

On this page