@fluidframework/local-driver 2.0.0-dev-rc.1.0.0.232845 → 2.0.0-dev-rc.2.0.0.246488
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.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 +4 -2
- 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 +2 -2
- package/dist/local-driver-beta.d.ts +6 -0
- package/dist/local-driver-public.d.ts +6 -0
- package/dist/local-driver-untrimmed.d.ts +28 -3
- package/dist/localDocumentService.d.ts +1 -1
- package/dist/localDocumentService.d.ts.map +1 -1
- package/dist/localDocumentService.js +7 -7
- 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.d.ts +4 -0
- package/dist/localSessionStorageDb.d.ts.map +1 -1
- package/dist/localSessionStorageDb.js +4 -4
- 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} +2 -2
- package/lib/{local-driver-beta.d.mts → local-driver-beta.d.ts} +6 -0
- package/lib/{local-driver-public.d.mts → local-driver-public.d.ts} +6 -0
- package/lib/{local-driver-untrimmed.d.mts → local-driver-untrimmed.d.ts} +28 -3
- 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} +2 -2
- package/lib/localDocumentService.d.ts.map +1 -0
- package/lib/{localDocumentService.mjs → localDocumentService.js} +5 -5
- 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} +5 -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 +49 -54
- package/src/index.ts +7 -7
- package/src/localDocumentService.ts +4 -4
- package/src/localDocumentServiceFactory.ts +5 -7
- package/src/localDocumentStorageService.ts +180 -4
- package/src/localResolver.ts +3 -5
- package/src/localSessionStorageDb.ts +2 -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
|
@@ -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=localRes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AAI,CAAC,QAAQ,IAAI,UAAU,EAAE;gBAC9E,UAAU,EAAE,uBAAuB;gBACnC,UAAU,EAAE,+BAA+B,IAAI,CAAC,QAAQ,EAAE;aAC1D;YACD,EAAE,EAAE,UAAU;YACd,MAAM,EAAE,EAAE,GAAG,EAAE,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE;YAChF,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,0BAA0B,IAAI,CAAC,QAAQ,IAAI,QAAQ,EAAE;SAC1D,CAAC;QAEF,OAAO,QAAQ,CAAC;IACjB,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,WAAyB,EAAE,WAAmB;QACzE,IAAI,GAAG,GAAG,WAAW,CAAC;QACtB,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACxB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACpB;QACD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,SAAS,CAAC,QAAQ,KAAK,IAAI,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;SACzD;QACD,MAAM,CAAC,EAAE,AAAD,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"]}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
1
5
|
import { IDb } from "@fluidframework/server-services-core";
|
|
2
6
|
import { ITestDbFactory } from "@fluidframework/server-test-utils";
|
|
3
7
|
/**
|
|
@@ -8,4 +12,4 @@ export declare class LocalSessionStorageDbFactory implements ITestDbFactory {
|
|
|
8
12
|
readonly testDatabase: IDb;
|
|
9
13
|
connect(): Promise<IDb>;
|
|
10
14
|
}
|
|
11
|
-
//# sourceMappingURL=localSessionStorageDb.d.
|
|
15
|
+
//# sourceMappingURL=localSessionStorageDb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localSessionStorageDb.d.ts","sourceRoot":"","sources":["../src/localSessionStorageDb.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,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;AAEH,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;QAC9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K,CAAC;gBAC1B,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE;oBAC3B,IAAI,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 */\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,CA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QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;YACpD,MAAM,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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/local-driver",
|
|
3
|
-
"version": "2.0.0-dev-rc.
|
|
3
|
+
"version": "2.0.0-dev-rc.2.0.0.246488",
|
|
4
4
|
"description": "Fluid local driver",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -10,60 +10,50 @@
|
|
|
10
10
|
},
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"author": "Microsoft and contributors",
|
|
13
|
+
"type": "module",
|
|
13
14
|
"exports": {
|
|
14
15
|
".": {
|
|
15
16
|
"import": {
|
|
16
|
-
"types": "./lib/index.d.
|
|
17
|
-
"default": "./lib/index.
|
|
17
|
+
"types": "./lib/index.d.ts",
|
|
18
|
+
"default": "./lib/index.js"
|
|
18
19
|
},
|
|
19
20
|
"require": {
|
|
20
21
|
"types": "./dist/index.d.ts",
|
|
21
22
|
"default": "./dist/index.js"
|
|
22
23
|
}
|
|
23
24
|
},
|
|
24
|
-
"./
|
|
25
|
+
"./public": {
|
|
25
26
|
"import": {
|
|
26
|
-
"types": "./lib/local-driver-
|
|
27
|
-
"default": "./lib/index.
|
|
27
|
+
"types": "./lib/local-driver-public.d.ts",
|
|
28
|
+
"default": "./lib/index.js"
|
|
28
29
|
},
|
|
29
30
|
"require": {
|
|
30
|
-
"types": "./dist/local-driver-
|
|
31
|
+
"types": "./dist/local-driver-public.d.ts",
|
|
31
32
|
"default": "./dist/index.js"
|
|
32
33
|
}
|
|
33
34
|
},
|
|
34
|
-
"./
|
|
35
|
+
"./alpha": {
|
|
35
36
|
"import": {
|
|
36
|
-
"types": "./lib/local-driver-
|
|
37
|
-
"default": "./lib/index.
|
|
37
|
+
"types": "./lib/local-driver-alpha.d.ts",
|
|
38
|
+
"default": "./lib/index.js"
|
|
38
39
|
},
|
|
39
40
|
"require": {
|
|
40
|
-
"types": "./dist/local-driver-
|
|
41
|
+
"types": "./dist/local-driver-alpha.d.ts",
|
|
41
42
|
"default": "./dist/index.js"
|
|
42
43
|
}
|
|
43
44
|
},
|
|
44
45
|
"./internal": {
|
|
45
46
|
"import": {
|
|
46
|
-
"types": "./lib/index.d.
|
|
47
|
-
"default": "./lib/index.
|
|
47
|
+
"types": "./lib/index.d.ts",
|
|
48
|
+
"default": "./lib/index.js"
|
|
48
49
|
},
|
|
49
50
|
"require": {
|
|
50
51
|
"types": "./dist/index.d.ts",
|
|
51
52
|
"default": "./dist/index.js"
|
|
52
53
|
}
|
|
53
|
-
},
|
|
54
|
-
"./public": {
|
|
55
|
-
"import": {
|
|
56
|
-
"types": "./lib/local-driver-public.d.mts",
|
|
57
|
-
"default": "./lib/index.mjs"
|
|
58
|
-
},
|
|
59
|
-
"require": {
|
|
60
|
-
"types": "./dist/local-driver-public.d.ts",
|
|
61
|
-
"default": "./dist/index.js"
|
|
62
|
-
}
|
|
63
54
|
}
|
|
64
55
|
},
|
|
65
56
|
"main": "dist/index.js",
|
|
66
|
-
"module": "lib/index.mjs",
|
|
67
57
|
"browser": {
|
|
68
58
|
"moniker": "@fluidframework/server-services-client/dist/generateNames.js"
|
|
69
59
|
},
|
|
@@ -89,34 +79,32 @@
|
|
|
89
79
|
"temp-directory": "nyc/.nyc_output"
|
|
90
80
|
},
|
|
91
81
|
"dependencies": {
|
|
92
|
-
"@fluid-internal/client-utils": "2.0.0-dev-rc.
|
|
93
|
-
"@fluidframework/core-interfaces": "2.0.0-dev-rc.
|
|
94
|
-
"@fluidframework/core-utils": "2.0.0-dev-rc.
|
|
95
|
-
"@fluidframework/driver-base": "2.0.0-dev-rc.
|
|
96
|
-
"@fluidframework/driver-definitions": "2.0.0-dev-rc.
|
|
97
|
-
"@fluidframework/driver-utils": "2.0.0-dev-rc.
|
|
98
|
-
"@fluidframework/protocol-base": "^
|
|
99
|
-
"@fluidframework/protocol-definitions": "^3.2.0
|
|
100
|
-
"@fluidframework/routerlicious-driver": "2.0.0-dev-rc.
|
|
101
|
-
"@fluidframework/server-local-server": "^
|
|
102
|
-
"@fluidframework/server-services-client": "^
|
|
103
|
-
"@fluidframework/server-services-core": "^
|
|
104
|
-
"@fluidframework/server-test-utils": "^
|
|
105
|
-
"@fluidframework/telemetry-utils": "2.0.0-dev-rc.
|
|
106
|
-
"events": "^3.1.0",
|
|
82
|
+
"@fluid-internal/client-utils": "2.0.0-dev-rc.2.0.0.246488",
|
|
83
|
+
"@fluidframework/core-interfaces": "2.0.0-dev-rc.2.0.0.246488",
|
|
84
|
+
"@fluidframework/core-utils": "2.0.0-dev-rc.2.0.0.246488",
|
|
85
|
+
"@fluidframework/driver-base": "2.0.0-dev-rc.2.0.0.246488",
|
|
86
|
+
"@fluidframework/driver-definitions": "2.0.0-dev-rc.2.0.0.246488",
|
|
87
|
+
"@fluidframework/driver-utils": "2.0.0-dev-rc.2.0.0.246488",
|
|
88
|
+
"@fluidframework/protocol-base": "^4.0.0",
|
|
89
|
+
"@fluidframework/protocol-definitions": "^3.2.0",
|
|
90
|
+
"@fluidframework/routerlicious-driver": "2.0.0-dev-rc.2.0.0.246488",
|
|
91
|
+
"@fluidframework/server-local-server": "^4.0.0",
|
|
92
|
+
"@fluidframework/server-services-client": "^4.0.0",
|
|
93
|
+
"@fluidframework/server-services-core": "^4.0.0",
|
|
94
|
+
"@fluidframework/server-test-utils": "^4.0.0",
|
|
95
|
+
"@fluidframework/telemetry-utils": "2.0.0-dev-rc.2.0.0.246488",
|
|
107
96
|
"jsrsasign": "^11.0.0",
|
|
108
|
-
"url": "^0.11.0",
|
|
109
97
|
"uuid": "^9.0.0"
|
|
110
98
|
},
|
|
111
99
|
"devDependencies": {
|
|
112
100
|
"@arethetypeswrong/cli": "^0.13.3",
|
|
113
|
-
"@fluid-
|
|
101
|
+
"@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.2.0.0.246488",
|
|
102
|
+
"@fluid-tools/build-cli": "^0.34.0",
|
|
114
103
|
"@fluidframework/build-common": "^2.0.3",
|
|
115
|
-
"@fluidframework/build-tools": "^0.
|
|
116
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
104
|
+
"@fluidframework/build-tools": "^0.34.0",
|
|
105
|
+
"@fluidframework/eslint-config-fluid": "^5.1.0",
|
|
117
106
|
"@fluidframework/local-driver-previous": "npm:@fluidframework/local-driver@2.0.0-internal.8.0.0",
|
|
118
|
-
"@
|
|
119
|
-
"@microsoft/api-extractor": "^7.39.1",
|
|
107
|
+
"@microsoft/api-extractor": "^7.42.3",
|
|
120
108
|
"@types/jsrsasign": "^10.5.12",
|
|
121
109
|
"@types/mocha": "^9.1.1",
|
|
122
110
|
"@types/node": "^18.19.0",
|
|
@@ -124,15 +112,14 @@
|
|
|
124
112
|
"c8": "^8.0.1",
|
|
125
113
|
"copyfiles": "^2.4.1",
|
|
126
114
|
"cross-env": "^7.0.3",
|
|
127
|
-
"eslint": "~8.
|
|
115
|
+
"eslint": "~8.55.0",
|
|
128
116
|
"mocha": "^10.2.0",
|
|
129
117
|
"mocha-json-output-reporter": "^2.0.1",
|
|
130
118
|
"mocha-multi-reporters": "^1.5.1",
|
|
131
119
|
"moment": "^2.21.0",
|
|
132
120
|
"prettier": "~3.0.3",
|
|
133
121
|
"rimraf": "^4.4.0",
|
|
134
|
-
"socket.io-client": "^4.
|
|
135
|
-
"tsc-multi": "^1.1.0",
|
|
122
|
+
"socket.io-client": "^4.7.3",
|
|
136
123
|
"typescript": "~5.1.6"
|
|
137
124
|
},
|
|
138
125
|
"fluidBuild": {
|
|
@@ -151,19 +138,25 @@
|
|
|
151
138
|
"broken": {
|
|
152
139
|
"ClassDeclaration_LocalDocumentService": {
|
|
153
140
|
"forwardCompat": false
|
|
141
|
+
},
|
|
142
|
+
"ClassDeclaration_LocalDocumentStorageService": {
|
|
143
|
+
"backCompat": false,
|
|
144
|
+
"forwardCompat": false
|
|
154
145
|
}
|
|
155
146
|
}
|
|
156
147
|
},
|
|
157
148
|
"scripts": {
|
|
158
149
|
"api": "fluid-build . --task api",
|
|
159
|
-
"api-extractor:commonjs": "api-extractor run --
|
|
160
|
-
"api-extractor:esnext": "api-extractor run --
|
|
150
|
+
"api-extractor:commonjs": "api-extractor run --config ./api-extractor-cjs.json",
|
|
151
|
+
"api-extractor:esnext": "api-extractor run --local",
|
|
161
152
|
"build": "fluid-build . --task build",
|
|
162
153
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
163
154
|
"build:compile": "fluid-build . --task compile",
|
|
164
155
|
"build:docs": "fluid-build . --task api",
|
|
165
|
-
"build:esnext": "tsc
|
|
166
|
-
"build:test": "
|
|
156
|
+
"build:esnext": "tsc --project ./tsconfig.json",
|
|
157
|
+
"build:test": "npm run build:test:esm && npm run build:test:cjs",
|
|
158
|
+
"build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
|
|
159
|
+
"build:test:esm": "tsc --project ./src/test/tsconfig.json",
|
|
167
160
|
"check:are-the-types-wrong": "attw --pack . --entrypoints .",
|
|
168
161
|
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
169
162
|
"ci:build:docs": "api-extractor run",
|
|
@@ -177,9 +170,11 @@
|
|
|
177
170
|
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
178
171
|
"test": "npm run test:mocha",
|
|
179
172
|
"test:coverage": "c8 npm test",
|
|
180
|
-
"test:mocha": "
|
|
173
|
+
"test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
|
|
174
|
+
"test:mocha:cjs": "mocha --recursive \"dist/test/**/*.spec.*js\" --exit",
|
|
175
|
+
"test:mocha:esm": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit",
|
|
181
176
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
182
|
-
"tsc": "tsc",
|
|
177
|
+
"tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
|
|
183
178
|
"typetests:gen": "fluid-type-test-generator",
|
|
184
179
|
"typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
|
|
185
180
|
}
|
package/src/index.ts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export { LocalDeltaStorageService } from "./localDeltaStorageService";
|
|
7
|
-
export { LocalDocumentDeltaConnection } from "./localDocumentDeltaConnection";
|
|
8
|
-
export { createLocalDocumentService, LocalDocumentService } from "./localDocumentService";
|
|
9
|
-
export { LocalDocumentServiceFactory } from "./localDocumentServiceFactory";
|
|
10
|
-
export { LocalDocumentStorageService } from "./localDocumentStorageService";
|
|
11
|
-
export { createLocalResolverCreateNewRequest, LocalResolver } from "./localResolver";
|
|
12
|
-
export { LocalSessionStorageDbFactory } from "./localSessionStorageDb";
|
|
6
|
+
export { LocalDeltaStorageService } from "./localDeltaStorageService.js";
|
|
7
|
+
export { LocalDocumentDeltaConnection } from "./localDocumentDeltaConnection.js";
|
|
8
|
+
export { createLocalDocumentService, LocalDocumentService } from "./localDocumentService.js";
|
|
9
|
+
export { LocalDocumentServiceFactory } from "./localDocumentServiceFactory.js";
|
|
10
|
+
export { LocalDocumentStorageService } from "./localDocumentStorageService.js";
|
|
11
|
+
export { createLocalResolverCreateNewRequest, LocalResolver } from "./localResolver.js";
|
|
12
|
+
export { LocalSessionStorageDbFactory } from "./localSessionStorageDb.js";
|
|
@@ -19,9 +19,9 @@ import { GitManager } from "@fluidframework/server-services-client";
|
|
|
19
19
|
import { TestHistorian } from "@fluidframework/server-test-utils";
|
|
20
20
|
import { ILocalDeltaConnectionServer } from "@fluidframework/server-local-server";
|
|
21
21
|
import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
22
|
-
import { LocalDocumentStorageService } from "./localDocumentStorageService";
|
|
23
|
-
import { LocalDocumentDeltaConnection } from "./localDocumentDeltaConnection";
|
|
24
|
-
import { LocalDeltaStorageService } from "./localDeltaStorageService";
|
|
22
|
+
import { LocalDocumentStorageService } from "./localDocumentStorageService.js";
|
|
23
|
+
import { LocalDocumentDeltaConnection } from "./localDocumentDeltaConnection.js";
|
|
24
|
+
import { LocalDeltaStorageService } from "./localDeltaStorageService.js";
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Basic implementation of a document service for local use.
|
|
@@ -44,7 +44,7 @@ export class LocalDocumentService
|
|
|
44
44
|
private readonly tenantId: string,
|
|
45
45
|
private readonly documentId: string,
|
|
46
46
|
private readonly documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>,
|
|
47
|
-
public readonly policies: IDocumentServicePolicies = {},
|
|
47
|
+
public readonly policies: IDocumentServicePolicies = { supportGetSnapshotApi: true },
|
|
48
48
|
private readonly innerDocumentService?: IDocumentService,
|
|
49
49
|
private readonly logger?: ITelemetryBaseLogger,
|
|
50
50
|
) {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { parse } from "url";
|
|
7
6
|
import {
|
|
8
7
|
IDocumentService,
|
|
9
8
|
IDocumentServiceFactory,
|
|
@@ -14,9 +13,9 @@ import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
|
14
13
|
import { DefaultTokenProvider } from "@fluidframework/routerlicious-driver";
|
|
15
14
|
import { ILocalDeltaConnectionServer } from "@fluidframework/server-local-server";
|
|
16
15
|
import { ISummaryTree, NackErrorType } from "@fluidframework/protocol-definitions";
|
|
17
|
-
import { LocalDocumentDeltaConnection } from "./localDocumentDeltaConnection";
|
|
18
|
-
import { createLocalDocumentService } from "./localDocumentService";
|
|
19
|
-
import { createDocument } from "./localCreateDocument";
|
|
16
|
+
import { LocalDocumentDeltaConnection } from "./localDocumentDeltaConnection.js";
|
|
17
|
+
import { createLocalDocumentService } from "./localDocumentService.js";
|
|
18
|
+
import { createDocument } from "./localCreateDocument.js";
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* Implementation of document service factory for local use.
|
|
@@ -29,7 +28,6 @@ export class LocalDocumentServiceFactory implements IDocumentServiceFactory {
|
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
30
|
* @param localDeltaConnectionServer - delta connection server for ops
|
|
32
|
-
* @alpha
|
|
33
31
|
*/
|
|
34
32
|
constructor(
|
|
35
33
|
private readonly localDeltaConnectionServer: ILocalDeltaConnectionServer,
|
|
@@ -62,8 +60,8 @@ export class LocalDocumentServiceFactory implements IDocumentServiceFactory {
|
|
|
62
60
|
logger?: ITelemetryBaseLogger,
|
|
63
61
|
clientIsSummarizer?: boolean,
|
|
64
62
|
): Promise<IDocumentService> {
|
|
65
|
-
const parsedUrl =
|
|
66
|
-
const [, tenantId, documentId] = parsedUrl.
|
|
63
|
+
const parsedUrl = new URL(resolvedUrl.url);
|
|
64
|
+
const [, tenantId, documentId] = parsedUrl.pathname ? parsedUrl.pathname.split("/") : [];
|
|
67
65
|
if (!documentId || !tenantId) {
|
|
68
66
|
throw new Error(
|
|
69
67
|
`Couldn't parse resolved url. [documentId:${documentId}][tenantId:${tenantId}]`,
|