@cabloy/zod-query 1.0.16 → 1.0.17

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/dist/lib/query.js CHANGED
@@ -106,7 +106,7 @@ const _parseArray = z.ZodArray.prototype._parse;
106
106
  z.ZodArray.prototype._parse = function (input) {
107
107
  _coerceWithNil(input, () => {
108
108
  if (typeof input.data === 'string') {
109
- if (input.data[0] === '[') {
109
+ if (input.data.startsWith('[') && input.data.endsWith(']')) {
110
110
  input.data = JSON.parse(input.data);
111
111
  }
112
112
  else {
@@ -1,3 +1,4 @@
1
+ import type z from 'zod';
1
2
  export declare class ZodMetadata {
2
3
  static unwrapUntil(schema: any, typeName?: any): any;
3
4
  static unwrapChained(schema: any): any;
@@ -5,5 +6,7 @@ export declare class ZodMetadata {
5
6
  static getInternalMetadata(zodSchema: any): any;
6
7
  static getLazySchema(zodSchema: any): any;
7
8
  static getRefId(zodSchema: any): any;
9
+ static getFieldSchema(schema: any, key: string): z.ZodSchema;
10
+ static getOpenapiMetadata(schema: any): any;
8
11
  }
9
12
  export declare function isZodType(schema: any, typeName: any): boolean;
@@ -42,6 +42,12 @@ export class ZodMetadata {
42
42
  // eslint-disable-next-line
43
43
  return (_a = this.getInternalMetadata(zodSchema)) === null || _a === void 0 ? void 0 : _a.refId;
44
44
  }
45
+ static getFieldSchema(schema, key) {
46
+ return schema.shape[key];
47
+ }
48
+ static getOpenapiMetadata(schema) {
49
+ return schema._def.openapi?.metadata;
50
+ }
45
51
  }
46
52
  export function isZodType(schema, typeName) {
47
53
  let _a;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cabloy/zod-query",
3
3
  "type": "module",
4
- "version": "1.0.16",
4
+ "version": "1.0.17",
5
5
  "description": "zod-query",
6
6
  "publishConfig": {
7
7
  "access": "public"