Request parsing, response creation, and error handling utilities for data store interactions.
⚠️ Important: These APIs are only available through the legacy import path (@fluidframework/runtime-utils/legacy) and are marked as legacy/beta. They may change or be removed in future versions.
The RequestParser class is available only through the legacy API import.
/**
* Takes an IRequest and provides parsing and sub request creation capabilities
* Available via: @fluidframework/runtime-utils/legacy
*/
class RequestParser implements IRequest {
readonly url: string;
readonly headers?: IRequestHeader;
readonly query: string;
readonly pathParts: readonly string[];
static create(request: Readonly<IRequest>): RequestParser;
static getPathParts(url: string): readonly string[];
isLeaf(elements: number): boolean;
createSubRequest(startingPathIndex: number): IRequest;
protected constructor(request: Readonly<IRequest>);
}Only the create404Response function is available in the legacy API.
/**
* Creates a 404 "not found" response for the given request
* Available via: @fluidframework/runtime-utils/legacy
*/
const create404Response: (request: IRequest) => IResponse;Note: The following APIs are mentioned in the source code but are not exported and not available for external use:
createResponseError - Internal error response creationexceptionToResponse - Internal error conversionresponseToException - Internal response to error conversiongenerateHandleContextPath - Internal path generation utilityThese APIs are for internal framework use only and should not be relied upon by external applications.
Legacy API Usage Example:
import {
RequestParser,
create404Response
} from "@fluidframework/runtime-utils/legacy";
// Request parsing (Legacy API)
const parser = RequestParser.create({
url: "/datastore/component/action?param=value"
});
console.log(parser.pathParts); // ["datastore", "component", "action"]
console.log(parser.query); // "param=value"
if (parser.isLeaf(3)) {
// This is a terminal request
processLeafRequest(parser);
} else {
// Create sub-request for nested component
const subRequest = parser.createSubRequest(1);
forwardToComponent(subRequest);
}
// Response creation (Legacy API)
const notFoundResponse = create404Response(parser);If you're using data store operation utilities:
RequestParser from the legacy import, but be aware it may changecreate404Response is available, other response utilities are internalThe limited API surface suggests that most data store operations should be handled through other Fluid Framework packages rather than directly using runtime-utils.
⚠️ Deprecation Warning: These legacy APIs may be removed in future versions. Consider migrating to alternative Fluid Framework APIs when possible.