44 lines
1.4 KiB
TypeScript
Raw Normal View History

export type Plane = 'accepts' | 'emits';
export interface MatrixUri {
scheme: 'matrix';
raw: string;
/** Optional principal (user identity before @). */
principal?: string;
/** Optional root. If absent, this is a local-only semantic address. */
root?: string;
/** @deprecated Use root instead */
realm?: string;
/** Mount segments (slash-delimited). */
mountSegments: string[];
/** Component path (dot-delimited). */
componentPath: string;
plane: Plane;
messageName: string;
/** Derived canonical path: <mount...>/<componentPath>.<plane>.<messageName> */
toPath: string;
/** Query parameters (not routing) */
query: Record<string, string>;
}
/**
* Parse a Matrix semantic URI.
*
* Accepts bare URIs (no scheme prefix):
*
* - Compact form:
* <root>/<mount...>/<componentPath>.<plane>.<messageName>
* <componentPath>.<plane>.<messageName> (no root; local)
* <principal>@<root>/<mount...>/<componentPath>.<plane>.<messageName>
*
* - Segmented MXURI/1:
* <root>/<mount...>/-/<component...>/<plane>/<message>
*
* Tab roots (leaf roots) are normalized:
* <homeRoot>/~tab/<tabId>/... => root = <homeRoot>.tab.<tabId>
*
* Query parameters:
* <root>/path.accepts.cmd?key=value
*
* Rejects URIs with non-matrix schemes (http://, ftp://, etc.).
*/
export declare function parseMatrixUri(uri: string): MatrixUri | null;
//# sourceMappingURL=uri.d.ts.map