@piying/view-angular-core 1.7.2 → 1.7.3

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.
@@ -0,0 +1,52 @@
1
+ import * as v from 'valibot';
2
+ import { JsonSchemaDraft202012Object } from '@hyperjump/json-schema/draft-2020-12';
3
+
4
+ type JSType = NonNullable<Exclude<JsonSchemaDraft202012Object['type'], any[]>>;
5
+ type ResolvedSchema = v.BaseSchema<any, any, any> | v.SchemaWithPipe<readonly [
6
+ v.BaseSchema<any, any, any>,
7
+ ...(v.BaseSchema<any, any, any> | v.PipeAction<any, any, v.BaseIssue<unknown>>)[]
8
+ ]>;
9
+ interface JSONSchemaRaw extends JsonSchemaDraft202012Object {
10
+ actions?: {
11
+ name: string;
12
+ params: any[];
13
+ }[];
14
+ }
15
+ interface JSONSchemaNoRef extends JSONSchemaRaw {
16
+ __resolved: {
17
+ hasRef: boolean;
18
+ };
19
+ }
20
+ type ResolvedJsonSchema = JSONSchemaNoRef & {
21
+ __resolved: {
22
+ type: {
23
+ types: Extract<JsonSchemaDraft202012Object['type'], any[]>;
24
+ optional: boolean;
25
+ };
26
+ isResolved: boolean;
27
+ };
28
+ };
29
+ /** 合并schema
30
+ * 子级需要解析
31
+ */
32
+ interface TypeHandle {
33
+ afterResolve: (type: string, jSchema: any, vSchema: ResolvedSchema) => ResolvedSchema | undefined;
34
+ }
35
+ interface J2VOptions {
36
+ customActions?: Record<string, (...args: any[]) => v.BaseMetadata<any> | v.BaseValidation<any, any, any>>;
37
+ schemaHandle?: {
38
+ type?: TypeHandle;
39
+ afterResolve?: (jSchema: ResolvedJsonSchema, vSchema: ResolvedSchema) => ResolvedSchema | undefined;
40
+ };
41
+ }
42
+ declare function jsonSchemaToValibot(schema: JSONSchemaRaw, options?: J2VOptions): ResolvedSchema;
43
+ declare class JsonSchemaToValibot {
44
+ #private;
45
+ root: JSONSchemaRaw;
46
+ private cacheSchema;
47
+ constructor(root: JSONSchemaRaw, options?: J2VOptions);
48
+ convert(): ResolvedSchema;
49
+ }
50
+
51
+ export { JsonSchemaToValibot, jsonSchemaToValibot };
52
+ export type { JSType, TypeHandle };