@proofkit/fmdapi 5.0.1-beta.1 → 5.0.1-beta.2
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/esm/utils.d.ts +5 -0
- package/dist/esm/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/utils.ts +10 -0
package/dist/esm/utils.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
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";
|
|
2
4
|
type TransformedFields<T extends Record<string, any>> = U.Merge<{
|
|
3
5
|
[Field in keyof T]: {
|
|
4
6
|
[Key in Field extends string ? L.Last<S.Split<Field, "::">> : Field]: T[Field];
|
|
5
7
|
};
|
|
6
8
|
}[keyof T]>;
|
|
7
9
|
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]>;
|
|
12
|
+
};
|
|
8
13
|
export {};
|
package/dist/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import type { S, L, U } from \"ts-toolbelt\";\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"],"names":[],"mappings":"
|
|
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;"}
|
package/package.json
CHANGED
package/src/utils.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { S, L, U } from "ts-toolbelt";
|
|
2
|
+
import type * as z3 from "zod/v3";
|
|
3
|
+
import type * as z4 from "zod/v4/core";
|
|
2
4
|
|
|
3
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
6
|
type TransformedFields<T extends Record<string, any>> = U.Merge<
|
|
@@ -27,3 +29,11 @@ export function removeFMTableNames<T extends Record<string, any>>(
|
|
|
27
29
|
}
|
|
28
30
|
return newObj;
|
|
29
31
|
}
|
|
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]>;
|
|
39
|
+
};
|