@fluidframework/runtime-utils 2.0.0-dev-rc.3.0.0.250606 → 2.0.0-dev-rc.3.0.0.254274

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.
Files changed (63) hide show
  1. package/api-report/runtime-utils.api.md +9 -9
  2. package/dist/dataStoreHelpers.d.ts +1 -1
  3. package/dist/dataStoreHelpers.d.ts.map +1 -1
  4. package/dist/dataStoreHelpers.js +6 -6
  5. package/dist/dataStoreHelpers.js.map +1 -1
  6. package/dist/objectstoragepartition.js +2 -2
  7. package/dist/objectstoragepartition.js.map +1 -1
  8. package/dist/runtime-utils-alpha.d.ts +9 -9
  9. package/dist/runtime-utils-beta.d.ts +9 -9
  10. package/dist/runtime-utils-public.d.ts +9 -9
  11. package/dist/runtime-utils-untrimmed.d.ts +9 -9
  12. package/dist/runtimeFactoryHelper.d.ts +2 -2
  13. package/dist/runtimeFactoryHelper.d.ts.map +1 -1
  14. package/dist/runtimeFactoryHelper.js.map +1 -1
  15. package/dist/summaryUtils.d.ts +3 -2
  16. package/dist/summaryUtils.d.ts.map +1 -1
  17. package/dist/summaryUtils.js +7 -7
  18. package/dist/summaryUtils.js.map +1 -1
  19. package/dist/unpackUsedRoutes.js +2 -2
  20. package/dist/unpackUsedRoutes.js.map +1 -1
  21. package/dist/utils.js +2 -2
  22. package/dist/utils.js.map +1 -1
  23. package/lib/dataStoreHelpers.d.ts +1 -1
  24. package/lib/dataStoreHelpers.d.ts.map +1 -1
  25. package/lib/dataStoreHelpers.js +2 -2
  26. package/lib/dataStoreHelpers.js.map +1 -1
  27. package/lib/objectstoragepartition.js +1 -1
  28. package/lib/objectstoragepartition.js.map +1 -1
  29. package/lib/runtime-utils-alpha.d.ts +9 -9
  30. package/lib/runtime-utils-beta.d.ts +9 -9
  31. package/lib/runtime-utils-public.d.ts +9 -9
  32. package/lib/runtime-utils-untrimmed.d.ts +9 -9
  33. package/lib/runtimeFactoryHelper.d.ts +2 -2
  34. package/lib/runtimeFactoryHelper.d.ts.map +1 -1
  35. package/lib/runtimeFactoryHelper.js.map +1 -1
  36. package/lib/summaryUtils.d.ts +3 -2
  37. package/lib/summaryUtils.d.ts.map +1 -1
  38. package/lib/summaryUtils.js +2 -2
  39. package/lib/summaryUtils.js.map +1 -1
  40. package/lib/tsdoc-metadata.json +11 -0
  41. package/lib/unpackUsedRoutes.js +1 -1
  42. package/lib/unpackUsedRoutes.js.map +1 -1
  43. package/lib/utils.js +1 -1
  44. package/lib/utils.js.map +1 -1
  45. package/package.json +13 -25
  46. package/src/dataStoreHelpers.ts +3 -3
  47. package/src/objectstoragepartition.ts +1 -1
  48. package/src/runtimeFactoryHelper.ts +2 -2
  49. package/src/summaryUtils.ts +8 -4
  50. package/src/unpackUsedRoutes.ts +1 -1
  51. package/src/utils.ts +1 -1
  52. package/lib/test/dataStoreHelpers.spec.js +0 -29
  53. package/lib/test/dataStoreHelpers.spec.js.map +0 -1
  54. package/lib/test/requestParser.spec.js +0 -111
  55. package/lib/test/requestParser.spec.js.map +0 -1
  56. package/lib/test/runtimeFactoryHelper.spec.js +0 -44
  57. package/lib/test/runtimeFactoryHelper.spec.js.map +0 -1
  58. package/lib/test/summaryUtils.spec.js +0 -283
  59. package/lib/test/summaryUtils.spec.js.map +0 -1
  60. package/lib/test/types/validateRuntimeUtilsPrevious.generated.js +0 -58
  61. package/lib/test/types/validateRuntimeUtilsPrevious.generated.js.map +0 -1
  62. package/lib/test/utils.spec.js +0 -65
  63. package/lib/test/utils.spec.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/runtime-utils",
3
- "version": "2.0.0-dev-rc.3.0.0.250606",
3
+ "version": "2.0.0-dev-rc.3.0.0.254274",
4
4
  "description": "Collection of utility functions for Fluid Runtime",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -14,16 +14,6 @@
14
14
  "type": "module",
15
15
  "exports": {
16
16
  ".": {
17
- "import": {
18
- "types": "./lib/index.d.ts",
19
- "default": "./lib/index.js"
20
- },
21
- "require": {
22
- "types": "./dist/index.d.ts",
23
- "default": "./dist/index.js"
24
- }
25
- },
26
- "./public": {
27
17
  "import": {
28
18
  "types": "./lib/runtime-utils-public.d.ts",
29
19
  "default": "./lib/index.js"
@@ -55,7 +45,7 @@
55
45
  }
56
46
  },
57
47
  "main": "dist/index.js",
58
- "types": "dist/index.d.ts",
48
+ "types": "./dist/runtime-utils-public.d.ts",
59
49
  "c8": {
60
50
  "all": true,
61
51
  "cache-dir": "nyc/.cache",
@@ -77,21 +67,21 @@
77
67
  "temp-directory": "nyc/.nyc_output"
78
68
  },
79
69
  "dependencies": {
80
- "@fluid-internal/client-utils": "2.0.0-dev-rc.3.0.0.250606",
81
- "@fluidframework/container-definitions": "2.0.0-dev-rc.3.0.0.250606",
82
- "@fluidframework/container-runtime-definitions": "2.0.0-dev-rc.3.0.0.250606",
83
- "@fluidframework/core-interfaces": "2.0.0-dev-rc.3.0.0.250606",
84
- "@fluidframework/core-utils": "2.0.0-dev-rc.3.0.0.250606",
85
- "@fluidframework/datastore-definitions": "2.0.0-dev-rc.3.0.0.250606",
86
- "@fluidframework/driver-utils": "2.0.0-dev-rc.3.0.0.250606",
70
+ "@fluid-internal/client-utils": "2.0.0-dev-rc.3.0.0.254274",
71
+ "@fluidframework/container-definitions": "2.0.0-dev-rc.3.0.0.254274",
72
+ "@fluidframework/container-runtime-definitions": "2.0.0-dev-rc.3.0.0.254274",
73
+ "@fluidframework/core-interfaces": "2.0.0-dev-rc.3.0.0.254274",
74
+ "@fluidframework/core-utils": "2.0.0-dev-rc.3.0.0.254274",
75
+ "@fluidframework/datastore-definitions": "2.0.0-dev-rc.3.0.0.254274",
76
+ "@fluidframework/driver-utils": "2.0.0-dev-rc.3.0.0.254274",
87
77
  "@fluidframework/protocol-definitions": "^3.2.0",
88
- "@fluidframework/runtime-definitions": "2.0.0-dev-rc.3.0.0.250606",
89
- "@fluidframework/telemetry-utils": "2.0.0-dev-rc.3.0.0.250606"
78
+ "@fluidframework/runtime-definitions": "2.0.0-dev-rc.3.0.0.254274",
79
+ "@fluidframework/telemetry-utils": "2.0.0-dev-rc.3.0.0.254274"
90
80
  },
91
81
  "devDependencies": {
92
- "@arethetypeswrong/cli": "^0.13.3",
82
+ "@arethetypeswrong/cli": "^0.15.2",
93
83
  "@biomejs/biome": "^1.6.2",
94
- "@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.3.0.0.250606",
84
+ "@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.3.0.0.254274",
95
85
  "@fluid-tools/build-cli": "^0.34.0",
96
86
  "@fluidframework/build-common": "^2.0.3",
97
87
  "@fluidframework/build-tools": "^0.34.0",
@@ -148,7 +138,6 @@
148
138
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
149
139
  "build:test:esm": "tsc --project ./src/test/tsconfig.json",
150
140
  "check:are-the-types-wrong": "attw --pack . --entrypoints .",
151
- "check:biome": "biome check .",
152
141
  "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
153
142
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
154
143
  "ci:build:docs": "api-extractor run",
@@ -156,7 +145,6 @@
156
145
  "eslint": "eslint --format stylish src",
157
146
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
158
147
  "format": "fluid-build --task format .",
159
- "format:biome": "biome check --apply .",
160
148
  "format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
161
149
  "lint": "fluid-build . --task lint",
162
150
  "lint:fix": "fluid-build . --task eslint:fix --task format",
@@ -4,13 +4,13 @@
4
4
  */
5
5
 
6
6
  import { IRequest, IResponse } from "@fluidframework/core-interfaces";
7
- import { assert } from "@fluidframework/core-utils";
7
+ import { assert } from "@fluidframework/core-utils/internal";
8
8
  import {
9
9
  IFluidDataStoreFactory,
10
10
  IFluidDataStoreRegistry,
11
11
  IProvideFluidDataStoreRegistry,
12
- } from "@fluidframework/runtime-definitions";
13
- import { generateErrorWithStack } from "@fluidframework/telemetry-utils";
12
+ } from "@fluidframework/runtime-definitions/internal";
13
+ import { generateErrorWithStack } from "@fluidframework/telemetry-utils/internal";
14
14
 
15
15
  interface IResponseException extends Error {
16
16
  errorFromRequestFluidObject: true;
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert } from "@fluidframework/core-utils";
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
7
  import { IChannelStorageService } from "@fluidframework/datastore-definitions";
8
8
 
9
9
  /**
@@ -7,8 +7,8 @@ import {
7
7
  IContainerContext,
8
8
  IRuntime,
9
9
  IRuntimeFactory,
10
- } from "@fluidframework/container-definitions";
11
- import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
10
+ } from "@fluidframework/container-definitions/internal";
11
+ import { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
12
12
 
13
13
  /**
14
14
  * @alpha
@@ -9,10 +9,14 @@ import {
9
9
  bufferToString,
10
10
  fromBase64ToUtf8,
11
11
  } from "@fluid-internal/client-utils";
12
- import { ISnapshotTreeWithBlobContents } from "@fluidframework/container-definitions";
12
+ import { ISnapshotTreeWithBlobContents } from "@fluidframework/container-definitions/internal";
13
13
  import type { TelemetryBaseEventPropertyType } from "@fluidframework/core-interfaces";
14
- import { assert, unreachableCase } from "@fluidframework/core-utils";
15
- import { AttachmentTreeEntry, BlobTreeEntry, TreeTreeEntry } from "@fluidframework/driver-utils";
14
+ import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
15
+ import {
16
+ AttachmentTreeEntry,
17
+ BlobTreeEntry,
18
+ TreeTreeEntry,
19
+ } from "@fluidframework/driver-utils/internal";
16
20
  import {
17
21
  ISummaryBlob,
18
22
  ISummaryTree,
@@ -24,11 +28,11 @@ import {
24
28
  } from "@fluidframework/protocol-definitions";
25
29
  import {
26
30
  IGarbageCollectionData,
27
- ISummarizeResult,
28
31
  ISummaryStats,
29
32
  ISummaryTreeWithStats,
30
33
  ITelemetryContext,
31
34
  } from "@fluidframework/runtime-definitions";
35
+ import { ISummarizeResult } from "@fluidframework/runtime-definitions/internal";
32
36
 
33
37
  /**
34
38
  * Combines summary stats by adding their totals together.
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert } from "@fluidframework/core-utils";
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
7
 
8
8
  /**
9
9
  * Helper function that unpacks the used routes of children from a given node's used routes.
package/src/utils.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert } from "@fluidframework/core-utils";
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
7
  import { IDocumentAttributes, ISnapshotTree } from "@fluidframework/protocol-definitions";
8
8
 
9
9
  /**
@@ -1,29 +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 { createResponseError, exceptionToResponse, responseToException, } from "../dataStoreHelpers.js";
7
- describe("createResponseError", () => {
8
- it("Strip URL query param ", () => {
9
- const response = createResponseError(400, "SomeValue", { url: "http://foo.com?a=b" });
10
- assert.strictEqual(response.value, "SomeValue: http://foo.com");
11
- });
12
- it("request / response / error handling ", () => {
13
- const request = { url: "/foo/bar?something" };
14
- const response = createResponseError(401, "some value", request);
15
- const value = "some value: /foo/bar";
16
- assert.strict.equal(response.status, 401, "status code");
17
- assert.strict.equal(response.value, value, "value");
18
- const stack = response.stack;
19
- assert.strict.notEqual(stack, undefined, "stack");
20
- const exception = responseToException(response, request);
21
- assert.strict.equal(exception.message, value, "value2");
22
- assert.strict.equal(exception.stack, stack, "stack2");
23
- const response2 = exceptionToResponse(exception);
24
- assert.strict.equal(response2.status, 401, "status code3");
25
- assert.strict.equal(response2.value, value, "value3");
26
- assert.strict.equal(response.stack, stack, "stack3");
27
- });
28
- });
29
- //# sourceMappingURL=dataStoreHelpers.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dataStoreHelpers.spec.js","sourceRoot":"","sources":["../../src/test/dataStoreHelpers.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACjC,MAAM,QAAQ,GAAG,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,oBAAoB,EAAE,CAAC,CAAC;QACtF,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,EAAE,2BAA2B,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC/C,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,oBAAoB,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,mBAAmB,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QACjE,MAAM,KAAK,GAAG,sBAAsB,CAAC;QACrC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC;QACzD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACpD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC7B,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAElD,MAAM,SAAS,GAAG,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QACxD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAEtD,MAAM,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACjD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,cAAc,CAAC,CAAC;QAC3D,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtD,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 {\n\tcreateResponseError,\n\texceptionToResponse,\n\tresponseToException,\n} from \"../dataStoreHelpers.js\";\n\ndescribe(\"createResponseError\", () => {\n\tit(\"Strip URL query param \", () => {\n\t\tconst response = createResponseError(400, \"SomeValue\", { url: \"http://foo.com?a=b\" });\n\t\tassert.strictEqual(response.value, \"SomeValue: http://foo.com\");\n\t});\n\n\tit(\"request / response / error handling \", () => {\n\t\tconst request = { url: \"/foo/bar?something\" };\n\t\tconst response = createResponseError(401, \"some value\", request);\n\t\tconst value = \"some value: /foo/bar\";\n\t\tassert.strict.equal(response.status, 401, \"status code\");\n\t\tassert.strict.equal(response.value, value, \"value\");\n\t\tconst stack = response.stack;\n\t\tassert.strict.notEqual(stack, undefined, \"stack\");\n\n\t\tconst exception = responseToException(response, request);\n\t\tassert.strict.equal(exception.message, value, \"value2\");\n\t\tassert.strict.equal(exception.stack, stack, \"stack2\");\n\n\t\tconst response2 = exceptionToResponse(exception);\n\t\tassert.strict.equal(response2.status, 401, \"status code3\");\n\t\tassert.strict.equal(response2.value, value, \"value3\");\n\t\tassert.strict.equal(response.stack, stack, \"stack3\");\n\t});\n});\n"]}
@@ -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,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;QAC9B,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;YAC9B,MAAM,GAAG,GAAG,aAAa,CAAC;YAC1B,MAAM,SAAS,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YAClD,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YACxC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;YACrC,MAAM,GAAG,GAAG,eAAe,CAAC;YAC5B,MAAM,SAAS,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YAClD,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,EAAE,C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;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,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C,CAAC,IAAI,EAAE,CAAC;QAC5C,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,KAAK,EAAE,CAAC;QAChD,MAAM,MAAM,CAAC,kBAAkB,CAAC,OAA4B,EAAE,cAAc,CAAC,KAAK,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"]}