@fluidframework/container-loader 2.0.0-internal.6.4.0 → 2.0.0-internal.7.1.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 +118 -0
- package/api-extractor.json +9 -1
- package/api-report/container-loader.api.md +142 -0
- package/dist/catchUpMonitor.d.ts +2 -2
- package/dist/catchUpMonitor.d.ts.map +1 -1
- package/dist/connectionManager.d.ts +1 -0
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +109 -83
- 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-loader-alpha.d.ts +297 -0
- package/dist/container-loader-beta.d.ts +297 -0
- package/dist/container-loader-public.d.ts +297 -0
- package/dist/container-loader.d.ts +297 -0
- 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 +5 -4
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/debugLogger.d.ts.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 +90 -89
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.js +14 -14
- package/dist/deltaQueue.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +3 -6
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +20 -85
- package/dist/loader.js.map +1 -1
- package/dist/location-redirection-utilities/index.d.ts +6 -0
- package/dist/location-redirection-utilities/index.d.ts.map +1 -0
- package/dist/location-redirection-utilities/index.js +11 -0
- package/dist/location-redirection-utilities/index.js.map +1 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts +22 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.js +51 -0
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -0
- 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 +1 -0
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +112 -84
- 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 +5 -4
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/debugLogger.d.ts.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 +90 -89
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.js +14 -14
- package/lib/deltaQueue.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/loader.d.ts +3 -6
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +20 -85
- package/lib/loader.js.map +1 -1
- package/lib/location-redirection-utilities/index.d.ts +6 -0
- package/lib/location-redirection-utilities/index.d.ts.map +1 -0
- package/lib/location-redirection-utilities/index.js +6 -0
- package/lib/location-redirection-utilities/index.js.map +1 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts +22 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js +46 -0
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -0
- 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 +23 -24
- package/src/connectionManager.ts +57 -16
- package/src/container.ts +15 -15
- package/src/containerStorageAdapter.ts +0 -6
- package/src/contracts.ts +8 -4
- package/src/debugLogger.ts +4 -1
- package/src/deltaManager.ts +11 -9
- package/src/index.ts +4 -0
- package/src/loader.ts +24 -92
- package/src/location-redirection-utilities/index.ts +9 -0
- package/src/location-redirection-utilities/resolveWithLocationRedirection.ts +59 -0
- package/src/packageVersion.ts +1 -1
- package/src/protocol.ts +2 -6
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ITelemetryBaseLogger, IRequest } from "@fluidframework/core-interfaces";
|
|
7
|
+
import {
|
|
8
|
+
DriverErrorTypes,
|
|
9
|
+
ILocationRedirectionError,
|
|
10
|
+
IUrlResolver,
|
|
11
|
+
} from "@fluidframework/driver-definitions";
|
|
12
|
+
import { createChildLogger } from "@fluidframework/telemetry-utils";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Checks if the error is location redirection error.
|
|
16
|
+
* @param error - error whose type is to be determined.
|
|
17
|
+
* @returns `true` is the error is location redirection error, otherwise `false`.
|
|
18
|
+
*/
|
|
19
|
+
export function isLocationRedirectionError(error: any): error is ILocationRedirectionError {
|
|
20
|
+
return (
|
|
21
|
+
typeof error === "object" &&
|
|
22
|
+
error !== null &&
|
|
23
|
+
error.errorType === DriverErrorTypes.locationRedirection
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Handles location redirection while fulfilling the loader request.
|
|
29
|
+
* @param api - Callback in which user can wrap the loader.resolve or loader.request call.
|
|
30
|
+
* @param request - request to be resolved.
|
|
31
|
+
* @param urlResolver - resolver used to resolve the url.
|
|
32
|
+
* @param logger - logger to send events.
|
|
33
|
+
* @returns Response from the API call.
|
|
34
|
+
*/
|
|
35
|
+
export async function resolveWithLocationRedirectionHandling<T>(
|
|
36
|
+
api: (request: IRequest) => Promise<T>,
|
|
37
|
+
request: IRequest,
|
|
38
|
+
urlResolver: IUrlResolver,
|
|
39
|
+
logger?: ITelemetryBaseLogger,
|
|
40
|
+
): Promise<T> {
|
|
41
|
+
let req: IRequest = request;
|
|
42
|
+
const childLogger = createChildLogger({ logger, namespace: "LocationRedirection" });
|
|
43
|
+
for (;;) {
|
|
44
|
+
try {
|
|
45
|
+
return await api(req);
|
|
46
|
+
} catch (error: any) {
|
|
47
|
+
if (!isLocationRedirectionError(error)) {
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
childLogger.sendTelemetryEvent({ eventName: "LocationRedirectionError" });
|
|
51
|
+
const resolvedUrl = error.redirectUrl;
|
|
52
|
+
// Generate the new request with new location details from the resolved url. For datastore/relative path,
|
|
53
|
+
// we don't need to pass "/" as host could have asked for a specific data store. So driver need to
|
|
54
|
+
// extract it from the resolved url.
|
|
55
|
+
const absoluteUrl = await urlResolver.getAbsoluteUrl(resolvedUrl, "", undefined);
|
|
56
|
+
req = { url: absoluteUrl, headers: req.headers };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
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");
|