@fluidframework/request-handler 2.0.0-internal.7.4.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.
- package/CHANGELOG.md +21 -0
- package/api-report/request-handler.api.md +0 -25
- package/dist/index.cjs +1 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/request-handler-alpha.d.ts +2 -13
- package/dist/request-handler-beta.d.ts +0 -20
- package/dist/request-handler-public.d.ts +0 -20
- package/dist/request-handler-untrimmed.d.ts +4 -45
- package/dist/requestHandlers.cjs +0 -74
- package/dist/requestHandlers.cjs.map +1 -1
- package/dist/requestHandlers.d.ts +3 -26
- package/dist/requestHandlers.d.ts.map +1 -1
- package/dist/runtimeRequestHandlerBuilder.cjs +3 -6
- package/dist/runtimeRequestHandlerBuilder.cjs.map +1 -1
- package/dist/runtimeRequestHandlerBuilder.d.ts +1 -12
- package/dist/runtimeRequestHandlerBuilder.d.ts.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.mjs +1 -2
- package/lib/index.mjs.map +1 -1
- package/lib/request-handler-alpha.d.ts +2 -13
- package/lib/request-handler-beta.d.ts +0 -20
- package/lib/request-handler-public.d.ts +0 -20
- package/lib/request-handler-untrimmed.d.ts +4 -45
- package/lib/requestHandlers.d.ts +3 -26
- package/lib/requestHandlers.d.ts.map +1 -1
- package/lib/requestHandlers.mjs +1 -70
- package/lib/requestHandlers.mjs.map +1 -1
- package/lib/runtimeRequestHandlerBuilder.d.ts +1 -12
- package/lib/runtimeRequestHandlerBuilder.d.ts.map +1 -1
- package/lib/runtimeRequestHandlerBuilder.mjs +3 -5
- package/lib/runtimeRequestHandlerBuilder.mjs.map +1 -1
- package/package.json +26 -9
- package/src/index.ts +2 -10
- package/src/requestHandlers.ts +3 -95
- package/src/runtimeRequestHandlerBuilder.ts +3 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @fluidframework/request-handler
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.8.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- aqueduct: Removed requestHandler utilities [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
|
|
8
|
+
|
|
9
|
+
The following `requestHandler` utilities have been removed:
|
|
10
|
+
|
|
11
|
+
- `makeModelRequestHandler`
|
|
12
|
+
- `defaultFluidObjectRequestHandler`
|
|
13
|
+
- `defaultRouteRequestHandler`
|
|
14
|
+
- `mountableViewRequestHandler`
|
|
15
|
+
- `createFluidObjectResponse`
|
|
16
|
+
- `rootDataStoreRequestHandler`
|
|
17
|
+
- `handleFromLegacyUri`
|
|
18
|
+
- `RuntimeRequestHandlerBuilder`
|
|
19
|
+
|
|
20
|
+
Please migrate all usage to the new `entryPoint` pattern.
|
|
21
|
+
|
|
22
|
+
See [Removing-IFluidRouter.md](https://github.com/microsoft/FluidFramework/blob/main/packages/common/core-interfaces/Removing-IFluidRouter.md) for more details.
|
|
23
|
+
|
|
3
24
|
## 2.0.0-internal.7.4.0
|
|
4
25
|
|
|
5
26
|
Dependency updates only.
|
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
8
7
|
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
9
|
-
import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';
|
|
10
|
-
import { IFluidHandle } from '@fluidframework/core-interfaces';
|
|
11
|
-
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
12
8
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
13
9
|
import { IResponse } from '@fluidframework/core-interfaces';
|
|
14
10
|
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
@@ -16,30 +12,9 @@ import { RequestParser } from '@fluidframework/runtime-utils';
|
|
|
16
12
|
// @internal @deprecated (undocumented)
|
|
17
13
|
export function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
18
14
|
|
|
19
|
-
// @internal @deprecated (undocumented)
|
|
20
|
-
export const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
21
|
-
status: 200;
|
|
22
|
-
mimeType: "fluid/object";
|
|
23
|
-
value: FluidObject;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// @internal @deprecated (undocumented)
|
|
27
|
-
export function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
28
|
-
|
|
29
|
-
// @internal @deprecated
|
|
30
|
-
export const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
31
|
-
|
|
32
15
|
// @alpha @deprecated
|
|
33
16
|
export type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
34
17
|
|
|
35
|
-
// @internal @deprecated
|
|
36
|
-
export class RuntimeRequestHandlerBuilder {
|
|
37
|
-
// (undocumented)
|
|
38
|
-
handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse>;
|
|
39
|
-
// (undocumented)
|
|
40
|
-
pushHandler(...handlers: RuntimeRequestHandler[]): void;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
18
|
// (No @packageDocumentation comment for this package)
|
|
44
19
|
|
|
45
20
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -4,12 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
var requestHandlers_1 = require("./requestHandlers.cjs");
|
|
9
|
-
Object.defineProperty(exports, "createFluidObjectResponse", { enumerable: true, get: function () { return requestHandlers_1.createFluidObjectResponse; } });
|
|
10
|
-
Object.defineProperty(exports, "handleFromLegacyUri", { enumerable: true, get: function () { return requestHandlers_1.handleFromLegacyUri; } });
|
|
11
|
-
Object.defineProperty(exports, "rootDataStoreRequestHandler", { enumerable: true, get: function () { return requestHandlers_1.rootDataStoreRequestHandler; } });
|
|
7
|
+
exports.buildRuntimeRequestHandler = void 0;
|
|
12
8
|
var runtimeRequestHandlerBuilder_1 = require("./runtimeRequestHandlerBuilder.cjs");
|
|
13
9
|
Object.defineProperty(exports, "buildRuntimeRequestHandler", { enumerable: true, get: function () { return runtimeRequestHandlerBuilder_1.buildRuntimeRequestHandler; } });
|
|
14
|
-
Object.defineProperty(exports, "RuntimeRequestHandlerBuilder", { enumerable: true, get: function () { return runtimeRequestHandlerBuilder_1.RuntimeRequestHandlerBuilder; } });
|
|
15
10
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,mFAA4E;AAAnE,0IAAA,0BAA0B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { RuntimeRequestHandler } from \"./requestHandlers\";\nexport { buildRuntimeRequestHandler } from \"./runtimeRequestHandlerBuilder\";\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export {
|
|
6
|
-
export { buildRuntimeRequestHandler
|
|
5
|
+
export { RuntimeRequestHandler } from "./requestHandlers";
|
|
6
|
+
export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,30 +1,19 @@
|
|
|
1
|
-
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
1
|
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
3
|
-
import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';
|
|
4
|
-
import { IFluidHandle } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
6
2
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
7
3
|
import { IResponse } from '@fluidframework/core-interfaces';
|
|
8
4
|
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
9
5
|
|
|
10
6
|
/* Excluded from this release type: buildRuntimeRequestHandler */
|
|
11
7
|
|
|
12
|
-
/* Excluded from this release type: createFluidObjectResponse */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: handleFromLegacyUri */
|
|
15
|
-
|
|
16
|
-
/* Excluded from this release type: rootDataStoreRequestHandler */
|
|
17
|
-
|
|
18
8
|
/**
|
|
19
9
|
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
20
10
|
* if it does not apply. These handlers are called in series, so there may be other handlers before or after.
|
|
21
11
|
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
22
12
|
* the route, or fulling the specific request.
|
|
23
|
-
* @deprecated Will be removed
|
|
13
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
14
|
+
*
|
|
24
15
|
* @alpha
|
|
25
16
|
*/
|
|
26
17
|
export declare type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
27
18
|
|
|
28
|
-
/* Excluded from this release type: RuntimeRequestHandlerBuilder */
|
|
29
|
-
|
|
30
19
|
export { }
|
|
@@ -1,38 +1,18 @@
|
|
|
1
|
-
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
1
|
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
3
|
-
import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';
|
|
4
|
-
import { IFluidHandle } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
6
2
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
7
3
|
import { IResponse } from '@fluidframework/core-interfaces';
|
|
8
4
|
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
9
5
|
|
|
10
6
|
/* Excluded from this release type: buildRuntimeRequestHandler */
|
|
11
7
|
|
|
12
|
-
/* Excluded from this release type: createFluidObjectResponse */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: FluidObject */
|
|
15
|
-
|
|
16
|
-
/* Excluded from this release type: handleFromLegacyUri */
|
|
17
|
-
|
|
18
8
|
/* Excluded from this release type: IContainerRuntime */
|
|
19
9
|
|
|
20
|
-
/* Excluded from this release type: IContainerRuntimeBase */
|
|
21
|
-
|
|
22
|
-
/* Excluded from this release type: IFluidHandle */
|
|
23
|
-
|
|
24
|
-
/* Excluded from this release type: IFluidLoadable */
|
|
25
|
-
|
|
26
10
|
/* Excluded from this release type: IRequest */
|
|
27
11
|
|
|
28
12
|
/* Excluded from this release type: IResponse */
|
|
29
13
|
|
|
30
14
|
/* Excluded from this release type: RequestParser */
|
|
31
15
|
|
|
32
|
-
/* Excluded from this release type: rootDataStoreRequestHandler */
|
|
33
|
-
|
|
34
16
|
/* Excluded from this release type: RuntimeRequestHandler */
|
|
35
17
|
|
|
36
|
-
/* Excluded from this release type: RuntimeRequestHandlerBuilder */
|
|
37
|
-
|
|
38
18
|
export { }
|
|
@@ -1,38 +1,18 @@
|
|
|
1
|
-
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
1
|
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
3
|
-
import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';
|
|
4
|
-
import { IFluidHandle } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
6
2
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
7
3
|
import { IResponse } from '@fluidframework/core-interfaces';
|
|
8
4
|
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
9
5
|
|
|
10
6
|
/* Excluded from this release type: buildRuntimeRequestHandler */
|
|
11
7
|
|
|
12
|
-
/* Excluded from this release type: createFluidObjectResponse */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: FluidObject */
|
|
15
|
-
|
|
16
|
-
/* Excluded from this release type: handleFromLegacyUri */
|
|
17
|
-
|
|
18
8
|
/* Excluded from this release type: IContainerRuntime */
|
|
19
9
|
|
|
20
|
-
/* Excluded from this release type: IContainerRuntimeBase */
|
|
21
|
-
|
|
22
|
-
/* Excluded from this release type: IFluidHandle */
|
|
23
|
-
|
|
24
|
-
/* Excluded from this release type: IFluidLoadable */
|
|
25
|
-
|
|
26
10
|
/* Excluded from this release type: IRequest */
|
|
27
11
|
|
|
28
12
|
/* Excluded from this release type: IResponse */
|
|
29
13
|
|
|
30
14
|
/* Excluded from this release type: RequestParser */
|
|
31
15
|
|
|
32
|
-
/* Excluded from this release type: rootDataStoreRequestHandler */
|
|
33
|
-
|
|
34
16
|
/* Excluded from this release type: RuntimeRequestHandler */
|
|
35
17
|
|
|
36
|
-
/* Excluded from this release type: RuntimeRequestHandlerBuilder */
|
|
37
|
-
|
|
38
18
|
export { }
|
|
@@ -1,65 +1,24 @@
|
|
|
1
|
-
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
1
|
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
3
|
-
import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';
|
|
4
|
-
import { IFluidHandle } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
6
2
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
7
3
|
import { IResponse } from '@fluidframework/core-interfaces';
|
|
8
4
|
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
9
5
|
|
|
10
6
|
/**
|
|
11
|
-
* @deprecated Will be removed
|
|
7
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
8
|
+
*
|
|
12
9
|
* @internal
|
|
13
10
|
*/
|
|
14
11
|
export declare function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
15
12
|
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
export declare const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
21
|
-
status: 200;
|
|
22
|
-
mimeType: "fluid/object";
|
|
23
|
-
value: FluidObject;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
30
|
-
export declare function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* A request handler to expose access to all root data stores in the container by id.
|
|
34
|
-
* @param request - the request for the root data store. The first path part must be the data store's ID.
|
|
35
|
-
* @param runtime - the container runtime
|
|
36
|
-
* @returns the result of the request
|
|
37
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
export declare const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
41
|
-
|
|
42
13
|
/**
|
|
43
14
|
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
44
15
|
* if it does not apply. These handlers are called in series, so there may be other handlers before or after.
|
|
45
16
|
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
46
17
|
* the route, or fulling the specific request.
|
|
47
|
-
* @deprecated Will be removed
|
|
18
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
19
|
+
*
|
|
48
20
|
* @alpha
|
|
49
21
|
*/
|
|
50
22
|
export declare type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
51
23
|
|
|
52
|
-
/**
|
|
53
|
-
* The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
|
|
54
|
-
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
55
|
-
*
|
|
56
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
57
|
-
* @internal
|
|
58
|
-
*/
|
|
59
|
-
export declare class RuntimeRequestHandlerBuilder {
|
|
60
|
-
private readonly handlers;
|
|
61
|
-
pushHandler(...handlers: RuntimeRequestHandler[]): void;
|
|
62
|
-
handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse>;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
24
|
export { }
|
package/dist/requestHandlers.cjs
CHANGED
|
@@ -4,78 +4,4 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.handleFromLegacyUri = exports.createFluidObjectResponse = exports.rootDataStoreRequestHandler = void 0;
|
|
8
|
-
const core_utils_1 = require("@fluidframework/core-utils");
|
|
9
|
-
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
10
|
-
/**
|
|
11
|
-
* A request handler to expose access to all root data stores in the container by id.
|
|
12
|
-
* @param request - the request for the root data store. The first path part must be the data store's ID.
|
|
13
|
-
* @param runtime - the container runtime
|
|
14
|
-
* @returns the result of the request
|
|
15
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
const rootDataStoreRequestHandler = async (request, runtime) => {
|
|
19
|
-
const requestParser = runtime_utils_1.RequestParser.create(request);
|
|
20
|
-
const id = requestParser.pathParts[0];
|
|
21
|
-
const wait = typeof request.headers?.wait === "boolean" ? request.headers.wait : undefined;
|
|
22
|
-
// eslint-disable-next-line import/no-deprecated
|
|
23
|
-
let rootDataStore;
|
|
24
|
-
try {
|
|
25
|
-
// getRootDataStore currently throws if the data store is not found
|
|
26
|
-
rootDataStore = await runtime.getRootDataStore(id, wait);
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
return undefined; // continue search
|
|
30
|
-
}
|
|
31
|
-
try {
|
|
32
|
-
return await rootDataStore.IFluidRouter.request(requestParser.createSubRequest(1));
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
return { status: 500, mimeType: "fluid/object", value: error };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
exports.rootDataStoreRequestHandler = rootDataStoreRequestHandler;
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
41
|
-
* @internal
|
|
42
|
-
*/
|
|
43
|
-
const createFluidObjectResponse = (fluidObject) => {
|
|
44
|
-
return { status: 200, mimeType: "fluid/object", value: fluidObject };
|
|
45
|
-
};
|
|
46
|
-
exports.createFluidObjectResponse = createFluidObjectResponse;
|
|
47
|
-
class LegacyUriHandle {
|
|
48
|
-
get IFluidHandle() {
|
|
49
|
-
return this;
|
|
50
|
-
}
|
|
51
|
-
constructor(absolutePath, runtime) {
|
|
52
|
-
this.absolutePath = absolutePath;
|
|
53
|
-
this.runtime = runtime;
|
|
54
|
-
this.isAttached = true;
|
|
55
|
-
}
|
|
56
|
-
attachGraph() {
|
|
57
|
-
(0, core_utils_1.assert)(false, 0x0ca /* "Trying to use legacy graph attach!" */);
|
|
58
|
-
}
|
|
59
|
-
async get() {
|
|
60
|
-
const response = await this.runtime.IFluidHandleContext.resolveHandle({
|
|
61
|
-
url: this.absolutePath,
|
|
62
|
-
});
|
|
63
|
-
if (response.status === 200 && response.mimeType === "fluid/object") {
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
65
|
-
return response.value;
|
|
66
|
-
}
|
|
67
|
-
throw new Error(`Failed to resolve container path ${this.absolutePath}`);
|
|
68
|
-
}
|
|
69
|
-
bind(handle) {
|
|
70
|
-
throw new Error("Cannot bind to LegacyUriHandle");
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
75
|
-
* @internal
|
|
76
|
-
*/
|
|
77
|
-
function handleFromLegacyUri(uri, runtime) {
|
|
78
|
-
return new LegacyUriHandle(uri, runtime);
|
|
79
|
-
}
|
|
80
|
-
exports.handleFromLegacyUri = handleFromLegacyUri;
|
|
81
7
|
//# sourceMappingURL=requestHandlers.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.cjs","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"requestHandlers.cjs","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-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 * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @alpha\n */\nexport type RuntimeRequestHandler = (\n\trequest: RequestParser,\n\truntime: IContainerRuntime,\n) => Promise<IResponse | undefined>;\n"]}
|
|
@@ -2,40 +2,17 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IResponse
|
|
5
|
+
import { IResponse } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
|
-
import { IContainerRuntimeBase } from "@fluidframework/runtime-definitions";
|
|
8
7
|
import { RequestParser } from "@fluidframework/runtime-utils";
|
|
9
8
|
/**
|
|
10
9
|
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
11
10
|
* if it does not apply. These handlers are called in series, so there may be other handlers before or after.
|
|
12
11
|
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
13
12
|
* the route, or fulling the specific request.
|
|
14
|
-
* @deprecated Will be removed
|
|
13
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
14
|
+
*
|
|
15
15
|
* @alpha
|
|
16
16
|
*/
|
|
17
17
|
export type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
18
|
-
/**
|
|
19
|
-
* A request handler to expose access to all root data stores in the container by id.
|
|
20
|
-
* @param request - the request for the root data store. The first path part must be the data store's ID.
|
|
21
|
-
* @param runtime - the container runtime
|
|
22
|
-
* @returns the result of the request
|
|
23
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
export declare const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
export declare const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
32
|
-
status: 200;
|
|
33
|
-
mimeType: "fluid/object";
|
|
34
|
-
value: FluidObject;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
export declare function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
41
18
|
//# sourceMappingURL=requestHandlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,CACnC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,iBAAiB,KACtB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC"}
|
|
@@ -4,14 +4,11 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.buildRuntimeRequestHandler =
|
|
7
|
+
exports.buildRuntimeRequestHandler = void 0;
|
|
8
8
|
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
9
9
|
/**
|
|
10
10
|
* The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
|
|
11
11
|
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
12
|
-
*
|
|
13
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
14
|
-
* @internal
|
|
15
12
|
*/
|
|
16
13
|
class RuntimeRequestHandlerBuilder {
|
|
17
14
|
constructor() {
|
|
@@ -35,9 +32,9 @@ class RuntimeRequestHandlerBuilder {
|
|
|
35
32
|
return (0, runtime_utils_1.create404Response)(request);
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
|
-
exports.RuntimeRequestHandlerBuilder = RuntimeRequestHandlerBuilder;
|
|
39
35
|
/**
|
|
40
|
-
* @deprecated Will be removed
|
|
36
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
37
|
+
*
|
|
41
38
|
* @internal
|
|
42
39
|
*/
|
|
43
40
|
// eslint-disable-next-line import/no-deprecated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeRequestHandlerBuilder.cjs","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,iEAAiF;AAIjF
|
|
1
|
+
{"version":3,"file":"runtimeRequestHandlerBuilder.cjs","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,iEAAiF;AAIjF;;;GAGG;AACH,MAAM,4BAA4B;IAAlC;QACC,gDAAgD;QAC/B,aAAQ,GAA4B,EAAE,CAAC;IAmBzD,CAAC;IAjBA,gDAAgD;IACzC,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;AAED;;;;GAIG;AACH,gDAAgD;AAChD,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\";\n// eslint-disable-next-line import/no-deprecated\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 */\nclass RuntimeRequestHandlerBuilder {\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate readonly handlers: RuntimeRequestHandler[] = [];\n\n\t// eslint-disable-next-line import/no-deprecated\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\n/**\n * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @internal\n */\n// eslint-disable-next-line import/no-deprecated\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"]}
|
|
@@ -6,19 +6,8 @@ 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
|
-
*
|
|
10
|
-
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
9
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
11
10
|
*
|
|
12
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export declare class RuntimeRequestHandlerBuilder {
|
|
16
|
-
private readonly handlers;
|
|
17
|
-
pushHandler(...handlers: RuntimeRequestHandler[]): void;
|
|
18
|
-
handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse>;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
22
11
|
* @internal
|
|
23
12
|
*/
|
|
24
13
|
export declare function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
@@ -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;AAGlF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;
|
|
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;AAGlF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AA6B1D;;;;GAIG;AAEH,wBAAgB,0BAA0B,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE,aAGvD,QAAQ,WAAW,iBAAiB,wBAE3D"}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export {
|
|
6
|
-
export { buildRuntimeRequestHandler
|
|
5
|
+
export { RuntimeRequestHandler } from "./requestHandlers.mjs";
|
|
6
|
+
export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder.mjs";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,qBAAqB,EAAE;OACzB,EAAE,0BAA0B,EAAE"}
|
package/lib/index.mjs
CHANGED
|
@@ -2,6 +2,5 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export {
|
|
6
|
-
export { buildRuntimeRequestHandler, RuntimeRequestHandlerBuilder, } from "./runtimeRequestHandlerBuilder.mjs";
|
|
5
|
+
export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder.mjs";
|
|
7
6
|
//# sourceMappingURL=index.mjs.map
|
package/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,0BAA0B,EAAE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { RuntimeRequestHandler } from \"./requestHandlers\";\nexport { buildRuntimeRequestHandler } from \"./runtimeRequestHandlerBuilder\";\n"]}
|
|
@@ -1,30 +1,19 @@
|
|
|
1
|
-
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
1
|
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
3
|
-
import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';
|
|
4
|
-
import { IFluidHandle } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
6
2
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
7
3
|
import { IResponse } from '@fluidframework/core-interfaces';
|
|
8
4
|
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
9
5
|
|
|
10
6
|
/* Excluded from this release type: buildRuntimeRequestHandler */
|
|
11
7
|
|
|
12
|
-
/* Excluded from this release type: createFluidObjectResponse */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: handleFromLegacyUri */
|
|
15
|
-
|
|
16
|
-
/* Excluded from this release type: rootDataStoreRequestHandler */
|
|
17
|
-
|
|
18
8
|
/**
|
|
19
9
|
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
20
10
|
* if it does not apply. These handlers are called in series, so there may be other handlers before or after.
|
|
21
11
|
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
22
12
|
* the route, or fulling the specific request.
|
|
23
|
-
* @deprecated Will be removed
|
|
13
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
14
|
+
*
|
|
24
15
|
* @alpha
|
|
25
16
|
*/
|
|
26
17
|
export declare type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
27
18
|
|
|
28
|
-
/* Excluded from this release type: RuntimeRequestHandlerBuilder */
|
|
29
|
-
|
|
30
19
|
export { }
|
|
@@ -1,38 +1,18 @@
|
|
|
1
|
-
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
1
|
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
3
|
-
import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';
|
|
4
|
-
import { IFluidHandle } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
6
2
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
7
3
|
import { IResponse } from '@fluidframework/core-interfaces';
|
|
8
4
|
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
9
5
|
|
|
10
6
|
/* Excluded from this release type: buildRuntimeRequestHandler */
|
|
11
7
|
|
|
12
|
-
/* Excluded from this release type: createFluidObjectResponse */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: FluidObject */
|
|
15
|
-
|
|
16
|
-
/* Excluded from this release type: handleFromLegacyUri */
|
|
17
|
-
|
|
18
8
|
/* Excluded from this release type: IContainerRuntime */
|
|
19
9
|
|
|
20
|
-
/* Excluded from this release type: IContainerRuntimeBase */
|
|
21
|
-
|
|
22
|
-
/* Excluded from this release type: IFluidHandle */
|
|
23
|
-
|
|
24
|
-
/* Excluded from this release type: IFluidLoadable */
|
|
25
|
-
|
|
26
10
|
/* Excluded from this release type: IRequest */
|
|
27
11
|
|
|
28
12
|
/* Excluded from this release type: IResponse */
|
|
29
13
|
|
|
30
14
|
/* Excluded from this release type: RequestParser */
|
|
31
15
|
|
|
32
|
-
/* Excluded from this release type: rootDataStoreRequestHandler */
|
|
33
|
-
|
|
34
16
|
/* Excluded from this release type: RuntimeRequestHandler */
|
|
35
17
|
|
|
36
|
-
/* Excluded from this release type: RuntimeRequestHandlerBuilder */
|
|
37
|
-
|
|
38
18
|
export { }
|
|
@@ -1,38 +1,18 @@
|
|
|
1
|
-
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
1
|
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
3
|
-
import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';
|
|
4
|
-
import { IFluidHandle } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
6
2
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
7
3
|
import { IResponse } from '@fluidframework/core-interfaces';
|
|
8
4
|
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
9
5
|
|
|
10
6
|
/* Excluded from this release type: buildRuntimeRequestHandler */
|
|
11
7
|
|
|
12
|
-
/* Excluded from this release type: createFluidObjectResponse */
|
|
13
|
-
|
|
14
|
-
/* Excluded from this release type: FluidObject */
|
|
15
|
-
|
|
16
|
-
/* Excluded from this release type: handleFromLegacyUri */
|
|
17
|
-
|
|
18
8
|
/* Excluded from this release type: IContainerRuntime */
|
|
19
9
|
|
|
20
|
-
/* Excluded from this release type: IContainerRuntimeBase */
|
|
21
|
-
|
|
22
|
-
/* Excluded from this release type: IFluidHandle */
|
|
23
|
-
|
|
24
|
-
/* Excluded from this release type: IFluidLoadable */
|
|
25
|
-
|
|
26
10
|
/* Excluded from this release type: IRequest */
|
|
27
11
|
|
|
28
12
|
/* Excluded from this release type: IResponse */
|
|
29
13
|
|
|
30
14
|
/* Excluded from this release type: RequestParser */
|
|
31
15
|
|
|
32
|
-
/* Excluded from this release type: rootDataStoreRequestHandler */
|
|
33
|
-
|
|
34
16
|
/* Excluded from this release type: RuntimeRequestHandler */
|
|
35
17
|
|
|
36
|
-
/* Excluded from this release type: RuntimeRequestHandlerBuilder */
|
|
37
|
-
|
|
38
18
|
export { }
|
|
@@ -1,65 +1,24 @@
|
|
|
1
|
-
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
1
|
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
3
|
-
import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';
|
|
4
|
-
import { IFluidHandle } from '@fluidframework/core-interfaces';
|
|
5
|
-
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
6
2
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
7
3
|
import { IResponse } from '@fluidframework/core-interfaces';
|
|
8
4
|
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
9
5
|
|
|
10
6
|
/**
|
|
11
|
-
* @deprecated Will be removed
|
|
7
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
8
|
+
*
|
|
12
9
|
* @internal
|
|
13
10
|
*/
|
|
14
11
|
export declare function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
15
12
|
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
export declare const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
21
|
-
status: 200;
|
|
22
|
-
mimeType: "fluid/object";
|
|
23
|
-
value: FluidObject;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
30
|
-
export declare function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* A request handler to expose access to all root data stores in the container by id.
|
|
34
|
-
* @param request - the request for the root data store. The first path part must be the data store's ID.
|
|
35
|
-
* @param runtime - the container runtime
|
|
36
|
-
* @returns the result of the request
|
|
37
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
export declare const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
41
|
-
|
|
42
13
|
/**
|
|
43
14
|
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
44
15
|
* if it does not apply. These handlers are called in series, so there may be other handlers before or after.
|
|
45
16
|
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
46
17
|
* the route, or fulling the specific request.
|
|
47
|
-
* @deprecated Will be removed
|
|
18
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
19
|
+
*
|
|
48
20
|
* @alpha
|
|
49
21
|
*/
|
|
50
22
|
export declare type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
51
23
|
|
|
52
|
-
/**
|
|
53
|
-
* The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
|
|
54
|
-
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
55
|
-
*
|
|
56
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
57
|
-
* @internal
|
|
58
|
-
*/
|
|
59
|
-
export declare class RuntimeRequestHandlerBuilder {
|
|
60
|
-
private readonly handlers;
|
|
61
|
-
pushHandler(...handlers: RuntimeRequestHandler[]): void;
|
|
62
|
-
handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse>;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
24
|
export { }
|
package/lib/requestHandlers.d.ts
CHANGED
|
@@ -2,40 +2,17 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IResponse
|
|
5
|
+
import { IResponse } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
|
-
import { IContainerRuntimeBase } from "@fluidframework/runtime-definitions";
|
|
8
7
|
import { RequestParser } from "@fluidframework/runtime-utils";
|
|
9
8
|
/**
|
|
10
9
|
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
11
10
|
* if it does not apply. These handlers are called in series, so there may be other handlers before or after.
|
|
12
11
|
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
13
12
|
* the route, or fulling the specific request.
|
|
14
|
-
* @deprecated Will be removed
|
|
13
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
14
|
+
*
|
|
15
15
|
* @alpha
|
|
16
16
|
*/
|
|
17
17
|
export type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
18
|
-
/**
|
|
19
|
-
* A request handler to expose access to all root data stores in the container by id.
|
|
20
|
-
* @param request - the request for the root data store. The first path part must be the data store's ID.
|
|
21
|
-
* @param runtime - the container runtime
|
|
22
|
-
* @returns the result of the request
|
|
23
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
export declare const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
export declare const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
32
|
-
status: 200;
|
|
33
|
-
mimeType: "fluid/object";
|
|
34
|
-
value: FluidObject;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
export declare function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
41
18
|
//# sourceMappingURL=requestHandlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"requestHandlers.d.ts","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,SAAS,EAAE,MAAM,iCAAiC;OACpD,EAAE,iBAAiB,EAAE,MAAM,+CAA+C;OAC1E,EAAE,aAAa,EAAE,MAAM,+BAA+B;AAE7D;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,CACnC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,iBAAiB,KACtB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC"}
|
package/lib/requestHandlers.mjs
CHANGED
|
@@ -2,74 +2,5 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
import { RequestParser } from "@fluidframework/runtime-utils";
|
|
7
|
-
/**
|
|
8
|
-
* A request handler to expose access to all root data stores in the container by id.
|
|
9
|
-
* @param request - the request for the root data store. The first path part must be the data store's ID.
|
|
10
|
-
* @param runtime - the container runtime
|
|
11
|
-
* @returns the result of the request
|
|
12
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export const rootDataStoreRequestHandler = async (request, runtime) => {
|
|
16
|
-
const requestParser = RequestParser.create(request);
|
|
17
|
-
const id = requestParser.pathParts[0];
|
|
18
|
-
const wait = typeof request.headers?.wait === "boolean" ? request.headers.wait : undefined;
|
|
19
|
-
// eslint-disable-next-line import/no-deprecated
|
|
20
|
-
let rootDataStore;
|
|
21
|
-
try {
|
|
22
|
-
// getRootDataStore currently throws if the data store is not found
|
|
23
|
-
rootDataStore = await runtime.getRootDataStore(id, wait);
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
return undefined; // continue search
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
return await rootDataStore.IFluidRouter.request(requestParser.createSubRequest(1));
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
return { status: 500, mimeType: "fluid/object", value: error };
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
37
|
-
* @internal
|
|
38
|
-
*/
|
|
39
|
-
export const createFluidObjectResponse = (fluidObject) => {
|
|
40
|
-
return { status: 200, mimeType: "fluid/object", value: fluidObject };
|
|
41
|
-
};
|
|
42
|
-
class LegacyUriHandle {
|
|
43
|
-
get IFluidHandle() {
|
|
44
|
-
return this;
|
|
45
|
-
}
|
|
46
|
-
constructor(absolutePath, runtime) {
|
|
47
|
-
this.absolutePath = absolutePath;
|
|
48
|
-
this.runtime = runtime;
|
|
49
|
-
this.isAttached = true;
|
|
50
|
-
}
|
|
51
|
-
attachGraph() {
|
|
52
|
-
assert(false, 0x0ca /* "Trying to use legacy graph attach!" */);
|
|
53
|
-
}
|
|
54
|
-
async get() {
|
|
55
|
-
const response = await this.runtime.IFluidHandleContext.resolveHandle({
|
|
56
|
-
url: this.absolutePath,
|
|
57
|
-
});
|
|
58
|
-
if (response.status === 200 && response.mimeType === "fluid/object") {
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
60
|
-
return response.value;
|
|
61
|
-
}
|
|
62
|
-
throw new Error(`Failed to resolve container path ${this.absolutePath}`);
|
|
63
|
-
}
|
|
64
|
-
bind(handle) {
|
|
65
|
-
throw new Error("Cannot bind to LegacyUriHandle");
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
70
|
-
* @internal
|
|
71
|
-
*/
|
|
72
|
-
export function handleFromLegacyUri(uri, runtime) {
|
|
73
|
-
return new LegacyUriHandle(uri, runtime);
|
|
74
|
-
}
|
|
5
|
+
export {};
|
|
75
6
|
//# sourceMappingURL=requestHandlers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.mjs","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"requestHandlers.mjs","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-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 * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @alpha\n */\nexport type RuntimeRequestHandler = (\n\trequest: RequestParser,\n\truntime: IContainerRuntime,\n) => Promise<IResponse | undefined>;\n"]}
|
|
@@ -6,19 +6,8 @@ import { IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
|
6
6
|
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
7
7
|
import { RuntimeRequestHandler } from "./requestHandlers.mjs";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
9
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
11
10
|
*
|
|
12
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export declare class RuntimeRequestHandlerBuilder {
|
|
16
|
-
private readonly handlers;
|
|
17
|
-
pushHandler(...handlers: RuntimeRequestHandler[]): void;
|
|
18
|
-
handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse>;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
22
11
|
* @internal
|
|
23
12
|
*/
|
|
24
13
|
export declare function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeRequestHandlerBuilder.d.ts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC;OAC9D,EAAE,iBAAiB,EAAE,MAAM,+CAA+C;OAG1E,EAAE,qBAAqB,EAAE;
|
|
1
|
+
{"version":3,"file":"runtimeRequestHandlerBuilder.d.ts","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC;OAC9D,EAAE,iBAAiB,EAAE,MAAM,+CAA+C;OAG1E,EAAE,qBAAqB,EAAE;AA6BhC;;;;GAIG;AAEH,wBAAgB,0BAA0B,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE,aAGvD,QAAQ,WAAW,iBAAiB,wBAE3D"}
|
|
@@ -6,11 +6,8 @@ import { RequestParser, create404Response } from "@fluidframework/runtime-utils"
|
|
|
6
6
|
/**
|
|
7
7
|
* The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
|
|
8
8
|
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
9
|
-
*
|
|
10
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
11
|
-
* @internal
|
|
12
9
|
*/
|
|
13
|
-
|
|
10
|
+
class RuntimeRequestHandlerBuilder {
|
|
14
11
|
constructor() {
|
|
15
12
|
// eslint-disable-next-line import/no-deprecated
|
|
16
13
|
this.handlers = [];
|
|
@@ -33,7 +30,8 @@ export class RuntimeRequestHandlerBuilder {
|
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
/**
|
|
36
|
-
* @deprecated Will be removed
|
|
33
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
34
|
+
*
|
|
37
35
|
* @internal
|
|
38
36
|
*/
|
|
39
37
|
// eslint-disable-next-line import/no-deprecated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeRequestHandlerBuilder.mjs","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAII,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,+BAA+B;AAIhF
|
|
1
|
+
{"version":3,"file":"runtimeRequestHandlerBuilder.mjs","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAII,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,+BAA+B;AAIhF;;;GAGG;AACH,MAAM,4BAA4B;IAAlC;QACC,gDAAgD;QAC/B,aAAQ,GAA4B,EAAE,CAAC;IAmBzD,CAAC;IAjBA,gDAAgD;IACzC,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;;;;GAIG;AACH,gDAAgD;AAChD,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\";\n// eslint-disable-next-line import/no-deprecated\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 */\nclass RuntimeRequestHandlerBuilder {\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate readonly handlers: RuntimeRequestHandler[] = [];\n\n\t// eslint-disable-next-line import/no-deprecated\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\n/**\n * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @internal\n */\n// eslint-disable-next-line import/no-deprecated\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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/request-handler",
|
|
3
|
-
"version": "2.0.0-internal.
|
|
3
|
+
"version": "2.0.0-internal.8.0.0",
|
|
4
4
|
"description": "A simple request handling library for Fluid Framework",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluidframework/container-runtime-definitions": ">=2.0.0-internal.
|
|
39
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.
|
|
40
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.
|
|
41
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-internal.
|
|
42
|
-
"@fluidframework/runtime-utils": ">=2.0.0-internal.
|
|
38
|
+
"@fluidframework/container-runtime-definitions": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
39
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
40
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
41
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
42
|
+
"@fluidframework/runtime-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@arethetypeswrong/cli": "^0.13.3",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"@fluidframework/build-common": "^2.0.3",
|
|
48
48
|
"@fluidframework/build-tools": "^0.28.0",
|
|
49
49
|
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
50
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.
|
|
50
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
51
51
|
"@fluidframework/request-handler-previous": "npm:@fluidframework/request-handler@2.0.0-internal.7.2.0",
|
|
52
|
-
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.
|
|
52
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
53
53
|
"@microsoft/api-extractor": "^7.38.3",
|
|
54
54
|
"@types/diff": "^3.5.1",
|
|
55
55
|
"@types/mocha": "^9.1.1",
|
|
@@ -81,7 +81,24 @@
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"typeValidation": {
|
|
84
|
-
"broken": {
|
|
84
|
+
"broken": {
|
|
85
|
+
"RemovedVariableDeclaration_createFluidObjectResponse": {
|
|
86
|
+
"forwardCompat": false,
|
|
87
|
+
"backCompat": false
|
|
88
|
+
},
|
|
89
|
+
"RemovedVariableDeclaration_rootDataStoreRequestHandler": {
|
|
90
|
+
"forwardCompat": false,
|
|
91
|
+
"backCompat": false
|
|
92
|
+
},
|
|
93
|
+
"RemovedFunctionDeclaration_handleFromLegacyUri": {
|
|
94
|
+
"forwardCompat": false,
|
|
95
|
+
"backCompat": false
|
|
96
|
+
},
|
|
97
|
+
"RemovedClassDeclaration_RuntimeRequestHandlerBuilder": {
|
|
98
|
+
"forwardCompat": false,
|
|
99
|
+
"backCompat": false
|
|
100
|
+
}
|
|
101
|
+
}
|
|
85
102
|
},
|
|
86
103
|
"scripts": {
|
|
87
104
|
"api": "fluid-build . --task api",
|
package/src/index.ts
CHANGED
|
@@ -3,13 +3,5 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export {
|
|
7
|
-
|
|
8
|
-
handleFromLegacyUri,
|
|
9
|
-
rootDataStoreRequestHandler,
|
|
10
|
-
RuntimeRequestHandler,
|
|
11
|
-
} from "./requestHandlers";
|
|
12
|
-
export {
|
|
13
|
-
buildRuntimeRequestHandler,
|
|
14
|
-
RuntimeRequestHandlerBuilder,
|
|
15
|
-
} from "./runtimeRequestHandlerBuilder";
|
|
6
|
+
export { RuntimeRequestHandler } from "./requestHandlers";
|
|
7
|
+
export { buildRuntimeRequestHandler } from "./runtimeRequestHandlerBuilder";
|
package/src/requestHandlers.ts
CHANGED
|
@@ -3,18 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
IResponse,
|
|
9
|
-
IRequest,
|
|
10
|
-
IFluidHandle,
|
|
11
|
-
IFluidLoadable,
|
|
12
|
-
FluidObject,
|
|
13
|
-
// eslint-disable-next-line import/no-deprecated
|
|
14
|
-
IFluidRouter,
|
|
15
|
-
} from "@fluidframework/core-interfaces";
|
|
6
|
+
import { IResponse } from "@fluidframework/core-interfaces";
|
|
16
7
|
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
17
|
-
import { IContainerRuntimeBase } from "@fluidframework/runtime-definitions";
|
|
18
8
|
import { RequestParser } from "@fluidframework/runtime-utils";
|
|
19
9
|
|
|
20
10
|
/**
|
|
@@ -22,93 +12,11 @@ import { RequestParser } from "@fluidframework/runtime-utils";
|
|
|
22
12
|
* if it does not apply. These handlers are called in series, so there may be other handlers before or after.
|
|
23
13
|
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
24
14
|
* the route, or fulling the specific request.
|
|
25
|
-
* @deprecated Will be removed
|
|
15
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
16
|
+
*
|
|
26
17
|
* @alpha
|
|
27
18
|
*/
|
|
28
19
|
export type RuntimeRequestHandler = (
|
|
29
20
|
request: RequestParser,
|
|
30
21
|
runtime: IContainerRuntime,
|
|
31
22
|
) => Promise<IResponse | undefined>;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* A request handler to expose access to all root data stores in the container by id.
|
|
35
|
-
* @param request - the request for the root data store. The first path part must be the data store's ID.
|
|
36
|
-
* @param runtime - the container runtime
|
|
37
|
-
* @returns the result of the request
|
|
38
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
39
|
-
* @internal
|
|
40
|
-
*/
|
|
41
|
-
export const rootDataStoreRequestHandler = async (
|
|
42
|
-
request: IRequest,
|
|
43
|
-
runtime: IContainerRuntime,
|
|
44
|
-
) => {
|
|
45
|
-
const requestParser = RequestParser.create(request);
|
|
46
|
-
const id = requestParser.pathParts[0];
|
|
47
|
-
const wait = typeof request.headers?.wait === "boolean" ? request.headers.wait : undefined;
|
|
48
|
-
// eslint-disable-next-line import/no-deprecated
|
|
49
|
-
let rootDataStore: IFluidRouter;
|
|
50
|
-
try {
|
|
51
|
-
// getRootDataStore currently throws if the data store is not found
|
|
52
|
-
rootDataStore = await runtime.getRootDataStore(id, wait);
|
|
53
|
-
} catch (error) {
|
|
54
|
-
return undefined; // continue search
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
return await rootDataStore.IFluidRouter.request(requestParser.createSubRequest(1));
|
|
58
|
-
} catch (error) {
|
|
59
|
-
return { status: 500, mimeType: "fluid/object", value: error };
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
65
|
-
* @internal
|
|
66
|
-
*/
|
|
67
|
-
export const createFluidObjectResponse = (
|
|
68
|
-
fluidObject: FluidObject,
|
|
69
|
-
): { status: 200; mimeType: "fluid/object"; value: FluidObject } => {
|
|
70
|
-
return { status: 200, mimeType: "fluid/object", value: fluidObject };
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
class LegacyUriHandle<T = FluidObject & IFluidLoadable> implements IFluidHandle<T> {
|
|
74
|
-
public readonly isAttached = true;
|
|
75
|
-
|
|
76
|
-
public get IFluidHandle(): IFluidHandle {
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public constructor(
|
|
81
|
-
public readonly absolutePath,
|
|
82
|
-
public readonly runtime: IContainerRuntimeBase,
|
|
83
|
-
) {}
|
|
84
|
-
|
|
85
|
-
public attachGraph() {
|
|
86
|
-
assert(false, 0x0ca /* "Trying to use legacy graph attach!" */);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public async get(): Promise<any> {
|
|
90
|
-
const response = await this.runtime.IFluidHandleContext.resolveHandle({
|
|
91
|
-
url: this.absolutePath,
|
|
92
|
-
});
|
|
93
|
-
if (response.status === 200 && response.mimeType === "fluid/object") {
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
95
|
-
return response.value;
|
|
96
|
-
}
|
|
97
|
-
throw new Error(`Failed to resolve container path ${this.absolutePath}`);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
public bind(handle: IFluidHandle) {
|
|
101
|
-
throw new Error("Cannot bind to LegacyUriHandle");
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
107
|
-
* @internal
|
|
108
|
-
*/
|
|
109
|
-
export function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(
|
|
110
|
-
uri: string,
|
|
111
|
-
runtime: IContainerRuntimeBase,
|
|
112
|
-
): IFluidHandle<T> {
|
|
113
|
-
return new LegacyUriHandle<T>(uri, runtime);
|
|
114
|
-
}
|
|
@@ -12,11 +12,8 @@ import { RuntimeRequestHandler } from "./requestHandlers";
|
|
|
12
12
|
/**
|
|
13
13
|
* The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
|
|
14
14
|
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
15
|
-
*
|
|
16
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
17
|
-
* @internal
|
|
18
15
|
*/
|
|
19
|
-
|
|
16
|
+
class RuntimeRequestHandlerBuilder {
|
|
20
17
|
// eslint-disable-next-line import/no-deprecated
|
|
21
18
|
private readonly handlers: RuntimeRequestHandler[] = [];
|
|
22
19
|
|
|
@@ -40,7 +37,8 @@ export class RuntimeRequestHandlerBuilder {
|
|
|
40
37
|
}
|
|
41
38
|
|
|
42
39
|
/**
|
|
43
|
-
* @deprecated Will be removed
|
|
40
|
+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
41
|
+
*
|
|
44
42
|
* @internal
|
|
45
43
|
*/
|
|
46
44
|
// eslint-disable-next-line import/no-deprecated
|