@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.
Files changed (71) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +4 -3
  3. package/api-extractor.json +1 -13
  4. package/api-report/client-utils.api.md +127 -0
  5. package/dist/base64Encoding.d.ts.map +1 -1
  6. package/dist/base64Encoding.js +6 -3
  7. package/dist/base64Encoding.js.map +1 -1
  8. package/dist/bufferBrowser.d.ts +3 -3
  9. package/dist/bufferBrowser.d.ts.map +1 -1
  10. package/dist/bufferBrowser.js +14 -3
  11. package/dist/bufferBrowser.js.map +1 -1
  12. package/dist/bufferNode.d.ts +7 -7
  13. package/dist/bufferNode.d.ts.map +1 -1
  14. package/dist/bufferNode.js +10 -5
  15. package/dist/bufferNode.js.map +1 -1
  16. package/dist/client-utils-alpha.d.ts +46 -0
  17. package/dist/client-utils-beta.d.ts +46 -0
  18. package/dist/client-utils-public.d.ts +46 -0
  19. package/dist/client-utils-untrimmed.d.ts +241 -0
  20. package/dist/eventForwarder.d.ts.map +1 -1
  21. package/dist/eventForwarder.js +10 -10
  22. package/dist/eventForwarder.js.map +1 -1
  23. package/dist/hashFileBrowser.js +5 -1
  24. package/dist/hashFileBrowser.js.map +1 -1
  25. package/dist/index.js +5 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/performanceIsomorphic.d.ts +1 -1
  28. package/dist/performanceIsomorphic.d.ts.map +1 -1
  29. package/dist/performanceNode.d.ts.map +1 -1
  30. package/dist/performanceNode.js +2 -1
  31. package/dist/performanceNode.js.map +1 -1
  32. package/dist/trace.js +4 -4
  33. package/dist/trace.js.map +1 -1
  34. package/dist/tsdoc-metadata.json +1 -1
  35. package/dist/typedEventEmitter.d.ts +2 -2
  36. package/dist/typedEventEmitter.d.ts.map +1 -1
  37. package/dist/typedEventEmitter.js +2 -0
  38. package/dist/typedEventEmitter.js.map +1 -1
  39. package/lib/base64Encoding.d.ts.map +1 -1
  40. package/lib/base64Encoding.js +6 -3
  41. package/lib/base64Encoding.js.map +1 -1
  42. package/lib/bufferBrowser.d.ts +3 -3
  43. package/lib/bufferBrowser.d.ts.map +1 -1
  44. package/lib/bufferBrowser.js +9 -2
  45. package/lib/bufferBrowser.js.map +1 -1
  46. package/lib/bufferNode.d.ts +7 -7
  47. package/lib/bufferNode.d.ts.map +1 -1
  48. package/lib/bufferNode.js +10 -5
  49. package/lib/bufferNode.js.map +1 -1
  50. package/lib/eventForwarder.d.ts.map +1 -1
  51. package/lib/eventForwarder.js +10 -10
  52. package/lib/eventForwarder.js.map +1 -1
  53. package/lib/performanceIsomorphic.d.ts +1 -1
  54. package/lib/performanceIsomorphic.d.ts.map +1 -1
  55. package/lib/performanceNode.d.ts.map +1 -1
  56. package/lib/performanceNode.js +2 -1
  57. package/lib/performanceNode.js.map +1 -1
  58. package/lib/trace.js +4 -4
  59. package/lib/trace.js.map +1 -1
  60. package/lib/typedEventEmitter.d.ts +2 -2
  61. package/lib/typedEventEmitter.d.ts.map +1 -1
  62. package/lib/typedEventEmitter.js +2 -0
  63. package/lib/typedEventEmitter.js.map +1 -1
  64. package/package.json +15 -17
  65. package/src/base64Encoding.ts +6 -3
  66. package/src/bufferBrowser.ts +14 -4
  67. package/src/bufferNode.ts +18 -9
  68. package/src/eventForwarder.ts +2 -0
  69. package/src/performanceNode.ts +2 -1
  70. package/src/typedEventEmitter.ts +2 -0
  71. 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
- * @public
11
+ * @internal
12
12
  */
13
13
  export declare class Buffer extends Uint8Array {
14
- toString(encoding?: string): string;
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
- * @public
31
+ * @internal
31
32
  */
32
33
  export const IsoBuffer = Buffer;
33
34
 
34
35
  /**
35
- * @public
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(arr: Uint8Array, encoding?: string): string {
50
- // Make this check because Buffer.from(arr) will always do a buffer copy
51
- return Buffer.isBuffer(arr) ? arr.toString(encoding) : Buffer.from(arr).toString(encoding);
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 = (blob: ArrayBufferLike, encoding: string): string =>
80
- IsoBuffer.from(blob).toString(encoding);
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);
@@ -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";
@@ -3,7 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- // eslint-disable-next-line import/no-nodejs-modules
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
 
@@ -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 {
8
10
  IEvent,
package/tsconfig.json CHANGED
@@ -8,6 +8,7 @@
8
8
  "paths": {
9
9
  "perf_hooks": ["types/perf_hooks.d.ts"],
10
10
  },
11
+ "types": ["events"],
11
12
  },
12
13
  "include": ["src/**/*"],
13
14
  "exclude": ["src/test/**/*"],