PersistentAI API Documentation / @persistentai/fireflow-trpc / server / DBFlowStore
Class: DBFlowStore
Defined in: packages/fireflow-trpc/server/stores/flowStore/dbFlowStore.ts:27
In-memory implementation of flow storage
Implements
Constructors
Constructor
new DBFlowStore(
db,cacheEnabled?,nodeRegistry?,ownershipResolver?):DBFlowStore
Defined in: packages/fireflow-trpc/server/stores/flowStore/dbFlowStore.ts:37
Parameters
db
NodePgDatabase<Record<string, unknown>> & object
cacheEnabled?
boolean = true
nodeRegistry?
NodeRegistry = ...
ownershipResolver?
Returns
DBFlowStore
Methods
createFlow()
createFlow(
metadata):Promise<Flow>
Defined in: packages/fireflow-trpc/server/stores/flowStore/dbFlowStore.ts:51
Creates a new flow with given metadata
Parameters
metadata
Flow metadata
Returns
Promise<Flow>
Created flow ID
Implementation of
deleteFlow()
deleteFlow(
flowId):Promise<boolean>
Defined in: packages/fireflow-trpc/server/stores/flowStore/dbFlowStore.ts:159
Deletes flow
Parameters
flowId
string
Flow identifier
Returns
Promise<boolean>
true if flow was deleted, false if not found
Implementation of
getFlow()
getFlow(
flowId):Promise<Flow|null>
Defined in: packages/fireflow-trpc/server/stores/flowStore/dbFlowStore.ts:70
Retrieves flow by ID
Parameters
flowId
string
Flow identifier
Returns
Promise<Flow | null>
Flow instance or null if not found
Implementation of
getFlowMetadata()
getFlowMetadata(
flowId):Promise<FlowMetadata|null>
Defined in: packages/fireflow-trpc/server/stores/flowStore/dbFlowStore.ts:112
Parameters
flowId
string
Returns
Promise<FlowMetadata | null>
Implementation of
hasAccess()
hasAccess(
flowId,userId,cacheEnabled?):Promise<boolean>
Defined in: packages/fireflow-trpc/server/stores/flowStore/dbFlowStore.ts:199
Checks if user has access to flow Supports both new internal user IDs (USR...) and old external IDs (PersistentAI IDs) for backward compatibility with pre-migration flows
Parameters
flowId
string
Flow identifier
userId
string
User identifier (internal USR... format)
cacheEnabled?
boolean = true
Whether to use cache
Returns
Promise<boolean>
true if user has access, false otherwise
Implementation of
listFlows()
listFlows(
ownerId,orderBy,limit):Promise<FlowMetadata[]>
Defined in: packages/fireflow-trpc/server/stores/flowStore/dbFlowStore.ts:131
Lists all available flows ordered by updatedAt desc Supports both new internal user IDs (USR...) and old external IDs (PersistentAI IDs) for backward compatibility with pre-migration flows
Parameters
ownerId
string
User identifier (internal USR... format)
orderBy
ListOrderBy
Sort order
limit
number
Maximum number of flows to return
Returns
Promise<FlowMetadata[]>
Array of flows
Implementation of
lockFlow()
lockFlow(
flowId,timeout?):Promise<void>
Defined in: packages/fireflow-trpc/server/stores/flowStore/dbFlowStore.ts:245
Locks a flow to prevent concurrent modifications. If the flow is already locked, this method will block until the lock is released.
Parameters
flowId
string
Flow identifier
timeout?
number = 5000
Lock timeout in milliseconds (default: 5000 ms)
Returns
Promise<void>
Throws
Error if flow doesn't exist
Implementation of
unlockFlow()
unlockFlow(
flowId):Promise<void>
Defined in: packages/fireflow-trpc/server/stores/flowStore/dbFlowStore.ts:285
Unlocks a previously locked flow and grants lock to the next waiter if any
Parameters
flowId
string
Flow identifier
Returns
Promise<void>
Throws
Error if flow doesn't exist
Implementation of
updateFlow()
updateFlow(
flow):Promise<Flow>
Defined in: packages/fireflow-trpc/server/stores/flowStore/dbFlowStore.ts:175
Updates flow with new data
Parameters
flow
Flow data
Returns
Promise<Flow>
Updated flow