@fluidframework/driver-utils 2.0.0-internal.3.4.2 → 2.0.0-internal.4.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/dist/index.d.ts +3 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -21
- package/dist/index.js.map +1 -1
- package/dist/messageRecognition.d.ts +0 -20
- package/dist/messageRecognition.d.ts.map +1 -1
- package/dist/messageRecognition.js +1 -37
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts +0 -15
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +0 -12
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/networkUtils.js +1 -34
- package/dist/networkUtils.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/index.d.ts +3 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -9
- package/lib/index.js.map +1 -1
- package/lib/messageRecognition.d.ts +0 -20
- package/lib/messageRecognition.d.ts.map +1 -1
- package/lib/messageRecognition.js +0 -35
- package/lib/messageRecognition.js.map +1 -1
- package/lib/network.d.ts +0 -15
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.d.ts +0 -12
- package/lib/networkUtils.d.ts.map +1 -1
- package/lib/networkUtils.js +0 -32
- package/lib/networkUtils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +64 -7
- package/src/index.ts +2 -19
- package/src/messageRecognition.ts +0 -36
- package/src/network.ts +0 -16
- package/src/networkUtils.ts +0 -34
- package/src/packageVersion.ts +1 -1
- package/dist/blobAggregationStorage.d.ts +0 -56
- package/dist/blobAggregationStorage.d.ts.map +0 -1
- package/dist/blobAggregationStorage.js +0 -327
- package/dist/blobAggregationStorage.js.map +0 -1
- package/dist/blobCacheStorageService.d.ts +0 -27
- package/dist/blobCacheStorageService.d.ts.map +0 -1
- package/dist/blobCacheStorageService.js +0 -40
- package/dist/blobCacheStorageService.js.map +0 -1
- package/dist/emptyDocumentDeltaStorageService.d.ts +0 -18
- package/dist/emptyDocumentDeltaStorageService.d.ts.map +0 -1
- package/dist/emptyDocumentDeltaStorageService.js +0 -25
- package/dist/emptyDocumentDeltaStorageService.js.map +0 -1
- package/dist/mapWithExpiration.d.ts +0 -75
- package/dist/mapWithExpiration.d.ts.map +0 -1
- package/dist/mapWithExpiration.js +0 -146
- package/dist/mapWithExpiration.js.map +0 -1
- package/dist/multiDocumentServiceFactory.d.ts +0 -34
- package/dist/multiDocumentServiceFactory.d.ts.map +0 -1
- package/dist/multiDocumentServiceFactory.js +0 -81
- package/dist/multiDocumentServiceFactory.js.map +0 -1
- package/dist/multiUrlResolver.d.ts +0 -34
- package/dist/multiUrlResolver.d.ts.map +0 -1
- package/dist/multiUrlResolver.js +0 -59
- package/dist/multiUrlResolver.js.map +0 -1
- package/dist/treeUtils.d.ts +0 -72
- package/dist/treeUtils.d.ts.map +0 -1
- package/dist/treeUtils.js +0 -102
- package/dist/treeUtils.js.map +0 -1
- package/lib/blobAggregationStorage.d.ts +0 -56
- package/lib/blobAggregationStorage.d.ts.map +0 -1
- package/lib/blobAggregationStorage.js +0 -322
- package/lib/blobAggregationStorage.js.map +0 -1
- package/lib/blobCacheStorageService.d.ts +0 -27
- package/lib/blobCacheStorageService.d.ts.map +0 -1
- package/lib/blobCacheStorageService.js +0 -36
- package/lib/blobCacheStorageService.js.map +0 -1
- package/lib/emptyDocumentDeltaStorageService.d.ts +0 -18
- package/lib/emptyDocumentDeltaStorageService.d.ts.map +0 -1
- package/lib/emptyDocumentDeltaStorageService.js +0 -21
- package/lib/emptyDocumentDeltaStorageService.js.map +0 -1
- package/lib/mapWithExpiration.d.ts +0 -75
- package/lib/mapWithExpiration.d.ts.map +0 -1
- package/lib/mapWithExpiration.js +0 -142
- package/lib/mapWithExpiration.js.map +0 -1
- package/lib/multiDocumentServiceFactory.d.ts +0 -34
- package/lib/multiDocumentServiceFactory.d.ts.map +0 -1
- package/lib/multiDocumentServiceFactory.js +0 -77
- package/lib/multiDocumentServiceFactory.js.map +0 -1
- package/lib/multiUrlResolver.d.ts +0 -34
- package/lib/multiUrlResolver.d.ts.map +0 -1
- package/lib/multiUrlResolver.js +0 -54
- package/lib/multiUrlResolver.js.map +0 -1
- package/lib/treeUtils.d.ts +0 -72
- package/lib/treeUtils.d.ts.map +0 -1
- package/lib/treeUtils.js +0 -97
- package/lib/treeUtils.js.map +0 -1
- package/src/blobAggregationStorage.ts +0 -430
- package/src/blobCacheStorageService.ts +0 -46
- package/src/emptyDocumentDeltaStorageService.ts +0 -30
- package/src/mapWithExpiration.ts +0 -165
- package/src/multiDocumentServiceFactory.ts +0 -109
- package/src/multiUrlResolver.ts +0 -62
- package/src/treeUtils.ts +0 -128
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { parse } from "url";
|
|
7
|
-
import {
|
|
8
|
-
IDocumentServiceFactory,
|
|
9
|
-
IResolvedUrl,
|
|
10
|
-
IDocumentService,
|
|
11
|
-
} from "@fluidframework/driver-definitions";
|
|
12
|
-
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
13
|
-
import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
14
|
-
import { ensureFluidResolvedUrl } from "./fluidResolvedUrl";
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
18
|
-
*/
|
|
19
|
-
export class MultiDocumentServiceFactory implements IDocumentServiceFactory {
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
22
|
-
*/
|
|
23
|
-
public static create(
|
|
24
|
-
documentServiceFactory: IDocumentServiceFactory | IDocumentServiceFactory[],
|
|
25
|
-
) {
|
|
26
|
-
if (Array.isArray(documentServiceFactory)) {
|
|
27
|
-
const factories: IDocumentServiceFactory[] = [];
|
|
28
|
-
documentServiceFactory.forEach((factory) => {
|
|
29
|
-
const maybeMulti = factory as MultiDocumentServiceFactory;
|
|
30
|
-
if (maybeMulti.protocolToDocumentFactoryMap !== undefined) {
|
|
31
|
-
factories.push(...maybeMulti.protocolToDocumentFactoryMap.values());
|
|
32
|
-
} else {
|
|
33
|
-
factories.push(factory);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
if (factories.length === 1) {
|
|
37
|
-
return factories[0];
|
|
38
|
-
}
|
|
39
|
-
return new MultiDocumentServiceFactory(factories);
|
|
40
|
-
}
|
|
41
|
-
return documentServiceFactory;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
private readonly protocolToDocumentFactoryMap: Map<string, IDocumentServiceFactory>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
48
|
-
*/
|
|
49
|
-
constructor(documentServiceFactories: IDocumentServiceFactory[]) {
|
|
50
|
-
this.protocolToDocumentFactoryMap = new Map();
|
|
51
|
-
documentServiceFactories.forEach((factory: IDocumentServiceFactory) => {
|
|
52
|
-
this.protocolToDocumentFactoryMap.set(factory.protocolName, factory);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
57
|
-
*/
|
|
58
|
-
public readonly protocolName = "none:";
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
61
|
-
*/
|
|
62
|
-
async createDocumentService(
|
|
63
|
-
resolvedUrl: IResolvedUrl,
|
|
64
|
-
logger?: ITelemetryBaseLogger,
|
|
65
|
-
clientIsSummarizer?: boolean,
|
|
66
|
-
): Promise<IDocumentService> {
|
|
67
|
-
ensureFluidResolvedUrl(resolvedUrl);
|
|
68
|
-
const urlObj = parse(resolvedUrl.url);
|
|
69
|
-
if (urlObj.protocol === undefined || urlObj.protocol === null) {
|
|
70
|
-
throw new Error("No protocol provided");
|
|
71
|
-
}
|
|
72
|
-
const factory: IDocumentServiceFactory | undefined = this.protocolToDocumentFactoryMap.get(
|
|
73
|
-
urlObj.protocol,
|
|
74
|
-
);
|
|
75
|
-
if (factory === undefined) {
|
|
76
|
-
throw new Error("Unknown Fluid protocol");
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return factory.createDocumentService(resolvedUrl, logger, clientIsSummarizer);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
84
|
-
*/
|
|
85
|
-
public async createContainer(
|
|
86
|
-
createNewSummary: ISummaryTree,
|
|
87
|
-
createNewResolvedUrl: IResolvedUrl,
|
|
88
|
-
logger?: ITelemetryBaseLogger,
|
|
89
|
-
clientIsSummarizer?: boolean,
|
|
90
|
-
): Promise<IDocumentService> {
|
|
91
|
-
ensureFluidResolvedUrl(createNewResolvedUrl);
|
|
92
|
-
const urlObj = parse(createNewResolvedUrl.url);
|
|
93
|
-
if (urlObj.protocol === undefined || urlObj.protocol === null) {
|
|
94
|
-
throw new Error("No protocol provided");
|
|
95
|
-
}
|
|
96
|
-
const factory: IDocumentServiceFactory | undefined = this.protocolToDocumentFactoryMap.get(
|
|
97
|
-
urlObj.protocol,
|
|
98
|
-
);
|
|
99
|
-
if (factory === undefined) {
|
|
100
|
-
throw new Error("Unknown Fluid protocol");
|
|
101
|
-
}
|
|
102
|
-
return factory.createContainer(
|
|
103
|
-
createNewSummary,
|
|
104
|
-
createNewResolvedUrl,
|
|
105
|
-
logger,
|
|
106
|
-
clientIsSummarizer,
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
}
|
package/src/multiUrlResolver.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { IRequest } from "@fluidframework/core-interfaces";
|
|
7
|
-
import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Resolver that takes a list of url resolvers and then try each of them to resolve the url.
|
|
11
|
-
* @param resolversList - List of url resolvers to be used to resolve the request.
|
|
12
|
-
* @param request - Request to be resolved.
|
|
13
|
-
*
|
|
14
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
15
|
-
*/
|
|
16
|
-
export async function configurableUrlResolver(
|
|
17
|
-
resolversList: IUrlResolver[],
|
|
18
|
-
request: IRequest,
|
|
19
|
-
): Promise<IResolvedUrl | undefined> {
|
|
20
|
-
let resolved: IResolvedUrl | undefined;
|
|
21
|
-
for (const resolver of resolversList) {
|
|
22
|
-
resolved = await resolver.resolve({ ...request });
|
|
23
|
-
if (resolved !== undefined) {
|
|
24
|
-
return resolved;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return undefined;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
32
|
-
*/
|
|
33
|
-
export class MultiUrlResolver implements IUrlResolver {
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
36
|
-
*/
|
|
37
|
-
public static create(urlResolver: IUrlResolver | IUrlResolver[]) {
|
|
38
|
-
if (Array.isArray(urlResolver)) {
|
|
39
|
-
if (urlResolver.length === 1) {
|
|
40
|
-
return urlResolver[0];
|
|
41
|
-
}
|
|
42
|
-
return new MultiUrlResolver(urlResolver);
|
|
43
|
-
}
|
|
44
|
-
return urlResolver;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
private constructor(private readonly urlResolvers: IUrlResolver[]) {}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
51
|
-
*/
|
|
52
|
-
async resolve(request: IRequest): Promise<IResolvedUrl | undefined> {
|
|
53
|
-
return configurableUrlResolver(this.urlResolvers, request);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
58
|
-
*/
|
|
59
|
-
public async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {
|
|
60
|
-
throw new Error("Not implmented");
|
|
61
|
-
}
|
|
62
|
-
}
|
package/src/treeUtils.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { assert, IsoBuffer } from "@fluidframework/common-utils";
|
|
7
|
-
import {
|
|
8
|
-
SummaryType,
|
|
9
|
-
ISnapshotTree,
|
|
10
|
-
ISummaryTree,
|
|
11
|
-
SummaryObject,
|
|
12
|
-
} from "@fluidframework/protocol-definitions";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Summary tree assembler props
|
|
16
|
-
*
|
|
17
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
18
|
-
*/
|
|
19
|
-
export interface ISummaryTreeAssemblerProps {
|
|
20
|
-
/**
|
|
21
|
-
* Indicates that this tree is unreferenced. If this is not present, the tree is considered referenced.
|
|
22
|
-
*
|
|
23
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
24
|
-
*/
|
|
25
|
-
unreferenced?: true;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Summary tree assembler (without stats collection).
|
|
30
|
-
*
|
|
31
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
32
|
-
*/
|
|
33
|
-
export class SummaryTreeAssembler {
|
|
34
|
-
private attachmentCounter: number = 0;
|
|
35
|
-
private readonly summaryTree: { [path: string]: SummaryObject } = {};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
39
|
-
*/
|
|
40
|
-
constructor(private readonly props?: ISummaryTreeAssemblerProps) {}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Get final summary
|
|
44
|
-
*
|
|
45
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
46
|
-
*/
|
|
47
|
-
public get summary(): ISummaryTree {
|
|
48
|
-
return {
|
|
49
|
-
type: SummaryType.Tree,
|
|
50
|
-
tree: { ...this.summaryTree },
|
|
51
|
-
unreferenced: this.props?.unreferenced,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Add blob to summary
|
|
57
|
-
*
|
|
58
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
59
|
-
*/
|
|
60
|
-
public addBlob(key: string, content: string | Uint8Array): void {
|
|
61
|
-
this.summaryTree[key] = {
|
|
62
|
-
type: SummaryType.Blob,
|
|
63
|
-
content,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Add handle to summary
|
|
69
|
-
*
|
|
70
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
71
|
-
*/
|
|
72
|
-
public addHandle(
|
|
73
|
-
key: string,
|
|
74
|
-
handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment,
|
|
75
|
-
handle: string,
|
|
76
|
-
): void {
|
|
77
|
-
this.summaryTree[key] = {
|
|
78
|
-
type: SummaryType.Handle,
|
|
79
|
-
handleType,
|
|
80
|
-
handle,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Add tree to summary
|
|
86
|
-
*
|
|
87
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
88
|
-
*/
|
|
89
|
-
public addTree(key: string, summary: ISummaryTree): void {
|
|
90
|
-
this.summaryTree[key] = summary;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Add attachment to summary
|
|
95
|
-
*
|
|
96
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
97
|
-
*/
|
|
98
|
-
public addAttachment(id: string) {
|
|
99
|
-
this.summaryTree[this.attachmentCounter++] = { id, type: SummaryType.Attachment };
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Helper function that converts ISnapshotTree and blobs to ISummaryTree
|
|
105
|
-
* @param snapshot - Source snapshot tree
|
|
106
|
-
* @param blobs - Blobs cache
|
|
107
|
-
* @returns Converted snapshot in ISummaryTree format
|
|
108
|
-
*
|
|
109
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
110
|
-
*/
|
|
111
|
-
export function convertSnapshotAndBlobsToSummaryTree(
|
|
112
|
-
snapshot: ISnapshotTree,
|
|
113
|
-
blobs: Map<string, ArrayBuffer>,
|
|
114
|
-
): ISummaryTree {
|
|
115
|
-
const assembler = new SummaryTreeAssembler({
|
|
116
|
-
unreferenced: snapshot.unreferenced,
|
|
117
|
-
});
|
|
118
|
-
for (const [path, id] of Object.entries(snapshot.blobs)) {
|
|
119
|
-
const blob = blobs.get(id);
|
|
120
|
-
assert(blob !== undefined, 0x2dd /* "Cannot find blob for a given id" */);
|
|
121
|
-
assembler.addBlob(path, IsoBuffer.from(blob).toString("utf-8"));
|
|
122
|
-
}
|
|
123
|
-
for (const [key, tree] of Object.entries(snapshot.trees)) {
|
|
124
|
-
const subtree = convertSnapshotAndBlobsToSummaryTree(tree, blobs);
|
|
125
|
-
assembler.addTree(key, subtree);
|
|
126
|
-
}
|
|
127
|
-
return assembler.summary;
|
|
128
|
-
}
|