@fluidframework/request-handler 2.0.0-internal.7.0.0 → 2.0.0-internal.7.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.
- package/CHANGELOG.md +4 -0
- package/api-extractor.json +1 -1
- package/api-report/request-handler.api.md +45 -0
- package/dist/request-handler-alpha.d.ts +71 -0
- package/dist/request-handler-beta.d.ts +71 -0
- package/dist/request-handler-public.d.ts +71 -0
- package/dist/request-handler.d.ts +71 -0
- package/dist/requestHandlers.d.ts +14 -2
- package/dist/requestHandlers.d.ts.map +1 -1
- package/dist/requestHandlers.js +12 -2
- package/dist/requestHandlers.js.map +1 -1
- package/dist/runtimeRequestHandlerBuilder.d.ts +8 -1
- package/dist/runtimeRequestHandlerBuilder.d.ts.map +1 -1
- package/dist/runtimeRequestHandlerBuilder.js +8 -1
- package/dist/runtimeRequestHandlerBuilder.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/requestHandlers.d.ts +14 -2
- package/lib/requestHandlers.d.ts.map +1 -1
- package/lib/requestHandlers.js +12 -2
- package/lib/requestHandlers.js.map +1 -1
- package/lib/runtimeRequestHandlerBuilder.d.ts +8 -1
- package/lib/runtimeRequestHandlerBuilder.d.ts.map +1 -1
- package/lib/runtimeRequestHandlerBuilder.js +8 -1
- package/lib/runtimeRequestHandlerBuilder.js.map +1 -1
- package/package.json +17 -17
- package/src/requestHandlers.ts +14 -2
- package/src/runtimeRequestHandlerBuilder.ts +8 -1
package/CHANGELOG.md
CHANGED
package/api-extractor.json
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
## API Report File for "@fluidframework/request-handler"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
8
|
+
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
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
13
|
+
import { IResponse } from '@fluidframework/core-interfaces';
|
|
14
|
+
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
15
|
+
|
|
16
|
+
// @public @deprecated (undocumented)
|
|
17
|
+
export function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
18
|
+
|
|
19
|
+
// @public @deprecated (undocumented)
|
|
20
|
+
export const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
21
|
+
status: 200;
|
|
22
|
+
mimeType: "fluid/object";
|
|
23
|
+
value: FluidObject;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// @public @deprecated (undocumented)
|
|
27
|
+
export function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
28
|
+
|
|
29
|
+
// @public @deprecated
|
|
30
|
+
export const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
31
|
+
|
|
32
|
+
// @public @deprecated
|
|
33
|
+
export type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
34
|
+
|
|
35
|
+
// @public @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
|
+
// (No @packageDocumentation comment for this package)
|
|
44
|
+
|
|
45
|
+
```
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
|
+
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
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { IResponse } from '@fluidframework/core-interfaces';
|
|
8
|
+
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
23
|
+
status: 200;
|
|
24
|
+
mimeType: "fluid/object";
|
|
25
|
+
value: FluidObject;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A request handler to expose access to all root data stores in the container by id.
|
|
37
|
+
* @param request - the request for the root data store. The first path part must be the data store's ID.
|
|
38
|
+
* @param runtime - the container runtime
|
|
39
|
+
* @returns the result of the request
|
|
40
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export declare const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
48
|
+
* if it does not apply. These handlers are called in series, so there may be other handlers before or after.
|
|
49
|
+
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
50
|
+
* the route, or fulling the specific request.
|
|
51
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
|
|
59
|
+
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
60
|
+
*
|
|
61
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
export declare class RuntimeRequestHandlerBuilder {
|
|
66
|
+
private readonly handlers;
|
|
67
|
+
pushHandler(...handlers: RuntimeRequestHandler[]): void;
|
|
68
|
+
handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { }
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
|
+
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
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { IResponse } from '@fluidframework/core-interfaces';
|
|
8
|
+
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
23
|
+
status: 200;
|
|
24
|
+
mimeType: "fluid/object";
|
|
25
|
+
value: FluidObject;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A request handler to expose access to all root data stores in the container by id.
|
|
37
|
+
* @param request - the request for the root data store. The first path part must be the data store's ID.
|
|
38
|
+
* @param runtime - the container runtime
|
|
39
|
+
* @returns the result of the request
|
|
40
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export declare const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
48
|
+
* if it does not apply. These handlers are called in series, so there may be other handlers before or after.
|
|
49
|
+
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
50
|
+
* the route, or fulling the specific request.
|
|
51
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
|
|
59
|
+
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
60
|
+
*
|
|
61
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
export declare class RuntimeRequestHandlerBuilder {
|
|
66
|
+
private readonly handlers;
|
|
67
|
+
pushHandler(...handlers: RuntimeRequestHandler[]): void;
|
|
68
|
+
handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { }
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
|
+
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
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { IResponse } from '@fluidframework/core-interfaces';
|
|
8
|
+
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
23
|
+
status: 200;
|
|
24
|
+
mimeType: "fluid/object";
|
|
25
|
+
value: FluidObject;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A request handler to expose access to all root data stores in the container by id.
|
|
37
|
+
* @param request - the request for the root data store. The first path part must be the data store's ID.
|
|
38
|
+
* @param runtime - the container runtime
|
|
39
|
+
* @returns the result of the request
|
|
40
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export declare const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
48
|
+
* if it does not apply. These handlers are called in series, so there may be other handlers before or after.
|
|
49
|
+
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
50
|
+
* the route, or fulling the specific request.
|
|
51
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
|
|
59
|
+
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
60
|
+
*
|
|
61
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
export declare class RuntimeRequestHandlerBuilder {
|
|
66
|
+
private readonly handlers;
|
|
67
|
+
pushHandler(...handlers: RuntimeRequestHandler[]): void;
|
|
68
|
+
handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { }
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
|
+
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
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { IResponse } from '@fluidframework/core-interfaces';
|
|
8
|
+
import { RequestParser } from '@fluidframework/runtime-utils';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
23
|
+
status: 200;
|
|
24
|
+
mimeType: "fluid/object";
|
|
25
|
+
value: FluidObject;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A request handler to expose access to all root data stores in the container by id.
|
|
37
|
+
* @param request - the request for the root data store. The first path part must be the data store's ID.
|
|
38
|
+
* @param runtime - the container runtime
|
|
39
|
+
* @returns the result of the request
|
|
40
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export declare const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A request handler for the container runtime. Each handler should handle a specific request, and return undefined
|
|
48
|
+
* if it does not apply. These handlers are called in series, so there may be other handlers before or after.
|
|
49
|
+
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
50
|
+
* the route, or fulling the specific request.
|
|
51
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
|
|
59
|
+
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
60
|
+
*
|
|
61
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
export declare class RuntimeRequestHandlerBuilder {
|
|
66
|
+
private readonly handlers;
|
|
67
|
+
pushHandler(...handlers: RuntimeRequestHandler[]): void;
|
|
68
|
+
handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { }
|
|
@@ -12,6 +12,8 @@ import { RequestParser } from "@fluidframework/runtime-utils";
|
|
|
12
12
|
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
13
13
|
* the route, or fulling the specific request.
|
|
14
14
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
15
17
|
*/
|
|
16
18
|
export type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
17
19
|
/**
|
|
@@ -20,14 +22,24 @@ export type RuntimeRequestHandler = (request: RequestParser, runtime: IContainer
|
|
|
20
22
|
* @param runtime - the container runtime
|
|
21
23
|
* @returns the result of the request
|
|
22
24
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
23
27
|
*/
|
|
24
28
|
export declare const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
25
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
26
34
|
export declare const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
27
35
|
status: 200;
|
|
28
36
|
mimeType: "fluid/object";
|
|
29
37
|
value: FluidObject;
|
|
30
38
|
};
|
|
31
|
-
/**
|
|
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
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
32
44
|
export declare function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
33
45
|
//# sourceMappingURL=requestHandlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,EAGX,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
|
|
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,EAGX,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;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,CACnC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,iBAAiB,KACtB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;AAEpC;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,YAC9B,QAAQ,WACR,iBAAiB,mCAkB1B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,gBACxB,WAAW,KACtB;IAAE,QAAQ,GAAG,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAE7D,CAAC;AAkCF;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,WAAW,GAAG,cAAc,EACnE,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,GAC5B,YAAY,CAAC,CAAC,CAAC,CAEjB"}
|
package/dist/requestHandlers.js
CHANGED
|
@@ -13,6 +13,8 @@ const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
|
13
13
|
* @param runtime - the container runtime
|
|
14
14
|
* @returns the result of the request
|
|
15
15
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
16
18
|
*/
|
|
17
19
|
const rootDataStoreRequestHandler = async (request, runtime) => {
|
|
18
20
|
const requestParser = runtime_utils_1.RequestParser.create(request);
|
|
@@ -35,7 +37,11 @@ const rootDataStoreRequestHandler = async (request, runtime) => {
|
|
|
35
37
|
}
|
|
36
38
|
};
|
|
37
39
|
exports.rootDataStoreRequestHandler = rootDataStoreRequestHandler;
|
|
38
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
39
45
|
const createFluidObjectResponse = (fluidObject) => {
|
|
40
46
|
return { status: 200, mimeType: "fluid/object", value: fluidObject };
|
|
41
47
|
};
|
|
@@ -66,7 +72,11 @@ class LegacyUriHandle {
|
|
|
66
72
|
throw new Error("Cannot bind to LegacyUriHandle");
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
|
-
/**
|
|
75
|
+
/**
|
|
76
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
70
80
|
function handleFromLegacyUri(uri, runtime) {
|
|
71
81
|
return new LegacyUriHandle(uri, runtime);
|
|
72
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAYpD,iEAA8D;
|
|
1
|
+
{"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAYpD,iEAA8D;AAgB9D;;;;;;;;GAQG;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,OAAO,CAAC,OAAO,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3F,gDAAgD;IAChD,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,MAAM,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;KACnF;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;AApBW,QAAA,2BAA2B,+BAoBtC;AAEF;;;;GAIG;AACI,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;IAGpB,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YACiB,YAAY,EACZ,OAA8B;QAD9B,iBAAY,GAAZ,YAAY,CAAA;QACZ,YAAO,GAAP,OAAO,CAAuB;QAR/B,eAAU,GAAG,IAAI,CAAC;IAS/B,CAAC;IAEG,WAAW;QACjB,IAAA,mBAAM,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;;;;GAIG;AACH,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/core-utils\";\nimport {\n\tIResponse,\n\tIRequest,\n\tIFluidHandle,\n\tIFluidLoadable,\n\tFluidObject,\n\t// eslint-disable-next-line import/no-deprecated\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 * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @public\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 * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @public\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\t// eslint-disable-next-line import/no-deprecated\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 await rootDataStore.IFluidRouter.request(requestParser.createSubRequest(1));\n\t} catch (error) {\n\t\treturn { status: 500, mimeType: \"fluid/object\", value: error };\n\t}\n};\n\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @public\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\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @public\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"]}
|
|
@@ -8,13 +8,20 @@ import { RuntimeRequestHandler } from "./requestHandlers";
|
|
|
8
8
|
/**
|
|
9
9
|
* The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
|
|
10
10
|
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
11
|
+
*
|
|
11
12
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
12
15
|
*/
|
|
13
16
|
export declare class RuntimeRequestHandlerBuilder {
|
|
14
17
|
private readonly handlers;
|
|
15
18
|
pushHandler(...handlers: RuntimeRequestHandler[]): void;
|
|
16
19
|
handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse>;
|
|
17
20
|
}
|
|
18
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
19
26
|
export declare function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
20
27
|
//# sourceMappingURL=runtimeRequestHandlerBuilder.d.ts.map
|
|
@@ -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;AAE1D
|
|
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;AAE1D;;;;;;;GAOG;AACH,qBAAa,4BAA4B;IAExC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+B;IAGjD,WAAW,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE;IAM1C,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;CAU7F;AAED;;;;GAIG;AAEH,wBAAgB,0BAA0B,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE,aAGvD,QAAQ,WAAW,iBAAiB,wBAE3D"}
|
|
@@ -9,7 +9,10 @@ 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
|
+
*
|
|
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
|
+
*
|
|
15
|
+
* @public
|
|
13
16
|
*/
|
|
14
17
|
class RuntimeRequestHandlerBuilder {
|
|
15
18
|
constructor() {
|
|
@@ -34,7 +37,11 @@ class RuntimeRequestHandlerBuilder {
|
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
exports.RuntimeRequestHandlerBuilder = RuntimeRequestHandlerBuilder;
|
|
37
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
38
45
|
// eslint-disable-next-line import/no-deprecated
|
|
39
46
|
function buildRuntimeRequestHandler(...handlers) {
|
|
40
47
|
const builder = new RuntimeRequestHandlerBuilder();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeRequestHandlerBuilder.js","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,iEAAiF;AAIjF
|
|
1
|
+
{"version":3,"file":"runtimeRequestHandlerBuilder.js","sourceRoot":"","sources":["../src/runtimeRequestHandlerBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,iEAAiF;AAIjF;;;;;;;GAOG;AACH,MAAa,4BAA4B;IAAzC;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;AArBD,oEAqBC;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 *\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @public\n */\nexport class 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 in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @public\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/dist/tsdoc-metadata.json
CHANGED
package/lib/requestHandlers.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ import { RequestParser } from "@fluidframework/runtime-utils";
|
|
|
12
12
|
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
13
13
|
* the route, or fulling the specific request.
|
|
14
14
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
15
17
|
*/
|
|
16
18
|
export type RuntimeRequestHandler = (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
17
19
|
/**
|
|
@@ -20,14 +22,24 @@ export type RuntimeRequestHandler = (request: RequestParser, runtime: IContainer
|
|
|
20
22
|
* @param runtime - the container runtime
|
|
21
23
|
* @returns the result of the request
|
|
22
24
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
23
27
|
*/
|
|
24
28
|
export declare const rootDataStoreRequestHandler: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
|
|
25
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
26
34
|
export declare const createFluidObjectResponse: (fluidObject: FluidObject) => {
|
|
27
35
|
status: 200;
|
|
28
36
|
mimeType: "fluid/object";
|
|
29
37
|
value: FluidObject;
|
|
30
38
|
};
|
|
31
|
-
/**
|
|
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
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
32
44
|
export declare function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(uri: string, runtime: IContainerRuntimeBase): IFluidHandle<T>;
|
|
33
45
|
//# sourceMappingURL=requestHandlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,EAGX,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
|
|
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,EAGX,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;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,CACnC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,iBAAiB,KACtB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;AAEpC;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,YAC9B,QAAQ,WACR,iBAAiB,mCAkB1B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,gBACxB,WAAW,KACtB;IAAE,QAAQ,GAAG,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAE7D,CAAC;AAkCF;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,WAAW,GAAG,cAAc,EACnE,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,GAC5B,YAAY,CAAC,CAAC,CAAC,CAEjB"}
|
package/lib/requestHandlers.js
CHANGED
|
@@ -10,6 +10,8 @@ import { RequestParser } from "@fluidframework/runtime-utils";
|
|
|
10
10
|
* @param runtime - the container runtime
|
|
11
11
|
* @returns the result of the request
|
|
12
12
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
13
15
|
*/
|
|
14
16
|
export const rootDataStoreRequestHandler = async (request, runtime) => {
|
|
15
17
|
const requestParser = RequestParser.create(request);
|
|
@@ -31,7 +33,11 @@ export const rootDataStoreRequestHandler = async (request, runtime) => {
|
|
|
31
33
|
return { status: 500, mimeType: "fluid/object", value: error };
|
|
32
34
|
}
|
|
33
35
|
};
|
|
34
|
-
/**
|
|
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
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
35
41
|
export const createFluidObjectResponse = (fluidObject) => {
|
|
36
42
|
return { status: 200, mimeType: "fluid/object", value: fluidObject };
|
|
37
43
|
};
|
|
@@ -61,7 +67,11 @@ class LegacyUriHandle {
|
|
|
61
67
|
throw new Error("Cannot bind to LegacyUriHandle");
|
|
62
68
|
}
|
|
63
69
|
}
|
|
64
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
72
|
+
*
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
65
75
|
export function handleFromLegacyUri(uri, runtime) {
|
|
66
76
|
return new LegacyUriHandle(uri, runtime);
|
|
67
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAYpD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"requestHandlers.js","sourceRoot":"","sources":["../src/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAYpD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAgB9D;;;;;;;;GAQG;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,OAAO,CAAC,OAAO,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3F,gDAAgD;IAChD,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,MAAM,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;KACnF;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;;;;GAIG;AACH,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;IAGpB,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YACiB,YAAY,EACZ,OAA8B;QAD9B,iBAAY,GAAZ,YAAY,CAAA;QACZ,YAAO,GAAP,OAAO,CAAuB;QAR/B,eAAU,GAAG,IAAI,CAAC;IAS/B,CAAC;IAEG,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;;;;GAIG;AACH,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/core-utils\";\nimport {\n\tIResponse,\n\tIRequest,\n\tIFluidHandle,\n\tIFluidLoadable,\n\tFluidObject,\n\t// eslint-disable-next-line import/no-deprecated\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 * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @public\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 * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @public\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\t// eslint-disable-next-line import/no-deprecated\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 await rootDataStore.IFluidRouter.request(requestParser.createSubRequest(1));\n\t} catch (error) {\n\t\treturn { status: 500, mimeType: \"fluid/object\", value: error };\n\t}\n};\n\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @public\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\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @public\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"]}
|
|
@@ -8,13 +8,20 @@ import { RuntimeRequestHandler } from "./requestHandlers";
|
|
|
8
8
|
/**
|
|
9
9
|
* The RuntimeRequestHandlerBuilder creates a runtime request handler based on request handlers.
|
|
10
10
|
* The provided handlers sequentially applied until one is able to satisfy the request.
|
|
11
|
+
*
|
|
11
12
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
12
15
|
*/
|
|
13
16
|
export declare class RuntimeRequestHandlerBuilder {
|
|
14
17
|
private readonly handlers;
|
|
15
18
|
pushHandler(...handlers: RuntimeRequestHandler[]): void;
|
|
16
19
|
handleRequest(request: IRequest, runtime: IContainerRuntime): Promise<IResponse>;
|
|
17
20
|
}
|
|
18
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
19
26
|
export declare function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]): (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
20
27
|
//# sourceMappingURL=runtimeRequestHandlerBuilder.d.ts.map
|
|
@@ -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;AAE1D
|
|
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;AAE1D;;;;;;;GAOG;AACH,qBAAa,4BAA4B;IAExC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+B;IAGjD,WAAW,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE;IAM1C,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;CAU7F;AAED;;;;GAIG;AAEH,wBAAgB,0BAA0B,CAAC,GAAG,QAAQ,EAAE,qBAAqB,EAAE,aAGvD,QAAQ,WAAW,iBAAiB,wBAE3D"}
|
|
@@ -6,7 +6,10 @@ 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
|
+
*
|
|
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
|
+
*
|
|
12
|
+
* @public
|
|
10
13
|
*/
|
|
11
14
|
export class RuntimeRequestHandlerBuilder {
|
|
12
15
|
constructor() {
|
|
@@ -30,7 +33,11 @@ export class RuntimeRequestHandlerBuilder {
|
|
|
30
33
|
return create404Response(request);
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
|
-
/**
|
|
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
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
34
41
|
// eslint-disable-next-line import/no-deprecated
|
|
35
42
|
export function buildRuntimeRequestHandler(...handlers) {
|
|
36
43
|
const builder = new RuntimeRequestHandlerBuilder();
|
|
@@ -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;AAIjF
|
|
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;AAIjF;;;;;;;GAOG;AACH,MAAM,OAAO,4BAA4B;IAAzC;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 *\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @public\n */\nexport class 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 in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n *\n * @public\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.7.
|
|
3
|
+
"version": "2.0.0-internal.7.1.0",
|
|
4
4
|
"description": "A simple request handling library for Fluid Framework",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,20 +35,20 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluidframework/container-runtime-definitions": ">=2.0.0-internal.7.
|
|
39
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.
|
|
40
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.7.
|
|
41
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-internal.7.
|
|
42
|
-
"@fluidframework/runtime-utils": ">=2.0.0-internal.7.
|
|
38
|
+
"@fluidframework/container-runtime-definitions": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
39
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
40
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
41
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
42
|
+
"@fluidframework/runtime-utils": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@fluid-tools/build-cli": "^0.
|
|
46
|
-
"@fluidframework/build-common": "^2.0.
|
|
47
|
-
"@fluidframework/build-tools": "^0.
|
|
48
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
49
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.
|
|
50
|
-
"@fluidframework/request-handler-previous": "npm:@fluidframework/request-handler@2.0.0-internal.
|
|
51
|
-
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.7.
|
|
45
|
+
"@fluid-tools/build-cli": "^0.25.0",
|
|
46
|
+
"@fluidframework/build-common": "^2.0.1",
|
|
47
|
+
"@fluidframework/build-tools": "^0.25.0",
|
|
48
|
+
"@fluidframework/eslint-config-fluid": "^3.0.0",
|
|
49
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
50
|
+
"@fluidframework/request-handler-previous": "npm:@fluidframework/request-handler@2.0.0-internal.7.0.0",
|
|
51
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
52
52
|
"@microsoft/api-extractor": "^7.37.0",
|
|
53
53
|
"@types/diff": "^3.5.1",
|
|
54
54
|
"@types/mocha": "^9.1.1",
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"copyfiles": "^2.4.1",
|
|
58
58
|
"cross-env": "^7.0.3",
|
|
59
59
|
"diff": "^3.5.0",
|
|
60
|
-
"eslint": "~8.
|
|
60
|
+
"eslint": "~8.50.0",
|
|
61
61
|
"mocha": "^10.2.0",
|
|
62
62
|
"mocha-json-output-reporter": "^2.0.1",
|
|
63
63
|
"mocha-multi-reporters": "^1.5.1",
|
|
64
64
|
"moment": "^2.21.0",
|
|
65
|
-
"prettier": "~
|
|
65
|
+
"prettier": "~3.0.3",
|
|
66
66
|
"rimraf": "^4.4.0",
|
|
67
67
|
"typescript": "~5.1.6"
|
|
68
68
|
},
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"build": "fluid-build . --task build",
|
|
74
74
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
75
75
|
"build:compile": "fluid-build . --task compile",
|
|
76
|
-
"build:docs": "api-extractor run --local
|
|
76
|
+
"build:docs": "api-extractor run --local",
|
|
77
77
|
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
78
78
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
79
|
-
"ci:build:docs": "api-extractor run
|
|
79
|
+
"ci:build:docs": "api-extractor run",
|
|
80
80
|
"clean": "rimraf --glob 'dist' 'lib' '*.tsbuildinfo' '*.build.log' '_api-extractor-temp' 'nyc'",
|
|
81
81
|
"eslint": "eslint --format stylish src",
|
|
82
82
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
package/src/requestHandlers.ts
CHANGED
|
@@ -23,6 +23,8 @@ import { RequestParser } from "@fluidframework/runtime-utils";
|
|
|
23
23
|
* A handler should only return error if the request is for a route the handler owns, and there is a problem with
|
|
24
24
|
* the route, or fulling the specific request.
|
|
25
25
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
26
28
|
*/
|
|
27
29
|
export type RuntimeRequestHandler = (
|
|
28
30
|
request: RequestParser,
|
|
@@ -35,6 +37,8 @@ export type RuntimeRequestHandler = (
|
|
|
35
37
|
* @param runtime - the container runtime
|
|
36
38
|
* @returns the result of the request
|
|
37
39
|
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
38
42
|
*/
|
|
39
43
|
export const rootDataStoreRequestHandler = async (
|
|
40
44
|
request: IRequest,
|
|
@@ -58,7 +62,11 @@ export const rootDataStoreRequestHandler = async (
|
|
|
58
62
|
}
|
|
59
63
|
};
|
|
60
64
|
|
|
61
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
67
|
+
*
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
62
70
|
export const createFluidObjectResponse = (
|
|
63
71
|
fluidObject: FluidObject,
|
|
64
72
|
): { status: 200; mimeType: "fluid/object"; value: FluidObject } => {
|
|
@@ -97,7 +105,11 @@ class LegacyUriHandle<T = FluidObject & IFluidLoadable> implements IFluidHandle<
|
|
|
97
105
|
}
|
|
98
106
|
}
|
|
99
107
|
|
|
100
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
110
|
+
*
|
|
111
|
+
* @public
|
|
112
|
+
*/
|
|
101
113
|
export function handleFromLegacyUri<T = FluidObject & IFluidLoadable>(
|
|
102
114
|
uri: string,
|
|
103
115
|
runtime: IContainerRuntimeBase,
|
|
@@ -12,7 +12,10 @@ 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
|
+
*
|
|
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
|
+
*
|
|
18
|
+
* @public
|
|
16
19
|
*/
|
|
17
20
|
export class RuntimeRequestHandlerBuilder {
|
|
18
21
|
// eslint-disable-next-line import/no-deprecated
|
|
@@ -37,7 +40,11 @@ export class RuntimeRequestHandlerBuilder {
|
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
|
|
40
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
41
48
|
// eslint-disable-next-line import/no-deprecated
|
|
42
49
|
export function buildRuntimeRequestHandler(...handlers: RuntimeRequestHandler[]) {
|
|
43
50
|
const builder = new RuntimeRequestHandlerBuilder();
|