@fluid-internal/client-utils 2.118.1 → 3.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 +1 -5
- package/README.md +13 -15
- package/dist/base64EncodingBrowser.d.ts +2 -1
- package/dist/base64EncodingBrowser.d.ts.map +1 -1
- package/dist/base64EncodingBrowser.js +1 -1
- package/dist/base64EncodingBrowser.js.map +1 -1
- package/dist/base64EncodingNode.d.ts +2 -1
- package/dist/base64EncodingNode.d.ts.map +1 -1
- package/dist/base64EncodingNode.js.map +1 -1
- package/dist/buffer.d.ts +93 -0
- package/dist/buffer.d.ts.map +1 -0
- package/dist/buffer.js +7 -0
- package/dist/buffer.js.map +1 -0
- package/dist/bufferBrowser.d.ts +18 -49
- package/dist/bufferBrowser.d.ts.map +1 -1
- package/dist/bufferBrowser.js +49 -52
- package/dist/bufferBrowser.js.map +1 -1
- package/dist/bufferNode.d.ts +67 -19
- package/dist/bufferNode.d.ts.map +1 -1
- package/dist/bufferNode.js +10 -12
- package/dist/bufferNode.js.map +1 -1
- package/dist/bufferShared.d.ts +38 -3
- package/dist/bufferShared.d.ts.map +1 -1
- package/dist/bufferShared.js +67 -5
- package/dist/bufferShared.js.map +1 -1
- package/dist/events/emitter.d.ts.map +1 -1
- package/dist/events/emitter.js +4 -3
- package/dist/events/emitter.js.map +1 -1
- package/dist/hashFileBrowser.d.ts +1 -1
- package/dist/hashFileBrowser.d.ts.map +1 -1
- package/dist/hashFileBrowser.js +23 -11
- package/dist/hashFileBrowser.js.map +1 -1
- package/dist/hashFileNode.d.ts +10 -2
- package/dist/hashFileNode.d.ts.map +1 -1
- package/dist/hashFileNode.js +10 -3
- package/dist/hashFileNode.js.map +1 -1
- package/dist/indexBrowser.d.ts +5 -3
- package/dist/indexBrowser.d.ts.map +1 -1
- package/dist/indexBrowser.js +5 -5
- package/dist/indexBrowser.js.map +1 -1
- package/dist/indexNode.d.ts +4 -3
- package/dist/indexNode.d.ts.map +1 -1
- package/dist/indexNode.js +5 -2
- package/dist/indexNode.js.map +1 -1
- package/dist/layerCompat.d.ts +37 -13
- package/dist/layerCompat.d.ts.map +1 -1
- package/dist/layerCompat.js +19 -14
- package/dist/layerCompat.js.map +1 -1
- package/dist/trace.js +2 -0
- package/dist/trace.js.map +1 -1
- package/dist/typedEventEmitter.js +7 -0
- package/dist/typedEventEmitter.js.map +1 -1
- package/eslint.config.mts +2 -2
- package/lib/base64EncodingBrowser.d.ts +2 -1
- package/lib/base64EncodingBrowser.d.ts.map +1 -1
- package/lib/base64EncodingBrowser.js +1 -1
- package/lib/base64EncodingBrowser.js.map +1 -1
- package/lib/base64EncodingNode.d.ts +2 -1
- package/lib/base64EncodingNode.d.ts.map +1 -1
- package/lib/base64EncodingNode.js.map +1 -1
- package/lib/buffer.d.ts +93 -0
- package/lib/buffer.d.ts.map +1 -0
- package/lib/buffer.js +6 -0
- package/lib/buffer.js.map +1 -0
- package/lib/bufferBrowser.d.ts +18 -49
- package/lib/bufferBrowser.d.ts.map +1 -1
- package/lib/bufferBrowser.js +29 -40
- package/lib/bufferBrowser.js.map +1 -1
- package/lib/bufferNode.d.ts +67 -19
- package/lib/bufferNode.d.ts.map +1 -1
- package/lib/bufferNode.js +7 -9
- package/lib/bufferNode.js.map +1 -1
- package/lib/bufferShared.d.ts +38 -3
- package/lib/bufferShared.d.ts.map +1 -1
- package/lib/bufferShared.js +64 -3
- package/lib/bufferShared.js.map +1 -1
- package/lib/events/emitter.d.ts.map +1 -1
- package/lib/events/emitter.js +2 -1
- package/lib/events/emitter.js.map +1 -1
- package/lib/hashFileBrowser.d.ts +1 -1
- package/lib/hashFileBrowser.d.ts.map +1 -1
- package/lib/hashFileBrowser.js +4 -1
- package/lib/hashFileBrowser.js.map +1 -1
- package/lib/hashFileNode.d.ts +10 -2
- package/lib/hashFileNode.d.ts.map +1 -1
- package/lib/hashFileNode.js +8 -0
- package/lib/hashFileNode.js.map +1 -1
- package/lib/indexBrowser.d.ts +5 -3
- package/lib/indexBrowser.d.ts.map +1 -1
- package/lib/indexBrowser.js +3 -5
- package/lib/indexBrowser.js.map +1 -1
- package/lib/indexNode.d.ts +4 -3
- package/lib/indexNode.d.ts.map +1 -1
- package/lib/indexNode.js +2 -2
- package/lib/indexNode.js.map +1 -1
- package/lib/layerCompat.d.ts +37 -13
- package/lib/layerCompat.d.ts.map +1 -1
- package/lib/layerCompat.js +17 -12
- package/lib/layerCompat.js.map +1 -1
- package/lib/trace.js +2 -0
- package/lib/trace.js.map +1 -1
- package/lib/typedEventEmitter.js +7 -0
- package/lib/typedEventEmitter.js.map +1 -1
- package/package.json +65 -62
- package/playwright.config.ts +23 -0
- package/src/base64EncodingBrowser.ts +3 -2
- package/src/base64EncodingNode.ts +2 -1
- package/src/buffer.ts +112 -0
- package/src/bufferBrowser.ts +98 -60
- package/src/bufferNode.ts +86 -30
- package/src/bufferShared.ts +74 -4
- package/src/hashFileBrowser.ts +6 -3
- package/src/hashFileNode.ts +10 -2
- package/src/indexBrowser.ts +13 -2
- package/src/indexNode.ts +13 -2
- package/src/layerCompat.ts +41 -13
- package/tsconfig.json +1 -2
- package/webpack.playwright.cjs +22 -0
- package/jest-puppeteer.config.cjs +0 -16
- package/jest.config.cjs +0 -21
package/src/indexBrowser.ts
CHANGED
|
@@ -6,9 +6,14 @@
|
|
|
6
6
|
// Entrypoint for browser-specific code in the package.
|
|
7
7
|
// (See 'Isomorphic Code' section in the package README.md.)
|
|
8
8
|
|
|
9
|
+
// This export is needed for api-extractor compliance.
|
|
10
|
+
export type { IsoBuffer as IsoBufferInterface } from "./buffer.js";
|
|
11
|
+
export type {
|
|
12
|
+
IsoBufferConstructor,
|
|
13
|
+
IsoBufferEncoding,
|
|
14
|
+
} from "./bufferBrowser.js";
|
|
9
15
|
export {
|
|
10
16
|
bufferToString,
|
|
11
|
-
isArrayBuffer,
|
|
12
17
|
IsoBuffer,
|
|
13
18
|
stringToBuffer,
|
|
14
19
|
Uint8ArrayToString,
|
|
@@ -16,7 +21,11 @@ export {
|
|
|
16
21
|
export { gitHashFile, hashFile } from "./hashFileBrowser.js";
|
|
17
22
|
|
|
18
23
|
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingBrowser.js";
|
|
19
|
-
export {
|
|
24
|
+
export {
|
|
25
|
+
AnyUint8ArrayToArrayBuffer,
|
|
26
|
+
ArrayBufferLikeToArrayBuffer,
|
|
27
|
+
Uint8ArrayToArrayBufferLike,
|
|
28
|
+
} from "./bufferShared.js";
|
|
20
29
|
export { EventEmitter } from "./eventEmitter.cjs";
|
|
21
30
|
export { performanceNow } from "./performanceIsomorphic.js";
|
|
22
31
|
export { type ITraceEvent, Trace } from "./trace.js";
|
|
@@ -35,6 +44,8 @@ export {
|
|
|
35
44
|
type ILayerCompatDetails,
|
|
36
45
|
type IProvideLayerCompatDetails,
|
|
37
46
|
type ILayerCompatSupportRequirements,
|
|
47
|
+
type IProvideLayerCompatSupportRequirements,
|
|
48
|
+
defaultLayerCompatDetails,
|
|
38
49
|
LayerCompatibilityPolicyWindowMonths,
|
|
39
50
|
} from "./layerCompat.js";
|
|
40
51
|
export { generation } from "./layerGenerationState.js";
|
package/src/indexNode.ts
CHANGED
|
@@ -6,7 +6,12 @@
|
|
|
6
6
|
// Entrypoint for Node.js-specific code in the package.
|
|
7
7
|
// (See 'Isomorphic Code' section in the package README.md.)
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export type { IsoBuffer as IsoBufferInterface } from "./buffer.js";
|
|
10
|
+
export type {
|
|
11
|
+
Buffer,
|
|
12
|
+
IsoBufferConstructor,
|
|
13
|
+
IsoBufferEncoding,
|
|
14
|
+
} from "./bufferNode.js";
|
|
10
15
|
export {
|
|
11
16
|
bufferToString,
|
|
12
17
|
IsoBuffer,
|
|
@@ -16,7 +21,11 @@ export {
|
|
|
16
21
|
export { gitHashFile, hashFile } from "./hashFileNode.js";
|
|
17
22
|
|
|
18
23
|
export { fromBase64ToUtf8, fromUtf8ToBase64, toUtf8 } from "./base64EncodingNode.js";
|
|
19
|
-
export {
|
|
24
|
+
export {
|
|
25
|
+
AnyUint8ArrayToArrayBuffer,
|
|
26
|
+
ArrayBufferLikeToArrayBuffer,
|
|
27
|
+
Uint8ArrayToArrayBufferLike,
|
|
28
|
+
} from "./bufferShared.js";
|
|
20
29
|
export { EventEmitter } from "./eventEmitter.cjs";
|
|
21
30
|
export { performanceNow } from "./performanceIsomorphic.js";
|
|
22
31
|
export { type ITraceEvent, Trace } from "./trace.js";
|
|
@@ -35,6 +44,8 @@ export {
|
|
|
35
44
|
type ILayerCompatDetails,
|
|
36
45
|
type IProvideLayerCompatDetails,
|
|
37
46
|
type ILayerCompatSupportRequirements,
|
|
47
|
+
type IProvideLayerCompatSupportRequirements,
|
|
48
|
+
defaultLayerCompatDetails,
|
|
38
49
|
LayerCompatibilityPolicyWindowMonths,
|
|
39
50
|
} from "./layerCompat.js";
|
|
40
51
|
export { generation } from "./layerGenerationState.js";
|
package/src/layerCompat.ts
CHANGED
|
@@ -23,29 +23,29 @@ export type FluidLayer = "loader" | "driver" | "runtime" | "dataStore";
|
|
|
23
23
|
*/
|
|
24
24
|
export const LayerCompatibilityPolicyWindowMonths = {
|
|
25
25
|
/**
|
|
26
|
-
* Driver is compatible with Loader versions up to 12 months (or generations) older.
|
|
26
|
+
* A newer Driver is compatible with Loader versions up to 12 months (or generations) older.
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
NewDriverOldLoader: 12,
|
|
29
29
|
/**
|
|
30
|
-
* Loader is compatible with Driver versions up to 12 months (or generations) older.
|
|
30
|
+
* A newer Loader is compatible with Driver versions up to 12 months (or generations) older.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
NewLoaderOldDriver: 12,
|
|
33
33
|
/**
|
|
34
|
-
* Runtime is compatible with Loader versions up to 12 months (or generations) older.
|
|
34
|
+
* A newer Runtime is compatible with Loader versions up to 12 months (or generations) older.
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
NewRuntimeOldLoader: 12,
|
|
37
37
|
/**
|
|
38
|
-
* Loader is compatible with Runtime versions up to 3 months (or generations) older.
|
|
38
|
+
* A newer Loader is compatible with Runtime versions up to 3 months (or generations) older.
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
NewLoaderOldRuntime: 3,
|
|
41
41
|
/**
|
|
42
|
-
* Runtime is compatible with DataStore versions up to 3 months (or generations) older.
|
|
42
|
+
* A newer Runtime is compatible with DataStore versions up to 3 months (or generations) older.
|
|
43
43
|
*/
|
|
44
|
-
|
|
44
|
+
NewRuntimeOldDataStore: 3,
|
|
45
45
|
/**
|
|
46
|
-
* DataStore is compatible with Runtime versions up to 3 months (or generations) older.
|
|
46
|
+
* A newer DataStore is compatible with Runtime versions up to 3 months (or generations) older.
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
NewDataStoreOldRuntime: 3,
|
|
49
49
|
} as const;
|
|
50
50
|
|
|
51
51
|
/**
|
|
@@ -119,11 +119,39 @@ export const defaultLayerCompatDetails: ILayerCompatDetails = {
|
|
|
119
119
|
pkgVersion: "unknown",
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Key used to look up {@link (ILayerCompatSupportRequirements:interface)} on a `FluidObject`.
|
|
124
|
+
* @internal
|
|
125
|
+
*/
|
|
126
|
+
export const ILayerCompatSupportRequirements: keyof IProvideLayerCompatSupportRequirements =
|
|
127
|
+
"ILayerCompatSupportRequirements";
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Provides {@link (ILayerCompatSupportRequirements:interface)} so that a layer can publish, as a `FluidObject`, the
|
|
131
|
+
* requirements another layer must meet to be compatible with it.
|
|
132
|
+
* @internal
|
|
133
|
+
*/
|
|
134
|
+
export interface IProvideLayerCompatSupportRequirements {
|
|
135
|
+
readonly ILayerCompatSupportRequirements: ILayerCompatSupportRequirements;
|
|
136
|
+
}
|
|
137
|
+
|
|
122
138
|
/**
|
|
123
139
|
* The requirements that a layer needs another layer to support for them to be compatible.
|
|
140
|
+
*
|
|
141
|
+
* @remarks
|
|
142
|
+
* A layer can also publish its requirements across a boundary as a `FluidObject` (via
|
|
143
|
+
* {@link IProvideLayerCompatSupportRequirements}) for the case where this layer cannot run the compatibility
|
|
144
|
+
* validation itself and instead needs the layer on the other side of the boundary to check itself against the
|
|
145
|
+
* published requirements. Most boundaries are validated by both layers because each holds
|
|
146
|
+
* a reference to the other (e.g. the Loader and the Runtime). The Driver / Loader boundary is asymmetric: the
|
|
147
|
+
* Loader holds a reference to the Driver, but the Driver has no reference to the Loader and so cannot validate it.
|
|
148
|
+
* To still validate in both directions, the Driver publishes its requirements for the Loader and the Loader
|
|
149
|
+
* validates itself against them on the Driver's behalf.
|
|
150
|
+
*
|
|
124
151
|
* @internal
|
|
125
152
|
*/
|
|
126
|
-
export interface ILayerCompatSupportRequirements
|
|
153
|
+
export interface ILayerCompatSupportRequirements
|
|
154
|
+
extends Partial<IProvideLayerCompatSupportRequirements> {
|
|
127
155
|
/**
|
|
128
156
|
* The minimum supported generation the other layer needs to be at.
|
|
129
157
|
*/
|
package/tsconfig.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../../common/build/build-common/tsconfig.
|
|
2
|
+
"extends": "../../../common/build/build-common/tsconfig.node20.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"rootDir": "./src",
|
|
5
5
|
"outDir": "./lib",
|
|
6
|
-
"baseUrl": ".",
|
|
7
6
|
"noUncheckedIndexedAccess": false,
|
|
8
7
|
},
|
|
9
8
|
"include": ["src/**/*"],
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const path = require("node:path");
|
|
7
|
+
const webpack = require("webpack");
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
mode: "development",
|
|
11
|
+
devtool: "inline-source-map",
|
|
12
|
+
entry: "./lib/test/playwright/browserHash.js",
|
|
13
|
+
output: {
|
|
14
|
+
filename: "browserHash.bundle.js",
|
|
15
|
+
path: path.resolve(__dirname, "lib/test/playwright"),
|
|
16
|
+
},
|
|
17
|
+
plugins: [
|
|
18
|
+
new webpack.IgnorePlugin({
|
|
19
|
+
resourceRegExp: /^\.\/hashFileNode\.js$/,
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
launch: {
|
|
8
|
-
args: ["--no-sandbox", "--disable-setuid-sandbox"], // https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#setting-up-chrome-linux-sandbox
|
|
9
|
-
dumpio: true, // output browser console to cmd line
|
|
10
|
-
// slowMo: 500, // slows down process for easier viewing
|
|
11
|
-
|
|
12
|
-
// Use chrome-headless-shell since some tests don't work as-is with the new headless mode.
|
|
13
|
-
// AB#7150: Remove this once we have fixed the tests.
|
|
14
|
-
headless: "shell",
|
|
15
|
-
},
|
|
16
|
-
};
|
package/jest.config.cjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
preset: "jest-puppeteer",
|
|
8
|
-
reporters: [
|
|
9
|
-
"default",
|
|
10
|
-
[
|
|
11
|
-
"jest-junit",
|
|
12
|
-
{
|
|
13
|
-
outputDirectory: "nyc",
|
|
14
|
-
outputName: "jest-junit-report.xml",
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
],
|
|
18
|
-
// Only CJS is tested per use of `rewire` in gitHash.spec.ts.
|
|
19
|
-
testMatch: ["**/dist/test/jest/?(*.)+(spec|test).*js"],
|
|
20
|
-
testPathIgnorePatterns: ["/node_modules/"],
|
|
21
|
-
};
|