@trpc-panel/core 1.0.2 → 1.0.4

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.
Files changed (32) hide show
  1. package/README.md +13 -3
  2. package/lib/index.js +19063 -365
  3. package/lib/index.mjs +19030 -362
  4. package/lib/react-app/bundle.js +759 -81
  5. package/lib/react-app/index.css +270 -54
  6. package/lib/scripts/build-react.d.ts +1 -0
  7. package/lib/scripts/debug-render.d.ts +1 -0
  8. package/lib/src/meta.d.ts +1 -5
  9. package/lib/src/parse/__tests__/utils/router.d.ts +13 -53
  10. package/lib/src/parse/input-mappers/zod/parsers/parseZodArrayDef.d.ts +13 -2
  11. package/lib/src/parse/input-mappers/zod/parsers/parseZodBigIntDef.d.ts +7 -3
  12. package/lib/src/parse/input-mappers/zod/parsers/parseZodBooleanFieldDef.d.ts +6 -2
  13. package/lib/src/parse/input-mappers/zod/parsers/parseZodBrandedDef.d.ts +13 -2
  14. package/lib/src/parse/input-mappers/zod/parsers/parseZodDefaultDef.d.ts +14 -2
  15. package/lib/src/parse/input-mappers/zod/parsers/parseZodDiscriminatedUnionDef.d.ts +7 -14
  16. package/lib/src/parse/input-mappers/zod/parsers/parseZodEffectsDef.d.ts +27 -2
  17. package/lib/src/parse/input-mappers/zod/parsers/parseZodEnumDef.d.ts +8 -2
  18. package/lib/src/parse/input-mappers/zod/parsers/parseZodLiteralDef.d.ts +8 -2
  19. package/lib/src/parse/input-mappers/zod/parsers/parseZodNullDef.d.ts +7 -3
  20. package/lib/src/parse/input-mappers/zod/parsers/parseZodNullableDef.d.ts +13 -2
  21. package/lib/src/parse/input-mappers/zod/parsers/parseZodNumberDef.d.ts +6 -2
  22. package/lib/src/parse/input-mappers/zod/parsers/parseZodObjectDef.d.ts +14 -2
  23. package/lib/src/parse/input-mappers/zod/parsers/parseZodOptionalDef.d.ts +14 -3
  24. package/lib/src/parse/input-mappers/zod/parsers/parseZodPromiseDef.d.ts +13 -2
  25. package/lib/src/parse/input-mappers/zod/parsers/parseZodStringDef.d.ts +6 -2
  26. package/lib/src/parse/input-mappers/zod/parsers/parseZodUndefinedDef.d.ts +7 -3
  27. package/lib/src/parse/input-mappers/zod/parsers/parseZodVoidDef.d.ts +7 -3
  28. package/lib/src/parse/input-mappers/zod/selector.d.ts +2 -1
  29. package/lib/src/parse/input-mappers/zod/zod-types.d.ts +5 -3
  30. package/lib/src/parse/parseNodeTypes.d.ts +2 -2
  31. package/lib/src/parse/routerType.d.ts +56 -400
  32. package/package.json +13 -18
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/lib/src/meta.d.ts CHANGED
@@ -1,9 +1,5 @@
1
1
  import { z } from "zod";
2
2
  export declare const TRPCPanelMetaSchema: z.ZodObject<{
3
3
  description: z.ZodOptional<z.ZodString>;
4
- }, "strip", z.ZodTypeAny, {
5
- description?: string | undefined;
6
- }, {
7
- description?: string | undefined;
8
- }>;
4
+ }, z.core.$strip>;
9
5
  export type TRPCPanelMeta = z.infer<typeof TRPCPanelMetaSchema>;
@@ -17,64 +17,24 @@ export declare const parseTestRouterInputSchema: z.ZodObject<{
17
17
  expectedAgeOfDeath: z.ZodOptional<z.ZodNumber>;
18
18
  object: z.ZodObject<{
19
19
  nestedId: z.ZodString;
20
- }, "strip", z.ZodTypeAny, {
21
- nestedId: string;
22
- }, {
23
- nestedId: string;
24
- }>;
25
- du: z.ZodDiscriminatedUnion<"d", [z.ZodObject<{
20
+ }, z.core.$strip>;
21
+ du: z.ZodDiscriminatedUnion<[z.ZodObject<{
26
22
  d: z.ZodLiteral<"one">;
27
23
  oneProps: z.ZodString;
28
- }, "strip", z.ZodTypeAny, {
29
- d: "one";
30
- oneProps: string;
31
- }, {
32
- d: "one";
33
- oneProps: string;
34
- }>, z.ZodObject<{
24
+ }, z.core.$strip>, z.ZodObject<{
35
25
  d: z.ZodLiteral<"two">;
36
- }, "strip", z.ZodTypeAny, {
37
- d: "two";
38
- }, {
39
- d: "two";
40
- }>]>;
41
- }, "strip", z.ZodTypeAny, {
42
- object: {
43
- nestedId: string;
44
- };
45
- id: string;
46
- age: number;
47
- du: {
48
- d: "one";
49
- oneProps: string;
50
- } | {
51
- d: "two";
52
- };
53
- expectedAgeOfDeath?: number | undefined;
54
- }, {
55
- object: {
56
- nestedId: string;
57
- };
58
- id: string;
59
- age: number;
60
- du: {
61
- d: "one";
62
- oneProps: string;
63
- } | {
64
- d: "two";
65
- };
66
- expectedAgeOfDeath?: number | undefined;
67
- }>;
26
+ }, z.core.$strip>], "d">;
27
+ }, z.core.$strip>;
68
28
  export declare const expectedTestRouterInputParsedNode: ObjectNode;
69
29
  export declare const testQueryExpectedParseResult: ParsedProcedure;
70
30
  export declare const testMutationExpectedParseResult: ParsedProcedure;
71
31
  export declare const testQuery: import("@trpc/server").TRPCQueryProcedure<{
72
32
  input: {
33
+ id: string;
34
+ age: number;
73
35
  object: {
74
36
  nestedId: string;
75
37
  };
76
- id: string;
77
- age: number;
78
38
  du: {
79
39
  d: "one";
80
40
  oneProps: string;
@@ -90,11 +50,11 @@ export declare const testQuery: import("@trpc/server").TRPCQueryProcedure<{
90
50
  }>;
91
51
  export declare const testMutation: import("@trpc/server").TRPCMutationProcedure<{
92
52
  input: {
53
+ id: string;
54
+ age: number;
93
55
  object: {
94
56
  nestedId: string;
95
57
  };
96
- id: string;
97
- age: number;
98
58
  du: {
99
59
  d: "one";
100
60
  oneProps: string;
@@ -118,11 +78,11 @@ export declare const parseTestRouter: import("@trpc/server").TRPCBuiltRouter<{
118
78
  }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
119
79
  testQuery: import("@trpc/server").TRPCQueryProcedure<{
120
80
  input: {
81
+ id: string;
82
+ age: number;
121
83
  object: {
122
84
  nestedId: string;
123
85
  };
124
- id: string;
125
- age: number;
126
86
  du: {
127
87
  d: "one";
128
88
  oneProps: string;
@@ -138,11 +98,11 @@ export declare const parseTestRouter: import("@trpc/server").TRPCBuiltRouter<{
138
98
  }>;
139
99
  testMutation: import("@trpc/server").TRPCMutationProcedure<{
140
100
  input: {
101
+ id: string;
102
+ age: number;
141
103
  object: {
142
104
  nestedId: string;
143
105
  };
144
- id: string;
145
- age: number;
146
106
  du: {
147
107
  d: "one";
148
108
  oneProps: string;
@@ -1,3 +1,14 @@
1
- import { ZodArrayDef } from "zod";
2
1
  import { ArrayNode, ParseFunction } from "../../../parseNodeTypes";
3
- export declare const parseZodArrayDef: ParseFunction<ZodArrayDef, ArrayNode>;
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4ArrayDef extends ZodDefWithType {
4
+ type: "array";
5
+ element: {
6
+ _def?: unknown;
7
+ def?: unknown;
8
+ _zod?: {
9
+ def?: unknown;
10
+ };
11
+ };
12
+ }
13
+ export declare const parseZodArrayDef: ParseFunction<ZodV4ArrayDef, ArrayNode>;
14
+ export {};
@@ -1,3 +1,7 @@
1
- import { ParsedInputNode, ParseReferences } from "@src/parse/parseNodeTypes";
2
- import { ZodBigIntDef } from "zod";
3
- export declare function parseZodBigIntDef(def: ZodBigIntDef, refs: ParseReferences): ParsedInputNode;
1
+ import { NumberNode, ParseFunction } from "../../../parseNodeTypes";
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4BigIntDef extends ZodDefWithType {
4
+ type: "bigint";
5
+ }
6
+ export declare const parseZodBigIntDef: ParseFunction<ZodV4BigIntDef, NumberNode>;
7
+ export {};
@@ -1,3 +1,7 @@
1
- import { ZodBooleanDef } from "zod";
2
1
  import { BooleanNode, ParseFunction } from "../../../parseNodeTypes";
3
- export declare const parseZodBooleanFieldDef: ParseFunction<ZodBooleanDef, BooleanNode>;
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4BooleanDef extends ZodDefWithType {
4
+ type: "boolean";
5
+ }
6
+ export declare const parseZodBooleanFieldDef: ParseFunction<ZodV4BooleanDef, BooleanNode>;
7
+ export {};
@@ -1,3 +1,14 @@
1
1
  import { ParsedInputNode, ParseReferences } from "@src/parse/parseNodeTypes";
2
- import { AnyZodObject, ZodBrandedDef } from "zod";
3
- export declare function parseZodBrandedDef(def: ZodBrandedDef<AnyZodObject>, refs: ParseReferences): ParsedInputNode;
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4BrandedDef extends ZodDefWithType {
4
+ type: "branded";
5
+ innerType?: {
6
+ _def?: unknown;
7
+ def?: unknown;
8
+ _zod?: {
9
+ def?: unknown;
10
+ };
11
+ };
12
+ }
13
+ export declare function parseZodBrandedDef(def: ZodV4BrandedDef, refs: ParseReferences): ParsedInputNode;
14
+ export {};
@@ -1,3 +1,15 @@
1
1
  import { ParsedInputNode, ParseReferences } from "@src/parse/parseNodeTypes";
2
- import { ZodDefaultDef } from "zod";
3
- export declare function parseZodDefaultDef(def: ZodDefaultDef, refs: ParseReferences): ParsedInputNode;
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4DefaultDef extends ZodDefWithType {
4
+ type: "default";
5
+ innerType: {
6
+ _def?: unknown;
7
+ def?: unknown;
8
+ _zod?: {
9
+ def?: unknown;
10
+ };
11
+ };
12
+ defaultValue: unknown;
13
+ }
14
+ export declare function parseZodDefaultDef(def: ZodV4DefaultDef, refs: ParseReferences): ParsedInputNode;
15
+ export {};
@@ -1,16 +1,9 @@
1
- import { AnyZodObject } from "zod";
2
1
  import { DiscriminatedUnionNode, ParseFunction } from "../../../parseNodeTypes";
3
- type OptionsMap = Map<string, AnyZodObject>;
4
- type ZodDiscriminatedUnionThreePointTwenty = {
5
- optionsMap: OptionsMap;
6
- discriminator: string;
7
- description?: string;
8
- };
9
- type ZodDiscriminatedUnionPreThreePointTwenty = {
10
- options: OptionsMap;
11
- discriminator: string;
12
- description?: string;
13
- };
14
- export type ZodDiscriminatedUnionDefUnversioned = ZodDiscriminatedUnionPreThreePointTwenty | ZodDiscriminatedUnionThreePointTwenty;
2
+ import { ZodDefWithType } from "../zod-types";
3
+ export interface ZodDiscriminatedUnionDefUnversioned extends ZodDefWithType {
4
+ type: "union";
5
+ discriminator?: string;
6
+ options?: unknown[];
7
+ optionsMap?: Map<string, unknown>;
8
+ }
15
9
  export declare const parseZodDiscriminatedUnionDef: ParseFunction<ZodDiscriminatedUnionDefUnversioned, DiscriminatedUnionNode>;
16
- export {};
@@ -1,3 +1,28 @@
1
1
  import { ParsedInputNode, ParseReferences } from "@src/parse/parseNodeTypes";
2
- import { ZodEffectsDef } from "zod";
3
- export declare function parseZodEffectsDef(def: ZodEffectsDef, refs: ParseReferences): ParsedInputNode;
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4EffectsDef extends ZodDefWithType {
4
+ type: "effects" | "pipe";
5
+ schema?: {
6
+ _def?: unknown;
7
+ def?: unknown;
8
+ _zod?: {
9
+ def?: unknown;
10
+ };
11
+ };
12
+ in?: {
13
+ _def?: unknown;
14
+ def?: unknown;
15
+ _zod?: {
16
+ def?: unknown;
17
+ };
18
+ };
19
+ out?: {
20
+ _def?: unknown;
21
+ def?: unknown;
22
+ _zod?: {
23
+ def?: unknown;
24
+ };
25
+ };
26
+ }
27
+ export declare function parseZodEffectsDef(def: ZodV4EffectsDef, refs: ParseReferences): ParsedInputNode;
28
+ export {};
@@ -1,3 +1,9 @@
1
- import { ZodEnumDef } from "zod";
2
1
  import { EnumNode, ParseFunction } from "../../../parseNodeTypes";
3
- export declare const parseZodEnumDef: ParseFunction<ZodEnumDef, EnumNode>;
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4EnumDef extends ZodDefWithType {
4
+ type: "enum";
5
+ values?: readonly string[];
6
+ entries?: Record<string, string>;
7
+ }
8
+ export declare const parseZodEnumDef: ParseFunction<ZodV4EnumDef, EnumNode>;
9
+ export {};
@@ -1,3 +1,9 @@
1
- import { ZodLiteralDef } from "zod";
2
1
  import { LiteralNode, ParseFunction } from "../../../parseNodeTypes";
3
- export declare const parseZodLiteralDef: ParseFunction<ZodLiteralDef, LiteralNode>;
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4LiteralDef extends ZodDefWithType {
4
+ type: "literal";
5
+ value?: string | number | boolean | bigint | null | undefined;
6
+ values?: readonly (string | number | boolean | bigint | null | undefined)[];
7
+ }
8
+ export declare const parseZodLiteralDef: ParseFunction<ZodV4LiteralDef, LiteralNode>;
9
+ export {};
@@ -1,3 +1,7 @@
1
- import { ParsedInputNode, ParseReferences } from "@src/parse/parseNodeTypes";
2
- import { ZodNullDef } from "zod";
3
- export declare function parseZodNullDef(def: ZodNullDef, refs: ParseReferences): ParsedInputNode;
1
+ import { LiteralNode, ParseFunction } from "../../../parseNodeTypes";
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4NullDef extends ZodDefWithType {
4
+ type: "null";
5
+ }
6
+ export declare const parseZodNullDef: ParseFunction<ZodV4NullDef, LiteralNode>;
7
+ export {};
@@ -1,3 +1,14 @@
1
1
  import { ParsedInputNode, ParseReferences } from "@src/parse/parseNodeTypes";
2
- import { ZodNullableDef } from "zod";
3
- export declare function parseZodNullableDef(def: ZodNullableDef, refs: ParseReferences): ParsedInputNode;
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4NullableDef extends ZodDefWithType {
4
+ type: "nullable";
5
+ innerType: {
6
+ _def?: unknown;
7
+ def?: unknown;
8
+ _zod?: {
9
+ def?: unknown;
10
+ };
11
+ };
12
+ }
13
+ export declare function parseZodNullableDef(def: ZodV4NullableDef, refs: ParseReferences): ParsedInputNode;
14
+ export {};
@@ -1,3 +1,7 @@
1
1
  import { NumberNode, ParseFunction } from "../../../parseNodeTypes";
2
- import { ZodNumberDef } from "zod";
3
- export declare const parseZodNumberDef: ParseFunction<ZodNumberDef, NumberNode>;
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4NumberDef extends ZodDefWithType {
4
+ type: "number";
5
+ }
6
+ export declare const parseZodNumberDef: ParseFunction<ZodV4NumberDef, NumberNode>;
7
+ export {};
@@ -1,3 +1,15 @@
1
- import { ZodObjectDef } from "zod";
2
1
  import { ObjectNode, ParseFunction, UnsupportedNode } from "../../../parseNodeTypes";
3
- export declare const parseZodObjectDef: ParseFunction<ZodObjectDef, ObjectNode | UnsupportedNode>;
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4ObjectDef extends ZodDefWithType {
4
+ type: "object";
5
+ shape: Record<string, {
6
+ _def?: unknown;
7
+ def?: unknown;
8
+ _zod?: {
9
+ def?: unknown;
10
+ };
11
+ description?: string;
12
+ }>;
13
+ }
14
+ export declare const parseZodObjectDef: ParseFunction<ZodV4ObjectDef, ObjectNode | UnsupportedNode>;
15
+ export {};
@@ -1,3 +1,14 @@
1
- import { ZodOptionalDef } from "zod";
2
- import { ParsedInputNode, ParseFunction } from "../../../parseNodeTypes";
3
- export declare const parseZodOptionalDef: ParseFunction<ZodOptionalDef, ParsedInputNode>;
1
+ import { ParsedInputNode, ParseReferences } from "@src/parse/parseNodeTypes";
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4OptionalDef extends ZodDefWithType {
4
+ type: "optional";
5
+ innerType: {
6
+ _def?: unknown;
7
+ def?: unknown;
8
+ _zod?: {
9
+ def?: unknown;
10
+ };
11
+ };
12
+ }
13
+ export declare function parseZodOptionalDef(def: ZodV4OptionalDef, refs: ParseReferences): ParsedInputNode;
14
+ export {};
@@ -1,3 +1,14 @@
1
1
  import { ParsedInputNode, ParseReferences } from "@src/parse/parseNodeTypes";
2
- import { ZodPromiseDef } from "zod";
3
- export declare function parseZodPromiseDef(def: ZodPromiseDef, refs: ParseReferences): ParsedInputNode;
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4PromiseDef extends ZodDefWithType {
4
+ type: "promise";
5
+ innerType?: {
6
+ _def?: unknown;
7
+ def?: unknown;
8
+ _zod?: {
9
+ def?: unknown;
10
+ };
11
+ };
12
+ }
13
+ export declare function parseZodPromiseDef(def: ZodV4PromiseDef, refs: ParseReferences): ParsedInputNode;
14
+ export {};
@@ -1,3 +1,7 @@
1
1
  import { ParseFunction, StringNode } from "../../../parseNodeTypes";
2
- import { ZodStringDef } from "zod";
3
- export declare const parseZodStringDef: ParseFunction<ZodStringDef, StringNode>;
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4StringDef extends ZodDefWithType {
4
+ type: "string";
5
+ }
6
+ export declare const parseZodStringDef: ParseFunction<ZodV4StringDef, StringNode>;
7
+ export {};
@@ -1,3 +1,7 @@
1
- import { ParsedInputNode, ParseReferences } from "@src/parse/parseNodeTypes";
2
- import { ZodUndefinedDef } from "zod";
3
- export declare function parseZodUndefinedDef(def: ZodUndefinedDef, refs: ParseReferences): ParsedInputNode;
1
+ import { LiteralNode, ParseFunction } from "../../../parseNodeTypes";
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4UndefinedDef extends ZodDefWithType {
4
+ type: "undefined";
5
+ }
6
+ export declare const parseZodUndefinedDef: ParseFunction<ZodV4UndefinedDef, LiteralNode>;
7
+ export {};
@@ -1,3 +1,7 @@
1
- import { LiteralNode, ParseReferences } from "@src/parse/parseNodeTypes";
2
- import { ZodVoidDef } from "zod";
3
- export declare function parseZodVoidDef(_: ZodVoidDef, refs: ParseReferences): LiteralNode;
1
+ import { LiteralNode, ParseFunction } from "../../../parseNodeTypes";
2
+ import { ZodDefWithType } from "../zod-types";
3
+ interface ZodV4VoidDef extends ZodDefWithType {
4
+ type: "void";
5
+ }
6
+ export declare const parseZodVoidDef: ParseFunction<ZodV4VoidDef, LiteralNode>;
7
+ export {};
@@ -1,3 +1,4 @@
1
+ import { getZodDef, ZodDefWithType } from "./zod-types";
1
2
  import { ParserSelectorFunction } from "../../parseNodeTypes";
2
- import { ZodDefWithType } from "./zod-types";
3
3
  export declare const zodSelectorFunction: ParserSelectorFunction<ZodDefWithType>;
4
+ export { getZodDef };
@@ -1,4 +1,6 @@
1
- import { ZodFirstPartyTypeKind, ZodTypeDef } from "zod";
2
- export type ZodDefWithType = ZodTypeDef & {
3
- typeName: ZodFirstPartyTypeKind;
1
+ export type ZodV4Type = "string" | "number" | "boolean" | "bigint" | "date" | "symbol" | "undefined" | "null" | "void" | "never" | "any" | "unknown" | "array" | "object" | "union" | "intersection" | "tuple" | "record" | "map" | "set" | "function" | "lazy" | "literal" | "enum" | "nativeEnum" | "optional" | "nullable" | "default" | "catch" | "nan" | "readonly" | "pipe" | "promise" | "effects" | "branded";
2
+ export type ZodDefWithType = {
3
+ type: ZodV4Type;
4
+ [key: string]: unknown;
4
5
  };
6
+ export declare function getZodDef(schema: unknown): ZodDefWithType | null;
@@ -1,11 +1,11 @@
1
- import { ZodTypeDef } from "zod";
2
1
  import { ZodDiscriminatedUnionDefUnversioned } from "./input-mappers/zod/parsers/parseZodDiscriminatedUnionDef";
3
2
  import { TrpcPanelExtraOptions } from "./parseRouter";
3
+ import { ZodDefWithType } from "./input-mappers/zod/zod-types";
4
4
  export type SharedInputNodeProperties = {
5
5
  path: (string | number)[];
6
6
  optional?: true;
7
7
  };
8
- type InputNodeTypes = ZodTypeDef | ZodDiscriminatedUnionDefUnversioned;
8
+ type InputNodeTypes = ZodDefWithType | ZodDiscriminatedUnionDefUnversioned;
9
9
  export type ArrayNode = {
10
10
  type: "array";
11
11
  childType: ParsedInputNode;