@fluidframework/test-utils 0.59.2001 → 0.59.3000-66610

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.
package/dist/debug.js CHANGED
@@ -10,6 +10,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.debug = void 0;
11
11
  const debug_1 = __importDefault(require("debug"));
12
12
  const packageVersion_1 = require("./packageVersion");
13
- exports.debug = debug_1.default("fluid:test-utils");
14
- exports.debug(`Package: ${packageVersion_1.pkgName} - Version: ${packageVersion_1.pkgVersion}`);
13
+ exports.debug = (0, debug_1.default)("fluid:test-utils");
14
+ (0, exports.debug)(`Package: ${packageVersion_1.pkgName} - Version: ${packageVersion_1.pkgVersion}`);
15
15
  //# sourceMappingURL=debug.js.map
package/dist/debug.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,kDAAkC;AAClC,qDAAuD;AAE1C,QAAA,KAAK,GAAG,eAAa,CAAC,kBAAkB,CAAC,CAAC;AACvD,aAAK,CAAC,YAAY,wBAAO,eAAe,2BAAU,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport registerDebug from \"debug\";\nimport { pkgName, pkgVersion } from \"./packageVersion\";\n\nexport const debug = registerDebug(\"fluid:test-utils\");\ndebug(`Package: ${pkgName} - Version: ${pkgVersion}`);\n"]}
1
+ {"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,kDAAkC;AAClC,qDAAuD;AAE1C,QAAA,KAAK,GAAG,IAAA,eAAa,EAAC,kBAAkB,CAAC,CAAC;AACvD,IAAA,aAAK,EAAC,YAAY,wBAAO,eAAe,2BAAU,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport registerDebug from \"debug\";\nimport { pkgName, pkgVersion } from \"./packageVersion\";\n\nexport const debug = registerDebug(\"fluid:test-utils\");\ndebug(`Package: ${pkgName} - Version: ${pkgVersion}`);\n"]}
@@ -239,8 +239,8 @@ class LoaderContainerTracker {
239
239
  if (!("clientSequenceNumber" in deltaManager)) {
240
240
  deltaManager = deltaManager.connectionManager;
241
241
  }
242
- common_utils_1.assert("clientSequenceNumber" in deltaManager, "no clientSequenceNumber");
243
- common_utils_1.assert("clientSequenceNumberObserved" in deltaManager, "no clientSequenceNumber");
242
+ (0, common_utils_1.assert)("clientSequenceNumber" in deltaManager, "no clientSequenceNumber");
243
+ (0, common_utils_1.assert)("clientSequenceNumberObserved" in deltaManager, "no clientSequenceNumber");
244
244
  return deltaManager.clientSequenceNumber ===
245
245
  deltaManager.clientSequenceNumberObserved + trailingNoOps;
246
246
  });
@@ -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;IAAnC;QACqB,eAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;QAC7D,uBAAkB,GAAW,CAAC,CAAC;IAkgB3C,CAAC;IAhgBG;;;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;gBA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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 /**\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) { 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) { 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 !== undefined && record.paused) {\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);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O,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;AApgBD,wDAogBC","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 /**\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) { 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) { 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 !== undefined && record.paused) {\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"]}
@@ -37,8 +37,8 @@ class LocalCodeLoader {
37
37
  fluidModule = { fluidExport: maybeExport };
38
38
  }
39
39
  else {
40
- assert_1.default(maybeExport.IFluidDataStoreFactory !== undefined);
41
- const defaultFactory = runtime_utils_1.createDataStoreFactory("default", maybeExport.IFluidDataStoreFactory);
40
+ (0, assert_1.default)(maybeExport.IFluidDataStoreFactory !== undefined);
41
+ const defaultFactory = (0, runtime_utils_1.createDataStoreFactory)("default", maybeExport.IFluidDataStoreFactory);
42
42
  const innerRequestHandler = async (request, runtime) => runtime.IFluidHandleContext.resolveHandle(request);
43
43
  fluidModule = {
44
44
  fluidExport: Object.assign(Object.assign({}, maybeExport), { IRuntimeFactory: new aqueduct_1.ContainerRuntimeFactoryWithDefaultDataStore(defaultFactory, [[defaultFactory.type, Promise.resolve(defaultFactory)]], undefined, [innerRequestHandler], runtimeOptions) }),
@@ -1 +1 @@
1
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W,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,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,IAAI,KAAa,CAAC;YAElB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACxB,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE;gBACpC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC;aAC1B;iBAAM;gBACH,KAAK,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,M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,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"]}
@@ -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 = "0.59.2001";
8
+ export declare const pkgVersion = "0.59.3000-66610";
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,cAAc,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,oBAAoB,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 = "0.59.2001";
11
+ exports.pkgVersion = "0.59.3000-66610";
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,WAAW,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 = \"0.59.2001\";\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,iBAAiB,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 = \"0.59.3000-66610\";\n"]}
package/dist/retry.js CHANGED
@@ -13,7 +13,7 @@ const retry = async (callback, defaultValue, maxTries, backOffMs) => {
13
13
  return result;
14
14
  }
15
15
  catch (error) {
16
- await common_utils_1.delay(currentTry * backOffMs);
16
+ await (0, common_utils_1.delay)(currentTry * backOffMs);
17
17
  }
18
18
  }
19
19
  return Promise.resolve(defaultValue);
package/dist/retry.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAqD;AAErD,MAAM,KAAK,GAAG,KAAK,EACf,QAA0B,EAC1B,YAAe,EACf,QAAgB,EAChB,SAAiB,EACP,EAAE;IACZ,KAAK,IAAI,UAAU,GAAG,CAAC,EAAE,UAAU,IAAI,QAAQ,EAAE,UAAU,EAAE,EAAE;QAC3D,IAAI;YACA,MAAM,MAAM,GAAG,MAAM,QAAQ,EAAE,CAAC;YAChC,OAAO,MAAM,CAAC;SACjB;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,oBAAK,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;SACvC;KACJ;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACI,MAAM,sBAAsB,GAAG,KAAK,EACvC,QAA0B,EAC1B,KAA4B,EAC5B,YAAe,EACf,QAAQ,GAAG,EAAE,EACb,SAAS,GAAG,EAAE,EACJ,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;IAC9B,MAAM,KAAK,GAAG,MAAM,QAAQ,EAAE,CAAC;IAC/B,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE;QACd,OAAO,KAAK,CAAC;KAChB;IAED,MAAM,KAAK,CAAC,WAAW,CAAC,CAAC;AAC7B,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAbzB,QAAA,sBAAsB,0BAaG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { delay } from \"@fluidframework/common-utils\";\n\nconst retry = async <T>(\n callback: () => Promise<T>,\n defaultValue: T,\n maxTries: number,\n backOffMs: number,\n): Promise<T> => {\n for (let currentTry = 1; currentTry <= maxTries; currentTry++) {\n try {\n const result = await callback();\n return result;\n } catch (error) {\n await delay(currentTry * backOffMs);\n }\n }\n\n return Promise.resolve(defaultValue);\n};\n\n/**\n * Simple retry mechanism with linear back off to call\n * a function which may eventually return an accepted value.\n *\n * @param callback - the function to execute\n * @param check - the function to check if the value is acceptable\n * @param defaultValue - the default value\n * @param maxTries - maximum number of attempts\n * @param backOffMs - back off between attempts in milliseconds\n * @returns the actual value from the callback when successful or the default value otherwise\n */\nexport const retryWithEventualValue = async <T>(\n callback: () => Promise<T>,\n check: (value: T) => boolean,\n defaultValue: T,\n maxTries = 20,\n backOffMs = 50,\n): Promise<T> => retry(async () => {\n const value = await callback();\n if (check(value)) {\n return value;\n }\n\n throw Error(\"Not ready\");\n}, defaultValue, maxTries, backOffMs);\n"]}
1
+ {"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAqD;AAErD,MAAM,KAAK,GAAG,KAAK,EACf,QAA0B,EAC1B,YAAe,EACf,QAAgB,EAChB,SAAiB,EACP,EAAE;IACZ,KAAK,IAAI,UAAU,GAAG,CAAC,EAAE,UAAU,IAAI,QAAQ,EAAE,UAAU,EAAE,EAAE;QAC3D,IAAI;YACA,MAAM,MAAM,GAAG,MAAM,QAAQ,EAAE,CAAC;YAChC,OAAO,MAAM,CAAC;SACjB;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,IAAA,oBAAK,EAAC,UAAU,GAAG,SAAS,CAAC,CAAC;SACvC;KACJ;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACI,MAAM,sBAAsB,GAAG,KAAK,EACvC,QAA0B,EAC1B,KAA4B,EAC5B,YAAe,EACf,QAAQ,GAAG,EAAE,EACb,SAAS,GAAG,EAAE,EACJ,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;IAC9B,MAAM,KAAK,GAAG,MAAM,QAAQ,EAAE,CAAC;IAC/B,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE;QACd,OAAO,KAAK,CAAC;KAChB;IAED,MAAM,KAAK,CAAC,WAAW,CAAC,CAAC;AAC7B,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAbzB,QAAA,sBAAsB,0BAaG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { delay } from \"@fluidframework/common-utils\";\n\nconst retry = async <T>(\n callback: () => Promise<T>,\n defaultValue: T,\n maxTries: number,\n backOffMs: number,\n): Promise<T> => {\n for (let currentTry = 1; currentTry <= maxTries; currentTry++) {\n try {\n const result = await callback();\n return result;\n } catch (error) {\n await delay(currentTry * backOffMs);\n }\n }\n\n return Promise.resolve(defaultValue);\n};\n\n/**\n * Simple retry mechanism with linear back off to call\n * a function which may eventually return an accepted value.\n *\n * @param callback - the function to execute\n * @param check - the function to check if the value is acceptable\n * @param defaultValue - the default value\n * @param maxTries - maximum number of attempts\n * @param backOffMs - back off between attempts in milliseconds\n * @returns the actual value from the callback when successful or the default value otherwise\n */\nexport const retryWithEventualValue = async <T>(\n callback: () => Promise<T>,\n check: (value: T) => boolean,\n defaultValue: T,\n maxTries = 20,\n backOffMs = 50,\n): Promise<T> => retry(async () => {\n const value = await callback();\n if (check(value)) {\n return value;\n }\n\n throw Error(\"Not ready\");\n}, defaultValue, maxTries, backOffMs);\n"]}
@@ -40,7 +40,7 @@ const createTestContainerRuntimeFactory = (containerRuntimeCtor) => {
40
40
  const runtime = await containerRuntimeCtor.load(context, [
41
41
  ["default", Promise.resolve(this.dataStoreFactory)],
42
42
  [this.type, Promise.resolve(this.dataStoreFactory)],
43
- ], request_handler_1.buildRuntimeRequestHandler(aqueduct_1.defaultRouteRequestHandler("default"), ...this.requestHandlers), this.runtimeOptions, undefined, // containerScope
43
+ ], (0, request_handler_1.buildRuntimeRequestHandler)((0, aqueduct_1.defaultRouteRequestHandler)("default"), ...this.requestHandlers), this.runtimeOptions, undefined, // containerScope
44
44
  existing);
45
45
  return runtime;
46
46
  }
@@ -50,5 +50,5 @@ exports.createTestContainerRuntimeFactory = createTestContainerRuntimeFactory;
50
50
  /**
51
51
  * A container runtime factory that allows you to set runtime options
52
52
  */
53
- exports.TestContainerRuntimeFactory = exports.createTestContainerRuntimeFactory(container_runtime_1.ContainerRuntime);
53
+ exports.TestContainerRuntimeFactory = (0, exports.createTestContainerRuntimeFactory)(container_runtime_1.ContainerRuntime);
54
54
  //# sourceMappingURL=testContainerRuntimeFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"testContainerRuntimeFactory.js","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAsE;AAEtE,yEAA+F;AAE/F,qEAEmE;AAEnE,iEAAqE;AAErE;;GAEG;AACI,MAAM,iCAAiC,GAAG,CAAC,oBAA6C,EAAE,EAAE;IAC/F,OAAO,KAAM,SAAQ,oCAAoB;QACrC,YACW,IAAY,EACZ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CACtB,qCAA0B,CAAC,SAAS,CAAC,EACrC,GAAG,IAAI,CAAC,eAAe,CAC1B,EACD,IAAI,CAAC,cAAc,EACnB,SAAS,EAAE,iBAAiB;YAC5B,QAAQ,CACX,CAAC;YAEF,OAAO,OAAO,CAAC;QACnB,CAAC;KACJ,CAAC;AACN,CAAC,CAAC;AAnDW,QAAA,iCAAiC,qCAmD5C;AAEF;;GAEG;AACU,QAAA,2BAA2B,GAAG,yCAAiC,CAAC,oCAAgB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultRouteRequestHandler } from \"@fluidframework/aqueduct\";\nimport { IContainerContext, IRuntime } from \"@fluidframework/container-definitions\";\nimport { ContainerRuntime, IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport {\n buildRuntimeRequestHandler,\n RuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\nimport { RuntimeFactoryHelper } from \"@fluidframework/runtime-utils\";\n\n/**\n * Create a container runtime factory class that allows you to set runtime options\n */\nexport const createTestContainerRuntimeFactory = (containerRuntimeCtor: typeof ContainerRuntime) => {\n return class extends RuntimeFactoryHelper {\n constructor(\n public type: string,\n public dataStoreFactory: IFluidDataStoreFactory,\n public runtimeOptions: IContainerRuntimeOptions = {\n summaryOptions: { initialSummarizerDelayMs: 0 },\n },\n public requestHandlers: RuntimeRequestHandler[] = [],\n ) {\n super();\n }\n\n public async instantiateFirstTime(runtime: ContainerRuntime): Promise<void> {\n await runtime.createRootDataStore(this.type, \"default\");\n\n // Test detached creation\n const root2Context = runtime.createDetachedRootDataStore([this.type], \"default2\");\n const root2Runtime = await this.dataStoreFactory.instantiateDataStore(root2Context, /* existing */ false);\n await root2Context.attachRuntime(this.dataStoreFactory, root2Runtime);\n }\n\n public async instantiateFromExisting(runtime: ContainerRuntime): Promise<void> {\n // Validate we can load root data stores.\n // We should be able to load any data store that was created in initializeFirstTime!\n await runtime.getRootDataStore(\"default\");\n await runtime.getRootDataStore(\"default2\");\n }\n\n async preInitialize(\n context: IContainerContext,\n existing: boolean,\n ): Promise<IRuntime & IContainerRuntime> {\n const runtime: ContainerRuntime = await containerRuntimeCtor.load(\n context,\n [\n [\"default\", Promise.resolve(this.dataStoreFactory)],\n [this.type, Promise.resolve(this.dataStoreFactory)],\n ],\n buildRuntimeRequestHandler(\n defaultRouteRequestHandler(\"default\"),\n ...this.requestHandlers,\n ),\n this.runtimeOptions,\n undefined, // containerScope\n existing,\n );\n\n return runtime;\n }\n };\n};\n\n/**\n * A container runtime factory that allows you to set runtime options\n */\nexport const TestContainerRuntimeFactory = createTestContainerRuntimeFactory(ContainerRuntime);\n"]}
1
+ {"version":3,"file":"testContainerRuntimeFactory.js","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAsE;AAEtE,yEAA+F;AAE/F,qEAEmE;AAEnE,iEAAqE;AAErE;;GAEG;AACI,MAAM,iCAAiC,GAAG,CAAC,oBAA6C,EAAE,EAAE;IAC/F,OAAO,KAAM,SAAQ,oCAAoB;QACrC,YACW,IAAY,EACZ,gBAAwC,EACxC,iBAA2C;YAC9C,cAAc,EAAE,EAAE,wBAAwB,EAAE,CAAC,EAAE;SAClD,EACM,kBAA2C,EAAE;YAEpD,KAAK,EAAE,CAAC;YAPD,SAAI,GAAJ,IAAI,CAAQ;YACZ,qBAAgB,GAAhB,gBAAgB,CAAwB;YACxC,mBAAc,GAAd,cAAc,CAEpB;YACM,oBAAe,GAAf,eAAe,CAA8B;QAGxD,CAAC;QAEM,KAAK,CAAC,oBAAoB,CAAC,OAAyB;YACvD,MAAM,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAExD,yBAAyB;YACzB,MAAM,YAAY,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;YAClF,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,YAAY,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;YAC1G,MAAM,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAC1E,CAAC;QAEM,KAAK,CAAC,uBAAuB,CAAC,OAAyB;YAC1D,yCAAyC;YACzC,oFAAoF;YACpF,MAAM,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YAC1C,MAAM,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAC/C,CAAC;QAED,KAAK,CAAC,aAAa,CACf,OAA0B,EAC1B,QAAiB;YAEjB,MAAM,OAAO,GAAqB,MAAM,oBAAoB,CAAC,IAAI,CAC7D,OAAO,EACP;gBACI,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;gBACnD,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aACtD,EACD,IAAA,4CAA0B,EACtB,IAAA,qCAA0B,EAAC,SAAS,CAAC,EACrC,GAAG,IAAI,CAAC,eAAe,CAC1B,EACD,IAAI,CAAC,cAAc,EACnB,SAAS,EAAE,iBAAiB;YAC5B,QAAQ,CACX,CAAC;YAEF,OAAO,OAAO,CAAC;QACnB,CAAC;KACJ,CAAC;AACN,CAAC,CAAC;AAnDW,QAAA,iCAAiC,qCAmD5C;AAEF;;GAEG;AACU,QAAA,2BAA2B,GAAG,IAAA,yCAAiC,EAAC,oCAAgB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultRouteRequestHandler } from \"@fluidframework/aqueduct\";\nimport { IContainerContext, IRuntime } from \"@fluidframework/container-definitions\";\nimport { ContainerRuntime, IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport {\n buildRuntimeRequestHandler,\n RuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\nimport { RuntimeFactoryHelper } from \"@fluidframework/runtime-utils\";\n\n/**\n * Create a container runtime factory class that allows you to set runtime options\n */\nexport const createTestContainerRuntimeFactory = (containerRuntimeCtor: typeof ContainerRuntime) => {\n return class extends RuntimeFactoryHelper {\n constructor(\n public type: string,\n public dataStoreFactory: IFluidDataStoreFactory,\n public runtimeOptions: IContainerRuntimeOptions = {\n summaryOptions: { initialSummarizerDelayMs: 0 },\n },\n public requestHandlers: RuntimeRequestHandler[] = [],\n ) {\n super();\n }\n\n public async instantiateFirstTime(runtime: ContainerRuntime): Promise<void> {\n await runtime.createRootDataStore(this.type, \"default\");\n\n // Test detached creation\n const root2Context = runtime.createDetachedRootDataStore([this.type], \"default2\");\n const root2Runtime = await this.dataStoreFactory.instantiateDataStore(root2Context, /* existing */ false);\n await root2Context.attachRuntime(this.dataStoreFactory, root2Runtime);\n }\n\n public async instantiateFromExisting(runtime: ContainerRuntime): Promise<void> {\n // Validate we can load root data stores.\n // We should be able to load any data store that was created in initializeFirstTime!\n await runtime.getRootDataStore(\"default\");\n await runtime.getRootDataStore(\"default2\");\n }\n\n async preInitialize(\n context: IContainerContext,\n existing: boolean,\n ): Promise<IRuntime & IContainerRuntime> {\n const runtime: ContainerRuntime = await containerRuntimeCtor.load(\n context,\n [\n [\"default\", Promise.resolve(this.dataStoreFactory)],\n [this.type, Promise.resolve(this.dataStoreFactory)],\n ],\n buildRuntimeRequestHandler(\n defaultRouteRequestHandler(\"default\"),\n ...this.requestHandlers,\n ),\n this.runtimeOptions,\n undefined, // containerScope\n existing,\n );\n\n return runtime;\n }\n };\n};\n\n/**\n * A container runtime factory that allows you to set runtime options\n */\nexport const TestContainerRuntimeFactory = createTestContainerRuntimeFactory(ContainerRuntime);\n"]}
@@ -57,7 +57,7 @@ class TestFluidObject {
57
57
  throw new Error(`Shared object with id ${id} not found.`);
58
58
  }
59
59
  async request(request) {
60
- return aqueduct_1.defaultFluidObjectRequestHandler(this, request);
60
+ return (0, aqueduct_1.defaultFluidObjectRequestHandler)(this, request);
61
61
  }
62
62
  async initialize(existing) {
63
63
  if (!existing) {
@@ -120,7 +120,7 @@ class TestFluidObjectFactory {
120
120
  factoryEntriesMapForObject.set(id, entry[1]);
121
121
  }
122
122
  }
123
- const runtimeClass = datastore_1.mixinRequestHandler(async (request) => {
123
+ const runtimeClass = (0, datastore_1.mixinRequestHandler)(async (request) => {
124
124
  const router = await routerP;
125
125
  return router.request(request);
126
126
  });
@@ -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,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ACpB,IAAI,EAAE,KAAK,SAAS,EAAE;gBAClB,0BAA0B,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aAChD;SACJ;QAED,MAAM,YAAY,GAAG,+BAAmB,CACpC,KAAK,EAAE,OAAiB,EAAE,EAAE;YACxB,MAAM,MAAM,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":["../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,IAAI,CAAC;IAChB,CAAC;IAED,IAAW,MAAM,KAAyB,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAqBpE;;;OAGG;IACI,KAAK,CAAC,eAAe,CAAU,EAAU;QAC5C,IAAI,IAAI,CAAC,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AAE,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 +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,sBAA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EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC;IAkB/F;;;;;OAKG;IACU,iBAAiB,CAC1B,mBAAmB,CAAC,EAAE,oBAAoB,EAC1C,aAAa,CAAC,EAAE,cAAc,GAC/B,OAAO,CAAC,UAAU,CAAC;IAUf,KAAK;IAaC,kBAAkB;IAI/B,gBAAgB,CAAC,WAAW,EAAE,YAAY,GAAG,SAAS;CAGzD;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,2BAA2B,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,qBAa9G"}
@@ -21,20 +21,20 @@ var DataObjectFactoryType;
21
21
  DataObjectFactoryType[DataObjectFactoryType["Primed"] = 0] = "Primed";
22
22
  DataObjectFactoryType[DataObjectFactoryType["Test"] = 1] = "Test";
23
23
  })(DataObjectFactoryType = exports.DataObjectFactoryType || (exports.DataObjectFactoryType = {}));
24
- const createDocumentId = () => uuid_1.v4();
24
+ const createDocumentId = () => (0, uuid_1.v4)();
25
25
  exports.createDocumentId = createDocumentId;
26
26
  /**
27
27
  * Document ID is treated differently by test drivers. The key difference is in generating
28
28
  * a new container ID and accessing the container in multi-instance test cases.
29
29
  */
30
30
  function getDocumentIdStrategy(type) {
31
- let documentId = exports.createDocumentId();
31
+ let documentId = (0, exports.createDocumentId)();
32
32
  switch (type) {
33
33
  case "odsp":
34
34
  return {
35
35
  get: () => documentId,
36
36
  update: () => { },
37
- reset: () => { documentId = exports.createDocumentId(); },
37
+ reset: () => { documentId = (0, exports.createDocumentId)(); },
38
38
  };
39
39
  default:
40
40
  return {
@@ -42,10 +42,10 @@ function getDocumentIdStrategy(type) {
42
42
  update: (resolvedUrl) => {
43
43
  var _a;
44
44
  // Extract the document ID from the resolved container's URL and reset the ID property
45
- driver_utils_1.ensureFluidResolvedUrl(resolvedUrl);
45
+ (0, driver_utils_1.ensureFluidResolvedUrl)(resolvedUrl);
46
46
  documentId = (_a = resolvedUrl.id) !== null && _a !== void 0 ? _a : documentId;
47
47
  },
48
- reset: () => { documentId = exports.createDocumentId(); },
48
+ reset: () => { documentId = (0, exports.createDocumentId)(); },
49
49
  };
50
50
  }
51
51
  }
@@ -194,7 +194,7 @@ class TestObjectProvider {
194
194
  throw new Error("Only one container/document can be created. To load the container/document use loadContainer");
195
195
  }
196
196
  const loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);
197
- const container = await localLoader_1.createAndAttachContainer(defaultCodeDetails, loader, this.driver.createCreateNewRequest(this.documentId));
197
+ const container = await (0, localLoader_1.createAndAttachContainer)(defaultCodeDetails, loader, this.driver.createCreateNewRequest(this.documentId));
198
198
  this._documentCreated = true;
199
199
  // r11s driver will generate a new ID for the new container.
200
200
  // update the document ID with the actual ID of the attached container.
@@ -223,7 +223,7 @@ class TestObjectProvider {
223
223
  throw new Error("Only one container/document can be created. To load the container/document use loadTestContainer");
224
224
  }
225
225
  const loader = this.makeTestLoader(testContainerConfig);
226
- const container = await localLoader_1.createAndAttachContainer(defaultCodeDetails, loader, this.driver.createCreateNewRequest(this.documentId));
226
+ const container = await (0, localLoader_1.createAndAttachContainer)(defaultCodeDetails, loader, this.driver.createCreateNewRequest(this.documentId));
227
227
  this._documentCreated = true;
228
228
  // r11s driver will generate a new ID for the new container.
229
229
  // update the document ID with the actual ID of the attached container.
@@ -242,7 +242,7 @@ class TestObjectProvider {
242
242
  url: await this.driver.createContainerUrl(this.documentId),
243
243
  headers: requestHeader,
244
244
  });
245
- await container_loader_1.waitContainerToCatchUp(container);
245
+ await (0, container_loader_1.waitContainerToCatchUp)(container);
246
246
  return container;
247
247
  }
248
248
  reset() {
@@ -1 +1 @@
1
- {"version":3,"file":"testObjectProvider.js","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,uEAAgG;AAIhG,+DAAsE;AAEtE,+BAAkC;AAClC,qEAAgG;AAChG,qEAAkE;AAClE,uDAAqE;AACrE,+CAAyD;AAGzD,MAAM,kBAAkB,GAA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port { IContainer, IHostLoader, IFluidCodeDetails } from \"@fluidframework/container-definitions\";\nimport { ITelemetryGenericEvent, ITelemetryBaseLogger, ITelemetryBaseEvent } from \"@fluidframework/common-definitions\";\nimport { ILoaderProps, Loader, waitContainerToCatchUp } from \"@fluidframework/container-loader\";\nimport { IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\nimport { IRequestHeader } from \"@fluidframework/core-interfaces\";\nimport { IDocumentServiceFactory, IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { ensureFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport { ITestDriver, TestDriverTypes } from \"@fluidframework/test-driver-definitions\";\nimport { v4 as uuid } from \"uuid\";\nimport { ChildLogger, MultiSinkLogger, TelemetryLogger } from \"@fluidframework/telemetry-utils\";\nimport { LoaderContainerTracker } from \"./loaderContainerTracker\";\nimport { fluidEntryPoint, LocalCodeLoader } from \"./localCodeLoader\";\nimport { createAndAttachContainer } from \"./localLoader\";\nimport { ChannelFactoryRegistry } from \"./testFluidObject\";\n\nconst defaultCodeDetails: IFluidCodeDetails = {\n package: \"defaultTestPackage\",\n config: {},\n};\n\nexport interface IOpProcessingController {\n processIncoming(...containers: IContainer[]): Promise<void>;\n processOutgoing(...containers: IContainer[]): Promise<void>;\n pauseProcessing(...containers: IContainer[]): Promise<void>;\n resumeProcessing(...containers: IContainer[]): void;\n}\n\nexport interface ITestObjectProvider {\n createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint;\n createLoader(\n packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n loaderProps?: Partial<ILoaderProps>,\n ): IHostLoader;\n createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>): Promise<IContainer>;\n loadContainer(\n entryPoint: fluidEntryPoint,\n loaderProps?: Partial<ILoaderProps>,\n requestHeader?: IRequestHeader,\n ): Promise<IContainer>;\n\n /**\n * Used to create a test Container. The Loader/ContainerRuntime/DataRuntime might be different versioned.\n * In generateLocalCompatTest(), this Container and its runtime will be arbitrarily-versioned.\n */\n makeTestLoader(testContainerConfig?: ITestContainerConfig): IHostLoader,\n makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>,\n loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>,\n /**\n *\n * @param url - Resolved container URL\n */\n updateDocumentId(url: IResolvedUrl | undefined): void,\n\n logger: ITelemetryBaseLogger,\n documentServiceFactory: IDocumentServiceFactory,\n urlResolver: IUrlResolver,\n defaultCodeDetails: IFluidCodeDetails,\n opProcessingController: IOpProcessingController,\n\n ensureSynchronized(): Promise<void>;\n reset(): void,\n\n documentId: string,\n driver: ITestDriver;\n}\n\nexport enum DataObjectFactoryType {\n Primed, // default\n Test,\n}\n\nexport interface ITestContainerConfig {\n /** TestFluidDataObject instead of PrimedDataStore */\n fluidDataObjectType?: DataObjectFactoryType,\n\n /** An array of channel name and DDS factory pair to create on container creation time */\n registry?: ChannelFactoryRegistry,\n\n /** Container runtime options for the container instance */\n runtimeOptions?: IContainerRuntimeOptions,\n\n /** Loader options for the loader used to create containers */\n loaderProps?: Partial<ILoaderProps>,\n}\n\nexport const createDocumentId = (): string => uuid();\n\ninterface IDocumentIdStrategy {\n get(): string;\n update(resolvedUrl?: IResolvedUrl): void;\n reset(): void;\n}\n\n/**\n * Document ID is treated differently by test drivers. The key difference is in generating\n * a new container ID and accessing the container in multi-instance test cases.\n */\nfunction getDocumentIdStrategy(type?: TestDriverTypes): IDocumentIdStrategy {\n let documentId = createDocumentId();\n switch (type) {\n case \"odsp\":\n return {\n get: () => documentId,\n update: () => { }, // do not update the document ID in odsp test cases\n reset: () => { documentId = createDocumentId(); },\n };\n default:\n return {\n get: () => documentId,\n update: (resolvedUrl?: IResolvedUrl) => {\n // Extract the document ID from the resolved container's URL and reset the ID property\n ensureFluidResolvedUrl(resolvedUrl);\n documentId = resolvedUrl.id ?? documentId;\n },\n reset: () => { documentId = createDocumentId(); },\n };\n }\n}\n\n/**\n * This class tracks events. It allows specifying expected events, which will be looked for in order.\n * It also tracks all unexpected errors.\n * At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and\n * any expected events that have not occurred.\n */\nexport class EventAndErrorTrackingLogger extends TelemetryLogger {\n constructor(private readonly baseLogger: ITelemetryBaseLogger) {\n super();\n }\n\n private readonly expectedEvents: ({index: number, event: ITelemetryGenericEvent | undefined} | undefined)[] = [];\n private readonly unexpectedErrors: ITelemetryBaseEvent[] = [];\n\n public registerExpectedEvent(... orderedExpectedEvents: ITelemetryGenericEvent[]) {\n if(this.expectedEvents.length !== 0) {\n // we don't have to error here. just no reason not to. given the events must be\n // ordered it could be tricky to figure out problems around multiple registrations.\n throw new Error(\n \"Expected events already registered.\\n\"\n + \"Call reportAndClearTrackedEvents to clear them before registering more\");\n }\n this.expectedEvents.push(... orderedExpectedEvents.map((event,index)=>({index, event})));\n }\n\n send(event: ITelemetryBaseEvent): void {\n const ee = this.expectedEvents[0]?.event;\n if(ee?.eventName === event.eventName) {\n let matches = true;\n for(const key of Object.keys(ee)) {\n if(ee[key] !== event[key]) {\n matches = false;\n break;\n }\n }\n if(matches) {\n // we found an expected event\n // so remove it from the list of expected events\n // and if it is an error, change it to generic\n // this helps keep our telemetry clear of\n // expected errors.\n this.expectedEvents.shift();\n if(event.category === \"error\") {\n event.category = \"generic\";\n }\n }\n }\n if(event.category === \"error\") {\n this.unexpectedErrors.push(event);\n }\n\n this.baseLogger.send(event);\n }\n\n public reportAndClearTrackedEvents() {\n const expectedNotFound = this.expectedEvents.splice(0, this.expectedEvents.length);\n const unexpectedErrors = this.unexpectedErrors.splice(0, this.unexpectedErrors.length);\n return {\n expectedNotFound,\n unexpectedErrors,\n };\n }\n}\n\n/**\n * Shared base class for test object provider. Contain code for loader and container creation and loading\n */\nexport class TestObjectProvider implements ITestObjectProvider {\n private readonly _loaderContainerTracker = new LoaderContainerTracker();\n private _documentServiceFactory: IDocumentServiceFactory | undefined;\n private _urlResolver: IUrlResolver | undefined;\n private _logger: EventAndErrorTrackingLogger | undefined;\n private readonly _documentIdStrategy: IDocumentIdStrategy;\n // Since documentId doesn't change we can only create/make one container. Call the load functions instead.\n private _documentCreated = false;\n\n /**\n * Manage objects for loading and creating container, including the driver, loader, and OpProcessingController\n * @param createFluidEntryPoint - callback to create a fluidEntryPoint, with an optional set of channel name\n * and factory for TestFluidObject\n */\n constructor(\n public readonly LoaderConstructor: typeof Loader,\n public readonly driver: ITestDriver,\n public readonly createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint,\n ) {\n this._documentIdStrategy = getDocumentIdStrategy(driver.type);\n }\n\n get logger(): EventAndErrorTrackingLogger {\n if (this._logger === undefined) {\n this._logger = new EventAndErrorTrackingLogger(\n ChildLogger.create(getTestLogger?.(), undefined,\n {\n all: {\n driverType: this.driver.type,\n driverEndpointName: this.driver.endpointName,\n driverTenantName: this.driver.tenantName,\n driverUserIndex: this.driver.userIndex,\n },\n }));\n }\n return this._logger;\n }\n\n get documentServiceFactory() {\n if (!this._documentServiceFactory) {\n this._documentServiceFactory = this.driver.createDocumentServiceFactory();\n }\n return this._documentServiceFactory;\n }\n\n get urlResolver() {\n if (!this._urlResolver) {\n this._urlResolver = this.driver.createUrlResolver();\n }\n return this._urlResolver;\n }\n\n get documentId() {\n return this._documentIdStrategy.get();\n }\n\n get defaultCodeDetails() {\n return defaultCodeDetails;\n }\n\n get opProcessingController(): IOpProcessingController {\n return this._loaderContainerTracker;\n }\n\n /**\n * Create a loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n *\n * Only the version of the loader will vary based on compat config. The version of\n * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n *\n * @param packageEntries - list of code details and fluidEntryPoint pairs.\n */\n public createLoader(\n packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n loaderProps?: Partial<ILoaderProps>,\n ) {\n const multiSinkLogger = new MultiSinkLogger();\n multiSinkLogger.addLogger(this.logger);\n if (loaderProps?.logger !== undefined) {\n multiSinkLogger.addLogger(loaderProps.logger);\n }\n\n const loader = new this.LoaderConstructor({\n ... loaderProps,\n logger: multiSinkLogger,\n codeLoader: loaderProps?.codeLoader ?? new LocalCodeLoader(packageEntries),\n urlResolver: loaderProps?.urlResolver ?? this.urlResolver,\n documentServiceFactory: loaderProps?.documentServiceFactory ?? this.documentServiceFactory,\n });\n this._loaderContainerTracker.add(loader);\n return loader;\n }\n\n /**\n * Create a container using a default document id and code details.\n * Container created is automatically added to the OpProcessingController to manage op flow\n *\n * Only the version of the loader will vary based on compat config. The version of\n * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n *\n * @param packageEntries - list of code details and fluidEntryPoint pairs.\n */\n public async createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>) {\n if (this._documentCreated) {\n throw new Error(\n \"Only one container/document can be created. To load the container/document use loadContainer\");\n }\n const loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n const container = await createAndAttachContainer(\n defaultCodeDetails,\n loader,\n this.driver.createCreateNewRequest(this.documentId),\n );\n this._documentCreated = true;\n // r11s driver will generate a new ID for the new container.\n // update the document ID with the actual ID of the attached container.\n this._documentIdStrategy.update(container.resolvedUrl);\n return container;\n }\n\n public async loadContainer(\n entryPoint: fluidEntryPoint,\n loaderProps?: Partial<ILoaderProps>,\n requestHeader?: IRequestHeader): Promise<IContainer> {\n const loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n return loader.resolve({ url: await this.driver.createContainerUrl(this.documentId), headers: requestHeader });\n }\n\n /**\n * Make a test loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n * The version of the loader/containerRuntime/dataRuntime may vary based on compat config of the current run\n * @param testContainerConfig - optional configuring the test Container\n */\n public makeTestLoader(testContainerConfig?: ITestContainerConfig) {\n return this.createLoader(\n [[defaultCodeDetails, this.createFluidEntryPoint(testContainerConfig)]],\n testContainerConfig?.loaderProps,\n );\n }\n\n /**\n * Make a container using a default document id and code details\n * Container loaded is automatically added to the OpProcessingController to manage op flow\n * @param testContainerConfig - optional configuring the test Container\n */\n public async makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer> {\n if (this._documentCreated) {\n throw new Error(\n \"Only one container/document can be created. To load the container/document use loadTestContainer\");\n }\n const loader = this.makeTestLoader(testContainerConfig);\n const container =\n await createAndAttachContainer(\n defaultCodeDetails,\n loader,\n this.driver.createCreateNewRequest(this.documentId));\n this._documentCreated = true;\n // r11s driver will generate a new ID for the new container.\n // update the document ID with the actual ID of the attached container.\n this._documentIdStrategy.update(container.resolvedUrl);\n return container;\n }\n\n /**\n * Load a container using a default document id and code details.\n * IContainer loaded is automatically added to the OpProcessingController to manage op flow\n * @param testContainerConfig - optional configuring the test Container\n * @param requestHeader - optional headers to be supplied to the loader\n */\n public async loadTestContainer(\n testContainerConfig?: ITestContainerConfig,\n requestHeader?: IRequestHeader,\n ): Promise<IContainer> {\n const loader = this.makeTestLoader(testContainerConfig);\n const container = await loader.resolve({\n url: await this.driver.createContainerUrl(this.documentId),\n headers: requestHeader,\n });\n await waitContainerToCatchUp(container);\n return container;\n }\n\n public reset() {\n this._loaderContainerTracker.reset();\n this._documentServiceFactory = undefined;\n this._urlResolver = undefined;\n this._documentIdStrategy.reset();\n const logError = getUnexpectedLogErrorException(this._logger);\n if(logError) {\n throw logError;\n }\n this._logger = undefined;\n this._documentCreated = false;\n }\n\n public async ensureSynchronized() {\n return this._loaderContainerTracker.ensureSynchronized();\n }\n\n updateDocumentId(resolvedUrl: IResolvedUrl | undefined) {\n this._documentIdStrategy.update(resolvedUrl);\n }\n}\n\nexport function getUnexpectedLogErrorException(logger: EventAndErrorTrackingLogger | undefined, prefix?: string) {\n if(logger === undefined) {\n return;\n }\n const results = logger.reportAndClearTrackedEvents();\n if(results.unexpectedErrors.length > 0) {\n return new Error(\n `${prefix ?? \"\"}Unexpected Errors in Logs:\\n${JSON.stringify(results.unexpectedErrors, undefined, 2)}`);\n }\n if(results.expectedNotFound.length > 0) {\n return new Error(\n `${prefix ?? \"\"}Expected Events not found:\\n${JSON.stringify(results.expectedNotFound, undefined, 2)}`);\n }\n}\n"]}
1
+ {"version":3,"file":"testObjectProvider.js","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,uEAAgG;AAIhG,+DAAsE;AAEtE,+BAAkC;AAClC,qEAAgG;AAChG,qEAAkE;AAClE,uDAAqE;AACrE,+CAAyD;AAGzD,MAAM,kBAAkB,GAAsB;IAC1C,OAAO,EAAE,oBAAoB;IAC7B,MAAM,EAAE,EAAE;CACb,CAAC;AAgDF,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC7B,qEAAM,CAAA;IACN,iEAAI,CAAA;AACR,CAAC,EAHW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAGhC;AAgBM,MAAM,gBAAgB,GAAG,GAAW,EAAE,CAAC,IAAA,SAAI,GAAE,CAAC;AAAxC,QAAA,gBAAgB,oBAAwB;AAQrD;;;GAGG;AACH,SAAS,qBAAqB,CAAC,IAAsB;IACjD,IAAI,UAAU,GAAG,IAAA,wBAAgB,GAAE,CAAC;IACpC,QAAQ,IAAI,EAAE;QACV,KAAK,MAAM;YACP,OAAO;gBACH,GAAG,EAAE,GAAG,EAAE,CAAC,UAAU;gBACrB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC;gBACjB,KAAK,EAAE,GAAG,EAAE,GAAG,UAAU,GAAG,IAAA,wBAAgB,GAAE,CAAC,CAAC,CAAC;aACpD,CAAC;QACN;YACI,OAAO;gBACH,GAAG,EAAE,GAAG,EAAE,CAAC,UAAU;gBACrB,MAAM,EAAE,CAAC,WAA0B,EAAE,EAAE;;oBACnC,sFAAsF;oBACtF,IAAA,qCAAsB,EAAC,WAAW,CAAC,CAAC;oBACpC,UAAU,GAAG,MAAA,WAAW,CAAC,EAAE,mCAAI,UAAU,CA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AI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC/G;IACD,IAAI,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QACrC,OAAO,IAAI,KAAK,CACZ,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,+BAA+B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC/G;AACL,CAAC;AAbD,wEAaC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainer, IHostLoader, IFluidCodeDetails } from \"@fluidframework/container-definitions\";\nimport { ITelemetryGenericEvent, ITelemetryBaseLogger, ITelemetryBaseEvent } from \"@fluidframework/common-definitions\";\nimport { ILoaderProps, Loader, waitContainerToCatchUp } from \"@fluidframework/container-loader\";\nimport { IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\nimport { IRequestHeader } from \"@fluidframework/core-interfaces\";\nimport { IDocumentServiceFactory, IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { ensureFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport { ITestDriver, TestDriverTypes } from \"@fluidframework/test-driver-definitions\";\nimport { v4 as uuid } from \"uuid\";\nimport { ChildLogger, MultiSinkLogger, TelemetryLogger } from \"@fluidframework/telemetry-utils\";\nimport { LoaderContainerTracker } from \"./loaderContainerTracker\";\nimport { fluidEntryPoint, LocalCodeLoader } from \"./localCodeLoader\";\nimport { createAndAttachContainer } from \"./localLoader\";\nimport { ChannelFactoryRegistry } from \"./testFluidObject\";\n\nconst defaultCodeDetails: IFluidCodeDetails = {\n package: \"defaultTestPackage\",\n config: {},\n};\n\nexport interface IOpProcessingController {\n processIncoming(...containers: IContainer[]): Promise<void>;\n processOutgoing(...containers: IContainer[]): Promise<void>;\n pauseProcessing(...containers: IContainer[]): Promise<void>;\n resumeProcessing(...containers: IContainer[]): void;\n}\n\nexport interface ITestObjectProvider {\n createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint;\n createLoader(\n packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n loaderProps?: Partial<ILoaderProps>,\n ): IHostLoader;\n createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>): Promise<IContainer>;\n loadContainer(\n entryPoint: fluidEntryPoint,\n loaderProps?: Partial<ILoaderProps>,\n requestHeader?: IRequestHeader,\n ): Promise<IContainer>;\n\n /**\n * Used to create a test Container. The Loader/ContainerRuntime/DataRuntime might be different versioned.\n * In generateLocalCompatTest(), this Container and its runtime will be arbitrarily-versioned.\n */\n makeTestLoader(testContainerConfig?: ITestContainerConfig): IHostLoader;\n makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>;\n loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>;\n /**\n *\n * @param url - Resolved container URL\n */\n updateDocumentId(url: IResolvedUrl | undefined): void;\n\n logger: ITelemetryBaseLogger;\n documentServiceFactory: IDocumentServiceFactory;\n urlResolver: IUrlResolver;\n defaultCodeDetails: IFluidCodeDetails;\n opProcessingController: IOpProcessingController;\n\n ensureSynchronized(): Promise<void>;\n reset(): void;\n\n documentId: string;\n driver: ITestDriver;\n}\n\nexport enum DataObjectFactoryType {\n Primed, // default\n Test,\n}\n\nexport interface ITestContainerConfig {\n /** TestFluidDataObject instead of PrimedDataStore */\n fluidDataObjectType?: DataObjectFactoryType;\n\n /** An array of channel name and DDS factory pair to create on container creation time */\n registry?: ChannelFactoryRegistry;\n\n /** Container runtime options for the container instance */\n runtimeOptions?: IContainerRuntimeOptions;\n\n /** Loader options for the loader used to create containers */\n loaderProps?: Partial<ILoaderProps>;\n}\n\nexport const createDocumentId = (): string => uuid();\n\ninterface IDocumentIdStrategy {\n get(): string;\n update(resolvedUrl?: IResolvedUrl): void;\n reset(): void;\n}\n\n/**\n * Document ID is treated differently by test drivers. The key difference is in generating\n * a new container ID and accessing the container in multi-instance test cases.\n */\nfunction getDocumentIdStrategy(type?: TestDriverTypes): IDocumentIdStrategy {\n let documentId = createDocumentId();\n switch (type) {\n case \"odsp\":\n return {\n get: () => documentId,\n update: () => { }, // do not update the document ID in odsp test cases\n reset: () => { documentId = createDocumentId(); },\n };\n default:\n return {\n get: () => documentId,\n update: (resolvedUrl?: IResolvedUrl) => {\n // Extract the document ID from the resolved container's URL and reset the ID property\n ensureFluidResolvedUrl(resolvedUrl);\n documentId = resolvedUrl.id ?? documentId;\n },\n reset: () => { documentId = createDocumentId(); },\n };\n }\n}\n\n/**\n * This class tracks events. It allows specifying expected events, which will be looked for in order.\n * It also tracks all unexpected errors.\n * At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and\n * any expected events that have not occurred.\n */\nexport class EventAndErrorTrackingLogger extends TelemetryLogger {\n constructor(private readonly baseLogger: ITelemetryBaseLogger) {\n super();\n }\n\n private readonly expectedEvents: ({ index: number; event: ITelemetryGenericEvent | undefined; } | undefined)[] = [];\n private readonly unexpectedErrors: ITelemetryBaseEvent[] = [];\n\n public registerExpectedEvent(... orderedExpectedEvents: ITelemetryGenericEvent[]) {\n if (this.expectedEvents.length !== 0) {\n // we don't have to error here. just no reason not to. given the events must be\n // ordered it could be tricky to figure out problems around multiple registrations.\n throw new Error(\n \"Expected events already registered.\\n\"\n + \"Call reportAndClearTrackedEvents to clear them before registering more\");\n }\n this.expectedEvents.push(... orderedExpectedEvents.map((event, index) => ({ index, event })));\n }\n\n send(event: ITelemetryBaseEvent): void {\n const ee = this.expectedEvents[0]?.event;\n if (ee?.eventName === event.eventName) {\n let matches = true;\n for (const key of Object.keys(ee)) {\n if (ee[key] !== event[key]) {\n matches = false;\n break;\n }\n }\n if (matches) {\n // we found an expected event\n // so remove it from the list of expected events\n // and if it is an error, change it to generic\n // this helps keep our telemetry clear of\n // expected errors.\n this.expectedEvents.shift();\n if (event.category === \"error\") {\n event.category = \"generic\";\n }\n }\n }\n if (event.category === \"error\") {\n this.unexpectedErrors.push(event);\n }\n\n this.baseLogger.send(event);\n }\n\n public reportAndClearTrackedEvents() {\n const expectedNotFound = this.expectedEvents.splice(0, this.expectedEvents.length);\n const unexpectedErrors = this.unexpectedErrors.splice(0, this.unexpectedErrors.length);\n return {\n expectedNotFound,\n unexpectedErrors,\n };\n }\n}\n\n/**\n * Shared base class for test object provider. Contain code for loader and container creation and loading\n */\nexport class TestObjectProvider implements ITestObjectProvider {\n private readonly _loaderContainerTracker = new LoaderContainerTracker();\n private _documentServiceFactory: IDocumentServiceFactory | undefined;\n private _urlResolver: IUrlResolver | undefined;\n private _logger: EventAndErrorTrackingLogger | undefined;\n private readonly _documentIdStrategy: IDocumentIdStrategy;\n // Since documentId doesn't change we can only create/make one container. Call the load functions instead.\n private _documentCreated = false;\n\n /**\n * Manage objects for loading and creating container, including the driver, loader, and OpProcessingController\n * @param createFluidEntryPoint - callback to create a fluidEntryPoint, with an optional set of channel name\n * and factory for TestFluidObject\n */\n constructor(\n public readonly LoaderConstructor: typeof Loader,\n public readonly driver: ITestDriver,\n public readonly createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint,\n ) {\n this._documentIdStrategy = getDocumentIdStrategy(driver.type);\n }\n\n get logger(): EventAndErrorTrackingLogger {\n if (this._logger === undefined) {\n this._logger = new EventAndErrorTrackingLogger(\n ChildLogger.create(getTestLogger?.(), undefined,\n {\n all: {\n driverType: this.driver.type,\n driverEndpointName: this.driver.endpointName,\n driverTenantName: this.driver.tenantName,\n driverUserIndex: this.driver.userIndex,\n },\n }));\n }\n return this._logger;\n }\n\n get documentServiceFactory() {\n if (!this._documentServiceFactory) {\n this._documentServiceFactory = this.driver.createDocumentServiceFactory();\n }\n return this._documentServiceFactory;\n }\n\n get urlResolver() {\n if (!this._urlResolver) {\n this._urlResolver = this.driver.createUrlResolver();\n }\n return this._urlResolver;\n }\n\n get documentId() {\n return this._documentIdStrategy.get();\n }\n\n get defaultCodeDetails() {\n return defaultCodeDetails;\n }\n\n get opProcessingController(): IOpProcessingController {\n return this._loaderContainerTracker;\n }\n\n /**\n * Create a loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n *\n * Only the version of the loader will vary based on compat config. The version of\n * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n *\n * @param packageEntries - list of code details and fluidEntryPoint pairs.\n */\n public createLoader(\n packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n loaderProps?: Partial<ILoaderProps>,\n ) {\n const multiSinkLogger = new MultiSinkLogger();\n multiSinkLogger.addLogger(this.logger);\n if (loaderProps?.logger !== undefined) {\n multiSinkLogger.addLogger(loaderProps.logger);\n }\n\n const loader = new this.LoaderConstructor({\n ... loaderProps,\n logger: multiSinkLogger,\n codeLoader: loaderProps?.codeLoader ?? new LocalCodeLoader(packageEntries),\n urlResolver: loaderProps?.urlResolver ?? this.urlResolver,\n documentServiceFactory: loaderProps?.documentServiceFactory ?? this.documentServiceFactory,\n });\n this._loaderContainerTracker.add(loader);\n return loader;\n }\n\n /**\n * Create a container using a default document id and code details.\n * Container created is automatically added to the OpProcessingController to manage op flow\n *\n * Only the version of the loader will vary based on compat config. The version of\n * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n *\n * @param packageEntries - list of code details and fluidEntryPoint pairs.\n */\n public async createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>) {\n if (this._documentCreated) {\n throw new Error(\n \"Only one container/document can be created. To load the container/document use loadContainer\");\n }\n const loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n const container = await createAndAttachContainer(\n defaultCodeDetails,\n loader,\n this.driver.createCreateNewRequest(this.documentId),\n );\n this._documentCreated = true;\n // r11s driver will generate a new ID for the new container.\n // update the document ID with the actual ID of the attached container.\n this._documentIdStrategy.update(container.resolvedUrl);\n return container;\n }\n\n public async loadContainer(\n entryPoint: fluidEntryPoint,\n loaderProps?: Partial<ILoaderProps>,\n requestHeader?: IRequestHeader): Promise<IContainer> {\n const loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n return loader.resolve({ url: await this.driver.createContainerUrl(this.documentId), headers: requestHeader });\n }\n\n /**\n * Make a test loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n * The version of the loader/containerRuntime/dataRuntime may vary based on compat config of the current run\n * @param testContainerConfig - optional configuring the test Container\n */\n public makeTestLoader(testContainerConfig?: ITestContainerConfig) {\n return this.createLoader(\n [[defaultCodeDetails, this.createFluidEntryPoint(testContainerConfig)]],\n testContainerConfig?.loaderProps,\n );\n }\n\n /**\n * Make a container using a default document id and code details\n * Container loaded is automatically added to the OpProcessingController to manage op flow\n * @param testContainerConfig - optional configuring the test Container\n */\n public async makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer> {\n if (this._documentCreated) {\n throw new Error(\n \"Only one container/document can be created. To load the container/document use loadTestContainer\");\n }\n const loader = this.makeTestLoader(testContainerConfig);\n const container =\n await createAndAttachContainer(\n defaultCodeDetails,\n loader,\n this.driver.createCreateNewRequest(this.documentId));\n this._documentCreated = true;\n // r11s driver will generate a new ID for the new container.\n // update the document ID with the actual ID of the attached container.\n this._documentIdStrategy.update(container.resolvedUrl);\n return container;\n }\n\n /**\n * Load a container using a default document id and code details.\n * IContainer loaded is automatically added to the OpProcessingController to manage op flow\n * @param testContainerConfig - optional configuring the test Container\n * @param requestHeader - optional headers to be supplied to the loader\n */\n public async loadTestContainer(\n testContainerConfig?: ITestContainerConfig,\n requestHeader?: IRequestHeader,\n ): Promise<IContainer> {\n const loader = this.makeTestLoader(testContainerConfig);\n const container = await loader.resolve({\n url: await this.driver.createContainerUrl(this.documentId),\n headers: requestHeader,\n });\n await waitContainerToCatchUp(container);\n return container;\n }\n\n public reset() {\n this._loaderContainerTracker.reset();\n this._documentServiceFactory = undefined;\n this._urlResolver = undefined;\n this._documentIdStrategy.reset();\n const logError = getUnexpectedLogErrorException(this._logger);\n if (logError) {\n throw logError;\n }\n this._logger = undefined;\n this._documentCreated = false;\n }\n\n public async ensureSynchronized() {\n return this._loaderContainerTracker.ensureSynchronized();\n }\n\n updateDocumentId(resolvedUrl: IResolvedUrl | undefined) {\n this._documentIdStrategy.update(resolvedUrl);\n }\n}\n\nexport function getUnexpectedLogErrorException(logger: EventAndErrorTrackingLogger | undefined, prefix?: string) {\n if (logger === undefined) {\n return;\n }\n const results = logger.reportAndClearTrackedEvents();\n if (results.unexpectedErrors.length > 0) {\n return new Error(\n `${prefix ?? \"\"}Unexpected Errors in Logs:\\n${JSON.stringify(results.unexpectedErrors, undefined, 2)}`);\n }\n if (results.expectedNotFound.length > 0) {\n return new Error(\n `${prefix ?? \"\"}Expected Events not found:\\n${JSON.stringify(results.expectedNotFound, undefined, 2)}`);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"timeoutUtils.js","sourceRoot":"","sources":["../src/timeoutUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAarC,KAAK,UAAU,YAAY,CAC9B,OAAuB,EACvB,iBAAyD,EAAE;IAE3D,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,cAAc,CAAI,GAAG,EAAE,GAAG,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;AACjF,CAAC;AALD,oCAKC;AAEM,KAAK,UAAU,cAAc,CAChC,QAAgG,EAChG,iBAAyD,EAAE;;IAE3D,MAAM,OAAO,GACT,cAAc,CAAC,UAAU,KAAK,SAAS;WACpC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC;WAC1C,cAAc,CAAC,UAAU,GAAG,CAAC;QAC5B,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,gCAAwB,CAAC;IAC/D,8EAA8E;IAC9E,wDAAwD;IACxD,MAAM,GAAG,GAAG,cAAc,CAAC,MAAM,KAAK,KAAK;QACvC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,MAAA,cAAc,CAAC,QAAQ,mCAAI,WAAW,IAAI,OAAO,KAAK,CAAC,CAAC;IAC3E,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAC,MAAM,EAAC,EAAE;QACpC,MAAM,KAAK,GAAG,UAAU,CACpB,GAAE,EAAE,CAAA,cAAc,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EACjF,OAAO,CAAC,CAAC;QAEb,QAAQ,CACJ,CAAC,KAAK,EAAE,EAAE;YACN,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC,EACD,CAAC,MAAM,EAAE,EAAE;YACP,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACP,CAAC;AA7BD,wCA6BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport const defaultTimeoutDurationMs = 250;\n\nexport interface TimeoutWithError {\n durationMs?: number;\n reject?: true;\n errorMsg?: string;\n}\nexport interface TimeoutWithValue<T = void> {\n durationMs?: number;\n reject: false;\n value: T;\n}\n\nexport async function timeoutAwait<T = void>(\n promise: PromiseLike<T>,\n timeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n) {\n return Promise.race([promise, timeoutPromise<T>(() => { }, timeoutOptions)]);\n}\n\nexport async function timeoutPromise<T = void>(\n executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void,\n timeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n): Promise<T> {\n const timeout =\n timeoutOptions.durationMs !== undefined\n && Number.isFinite(timeoutOptions.durationMs)\n && timeoutOptions.durationMs > 0\n ? timeoutOptions.durationMs : defaultTimeoutDurationMs;\n // create the timeout error outside the async task, so it's callstack includes\n // the original call site, this makes it easier to debug\n const err = timeoutOptions.reject === false\n ? undefined\n : new Error(`${timeoutOptions.errorMsg ?? \"Timed out\"}(${timeout}ms)`);\n return new Promise<T>((resolve,reject)=>{\n const timer = setTimeout(\n ()=>timeoutOptions.reject === false ? resolve(timeoutOptions.value) : reject(err),\n timeout);\n\n executor(\n (value) => {\n clearTimeout(timer);\n resolve(value);\n },\n (reason) => {\n clearTimeout(timer);\n reject(reason);\n });\n });\n}\n"]}
1
+ {"version":3,"file":"timeoutUtils.js","sourceRoot":"","sources":["../src/timeoutUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAarC,KAAK,UAAU,YAAY,CAC9B,OAAuB,EACvB,iBAAyD,EAAE;IAE3D,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,cAAc,CAAI,GAAG,EAAE,GAAG,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;AACjF,CAAC;AALD,oCAKC;AAEM,KAAK,UAAU,cAAc,CAChC,QAAgG,EAChG,iBAAyD,EAAE;;IAE3D,MAAM,OAAO,GACT,cAAc,CAAC,UAAU,KAAK,SAAS;WACpC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC;WAC1C,cAAc,CAAC,UAAU,GAAG,CAAC;QAC5B,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,gCAAwB,CAAC;IAC/D,8EAA8E;IAC9E,wDAAwD;IACxD,MAAM,GAAG,GAAG,cAAc,CAAC,MAAM,KAAK,KAAK;QACvC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,MAAA,cAAc,CAAC,QAAQ,mCAAI,WAAW,IAAI,OAAO,KAAK,CAAC,CAAC;IAC3E,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,UAAU,CACpB,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EACnF,OAAO,CAAC,CAAC;QAEb,QAAQ,CACJ,CAAC,KAAK,EAAE,EAAE;YACN,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC,EACD,CAAC,MAAM,EAAE,EAAE;YACP,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACP,CAAC;AA7BD,wCA6BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport const defaultTimeoutDurationMs = 250;\n\nexport interface TimeoutWithError {\n durationMs?: number;\n reject?: true;\n errorMsg?: string;\n}\nexport interface TimeoutWithValue<T = void> {\n durationMs?: number;\n reject: false;\n value: T;\n}\n\nexport async function timeoutAwait<T = void>(\n promise: PromiseLike<T>,\n timeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n) {\n return Promise.race([promise, timeoutPromise<T>(() => { }, timeoutOptions)]);\n}\n\nexport async function timeoutPromise<T = void>(\n executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void,\n timeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n): Promise<T> {\n const timeout =\n timeoutOptions.durationMs !== undefined\n && Number.isFinite(timeoutOptions.durationMs)\n && timeoutOptions.durationMs > 0\n ? timeoutOptions.durationMs : defaultTimeoutDurationMs;\n // create the timeout error outside the async task, so it's callstack includes\n // the original call site, this makes it easier to debug\n const err = timeoutOptions.reject === false\n ? undefined\n : new Error(`${timeoutOptions.errorMsg ?? \"Timed out\"}(${timeout}ms)`);\n return new Promise<T>((resolve, reject) => {\n const timer = setTimeout(\n () => timeoutOptions.reject === false ? resolve(timeoutOptions.value) : reject(err),\n timeout);\n\n executor(\n (value) => {\n clearTimeout(timer);\n resolve(value);\n },\n (reason) => {\n clearTimeout(timer);\n reject(reason);\n });\n });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/test-utils",
3
- "version": "0.59.2001",
3
+ "version": "0.59.3000-66610",
4
4
  "description": "Utilities for Fluid tests",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -55,35 +55,36 @@
55
55
  "temp-directory": "nyc/.nyc_output"
56
56
  },
57
57
  "dependencies": {
58
- "@fluidframework/aqueduct": "^0.59.2001",
58
+ "@fluidframework/aqueduct": "0.59.3000-66610",
59
59
  "@fluidframework/common-definitions": "^0.20.1",
60
60
  "@fluidframework/common-utils": "^0.32.1",
61
61
  "@fluidframework/container-definitions": "^0.48.1000",
62
- "@fluidframework/container-loader": "^0.59.2001",
63
- "@fluidframework/container-runtime": "^0.59.2001",
64
- "@fluidframework/container-runtime-definitions": "^0.59.2001",
62
+ "@fluidframework/container-loader": "0.59.3000-66610",
63
+ "@fluidframework/container-runtime": "0.59.3000-66610",
64
+ "@fluidframework/container-runtime-definitions": "0.59.3000-66610",
65
65
  "@fluidframework/core-interfaces": "^0.43.1000",
66
- "@fluidframework/datastore": "^0.59.2001",
67
- "@fluidframework/datastore-definitions": "^0.59.2001",
66
+ "@fluidframework/datastore": "0.59.3000-66610",
67
+ "@fluidframework/datastore-definitions": "0.59.3000-66610",
68
68
  "@fluidframework/driver-definitions": "^0.46.1000",
69
- "@fluidframework/driver-utils": "^0.59.2001",
70
- "@fluidframework/local-driver": "^0.59.2001",
71
- "@fluidframework/map": "^0.59.2001",
69
+ "@fluidframework/driver-utils": "0.59.3000-66610",
70
+ "@fluidframework/local-driver": "0.59.3000-66610",
71
+ "@fluidframework/map": "0.59.3000-66610",
72
72
  "@fluidframework/protocol-definitions": "^0.1028.1000",
73
- "@fluidframework/request-handler": "^0.59.2001",
74
- "@fluidframework/routerlicious-driver": "^0.59.2001",
75
- "@fluidframework/runtime-definitions": "^0.59.2001",
76
- "@fluidframework/runtime-utils": "^0.59.2001",
77
- "@fluidframework/telemetry-utils": "^0.59.2001",
78
- "@fluidframework/test-driver-definitions": "^0.59.2001",
79
- "@fluidframework/test-runtime-utils": "^0.59.2001",
73
+ "@fluidframework/request-handler": "0.59.3000-66610",
74
+ "@fluidframework/routerlicious-driver": "0.59.3000-66610",
75
+ "@fluidframework/runtime-definitions": "0.59.3000-66610",
76
+ "@fluidframework/runtime-utils": "0.59.3000-66610",
77
+ "@fluidframework/telemetry-utils": "0.59.3000-66610",
78
+ "@fluidframework/test-driver-definitions": "0.59.3000-66610",
79
+ "@fluidframework/test-runtime-utils": "0.59.3000-66610",
80
80
  "debug": "^4.1.1",
81
81
  "uuid": "^8.3.1"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@fluidframework/build-common": "^0.23.0",
85
- "@fluidframework/eslint-config-fluid": "^0.28.1000",
86
- "@fluidframework/test-utils-previous": "npm:@fluidframework/test-utils@0.59.1000",
85
+ "@fluidframework/build-tools": "^0.2.66048",
86
+ "@fluidframework/eslint-config-fluid": "^0.28.2000-0",
87
+ "@fluidframework/test-utils-previous": "npm:@fluidframework/test-utils@0.59.2000",
87
88
  "@microsoft/api-extractor": "^7.22.2",
88
89
  "@rushstack/eslint-config": "^2.5.1",
89
90
  "@types/diff": "^3.5.1",
@@ -109,11 +110,11 @@
109
110
  "nyc": "^15.0.0",
110
111
  "random-js": "^1.0.8",
111
112
  "rimraf": "^2.6.2",
112
- "typescript": "~4.1.3",
113
+ "typescript": "~4.5.5",
113
114
  "typescript-formatter": "7.1.0"
114
115
  },
115
116
  "typeValidation": {
116
- "version": "0.59.2000",
117
+ "version": "0.59.3000",
117
118
  "broken": {}
118
119
  }
119
120
  }
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/test-utils";
9
- export const pkgVersion = "0.59.2001";
9
+ export const pkgVersion = "0.59.3000-66610";
@@ -47,25 +47,25 @@ export interface ITestObjectProvider {
47
47
  * Used to create a test Container. The Loader/ContainerRuntime/DataRuntime might be different versioned.
48
48
  * In generateLocalCompatTest(), this Container and its runtime will be arbitrarily-versioned.
49
49
  */
50
- makeTestLoader(testContainerConfig?: ITestContainerConfig): IHostLoader,
51
- makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>,
52
- loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>,
50
+ makeTestLoader(testContainerConfig?: ITestContainerConfig): IHostLoader;
51
+ makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>;
52
+ loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>;
53
53
  /**
54
54
  *
55
55
  * @param url - Resolved container URL
56
56
  */
57
- updateDocumentId(url: IResolvedUrl | undefined): void,
57
+ updateDocumentId(url: IResolvedUrl | undefined): void;
58
58
 
59
- logger: ITelemetryBaseLogger,
60
- documentServiceFactory: IDocumentServiceFactory,
61
- urlResolver: IUrlResolver,
62
- defaultCodeDetails: IFluidCodeDetails,
63
- opProcessingController: IOpProcessingController,
59
+ logger: ITelemetryBaseLogger;
60
+ documentServiceFactory: IDocumentServiceFactory;
61
+ urlResolver: IUrlResolver;
62
+ defaultCodeDetails: IFluidCodeDetails;
63
+ opProcessingController: IOpProcessingController;
64
64
 
65
65
  ensureSynchronized(): Promise<void>;
66
- reset(): void,
66
+ reset(): void;
67
67
 
68
- documentId: string,
68
+ documentId: string;
69
69
  driver: ITestDriver;
70
70
  }
71
71
 
@@ -76,16 +76,16 @@ export enum DataObjectFactoryType {
76
76
 
77
77
  export interface ITestContainerConfig {
78
78
  /** TestFluidDataObject instead of PrimedDataStore */
79
- fluidDataObjectType?: DataObjectFactoryType,
79
+ fluidDataObjectType?: DataObjectFactoryType;
80
80
 
81
81
  /** An array of channel name and DDS factory pair to create on container creation time */
82
- registry?: ChannelFactoryRegistry,
82
+ registry?: ChannelFactoryRegistry;
83
83
 
84
84
  /** Container runtime options for the container instance */
85
- runtimeOptions?: IContainerRuntimeOptions,
85
+ runtimeOptions?: IContainerRuntimeOptions;
86
86
 
87
87
  /** Loader options for the loader used to create containers */
88
- loaderProps?: Partial<ILoaderProps>,
88
+ loaderProps?: Partial<ILoaderProps>;
89
89
  }
90
90
 
91
91
  export const createDocumentId = (): string => uuid();
@@ -133,43 +133,43 @@ export class EventAndErrorTrackingLogger extends TelemetryLogger {
133
133
  super();
134
134
  }
135
135
 
136
- private readonly expectedEvents: ({index: number, event: ITelemetryGenericEvent | undefined} | undefined)[] = [];
136
+ private readonly expectedEvents: ({ index: number; event: ITelemetryGenericEvent | undefined; } | undefined)[] = [];
137
137
  private readonly unexpectedErrors: ITelemetryBaseEvent[] = [];
138
138
 
139
139
  public registerExpectedEvent(... orderedExpectedEvents: ITelemetryGenericEvent[]) {
140
- if(this.expectedEvents.length !== 0) {
140
+ if (this.expectedEvents.length !== 0) {
141
141
  // we don't have to error here. just no reason not to. given the events must be
142
142
  // ordered it could be tricky to figure out problems around multiple registrations.
143
143
  throw new Error(
144
144
  "Expected events already registered.\n"
145
145
  + "Call reportAndClearTrackedEvents to clear them before registering more");
146
146
  }
147
- this.expectedEvents.push(... orderedExpectedEvents.map((event,index)=>({index, event})));
147
+ this.expectedEvents.push(... orderedExpectedEvents.map((event, index) => ({ index, event })));
148
148
  }
149
149
 
150
150
  send(event: ITelemetryBaseEvent): void {
151
151
  const ee = this.expectedEvents[0]?.event;
152
- if(ee?.eventName === event.eventName) {
152
+ if (ee?.eventName === event.eventName) {
153
153
  let matches = true;
154
- for(const key of Object.keys(ee)) {
155
- if(ee[key] !== event[key]) {
154
+ for (const key of Object.keys(ee)) {
155
+ if (ee[key] !== event[key]) {
156
156
  matches = false;
157
157
  break;
158
158
  }
159
159
  }
160
- if(matches) {
160
+ if (matches) {
161
161
  // we found an expected event
162
162
  // so remove it from the list of expected events
163
163
  // and if it is an error, change it to generic
164
164
  // this helps keep our telemetry clear of
165
165
  // expected errors.
166
166
  this.expectedEvents.shift();
167
- if(event.category === "error") {
167
+ if (event.category === "error") {
168
168
  event.category = "generic";
169
169
  }
170
170
  }
171
171
  }
172
- if(event.category === "error") {
172
+ if (event.category === "error") {
173
173
  this.unexpectedErrors.push(event);
174
174
  }
175
175
 
@@ -377,7 +377,7 @@ export class TestObjectProvider implements ITestObjectProvider {
377
377
  this._urlResolver = undefined;
378
378
  this._documentIdStrategy.reset();
379
379
  const logError = getUnexpectedLogErrorException(this._logger);
380
- if(logError) {
380
+ if (logError) {
381
381
  throw logError;
382
382
  }
383
383
  this._logger = undefined;
@@ -394,15 +394,15 @@ export class TestObjectProvider implements ITestObjectProvider {
394
394
  }
395
395
 
396
396
  export function getUnexpectedLogErrorException(logger: EventAndErrorTrackingLogger | undefined, prefix?: string) {
397
- if(logger === undefined) {
397
+ if (logger === undefined) {
398
398
  return;
399
399
  }
400
400
  const results = logger.reportAndClearTrackedEvents();
401
- if(results.unexpectedErrors.length > 0) {
401
+ if (results.unexpectedErrors.length > 0) {
402
402
  return new Error(
403
403
  `${prefix ?? ""}Unexpected Errors in Logs:\n${JSON.stringify(results.unexpectedErrors, undefined, 2)}`);
404
404
  }
405
- if(results.expectedNotFound.length > 0) {
405
+ if (results.expectedNotFound.length > 0) {
406
406
  return new Error(
407
407
  `${prefix ?? ""}Expected Events not found:\n${JSON.stringify(results.expectedNotFound, undefined, 2)}`);
408
408
  }
@@ -37,9 +37,9 @@ export async function timeoutPromise<T = void>(
37
37
  const err = timeoutOptions.reject === false
38
38
  ? undefined
39
39
  : new Error(`${timeoutOptions.errorMsg ?? "Timed out"}(${timeout}ms)`);
40
- return new Promise<T>((resolve,reject)=>{
40
+ return new Promise<T>((resolve, reject) => {
41
41
  const timer = setTimeout(
42
- ()=>timeoutOptions.reject === false ? resolve(timeoutOptions.value) : reject(err),
42
+ () => timeoutOptions.reject === false ? resolve(timeoutOptions.value) : reject(err),
43
43
  timeout);
44
44
 
45
45
  executor(