@fluidframework/local-driver 2.0.0-rc.1.0.3 → 2.0.0-rc.2.0.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/{.eslintrc.js → .eslintrc.cjs} +5 -5
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +20 -0
- package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
- package/api-extractor-lint.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/local-driver.api.md +7 -3
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/local-driver-alpha.d.ts +4 -2
- package/dist/local-driver-beta.d.ts +10 -0
- package/dist/local-driver-public.d.ts +10 -0
- package/dist/local-driver-untrimmed.d.ts +31 -4
- package/dist/localDocumentService.d.ts +4 -3
- package/dist/localDocumentService.d.ts.map +1 -1
- package/dist/localDocumentService.js +10 -8
- package/dist/localDocumentService.js.map +1 -1
- package/dist/localDocumentServiceFactory.d.ts +0 -1
- package/dist/localDocumentServiceFactory.d.ts.map +1 -1
- package/dist/localDocumentServiceFactory.js +6 -8
- package/dist/localDocumentServiceFactory.js.map +1 -1
- package/dist/localDocumentStorageService.d.ts +27 -2
- package/dist/localDocumentStorageService.d.ts.map +1 -1
- package/dist/localDocumentStorageService.js +130 -3
- package/dist/localDocumentStorageService.js.map +1 -1
- package/dist/localResolver.d.ts +0 -1
- package/dist/localResolver.d.ts.map +1 -1
- package/dist/localResolver.js +4 -6
- package/dist/localResolver.js.map +1 -1
- package/dist/localSessionStorageDb.js +2 -2
- package/dist/localSessionStorageDb.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/{auth.d.mts → auth.d.ts} +1 -1
- package/lib/auth.d.ts.map +1 -0
- package/lib/{auth.mjs → auth.js} +1 -1
- package/lib/auth.js.map +1 -0
- package/lib/{index.mjs → index.d.ts} +8 -8
- package/lib/index.d.ts.map +1 -0
- package/lib/{index.d.mts → index.js} +8 -8
- package/lib/index.js.map +1 -0
- package/lib/{local-driver-alpha.d.mts → local-driver-alpha.d.ts} +4 -2
- package/lib/{local-driver-beta.d.mts → local-driver-beta.d.ts} +10 -0
- package/lib/{local-driver-public.d.mts → local-driver-public.d.ts} +10 -0
- package/lib/{local-driver-untrimmed.d.mts → local-driver-untrimmed.d.ts} +31 -4
- package/lib/{localCreateDocument.d.mts → localCreateDocument.d.ts} +1 -1
- package/lib/localCreateDocument.d.ts.map +1 -0
- package/lib/{localCreateDocument.mjs → localCreateDocument.js} +1 -1
- package/lib/localCreateDocument.js.map +1 -0
- package/lib/{localDeltaStorageService.d.mts → localDeltaStorageService.d.ts} +1 -1
- package/lib/localDeltaStorageService.d.ts.map +1 -0
- package/lib/{localDeltaStorageService.mjs → localDeltaStorageService.js} +1 -1
- package/lib/localDeltaStorageService.js.map +1 -0
- package/lib/{localDocumentDeltaConnection.d.mts → localDocumentDeltaConnection.d.ts} +1 -1
- package/lib/localDocumentDeltaConnection.d.ts.map +1 -0
- package/lib/{localDocumentDeltaConnection.mjs → localDocumentDeltaConnection.js} +1 -1
- package/lib/localDocumentDeltaConnection.js.map +1 -0
- package/lib/{localDocumentService.d.mts → localDocumentService.d.ts} +5 -4
- package/lib/localDocumentService.d.ts.map +1 -0
- package/lib/{localDocumentService.mjs → localDocumentService.js} +8 -6
- package/lib/localDocumentService.js.map +1 -0
- package/lib/{localDocumentServiceFactory.d.mts → localDocumentServiceFactory.d.ts} +1 -2
- package/lib/localDocumentServiceFactory.d.ts.map +1 -0
- package/lib/{localDocumentServiceFactory.mjs → localDocumentServiceFactory.js} +5 -7
- package/lib/localDocumentServiceFactory.js.map +1 -0
- package/lib/{localDocumentStorageService.d.mts → localDocumentStorageService.d.ts} +28 -3
- package/lib/localDocumentStorageService.d.ts.map +1 -0
- package/lib/localDocumentStorageService.js +211 -0
- package/lib/localDocumentStorageService.js.map +1 -0
- package/lib/{localResolver.d.mts → localResolver.d.ts} +1 -2
- package/lib/localResolver.d.ts.map +1 -0
- package/lib/{localResolver.mjs → localResolver.js} +4 -6
- package/lib/localResolver.js.map +1 -0
- package/lib/{localSessionStorageDb.d.mts → localSessionStorageDb.d.ts} +1 -1
- package/lib/localSessionStorageDb.d.ts.map +1 -0
- package/lib/{localSessionStorageDb.mjs → localSessionStorageDb.js} +6 -2
- package/lib/localSessionStorageDb.js.map +1 -0
- package/lib/test/localResolverTest.spec.js +47 -0
- package/lib/test/localResolverTest.spec.js.map +1 -0
- package/lib/test/types/validateLocalDriverPrevious.generated.js +26 -0
- package/lib/test/types/validateLocalDriverPrevious.generated.js.map +1 -0
- package/package.json +56 -57
- package/src/index.ts +7 -7
- package/src/localDocumentService.ts +13 -6
- package/src/localDocumentServiceFactory.ts +5 -7
- package/src/localDocumentStorageService.ts +180 -4
- package/src/localResolver.ts +3 -5
- package/src/localSessionStorageDb.ts +1 -1
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/lib/auth.d.mts.map +0 -1
- package/lib/auth.mjs.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs.map +0 -1
- package/lib/localCreateDocument.d.mts.map +0 -1
- package/lib/localCreateDocument.mjs.map +0 -1
- package/lib/localDeltaStorageService.d.mts.map +0 -1
- package/lib/localDeltaStorageService.mjs.map +0 -1
- package/lib/localDocumentDeltaConnection.d.mts.map +0 -1
- package/lib/localDocumentDeltaConnection.mjs.map +0 -1
- package/lib/localDocumentService.d.mts.map +0 -1
- package/lib/localDocumentService.mjs.map +0 -1
- package/lib/localDocumentServiceFactory.d.mts.map +0 -1
- package/lib/localDocumentServiceFactory.mjs.map +0 -1
- package/lib/localDocumentStorageService.d.mts.map +0 -1
- package/lib/localDocumentStorageService.mjs +0 -84
- package/lib/localDocumentStorageService.mjs.map +0 -1
- package/lib/localResolver.d.mts.map +0 -1
- package/lib/localResolver.mjs.map +0 -1
- package/lib/localSessionStorageDb.d.mts.map +0 -1
- package/lib/localSessionStorageDb.mjs.map +0 -1
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { bufferToString, IsoBuffer, stringToBuffer, Uint8ArrayToString, } from "@fluid-internal/client-utils";
|
|
6
|
+
import { buildGitTreeHierarchy } from "@fluidframework/protocol-base";
|
|
7
|
+
import { SummaryTreeUploadManager, } from "@fluidframework/server-services-client";
|
|
8
|
+
import { assert } from "@fluidframework/core-utils";
|
|
9
|
+
import { createDocument } from "./localCreateDocument.js";
|
|
10
|
+
const minTTLInSeconds = 24 * 60 * 60; // Same TTL as ODSP
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export class LocalDocumentStorageService {
|
|
15
|
+
constructor(id, manager, policies, localDeltaConnectionServer, resolvedUrl) {
|
|
16
|
+
this.id = id;
|
|
17
|
+
this.manager = manager;
|
|
18
|
+
this.policies = policies;
|
|
19
|
+
this.localDeltaConnectionServer = localDeltaConnectionServer;
|
|
20
|
+
this.resolvedUrl = resolvedUrl;
|
|
21
|
+
// The values of this cache is useless. We only need the keys. So we are always putting
|
|
22
|
+
// empty strings as values.
|
|
23
|
+
this.blobsShaCache = new Map();
|
|
24
|
+
this.summaryTreeUploadManager = new SummaryTreeUploadManager(manager, this.blobsShaCache, this.getPreviousFullSnapshot.bind(this));
|
|
25
|
+
}
|
|
26
|
+
async getVersions(versionId, count) {
|
|
27
|
+
const id = versionId ? versionId : this.id;
|
|
28
|
+
const commits = await this.manager.getCommits(id, count);
|
|
29
|
+
return commits.map((commit) => ({
|
|
30
|
+
date: commit.commit.author.date,
|
|
31
|
+
id: commit.sha,
|
|
32
|
+
treeId: commit.commit.tree.sha,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
async getSnapshotTree(version) {
|
|
36
|
+
let requestVersion = version;
|
|
37
|
+
if (!requestVersion) {
|
|
38
|
+
const versions = await this.getVersions(this.id, 1);
|
|
39
|
+
if (versions.length === 0) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
requestVersion = versions[0];
|
|
43
|
+
}
|
|
44
|
+
const rawTree = await this.manager.getTree(requestVersion.treeId);
|
|
45
|
+
const tree = buildGitTreeHierarchy(rawTree, this.blobsShaCache, true);
|
|
46
|
+
await this.populateGroupId(tree);
|
|
47
|
+
return tree;
|
|
48
|
+
}
|
|
49
|
+
async getSnapshot(snapshotFetchOptions) {
|
|
50
|
+
let versionId = snapshotFetchOptions?.versionId;
|
|
51
|
+
if (!versionId) {
|
|
52
|
+
const versions = await this.getVersions(this.id, 1);
|
|
53
|
+
if (versions.length === 0) {
|
|
54
|
+
throw new Error("No versions for the document!");
|
|
55
|
+
}
|
|
56
|
+
versionId = versions[0].treeId;
|
|
57
|
+
}
|
|
58
|
+
const rawTree = await this.manager.getTree(versionId);
|
|
59
|
+
const snapshotTree = buildGitTreeHierarchy(rawTree, this.blobsShaCache, true);
|
|
60
|
+
if (snapshotFetchOptions?.loadingGroupIds !== undefined) {
|
|
61
|
+
const groupIds = new Set(snapshotFetchOptions.loadingGroupIds);
|
|
62
|
+
const hasFoundTree = await this.filterTreeByLoadingGroupIds(snapshotTree, groupIds, false);
|
|
63
|
+
assert(hasFoundTree, 0x8dd /* No tree found for the given groupIds */);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
await this.stripTreeOfLoadingGroupIds(snapshotTree);
|
|
67
|
+
}
|
|
68
|
+
const blobContents = new Map();
|
|
69
|
+
await this.populateBlobContents(snapshotTree, blobContents);
|
|
70
|
+
const metadataString = IsoBuffer.from(blobContents.get(".metadata")).toString("utf-8");
|
|
71
|
+
const metadata = JSON.parse(metadataString);
|
|
72
|
+
const sequenceNumber = metadata.message?.sequenceNumber ?? 0;
|
|
73
|
+
return {
|
|
74
|
+
snapshotTree,
|
|
75
|
+
blobContents,
|
|
76
|
+
ops: [],
|
|
77
|
+
snapshotFormatV: 1,
|
|
78
|
+
sequenceNumber,
|
|
79
|
+
latestSequenceNumber: undefined,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Strips the tree or any subtree of data if it has a groupId.
|
|
84
|
+
*
|
|
85
|
+
* @param tree - The tree to strip of loading groupIds
|
|
86
|
+
* @returns a tree that has trees with groupIds that are empty
|
|
87
|
+
*/
|
|
88
|
+
async stripTreeOfLoadingGroupIds(tree) {
|
|
89
|
+
const groupId = await this.readGroupId(tree);
|
|
90
|
+
if (groupId !== undefined) {
|
|
91
|
+
// strip
|
|
92
|
+
this.stripTree(tree, groupId);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
await Promise.all(Object.values(tree.trees).map(async (childTree) => {
|
|
96
|
+
await this.stripTreeOfLoadingGroupIds(childTree);
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Named differently as the algorithm is a little more involved.
|
|
101
|
+
*
|
|
102
|
+
* We want to strip the tree if it has a groupId that is not in the loadingGroupIds or if it doesn't have a descendent or ancestor
|
|
103
|
+
* that has a groupId that is in the loadingGroupIds.
|
|
104
|
+
*
|
|
105
|
+
* We keep the tree in the opposite case.
|
|
106
|
+
*
|
|
107
|
+
* @param tree - the tree to strip of any data that is not in the loadingGroupIds
|
|
108
|
+
* @param loadingGroupIds - the set of groupIds that are being loaded
|
|
109
|
+
* @param ancestorGroupIdInLoadingGroup - whether the ancestor of the tree has a groupId that is in the loadingGroupIds
|
|
110
|
+
* @returns whether or not it or descendant has a groupId that is in the loadingGroupIds
|
|
111
|
+
*/
|
|
112
|
+
async filterTreeByLoadingGroupIds(tree, loadingGroupIds, ancestorGroupIdInLoadingGroup) {
|
|
113
|
+
assert(loadingGroupIds.size > 0, 0x8de /* loadingGroupIds should not be empty */);
|
|
114
|
+
const groupId = await this.readGroupId(tree);
|
|
115
|
+
// Strip the tree if it has a groupId and it is not in the loadingGroupIds
|
|
116
|
+
// This is an optimization here as we have other reasons to keep the tree.
|
|
117
|
+
const noGroupIdInLoadingGroupIds = groupId !== undefined && !loadingGroupIds.has(groupId);
|
|
118
|
+
if (noGroupIdInLoadingGroupIds) {
|
|
119
|
+
this.stripTree(tree, groupId);
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
// Keep tree if it has a groupId and it is in the loadingGroupIds
|
|
123
|
+
const groupIdInLoadingGroupIds = groupId !== undefined && loadingGroupIds.has(groupId);
|
|
124
|
+
// Keep tree if it has an ancestor that has a groupId that is in loadingGroupIds and it doesn't have groupId
|
|
125
|
+
const isChildOfAncestorWithGroupId = ancestorGroupIdInLoadingGroup && groupId === undefined;
|
|
126
|
+
// Keep tree if it has a child that has a groupId that is in loadingGroupIds
|
|
127
|
+
const descendants = await Promise.all(Object.values(tree.trees).map(async (childTree) => {
|
|
128
|
+
return this.filterTreeByLoadingGroupIds(childTree, loadingGroupIds, ancestorGroupIdInLoadingGroup || groupIdInLoadingGroupIds);
|
|
129
|
+
}));
|
|
130
|
+
const isAncestorOfDescendantsWithGroupId = descendants.some((keep) => keep);
|
|
131
|
+
// We don't want to return prematurely as we still may have children that we want to keep.
|
|
132
|
+
if (groupIdInLoadingGroupIds ||
|
|
133
|
+
isChildOfAncestorWithGroupId ||
|
|
134
|
+
isAncestorOfDescendantsWithGroupId) {
|
|
135
|
+
// Keep this tree node
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
// This means we have no groupId and none of our ancestors or descendants have a groupId in the loadingGroupIds
|
|
139
|
+
this.stripTree(tree, groupId);
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
// Takes all the blobs of a tree and puts it into the blobContents
|
|
143
|
+
async populateBlobContents(tree, blobContents) {
|
|
144
|
+
await Promise.all(Object.entries(tree.blobs).map(async ([path, blobId]) => {
|
|
145
|
+
const content = await this.readBlob(blobId);
|
|
146
|
+
blobContents.set(path, content);
|
|
147
|
+
}));
|
|
148
|
+
await Promise.all(Object.values(tree.trees).map(async (childTree) => {
|
|
149
|
+
await this.populateBlobContents(childTree, blobContents);
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
async populateGroupId(tree) {
|
|
153
|
+
await this.readGroupId(tree);
|
|
154
|
+
await Promise.all(Object.values(tree.trees).map(async (childTree) => {
|
|
155
|
+
await this.populateGroupId(childTree);
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
stripTree(tree, groupId) {
|
|
159
|
+
tree.blobs = {};
|
|
160
|
+
tree.groupId = groupId;
|
|
161
|
+
tree.trees = {};
|
|
162
|
+
tree.omitted = true;
|
|
163
|
+
}
|
|
164
|
+
async readGroupId(tree) {
|
|
165
|
+
const groupIdBlobId = tree.blobs[".groupId"];
|
|
166
|
+
if (groupIdBlobId !== undefined) {
|
|
167
|
+
const groupIdBuffer = await this.readBlob(groupIdBlobId);
|
|
168
|
+
const groupId = bufferToString(groupIdBuffer, "utf8");
|
|
169
|
+
tree.groupId = groupId;
|
|
170
|
+
delete tree.blobs[".groupId"];
|
|
171
|
+
return groupId;
|
|
172
|
+
}
|
|
173
|
+
return tree.groupId;
|
|
174
|
+
}
|
|
175
|
+
async readBlob(blobId) {
|
|
176
|
+
const blob = await this.manager.getBlob(blobId);
|
|
177
|
+
this.blobsShaCache.set(blob.sha, "");
|
|
178
|
+
const bufferContent = stringToBuffer(blob.content, blob.encoding);
|
|
179
|
+
return bufferContent;
|
|
180
|
+
}
|
|
181
|
+
async uploadSummaryWithContext(summary, context) {
|
|
182
|
+
if (context.referenceSequenceNumber === 0) {
|
|
183
|
+
if (this.localDeltaConnectionServer === undefined || this.resolvedUrl === undefined) {
|
|
184
|
+
throw new Error("Insufficient constructor parameters. An ILocalDeltaConnectionServer and IResolvedUrl required");
|
|
185
|
+
}
|
|
186
|
+
await createDocument(this.localDeltaConnectionServer, this.resolvedUrl, summary);
|
|
187
|
+
const version = await this.getVersions(this.id, 1);
|
|
188
|
+
return version[0].id;
|
|
189
|
+
}
|
|
190
|
+
return this.summaryTreeUploadManager.writeSummaryTree(summary, context.ackHandle ?? "", "channel");
|
|
191
|
+
}
|
|
192
|
+
async createBlob(file) {
|
|
193
|
+
const uint8ArrayFile = new Uint8Array(file);
|
|
194
|
+
return this.manager
|
|
195
|
+
.createBlob(Uint8ArrayToString(uint8ArrayFile, "base64"), "base64")
|
|
196
|
+
.then((r) => ({ id: r.sha, url: r.url, minTTLInSeconds }));
|
|
197
|
+
}
|
|
198
|
+
async downloadSummary(handle) {
|
|
199
|
+
throw new Error("NOT IMPLEMENTED!");
|
|
200
|
+
}
|
|
201
|
+
async getPreviousFullSnapshot(parentHandle) {
|
|
202
|
+
return parentHandle
|
|
203
|
+
? this.getVersions(parentHandle, 1).then(async (versions) => {
|
|
204
|
+
// Clear the cache as the getSnapshotTree call will fill the cache.
|
|
205
|
+
this.blobsShaCache.clear();
|
|
206
|
+
return this.getSnapshotTree(versions[0]);
|
|
207
|
+
})
|
|
208
|
+
: undefined;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=localDocumentStorageService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localDocumentStorageService.js","sourceRoot":"","sources":["../src/localDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,SAAS,EACT,cAAc,EACd,kBAAkB,GAClB,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAGN,wBAAwB,GACxB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,MAAM,eAAe,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,mBAAmB;AACzD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,OAAO,CAAC,SAAS,IAAI,EAAE,EACvB,SAAS,CACT,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QAC5C,MAAM,cAAc,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC,OAAO;aACjB,UAAU,CAAC,kBAAkB,CAAC,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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tbufferToString,\n\tIsoBuffer,\n\tstringToBuffer,\n\tUint8ArrayToString,\n} from \"@fluid-internal/client-utils\";\nimport {\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tIResolvedUrl,\n\tISummaryContext,\n\ttype ISnapshotFetchOptions,\n\ttype ISnapshot,\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 { assert } from \"@fluidframework/core-utils\";\nimport { createDocument } from \"./localCreateDocument.js\";\n\nconst minTTLInSeconds = 24 * 60 * 60; // Same TTL as ODSP\n/**\n * @internal\n */\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\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\tawait this.populateGroupId(tree);\n\t\treturn tree;\n\t}\n\n\tpublic async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {\n\t\tlet versionId = snapshotFetchOptions?.versionId;\n\t\tif (!versionId) {\n\t\t\tconst versions = await this.getVersions(this.id, 1);\n\t\t\tif (versions.length === 0) {\n\t\t\t\tthrow new Error(\"No versions for the document!\");\n\t\t\t}\n\n\t\t\tversionId = versions[0].treeId;\n\t\t}\n\t\tconst rawTree = await this.manager.getTree(versionId);\n\t\tconst snapshotTree = buildGitTreeHierarchy(rawTree, this.blobsShaCache, true);\n\t\tif (snapshotFetchOptions?.loadingGroupIds !== undefined) {\n\t\t\tconst groupIds = new Set<string>(snapshotFetchOptions.loadingGroupIds);\n\t\t\tconst hasFoundTree = await this.filterTreeByLoadingGroupIds(\n\t\t\t\tsnapshotTree,\n\t\t\t\tgroupIds,\n\t\t\t\tfalse,\n\t\t\t);\n\t\t\tassert(hasFoundTree, 0x8dd /* No tree found for the given groupIds */);\n\t\t} else {\n\t\t\tawait this.stripTreeOfLoadingGroupIds(snapshotTree);\n\t\t}\n\n\t\tconst blobContents = new Map<string, ArrayBufferLike>();\n\t\tawait this.populateBlobContents(snapshotTree, blobContents);\n\n\t\tconst metadataString = IsoBuffer.from(blobContents.get(\".metadata\")).toString(\"utf-8\");\n\t\tconst metadata = JSON.parse(metadataString);\n\t\tconst sequenceNumber: number = metadata.message?.sequenceNumber ?? 0;\n\t\treturn {\n\t\t\tsnapshotTree,\n\t\t\tblobContents,\n\t\t\tops: [],\n\t\t\tsnapshotFormatV: 1,\n\t\t\tsequenceNumber,\n\t\t\tlatestSequenceNumber: undefined,\n\t\t};\n\t}\n\n\t/**\n\t * Strips the tree or any subtree of data if it has a groupId.\n\t *\n\t * @param tree - The tree to strip of loading groupIds\n\t * @returns a tree that has trees with groupIds that are empty\n\t */\n\tprivate async stripTreeOfLoadingGroupIds(tree: ISnapshotTreeEx) {\n\t\tconst groupId = await this.readGroupId(tree);\n\t\tif (groupId !== undefined) {\n\t\t\t// strip\n\t\t\tthis.stripTree(tree, groupId);\n\t\t\treturn;\n\t\t}\n\t\tawait Promise.all(\n\t\t\tObject.values(tree.trees).map(async (childTree) => {\n\t\t\t\tawait this.stripTreeOfLoadingGroupIds(childTree);\n\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Named differently as the algorithm is a little more involved.\n\t *\n\t * We want to strip the tree if it has a groupId that is not in the loadingGroupIds or if it doesn't have a descendent or ancestor\n\t * that has a groupId that is in the loadingGroupIds.\n\t *\n\t * We keep the tree in the opposite case.\n\t *\n\t * @param tree - the tree to strip of any data that is not in the loadingGroupIds\n\t * @param loadingGroupIds - the set of groupIds that are being loaded\n\t * @param ancestorGroupIdInLoadingGroup - whether the ancestor of the tree has a groupId that is in the loadingGroupIds\n\t * @returns whether or not it or descendant has a groupId that is in the loadingGroupIds\n\t */\n\tprivate async filterTreeByLoadingGroupIds(\n\t\ttree: ISnapshotTreeEx,\n\t\tloadingGroupIds: Set<string>,\n\t\tancestorGroupIdInLoadingGroup: boolean,\n\t): Promise<boolean> {\n\t\tassert(loadingGroupIds.size > 0, 0x8de /* loadingGroupIds should not be empty */);\n\t\tconst groupId = await this.readGroupId(tree);\n\n\t\t// Strip the tree if it has a groupId and it is not in the loadingGroupIds\n\t\t// This is an optimization here as we have other reasons to keep the tree.\n\t\tconst noGroupIdInLoadingGroupIds = groupId !== undefined && !loadingGroupIds.has(groupId);\n\t\tif (noGroupIdInLoadingGroupIds) {\n\t\t\tthis.stripTree(tree, groupId);\n\t\t\treturn false;\n\t\t}\n\n\t\t// Keep tree if it has a groupId and it is in the loadingGroupIds\n\t\tconst groupIdInLoadingGroupIds = groupId !== undefined && loadingGroupIds.has(groupId);\n\n\t\t// Keep tree if it has an ancestor that has a groupId that is in loadingGroupIds and it doesn't have groupId\n\t\tconst isChildOfAncestorWithGroupId = ancestorGroupIdInLoadingGroup && groupId === undefined;\n\n\t\t// Keep tree if it has a child that has a groupId that is in loadingGroupIds\n\t\tconst descendants = await Promise.all<boolean>(\n\t\t\tObject.values(tree.trees).map(async (childTree) => {\n\t\t\t\treturn this.filterTreeByLoadingGroupIds(\n\t\t\t\t\tchildTree,\n\t\t\t\t\tloadingGroupIds,\n\t\t\t\t\tancestorGroupIdInLoadingGroup || groupIdInLoadingGroupIds,\n\t\t\t\t);\n\t\t\t}),\n\t\t);\n\t\tconst isAncestorOfDescendantsWithGroupId = descendants.some((keep) => keep);\n\n\t\t// We don't want to return prematurely as we still may have children that we want to keep.\n\t\tif (\n\t\t\tgroupIdInLoadingGroupIds ||\n\t\t\tisChildOfAncestorWithGroupId ||\n\t\t\tisAncestorOfDescendantsWithGroupId\n\t\t) {\n\t\t\t// Keep this tree node\n\t\t\treturn true;\n\t\t}\n\n\t\t// This means we have no groupId and none of our ancestors or descendants have a groupId in the loadingGroupIds\n\t\tthis.stripTree(tree, groupId);\n\t\treturn false;\n\t}\n\n\t// Takes all the blobs of a tree and puts it into the blobContents\n\tprivate async populateBlobContents(\n\t\ttree: ISnapshotTreeEx,\n\t\tblobContents: Map<string, ArrayBufferLike>,\n\t): Promise<void> {\n\t\tawait Promise.all(\n\t\t\tObject.entries(tree.blobs).map(async ([path, blobId]) => {\n\t\t\t\tconst content = await this.readBlob(blobId);\n\t\t\t\tblobContents.set(path, content);\n\t\t\t}),\n\t\t);\n\t\tawait Promise.all(\n\t\t\tObject.values(tree.trees).map(async (childTree) => {\n\t\t\t\tawait this.populateBlobContents(childTree, blobContents);\n\t\t\t}),\n\t\t);\n\t}\n\n\tprivate async populateGroupId(tree: ISnapshotTreeEx): Promise<void> {\n\t\tawait this.readGroupId(tree);\n\t\tawait Promise.all(\n\t\t\tObject.values(tree.trees).map(async (childTree) => {\n\t\t\t\tawait this.populateGroupId(childTree);\n\t\t\t}),\n\t\t);\n\t}\n\n\tprivate stripTree(tree: ISnapshotTreeEx, groupId: string | undefined) {\n\t\ttree.blobs = {};\n\t\ttree.groupId = groupId;\n\t\ttree.trees = {};\n\t\ttree.omitted = true;\n\t}\n\n\tprivate async readGroupId(tree: ISnapshotTreeEx): Promise<string | undefined> {\n\t\tconst groupIdBlobId = tree.blobs[\".groupId\"];\n\t\tif (groupIdBlobId !== undefined) {\n\t\t\tconst groupIdBuffer = await this.readBlob(groupIdBlobId);\n\t\t\tconst groupId = bufferToString(groupIdBuffer, \"utf8\");\n\t\t\ttree.groupId = groupId;\n\t\t\tdelete tree.blobs[\".groupId\"];\n\t\t\treturn groupId;\n\t\t}\n\n\t\treturn tree.groupId;\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"]}
|
|
@@ -22,10 +22,9 @@ export declare class LocalResolver implements IUrlResolver {
|
|
|
22
22
|
* token from constant test strings. The root of the URL is fake, but the
|
|
23
23
|
* remaining relative URL can still be parsed.
|
|
24
24
|
* @param request - request to handle
|
|
25
|
-
* @alpha
|
|
26
25
|
*/
|
|
27
26
|
resolve(request: IRequest): Promise<IResolvedUrl>;
|
|
28
27
|
getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
|
|
29
28
|
createCreateNewRequest(documentId: string): IRequest;
|
|
30
29
|
}
|
|
31
|
-
//# sourceMappingURL=localResolver.d.
|
|
30
|
+
//# sourceMappingURL=localResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localResolver.d.ts","sourceRoot":"","sources":["../src/localResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAgB,MAAM,oCAAoC,CAAC;AAI9F;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,CAQhF;AAED;;;;GAIG;AACH,qBAAa,aAAc,YAAW,YAAY;IACjD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IACvC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;;IAIvC;;;;;OAKG;IACU,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAoBjD,cAAc,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAerF,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ;CAG3D"}
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { parse } from "url";
|
|
6
5
|
import { assert } from "@fluidframework/core-utils";
|
|
7
6
|
import { DriverHeader } from "@fluidframework/driver-definitions";
|
|
8
7
|
import { ScopeType } from "@fluidframework/protocol-definitions";
|
|
9
|
-
import { generateToken } from "./auth.
|
|
8
|
+
import { generateToken } from "./auth.js";
|
|
10
9
|
/**
|
|
11
10
|
* @alpha
|
|
12
11
|
*/
|
|
@@ -34,7 +33,6 @@ export class LocalResolver {
|
|
|
34
33
|
* token from constant test strings. The root of the URL is fake, but the
|
|
35
34
|
* remaining relative URL can still be parsed.
|
|
36
35
|
* @param request - request to handle
|
|
37
|
-
* @alpha
|
|
38
36
|
*/
|
|
39
37
|
async resolve(request) {
|
|
40
38
|
const parsedUrl = new URL(request.url);
|
|
@@ -50,7 +48,7 @@ export class LocalResolver {
|
|
|
50
48
|
id: documentId,
|
|
51
49
|
tokens: { jwt: generateToken(this.tenantId, documentId, this.tokenKey, scopes) },
|
|
52
50
|
type: "fluid",
|
|
53
|
-
url: `
|
|
51
|
+
url: `https://localhost:3000/${this.tenantId}/${fullPath}`,
|
|
54
52
|
};
|
|
55
53
|
return resolved;
|
|
56
54
|
}
|
|
@@ -59,7 +57,7 @@ export class LocalResolver {
|
|
|
59
57
|
if (url.startsWith("/")) {
|
|
60
58
|
url = url.substr(1);
|
|
61
59
|
}
|
|
62
|
-
const parsedUrl =
|
|
60
|
+
const parsedUrl = new URL(resolvedUrl.url);
|
|
63
61
|
if (parsedUrl.pathname === null) {
|
|
64
62
|
throw new Error("Url should contain tenant and docId!!");
|
|
65
63
|
}
|
|
@@ -71,4 +69,4 @@ export class LocalResolver {
|
|
|
71
69
|
return createLocalResolverCreateNewRequest(documentId);
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
|
-
//# sourceMappingURL=localResolver.
|
|
72
|
+
//# sourceMappingURL=localResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localResolver.js","sourceRoot":"","sources":["../src/localResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAA8B,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;GAEG;AACH,MAAM,UAAU,mCAAmC,CAAC,UAAkB;IACrE,MAAM,gBAAgB,GAAa;QAClC,GAAG,EAAE,yBAAyB,UAAU,EAAE;QAC1C,OAAO,EAAE;YACR,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,IAAI;SAC9B;KACD,CAAC;IACF,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,aAAa;IAIzB;QAHiB,aAAQ,GAAG,UAAU,CAAC;QACtB,aAAQ,GAAG,UAAU,CAAC;IAExB,CAAC;IAEhB;;;;;OAKG;IACI,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,OAAO,CA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AAD,EAAG,UAAU,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvD,MAAM,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,+DAA+D,CAAC,CAAC;QAE5F,OAAO,yBAAyB,UAAU,IAAI,GAAG,EAAE,CAAC;IACrD,CAAC;IAEM,sBAAsB,CAAC,UAAkB;QAC/C,OAAO,mCAAmC,CAAC,UAAU,CAAC,CAAC;IACxD,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/core-utils\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, IUrlResolver, DriverHeader } from \"@fluidframework/driver-definitions\";\nimport { ScopeType } from \"@fluidframework/protocol-definitions\";\nimport { generateToken } from \"./auth.js\";\n\n/**\n * @alpha\n */\nexport function createLocalResolverCreateNewRequest(documentId: string): IRequest {\n\tconst createNewRequest: IRequest = {\n\t\turl: `http://localhost:3000/${documentId}`,\n\t\theaders: {\n\t\t\t[DriverHeader.createNew]: true,\n\t\t},\n\t};\n\treturn createNewRequest;\n}\n\n/**\n * Resolves URLs by providing fake URLs which succeed with the other\n * related local classes.\n * @alpha\n */\nexport class LocalResolver implements IUrlResolver {\n\tprivate readonly tenantId = \"tenantId\";\n\tprivate readonly tokenKey = \"tokenKey\";\n\n\tconstructor() {}\n\n\t/**\n\t * Resolves URL requests by providing fake URLs with an actually generated\n\t * token from constant test strings. The root of the URL is fake, but the\n\t * remaining relative URL can still be parsed.\n\t * @param request - request to handle\n\t */\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl> {\n\t\tconst parsedUrl = new URL(request.url);\n\t\tconst fullPath = `${parsedUrl.pathname.substr(1)}${parsedUrl.search}`;\n\t\tconst documentId = fullPath.split(\"/\")[0];\n\t\tconst scopes = [ScopeType.DocRead, ScopeType.DocWrite, ScopeType.SummaryWrite];\n\t\tconst resolved: IResolvedUrl = {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl: `http://localhost:3000/deltas/${this.tenantId}/${documentId}`,\n\t\t\t\tordererUrl: \"http://localhost:3000\",\n\t\t\t\tstorageUrl: `http://localhost:3000/repos/${this.tenantId}`,\n\t\t\t},\n\t\t\tid: documentId,\n\t\t\ttokens: { jwt: generateToken(this.tenantId, documentId, this.tokenKey, scopes) },\n\t\t\ttype: \"fluid\",\n\t\t\turl: `https://localhost:3000/${this.tenantId}/${fullPath}`,\n\t\t};\n\n\t\treturn resolved;\n\t}\n\n\tpublic async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tlet url = relativeUrl;\n\t\tif (url.startsWith(\"/\")) {\n\t\t\turl = url.substr(1);\n\t\t}\n\t\tconst parsedUrl = new URL(resolvedUrl.url);\n\t\tif (parsedUrl.pathname === null) {\n\t\t\tthrow new Error(\"Url should contain tenant and docId!!\");\n\t\t}\n\t\tconst [, , documentId] = parsedUrl.pathname.split(\"/\");\n\t\tassert(!!documentId, 0x09a /* \"'documentId' must be a defined, non-zero length string.\" */);\n\n\t\treturn `http://localhost:3000/${documentId}/${url}`;\n\t}\n\n\tpublic createCreateNewRequest(documentId: string): IRequest {\n\t\treturn createLocalResolverCreateNewRequest(documentId);\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localSessionStorageDb.d.ts","sourceRoot":"","sources":["../src/localSessionStorageDb.ts"],"names":[],"mappings":"AAKA,OAAO,EAAe,GAAG,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAgTnE;;;GAGG;AACH,qBAAa,4BAA6B,YAAW,cAAc;IAClE,SAAgB,YAAY,EAAE,GAAG,CAA+B;IACnD,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;CAGpC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { EventEmitter } from "@fluid-internal/client-utils";
|
|
2
6
|
import { v4 as uuid } from "uuid";
|
|
3
7
|
/**
|
|
4
8
|
* A collection for local session storage, where data is stored in the browser
|
|
@@ -289,4 +293,4 @@ export class LocalSessionStorageDbFactory {
|
|
|
289
293
|
return this.testDatabase;
|
|
290
294
|
}
|
|
291
295
|
}
|
|
292
|
-
//# sourceMappingURL=localSessionStorageDb.
|
|
296
|
+
//# sourceMappingURL=localSessionStorageDb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localSessionStorageDb.js","sourceRoot":"","sources":["../src/localSessionStorageDb.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5D,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC;;;GAGG;AACH,MAAM,6BAA6B;IAClC;;OAEG;IACH,YAA6B,cAAsB;QAAtB,mBAAc,GAAd,cAAc,CAAQ;IAAG,CAAC;IAEhD,SAAS,CAAC,QAAa,EAAE,OAAa;QAC5C,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC3C,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,MAAW,EAAE,GAAQ,EAAE,QAAa;QAC3D,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC3C,CAAC;IACM,KAAK,CAAC,QAAQ,CAAC,GAAQ,EAAE,KAAU;QACzC,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC3C,CAAC;IACM,KAAK,CAAC,aAAa,CAAC,KAAU,EAAE,KAAQ;QAC9C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IA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AAI,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC,EAAE;wBAC5B,aAAa,GAAG,IAAI,CAAC;wBACrB,MAAM;qBACN;iBACD;gBAED,IAAI,CAAC,aAAa,EAAE;oBACnB,OAAO,KAAK,CAAC;iBACb;aACD;SACD;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAED;;GAEG;AACH,MAAM,qBAAsB,SAAQ,YAAY;IAAhD;;QACkB,gBAAW,GAAG,IAAI,GAAG,EAA8C,CAAC;IAgBtF,CAAC;IAfO,KAAK,CAAC,KAAK,KAAmB,CAAC;IAC/B,UAAU,CAAI,IAAY;QAChC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAChC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,6BAA6B,CAAI,IAAI,CAAC,CAAC,CAAC;SACvE;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAqC,CAAC;IACvE,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,IAAY;QACvC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAChC,OAAO,IAAI,CAAC;SACZ;QACD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,OAAO,4BAA4B;IAAzC;QACiB,iBAAY,GAAQ,IAAI,qBAAqB,EAAE,CAAC;IAIjE,CAAC;IAHO,KAAK,CAAC,OAAO;QACnB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { EventEmitter } from \"@fluid-internal/client-utils\";\nimport { ICollection, IDb } from \"@fluidframework/server-services-core\";\nimport { ITestDbFactory } from \"@fluidframework/server-test-utils\";\nimport { v4 as uuid } from \"uuid\";\n\n/**\n * A collection for local session storage, where data is stored in the browser\n * Functions include database operations such as queries, insertion and update.\n */\nclass LocalSessionStorageCollection<T> implements ICollection<T> {\n\t/**\n\t * @param collectionName - data type of the collection, e.g. blobs, deltas, trees, etc.\n\t */\n\tconstructor(private readonly collectionName: string) {}\n\n\tpublic aggregate(pipeline: any, options?: any): any {\n\t\tthrow new Error(\"Method Not Implemented\");\n\t}\n\n\tpublic async updateMany(filter: any, set: any, addToSet: any): Promise<void> {\n\t\tthrow new Error(\"Method Not Implemented\");\n\t}\n\tpublic async distinct(key: any, query: any): Promise<any> {\n\t\tthrow new Error(\"Method Not Implemented\");\n\t}\n\tpublic async findAndUpdate(query: any, value: T): Promise<{ value: T; existing: boolean }> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.find}\n\t */\n\t/*\n\t * Each query key consists of several keys separated by '.' e.g: \"operation.sequenceNumber\".\n\t * The hierarchical syntax allows finding nested key patterns.\n\t */\n\tpublic async find(query: any, sort: any): Promise<any[]> {\n\t\t// split the keys and get the corresponding value\n\t\tfunction getValueByKey(propertyBag, key: string) {\n\t\t\tconst keys = key.split(\".\");\n\t\t\tlet value = propertyBag;\n\t\t\tkeys.forEach((splitKey) => {\n\t\t\t\tvalue = value[splitKey];\n\t\t\t});\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn value;\n\t\t}\n\n\t\t// getting keys of the query we are trying to find\n\t\tconst queryKeys = Object.keys(query);\n\t\tlet filteredCollection = this.getAllInternal();\n\t\tqueryKeys.forEach((key) => {\n\t\t\tif (!query[key]) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (query[key].$gt > 0 || query[key].$lt > 0) {\n\t\t\t\tif (query[key].$gt > 0) {\n\t\t\t\t\tfilteredCollection = filteredCollection.filter(\n\t\t\t\t\t\t(value) => getValueByKey(value, key) > query[key].$gt,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (query[key].$lt > 0) {\n\t\t\t\t\tfilteredCollection = filteredCollection.filter(\n\t\t\t\t\t\t(value) => getValueByKey(value, key) < query[key].$lt,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfilteredCollection = filteredCollection.filter(\n\t\t\t\t\t(value) => getValueByKey(value, key) === query[key],\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\tif (sort && Object.keys(sort).length === 1) {\n\t\t\t// eslint-disable-next-line no-inner-declarations\n\t\t\tfunction compare(a, b) {\n\t\t\t\tconst sortKey = Object.keys(sort)[0];\n\t\t\t\treturn sort[sortKey] === 1\n\t\t\t\t\t? getValueByKey(a, sortKey) - getValueByKey(b, sortKey)\n\t\t\t\t\t: getValueByKey(b, sortKey) - getValueByKey(a, sortKey);\n\t\t\t}\n\n\t\t\tfilteredCollection = filteredCollection.sort(compare);\n\t\t}\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn filteredCollection;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.findAll}\n\t */\n\tpublic async findAll(): Promise<any[]> {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn this.getAllInternal();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.findOne}\n\t */\n\t/*\n\t * Query is expected to have a member \"_id\" which is a string used to find value in the database.\n\t */\n\tpublic async findOne(query: any): Promise<any> {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn this.findOneInternal(query);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.update}\n\t */\n\t/*\n\t * Query is expected to have a member \"_id\" which is a string used to find value in the database.\n\t */\n\tpublic async update(query: any, set: any, addToSet: any): Promise<void> {\n\t\tconst value = this.findOneInternal(query);\n\t\tif (!value) {\n\t\t\tthrow new Error(\"Not found\");\n\t\t} else {\n\t\t\tfor (const key of Object.keys(set)) {\n\t\t\t\tvalue[key] = set[key];\n\t\t\t}\n\t\t\tthis.insertInternal(value);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.upsert}\n\t */\n\t/*\n\t * Query is expected to have a member \"_id\" which is a string used to find value in the database.\n\t */\n\tpublic async upsert(query: any, set: any, addToSet: any): Promise<void> {\n\t\tconst value = this.findOneInternal(query);\n\t\tif (!value) {\n\t\t\tthis.insertInternal(set);\n\t\t} else {\n\t\t\tfor (const key of Object.keys(set)) {\n\t\t\t\tvalue[key] = set[key];\n\t\t\t}\n\t\t\tthis.insertInternal(value);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.insertOne}\n\t */\n\t/*\n\t * Value is expected to have a member \"_id\" which is a string used to search in the database.\n\t */\n\tpublic async insertOne(value: any): Promise<any> {\n\t\tconst presentVal = this.findOneInternal(value);\n\t\t// Only raise error when the object is present and the value is not equal.\n\t\tif (presentVal) {\n\t\t\tif (JSON.stringify(presentVal) === JSON.stringify(value)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthrow new Error(\"Existing Object!!\");\n\t\t}\n\n\t\treturn this.insertInternal(value);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.findOrCreate}\n\t */\n\t/*\n\t * Value and query are expected to have a member \"_id\" which is a string used to search or insert in the database.\n\t */\n\tpublic async findOrCreate(query: any, value: any): Promise<{ value: any; existing: boolean }> {\n\t\tconst existing = this.findOneInternal(query);\n\t\tif (existing) {\n\t\t\treturn { value: existing, existing: true };\n\t\t}\n\t\tthis.insertInternal(value);\n\t\treturn { value, existing: false };\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.insertMany}\n\t */\n\t/*\n\t * Each element in values is expected to have a member \"_id\" which is a string used to insert in the database.\n\t */\n\tpublic async insertMany(values: any[], ordered: boolean): Promise<void> {\n\t\tthis.insertInternal(...values);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.deleteOne}\n\t */\n\tpublic async deleteOne(query: any): Promise<any> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.deleteMany}\n\t */\n\tpublic async deleteMany(query: any): Promise<any> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/server-services-core#ICollection.createIndex}\n\t */\n\tpublic async createIndex(index: any, unique: boolean): Promise<void> {\n\t\tthrow new Error(\"Method not implemented.\");\n\t}\n\n\t/**\n\t * Return all values in the database\n\t */\n\tprivate getAllInternal(): any[] {\n\t\tconst values: string[] = [];\n\t\tfor (let i = 0; i < sessionStorage.length; i++) {\n\t\t\tconst key = sessionStorage.key(i);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tif (key!.startsWith(this.collectionName)) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tvalues.push(JSON.parse(sessionStorage.getItem(key!)!));\n\t\t\t}\n\t\t}\n\t\treturn values;\n\t}\n\n\t/**\n\t * Inserts values into the session storge.\n\t * Values are expected to have a member \"_id\" which is a unique id, otherwise will be assigned one\n\t *\n\t * @param values - data to insert to the database\n\t */\n\tprivate insertInternal(...values: any[]) {\n\t\tfor (const value of values) {\n\t\t\tif (value) {\n\t\t\t\tif (!value._id) {\n\t\t\t\t\tvalue._id = uuid();\n\t\t\t\t}\n\t\t\t\tsessionStorage.setItem(\n\t\t\t\t\t`${this.collectionName}-${value._id}`,\n\t\t\t\t\tJSON.stringify(value),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Finds the query in session storage and returns its value.\n\t * Returns null if query is not found.\n\t * Query is expected to have a member \"_id\" which is a unique id.\n\t *\n\t * @param query - what to find in the database\n\t */\n\tprivate findOneInternal(query: any): any {\n\t\tif (query._id) {\n\t\t\tconst json = sessionStorage.getItem(`${this.collectionName}-${query._id}`);\n\t\t\tif (json) {\n\t\t\t\treturn JSON.parse(json);\n\t\t\t}\n\t\t} else {\n\t\t\tconst queryKeys = Object.keys(query);\n\t\t\tfor (let i = 0; i < sessionStorage.length; i++) {\n\t\t\t\tconst ssKey = sessionStorage.key(i);\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tif (!ssKey!.startsWith(this.collectionName)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst value = JSON.parse(sessionStorage.getItem(ssKey!)!);\n\t\t\t\tlet foundMismatch = false;\n\t\t\t\tfor (const qk of queryKeys) {\n\t\t\t\t\tif (value[qk] !== query[qk]) {\n\t\t\t\t\t\tfoundMismatch = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!foundMismatch) {\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n}\n\n/**\n * A database for testing that stores data in the browsers session storage\n */\nclass LocalSessionStorageDb extends EventEmitter implements IDb {\n\tprivate readonly collections = new Map<string, LocalSessionStorageCollection<any>>();\n\tpublic async close(): Promise<void> {}\n\tpublic collection<T>(name: string): ICollection<T> {\n\t\tif (!this.collections.has(name)) {\n\t\t\tthis.collections.set(name, new LocalSessionStorageCollection<T>(name));\n\t\t}\n\t\treturn this.collections.get(name) as LocalSessionStorageCollection<T>;\n\t}\n\n\tpublic async dropCollection(name: string): Promise<boolean> {\n\t\tif (!this.collections.has(name)) {\n\t\t\treturn true;\n\t\t}\n\t\tthis.collections.delete(name);\n\t\treturn true;\n\t}\n}\n\n/**\n * A database factory for testing that stores data in the browsers session storage\n * @internal\n */\nexport class LocalSessionStorageDbFactory implements ITestDbFactory {\n\tpublic readonly testDatabase: IDb = new LocalSessionStorageDb();\n\tpublic async connect(): Promise<IDb> {\n\t\treturn this.testDatabase;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { strict as assert } from "assert";
|
|
6
|
+
import { DriverHeader } from "@fluidframework/driver-definitions";
|
|
7
|
+
import { LocalResolver } from "../localResolver.js";
|
|
8
|
+
describe("Local Driver Resolver", () => {
|
|
9
|
+
const documentId = "localResolverTest";
|
|
10
|
+
let resolver;
|
|
11
|
+
describe("CreateNew Flow", () => {
|
|
12
|
+
let request;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
resolver = new LocalResolver();
|
|
15
|
+
request = resolver.createCreateNewRequest(documentId);
|
|
16
|
+
});
|
|
17
|
+
it("should successfully create a creatNewRequest", async () => {
|
|
18
|
+
assert(!!request.headers?.[DriverHeader.createNew], "Request should contain create new header");
|
|
19
|
+
const expectedUrl = `http://localhost:3000/${documentId}`;
|
|
20
|
+
assert.equal(request.url, expectedUrl, "The url in createNewRequest should match");
|
|
21
|
+
});
|
|
22
|
+
it("should successfully resolve a createNewRequest", async () => {
|
|
23
|
+
const resolvedUrl = await resolver.resolve(request);
|
|
24
|
+
const expectedUrl = `https://localhost:3000/tenantId/${documentId}`;
|
|
25
|
+
assert.equal(resolvedUrl.url, expectedUrl, "The resolved url should match");
|
|
26
|
+
});
|
|
27
|
+
it("should successfully create requestUrl for a data store from resolvedUrl", async () => {
|
|
28
|
+
const resolvedUrl = await resolver.resolve(request);
|
|
29
|
+
const dataStoreId = "datastore";
|
|
30
|
+
const response = await resolver.getAbsoluteUrl(resolvedUrl, dataStoreId);
|
|
31
|
+
const expectedUrl = `http://localhost:3000/${documentId}/${dataStoreId}`;
|
|
32
|
+
assert.equal(response, expectedUrl, "The requestUrl should match");
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
describe("Container Request Resolution", () => {
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
resolver = new LocalResolver();
|
|
38
|
+
});
|
|
39
|
+
it("should successfully resolve request for a container url", async () => {
|
|
40
|
+
const url = `http://localhost/${documentId}`;
|
|
41
|
+
const resolvedUrl = await resolver.resolve({ url });
|
|
42
|
+
const expectedUrl = `https://localhost:3000/tenantId/${documentId}`;
|
|
43
|
+
assert.equal(resolvedUrl.url, expectedUrl, "The resolved container url should match");
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=localResolverTest.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localResolverTest.spec.js","sourceRoot":"","sources":["../../src/test/localResolverTest.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACtC,MAAM,UAAU,GAAG,mBAAmB,CAAC;IACvC,IAAI,QAAuB,CAAC;IAE5B,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC/B,IAAI,OAAiB,CAAC;QAEtB,UAAU,CAAC,GAAG,EAAE;YACf,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAC;YAC/B,OAAO,GAAG,QAAQ,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;YAC7D,MAAM,CACL,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,EAC3C,0CAA0C,CAC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M,WAAW,GAAG,mCAAmC,UAAU,EAAE,CAAC;YACpE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,yCAAyC,CAAC,CAAC;QACvF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport { DriverHeader } from \"@fluidframework/driver-definitions\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { LocalResolver } from \"../localResolver.js\";\n\ndescribe(\"Local Driver Resolver\", () => {\n\tconst documentId = \"localResolverTest\";\n\tlet resolver: LocalResolver;\n\n\tdescribe(\"CreateNew Flow\", () => {\n\t\tlet request: IRequest;\n\n\t\tbeforeEach(() => {\n\t\t\tresolver = new LocalResolver();\n\t\t\trequest = resolver.createCreateNewRequest(documentId);\n\t\t});\n\n\t\tit(\"should successfully create a creatNewRequest\", async () => {\n\t\t\tassert(\n\t\t\t\t!!request.headers?.[DriverHeader.createNew],\n\t\t\t\t\"Request should contain create new header\",\n\t\t\t);\n\t\t\tconst expectedUrl = `http://localhost:3000/${documentId}`;\n\t\t\tassert.equal(request.url, expectedUrl, \"The url in createNewRequest should match\");\n\t\t});\n\n\t\tit(\"should successfully resolve a createNewRequest\", async () => {\n\t\t\tconst resolvedUrl = await resolver.resolve(request);\n\t\t\tconst expectedUrl = `https://localhost:3000/tenantId/${documentId}`;\n\t\t\tassert.equal(resolvedUrl.url, expectedUrl, \"The resolved url should match\");\n\t\t});\n\n\t\tit(\"should successfully create requestUrl for a data store from resolvedUrl\", async () => {\n\t\t\tconst resolvedUrl = await resolver.resolve(request);\n\t\t\tconst dataStoreId = \"datastore\";\n\t\t\tconst response = await resolver.getAbsoluteUrl(resolvedUrl, dataStoreId);\n\t\t\tconst expectedUrl = `http://localhost:3000/${documentId}/${dataStoreId}`;\n\t\t\tassert.equal(response, expectedUrl, \"The requestUrl should match\");\n\t\t});\n\t});\n\n\tdescribe(\"Container Request Resolution\", () => {\n\t\tbeforeEach(() => {\n\t\t\tresolver = new LocalResolver();\n\t\t});\n\n\t\tit(\"should successfully resolve request for a container url\", async () => {\n\t\t\tconst url = `http://localhost/${documentId}`;\n\t\t\tconst resolvedUrl = await resolver.resolve({ url });\n\t\t\tconst expectedUrl = `https://localhost:3000/tenantId/${documentId}`;\n\t\t\tassert.equal(resolvedUrl.url, expectedUrl, \"The resolved container url should match\");\n\t\t});\n\t});\n});\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
use_current_ClassDeclaration_LocalDeltaStorageService(get_old_ClassDeclaration_LocalDeltaStorageService());
|
|
2
|
+
use_old_ClassDeclaration_LocalDeltaStorageService(get_current_ClassDeclaration_LocalDeltaStorageService());
|
|
3
|
+
use_current_ClassDeclaration_LocalDocumentDeltaConnection(get_old_ClassDeclaration_LocalDocumentDeltaConnection());
|
|
4
|
+
use_old_ClassDeclaration_LocalDocumentDeltaConnection(get_current_ClassDeclaration_LocalDocumentDeltaConnection());
|
|
5
|
+
use_current_ClassDeclaration_LocalDocumentService(
|
|
6
|
+
// @ts-expect-error compatibility expected to be broken
|
|
7
|
+
get_old_ClassDeclaration_LocalDocumentService());
|
|
8
|
+
use_old_ClassDeclaration_LocalDocumentService(get_current_ClassDeclaration_LocalDocumentService());
|
|
9
|
+
use_current_ClassDeclaration_LocalDocumentServiceFactory(get_old_ClassDeclaration_LocalDocumentServiceFactory());
|
|
10
|
+
use_old_ClassDeclaration_LocalDocumentServiceFactory(get_current_ClassDeclaration_LocalDocumentServiceFactory());
|
|
11
|
+
use_current_ClassDeclaration_LocalDocumentStorageService(
|
|
12
|
+
// @ts-expect-error compatibility expected to be broken
|
|
13
|
+
get_old_ClassDeclaration_LocalDocumentStorageService());
|
|
14
|
+
use_old_ClassDeclaration_LocalDocumentStorageService(
|
|
15
|
+
// @ts-expect-error compatibility expected to be broken
|
|
16
|
+
get_current_ClassDeclaration_LocalDocumentStorageService());
|
|
17
|
+
use_current_ClassDeclaration_LocalResolver(get_old_ClassDeclaration_LocalResolver());
|
|
18
|
+
use_old_ClassDeclaration_LocalResolver(get_current_ClassDeclaration_LocalResolver());
|
|
19
|
+
use_current_ClassDeclaration_LocalSessionStorageDbFactory(get_old_ClassDeclaration_LocalSessionStorageDbFactory());
|
|
20
|
+
use_old_ClassDeclaration_LocalSessionStorageDbFactory(get_current_ClassDeclaration_LocalSessionStorageDbFactory());
|
|
21
|
+
use_current_FunctionDeclaration_createLocalDocumentService(get_old_FunctionDeclaration_createLocalDocumentService());
|
|
22
|
+
use_old_FunctionDeclaration_createLocalDocumentService(get_current_FunctionDeclaration_createLocalDocumentService());
|
|
23
|
+
use_current_FunctionDeclaration_createLocalResolverCreateNewRequest(get_old_FunctionDeclaration_createLocalResolverCreateNewRequest());
|
|
24
|
+
use_old_FunctionDeclaration_createLocalResolverCreateNewRequest(get_current_FunctionDeclaration_createLocalResolverCreateNewRequest());
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=validateLocalDriverPrevious.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateLocalDriverPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateLocalDriverPrevious.generated.ts"],"names":[],"mappings":"AAgCA,qDAAqD,CACjD,iDAAiD,EAAE,CAAC,CAAC;AAWzD,iDAAiD,CAC7C,qDAAqD,EAAE,CAAC,CAAC;AAW7D,yDAAyD,CACrD,qDAAqD,EAAE,CAAC,CAAC;AAW7D,qDAAqD,CACjD,yDAAyD,EAAE,CAAC,CAAC;AAWjE,iDAAiD;AAC7C,uDAAuD;AACvD,6CAA6C,EAAE,CAAC,CAAC;AAWrD,6CAA6C,CACzC,iDAAiD,EAAE,CAAC,CAAC;AAWzD,wDAAwD,CACpD,oDAAoD,EAAE,CAAC,CAAC;AAW5D,oDAAoD,CAChD,wDAAwD,EAAE,CAAC,CAAC;AAWhE,wDAAwD;AACpD,uDAAuD;AACvD,oDAAoD,EAAE,CAAC,CAAC;AAW5D,oDAAoD;AAChD,uDAAuD;AACvD,wDAAwD,EAAE,CAAC,CAAC;AAWhE,0CAA0C,CACtC,sCAAsC,EAAE,CAAC,CAAC;AAW9C,sCAAsC,CAClC,0CAA0C,EAAE,CAAC,CAAC;AAWlD,yDAAyD,CACrD,qDAAqD,EAAE,CAAC,CAAC;AAW7D,qDAAqD,CACjD,yDAAyD,EAAE,CAAC,CAAC;AAWjE,0DAA0D,CACtD,sDAAsD,EAAE,CAAC,CAAC;AAW9D,sDAAsD,CAClD,0DAA0D,EAAE,CAAC,CAAC;AAWlE,mEAAmE,CAC/D,+DAA+D,EAAE,CAAC,CAAC;AAWvE,+DAA+D,CAC3D,mEAAmE,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by fluid-type-test-generator in @fluidframework/build-tools.\n */\nimport type * as old from \"@fluidframework/local-driver-previous\";\nimport type * as current from \"../../index.js\";\n\n\n// See 'build-tools/src/type-test-generator/compatibility.ts' for more information.\ntype TypeOnly<T> = T extends number\n\t? number\n\t: T extends string\n\t? string\n\t: T extends boolean | bigint | symbol\n\t? T\n\t: {\n\t\t\t[P in keyof T]: TypeOnly<T[P]>;\n\t };\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalDeltaStorageService\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_LocalDeltaStorageService():\n TypeOnly<old.LocalDeltaStorageService>;\ndeclare function use_current_ClassDeclaration_LocalDeltaStorageService(\n use: TypeOnly<current.LocalDeltaStorageService>): void;\nuse_current_ClassDeclaration_LocalDeltaStorageService(\n get_old_ClassDeclaration_LocalDeltaStorageService());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalDeltaStorageService\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_LocalDeltaStorageService():\n TypeOnly<current.LocalDeltaStorageService>;\ndeclare function use_old_ClassDeclaration_LocalDeltaStorageService(\n use: TypeOnly<old.LocalDeltaStorageService>): void;\nuse_old_ClassDeclaration_LocalDeltaStorageService(\n get_current_ClassDeclaration_LocalDeltaStorageService());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalDocumentDeltaConnection\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_LocalDocumentDeltaConnection():\n TypeOnly<old.LocalDocumentDeltaConnection>;\ndeclare function use_current_ClassDeclaration_LocalDocumentDeltaConnection(\n use: TypeOnly<current.LocalDocumentDeltaConnection>): void;\nuse_current_ClassDeclaration_LocalDocumentDeltaConnection(\n get_old_ClassDeclaration_LocalDocumentDeltaConnection());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalDocumentDeltaConnection\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_LocalDocumentDeltaConnection():\n TypeOnly<current.LocalDocumentDeltaConnection>;\ndeclare function use_old_ClassDeclaration_LocalDocumentDeltaConnection(\n use: TypeOnly<old.LocalDocumentDeltaConnection>): void;\nuse_old_ClassDeclaration_LocalDocumentDeltaConnection(\n get_current_ClassDeclaration_LocalDocumentDeltaConnection());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalDocumentService\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_LocalDocumentService():\n TypeOnly<old.LocalDocumentService>;\ndeclare function use_current_ClassDeclaration_LocalDocumentService(\n use: TypeOnly<current.LocalDocumentService>): void;\nuse_current_ClassDeclaration_LocalDocumentService(\n // @ts-expect-error compatibility expected to be broken\n get_old_ClassDeclaration_LocalDocumentService());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalDocumentService\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_LocalDocumentService():\n TypeOnly<current.LocalDocumentService>;\ndeclare function use_old_ClassDeclaration_LocalDocumentService(\n use: TypeOnly<old.LocalDocumentService>): void;\nuse_old_ClassDeclaration_LocalDocumentService(\n get_current_ClassDeclaration_LocalDocumentService());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalDocumentServiceFactory\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_LocalDocumentServiceFactory():\n TypeOnly<old.LocalDocumentServiceFactory>;\ndeclare function use_current_ClassDeclaration_LocalDocumentServiceFactory(\n use: TypeOnly<current.LocalDocumentServiceFactory>): void;\nuse_current_ClassDeclaration_LocalDocumentServiceFactory(\n get_old_ClassDeclaration_LocalDocumentServiceFactory());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalDocumentServiceFactory\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_LocalDocumentServiceFactory():\n TypeOnly<current.LocalDocumentServiceFactory>;\ndeclare function use_old_ClassDeclaration_LocalDocumentServiceFactory(\n use: TypeOnly<old.LocalDocumentServiceFactory>): void;\nuse_old_ClassDeclaration_LocalDocumentServiceFactory(\n get_current_ClassDeclaration_LocalDocumentServiceFactory());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalDocumentStorageService\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_LocalDocumentStorageService():\n TypeOnly<old.LocalDocumentStorageService>;\ndeclare function use_current_ClassDeclaration_LocalDocumentStorageService(\n use: TypeOnly<current.LocalDocumentStorageService>): void;\nuse_current_ClassDeclaration_LocalDocumentStorageService(\n // @ts-expect-error compatibility expected to be broken\n get_old_ClassDeclaration_LocalDocumentStorageService());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalDocumentStorageService\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_LocalDocumentStorageService():\n TypeOnly<current.LocalDocumentStorageService>;\ndeclare function use_old_ClassDeclaration_LocalDocumentStorageService(\n use: TypeOnly<old.LocalDocumentStorageService>): void;\nuse_old_ClassDeclaration_LocalDocumentStorageService(\n // @ts-expect-error compatibility expected to be broken\n get_current_ClassDeclaration_LocalDocumentStorageService());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalResolver\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_LocalResolver():\n TypeOnly<old.LocalResolver>;\ndeclare function use_current_ClassDeclaration_LocalResolver(\n use: TypeOnly<current.LocalResolver>): void;\nuse_current_ClassDeclaration_LocalResolver(\n get_old_ClassDeclaration_LocalResolver());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalResolver\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_LocalResolver():\n TypeOnly<current.LocalResolver>;\ndeclare function use_old_ClassDeclaration_LocalResolver(\n use: TypeOnly<old.LocalResolver>): void;\nuse_old_ClassDeclaration_LocalResolver(\n get_current_ClassDeclaration_LocalResolver());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalSessionStorageDbFactory\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_LocalSessionStorageDbFactory():\n TypeOnly<old.LocalSessionStorageDbFactory>;\ndeclare function use_current_ClassDeclaration_LocalSessionStorageDbFactory(\n use: TypeOnly<current.LocalSessionStorageDbFactory>): void;\nuse_current_ClassDeclaration_LocalSessionStorageDbFactory(\n get_old_ClassDeclaration_LocalSessionStorageDbFactory());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_LocalSessionStorageDbFactory\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_LocalSessionStorageDbFactory():\n TypeOnly<current.LocalSessionStorageDbFactory>;\ndeclare function use_old_ClassDeclaration_LocalSessionStorageDbFactory(\n use: TypeOnly<old.LocalSessionStorageDbFactory>): void;\nuse_old_ClassDeclaration_LocalSessionStorageDbFactory(\n get_current_ClassDeclaration_LocalSessionStorageDbFactory());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_createLocalDocumentService\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_createLocalDocumentService():\n TypeOnly<typeof old.createLocalDocumentService>;\ndeclare function use_current_FunctionDeclaration_createLocalDocumentService(\n use: TypeOnly<typeof current.createLocalDocumentService>): void;\nuse_current_FunctionDeclaration_createLocalDocumentService(\n get_old_FunctionDeclaration_createLocalDocumentService());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_createLocalDocumentService\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_createLocalDocumentService():\n TypeOnly<typeof current.createLocalDocumentService>;\ndeclare function use_old_FunctionDeclaration_createLocalDocumentService(\n use: TypeOnly<typeof old.createLocalDocumentService>): void;\nuse_old_FunctionDeclaration_createLocalDocumentService(\n get_current_FunctionDeclaration_createLocalDocumentService());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_createLocalResolverCreateNewRequest\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_createLocalResolverCreateNewRequest():\n TypeOnly<typeof old.createLocalResolverCreateNewRequest>;\ndeclare function use_current_FunctionDeclaration_createLocalResolverCreateNewRequest(\n use: TypeOnly<typeof current.createLocalResolverCreateNewRequest>): void;\nuse_current_FunctionDeclaration_createLocalResolverCreateNewRequest(\n get_old_FunctionDeclaration_createLocalResolverCreateNewRequest());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_createLocalResolverCreateNewRequest\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_createLocalResolverCreateNewRequest():\n TypeOnly<typeof current.createLocalResolverCreateNewRequest>;\ndeclare function use_old_FunctionDeclaration_createLocalResolverCreateNewRequest(\n use: TypeOnly<typeof old.createLocalResolverCreateNewRequest>): void;\nuse_old_FunctionDeclaration_createLocalResolverCreateNewRequest(\n get_current_FunctionDeclaration_createLocalResolverCreateNewRequest());\n"]}
|