@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.
- package/dist/esm/utils.d.ts +10 -4
- package/dist/esm/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/utils.ts +8 -6
package/dist/esm/utils.d.ts
CHANGED
|
@@ -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,
|
|
11
|
-
[K in keyof T]: T[K] extends
|
|
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 {};
|
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\";\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
|
|
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
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
|
|
35
|
-
>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
};
|