@fluidframework/container-loader 2.63.0-359734 → 2.63.0
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/CHANGELOG.md +4 -0
- package/api-report/container-loader.legacy.alpha.api.md +31 -0
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +12 -8
- package/dist/container.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +7 -13
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +9 -14
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/createAndLoadContainerUtils.d.ts +13 -0
- package/dist/createAndLoadContainerUtils.d.ts.map +1 -1
- package/dist/createAndLoadContainerUtils.js +118 -2
- package/dist/createAndLoadContainerUtils.js.map +1 -1
- package/dist/frozenServices.d.ts +10 -1
- package/dist/frozenServices.d.ts.map +1 -1
- package/dist/frozenServices.js +24 -4
- package/dist/frozenServices.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/legacyAlpha.d.ts +7 -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/serializedStateManager.d.ts +10 -6
- package/dist/serializedStateManager.d.ts.map +1 -1
- package/dist/serializedStateManager.js +76 -77
- package/dist/serializedStateManager.js.map +1 -1
- package/dist/summarizerResultTypes.d.ts +96 -0
- package/dist/summarizerResultTypes.d.ts.map +1 -0
- package/dist/summarizerResultTypes.js +9 -0
- package/dist/summarizerResultTypes.js.map +1 -0
- package/dist/utils.d.ts +4 -5
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +14 -13
- package/dist/utils.js.map +1 -1
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +13 -9
- package/lib/container.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +7 -13
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +10 -15
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/createAndLoadContainerUtils.d.ts +13 -0
- package/lib/createAndLoadContainerUtils.d.ts.map +1 -1
- package/lib/createAndLoadContainerUtils.js +117 -2
- package/lib/createAndLoadContainerUtils.js.map +1 -1
- package/lib/frozenServices.d.ts +10 -1
- package/lib/frozenServices.d.ts.map +1 -1
- package/lib/frozenServices.js +20 -1
- package/lib/frozenServices.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/legacyAlpha.d.ts +7 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/serializedStateManager.d.ts +10 -6
- package/lib/serializedStateManager.d.ts.map +1 -1
- package/lib/serializedStateManager.js +78 -79
- package/lib/serializedStateManager.js.map +1 -1
- package/lib/summarizerResultTypes.d.ts +96 -0
- package/lib/summarizerResultTypes.d.ts.map +1 -0
- package/lib/summarizerResultTypes.js +6 -0
- package/lib/summarizerResultTypes.js.map +1 -0
- package/lib/utils.d.ts +4 -5
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +15 -14
- package/lib/utils.js.map +1 -1
- package/package.json +11 -11
- package/src/container.ts +19 -14
- package/src/containerStorageAdapter.ts +14 -18
- package/src/createAndLoadContainerUtils.ts +176 -2
- package/src/frozenServices.ts +28 -2
- package/src/index.ts +8 -0
- package/src/packageVersion.ts +1 -1
- package/src/serializedStateManager.ts +118 -109
- package/src/summarizerResultTypes.ts +115 -0
- package/src/utils.ts +20 -20
package/src/container.ts
CHANGED
|
@@ -153,7 +153,6 @@ import {
|
|
|
153
153
|
SerializedStateManager,
|
|
154
154
|
} from "./serializedStateManager.js";
|
|
155
155
|
import {
|
|
156
|
-
type ISnapshotTreeWithBlobContents,
|
|
157
156
|
combineAppAndProtocolSummary,
|
|
158
157
|
combineSnapshotTreeAndSnapshotBlobs,
|
|
159
158
|
getDetachedContainerStateFromSerializedContainer,
|
|
@@ -162,6 +161,7 @@ import {
|
|
|
162
161
|
getISnapshotFromSerializedContainer,
|
|
163
162
|
runSingle,
|
|
164
163
|
convertISnapshotToSnapshotWithBlobs,
|
|
164
|
+
convertSnapshotInfoToSnapshot,
|
|
165
165
|
} from "./utils.js";
|
|
166
166
|
|
|
167
167
|
const detachedContainerRefSeqNumber = 0;
|
|
@@ -1013,7 +1013,6 @@ export class Container
|
|
|
1013
1013
|
this.storageAdapter = new ContainerStorageAdapter(
|
|
1014
1014
|
this.detachedBlobStorage,
|
|
1015
1015
|
this.mc.logger,
|
|
1016
|
-
pendingLocalState?.snapshotBlobs,
|
|
1017
1016
|
pendingLocalState?.loadedGroupIdSnapshots,
|
|
1018
1017
|
addProtocolSummaryIfMissing,
|
|
1019
1018
|
enableSummarizeProtocolTree,
|
|
@@ -1023,7 +1022,7 @@ export class Container
|
|
|
1023
1022
|
this.isInteractiveClient &&
|
|
1024
1023
|
(this.mc.config.getBoolean("Fluid.Container.enableOfflineLoad") ??
|
|
1025
1024
|
this.mc.config.getBoolean("Fluid.Container.enableOfflineFull") ??
|
|
1026
|
-
options.enableOfflineLoad
|
|
1025
|
+
options.enableOfflineLoad !== false);
|
|
1027
1026
|
this.serializedStateManager = new SerializedStateManager(
|
|
1028
1027
|
this.subLogger,
|
|
1029
1028
|
this.storageAdapter,
|
|
@@ -1668,8 +1667,11 @@ export class Container
|
|
|
1668
1667
|
timings.phase2 = performanceNow();
|
|
1669
1668
|
|
|
1670
1669
|
// Fetch specified snapshot.
|
|
1671
|
-
const {
|
|
1672
|
-
|
|
1670
|
+
const {
|
|
1671
|
+
snapshot: baseSnapshot,
|
|
1672
|
+
version,
|
|
1673
|
+
attributes,
|
|
1674
|
+
} = await this.serializedStateManager.fetchSnapshot(specifiedVersion, pendingLocalState);
|
|
1673
1675
|
const baseSnapshotTree: ISnapshotTree | undefined = getSnapshotTree(baseSnapshot);
|
|
1674
1676
|
this._loadedFromVersion = version;
|
|
1675
1677
|
|
|
@@ -1845,18 +1847,20 @@ export class Container
|
|
|
1845
1847
|
0x250 /* "serialized container with attachment blobs must be rehydrated with detached blob storage" */,
|
|
1846
1848
|
);
|
|
1847
1849
|
}
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1850
|
+
|
|
1851
|
+
const snapshot = convertSnapshotInfoToSnapshot({
|
|
1852
|
+
baseSnapshot,
|
|
1853
|
+
snapshotBlobs,
|
|
1854
|
+
snapshotSequenceNumber: 0,
|
|
1855
|
+
});
|
|
1856
|
+
|
|
1857
|
+
this.storageAdapter.cacheSnapshotBlobs(snapshot.blobContents);
|
|
1858
|
+
const attributes = await getDocumentAttributes(this.storageAdapter, snapshot.snapshotTree);
|
|
1855
1859
|
|
|
1856
1860
|
await this.attachDeltaManagerOpHandler(attributes);
|
|
1857
1861
|
|
|
1858
1862
|
// Initialize the protocol handler
|
|
1859
|
-
const baseTree = getProtocolSnapshotTree(
|
|
1863
|
+
const baseTree = getProtocolSnapshotTree(snapshot.snapshotTree);
|
|
1860
1864
|
const qValues = await readAndParse<[string, ICommittedProposal][]>(
|
|
1861
1865
|
this.storageAdapter,
|
|
1862
1866
|
baseTree.blobs.quorumValues,
|
|
@@ -1873,8 +1877,9 @@ export class Container
|
|
|
1873
1877
|
|
|
1874
1878
|
await this.instantiateRuntime(
|
|
1875
1879
|
codeDetails,
|
|
1876
|
-
|
|
1880
|
+
combineSnapshotTreeAndSnapshotBlobs(snapshot),
|
|
1877
1881
|
pendingRuntimeState,
|
|
1882
|
+
snapshot,
|
|
1878
1883
|
);
|
|
1879
1884
|
|
|
1880
1885
|
this.setLoaded();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { bufferToString
|
|
6
|
+
import { bufferToString } from "@fluid-internal/client-utils";
|
|
7
7
|
import type {
|
|
8
8
|
ISnapshotTreeWithBlobContents,
|
|
9
9
|
IContainerStorageService,
|
|
@@ -31,7 +31,7 @@ import { ProtocolTreeStorageService } from "./protocolTreeDocumentStorageService
|
|
|
31
31
|
import { RetriableDocumentStorageService } from "./retriableDocumentStorageService.js";
|
|
32
32
|
import type {
|
|
33
33
|
ISerializedStateManagerDocumentStorageService,
|
|
34
|
-
|
|
34
|
+
SerializedSnapshotInfo,
|
|
35
35
|
} from "./serializedStateManager.js";
|
|
36
36
|
import { convertSnapshotInfoToSnapshot } from "./utils.js";
|
|
37
37
|
|
|
@@ -71,6 +71,11 @@ export class ContainerStorageAdapter
|
|
|
71
71
|
return this._loadedGroupIdSnapshots;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* ArrayBufferLikes containing blobs from a snapshot
|
|
76
|
+
*/
|
|
77
|
+
private readonly blobContents: { [id: string]: ArrayBufferLike } = {};
|
|
78
|
+
|
|
74
79
|
/**
|
|
75
80
|
* An adapter that ensures we're using detachedBlobStorage up until we connect to a real service, and then
|
|
76
81
|
* after connecting to a real service augments it with retry and combined summary tree enforcement.
|
|
@@ -84,11 +89,9 @@ export class ContainerStorageAdapter
|
|
|
84
89
|
public constructor(
|
|
85
90
|
detachedBlobStorage: MemoryDetachedBlobStorage | undefined,
|
|
86
91
|
private readonly logger: ITelemetryLoggerExt,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
private readonly blobContents: { [id: string]: ArrayBufferLike | string } = {},
|
|
91
|
-
private loadingGroupIdSnapshotsFromPendingState: Record<string, ISnapshotInfo> | undefined,
|
|
92
|
+
private loadingGroupIdSnapshotsFromPendingState:
|
|
93
|
+
| Record<string, SerializedSnapshotInfo>
|
|
94
|
+
| undefined,
|
|
92
95
|
private readonly addProtocolSummaryIfMissing: (summaryTree: ISummaryTree) => ISummaryTree,
|
|
93
96
|
private readonly enableSummarizeProtocolTree: boolean | undefined,
|
|
94
97
|
) {
|
|
@@ -141,9 +144,9 @@ export class ContainerStorageAdapter
|
|
|
141
144
|
);
|
|
142
145
|
}
|
|
143
146
|
|
|
144
|
-
public
|
|
145
|
-
for (const [id, value] of
|
|
146
|
-
this.blobContents[id]
|
|
147
|
+
public cacheSnapshotBlobs(snapshotBlobs: Map<string, ArrayBuffer>): void {
|
|
148
|
+
for (const [id, value] of snapshotBlobs.entries()) {
|
|
149
|
+
this.blobContents[id] ??= value;
|
|
147
150
|
}
|
|
148
151
|
}
|
|
149
152
|
|
|
@@ -184,10 +187,7 @@ export class ContainerStorageAdapter
|
|
|
184
187
|
const localSnapshot =
|
|
185
188
|
this.loadingGroupIdSnapshotsFromPendingState[snapshotFetchOptions.loadingGroupIds[0]];
|
|
186
189
|
assert(localSnapshot !== undefined, 0x970 /* Local snapshot must be present */);
|
|
187
|
-
snapshot = convertSnapshotInfoToSnapshot(
|
|
188
|
-
localSnapshot,
|
|
189
|
-
localSnapshot.snapshotSequenceNumber,
|
|
190
|
-
);
|
|
190
|
+
snapshot = convertSnapshotInfoToSnapshot(localSnapshot);
|
|
191
191
|
} else {
|
|
192
192
|
if (this._storageService.getSnapshot === undefined) {
|
|
193
193
|
throw new UsageError(
|
|
@@ -221,10 +221,6 @@ export class ContainerStorageAdapter
|
|
|
221
221
|
public async readBlob(id: string): Promise<ArrayBufferLike> {
|
|
222
222
|
const maybeBlob = this.blobContents[id];
|
|
223
223
|
if (maybeBlob !== undefined) {
|
|
224
|
-
if (typeof maybeBlob === "string") {
|
|
225
|
-
const blob = stringToBuffer(maybeBlob, "utf8");
|
|
226
|
-
return blob;
|
|
227
|
-
}
|
|
228
224
|
return maybeBlob;
|
|
229
225
|
}
|
|
230
226
|
return this._storageService.readBlob(id);
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
IFluidCodeDetails,
|
|
10
10
|
IContainerPolicies,
|
|
11
11
|
} from "@fluidframework/container-definitions/internal";
|
|
12
|
+
import { LoaderHeader } from "@fluidframework/container-definitions/internal";
|
|
12
13
|
import type {
|
|
13
14
|
FluidObject,
|
|
14
15
|
IConfigProviderBase,
|
|
@@ -20,10 +21,44 @@ import type {
|
|
|
20
21
|
IDocumentServiceFactory,
|
|
21
22
|
IUrlResolver,
|
|
22
23
|
} from "@fluidframework/driver-definitions/internal";
|
|
24
|
+
import { DriverHeader } from "@fluidframework/driver-definitions/internal";
|
|
25
|
+
import {
|
|
26
|
+
GenericError,
|
|
27
|
+
normalizeError,
|
|
28
|
+
createChildMonitoringContext,
|
|
29
|
+
mixinMonitoringContext,
|
|
30
|
+
sessionStorageConfigProvider,
|
|
31
|
+
PerformanceEvent,
|
|
32
|
+
isFluidError,
|
|
33
|
+
} from "@fluidframework/telemetry-utils/internal";
|
|
34
|
+
import { v4 as uuid } from "uuid";
|
|
23
35
|
|
|
24
|
-
import {
|
|
36
|
+
import { DebugLogger } from "./debugLogger.js";
|
|
37
|
+
import { createFrozenDocumentServiceFactory } from "./frozenServices.js";
|
|
25
38
|
import { Loader } from "./loader.js";
|
|
39
|
+
import { pkgVersion } from "./packageVersion.js";
|
|
26
40
|
import type { ProtocolHandlerBuilder } from "./protocol.js";
|
|
41
|
+
import type {
|
|
42
|
+
LoadSummarizerSummaryResult,
|
|
43
|
+
OnDemandSummaryResults,
|
|
44
|
+
SummarizeOnDemandResults,
|
|
45
|
+
} from "./summarizerResultTypes.js";
|
|
46
|
+
|
|
47
|
+
interface OnDemandSummarizeResultsPromises {
|
|
48
|
+
readonly summarySubmitted: Promise<SummarizeOnDemandResults["summarySubmitted"]>;
|
|
49
|
+
readonly summaryOpBroadcasted: Promise<SummarizeOnDemandResults["summaryOpBroadcasted"]>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface OnDemandSummarizeOptions {
|
|
53
|
+
readonly reason?: string;
|
|
54
|
+
readonly retryOnFailure?: boolean;
|
|
55
|
+
readonly fullTree?: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface SummarizerLike {
|
|
59
|
+
readonly ISummarizer?: SummarizerLike;
|
|
60
|
+
summarizeOnDemand(options: OnDemandSummarizeOptions): OnDemandSummarizeResultsPromises;
|
|
61
|
+
}
|
|
27
62
|
|
|
28
63
|
/**
|
|
29
64
|
* Properties necessary for creating and loading a container.
|
|
@@ -103,6 +138,15 @@ export interface ILoadExistingContainerProps extends ICreateAndLoadContainerProp
|
|
|
103
138
|
readonly pendingLocalState?: string | undefined;
|
|
104
139
|
}
|
|
105
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Props used to load summarizer container.
|
|
143
|
+
* @legacy @alpha
|
|
144
|
+
*/
|
|
145
|
+
export type ILoadSummarizerContainerProps = Omit<
|
|
146
|
+
ILoadExistingContainerProps,
|
|
147
|
+
"pendingLocalState"
|
|
148
|
+
>;
|
|
149
|
+
|
|
106
150
|
/**
|
|
107
151
|
* Props used to create a detached container.
|
|
108
152
|
* @legacy @beta
|
|
@@ -197,6 +241,136 @@ export async function loadFrozenContainerFromPendingState(
|
|
|
197
241
|
): Promise<IContainer> {
|
|
198
242
|
return loadExistingContainer({
|
|
199
243
|
...props,
|
|
200
|
-
documentServiceFactory:
|
|
244
|
+
documentServiceFactory: createFrozenDocumentServiceFactory(props.documentServiceFactory),
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Loads a summarizer container with the required headers, triggers an on-demand summary, and then closes it.
|
|
250
|
+
* Returns success/failure and an optional error for host-side handling.
|
|
251
|
+
*
|
|
252
|
+
* @legacy @alpha
|
|
253
|
+
*/
|
|
254
|
+
export async function loadSummarizerContainerAndMakeSummary(
|
|
255
|
+
loadSummarizerContainerProps: ILoadSummarizerContainerProps,
|
|
256
|
+
): Promise<LoadSummarizerSummaryResult> {
|
|
257
|
+
const { logger, configProvider, request: originalRequest } = loadSummarizerContainerProps;
|
|
258
|
+
const telemetryProps = {
|
|
259
|
+
loaderId: uuid(),
|
|
260
|
+
loaderVersion: pkgVersion,
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
const subMc = mixinMonitoringContext(
|
|
264
|
+
DebugLogger.mixinDebugLogger("fluid:telemetry", logger, {
|
|
265
|
+
all: telemetryProps,
|
|
266
|
+
}),
|
|
267
|
+
sessionStorageConfigProvider.value,
|
|
268
|
+
configProvider,
|
|
269
|
+
);
|
|
270
|
+
const mc = createChildMonitoringContext({
|
|
271
|
+
logger: subMc.logger,
|
|
272
|
+
namespace: "SummarizerOnDemand",
|
|
201
273
|
});
|
|
274
|
+
return PerformanceEvent.timedExecAsync(
|
|
275
|
+
mc.logger,
|
|
276
|
+
{ eventName: "SummarizerOnDemandSummary" },
|
|
277
|
+
async (event) => {
|
|
278
|
+
const baseHeaders = originalRequest.headers;
|
|
279
|
+
const request = {
|
|
280
|
+
...originalRequest,
|
|
281
|
+
headers: {
|
|
282
|
+
...baseHeaders,
|
|
283
|
+
[LoaderHeader.cache]: false,
|
|
284
|
+
[LoaderHeader.clientDetails]: {
|
|
285
|
+
capabilities: { interactive: false },
|
|
286
|
+
type: "summarizer",
|
|
287
|
+
},
|
|
288
|
+
[DriverHeader.summarizingClient]: true,
|
|
289
|
+
[LoaderHeader.reconnect]: false,
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const container = await loadExistingContainer({
|
|
294
|
+
...loadSummarizerContainerProps,
|
|
295
|
+
request,
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
let summarySubmitted: SummarizeOnDemandResults["summarySubmitted"];
|
|
299
|
+
let summaryOpBroadcasted: SummarizeOnDemandResults["summaryOpBroadcasted"];
|
|
300
|
+
try {
|
|
301
|
+
if (container.getEntryPoint === undefined) {
|
|
302
|
+
throw new GenericError("container.getEntryPoint() is undefined");
|
|
303
|
+
}
|
|
304
|
+
const fluidObject = (await container.getEntryPoint()) as FluidObject<SummarizerLike>;
|
|
305
|
+
const summarizer = fluidObject?.ISummarizer;
|
|
306
|
+
if (summarizer === undefined) {
|
|
307
|
+
throw new GenericError("Summarizer entry point not available");
|
|
308
|
+
}
|
|
309
|
+
// Host controlled feature gate for fullTree
|
|
310
|
+
// Default value will be false
|
|
311
|
+
const fullTreeGate =
|
|
312
|
+
mc.config.getBoolean("Fluid.Summarizer.FullTree.OnDemand") === true;
|
|
313
|
+
|
|
314
|
+
const summarizeResults: OnDemandSummarizeResultsPromises =
|
|
315
|
+
summarizer.summarizeOnDemand({
|
|
316
|
+
reason: "summaryOnRequest",
|
|
317
|
+
retryOnFailure: true,
|
|
318
|
+
fullTree: fullTreeGate,
|
|
319
|
+
});
|
|
320
|
+
[summarySubmitted, summaryOpBroadcasted] = await Promise.all([
|
|
321
|
+
summarizeResults.summarySubmitted,
|
|
322
|
+
summarizeResults.summaryOpBroadcasted,
|
|
323
|
+
]);
|
|
324
|
+
|
|
325
|
+
const summaryResults: OnDemandSummaryResults = {
|
|
326
|
+
summarySubmitted: summarySubmitted.success,
|
|
327
|
+
summaryInfo: summarySubmitted.success
|
|
328
|
+
? {
|
|
329
|
+
stage: summarySubmitted.data.stage,
|
|
330
|
+
handle: summaryOpBroadcasted.success
|
|
331
|
+
? summaryOpBroadcasted.data.summarizeOp.contents.handle
|
|
332
|
+
: undefined,
|
|
333
|
+
}
|
|
334
|
+
: {},
|
|
335
|
+
summaryOpBroadcasted: summaryOpBroadcasted.success,
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
if (summarySubmitted.success && summaryOpBroadcasted.success) {
|
|
339
|
+
event.end({
|
|
340
|
+
success: true,
|
|
341
|
+
summarySubmitted: true,
|
|
342
|
+
summaryOpBroadcasted: true,
|
|
343
|
+
});
|
|
344
|
+
return {
|
|
345
|
+
success: true,
|
|
346
|
+
summaryResults,
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const failureError =
|
|
351
|
+
summarySubmitted.success === false
|
|
352
|
+
? summarySubmitted.error
|
|
353
|
+
: summaryOpBroadcasted.success === false
|
|
354
|
+
? summaryOpBroadcasted.error
|
|
355
|
+
: new GenericError("On demand summary failed");
|
|
356
|
+
|
|
357
|
+
event.end({
|
|
358
|
+
success: false,
|
|
359
|
+
summarySubmitted: summarySubmitted.success,
|
|
360
|
+
summaryOpBroadcasted: summaryOpBroadcasted.success,
|
|
361
|
+
});
|
|
362
|
+
return {
|
|
363
|
+
success: false,
|
|
364
|
+
error: failureError,
|
|
365
|
+
};
|
|
366
|
+
} catch (error) {
|
|
367
|
+
event.cancel({ success: false }, error);
|
|
368
|
+
const caughtError = isFluidError(error) ? error : normalizeError(error);
|
|
369
|
+
return { success: false, error: caughtError };
|
|
370
|
+
} finally {
|
|
371
|
+
container.dispose();
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
{ start: true, end: true, cancel: "generic" },
|
|
375
|
+
);
|
|
202
376
|
}
|
package/src/frozenServices.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
7
7
|
import type { IDisposable } from "@fluidframework/core-interfaces";
|
|
8
|
+
import { isPromiseLike } from "@fluidframework/core-utils/internal";
|
|
8
9
|
import {
|
|
9
10
|
ScopeType,
|
|
10
11
|
type ConnectionMode,
|
|
@@ -28,13 +29,38 @@ import {
|
|
|
28
29
|
|
|
29
30
|
import type { IConnectionStateChangeReason } from "./contracts.js";
|
|
30
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Creation of a FrozenDocumentServiceFactory which wraps an existing
|
|
34
|
+
* DocumentServiceFactory to provide a storage-only document service.
|
|
35
|
+
*
|
|
36
|
+
* @param documentServiceFactory - The underlying DocumentServiceFactory to wrap.
|
|
37
|
+
* @returns A FrozenDocumentServiceFactory
|
|
38
|
+
* @legacy @alpha
|
|
39
|
+
*/
|
|
40
|
+
export function createFrozenDocumentServiceFactory(
|
|
41
|
+
factory?: IDocumentServiceFactory | Promise<IDocumentServiceFactory>,
|
|
42
|
+
): IDocumentServiceFactory {
|
|
43
|
+
// Sync path
|
|
44
|
+
return factory instanceof FrozenDocumentServiceFactory
|
|
45
|
+
? factory
|
|
46
|
+
: new FrozenDocumentServiceFactory(factory);
|
|
47
|
+
}
|
|
48
|
+
|
|
31
49
|
export class FrozenDocumentServiceFactory implements IDocumentServiceFactory {
|
|
32
|
-
constructor(
|
|
50
|
+
constructor(
|
|
51
|
+
private readonly documentServiceFactory?:
|
|
52
|
+
| IDocumentServiceFactory
|
|
53
|
+
| Promise<IDocumentServiceFactory>,
|
|
54
|
+
) {}
|
|
33
55
|
|
|
34
56
|
async createDocumentService(resolvedUrl: IResolvedUrl): Promise<IDocumentService> {
|
|
57
|
+
let factory = this.documentServiceFactory;
|
|
58
|
+
if (isPromiseLike(factory)) {
|
|
59
|
+
factory = await this.documentServiceFactory;
|
|
60
|
+
}
|
|
35
61
|
return new FrozenDocumentService(
|
|
36
62
|
resolvedUrl,
|
|
37
|
-
await
|
|
63
|
+
await factory?.createDocumentService(resolvedUrl),
|
|
38
64
|
);
|
|
39
65
|
}
|
|
40
66
|
async createContainer(): Promise<IDocumentService> {
|
package/src/index.ts
CHANGED
|
@@ -5,17 +5,25 @@
|
|
|
5
5
|
|
|
6
6
|
export { ConnectionState } from "./connectionState.js";
|
|
7
7
|
export { type ContainerAlpha, waitContainerToCatchUp, asLegacyAlpha } from "./container.js";
|
|
8
|
+
export { createFrozenDocumentServiceFactory } from "./frozenServices.js";
|
|
8
9
|
export {
|
|
9
10
|
createDetachedContainer,
|
|
10
11
|
loadExistingContainer,
|
|
11
12
|
rehydrateDetachedContainer,
|
|
12
13
|
loadFrozenContainerFromPendingState,
|
|
14
|
+
loadSummarizerContainerAndMakeSummary,
|
|
13
15
|
type ICreateAndLoadContainerProps,
|
|
14
16
|
type ICreateDetachedContainerProps,
|
|
15
17
|
type ILoadExistingContainerProps,
|
|
18
|
+
type ILoadSummarizerContainerProps,
|
|
16
19
|
type IRehydrateDetachedContainerProps,
|
|
17
20
|
type ILoadFrozenContainerFromPendingStateProps,
|
|
18
21
|
} from "./createAndLoadContainerUtils.js";
|
|
22
|
+
export type {
|
|
23
|
+
LoadSummarizerSummaryResult,
|
|
24
|
+
OnDemandSummaryResults,
|
|
25
|
+
SummaryStage,
|
|
26
|
+
} from "./summarizerResultTypes.js";
|
|
19
27
|
export {
|
|
20
28
|
type ICodeDetailsLoader,
|
|
21
29
|
type IFluidModuleWithDetails,
|
package/src/packageVersion.ts
CHANGED