@fluidframework/container-loader 2.70.0-361248 → 2.70.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 +13 -0
- package/dist/container.d.ts +7 -4
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +92 -16
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +1 -0
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +1 -0
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +1 -8
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +0 -9
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/legacyAlpha.d.ts +1 -0
- package/dist/loaderLayerCompatState.d.ts +4 -3
- package/dist/loaderLayerCompatState.d.ts.map +1 -1
- package/dist/loaderLayerCompatState.js +4 -34
- package/dist/loaderLayerCompatState.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/pendingLocalStateStore.d.ts +84 -0
- package/dist/pendingLocalStateStore.d.ts.map +1 -0
- package/dist/pendingLocalStateStore.js +157 -0
- package/dist/pendingLocalStateStore.js.map +1 -0
- package/dist/protocol.d.ts +1 -0
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +43 -1
- package/dist/protocol.js.map +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +0 -4
- package/dist/utils.js.map +1 -1
- package/lib/container.d.ts +7 -4
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +93 -17
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +1 -0
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js +1 -0
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +1 -8
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +0 -9
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/legacyAlpha.d.ts +1 -0
- package/lib/loaderLayerCompatState.d.ts +4 -3
- package/lib/loaderLayerCompatState.d.ts.map +1 -1
- package/lib/loaderLayerCompatState.js +5 -35
- package/lib/loaderLayerCompatState.js.map +1 -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/pendingLocalStateStore.d.ts +84 -0
- package/lib/pendingLocalStateStore.d.ts.map +1 -0
- package/lib/pendingLocalStateStore.js +153 -0
- package/lib/pendingLocalStateStore.js.map +1 -0
- package/lib/protocol.d.ts +1 -0
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +41 -0
- package/lib/protocol.js.map +1 -1
- package/lib/utils.d.ts +1 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +0 -4
- package/lib/utils.js.map +1 -1
- package/package.json +11 -11
- package/src/container.ts +129 -31
- package/src/containerContext.ts +2 -0
- package/src/containerStorageAdapter.ts +1 -11
- package/src/index.ts +1 -0
- package/src/loaderLayerCompatState.ts +21 -36
- package/src/packageVersion.ts +1 -1
- package/src/pendingLocalStateStore.ts +160 -0
- package/src/protocol.ts +49 -0
- package/src/utils.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -203,6 +203,19 @@ export interface OnDemandSummaryResults {
|
|
|
203
203
|
readonly summarySubmitted: boolean;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
// @alpha @legacy
|
|
207
|
+
export class PendingLocalStateStore<TKey> {
|
|
208
|
+
[Symbol.iterator](): Iterator<[TKey, string]>;
|
|
209
|
+
clear(): void;
|
|
210
|
+
delete(key: TKey): boolean;
|
|
211
|
+
entries(): Iterator<[TKey, string]>;
|
|
212
|
+
get(key: TKey): string | undefined;
|
|
213
|
+
has(key: TKey): boolean;
|
|
214
|
+
keys(): IterableIterator<TKey>;
|
|
215
|
+
set(key: TKey, pendingLocalState: string): this;
|
|
216
|
+
get size(): number;
|
|
217
|
+
}
|
|
218
|
+
|
|
206
219
|
// @beta @legacy
|
|
207
220
|
export type ProtocolHandlerBuilder = (attributes: IDocumentAttributes, snapshot: IQuorumSnapshot, sendProposal: (key: string, value: any) => number) => IProtocolHandler;
|
|
208
221
|
|
package/dist/container.d.ts
CHANGED
|
@@ -141,6 +141,7 @@ export declare class Container extends EventEmitterWithErrorHandling<IContainerE
|
|
|
141
141
|
private readonly subLogger;
|
|
142
142
|
private readonly detachedBlobStorage;
|
|
143
143
|
private readonly protocolHandlerBuilder;
|
|
144
|
+
private readonly signalAudience;
|
|
144
145
|
private readonly client;
|
|
145
146
|
private readonly mc;
|
|
146
147
|
/**
|
|
@@ -347,12 +348,14 @@ export declare class Container extends EventEmitterWithErrorHandling<IContainerE
|
|
|
347
348
|
private instantiateRuntime;
|
|
348
349
|
private readonly updateDirtyContainerState;
|
|
349
350
|
/**
|
|
350
|
-
*
|
|
351
|
-
* This controls the "connected" state of the ContainerRuntime as well
|
|
352
|
-
* @param connected - Is the container currently connected?
|
|
351
|
+
* Send the connected status to the runtime.
|
|
353
352
|
* @param readonly - Is the container in readonly mode?
|
|
353
|
+
* @param onlyCallSetConnectionStateIfConnectedOrDisconnected - If true, only
|
|
354
|
+
* call older `setConnectionState` on the runtime if the connection state is
|
|
355
|
+
* either Connected or Disconnected. This exists to preserve older behavior
|
|
356
|
+
* where the runtime was only notified of these two states.
|
|
354
357
|
*/
|
|
355
|
-
private
|
|
358
|
+
private setConnectionStatus;
|
|
356
359
|
private handleDeltaConnectionArg;
|
|
357
360
|
}
|
|
358
361
|
/**
|
package/dist/container.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EACN,WAAW,EACX,KAAK,SAAS,EACd,KAAK,uBAAuB,EAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAGX,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EAMjB,YAAY,EAEZ,cAAc,EAEd,MAAM,gDAAgD,CAAC;AAExD,OAAO,EACN,KAAK,WAAW,EAEhB,KAAK,QAAQ,EACb,KAAK,wBAAwB,EAE7B,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAEN,KAAK,cAAc,EACnB,KAAK,cAAc,EAInB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAEN,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EAGjB,KAAK,YAAY,EAGjB,KAAK,gBAAgB,EAOrB,KAAK,yBAAyB,EAG9B,MAAM,6CAA6C,CAAC;AAWrD,OAAO,EAEN,KAAK,mBAAmB,EACxB,6BAA6B,EAe7B,MAAM,0CAA0C,CAAC;AAWlD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AA4BvD,OAAO,EAGN,KAAK,sBAAsB,
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EACN,WAAW,EACX,KAAK,SAAS,EACd,KAAK,uBAAuB,EAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAGX,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EAMjB,YAAY,EAEZ,cAAc,EAEd,MAAM,gDAAgD,CAAC;AA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M,CAAC,WAAW;IAqC1B;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,kBAAkB;YA4FZ,2BAA2B;IAmBzC,OAAO,CAAC,iCAAiC;IA4DzC,OAAO,CAAC,wBAAwB;IA2ChC,OAAO,CAAC,sBAAsB;IAyB9B;;OAEG;IACH,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,oBAAoB;IAsB5B,OAAO,CAAC,aAAa;IAwBrB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IA+C5B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,aAAa;YAUP,kBAAkB;IA8FhC,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAMxC;IAEF;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IAkF3B,OAAO,CAAC,wBAAwB;CAuChC;AAED;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,UAAU;IACjD;;;;;OAKG;IACH,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,CAE9D"}
|
package/dist/container.js
CHANGED
|
@@ -216,12 +216,16 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
216
216
|
// in the order that is not possible in real life, that it may not expect.
|
|
217
217
|
// Ideally, we should supply pendingLocalState?.clientId here as well, not in constructor, but it does not matter (at least today)
|
|
218
218
|
this.connectionStateHandler.initProtocol(this.protocolHandler);
|
|
219
|
-
// Propagate current connection state through the system.
|
|
220
|
-
const readonly = this.readOnlyInfo.readonly ?? false;
|
|
221
219
|
// This call does not look like needed any more, with delaying all connection-related events past loaded phase.
|
|
222
220
|
// Yet, there could be some customer code that would break if we do not deliver it.
|
|
223
221
|
// Will be removed in further PRs with proper changeset.
|
|
224
|
-
|
|
222
|
+
const runtime = this._runtime;
|
|
223
|
+
if (runtime !== undefined &&
|
|
224
|
+
// Check for older runtime that may need this call
|
|
225
|
+
!("setConnectionStatus" in runtime) &&
|
|
226
|
+
runtime.disposed === false) {
|
|
227
|
+
runtime.setConnectionState(false /* canSendOps */, this.clientId);
|
|
228
|
+
}
|
|
225
229
|
// Deliver delayed calls to DeltaManager - we ignored "connect" events while loading.
|
|
226
230
|
const cm = this._deltaManager.connectionManager;
|
|
227
231
|
if (cm.connected) {
|
|
@@ -381,6 +385,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
381
385
|
}, error);
|
|
382
386
|
this.close((0, internal_5.normalizeError)(error));
|
|
383
387
|
});
|
|
388
|
+
this.signalAudience = new audience_js_1.Audience();
|
|
384
389
|
/**
|
|
385
390
|
* Lifecycle state of the container, used mainly to prevent re-entrancy and telemetry
|
|
386
391
|
*
|
|
@@ -509,7 +514,8 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
509
514
|
const { canReconnect, clientDetailsOverride, urlResolver, documentServiceFactory, codeLoader, options, scope, subLogger, protocolHandlerBuilder, retryConnectionTimeoutMs, } = createProps;
|
|
510
515
|
// Validate that the Driver is compatible with this Loader.
|
|
511
516
|
const maybeDriverCompatDetails = documentServiceFactory;
|
|
512
|
-
(0, loaderLayerCompatState_js_1.validateDriverCompatibility)(maybeDriverCompatDetails.ILayerCompatDetails, (error) => { } /* disposeFn
|
|
517
|
+
(0, loaderLayerCompatState_js_1.validateDriverCompatibility)(maybeDriverCompatDetails.ILayerCompatDetails, (error) => { } /* disposeFn */, // There is nothing to dispose here, so just ignore the error.
|
|
518
|
+
subLogger);
|
|
513
519
|
this.connectionTransitionTimes[connectionState_js_1.ConnectionState.Disconnected] = (0, client_utils_1.performanceNow)();
|
|
514
520
|
const pendingLocalState = loadProps?.pendingLocalState;
|
|
515
521
|
this._canReconnect = canReconnect ?? true;
|
|
@@ -523,9 +529,8 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
523
529
|
// Tracking alternative ways to handle this in AB#4129.
|
|
524
530
|
this.options = { ...options };
|
|
525
531
|
this.scope = scope;
|
|
526
|
-
this.protocolHandlerBuilder =
|
|
527
|
-
|
|
528
|
-
((attributes, quorumSnapshot, sendProposal) => new protocol_js_1.ProtocolHandler(attributes, quorumSnapshot, sendProposal, new audience_js_1.Audience(), (clientId) => this.clientsWhoShouldHaveLeft.has(clientId)));
|
|
532
|
+
this.protocolHandlerBuilder = (0, protocol_js_1.wrapProtocolHandlerBuilder)(protocolHandlerBuilder ??
|
|
533
|
+
((attributes, quorumSnapshot, sendProposal) => new protocol_js_1.ProtocolHandler(attributes, quorumSnapshot, sendProposal, new audience_js_1.Audience(), (clientId) => this.clientsWhoShouldHaveLeft.has(clientId))), this.signalAudience);
|
|
529
534
|
// Note that we capture the createProps here so we can replicate the creation call when we want to clone.
|
|
530
535
|
this.clone = async (_loadProps, createParamOverrides) => {
|
|
531
536
|
return Container.load(_loadProps, {
|
|
@@ -1329,7 +1334,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1329
1334
|
});
|
|
1330
1335
|
deltaManager.on("readonly", (readonly) => {
|
|
1331
1336
|
if (this.loaded) {
|
|
1332
|
-
this.
|
|
1337
|
+
this.setConnectionStatus(readonly);
|
|
1333
1338
|
}
|
|
1334
1339
|
this.emit("readonly", readonly);
|
|
1335
1340
|
});
|
|
@@ -1405,7 +1410,18 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1405
1410
|
const clientId = this.connectionStateHandler.clientId;
|
|
1406
1411
|
(0, internal_2.assert)(clientId !== undefined, 0x96e /* there has to be clientId */);
|
|
1407
1412
|
this.protocolHandler.audience.setCurrentClientId(clientId);
|
|
1413
|
+
this.signalAudience.setCurrentClientId(clientId);
|
|
1414
|
+
}
|
|
1415
|
+
else if (this.connectionState === connectionState_js_1.ConnectionState.CatchingUp) {
|
|
1416
|
+
// Signal-based Audience does not wait for ops. So provide clientId
|
|
1417
|
+
// as soon as possible.
|
|
1418
|
+
const clientId = this.connectionStateHandler.pendingClientId;
|
|
1419
|
+
(0, internal_2.assert)(clientId !== undefined, 0xc89 /* catching up without clientId */);
|
|
1420
|
+
this.signalAudience.setCurrentClientId(clientId);
|
|
1408
1421
|
}
|
|
1422
|
+
this.setConnectionStatus(
|
|
1423
|
+
/* readonly */ this.readOnlyInfo.readonly ?? false,
|
|
1424
|
+
/* onlyCallSetConnectionStateIfConnectedOrDisconnected */ true);
|
|
1409
1425
|
// We communicate only transitions to Connected & Disconnected states, skipping all other states.
|
|
1410
1426
|
// This can be changed in the future, for example we likely should add "CatchingUp" event on Container.
|
|
1411
1427
|
if (this.connectionState !== connectionState_js_1.ConnectionState.Connected &&
|
|
@@ -1413,7 +1429,6 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1413
1429
|
return;
|
|
1414
1430
|
}
|
|
1415
1431
|
// Both protocol and context should not be undefined if we got so far.
|
|
1416
|
-
this.setContextConnectedState(connected, this.readOnlyInfo.readonly ?? false);
|
|
1417
1432
|
this.protocolHandler.setConnectionState(connected, this.clientId);
|
|
1418
1433
|
(0, internal_5.raiseConnectedEvent)(this.mc.logger, this, connected, this.clientId, disconnectedReason?.text);
|
|
1419
1434
|
}
|
|
@@ -1545,6 +1560,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1545
1560
|
storage: this.storageAdapter,
|
|
1546
1561
|
quorum: this.protocolHandler.quorum,
|
|
1547
1562
|
audience: this.protocolHandler.audience,
|
|
1563
|
+
signalAudience: this.signalAudience,
|
|
1548
1564
|
loader,
|
|
1549
1565
|
submitFn: (type, contents, batch, metadata) => this.submitContainerMessage(type, contents, batch, metadata),
|
|
1550
1566
|
submitSummaryFn: (summaryOp, referenceSequenceNumber) => this.submitSummaryMessage(summaryOp, referenceSequenceNumber),
|
|
@@ -1568,7 +1584,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1568
1584
|
const runtime = await internal_5.PerformanceEvent.timedExecAsync(this.subLogger, { eventName: "InstantiateRuntime" }, async () => runtimeFactory.instantiateRuntime(context, existing));
|
|
1569
1585
|
// Validate that the Runtime is compatible with this Loader.
|
|
1570
1586
|
const maybeRuntimeCompatDetails = runtime;
|
|
1571
|
-
(0, loaderLayerCompatState_js_1.validateRuntimeCompatibility)(maybeRuntimeCompatDetails.ILayerCompatDetails);
|
|
1587
|
+
(0, loaderLayerCompatState_js_1.validateRuntimeCompatibility)(maybeRuntimeCompatDetails.ILayerCompatDetails, this.mc.logger);
|
|
1572
1588
|
this._runtime = runtime;
|
|
1573
1589
|
this._lifecycleEvents.emit("runtimeInstantiated");
|
|
1574
1590
|
this._loadedCodeDetails = codeDetails;
|
|
@@ -1579,15 +1595,75 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1579
1595
|
}
|
|
1580
1596
|
}
|
|
1581
1597
|
/**
|
|
1582
|
-
*
|
|
1583
|
-
* This controls the "connected" state of the ContainerRuntime as well
|
|
1584
|
-
* @param connected - Is the container currently connected?
|
|
1598
|
+
* Send the connected status to the runtime.
|
|
1585
1599
|
* @param readonly - Is the container in readonly mode?
|
|
1600
|
+
* @param onlyCallSetConnectionStateIfConnectedOrDisconnected - If true, only
|
|
1601
|
+
* call older `setConnectionState` on the runtime if the connection state is
|
|
1602
|
+
* either Connected or Disconnected. This exists to preserve older behavior
|
|
1603
|
+
* where the runtime was only notified of these two states.
|
|
1586
1604
|
*/
|
|
1587
|
-
|
|
1605
|
+
setConnectionStatus(readonly, onlyCallSetConnectionStateIfConnectedOrDisconnected = false) {
|
|
1588
1606
|
if (this._runtime?.disposed === false && this.loaded) {
|
|
1589
|
-
this.runtime.
|
|
1590
|
-
|
|
1607
|
+
const setConnectionStatus = this.runtime.setConnectionStatus?.bind(this.runtime);
|
|
1608
|
+
if (setConnectionStatus === undefined) {
|
|
1609
|
+
if (!onlyCallSetConnectionStateIfConnectedOrDisconnected ||
|
|
1610
|
+
this.connectionState === connectionState_js_1.ConnectionState.Connected ||
|
|
1611
|
+
this.connectionState === connectionState_js_1.ConnectionState.Disconnected) {
|
|
1612
|
+
this.runtime.setConnectionState(this.connectionState === connectionState_js_1.ConnectionState.Connected &&
|
|
1613
|
+
!readonly /* container can send ops if connected to service and not in readonly mode */, this.clientId);
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
else {
|
|
1617
|
+
const pendingClientConnectionId = this.connectionStateHandler.pendingClientId;
|
|
1618
|
+
const connectionState = this.connectionState;
|
|
1619
|
+
switch (connectionState) {
|
|
1620
|
+
case connectionState_js_1.ConnectionState.EstablishingConnection: {
|
|
1621
|
+
setConnectionStatus({
|
|
1622
|
+
connectionState,
|
|
1623
|
+
canSendOps: false,
|
|
1624
|
+
readonly,
|
|
1625
|
+
});
|
|
1626
|
+
break;
|
|
1627
|
+
}
|
|
1628
|
+
case connectionState_js_1.ConnectionState.CatchingUp: {
|
|
1629
|
+
// When catching up, we have a pending clientId, but it
|
|
1630
|
+
// is not usable for ops. Send clientId with canSendOps false.
|
|
1631
|
+
(0, internal_2.assert)(pendingClientConnectionId !== undefined, 0xc8a /* catching up without clientId */);
|
|
1632
|
+
setConnectionStatus({
|
|
1633
|
+
connectionState,
|
|
1634
|
+
pendingClientConnectionId,
|
|
1635
|
+
canSendOps: false,
|
|
1636
|
+
readonly,
|
|
1637
|
+
});
|
|
1638
|
+
break;
|
|
1639
|
+
}
|
|
1640
|
+
case connectionState_js_1.ConnectionState.Connected: {
|
|
1641
|
+
// When connected, we have an active clientId. Pass it along
|
|
1642
|
+
// with canSendOps true/false based on readonly.
|
|
1643
|
+
const clientConnectionId = this.clientId;
|
|
1644
|
+
(0, internal_2.assert)(clientConnectionId !== undefined, 0xc8b /* connected without clientId */);
|
|
1645
|
+
(0, internal_2.assert)(clientConnectionId === pendingClientConnectionId, 0xc8c /* connected with different clientId than pending */);
|
|
1646
|
+
setConnectionStatus({
|
|
1647
|
+
connectionState,
|
|
1648
|
+
clientConnectionId,
|
|
1649
|
+
canSendOps: !readonly,
|
|
1650
|
+
readonly,
|
|
1651
|
+
});
|
|
1652
|
+
break;
|
|
1653
|
+
}
|
|
1654
|
+
case connectionState_js_1.ConnectionState.Disconnected: {
|
|
1655
|
+
setConnectionStatus({
|
|
1656
|
+
connectionState,
|
|
1657
|
+
priorPendingClientConnectionId: pendingClientConnectionId,
|
|
1658
|
+
priorConnectedClientConnectionId: this.clientId,
|
|
1659
|
+
canSendOps: false,
|
|
1660
|
+
readonly,
|
|
1661
|
+
});
|
|
1662
|
+
break;
|
|
1663
|
+
}
|
|
1664
|
+
// No default
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1591
1667
|
}
|
|
1592
1668
|
}
|
|
1593
1669
|
handleDeltaConnectionArg(deltaConnectionArg, connectionArgs) {
|