@fluidframework/runtime-utils 2.0.0-rc.2.0.2 → 2.0.0-rc.3.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/CHANGELOG.md +23 -0
- package/api-report/runtime-utils.api.md +10 -10
- package/dist/dataStoreHelpers.d.ts +2 -2
- package/dist/dataStoreHelpers.d.ts.map +1 -1
- package/dist/dataStoreHelpers.js +7 -7
- package/dist/dataStoreHelpers.js.map +1 -1
- package/dist/legacy.d.ts +18 -0
- package/dist/objectstoragepartition.js +2 -2
- package/dist/objectstoragepartition.js.map +1 -1
- package/dist/public.d.ts +12 -0
- package/dist/requestParser.d.ts.map +1 -1
- package/dist/requestParser.js +4 -0
- package/dist/requestParser.js.map +1 -1
- package/dist/runtimeFactoryHelper.d.ts +2 -2
- package/dist/runtimeFactoryHelper.d.ts.map +1 -1
- package/dist/runtimeFactoryHelper.js.map +1 -1
- package/dist/summaryUtils.d.ts +4 -3
- package/dist/summaryUtils.d.ts.map +1 -1
- package/dist/summaryUtils.js +7 -7
- package/dist/summaryUtils.js.map +1 -1
- package/dist/unpackUsedRoutes.js +2 -2
- package/dist/unpackUsedRoutes.js.map +1 -1
- package/dist/utils.js +2 -2
- package/dist/utils.js.map +1 -1
- package/internal.d.ts +11 -0
- package/legacy.d.ts +11 -0
- package/lib/dataStoreHelpers.d.ts +2 -2
- package/lib/dataStoreHelpers.d.ts.map +1 -1
- package/lib/dataStoreHelpers.js +3 -3
- package/lib/dataStoreHelpers.js.map +1 -1
- package/lib/legacy.d.ts +18 -0
- package/lib/objectstoragepartition.js +1 -1
- package/lib/objectstoragepartition.js.map +1 -1
- package/lib/public.d.ts +12 -0
- package/lib/requestParser.d.ts.map +1 -1
- package/lib/requestParser.js +4 -0
- package/lib/requestParser.js.map +1 -1
- package/lib/runtimeFactoryHelper.d.ts +2 -2
- package/lib/runtimeFactoryHelper.d.ts.map +1 -1
- package/lib/runtimeFactoryHelper.js.map +1 -1
- package/lib/summaryUtils.d.ts +4 -3
- package/lib/summaryUtils.d.ts.map +1 -1
- package/lib/summaryUtils.js +3 -3
- package/lib/summaryUtils.js.map +1 -1
- package/lib/unpackUsedRoutes.js +1 -1
- package/lib/unpackUsedRoutes.js.map +1 -1
- package/lib/utils.js +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +33 -54
- package/src/dataStoreHelpers.ts +4 -4
- package/src/objectstoragepartition.ts +1 -1
- package/src/requestParser.ts +1 -0
- package/src/runtimeFactoryHelper.ts +2 -2
- package/src/summaryUtils.ts +16 -12
- package/src/unpackUsedRoutes.ts +1 -1
- package/src/utils.ts +1 -1
- package/api-extractor-cjs.json +0 -8
- package/dist/runtime-utils-alpha.d.ts +0 -161
- package/dist/runtime-utils-beta.d.ts +0 -109
- package/dist/runtime-utils-public.d.ts +0 -109
- package/dist/runtime-utils-untrimmed.d.ts +0 -346
- package/lib/runtime-utils-alpha.d.ts +0 -161
- package/lib/runtime-utils-beta.d.ts +0 -109
- package/lib/runtime-utils-public.d.ts +0 -109
- package/lib/runtime-utils-untrimmed.d.ts +0 -346
- package/lib/test/dataStoreHelpers.spec.js +0 -29
- package/lib/test/dataStoreHelpers.spec.js.map +0 -1
- package/lib/test/requestParser.spec.js +0 -111
- package/lib/test/requestParser.spec.js.map +0 -1
- package/lib/test/runtimeFactoryHelper.spec.js +0 -44
- package/lib/test/runtimeFactoryHelper.spec.js.map +0 -1
- package/lib/test/summaryUtils.spec.js +0 -283
- package/lib/test/summaryUtils.spec.js.map +0 -1
- package/lib/test/types/validateRuntimeUtilsPrevious.generated.js +0 -58
- package/lib/test/types/validateRuntimeUtilsPrevious.generated.js.map +0 -1
- package/lib/test/utils.spec.js +0 -65
- package/lib/test/utils.spec.js.map +0 -1
- /package/{dist → lib}/tsdoc-metadata.json +0 -0
|
@@ -1,111 +0,0 @@
|
|
|
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 { RequestParser } from "../requestParser.js";
|
|
7
|
-
describe("RequestParser", () => {
|
|
8
|
-
describe(".getPathParts", () => {
|
|
9
|
-
it("Parse Data Store Id", () => {
|
|
10
|
-
const url = "dataStoreId";
|
|
11
|
-
const pathParts = RequestParser.getPathParts(url);
|
|
12
|
-
assert.strictEqual(pathParts.length, 1);
|
|
13
|
-
assert.strictEqual(pathParts[0], "dataStoreId");
|
|
14
|
-
});
|
|
15
|
-
it("Parse Data Store Id with /", () => {
|
|
16
|
-
const url = "/dataStoreId/";
|
|
17
|
-
const pathParts = RequestParser.getPathParts(url);
|
|
18
|
-
assert.strictEqual(pathParts.length, 1);
|
|
19
|
-
assert.strictEqual(pathParts[0], "dataStoreId");
|
|
20
|
-
});
|
|
21
|
-
it("Parse Data Store Id with query", () => {
|
|
22
|
-
const url = "/dataStoreId/?foo=bar";
|
|
23
|
-
const pathParts = RequestParser.getPathParts(url);
|
|
24
|
-
assert.strictEqual(pathParts.length, 1);
|
|
25
|
-
assert.strictEqual(pathParts[0], "dataStoreId");
|
|
26
|
-
});
|
|
27
|
-
it("Parse Data Store Id with sub route with query", () => {
|
|
28
|
-
const url = "/dataStoreId//some/route?foo=bar";
|
|
29
|
-
const pathParts = RequestParser.getPathParts(url);
|
|
30
|
-
assert.strictEqual(pathParts.length, 3);
|
|
31
|
-
assert.strictEqual(pathParts[0], "dataStoreId");
|
|
32
|
-
assert.strictEqual(pathParts[1], "some");
|
|
33
|
-
assert.strictEqual(pathParts[2], "route");
|
|
34
|
-
});
|
|
35
|
-
it("Parse encoded Data Store Id", () => {
|
|
36
|
-
const url = "data%20store%20Id";
|
|
37
|
-
const pathParts = RequestParser.getPathParts(url);
|
|
38
|
-
assert.strictEqual(pathParts.length, 1);
|
|
39
|
-
assert.strictEqual(pathParts[0], "data store Id");
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
describe(".createSubRequest with special characters", () => {
|
|
43
|
-
let requestParser;
|
|
44
|
-
beforeEach(() => {
|
|
45
|
-
requestParser = RequestParser.create({ url: "//dataStoreId!@//some!@//route!@//" });
|
|
46
|
-
});
|
|
47
|
-
it("Create request from part 0", () => {
|
|
48
|
-
assert.strictEqual(requestParser.createSubRequest(0).url, "/dataStoreId!@/some!@/route!@");
|
|
49
|
-
});
|
|
50
|
-
it("Create request from part 1", () => {
|
|
51
|
-
assert.strictEqual(requestParser.createSubRequest(1).url, "/some!@/route!@");
|
|
52
|
-
});
|
|
53
|
-
it("Create request from part 2", () => {
|
|
54
|
-
assert.strictEqual(requestParser.createSubRequest(2).url, "/route!@");
|
|
55
|
-
});
|
|
56
|
-
it("Create request from parts length ", () => {
|
|
57
|
-
assert.strictEqual(requestParser.createSubRequest(3).url, "/");
|
|
58
|
-
});
|
|
59
|
-
it("Create request from invalid part ", () => {
|
|
60
|
-
assert.throws(() => requestParser.createSubRequest(4));
|
|
61
|
-
assert.throws(() => requestParser.createSubRequest(-1));
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
describe(".createSubRequest with special urls", () => {
|
|
65
|
-
it("Create request for `/`", () => {
|
|
66
|
-
const testRequestParser = RequestParser.create({ url: "/" });
|
|
67
|
-
assert.strictEqual(testRequestParser.createSubRequest(0).url, "/");
|
|
68
|
-
assert.throws(() => testRequestParser.createSubRequest(1));
|
|
69
|
-
assert.throws(() => testRequestParser.createSubRequest(-1));
|
|
70
|
-
});
|
|
71
|
-
it("Create request from empty string", () => {
|
|
72
|
-
const testRequestParser = RequestParser.create({ url: "" });
|
|
73
|
-
assert.strictEqual(testRequestParser.createSubRequest(0).url, "/");
|
|
74
|
-
assert.throws(() => testRequestParser.createSubRequest(1));
|
|
75
|
-
assert.throws(() => testRequestParser.createSubRequest(-1));
|
|
76
|
-
});
|
|
77
|
-
it("Create request for just query params", () => {
|
|
78
|
-
const testRequestParser = RequestParser.create({ url: "/?query" });
|
|
79
|
-
assert.strictEqual(testRequestParser.createSubRequest(0).url, "/?query");
|
|
80
|
-
assert.throws(() => testRequestParser.createSubRequest(1));
|
|
81
|
-
assert.throws(() => testRequestParser.createSubRequest(-1));
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
const testSubRequest = function (uri) {
|
|
85
|
-
describe(".createSubRequest with query params", () => {
|
|
86
|
-
let requestParser2;
|
|
87
|
-
beforeEach(() => {
|
|
88
|
-
requestParser2 = RequestParser.create({ url: uri });
|
|
89
|
-
});
|
|
90
|
-
it("Create request from part 0", () => {
|
|
91
|
-
assert.strictEqual(requestParser2.createSubRequest(0).url, "/dataStoreId/some/route/?query1=1&query2=2");
|
|
92
|
-
});
|
|
93
|
-
it("Create request from part 1", () => {
|
|
94
|
-
assert.strictEqual(requestParser2.createSubRequest(1).url, "/some/route/?query1=1&query2=2");
|
|
95
|
-
});
|
|
96
|
-
it("Create request from part 2", () => {
|
|
97
|
-
assert.strictEqual(requestParser2.createSubRequest(2).url, "/route/?query1=1&query2=2");
|
|
98
|
-
});
|
|
99
|
-
it("Create request from parts length", () => {
|
|
100
|
-
assert.strictEqual(requestParser2.createSubRequest(3).url, "/?query1=1&query2=2");
|
|
101
|
-
});
|
|
102
|
-
it("Create request from invalid part ", () => {
|
|
103
|
-
assert.throws(() => requestParser2.createSubRequest(4));
|
|
104
|
-
assert.throws(() => requestParser2.createSubRequest(-1));
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
testSubRequest("/dataStoreId/some/route/?query1=1&query2=2");
|
|
109
|
-
testSubRequest("dataStoreId/some/route/?query1=1&query2=2");
|
|
110
|
-
});
|
|
111
|
-
//# sourceMappingURL=requestParser.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"requestParser.spec.js","sourceRoot":"","sources":["../../src/test/requestParser.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ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AAE,GAAG,EAAE;gBACrC,MAAM,CAAC,WAAW,CACjB,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,EACtC,4CAA4C,CAC5C,CAAC;YACH,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;gBACrC,MAAM,CAAC,WAAW,CACjB,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,EACtC,gCAAgC,CAChC,CAAC;YACH,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;gBACrC,MAAM,CAAC,WAAW,CACjB,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,EACtC,2BAA2B,CAC3B,CAAC;YACH,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;gBAC3C,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC;YACnF,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;gBAC5C,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;gBACxD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1D,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;IACF,cAAc,CAAC,4CAA4C,CAAC,CAAC;IAC7D,cAAc,CAAC,2CAA2C,CAAC,CAAC;AAC7D,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 { RequestParser } from \"../requestParser.js\";\n\ndescribe(\"RequestParser\", () => {\n\tdescribe(\".getPathParts\", () => {\n\t\tit(\"Parse Data Store Id\", () => {\n\t\t\tconst url = \"dataStoreId\";\n\t\t\tconst pathParts = RequestParser.getPathParts(url);\n\t\t\tassert.strictEqual(pathParts.length, 1);\n\t\t\tassert.strictEqual(pathParts[0], \"dataStoreId\");\n\t\t});\n\t\tit(\"Parse Data Store Id with /\", () => {\n\t\t\tconst url = \"/dataStoreId/\";\n\t\t\tconst pathParts = RequestParser.getPathParts(url);\n\t\t\tassert.strictEqual(pathParts.length, 1);\n\t\t\tassert.strictEqual(pathParts[0], \"dataStoreId\");\n\t\t});\n\t\tit(\"Parse Data Store Id with query\", () => {\n\t\t\tconst url = \"/dataStoreId/?foo=bar\";\n\t\t\tconst pathParts = RequestParser.getPathParts(url);\n\t\t\tassert.strictEqual(pathParts.length, 1);\n\t\t\tassert.strictEqual(pathParts[0], \"dataStoreId\");\n\t\t});\n\t\tit(\"Parse Data Store Id with sub route with query\", () => {\n\t\t\tconst url = \"/dataStoreId//some/route?foo=bar\";\n\t\t\tconst pathParts = RequestParser.getPathParts(url);\n\t\t\tassert.strictEqual(pathParts.length, 3);\n\t\t\tassert.strictEqual(pathParts[0], \"dataStoreId\");\n\t\t\tassert.strictEqual(pathParts[1], \"some\");\n\t\t\tassert.strictEqual(pathParts[2], \"route\");\n\t\t});\n\t\tit(\"Parse encoded Data Store Id\", () => {\n\t\t\tconst url = \"data%20store%20Id\";\n\t\t\tconst pathParts = RequestParser.getPathParts(url);\n\t\t\tassert.strictEqual(pathParts.length, 1);\n\t\t\tassert.strictEqual(pathParts[0], \"data store Id\");\n\t\t});\n\t});\n\tdescribe(\".createSubRequest with special characters\", () => {\n\t\tlet requestParser: RequestParser;\n\t\tbeforeEach(() => {\n\t\t\trequestParser = RequestParser.create({ url: \"//dataStoreId!@//some!@//route!@//\" });\n\t\t});\n\t\tit(\"Create request from part 0\", () => {\n\t\t\tassert.strictEqual(\n\t\t\t\trequestParser.createSubRequest(0).url,\n\t\t\t\t\"/dataStoreId!@/some!@/route!@\",\n\t\t\t);\n\t\t});\n\t\tit(\"Create request from part 1\", () => {\n\t\t\tassert.strictEqual(requestParser.createSubRequest(1).url, \"/some!@/route!@\");\n\t\t});\n\t\tit(\"Create request from part 2\", () => {\n\t\t\tassert.strictEqual(requestParser.createSubRequest(2).url, \"/route!@\");\n\t\t});\n\t\tit(\"Create request from parts length \", () => {\n\t\t\tassert.strictEqual(requestParser.createSubRequest(3).url, \"/\");\n\t\t});\n\t\tit(\"Create request from invalid part \", () => {\n\t\t\tassert.throws(() => requestParser.createSubRequest(4));\n\t\t\tassert.throws(() => requestParser.createSubRequest(-1));\n\t\t});\n\t});\n\n\tdescribe(\".createSubRequest with special urls\", () => {\n\t\tit(\"Create request for `/`\", () => {\n\t\t\tconst testRequestParser = RequestParser.create({ url: \"/\" });\n\t\t\tassert.strictEqual(testRequestParser.createSubRequest(0).url, \"/\");\n\t\t\tassert.throws(() => testRequestParser.createSubRequest(1));\n\t\t\tassert.throws(() => testRequestParser.createSubRequest(-1));\n\t\t});\n\t\tit(\"Create request from empty string\", () => {\n\t\t\tconst testRequestParser = RequestParser.create({ url: \"\" });\n\t\t\tassert.strictEqual(testRequestParser.createSubRequest(0).url, \"/\");\n\t\t\tassert.throws(() => testRequestParser.createSubRequest(1));\n\t\t\tassert.throws(() => testRequestParser.createSubRequest(-1));\n\t\t});\n\t\tit(\"Create request for just query params\", () => {\n\t\t\tconst testRequestParser = RequestParser.create({ url: \"/?query\" });\n\t\t\tassert.strictEqual(testRequestParser.createSubRequest(0).url, \"/?query\");\n\t\t\tassert.throws(() => testRequestParser.createSubRequest(1));\n\t\t\tassert.throws(() => testRequestParser.createSubRequest(-1));\n\t\t});\n\t});\n\n\tconst testSubRequest = function (uri: string) {\n\t\tdescribe(\".createSubRequest with query params\", () => {\n\t\t\tlet requestParser2: RequestParser;\n\t\t\tbeforeEach(() => {\n\t\t\t\trequestParser2 = RequestParser.create({ url: uri });\n\t\t\t});\n\t\t\tit(\"Create request from part 0\", () => {\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\trequestParser2.createSubRequest(0).url,\n\t\t\t\t\t\"/dataStoreId/some/route/?query1=1&query2=2\",\n\t\t\t\t);\n\t\t\t});\n\t\t\tit(\"Create request from part 1\", () => {\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\trequestParser2.createSubRequest(1).url,\n\t\t\t\t\t\"/some/route/?query1=1&query2=2\",\n\t\t\t\t);\n\t\t\t});\n\t\t\tit(\"Create request from part 2\", () => {\n\t\t\t\tassert.strictEqual(\n\t\t\t\t\trequestParser2.createSubRequest(2).url,\n\t\t\t\t\t\"/route/?query1=1&query2=2\",\n\t\t\t\t);\n\t\t\t});\n\t\t\tit(\"Create request from parts length\", () => {\n\t\t\t\tassert.strictEqual(requestParser2.createSubRequest(3).url, \"/?query1=1&query2=2\");\n\t\t\t});\n\t\t\tit(\"Create request from invalid part \", () => {\n\t\t\t\tassert.throws(() => requestParser2.createSubRequest(4));\n\t\t\t\tassert.throws(() => requestParser2.createSubRequest(-1));\n\t\t\t});\n\t\t});\n\t};\n\ttestSubRequest(\"/dataStoreId/some/route/?query1=1&query2=2\");\n\ttestSubRequest(\"dataStoreId/some/route/?query1=1&query2=2\");\n});\n"]}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import Sinon from "sinon";
|
|
6
|
-
import { RuntimeFactoryHelper } from "../runtimeFactoryHelper.js";
|
|
7
|
-
class TestRuntimeFactoryHelper extends RuntimeFactoryHelper {
|
|
8
|
-
constructor(runtime) {
|
|
9
|
-
super();
|
|
10
|
-
this.runtime = runtime;
|
|
11
|
-
}
|
|
12
|
-
async preInitialize(_context, _existing) {
|
|
13
|
-
return this.runtime;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
describe("RuntimeFactoryHelper", () => {
|
|
17
|
-
const sandbox = Sinon.createSandbox();
|
|
18
|
-
const context = {};
|
|
19
|
-
const runtime = {};
|
|
20
|
-
let helper;
|
|
21
|
-
let unit;
|
|
22
|
-
beforeEach(() => {
|
|
23
|
-
helper = new TestRuntimeFactoryHelper(runtime);
|
|
24
|
-
unit = sandbox.mock(helper);
|
|
25
|
-
unit.expects("preInitialize").once();
|
|
26
|
-
unit.expects("hasInitialized").once();
|
|
27
|
-
});
|
|
28
|
-
afterEach(() => {
|
|
29
|
-
sandbox.restore();
|
|
30
|
-
});
|
|
31
|
-
it("Instantiate when existing flag is `true`", async () => {
|
|
32
|
-
unit.expects("instantiateFirstTime").never();
|
|
33
|
-
unit.expects("instantiateFromExisting").once();
|
|
34
|
-
await helper.instantiateRuntime(context, /* existing */ true);
|
|
35
|
-
unit.verify();
|
|
36
|
-
});
|
|
37
|
-
it("Instantiate when existing flag is `false`", async () => {
|
|
38
|
-
unit.expects("instantiateFirstTime").once();
|
|
39
|
-
unit.expects("instantiateFromExisting").never();
|
|
40
|
-
await helper.instantiateRuntime(context, /* existing */ false);
|
|
41
|
-
unit.verify();
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
//# sourceMappingURL=runtimeFactoryHelper.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeFactoryHelper.spec.js","sourceRoot":"","sources":["../../src/test/runtimeFactoryHelper.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,wBAAyB,SAAQ,oBAAoB;IAC1D,YAA6B,OAAqC;QACjE,KAAK,EAAE,CAAC;QADoB,YAAO,GAAP,OAAO,CAA8B;IAElE,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,QAA2B,EAC3B,SAAkB;QAElB,OAAO,IAAI,CAAC,OAAO,CAAC;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AK,CAAC,CAAC;QAEpF,IAAI,CAAC,MAAM,EAAE,CAAC;IACf,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 { IContainerContext, IRuntime } from \"@fluidframework/container-definitions\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport Sinon from \"sinon\";\nimport { RuntimeFactoryHelper } from \"../runtimeFactoryHelper.js\";\n\nclass TestRuntimeFactoryHelper extends RuntimeFactoryHelper {\n\tconstructor(private readonly runtime: IRuntime & IContainerRuntime) {\n\t\tsuper();\n\t}\n\n\tpublic async preInitialize(\n\t\t_context: IContainerContext,\n\t\t_existing: boolean,\n\t): Promise<IRuntime & IContainerRuntime> {\n\t\treturn this.runtime;\n\t}\n}\n\ndescribe(\"RuntimeFactoryHelper\", () => {\n\tconst sandbox: Sinon.SinonSandbox = Sinon.createSandbox();\n\tconst context: Partial<IContainerContext> = {};\n\tconst runtime: Partial<IRuntime & IContainerRuntime> = {};\n\tlet helper: TestRuntimeFactoryHelper;\n\tlet unit: Sinon.SinonMock;\n\n\tbeforeEach(() => {\n\t\thelper = new TestRuntimeFactoryHelper(runtime as IRuntime & IContainerRuntime);\n\t\tunit = sandbox.mock(helper);\n\t\tunit.expects(\"preInitialize\").once();\n\t\tunit.expects(\"hasInitialized\").once();\n\t});\n\n\tafterEach(() => {\n\t\tsandbox.restore();\n\t});\n\n\tit(\"Instantiate when existing flag is `true`\", async () => {\n\t\tunit.expects(\"instantiateFirstTime\").never();\n\t\tunit.expects(\"instantiateFromExisting\").once();\n\t\tawait helper.instantiateRuntime(context as IContainerContext, /* existing */ true);\n\n\t\tunit.verify();\n\t});\n\n\tit(\"Instantiate when existing flag is `false`\", async () => {\n\t\tunit.expects(\"instantiateFirstTime\").once();\n\t\tunit.expects(\"instantiateFromExisting\").never();\n\t\tawait helper.instantiateRuntime(context as IContainerContext, /* existing */ false);\n\n\t\tunit.verify();\n\t});\n});\n"]}
|
|
@@ -1,283 +0,0 @@
|
|
|
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 { IsoBuffer, stringToBuffer, Uint8ArrayToString } from "@fluid-internal/client-utils";
|
|
7
|
-
import { BlobTreeEntry, TreeTreeEntry } from "@fluidframework/driver-utils";
|
|
8
|
-
import { SummaryType, } from "@fluidframework/protocol-definitions";
|
|
9
|
-
import { convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, convertToSummaryTree, TelemetryContext, utf8ByteLength, } from "../summaryUtils.js";
|
|
10
|
-
describe("Summary Utils", () => {
|
|
11
|
-
function assertSummaryTree(obj) {
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
13
|
-
if (obj && obj.type === SummaryType.Tree) {
|
|
14
|
-
return obj;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
assert.fail("Object should be summary tree");
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function assertSummaryBlob(obj) {
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
22
|
-
if (obj && obj.type === SummaryType.Blob) {
|
|
23
|
-
return obj;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
assert.fail("Object should be summary blob");
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function assertSummaryHandle(obj) {
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
31
|
-
if (obj && obj.type === SummaryType.Handle) {
|
|
32
|
-
return obj;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
assert.fail("Object should be summary handle");
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
describe("ITree <-> ISummaryTree", () => {
|
|
39
|
-
let tree;
|
|
40
|
-
beforeEach(() => {
|
|
41
|
-
const base64Content = IsoBuffer.from("test-b64").toString("base64");
|
|
42
|
-
tree = {
|
|
43
|
-
entries: [
|
|
44
|
-
new TreeTreeEntry("t", {
|
|
45
|
-
entries: [
|
|
46
|
-
new BlobTreeEntry("bu8", "test-u8"),
|
|
47
|
-
new BlobTreeEntry("b64", base64Content, "base64"),
|
|
48
|
-
new TreeTreeEntry("tu", {
|
|
49
|
-
entries: [],
|
|
50
|
-
unreferenced: true,
|
|
51
|
-
groupId: undefined,
|
|
52
|
-
}),
|
|
53
|
-
],
|
|
54
|
-
unreferenced: undefined,
|
|
55
|
-
groupId: undefined,
|
|
56
|
-
}),
|
|
57
|
-
new BlobTreeEntry("b", "test-blob"),
|
|
58
|
-
new TreeTreeEntry("h", {
|
|
59
|
-
id: "test-handle",
|
|
60
|
-
entries: [new BlobTreeEntry("ignore", "this-should-be-ignored")],
|
|
61
|
-
}),
|
|
62
|
-
new TreeTreeEntry("unref", {
|
|
63
|
-
entries: [],
|
|
64
|
-
unreferenced: true,
|
|
65
|
-
groupId: undefined,
|
|
66
|
-
}),
|
|
67
|
-
new TreeTreeEntry("groupId", {
|
|
68
|
-
entries: [],
|
|
69
|
-
unreferenced: undefined,
|
|
70
|
-
groupId: "group-id",
|
|
71
|
-
}),
|
|
72
|
-
],
|
|
73
|
-
unreferenced: undefined,
|
|
74
|
-
groupId: undefined,
|
|
75
|
-
};
|
|
76
|
-
});
|
|
77
|
-
it("Should convert ITree to ISummaryTree correctly", () => {
|
|
78
|
-
const summaryResults = convertToSummaryTree(tree);
|
|
79
|
-
const summaryTree = assertSummaryTree(summaryResults.summary);
|
|
80
|
-
// blobs should parse
|
|
81
|
-
const blob = assertSummaryBlob(summaryTree.tree.b);
|
|
82
|
-
assert.strictEqual(blob.content, "test-blob");
|
|
83
|
-
// trees with ids should become handles
|
|
84
|
-
const handle = assertSummaryHandle(summaryTree.tree.h);
|
|
85
|
-
assert.strictEqual(handle.handleType, SummaryType.Tree);
|
|
86
|
-
assert.strictEqual(handle.handle, "test-handle");
|
|
87
|
-
// subtrees should recurse
|
|
88
|
-
const subTree = assertSummaryTree(summaryTree.tree.t);
|
|
89
|
-
const subBlobUtf8 = assertSummaryBlob(subTree.tree.bu8);
|
|
90
|
-
assert.strictEqual(subBlobUtf8.content, "test-u8");
|
|
91
|
-
const subBlobBase64 = assertSummaryBlob(subTree.tree.b64);
|
|
92
|
-
assert.strictEqual(Uint8ArrayToString(subBlobBase64.content), "test-b64");
|
|
93
|
-
const subTreeUnref = assertSummaryTree(subTree.tree.tu);
|
|
94
|
-
assert.strictEqual(Object.keys(subTreeUnref.tree).length, 0, "There should be no entries in tu subtree");
|
|
95
|
-
});
|
|
96
|
-
it("Should convert ITree to ISummaryTree correctly with fullTree enabled", () => {
|
|
97
|
-
const summaryResults = convertToSummaryTree(tree, true);
|
|
98
|
-
const summaryTree = assertSummaryTree(summaryResults.summary);
|
|
99
|
-
// blobs should parse
|
|
100
|
-
const blob = assertSummaryBlob(summaryTree.tree.b);
|
|
101
|
-
assert.strictEqual(blob.content, "test-blob");
|
|
102
|
-
// trees with ids should not become handles
|
|
103
|
-
const usuallyIgnoredSubtree = assertSummaryTree(summaryTree.tree.h);
|
|
104
|
-
const usuallyIgnoredBlob = assertSummaryBlob(usuallyIgnoredSubtree.tree.ignore);
|
|
105
|
-
assert.strictEqual(usuallyIgnoredBlob.content, "this-should-be-ignored");
|
|
106
|
-
// subtrees should recurse
|
|
107
|
-
const subTree = assertSummaryTree(summaryTree.tree.t);
|
|
108
|
-
const subBlobUtf8 = assertSummaryBlob(subTree.tree.bu8);
|
|
109
|
-
assert.strictEqual(subBlobUtf8.content, "test-u8");
|
|
110
|
-
const subBlobBase64 = assertSummaryBlob(subTree.tree.b64);
|
|
111
|
-
assert.strictEqual(Uint8ArrayToString(subBlobBase64.content), "test-b64");
|
|
112
|
-
const subUnrefTree = assertSummaryTree(subTree.tree.tu);
|
|
113
|
-
assert.strictEqual(Object.keys(subUnrefTree.tree).length, 0, "There should be no entries in tu subtree");
|
|
114
|
-
});
|
|
115
|
-
it("Should calculate summary data correctly", () => {
|
|
116
|
-
const summaryResults = convertToSummaryTree(tree);
|
|
117
|
-
// nodes should count
|
|
118
|
-
assert.strictEqual(summaryResults.stats.blobNodeCount, 3);
|
|
119
|
-
assert.strictEqual(summaryResults.stats.handleNodeCount, 1);
|
|
120
|
-
assert.strictEqual(summaryResults.stats.treeNodeCount, 5);
|
|
121
|
-
const bufferLength = IsoBuffer.from("test-b64").byteLength +
|
|
122
|
-
IsoBuffer.from("test-blob").byteLength +
|
|
123
|
-
IsoBuffer.from("test-u8").byteLength;
|
|
124
|
-
assert.strictEqual(summaryResults.stats.totalBlobSize, bufferLength);
|
|
125
|
-
});
|
|
126
|
-
it("should convert unreferenced state correctly", () => {
|
|
127
|
-
const summaryResults = convertToSummaryTree(tree);
|
|
128
|
-
const summaryTree = assertSummaryTree(summaryResults.summary);
|
|
129
|
-
assert.strictEqual(summaryTree.unreferenced, undefined, "The root summary tree should be referenced");
|
|
130
|
-
const subTreeT = assertSummaryTree(summaryTree.tree.t);
|
|
131
|
-
assert.strictEqual(subTreeT.unreferenced, undefined, "The t subtree should be referenced");
|
|
132
|
-
const subTreeTUnrefTree = assertSummaryTree(subTreeT.tree.tu);
|
|
133
|
-
assert.strictEqual(subTreeTUnrefTree.unreferenced, true, "The tu subtree of t should be referenced");
|
|
134
|
-
const subTreeUnref = assertSummaryTree(summaryTree.tree.unref);
|
|
135
|
-
assert.strictEqual(subTreeUnref.unreferenced, true, "The unref subtree should be unreferenced");
|
|
136
|
-
});
|
|
137
|
-
it("should convert ISummaryTree to ITree correctly", () => {
|
|
138
|
-
// convertSummaryTreeToITree API does not accept a tree with handles. So, remove handles from the ITree.
|
|
139
|
-
const treeWithoutHandles = {
|
|
140
|
-
entries: tree.entries.filter((treeEntry) => {
|
|
141
|
-
return treeEntry.path !== "h";
|
|
142
|
-
}),
|
|
143
|
-
unreferenced: undefined,
|
|
144
|
-
groupId: undefined,
|
|
145
|
-
};
|
|
146
|
-
const summaryResults = convertToSummaryTree(treeWithoutHandles);
|
|
147
|
-
const summaryTree = assertSummaryTree(summaryResults.summary);
|
|
148
|
-
// Covert the ISummaryTree back to ITree and validate that it matches with the original tree.
|
|
149
|
-
const iTree = convertSummaryTreeToITree(summaryTree);
|
|
150
|
-
assert.deepStrictEqual(treeWithoutHandles, iTree, "Could not covert back to ITree correctly");
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
describe("ISnapshotTree -> ISummaryTree", () => {
|
|
154
|
-
let snapshotTree;
|
|
155
|
-
beforeEach(() => {
|
|
156
|
-
snapshotTree = {
|
|
157
|
-
blobs: {
|
|
158
|
-
"b": "blob-b",
|
|
159
|
-
"blob-b": IsoBuffer.from("test-blob").toString("base64"),
|
|
160
|
-
},
|
|
161
|
-
trees: {
|
|
162
|
-
t: {
|
|
163
|
-
blobs: {
|
|
164
|
-
"bu8": "blob-bu8",
|
|
165
|
-
"blob-bu8": IsoBuffer.from("test-u8").toString("base64"),
|
|
166
|
-
"b64": "blob-b64",
|
|
167
|
-
"blob-b64": IsoBuffer.from("test-b64").toString("base64"),
|
|
168
|
-
},
|
|
169
|
-
trees: {
|
|
170
|
-
tu: {
|
|
171
|
-
blobs: {},
|
|
172
|
-
trees: {},
|
|
173
|
-
unreferenced: true,
|
|
174
|
-
groupId: undefined,
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
unref: {
|
|
179
|
-
blobs: {},
|
|
180
|
-
trees: {},
|
|
181
|
-
unreferenced: true,
|
|
182
|
-
groupId: undefined,
|
|
183
|
-
},
|
|
184
|
-
groupId: {
|
|
185
|
-
blobs: {},
|
|
186
|
-
trees: {},
|
|
187
|
-
unreferenced: true,
|
|
188
|
-
groupId: "group-id",
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
};
|
|
192
|
-
});
|
|
193
|
-
it("Should convert correctly", () => {
|
|
194
|
-
const summaryResults = convertSnapshotTreeToSummaryTree(snapshotTree);
|
|
195
|
-
const summaryTree = assertSummaryTree(summaryResults.summary);
|
|
196
|
-
// blobs should parse
|
|
197
|
-
const blob = assertSummaryBlob(summaryTree.tree.b);
|
|
198
|
-
assert.strictEqual(blob.content, "test-blob");
|
|
199
|
-
// subtrees should recurse
|
|
200
|
-
const subTree = assertSummaryTree(summaryTree.tree.t);
|
|
201
|
-
const subBlobUtf8 = assertSummaryBlob(subTree.tree.bu8);
|
|
202
|
-
assert.strictEqual(subBlobUtf8.content, "test-u8");
|
|
203
|
-
const subBlobBase64 = assertSummaryBlob(subTree.tree.b64);
|
|
204
|
-
assert.strictEqual(Uint8ArrayToString(subBlobBase64.content), "test-b64");
|
|
205
|
-
const subTreeUnref = assertSummaryTree(subTree.tree.tu);
|
|
206
|
-
assert.strictEqual(Object.keys(subTreeUnref.tree).length, 0, "There should be no entries in tu subtree");
|
|
207
|
-
});
|
|
208
|
-
it("Should calculate summary data correctly", () => {
|
|
209
|
-
const summaryResults = convertSnapshotTreeToSummaryTree(snapshotTree);
|
|
210
|
-
// nodes should count
|
|
211
|
-
assert.strictEqual(summaryResults.stats.blobNodeCount, 3);
|
|
212
|
-
assert.strictEqual(summaryResults.stats.handleNodeCount, 0);
|
|
213
|
-
assert.strictEqual(summaryResults.stats.treeNodeCount, 5);
|
|
214
|
-
const bufferLength = IsoBuffer.from("test-b64").byteLength +
|
|
215
|
-
IsoBuffer.from("test-blob").byteLength +
|
|
216
|
-
IsoBuffer.from("test-u8").byteLength;
|
|
217
|
-
assert.strictEqual(summaryResults.stats.totalBlobSize, bufferLength);
|
|
218
|
-
});
|
|
219
|
-
it("should convert unreferenced state correctly", () => {
|
|
220
|
-
const summaryResults = convertSnapshotTreeToSummaryTree(snapshotTree);
|
|
221
|
-
const summaryTree = assertSummaryTree(summaryResults.summary);
|
|
222
|
-
assert.strictEqual(summaryTree.unreferenced, undefined, "The root summary tree should be referenced");
|
|
223
|
-
const subTreeT = assertSummaryTree(summaryTree.tree.t);
|
|
224
|
-
assert.strictEqual(subTreeT.unreferenced, undefined, "The t subtree should be referenced");
|
|
225
|
-
const subTreeTUnrefTree = assertSummaryTree(subTreeT.tree.tu);
|
|
226
|
-
assert.strictEqual(subTreeTUnrefTree.unreferenced, true, "The tu subtree of t should be referenced");
|
|
227
|
-
const subTreeUnref = assertSummaryTree(summaryTree.tree.unref);
|
|
228
|
-
assert.strictEqual(subTreeUnref.unreferenced, true, "The unref subtree should be unreferenced");
|
|
229
|
-
});
|
|
230
|
-
it("should convert groupId state correctly", () => {
|
|
231
|
-
const summaryResults = convertSnapshotTreeToSummaryTree(snapshotTree);
|
|
232
|
-
const summaryTree = assertSummaryTree(summaryResults.summary);
|
|
233
|
-
assert.strictEqual(summaryTree.groupId, undefined, "The root summary tree should not have groupId");
|
|
234
|
-
const subTreeT = assertSummaryTree(summaryTree.tree.t);
|
|
235
|
-
assert.strictEqual(subTreeT.groupId, undefined, "The t subtree not have groupId");
|
|
236
|
-
const subTreeTUnrefTree = assertSummaryTree(subTreeT.tree.tu);
|
|
237
|
-
assert.strictEqual(subTreeTUnrefTree.groupId, undefined, "The tu subtree of t not have groupId");
|
|
238
|
-
const subTreeUnref = assertSummaryTree(summaryTree.tree.unref);
|
|
239
|
-
assert.strictEqual(subTreeUnref.groupId, undefined, "The groupId should not be set");
|
|
240
|
-
const subTreeGroupId = assertSummaryTree(summaryTree.tree.groupId);
|
|
241
|
-
assert.strictEqual(subTreeGroupId.groupId, "group-id", "The groupId should be set");
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
describe("utf8ByteLength()", () => {
|
|
245
|
-
it("gives correct utf8 byte length", () => {
|
|
246
|
-
const a = [
|
|
247
|
-
"prague is a city in europe",
|
|
248
|
-
"ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ",
|
|
249
|
-
"Τὴ γλῶσσα μοῦ ἔδωσαν ἑλληνικὴ",
|
|
250
|
-
"На берегу пустынных волн",
|
|
251
|
-
"⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑",
|
|
252
|
-
"أنا قادر على أكل الزجاج و هذا لا يؤلمني.",
|
|
253
|
-
" 我能吞下玻璃而不傷身體。",
|
|
254
|
-
"ᐊᓕᒍᖅ ᓂᕆᔭᕌᖓᒃᑯ ᓱᕋᙱᑦᑐᓐᓇᖅᑐᖓ",
|
|
255
|
-
"🤦🏼♂️",
|
|
256
|
-
"🏴",
|
|
257
|
-
"���",
|
|
258
|
-
"������",
|
|
259
|
-
];
|
|
260
|
-
a.map((s) => assert.strictEqual(utf8ByteLength(s), stringToBuffer(s, "utf8").byteLength, s));
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
describe("TelemetryContext", () => {
|
|
264
|
-
it("Should serialize properly", () => {
|
|
265
|
-
const telemetryContext = new TelemetryContext();
|
|
266
|
-
telemetryContext.set("pre1_", "prop1", 10);
|
|
267
|
-
telemetryContext.set("pre2_", "prop1", "10");
|
|
268
|
-
telemetryContext.set("pre2_", "prop2", true);
|
|
269
|
-
telemetryContext.set("pre1_", "prop2", undefined);
|
|
270
|
-
telemetryContext.setMultiple("pre3_", "obj1", { prop1: "1", prop2: 2, prop3: true });
|
|
271
|
-
const serialized = telemetryContext.serialize();
|
|
272
|
-
const obj = JSON.parse(serialized);
|
|
273
|
-
assert.strictEqual(obj.pre1_prop1, 10);
|
|
274
|
-
assert.strictEqual(obj.pre1_prop2, undefined);
|
|
275
|
-
assert.strictEqual(obj.pre2_prop1, "10");
|
|
276
|
-
assert.strictEqual(obj.pre2_prop2, true);
|
|
277
|
-
assert.strictEqual(obj.pre3_obj1_prop1, "1");
|
|
278
|
-
assert.strictEqual(obj.pre3_obj1_prop2, 2);
|
|
279
|
-
assert.strictEqual(obj.pre3_obj1_prop3, true);
|
|
280
|
-
});
|
|
281
|
-
});
|
|
282
|
-
});
|
|
283
|
-
//# sourceMappingURL=summaryUtils.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"summaryUtils.spec.js","sourceRoot":"","sources":["../../src/test/summaryUtils.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAKN,WAAW,GAGX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACN,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,GACd,MAAM,oBAAoB,CAAC;AAE5B,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC9B,SAAS,iBAAiB,CAAC,GAAkB;QAC5C,yEAAyE;QACzE,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,EAAE;YACzC,OAAO,GAAG,CAAC;SACX;aAAM;YACN,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;SAC7C;IACF,CAAC;IACD,SAAS,iBAAiB,CAAC,GAAkB;QAC5C,yEAAyE;QACzE,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,EAAE;YACzC,OAAO,GAAG,CAAC;SACX;aAAM;YACN,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;SAC7C;IACF,CAAC;IACD,SAAS,mBAAmB,CAAC,GAAkB;QAC9C,yEAAyE;QACzE,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,CAA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E,OAAO,EAAE,IAAI,CAAC,CAAC;YAC7C,gBAAgB,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YAC7C,gBAAgB,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAClD,gBAAgB,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAErF,MAAM,UAAU,GAAG,gBAAgB,CAAC,SAAS,EAAE,CAAC;YAEhD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAEnC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YACvC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YAC9C,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YACzC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YACzC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;YAC7C,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;YAC3C,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QAC/C,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 { IsoBuffer, stringToBuffer, Uint8ArrayToString } from \"@fluid-internal/client-utils\";\nimport { BlobTreeEntry, TreeTreeEntry } from \"@fluidframework/driver-utils\";\nimport {\n\tSummaryObject,\n\tISummaryTree,\n\tISummaryBlob,\n\tISummaryHandle,\n\tSummaryType,\n\tISnapshotTree,\n\tITree,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"../summaryUtils.js\";\n\ndescribe(\"Summary Utils\", () => {\n\tfunction assertSummaryTree(obj: SummaryObject): ISummaryTree {\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tif (obj && obj.type === SummaryType.Tree) {\n\t\t\treturn obj;\n\t\t} else {\n\t\t\tassert.fail(\"Object should be summary tree\");\n\t\t}\n\t}\n\tfunction assertSummaryBlob(obj: SummaryObject): ISummaryBlob {\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tif (obj && obj.type === SummaryType.Blob) {\n\t\t\treturn obj;\n\t\t} else {\n\t\t\tassert.fail(\"Object should be summary blob\");\n\t\t}\n\t}\n\tfunction assertSummaryHandle(obj: SummaryObject): ISummaryHandle {\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tif (obj && obj.type === SummaryType.Handle) {\n\t\t\treturn obj;\n\t\t} else {\n\t\t\tassert.fail(\"Object should be summary handle\");\n\t\t}\n\t}\n\n\tdescribe(\"ITree <-> ISummaryTree\", () => {\n\t\tlet tree: ITree;\n\n\t\tbeforeEach(() => {\n\t\t\tconst base64Content = IsoBuffer.from(\"test-b64\").toString(\"base64\");\n\t\t\ttree = {\n\t\t\t\tentries: [\n\t\t\t\t\tnew TreeTreeEntry(\"t\", {\n\t\t\t\t\t\tentries: [\n\t\t\t\t\t\t\tnew BlobTreeEntry(\"bu8\", \"test-u8\"),\n\t\t\t\t\t\t\tnew BlobTreeEntry(\"b64\", base64Content, \"base64\"),\n\t\t\t\t\t\t\tnew TreeTreeEntry(\"tu\", {\n\t\t\t\t\t\t\t\tentries: [],\n\t\t\t\t\t\t\t\tunreferenced: true,\n\t\t\t\t\t\t\t\tgroupId: undefined,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t],\n\t\t\t\t\t\tunreferenced: undefined,\n\t\t\t\t\t\tgroupId: undefined,\n\t\t\t\t\t}),\n\t\t\t\t\tnew BlobTreeEntry(\"b\", \"test-blob\"),\n\t\t\t\t\tnew TreeTreeEntry(\"h\", {\n\t\t\t\t\t\tid: \"test-handle\",\n\t\t\t\t\t\tentries: [new BlobTreeEntry(\"ignore\", \"this-should-be-ignored\")],\n\t\t\t\t\t}),\n\t\t\t\t\tnew TreeTreeEntry(\"unref\", {\n\t\t\t\t\t\tentries: [],\n\t\t\t\t\t\tunreferenced: true,\n\t\t\t\t\t\tgroupId: undefined,\n\t\t\t\t\t}),\n\t\t\t\t\tnew TreeTreeEntry(\"groupId\", {\n\t\t\t\t\t\tentries: [],\n\t\t\t\t\t\tunreferenced: undefined,\n\t\t\t\t\t\tgroupId: \"group-id\",\n\t\t\t\t\t}),\n\t\t\t\t],\n\t\t\t\tunreferenced: undefined,\n\t\t\t\tgroupId: undefined,\n\t\t\t};\n\t\t});\n\n\t\tit(\"Should convert ITree to ISummaryTree correctly\", () => {\n\t\t\tconst summaryResults = convertToSummaryTree(tree);\n\t\t\tconst summaryTree = assertSummaryTree(summaryResults.summary);\n\n\t\t\t// blobs should parse\n\t\t\tconst blob = assertSummaryBlob(summaryTree.tree.b);\n\t\t\tassert.strictEqual(blob.content, \"test-blob\");\n\n\t\t\t// trees with ids should become handles\n\t\t\tconst handle = assertSummaryHandle(summaryTree.tree.h);\n\t\t\tassert.strictEqual(handle.handleType, SummaryType.Tree);\n\t\t\tassert.strictEqual(handle.handle, \"test-handle\");\n\n\t\t\t// subtrees should recurse\n\t\t\tconst subTree = assertSummaryTree(summaryTree.tree.t);\n\t\t\tconst subBlobUtf8 = assertSummaryBlob(subTree.tree.bu8);\n\t\t\tassert.strictEqual(subBlobUtf8.content, \"test-u8\");\n\t\t\tconst subBlobBase64 = assertSummaryBlob(subTree.tree.b64);\n\t\t\tassert.strictEqual(Uint8ArrayToString(subBlobBase64.content as Uint8Array), \"test-b64\");\n\t\t\tconst subTreeUnref = assertSummaryTree(subTree.tree.tu);\n\t\t\tassert.strictEqual(\n\t\t\t\tObject.keys(subTreeUnref.tree).length,\n\t\t\t\t0,\n\t\t\t\t\"There should be no entries in tu subtree\",\n\t\t\t);\n\t\t});\n\n\t\tit(\"Should convert ITree to ISummaryTree correctly with fullTree enabled\", () => {\n\t\t\tconst summaryResults = convertToSummaryTree(tree, true);\n\t\t\tconst summaryTree = assertSummaryTree(summaryResults.summary);\n\n\t\t\t// blobs should parse\n\t\t\tconst blob = assertSummaryBlob(summaryTree.tree.b);\n\t\t\tassert.strictEqual(blob.content, \"test-blob\");\n\n\t\t\t// trees with ids should not become handles\n\t\t\tconst usuallyIgnoredSubtree = assertSummaryTree(summaryTree.tree.h);\n\t\t\tconst usuallyIgnoredBlob = assertSummaryBlob(usuallyIgnoredSubtree.tree.ignore);\n\t\t\tassert.strictEqual(usuallyIgnoredBlob.content, \"this-should-be-ignored\");\n\n\t\t\t// subtrees should recurse\n\t\t\tconst subTree = assertSummaryTree(summaryTree.tree.t);\n\t\t\tconst subBlobUtf8 = assertSummaryBlob(subTree.tree.bu8);\n\t\t\tassert.strictEqual(subBlobUtf8.content, \"test-u8\");\n\t\t\tconst subBlobBase64 = assertSummaryBlob(subTree.tree.b64);\n\t\t\tassert.strictEqual(Uint8ArrayToString(subBlobBase64.content as Uint8Array), \"test-b64\");\n\t\t\tconst subUnrefTree = assertSummaryTree(subTree.tree.tu);\n\t\t\tassert.strictEqual(\n\t\t\t\tObject.keys(subUnrefTree.tree).length,\n\t\t\t\t0,\n\t\t\t\t\"There should be no entries in tu subtree\",\n\t\t\t);\n\t\t});\n\n\t\tit(\"Should calculate summary data correctly\", () => {\n\t\t\tconst summaryResults = convertToSummaryTree(tree);\n\t\t\t// nodes should count\n\t\t\tassert.strictEqual(summaryResults.stats.blobNodeCount, 3);\n\t\t\tassert.strictEqual(summaryResults.stats.handleNodeCount, 1);\n\t\t\tassert.strictEqual(summaryResults.stats.treeNodeCount, 5);\n\n\t\t\tconst bufferLength =\n\t\t\t\tIsoBuffer.from(\"test-b64\").byteLength +\n\t\t\t\tIsoBuffer.from(\"test-blob\").byteLength +\n\t\t\t\tIsoBuffer.from(\"test-u8\").byteLength;\n\t\t\tassert.strictEqual(summaryResults.stats.totalBlobSize, bufferLength);\n\t\t});\n\n\t\tit(\"should convert unreferenced state correctly\", () => {\n\t\t\tconst summaryResults = convertToSummaryTree(tree);\n\t\t\tconst summaryTree = assertSummaryTree(summaryResults.summary);\n\t\t\tassert.strictEqual(\n\t\t\t\tsummaryTree.unreferenced,\n\t\t\t\tundefined,\n\t\t\t\t\"The root summary tree should be referenced\",\n\t\t\t);\n\n\t\t\tconst subTreeT = assertSummaryTree(summaryTree.tree.t);\n\t\t\tassert.strictEqual(\n\t\t\t\tsubTreeT.unreferenced,\n\t\t\t\tundefined,\n\t\t\t\t\"The t subtree should be referenced\",\n\t\t\t);\n\t\t\tconst subTreeTUnrefTree = assertSummaryTree(subTreeT.tree.tu);\n\t\t\tassert.strictEqual(\n\t\t\t\tsubTreeTUnrefTree.unreferenced,\n\t\t\t\ttrue,\n\t\t\t\t\"The tu subtree of t should be referenced\",\n\t\t\t);\n\n\t\t\tconst subTreeUnref = assertSummaryTree(summaryTree.tree.unref);\n\t\t\tassert.strictEqual(\n\t\t\t\tsubTreeUnref.unreferenced,\n\t\t\t\ttrue,\n\t\t\t\t\"The unref subtree should be unreferenced\",\n\t\t\t);\n\t\t});\n\n\t\tit(\"should convert ISummaryTree to ITree correctly\", () => {\n\t\t\t// convertSummaryTreeToITree API does not accept a tree with handles. So, remove handles from the ITree.\n\t\t\tconst treeWithoutHandles: ITree = {\n\t\t\t\tentries: tree.entries.filter((treeEntry) => {\n\t\t\t\t\treturn treeEntry.path !== \"h\";\n\t\t\t\t}),\n\t\t\t\tunreferenced: undefined,\n\t\t\t\tgroupId: undefined,\n\t\t\t};\n\t\t\tconst summaryResults = convertToSummaryTree(treeWithoutHandles);\n\t\t\tconst summaryTree = assertSummaryTree(summaryResults.summary);\n\n\t\t\t// Covert the ISummaryTree back to ITree and validate that it matches with the original tree.\n\t\t\tconst iTree = convertSummaryTreeToITree(summaryTree);\n\t\t\tassert.deepStrictEqual(\n\t\t\t\ttreeWithoutHandles,\n\t\t\t\tiTree,\n\t\t\t\t\"Could not covert back to ITree correctly\",\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe(\"ISnapshotTree -> ISummaryTree\", () => {\n\t\tlet snapshotTree: ISnapshotTree;\n\n\t\tbeforeEach(() => {\n\t\t\tsnapshotTree = {\n\t\t\t\tblobs: {\n\t\t\t\t\t\"b\": \"blob-b\",\n\t\t\t\t\t\"blob-b\": IsoBuffer.from(\"test-blob\").toString(\"base64\"),\n\t\t\t\t},\n\t\t\t\ttrees: {\n\t\t\t\t\tt: {\n\t\t\t\t\t\tblobs: {\n\t\t\t\t\t\t\t\"bu8\": \"blob-bu8\",\n\t\t\t\t\t\t\t\"blob-bu8\": IsoBuffer.from(\"test-u8\").toString(\"base64\"),\n\t\t\t\t\t\t\t\"b64\": \"blob-b64\",\n\t\t\t\t\t\t\t\"blob-b64\": IsoBuffer.from(\"test-b64\").toString(\"base64\"),\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttrees: {\n\t\t\t\t\t\t\ttu: {\n\t\t\t\t\t\t\t\tblobs: {},\n\t\t\t\t\t\t\t\ttrees: {},\n\t\t\t\t\t\t\t\tunreferenced: true,\n\t\t\t\t\t\t\t\tgroupId: undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tunref: {\n\t\t\t\t\t\tblobs: {},\n\t\t\t\t\t\ttrees: {},\n\t\t\t\t\t\tunreferenced: true,\n\t\t\t\t\t\tgroupId: undefined,\n\t\t\t\t\t},\n\t\t\t\t\tgroupId: {\n\t\t\t\t\t\tblobs: {},\n\t\t\t\t\t\ttrees: {},\n\t\t\t\t\t\tunreferenced: true,\n\t\t\t\t\t\tgroupId: \"group-id\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t});\n\t\tit(\"Should convert correctly\", () => {\n\t\t\tconst summaryResults = convertSnapshotTreeToSummaryTree(snapshotTree);\n\t\t\tconst summaryTree = assertSummaryTree(summaryResults.summary);\n\n\t\t\t// blobs should parse\n\t\t\tconst blob = assertSummaryBlob(summaryTree.tree.b);\n\t\t\tassert.strictEqual(blob.content, \"test-blob\");\n\n\t\t\t// subtrees should recurse\n\t\t\tconst subTree = assertSummaryTree(summaryTree.tree.t);\n\t\t\tconst subBlobUtf8 = assertSummaryBlob(subTree.tree.bu8);\n\t\t\tassert.strictEqual(subBlobUtf8.content, \"test-u8\");\n\t\t\tconst subBlobBase64 = assertSummaryBlob(subTree.tree.b64);\n\t\t\tassert.strictEqual(Uint8ArrayToString(subBlobBase64.content as Uint8Array), \"test-b64\");\n\t\t\tconst subTreeUnref = assertSummaryTree(subTree.tree.tu);\n\t\t\tassert.strictEqual(\n\t\t\t\tObject.keys(subTreeUnref.tree).length,\n\t\t\t\t0,\n\t\t\t\t\"There should be no entries in tu subtree\",\n\t\t\t);\n\t\t});\n\n\t\tit(\"Should calculate summary data correctly\", () => {\n\t\t\tconst summaryResults = convertSnapshotTreeToSummaryTree(snapshotTree);\n\t\t\t// nodes should count\n\t\t\tassert.strictEqual(summaryResults.stats.blobNodeCount, 3);\n\t\t\tassert.strictEqual(summaryResults.stats.handleNodeCount, 0);\n\t\t\tassert.strictEqual(summaryResults.stats.treeNodeCount, 5);\n\n\t\t\tconst bufferLength =\n\t\t\t\tIsoBuffer.from(\"test-b64\").byteLength +\n\t\t\t\tIsoBuffer.from(\"test-blob\").byteLength +\n\t\t\t\tIsoBuffer.from(\"test-u8\").byteLength;\n\t\t\tassert.strictEqual(summaryResults.stats.totalBlobSize, bufferLength);\n\t\t});\n\n\t\tit(\"should convert unreferenced state correctly\", () => {\n\t\t\tconst summaryResults = convertSnapshotTreeToSummaryTree(snapshotTree);\n\t\t\tconst summaryTree = assertSummaryTree(summaryResults.summary);\n\t\t\tassert.strictEqual(\n\t\t\t\tsummaryTree.unreferenced,\n\t\t\t\tundefined,\n\t\t\t\t\"The root summary tree should be referenced\",\n\t\t\t);\n\n\t\t\tconst subTreeT = assertSummaryTree(summaryTree.tree.t);\n\t\t\tassert.strictEqual(\n\t\t\t\tsubTreeT.unreferenced,\n\t\t\t\tundefined,\n\t\t\t\t\"The t subtree should be referenced\",\n\t\t\t);\n\t\t\tconst subTreeTUnrefTree = assertSummaryTree(subTreeT.tree.tu);\n\t\t\tassert.strictEqual(\n\t\t\t\tsubTreeTUnrefTree.unreferenced,\n\t\t\t\ttrue,\n\t\t\t\t\"The tu subtree of t should be referenced\",\n\t\t\t);\n\n\t\t\tconst subTreeUnref = assertSummaryTree(summaryTree.tree.unref);\n\t\t\tassert.strictEqual(\n\t\t\t\tsubTreeUnref.unreferenced,\n\t\t\t\ttrue,\n\t\t\t\t\"The unref subtree should be unreferenced\",\n\t\t\t);\n\t\t});\n\n\t\tit(\"should convert groupId state correctly\", () => {\n\t\t\tconst summaryResults = convertSnapshotTreeToSummaryTree(snapshotTree);\n\t\t\tconst summaryTree = assertSummaryTree(summaryResults.summary);\n\t\t\tassert.strictEqual(\n\t\t\t\tsummaryTree.groupId,\n\t\t\t\tundefined,\n\t\t\t\t\"The root summary tree should not have groupId\",\n\t\t\t);\n\n\t\t\tconst subTreeT = assertSummaryTree(summaryTree.tree.t);\n\t\t\tassert.strictEqual(subTreeT.groupId, undefined, \"The t subtree not have groupId\");\n\t\t\tconst subTreeTUnrefTree = assertSummaryTree(subTreeT.tree.tu);\n\t\t\tassert.strictEqual(\n\t\t\t\tsubTreeTUnrefTree.groupId,\n\t\t\t\tundefined,\n\t\t\t\t\"The tu subtree of t not have groupId\",\n\t\t\t);\n\n\t\t\tconst subTreeUnref = assertSummaryTree(summaryTree.tree.unref);\n\t\t\tassert.strictEqual(subTreeUnref.groupId, undefined, \"The groupId should not be set\");\n\n\t\t\tconst subTreeGroupId = assertSummaryTree(summaryTree.tree.groupId);\n\t\t\tassert.strictEqual(subTreeGroupId.groupId, \"group-id\", \"The groupId should be set\");\n\t\t});\n\t});\n\n\tdescribe(\"utf8ByteLength()\", () => {\n\t\tit(\"gives correct utf8 byte length\", () => {\n\t\t\tconst a = [\n\t\t\t\t\"prague is a city in europe\",\n\t\t\t\t\"ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ\",\n\t\t\t\t\"Τὴ γλῶσσα μοῦ ἔδωσαν ἑλληνικὴ\",\n\t\t\t\t\"На берегу пустынных волн\",\n\t\t\t\t\"⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑\",\n\t\t\t\t\"أنا قادر على أكل الزجاج و هذا لا يؤلمني.\",\n\t\t\t\t\" 我能吞下玻璃而不傷身體。\",\n\t\t\t\t\"ᐊᓕᒍᖅ ᓂᕆᔭᕌᖓᒃᑯ ᓱᕋᙱᑦᑐᓐᓇᖅᑐᖓ\",\n\t\t\t\t\"🤦🏼♂️\",\n\t\t\t\t\"🏴\", // the flag of wales\n\t\t\t\t\"���\",\n\t\t\t\t\"������\",\n\t\t\t];\n\t\t\ta.map((s) =>\n\t\t\t\tassert.strictEqual(utf8ByteLength(s), stringToBuffer(s, \"utf8\").byteLength, s),\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe(\"TelemetryContext\", () => {\n\t\tit(\"Should serialize properly\", () => {\n\t\t\tconst telemetryContext = new TelemetryContext();\n\n\t\t\ttelemetryContext.set(\"pre1_\", \"prop1\", 10);\n\t\t\ttelemetryContext.set(\"pre2_\", \"prop1\", \"10\");\n\t\t\ttelemetryContext.set(\"pre2_\", \"prop2\", true);\n\t\t\ttelemetryContext.set(\"pre1_\", \"prop2\", undefined);\n\t\t\ttelemetryContext.setMultiple(\"pre3_\", \"obj1\", { prop1: \"1\", prop2: 2, prop3: true });\n\n\t\t\tconst serialized = telemetryContext.serialize();\n\n\t\t\tconst obj = JSON.parse(serialized);\n\n\t\t\tassert.strictEqual(obj.pre1_prop1, 10);\n\t\t\tassert.strictEqual(obj.pre1_prop2, undefined);\n\t\t\tassert.strictEqual(obj.pre2_prop1, \"10\");\n\t\t\tassert.strictEqual(obj.pre2_prop2, true);\n\t\t\tassert.strictEqual(obj.pre3_obj1_prop1, \"1\");\n\t\t\tassert.strictEqual(obj.pre3_obj1_prop2, 2);\n\t\t\tassert.strictEqual(obj.pre3_obj1_prop3, true);\n\t\t});\n\t});\n});\n"]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
use_current_TypeAliasDeclaration_Factory(get_old_TypeAliasDeclaration_Factory());
|
|
2
|
-
use_old_TypeAliasDeclaration_Factory(get_current_TypeAliasDeclaration_Factory());
|
|
3
|
-
use_current_ClassDeclaration_GCDataBuilder(get_old_ClassDeclaration_GCDataBuilder());
|
|
4
|
-
use_old_ClassDeclaration_GCDataBuilder(get_current_ClassDeclaration_GCDataBuilder());
|
|
5
|
-
use_current_ClassDeclaration_ObjectStoragePartition(get_old_ClassDeclaration_ObjectStoragePartition());
|
|
6
|
-
use_old_ClassDeclaration_ObjectStoragePartition(get_current_ClassDeclaration_ObjectStoragePartition());
|
|
7
|
-
use_current_TypeAliasDeclaration_ReadAndParseBlob(get_old_TypeAliasDeclaration_ReadAndParseBlob());
|
|
8
|
-
use_old_TypeAliasDeclaration_ReadAndParseBlob(get_current_TypeAliasDeclaration_ReadAndParseBlob());
|
|
9
|
-
use_current_ClassDeclaration_RequestParser(get_old_ClassDeclaration_RequestParser());
|
|
10
|
-
use_old_ClassDeclaration_RequestParser(get_current_ClassDeclaration_RequestParser());
|
|
11
|
-
use_current_ClassDeclaration_RuntimeFactoryHelper(get_old_ClassDeclaration_RuntimeFactoryHelper());
|
|
12
|
-
use_old_ClassDeclaration_RuntimeFactoryHelper(get_current_ClassDeclaration_RuntimeFactoryHelper());
|
|
13
|
-
use_current_ClassDeclaration_SummaryTreeBuilder(get_old_ClassDeclaration_SummaryTreeBuilder());
|
|
14
|
-
use_old_ClassDeclaration_SummaryTreeBuilder(get_current_ClassDeclaration_SummaryTreeBuilder());
|
|
15
|
-
use_current_ClassDeclaration_TelemetryContext(get_old_ClassDeclaration_TelemetryContext());
|
|
16
|
-
use_old_ClassDeclaration_TelemetryContext(get_current_ClassDeclaration_TelemetryContext());
|
|
17
|
-
use_current_FunctionDeclaration_addBlobToSummary(get_old_FunctionDeclaration_addBlobToSummary());
|
|
18
|
-
use_old_FunctionDeclaration_addBlobToSummary(get_current_FunctionDeclaration_addBlobToSummary());
|
|
19
|
-
use_current_FunctionDeclaration_addSummarizeResultToSummary(get_old_FunctionDeclaration_addSummarizeResultToSummary());
|
|
20
|
-
use_old_FunctionDeclaration_addSummarizeResultToSummary(get_current_FunctionDeclaration_addSummarizeResultToSummary());
|
|
21
|
-
use_current_FunctionDeclaration_calculateStats(get_old_FunctionDeclaration_calculateStats());
|
|
22
|
-
use_old_FunctionDeclaration_calculateStats(get_current_FunctionDeclaration_calculateStats());
|
|
23
|
-
use_current_FunctionDeclaration_convertSnapshotTreeToSummaryTree(get_old_FunctionDeclaration_convertSnapshotTreeToSummaryTree());
|
|
24
|
-
use_old_FunctionDeclaration_convertSnapshotTreeToSummaryTree(get_current_FunctionDeclaration_convertSnapshotTreeToSummaryTree());
|
|
25
|
-
use_current_FunctionDeclaration_convertSummaryTreeToITree(get_old_FunctionDeclaration_convertSummaryTreeToITree());
|
|
26
|
-
use_old_FunctionDeclaration_convertSummaryTreeToITree(get_current_FunctionDeclaration_convertSummaryTreeToITree());
|
|
27
|
-
use_current_FunctionDeclaration_convertToSummaryTree(get_old_FunctionDeclaration_convertToSummaryTree());
|
|
28
|
-
use_old_FunctionDeclaration_convertToSummaryTree(get_current_FunctionDeclaration_convertToSummaryTree());
|
|
29
|
-
use_current_FunctionDeclaration_convertToSummaryTreeWithStats(get_old_FunctionDeclaration_convertToSummaryTreeWithStats());
|
|
30
|
-
use_old_FunctionDeclaration_convertToSummaryTreeWithStats(get_current_FunctionDeclaration_convertToSummaryTreeWithStats());
|
|
31
|
-
use_current_VariableDeclaration_create404Response(get_old_VariableDeclaration_create404Response());
|
|
32
|
-
use_old_VariableDeclaration_create404Response(get_current_VariableDeclaration_create404Response());
|
|
33
|
-
use_current_FunctionDeclaration_createDataStoreFactory(get_old_FunctionDeclaration_createDataStoreFactory());
|
|
34
|
-
use_old_FunctionDeclaration_createDataStoreFactory(get_current_FunctionDeclaration_createDataStoreFactory());
|
|
35
|
-
use_current_FunctionDeclaration_createResponseError(get_old_FunctionDeclaration_createResponseError());
|
|
36
|
-
use_old_FunctionDeclaration_createResponseError(get_current_FunctionDeclaration_createResponseError());
|
|
37
|
-
use_current_FunctionDeclaration_exceptionToResponse(get_old_FunctionDeclaration_exceptionToResponse());
|
|
38
|
-
use_old_FunctionDeclaration_exceptionToResponse(get_current_FunctionDeclaration_exceptionToResponse());
|
|
39
|
-
use_current_FunctionDeclaration_generateHandleContextPath(get_old_FunctionDeclaration_generateHandleContextPath());
|
|
40
|
-
use_old_FunctionDeclaration_generateHandleContextPath(get_current_FunctionDeclaration_generateHandleContextPath());
|
|
41
|
-
use_current_FunctionDeclaration_getBlobSize(get_old_FunctionDeclaration_getBlobSize());
|
|
42
|
-
use_old_FunctionDeclaration_getBlobSize(get_current_FunctionDeclaration_getBlobSize());
|
|
43
|
-
use_current_FunctionDeclaration_getNormalizedObjectStoragePathParts(get_old_FunctionDeclaration_getNormalizedObjectStoragePathParts());
|
|
44
|
-
use_old_FunctionDeclaration_getNormalizedObjectStoragePathParts(get_current_FunctionDeclaration_getNormalizedObjectStoragePathParts());
|
|
45
|
-
use_current_FunctionDeclaration_listBlobsAtTreePath(get_old_FunctionDeclaration_listBlobsAtTreePath());
|
|
46
|
-
use_old_FunctionDeclaration_listBlobsAtTreePath(get_current_FunctionDeclaration_listBlobsAtTreePath());
|
|
47
|
-
use_current_FunctionDeclaration_mergeStats(get_old_FunctionDeclaration_mergeStats());
|
|
48
|
-
use_old_FunctionDeclaration_mergeStats(get_current_FunctionDeclaration_mergeStats());
|
|
49
|
-
use_current_FunctionDeclaration_responseToException(get_old_FunctionDeclaration_responseToException());
|
|
50
|
-
use_old_FunctionDeclaration_responseToException(get_current_FunctionDeclaration_responseToException());
|
|
51
|
-
use_current_FunctionDeclaration_seqFromTree(get_old_FunctionDeclaration_seqFromTree());
|
|
52
|
-
use_old_FunctionDeclaration_seqFromTree(get_current_FunctionDeclaration_seqFromTree());
|
|
53
|
-
use_current_FunctionDeclaration_unpackChildNodesUsedRoutes(get_old_FunctionDeclaration_unpackChildNodesUsedRoutes());
|
|
54
|
-
use_old_FunctionDeclaration_unpackChildNodesUsedRoutes(get_current_FunctionDeclaration_unpackChildNodesUsedRoutes());
|
|
55
|
-
use_current_FunctionDeclaration_utf8ByteLength(get_old_FunctionDeclaration_utf8ByteLength());
|
|
56
|
-
use_old_FunctionDeclaration_utf8ByteLength(get_current_FunctionDeclaration_utf8ByteLength());
|
|
57
|
-
export {};
|
|
58
|
-
//# sourceMappingURL=validateRuntimeUtilsPrevious.generated.js.map
|