@fluidframework/test-utils 1.4.0-115997 → 2.0.0-dev-rc.1.0.0.224419
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/.eslintrc.js +8 -7
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +177 -0
- package/README.md +44 -14
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/test-utils.api.md +395 -0
- package/dist/DriverWrappers.d.ts +32 -0
- package/dist/DriverWrappers.d.ts.map +1 -0
- package/dist/DriverWrappers.js +57 -0
- package/dist/DriverWrappers.js.map +1 -0
- package/dist/TestConfigs.d.ts +10 -0
- package/dist/TestConfigs.d.ts.map +1 -0
- package/dist/TestConfigs.js +17 -0
- package/dist/TestConfigs.js.map +1 -0
- package/dist/TestSummaryUtils.d.ts +61 -0
- package/dist/TestSummaryUtils.d.ts.map +1 -0
- package/dist/TestSummaryUtils.js +135 -0
- package/dist/TestSummaryUtils.js.map +1 -0
- package/dist/containerUtils.d.ts +46 -0
- package/dist/containerUtils.d.ts.map +1 -0
- package/dist/containerUtils.js +85 -0
- package/dist/containerUtils.js.map +1 -0
- package/dist/index.d.ts +14 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -19
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +6 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/loaderContainerTracker.d.ts +39 -15
- package/dist/loaderContainerTracker.d.ts.map +1 -1
- package/dist/loaderContainerTracker.js +214 -86
- package/dist/loaderContainerTracker.js.map +1 -1
- package/dist/localCodeLoader.d.ts +9 -2
- package/dist/localCodeLoader.d.ts.map +1 -1
- package/dist/localCodeLoader.js +18 -17
- package/dist/localCodeLoader.js.map +1 -1
- package/dist/localLoader.d.ts +3 -2
- package/dist/localLoader.d.ts.map +1 -1
- package/dist/localLoader.js +2 -0
- package/dist/localLoader.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/retry.d.ts +1 -0
- package/dist/retry.d.ts.map +1 -1
- package/dist/retry.js +3 -2
- package/dist/retry.js.map +1 -1
- package/dist/test-utils-alpha.d.ts +305 -0
- package/dist/test-utils-beta.d.ts +202 -0
- package/dist/test-utils-public.d.ts +202 -0
- package/dist/test-utils-untrimmed.d.ts +1001 -0
- package/dist/testContainerRuntimeFactory.d.ts +4 -2
- package/dist/testContainerRuntimeFactory.d.ts.map +1 -1
- package/dist/testContainerRuntimeFactory.js +67 -12
- package/dist/testContainerRuntimeFactory.js.map +1 -1
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.d.ts +23 -0
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -0
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js +32 -0
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js.map +1 -0
- package/dist/testFluidObject.d.ts +30 -12
- package/dist/testFluidObject.d.ts.map +1 -1
- package/dist/testFluidObject.js +74 -43
- package/dist/testFluidObject.js.map +1 -1
- package/dist/testObjectProvider.d.ts +298 -41
- package/dist/testObjectProvider.d.ts.map +1 -1
- package/dist/testObjectProvider.js +377 -61
- package/dist/testObjectProvider.js.map +1 -1
- package/dist/timeoutUtils.d.ts +42 -0
- package/dist/timeoutUtils.d.ts.map +1 -1
- package/dist/timeoutUtils.js +142 -9
- package/dist/timeoutUtils.js.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/test-utils-alpha.d.ts +305 -0
- package/lib/test-utils-beta.d.ts +202 -0
- package/lib/test-utils-public.d.ts +202 -0
- package/lib/test-utils-untrimmed.d.ts +1001 -0
- package/package.json +106 -72
- package/prettier.config.cjs +8 -0
- package/src/DriverWrappers.ts +83 -0
- package/src/TestConfigs.ts +17 -0
- package/src/TestSummaryUtils.ts +210 -0
- package/src/containerUtils.ts +90 -0
- package/src/index.ts +47 -9
- package/src/interfaces.ts +16 -7
- package/src/loaderContainerTracker.ts +754 -534
- package/src/localCodeLoader.ts +87 -86
- package/src/localLoader.ts +27 -26
- package/src/packageVersion.ts +1 -1
- package/src/retry.ts +33 -26
- package/src/testContainerRuntimeFactory.ts +152 -59
- package/src/testContainerRuntimeFactoryWithDefaultDataStore.ts +61 -0
- package/src/testFluidObject.ts +190 -147
- package/src/testObjectProvider.ts +931 -372
- package/src/timeoutUtils.ts +226 -37
- package/tsconfig.json +9 -12
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.summarizeNow = exports.createSummarizer = exports.createSummarizerFromFactory = void 0;
|
|
8
|
+
const aqueduct_1 = require("@fluidframework/aqueduct");
|
|
9
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
10
|
+
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
11
|
+
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
12
|
+
const TestConfigs_1 = require("./TestConfigs");
|
|
13
|
+
const containerUtils_1 = require("./containerUtils");
|
|
14
|
+
const timeoutUtils_1 = require("./timeoutUtils");
|
|
15
|
+
const testContainerRuntimeFactoryWithDefaultDataStore_1 = require("./testContainerRuntimeFactoryWithDefaultDataStore");
|
|
16
|
+
const summarizerClientType = "summarizer";
|
|
17
|
+
async function createSummarizerCore(container, loader, summaryVersion) {
|
|
18
|
+
const absoluteUrl = await container.getAbsoluteUrl("");
|
|
19
|
+
if (absoluteUrl === undefined) {
|
|
20
|
+
throw new Error("URL could not be resolved");
|
|
21
|
+
}
|
|
22
|
+
const request = {
|
|
23
|
+
headers: {
|
|
24
|
+
[container_definitions_1.LoaderHeader.cache]: false,
|
|
25
|
+
[container_definitions_1.LoaderHeader.clientDetails]: {
|
|
26
|
+
capabilities: { interactive: false },
|
|
27
|
+
type: summarizerClientType,
|
|
28
|
+
},
|
|
29
|
+
[driver_definitions_1.DriverHeader.summarizingClient]: true,
|
|
30
|
+
[container_definitions_1.LoaderHeader.version]: summaryVersion,
|
|
31
|
+
},
|
|
32
|
+
url: absoluteUrl,
|
|
33
|
+
};
|
|
34
|
+
const summarizerContainer = await loader.resolve(request);
|
|
35
|
+
await (0, containerUtils_1.waitForContainerConnection)(summarizerContainer);
|
|
36
|
+
const fluidObject = await summarizerContainer.getEntryPoint();
|
|
37
|
+
if (fluidObject?.ISummarizer === undefined) {
|
|
38
|
+
throw new Error("Fluid object does not implement ISummarizer");
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
container: summarizerContainer,
|
|
42
|
+
summarizer: fluidObject.ISummarizer,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const defaultSummaryOptions = {
|
|
46
|
+
summaryConfigOverrides: {
|
|
47
|
+
state: "disableHeuristics",
|
|
48
|
+
maxAckWaitTime: 20000,
|
|
49
|
+
maxOpsSinceLastSummary: 7000,
|
|
50
|
+
initialSummarizerDelayMs: 0,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Creates a summarizer client from the given container and data store factory, and returns the summarizer client's
|
|
55
|
+
* IContainer and ISummarizer.
|
|
56
|
+
* The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
async function createSummarizerFromFactory(provider, container, dataStoreFactory, summaryVersion, containerRuntimeFactoryType = aqueduct_1.ContainerRuntimeFactoryWithDefaultDataStore, registryEntries, logger, configProvider = (0, TestConfigs_1.mockConfigProvider)()) {
|
|
60
|
+
const runtimeFactory = (0, testContainerRuntimeFactoryWithDefaultDataStore_1.createContainerRuntimeFactoryWithDefaultDataStore)(containerRuntimeFactoryType, {
|
|
61
|
+
defaultFactory: dataStoreFactory,
|
|
62
|
+
registryEntries: registryEntries ?? [
|
|
63
|
+
[dataStoreFactory.type, Promise.resolve(dataStoreFactory)],
|
|
64
|
+
],
|
|
65
|
+
runtimeOptions: { summaryOptions: defaultSummaryOptions },
|
|
66
|
+
});
|
|
67
|
+
const loader = provider.createLoader([[provider.defaultCodeDetails, runtimeFactory]], {
|
|
68
|
+
configProvider,
|
|
69
|
+
logger,
|
|
70
|
+
});
|
|
71
|
+
return createSummarizerCore(container, loader, summaryVersion);
|
|
72
|
+
}
|
|
73
|
+
exports.createSummarizerFromFactory = createSummarizerFromFactory;
|
|
74
|
+
/**
|
|
75
|
+
* Creates a summarizer client from the given container and returns the summarizer client's IContainer and ISummarizer.
|
|
76
|
+
* The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.
|
|
77
|
+
*
|
|
78
|
+
* Can pass in a test config provider to enable/disable features.
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
async function createSummarizer(provider, container, config, summaryVersion, logger) {
|
|
82
|
+
const testContainerConfig = {
|
|
83
|
+
...config,
|
|
84
|
+
runtimeOptions: {
|
|
85
|
+
...config?.runtimeOptions,
|
|
86
|
+
summaryOptions: config?.runtimeOptions?.summaryOptions ?? defaultSummaryOptions,
|
|
87
|
+
},
|
|
88
|
+
loaderProps: {
|
|
89
|
+
...config?.loaderProps,
|
|
90
|
+
configProvider: config?.loaderProps?.configProvider ?? (0, TestConfigs_1.mockConfigProvider)(),
|
|
91
|
+
logger,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
const loader = provider.makeTestLoader(testContainerConfig);
|
|
95
|
+
return createSummarizerCore(container, loader, summaryVersion);
|
|
96
|
+
}
|
|
97
|
+
exports.createSummarizer = createSummarizer;
|
|
98
|
+
/**
|
|
99
|
+
* Summarizes on demand and returns the summary tree, the version number and the reference sequence number of the
|
|
100
|
+
* submitted summary.
|
|
101
|
+
*
|
|
102
|
+
* @param summarizer - The ISummarizer to use to summarize on demand
|
|
103
|
+
* @param inputs - Either the reason string or the full IOnDemandSummarizeOptions.
|
|
104
|
+
* Defaults to the reason "end-to-end test".
|
|
105
|
+
* @internal
|
|
106
|
+
*/
|
|
107
|
+
async function summarizeNow(summarizer, inputs = "end-to-end test") {
|
|
108
|
+
const options = typeof inputs === "string" ? { reason: inputs } : inputs;
|
|
109
|
+
const result = summarizer.summarizeOnDemand(options);
|
|
110
|
+
const submitResult = await (0, timeoutUtils_1.timeoutAwait)(result.summarySubmitted);
|
|
111
|
+
if (!submitResult.success) {
|
|
112
|
+
if (typeof submitResult.error !== "string") {
|
|
113
|
+
submitResult.error.data = submitResult.data;
|
|
114
|
+
}
|
|
115
|
+
throw submitResult.error;
|
|
116
|
+
}
|
|
117
|
+
(0, core_utils_1.assert)(submitResult.data.stage === "submit", "on-demand summary submitted data stage should be submit");
|
|
118
|
+
(0, core_utils_1.assert)(submitResult.data.summaryTree !== undefined, "summary tree should exist");
|
|
119
|
+
const broadcastResult = await (0, timeoutUtils_1.timeoutAwait)(result.summaryOpBroadcasted);
|
|
120
|
+
if (!broadcastResult.success) {
|
|
121
|
+
throw broadcastResult.error;
|
|
122
|
+
}
|
|
123
|
+
const ackNackResult = await (0, timeoutUtils_1.timeoutAwait)(result.receivedSummaryAckOrNack);
|
|
124
|
+
if (!ackNackResult.success) {
|
|
125
|
+
throw ackNackResult.error;
|
|
126
|
+
}
|
|
127
|
+
await new Promise((resolve) => process.nextTick(resolve));
|
|
128
|
+
return {
|
|
129
|
+
summaryTree: submitResult.data.summaryTree,
|
|
130
|
+
summaryVersion: ackNackResult.data.summaryAckOp.contents.handle,
|
|
131
|
+
summaryRefSeq: submitResult.data.referenceSequenceNumber,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
exports.summarizeNow = summarizeNow;
|
|
135
|
+
//# sourceMappingURL=TestSummaryUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestSummaryUtils.js","sourceRoot":"","sources":["../src/TestSummaryUtils.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ContainerRuntimeFactoryWithDefaultDataStore } from \"@fluidframework/aqueduct\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IContainer, IHostLoader, LoaderHeader } from \"@fluidframework/container-definitions\";\nimport {\n\tIOnDemandSummarizeOptions,\n\tISummarizer,\n\tISummaryRuntimeOptions,\n} from \"@fluidframework/container-runtime\";\nimport {\n\tITelemetryBaseLogger,\n\tFluidObject,\n\tIRequest,\n\tIConfigProviderBase,\n} from \"@fluidframework/core-interfaces\";\nimport { DriverHeader } from \"@fluidframework/driver-definitions\";\nimport {\n\tIFluidDataStoreFactory,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { ITestContainerConfig, ITestObjectProvider } from \"./testObjectProvider\";\nimport { mockConfigProvider } from \"./TestConfigs\";\nimport { waitForContainerConnection } from \"./containerUtils\";\nimport { timeoutAwait } from \"./timeoutUtils\";\nimport { createContainerRuntimeFactoryWithDefaultDataStore } from \"./testContainerRuntimeFactoryWithDefaultDataStore\";\n\nconst summarizerClientType = \"summarizer\";\n\nasync function createSummarizerCore(\n\tcontainer: IContainer,\n\tloader: IHostLoader,\n\tsummaryVersion?: string,\n) {\n\tconst absoluteUrl = await container.getAbsoluteUrl(\"\");\n\tif (absoluteUrl === undefined) {\n\t\tthrow new Error(\"URL could not be resolved\");\n\t}\n\n\tconst request: IRequest = {\n\t\theaders: {\n\t\t\t[LoaderHeader.cache]: false,\n\t\t\t[LoaderHeader.clientDetails]: {\n\t\t\t\tcapabilities: { interactive: false },\n\t\t\t\ttype: summarizerClientType,\n\t\t\t},\n\t\t\t[DriverHeader.summarizingClient]: true,\n\t\t\t[LoaderHeader.version]: summaryVersion,\n\t\t},\n\t\turl: absoluteUrl,\n\t};\n\tconst summarizerContainer = await loader.resolve(request);\n\tawait waitForContainerConnection(summarizerContainer);\n\n\tconst fluidObject: FluidObject<ISummarizer> | undefined =\n\t\tawait summarizerContainer.getEntryPoint();\n\tif (fluidObject?.ISummarizer === undefined) {\n\t\tthrow new Error(\"Fluid object does not implement ISummarizer\");\n\t}\n\n\treturn {\n\t\tcontainer: summarizerContainer,\n\t\tsummarizer: fluidObject.ISummarizer,\n\t};\n}\n\nconst defaultSummaryOptions: ISummaryRuntimeOptions = {\n\tsummaryConfigOverrides: {\n\t\tstate: \"disableHeuristics\",\n\t\tmaxAckWaitTime: 20000, // Some of the AFR tests take a long time to ack.\n\t\tmaxOpsSinceLastSummary: 7000,\n\t\tinitialSummarizerDelayMs: 0,\n\t},\n};\n\n/**\n * Creates a summarizer client from the given container and data store factory, and returns the summarizer client's\n * IContainer and ISummarizer.\n * The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.\n * @internal\n */\nexport async function createSummarizerFromFactory(\n\tprovider: ITestObjectProvider,\n\tcontainer: IContainer,\n\tdataStoreFactory: IFluidDataStoreFactory,\n\tsummaryVersion?: string,\n\tcontainerRuntimeFactoryType = ContainerRuntimeFactoryWithDefaultDataStore,\n\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\tlogger?: ITelemetryBaseLogger,\n\tconfigProvider: IConfigProviderBase = mockConfigProvider(),\n): Promise<{ container: IContainer; summarizer: ISummarizer }> {\n\tconst runtimeFactory = createContainerRuntimeFactoryWithDefaultDataStore(\n\t\tcontainerRuntimeFactoryType,\n\t\t{\n\t\t\tdefaultFactory: dataStoreFactory,\n\t\t\tregistryEntries: registryEntries ?? [\n\t\t\t\t[dataStoreFactory.type, Promise.resolve(dataStoreFactory)],\n\t\t\t],\n\t\t\truntimeOptions: { summaryOptions: defaultSummaryOptions },\n\t\t},\n\t);\n\n\tconst loader = provider.createLoader([[provider.defaultCodeDetails, runtimeFactory]], {\n\t\tconfigProvider,\n\t\tlogger,\n\t});\n\treturn createSummarizerCore(container, loader, summaryVersion);\n}\n\n/**\n * Creates a summarizer client from the given container and returns the summarizer client's IContainer and ISummarizer.\n * The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.\n *\n * Can pass in a test config provider to enable/disable features.\n * @internal\n */\nexport async function createSummarizer(\n\tprovider: ITestObjectProvider,\n\tcontainer: IContainer,\n\tconfig?: ITestContainerConfig,\n\tsummaryVersion?: string,\n\tlogger?: ITelemetryBaseLogger,\n): Promise<{ container: IContainer; summarizer: ISummarizer }> {\n\tconst testContainerConfig: ITestContainerConfig = {\n\t\t...config,\n\t\truntimeOptions: {\n\t\t\t...config?.runtimeOptions,\n\t\t\tsummaryOptions: config?.runtimeOptions?.summaryOptions ?? defaultSummaryOptions,\n\t\t},\n\t\tloaderProps: {\n\t\t\t...config?.loaderProps,\n\t\t\tconfigProvider: config?.loaderProps?.configProvider ?? mockConfigProvider(),\n\t\t\tlogger,\n\t\t},\n\t};\n\tconst loader = provider.makeTestLoader(testContainerConfig);\n\treturn createSummarizerCore(container, loader, summaryVersion);\n}\n\n/**\n * Summarizes on demand and returns the summary tree, the version number and the reference sequence number of the\n * submitted summary.\n *\n * @param summarizer - The ISummarizer to use to summarize on demand\n * @param inputs - Either the reason string or the full IOnDemandSummarizeOptions.\n * Defaults to the reason \"end-to-end test\".\n * @internal\n */\nexport async function summarizeNow(\n\tsummarizer: ISummarizer,\n\tinputs: string | IOnDemandSummarizeOptions = \"end-to-end test\",\n): Promise<SummaryInfo> {\n\tconst options: IOnDemandSummarizeOptions =\n\t\ttypeof inputs === \"string\" ? { reason: inputs } : inputs;\n\tconst result = summarizer.summarizeOnDemand(options);\n\n\tconst submitResult = await timeoutAwait(result.summarySubmitted);\n\tif (!submitResult.success) {\n\t\tif (typeof submitResult.error !== \"string\") {\n\t\t\tsubmitResult.error.data = submitResult.data;\n\t\t}\n\t\tthrow submitResult.error;\n\t}\n\tassert(\n\t\tsubmitResult.data.stage === \"submit\",\n\t\t\"on-demand summary submitted data stage should be submit\",\n\t);\n\tassert(submitResult.data.summaryTree !== undefined, \"summary tree should exist\");\n\n\tconst broadcastResult = await timeoutAwait(result.summaryOpBroadcasted);\n\tif (!broadcastResult.success) {\n\t\tthrow broadcastResult.error;\n\t}\n\n\tconst ackNackResult = await timeoutAwait(result.receivedSummaryAckOrNack);\n\tif (!ackNackResult.success) {\n\t\tthrow ackNackResult.error;\n\t}\n\n\tawait new Promise((resolve) => process.nextTick(resolve));\n\n\treturn {\n\t\tsummaryTree: submitResult.data.summaryTree,\n\t\tsummaryVersion: ackNackResult.data.summaryAckOp.contents.handle,\n\t\tsummaryRefSeq: submitResult.data.referenceSequenceNumber,\n\t};\n}\n\n/**\n * Summary information containing the summary tree, summary version, and summary sequence number.\n * @internal\n */\nexport interface SummaryInfo {\n\t/**\n\t * The summary tree generated\n\t */\n\tsummaryTree: ISummaryTree;\n\t/**\n\t * Handle of the completed summary\n\t */\n\tsummaryVersion: string;\n\t/**\n\t * Reference sequence number of the current summary generation\n\t */\n\tsummaryRefSeq: number;\n}\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { IContainer } from "@fluidframework/container-definitions";
|
|
6
|
+
import { IDataStore } from "@fluidframework/runtime-definitions";
|
|
7
|
+
import { TimeoutWithError } from "./timeoutUtils";
|
|
8
|
+
/**
|
|
9
|
+
* Utility function to wait for the specified Container to be in Connected state.
|
|
10
|
+
* If the Container is already connected, the Promise returns immediately; otherwise it resolves when the Container emits
|
|
11
|
+
* its 'connected' event.
|
|
12
|
+
* If failOnContainerClose === true, the returned Promise will be rejected if the container emits a 'closed' event
|
|
13
|
+
* before a 'connected' event.
|
|
14
|
+
* @param container - The container to wait for.
|
|
15
|
+
* @param failOnContainerClose - If true, the returned Promise will be rejected if the container emits a 'closed' event
|
|
16
|
+
* before a 'connected' event.
|
|
17
|
+
* Defaults to true.
|
|
18
|
+
* @param timeoutOptions - Options related to the behavior of the timeout.
|
|
19
|
+
* If provided, the returned Promise will reject if the container hasn't emitted relevant events in timeoutOptions.durationMs.
|
|
20
|
+
* If not provided, the Promise will wait indefinitely for the Container to emit its 'connected' (or 'closed', if
|
|
21
|
+
* failOnContainerClose === true) event.
|
|
22
|
+
*
|
|
23
|
+
* @returns A Promise that either:
|
|
24
|
+
* - Resolves when the specified container emits a 'connected' event (or immediately if the Container is already connected).
|
|
25
|
+
* - Rejects if failOnContainerClose === true and the container emits a 'closed' event before a 'connected' event.
|
|
26
|
+
* - Rejects after timeoutOptions.durationMs if timeoutOptions !== undefined and the container does not emit relevant
|
|
27
|
+
* events, within that timeframe.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare function waitForContainerConnection(container: IContainer, failOnContainerClose?: boolean, timeoutOptions?: TimeoutWithError): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* This function should ONLY be used for back compat purposes
|
|
33
|
+
* LTS versions of the Loader/Container will not have the "getEntryPoint" method, so we need to fallback to "request"
|
|
34
|
+
* This function can be removed once LTS version of Loader moves to 2.0.0-internal.7.0.0
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export declare function getContainerEntryPointBackCompat<T>(container: IContainer): Promise<T>;
|
|
38
|
+
/**
|
|
39
|
+
* This function should ONLY be used for back compat purposes
|
|
40
|
+
* Older supported versions of IDataStore do not have the "entryPoint" property, so we need to fallback to "request"
|
|
41
|
+
* This function can be removed once back-compat support for IDataStore moves to 2.0.0-internal.7.0.0
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export declare function getDataStoreEntryPointBackCompat<T>(dataStore: IDataStore): Promise<T>;
|
|
46
|
+
//# sourceMappingURL=containerUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerUtils.d.ts","sourceRoot":"","sources":["../src/containerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAInE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAmC,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,0BAA0B,CAC/C,SAAS,EAAE,UAAU,EACrB,oBAAoB,GAAE,OAAc,EACpC,cAAc,CAAC,EAAE,gBAAgB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAaf;AAED;;;;;GAKG;AACH,wBAAsB,gCAAgC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,CAc3F;AAED;;;;;;GAMG;AACH,wBAAsB,gCAAgC,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,CAO3F"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.getDataStoreEntryPointBackCompat = exports.getContainerEntryPointBackCompat = exports.waitForContainerConnection = void 0;
|
|
8
|
+
const container_loader_1 = require("@fluidframework/container-loader");
|
|
9
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
10
|
+
const timeoutUtils_1 = require("./timeoutUtils");
|
|
11
|
+
/**
|
|
12
|
+
* Utility function to wait for the specified Container to be in Connected state.
|
|
13
|
+
* If the Container is already connected, the Promise returns immediately; otherwise it resolves when the Container emits
|
|
14
|
+
* its 'connected' event.
|
|
15
|
+
* If failOnContainerClose === true, the returned Promise will be rejected if the container emits a 'closed' event
|
|
16
|
+
* before a 'connected' event.
|
|
17
|
+
* @param container - The container to wait for.
|
|
18
|
+
* @param failOnContainerClose - If true, the returned Promise will be rejected if the container emits a 'closed' event
|
|
19
|
+
* before a 'connected' event.
|
|
20
|
+
* Defaults to true.
|
|
21
|
+
* @param timeoutOptions - Options related to the behavior of the timeout.
|
|
22
|
+
* If provided, the returned Promise will reject if the container hasn't emitted relevant events in timeoutOptions.durationMs.
|
|
23
|
+
* If not provided, the Promise will wait indefinitely for the Container to emit its 'connected' (or 'closed', if
|
|
24
|
+
* failOnContainerClose === true) event.
|
|
25
|
+
*
|
|
26
|
+
* @returns A Promise that either:
|
|
27
|
+
* - Resolves when the specified container emits a 'connected' event (or immediately if the Container is already connected).
|
|
28
|
+
* - Rejects if failOnContainerClose === true and the container emits a 'closed' event before a 'connected' event.
|
|
29
|
+
* - Rejects after timeoutOptions.durationMs if timeoutOptions !== undefined and the container does not emit relevant
|
|
30
|
+
* events, within that timeframe.
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
async function waitForContainerConnection(container, failOnContainerClose = true, timeoutOptions) {
|
|
34
|
+
if (container.connectionState !== container_loader_1.ConnectionState.Connected) {
|
|
35
|
+
const executor = (resolve, reject) => {
|
|
36
|
+
container.once("connected", () => resolve());
|
|
37
|
+
if (failOnContainerClose) {
|
|
38
|
+
container.once("closed", (error) => reject(error));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return timeoutOptions === undefined
|
|
42
|
+
? new Promise(executor)
|
|
43
|
+
: (0, timeoutUtils_1.timeoutPromise)(executor, timeoutOptions);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.waitForContainerConnection = waitForContainerConnection;
|
|
47
|
+
/**
|
|
48
|
+
* This function should ONLY be used for back compat purposes
|
|
49
|
+
* LTS versions of the Loader/Container will not have the "getEntryPoint" method, so we need to fallback to "request"
|
|
50
|
+
* This function can be removed once LTS version of Loader moves to 2.0.0-internal.7.0.0
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
async function getContainerEntryPointBackCompat(container) {
|
|
54
|
+
if (container.getEntryPoint !== undefined) {
|
|
55
|
+
const entryPoint = await container.getEntryPoint();
|
|
56
|
+
// Note: We need to also check if the result of `getEntryPoint()` is defined. This is because when running
|
|
57
|
+
// cross version compat testing scenarios, if we create with 1.X container and load with 2.X then the
|
|
58
|
+
// function container.getEntryPoint will be defined for the 2.X container. However, it will not return undefined
|
|
59
|
+
// since the container's runtime will be on version 1.X, which does not have an entry point defined.
|
|
60
|
+
if (entryPoint !== undefined) {
|
|
61
|
+
return entryPoint;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const response = await container.request({ url: "/" });
|
|
65
|
+
(0, core_utils_1.assert)(response.status === 200, "requesting '/' should return default data object");
|
|
66
|
+
return response.value;
|
|
67
|
+
}
|
|
68
|
+
exports.getContainerEntryPointBackCompat = getContainerEntryPointBackCompat;
|
|
69
|
+
/**
|
|
70
|
+
* This function should ONLY be used for back compat purposes
|
|
71
|
+
* Older supported versions of IDataStore do not have the "entryPoint" property, so we need to fallback to "request"
|
|
72
|
+
* This function can be removed once back-compat support for IDataStore moves to 2.0.0-internal.7.0.0
|
|
73
|
+
*
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
async function getDataStoreEntryPointBackCompat(dataStore) {
|
|
77
|
+
if (dataStore.entryPoint !== undefined) {
|
|
78
|
+
return dataStore.entryPoint.get();
|
|
79
|
+
}
|
|
80
|
+
const response = await dataStore.request({ url: "" });
|
|
81
|
+
(0, core_utils_1.assert)(response.status === 200, "empty request should return data object");
|
|
82
|
+
return response.value;
|
|
83
|
+
}
|
|
84
|
+
exports.getDataStoreEntryPointBackCompat = getDataStoreEntryPointBackCompat;
|
|
85
|
+
//# sourceMappingURL=containerUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerUtils.js","sourceRoot":"","sources":["../src/containerUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uEAAmE;AAEnE,2DAAoD;AAEpD,iDAAmF;AAEnF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACI,KAAK,UAAU,0BAA0B,CAC/C,SAAqB,EACrB,uBAAgC,IAAI,EACpC,cAAiC;IAEjC,IAAI,SAAS,CAAC,eAAe,KAAK,kCAAe,CAAC,SAAS,EAAE;QAC5D,MAAM,QAAQ,GAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrD,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YAC7C,IAAI,oBAAoB,EAAE;gBACzB,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;aACnD;QACF,CAAC,CAAC;QAEF,OAAO,cAAc,KAAK,SAAS;YAClC,CAAC,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC;YACvB,CAAC,CAAC,IAAA,6BAAc,EAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;KAC5C;AACF,CAAC;AAjBD,gEAiBC;AAED;;;;;GAKG;AACI,KAAK,UAAU,gCAAgC,CAAI,SAAqB;IAC9E,IAAI,SAAS,CAAC,aAAa,KAAK,SAAS,EAAE;QAC1C,MAAM,UAAU,GAAG,MAAM,SAAS,CAAC,aAAa,EAAE,CAAC;QACnD,0GAA0G;QAC1G,qGAAqG;QACrG,gHAAgH;QAChH,oGAAoG;QACpG,IAAI,UAAU,KAAK,SAAS,EAAE;YAC7B,OAAO,UAAe,CAAC;SACvB;KACD;IACD,MAAM,QAAQ,GAAc,MAAO,SAAiB,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3E,IAAA,mBAAM,EAAC,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,kDAAkD,CAAC,CAAC;IACpF,OAAO,QAAQ,CAAC,KAAU,CAAC;AAC5B,CAAC;AAdD,4EAcC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,gCAAgC,CAAI,SAAqB;IAC9E,IAAI,SAAS,CAAC,UAAU,KAAK,SAAS,EAAE;QACvC,OAAO,SAAS,CAAC,UAAU,CAAC,GAAG,EAAgB,CAAC;KAChD;IACD,MAAM,QAAQ,GAAc,MAAO,SAAiB,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1E,IAAA,mBAAM,EAAC,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,yCAAyC,CAAC,CAAC;IAC3E,OAAO,QAAQ,CAAC,KAAU,CAAC;AAC5B,CAAC;AAPD,4EAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainer } from \"@fluidframework/container-definitions\";\nimport { ConnectionState } from \"@fluidframework/container-loader\";\nimport { IResponse } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDataStore } from \"@fluidframework/runtime-definitions\";\nimport { PromiseExecutor, timeoutPromise, TimeoutWithError } from \"./timeoutUtils\";\n\n/**\n * Utility function to wait for the specified Container to be in Connected state.\n * If the Container is already connected, the Promise returns immediately; otherwise it resolves when the Container emits\n * its 'connected' event.\n * If failOnContainerClose === true, the returned Promise will be rejected if the container emits a 'closed' event\n * before a 'connected' event.\n * @param container - The container to wait for.\n * @param failOnContainerClose - If true, the returned Promise will be rejected if the container emits a 'closed' event\n * before a 'connected' event.\n * Defaults to true.\n * @param timeoutOptions - Options related to the behavior of the timeout.\n * If provided, the returned Promise will reject if the container hasn't emitted relevant events in timeoutOptions.durationMs.\n * If not provided, the Promise will wait indefinitely for the Container to emit its 'connected' (or 'closed', if\n * failOnContainerClose === true) event.\n *\n * @returns A Promise that either:\n * - Resolves when the specified container emits a 'connected' event (or immediately if the Container is already connected).\n * - Rejects if failOnContainerClose === true and the container emits a 'closed' event before a 'connected' event.\n * - Rejects after timeoutOptions.durationMs if timeoutOptions !== undefined and the container does not emit relevant\n * events, within that timeframe.\n * @internal\n */\nexport async function waitForContainerConnection(\n\tcontainer: IContainer,\n\tfailOnContainerClose: boolean = true,\n\ttimeoutOptions?: TimeoutWithError,\n): Promise<void> {\n\tif (container.connectionState !== ConnectionState.Connected) {\n\t\tconst executor: PromiseExecutor = (resolve, reject) => {\n\t\t\tcontainer.once(\"connected\", () => resolve());\n\t\t\tif (failOnContainerClose) {\n\t\t\t\tcontainer.once(\"closed\", (error) => reject(error));\n\t\t\t}\n\t\t};\n\n\t\treturn timeoutOptions === undefined\n\t\t\t? new Promise(executor)\n\t\t\t: timeoutPromise(executor, timeoutOptions);\n\t}\n}\n\n/**\n * This function should ONLY be used for back compat purposes\n * LTS versions of the Loader/Container will not have the \"getEntryPoint\" method, so we need to fallback to \"request\"\n * This function can be removed once LTS version of Loader moves to 2.0.0-internal.7.0.0\n * @internal\n */\nexport async function getContainerEntryPointBackCompat<T>(container: IContainer): Promise<T> {\n\tif (container.getEntryPoint !== undefined) {\n\t\tconst entryPoint = await container.getEntryPoint();\n\t\t// Note: We need to also check if the result of `getEntryPoint()` is defined. This is because when running\n\t\t// cross version compat testing scenarios, if we create with 1.X container and load with 2.X then the\n\t\t// function container.getEntryPoint will be defined for the 2.X container. However, it will not return undefined\n\t\t// since the container's runtime will be on version 1.X, which does not have an entry point defined.\n\t\tif (entryPoint !== undefined) {\n\t\t\treturn entryPoint as T;\n\t\t}\n\t}\n\tconst response: IResponse = await (container as any).request({ url: \"/\" });\n\tassert(response.status === 200, \"requesting '/' should return default data object\");\n\treturn response.value as T;\n}\n\n/**\n * This function should ONLY be used for back compat purposes\n * Older supported versions of IDataStore do not have the \"entryPoint\" property, so we need to fallback to \"request\"\n * This function can be removed once back-compat support for IDataStore moves to 2.0.0-internal.7.0.0\n *\n * @internal\n */\nexport async function getDataStoreEntryPointBackCompat<T>(dataStore: IDataStore): Promise<T> {\n\tif (dataStore.entryPoint !== undefined) {\n\t\treturn dataStore.entryPoint.get() as Promise<T>;\n\t}\n\tconst response: IResponse = await (dataStore as any).request({ url: \"\" });\n\tassert(response.status === 200, \"empty request should return data object\");\n\treturn response.value as T;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
5
|
+
export { wrapDocumentService, wrapDocumentServiceFactory, wrapDocumentStorageService, } from "./DriverWrappers";
|
|
6
|
+
export { IProvideTestFluidObject, ITestFluidObject } from "./interfaces";
|
|
7
|
+
export { LoaderContainerTracker } from "./loaderContainerTracker";
|
|
8
|
+
export { fluidEntryPoint, LocalCodeLoader, SupportedExportInterfaces } from "./localCodeLoader";
|
|
9
|
+
export { createAndAttachContainer, createLoader } from "./localLoader";
|
|
10
|
+
export { retryWithEventualValue } from "./retry";
|
|
11
|
+
export { mockConfigProvider } from "./TestConfigs";
|
|
12
|
+
export { createTestContainerRuntimeFactory, TestContainerRuntimeFactory, } from "./testContainerRuntimeFactory";
|
|
13
|
+
export { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory } from "./testFluidObject";
|
|
14
|
+
export { createDocumentId, DataObjectFactoryType, EventAndErrorTrackingLogger, getUnexpectedLogErrorException, IDocumentIdStrategy, IOpProcessingController, ITestContainerConfig, ITestObjectProvider, TestObjectProvider, TestObjectProviderWithVersionedLoad, } from "./testObjectProvider";
|
|
15
|
+
export { createSummarizer, createSummarizerFromFactory, summarizeNow, SummaryInfo, } from "./TestSummaryUtils";
|
|
16
|
+
export { defaultTimeoutDurationMs, timeoutAwait, timeoutPromise, TimeoutWithError, TimeoutWithValue, } from "./timeoutUtils";
|
|
17
|
+
export { waitForContainerConnection, getContainerEntryPointBackCompat, getDataStoreEntryPointBackCompat, } from "./containerUtils";
|
|
18
|
+
export { createContainerRuntimeFactoryWithDefaultDataStore } from "./testContainerRuntimeFactoryWithDefaultDataStore";
|
|
14
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,0BAA0B,EAC1B,0BAA0B,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAChG,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACN,iCAAiC,EACjC,2BAA2B,GAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,8BAA8B,EAC9B,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,mCAAmC,GACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,YAAY,EACZ,WAAW,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,wBAAwB,EACxB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,gBAAgB,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,GAChC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iDAAiD,EAAE,MAAM,mDAAmD,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,24 +3,48 @@
|
|
|
3
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
7
|
+
exports.createContainerRuntimeFactoryWithDefaultDataStore = exports.getDataStoreEntryPointBackCompat = exports.getContainerEntryPointBackCompat = exports.waitForContainerConnection = exports.timeoutPromise = exports.timeoutAwait = exports.defaultTimeoutDurationMs = exports.summarizeNow = exports.createSummarizerFromFactory = exports.createSummarizer = exports.TestObjectProviderWithVersionedLoad = exports.TestObjectProvider = exports.getUnexpectedLogErrorException = exports.EventAndErrorTrackingLogger = exports.DataObjectFactoryType = exports.createDocumentId = exports.TestFluidObjectFactory = exports.TestFluidObject = exports.TestContainerRuntimeFactory = exports.createTestContainerRuntimeFactory = exports.mockConfigProvider = exports.retryWithEventualValue = exports.createLoader = exports.createAndAttachContainer = exports.LocalCodeLoader = exports.LoaderContainerTracker = exports.wrapDocumentStorageService = exports.wrapDocumentServiceFactory = exports.wrapDocumentService = void 0;
|
|
8
|
+
var DriverWrappers_1 = require("./DriverWrappers");
|
|
9
|
+
Object.defineProperty(exports, "wrapDocumentService", { enumerable: true, get: function () { return DriverWrappers_1.wrapDocumentService; } });
|
|
10
|
+
Object.defineProperty(exports, "wrapDocumentServiceFactory", { enumerable: true, get: function () { return DriverWrappers_1.wrapDocumentServiceFactory; } });
|
|
11
|
+
Object.defineProperty(exports, "wrapDocumentStorageService", { enumerable: true, get: function () { return DriverWrappers_1.wrapDocumentStorageService; } });
|
|
12
|
+
var loaderContainerTracker_1 = require("./loaderContainerTracker");
|
|
13
|
+
Object.defineProperty(exports, "LoaderContainerTracker", { enumerable: true, get: function () { return loaderContainerTracker_1.LoaderContainerTracker; } });
|
|
14
|
+
var localCodeLoader_1 = require("./localCodeLoader");
|
|
15
|
+
Object.defineProperty(exports, "LocalCodeLoader", { enumerable: true, get: function () { return localCodeLoader_1.LocalCodeLoader; } });
|
|
16
|
+
var localLoader_1 = require("./localLoader");
|
|
17
|
+
Object.defineProperty(exports, "createAndAttachContainer", { enumerable: true, get: function () { return localLoader_1.createAndAttachContainer; } });
|
|
18
|
+
Object.defineProperty(exports, "createLoader", { enumerable: true, get: function () { return localLoader_1.createLoader; } });
|
|
19
|
+
var retry_1 = require("./retry");
|
|
20
|
+
Object.defineProperty(exports, "retryWithEventualValue", { enumerable: true, get: function () { return retry_1.retryWithEventualValue; } });
|
|
21
|
+
var TestConfigs_1 = require("./TestConfigs");
|
|
22
|
+
Object.defineProperty(exports, "mockConfigProvider", { enumerable: true, get: function () { return TestConfigs_1.mockConfigProvider; } });
|
|
23
|
+
var testContainerRuntimeFactory_1 = require("./testContainerRuntimeFactory");
|
|
24
|
+
Object.defineProperty(exports, "createTestContainerRuntimeFactory", { enumerable: true, get: function () { return testContainerRuntimeFactory_1.createTestContainerRuntimeFactory; } });
|
|
25
|
+
Object.defineProperty(exports, "TestContainerRuntimeFactory", { enumerable: true, get: function () { return testContainerRuntimeFactory_1.TestContainerRuntimeFactory; } });
|
|
26
|
+
var testFluidObject_1 = require("./testFluidObject");
|
|
27
|
+
Object.defineProperty(exports, "TestFluidObject", { enumerable: true, get: function () { return testFluidObject_1.TestFluidObject; } });
|
|
28
|
+
Object.defineProperty(exports, "TestFluidObjectFactory", { enumerable: true, get: function () { return testFluidObject_1.TestFluidObjectFactory; } });
|
|
29
|
+
var testObjectProvider_1 = require("./testObjectProvider");
|
|
30
|
+
Object.defineProperty(exports, "createDocumentId", { enumerable: true, get: function () { return testObjectProvider_1.createDocumentId; } });
|
|
31
|
+
Object.defineProperty(exports, "DataObjectFactoryType", { enumerable: true, get: function () { return testObjectProvider_1.DataObjectFactoryType; } });
|
|
32
|
+
Object.defineProperty(exports, "EventAndErrorTrackingLogger", { enumerable: true, get: function () { return testObjectProvider_1.EventAndErrorTrackingLogger; } });
|
|
33
|
+
Object.defineProperty(exports, "getUnexpectedLogErrorException", { enumerable: true, get: function () { return testObjectProvider_1.getUnexpectedLogErrorException; } });
|
|
34
|
+
Object.defineProperty(exports, "TestObjectProvider", { enumerable: true, get: function () { return testObjectProvider_1.TestObjectProvider; } });
|
|
35
|
+
Object.defineProperty(exports, "TestObjectProviderWithVersionedLoad", { enumerable: true, get: function () { return testObjectProvider_1.TestObjectProviderWithVersionedLoad; } });
|
|
36
|
+
var TestSummaryUtils_1 = require("./TestSummaryUtils");
|
|
37
|
+
Object.defineProperty(exports, "createSummarizer", { enumerable: true, get: function () { return TestSummaryUtils_1.createSummarizer; } });
|
|
38
|
+
Object.defineProperty(exports, "createSummarizerFromFactory", { enumerable: true, get: function () { return TestSummaryUtils_1.createSummarizerFromFactory; } });
|
|
39
|
+
Object.defineProperty(exports, "summarizeNow", { enumerable: true, get: function () { return TestSummaryUtils_1.summarizeNow; } });
|
|
40
|
+
var timeoutUtils_1 = require("./timeoutUtils");
|
|
41
|
+
Object.defineProperty(exports, "defaultTimeoutDurationMs", { enumerable: true, get: function () { return timeoutUtils_1.defaultTimeoutDurationMs; } });
|
|
42
|
+
Object.defineProperty(exports, "timeoutAwait", { enumerable: true, get: function () { return timeoutUtils_1.timeoutAwait; } });
|
|
43
|
+
Object.defineProperty(exports, "timeoutPromise", { enumerable: true, get: function () { return timeoutUtils_1.timeoutPromise; } });
|
|
44
|
+
var containerUtils_1 = require("./containerUtils");
|
|
45
|
+
Object.defineProperty(exports, "waitForContainerConnection", { enumerable: true, get: function () { return containerUtils_1.waitForContainerConnection; } });
|
|
46
|
+
Object.defineProperty(exports, "getContainerEntryPointBackCompat", { enumerable: true, get: function () { return containerUtils_1.getContainerEntryPointBackCompat; } });
|
|
47
|
+
Object.defineProperty(exports, "getDataStoreEntryPointBackCompat", { enumerable: true, get: function () { return containerUtils_1.getDataStoreEntryPointBackCompat; } });
|
|
48
|
+
var testContainerRuntimeFactoryWithDefaultDataStore_1 = require("./testContainerRuntimeFactoryWithDefaultDataStore");
|
|
49
|
+
Object.defineProperty(exports, "createContainerRuntimeFactoryWithDefaultDataStore", { enumerable: true, get: function () { return testContainerRuntimeFactoryWithDefaultDataStore_1.createContainerRuntimeFactoryWithDefaultDataStore; } });
|
|
26
50
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mDAI0B;AAHzB,qHAAA,mBAAmB,OAAA;AACnB,4HAAA,0BAA0B,OAAA;AAC1B,4HAAA,0BAA0B,OAAA;AAG3B,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,qDAAgG;AAAtE,kHAAA,eAAe,OAAA;AACzC,6CAAuE;AAA9D,uHAAA,wBAAwB,OAAA;AAAE,2GAAA,YAAY,OAAA;AAC/C,iCAAiD;AAAxC,+GAAA,sBAAsB,OAAA;AAC/B,6CAAmD;AAA1C,iHAAA,kBAAkB,OAAA;AAC3B,6EAGuC;AAFtC,gJAAA,iCAAiC,OAAA;AACjC,0IAAA,2BAA2B,OAAA;AAE5B,qDAAoG;AAAnE,kHAAA,eAAe,OAAA;AAAE,yHAAA,sBAAsB,OAAA;AACxE,2DAW8B;AAV7B,sHAAA,gBAAgB,OAAA;AAChB,2HAAA,qBAAqB,OAAA;AACrB,iIAAA,2BAA2B,OAAA;AAC3B,oIAAA,8BAA8B,OAAA;AAK9B,wHAAA,kBAAkB,OAAA;AAClB,yIAAA,mCAAmC,OAAA;AAEpC,uDAK4B;AAJ3B,oHAAA,gBAAgB,OAAA;AAChB,+HAAA,2BAA2B,OAAA;AAC3B,gHAAA,YAAY,OAAA;AAGb,+CAMwB;AALvB,wHAAA,wBAAwB,OAAA;AACxB,4GAAA,YAAY,OAAA;AACZ,8GAAA,cAAc,OAAA;AAIf,mDAI0B;AAHzB,4HAAA,0BAA0B,OAAA;AAC1B,kIAAA,gCAAgC,OAAA;AAChC,kIAAA,gCAAgC,OAAA;AAEjC,qHAAsH;AAA7G,oLAAA,iDAAiD,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\twrapDocumentService,\n\twrapDocumentServiceFactory,\n\twrapDocumentStorageService,\n} from \"./DriverWrappers\";\nexport { IProvideTestFluidObject, ITestFluidObject } from \"./interfaces\";\nexport { LoaderContainerTracker } from \"./loaderContainerTracker\";\nexport { fluidEntryPoint, LocalCodeLoader, SupportedExportInterfaces } from \"./localCodeLoader\";\nexport { createAndAttachContainer, createLoader } from \"./localLoader\";\nexport { retryWithEventualValue } from \"./retry\";\nexport { mockConfigProvider } from \"./TestConfigs\";\nexport {\n\tcreateTestContainerRuntimeFactory,\n\tTestContainerRuntimeFactory,\n} from \"./testContainerRuntimeFactory\";\nexport { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory } from \"./testFluidObject\";\nexport {\n\tcreateDocumentId,\n\tDataObjectFactoryType,\n\tEventAndErrorTrackingLogger,\n\tgetUnexpectedLogErrorException,\n\tIDocumentIdStrategy,\n\tIOpProcessingController,\n\tITestContainerConfig,\n\tITestObjectProvider,\n\tTestObjectProvider,\n\tTestObjectProviderWithVersionedLoad,\n} from \"./testObjectProvider\";\nexport {\n\tcreateSummarizer,\n\tcreateSummarizerFromFactory,\n\tsummarizeNow,\n\tSummaryInfo,\n} from \"./TestSummaryUtils\";\nexport {\n\tdefaultTimeoutDurationMs,\n\ttimeoutAwait,\n\ttimeoutPromise,\n\tTimeoutWithError,\n\tTimeoutWithValue,\n} from \"./timeoutUtils\";\nexport {\n\twaitForContainerConnection,\n\tgetContainerEntryPointBackCompat,\n\tgetDataStoreEntryPointBackCompat,\n} from \"./containerUtils\";\nexport { createContainerRuntimeFactoryWithDefaultDataStore } from \"./testContainerRuntimeFactoryWithDefaultDataStore\";\n"]}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -6,9 +6,15 @@ import { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
|
|
|
6
6
|
import { ISharedMap } from "@fluidframework/map";
|
|
7
7
|
import { IFluidDataStoreContext, IFluidDataStoreChannel } from "@fluidframework/runtime-definitions";
|
|
8
8
|
import { IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
9
|
+
/**
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
9
12
|
export interface IProvideTestFluidObject {
|
|
10
13
|
readonly ITestFluidObject: ITestFluidObject;
|
|
11
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
12
18
|
export interface ITestFluidObject extends IProvideTestFluidObject, IFluidLoadable {
|
|
13
19
|
root: ISharedMap;
|
|
14
20
|
readonly runtime: IFluidDataStoreRuntime;
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,uBAAuB,EAAE,cAAc;IAChF,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACjD"}
|
package/dist/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { ISharedMap } from \"@fluidframework/map\";\nimport {
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { ISharedMap } from \"@fluidframework/map\";\nimport {\n\tIFluidDataStoreContext,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\n\n/**\n * @alpha\n */\nexport interface IProvideTestFluidObject {\n\treadonly ITestFluidObject: ITestFluidObject;\n}\n\n/**\n * @alpha\n */\nexport interface ITestFluidObject extends IProvideTestFluidObject, IFluidLoadable {\n\troot: ISharedMap;\n\treadonly runtime: IFluidDataStoreRuntime;\n\treadonly channel: IFluidDataStoreChannel;\n\treadonly context: IFluidDataStoreContext;\n\tgetSharedObject<T = any>(id: string): Promise<T>;\n}\n"]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
1
|
import { IContainer, IHostLoader } from "@fluidframework/container-definitions";
|
|
6
2
|
import { IOpProcessingController } from "./testObjectProvider";
|
|
3
|
+
/**
|
|
4
|
+
* @alpha
|
|
5
|
+
*/
|
|
7
6
|
export declare class LoaderContainerTracker implements IOpProcessingController {
|
|
8
7
|
private readonly syncSummarizerClients;
|
|
9
8
|
private readonly containers;
|
|
@@ -35,14 +34,19 @@ export declare class LoaderContainerTracker implements IOpProcessingController {
|
|
|
35
34
|
reset(): void;
|
|
36
35
|
/**
|
|
37
36
|
* Make sure all the tracked containers are synchronized.
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* -
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
37
|
+
*
|
|
38
|
+
* No isDirty (non-readonly) containers
|
|
39
|
+
* No extra clientId in quorum of any container that is not tracked and still opened.
|
|
40
|
+
* - i.e. no pending Join/Leave message.
|
|
41
|
+
* No unresolved proposal (minSeqNum \>= lastProposalSeqNum)
|
|
42
|
+
* lastSequenceNumber of all container is the same
|
|
43
|
+
* clientSequenceNumberObserved is the same as clientSequenceNumber sent
|
|
44
|
+
* - this overlaps with !isDirty, but include task scheduler ops.
|
|
45
|
+
* - Trailing NoOp is tracked and don't count as pending ops.
|
|
46
|
+
*
|
|
47
|
+
* Containers that are already pause will resume process and paused again once
|
|
48
|
+
* everything is synchronized. Containers that aren't paused will remain unpaused when this
|
|
49
|
+
* function returns.
|
|
46
50
|
*/
|
|
47
51
|
ensureSynchronized(...containers: IContainer[]): Promise<void>;
|
|
48
52
|
/**
|
|
@@ -58,7 +62,8 @@ export declare class LoaderContainerTracker implements IOpProcessingController {
|
|
|
58
62
|
*
|
|
59
63
|
* @param containersToApply - the set of containers to check
|
|
60
64
|
*/
|
|
61
|
-
private
|
|
65
|
+
private needSequenceNumberSynchronize;
|
|
66
|
+
private containerIndexStrings;
|
|
62
67
|
/**
|
|
63
68
|
* Utility to wait for any clientId in quorum that is NOT associated with any container we
|
|
64
69
|
* tracked, indicating there is a pending join or leave op that we need to wait.
|
|
@@ -80,18 +85,37 @@ export declare class LoaderContainerTracker implements IOpProcessingController {
|
|
|
80
85
|
/**
|
|
81
86
|
* Pause all queue activities on the containers given, or all tracked containers
|
|
82
87
|
* Any containers given that is not tracked will be ignored.
|
|
88
|
+
*
|
|
89
|
+
* When a container is paused, it is assumed that we want fine grain control over op
|
|
90
|
+
* sequencing. This function will prepare the container and force it into write mode to
|
|
91
|
+
* avoid missing join messages or change the sequence of event when switching from read to
|
|
92
|
+
* write mode.
|
|
83
93
|
*/
|
|
84
94
|
pauseProcessing(...containers: IContainer[]): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* When a container is paused, it is assumed that we want fine grain control over op
|
|
97
|
+
* sequencing. This function will prepare the container and force it into write mode to
|
|
98
|
+
* avoid missing join messages or change the sequence of event when switching from read to
|
|
99
|
+
* write mode.
|
|
100
|
+
*
|
|
101
|
+
* @param container - the container to pause
|
|
102
|
+
* @param record - the record for the container
|
|
103
|
+
*/
|
|
104
|
+
private pauseContainer;
|
|
85
105
|
/**
|
|
86
106
|
* Pause all queue activities on all tracked containers, and resume only
|
|
87
107
|
* inbound to process ops until it is idle. All queues are left in the paused state
|
|
88
|
-
* after the function
|
|
108
|
+
* after the function.
|
|
109
|
+
*
|
|
110
|
+
* Pausing will switch the container to write mode. See `pauseProcessing`
|
|
89
111
|
*/
|
|
90
112
|
processIncoming(...containers: IContainer[]): Promise<void>;
|
|
91
113
|
/**
|
|
92
114
|
* Pause all queue activities on all tracked containers, and resume only
|
|
93
115
|
* outbound to process ops until it is idle. All queues are left in the paused state
|
|
94
|
-
* after the function
|
|
116
|
+
* after the function.
|
|
117
|
+
*
|
|
118
|
+
* Pausing will switch the container to write mode. See `pauseProcessing`
|
|
95
119
|
*/
|
|
96
120
|
processOutgoing(...containers: IContainer[]): Promise<void>;
|
|
97
121
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaderContainerTracker.d.ts","sourceRoot":"","sources":["../src/loaderContainerTracker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loaderContainerTracker.d.ts","sourceRoot":"","sources":["../src/loaderContainerTracker.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAe,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAe7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAuB/D;;GAEG;AACH,qBAAa,sBAAuB,YAAW,uBAAuB;IAIzD,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAHlD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0C;IACrE,OAAO,CAAC,kBAAkB,CAAa;gBAEV,qBAAqB,GAAE,OAAe;IAEnE;;;OAGG;IACI,GAAG,CAAC,UAAU,SAAS,WAAW,EAAE,MAAM,EAAE,UAAU;IAmB7D;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAoDpB;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAuC1B,OAAO,CAAC,iBAAiB;IAQzB;;OAEG;IACI,KAAK;IAUZ;;;;;;;;;;;;;;;OAeG;IACU,kBAAkB,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA2E3E;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IA8BzB;;;;;OAKG;IACH,OAAO,CAAC,6BAA6B;IAmErC,OAAO,CAAC,qBAAqB;IAO7B;;;;;;;OAOG;YACW,qBAAqB;IAoCnC;;;OAGG;YACW,oBAAoB;IAclC;;OAEG;IACI,gBAAgB,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;IAoBnD;;;;;;;;OAQG;IACU,eAAe,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;IAexD;;;;;;;;OAQG;YACW,cAAc;IAwD5B;;;;;;OAMG;IACU,eAAe,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;IAIxD;;;;;;OAMG;IACU,eAAe,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE;IAIxD;;OAEG;YACW,YAAY;IAgD1B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;OAEG;IACH,OAAO,CAAC,UAAU;IAwElB;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAKrB"}
|