@fluidframework/local-driver 2.0.0-internal.5.4.0 → 2.0.0-internal.6.1.0
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 +12 -0
- package/dist/localCreateDocument.d.ts.map +1 -1
- package/dist/localCreateDocument.js +1 -5
- package/dist/localCreateDocument.js.map +1 -1
- package/dist/localDeltaStorageService.js +1 -1
- package/dist/localDeltaStorageService.js.map +1 -1
- package/dist/localDocumentStorageService.d.ts +2 -2
- package/dist/localDocumentStorageService.d.ts.map +1 -1
- package/dist/localDocumentStorageService.js +2 -3
- package/dist/localDocumentStorageService.js.map +1 -1
- package/lib/localCreateDocument.d.ts.map +1 -1
- package/lib/localCreateDocument.js +1 -5
- package/lib/localCreateDocument.js.map +1 -1
- package/lib/localDeltaStorageService.js +1 -1
- package/lib/localDeltaStorageService.js.map +1 -1
- package/lib/localDocumentStorageService.d.ts +2 -2
- package/lib/localDocumentStorageService.d.ts.map +1 -1
- package/lib/localDocumentStorageService.js +3 -4
- package/lib/localDocumentStorageService.js.map +1 -1
- package/package.json +17 -17
- package/src/localCreateDocument.ts +0 -2
- package/src/localDocumentStorageService.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @fluidframework/local-driver
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.6.1.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
7
|
+
## 2.0.0-internal.6.0.0
|
|
8
|
+
|
|
9
|
+
### Major Changes
|
|
10
|
+
|
|
11
|
+
- Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
12
|
+
|
|
13
|
+
Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
|
|
14
|
+
|
|
3
15
|
## 2.0.0-internal.5.4.0
|
|
4
16
|
|
|
5
17
|
Dependency updates only.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localCreateDocument.d.ts","sourceRoot":"","sources":["../src/localCreateDocument.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAMlE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAIpE,wBAAsB,cAAc,CACnC,0BAA0B,KAAA,EAC1B,WAAW,EAAE,YAAY,EACzB,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"localCreateDocument.d.ts","sourceRoot":"","sources":["../src/localCreateDocument.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAMlE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAIpE,wBAAsB,cAAc,CACnC,0BAA0B,KAAA,EAC1B,WAAW,EAAE,YAAY,EACzB,OAAO,EAAE,YAAY,iBA4BrB"}
|
|
@@ -8,7 +8,6 @@ exports.createDocument = void 0;
|
|
|
8
8
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
9
9
|
const server_services_client_1 = require("@fluidframework/server-services-client");
|
|
10
10
|
async function createDocument(localDeltaConnectionServer, resolvedUrl, summary) {
|
|
11
|
-
var _a, _b, _c;
|
|
12
11
|
const pathName = new URL(resolvedUrl.url).pathname;
|
|
13
12
|
const pathArr = pathName.split("/");
|
|
14
13
|
const tenantId = pathArr[pathArr.length - 2];
|
|
@@ -23,10 +22,7 @@ async function createDocument(localDeltaConnectionServer, resolvedUrl, summary)
|
|
|
23
22
|
const documentAttributes = (0, driver_utils_1.getDocAttributesFromProtocolSummary)(protocolSummary);
|
|
24
23
|
const quorumValues = (0, driver_utils_1.getQuorumValuesFromProtocolSummary)(protocolSummary);
|
|
25
24
|
const sequenceNumber = documentAttributes.sequenceNumber;
|
|
26
|
-
await documentStorage.createDocument(tenantId, id, appSummary, sequenceNumber,
|
|
27
|
-
// "term" was an experimental feature that is being removed. The only safe value to use is 1.
|
|
28
|
-
1, // term
|
|
29
|
-
server_services_client_1.defaultHash, (_a = resolvedUrl.endpoints.ordererUrl) !== null && _a !== void 0 ? _a : "", (_b = resolvedUrl.endpoints.storageUrl) !== null && _b !== void 0 ? _b : "", (_c = resolvedUrl.endpoints.deltaStorageUrl) !== null && _c !== void 0 ? _c : "", quorumValues, false /* enableDiscovery */);
|
|
25
|
+
await documentStorage.createDocument(tenantId, id, appSummary, sequenceNumber, server_services_client_1.defaultHash, resolvedUrl.endpoints.ordererUrl ?? "", resolvedUrl.endpoints.storageUrl ?? "", resolvedUrl.endpoints.deltaStorageUrl ?? "", quorumValues, false /* enableDiscovery */);
|
|
30
26
|
}
|
|
31
27
|
exports.createDocument = createDocument;
|
|
32
28
|
//# sourceMappingURL=localCreateDocument.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localCreateDocument.js","sourceRoot":"","sources":["../src/localCreateDocument.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAIsC;AAGtC,mFAAqE;AAE9D,KAAK,UAAU,cAAc,CACnC,0BAA0B,EAC1B,WAAyB,EACzB,OAAqB
|
|
1
|
+
{"version":3,"file":"localCreateDocument.js","sourceRoot":"","sources":["../src/localCreateDocument.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAIsC;AAGtC,mFAAqE;AAE9D,KAAK,UAAU,cAAc,CACnC,0BAA0B,EAC1B,WAAyB,EACzB,OAAqB;IAErB,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;IACnD,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC7C,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACvC,MAAM,eAAe,GAAI,0BAAyD;SAChF,eAAe,CAAC;IAClB,IAAI,CAAC,IAAA,8CAA+B,EAAC,OAAO,CAAC,EAAE;QAC9C,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;KACzE;IACD,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,kBAAkB,GAAG,IAAA,kDAAmC,EAAC,eAAe,CAAC,CAAC;IAChF,MAAM,YAAY,GAAG,IAAA,iDAAkC,EAAC,eAAe,CAAC,CAAC;IACzE,MAAM,cAAc,GAAG,kBAAkB,CAAC,cAAc,CAAC;IACzD,MAAM,eAAe,CAAC,cAAc,CACnC,QAAQ,EACR,EAAE,EACF,UAAU,EACV,cAAc,EACd,oCAAW,EACX,WAAW,CAAC,SAAS,CAAC,UAAU,IAAI,EAAE,EACtC,WAAW,CAAC,SAAS,CAAC,UAAU,IAAI,EAAE,EACtC,WAAW,CAAC,SAAS,CAAC,eAAe,IAAI,EAAE,EAC3C,YAAY,EACZ,KAAK,CAAC,qBAAqB,CAC3B,CAAC;AACH,CAAC;AA/BD,wCA+BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IResolvedUrl } from \"@fluidframework/driver-definitions\";\nimport {\n\tgetDocAttributesFromProtocolSummary,\n\tgetQuorumValuesFromProtocolSummary,\n\tisCombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { LocalDeltaConnectionServer } from \"@fluidframework/server-local-server\";\nimport { defaultHash } from \"@fluidframework/server-services-client\";\n\nexport async function createDocument(\n\tlocalDeltaConnectionServer,\n\tresolvedUrl: IResolvedUrl,\n\tsummary: ISummaryTree,\n) {\n\tconst pathName = new URL(resolvedUrl.url).pathname;\n\tconst pathArr = pathName.split(\"/\");\n\tconst tenantId = pathArr[pathArr.length - 2];\n\tconst id = pathArr[pathArr.length - 1];\n\tconst documentStorage = (localDeltaConnectionServer as LocalDeltaConnectionServer)\n\t\t.documentStorage;\n\tif (!isCombinedAppAndProtocolSummary(summary)) {\n\t\tthrow new Error(\"Protocol and App Summary required in the full summary\");\n\t}\n\tconst protocolSummary = summary.tree[\".protocol\"];\n\tconst appSummary = summary.tree[\".app\"];\n\tconst documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary);\n\tconst quorumValues = getQuorumValuesFromProtocolSummary(protocolSummary);\n\tconst sequenceNumber = documentAttributes.sequenceNumber;\n\tawait documentStorage.createDocument(\n\t\ttenantId,\n\t\tid,\n\t\tappSummary,\n\t\tsequenceNumber,\n\t\tdefaultHash,\n\t\tresolvedUrl.endpoints.ordererUrl ?? \"\",\n\t\tresolvedUrl.endpoints.storageUrl ?? \"\",\n\t\tresolvedUrl.endpoints.deltaStorageUrl ?? \"\",\n\t\tquorumValues,\n\t\tfalse /* enableDiscovery */,\n\t);\n}\n"]}
|
|
@@ -24,7 +24,7 @@ class LocalDeltaStorageService {
|
|
|
24
24
|
query["operation.sequenceNumber"].$gt = from - 1; // from is inclusive
|
|
25
25
|
// This looks like a bug. It used to work without setting $lt key. Now it does not
|
|
26
26
|
// Need follow up
|
|
27
|
-
query["operation.sequenceNumber"].$lt = to
|
|
27
|
+
query["operation.sequenceNumber"].$lt = to ?? Number.MAX_SAFE_INTEGER;
|
|
28
28
|
const allDeltas = await this.databaseManager.getDeltaCollection(this.tenantId, this.id);
|
|
29
29
|
const dbDeltas = await allDeltas.find(query, { "operation.sequenceNumber": 1 });
|
|
30
30
|
const messages = dbDeltas.map((delta) => delta.operation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localDeltaStorageService.js","sourceRoot":"","sources":["../src/localDeltaStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,+DAAkE;AAElE;;GAEG;AACH,MAAa,wBAAwB;IACpC,YACkB,QAAgB,EAChB,EAAU,EACV,eAAiC;QAFjC,aAAQ,GAAR,QAAQ,CAAQ;QAChB,OAAE,GAAF,EAAE,CAAQ;QACV,oBAAe,GAAf,eAAe,CAAkB;IAChD,CAAC;IAEG,aAAa,CACnB,IAAY,EACZ,EAAsB,EACtB,WAAyB,EACzB,UAAoB;QAEpB,OAAO,IAAA,iCAAkB,EAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,EAAW;QAC9C,MAAM,KAAK,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC/D,KAAK,CAAC,0BAA0B,CAAC,GAAG,EAAE,CAAC;QACvC,KAAK,CAAC,0BAA0B,CAAC,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,oBAAoB;QAEtE,kFAAkF;QAClF,iBAAiB;QACjB,KAAK,CAAC,0BAA0B,CAAC,CAAC,GAAG,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"localDeltaStorageService.js","sourceRoot":"","sources":["../src/localDeltaStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,+DAAkE;AAElE;;GAEG;AACH,MAAa,wBAAwB;IACpC,YACkB,QAAgB,EAChB,EAAU,EACV,eAAiC;QAFjC,aAAQ,GAAR,QAAQ,CAAQ;QAChB,OAAE,GAAF,EAAE,CAAQ;QACV,oBAAe,GAAf,eAAe,CAAkB;IAChD,CAAC;IAEG,aAAa,CACnB,IAAY,EACZ,EAAsB,EACtB,WAAyB,EACzB,UAAoB;QAEpB,OAAO,IAAA,iCAAkB,EAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,EAAW;QAC9C,MAAM,KAAK,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC/D,KAAK,CAAC,0BAA0B,CAAC,GAAG,EAAE,CAAC;QACvC,KAAK,CAAC,0BAA0B,CAAC,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,oBAAoB;QAEtE,kFAAkF;QAClF,iBAAiB;QACjB,KAAK,CAAC,0BAA0B,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,MAAM,CAAC,gBAAgB,CAAC;QAEtE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACxF,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,0BAA0B,EAAE,CAAC,EAAE,CAAC,CAAC;QAChF,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD;AA9BD,4DA8BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentDeltaStorageService, IStream } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IDatabaseManager } from \"@fluidframework/server-services-core\";\nimport { streamFromMessages } from \"@fluidframework/driver-utils\";\n\n/**\n * Provides access to the underlying delta storage on the server for local driver.\n */\nexport class LocalDeltaStorageService implements IDocumentDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly tenantId: string,\n\t\tprivate readonly id: string,\n\t\tprivate readonly databaseManager: IDatabaseManager,\n\t) {}\n\n\tpublic fetchMessages(\n\t\tfrom: number,\n\t\tto: number | undefined,\n\t\tabortSignal?: AbortSignal,\n\t\tcachedOnly?: boolean,\n\t): IStream<ISequencedDocumentMessage[]> {\n\t\treturn streamFromMessages(this.getCore(from, to));\n\t}\n\n\tprivate async getCore(from: number, to?: number) {\n\t\tconst query = { documentId: this.id, tenantId: this.tenantId };\n\t\tquery[\"operation.sequenceNumber\"] = {};\n\t\tquery[\"operation.sequenceNumber\"].$gt = from - 1; // from is inclusive\n\n\t\t// This looks like a bug. It used to work without setting $lt key. Now it does not\n\t\t// Need follow up\n\t\tquery[\"operation.sequenceNumber\"].$lt = to ?? Number.MAX_SAFE_INTEGER;\n\n\t\tconst allDeltas = await this.databaseManager.getDeltaCollection(this.tenantId, this.id);\n\t\tconst dbDeltas = await allDeltas.find(query, { \"operation.sequenceNumber\": 1 });\n\t\tconst messages = dbDeltas.map((delta) => delta.operation);\n\t\treturn messages;\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
5
|
+
import { IDocumentStorageService, IDocumentStorageServicePolicies, IResolvedUrl, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
6
6
|
import { ICreateBlobResponse, ISnapshotTreeEx, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { GitManager } from "@fluidframework/server-services-client";
|
|
8
8
|
import { ILocalDeltaConnectionServer } from "@fluidframework/server-local-server";
|
|
@@ -15,7 +15,7 @@ export declare class LocalDocumentStorageService implements IDocumentStorageServ
|
|
|
15
15
|
protected readonly blobsShaCache: Map<string, string>;
|
|
16
16
|
private readonly summaryTreeUploadManager;
|
|
17
17
|
get repositoryUrl(): string;
|
|
18
|
-
constructor(id: string, manager: GitManager, policies: IDocumentStorageServicePolicies, localDeltaConnectionServer?: ILocalDeltaConnectionServer | undefined, resolvedUrl?:
|
|
18
|
+
constructor(id: string, manager: GitManager, policies: IDocumentStorageServicePolicies, localDeltaConnectionServer?: ILocalDeltaConnectionServer | undefined, resolvedUrl?: IResolvedUrl | undefined);
|
|
19
19
|
getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
|
|
20
20
|
getSnapshotTree(version?: IVersion): Promise<ISnapshotTreeEx | null>;
|
|
21
21
|
readBlob(blobId: string): Promise<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/localDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,uBAAuB,EACvB,+BAA+B,
|
|
1
|
+
{"version":3,"file":"localDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/localDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,uBAAuB,EACvB,+BAA+B,EAC/B,YAAY,EACZ,eAAe,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACN,UAAU,EAGV,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAIlF,qBAAa,2BAA4B,YAAW,uBAAuB;IAWzE,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,OAAO;aACR,QAAQ,EAAE,+BAA+B;IACzD,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAC;IAC5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAZ9B,SAAS,CAAC,QAAQ,CAAC,aAAa,sBAA6B;IAC7D,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAwB;IAEjE,IAAW,aAAa,IAAI,MAAM,CAEjC;gBAGiB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,UAAU,EACpB,QAAQ,EAAE,+BAA+B,EACxC,0BAA0B,CAAC,yCAA6B,EACxD,WAAW,CAAC,0BAAc;IAS/B,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAUzE,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAgBpE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAOlD,wBAAwB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;IAkBL,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO/D,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;YAI7D,uBAAuB;CAWrC"}
|
|
@@ -44,7 +44,7 @@ class LocalDocumentStorageService {
|
|
|
44
44
|
requestVersion = versions[0];
|
|
45
45
|
}
|
|
46
46
|
const rawTree = await this.manager.getTree(requestVersion.treeId);
|
|
47
|
-
const tree = (0, protocol_base_1.
|
|
47
|
+
const tree = (0, protocol_base_1.buildGitTreeHierarchy)(rawTree, this.blobsShaCache, true);
|
|
48
48
|
return tree;
|
|
49
49
|
}
|
|
50
50
|
async readBlob(blobId) {
|
|
@@ -54,7 +54,6 @@ class LocalDocumentStorageService {
|
|
|
54
54
|
return bufferContent;
|
|
55
55
|
}
|
|
56
56
|
async uploadSummaryWithContext(summary, context) {
|
|
57
|
-
var _a;
|
|
58
57
|
if (context.referenceSequenceNumber === 0) {
|
|
59
58
|
if (this.localDeltaConnectionServer === undefined || this.resolvedUrl === undefined) {
|
|
60
59
|
throw new Error("Insufficient constructor parameters. An ILocalDeltaConnectionServer and IResolvedUrl required");
|
|
@@ -63,7 +62,7 @@ class LocalDocumentStorageService {
|
|
|
63
62
|
const version = await this.getVersions(this.id, 1);
|
|
64
63
|
return version[0].id;
|
|
65
64
|
}
|
|
66
|
-
return this.summaryTreeUploadManager.writeSummaryTree(summary,
|
|
65
|
+
return this.summaryTreeUploadManager.writeSummaryTree(summary, context.ackHandle ?? "", "channel");
|
|
67
66
|
}
|
|
68
67
|
async createBlob(file) {
|
|
69
68
|
const uint8ArrayFile = new Uint8Array(file);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localDocumentStorageService.js","sourceRoot":"","sources":["../src/localDocumentStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAkF;AAclF,
|
|
1
|
+
{"version":3,"file":"localDocumentStorageService.js","sourceRoot":"","sources":["../src/localDocumentStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAkF;AAclF,iEAAsE;AACtE,mFAIgD;AAEhD,+DAAuD;AAEvD,MAAM,eAAe,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,mBAAmB;AACzD,MAAa,2BAA2B;IAUvC,YACkB,EAAU,EACV,OAAmB,EACpB,QAAyC,EACxC,0BAAwD,EACxD,WAA0B;QAJ1B,OAAE,GAAF,EAAE,CAAQ;QACV,YAAO,GAAP,OAAO,CAAY;QACpB,aAAQ,GAAR,QAAQ,CAAiC;QACxC,+BAA0B,GAA1B,0BAA0B,CAA8B;QACxD,gBAAW,GAAX,WAAW,CAAe;QAd5C,uFAAuF;QACvF,2BAA2B;QACR,kBAA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EAAC,cAAc,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;aAClE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC;IAC7D,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAAsB;QAClD,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACrC,CAAC;IAEO,KAAK,CAAC,uBAAuB,CACpC,YAAoB;QAEpB,OAAO,YAAY;YAClB,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;gBAC1D,mEAAmE;gBACnE,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;gBAC3B,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;YACzC,CAAC,CAAC;YACJ,CAAC,CAAC,SAAS,CAAC;IACd,CAAC;CACD;AApGD,kEAoGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { stringToBuffer, Uint8ArrayToString } from \"@fluidframework/common-utils\";\nimport {\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tIResolvedUrl,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTreeEx,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { buildGitTreeHierarchy } from \"@fluidframework/protocol-base\";\nimport {\n\tGitManager,\n\tISummaryUploadManager,\n\tSummaryTreeUploadManager,\n} from \"@fluidframework/server-services-client\";\nimport { ILocalDeltaConnectionServer } from \"@fluidframework/server-local-server\";\nimport { createDocument } from \"./localCreateDocument\";\n\nconst minTTLInSeconds = 24 * 60 * 60; // Same TTL as ODSP\nexport class LocalDocumentStorageService implements IDocumentStorageService {\n\t// The values of this cache is useless. We only need the keys. So we are always putting\n\t// empty strings as values.\n\tprotected readonly blobsShaCache = new Map<string, string>();\n\tprivate readonly summaryTreeUploadManager: ISummaryUploadManager;\n\n\tpublic get repositoryUrl(): string {\n\t\treturn \"\";\n\t}\n\n\tconstructor(\n\t\tprivate readonly id: string,\n\t\tprivate readonly manager: GitManager,\n\t\tpublic readonly policies: IDocumentStorageServicePolicies,\n\t\tprivate readonly localDeltaConnectionServer?: ILocalDeltaConnectionServer,\n\t\tprivate readonly resolvedUrl?: IResolvedUrl,\n\t) {\n\t\tthis.summaryTreeUploadManager = new SummaryTreeUploadManager(\n\t\t\tmanager,\n\t\t\tthis.blobsShaCache,\n\t\t\tthis.getPreviousFullSnapshot.bind(this),\n\t\t);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tconst id = versionId ? versionId : this.id;\n\t\tconst commits = await this.manager.getCommits(id, count);\n\t\treturn commits.map((commit) => ({\n\t\t\tdate: commit.commit.author.date,\n\t\t\tid: commit.sha,\n\t\t\ttreeId: commit.commit.tree.sha,\n\t\t}));\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTreeEx | null> {\n\t\tlet requestVersion = version;\n\t\tif (!requestVersion) {\n\t\t\tconst versions = await this.getVersions(this.id, 1);\n\t\t\tif (versions.length === 0) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\trequestVersion = versions[0];\n\t\t}\n\n\t\tconst rawTree = await this.manager.getTree(requestVersion.treeId);\n\t\tconst tree = buildGitTreeHierarchy(rawTree, this.blobsShaCache, true);\n\t\treturn tree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst blob = await this.manager.getBlob(blobId);\n\t\tthis.blobsShaCache.set(blob.sha, \"\");\n\t\tconst bufferContent = stringToBuffer(blob.content, blob.encoding);\n\t\treturn bufferContent;\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tif (context.referenceSequenceNumber === 0) {\n\t\t\tif (this.localDeltaConnectionServer === undefined || this.resolvedUrl === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Insufficient constructor parameters. An ILocalDeltaConnectionServer and IResolvedUrl required\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tawait createDocument(this.localDeltaConnectionServer, this.resolvedUrl, summary);\n\t\t\tconst version = await this.getVersions(this.id, 1);\n\t\t\treturn version[0].id;\n\t\t}\n\t\treturn this.summaryTreeUploadManager.writeSummaryTree(\n\t\t\tsummary,\n\t\t\tcontext.ackHandle ?? \"\",\n\t\t\t\"channel\",\n\t\t);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\tconst uint8ArrayFile = new Uint8Array(file);\n\t\treturn this.manager\n\t\t\t.createBlob(Uint8ArrayToString(uint8ArrayFile, \"base64\"), \"base64\")\n\t\t\t.then((r) => ({ id: r.sha, url: r.url, minTTLInSeconds }));\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\tthrow new Error(\"NOT IMPLEMENTED!\");\n\t}\n\n\tprivate async getPreviousFullSnapshot(\n\t\tparentHandle: string,\n\t): Promise<ISnapshotTreeEx | null | undefined> {\n\t\treturn parentHandle\n\t\t\t? this.getVersions(parentHandle, 1).then(async (versions) => {\n\t\t\t\t\t// Clear the cache as the getSnapshotTree call will fill the cache.\n\t\t\t\t\tthis.blobsShaCache.clear();\n\t\t\t\t\treturn this.getSnapshotTree(versions[0]);\n\t\t\t })\n\t\t\t: undefined;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localCreateDocument.d.ts","sourceRoot":"","sources":["../src/localCreateDocument.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAMlE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAIpE,wBAAsB,cAAc,CACnC,0BAA0B,KAAA,EAC1B,WAAW,EAAE,YAAY,EACzB,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"localCreateDocument.d.ts","sourceRoot":"","sources":["../src/localCreateDocument.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAMlE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAIpE,wBAAsB,cAAc,CACnC,0BAA0B,KAAA,EAC1B,WAAW,EAAE,YAAY,EACzB,OAAO,EAAE,YAAY,iBA4BrB"}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import { getDocAttributesFromProtocolSummary, getQuorumValuesFromProtocolSummary, isCombinedAppAndProtocolSummary, } from "@fluidframework/driver-utils";
|
|
6
6
|
import { defaultHash } from "@fluidframework/server-services-client";
|
|
7
7
|
export async function createDocument(localDeltaConnectionServer, resolvedUrl, summary) {
|
|
8
|
-
var _a, _b, _c;
|
|
9
8
|
const pathName = new URL(resolvedUrl.url).pathname;
|
|
10
9
|
const pathArr = pathName.split("/");
|
|
11
10
|
const tenantId = pathArr[pathArr.length - 2];
|
|
@@ -20,9 +19,6 @@ export async function createDocument(localDeltaConnectionServer, resolvedUrl, su
|
|
|
20
19
|
const documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary);
|
|
21
20
|
const quorumValues = getQuorumValuesFromProtocolSummary(protocolSummary);
|
|
22
21
|
const sequenceNumber = documentAttributes.sequenceNumber;
|
|
23
|
-
await documentStorage.createDocument(tenantId, id, appSummary, sequenceNumber,
|
|
24
|
-
// "term" was an experimental feature that is being removed. The only safe value to use is 1.
|
|
25
|
-
1, // term
|
|
26
|
-
defaultHash, (_a = resolvedUrl.endpoints.ordererUrl) !== null && _a !== void 0 ? _a : "", (_b = resolvedUrl.endpoints.storageUrl) !== null && _b !== void 0 ? _b : "", (_c = resolvedUrl.endpoints.deltaStorageUrl) !== null && _c !== void 0 ? _c : "", quorumValues, false /* enableDiscovery */);
|
|
22
|
+
await documentStorage.createDocument(tenantId, id, appSummary, sequenceNumber, defaultHash, resolvedUrl.endpoints.ordererUrl ?? "", resolvedUrl.endpoints.storageUrl ?? "", resolvedUrl.endpoints.deltaStorageUrl ?? "", quorumValues, false /* enableDiscovery */);
|
|
27
23
|
}
|
|
28
24
|
//# sourceMappingURL=localCreateDocument.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localCreateDocument.js","sourceRoot":"","sources":["../src/localCreateDocument.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,mCAAmC,EACnC,kCAAkC,EAClC,+BAA+B,GAC/B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE,MAAM,CAAC,KAAK,UAAU,cAAc,CACnC,0BAA0B,EAC1B,WAAyB,EACzB,OAAqB
|
|
1
|
+
{"version":3,"file":"localCreateDocument.js","sourceRoot":"","sources":["../src/localCreateDocument.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,mCAAmC,EACnC,kCAAkC,EAClC,+BAA+B,GAC/B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE,MAAM,CAAC,KAAK,UAAU,cAAc,CACnC,0BAA0B,EAC1B,WAAyB,EACzB,OAAqB;IAErB,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;IACnD,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC7C,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACvC,MAAM,eAAe,GAAI,0BAAyD;SAChF,eAAe,CAAC;IAClB,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAAC,EAAE;QAC9C,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;KACzE;IACD,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,kBAAkB,GAAG,mCAAmC,CAAC,eAAe,CAAC,CAAC;IAChF,MAAM,YAAY,GAAG,kCAAkC,CAAC,eAAe,CAAC,CAAC;IACzE,MAAM,cAAc,GAAG,kBAAkB,CAAC,cAAc,CAAC;IACzD,MAAM,eAAe,CAAC,cAAc,CACnC,QAAQ,EACR,EAAE,EACF,UAAU,EACV,cAAc,EACd,WAAW,EACX,WAAW,CAAC,SAAS,CAAC,UAAU,IAAI,EAAE,EACtC,WAAW,CAAC,SAAS,CAAC,UAAU,IAAI,EAAE,EACtC,WAAW,CAAC,SAAS,CAAC,eAAe,IAAI,EAAE,EAC3C,YAAY,EACZ,KAAK,CAAC,qBAAqB,CAC3B,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IResolvedUrl } from \"@fluidframework/driver-definitions\";\nimport {\n\tgetDocAttributesFromProtocolSummary,\n\tgetQuorumValuesFromProtocolSummary,\n\tisCombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { LocalDeltaConnectionServer } from \"@fluidframework/server-local-server\";\nimport { defaultHash } from \"@fluidframework/server-services-client\";\n\nexport async function createDocument(\n\tlocalDeltaConnectionServer,\n\tresolvedUrl: IResolvedUrl,\n\tsummary: ISummaryTree,\n) {\n\tconst pathName = new URL(resolvedUrl.url).pathname;\n\tconst pathArr = pathName.split(\"/\");\n\tconst tenantId = pathArr[pathArr.length - 2];\n\tconst id = pathArr[pathArr.length - 1];\n\tconst documentStorage = (localDeltaConnectionServer as LocalDeltaConnectionServer)\n\t\t.documentStorage;\n\tif (!isCombinedAppAndProtocolSummary(summary)) {\n\t\tthrow new Error(\"Protocol and App Summary required in the full summary\");\n\t}\n\tconst protocolSummary = summary.tree[\".protocol\"];\n\tconst appSummary = summary.tree[\".app\"];\n\tconst documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary);\n\tconst quorumValues = getQuorumValuesFromProtocolSummary(protocolSummary);\n\tconst sequenceNumber = documentAttributes.sequenceNumber;\n\tawait documentStorage.createDocument(\n\t\ttenantId,\n\t\tid,\n\t\tappSummary,\n\t\tsequenceNumber,\n\t\tdefaultHash,\n\t\tresolvedUrl.endpoints.ordererUrl ?? \"\",\n\t\tresolvedUrl.endpoints.storageUrl ?? \"\",\n\t\tresolvedUrl.endpoints.deltaStorageUrl ?? \"\",\n\t\tquorumValues,\n\t\tfalse /* enableDiscovery */,\n\t);\n}\n"]}
|
|
@@ -21,7 +21,7 @@ export class LocalDeltaStorageService {
|
|
|
21
21
|
query["operation.sequenceNumber"].$gt = from - 1; // from is inclusive
|
|
22
22
|
// This looks like a bug. It used to work without setting $lt key. Now it does not
|
|
23
23
|
// Need follow up
|
|
24
|
-
query["operation.sequenceNumber"].$lt = to
|
|
24
|
+
query["operation.sequenceNumber"].$lt = to ?? Number.MAX_SAFE_INTEGER;
|
|
25
25
|
const allDeltas = await this.databaseManager.getDeltaCollection(this.tenantId, this.id);
|
|
26
26
|
const dbDeltas = await allDeltas.find(query, { "operation.sequenceNumber": 1 });
|
|
27
27
|
const messages = dbDeltas.map((delta) => delta.operation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localDeltaStorageService.js","sourceRoot":"","sources":["../src/localDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC,YACkB,QAAgB,EAChB,EAAU,EACV,eAAiC;QAFjC,aAAQ,GAAR,QAAQ,CAAQ;QAChB,OAAE,GAAF,EAAE,CAAQ;QACV,oBAAe,GAAf,eAAe,CAAkB;IAChD,CAAC;IAEG,aAAa,CACnB,IAAY,EACZ,EAAsB,EACtB,WAAyB,EACzB,UAAoB;QAEpB,OAAO,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,EAAW;QAC9C,MAAM,KAAK,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC/D,KAAK,CAAC,0BAA0B,CAAC,GAAG,EAAE,CAAC;QACvC,KAAK,CAAC,0BAA0B,CAAC,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,oBAAoB;QAEtE,kFAAkF;QAClF,iBAAiB;QACjB,KAAK,CAAC,0BAA0B,CAAC,CAAC,GAAG,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"localDeltaStorageService.js","sourceRoot":"","sources":["../src/localDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC,YACkB,QAAgB,EAChB,EAAU,EACV,eAAiC;QAFjC,aAAQ,GAAR,QAAQ,CAAQ;QAChB,OAAE,GAAF,EAAE,CAAQ;QACV,oBAAe,GAAf,eAAe,CAAkB;IAChD,CAAC;IAEG,aAAa,CACnB,IAAY,EACZ,EAAsB,EACtB,WAAyB,EACzB,UAAoB;QAEpB,OAAO,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,EAAW;QAC9C,MAAM,KAAK,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC/D,KAAK,CAAC,0BAA0B,CAAC,GAAG,EAAE,CAAC;QACvC,KAAK,CAAC,0BAA0B,CAAC,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,oBAAoB;QAEtE,kFAAkF;QAClF,iBAAiB;QACjB,KAAK,CAAC,0BAA0B,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,MAAM,CAAC,gBAAgB,CAAC;QAEtE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACxF,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,0BAA0B,EAAE,CAAC,EAAE,CAAC,CAAC;QAChF,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentDeltaStorageService, IStream } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IDatabaseManager } from \"@fluidframework/server-services-core\";\nimport { streamFromMessages } from \"@fluidframework/driver-utils\";\n\n/**\n * Provides access to the underlying delta storage on the server for local driver.\n */\nexport class LocalDeltaStorageService implements IDocumentDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly tenantId: string,\n\t\tprivate readonly id: string,\n\t\tprivate readonly databaseManager: IDatabaseManager,\n\t) {}\n\n\tpublic fetchMessages(\n\t\tfrom: number,\n\t\tto: number | undefined,\n\t\tabortSignal?: AbortSignal,\n\t\tcachedOnly?: boolean,\n\t): IStream<ISequencedDocumentMessage[]> {\n\t\treturn streamFromMessages(this.getCore(from, to));\n\t}\n\n\tprivate async getCore(from: number, to?: number) {\n\t\tconst query = { documentId: this.id, tenantId: this.tenantId };\n\t\tquery[\"operation.sequenceNumber\"] = {};\n\t\tquery[\"operation.sequenceNumber\"].$gt = from - 1; // from is inclusive\n\n\t\t// This looks like a bug. It used to work without setting $lt key. Now it does not\n\t\t// Need follow up\n\t\tquery[\"operation.sequenceNumber\"].$lt = to ?? Number.MAX_SAFE_INTEGER;\n\n\t\tconst allDeltas = await this.databaseManager.getDeltaCollection(this.tenantId, this.id);\n\t\tconst dbDeltas = await allDeltas.find(query, { \"operation.sequenceNumber\": 1 });\n\t\tconst messages = dbDeltas.map((delta) => delta.operation);\n\t\treturn messages;\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
5
|
+
import { IDocumentStorageService, IDocumentStorageServicePolicies, IResolvedUrl, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
6
6
|
import { ICreateBlobResponse, ISnapshotTreeEx, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { GitManager } from "@fluidframework/server-services-client";
|
|
8
8
|
import { ILocalDeltaConnectionServer } from "@fluidframework/server-local-server";
|
|
@@ -15,7 +15,7 @@ export declare class LocalDocumentStorageService implements IDocumentStorageServ
|
|
|
15
15
|
protected readonly blobsShaCache: Map<string, string>;
|
|
16
16
|
private readonly summaryTreeUploadManager;
|
|
17
17
|
get repositoryUrl(): string;
|
|
18
|
-
constructor(id: string, manager: GitManager, policies: IDocumentStorageServicePolicies, localDeltaConnectionServer?: ILocalDeltaConnectionServer | undefined, resolvedUrl?:
|
|
18
|
+
constructor(id: string, manager: GitManager, policies: IDocumentStorageServicePolicies, localDeltaConnectionServer?: ILocalDeltaConnectionServer | undefined, resolvedUrl?: IResolvedUrl | undefined);
|
|
19
19
|
getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
|
|
20
20
|
getSnapshotTree(version?: IVersion): Promise<ISnapshotTreeEx | null>;
|
|
21
21
|
readBlob(blobId: string): Promise<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/localDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,uBAAuB,EACvB,+BAA+B,
|
|
1
|
+
{"version":3,"file":"localDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/localDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,uBAAuB,EACvB,+BAA+B,EAC/B,YAAY,EACZ,eAAe,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACN,UAAU,EAGV,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAIlF,qBAAa,2BAA4B,YAAW,uBAAuB;IAWzE,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,OAAO;aACR,QAAQ,EAAE,+BAA+B;IACzD,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAC;IAC5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAZ9B,SAAS,CAAC,QAAQ,CAAC,aAAa,sBAA6B;IAC7D,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAwB;IAEjE,IAAW,aAAa,IAAI,MAAM,CAEjC;gBAGiB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,UAAU,EACpB,QAAQ,EAAE,+BAA+B,EACxC,0BAA0B,CAAC,yCAA6B,EACxD,WAAW,CAAC,0BAAc;IAS/B,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAUzE,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAgBpE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAOlD,wBAAwB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;IAkBL,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO/D,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;YAI7D,uBAAuB;CAWrC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { stringToBuffer, Uint8ArrayToString } from "@fluidframework/common-utils";
|
|
6
|
-
import {
|
|
6
|
+
import { buildGitTreeHierarchy } from "@fluidframework/protocol-base";
|
|
7
7
|
import { SummaryTreeUploadManager, } from "@fluidframework/server-services-client";
|
|
8
8
|
import { createDocument } from "./localCreateDocument";
|
|
9
9
|
const minTTLInSeconds = 24 * 60 * 60; // Same TTL as ODSP
|
|
@@ -41,7 +41,7 @@ export class LocalDocumentStorageService {
|
|
|
41
41
|
requestVersion = versions[0];
|
|
42
42
|
}
|
|
43
43
|
const rawTree = await this.manager.getTree(requestVersion.treeId);
|
|
44
|
-
const tree =
|
|
44
|
+
const tree = buildGitTreeHierarchy(rawTree, this.blobsShaCache, true);
|
|
45
45
|
return tree;
|
|
46
46
|
}
|
|
47
47
|
async readBlob(blobId) {
|
|
@@ -51,7 +51,6 @@ export class LocalDocumentStorageService {
|
|
|
51
51
|
return bufferContent;
|
|
52
52
|
}
|
|
53
53
|
async uploadSummaryWithContext(summary, context) {
|
|
54
|
-
var _a;
|
|
55
54
|
if (context.referenceSequenceNumber === 0) {
|
|
56
55
|
if (this.localDeltaConnectionServer === undefined || this.resolvedUrl === undefined) {
|
|
57
56
|
throw new Error("Insufficient constructor parameters. An ILocalDeltaConnectionServer and IResolvedUrl required");
|
|
@@ -60,7 +59,7 @@ export class LocalDocumentStorageService {
|
|
|
60
59
|
const version = await this.getVersions(this.id, 1);
|
|
61
60
|
return version[0].id;
|
|
62
61
|
}
|
|
63
|
-
return this.summaryTreeUploadManager.writeSummaryTree(summary,
|
|
62
|
+
return this.summaryTreeUploadManager.writeSummaryTree(summary, context.ackHandle ?? "", "channel");
|
|
64
63
|
}
|
|
65
64
|
async createBlob(file) {
|
|
66
65
|
const uint8ArrayFile = new Uint8Array(file);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localDocumentStorageService.js","sourceRoot":"","sources":["../src/localDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAclF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"localDocumentStorageService.js","sourceRoot":"","sources":["../src/localDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAclF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAA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.\n */\n\nimport { stringToBuffer, Uint8ArrayToString } from \"@fluidframework/common-utils\";\nimport {\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tIResolvedUrl,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTreeEx,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { buildGitTreeHierarchy } from \"@fluidframework/protocol-base\";\nimport {\n\tGitManager,\n\tISummaryUploadManager,\n\tSummaryTreeUploadManager,\n} from \"@fluidframework/server-services-client\";\nimport { ILocalDeltaConnectionServer } from \"@fluidframework/server-local-server\";\nimport { createDocument } from \"./localCreateDocument\";\n\nconst minTTLInSeconds = 24 * 60 * 60; // Same TTL as ODSP\nexport class LocalDocumentStorageService implements IDocumentStorageService {\n\t// The values of this cache is useless. We only need the keys. So we are always putting\n\t// empty strings as values.\n\tprotected readonly blobsShaCache = new Map<string, string>();\n\tprivate readonly summaryTreeUploadManager: ISummaryUploadManager;\n\n\tpublic get repositoryUrl(): string {\n\t\treturn \"\";\n\t}\n\n\tconstructor(\n\t\tprivate readonly id: string,\n\t\tprivate readonly manager: GitManager,\n\t\tpublic readonly policies: IDocumentStorageServicePolicies,\n\t\tprivate readonly localDeltaConnectionServer?: ILocalDeltaConnectionServer,\n\t\tprivate readonly resolvedUrl?: IResolvedUrl,\n\t) {\n\t\tthis.summaryTreeUploadManager = new SummaryTreeUploadManager(\n\t\t\tmanager,\n\t\t\tthis.blobsShaCache,\n\t\t\tthis.getPreviousFullSnapshot.bind(this),\n\t\t);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tconst id = versionId ? versionId : this.id;\n\t\tconst commits = await this.manager.getCommits(id, count);\n\t\treturn commits.map((commit) => ({\n\t\t\tdate: commit.commit.author.date,\n\t\t\tid: commit.sha,\n\t\t\ttreeId: commit.commit.tree.sha,\n\t\t}));\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTreeEx | null> {\n\t\tlet requestVersion = version;\n\t\tif (!requestVersion) {\n\t\t\tconst versions = await this.getVersions(this.id, 1);\n\t\t\tif (versions.length === 0) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\trequestVersion = versions[0];\n\t\t}\n\n\t\tconst rawTree = await this.manager.getTree(requestVersion.treeId);\n\t\tconst tree = buildGitTreeHierarchy(rawTree, this.blobsShaCache, true);\n\t\treturn tree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst blob = await this.manager.getBlob(blobId);\n\t\tthis.blobsShaCache.set(blob.sha, \"\");\n\t\tconst bufferContent = stringToBuffer(blob.content, blob.encoding);\n\t\treturn bufferContent;\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tif (context.referenceSequenceNumber === 0) {\n\t\t\tif (this.localDeltaConnectionServer === undefined || this.resolvedUrl === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Insufficient constructor parameters. An ILocalDeltaConnectionServer and IResolvedUrl required\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tawait createDocument(this.localDeltaConnectionServer, this.resolvedUrl, summary);\n\t\t\tconst version = await this.getVersions(this.id, 1);\n\t\t\treturn version[0].id;\n\t\t}\n\t\treturn this.summaryTreeUploadManager.writeSummaryTree(\n\t\t\tsummary,\n\t\t\tcontext.ackHandle ?? \"\",\n\t\t\t\"channel\",\n\t\t);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\tconst uint8ArrayFile = new Uint8Array(file);\n\t\treturn this.manager\n\t\t\t.createBlob(Uint8ArrayToString(uint8ArrayFile, \"base64\"), \"base64\")\n\t\t\t.then((r) => ({ id: r.sha, url: r.url, minTTLInSeconds }));\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\tthrow new Error(\"NOT IMPLEMENTED!\");\n\t}\n\n\tprivate async getPreviousFullSnapshot(\n\t\tparentHandle: string,\n\t): Promise<ISnapshotTreeEx | null | undefined> {\n\t\treturn parentHandle\n\t\t\t? this.getVersions(parentHandle, 1).then(async (versions) => {\n\t\t\t\t\t// Clear the cache as the getSnapshotTree call will fill the cache.\n\t\t\t\t\tthis.blobsShaCache.clear();\n\t\t\t\t\treturn this.getSnapshotTree(versions[0]);\n\t\t\t })\n\t\t\t: undefined;\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/local-driver",
|
|
3
|
-
"version": "2.0.0-internal.
|
|
3
|
+
"version": "2.0.0-internal.6.1.0",
|
|
4
4
|
"description": "Fluid local driver",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -38,30 +38,30 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@fluidframework/common-utils": "^1.1.1",
|
|
41
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.
|
|
42
|
-
"@fluidframework/driver-base": ">=2.0.0-internal.
|
|
43
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.
|
|
44
|
-
"@fluidframework/driver-utils": ">=2.0.0-internal.
|
|
45
|
-
"@fluidframework/protocol-base": "^0.
|
|
41
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
|
|
42
|
+
"@fluidframework/driver-base": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
|
|
43
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
|
|
44
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
|
|
45
|
+
"@fluidframework/protocol-base": "^1.0.0",
|
|
46
46
|
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
47
|
-
"@fluidframework/routerlicious-driver": ">=2.0.0-internal.
|
|
48
|
-
"@fluidframework/server-local-server": "^0.
|
|
49
|
-
"@fluidframework/server-services-client": "^0.
|
|
50
|
-
"@fluidframework/server-services-core": "^0.
|
|
51
|
-
"@fluidframework/server-test-utils": "^0.
|
|
52
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.
|
|
47
|
+
"@fluidframework/routerlicious-driver": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
|
|
48
|
+
"@fluidframework/server-local-server": "^1.0.0",
|
|
49
|
+
"@fluidframework/server-services-client": "^1.0.0",
|
|
50
|
+
"@fluidframework/server-services-core": "^1.0.0",
|
|
51
|
+
"@fluidframework/server-test-utils": "^1.0.0",
|
|
52
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
|
|
53
53
|
"events": "^3.1.0",
|
|
54
54
|
"jsrsasign": "^10.5.25",
|
|
55
55
|
"url": "^0.11.0",
|
|
56
56
|
"uuid": "^8.3.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@fluid-tools/build-cli": "^0.
|
|
60
|
-
"@fluidframework/build-common": "^
|
|
61
|
-
"@fluidframework/build-tools": "^0.
|
|
59
|
+
"@fluid-tools/build-cli": "^0.22.0",
|
|
60
|
+
"@fluidframework/build-common": "^2.0.0",
|
|
61
|
+
"@fluidframework/build-tools": "^0.22.0",
|
|
62
62
|
"@fluidframework/eslint-config-fluid": "^2.0.0",
|
|
63
|
-
"@fluidframework/local-driver-previous": "npm:@fluidframework/local-driver@2.0.0-internal.
|
|
64
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.
|
|
63
|
+
"@fluidframework/local-driver-previous": "npm:@fluidframework/local-driver@2.0.0-internal.6.0.0",
|
|
64
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.6.1.0 <2.0.0-internal.6.2.0",
|
|
65
65
|
"@microsoft/api-extractor": "^7.34.4",
|
|
66
66
|
"@types/jsrsasign": "^8.0.8",
|
|
67
67
|
"@types/mocha": "^9.1.1",
|
|
@@ -37,8 +37,6 @@ export async function createDocument(
|
|
|
37
37
|
id,
|
|
38
38
|
appSummary,
|
|
39
39
|
sequenceNumber,
|
|
40
|
-
// "term" was an experimental feature that is being removed. The only safe value to use is 1.
|
|
41
|
-
1, // term
|
|
42
40
|
defaultHash,
|
|
43
41
|
resolvedUrl.endpoints.ordererUrl ?? "",
|
|
44
42
|
resolvedUrl.endpoints.storageUrl ?? "",
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
ISummaryTree,
|
|
18
18
|
IVersion,
|
|
19
19
|
} from "@fluidframework/protocol-definitions";
|
|
20
|
-
import {
|
|
20
|
+
import { buildGitTreeHierarchy } from "@fluidframework/protocol-base";
|
|
21
21
|
import {
|
|
22
22
|
GitManager,
|
|
23
23
|
ISummaryUploadManager,
|
|
@@ -73,7 +73,7 @@ export class LocalDocumentStorageService implements IDocumentStorageService {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
const rawTree = await this.manager.getTree(requestVersion.treeId);
|
|
76
|
-
const tree =
|
|
76
|
+
const tree = buildGitTreeHierarchy(rawTree, this.blobsShaCache, true);
|
|
77
77
|
return tree;
|
|
78
78
|
}
|
|
79
79
|
|