/** * Percent-encode everything that isn't safe to have in a path without encoding safe chars. * * Taken from https://datatracker.ietf.org/doc/html/rfc3986#section-3.3: * > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" * > sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" * > pchar = unreserved / pct-encoded / sub-delims / ":" / "@" */ export declare function encodeURIPath(str: string): string; /** * Like {@link encodeURIPath} but leaves `/` unescaped, implementing RFC 6570 reserved expansion * (`{+var}`) for path-like parameters such as a file path. The slash is part of the route shape for * these params — `docs/example.txt` must stay nested under `.../files/docs/example.txt` rather than * collapsing to a single `docs%2Fexample.txt` segment that points at a different backend path. Each * `/`-separated segment is still run through {@link encodeURIPath}, so every other unsafe character is * percent-encoded with the exact same rules, and the tag function below still rejects `.`/`..` segments, * so a reserved value cannot smuggle in path traversal. */ export declare function encodeURIPathReserved(str: string): string; /** * Wrapper marking a path-parameter value for reserved expansion. The {@link createPathTagFunction} tag * detects this instance and encodes its value with {@link encodeURIPathReserved} (slash-preserving) * instead of the default per-segment encoder, while leaving all other interpolated params untouched. */ declare class ReservedPathParam { readonly value: string; constructor(value: string); toString(): string; } /** * Marks a value so the `path` tag preserves `/` when encoding it (RFC 6570 reserved expansion). Used by * generated request paths for parameters the spec flags with `allowReserved` (e.g. file paths). */ export declare const reserved: (value: unknown) => ReservedPathParam; export declare const createPathTagFunction: (pathEncoder?: typeof encodeURIPath) => (statics: readonly string[], ...params: readonly unknown[]) => string; /** * URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced. */ export declare const path: (statics: readonly string[], ...params: readonly unknown[]) => string; export {}; //# sourceMappingURL=path.d.ts.map