@asaidimu/anansi 1.5.2 → 1.6.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 (5) hide show
  1. package/index.cjs +52 -39
  2. package/index.d.cts +105 -35
  3. package/index.d.ts +105 -35
  4. package/index.js +40 -27
  5. package/package.json +2 -1
package/index.d.cts CHANGED
@@ -3,6 +3,7 @@ import { Faker } from '@faker-js/faker';
3
3
  import { QueryDSL, QueryFilter } from '@asaidimu/query';
4
4
  import { StandardSchemaV1 } from '@standard-schema/spec';
5
5
  import LightningFS from '@isomorphic-git/lightning-fs';
6
+ import { FieldValues, ResolverOptions, ResolverResult } from 'react-hook-form';
6
7
 
7
8
  /**
8
9
  * hints.ts
@@ -129,10 +130,22 @@ type DynamicHint = {
129
130
  group?: string;
130
131
  ignore?: boolean;
131
132
  };
133
+ /**
134
+ * Hints for generating a date input control.
135
+ */
136
+ type DateHint = {
137
+ type: "date" | "datetime" | "time";
138
+ label?: string;
139
+ placeholder?: string;
140
+ min?: string;
141
+ max?: string;
142
+ group?: string;
143
+ ignore?: boolean;
144
+ };
132
145
  /**
133
146
  * Union type for all possible input hints.
134
147
  */
135
- type InputHint = FileHint | TextHint | SecretHint | NumberHint | BooleanHint | EnumHint | ArrayHint | SetHint | ObjectHint | DynamicHint;
148
+ type InputHint = FileHint | TextHint | SecretHint | NumberHint | BooleanHint | EnumHint | ArrayHint | SetHint | ObjectHint | DynamicHint | DateHint;
136
149
  /**
137
150
  * Defines metadata for a group of inputs at the schema level.
138
151
  */
@@ -155,7 +168,7 @@ type LogicalOperator = "and" | "or" | "not" | "nor" | "xor";
155
168
  /**
156
169
  * Basic field types supported by the schema system.
157
170
  */
158
- type FieldType = "string" | "number" | "boolean" | "array" | "set" | "enum" | "object" | "record" | "dynamic";
171
+ type FieldType = "string" | "number" | "boolean" | "array" | "set" | "enum" | "object" | "record" | "union" | "dynamic";
159
172
  /**
160
173
  * Index types for optimizing different query patterns.
161
174
  */
@@ -226,6 +239,12 @@ interface ConstraintGroup<T extends FieldType> {
226
239
  * Collection of constraints or groups applied at the schema or nested level.
227
240
  */
228
241
  type SchemaConstraint<T extends FieldType> = Array<Constraint<T> | ConstraintGroup<T>>;
242
+ /** Reference to a nested schema (mini-SchemaDefinition) with optional overrides. */
243
+ interface FieldSchema {
244
+ id: string;
245
+ constraints?: SchemaConstraint<any>;
246
+ indexes?: IndexDefinition[];
247
+ }
229
248
  /**
230
249
  * Defines a field within a schema, including its type, constraints, and nesting.
231
250
  */
@@ -233,16 +252,16 @@ interface FieldDefinition<T> {
233
252
  name: string;
234
253
  type: FieldType;
235
254
  required?: boolean;
236
- constraints?: Constraint<any>[];
255
+ constraints?: Array<Constraint<any> | ConstraintGroup<any>>;
237
256
  default?: T;
238
- values?: Array<unknown>;
257
+ /** For type 'enum', specifies the allowed values. */
258
+ values?: Array<string | number>;
259
+ /** For type 'union', specifies the array of allowed schemas.
260
+ * For type 'object' specifies the schema of the object
261
+ * */
262
+ schema?: FieldSchema | Array<FieldSchema>;
239
263
  itemsType?: FieldType;
240
- /** Reference to a nested schema (mini-SchemaDefinition) with optional overrides. */
241
- nestedSchema?: {
242
- id: string;
243
- constraints?: SchemaConstraint<any>;
244
- indexes?: IndexDefinition[];
245
- };
264
+ nestedSchema?: FieldSchema;
246
265
  deprecated?: boolean;
247
266
  reference?: {
248
267
  schema: string;
@@ -276,15 +295,50 @@ interface IndexDefinition {
276
295
  name: string;
277
296
  }
278
297
  /**
279
- * A mini-schema definition for reusable nested structures within a larger schema.
280
- * Mirrors SchemaDefinition but omits top-level-only properties like version and migrations.
298
+ * Represents a nested schema definition embedded within a parent schema.
299
+ * Unlike SchemaDefinition, this can use a discriminated array of field sets for variant-specific fields,
300
+ * but only when concrete is false. This restriction avoids complexity in RDBMS implementations,
301
+ * where concrete schemas map directly to tables with fixed columns. Non-concrete schemas, as embedded
302
+ * structures, can leverage this flexibility without affecting physical table design.
281
303
  */
282
304
  interface NestedSchemaDefinition {
305
+ /**
306
+ * The name of the nested schema, unique within the parent schema's nestedSchemas.
307
+ */
283
308
  name: string;
309
+ /**
310
+ * A description of the nested schema's purpose.
311
+ */
284
312
  description?: string;
285
- fields: Record<string, FieldDefinition<any>>;
286
- indexes?: IndexDefinition[];
313
+ /**
314
+ * Indicates whether this schema represents a standalone entity (true) or is embedded (false).
315
+ * When true, fields must be a Record<string, FieldDefinition<any>> to ensure a fixed structure
316
+ * suitable for RDBMS table mapping. When false, fields can be an array of discriminated field sets.
317
+ * @default false
318
+ */
319
+ concrete?: boolean;
320
+ /**
321
+ * Defines the fields of the nested schema.
322
+ * - If concrete is true, must be a Record<string, FieldDefinition<any>> for a fixed field set.
323
+ * - If concrete is false, can be either a Record<string, FieldDefinition<any>> or an
324
+ * Array<{ fields: Record<string, FieldDefinition<any>>; when?: { field: string; value: any } }>,
325
+ * allowing discriminated field sets based on a field value (e.g., 'type').
326
+ * The array form enables variant-specific fields without constraints, but is not supported for
327
+ * concrete schemas to maintain simplicity in RDBMS table mappings.
328
+ */
329
+ fields: Record<string, FieldDefinition<any>> | Array<{
330
+ fields: Record<string, FieldDefinition<any>>;
331
+ when?: {
332
+ field: string;
333
+ value: any;
334
+ };
335
+ }>;
336
+ /**
337
+ * Optional constraints for additional validation rules.
338
+ * Less necessary when using discriminated field sets, as variant logic can be structural.
339
+ */
287
340
  constraints?: SchemaConstraint<any>;
341
+ indexes?: IndexDefinition[];
288
342
  metadata?: Record<string, any>;
289
343
  }
290
344
  /**
@@ -1454,9 +1508,32 @@ declare class MigrationEngine {
1454
1508
  */
1455
1509
  declare const createSchemaMigrationHelper: <T>(schema: Readonly<SchemaDefinition>) => SchemaMigrationHelper;
1456
1510
 
1457
- declare function validateMigration<T>(change: any): change is Migration<T>;
1458
- declare function validateSchemaChange<T>(change: any): change is SchemaChange<T>;
1459
- declare function validateSchemaDefinition(schema: any): schema is SchemaDefinition;
1511
+ /**
1512
+ * Validates a migration object against the standard schema.
1513
+ * @template T The expected type of the migration data.
1514
+ * @param change The object to validate.
1515
+ * @returns A type guard indicating whether the object conforms to Migration<T>.
1516
+ * @throws {SchemaValidationError} If validation fails due to an unexpected error.
1517
+ */
1518
+ declare function validateMigration<T>(change: unknown): change is Migration<T>;
1519
+ /**
1520
+ * Validates a schema change object against the standard schema.
1521
+ * @template T The expected type of the schema change data.
1522
+ * @param change The object to validate.
1523
+ * @returns A type guard indicating whether the object conforms to SchemaChange<T>.
1524
+ * @throws {SchemaValidationError} If validation fails due to an unexpected error.
1525
+ */
1526
+ declare function validateSchemaChange<T>(change: unknown): change is SchemaChange<T>;
1527
+ /**
1528
+ * Validates a schema definition object against the standard schema.
1529
+ * @param schema The object to validate.
1530
+ * @returns A type guard indicating whether the object conforms to SchemaDefinition.
1531
+ * @throws {SchemaValidationError} If validation fails due to an unexpected error.
1532
+ */
1533
+ declare function validateSchemaDefinition(schema: unknown): schema is SchemaDefinition;
1534
+ /**
1535
+ * Alias for validateSchemaDefinition, provided for convenience.
1536
+ */
1460
1537
  declare const validate: typeof validateSchemaDefinition;
1461
1538
 
1462
1539
  /**
@@ -1479,9 +1556,10 @@ declare function deepMerge<T extends object>(target: T, update: Partial<T>): T;
1479
1556
  * Converts a SchemaDefinition to TypeScript type definitions
1480
1557
  *
1481
1558
  * Analyzes a schema definition and generates TypeScript type declarations for the main schema,
1482
- * nested schemas, and union types for enum-like constraints. Uses capitalized field.name for field names,
1483
- * capitalized nestedSchema.name for type names, and ignores UUID keys. Handles required/optional fields,
1484
- * union types, primitives, arrays, sets, references, and nested structures with strict type safety.
1559
+ * nested schemas, and union types for enum fields and constraints. Uses field.name as-is for field names,
1560
+ * capitalized nestedSchema.name for type names, and handles required/optional fields, new types (enum,
1561
+ * record, union), discriminated unions with common fields, primitives, arrays, sets, references, and nested
1562
+ * structures with strict type safety. Introduces unique generics for each record field.
1485
1563
  *
1486
1564
  * @param schema - The schema definition to convert
1487
1565
  * @param includeComments - Whether to include JSDoc comments (default: true)
@@ -1500,22 +1578,14 @@ declare function generateValidationInterface(schema: SchemaDefinition, exportTyp
1500
1578
  declare function serializeParams(params: any): string;
1501
1579
  /**
1502
1580
  * Creates a Standard Schema validator that conforms to the StandardSchemaV1 interface.
1503
- * The validator uses a closure pattern to maintain internal state and avoid prop drilling.
1504
- * Instead of only returning a boolean, the validator collects detailed error issues if validation fails.
1505
- *
1506
- * @template T - The type of the data object to validate
1507
- * @param {SchemaDefinition} schema - The schema definition containing field and constraint rules
1508
- * @param {PredicateMap} constraintsMap - A map of constraint names to predicate functions
1509
- * @returns {StandardSchemaV1<T, T>} An object conforming to the StandardSchemaV1 interface
1510
- *
1511
- * @example
1512
- * const validator = createStandardSchemaValidator(mySchema, myConstraints);
1513
- * const result = validator["~standard"].validate(data);
1514
- * if ('issues' in result) {
1515
- * console.log('Validation failed:', result.issues);
1516
- * }
1517
1581
  */
1518
1582
  declare function createStandardSchemaValidator<T extends Record<string, any>>(schema: SchemaDefinition, constraintsMap: PredicateMap): StandardSchemaV1<T, T>;
1583
+ /**
1584
+ * Adapts a StandardSchemaV1 validator to React Hook Form's resolver interface.
1585
+ * @param validator - The StandardSchemaV1 validator instance.
1586
+ * @returns A resolver function compatible with React Hook Form.
1587
+ */
1588
+ declare function formResolver<TFieldValues extends FieldValues>(validator: ReturnType<typeof createStandardSchemaValidator>["~standard"]): (values: TFieldValues, context: unknown, options: ResolverOptions<TFieldValues>) => Promise<ResolverResult<TFieldValues>>;
1519
1589
 
1520
1590
  /**
1521
1591
  * Calculates the next version number based on schema changes.
@@ -1563,4 +1633,4 @@ interface FieldGroup {
1563
1633
  */
1564
1634
  declare function extractInputFieldGroups(schema: SchemaDefinition): FieldGroup[];
1565
1635
 
1566
- export { type Constraint, type ConstraintGroup, type ConstraintParameters, type ConstraintsMap, type DataTransform, type FieldDefinition, type FieldGroup, type FieldType, type FunctionMap, type IndexDefinition, type IndexType, JsonPatchError, type LogicalOperator, type Migration, MigrationEngine, type MigrationEngineInterface, MigrationError, MigrationErrorCode, type MigrationMetadata, type NestedSchemaDefinition, type PartialIndexCondition, type PatchOperation, type Persistence, type PersistenceCollection, type PersistenceEvent, type PersistenceEventType, type PersistenceTransaction, type Predicate, type PredicateMap, type PredicateName, type PredicateParameters, type RegistryLock, type RegistryMetadata, type RemoteRepository, type Schema, type SchemaChange, type SchemaConstraint, type SchemaDefinition, type SchemaEvent, type SchemaEventType, type SchemaIndex, type SchemaMetadata, type SchemaMigrationHelper, SchemaRegistry, type SchemaRegistryInterface, type SchemaVersion, type TransformFunction, applyPatch, calculateNextVersion, compareSemanticVersions, createGitSchemaRegistry, createPatch, createSchemaMigrationHelper, createStandardSchemaValidator, deepMerge, docgen, extractInputFieldGroups, generateSHA256Hash, generateValidationInterface, normalizePath, schemaChangeToPatch, schemaToTypes, serializeParams, sortSemanticVars, validate, validateMigration, validateSchemaChange, validateSchemaDefinition };
1636
+ export { type ArrayHint, type BooleanHint, type Constraint, type ConstraintGroup, type ConstraintParameters, type ConstraintsMap, type DataTransform, type DateHint, type DynamicHint, type EnumHint, type FieldDefinition, type FieldGroup, type FieldSchema, type FieldType, type FileHint, type FunctionMap, type GroupDefinition, type IndexDefinition, type IndexType, type InputHint, JsonPatchError, type LogicalOperator, type Migration, MigrationEngine, type MigrationEngineInterface, MigrationError, MigrationErrorCode, type MigrationMetadata, type NestedSchemaDefinition, type NumberHint, type ObjectHint, type PartialIndexCondition, type PatchOperation, type Persistence, type PersistenceCollection, type PersistenceEvent, type PersistenceEventType, type PersistenceTransaction, type Predicate, type PredicateMap, type PredicateName, type PredicateParameters, type RegistryLock, type RegistryMetadata, type RemoteRepository, type Schema, type SchemaChange, type SchemaConstraint, type SchemaDefinition, type SchemaEvent, type SchemaEventType, type SchemaHint, type SchemaIndex, type SchemaMetadata, type SchemaMigrationHelper, SchemaRegistry, type SchemaRegistryInterface, type SchemaVersion, type SecretHint, type SetHint, type TextHint, type TransformFunction, applyPatch, calculateNextVersion, compareSemanticVersions, createGitSchemaRegistry, createPatch, createSchemaMigrationHelper, createStandardSchemaValidator, deepMerge, docgen, extractInputFieldGroups, formResolver, generateSHA256Hash, generateValidationInterface, normalizePath, schemaChangeToPatch, schemaToTypes, serializeParams, sortSemanticVars, validate, validateMigration, validateSchemaChange, validateSchemaDefinition };
package/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { Faker } from '@faker-js/faker';
3
3
  import { QueryDSL, QueryFilter } from '@asaidimu/query';
4
4
  import { StandardSchemaV1 } from '@standard-schema/spec';
5
5
  import LightningFS from '@isomorphic-git/lightning-fs';
6
+ import { FieldValues, ResolverOptions, ResolverResult } from 'react-hook-form';
6
7
 
7
8
  /**
8
9
  * hints.ts
@@ -129,10 +130,22 @@ type DynamicHint = {
129
130
  group?: string;
130
131
  ignore?: boolean;
131
132
  };
133
+ /**
134
+ * Hints for generating a date input control.
135
+ */
136
+ type DateHint = {
137
+ type: "date" | "datetime" | "time";
138
+ label?: string;
139
+ placeholder?: string;
140
+ min?: string;
141
+ max?: string;
142
+ group?: string;
143
+ ignore?: boolean;
144
+ };
132
145
  /**
133
146
  * Union type for all possible input hints.
134
147
  */
135
- type InputHint = FileHint | TextHint | SecretHint | NumberHint | BooleanHint | EnumHint | ArrayHint | SetHint | ObjectHint | DynamicHint;
148
+ type InputHint = FileHint | TextHint | SecretHint | NumberHint | BooleanHint | EnumHint | ArrayHint | SetHint | ObjectHint | DynamicHint | DateHint;
136
149
  /**
137
150
  * Defines metadata for a group of inputs at the schema level.
138
151
  */
@@ -155,7 +168,7 @@ type LogicalOperator = "and" | "or" | "not" | "nor" | "xor";
155
168
  /**
156
169
  * Basic field types supported by the schema system.
157
170
  */
158
- type FieldType = "string" | "number" | "boolean" | "array" | "set" | "enum" | "object" | "record" | "dynamic";
171
+ type FieldType = "string" | "number" | "boolean" | "array" | "set" | "enum" | "object" | "record" | "union" | "dynamic";
159
172
  /**
160
173
  * Index types for optimizing different query patterns.
161
174
  */
@@ -226,6 +239,12 @@ interface ConstraintGroup<T extends FieldType> {
226
239
  * Collection of constraints or groups applied at the schema or nested level.
227
240
  */
228
241
  type SchemaConstraint<T extends FieldType> = Array<Constraint<T> | ConstraintGroup<T>>;
242
+ /** Reference to a nested schema (mini-SchemaDefinition) with optional overrides. */
243
+ interface FieldSchema {
244
+ id: string;
245
+ constraints?: SchemaConstraint<any>;
246
+ indexes?: IndexDefinition[];
247
+ }
229
248
  /**
230
249
  * Defines a field within a schema, including its type, constraints, and nesting.
231
250
  */
@@ -233,16 +252,16 @@ interface FieldDefinition<T> {
233
252
  name: string;
234
253
  type: FieldType;
235
254
  required?: boolean;
236
- constraints?: Constraint<any>[];
255
+ constraints?: Array<Constraint<any> | ConstraintGroup<any>>;
237
256
  default?: T;
238
- values?: Array<unknown>;
257
+ /** For type 'enum', specifies the allowed values. */
258
+ values?: Array<string | number>;
259
+ /** For type 'union', specifies the array of allowed schemas.
260
+ * For type 'object' specifies the schema of the object
261
+ * */
262
+ schema?: FieldSchema | Array<FieldSchema>;
239
263
  itemsType?: FieldType;
240
- /** Reference to a nested schema (mini-SchemaDefinition) with optional overrides. */
241
- nestedSchema?: {
242
- id: string;
243
- constraints?: SchemaConstraint<any>;
244
- indexes?: IndexDefinition[];
245
- };
264
+ nestedSchema?: FieldSchema;
246
265
  deprecated?: boolean;
247
266
  reference?: {
248
267
  schema: string;
@@ -276,15 +295,50 @@ interface IndexDefinition {
276
295
  name: string;
277
296
  }
278
297
  /**
279
- * A mini-schema definition for reusable nested structures within a larger schema.
280
- * Mirrors SchemaDefinition but omits top-level-only properties like version and migrations.
298
+ * Represents a nested schema definition embedded within a parent schema.
299
+ * Unlike SchemaDefinition, this can use a discriminated array of field sets for variant-specific fields,
300
+ * but only when concrete is false. This restriction avoids complexity in RDBMS implementations,
301
+ * where concrete schemas map directly to tables with fixed columns. Non-concrete schemas, as embedded
302
+ * structures, can leverage this flexibility without affecting physical table design.
281
303
  */
282
304
  interface NestedSchemaDefinition {
305
+ /**
306
+ * The name of the nested schema, unique within the parent schema's nestedSchemas.
307
+ */
283
308
  name: string;
309
+ /**
310
+ * A description of the nested schema's purpose.
311
+ */
284
312
  description?: string;
285
- fields: Record<string, FieldDefinition<any>>;
286
- indexes?: IndexDefinition[];
313
+ /**
314
+ * Indicates whether this schema represents a standalone entity (true) or is embedded (false).
315
+ * When true, fields must be a Record<string, FieldDefinition<any>> to ensure a fixed structure
316
+ * suitable for RDBMS table mapping. When false, fields can be an array of discriminated field sets.
317
+ * @default false
318
+ */
319
+ concrete?: boolean;
320
+ /**
321
+ * Defines the fields of the nested schema.
322
+ * - If concrete is true, must be a Record<string, FieldDefinition<any>> for a fixed field set.
323
+ * - If concrete is false, can be either a Record<string, FieldDefinition<any>> or an
324
+ * Array<{ fields: Record<string, FieldDefinition<any>>; when?: { field: string; value: any } }>,
325
+ * allowing discriminated field sets based on a field value (e.g., 'type').
326
+ * The array form enables variant-specific fields without constraints, but is not supported for
327
+ * concrete schemas to maintain simplicity in RDBMS table mappings.
328
+ */
329
+ fields: Record<string, FieldDefinition<any>> | Array<{
330
+ fields: Record<string, FieldDefinition<any>>;
331
+ when?: {
332
+ field: string;
333
+ value: any;
334
+ };
335
+ }>;
336
+ /**
337
+ * Optional constraints for additional validation rules.
338
+ * Less necessary when using discriminated field sets, as variant logic can be structural.
339
+ */
287
340
  constraints?: SchemaConstraint<any>;
341
+ indexes?: IndexDefinition[];
288
342
  metadata?: Record<string, any>;
289
343
  }
290
344
  /**
@@ -1454,9 +1508,32 @@ declare class MigrationEngine {
1454
1508
  */
1455
1509
  declare const createSchemaMigrationHelper: <T>(schema: Readonly<SchemaDefinition>) => SchemaMigrationHelper;
1456
1510
 
1457
- declare function validateMigration<T>(change: any): change is Migration<T>;
1458
- declare function validateSchemaChange<T>(change: any): change is SchemaChange<T>;
1459
- declare function validateSchemaDefinition(schema: any): schema is SchemaDefinition;
1511
+ /**
1512
+ * Validates a migration object against the standard schema.
1513
+ * @template T The expected type of the migration data.
1514
+ * @param change The object to validate.
1515
+ * @returns A type guard indicating whether the object conforms to Migration<T>.
1516
+ * @throws {SchemaValidationError} If validation fails due to an unexpected error.
1517
+ */
1518
+ declare function validateMigration<T>(change: unknown): change is Migration<T>;
1519
+ /**
1520
+ * Validates a schema change object against the standard schema.
1521
+ * @template T The expected type of the schema change data.
1522
+ * @param change The object to validate.
1523
+ * @returns A type guard indicating whether the object conforms to SchemaChange<T>.
1524
+ * @throws {SchemaValidationError} If validation fails due to an unexpected error.
1525
+ */
1526
+ declare function validateSchemaChange<T>(change: unknown): change is SchemaChange<T>;
1527
+ /**
1528
+ * Validates a schema definition object against the standard schema.
1529
+ * @param schema The object to validate.
1530
+ * @returns A type guard indicating whether the object conforms to SchemaDefinition.
1531
+ * @throws {SchemaValidationError} If validation fails due to an unexpected error.
1532
+ */
1533
+ declare function validateSchemaDefinition(schema: unknown): schema is SchemaDefinition;
1534
+ /**
1535
+ * Alias for validateSchemaDefinition, provided for convenience.
1536
+ */
1460
1537
  declare const validate: typeof validateSchemaDefinition;
1461
1538
 
1462
1539
  /**
@@ -1479,9 +1556,10 @@ declare function deepMerge<T extends object>(target: T, update: Partial<T>): T;
1479
1556
  * Converts a SchemaDefinition to TypeScript type definitions
1480
1557
  *
1481
1558
  * Analyzes a schema definition and generates TypeScript type declarations for the main schema,
1482
- * nested schemas, and union types for enum-like constraints. Uses capitalized field.name for field names,
1483
- * capitalized nestedSchema.name for type names, and ignores UUID keys. Handles required/optional fields,
1484
- * union types, primitives, arrays, sets, references, and nested structures with strict type safety.
1559
+ * nested schemas, and union types for enum fields and constraints. Uses field.name as-is for field names,
1560
+ * capitalized nestedSchema.name for type names, and handles required/optional fields, new types (enum,
1561
+ * record, union), discriminated unions with common fields, primitives, arrays, sets, references, and nested
1562
+ * structures with strict type safety. Introduces unique generics for each record field.
1485
1563
  *
1486
1564
  * @param schema - The schema definition to convert
1487
1565
  * @param includeComments - Whether to include JSDoc comments (default: true)
@@ -1500,22 +1578,14 @@ declare function generateValidationInterface(schema: SchemaDefinition, exportTyp
1500
1578
  declare function serializeParams(params: any): string;
1501
1579
  /**
1502
1580
  * Creates a Standard Schema validator that conforms to the StandardSchemaV1 interface.
1503
- * The validator uses a closure pattern to maintain internal state and avoid prop drilling.
1504
- * Instead of only returning a boolean, the validator collects detailed error issues if validation fails.
1505
- *
1506
- * @template T - The type of the data object to validate
1507
- * @param {SchemaDefinition} schema - The schema definition containing field and constraint rules
1508
- * @param {PredicateMap} constraintsMap - A map of constraint names to predicate functions
1509
- * @returns {StandardSchemaV1<T, T>} An object conforming to the StandardSchemaV1 interface
1510
- *
1511
- * @example
1512
- * const validator = createStandardSchemaValidator(mySchema, myConstraints);
1513
- * const result = validator["~standard"].validate(data);
1514
- * if ('issues' in result) {
1515
- * console.log('Validation failed:', result.issues);
1516
- * }
1517
1581
  */
1518
1582
  declare function createStandardSchemaValidator<T extends Record<string, any>>(schema: SchemaDefinition, constraintsMap: PredicateMap): StandardSchemaV1<T, T>;
1583
+ /**
1584
+ * Adapts a StandardSchemaV1 validator to React Hook Form's resolver interface.
1585
+ * @param validator - The StandardSchemaV1 validator instance.
1586
+ * @returns A resolver function compatible with React Hook Form.
1587
+ */
1588
+ declare function formResolver<TFieldValues extends FieldValues>(validator: ReturnType<typeof createStandardSchemaValidator>["~standard"]): (values: TFieldValues, context: unknown, options: ResolverOptions<TFieldValues>) => Promise<ResolverResult<TFieldValues>>;
1519
1589
 
1520
1590
  /**
1521
1591
  * Calculates the next version number based on schema changes.
@@ -1563,4 +1633,4 @@ interface FieldGroup {
1563
1633
  */
1564
1634
  declare function extractInputFieldGroups(schema: SchemaDefinition): FieldGroup[];
1565
1635
 
1566
- export { type Constraint, type ConstraintGroup, type ConstraintParameters, type ConstraintsMap, type DataTransform, type FieldDefinition, type FieldGroup, type FieldType, type FunctionMap, type IndexDefinition, type IndexType, JsonPatchError, type LogicalOperator, type Migration, MigrationEngine, type MigrationEngineInterface, MigrationError, MigrationErrorCode, type MigrationMetadata, type NestedSchemaDefinition, type PartialIndexCondition, type PatchOperation, type Persistence, type PersistenceCollection, type PersistenceEvent, type PersistenceEventType, type PersistenceTransaction, type Predicate, type PredicateMap, type PredicateName, type PredicateParameters, type RegistryLock, type RegistryMetadata, type RemoteRepository, type Schema, type SchemaChange, type SchemaConstraint, type SchemaDefinition, type SchemaEvent, type SchemaEventType, type SchemaIndex, type SchemaMetadata, type SchemaMigrationHelper, SchemaRegistry, type SchemaRegistryInterface, type SchemaVersion, type TransformFunction, applyPatch, calculateNextVersion, compareSemanticVersions, createGitSchemaRegistry, createPatch, createSchemaMigrationHelper, createStandardSchemaValidator, deepMerge, docgen, extractInputFieldGroups, generateSHA256Hash, generateValidationInterface, normalizePath, schemaChangeToPatch, schemaToTypes, serializeParams, sortSemanticVars, validate, validateMigration, validateSchemaChange, validateSchemaDefinition };
1636
+ export { type ArrayHint, type BooleanHint, type Constraint, type ConstraintGroup, type ConstraintParameters, type ConstraintsMap, type DataTransform, type DateHint, type DynamicHint, type EnumHint, type FieldDefinition, type FieldGroup, type FieldSchema, type FieldType, type FileHint, type FunctionMap, type GroupDefinition, type IndexDefinition, type IndexType, type InputHint, JsonPatchError, type LogicalOperator, type Migration, MigrationEngine, type MigrationEngineInterface, MigrationError, MigrationErrorCode, type MigrationMetadata, type NestedSchemaDefinition, type NumberHint, type ObjectHint, type PartialIndexCondition, type PatchOperation, type Persistence, type PersistenceCollection, type PersistenceEvent, type PersistenceEventType, type PersistenceTransaction, type Predicate, type PredicateMap, type PredicateName, type PredicateParameters, type RegistryLock, type RegistryMetadata, type RemoteRepository, type Schema, type SchemaChange, type SchemaConstraint, type SchemaDefinition, type SchemaEvent, type SchemaEventType, type SchemaHint, type SchemaIndex, type SchemaMetadata, type SchemaMigrationHelper, SchemaRegistry, type SchemaRegistryInterface, type SchemaVersion, type SecretHint, type SetHint, type TextHint, type TransformFunction, applyPatch, calculateNextVersion, compareSemanticVersions, createGitSchemaRegistry, createPatch, createSchemaMigrationHelper, createStandardSchemaValidator, deepMerge, docgen, extractInputFieldGroups, formResolver, generateSHA256Hash, generateValidationInterface, normalizePath, schemaChangeToPatch, schemaToTypes, serializeParams, sortSemanticVars, validate, validateMigration, validateSchemaChange, validateSchemaDefinition };