forked from microsoft/FluidFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloaderLayerCompatState.ts
More file actions
114 lines (106 loc) · 3.06 KB
/
loaderLayerCompatState.ts
File metadata and controls
114 lines (106 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
import type {
ILayerCompatDetails,
ILayerCompatSupportRequirements,
} from "@fluid-internal/client-utils";
import type { ICriticalContainerError } from "@fluidframework/container-definitions";
import {
validateLayerCompatibility,
type ITelemetryLoggerExt,
} from "@fluidframework/telemetry-utils/internal";
import { pkgVersion } from "./packageVersion.js";
/**
* The core compatibility details of the Loader layer that is the same across all layer boundaries.
* @internal
*/
export const loaderCoreCompatDetails = {
/**
* The package version of the Loader layer.
*/
pkgVersion,
/**
* The current generation of the Loader layer.
*/
generation: 1,
};
/**
* Loader's compatibility details that is exposed to the Runtime layer.
* @internal
*/
export const loaderCompatDetailsForRuntime: ILayerCompatDetails = {
...loaderCoreCompatDetails,
/**
* The features supported by the Loader layer across the Loader / Runtime boundary.
*/
supportedFeatures: new Set<string>(),
};
/**
* The requirements that the Runtime layer must meet to be compatible with this Loader.
* @internal
*/
export const runtimeSupportRequirementsForLoader: ILayerCompatSupportRequirements = {
/**
* Minimum generation that Runtime must be at to be compatible with Loader. Note that 0 is used here for
* Runtime layers before the introduction of the layer compatibility enforcement.
*/
minSupportedGeneration: 0,
/**
* The features that the Runtime must support to be compatible with Loader.
*/
requiredFeatures: [],
};
/**
* The requirements that the Driver layer must meet to be compatible with this Loader.
* @internal
*/
export const driverSupportRequirementsForLoader: ILayerCompatSupportRequirements = {
/**
* Minimum generation that Driver must be at to be compatible with Loader. Note that 0 is used here for
* Driver layers before the introduction of the layer compatibility enforcement.
*/
minSupportedGeneration: 0,
/**
* The features that the Driver must support to be compatible with Loader.
*/
requiredFeatures: [],
};
/**
* Validates that the Runtime layer is compatible with the Loader. *
* @internal
*/
export function validateRuntimeCompatibility(
maybeRuntimeCompatDetails: ILayerCompatDetails | undefined,
logger: ITelemetryLoggerExt,
): void {
validateLayerCompatibility(
"loader",
"runtime",
loaderCompatDetailsForRuntime,
runtimeSupportRequirementsForLoader,
maybeRuntimeCompatDetails,
() => {} /* disposeFn - no op. This will be handled by the caller */,
logger,
);
}
/**
* Validates that the Driver layer is compatible with the Loader.
* @internal
*/
export function validateDriverCompatibility(
maybeDriverCompatDetails: ILayerCompatDetails | undefined,
disposeFn: (error?: ICriticalContainerError) => void,
logger: ITelemetryLoggerExt,
): void {
validateLayerCompatibility(
"loader",
"driver",
loaderCompatDetailsForRuntime,
driverSupportRequirementsForLoader,
maybeDriverCompatDetails,
disposeFn,
logger,
);
}