@fluid-internal/client-utils 2.0.0-dev.7.2.0.203917 → 2.0.0-dev.7.2.0.205722
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-internal/client-utils",
|
|
3
|
-
"version": "2.0.0-dev.7.2.0.
|
|
3
|
+
"version": "2.0.0-dev.7.2.0.205722",
|
|
4
4
|
"description": "Not intended for use outside the Fluid Framework.",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"temp-directory": "nyc/.nyc_output"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@fluidframework/core-interfaces": "2.0.0-dev.7.2.0.
|
|
43
|
-
"@fluidframework/core-utils": "2.0.0-dev.7.2.0.
|
|
42
|
+
"@fluidframework/core-interfaces": "2.0.0-dev.7.2.0.205722",
|
|
43
|
+
"@fluidframework/core-utils": "2.0.0-dev.7.2.0.205722",
|
|
44
44
|
"@types/events": "^3.0.0",
|
|
45
45
|
"base64-js": "^1.5.1",
|
|
46
46
|
"buffer": "^6.0.3",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"sha.js": "^2.4.11"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@fluid-tools/build-cli": "0.26.
|
|
53
|
-
"@fluidframework/build-common": "^2.0.
|
|
54
|
-
"@fluidframework/build-tools": "0.26.
|
|
52
|
+
"@fluid-tools/build-cli": "^0.26.1",
|
|
53
|
+
"@fluidframework/build-common": "^2.0.3",
|
|
54
|
+
"@fluidframework/build-tools": "^0.26.1",
|
|
55
55
|
"@fluidframework/eslint-config-fluid": "^3.0.0",
|
|
56
|
-
"@fluidframework/mocha-test-setup": "2.0.0-dev.7.2.0.
|
|
56
|
+
"@fluidframework/mocha-test-setup": "2.0.0-dev.7.2.0.205722",
|
|
57
57
|
"@microsoft/api-extractor": "^7.37.0",
|
|
58
58
|
"@types/base64-js": "^1.3.0",
|
|
59
59
|
"@types/jest": "29.5.3",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"build:test:mocha": "tsc --project ./src/test/mocha/tsconfig.json",
|
|
120
120
|
"build:test:types": "tsc --project ./src/test/types/tsconfig.json",
|
|
121
121
|
"ci:build:docs": "api-extractor run",
|
|
122
|
-
"clean": "rimraf --glob
|
|
122
|
+
"clean": "rimraf --glob _api-extractor-temp dist lib \"*.tsbuildinfo\" \"*.build.log\" nyc",
|
|
123
123
|
"eslint": "eslint --format stylish src",
|
|
124
124
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
125
125
|
"format": "npm run prettier:fix",
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { IDisposable } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IEventTransformer } from '@fluidframework/core-interfaces';
|
|
6
|
-
import { TransformedEvent } from '@fluidframework/core-interfaces';
|
|
7
|
-
|
|
8
|
-
/* Excluded from this release type: Buffer */
|
|
9
|
-
|
|
10
|
-
/* Excluded from this release type: bufferToString */
|
|
11
|
-
|
|
12
|
-
/* Excluded from this release type: EventEmitterEventType */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: EventForwarder */
|
|
15
|
-
|
|
16
|
-
/* Excluded from this release type: fromBase64ToUtf8 */
|
|
17
|
-
|
|
18
|
-
/* Excluded from this release type: fromUtf8ToBase64 */
|
|
19
|
-
|
|
20
|
-
/* Excluded from this release type: gitHashFile */
|
|
21
|
-
|
|
22
|
-
/* Excluded from this release type: hashFile */
|
|
23
|
-
|
|
24
|
-
/* Excluded from this release type: IsoBuffer */
|
|
25
|
-
|
|
26
|
-
/* Excluded from this release type: IsomorphicPerformance */
|
|
27
|
-
|
|
28
|
-
/* Excluded from this release type: ITraceEvent */
|
|
29
|
-
|
|
30
|
-
/* Excluded from this release type: performance_2 */
|
|
31
|
-
|
|
32
|
-
/* Excluded from this release type: stringToBuffer */
|
|
33
|
-
|
|
34
|
-
/* Excluded from this release type: toUtf8 */
|
|
35
|
-
|
|
36
|
-
/* Excluded from this release type: Trace */
|
|
37
|
-
|
|
38
|
-
/* Excluded from this release type: TypedEventEmitter */
|
|
39
|
-
|
|
40
|
-
/* Excluded from this release type: TypedEventTransform */
|
|
41
|
-
|
|
42
|
-
/* Excluded from this release type: Uint8ArrayToArrayBuffer */
|
|
43
|
-
|
|
44
|
-
/* Excluded from this release type: Uint8ArrayToString */
|
|
45
|
-
|
|
46
|
-
export { }
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { IDisposable } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IEventTransformer } from '@fluidframework/core-interfaces';
|
|
6
|
-
import { TransformedEvent } from '@fluidframework/core-interfaces';
|
|
7
|
-
|
|
8
|
-
/* Excluded from this release type: Buffer */
|
|
9
|
-
|
|
10
|
-
/* Excluded from this release type: bufferToString */
|
|
11
|
-
|
|
12
|
-
/* Excluded from this release type: EventEmitterEventType */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: EventForwarder */
|
|
15
|
-
|
|
16
|
-
/* Excluded from this release type: fromBase64ToUtf8 */
|
|
17
|
-
|
|
18
|
-
/* Excluded from this release type: fromUtf8ToBase64 */
|
|
19
|
-
|
|
20
|
-
/* Excluded from this release type: gitHashFile */
|
|
21
|
-
|
|
22
|
-
/* Excluded from this release type: hashFile */
|
|
23
|
-
|
|
24
|
-
/* Excluded from this release type: IsoBuffer */
|
|
25
|
-
|
|
26
|
-
/* Excluded from this release type: IsomorphicPerformance */
|
|
27
|
-
|
|
28
|
-
/* Excluded from this release type: ITraceEvent */
|
|
29
|
-
|
|
30
|
-
/* Excluded from this release type: performance_2 */
|
|
31
|
-
|
|
32
|
-
/* Excluded from this release type: stringToBuffer */
|
|
33
|
-
|
|
34
|
-
/* Excluded from this release type: toUtf8 */
|
|
35
|
-
|
|
36
|
-
/* Excluded from this release type: Trace */
|
|
37
|
-
|
|
38
|
-
/* Excluded from this release type: TypedEventEmitter */
|
|
39
|
-
|
|
40
|
-
/* Excluded from this release type: TypedEventTransform */
|
|
41
|
-
|
|
42
|
-
/* Excluded from this release type: Uint8ArrayToArrayBuffer */
|
|
43
|
-
|
|
44
|
-
/* Excluded from this release type: Uint8ArrayToString */
|
|
45
|
-
|
|
46
|
-
export { }
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { IDisposable } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IEventTransformer } from '@fluidframework/core-interfaces';
|
|
6
|
-
import { TransformedEvent } from '@fluidframework/core-interfaces';
|
|
7
|
-
|
|
8
|
-
/* Excluded from this release type: Buffer */
|
|
9
|
-
|
|
10
|
-
/* Excluded from this release type: bufferToString */
|
|
11
|
-
|
|
12
|
-
/* Excluded from this release type: EventEmitterEventType */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: EventForwarder */
|
|
15
|
-
|
|
16
|
-
/* Excluded from this release type: fromBase64ToUtf8 */
|
|
17
|
-
|
|
18
|
-
/* Excluded from this release type: fromUtf8ToBase64 */
|
|
19
|
-
|
|
20
|
-
/* Excluded from this release type: gitHashFile */
|
|
21
|
-
|
|
22
|
-
/* Excluded from this release type: hashFile */
|
|
23
|
-
|
|
24
|
-
/* Excluded from this release type: IsoBuffer */
|
|
25
|
-
|
|
26
|
-
/* Excluded from this release type: IsomorphicPerformance */
|
|
27
|
-
|
|
28
|
-
/* Excluded from this release type: ITraceEvent */
|
|
29
|
-
|
|
30
|
-
/* Excluded from this release type: performance_2 */
|
|
31
|
-
|
|
32
|
-
/* Excluded from this release type: stringToBuffer */
|
|
33
|
-
|
|
34
|
-
/* Excluded from this release type: toUtf8 */
|
|
35
|
-
|
|
36
|
-
/* Excluded from this release type: Trace */
|
|
37
|
-
|
|
38
|
-
/* Excluded from this release type: TypedEventEmitter */
|
|
39
|
-
|
|
40
|
-
/* Excluded from this release type: TypedEventTransform */
|
|
41
|
-
|
|
42
|
-
/* Excluded from this release type: Uint8ArrayToArrayBuffer */
|
|
43
|
-
|
|
44
|
-
/* Excluded from this release type: Uint8ArrayToString */
|
|
45
|
-
|
|
46
|
-
export { }
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { IDisposable } from '@fluidframework/core-interfaces';
|
|
3
|
-
import { IEvent } from '@fluidframework/core-interfaces';
|
|
4
|
-
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IEventTransformer } from '@fluidframework/core-interfaces';
|
|
6
|
-
import { TransformedEvent } from '@fluidframework/core-interfaces';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Declare the subset of Buffer functionality we want to make available instead of
|
|
10
|
-
* exposing the entirely of Node's typings. This should match the public interface
|
|
11
|
-
* of the browser implementation, so any changes made in one should be made in both.
|
|
12
|
-
*
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export declare class Buffer extends Uint8Array {
|
|
16
|
-
toString(encoding?: "utf8" | "utf-8" | "base64"): string;
|
|
17
|
-
/**
|
|
18
|
-
* Static constructor
|
|
19
|
-
*
|
|
20
|
-
* @param value - (string | ArrayBuffer).
|
|
21
|
-
* @param encodingOrOffset - (string | number).
|
|
22
|
-
* @param length - (number).
|
|
23
|
-
*
|
|
24
|
-
* @privateRemarks TODO: Use actual types
|
|
25
|
-
*/
|
|
26
|
-
static from(value: unknown, encodingOrOffset?: unknown, length?: unknown): IsoBuffer;
|
|
27
|
-
static isBuffer(obj: unknown): obj is Buffer;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Convert binary blob to string format
|
|
32
|
-
*
|
|
33
|
-
* @param blob - The binary blob
|
|
34
|
-
* @param encoding - Output string's encoding
|
|
35
|
-
* @returns The blob in string format
|
|
36
|
-
*
|
|
37
|
-
* @internal
|
|
38
|
-
*/
|
|
39
|
-
export declare const bufferToString: (blob: ArrayBufferLike, encoding: "utf8" | "utf-8" | "base64") => string;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The event emitter polyfill and the node event emitter have different event types:
|
|
43
|
-
* string | symbol vs. string | number
|
|
44
|
-
*
|
|
45
|
-
* This type allow us to correctly handle either type
|
|
46
|
-
*
|
|
47
|
-
* @internal
|
|
48
|
-
*/
|
|
49
|
-
export declare type EventEmitterEventType = EventEmitter extends {
|
|
50
|
-
on(event: infer E, listener: any): any;
|
|
51
|
-
} ? E : never;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Base class used for forwarding events from a source EventEmitter.
|
|
55
|
-
* This can be useful when all arbitrary listeners need to be removed,
|
|
56
|
-
* but the primary source needs to stay intact.
|
|
57
|
-
*
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
export declare class EventForwarder<TEvent = IEvent> extends TypedEventEmitter<TEvent> implements IDisposable {
|
|
61
|
-
protected static isEmitterEvent(event: string): boolean;
|
|
62
|
-
private static readonly newListenerEvent;
|
|
63
|
-
private static readonly removeListenerEvent;
|
|
64
|
-
/**
|
|
65
|
-
* {@inheritDoc @fluidframework/core-interfaces#IDisposable.disposed}
|
|
66
|
-
*/
|
|
67
|
-
get disposed(): boolean;
|
|
68
|
-
private isDisposed;
|
|
69
|
-
private readonly forwardingEvents;
|
|
70
|
-
constructor(source?: EventEmitter | IEventProvider<TEvent & IEvent>);
|
|
71
|
-
/**
|
|
72
|
-
* {@inheritDoc @fluidframework/core-interfaces#IDisposable.dispose}
|
|
73
|
-
*/
|
|
74
|
-
dispose(): void;
|
|
75
|
-
protected forwardEvent(source: EventEmitter | IEventProvider<TEvent & IEvent>, ...events: string[]): void;
|
|
76
|
-
protected unforwardEvent(source: EventEmitter | IEventProvider<TEvent & IEvent>, ...events: string[]): void;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Converts the provided {@link https://en.wikipedia.org/wiki/Base64 | base64}-encoded string
|
|
81
|
-
* to {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8}.
|
|
82
|
-
*
|
|
83
|
-
* @internal
|
|
84
|
-
*/
|
|
85
|
-
export declare const fromBase64ToUtf8: (input: string) => string;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Converts the provided {@link https://en.wikipedia.org/wiki/UTF-8 | utf-8}-encoded string
|
|
89
|
-
* to {@link https://en.wikipedia.org/wiki/Base64 | base64}.
|
|
90
|
-
*
|
|
91
|
-
* @internal
|
|
92
|
-
*/
|
|
93
|
-
export declare const fromUtf8ToBase64: (input: string) => string;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Create a github hash (Github hashes the string with blob and size)
|
|
97
|
-
* Must be called under secure context for browsers
|
|
98
|
-
*
|
|
99
|
-
* @param file - The contents of the file in a buffer
|
|
100
|
-
* @returns The sha1 hash of the content of the buffer with the `blob` prefix and size
|
|
101
|
-
*
|
|
102
|
-
* @internal
|
|
103
|
-
*/
|
|
104
|
-
export declare function gitHashFile(file: IsoBuffer): Promise<string>;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Hash a file. Consistent within a session, but should not be persisted and
|
|
108
|
-
* is not consistent with git.
|
|
109
|
-
* If called under an insecure context for a browser, this will fallback to
|
|
110
|
-
* using the node implementation.
|
|
111
|
-
*
|
|
112
|
-
* @param file - The contents of the file in a buffer.
|
|
113
|
-
* @param algorithm - The hash algorithm to use, artificially constrained by what is used internally.
|
|
114
|
-
* @param hashEncoding - The encoding of the returned hash, also artificially constrained.
|
|
115
|
-
* @returns The hash of the content of the buffer.
|
|
116
|
-
*
|
|
117
|
-
* @internal
|
|
118
|
-
*/
|
|
119
|
-
export declare function hashFile(file: IsoBuffer, algorithm?: "SHA-1" | "SHA-256", hashEncoding?: "hex" | "base64"): Promise<string>;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* @internal
|
|
123
|
-
*/
|
|
124
|
-
export declare const IsoBuffer: typeof Buffer;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* @internal
|
|
128
|
-
*/
|
|
129
|
-
export declare type IsoBuffer = Buffer;
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* This type contains all browser performance properties as optional, and some
|
|
133
|
-
* of the intersecting properties of node and browser performance as required.
|
|
134
|
-
*
|
|
135
|
-
* @internal
|
|
136
|
-
*/
|
|
137
|
-
export declare type IsomorphicPerformance = Partial<Performance> & Pick<Performance, "clearMarks" | "mark" | "measure" | "now">;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Event in a performance trace including time elapsed.
|
|
141
|
-
*
|
|
142
|
-
* @internal
|
|
143
|
-
*/
|
|
144
|
-
export declare interface ITraceEvent {
|
|
145
|
-
/**
|
|
146
|
-
* Total time elapsed since the start of the Trace.
|
|
147
|
-
* Measured in milliseconds as a floating point with a decimal
|
|
148
|
-
*/
|
|
149
|
-
readonly totalTimeElapsed: number;
|
|
150
|
-
/**
|
|
151
|
-
* Time elapsed since the last trace event.
|
|
152
|
-
* Measured in milliseconds as a floating point with a decimal
|
|
153
|
-
*/
|
|
154
|
-
readonly duration: number;
|
|
155
|
-
/**
|
|
156
|
-
* This number represents a relative time which should
|
|
157
|
-
* be consistent for all trace ticks.
|
|
158
|
-
*/
|
|
159
|
-
readonly tick: number;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* @internal
|
|
164
|
-
*/
|
|
165
|
-
declare const performance_2: IsomorphicPerformance;
|
|
166
|
-
export { performance_2 as performance }
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Convert base64 or utf8 string to array buffer.
|
|
170
|
-
* @param encoding - The input string's encoding.
|
|
171
|
-
*
|
|
172
|
-
* @internal
|
|
173
|
-
*/
|
|
174
|
-
export declare function stringToBuffer(input: string, encoding: string): ArrayBufferLike;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Convenience function to convert unknown encoding to utf8 that avoids
|
|
178
|
-
* buffer copies/encode ops when no conversion is needed.
|
|
179
|
-
* @param input - The source string to convert.
|
|
180
|
-
* @param encoding - The source string's encoding.
|
|
181
|
-
*
|
|
182
|
-
* @internal
|
|
183
|
-
*/
|
|
184
|
-
export declare const toUtf8: (input: string, encoding: string) => string;
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Helper class for tracing performance of events
|
|
188
|
-
* Time measurements are in milliseconds as a floating point with a decimal
|
|
189
|
-
*
|
|
190
|
-
* @internal
|
|
191
|
-
*/
|
|
192
|
-
export declare class Trace {
|
|
193
|
-
readonly startTick: number;
|
|
194
|
-
static start(): Trace;
|
|
195
|
-
protected lastTick: number;
|
|
196
|
-
protected constructor(startTick: number);
|
|
197
|
-
trace(): ITraceEvent;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Event Emitter helper class the supports emitting typed events
|
|
202
|
-
*
|
|
203
|
-
* @internal
|
|
204
|
-
*/
|
|
205
|
-
export declare class TypedEventEmitter<TEvent> extends EventEmitter implements IEventProvider<TEvent & IEvent> {
|
|
206
|
-
constructor();
|
|
207
|
-
readonly addListener: TypedEventTransform<this, TEvent>;
|
|
208
|
-
readonly on: TypedEventTransform<this, TEvent>;
|
|
209
|
-
readonly once: TypedEventTransform<this, TEvent>;
|
|
210
|
-
readonly prependListener: TypedEventTransform<this, TEvent>;
|
|
211
|
-
readonly prependOnceListener: TypedEventTransform<this, TEvent>;
|
|
212
|
-
readonly removeListener: TypedEventTransform<this, TEvent>;
|
|
213
|
-
readonly off: TypedEventTransform<this, TEvent>;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* @internal
|
|
218
|
-
*/
|
|
219
|
-
export declare type TypedEventTransform<TThis, TEvent> = TransformedEvent<TThis, "newListener" | "removeListener", Parameters<(event: string, listener: (...args: any[]) => void) => void>> & IEventTransformer<TThis, TEvent & IEvent> & TransformedEvent<TThis, EventEmitterEventType, any[]>;
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Converts a Uint8Array array to an ArrayBuffer.
|
|
223
|
-
* @param array - Array to convert to ArrayBuffer.
|
|
224
|
-
*
|
|
225
|
-
* @internal
|
|
226
|
-
*/
|
|
227
|
-
export declare function Uint8ArrayToArrayBuffer(array: Uint8Array): ArrayBuffer;
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Converts a Uint8Array to a string of the provided encoding.
|
|
231
|
-
* @remarks Useful when the array might be an IsoBuffer.
|
|
232
|
-
* @param arr - The array to convert.
|
|
233
|
-
* @param encoding - Optional target encoding; only "utf8" and "base64" are
|
|
234
|
-
* supported, with "utf8" being default.
|
|
235
|
-
* @returns The converted string.
|
|
236
|
-
*
|
|
237
|
-
* @internal
|
|
238
|
-
*/
|
|
239
|
-
export declare function Uint8ArrayToString(arr: Uint8Array, encoding?: "utf8" | "utf-8" | "base64"): string;
|
|
240
|
-
|
|
241
|
-
export { }
|