@fluidframework/request-handler 2.0.0-internal.3.0.1 → 2.0.0-internal.3.1.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 (38) hide show
  1. package/.eslintrc.js +5 -7
  2. package/.mocharc.js +2 -2
  3. package/api-extractor.json +2 -2
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/packageVersion.d.ts +1 -1
  8. package/dist/packageVersion.js +1 -1
  9. package/dist/packageVersion.js.map +1 -1
  10. package/dist/requestHandlers.d.ts.map +1 -1
  11. package/dist/requestHandlers.js +6 -2
  12. package/dist/requestHandlers.js.map +1 -1
  13. package/dist/runtimeRequestHandlerBuilder.d.ts +3 -3
  14. package/dist/runtimeRequestHandlerBuilder.d.ts.map +1 -1
  15. package/dist/runtimeRequestHandlerBuilder.js +3 -3
  16. package/dist/runtimeRequestHandlerBuilder.js.map +1 -1
  17. package/lib/index.d.ts +1 -1
  18. package/lib/index.d.ts.map +1 -1
  19. package/lib/index.js +1 -1
  20. package/lib/index.js.map +1 -1
  21. package/lib/packageVersion.d.ts +1 -1
  22. package/lib/packageVersion.js +1 -1
  23. package/lib/packageVersion.js.map +1 -1
  24. package/lib/requestHandlers.d.ts.map +1 -1
  25. package/lib/requestHandlers.js +6 -2
  26. package/lib/requestHandlers.js.map +1 -1
  27. package/lib/runtimeRequestHandlerBuilder.d.ts +3 -3
  28. package/lib/runtimeRequestHandlerBuilder.d.ts.map +1 -1
  29. package/lib/runtimeRequestHandlerBuilder.js +3 -3
  30. package/lib/runtimeRequestHandlerBuilder.js.map +1 -1
  31. package/package.json +102 -101
  32. package/prettier.config.cjs +1 -1
  33. package/src/index.ts +4 -1
  34. package/src/packageVersion.ts +1 -1
  35. package/src/requestHandlers.ts +60 -48
  36. package/src/runtimeRequestHandlerBuilder.ts +23 -22
  37. package/tsconfig.esnext.json +6 -6
  38. package/tsconfig.json +9 -13
package/.eslintrc.js CHANGED
@@ -4,10 +4,8 @@
4
4
  */
5
5
 
6
6
  module.exports = {
7
- "extends": [
8
- require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"
9
- ],
10
- "parserOptions": {
11
- "project": ["./tsconfig.json", "./src/test/tsconfig.json"]
12
- },
13
- }
7
+ extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"],
8
+ parserOptions: {
9
+ project: ["./tsconfig.json", "./src/test/tsconfig.json"],
10
+ },
11
+ };
package/.mocharc.js CHANGED
@@ -3,9 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- 'use strict';
6
+ "use strict";
7
7
 
8
- const getFluidTestMochaConfig = require('@fluidframework/mocha-test-setup/mocharc-common');
8
+ const getFluidTestMochaConfig = require("@fluidframework/mocha-test-setup/mocharc-common");
9
9
 
10
10
  const packageDir = __dirname;
11
11
  const config = getFluidTestMochaConfig(packageDir);
@@ -1,4 +1,4 @@
1
1
  {
2
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "@fluidframework/build-common/api-extractor-common-report.json"
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "@fluidframework/build-common/api-extractor-common-report.json"
4
4
  }
package/dist/index.d.ts CHANGED
@@ -3,5 +3,5 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { createFluidObjectResponse, handleFromLegacyUri, rootDataStoreRequestHandler, RuntimeRequestHandler, } from "./requestHandlers";
6
- export { buildRuntimeRequestHandler, RuntimeRequestHandlerBuilder } from "./runtimeRequestHandlerBuilder";
6
+ export { buildRuntimeRequestHandler, RuntimeRequestHandlerBuilder, } from "./runtimeRequestHandlerBuilder";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,yBAAyB,EACzB,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,yBAAyB,EACzB,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,0BAA0B,EAC1B,4BAA4B,GAC5B,MAAM,gCAAgC,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qDAK2B;AAJ1B,4HAAA,yBAAyB,OAAA;AACzB,sHAAA,mBAAmB,OAAA;AACnB,8HAAA,2BAA2B,OAAA;AAG5B,+EAA0G;AAAjG,0IAAA,0BAA0B,OAAA;AAAE,4IAAA,4BAA4B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tcreateFluidObjectResponse,\n\thandleFromLegacyUri,\n\trootDataStoreRequestHandler,\n\tRuntimeRequestHandler,\n} from \"./requestHandlers\";\nexport { buildRuntimeRequestHandler, RuntimeRequestHandlerBuilder } from \"./runtimeRequestHandlerBuilder\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qDAK2B;AAJ1B,4HAAA,yBAAyB,OAAA;AACzB,sHAAA,mBAAmB,OAAA;AACnB,8HAAA,2BAA2B,OAAA;AAG5B,+EAGwC;AAFvC,0IAAA,0BAA0B,OAAA;AAC1B,4IAAA,4BAA4B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tcreateFluidObjectResponse,\n\thandleFromLegacyUri,\n\trootDataStoreRequestHandler,\n\tRuntimeRequestHandler,\n} from \"./requestHandlers\";\nexport {\n\tbuildRuntimeRequestHandler,\n\tRuntimeRequestHandlerBuilder,\n} from \"./runtimeRequestHandlerBuilder\";\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/request-handler";
8
- export declare const pkgVersion = "2.0.0-internal.3.0.1";
8
+ export declare const pkgVersion = "2.0.0-internal.3.1.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/request-handler";
11
- exports.pkgVersion = "2.0.0-internal.3.0.1";
11
+ exports.pkgVersion = "2.0.0-internal.3.1.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,iCAAiC,CAAC;AAC5C,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/request-handler\";\nexport const pkgVersion = \"2.0.0-internal.3.0.1\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,iCAAiC,CAAC;AAC5C,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/request-handler\";\nexport const pkgVersion = \"2.0.0-internal.3.1.0\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,WAAW,EAEd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D;;;;;GAKG;AACH,oBAAY,qBAAqB,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,iBAAiB,KAChF,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,YAAmB,QAAQ,WAAW,iBAAiB,mCAgB9F,CAAC;AAEF,eAAO,MAAM,yBAAyB,gBAAiB,WAAW,KAC9D;IAAE,QAAQ,GAAG,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,WAAW,CAAC;CAE/D,CAAC;AA4BF,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,WAAW,GAAG,cAAc,EAChE,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,GAC/B,YAAY,CAAC,CAAC,CAAC,CAEjB"}
1
+ {"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,WAAW,EAEX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D;;;;;GAKG;AACH,oBAAY,qBAAqB,GAAG,CACnC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,iBAAiB,KACtB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,YAC9B,QAAQ,WACR,iBAAiB,mCAiB1B,CAAC;AAEF,eAAO,MAAM,yBAAyB,gBACxB,WAAW,KACtB;IAAE,QAAQ,GAAG,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAE7D,CAAC;AAkCF,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,WAAW,GAAG,cAAc,EACnE,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,GAC5B,YAAY,CAAC,CAAC,CAAC,CAEjB"}
@@ -44,12 +44,16 @@ class LegacyUriHandle {
44
44
  this.runtime = runtime;
45
45
  this.isAttached = true;
46
46
  }
47
- get IFluidHandle() { return this; }
47
+ get IFluidHandle() {
48
+ return this;
49
+ }
48
50
  attachGraph() {
49
51
  (0, common_utils_1.assert)(false, 0x0ca /* "Trying to use legacy graph attach!" */);
50
52
  }
51
53
  async get() {
52
- const response = await this.runtime.IFluidHandleContext.resolveHandle({ url: this.absolutePath });
54
+ const response = await this.runtime.IFluidHandleContext.resolveHandle({
55
+ url: this.absolutePath,
56
+ });
53
57
  if (response.status === 200 && response.mimeType === "fluid/object") {
54
58
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
55
59
  return response.value;
@@ -1 +1 @@
1
- {"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAWtD,iEAA8D;AAW9D;;;;;GAKG;AACI,MAAM,2BAA2B,GAAG,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE;;IAC/F,MAAM,aAAa,GAAG,6BAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,EAAE,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,OAAO,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,IAAI,CAAA,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3F,IAAI,aAA2B,CAAC;IAChC,IAAI;QACA,mEAAmE;QACnE,aAAa,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;KAC5D;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,SAAS,CAAC,CAAC,kBAAkB;KACvC;IACD,IAAI;QACA,OAAO,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;KAChF;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;KAClE;AACL,CAAC,CAAC;AAhBW,QAAA,2BAA2B,+BAgBtC;AAEK,MAAM,yBAAyB,GAAG,CAAC,WAAwB,EACC,EAAE;IACjE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AACzE,CAAC,CAAC;AAHW,QAAA,yBAAyB,6BAGpC;AAEF,MAAM,eAAe;IAKjB,YAAmC,YAAY,EAAkB,OAA8B;QAA5D,iBAAY,GAAZ,YAAY,CAAA;QAAkB,YAAO,GAAP,OAAO,CAAuB;QAJ/E,eAAU,GAAG,IAAI,CAAC;IAKlC,CAAC;IAHD,IAAW,YAAY,KAAmB,OAAO,IAAI,CAAC,CAAC,CAAC;IAKjD,WAAW;QACd,IAAA,qBAAM,EAAC,KAAK,EAAE,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACpE,CAAC;IAEM,KAAK,CAAC,GAAG;QACZ,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAClG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;YACjE,+DAA+D;YAC/D,OAAO,QAAQ,CAAC,KAAK,CAAC;SACzB;QACD,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IAC7E,CAAC;IAEM,IAAI,CAAC,MAAoB;QAC5B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACtD,CAAC;CACJ;AAED,SAAgB,mBAAmB,CAC/B,GAAW,EACX,OAA8B;IAE9B,OAAO,IAAI,eAAe,CAAI,GAAG,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AALD,kDAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n IResponse,\n IRequest,\n IFluidHandle,\n IFluidLoadable,\n FluidObject,\n IFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IContainerRuntimeBase } from \"@fluidframework/runtime-definitions\";\nimport { RequestParser } from \"@fluidframework/runtime-utils\";\n\n/**\n * A request handler for the container runtime. Each handler should handle a specific request, and return undefined\n * if it does not apply. These handlers are called in series, so there may be other handlers before or after.\n * A handler should only return error if the request is for a route the handler owns, and there is a problem with\n * the route, or fulling the specific request.\n */\nexport type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime)\n => Promise<IResponse | undefined>;\n\n/**\n * A request handler to expose access to all root data stores in the container by id.\n * @param request - the request for the root data store. The first path part must be the data store's ID.\n * @param runtime - the container runtime\n * @returns the result of the request\n */\nexport const rootDataStoreRequestHandler = async (request: IRequest, runtime: IContainerRuntime) => {\n const requestParser = RequestParser.create(request);\n const id = requestParser.pathParts[0];\n const wait = typeof request.headers?.wait === \"boolean\" ? request.headers.wait : undefined;\n let rootDataStore: IFluidRouter;\n try {\n // getRootDataStore currently throws if the data store is not found\n rootDataStore = await runtime.getRootDataStore(id, wait);\n } catch (error) {\n return undefined; // continue search\n }\n try {\n return rootDataStore.IFluidRouter.request(requestParser.createSubRequest(1));\n } catch (error) {\n return { status: 500, mimeType: \"fluid/object\", value: error };\n }\n};\n\nexport const createFluidObjectResponse = (fluidObject: FluidObject):\n { status: 200; mimeType: \"fluid/object\"; value: FluidObject; } => {\n return { status: 200, mimeType: \"fluid/object\", value: fluidObject };\n};\n\nclass LegacyUriHandle<T = FluidObject & IFluidLoadable> implements IFluidHandle<T> {\n public readonly isAttached = true;\n\n public get IFluidHandle(): IFluidHandle { return this; }\n\n public constructor(public readonly absolutePath, public readonly runtime: IContainerRuntimeBase) {\n }\n\n public attachGraph() {\n assert(false, 0x0ca /* \"Trying to use legacy graph attach!\" */);\n }\n\n public async get(): Promise<any> {\n const response = await this.runtime.IFluidHandleContext.resolveHandle({ url: this.absolutePath });\n if (response.status === 200 && response.mimeType === \"fluid/object\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return response.value;\n }\n throw new Error(`Failed to resolve container path ${this.absolutePath}`);\n }\n\n public bind(handle: IFluidHandle) {\n throw new Error(\"Cannot bind to LegacyUriHandle\");\n }\n}\n\nexport function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(\n uri: string,\n runtime: IContainerRuntimeBase,\n): IFluidHandle<T> {\n return new LegacyUriHandle<T>(uri, runtime);\n}\n"]}
1
+ {"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAWtD,iEAA8D;AAa9D;;;;;GAKG;AACI,MAAM,2BAA2B,GAAG,KAAK,EAC/C,OAAiB,EACjB,OAA0B,EACzB,EAAE;;IACH,MAAM,aAAa,GAAG,6BAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,EAAE,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,OAAO,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,IAAI,CAAA,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3F,IAAI,aAA2B,CAAC;IAChC,IAAI;QACH,mEAAmE;QACnE,aAAa,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;KACzD;IAAC,OAAO,KAAK,EAAE;QACf,OAAO,SAAS,CAAC,CAAC,kBAAkB;KACpC;IACD,IAAI;QACH,OAAO,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;KAC7E;IAAC,OAAO,KAAK,EAAE;QACf,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;KAC/D;AACF,CAAC,CAAC;AAnBW,QAAA,2BAA2B,+BAmBtC;AAEK,MAAM,yBAAyB,GAAG,CACxC,WAAwB,EACwC,EAAE;IAClE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AACtE,CAAC,CAAC;AAJW,QAAA,yBAAyB,6BAIpC;AAEF,MAAM,eAAe;IAOpB,YACiB,YAAY,EACZ,OAA8B;QAD9B,iBAAY,GAAZ,YAAY,CAAA;QACZ,YAAO,GAAP,OAAO,CAAuB;QAR/B,eAAU,GAAG,IAAI,CAAC;IAS/B,CAAC;IAPJ,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAOM,WAAW;QACjB,IAAA,qBAAM,EAAC,KAAK,EAAE,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACjE,CAAC;IAEM,KAAK,CAAC,GAAG;QACf,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC;YACrE,GAAG,EAAE,IAAI,CAAC,YAAY;SACtB,CAAC,CAAC;QACH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;YACpE,+DAA+D;YAC/D,OAAO,QAAQ,CAAC,KAAK,CAAC;SACtB;QACD,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IAC1E,CAAC;IAEM,IAAI,CAAC,MAAoB;QAC/B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACnD,CAAC;CACD;AAED,SAAgB,mBAAmB,CAClC,GAAW,EACX,OAA8B;IAE9B,OAAO,IAAI,eAAe,CAAI,GAAG,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC;AALD,kDAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n\tIResponse,\n\tIRequest,\n\tIFluidHandle,\n\tIFluidLoadable,\n\tFluidObject,\n\tIFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IContainerRuntimeBase } from \"@fluidframework/runtime-definitions\";\nimport { RequestParser } from \"@fluidframework/runtime-utils\";\n\n/**\n * A request handler for the container runtime. Each handler should handle a specific request, and return undefined\n * if it does not apply. These handlers are called in series, so there may be other handlers before or after.\n * A handler should only return error if the request is for a route the handler owns, and there is a problem with\n * the route, or fulling the specific request.\n */\nexport type RuntimeRequestHandler = (\n\trequest: RequestParser,\n\truntime: IContainerRuntime,\n) => Promise<IResponse | undefined>;\n\n/**\n * A request handler to expose access to all root data stores in the container by id.\n * @param request - the request for the root data store. The first path part must be the data store's ID.\n * @param runtime - the container runtime\n * @returns the result of the request\n */\nexport const rootDataStoreRequestHandler = async (\n\trequest: IRequest,\n\truntime: IContainerRuntime,\n) => {\n\tconst requestParser = RequestParser.create(request);\n\tconst id = requestParser.pathParts[0];\n\tconst wait = typeof request.headers?.wait === \"boolean\" ? request.headers.wait : undefined;\n\tlet rootDataStore: IFluidRouter;\n\ttry {\n\t\t// getRootDataStore currently throws if the data store is not found\n\t\trootDataStore = await runtime.getRootDataStore(id, wait);\n\t} catch (error) {\n\t\treturn undefined; // continue search\n\t}\n\ttry {\n\t\treturn rootDataStore.IFluidRouter.request(requestParser.createSubRequest(1));\n\t} catch (error) {\n\t\treturn { status: 500, mimeType: \"fluid/object\", value: error };\n\t}\n};\n\nexport const createFluidObjectResponse = (\n\tfluidObject: FluidObject,\n): { status: 200; mimeType: \"fluid/object\"; value: FluidObject } => {\n\treturn { status: 200, mimeType: \"fluid/object\", value: fluidObject };\n};\n\nclass LegacyUriHandle<T = FluidObject & IFluidLoadable> implements IFluidHandle<T> {\n\tpublic readonly isAttached = true;\n\n\tpublic get IFluidHandle(): IFluidHandle {\n\t\treturn this;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly absolutePath,\n\t\tpublic readonly runtime: IContainerRuntimeBase,\n\t) {}\n\n\tpublic attachGraph() {\n\t\tassert(false, 0x0ca /* \"Trying to use legacy graph attach!\" */);\n\t}\n\n\tpublic async get(): Promise<any> {\n\t\tconst response = await this.runtime.IFluidHandleContext.resolveHandle({\n\t\t\turl: this.absolutePath,\n\t\t});\n\t\tif (response.status === 200 && response.mimeType === \"fluid/object\") {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn response.value;\n\t\t}\n\t\tthrow new Error(`Failed to resolve container path ${this.absolutePath}`);\n\t}\n\n\tpublic bind(handle: IFluidHandle) {\n\t\tthrow new Error(\"Cannot bind to LegacyUriHandle\");\n\t}\n}\n\nexport function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(\n\turi: string,\n\truntime: IContainerRuntimeBase,\n): IFluidHandle<T> {\n\treturn new LegacyUriHandle<T>(uri, runtime);\n}\n"]}
@@ -6,9 +6,9 @@ import { IRequest, IResponse } from "@fluidframework/core-interfaces";
6
6
  import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
7
7
  import { RuntimeRequestHandler } from "./requestHandlers";
8
8
  /**
9
- * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
10
- * The provided handlers sequentially applied until one is able to satisfy the request.
11
- */
9
+ * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
10
+ * The provided handlers sequentially applied until one is able to satisfy the request.
11
+ */
12
12
  export declare class RuntimeRequestHandlerBuilder {
13
13
  private readonly handlers;
14
14
  pushHandler(...handlers: RuntimeRequestHandler[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeRequestHandlerBuilder.d.ts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;IAGI;AACJ,qBAAa,4BAA4B;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+B;IAEjD,WAAW,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE;IAM1C,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;CAUhG;AAED,wBAAgB,0BAA0B,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE,aAGpD,QAAQ,WAAW,iBAAiB,wBAC9D"}
1
+ {"version":3,"file":"runtimeRequestHandlerBuilder.d.ts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;GAGG;AACH,qBAAa,4BAA4B;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+B;IAEjD,WAAW,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE;IAM1C,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;CAU7F;AAED,wBAAgB,0BAA0B,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE,aAGvD,QAAQ,WAAW,iBAAiB,wBAE3D"}
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.buildRuntimeRequestHandler = exports.RuntimeRequestHandlerBuilder = void 0;
8
8
  const runtime_utils_1 = require("@fluidframework/runtime-utils");
9
9
  /**
10
- * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
11
- * The provided handlers sequentially applied until one is able to satisfy the request.
12
- */
10
+ * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
11
+ * The provided handlers sequentially applied until one is able to satisfy the request.
12
+ */
13
13
  class RuntimeRequestHandlerBuilder {
14
14
  constructor() {
15
15
  this.handlers = [];
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeRequestHandlerBuilder.js","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,iEAAiF;AAGjF;;;IAGI;AACJ,MAAa,4BAA4B;IAAzC;QACqB,aAAQ,GAA4B,EAAE,CAAC;IAkB5D,CAAC;IAhBU,WAAW,CAAC,GAAG,QAAiC;QACnD,IAAI,QAAQ,KAAK,SAAS,EAAE;YACxB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;SACnC;IACL,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,OAAiB,EAAE,OAA0B;QACpE,MAAM,MAAM,GAAG,6BAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChD,IAAI,QAAQ,KAAK,SAAS,EAAE;gBACxB,OAAO,QAAQ,CAAC;aACnB;SACJ;QACD,OAAO,IAAA,iCAAiB,EAAC,OAAO,CAAC,CAAC;IACtC,CAAC;CACJ;AAnBD,oEAmBC;AAED,SAAgB,0BAA0B,CAAC,GAAG,QAAiC;IAC3E,MAAM,OAAO,GAAG,IAAI,4BAA4B,EAAE,CAAC;IACnD,OAAO,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC;IACjC,OAAO,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5G,CAAC;AAJD,gEAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\nimport { RuntimeRequestHandler } from \"./requestHandlers\";\n\n/**\n * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.\n * The provided handlers sequentially applied until one is able to satisfy the request.\n */\nexport class RuntimeRequestHandlerBuilder {\n private readonly handlers: RuntimeRequestHandler[] = [];\n\n public pushHandler(...handlers: RuntimeRequestHandler[]) {\n if (handlers !== undefined) {\n this.handlers.push(...handlers);\n }\n }\n\n public async handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse> {\n const parser = RequestParser.create(request);\n for (const handler of this.handlers) {\n const response = await handler(parser, runtime);\n if (response !== undefined) {\n return response;\n }\n }\n return create404Response(request);\n }\n}\n\nexport function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]) {\n const builder = new RuntimeRequestHandlerBuilder();\n builder.pushHandler(...handlers);\n return async (request: IRequest, runtime: IContainerRuntime) => builder.handleRequest(request, runtime);\n}\n"]}
1
+ {"version":3,"file":"runtimeRequestHandlerBuilder.js","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,iEAAiF;AAGjF;;;GAGG;AACH,MAAa,4BAA4B;IAAzC;QACkB,aAAQ,GAA4B,EAAE,CAAC;IAkBzD,CAAC;IAhBO,WAAW,CAAC,GAAG,QAAiC;QACtD,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC3B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;SAChC;IACF,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,OAAiB,EAAE,OAA0B;QACvE,MAAM,MAAM,GAAG,6BAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE;YACpC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChD,IAAI,QAAQ,KAAK,SAAS,EAAE;gBAC3B,OAAO,QAAQ,CAAC;aAChB;SACD;QACD,OAAO,IAAA,iCAAiB,EAAC,OAAO,CAAC,CAAC;IACnC,CAAC;CACD;AAnBD,oEAmBC;AAED,SAAgB,0BAA0B,CAAC,GAAG,QAAiC;IAC9E,MAAM,OAAO,GAAG,IAAI,4BAA4B,EAAE,CAAC;IACnD,OAAO,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC;IACjC,OAAO,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE,CAC9D,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AALD,gEAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\nimport { RuntimeRequestHandler } from \"./requestHandlers\";\n\n/**\n * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.\n * The provided handlers sequentially applied until one is able to satisfy the request.\n */\nexport class RuntimeRequestHandlerBuilder {\n\tprivate readonly handlers: RuntimeRequestHandler[] = [];\n\n\tpublic pushHandler(...handlers: RuntimeRequestHandler[]) {\n\t\tif (handlers !== undefined) {\n\t\t\tthis.handlers.push(...handlers);\n\t\t}\n\t}\n\n\tpublic async handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse> {\n\t\tconst parser = RequestParser.create(request);\n\t\tfor (const handler of this.handlers) {\n\t\t\tconst response = await handler(parser, runtime);\n\t\t\tif (response !== undefined) {\n\t\t\t\treturn response;\n\t\t\t}\n\t\t}\n\t\treturn create404Response(request);\n\t}\n}\n\nexport function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]) {\n\tconst builder = new RuntimeRequestHandlerBuilder();\n\tbuilder.pushHandler(...handlers);\n\treturn async (request: IRequest, runtime: IContainerRuntime) =>\n\t\tbuilder.handleRequest(request, runtime);\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -3,5 +3,5 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { createFluidObjectResponse, handleFromLegacyUri, rootDataStoreRequestHandler, RuntimeRequestHandler, } from "./requestHandlers";
6
- export { buildRuntimeRequestHandler, RuntimeRequestHandlerBuilder } from "./runtimeRequestHandlerBuilder";
6
+ export { buildRuntimeRequestHandler, RuntimeRequestHandlerBuilder, } from "./runtimeRequestHandlerBuilder";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,yBAAyB,EACzB,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,yBAAyB,EACzB,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,0BAA0B,EAC1B,4BAA4B,GAC5B,MAAM,gCAAgC,CAAC"}
package/lib/index.js CHANGED
@@ -3,5 +3,5 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { createFluidObjectResponse, handleFromLegacyUri, rootDataStoreRequestHandler, } from "./requestHandlers";
6
- export { buildRuntimeRequestHandler, RuntimeRequestHandlerBuilder } from "./runtimeRequestHandlerBuilder";
6
+ export { buildRuntimeRequestHandler, RuntimeRequestHandlerBuilder, } from "./runtimeRequestHandlerBuilder";
7
7
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,yBAAyB,EACzB,mBAAmB,EACnB,2BAA2B,GAE3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tcreateFluidObjectResponse,\n\thandleFromLegacyUri,\n\trootDataStoreRequestHandler,\n\tRuntimeRequestHandler,\n} from \"./requestHandlers\";\nexport { buildRuntimeRequestHandler, RuntimeRequestHandlerBuilder } from \"./runtimeRequestHandlerBuilder\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,yBAAyB,EACzB,mBAAmB,EACnB,2BAA2B,GAE3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,0BAA0B,EAC1B,4BAA4B,GAC5B,MAAM,gCAAgC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tcreateFluidObjectResponse,\n\thandleFromLegacyUri,\n\trootDataStoreRequestHandler,\n\tRuntimeRequestHandler,\n} from \"./requestHandlers\";\nexport {\n\tbuildRuntimeRequestHandler,\n\tRuntimeRequestHandlerBuilder,\n} from \"./runtimeRequestHandlerBuilder\";\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/request-handler";
8
- export declare const pkgVersion = "2.0.0-internal.3.0.1";
8
+ export declare const pkgVersion = "2.0.0-internal.3.1.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/request-handler";
8
- export const pkgVersion = "2.0.0-internal.3.0.1";
8
+ export const pkgVersion = "2.0.0-internal.3.1.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,iCAAiC,CAAC;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/request-handler\";\nexport const pkgVersion = \"2.0.0-internal.3.0.1\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,iCAAiC,CAAC;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/request-handler\";\nexport const pkgVersion = \"2.0.0-internal.3.1.0\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,WAAW,EAEd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D;;;;;GAKG;AACH,oBAAY,qBAAqB,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,iBAAiB,KAChF,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,YAAmB,QAAQ,WAAW,iBAAiB,mCAgB9F,CAAC;AAEF,eAAO,MAAM,yBAAyB,gBAAiB,WAAW,KAC9D;IAAE,QAAQ,GAAG,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,WAAW,CAAC;CAE/D,CAAC;AA4BF,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,WAAW,GAAG,cAAc,EAChE,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,GAC/B,YAAY,CAAC,CAAC,CAAC,CAEjB"}
1
+ {"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,WAAW,EAEX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D;;;;;GAKG;AACH,oBAAY,qBAAqB,GAAG,CACnC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,iBAAiB,KACtB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,YAC9B,QAAQ,WACR,iBAAiB,mCAiB1B,CAAC;AAEF,eAAO,MAAM,yBAAyB,gBACxB,WAAW,KACtB;IAAE,QAAQ,GAAG,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAE7D,CAAC;AAkCF,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,WAAW,GAAG,cAAc,EACnE,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,GAC5B,YAAY,CAAC,CAAC,CAAC,CAEjB"}
@@ -39,12 +39,16 @@ class LegacyUriHandle {
39
39
  this.runtime = runtime;
40
40
  this.isAttached = true;
41
41
  }
42
- get IFluidHandle() { return this; }
42
+ get IFluidHandle() {
43
+ return this;
44
+ }
43
45
  attachGraph() {
44
46
  assert(false, 0x0ca /* "Trying to use legacy graph attach!" */);
45
47
  }
46
48
  async get() {
47
- const response = await this.runtime.IFluidHandleContext.resolveHandle({ url: this.absolutePath });
49
+ const response = await this.runtime.IFluidHandleContext.resolveHandle({
50
+ url: this.absolutePath,
51
+ });
48
52
  if (response.status === 200 && response.mimeType === "fluid/object") {
49
53
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
50
54
  return response.value;
@@ -1 +1 @@
1
- {"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAWtD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAW9D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE;;IAC/F,MAAM,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,EAAE,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,OAAO,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,IAAI,CAAA,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3F,IAAI,aAA2B,CAAC;IAChC,IAAI;QACA,mEAAmE;QACnE,aAAa,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;KAC5D;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,SAAS,CAAC,CAAC,kBAAkB;KACvC;IACD,IAAI;QACA,OAAO,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;KAChF;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;KAClE;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,WAAwB,EACC,EAAE;IACjE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AACzE,CAAC,CAAC;AAEF,MAAM,eAAe;IAKjB,YAAmC,YAAY,EAAkB,OAA8B;QAA5D,iBAAY,GAAZ,YAAY,CAAA;QAAkB,YAAO,GAAP,OAAO,CAAuB;QAJ/E,eAAU,GAAG,IAAI,CAAC;IAKlC,CAAC;IAHD,IAAW,YAAY,KAAmB,OAAO,IAAI,CAAC,CAAC,CAAC;IAKjD,WAAW;QACd,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACpE,CAAC;IAEM,KAAK,CAAC,GAAG;QACZ,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAClG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;YACjE,+DAA+D;YAC/D,OAAO,QAAQ,CAAC,KAAK,CAAC;SACzB;QACD,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IAC7E,CAAC;IAEM,IAAI,CAAC,MAAoB;QAC5B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACtD,CAAC;CACJ;AAED,MAAM,UAAU,mBAAmB,CAC/B,GAAW,EACX,OAA8B;IAE9B,OAAO,IAAI,eAAe,CAAI,GAAG,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n IResponse,\n IRequest,\n IFluidHandle,\n IFluidLoadable,\n FluidObject,\n IFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IContainerRuntimeBase } from \"@fluidframework/runtime-definitions\";\nimport { RequestParser } from \"@fluidframework/runtime-utils\";\n\n/**\n * A request handler for the container runtime. Each handler should handle a specific request, and return undefined\n * if it does not apply. These handlers are called in series, so there may be other handlers before or after.\n * A handler should only return error if the request is for a route the handler owns, and there is a problem with\n * the route, or fulling the specific request.\n */\nexport type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime)\n => Promise<IResponse | undefined>;\n\n/**\n * A request handler to expose access to all root data stores in the container by id.\n * @param request - the request for the root data store. The first path part must be the data store's ID.\n * @param runtime - the container runtime\n * @returns the result of the request\n */\nexport const rootDataStoreRequestHandler = async (request: IRequest, runtime: IContainerRuntime) => {\n const requestParser = RequestParser.create(request);\n const id = requestParser.pathParts[0];\n const wait = typeof request.headers?.wait === \"boolean\" ? request.headers.wait : undefined;\n let rootDataStore: IFluidRouter;\n try {\n // getRootDataStore currently throws if the data store is not found\n rootDataStore = await runtime.getRootDataStore(id, wait);\n } catch (error) {\n return undefined; // continue search\n }\n try {\n return rootDataStore.IFluidRouter.request(requestParser.createSubRequest(1));\n } catch (error) {\n return { status: 500, mimeType: \"fluid/object\", value: error };\n }\n};\n\nexport const createFluidObjectResponse = (fluidObject: FluidObject):\n { status: 200; mimeType: \"fluid/object\"; value: FluidObject; } => {\n return { status: 200, mimeType: \"fluid/object\", value: fluidObject };\n};\n\nclass LegacyUriHandle<T = FluidObject & IFluidLoadable> implements IFluidHandle<T> {\n public readonly isAttached = true;\n\n public get IFluidHandle(): IFluidHandle { return this; }\n\n public constructor(public readonly absolutePath, public readonly runtime: IContainerRuntimeBase) {\n }\n\n public attachGraph() {\n assert(false, 0x0ca /* \"Trying to use legacy graph attach!\" */);\n }\n\n public async get(): Promise<any> {\n const response = await this.runtime.IFluidHandleContext.resolveHandle({ url: this.absolutePath });\n if (response.status === 200 && response.mimeType === \"fluid/object\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return response.value;\n }\n throw new Error(`Failed to resolve container path ${this.absolutePath}`);\n }\n\n public bind(handle: IFluidHandle) {\n throw new Error(\"Cannot bind to LegacyUriHandle\");\n }\n}\n\nexport function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(\n uri: string,\n runtime: IContainerRuntimeBase,\n): IFluidHandle<T> {\n return new LegacyUriHandle<T>(uri, runtime);\n}\n"]}
1
+ {"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAWtD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAa9D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,EAC/C,OAAiB,EACjB,OAA0B,EACzB,EAAE;;IACH,MAAM,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,EAAE,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,OAAO,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,IAAI,CAAA,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3F,IAAI,aAA2B,CAAC;IAChC,IAAI;QACH,mEAAmE;QACnE,aAAa,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;KACzD;IAAC,OAAO,KAAK,EAAE;QACf,OAAO,SAAS,CAAC,CAAC,kBAAkB;KACpC;IACD,IAAI;QACH,OAAO,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;KAC7E;IAAC,OAAO,KAAK,EAAE;QACf,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;KAC/D;AACF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACxC,WAAwB,EACwC,EAAE;IAClE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AACtE,CAAC,CAAC;AAEF,MAAM,eAAe;IAOpB,YACiB,YAAY,EACZ,OAA8B;QAD9B,iBAAY,GAAZ,YAAY,CAAA;QACZ,YAAO,GAAP,OAAO,CAAuB;QAR/B,eAAU,GAAG,IAAI,CAAC;IAS/B,CAAC;IAPJ,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAOM,WAAW;QACjB,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACjE,CAAC;IAEM,KAAK,CAAC,GAAG;QACf,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC;YACrE,GAAG,EAAE,IAAI,CAAC,YAAY;SACtB,CAAC,CAAC;QACH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;YACpE,+DAA+D;YAC/D,OAAO,QAAQ,CAAC,KAAK,CAAC;SACtB;QACD,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IAC1E,CAAC;IAEM,IAAI,CAAC,MAAoB;QAC/B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACnD,CAAC;CACD;AAED,MAAM,UAAU,mBAAmB,CAClC,GAAW,EACX,OAA8B;IAE9B,OAAO,IAAI,eAAe,CAAI,GAAG,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n\tIResponse,\n\tIRequest,\n\tIFluidHandle,\n\tIFluidLoadable,\n\tFluidObject,\n\tIFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IContainerRuntimeBase } from \"@fluidframework/runtime-definitions\";\nimport { RequestParser } from \"@fluidframework/runtime-utils\";\n\n/**\n * A request handler for the container runtime. Each handler should handle a specific request, and return undefined\n * if it does not apply. These handlers are called in series, so there may be other handlers before or after.\n * A handler should only return error if the request is for a route the handler owns, and there is a problem with\n * the route, or fulling the specific request.\n */\nexport type RuntimeRequestHandler = (\n\trequest: RequestParser,\n\truntime: IContainerRuntime,\n) => Promise<IResponse | undefined>;\n\n/**\n * A request handler to expose access to all root data stores in the container by id.\n * @param request - the request for the root data store. The first path part must be the data store's ID.\n * @param runtime - the container runtime\n * @returns the result of the request\n */\nexport const rootDataStoreRequestHandler = async (\n\trequest: IRequest,\n\truntime: IContainerRuntime,\n) => {\n\tconst requestParser = RequestParser.create(request);\n\tconst id = requestParser.pathParts[0];\n\tconst wait = typeof request.headers?.wait === \"boolean\" ? request.headers.wait : undefined;\n\tlet rootDataStore: IFluidRouter;\n\ttry {\n\t\t// getRootDataStore currently throws if the data store is not found\n\t\trootDataStore = await runtime.getRootDataStore(id, wait);\n\t} catch (error) {\n\t\treturn undefined; // continue search\n\t}\n\ttry {\n\t\treturn rootDataStore.IFluidRouter.request(requestParser.createSubRequest(1));\n\t} catch (error) {\n\t\treturn { status: 500, mimeType: \"fluid/object\", value: error };\n\t}\n};\n\nexport const createFluidObjectResponse = (\n\tfluidObject: FluidObject,\n): { status: 200; mimeType: \"fluid/object\"; value: FluidObject } => {\n\treturn { status: 200, mimeType: \"fluid/object\", value: fluidObject };\n};\n\nclass LegacyUriHandle<T = FluidObject & IFluidLoadable> implements IFluidHandle<T> {\n\tpublic readonly isAttached = true;\n\n\tpublic get IFluidHandle(): IFluidHandle {\n\t\treturn this;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly absolutePath,\n\t\tpublic readonly runtime: IContainerRuntimeBase,\n\t) {}\n\n\tpublic attachGraph() {\n\t\tassert(false, 0x0ca /* \"Trying to use legacy graph attach!\" */);\n\t}\n\n\tpublic async get(): Promise<any> {\n\t\tconst response = await this.runtime.IFluidHandleContext.resolveHandle({\n\t\t\turl: this.absolutePath,\n\t\t});\n\t\tif (response.status === 200 && response.mimeType === \"fluid/object\") {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn response.value;\n\t\t}\n\t\tthrow new Error(`Failed to resolve container path ${this.absolutePath}`);\n\t}\n\n\tpublic bind(handle: IFluidHandle) {\n\t\tthrow new Error(\"Cannot bind to LegacyUriHandle\");\n\t}\n}\n\nexport function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(\n\turi: string,\n\truntime: IContainerRuntimeBase,\n): IFluidHandle<T> {\n\treturn new LegacyUriHandle<T>(uri, runtime);\n}\n"]}
@@ -6,9 +6,9 @@ import { IRequest, IResponse } from "@fluidframework/core-interfaces";
6
6
  import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
7
7
  import { RuntimeRequestHandler } from "./requestHandlers";
8
8
  /**
9
- * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
10
- * The provided handlers sequentially applied until one is able to satisfy the request.
11
- */
9
+ * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
10
+ * The provided handlers sequentially applied until one is able to satisfy the request.
11
+ */
12
12
  export declare class RuntimeRequestHandlerBuilder {
13
13
  private readonly handlers;
14
14
  pushHandler(...handlers: RuntimeRequestHandler[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeRequestHandlerBuilder.d.ts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;IAGI;AACJ,qBAAa,4BAA4B;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+B;IAEjD,WAAW,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE;IAM1C,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;CAUhG;AAED,wBAAgB,0BAA0B,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE,aAGpD,QAAQ,WAAW,iBAAiB,wBAC9D"}
1
+ {"version":3,"file":"runtimeRequestHandlerBuilder.d.ts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;GAGG;AACH,qBAAa,4BAA4B;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+B;IAEjD,WAAW,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE;IAM1C,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;CAU7F;AAED,wBAAgB,0BAA0B,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE,aAGvD,QAAQ,WAAW,iBAAiB,wBAE3D"}
@@ -4,9 +4,9 @@
4
4
  */
5
5
  import { RequestParser, create404Response } from "@fluidframework/runtime-utils";
6
6
  /**
7
- * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
8
- * The provided handlers sequentially applied until one is able to satisfy the request.
9
- */
7
+ * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
8
+ * The provided handlers sequentially applied until one is able to satisfy the request.
9
+ */
10
10
  export class RuntimeRequestHandlerBuilder {
11
11
  constructor() {
12
12
  this.handlers = [];
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeRequestHandlerBuilder.js","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGjF;;;IAGI;AACJ,MAAM,OAAO,4BAA4B;IAAzC;QACqB,aAAQ,GAA4B,EAAE,CAAC;IAkB5D,CAAC;IAhBU,WAAW,CAAC,GAAG,QAAiC;QACnD,IAAI,QAAQ,KAAK,SAAS,EAAE;YACxB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;SACnC;IACL,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,OAAiB,EAAE,OAA0B;QACpE,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChD,IAAI,QAAQ,KAAK,SAAS,EAAE;gBACxB,OAAO,QAAQ,CAAC;aACnB;SACJ;QACD,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;CACJ;AAED,MAAM,UAAU,0BAA0B,CAAC,GAAG,QAAiC;IAC3E,MAAM,OAAO,GAAG,IAAI,4BAA4B,EAAE,CAAC;IACnD,OAAO,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC;IACjC,OAAO,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5G,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\nimport { RuntimeRequestHandler } from \"./requestHandlers\";\n\n/**\n * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.\n * The provided handlers sequentially applied until one is able to satisfy the request.\n */\nexport class RuntimeRequestHandlerBuilder {\n private readonly handlers: RuntimeRequestHandler[] = [];\n\n public pushHandler(...handlers: RuntimeRequestHandler[]) {\n if (handlers !== undefined) {\n this.handlers.push(...handlers);\n }\n }\n\n public async handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse> {\n const parser = RequestParser.create(request);\n for (const handler of this.handlers) {\n const response = await handler(parser, runtime);\n if (response !== undefined) {\n return response;\n }\n }\n return create404Response(request);\n }\n}\n\nexport function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]) {\n const builder = new RuntimeRequestHandlerBuilder();\n builder.pushHandler(...handlers);\n return async (request: IRequest, runtime: IContainerRuntime) => builder.handleRequest(request, runtime);\n}\n"]}
1
+ {"version":3,"file":"runtimeRequestHandlerBuilder.js","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGjF;;;GAGG;AACH,MAAM,OAAO,4BAA4B;IAAzC;QACkB,aAAQ,GAA4B,EAAE,CAAC;IAkBzD,CAAC;IAhBO,WAAW,CAAC,GAAG,QAAiC;QACtD,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC3B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;SAChC;IACF,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,OAAiB,EAAE,OAA0B;QACvE,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE;YACpC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChD,IAAI,QAAQ,KAAK,SAAS,EAAE;gBAC3B,OAAO,QAAQ,CAAC;aAChB;SACD;QACD,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;CACD;AAED,MAAM,UAAU,0BAA0B,CAAC,GAAG,QAAiC;IAC9E,MAAM,OAAO,GAAG,IAAI,4BAA4B,EAAE,CAAC;IACnD,OAAO,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC;IACjC,OAAO,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE,CAC9D,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\nimport { RuntimeRequestHandler } from \"./requestHandlers\";\n\n/**\n * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.\n * The provided handlers sequentially applied until one is able to satisfy the request.\n */\nexport class RuntimeRequestHandlerBuilder {\n\tprivate readonly handlers: RuntimeRequestHandler[] = [];\n\n\tpublic pushHandler(...handlers: RuntimeRequestHandler[]) {\n\t\tif (handlers !== undefined) {\n\t\t\tthis.handlers.push(...handlers);\n\t\t}\n\t}\n\n\tpublic async handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse> {\n\t\tconst parser = RequestParser.create(request);\n\t\tfor (const handler of this.handlers) {\n\t\t\tconst response = await handler(parser, runtime);\n\t\t\tif (response !== undefined) {\n\t\t\t\treturn response;\n\t\t\t}\n\t\t}\n\t\treturn create404Response(request);\n\t}\n}\n\nexport function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]) {\n\tconst builder = new RuntimeRequestHandlerBuilder();\n\tbuilder.pushHandler(...handlers);\n\treturn async (request: IRequest, runtime: IContainerRuntime) =>\n\t\tbuilder.handleRequest(request, runtime);\n}\n"]}
package/package.json CHANGED
@@ -1,103 +1,104 @@
1
1
  {
2
- "name": "@fluidframework/request-handler",
3
- "version": "2.0.0-internal.3.0.1",
4
- "description": "A simple request handling library for Fluid Framework",
5
- "homepage": "https://fluidframework.com",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/microsoft/FluidFramework.git",
9
- "directory": "packages/framework/request-handler"
10
- },
11
- "license": "MIT",
12
- "author": "Microsoft and contributors",
13
- "sideEffects": false,
14
- "main": "dist/index.js",
15
- "module": "lib/index.js",
16
- "types": "dist/index.d.ts",
17
- "scripts": {
18
- "build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
19
- "build:commonjs": "npm run tsc && npm run typetests:gen && npm run build:test",
20
- "build:compile": "concurrently npm:build:commonjs npm:build:esnext",
21
- "build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
22
- "build:esnext": "tsc --project ./tsconfig.esnext.json",
23
- "build:full": "npm run build",
24
- "build:full:compile": "npm run build:compile",
25
- "build:genver": "gen-version",
26
- "build:test": "tsc --project ./src/test/tsconfig.json",
27
- "ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
28
- "clean": "rimraf dist lib *.tsbuildinfo *.build.log",
29
- "eslint": "eslint --format stylish src",
30
- "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
31
- "format": "npm run prettier:fix",
32
- "lint": "npm run eslint",
33
- "lint:fix": "npm run eslint:fix",
34
- "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
35
- "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
36
- "test": "npm run test:mocha",
37
- "test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
38
- "test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test --exit -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
39
- "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
40
- "tsc": "tsc",
41
- "typetests:gen": "flub generate typetests --generate --dir .",
42
- "typetests:prepare": "flub generate typetests --prepare --dir . --pin"
43
- },
44
- "nyc": {
45
- "all": true,
46
- "cache-dir": "nyc/.cache",
47
- "exclude": [
48
- "src/test/**/*.ts",
49
- "dist/test/**/*.js"
50
- ],
51
- "exclude-after-remap": false,
52
- "include": [
53
- "src/**/*.ts",
54
- "dist/**/*.js"
55
- ],
56
- "report-dir": "nyc/report",
57
- "reporter": [
58
- "cobertura",
59
- "html",
60
- "text"
61
- ],
62
- "temp-directory": "nyc/.nyc_output"
63
- },
64
- "dependencies": {
65
- "@fluidframework/common-utils": "^1.0.0",
66
- "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.3.0.1 <2.0.0-internal.4.0.0",
67
- "@fluidframework/core-interfaces": ">=2.0.0-internal.3.0.1 <2.0.0-internal.4.0.0",
68
- "@fluidframework/runtime-definitions": ">=2.0.0-internal.3.0.1 <2.0.0-internal.4.0.0",
69
- "@fluidframework/runtime-utils": ">=2.0.0-internal.3.0.1 <2.0.0-internal.4.0.0"
70
- },
71
- "devDependencies": {
72
- "@fluid-tools/build-cli": "^0.8.0",
73
- "@fluidframework/build-common": "^1.1.0",
74
- "@fluidframework/build-tools": "^0.8.0",
75
- "@fluidframework/eslint-config-fluid": "^2.0.0",
76
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.3.0.1 <2.0.0-internal.4.0.0",
77
- "@fluidframework/request-handler-previous": "npm:@fluidframework/request-handler@2.0.0-internal.2.2.0",
78
- "@fluidframework/test-runtime-utils": ">=2.0.0-internal.3.0.1 <2.0.0-internal.4.0.0",
79
- "@microsoft/api-extractor": "^7.22.2",
80
- "@rushstack/eslint-config": "^2.5.1",
81
- "@types/diff": "^3.5.1",
82
- "@types/mocha": "^9.1.1",
83
- "@types/node": "^14.18.36",
84
- "@types/random-js": "^1.0.31",
85
- "concurrently": "^6.2.0",
86
- "copyfiles": "^2.4.1",
87
- "cross-env": "^7.0.2",
88
- "diff": "^3.5.0",
89
- "eslint": "~8.6.0",
90
- "mocha": "^10.0.0",
91
- "nyc": "^15.0.0",
92
- "prettier": "~2.6.2",
93
- "random-js": "^1.0.8",
94
- "rimraf": "^2.6.2",
95
- "typescript": "~4.5.5"
96
- },
97
- "typeValidation": {
98
- "version": "2.0.0-internal.3.0.0",
99
- "baselineRange": ">=2.0.0-internal.2.0.0 <2.0.0-internal.3.0.0",
100
- "baselineVersion": "2.0.0-internal.2.1.1",
101
- "broken": {}
102
- }
2
+ "name": "@fluidframework/request-handler",
3
+ "version": "2.0.0-internal.3.1.0",
4
+ "description": "A simple request handling library for Fluid Framework",
5
+ "homepage": "https://fluidframework.com",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/microsoft/FluidFramework.git",
9
+ "directory": "packages/framework/request-handler"
10
+ },
11
+ "license": "MIT",
12
+ "author": "Microsoft and contributors",
13
+ "sideEffects": false,
14
+ "main": "dist/index.js",
15
+ "module": "lib/index.js",
16
+ "types": "dist/index.d.ts",
17
+ "scripts": {
18
+ "build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
19
+ "build:commonjs": "npm run tsc && npm run typetests:gen && npm run build:test",
20
+ "build:compile": "concurrently npm:build:commonjs npm:build:esnext",
21
+ "build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
22
+ "build:esnext": "tsc --project ./tsconfig.esnext.json",
23
+ "build:full": "npm run build",
24
+ "build:full:compile": "npm run build:compile",
25
+ "build:genver": "gen-version",
26
+ "build:test": "tsc --project ./src/test/tsconfig.json",
27
+ "ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
28
+ "clean": "rimraf dist lib *.tsbuildinfo *.build.log",
29
+ "eslint": "eslint --format stylish src",
30
+ "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
31
+ "format": "npm run prettier:fix",
32
+ "lint": "npm run prettier && npm run eslint",
33
+ "lint:fix": "npm run prettier:fix && npm run eslint:fix",
34
+ "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
35
+ "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
36
+ "test": "npm run test:mocha",
37
+ "test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
38
+ "test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test --exit -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
39
+ "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
40
+ "tsc": "tsc",
41
+ "typetests:gen": "flub generate typetests --generate --dir .",
42
+ "typetests:prepare": "flub generate typetests --prepare --dir . --pin"
43
+ },
44
+ "nyc": {
45
+ "all": true,
46
+ "cache-dir": "nyc/.cache",
47
+ "exclude": [
48
+ "src/test/**/*.ts",
49
+ "dist/test/**/*.js"
50
+ ],
51
+ "exclude-after-remap": false,
52
+ "include": [
53
+ "src/**/*.ts",
54
+ "dist/**/*.js"
55
+ ],
56
+ "report-dir": "nyc/report",
57
+ "reporter": [
58
+ "cobertura",
59
+ "html",
60
+ "text"
61
+ ],
62
+ "temp-directory": "nyc/.nyc_output"
63
+ },
64
+ "dependencies": {
65
+ "@fluidframework/common-utils": "^1.0.0",
66
+ "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.3.1.0 <2.0.0-internal.4.0.0",
67
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.3.1.0 <2.0.0-internal.4.0.0",
68
+ "@fluidframework/runtime-definitions": ">=2.0.0-internal.3.1.0 <2.0.0-internal.4.0.0",
69
+ "@fluidframework/runtime-utils": ">=2.0.0-internal.3.1.0 <2.0.0-internal.4.0.0"
70
+ },
71
+ "devDependencies": {
72
+ "@fluid-tools/build-cli": "^0.9.0",
73
+ "@fluidframework/build-common": "^1.1.0",
74
+ "@fluidframework/build-tools": "^0.9.0",
75
+ "@fluidframework/eslint-config-fluid": "^2.0.0",
76
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.3.1.0 <2.0.0-internal.4.0.0",
77
+ "@fluidframework/request-handler-previous": "npm:@fluidframework/request-handler@2.0.0-internal.3.0.0",
78
+ "@fluidframework/test-runtime-utils": ">=2.0.0-internal.3.1.0 <2.0.0-internal.4.0.0",
79
+ "@microsoft/api-extractor": "^7.22.2",
80
+ "@rushstack/eslint-config": "^2.5.1",
81
+ "@types/diff": "^3.5.1",
82
+ "@types/mocha": "^9.1.1",
83
+ "@types/node": "^14.18.36",
84
+ "@types/random-js": "^1.0.31",
85
+ "concurrently": "^6.2.0",
86
+ "copyfiles": "^2.4.1",
87
+ "cross-env": "^7.0.2",
88
+ "diff": "^3.5.0",
89
+ "eslint": "~8.6.0",
90
+ "mocha": "^10.0.0",
91
+ "nyc": "^15.0.0",
92
+ "prettier": "~2.6.2",
93
+ "random-js": "^1.0.8",
94
+ "rimraf": "^2.6.2",
95
+ "typescript": "~4.5.5"
96
+ },
97
+ "typeValidation": {
98
+ "version": "2.0.0-internal.3.1.0",
99
+ "previousVersionStyle": "~previousMinor",
100
+ "baselineRange": ">=2.0.0-internal.3.0.0 <2.0.0-internal.3.1.0",
101
+ "baselineVersion": "2.0.0-internal.3.0.0",
102
+ "broken": {}
103
+ }
103
104
  }
@@ -4,5 +4,5 @@
4
4
  */
5
5
 
6
6
  module.exports = {
7
- ...require("@fluidframework/build-common/prettier.config.cjs"),
7
+ ...require("@fluidframework/build-common/prettier.config.cjs"),
8
8
  };
package/src/index.ts CHANGED
@@ -9,4 +9,7 @@ export {
9
9
  rootDataStoreRequestHandler,
10
10
  RuntimeRequestHandler,
11
11
  } from "./requestHandlers";
12
- export { buildRuntimeRequestHandler, RuntimeRequestHandlerBuilder } from "./runtimeRequestHandlerBuilder";
12
+ export {
13
+ buildRuntimeRequestHandler,
14
+ RuntimeRequestHandlerBuilder,
15
+ } from "./runtimeRequestHandlerBuilder";
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/request-handler";
9
- export const pkgVersion = "2.0.0-internal.3.0.1";
9
+ export const pkgVersion = "2.0.0-internal.3.1.0";
@@ -5,12 +5,12 @@
5
5
 
6
6
  import { assert } from "@fluidframework/common-utils";
7
7
  import {
8
- IResponse,
9
- IRequest,
10
- IFluidHandle,
11
- IFluidLoadable,
12
- FluidObject,
13
- IFluidRouter,
8
+ IResponse,
9
+ IRequest,
10
+ IFluidHandle,
11
+ IFluidLoadable,
12
+ FluidObject,
13
+ IFluidRouter,
14
14
  } from "@fluidframework/core-interfaces";
15
15
  import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
16
16
  import { IContainerRuntimeBase } from "@fluidframework/runtime-definitions";
@@ -22,8 +22,10 @@ import { RequestParser } from "@fluidframework/runtime-utils";
22
22
  * A handler should only return error if the request is for a route the handler owns, and there is a problem with
23
23
  * the route, or fulling the specific request.
24
24
  */
25
- export type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime)
26
- => Promise<IResponse | undefined>;
25
+ export type RuntimeRequestHandler = (
26
+ request: RequestParser,
27
+ runtime: IContainerRuntime,
28
+ ) => Promise<IResponse | undefined>;
27
29
 
28
30
  /**
29
31
  * A request handler to expose access to all root data stores in the container by id.
@@ -31,58 +33,68 @@ export type RuntimeRequestHandler = (request: RequestParser, runtime: IContainer
31
33
  * @param runtime - the container runtime
32
34
  * @returns the result of the request
33
35
  */
34
- export const rootDataStoreRequestHandler = async (request: IRequest, runtime: IContainerRuntime) => {
35
- const requestParser = RequestParser.create(request);
36
- const id = requestParser.pathParts[0];
37
- const wait = typeof request.headers?.wait === "boolean" ? request.headers.wait : undefined;
38
- let rootDataStore: IFluidRouter;
39
- try {
40
- // getRootDataStore currently throws if the data store is not found
41
- rootDataStore = await runtime.getRootDataStore(id, wait);
42
- } catch (error) {
43
- return undefined; // continue search
44
- }
45
- try {
46
- return rootDataStore.IFluidRouter.request(requestParser.createSubRequest(1));
47
- } catch (error) {
48
- return { status: 500, mimeType: "fluid/object", value: error };
49
- }
36
+ export const rootDataStoreRequestHandler = async (
37
+ request: IRequest,
38
+ runtime: IContainerRuntime,
39
+ ) => {
40
+ const requestParser = RequestParser.create(request);
41
+ const id = requestParser.pathParts[0];
42
+ const wait = typeof request.headers?.wait === "boolean" ? request.headers.wait : undefined;
43
+ let rootDataStore: IFluidRouter;
44
+ try {
45
+ // getRootDataStore currently throws if the data store is not found
46
+ rootDataStore = await runtime.getRootDataStore(id, wait);
47
+ } catch (error) {
48
+ return undefined; // continue search
49
+ }
50
+ try {
51
+ return rootDataStore.IFluidRouter.request(requestParser.createSubRequest(1));
52
+ } catch (error) {
53
+ return { status: 500, mimeType: "fluid/object", value: error };
54
+ }
50
55
  };
51
56
 
52
- export const createFluidObjectResponse = (fluidObject: FluidObject):
53
- { status: 200; mimeType: "fluid/object"; value: FluidObject; } => {
54
- return { status: 200, mimeType: "fluid/object", value: fluidObject };
57
+ export const createFluidObjectResponse = (
58
+ fluidObject: FluidObject,
59
+ ): { status: 200; mimeType: "fluid/object"; value: FluidObject } => {
60
+ return { status: 200, mimeType: "fluid/object", value: fluidObject };
55
61
  };
56
62
 
57
63
  class LegacyUriHandle<T = FluidObject & IFluidLoadable> implements IFluidHandle<T> {
58
- public readonly isAttached = true;
64
+ public readonly isAttached = true;
59
65
 
60
- public get IFluidHandle(): IFluidHandle { return this; }
66
+ public get IFluidHandle(): IFluidHandle {
67
+ return this;
68
+ }
61
69
 
62
- public constructor(public readonly absolutePath, public readonly runtime: IContainerRuntimeBase) {
63
- }
70
+ public constructor(
71
+ public readonly absolutePath,
72
+ public readonly runtime: IContainerRuntimeBase,
73
+ ) {}
64
74
 
65
- public attachGraph() {
66
- assert(false, 0x0ca /* "Trying to use legacy graph attach!" */);
67
- }
75
+ public attachGraph() {
76
+ assert(false, 0x0ca /* "Trying to use legacy graph attach!" */);
77
+ }
68
78
 
69
- public async get(): Promise<any> {
70
- const response = await this.runtime.IFluidHandleContext.resolveHandle({ url: this.absolutePath });
71
- if (response.status === 200 && response.mimeType === "fluid/object") {
72
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
73
- return response.value;
74
- }
75
- throw new Error(`Failed to resolve container path ${this.absolutePath}`);
76
- }
79
+ public async get(): Promise<any> {
80
+ const response = await this.runtime.IFluidHandleContext.resolveHandle({
81
+ url: this.absolutePath,
82
+ });
83
+ if (response.status === 200 && response.mimeType === "fluid/object") {
84
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
85
+ return response.value;
86
+ }
87
+ throw new Error(`Failed to resolve container path ${this.absolutePath}`);
88
+ }
77
89
 
78
- public bind(handle: IFluidHandle) {
79
- throw new Error("Cannot bind to LegacyUriHandle");
80
- }
90
+ public bind(handle: IFluidHandle) {
91
+ throw new Error("Cannot bind to LegacyUriHandle");
92
+ }
81
93
  }
82
94
 
83
95
  export function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(
84
- uri: string,
85
- runtime: IContainerRuntimeBase,
96
+ uri: string,
97
+ runtime: IContainerRuntimeBase,
86
98
  ): IFluidHandle<T> {
87
- return new LegacyUriHandle<T>(uri, runtime);
99
+ return new LegacyUriHandle<T>(uri, runtime);
88
100
  }
@@ -9,32 +9,33 @@ import { RequestParser, create404Response } from "@fluidframework/runtime-utils"
9
9
  import { RuntimeRequestHandler } from "./requestHandlers";
10
10
 
11
11
  /**
12
- * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
13
- * The provided handlers sequentially applied until one is able to satisfy the request.
14
- */
12
+ * The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
13
+ * The provided handlers sequentially applied until one is able to satisfy the request.
14
+ */
15
15
  export class RuntimeRequestHandlerBuilder {
16
- private readonly handlers: RuntimeRequestHandler[] = [];
16
+ private readonly handlers: RuntimeRequestHandler[] = [];
17
17
 
18
- public pushHandler(...handlers: RuntimeRequestHandler[]) {
19
- if (handlers !== undefined) {
20
- this.handlers.push(...handlers);
21
- }
22
- }
18
+ public pushHandler(...handlers: RuntimeRequestHandler[]) {
19
+ if (handlers !== undefined) {
20
+ this.handlers.push(...handlers);
21
+ }
22
+ }
23
23
 
24
- public async handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse> {
25
- const parser = RequestParser.create(request);
26
- for (const handler of this.handlers) {
27
- const response = await handler(parser, runtime);
28
- if (response !== undefined) {
29
- return response;
30
- }
31
- }
32
- return create404Response(request);
33
- }
24
+ public async handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse> {
25
+ const parser = RequestParser.create(request);
26
+ for (const handler of this.handlers) {
27
+ const response = await handler(parser, runtime);
28
+ if (response !== undefined) {
29
+ return response;
30
+ }
31
+ }
32
+ return create404Response(request);
33
+ }
34
34
  }
35
35
 
36
36
  export function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]) {
37
- const builder = new RuntimeRequestHandlerBuilder();
38
- builder.pushHandler(...handlers);
39
- return async (request: IRequest, runtime: IContainerRuntime) => builder.handleRequest(request, runtime);
37
+ const builder = new RuntimeRequestHandlerBuilder();
38
+ builder.pushHandler(...handlers);
39
+ return async (request: IRequest, runtime: IContainerRuntime) =>
40
+ builder.handleRequest(request, runtime);
40
41
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./lib",
5
- "module": "esnext"
6
- },
7
- }
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./lib",
5
+ "module": "esnext",
6
+ },
7
+ }
package/tsconfig.json CHANGED
@@ -1,14 +1,10 @@
1
1
  {
2
- "extends": "@fluidframework/build-common/ts-common-config.json",
3
- "exclude": [
4
- "src/test/**/*"
5
- ],
6
- "compilerOptions": {
7
- "rootDir": "./src",
8
- "outDir": "./dist",
9
- "composite": true
10
- },
11
- "include": [
12
- "src/**/*"
13
- ]
14
- }
2
+ "extends": "@fluidframework/build-common/ts-common-config.json",
3
+ "exclude": ["src/test/**/*"],
4
+ "compilerOptions": {
5
+ "rootDir": "./src",
6
+ "outDir": "./dist",
7
+ "composite": true,
8
+ },
9
+ "include": ["src/**/*"],
10
+ }