@arrirpc/schema 0.70.1 → 0.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import { Type } from '@arrirpc/type-defs';
2
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
3
 
3
4
  declare function sanitizeJson(json: string): string;
4
5
  /**
@@ -73,7 +74,7 @@ interface SchemaMetadata<T> {
73
74
  isDeprecated?: boolean;
74
75
  [SCHEMA_METADATA]: SchemaValidator<T>;
75
76
  }
76
- interface ASchema<T = any> {
77
+ interface ASchema<T = any> extends StandardSchemaV1<T> {
77
78
  metadata: SchemaMetadata<T>;
78
79
  nullable?: boolean;
79
80
  }
@@ -88,7 +89,7 @@ type ResolveObject<T> = Resolve<{
88
89
  [k in keyof T]: T[k];
89
90
  }>;
90
91
  type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
91
- type InferType<TInput extends ASchema<any>> = Resolve<TInput["metadata"][typeof SCHEMA_METADATA]["output"]>;
92
+ type InferType<TInput extends ASchema<any>> = Resolve<TInput['metadata'][typeof SCHEMA_METADATA]['output']>;
92
93
  /**
93
94
  * Infer a specific subtype of a discriminated union.
94
95
  * In order for this to work you must first infer the union type using `a.infer`
@@ -157,7 +158,7 @@ interface AObjectSchemaOptions<TAdditionalProps extends boolean = false> extends
157
158
  }
158
159
  type InferObjectOutput<TInput = any> = ResolveObject<InferObjectRawType<TInput>>;
159
160
  type InferObjectRawType<TInput> = TInput extends Record<any, any> ? {
160
- [TKey in keyof TInput]: TInput[TKey]["metadata"][typeof SCHEMA_METADATA]["optional"] extends true ? TInput[TKey]["metadata"][typeof SCHEMA_METADATA]["output"] | undefined : TInput[TKey]["metadata"][typeof SCHEMA_METADATA]["output"];
161
+ [TKey in keyof TInput]: TInput[TKey]['metadata'][typeof SCHEMA_METADATA]['optional'] extends true ? TInput[TKey]['metadata'][typeof SCHEMA_METADATA]['output'] | undefined : TInput[TKey]['metadata'][typeof SCHEMA_METADATA]['output'];
161
162
  } : never;
162
163
  declare function isObject(input: unknown): input is Record<any, any>;
163
164
  interface ARefSchema<T> extends ASchema<T> {
@@ -1,4 +1,5 @@
1
1
  import { Type } from '@arrirpc/type-defs';
2
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
3
 
3
4
  declare function sanitizeJson(json: string): string;
4
5
  /**
@@ -73,7 +74,7 @@ interface SchemaMetadata<T> {
73
74
  isDeprecated?: boolean;
74
75
  [SCHEMA_METADATA]: SchemaValidator<T>;
75
76
  }
76
- interface ASchema<T = any> {
77
+ interface ASchema<T = any> extends StandardSchemaV1<T> {
77
78
  metadata: SchemaMetadata<T>;
78
79
  nullable?: boolean;
79
80
  }
@@ -88,7 +89,7 @@ type ResolveObject<T> = Resolve<{
88
89
  [k in keyof T]: T[k];
89
90
  }>;
90
91
  type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
91
- type InferType<TInput extends ASchema<any>> = Resolve<TInput["metadata"][typeof SCHEMA_METADATA]["output"]>;
92
+ type InferType<TInput extends ASchema<any>> = Resolve<TInput['metadata'][typeof SCHEMA_METADATA]['output']>;
92
93
  /**
93
94
  * Infer a specific subtype of a discriminated union.
94
95
  * In order for this to work you must first infer the union type using `a.infer`
@@ -157,7 +158,7 @@ interface AObjectSchemaOptions<TAdditionalProps extends boolean = false> extends
157
158
  }
158
159
  type InferObjectOutput<TInput = any> = ResolveObject<InferObjectRawType<TInput>>;
159
160
  type InferObjectRawType<TInput> = TInput extends Record<any, any> ? {
160
- [TKey in keyof TInput]: TInput[TKey]["metadata"][typeof SCHEMA_METADATA]["optional"] extends true ? TInput[TKey]["metadata"][typeof SCHEMA_METADATA]["output"] | undefined : TInput[TKey]["metadata"][typeof SCHEMA_METADATA]["output"];
161
+ [TKey in keyof TInput]: TInput[TKey]['metadata'][typeof SCHEMA_METADATA]['optional'] extends true ? TInput[TKey]['metadata'][typeof SCHEMA_METADATA]['output'] | undefined : TInput[TKey]['metadata'][typeof SCHEMA_METADATA]['output'];
161
162
  } : never;
162
163
  declare function isObject(input: unknown): input is Record<any, any>;
163
164
  interface ARefSchema<T> extends ASchema<T> {
@@ -1,4 +1,5 @@
1
1
  import { Type } from '@arrirpc/type-defs';
2
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
3
 
3
4
  declare function sanitizeJson(json: string): string;
4
5
  /**
@@ -73,7 +74,7 @@ interface SchemaMetadata<T> {
73
74
  isDeprecated?: boolean;
74
75
  [SCHEMA_METADATA]: SchemaValidator<T>;
75
76
  }
76
- interface ASchema<T = any> {
77
+ interface ASchema<T = any> extends StandardSchemaV1<T> {
77
78
  metadata: SchemaMetadata<T>;
78
79
  nullable?: boolean;
79
80
  }
@@ -88,7 +89,7 @@ type ResolveObject<T> = Resolve<{
88
89
  [k in keyof T]: T[k];
89
90
  }>;
90
91
  type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
91
- type InferType<TInput extends ASchema<any>> = Resolve<TInput["metadata"][typeof SCHEMA_METADATA]["output"]>;
92
+ type InferType<TInput extends ASchema<any>> = Resolve<TInput['metadata'][typeof SCHEMA_METADATA]['output']>;
92
93
  /**
93
94
  * Infer a specific subtype of a discriminated union.
94
95
  * In order for this to work you must first infer the union type using `a.infer`
@@ -157,7 +158,7 @@ interface AObjectSchemaOptions<TAdditionalProps extends boolean = false> extends
157
158
  }
158
159
  type InferObjectOutput<TInput = any> = ResolveObject<InferObjectRawType<TInput>>;
159
160
  type InferObjectRawType<TInput> = TInput extends Record<any, any> ? {
160
- [TKey in keyof TInput]: TInput[TKey]["metadata"][typeof SCHEMA_METADATA]["optional"] extends true ? TInput[TKey]["metadata"][typeof SCHEMA_METADATA]["output"] | undefined : TInput[TKey]["metadata"][typeof SCHEMA_METADATA]["output"];
161
+ [TKey in keyof TInput]: TInput[TKey]['metadata'][typeof SCHEMA_METADATA]['optional'] extends true ? TInput[TKey]['metadata'][typeof SCHEMA_METADATA]['output'] | undefined : TInput[TKey]['metadata'][typeof SCHEMA_METADATA]['output'];
161
162
  } : never;
162
163
  declare function isObject(input: unknown): input is Record<any, any>;
163
164
  interface ARefSchema<T> extends ASchema<T> {