Skip to main content

fraiseql_functions/
lib.rs

1//! FraiseQL serverless functions runtime.
2//!
3//! This crate provides the core infrastructure for executing serverless functions
4//! in FraiseQL, with support for multiple runtimes (WASM, Deno, etc.).
5//!
6//! # Architecture
7//!
8//! - `FunctionRuntime`: Trait for implementing function execution backends
9//! - `WasmRuntime`: WASM component model executor (feature: `runtime-wasm`)
10//! - `DenoRuntime`: JavaScript/TypeScript executor via V8 (feature: `runtime-deno`)
11//! - `FunctionObserver`: Integrates with fraiseql-observers for trigger execution
12
13pub mod host;
14pub mod migrations;
15pub mod observer;
16pub mod outbound;
17pub mod runtime;
18pub mod triggers;
19pub mod types;
20
21/// The `bytes` this crate's public API is built against (#1198).
22pub use bytes;
23/// The `chrono` this crate's public API is built against (#1198).
24pub use chrono;
25pub use host::{HostContext, NoopHostContext};
26pub use observer::FunctionObserver;
27pub use outbound::{
28    EmailTransport, LoginEmailSender, SendContext, SendEmailRequest, SendEmailResponse,
29    SendPolicyError, SenderIdentity, SenderIdentityResolver, resolve_sender_identity,
30};
31/// The `reqwest` this crate's public API is built against (#1198).
32#[cfg(feature = "host-live")]
33pub use reqwest;
34pub use runtime::{FunctionRuntime, SendFunctionRuntime};
35/// The `serde_json` this crate's public API is built against (#1198).
36pub use serde_json;
37pub use triggers::{
38    cron::{CronScheduler, CronSchedulerHandle, CronTrigger},
39    ingest::{
40        Attachment, Classification, InboundMessage, InboundRouting, IngestError, IngestSelector,
41        IngestSource, IngestTrigger, PullBatch, PullContext, PullSource, PushSource, RawDelivery,
42        Recipient, RoutingRule, Source, StorageRef, Transport,
43        email::{ParsedEmail, PendingAttachment, classify, derive_thread_key, normalize_email},
44        parse_recipient, resolve_routing,
45    },
46    mutation::{
47        AfterMutationTrigger, BeforeMutationChain, BeforeMutationResult, BeforeMutationTrigger,
48        EntityEvent, EventKind, TriggerMatcher, interpret_guest_decision,
49    },
50    registry::TriggerRegistry,
51    source::{IngestSink, SourceOutcome, run_source_once},
52};
53pub use types::{
54    EventPayload, FunctionDefinition, FunctionModule, FunctionResult, FunctionsConfig, LogEntry,
55    LogLevel, ResourceLimits, RunAs, RuntimeType,
56};
57/// The `wasmtime` this crate's public API is built against (#1198).
58#[cfg(feature = "runtime-wasm")]
59pub use wasmtime;
60
61#[cfg(test)]
62mod tests;