@scalar/types 0.3.0 → 0.3.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/api-reference/api-client-configuration.d.ts +122 -0
  3. package/dist/api-reference/api-client-configuration.d.ts.map +1 -0
  4. package/dist/api-reference/api-client-configuration.js +7 -0
  5. package/dist/api-reference/api-client-configuration.js.map +7 -0
  6. package/dist/{api-client → api-reference}/api-client-plugin.d.ts +10 -7
  7. package/dist/api-reference/api-client-plugin.d.ts.map +1 -0
  8. package/dist/api-reference/api-client-plugin.js +36 -0
  9. package/dist/api-reference/api-client-plugin.js.map +7 -0
  10. package/dist/api-reference/api-reference-configuration.d.ts +58 -525
  11. package/dist/api-reference/api-reference-configuration.d.ts.map +1 -1
  12. package/dist/api-reference/api-reference-configuration.js +278 -501
  13. package/dist/api-reference/api-reference-configuration.js.map +2 -2
  14. package/dist/api-reference/api-reference-plugin.d.ts +4 -4
  15. package/dist/api-reference/api-reference-plugin.d.ts.map +1 -1
  16. package/dist/api-reference/api-reference-plugin.js +5 -5
  17. package/dist/api-reference/api-reference-plugin.js.map +2 -2
  18. package/dist/api-reference/authentication-configuration.d.ts +1 -1
  19. package/dist/api-reference/authentication-configuration.d.ts.map +1 -1
  20. package/dist/api-reference/base-configuration.d.ts +118 -0
  21. package/dist/api-reference/base-configuration.d.ts.map +1 -0
  22. package/dist/api-reference/base-configuration.js +139 -0
  23. package/dist/api-reference/base-configuration.js.map +7 -0
  24. package/dist/api-reference/html-rendering-configuration.d.ts +2 -2
  25. package/dist/api-reference/html-rendering-configuration.d.ts.map +1 -1
  26. package/dist/api-reference/html-rendering-configuration.js.map +2 -2
  27. package/dist/api-reference/index.d.ts +6 -3
  28. package/dist/api-reference/index.d.ts.map +1 -1
  29. package/dist/api-reference/index.js +12 -3
  30. package/dist/api-reference/index.js.map +2 -2
  31. package/dist/api-reference/source-configuration.d.ts +18 -0
  32. package/dist/api-reference/source-configuration.d.ts.map +1 -0
  33. package/dist/api-reference/source-configuration.js +87 -0
  34. package/dist/api-reference/source-configuration.js.map +7 -0
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +1 -1
  38. package/dist/index.js.map +2 -2
  39. package/dist/snippetz/snippetz.d.ts +2 -2
  40. package/dist/snippetz/snippetz.d.ts.map +1 -1
  41. package/dist/snippetz/snippetz.js +1 -0
  42. package/dist/snippetz/snippetz.js.map +2 -2
  43. package/package.json +3 -3
  44. package/dist/api-client/api-client-plugin.d.ts.map +0 -1
  45. package/dist/api-client/api-client-plugin.js +0 -34
  46. package/dist/api-client/api-client-plugin.js.map +0 -7
  47. package/dist/api-client/index.d.ts +0 -2
  48. package/dist/api-client/index.d.ts.map +0 -1
  49. package/dist/api-client/index.js +0 -6
  50. package/dist/api-client/index.js.map +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @scalar/types
2
2
 
3
+ ## 0.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - f3e17d8: fix(types): allow async callbacks for event handlers
8
+ - Updated dependencies [f69e7cc]
9
+ - @scalar/openapi-types@0.5.0
10
+
11
+ ## 0.3.1
12
+
13
+ ### Patch Changes
14
+
15
+ - 1e01464: Adds a new ApiReferenceConfigWithSource type and make the base ApiReferenceConfig type agnostic of any document sources.
16
+ - Updated dependencies [15c4240]
17
+ - @scalar/openapi-types@0.4.1
18
+
3
19
  ## 0.3.0
4
20
 
5
21
  ### Minor Changes
@@ -0,0 +1,122 @@
1
+ import type z from 'zod';
2
+ export declare const apiClientConfigurationSchema: z.ZodObject<{
3
+ authentication: z.ZodOptional<z.ZodAny>;
4
+ baseServerURL: z.ZodOptional<z.ZodString>;
5
+ hideClientButton: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
6
+ proxyUrl: z.ZodOptional<z.ZodString>;
7
+ searchHotKey: z.ZodOptional<z.ZodEnum<{
8
+ a: "a";
9
+ b: "b";
10
+ c: "c";
11
+ d: "d";
12
+ e: "e";
13
+ f: "f";
14
+ g: "g";
15
+ h: "h";
16
+ i: "i";
17
+ j: "j";
18
+ k: "k";
19
+ l: "l";
20
+ m: "m";
21
+ n: "n";
22
+ o: "o";
23
+ p: "p";
24
+ q: "q";
25
+ r: "r";
26
+ s: "s";
27
+ t: "t";
28
+ u: "u";
29
+ v: "v";
30
+ w: "w";
31
+ x: "x";
32
+ y: "y";
33
+ z: "z";
34
+ }>>;
35
+ servers: z.ZodOptional<z.ZodArray<z.ZodAny>>;
36
+ showSidebar: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
37
+ showToolbar: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodEnum<{
38
+ never: "never";
39
+ always: "always";
40
+ localhost: "localhost";
41
+ }>>>>;
42
+ operationTitleSource: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodEnum<{
43
+ summary: "summary";
44
+ path: "path";
45
+ }>>>>;
46
+ theme: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodEnum<{
47
+ default: "default";
48
+ alternate: "alternate";
49
+ moon: "moon";
50
+ purple: "purple";
51
+ solarized: "solarized";
52
+ bluePlanet: "bluePlanet";
53
+ deepSpace: "deepSpace";
54
+ saturn: "saturn";
55
+ kepler: "kepler";
56
+ elysiajs: "elysiajs";
57
+ fastify: "fastify";
58
+ mars: "mars";
59
+ laserwave: "laserwave";
60
+ none: "none";
61
+ }>>>>;
62
+ _integration: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
63
+ elysiajs: "elysiajs";
64
+ fastify: "fastify";
65
+ adonisjs: "adonisjs";
66
+ docusaurus: "docusaurus";
67
+ dotnet: "dotnet";
68
+ express: "express";
69
+ fastapi: "fastapi";
70
+ go: "go";
71
+ hono: "hono";
72
+ html: "html";
73
+ laravel: "laravel";
74
+ litestar: "litestar";
75
+ nestjs: "nestjs";
76
+ nextjs: "nextjs";
77
+ nitro: "nitro";
78
+ nuxt: "nuxt";
79
+ platformatic: "platformatic";
80
+ react: "react";
81
+ rust: "rust";
82
+ svelte: "svelte";
83
+ vue: "vue";
84
+ }>>>;
85
+ onRequestSent: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodString], null>, z.ZodVoid>>;
86
+ persistAuth: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
87
+ plugins: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodObject<{
88
+ name: z.ZodString;
89
+ views: z.ZodOptional<z.ZodObject<{
90
+ 'request.section': z.ZodOptional<z.ZodArray<z.ZodObject<{
91
+ title: z.ZodOptional<z.ZodString>;
92
+ component: z.ZodUnknown;
93
+ props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
94
+ }, z.core.$strip>>>;
95
+ 'response.section': z.ZodOptional<z.ZodArray<z.ZodObject<{
96
+ title: z.ZodOptional<z.ZodString>;
97
+ component: z.ZodUnknown;
98
+ props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
99
+ }, z.core.$strip>>>;
100
+ }, z.core.$strip>>;
101
+ hooks: z.ZodOptional<z.ZodObject<{
102
+ onBeforeRequest: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
103
+ request: z.ZodCustom<Request, Request>;
104
+ }, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
105
+ onResponseReceived: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
106
+ response: z.ZodCustom<Response, Response>;
107
+ operation: z.ZodRecord<z.ZodString, z.ZodAny>;
108
+ }, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
109
+ }, z.core.$strip>>;
110
+ }, z.core.$strip>>>>;
111
+ telemetry: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
112
+ url: z.ZodOptional<z.ZodString>;
113
+ content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodRecord<z.ZodString, z.ZodAny>>]>>;
114
+ title: z.ZodOptional<z.ZodString>;
115
+ slug: z.ZodOptional<z.ZodString>;
116
+ spec: z.ZodOptional<z.ZodObject<{
117
+ url: z.ZodOptional<z.ZodString>;
118
+ content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodRecord<z.ZodString, z.ZodAny>>]>>;
119
+ }, z.core.$strip>>;
120
+ }, z.core.$strip>;
121
+ export type ApiClientConfiguration = z.infer<typeof apiClientConfigurationSchema>;
122
+ //# sourceMappingURL=api-client-configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/api-client-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAKxB,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAkE,CAAA;AAE3G,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { baseConfigurationSchema } from "./base-configuration.js";
2
+ import { sourceConfigurationSchema } from "./source-configuration.js";
3
+ const apiClientConfigurationSchema = baseConfigurationSchema.extend(sourceConfigurationSchema.shape);
4
+ export {
5
+ apiClientConfigurationSchema
6
+ };
7
+ //# sourceMappingURL=api-client-configuration.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/api-reference/api-client-configuration.ts"],
4
+ "sourcesContent": ["import type z from 'zod'\n\nimport { baseConfigurationSchema } from './base-configuration'\nimport { sourceConfigurationSchema } from './source-configuration'\n\nexport const apiClientConfigurationSchema = baseConfigurationSchema.extend(sourceConfigurationSchema.shape)\n\nexport type ApiClientConfiguration = z.infer<typeof apiClientConfigurationSchema>\n"],
5
+ "mappings": "AAEA,SAAS,+BAA+B;AACxC,SAAS,iCAAiC;AAEnC,MAAM,+BAA+B,wBAAwB,OAAO,0BAA0B,KAAK;",
6
+ "names": []
7
+ }
@@ -1,14 +1,17 @@
1
1
  import { z } from 'zod';
2
- export declare const HooksSchema: z.ZodObject<{
2
+ export declare const hooksSchema: z.ZodObject<{
3
3
  onBeforeRequest: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
4
4
  request: z.ZodCustom<Request, Request>;
5
- }, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
5
+ }, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
6
6
  onResponseReceived: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
7
7
  response: z.ZodCustom<Response, Response>;
8
8
  operation: z.ZodRecord<z.ZodString, z.ZodAny>;
9
- }, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
9
+ }, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
10
10
  }, z.core.$strip>;
11
- export declare const ApiClientPluginSchema: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodObject<{
11
+ /**
12
+ * An API client plugin that can connect into request and response hooks
13
+ */
14
+ export declare const apiClientPluginSchema: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodObject<{
12
15
  name: z.ZodString;
13
16
  views: z.ZodOptional<z.ZodObject<{
14
17
  'request.section': z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -25,12 +28,12 @@ export declare const ApiClientPluginSchema: z.ZodFunction<z.ZodTuple<readonly []
25
28
  hooks: z.ZodOptional<z.ZodObject<{
26
29
  onBeforeRequest: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
27
30
  request: z.ZodCustom<Request, Request>;
28
- }, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
31
+ }, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
29
32
  onResponseReceived: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
30
33
  response: z.ZodCustom<Response, Response>;
31
34
  operation: z.ZodRecord<z.ZodString, z.ZodAny>;
32
- }, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
35
+ }, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
33
36
  }, z.core.$strip>>;
34
37
  }, z.core.$strip>>;
35
- export type ApiClientPlugin = z.infer<typeof ApiClientPluginSchema>;
38
+ export type ApiClientPlugin = z.infer<typeof apiClientPluginSchema>;
36
39
  //# sourceMappingURL=api-client-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client-plugin.d.ts","sourceRoot":"","sources":["../../src/api-reference/api-client-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAcvB,eAAO,MAAM,WAAW;;;;;;;;iBAetB,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;kBAOhC,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ const sectionViewSchema = z.object({
3
+ title: z.string().optional(),
4
+ // Since this is meant to be a Vue component, we'll use unknown
5
+ component: z.unknown(),
6
+ props: z.record(z.string(), z.any()).optional()
7
+ });
8
+ const viewsSchema = z.object({
9
+ "request.section": z.array(sectionViewSchema).optional(),
10
+ "response.section": z.array(sectionViewSchema).optional()
11
+ });
12
+ const hooksSchema = z.object({
13
+ onBeforeRequest: z.function({
14
+ input: [z.object({ request: z.instanceof(Request) })]
15
+ // Why no output? https://github.com/scalar/scalar/pull/7047
16
+ // output: z.union([z.void(), z.promise(z.void())]),
17
+ }).optional(),
18
+ onResponseReceived: z.function({
19
+ input: [z.object({ response: z.instanceof(Response), operation: z.record(z.string(), z.any()) })]
20
+ // Why no output? https://github.com/scalar/scalar/pull/7047
21
+ // output: z.union([z.void(), z.promise(z.void())]),
22
+ }).optional()
23
+ });
24
+ const apiClientPluginSchema = z.function({
25
+ input: [],
26
+ output: z.object({
27
+ name: z.string(),
28
+ views: viewsSchema.optional(),
29
+ hooks: hooksSchema.optional()
30
+ })
31
+ });
32
+ export {
33
+ apiClientPluginSchema,
34
+ hooksSchema
35
+ };
36
+ //# sourceMappingURL=api-client-plugin.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/api-reference/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.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 // Why no output? https://github.com/scalar/scalar/pull/7047\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 // Why no output? https://github.com/scalar/scalar/pull/7047\n // output: z.union([z.void(), z.promise(z.void())]),\n })\n .optional(),\n})\n\n/**\n * An API client plugin that can connect into request and response hooks\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;AAAA;AAAA,EAGtD,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;AAAA;AAAA,EAGlG,CAAC,EACA,SAAS;AACd,CAAC;AAKM,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
+ "names": []
7
+ }