@fluidframework/aqueduct 2.0.0-internal.3.4.1 → 2.0.0-internal.4.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.
Files changed (42) hide show
  1. package/dist/data-objects/pureDataObject.d.ts +1 -7
  2. package/dist/data-objects/pureDataObject.d.ts.map +1 -1
  3. package/dist/data-objects/pureDataObject.js +0 -10
  4. package/dist/data-objects/pureDataObject.js.map +1 -1
  5. package/dist/index.d.ts +1 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -6
  8. package/dist/index.js.map +1 -1
  9. package/dist/test/tsconfig.tsbuildinfo +1 -1
  10. package/dist/test/types/validateAqueductPrevious.generated.js +20 -10
  11. package/dist/test/types/validateAqueductPrevious.generated.js.map +1 -1
  12. package/dist/utils/index.d.ts +0 -1
  13. package/dist/utils/index.d.ts.map +1 -1
  14. package/dist/utils/index.js +1 -3
  15. package/dist/utils/index.js.map +1 -1
  16. package/lib/data-objects/pureDataObject.js +0 -10
  17. package/lib/data-objects/pureDataObject.js.map +1 -1
  18. package/lib/index.js +1 -2
  19. package/lib/index.js.map +1 -1
  20. package/lib/utils/index.js +0 -1
  21. package/lib/utils/index.js.map +1 -1
  22. package/package.json +37 -16
  23. package/dist/container-services/containerServices.d.ts +0 -44
  24. package/dist/container-services/containerServices.d.ts.map +0 -1
  25. package/dist/container-services/containerServices.js +0 -100
  26. package/dist/container-services/containerServices.js.map +0 -1
  27. package/dist/container-services/index.d.ts +0 -6
  28. package/dist/container-services/index.d.ts.map +0 -1
  29. package/dist/container-services/index.js +0 -12
  30. package/dist/container-services/index.js.map +0 -1
  31. package/dist/test/containerServices.spec.js +0 -132
  32. package/dist/test/containerServices.spec.js.map +0 -1
  33. package/dist/utils/attachUtils.d.ts +0 -10
  34. package/dist/utils/attachUtils.d.ts.map +0 -1
  35. package/dist/utils/attachUtils.js +0 -25
  36. package/dist/utils/attachUtils.js.map +0 -1
  37. package/lib/container-services/containerServices.js +0 -95
  38. package/lib/container-services/containerServices.js.map +0 -1
  39. package/lib/container-services/index.js +0 -6
  40. package/lib/container-services/index.js.map +0 -1
  41. package/lib/utils/attachUtils.js +0 -21
  42. package/lib/utils/attachUtils.js.map +0 -1
@@ -1,132 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- /* eslint-disable @typescript-eslint/consistent-type-assertions */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- const assert_1 = require("assert");
9
- const runtime_utils_1 = require("@fluidframework/runtime-utils");
10
- const container_services_1 = require("../container-services");
11
- class ContainerServiceMock extends container_services_1.BaseContainerService {
12
- constructor() {
13
- super(...arguments);
14
- this.route = "";
15
- }
16
- async request(request) {
17
- this.route = request.url;
18
- return {
19
- status: 200,
20
- mimeType: "fluid/object",
21
- value: this,
22
- };
23
- }
24
- }
25
- describe("Routerlicious", () => {
26
- describe("Aqueduct", () => {
27
- describe("generateContainerServicesRequestHandler", () => {
28
- it(`Request to ${container_services_1.serviceRoutePathRoot} and no id should fail`, async () => {
29
- const requestHandler = (0, container_services_1.generateContainerServicesRequestHandler)([]);
30
- const requestParser = runtime_utils_1.RequestParser.create({ url: `/${container_services_1.serviceRoutePathRoot}` });
31
- const response = await requestHandler(requestParser, {});
32
- (0, assert_1.strict)(response, "Response returned");
33
- (0, assert_1.strict)((response === null || response === void 0 ? void 0 : response.status) === 400, "Returned 400 Status Code");
34
- });
35
- it("Unknown service should return 404 with no services", async () => {
36
- const requestHandler = (0, container_services_1.generateContainerServicesRequestHandler)([]);
37
- const requestParser = runtime_utils_1.RequestParser.create({ url: `/${container_services_1.serviceRoutePathRoot}/id1` });
38
- const response = await requestHandler(requestParser, {});
39
- (0, assert_1.strict)(response, "Response returned");
40
- (0, assert_1.strict)((response === null || response === void 0 ? void 0 : response.status) === 404, "Returned 404 Status Code");
41
- });
42
- it("Unknown service should return 404 with services", async () => {
43
- const requestHandler = (0, container_services_1.generateContainerServicesRequestHandler)([
44
- ["id1", async (r) => new ContainerServiceMock(r)],
45
- ]);
46
- const requestParser = runtime_utils_1.RequestParser.create({ url: `/${container_services_1.serviceRoutePathRoot}/id2` });
47
- const response = await requestHandler(requestParser, {});
48
- (0, assert_1.strict)(response, "Response returned");
49
- (0, assert_1.strict)((response === null || response === void 0 ? void 0 : response.status) === 404, "Returned 404 Status Code");
50
- });
51
- it("Request to non-routeable service with sub-route should fail", async () => {
52
- const requestHandler = (0, container_services_1.generateContainerServicesRequestHandler)([
53
- [
54
- "id1",
55
- async (r) => {
56
- return {};
57
- },
58
- ],
59
- ]);
60
- const requestParser = runtime_utils_1.RequestParser.create({
61
- url: `/${container_services_1.serviceRoutePathRoot}/id1/subroute`,
62
- });
63
- const response = await requestHandler(requestParser, {});
64
- (0, assert_1.strict)(response, "Response returned");
65
- (0, assert_1.strict)((response === null || response === void 0 ? void 0 : response.status) === 400, "Returned 400 Status Code");
66
- });
67
- it("Correct service should be returned with single service", async () => {
68
- const service1 = new ContainerServiceMock({});
69
- const serviceMap = new Map();
70
- serviceMap.set("id1", async (r) => service1);
71
- const requestHandler = (0, container_services_1.generateContainerServicesRequestHandler)(serviceMap);
72
- const requestParser = runtime_utils_1.RequestParser.create({ url: `/${container_services_1.serviceRoutePathRoot}/id1` });
73
- const response = await requestHandler(requestParser, {});
74
- (0, assert_1.strict)(response, "Response returned");
75
- (0, assert_1.strict)((response === null || response === void 0 ? void 0 : response.status) === 200, "Returned 200 Status Code");
76
- (0, assert_1.strict)((response === null || response === void 0 ? void 0 : response.value) === service1, "Returned expected service");
77
- });
78
- it("Same service should be returned twice with two calls", async () => {
79
- const requestHandler = (0, container_services_1.generateContainerServicesRequestHandler)([
80
- ["id1", async (r) => new ContainerServiceMock(r)],
81
- ]);
82
- const requestParser = runtime_utils_1.RequestParser.create({ url: `/${container_services_1.serviceRoutePathRoot}/id1` });
83
- const response1 = await requestHandler(requestParser, {});
84
- const response2 = await requestHandler(requestParser, {});
85
- (0, assert_1.strict)((response1 === null || response1 === void 0 ? void 0 : response1.value) === (response2 === null || response2 === void 0 ? void 0 : response2.value), "Returned same service twice");
86
- });
87
- it("Correct service should be returned with multiple services", async () => {
88
- const service2 = new ContainerServiceMock({});
89
- const requestHandler = (0, container_services_1.generateContainerServicesRequestHandler)([
90
- ["id1", async (r) => new ContainerServiceMock(r)],
91
- ["id2", async (r) => service2],
92
- ]);
93
- const requestParser = runtime_utils_1.RequestParser.create({ url: `/${container_services_1.serviceRoutePathRoot}/id2` });
94
- const response = await requestHandler(requestParser, {});
95
- (0, assert_1.strict)(response, "Response returned");
96
- (0, assert_1.strict)((response === null || response === void 0 ? void 0 : response.status) === 200, "Returned 200 Status Code");
97
- (0, assert_1.strict)((response === null || response === void 0 ? void 0 : response.value) === service2, "Returned expected service");
98
- });
99
- it("Last registered service should be returned with multiple services of the same name", async () => {
100
- const service1 = new ContainerServiceMock({});
101
- const requestHandler = (0, container_services_1.generateContainerServicesRequestHandler)([
102
- ["id1", async (r) => new ContainerServiceMock(r)],
103
- ["id1", async (r) => new ContainerServiceMock(r)],
104
- ["id1", async (r) => new ContainerServiceMock(r)],
105
- ["id1", async (r) => new ContainerServiceMock(r)],
106
- ["id1", async (r) => new ContainerServiceMock(r)],
107
- ["id1", async (r) => service1],
108
- ]);
109
- const requestParser = runtime_utils_1.RequestParser.create({ url: `/${container_services_1.serviceRoutePathRoot}/id1` });
110
- const response = await requestHandler(requestParser, {});
111
- (0, assert_1.strict)(response, "Response returned");
112
- (0, assert_1.strict)((response === null || response === void 0 ? void 0 : response.status) === 200, "Returned 200 Status Code");
113
- (0, assert_1.strict)((response === null || response === void 0 ? void 0 : response.value) === service1, "Returned expected service");
114
- });
115
- it("Sub-route should be persisted through", async () => {
116
- const service1 = new ContainerServiceMock({});
117
- const requestHandler = (0, container_services_1.generateContainerServicesRequestHandler)([
118
- ["id1", async (r) => service1],
119
- ]);
120
- const requestParser = runtime_utils_1.RequestParser.create({
121
- url: `/${container_services_1.serviceRoutePathRoot}/id1/sub1`,
122
- });
123
- const response = await requestHandler(requestParser, {});
124
- (0, assert_1.strict)(response, "Response returned");
125
- (0, assert_1.strict)((response === null || response === void 0 ? void 0 : response.status) === 200, "Returned 200 Status Code");
126
- (0, assert_1.strict)((response === null || response === void 0 ? void 0 : response.value) === service1, "Returned expected service");
127
- (0, assert_1.strict)((response === null || response === void 0 ? void 0 : response.value).route === "/sub1", "sub-route persisted");
128
- });
129
- });
130
- });
131
- });
132
- //# sourceMappingURL=containerServices.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"containerServices.spec.js","sourceRoot":"","sources":["../../src/test/containerServices.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,kEAAkE;;AAElE,mCAA0C;AAG1C,iEAA8D;AAC9D,8DAI+B;AAE/B,MAAM,oBAAqB,SAAQ,yCAAoB;IAAvD;;QACQ,UAAK,GAAW,EAAE,CAAC;IAU3B,CAAC;IARO,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC;QACzB,OAAO;YACN,MAAM,EAAE,GAAG;YACX,QAAQ,EAAE,cAAc;YACxB,KAAK,EAAE,IAAI;SACX,CAAC;IACH,CAAC;CACD;AAED,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;QACzB,QAAQ,CAAC,yCAAyC,EAAE,GAAG,EAAE;YACxD,EAAE,CAAC,cAAc,yCAAoB,wBAAwB,EAAE,KAAK,IAAI,EAAE;gBACzE,MAAM,cAAc,GAAG,IAAA,4DAAuC,EAAC,EAAE,CAAC,CAAC;gBACnE,MAAM,aAAa,GAAG,6BAAa,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,yCAAoB,EAAE,EAAE,CAAC,CAAC;gBAEhF,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,aAAa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AAC,CAAC;gBAC7D,IAAA,eAAM,EAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,MAAK,QAAQ,EAAE,2BAA2B,CAAC,CAAC;gBAClE,IAAA,eAAM,EACL,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAA8B,CAAA,CAAC,KAAK,KAAK,OAAO,EAC3D,qBAAqB,CACrB,CAAC;YACH,CAAC,CAAC,CAAC;QACJ,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/* eslint-disable @typescript-eslint/consistent-type-assertions */\n\nimport { strict as assert } from \"assert\";\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { RequestParser } from \"@fluidframework/runtime-utils\";\nimport {\n\tBaseContainerService,\n\tgenerateContainerServicesRequestHandler,\n\tserviceRoutePathRoot,\n} from \"../container-services\";\n\nclass ContainerServiceMock extends BaseContainerService {\n\tpublic route: string = \"\";\n\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\tthis.route = request.url;\n\t\treturn {\n\t\t\tstatus: 200,\n\t\t\tmimeType: \"fluid/object\",\n\t\t\tvalue: this,\n\t\t};\n\t}\n}\n\ndescribe(\"Routerlicious\", () => {\n\tdescribe(\"Aqueduct\", () => {\n\t\tdescribe(\"generateContainerServicesRequestHandler\", () => {\n\t\t\tit(`Request to ${serviceRoutePathRoot} and no id should fail`, async () => {\n\t\t\t\tconst requestHandler = generateContainerServicesRequestHandler([]);\n\t\t\t\tconst requestParser = RequestParser.create({ url: `/${serviceRoutePathRoot}` });\n\n\t\t\t\tconst response = await requestHandler(requestParser, {} as IContainerRuntime);\n\n\t\t\t\tassert(response, \"Response returned\");\n\t\t\t\tassert(response?.status === 400, \"Returned 400 Status Code\");\n\t\t\t});\n\n\t\t\tit(\"Unknown service should return 404 with no services\", async () => {\n\t\t\t\tconst requestHandler = generateContainerServicesRequestHandler([]);\n\t\t\t\tconst requestParser = RequestParser.create({ url: `/${serviceRoutePathRoot}/id1` });\n\n\t\t\t\tconst response = await requestHandler(requestParser, {} as IContainerRuntime);\n\n\t\t\t\tassert(response, \"Response returned\");\n\t\t\t\tassert(response?.status === 404, \"Returned 404 Status Code\");\n\t\t\t});\n\n\t\t\tit(\"Unknown service should return 404 with services\", async () => {\n\t\t\t\tconst requestHandler = generateContainerServicesRequestHandler([\n\t\t\t\t\t[\"id1\", async (r) => new ContainerServiceMock(r)],\n\t\t\t\t]);\n\t\t\t\tconst requestParser = RequestParser.create({ url: `/${serviceRoutePathRoot}/id2` });\n\n\t\t\t\tconst response = await requestHandler(requestParser, {} as IContainerRuntime);\n\n\t\t\t\tassert(response, \"Response returned\");\n\t\t\t\tassert(response?.status === 404, \"Returned 404 Status Code\");\n\t\t\t});\n\n\t\t\tit(\"Request to non-routeable service with sub-route should fail\", async () => {\n\t\t\t\tconst requestHandler = generateContainerServicesRequestHandler([\n\t\t\t\t\t[\n\t\t\t\t\t\t\"id1\",\n\t\t\t\t\t\tasync (r) => {\n\t\t\t\t\t\t\treturn {};\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t]);\n\t\t\t\tconst requestParser = RequestParser.create({\n\t\t\t\t\turl: `/${serviceRoutePathRoot}/id1/subroute`,\n\t\t\t\t});\n\n\t\t\t\tconst response = await requestHandler(requestParser, {} as IContainerRuntime);\n\n\t\t\t\tassert(response, \"Response returned\");\n\t\t\t\tassert(response?.status === 400, \"Returned 400 Status Code\");\n\t\t\t});\n\n\t\t\tit(\"Correct service should be returned with single service\", async () => {\n\t\t\t\tconst service1 = new ContainerServiceMock({} as IContainerRuntime);\n\t\t\t\tconst serviceMap = new Map();\n\t\t\t\tserviceMap.set(\"id1\", async (r) => service1);\n\t\t\t\tconst requestHandler = generateContainerServicesRequestHandler(serviceMap);\n\t\t\t\tconst requestParser = RequestParser.create({ url: `/${serviceRoutePathRoot}/id1` });\n\n\t\t\t\tconst response = await requestHandler(requestParser, {} as IContainerRuntime);\n\n\t\t\t\tassert(response, \"Response returned\");\n\t\t\t\tassert(response?.status === 200, \"Returned 200 Status Code\");\n\t\t\t\tassert(response?.value === service1, \"Returned expected service\");\n\t\t\t});\n\n\t\t\tit(\"Same service should be returned twice with two calls\", async () => {\n\t\t\t\tconst requestHandler = generateContainerServicesRequestHandler([\n\t\t\t\t\t[\"id1\", async (r) => new ContainerServiceMock(r)],\n\t\t\t\t]);\n\t\t\t\tconst requestParser = RequestParser.create({ url: `/${serviceRoutePathRoot}/id1` });\n\n\t\t\t\tconst response1 = await requestHandler(requestParser, {} as IContainerRuntime);\n\t\t\t\tconst response2 = await requestHandler(requestParser, {} as IContainerRuntime);\n\n\t\t\t\tassert(response1?.value === response2?.value, \"Returned same service twice\");\n\t\t\t});\n\n\t\t\tit(\"Correct service should be returned with multiple services\", async () => {\n\t\t\t\tconst service2 = new ContainerServiceMock({} as IContainerRuntime);\n\t\t\t\tconst requestHandler = generateContainerServicesRequestHandler([\n\t\t\t\t\t[\"id1\", async (r) => new ContainerServiceMock(r)],\n\t\t\t\t\t[\"id2\", async (r) => service2],\n\t\t\t\t]);\n\t\t\t\tconst requestParser = RequestParser.create({ url: `/${serviceRoutePathRoot}/id2` });\n\n\t\t\t\tconst response = await requestHandler(requestParser, {} as IContainerRuntime);\n\n\t\t\t\tassert(response, \"Response returned\");\n\t\t\t\tassert(response?.status === 200, \"Returned 200 Status Code\");\n\t\t\t\tassert(response?.value === service2, \"Returned expected service\");\n\t\t\t});\n\n\t\t\tit(\"Last registered service should be returned with multiple services of the same name\", async () => {\n\t\t\t\tconst service1 = new ContainerServiceMock({} as IContainerRuntime);\n\t\t\t\tconst requestHandler = generateContainerServicesRequestHandler([\n\t\t\t\t\t[\"id1\", async (r) => new ContainerServiceMock(r)],\n\t\t\t\t\t[\"id1\", async (r) => new ContainerServiceMock(r)],\n\t\t\t\t\t[\"id1\", async (r) => new ContainerServiceMock(r)],\n\t\t\t\t\t[\"id1\", async (r) => new ContainerServiceMock(r)],\n\t\t\t\t\t[\"id1\", async (r) => new ContainerServiceMock(r)],\n\t\t\t\t\t[\"id1\", async (r) => service1],\n\t\t\t\t]);\n\t\t\t\tconst requestParser = RequestParser.create({ url: `/${serviceRoutePathRoot}/id1` });\n\n\t\t\t\tconst response = await requestHandler(requestParser, {} as IContainerRuntime);\n\n\t\t\t\tassert(response, \"Response returned\");\n\t\t\t\tassert(response?.status === 200, \"Returned 200 Status Code\");\n\t\t\t\tassert(response?.value === service1, \"Returned expected service\");\n\t\t\t});\n\n\t\t\tit(\"Sub-route should be persisted through\", async () => {\n\t\t\t\tconst service1 = new ContainerServiceMock({} as IContainerRuntime);\n\t\t\t\tconst requestHandler = generateContainerServicesRequestHandler([\n\t\t\t\t\t[\"id1\", async (r) => service1],\n\t\t\t\t]);\n\t\t\t\tconst requestParser = RequestParser.create({\n\t\t\t\t\turl: `/${serviceRoutePathRoot}/id1/sub1`,\n\t\t\t\t});\n\n\t\t\t\tconst response = await requestHandler(requestParser, {} as IContainerRuntime);\n\n\t\t\t\tassert(response, \"Response returned\");\n\t\t\t\tassert(response?.status === 200, \"Returned 200 Status Code\");\n\t\t\t\tassert(response?.value === service1, \"Returned expected service\");\n\t\t\t\tassert(\n\t\t\t\t\t(response?.value as ContainerServiceMock).route === \"/sub1\",\n\t\t\t\t\t\"sub-route persisted\",\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n});\n"]}
@@ -1,10 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
6
- /**
7
- * @deprecated 2.0.0-internal.3.3.0 Prefer not to inspect and react to the attach state unless necessary. If needed, instead inspect the IFluidDataStoreRuntime's attachState property, and await the "attached" event if not attached.
8
- */
9
- export declare function waitForAttach(dataStoreRuntime: IFluidDataStoreRuntime): Promise<void>;
10
- //# sourceMappingURL=attachUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachUtils.d.ts","sourceRoot":"","sources":["../../src/utils/attachUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAG/E;;GAEG;AACH,wBAAsB,aAAa,CAAC,gBAAgB,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAY3F"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.waitForAttach = void 0;
8
- const container_definitions_1 = require("@fluidframework/container-definitions");
9
- /**
10
- * @deprecated 2.0.0-internal.3.3.0 Prefer not to inspect and react to the attach state unless necessary. If needed, instead inspect the IFluidDataStoreRuntime's attachState property, and await the "attached" event if not attached.
11
- */
12
- async function waitForAttach(dataStoreRuntime) {
13
- if (dataStoreRuntime.attachState === container_definitions_1.AttachState.Attached) {
14
- return;
15
- }
16
- return new Promise((resolve) => {
17
- dataStoreRuntime.once("attached", () => {
18
- Promise.resolve()
19
- .then(() => resolve())
20
- .catch(() => { });
21
- });
22
- });
23
- }
24
- exports.waitForAttach = waitForAttach;
25
- //# sourceMappingURL=attachUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachUtils.js","sourceRoot":"","sources":["../../src/utils/attachUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iFAAoE;AAEpE;;GAEG;AACI,KAAK,UAAU,aAAa,CAAC,gBAAwC;IAC3E,IAAI,gBAAgB,CAAC,WAAW,KAAK,mCAAW,CAAC,QAAQ,EAAE;QAC1D,OAAO;KACP;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE;YACtC,OAAO,CAAC,OAAO,EAAE;iBACf,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;iBACrB,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AAZD,sCAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\n\n/**\n * @deprecated 2.0.0-internal.3.3.0 Prefer not to inspect and react to the attach state unless necessary. If needed, instead inspect the IFluidDataStoreRuntime's attachState property, and await the \"attached\" event if not attached.\n */\nexport async function waitForAttach(dataStoreRuntime: IFluidDataStoreRuntime): Promise<void> {\n\tif (dataStoreRuntime.attachState === AttachState.Attached) {\n\t\treturn;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tdataStoreRuntime.once(\"attached\", () => {\n\t\t\tPromise.resolve()\n\t\t\t\t.then(() => resolve())\n\t\t\t\t.catch(() => {});\n\t\t});\n\t});\n}\n"]}
@@ -1,95 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { create404Response, createResponseError, } from "@fluidframework/runtime-utils";
6
- // TODO: should this just be "s"?
7
- /**
8
- * @deprecated See {@link @fluidframework/synthesize#DependencyContainer}
9
- */
10
- export const serviceRoutePathRoot = "_services";
11
- /**
12
- * This class is a simple starter class for building a Container Service. It simply provides routing
13
- * @deprecated Use {@link @fluidframework/synthesize#DependencyContainer} as a replacement for this class
14
- */
15
- export class BaseContainerService {
16
- /**
17
- * @deprecated Use {@link @fluidframework/synthesize#DependencyContainer} as a replacement for this class
18
- */
19
- constructor(runtime) {
20
- this.runtime = runtime;
21
- }
22
- /**
23
- * @deprecated Use {@link @fluidframework/synthesize#DependencyContainer} as a replacement for this class
24
- */
25
- get IFluidRouter() {
26
- return this;
27
- }
28
- /**
29
- * @deprecated Use {@link @fluidframework/synthesize#DependencyContainer} as a replacement for this class
30
- */
31
- async request(request) {
32
- return {
33
- status: 200,
34
- mimeType: "fluid/object",
35
- value: this,
36
- };
37
- }
38
- }
39
- /**
40
- * ContainerService Factory that will only create one instance of the service for the Container.
41
- */
42
- class SingletonContainerServiceFactory {
43
- constructor(serviceFn) {
44
- this.serviceFn = serviceFn;
45
- }
46
- async getService(runtime) {
47
- if (!this.service) {
48
- this.service = this.serviceFn(runtime);
49
- }
50
- return this.service;
51
- }
52
- }
53
- /**
54
- * Given a collection of IContainerServices will produce a RequestHandler for them all
55
- * @param serviceRegistry - Collection of Container Services
56
- * @deprecated See {@link @fluidframework/synthesize#DependencyContainer}
57
- */
58
- export const generateContainerServicesRequestHandler = (serviceRegistry) => {
59
- const factories = new Map();
60
- new Map(serviceRegistry).forEach((fn, id) => {
61
- factories.set(id, new SingletonContainerServiceFactory(fn));
62
- });
63
- return async (request, runtime) => {
64
- if (request.pathParts[0] !== serviceRoutePathRoot) {
65
- // If the request is not for a service we return undefined so the next handler can use it
66
- return undefined;
67
- }
68
- if (request.pathParts.length < 2) {
69
- // If there is not service to route to then return a failure
70
- return createResponseError(400, "request did not specify a service to route to", request);
71
- }
72
- const factory = factories.get(request.pathParts[1]);
73
- if (!factory) {
74
- // If we can't find a registry entry then return
75
- return create404Response(request);
76
- }
77
- const service = await factory.getService(runtime);
78
- const router = service.IFluidRouter;
79
- const subRequest = request.createSubRequest(2);
80
- if (router) {
81
- return router.request(subRequest);
82
- }
83
- if (!request.isLeaf(2)) {
84
- // If there is not terminating route but a sub-route was requested then we will fail.
85
- return createResponseError(400, "request sub-url for service that doesn't support routing", request);
86
- }
87
- // Otherwise we will just return the service
88
- return {
89
- status: 200,
90
- mimeType: "fluid/object",
91
- value: service,
92
- };
93
- };
94
- };
95
- //# sourceMappingURL=containerServices.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"containerServices.js","sourceRoot":"","sources":["../../src/container-services/containerServices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAEN,iBAAiB,EACjB,mBAAmB,GACnB,MAAM,+BAA+B,CAAC;AAEvC,iCAAiC;AACjC;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAShD;;;GAGG;AACH,MAAM,OAAgB,oBAAoB;IAQzC;;OAEG;IACH,YAA+B,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;IAAG,CAAC;IAV7D;;OAEG;IACH,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAOD;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,OAAO;YACN,MAAM,EAAE,GAAG;YACX,QAAQ,EAAE,cAAc;YACxB,KAAK,EAAE,IAAI;SACX,CAAC;IACH,CAAC;CACD;AAED;;GAEG;AACH,MAAM,gCAAgC;IAGrC,YACkB,SAA+D;QAA/D,cAAS,GAAT,SAAS,CAAsD;IAC9E,CAAC;IAEG,KAAK,CAAC,UAAU,CAAC,OAA0B;QACjD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;SACvC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;CACD;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,CACtD,eAAgD,EACxB,EAAE;IAC1B,MAAM,SAAS,GAAkD,IAAI,GAAG,EAAE,CAAC;IAC3E,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;QAC3C,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,gCAAgC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,EAAE,OAAsB,EAAE,OAA0B,EAAE,EAAE;QACnE,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,oBAAoB,EAAE;YAClD,yFAAyF;YACzF,OAAO,SAAS,CAAC;SACjB;QAED,IAAI,OAAO,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACjC,4DAA4D;YAC5D,OAAO,mBAAmB,CACzB,GAAG,EACH,+CAA+C,EAC/C,OAAO,CACP,CAAC;SACF;QAED,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO,EAAE;YACb,gDAAgD;YAChD,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;SAClC;QAED,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;QACpC,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAC/C,IAAI,MAAM,EAAE;YACX,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;SAClC;QAED,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;YACvB,qFAAqF;YACrF,OAAO,mBAAmB,CACzB,GAAG,EACH,0DAA0D,EAC1D,OAAO,CACP,CAAC;SACF;QAED,4CAA4C;QAC5C,OAAO;YACN,MAAM,EAAE,GAAG;YACX,QAAQ,EAAE,cAAc;YACxB,KAAK,EAAE,OAAO;SACd,CAAC;IACH,CAAC,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IResponse, IFluidRouter, IRequest, FluidObject } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { RuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport {\n\tRequestParser,\n\tcreate404Response,\n\tcreateResponseError,\n} from \"@fluidframework/runtime-utils\";\n\n// TODO: should this just be \"s\"?\n/**\n * @deprecated See {@link @fluidframework/synthesize#DependencyContainer}\n */\nexport const serviceRoutePathRoot = \"_services\";\n\n/**\n * @deprecated See {@link @fluidframework/synthesize#DependencyContainer}\n */\nexport type ContainerServiceRegistryEntries = Iterable<\n\t[string, (runtime: IContainerRuntime) => Promise<FluidObject>]\n>;\n\n/**\n * This class is a simple starter class for building a Container Service. It simply provides routing\n * @deprecated Use {@link @fluidframework/synthesize#DependencyContainer} as a replacement for this class\n */\nexport abstract class BaseContainerService implements IFluidRouter {\n\t/**\n\t * @deprecated Use {@link @fluidframework/synthesize#DependencyContainer} as a replacement for this class\n\t */\n\tpublic get IFluidRouter() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * @deprecated Use {@link @fluidframework/synthesize#DependencyContainer} as a replacement for this class\n\t */\n\tconstructor(protected readonly runtime: IContainerRuntime) {}\n\n\t/**\n\t * @deprecated Use {@link @fluidframework/synthesize#DependencyContainer} as a replacement for this class\n\t */\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\treturn {\n\t\t\tstatus: 200,\n\t\t\tmimeType: \"fluid/object\",\n\t\t\tvalue: this,\n\t\t};\n\t}\n}\n\n/**\n * ContainerService Factory that will only create one instance of the service for the Container.\n */\nclass SingletonContainerServiceFactory {\n\tprivate service: Promise<FluidObject> | undefined;\n\n\tpublic constructor(\n\t\tprivate readonly serviceFn: (runtime: IContainerRuntime) => Promise<FluidObject>,\n\t) {}\n\n\tpublic async getService(runtime: IContainerRuntime): Promise<FluidObject<IFluidRouter>> {\n\t\tif (!this.service) {\n\t\t\tthis.service = this.serviceFn(runtime);\n\t\t}\n\t\treturn this.service;\n\t}\n}\n\n/**\n * Given a collection of IContainerServices will produce a RequestHandler for them all\n * @param serviceRegistry - Collection of Container Services\n * @deprecated See {@link @fluidframework/synthesize#DependencyContainer}\n */\nexport const generateContainerServicesRequestHandler = (\n\tserviceRegistry: ContainerServiceRegistryEntries,\n): RuntimeRequestHandler => {\n\tconst factories: Map<string, SingletonContainerServiceFactory> = new Map();\n\tnew Map(serviceRegistry).forEach((fn, id) => {\n\t\tfactories.set(id, new SingletonContainerServiceFactory(fn));\n\t});\n\n\treturn async (request: RequestParser, runtime: IContainerRuntime) => {\n\t\tif (request.pathParts[0] !== serviceRoutePathRoot) {\n\t\t\t// If the request is not for a service we return undefined so the next handler can use it\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (request.pathParts.length < 2) {\n\t\t\t// If there is not service to route to then return a failure\n\t\t\treturn createResponseError(\n\t\t\t\t400,\n\t\t\t\t\"request did not specify a service to route to\",\n\t\t\t\trequest,\n\t\t\t);\n\t\t}\n\n\t\tconst factory = factories.get(request.pathParts[1]);\n\t\tif (!factory) {\n\t\t\t// If we can't find a registry entry then return\n\t\t\treturn create404Response(request);\n\t\t}\n\n\t\tconst service = await factory.getService(runtime);\n\t\tconst router = service.IFluidRouter;\n\t\tconst subRequest = request.createSubRequest(2);\n\t\tif (router) {\n\t\t\treturn router.request(subRequest);\n\t\t}\n\n\t\tif (!request.isLeaf(2)) {\n\t\t\t// If there is not terminating route but a sub-route was requested then we will fail.\n\t\t\treturn createResponseError(\n\t\t\t\t400,\n\t\t\t\t\"request sub-url for service that doesn't support routing\",\n\t\t\t\trequest,\n\t\t\t);\n\t\t}\n\n\t\t// Otherwise we will just return the service\n\t\treturn {\n\t\t\tstatus: 200,\n\t\t\tmimeType: \"fluid/object\",\n\t\t\tvalue: service,\n\t\t};\n\t};\n};\n"]}
@@ -1,6 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- export { BaseContainerService, generateContainerServicesRequestHandler, serviceRoutePathRoot, } from "./containerServices";
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/container-services/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,oBAAoB,EAEpB,uCAAuC,EACvC,oBAAoB,GACpB,MAAM,qBAAqB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tBaseContainerService,\n\tContainerServiceRegistryEntries,\n\tgenerateContainerServicesRequestHandler,\n\tserviceRoutePathRoot,\n} from \"./containerServices\";\n"]}
@@ -1,21 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { AttachState } from "@fluidframework/container-definitions";
6
- /**
7
- * @deprecated 2.0.0-internal.3.3.0 Prefer not to inspect and react to the attach state unless necessary. If needed, instead inspect the IFluidDataStoreRuntime's attachState property, and await the "attached" event if not attached.
8
- */
9
- export async function waitForAttach(dataStoreRuntime) {
10
- if (dataStoreRuntime.attachState === AttachState.Attached) {
11
- return;
12
- }
13
- return new Promise((resolve) => {
14
- dataStoreRuntime.once("attached", () => {
15
- Promise.resolve()
16
- .then(() => resolve())
17
- .catch(() => { });
18
- });
19
- });
20
- }
21
- //# sourceMappingURL=attachUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachUtils.js","sourceRoot":"","sources":["../../src/utils/attachUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAEpE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,gBAAwC;IAC3E,IAAI,gBAAgB,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,EAAE;QAC1D,OAAO;KACP;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE;YACtC,OAAO,CAAC,OAAO,EAAE;iBACf,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;iBACrB,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\n\n/**\n * @deprecated 2.0.0-internal.3.3.0 Prefer not to inspect and react to the attach state unless necessary. If needed, instead inspect the IFluidDataStoreRuntime's attachState property, and await the \"attached\" event if not attached.\n */\nexport async function waitForAttach(dataStoreRuntime: IFluidDataStoreRuntime): Promise<void> {\n\tif (dataStoreRuntime.attachState === AttachState.Attached) {\n\t\treturn;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tdataStoreRuntime.once(\"attached\", () => {\n\t\t\tPromise.resolve()\n\t\t\t\t.then(() => resolve())\n\t\t\t\t.catch(() => {});\n\t\t});\n\t});\n}\n"]}