@fluid-internal/client-utils 2.0.0-dev.6.4.0.192049 → 2.0.0-dev.7.2.0.204906
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 +18 -0
- package/README.md +4 -3
- package/api-extractor.json +1 -13
- package/api-report/client-utils.api.md +127 -0
- package/dist/base64Encoding.d.ts.map +1 -1
- package/dist/base64Encoding.js +6 -3
- package/dist/base64Encoding.js.map +1 -1
- package/dist/bufferBrowser.d.ts +3 -3
- package/dist/bufferBrowser.d.ts.map +1 -1
- package/dist/bufferBrowser.js +14 -3
- package/dist/bufferBrowser.js.map +1 -1
- package/dist/bufferNode.d.ts +7 -7
- package/dist/bufferNode.d.ts.map +1 -1
- package/dist/bufferNode.js +10 -5
- package/dist/bufferNode.js.map +1 -1
- package/dist/client-utils-alpha.d.ts +46 -0
- package/dist/client-utils-beta.d.ts +46 -0
- package/dist/client-utils-public.d.ts +46 -0
- package/dist/client-utils-untrimmed.d.ts +241 -0
- package/dist/eventForwarder.d.ts.map +1 -1
- package/dist/eventForwarder.js +10 -10
- package/dist/eventForwarder.js.map +1 -1
- package/dist/hashFileBrowser.js +5 -1
- package/dist/hashFileBrowser.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/performanceIsomorphic.d.ts +1 -1
- package/dist/performanceIsomorphic.d.ts.map +1 -1
- package/dist/performanceNode.d.ts.map +1 -1
- package/dist/performanceNode.js +2 -1
- package/dist/performanceNode.js.map +1 -1
- package/dist/trace.js +4 -4
- package/dist/trace.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/typedEventEmitter.d.ts +2 -2
- package/dist/typedEventEmitter.d.ts.map +1 -1
- package/dist/typedEventEmitter.js +2 -0
- package/dist/typedEventEmitter.js.map +1 -1
- package/lib/base64Encoding.d.ts.map +1 -1
- package/lib/base64Encoding.js +6 -3
- package/lib/base64Encoding.js.map +1 -1
- package/lib/bufferBrowser.d.ts +3 -3
- package/lib/bufferBrowser.d.ts.map +1 -1
- package/lib/bufferBrowser.js +9 -2
- package/lib/bufferBrowser.js.map +1 -1
- package/lib/bufferNode.d.ts +7 -7
- package/lib/bufferNode.d.ts.map +1 -1
- package/lib/bufferNode.js +10 -5
- package/lib/bufferNode.js.map +1 -1
- package/lib/eventForwarder.d.ts.map +1 -1
- package/lib/eventForwarder.js +10 -10
- package/lib/eventForwarder.js.map +1 -1
- package/lib/performanceIsomorphic.d.ts +1 -1
- package/lib/performanceIsomorphic.d.ts.map +1 -1
- package/lib/performanceNode.d.ts.map +1 -1
- package/lib/performanceNode.js +2 -1
- package/lib/performanceNode.js.map +1 -1
- package/lib/trace.js +4 -4
- package/lib/trace.js.map +1 -1
- package/lib/typedEventEmitter.d.ts +2 -2
- package/lib/typedEventEmitter.d.ts.map +1 -1
- package/lib/typedEventEmitter.js +2 -0
- package/lib/typedEventEmitter.js.map +1 -1
- package/package.json +15 -17
- package/src/base64Encoding.ts +6 -3
- package/src/bufferBrowser.ts +14 -4
- package/src/bufferNode.ts +18 -9
- package/src/eventForwarder.ts +2 -0
- package/src/performanceNode.ts +2 -1
- package/src/typedEventEmitter.ts +2 -0
- package/tsconfig.json +1 -0
package/src/bufferNode.ts
CHANGED
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
* exposing the entirely of Node's typings. This should match the public interface
|
|
9
9
|
* of the browser implementation, so any changes made in one should be made in both.
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
11
|
+
* @internal
|
|
12
12
|
*/
|
|
13
13
|
export declare class Buffer extends Uint8Array {
|
|
14
|
-
|
|
14
|
+
// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged
|
|
15
|
+
toString(encoding?: "utf8" | "utf-8" | "base64"): string;
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Static constructor
|
|
@@ -27,12 +28,12 @@ export declare class Buffer extends Uint8Array {
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
|
-
* @
|
|
31
|
+
* @internal
|
|
31
32
|
*/
|
|
32
33
|
export const IsoBuffer = Buffer;
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
|
-
* @
|
|
36
|
+
* @internal
|
|
36
37
|
*/
|
|
37
38
|
export type IsoBuffer = Buffer;
|
|
38
39
|
|
|
@@ -46,9 +47,14 @@ export type IsoBuffer = Buffer;
|
|
|
46
47
|
*
|
|
47
48
|
* @internal
|
|
48
49
|
*/
|
|
49
|
-
export function Uint8ArrayToString(
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
export function Uint8ArrayToString(
|
|
51
|
+
arr: Uint8Array,
|
|
52
|
+
// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged
|
|
53
|
+
encoding?: "utf8" | "utf-8" | "base64",
|
|
54
|
+
): string {
|
|
55
|
+
// Buffer extends Uint8Array. Therefore, 'arr' may already be a Buffer, in
|
|
56
|
+
// which case we can avoid copying the Uint8Array into a new Buffer instance.
|
|
57
|
+
return (Buffer.isBuffer(arr) ? arr : Buffer.from(arr)).toString(encoding);
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
/**
|
|
@@ -76,5 +82,8 @@ export function stringToBuffer(input: string, encoding: string): ArrayBufferLike
|
|
|
76
82
|
*
|
|
77
83
|
* @internal
|
|
78
84
|
*/
|
|
79
|
-
export const bufferToString = (
|
|
80
|
-
|
|
85
|
+
export const bufferToString = (
|
|
86
|
+
blob: ArrayBufferLike,
|
|
87
|
+
// eslint-disable-next-line unicorn/text-encoding-identifier-case -- this value is supported, just discouraged
|
|
88
|
+
encoding: "utf8" | "utf-8" | "base64",
|
|
89
|
+
): string => IsoBuffer.from(blob).toString(encoding);
|
package/src/eventForwarder.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
// False positive: this is an import from the `events` package, not from Node.
|
|
7
|
+
// eslint-disable-next-line unicorn/prefer-node-protocol
|
|
6
8
|
import { EventEmitter } from "events";
|
|
7
9
|
import { IDisposable, IEvent, IEventProvider } from "@fluidframework/core-interfaces";
|
|
8
10
|
import { TypedEventEmitter } from "./typedEventEmitter";
|
package/src/performanceNode.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// This is referring to our own `perf_hooks`, not Node's.
|
|
7
|
+
// eslint-disable-next-line import/no-nodejs-modules, unicorn/prefer-node-protocol
|
|
7
8
|
import { performance as nodePerformance } from "perf_hooks";
|
|
8
9
|
import { IsomorphicPerformance } from "./performanceIsomorphic";
|
|
9
10
|
|
package/src/typedEventEmitter.ts
CHANGED