Function: createAndLinkImportedSession()
Makaio Framework / services-core / createAndLinkImportedSession
Function: createAndLinkImportedSession()
Section titled “Function: createAndLinkImportedSession()”createAndLinkImportedSession(
params):Promise<CreateAndLinkResult>
Defined in: ../../../packages/services/core/src/session/adapter-sessions/handlers.ts:273
Unified helper that creates and links a Makaio session for an adapter session.
Consolidates both the discovery path (registerSessionDiscoveredHandler) and the
import path into a single authoritative flow:
- Early-exit if the adapter session is already linked (idempotent).
- Eagerly resolve
parentSessionId/rootSessionIdviaresolveLineage. - Create the Makaio session record via
SessionStorageSubjects.setwithifAbsent. - Link, emit
SessionSubjects.created, and clean up on failure vialinkAndEmit.
Parameters
Section titled “Parameters”params
Section titled “params”Parameters for the unified session creation/linking flow.
Returns
Section titled “Returns”Promise<CreateAndLinkResult>
The session ID and whether a new record was created.