Skip to content

PersistentAI API Documentation / @persistentai/fireflow-trpc / server / IOwnershipResolver

Interface: IOwnershipResolver

Defined in: packages/fireflow-trpc/server/stores/ownership/IOwnershipResolver.ts:19

Interface for resolving user ownership and identity mappings.

This provides a minimal interface for checking ownership that supports:

  • Direct ID matching (new flows with internal USR... IDs)
  • External account matching (old flows with PersistentAI/provider IDs)

This abstraction allows FlowStore to check ownership without depending on the full UserStore implementation, making it easier to test and maintain.

Properties

getAllUserIds()

getAllUserIds: (userId) => Promise<string[]>

Defined in: packages/fireflow-trpc/server/stores/ownership/IOwnershipResolver.ts:45

Get all possible owner IDs for a user

Returns an array containing:

  • The user's internal ID (USR...)
  • All linked external IDs (PersistentAI ID, demo ID, etc.)

Used for querying resources that may have either ID format.

Parameters

userId

string

User identifier (internal USR... format)

Returns

Promise<string[]>

Array of all possible owner IDs for this user


isOwner()

isOwner: (userId, ownerId) => Promise<boolean>

Defined in: packages/fireflow-trpc/server/stores/ownership/IOwnershipResolver.ts:31

Check if a user owns a resource based on owner ID

Handles both:

  • Direct match: userId === ownerId (new entities)
  • External match: userId's external accounts include ownerId (old entities)

Parameters

userId

string

User identifier (internal USR... format)

ownerId

string

Resource owner identifier (may be internal or external ID)

Returns

Promise<boolean>

true if user owns the resource

Licensed under BUSL-1.1