@proofkit/fmdapi 5.0.1-beta.2 → 5.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.
@@ -1,13 +1,19 @@
1
1
  import { S, L, U } from 'ts-toolbelt';
2
- import type * as z3 from "zod/v3";
3
- import type * as z4 from "zod/v4/core";
4
2
  type TransformedFields<T extends Record<string, any>> = U.Merge<{
5
3
  [Field in keyof T]: {
6
4
  [Key in Field extends string ? L.Last<S.Split<Field, "::">> : Field]: T[Field];
7
5
  };
8
6
  }[keyof T]>;
9
7
  export declare function removeFMTableNames<T extends Record<string, any>>(obj: T): TransformedFields<T>;
10
- export type InferZodPortals<T extends Record<string, z3.AnyZodObject | z4.$ZodObject>> = {
11
- [K in keyof T]: T[K] extends z3.AnyZodObject ? z3.infer<T[K]> : z4.infer<T[K]>;
8
+ export type InferZodPortals<T extends Record<string, any>> = {
9
+ [K in keyof T]: T[K] extends {
10
+ _def: any;
11
+ parse: (...args: any[]) => any;
12
+ } ? ReturnType<T[K]["parse"]> : T[K] extends {
13
+ _def: any;
14
+ safeParse: (...args: any[]) => any;
15
+ } ? T[K] extends {
16
+ parse: (...args: any[]) => any;
17
+ } ? ReturnType<T[K]["parse"]> : any : never;
12
18
  };
13
19
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import type { S, L, U } from \"ts-toolbelt\";\nimport type * as z3 from \"zod/v3\";\nimport type * as z4 from \"zod/v4/core\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype TransformedFields<T extends Record<string, any>> = U.Merge<\n {\n [Field in keyof T]: {\n [Key in Field extends string\n ? L.Last<S.Split<Field, \"::\">>\n : Field]: T[Field];\n };\n }[keyof T]\n>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function removeFMTableNames<T extends Record<string, any>>(\n obj: T,\n): TransformedFields<T> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const newObj: any = {};\n for (const key in obj) {\n if (key.includes(\"::\")) {\n const newKey = key.split(\"::\")[1];\n newObj[newKey as keyof TransformedFields<T>] = obj[key];\n } else {\n newObj[key] = obj[key];\n }\n }\n return newObj;\n}\n\nexport type InferZodPortals<\n T extends Record<string, z3.AnyZodObject | z4.$ZodObject>,\n> = {\n [K in keyof T]: T[K] extends z3.AnyZodObject\n ? z3.infer<T[K]>\n : z4.infer<T[K]>;\n};\n"],"names":[],"mappings":"AAgBO,SAAS,mBACd,KACsB;AAEtB,QAAM,SAAc,CAAC;AACrB,aAAW,OAAO,KAAK;AACjB,QAAA,IAAI,SAAS,IAAI,GAAG;AACtB,YAAM,SAAS,IAAI,MAAM,IAAI,EAAE,CAAC;AACzB,aAAA,MAAoC,IAAI,IAAI,GAAG;AAAA,IAAA,OACjD;AACE,aAAA,GAAG,IAAI,IAAI,GAAG;AAAA,IAAA;AAAA,EACvB;AAEK,SAAA;AACT;"}
1
+ {"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import type { S, L, U } from \"ts-toolbelt\";\nimport type * as z3 from \"zod/v3\";\nimport type * as z4 from \"zod/v4/core\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype TransformedFields<T extends Record<string, any>> = U.Merge<\n {\n [Field in keyof T]: {\n [Key in Field extends string\n ? L.Last<S.Split<Field, \"::\">>\n : Field]: T[Field];\n };\n }[keyof T]\n>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function removeFMTableNames<T extends Record<string, any>>(\n obj: T,\n): TransformedFields<T> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const newObj: any = {};\n for (const key in obj) {\n if (key.includes(\"::\")) {\n const newKey = key.split(\"::\")[1];\n newObj[newKey as keyof TransformedFields<T>] = obj[key];\n } else {\n newObj[key] = obj[key];\n }\n }\n return newObj;\n}\n\nexport type InferZodPortals<T extends Record<string, any>> = {\n [K in keyof T]: T[K] extends { _def: any; parse: (...args: any[]) => any }\n ? ReturnType<T[K][\"parse\"]>\n : T[K] extends { _def: any; safeParse: (...args: any[]) => any }\n ? T[K] extends { parse: (...args: any[]) => any }\n ? ReturnType<T[K][\"parse\"]>\n : any\n : never;\n};\n"],"names":[],"mappings":"AAgBO,SAAS,mBACd,KACsB;AAEtB,QAAM,SAAc,CAAC;AACrB,aAAW,OAAO,KAAK;AACjB,QAAA,IAAI,SAAS,IAAI,GAAG;AACtB,YAAM,SAAS,IAAI,MAAM,IAAI,EAAE,CAAC;AACzB,aAAA,MAAoC,IAAI,IAAI,GAAG;AAAA,IAAA,OACjD;AACE,aAAA,GAAG,IAAI,IAAI,GAAG;AAAA,IAAA;AAAA,EACvB;AAEK,SAAA;AACT;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proofkit/fmdapi",
3
- "version": "5.0.1-beta.2",
3
+ "version": "5.0.1",
4
4
  "description": "FileMaker Data API client",
5
5
  "repository": "git@github.com:proofgeist/fm-dapi.git",
6
6
  "author": "Eric <37158449+eluce2@users.noreply.github.com>",
package/src/utils.ts CHANGED
@@ -30,10 +30,12 @@ export function removeFMTableNames<T extends Record<string, any>>(
30
30
  return newObj;
31
31
  }
32
32
 
33
- export type InferZodPortals<
34
- T extends Record<string, z3.AnyZodObject | z4.$ZodObject>,
35
- > = {
36
- [K in keyof T]: T[K] extends z3.AnyZodObject
37
- ? z3.infer<T[K]>
38
- : z4.infer<T[K]>;
33
+ export type InferZodPortals<T extends Record<string, any>> = {
34
+ [K in keyof T]: T[K] extends { _def: any; parse: (...args: any[]) => any }
35
+ ? ReturnType<T[K]["parse"]>
36
+ : T[K] extends { _def: any; safeParse: (...args: any[]) => any }
37
+ ? T[K] extends { parse: (...args: any[]) => any }
38
+ ? ReturnType<T[K]["parse"]>
39
+ : any
40
+ : never;
39
41
  };