@fluidframework/test-utils 1.2.7 → 2.0.0-dev.1.3.0.96595

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/DriverWrappers.d.ts +29 -0
  2. package/dist/DriverWrappers.d.ts.map +1 -0
  3. package/dist/DriverWrappers.js +54 -0
  4. package/dist/DriverWrappers.js.map +1 -0
  5. package/dist/TestConfigs.d.ts +7 -0
  6. package/dist/TestConfigs.d.ts.map +1 -0
  7. package/dist/TestConfigs.js +15 -0
  8. package/dist/TestConfigs.js.map +1 -0
  9. package/dist/TestSummaryUtils.d.ts +18 -0
  10. package/dist/TestSummaryUtils.d.ts.map +1 -0
  11. package/dist/TestSummaryUtils.js +95 -0
  12. package/dist/TestSummaryUtils.js.map +1 -0
  13. package/dist/index.d.ts +3 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +3 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/loaderContainerTracker.d.ts +25 -9
  18. package/dist/loaderContainerTracker.d.ts.map +1 -1
  19. package/dist/loaderContainerTracker.js +58 -17
  20. package/dist/loaderContainerTracker.js.map +1 -1
  21. package/dist/localCodeLoader.d.ts.map +1 -1
  22. package/dist/localCodeLoader.js +6 -14
  23. package/dist/localCodeLoader.js.map +1 -1
  24. package/dist/packageVersion.d.ts +1 -1
  25. package/dist/packageVersion.d.ts.map +1 -1
  26. package/dist/packageVersion.js +1 -1
  27. package/dist/packageVersion.js.map +1 -1
  28. package/dist/testFluidObject.d.ts +16 -9
  29. package/dist/testFluidObject.d.ts.map +1 -1
  30. package/dist/testFluidObject.js +16 -9
  31. package/dist/testFluidObject.js.map +1 -1
  32. package/dist/testObjectProvider.d.ts +3 -2
  33. package/dist/testObjectProvider.d.ts.map +1 -1
  34. package/dist/testObjectProvider.js +9 -2
  35. package/dist/testObjectProvider.js.map +1 -1
  36. package/dist/timeoutUtils.d.ts +2 -0
  37. package/dist/timeoutUtils.d.ts.map +1 -1
  38. package/dist/timeoutUtils.js +8 -2
  39. package/dist/timeoutUtils.js.map +1 -1
  40. package/package.json +29 -28
  41. package/src/DriverWrappers.ts +77 -0
  42. package/src/TestConfigs.ts +14 -0
  43. package/src/TestSummaryUtils.ts +144 -0
  44. package/src/index.ts +3 -0
  45. package/src/loaderContainerTracker.ts +66 -17
  46. package/src/localCodeLoader.ts +6 -14
  47. package/src/packageVersion.ts +1 -1
  48. package/src/testFluidObject.ts +16 -9
  49. package/src/testObjectProvider.ts +10 -3
  50. package/src/timeoutUtils.ts +9 -1
  51. package/tsconfig.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"loaderContainerTracker.js","sourceRoot":"","sources":["../src/loaderContainerTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAGtD,+EAAgH;AAChH,mCAAgC;AAGhC,MAAM,OAAO,GAAG,aAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpC,MAAM,SAAS,GAAG,aAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAkBvC,MAAa,sBAAsB;IAI/B,YAA6B,wBAAiC,KAAK;QAAtC,0BAAqB,GAArB,qBAAqB,CAAiB;QAHlD,eAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;QAC7D,uBAAkB,GAAW,CAAC,CAAC;IAE+B,CAAC;IAEvE;;;OAGG;IACI,GAAG,CAAiC,MAAkB;QACzD,oFAAoF;QACpF,MAAM,KAAK,GAAG,CAA0B,EAA2B,EAAE,EAAE;YACnE,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAChC,OAAO,KAAK,EAAE,GAAG,IAAS,EAAE,EAAE;gBAC1B,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;gBACzC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;gBAC7B,OAAO,SAAS,CAAC;YACrB,CAAC,C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E,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG;0BACxE,GAAG,GAAG,CAAC,IAAI,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gBACtE,CAAC,CAAC;YACN,CAAC,CAAC;YACF,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;YACpE,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;YAClE,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;gBAC7C,OAAO,CAAC,GAAG,KAAK,oBAAoB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;YACH,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;gBAC/C,OAAO,CAAC,GAAG,KAAK,UAAU,MAAM,EAAE,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAED;;;;OAIG;IACK,aAAa,CAAC,UAAwB;QAC1C,MAAM,iBAAiB,GAAG,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QACpG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACtE,CAAC;CACJ;AAtgBD,wDAsgBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IContainer, IDeltaQueue, IHostLoader } from \"@fluidframework/container-definitions\";\nimport { Container } from \"@fluidframework/container-loader\";\nimport { IDocumentMessage, ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { debug } from \"./debug\";\nimport { IOpProcessingController } from \"./testObjectProvider\";\n\nconst debugOp = debug.extend(\"ops\");\nconst debugWait = debug.extend(\"wait\");\n\ninterface ContainerRecord {\n // A short number for debug output\n index: number;\n\n // LoaderContainerTracker paused state\n paused: boolean;\n\n // Tracking trailing no-op that may or may be acked by the server so we can discount them\n // See issue #5629\n startTrailingNoOps: number;\n trailingNoOps: number;\n\n // Track last proposal to ensure no unresolved proposal\n lastProposal: number;\n}\n\nexport class LoaderContainerTracker implements IOpProcessingController {\n private readonly containers = new Map<IContainer, ContainerRecord>();\n private lastProposalSeqNum: number = 0;\n\n constructor(private readonly syncSummarizerClients: boolean = false) {}\n\n /**\n * Add a loader to start to track any container created from them\n * @param loader - loader to start tracking any container created.\n */\n public add<LoaderType extends IHostLoader>(loader: LoaderType) {\n // TODO: Expose Loader API to able to intercept container creation (See issue #5114)\n const patch = <T, C extends IContainer>(fn: (...args) => Promise<C>) => {\n const boundFn = fn.bind(loader);\n return async (...args: T[]) => {\n const container = await boundFn(...args);\n this.addContainer(container);\n return container;\n };\n };\n /* eslint-disable @typescript-eslint/unbound-method */\n loader.resolve = patch(loader.resolve);\n loader.createDetachedContainer = patch(loader.createDetachedContainer);\n loader.rehydrateDetachedContainerFromSnapshot = patch(loader.rehydrateDetachedContainerFromSnapshot);\n /* eslint-enable @typescript-eslint/unbound-method */\n }\n\n /**\n * Utility function to add container to be tracked.\n *\n * @param container - container to add\n */\n private addContainer(container: IContainer) {\n // ignore summarizer\n if (!container.deltaManager.clientDetails.capabilities.interactive && !this.syncSummarizerClients) { return; }\n\n // don't add container that is already tracked\n if (this.containers.has(container)) { return; }\n\n const record = {\n index: this.containers.size,\n paused: false,\n startTrailingNoOps: 0,\n trailingNoOps: 0,\n lastProposal: 0,\n };\n this.containers.set(container, record);\n this.trackTrailingNoOps(container, record);\n this.trackLastProposal(container);\n this.setupTrace(container, record.index);\n }\n\n /**\n * Keep track of the trailing NoOp that was sent so we can discount them in the clientSequenceNumber tracking.\n * The server might coalesce them with other ops, or a single NoOp, or delay it if it don't think it is necessary.\n *\n * @param container - the container to track\n * @param record - the record to update the trailing op information\n */\n private trackTrailingNoOps(container: IContainer, record: ContainerRecord) {\n container.deltaManager.outbound.on(\"op\", (messages) => {\n for (const msg of messages) {\n if (msg.type === MessageType.NoOp) {\n // Track the NoOp that was sent.\n if (record.trailingNoOps === 0) {\n // record the starting sequence number of the trailing no ops if we haven't been tracking yet.\n record.startTrailingNoOps = msg.clientSequenceNumber;\n }\n record.trailingNoOps++;\n } else {\n // Other ops has been sent. We would like to see those ack'ed, so no more need to track NoOps\n record.trailingNoOps = 0;\n }\n }\n });\n\n container.deltaManager.inbound.on(\"push\", (message) => {\n // Received the no op back, update the record if we are tracking\n if (message.type === MessageType.NoOp\n && message.clientId === (container as Container).clientId\n && record.trailingNoOps !== 0\n && record.startTrailingNoOps <= message.clientSequenceNumber\n ) {\n // NoOp might have coalesced and skipped ahead some sequence number\n // update the record and skip ahead as well\n const oldStartTrailingNoOps = record.startTrailingNoOps;\n record.startTrailingNoOps = message.clientSequenceNumber + 1;\n record.trailingNoOps -= (record.startTrailingNoOps - oldStartTrailingNoOps);\n }\n });\n\n container.on(\"disconnected\", () => {\n // reset on disconnect.\n record.trailingNoOps = 0;\n });\n }\n\n private trackLastProposal(container: IContainer) {\n container.on(\"codeDetailsProposed\", (value, proposal) => {\n if (proposal.sequenceNumber > this.lastProposalSeqNum) {\n this.lastProposalSeqNum = proposal.sequenceNumber;\n }\n });\n }\n\n /**\n * Reset the tracker, closing all containers and stop tracking them.\n */\n public reset() {\n this.lastProposalSeqNum = 0;\n for (const container of this.containers.keys()) {\n container.close();\n }\n this.containers.clear();\n\n // REVIEW: do we need to unpatch the loaders?\n }\n\n /**\n * Make sure all the tracked containers are synchronized.\n * - No isDirty (non-readonly) containers\n * - No extra clientId in quorum of any container that is not tracked and still opened.\n * - i.e. no pending Join/Leave message.\n * - No unresolved proposal (minSeqNum \\>= lastProposalSeqNum)\n * - lastSequenceNumber of all container is the same\n * - clientSequenceNumberObserved is the same as clientSequenceNumber sent\n * - this overlaps with !isDirty, but include task scheduler ops.\n * - Trailing NoOp is tracked and don't count as pending ops.\n */\n public async ensureSynchronized(...containers: IContainer[]) {\n const resumed = this.resumeProcessing(...containers);\n\n let waitingSequenceNumberSynchronized = false;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const containersToApply = this.getContainers(containers);\n if (containersToApply.length === 0) { break; }\n\n // Ignore readonly dirty containers, because it can't sent up and nothing can be done about it being dirty\n const dirtyContainers = containersToApply.filter((c) => {\n const { deltaManager, isDirty } = c;\n return deltaManager.readOnlyInfo.readonly !== true && isDirty;\n });\n if (dirtyContainers.length === 0) {\n // Wait for all the leave messages\n const pendingClients = this.getPendingClients(containersToApply);\n if (pendingClients.length === 0) {\n if (this.isSequenceNumberSynchronized(containersToApply)) {\n // done, we are in sync\n break;\n }\n if (!waitingSequenceNumberSynchronized) {\n // Only write it out once\n waitingSequenceNumberSynchronized = true;\n debugWait(\"Waiting for sequence number synchronized\");\n await this.waitForAnyInboundOps(containersToApply);\n }\n } else {\n waitingSequenceNumberSynchronized = false;\n await this.waitForPendingClients(pendingClients);\n }\n } else {\n // Wait for all the containers to be saved\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n debugWait(`Waiting container to be saved ${dirtyContainers.map((c) => this.containers.get(c)!.index)}`);\n waitingSequenceNumberSynchronized = false;\n await Promise.all(dirtyContainers.map(async (c) => new Promise((resolve) => c.once(\"saved\", resolve))));\n }\n\n // yield a turn to allow side effect of the ops we just processed execute before we check again\n await new Promise<void>((resolve) => { setTimeout(resolve, 0); });\n }\n\n // Pause all container that was resumed\n // don't call pause if resumed is empty and pause everything, which is not what we want\n if (resumed.length !== 0) {\n await this.pauseProcessing(...resumed);\n }\n\n debugWait(\"Synchronized\");\n }\n\n /**\n * Utility to calculate the set of clientId per container in quorum that is NOT associated with\n * any container we tracked, indicating there is a pending join or leave op that we need to wait.\n *\n * @param containersToApply - the set of containers to check\n */\n private getPendingClients(containersToApply: IContainer[]) {\n // All the clientId we track should be a superset of the quorum, otherwise, we are missing\n // leave messages\n const openedDocuments = Array.from(this.containers.keys()).filter((c) => !c.closed);\n const openedClientId = openedDocuments.map((container) => (container as Container).clientId);\n\n const pendingClients: [IContainer, Set<string>][] = [];\n containersToApply.forEach((container) => {\n const pendingClientId = new Set<string>();\n const quorum = container.getQuorum();\n quorum.getMembers().forEach((client, clientId) => {\n // ignore summarizer\n if (!client.client.details.capabilities.interactive && !this.syncSummarizerClients) { return; }\n if (!openedClientId.includes(clientId)) {\n pendingClientId.add(clientId);\n }\n });\n\n if (pendingClientId.size !== 0) {\n pendingClients.push([container, pendingClientId]);\n }\n });\n return pendingClients;\n }\n\n /**\n * Utility to check synchronization based on sequence number\n * See ensureSynchronized for more detail\n *\n * @param containersToApply - the set of containers to check\n */\n private isSequenceNumberSynchronized(containersToApply: IContainer[]) {\n // clientSequenceNumber check detects ops in flight, both on the wire and in the outbound queue\n // We need both client sequence number and isDirty check because:\n // - Currently isDirty flag ignores ops for task scheduler, so we need the client sequence number check\n // - But isDirty flags include ops during forceReadonly and disconnected, because we don't submit\n // the ops in the first place, clientSequenceNumber is not assigned\n\n const isClientSequenceNumberSynchronized = containersToApply.every((container) => {\n if (container.deltaManager.readOnlyInfo.readonly === true) {\n // Ignore readonly container. the clientSeqNum and clientSeqNumObserved might be out of sync\n // because we transition to readonly when outbound is not empty or the in transit op got lost\n return true;\n }\n // Note that in read only mode, the op won't be submitted\n let deltaManager = (container.deltaManager as any);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const { trailingNoOps } = this.containers.get(container)!;\n // Back-compat: clientSequenceNumber & clientSequenceNumberObserved moved to ConnectionManager in 0.53\n if (!(\"clientSequenceNumber\" in deltaManager)) {\n deltaManager = deltaManager.connectionManager;\n }\n assert(\"clientSequenceNumber\" in deltaManager, \"no clientSequenceNumber\");\n assert(\"clientSequenceNumberObserved\" in deltaManager, \"no clientSequenceNumber\");\n return deltaManager.clientSequenceNumber ===\n (deltaManager.clientSequenceNumberObserved as number) + trailingNoOps;\n });\n\n if (!isClientSequenceNumberSynchronized) {\n return false;\n }\n\n const minSeqNum = containersToApply[0].deltaManager.minimumSequenceNumber;\n if (minSeqNum < this.lastProposalSeqNum) {\n // There is an unresolved proposal\n return false;\n }\n\n // Check to see if all the container has process the same number of ops.\n const seqNum = containersToApply[0].deltaManager.lastSequenceNumber;\n return containersToApply.every((c) => c.deltaManager.lastSequenceNumber === seqNum);\n }\n\n /**\n * Utility to wait for any clientId in quorum that is NOT associated with any container we\n * tracked, indicating there is a pending join or leave op that we need to wait.\n *\n * Note that this function doesn't account for container that got added after we started waiting\n *\n * @param containersToApply - the set of containers to wait for any inbound ops for\n */\n private async waitForPendingClients(pendingClients: [IContainer, Set<string>][]) {\n const unconnectedClients =\n Array.from(this.containers.keys()).filter((c) => !c.closed && !(c as Container).connected);\n return Promise.all(pendingClients.map(async ([container, pendingClientId]) => {\n return new Promise<void>((resolve) => {\n const cleanup = () => {\n unconnectedClients.forEach((c) => c.off(\"connected\", handler));\n container.getQuorum().off(\"removeMember\", handler);\n };\n const handler = (clientId: string) => {\n pendingClientId.delete(clientId);\n if (pendingClientId.size === 0) {\n cleanup();\n resolve();\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const index = this.containers.get(container)!.index;\n debugWait(`${index}: Waiting for pending clients ${Array.from(pendingClientId.keys())}`);\n unconnectedClients.forEach((c) => c.on(\"connected\", handler));\n container.getQuorum().on(\"removeMember\", handler);\n container.on(\"closed\", () => {\n cleanup();\n resolve();\n });\n });\n }));\n }\n\n /**\n * Utility to wait for any inbound ops from a set of containers\n * @param containersToApply - the set of containers to wait for any inbound ops for\n */\n private async waitForAnyInboundOps(containersToApply: IContainer[]) {\n return new Promise<void>((resolve) => {\n const handler = () => {\n containersToApply.map((c) => {\n c.deltaManager.inbound.off(\"push\", handler);\n });\n resolve();\n };\n containersToApply.map((c) => {\n c.deltaManager.inbound.on(\"push\", handler);\n });\n });\n }\n\n /**\n * Resume all queue activities on all paused tracked containers and return them\n */\n public resumeProcessing(...containers: IContainer[]) {\n const resumed: IContainer[] = [];\n const containersToApply = this.getContainers(containers);\n for (const container of containersToApply) {\n const record = this.containers.get(container);\n if (record?.paused === true) {\n debugWait(`${record.index}: container resumed`);\n container.deltaManager.inbound.resume();\n container.deltaManager.outbound.resume();\n resumed.push(container);\n record.paused = false;\n }\n }\n return resumed;\n }\n\n /**\n * Pause all queue activities on the containers given, or all tracked containers\n * Any containers given that is not tracked will be ignored.\n */\n public async pauseProcessing(...containers: IContainer[]) {\n const pauseP: Promise<void>[] = [];\n const containersToApply = this.getContainers(containers);\n for (const container of containersToApply) {\n const record = this.containers.get(container);\n if (record !== undefined && !record.paused) {\n debugWait(`${record.index}: container paused`);\n pauseP.push(container.deltaManager.inbound.pause());\n pauseP.push(container.deltaManager.outbound.pause());\n record.paused = true;\n }\n }\n await Promise.all(pauseP);\n }\n\n /**\n * Pause all queue activities on all tracked containers, and resume only\n * inbound to process ops until it is idle. All queues are left in the paused state\n * after the function\n */\n public async processIncoming(...containers: IContainer[]) {\n return this.processQueue(containers, (container) => container.deltaManager.inbound);\n }\n\n /**\n * Pause all queue activities on all tracked containers, and resume only\n * outbound to process ops until it is idle. All queues are left in the paused state\n * after the function\n */\n public async processOutgoing(...containers: IContainer[]) {\n return this.processQueue(containers, (container) => container.deltaManager.outbound);\n }\n\n /**\n * Implementation of processIncoming and processOutgoing\n */\n private async processQueue<U>(containers: IContainer[], getQueue: (container: IContainer) => IDeltaQueue<U>) {\n await this.pauseProcessing(...containers);\n const resumed: IDeltaQueue<U>[] = [];\n\n const containersToApply = this.getContainers(containers);\n const inflightTracker = new Map<IContainer, number>();\n const cleanup: (() => void)[] = [];\n for (const container of containersToApply) {\n const queue = getQueue(container);\n\n // track the outgoing ops (if any) to make sure they make the round trip to at least to the same client\n // to make sure they are sequenced.\n cleanup.push(this.setupInOutTracker(container, inflightTracker));\n queue.resume();\n resumed.push(queue);\n }\n\n while (resumed.some((queue) => !queue.idle)) {\n debugWait(\"Wait until queue is idle\");\n await new Promise<void>((resolve) => { setTimeout(resolve, 0); });\n }\n\n // Make sure all the op that we sent out are acked first\n // This is no op if we are processing incoming\n if (inflightTracker.size) {\n debugWait(\"Wait for inflight ops\");\n do {\n await this.waitForAnyInboundOps(containersToApply);\n } while (inflightTracker.size);\n }\n\n // remove the handlers\n cleanup.forEach((clean) => clean());\n\n await Promise.all(resumed.map(async (queue) => queue.pause()));\n }\n\n /**\n * Utility to set up listener to track the outbound ops until it round trip back\n * Returns a function to remove the handler after it is done.\n *\n * @param container - the container to setup\n * @param inflightTracker - a map to track the clientSequenceNumber per container it expect to get ops back\n */\n private setupInOutTracker(container: IContainer, inflightTracker: Map<IContainer, number>) {\n const outHandler = (messages: IDocumentMessage[]) => {\n for (const message of messages) {\n if (message.type !== MessageType.NoOp) {\n inflightTracker.set(container, message.clientSequenceNumber);\n }\n }\n };\n const inHandler = (message: ISequencedDocumentMessage) => {\n if (message.type !== MessageType.NoOp\n && message.clientId === (container as Container).clientId\n && inflightTracker.get(container) === message.clientSequenceNumber) {\n inflightTracker.delete(container);\n }\n };\n\n container.deltaManager.outbound.on(\"op\", outHandler);\n container.deltaManager.inbound.on(\"push\", inHandler);\n\n return () => {\n container.deltaManager.outbound.off(\"op\", outHandler);\n container.deltaManager.inbound.off(\"push\", inHandler);\n };\n }\n\n /**\n * Setup debug traces for connection and ops\n */\n private setupTrace(container: IContainer, index: number) {\n if (debugOp.enabled) {\n const getContentsString = (type: string, msgContents: any) => {\n try {\n if (type !== MessageType.Operation) {\n if (typeof msgContents === \"string\") { return msgContents; }\n return JSON.stringify(msgContents);\n }\n let address = \"\";\n\n // contents comes in the wire as JSON string (\"push\" event)\n // But already parsed when apply (\"op\" event)\n let contents = typeof msgContents === \"string\" ?\n JSON.parse(msgContents) : msgContents;\n while (contents !== undefined && contents !== null) {\n if (contents.contents?.address !== undefined) {\n address += `/${contents.contents.address}`;\n contents = contents.contents.contents;\n } else if (contents.content?.address !== undefined) {\n address += `/${contents.content.address}`;\n contents = contents.content.contents;\n } else {\n break;\n }\n }\n if (address) {\n return `${address} ${JSON.stringify(contents)}`;\n }\n return JSON.stringify(contents);\n } catch (e: any) {\n return `${e.message}: ${e.stack}`;\n }\n };\n debugOp(`${index}: ADD: clientId: ${(container as Container).clientId}`);\n container.deltaManager.outbound.on(\"op\", (messages) => {\n for (const msg of messages) {\n debugOp(`${index}: OUT: `\n + `cli: ${msg.clientSequenceNumber.toString().padStart(3)} `\n + `rsq: ${msg.referenceSequenceNumber.toString().padStart(3)} `\n + `${msg.type} ${getContentsString(msg.type, msg.contents)}`);\n }\n });\n const getInboundHandler = (type: string) => {\n return (msg: ISequencedDocumentMessage) => {\n const clientSeq = msg.clientId === (container as Container).clientId ?\n `cli: ${msg.clientSequenceNumber.toString().padStart(3)}` : \" \";\n debugOp(`${index}: ${type}: seq: ${msg.sequenceNumber.toString().padStart(3)} `\n + `${clientSeq} min: ${msg.minimumSequenceNumber.toString().padStart(3)} `\n + `${msg.type} ${getContentsString(msg.type, msg.contents)}`);\n };\n };\n container.deltaManager.inbound.on(\"push\", getInboundHandler(\"IN \"));\n container.deltaManager.inbound.on(\"op\", getInboundHandler(\"OP \"));\n container.deltaManager.on(\"connect\", (details) => {\n debugOp(`${index}: CON: clientId: ${details.clientId}`);\n });\n container.deltaManager.on(\"disconnect\", (reason) => {\n debugOp(`${index}: DIS: ${reason}`);\n });\n }\n }\n\n /**\n * Filter out the opened containers based on param.\n * @param containers - The container to filter to. If the array is empty, it means don't filter and return\n * all open containers.\n */\n private getContainers(containers: IContainer[]) {\n const containersToApply = containers.length === 0 ? Array.from(this.containers.keys()) : containers;\n return containersToApply.filter((container) => !container.closed);\n }\n}\n"]}
1
+ {"version":3,"file":"loaderContainerTracker.js","sourceRoot":"","sources":["../src/loaderContainerTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,kEAAkE;;;AAElE,+DAAsD;AAGtD,+DAAuE;AACvE,+EAAgH;AAChH,mCAAgC;AAEhC,iDAA8D;AAE9D,MAAM,OAAO,GAAG,aAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpC,MAAM,SAAS,GAAG,aAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAEvC,0CAA0C;AAC1C,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,CAAC;AAkBnC,MAAa,sBAAsB;IAI/B,YAA6B,wBAAiC,KAAK;QAAtC,0BAAqB,GAArB,qBAAqB,CAAiB;QAHlD,eAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;QAC7D,uBAAkB,GAAW,CAAC,CAAC;IAE+B,CAAC;IAEvE;;;OAGG;IACI,GAAG,CAAiC,MAAkB;QACzD,oFAAoF;QACpF,MAAM,KAAK,GAAG,CAA0B,EAA2B,EAAE,EAAE;YACnE,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAChC,OAAO,KAAK,EAAE,GAAG,IAAS,EAAE,EAAE;gBAC1B,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;gBACzC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;gBAC7B,OAAO,SAAS,CAAC;YACrB,CAAC,CAAC;QACN,CAAC,CAAC;QACF,sDAAsD;QACtD,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,CAAC,uBAAuB,GAAG,KAAK,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QACvE,MAAM,CAAC,sCAAsC,GAAG,KAAK,CAAC,MAAM,CAAC,sCAAsC,CAA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AC;gBACtE,CAAC,CAAC;YACN,CAAC,CAAC;YACF,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;YACpE,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;YAClE,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;gBAC7C,OAAO,CAAC,GAAG,KAAK,oBAAoB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;YACH,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;gBAC/C,OAAO,CAAC,GAAG,KAAK,UAAU,MAAM,EAAE,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAED;;;;OAIG;IACK,aAAa,CAAC,UAAwB;QAC1C,MAAM,iBAAiB,GAAG,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QACpG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACtE,CAAC;CACJ;AAjjBD,wDAijBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint-disable @typescript-eslint/strict-boolean-expressions */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IContainer, IDeltaQueue, IHostLoader } from \"@fluidframework/container-definitions\";\nimport { Container } from \"@fluidframework/container-loader\";\nimport { canBeCoalescedByService } from \"@fluidframework/driver-utils\";\nimport { IDocumentMessage, ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { debug } from \"./debug\";\nimport { IOpProcessingController } from \"./testObjectProvider\";\nimport { timeoutAwait, timeoutPromise } from \"./timeoutUtils\";\n\nconst debugOp = debug.extend(\"ops\");\nconst debugWait = debug.extend(\"wait\");\n\n// set the maximum timeout value as 5 mins\nconst defaultMaxTimeout = 5 * 6000;\n\ninterface ContainerRecord {\n // A short number for debug output\n index: number;\n\n // LoaderContainerTracker paused state\n paused: boolean;\n\n // Tracking trailing no-op that may or may be acked by the server so we can discount them\n // See issue #5629\n startTrailingNoOps: number;\n trailingNoOps: number;\n\n // Track last proposal to ensure no unresolved proposal\n lastProposal: number;\n}\n\nexport class LoaderContainerTracker implements IOpProcessingController {\n private readonly containers = new Map<IContainer, ContainerRecord>();\n private lastProposalSeqNum: number = 0;\n\n constructor(private readonly syncSummarizerClients: boolean = false) {}\n\n /**\n * Add a loader to start to track any container created from them\n * @param loader - loader to start tracking any container created.\n */\n public add<LoaderType extends IHostLoader>(loader: LoaderType) {\n // TODO: Expose Loader API to able to intercept container creation (See issue #5114)\n const patch = <T, C extends IContainer>(fn: (...args) => Promise<C>) => {\n const boundFn = fn.bind(loader);\n return async (...args: T[]) => {\n const container = await boundFn(...args);\n this.addContainer(container);\n return container;\n };\n };\n /* eslint-disable @typescript-eslint/unbound-method */\n loader.resolve = patch(loader.resolve);\n loader.createDetachedContainer = patch(loader.createDetachedContainer);\n loader.rehydrateDetachedContainerFromSnapshot = patch(loader.rehydrateDetachedContainerFromSnapshot);\n /* eslint-enable @typescript-eslint/unbound-method */\n }\n\n /**\n * Utility function to add container to be tracked.\n *\n * @param container - container to add\n */\n private addContainer(container: IContainer) {\n // ignore summarizer\n if (!container.deltaManager.clientDetails.capabilities.interactive && !this.syncSummarizerClients) { return; }\n\n // don't add container that is already tracked\n if (this.containers.has(container)) { return; }\n\n const record = {\n index: this.containers.size,\n paused: false,\n startTrailingNoOps: 0,\n trailingNoOps: 0,\n lastProposal: 0,\n };\n this.containers.set(container, record);\n this.trackTrailingNoOps(container, record);\n this.trackLastProposal(container);\n this.setupTrace(container, record.index);\n }\n\n /**\n * Keep track of the trailing NoOp that was sent so we can discount them in the clientSequenceNumber tracking.\n * The server might coalesce them with other ops, or a single NoOp, or delay it if it don't think it is necessary.\n *\n * @param container - the container to track\n * @param record - the record to update the trailing op information\n */\n private trackTrailingNoOps(container: IContainer, record: ContainerRecord) {\n container.deltaManager.outbound.on(\"op\", (messages) => {\n for (const msg of messages) {\n if (canBeCoalescedByService(msg)) {\n // Track the NoOp that was sent.\n if (record.trailingNoOps === 0) {\n // record the starting sequence number of the trailing no ops if we haven't been tracking yet.\n record.startTrailingNoOps = msg.clientSequenceNumber;\n }\n record.trailingNoOps++;\n } else {\n // Other ops has been sent. We would like to see those ack'ed, so no more need to track NoOps\n record.trailingNoOps = 0;\n }\n }\n });\n\n container.deltaManager.inbound.on(\"push\", (message) => {\n // Received the no op back, update the record if we are tracking\n if (canBeCoalescedByService(message)\n && message.clientId === (container as Container).clientId\n && record.trailingNoOps !== 0\n && record.startTrailingNoOps <= message.clientSequenceNumber\n ) {\n // NoOp might have coalesced and skipped ahead some sequence number\n // update the record and skip ahead as well\n const oldStartTrailingNoOps = record.startTrailingNoOps;\n record.startTrailingNoOps = message.clientSequenceNumber + 1;\n record.trailingNoOps -= (record.startTrailingNoOps - oldStartTrailingNoOps);\n }\n });\n\n container.on(\"disconnected\", () => {\n // reset on disconnect.\n record.trailingNoOps = 0;\n });\n }\n\n private trackLastProposal(container: IContainer) {\n container.on(\"codeDetailsProposed\", (value, proposal) => {\n if (proposal.sequenceNumber > this.lastProposalSeqNum) {\n this.lastProposalSeqNum = proposal.sequenceNumber;\n }\n });\n }\n\n /**\n * Reset the tracker, closing all containers and stop tracking them.\n */\n public reset() {\n this.lastProposalSeqNum = 0;\n for (const container of this.containers.keys()) {\n container.close();\n }\n this.containers.clear();\n\n // REVIEW: do we need to unpatch the loaders?\n }\n\n /**\n * Ensure all tracked containers are synchronized\n */\n public async ensureSynchronized(...containers: IContainer[]): Promise<void> {\n await this.processSynchronized(undefined, ...containers);\n }\n\n /**\n * Ensure all tracked containers are synchronized with a time limit\n */\n public async ensureSynchronizedWithTimeout?(timeoutDuration: number | undefined, ...containers: IContainer[]) {\n await this.processSynchronized(timeoutDuration, ...containers);\n }\n\n /**\n * Make sure all the tracked containers are synchronized.\n *\n * No isDirty (non-readonly) containers\n *\n * No extra clientId in quorum of any container that is not tracked and still opened.\n *\n * - i.e. no pending Join/Leave message.\n *\n * No unresolved proposal (minSeqNum \\>= lastProposalSeqNum)\n *\n * lastSequenceNumber of all container is the same\n *\n * clientSequenceNumberObserved is the same as clientSequenceNumber sent\n *\n * - this overlaps with !isDirty, but include task scheduler ops.\n *\n * - Trailing NoOp is tracked and don't count as pending ops.\n */\n private async processSynchronized(timeoutDuration: number | undefined, ...containers: IContainer[]) {\n const start = Date.now();\n const resumed = this.resumeProcessing(...containers);\n\n let waitingSequenceNumberSynchronized = false;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const containersToApply = this.getContainers(containers);\n if (containersToApply.length === 0) { break; }\n\n // Ignore readonly dirty containers, because it can't sent up and nothing can be done about it being dirty\n const dirtyContainers = containersToApply.filter((c) => {\n const { deltaManager, isDirty } = c;\n return deltaManager.readOnlyInfo.readonly !== true && isDirty;\n });\n if (dirtyContainers.length === 0) {\n // Wait for all the leave messages\n const pendingClients = this.getPendingClients(containersToApply);\n if (pendingClients.length === 0) {\n if (this.isSequenceNumberSynchronized(containersToApply)) {\n // done, we are in sync\n break;\n }\n if (!waitingSequenceNumberSynchronized) {\n // Only write it out once\n waitingSequenceNumberSynchronized = true;\n debugWait(\"Waiting for sequence number synchronized\");\n await timeoutAwait(this.waitForAnyInboundOps(containersToApply), {\n durationMs: timeoutDuration ? timeoutDuration - (Date.now() - start) : defaultMaxTimeout,\n errorMsg: \"Timeout on waiting for sequence number synchronized\",\n });\n }\n } else {\n waitingSequenceNumberSynchronized = false;\n await timeoutAwait(this.waitForPendingClients(pendingClients), {\n durationMs: timeoutDuration ? timeoutDuration - (Date.now() - start) : defaultMaxTimeout,\n errorMsg: \"Timeout on waiting for pending join or leave op\",\n });\n }\n } else {\n // Wait for all the containers to be saved\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n debugWait(`Waiting container to be saved ${dirtyContainers.map((c) => this.containers.get(c)!.index)}`);\n waitingSequenceNumberSynchronized = false;\n const remainedDuration = timeoutDuration ? timeoutDuration - (Date.now() - start) : defaultMaxTimeout;\n await Promise.all(dirtyContainers.map(async (c) => Promise.race(\n [timeoutPromise(\n (resolve) => c.once(\"saved\", () => resolve()),\n {\n durationMs: remainedDuration,\n errorMsg: \"Timeout on waiting a container to be saved\",\n },\n ),\n new Promise((resolve) => c.once(\"closed\", resolve)),\n ],\n )));\n }\n\n // yield a turn to allow side effect of the ops we just processed execute before we check again\n await new Promise<void>((resolve) => { setTimeout(resolve, 0); });\n }\n\n // Pause all container that was resumed\n // don't call pause if resumed is empty and pause everything, which is not what we want\n if (resumed.length !== 0) {\n await timeoutAwait(this.pauseProcessing(...resumed), {\n durationMs: timeoutDuration ? timeoutDuration - (Date.now() - start) : defaultMaxTimeout,\n errorMsg: \"Timeout on waiting for pausing all resumed containers\",\n });\n }\n\n debugWait(\"Synchronized\");\n }\n\n /**\n * Utility to calculate the set of clientId per container in quorum that is NOT associated with\n * any container we tracked, indicating there is a pending join or leave op that we need to wait.\n *\n * @param containersToApply - the set of containers to check\n */\n private getPendingClients(containersToApply: IContainer[]) {\n // All the clientId we track should be a superset of the quorum, otherwise, we are missing\n // leave messages\n const openedDocuments = Array.from(this.containers.keys()).filter((c) => !c.closed);\n const openedClientId = openedDocuments.map((container) => (container as Container).clientId);\n\n const pendingClients: [IContainer, Set<string>][] = [];\n containersToApply.forEach((container) => {\n const pendingClientId = new Set<string>();\n const quorum = container.getQuorum();\n quorum.getMembers().forEach((client, clientId) => {\n // ignore summarizer\n if (!client.client.details.capabilities.interactive && !this.syncSummarizerClients) { return; }\n if (!openedClientId.includes(clientId)) {\n pendingClientId.add(clientId);\n }\n });\n\n if (pendingClientId.size !== 0) {\n pendingClients.push([container, pendingClientId]);\n }\n });\n return pendingClients;\n }\n\n /**\n * Utility to check synchronization based on sequence number\n * See ensureSynchronized for more detail\n *\n * @param containersToApply - the set of containers to check\n */\n private isSequenceNumberSynchronized(containersToApply: IContainer[]) {\n // clientSequenceNumber check detects ops in flight, both on the wire and in the outbound queue\n // We need both client sequence number and isDirty check because:\n // - Currently isDirty flag ignores ops for task scheduler, so we need the client sequence number check\n // - But isDirty flags include ops during forceReadonly and disconnected, because we don't submit\n // the ops in the first place, clientSequenceNumber is not assigned\n\n const isClientSequenceNumberSynchronized = containersToApply.every((container) => {\n if (container.deltaManager.readOnlyInfo.readonly === true) {\n // Ignore readonly container. the clientSeqNum and clientSeqNumObserved might be out of sync\n // because we transition to readonly when outbound is not empty or the in transit op got lost\n return true;\n }\n // Note that in read only mode, the op won't be submitted\n let deltaManager = (container.deltaManager as any);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const { trailingNoOps } = this.containers.get(container)!;\n // Back-compat: clientSequenceNumber & clientSequenceNumberObserved moved to ConnectionManager in 0.53\n if (!(\"clientSequenceNumber\" in deltaManager)) {\n deltaManager = deltaManager.connectionManager;\n }\n assert(\"clientSequenceNumber\" in deltaManager, \"no clientSequenceNumber\");\n assert(\"clientSequenceNumberObserved\" in deltaManager, \"no clientSequenceNumber\");\n return deltaManager.clientSequenceNumber ===\n (deltaManager.clientSequenceNumberObserved as number) + trailingNoOps;\n });\n\n if (!isClientSequenceNumberSynchronized) {\n return false;\n }\n\n const minSeqNum = containersToApply[0].deltaManager.minimumSequenceNumber;\n if (minSeqNum < this.lastProposalSeqNum) {\n // There is an unresolved proposal\n return false;\n }\n\n // Check to see if all the container has process the same number of ops.\n const seqNum = containersToApply[0].deltaManager.lastSequenceNumber;\n return containersToApply.every((c) => c.deltaManager.lastSequenceNumber === seqNum);\n }\n\n /**\n * Utility to wait for any clientId in quorum that is NOT associated with any container we\n * tracked, indicating there is a pending join or leave op that we need to wait.\n *\n * Note that this function doesn't account for container that got added after we started waiting\n *\n * @param containersToApply - the set of containers to wait for any inbound ops for\n */\n private async waitForPendingClients(pendingClients: [IContainer, Set<string>][]) {\n const unconnectedClients =\n Array.from(this.containers.keys()).filter((c) => !c.closed && !(c as Container).connected);\n return Promise.all(pendingClients.map(async ([container, pendingClientId]) => {\n return new Promise<void>((resolve) => {\n const cleanup = () => {\n unconnectedClients.forEach((c) => c.off(\"connected\", handler));\n container.getQuorum().off(\"removeMember\", handler);\n };\n const handler = (clientId: string) => {\n pendingClientId.delete(clientId);\n if (pendingClientId.size === 0) {\n cleanup();\n resolve();\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const index = this.containers.get(container)!.index;\n debugWait(`${index}: Waiting for pending clients ${Array.from(pendingClientId.keys())}`);\n unconnectedClients.forEach((c) => c.on(\"connected\", handler));\n container.getQuorum().on(\"removeMember\", handler);\n container.on(\"closed\", () => {\n cleanup();\n resolve();\n });\n });\n }));\n }\n\n /**\n * Utility to wait for any inbound ops from a set of containers\n * @param containersToApply - the set of containers to wait for any inbound ops for\n */\n private async waitForAnyInboundOps(containersToApply: IContainer[]) {\n return new Promise<void>((resolve) => {\n const handler = () => {\n containersToApply.map((c) => {\n c.deltaManager.inbound.off(\"push\", handler);\n });\n resolve();\n };\n containersToApply.map((c) => {\n c.deltaManager.inbound.on(\"push\", handler);\n });\n });\n }\n\n /**\n * Resume all queue activities on all paused tracked containers and return them\n */\n public resumeProcessing(...containers: IContainer[]) {\n const resumed: IContainer[] = [];\n const containersToApply = this.getContainers(containers);\n for (const container of containersToApply) {\n const record = this.containers.get(container);\n if (record?.paused === true) {\n debugWait(`${record.index}: container resumed`);\n container.deltaManager.inbound.resume();\n container.deltaManager.outbound.resume();\n resumed.push(container);\n record.paused = false;\n }\n }\n return resumed;\n }\n\n /**\n * Pause all queue activities on the containers given, or all tracked containers\n * Any containers given that is not tracked will be ignored.\n */\n public async pauseProcessing(...containers: IContainer[]) {\n const pauseP: Promise<void>[] = [];\n const containersToApply = this.getContainers(containers);\n for (const container of containersToApply) {\n const record = this.containers.get(container);\n if (record !== undefined && !record.paused) {\n debugWait(`${record.index}: container paused`);\n pauseP.push(container.deltaManager.inbound.pause());\n pauseP.push(container.deltaManager.outbound.pause());\n record.paused = true;\n }\n }\n await Promise.all(pauseP);\n }\n\n /**\n * Pause all queue activities on all tracked containers, and resume only\n * inbound to process ops until it is idle. All queues are left in the paused state\n * after the function\n */\n public async processIncoming(...containers: IContainer[]) {\n return this.processQueue(containers, (container) => container.deltaManager.inbound);\n }\n\n /**\n * Pause all queue activities on all tracked containers, and resume only\n * outbound to process ops until it is idle. All queues are left in the paused state\n * after the function\n */\n public async processOutgoing(...containers: IContainer[]) {\n return this.processQueue(containers, (container) => container.deltaManager.outbound);\n }\n\n /**\n * Implementation of processIncoming and processOutgoing\n */\n private async processQueue<U>(containers: IContainer[], getQueue: (container: IContainer) => IDeltaQueue<U>) {\n await this.pauseProcessing(...containers);\n const resumed: IDeltaQueue<U>[] = [];\n\n const containersToApply = this.getContainers(containers);\n const inflightTracker = new Map<IContainer, number>();\n const cleanup: (() => void)[] = [];\n for (const container of containersToApply) {\n const queue = getQueue(container);\n\n // track the outgoing ops (if any) to make sure they make the round trip to at least to the same client\n // to make sure they are sequenced.\n cleanup.push(this.setupInOutTracker(container, inflightTracker));\n queue.resume();\n resumed.push(queue);\n }\n\n while (resumed.some((queue) => !queue.idle)) {\n debugWait(\"Wait until queue is idle\");\n await new Promise<void>((resolve) => { setTimeout(resolve, 0); });\n }\n\n // Make sure all the op that we sent out are acked first\n // This is no op if we are processing incoming\n if (inflightTracker.size) {\n debugWait(\"Wait for inflight ops\");\n do {\n await this.waitForAnyInboundOps(containersToApply);\n } while (inflightTracker.size);\n }\n\n // remove the handlers\n cleanup.forEach((clean) => clean());\n\n await Promise.all(resumed.map(async (queue) => queue.pause()));\n }\n\n /**\n * Utility to set up listener to track the outbound ops until it round trip back\n * Returns a function to remove the handler after it is done.\n *\n * @param container - the container to setup\n * @param inflightTracker - a map to track the clientSequenceNumber per container it expect to get ops back\n */\n private setupInOutTracker(container: IContainer, inflightTracker: Map<IContainer, number>) {\n const outHandler = (messages: IDocumentMessage[]) => {\n for (const message of messages) {\n if (!canBeCoalescedByService(message)) {\n inflightTracker.set(container, message.clientSequenceNumber);\n }\n }\n };\n const inHandler = (message: ISequencedDocumentMessage) => {\n if (!canBeCoalescedByService(message)\n && message.clientId === (container as Container).clientId\n && inflightTracker.get(container) === message.clientSequenceNumber) {\n inflightTracker.delete(container);\n }\n };\n\n container.deltaManager.outbound.on(\"op\", outHandler);\n container.deltaManager.inbound.on(\"push\", inHandler);\n\n return () => {\n container.deltaManager.outbound.off(\"op\", outHandler);\n container.deltaManager.inbound.off(\"push\", inHandler);\n };\n }\n\n /**\n * Setup debug traces for connection and ops\n */\n private setupTrace(container: IContainer, index: number) {\n if (debugOp.enabled) {\n const getContentsString = (type: string, msgContents: any) => {\n try {\n if (type !== MessageType.Operation) {\n if (typeof msgContents === \"string\") { return msgContents; }\n return JSON.stringify(msgContents);\n }\n let address = \"\";\n\n // contents comes in the wire as JSON string (\"push\" event)\n // But already parsed when apply (\"op\" event)\n let contents = typeof msgContents === \"string\" ?\n JSON.parse(msgContents) : msgContents;\n while (contents !== undefined && contents !== null) {\n if (contents.contents?.address !== undefined) {\n address += `/${contents.contents.address}`;\n contents = contents.contents.contents;\n } else if (contents.content?.address !== undefined) {\n address += `/${contents.content.address}`;\n contents = contents.content.contents;\n } else {\n break;\n }\n }\n if (address) {\n return `${address} ${JSON.stringify(contents)}`;\n }\n return JSON.stringify(contents);\n } catch (e: any) {\n return `${e.message}: ${e.stack}`;\n }\n };\n debugOp(`${index}: ADD: clientId: ${(container as Container).clientId}`);\n container.deltaManager.outbound.on(\"op\", (messages) => {\n for (const msg of messages) {\n debugOp(`${index}: OUT: `\n + `cli: ${msg.clientSequenceNumber.toString().padStart(3)} `\n + `rsq: ${msg.referenceSequenceNumber.toString().padStart(3)} `\n + `${msg.type} ${getContentsString(msg.type, msg.contents)}`);\n }\n });\n const getInboundHandler = (type: string) => {\n return (msg: ISequencedDocumentMessage) => {\n const clientSeq = msg.clientId === (container as Container).clientId ?\n `cli: ${msg.clientSequenceNumber.toString().padStart(3)}` : \" \";\n debugOp(`${index}: ${type}: seq: ${msg.sequenceNumber.toString().padStart(3)} `\n + `${clientSeq} min: ${msg.minimumSequenceNumber.toString().padStart(3)} `\n + `${msg.type} ${getContentsString(msg.type, msg.contents)}`);\n };\n };\n container.deltaManager.inbound.on(\"push\", getInboundHandler(\"IN \"));\n container.deltaManager.inbound.on(\"op\", getInboundHandler(\"OP \"));\n container.deltaManager.on(\"connect\", (details) => {\n debugOp(`${index}: CON: clientId: ${details.clientId}`);\n });\n container.deltaManager.on(\"disconnect\", (reason) => {\n debugOp(`${index}: DIS: ${reason}`);\n });\n }\n }\n\n /**\n * Filter out the opened containers based on param.\n * @param containers - The container to filter to. If the array is empty, it means don't filter and return\n * all open containers.\n */\n private getContainers(containers: IContainer[]) {\n const containersToApply = containers.length === 0 ? Array.from(this.containers.keys()) : containers;\n return containersToApply.filter((container) => !container.closed);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"localCodeLoader.d.ts","sourceRoot":"","sources":["../src/localCodeLoader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACH,sBAAsB,EACtB,YAAY,EACZ,gCAAgC,EAChC,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EAC1B,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAyB,6BAA6B,EACzD,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAEhF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,oBAAY,yBAAyB,GAAG,OAAO,CAC3C,sBAAsB,GACtB,6BAA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
22
22
  // Store the entry point against a unique id in the fluidPackageCache.
23
23
  // For code details containing a package name, use the package name as the id.
24
24
  // For code details containing a Fluid package, create a unique id from the package name and version.
25
- let pkgId;
26
25
  const source = entry[0];
27
- if (typeof source.package === "string") {
28
- pkgId = source.package;
29
- }
30
- else {
31
- pkgId = `${source.package.name}@${source.package.version}`;
32
- }
26
+ const pkgId = typeof source.package === "string"
27
+ ? source.package
28
+ : `${source.package.name}@${source.package.version}`;
33
29
  let fluidModule = entry[1];
34
30
  if ((fluidModule === null || fluidModule === void 0 ? void 0 : fluidModule.fluidExport) === undefined) {
35
31
  const maybeExport = fluidModule;
@@ -61,13 +57,9 @@ class LocalCodeLoader {
61
57
  // Get the entry point for from the fluidPackageCache for the given code details.
62
58
  // For code details containing a package name, use the package name as the id.
63
59
  // For code details containing a Fluid package, create a unique id from the package name and version.
64
- let pkdId;
65
- if (typeof source.package === "string") {
66
- pkdId = source.package;
67
- }
68
- else {
69
- pkdId = `${source.package.name}@${source.package.version}`;
70
- }
60
+ const pkdId = typeof source.package === "string"
61
+ ? source.package
62
+ : `${source.package.name}@${source.package.version}`;
71
63
  const entryPoint = this.fluidPackageCache.get(pkdId);
72
64
  if (entryPoint === undefined) {
73
65
  throw new Error(`Cannot find package ${pkdId}`);
@@ -1 +1 @@
1
- {"version":3,"file":"localCodeLoader.js","sourceRoot":"","sources":["../src/localCodeLoader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,oDAA4B;AAC5B,uDAAuF;AAYvF,iEAAuE;AAYvE;;;GAGG;AACH,MAAa,eAAe;IAGxB,YACI,cAA8D,EAC9D,cAAyC;QAJ5B,sBAAiB,GAAG,IAAI,GAAG,EAAmC,CAAC;QAM5E,KAAK,MAAM,KAAK,IAAI,cAAc,EAAE;YAChC,sEAAsE;YACtE,8EAA8E;YAC9E,qGAAqG;YACrG,IAAI,KAAa,CAAC;YAElB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACxB,IA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;IACL,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,IAAI,CACb,MAAyB;QAEzB,iFAAiF;QACjF,8EAA8E;QAC9E,qGAAqG;QACrG,IAAI,KAAa,CAAC;QAElB,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE;YACpC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC;SAC1B;aAAM;YACH,KAAK,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;SAC9D;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrD,IAAI,UAAU,KAAK,SAAS,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC;SACnD;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AAhFD,0CAgFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport assert from \"assert\";\nimport { ContainerRuntimeFactoryWithDefaultDataStore } from \"@fluidframework/aqueduct\";\nimport {\n IProvideRuntimeFactory,\n IFluidModule,\n IProvideFluidCodeDetailsComparer,\n IFluidCodeDetails,\n ICodeDetailsLoader,\n IFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntimeBase, IProvideFluidDataStoreFactory,\n IProvideFluidDataStoreRegistry } from \"@fluidframework/runtime-definitions\";\nimport { createDataStoreFactory } from \"@fluidframework/runtime-utils\";\nimport { IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\n\nexport type SupportedExportInterfaces = Partial<\n IProvideRuntimeFactory &\n IProvideFluidDataStoreFactory &\n IProvideFluidDataStoreRegistry &\n IProvideFluidCodeDetailsComparer>;\n\n// Represents the entry point for a Fluid container.\nexport type fluidEntryPoint = SupportedExportInterfaces | IFluidModule;\n\n/**\n * A simple code loader that caches a mapping of package name to a Fluid entry point.\n * On load, it retrieves the entry point matching the package name in the given code details.\n */\nexport class LocalCodeLoader implements ICodeDetailsLoader {\n private readonly fluidPackageCache = new Map<string, IFluidModuleWithDetails>();\n\n constructor(\n packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n runtimeOptions?: IContainerRuntimeOptions,\n ) {\n for (const entry of packageEntries) {\n // Store the entry point against a unique id in the fluidPackageCache.\n // For code details containing a package name, use the package name as the id.\n // For code details containing a Fluid package, create a unique id from the package name and version.\n let pkgId: string;\n\n const source = entry[0];\n if (typeof source.package === \"string\") {\n pkgId = source.package;\n } else {\n pkgId = `${source.package.name}@${source.package.version}`;\n }\n let fluidModule = entry[1] as IFluidModule;\n if (fluidModule?.fluidExport === undefined) {\n const maybeExport = fluidModule as SupportedExportInterfaces;\n\n if (maybeExport.IRuntimeFactory !== undefined) {\n fluidModule = { fluidExport: maybeExport };\n } else {\n assert(maybeExport.IFluidDataStoreFactory !== undefined);\n const defaultFactory = createDataStoreFactory(\"default\", maybeExport.IFluidDataStoreFactory);\n const innerRequestHandler = async (request: IRequest, runtime: IContainerRuntimeBase) =>\n runtime.IFluidHandleContext.resolveHandle(request);\n fluidModule = {\n fluidExport: {\n ... maybeExport,\n IRuntimeFactory:\n new ContainerRuntimeFactoryWithDefaultDataStore(\n defaultFactory,\n [[defaultFactory.type, Promise.resolve(defaultFactory)]],\n undefined,\n [innerRequestHandler],\n runtimeOptions,\n ),\n },\n };\n }\n }\n\n const runtimeFactory = {\n module: fluidModule,\n details: source,\n };\n\n this.fluidPackageCache.set(pkgId, runtimeFactory);\n }\n }\n\n /**\n * It finds the entry point for the package name in the given source and return it\n * as a Fluid module.\n * @param source - Details of where to find chaincode\n */\n public async load(\n source: IFluidCodeDetails,\n ): Promise<IFluidModuleWithDetails> {\n // Get the entry point for from the fluidPackageCache for the given code details.\n // For code details containing a package name, use the package name as the id.\n // For code details containing a Fluid package, create a unique id from the package name and version.\n let pkdId: string;\n\n if (typeof source.package === \"string\") {\n pkdId = source.package;\n } else {\n pkdId = `${source.package.name}@${source.package.version}`;\n }\n\n const entryPoint = this.fluidPackageCache.get(pkdId);\n if (entryPoint === undefined) {\n throw new Error(`Cannot find package ${pkdId}`);\n }\n return entryPoint;\n }\n}\n"]}
1
+ {"version":3,"file":"localCodeLoader.js","sourceRoot":"","sources":["../src/localCodeLoader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,oDAA4B;AAC5B,uDAAuF;AAYvF,iEAAuE;AAYvE;;;GAGG;AACH,MAAa,eAAe;IAGxB,YACI,cAA8D,EAC9D,cAAyC;QAJ5B,sBAAiB,GAAG,IAAI,GAAG,EAAmC,CAAC;QAM5E,KAAK,MAAM,KAAK,IAAI,cAAc,EAAE;YAChC,sEAAsE;YACtE,8EAA8E;YAC9E,qGAAqG;YACrG,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACxB,MAAM,KAAK,GAAG,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ;gBAC5C,CAAC,CAAC,MAAM,CAAC,OAAO;gBAChB,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACzD,IAAI,WAAW,GAAG,KAAK,CAAC,CAAC,CAAiB,CAAC;YAC3C,IAAI,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,MAAK,SAAS,EAAE;gBACxC,MAAM,WAAW,GAAG,WAAwC,CAAC;gBAE7D,IAAI,WAAW,CAAC,eAAe,KAAK,SAAS,EAAE;oBAC3C,WAAW,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;iBAC9C;qBAAM;oBACH,IAAA,gBAAM,EAAC,WAAW,CAAC,sBAAsB,KAAK,SAAS,CAAC,CAAC;oBACzD,MAAM,cAAc,GAAG,IAAA,sCAAsB,EAAC,SAAS,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC;oBAC7F,MAAM,mBAAmB,GAAG,KAAK,EAAE,OAAiB,EAAE,OAA8B,EAAE,EAAE,CACpF,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;oBACvD,WAAW,GAAG;wBACV,WAAW,kCACH,WAAW,KACf,eAAe,EACX,IAAI,sDAA2C,CAC3C,cAAc,EACd,CAAC,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,EACxD,SAAS,EACT,CAAC,mBAAmB,CAAC,EACrB,cAAc,CACjB,GACR;qBACJ,CAAC;iBACL;aACJ;YAED,MAAM,cAAc,GAAG;gBACnB,MAAM,EAAE,WAAW;gBACnB,OAAO,EAAE,MAAM;aAClB,CAAC;YAEF,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;SACrD;IACL,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,IAAI,CACb,MAAyB;QAEzB,iFAAiF;QACjF,8EAA8E;QAC9E,qGAAqG;QACrG,MAAM,KAAK,GAAG,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ;YAC5C,CAAC,CAAC,MAAM,CAAC,OAAO;YAChB,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAEzD,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrD,IAAI,UAAU,KAAK,SAAS,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC;SACnD;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AAxED,0CAwEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport assert from \"assert\";\nimport { ContainerRuntimeFactoryWithDefaultDataStore } from \"@fluidframework/aqueduct\";\nimport {\n IProvideRuntimeFactory,\n IFluidModule,\n IProvideFluidCodeDetailsComparer,\n IFluidCodeDetails,\n ICodeDetailsLoader,\n IFluidModuleWithDetails,\n} from \"@fluidframework/container-definitions\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntimeBase, IProvideFluidDataStoreFactory,\n IProvideFluidDataStoreRegistry } from \"@fluidframework/runtime-definitions\";\nimport { createDataStoreFactory } from \"@fluidframework/runtime-utils\";\nimport { IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\n\nexport type SupportedExportInterfaces = Partial<\n IProvideRuntimeFactory &\n IProvideFluidDataStoreFactory &\n IProvideFluidDataStoreRegistry &\n IProvideFluidCodeDetailsComparer>;\n\n// Represents the entry point for a Fluid container.\nexport type fluidEntryPoint = SupportedExportInterfaces | IFluidModule;\n\n/**\n * A simple code loader that caches a mapping of package name to a Fluid entry point.\n * On load, it retrieves the entry point matching the package name in the given code details.\n */\nexport class LocalCodeLoader implements ICodeDetailsLoader {\n private readonly fluidPackageCache = new Map<string, IFluidModuleWithDetails>();\n\n constructor(\n packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n runtimeOptions?: IContainerRuntimeOptions,\n ) {\n for (const entry of packageEntries) {\n // Store the entry point against a unique id in the fluidPackageCache.\n // For code details containing a package name, use the package name as the id.\n // For code details containing a Fluid package, create a unique id from the package name and version.\n const source = entry[0];\n const pkgId = typeof source.package === \"string\"\n ? source.package\n : `${source.package.name}@${source.package.version}`;\n let fluidModule = entry[1] as IFluidModule;\n if (fluidModule?.fluidExport === undefined) {\n const maybeExport = fluidModule as SupportedExportInterfaces;\n\n if (maybeExport.IRuntimeFactory !== undefined) {\n fluidModule = { fluidExport: maybeExport };\n } else {\n assert(maybeExport.IFluidDataStoreFactory !== undefined);\n const defaultFactory = createDataStoreFactory(\"default\", maybeExport.IFluidDataStoreFactory);\n const innerRequestHandler = async (request: IRequest, runtime: IContainerRuntimeBase) =>\n runtime.IFluidHandleContext.resolveHandle(request);\n fluidModule = {\n fluidExport: {\n ... maybeExport,\n IRuntimeFactory:\n new ContainerRuntimeFactoryWithDefaultDataStore(\n defaultFactory,\n [[defaultFactory.type, Promise.resolve(defaultFactory)]],\n undefined,\n [innerRequestHandler],\n runtimeOptions,\n ),\n },\n };\n }\n }\n\n const runtimeFactory = {\n module: fluidModule,\n details: source,\n };\n\n this.fluidPackageCache.set(pkgId, runtimeFactory);\n }\n }\n\n /**\n * It finds the entry point for the package name in the given source and return it\n * as a Fluid module.\n * @param source - Details of where to find chaincode\n */\n public async load(\n source: IFluidCodeDetails,\n ): Promise<IFluidModuleWithDetails> {\n // Get the entry point for from the fluidPackageCache for the given code details.\n // For code details containing a package name, use the package name as the id.\n // For code details containing a Fluid package, create a unique id from the package name and version.\n const pkdId = typeof source.package === \"string\"\n ? source.package\n : `${source.package.name}@${source.package.version}`;\n\n const entryPoint = this.fluidPackageCache.get(pkdId);\n if (entryPoint === undefined) {\n throw new Error(`Cannot find package ${pkdId}`);\n }\n return entryPoint;\n }\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/test-utils";
8
- export declare const pkgVersion = "1.2.7";
8
+ export declare const pkgVersion = "2.0.0-dev.1.3.0.96595";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,+BAA+B,CAAC;AACpD,eAAO,MAAM,UAAU,UAAU,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,+BAA+B,CAAC;AACpD,eAAO,MAAM,UAAU,0BAA0B,CAAC"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/test-utils";
11
- exports.pkgVersion = "1.2.7";
11
+ exports.pkgVersion = "2.0.0-dev.1.3.0.96595";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,OAAO,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/test-utils\";\nexport const pkgVersion = \"1.2.7\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,uBAAuB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/test-utils\";\nexport const pkgVersion = \"2.0.0-dev.1.3.0.96595\";\n"]}
@@ -46,17 +46,24 @@ export declare type ChannelFactoryRegistry = Iterable<[string | undefined, IChan
46
46
  * with the object factories in the entry list. All the entries with an id other than undefined are passed to the
47
47
  * Fluid object so that it can create a shared object for each.
48
48
  *
49
- * For example, the following will create a Fluid object that creates and loads a SharedString and SharedDirectory. It
50
- * will add SparseMatrix to the data store's factory so that it can be created later.
51
- * new TestFluidObjectFactory([
52
- * [ "sharedString", SharedString.getFactory() ],
53
- * [ "sharedDirectory", SharedDirectory.getFactory() ],
54
- * [ undefined, SparseMatrix.getFactory() ],
55
- * ]);
49
+ * @example
50
+ * The following will create a Fluid object that creates and loads a SharedString and SharedDirectory.
51
+ * It will add SparseMatrix to the data store's factory so that it can be created later.
52
+ *
53
+ * ```typescript
54
+ * new TestFluidObjectFactory([
55
+ * [ "sharedString", SharedString.getFactory() ],
56
+ * [ "sharedDirectory", SharedDirectory.getFactory() ],
57
+ * [ undefined, SparseMatrix.getFactory() ],
58
+ * ]);
59
+ * ```
56
60
  *
57
61
  * The SharedString and SharedDirectory can be retrieved via getSharedObject() on the TestFluidObject as follows:
58
- * sharedString = testFluidObject.getSharedObject<SharedString>("sharedString");
59
- * sharedDir = testFluidObject.getSharedObject<SharedDirectory>("sharedDirectory");
62
+ *
63
+ * ```typescript
64
+ * sharedString = testFluidObject.getSharedObject<SharedString>("sharedString");
65
+ * sharedDir = testFluidObject.getSharedObject<SharedDirectory>("sharedDirectory");
66
+ * ```
60
67
  */
61
68
  export declare class TestFluidObjectFactory implements IFluidDataStoreFactory {
62
69
  private readonly factoryEntries;
@@ -1 +1 @@
1
- {"version":3,"file":"testFluidObject.d.ts","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAqB,qBAAqB,EAAuB,MAAM,2BAA2B,CAAC;AAC1G,OAAO,EAAa,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EACH,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAA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,MAAM,EAAE,eAAe,CAAC;IAKpE;;;OAGG;IACU,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAehD,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;YAI7C,UAAU;CAc3B;AAED,oBAAY,sBAAsB,GAAG,QAAQ,CAAC,CAAC,MAAM,GAAG,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC;AAErF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,sBAAuB,YAAW,sBAAsB;IASrD,OAAO,CAAC,QAAQ,CAAC,cAAc;aACvB,IAAI;IATxB,IAAW,sBAAsB,SAAmB;IAEpD;;;;;OAKG;gBAC0B,cAAc,EAAE,sBAAsB,EAC/C,IAAI,SAA2B;IAEtC,oBAAoB,CAC7B,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,OAAO,GAClB,OAAO,CAAC,qBAAqB,CAAC;CAwCpC"}
@@ -77,17 +77,24 @@ exports.TestFluidObject = TestFluidObject;
77
77
  * with the object factories in the entry list. All the entries with an id other than undefined are passed to the
78
78
  * Fluid object so that it can create a shared object for each.
79
79
  *
80
- * For example, the following will create a Fluid object that creates and loads a SharedString and SharedDirectory. It
81
- * will add SparseMatrix to the data store's factory so that it can be created later.
82
- * new TestFluidObjectFactory([
83
- * [ "sharedString", SharedString.getFactory() ],
84
- * [ "sharedDirectory", SharedDirectory.getFactory() ],
85
- * [ undefined, SparseMatrix.getFactory() ],
86
- * ]);
80
+ * @example
81
+ * The following will create a Fluid object that creates and loads a SharedString and SharedDirectory.
82
+ * It will add SparseMatrix to the data store's factory so that it can be created later.
83
+ *
84
+ * ```typescript
85
+ * new TestFluidObjectFactory([
86
+ * [ "sharedString", SharedString.getFactory() ],
87
+ * [ "sharedDirectory", SharedDirectory.getFactory() ],
88
+ * [ undefined, SparseMatrix.getFactory() ],
89
+ * ]);
90
+ * ```
87
91
  *
88
92
  * The SharedString and SharedDirectory can be retrieved via getSharedObject() on the TestFluidObject as follows:
89
- * sharedString = testFluidObject.getSharedObject<SharedString>("sharedString");
90
- * sharedDir = testFluidObject.getSharedObject<SharedDirectory>("sharedDirectory");
93
+ *
94
+ * ```typescript
95
+ * sharedString = testFluidObject.getSharedObject<SharedString>("sharedString");
96
+ * sharedDir = testFluidObject.getSharedObject<SharedDirectory>("sharedDirectory");
97
+ * ```
91
98
  */
92
99
  class TestFluidObjectFactory {
93
100
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"testFluidObject.js","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAA4E;AAE5E,yDAA0G;AAC1G,6CAA4D;AAS5D;;;;GAIG;AACH,MAAa,eAAe;IA2BxB;;;;;;OAMG;IACH,YACoB,OAA+B,EAC/B,OAA+B,EAC/B,OAA+B,EAC9B,iBAA+C;QAHhD,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC9B,sBAAiB,GAAjB,iBAAiB,CAA8B;QAEhE,IAAI,CAAC,WAAW,GAAG,IAAI,6BAAiB,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACtF,CAAC;IAxCM,MAAM,CAAC,KAAK,CAAC,IAAI,CACpB,OAA+B,EAC/B,OAA+B,EAC/B,OAA+B,EAC/B,cAA4C,EAC5C,QAAiB;QAEjB,MAAM,WAAW,GAAG,IAAI,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACnF,MAAM,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAEvC,OAAO,WAAW,CAAC;IACvB,CAAC;IAED,IAAW,gBAAgB;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAW,cAAc;QACrB,OAAO,I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,GAAG,MAAM,OAAO,CAAC;YAC7B,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEP,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC/D,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,CAChC,OAAO,EACP,OAAO,EACP,OAAO,EACP,0BAA0B,EAC1B,QAAQ,CACX,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAvDD,wDAuDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultFluidObjectRequestHandler } from \"@fluidframework/aqueduct\";\nimport { IRequest, IResponse, IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { FluidObjectHandle, FluidDataStoreRuntime, mixinRequestHandler } from \"@fluidframework/datastore\";\nimport { SharedMap, ISharedMap } from \"@fluidframework/map\";\nimport {\n IFluidDataStoreContext,\n IFluidDataStoreFactory,\n IFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\nimport { IFluidDataStoreRuntime, IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { ITestFluidObject } from \"./interfaces\";\n\n/**\n * A test Fluid object that will create a shared object for each key-value pair in the factoryEntries passed to load.\n * The shared objects can be retrieved by passing the key of the entry to getSharedObject.\n * It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.\n */\nexport class TestFluidObject implements ITestFluidObject {\n public static async load(\n runtime: IFluidDataStoreRuntime,\n channel: IFluidDataStoreChannel,\n context: IFluidDataStoreContext,\n factoryEntries: Map<string, IChannelFactory>,\n existing: boolean,\n ) {\n const fluidObject = new TestFluidObject(runtime, channel, context, factoryEntries);\n await fluidObject.initialize(existing);\n\n return fluidObject;\n }\n\n public get ITestFluidObject() {\n return this;\n }\n\n public get IFluidLoadable() {\n return this;\n }\n\n public get handle(): IFluidHandle<this> { return this.innerHandle; }\n\n public root!: ISharedMap;\n private readonly innerHandle: IFluidHandle<this>;\n\n /**\n * Creates a new TestFluidObject.\n * @param runtime - The data store runtime.\n * @param context - The data store context.\n * @param factoryEntries - A list of id to IChannelFactory mapping. For each item in the list,\n * a shared object is created which can be retrieved by calling getSharedObject() with the id;\n */\n constructor(\n public readonly runtime: IFluidDataStoreRuntime,\n public readonly channel: IFluidDataStoreChannel,\n public readonly context: IFluidDataStoreContext,\n private readonly factoryEntriesMap: Map<string, IChannelFactory>,\n ) {\n this.innerHandle = new FluidObjectHandle(this, \"\", runtime.objectsRoutingContext);\n }\n\n /**\n * Retrieves a shared object with the given id.\n * @param id - The id of the shared object to retrieve.\n */\n public async getSharedObject<T = any>(id: string): Promise<T> {\n if (this.factoryEntriesMap === undefined) {\n throw new Error(\"Shared objects were not provided during creation.\");\n }\n\n for (const key of this.factoryEntriesMap.keys()) {\n if (key === id) {\n const handle = this.root.get<IFluidHandle>(id);\n return handle?.get() as unknown as T;\n }\n }\n\n throw new Error(`Shared object with id ${id} not found.`);\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n return defaultFluidObjectRequestHandler(this, request);\n }\n\n private async initialize(existing: boolean) {\n if (!existing) {\n this.root = SharedMap.create(this.runtime, \"root\");\n\n this.factoryEntriesMap.forEach((sharedObjectFactory: IChannelFactory, key: string) => {\n const sharedObject = this.runtime.createChannel(key, sharedObjectFactory.type);\n this.root.set(key, sharedObject.handle);\n });\n\n this.root.bindToContext();\n }\n\n this.root = await this.runtime.getChannel(\"root\") as ISharedMap;\n }\n}\n\nexport type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;\n\n/**\n * Creates a factory for a TestFluidObject with the given object factory entries. It creates a data store runtime\n * with the object factories in the entry list. All the entries with an id other than undefined are passed to the\n * Fluid object so that it can create a shared object for each.\n *\n * For example, the following will create a Fluid object that creates and loads a SharedString and SharedDirectory. It\n * will add SparseMatrix to the data store's factory so that it can be created later.\n * new TestFluidObjectFactory([\n * [ \"sharedString\", SharedString.getFactory() ],\n * [ \"sharedDirectory\", SharedDirectory.getFactory() ],\n* [ undefined, SparseMatrix.getFactory() ],\n * ]);\n *\n * The SharedString and SharedDirectory can be retrieved via getSharedObject() on the TestFluidObject as follows:\n * sharedString = testFluidObject.getSharedObject<SharedString>(\"sharedString\");\n * sharedDir = testFluidObject.getSharedObject<SharedDirectory>(\"sharedDirectory\");\n */\nexport class TestFluidObjectFactory implements IFluidDataStoreFactory {\n public get IFluidDataStoreFactory() { return this; }\n\n /**\n * Creates a new TestFluidObjectFactory.\n * @param factoryEntries - A list of id to IChannelFactory mapping. It creates a data store runtime with each\n * IChannelFactory. Entries with string ids are passed to the Fluid object so that it can create a shared object\n * for it.\n */\n constructor(private readonly factoryEntries: ChannelFactoryRegistry,\n public readonly type = \"TestFluidObjectFactory\") { }\n\n public async instantiateDataStore(\n context: IFluidDataStoreContext,\n existing: boolean,\n ): Promise<FluidDataStoreRuntime> {\n const dataTypes = new Map<string, IChannelFactory>();\n\n // Add SharedMap's factory which will be used to create the root map.\n const sharedMapFactory = SharedMap.getFactory();\n dataTypes.set(sharedMapFactory.type, sharedMapFactory);\n\n // Add the object factories to the list to be sent to data store runtime.\n for (const entry of this.factoryEntries) {\n const factory = entry[1];\n dataTypes.set(factory.type, factory);\n }\n\n // Create a map from the factory entries with entries that don't have the id as undefined. This will be\n // passed to the Fluid object.\n const factoryEntriesMapForObject = new Map<string, IChannelFactory>();\n for (const entry of this.factoryEntries) {\n const id = entry[0];\n if (id !== undefined) {\n factoryEntriesMapForObject.set(id, entry[1]);\n }\n }\n\n const runtimeClass = mixinRequestHandler(\n async (request: IRequest) => {\n const router = await routerP;\n return router.request(request);\n });\n\n const runtime = new runtimeClass(context, dataTypes, existing);\n const routerP = TestFluidObject.load(\n runtime,\n runtime,\n context,\n factoryEntriesMapForObject,\n existing,\n );\n\n return runtime;\n }\n}\n"]}
1
+ {"version":3,"file":"testFluidObject.js","sourceRoot":"","sources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["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultFluidObjectRequestHandler } from \"@fluidframework/aqueduct\";\nimport { IRequest, IResponse, IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { FluidObjectHandle, FluidDataStoreRuntime, mixinRequestHandler } from \"@fluidframework/datastore\";\nimport { SharedMap, ISharedMap } from \"@fluidframework/map\";\nimport {\n IFluidDataStoreContext,\n IFluidDataStoreFactory,\n IFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\nimport { IFluidDataStoreRuntime, IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { ITestFluidObject } from \"./interfaces\";\n\n/**\n * A test Fluid object that will create a shared object for each key-value pair in the factoryEntries passed to load.\n * The shared objects can be retrieved by passing the key of the entry to getSharedObject.\n * It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.\n */\nexport class TestFluidObject implements ITestFluidObject {\n public static async load(\n runtime: IFluidDataStoreRuntime,\n channel: IFluidDataStoreChannel,\n context: IFluidDataStoreContext,\n factoryEntries: Map<string, IChannelFactory>,\n existing: boolean,\n ) {\n const fluidObject = new TestFluidObject(runtime, channel, context, factoryEntries);\n await fluidObject.initialize(existing);\n\n return fluidObject;\n }\n\n public get ITestFluidObject() {\n return this;\n }\n\n public get IFluidLoadable() {\n return this;\n }\n\n public get handle(): IFluidHandle<this> { return this.innerHandle; }\n\n public root!: ISharedMap;\n private readonly innerHandle: IFluidHandle<this>;\n\n /**\n * Creates a new TestFluidObject.\n * @param runtime - The data store runtime.\n * @param context - The data store context.\n * @param factoryEntries - A list of id to IChannelFactory mapping. For each item in the list,\n * a shared object is created which can be retrieved by calling getSharedObject() with the id;\n */\n constructor(\n public readonly runtime: IFluidDataStoreRuntime,\n public readonly channel: IFluidDataStoreChannel,\n public readonly context: IFluidDataStoreContext,\n private readonly factoryEntriesMap: Map<string, IChannelFactory>,\n ) {\n this.innerHandle = new FluidObjectHandle(this, \"\", runtime.objectsRoutingContext);\n }\n\n /**\n * Retrieves a shared object with the given id.\n * @param id - The id of the shared object to retrieve.\n */\n public async getSharedObject<T = any>(id: string): Promise<T> {\n if (this.factoryEntriesMap === undefined) {\n throw new Error(\"Shared objects were not provided during creation.\");\n }\n\n for (const key of this.factoryEntriesMap.keys()) {\n if (key === id) {\n const handle = this.root.get<IFluidHandle>(id);\n return handle?.get() as unknown as T;\n }\n }\n\n throw new Error(`Shared object with id ${id} not found.`);\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n return defaultFluidObjectRequestHandler(this, request);\n }\n\n private async initialize(existing: boolean) {\n if (!existing) {\n this.root = SharedMap.create(this.runtime, \"root\");\n\n this.factoryEntriesMap.forEach((sharedObjectFactory: IChannelFactory, key: string) => {\n const sharedObject = this.runtime.createChannel(key, sharedObjectFactory.type);\n this.root.set(key, sharedObject.handle);\n });\n\n this.root.bindToContext();\n }\n\n this.root = await this.runtime.getChannel(\"root\") as ISharedMap;\n }\n}\n\nexport type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;\n\n/**\n * Creates a factory for a TestFluidObject with the given object factory entries. It creates a data store runtime\n * with the object factories in the entry list. All the entries with an id other than undefined are passed to the\n * Fluid object so that it can create a shared object for each.\n *\n * @example\n * The following will create a Fluid object that creates and loads a SharedString and SharedDirectory.\n * It will add SparseMatrix to the data store's factory so that it can be created later.\n *\n * ```typescript\n * new TestFluidObjectFactory([\n * [ \"sharedString\", SharedString.getFactory() ],\n * [ \"sharedDirectory\", SharedDirectory.getFactory() ],\n * [ undefined, SparseMatrix.getFactory() ],\n * ]);\n * ```\n *\n * The SharedString and SharedDirectory can be retrieved via getSharedObject() on the TestFluidObject as follows:\n *\n * ```typescript\n * sharedString = testFluidObject.getSharedObject<SharedString>(\"sharedString\");\n * sharedDir = testFluidObject.getSharedObject<SharedDirectory>(\"sharedDirectory\");\n * ```\n */\nexport class TestFluidObjectFactory implements IFluidDataStoreFactory {\n public get IFluidDataStoreFactory() { return this; }\n\n /**\n * Creates a new TestFluidObjectFactory.\n * @param factoryEntries - A list of id to IChannelFactory mapping. It creates a data store runtime with each\n * IChannelFactory. Entries with string ids are passed to the Fluid object so that it can create a shared object\n * for it.\n */\n constructor(private readonly factoryEntries: ChannelFactoryRegistry,\n public readonly type = \"TestFluidObjectFactory\") { }\n\n public async instantiateDataStore(\n context: IFluidDataStoreContext,\n existing: boolean,\n ): Promise<FluidDataStoreRuntime> {\n const dataTypes = new Map<string, IChannelFactory>();\n\n // Add SharedMap's factory which will be used to create the root map.\n const sharedMapFactory = SharedMap.getFactory();\n dataTypes.set(sharedMapFactory.type, sharedMapFactory);\n\n // Add the object factories to the list to be sent to data store runtime.\n for (const entry of this.factoryEntries) {\n const factory = entry[1];\n dataTypes.set(factory.type, factory);\n }\n\n // Create a map from the factory entries with entries that don't have the id as undefined. This will be\n // passed to the Fluid object.\n const factoryEntriesMapForObject = new Map<string, IChannelFactory>();\n for (const entry of this.factoryEntries) {\n const id = entry[0];\n if (id !== undefined) {\n factoryEntriesMapForObject.set(id, entry[1]);\n }\n }\n\n const runtimeClass = mixinRequestHandler(\n async (request: IRequest) => {\n const router = await routerP;\n return router.request(request);\n });\n\n const runtime = new runtimeClass(context, dataTypes, existing);\n const routerP = TestFluidObject.load(\n runtime,\n runtime,\n context,\n factoryEntriesMapForObject,\n existing,\n );\n\n return runtime;\n }\n}\n"]}
@@ -40,7 +40,7 @@ export interface ITestObjectProvider {
40
40
  urlResolver: IUrlResolver;
41
41
  defaultCodeDetails: IFluidCodeDetails;
42
42
  opProcessingController: IOpProcessingController;
43
- ensureSynchronized(): Promise<void>;
43
+ ensureSynchronized(timeoutDuration?: number): Promise<void>;
44
44
  reset(): void;
45
45
  documentId: string;
46
46
  driver: ITestDriver;
@@ -101,6 +101,7 @@ export declare class TestObjectProvider implements ITestObjectProvider {
101
101
  */
102
102
  constructor(LoaderConstructor: typeof Loader, driver: ITestDriver, createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint);
103
103
  get logger(): EventAndErrorTrackingLogger;
104
+ set logger(logger: EventAndErrorTrackingLogger);
104
105
  get documentServiceFactory(): IDocumentServiceFactory;
105
106
  get urlResolver(): IUrlResolver;
106
107
  get documentId(): string;
@@ -146,7 +147,7 @@ export declare class TestObjectProvider implements ITestObjectProvider {
146
147
  */
147
148
  loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>;
148
149
  reset(): void;
149
- ensureSynchronized(): Promise<void>;
150
+ ensureSynchronized(timeoutDuration?: number): Promise<void>;
150
151
  waitContainerToCatchUp(container: IContainer): Promise<boolean>;
151
152
  updateDocumentId(resolvedUrl: IResolvedUrl | undefined): void;
152
153
  resetLoaderContainerTracker(syncSummarizerClients?: boolean): void;
@@ -1 +1 @@
1
- {"version":3,"file":"testObjectProvider.d.ts","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACvH,OAAO,EACH,YAAY,EACZ,MAAM,EAET,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEzG,OAAO,EAAE,WAAW,EAAmB,MAAM,yCAAyC,CAAC;AAEvF,OAAO,EAAgC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAmB,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAO3D,MAAM,WAAW,uBAA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AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,2BAA2B,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,qBAa9G"}
@@ -140,6 +140,9 @@ class TestObjectProvider {
140
140
  }
141
141
  return this._logger;
142
142
  }
143
+ set logger(logger) {
144
+ this._logger = logger;
145
+ }
143
146
  get documentServiceFactory() {
144
147
  if (!this._documentServiceFactory) {
145
148
  this._documentServiceFactory = this.driver.createDocumentServiceFactory();
@@ -257,8 +260,12 @@ class TestObjectProvider {
257
260
  this._logger = undefined;
258
261
  this._documentCreated = false;
259
262
  }
260
- async ensureSynchronized() {
261
- return this._loaderContainerTracker.ensureSynchronized();
263
+ async ensureSynchronized(timeoutDuration) {
264
+ var _a, _b;
265
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
266
+ return !timeoutDuration
267
+ ? this._loaderContainerTracker.ensureSynchronized()
268
+ : (_b = (_a = this._loaderContainerTracker).ensureSynchronizedWithTimeout) === null || _b === void 0 ? void 0 : _b.call(_a, timeoutDuration);
262
269
  }
263
270
  async waitContainerToCatchUp(container) {
264
271
  // The original waitContainerToCatchUp() from container loader uses either Container.resume()