Reference

@reckona/mreact-server/flight

51 public exports.

Function

FunctioncreateClientReferencefunction createClientReference(moduleId: string, exportName: string, chunks?: string[]): ClientReferenceCreates a runtime client reference marker for a module export.FunctioncreateFlightClientManifestfunction createFlightClientManifest(references: readonly FlightClientReferenceInput[], resolveChunks: (reference: FlightClientReferenceInput): string[]): FlightClientManifestEntry[]Builds a Flight client manifest from client references and chunk resolution.FunctioncreateServerActionHandlerfunction createServerActionHandler(actions: ServerActionRegistry, options: ServerActionHandlerOptions): (request: Request): Promise<Response>Creates a request handler that validates and invokes registered server actions.FunctioncreateServerReferencefunction createServerReference(moduleId: string, exportName: string, bound?: unknown[]): ServerReferenceCreates a runtime server reference marker for a module export.FunctionfromReactFlightRowsfunction fromReactFlightRows(rows: string): FlightResponseDecodes React Flight row text into a structured Flight response.FunctiongetReactFlightProtocolCoveragefunction getReactFlightProtocolCoverage(): ReactFlightProtocolCoverageReturns the React Flight protocol tags and tokens supported by this package.FunctionisClientReferencefunction isClientReference(value: unknown): value is ClientReferenceReturns true when a value is a runtime client reference marker.FunctionisServerReferencefunction isServerReference(value: unknown): value is ServerReferenceReturns true when a value is a runtime server reference marker.FunctionmergeReactFlightRowsfunction mergeReactFlightRows(response: FlightResponse, rows: string): FlightResponseMerges additional React Flight row text into an existing Flight response.FunctionrenderFlightPreloadLinksfunction renderFlightPreloadLinks(response: FlightResponse, options: { nonce?: string }): stringRenders modulepreload links for client chunks referenced by a Flight response.FunctionrenderFlightResponseScriptfunction renderFlightResponseScript(response: FlightResponse, options: FlightScriptOptions): stringRenders a Flight response as an HTML script tag.FunctionrenderToFlightResponsefunction renderToFlightResponse<P>(renderable: unknown, props: P): Promise<FlightResponse>Serializes a renderable value into a structured Flight response.FunctionstringifyFlightResponsefunction stringifyFlightResponse(response: FlightResponse): stringSerializes a Flight response to JSON text.FunctiontoReactFlightRowsfunction toReactFlightRows(response: FlightResponse): stringEncodes a structured Flight response into React Flight row text.

Interface

InterfaceClientReferenceinterface ClientReferenceRuntime marker object representing a client module export.InterfaceFlightArrayBufferModelinterface FlightArrayBufferModelSerialized ArrayBuffer value inside a Flight model.InterfaceFlightBigIntModelinterface FlightBigIntModelSerialized bigint value inside a Flight model.InterfaceFlightClientManifestEntryinterface FlightClientManifestEntryClient manifest entry with resolved module chunks.InterfaceFlightClientReferenceinterface FlightClientReferenceRegistered client reference included in a Flight response.InterfaceFlightClientReferenceInputinterface FlightClientReferenceInputInput used to register a client reference before assigning a Flight id.InterfaceFlightClientReferenceModelinterface FlightClientReferenceModelReference to a client module export inside a Flight model.InterfaceFlightDataViewModelinterface FlightDataViewModelSerialized DataView value inside a Flight model.InterfaceFlightDateModelinterface FlightDateModelSerialized Date value inside a Flight model.InterfaceFlightElementModelinterface FlightElementModelSerialized React-compatible element inside a Flight model.InterfaceFlightErrorModelinterface FlightErrorModelSerialized Error value inside a Flight model.InterfaceFlightFormDataModelinterface FlightFormDataModelSerialized FormData value inside a Flight model.InterfaceFlightIterableModelinterface FlightIterableModelSerialized iterable value inside a Flight model.InterfaceFlightMapModelinterface FlightMapModelSerialized Map value inside a Flight model.InterfaceFlightNumberModelinterface FlightNumberModelSerialized non-finite or negative-zero number inside a Flight model.InterfaceFlightObjectModelinterface FlightObjectModelPlain object shape inside a Flight model.InterfaceFlightPromiseModelinterface FlightPromiseModelReference to an outlined promise chunk inside a Flight model.InterfaceFlightResponseinterface FlightResponseSerializable Flight payload with root model and module references.InterfaceFlightScriptOptionsinterface FlightScriptOptionsOptions for embedding a serialized Flight response in a script tag.InterfaceFlightServerReferenceinterface FlightServerReferenceRegistered server reference included in a Flight response.InterfaceFlightServerReferenceModelinterface FlightServerReferenceModelReference to a server module export inside a Flight model.InterfaceFlightSetModelinterface FlightSetModelSerialized Set value inside a Flight model.InterfaceFlightSymbolModelinterface FlightSymbolModelSerialized global symbol reference inside a Flight model.InterfaceFlightTypedArrayModelinterface FlightTypedArrayModelSerialized typed array value inside a Flight model.InterfaceReactFlightProtocolCoverageinterface ReactFlightProtocolCoverageLists the React Flight row tags and model tokens covered by the serializer.InterfaceServerActionDescriptorinterface ServerActionDescriptorServer action entry with optional argument validation.InterfaceServerActionHandlerOptionsinterface ServerActionHandlerOptionsSecurity and validation options for createServerActionHandler.InterfaceServerActionReplayStoreinterface ServerActionReplayStoreStore used to reject replayed server action nonces.InterfaceServerActionRequestReferenceinterface ServerActionRequestReferenceModule export reference requested by a server action request.InterfaceServerReferenceinterface ServerReferenceRuntime marker object representing a server module export.

Type Alias

Type AliasFlightModeltype FlightModel = null | string | number | boolean | FlightModel[] | FlightObjectModel | FlightElementModel | FlightClientReferenceModel | FlightServerReferenceModel | FlightDateModel | FlightBigIntModel | FlightNumberModel | FlightSymbolModel | FlightMapModel | FlightSetModel | FlightFormDataModel | FlightIterableModel | FlightErrorModel | FlightPromiseModel | FlightArrayBufferModel | FlightTypedArrayModel | FlightDataViewModel | { kind: "undefined" }Recursive value model supported by the mreact Flight serializer.Type AliasFlightTypedArrayNametype FlightTypedArrayName = "Int8Array" | "Uint8Array" | "Uint8ClampedArray" | "Int16Array" | "Uint16Array" | "Int32Array" | "Uint32Array" | "Float32Array" | "Float64Array" | "BigInt64Array" | "BigUint64Array"Typed array constructor names supported by the Flight serializer.Type AliasServerActiontype ServerAction = (...args: unknown[]): unknown | Promise<unknown>Function that can be invoked through a server action request.Type AliasServerActionRegistrytype ServerActionRegistry = Record<string, ServerAction | ServerActionDescriptor>Registry mapping server action keys to handlers.Type AliasServerActionValidationResulttype ServerActionValidationResult = boolean | stringValidation result returned by server action guards.

Variable

VariableCLIENT_REFERENCE_TYPEconst CLIENT_REFERENCE_TYPE: typeof CLIENT_REFERENCE_TYPESymbol tag used to identify client references in serialized Flight values.VariableSERVER_REFERENCE_TYPEconst SERVER_REFERENCE_TYPE: typeof SERVER_REFERENCE_TYPESymbol tag used to identify server references in serialized Flight values.