import { IContainer , IRuntimeFactory , } from "@fluidframework/container-definitions" ; import { ensureFluidResolvedUrl } from "@fluidframework/driver-utils" ; import { RouterliciousDocumentServiceFactory } from "@fluidframework/routerlicious-driver" ; import { createTinyliciousCreateNewRequest , InsecureTinyliciousTokenProvider , InsecureTinyliciousUrlResolver , } from "@fluidframework/tinylicious-driver" ; import { createContainer , getContainer } from "./getContainer" ; param documentId param containerRuntimeFactory param createNew param tinyliciousPort returns export async function getTinyliciousContainer ( documentId , containerRuntimeFactory , createNew , tinyliciousPort ? ) { const tokenProvider = new InsecureTinyliciousTokenProvider ( ) ; const urlResolver = new InsecureTinyliciousUrlResolver ( tinyliciousPort ) ; const documentServiceFactory = new RouterliciousDocumentServiceFactory ( tokenProvider ) ; let container ; if ( createNew ) { container = await createContainer ( { documentServiceFactory , urlResolver , containerRuntimeFactory , request : createTinyliciousCreateNewRequest ( ) } ) ; } else { container = await getContainer ( { documentServiceFactory , urlResolver , containerRuntimeFactory , request : { url : documentId } } ) ; } const resolved = container . resolvedUrl ; ensureFluidResolvedUrl ( resolved ) ; const containerId = resolved . id ; return [ container , containerId ] ; }