@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
package/lib/mapWithExpiration.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { assert } from "@fluidframework/common-utils";
|
|
6
|
-
/**
|
|
7
|
-
* An extension of Map that expires (deletes) entries after a period of inactivity.
|
|
8
|
-
* The policy is based on the last time a key was written to.
|
|
9
|
-
*
|
|
10
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
11
|
-
*/
|
|
12
|
-
export class MapWithExpiration extends Map {
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
15
|
-
*/
|
|
16
|
-
constructor(expiryMs) {
|
|
17
|
-
super();
|
|
18
|
-
this.expiryMs = expiryMs;
|
|
19
|
-
/** Timestamps (as epoch ms numbers) of when each key was last refreshed */
|
|
20
|
-
this.lastRefreshedTimes = new Map();
|
|
21
|
-
}
|
|
22
|
-
refresh(key) {
|
|
23
|
-
this.lastRefreshedTimes.set(key, new Date().valueOf());
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Returns true if the key is present and expired, false if it's not expired, and undefined if it's not found
|
|
27
|
-
* If cleanUp is passed as true, then delete any expired entry before returning.
|
|
28
|
-
*/
|
|
29
|
-
checkExpiry(key, cleanUp = false) {
|
|
30
|
-
const refreshTime = this.lastRefreshedTimes.get(key);
|
|
31
|
-
assert((refreshTime !== undefined) === super.has(key), 0x50c /* freshness map out of sync */);
|
|
32
|
-
if (refreshTime === undefined) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
const expired = new Date().valueOf() - refreshTime >= this.expiryMs;
|
|
36
|
-
if (expired && cleanUp) {
|
|
37
|
-
this.delete(key);
|
|
38
|
-
}
|
|
39
|
-
return expired;
|
|
40
|
-
}
|
|
41
|
-
clearExpiredEntries() {
|
|
42
|
-
// forEach clears out any expired entries
|
|
43
|
-
this.forEach(() => { });
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
47
|
-
*/
|
|
48
|
-
get size() {
|
|
49
|
-
this.clearExpiredEntries();
|
|
50
|
-
return super.size;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
54
|
-
*/
|
|
55
|
-
has(key) {
|
|
56
|
-
this.checkExpiry(key, true /* cleanUp */);
|
|
57
|
-
return super.has(key);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
61
|
-
*/
|
|
62
|
-
get(key) {
|
|
63
|
-
this.checkExpiry(key, true /* cleanUp */);
|
|
64
|
-
return super.get(key);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
68
|
-
*/
|
|
69
|
-
set(key, value) {
|
|
70
|
-
// Sliding window expiration policy (on write)
|
|
71
|
-
this.refresh(key);
|
|
72
|
-
return super.set(key, value);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
76
|
-
*/
|
|
77
|
-
delete(key) {
|
|
78
|
-
this.lastRefreshedTimes.delete(key);
|
|
79
|
-
return super.delete(key);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
83
|
-
*/
|
|
84
|
-
clear() {
|
|
85
|
-
this.lastRefreshedTimes.clear();
|
|
86
|
-
super.clear();
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
90
|
-
*/
|
|
91
|
-
forEach(callbackfn, thisArg) {
|
|
92
|
-
const expiredKeys = [];
|
|
93
|
-
super.forEach((v, k, m) => {
|
|
94
|
-
if (this.checkExpiry(k) === true) {
|
|
95
|
-
expiredKeys.push(k);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
callbackfn.bind(thisArg)(v, k, m);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
// Clean up keys we know are expired now that we're done iterating
|
|
102
|
-
expiredKeys.forEach((key) => {
|
|
103
|
-
this.delete(key);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
108
|
-
*/
|
|
109
|
-
entries() {
|
|
110
|
-
this.clearExpiredEntries();
|
|
111
|
-
return super.entries();
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
115
|
-
*/
|
|
116
|
-
keys() {
|
|
117
|
-
this.clearExpiredEntries();
|
|
118
|
-
return super.keys();
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
122
|
-
*/
|
|
123
|
-
values() {
|
|
124
|
-
this.clearExpiredEntries();
|
|
125
|
-
return super.values();
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
129
|
-
*/
|
|
130
|
-
[Symbol.iterator]() {
|
|
131
|
-
this.clearExpiredEntries();
|
|
132
|
-
return super[Symbol.iterator]();
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
136
|
-
*/
|
|
137
|
-
valueOf() {
|
|
138
|
-
this.clearExpiredEntries();
|
|
139
|
-
return super.valueOf();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
//# sourceMappingURL=mapWithExpiration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapWithExpiration.js","sourceRoot":"","sources":["../src/mapWithExpiration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,OAAO,iBAA4C,SAAQ,GAAiB;IAIjF;;OAEG;IACH,YAA6B,QAAgB;QAC5C,KAAK,EAAE,CAAC;QADoB,aAAQ,GAAR,QAAQ,CAAQ;QAN7C,2EAA2E;QAC1D,uBAAkB,GAAG,IAAI,GAAG,EAAgB,CAAC;IAO9D,CAAC;IAEO,OAAO,CAAC,GAAS;QACxB,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IACxD,CAAC;IAED;;;OAGG;IACK,WAAW,CAAC,GAAS,EAAE,UAAmB,K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IACD;;OAEG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,OAAO;QACN,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\n\n/**\n * An extension of Map that expires (deletes) entries after a period of inactivity.\n * The policy is based on the last time a key was written to.\n *\n * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n */\nexport class MapWithExpiration<TKey = any, TValue = any> extends Map<TKey, TValue> {\n\t/** Timestamps (as epoch ms numbers) of when each key was last refreshed */\n\tprivate readonly lastRefreshedTimes = new Map<TKey, number>();\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tconstructor(private readonly expiryMs: number) {\n\t\tsuper();\n\t}\n\n\tprivate refresh(key: TKey): void {\n\t\tthis.lastRefreshedTimes.set(key, new Date().valueOf());\n\t}\n\n\t/**\n\t * Returns true if the key is present and expired, false if it's not expired, and undefined if it's not found\n\t * If cleanUp is passed as true, then delete any expired entry before returning.\n\t */\n\tprivate checkExpiry(key: TKey, cleanUp: boolean = false): boolean | undefined {\n\t\tconst refreshTime = this.lastRefreshedTimes.get(key);\n\t\tassert(\n\t\t\t(refreshTime !== undefined) === super.has(key),\n\t\t\t0x50c /* freshness map out of sync */,\n\t\t);\n\n\t\tif (refreshTime === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst expired = new Date().valueOf() - refreshTime >= this.expiryMs;\n\t\tif (expired && cleanUp) {\n\t\t\tthis.delete(key);\n\t\t}\n\t\treturn expired;\n\t}\n\n\tprivate clearExpiredEntries() {\n\t\t// forEach clears out any expired entries\n\t\tthis.forEach(() => {});\n\t}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tget size(): number {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.size;\n\t}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\thas(key: TKey): boolean {\n\t\tthis.checkExpiry(key, true /* cleanUp */);\n\t\treturn super.has(key);\n\t}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tget(key: TKey): TValue | undefined {\n\t\tthis.checkExpiry(key, true /* cleanUp */);\n\t\treturn super.get(key);\n\t}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tset(key: TKey, value: TValue): this {\n\t\t// Sliding window expiration policy (on write)\n\t\tthis.refresh(key);\n\t\treturn super.set(key, value);\n\t}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tdelete(key: TKey): boolean {\n\t\tthis.lastRefreshedTimes.delete(key);\n\t\treturn super.delete(key);\n\t}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tclear(): void {\n\t\tthis.lastRefreshedTimes.clear();\n\t\tsuper.clear();\n\t}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tforEach(\n\t\tcallbackfn: (value: TValue, key: TKey, map: Map<TKey, TValue>) => void,\n\t\tthisArg?: any,\n\t): void {\n\t\tconst expiredKeys: TKey[] = [];\n\t\tsuper.forEach(\n\t\t\t(v, k, m) => {\n\t\t\t\tif (this.checkExpiry(k) === true) {\n\t\t\t\t\texpiredKeys.push(k);\n\t\t\t\t} else {\n\t\t\t\t\tcallbackfn.bind(thisArg)(v, k, m);\n\t\t\t\t}\n\t\t\t},\n\t\t\t// Note we don't pass thisArg here, since we bind it directly to callbackFn and don't need it otherwise\n\t\t);\n\n\t\t// Clean up keys we know are expired now that we're done iterating\n\t\texpiredKeys.forEach((key: TKey) => {\n\t\t\tthis.delete(key);\n\t\t});\n\t}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tentries(): IterableIterator<[TKey, TValue]> {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.entries();\n\t}\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tkeys(): IterableIterator<TKey> {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.keys();\n\t}\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tvalues(): IterableIterator<TValue> {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.values();\n\t}\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\t[Symbol.iterator](): IterableIterator<[TKey, TValue]> {\n\t\tthis.clearExpiredEntries();\n\t\treturn super[Symbol.iterator]();\n\t}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tvalueOf() {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.valueOf();\n\t}\n}\n"]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { IDocumentServiceFactory, IResolvedUrl, IDocumentService } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
7
|
-
import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
10
|
-
*/
|
|
11
|
-
export declare class MultiDocumentServiceFactory implements IDocumentServiceFactory {
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
14
|
-
*/
|
|
15
|
-
static create(documentServiceFactory: IDocumentServiceFactory | IDocumentServiceFactory[]): IDocumentServiceFactory;
|
|
16
|
-
private readonly protocolToDocumentFactoryMap;
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
19
|
-
*/
|
|
20
|
-
constructor(documentServiceFactories: IDocumentServiceFactory[]);
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
23
|
-
*/
|
|
24
|
-
readonly protocolName = "none:";
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
27
|
-
*/
|
|
28
|
-
createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
31
|
-
*/
|
|
32
|
-
createContainer(createNewSummary: ISummaryTree, createNewResolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=multiDocumentServiceFactory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multiDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/multiDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,uBAAuB,EACvB,YAAY,EACZ,gBAAgB,EAChB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAG1E;;GAEG;AACH,qBAAa,2BAA4B,YAAW,uBAAuB;IAC1E;;OAEG;WACW,MAAM,CACnB,sBAAsB,EAAE,uBAAuB,GAAG,uBAAuB,EAAE;IAoB5E,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAuC;IAEpF;;OAEG;gBACS,wBAAwB,EAAE,uBAAuB,EAAE;IAM/D;;OAEG;IACH,SAAgB,YAAY,WAAW;IACvC;;OAEG;IACG,qBAAqB,CAC1B,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;IAgB5B;;OAEG;IACU,eAAe,CAC3B,gBAAgB,EAAE,YAAY,EAC9B,oBAAoB,EAAE,YAAY,EAClC,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;CAmB5B"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { parse } from "url";
|
|
6
|
-
import { ensureFluidResolvedUrl } from "./fluidResolvedUrl";
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
9
|
-
*/
|
|
10
|
-
export class MultiDocumentServiceFactory {
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
13
|
-
*/
|
|
14
|
-
constructor(documentServiceFactories) {
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
17
|
-
*/
|
|
18
|
-
this.protocolName = "none:";
|
|
19
|
-
this.protocolToDocumentFactoryMap = new Map();
|
|
20
|
-
documentServiceFactories.forEach((factory) => {
|
|
21
|
-
this.protocolToDocumentFactoryMap.set(factory.protocolName, factory);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
26
|
-
*/
|
|
27
|
-
static create(documentServiceFactory) {
|
|
28
|
-
if (Array.isArray(documentServiceFactory)) {
|
|
29
|
-
const factories = [];
|
|
30
|
-
documentServiceFactory.forEach((factory) => {
|
|
31
|
-
const maybeMulti = factory;
|
|
32
|
-
if (maybeMulti.protocolToDocumentFactoryMap !== undefined) {
|
|
33
|
-
factories.push(...maybeMulti.protocolToDocumentFactoryMap.values());
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
factories.push(factory);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
if (factories.length === 1) {
|
|
40
|
-
return factories[0];
|
|
41
|
-
}
|
|
42
|
-
return new MultiDocumentServiceFactory(factories);
|
|
43
|
-
}
|
|
44
|
-
return documentServiceFactory;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
48
|
-
*/
|
|
49
|
-
async createDocumentService(resolvedUrl, logger, clientIsSummarizer) {
|
|
50
|
-
ensureFluidResolvedUrl(resolvedUrl);
|
|
51
|
-
const urlObj = parse(resolvedUrl.url);
|
|
52
|
-
if (urlObj.protocol === undefined || urlObj.protocol === null) {
|
|
53
|
-
throw new Error("No protocol provided");
|
|
54
|
-
}
|
|
55
|
-
const factory = this.protocolToDocumentFactoryMap.get(urlObj.protocol);
|
|
56
|
-
if (factory === undefined) {
|
|
57
|
-
throw new Error("Unknown Fluid protocol");
|
|
58
|
-
}
|
|
59
|
-
return factory.createDocumentService(resolvedUrl, logger, clientIsSummarizer);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
63
|
-
*/
|
|
64
|
-
async createContainer(createNewSummary, createNewResolvedUrl, logger, clientIsSummarizer) {
|
|
65
|
-
ensureFluidResolvedUrl(createNewResolvedUrl);
|
|
66
|
-
const urlObj = parse(createNewResolvedUrl.url);
|
|
67
|
-
if (urlObj.protocol === undefined || urlObj.protocol === null) {
|
|
68
|
-
throw new Error("No protocol provided");
|
|
69
|
-
}
|
|
70
|
-
const factory = this.protocolToDocumentFactoryMap.get(urlObj.protocol);
|
|
71
|
-
if (factory === undefined) {
|
|
72
|
-
throw new Error("Unknown Fluid protocol");
|
|
73
|
-
}
|
|
74
|
-
return factory.createContainer(createNewSummary, createNewResolvedUrl, logger, clientIsSummarizer);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=multiDocumentServiceFactory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multiDocumentServiceFactory.js","sourceRoot":"","sources":["../src/multiDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AAQ5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;GAEG;AACH,MAAM,OAAO,2BAA2B;IA2BvC;;OAEG;IACH,YAAY,wBAAmD;QAM/D;;WAEG;QACa,iBAAY,GAAG,OAAO,CAAC;QARtC,IAAI,CAAC,4BAA4B,GAAG,IAAI,GAAG,EAAE,CAAC;QAC9C,wBAAwB,CAAC,OAAO,CAAC,CAAC,OAAgC,EAAE,EAAE;YACrE,IAAI,CAAC,4BAA4B,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACJ,CAAC;IAlCD;;OAEG;IACI,MAAM,CAAC,MAAM,CACnB,sBAA2E;QAE3E,IAAI,KAAK,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE;YAC1C,MAAM,SAAS,GAA8B,EAAE,CAAC;YAChD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B,sBAAsB,CAAC,oBAAoB,CAAC,CAAC;QAC7C,MAAM,MAAM,GAAG,KAAK,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,EAAE;YAC9D,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SACxC;QACD,MAAM,OAAO,GAAwC,IAAI,CAAC,4BAA4B,CAAC,GAAG,CACzF,MAAM,CAAC,QAAQ,CACf,CAAC;QACF,IAAI,OAAO,KAAK,SAAS,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC1C;QACD,OAAO,OAAO,CAAC,eAAe,CAC7B,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,EACN,kBAAkB,CAClB,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { parse } from \"url\";\nimport {\n\tIDocumentServiceFactory,\n\tIResolvedUrl,\n\tIDocumentService,\n} from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { ensureFluidResolvedUrl } from \"./fluidResolvedUrl\";\n\n/**\n * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n */\nexport class MultiDocumentServiceFactory implements IDocumentServiceFactory {\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic static create(\n\t\tdocumentServiceFactory: IDocumentServiceFactory | IDocumentServiceFactory[],\n\t) {\n\t\tif (Array.isArray(documentServiceFactory)) {\n\t\t\tconst factories: IDocumentServiceFactory[] = [];\n\t\t\tdocumentServiceFactory.forEach((factory) => {\n\t\t\t\tconst maybeMulti = factory as MultiDocumentServiceFactory;\n\t\t\t\tif (maybeMulti.protocolToDocumentFactoryMap !== undefined) {\n\t\t\t\t\tfactories.push(...maybeMulti.protocolToDocumentFactoryMap.values());\n\t\t\t\t} else {\n\t\t\t\t\tfactories.push(factory);\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (factories.length === 1) {\n\t\t\t\treturn factories[0];\n\t\t\t}\n\t\t\treturn new MultiDocumentServiceFactory(factories);\n\t\t}\n\t\treturn documentServiceFactory;\n\t}\n\n\tprivate readonly protocolToDocumentFactoryMap: Map<string, IDocumentServiceFactory>;\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tconstructor(documentServiceFactories: IDocumentServiceFactory[]) {\n\t\tthis.protocolToDocumentFactoryMap = new Map();\n\t\tdocumentServiceFactories.forEach((factory: IDocumentServiceFactory) => {\n\t\t\tthis.protocolToDocumentFactoryMap.set(factory.protocolName, factory);\n\t\t});\n\t}\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic readonly protocolName = \"none:\";\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tasync createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tensureFluidResolvedUrl(resolvedUrl);\n\t\tconst urlObj = parse(resolvedUrl.url);\n\t\tif (urlObj.protocol === undefined || urlObj.protocol === null) {\n\t\t\tthrow new Error(\"No protocol provided\");\n\t\t}\n\t\tconst factory: IDocumentServiceFactory | undefined = this.protocolToDocumentFactoryMap.get(\n\t\t\turlObj.protocol,\n\t\t);\n\t\tif (factory === undefined) {\n\t\t\tthrow new Error(\"Unknown Fluid protocol\");\n\t\t}\n\n\t\treturn factory.createDocumentService(resolvedUrl, logger, clientIsSummarizer);\n\t}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic async createContainer(\n\t\tcreateNewSummary: ISummaryTree,\n\t\tcreateNewResolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tensureFluidResolvedUrl(createNewResolvedUrl);\n\t\tconst urlObj = parse(createNewResolvedUrl.url);\n\t\tif (urlObj.protocol === undefined || urlObj.protocol === null) {\n\t\t\tthrow new Error(\"No protocol provided\");\n\t\t}\n\t\tconst factory: IDocumentServiceFactory | undefined = this.protocolToDocumentFactoryMap.get(\n\t\t\turlObj.protocol,\n\t\t);\n\t\tif (factory === undefined) {\n\t\t\tthrow new Error(\"Unknown Fluid protocol\");\n\t\t}\n\t\treturn factory.createContainer(\n\t\t\tcreateNewSummary,\n\t\t\tcreateNewResolvedUrl,\n\t\t\tlogger,\n\t\t\tclientIsSummarizer,\n\t\t);\n\t}\n}\n"]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { IRequest } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
7
|
-
/**
|
|
8
|
-
* Resolver that takes a list of url resolvers and then try each of them to resolve the url.
|
|
9
|
-
* @param resolversList - List of url resolvers to be used to resolve the request.
|
|
10
|
-
* @param request - Request to be resolved.
|
|
11
|
-
*
|
|
12
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
13
|
-
*/
|
|
14
|
-
export declare function configurableUrlResolver(resolversList: IUrlResolver[], request: IRequest): Promise<IResolvedUrl | undefined>;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
17
|
-
*/
|
|
18
|
-
export declare class MultiUrlResolver implements IUrlResolver {
|
|
19
|
-
private readonly urlResolvers;
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
22
|
-
*/
|
|
23
|
-
static create(urlResolver: IUrlResolver | IUrlResolver[]): IUrlResolver;
|
|
24
|
-
private constructor();
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
27
|
-
*/
|
|
28
|
-
resolve(request: IRequest): Promise<IResolvedUrl | undefined>;
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
31
|
-
*/
|
|
32
|
-
getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=multiUrlResolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multiUrlResolver.d.ts","sourceRoot":"","sources":["../src/multiUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEhF;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC5C,aAAa,EAAE,YAAY,EAAE,EAC7B,OAAO,EAAE,QAAQ,GACf,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CASnC;AAED;;GAEG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IAchC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAbjD;;OAEG;WACW,MAAM,CAAC,WAAW,EAAE,YAAY,GAAG,YAAY,EAAE;IAU/D,OAAO;IAEP;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAInE;;OAEG;IACU,cAAc,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAG5F"}
|
package/lib/multiUrlResolver.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Resolver that takes a list of url resolvers and then try each of them to resolve the url.
|
|
7
|
-
* @param resolversList - List of url resolvers to be used to resolve the request.
|
|
8
|
-
* @param request - Request to be resolved.
|
|
9
|
-
*
|
|
10
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
11
|
-
*/
|
|
12
|
-
export async function configurableUrlResolver(resolversList, request) {
|
|
13
|
-
let resolved;
|
|
14
|
-
for (const resolver of resolversList) {
|
|
15
|
-
resolved = await resolver.resolve(Object.assign({}, request));
|
|
16
|
-
if (resolved !== undefined) {
|
|
17
|
-
return resolved;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
24
|
-
*/
|
|
25
|
-
export class MultiUrlResolver {
|
|
26
|
-
constructor(urlResolvers) {
|
|
27
|
-
this.urlResolvers = urlResolvers;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
31
|
-
*/
|
|
32
|
-
static create(urlResolver) {
|
|
33
|
-
if (Array.isArray(urlResolver)) {
|
|
34
|
-
if (urlResolver.length === 1) {
|
|
35
|
-
return urlResolver[0];
|
|
36
|
-
}
|
|
37
|
-
return new MultiUrlResolver(urlResolver);
|
|
38
|
-
}
|
|
39
|
-
return urlResolver;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
43
|
-
*/
|
|
44
|
-
async resolve(request) {
|
|
45
|
-
return configurableUrlResolver(this.urlResolvers, request);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
49
|
-
*/
|
|
50
|
-
async getAbsoluteUrl(resolvedUrl, relativeUrl) {
|
|
51
|
-
throw new Error("Not implmented");
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=multiUrlResolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multiUrlResolver.js","sourceRoot":"","sources":["../src/multiUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC5C,aAA6B,EAC7B,OAAiB;IAEjB,IAAI,QAAkC,CAAC;IACvC,KAAK,MAAM,QAAQ,IAAI,aAAa,EAAE;QACrC,QAAQ,GAAG,MAAM,QAAQ,CAAC,OAAO,mBAAM,OAAO,EAAG,CAAC;QAClD,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC3B,OAAO,QAAQ,CAAC;SAChB;KACD;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAc5B,YAAqC,YAA4B;QAA5B,iBAAY,GAAZ,YAAY,CAAgB;IAAG,CAAC;IAbrE;;OAEG;IACI,MAAM,CAAC,MAAM,CAAC,WAA0C;QAC9D,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YAC/B,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC7B,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;aACtB;YACD,OAAO,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC;SACzC;QACD,OAAO,WAAW,CAAC;IACpB,CAAC;IAID;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,OAAiB;QAC9B,OAAO,uBAAuB,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,cAAc,CAAC,WAAyB,EAAE,WAAmB;QACzE,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACnC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\n\n/**\n * Resolver that takes a list of url resolvers and then try each of them to resolve the url.\n * @param resolversList - List of url resolvers to be used to resolve the request.\n * @param request - Request to be resolved.\n *\n * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n */\nexport async function configurableUrlResolver(\n\tresolversList: IUrlResolver[],\n\trequest: IRequest,\n): Promise<IResolvedUrl | undefined> {\n\tlet resolved: IResolvedUrl | undefined;\n\tfor (const resolver of resolversList) {\n\t\tresolved = await resolver.resolve({ ...request });\n\t\tif (resolved !== undefined) {\n\t\t\treturn resolved;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n */\nexport class MultiUrlResolver implements IUrlResolver {\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic static create(urlResolver: IUrlResolver | IUrlResolver[]) {\n\t\tif (Array.isArray(urlResolver)) {\n\t\t\tif (urlResolver.length === 1) {\n\t\t\t\treturn urlResolver[0];\n\t\t\t}\n\t\t\treturn new MultiUrlResolver(urlResolver);\n\t\t}\n\t\treturn urlResolver;\n\t}\n\n\tprivate constructor(private readonly urlResolvers: IUrlResolver[]) {}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tasync resolve(request: IRequest): Promise<IResolvedUrl | undefined> {\n\t\treturn configurableUrlResolver(this.urlResolvers, request);\n\t}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tthrow new Error(\"Not implmented\");\n\t}\n}\n"]}
|
package/lib/treeUtils.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { SummaryType, ISnapshotTree, ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
6
|
-
/**
|
|
7
|
-
* Summary tree assembler props
|
|
8
|
-
*
|
|
9
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
10
|
-
*/
|
|
11
|
-
export interface ISummaryTreeAssemblerProps {
|
|
12
|
-
/**
|
|
13
|
-
* Indicates that this tree is unreferenced. If this is not present, the tree is considered referenced.
|
|
14
|
-
*
|
|
15
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
16
|
-
*/
|
|
17
|
-
unreferenced?: true;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Summary tree assembler (without stats collection).
|
|
21
|
-
*
|
|
22
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
23
|
-
*/
|
|
24
|
-
export declare class SummaryTreeAssembler {
|
|
25
|
-
private readonly props?;
|
|
26
|
-
private attachmentCounter;
|
|
27
|
-
private readonly summaryTree;
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
30
|
-
*/
|
|
31
|
-
constructor(props?: ISummaryTreeAssemblerProps | undefined);
|
|
32
|
-
/**
|
|
33
|
-
* Get final summary
|
|
34
|
-
*
|
|
35
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
36
|
-
*/
|
|
37
|
-
get summary(): ISummaryTree;
|
|
38
|
-
/**
|
|
39
|
-
* Add blob to summary
|
|
40
|
-
*
|
|
41
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
42
|
-
*/
|
|
43
|
-
addBlob(key: string, content: string | Uint8Array): void;
|
|
44
|
-
/**
|
|
45
|
-
* Add handle to summary
|
|
46
|
-
*
|
|
47
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
48
|
-
*/
|
|
49
|
-
addHandle(key: string, handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment, handle: string): void;
|
|
50
|
-
/**
|
|
51
|
-
* Add tree to summary
|
|
52
|
-
*
|
|
53
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
54
|
-
*/
|
|
55
|
-
addTree(key: string, summary: ISummaryTree): void;
|
|
56
|
-
/**
|
|
57
|
-
* Add attachment to summary
|
|
58
|
-
*
|
|
59
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
60
|
-
*/
|
|
61
|
-
addAttachment(id: string): void;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Helper function that converts ISnapshotTree and blobs to ISummaryTree
|
|
65
|
-
* @param snapshot - Source snapshot tree
|
|
66
|
-
* @param blobs - Blobs cache
|
|
67
|
-
* @returns Converted snapshot in ISummaryTree format
|
|
68
|
-
*
|
|
69
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
70
|
-
*/
|
|
71
|
-
export declare function convertSnapshotAndBlobsToSummaryTree(snapshot: ISnapshotTree, blobs: Map<string, ArrayBuffer>): ISummaryTree;
|
|
72
|
-
//# sourceMappingURL=treeUtils.d.ts.map
|
package/lib/treeUtils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"treeUtils.d.ts","sourceRoot":"","sources":["../src/treeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,WAAW,EACX,aAAa,EACb,YAAY,EAEZ,MAAM,sCAAsC,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;;;OAIG;IACH,YAAY,CAAC,EAAE,IAAI,CAAC;CACpB;AAED;;;;GAIG;AACH,qBAAa,oBAAoB;IAOpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IANnC,OAAO,CAAC,iBAAiB,CAAa;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAyC;IAErE;;OAEG;gBAC0B,KAAK,CAAC,wCAA4B;IAE/D;;;;OAIG;IACH,IAAW,OAAO,IAAI,YAAY,CAMjC;IAED;;;;OAIG;IACI,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAO/D;;;;OAIG;IACI,SAAS,CACf,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,WAAW,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,GAAG,WAAW,CAAC,UAAU,EACxE,MAAM,EAAE,MAAM,GACZ,IAAI;IAQP;;;;OAIG;IACI,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI;IAIxD;;;;OAIG;IACI,aAAa,CAAC,EAAE,EAAE,MAAM;CAG/B;AAED;;;;;;;GAOG;AACH,wBAAgB,oCAAoC,CACnD,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAC7B,YAAY,CAcd"}
|
package/lib/treeUtils.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { assert, IsoBuffer } from "@fluidframework/common-utils";
|
|
6
|
-
import { SummaryType, } from "@fluidframework/protocol-definitions";
|
|
7
|
-
/**
|
|
8
|
-
* Summary tree assembler (without stats collection).
|
|
9
|
-
*
|
|
10
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
11
|
-
*/
|
|
12
|
-
export class SummaryTreeAssembler {
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
15
|
-
*/
|
|
16
|
-
constructor(props) {
|
|
17
|
-
this.props = props;
|
|
18
|
-
this.attachmentCounter = 0;
|
|
19
|
-
this.summaryTree = {};
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Get final summary
|
|
23
|
-
*
|
|
24
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
25
|
-
*/
|
|
26
|
-
get summary() {
|
|
27
|
-
var _a;
|
|
28
|
-
return {
|
|
29
|
-
type: SummaryType.Tree,
|
|
30
|
-
tree: Object.assign({}, this.summaryTree),
|
|
31
|
-
unreferenced: (_a = this.props) === null || _a === void 0 ? void 0 : _a.unreferenced,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Add blob to summary
|
|
36
|
-
*
|
|
37
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
38
|
-
*/
|
|
39
|
-
addBlob(key, content) {
|
|
40
|
-
this.summaryTree[key] = {
|
|
41
|
-
type: SummaryType.Blob,
|
|
42
|
-
content,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Add handle to summary
|
|
47
|
-
*
|
|
48
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
49
|
-
*/
|
|
50
|
-
addHandle(key, handleType, handle) {
|
|
51
|
-
this.summaryTree[key] = {
|
|
52
|
-
type: SummaryType.Handle,
|
|
53
|
-
handleType,
|
|
54
|
-
handle,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Add tree to summary
|
|
59
|
-
*
|
|
60
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
61
|
-
*/
|
|
62
|
-
addTree(key, summary) {
|
|
63
|
-
this.summaryTree[key] = summary;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Add attachment to summary
|
|
67
|
-
*
|
|
68
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
69
|
-
*/
|
|
70
|
-
addAttachment(id) {
|
|
71
|
-
this.summaryTree[this.attachmentCounter++] = { id, type: SummaryType.Attachment };
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Helper function that converts ISnapshotTree and blobs to ISummaryTree
|
|
76
|
-
* @param snapshot - Source snapshot tree
|
|
77
|
-
* @param blobs - Blobs cache
|
|
78
|
-
* @returns Converted snapshot in ISummaryTree format
|
|
79
|
-
*
|
|
80
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
81
|
-
*/
|
|
82
|
-
export function convertSnapshotAndBlobsToSummaryTree(snapshot, blobs) {
|
|
83
|
-
const assembler = new SummaryTreeAssembler({
|
|
84
|
-
unreferenced: snapshot.unreferenced,
|
|
85
|
-
});
|
|
86
|
-
for (const [path, id] of Object.entries(snapshot.blobs)) {
|
|
87
|
-
const blob = blobs.get(id);
|
|
88
|
-
assert(blob !== undefined, 0x2dd /* "Cannot find blob for a given id" */);
|
|
89
|
-
assembler.addBlob(path, IsoBuffer.from(blob).toString("utf-8"));
|
|
90
|
-
}
|
|
91
|
-
for (const [key, tree] of Object.entries(snapshot.trees)) {
|
|
92
|
-
const subtree = convertSnapshotAndBlobsToSummaryTree(tree, blobs);
|
|
93
|
-
assembler.addTree(key, subtree);
|
|
94
|
-
}
|
|
95
|
-
return assembler.summary;
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=treeUtils.js.map
|
package/lib/treeUtils.js.map
DELETED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AE,WAAW,CAAC,UAAU,EAAE,CAAC;IACnF,CAAC;CACD;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oCAAoC,CACnD,QAAuB,EACvB,KAA+B;IAE/B,MAAM,SAAS,GAAG,IAAI,oBAAoB,CAAC;QAC1C,YAAY,EAAE,QAAQ,CAAC,YAAY;KACnC,CAAC,CAAC;IACH,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACxD,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC3B,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC1E,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;KAChE;IACD,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACzD,MAAM,OAAO,GAAG,oCAAoC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAClE,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KAChC;IACD,OAAO,SAAS,CAAC,OAAO,CAAC;AAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, IsoBuffer } from \"@fluidframework/common-utils\";\nimport {\n\tSummaryType,\n\tISnapshotTree,\n\tISummaryTree,\n\tSummaryObject,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Summary tree assembler props\n *\n * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n */\nexport interface ISummaryTreeAssemblerProps {\n\t/**\n\t * Indicates that this tree is unreferenced. If this is not present, the tree is considered referenced.\n\t *\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tunreferenced?: true;\n}\n\n/**\n * Summary tree assembler (without stats collection).\n *\n * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n */\nexport class SummaryTreeAssembler {\n\tprivate attachmentCounter: number = 0;\n\tprivate readonly summaryTree: { [path: string]: SummaryObject } = {};\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tconstructor(private readonly props?: ISummaryTreeAssemblerProps) {}\n\n\t/**\n\t * Get final summary\n\t *\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic get summary(): ISummaryTree {\n\t\treturn {\n\t\t\ttype: SummaryType.Tree,\n\t\t\ttree: { ...this.summaryTree },\n\t\t\tunreferenced: this.props?.unreferenced,\n\t\t};\n\t}\n\n\t/**\n\t * Add blob to summary\n\t *\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic addBlob(key: string, content: string | Uint8Array): void {\n\t\tthis.summaryTree[key] = {\n\t\t\ttype: SummaryType.Blob,\n\t\t\tcontent,\n\t\t};\n\t}\n\n\t/**\n\t * Add handle to summary\n\t *\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic addHandle(\n\t\tkey: string,\n\t\thandleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment,\n\t\thandle: string,\n\t): void {\n\t\tthis.summaryTree[key] = {\n\t\t\ttype: SummaryType.Handle,\n\t\t\thandleType,\n\t\t\thandle,\n\t\t};\n\t}\n\n\t/**\n\t * Add tree to summary\n\t *\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic addTree(key: string, summary: ISummaryTree): void {\n\t\tthis.summaryTree[key] = summary;\n\t}\n\n\t/**\n\t * Add attachment to summary\n\t *\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic addAttachment(id: string) {\n\t\tthis.summaryTree[this.attachmentCounter++] = { id, type: SummaryType.Attachment };\n\t}\n}\n\n/**\n * Helper function that converts ISnapshotTree and blobs to ISummaryTree\n * @param snapshot - Source snapshot tree\n * @param blobs - Blobs cache\n * @returns Converted snapshot in ISummaryTree format\n *\n * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n */\nexport function convertSnapshotAndBlobsToSummaryTree(\n\tsnapshot: ISnapshotTree,\n\tblobs: Map<string, ArrayBuffer>,\n): ISummaryTree {\n\tconst assembler = new SummaryTreeAssembler({\n\t\tunreferenced: snapshot.unreferenced,\n\t});\n\tfor (const [path, id] of Object.entries(snapshot.blobs)) {\n\t\tconst blob = blobs.get(id);\n\t\tassert(blob !== undefined, 0x2dd /* \"Cannot find blob for a given id\" */);\n\t\tassembler.addBlob(path, IsoBuffer.from(blob).toString(\"utf-8\"));\n\t}\n\tfor (const [key, tree] of Object.entries(snapshot.trees)) {\n\t\tconst subtree = convertSnapshotAndBlobsToSummaryTree(tree, blobs);\n\t\tassembler.addTree(key, subtree);\n\t}\n\treturn assembler.summary;\n}\n"]}
|