@fluidframework/container-loader 2.0.0-dev.3.1.0.125672 → 2.0.0-dev.4.2.0.153917
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 +14 -0
- package/README.md +45 -4
- package/closeAndGetPendingLocalState.md +51 -0
- package/dist/connectionManager.d.ts +2 -1
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +59 -17
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionStateHandler.d.ts +4 -4
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +7 -0
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +44 -4
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +160 -105
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +18 -8
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +47 -4
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +41 -2
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +87 -11
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +2 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/deltaManager.d.ts +4 -5
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +7 -10
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaManagerProxy.d.ts +10 -22
- package/dist/deltaManagerProxy.d.ts.map +1 -1
- package/dist/deltaManagerProxy.js +14 -50
- package/dist/deltaManagerProxy.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +10 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +25 -16
- package/dist/loader.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/protocol.d.ts +1 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +4 -2
- package/dist/protocol.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts +6 -2
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/dist/protocolTreeDocumentStorageService.js +7 -4
- package/dist/protocolTreeDocumentStorageService.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -1
- package/dist/utils.js.map +1 -1
- package/lib/connectionManager.d.ts +2 -1
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +60 -18
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.d.ts +4 -4
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +7 -0
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +44 -4
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +164 -109
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +18 -8
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +48 -5
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +41 -2
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +85 -11
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts +2 -2
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/deltaManager.d.ts +4 -5
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +7 -10
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaManagerProxy.d.ts +10 -22
- package/lib/deltaManagerProxy.d.ts.map +1 -1
- package/lib/deltaManagerProxy.js +14 -50
- package/lib/deltaManagerProxy.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/loader.d.ts +10 -1
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +24 -16
- package/lib/loader.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/protocol.d.ts +1 -0
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +3 -1
- package/lib/protocol.js.map +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts +6 -2
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/protocolTreeDocumentStorageService.js +7 -4
- package/lib/protocolTreeDocumentStorageService.js.map +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +2 -1
- package/lib/utils.js.map +1 -1
- package/package.json +64 -56
- package/src/connectionManager.ts +65 -24
- package/src/connectionStateHandler.ts +17 -5
- package/src/container.ts +239 -137
- package/src/containerContext.ts +74 -11
- package/src/containerStorageAdapter.ts +113 -9
- package/src/contracts.ts +2 -2
- package/src/deltaManager.ts +12 -14
- package/src/deltaManagerProxy.ts +18 -73
- package/src/index.ts +3 -3
- package/src/loader.ts +31 -26
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +4 -1
- package/src/protocolTreeDocumentStorageService.ts +6 -3
- package/src/utils.ts +7 -4
package/src/loader.ts
CHANGED
|
@@ -36,15 +36,10 @@ import {
|
|
|
36
36
|
IDocumentServiceFactory,
|
|
37
37
|
IDocumentStorageService,
|
|
38
38
|
IFluidResolvedUrl,
|
|
39
|
-
IResolvedUrl,
|
|
40
39
|
IUrlResolver,
|
|
41
40
|
} from "@fluidframework/driver-definitions";
|
|
42
41
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
43
|
-
import {
|
|
44
|
-
ensureFluidResolvedUrl,
|
|
45
|
-
MultiUrlResolver,
|
|
46
|
-
MultiDocumentServiceFactory,
|
|
47
|
-
} from "@fluidframework/driver-utils";
|
|
42
|
+
import { ensureFluidResolvedUrl } from "@fluidframework/driver-utils";
|
|
48
43
|
import { Container, IPendingContainerState } from "./container";
|
|
49
44
|
import { IParsedUrl, parseUrl } from "./utils";
|
|
50
45
|
import { pkgVersion } from "./packageVersion";
|
|
@@ -58,6 +53,9 @@ function canUseCache(request: IRequest): boolean {
|
|
|
58
53
|
return request.headers[LoaderHeader.cache] !== false;
|
|
59
54
|
}
|
|
60
55
|
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated - In the next release RelativeLoader will no longer be exported. It is an internal class that should not be used directly.
|
|
58
|
+
*/
|
|
61
59
|
export class RelativeLoader implements ILoader {
|
|
62
60
|
constructor(
|
|
63
61
|
private readonly container: Container,
|
|
@@ -109,22 +107,6 @@ export class RelativeLoader implements ILoader {
|
|
|
109
107
|
}
|
|
110
108
|
}
|
|
111
109
|
|
|
112
|
-
function createCachedResolver(resolver: IUrlResolver) {
|
|
113
|
-
const cacheResolver = Object.create(resolver) as IUrlResolver;
|
|
114
|
-
const resolveCache = new Map<string, Promise<IResolvedUrl | undefined>>();
|
|
115
|
-
cacheResolver.resolve = async (request: IRequest): Promise<IResolvedUrl | undefined> => {
|
|
116
|
-
if (!canUseCache(request)) {
|
|
117
|
-
return resolver.resolve(request);
|
|
118
|
-
}
|
|
119
|
-
if (!resolveCache.has(request.url)) {
|
|
120
|
-
resolveCache.set(request.url, resolver.resolve(request));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return resolveCache.get(request.url);
|
|
124
|
-
};
|
|
125
|
-
return cacheResolver;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
110
|
export interface ILoaderOptions extends ILoaderOptions1 {
|
|
129
111
|
summarizeProtocolTree?: boolean;
|
|
130
112
|
}
|
|
@@ -275,6 +257,31 @@ export type IDetachedBlobStorage = Pick<IDocumentStorageService, "createBlob" |
|
|
|
275
257
|
getBlobIds(): string[];
|
|
276
258
|
};
|
|
277
259
|
|
|
260
|
+
/**
|
|
261
|
+
* With an already-resolved container, we can request a component directly, without loading the container again
|
|
262
|
+
* @param container - a resolved container
|
|
263
|
+
* @returns component on the container
|
|
264
|
+
*/
|
|
265
|
+
export async function requestResolvedObjectFromContainer(
|
|
266
|
+
container: IContainer,
|
|
267
|
+
headers?: IRequestHeader,
|
|
268
|
+
): Promise<IResponse> {
|
|
269
|
+
ensureFluidResolvedUrl(container.resolvedUrl);
|
|
270
|
+
const parsedUrl = parseUrl(container.resolvedUrl.url);
|
|
271
|
+
|
|
272
|
+
if (parsedUrl === undefined) {
|
|
273
|
+
throw new Error(`Invalid URL ${container.resolvedUrl.url}`);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const entryPoint: FluidObject<IFluidRouter> | undefined = await container.getEntryPoint?.();
|
|
277
|
+
const router = entryPoint?.IFluidRouter ?? container.IFluidRouter;
|
|
278
|
+
|
|
279
|
+
return router.request({
|
|
280
|
+
url: `${parsedUrl.path}${parsedUrl.query}`,
|
|
281
|
+
headers,
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
278
285
|
/**
|
|
279
286
|
* Manages Fluid resource loading
|
|
280
287
|
*/
|
|
@@ -303,10 +310,8 @@ export class Loader implements IHostLoader {
|
|
|
303
310
|
);
|
|
304
311
|
|
|
305
312
|
this.services = {
|
|
306
|
-
urlResolver:
|
|
307
|
-
documentServiceFactory:
|
|
308
|
-
loaderProps.documentServiceFactory,
|
|
309
|
-
),
|
|
313
|
+
urlResolver: loaderProps.urlResolver,
|
|
314
|
+
documentServiceFactory: loaderProps.documentServiceFactory,
|
|
310
315
|
codeLoader: loaderProps.codeLoader,
|
|
311
316
|
options: loaderProps.options ?? {},
|
|
312
317
|
scope,
|
package/src/packageVersion.ts
CHANGED
package/src/protocol.ts
CHANGED
|
@@ -20,6 +20,9 @@ import {
|
|
|
20
20
|
} from "@fluidframework/protocol-definitions";
|
|
21
21
|
import { canBeCoalescedByService } from "@fluidframework/driver-utils";
|
|
22
22
|
|
|
23
|
+
// "term" was an experimental feature that is being removed. The only safe value to use is 1.
|
|
24
|
+
export const OnlyValidTermValue = 1 as const;
|
|
25
|
+
|
|
23
26
|
// ADO: #1986: Start using enum from protocol-base.
|
|
24
27
|
export enum SignalType {
|
|
25
28
|
ClientJoin = "join", // same value as MessageType.ClientJoin,
|
|
@@ -51,7 +54,7 @@ export class ProtocolHandler extends ProtocolOpHandler implements IProtocolHandl
|
|
|
51
54
|
super(
|
|
52
55
|
attributes.minimumSequenceNumber,
|
|
53
56
|
attributes.sequenceNumber,
|
|
54
|
-
|
|
57
|
+
OnlyValidTermValue,
|
|
55
58
|
quorumSnapshot.members,
|
|
56
59
|
quorumSnapshot.proposals,
|
|
57
60
|
quorumSnapshot.values,
|
|
@@ -5,13 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
import { IDisposable } from "@fluidframework/common-definitions";
|
|
7
7
|
import { IDocumentStorageService, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
8
|
-
import { combineAppAndProtocolSummary } from "@fluidframework/driver-utils";
|
|
9
8
|
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
10
9
|
|
|
10
|
+
/**
|
|
11
|
+
* A storage service wrapper whose sole job is to intercept calls to uploadSummaryWithContext and ensure they include
|
|
12
|
+
* the protocol summary, using the provided callback to add it if necessary.
|
|
13
|
+
*/
|
|
11
14
|
export class ProtocolTreeStorageService implements IDocumentStorageService, IDisposable {
|
|
12
15
|
constructor(
|
|
13
16
|
private readonly internalStorageService: IDocumentStorageService & IDisposable,
|
|
14
|
-
private readonly
|
|
17
|
+
private readonly addProtocolSummaryIfMissing: (summaryTree: ISummaryTree) => ISummaryTree,
|
|
15
18
|
) {}
|
|
16
19
|
public get policies() {
|
|
17
20
|
return this.internalStorageService.policies;
|
|
@@ -35,7 +38,7 @@ export class ProtocolTreeStorageService implements IDocumentStorageService, IDis
|
|
|
35
38
|
context: ISummaryContext,
|
|
36
39
|
): Promise<string> {
|
|
37
40
|
return this.internalStorageService.uploadSummaryWithContext(
|
|
38
|
-
|
|
41
|
+
this.addProtocolSummaryIfMissing(summary),
|
|
39
42
|
context,
|
|
40
43
|
);
|
|
41
44
|
}
|
package/src/utils.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "@fluidframework/common-utils";
|
|
14
14
|
import { ISummaryTree, ISnapshotTree, SummaryType } from "@fluidframework/protocol-definitions";
|
|
15
15
|
import { LoggingError } from "@fluidframework/telemetry-utils";
|
|
16
|
+
import { isCombinedAppAndProtocolSummary } from "@fluidframework/driver-utils";
|
|
16
17
|
|
|
17
18
|
// This is used when we rehydrate a container from the snapshot. Here we put the blob contents
|
|
18
19
|
// in separate property: blobContents.
|
|
@@ -125,13 +126,15 @@ export function convertProtocolAndAppSummaryToSnapshotTree(
|
|
|
125
126
|
|
|
126
127
|
// This function converts the snapshot taken in detached container(by serialize api) to snapshotTree with which
|
|
127
128
|
// a detached container can be rehydrated.
|
|
128
|
-
export const getSnapshotTreeFromSerializedContainer = (
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
export const getSnapshotTreeFromSerializedContainer = (
|
|
130
|
+
detachedContainerSnapshot: ISummaryTree,
|
|
131
|
+
): ISnapshotTreeWithBlobContents => {
|
|
131
132
|
assert(
|
|
132
|
-
|
|
133
|
+
isCombinedAppAndProtocolSummary(detachedContainerSnapshot),
|
|
133
134
|
0x1e0 /* "Protocol and App summary trees should be present" */,
|
|
134
135
|
);
|
|
136
|
+
const protocolSummaryTree = detachedContainerSnapshot.tree[".protocol"];
|
|
137
|
+
const appSummaryTree = detachedContainerSnapshot.tree[".app"];
|
|
135
138
|
const snapshotTreeWithBlobContents = convertProtocolAndAppSummaryToSnapshotTree(
|
|
136
139
|
protocolSummaryTree,
|
|
137
140
|
appSummaryTree,
|