@bram-dc/fastify-type-provider-zod 7.0.0 → 7.0.1
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 +1 -1
- package/dist/cjs/core.cjs.map +1 -1
- package/dist/cjs/core.d.cts +1 -2
- package/dist/esm/core.d.ts +1 -2
- package/dist/esm/core.js.map +1 -1
- package/package.json +1 -1
- package/src/core.ts +1 -1
package/README.md
CHANGED
package/dist/cjs/core.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.cjs","sources":["../../src/core.ts"],"sourcesContent":["import type { SwaggerTransform, SwaggerTransformObject } from '@fastify/swagger'\nimport type {\n FastifyPluginAsync,\n FastifyPluginCallback,\n FastifyPluginOptions,\n FastifySchema,\n FastifySchemaCompiler,\n FastifyTypeProvider,\n RawServerBase,\n RawServerDefault,\n} from 'fastify'\nimport type {
|
|
1
|
+
{"version":3,"file":"core.cjs","sources":["../../src/core.ts"],"sourcesContent":["import type { SwaggerTransform, SwaggerTransformObject } from '@fastify/swagger'\nimport type {\n FastifyPluginAsync,\n FastifyPluginCallback,\n FastifyPluginOptions,\n FastifySchema,\n FastifySchemaCompiler,\n FastifySerializerCompiler,\n FastifyTypeProvider,\n RawServerBase,\n RawServerDefault,\n} from 'fastify'\nimport type { $ZodRegistry, output } from 'zod/v4/core'\nimport { $ZodType, globalRegistry, safeDecode, safeEncode } from 'zod/v4/core'\nimport { createValidationError, InvalidSchemaError, ResponseSerializationError } from './errors'\nimport { generateIORegistries, type SchemaRegistryMeta } from './registry'\nimport { assertIsOpenAPIObject, getJSONSchemaTarget } from './utils'\nimport { type ZodToJsonConfig, zodRegistryToJson, zodSchemaToJson } from './zod-to-json'\n\ntype FreeformRecord = Record<string, any>\n\nconst defaultSkipList = [\n '/documentation/',\n '/documentation/initOAuth',\n '/documentation/json',\n '/documentation/uiConfig',\n '/documentation/yaml',\n '/documentation/*',\n '/documentation/static/*',\n]\n\nexport interface ZodTypeProvider extends FastifyTypeProvider {\n validator: this['schema'] extends $ZodType ? output<this['schema']> : unknown\n serializer: this['schema'] extends $ZodType ? output<this['schema']> : unknown\n}\n\ninterface Schema extends FastifySchema {\n hide?: boolean\n}\n\ntype CreateJsonSchemaTransformOptions = {\n skipList?: readonly string[]\n schemaRegistry?: $ZodRegistry<SchemaRegistryMeta>\n zodToJsonConfig?: ZodToJsonConfig\n}\n\nexport const createJsonSchemaTransform = ({\n skipList = defaultSkipList,\n schemaRegistry = globalRegistry,\n zodToJsonConfig = {},\n}: CreateJsonSchemaTransformOptions): SwaggerTransform<Schema> => {\n return (document) => {\n assertIsOpenAPIObject(document)\n\n const { schema, url } = document\n\n if (!schema) {\n return {\n schema,\n url,\n }\n }\n\n const target = getJSONSchemaTarget(document.openapiObject.openapi)\n const config = {\n target,\n ...zodToJsonConfig,\n }\n\n const { inputRegistry, outputRegistry } = generateIORegistries(schemaRegistry)\n\n const { response, headers, querystring, body, params, hide, ...rest } = schema\n\n const transformed: FreeformRecord = {}\n\n if (skipList.includes(url) || hide) {\n transformed.hide = true\n return { schema: transformed, url }\n }\n\n const zodSchemas: FreeformRecord = { headers, querystring, body, params }\n\n for (const prop in zodSchemas) {\n const zodSchema = zodSchemas[prop]\n if (zodSchema) {\n transformed[prop] = zodSchemaToJson(zodSchema, inputRegistry, 'input', config)\n }\n }\n\n if (response) {\n transformed.response = {}\n\n for (const prop in response as any) {\n const zodSchema = resolveSchema((response as any)[prop])\n\n transformed.response[prop] = zodSchemaToJson(zodSchema, outputRegistry, 'output', config)\n }\n }\n\n for (const prop in rest) {\n const meta = rest[prop as keyof typeof rest]\n if (meta) {\n transformed[prop] = meta\n }\n }\n\n return { schema: transformed, url }\n }\n}\n\nexport const jsonSchemaTransform: SwaggerTransform<Schema> = createJsonSchemaTransform({})\n\ntype CreateJsonSchemaTransformObjectOptions = {\n schemaRegistry?: $ZodRegistry<SchemaRegistryMeta>\n zodToJsonConfig?: ZodToJsonConfig\n}\n\nexport const createJsonSchemaTransformObject =\n ({\n schemaRegistry = globalRegistry,\n zodToJsonConfig = {},\n }: CreateJsonSchemaTransformObjectOptions): SwaggerTransformObject =>\n (document) => {\n assertIsOpenAPIObject(document)\n\n const target = getJSONSchemaTarget(document.openapiObject.openapi)\n const config = {\n target,\n ...zodToJsonConfig,\n }\n\n const { inputRegistry, outputRegistry } = generateIORegistries(schemaRegistry)\n const inputSchemas = zodRegistryToJson(inputRegistry, 'input', config)\n const outputSchemas = zodRegistryToJson(outputRegistry, 'output', config)\n\n return {\n ...document.openapiObject,\n components: {\n ...document.openapiObject.components,\n schemas: {\n ...document.openapiObject.components?.schemas,\n ...inputSchemas,\n ...outputSchemas,\n },\n },\n } as ReturnType<SwaggerTransformObject>\n }\n\nexport const jsonSchemaTransformObject: SwaggerTransformObject = createJsonSchemaTransformObject({})\n\nexport const validatorCompiler: FastifySchemaCompiler<$ZodType> =\n ({ schema }) =>\n (data) => {\n const result = safeDecode(schema, data)\n if (result.error) {\n return { error: createValidationError(result.error) as unknown as Error }\n }\n\n return { value: result.data }\n }\n\nfunction resolveSchema(maybeSchema: $ZodType | { properties: $ZodType }): $ZodType {\n if (maybeSchema instanceof $ZodType) {\n return maybeSchema as $ZodType\n }\n if ('properties' in maybeSchema && maybeSchema.properties instanceof $ZodType) {\n return maybeSchema.properties as $ZodType\n }\n throw new InvalidSchemaError(JSON.stringify(maybeSchema))\n}\n\ntype ReplacerFunction = (this: any, key: string, value: any) => any\n\nexport type ZodSerializerCompilerOptions = {\n replacer?: ReplacerFunction\n}\n\nexport const createSerializerCompiler =\n (\n options?: ZodSerializerCompilerOptions,\n ): FastifySerializerCompiler<$ZodType | { properties: $ZodType }> =>\n ({ schema: maybeSchema, method, url }) =>\n (data) => {\n const schema = resolveSchema(maybeSchema)\n\n const result = safeEncode(schema, data)\n if (result.error) {\n throw new ResponseSerializationError(method, url, { cause: result.error })\n }\n\n return JSON.stringify(result.data, options?.replacer)\n }\n\nexport const serializerCompiler: ReturnType<typeof createSerializerCompiler> =\n createSerializerCompiler({})\n\n/**\n * FastifyPluginCallbackZod with Zod automatic type inference\n *\n * @example\n * ```typescript\n * import { FastifyPluginCallbackZod } from \"fastify-type-provider-zod\"\n *\n * const plugin: FastifyPluginCallbackZod = (fastify, options, done) => {\n * done()\n * }\n * ```\n */\nexport type FastifyPluginCallbackZod<\n Options extends FastifyPluginOptions = Record<never, never>,\n Server extends RawServerBase = RawServerDefault,\n> = FastifyPluginCallback<Options, Server, ZodTypeProvider>\n\n/**\n * FastifyPluginAsyncZod with Zod automatic type inference\n *\n * @example\n * ```typescript\n * import { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\"\n *\n * const plugin: FastifyPluginAsyncZod = async (fastify, options) => {\n * }\n * ```\n */\nexport type FastifyPluginAsyncZod<\n Options extends FastifyPluginOptions = Record<never, never>,\n Server extends RawServerBase = RawServerDefault,\n> = FastifyPluginAsync<Options, Server, ZodTypeProvider>\n"],"names":["globalRegistry","assertIsOpenAPIObject","getJSONSchemaTarget","generateIORegistries","zodSchemaToJson","zodRegistryToJson","safeDecode","createValidationError","$ZodType","InvalidSchemaError","safeEncode","ResponseSerializationError"],"mappings":";;;;;;;AAqBA,MAAM,kBAAkB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAiBO,MAAM,4BAA4B,CAAC;AAAA,EACxC,WAAW;AAAA,EACX,iBAAiBA,KAAAA;AAAAA,EACjB,kBAAkB,CAAA;AACpB,MAAkE;AAChE,SAAO,CAAC,aAAa;AACnBC,UAAAA,sBAAsB,QAAQ;AAE9B,UAAM,EAAE,QAAQ,IAAA,IAAQ;AAExB,QAAI,CAAC,QAAQ;AACX,aAAO;AAAA,QACL;AAAA,QACA;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAM,SAASC,MAAAA,oBAAoB,SAAS,cAAc,OAAO;AACjE,UAAM,SAAS;AAAA,MACb;AAAA,MACA,GA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 -1,6 +1,5 @@
|
|
|
1
1
|
import type { SwaggerTransform, SwaggerTransformObject } from "@fastify/swagger";
|
|
2
|
-
import type { FastifyPluginAsync, FastifyPluginCallback, FastifyPluginOptions, FastifySchema, FastifySchemaCompiler, FastifyTypeProvider, RawServerBase, RawServerDefault } from "fastify";
|
|
3
|
-
import type { FastifySerializerCompiler } from "fastify/types/schema";
|
|
2
|
+
import type { FastifyPluginAsync, FastifyPluginCallback, FastifyPluginOptions, FastifySchema, FastifySchemaCompiler, FastifySerializerCompiler, FastifyTypeProvider, RawServerBase, RawServerDefault } from "fastify";
|
|
4
3
|
import type { $ZodRegistry, output } from "zod/v4/core";
|
|
5
4
|
import { $ZodType } from "zod/v4/core";
|
|
6
5
|
import { type SchemaRegistryMeta } from "../cjs/registry.cjs";
|
package/dist/esm/core.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { SwaggerTransform, SwaggerTransformObject } from "@fastify/swagger";
|
|
2
|
-
import type { FastifyPluginAsync, FastifyPluginCallback, FastifyPluginOptions, FastifySchema, FastifySchemaCompiler, FastifyTypeProvider, RawServerBase, RawServerDefault } from "fastify";
|
|
3
|
-
import type { FastifySerializerCompiler } from "fastify/types/schema";
|
|
2
|
+
import type { FastifyPluginAsync, FastifyPluginCallback, FastifyPluginOptions, FastifySchema, FastifySchemaCompiler, FastifySerializerCompiler, FastifyTypeProvider, RawServerBase, RawServerDefault } from "fastify";
|
|
4
3
|
import type { $ZodRegistry, output } from "zod/v4/core";
|
|
5
4
|
import { $ZodType } from "zod/v4/core";
|
|
6
5
|
import { type SchemaRegistryMeta } from "../esm/registry.js";
|
package/dist/esm/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sources":["../../src/core.ts"],"sourcesContent":["import type { SwaggerTransform, SwaggerTransformObject } from '@fastify/swagger'\nimport type {\n FastifyPluginAsync,\n FastifyPluginCallback,\n FastifyPluginOptions,\n FastifySchema,\n FastifySchemaCompiler,\n FastifyTypeProvider,\n RawServerBase,\n RawServerDefault,\n} from 'fastify'\nimport type {
|
|
1
|
+
{"version":3,"file":"core.js","sources":["../../src/core.ts"],"sourcesContent":["import type { SwaggerTransform, SwaggerTransformObject } from '@fastify/swagger'\nimport type {\n FastifyPluginAsync,\n FastifyPluginCallback,\n FastifyPluginOptions,\n FastifySchema,\n FastifySchemaCompiler,\n FastifySerializerCompiler,\n FastifyTypeProvider,\n RawServerBase,\n RawServerDefault,\n} from 'fastify'\nimport type { $ZodRegistry, output } from 'zod/v4/core'\nimport { $ZodType, globalRegistry, safeDecode, safeEncode } from 'zod/v4/core'\nimport { createValidationError, InvalidSchemaError, ResponseSerializationError } from './errors'\nimport { generateIORegistries, type SchemaRegistryMeta } from './registry'\nimport { assertIsOpenAPIObject, getJSONSchemaTarget } from './utils'\nimport { type ZodToJsonConfig, zodRegistryToJson, zodSchemaToJson } from './zod-to-json'\n\ntype FreeformRecord = Record<string, any>\n\nconst defaultSkipList = [\n '/documentation/',\n '/documentation/initOAuth',\n '/documentation/json',\n '/documentation/uiConfig',\n '/documentation/yaml',\n '/documentation/*',\n '/documentation/static/*',\n]\n\nexport interface ZodTypeProvider extends FastifyTypeProvider {\n validator: this['schema'] extends $ZodType ? output<this['schema']> : unknown\n serializer: this['schema'] extends $ZodType ? output<this['schema']> : unknown\n}\n\ninterface Schema extends FastifySchema {\n hide?: boolean\n}\n\ntype CreateJsonSchemaTransformOptions = {\n skipList?: readonly string[]\n schemaRegistry?: $ZodRegistry<SchemaRegistryMeta>\n zodToJsonConfig?: ZodToJsonConfig\n}\n\nexport const createJsonSchemaTransform = ({\n skipList = defaultSkipList,\n schemaRegistry = globalRegistry,\n zodToJsonConfig = {},\n}: CreateJsonSchemaTransformOptions): SwaggerTransform<Schema> => {\n return (document) => {\n assertIsOpenAPIObject(document)\n\n const { schema, url } = document\n\n if (!schema) {\n return {\n schema,\n url,\n }\n }\n\n const target = getJSONSchemaTarget(document.openapiObject.openapi)\n const config = {\n target,\n ...zodToJsonConfig,\n }\n\n const { inputRegistry, outputRegistry } = generateIORegistries(schemaRegistry)\n\n const { response, headers, querystring, body, params, hide, ...rest } = schema\n\n const transformed: FreeformRecord = {}\n\n if (skipList.includes(url) || hide) {\n transformed.hide = true\n return { schema: transformed, url }\n }\n\n const zodSchemas: FreeformRecord = { headers, querystring, body, params }\n\n for (const prop in zodSchemas) {\n const zodSchema = zodSchemas[prop]\n if (zodSchema) {\n transformed[prop] = zodSchemaToJson(zodSchema, inputRegistry, 'input', config)\n }\n }\n\n if (response) {\n transformed.response = {}\n\n for (const prop in response as any) {\n const zodSchema = resolveSchema((response as any)[prop])\n\n transformed.response[prop] = zodSchemaToJson(zodSchema, outputRegistry, 'output', config)\n }\n }\n\n for (const prop in rest) {\n const meta = rest[prop as keyof typeof rest]\n if (meta) {\n transformed[prop] = meta\n }\n }\n\n return { schema: transformed, url }\n }\n}\n\nexport const jsonSchemaTransform: SwaggerTransform<Schema> = createJsonSchemaTransform({})\n\ntype CreateJsonSchemaTransformObjectOptions = {\n schemaRegistry?: $ZodRegistry<SchemaRegistryMeta>\n zodToJsonConfig?: ZodToJsonConfig\n}\n\nexport const createJsonSchemaTransformObject =\n ({\n schemaRegistry = globalRegistry,\n zodToJsonConfig = {},\n }: CreateJsonSchemaTransformObjectOptions): SwaggerTransformObject =>\n (document) => {\n assertIsOpenAPIObject(document)\n\n const target = getJSONSchemaTarget(document.openapiObject.openapi)\n const config = {\n target,\n ...zodToJsonConfig,\n }\n\n const { inputRegistry, outputRegistry } = generateIORegistries(schemaRegistry)\n const inputSchemas = zodRegistryToJson(inputRegistry, 'input', config)\n const outputSchemas = zodRegistryToJson(outputRegistry, 'output', config)\n\n return {\n ...document.openapiObject,\n components: {\n ...document.openapiObject.components,\n schemas: {\n ...document.openapiObject.components?.schemas,\n ...inputSchemas,\n ...outputSchemas,\n },\n },\n } as ReturnType<SwaggerTransformObject>\n }\n\nexport const jsonSchemaTransformObject: SwaggerTransformObject = createJsonSchemaTransformObject({})\n\nexport const validatorCompiler: FastifySchemaCompiler<$ZodType> =\n ({ schema }) =>\n (data) => {\n const result = safeDecode(schema, data)\n if (result.error) {\n return { error: createValidationError(result.error) as unknown as Error }\n }\n\n return { value: result.data }\n }\n\nfunction resolveSchema(maybeSchema: $ZodType | { properties: $ZodType }): $ZodType {\n if (maybeSchema instanceof $ZodType) {\n return maybeSchema as $ZodType\n }\n if ('properties' in maybeSchema && maybeSchema.properties instanceof $ZodType) {\n return maybeSchema.properties as $ZodType\n }\n throw new InvalidSchemaError(JSON.stringify(maybeSchema))\n}\n\ntype ReplacerFunction = (this: any, key: string, value: any) => any\n\nexport type ZodSerializerCompilerOptions = {\n replacer?: ReplacerFunction\n}\n\nexport const createSerializerCompiler =\n (\n options?: ZodSerializerCompilerOptions,\n ): FastifySerializerCompiler<$ZodType | { properties: $ZodType }> =>\n ({ schema: maybeSchema, method, url }) =>\n (data) => {\n const schema = resolveSchema(maybeSchema)\n\n const result = safeEncode(schema, data)\n if (result.error) {\n throw new ResponseSerializationError(method, url, { cause: result.error })\n }\n\n return JSON.stringify(result.data, options?.replacer)\n }\n\nexport const serializerCompiler: ReturnType<typeof createSerializerCompiler> =\n createSerializerCompiler({})\n\n/**\n * FastifyPluginCallbackZod with Zod automatic type inference\n *\n * @example\n * ```typescript\n * import { FastifyPluginCallbackZod } from \"fastify-type-provider-zod\"\n *\n * const plugin: FastifyPluginCallbackZod = (fastify, options, done) => {\n * done()\n * }\n * ```\n */\nexport type FastifyPluginCallbackZod<\n Options extends FastifyPluginOptions = Record<never, never>,\n Server extends RawServerBase = RawServerDefault,\n> = FastifyPluginCallback<Options, Server, ZodTypeProvider>\n\n/**\n * FastifyPluginAsyncZod with Zod automatic type inference\n *\n * @example\n * ```typescript\n * import { FastifyPluginAsyncZod } from \"fastify-type-provider-zod\"\n *\n * const plugin: FastifyPluginAsyncZod = async (fastify, options) => {\n * }\n * ```\n */\nexport type FastifyPluginAsyncZod<\n Options extends FastifyPluginOptions = Record<never, never>,\n Server extends RawServerBase = RawServerDefault,\n> = FastifyPluginAsync<Options, Server, ZodTypeProvider>\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,kBAAkB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAiBO,MAAM,4BAA4B,CAAC;AAAA,EACxC,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,kBAAkB,CAAA;AACpB,MAAkE;AAChE,SAAO,CAAC,aAAa;AACnB,0BAAsB,QAAQ;AAE9B,UAAM,EAAE,QAAQ,IAAA,IAAQ;AAExB,QAAI,CAAC,QAAQ;AACX,aAAO;AAAA,QACL;AAAA,QACA;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAM,SAAS,oBAAoB,SAAS,cAAc,OAAO;AACjE,UAAM,SAAS;AAAA,MACb;AAAA,MACA,GAAG;AAAA,IAAA;AAGL,UAAM,EAAE,eAAe,mBAAmB,qBAAqB,cAAc;AAE7E,UAAM,EAAE,UAAU,SAAS,aAAa,MAAM,QAAQ,MAAM,GAAG,KAAA,IAAS;AAExE,UAAM,cAA8B,CAAA;AAEpC,QAAI,SAAS,SAAS,GAAG,KAAK,MAAM;AAClC,kBAAY,OAAO;AACnB,aAAO,EAAE,QAAQ,aAAa,IAAA;AAAA,IAChC;AAEA,UAAM,aAA6B,EAAE,SAAS,aAAa,MAAM,OAAA;AAEjE,eAAW,QAAQ,YAAY;AAC7B,YAAM,YAAY,WAAW,IAAI;AACjC,UAAI,WAAW;AACb,oBAAY,IAAI,IAAI,gBAAgB,WAAW,eAAe,SAAS,MAAM;AAAA,MAC/E;AAAA,IACF;AAEA,QAAI,UAAU;AACZ,kBAAY,WAAW,CAAA;AAEvB,iBAAW,QAAQ,UAAiB;AAClC,cAAM,YAAY,cAAe,SAAiB,IAAI,CAAC;AAEvD,oBAAY,SAAS,IAAI,IAAI,gBAAgB,WAAW,gBAAgB,UAAU,MAAM;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AAM,IAAI,mBAAmB,KAAK,UAAU,WAAW,CAAC;AAC1D;AAQO,MAAM,2BACX,CACE,YAEF,CAAC,EAAE,QAAQ,aAAa,QAAQ,UAChC,CAAC,SAAS;AACR,QAAM,SAAS,cAAc,WAAW;AAExC,QAAM,SAAS,WAAW,QAAQ,IAAI;AACtC,MAAI,OAAO,OAAO;AAChB,UAAM,IAAI,2BAA2B,QAAQ,KAAK,EAAE,OAAO,OAAO,OAAO;AAAA,EAC3E;AAEA,SAAO,KAAK,UAAU,OAAO,MAAM,SAAS,QAAQ;AACtD;AAEK,MAAM,qBACX,yBAAyB,CAAA,CAAE;"}
|
package/package.json
CHANGED
package/src/core.ts
CHANGED
|
@@ -5,11 +5,11 @@ import type {
|
|
|
5
5
|
FastifyPluginOptions,
|
|
6
6
|
FastifySchema,
|
|
7
7
|
FastifySchemaCompiler,
|
|
8
|
+
FastifySerializerCompiler,
|
|
8
9
|
FastifyTypeProvider,
|
|
9
10
|
RawServerBase,
|
|
10
11
|
RawServerDefault,
|
|
11
12
|
} from 'fastify'
|
|
12
|
-
import type { FastifySerializerCompiler } from 'fastify/types/schema'
|
|
13
13
|
import type { $ZodRegistry, output } from 'zod/v4/core'
|
|
14
14
|
import { $ZodType, globalRegistry, safeDecode, safeEncode } from 'zod/v4/core'
|
|
15
15
|
import { createValidationError, InvalidSchemaError, ResponseSerializationError } from './errors'
|