From 5ad06de350a6760c6acc6abc76b714711b528e0a Mon Sep 17 00:00:00 2001 From: Ben Durrant Date: Sun, 20 Apr 2025 22:55:51 +0100 Subject: [PATCH 1/5] create objectWithPatterns schema --- .../src/schemas/objectWithPatterns/index.ts | 1 + .../objectWithPatterns.test-d.ts | 138 +++++++ .../objectWithPatterns.test.ts | 376 ++++++++++++++++++ .../objectWithPatterns/objectWithPatterns.ts | 253 ++++++++++++ 4 files changed, 768 insertions(+) create mode 100644 library/src/schemas/objectWithPatterns/index.ts create mode 100644 library/src/schemas/objectWithPatterns/objectWithPatterns.test-d.ts create mode 100644 library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts create mode 100644 library/src/schemas/objectWithPatterns/objectWithPatterns.ts diff --git a/library/src/schemas/objectWithPatterns/index.ts b/library/src/schemas/objectWithPatterns/index.ts new file mode 100644 index 000000000..1e862ef37 --- /dev/null +++ b/library/src/schemas/objectWithPatterns/index.ts @@ -0,0 +1 @@ +export * from './objectWithPatterns.ts'; diff --git a/library/src/schemas/objectWithPatterns/objectWithPatterns.test-d.ts b/library/src/schemas/objectWithPatterns/objectWithPatterns.test-d.ts new file mode 100644 index 000000000..f83be17b7 --- /dev/null +++ b/library/src/schemas/objectWithPatterns/objectWithPatterns.test-d.ts @@ -0,0 +1,138 @@ +import { describe, expectTypeOf, test } from 'vitest'; +import { transform } from '../../actions/index.ts'; +import { pipe } from '../../methods/index.ts'; +import type { InferInput, InferIssue, InferOutput } from '../../types/index.ts'; +import type { BooleanIssue, BooleanSchema } from '../boolean/boolean.ts'; +import { boolean } from '../boolean/boolean.ts'; +import { custom } from '../custom/custom.ts'; +import type { CustomIssue } from '../custom/types.ts'; +import type { NumberIssue, NumberSchema } from '../number/number.ts'; +import { number } from '../number/number.ts'; +import type { StringIssue, StringSchema } from '../string/string.ts'; +import { string } from '../string/string.ts'; +import { + objectWithPatterns, + type ObjectWithPatternsIssue, + type ObjectWithPatternsSchema, +} from './objectWithPatterns.ts'; + +const FooKeySchema = custom<`foo(${string})`>( + (input) => + typeof input === 'string' && input.startsWith('foo(') && input.endsWith(')') +); + +const BarKeysSchema = pipe( + custom<`bar(${string})`>( + (input) => + typeof input === 'string' && + input.startsWith('bar(') && + input.endsWith(')') + ), + transform((input) => input.toUpperCase() as Uppercase) +); + +describe('objectWithPatterns', () => { + describe('should return schema object', () => { + test('without message', () => { + expectTypeOf( + objectWithPatterns( + [ + [FooKeySchema, string()], + [BarKeysSchema, number()], + ], + boolean() + ) + ).toEqualTypeOf< + ObjectWithPatternsSchema< + readonly [ + readonly [typeof FooKeySchema, StringSchema], + readonly [typeof BarKeysSchema, NumberSchema], + ], + BooleanSchema, + undefined + > + >(); + }); + test('with message', () => { + expectTypeOf( + objectWithPatterns( + [ + [FooKeySchema, string()], + [BarKeysSchema, number()], + ], + boolean(), + 'message' + ) + ).toEqualTypeOf< + ObjectWithPatternsSchema< + readonly [ + readonly [typeof FooKeySchema, StringSchema], + readonly [typeof BarKeysSchema, NumberSchema], + ], + BooleanSchema, + 'message' + > + >(); + }); + }); + describe('should return inference types', () => { + test('of input', () => { + expectTypeOf< + InferInput< + ObjectWithPatternsSchema< + readonly [ + readonly [typeof FooKeySchema, StringSchema], + readonly [typeof BarKeysSchema, NumberSchema], + ], + BooleanSchema, + undefined + > + > + >().toEqualTypeOf< + { + [key: `foo(${string})`]: string | undefined; + [key: `bar(${string})`]: number | undefined; + } & { [key: string]: boolean } + >(); + }); + test('of output', () => { + expectTypeOf< + InferOutput< + ObjectWithPatternsSchema< + readonly [ + readonly [typeof FooKeySchema, StringSchema], + readonly [typeof BarKeysSchema, NumberSchema], + ], + BooleanSchema, + undefined + > + > + >().toEqualTypeOf< + { + [key: `foo(${string})`]: string | undefined; + [key: `BAR(${Uppercase})`]: number | undefined; + } & { [key: string]: boolean } + >(); + }); + test('of issue', () => { + expectTypeOf< + InferIssue< + ObjectWithPatternsSchema< + readonly [ + readonly [typeof FooKeySchema, StringSchema], + readonly [typeof BarKeysSchema, NumberSchema], + ], + BooleanSchema, + undefined + > + > + >().toEqualTypeOf< + | ObjectWithPatternsIssue + | CustomIssue + | StringIssue + | NumberIssue + | BooleanIssue + >(); + }); + }); +}); diff --git a/library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts b/library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts new file mode 100644 index 000000000..73eeae208 --- /dev/null +++ b/library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts @@ -0,0 +1,376 @@ +import { describe, expect, test } from 'vitest'; +import { transform } from '../../actions/index.ts'; +import { pipe } from '../../methods/index.ts'; +import { + boolean, + custom, + never, + number, + object, + string, +} from '../../schemas/index.ts'; +import type { FailureDataset } from '../../types/dataset.ts'; +import type { InferIssue } from '../../types/infer.ts'; +import { expectNoSchemaIssue } from '../../vitest/expectNoSchemaIssue.ts'; +import { expectSchemaIssue } from '../../vitest/expectSchemaIssue.ts'; +import type { + ObjectWithPatternsIssue, + ObjectWithPatternsSchema, +} from './objectWithPatterns.ts'; +import { objectWithPatterns } from './objectWithPatterns.ts'; + +const FooKeySchema = custom<`foo(${string})`>( + (input) => + typeof input === 'string' && input.startsWith('foo(') && input.endsWith(')') +); + +const BarKeySchema = pipe( + custom<`bar(${string})`>( + (input) => + typeof input === 'string' && + input.startsWith('bar(') && + input.endsWith(')') + ), + transform((input) => input.toUpperCase() as Uppercase) +); + +describe('objectWithPatterns', () => { + describe('should return schema object', () => { + const patterns = [ + [FooKeySchema, string()], + [BarKeySchema, number()], + ] as const; + type Patterns = typeof patterns; + const rest = boolean(); + type Rest = typeof rest; + const baseSchema: Omit< + ObjectWithPatternsSchema, + 'message' + > = { + kind: 'schema', + type: 'object_with_patterns', + reference: objectWithPatterns, + expects: 'Object', + patterns, + rest, + async: false, + '~standard': { + version: 1, + vendor: 'valibot', + validate: expect.any(Function), + }, + '~run': expect.any(Function), + }; + test('without message', () => { + expect(objectWithPatterns(patterns, rest)).toStrictEqual({ + ...baseSchema, + message: undefined, + }); + }); + test('with message', () => { + expect(objectWithPatterns(patterns, rest, 'message')).toStrictEqual({ + ...baseSchema, + message: 'message', + }); + }); + }); + describe('should return dataset without issues', () => { + test('for empty object', () => { + expectNoSchemaIssue( + objectWithPatterns([[FooKeySchema, string()]], boolean()), + [{}] + ); + }); + test('for simple object', () => { + expectNoSchemaIssue( + objectWithPatterns( + [ + [FooKeySchema, string()], + [BarKeySchema, number()], + ], + boolean() + ), + // @ts-expect-error + [{ 'foo(bar)': 'foo', 'bar(baz)': 123, other: true }] + ); + }); + }); + describe('should return dataset with issues', () => { + const schema = objectWithPatterns( + [[FooKeySchema, string()]], + never(), + 'message' + ); + const baseIssue: Omit = { + kind: 'schema', + type: 'object_with_patterns', + expected: 'Object', + message: 'message', + }; + + // for primitive types + + test('for bigints', () => { + expectSchemaIssue(schema, baseIssue, [-1n, 0n, 123n]); + }); + + test('for booleans', () => { + expectSchemaIssue(schema, baseIssue, [true, false]); + }); + + test('for null', () => { + expectSchemaIssue(schema, baseIssue, [null]); + }); + + test('for numbers', () => { + expectSchemaIssue(schema, baseIssue, [-1, 0, 123, 45.67]); + }); + + test('for strings', () => { + expectSchemaIssue(schema, baseIssue, ['foo', 'bar', 'baz']); + }); + + test('for symbols', () => { + expectSchemaIssue(schema, baseIssue, [ + Symbol('foo'), + Symbol('bar'), + Symbol('baz'), + ]); + }); + + // complex types + + // TODO: Enable this test again in case we find a reliable way to check for + // plain objects + // test('for arrays', () => { + // expectSchemaIssue(schema, baseIssue, [[], ['value']]); + // }); + + test('for functions', () => { + // eslint-disable-next-line @typescript-eslint/no-empty-function + expectSchemaIssue(schema, baseIssue, [() => {}, function () {}]); + }); + }); + + describe('should return dataset without nested issues', () => { + test('for simple object', () => { + expectNoSchemaIssue( + objectWithPatterns([[FooKeySchema, string()]], boolean()), + // @ts-expect-error + [{ 'foo(bar)': 'foo', other: true }] + ); + }); + + test('for nested object', () => { + expectNoSchemaIssue( + objectWithPatterns( + [[FooKeySchema, object({ key: string() })]], + object({ key: number() }) + ), + // @ts-expect-error + [{ 'foo(bar)': { key: 'foo' }, other: { key: 123 } }] + ); + }); + }); + describe('should return dataset with nested issues', () => { + const schema = objectWithPatterns( + [ + [FooKeySchema, string()], + [BarKeySchema, object({ key: number() })], + ], + object({ key: number() }), + 'message' + ); + + const baseInfo = { + message: expect.any(String), + requirement: undefined, + issues: undefined, + lang: undefined, + abortEarly: undefined, + abortPipeEarly: undefined, + }; + + test('for invalid entries', () => { + const input = { 'foo(bar)': false, 'bar(baz)': '123', other: 'foo' }; + expect(schema['~run']({ value: input }, {})).toStrictEqual({ + typed: false, + value: input, + issues: [ + { + ...baseInfo, + kind: 'schema', + type: 'string', + input: false, + expected: 'string', + received: 'false', + path: [ + { + type: 'object', + origin: 'value', + input, + key: 'foo(bar)', + value: false, + }, + ], + }, + { + ...baseInfo, + kind: 'schema', + type: 'object', + input: '123', + expected: 'Object', + received: '"123"', + path: [ + { + type: 'object', + origin: 'value', + input, + key: 'bar(baz)', + value: '123', + }, + ], + }, + { + ...baseInfo, + kind: 'schema', + type: 'object', + input: 'foo', + expected: 'Object', + received: '"foo"', + path: [ + { + type: 'object', + origin: 'value', + input, + key: 'other', + value: 'foo', + }, + ], + }, + ], + } satisfies FailureDataset>); + }); + test('for invalid nested entries', () => { + const input = { 'bar(baz)': { key: '123' } }; + expect(schema['~run']({ value: input }, {})).toStrictEqual({ + typed: false, + value: input, + issues: [ + { + ...baseInfo, + kind: 'schema', + type: 'number', + input: '123', + expected: 'number', + received: '"123"', + path: [ + { + type: 'object', + origin: 'value', + input, + key: 'bar(baz)', + value: input['bar(baz)'], + }, + { + type: 'object', + origin: 'value', + input: input['bar(baz)'], + key: 'key', + value: '123', + }, + ], + }, + ], + } satisfies FailureDataset>); + }); + test('for invalid entries with abort early', () => { + const input = { 'foo(bar)': false, 'bar(baz)': '123', other: 'foo' }; + expect( + schema['~run']({ value: input }, { abortEarly: true }) + ).toStrictEqual({ + typed: false, + value: {}, + issues: [ + { + ...baseInfo, + kind: 'schema', + type: 'string', + input: false, + expected: 'string', + received: 'false', + path: [ + { + type: 'object', + origin: 'value', + input, + key: 'foo(bar)', + value: false, + }, + ], + abortEarly: true, + }, + ], + }); + }); + test('for wrong rest', () => { + const input = { 'foo(bar)': 'foo', other: 'foo' }; + expect(schema['~run']({ value: input }, {})).toStrictEqual({ + typed: false, + value: input, + issues: [ + { + ...baseInfo, + kind: 'schema', + type: 'object', + input: 'foo', + expected: 'Object', + received: '"foo"', + path: [ + { + type: 'object', + origin: 'value', + input, + key: 'other', + value: 'foo', + }, + ], + }, + ], + }); + }); + test('for wrong nested rest', () => { + const input = { other: { key: 'foo' } }; + expect(schema['~run']({ value: input }, {})).toStrictEqual({ + typed: false, + value: input, + issues: [ + { + ...baseInfo, + kind: 'schema', + type: 'number', + input: 'foo', + expected: 'number', + received: '"foo"', + path: [ + { + type: 'object', + origin: 'value', + input, + key: 'other', + value: input.other, + }, + { + type: 'object', + origin: 'value', + input: input.other, + key: 'key', + value: 'foo', + }, + ], + }, + ], + } satisfies FailureDataset>); + }); + }); +}); diff --git a/library/src/schemas/objectWithPatterns/objectWithPatterns.ts b/library/src/schemas/objectWithPatterns/objectWithPatterns.ts new file mode 100644 index 000000000..f6266f761 --- /dev/null +++ b/library/src/schemas/objectWithPatterns/objectWithPatterns.ts @@ -0,0 +1,253 @@ +import type { + BaseIssue, + BaseSchema, + ErrorMessage, + InferInput, + InferIssue, + InferOutput, + ObjectPathItem, + OutputDataset, + Prettify, +} from '../../types/index.ts'; +import { + _addIssue, + _getStandardProps, + _isValidObjectKey, +} from '../../utils/index.ts'; + +export type PatternTuple = readonly [ + key: BaseSchema>, + value: BaseSchema>, +]; + +export type PatternTuples = readonly [PatternTuple, ...PatternTuple[]]; + +export type InferPatternInput = { + [K in InferInput]?: InferInput; +}; + +export type InferPatternsInput = + TPatterns extends readonly [infer TPattern extends PatternTuple] + ? InferPatternInput + : TPatterns extends readonly [ + infer TPattern extends PatternTuple, + ...infer TRest extends PatternTuples, + ] + ? InferPatternInput & InferPatternsInput + : never; + +export type InferPatternIssue = InferIssue< + TPattern[number] +>; + +export type InferPatternsIssue = + InferPatternIssue; + +export type InferPatternOutput = { + [K in InferOutput]?: InferOutput; +}; + +export type InferPatternsOutput = + TPatterns extends readonly [infer TPattern extends PatternTuple] + ? InferPatternOutput + : TPatterns extends readonly [ + infer TPattern extends PatternTuple, + ...infer TRest extends PatternTuples, + ] + ? InferPatternOutput & InferPatternsOutput + : never; + +export interface ObjectWithPatternsIssue extends BaseIssue { + /** + * The issue kind. + */ + readonly kind: 'schema'; + /** + * The issue type. + */ + readonly type: 'object_with_patterns'; + /** + * The expected property. + */ + readonly expected: 'Object' | `"${string}"`; +} + +export interface ObjectWithPatternsSchema< + TPatterns extends PatternTuples, + TRest extends BaseSchema>, + TMessage extends ErrorMessage | undefined, +> extends BaseSchema< + Prettify> & { + [key: string]: InferInput; + }, + Prettify> & { + [key: string]: InferOutput; + }, + ObjectWithPatternsIssue | InferPatternsIssue | InferIssue + > { + /** + * The schema type. + */ + readonly type: 'object_with_patterns'; + /** + * The schema reference. + */ + readonly reference: typeof objectWithPatterns; + /** + * The expected property. + */ + readonly expects: 'Object'; + /** + * The patterns schema. + */ + readonly patterns: TPatterns; + /** + * The rest schema. + */ + readonly rest: TRest; + /** + * The error message. + */ + readonly message: TMessage; +} + +/** + * Creates a object schema that matches patterns. + * + * @param patterns Pairs of key and value schemas. + * @param rest Schema to use when no pattern matches. + * + * @returns A object schema. + */ +export function objectWithPatterns< + const TPatterns extends PatternTuples, + const TRest extends BaseSchema>, +>( + patterns: TPatterns, + rest: TRest +): ObjectWithPatternsSchema; + +/** + * Creates a object schema that matches patterns. + * + * @param patterns Pairs of key and value schemas. + * @param rest Schema to use when no pattern matches. + * @param message The error message. + * + * @returns A object schema. + */ +export function objectWithPatterns< + const TPatterns extends PatternTuples, + const TRest extends BaseSchema>, + const TMessage extends ErrorMessage | undefined, +>( + patterns: TPatterns, + rest: TRest, + message: TMessage +): ObjectWithPatternsSchema; + +// @__NO_SIDE_EFFECTS__ +export function objectWithPatterns( + patterns: PatternTuples, + rest: BaseSchema>, + message?: ErrorMessage +): ObjectWithPatternsSchema< + PatternTuples, + BaseSchema>, + ErrorMessage | undefined +> { + return { + kind: 'schema', + type: 'object_with_patterns', + reference: objectWithPatterns, + expects: 'Object', + async: false, + patterns, + rest, + message, + get '~standard'() { + return _getStandardProps(this); + }, + '~run'(dataset, config) { + // Get input value from dataset + const input = dataset.value; + + // If root type is valid, check nested types + if (input && typeof input === 'object') { + // Set typed to `true` and value to empty object + // @ts-expect-error + dataset.typed = true; + dataset.value = {}; + + // Parse schema of each pattern + for (const key in input) { + // exclude specific keys for security reasons + if (!_isValidObjectKey(input, key)) continue; + + // Get pattern schema + const [, valueSchema = this.rest] = + this.patterns.find( + ([keySchema]) => !keySchema['~run']({ value: key }, config).issues + ) ?? []; + // @ts-expect-error + const value = input[key]; + const valueDataset = valueSchema['~run']({ value }, config); + + // If there are issues, capture them + if (valueDataset.issues) { + // Create object path item + const pathItem: ObjectPathItem = { + type: 'object', + origin: 'value', + input: input as Record, + key, + value, + }; + + // Add modified entry dataset issues to issues + for (const issue of valueDataset.issues) { + if (issue.path) { + issue.path.unshift(pathItem); + } else { + // @ts-expect-error + issue.path = [pathItem]; + } + // @ts-expect-error + dataset.issues?.push(issue); + } + if (!dataset.issues) { + // @ts-expect-error + dataset.issues = valueDataset.issues; + } + + // If necessary, abort early + if (config.abortEarly) { + dataset.typed = false; + break; + } + } + + // If not typed, set typed to `false` + if (!valueDataset.typed) { + dataset.typed = false; + } + + // Add entry to dataset + // @ts-expect-error + dataset.value[key] = valueDataset.value; + } + // Otherwise, add object issue + } else { + _addIssue(this, 'type', dataset, config); + } + // Return output dataset + // @ts-expect-error + return dataset as OutputDataset< + InferPatternsOutput & { [key: string]: unknown }, + | ObjectWithPatternsIssue + | InferPatternsIssue + | BaseIssue + >; + }, + }; +} From 35de9812e5780f96880b0645c08f3be300907a90 Mon Sep 17 00:00:00 2001 From: Ben Durrant Date: Sun, 20 Apr 2025 23:12:33 +0100 Subject: [PATCH 2/5] properly support transforming key --- .../objectWithPatterns.test.ts | 11 ++++++++ .../objectWithPatterns/objectWithPatterns.ts | 27 ++++++++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts b/library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts index 73eeae208..e0fc71f33 100644 --- a/library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts +++ b/library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts @@ -94,6 +94,17 @@ describe('objectWithPatterns', () => { [{ 'foo(bar)': 'foo', 'bar(baz)': 123, other: true }] ); }); + test('should use transformed key', () => { + expect( + objectWithPatterns([[BarKeySchema, number()]], boolean())['~run']( + { value: { 'bar(baz)': 123 } }, + {} + ) + ).toStrictEqual({ + typed: true, + value: { 'BAR(BAZ)': 123 }, + }); + }); }); describe('should return dataset with issues', () => { const schema = objectWithPatterns( diff --git a/library/src/schemas/objectWithPatterns/objectWithPatterns.ts b/library/src/schemas/objectWithPatterns/objectWithPatterns.ts index f6266f761..e20abca16 100644 --- a/library/src/schemas/objectWithPatterns/objectWithPatterns.ts +++ b/library/src/schemas/objectWithPatterns/objectWithPatterns.ts @@ -184,11 +184,26 @@ export function objectWithPatterns( // exclude specific keys for security reasons if (!_isValidObjectKey(input, key)) continue; - // Get pattern schema - const [, valueSchema = this.rest] = - this.patterns.find( - ([keySchema]) => !keySchema['~run']({ value: key }, config).issues - ) ?? []; + // Get pattern schema and new key + + let valueSchema: + | BaseSchema> + | undefined; + let newKey = key; + for (const [keySchema, valueSchema_] of patterns) { + const keyDataset = keySchema['~run']({ value: key }, config); + if (keyDataset.typed) { + valueSchema = valueSchema_; + newKey = keyDataset.value; + break; + } + } + + // if no pattern matches, use rest schema + if (!valueSchema) { + valueSchema = rest; + } + // @ts-expect-error const value = input[key]; const valueDataset = valueSchema['~run']({ value }, config); @@ -234,7 +249,7 @@ export function objectWithPatterns( // Add entry to dataset // @ts-expect-error - dataset.value[key] = valueDataset.value; + dataset.value[newKey] = valueDataset.value; } // Otherwise, add object issue } else { From 1c9ed893df6af13c41ed2859b85376d6987cc63e Mon Sep 17 00:00:00 2001 From: Ben Durrant Date: Mon, 21 Apr 2025 12:33:09 +0100 Subject: [PATCH 3/5] objectWithPatternsAsync --- library/src/schemas/index.ts | 1 + .../src/schemas/objectWithPatterns/index.ts | 2 + .../objectWithPatterns.test-d.ts | 24 +- .../objectWithPatterns.test.ts | 25 +- .../objectWithPatterns/objectWithPatterns.ts | 16 +- .../objectWithPatternsAsync.test-d.ts | 135 +++++++ .../objectWithPatternsAsync.test.ts | 353 ++++++++++++++++++ .../objectWithPatternsAsync.ts | 275 ++++++++++++++ .../src/schemas/objectWithPatterns/types.ts | 16 + 9 files changed, 802 insertions(+), 45 deletions(-) create mode 100644 library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test-d.ts create mode 100644 library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test.ts create mode 100644 library/src/schemas/objectWithPatterns/objectWithPatternsAsync.ts create mode 100644 library/src/schemas/objectWithPatterns/types.ts diff --git a/library/src/schemas/index.ts b/library/src/schemas/index.ts index 1d43af2a2..2bc7c940a 100644 --- a/library/src/schemas/index.ts +++ b/library/src/schemas/index.ts @@ -26,6 +26,7 @@ export * from './nullable/index.ts'; export * from './nullish/index.ts'; export * from './number/index.ts'; export * from './object/index.ts'; +export * from './objectWithPatterns/index.ts'; export * from './objectWithRest/index.ts'; export * from './optional/index.ts'; export * from './picklist/index.ts'; diff --git a/library/src/schemas/objectWithPatterns/index.ts b/library/src/schemas/objectWithPatterns/index.ts index 1e862ef37..6c8e12caa 100644 --- a/library/src/schemas/objectWithPatterns/index.ts +++ b/library/src/schemas/objectWithPatterns/index.ts @@ -1 +1,3 @@ export * from './objectWithPatterns.ts'; +export * from './objectWithPatternsAsync.ts'; +export * from './types.ts'; diff --git a/library/src/schemas/objectWithPatterns/objectWithPatterns.test-d.ts b/library/src/schemas/objectWithPatterns/objectWithPatterns.test-d.ts index f83be17b7..5b90c4fb9 100644 --- a/library/src/schemas/objectWithPatterns/objectWithPatterns.test-d.ts +++ b/library/src/schemas/objectWithPatterns/objectWithPatterns.test-d.ts @@ -10,18 +10,16 @@ import type { NumberIssue, NumberSchema } from '../number/number.ts'; import { number } from '../number/number.ts'; import type { StringIssue, StringSchema } from '../string/string.ts'; import { string } from '../string/string.ts'; -import { - objectWithPatterns, - type ObjectWithPatternsIssue, - type ObjectWithPatternsSchema, -} from './objectWithPatterns.ts'; +import type { ObjectWithPatternsSchema } from './objectWithPatterns.ts'; +import { objectWithPatterns } from './objectWithPatterns.ts'; +import type { ObjectWithPatternsIssue } from './types.ts'; const FooKeySchema = custom<`foo(${string})`>( (input) => typeof input === 'string' && input.startsWith('foo(') && input.endsWith(')') ); -const BarKeysSchema = pipe( +const BarKeySchema = pipe( custom<`bar(${string})`>( (input) => typeof input === 'string' && @@ -38,7 +36,7 @@ describe('objectWithPatterns', () => { objectWithPatterns( [ [FooKeySchema, string()], - [BarKeysSchema, number()], + [BarKeySchema, number()], ], boolean() ) @@ -46,7 +44,7 @@ describe('objectWithPatterns', () => { ObjectWithPatternsSchema< readonly [ readonly [typeof FooKeySchema, StringSchema], - readonly [typeof BarKeysSchema, NumberSchema], + readonly [typeof BarKeySchema, NumberSchema], ], BooleanSchema, undefined @@ -58,7 +56,7 @@ describe('objectWithPatterns', () => { objectWithPatterns( [ [FooKeySchema, string()], - [BarKeysSchema, number()], + [BarKeySchema, number()], ], boolean(), 'message' @@ -67,7 +65,7 @@ describe('objectWithPatterns', () => { ObjectWithPatternsSchema< readonly [ readonly [typeof FooKeySchema, StringSchema], - readonly [typeof BarKeysSchema, NumberSchema], + readonly [typeof BarKeySchema, NumberSchema], ], BooleanSchema, 'message' @@ -82,7 +80,7 @@ describe('objectWithPatterns', () => { ObjectWithPatternsSchema< readonly [ readonly [typeof FooKeySchema, StringSchema], - readonly [typeof BarKeysSchema, NumberSchema], + readonly [typeof BarKeySchema, NumberSchema], ], BooleanSchema, undefined @@ -101,7 +99,7 @@ describe('objectWithPatterns', () => { ObjectWithPatternsSchema< readonly [ readonly [typeof FooKeySchema, StringSchema], - readonly [typeof BarKeysSchema, NumberSchema], + readonly [typeof BarKeySchema, NumberSchema], ], BooleanSchema, undefined @@ -120,7 +118,7 @@ describe('objectWithPatterns', () => { ObjectWithPatternsSchema< readonly [ readonly [typeof FooKeySchema, StringSchema], - readonly [typeof BarKeysSchema, NumberSchema], + readonly [typeof BarKeySchema, NumberSchema], ], BooleanSchema, undefined diff --git a/library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts b/library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts index e0fc71f33..d16c0ecb4 100644 --- a/library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts +++ b/library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts @@ -13,11 +13,9 @@ import type { FailureDataset } from '../../types/dataset.ts'; import type { InferIssue } from '../../types/infer.ts'; import { expectNoSchemaIssue } from '../../vitest/expectNoSchemaIssue.ts'; import { expectSchemaIssue } from '../../vitest/expectSchemaIssue.ts'; -import type { - ObjectWithPatternsIssue, - ObjectWithPatternsSchema, -} from './objectWithPatterns.ts'; +import type { ObjectWithPatternsSchema } from './objectWithPatterns.ts'; import { objectWithPatterns } from './objectWithPatterns.ts'; +import type { ObjectWithPatternsIssue } from './types.ts'; const FooKeySchema = custom<`foo(${string})`>( (input) => @@ -82,27 +80,20 @@ describe('objectWithPatterns', () => { ); }); test('for simple object', () => { - expectNoSchemaIssue( + expect( objectWithPatterns( [ [FooKeySchema, string()], [BarKeySchema, number()], ], boolean() - ), - // @ts-expect-error - [{ 'foo(bar)': 'foo', 'bar(baz)': 123, other: true }] - ); - }); - test('should use transformed key', () => { - expect( - objectWithPatterns([[BarKeySchema, number()]], boolean())['~run']( - { value: { 'bar(baz)': 123 } }, + )['~run']( + { value: { 'foo(bar)': 'foo', 'bar(baz)': 123, other: true } }, {} ) ).toStrictEqual({ typed: true, - value: { 'BAR(BAZ)': 123 }, + value: { 'foo(bar)': 'foo', 'BAR(BAZ)': 123, other: true }, }); }); }); @@ -206,7 +197,7 @@ describe('objectWithPatterns', () => { const input = { 'foo(bar)': false, 'bar(baz)': '123', other: 'foo' }; expect(schema['~run']({ value: input }, {})).toStrictEqual({ typed: false, - value: input, + value: { 'foo(bar)': false, 'BAR(BAZ)': '123', other: 'foo' }, issues: [ { ...baseInfo, @@ -266,7 +257,7 @@ describe('objectWithPatterns', () => { const input = { 'bar(baz)': { key: '123' } }; expect(schema['~run']({ value: input }, {})).toStrictEqual({ typed: false, - value: input, + value: { 'BAR(BAZ)': { key: '123' } }, issues: [ { ...baseInfo, diff --git a/library/src/schemas/objectWithPatterns/objectWithPatterns.ts b/library/src/schemas/objectWithPatterns/objectWithPatterns.ts index e20abca16..e6e33415e 100644 --- a/library/src/schemas/objectWithPatterns/objectWithPatterns.ts +++ b/library/src/schemas/objectWithPatterns/objectWithPatterns.ts @@ -14,6 +14,7 @@ import { _getStandardProps, _isValidObjectKey, } from '../../utils/index.ts'; +import type { ObjectWithPatternsIssue } from './types.ts'; export type PatternTuple = readonly [ key: BaseSchema>, @@ -57,21 +58,6 @@ export type InferPatternsOutput = ? InferPatternOutput & InferPatternsOutput : never; -export interface ObjectWithPatternsIssue extends BaseIssue { - /** - * The issue kind. - */ - readonly kind: 'schema'; - /** - * The issue type. - */ - readonly type: 'object_with_patterns'; - /** - * The expected property. - */ - readonly expected: 'Object' | `"${string}"`; -} - export interface ObjectWithPatternsSchema< TPatterns extends PatternTuples, TRest extends BaseSchema>, diff --git a/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test-d.ts b/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test-d.ts new file mode 100644 index 000000000..ee6c51031 --- /dev/null +++ b/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test-d.ts @@ -0,0 +1,135 @@ +import { describe, expectTypeOf, test } from 'vitest'; +import { transformAsync } from '../../actions/index.ts'; +import { pipeAsync } from '../../methods/index.ts'; +import type { + CustomIssue, + ObjectWithPatternsIssue, + ObjectWithPatternsSchemaAsync, + StringIssue, + StringSchema, +} from '../../schemas/index.ts'; +import { + customAsync, + objectWithPatternsAsync, + string, +} from '../../schemas/index.ts'; +import type { InferInput, InferIssue, InferOutput } from '../../types/index.ts'; + +const FooKeySchema = customAsync<`foo(${string})`>( + (input) => + typeof input === 'string' && input.startsWith('foo(') && input.endsWith(')') +); + +const BarKeySchema = pipeAsync( + customAsync<`bar(${string})`>( + (input) => + typeof input === 'string' && + input.startsWith('bar(') && + input.endsWith(')') + ), + transformAsync( + async (input) => input.toUpperCase() as Uppercase + ) +); + +describe('objectWithPatternsAsync', () => { + describe('should return schema object', () => { + test('without message', () => { + expectTypeOf( + objectWithPatternsAsync( + [ + [FooKeySchema, string()], + [BarKeySchema, string()], + ], + string() + ) + ).toEqualTypeOf< + ObjectWithPatternsSchemaAsync< + readonly [ + readonly [typeof FooKeySchema, StringSchema], + readonly [typeof BarKeySchema, StringSchema], + ], + StringSchema, + undefined + > + >(); + }); + + test('with message', () => { + expectTypeOf( + objectWithPatternsAsync( + [ + [FooKeySchema, string()], + [BarKeySchema, string()], + ], + string(), + 'message' + ) + ).toEqualTypeOf< + ObjectWithPatternsSchemaAsync< + readonly [ + readonly [typeof FooKeySchema, StringSchema], + readonly [typeof BarKeySchema, StringSchema], + ], + StringSchema, + 'message' + > + >(); + }); + }); + + describe('should return inferred type', () => { + test('of input', () => { + expectTypeOf< + InferInput< + ObjectWithPatternsSchemaAsync< + readonly [ + readonly [typeof FooKeySchema, StringSchema], + readonly [typeof BarKeySchema, StringSchema], + ], + StringSchema, + undefined + > + > + >().toEqualTypeOf< + { + [key: `foo(${string})`]: string | undefined; + [key: `bar(${string})`]: string | undefined; + } & { [key: string]: string } + >(); + }); + test('of output', () => { + expectTypeOf< + InferOutput< + ObjectWithPatternsSchemaAsync< + readonly [ + readonly [typeof FooKeySchema, StringSchema], + readonly [typeof BarKeySchema, StringSchema], + ], + StringSchema, + undefined + > + > + >().toEqualTypeOf< + { + [key: `foo(${string})`]: string | undefined; + [key: `BAR(${Uppercase})`]: string | undefined; + } & { [key: string]: string } + >(); + }); + test('of issue', () => { + expectTypeOf< + InferIssue< + ObjectWithPatternsSchemaAsync< + readonly [ + readonly [typeof FooKeySchema, StringSchema], + readonly [typeof BarKeySchema, StringSchema], + ], + StringSchema, + undefined + > + > + >().toEqualTypeOf(); + }); + }); +}); diff --git a/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test.ts b/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test.ts new file mode 100644 index 000000000..88bd4e4bd --- /dev/null +++ b/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test.ts @@ -0,0 +1,353 @@ +import { describe, expect, test } from 'vitest'; +import { transformAsync } from '../../actions/index.ts'; +import { pipeAsync } from '../../methods/index.ts'; +import type { + ObjectWithPatternsIssue, + ObjectWithPatternsSchemaAsync, +} from '../../schemas/index.ts'; +import { + boolean, + customAsync, + never, + number, + objectAsync, + objectWithPatternsAsync, + string, +} from '../../schemas/index.ts'; +import { FailureDataset } from '../../types/dataset.ts'; +import { InferIssue } from '../../types/infer.ts'; +import { + expectNoSchemaIssueAsync, + expectSchemaIssueAsync, +} from '../../vitest/index.ts'; + +const FooKeySchema = customAsync<`foo(${string})`>( + async (input) => + typeof input === 'string' && input.startsWith('foo(') && input.endsWith(')') +); + +const BarKeySchema = pipeAsync( + customAsync<`bar(${string})`>( + async (input) => + typeof input === 'string' && + input.startsWith('bar(') && + input.endsWith(')') + ), + transformAsync( + async (input) => input.toUpperCase() as Uppercase + ) +); + +describe('objectWithPatternsAsync', () => { + describe('should return schema object', () => { + const patterns = [ + [FooKeySchema, string()], + [BarKeySchema, number()], + ] as const; + type Patterns = typeof patterns; + const rest = boolean(); + type Rest = typeof rest; + const baseSchema: Omit< + ObjectWithPatternsSchemaAsync, + 'message' + > = { + kind: 'schema', + type: 'object_with_patterns', + reference: objectWithPatternsAsync, + expects: 'Object', + patterns, + rest, + async: true, + '~standard': { + version: 1, + vendor: 'valibot', + validate: expect.any(Function), + }, + '~run': expect.any(Function), + }; + test('without message', () => { + expect(objectWithPatternsAsync(patterns, rest)).toStrictEqual({ + ...baseSchema, + message: undefined, + }); + }); + + test('with string message', () => { + expect(objectWithPatternsAsync(patterns, rest, 'message')).toStrictEqual({ + ...baseSchema, + message: 'message', + }); + }); + + test('with function message', () => { + const message = () => 'message'; + expect(objectWithPatternsAsync(patterns, rest, message)).toStrictEqual({ + ...baseSchema, + message, + }); + }); + }); + + describe('should return dataset without issues', () => { + test('for empty object', async () => { + await expectNoSchemaIssueAsync( + objectWithPatternsAsync([[FooKeySchema, string()]], string()), + [{}] + ); + }); + test('for simple object', async () => { + expect( + await objectWithPatternsAsync( + [ + [FooKeySchema, string()], + [BarKeySchema, number()], + ], + boolean() + )['~run']( + { value: { 'foo(bar)': 'foo', 'bar(baz)': 123, other: true } }, + {} + ) + ).toEqual({ + typed: true, + value: { 'foo(bar)': 'foo', 'BAR(BAZ)': 123, other: true }, + }); + }); + }); + + describe('should return dataset with issues', () => { + const schema = objectWithPatternsAsync( + [[FooKeySchema, string()]], + never(), + 'message' + ); + const baseIssue: Omit = { + kind: 'schema', + type: 'object_with_patterns', + expected: 'Object', + message: 'message', + }; + + // for primitive types + + test('for bigints', async () => { + await expectSchemaIssueAsync(schema, baseIssue, [-1n, 0n, 123n]); + }); + + test('for booleans', async () => { + await expectSchemaIssueAsync(schema, baseIssue, [true, false]); + }); + + test('for null', async () => { + await expectSchemaIssueAsync(schema, baseIssue, [null]); + }); + + test('for numbers', async () => { + await expectSchemaIssueAsync(schema, baseIssue, [-1, 0, 123, 45.67]); + }); + + test('for strings', async () => { + await expectSchemaIssueAsync(schema, baseIssue, ['foo', 'bar', 'baz']); + }); + + test('for symbols', async () => { + await expectSchemaIssueAsync(schema, baseIssue, [ + Symbol('foo'), + Symbol('bar'), + Symbol('baz'), + ]); + }); + + // complex types + + // test('for arrays', async () => { + // await expectSchemaIssueAsync(schema, baseIssue, [[], ['value']]); + // }); + + test('for functions', async () => { + await expectSchemaIssueAsync(schema, baseIssue, [ + // eslint-disable-next-line @typescript-eslint/no-empty-function + () => {}, + // eslint-disable-next-line @typescript-eslint/no-empty-function + function () {}, + ]); + }); + }); + + describe('should return dataset without nested issues', () => { + test('for simple object', async () => { + await expectNoSchemaIssueAsync( + objectWithPatternsAsync([[FooKeySchema, string()]], boolean()), + // @ts-expect-error + [{ 'foo(bar)': 'foo', other: true }] + ); + }); + + test('for nested object', async () => { + await expectNoSchemaIssueAsync( + objectWithPatternsAsync( + [[FooKeySchema, objectAsync({ key: string() })]], + objectAsync({ key: number() }) + ), + // @ts-expect-error + [{ 'foo(bar)': { key: 'foo' }, other: { key: 123 } }] + ); + }); + }); + + describe('should return dataset with nested issues', () => { + const schema = objectWithPatternsAsync( + [ + [FooKeySchema, string()], + [BarKeySchema, objectAsync({ key: number() })], + ], + objectAsync({ key: number() }), + 'message' + ); + + const baseInfo = { + message: expect.any(String), + requirement: undefined, + issues: undefined, + lang: undefined, + abortEarly: undefined, + abortPipeEarly: undefined, + }; + + test('for invalid entries', async () => { + const input = { 'foo(bar)': false, other: 'foo' }; + expect(await schema['~run']({ value: input }, {})).toStrictEqual({ + typed: false, + value: input, + issues: [ + { + ...baseInfo, + kind: 'schema', + type: 'string', + input: false, + expected: 'string', + received: 'false', + path: [ + { + type: 'object', + origin: 'value', + input, + key: 'foo(bar)', + value: false, + }, + ], + }, + { + ...baseInfo, + kind: 'schema', + type: 'object', + input: 'foo', + expected: 'Object', + received: '"foo"', + path: [ + { + type: 'object', + origin: 'value', + input, + key: 'other', + value: 'foo', + }, + ], + }, + ], + } satisfies FailureDataset>); + }); + + test('for invalid nested entries', async () => { + const input = { 'bar(baz)': { key: '123' } }; + expect(await schema['~run']({ value: input }, {})).toStrictEqual({ + typed: false, + value: { 'BAR(BAZ)': { key: '123' } }, + issues: [ + { + ...baseInfo, + kind: 'schema', + type: 'number', + input: '123', + expected: 'number', + received: '"123"', + path: [ + { + type: 'object', + origin: 'value', + input, + key: 'bar(baz)', + value: input['bar(baz)'], + }, + { + type: 'object', + origin: 'value', + input: input['bar(baz)'], + key: 'key', + value: '123', + }, + ], + }, + ], + } satisfies FailureDataset>); + }); + test('for wrong rest', async () => { + const input = { 'foo(bar)': 'foo', other: 'foo' }; + expect(await schema['~run']({ value: input }, {})).toStrictEqual({ + typed: false, + value: input, + issues: [ + { + ...baseInfo, + kind: 'schema', + type: 'object', + input: 'foo', + expected: 'Object', + received: '"foo"', + path: [ + { + type: 'object', + origin: 'value', + input, + key: 'other', + value: 'foo', + }, + ], + }, + ], + }); + }); + test('for wrong nested rest', async () => { + const input = { other: { key: 'foo' } }; + expect(await schema['~run']({ value: input }, {})).toStrictEqual({ + typed: false, + value: input, + issues: [ + { + ...baseInfo, + kind: 'schema', + type: 'number', + input: 'foo', + expected: 'number', + received: '"foo"', + path: [ + { + type: 'object', + origin: 'value', + input, + key: 'other', + value: input.other, + }, + { + type: 'object', + origin: 'value', + input: input.other, + key: 'key', + value: 'foo', + }, + ], + }, + ], + } satisfies FailureDataset>); + }); + }); +}); diff --git a/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.ts b/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.ts new file mode 100644 index 000000000..7733355d0 --- /dev/null +++ b/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.ts @@ -0,0 +1,275 @@ +import type { + BaseIssue, + BaseSchema, + BaseSchemaAsync, + ErrorMessage, + InferInput, + InferIssue, + InferOutput, + ObjectPathItem, + OutputDataset, + Prettify, +} from '../../types/index.ts'; +import { _addIssue, _getStandardProps } from '../../utils/index.ts'; +import type { objectWithPatterns } from './objectWithPatterns.ts'; +import type { ObjectWithPatternsIssue } from './types.ts'; + +export type PatternTupleAsync = readonly [ + key: + | BaseSchema> + | BaseSchemaAsync>, + value: + | BaseSchema> + | BaseSchemaAsync>, +]; + +export type PatternTuplesAsync = readonly [ + PatternTupleAsync, + ...PatternTupleAsync[], +]; + +export type InferPatternInputAsync = { + [K in InferInput]?: InferInput; +}; + +export type InferPatternsInputAsync = + TPatterns extends readonly [infer TPattern extends PatternTupleAsync] + ? InferPatternInputAsync + : TPatterns extends readonly [ + infer TPattern extends PatternTupleAsync, + ...infer TRest extends PatternTuplesAsync, + ] + ? InferPatternInputAsync & InferPatternsInputAsync + : never; + +export type InferPatternIssueAsync = + InferIssue; + +export type InferPatternsIssueAsync = + InferPatternIssueAsync; + +export type InferPatternOutputAsync = { + [K in InferOutput]?: InferOutput; +}; + +export type InferPatternsOutputAsync = + TPatterns extends readonly [infer TPattern extends PatternTupleAsync] + ? InferPatternOutputAsync + : TPatterns extends readonly [ + infer TPattern extends PatternTupleAsync, + ...infer TRest extends PatternTuplesAsync, + ] + ? InferPatternOutputAsync & InferPatternsOutputAsync + : never; + +export interface ObjectWithPatternsSchemaAsync< + TPatterns extends PatternTuplesAsync, + TRest extends + | BaseSchema> + | BaseSchemaAsync>, + TMessage extends ErrorMessage | undefined, +> extends BaseSchemaAsync< + Prettify> & { + [key: string]: InferInput; + }, + Prettify> & { + [key: string]: InferOutput; + }, + | ObjectWithPatternsIssue + | InferPatternsIssueAsync + | InferIssue + > { + /** + * The schema type. + */ + readonly type: 'object_with_patterns'; + /** + * The schema reference. + */ + readonly reference: + | typeof objectWithPatterns + | typeof objectWithPatternsAsync; + /** + * The expected property. + */ + readonly expects: 'Object'; + /** + * The patterns schema. + */ + readonly patterns: TPatterns; + /** + * The rest schema. + */ + readonly rest: TRest; + /** + * The error message. + */ + readonly message: TMessage; +} + +/** + * Creates a object schema that matches patterns. + * + * @param patterns Pairs of key and value schemas. + * @param rest Schema to use when no pattern matches. + * + * @returns A object schema. + */ +export function objectWithPatternsAsync< + const TPatterns extends PatternTuplesAsync, + const TRest extends + | BaseSchema> + | BaseSchemaAsync>, +>( + patterns: TPatterns, + rest: TRest +): ObjectWithPatternsSchemaAsync; + +/** + * Creates a object schema that matches patterns. + * + * @param patterns Pairs of key and value schemas. + * @param rest Schema to use when no pattern matches. + * @param message The error message. + * + * @returns A object schema. + */ +export function objectWithPatternsAsync< + const TPatterns extends PatternTuplesAsync, + const TRest extends + | BaseSchema> + | BaseSchemaAsync>, + const TMessage extends ErrorMessage | undefined, +>( + patterns: TPatterns, + rest: TRest, + message: TMessage +): ObjectWithPatternsSchemaAsync; + +// @__NO_SIDE_EFFECTS__ +export function objectWithPatternsAsync( + patterns: PatternTuplesAsync, + rest: + | BaseSchema> + | BaseSchemaAsync>, + message?: ErrorMessage +): ObjectWithPatternsSchemaAsync< + PatternTuplesAsync, + | BaseSchema> + | BaseSchemaAsync>, + ErrorMessage | undefined +> { + return { + kind: 'schema', + type: 'object_with_patterns', + reference: objectWithPatternsAsync, + expects: 'Object', + async: true, + patterns, + rest, + message, + get '~standard'() { + return _getStandardProps(this); + }, + async '~run'(dataset, config) { + // Get input value from dataset + const input = dataset.value; + + // If root type is valid, check nested types + if (input && typeof input === 'object') { + // Set typed to `true` and value to empty object + // @ts-expect-error + dataset.typed = true; + dataset.value = {}; + + // Parse schema of each pattern + const datasets = await Promise.all( + Object.entries(input).map(async ([key, value]) => { + // Get pattern schema and new key + let valueSchema: + | BaseSchema> + | BaseSchemaAsync> + | undefined; + let newKey = key; + for (const [keySchema, valueSchema_] of patterns) { + const keyDataset = await keySchema['~run']( + { value: key }, + config + ); + if (keyDataset.typed) { + valueSchema = valueSchema_; + newKey = keyDataset.value; + break; + } + } + + // If no pattern matches, use rest schema + if (!valueSchema) { + valueSchema = rest; + } + + const valueDataset = await valueSchema['~run']({ value }, config); + return [key, newKey, valueDataset] as const; + }) + ); + for (const [key, newKey, valueDataset] of datasets) { + // If there are issues, capture them + if (valueDataset.issues) { + // Create object path item + const pathItem: ObjectPathItem = { + type: 'object', + origin: 'value', + input: input as Record, + key, + value: valueDataset.value, + }; + + // Add modified entry dataset issues to issues + for (const issue of valueDataset.issues) { + if (issue.path) { + issue.path.unshift(pathItem); + } else { + // @ts-expect-error + issue.path = [pathItem]; + } + // @ts-expect-error + dataset.issues?.push(issue); + } + if (!dataset.issues) { + // @ts-expect-error + dataset.issues = valueDataset.issues; + } + + // If necessary, abort early + if (config.abortEarly) { + dataset.typed = false; + break; + } + } + + // If not typed, set typed to `false` + if (!valueDataset.typed) { + dataset.typed = false; + } + + // Add entry to dataset + // @ts-expect-error + dataset.value[newKey] = valueDataset.value; + } + // Otherwise, add object issue + } else { + _addIssue(this, 'type', dataset, config); + } + // Return output dataset + // @ts-expect-error + return dataset as OutputDataset< + InferPatternsOutputAsync & { + [key: string]: unknown; + }, + | ObjectWithPatternsIssue + | InferPatternsIssueAsync + | BaseIssue + >; + }, + }; +} diff --git a/library/src/schemas/objectWithPatterns/types.ts b/library/src/schemas/objectWithPatterns/types.ts new file mode 100644 index 000000000..873c4ee9f --- /dev/null +++ b/library/src/schemas/objectWithPatterns/types.ts @@ -0,0 +1,16 @@ +import type { BaseIssue } from '../../types/index.ts'; + +export interface ObjectWithPatternsIssue extends BaseIssue { + /** + * The issue kind. + */ + readonly kind: 'schema'; + /** + * The issue type. + */ + readonly type: 'object_with_patterns'; + /** + * The expected property. + */ + readonly expected: 'Object' | `"${string}"`; +} From 97b6686c644ae2b25cbf7d810201ae8c1efbdbce Mon Sep 17 00:00:00 2001 From: Ben Durrant Date: Mon, 21 Apr 2025 23:24:26 +0100 Subject: [PATCH 4/5] docs --- .../objectWithPatterns/objectWithPatterns.ts | 4 +- .../objectWithPatternsAsync.ts | 4 +- website/src/components/Property.tsx | 7 + .../src/routes/api/(actions)/brand/index.mdx | 1 + .../src/routes/api/(actions)/check/index.mdx | 1 + .../api/(actions)/description/index.mdx | 1 + .../routes/api/(actions)/entries/index.mdx | 1 + .../routes/api/(actions)/maxEntries/index.mdx | 1 + .../routes/api/(actions)/metadata/index.mdx | 1 + .../routes/api/(actions)/minEntries/index.mdx | 1 + .../routes/api/(actions)/notEntries/index.mdx | 1 + .../api/(actions)/partialCheck/index.mdx | 1 + .../routes/api/(actions)/rawCheck/index.mdx | 1 + .../api/(actions)/rawTransform/index.mdx | 1 + .../routes/api/(actions)/readonly/index.mdx | 1 + .../routes/api/(actions)/returns/index.mdx | 1 + .../src/routes/api/(actions)/title/index.mdx | 1 + .../routes/api/(actions)/transform/index.mdx | 1 + .../routes/api/(async)/arrayAsync/index.mdx | 2 + .../routes/api/(async)/awaitAsync/index.mdx | 2 + .../routes/api/(async)/checkAsync/index.mdx | 2 + .../routes/api/(async)/customAsync/index.mdx | 2 + .../api/(async)/exactOptionalAsync/index.mdx | 2 + .../api/(async)/fallbackAsync/index.mdx | 2 + .../routes/api/(async)/forwardAsync/index.mdx | 2 + .../api/(async)/getDefaultsAsync/index.mdx | 2 + .../api/(async)/getFallbacksAsync/index.mdx | 2 + .../api/(async)/intersectAsync/index.mdx | 2 + .../routes/api/(async)/lazyAsync/index.mdx | 2 + .../api/(async)/looseObjectAsync/index.mdx | 2 + .../api/(async)/looseTupleAsync/index.mdx | 2 + .../src/routes/api/(async)/mapAsync/index.mdx | 2 + .../api/(async)/nonNullableAsync/index.mdx | 2 + .../api/(async)/nonNullishAsync/index.mdx | 2 + .../api/(async)/nonOptionalAsync/index.mdx | 2 + .../api/(async)/nullableAsync/index.mdx | 2 + .../routes/api/(async)/nullishAsync/index.mdx | 2 + .../routes/api/(async)/objectAsync/index.mdx | 2 + .../(async)/objectWithPatternsAsync/index.mdx | 193 ++++++++++++++++++ .../objectWithPatternsAsync/properties.ts | 110 ++++++++++ .../api/(async)/objectWithRestAsync/index.mdx | 2 + .../api/(async)/optionalAsync/index.mdx | 2 + .../routes/api/(async)/parseAsync/index.mdx | 2 + .../routes/api/(async)/parserAsync/index.mdx | 2 + .../routes/api/(async)/partialAsync/index.mdx | 2 + .../api/(async)/partialCheckAsync/index.mdx | 2 + .../routes/api/(async)/pipeAsync/index.mdx | 2 + .../api/(async)/rawCheckAsync/index.mdx | 2 + .../api/(async)/rawTransformAsync/index.mdx | 2 + .../routes/api/(async)/recordAsync/index.mdx | 2 + .../api/(async)/requiredAsync/index.mdx | 2 + .../routes/api/(async)/returnsAsync/index.mdx | 2 + .../api/(async)/safeParseAsync/index.mdx | 2 + .../api/(async)/safeParserAsync/index.mdx | 2 + .../src/routes/api/(async)/setAsync/index.mdx | 2 + .../api/(async)/strictObjectAsync/index.mdx | 2 + .../api/(async)/strictTupleAsync/index.mdx | 2 + .../api/(async)/transformAsync/index.mdx | 2 + .../routes/api/(async)/tupleAsync/index.mdx | 2 + .../api/(async)/tupleWithRestAsync/index.mdx | 2 + .../api/(async)/undefinedableAsync/index.mdx | 2 + .../routes/api/(async)/unionAsync/index.mdx | 2 + .../routes/api/(async)/variantAsync/index.mdx | 1 + .../src/routes/api/(methods)/assert/index.mdx | 1 + .../src/routes/api/(methods)/config/index.mdx | 2 + .../routes/api/(methods)/fallback/index.mdx | 1 + .../routes/api/(methods)/forward/index.mdx | 1 + .../routes/api/(methods)/getDefault/index.mdx | 2 + .../api/(methods)/getDefaults/index.mdx | 1 + .../api/(methods)/getFallback/index.mdx | 2 + .../api/(methods)/getFallbacks/index.mdx | 1 + website/src/routes/api/(methods)/is/index.mdx | 1 + .../src/routes/api/(methods)/keyof/index.mdx | 2 + .../routes/api/(methods)/message/index.mdx | 2 + .../src/routes/api/(methods)/omit/index.mdx | 2 + .../src/routes/api/(methods)/parse/index.mdx | 1 + .../src/routes/api/(methods)/parser/index.mdx | 1 + .../routes/api/(methods)/partial/index.mdx | 1 + .../src/routes/api/(methods)/pick/index.mdx | 2 + .../src/routes/api/(methods)/pipe/index.mdx | 1 + .../routes/api/(methods)/required/index.mdx | 1 + .../routes/api/(methods)/safeParse/index.mdx | 1 + .../routes/api/(methods)/safeParser/index.mdx | 1 + .../src/routes/api/(schemas)/any/index.mdx | 1 + .../src/routes/api/(schemas)/array/index.mdx | 1 + .../src/routes/api/(schemas)/bigint/index.mdx | 1 + .../src/routes/api/(schemas)/blob/index.mdx | 1 + .../routes/api/(schemas)/boolean/index.mdx | 1 + .../src/routes/api/(schemas)/custom/index.mdx | 1 + .../src/routes/api/(schemas)/date/index.mdx | 1 + .../src/routes/api/(schemas)/enum/index.mdx | 1 + .../api/(schemas)/exactOptional/index.mdx | 1 + .../src/routes/api/(schemas)/file/index.mdx | 1 + .../routes/api/(schemas)/function/index.mdx | 1 + .../routes/api/(schemas)/instance/index.mdx | 1 + .../routes/api/(schemas)/intersect/index.mdx | 1 + .../src/routes/api/(schemas)/lazy/index.mdx | 1 + .../routes/api/(schemas)/literal/index.mdx | 1 + .../api/(schemas)/looseObject/index.mdx | 1 + .../routes/api/(schemas)/looseTuple/index.mdx | 1 + .../src/routes/api/(schemas)/map/index.mdx | 1 + .../src/routes/api/(schemas)/nan/index.mdx | 1 + .../src/routes/api/(schemas)/never/index.mdx | 1 + .../api/(schemas)/nonNullable/index.mdx | 1 + .../routes/api/(schemas)/nonNullish/index.mdx | 1 + .../api/(schemas)/nonOptional/index.mdx | 1 + .../src/routes/api/(schemas)/null/index.mdx | 1 + .../routes/api/(schemas)/nullable/index.mdx | 1 + .../routes/api/(schemas)/nullish/index.mdx | 1 + .../src/routes/api/(schemas)/number/index.mdx | 1 + .../src/routes/api/(schemas)/object/index.mdx | 1 + .../(schemas)/objectWithPatterns/index.mdx | 166 +++++++++++++++ .../objectWithPatterns/properties.ts | 90 ++++++++ .../api/(schemas)/objectWithRest/index.mdx | 1 + .../routes/api/(schemas)/optional/index.mdx | 1 + .../routes/api/(schemas)/picklist/index.mdx | 1 + .../routes/api/(schemas)/promise/index.mdx | 1 + .../src/routes/api/(schemas)/record/index.mdx | 1 + .../src/routes/api/(schemas)/set/index.mdx | 1 + .../api/(schemas)/strictObject/index.mdx | 1 + .../api/(schemas)/strictTuple/index.mdx | 1 + .../src/routes/api/(schemas)/string/index.mdx | 1 + .../src/routes/api/(schemas)/symbol/index.mdx | 1 + .../src/routes/api/(schemas)/tuple/index.mdx | 1 + .../api/(schemas)/tupleWithRest/index.mdx | 1 + .../routes/api/(schemas)/undefined/index.mdx | 1 + .../api/(schemas)/undefinedable/index.mdx | 1 + .../src/routes/api/(schemas)/union/index.mdx | 1 + .../routes/api/(schemas)/unknown/index.mdx | 1 + .../src/routes/api/(schemas)/void/index.mdx | 1 + .../(types)/ObjectWithPatternsIssue/index.mdx | 20 ++ .../ObjectWithPatternsIssue/properties.ts | 50 +++++ .../ObjectWithPatternsSchema/index.mdx | 29 +++ .../ObjectWithPatternsSchema/properties.ts | 69 +++++++ .../ObjectWithPatternsSchemaAsync/index.mdx | 29 +++ .../properties.ts | 89 ++++++++ .../routes/api/(types)/PatternTuple/index.mdx | 17 ++ .../api/(types)/PatternTuple/properties.ts | 43 ++++ .../api/(types)/PatternTupleAsync/index.mdx | 17 ++ .../(types)/PatternTupleAsync/properties.ts | 83 ++++++++ .../api/(types)/PatternTuples/index.mdx | 17 ++ .../api/(types)/PatternTuples/properties.ts | 22 ++ .../api/(types)/PatternTuplesAsync/index.mdx | 17 ++ .../(types)/PatternTuplesAsync/properties.ts | 26 +++ .../api/(utils)/entriesFromList/index.mdx | 1 + website/src/routes/api/menu.md | 9 + .../guides/(main-concepts)/schemas/index.mdx | 1 + 147 files changed, 1281 insertions(+), 4 deletions(-) create mode 100644 website/src/routes/api/(async)/objectWithPatternsAsync/index.mdx create mode 100644 website/src/routes/api/(async)/objectWithPatternsAsync/properties.ts create mode 100644 website/src/routes/api/(schemas)/objectWithPatterns/index.mdx create mode 100644 website/src/routes/api/(schemas)/objectWithPatterns/properties.ts create mode 100644 website/src/routes/api/(types)/ObjectWithPatternsIssue/index.mdx create mode 100644 website/src/routes/api/(types)/ObjectWithPatternsIssue/properties.ts create mode 100644 website/src/routes/api/(types)/ObjectWithPatternsSchema/index.mdx create mode 100644 website/src/routes/api/(types)/ObjectWithPatternsSchema/properties.ts create mode 100644 website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/index.mdx create mode 100644 website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/properties.ts create mode 100644 website/src/routes/api/(types)/PatternTuple/index.mdx create mode 100644 website/src/routes/api/(types)/PatternTuple/properties.ts create mode 100644 website/src/routes/api/(types)/PatternTupleAsync/index.mdx create mode 100644 website/src/routes/api/(types)/PatternTupleAsync/properties.ts create mode 100644 website/src/routes/api/(types)/PatternTuples/index.mdx create mode 100644 website/src/routes/api/(types)/PatternTuples/properties.ts create mode 100644 website/src/routes/api/(types)/PatternTuplesAsync/index.mdx create mode 100644 website/src/routes/api/(types)/PatternTuplesAsync/properties.ts diff --git a/library/src/schemas/objectWithPatterns/objectWithPatterns.ts b/library/src/schemas/objectWithPatterns/objectWithPatterns.ts index e6e33415e..e05ba1e20 100644 --- a/library/src/schemas/objectWithPatterns/objectWithPatterns.ts +++ b/library/src/schemas/objectWithPatterns/objectWithPatterns.ts @@ -98,7 +98,7 @@ export interface ObjectWithPatternsSchema< } /** - * Creates a object schema that matches patterns. + * Creates an object schema that matches patterns. * * @param patterns Pairs of key and value schemas. * @param rest Schema to use when no pattern matches. @@ -114,7 +114,7 @@ export function objectWithPatterns< ): ObjectWithPatternsSchema; /** - * Creates a object schema that matches patterns. + * Creates an object schema that matches patterns. * * @param patterns Pairs of key and value schemas. * @param rest Schema to use when no pattern matches. diff --git a/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.ts b/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.ts index 7733355d0..a299e33f0 100644 --- a/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.ts +++ b/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.ts @@ -108,7 +108,7 @@ export interface ObjectWithPatternsSchemaAsync< } /** - * Creates a object schema that matches patterns. + * Creates an object schema that matches patterns. * * @param patterns Pairs of key and value schemas. * @param rest Schema to use when no pattern matches. @@ -126,7 +126,7 @@ export function objectWithPatternsAsync< ): ObjectWithPatternsSchemaAsync; /** - * Creates a object schema that matches patterns. + * Creates an object schema that matches patterns. * * @param patterns Pairs of key and value schemas. * @param rest Schema to use when no pattern matches. diff --git a/website/src/components/Property.tsx b/website/src/components/Property.tsx index e175ae875..ff98081bb 100644 --- a/website/src/components/Property.tsx +++ b/website/src/components/Property.tsx @@ -53,6 +53,7 @@ type DefinitionData = type: 'tuple'; modifier?: string; items: DefinitionData[]; + itemLabels?: (string | undefined)[]; } | { type: 'function'; @@ -250,6 +251,12 @@ const Definition = component$(({ parent, data }) => ( {data.items.map((item, index) => ( {index > 0 && ', '} + {data.itemLabels?.[index] && ( + + {data.itemLabels[index]} + {': '} + + )} ))} diff --git a/website/src/routes/api/(actions)/brand/index.mdx b/website/src/routes/api/(actions)/brand/index.mdx index f615b53a5..8a3d3b674 100644 --- a/website/src/routes/api/(actions)/brand/index.mdx +++ b/website/src/routes/api/(actions)/brand/index.mdx @@ -90,6 +90,7 @@ The following APIs can be combined with `brand`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(actions)/check/index.mdx b/website/src/routes/api/(actions)/check/index.mdx index 7c6fa832a..6e67e0711 100644 --- a/website/src/routes/api/(actions)/check/index.mdx +++ b/website/src/routes/api/(actions)/check/index.mdx @@ -92,6 +92,7 @@ The following APIs can be combined with `check`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(actions)/description/index.mdx b/website/src/routes/api/(actions)/description/index.mdx index 14de31e03..8cbad01d3 100644 --- a/website/src/routes/api/(actions)/description/index.mdx +++ b/website/src/routes/api/(actions)/description/index.mdx @@ -89,6 +89,7 @@ The following APIs can be combined with `description`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(actions)/entries/index.mdx b/website/src/routes/api/(actions)/entries/index.mdx index f7148834c..96b2ac5ea 100644 --- a/website/src/routes/api/(actions)/entries/index.mdx +++ b/website/src/routes/api/(actions)/entries/index.mdx @@ -61,6 +61,7 @@ The following APIs can be combined with `entries`. items={[ 'looseObject', 'object', + 'objectWithPatterns', 'objectWithRest', 'record', 'strictObject', diff --git a/website/src/routes/api/(actions)/maxEntries/index.mdx b/website/src/routes/api/(actions)/maxEntries/index.mdx index 2aa656564..248ecc9c2 100644 --- a/website/src/routes/api/(actions)/maxEntries/index.mdx +++ b/website/src/routes/api/(actions)/maxEntries/index.mdx @@ -66,6 +66,7 @@ The following APIs can be combined with `maxEntries`. items={[ 'looseObject', 'object', + 'objectWithPatterns', 'objectWithRest', 'record', 'strictObject', diff --git a/website/src/routes/api/(actions)/metadata/index.mdx b/website/src/routes/api/(actions)/metadata/index.mdx index f682be1b5..635e9c871 100644 --- a/website/src/routes/api/(actions)/metadata/index.mdx +++ b/website/src/routes/api/(actions)/metadata/index.mdx @@ -94,6 +94,7 @@ The following APIs can be combined with `metadata`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(actions)/minEntries/index.mdx b/website/src/routes/api/(actions)/minEntries/index.mdx index 043110d03..0b7965110 100644 --- a/website/src/routes/api/(actions)/minEntries/index.mdx +++ b/website/src/routes/api/(actions)/minEntries/index.mdx @@ -66,6 +66,7 @@ The following APIs can be combined with `minEntries`. items={[ 'looseObject', 'object', + 'objectWithPatterns', 'objectWithRest', 'record', 'strictObject', diff --git a/website/src/routes/api/(actions)/notEntries/index.mdx b/website/src/routes/api/(actions)/notEntries/index.mdx index e2cf990dc..18e593bd9 100644 --- a/website/src/routes/api/(actions)/notEntries/index.mdx +++ b/website/src/routes/api/(actions)/notEntries/index.mdx @@ -64,6 +64,7 @@ The following APIs can be combined with `notEntries`. items={[ 'looseObject', 'object', + 'objectWithPatterns', 'objectWithRest', 'record', 'strictObject', diff --git a/website/src/routes/api/(actions)/partialCheck/index.mdx b/website/src/routes/api/(actions)/partialCheck/index.mdx index 6537ad64c..fc6bc447d 100644 --- a/website/src/routes/api/(actions)/partialCheck/index.mdx +++ b/website/src/routes/api/(actions)/partialCheck/index.mdx @@ -99,6 +99,7 @@ The following APIs can be combined with `partialCheck`. 'nonNullish', 'nonOptional', 'object', + 'objectWithPatterns', 'objectWithRest', 'record', 'strictObject', diff --git a/website/src/routes/api/(actions)/rawCheck/index.mdx b/website/src/routes/api/(actions)/rawCheck/index.mdx index 99c9afc0e..90c0c8023 100644 --- a/website/src/routes/api/(actions)/rawCheck/index.mdx +++ b/website/src/routes/api/(actions)/rawCheck/index.mdx @@ -115,6 +115,7 @@ The following APIs can be combined with `rawCheck`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(actions)/rawTransform/index.mdx b/website/src/routes/api/(actions)/rawTransform/index.mdx index 533b61e98..11429ebda 100644 --- a/website/src/routes/api/(actions)/rawTransform/index.mdx +++ b/website/src/routes/api/(actions)/rawTransform/index.mdx @@ -133,6 +133,7 @@ The following APIs can be combined with `rawTransform`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(actions)/readonly/index.mdx b/website/src/routes/api/(actions)/readonly/index.mdx index 71562bef2..cc6ff019a 100644 --- a/website/src/routes/api/(actions)/readonly/index.mdx +++ b/website/src/routes/api/(actions)/readonly/index.mdx @@ -85,6 +85,7 @@ The following APIs can be combined with `readonly`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(actions)/returns/index.mdx b/website/src/routes/api/(actions)/returns/index.mdx index a11d852a9..27b282ac4 100644 --- a/website/src/routes/api/(actions)/returns/index.mdx +++ b/website/src/routes/api/(actions)/returns/index.mdx @@ -86,6 +86,7 @@ The following APIs can be combined with `returns`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(actions)/title/index.mdx b/website/src/routes/api/(actions)/title/index.mdx index a0f8c89f6..60b4449e2 100644 --- a/website/src/routes/api/(actions)/title/index.mdx +++ b/website/src/routes/api/(actions)/title/index.mdx @@ -89,6 +89,7 @@ The following APIs can be combined with `title`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(actions)/transform/index.mdx b/website/src/routes/api/(actions)/transform/index.mdx index e850e2e68..378581c1a 100644 --- a/website/src/routes/api/(actions)/transform/index.mdx +++ b/website/src/routes/api/(actions)/transform/index.mdx @@ -101,6 +101,7 @@ The following APIs can be combined with `transform`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(async)/arrayAsync/index.mdx b/website/src/routes/api/(async)/arrayAsync/index.mdx index 139c0f2d7..bbc0bb1fd 100644 --- a/website/src/routes/api/(async)/arrayAsync/index.mdx +++ b/website/src/routes/api/(async)/arrayAsync/index.mdx @@ -94,6 +94,7 @@ The following APIs can be combined with `arrayAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -177,6 +178,7 @@ The following APIs can be combined with `arrayAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/awaitAsync/index.mdx b/website/src/routes/api/(async)/awaitAsync/index.mdx index ba75105cb..2539b9b6f 100644 --- a/website/src/routes/api/(async)/awaitAsync/index.mdx +++ b/website/src/routes/api/(async)/awaitAsync/index.mdx @@ -82,6 +82,7 @@ The following APIs can be combined with `awaitAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -125,6 +126,7 @@ The following APIs can be combined with `awaitAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'pipeAsync', diff --git a/website/src/routes/api/(async)/checkAsync/index.mdx b/website/src/routes/api/(async)/checkAsync/index.mdx index 4fcba1536..a0e1cd3c4 100644 --- a/website/src/routes/api/(async)/checkAsync/index.mdx +++ b/website/src/routes/api/(async)/checkAsync/index.mdx @@ -95,6 +95,7 @@ The following APIs can be combined with `checkAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -139,6 +140,7 @@ The following APIs can be combined with `checkAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'pipeAsync', diff --git a/website/src/routes/api/(async)/customAsync/index.mdx b/website/src/routes/api/(async)/customAsync/index.mdx index 6ddc0a8ce..6acf61214 100644 --- a/website/src/routes/api/(async)/customAsync/index.mdx +++ b/website/src/routes/api/(async)/customAsync/index.mdx @@ -87,6 +87,7 @@ The following APIs can be combined with `customAsync`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', @@ -238,6 +239,7 @@ The following APIs can be combined with `customAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/exactOptionalAsync/index.mdx b/website/src/routes/api/(async)/exactOptionalAsync/index.mdx index eb230349a..9fde29ffc 100644 --- a/website/src/routes/api/(async)/exactOptionalAsync/index.mdx +++ b/website/src/routes/api/(async)/exactOptionalAsync/index.mdx @@ -130,6 +130,7 @@ The following APIs can be combined with `exactOptionalAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -199,6 +200,7 @@ The following APIs can be combined with `exactOptionalAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/fallbackAsync/index.mdx b/website/src/routes/api/(async)/fallbackAsync/index.mdx index a39ecce79..9246fef4c 100644 --- a/website/src/routes/api/(async)/fallbackAsync/index.mdx +++ b/website/src/routes/api/(async)/fallbackAsync/index.mdx @@ -96,6 +96,7 @@ The following APIs can be combined with `fallbackAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -267,6 +268,7 @@ The following APIs can be combined with `fallbackAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/forwardAsync/index.mdx b/website/src/routes/api/(async)/forwardAsync/index.mdx index 0dfb34339..9527ee34c 100644 --- a/website/src/routes/api/(async)/forwardAsync/index.mdx +++ b/website/src/routes/api/(async)/forwardAsync/index.mdx @@ -81,6 +81,7 @@ The following APIs can be combined with `forwardAsync`. 'looseObject', 'looseTuple', 'object', + 'objectWithPatterns', 'objectWithRest', 'record', 'strictObject', @@ -139,6 +140,7 @@ The following APIs can be combined with `forwardAsync`. 'looseObjectAsync', 'looseTupleAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'partialAsync', 'partialCheckAsync', diff --git a/website/src/routes/api/(async)/getDefaultsAsync/index.mdx b/website/src/routes/api/(async)/getDefaultsAsync/index.mdx index f8d8a2d93..b2728fe88 100644 --- a/website/src/routes/api/(async)/getDefaultsAsync/index.mdx +++ b/website/src/routes/api/(async)/getDefaultsAsync/index.mdx @@ -99,6 +99,7 @@ The following APIs can be combined with `getDefaultsAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -157,6 +158,7 @@ The following APIs can be combined with `getDefaultsAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(async)/getFallbacksAsync/index.mdx b/website/src/routes/api/(async)/getFallbacksAsync/index.mdx index 710d09e82..4b96b7fdb 100644 --- a/website/src/routes/api/(async)/getFallbacksAsync/index.mdx +++ b/website/src/routes/api/(async)/getFallbacksAsync/index.mdx @@ -97,6 +97,7 @@ The following APIs can be combined with `getFallbacksAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -155,6 +156,7 @@ The following APIs can be combined with `getFallbacksAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(async)/intersectAsync/index.mdx b/website/src/routes/api/(async)/intersectAsync/index.mdx index d74180f37..841f74bfe 100644 --- a/website/src/routes/api/(async)/intersectAsync/index.mdx +++ b/website/src/routes/api/(async)/intersectAsync/index.mdx @@ -109,6 +109,7 @@ The following APIs can be combined with `intersectAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -269,6 +270,7 @@ The following APIs can be combined with `intersectAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/lazyAsync/index.mdx b/website/src/routes/api/(async)/lazyAsync/index.mdx index d49129226..6ddbca748 100644 --- a/website/src/routes/api/(async)/lazyAsync/index.mdx +++ b/website/src/routes/api/(async)/lazyAsync/index.mdx @@ -141,6 +141,7 @@ The following APIs can be combined with `lazyAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -301,6 +302,7 @@ The following APIs can be combined with `lazyAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/looseObjectAsync/index.mdx b/website/src/routes/api/(async)/looseObjectAsync/index.mdx index 40bf79671..1f11d7943 100644 --- a/website/src/routes/api/(async)/looseObjectAsync/index.mdx +++ b/website/src/routes/api/(async)/looseObjectAsync/index.mdx @@ -99,6 +99,7 @@ The following APIs can be combined with `looseObjectAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -167,6 +168,7 @@ The following APIs can be combined with `looseObjectAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/looseTupleAsync/index.mdx b/website/src/routes/api/(async)/looseTupleAsync/index.mdx index 2f3e33d37..0979246e1 100644 --- a/website/src/routes/api/(async)/looseTupleAsync/index.mdx +++ b/website/src/routes/api/(async)/looseTupleAsync/index.mdx @@ -95,6 +95,7 @@ The following APIs can be combined with `looseTupleAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -178,6 +179,7 @@ The following APIs can be combined with `looseTupleAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/mapAsync/index.mdx b/website/src/routes/api/(async)/mapAsync/index.mdx index b01ff3b25..7ab79371e 100644 --- a/website/src/routes/api/(async)/mapAsync/index.mdx +++ b/website/src/routes/api/(async)/mapAsync/index.mdx @@ -93,6 +93,7 @@ The following APIs can be combined with `mapAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -163,6 +164,7 @@ The following APIs can be combined with `mapAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/nonNullableAsync/index.mdx b/website/src/routes/api/(async)/nonNullableAsync/index.mdx index ba3263f07..5a3e93a0c 100644 --- a/website/src/routes/api/(async)/nonNullableAsync/index.mdx +++ b/website/src/routes/api/(async)/nonNullableAsync/index.mdx @@ -98,6 +98,7 @@ The following APIs can be combined with `nonNullableAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -166,6 +167,7 @@ The following APIs can be combined with `nonNullableAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/nonNullishAsync/index.mdx b/website/src/routes/api/(async)/nonNullishAsync/index.mdx index 9f2f3f6ec..b322ac836 100644 --- a/website/src/routes/api/(async)/nonNullishAsync/index.mdx +++ b/website/src/routes/api/(async)/nonNullishAsync/index.mdx @@ -94,6 +94,7 @@ The following APIs can be combined with `nonNullishAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -162,6 +163,7 @@ The following APIs can be combined with `nonNullishAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/nonOptionalAsync/index.mdx b/website/src/routes/api/(async)/nonOptionalAsync/index.mdx index 76320f8ff..cbb9f56ed 100644 --- a/website/src/routes/api/(async)/nonOptionalAsync/index.mdx +++ b/website/src/routes/api/(async)/nonOptionalAsync/index.mdx @@ -104,6 +104,7 @@ The following APIs can be combined with `nonOptionalAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -172,6 +173,7 @@ The following APIs can be combined with `nonOptionalAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/nullableAsync/index.mdx b/website/src/routes/api/(async)/nullableAsync/index.mdx index ac5693e10..82b49274c 100644 --- a/website/src/routes/api/(async)/nullableAsync/index.mdx +++ b/website/src/routes/api/(async)/nullableAsync/index.mdx @@ -118,6 +118,7 @@ The following APIs can be combined with `nullableAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -186,6 +187,7 @@ The following APIs can be combined with `nullableAsync`. 'nonOptionalAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/nullishAsync/index.mdx b/website/src/routes/api/(async)/nullishAsync/index.mdx index ff5348513..84d245d30 100644 --- a/website/src/routes/api/(async)/nullishAsync/index.mdx +++ b/website/src/routes/api/(async)/nullishAsync/index.mdx @@ -151,6 +151,7 @@ The following APIs can be combined with `nullishAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -219,6 +220,7 @@ The following APIs can be combined with `nullishAsync`. 'nonOptionalAsync', 'nullableAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/objectAsync/index.mdx b/website/src/routes/api/(async)/objectAsync/index.mdx index e5f20de54..9454a6267 100644 --- a/website/src/routes/api/(async)/objectAsync/index.mdx +++ b/website/src/routes/api/(async)/objectAsync/index.mdx @@ -99,6 +99,7 @@ The following APIs can be combined with `objectAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -173,6 +174,7 @@ The following APIs can be combined with `objectAsync`. 'nonOptionalAsync', 'nullableAsync', 'nullishAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/objectWithPatternsAsync/index.mdx b/website/src/routes/api/(async)/objectWithPatternsAsync/index.mdx new file mode 100644 index 000000000..859a89e1d --- /dev/null +++ b/website/src/routes/api/(async)/objectWithPatternsAsync/index.mdx @@ -0,0 +1,193 @@ +--- +title: objectWithPatternsAsync +description: Creates an object schema that matches patterns. +source: /schemas/objectWithPatterns/objectWithPatternsAsync.ts +contributors: + - EskiMojo14 +--- + +import { Link } from '@builder.io/qwik-city'; +import { ApiList, Property } from '~/components'; +import { properties } from './properties'; + +# objectWithPatternsAsync + +Creates an object schema that matches patterns. + +```ts +const ObjectWithPatternsSchemaAsync = v.objectWithPatternsAsync< + TPatterns, + TRest, + TMessage +>(patterns, rest, message); +``` + +## Generics + +- `TPatterns` +- `TRest` +- `TMessage` + +## Parameters + +- `patterns` +- `rest` +- `message` + +## Returns + +- `Schema` + +## Explanation + +Tuples of key and value schemas are iterated through until a key schema matches, and the value schema is used to validate the value. If no key schema matches, the rest schema is used. + +## Examples + +The following examples show how `objectWithPatternsAsync` can be used. Please see the object guide for more examples and explanations. + +```ts +const ObjectWithPatternsSchemaAsync = v.objectWithPatternsAsync( + [ + [v.pipeAsync(v.string(), v.startsWith('str-')), v.string()], + [v.pipeAsync(v.string(), v.startsWith('num-')), v.number()], + ], + v.boolean() +); +``` + +## Related + +The following APIs can be combined with `objectWithPatternsAsync`. + +### Schemas + + + +### Methods + + + +### Actions + + + +### Utils + + + +### Async + + diff --git a/website/src/routes/api/(async)/objectWithPatternsAsync/properties.ts b/website/src/routes/api/(async)/objectWithPatternsAsync/properties.ts new file mode 100644 index 000000000..224d09036 --- /dev/null +++ b/website/src/routes/api/(async)/objectWithPatternsAsync/properties.ts @@ -0,0 +1,110 @@ +import type { PropertyProps } from '~/components'; + +export const properties: Record = { + TPatterns: { + modifier: 'extends', + type: { + type: 'custom', + name: 'PatternTuplesAsync', + href: '../PatternTuplesAsync/', + }, + }, + TRest: { + modifier: 'extends', + type: { + type: 'union', + options: [ + { + type: 'custom', + name: 'BaseSchema', + href: '../BaseSchema/', + generics: [ + 'unknown', + 'unknown', + { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], + }, + ], + }, + { + type: 'custom', + name: 'BaseSchemaAsync', + href: '../BaseSchemaAsync/', + generics: [ + 'unknown', + 'unknown', + { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], + }, + ], + }, + ], + }, + }, + TMessage: { + modifier: 'extends', + type: { + type: 'union', + options: [ + { + type: 'custom', + name: 'ErrorMessage', + href: '../ErrorMessage/', + generics: [ + { + type: 'custom', + name: 'ObjectWithPatternsIssue', + href: '../ObjectWithPatternsIssue/', + }, + ], + }, + 'undefined', + ], + }, + }, + patterns: { + type: { + type: 'custom', + name: 'TPatterns', + }, + }, + rest: { + type: { + type: 'custom', + name: 'TRest', + }, + }, + message: { + type: { + type: 'custom', + name: 'TMessage', + }, + }, + Schema: { + type: { + type: 'custom', + name: 'ObjectWithPatternsSchemaAsync', + href: '../ObjectWithPatternsSchemaAsync/', + generics: [ + { + type: 'custom', + name: 'TPatterns', + }, + { + type: 'custom', + name: 'TRest', + }, + { + type: 'custom', + name: 'TMessage', + }, + ], + }, + }, +}; diff --git a/website/src/routes/api/(async)/objectWithRestAsync/index.mdx b/website/src/routes/api/(async)/objectWithRestAsync/index.mdx index 3b2097681..5493fb0ab 100644 --- a/website/src/routes/api/(async)/objectWithRestAsync/index.mdx +++ b/website/src/routes/api/(async)/objectWithRestAsync/index.mdx @@ -113,6 +113,7 @@ The following APIs can be combined with `objectWithRestAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -188,6 +189,7 @@ The following APIs can be combined with `objectWithRestAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'optionalAsync', 'parseAsync', 'parserAsync', diff --git a/website/src/routes/api/(async)/optionalAsync/index.mdx b/website/src/routes/api/(async)/optionalAsync/index.mdx index 67f56cc73..6f0ed95b7 100644 --- a/website/src/routes/api/(async)/optionalAsync/index.mdx +++ b/website/src/routes/api/(async)/optionalAsync/index.mdx @@ -151,6 +151,7 @@ The following APIs can be combined with `optionalAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -220,6 +221,7 @@ The following APIs can be combined with `optionalAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'parseAsync', 'parserAsync', diff --git a/website/src/routes/api/(async)/parseAsync/index.mdx b/website/src/routes/api/(async)/parseAsync/index.mdx index 7240a143c..61a9f11e3 100644 --- a/website/src/routes/api/(async)/parseAsync/index.mdx +++ b/website/src/routes/api/(async)/parseAsync/index.mdx @@ -96,6 +96,7 @@ The following APIs can be combined with `parseAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -159,6 +160,7 @@ The following APIs can be combined with `parseAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(async)/parserAsync/index.mdx b/website/src/routes/api/(async)/parserAsync/index.mdx index 50f5de653..107615d90 100644 --- a/website/src/routes/api/(async)/parserAsync/index.mdx +++ b/website/src/routes/api/(async)/parserAsync/index.mdx @@ -90,6 +90,7 @@ The following APIs can be combined with `parserAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -153,6 +154,7 @@ The following APIs can be combined with `parserAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(async)/partialAsync/index.mdx b/website/src/routes/api/(async)/partialAsync/index.mdx index 8136f00fa..8e39c4a00 100644 --- a/website/src/routes/api/(async)/partialAsync/index.mdx +++ b/website/src/routes/api/(async)/partialAsync/index.mdx @@ -98,6 +98,7 @@ The following APIs can be combined with `partialAsync`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', @@ -179,6 +180,7 @@ The following APIs can be combined with `partialAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/partialCheckAsync/index.mdx b/website/src/routes/api/(async)/partialCheckAsync/index.mdx index 15289e73b..0d09f8bfd 100644 --- a/website/src/routes/api/(async)/partialCheckAsync/index.mdx +++ b/website/src/routes/api/(async)/partialCheckAsync/index.mdx @@ -101,6 +101,7 @@ The following APIs can be combined with `partialCheckAsync`. 'nonNullish', 'nonOptional', 'object', + 'objectWithPatterns', 'objectWithRest', 'record', 'strictObject', @@ -132,6 +133,7 @@ The following APIs can be combined with `partialCheckAsync`. 'nonNullishAsync', 'nonOptionalAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'pipeAsync', 'recordAsync', diff --git a/website/src/routes/api/(async)/pipeAsync/index.mdx b/website/src/routes/api/(async)/pipeAsync/index.mdx index 95f8b6fd0..3bcd8024d 100644 --- a/website/src/routes/api/(async)/pipeAsync/index.mdx +++ b/website/src/routes/api/(async)/pipeAsync/index.mdx @@ -123,6 +123,7 @@ The following APIs can be combined with `pipeAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -308,6 +309,7 @@ The following APIs can be combined with `pipeAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/rawCheckAsync/index.mdx b/website/src/routes/api/(async)/rawCheckAsync/index.mdx index 608bdda95..1df260dea 100644 --- a/website/src/routes/api/(async)/rawCheckAsync/index.mdx +++ b/website/src/routes/api/(async)/rawCheckAsync/index.mdx @@ -121,6 +121,7 @@ The following APIs can be combined with `rawCheckAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -166,6 +167,7 @@ The following APIs can be combined with `rawCheckAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'pipeAsync', diff --git a/website/src/routes/api/(async)/rawTransformAsync/index.mdx b/website/src/routes/api/(async)/rawTransformAsync/index.mdx index 9a91a7d20..8c629c0d9 100644 --- a/website/src/routes/api/(async)/rawTransformAsync/index.mdx +++ b/website/src/routes/api/(async)/rawTransformAsync/index.mdx @@ -121,6 +121,7 @@ The following APIs can be combined with `rawTransformAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -165,6 +166,7 @@ The following APIs can be combined with `rawTransformAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'pipeAsync', diff --git a/website/src/routes/api/(async)/recordAsync/index.mdx b/website/src/routes/api/(async)/recordAsync/index.mdx index 7d878ac68..7ac54034d 100644 --- a/website/src/routes/api/(async)/recordAsync/index.mdx +++ b/website/src/routes/api/(async)/recordAsync/index.mdx @@ -100,6 +100,7 @@ The following APIs can be combined with `recordAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -172,6 +173,7 @@ The following APIs can be combined with `recordAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/requiredAsync/index.mdx b/website/src/routes/api/(async)/requiredAsync/index.mdx index bc2f13651..b4f0fce6d 100644 --- a/website/src/routes/api/(async)/requiredAsync/index.mdx +++ b/website/src/routes/api/(async)/requiredAsync/index.mdx @@ -104,6 +104,7 @@ The following APIs can be combined with `requiredAsync`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', @@ -185,6 +186,7 @@ The following APIs can be combined with `requiredAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/returnsAsync/index.mdx b/website/src/routes/api/(async)/returnsAsync/index.mdx index e548892d7..4eab85e04 100644 --- a/website/src/routes/api/(async)/returnsAsync/index.mdx +++ b/website/src/routes/api/(async)/returnsAsync/index.mdx @@ -100,6 +100,7 @@ The following APIs can be combined with `returnsAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -146,6 +147,7 @@ The following APIs can be combined with `returnsAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'pipeAsync', diff --git a/website/src/routes/api/(async)/safeParseAsync/index.mdx b/website/src/routes/api/(async)/safeParseAsync/index.mdx index 9c3bb6c38..1b936f8c4 100644 --- a/website/src/routes/api/(async)/safeParseAsync/index.mdx +++ b/website/src/routes/api/(async)/safeParseAsync/index.mdx @@ -89,6 +89,7 @@ The following APIs can be combined with `safeParseAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -152,6 +153,7 @@ The following APIs can be combined with `safeParseAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(async)/safeParserAsync/index.mdx b/website/src/routes/api/(async)/safeParserAsync/index.mdx index d542867a7..70bb5ad64 100644 --- a/website/src/routes/api/(async)/safeParserAsync/index.mdx +++ b/website/src/routes/api/(async)/safeParserAsync/index.mdx @@ -90,6 +90,7 @@ The following APIs can be combined with `safeParserAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -153,6 +154,7 @@ The following APIs can be combined with `safeParserAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(async)/setAsync/index.mdx b/website/src/routes/api/(async)/setAsync/index.mdx index 0efe0d984..96c3c755e 100644 --- a/website/src/routes/api/(async)/setAsync/index.mdx +++ b/website/src/routes/api/(async)/setAsync/index.mdx @@ -92,6 +92,7 @@ The following APIs can be combined with `setAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -162,6 +163,7 @@ The following APIs can be combined with `setAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/strictObjectAsync/index.mdx b/website/src/routes/api/(async)/strictObjectAsync/index.mdx index e3e02f2c0..68a81fdaf 100644 --- a/website/src/routes/api/(async)/strictObjectAsync/index.mdx +++ b/website/src/routes/api/(async)/strictObjectAsync/index.mdx @@ -99,6 +99,7 @@ The following APIs can be combined with `strictObjectAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -174,6 +175,7 @@ The following APIs can be combined with `strictObjectAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/strictTupleAsync/index.mdx b/website/src/routes/api/(async)/strictTupleAsync/index.mdx index 44a7052bc..b8a240734 100644 --- a/website/src/routes/api/(async)/strictTupleAsync/index.mdx +++ b/website/src/routes/api/(async)/strictTupleAsync/index.mdx @@ -96,6 +96,7 @@ The following APIs can be combined with `strictTupleAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -179,6 +180,7 @@ The following APIs can be combined with `strictTupleAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/transformAsync/index.mdx b/website/src/routes/api/(async)/transformAsync/index.mdx index 764e6b252..e07dd0b15 100644 --- a/website/src/routes/api/(async)/transformAsync/index.mdx +++ b/website/src/routes/api/(async)/transformAsync/index.mdx @@ -88,6 +88,7 @@ The following APIs can be combined with `transformAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -132,6 +133,7 @@ The following APIs can be combined with `transformAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'pipeAsync', diff --git a/website/src/routes/api/(async)/tupleAsync/index.mdx b/website/src/routes/api/(async)/tupleAsync/index.mdx index 5eb015370..4171755be 100644 --- a/website/src/routes/api/(async)/tupleAsync/index.mdx +++ b/website/src/routes/api/(async)/tupleAsync/index.mdx @@ -96,6 +96,7 @@ The following APIs can be combined with `tupleAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -179,6 +180,7 @@ The following APIs can be combined with `tupleAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/tupleWithRestAsync/index.mdx b/website/src/routes/api/(async)/tupleWithRestAsync/index.mdx index 684c1e531..5e9c0a2b7 100644 --- a/website/src/routes/api/(async)/tupleWithRestAsync/index.mdx +++ b/website/src/routes/api/(async)/tupleWithRestAsync/index.mdx @@ -103,6 +103,7 @@ The following APIs can be combined with `tupleWithRestAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -186,6 +187,7 @@ The following APIs can be combined with `tupleWithRestAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/undefinedableAsync/index.mdx b/website/src/routes/api/(async)/undefinedableAsync/index.mdx index fc788613d..a591ca52f 100644 --- a/website/src/routes/api/(async)/undefinedableAsync/index.mdx +++ b/website/src/routes/api/(async)/undefinedableAsync/index.mdx @@ -153,6 +153,7 @@ The following APIs can be combined with `undefinedableAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -222,6 +223,7 @@ The following APIs can be combined with `undefinedableAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/unionAsync/index.mdx b/website/src/routes/api/(async)/unionAsync/index.mdx index 5febac5bc..481588a8f 100644 --- a/website/src/routes/api/(async)/unionAsync/index.mdx +++ b/website/src/routes/api/(async)/unionAsync/index.mdx @@ -102,6 +102,7 @@ The following APIs can be combined with `unionAsync`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -262,6 +263,7 @@ The following APIs can be combined with `unionAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/variantAsync/index.mdx b/website/src/routes/api/(async)/variantAsync/index.mdx index a9a51b851..1e0c4227c 100644 --- a/website/src/routes/api/(async)/variantAsync/index.mdx +++ b/website/src/routes/api/(async)/variantAsync/index.mdx @@ -161,6 +161,7 @@ The following APIs can be combined with `variantAsync`. 'getFallbacksAsync', 'looseObjectAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'parseAsync', 'parserAsync', diff --git a/website/src/routes/api/(methods)/assert/index.mdx b/website/src/routes/api/(methods)/assert/index.mdx index 573cf9035..ef6aaaf7d 100644 --- a/website/src/routes/api/(methods)/assert/index.mdx +++ b/website/src/routes/api/(methods)/assert/index.mdx @@ -81,6 +81,7 @@ The following APIs can be combined with `assert`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(methods)/config/index.mdx b/website/src/routes/api/(methods)/config/index.mdx index 1ac708cbf..8bcf1f869 100644 --- a/website/src/routes/api/(methods)/config/index.mdx +++ b/website/src/routes/api/(methods)/config/index.mdx @@ -103,6 +103,7 @@ The following APIs can be combined with `config`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -282,6 +283,7 @@ The following APIs can be combined with `config`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(methods)/fallback/index.mdx b/website/src/routes/api/(methods)/fallback/index.mdx index ef3e6518e..128a05b66 100644 --- a/website/src/routes/api/(methods)/fallback/index.mdx +++ b/website/src/routes/api/(methods)/fallback/index.mdx @@ -102,6 +102,7 @@ The following APIs can be combined with `fallback`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(methods)/forward/index.mdx b/website/src/routes/api/(methods)/forward/index.mdx index 5f49734af..069e268d1 100644 --- a/website/src/routes/api/(methods)/forward/index.mdx +++ b/website/src/routes/api/(methods)/forward/index.mdx @@ -84,6 +84,7 @@ The following APIs can be combined with `forward`. 'looseObject', 'looseTuple', 'object', + 'objectWithPatterns', 'objectWithRest', 'record', 'strictObject', diff --git a/website/src/routes/api/(methods)/getDefault/index.mdx b/website/src/routes/api/(methods)/getDefault/index.mdx index 3130180e4..fc008ae6b 100644 --- a/website/src/routes/api/(methods)/getDefault/index.mdx +++ b/website/src/routes/api/(methods)/getDefault/index.mdx @@ -80,6 +80,7 @@ The following APIs can be combined with `getDefault`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -138,6 +139,7 @@ The following APIs can be combined with `getDefault`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(methods)/getDefaults/index.mdx b/website/src/routes/api/(methods)/getDefaults/index.mdx index 1ced7139b..52a35f4bc 100644 --- a/website/src/routes/api/(methods)/getDefaults/index.mdx +++ b/website/src/routes/api/(methods)/getDefaults/index.mdx @@ -94,6 +94,7 @@ The following APIs can be combined with `getDefaults`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(methods)/getFallback/index.mdx b/website/src/routes/api/(methods)/getFallback/index.mdx index cdfca2a80..8186ea23a 100644 --- a/website/src/routes/api/(methods)/getFallback/index.mdx +++ b/website/src/routes/api/(methods)/getFallback/index.mdx @@ -80,6 +80,7 @@ The following APIs can be combined with `getFallback`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -138,6 +139,7 @@ The following APIs can be combined with `getFallback`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(methods)/getFallbacks/index.mdx b/website/src/routes/api/(methods)/getFallbacks/index.mdx index af83d95bc..c9950f3fa 100644 --- a/website/src/routes/api/(methods)/getFallbacks/index.mdx +++ b/website/src/routes/api/(methods)/getFallbacks/index.mdx @@ -94,6 +94,7 @@ The following APIs can be combined with `getFallbacks`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(methods)/is/index.mdx b/website/src/routes/api/(methods)/is/index.mdx index 581701422..683fb8a43 100644 --- a/website/src/routes/api/(methods)/is/index.mdx +++ b/website/src/routes/api/(methods)/is/index.mdx @@ -86,6 +86,7 @@ The following APIs can be combined with `is`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(methods)/keyof/index.mdx b/website/src/routes/api/(methods)/keyof/index.mdx index dfcd920ca..ec6eef4b5 100644 --- a/website/src/routes/api/(methods)/keyof/index.mdx +++ b/website/src/routes/api/(methods)/keyof/index.mdx @@ -65,6 +65,7 @@ The following APIs can be combined with `keyof`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', @@ -139,6 +140,7 @@ The following APIs can be combined with `keyof`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(methods)/message/index.mdx b/website/src/routes/api/(methods)/message/index.mdx index 91e0e470d..00ea1eec9 100644 --- a/website/src/routes/api/(methods)/message/index.mdx +++ b/website/src/routes/api/(methods)/message/index.mdx @@ -86,6 +86,7 @@ The following APIs can be combined with `message`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', @@ -266,6 +267,7 @@ The following APIs can be combined with `message`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(methods)/omit/index.mdx b/website/src/routes/api/(methods)/omit/index.mdx index dd581aade..6df5d7764 100644 --- a/website/src/routes/api/(methods)/omit/index.mdx +++ b/website/src/routes/api/(methods)/omit/index.mdx @@ -80,6 +80,7 @@ The following APIs can be combined with `omit`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', @@ -165,6 +166,7 @@ The following APIs can be combined with `omit`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(methods)/parse/index.mdx b/website/src/routes/api/(methods)/parse/index.mdx index 9f63111cb..c905e2ae5 100644 --- a/website/src/routes/api/(methods)/parse/index.mdx +++ b/website/src/routes/api/(methods)/parse/index.mdx @@ -87,6 +87,7 @@ The following APIs can be combined with `parse`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(methods)/parser/index.mdx b/website/src/routes/api/(methods)/parser/index.mdx index cc82cb490..e61e8268c 100644 --- a/website/src/routes/api/(methods)/parser/index.mdx +++ b/website/src/routes/api/(methods)/parser/index.mdx @@ -83,6 +83,7 @@ The following APIs can be combined with `parser`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(methods)/partial/index.mdx b/website/src/routes/api/(methods)/partial/index.mdx index 7224dcd3c..3ee695cf0 100644 --- a/website/src/routes/api/(methods)/partial/index.mdx +++ b/website/src/routes/api/(methods)/partial/index.mdx @@ -93,6 +93,7 @@ The following APIs can be combined with `partial`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(methods)/pick/index.mdx b/website/src/routes/api/(methods)/pick/index.mdx index a6a0d851a..39f43724f 100644 --- a/website/src/routes/api/(methods)/pick/index.mdx +++ b/website/src/routes/api/(methods)/pick/index.mdx @@ -80,6 +80,7 @@ The following APIs can be combined with `pick`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', @@ -165,6 +166,7 @@ The following APIs can be combined with `pick`. 'nullableAsync', 'nullishAsync', 'objectAsync', + 'objectWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(methods)/pipe/index.mdx b/website/src/routes/api/(methods)/pipe/index.mdx index 1681d4a9c..aee0d1876 100644 --- a/website/src/routes/api/(methods)/pipe/index.mdx +++ b/website/src/routes/api/(methods)/pipe/index.mdx @@ -105,6 +105,7 @@ The following APIs can be combined with `pipe`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(methods)/required/index.mdx b/website/src/routes/api/(methods)/required/index.mdx index 1638b421a..67f689691 100644 --- a/website/src/routes/api/(methods)/required/index.mdx +++ b/website/src/routes/api/(methods)/required/index.mdx @@ -102,6 +102,7 @@ The following APIs can be combined with `required`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(methods)/safeParse/index.mdx b/website/src/routes/api/(methods)/safeParse/index.mdx index 3d4c12769..1da35ddfa 100644 --- a/website/src/routes/api/(methods)/safeParse/index.mdx +++ b/website/src/routes/api/(methods)/safeParse/index.mdx @@ -82,6 +82,7 @@ The following APIs can be combined with `safeParse`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(methods)/safeParser/index.mdx b/website/src/routes/api/(methods)/safeParser/index.mdx index 4f217d5f1..09fa3d796 100644 --- a/website/src/routes/api/(methods)/safeParser/index.mdx +++ b/website/src/routes/api/(methods)/safeParser/index.mdx @@ -83,6 +83,7 @@ The following APIs can be combined with `safeParser`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/any/index.mdx b/website/src/routes/api/(schemas)/any/index.mdx index 74a0a5da0..d5440f332 100644 --- a/website/src/routes/api/(schemas)/any/index.mdx +++ b/website/src/routes/api/(schemas)/any/index.mdx @@ -48,6 +48,7 @@ The following APIs can be combined with `any`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/array/index.mdx b/website/src/routes/api/(schemas)/array/index.mdx index 813374362..f1f89d5d2 100644 --- a/website/src/routes/api/(schemas)/array/index.mdx +++ b/website/src/routes/api/(schemas)/array/index.mdx @@ -118,6 +118,7 @@ The following APIs can be combined with `array`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/bigint/index.mdx b/website/src/routes/api/(schemas)/bigint/index.mdx index d42751b35..f8f166bc5 100644 --- a/website/src/routes/api/(schemas)/bigint/index.mdx +++ b/website/src/routes/api/(schemas)/bigint/index.mdx @@ -75,6 +75,7 @@ The following APIs can be combined with `bigint`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/blob/index.mdx b/website/src/routes/api/(schemas)/blob/index.mdx index 13f0b8035..b0f2de9a5 100644 --- a/website/src/routes/api/(schemas)/blob/index.mdx +++ b/website/src/routes/api/(schemas)/blob/index.mdx @@ -72,6 +72,7 @@ The following APIs can be combined with `blob`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/boolean/index.mdx b/website/src/routes/api/(schemas)/boolean/index.mdx index 020c50836..baf375cd2 100644 --- a/website/src/routes/api/(schemas)/boolean/index.mdx +++ b/website/src/routes/api/(schemas)/boolean/index.mdx @@ -71,6 +71,7 @@ The following APIs can be combined with `boolean`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/custom/index.mdx b/website/src/routes/api/(schemas)/custom/index.mdx index 01da23739..d2f277e5e 100644 --- a/website/src/routes/api/(schemas)/custom/index.mdx +++ b/website/src/routes/api/(schemas)/custom/index.mdx @@ -76,6 +76,7 @@ The following APIs can be combined with `custom`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/date/index.mdx b/website/src/routes/api/(schemas)/date/index.mdx index 2fc555be9..8a5d4b5ab 100644 --- a/website/src/routes/api/(schemas)/date/index.mdx +++ b/website/src/routes/api/(schemas)/date/index.mdx @@ -80,6 +80,7 @@ The following APIs can be combined with `date`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/enum/index.mdx b/website/src/routes/api/(schemas)/enum/index.mdx index 2183ced2f..549ca8914 100644 --- a/website/src/routes/api/(schemas)/enum/index.mdx +++ b/website/src/routes/api/(schemas)/enum/index.mdx @@ -73,6 +73,7 @@ The following APIs can be combined with `enum`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/exactOptional/index.mdx b/website/src/routes/api/(schemas)/exactOptional/index.mdx index 17fb696e6..bb6ad84b4 100644 --- a/website/src/routes/api/(schemas)/exactOptional/index.mdx +++ b/website/src/routes/api/(schemas)/exactOptional/index.mdx @@ -100,6 +100,7 @@ The following APIs can be combined with `exactOptional`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/file/index.mdx b/website/src/routes/api/(schemas)/file/index.mdx index 00fec2323..873bac3d4 100644 --- a/website/src/routes/api/(schemas)/file/index.mdx +++ b/website/src/routes/api/(schemas)/file/index.mdx @@ -72,6 +72,7 @@ The following APIs can be combined with `file`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/function/index.mdx b/website/src/routes/api/(schemas)/function/index.mdx index 73a8b11a2..6646bf2dc 100644 --- a/website/src/routes/api/(schemas)/function/index.mdx +++ b/website/src/routes/api/(schemas)/function/index.mdx @@ -54,6 +54,7 @@ The following APIs can be combined with `function`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/instance/index.mdx b/website/src/routes/api/(schemas)/instance/index.mdx index e36572f55..3016103dc 100644 --- a/website/src/routes/api/(schemas)/instance/index.mdx +++ b/website/src/routes/api/(schemas)/instance/index.mdx @@ -81,6 +81,7 @@ The following APIs can be combined with `instance`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/intersect/index.mdx b/website/src/routes/api/(schemas)/intersect/index.mdx index a1cc20c42..3abe20a88 100644 --- a/website/src/routes/api/(schemas)/intersect/index.mdx +++ b/website/src/routes/api/(schemas)/intersect/index.mdx @@ -90,6 +90,7 @@ The following APIs can be combined with `intersect`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/lazy/index.mdx b/website/src/routes/api/(schemas)/lazy/index.mdx index 8843c18a5..e97030742 100644 --- a/website/src/routes/api/(schemas)/lazy/index.mdx +++ b/website/src/routes/api/(schemas)/lazy/index.mdx @@ -153,6 +153,7 @@ The following APIs can be combined with `lazy`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/literal/index.mdx b/website/src/routes/api/(schemas)/literal/index.mdx index c5f52a84e..a7ca78a13 100644 --- a/website/src/routes/api/(schemas)/literal/index.mdx +++ b/website/src/routes/api/(schemas)/literal/index.mdx @@ -84,6 +84,7 @@ The following APIs can be combined with `literal`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/looseObject/index.mdx b/website/src/routes/api/(schemas)/looseObject/index.mdx index 614963eb6..cd1f828cd 100644 --- a/website/src/routes/api/(schemas)/looseObject/index.mdx +++ b/website/src/routes/api/(schemas)/looseObject/index.mdx @@ -129,6 +129,7 @@ The following APIs can be combined with `looseObject`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/looseTuple/index.mdx b/website/src/routes/api/(schemas)/looseTuple/index.mdx index b1bc2d624..e9800a8ec 100644 --- a/website/src/routes/api/(schemas)/looseTuple/index.mdx +++ b/website/src/routes/api/(schemas)/looseTuple/index.mdx @@ -85,6 +85,7 @@ The following APIs can be combined with `looseTuple`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/map/index.mdx b/website/src/routes/api/(schemas)/map/index.mdx index 5e3a98818..2d9c49760 100644 --- a/website/src/routes/api/(schemas)/map/index.mdx +++ b/website/src/routes/api/(schemas)/map/index.mdx @@ -92,6 +92,7 @@ The following APIs can be combined with `map`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/nan/index.mdx b/website/src/routes/api/(schemas)/nan/index.mdx index efad1f3fa..0464ea02e 100644 --- a/website/src/routes/api/(schemas)/nan/index.mdx +++ b/website/src/routes/api/(schemas)/nan/index.mdx @@ -54,6 +54,7 @@ The following APIs can be combined with `nan`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/never/index.mdx b/website/src/routes/api/(schemas)/never/index.mdx index fdd9661f7..057e91ae1 100644 --- a/website/src/routes/api/(schemas)/never/index.mdx +++ b/website/src/routes/api/(schemas)/never/index.mdx @@ -54,6 +54,7 @@ The following APIs can be combined with `never`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/nonNullable/index.mdx b/website/src/routes/api/(schemas)/nonNullable/index.mdx index ae1c7e3aa..5e4e8888f 100644 --- a/website/src/routes/api/(schemas)/nonNullable/index.mdx +++ b/website/src/routes/api/(schemas)/nonNullable/index.mdx @@ -94,6 +94,7 @@ The following APIs can be combined with `nonNullable`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/nonNullish/index.mdx b/website/src/routes/api/(schemas)/nonNullish/index.mdx index 5229a8dfa..0a63f0131 100644 --- a/website/src/routes/api/(schemas)/nonNullish/index.mdx +++ b/website/src/routes/api/(schemas)/nonNullish/index.mdx @@ -94,6 +94,7 @@ The following APIs can be combined with `nonNullish`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/nonOptional/index.mdx b/website/src/routes/api/(schemas)/nonOptional/index.mdx index 4d1afd4ec..60be5458d 100644 --- a/website/src/routes/api/(schemas)/nonOptional/index.mdx +++ b/website/src/routes/api/(schemas)/nonOptional/index.mdx @@ -94,6 +94,7 @@ The following APIs can be combined with `nonOptional`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/null/index.mdx b/website/src/routes/api/(schemas)/null/index.mdx index c57c7fbe8..1e911973a 100644 --- a/website/src/routes/api/(schemas)/null/index.mdx +++ b/website/src/routes/api/(schemas)/null/index.mdx @@ -54,6 +54,7 @@ The following APIs can be combined with `null`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/nullable/index.mdx b/website/src/routes/api/(schemas)/nullable/index.mdx index 61483af08..c909f5cd8 100644 --- a/website/src/routes/api/(schemas)/nullable/index.mdx +++ b/website/src/routes/api/(schemas)/nullable/index.mdx @@ -115,6 +115,7 @@ The following APIs can be combined with `nullable`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/nullish/index.mdx b/website/src/routes/api/(schemas)/nullish/index.mdx index 8d6a03f29..6b78e3cff 100644 --- a/website/src/routes/api/(schemas)/nullish/index.mdx +++ b/website/src/routes/api/(schemas)/nullish/index.mdx @@ -115,6 +115,7 @@ The following APIs can be combined with `nullish`. 'nullable', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/number/index.mdx b/website/src/routes/api/(schemas)/number/index.mdx index 4fdedf188..203016a60 100644 --- a/website/src/routes/api/(schemas)/number/index.mdx +++ b/website/src/routes/api/(schemas)/number/index.mdx @@ -83,6 +83,7 @@ The following APIs can be combined with `number`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/object/index.mdx b/website/src/routes/api/(schemas)/object/index.mdx index 5136b014e..6a3d161c3 100644 --- a/website/src/routes/api/(schemas)/object/index.mdx +++ b/website/src/routes/api/(schemas)/object/index.mdx @@ -129,6 +129,7 @@ The following APIs can be combined with `object`. 'nullable', 'nullish', 'number', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/objectWithPatterns/index.mdx b/website/src/routes/api/(schemas)/objectWithPatterns/index.mdx new file mode 100644 index 000000000..fc3e51bd0 --- /dev/null +++ b/website/src/routes/api/(schemas)/objectWithPatterns/index.mdx @@ -0,0 +1,166 @@ +--- +title: objectWithPatterns +description: Creates an object with patterns schema. +source: /schemas/objectWithPatterns/objectWithPatterns.ts +contributors: + - EskiMojo14 +--- + +import { Link } from '@builder.io/qwik-city'; +import { ApiList, Property } from '~/components'; +import { properties } from './properties'; + +# objectWithPatterns + +Creates an object schema that matches patterns. + +```ts +const ObjectWithPatternsSchema = v.objectWithPatterns< + TPatterns, + TRest, + TMessage +>(patterns, rest, message); +``` + +## Generics + +- `TPatterns` +- `TRest` +- `TMessage` + +## Parameters + +- `patterns` +- `rest` +- `message` + +## Returns + +- `Schema` + +## Explanation + +Tuples of key and value schemas are iterated through until a key schema matches, and the value schema is used to validate the value. If no key schema matches, the rest schema is used. + +## Examples + +The following examples show how `objectWithPatterns` can be used. Please see the object guide for more examples and explanations. + +```ts +const ObjectWithPatternsSchema = v.objectWithPatterns( + [ + [v.pipe(v.string(), v.startsWith('str-')), v.string()], + [v.pipe(v.string(), v.startsWith('num-')), v.number()], + ], + v.boolean() +); +``` + +## Related + +The following APIs can be combined with `objectWithPatterns`. + +### Schemas + + + +### Methods + + + +### Actions + + + +### Utils + + diff --git a/website/src/routes/api/(schemas)/objectWithPatterns/properties.ts b/website/src/routes/api/(schemas)/objectWithPatterns/properties.ts new file mode 100644 index 000000000..ef397a929 --- /dev/null +++ b/website/src/routes/api/(schemas)/objectWithPatterns/properties.ts @@ -0,0 +1,90 @@ +import type { PropertyProps } from '~/components'; + +export const properties: Record = { + TPatterns: { + modifier: 'extends', + type: { + type: 'custom', + name: 'PatternTuples', + href: '../PatternTuples/', + }, + }, + TRest: { + modifier: 'extends', + type: { + type: 'custom', + name: 'BaseSchema', + href: '../BaseSchema/', + generics: [ + 'unknown', + 'unknown', + { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], + }, + ], + }, + }, + TMessage: { + modifier: 'extends', + type: { + type: 'union', + options: [ + { + type: 'custom', + name: 'ErrorMessage', + href: '../ErrorMessage/', + generics: [ + { + type: 'custom', + name: 'ObjectWithPatternsIssue', + href: '../ObjectWithPatternsIssue/', + }, + ], + }, + 'undefined', + ], + }, + }, + patterns: { + type: { + type: 'custom', + name: 'TPatterns', + }, + }, + rest: { + type: { + type: 'custom', + name: 'TRest', + }, + }, + message: { + type: { + type: 'custom', + name: 'TMessage', + }, + }, + Schema: { + type: { + type: 'custom', + name: 'ObjectWithPatternsSchema', + href: '../ObjectWithPatternsSchema/', + generics: [ + { + type: 'custom', + name: 'TPatterns', + }, + { + type: 'custom', + name: 'TRest', + }, + { + type: 'custom', + name: 'TMessage', + }, + ], + }, + }, +}; diff --git a/website/src/routes/api/(schemas)/objectWithRest/index.mdx b/website/src/routes/api/(schemas)/objectWithRest/index.mdx index d0a2ab58e..3c9054f8e 100644 --- a/website/src/routes/api/(schemas)/objectWithRest/index.mdx +++ b/website/src/routes/api/(schemas)/objectWithRest/index.mdx @@ -148,6 +148,7 @@ The following APIs can be combined with `objectWithRest`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'optional', 'picklist', 'promise', diff --git a/website/src/routes/api/(schemas)/optional/index.mdx b/website/src/routes/api/(schemas)/optional/index.mdx index f6c2258d9..7e13c74c5 100644 --- a/website/src/routes/api/(schemas)/optional/index.mdx +++ b/website/src/routes/api/(schemas)/optional/index.mdx @@ -116,6 +116,7 @@ The following APIs can be combined with `optional`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'picklist', 'promise', diff --git a/website/src/routes/api/(schemas)/picklist/index.mdx b/website/src/routes/api/(schemas)/picklist/index.mdx index 9c3ff73cc..c2cb89168 100644 --- a/website/src/routes/api/(schemas)/picklist/index.mdx +++ b/website/src/routes/api/(schemas)/picklist/index.mdx @@ -90,6 +90,7 @@ The following APIs can be combined with `picklist`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/promise/index.mdx b/website/src/routes/api/(schemas)/promise/index.mdx index 31ca29320..59bd1622a 100644 --- a/website/src/routes/api/(schemas)/promise/index.mdx +++ b/website/src/routes/api/(schemas)/promise/index.mdx @@ -70,6 +70,7 @@ The following APIs can be combined with `promise`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/record/index.mdx b/website/src/routes/api/(schemas)/record/index.mdx index f4a852c67..e249681e8 100644 --- a/website/src/routes/api/(schemas)/record/index.mdx +++ b/website/src/routes/api/(schemas)/record/index.mdx @@ -128,6 +128,7 @@ The following APIs can be combined with `record`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/set/index.mdx b/website/src/routes/api/(schemas)/set/index.mdx index 7c412eb5a..bc040390b 100644 --- a/website/src/routes/api/(schemas)/set/index.mdx +++ b/website/src/routes/api/(schemas)/set/index.mdx @@ -91,6 +91,7 @@ The following APIs can be combined with `set`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/strictObject/index.mdx b/website/src/routes/api/(schemas)/strictObject/index.mdx index 7f2eac7ff..330dddd1c 100644 --- a/website/src/routes/api/(schemas)/strictObject/index.mdx +++ b/website/src/routes/api/(schemas)/strictObject/index.mdx @@ -130,6 +130,7 @@ The following APIs can be combined with `strictObject`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/strictTuple/index.mdx b/website/src/routes/api/(schemas)/strictTuple/index.mdx index 65ca97f74..1536f3ce7 100644 --- a/website/src/routes/api/(schemas)/strictTuple/index.mdx +++ b/website/src/routes/api/(schemas)/strictTuple/index.mdx @@ -86,6 +86,7 @@ The following APIs can be combined with `strictTuple`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/string/index.mdx b/website/src/routes/api/(schemas)/string/index.mdx index e335716f7..77fdd2266 100644 --- a/website/src/routes/api/(schemas)/string/index.mdx +++ b/website/src/routes/api/(schemas)/string/index.mdx @@ -101,6 +101,7 @@ The following APIs can be combined with `string`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/symbol/index.mdx b/website/src/routes/api/(schemas)/symbol/index.mdx index 9661419b7..d4a3ac8d6 100644 --- a/website/src/routes/api/(schemas)/symbol/index.mdx +++ b/website/src/routes/api/(schemas)/symbol/index.mdx @@ -67,6 +67,7 @@ The following APIs can be combined with `symbol`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/tuple/index.mdx b/website/src/routes/api/(schemas)/tuple/index.mdx index efe7205e6..c15800a51 100644 --- a/website/src/routes/api/(schemas)/tuple/index.mdx +++ b/website/src/routes/api/(schemas)/tuple/index.mdx @@ -86,6 +86,7 @@ The following APIs can be combined with `tuple`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/tupleWithRest/index.mdx b/website/src/routes/api/(schemas)/tupleWithRest/index.mdx index 99048f639..376acf074 100644 --- a/website/src/routes/api/(schemas)/tupleWithRest/index.mdx +++ b/website/src/routes/api/(schemas)/tupleWithRest/index.mdx @@ -89,6 +89,7 @@ The following APIs can be combined with `tupleWithRest`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/undefined/index.mdx b/website/src/routes/api/(schemas)/undefined/index.mdx index 6bb2ba4f3..4a4ea3eae 100644 --- a/website/src/routes/api/(schemas)/undefined/index.mdx +++ b/website/src/routes/api/(schemas)/undefined/index.mdx @@ -54,6 +54,7 @@ The following APIs can be combined with `undefined`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/undefinedable/index.mdx b/website/src/routes/api/(schemas)/undefinedable/index.mdx index e96210ed8..c8fc0d9c6 100644 --- a/website/src/routes/api/(schemas)/undefinedable/index.mdx +++ b/website/src/routes/api/(schemas)/undefinedable/index.mdx @@ -120,6 +120,7 @@ The following APIs can be combined with `undefinedable`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'picklist', 'promise', diff --git a/website/src/routes/api/(schemas)/union/index.mdx b/website/src/routes/api/(schemas)/union/index.mdx index 365234239..98535c37e 100644 --- a/website/src/routes/api/(schemas)/union/index.mdx +++ b/website/src/routes/api/(schemas)/union/index.mdx @@ -107,6 +107,7 @@ The following APIs can be combined with `union`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/unknown/index.mdx b/website/src/routes/api/(schemas)/unknown/index.mdx index 40d6ba470..af1f2f871 100644 --- a/website/src/routes/api/(schemas)/unknown/index.mdx +++ b/website/src/routes/api/(schemas)/unknown/index.mdx @@ -49,6 +49,7 @@ The following APIs can be combined with `unknown`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(schemas)/void/index.mdx b/website/src/routes/api/(schemas)/void/index.mdx index b282bc615..f25bcb3bf 100644 --- a/website/src/routes/api/(schemas)/void/index.mdx +++ b/website/src/routes/api/(schemas)/void/index.mdx @@ -54,6 +54,7 @@ The following APIs can be combined with `void`. 'nullable', 'nullish', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'record', diff --git a/website/src/routes/api/(types)/ObjectWithPatternsIssue/index.mdx b/website/src/routes/api/(types)/ObjectWithPatternsIssue/index.mdx new file mode 100644 index 000000000..cc8754ad2 --- /dev/null +++ b/website/src/routes/api/(types)/ObjectWithPatternsIssue/index.mdx @@ -0,0 +1,20 @@ +--- +title: ObjectWithPatternsIssue +description: Object with patterns issue interface. +contributors: + - EskiMojo14 +--- + +import { Property } from '~/components'; +import { properties } from './properties'; + +# ObjectWithPatternsIssue + +Object with patterns issue interface. + +## Definition + +- `ObjectWithPatternsIssue` + - `kind` + - `type` + - `expected` diff --git a/website/src/routes/api/(types)/ObjectWithPatternsIssue/properties.ts b/website/src/routes/api/(types)/ObjectWithPatternsIssue/properties.ts new file mode 100644 index 000000000..54b9cde6c --- /dev/null +++ b/website/src/routes/api/(types)/ObjectWithPatternsIssue/properties.ts @@ -0,0 +1,50 @@ +import type { PropertyProps } from '~/components'; + +export const properties: Record = { + BaseIssue: { + modifier: 'extends', + type: { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], + }, + }, + kind: { + type: { + type: 'string', + value: 'schema', + }, + }, + type: { + type: { + type: 'string', + value: 'object_with_patterns', + }, + }, + expected: { + type: { + type: 'union', + options: [ + { + type: 'string', + value: 'Object', + }, + { + type: 'template', + parts: [ + { + type: 'string', + value: '"', + }, + 'string', + { + type: 'string', + value: '"', + }, + ], + }, + ], + }, + }, +}; diff --git a/website/src/routes/api/(types)/ObjectWithPatternsSchema/index.mdx b/website/src/routes/api/(types)/ObjectWithPatternsSchema/index.mdx new file mode 100644 index 000000000..c1e41a151 --- /dev/null +++ b/website/src/routes/api/(types)/ObjectWithPatternsSchema/index.mdx @@ -0,0 +1,29 @@ +--- +title: ObjectWithPatternsSchema +description: Object with patterns schema interface. +contributors: + - EskiMojo14 +--- + +import { Property } from '~/components'; +import { properties } from './properties'; + +# ObjectWithPatternsSchema + +Object with patterns schema interface. + +## Generics + +- `TPatterns` +- `TRest` +- `TMessage` + +## Definition + +- `ObjectWithPatternsSchema` + - `type` + - `reference` + - `expects` + - `patterns` + - `rest` + - `message` diff --git a/website/src/routes/api/(types)/ObjectWithPatternsSchema/properties.ts b/website/src/routes/api/(types)/ObjectWithPatternsSchema/properties.ts new file mode 100644 index 000000000..4e16f0b4e --- /dev/null +++ b/website/src/routes/api/(types)/ObjectWithPatternsSchema/properties.ts @@ -0,0 +1,69 @@ +import type { PropertyProps } from '~/components'; + +export const properties: Record = { + TPatterns: { + modifier: 'extends', + type: { + type: 'custom', + name: 'PatternTuples', + href: '../PatternTuples/', + }, + }, + TRest: { + modifier: 'extends', + type: { + type: 'custom', + name: 'BaseSchema', + href: '../BaseSchema/', + generics: [ + 'unknown', + 'unknown', + { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], + }, + ], + }, + }, + TMessage: { + modifier: 'extends', + type: { + type: 'union', + options: [ + { + type: 'custom', + name: 'ErrorMessage', + href: '../ErrorMessage/', + generics: [ + { + type: 'custom', + name: 'ObjectWithPatternsIssue', + href: '../ObjectWithPatternsIssue/', + }, + ], + }, + 'undefined', + ], + }, + }, + patterns: { + type: { + type: 'custom', + name: 'TPatterns', + }, + }, + rest: { + type: { + type: 'custom', + name: 'TRest', + }, + }, + message: { + type: { + type: 'custom', + name: 'TMessage', + }, + }, +}; diff --git a/website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/index.mdx b/website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/index.mdx new file mode 100644 index 000000000..d2ffd2979 --- /dev/null +++ b/website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/index.mdx @@ -0,0 +1,29 @@ +--- +title: ObjectWithPatternsSchemaAsync +description: Object with patterns schema async interface. +contributors: + - EskiMojo14 +--- + +import { Property } from '~/components'; +import { properties } from './properties'; + +# ObjectWithPatternsSchemaAsync + +Object with patterns schema async interface. + +## Generics + +- `TPatterns` +- `TRest` +- `TMessage` + +## Definition + +- `ObjectWithPatternsSchemaAsync` + - `type` + - `reference` + - `expects` + - `patterns` + - `rest` + - `message` diff --git a/website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/properties.ts b/website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/properties.ts new file mode 100644 index 000000000..9754d123c --- /dev/null +++ b/website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/properties.ts @@ -0,0 +1,89 @@ +import type { PropertyProps } from '~/components'; + +export const properties: Record = { + TPatterns: { + modifier: 'extends', + type: { + type: 'custom', + name: 'PatternTuplesAsync', + href: '../PatternTuplesAsync/', + }, + }, + TRest: { + modifier: 'extends', + type: { + type: 'union', + options: [ + { + type: 'custom', + name: 'BaseSchema', + href: '../BaseSchema/', + generics: [ + 'unknown', + 'unknown', + { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], + }, + ], + }, + { + type: 'custom', + name: 'BaseSchemaAsync', + href: '../BaseSchemaAsync/', + generics: [ + 'unknown', + 'unknown', + { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], + }, + ], + }, + ], + }, + }, + TMessage: { + modifier: 'extends', + type: { + type: 'union', + options: [ + { + type: 'custom', + name: 'ErrorMessage', + href: '../ErrorMessage/', + generics: [ + { + type: 'custom', + name: 'ObjectWithPatternsIssue', + href: '../ObjectWithPatternsIssue/', + }, + ], + }, + 'undefined', + ], + }, + }, + patterns: { + type: { + type: 'custom', + name: 'TPatterns', + }, + }, + rest: { + type: { + type: 'custom', + name: 'TRest', + }, + }, + message: { + type: { + type: 'custom', + name: 'TMessage', + }, + }, +}; diff --git a/website/src/routes/api/(types)/PatternTuple/index.mdx b/website/src/routes/api/(types)/PatternTuple/index.mdx new file mode 100644 index 000000000..4836dc15f --- /dev/null +++ b/website/src/routes/api/(types)/PatternTuple/index.mdx @@ -0,0 +1,17 @@ +--- +title: PatternTuple +description: Pattern tuple type. +contributors: + - EskiMojo14 +--- + +import { Property } from '~/components'; +import { properties } from './properties'; + +# PatternTuple + +Pattern tuple type. + +## Definition + +- `PatternTuple` diff --git a/website/src/routes/api/(types)/PatternTuple/properties.ts b/website/src/routes/api/(types)/PatternTuple/properties.ts new file mode 100644 index 000000000..834085b53 --- /dev/null +++ b/website/src/routes/api/(types)/PatternTuple/properties.ts @@ -0,0 +1,43 @@ +import type { PropertyProps } from '~/components'; + +export const properties: Record = { + PatternTuple: { + type: { + type: 'tuple', + modifier: 'readonly', + itemLabels: ['key', 'value'], + items: [ + { + type: 'custom', + name: 'BaseSchema', + href: '../BaseSchema/', + generics: [ + 'unknown', + 'unknown', + { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], + }, + ], + }, + { + type: 'custom', + name: 'BaseSchema', + href: '../BaseSchema/', + generics: [ + 'unknown', + 'unknown', + { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], + }, + ], + }, + ], + }, + }, +}; diff --git a/website/src/routes/api/(types)/PatternTupleAsync/index.mdx b/website/src/routes/api/(types)/PatternTupleAsync/index.mdx new file mode 100644 index 000000000..aeed468c6 --- /dev/null +++ b/website/src/routes/api/(types)/PatternTupleAsync/index.mdx @@ -0,0 +1,17 @@ +--- +title: PatternTupleAsync +description: Pattern tuple async type. +contributors: + - EskiMojo14 +--- + +import { Property } from '~/components'; +import { properties } from './properties'; + +# PatternTupleAsync + +Pattern tuple async type. + +## Definition + +- `PatternTupleAsync` diff --git a/website/src/routes/api/(types)/PatternTupleAsync/properties.ts b/website/src/routes/api/(types)/PatternTupleAsync/properties.ts new file mode 100644 index 000000000..9432e2769 --- /dev/null +++ b/website/src/routes/api/(types)/PatternTupleAsync/properties.ts @@ -0,0 +1,83 @@ +import type { PropertyProps } from '~/components'; + +export const properties: Record = { + PatternTupleAsync: { + type: { + type: 'tuple', + modifier: 'readonly', + itemLabels: ['key', 'value'], + items: [ + { + type: 'union', + options: [ + { + type: 'custom', + name: 'BaseSchema', + href: '../BaseSchema/', + generics: [ + 'string', + 'string', + { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], + }, + ], + }, + { + type: 'custom', + name: 'BaseSchemaAsync', + href: '../BaseSchemaAsync/', + generics: [ + 'string', + 'string', + { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], + }, + ], + }, + ], + }, + { + type: 'union', + options: [ + { + type: 'custom', + name: 'BaseSchema', + href: '../BaseSchema/', + generics: [ + 'unknown', + 'unknown', + { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], + }, + ], + }, + { + type: 'custom', + name: 'BaseSchemaAsync', + href: '../BaseSchemaAsync/', + generics: [ + 'unknown', + 'unknown', + { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: ['unknown'], + }, + ], + }, + ], + }, + ], + }, + }, +}; diff --git a/website/src/routes/api/(types)/PatternTuples/index.mdx b/website/src/routes/api/(types)/PatternTuples/index.mdx new file mode 100644 index 000000000..d820cdd36 --- /dev/null +++ b/website/src/routes/api/(types)/PatternTuples/index.mdx @@ -0,0 +1,17 @@ +--- +title: PatternTuples +description: Pattern tuples type. +contributors: + - EskiMojo14 +--- + +import { Property } from '~/components'; +import { properties } from './properties'; + +# PatternTuples + +Pattern tuples type. + +## Definition + +- `PatternTuples` diff --git a/website/src/routes/api/(types)/PatternTuples/properties.ts b/website/src/routes/api/(types)/PatternTuples/properties.ts new file mode 100644 index 000000000..c5ee21419 --- /dev/null +++ b/website/src/routes/api/(types)/PatternTuples/properties.ts @@ -0,0 +1,22 @@ +import type { PropertyProps } from '~/components'; + +export const properties: Record = { + PatternTuples: { + type: { + type: 'tuple', + modifier: 'readonly', + items: [ + { type: 'custom', name: 'PatternTuple', href: '../PatternTuple/' }, + { + type: 'array', + spread: true, + item: { + type: 'custom', + name: 'PatternTuple', + href: '../PatternTuple/', + }, + }, + ], + }, + }, +}; diff --git a/website/src/routes/api/(types)/PatternTuplesAsync/index.mdx b/website/src/routes/api/(types)/PatternTuplesAsync/index.mdx new file mode 100644 index 000000000..322ac3dd7 --- /dev/null +++ b/website/src/routes/api/(types)/PatternTuplesAsync/index.mdx @@ -0,0 +1,17 @@ +--- +title: PatternTuplesAsync +description: Pattern tuples async type. +contributors: + - EskiMojo14 +--- + +import { Property } from '~/components'; +import { properties } from './properties'; + +# PatternTuplesAsync + +Pattern tuples async type. + +## Definition + +- `PatternTuplesAsync` diff --git a/website/src/routes/api/(types)/PatternTuplesAsync/properties.ts b/website/src/routes/api/(types)/PatternTuplesAsync/properties.ts new file mode 100644 index 000000000..64d088b92 --- /dev/null +++ b/website/src/routes/api/(types)/PatternTuplesAsync/properties.ts @@ -0,0 +1,26 @@ +import type { PropertyProps } from '~/components'; + +export const properties: Record = { + PatternTuplesAsync: { + type: { + type: 'tuple', + modifier: 'readonly', + items: [ + { + type: 'custom', + name: 'PatternTupleAsync', + href: '../PatternTupleAsync/', + }, + { + type: 'array', + spread: true, + item: { + type: 'custom', + name: 'PatternTupleAsync', + href: '../PatternTupleAsync/', + }, + }, + ], + }, + }, +}; diff --git a/website/src/routes/api/(utils)/entriesFromList/index.mdx b/website/src/routes/api/(utils)/entriesFromList/index.mdx index df7e108ea..68f5b5716 100644 --- a/website/src/routes/api/(utils)/entriesFromList/index.mdx +++ b/website/src/routes/api/(utils)/entriesFromList/index.mdx @@ -76,6 +76,7 @@ The following APIs can be combined with `entriesFromList`. 'nullish', 'number', 'object', + 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/menu.md b/website/src/routes/api/menu.md index 6e428cefa..591660f01 100644 --- a/website/src/routes/api/menu.md +++ b/website/src/routes/api/menu.md @@ -30,6 +30,7 @@ - [nullish](/api/nullish/) - [number](/api/number/) - [object](/api/object/) +- [objectWithPatterns](/api/objectWithPatterns/) - [objectWithRest](/api/objectWithRest/) - [optional](/api/optional/) - [picklist](/api/picklist/) @@ -230,6 +231,7 @@ - [nullableAsync](/api/nullableAsync/) - [nullishAsync](/api/nullishAsync/) - [objectAsync](/api/objectAsync/) +- [objectWithPatternsAsync](/api/objectWithPatternsAsync/) - [objectWithRestAsync](/api/objectWithRestAsync/) - [optionalAsync](/api/optionalAsync/) - [parseAsync](/api/parseAsync/) @@ -556,11 +558,18 @@ - [ObjectPathItem](/api/ObjectPathItem/) - [ObjectSchema](/api/ObjectSchema/) - [ObjectSchemaAsync](/api/ObjectSchemaAsync/) +- [ObjectWithPatternsIssue](/api/ObjectWithPatternsIssue/) +- [ObjectWithPatternsSchema](/api/ObjectWithPatternsSchema/) +- [ObjectWithPatternsSchemaAsync](/api/ObjectWithPatternsSchemaAsync/) - [ObjectWithRestIssue](/api/ObjectWithRestIssue/) - [ObjectWithRestSchema](/api/ObjectWithRestSchema/) - [ObjectWithRestSchemaAsync](/api/ObjectWithRestSchemaAsync/) - [OctalAction](/api/OctalAction/) - [OctalIssue](/api/OctalIssue/) +- [PatternTuple](/api/PatternTuple/) +- [PatternTupleAsync](/api/PatternTupleAsync/) +- [PatternTuples](/api/PatternTuples/) +- [PatternTuplesAsync](/api/PatternTuplesAsync/) - [OptionalSchema](/api/OptionalSchema/) - [OptionalSchemaAsync](/api/OptionalSchemaAsync/) - [OutputDataset](/api/OutputDataset/) diff --git a/website/src/routes/guides/(main-concepts)/schemas/index.mdx b/website/src/routes/guides/(main-concepts)/schemas/index.mdx index 0a25fc54f..956b947c0 100644 --- a/website/src/routes/guides/(main-concepts)/schemas/index.mdx +++ b/website/src/routes/guides/(main-concepts)/schemas/index.mdx @@ -66,6 +66,7 @@ Among complex values, Valibot supports objects, records, arrays, tuples, and sev 'looseTuple', 'map', 'object', + 'objectWithPatterns', 'objectWithRest', 'promise', 'record', From 762dfc3c6c57b527f94ea50488a8ecc303b06721 Mon Sep 17 00:00:00 2001 From: Ben Durrant Date: Tue, 22 Apr 2025 11:09:26 +0100 Subject: [PATCH 5/5] objectWithPattern -> recordWithPattern --- library/src/schemas/index.ts | 2 +- .../src/schemas/objectWithPatterns/index.ts | 3 -- .../src/schemas/recordWithPatterns/index.ts | 3 ++ .../recordWithPatterns.test-d.ts} | 24 +++++----- .../recordWithPatterns.test.ts} | 34 +++++++------- .../recordWithPatterns.ts} | 44 +++++++++---------- .../recordWithPatternsAsync.test-d.ts} | 24 +++++----- .../recordWithPatternsAsync.test.ts} | 36 +++++++-------- .../recordWithPatternsAsync.ts} | 40 ++++++++--------- .../types.ts | 4 +- .../src/routes/api/(actions)/brand/index.mdx | 2 +- .../src/routes/api/(actions)/check/index.mdx | 2 +- .../api/(actions)/description/index.mdx | 2 +- .../routes/api/(actions)/entries/index.mdx | 2 +- .../routes/api/(actions)/maxEntries/index.mdx | 2 +- .../routes/api/(actions)/metadata/index.mdx | 2 +- .../routes/api/(actions)/minEntries/index.mdx | 2 +- .../routes/api/(actions)/notEntries/index.mdx | 2 +- .../api/(actions)/partialCheck/index.mdx | 2 +- .../routes/api/(actions)/rawCheck/index.mdx | 2 +- .../api/(actions)/rawTransform/index.mdx | 2 +- .../routes/api/(actions)/readonly/index.mdx | 2 +- .../routes/api/(actions)/returns/index.mdx | 2 +- .../src/routes/api/(actions)/title/index.mdx | 2 +- .../routes/api/(actions)/transform/index.mdx | 2 +- .../routes/api/(async)/arrayAsync/index.mdx | 4 +- .../routes/api/(async)/awaitAsync/index.mdx | 4 +- .../routes/api/(async)/checkAsync/index.mdx | 4 +- .../routes/api/(async)/customAsync/index.mdx | 4 +- .../api/(async)/exactOptionalAsync/index.mdx | 4 +- .../api/(async)/fallbackAsync/index.mdx | 4 +- .../routes/api/(async)/forwardAsync/index.mdx | 4 +- .../api/(async)/getDefaultsAsync/index.mdx | 4 +- .../api/(async)/getFallbacksAsync/index.mdx | 4 +- .../api/(async)/intersectAsync/index.mdx | 4 +- .../routes/api/(async)/lazyAsync/index.mdx | 4 +- .../api/(async)/looseObjectAsync/index.mdx | 4 +- .../api/(async)/looseTupleAsync/index.mdx | 4 +- .../src/routes/api/(async)/mapAsync/index.mdx | 4 +- .../api/(async)/nonNullableAsync/index.mdx | 4 +- .../api/(async)/nonNullishAsync/index.mdx | 4 +- .../api/(async)/nonOptionalAsync/index.mdx | 4 +- .../api/(async)/nullableAsync/index.mdx | 4 +- .../routes/api/(async)/nullishAsync/index.mdx | 4 +- .../routes/api/(async)/objectAsync/index.mdx | 4 +- .../api/(async)/objectWithRestAsync/index.mdx | 4 +- .../api/(async)/optionalAsync/index.mdx | 4 +- .../routes/api/(async)/parseAsync/index.mdx | 4 +- .../routes/api/(async)/parserAsync/index.mdx | 4 +- .../routes/api/(async)/partialAsync/index.mdx | 4 +- .../api/(async)/partialCheckAsync/index.mdx | 4 +- .../routes/api/(async)/pipeAsync/index.mdx | 4 +- .../api/(async)/rawCheckAsync/index.mdx | 4 +- .../api/(async)/rawTransformAsync/index.mdx | 4 +- .../routes/api/(async)/recordAsync/index.mdx | 4 +- .../index.mdx | 16 +++---- .../properties.ts | 8 ++-- .../api/(async)/requiredAsync/index.mdx | 4 +- .../routes/api/(async)/returnsAsync/index.mdx | 4 +- .../api/(async)/safeParseAsync/index.mdx | 4 +- .../api/(async)/safeParserAsync/index.mdx | 4 +- .../src/routes/api/(async)/setAsync/index.mdx | 4 +- .../api/(async)/strictObjectAsync/index.mdx | 4 +- .../api/(async)/strictTupleAsync/index.mdx | 4 +- .../api/(async)/transformAsync/index.mdx | 4 +- .../routes/api/(async)/tupleAsync/index.mdx | 4 +- .../api/(async)/tupleWithRestAsync/index.mdx | 4 +- .../api/(async)/undefinedableAsync/index.mdx | 4 +- .../routes/api/(async)/unionAsync/index.mdx | 4 +- .../routes/api/(async)/variantAsync/index.mdx | 2 +- .../src/routes/api/(methods)/assert/index.mdx | 2 +- .../src/routes/api/(methods)/config/index.mdx | 4 +- .../routes/api/(methods)/fallback/index.mdx | 2 +- .../routes/api/(methods)/forward/index.mdx | 2 +- .../routes/api/(methods)/getDefault/index.mdx | 4 +- .../api/(methods)/getDefaults/index.mdx | 2 +- .../api/(methods)/getFallback/index.mdx | 4 +- .../api/(methods)/getFallbacks/index.mdx | 2 +- website/src/routes/api/(methods)/is/index.mdx | 2 +- .../src/routes/api/(methods)/keyof/index.mdx | 4 +- .../routes/api/(methods)/message/index.mdx | 4 +- .../src/routes/api/(methods)/omit/index.mdx | 4 +- .../src/routes/api/(methods)/parse/index.mdx | 2 +- .../src/routes/api/(methods)/parser/index.mdx | 2 +- .../routes/api/(methods)/partial/index.mdx | 2 +- .../src/routes/api/(methods)/pick/index.mdx | 4 +- .../src/routes/api/(methods)/pipe/index.mdx | 2 +- .../routes/api/(methods)/required/index.mdx | 2 +- .../routes/api/(methods)/safeParse/index.mdx | 2 +- .../routes/api/(methods)/safeParser/index.mdx | 2 +- .../src/routes/api/(schemas)/any/index.mdx | 2 +- .../src/routes/api/(schemas)/array/index.mdx | 2 +- .../src/routes/api/(schemas)/bigint/index.mdx | 2 +- .../src/routes/api/(schemas)/blob/index.mdx | 2 +- .../routes/api/(schemas)/boolean/index.mdx | 2 +- .../src/routes/api/(schemas)/custom/index.mdx | 2 +- .../src/routes/api/(schemas)/date/index.mdx | 2 +- .../src/routes/api/(schemas)/enum/index.mdx | 2 +- .../api/(schemas)/exactOptional/index.mdx | 2 +- .../src/routes/api/(schemas)/file/index.mdx | 2 +- .../routes/api/(schemas)/function/index.mdx | 2 +- .../routes/api/(schemas)/instance/index.mdx | 2 +- .../routes/api/(schemas)/intersect/index.mdx | 2 +- .../src/routes/api/(schemas)/lazy/index.mdx | 2 +- .../routes/api/(schemas)/literal/index.mdx | 2 +- .../api/(schemas)/looseObject/index.mdx | 2 +- .../routes/api/(schemas)/looseTuple/index.mdx | 2 +- .../src/routes/api/(schemas)/map/index.mdx | 2 +- .../src/routes/api/(schemas)/nan/index.mdx | 2 +- .../src/routes/api/(schemas)/never/index.mdx | 2 +- .../api/(schemas)/nonNullable/index.mdx | 2 +- .../routes/api/(schemas)/nonNullish/index.mdx | 2 +- .../api/(schemas)/nonOptional/index.mdx | 2 +- .../src/routes/api/(schemas)/null/index.mdx | 2 +- .../routes/api/(schemas)/nullable/index.mdx | 2 +- .../routes/api/(schemas)/nullish/index.mdx | 2 +- .../src/routes/api/(schemas)/number/index.mdx | 2 +- .../src/routes/api/(schemas)/object/index.mdx | 2 +- .../api/(schemas)/objectWithRest/index.mdx | 2 +- .../routes/api/(schemas)/optional/index.mdx | 2 +- .../routes/api/(schemas)/picklist/index.mdx | 2 +- .../routes/api/(schemas)/promise/index.mdx | 2 +- .../src/routes/api/(schemas)/record/index.mdx | 1 - .../index.mdx | 19 ++++---- .../properties.ts | 8 ++-- .../src/routes/api/(schemas)/set/index.mdx | 2 +- .../api/(schemas)/strictObject/index.mdx | 2 +- .../api/(schemas)/strictTuple/index.mdx | 2 +- .../src/routes/api/(schemas)/string/index.mdx | 2 +- .../src/routes/api/(schemas)/symbol/index.mdx | 2 +- .../src/routes/api/(schemas)/tuple/index.mdx | 2 +- .../api/(schemas)/tupleWithRest/index.mdx | 2 +- .../routes/api/(schemas)/undefined/index.mdx | 2 +- .../api/(schemas)/undefinedable/index.mdx | 2 +- .../src/routes/api/(schemas)/union/index.mdx | 2 +- .../routes/api/(schemas)/unknown/index.mdx | 2 +- .../src/routes/api/(schemas)/void/index.mdx | 2 +- .../index.mdx | 10 ++--- .../properties.ts | 2 +- .../index.mdx | 10 ++--- .../properties.ts | 4 +- .../index.mdx | 10 ++--- .../properties.ts | 4 +- .../api/(utils)/entriesFromList/index.mdx | 2 +- website/src/routes/api/menu.md | 18 ++++---- .../guides/(main-concepts)/schemas/index.mdx | 2 +- 146 files changed, 335 insertions(+), 335 deletions(-) delete mode 100644 library/src/schemas/objectWithPatterns/index.ts create mode 100644 library/src/schemas/recordWithPatterns/index.ts rename library/src/schemas/{objectWithPatterns/objectWithPatterns.test-d.ts => recordWithPatterns/recordWithPatterns.test-d.ts} (88%) rename library/src/schemas/{objectWithPatterns/objectWithPatterns.test.ts => recordWithPatterns/recordWithPatterns.test.ts} (91%) rename library/src/schemas/{objectWithPatterns/objectWithPatterns.ts => recordWithPatterns/recordWithPatterns.ts} (86%) rename library/src/schemas/{objectWithPatterns/objectWithPatternsAsync.test-d.ts => recordWithPatterns/recordWithPatternsAsync.test-d.ts} (87%) rename library/src/schemas/{objectWithPatterns/objectWithPatternsAsync.test.ts => recordWithPatterns/recordWithPatternsAsync.test.ts} (91%) rename library/src/schemas/{objectWithPatterns/objectWithPatternsAsync.ts => recordWithPatterns/recordWithPatternsAsync.ts} (88%) rename library/src/schemas/{objectWithPatterns => recordWithPatterns}/types.ts (69%) rename website/src/routes/api/(async)/{objectWithPatternsAsync => recordWithPatternsAsync}/index.mdx (89%) rename website/src/routes/api/(async)/{objectWithPatternsAsync => recordWithPatternsAsync}/properties.ts (91%) rename website/src/routes/api/(schemas)/{objectWithPatterns => recordWithPatterns}/index.mdx (84%) rename website/src/routes/api/(schemas)/{objectWithPatterns => recordWithPatterns}/properties.ts (89%) rename website/src/routes/api/(types)/{ObjectWithPatternsIssue => RecordWithPatternsIssue}/index.mdx (57%) rename website/src/routes/api/(types)/{ObjectWithPatternsIssue => RecordWithPatternsIssue}/properties.ts (95%) rename website/src/routes/api/(types)/{ObjectWithPatternsSchema => RecordWithPatternsSchema}/index.mdx (73%) rename website/src/routes/api/(types)/{ObjectWithPatternsSchema => RecordWithPatternsSchema}/properties.ts (92%) rename website/src/routes/api/(types)/{ObjectWithPatternsSchemaAsync => RecordWithPatternsSchemaAsync}/index.mdx (72%) rename website/src/routes/api/(types)/{ObjectWithPatternsSchemaAsync => RecordWithPatternsSchemaAsync}/properties.ts (94%) diff --git a/library/src/schemas/index.ts b/library/src/schemas/index.ts index 2bc7c940a..794cfac1b 100644 --- a/library/src/schemas/index.ts +++ b/library/src/schemas/index.ts @@ -26,7 +26,7 @@ export * from './nullable/index.ts'; export * from './nullish/index.ts'; export * from './number/index.ts'; export * from './object/index.ts'; -export * from './objectWithPatterns/index.ts'; +export * from './recordWithPatterns/index.ts'; export * from './objectWithRest/index.ts'; export * from './optional/index.ts'; export * from './picklist/index.ts'; diff --git a/library/src/schemas/objectWithPatterns/index.ts b/library/src/schemas/objectWithPatterns/index.ts deleted file mode 100644 index 6c8e12caa..000000000 --- a/library/src/schemas/objectWithPatterns/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './objectWithPatterns.ts'; -export * from './objectWithPatternsAsync.ts'; -export * from './types.ts'; diff --git a/library/src/schemas/recordWithPatterns/index.ts b/library/src/schemas/recordWithPatterns/index.ts new file mode 100644 index 000000000..66b1da8bc --- /dev/null +++ b/library/src/schemas/recordWithPatterns/index.ts @@ -0,0 +1,3 @@ +export * from './recordWithPatterns.ts'; +export * from './recordWithPatternsAsync.ts'; +export * from './types.ts'; diff --git a/library/src/schemas/objectWithPatterns/objectWithPatterns.test-d.ts b/library/src/schemas/recordWithPatterns/recordWithPatterns.test-d.ts similarity index 88% rename from library/src/schemas/objectWithPatterns/objectWithPatterns.test-d.ts rename to library/src/schemas/recordWithPatterns/recordWithPatterns.test-d.ts index 5b90c4fb9..8c07a0440 100644 --- a/library/src/schemas/objectWithPatterns/objectWithPatterns.test-d.ts +++ b/library/src/schemas/recordWithPatterns/recordWithPatterns.test-d.ts @@ -10,9 +10,9 @@ import type { NumberIssue, NumberSchema } from '../number/number.ts'; import { number } from '../number/number.ts'; import type { StringIssue, StringSchema } from '../string/string.ts'; import { string } from '../string/string.ts'; -import type { ObjectWithPatternsSchema } from './objectWithPatterns.ts'; -import { objectWithPatterns } from './objectWithPatterns.ts'; -import type { ObjectWithPatternsIssue } from './types.ts'; +import type { RecordWithPatternsSchema } from './recordWithPatterns.ts'; +import { recordWithPatterns } from './recordWithPatterns.ts'; +import type { RecordWithPatternsIssue } from './types.ts'; const FooKeySchema = custom<`foo(${string})`>( (input) => @@ -29,11 +29,11 @@ const BarKeySchema = pipe( transform((input) => input.toUpperCase() as Uppercase) ); -describe('objectWithPatterns', () => { +describe('recordWithPatterns', () => { describe('should return schema object', () => { test('without message', () => { expectTypeOf( - objectWithPatterns( + recordWithPatterns( [ [FooKeySchema, string()], [BarKeySchema, number()], @@ -41,7 +41,7 @@ describe('objectWithPatterns', () => { boolean() ) ).toEqualTypeOf< - ObjectWithPatternsSchema< + RecordWithPatternsSchema< readonly [ readonly [typeof FooKeySchema, StringSchema], readonly [typeof BarKeySchema, NumberSchema], @@ -53,7 +53,7 @@ describe('objectWithPatterns', () => { }); test('with message', () => { expectTypeOf( - objectWithPatterns( + recordWithPatterns( [ [FooKeySchema, string()], [BarKeySchema, number()], @@ -62,7 +62,7 @@ describe('objectWithPatterns', () => { 'message' ) ).toEqualTypeOf< - ObjectWithPatternsSchema< + RecordWithPatternsSchema< readonly [ readonly [typeof FooKeySchema, StringSchema], readonly [typeof BarKeySchema, NumberSchema], @@ -77,7 +77,7 @@ describe('objectWithPatterns', () => { test('of input', () => { expectTypeOf< InferInput< - ObjectWithPatternsSchema< + RecordWithPatternsSchema< readonly [ readonly [typeof FooKeySchema, StringSchema], readonly [typeof BarKeySchema, NumberSchema], @@ -96,7 +96,7 @@ describe('objectWithPatterns', () => { test('of output', () => { expectTypeOf< InferOutput< - ObjectWithPatternsSchema< + RecordWithPatternsSchema< readonly [ readonly [typeof FooKeySchema, StringSchema], readonly [typeof BarKeySchema, NumberSchema], @@ -115,7 +115,7 @@ describe('objectWithPatterns', () => { test('of issue', () => { expectTypeOf< InferIssue< - ObjectWithPatternsSchema< + RecordWithPatternsSchema< readonly [ readonly [typeof FooKeySchema, StringSchema], readonly [typeof BarKeySchema, NumberSchema], @@ -125,7 +125,7 @@ describe('objectWithPatterns', () => { > > >().toEqualTypeOf< - | ObjectWithPatternsIssue + | RecordWithPatternsIssue | CustomIssue | StringIssue | NumberIssue diff --git a/library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts b/library/src/schemas/recordWithPatterns/recordWithPatterns.test.ts similarity index 91% rename from library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts rename to library/src/schemas/recordWithPatterns/recordWithPatterns.test.ts index d16c0ecb4..e3c6a32b9 100644 --- a/library/src/schemas/objectWithPatterns/objectWithPatterns.test.ts +++ b/library/src/schemas/recordWithPatterns/recordWithPatterns.test.ts @@ -13,9 +13,9 @@ import type { FailureDataset } from '../../types/dataset.ts'; import type { InferIssue } from '../../types/infer.ts'; import { expectNoSchemaIssue } from '../../vitest/expectNoSchemaIssue.ts'; import { expectSchemaIssue } from '../../vitest/expectSchemaIssue.ts'; -import type { ObjectWithPatternsSchema } from './objectWithPatterns.ts'; -import { objectWithPatterns } from './objectWithPatterns.ts'; -import type { ObjectWithPatternsIssue } from './types.ts'; +import type { RecordWithPatternsSchema } from './recordWithPatterns.ts'; +import { recordWithPatterns } from './recordWithPatterns.ts'; +import type { RecordWithPatternsIssue } from './types.ts'; const FooKeySchema = custom<`foo(${string})`>( (input) => @@ -32,7 +32,7 @@ const BarKeySchema = pipe( transform((input) => input.toUpperCase() as Uppercase) ); -describe('objectWithPatterns', () => { +describe('recordWithPatterns', () => { describe('should return schema object', () => { const patterns = [ [FooKeySchema, string()], @@ -42,12 +42,12 @@ describe('objectWithPatterns', () => { const rest = boolean(); type Rest = typeof rest; const baseSchema: Omit< - ObjectWithPatternsSchema, + RecordWithPatternsSchema, 'message' > = { kind: 'schema', - type: 'object_with_patterns', - reference: objectWithPatterns, + type: 'record_with_patterns', + reference: recordWithPatterns, expects: 'Object', patterns, rest, @@ -60,13 +60,13 @@ describe('objectWithPatterns', () => { '~run': expect.any(Function), }; test('without message', () => { - expect(objectWithPatterns(patterns, rest)).toStrictEqual({ + expect(recordWithPatterns(patterns, rest)).toStrictEqual({ ...baseSchema, message: undefined, }); }); test('with message', () => { - expect(objectWithPatterns(patterns, rest, 'message')).toStrictEqual({ + expect(recordWithPatterns(patterns, rest, 'message')).toStrictEqual({ ...baseSchema, message: 'message', }); @@ -75,13 +75,13 @@ describe('objectWithPatterns', () => { describe('should return dataset without issues', () => { test('for empty object', () => { expectNoSchemaIssue( - objectWithPatterns([[FooKeySchema, string()]], boolean()), + recordWithPatterns([[FooKeySchema, string()]], boolean()), [{}] ); }); test('for simple object', () => { expect( - objectWithPatterns( + recordWithPatterns( [ [FooKeySchema, string()], [BarKeySchema, number()], @@ -98,14 +98,14 @@ describe('objectWithPatterns', () => { }); }); describe('should return dataset with issues', () => { - const schema = objectWithPatterns( + const schema = recordWithPatterns( [[FooKeySchema, string()]], never(), 'message' ); - const baseIssue: Omit = { + const baseIssue: Omit = { kind: 'schema', - type: 'object_with_patterns', + type: 'record_with_patterns', expected: 'Object', message: 'message', }; @@ -157,7 +157,7 @@ describe('objectWithPatterns', () => { describe('should return dataset without nested issues', () => { test('for simple object', () => { expectNoSchemaIssue( - objectWithPatterns([[FooKeySchema, string()]], boolean()), + recordWithPatterns([[FooKeySchema, string()]], boolean()), // @ts-expect-error [{ 'foo(bar)': 'foo', other: true }] ); @@ -165,7 +165,7 @@ describe('objectWithPatterns', () => { test('for nested object', () => { expectNoSchemaIssue( - objectWithPatterns( + recordWithPatterns( [[FooKeySchema, object({ key: string() })]], object({ key: number() }) ), @@ -175,7 +175,7 @@ describe('objectWithPatterns', () => { }); }); describe('should return dataset with nested issues', () => { - const schema = objectWithPatterns( + const schema = recordWithPatterns( [ [FooKeySchema, string()], [BarKeySchema, object({ key: number() })], diff --git a/library/src/schemas/objectWithPatterns/objectWithPatterns.ts b/library/src/schemas/recordWithPatterns/recordWithPatterns.ts similarity index 86% rename from library/src/schemas/objectWithPatterns/objectWithPatterns.ts rename to library/src/schemas/recordWithPatterns/recordWithPatterns.ts index e05ba1e20..cb24699df 100644 --- a/library/src/schemas/objectWithPatterns/objectWithPatterns.ts +++ b/library/src/schemas/recordWithPatterns/recordWithPatterns.ts @@ -14,7 +14,7 @@ import { _getStandardProps, _isValidObjectKey, } from '../../utils/index.ts'; -import type { ObjectWithPatternsIssue } from './types.ts'; +import type { RecordWithPatternsIssue } from './types.ts'; export type PatternTuple = readonly [ key: BaseSchema>, @@ -58,10 +58,10 @@ export type InferPatternsOutput = ? InferPatternOutput & InferPatternsOutput : never; -export interface ObjectWithPatternsSchema< +export interface RecordWithPatternsSchema< TPatterns extends PatternTuples, TRest extends BaseSchema>, - TMessage extends ErrorMessage | undefined, + TMessage extends ErrorMessage | undefined, > extends BaseSchema< Prettify> & { [key: string]: InferInput; @@ -69,16 +69,16 @@ export interface ObjectWithPatternsSchema< Prettify> & { [key: string]: InferOutput; }, - ObjectWithPatternsIssue | InferPatternsIssue | InferIssue + RecordWithPatternsIssue | InferPatternsIssue | InferIssue > { /** * The schema type. */ - readonly type: 'object_with_patterns'; + readonly type: 'record_with_patterns'; /** * The schema reference. */ - readonly reference: typeof objectWithPatterns; + readonly reference: typeof recordWithPatterns; /** * The expected property. */ @@ -98,54 +98,54 @@ export interface ObjectWithPatternsSchema< } /** - * Creates an object schema that matches patterns. + * Creates a record schema that matches patterns. * * @param patterns Pairs of key and value schemas. * @param rest Schema to use when no pattern matches. * - * @returns A object schema. + * @returns A record schema. */ -export function objectWithPatterns< +export function recordWithPatterns< const TPatterns extends PatternTuples, const TRest extends BaseSchema>, >( patterns: TPatterns, rest: TRest -): ObjectWithPatternsSchema; +): RecordWithPatternsSchema; /** - * Creates an object schema that matches patterns. + * Creates a record schema that matches patterns. * * @param patterns Pairs of key and value schemas. * @param rest Schema to use when no pattern matches. * @param message The error message. * - * @returns A object schema. + * @returns A record schema. */ -export function objectWithPatterns< +export function recordWithPatterns< const TPatterns extends PatternTuples, const TRest extends BaseSchema>, - const TMessage extends ErrorMessage | undefined, + const TMessage extends ErrorMessage | undefined, >( patterns: TPatterns, rest: TRest, message: TMessage -): ObjectWithPatternsSchema; +): RecordWithPatternsSchema; // @__NO_SIDE_EFFECTS__ -export function objectWithPatterns( +export function recordWithPatterns( patterns: PatternTuples, rest: BaseSchema>, - message?: ErrorMessage -): ObjectWithPatternsSchema< + message?: ErrorMessage +): RecordWithPatternsSchema< PatternTuples, BaseSchema>, - ErrorMessage | undefined + ErrorMessage | undefined > { return { kind: 'schema', - type: 'object_with_patterns', - reference: objectWithPatterns, + type: 'record_with_patterns', + reference: recordWithPatterns, expects: 'Object', async: false, patterns, @@ -245,7 +245,7 @@ export function objectWithPatterns( // @ts-expect-error return dataset as OutputDataset< InferPatternsOutput & { [key: string]: unknown }, - | ObjectWithPatternsIssue + | RecordWithPatternsIssue | InferPatternsIssue | BaseIssue >; diff --git a/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test-d.ts b/library/src/schemas/recordWithPatterns/recordWithPatternsAsync.test-d.ts similarity index 87% rename from library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test-d.ts rename to library/src/schemas/recordWithPatterns/recordWithPatternsAsync.test-d.ts index ee6c51031..04adf5bb7 100644 --- a/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test-d.ts +++ b/library/src/schemas/recordWithPatterns/recordWithPatternsAsync.test-d.ts @@ -3,14 +3,14 @@ import { transformAsync } from '../../actions/index.ts'; import { pipeAsync } from '../../methods/index.ts'; import type { CustomIssue, - ObjectWithPatternsIssue, - ObjectWithPatternsSchemaAsync, + RecordWithPatternsIssue, + RecordWithPatternsSchemaAsync, StringIssue, StringSchema, } from '../../schemas/index.ts'; import { customAsync, - objectWithPatternsAsync, + recordWithPatternsAsync, string, } from '../../schemas/index.ts'; import type { InferInput, InferIssue, InferOutput } from '../../types/index.ts'; @@ -32,11 +32,11 @@ const BarKeySchema = pipeAsync( ) ); -describe('objectWithPatternsAsync', () => { +describe('recordWithPatternsAsync', () => { describe('should return schema object', () => { test('without message', () => { expectTypeOf( - objectWithPatternsAsync( + recordWithPatternsAsync( [ [FooKeySchema, string()], [BarKeySchema, string()], @@ -44,7 +44,7 @@ describe('objectWithPatternsAsync', () => { string() ) ).toEqualTypeOf< - ObjectWithPatternsSchemaAsync< + RecordWithPatternsSchemaAsync< readonly [ readonly [typeof FooKeySchema, StringSchema], readonly [typeof BarKeySchema, StringSchema], @@ -57,7 +57,7 @@ describe('objectWithPatternsAsync', () => { test('with message', () => { expectTypeOf( - objectWithPatternsAsync( + recordWithPatternsAsync( [ [FooKeySchema, string()], [BarKeySchema, string()], @@ -66,7 +66,7 @@ describe('objectWithPatternsAsync', () => { 'message' ) ).toEqualTypeOf< - ObjectWithPatternsSchemaAsync< + RecordWithPatternsSchemaAsync< readonly [ readonly [typeof FooKeySchema, StringSchema], readonly [typeof BarKeySchema, StringSchema], @@ -82,7 +82,7 @@ describe('objectWithPatternsAsync', () => { test('of input', () => { expectTypeOf< InferInput< - ObjectWithPatternsSchemaAsync< + RecordWithPatternsSchemaAsync< readonly [ readonly [typeof FooKeySchema, StringSchema], readonly [typeof BarKeySchema, StringSchema], @@ -101,7 +101,7 @@ describe('objectWithPatternsAsync', () => { test('of output', () => { expectTypeOf< InferOutput< - ObjectWithPatternsSchemaAsync< + RecordWithPatternsSchemaAsync< readonly [ readonly [typeof FooKeySchema, StringSchema], readonly [typeof BarKeySchema, StringSchema], @@ -120,7 +120,7 @@ describe('objectWithPatternsAsync', () => { test('of issue', () => { expectTypeOf< InferIssue< - ObjectWithPatternsSchemaAsync< + RecordWithPatternsSchemaAsync< readonly [ readonly [typeof FooKeySchema, StringSchema], readonly [typeof BarKeySchema, StringSchema], @@ -129,7 +129,7 @@ describe('objectWithPatternsAsync', () => { undefined > > - >().toEqualTypeOf(); + >().toEqualTypeOf(); }); }); }); diff --git a/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test.ts b/library/src/schemas/recordWithPatterns/recordWithPatternsAsync.test.ts similarity index 91% rename from library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test.ts rename to library/src/schemas/recordWithPatterns/recordWithPatternsAsync.test.ts index 88bd4e4bd..12ca0eef8 100644 --- a/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.test.ts +++ b/library/src/schemas/recordWithPatterns/recordWithPatternsAsync.test.ts @@ -2,8 +2,8 @@ import { describe, expect, test } from 'vitest'; import { transformAsync } from '../../actions/index.ts'; import { pipeAsync } from '../../methods/index.ts'; import type { - ObjectWithPatternsIssue, - ObjectWithPatternsSchemaAsync, + RecordWithPatternsIssue, + RecordWithPatternsSchemaAsync, } from '../../schemas/index.ts'; import { boolean, @@ -11,7 +11,7 @@ import { never, number, objectAsync, - objectWithPatternsAsync, + recordWithPatternsAsync, string, } from '../../schemas/index.ts'; import { FailureDataset } from '../../types/dataset.ts'; @@ -38,7 +38,7 @@ const BarKeySchema = pipeAsync( ) ); -describe('objectWithPatternsAsync', () => { +describe('recordWithPatternsAsync', () => { describe('should return schema object', () => { const patterns = [ [FooKeySchema, string()], @@ -48,12 +48,12 @@ describe('objectWithPatternsAsync', () => { const rest = boolean(); type Rest = typeof rest; const baseSchema: Omit< - ObjectWithPatternsSchemaAsync, + RecordWithPatternsSchemaAsync, 'message' > = { kind: 'schema', - type: 'object_with_patterns', - reference: objectWithPatternsAsync, + type: 'record_with_patterns', + reference: recordWithPatternsAsync, expects: 'Object', patterns, rest, @@ -66,14 +66,14 @@ describe('objectWithPatternsAsync', () => { '~run': expect.any(Function), }; test('without message', () => { - expect(objectWithPatternsAsync(patterns, rest)).toStrictEqual({ + expect(recordWithPatternsAsync(patterns, rest)).toStrictEqual({ ...baseSchema, message: undefined, }); }); test('with string message', () => { - expect(objectWithPatternsAsync(patterns, rest, 'message')).toStrictEqual({ + expect(recordWithPatternsAsync(patterns, rest, 'message')).toStrictEqual({ ...baseSchema, message: 'message', }); @@ -81,7 +81,7 @@ describe('objectWithPatternsAsync', () => { test('with function message', () => { const message = () => 'message'; - expect(objectWithPatternsAsync(patterns, rest, message)).toStrictEqual({ + expect(recordWithPatternsAsync(patterns, rest, message)).toStrictEqual({ ...baseSchema, message, }); @@ -91,13 +91,13 @@ describe('objectWithPatternsAsync', () => { describe('should return dataset without issues', () => { test('for empty object', async () => { await expectNoSchemaIssueAsync( - objectWithPatternsAsync([[FooKeySchema, string()]], string()), + recordWithPatternsAsync([[FooKeySchema, string()]], string()), [{}] ); }); test('for simple object', async () => { expect( - await objectWithPatternsAsync( + await recordWithPatternsAsync( [ [FooKeySchema, string()], [BarKeySchema, number()], @@ -115,14 +115,14 @@ describe('objectWithPatternsAsync', () => { }); describe('should return dataset with issues', () => { - const schema = objectWithPatternsAsync( + const schema = recordWithPatternsAsync( [[FooKeySchema, string()]], never(), 'message' ); - const baseIssue: Omit = { + const baseIssue: Omit = { kind: 'schema', - type: 'object_with_patterns', + type: 'record_with_patterns', expected: 'Object', message: 'message', }; @@ -176,7 +176,7 @@ describe('objectWithPatternsAsync', () => { describe('should return dataset without nested issues', () => { test('for simple object', async () => { await expectNoSchemaIssueAsync( - objectWithPatternsAsync([[FooKeySchema, string()]], boolean()), + recordWithPatternsAsync([[FooKeySchema, string()]], boolean()), // @ts-expect-error [{ 'foo(bar)': 'foo', other: true }] ); @@ -184,7 +184,7 @@ describe('objectWithPatternsAsync', () => { test('for nested object', async () => { await expectNoSchemaIssueAsync( - objectWithPatternsAsync( + recordWithPatternsAsync( [[FooKeySchema, objectAsync({ key: string() })]], objectAsync({ key: number() }) ), @@ -195,7 +195,7 @@ describe('objectWithPatternsAsync', () => { }); describe('should return dataset with nested issues', () => { - const schema = objectWithPatternsAsync( + const schema = recordWithPatternsAsync( [ [FooKeySchema, string()], [BarKeySchema, objectAsync({ key: number() })], diff --git a/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.ts b/library/src/schemas/recordWithPatterns/recordWithPatternsAsync.ts similarity index 88% rename from library/src/schemas/objectWithPatterns/objectWithPatternsAsync.ts rename to library/src/schemas/recordWithPatterns/recordWithPatternsAsync.ts index a299e33f0..10a3f33d9 100644 --- a/library/src/schemas/objectWithPatterns/objectWithPatternsAsync.ts +++ b/library/src/schemas/recordWithPatterns/recordWithPatternsAsync.ts @@ -11,8 +11,8 @@ import type { Prettify, } from '../../types/index.ts'; import { _addIssue, _getStandardProps } from '../../utils/index.ts'; -import type { objectWithPatterns } from './objectWithPatterns.ts'; -import type { ObjectWithPatternsIssue } from './types.ts'; +import type { recordWithPatterns } from './recordWithPatterns.ts'; +import type { RecordWithPatternsIssue } from './types.ts'; export type PatternTupleAsync = readonly [ key: @@ -62,12 +62,12 @@ export type InferPatternsOutputAsync = ? InferPatternOutputAsync & InferPatternsOutputAsync : never; -export interface ObjectWithPatternsSchemaAsync< +export interface RecordWithPatternsSchemaAsync< TPatterns extends PatternTuplesAsync, TRest extends | BaseSchema> | BaseSchemaAsync>, - TMessage extends ErrorMessage | undefined, + TMessage extends ErrorMessage | undefined, > extends BaseSchemaAsync< Prettify> & { [key: string]: InferInput; @@ -75,20 +75,20 @@ export interface ObjectWithPatternsSchemaAsync< Prettify> & { [key: string]: InferOutput; }, - | ObjectWithPatternsIssue + | RecordWithPatternsIssue | InferPatternsIssueAsync | InferIssue > { /** * The schema type. */ - readonly type: 'object_with_patterns'; + readonly type: 'record_with_patterns'; /** * The schema reference. */ readonly reference: - | typeof objectWithPatterns - | typeof objectWithPatternsAsync; + | typeof recordWithPatterns + | typeof recordWithPatternsAsync; /** * The expected property. */ @@ -115,7 +115,7 @@ export interface ObjectWithPatternsSchemaAsync< * * @returns A object schema. */ -export function objectWithPatternsAsync< +export function recordWithPatternsAsync< const TPatterns extends PatternTuplesAsync, const TRest extends | BaseSchema> @@ -123,7 +123,7 @@ export function objectWithPatternsAsync< >( patterns: TPatterns, rest: TRest -): ObjectWithPatternsSchemaAsync; +): RecordWithPatternsSchemaAsync; /** * Creates an object schema that matches patterns. @@ -134,35 +134,35 @@ export function objectWithPatternsAsync< * * @returns A object schema. */ -export function objectWithPatternsAsync< +export function recordWithPatternsAsync< const TPatterns extends PatternTuplesAsync, const TRest extends | BaseSchema> | BaseSchemaAsync>, - const TMessage extends ErrorMessage | undefined, + const TMessage extends ErrorMessage | undefined, >( patterns: TPatterns, rest: TRest, message: TMessage -): ObjectWithPatternsSchemaAsync; +): RecordWithPatternsSchemaAsync; // @__NO_SIDE_EFFECTS__ -export function objectWithPatternsAsync( +export function recordWithPatternsAsync( patterns: PatternTuplesAsync, rest: | BaseSchema> | BaseSchemaAsync>, - message?: ErrorMessage -): ObjectWithPatternsSchemaAsync< + message?: ErrorMessage +): RecordWithPatternsSchemaAsync< PatternTuplesAsync, | BaseSchema> | BaseSchemaAsync>, - ErrorMessage | undefined + ErrorMessage | undefined > { return { kind: 'schema', - type: 'object_with_patterns', - reference: objectWithPatternsAsync, + type: 'record_with_patterns', + reference: recordWithPatternsAsync, expects: 'Object', async: true, patterns, @@ -266,7 +266,7 @@ export function objectWithPatternsAsync( InferPatternsOutputAsync & { [key: string]: unknown; }, - | ObjectWithPatternsIssue + | RecordWithPatternsIssue | InferPatternsIssueAsync | BaseIssue >; diff --git a/library/src/schemas/objectWithPatterns/types.ts b/library/src/schemas/recordWithPatterns/types.ts similarity index 69% rename from library/src/schemas/objectWithPatterns/types.ts rename to library/src/schemas/recordWithPatterns/types.ts index 873c4ee9f..0735684b3 100644 --- a/library/src/schemas/objectWithPatterns/types.ts +++ b/library/src/schemas/recordWithPatterns/types.ts @@ -1,6 +1,6 @@ import type { BaseIssue } from '../../types/index.ts'; -export interface ObjectWithPatternsIssue extends BaseIssue { +export interface RecordWithPatternsIssue extends BaseIssue { /** * The issue kind. */ @@ -8,7 +8,7 @@ export interface ObjectWithPatternsIssue extends BaseIssue { /** * The issue type. */ - readonly type: 'object_with_patterns'; + readonly type: 'record_with_patterns'; /** * The expected property. */ diff --git a/website/src/routes/api/(actions)/brand/index.mdx b/website/src/routes/api/(actions)/brand/index.mdx index 8a3d3b674..092d7184f 100644 --- a/website/src/routes/api/(actions)/brand/index.mdx +++ b/website/src/routes/api/(actions)/brand/index.mdx @@ -90,12 +90,12 @@ The following APIs can be combined with `brand`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(actions)/check/index.mdx b/website/src/routes/api/(actions)/check/index.mdx index 6e67e0711..4389f3401 100644 --- a/website/src/routes/api/(actions)/check/index.mdx +++ b/website/src/routes/api/(actions)/check/index.mdx @@ -92,12 +92,12 @@ The following APIs can be combined with `check`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(actions)/description/index.mdx b/website/src/routes/api/(actions)/description/index.mdx index 8cbad01d3..16e00b51f 100644 --- a/website/src/routes/api/(actions)/description/index.mdx +++ b/website/src/routes/api/(actions)/description/index.mdx @@ -89,12 +89,12 @@ The following APIs can be combined with `description`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(actions)/entries/index.mdx b/website/src/routes/api/(actions)/entries/index.mdx index 96b2ac5ea..192d71725 100644 --- a/website/src/routes/api/(actions)/entries/index.mdx +++ b/website/src/routes/api/(actions)/entries/index.mdx @@ -61,9 +61,9 @@ The following APIs can be combined with `entries`. items={[ 'looseObject', 'object', - 'objectWithPatterns', 'objectWithRest', 'record', + 'recordWithPatterns', 'strictObject', 'variant', ]} diff --git a/website/src/routes/api/(actions)/maxEntries/index.mdx b/website/src/routes/api/(actions)/maxEntries/index.mdx index 248ecc9c2..117d28ff3 100644 --- a/website/src/routes/api/(actions)/maxEntries/index.mdx +++ b/website/src/routes/api/(actions)/maxEntries/index.mdx @@ -66,9 +66,9 @@ The following APIs can be combined with `maxEntries`. items={[ 'looseObject', 'object', - 'objectWithPatterns', 'objectWithRest', 'record', + 'recordWithPatterns', 'strictObject', 'variant', ]} diff --git a/website/src/routes/api/(actions)/metadata/index.mdx b/website/src/routes/api/(actions)/metadata/index.mdx index 635e9c871..12291f4af 100644 --- a/website/src/routes/api/(actions)/metadata/index.mdx +++ b/website/src/routes/api/(actions)/metadata/index.mdx @@ -94,12 +94,12 @@ The following APIs can be combined with `metadata`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(actions)/minEntries/index.mdx b/website/src/routes/api/(actions)/minEntries/index.mdx index 0b7965110..49f3652f7 100644 --- a/website/src/routes/api/(actions)/minEntries/index.mdx +++ b/website/src/routes/api/(actions)/minEntries/index.mdx @@ -66,9 +66,9 @@ The following APIs can be combined with `minEntries`. items={[ 'looseObject', 'object', - 'objectWithPatterns', 'objectWithRest', 'record', + 'recordWithPatterns', 'strictObject', 'variant', ]} diff --git a/website/src/routes/api/(actions)/notEntries/index.mdx b/website/src/routes/api/(actions)/notEntries/index.mdx index 18e593bd9..d5159012a 100644 --- a/website/src/routes/api/(actions)/notEntries/index.mdx +++ b/website/src/routes/api/(actions)/notEntries/index.mdx @@ -64,9 +64,9 @@ The following APIs can be combined with `notEntries`. items={[ 'looseObject', 'object', - 'objectWithPatterns', 'objectWithRest', 'record', + 'recordWithPatterns', 'strictObject', 'variant', ]} diff --git a/website/src/routes/api/(actions)/partialCheck/index.mdx b/website/src/routes/api/(actions)/partialCheck/index.mdx index fc6bc447d..c51c0278c 100644 --- a/website/src/routes/api/(actions)/partialCheck/index.mdx +++ b/website/src/routes/api/(actions)/partialCheck/index.mdx @@ -99,9 +99,9 @@ The following APIs can be combined with `partialCheck`. 'nonNullish', 'nonOptional', 'object', - 'objectWithPatterns', 'objectWithRest', 'record', + 'recordWithPatterns', 'strictObject', 'strictTuple', 'tuple', diff --git a/website/src/routes/api/(actions)/rawCheck/index.mdx b/website/src/routes/api/(actions)/rawCheck/index.mdx index 90c0c8023..36164850e 100644 --- a/website/src/routes/api/(actions)/rawCheck/index.mdx +++ b/website/src/routes/api/(actions)/rawCheck/index.mdx @@ -115,12 +115,12 @@ The following APIs can be combined with `rawCheck`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(actions)/rawTransform/index.mdx b/website/src/routes/api/(actions)/rawTransform/index.mdx index 11429ebda..e179961ce 100644 --- a/website/src/routes/api/(actions)/rawTransform/index.mdx +++ b/website/src/routes/api/(actions)/rawTransform/index.mdx @@ -133,12 +133,12 @@ The following APIs can be combined with `rawTransform`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(actions)/readonly/index.mdx b/website/src/routes/api/(actions)/readonly/index.mdx index cc6ff019a..63accf40d 100644 --- a/website/src/routes/api/(actions)/readonly/index.mdx +++ b/website/src/routes/api/(actions)/readonly/index.mdx @@ -85,12 +85,12 @@ The following APIs can be combined with `readonly`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(actions)/returns/index.mdx b/website/src/routes/api/(actions)/returns/index.mdx index 27b282ac4..3edbfd8c3 100644 --- a/website/src/routes/api/(actions)/returns/index.mdx +++ b/website/src/routes/api/(actions)/returns/index.mdx @@ -86,12 +86,12 @@ The following APIs can be combined with `returns`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(actions)/title/index.mdx b/website/src/routes/api/(actions)/title/index.mdx index 60b4449e2..aae78dcd1 100644 --- a/website/src/routes/api/(actions)/title/index.mdx +++ b/website/src/routes/api/(actions)/title/index.mdx @@ -89,12 +89,12 @@ The following APIs can be combined with `title`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(actions)/transform/index.mdx b/website/src/routes/api/(actions)/transform/index.mdx index 378581c1a..e4901bb45 100644 --- a/website/src/routes/api/(actions)/transform/index.mdx +++ b/website/src/routes/api/(actions)/transform/index.mdx @@ -101,12 +101,12 @@ The following APIs can be combined with `transform`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(async)/arrayAsync/index.mdx b/website/src/routes/api/(async)/arrayAsync/index.mdx index bbc0bb1fd..29377e9bd 100644 --- a/website/src/routes/api/(async)/arrayAsync/index.mdx +++ b/website/src/routes/api/(async)/arrayAsync/index.mdx @@ -94,12 +94,12 @@ The following APIs can be combined with `arrayAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -178,7 +178,7 @@ The following APIs can be combined with `arrayAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/awaitAsync/index.mdx b/website/src/routes/api/(async)/awaitAsync/index.mdx index 2539b9b6f..4a154ab65 100644 --- a/website/src/routes/api/(async)/awaitAsync/index.mdx +++ b/website/src/routes/api/(async)/awaitAsync/index.mdx @@ -82,12 +82,12 @@ The following APIs can be combined with `awaitAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -126,7 +126,7 @@ The following APIs can be combined with `awaitAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'pipeAsync', diff --git a/website/src/routes/api/(async)/checkAsync/index.mdx b/website/src/routes/api/(async)/checkAsync/index.mdx index a0e1cd3c4..de70940df 100644 --- a/website/src/routes/api/(async)/checkAsync/index.mdx +++ b/website/src/routes/api/(async)/checkAsync/index.mdx @@ -95,12 +95,12 @@ The following APIs can be combined with `checkAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -140,7 +140,7 @@ The following APIs can be combined with `checkAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'pipeAsync', diff --git a/website/src/routes/api/(async)/customAsync/index.mdx b/website/src/routes/api/(async)/customAsync/index.mdx index 6acf61214..b54bf376a 100644 --- a/website/src/routes/api/(async)/customAsync/index.mdx +++ b/website/src/routes/api/(async)/customAsync/index.mdx @@ -87,10 +87,10 @@ The following APIs can be combined with `customAsync`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -239,7 +239,7 @@ The following APIs can be combined with `customAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/exactOptionalAsync/index.mdx b/website/src/routes/api/(async)/exactOptionalAsync/index.mdx index 9fde29ffc..18074c11b 100644 --- a/website/src/routes/api/(async)/exactOptionalAsync/index.mdx +++ b/website/src/routes/api/(async)/exactOptionalAsync/index.mdx @@ -130,12 +130,12 @@ The following APIs can be combined with `exactOptionalAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -200,7 +200,7 @@ The following APIs can be combined with `exactOptionalAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/fallbackAsync/index.mdx b/website/src/routes/api/(async)/fallbackAsync/index.mdx index 9246fef4c..c7b03c7f7 100644 --- a/website/src/routes/api/(async)/fallbackAsync/index.mdx +++ b/website/src/routes/api/(async)/fallbackAsync/index.mdx @@ -96,12 +96,12 @@ The following APIs can be combined with `fallbackAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -268,7 +268,7 @@ The following APIs can be combined with `fallbackAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/forwardAsync/index.mdx b/website/src/routes/api/(async)/forwardAsync/index.mdx index 9527ee34c..e81bc2193 100644 --- a/website/src/routes/api/(async)/forwardAsync/index.mdx +++ b/website/src/routes/api/(async)/forwardAsync/index.mdx @@ -81,9 +81,9 @@ The following APIs can be combined with `forwardAsync`. 'looseObject', 'looseTuple', 'object', - 'objectWithPatterns', 'objectWithRest', 'record', + 'recordWithPatterns', 'strictObject', 'strictTuple', 'tuple', @@ -140,7 +140,7 @@ The following APIs can be combined with `forwardAsync`. 'looseObjectAsync', 'looseTupleAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'partialAsync', 'partialCheckAsync', diff --git a/website/src/routes/api/(async)/getDefaultsAsync/index.mdx b/website/src/routes/api/(async)/getDefaultsAsync/index.mdx index b2728fe88..69e6ade62 100644 --- a/website/src/routes/api/(async)/getDefaultsAsync/index.mdx +++ b/website/src/routes/api/(async)/getDefaultsAsync/index.mdx @@ -99,12 +99,12 @@ The following APIs can be combined with `getDefaultsAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -158,7 +158,7 @@ The following APIs can be combined with `getDefaultsAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(async)/getFallbacksAsync/index.mdx b/website/src/routes/api/(async)/getFallbacksAsync/index.mdx index 4b96b7fdb..cfb6c55d5 100644 --- a/website/src/routes/api/(async)/getFallbacksAsync/index.mdx +++ b/website/src/routes/api/(async)/getFallbacksAsync/index.mdx @@ -97,12 +97,12 @@ The following APIs can be combined with `getFallbacksAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -156,7 +156,7 @@ The following APIs can be combined with `getFallbacksAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(async)/intersectAsync/index.mdx b/website/src/routes/api/(async)/intersectAsync/index.mdx index 841f74bfe..7d93ab77d 100644 --- a/website/src/routes/api/(async)/intersectAsync/index.mdx +++ b/website/src/routes/api/(async)/intersectAsync/index.mdx @@ -109,12 +109,12 @@ The following APIs can be combined with `intersectAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -270,7 +270,7 @@ The following APIs can be combined with `intersectAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/lazyAsync/index.mdx b/website/src/routes/api/(async)/lazyAsync/index.mdx index 6ddbca748..921b94806 100644 --- a/website/src/routes/api/(async)/lazyAsync/index.mdx +++ b/website/src/routes/api/(async)/lazyAsync/index.mdx @@ -141,12 +141,12 @@ The following APIs can be combined with `lazyAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -302,7 +302,7 @@ The following APIs can be combined with `lazyAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/looseObjectAsync/index.mdx b/website/src/routes/api/(async)/looseObjectAsync/index.mdx index 1f11d7943..a1e2e5544 100644 --- a/website/src/routes/api/(async)/looseObjectAsync/index.mdx +++ b/website/src/routes/api/(async)/looseObjectAsync/index.mdx @@ -99,12 +99,12 @@ The following APIs can be combined with `looseObjectAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -168,7 +168,7 @@ The following APIs can be combined with `looseObjectAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/looseTupleAsync/index.mdx b/website/src/routes/api/(async)/looseTupleAsync/index.mdx index 0979246e1..a27285e69 100644 --- a/website/src/routes/api/(async)/looseTupleAsync/index.mdx +++ b/website/src/routes/api/(async)/looseTupleAsync/index.mdx @@ -95,12 +95,12 @@ The following APIs can be combined with `looseTupleAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -179,7 +179,7 @@ The following APIs can be combined with `looseTupleAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/mapAsync/index.mdx b/website/src/routes/api/(async)/mapAsync/index.mdx index 7ab79371e..ae506ef21 100644 --- a/website/src/routes/api/(async)/mapAsync/index.mdx +++ b/website/src/routes/api/(async)/mapAsync/index.mdx @@ -93,12 +93,12 @@ The following APIs can be combined with `mapAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -164,7 +164,7 @@ The following APIs can be combined with `mapAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/nonNullableAsync/index.mdx b/website/src/routes/api/(async)/nonNullableAsync/index.mdx index 5a3e93a0c..2b370e761 100644 --- a/website/src/routes/api/(async)/nonNullableAsync/index.mdx +++ b/website/src/routes/api/(async)/nonNullableAsync/index.mdx @@ -98,12 +98,12 @@ The following APIs can be combined with `nonNullableAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -167,7 +167,7 @@ The following APIs can be combined with `nonNullableAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/nonNullishAsync/index.mdx b/website/src/routes/api/(async)/nonNullishAsync/index.mdx index b322ac836..911b7f203 100644 --- a/website/src/routes/api/(async)/nonNullishAsync/index.mdx +++ b/website/src/routes/api/(async)/nonNullishAsync/index.mdx @@ -94,12 +94,12 @@ The following APIs can be combined with `nonNullishAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -163,7 +163,7 @@ The following APIs can be combined with `nonNullishAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/nonOptionalAsync/index.mdx b/website/src/routes/api/(async)/nonOptionalAsync/index.mdx index cbb9f56ed..ac1bd3c8e 100644 --- a/website/src/routes/api/(async)/nonOptionalAsync/index.mdx +++ b/website/src/routes/api/(async)/nonOptionalAsync/index.mdx @@ -104,12 +104,12 @@ The following APIs can be combined with `nonOptionalAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -173,7 +173,7 @@ The following APIs can be combined with `nonOptionalAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/nullableAsync/index.mdx b/website/src/routes/api/(async)/nullableAsync/index.mdx index 82b49274c..4ab7510aa 100644 --- a/website/src/routes/api/(async)/nullableAsync/index.mdx +++ b/website/src/routes/api/(async)/nullableAsync/index.mdx @@ -118,12 +118,12 @@ The following APIs can be combined with `nullableAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -187,7 +187,7 @@ The following APIs can be combined with `nullableAsync`. 'nonOptionalAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/nullishAsync/index.mdx b/website/src/routes/api/(async)/nullishAsync/index.mdx index 84d245d30..da2d8cb11 100644 --- a/website/src/routes/api/(async)/nullishAsync/index.mdx +++ b/website/src/routes/api/(async)/nullishAsync/index.mdx @@ -151,12 +151,12 @@ The following APIs can be combined with `nullishAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -220,7 +220,7 @@ The following APIs can be combined with `nullishAsync`. 'nonOptionalAsync', 'nullableAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/objectAsync/index.mdx b/website/src/routes/api/(async)/objectAsync/index.mdx index 9454a6267..9db62fdc5 100644 --- a/website/src/routes/api/(async)/objectAsync/index.mdx +++ b/website/src/routes/api/(async)/objectAsync/index.mdx @@ -99,12 +99,12 @@ The following APIs can be combined with `objectAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -174,7 +174,7 @@ The following APIs can be combined with `objectAsync`. 'nonOptionalAsync', 'nullableAsync', 'nullishAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/objectWithRestAsync/index.mdx b/website/src/routes/api/(async)/objectWithRestAsync/index.mdx index 5493fb0ab..4d510e2c7 100644 --- a/website/src/routes/api/(async)/objectWithRestAsync/index.mdx +++ b/website/src/routes/api/(async)/objectWithRestAsync/index.mdx @@ -113,12 +113,12 @@ The following APIs can be combined with `objectWithRestAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -189,7 +189,7 @@ The following APIs can be combined with `objectWithRestAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'optionalAsync', 'parseAsync', 'parserAsync', diff --git a/website/src/routes/api/(async)/optionalAsync/index.mdx b/website/src/routes/api/(async)/optionalAsync/index.mdx index 6f0ed95b7..f406b51fe 100644 --- a/website/src/routes/api/(async)/optionalAsync/index.mdx +++ b/website/src/routes/api/(async)/optionalAsync/index.mdx @@ -151,12 +151,12 @@ The following APIs can be combined with `optionalAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -221,7 +221,7 @@ The following APIs can be combined with `optionalAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'parseAsync', 'parserAsync', diff --git a/website/src/routes/api/(async)/parseAsync/index.mdx b/website/src/routes/api/(async)/parseAsync/index.mdx index 61a9f11e3..47b79d987 100644 --- a/website/src/routes/api/(async)/parseAsync/index.mdx +++ b/website/src/routes/api/(async)/parseAsync/index.mdx @@ -96,12 +96,12 @@ The following APIs can be combined with `parseAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -160,7 +160,7 @@ The following APIs can be combined with `parseAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(async)/parserAsync/index.mdx b/website/src/routes/api/(async)/parserAsync/index.mdx index 107615d90..55842a8e8 100644 --- a/website/src/routes/api/(async)/parserAsync/index.mdx +++ b/website/src/routes/api/(async)/parserAsync/index.mdx @@ -90,12 +90,12 @@ The following APIs can be combined with `parserAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -154,7 +154,7 @@ The following APIs can be combined with `parserAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(async)/partialAsync/index.mdx b/website/src/routes/api/(async)/partialAsync/index.mdx index 8e39c4a00..f343caa87 100644 --- a/website/src/routes/api/(async)/partialAsync/index.mdx +++ b/website/src/routes/api/(async)/partialAsync/index.mdx @@ -98,10 +98,10 @@ The following APIs can be combined with `partialAsync`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -180,7 +180,7 @@ The following APIs can be combined with `partialAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/partialCheckAsync/index.mdx b/website/src/routes/api/(async)/partialCheckAsync/index.mdx index 0d09f8bfd..cfe96c1da 100644 --- a/website/src/routes/api/(async)/partialCheckAsync/index.mdx +++ b/website/src/routes/api/(async)/partialCheckAsync/index.mdx @@ -101,9 +101,9 @@ The following APIs can be combined with `partialCheckAsync`. 'nonNullish', 'nonOptional', 'object', - 'objectWithPatterns', 'objectWithRest', 'record', + 'recordWithPatterns', 'strictObject', 'strictTuple', 'tuple', @@ -133,7 +133,7 @@ The following APIs can be combined with `partialCheckAsync`. 'nonNullishAsync', 'nonOptionalAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'pipeAsync', 'recordAsync', diff --git a/website/src/routes/api/(async)/pipeAsync/index.mdx b/website/src/routes/api/(async)/pipeAsync/index.mdx index 3bcd8024d..727a60cfc 100644 --- a/website/src/routes/api/(async)/pipeAsync/index.mdx +++ b/website/src/routes/api/(async)/pipeAsync/index.mdx @@ -123,12 +123,12 @@ The following APIs can be combined with `pipeAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -309,7 +309,7 @@ The following APIs can be combined with `pipeAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/rawCheckAsync/index.mdx b/website/src/routes/api/(async)/rawCheckAsync/index.mdx index 1df260dea..5735ff2c1 100644 --- a/website/src/routes/api/(async)/rawCheckAsync/index.mdx +++ b/website/src/routes/api/(async)/rawCheckAsync/index.mdx @@ -121,12 +121,12 @@ The following APIs can be combined with `rawCheckAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -167,7 +167,7 @@ The following APIs can be combined with `rawCheckAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'pipeAsync', diff --git a/website/src/routes/api/(async)/rawTransformAsync/index.mdx b/website/src/routes/api/(async)/rawTransformAsync/index.mdx index 8c629c0d9..57ae6fcd3 100644 --- a/website/src/routes/api/(async)/rawTransformAsync/index.mdx +++ b/website/src/routes/api/(async)/rawTransformAsync/index.mdx @@ -121,12 +121,12 @@ The following APIs can be combined with `rawTransformAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -166,7 +166,7 @@ The following APIs can be combined with `rawTransformAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'pipeAsync', diff --git a/website/src/routes/api/(async)/recordAsync/index.mdx b/website/src/routes/api/(async)/recordAsync/index.mdx index 7ac54034d..6a1213669 100644 --- a/website/src/routes/api/(async)/recordAsync/index.mdx +++ b/website/src/routes/api/(async)/recordAsync/index.mdx @@ -100,12 +100,12 @@ The following APIs can be combined with `recordAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -173,7 +173,7 @@ The following APIs can be combined with `recordAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/objectWithPatternsAsync/index.mdx b/website/src/routes/api/(async)/recordWithPatternsAsync/index.mdx similarity index 89% rename from website/src/routes/api/(async)/objectWithPatternsAsync/index.mdx rename to website/src/routes/api/(async)/recordWithPatternsAsync/index.mdx index 859a89e1d..04842f412 100644 --- a/website/src/routes/api/(async)/objectWithPatternsAsync/index.mdx +++ b/website/src/routes/api/(async)/recordWithPatternsAsync/index.mdx @@ -1,7 +1,7 @@ --- -title: objectWithPatternsAsync +title: recordWithPatternsAsync description: Creates an object schema that matches patterns. -source: /schemas/objectWithPatterns/objectWithPatternsAsync.ts +source: /schemas/recordWithPatterns/recordWithPatternsAsync.ts contributors: - EskiMojo14 --- @@ -10,12 +10,12 @@ import { Link } from '@builder.io/qwik-city'; import { ApiList, Property } from '~/components'; import { properties } from './properties'; -# objectWithPatternsAsync +# recordWithPatternsAsync Creates an object schema that matches patterns. ```ts -const ObjectWithPatternsSchemaAsync = v.objectWithPatternsAsync< +const RecordWithPatternsSchemaAsync = v.recordWithPatternsAsync< TPatterns, TRest, TMessage @@ -44,10 +44,10 @@ Tuples of key and value schemas are iterated through until a key schema matches, ## Examples -The following examples show how `objectWithPatternsAsync` can be used. Please see the object guide for more examples and explanations. +The following examples show how `recordWithPatternsAsync` can be used. Please see the object guide for more examples and explanations. ```ts -const ObjectWithPatternsSchemaAsync = v.objectWithPatternsAsync( +const RecordWithPatternsSchemaAsync = v.recordWithPatternsAsync( [ [v.pipeAsync(v.string(), v.startsWith('str-')), v.string()], [v.pipeAsync(v.string(), v.startsWith('num-')), v.number()], @@ -58,7 +58,7 @@ const ObjectWithPatternsSchemaAsync = v.objectWithPatternsAsync( ## Related -The following APIs can be combined with `objectWithPatternsAsync`. +The following APIs can be combined with `recordWithPatternsAsync`. ### Schemas @@ -92,12 +92,12 @@ The following APIs can be combined with `objectWithPatternsAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(async)/objectWithPatternsAsync/properties.ts b/website/src/routes/api/(async)/recordWithPatternsAsync/properties.ts similarity index 91% rename from website/src/routes/api/(async)/objectWithPatternsAsync/properties.ts rename to website/src/routes/api/(async)/recordWithPatternsAsync/properties.ts index 224d09036..5b253dfbf 100644 --- a/website/src/routes/api/(async)/objectWithPatternsAsync/properties.ts +++ b/website/src/routes/api/(async)/recordWithPatternsAsync/properties.ts @@ -59,8 +59,8 @@ export const properties: Record = { generics: [ { type: 'custom', - name: 'ObjectWithPatternsIssue', - href: '../ObjectWithPatternsIssue/', + name: 'RecordWithPatternsIssue', + href: '../RecordWithPatternsIssue/', }, ], }, @@ -89,8 +89,8 @@ export const properties: Record = { Schema: { type: { type: 'custom', - name: 'ObjectWithPatternsSchemaAsync', - href: '../ObjectWithPatternsSchemaAsync/', + name: 'RecordWithPatternsSchemaAsync', + href: '../RecordWithPatternsSchemaAsync/', generics: [ { type: 'custom', diff --git a/website/src/routes/api/(async)/requiredAsync/index.mdx b/website/src/routes/api/(async)/requiredAsync/index.mdx index b4f0fce6d..067bd08c1 100644 --- a/website/src/routes/api/(async)/requiredAsync/index.mdx +++ b/website/src/routes/api/(async)/requiredAsync/index.mdx @@ -104,10 +104,10 @@ The following APIs can be combined with `requiredAsync`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -186,7 +186,7 @@ The following APIs can be combined with `requiredAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/returnsAsync/index.mdx b/website/src/routes/api/(async)/returnsAsync/index.mdx index 4eab85e04..de99ff8d5 100644 --- a/website/src/routes/api/(async)/returnsAsync/index.mdx +++ b/website/src/routes/api/(async)/returnsAsync/index.mdx @@ -100,12 +100,12 @@ The following APIs can be combined with `returnsAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -147,7 +147,7 @@ The following APIs can be combined with `returnsAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'pipeAsync', diff --git a/website/src/routes/api/(async)/safeParseAsync/index.mdx b/website/src/routes/api/(async)/safeParseAsync/index.mdx index 1b936f8c4..beefc15ad 100644 --- a/website/src/routes/api/(async)/safeParseAsync/index.mdx +++ b/website/src/routes/api/(async)/safeParseAsync/index.mdx @@ -89,12 +89,12 @@ The following APIs can be combined with `safeParseAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -153,7 +153,7 @@ The following APIs can be combined with `safeParseAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(async)/safeParserAsync/index.mdx b/website/src/routes/api/(async)/safeParserAsync/index.mdx index 70bb5ad64..100f49ba8 100644 --- a/website/src/routes/api/(async)/safeParserAsync/index.mdx +++ b/website/src/routes/api/(async)/safeParserAsync/index.mdx @@ -90,12 +90,12 @@ The following APIs can be combined with `safeParserAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -154,7 +154,7 @@ The following APIs can be combined with `safeParserAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(async)/setAsync/index.mdx b/website/src/routes/api/(async)/setAsync/index.mdx index 96c3c755e..7e928f76f 100644 --- a/website/src/routes/api/(async)/setAsync/index.mdx +++ b/website/src/routes/api/(async)/setAsync/index.mdx @@ -92,12 +92,12 @@ The following APIs can be combined with `setAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'strictObject', 'strictTuple', 'string', @@ -163,7 +163,7 @@ The following APIs can be combined with `setAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/strictObjectAsync/index.mdx b/website/src/routes/api/(async)/strictObjectAsync/index.mdx index 68a81fdaf..ee6c5c680 100644 --- a/website/src/routes/api/(async)/strictObjectAsync/index.mdx +++ b/website/src/routes/api/(async)/strictObjectAsync/index.mdx @@ -99,12 +99,12 @@ The following APIs can be combined with `strictObjectAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -175,7 +175,7 @@ The following APIs can be combined with `strictObjectAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/strictTupleAsync/index.mdx b/website/src/routes/api/(async)/strictTupleAsync/index.mdx index b8a240734..25d97006d 100644 --- a/website/src/routes/api/(async)/strictTupleAsync/index.mdx +++ b/website/src/routes/api/(async)/strictTupleAsync/index.mdx @@ -96,12 +96,12 @@ The following APIs can be combined with `strictTupleAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'string', @@ -180,7 +180,7 @@ The following APIs can be combined with `strictTupleAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/transformAsync/index.mdx b/website/src/routes/api/(async)/transformAsync/index.mdx index e07dd0b15..de08b2d6d 100644 --- a/website/src/routes/api/(async)/transformAsync/index.mdx +++ b/website/src/routes/api/(async)/transformAsync/index.mdx @@ -88,12 +88,12 @@ The following APIs can be combined with `transformAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -133,7 +133,7 @@ The following APIs can be combined with `transformAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'pipeAsync', diff --git a/website/src/routes/api/(async)/tupleAsync/index.mdx b/website/src/routes/api/(async)/tupleAsync/index.mdx index 4171755be..8e99c6646 100644 --- a/website/src/routes/api/(async)/tupleAsync/index.mdx +++ b/website/src/routes/api/(async)/tupleAsync/index.mdx @@ -96,12 +96,12 @@ The following APIs can be combined with `tupleAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -180,7 +180,7 @@ The following APIs can be combined with `tupleAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/tupleWithRestAsync/index.mdx b/website/src/routes/api/(async)/tupleWithRestAsync/index.mdx index 5e9c0a2b7..694ffe522 100644 --- a/website/src/routes/api/(async)/tupleWithRestAsync/index.mdx +++ b/website/src/routes/api/(async)/tupleWithRestAsync/index.mdx @@ -103,12 +103,12 @@ The following APIs can be combined with `tupleWithRestAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -187,7 +187,7 @@ The following APIs can be combined with `tupleWithRestAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/undefinedableAsync/index.mdx b/website/src/routes/api/(async)/undefinedableAsync/index.mdx index a591ca52f..3fab15af1 100644 --- a/website/src/routes/api/(async)/undefinedableAsync/index.mdx +++ b/website/src/routes/api/(async)/undefinedableAsync/index.mdx @@ -153,12 +153,12 @@ The following APIs can be combined with `undefinedableAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -223,7 +223,7 @@ The following APIs can be combined with `undefinedableAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/unionAsync/index.mdx b/website/src/routes/api/(async)/unionAsync/index.mdx index 481588a8f..ee49c0fb4 100644 --- a/website/src/routes/api/(async)/unionAsync/index.mdx +++ b/website/src/routes/api/(async)/unionAsync/index.mdx @@ -102,12 +102,12 @@ The following APIs can be combined with `unionAsync`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -263,7 +263,7 @@ The following APIs can be combined with `unionAsync`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(async)/variantAsync/index.mdx b/website/src/routes/api/(async)/variantAsync/index.mdx index 1e0c4227c..5983d1efa 100644 --- a/website/src/routes/api/(async)/variantAsync/index.mdx +++ b/website/src/routes/api/(async)/variantAsync/index.mdx @@ -161,7 +161,7 @@ The following APIs can be combined with `variantAsync`. 'getFallbacksAsync', 'looseObjectAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'parseAsync', 'parserAsync', diff --git a/website/src/routes/api/(methods)/assert/index.mdx b/website/src/routes/api/(methods)/assert/index.mdx index ef6aaaf7d..0892b354f 100644 --- a/website/src/routes/api/(methods)/assert/index.mdx +++ b/website/src/routes/api/(methods)/assert/index.mdx @@ -81,12 +81,12 @@ The following APIs can be combined with `assert`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(methods)/config/index.mdx b/website/src/routes/api/(methods)/config/index.mdx index 8bcf1f869..0cf64c948 100644 --- a/website/src/routes/api/(methods)/config/index.mdx +++ b/website/src/routes/api/(methods)/config/index.mdx @@ -103,12 +103,12 @@ The following APIs can be combined with `config`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -283,7 +283,7 @@ The following APIs can be combined with `config`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(methods)/fallback/index.mdx b/website/src/routes/api/(methods)/fallback/index.mdx index 128a05b66..beb431e5f 100644 --- a/website/src/routes/api/(methods)/fallback/index.mdx +++ b/website/src/routes/api/(methods)/fallback/index.mdx @@ -102,12 +102,12 @@ The following APIs can be combined with `fallback`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(methods)/forward/index.mdx b/website/src/routes/api/(methods)/forward/index.mdx index 069e268d1..715316178 100644 --- a/website/src/routes/api/(methods)/forward/index.mdx +++ b/website/src/routes/api/(methods)/forward/index.mdx @@ -84,9 +84,9 @@ The following APIs can be combined with `forward`. 'looseObject', 'looseTuple', 'object', - 'objectWithPatterns', 'objectWithRest', 'record', + 'recordWithPatterns', 'strictObject', 'strictTuple', 'tuple', diff --git a/website/src/routes/api/(methods)/getDefault/index.mdx b/website/src/routes/api/(methods)/getDefault/index.mdx index fc008ae6b..640eb6558 100644 --- a/website/src/routes/api/(methods)/getDefault/index.mdx +++ b/website/src/routes/api/(methods)/getDefault/index.mdx @@ -80,12 +80,12 @@ The following APIs can be combined with `getDefault`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -139,7 +139,7 @@ The following APIs can be combined with `getDefault`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(methods)/getDefaults/index.mdx b/website/src/routes/api/(methods)/getDefaults/index.mdx index 52a35f4bc..bb6a43dd4 100644 --- a/website/src/routes/api/(methods)/getDefaults/index.mdx +++ b/website/src/routes/api/(methods)/getDefaults/index.mdx @@ -94,12 +94,12 @@ The following APIs can be combined with `getDefaults`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(methods)/getFallback/index.mdx b/website/src/routes/api/(methods)/getFallback/index.mdx index 8186ea23a..364b92684 100644 --- a/website/src/routes/api/(methods)/getFallback/index.mdx +++ b/website/src/routes/api/(methods)/getFallback/index.mdx @@ -80,12 +80,12 @@ The following APIs can be combined with `getFallback`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -139,7 +139,7 @@ The following APIs can be combined with `getFallback`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(methods)/getFallbacks/index.mdx b/website/src/routes/api/(methods)/getFallbacks/index.mdx index c9950f3fa..0d55a76e8 100644 --- a/website/src/routes/api/(methods)/getFallbacks/index.mdx +++ b/website/src/routes/api/(methods)/getFallbacks/index.mdx @@ -94,12 +94,12 @@ The following APIs can be combined with `getFallbacks`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(methods)/is/index.mdx b/website/src/routes/api/(methods)/is/index.mdx index 683fb8a43..41920d795 100644 --- a/website/src/routes/api/(methods)/is/index.mdx +++ b/website/src/routes/api/(methods)/is/index.mdx @@ -86,12 +86,12 @@ The following APIs can be combined with `is`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(methods)/keyof/index.mdx b/website/src/routes/api/(methods)/keyof/index.mdx index ec6eef4b5..fe778b285 100644 --- a/website/src/routes/api/(methods)/keyof/index.mdx +++ b/website/src/routes/api/(methods)/keyof/index.mdx @@ -65,10 +65,10 @@ The following APIs can be combined with `keyof`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -140,7 +140,7 @@ The following APIs can be combined with `keyof`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(methods)/message/index.mdx b/website/src/routes/api/(methods)/message/index.mdx index 00ea1eec9..8991c8c82 100644 --- a/website/src/routes/api/(methods)/message/index.mdx +++ b/website/src/routes/api/(methods)/message/index.mdx @@ -86,12 +86,12 @@ The following APIs can be combined with `message`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -267,7 +267,7 @@ The following APIs can be combined with `message`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'partialAsync', diff --git a/website/src/routes/api/(methods)/omit/index.mdx b/website/src/routes/api/(methods)/omit/index.mdx index 6df5d7764..380c3e9e4 100644 --- a/website/src/routes/api/(methods)/omit/index.mdx +++ b/website/src/routes/api/(methods)/omit/index.mdx @@ -80,10 +80,10 @@ The following APIs can be combined with `omit`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -166,7 +166,7 @@ The following APIs can be combined with `omit`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(methods)/parse/index.mdx b/website/src/routes/api/(methods)/parse/index.mdx index c905e2ae5..c4526236d 100644 --- a/website/src/routes/api/(methods)/parse/index.mdx +++ b/website/src/routes/api/(methods)/parse/index.mdx @@ -87,12 +87,12 @@ The following APIs can be combined with `parse`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(methods)/parser/index.mdx b/website/src/routes/api/(methods)/parser/index.mdx index e61e8268c..9ebfd0c96 100644 --- a/website/src/routes/api/(methods)/parser/index.mdx +++ b/website/src/routes/api/(methods)/parser/index.mdx @@ -83,12 +83,12 @@ The following APIs can be combined with `parser`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(methods)/partial/index.mdx b/website/src/routes/api/(methods)/partial/index.mdx index 3ee695cf0..5d8e2850b 100644 --- a/website/src/routes/api/(methods)/partial/index.mdx +++ b/website/src/routes/api/(methods)/partial/index.mdx @@ -93,10 +93,10 @@ The following APIs can be combined with `partial`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(methods)/pick/index.mdx b/website/src/routes/api/(methods)/pick/index.mdx index 39f43724f..b9ef0796e 100644 --- a/website/src/routes/api/(methods)/pick/index.mdx +++ b/website/src/routes/api/(methods)/pick/index.mdx @@ -80,10 +80,10 @@ The following APIs can be combined with `pick`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', @@ -166,7 +166,7 @@ The following APIs can be combined with `pick`. 'nullableAsync', 'nullishAsync', 'objectAsync', - 'objectWithPatternsAsync', + 'recordWithPatternsAsync', 'objectWithRestAsync', 'optionalAsync', 'parseAsync', diff --git a/website/src/routes/api/(methods)/pipe/index.mdx b/website/src/routes/api/(methods)/pipe/index.mdx index aee0d1876..35b340288 100644 --- a/website/src/routes/api/(methods)/pipe/index.mdx +++ b/website/src/routes/api/(methods)/pipe/index.mdx @@ -105,12 +105,12 @@ The following APIs can be combined with `pipe`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(methods)/required/index.mdx b/website/src/routes/api/(methods)/required/index.mdx index 67f689691..41c694a46 100644 --- a/website/src/routes/api/(methods)/required/index.mdx +++ b/website/src/routes/api/(methods)/required/index.mdx @@ -102,10 +102,10 @@ The following APIs can be combined with `required`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(methods)/safeParse/index.mdx b/website/src/routes/api/(methods)/safeParse/index.mdx index 1da35ddfa..a00a11217 100644 --- a/website/src/routes/api/(methods)/safeParse/index.mdx +++ b/website/src/routes/api/(methods)/safeParse/index.mdx @@ -82,12 +82,12 @@ The following APIs can be combined with `safeParse`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(methods)/safeParser/index.mdx b/website/src/routes/api/(methods)/safeParser/index.mdx index 09fa3d796..c7b4b0e9b 100644 --- a/website/src/routes/api/(methods)/safeParser/index.mdx +++ b/website/src/routes/api/(methods)/safeParser/index.mdx @@ -83,12 +83,12 @@ The following APIs can be combined with `safeParser`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/any/index.mdx b/website/src/routes/api/(schemas)/any/index.mdx index d5440f332..da6bedb7c 100644 --- a/website/src/routes/api/(schemas)/any/index.mdx +++ b/website/src/routes/api/(schemas)/any/index.mdx @@ -48,10 +48,10 @@ The following APIs can be combined with `any`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/array/index.mdx b/website/src/routes/api/(schemas)/array/index.mdx index f1f89d5d2..4731d3b2d 100644 --- a/website/src/routes/api/(schemas)/array/index.mdx +++ b/website/src/routes/api/(schemas)/array/index.mdx @@ -118,12 +118,12 @@ The following APIs can be combined with `array`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/bigint/index.mdx b/website/src/routes/api/(schemas)/bigint/index.mdx index f8f166bc5..f1e9463f1 100644 --- a/website/src/routes/api/(schemas)/bigint/index.mdx +++ b/website/src/routes/api/(schemas)/bigint/index.mdx @@ -75,10 +75,10 @@ The following APIs can be combined with `bigint`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/blob/index.mdx b/website/src/routes/api/(schemas)/blob/index.mdx index b0f2de9a5..a1f1b5aac 100644 --- a/website/src/routes/api/(schemas)/blob/index.mdx +++ b/website/src/routes/api/(schemas)/blob/index.mdx @@ -72,10 +72,10 @@ The following APIs can be combined with `blob`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/boolean/index.mdx b/website/src/routes/api/(schemas)/boolean/index.mdx index baf375cd2..bc938aa77 100644 --- a/website/src/routes/api/(schemas)/boolean/index.mdx +++ b/website/src/routes/api/(schemas)/boolean/index.mdx @@ -71,10 +71,10 @@ The following APIs can be combined with `boolean`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/custom/index.mdx b/website/src/routes/api/(schemas)/custom/index.mdx index d2f277e5e..d24fd957c 100644 --- a/website/src/routes/api/(schemas)/custom/index.mdx +++ b/website/src/routes/api/(schemas)/custom/index.mdx @@ -76,10 +76,10 @@ The following APIs can be combined with `custom`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/date/index.mdx b/website/src/routes/api/(schemas)/date/index.mdx index 8a5d4b5ab..7f363e927 100644 --- a/website/src/routes/api/(schemas)/date/index.mdx +++ b/website/src/routes/api/(schemas)/date/index.mdx @@ -80,10 +80,10 @@ The following APIs can be combined with `date`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/enum/index.mdx b/website/src/routes/api/(schemas)/enum/index.mdx index 549ca8914..371e243b6 100644 --- a/website/src/routes/api/(schemas)/enum/index.mdx +++ b/website/src/routes/api/(schemas)/enum/index.mdx @@ -73,10 +73,10 @@ The following APIs can be combined with `enum`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/exactOptional/index.mdx b/website/src/routes/api/(schemas)/exactOptional/index.mdx index bb6ad84b4..cae2ca761 100644 --- a/website/src/routes/api/(schemas)/exactOptional/index.mdx +++ b/website/src/routes/api/(schemas)/exactOptional/index.mdx @@ -100,12 +100,12 @@ The following APIs can be combined with `exactOptional`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/file/index.mdx b/website/src/routes/api/(schemas)/file/index.mdx index 873bac3d4..acfc0de55 100644 --- a/website/src/routes/api/(schemas)/file/index.mdx +++ b/website/src/routes/api/(schemas)/file/index.mdx @@ -72,10 +72,10 @@ The following APIs can be combined with `file`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/function/index.mdx b/website/src/routes/api/(schemas)/function/index.mdx index 6646bf2dc..45ac4b6c4 100644 --- a/website/src/routes/api/(schemas)/function/index.mdx +++ b/website/src/routes/api/(schemas)/function/index.mdx @@ -54,10 +54,10 @@ The following APIs can be combined with `function`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/instance/index.mdx b/website/src/routes/api/(schemas)/instance/index.mdx index 3016103dc..535f47050 100644 --- a/website/src/routes/api/(schemas)/instance/index.mdx +++ b/website/src/routes/api/(schemas)/instance/index.mdx @@ -81,10 +81,10 @@ The following APIs can be combined with `instance`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/intersect/index.mdx b/website/src/routes/api/(schemas)/intersect/index.mdx index 3abe20a88..b8b4bf0a0 100644 --- a/website/src/routes/api/(schemas)/intersect/index.mdx +++ b/website/src/routes/api/(schemas)/intersect/index.mdx @@ -90,12 +90,12 @@ The following APIs can be combined with `intersect`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/lazy/index.mdx b/website/src/routes/api/(schemas)/lazy/index.mdx index e97030742..5b08843a2 100644 --- a/website/src/routes/api/(schemas)/lazy/index.mdx +++ b/website/src/routes/api/(schemas)/lazy/index.mdx @@ -153,12 +153,12 @@ The following APIs can be combined with `lazy`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/literal/index.mdx b/website/src/routes/api/(schemas)/literal/index.mdx index a7ca78a13..8a556edf3 100644 --- a/website/src/routes/api/(schemas)/literal/index.mdx +++ b/website/src/routes/api/(schemas)/literal/index.mdx @@ -84,10 +84,10 @@ The following APIs can be combined with `literal`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/looseObject/index.mdx b/website/src/routes/api/(schemas)/looseObject/index.mdx index cd1f828cd..d5952e161 100644 --- a/website/src/routes/api/(schemas)/looseObject/index.mdx +++ b/website/src/routes/api/(schemas)/looseObject/index.mdx @@ -129,12 +129,12 @@ The following APIs can be combined with `looseObject`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/looseTuple/index.mdx b/website/src/routes/api/(schemas)/looseTuple/index.mdx index e9800a8ec..e31497634 100644 --- a/website/src/routes/api/(schemas)/looseTuple/index.mdx +++ b/website/src/routes/api/(schemas)/looseTuple/index.mdx @@ -85,12 +85,12 @@ The following APIs can be combined with `looseTuple`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/map/index.mdx b/website/src/routes/api/(schemas)/map/index.mdx index 2d9c49760..74f8cb04f 100644 --- a/website/src/routes/api/(schemas)/map/index.mdx +++ b/website/src/routes/api/(schemas)/map/index.mdx @@ -92,12 +92,12 @@ The following APIs can be combined with `map`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/nan/index.mdx b/website/src/routes/api/(schemas)/nan/index.mdx index 0464ea02e..3bf8f6e2c 100644 --- a/website/src/routes/api/(schemas)/nan/index.mdx +++ b/website/src/routes/api/(schemas)/nan/index.mdx @@ -54,10 +54,10 @@ The following APIs can be combined with `nan`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/never/index.mdx b/website/src/routes/api/(schemas)/never/index.mdx index 057e91ae1..91ddd76ab 100644 --- a/website/src/routes/api/(schemas)/never/index.mdx +++ b/website/src/routes/api/(schemas)/never/index.mdx @@ -54,10 +54,10 @@ The following APIs can be combined with `never`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/nonNullable/index.mdx b/website/src/routes/api/(schemas)/nonNullable/index.mdx index 5e4e8888f..b4de0c4e2 100644 --- a/website/src/routes/api/(schemas)/nonNullable/index.mdx +++ b/website/src/routes/api/(schemas)/nonNullable/index.mdx @@ -94,12 +94,12 @@ The following APIs can be combined with `nonNullable`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/nonNullish/index.mdx b/website/src/routes/api/(schemas)/nonNullish/index.mdx index 0a63f0131..c6e4a82cc 100644 --- a/website/src/routes/api/(schemas)/nonNullish/index.mdx +++ b/website/src/routes/api/(schemas)/nonNullish/index.mdx @@ -94,12 +94,12 @@ The following APIs can be combined with `nonNullish`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/nonOptional/index.mdx b/website/src/routes/api/(schemas)/nonOptional/index.mdx index 60be5458d..4b73affb1 100644 --- a/website/src/routes/api/(schemas)/nonOptional/index.mdx +++ b/website/src/routes/api/(schemas)/nonOptional/index.mdx @@ -94,12 +94,12 @@ The following APIs can be combined with `nonOptional`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/null/index.mdx b/website/src/routes/api/(schemas)/null/index.mdx index 1e911973a..9351bb64a 100644 --- a/website/src/routes/api/(schemas)/null/index.mdx +++ b/website/src/routes/api/(schemas)/null/index.mdx @@ -54,10 +54,10 @@ The following APIs can be combined with `null`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/nullable/index.mdx b/website/src/routes/api/(schemas)/nullable/index.mdx index c909f5cd8..1a801f0fa 100644 --- a/website/src/routes/api/(schemas)/nullable/index.mdx +++ b/website/src/routes/api/(schemas)/nullable/index.mdx @@ -115,12 +115,12 @@ The following APIs can be combined with `nullable`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/nullish/index.mdx b/website/src/routes/api/(schemas)/nullish/index.mdx index 6b78e3cff..a3293d12e 100644 --- a/website/src/routes/api/(schemas)/nullish/index.mdx +++ b/website/src/routes/api/(schemas)/nullish/index.mdx @@ -115,12 +115,12 @@ The following APIs can be combined with `nullish`. 'nullable', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/number/index.mdx b/website/src/routes/api/(schemas)/number/index.mdx index 203016a60..312617aa9 100644 --- a/website/src/routes/api/(schemas)/number/index.mdx +++ b/website/src/routes/api/(schemas)/number/index.mdx @@ -83,10 +83,10 @@ The following APIs can be combined with `number`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/object/index.mdx b/website/src/routes/api/(schemas)/object/index.mdx index 6a3d161c3..301cb0fa0 100644 --- a/website/src/routes/api/(schemas)/object/index.mdx +++ b/website/src/routes/api/(schemas)/object/index.mdx @@ -129,12 +129,12 @@ The following APIs can be combined with `object`. 'nullable', 'nullish', 'number', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/objectWithRest/index.mdx b/website/src/routes/api/(schemas)/objectWithRest/index.mdx index 3c9054f8e..b7eb8ca43 100644 --- a/website/src/routes/api/(schemas)/objectWithRest/index.mdx +++ b/website/src/routes/api/(schemas)/objectWithRest/index.mdx @@ -148,11 +148,11 @@ The following APIs can be combined with `objectWithRest`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/optional/index.mdx b/website/src/routes/api/(schemas)/optional/index.mdx index 7e13c74c5..d4c1ed1dd 100644 --- a/website/src/routes/api/(schemas)/optional/index.mdx +++ b/website/src/routes/api/(schemas)/optional/index.mdx @@ -116,11 +116,11 @@ The following APIs can be combined with `optional`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/picklist/index.mdx b/website/src/routes/api/(schemas)/picklist/index.mdx index c2cb89168..376662e31 100644 --- a/website/src/routes/api/(schemas)/picklist/index.mdx +++ b/website/src/routes/api/(schemas)/picklist/index.mdx @@ -90,10 +90,10 @@ The following APIs can be combined with `picklist`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/promise/index.mdx b/website/src/routes/api/(schemas)/promise/index.mdx index 59bd1622a..a2a1fd2a8 100644 --- a/website/src/routes/api/(schemas)/promise/index.mdx +++ b/website/src/routes/api/(schemas)/promise/index.mdx @@ -70,10 +70,10 @@ The following APIs can be combined with `promise`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/record/index.mdx b/website/src/routes/api/(schemas)/record/index.mdx index e249681e8..f4a852c67 100644 --- a/website/src/routes/api/(schemas)/record/index.mdx +++ b/website/src/routes/api/(schemas)/record/index.mdx @@ -128,7 +128,6 @@ The following APIs can be combined with `record`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', diff --git a/website/src/routes/api/(schemas)/objectWithPatterns/index.mdx b/website/src/routes/api/(schemas)/recordWithPatterns/index.mdx similarity index 84% rename from website/src/routes/api/(schemas)/objectWithPatterns/index.mdx rename to website/src/routes/api/(schemas)/recordWithPatterns/index.mdx index fc3e51bd0..840629d9d 100644 --- a/website/src/routes/api/(schemas)/objectWithPatterns/index.mdx +++ b/website/src/routes/api/(schemas)/recordWithPatterns/index.mdx @@ -1,7 +1,7 @@ --- -title: objectWithPatterns -description: Creates an object with patterns schema. -source: /schemas/objectWithPatterns/objectWithPatterns.ts +title: recordWithPatterns +description: Creates a record schema that matches patterns. +source: /schemas/recordWithPatterns/recordWithPatterns.ts contributors: - EskiMojo14 --- @@ -10,12 +10,12 @@ import { Link } from '@builder.io/qwik-city'; import { ApiList, Property } from '~/components'; import { properties } from './properties'; -# objectWithPatterns +# recordWithPatterns -Creates an object schema that matches patterns. +Creates a record schema that matches patterns. ```ts -const ObjectWithPatternsSchema = v.objectWithPatterns< +const RecordWithPatternsSchema = v.recordWithPatterns< TPatterns, TRest, TMessage @@ -44,10 +44,10 @@ Tuples of key and value schemas are iterated through until a key schema matches, ## Examples -The following examples show how `objectWithPatterns` can be used. Please see the object guide for more examples and explanations. +The following examples show how `recordWithPatterns` can be used. Please see the object guide for more examples and explanations. ```ts -const ObjectWithPatternsSchema = v.objectWithPatterns( +const RecordWithPatternsSchema = v.recordWithPatterns( [ [v.pipe(v.string(), v.startsWith('str-')), v.string()], [v.pipe(v.string(), v.startsWith('num-')), v.number()], @@ -58,7 +58,7 @@ const ObjectWithPatternsSchema = v.objectWithPatterns( ## Related -The following APIs can be combined with `objectWithPatterns`. +The following APIs can be combined with `recordWithPatterns`. ### Schemas @@ -97,6 +97,7 @@ The following APIs can be combined with `objectWithPatterns`. 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/objectWithPatterns/properties.ts b/website/src/routes/api/(schemas)/recordWithPatterns/properties.ts similarity index 89% rename from website/src/routes/api/(schemas)/objectWithPatterns/properties.ts rename to website/src/routes/api/(schemas)/recordWithPatterns/properties.ts index ef397a929..8ec7f8838 100644 --- a/website/src/routes/api/(schemas)/objectWithPatterns/properties.ts +++ b/website/src/routes/api/(schemas)/recordWithPatterns/properties.ts @@ -39,8 +39,8 @@ export const properties: Record = { generics: [ { type: 'custom', - name: 'ObjectWithPatternsIssue', - href: '../ObjectWithPatternsIssue/', + name: 'RecordWithPatternsIssue', + href: '../RecordWithPatternsIssue/', }, ], }, @@ -69,8 +69,8 @@ export const properties: Record = { Schema: { type: { type: 'custom', - name: 'ObjectWithPatternsSchema', - href: '../ObjectWithPatternsSchema/', + name: 'RecordWithPatternsSchema', + href: '../RecordWithPatternsSchema/', generics: [ { type: 'custom', diff --git a/website/src/routes/api/(schemas)/set/index.mdx b/website/src/routes/api/(schemas)/set/index.mdx index bc040390b..42f3b98ba 100644 --- a/website/src/routes/api/(schemas)/set/index.mdx +++ b/website/src/routes/api/(schemas)/set/index.mdx @@ -91,12 +91,12 @@ The following APIs can be combined with `set`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'strictObject', 'strictTuple', 'string', diff --git a/website/src/routes/api/(schemas)/strictObject/index.mdx b/website/src/routes/api/(schemas)/strictObject/index.mdx index 330dddd1c..a5b96c5da 100644 --- a/website/src/routes/api/(schemas)/strictObject/index.mdx +++ b/website/src/routes/api/(schemas)/strictObject/index.mdx @@ -130,12 +130,12 @@ The following APIs can be combined with `strictObject`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictTuple', 'string', diff --git a/website/src/routes/api/(schemas)/strictTuple/index.mdx b/website/src/routes/api/(schemas)/strictTuple/index.mdx index 1536f3ce7..f8fa812c3 100644 --- a/website/src/routes/api/(schemas)/strictTuple/index.mdx +++ b/website/src/routes/api/(schemas)/strictTuple/index.mdx @@ -86,12 +86,12 @@ The following APIs can be combined with `strictTuple`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'string', diff --git a/website/src/routes/api/(schemas)/string/index.mdx b/website/src/routes/api/(schemas)/string/index.mdx index 77fdd2266..5478a84f5 100644 --- a/website/src/routes/api/(schemas)/string/index.mdx +++ b/website/src/routes/api/(schemas)/string/index.mdx @@ -101,10 +101,10 @@ The following APIs can be combined with `string`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/symbol/index.mdx b/website/src/routes/api/(schemas)/symbol/index.mdx index d4a3ac8d6..3bb80afd2 100644 --- a/website/src/routes/api/(schemas)/symbol/index.mdx +++ b/website/src/routes/api/(schemas)/symbol/index.mdx @@ -67,10 +67,10 @@ The following APIs can be combined with `symbol`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/tuple/index.mdx b/website/src/routes/api/(schemas)/tuple/index.mdx index c15800a51..2f04f16b3 100644 --- a/website/src/routes/api/(schemas)/tuple/index.mdx +++ b/website/src/routes/api/(schemas)/tuple/index.mdx @@ -86,12 +86,12 @@ The following APIs can be combined with `tuple`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/tupleWithRest/index.mdx b/website/src/routes/api/(schemas)/tupleWithRest/index.mdx index 376acf074..04692bca9 100644 --- a/website/src/routes/api/(schemas)/tupleWithRest/index.mdx +++ b/website/src/routes/api/(schemas)/tupleWithRest/index.mdx @@ -89,12 +89,12 @@ The following APIs can be combined with `tupleWithRest`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/undefined/index.mdx b/website/src/routes/api/(schemas)/undefined/index.mdx index 4a4ea3eae..2370eb391 100644 --- a/website/src/routes/api/(schemas)/undefined/index.mdx +++ b/website/src/routes/api/(schemas)/undefined/index.mdx @@ -54,10 +54,10 @@ The following APIs can be combined with `undefined`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/undefinedable/index.mdx b/website/src/routes/api/(schemas)/undefinedable/index.mdx index c8fc0d9c6..23a1a8028 100644 --- a/website/src/routes/api/(schemas)/undefinedable/index.mdx +++ b/website/src/routes/api/(schemas)/undefinedable/index.mdx @@ -120,11 +120,11 @@ The following APIs can be combined with `undefinedable`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/union/index.mdx b/website/src/routes/api/(schemas)/union/index.mdx index 98535c37e..63458900b 100644 --- a/website/src/routes/api/(schemas)/union/index.mdx +++ b/website/src/routes/api/(schemas)/union/index.mdx @@ -107,12 +107,12 @@ The following APIs can be combined with `union`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/unknown/index.mdx b/website/src/routes/api/(schemas)/unknown/index.mdx index af1f2f871..559604c05 100644 --- a/website/src/routes/api/(schemas)/unknown/index.mdx +++ b/website/src/routes/api/(schemas)/unknown/index.mdx @@ -49,10 +49,10 @@ The following APIs can be combined with `unknown`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(schemas)/void/index.mdx b/website/src/routes/api/(schemas)/void/index.mdx index f25bcb3bf..d0bf80cd4 100644 --- a/website/src/routes/api/(schemas)/void/index.mdx +++ b/website/src/routes/api/(schemas)/void/index.mdx @@ -54,10 +54,10 @@ The following APIs can be combined with `void`. 'nullable', 'nullish', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/(types)/ObjectWithPatternsIssue/index.mdx b/website/src/routes/api/(types)/RecordWithPatternsIssue/index.mdx similarity index 57% rename from website/src/routes/api/(types)/ObjectWithPatternsIssue/index.mdx rename to website/src/routes/api/(types)/RecordWithPatternsIssue/index.mdx index cc8754ad2..b1f524de1 100644 --- a/website/src/routes/api/(types)/ObjectWithPatternsIssue/index.mdx +++ b/website/src/routes/api/(types)/RecordWithPatternsIssue/index.mdx @@ -1,6 +1,6 @@ --- -title: ObjectWithPatternsIssue -description: Object with patterns issue interface. +title: RecordWithPatternsIssue +description: Record with patterns issue interface. contributors: - EskiMojo14 --- @@ -8,13 +8,13 @@ contributors: import { Property } from '~/components'; import { properties } from './properties'; -# ObjectWithPatternsIssue +# RecordWithPatternsIssue -Object with patterns issue interface. +Record with patterns issue interface. ## Definition -- `ObjectWithPatternsIssue` +- `RecordWithPatternsIssue` - `kind` - `type` - `expected` diff --git a/website/src/routes/api/(types)/ObjectWithPatternsIssue/properties.ts b/website/src/routes/api/(types)/RecordWithPatternsIssue/properties.ts similarity index 95% rename from website/src/routes/api/(types)/ObjectWithPatternsIssue/properties.ts rename to website/src/routes/api/(types)/RecordWithPatternsIssue/properties.ts index 54b9cde6c..513c87736 100644 --- a/website/src/routes/api/(types)/ObjectWithPatternsIssue/properties.ts +++ b/website/src/routes/api/(types)/RecordWithPatternsIssue/properties.ts @@ -19,7 +19,7 @@ export const properties: Record = { type: { type: { type: 'string', - value: 'object_with_patterns', + value: 'record_with_patterns', }, }, expected: { diff --git a/website/src/routes/api/(types)/ObjectWithPatternsSchema/index.mdx b/website/src/routes/api/(types)/RecordWithPatternsSchema/index.mdx similarity index 73% rename from website/src/routes/api/(types)/ObjectWithPatternsSchema/index.mdx rename to website/src/routes/api/(types)/RecordWithPatternsSchema/index.mdx index c1e41a151..f2d4c3e6c 100644 --- a/website/src/routes/api/(types)/ObjectWithPatternsSchema/index.mdx +++ b/website/src/routes/api/(types)/RecordWithPatternsSchema/index.mdx @@ -1,6 +1,6 @@ --- -title: ObjectWithPatternsSchema -description: Object with patterns schema interface. +title: RecordWithPatternsSchema +description: Record with patterns schema interface. contributors: - EskiMojo14 --- @@ -8,9 +8,9 @@ contributors: import { Property } from '~/components'; import { properties } from './properties'; -# ObjectWithPatternsSchema +# RecordWithPatternsSchema -Object with patterns schema interface. +Record with patterns schema interface. ## Generics @@ -20,7 +20,7 @@ Object with patterns schema interface. ## Definition -- `ObjectWithPatternsSchema` +- `RecordWithPatternsSchema` - `type` - `reference` - `expects` diff --git a/website/src/routes/api/(types)/ObjectWithPatternsSchema/properties.ts b/website/src/routes/api/(types)/RecordWithPatternsSchema/properties.ts similarity index 92% rename from website/src/routes/api/(types)/ObjectWithPatternsSchema/properties.ts rename to website/src/routes/api/(types)/RecordWithPatternsSchema/properties.ts index 4e16f0b4e..afe711802 100644 --- a/website/src/routes/api/(types)/ObjectWithPatternsSchema/properties.ts +++ b/website/src/routes/api/(types)/RecordWithPatternsSchema/properties.ts @@ -39,8 +39,8 @@ export const properties: Record = { generics: [ { type: 'custom', - name: 'ObjectWithPatternsIssue', - href: '../ObjectWithPatternsIssue/', + name: 'RecordWithPatternsIssue', + href: '../RecordWithPatternsIssue/', }, ], }, diff --git a/website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/index.mdx b/website/src/routes/api/(types)/RecordWithPatternsSchemaAsync/index.mdx similarity index 72% rename from website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/index.mdx rename to website/src/routes/api/(types)/RecordWithPatternsSchemaAsync/index.mdx index d2ffd2979..85a090e23 100644 --- a/website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/index.mdx +++ b/website/src/routes/api/(types)/RecordWithPatternsSchemaAsync/index.mdx @@ -1,6 +1,6 @@ --- -title: ObjectWithPatternsSchemaAsync -description: Object with patterns schema async interface. +title: RecordWithPatternsSchemaAsync +description: Record with patterns schema async interface. contributors: - EskiMojo14 --- @@ -8,9 +8,9 @@ contributors: import { Property } from '~/components'; import { properties } from './properties'; -# ObjectWithPatternsSchemaAsync +# RecordWithPatternsSchemaAsync -Object with patterns schema async interface. +Record with patterns schema async interface. ## Generics @@ -20,7 +20,7 @@ Object with patterns schema async interface. ## Definition -- `ObjectWithPatternsSchemaAsync` +- `RecordWithPatternsSchemaAsync` - `type` - `reference` - `expects` diff --git a/website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/properties.ts b/website/src/routes/api/(types)/RecordWithPatternsSchemaAsync/properties.ts similarity index 94% rename from website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/properties.ts rename to website/src/routes/api/(types)/RecordWithPatternsSchemaAsync/properties.ts index 9754d123c..dac34b403 100644 --- a/website/src/routes/api/(types)/ObjectWithPatternsSchemaAsync/properties.ts +++ b/website/src/routes/api/(types)/RecordWithPatternsSchemaAsync/properties.ts @@ -59,8 +59,8 @@ export const properties: Record = { generics: [ { type: 'custom', - name: 'ObjectWithPatternsIssue', - href: '../ObjectWithPatternsIssue/', + name: 'RecordWithPatternsIssue', + href: '../RecordWithPatternsIssue/', }, ], }, diff --git a/website/src/routes/api/(utils)/entriesFromList/index.mdx b/website/src/routes/api/(utils)/entriesFromList/index.mdx index 68f5b5716..3757ffbdf 100644 --- a/website/src/routes/api/(utils)/entriesFromList/index.mdx +++ b/website/src/routes/api/(utils)/entriesFromList/index.mdx @@ -76,12 +76,12 @@ The following APIs can be combined with `entriesFromList`. 'nullish', 'number', 'object', - 'objectWithPatterns', 'objectWithRest', 'optional', 'picklist', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple', diff --git a/website/src/routes/api/menu.md b/website/src/routes/api/menu.md index 591660f01..bf80aefc8 100644 --- a/website/src/routes/api/menu.md +++ b/website/src/routes/api/menu.md @@ -30,12 +30,12 @@ - [nullish](/api/nullish/) - [number](/api/number/) - [object](/api/object/) -- [objectWithPatterns](/api/objectWithPatterns/) - [objectWithRest](/api/objectWithRest/) - [optional](/api/optional/) - [picklist](/api/picklist/) - [promise](/api/promise/) - [record](/api/record/) +- [recordWithPatterns](/api/recordWithPatterns/) - [set](/api/set/) - [strictObject](/api/strictObject/) - [strictTuple](/api/strictTuple/) @@ -231,7 +231,6 @@ - [nullableAsync](/api/nullableAsync/) - [nullishAsync](/api/nullishAsync/) - [objectAsync](/api/objectAsync/) -- [objectWithPatternsAsync](/api/objectWithPatternsAsync/) - [objectWithRestAsync](/api/objectWithRestAsync/) - [optionalAsync](/api/optionalAsync/) - [parseAsync](/api/parseAsync/) @@ -242,6 +241,7 @@ - [rawCheckAsync](/api/rawCheckAsync/) - [rawTransformAsync](/api/rawTransformAsync/) - [recordAsync](/api/recordAsync/) +- [recordWithPatternsAsync](/api/recordWithPatternsAsync/) - [requiredAsync](/api/requiredAsync/) - [returnsAsync](/api/returnsAsync/) - [safeParseAsync](/api/safeParseAsync/) @@ -558,18 +558,11 @@ - [ObjectPathItem](/api/ObjectPathItem/) - [ObjectSchema](/api/ObjectSchema/) - [ObjectSchemaAsync](/api/ObjectSchemaAsync/) -- [ObjectWithPatternsIssue](/api/ObjectWithPatternsIssue/) -- [ObjectWithPatternsSchema](/api/ObjectWithPatternsSchema/) -- [ObjectWithPatternsSchemaAsync](/api/ObjectWithPatternsSchemaAsync/) - [ObjectWithRestIssue](/api/ObjectWithRestIssue/) - [ObjectWithRestSchema](/api/ObjectWithRestSchema/) - [ObjectWithRestSchemaAsync](/api/ObjectWithRestSchemaAsync/) - [OctalAction](/api/OctalAction/) - [OctalIssue](/api/OctalIssue/) -- [PatternTuple](/api/PatternTuple/) -- [PatternTupleAsync](/api/PatternTupleAsync/) -- [PatternTuples](/api/PatternTuples/) -- [PatternTuplesAsync](/api/PatternTuplesAsync/) - [OptionalSchema](/api/OptionalSchema/) - [OptionalSchemaAsync](/api/OptionalSchemaAsync/) - [OutputDataset](/api/OutputDataset/) @@ -580,6 +573,10 @@ - [PartialCheckIssue](/api/PartialCheckIssue/) - [PartialDataset](/api/PartialDataset/) - [PartialInput](/api/PartialInput/) +- [PatternTuple](/api/PatternTuple/) +- [PatternTupleAsync](/api/PatternTupleAsync/) +- [PatternTuples](/api/PatternTuples/) +- [PatternTuplesAsync](/api/PatternTuplesAsync/) - [PicklistOptions](/api/PicklistOptions/) - [PicklistIssue](/api/PicklistIssue/) - [PicklistSchema](/api/PicklistSchema/) @@ -599,6 +596,9 @@ - [RecordIssue](/api/RecordIssue/) - [RecordSchema](/api/RecordSchema/) - [RecordSchemaAsync](/api/RecordSchemaAsync/) +- [RecordWithPatternsIssue](/api/RecordWithPatternsIssue/) +- [RecordWithPatternsSchema](/api/RecordWithPatternsSchema/) +- [RecordWithPatternsSchemaAsync](/api/RecordWithPatternsSchemaAsync/) - [ReduceItemsAction](/api/ReduceItemsAction/) - [RegexAction](/api/RegexAction/) - [RegexIssue](/api/RegexIssue/) diff --git a/website/src/routes/guides/(main-concepts)/schemas/index.mdx b/website/src/routes/guides/(main-concepts)/schemas/index.mdx index 956b947c0..79599942f 100644 --- a/website/src/routes/guides/(main-concepts)/schemas/index.mdx +++ b/website/src/routes/guides/(main-concepts)/schemas/index.mdx @@ -66,10 +66,10 @@ Among complex values, Valibot supports objects, records, arrays, tuples, and sev 'looseTuple', 'map', 'object', - 'objectWithPatterns', 'objectWithRest', 'promise', 'record', + 'recordWithPatterns', 'set', 'strictObject', 'strictTuple',