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 store;
19pub mod triggers;
20pub mod types;
21
22pub use host::{HostContext, NoopHostContext};
23pub use observer::FunctionObserver;
24pub use outbound::{
25    EmailTransport, LoginEmailSender, SendContext, SendEmailRequest, SendEmailResponse,
26    SendPolicyError, SenderIdentity, SenderIdentityResolver, resolve_sender_identity,
27};
28pub use runtime::{FunctionRuntime, SendFunctionRuntime};
29pub use store::{FunctionRecord, FunctionStatus, FunctionStore, memory::InMemoryFunctionStore};
30pub use triggers::{
31    cron::{CronScheduler, CronSchedulerHandle, CronTrigger},
32    ingest::{
33        Attachment, Classification, InboundMessage, InboundRouting, IngestError, IngestSource,
34        IngestTrigger, PushSource, RawDelivery, Recipient, RoutingRule, Source, StorageRef,
35        Transport,
36        email::{ParsedEmail, PendingAttachment, classify, derive_thread_key, normalize_email},
37        parse_recipient, resolve_routing,
38    },
39    mutation::{
40        AfterMutationTrigger, BeforeMutationChain, BeforeMutationResult, BeforeMutationTrigger,
41        EntityEvent, EventKind, TriggerMatcher,
42    },
43    registry::TriggerRegistry,
44};
45pub use types::{
46    EventPayload, FunctionDefinition, FunctionModule, FunctionResult, LogEntry, LogLevel,
47    ResourceLimits, RuntimeType,
48};
49
50#[cfg(test)]
51mod tests;