paramour 0.5.1 → 0.7.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/dist/codec.d.ts +16 -18
- package/dist/describe.d.ts +14 -3
- package/dist/describe.js +20 -3
- package/dist/errors.d.ts +89 -10
- package/dist/errors.js +79 -13
- package/dist/href.d.ts +38 -41
- package/dist/href.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/internal.d.ts +4 -3
- package/dist/internal.js +4 -3
- package/dist/p.d.ts +11 -10
- package/dist/p.js +45 -37
- package/dist/path.d.ts +26 -26
- package/dist/path.js +78 -42
- package/dist/route.d.ts +73 -73
- package/dist/route.js +30 -30
- package/dist/safe-decode.d.ts +10 -9
- package/dist/safe-decode.js +12 -11
- package/dist/schema.d.ts +4 -4
- package/dist/schema.js +4 -4
- package/dist/search.d.ts +32 -28
- package/dist/search.js +76 -42
- package/dist/standard-schema.d.ts +15 -15
- package/dist/standard-schema.js +15 -15
- package/package.json +1 -1
package/dist/p.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
2
|
import { type Codec } from "./codec.js";
|
|
3
3
|
/**
|
|
4
|
-
* The `p.*` wire-codec builders
|
|
5
|
-
*
|
|
4
|
+
* The `p.*` wire-codec builders. Each codec defines how one value
|
|
5
|
+
* crosses the URL boundary, in both directions.
|
|
6
6
|
*/
|
|
7
7
|
export declare const p: {
|
|
8
8
|
/**
|
|
9
|
-
* A repeated-key list (`?tags=a&tags=b`,
|
|
9
|
+
* A repeated-key list (`?tags=a&tags=b`, PP1): arity "many", so
|
|
10
10
|
* presence modifiers are unavailable — absent and `[]` are the same wire
|
|
11
11
|
* state (S6/P6) — unlike `p.csv`'s one-key packing (CV7). Elements are
|
|
12
12
|
* strings unless an element codec is given.
|
|
@@ -14,7 +14,7 @@ export declare const p: {
|
|
|
14
14
|
array<E = string>(element?: Codec<E>): Codec<E[], "required", false, "many">;
|
|
15
15
|
boolean(): Codec<boolean>;
|
|
16
16
|
/**
|
|
17
|
-
* A comma-separated scalar list in ONE wire value (
|
|
17
|
+
* A comma-separated scalar list in ONE wire value (CV1): arity
|
|
18
18
|
* "single", so the full modifier set applies — unlike `p.array`'s
|
|
19
19
|
* repeated-key format (CV7: both are first-class; csv is the one-key
|
|
20
20
|
* packing). Elements are strings unless an element codec is given.
|
|
@@ -29,13 +29,14 @@ export declare const p: {
|
|
|
29
29
|
enum<const M extends readonly [string, ...string[]]>(members: M): Codec<M[number]>;
|
|
30
30
|
/**
|
|
31
31
|
* A 1-based-on-wire / 0-based-in-memory integer for pagination-style
|
|
32
|
-
* params (`?page=1` ↔ index 0,
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
32
|
+
* params (`?page=1` ↔ index 0, PP5). Deliberately stricter than nuqs's
|
|
33
|
+
* `parseAsIndex`, whose below-floor behavior is unspecified: wire values
|
|
34
|
+
* below 1 are a ParseError (recoverable via `.catch()`, like any other
|
|
35
|
+
* malformed input), and a negative in-memory index — which cannot
|
|
36
36
|
* round-trip through the 1-based wire floor — is a SerializeError at
|
|
37
|
-
* link-build time
|
|
38
|
-
* in-memory (0-based)
|
|
37
|
+
* link-build time, failing where the link is written rather than on the
|
|
38
|
+
* next navigation. The optional schema validates the in-memory (0-based)
|
|
39
|
+
* value on both sides.
|
|
39
40
|
*/
|
|
40
41
|
index<S extends StandardSchemaV1<number, number>>(schema?: S): Codec<S extends undefined ? number : StandardSchemaV1.InferOutput<S>>;
|
|
41
42
|
integer<S extends StandardSchemaV1<number, number>>(schema?: S): Codec<S extends undefined ? number : StandardSchemaV1.InferOutput<S>>;
|
package/dist/p.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createCodec } from "./codec.js";
|
|
2
|
-
import { foreignMessage, ParamourError, ParseError, rebrandForeign, SerializeError, showValue, } from "./errors.js";
|
|
2
|
+
import { foreignMessage, grammarParseError, ParamourError, ParseError, rebrandForeign, SerializeError, showValue, } from "./errors.js";
|
|
3
3
|
import { runStandardSchemaSync } from "./schema.js";
|
|
4
|
-
// Wire grammars
|
|
4
|
+
// Wire grammars for the scalar kinds. `Number()` alone is too loose
|
|
5
5
|
// (accepts hex, trims whitespace), hence explicit anchored patterns.
|
|
6
6
|
const INTEGER_RE = /^-?\d+$/;
|
|
7
7
|
const NUMBER_RE = /^-?\d+(\.\d+)?([eE][+-]?\d+)?$/;
|
|
@@ -12,8 +12,8 @@ const TIMESTAMP_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?Z$/;
|
|
|
12
12
|
/**
|
|
13
13
|
* Serialize-side Date guard. Years outside 0000–9999 are rejected:
|
|
14
14
|
* toISOString switches to the expanded ±6-digit-year form there, which the
|
|
15
|
-
* wire grammars
|
|
16
|
-
*
|
|
15
|
+
* wire grammars cannot represent — better a loud SerializeError than a URL
|
|
16
|
+
* that can never round-trip.
|
|
17
17
|
*/
|
|
18
18
|
function expectSerializableDate(value) {
|
|
19
19
|
if (!(value instanceof Date) || Number.isNaN(value.getTime())) {
|
|
@@ -33,27 +33,30 @@ function joinIssues(issues) {
|
|
|
33
33
|
}
|
|
34
34
|
function parseIntegerElement(raw) {
|
|
35
35
|
if (!INTEGER_RE.test(raw)) {
|
|
36
|
-
throw
|
|
36
|
+
throw grammarParseError(`"${raw}" is not an integer`);
|
|
37
37
|
}
|
|
38
38
|
const value = Number(raw);
|
|
39
39
|
if (!Number.isSafeInteger(value)) {
|
|
40
|
-
throw
|
|
40
|
+
throw grammarParseError(`"${raw}" is outside the safe integer range`);
|
|
41
41
|
}
|
|
42
42
|
return value;
|
|
43
43
|
}
|
|
44
44
|
function parseNumberElement(raw) {
|
|
45
45
|
if (!NUMBER_RE.test(raw)) {
|
|
46
|
-
throw
|
|
46
|
+
throw grammarParseError(`"${raw}" is not a number`);
|
|
47
47
|
}
|
|
48
48
|
const value = Number(raw);
|
|
49
49
|
if (!Number.isFinite(value)) {
|
|
50
|
-
throw
|
|
50
|
+
throw grammarParseError(`"${raw}" is not a finite number`);
|
|
51
51
|
}
|
|
52
52
|
return value;
|
|
53
53
|
}
|
|
54
54
|
function refine(schema, value) {
|
|
55
55
|
const result = runStandardSchemaSync(schema, value);
|
|
56
56
|
if (result.issues) {
|
|
57
|
+
// Plain ParseError, NOT grammarParseError: the joined issue prose comes
|
|
58
|
+
// from the user's validator and is not guaranteed to quote the value or
|
|
59
|
+
// name the grammar, so renderers must add that context themselves.
|
|
57
60
|
throw new ParseError(`Schema validation failed: ${joinIssues(result.issues)}`);
|
|
58
61
|
}
|
|
59
62
|
return result.value;
|
|
@@ -76,9 +79,10 @@ function refineForSerialize(schema, value) {
|
|
|
76
79
|
/**
|
|
77
80
|
* Shared element admission for `p.array`/`p.csv` (PP1/CV2): resolves the
|
|
78
81
|
* no-arg default and mirrors the type-state exclusions — presence, catch,
|
|
79
|
-
* and arity-many inners — for JS consumers
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
+
* and arity-many inners — for JS consumers, who get the same fail-fast
|
|
83
|
+
* rejection at definition time that the type layer gives TS callers. Only
|
|
84
|
+
* the element's parse/serialize functions are captured by the list builders,
|
|
85
|
+
* so an accepted modifier would be silently dropped, not applied; one guard
|
|
82
86
|
* keeps that runtime mirror of the type-state in a single place.
|
|
83
87
|
*/
|
|
84
88
|
function resolveListElement(element, builder) {
|
|
@@ -127,12 +131,12 @@ function stringifyJson(value) {
|
|
|
127
131
|
*/
|
|
128
132
|
let defaultListElement;
|
|
129
133
|
/**
|
|
130
|
-
* The `p.*` wire-codec builders
|
|
131
|
-
*
|
|
134
|
+
* The `p.*` wire-codec builders. Each codec defines how one value
|
|
135
|
+
* crosses the URL boundary, in both directions.
|
|
132
136
|
*/
|
|
133
137
|
export const p = {
|
|
134
138
|
/**
|
|
135
|
-
* A repeated-key list (`?tags=a&tags=b`,
|
|
139
|
+
* A repeated-key list (`?tags=a&tags=b`, PP1): arity "many", so
|
|
136
140
|
* presence modifiers are unavailable — absent and `[]` are the same wire
|
|
137
141
|
* state (S6/P6) — unlike `p.csv`'s one-key packing (CV7). Elements are
|
|
138
142
|
* strings unless an element codec is given.
|
|
@@ -166,7 +170,7 @@ export const p = {
|
|
|
166
170
|
return true;
|
|
167
171
|
if (raw === "false")
|
|
168
172
|
return false;
|
|
169
|
-
throw
|
|
173
|
+
throw grammarParseError(`"${raw}" is not "true" or "false"`);
|
|
170
174
|
},
|
|
171
175
|
serializeElement: (value) => {
|
|
172
176
|
if (typeof value !== "boolean") {
|
|
@@ -177,19 +181,18 @@ export const p = {
|
|
|
177
181
|
});
|
|
178
182
|
},
|
|
179
183
|
/**
|
|
180
|
-
* A comma-separated scalar list in ONE wire value (
|
|
184
|
+
* A comma-separated scalar list in ONE wire value (CV1): arity
|
|
181
185
|
* "single", so the full modifier set applies — unlike `p.array`'s
|
|
182
186
|
* repeated-key format (CV7: both are first-class; csv is the one-key
|
|
183
187
|
* packing). Elements are strings unless an element codec is given.
|
|
184
188
|
*/
|
|
185
189
|
csv(element) {
|
|
186
190
|
// CV2: presence, catch, and arity-many inners are excluded by the
|
|
187
|
-
// parameter type (the
|
|
188
|
-
// type-state for JS consumers
|
|
191
|
+
// parameter type (the same type-state philosophy); resolveListElement
|
|
192
|
+
// mirrors that type-state for JS consumers. Nesting is detected
|
|
189
193
|
// structurally via ~element (never via ~kind, which is reflection-only
|
|
190
|
-
// and free-form for p.custom labels). Comma-emitting p.custom inners
|
|
191
|
-
//
|
|
192
|
-
// instead.
|
|
194
|
+
// and free-form for p.custom labels). Comma-emitting p.custom inners are
|
|
195
|
+
// undetectable here and are caught by the CV4 serialize guard instead.
|
|
193
196
|
const inner = resolveListElement(element, "p.csv");
|
|
194
197
|
// The shared guard ran first: p.array also carries ~element (PP1), and
|
|
195
198
|
// the arity guard owns the "array codecs" wording — the ~element guard
|
|
@@ -213,7 +216,7 @@ export const p = {
|
|
|
213
216
|
// CV3: strict grammar — "a,,b", trailing "a,", and a lone "," are
|
|
214
217
|
// ParseErrors, recoverable via the LIST's .catch() (D2).
|
|
215
218
|
if (segment === "") {
|
|
216
|
-
throw
|
|
219
|
+
throw grammarParseError(`"${raw}" contains an empty list element`);
|
|
217
220
|
}
|
|
218
221
|
// CV3: the first element failure aborts the list parse — the
|
|
219
222
|
// element codec's own ParseError propagates unwrapped.
|
|
@@ -262,7 +265,11 @@ export const p = {
|
|
|
262
265
|
// rebrandForeign normalizes to ParseError so recovery sees them.
|
|
263
266
|
return createCodec({
|
|
264
267
|
...(codec.label === undefined ? {} : { kind: codec.label }),
|
|
265
|
-
parseElement: (raw) => rebrandForeign(() => codec.parse(raw),
|
|
268
|
+
parseElement: (raw) => rebrandForeign(() => codec.parse(raw),
|
|
269
|
+
// Not grammarParseError: foreign prose may name neither the value
|
|
270
|
+
// nor the grammar, so decode issues classify it "validate" and
|
|
271
|
+
// renderers append the expected shape themselves.
|
|
272
|
+
(error) => new ParseError(foreignMessage(error), { cause: error })),
|
|
266
273
|
serializeElement: (value) => rebrandForeign(() => codec.serialize(value), (error) => new SerializeError(foreignMessage(error), { cause: error })),
|
|
267
274
|
});
|
|
268
275
|
},
|
|
@@ -273,7 +280,7 @@ export const p = {
|
|
|
273
280
|
kind: "enum",
|
|
274
281
|
parseElement: (raw) => {
|
|
275
282
|
if (!set.has(raw)) {
|
|
276
|
-
throw
|
|
283
|
+
throw grammarParseError(`"${raw}" is not one of: ${members.join(", ")}`);
|
|
277
284
|
}
|
|
278
285
|
return raw;
|
|
279
286
|
},
|
|
@@ -287,13 +294,14 @@ export const p = {
|
|
|
287
294
|
},
|
|
288
295
|
/**
|
|
289
296
|
* A 1-based-on-wire / 0-based-in-memory integer for pagination-style
|
|
290
|
-
* params (`?page=1` ↔ index 0,
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
297
|
+
* params (`?page=1` ↔ index 0, PP5). Deliberately stricter than nuqs's
|
|
298
|
+
* `parseAsIndex`, whose below-floor behavior is unspecified: wire values
|
|
299
|
+
* below 1 are a ParseError (recoverable via `.catch()`, like any other
|
|
300
|
+
* malformed input), and a negative in-memory index — which cannot
|
|
294
301
|
* round-trip through the 1-based wire floor — is a SerializeError at
|
|
295
|
-
* link-build time
|
|
296
|
-
* in-memory (0-based)
|
|
302
|
+
* link-build time, failing where the link is written rather than on the
|
|
303
|
+
* next navigation. The optional schema validates the in-memory (0-based)
|
|
304
|
+
* value on both sides.
|
|
297
305
|
*/
|
|
298
306
|
index(schema) {
|
|
299
307
|
return createCodec({
|
|
@@ -301,7 +309,7 @@ export const p = {
|
|
|
301
309
|
parseElement: (raw) => {
|
|
302
310
|
const wire = parseIntegerElement(raw);
|
|
303
311
|
if (wire < 1) {
|
|
304
|
-
throw
|
|
312
|
+
throw grammarParseError(`"${raw}" is below the 1-based wire floor of 1`);
|
|
305
313
|
}
|
|
306
314
|
const value = wire - 1;
|
|
307
315
|
return schema ? refine(schema, value) : value;
|
|
@@ -334,7 +342,7 @@ export const p = {
|
|
|
334
342
|
kind: "isoDate",
|
|
335
343
|
parseElement: (raw) => {
|
|
336
344
|
if (!ISO_DATE_RE.test(raw)) {
|
|
337
|
-
throw
|
|
345
|
+
throw grammarParseError(`"${raw}" is not a YYYY-MM-DD date`);
|
|
338
346
|
}
|
|
339
347
|
// ISO-string construction, not Date.UTC: the latter maps years 0-99
|
|
340
348
|
// to 1900+year. The round-trip comparison rejects days the engine
|
|
@@ -342,7 +350,7 @@ export const p = {
|
|
|
342
350
|
const date = new Date(`${raw}T00:00:00.000Z`);
|
|
343
351
|
if (Number.isNaN(date.getTime()) ||
|
|
344
352
|
date.toISOString().slice(0, 10) !== raw) {
|
|
345
|
-
throw
|
|
353
|
+
throw grammarParseError(`"${raw}" is not a real calendar date`);
|
|
346
354
|
}
|
|
347
355
|
return date;
|
|
348
356
|
},
|
|
@@ -358,7 +366,7 @@ export const p = {
|
|
|
358
366
|
parsed = JSON.parse(raw);
|
|
359
367
|
}
|
|
360
368
|
catch {
|
|
361
|
-
throw
|
|
369
|
+
throw grammarParseError(`"${raw}" is not valid JSON`);
|
|
362
370
|
}
|
|
363
371
|
return refine(schema, parsed);
|
|
364
372
|
},
|
|
@@ -402,18 +410,18 @@ export const p = {
|
|
|
402
410
|
kind: "timestamp",
|
|
403
411
|
parseElement: (raw) => {
|
|
404
412
|
if (!TIMESTAMP_RE.test(raw)) {
|
|
405
|
-
throw
|
|
413
|
+
throw grammarParseError(`"${raw}" is not an ISO 8601 UTC timestamp`);
|
|
406
414
|
}
|
|
407
415
|
const date = new Date(raw);
|
|
408
416
|
if (Number.isNaN(date.getTime())) {
|
|
409
|
-
throw
|
|
417
|
+
throw grammarParseError(`"${raw}" is not a real instant`);
|
|
410
418
|
}
|
|
411
419
|
// The engine silently normalizes impossible fields (Feb 30 → Mar 1,
|
|
412
420
|
// 24:00 → next day). Pad the input to canonical millisecond form and
|
|
413
421
|
// require an exact round-trip instead.
|
|
414
422
|
const canonical = raw.replace(/(?:\.(\d{1,3}))?Z$/, (_match, ms) => `.${(ms ?? "").padEnd(3, "0")}Z`);
|
|
415
423
|
if (date.toISOString() !== canonical) {
|
|
416
|
-
throw
|
|
424
|
+
throw grammarParseError(`"${raw}" is not a real instant`);
|
|
417
425
|
}
|
|
418
426
|
return date;
|
|
419
427
|
},
|
package/dist/path.d.ts
CHANGED
|
@@ -15,11 +15,11 @@ export interface DecodeParamsOptions {
|
|
|
15
15
|
readonly percentDecode?: boolean;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Encode-input side of a route's params (
|
|
18
|
+
* Encode-input side of a route's params (the href-input column): `[id]` →
|
|
19
19
|
* `Out` (required), `[...slug]` → `Out[]` (required — `[]` is an R3
|
|
20
|
-
* serialization error), `[[...slug]]` → `Out[]` with an OPTIONAL key
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* serialization error), `[[...slug]]` → `Out[]` with an OPTIONAL key under
|
|
21
|
+
* exactOptionalPropertyTypes. Module-level export only; `InferHrefInput`
|
|
22
|
+
* builds on it.
|
|
23
23
|
*/
|
|
24
24
|
export type InferParamsInput<R extends AnyRoute> = {
|
|
25
25
|
[K in CatchAllNames<R["path"]>]: ParamOutput<R["~params"], K>[];
|
|
@@ -38,7 +38,7 @@ export type InferParamsInput<R extends AnyRoute> = {
|
|
|
38
38
|
*/
|
|
39
39
|
export type InferStaticParams<R extends AnyRoute> = Partial<Record<OptionalCatchAllNames<R["path"]>, string[]>> & Record<CatchAllNames<R["path"]>, string[]> & Record<SingleParamNames<R["path"]>, string>;
|
|
40
40
|
/**
|
|
41
|
-
* Value-layer params source (
|
|
41
|
+
* Value-layer params source (R5): the shape of Next's `params`
|
|
42
42
|
* prop and `useParams()` return. Contrary to the byte-layer's usual "platform
|
|
43
43
|
* already decoded it" stance, Next hands the App-Router surfaces percent-ENCODED
|
|
44
44
|
* values (Next issues #48058/#64952 — only route.ts handlers decode), so core
|
|
@@ -57,14 +57,14 @@ export type PathSegment = {
|
|
|
57
57
|
readonly raw: string;
|
|
58
58
|
};
|
|
59
59
|
/**
|
|
60
|
-
* Builds the path portion of an href
|
|
60
|
+
* Builds the path portion of an href: `/` plus the encoded segments
|
|
61
61
|
* joined with `/`. R2's element joining falls out of the same join as
|
|
62
62
|
* everything else; a fully-elided path (an optional catch-all at the root)
|
|
63
63
|
* yields "/".
|
|
64
64
|
*/
|
|
65
65
|
export declare function buildPath<R extends AnyRoute>(route: R, params: InferParamsInput<R>): string;
|
|
66
66
|
/**
|
|
67
|
-
* Decodes a params source against a route's codecs
|
|
67
|
+
* Decodes a params source against a route's codecs, the sync twin of
|
|
68
68
|
* `route.parseParams` — mirrors decodeSearch: per-key {@link Issue}
|
|
69
69
|
* aggregation into {@link ParamsDecodeError}. Shape validation is strict:
|
|
70
70
|
* `[id]` given an array, a catch-all given a string, a missing required key,
|
|
@@ -76,33 +76,33 @@ export declare function buildPath<R extends AnyRoute>(route: R, params: InferPar
|
|
|
76
76
|
export declare function decodeParams<R extends AnyRoute>(route: R, source: ParamsSource, options?: DecodeParamsOptions): InferRouteParams<R>;
|
|
77
77
|
/**
|
|
78
78
|
* Encodes a params input into ordered, already-percent-encoded URL segment
|
|
79
|
-
* strings
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
79
|
+
* strings — ONE entry per emitted URL segment: a static segment is emitted
|
|
80
|
+
* verbatim, a single param contributes one entry (R1), a catch-all one per
|
|
81
|
+
* element (R2), an elided optional catch-all none (R3). Codec serialize
|
|
82
|
+
* errors and schema-refinement failures propagate unchanged, already branded
|
|
83
|
+
* at their own chokepoints.
|
|
84
84
|
*/
|
|
85
85
|
export declare function encodeParams<R extends AnyRoute>(route: R, params: InferParamsInput<R>): string[];
|
|
86
86
|
/**
|
|
87
87
|
* Encodes a params input into the per-param wire-value record the static
|
|
88
88
|
* generation surfaces expect: App Router `generateStaticParams` entries and
|
|
89
|
-
* Pages Router `getStaticPaths` `{ params }` objects
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
89
|
+
* Pages Router `getStaticPaths` `{ params }` objects. Same codec
|
|
90
|
+
* serialization and R1–R4 validation as {@link encodeParams}, with two
|
|
91
|
+
* deliberate differences: static segments are skipped (Next wants only the
|
|
92
|
+
* dynamic params, keyed by name), and values are NOT percent-encoded — Next
|
|
93
|
+
* percent-encodes static-params values itself when it materializes the
|
|
94
|
+
* concrete URLs, so pre-encoding here would double-encode (the encode-side
|
|
95
|
+
* mirror of R5's decode asymmetry). That also means the S7 lone-surrogate
|
|
96
|
+
* brand stays an encodeParams concern: strings are handed to Next verbatim.
|
|
97
|
+
* An elided optional catch-all (R3) OMITS its key — an absent key is the
|
|
98
|
+
* base-path variant on both routers (Pages also accepts undefined/[];
|
|
99
|
+
* omission is the one spelling valid on both).
|
|
100
100
|
*/
|
|
101
101
|
export declare function encodeStaticParams<R extends AnyRoute>(route: R, params: InferParamsInput<R>): InferStaticParams<R>;
|
|
102
102
|
/**
|
|
103
103
|
* Tokenizes a path literal into segments, throwing ParamourError on every
|
|
104
|
-
*
|
|
105
|
-
* and the R-rule runtime here, so encode/decode never re-derive
|
|
106
|
-
* kinds.
|
|
104
|
+
* rejected literal. Shared by the route constructors (define-time
|
|
105
|
+
* validation) and the R-rule runtime here, so encode/decode never re-derive
|
|
106
|
+
* segment kinds.
|
|
107
107
|
*/
|
|
108
108
|
export declare function tokenizePath(path: string): PathSegment[];
|