@fluidframework/aqueduct 2.0.0-internal.7.3.0 → 2.0.0-internal.8.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 (102) hide show
  1. package/dist/aqueduct-alpha.d.ts +365 -0
  2. package/dist/aqueduct-beta.d.ts +120 -0
  3. package/dist/aqueduct-public.d.ts +120 -0
  4. package/dist/aqueduct-untrimmed.d.ts +365 -0
  5. package/dist/container-runtime-factories/baseContainerRuntimeFactory.cjs +1 -1
  6. package/dist/container-runtime-factories/baseContainerRuntimeFactory.cjs.map +1 -1
  7. package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts +2 -2
  8. package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -1
  9. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.cjs +14 -5
  10. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.cjs.map +1 -1
  11. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +2 -2
  12. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
  13. package/dist/data-object-factories/dataObjectFactory.cjs +1 -1
  14. package/dist/data-object-factories/dataObjectFactory.cjs.map +1 -1
  15. package/dist/data-object-factories/dataObjectFactory.d.ts +1 -1
  16. package/dist/data-object-factories/index.cjs.map +1 -1
  17. package/dist/data-object-factories/index.d.ts +1 -1
  18. package/dist/data-object-factories/index.d.ts.map +1 -1
  19. package/dist/data-object-factories/pureDataObjectFactory.cjs +1 -1
  20. package/dist/data-object-factories/pureDataObjectFactory.cjs.map +1 -1
  21. package/dist/data-object-factories/pureDataObjectFactory.d.ts +2 -10
  22. package/dist/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
  23. package/dist/data-objects/dataObject.cjs +1 -1
  24. package/dist/data-objects/dataObject.cjs.map +1 -1
  25. package/dist/data-objects/dataObject.d.ts +1 -1
  26. package/dist/data-objects/pureDataObject.cjs +1 -8
  27. package/dist/data-objects/pureDataObject.cjs.map +1 -1
  28. package/dist/data-objects/pureDataObject.d.ts +3 -7
  29. package/dist/data-objects/pureDataObject.d.ts.map +1 -1
  30. package/dist/data-objects/types.cjs.map +1 -1
  31. package/dist/data-objects/types.d.ts +2 -2
  32. package/dist/index.cjs +1 -9
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.ts +1 -3
  35. package/dist/index.d.ts.map +1 -1
  36. package/lib/aqueduct-alpha.d.ts +365 -0
  37. package/lib/aqueduct-beta.d.ts +120 -0
  38. package/lib/aqueduct-public.d.ts +120 -0
  39. package/lib/aqueduct-untrimmed.d.ts +365 -0
  40. package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts +59 -0
  41. package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -0
  42. package/lib/container-runtime-factories/baseContainerRuntimeFactory.mjs +1 -1
  43. package/lib/container-runtime-factories/baseContainerRuntimeFactory.mjs.map +1 -1
  44. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +45 -0
  45. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -0
  46. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.mjs +14 -4
  47. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.mjs.map +1 -1
  48. package/lib/container-runtime-factories/index.d.ts +7 -0
  49. package/lib/container-runtime-factories/index.d.ts.map +1 -0
  50. package/lib/data-object-factories/dataObjectFactory.d.ts +23 -0
  51. package/lib/data-object-factories/dataObjectFactory.d.ts.map +1 -0
  52. package/lib/data-object-factories/dataObjectFactory.mjs +1 -1
  53. package/lib/data-object-factories/dataObjectFactory.mjs.map +1 -1
  54. package/lib/data-object-factories/index.d.ts +7 -0
  55. package/lib/data-object-factories/index.d.ts.map +1 -0
  56. package/lib/data-object-factories/index.mjs.map +1 -1
  57. package/lib/data-object-factories/pureDataObjectFactory.d.ts +91 -0
  58. package/lib/data-object-factories/pureDataObjectFactory.d.ts.map +1 -0
  59. package/lib/data-object-factories/pureDataObjectFactory.mjs +1 -1
  60. package/lib/data-object-factories/pureDataObjectFactory.mjs.map +1 -1
  61. package/lib/data-objects/dataObject.d.ts +38 -0
  62. package/lib/data-objects/dataObject.d.ts.map +1 -0
  63. package/lib/data-objects/dataObject.mjs +1 -1
  64. package/lib/data-objects/dataObject.mjs.map +1 -1
  65. package/lib/data-objects/index.d.ts +8 -0
  66. package/lib/data-objects/index.d.ts.map +1 -0
  67. package/lib/data-objects/pureDataObject.d.ts +94 -0
  68. package/lib/data-objects/pureDataObject.d.ts.map +1 -0
  69. package/lib/data-objects/pureDataObject.mjs +1 -8
  70. package/lib/data-objects/pureDataObject.mjs.map +1 -1
  71. package/lib/data-objects/types.d.ts +36 -0
  72. package/lib/data-objects/types.d.ts.map +1 -0
  73. package/lib/data-objects/types.mjs.map +1 -1
  74. package/lib/index.d.ts +8 -0
  75. package/lib/index.d.ts.map +1 -0
  76. package/lib/index.mjs +1 -3
  77. package/lib/index.mjs.map +1 -1
  78. package/package.json +79 -34
  79. package/dist/request-handlers/index.cjs +0 -12
  80. package/dist/request-handlers/index.cjs.map +0 -1
  81. package/dist/request-handlers/index.d.ts +0 -6
  82. package/dist/request-handlers/index.d.ts.map +0 -1
  83. package/dist/request-handlers/requestHandlers.cjs +0 -93
  84. package/dist/request-handlers/requestHandlers.cjs.map +0 -1
  85. package/dist/request-handlers/requestHandlers.d.ts +0 -46
  86. package/dist/request-handlers/requestHandlers.d.ts.map +0 -1
  87. package/dist/utils/containerInteractions.cjs +0 -76
  88. package/dist/utils/containerInteractions.cjs.map +0 -1
  89. package/dist/utils/containerInteractions.d.ts +0 -42
  90. package/dist/utils/containerInteractions.d.ts.map +0 -1
  91. package/dist/utils/index.cjs +0 -12
  92. package/dist/utils/index.cjs.map +0 -1
  93. package/dist/utils/index.d.ts +0 -6
  94. package/dist/utils/index.d.ts.map +0 -1
  95. package/lib/request-handlers/index.mjs +0 -6
  96. package/lib/request-handlers/index.mjs.map +0 -1
  97. package/lib/request-handlers/requestHandlers.mjs +0 -86
  98. package/lib/request-handlers/requestHandlers.mjs.map +0 -1
  99. package/lib/utils/containerInteractions.mjs +0 -70
  100. package/lib/utils/containerInteractions.mjs.map +0 -1
  101. package/lib/utils/index.mjs +0 -6
  102. package/lib/utils/index.mjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/aqueduct",
3
- "version": "2.0.0-internal.7.3.0",
3
+ "version": "2.0.0-internal.8.0.0",
4
4
  "description": "A set of implementations for Fluid Framework interfaces.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -11,18 +11,6 @@
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
13
13
  "sideEffects": false,
14
- "exports": {
15
- ".": {
16
- "import": {
17
- "types": "./lib/index.d.ts",
18
- "default": "./lib/index.mjs"
19
- },
20
- "require": {
21
- "types": "./dist/index.d.ts",
22
- "default": "./dist/index.cjs"
23
- }
24
- }
25
- },
26
14
  "main": "dist/index.cjs",
27
15
  "module": "lib/index.mjs",
28
16
  "types": "dist/index.d.ts",
@@ -52,34 +40,36 @@
52
40
  "temp-directory": "nyc/.nyc_output"
53
41
  },
54
42
  "dependencies": {
55
- "@fluid-internal/client-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
56
- "@fluidframework/container-definitions": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
57
- "@fluidframework/container-runtime": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
58
- "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
59
- "@fluidframework/core-interfaces": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
60
- "@fluidframework/core-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
61
- "@fluidframework/datastore": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
62
- "@fluidframework/datastore-definitions": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
63
- "@fluidframework/map": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
64
- "@fluidframework/request-handler": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
65
- "@fluidframework/runtime-definitions": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
66
- "@fluidframework/runtime-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
67
- "@fluidframework/synthesize": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
68
- "@fluidframework/view-interfaces": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
43
+ "@fluid-internal/client-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
44
+ "@fluidframework/container-definitions": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
45
+ "@fluidframework/container-runtime": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
46
+ "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
47
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
48
+ "@fluidframework/core-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
49
+ "@fluidframework/datastore": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
50
+ "@fluidframework/datastore-definitions": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
51
+ "@fluidframework/map": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
52
+ "@fluidframework/request-handler": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
53
+ "@fluidframework/runtime-definitions": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
54
+ "@fluidframework/runtime-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
55
+ "@fluidframework/synthesize": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
56
+ "@fluidframework/view-interfaces": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
69
57
  "uuid": "^9.0.0"
70
58
  },
71
59
  "devDependencies": {
60
+ "@arethetypeswrong/cli": "^0.13.3",
72
61
  "@fluid-tools/build-cli": "^0.28.0",
73
62
  "@fluidframework/aqueduct-previous": "npm:@fluidframework/aqueduct@2.0.0-internal.7.2.0",
74
63
  "@fluidframework/build-common": "^2.0.3",
75
64
  "@fluidframework/build-tools": "^0.28.0",
76
65
  "@fluidframework/eslint-config-fluid": "^3.1.0",
77
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
66
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
78
67
  "@microsoft/api-extractor": "^7.38.3",
79
68
  "@types/events": "^3.0.0",
80
69
  "@types/mocha": "^9.1.1",
81
- "@types/node": "^16.18.38",
70
+ "@types/node": "^18.19.0",
82
71
  "c8": "^7.7.1",
72
+ "copyfiles": "^2.4.1",
83
73
  "cross-env": "^7.0.3",
84
74
  "eslint": "~8.50.0",
85
75
  "mocha": "^10.2.0",
@@ -91,25 +81,80 @@
91
81
  "tsc-multi": "^1.1.0",
92
82
  "typescript": "~5.1.6"
93
83
  },
84
+ "fluidBuild": {
85
+ "tasks": {
86
+ "build:docs": {
87
+ "dependsOn": [
88
+ "...",
89
+ "api-extractor:commonjs",
90
+ "api-extractor:esnext"
91
+ ],
92
+ "script": false
93
+ }
94
+ }
95
+ },
94
96
  "typeValidation": {
95
- "broken": {}
97
+ "broken": {
98
+ "RemovedFunctionDeclaration_getDefaultObjectFromContainer": {
99
+ "forwardCompat": false,
100
+ "backCompat": false
101
+ },
102
+ "RemovedFunctionDeclaration_getObjectFromContainer": {
103
+ "forwardCompat": false,
104
+ "backCompat": false
105
+ },
106
+ "RemovedFunctionDeclaration_getObjectWithIdFromContainer": {
107
+ "forwardCompat": false,
108
+ "backCompat": false
109
+ },
110
+ "RemovedFunctionDeclaration_defaultFluidObjectRequestHandler": {
111
+ "forwardCompat": false,
112
+ "backCompat": false
113
+ },
114
+ "RemovedVariableDeclaration_defaultRouteRequestHandler": {
115
+ "forwardCompat": false,
116
+ "backCompat": false
117
+ },
118
+ "RemovedVariableDeclaration_mountableViewRequestHandler": {
119
+ "forwardCompat": false,
120
+ "backCompat": false
121
+ },
122
+ "ClassDeclaration_DataObject": {
123
+ "backCompat": false
124
+ },
125
+ "RemovedInterfaceDeclaration_IRootDataObjectFactory": {
126
+ "forwardCompat": false,
127
+ "backCompat": false
128
+ },
129
+ "ClassDeclaration_PureDataObject": {
130
+ "backCompat": false
131
+ },
132
+ "InterfaceDeclaration_IDataObjectProps": {
133
+ "backCompat": false
134
+ }
135
+ }
96
136
  },
97
137
  "scripts": {
138
+ "api": "fluid-build . --task api",
139
+ "api-extractor:commonjs": "api-extractor run --local",
140
+ "api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
98
141
  "build": "fluid-build . --task build",
99
142
  "build:commonjs": "fluid-build . --task commonjs",
100
143
  "build:compile": "fluid-build . --task compile",
101
- "build:docs": "api-extractor run --local",
144
+ "build:docs": "fluid-build . --task api",
102
145
  "build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
103
146
  "build:test": "tsc-multi --config ./tsc-multi.test.json",
147
+ "check:are-the-types-wrong": "attw --pack",
148
+ "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
104
149
  "ci:build:docs": "api-extractor run",
105
150
  "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
106
151
  "eslint": "eslint --format stylish src",
107
152
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
108
153
  "format": "npm run prettier:fix",
109
- "lint": "npm run prettier && npm run eslint",
154
+ "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
110
155
  "lint:fix": "npm run prettier:fix && npm run eslint:fix",
111
- "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
112
- "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
156
+ "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
157
+ "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
113
158
  "test": "npm run test:mocha",
114
159
  "test:coverage": "c8 npm test",
115
160
  "test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
@@ -1,12 +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.mountableViewRequestHandler = exports.defaultRouteRequestHandler = exports.defaultFluidObjectRequestHandler = void 0;
8
- var requestHandlers_1 = require("./requestHandlers.cjs");
9
- Object.defineProperty(exports, "defaultFluidObjectRequestHandler", { enumerable: true, get: function () { return requestHandlers_1.defaultFluidObjectRequestHandler; } });
10
- Object.defineProperty(exports, "defaultRouteRequestHandler", { enumerable: true, get: function () { return requestHandlers_1.defaultRouteRequestHandler; } });
11
- Object.defineProperty(exports, "mountableViewRequestHandler", { enumerable: true, get: function () { return requestHandlers_1.mountableViewRequestHandler; } });
12
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/request-handlers/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yDAI2B;AAH1B,mIAAA,gCAAgC,OAAA;AAChC,6HAAA,0BAA0B,OAAA;AAC1B,8HAAA,2BAA2B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tdefaultFluidObjectRequestHandler,\n\tdefaultRouteRequestHandler,\n\tmountableViewRequestHandler,\n} from \"./requestHandlers\";\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 { defaultFluidObjectRequestHandler, defaultRouteRequestHandler, mountableViewRequestHandler, } from "./requestHandlers";
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/request-handlers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,gCAAgC,EAChC,0BAA0B,EAC1B,2BAA2B,GAC3B,MAAM,mBAAmB,CAAC"}
@@ -1,93 +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.defaultFluidObjectRequestHandler = exports.defaultRouteRequestHandler = exports.mountableViewRequestHandler = void 0;
8
- // eslint-disable-next-line import/no-deprecated
9
- const request_handler_1 = require("@fluidframework/request-handler");
10
- const runtime_utils_1 = require("@fluidframework/runtime-utils");
11
- /**
12
- * A mountable view is only required if the view needs to be mounted across a bundle boundary. Mounting across
13
- * bundle boundaries breaks some frameworks, so the mountable view is used to ensure the mounting is done within
14
- * the same bundle as the view. For example, React hooks don't work if mounted across bundles since there will
15
- * be two React instances, breaking the Rules of Hooks. When cross-bundle mounting isn't required, the mountable
16
- * view isn't necessary.
17
- *
18
- * When a request is received with a mountableView: true header, this request handler will reissue the request
19
- * without the header, and respond with a mountable view of the given class using the response.
20
- * @param MountableViewClass - The type of mountable view to use when responding
21
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
22
- * @public
23
- */
24
- const mountableViewRequestHandler = (MountableViewClass, handlers) => {
25
- // eslint-disable-next-line import/no-deprecated
26
- const nestedHandler = (0, request_handler_1.buildRuntimeRequestHandler)(...handlers);
27
- return async (request, runtime) => {
28
- const mountableView = request.headers?.mountableView === true;
29
- let newRequest = request;
30
- if (mountableView) {
31
- // Reissue the request without the mountableView header.
32
- // We'll repack whatever the response is if we can.
33
- const headers = { ...request.headers };
34
- delete headers.mountableView;
35
- newRequest = {
36
- url: request.url,
37
- headers,
38
- };
39
- }
40
- const response = await nestedHandler(newRequest, runtime);
41
- if (mountableView &&
42
- response.status === 200 &&
43
- MountableViewClass.canMount(response.value)) {
44
- return {
45
- status: 200,
46
- mimeType: "fluid/object",
47
- value: new MountableViewClass(response.value),
48
- };
49
- }
50
- return response;
51
- };
52
- };
53
- exports.mountableViewRequestHandler = mountableViewRequestHandler;
54
- /**
55
- * Pipe through container request into internal request.
56
- * If request is empty and default url is provided, redirect request to such default url.
57
- * @param defaultRootId - optional default root data store ID to pass request in case request is empty.
58
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
59
- * @public
60
- */
61
- const defaultRouteRequestHandler = (defaultRootId) => {
62
- return async (request, runtime) => {
63
- const parser = runtime_utils_1.RequestParser.create(request);
64
- if (parser.pathParts.length === 0) {
65
- return runtime.IFluidHandleContext.resolveHandle({
66
- url: `/${defaultRootId}${parser.query}`,
67
- headers: request.headers,
68
- });
69
- }
70
- return undefined; // continue search
71
- };
72
- };
73
- exports.defaultRouteRequestHandler = defaultRouteRequestHandler;
74
- /**
75
- * Default request handler for a Fluid object that returns the object itself if:
76
- *
77
- * 1. the request url is empty
78
- *
79
- * 2. the request url is "/"
80
- *
81
- * 3. the request url starts with "/" and is followed by a query param, such as /?key=value
82
- *
83
- * Returns a 404 error for any other url.
84
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
85
- * @public
86
- */
87
- function defaultFluidObjectRequestHandler(fluidObject, request) {
88
- return request.url === "" || request.url === "/" || request.url.startsWith("/?")
89
- ? { mimeType: "fluid/object", status: 200, value: fluidObject }
90
- : (0, runtime_utils_1.create404Response)(request);
91
- }
92
- exports.defaultFluidObjectRequestHandler = defaultFluidObjectRequestHandler;
93
- //# sourceMappingURL=requestHandlers.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requestHandlers.cjs","sourceRoot":"","sources":["../../src/request-handlers/requestHandlers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,gDAAgD;AAChD,qEAAoG;AACpG,iEAAiF;AAEjF;;;;;;;;;;;;GAYG;AACI,MAAM,2BAA2B,GAAG,CAC1C,kBAA4C,EAC5C,QAAiC,EAChC,EAAE;IACH,gDAAgD;IAChD,MAAM,aAAa,GAAG,IAAA,4CAA0B,EAAC,GAAG,QAAQ,CAAC,CAAC;IAC9D,OAAO,KAAK,EAAE,OAAsB,EAAE,OAA0B,EAAE,EAAE;QACnE,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;QAC9D,IAAI,UAAU,GAAa,OAAO,CAAC;QACnC,IAAI,aAAa,EAAE;YAClB,wDAAwD;YACxD,mDAAmD;YACnD,MAAM,OAAO,GAAmB,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;YACvD,OAAQ,OAAe,CAAC,aAAa,CAAC;YACtC,UAAU,GAAG;gBACZ,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,OAAO;aACP,CAAC;SACF;QACD,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAE1D,IACC,aAAa;YACb,QAAQ,CAAC,MAAM,KAAK,GAAG;YACvB,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC1C;YACD,OAAO;gBACN,MAAM,EAAE,GAAG;gBACX,QAAQ,EAAE,cAAc;gBACxB,KAAK,EAAE,IAAI,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC;aAC7C,CAAC;SACF;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC,CAAC;AACH,CAAC,CAAC;AAlCW,QAAA,2BAA2B,+BAkCtC;AAEF;;;;;;GAMG;AACI,MAAM,0BAA0B,GAAG,CAAC,aAAqB,EAAE,EAAE;IACnE,OAAO,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE;QAC9D,MAAM,MAAM,GAAG,6BAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,OAAO,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC;gBAChD,GAAG,EAAE,IAAI,aAAa,GAAG,MAAM,CAAC,KAAK,EAAE;gBACvC,OAAO,EAAE,OAAO,CAAC,OAAO;aACxB,CAAC,CAAC;SACH;QACD,OAAO,SAAS,CAAC,CAAC,kBAAkB;IACrC,CAAC,CAAC;AACH,CAAC,CAAC;AAXW,QAAA,0BAA0B,8BAWrC;AAEF;;;;;;;;;;;;GAYG;AACH,SAAgB,gCAAgC,CAC/C,WAAwB,EACxB,OAAiB;IAEjB,OAAO,OAAO,CAAC,GAAG,KAAK,EAAE,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;QAC/E,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE;QAC/D,CAAC,CAAC,IAAA,iCAAiB,EAAC,OAAO,CAAC,CAAC;AAC/B,CAAC;AAPD,4EAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidObject, IRequest, IRequestHeader, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport type { IFluidMountableViewClass } from \"@fluidframework/view-interfaces\";\n// eslint-disable-next-line import/no-deprecated\nimport { RuntimeRequestHandler, buildRuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\n\n/**\n * A mountable view is only required if the view needs to be mounted across a bundle boundary. Mounting across\n * bundle boundaries breaks some frameworks, so the mountable view is used to ensure the mounting is done within\n * the same bundle as the view. For example, React hooks don't work if mounted across bundles since there will\n * be two React instances, breaking the Rules of Hooks. When cross-bundle mounting isn't required, the mountable\n * view isn't necessary.\n *\n * When a request is received with a mountableView: true header, this request handler will reissue the request\n * without the header, and respond with a mountable view of the given class using the response.\n * @param MountableViewClass - The type of mountable view to use when responding\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * @public\n */\nexport const mountableViewRequestHandler = (\n\tMountableViewClass: IFluidMountableViewClass,\n\thandlers: RuntimeRequestHandler[],\n) => {\n\t// eslint-disable-next-line import/no-deprecated\n\tconst nestedHandler = buildRuntimeRequestHandler(...handlers);\n\treturn async (request: RequestParser, runtime: IContainerRuntime) => {\n\t\tconst mountableView = request.headers?.mountableView === true;\n\t\tlet newRequest: IRequest = request;\n\t\tif (mountableView) {\n\t\t\t// Reissue the request without the mountableView header.\n\t\t\t// We'll repack whatever the response is if we can.\n\t\t\tconst headers: IRequestHeader = { ...request.headers };\n\t\t\tdelete (headers as any).mountableView;\n\t\t\tnewRequest = {\n\t\t\t\turl: request.url,\n\t\t\t\theaders,\n\t\t\t};\n\t\t}\n\t\tconst response = await nestedHandler(newRequest, runtime);\n\n\t\tif (\n\t\t\tmountableView &&\n\t\t\tresponse.status === 200 &&\n\t\t\tMountableViewClass.canMount(response.value)\n\t\t) {\n\t\t\treturn {\n\t\t\t\tstatus: 200,\n\t\t\t\tmimeType: \"fluid/object\",\n\t\t\t\tvalue: new MountableViewClass(response.value),\n\t\t\t};\n\t\t}\n\t\treturn response;\n\t};\n};\n\n/**\n * Pipe through container request into internal request.\n * If request is empty and default url is provided, redirect request to such default url.\n * @param defaultRootId - optional default root data store ID to pass request in case request is empty.\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * @public\n */\nexport const defaultRouteRequestHandler = (defaultRootId: string) => {\n\treturn async (request: IRequest, runtime: IContainerRuntime) => {\n\t\tconst parser = RequestParser.create(request);\n\t\tif (parser.pathParts.length === 0) {\n\t\t\treturn runtime.IFluidHandleContext.resolveHandle({\n\t\t\t\turl: `/${defaultRootId}${parser.query}`,\n\t\t\t\theaders: request.headers,\n\t\t\t});\n\t\t}\n\t\treturn undefined; // continue search\n\t};\n};\n\n/**\n * Default request handler for a Fluid object that returns the object itself if:\n *\n * 1. the request url is empty\n *\n * 2. the request url is \"/\"\n *\n * 3. the request url starts with \"/\" and is followed by a query param, such as /?key=value\n *\n * Returns a 404 error for any other url.\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * @public\n */\nexport function defaultFluidObjectRequestHandler(\n\tfluidObject: FluidObject,\n\trequest: IRequest,\n): IResponse {\n\treturn request.url === \"\" || request.url === \"/\" || request.url.startsWith(\"/?\")\n\t\t? { mimeType: \"fluid/object\", status: 200, value: fluidObject }\n\t\t: create404Response(request);\n}\n"]}
@@ -1,46 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { FluidObject, IRequest, IResponse } from "@fluidframework/core-interfaces";
6
- import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
7
- import type { IFluidMountableViewClass } from "@fluidframework/view-interfaces";
8
- import { RuntimeRequestHandler } from "@fluidframework/request-handler";
9
- import { RequestParser } from "@fluidframework/runtime-utils";
10
- /**
11
- * A mountable view is only required if the view needs to be mounted across a bundle boundary. Mounting across
12
- * bundle boundaries breaks some frameworks, so the mountable view is used to ensure the mounting is done within
13
- * the same bundle as the view. For example, React hooks don't work if mounted across bundles since there will
14
- * be two React instances, breaking the Rules of Hooks. When cross-bundle mounting isn't required, the mountable
15
- * view isn't necessary.
16
- *
17
- * When a request is received with a mountableView: true header, this request handler will reissue the request
18
- * without the header, and respond with a mountable view of the given class using the response.
19
- * @param MountableViewClass - The type of mountable view to use when responding
20
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
21
- * @public
22
- */
23
- export declare const mountableViewRequestHandler: (MountableViewClass: IFluidMountableViewClass, handlers: RuntimeRequestHandler[]) => (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse>;
24
- /**
25
- * Pipe through container request into internal request.
26
- * If request is empty and default url is provided, redirect request to such default url.
27
- * @param defaultRootId - optional default root data store ID to pass request in case request is empty.
28
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
29
- * @public
30
- */
31
- export declare const defaultRouteRequestHandler: (defaultRootId: string) => (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
32
- /**
33
- * Default request handler for a Fluid object that returns the object itself if:
34
- *
35
- * 1. the request url is empty
36
- *
37
- * 2. the request url is "/"
38
- *
39
- * 3. the request url starts with "/" and is followed by a query param, such as /?key=value
40
- *
41
- * Returns a 404 error for any other url.
42
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
43
- * @public
44
- */
45
- export declare function defaultFluidObjectRequestHandler(fluidObject: FluidObject, request: IRequest): IResponse;
46
- //# sourceMappingURL=requestHandlers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../../src/request-handlers/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAkB,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,EAAE,qBAAqB,EAA8B,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAE,aAAa,EAAqB,MAAM,+BAA+B,CAAC;AAEjF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B,uBACnB,wBAAwB,YAClC,qBAAqB,EAAE,eAIV,aAAa,WAAW,iBAAiB,uBA4BhE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,kBAAmB,MAAM,eACxC,QAAQ,WAAW,iBAAiB,mCAU3D,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,gCAAgC,CAC/C,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,QAAQ,GACf,SAAS,CAIX"}
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getObjectFromContainer = exports.getObjectWithIdFromContainer = exports.getDefaultObjectFromContainer = void 0;
4
- /**
5
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
6
- * Helper function for getting the default Fluid Object from a Container. This function only works for
7
- * Containers that support "/" request.
8
- *
9
- * @typeParam T - Defines the type you expect to be returned.
10
- *
11
- * @param container - Container you're attempting to get the object from
12
- * @public
13
- */
14
- async function getDefaultObjectFromContainer(container) {
15
- const url = "/";
16
- const response = await container.request({ url });
17
- // Verify the response
18
- if (response.status !== 200 || response.mimeType !== "fluid/object") {
19
- throw new Error(`Unable to retrieve Fluid object at URL: "${url}"`);
20
- }
21
- else if (response.value === undefined) {
22
- throw new Error(`Empty response from URL: "${url}"`);
23
- }
24
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
25
- return response.value;
26
- }
27
- exports.getDefaultObjectFromContainer = getDefaultObjectFromContainer;
28
- /**
29
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
30
- * Helper function for getting as Fluid Object from a Container given a Unique Id. This function only works for
31
- * Containers that support getting FluidObjects via request.
32
- *
33
- * @typeParam T - Defines the type you expect to be returned.
34
- *
35
- * @param id - Unique id of the FluidObject
36
- * @param container - Container you're attempting to get the object from
37
- * @public
38
- */
39
- async function getObjectWithIdFromContainer(id, container) {
40
- const url = `/${id}`;
41
- const response = await container.request({ url });
42
- // Verify the response
43
- if (response.status !== 200 || response.mimeType !== "fluid/object") {
44
- throw new Error(`Unable to retrieve Fluid object with ID: "${id}" from URL: "${url}"`);
45
- }
46
- else if (response.value === undefined) {
47
- throw new Error(`Empty response for ID: "${id}" from URL: "${url}"`);
48
- }
49
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
50
- return response.value;
51
- }
52
- exports.getObjectWithIdFromContainer = getObjectWithIdFromContainer;
53
- /**
54
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
55
- * Helper function for getting a Fluid Object from a Container given a path/url. This function only works for
56
- * Containers that support getting FluidObjects via request.
57
- *
58
- * @typeParam T - Defines the type you expect to be returned.
59
- *
60
- * @param path - Unique path/url of the FluidObject
61
- * @param container - Container you're attempting to get the object from
62
- * @public
63
- */
64
- async function getObjectFromContainer(path, container) {
65
- const response = await container.request({ url: path });
66
- if (response.status !== 200 || response.mimeType !== "fluid/object") {
67
- throw new Error(`Unable to retrieve Fluid object with from URL: "${path}"`);
68
- }
69
- else if (response.value === undefined) {
70
- throw new Error(`Empty response for from URL: "${path}"`);
71
- }
72
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
73
- return response.value;
74
- }
75
- exports.getObjectFromContainer = getObjectFromContainer;
76
- //# sourceMappingURL=containerInteractions.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"containerInteractions.cjs","sourceRoot":"","sources":["../../src/utils/containerInteractions.ts"],"names":[],"mappings":";;;AAOA;;;;;;;;;GASG;AACI,KAAK,UAAU,6BAA6B,CAClD,SAAqB;IAErB,MAAM,GAAG,GAAG,GAAG,CAAC;IAChB,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAElD,sBAAsB;IACtB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;QACpE,MAAM,IAAI,KAAK,CAAC,4CAA4C,GAAG,GAAG,CAAC,CAAC;KACpE;SAAM,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE;QACxC,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,GAAG,CAAC,CAAC;KACrD;IAED,+DAA+D;IAC/D,OAAO,QAAQ,CAAC,KAAK,CAAC;AACvB,CAAC;AAfD,sEAeC;AAED;;;;;;;;;;GAUG;AACI,KAAK,UAAU,4BAA4B,CACjD,EAAU,EACV,SAAqB;IAErB,MAAM,GAAG,GAAG,IAAI,EAAE,EAAE,CAAC;IACrB,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAElD,sBAAsB;IACtB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;QACpE,MAAM,IAAI,KAAK,CAAC,6CAA6C,EAAE,gBAAgB,GAAG,GAAG,CAAC,CAAC;KACvF;SAAM,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE;QACxC,MAAM,IAAI,KAAK,CAAC,2BAA2B,EAAE,gBAAgB,GAAG,GAAG,CAAC,CAAC;KACrE;IAED,+DAA+D;IAC/D,OAAO,QAAQ,CAAC,KAAK,CAAC;AACvB,CAAC;AAhBD,oEAgBC;AAED;;;;;;;;;;GAUG;AACI,KAAK,UAAU,sBAAsB,CAC3C,IAAY,EACZ,SAAqB;IAErB,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;IAExD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;QACpE,MAAM,IAAI,KAAK,CAAC,mDAAmD,IAAI,GAAG,CAAC,CAAC;KAC5E;SAAM,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE;QACxC,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,GAAG,CAAC,CAAC;KAC1D;IAED,+DAA+D;IAC/D,OAAO,QAAQ,CAAC,KAAK,CAAC;AACvB,CAAC;AAdD,wDAcC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { IContainer } from \"@fluidframework/container-definitions\";\n\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * Helper function for getting the default Fluid Object from a Container. This function only works for\n * Containers that support \"/\" request.\n *\n * @typeParam T - Defines the type you expect to be returned.\n *\n * @param container - Container you're attempting to get the object from\n * @public\n */\nexport async function getDefaultObjectFromContainer<T = FluidObject>(\n\tcontainer: IContainer,\n): Promise<T> {\n\tconst url = \"/\";\n\tconst response = await container.request({ url });\n\n\t// Verify the response\n\tif (response.status !== 200 || response.mimeType !== \"fluid/object\") {\n\t\tthrow new Error(`Unable to retrieve Fluid object at URL: \"${url}\"`);\n\t} else if (response.value === undefined) {\n\t\tthrow new Error(`Empty response from URL: \"${url}\"`);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn response.value;\n}\n\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * Helper function for getting as Fluid Object from a Container given a Unique Id. This function only works for\n * Containers that support getting FluidObjects via request.\n *\n * @typeParam T - Defines the type you expect to be returned.\n *\n * @param id - Unique id of the FluidObject\n * @param container - Container you're attempting to get the object from\n * @public\n */\nexport async function getObjectWithIdFromContainer<T = FluidObject>(\n\tid: string,\n\tcontainer: IContainer,\n): Promise<T> {\n\tconst url = `/${id}`;\n\tconst response = await container.request({ url });\n\n\t// Verify the response\n\tif (response.status !== 200 || response.mimeType !== \"fluid/object\") {\n\t\tthrow new Error(`Unable to retrieve Fluid object with ID: \"${id}\" from URL: \"${url}\"`);\n\t} else if (response.value === undefined) {\n\t\tthrow new Error(`Empty response for ID: \"${id}\" from URL: \"${url}\"`);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn response.value;\n}\n\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * Helper function for getting a Fluid Object from a Container given a path/url. This function only works for\n * Containers that support getting FluidObjects via request.\n *\n * @typeParam T - Defines the type you expect to be returned.\n *\n * @param path - Unique path/url of the FluidObject\n * @param container - Container you're attempting to get the object from\n * @public\n */\nexport async function getObjectFromContainer<T = FluidObject>(\n\tpath: string,\n\tcontainer: IContainer,\n): Promise<T> {\n\tconst response = await container.request({ url: path });\n\n\tif (response.status !== 200 || response.mimeType !== \"fluid/object\") {\n\t\tthrow new Error(`Unable to retrieve Fluid object with from URL: \"${path}\"`);\n\t} else if (response.value === undefined) {\n\t\tthrow new Error(`Empty response for from URL: \"${path}\"`);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn response.value;\n}\n"]}
@@ -1,42 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { FluidObject } from "@fluidframework/core-interfaces";
6
- import { IContainer } from "@fluidframework/container-definitions";
7
- /**
8
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
9
- * Helper function for getting the default Fluid Object from a Container. This function only works for
10
- * Containers that support "/" request.
11
- *
12
- * @typeParam T - Defines the type you expect to be returned.
13
- *
14
- * @param container - Container you're attempting to get the object from
15
- * @public
16
- */
17
- export declare function getDefaultObjectFromContainer<T = FluidObject>(container: IContainer): Promise<T>;
18
- /**
19
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
20
- * Helper function for getting as Fluid Object from a Container given a Unique Id. This function only works for
21
- * Containers that support getting FluidObjects via request.
22
- *
23
- * @typeParam T - Defines the type you expect to be returned.
24
- *
25
- * @param id - Unique id of the FluidObject
26
- * @param container - Container you're attempting to get the object from
27
- * @public
28
- */
29
- export declare function getObjectWithIdFromContainer<T = FluidObject>(id: string, container: IContainer): Promise<T>;
30
- /**
31
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
32
- * Helper function for getting a Fluid Object from a Container given a path/url. This function only works for
33
- * Containers that support getting FluidObjects via request.
34
- *
35
- * @typeParam T - Defines the type you expect to be returned.
36
- *
37
- * @param path - Unique path/url of the FluidObject
38
- * @param container - Container you're attempting to get the object from
39
- * @public
40
- */
41
- export declare function getObjectFromContainer<T = FluidObject>(path: string, container: IContainer): Promise<T>;
42
- //# sourceMappingURL=containerInteractions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"containerInteractions.d.ts","sourceRoot":"","sources":["../../src/utils/containerInteractions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAEnE;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CAAC,CAAC,GAAG,WAAW,EAClE,SAAS,EAAE,UAAU,GACnB,OAAO,CAAC,CAAC,CAAC,CAaZ;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,4BAA4B,CAAC,CAAC,GAAG,WAAW,EACjE,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,UAAU,GACnB,OAAO,CAAC,CAAC,CAAC,CAaZ;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAAC,CAAC,GAAG,WAAW,EAC3D,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,UAAU,GACnB,OAAO,CAAC,CAAC,CAAC,CAWZ"}
@@ -1,12 +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.getObjectWithIdFromContainer = exports.getObjectFromContainer = exports.getDefaultObjectFromContainer = void 0;
8
- var containerInteractions_1 = require("./containerInteractions.cjs");
9
- Object.defineProperty(exports, "getDefaultObjectFromContainer", { enumerable: true, get: function () { return containerInteractions_1.getDefaultObjectFromContainer; } });
10
- Object.defineProperty(exports, "getObjectFromContainer", { enumerable: true, get: function () { return containerInteractions_1.getObjectFromContainer; } });
11
- Object.defineProperty(exports, "getObjectWithIdFromContainer", { enumerable: true, get: function () { return containerInteractions_1.getObjectWithIdFromContainer; } });
12
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAIiC;AAHhC,sIAAA,6BAA6B,OAAA;AAC7B,+HAAA,sBAAsB,OAAA;AACtB,qIAAA,4BAA4B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tgetDefaultObjectFromContainer,\n\tgetObjectFromContainer,\n\tgetObjectWithIdFromContainer,\n} from \"./containerInteractions\";\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 { getDefaultObjectFromContainer, getObjectFromContainer, getObjectWithIdFromContainer, } from "./containerInteractions";
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,GAC5B,MAAM,yBAAyB,CAAC"}
@@ -1,6 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- export { defaultFluidObjectRequestHandler, defaultRouteRequestHandler, mountableViewRequestHandler, } from "./requestHandlers.mjs";
6
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/request-handlers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,gCAAgC,EAChC,0BAA0B,EAC1B,2BAA2B,GAC3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tdefaultFluidObjectRequestHandler,\n\tdefaultRouteRequestHandler,\n\tmountableViewRequestHandler,\n} from \"./requestHandlers\";\n"]}
@@ -1,86 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { buildRuntimeRequestHandler } from "@fluidframework/request-handler";
6
- import { RequestParser, create404Response } from "@fluidframework/runtime-utils";
7
- /**
8
- * A mountable view is only required if the view needs to be mounted across a bundle boundary. Mounting across
9
- * bundle boundaries breaks some frameworks, so the mountable view is used to ensure the mounting is done within
10
- * the same bundle as the view. For example, React hooks don't work if mounted across bundles since there will
11
- * be two React instances, breaking the Rules of Hooks. When cross-bundle mounting isn't required, the mountable
12
- * view isn't necessary.
13
- *
14
- * When a request is received with a mountableView: true header, this request handler will reissue the request
15
- * without the header, and respond with a mountable view of the given class using the response.
16
- * @param MountableViewClass - The type of mountable view to use when responding
17
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
18
- * @public
19
- */
20
- export const mountableViewRequestHandler = (MountableViewClass, handlers) => {
21
- // eslint-disable-next-line import/no-deprecated
22
- const nestedHandler = buildRuntimeRequestHandler(...handlers);
23
- return async (request, runtime) => {
24
- const mountableView = request.headers?.mountableView === true;
25
- let newRequest = request;
26
- if (mountableView) {
27
- // Reissue the request without the mountableView header.
28
- // We'll repack whatever the response is if we can.
29
- const headers = { ...request.headers };
30
- delete headers.mountableView;
31
- newRequest = {
32
- url: request.url,
33
- headers,
34
- };
35
- }
36
- const response = await nestedHandler(newRequest, runtime);
37
- if (mountableView &&
38
- response.status === 200 &&
39
- MountableViewClass.canMount(response.value)) {
40
- return {
41
- status: 200,
42
- mimeType: "fluid/object",
43
- value: new MountableViewClass(response.value),
44
- };
45
- }
46
- return response;
47
- };
48
- };
49
- /**
50
- * Pipe through container request into internal request.
51
- * If request is empty and default url is provided, redirect request to such default url.
52
- * @param defaultRootId - optional default root data store ID to pass request in case request is empty.
53
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
54
- * @public
55
- */
56
- export const defaultRouteRequestHandler = (defaultRootId) => {
57
- return async (request, runtime) => {
58
- const parser = RequestParser.create(request);
59
- if (parser.pathParts.length === 0) {
60
- return runtime.IFluidHandleContext.resolveHandle({
61
- url: `/${defaultRootId}${parser.query}`,
62
- headers: request.headers,
63
- });
64
- }
65
- return undefined; // continue search
66
- };
67
- };
68
- /**
69
- * Default request handler for a Fluid object that returns the object itself if:
70
- *
71
- * 1. the request url is empty
72
- *
73
- * 2. the request url is "/"
74
- *
75
- * 3. the request url starts with "/" and is followed by a query param, such as /?key=value
76
- *
77
- * Returns a 404 error for any other url.
78
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
79
- * @public
80
- */
81
- export function defaultFluidObjectRequestHandler(fluidObject, request) {
82
- return request.url === "" || request.url === "/" || request.url.startsWith("/?")
83
- ? { mimeType: "fluid/object", status: 200, value: fluidObject }
84
- : create404Response(request);
85
- }
86
- //# sourceMappingURL=requestHandlers.mjs.map