@lssm/lib.schema 1.42.9 → 1.43.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.
package/README.md CHANGED
@@ -33,8 +33,16 @@ import { SchemaModel, ScalarTypeEnum } from '@lssm/lib.schema';
33
33
  - `SchemaModel` composes fields into named object models with helpers:
34
34
  - `getZod()` → typed `z.ZodObject` preserving each field's schema and optionality
35
35
  - `getPothosInput()` → builder name for input object
36
+ - `getPothosInput()` → builder name for input object
36
37
  - `getJsonSchema()` → resolved JSON Schema
37
38
 
39
+ ### Multi-Format Wrappers
40
+
41
+ Use existing schema definitions from other libraries:
42
+ - `ZodSchemaType`: Wraps a raw Zod schema (`z.infer` becomes the TS type).
43
+ - `JsonSchemaType`: Wraps a JSON Schema object.
44
+ - `GraphQLSchemaType`: Wraps a GraphQL SDL string.
45
+
38
46
  ### Enums
39
47
 
40
48
  - `EnumType<T>` represents string enums with a single source of truth:
@@ -1,4 +1,4 @@
1
- import * as z from "zod";
1
+ import * as z$1 from "zod";
2
2
  import { GraphQLEnumType } from "graphql";
3
3
 
4
4
  //#region src/EnumType.d.ts
@@ -18,7 +18,7 @@ declare class EnumType<T extends [string, ...string[]]> {
18
18
  /** GraphQL enum instance suitable for Pothos or vanilla GraphQL schemas. */
19
19
  getPothos(): GraphQLEnumType;
20
20
  /** zod schema representing this enum. */
21
- getZod(): z.ZodEnum<{ [K in T[number]]: K }>;
21
+ getZod(): z$1.ZodEnum<{ [K in T[number]]: K }>;
22
22
  /** Minimal JSON representation (alias of getJsonSchema). */
23
23
  getJson(): {
24
24
  type: 'string';
@@ -1 +1 @@
1
- {"version":3,"file":"EnumType.d.ts","names":[],"sources":["../src/EnumType.ts"],"sourcesContent":[],"mappings":";;;;;;;AAMA;AAKoC,cALvB,QAKuB,CAAA,UAAA,CAAA,MAAA,EAAA,GAAA,MAAA,EAAA,CAAA,CAAA,CAAA;EAejB,iBAAA,IAAA;EAMJ,iBAAA,MAAA;EAKe,iBAAA,OAAA;EAAY,WAAA,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EA1BN,CA0BM;EAA5B;EAKuB,OAAA,CAAA,CAAA,EAAA,MAAA;EAKM;EAAC,aAAA,CAAA,CAAA,EArBzB,CAqByB;EAKhC;EAOC,SAAA,CAAA,CAAA,EA3BE,eA8BgB;EADrB;EAAC,MAAA,CAAA,CAAA,EAxBC,CAAA,CAAE,OAwBH,CAAA,QAxBmB,CAwBnB,CAAA,MAAA,CAAA,GAxB+B,CAwB/B,EAAA,CAAA;;;;UAnB0B;;;;;UAKM;;;KAK/B,WAAA,GAAc;;;;;;cAOb,oEAEH,MAAC,SAAA"}
1
+ {"version":3,"file":"EnumType.d.ts","names":[],"sources":["../src/EnumType.ts"],"sourcesContent":[],"mappings":";;;;;;;AAMA;AAKoC,cALvB,QAKuB,CAAA,UAAA,CAAA,MAAA,EAAA,GAAA,MAAA,EAAA,CAAA,CAAA,CAAA;EAejB,iBAAA,IAAA;EAMJ,iBAAA,MAAA;EAKe,iBAAA,OAAA;EAAY,WAAA,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EA1BN,CA0BM;EAA9B;EAKyB,OAAA,CAAA,CAAA,EAAA,MAAA;EAKM;EAAC,aAAA,CAAA,CAAA,EArBzB,CAqByB;EAKhC;EAOC,SAAA,CAAA,CAAA,EA3BE,eA8BgB;EADrB;EAAC,MAAA,CAAA,CAAA,EAxBC,GAAA,CAAE,OAwBH,CAAA,QAxBmB,CAwBnB,CAAA,MAAA,CAAA,GAxB+B,CAwB/B,EAAA,CAAA;;;;UAnB0B;;;;;UAKM;;;KAK/B,WAAA,GAAc;;;;;;cAOb,oEAEH,MAAC,SAAA"}
package/dist/EnumType.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as z from "zod";
1
+ import * as z$1 from "zod";
2
2
  import { GraphQLEnumType } from "graphql";
3
3
 
4
4
  //#region src/EnumType.ts
@@ -31,7 +31,7 @@ var EnumType = class {
31
31
  }
32
32
  /** zod schema representing this enum. */
33
33
  getZod() {
34
- return z.enum(this.values);
34
+ return z$1.enum(this.values);
35
35
  }
36
36
  /** Minimal JSON representation (alias of getJsonSchema). */
37
37
  getJson() {
@@ -1 +1 @@
1
- {"version":3,"file":"EnumType.js","names":[],"sources":["../src/EnumType.ts"],"sourcesContent":["import * as z from 'zod';\nimport { GraphQLEnumType } from 'graphql';\n\n/**\n * Strongly-typed string enum wrapper with one source of truth for zod, GraphQL, and JSON Schema.\n */\nexport class EnumType<T extends [string, ...string[]]> {\n private readonly name: string;\n private readonly values: T;\n private readonly gqlEnum: GraphQLEnumType;\n\n constructor(name: string, values: T) {\n this.name = name;\n this.values = values;\n this.gqlEnum = new GraphQLEnumType({\n name: this.name,\n values: Object.fromEntries(values.map((v) => [v, { value: v }] as const)),\n });\n }\n\n /** Enum type name (used by GraphQL and JSON Schema). */\n getName(): string {\n return this.name;\n }\n\n /** Returns the literal tuple of allowed values. */\n getEnumValues(): T {\n return this.values;\n }\n\n // For SchemaModel and adapters expecting a Pothos/GraphQL type-like object\n /** GraphQL enum instance suitable for Pothos or vanilla GraphQL schemas. */\n getPothos(): GraphQLEnumType {\n return this.gqlEnum;\n }\n\n /** zod schema representing this enum. */\n getZod(): z.ZodEnum<{ [K in T[number]]: K }> {\n return z.enum(this.values);\n }\n\n /** Minimal JSON representation (alias of getJsonSchema). */\n getJson(): { type: 'string'; enum: T } {\n return { type: 'string', enum: this.values } as const;\n }\n\n /** JSON Schema for this enum. */\n getJsonSchema(): { type: 'string'; enum: T } {\n return this.getJson();\n }\n}\n\nexport type AnyEnumType = EnumType<[string, ...string[]]>;\n\n/**\n * Helper to define an EnumType.\n * @param name Display/type name used across GraphQL and JSON Schema\n * @param values Literal tuple of allowed string values (at least one)\n */\nexport const defineEnum = <T extends [string, ...string[]]>(\n name: string,\n values: T\n) => new EnumType(name, values);\n"],"mappings":";;;;;;;AAMA,IAAa,WAAb,MAAuD;CACrD,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,YAAY,MAAc,QAAW;AACnC,OAAK,OAAO;AACZ,OAAK,SAAS;AACd,OAAK,UAAU,IAAI,gBAAgB;GACjC,MAAM,KAAK;GACX,QAAQ,OAAO,YAAY,OAAO,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,CAAC,CAAU,CAAC;GAC1E,CAAC;;;CAIJ,UAAkB;AAChB,SAAO,KAAK;;;CAId,gBAAmB;AACjB,SAAO,KAAK;;;CAKd,YAA6B;AAC3B,SAAO,KAAK;;;CAId,SAA6C;AAC3C,SAAO,EAAE,KAAK,KAAK,OAAO;;;CAI5B,UAAuC;AACrC,SAAO;GAAE,MAAM;GAAU,MAAM,KAAK;GAAQ;;;CAI9C,gBAA6C;AAC3C,SAAO,KAAK,SAAS;;;;;;;;AAWzB,MAAa,cACX,MACA,WACG,IAAI,SAAS,MAAM,OAAO"}
1
+ {"version":3,"file":"EnumType.js","names":["z"],"sources":["../src/EnumType.ts"],"sourcesContent":["import * as z from 'zod';\nimport { GraphQLEnumType } from 'graphql';\n\n/**\n * Strongly-typed string enum wrapper with one source of truth for zod, GraphQL, and JSON Schema.\n */\nexport class EnumType<T extends [string, ...string[]]> {\n private readonly name: string;\n private readonly values: T;\n private readonly gqlEnum: GraphQLEnumType;\n\n constructor(name: string, values: T) {\n this.name = name;\n this.values = values;\n this.gqlEnum = new GraphQLEnumType({\n name: this.name,\n values: Object.fromEntries(values.map((v) => [v, { value: v }] as const)),\n });\n }\n\n /** Enum type name (used by GraphQL and JSON Schema). */\n getName(): string {\n return this.name;\n }\n\n /** Returns the literal tuple of allowed values. */\n getEnumValues(): T {\n return this.values;\n }\n\n // For SchemaModel and adapters expecting a Pothos/GraphQL type-like object\n /** GraphQL enum instance suitable for Pothos or vanilla GraphQL schemas. */\n getPothos(): GraphQLEnumType {\n return this.gqlEnum;\n }\n\n /** zod schema representing this enum. */\n getZod(): z.ZodEnum<{ [K in T[number]]: K }> {\n return z.enum(this.values);\n }\n\n /** Minimal JSON representation (alias of getJsonSchema). */\n getJson(): { type: 'string'; enum: T } {\n return { type: 'string', enum: this.values } as const;\n }\n\n /** JSON Schema for this enum. */\n getJsonSchema(): { type: 'string'; enum: T } {\n return this.getJson();\n }\n}\n\nexport type AnyEnumType = EnumType<[string, ...string[]]>;\n\n/**\n * Helper to define an EnumType.\n * @param name Display/type name used across GraphQL and JSON Schema\n * @param values Literal tuple of allowed string values (at least one)\n */\nexport const defineEnum = <T extends [string, ...string[]]>(\n name: string,\n values: T\n) => new EnumType(name, values);\n"],"mappings":";;;;;;;AAMA,IAAa,WAAb,MAAuD;CACrD,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,YAAY,MAAc,QAAW;AACnC,OAAK,OAAO;AACZ,OAAK,SAAS;AACd,OAAK,UAAU,IAAI,gBAAgB;GACjC,MAAM,KAAK;GACX,QAAQ,OAAO,YAAY,OAAO,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,CAAC,CAAU,CAAC;GAC1E,CAAC;;;CAIJ,UAAkB;AAChB,SAAO,KAAK;;;CAId,gBAAmB;AACjB,SAAO,KAAK;;;CAKd,YAA6B;AAC3B,SAAO,KAAK;;;CAId,SAA6C;AAC3C,SAAOA,IAAE,KAAK,KAAK,OAAO;;;CAI5B,UAAuC;AACrC,SAAO;GAAE,MAAM;GAAU,MAAM,KAAK;GAAQ;;;CAI9C,gBAA6C;AAC3C,SAAO,KAAK,SAAS;;;;;;;;AAWzB,MAAa,cACX,MACA,WACG,IAAI,SAAS,MAAM,OAAO"}
@@ -1,9 +1,9 @@
1
- import * as z from "zod";
1
+ import * as z$1 from "zod";
2
2
  import { GraphQLScalarType, GraphQLScalarTypeConfig } from "graphql";
3
3
 
4
4
  //#region src/FieldType.d.ts
5
5
  interface FieldTypeConfig<TInternal, TExternal = TInternal> extends GraphQLScalarTypeConfig<TInternal, TExternal> {
6
- zod: z.ZodType<TInternal>;
6
+ zod: z$1.ZodType<TInternal>;
7
7
  jsonSchema: unknown | (() => unknown);
8
8
  }
9
9
  type AnyFieldType = FieldType<any, any>;
@@ -17,7 +17,7 @@ declare class FieldType<TInternal, TExternal = TInternal> extends GraphQLScalarT
17
17
  private readonly jsonSchemaDef?;
18
18
  constructor(config: FieldTypeConfig<TInternal, TExternal>);
19
19
  /** Return the attached zod schema for validation. */
20
- getZod(): z.ZodType<TInternal>;
20
+ getZod(): z$1.ZodType<TInternal>;
21
21
  /** GraphQL scalar instance usable by Pothos or vanilla GraphQL. */
22
22
  getPothos(): GraphQLScalarType<TInternal, TExternal>;
23
23
  /** Return the JSON Schema (evaluates factory if provided). */
@@ -25,7 +25,7 @@ declare class FieldType<TInternal, TExternal = TInternal> extends GraphQLScalarT
25
25
  getJsonSchemaDef(): unknown | (() => unknown);
26
26
  getJsonSchema(): unknown;
27
27
  }
28
- type ZodFieldType<Field extends AnyFieldType> = z.infer<ReturnType<Field['getZod']>>;
28
+ type ZodFieldType<Field extends AnyFieldType> = z$1.infer<ReturnType<Field['getZod']>>;
29
29
  //#endregion
30
30
  export { AnyFieldType, FieldType, FieldTypeConfig, ZodFieldType };
31
31
  //# sourceMappingURL=FieldType.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FieldType.d.ts","names":[],"sources":["../src/FieldType.ts"],"sourcesContent":[],"mappings":";;;;UAGiB,uCAEH,mBACJ,wBAAwB,WAAW;OACtC,CAAA,CAAE,QAAQ;EAJA,UAAA,EAAA,OAAe,GAAA,CAAA,GAAA,GAAA,OAAA,CAAA;;AAGE,KAMtB,YAAA,GAAe,SANO,CAAA,GAAA,EAAA,GAAA,CAAA;;;;;;AAMtB,cAOC,SAPW,CAAG,SAAA,EAAS,YAStB,SATsB,CAAA,SAU1B,iBAV0B,CAUR,SAVQ,EAUG,SAVH,CAAA,CAAA;EAOvB,QAAA,SAAS;EAER,iBAAA,aAAA;EACc,WAAA,CAAA,MAAA,EAIN,eAJM,CAIU,SAJV,EAIqB,SAJrB,CAAA;EAAW;EAID,MAAA,CAAA,CAAA,EAO1B,CAAA,CAAE,OAPwB,CAOhB,SAPgB,CAAA;EAAW;EAA3B,SAAA,CAAA,CAAA,EAYP,iBAZO,CAYW,SAZX,EAYsB,SAZtB,CAAA;EAOA;EAAR,OAAA,CAAA,CAAA,EAAA,OAAA;EAKmB,gBAAA,CAAA,CAAA,EAAA,OAAA,GAAA,CAAA,GAAA,GAAA,OAAA,CAAA;EAAW,aAAA,CAAA,CAAA,EAAA,OAAA;;AAhBlC,KAoDE,YApDF,CAAA,cAoD6B,YApD7B,CAAA,GAoD6C,CAAA,CAAE,KApD/C,CAqDR,UArDQ,CAqDG,KArDH,CAAA,QAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"FieldType.d.ts","names":[],"sources":["../src/FieldType.ts"],"sourcesContent":[],"mappings":";;;;UAGiB,uCAEH,mBACJ,wBAAwB,WAAW;OACtC,GAAA,CAAE,QAAQ;EAJA,UAAA,EAAA,OAAe,GAAA,CAAA,GAAA,GAAA,OAAA,CAAA;;AAGE,KAMtB,YAAA,GAAe,SANO,CAAA,GAAA,EAAA,GAAA,CAAA;;;;;;AAMtB,cAOC,SAPW,CAAG,SAAA,EAAS,YAStB,SATsB,CAAA,SAU1B,iBAV0B,CAUR,SAVQ,EAUG,SAVH,CAAA,CAAA;EAOvB,QAAA,SAAS;EAER,iBAAA,aAAA;EACc,WAAA,CAAA,MAAA,EAIN,eAJM,CAIU,SAJV,EAIqB,SAJrB,CAAA;EAAW;EAID,MAAA,CAAA,CAAA,EAO1B,GAAA,CAAE,OAPwB,CAOhB,SAPgB,CAAA;EAAW;EAA3B,SAAA,CAAA,CAAA,EAYP,iBAZO,CAYW,SAZX,EAYsB,SAZtB,CAAA;EAOA;EAAV,OAAE,CAAA,CAAA,EAAA,OAAA;EAKmB,gBAAA,CAAA,CAAA,EAAA,OAAA,GAAA,CAAA,GAAA,GAAA,OAAA,CAAA;EAAW,aAAA,CAAA,CAAA,EAAA,OAAA;;AAhBlC,KAoDE,YApDF,CAAA,cAoD6B,YApD7B,CAAA,GAoD6C,GAAA,CAAE,KApD/C,CAqDR,UArDQ,CAqDG,KArDH,CAAA,QAAA,CAAA,CAAA,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { SchemaModelType } from "./SchemaModelType.js";
2
+ import { z } from "zod";
3
+
4
+ //#region src/GraphQLSchemaType.d.ts
5
+
6
+ /**
7
+ * Wrapper for GraphQL Type Definitions to be used in ContractSpec Schemas.
8
+ * Note: Runtime validation is limited to 'unknown' (pass-through) as SDL is not parsed at runtime.
9
+ */
10
+ declare class GraphQLSchemaType implements SchemaModelType {
11
+ readonly typeDef: string;
12
+ readonly name: string;
13
+ readonly _isSchemaType = true;
14
+ constructor(typeDef: string, name: string);
15
+ getZod(): z.ZodType;
16
+ }
17
+ //#endregion
18
+ export { GraphQLSchemaType };
19
+ //# sourceMappingURL=GraphQLSchemaType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphQLSchemaType.d.ts","names":[],"sources":["../src/GraphQLSchemaType.ts"],"sourcesContent":[],"mappings":";;;;;;;AAOA;;cAAa,iBAAA,YAA6B;;;;;YAQ9B,CAAA,CAAE"}
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/GraphQLSchemaType.ts
4
+ /**
5
+ * Wrapper for GraphQL Type Definitions to be used in ContractSpec Schemas.
6
+ * Note: Runtime validation is limited to 'unknown' (pass-through) as SDL is not parsed at runtime.
7
+ */
8
+ var GraphQLSchemaType = class {
9
+ _isSchemaType = true;
10
+ constructor(typeDef, name) {
11
+ this.typeDef = typeDef;
12
+ this.name = name;
13
+ }
14
+ getZod() {
15
+ return z.unknown();
16
+ }
17
+ };
18
+
19
+ //#endregion
20
+ export { GraphQLSchemaType };
21
+ //# sourceMappingURL=GraphQLSchemaType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphQLSchemaType.js","names":["typeDef: string","name: string"],"sources":["../src/GraphQLSchemaType.ts"],"sourcesContent":["import { z } from 'zod';\nimport type { SchemaModelType } from './SchemaModelType';\n\n/**\n * Wrapper for GraphQL Type Definitions to be used in ContractSpec Schemas.\n * Note: Runtime validation is limited to 'unknown' (pass-through) as SDL is not parsed at runtime.\n */\nexport class GraphQLSchemaType implements SchemaModelType {\n readonly _isSchemaType = true;\n\n constructor(\n public readonly typeDef: string,\n public readonly name: string\n ) {}\n\n getZod(): z.ZodType {\n return z.unknown();\n }\n}\n"],"mappings":";;;;;;;AAOA,IAAa,oBAAb,MAA0D;CACxD,AAAS,gBAAgB;CAEzB,YACE,AAAgBA,SAChB,AAAgBC,MAChB;EAFgB;EACA;;CAGlB,SAAoB;AAClB,SAAO,EAAE,SAAS"}
@@ -0,0 +1,112 @@
1
+ import { SchemaModelType } from "./SchemaModelType.js";
2
+ import * as z$1 from "zod";
3
+
4
+ //#region src/JsonSchemaType.d.ts
5
+
6
+ /**
7
+ * JSON Schema definition structure.
8
+ * Supports standard JSON Schema draft-07/2020-12 properties.
9
+ */
10
+ interface JsonSchemaDefinition {
11
+ type?: string | string[];
12
+ properties?: Record<string, JsonSchemaDefinition>;
13
+ required?: string[];
14
+ additionalProperties?: boolean | JsonSchemaDefinition;
15
+ items?: JsonSchemaDefinition | JsonSchemaDefinition[];
16
+ enum?: unknown[];
17
+ const?: unknown;
18
+ oneOf?: JsonSchemaDefinition[];
19
+ anyOf?: JsonSchemaDefinition[];
20
+ allOf?: JsonSchemaDefinition[];
21
+ $ref?: string;
22
+ title?: string;
23
+ description?: string;
24
+ default?: unknown;
25
+ format?: string;
26
+ minimum?: number;
27
+ maximum?: number;
28
+ minLength?: number;
29
+ maxLength?: number;
30
+ pattern?: string;
31
+ [key: string]: unknown;
32
+ }
33
+ /**
34
+ * Options for JsonSchemaType wrapper.
35
+ */
36
+ interface JsonSchemaTypeOptions {
37
+ /** Name for identification */
38
+ name?: string;
39
+ }
40
+ /**
41
+ * Wrapper to use JSON Schema as a SchemaType.
42
+ * Converts to Zod at runtime for validation.
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const CustomFieldsSchema = fromJsonSchema({
47
+ * type: 'object',
48
+ * additionalProperties: {
49
+ * oneOf: [
50
+ * { type: 'string' },
51
+ * { type: 'number' },
52
+ * { type: 'boolean' },
53
+ * ],
54
+ * },
55
+ * }, { name: 'CustomFields' });
56
+ * ```
57
+ */
58
+ declare class JsonSchemaType implements SchemaModelType<Record<string, unknown>> {
59
+ private readonly jsonSchema;
60
+ private readonly options;
61
+ constructor(jsonSchema: JsonSchemaDefinition, options?: JsonSchemaTypeOptions);
62
+ /**
63
+ * Convert JSON Schema to Zod schema for runtime validation.
64
+ *
65
+ * Note: This is a simplified conversion. For complex schemas,
66
+ * consider using a dedicated json-schema-to-zod library.
67
+ */
68
+ getZod(): z$1.ZodType<Record<string, unknown>>;
69
+ /**
70
+ * Return the original JSON Schema.
71
+ */
72
+ getJsonSchema(): JsonSchemaDefinition;
73
+ /**
74
+ * Return GraphQL type info.
75
+ * JSON Schema types map to JSON scalar in GraphQL.
76
+ */
77
+ getPothos(): {
78
+ type: string;
79
+ name?: string;
80
+ };
81
+ /**
82
+ * Get the configured name for this schema.
83
+ */
84
+ getName(): string | undefined;
85
+ /**
86
+ * Convert a single JSON Schema property to Zod.
87
+ */
88
+ private convertPropertyToZod;
89
+ }
90
+ /**
91
+ * Helper to create a SchemaType from JSON Schema.
92
+ *
93
+ * @param schema - The JSON Schema definition
94
+ * @param options - Optional configuration
95
+ * @returns A SchemaType-compatible wrapper
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * const MetadataSchema = fromJsonSchema({
100
+ * type: 'object',
101
+ * properties: {
102
+ * createdAt: { type: 'string', format: 'date-time' },
103
+ * updatedAt: { type: 'string', format: 'date-time' },
104
+ * },
105
+ * required: ['createdAt'],
106
+ * });
107
+ * ```
108
+ */
109
+ declare const fromJsonSchema: (schema: JsonSchemaDefinition, options?: JsonSchemaTypeOptions) => JsonSchemaType;
110
+ //#endregion
111
+ export { JsonSchemaDefinition, JsonSchemaType, JsonSchemaTypeOptions, fromJsonSchema };
112
+ //# sourceMappingURL=JsonSchemaType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonSchemaType.d.ts","names":[],"sources":["../src/JsonSchemaType.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AA2CiB,UA3BA,oBAAA,CA2BqB;EAuBzB,IAAA,CAAA,EAAA,MAAA,GAAA,MAAe,EAAA;EAC1B,UAAA,CAAA,EAjDa,MAiDb,CAAA,MAAA,EAjD4B,oBAiD5B,CAAA;EAMc,QAAA,CAAA,EAAA,MAAA,EAAA;EACH,oBAAA,CAAA,EAAA,OAAA,GAtDsB,oBAsDtB;EAYS,KAAA,CAAA,EAjEZ,oBAiEY,GAjEW,oBAiEX,EAAA;EAAV,IAAE,CAAA,EAAA,OAAA,EAAA;EAqCK,KAAA,CAAA,EAAA,OAAA;EAzDoB,KAAA,CAAA,EA1C7B,oBA0C6B,EAAA;EAAe,KAAA,CAAA,EAzC5C,oBAyC4C,EAAA;EA+HzC,KAAA,CAAA,EAvKH,oBA0K8C,EAAA;EAF9C,IAAA,CAAA,EAAA,MAAA;EACE,KAAA,CAAA,EAAA,MAAA;EACT,WAAA,CAAA,EAAA,MAAA;EAAqD,OAAA,CAAA,EAAA,OAAA;;;;;;;;;;;;UAzJvC,qBAAA;;;;;;;;;;;;;;;;;;;;;;cAuBJ,cAAA,YAA0B,gBACrC;;;0BAMc,gCACH;;;;;;;YAYD,GAAA,CAAE,QAAQ;;;;mBAqCH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsEN,yBACH,gCACE,0BACT"}
@@ -0,0 +1,125 @@
1
+ import * as z$1 from "zod";
2
+
3
+ //#region src/JsonSchemaType.ts
4
+ /**
5
+ * JSON Schema wrapper for ContractSpec compatibility.
6
+ *
7
+ * Wraps JSON Schema definitions to implement the SchemaType interface,
8
+ * enabling direct JSON Schema usage in ContractSpec definitions.
9
+ *
10
+ * @module JsonSchemaType
11
+ */
12
+ /**
13
+ * Wrapper to use JSON Schema as a SchemaType.
14
+ * Converts to Zod at runtime for validation.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const CustomFieldsSchema = fromJsonSchema({
19
+ * type: 'object',
20
+ * additionalProperties: {
21
+ * oneOf: [
22
+ * { type: 'string' },
23
+ * { type: 'number' },
24
+ * { type: 'boolean' },
25
+ * ],
26
+ * },
27
+ * }, { name: 'CustomFields' });
28
+ * ```
29
+ */
30
+ var JsonSchemaType = class JsonSchemaType {
31
+ jsonSchema;
32
+ options;
33
+ constructor(jsonSchema, options = {}) {
34
+ this.jsonSchema = jsonSchema;
35
+ this.options = options;
36
+ }
37
+ /**
38
+ * Convert JSON Schema to Zod schema for runtime validation.
39
+ *
40
+ * Note: This is a simplified conversion. For complex schemas,
41
+ * consider using a dedicated json-schema-to-zod library.
42
+ */
43
+ getZod() {
44
+ if (this.jsonSchema.additionalProperties !== void 0) {
45
+ if (this.jsonSchema.additionalProperties === true) return z$1.record(z$1.string(), z$1.unknown());
46
+ if (typeof this.jsonSchema.additionalProperties === "object") return z$1.record(z$1.string(), z$1.unknown());
47
+ if (this.jsonSchema.additionalProperties === false) return z$1.object({}).strict();
48
+ }
49
+ if (this.jsonSchema.properties) {
50
+ const shape = {};
51
+ const required = new Set(this.jsonSchema.required ?? []);
52
+ for (const [key, propSchema] of Object.entries(this.jsonSchema.properties)) {
53
+ const fieldType = this.convertPropertyToZod(propSchema);
54
+ shape[key] = required.has(key) ? fieldType : fieldType.optional();
55
+ }
56
+ return z$1.object(shape).passthrough();
57
+ }
58
+ return z$1.object({}).passthrough();
59
+ }
60
+ /**
61
+ * Return the original JSON Schema.
62
+ */
63
+ getJsonSchema() {
64
+ return this.jsonSchema;
65
+ }
66
+ /**
67
+ * Return GraphQL type info.
68
+ * JSON Schema types map to JSON scalar in GraphQL.
69
+ */
70
+ getPothos() {
71
+ return {
72
+ type: "JSON",
73
+ name: this.options.name
74
+ };
75
+ }
76
+ /**
77
+ * Get the configured name for this schema.
78
+ */
79
+ getName() {
80
+ return this.options.name;
81
+ }
82
+ /**
83
+ * Convert a single JSON Schema property to Zod.
84
+ */
85
+ convertPropertyToZod(schema) {
86
+ switch (Array.isArray(schema.type) ? schema.type[0] : schema.type) {
87
+ case "string": return z$1.string();
88
+ case "number":
89
+ case "integer": return z$1.number();
90
+ case "boolean": return z$1.boolean();
91
+ case "array":
92
+ if (schema.items && !Array.isArray(schema.items)) return z$1.array(this.convertPropertyToZod(schema.items));
93
+ return z$1.array(z$1.unknown());
94
+ case "object":
95
+ if (schema.properties) return new JsonSchemaType(schema).getZod();
96
+ return z$1.record(z$1.string(), z$1.unknown());
97
+ case "null": return z$1.null();
98
+ default: return z$1.unknown();
99
+ }
100
+ }
101
+ };
102
+ /**
103
+ * Helper to create a SchemaType from JSON Schema.
104
+ *
105
+ * @param schema - The JSON Schema definition
106
+ * @param options - Optional configuration
107
+ * @returns A SchemaType-compatible wrapper
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * const MetadataSchema = fromJsonSchema({
112
+ * type: 'object',
113
+ * properties: {
114
+ * createdAt: { type: 'string', format: 'date-time' },
115
+ * updatedAt: { type: 'string', format: 'date-time' },
116
+ * },
117
+ * required: ['createdAt'],
118
+ * });
119
+ * ```
120
+ */
121
+ const fromJsonSchema = (schema, options) => new JsonSchemaType(schema, options);
122
+
123
+ //#endregion
124
+ export { JsonSchemaType, fromJsonSchema };
125
+ //# sourceMappingURL=JsonSchemaType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonSchemaType.js","names":["z","shape: Record<string, z.ZodType>"],"sources":["../src/JsonSchemaType.ts"],"sourcesContent":["/**\n * JSON Schema wrapper for ContractSpec compatibility.\n *\n * Wraps JSON Schema definitions to implement the SchemaType interface,\n * enabling direct JSON Schema usage in ContractSpec definitions.\n *\n * @module JsonSchemaType\n */\n\nimport * as z from 'zod';\nimport type { SchemaModelType } from './SchemaModelType';\n\n/**\n * JSON Schema definition structure.\n * Supports standard JSON Schema draft-07/2020-12 properties.\n */\nexport interface JsonSchemaDefinition {\n type?: string | string[];\n properties?: Record<string, JsonSchemaDefinition>;\n required?: string[];\n additionalProperties?: boolean | JsonSchemaDefinition;\n items?: JsonSchemaDefinition | JsonSchemaDefinition[];\n enum?: unknown[];\n const?: unknown;\n oneOf?: JsonSchemaDefinition[];\n anyOf?: JsonSchemaDefinition[];\n allOf?: JsonSchemaDefinition[];\n $ref?: string;\n title?: string;\n description?: string;\n default?: unknown;\n format?: string;\n minimum?: number;\n maximum?: number;\n minLength?: number;\n maxLength?: number;\n pattern?: string;\n [key: string]: unknown;\n}\n\n/**\n * Options for JsonSchemaType wrapper.\n */\nexport interface JsonSchemaTypeOptions {\n /** Name for identification */\n name?: string;\n}\n\n/**\n * Wrapper to use JSON Schema as a SchemaType.\n * Converts to Zod at runtime for validation.\n *\n * @example\n * ```typescript\n * const CustomFieldsSchema = fromJsonSchema({\n * type: 'object',\n * additionalProperties: {\n * oneOf: [\n * { type: 'string' },\n * { type: 'number' },\n * { type: 'boolean' },\n * ],\n * },\n * }, { name: 'CustomFields' });\n * ```\n */\nexport class JsonSchemaType implements SchemaModelType<\n Record<string, unknown>\n> {\n private readonly jsonSchema: JsonSchemaDefinition;\n private readonly options: JsonSchemaTypeOptions;\n\n constructor(\n jsonSchema: JsonSchemaDefinition,\n options: JsonSchemaTypeOptions = {}\n ) {\n this.jsonSchema = jsonSchema;\n this.options = options;\n }\n\n /**\n * Convert JSON Schema to Zod schema for runtime validation.\n *\n * Note: This is a simplified conversion. For complex schemas,\n * consider using a dedicated json-schema-to-zod library.\n */\n getZod(): z.ZodType<Record<string, unknown>> {\n // Handle additionalProperties (dictionary/record types)\n if (this.jsonSchema.additionalProperties !== undefined) {\n if (this.jsonSchema.additionalProperties === true) {\n return z.record(z.string(), z.unknown());\n }\n if (typeof this.jsonSchema.additionalProperties === 'object') {\n // For typed additionalProperties, use union or unknown\n return z.record(z.string(), z.unknown());\n }\n if (this.jsonSchema.additionalProperties === false) {\n return z.object({}).strict();\n }\n }\n\n // Handle explicit properties\n if (this.jsonSchema.properties) {\n const shape: Record<string, z.ZodType> = {};\n const required = new Set(this.jsonSchema.required ?? []);\n\n for (const [key, propSchema] of Object.entries(\n this.jsonSchema.properties\n )) {\n const fieldType = this.convertPropertyToZod(propSchema);\n shape[key] = required.has(key) ? fieldType : fieldType.optional();\n }\n\n return z.object(shape).passthrough();\n }\n\n // Default: passthrough object\n return z.object({}).passthrough();\n }\n\n /**\n * Return the original JSON Schema.\n */\n getJsonSchema(): JsonSchemaDefinition {\n return this.jsonSchema;\n }\n\n /**\n * Return GraphQL type info.\n * JSON Schema types map to JSON scalar in GraphQL.\n */\n getPothos(): { type: string; name?: string } {\n return { type: 'JSON', name: this.options.name };\n }\n\n /**\n * Get the configured name for this schema.\n */\n getName(): string | undefined {\n return this.options.name;\n }\n\n /**\n * Convert a single JSON Schema property to Zod.\n */\n private convertPropertyToZod(schema: JsonSchemaDefinition): z.ZodType {\n const type = Array.isArray(schema.type) ? schema.type[0] : schema.type;\n\n switch (type) {\n case 'string':\n return z.string();\n case 'number':\n case 'integer':\n return z.number();\n case 'boolean':\n return z.boolean();\n case 'array':\n if (schema.items && !Array.isArray(schema.items)) {\n return z.array(this.convertPropertyToZod(schema.items));\n }\n return z.array(z.unknown());\n case 'object':\n if (schema.properties) {\n return new JsonSchemaType(schema).getZod();\n }\n return z.record(z.string(), z.unknown());\n case 'null':\n return z.null();\n default:\n return z.unknown();\n }\n }\n}\n\n/**\n * Helper to create a SchemaType from JSON Schema.\n *\n * @param schema - The JSON Schema definition\n * @param options - Optional configuration\n * @returns A SchemaType-compatible wrapper\n *\n * @example\n * ```typescript\n * const MetadataSchema = fromJsonSchema({\n * type: 'object',\n * properties: {\n * createdAt: { type: 'string', format: 'date-time' },\n * updatedAt: { type: 'string', format: 'date-time' },\n * },\n * required: ['createdAt'],\n * });\n * ```\n */\nexport const fromJsonSchema = (\n schema: JsonSchemaDefinition,\n options?: JsonSchemaTypeOptions\n): JsonSchemaType => new JsonSchemaType(schema, options);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,IAAa,iBAAb,MAAa,eAEX;CACA,AAAiB;CACjB,AAAiB;CAEjB,YACE,YACA,UAAiC,EAAE,EACnC;AACA,OAAK,aAAa;AAClB,OAAK,UAAU;;;;;;;;CASjB,SAA6C;AAE3C,MAAI,KAAK,WAAW,yBAAyB,QAAW;AACtD,OAAI,KAAK,WAAW,yBAAyB,KAC3C,QAAOA,IAAE,OAAOA,IAAE,QAAQ,EAAEA,IAAE,SAAS,CAAC;AAE1C,OAAI,OAAO,KAAK,WAAW,yBAAyB,SAElD,QAAOA,IAAE,OAAOA,IAAE,QAAQ,EAAEA,IAAE,SAAS,CAAC;AAE1C,OAAI,KAAK,WAAW,yBAAyB,MAC3C,QAAOA,IAAE,OAAO,EAAE,CAAC,CAAC,QAAQ;;AAKhC,MAAI,KAAK,WAAW,YAAY;GAC9B,MAAMC,QAAmC,EAAE;GAC3C,MAAM,WAAW,IAAI,IAAI,KAAK,WAAW,YAAY,EAAE,CAAC;AAExD,QAAK,MAAM,CAAC,KAAK,eAAe,OAAO,QACrC,KAAK,WAAW,WACjB,EAAE;IACD,MAAM,YAAY,KAAK,qBAAqB,WAAW;AACvD,UAAM,OAAO,SAAS,IAAI,IAAI,GAAG,YAAY,UAAU,UAAU;;AAGnE,UAAOD,IAAE,OAAO,MAAM,CAAC,aAAa;;AAItC,SAAOA,IAAE,OAAO,EAAE,CAAC,CAAC,aAAa;;;;;CAMnC,gBAAsC;AACpC,SAAO,KAAK;;;;;;CAOd,YAA6C;AAC3C,SAAO;GAAE,MAAM;GAAQ,MAAM,KAAK,QAAQ;GAAM;;;;;CAMlD,UAA8B;AAC5B,SAAO,KAAK,QAAQ;;;;;CAMtB,AAAQ,qBAAqB,QAAyC;AAGpE,UAFa,MAAM,QAAQ,OAAO,KAAK,GAAG,OAAO,KAAK,KAAK,OAAO,MAElE;GACE,KAAK,SACH,QAAOA,IAAE,QAAQ;GACnB,KAAK;GACL,KAAK,UACH,QAAOA,IAAE,QAAQ;GACnB,KAAK,UACH,QAAOA,IAAE,SAAS;GACpB,KAAK;AACH,QAAI,OAAO,SAAS,CAAC,MAAM,QAAQ,OAAO,MAAM,CAC9C,QAAOA,IAAE,MAAM,KAAK,qBAAqB,OAAO,MAAM,CAAC;AAEzD,WAAOA,IAAE,MAAMA,IAAE,SAAS,CAAC;GAC7B,KAAK;AACH,QAAI,OAAO,WACT,QAAO,IAAI,eAAe,OAAO,CAAC,QAAQ;AAE5C,WAAOA,IAAE,OAAOA,IAAE,QAAQ,EAAEA,IAAE,SAAS,CAAC;GAC1C,KAAK,OACH,QAAOA,IAAE,MAAM;GACjB,QACE,QAAOA,IAAE,SAAS;;;;;;;;;;;;;;;;;;;;;;;AAwB1B,MAAa,kBACX,QACA,YACmB,IAAI,eAAe,QAAQ,QAAQ"}
@@ -1,5 +1,5 @@
1
1
  import { FieldType } from "./FieldType.js";
2
- import * as z from "zod";
2
+ import * as z$1 from "zod";
3
3
  import { Kind } from "graphql";
4
4
 
5
5
  //#region src/ScalarTypeEnum.ts
@@ -19,8 +19,8 @@ const ScalarTypeEnum = {
19
19
  String_unsecure: () => new FieldType({
20
20
  name: "String_unsecure",
21
21
  description: "Unvalidated string scalar",
22
- zod: z.string(),
23
- parseValue: (v) => z.string().parse(v),
22
+ zod: z$1.string(),
23
+ parseValue: (v) => z$1.string().parse(v),
24
24
  serialize: (v) => String(v),
25
25
  parseLiteral: (ast) => {
26
26
  if (ast.kind !== Kind.STRING) throw new TypeError("Invalid literal");
@@ -31,10 +31,10 @@ const ScalarTypeEnum = {
31
31
  Int_unsecure: () => new FieldType({
32
32
  name: "Int_unsecure",
33
33
  description: "Unvalidated integer scalar",
34
- zod: z.number().int(),
34
+ zod: z$1.number().int(),
35
35
  parseValue: (v) => {
36
36
  const num = typeof v === "number" ? v : Number(v);
37
- return z.number().int().parse(num);
37
+ return z$1.number().int().parse(num);
38
38
  },
39
39
  serialize: (v) => Math.trunc(typeof v === "number" ? v : Number(v)),
40
40
  parseLiteral: (ast) => {
@@ -46,10 +46,10 @@ const ScalarTypeEnum = {
46
46
  Float_unsecure: () => new FieldType({
47
47
  name: "Float_unsecure",
48
48
  description: "Unvalidated float scalar",
49
- zod: z.number(),
49
+ zod: z$1.number(),
50
50
  parseValue: (v) => {
51
51
  const num = typeof v === "number" ? v : Number(v);
52
- return z.number().parse(num);
52
+ return z$1.number().parse(num);
53
53
  },
54
54
  serialize: (v) => Number(v),
55
55
  parseLiteral: (ast) => {
@@ -61,8 +61,8 @@ const ScalarTypeEnum = {
61
61
  Boolean: () => new FieldType({
62
62
  name: "Boolean",
63
63
  description: "Unvalidated boolean scalar",
64
- zod: z.boolean(),
65
- parseValue: (v) => z.coerce.boolean().parse(v),
64
+ zod: z$1.boolean(),
65
+ parseValue: (v) => z$1.coerce.boolean().parse(v),
66
66
  serialize: (v) => Boolean(v),
67
67
  parseLiteral: (ast) => {
68
68
  if (ast.kind !== Kind.BOOLEAN) throw new TypeError("Invalid literal");
@@ -73,8 +73,8 @@ const ScalarTypeEnum = {
73
73
  ID: () => new FieldType({
74
74
  name: "ID",
75
75
  description: "Unvalidated id scalar",
76
- zod: z.string(),
77
- parseValue: (v) => z.string().parse(v),
76
+ zod: z$1.string(),
77
+ parseValue: (v) => z$1.string().parse(v),
78
78
  serialize: (v) => String(v),
79
79
  parseLiteral: (ast) => {
80
80
  if (ast.kind !== Kind.STRING) throw new TypeError("Invalid literal");
@@ -84,21 +84,21 @@ const ScalarTypeEnum = {
84
84
  }),
85
85
  JSON: () => new FieldType({
86
86
  name: "JSON",
87
- zod: z.any(),
87
+ zod: z$1.any(),
88
88
  parseValue: (v) => v,
89
89
  serialize: (v) => v,
90
90
  jsonSchema: {}
91
91
  }),
92
92
  JSONObject: () => new FieldType({
93
93
  name: "JSONObject",
94
- zod: z.record(z.string(), z.any()),
95
- parseValue: (v) => z.record(z.string(), z.any()).parse(v),
94
+ zod: z$1.record(z$1.string(), z$1.any()),
95
+ parseValue: (v) => z$1.record(z$1.string(), z$1.any()).parse(v),
96
96
  serialize: (v) => v ?? {},
97
97
  jsonSchema: { type: "object" }
98
98
  }),
99
99
  Date: () => new FieldType({
100
100
  name: "Date",
101
- zod: z.date(),
101
+ zod: z$1.date(),
102
102
  parseValue: (v) => v instanceof Date ? v : new Date(String(v)),
103
103
  serialize: (v) => v instanceof Date ? v.toISOString().split("T")[0] : String(v),
104
104
  jsonSchema: {
@@ -108,7 +108,7 @@ const ScalarTypeEnum = {
108
108
  }),
109
109
  DateTime: () => new FieldType({
110
110
  name: "DateTime",
111
- zod: z.date(),
111
+ zod: z$1.date(),
112
112
  parseValue: (v) => v instanceof Date ? v : new Date(String(v)),
113
113
  serialize: (v) => {
114
114
  return v instanceof Date ? v.toISOString() : String(v);
@@ -120,8 +120,8 @@ const ScalarTypeEnum = {
120
120
  }),
121
121
  Time: () => new FieldType({
122
122
  name: "Time",
123
- zod: z.string().regex(/^\d{2}:\d{2}(:\d{2})?$/),
124
- parseValue: (v) => z.string().regex(/^\d{2}:\d{2}(:\d{2})?$/).parse(v),
123
+ zod: z$1.string().regex(/^\d{2}:\d{2}(:\d{2})?$/),
124
+ parseValue: (v) => z$1.string().regex(/^\d{2}:\d{2}(:\d{2})?$/).parse(v),
125
125
  serialize: (v) => String(v),
126
126
  jsonSchema: {
127
127
  type: "string",
@@ -130,8 +130,8 @@ const ScalarTypeEnum = {
130
130
  }),
131
131
  EmailAddress: () => new FieldType({
132
132
  name: "EmailAddress",
133
- zod: z.string().email(),
134
- parseValue: (v) => z.string().email().parse(v),
133
+ zod: z$1.string().email(),
134
+ parseValue: (v) => z$1.string().email().parse(v),
135
135
  serialize: (v) => String(v),
136
136
  jsonSchema: {
137
137
  type: "string",
@@ -140,8 +140,8 @@ const ScalarTypeEnum = {
140
140
  }),
141
141
  URL: () => new FieldType({
142
142
  name: "URL",
143
- zod: z.string().url(),
144
- parseValue: (v) => z.string().url().parse(v),
143
+ zod: z$1.string().url(),
144
+ parseValue: (v) => z$1.string().url().parse(v),
145
145
  serialize: (v) => String(v),
146
146
  jsonSchema: {
147
147
  type: "string",
@@ -150,8 +150,8 @@ const ScalarTypeEnum = {
150
150
  }),
151
151
  PhoneNumber: () => new FieldType({
152
152
  name: "PhoneNumber",
153
- zod: z.string().regex(phoneRegex),
154
- parseValue: (v) => z.string().regex(phoneRegex).parse(v),
153
+ zod: z$1.string().regex(phoneRegex),
154
+ parseValue: (v) => z$1.string().regex(phoneRegex).parse(v),
155
155
  serialize: (v) => String(v),
156
156
  jsonSchema: {
157
157
  type: "string",
@@ -160,8 +160,8 @@ const ScalarTypeEnum = {
160
160
  }),
161
161
  NonEmptyString: () => new FieldType({
162
162
  name: "NonEmptyString",
163
- zod: z.string().min(1),
164
- parseValue: (v) => z.string().min(1).parse(v),
163
+ zod: z$1.string().min(1),
164
+ parseValue: (v) => z$1.string().min(1).parse(v),
165
165
  serialize: (v) => String(v),
166
166
  jsonSchema: {
167
167
  type: "string",
@@ -170,8 +170,8 @@ const ScalarTypeEnum = {
170
170
  }),
171
171
  Locale: () => new FieldType({
172
172
  name: "Locale",
173
- zod: z.string().regex(localeRegex),
174
- parseValue: (v) => z.string().regex(localeRegex).parse(v),
173
+ zod: z$1.string().regex(localeRegex),
174
+ parseValue: (v) => z$1.string().regex(localeRegex).parse(v),
175
175
  serialize: (v) => String(v),
176
176
  jsonSchema: {
177
177
  type: "string",
@@ -180,8 +180,8 @@ const ScalarTypeEnum = {
180
180
  }),
181
181
  TimeZone: () => new FieldType({
182
182
  name: "TimeZone",
183
- zod: z.string().regex(timezoneRegex),
184
- parseValue: (v) => z.string().regex(timezoneRegex).parse(v),
183
+ zod: z$1.string().regex(timezoneRegex),
184
+ parseValue: (v) => z$1.string().regex(timezoneRegex).parse(v),
185
185
  serialize: (v) => String(v),
186
186
  jsonSchema: {
187
187
  type: "string",
@@ -190,8 +190,8 @@ const ScalarTypeEnum = {
190
190
  }),
191
191
  Latitude: () => new FieldType({
192
192
  name: "Latitude",
193
- zod: z.number().min(latMin).max(latMax),
194
- parseValue: (v) => z.coerce.number().min(latMin).max(latMax).parse(v),
193
+ zod: z$1.number().min(latMin).max(latMax),
194
+ parseValue: (v) => z$1.coerce.number().min(latMin).max(latMax).parse(v),
195
195
  serialize: (v) => Number(v),
196
196
  jsonSchema: {
197
197
  type: "number",
@@ -201,8 +201,8 @@ const ScalarTypeEnum = {
201
201
  }),
202
202
  Longitude: () => new FieldType({
203
203
  name: "Longitude",
204
- zod: z.number().min(lonMin).max(lonMax),
205
- parseValue: (v) => z.coerce.number().min(lonMin).max(lonMax).parse(v),
204
+ zod: z$1.number().min(lonMin).max(lonMax),
205
+ parseValue: (v) => z$1.coerce.number().min(lonMin).max(lonMax).parse(v),
206
206
  serialize: (v) => Number(v),
207
207
  jsonSchema: {
208
208
  type: "number",
@@ -212,8 +212,8 @@ const ScalarTypeEnum = {
212
212
  }),
213
213
  Currency: () => new FieldType({
214
214
  name: "Currency",
215
- zod: z.string().regex(currencyRegex),
216
- parseValue: (v) => z.string().regex(currencyRegex).parse(v),
215
+ zod: z$1.string().regex(currencyRegex),
216
+ parseValue: (v) => z$1.string().regex(currencyRegex).parse(v),
217
217
  serialize: (v) => String(v),
218
218
  jsonSchema: {
219
219
  type: "string",
@@ -222,8 +222,8 @@ const ScalarTypeEnum = {
222
222
  }),
223
223
  CountryCode: () => new FieldType({
224
224
  name: "CountryCode",
225
- zod: z.string().regex(countryRegex),
226
- parseValue: (v) => z.string().regex(countryRegex).parse(v),
225
+ zod: z$1.string().regex(countryRegex),
226
+ parseValue: (v) => z$1.string().regex(countryRegex).parse(v),
227
227
  serialize: (v) => String(v),
228
228
  jsonSchema: {
229
229
  type: "string",