@cookbook/urlkit 1.1.0 → 1.2.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/README.md +32 -35
- package/dist/{compile-path-COU1uxXm.js → compile-path-oMMfpXR8.js} +321 -84
- package/dist/compile-path-oMMfpXR8.js.map +1 -0
- package/dist/{compile-static-search-CCwJuNC3.js → compile-static-search-c2f2FB_l.js} +2 -2
- package/dist/{compile-static-search-CCwJuNC3.js.map → compile-static-search-c2f2FB_l.js.map} +1 -1
- package/dist/{create-url-contract-DAU3UCJ6.js → create-url-contract-DcYa3Jv4.js} +2 -2
- package/dist/{create-url-contract-DAU3UCJ6.js.map → create-url-contract-DcYa3Jv4.js.map} +1 -1
- package/dist/date/contracts.d.ts +1 -0
- package/dist/date/date-format-string.d.ts +9 -0
- package/dist/index.js +43 -6
- package/dist/index.js.map +1 -1
- package/dist/router-runtime.js +6 -5
- package/dist/router-runtime.js.map +1 -1
- package/dist/schema/date-time.d.ts +7 -1
- package/dist/schema/date.d.ts +2 -2
- package/dist/static.js +4 -3
- package/dist/static.js.map +1 -1
- package/dist/url/path-param-kind.d.ts +2 -1
- package/package.json +1 -1
- package/dist/compile-path-COU1uxXm.js.map +0 -1
- package/dist/url/register-urlkit-path-constraints.d.ts +0 -1
package/dist/date/contracts.d.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UrlKitErrorCode } from '../errors/contracts.js';
|
|
2
|
+
export type DateFormatStringMode = 'date' | 'date-time';
|
|
3
|
+
export interface DateFormatStringOptions {
|
|
4
|
+
readonly code?: UrlKitErrorCode;
|
|
5
|
+
readonly path?: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function parseDateFormatString(input: string, format: string, mode: DateFormatStringMode, options?: DateFormatStringOptions): Date;
|
|
8
|
+
export declare function serializeDateFormatString(input: Date, format: string, mode: DateFormatStringMode, options?: DateFormatStringOptions): string;
|
|
9
|
+
export declare function validateDateFormatString(format: string, mode: DateFormatStringMode): void;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,50 @@
|
|
|
1
|
-
import { d as date, c as compileSearchSchema, a as compilePath
|
|
2
|
-
export { b as boolean, e as enumOf, h as hasPathConstraint, i as int, n as number, r as registerPathConstraint, f as registerPathConstraints, s as string } from './compile-path-
|
|
1
|
+
import { U as UrlKitError, v as validateDateFormatString, d as date, c as compileSearchSchema, a as compilePath } from './compile-path-oMMfpXR8.js';
|
|
2
|
+
export { b as boolean, e as enumOf, h as hasPathConstraint, i as int, n as number, r as registerPathConstraint, f as registerPathConstraints, s as string } from './compile-path-oMMfpXR8.js';
|
|
3
3
|
export { createConstraint } from '@cookbook/pathkit/constraints';
|
|
4
|
-
import { c as compileHashDescriptor, a as createUrlContract } from './create-url-contract-
|
|
5
|
-
export { b as array, g as getObjectSchemaShape, o as object, p as parseArrayRuntimeSchemaValue, s as serializeArrayRuntimeSchemaValue } from './create-url-contract-
|
|
4
|
+
import { c as compileHashDescriptor, a as createUrlContract } from './create-url-contract-DcYa3Jv4.js';
|
|
5
|
+
export { b as array, g as getObjectSchemaShape, o as object, p as parseArrayRuntimeSchemaValue, s as serializeArrayRuntimeSchemaValue } from './create-url-contract-DcYa3Jv4.js';
|
|
6
6
|
import '@cookbook/pathkit/compile';
|
|
7
7
|
import '@cookbook/pathkit/match';
|
|
8
|
+
import '@cookbook/pathkit/tokenize';
|
|
8
9
|
|
|
9
|
-
function dateTime() {
|
|
10
|
-
|
|
10
|
+
function dateTime(options = {}) {
|
|
11
|
+
const format = resolveDateTimeFormat(options);
|
|
12
|
+
return createDateTimeSchema({ format });
|
|
13
|
+
}
|
|
14
|
+
function createDateTimeSchema(options) {
|
|
15
|
+
return date(options, 'date-time');
|
|
16
|
+
}
|
|
17
|
+
function resolveDateTimeFormat(options) {
|
|
18
|
+
if (!isDateTimeOptions(options)) {
|
|
19
|
+
throw new UrlKitError('invalid-descriptor', 'Date-time options must be an object.');
|
|
20
|
+
}
|
|
21
|
+
const format = options.format ?? 'date-time';
|
|
22
|
+
if (format === 'date-time' || isDateFormatCodec(format)) {
|
|
23
|
+
return format;
|
|
24
|
+
}
|
|
25
|
+
if (isDisallowedBuiltInDateTimeFormat(format)) {
|
|
26
|
+
throw new UrlKitError('invalid-descriptor', 'Date-time format must be "date-time", a supported date-time format string, or an explicit codec.');
|
|
27
|
+
}
|
|
28
|
+
if (isDateFormatString(format)) {
|
|
29
|
+
validateDateFormatString(format, 'date-time');
|
|
30
|
+
return format;
|
|
31
|
+
}
|
|
32
|
+
throw new UrlKitError('invalid-descriptor', 'Date-time format must be "date-time", a supported date-time format string, or an explicit codec.');
|
|
33
|
+
}
|
|
34
|
+
function isDateTimeOptions(input) {
|
|
35
|
+
return typeof input === 'object' && input !== null && !Array.isArray(input);
|
|
36
|
+
}
|
|
37
|
+
function isDateFormatString(input) {
|
|
38
|
+
return typeof input === 'string';
|
|
39
|
+
}
|
|
40
|
+
function isDisallowedBuiltInDateTimeFormat(input) {
|
|
41
|
+
return input === 'date' || input === 'unix-seconds' || input === 'unix-ms';
|
|
42
|
+
}
|
|
43
|
+
function isDateFormatCodec(input) {
|
|
44
|
+
return (typeof input === 'object' &&
|
|
45
|
+
input !== null &&
|
|
46
|
+
typeof input.parse === 'function' &&
|
|
47
|
+
typeof input.serialize === 'function');
|
|
11
48
|
}
|
|
12
49
|
|
|
13
50
|
function compileRuntimeUrlDescriptor(descriptor, options = {}) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/schema/date-time.ts","../src/url/compile-runtime-url-descriptor.ts","../src/url/create-url.ts","../src/search/create-search.ts","../src/hash/create-hash.ts"],"sourcesContent":["import type { DateSchema } from './date.js';\nimport { date } from './date.js';\n\nexport interface DateTimeSchema extends DateSchema<'date-time'> {}\n\nexport function dateTime(): DateTimeSchema {\n return date({ format: 'date-time' });\n}\n","import { UrlKitError } from '../errors/url-kit-error.js';\nimport { compileHashDescriptor } from '../hash/compile-hash-descriptor.js';\nimport { compileSearchSchema } from '../search/compile-search-schema.js';\nimport { compilePath } from './compile-path.js';\nimport type {\n CreateUrlOptions,\n NormalizedUrlDescriptor,\n RuntimeUrlDescriptor,\n UrlModeFromRuntimeDescriptor,\n} from './contracts.js';\n\nexport function compileRuntimeUrlDescriptor<Descriptor extends RuntimeUrlDescriptor>(\n descriptor: Descriptor,\n options: CreateUrlOptions = {},\n): NormalizedUrlDescriptor<UrlModeFromRuntimeDescriptor<Descriptor>> {\n assertRuntimeUrlDescriptor(descriptor);\n\n const mode = Object.prototype.hasOwnProperty.call(descriptor, 'path') ? 'path' : 'pathless';\n\n if (descriptor.search) {\n compileSearchSchema(descriptor.search);\n }\n\n const normalized = {\n mode,\n pattern: mode === 'path' ? descriptor.path : undefined,\n ...(mode === 'path' && descriptor.path !== undefined\n ? {\n path: compilePath(descriptor.path, {\n params: 'parsed',\n ...(options.pathConstraints ? { pathConstraints: options.pathConstraints } : {}),\n }),\n }\n : {}),\n ...(descriptor.search ? { search: descriptor.search } : {}),\n ...(descriptor.hash ? { hash: compileHashDescriptor(descriptor.hash).descriptor } : {}),\n } as NormalizedUrlDescriptor<UrlModeFromRuntimeDescriptor<Descriptor>>;\n\n return Object.freeze(normalized);\n}\n\nfunction assertRuntimeUrlDescriptor(input: unknown): asserts input is RuntimeUrlDescriptor {\n if (!isRecord(input)) {\n throw new UrlKitError('invalid-descriptor', 'Runtime URL descriptor must be an object.', {\n path: [],\n });\n }\n\n if (Object.prototype.hasOwnProperty.call(input, 'path') && typeof input.path !== 'string') {\n throw new UrlKitError('invalid-descriptor', 'Runtime URL descriptor path must be a string.', {\n path: ['path'],\n });\n }\n\n if (\n Object.prototype.hasOwnProperty.call(input, 'search') &&\n input.search !== undefined &&\n !isRecord(input.search)\n ) {\n throw new UrlKitError(\n 'invalid-descriptor',\n 'Runtime URL descriptor search must be an object.',\n { path: ['search'] },\n );\n }\n}\n\nfunction isRecord(input: unknown): input is Record<string, unknown> {\n return typeof input === 'object' && input !== null && !Array.isArray(input);\n}\n","import { createUrlContract } from './create-url-contract.js';\nimport { compileRuntimeUrlDescriptor } from './compile-runtime-url-descriptor.js';\nimport type {\n CreateUrlOptions,\n HashBuildInputFromRuntimeDescriptor,\n HashFromRuntimeDescriptor,\n ParamsFromRuntimeDescriptor,\n PathnameFromRuntimeDescriptor,\n RuntimeUrlDescriptor,\n SearchBuildInputFromRuntimeDescriptor,\n SearchFromRuntimeDescriptor,\n UrlContract,\n UrlModeFromRuntimeDescriptor,\n} from './contracts.js';\n\nexport function url<const Descriptor extends RuntimeUrlDescriptor>(\n descriptor: Descriptor,\n options: CreateUrlOptions = {},\n): UrlContract<\n UrlModeFromRuntimeDescriptor<Descriptor>,\n PathnameFromRuntimeDescriptor<Descriptor>,\n ParamsFromRuntimeDescriptor<Descriptor>,\n SearchFromRuntimeDescriptor<Descriptor>,\n HashFromRuntimeDescriptor<Descriptor>,\n SearchBuildInputFromRuntimeDescriptor<Descriptor>,\n HashBuildInputFromRuntimeDescriptor<Descriptor>\n> {\n return createUrlContract<\n UrlModeFromRuntimeDescriptor<Descriptor>,\n PathnameFromRuntimeDescriptor<Descriptor>,\n ParamsFromRuntimeDescriptor<Descriptor>,\n SearchFromRuntimeDescriptor<Descriptor>,\n HashFromRuntimeDescriptor<Descriptor>,\n SearchBuildInputFromRuntimeDescriptor<Descriptor>,\n HashBuildInputFromRuntimeDescriptor<Descriptor>\n >(compileRuntimeUrlDescriptor(descriptor, options), options);\n}\n","import type { EmptyParams } from '../contracts.js';\nimport { url } from '../url/create-url.js';\nimport type { CreateUrlOptions, UrlContract } from '../url/contracts.js';\nimport type {\n InferRuntimeSearch,\n InferRuntimeSearchBuildInput,\n RuntimeSearchSchema,\n} from './contracts.js';\n\nexport function search<const Schema extends RuntimeSearchSchema>(\n schema: Schema,\n options?: CreateUrlOptions,\n): UrlContract<\n 'pathless',\n string,\n EmptyParams,\n InferRuntimeSearch<Schema>,\n undefined,\n InferRuntimeSearchBuildInput<Schema>\n> {\n return url(\n {\n search: schema,\n },\n options,\n );\n}\n","import type { EmptyParams } from '../contracts.js';\nimport type { InferRuntimeSchemaValue } from '../schema/contracts.js';\nimport { url } from '../url/create-url.js';\nimport type {\n CreateUrlOptions,\n HashBuildInputFromRuntimeSchema,\n UrlContract,\n} from '../url/contracts.js';\nimport type { HashSchema } from './contracts.js';\n\nexport function hash<const Schema extends HashSchema>(\n schema: Schema,\n options?: CreateUrlOptions,\n): UrlContract<\n 'pathless',\n string,\n EmptyParams,\n EmptyParams,\n InferRuntimeSchemaValue<Schema>,\n EmptyParams,\n HashBuildInputFromRuntimeSchema<Schema>\n> {\n return url(\n {\n hash: schema,\n },\n options,\n ) as UrlContract<\n 'pathless',\n string,\n EmptyParams,\n EmptyParams,\n InferRuntimeSchemaValue<Schema>,\n EmptyParams,\n HashBuildInputFromRuntimeSchema<Schema>\n >;\n}\n"],"names":[],"mappings":";;;;;;;;SAKgB,QAAQ,GAAA;IACtB,OAAO,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACtC;;SCIgB,2BAA2B,CACzC,UAAsB,EACtB,UAA4B,EAAE,EAAA;IAE9B,0BAA0B,CAAC,UAAU,CAAC;IAEtC,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,UAAU;AAE3F,IAAA,IAAI,UAAU,CAAC,MAAM,EAAE;AACrB,QAAA,mBAAmB,CAAC,UAAU,CAAC,MAAM,CAAC;IACxC;AAEA,IAAA,MAAM,UAAU,GAAG;QACjB,IAAI;AACJ,QAAA,OAAO,EAAE,IAAI,KAAK,MAAM,GAAG,UAAU,CAAC,IAAI,GAAG,SAAS;QACtD,IAAI,IAAI,KAAK,MAAM,IAAI,UAAU,CAAC,IAAI,KAAK;AACzC,cAAE;AACE,gBAAA,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC,I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C,EAAE,CACrB;IACH;AACF;AAEA,SAAS,QAAQ,CAAC,KAAc,EAAA;AAC9B,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAC7E;;SCtDgB,GAAG,CACjB,UAAsB,EACtB,UAA4B,EAAE,EAAA;IAU9B,OAAO,iBAAiB,CAQtB,2BAA2B,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC;AAC9D;;AC3BM,SAAU,MAAM,CACpB,MAAc,EACd,OAA0B,EAAA;AAS1B,IAAA,OAAO,GAAG,CACR;AACE,QAAA,MAAM,EAAE,MAAM;KACf,EACD,OAAO,CACR;AACH;;AChBM,SAAU,IAAI,CAClB,MAAc,EACd,OAA0B,EAAA;AAU1B,IAAA,OAAO,GAAG,CACR;AACE,QAAA,IAAI,EAAE,MAAM;KACb,EACD,OAAO,CASR;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/schema/date-time.ts","../src/url/compile-runtime-url-descriptor.ts","../src/url/create-url.ts","../src/search/create-search.ts","../src/hash/create-hash.ts"],"sourcesContent":["import type { DateFormatCodec, DateFormatString } from '../date/contracts.js';\nimport { validateDateFormatString } from '../date/date-format-string.js';\nimport { UrlKitError } from '../errors/url-kit-error.js';\nimport type { DateOptions, DateSchema } from './date.js';\nimport { date } from './date.js';\n\nexport type DateTimeFormat = 'date-time' | DateFormatString | DateFormatCodec;\n\nexport interface DateTimeSchema<\n Format extends DateTimeFormat = 'date-time',\n> extends DateSchema<Format> {}\n\nexport interface DateTimeOptions<Format extends DateTimeFormat = 'date-time'> {\n readonly format?: Format;\n}\n\nexport function dateTime(): DateTimeSchema;\nexport function dateTime<const Format extends DateTimeFormat>(\n options: DateTimeOptions<Format>,\n): DateTimeSchema<Format>;\nexport function dateTime(\n options: DateTimeOptions<DateTimeFormat> = {},\n): DateTimeSchema<DateTimeFormat> {\n const format = resolveDateTimeFormat(options);\n\n return createDateTimeSchema({ format });\n}\n\nfunction createDateTimeSchema(\n options: DateOptions<DateTimeFormat>,\n): DateTimeSchema<DateTimeFormat> {\n return (\n date as unknown as (\n options: DateOptions<DateTimeFormat>,\n formatStringMode: 'date-time',\n ) => DateTimeSchema<DateTimeFormat>\n )(options, 'date-time');\n}\n\nfunction resolveDateTimeFormat(options: DateTimeOptions<DateTimeFormat>): DateTimeFormat {\n if (!isDateTimeOptions(options)) {\n throw new UrlKitError('invalid-descriptor', 'Date-time options must be an object.');\n }\n\n const format = options.format ?? 'date-time';\n\n if (format === 'date-time' || isDateFormatCodec(format)) {\n return format;\n }\n\n if (isDisallowedBuiltInDateTimeFormat(format)) {\n throw new UrlKitError(\n 'invalid-descriptor',\n 'Date-time format must be \"date-time\", a supported date-time format string, or an explicit codec.',\n );\n }\n\n if (isDateFormatString(format)) {\n validateDateFormatString(format, 'date-time');\n return format;\n }\n\n throw new UrlKitError(\n 'invalid-descriptor',\n 'Date-time format must be \"date-time\", a supported date-time format string, or an explicit codec.',\n );\n}\n\nfunction isDateTimeOptions(input: unknown): input is DateTimeOptions<DateTimeFormat> {\n return typeof input === 'object' && input !== null && !Array.isArray(input);\n}\n\nfunction isDateFormatString(input: unknown): input is DateFormatString {\n return typeof input === 'string';\n}\n\nfunction isDisallowedBuiltInDateTimeFormat(input: unknown): boolean {\n return input === 'date' || input === 'unix-seconds' || input === 'unix-ms';\n}\n\nfunction isDateFormatCodec(input: unknown): input is DateFormatCodec {\n return (\n typeof input === 'object' &&\n input !== null &&\n typeof (input as Partial<DateFormatCodec>).parse === 'function' &&\n typeof (input as Partial<DateFormatCodec>).serialize === 'function'\n );\n}\n","import { UrlKitError } from '../errors/url-kit-error.js';\nimport { compileHashDescriptor } from '../hash/compile-hash-descriptor.js';\nimport { compileSearchSchema } from '../search/compile-search-schema.js';\nimport { compilePath } from './compile-path.js';\nimport type {\n CreateUrlOptions,\n NormalizedUrlDescriptor,\n RuntimeUrlDescriptor,\n UrlModeFromRuntimeDescriptor,\n} from './contracts.js';\n\nexport function compileRuntimeUrlDescriptor<Descriptor extends RuntimeUrlDescriptor>(\n descriptor: Descriptor,\n options: CreateUrlOptions = {},\n): NormalizedUrlDescriptor<UrlModeFromRuntimeDescriptor<Descriptor>> {\n assertRuntimeUrlDescriptor(descriptor);\n\n const mode = Object.prototype.hasOwnProperty.call(descriptor, 'path') ? 'path' : 'pathless';\n\n if (descriptor.search) {\n compileSearchSchema(descriptor.search);\n }\n\n const normalized = {\n mode,\n pattern: mode === 'path' ? descriptor.path : undefined,\n ...(mode === 'path' && descriptor.path !== undefined\n ? {\n path: compilePath(descriptor.path, {\n params: 'parsed',\n ...(options.pathConstraints ? { pathConstraints: options.pathConstraints } : {}),\n }),\n }\n : {}),\n ...(descriptor.search ? { search: descriptor.search } : {}),\n ...(descriptor.hash ? { hash: compileHashDescriptor(descriptor.hash).descriptor } : {}),\n } as NormalizedUrlDescriptor<UrlModeFromRuntimeDescriptor<Descriptor>>;\n\n return Object.freeze(normalized);\n}\n\nfunction assertRuntimeUrlDescriptor(input: unknown): asserts input is RuntimeUrlDescriptor {\n if (!isRecord(input)) {\n throw new UrlKitError('invalid-descriptor', 'Runtime URL descriptor must be an object.', {\n path: [],\n });\n }\n\n if (Object.prototype.hasOwnProperty.call(input, 'path') && typeof input.path !== 'string') {\n throw new UrlKitError('invalid-descriptor', 'Runtime URL descriptor path must be a string.', {\n path: ['path'],\n });\n }\n\n if (\n Object.prototype.hasOwnProperty.call(input, 'search') &&\n input.search !== undefined &&\n !isRecord(input.search)\n ) {\n throw new UrlKitError(\n 'invalid-descriptor',\n 'Runtime URL descriptor search must be an object.',\n { path: ['search'] },\n );\n }\n}\n\nfunction isRecord(input: unknown): input is Record<string, unknown> {\n return typeof input === 'object' && input !== null && !Array.isArray(input);\n}\n","import { createUrlContract } from './create-url-contract.js';\nimport { compileRuntimeUrlDescriptor } from './compile-runtime-url-descriptor.js';\nimport type {\n CreateUrlOptions,\n HashBuildInputFromRuntimeDescriptor,\n HashFromRuntimeDescriptor,\n ParamsFromRuntimeDescriptor,\n PathnameFromRuntimeDescriptor,\n RuntimeUrlDescriptor,\n SearchBuildInputFromRuntimeDescriptor,\n SearchFromRuntimeDescriptor,\n UrlContract,\n UrlModeFromRuntimeDescriptor,\n} from './contracts.js';\n\nexport function url<const Descriptor extends RuntimeUrlDescriptor>(\n descriptor: Descriptor,\n options: CreateUrlOptions = {},\n): UrlContract<\n UrlModeFromRuntimeDescriptor<Descriptor>,\n PathnameFromRuntimeDescriptor<Descriptor>,\n ParamsFromRuntimeDescriptor<Descriptor>,\n SearchFromRuntimeDescriptor<Descriptor>,\n HashFromRuntimeDescriptor<Descriptor>,\n SearchBuildInputFromRuntimeDescriptor<Descriptor>,\n HashBuildInputFromRuntimeDescriptor<Descriptor>\n> {\n return createUrlContract<\n UrlModeFromRuntimeDescriptor<Descriptor>,\n PathnameFromRuntimeDescriptor<Descriptor>,\n ParamsFromRuntimeDescriptor<Descriptor>,\n SearchFromRuntimeDescriptor<Descriptor>,\n HashFromRuntimeDescriptor<Descriptor>,\n SearchBuildInputFromRuntimeDescriptor<Descriptor>,\n HashBuildInputFromRuntimeDescriptor<Descriptor>\n >(compileRuntimeUrlDescriptor(descriptor, options), options);\n}\n","import type { EmptyParams } from '../contracts.js';\nimport { url } from '../url/create-url.js';\nimport type { CreateUrlOptions, UrlContract } from '../url/contracts.js';\nimport type {\n InferRuntimeSearch,\n InferRuntimeSearchBuildInput,\n RuntimeSearchSchema,\n} from './contracts.js';\n\nexport function search<const Schema extends RuntimeSearchSchema>(\n schema: Schema,\n options?: CreateUrlOptions,\n): UrlContract<\n 'pathless',\n string,\n EmptyParams,\n InferRuntimeSearch<Schema>,\n undefined,\n InferRuntimeSearchBuildInput<Schema>\n> {\n return url(\n {\n search: schema,\n },\n options,\n );\n}\n","import type { EmptyParams } from '../contracts.js';\nimport type { InferRuntimeSchemaValue } from '../schema/contracts.js';\nimport { url } from '../url/create-url.js';\nimport type {\n CreateUrlOptions,\n HashBuildInputFromRuntimeSchema,\n UrlContract,\n} from '../url/contracts.js';\nimport type { HashSchema } from './contracts.js';\n\nexport function hash<const Schema extends HashSchema>(\n schema: Schema,\n options?: CreateUrlOptions,\n): UrlContract<\n 'pathless',\n string,\n EmptyParams,\n EmptyParams,\n InferRuntimeSchemaValue<Schema>,\n EmptyParams,\n HashBuildInputFromRuntimeSchema<Schema>\n> {\n return url(\n {\n hash: schema,\n },\n options,\n ) as UrlContract<\n 'pathless',\n string,\n EmptyParams,\n EmptyParams,\n InferRuntimeSchemaValue<Schema>,\n EmptyParams,\n HashBuildInputFromRuntimeSchema<Schema>\n >;\n}\n"],"names":[],"mappings":";;;;;;;;;AAoBM,SAAU,QAAQ,CACtB,OAAA,GAA2C,EAAE,EAAA;AAE7C,IAAA,MAAM,MAAM,GAAG,qBAAqB,CAAC,OAAO,CAAC;AAE7C,IAAA,OAAO,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;AACzC;AAEA,SAAS,oBAAoB,CAC3B,OAAoC,EAAA;AAEpC,IAAA,OACE,IAID,CAAC,OAAO,EAAE,WAAW,CAAC;AACzB;AAEA,SAAS,qBAAqB,CAAC,OAAwC,EAAA;AACrE,IAAA,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE;AAC/B,QAAA,MAAM,IAAI,WAAW,CAAC,oBAAoB,EAAE,sCAAsC,CAAC;IACrF;AAEA,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,WAAW;IAE5C,IAAI,MAAM,KAAK,WAAW,IAAI,iBAAiB,CAAC,MAAM,CAAC,EAAE;AACvD,QAAA,OAAO,MAAM;IACf;AAEA,IAAA,IAAI,iCAAiC,CAAC,MAAM,CAAC,EAAE;AAC7C,QAAA,MAAM,IAAI,WAAW,CACnB,oBAAoB,EACpB,kGAAkG,CACnG;IACH;AAEA,IAAA,IAAI,kBAAkB,CAAC,MAAM,CAAC,EAAE;AAC9B,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B,EACpB,kDAAkD,EAClD,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,CACrB;IACH;AACF;AAEA,SAAS,QAAQ,CAAC,KAAc,EAAA;AAC9B,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAC7E;;SCtDgB,GAAG,CACjB,UAAsB,EACtB,UAA4B,EAAE,EAAA;IAU9B,OAAO,iBAAiB,CAQtB,2BAA2B,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC;AAC9D;;AC3BM,SAAU,MAAM,CACpB,MAAc,EACd,OAA0B,EAAA;AAS1B,IAAA,OAAO,GAAG,CACR;AACE,QAAA,MAAM,EAAE,MAAM;KACf,EACD,OAAO,CACR;AACH;;AChBM,SAAU,IAAI,CAClB,MAAc,EACd,OAA0B,EAAA;AAU1B,IAAA,OAAO,GAAG,CACR;AACE,QAAA,IAAI,EAAE,MAAM;KACb,EACD,OAAO,CASR;AACH;;;;"}
|
package/dist/router-runtime.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { a as compilePath, c as compileSearchSchema } from './compile-path-
|
|
2
|
-
export { h as hasPathConstraint, r as registerPathConstraint, f as registerPathConstraints } from './compile-path-
|
|
1
|
+
import { a as compilePath, c as compileSearchSchema } from './compile-path-oMMfpXR8.js';
|
|
2
|
+
export { h as hasPathConstraint, r as registerPathConstraint, f as registerPathConstraints } from './compile-path-oMMfpXR8.js';
|
|
3
3
|
export { createConstraint } from '@cookbook/pathkit/constraints';
|
|
4
|
-
import { c as compileStaticHash, a as compileStaticSearch } from './compile-static-search-
|
|
5
|
-
import { a as createUrlContract, d as buildCompiledSearch, e as buildRawSearch, f as omitRawSearch, h as parseRawSearch, i as hasSearchFieldRawValue, j as parseSearchFieldValue, k as deleteSearchFieldRawKeys, l as copyRawSearchParams, m as joinSearchStrings, n as pickRawSearch, q as parseCompiledSearch, r as readHashFragment, c as compileHashDescriptor } from './create-url-contract-
|
|
6
|
-
export { t as buildHash, u as parseHash } from './create-url-contract-
|
|
4
|
+
import { c as compileStaticHash, a as compileStaticSearch } from './compile-static-search-c2f2FB_l.js';
|
|
5
|
+
import { a as createUrlContract, d as buildCompiledSearch, e as buildRawSearch, f as omitRawSearch, h as parseRawSearch, i as hasSearchFieldRawValue, j as parseSearchFieldValue, k as deleteSearchFieldRawKeys, l as copyRawSearchParams, m as joinSearchStrings, n as pickRawSearch, q as parseCompiledSearch, r as readHashFragment, c as compileHashDescriptor } from './create-url-contract-DcYa3Jv4.js';
|
|
6
|
+
export { t as buildHash, u as parseHash } from './create-url-contract-DcYa3Jv4.js';
|
|
7
7
|
import '@cookbook/pathkit/compile';
|
|
8
8
|
import '@cookbook/pathkit/match';
|
|
9
|
+
import '@cookbook/pathkit/tokenize';
|
|
9
10
|
|
|
10
11
|
function createRouteUrlContract(descriptor, options) {
|
|
11
12
|
return createUrlContract(compileRouteUrlDescriptor(descriptor, options), options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-runtime.js","sources":["../src/runtime/create-route-url-contract.ts","../src/search/build-schema-search.ts","../src/search/build-search.ts","../src/search/omit-search.ts","../src/search/parse-partial-schema-search.ts","../src/search/patch-search.ts","../src/search/pick-search.ts","../src/search/replace-search.ts","../src/runtime/compile-cached-static-search.ts","../src/runtime/build-route-search.ts","../src/search/parse-search.ts","../src/runtime/parse-route-search.ts","../src/hash/normalize-hash.ts"],"sourcesContent":["import { compileStaticHash } from '../static/compile-static-hash.js';\nimport { compileStaticSearch } from '../static/compile-static-search.js';\nimport type {\n InferStaticUrlHash,\n InferStaticUrlHashBuildInput,\n InferStaticUrlSearch,\n InferStaticUrlSearchBuildInput,\n StaticUrlDescriptor,\n StaticUrlModeFromDescriptor,\n} from '../static/contracts.js';\nimport { compilePath } from '../url/compile-path.js';\nimport { createUrlContract } from '../url/create-url-contract.js';\nimport type {\n NormalizedUrlDescriptor,\n ParamsFromPattern,\n PathnameFromPattern,\n RawParamsFromPattern,\n UrlContract,\n} from '../url/contracts.js';\nimport type { EmptyParams } from '../contracts.js';\nimport type { CreateRouteUrlContractOptions } from './contracts.js';\n\nexport function createRouteUrlContract<\n const Descriptor extends StaticUrlDescriptor,\n const Options extends CreateRouteUrlContractOptions | undefined = undefined,\n>(\n descriptor: Descriptor,\n options?: Options,\n): UrlContract<\n StaticUrlModeFromDescriptor<Descriptor>,\n RoutePathnameFromDescriptor<Descriptor>,\n RouteParamsFromDescriptor<Descriptor, Options>,\n InferStaticUrlSearch<Descriptor>,\n InferStaticUrlHash<Descriptor>,\n InferStaticUrlSearchBuildInput<Descriptor>,\n InferStaticUrlHashBuildInput<Descriptor>\n> {\n return createUrlContract<\n StaticUrlModeFromDescriptor<Descriptor>,\n RoutePathnameFromDescriptor<Descriptor>,\n RouteParamsFromDescriptor<Descriptor, Options>,\n InferStaticUrlSearch<Descriptor>,\n InferStaticUrlHash<Descriptor>,\n InferStaticUrlSearchBuildInput<Descriptor>,\n InferStaticUrlHashBuildInput<Descriptor>\n >(compileRouteUrlDescriptor(descriptor, options), options);\n}\n\nexport type RoutePathnameFromDescriptor<Descriptor extends StaticUrlDescriptor> =\n Descriptor extends {\n readonly path: infer Pattern extends string;\n }\n ? PathnameFromPattern<Pattern>\n : string;\n\nexport type RouteParamsFromDescriptor<\n Descriptor extends StaticUrlDescriptor,\n Options extends CreateRouteUrlContractOptions | undefined,\n> = Descriptor extends { readonly path: infer Pattern extends string }\n ? RouteParamsMode<Options> extends 'parsed'\n ? ParamsFromPattern<Pattern>\n : RawParamsFromPattern<Pattern>\n : EmptyParams;\n\ntype RouteParamsMode<Options extends CreateRouteUrlContractOptions | undefined> = Options extends {\n readonly params: 'parsed';\n}\n ? 'parsed'\n : 'raw';\n\nfunction compileRouteUrlDescriptor<\n Descriptor extends StaticUrlDescriptor,\n Options extends CreateRouteUrlContractOptions | undefined,\n>(\n descriptor: Descriptor,\n options: Options,\n): NormalizedUrlDescriptor<StaticUrlModeFromDescriptor<Descriptor>> {\n const mode = Object.prototype.hasOwnProperty.call(descriptor, 'path') ? 'path' : 'pathless';\n const paramsMode = options?.params ?? 'raw';\n\n const normalized = {\n mode,\n pattern: mode === 'path' ? descriptor.path : undefined,\n ...(mode === 'path' && descriptor.path !== undefined\n ? {\n path: compilePath(descriptor.path, {\n params: paramsMode,\n ...(options?.pathConstraints ? { pathConstraints: options.pathConstraints } : {}),\n }),\n }\n : {}),\n ...(Object.prototype.hasOwnProperty.call(descriptor, 'search')\n ? { search: compileStaticSearch(descriptor.search ?? {}) }\n : {}),\n ...(Object.prototype.hasOwnProperty.call(descriptor, 'hash') && descriptor.hash !== undefined\n ? { hash: compileStaticHash(descriptor.hash) }\n : {}),\n } as NormalizedUrlDescriptor<StaticUrlModeFromDescriptor<Descriptor>>;\n\n return Object.freeze(normalized);\n}\n","import type { BuildSearchOptions } from '../contracts.js';\nimport { compileSearchSchema } from './compile-search-schema.js';\nimport type { RuntimeSearchSchema } from './contracts.js';\nimport { buildCompiledSearch } from './build-compiled-search.js';\n\nexport function buildSchemaSearch(\n input: Record<string, unknown> = {},\n schema: RuntimeSearchSchema,\n options: BuildSearchOptions = {},\n): string {\n return buildCompiledSearch(input, compileSearchSchema(schema), options);\n}\n","import type { BuildSearchOptions, SearchInputArgument } from '../contracts.js';\nimport type {\n InferRuntimeSearchBuildInput,\n RuntimeSearchSchema,\n SearchBuildOptions,\n} from './contracts.js';\nimport { buildRawSearch } from './build-raw-search.js';\nimport { buildSchemaSearch } from './build-schema-search.js';\n\nexport function buildSearch<const Schema extends RuntimeSearchSchema>(\n input: SearchInputArgument<InferRuntimeSearchBuildInput<Schema>>,\n options: SearchBuildOptions<Schema> & { readonly schema: Schema },\n): string;\nexport function buildSearch(input?: Record<string, unknown>, options?: BuildSearchOptions): string;\nexport function buildSearch(\n input: Record<string, unknown> | undefined = {},\n options: SearchBuildOptions<RuntimeSearchSchema> = {},\n): string {\n if (options.schema) {\n return buildSchemaSearch(input, options.schema, options);\n }\n\n return buildRawSearch(input, options);\n}\n","import { buildRawSearch } from './build-raw-search.js';\nimport { omitRawSearch } from './filter-raw-search.js';\nimport { parseRawSearch } from './parse-raw-search.js';\n\nexport function omitSearch(current: string | URLSearchParams, keys: readonly string[]): string {\n return buildRawSearch(omitRawSearch(parseRawSearch(current), keys));\n}\n","import type {\n RawSearchParams,\n RawSearchValue,\n RuntimeSearchSchema,\n SearchParseOptions,\n} from './contracts.js';\nimport { compileSearchSchema } from './compile-search-schema.js';\nimport { copyRawSearchParams } from './copy-raw-search-params.js';\nimport { parseSearchFieldValue } from './parse-search-field-value.js';\nimport { deleteSearchFieldRawKeys } from './delete-search-field-raw-keys.js';\nimport { hasSearchFieldRawValue } from './has-search-field-raw-value.js';\n\nexport interface PartialSchemaSearchParseResult {\n readonly search: Record<string, unknown>;\n readonly unknownSearch: RawSearchParams;\n}\n\nexport function parsePartialSchemaSearch(\n rawSearch: RawSearchParams,\n schema: RuntimeSearchSchema,\n options: SearchParseOptions = {},\n): PartialSchemaSearchParseResult {\n const compiled = compileSearchSchema(schema);\n const remainingUnknown = { ...rawSearch } satisfies Record<string, RawSearchValue>;\n const search: Record<string, unknown> = {};\n\n for (const field of compiled.fields) {\n if (!hasSearchFieldRawValue(field, rawSearch)) {\n continue;\n }\n\n const value = parseSearchFieldValue(field, rawSearch, options);\n deleteSearchFieldRawKeys(field, remainingUnknown);\n\n if (value !== undefined) {\n search[field.key] = value;\n }\n }\n\n return Object.freeze({\n search: Object.freeze(search),\n unknownSearch: copyRawSearchParams(remainingUnknown),\n });\n}\n","import type { BuildSearchOptions, PatchSearchOptions } from '../contracts.js';\nimport type {\n InferRuntimeSearch,\n RawSearchValue,\n RuntimeSearchSchema,\n SearchPatchOptions,\n} from './contracts.js';\nimport { buildRawSearch } from './build-raw-search.js';\nimport { buildSchemaSearch } from './build-schema-search.js';\nimport { compileSearchSchema } from './compile-search-schema.js';\nimport { copyRawSearchParams } from './copy-raw-search-params.js';\nimport { joinSearchStrings } from './join-search-strings.js';\nimport { parsePartialSchemaSearch } from './parse-partial-schema-search.js';\nimport { parseRawSearch } from './parse-raw-search.js';\n\nexport function patchSearch<const Schema extends RuntimeSearchSchema>(\n current: string | URLSearchParams,\n patch: Partial<InferRuntimeSearch<Schema>>,\n options: SearchPatchOptions<Schema> & { readonly schema: Schema },\n): string;\nexport function patchSearch(\n current: string | URLSearchParams,\n patch: Record<string, unknown>,\n options?: PatchSearchOptions,\n): string;\nexport function patchSearch(\n current: string | URLSearchParams,\n patch: Record<string, unknown>,\n options: SearchPatchOptions<RuntimeSearchSchema> = {},\n): string {\n if (options.schema) {\n return patchSchemaSearch(current, patch, options.schema, options);\n }\n\n return patchRawSearch(current, patch, options);\n}\n\nfunction patchRawSearch(\n current: string | URLSearchParams,\n patch: Record<string, unknown>,\n options: PatchSearchOptions,\n): string {\n const merged: Record<string, RawSearchValue> = { ...parseRawSearch(current) };\n\n for (const [key, value] of Object.entries(patch)) {\n if (shouldRemoveUndefined(value, options) || shouldRemoveNull(value, options)) {\n delete merged[key];\n continue;\n }\n\n if (value === undefined || value === null) {\n continue;\n }\n\n merged[key] = toRawSearchValue(value);\n }\n\n return buildRawSearch(merged, options);\n}\n\nfunction patchSchemaSearch(\n current: string | URLSearchParams,\n patch: Record<string, unknown>,\n schema: RuntimeSearchSchema,\n options: SearchPatchOptions<RuntimeSearchSchema>,\n): string {\n const compiled = compileSearchSchema(schema);\n const schemaKeys = compiled.keys;\n const currentParsed = parsePartialSchemaSearch(parseRawSearch(current), schema, options);\n const mergedSearch: Record<string, unknown> = { ...currentParsed.search };\n const unknownSearch: Record<string, RawSearchValue> = {\n ...copyRawSearchParams(currentParsed.unknownSearch),\n };\n\n for (const [key, value] of Object.entries(patch)) {\n if (shouldRemoveUndefined(value, options) || shouldRemoveNull(value, options)) {\n delete mergedSearch[key];\n delete unknownSearch[key];\n continue;\n }\n\n if (value === undefined || value === null) {\n continue;\n }\n\n if (schemaKeys.has(key)) {\n mergedSearch[key] = value;\n }\n }\n\n return joinSearchStrings(\n buildSchemaSearch(mergedSearch, schema, options as BuildSearchOptions),\n buildRawSearch(unknownSearch, options),\n );\n}\n\nfunction shouldRemoveUndefined(value: unknown, options: PatchSearchOptions): boolean {\n return value === undefined && options.removeUndefined === true;\n}\n\nfunction shouldRemoveNull(value: unknown, options: PatchSearchOptions): boolean {\n return value === null && options.removeNull === true;\n}\n\nfunction toRawSearchValue(value: unknown): RawSearchValue {\n if (Array.isArray(value)) {\n return Object.freeze(value.filter(isPresent).map(String));\n }\n\n return String(value);\n}\n\nfunction isPresent(value: unknown): boolean {\n return value !== undefined && value !== null;\n}\n","import { buildRawSearch } from './build-raw-search.js';\nimport { pickRawSearch } from './filter-raw-search.js';\nimport { parseRawSearch } from './parse-raw-search.js';\n\nexport function pickSearch(current: string | URLSearchParams, keys: readonly string[]): string {\n return buildRawSearch(pickRawSearch(parseRawSearch(current), keys));\n}\n","import type {\n InferRuntimeSearchBuildInput,\n RuntimeSearchSchema,\n SearchBuildOptions,\n} from './contracts.js';\nimport { buildSearch } from './build-search.js';\n\nexport function replaceSearch<const Schema extends RuntimeSearchSchema>(\n current: string | URLSearchParams,\n next: InferRuntimeSearchBuildInput<Schema>,\n options: SearchBuildOptions<Schema> & { readonly schema: Schema },\n): string;\nexport function replaceSearch(\n current: string | URLSearchParams,\n next: Record<string, unknown>,\n options?: SearchBuildOptions,\n): string;\nexport function replaceSearch(\n _current: string | URLSearchParams,\n next: object,\n options: SearchBuildOptions = {},\n): string {\n return buildSearch(next as Record<string, unknown>, options);\n}\n","import type { RuntimeSearchSchema } from '../search/contracts.js';\nimport { compileStaticSearch } from '../static/compile-static-search.js';\nimport type { StaticSearchDescriptor } from '../static/contracts.js';\n\nconst staticSearchCache = new WeakMap<StaticSearchDescriptor, RuntimeSearchSchema>();\n\nexport function compileCachedStaticSearch(schema: StaticSearchDescriptor): RuntimeSearchSchema {\n const cached = staticSearchCache.get(schema);\n\n if (cached) {\n return cached;\n }\n\n const compiled = compileStaticSearch(schema);\n staticSearchCache.set(schema, compiled);\n\n return compiled;\n}\n","import type { BuildSearchOptions, PatchSearchOptions, SearchInputArgument } from '../contracts.js';\nimport { buildSearch as buildRuntimeSearch } from '../search/build-search.js';\nimport { omitSearch as omitRuntimeSearch } from '../search/omit-search.js';\nimport { patchSearch as patchRuntimeSearch } from '../search/patch-search.js';\nimport { pickSearch as pickRuntimeSearch } from '../search/pick-search.js';\nimport { replaceSearch as replaceRuntimeSearch } from '../search/replace-search.js';\nimport { compileCachedStaticSearch } from './compile-cached-static-search.js';\nimport type {\n InferStaticSearch,\n InferStaticSearchBuildInput,\n StaticSearchDescriptor,\n} from '../static/contracts.js';\n\nexport interface BuildRouteSearchOptions<\n SearchDescriptor = StaticSearchDescriptor,\n> extends BuildSearchOptions {\n readonly schema?: SearchDescriptor;\n}\n\nexport interface PatchRouteSearchOptions<\n SearchDescriptor = StaticSearchDescriptor,\n> extends PatchSearchOptions {\n readonly schema?: SearchDescriptor;\n}\n\nexport function buildSearch<const SearchDescriptor extends StaticSearchDescriptor>(\n input: SearchInputArgument<InferStaticSearchBuildInput<SearchDescriptor>>,\n options: BuildRouteSearchOptions<SearchDescriptor> & { readonly schema: SearchDescriptor },\n): string;\nexport function buildSearch(input?: Record<string, unknown>, options?: BuildSearchOptions): string;\nexport function buildSearch(\n input: Record<string, unknown> | undefined = {},\n options: BuildRouteSearchOptions = {},\n): string {\n if (!options.schema) {\n return buildRuntimeSearch(input, options);\n }\n\n return buildRuntimeSearch(input, {\n ...options,\n schema: compileCachedStaticSearch(options.schema),\n });\n}\n\nexport function patchSearch<const SearchDescriptor extends StaticSearchDescriptor>(\n current: string | URLSearchParams,\n patch: Partial<InferStaticSearch<SearchDescriptor>>,\n options: PatchRouteSearchOptions<SearchDescriptor> & { readonly schema: SearchDescriptor },\n): string;\nexport function patchSearch(\n current: string | URLSearchParams,\n patch: Record<string, unknown>,\n options?: PatchSearchOptions,\n): string;\nexport function patchSearch(\n current: string | URLSearchParams,\n patch: Record<string, unknown>,\n options: PatchRouteSearchOptions = {},\n): string {\n if (!options.schema) {\n return patchRuntimeSearch(current, patch, options);\n }\n\n return patchRuntimeSearch(current, patch, {\n ...options,\n schema: compileCachedStaticSearch(options.schema),\n });\n}\n\nexport function replaceSearch<const SearchDescriptor extends StaticSearchDescriptor>(\n current: string | URLSearchParams,\n next: InferStaticSearchBuildInput<SearchDescriptor>,\n options: BuildRouteSearchOptions<SearchDescriptor> & { readonly schema: SearchDescriptor },\n): string;\nexport function replaceSearch(\n current: string | URLSearchParams,\n next: Record<string, unknown>,\n options?: BuildSearchOptions,\n): string;\nexport function replaceSearch(\n current: string | URLSearchParams,\n next: Record<string, unknown>,\n options: BuildRouteSearchOptions = {},\n): string {\n if (!options.schema) {\n return replaceRuntimeSearch(current, next, options);\n }\n\n return replaceRuntimeSearch(current, next, {\n ...options,\n schema: compileCachedStaticSearch(options.schema),\n });\n}\n\nexport function omitSearch(current: string | URLSearchParams, keys: readonly string[]): string {\n return omitRuntimeSearch(current, keys);\n}\n\nexport function pickSearch(current: string | URLSearchParams, keys: readonly string[]): string {\n return pickRuntimeSearch(current, keys);\n}\n","import type {\n InferRuntimeSearch,\n ParseSearchOptions,\n RawSearchParams,\n RuntimeSearchSchema,\n SearchParseResult,\n} from './contracts.js';\nimport { compileSearchSchema } from './compile-search-schema.js';\nimport { parseRawSearch } from './parse-raw-search.js';\nimport { parseCompiledSearch } from './parse-compiled-search.js';\n\nexport function parseSearch(input: string | URLSearchParams): RawSearchParams;\nexport function parseSearch<const Schema extends RuntimeSearchSchema>(\n input: string | URLSearchParams,\n options: ParseSearchOptions<Schema> & { readonly schema: Schema },\n): SearchParseResult<InferRuntimeSearch<Schema>>;\nexport function parseSearch(\n input: string | URLSearchParams,\n options?: ParseSearchOptions<RuntimeSearchSchema>,\n): RawSearchParams | SearchParseResult<Record<string, unknown>> {\n const rawSearch = parseRawSearch(input);\n\n if (!options?.schema) {\n return rawSearch;\n }\n\n return parseSchemaSearch(rawSearch, options.schema, options);\n}\n\nfunction parseSchemaSearch(\n rawSearch: RawSearchParams,\n schema: RuntimeSearchSchema,\n options: ParseSearchOptions,\n): SearchParseResult<Record<string, unknown>> {\n return parseCompiledSearch(\n rawSearch,\n compileSearchSchema(schema),\n options.unknownSearch ?? 'strip',\n options.arrayFormat ? { arrayFormat: options.arrayFormat } : {},\n );\n}\n","import type { SearchArrayFormat, UnknownSearchBehavior } from '../contracts.js';\nimport { parseSearch as parseRuntimeSearch } from '../search/parse-search.js';\nimport type { RawSearchParams } from '../search/contracts.js';\nimport { compileCachedStaticSearch } from './compile-cached-static-search.js';\nimport type { InferStaticSearch, StaticSearchDescriptor } from '../static/contracts.js';\n\nexport interface ParseSearchOptions<SearchDescriptor = StaticSearchDescriptor> {\n readonly schema?: SearchDescriptor;\n readonly unknownSearch?: UnknownSearchBehavior;\n readonly arrayFormat?: SearchArrayFormat;\n}\n\nexport function parseSearch<const SearchDescriptor extends StaticSearchDescriptor>(\n input: string | URLSearchParams,\n options: ParseSearchOptions<SearchDescriptor> & { readonly schema: SearchDescriptor },\n): InferStaticSearch<SearchDescriptor>;\nexport function parseSearch(\n input: string | URLSearchParams,\n options?: ParseSearchOptions,\n): RawSearchParams;\nexport function parseSearch(\n input: string | URLSearchParams,\n options: ParseSearchOptions = {},\n): RawSearchParams | Record<string, unknown> {\n if (!options.schema) {\n return parseRuntimeSearch(input);\n }\n\n return parseRuntimeSearch(input, {\n schema: compileCachedStaticSearch(options.schema),\n ...(options.unknownSearch ? { unknownSearch: options.unknownSearch } : {}),\n ...(options.arrayFormat ? { arrayFormat: options.arrayFormat } : {}),\n }).search;\n}\n","import type { HashDescriptorInput } from './contracts.js';\nimport { compileHashDescriptor } from './compile-hash-descriptor.js';\nimport { readHashFragment } from './hash-fragment.js';\n\nexport function normalizeHash(input: unknown): string | undefined;\nexport function normalizeHash(input: unknown, descriptor: HashDescriptorInput): unknown;\nexport function normalizeHash(input: unknown, descriptor?: HashDescriptorInput): unknown {\n if (descriptor === undefined) {\n return readHashFragment(input);\n }\n\n return compileHashDescriptor(descriptor).normalize(input);\n}\n"],"names":["buildSearch","omitSearch","patchSearch","pickSearch","replaceSearch","buildRuntimeSearch","patchRuntimeSearch","replaceRuntimeSearch","omitRuntimeSearch","pickRuntimeSearch","parseSearch","parseRuntimeSearch"],"mappings":";;;;;;;;;AAsBM,SAAU,sBAAsB,CAIpC,UAAsB,EACtB,OAAiB,EAAA;IAUjB,OAAO,iBAAiB,CAQtB,yBAAyB,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC;AAC5D;AAwBA,SAAS,yBAAyB,CAIhC,UAAsB,EACtB,OAAgB,EAAA;IAEhB,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,UAAU;AAC3F,IAAA,MAAM,UAAU,GAAG,OAAO,EAAE,MAAM,IAAI,KAAK;AAE3C,IAAA,MAAM,UAAU,GAAG;QACjB,IAAI;AACJ,QAAA,OAAO,EAAE,IAAI,KAAK,MAAM,GAAG,UAAU,CAAC,IAAI,GAAG,SAAS;QACtD,IAAI,IAAI,KAAK,MAAM,IAAI,UAAU,CAAC,IAAI,KAAK;AACzC,cAAE;AACE,gBAAA,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC,IAAI,EAAE;AACjC,oBAAA,MAAM,EAAE,UAAU;AAClB,oBAAA,IAAI,OAAO,EAAE,eAAe,GAAG,EAAE,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC;iBAClF,CAAC;AACH;cACD,EAAE,CAAC;AACP,QAAA,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ;AAC3D,cAAE,EAAE,MAAM,EAAE,mBAAmB,CAAC,UAAU,CAAC,MAAM,IAAI,EAAE,CAA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;"}
|
|
1
|
+
{"version":3,"file":"router-runtime.js","sources":["../src/runtime/create-route-url-contract.ts","../src/search/build-schema-search.ts","../src/search/build-search.ts","../src/search/omit-search.ts","../src/search/parse-partial-schema-search.ts","../src/search/patch-search.ts","../src/search/pick-search.ts","../src/search/replace-search.ts","../src/runtime/compile-cached-static-search.ts","../src/runtime/build-route-search.ts","../src/search/parse-search.ts","../src/runtime/parse-route-search.ts","../src/hash/normalize-hash.ts"],"sourcesContent":["import { compileStaticHash } from '../static/compile-static-hash.js';\nimport { compileStaticSearch } from '../static/compile-static-search.js';\nimport type {\n InferStaticUrlHash,\n InferStaticUrlHashBuildInput,\n InferStaticUrlSearch,\n InferStaticUrlSearchBuildInput,\n StaticUrlDescriptor,\n StaticUrlModeFromDescriptor,\n} from '../static/contracts.js';\nimport { compilePath } from '../url/compile-path.js';\nimport { createUrlContract } from '../url/create-url-contract.js';\nimport type {\n NormalizedUrlDescriptor,\n ParamsFromPattern,\n PathnameFromPattern,\n RawParamsFromPattern,\n UrlContract,\n} from '../url/contracts.js';\nimport type { EmptyParams } from '../contracts.js';\nimport type { CreateRouteUrlContractOptions } from './contracts.js';\n\nexport function createRouteUrlContract<\n const Descriptor extends StaticUrlDescriptor,\n const Options extends CreateRouteUrlContractOptions | undefined = undefined,\n>(\n descriptor: Descriptor,\n options?: Options,\n): UrlContract<\n StaticUrlModeFromDescriptor<Descriptor>,\n RoutePathnameFromDescriptor<Descriptor>,\n RouteParamsFromDescriptor<Descriptor, Options>,\n InferStaticUrlSearch<Descriptor>,\n InferStaticUrlHash<Descriptor>,\n InferStaticUrlSearchBuildInput<Descriptor>,\n InferStaticUrlHashBuildInput<Descriptor>\n> {\n return createUrlContract<\n StaticUrlModeFromDescriptor<Descriptor>,\n RoutePathnameFromDescriptor<Descriptor>,\n RouteParamsFromDescriptor<Descriptor, Options>,\n InferStaticUrlSearch<Descriptor>,\n InferStaticUrlHash<Descriptor>,\n InferStaticUrlSearchBuildInput<Descriptor>,\n InferStaticUrlHashBuildInput<Descriptor>\n >(compileRouteUrlDescriptor(descriptor, options), options);\n}\n\nexport type RoutePathnameFromDescriptor<Descriptor extends StaticUrlDescriptor> =\n Descriptor extends {\n readonly path: infer Pattern extends string;\n }\n ? PathnameFromPattern<Pattern>\n : string;\n\nexport type RouteParamsFromDescriptor<\n Descriptor extends StaticUrlDescriptor,\n Options extends CreateRouteUrlContractOptions | undefined,\n> = Descriptor extends { readonly path: infer Pattern extends string }\n ? RouteParamsMode<Options> extends 'parsed'\n ? ParamsFromPattern<Pattern>\n : RawParamsFromPattern<Pattern>\n : EmptyParams;\n\ntype RouteParamsMode<Options extends CreateRouteUrlContractOptions | undefined> = Options extends {\n readonly params: 'parsed';\n}\n ? 'parsed'\n : 'raw';\n\nfunction compileRouteUrlDescriptor<\n Descriptor extends StaticUrlDescriptor,\n Options extends CreateRouteUrlContractOptions | undefined,\n>(\n descriptor: Descriptor,\n options: Options,\n): NormalizedUrlDescriptor<StaticUrlModeFromDescriptor<Descriptor>> {\n const mode = Object.prototype.hasOwnProperty.call(descriptor, 'path') ? 'path' : 'pathless';\n const paramsMode = options?.params ?? 'raw';\n\n const normalized = {\n mode,\n pattern: mode === 'path' ? descriptor.path : undefined,\n ...(mode === 'path' && descriptor.path !== undefined\n ? {\n path: compilePath(descriptor.path, {\n params: paramsMode,\n ...(options?.pathConstraints ? { pathConstraints: options.pathConstraints } : {}),\n }),\n }\n : {}),\n ...(Object.prototype.hasOwnProperty.call(descriptor, 'search')\n ? { search: compileStaticSearch(descriptor.search ?? {}) }\n : {}),\n ...(Object.prototype.hasOwnProperty.call(descriptor, 'hash') && descriptor.hash !== undefined\n ? { hash: compileStaticHash(descriptor.hash) }\n : {}),\n } as NormalizedUrlDescriptor<StaticUrlModeFromDescriptor<Descriptor>>;\n\n return Object.freeze(normalized);\n}\n","import type { BuildSearchOptions } from '../contracts.js';\nimport { compileSearchSchema } from './compile-search-schema.js';\nimport type { RuntimeSearchSchema } from './contracts.js';\nimport { buildCompiledSearch } from './build-compiled-search.js';\n\nexport function buildSchemaSearch(\n input: Record<string, unknown> = {},\n schema: RuntimeSearchSchema,\n options: BuildSearchOptions = {},\n): string {\n return buildCompiledSearch(input, compileSearchSchema(schema), options);\n}\n","import type { BuildSearchOptions, SearchInputArgument } from '../contracts.js';\nimport type {\n InferRuntimeSearchBuildInput,\n RuntimeSearchSchema,\n SearchBuildOptions,\n} from './contracts.js';\nimport { buildRawSearch } from './build-raw-search.js';\nimport { buildSchemaSearch } from './build-schema-search.js';\n\nexport function buildSearch<const Schema extends RuntimeSearchSchema>(\n input: SearchInputArgument<InferRuntimeSearchBuildInput<Schema>>,\n options: SearchBuildOptions<Schema> & { readonly schema: Schema },\n): string;\nexport function buildSearch(input?: Record<string, unknown>, options?: BuildSearchOptions): string;\nexport function buildSearch(\n input: Record<string, unknown> | undefined = {},\n options: SearchBuildOptions<RuntimeSearchSchema> = {},\n): string {\n if (options.schema) {\n return buildSchemaSearch(input, options.schema, options);\n }\n\n return buildRawSearch(input, options);\n}\n","import { buildRawSearch } from './build-raw-search.js';\nimport { omitRawSearch } from './filter-raw-search.js';\nimport { parseRawSearch } from './parse-raw-search.js';\n\nexport function omitSearch(current: string | URLSearchParams, keys: readonly string[]): string {\n return buildRawSearch(omitRawSearch(parseRawSearch(current), keys));\n}\n","import type {\n RawSearchParams,\n RawSearchValue,\n RuntimeSearchSchema,\n SearchParseOptions,\n} from './contracts.js';\nimport { compileSearchSchema } from './compile-search-schema.js';\nimport { copyRawSearchParams } from './copy-raw-search-params.js';\nimport { parseSearchFieldValue } from './parse-search-field-value.js';\nimport { deleteSearchFieldRawKeys } from './delete-search-field-raw-keys.js';\nimport { hasSearchFieldRawValue } from './has-search-field-raw-value.js';\n\nexport interface PartialSchemaSearchParseResult {\n readonly search: Record<string, unknown>;\n readonly unknownSearch: RawSearchParams;\n}\n\nexport function parsePartialSchemaSearch(\n rawSearch: RawSearchParams,\n schema: RuntimeSearchSchema,\n options: SearchParseOptions = {},\n): PartialSchemaSearchParseResult {\n const compiled = compileSearchSchema(schema);\n const remainingUnknown = { ...rawSearch } satisfies Record<string, RawSearchValue>;\n const search: Record<string, unknown> = {};\n\n for (const field of compiled.fields) {\n if (!hasSearchFieldRawValue(field, rawSearch)) {\n continue;\n }\n\n const value = parseSearchFieldValue(field, rawSearch, options);\n deleteSearchFieldRawKeys(field, remainingUnknown);\n\n if (value !== undefined) {\n search[field.key] = value;\n }\n }\n\n return Object.freeze({\n search: Object.freeze(search),\n unknownSearch: copyRawSearchParams(remainingUnknown),\n });\n}\n","import type { BuildSearchOptions, PatchSearchOptions } from '../contracts.js';\nimport type {\n InferRuntimeSearch,\n RawSearchValue,\n RuntimeSearchSchema,\n SearchPatchOptions,\n} from './contracts.js';\nimport { buildRawSearch } from './build-raw-search.js';\nimport { buildSchemaSearch } from './build-schema-search.js';\nimport { compileSearchSchema } from './compile-search-schema.js';\nimport { copyRawSearchParams } from './copy-raw-search-params.js';\nimport { joinSearchStrings } from './join-search-strings.js';\nimport { parsePartialSchemaSearch } from './parse-partial-schema-search.js';\nimport { parseRawSearch } from './parse-raw-search.js';\n\nexport function patchSearch<const Schema extends RuntimeSearchSchema>(\n current: string | URLSearchParams,\n patch: Partial<InferRuntimeSearch<Schema>>,\n options: SearchPatchOptions<Schema> & { readonly schema: Schema },\n): string;\nexport function patchSearch(\n current: string | URLSearchParams,\n patch: Record<string, unknown>,\n options?: PatchSearchOptions,\n): string;\nexport function patchSearch(\n current: string | URLSearchParams,\n patch: Record<string, unknown>,\n options: SearchPatchOptions<RuntimeSearchSchema> = {},\n): string {\n if (options.schema) {\n return patchSchemaSearch(current, patch, options.schema, options);\n }\n\n return patchRawSearch(current, patch, options);\n}\n\nfunction patchRawSearch(\n current: string | URLSearchParams,\n patch: Record<string, unknown>,\n options: PatchSearchOptions,\n): string {\n const merged: Record<string, RawSearchValue> = { ...parseRawSearch(current) };\n\n for (const [key, value] of Object.entries(patch)) {\n if (shouldRemoveUndefined(value, options) || shouldRemoveNull(value, options)) {\n delete merged[key];\n continue;\n }\n\n if (value === undefined || value === null) {\n continue;\n }\n\n merged[key] = toRawSearchValue(value);\n }\n\n return buildRawSearch(merged, options);\n}\n\nfunction patchSchemaSearch(\n current: string | URLSearchParams,\n patch: Record<string, unknown>,\n schema: RuntimeSearchSchema,\n options: SearchPatchOptions<RuntimeSearchSchema>,\n): string {\n const compiled = compileSearchSchema(schema);\n const schemaKeys = compiled.keys;\n const currentParsed = parsePartialSchemaSearch(parseRawSearch(current), schema, options);\n const mergedSearch: Record<string, unknown> = { ...currentParsed.search };\n const unknownSearch: Record<string, RawSearchValue> = {\n ...copyRawSearchParams(currentParsed.unknownSearch),\n };\n\n for (const [key, value] of Object.entries(patch)) {\n if (shouldRemoveUndefined(value, options) || shouldRemoveNull(value, options)) {\n delete mergedSearch[key];\n delete unknownSearch[key];\n continue;\n }\n\n if (value === undefined || value === null) {\n continue;\n }\n\n if (schemaKeys.has(key)) {\n mergedSearch[key] = value;\n }\n }\n\n return joinSearchStrings(\n buildSchemaSearch(mergedSearch, schema, options as BuildSearchOptions),\n buildRawSearch(unknownSearch, options),\n );\n}\n\nfunction shouldRemoveUndefined(value: unknown, options: PatchSearchOptions): boolean {\n return value === undefined && options.removeUndefined === true;\n}\n\nfunction shouldRemoveNull(value: unknown, options: PatchSearchOptions): boolean {\n return value === null && options.removeNull === true;\n}\n\nfunction toRawSearchValue(value: unknown): RawSearchValue {\n if (Array.isArray(value)) {\n return Object.freeze(value.filter(isPresent).map(String));\n }\n\n return String(value);\n}\n\nfunction isPresent(value: unknown): boolean {\n return value !== undefined && value !== null;\n}\n","import { buildRawSearch } from './build-raw-search.js';\nimport { pickRawSearch } from './filter-raw-search.js';\nimport { parseRawSearch } from './parse-raw-search.js';\n\nexport function pickSearch(current: string | URLSearchParams, keys: readonly string[]): string {\n return buildRawSearch(pickRawSearch(parseRawSearch(current), keys));\n}\n","import type {\n InferRuntimeSearchBuildInput,\n RuntimeSearchSchema,\n SearchBuildOptions,\n} from './contracts.js';\nimport { buildSearch } from './build-search.js';\n\nexport function replaceSearch<const Schema extends RuntimeSearchSchema>(\n current: string | URLSearchParams,\n next: InferRuntimeSearchBuildInput<Schema>,\n options: SearchBuildOptions<Schema> & { readonly schema: Schema },\n): string;\nexport function replaceSearch(\n current: string | URLSearchParams,\n next: Record<string, unknown>,\n options?: SearchBuildOptions,\n): string;\nexport function replaceSearch(\n _current: string | URLSearchParams,\n next: object,\n options: SearchBuildOptions = {},\n): string {\n return buildSearch(next as Record<string, unknown>, options);\n}\n","import type { RuntimeSearchSchema } from '../search/contracts.js';\nimport { compileStaticSearch } from '../static/compile-static-search.js';\nimport type { StaticSearchDescriptor } from '../static/contracts.js';\n\nconst staticSearchCache = new WeakMap<StaticSearchDescriptor, RuntimeSearchSchema>();\n\nexport function compileCachedStaticSearch(schema: StaticSearchDescriptor): RuntimeSearchSchema {\n const cached = staticSearchCache.get(schema);\n\n if (cached) {\n return cached;\n }\n\n const compiled = compileStaticSearch(schema);\n staticSearchCache.set(schema, compiled);\n\n return compiled;\n}\n","import type { BuildSearchOptions, PatchSearchOptions, SearchInputArgument } from '../contracts.js';\nimport { buildSearch as buildRuntimeSearch } from '../search/build-search.js';\nimport { omitSearch as omitRuntimeSearch } from '../search/omit-search.js';\nimport { patchSearch as patchRuntimeSearch } from '../search/patch-search.js';\nimport { pickSearch as pickRuntimeSearch } from '../search/pick-search.js';\nimport { replaceSearch as replaceRuntimeSearch } from '../search/replace-search.js';\nimport { compileCachedStaticSearch } from './compile-cached-static-search.js';\nimport type {\n InferStaticSearch,\n InferStaticSearchBuildInput,\n StaticSearchDescriptor,\n} from '../static/contracts.js';\n\nexport interface BuildRouteSearchOptions<\n SearchDescriptor = StaticSearchDescriptor,\n> extends BuildSearchOptions {\n readonly schema?: SearchDescriptor;\n}\n\nexport interface PatchRouteSearchOptions<\n SearchDescriptor = StaticSearchDescriptor,\n> extends PatchSearchOptions {\n readonly schema?: SearchDescriptor;\n}\n\nexport function buildSearch<const SearchDescriptor extends StaticSearchDescriptor>(\n input: SearchInputArgument<InferStaticSearchBuildInput<SearchDescriptor>>,\n options: BuildRouteSearchOptions<SearchDescriptor> & { readonly schema: SearchDescriptor },\n): string;\nexport function buildSearch(input?: Record<string, unknown>, options?: BuildSearchOptions): string;\nexport function buildSearch(\n input: Record<string, unknown> | undefined = {},\n options: BuildRouteSearchOptions = {},\n): string {\n if (!options.schema) {\n return buildRuntimeSearch(input, options);\n }\n\n return buildRuntimeSearch(input, {\n ...options,\n schema: compileCachedStaticSearch(options.schema),\n });\n}\n\nexport function patchSearch<const SearchDescriptor extends StaticSearchDescriptor>(\n current: string | URLSearchParams,\n patch: Partial<InferStaticSearch<SearchDescriptor>>,\n options: PatchRouteSearchOptions<SearchDescriptor> & { readonly schema: SearchDescriptor },\n): string;\nexport function patchSearch(\n current: string | URLSearchParams,\n patch: Record<string, unknown>,\n options?: PatchSearchOptions,\n): string;\nexport function patchSearch(\n current: string | URLSearchParams,\n patch: Record<string, unknown>,\n options: PatchRouteSearchOptions = {},\n): string {\n if (!options.schema) {\n return patchRuntimeSearch(current, patch, options);\n }\n\n return patchRuntimeSearch(current, patch, {\n ...options,\n schema: compileCachedStaticSearch(options.schema),\n });\n}\n\nexport function replaceSearch<const SearchDescriptor extends StaticSearchDescriptor>(\n current: string | URLSearchParams,\n next: InferStaticSearchBuildInput<SearchDescriptor>,\n options: BuildRouteSearchOptions<SearchDescriptor> & { readonly schema: SearchDescriptor },\n): string;\nexport function replaceSearch(\n current: string | URLSearchParams,\n next: Record<string, unknown>,\n options?: BuildSearchOptions,\n): string;\nexport function replaceSearch(\n current: string | URLSearchParams,\n next: Record<string, unknown>,\n options: BuildRouteSearchOptions = {},\n): string {\n if (!options.schema) {\n return replaceRuntimeSearch(current, next, options);\n }\n\n return replaceRuntimeSearch(current, next, {\n ...options,\n schema: compileCachedStaticSearch(options.schema),\n });\n}\n\nexport function omitSearch(current: string | URLSearchParams, keys: readonly string[]): string {\n return omitRuntimeSearch(current, keys);\n}\n\nexport function pickSearch(current: string | URLSearchParams, keys: readonly string[]): string {\n return pickRuntimeSearch(current, keys);\n}\n","import type {\n InferRuntimeSearch,\n ParseSearchOptions,\n RawSearchParams,\n RuntimeSearchSchema,\n SearchParseResult,\n} from './contracts.js';\nimport { compileSearchSchema } from './compile-search-schema.js';\nimport { parseRawSearch } from './parse-raw-search.js';\nimport { parseCompiledSearch } from './parse-compiled-search.js';\n\nexport function parseSearch(input: string | URLSearchParams): RawSearchParams;\nexport function parseSearch<const Schema extends RuntimeSearchSchema>(\n input: string | URLSearchParams,\n options: ParseSearchOptions<Schema> & { readonly schema: Schema },\n): SearchParseResult<InferRuntimeSearch<Schema>>;\nexport function parseSearch(\n input: string | URLSearchParams,\n options?: ParseSearchOptions<RuntimeSearchSchema>,\n): RawSearchParams | SearchParseResult<Record<string, unknown>> {\n const rawSearch = parseRawSearch(input);\n\n if (!options?.schema) {\n return rawSearch;\n }\n\n return parseSchemaSearch(rawSearch, options.schema, options);\n}\n\nfunction parseSchemaSearch(\n rawSearch: RawSearchParams,\n schema: RuntimeSearchSchema,\n options: ParseSearchOptions,\n): SearchParseResult<Record<string, unknown>> {\n return parseCompiledSearch(\n rawSearch,\n compileSearchSchema(schema),\n options.unknownSearch ?? 'strip',\n options.arrayFormat ? { arrayFormat: options.arrayFormat } : {},\n );\n}\n","import type { SearchArrayFormat, UnknownSearchBehavior } from '../contracts.js';\nimport { parseSearch as parseRuntimeSearch } from '../search/parse-search.js';\nimport type { RawSearchParams } from '../search/contracts.js';\nimport { compileCachedStaticSearch } from './compile-cached-static-search.js';\nimport type { InferStaticSearch, StaticSearchDescriptor } from '../static/contracts.js';\n\nexport interface ParseSearchOptions<SearchDescriptor = StaticSearchDescriptor> {\n readonly schema?: SearchDescriptor;\n readonly unknownSearch?: UnknownSearchBehavior;\n readonly arrayFormat?: SearchArrayFormat;\n}\n\nexport function parseSearch<const SearchDescriptor extends StaticSearchDescriptor>(\n input: string | URLSearchParams,\n options: ParseSearchOptions<SearchDescriptor> & { readonly schema: SearchDescriptor },\n): InferStaticSearch<SearchDescriptor>;\nexport function parseSearch(\n input: string | URLSearchParams,\n options?: ParseSearchOptions,\n): RawSearchParams;\nexport function parseSearch(\n input: string | URLSearchParams,\n options: ParseSearchOptions = {},\n): RawSearchParams | Record<string, unknown> {\n if (!options.schema) {\n return parseRuntimeSearch(input);\n }\n\n return parseRuntimeSearch(input, {\n schema: compileCachedStaticSearch(options.schema),\n ...(options.unknownSearch ? { unknownSearch: options.unknownSearch } : {}),\n ...(options.arrayFormat ? { arrayFormat: options.arrayFormat } : {}),\n }).search;\n}\n","import type { HashDescriptorInput } from './contracts.js';\nimport { compileHashDescriptor } from './compile-hash-descriptor.js';\nimport { readHashFragment } from './hash-fragment.js';\n\nexport function normalizeHash(input: unknown): string | undefined;\nexport function normalizeHash(input: unknown, descriptor: HashDescriptorInput): unknown;\nexport function normalizeHash(input: unknown, descriptor?: HashDescriptorInput): unknown {\n if (descriptor === undefined) {\n return readHashFragment(input);\n }\n\n return compileHashDescriptor(descriptor).normalize(input);\n}\n"],"names":["buildSearch","omitSearch","patchSearch","pickSearch","replaceSearch","buildRuntimeSearch","patchRuntimeSearch","replaceRuntimeSearch","omitRuntimeSearch","pickRuntimeSearch","parseSearch","parseRuntimeSearch"],"mappings":";;;;;;;;;;AAsBM,SAAU,sBAAsB,CAIpC,UAAsB,EACtB,OAAiB,EAAA;IAUjB,OAAO,iBAAiB,CAQtB,yBAAyB,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC;AAC5D;AAwBA,SAAS,yBAAyB,CAIhC,UAAsB,EACtB,OAAgB,EAAA;IAEhB,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,UAAU;AAC3F,IAAA,MAAM,UAAU,GAAG,OAAO,EAAE,MAAM,IAAI,KAAK;AAE3C,IAAA,M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AAC;IAClC;IAEA,OAAOA,aAAkB,CAAC,KAAK,EAAE;AAC/B,QAAA,MAAM,EAAE,yBAAyB,CAAC,OAAO,CAAC,MAAM,CAAC;AACjD,QAAA,IAAI,OAAO,CAAC,aAAa,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC;AAC1E,QAAA,IAAI,OAAO,CAAC,WAAW,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC;KACrE,CAAC,CAAC,MAAM;AACX;;AC3BM,SAAU,aAAa,CAAC,KAAc,EAAE,UAAgC,EAAA;AAC5E,IAAA,IAAI,UAAU,KAAK,SAAS,EAAE;AAC5B,QAAA,OAAO,gBAAgB,CAAC,KAAK,CAAC;IAChC;IAEA,OAAO,qBAAqB,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC;AAC3D;;;;"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import type { DateFormatCodec, DateFormatString } from '../date/contracts.js';
|
|
1
2
|
import type { DateSchema } from './date.js';
|
|
2
|
-
export
|
|
3
|
+
export type DateTimeFormat = 'date-time' | DateFormatString | DateFormatCodec;
|
|
4
|
+
export interface DateTimeSchema<Format extends DateTimeFormat = 'date-time'> extends DateSchema<Format> {
|
|
5
|
+
}
|
|
6
|
+
export interface DateTimeOptions<Format extends DateTimeFormat = 'date-time'> {
|
|
7
|
+
readonly format?: Format;
|
|
3
8
|
}
|
|
4
9
|
export declare function dateTime(): DateTimeSchema;
|
|
10
|
+
export declare function dateTime<const Format extends DateTimeFormat>(options: DateTimeOptions<Format>): DateTimeSchema<Format>;
|
package/dist/schema/date.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { DateFormatCodec } from '../date/contracts.js';
|
|
1
|
+
import type { DateFormatCodec, DateFormatString } from '../date/contracts.js';
|
|
2
2
|
import type { RequiredRuntimeSchemaDescriptor, RuntimeSchemaBuilder, RuntimeSchemaOptions } from './contracts.js';
|
|
3
3
|
export type BuiltInRuntimeDateFormat = 'date' | 'date-time' | 'unix-seconds' | 'unix-ms';
|
|
4
|
-
export type RuntimeDateFormat = BuiltInRuntimeDateFormat | DateFormatCodec;
|
|
4
|
+
export type RuntimeDateFormat = BuiltInRuntimeDateFormat | DateFormatString | DateFormatCodec;
|
|
5
5
|
export interface DateSchemaOptions<Format extends RuntimeDateFormat = RuntimeDateFormat> extends RuntimeSchemaOptions {
|
|
6
6
|
readonly format: Format;
|
|
7
7
|
}
|
package/dist/static.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { a as compilePath, U as UrlKitError } from './compile-path-
|
|
2
|
-
export { h as hasPathConstraint, r as registerPathConstraint, f as registerPathConstraints } from './compile-path-
|
|
1
|
+
import { a as compilePath, U as UrlKitError } from './compile-path-oMMfpXR8.js';
|
|
2
|
+
export { h as hasPathConstraint, r as registerPathConstraint, f as registerPathConstraints } from './compile-path-oMMfpXR8.js';
|
|
3
3
|
export { createConstraint } from '@cookbook/pathkit/constraints';
|
|
4
|
-
import { c as compileStaticHash, a as compileStaticSearch } from './compile-static-search-
|
|
4
|
+
import { c as compileStaticHash, a as compileStaticSearch } from './compile-static-search-c2f2FB_l.js';
|
|
5
5
|
import '@cookbook/pathkit/compile';
|
|
6
6
|
import '@cookbook/pathkit/match';
|
|
7
|
+
import '@cookbook/pathkit/tokenize';
|
|
7
8
|
|
|
8
9
|
function compileStaticUrl(descriptor, options = {}) {
|
|
9
10
|
assertStaticUrlDescriptor(descriptor);
|
package/dist/static.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static.js","sources":["../src/static/compile-static-url.ts"],"sourcesContent":["import { UrlKitError } from '../errors/url-kit-error.js';\nimport type { NormalizedUrlDescriptor } from '../url/contracts.js';\nimport type {\n CompileStaticUrlOptions,\n StaticUrlDescriptor,\n StaticUrlModeFromDescriptor,\n} from './contracts.js';\nimport { compilePath } from '../url/compile-path.js';\nimport { compileStaticHash } from './compile-static-hash.js';\nimport { compileStaticSearch } from './compile-static-search.js';\n\nexport function compileStaticUrl<Descriptor extends StaticUrlDescriptor>(\n descriptor: Descriptor,\n options: CompileStaticUrlOptions = {},\n): NormalizedUrlDescriptor<StaticUrlModeFromDescriptor<Descriptor>> {\n assertStaticUrlDescriptor(descriptor);\n\n const mode = Object.prototype.hasOwnProperty.call(descriptor, 'path') ? 'path' : 'pathless';\n const normalized = {\n mode,\n pattern: mode === 'path' ? descriptor.path : undefined,\n ...(mode === 'path' && descriptor.path !== undefined\n ? {\n path: compilePath(descriptor.path, {\n params: 'parsed',\n ...(options.pathConstraints ? { pathConstraints: options.pathConstraints } : {}),\n }),\n }\n : {}),\n ...(Object.prototype.hasOwnProperty.call(descriptor, 'search')\n ? { search: compileStaticSearch(descriptor.search ?? {}) }\n : {}),\n ...(Object.prototype.hasOwnProperty.call(descriptor, 'hash') && descriptor.hash !== undefined\n ? { hash: compileStaticHash(descriptor.hash) }\n : {}),\n } as NormalizedUrlDescriptor<StaticUrlModeFromDescriptor<Descriptor>>;\n\n return Object.freeze(normalized);\n}\n\nfunction assertStaticUrlDescriptor(input: unknown): asserts input is StaticUrlDescriptor {\n if (!isRecord(input)) {\n throw new UrlKitError('invalid-descriptor', 'Static URL descriptor must be an object.', {\n path: [],\n });\n }\n\n if (Object.prototype.hasOwnProperty.call(input, 'path') && typeof input.path !== 'string') {\n throw new UrlKitError('invalid-descriptor', 'Static URL descriptor path must be a string.', {\n path: ['path'],\n });\n }\n\n if (\n Object.prototype.hasOwnProperty.call(input, 'search') &&\n input.search !== undefined &&\n !isRecord(input.search)\n ) {\n throw new UrlKitError('invalid-descriptor', 'Static URL descriptor search must be an object.', {\n path: ['search'],\n });\n }\n}\n\nfunction isRecord(input: unknown): input is Record<string, unknown> {\n return typeof input === 'object' && input !== null && !Array.isArray(input);\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"static.js","sources":["../src/static/compile-static-url.ts"],"sourcesContent":["import { UrlKitError } from '../errors/url-kit-error.js';\nimport type { NormalizedUrlDescriptor } from '../url/contracts.js';\nimport type {\n CompileStaticUrlOptions,\n StaticUrlDescriptor,\n StaticUrlModeFromDescriptor,\n} from './contracts.js';\nimport { compilePath } from '../url/compile-path.js';\nimport { compileStaticHash } from './compile-static-hash.js';\nimport { compileStaticSearch } from './compile-static-search.js';\n\nexport function compileStaticUrl<Descriptor extends StaticUrlDescriptor>(\n descriptor: Descriptor,\n options: CompileStaticUrlOptions = {},\n): NormalizedUrlDescriptor<StaticUrlModeFromDescriptor<Descriptor>> {\n assertStaticUrlDescriptor(descriptor);\n\n const mode = Object.prototype.hasOwnProperty.call(descriptor, 'path') ? 'path' : 'pathless';\n const normalized = {\n mode,\n pattern: mode === 'path' ? descriptor.path : undefined,\n ...(mode === 'path' && descriptor.path !== undefined\n ? {\n path: compilePath(descriptor.path, {\n params: 'parsed',\n ...(options.pathConstraints ? { pathConstraints: options.pathConstraints } : {}),\n }),\n }\n : {}),\n ...(Object.prototype.hasOwnProperty.call(descriptor, 'search')\n ? { search: compileStaticSearch(descriptor.search ?? {}) }\n : {}),\n ...(Object.prototype.hasOwnProperty.call(descriptor, 'hash') && descriptor.hash !== undefined\n ? { hash: compileStaticHash(descriptor.hash) }\n : {}),\n } as NormalizedUrlDescriptor<StaticUrlModeFromDescriptor<Descriptor>>;\n\n return Object.freeze(normalized);\n}\n\nfunction assertStaticUrlDescriptor(input: unknown): asserts input is StaticUrlDescriptor {\n if (!isRecord(input)) {\n throw new UrlKitError('invalid-descriptor', 'Static URL descriptor must be an object.', {\n path: [],\n });\n }\n\n if (Object.prototype.hasOwnProperty.call(input, 'path') && typeof input.path !== 'string') {\n throw new UrlKitError('invalid-descriptor', 'Static URL descriptor path must be a string.', {\n path: ['path'],\n });\n }\n\n if (\n Object.prototype.hasOwnProperty.call(input, 'search') &&\n input.search !== undefined &&\n !isRecord(input.search)\n ) {\n throw new UrlKitError('invalid-descriptor', 'Static URL descriptor search must be an object.', {\n path: ['search'],\n });\n }\n}\n\nfunction isRecord(input: unknown): input is Record<string, unknown> {\n return typeof input === 'object' && input !== null && !Array.isArray(input);\n}\n"],"names":[],"mappings":";;;;;;;;SAWgB,gBAAgB,CAC9B,UAAsB,EACtB,UAAmC,EAAE,EAAA;IAErC,yBAAyB,CAAC,UAAU,CAAC;IAErC,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,UAAU;AAC3F,IAAA,MAAM,UAAU,GAAG;QACjB,IAAI;AACJ,QAAA,OAAO,EAAE,IAAI,KAAK,MAAM,GAAG,UAAU,CAAC,IAAI,GAAG,SAAS;QACtD,IAAI,IAAI,KAAK,MAAM,IAAI,UAAU,CAAC,IAAI,KAAK;AACzC,cAAE;AACE,gBAAA,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC,IAAI,EAAE;AACjC,oBAAA,MAAM,EAAE,QAAQ;AAChB,oBAAA,IAAI,OAAO,CAAC,eAAe,GAAG,EAAE,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC;iBACjF,CAAC;AACH;cACD,EAAE,CAAC;AACP,QAAA,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ;AAC3D,cAAE,EAAE,MAAM,EAAE,mBAAmB,CAAC,UAAU,CAAC,MAAM,IAAI,EAAE,CAAC;cACtD,EAAE,CAAC;AACP,QAAA,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,KAAK;cAChF,EAAE,IAAI,EAAE,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC;cAC1C,EAAE,CAAC;KAC4D;AAErE,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;AAClC;AAEA,SAAS,yBAAyB,CAAC,KAAc,EAAA;AAC/C,IAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACpB,QAAA,MAAM,IAAI,WAAW,CAAC,oBAAoB,EAAE,0CAA0C,EAAE;AACtF,YAAA,IAAI,EAAE,EAAE;AACT,SAAA,CAAC;IACJ;IAEA,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;AACzF,QAAA,MAAM,IAAI,WAAW,CAAC,oBAAoB,EAAE,8CAA8C,EAAE;YAC1F,IAAI,EAAE,CAAC,MAAM,CAAC;AACf,SAAA,CAAC;IACJ;IAEA,IACE,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC;QACrD,KAAK,CAAC,MAAM,KAAK,SAAS;AAC1B,QAAA,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EACvB;AACA,QAAA,MAAM,IAAI,WAAW,CAAC,oBAAoB,EAAE,iDAAiD,EAAE;YAC7F,IAAI,EAAE,CAAC,QAAQ,CAAC;AACjB,SAAA,CAAC;IACJ;AACF;AAEA,SAAS,QAAQ,CAAC,KAAc,EAAA;AAC9B,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAC7E;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { ParsedPathParamSegment } from './path-segment.js';
|
|
2
|
-
export type PathParamKind = 'string' | 'int' | '
|
|
2
|
+
export type PathParamKind = 'string' | 'int' | 'decimal' | 'range' | 'regex';
|
|
3
3
|
export declare function getPathParamKind(segment: ParsedPathParamSegment): PathParamKind;
|
|
4
|
+
export declare function isNumericPathParamKind(kind: PathParamKind): kind is 'int' | 'decimal' | 'range';
|
package/package.json
CHANGED