@cookbook/urlkit 1.0.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.
Files changed (157) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +707 -0
  3. package/dist/compile-path-wQfWAzOh.js +1318 -0
  4. package/dist/compile-path-wQfWAzOh.js.map +1 -0
  5. package/dist/compile-static-search-Cq3uaLe8.js +238 -0
  6. package/dist/compile-static-search-Cq3uaLe8.js.map +1 -0
  7. package/dist/contracts.d.ts +107 -0
  8. package/dist/create-url-contract-BYKPM9bn.js +1751 -0
  9. package/dist/create-url-contract-BYKPM9bn.js.map +1 -0
  10. package/dist/date/contracts.d.ts +5 -0
  11. package/dist/date/parse-custom-date.d.ts +7 -0
  12. package/dist/date/parse-date-time.d.ts +6 -0
  13. package/dist/date/parse-date.d.ts +6 -0
  14. package/dist/date/parse-unix-ms.d.ts +6 -0
  15. package/dist/date/parse-unix-seconds.d.ts +6 -0
  16. package/dist/date/serialize-custom-date.d.ts +7 -0
  17. package/dist/date/serialize-date-time.d.ts +6 -0
  18. package/dist/date/serialize-date.d.ts +6 -0
  19. package/dist/date/serialize-unix-ms.d.ts +6 -0
  20. package/dist/date/serialize-unix-seconds.d.ts +6 -0
  21. package/dist/errors/contracts.d.ts +5 -0
  22. package/dist/errors/url-kit-error.d.ts +8 -0
  23. package/dist/hash/build-hash.d.ts +4 -0
  24. package/dist/hash/compile-hash-descriptor.d.ts +2 -0
  25. package/dist/hash/compile-normalized-hash-descriptor.d.ts +2 -0
  26. package/dist/hash/compile-runtime-hash-descriptor.d.ts +3 -0
  27. package/dist/hash/compile-static-hash-descriptor.d.ts +3 -0
  28. package/dist/hash/contracts.d.ts +21 -0
  29. package/dist/hash/copy-normalized-hash-descriptor.d.ts +2 -0
  30. package/dist/hash/create-hash.d.ts +5 -0
  31. package/dist/hash/hash-fragment.d.ts +2 -0
  32. package/dist/hash/is-normalized-hash-descriptor.d.ts +2 -0
  33. package/dist/hash/normalize-hash.d.ts +3 -0
  34. package/dist/hash/parse-hash.d.ts +3 -0
  35. package/dist/hash/validate-normalized-hash-value.d.ts +5 -0
  36. package/dist/index.d.ts +21 -0
  37. package/dist/index.js +73 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/router-runtime.d.ts +12 -0
  40. package/dist/router-runtime.js +214 -0
  41. package/dist/router-runtime.js.map +1 -0
  42. package/dist/runtime/build-route-search.d.ts +22 -0
  43. package/dist/runtime/compile-cached-static-search.d.ts +3 -0
  44. package/dist/runtime/contracts.d.ts +7 -0
  45. package/dist/runtime/create-route-url-contract.d.ts +15 -0
  46. package/dist/runtime/parse-route-search.d.ts +12 -0
  47. package/dist/schema/array.d.ts +9 -0
  48. package/dist/schema/boolean.d.ts +4 -0
  49. package/dist/schema/compile-runtime-schema-value.d.ts +6 -0
  50. package/dist/schema/compile-runtime-schema.d.ts +2 -0
  51. package/dist/schema/contracts.d.ts +87 -0
  52. package/dist/schema/create-schema-builder.d.ts +2 -0
  53. package/dist/schema/create-schema-value-error.d.ts +3 -0
  54. package/dist/schema/date-time.d.ts +4 -0
  55. package/dist/schema/date.d.ts +14 -0
  56. package/dist/schema/enum-of.d.ts +7 -0
  57. package/dist/schema/get-runtime-schema-internals.d.ts +2 -0
  58. package/dist/schema/handle-runtime-schema-absence.d.ts +6 -0
  59. package/dist/schema/int.d.ts +4 -0
  60. package/dist/schema/is-runtime-schema-kind.d.ts +2 -0
  61. package/dist/schema/normalize-compiled-runtime-schema-value.d.ts +3 -0
  62. package/dist/schema/normalize-runtime-schema-value.d.ts +2 -0
  63. package/dist/schema/number.d.ts +4 -0
  64. package/dist/schema/object.d.ts +20 -0
  65. package/dist/schema/parse-compiled-runtime-schema-value.d.ts +3 -0
  66. package/dist/schema/parse-runtime-schema-value.d.ts +2 -0
  67. package/dist/schema/runtime-schema-symbol.d.ts +5 -0
  68. package/dist/schema/runtime-schema-value-context.d.ts +2 -0
  69. package/dist/schema/safe-runtime-schema-value.d.ts +4 -0
  70. package/dist/schema/serialize-compiled-runtime-schema-value.d.ts +3 -0
  71. package/dist/schema/serialize-runtime-schema-value.d.ts +2 -0
  72. package/dist/schema/string.d.ts +4 -0
  73. package/dist/search/append-object-search-entries.d.ts +4 -0
  74. package/dist/search/append-raw-search-value.d.ts +2 -0
  75. package/dist/search/append-search-entry.d.ts +3 -0
  76. package/dist/search/are-search-values-equal.d.ts +1 -0
  77. package/dist/search/assert-object-search-collisions.d.ts +2 -0
  78. package/dist/search/build-compiled-search.d.ts +3 -0
  79. package/dist/search/build-raw-search.d.ts +2 -0
  80. package/dist/search/build-schema-search.d.ts +3 -0
  81. package/dist/search/build-search.d.ts +6 -0
  82. package/dist/search/collect-object-search-paths.d.ts +2 -0
  83. package/dist/search/compile-search-schema.d.ts +2 -0
  84. package/dist/search/contracts.d.ts +73 -0
  85. package/dist/search/copy-raw-search-params.d.ts +2 -0
  86. package/dist/search/copy-unknown-structured-search.d.ts +2 -0
  87. package/dist/search/create-search-params.d.ts +1 -0
  88. package/dist/search/create-search.d.ts +4 -0
  89. package/dist/search/delete-search-field-raw-keys.d.ts +2 -0
  90. package/dist/search/filter-raw-search.d.ts +3 -0
  91. package/dist/search/find-object-search-raw-value.d.ts +2 -0
  92. package/dist/search/has-search-field-raw-value.d.ts +2 -0
  93. package/dist/search/is-runtime-search-field.d.ts +2 -0
  94. package/dist/search/join-search-strings.d.ts +1 -0
  95. package/dist/search/normalize-compiled-search.d.ts +3 -0
  96. package/dist/search/normalize-search-build-value.d.ts +2 -0
  97. package/dist/search/normalize-search-field-default.d.ts +2 -0
  98. package/dist/search/normalize-search-field-type.d.ts +2 -0
  99. package/dist/search/object-search-key.d.ts +4 -0
  100. package/dist/search/object-search-path-key.d.ts +2 -0
  101. package/dist/search/object-search-raw-key-path.d.ts +1 -0
  102. package/dist/search/omit-search.d.ts +1 -0
  103. package/dist/search/parse-array-search-value.d.ts +4 -0
  104. package/dist/search/parse-compiled-search.d.ts +2 -0
  105. package/dist/search/parse-object-search-value.d.ts +4 -0
  106. package/dist/search/parse-partial-compiled-search.d.ts +6 -0
  107. package/dist/search/parse-partial-schema-search.d.ts +6 -0
  108. package/dist/search/parse-raw-search.d.ts +2 -0
  109. package/dist/search/parse-search-field-value.d.ts +2 -0
  110. package/dist/search/parse-search.d.ts +5 -0
  111. package/dist/search/patch-search.d.ts +6 -0
  112. package/dist/search/pick-search.d.ts +1 -0
  113. package/dist/search/replace-search.d.ts +5 -0
  114. package/dist/search/search-array-format.d.ts +3 -0
  115. package/dist/search/search-entries.d.ts +4 -0
  116. package/dist/search/serialize-search-build-value.d.ts +2 -0
  117. package/dist/search/serialize-search-entries.d.ts +3 -0
  118. package/dist/static/compile-static-hash.d.ts +3 -0
  119. package/dist/static/compile-static-search.d.ts +3 -0
  120. package/dist/static/compile-static-url.d.ts +3 -0
  121. package/dist/static/contracts.d.ts +81 -0
  122. package/dist/static/create-static-search-schema.d.ts +3 -0
  123. package/dist/static/normalize-static-search-default.d.ts +2 -0
  124. package/dist/static/static-search-field-kind.d.ts +4 -0
  125. package/dist/static.d.ts +7 -0
  126. package/dist/static.js +55 -0
  127. package/dist/static.js.map +1 -0
  128. package/dist/url/assert-path-match-failure.d.ts +2 -0
  129. package/dist/url/build-compiled-url.d.ts +3 -0
  130. package/dist/url/build-url.d.ts +3 -0
  131. package/dist/url/coerce-path-param.d.ts +2 -0
  132. package/dist/url/compile-path.d.ts +2 -0
  133. package/dist/url/compile-runtime-url-descriptor.d.ts +2 -0
  134. package/dist/url/compile-url-descriptor.d.ts +13 -0
  135. package/dist/url/contracts.d.ts +91 -0
  136. package/dist/url/create-unsupported-url-method.d.ts +1 -0
  137. package/dist/url/create-url-contract.d.ts +3 -0
  138. package/dist/url/create-url.d.ts +2 -0
  139. package/dist/url/filter-compiled-url-search.d.ts +4 -0
  140. package/dist/url/format-parsed-url.d.ts +2 -0
  141. package/dist/url/match-url.d.ts +3 -0
  142. package/dist/url/normalize-compiled-url.d.ts +3 -0
  143. package/dist/url/normalize-path-build-params.d.ts +1 -0
  144. package/dist/url/normalize-url.d.ts +3 -0
  145. package/dist/url/parse-compiled-url.d.ts +3 -0
  146. package/dist/url/parse-path-pattern.d.ts +2 -0
  147. package/dist/url/parse-request.d.ts +2 -0
  148. package/dist/url/parse-url.d.ts +6 -0
  149. package/dist/url/patch-compiled-url-search.d.ts +3 -0
  150. package/dist/url/path-constraints.d.ts +5 -0
  151. package/dist/url/path-param-kind.d.ts +3 -0
  152. package/dist/url/path-segment.d.ts +11 -0
  153. package/dist/url/register-urlkit-path-constraints.d.ts +1 -0
  154. package/dist/url/replace-compiled-url-search.d.ts +3 -0
  155. package/dist/url/resolve-url-unknown-search.d.ts +3 -0
  156. package/dist/url/url-state-brand.d.ts +7 -0
  157. package/package.json +73 -0
@@ -0,0 +1,14 @@
1
+ import type { DateFormatCodec } from '../date/contracts.js';
2
+ import type { RequiredRuntimeSchemaDescriptor, RuntimeSchemaBuilder, RuntimeSchemaOptions } from './contracts.js';
3
+ export type BuiltInRuntimeDateFormat = 'date' | 'date-time' | 'unix-seconds' | 'unix-ms';
4
+ export type RuntimeDateFormat = BuiltInRuntimeDateFormat | DateFormatCodec;
5
+ export interface DateSchemaOptions<Format extends RuntimeDateFormat = RuntimeDateFormat> extends RuntimeSchemaOptions {
6
+ readonly format: Format;
7
+ }
8
+ export interface DateSchema<Format extends RuntimeDateFormat = 'date'> extends RuntimeSchemaBuilder<Date, 'date', DateSchemaOptions<Format>, RequiredRuntimeSchemaDescriptor<'date', DateSchemaOptions<Format>>> {
9
+ }
10
+ export interface DateOptions<Format extends RuntimeDateFormat = 'date'> {
11
+ readonly format?: Format;
12
+ }
13
+ export declare function date(): DateSchema;
14
+ export declare function date<const Format extends RuntimeDateFormat>(options: DateOptions<Format>): DateSchema<Format>;
@@ -0,0 +1,7 @@
1
+ import type { RequiredRuntimeSchemaDescriptor, RuntimeSchemaBuilder, RuntimeSchemaOptions } from './contracts.js';
2
+ export interface EnumSchemaOptions<Values extends readonly string[]> extends RuntimeSchemaOptions {
3
+ readonly values: Values;
4
+ }
5
+ export interface EnumSchema<Values extends readonly string[]> extends RuntimeSchemaBuilder<Values[number], 'enum', EnumSchemaOptions<Values>, RequiredRuntimeSchemaDescriptor<'enum', EnumSchemaOptions<Values>>> {
6
+ }
7
+ export declare function enumOf<const Values extends readonly string[]>(values: Values): EnumSchema<Values>;
@@ -0,0 +1,2 @@
1
+ import type { NormalizedRuntimeSchemaDescriptor, RuntimeSchemaBuilder, RuntimeSchemaOptions } from './contracts.js';
2
+ export declare function getRuntimeSchemaInternals<Value, Kind extends string, Options extends RuntimeSchemaOptions, Descriptor extends NormalizedRuntimeSchemaDescriptor<Kind, Options>>(schema: RuntimeSchemaBuilder<Value, Kind, Options, Descriptor>): import("./contracts.js").RuntimeSchemaInternals<Value, Kind, Options, Descriptor>;
@@ -0,0 +1,6 @@
1
+ import type { NormalizedRuntimeSchemaDescriptor, RuntimeSchemaOptions, RuntimeSchemaValueOptions } from './contracts.js';
2
+ export interface RuntimeSchemaAbsenceResult<Value> {
3
+ readonly handled: boolean;
4
+ readonly value?: Value | undefined;
5
+ }
6
+ export declare function handleRuntimeSchemaAbsence<Value, Options extends RuntimeSchemaOptions = RuntimeSchemaOptions>(descriptor: NormalizedRuntimeSchemaDescriptor<string, Options, Value>, input: unknown, options?: RuntimeSchemaValueOptions): RuntimeSchemaAbsenceResult<Value>;
@@ -0,0 +1,4 @@
1
+ import type { EmptyRuntimeSchemaOptions, RequiredRuntimeSchemaDescriptor, RuntimeSchemaBuilder } from './contracts.js';
2
+ export interface IntSchema extends RuntimeSchemaBuilder<number, 'int', EmptyRuntimeSchemaOptions, RequiredRuntimeSchemaDescriptor<'int', EmptyRuntimeSchemaOptions>> {
3
+ }
4
+ export declare function int(): IntSchema;
@@ -0,0 +1,2 @@
1
+ import type { AnyRuntimeSchemaBuilder } from './contracts.js';
2
+ export declare function isRuntimeSchemaKind(schema: AnyRuntimeSchemaBuilder, kind: string): boolean;
@@ -0,0 +1,3 @@
1
+ import type { RuntimeSchemaValueOptions } from './contracts.js';
2
+ import type { CompiledRuntimeSchema } from './compile-runtime-schema-value.js';
3
+ export declare function normalizeCompiledRuntimeSchemaValue<Value = unknown>(compiled: CompiledRuntimeSchema<Value>, input: unknown, options?: RuntimeSchemaValueOptions): Value;
@@ -0,0 +1,2 @@
1
+ import type { NormalizedRuntimeSchemaDescriptor, RuntimeSchemaBuilder, RuntimeSchemaOptions, RuntimeSchemaValueOptions } from './contracts.js';
2
+ export declare function normalizeRuntimeSchemaValue<Value, Kind extends string, Options extends RuntimeSchemaOptions, Descriptor extends NormalizedRuntimeSchemaDescriptor<Kind, Options>>(schema: RuntimeSchemaBuilder<Value, Kind, Options, Descriptor>, input: unknown, options?: RuntimeSchemaValueOptions): Value;
@@ -0,0 +1,4 @@
1
+ import type { EmptyRuntimeSchemaOptions, RequiredRuntimeSchemaDescriptor, RuntimeSchemaBuilder } from './contracts.js';
2
+ export interface NumberSchema extends RuntimeSchemaBuilder<number, 'number', EmptyRuntimeSchemaOptions, RequiredRuntimeSchemaDescriptor<'number', EmptyRuntimeSchemaOptions>> {
3
+ }
4
+ export declare function number(): NumberSchema;
@@ -0,0 +1,20 @@
1
+ import type { AnyRuntimeSchemaBuilder, InferRuntimeSchemaValue, NormalizedRuntimeSchemaDescriptor, RequiredRuntimeSchemaDescriptor, RuntimeSchemaOptions, RuntimeSchemaBuilder } from './contracts.js';
2
+ export type ObjectSchemaShape = Readonly<Record<string, AnyRuntimeSchemaBuilder>>;
3
+ export interface ObjectSchemaOptions extends RuntimeSchemaOptions {
4
+ readonly shape: Readonly<Record<string, NormalizedRuntimeSchemaDescriptor>>;
5
+ }
6
+ export interface ObjectSchema<Shape extends ObjectSchemaShape, Value = InferObjectShape<Shape>, Descriptor extends NormalizedRuntimeSchemaDescriptor<'object', ObjectSchemaOptions> = RequiredRuntimeSchemaDescriptor<'object', ObjectSchemaOptions>> extends RuntimeSchemaBuilder<Value, 'object', ObjectSchemaOptions, Descriptor> {
7
+ }
8
+ export type AnyObjectSchema = ObjectSchema<any, any, any>;
9
+ export type InferObjectShape<Shape extends ObjectSchemaShape> = Simplify<{
10
+ readonly [Key in keyof Shape as IsOptionalObjectField<Shape[Key]> extends true ? never : Key]: InferRuntimeSchemaValue<Shape[Key]>;
11
+ } & {
12
+ readonly [Key in keyof Shape as IsOptionalObjectField<Shape[Key]> extends true ? Key : never]?: Exclude<InferRuntimeSchemaValue<Shape[Key]>, undefined>;
13
+ }>;
14
+ export declare function object<const Shape extends ObjectSchemaShape>(shape: Shape): ObjectSchema<Shape>;
15
+ export declare function getObjectSchemaShape<Shape extends ObjectSchemaShape>(schema: ObjectSchema<Shape, any, any>): Shape;
16
+ type IsOptionalObjectField<Schema extends AnyRuntimeSchemaBuilder> = undefined extends InferRuntimeSchemaValue<Schema> ? true : false;
17
+ type Simplify<Value> = {
18
+ readonly [Key in keyof Value]: Value[Key];
19
+ } & {};
20
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { RuntimeSchemaValueOptions } from './contracts.js';
2
+ import type { CompiledRuntimeSchema } from './compile-runtime-schema-value.js';
3
+ export declare function parseCompiledRuntimeSchemaValue<Value = unknown>(compiled: CompiledRuntimeSchema<Value>, input: unknown, options?: RuntimeSchemaValueOptions): Value;
@@ -0,0 +1,2 @@
1
+ import type { NormalizedRuntimeSchemaDescriptor, RuntimeSchemaBuilder, RuntimeSchemaOptions, RuntimeSchemaValueOptions } from './contracts.js';
2
+ export declare function parseRuntimeSchemaValue<Value, Kind extends string, Options extends RuntimeSchemaOptions, Descriptor extends NormalizedRuntimeSchemaDescriptor<Kind, Options>>(schema: RuntimeSchemaBuilder<Value, Kind, Options, Descriptor>, input: unknown, options?: RuntimeSchemaValueOptions): Value;
@@ -0,0 +1,5 @@
1
+ import type { NormalizedRuntimeSchemaDescriptor, RuntimeSchemaBuilder, RuntimeSchemaInternals, RuntimeSchemaOptions } from './contracts.js';
2
+ export declare const runtimeSchemaSymbol: unique symbol;
3
+ export interface RuntimeSchemaBuilderWithInternals<Value, Kind extends string, Options extends RuntimeSchemaOptions, Descriptor extends NormalizedRuntimeSchemaDescriptor<Kind, Options>> extends RuntimeSchemaBuilder<Value, Kind, Options, Descriptor> {
4
+ readonly [runtimeSchemaSymbol]: RuntimeSchemaInternals<Value, Kind, Options, Descriptor>;
5
+ }
@@ -0,0 +1,2 @@
1
+ import type { RuntimeSchemaValueContext, RuntimeSchemaValueOptions } from './contracts.js';
2
+ export declare function createRuntimeSchemaValueContext(kind: string, options?: RuntimeSchemaValueOptions): RuntimeSchemaValueContext;
@@ -0,0 +1,4 @@
1
+ import type { NormalizedRuntimeSchemaDescriptor, RuntimeSchemaBuilder, RuntimeSchemaOptions, RuntimeSchemaSafeResult, RuntimeSchemaValueOptions } from './contracts.js';
2
+ export declare function safeParseRuntimeSchemaValue<Value, Kind extends string, Options extends RuntimeSchemaOptions, Descriptor extends NormalizedRuntimeSchemaDescriptor<Kind, Options>>(schema: RuntimeSchemaBuilder<Value, Kind, Options, Descriptor>, input: unknown, options?: RuntimeSchemaValueOptions): RuntimeSchemaSafeResult<Value>;
3
+ export declare function safeNormalizeRuntimeSchemaValue<Value, Kind extends string, Options extends RuntimeSchemaOptions, Descriptor extends NormalizedRuntimeSchemaDescriptor<Kind, Options>>(schema: RuntimeSchemaBuilder<Value, Kind, Options, Descriptor>, input: unknown, options?: RuntimeSchemaValueOptions): RuntimeSchemaSafeResult<Value>;
4
+ export declare function safeSerializeRuntimeSchemaValue<Value, Kind extends string, Options extends RuntimeSchemaOptions, Descriptor extends NormalizedRuntimeSchemaDescriptor<Kind, Options>>(schema: RuntimeSchemaBuilder<Value, Kind, Options, Descriptor>, input: unknown, options?: RuntimeSchemaValueOptions): RuntimeSchemaSafeResult<string | undefined>;
@@ -0,0 +1,3 @@
1
+ import type { RuntimeSchemaValueOptions } from './contracts.js';
2
+ import type { CompiledRuntimeSchema } from './compile-runtime-schema-value.js';
3
+ export declare function serializeCompiledRuntimeSchemaValue<Value = unknown>(compiled: CompiledRuntimeSchema<Value>, input: unknown, options?: RuntimeSchemaValueOptions): string | undefined;
@@ -0,0 +1,2 @@
1
+ import type { NormalizedRuntimeSchemaDescriptor, RuntimeSchemaBuilder, RuntimeSchemaOptions, RuntimeSchemaValueOptions } from './contracts.js';
2
+ export declare function serializeRuntimeSchemaValue<Value, Kind extends string, Options extends RuntimeSchemaOptions, Descriptor extends NormalizedRuntimeSchemaDescriptor<Kind, Options>>(schema: RuntimeSchemaBuilder<Value, Kind, Options, Descriptor>, input: unknown, options?: RuntimeSchemaValueOptions): string | undefined;
@@ -0,0 +1,4 @@
1
+ import type { EmptyRuntimeSchemaOptions, RequiredRuntimeSchemaDescriptor, RuntimeSchemaBuilder } from './contracts.js';
2
+ export interface StringSchema extends RuntimeSchemaBuilder<string, 'string', EmptyRuntimeSchemaOptions, RequiredRuntimeSchemaDescriptor<'string', EmptyRuntimeSchemaOptions>> {
3
+ }
4
+ export declare function string(): StringSchema;
@@ -0,0 +1,4 @@
1
+ import type { BuildSearchOptions } from '../contracts.js';
2
+ import { type AnyObjectSchema } from '../schema/object.js';
3
+ import type { SearchEntry } from './search-entries.js';
4
+ export declare function appendObjectSearchEntries(entries: SearchEntry[], parentKey: string, schema: AnyObjectSchema, value: unknown, options?: BuildSearchOptions): void;
@@ -0,0 +1,2 @@
1
+ import type { RawSearchValue } from './contracts.js';
2
+ export declare function appendRawSearchValue(output: Record<string, RawSearchValue>, key: string, value: string): void;
@@ -0,0 +1,3 @@
1
+ import type { BuildSearchOptions } from '../contracts.js';
2
+ import type { SearchEntry } from './search-entries.js';
3
+ export declare function appendSearchEntry(entries: SearchEntry[], key: string, value: string | readonly string[] | undefined, options?: BuildSearchOptions): void;
@@ -0,0 +1 @@
1
+ export declare function areSearchValuesEqual(left: unknown, right: unknown): boolean;
@@ -0,0 +1,2 @@
1
+ import type { RawSearchParams } from './contracts.js';
2
+ export declare function assertNoObjectSearchCollisions(parentKey: string, rawSearch: RawSearchParams, parentPath: readonly string[]): void;
@@ -0,0 +1,3 @@
1
+ import type { BuildSearchOptions } from '../contracts.js';
2
+ import type { CompiledSearchSchema } from './contracts.js';
3
+ export declare function buildCompiledSearch(input: Record<string, unknown> | undefined, compiled: CompiledSearchSchema, options?: BuildSearchOptions): string;
@@ -0,0 +1,2 @@
1
+ import type { BuildSearchOptions } from '../contracts.js';
2
+ export declare function buildRawSearch(input?: Record<string, unknown>, options?: BuildSearchOptions): string;
@@ -0,0 +1,3 @@
1
+ import type { BuildSearchOptions } from '../contracts.js';
2
+ import type { RuntimeSearchSchema } from './contracts.js';
3
+ export declare function buildSchemaSearch(input: Record<string, unknown> | undefined, schema: RuntimeSearchSchema, options?: BuildSearchOptions): string;
@@ -0,0 +1,6 @@
1
+ import type { BuildSearchOptions, SearchInputArgument } from '../contracts.js';
2
+ import type { InferRuntimeSearchBuildInput, RuntimeSearchSchema, SearchBuildOptions } from './contracts.js';
3
+ export declare function buildSearch<const Schema extends RuntimeSearchSchema>(input: SearchInputArgument<InferRuntimeSearchBuildInput<Schema>>, options: SearchBuildOptions<Schema> & {
4
+ readonly schema: Schema;
5
+ }): string;
6
+ export declare function buildSearch(input?: Record<string, unknown>, options?: BuildSearchOptions): string;
@@ -0,0 +1,2 @@
1
+ import { type AnyObjectSchema } from '../schema/object.js';
2
+ export declare function collectObjectSearchPaths(schema: AnyObjectSchema): readonly (readonly string[])[];
@@ -0,0 +1,2 @@
1
+ import type { CompiledSearchSchema, RuntimeSearchSchema } from './contracts.js';
2
+ export declare function compileSearchSchema(schema: RuntimeSearchSchema): CompiledSearchSchema;
@@ -0,0 +1,73 @@
1
+ import type { BuildSearchOptions, PatchSearchOptions, SearchArrayFormat, UnknownSearchBehavior, UnknownSearchParams } from '../contracts.js';
2
+ import type { InferRuntimeSchemaValue, RuntimeSchemaBuilder } from '../schema/contracts.js';
3
+ import type { CompiledRuntimeSchema } from '../schema/compile-runtime-schema-value.js';
4
+ export type AnyRuntimeSchemaBuilder = RuntimeSchemaBuilder<any, any, any, any>;
5
+ export type RawSearchValue = string | readonly string[];
6
+ export type RawSearchParams = Readonly<Record<string, RawSearchValue>>;
7
+ export type SearchFieldType = 'one' | 'many';
8
+ export interface RuntimeSearchField<Schema extends AnyRuntimeSchemaBuilder = AnyRuntimeSchemaBuilder> {
9
+ readonly type?: SearchFieldType;
10
+ readonly value: Schema;
11
+ readonly optional?: boolean;
12
+ readonly default?: unknown;
13
+ }
14
+ export type RuntimeSearchFieldInput = AnyRuntimeSchemaBuilder | RuntimeSearchField;
15
+ export type RuntimeSearchSchema = Readonly<Record<string, RuntimeSearchFieldInput>>;
16
+ export interface ParseSearchOptions<SearchDescriptor = unknown> {
17
+ readonly schema?: SearchDescriptor;
18
+ readonly unknownSearch?: UnknownSearchBehavior;
19
+ readonly arrayFormat?: SearchArrayFormat;
20
+ }
21
+ export interface SearchBuildOptions<SearchDescriptor = unknown> extends BuildSearchOptions {
22
+ readonly schema?: SearchDescriptor;
23
+ }
24
+ export interface SearchPatchOptions<SearchDescriptor = unknown> extends PatchSearchOptions {
25
+ readonly schema?: SearchDescriptor;
26
+ }
27
+ export interface SearchParseResult<Search> {
28
+ readonly search: Search;
29
+ readonly unknownSearch?: UnknownSearchParams;
30
+ }
31
+ export interface CompiledSearchField {
32
+ readonly key: string;
33
+ readonly type: SearchFieldType;
34
+ readonly schema: AnyRuntimeSchemaBuilder;
35
+ readonly compiledSchema: CompiledRuntimeSchema;
36
+ readonly presence: 'required' | 'optional' | 'defaulted';
37
+ readonly defaultValue?: unknown;
38
+ }
39
+ export interface CompiledSearchSchema {
40
+ readonly fields: readonly CompiledSearchField[];
41
+ readonly keys: ReadonlySet<string>;
42
+ }
43
+ export interface SearchBuildContext {
44
+ readonly options?: SearchBuildOptions;
45
+ }
46
+ export interface SearchParseOptions {
47
+ readonly arrayFormat?: SearchArrayFormat;
48
+ }
49
+ export interface SearchPatchContext {
50
+ readonly options?: PatchSearchOptions;
51
+ }
52
+ export type InferRuntimeSearchBuildInput<Schema extends RuntimeSearchSchema> = Simplify<{
53
+ readonly [Key in keyof Schema as IsRequiredSearchBuildField<Schema[Key]> extends true ? Key : never]: InferSearchFieldValue<Schema[Key]>;
54
+ } & {
55
+ readonly [Key in keyof Schema as IsRequiredSearchBuildField<Schema[Key]> extends true ? never : Key]?: Exclude<InferSearchFieldValue<Schema[Key]>, undefined>;
56
+ }>;
57
+ export type InferRuntimeSearch<Schema extends RuntimeSearchSchema> = Simplify<{
58
+ readonly [Key in keyof Schema as IsOptionalSearchField<Schema[Key]> extends true ? never : Key]: InferSearchFieldValue<Schema[Key]>;
59
+ } & {
60
+ readonly [Key in keyof Schema as IsOptionalSearchField<Schema[Key]> extends true ? Key : never]?: Exclude<InferSearchFieldValue<Schema[Key]>, undefined>;
61
+ }>;
62
+ type InferSearchFieldValue<Field> = Field extends RuntimeSearchField<infer Schema> ? Field['type'] extends 'many' ? readonly InferSearchElementValue<Schema>[] : InferRuntimeSchemaValue<Schema> : Field extends AnyRuntimeSchemaBuilder ? InferRuntimeSchemaValue<Field> : never;
63
+ type InferSearchElementValue<Schema extends AnyRuntimeSchemaBuilder> = Exclude<InferRuntimeSchemaValue<Schema>, undefined>;
64
+ type IsOptionalSearchField<Field> = Field extends RuntimeSearchField<infer Schema> ? 'default' extends keyof Field ? false : Field['optional'] extends true ? true : Field['type'] extends 'many' ? false : IsOptionalSchema<Schema> : Field extends AnyRuntimeSchemaBuilder ? IsOptionalSchema<Field> : false;
65
+ type IsOptionalSchema<Schema extends AnyRuntimeSchemaBuilder> = undefined extends InferRuntimeSchemaValue<Schema> ? true : false;
66
+ type IsRequiredSearchBuildField<Field> = Field extends RuntimeSearchField<infer Schema> ? 'default' extends keyof Field ? false : Field['optional'] extends true ? false : Field['type'] extends 'many' ? true : IsRequiredSchema<Schema> : Field extends AnyRuntimeSchemaBuilder ? IsRequiredSchema<Field> : false;
67
+ type IsRequiredSchema<Schema extends AnyRuntimeSchemaBuilder> = Schema extends RuntimeSchemaBuilder<any, any, any, infer Descriptor> ? Descriptor extends {
68
+ readonly presence: 'required';
69
+ } ? true : false : false;
70
+ type Simplify<Value> = {
71
+ readonly [Key in keyof Value]: Value[Key];
72
+ } & {};
73
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { RawSearchParams } from './contracts.js';
2
+ export declare function copyRawSearchParams(input: RawSearchParams): RawSearchParams;
@@ -0,0 +1,2 @@
1
+ import type { UnknownSearchParams } from '../contracts.js';
2
+ export declare function copyUnknownStructuredSearch(input: Readonly<Record<string, unknown>>): UnknownSearchParams | undefined;
@@ -0,0 +1 @@
1
+ export declare function createSearchParams(input: string | URLSearchParams): URLSearchParams;
@@ -0,0 +1,4 @@
1
+ import type { EmptyParams } from '../contracts.js';
2
+ import type { CreateUrlOptions, UrlContract } from '../url/contracts.js';
3
+ import type { InferRuntimeSearch, InferRuntimeSearchBuildInput, RuntimeSearchSchema } from './contracts.js';
4
+ export declare function search<const Schema extends RuntimeSearchSchema>(schema: Schema, options?: CreateUrlOptions): UrlContract<'pathless', string, EmptyParams, InferRuntimeSearch<Schema>, undefined, InferRuntimeSearchBuildInput<Schema>>;
@@ -0,0 +1,2 @@
1
+ import type { CompiledSearchField } from './contracts.js';
2
+ export declare function deleteSearchFieldRawKeys(field: CompiledSearchField, rawSearch: Record<string, unknown>): void;
@@ -0,0 +1,3 @@
1
+ import type { RawSearchParams } from './contracts.js';
2
+ export declare function omitRawSearch(input: RawSearchParams, keys: readonly string[]): RawSearchParams;
3
+ export declare function pickRawSearch(input: RawSearchParams, keys: readonly string[]): RawSearchParams;
@@ -0,0 +1,2 @@
1
+ import type { RawSearchParams, RawSearchValue } from './contracts.js';
2
+ export declare function findObjectSearchRawValue(parentKey: string, path: readonly string[], rawSearch: RawSearchParams): RawSearchValue | undefined;
@@ -0,0 +1,2 @@
1
+ import type { CompiledSearchField, RawSearchParams } from './contracts.js';
2
+ export declare function hasSearchFieldRawValue(field: CompiledSearchField, rawSearch: RawSearchParams): boolean;
@@ -0,0 +1,2 @@
1
+ import type { RuntimeSearchField } from './contracts.js';
2
+ export declare function isRuntimeSearchField(input: unknown): input is RuntimeSearchField;
@@ -0,0 +1 @@
1
+ export declare function joinSearchStrings(...parts: readonly string[]): string;
@@ -0,0 +1,3 @@
1
+ import type { UnknownSearchBehavior } from '../contracts.js';
2
+ import type { CompiledSearchSchema, SearchParseResult } from './contracts.js';
3
+ export declare function normalizeCompiledSearch(input: unknown, compiled: CompiledSearchSchema | undefined, unknownSearch?: UnknownSearchBehavior): SearchParseResult<Record<string, unknown>>;
@@ -0,0 +1,2 @@
1
+ import type { CompiledSearchField } from './contracts.js';
2
+ export declare function normalizeSearchBuildValue(field: CompiledSearchField, input: unknown): unknown;
@@ -0,0 +1,2 @@
1
+ import type { AnyRuntimeSchemaBuilder, SearchFieldType } from './contracts.js';
2
+ export declare function normalizeSearchFieldDefault(fieldType: SearchFieldType, schema: AnyRuntimeSchemaBuilder, value: unknown, path: readonly string[]): unknown;
@@ -0,0 +1,2 @@
1
+ import type { SearchFieldType } from './contracts.js';
2
+ export declare function normalizeSearchFieldType(input: unknown): SearchFieldType;
@@ -0,0 +1,4 @@
1
+ export declare function joinObjectSearchKey(parentKey: string, childKey: string): string;
2
+ export declare function escapeObjectSearchSegment(segment: string): string;
3
+ export declare function unescapeObjectSearchSegment(segment: string): string;
4
+ export declare function splitObjectSearchKey(key: string): readonly string[];
@@ -0,0 +1,2 @@
1
+ export declare function createObjectSearchPathKey(path: readonly string[]): string;
2
+ export declare function isObjectSearchPathEqual(left: readonly string[], right: readonly string[]): boolean;
@@ -0,0 +1 @@
1
+ export declare function getObjectSearchRawKeyPath(parentKey: string, rawKey: string): readonly string[] | undefined;
@@ -0,0 +1 @@
1
+ export declare function omitSearch(current: string | URLSearchParams, keys: readonly string[]): string;
@@ -0,0 +1,4 @@
1
+ import type { RuntimeSchemaValueContext } from '../schema/contracts.js';
2
+ import { type ArraySchema } from '../schema/array.js';
3
+ import type { RawSearchValue, SearchParseOptions } from './contracts.js';
4
+ export declare function parseArraySearchValue(schema: ArraySchema<any>, value: RawSearchValue | undefined, context: RuntimeSchemaValueContext, options?: SearchParseOptions): unknown;
@@ -0,0 +1,2 @@
1
+ import type { CompiledSearchSchema, RawSearchParams, SearchParseOptions, SearchParseResult } from './contracts.js';
2
+ export declare function parseCompiledSearch(rawSearch: RawSearchParams, compiled: CompiledSearchSchema, unknownSearch?: 'strip' | 'preserve' | 'error', options?: SearchParseOptions): SearchParseResult<Record<string, unknown>>;
@@ -0,0 +1,4 @@
1
+ import type { RuntimeSchemaValueContext } from '../schema/contracts.js';
2
+ import { type AnyObjectSchema } from '../schema/object.js';
3
+ import type { RawSearchParams, SearchParseOptions } from './contracts.js';
4
+ export declare function parseObjectSearchValue(schema: AnyObjectSchema, parentKey: string, rawSearch: RawSearchParams, context: RuntimeSchemaValueContext, options?: SearchParseOptions): unknown;
@@ -0,0 +1,6 @@
1
+ import type { CompiledSearchSchema, RawSearchParams, SearchParseOptions } from './contracts.js';
2
+ export interface PartialCompiledSearchParseResult {
3
+ readonly search: Record<string, unknown>;
4
+ readonly unknownSearch: RawSearchParams;
5
+ }
6
+ export declare function parsePartialCompiledSearch(rawSearch: RawSearchParams, compiled: CompiledSearchSchema, options?: SearchParseOptions): PartialCompiledSearchParseResult;
@@ -0,0 +1,6 @@
1
+ import type { RawSearchParams, RuntimeSearchSchema, SearchParseOptions } from './contracts.js';
2
+ export interface PartialSchemaSearchParseResult {
3
+ readonly search: Record<string, unknown>;
4
+ readonly unknownSearch: RawSearchParams;
5
+ }
6
+ export declare function parsePartialSchemaSearch(rawSearch: RawSearchParams, schema: RuntimeSearchSchema, options?: SearchParseOptions): PartialSchemaSearchParseResult;
@@ -0,0 +1,2 @@
1
+ import type { RawSearchParams } from './contracts.js';
2
+ export declare function parseRawSearch(input: string | URLSearchParams): RawSearchParams;
@@ -0,0 +1,2 @@
1
+ import type { CompiledSearchField, RawSearchParams, SearchParseOptions } from './contracts.js';
2
+ export declare function parseSearchFieldValue(field: CompiledSearchField, rawSearch: RawSearchParams, options?: SearchParseOptions): unknown;
@@ -0,0 +1,5 @@
1
+ import type { InferRuntimeSearch, ParseSearchOptions, RawSearchParams, RuntimeSearchSchema, SearchParseResult } from './contracts.js';
2
+ export declare function parseSearch(input: string | URLSearchParams): RawSearchParams;
3
+ export declare function parseSearch<const Schema extends RuntimeSearchSchema>(input: string | URLSearchParams, options: ParseSearchOptions<Schema> & {
4
+ readonly schema: Schema;
5
+ }): SearchParseResult<InferRuntimeSearch<Schema>>;
@@ -0,0 +1,6 @@
1
+ import type { PatchSearchOptions } from '../contracts.js';
2
+ import type { InferRuntimeSearch, RuntimeSearchSchema, SearchPatchOptions } from './contracts.js';
3
+ export declare function patchSearch<const Schema extends RuntimeSearchSchema>(current: string | URLSearchParams, patch: Partial<InferRuntimeSearch<Schema>>, options: SearchPatchOptions<Schema> & {
4
+ readonly schema: Schema;
5
+ }): string;
6
+ export declare function patchSearch(current: string | URLSearchParams, patch: Record<string, unknown>, options?: PatchSearchOptions): string;
@@ -0,0 +1 @@
1
+ export declare function pickSearch(current: string | URLSearchParams, keys: readonly string[]): string;
@@ -0,0 +1,5 @@
1
+ import type { InferRuntimeSearchBuildInput, RuntimeSearchSchema, SearchBuildOptions } from './contracts.js';
2
+ export declare function replaceSearch<const Schema extends RuntimeSearchSchema>(current: string | URLSearchParams, next: InferRuntimeSearchBuildInput<Schema>, options: SearchBuildOptions<Schema> & {
3
+ readonly schema: Schema;
4
+ }): string;
5
+ export declare function replaceSearch(current: string | URLSearchParams, next: Record<string, unknown>, options?: SearchBuildOptions): string;
@@ -0,0 +1,3 @@
1
+ import type { SearchArrayFormat } from '../contracts.js';
2
+ import type { RawSearchValue } from './contracts.js';
3
+ export declare function readArraySearchValues(value: RawSearchValue | undefined, arrayFormat?: SearchArrayFormat): readonly string[] | undefined;
@@ -0,0 +1,4 @@
1
+ export interface SearchEntry {
2
+ readonly key: string;
3
+ readonly value: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ import type { CompiledSearchField } from './contracts.js';
2
+ export declare function serializeSearchBuildValue(field: CompiledSearchField, normalized: unknown): string | readonly string[] | undefined;
@@ -0,0 +1,3 @@
1
+ import type { BuildSearchOptions } from '../contracts.js';
2
+ import type { SearchEntry } from './search-entries.js';
3
+ export declare function serializeSearchEntries(entries: readonly SearchEntry[], options?: BuildSearchOptions): string;
@@ -0,0 +1,3 @@
1
+ import type { NormalizedHashDescriptor } from '../hash/contracts.js';
2
+ import type { InferStaticHash, StaticHashDescriptor } from './contracts.js';
3
+ export declare function compileStaticHash<Descriptor extends StaticHashDescriptor>(descriptor: Descriptor): NormalizedHashDescriptor<InferStaticHash<Descriptor>>;
@@ -0,0 +1,3 @@
1
+ import type { RuntimeSearchSchema } from '../search/contracts.js';
2
+ import type { StaticSearchDescriptor } from './contracts.js';
3
+ export declare function compileStaticSearch(descriptor: StaticSearchDescriptor): RuntimeSearchSchema;
@@ -0,0 +1,3 @@
1
+ import type { NormalizedUrlDescriptor } from '../url/contracts.js';
2
+ import type { CompileStaticUrlOptions, StaticUrlDescriptor, StaticUrlModeFromDescriptor } from './contracts.js';
3
+ export declare function compileStaticUrl<Descriptor extends StaticUrlDescriptor>(descriptor: Descriptor, options?: CompileStaticUrlOptions): NormalizedUrlDescriptor<StaticUrlModeFromDescriptor<Descriptor>>;
@@ -0,0 +1,81 @@
1
+ import type { PathConstraintMap } from '../contracts.js';
2
+ export interface CompileStaticUrlOptions {
3
+ readonly pathConstraints?: PathConstraintMap;
4
+ }
5
+ export interface StaticUrlDescriptor {
6
+ readonly path?: string;
7
+ readonly search?: StaticSearchDescriptor;
8
+ readonly hash?: StaticHashDescriptor;
9
+ }
10
+ export type StaticUrlModeFromDescriptor<Descriptor extends StaticUrlDescriptor> = Descriptor extends {
11
+ readonly path: string;
12
+ } ? 'path' : 'pathless';
13
+ export type InferStaticUrlSearch<Descriptor extends StaticUrlDescriptor> = Descriptor extends {
14
+ readonly search: infer SearchDescriptor extends StaticSearchDescriptor;
15
+ } ? InferStaticSearch<SearchDescriptor> : {};
16
+ export type InferStaticUrlSearchBuildInput<Descriptor extends StaticUrlDescriptor> = Descriptor extends {
17
+ readonly search: infer SearchDescriptor extends StaticSearchDescriptor;
18
+ } ? InferStaticSearchBuildInput<SearchDescriptor> : {};
19
+ export type InferStaticUrlHash<Descriptor extends StaticUrlDescriptor> = Descriptor extends {
20
+ readonly hash: infer HashDescriptor extends StaticHashDescriptor;
21
+ } ? InferStaticHash<HashDescriptor> : undefined;
22
+ export type InferStaticUrlHashBuildInput<Descriptor extends StaticUrlDescriptor> = Descriptor extends {
23
+ readonly hash: infer HashDescriptor extends StaticHashDescriptor;
24
+ } ? InferStaticHashBuildInput<HashDescriptor> : undefined;
25
+ export type StaticSearchDescriptor = Readonly<Record<string, StaticSearchField>>;
26
+ export type StaticSearchField = StaticSearchValue | StaticSearchFieldObject;
27
+ export interface StaticSearchFieldObject {
28
+ readonly type?: 'one' | 'many';
29
+ readonly optional?: boolean;
30
+ readonly value?: StaticSearchValue;
31
+ readonly default?: unknown;
32
+ }
33
+ export type StaticSearchValue = 'string' | 'number' | 'int' | 'boolean' | 'date' | 'date-time' | 'unix-seconds' | 'unix-ms' | StaticDateSearchValue | StaticEnumSearchValue;
34
+ export interface StaticDateSearchValue {
35
+ readonly type: 'date';
36
+ readonly format?: StaticDateFormat;
37
+ }
38
+ export type StaticDateFormat = 'date' | 'date-time' | 'unix-seconds' | 'unix-ms';
39
+ export interface StaticEnumSearchValue {
40
+ readonly type: 'enum';
41
+ readonly values: readonly string[];
42
+ }
43
+ export type InferStaticSearch<Descriptor extends StaticSearchDescriptor> = Simplify<{
44
+ readonly [Key in keyof Descriptor as IsOptionalStaticSearchField<Descriptor[Key]> extends true ? never : Key]: InferStaticSearchFieldValue<Descriptor[Key]>;
45
+ } & {
46
+ readonly [Key in keyof Descriptor as IsOptionalStaticSearchField<Descriptor[Key]> extends true ? Key : never]?: InferStaticSearchFieldValue<Descriptor[Key]>;
47
+ }>;
48
+ export type InferStaticSearchBuildInput<Descriptor extends StaticSearchDescriptor> = Simplify<{
49
+ readonly [Key in keyof Descriptor as IsRequiredStaticSearchBuildField<Descriptor[Key]> extends true ? Key : never]: InferStaticSearchFieldValue<Descriptor[Key]>;
50
+ } & {
51
+ readonly [Key in keyof Descriptor as IsRequiredStaticSearchBuildField<Descriptor[Key]> extends true ? never : Key]?: InferStaticSearchFieldValue<Descriptor[Key]>;
52
+ }>;
53
+ export type StaticHashDescriptor = readonly string[] | StaticStringHashDescriptor | StaticEnumHashDescriptor;
54
+ export interface StaticStringHashDescriptor {
55
+ readonly type: 'string';
56
+ readonly optional?: boolean;
57
+ readonly default?: string;
58
+ }
59
+ export interface StaticEnumHashDescriptor {
60
+ readonly type: 'enum';
61
+ readonly values: readonly string[];
62
+ readonly optional?: boolean;
63
+ readonly default?: string;
64
+ }
65
+ export type InferStaticHash<Descriptor extends StaticHashDescriptor> = Descriptor extends readonly string[] ? Descriptor[number] | undefined : Descriptor extends StaticStringHashDescriptor ? InferStaticStringHash<Descriptor> : Descriptor extends StaticEnumHashDescriptor ? InferStaticEnumHash<Descriptor> : never;
66
+ type InferStaticStringHash<Descriptor extends StaticStringHashDescriptor> = 'default' extends keyof Descriptor ? string : Descriptor['optional'] extends true ? string | undefined : string;
67
+ type InferStaticEnumHash<Descriptor extends StaticEnumHashDescriptor> = 'default' extends keyof Descriptor ? Descriptor['values'][number] : Descriptor['optional'] extends true ? Descriptor['values'][number] | undefined : Descriptor['values'][number];
68
+ export type InferStaticHashBuildInput<Descriptor extends StaticHashDescriptor> = Descriptor extends readonly string[] ? Descriptor[number] | undefined : Descriptor extends StaticStringHashDescriptor ? InferStaticStringHashBuildInput<Descriptor> : Descriptor extends StaticEnumHashDescriptor ? InferStaticEnumHashBuildInput<Descriptor> : never;
69
+ type InferStaticStringHashBuildInput<Descriptor extends StaticStringHashDescriptor> = 'default' extends keyof Descriptor ? string | undefined : Descriptor['optional'] extends true ? string | undefined : string;
70
+ type InferStaticEnumHashBuildInput<Descriptor extends StaticEnumHashDescriptor> = 'default' extends keyof Descriptor ? Descriptor['values'][number] | undefined : Descriptor['optional'] extends true ? Descriptor['values'][number] | undefined : Descriptor['values'][number];
71
+ type InferStaticSearchFieldValue<Field> = Field extends StaticSearchFieldObject ? Field['type'] extends 'many' ? readonly InferStaticSearchValue<StaticFieldObjectValue<Field>>[] : InferStaticSearchValue<StaticFieldObjectValue<Field>> : InferStaticSearchValue<Field>;
72
+ type StaticFieldObjectValue<Field extends StaticSearchFieldObject> = Field extends {
73
+ readonly value: infer Value;
74
+ } ? Value : 'string';
75
+ type InferStaticSearchValue<Value> = Value extends 'string' ? string : Value extends 'number' ? number : Value extends 'int' ? number : Value extends 'boolean' ? boolean : Value extends 'date' | 'date-time' | 'unix-seconds' | 'unix-ms' ? Date : Value extends StaticDateSearchValue ? Date : Value extends StaticEnumSearchValue ? Value['values'][number] : never;
76
+ type IsOptionalStaticSearchField<Field> = Field extends StaticSearchFieldObject ? 'default' extends keyof Field ? false : Field['optional'] extends true ? true : false : false;
77
+ type IsRequiredStaticSearchBuildField<Field> = Field extends StaticSearchFieldObject ? 'default' extends keyof Field ? false : Field['optional'] extends true ? false : true : true;
78
+ type Simplify<Value> = {
79
+ readonly [Key in keyof Value]: Value[Key];
80
+ } & {};
81
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { RuntimeSearchSchema } from '../search/contracts.js';
2
+ import type { StaticSearchDescriptor } from './contracts.js';
3
+ export declare function createStaticSearchSchema(descriptor: StaticSearchDescriptor): RuntimeSearchSchema;
@@ -0,0 +1,2 @@
1
+ import type { StaticSearchValue } from './contracts.js';
2
+ export declare function normalizeStaticSearchDefault(fieldType: 'one' | 'many', valueDescriptor: StaticSearchValue, defaultValue: unknown, path: readonly string[]): unknown;
@@ -0,0 +1,4 @@
1
+ import type { StaticSearchField, StaticSearchFieldObject, StaticSearchValue } from './contracts.js';
2
+ export declare function isStaticSearchFieldObject(field: StaticSearchField): field is StaticSearchFieldObject;
3
+ export declare function normalizeStaticSearchFieldValue(field: StaticSearchField): StaticSearchValue;
4
+ export declare function normalizeStaticSearchFieldType(input: unknown, path: readonly string[]): 'one' | 'many';
@@ -0,0 +1,7 @@
1
+ export * from './url/path-constraints.js';
2
+ export { createConstraint } from '@cookbook/pathkit/constraints';
3
+ export type { ConstraintValidation } from '@cookbook/pathkit';
4
+ export * from './static/compile-static-hash.js';
5
+ export * from './static/compile-static-search.js';
6
+ export * from './static/compile-static-url.js';
7
+ export * from './static/contracts.js';