@scalar/types 0.2.16 → 0.3.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @scalar/types
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 008a0f3: feat: migrate to Zod 4
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [008a0f3]
12
+ - @scalar/openapi-types@0.4.0
13
+
3
14
  ## 0.2.16
4
15
 
5
16
  ### Patch Changes
@@ -1,172 +1,36 @@
1
1
  import { z } from 'zod';
2
2
  export declare const HooksSchema: z.ZodObject<{
3
- onBeforeRequest: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
4
- request: z.ZodType<Request, z.ZodTypeDef, Request>;
5
- }, "strip", z.ZodTypeAny, {
6
- request: Request;
7
- }, {
8
- request: Request;
9
- }>], z.ZodUnknown>, z.ZodUnion<[z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
10
- onResponseReceived: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
11
- response: z.ZodType<Response, z.ZodTypeDef, Response>;
3
+ onBeforeRequest: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
4
+ request: z.ZodCustom<Request, Request>;
5
+ }, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
6
+ onResponseReceived: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
7
+ response: z.ZodCustom<Response, Response>;
12
8
  operation: z.ZodRecord<z.ZodString, z.ZodAny>;
13
- }, "strip", z.ZodTypeAny, {
14
- response: Response;
15
- operation: Record<string, any>;
16
- }, {
17
- response: Response;
18
- operation: Record<string, any>;
19
- }>], z.ZodUnknown>, z.ZodUnion<[z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
20
- }, "strip", z.ZodTypeAny, {
21
- onBeforeRequest?: ((args_0: {
22
- request: Request;
23
- }, ...args: unknown[]) => void | Promise<void>) | undefined;
24
- onResponseReceived?: ((args_0: {
25
- response: Response;
26
- operation: Record<string, any>;
27
- }, ...args: unknown[]) => void | Promise<void>) | undefined;
28
- }, {
29
- onBeforeRequest?: ((args_0: {
30
- request: Request;
31
- }, ...args: unknown[]) => void | Promise<void>) | undefined;
32
- onResponseReceived?: ((args_0: {
33
- response: Response;
34
- operation: Record<string, any>;
35
- }, ...args: unknown[]) => void | Promise<void>) | undefined;
36
- }>;
37
- export declare const ApiClientPluginSchema: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodObject<{
9
+ }, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
10
+ }, z.core.$strip>;
11
+ export declare const ApiClientPluginSchema: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodObject<{
38
12
  name: z.ZodString;
39
13
  views: z.ZodOptional<z.ZodObject<{
40
14
  'request.section': z.ZodOptional<z.ZodArray<z.ZodObject<{
41
15
  title: z.ZodOptional<z.ZodString>;
42
16
  component: z.ZodUnknown;
43
17
  props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
44
- }, "strip", z.ZodTypeAny, {
45
- title?: string | undefined;
46
- component?: unknown;
47
- props?: Record<string, any> | undefined;
48
- }, {
49
- title?: string | undefined;
50
- component?: unknown;
51
- props?: Record<string, any> | undefined;
52
- }>, "many">>;
18
+ }, z.core.$strip>>>;
53
19
  'response.section': z.ZodOptional<z.ZodArray<z.ZodObject<{
54
20
  title: z.ZodOptional<z.ZodString>;
55
21
  component: z.ZodUnknown;
56
22
  props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
57
- }, "strip", z.ZodTypeAny, {
58
- title?: string | undefined;
59
- component?: unknown;
60
- props?: Record<string, any> | undefined;
61
- }, {
62
- title?: string | undefined;
63
- component?: unknown;
64
- props?: Record<string, any> | undefined;
65
- }>, "many">>;
66
- }, "strip", z.ZodTypeAny, {
67
- 'request.section'?: {
68
- title?: string | undefined;
69
- component?: unknown;
70
- props?: Record<string, any> | undefined;
71
- }[] | undefined;
72
- 'response.section'?: {
73
- title?: string | undefined;
74
- component?: unknown;
75
- props?: Record<string, any> | undefined;
76
- }[] | undefined;
77
- }, {
78
- 'request.section'?: {
79
- title?: string | undefined;
80
- component?: unknown;
81
- props?: Record<string, any> | undefined;
82
- }[] | undefined;
83
- 'response.section'?: {
84
- title?: string | undefined;
85
- component?: unknown;
86
- props?: Record<string, any> | undefined;
87
- }[] | undefined;
88
- }>>;
23
+ }, z.core.$strip>>>;
24
+ }, z.core.$strip>>;
89
25
  hooks: z.ZodOptional<z.ZodObject<{
90
- onBeforeRequest: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
91
- request: z.ZodType<Request, z.ZodTypeDef, Request>;
92
- }, "strip", z.ZodTypeAny, {
93
- request: Request;
94
- }, {
95
- request: Request;
96
- }>], z.ZodUnknown>, z.ZodUnion<[z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
97
- onResponseReceived: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
98
- response: z.ZodType<Response, z.ZodTypeDef, Response>;
26
+ onBeforeRequest: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
27
+ request: z.ZodCustom<Request, Request>;
28
+ }, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
29
+ onResponseReceived: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
30
+ response: z.ZodCustom<Response, Response>;
99
31
  operation: z.ZodRecord<z.ZodString, z.ZodAny>;
100
- }, "strip", z.ZodTypeAny, {
101
- response: Response;
102
- operation: Record<string, any>;
103
- }, {
104
- response: Response;
105
- operation: Record<string, any>;
106
- }>], z.ZodUnknown>, z.ZodUnion<[z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
107
- }, "strip", z.ZodTypeAny, {
108
- onBeforeRequest?: ((args_0: {
109
- request: Request;
110
- }, ...args: unknown[]) => void | Promise<void>) | undefined;
111
- onResponseReceived?: ((args_0: {
112
- response: Response;
113
- operation: Record<string, any>;
114
- }, ...args: unknown[]) => void | Promise<void>) | undefined;
115
- }, {
116
- onBeforeRequest?: ((args_0: {
117
- request: Request;
118
- }, ...args: unknown[]) => void | Promise<void>) | undefined;
119
- onResponseReceived?: ((args_0: {
120
- response: Response;
121
- operation: Record<string, any>;
122
- }, ...args: unknown[]) => void | Promise<void>) | undefined;
123
- }>>;
124
- }, "strip", z.ZodTypeAny, {
125
- name: string;
126
- views?: {
127
- 'request.section'?: {
128
- title?: string | undefined;
129
- component?: unknown;
130
- props?: Record<string, any> | undefined;
131
- }[] | undefined;
132
- 'response.section'?: {
133
- title?: string | undefined;
134
- component?: unknown;
135
- props?: Record<string, any> | undefined;
136
- }[] | undefined;
137
- } | undefined;
138
- hooks?: {
139
- onBeforeRequest?: ((args_0: {
140
- request: Request;
141
- }, ...args: unknown[]) => void | Promise<void>) | undefined;
142
- onResponseReceived?: ((args_0: {
143
- response: Response;
144
- operation: Record<string, any>;
145
- }, ...args: unknown[]) => void | Promise<void>) | undefined;
146
- } | undefined;
147
- }, {
148
- name: string;
149
- views?: {
150
- 'request.section'?: {
151
- title?: string | undefined;
152
- component?: unknown;
153
- props?: Record<string, any> | undefined;
154
- }[] | undefined;
155
- 'response.section'?: {
156
- title?: string | undefined;
157
- component?: unknown;
158
- props?: Record<string, any> | undefined;
159
- }[] | undefined;
160
- } | undefined;
161
- hooks?: {
162
- onBeforeRequest?: ((args_0: {
163
- request: Request;
164
- }, ...args: unknown[]) => void | Promise<void>) | undefined;
165
- onResponseReceived?: ((args_0: {
166
- response: Response;
167
- operation: Record<string, any>;
168
- }, ...args: unknown[]) => void | Promise<void>) | undefined;
169
- } | undefined;
170
- }>>;
32
+ }, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
33
+ }, z.core.$strip>>;
34
+ }, z.core.$strip>>;
171
35
  export type ApiClientPlugin = z.infer<typeof ApiClientPluginSchema>;
172
36
  //# sourceMappingURL=api-client-plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-client-plugin.d.ts","sourceRoot":"","sources":["../../src/api-client/api-client-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAcvB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBtB,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAMjC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
1
+ {"version":3,"file":"api-client-plugin.d.ts","sourceRoot":"","sources":["../../src/api-client/api-client-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAcvB,eAAO,MAAM,WAAW;;;;;;;;iBAatB,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;kBAOhC,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
@@ -3,29 +3,30 @@ const SectionViewSchema = z.object({
3
3
  title: z.string().optional(),
4
4
  // Since this is meant to be a Vue component, we'll use unknown
5
5
  component: z.unknown(),
6
- props: z.record(z.any()).optional()
6
+ props: z.record(z.string(), z.any()).optional()
7
7
  });
8
8
  const ViewsSchema = z.object({
9
9
  "request.section": z.array(SectionViewSchema).optional(),
10
10
  "response.section": z.array(SectionViewSchema).optional()
11
11
  });
12
12
  const HooksSchema = z.object({
13
- onBeforeRequest: z.function().args(z.object({ request: z.instanceof(Request) })).returns(z.union([z.void(), z.promise(z.void())])).optional(),
14
- onResponseReceived: z.function().args(
15
- z.object({
16
- response: z.instanceof(Response),
17
- // Ideally, we'd have the Operation type here, but we don't.
18
- operation: z.record(z.any())
19
- })
20
- ).returns(z.union([z.void(), z.promise(z.void())])).optional()
13
+ onBeforeRequest: z.function({
14
+ input: [z.object({ request: z.instanceof(Request) })],
15
+ output: z.union([z.void(), z.promise(z.void())])
16
+ }).optional(),
17
+ onResponseReceived: z.function({
18
+ input: [z.object({ response: z.instanceof(Response), operation: z.record(z.string(), z.any()) })],
19
+ output: z.union([z.void(), z.promise(z.void())])
20
+ }).optional()
21
21
  });
22
- const ApiClientPluginSchema = z.function().returns(
23
- z.object({
22
+ const ApiClientPluginSchema = z.function({
23
+ input: [],
24
+ output: z.object({
24
25
  name: z.string(),
25
26
  views: ViewsSchema.optional(),
26
27
  hooks: HooksSchema.optional()
27
28
  })
28
- );
29
+ });
29
30
  export {
30
31
  ApiClientPluginSchema,
31
32
  HooksSchema
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/api-client/api-client-plugin.ts"],
4
- "sourcesContent": ["import { z } from 'zod'\n\nconst SectionViewSchema = z.object({\n title: z.string().optional(),\n // Since this is meant to be a Vue component, we'll use unknown\n component: z.unknown(),\n props: z.record(z.any()).optional(),\n})\n\nconst ViewsSchema = z.object({\n 'request.section': z.array(SectionViewSchema).optional(),\n 'response.section': z.array(SectionViewSchema).optional(),\n})\n\nexport const HooksSchema = z.object({\n onBeforeRequest: z\n .function()\n .args(z.object({ request: z.instanceof(Request) }))\n .returns(z.union([z.void(), z.promise(z.void())]))\n .optional(),\n onResponseReceived: z\n .function()\n .args(\n z.object({\n response: z.instanceof(Response),\n // Ideally, we'd have the Operation type here, but we don't.\n operation: z.record(z.any()),\n }),\n )\n .returns(z.union([z.void(), z.promise(z.void())]))\n .optional(),\n})\n\nexport const ApiClientPluginSchema = z.function().returns(\n z.object({\n name: z.string(),\n views: ViewsSchema.optional(),\n hooks: HooksSchema.optional(),\n }),\n)\n\nexport type ApiClientPlugin = z.infer<typeof ApiClientPluginSchema>\n"],
5
- "mappings": "AAAA,SAAS,SAAS;AAElB,MAAM,oBAAoB,EAAE,OAAO;AAAA,EACjC,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE3B,WAAW,EAAE,QAAQ;AAAA,EACrB,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS;AACpC,CAAC;AAED,MAAM,cAAc,EAAE,OAAO;AAAA,EAC3B,mBAAmB,EAAE,MAAM,iBAAiB,EAAE,SAAS;AAAA,EACvD,oBAAoB,EAAE,MAAM,iBAAiB,EAAE,SAAS;AAC1D,CAAC;AAEM,MAAM,cAAc,EAAE,OAAO;AAAA,EAClC,iBAAiB,EACd,SAAS,EACT,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,OAAO,EAAE,CAAC,CAAC,EACjD,QAAQ,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAChD,SAAS;AAAA,EACZ,oBAAoB,EACjB,SAAS,EACT;AAAA,IACC,EAAE,OAAO;AAAA,MACP,UAAU,EAAE,WAAW,QAAQ;AAAA;AAAA,MAE/B,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,IAC7B,CAAC;AAAA,EACH,EACC,QAAQ,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAChD,SAAS;AACd,CAAC;AAEM,MAAM,wBAAwB,EAAE,SAAS,EAAE;AAAA,EAChD,EAAE,OAAO;AAAA,IACP,MAAM,EAAE,OAAO;AAAA,IACf,OAAO,YAAY,SAAS;AAAA,IAC5B,OAAO,YAAY,SAAS;AAAA,EAC9B,CAAC;AACH;",
4
+ "sourcesContent": ["import { z } from 'zod'\n\nconst SectionViewSchema = z.object({\n title: z.string().optional(),\n // Since this is meant to be a Vue component, we'll use unknown\n component: z.unknown(),\n props: z.record(z.string(), z.any()).optional(),\n})\n\nconst ViewsSchema = z.object({\n 'request.section': z.array(SectionViewSchema).optional(),\n 'response.section': z.array(SectionViewSchema).optional(),\n})\n\nexport const HooksSchema = z.object({\n onBeforeRequest: z\n .function({\n input: [z.object({ request: z.instanceof(Request) })],\n output: z.union([z.void(), z.promise(z.void())]),\n })\n .optional(),\n onResponseReceived: z\n .function({\n input: [z.object({ response: z.instanceof(Response), operation: z.record(z.string(), z.any()) })],\n output: z.union([z.void(), z.promise(z.void())]),\n })\n .optional(),\n})\n\nexport const ApiClientPluginSchema = z.function({\n input: [],\n output: z.object({\n name: z.string(),\n views: ViewsSchema.optional(),\n hooks: HooksSchema.optional(),\n }),\n})\n\nexport type ApiClientPlugin = z.infer<typeof ApiClientPluginSchema>\n"],
5
+ "mappings": "AAAA,SAAS,SAAS;AAElB,MAAM,oBAAoB,EAAE,OAAO;AAAA,EACjC,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE3B,WAAW,EAAE,QAAQ;AAAA,EACrB,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC,EAAE,SAAS;AAChD,CAAC;AAED,MAAM,cAAc,EAAE,OAAO;AAAA,EAC3B,mBAAmB,EAAE,MAAM,iBAAiB,EAAE,SAAS;AAAA,EACvD,oBAAoB,EAAE,MAAM,iBAAiB,EAAE,SAAS;AAC1D,CAAC;AAEM,MAAM,cAAc,EAAE,OAAO;AAAA,EAClC,iBAAiB,EACd,SAAS;AAAA,IACR,OAAO,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,OAAO,EAAE,CAAC,CAAC;AAAA,IACpD,QAAQ,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAAA,EACjD,CAAC,EACA,SAAS;AAAA,EACZ,oBAAoB,EACjB,SAAS;AAAA,IACR,OAAO,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,QAAQ,GAAG,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;AAAA,IAChG,QAAQ,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAAA,EACjD,CAAC,EACA,SAAS;AACd,CAAC;AAEM,MAAM,wBAAwB,EAAE,SAAS;AAAA,EAC9C,OAAO,CAAC;AAAA,EACR,QAAQ,EAAE,OAAO;AAAA,IACf,MAAM,EAAE,OAAO;AAAA,IACf,OAAO,YAAY,SAAS;AAAA,IAC5B,OAAO,YAAY,SAAS;AAAA,EAC9B,CAAC;AACH,CAAC;",
6
6
  "names": []
7
7
  }