@scalar/types 0.7.3 → 0.7.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.
- package/CHANGELOG.md +6 -0
- package/dist/api-reference/api-client-configuration.js +3 -7
- package/dist/api-reference/api-client-plugin.js +32 -30
- package/dist/api-reference/api-reference-configuration.js +404 -361
- package/dist/api-reference/api-reference-plugin.js +43 -47
- package/dist/api-reference/authentication-configuration.js +1 -1
- package/dist/api-reference/authentication-configuration.test-d.js +41 -42
- package/dist/api-reference/base-configuration.js +150 -146
- package/dist/api-reference/html-api.js +1 -1
- package/dist/api-reference/html-rendering-configuration.js +19 -20
- package/dist/api-reference/index.js +5 -26
- package/dist/api-reference/source-configuration.js +105 -96
- package/dist/entities/index.js +1 -21
- package/dist/entities/security-scheme.js +179 -140
- package/dist/index.js +6 -6
- package/dist/legacy/index.js +1 -5
- package/dist/legacy/reference-config.js +6 -10
- package/dist/snippetz/index.js +1 -6
- package/dist/snippetz/snippetz.js +35 -31
- package/dist/snippetz/snippetz.test-d.js +30 -27
- package/dist/utils/index.js +1 -5
- package/dist/utils/nanoid.js +7 -7
- package/dist/utils/utility-types.js +1 -1
- package/package.json +5 -9
- package/dist/api-reference/api-client-configuration.js.map +0 -7
- package/dist/api-reference/api-client-plugin.js.map +0 -7
- package/dist/api-reference/api-reference-configuration.js.map +0 -7
- package/dist/api-reference/api-reference-plugin.js.map +0 -7
- package/dist/api-reference/authentication-configuration.js.map +0 -7
- package/dist/api-reference/authentication-configuration.test-d.js.map +0 -7
- package/dist/api-reference/base-configuration.js.map +0 -7
- package/dist/api-reference/html-api.js.map +0 -7
- package/dist/api-reference/html-rendering-configuration.js.map +0 -7
- package/dist/api-reference/index.js.map +0 -7
- package/dist/api-reference/source-configuration.js.map +0 -7
- package/dist/entities/index.js.map +0 -7
- package/dist/entities/security-scheme.js.map +0 -7
- package/dist/index.js.map +0 -7
- package/dist/legacy/index.js.map +0 -7
- package/dist/legacy/reference-config.js.map +0 -7
- package/dist/snippetz/index.js.map +0 -7
- package/dist/snippetz/snippetz.js.map +0 -7
- package/dist/snippetz/snippetz.test-d.js.map +0 -7
- package/dist/utils/index.js.map +0 -7
- package/dist/utils/nanoid.js.map +0 -7
- package/dist/utils/utility-types.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { baseConfigurationSchema } from
|
|
2
|
-
import { sourceConfigurationSchema } from
|
|
3
|
-
const apiClientConfigurationSchema = baseConfigurationSchema.extend(sourceConfigurationSchema.shape);
|
|
4
|
-
export {
|
|
5
|
-
apiClientConfigurationSchema
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=api-client-configuration.js.map
|
|
1
|
+
import { baseConfigurationSchema } from './base-configuration.js';
|
|
2
|
+
import { sourceConfigurationSchema } from './source-configuration.js';
|
|
3
|
+
export const apiClientConfigurationSchema = baseConfigurationSchema.extend(sourceConfigurationSchema.shape);
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
const sectionViewSchema = z.object({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
7
|
});
|
|
8
8
|
const viewsSchema = z.object({
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
'request.section': z.array(sectionViewSchema).optional(),
|
|
10
|
+
'response.section': z.array(sectionViewSchema).optional(),
|
|
11
11
|
});
|
|
12
|
-
const hooksSchema = z.object({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
export const hooksSchema = z.object({
|
|
13
|
+
onBeforeRequest: z
|
|
14
|
+
.function({
|
|
15
|
+
input: [z.object({ request: z.instanceof(Request) })],
|
|
16
|
+
// Why no output? https://github.com/scalar/scalar/pull/7047
|
|
17
|
+
// output: z.union([z.void(), z.promise(z.void())]),
|
|
18
|
+
})
|
|
19
|
+
.optional(),
|
|
20
|
+
onResponseReceived: z
|
|
21
|
+
.function({
|
|
22
|
+
input: [z.object({ response: z.instanceof(Response), operation: z.record(z.string(), z.any()) })],
|
|
23
|
+
// Why no output? https://github.com/scalar/scalar/pull/7047
|
|
24
|
+
// output: z.union([z.void(), z.promise(z.void())]),
|
|
25
|
+
})
|
|
26
|
+
.optional(),
|
|
23
27
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
/**
|
|
29
|
+
* An API client plugin that can connect into request and response hooks
|
|
30
|
+
*/
|
|
31
|
+
export const apiClientPluginSchema = z.function({
|
|
32
|
+
input: [],
|
|
33
|
+
output: z.object({
|
|
34
|
+
name: z.string(),
|
|
35
|
+
views: viewsSchema.optional(),
|
|
36
|
+
hooks: hooksSchema.optional(),
|
|
37
|
+
}),
|
|
31
38
|
});
|
|
32
|
-
export {
|
|
33
|
-
apiClientPluginSchema,
|
|
34
|
-
hooksSchema
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=api-client-plugin.js.map
|