@fluidframework/container-loader 2.0.0-internal.6.4.0 → 2.0.0-internal.7.0.1
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 +108 -0
- package/dist/catchUpMonitor.d.ts +2 -2
- package/dist/catchUpMonitor.d.ts.map +1 -1
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +89 -67
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionState.js +1 -1
- package/dist/connectionState.js.map +1 -1
- package/dist/connectionStateHandler.js +9 -9
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +6 -1
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +215 -215
- package/dist/container.js.map +1 -1
- package/dist/containerContext.js +16 -16
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +6 -8
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +2 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/debugLogger.js +4 -4
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +86 -89
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.js +14 -14
- package/dist/deltaQueue.js.map +1 -1
- package/dist/loader.d.ts +2 -5
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +19 -84
- 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 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +3 -5
- package/dist/protocol.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/catchUpMonitor.d.ts +2 -2
- package/lib/catchUpMonitor.d.ts.map +1 -1
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +92 -68
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.js +9 -9
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +6 -1
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +216 -216
- package/lib/container.js.map +1 -1
- package/lib/containerContext.js +16 -16
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +6 -8
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts +2 -1
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/debugLogger.js +4 -4
- package/lib/debugLogger.js.map +1 -1
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +86 -89
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.js +14 -14
- package/lib/deltaQueue.js.map +1 -1
- package/lib/loader.d.ts +2 -5
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +19 -84
- 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 -2
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +1 -3
- package/lib/protocol.js.map +1 -1
- package/package.json +24 -18
- package/src/connectionManager.ts +37 -5
- package/src/container.ts +15 -15
- package/src/containerStorageAdapter.ts +0 -6
- package/src/contracts.ts +5 -1
- package/src/deltaManager.ts +6 -8
- package/src/loader.ts +23 -91
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +2 -6
package/src/container.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
TelemetryEventCategory,
|
|
16
16
|
IRequest,
|
|
17
17
|
IResponse,
|
|
18
|
+
// eslint-disable-next-line import/no-deprecated
|
|
18
19
|
IFluidRouter,
|
|
19
20
|
FluidObject,
|
|
20
21
|
LogLevel,
|
|
@@ -121,7 +122,6 @@ import { ConnectionManager } from "./connectionManager";
|
|
|
121
122
|
import { ConnectionState } from "./connectionState";
|
|
122
123
|
import {
|
|
123
124
|
IProtocolHandler,
|
|
124
|
-
OnlyValidTermValue,
|
|
125
125
|
ProtocolHandler,
|
|
126
126
|
ProtocolHandlerBuilder,
|
|
127
127
|
protocolHandlerShouldProcessSignal,
|
|
@@ -359,7 +359,6 @@ export interface IPendingContainerState {
|
|
|
359
359
|
*/
|
|
360
360
|
savedOps: ISequencedDocumentMessage[];
|
|
361
361
|
url: string;
|
|
362
|
-
term: number;
|
|
363
362
|
clientId?: string;
|
|
364
363
|
}
|
|
365
364
|
|
|
@@ -595,6 +594,10 @@ export class Container
|
|
|
595
594
|
return this._deltaManager.connectionManager.connectionMode;
|
|
596
595
|
}
|
|
597
596
|
|
|
597
|
+
/**
|
|
598
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
599
|
+
*/
|
|
600
|
+
// eslint-disable-next-line import/no-deprecated
|
|
598
601
|
public get IFluidRouter(): IFluidRouter {
|
|
599
602
|
return this;
|
|
600
603
|
}
|
|
@@ -1151,7 +1154,6 @@ export class Container
|
|
|
1151
1154
|
snapshotBlobs: this.baseSnapshotBlobs,
|
|
1152
1155
|
savedOps: this.savedOps,
|
|
1153
1156
|
url: this.resolvedUrl.url,
|
|
1154
|
-
term: OnlyValidTermValue,
|
|
1155
1157
|
// no need to save this if there is no pending runtime state
|
|
1156
1158
|
clientId: pendingRuntimeState !== undefined ? this.clientId : undefined,
|
|
1157
1159
|
};
|
|
@@ -1333,6 +1335,9 @@ export class Container
|
|
|
1333
1335
|
);
|
|
1334
1336
|
}
|
|
1335
1337
|
|
|
1338
|
+
/**
|
|
1339
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
1340
|
+
*/
|
|
1336
1341
|
public async request(path: IRequest): Promise<IResponse> {
|
|
1337
1342
|
return PerformanceEvent.timedExecAsync(
|
|
1338
1343
|
this.mc.logger,
|
|
@@ -1551,18 +1556,15 @@ export class Container
|
|
|
1551
1556
|
this.client.details.type === summarizerClientType,
|
|
1552
1557
|
);
|
|
1553
1558
|
|
|
1554
|
-
//
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
// connections to same file) in two ways:
|
|
1561
|
-
// A) creation flow breaks (as one of the clients "sees" file as existing, and hits #2 above)
|
|
1562
|
-
// B) Once file is created, transition from view-only connection to write does not work - some bugs to be fixed.
|
|
1559
|
+
// Except in cases where it has stashed ops or requested by feature gate, the container will connect in "read" mode
|
|
1560
|
+
const mode =
|
|
1561
|
+
this.mc.config.getBoolean("Fluid.Container.ForceWriteConnection") === true ||
|
|
1562
|
+
(pendingLocalState?.savedOps.length ?? 0) > 0
|
|
1563
|
+
? "write"
|
|
1564
|
+
: "read";
|
|
1563
1565
|
const connectionArgs: IConnectionArgs = {
|
|
1564
1566
|
reason: { text: "DocumentOpen" },
|
|
1565
|
-
mode
|
|
1567
|
+
mode,
|
|
1566
1568
|
fetchOpsFromStorage: false,
|
|
1567
1569
|
};
|
|
1568
1570
|
|
|
@@ -1791,7 +1793,6 @@ export class Container
|
|
|
1791
1793
|
private async createDetached(codeDetails: IFluidCodeDetails) {
|
|
1792
1794
|
const attributes: IDocumentAttributes = {
|
|
1793
1795
|
sequenceNumber: detachedContainerRefSeqNumber,
|
|
1794
|
-
term: OnlyValidTermValue,
|
|
1795
1796
|
minimumSequenceNumber: 0,
|
|
1796
1797
|
};
|
|
1797
1798
|
|
|
@@ -1857,7 +1858,6 @@ export class Container
|
|
|
1857
1858
|
return {
|
|
1858
1859
|
minimumSequenceNumber: 0,
|
|
1859
1860
|
sequenceNumber: 0,
|
|
1860
|
-
term: OnlyValidTermValue,
|
|
1861
1861
|
};
|
|
1862
1862
|
}
|
|
1863
1863
|
|
|
@@ -99,12 +99,6 @@ export class ContainerStorageAdapter implements IDocumentStorageService, IDispos
|
|
|
99
99
|
this.addProtocolSummaryIfMissing,
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
// ensure we did not lose that policy in the process of wrapping
|
|
104
|
-
assert(
|
|
105
|
-
storageService.policies?.minBlobSize === this._storageService.policies?.minBlobSize,
|
|
106
|
-
0x0e0 /* "lost minBlobSize policy" */,
|
|
107
|
-
);
|
|
108
102
|
}
|
|
109
103
|
|
|
110
104
|
public loadSnapshotForRehydratingContainer(snapshotTree: ISnapshotTreeWithBlobContents) {
|
package/src/contracts.ts
CHANGED
|
@@ -179,8 +179,12 @@ export interface IConnectionManagerFactoryArgs {
|
|
|
179
179
|
*
|
|
180
180
|
* @param readonly - Whether or not the container is now read-only.
|
|
181
181
|
* `undefined` indicates that user permissions are not yet known.
|
|
182
|
+
* @param readonlyConnectionReason - reason/error if any for the change
|
|
182
183
|
*/
|
|
183
|
-
readonly readonlyChangeHandler: (
|
|
184
|
+
readonly readonlyChangeHandler: (
|
|
185
|
+
readonly?: boolean,
|
|
186
|
+
readonlyConnectionReason?: IConnectionStateChangeReason,
|
|
187
|
+
) => void;
|
|
184
188
|
|
|
185
189
|
/**
|
|
186
190
|
* Called whenever we try to start establishing a new connection.
|
package/src/deltaManager.ts
CHANGED
|
@@ -50,7 +50,6 @@ import {
|
|
|
50
50
|
IConnectionStateChangeReason,
|
|
51
51
|
} from "./contracts";
|
|
52
52
|
import { DeltaQueue } from "./deltaQueue";
|
|
53
|
-
import { OnlyValidTermValue } from "./protocol";
|
|
54
53
|
import { ThrottlingWarning } from "./error";
|
|
55
54
|
|
|
56
55
|
export interface IConnectionArgs {
|
|
@@ -412,8 +411,12 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
412
411
|
connectHandler: (connection: IConnectionDetailsInternal) =>
|
|
413
412
|
this.connectHandler(connection),
|
|
414
413
|
pongHandler: (latency: number) => this.emit("pong", latency),
|
|
415
|
-
readonlyChangeHandler: (
|
|
416
|
-
|
|
414
|
+
readonlyChangeHandler: (
|
|
415
|
+
readonly?: boolean,
|
|
416
|
+
readonlyConnectionReason?: IConnectionStateChangeReason,
|
|
417
|
+
) => {
|
|
418
|
+
safeRaiseEvent(this, this.logger, "readonly", readonly, readonlyConnectionReason);
|
|
419
|
+
},
|
|
417
420
|
establishConnectionHandler: (reason: IConnectionStateChangeReason) =>
|
|
418
421
|
this.establishingConnection(reason),
|
|
419
422
|
cancelConnectionHandler: (reason: IConnectionStateChangeReason) =>
|
|
@@ -1059,11 +1062,6 @@ export class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
1059
1062
|
0x267 /* "lastObservedSeqNumber should be updated first" */,
|
|
1060
1063
|
);
|
|
1061
1064
|
|
|
1062
|
-
// Back-compat for older server with no term
|
|
1063
|
-
if (message.term === undefined) {
|
|
1064
|
-
message.term = OnlyValidTermValue;
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
1065
|
if (this.handler === undefined) {
|
|
1068
1066
|
throw new Error("Attempted to process an inbound message without a handler attached");
|
|
1069
1067
|
}
|
package/src/loader.ts
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
ITelemetryBaseLogger,
|
|
19
19
|
FluidObject,
|
|
20
|
+
// eslint-disable-next-line import/no-deprecated
|
|
20
21
|
IFluidRouter,
|
|
21
22
|
IRequest,
|
|
22
23
|
IRequestHeader,
|
|
@@ -45,10 +46,6 @@ import { pkgVersion } from "./packageVersion";
|
|
|
45
46
|
import { ProtocolHandlerBuilder } from "./protocol";
|
|
46
47
|
import { DebugLogger } from "./debugLogger";
|
|
47
48
|
|
|
48
|
-
function canUseCache(request: IRequest): boolean {
|
|
49
|
-
return request.headers?.[LoaderHeader.cache] === true;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
49
|
function ensureResolvedUrlDefined(
|
|
53
50
|
resolved: IResolvedUrl | undefined,
|
|
54
51
|
): asserts resolved is IResolvedUrl {
|
|
@@ -68,29 +65,26 @@ export class RelativeLoader implements ILoader {
|
|
|
68
65
|
/**
|
|
69
66
|
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
|
|
70
67
|
*/
|
|
68
|
+
// eslint-disable-next-line import/no-deprecated
|
|
71
69
|
public get IFluidRouter(): IFluidRouter {
|
|
72
70
|
return this;
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
public async resolve(request: IRequest): Promise<IContainer> {
|
|
76
74
|
if (request.url.startsWith("/")) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
);
|
|
92
|
-
return container;
|
|
93
|
-
}
|
|
75
|
+
ensureResolvedUrlDefined(this.container.resolvedUrl);
|
|
76
|
+
const container = await this.container.clone(
|
|
77
|
+
{
|
|
78
|
+
resolvedUrl: { ...this.container.resolvedUrl },
|
|
79
|
+
version: request.headers?.[LoaderHeader.version] ?? undefined,
|
|
80
|
+
loadMode: request.headers?.[LoaderHeader.loadMode],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
canReconnect: request.headers?.[LoaderHeader.reconnect],
|
|
84
|
+
clientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
return container;
|
|
94
88
|
}
|
|
95
89
|
|
|
96
90
|
if (this.loader === undefined) {
|
|
@@ -279,6 +273,7 @@ export type IDetachedBlobStorage = Pick<IDocumentStorageService, "createBlob" |
|
|
|
279
273
|
* With an already-resolved container, we can request a component directly, without loading the container again
|
|
280
274
|
* @param container - a resolved container
|
|
281
275
|
* @returns component on the container
|
|
276
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
282
277
|
*/
|
|
283
278
|
export async function requestResolvedObjectFromContainer(
|
|
284
279
|
container: IContainer,
|
|
@@ -291,6 +286,7 @@ export async function requestResolvedObjectFromContainer(
|
|
|
291
286
|
throw new Error(`Invalid URL ${container.resolvedUrl.url}`);
|
|
292
287
|
}
|
|
293
288
|
|
|
289
|
+
// eslint-disable-next-line import/no-deprecated
|
|
294
290
|
const entryPoint: FluidObject<IFluidRouter> | undefined = await container.getEntryPoint?.();
|
|
295
291
|
const router = entryPoint?.IFluidRouter ?? container.IFluidRouter;
|
|
296
292
|
|
|
@@ -304,7 +300,6 @@ export async function requestResolvedObjectFromContainer(
|
|
|
304
300
|
* Manages Fluid resource loading
|
|
305
301
|
*/
|
|
306
302
|
export class Loader implements IHostLoader {
|
|
307
|
-
private readonly containers = new Map<string, Promise<Container>>();
|
|
308
303
|
public readonly services: ILoaderServices;
|
|
309
304
|
private readonly mc: MonitoringContext;
|
|
310
305
|
|
|
@@ -354,6 +349,7 @@ export class Loader implements IHostLoader {
|
|
|
354
349
|
/**
|
|
355
350
|
* @deprecated - Will be removed in future major release. Migrate all usage of IFluidRouter to the Container's IFluidRouter/request.
|
|
356
351
|
*/
|
|
352
|
+
// eslint-disable-next-line import/no-deprecated
|
|
357
353
|
public get IFluidRouter(): IFluidRouter {
|
|
358
354
|
return this;
|
|
359
355
|
}
|
|
@@ -365,25 +361,13 @@ export class Loader implements IHostLoader {
|
|
|
365
361
|
clientDetailsOverride?: IClientDetails;
|
|
366
362
|
},
|
|
367
363
|
): Promise<IContainer> {
|
|
368
|
-
|
|
364
|
+
return Container.createDetached(
|
|
369
365
|
{
|
|
370
366
|
...createDetachedProps,
|
|
371
367
|
...this.services,
|
|
372
368
|
},
|
|
373
369
|
codeDetails,
|
|
374
370
|
);
|
|
375
|
-
|
|
376
|
-
if (this.cachingEnabled) {
|
|
377
|
-
container.once("attached", () => {
|
|
378
|
-
ensureResolvedUrlDefined(container.resolvedUrl);
|
|
379
|
-
const parsedUrl = parseUrl(container.resolvedUrl.url);
|
|
380
|
-
if (parsedUrl !== undefined) {
|
|
381
|
-
this.addToContainerCache(parsedUrl.id, Promise.resolve(container));
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
return container;
|
|
387
371
|
}
|
|
388
372
|
|
|
389
373
|
public async rehydrateDetachedContainerFromSnapshot(
|
|
@@ -430,37 +414,6 @@ export class Loader implements IHostLoader {
|
|
|
430
414
|
);
|
|
431
415
|
}
|
|
432
416
|
|
|
433
|
-
private getKeyForContainerCache(request: IRequest, parsedUrl: IParsedUrl): string {
|
|
434
|
-
const key =
|
|
435
|
-
request.headers?.[LoaderHeader.version] !== undefined
|
|
436
|
-
? `${parsedUrl.id}@${request.headers[LoaderHeader.version]}`
|
|
437
|
-
: parsedUrl.id;
|
|
438
|
-
return key;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
private addToContainerCache(key: string, containerP: Promise<Container>) {
|
|
442
|
-
this.containers.set(key, containerP);
|
|
443
|
-
containerP
|
|
444
|
-
.then((container) => {
|
|
445
|
-
// If the container is closed/disposed or becomes closed/disposed after we resolve it,
|
|
446
|
-
// remove it from the cache.
|
|
447
|
-
if (container.closed || container.disposed) {
|
|
448
|
-
this.containers.delete(key);
|
|
449
|
-
} else {
|
|
450
|
-
container.once("closed", () => {
|
|
451
|
-
this.containers.delete(key);
|
|
452
|
-
});
|
|
453
|
-
container.once("disposed", () => {
|
|
454
|
-
this.containers.delete(key);
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
})
|
|
458
|
-
.catch((error) => {
|
|
459
|
-
// If an error occured while resolving the container request, then remove it from the cache.
|
|
460
|
-
this.containers.delete(key);
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
|
|
464
417
|
private async resolveCore(
|
|
465
418
|
request: IRequest,
|
|
466
419
|
pendingLocalState?: IPendingContainerState,
|
|
@@ -489,11 +442,6 @@ export class Loader implements IHostLoader {
|
|
|
489
442
|
// If set in both query string and headers, use query string. Also write the value from the query string into the header either way.
|
|
490
443
|
request.headers[LoaderHeader.version] =
|
|
491
444
|
parsed.version ?? request.headers[LoaderHeader.version];
|
|
492
|
-
const cacheHeader = request.headers[LoaderHeader.cache];
|
|
493
|
-
const canCache =
|
|
494
|
-
// Take header value if present, else use ILoaderOptions.cache value
|
|
495
|
-
(cacheHeader !== undefined ? cacheHeader === true : this.cachingEnabled) &&
|
|
496
|
-
pendingLocalState === undefined;
|
|
497
445
|
const fromSequenceNumber = request.headers[LoaderHeader.sequenceNumber] as
|
|
498
446
|
| number
|
|
499
447
|
| undefined;
|
|
@@ -513,26 +461,10 @@ export class Loader implements IHostLoader {
|
|
|
513
461
|
throw new UsageError('opsBeforeReturn must be set to "sequenceNumber"');
|
|
514
462
|
}
|
|
515
463
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
if (maybeContainer !== undefined) {
|
|
521
|
-
container = maybeContainer;
|
|
522
|
-
} else {
|
|
523
|
-
const containerP = this.loadContainer(request, resolvedAsFluid);
|
|
524
|
-
this.addToContainerCache(key, containerP);
|
|
525
|
-
container = await containerP;
|
|
526
|
-
}
|
|
527
|
-
} else {
|
|
528
|
-
container = await this.loadContainer(request, resolvedAsFluid, pendingLocalState);
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
return { container, parsed };
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
private get cachingEnabled() {
|
|
535
|
-
return this.services.options.cache === true;
|
|
464
|
+
return {
|
|
465
|
+
container: await this.loadContainer(request, resolvedAsFluid, pendingLocalState),
|
|
466
|
+
parsed,
|
|
467
|
+
};
|
|
536
468
|
}
|
|
537
469
|
|
|
538
470
|
private async loadContainer(
|
package/src/packageVersion.ts
CHANGED
package/src/protocol.ts
CHANGED
|
@@ -13,16 +13,12 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
IDocumentAttributes,
|
|
15
15
|
IProcessMessageResult,
|
|
16
|
-
ISequencedClient,
|
|
17
16
|
ISequencedDocumentMessage,
|
|
18
17
|
ISignalClient,
|
|
19
18
|
ISignalMessage,
|
|
20
19
|
MessageType,
|
|
21
20
|
} from "@fluidframework/protocol-definitions";
|
|
22
21
|
|
|
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
|
-
|
|
26
22
|
// ADO: #1986: Start using enum from protocol-base.
|
|
27
23
|
export enum SignalType {
|
|
28
24
|
ClientJoin = "join", // same value as MessageType.ClientJoin,
|
|
@@ -75,11 +71,11 @@ export class ProtocolHandler extends ProtocolOpHandler implements IProtocolHandl
|
|
|
75
71
|
message: ISequencedDocumentMessage,
|
|
76
72
|
local: boolean,
|
|
77
73
|
): IProcessMessageResult {
|
|
78
|
-
const client: ISequencedClient | undefined = this.quorum.getMember(message.clientId);
|
|
79
|
-
|
|
80
74
|
// Check and report if we're getting messages from a clientId that we previously
|
|
81
75
|
// flagged as shouldHaveLeft, or from a client that's not in the quorum but should be
|
|
82
76
|
if (message.clientId != null) {
|
|
77
|
+
const client = this.quorum.getMember(message.clientId);
|
|
78
|
+
|
|
83
79
|
if (client === undefined && message.type !== MessageType.ClientJoin) {
|
|
84
80
|
// pre-0.58 error message: messageClientIdMissingFromQuorum
|
|
85
81
|
throw new Error("Remote message's clientId is missing from the quorum");
|