@scalar/oas-utils 0.11.1 → 0.12.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 +11 -0
- package/dist/helpers/index.d.ts +0 -82
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +0 -78
- package/dist/migrations/migrate-to-indexdb.d.ts.map +1 -1
- package/dist/migrations/migrate-to-indexdb.js +1 -1
- package/dist/migrations/v-2.5.0/types.generated.d.ts +428 -34
- package/dist/migrations/v-2.5.0/types.generated.d.ts.map +1 -1
- package/package.json +7 -61
- package/dist/entities/cookie/cookie.d.ts +0 -15
- package/dist/entities/cookie/cookie.d.ts.map +0 -1
- package/dist/entities/cookie/cookie.js +0 -12
- package/dist/entities/cookie/index.d.ts +0 -2
- package/dist/entities/cookie/index.d.ts.map +0 -1
- package/dist/entities/cookie/index.js +0 -1
- package/dist/entities/environment/environment.d.ts +0 -12
- package/dist/entities/environment/environment.d.ts.map +0 -1
- package/dist/entities/environment/environment.js +0 -8
- package/dist/entities/environment/index.d.ts +0 -2
- package/dist/entities/environment/index.d.ts.map +0 -1
- package/dist/entities/environment/index.js +0 -1
- package/dist/entities/hotkeys/hotkeys.d.ts +0 -15
- package/dist/entities/hotkeys/hotkeys.d.ts.map +0 -1
- package/dist/entities/hotkeys/hotkeys.js +0 -118
- package/dist/entities/hotkeys/index.d.ts +0 -2
- package/dist/entities/hotkeys/index.d.ts.map +0 -1
- package/dist/entities/hotkeys/index.js +0 -1
- package/dist/entities/shared/index.d.ts +0 -2
- package/dist/entities/shared/index.d.ts.map +0 -1
- package/dist/entities/shared/index.js +0 -1
- package/dist/entities/shared/utility.d.ts +0 -5
- package/dist/entities/shared/utility.d.ts.map +0 -1
- package/dist/entities/shared/utility.js +0 -9
- package/dist/entities/spec/collection.d.ts +0 -133
- package/dist/entities/spec/collection.d.ts.map +0 -1
- package/dist/entities/spec/collection.js +0 -95
- package/dist/entities/spec/index.d.ts +0 -12
- package/dist/entities/spec/index.d.ts.map +0 -1
- package/dist/entities/spec/index.js +0 -10
- package/dist/entities/spec/operation.d.ts +0 -99
- package/dist/entities/spec/operation.d.ts.map +0 -1
- package/dist/entities/spec/operation.js +0 -6
- package/dist/entities/spec/parameters.d.ts +0 -44
- package/dist/entities/spec/parameters.d.ts.map +0 -1
- package/dist/entities/spec/parameters.js +0 -41
- package/dist/entities/spec/request-examples.d.ts +0 -380
- package/dist/entities/spec/request-examples.d.ts.map +0 -1
- package/dist/entities/spec/request-examples.js +0 -449
- package/dist/entities/spec/requests.d.ts +0 -137
- package/dist/entities/spec/requests.d.ts.map +0 -1
- package/dist/entities/spec/requests.js +0 -123
- package/dist/entities/spec/server.d.ts +0 -15
- package/dist/entities/spec/server.d.ts.map +0 -1
- package/dist/entities/spec/server.js +0 -67
- package/dist/entities/spec/spec-objects.d.ts +0 -171
- package/dist/entities/spec/spec-objects.d.ts.map +0 -1
- package/dist/entities/spec/spec-objects.js +0 -134
- package/dist/entities/spec/x-scalar-environments.d.ts +0 -22
- package/dist/entities/spec/x-scalar-environments.d.ts.map +0 -1
- package/dist/entities/spec/x-scalar-environments.js +0 -22
- package/dist/entities/spec/x-scalar-secrets.d.ts +0 -6
- package/dist/entities/spec/x-scalar-secrets.d.ts.map +0 -1
- package/dist/entities/spec/x-scalar-secrets.js +0 -8
- package/dist/entities/workspace/index.d.ts +0 -2
- package/dist/entities/workspace/index.d.ts.map +0 -1
- package/dist/entities/workspace/index.js +0 -1
- package/dist/entities/workspace/workspace.d.ts +0 -236
- package/dist/entities/workspace/workspace.d.ts.map +0 -1
- package/dist/entities/workspace/workspace.js +0 -49
- package/dist/helpers/fetch-document.d.ts +0 -7
- package/dist/helpers/fetch-document.d.ts.map +0 -1
- package/dist/helpers/fetch-document.js +0 -32
- package/dist/helpers/fetch-with-proxy-fallback.d.ts +0 -15
- package/dist/helpers/fetch-with-proxy-fallback.d.ts.map +0 -1
- package/dist/helpers/fetch-with-proxy-fallback.js +0 -29
- package/dist/helpers/normalize-mime-type-object.d.ts +0 -8
- package/dist/helpers/normalize-mime-type-object.d.ts.map +0 -1
- package/dist/helpers/normalize-mime-type-object.js +0 -21
- package/dist/helpers/normalize-mime-type.d.ts +0 -10
- package/dist/helpers/normalize-mime-type.d.ts.map +0 -1
- package/dist/helpers/normalize-mime-type.js +0 -12
- package/dist/helpers/operation-stability.d.ts +0 -19
- package/dist/helpers/operation-stability.d.ts.map +0 -1
- package/dist/helpers/operation-stability.js +0 -24
- package/dist/helpers/schema-model.d.ts +0 -5
- package/dist/helpers/schema-model.d.ts.map +0 -1
- package/dist/helpers/schema-model.js +0 -14
- package/dist/helpers/security/get-schemes.d.ts +0 -97
- package/dist/helpers/security/get-schemes.d.ts.map +0 -1
- package/dist/helpers/security/get-schemes.js +0 -8
- package/dist/helpers/security/has-token.d.ts +0 -4
- package/dist/helpers/security/has-token.d.ts.map +0 -1
- package/dist/helpers/security/has-token.js +0 -19
- package/dist/helpers/security/index.d.ts +0 -3
- package/dist/helpers/security/index.d.ts.map +0 -1
- package/dist/helpers/security/index.js +0 -2
- package/dist/helpers/servers.d.ts +0 -24
- package/dist/helpers/servers.d.ts.map +0 -1
- package/dist/helpers/servers.js +0 -146
- package/dist/helpers/should-ignore-entity.d.ts +0 -8
- package/dist/helpers/should-ignore-entity.d.ts.map +0 -1
- package/dist/helpers/should-ignore-entity.js +0 -4
- package/dist/migrations/generate-types.d.ts +0 -2
- package/dist/migrations/generate-types.d.ts.map +0 -1
- package/dist/migrations/generate-types.js +0 -53
- package/dist/spec-getters/get-example-from-schema.d.ts +0 -36
- package/dist/spec-getters/get-example-from-schema.d.ts.map +0 -1
- package/dist/spec-getters/get-example-from-schema.js +0 -521
- package/dist/spec-getters/get-parameters-from-operation.d.ts +0 -17
- package/dist/spec-getters/get-parameters-from-operation.d.ts.map +0 -1
- package/dist/spec-getters/get-parameters-from-operation.js +0 -40
- package/dist/spec-getters/get-request-body-from-operation.d.ts +0 -14
- package/dist/spec-getters/get-request-body-from-operation.d.ts.map +0 -1
- package/dist/spec-getters/get-request-body-from-operation.js +0 -176
- package/dist/spec-getters/get-server-variable-examples.d.ts +0 -4
- package/dist/spec-getters/get-server-variable-examples.d.ts.map +0 -1
- package/dist/spec-getters/get-server-variable-examples.js +0 -12
- package/dist/spec-getters/index.d.ts +0 -5
- package/dist/spec-getters/index.d.ts.map +0 -1
- package/dist/spec-getters/index.js +0 -4
- package/dist/transforms/import-spec.d.ts +0 -64
- package/dist/transforms/import-spec.d.ts.map +0 -1
- package/dist/transforms/import-spec.js +0 -397
- package/dist/transforms/index.d.ts +0 -2
- package/dist/transforms/index.d.ts.map +0 -1
- package/dist/transforms/index.js +0 -1
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { oasSecurityRequirementSchema } from '@scalar/types/entities';
|
|
2
|
-
import { XScalarStability } from '@scalar/types/legacy';
|
|
3
|
-
import { nanoidSchema } from '@scalar/types/utils';
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
import { selectedSecuritySchemeUidSchema } from '../../entities/shared/utility.js';
|
|
6
|
-
import { oasParameterSchema } from './parameters.js';
|
|
7
|
-
import { xScalarExampleSchema } from './request-examples.js';
|
|
8
|
-
import { oasExternalDocumentationSchema } from './spec-objects.js';
|
|
9
|
-
const xCodeSampleSchema = z.object({
|
|
10
|
-
lang: z.string().optional().catch(undefined),
|
|
11
|
-
label: z.string().optional().catch(undefined),
|
|
12
|
-
source: z.string(),
|
|
13
|
-
});
|
|
14
|
-
const xCodeSamplesSchema = z.object({
|
|
15
|
-
'x-codeSamples': xCodeSampleSchema.array().optional().catch(undefined),
|
|
16
|
-
'x-code-samples': xCodeSampleSchema.array().optional().catch(undefined),
|
|
17
|
-
'x-custom-examples': xCodeSampleSchema.array().optional().catch(undefined),
|
|
18
|
-
});
|
|
19
|
-
/** The code to execute */
|
|
20
|
-
const postResponseSchema = z.string();
|
|
21
|
-
const xPostResponseSchema = z.object({
|
|
22
|
-
'x-post-response': postResponseSchema.optional(),
|
|
23
|
-
});
|
|
24
|
-
const requestMethods = ['delete', 'get', 'head', 'options', 'patch', 'post', 'put', 'trace'];
|
|
25
|
-
const requestBodySchema = z.any();
|
|
26
|
-
/** Open API Compliant Request Validator */
|
|
27
|
-
const oasRequestSchema = z.object({
|
|
28
|
-
/**
|
|
29
|
-
* A list of tags for API documentation control. Tags can be used for logical
|
|
30
|
-
* grouping of operations by resources or any other qualifier.
|
|
31
|
-
*
|
|
32
|
-
* These tags are the openapi spec tag names, not uids
|
|
33
|
-
*/
|
|
34
|
-
'tags': z.string().array().optional(),
|
|
35
|
-
/** A short summary of what the operation does. */
|
|
36
|
-
'summary': z.string().optional(),
|
|
37
|
-
/** A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation. */
|
|
38
|
-
'description': z.string().optional(),
|
|
39
|
-
/**
|
|
40
|
-
* Unique string used to identify the operation. The id MUST be unique among all operations described in the API.
|
|
41
|
-
* The operationId value is case-sensitive. Tools and libraries MAY use the operationId to uniquely identify an
|
|
42
|
-
* operation, therefore, it is RECOMMENDED to follow bin common programming naming conventions./
|
|
43
|
-
*/
|
|
44
|
-
'operationId': z.string().optional(),
|
|
45
|
-
/**
|
|
46
|
-
* A declaration of which security mechanisms can be used across the API. The list of
|
|
47
|
-
* values includes alternative security requirement objects that can be used. Only
|
|
48
|
-
* one of the security requirement objects need to be satisfied to authorize a request.
|
|
49
|
-
* Individual operations can override this definition. To make security optional, an empty
|
|
50
|
-
* security requirement ({}) can be included in the array.
|
|
51
|
-
*/
|
|
52
|
-
'security': z.array(oasSecurityRequirementSchema).optional(),
|
|
53
|
-
/**
|
|
54
|
-
* The request body applicable for this operation. The requestBody is fully supported in HTTP methods where the
|
|
55
|
-
* HTTP 1.1 specification [RFC7231] has explicitly defined semantics for request bodies. In other cases where the
|
|
56
|
-
* HTTP spec is vague (such as GET, HEAD and DELETE), requestBody is permitted but does not have well-defined
|
|
57
|
-
* semantics and SHOULD be avoided if possible.
|
|
58
|
-
*/
|
|
59
|
-
'requestBody': requestBodySchema.optional(),
|
|
60
|
-
/**
|
|
61
|
-
* Request parameters
|
|
62
|
-
*/
|
|
63
|
-
'parameters': oasParameterSchema.array().optional(),
|
|
64
|
-
/**
|
|
65
|
-
* External documentation object
|
|
66
|
-
*/
|
|
67
|
-
'externalDocs': oasExternalDocumentationSchema.optional(),
|
|
68
|
-
'deprecated': z.boolean().optional(),
|
|
69
|
-
/** Response formats */
|
|
70
|
-
'responses': z.record(z.string(), z.any()).optional(),
|
|
71
|
-
/** Callbacks */
|
|
72
|
-
'callbacks': z.record(z.string(), z.record(z.string(), z.record(z.string(), z.any()))).optional(),
|
|
73
|
-
/** xScalar examples */
|
|
74
|
-
'x-scalar-examples': z.record(z.string(), xScalarExampleSchema).optional(),
|
|
75
|
-
/** Hide operations */
|
|
76
|
-
'x-internal': z.boolean().optional(),
|
|
77
|
-
/** Ignore operations */
|
|
78
|
-
'x-scalar-ignore': z.boolean().optional(),
|
|
79
|
-
});
|
|
80
|
-
/**
|
|
81
|
-
* An OpenAPI extension to indicate the stability of the operation
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```yaml
|
|
85
|
-
* x-scalar-stability: deprecated
|
|
86
|
-
* ```
|
|
87
|
-
*/
|
|
88
|
-
const ScalarStabilitySchema = z.object({
|
|
89
|
-
'x-scalar-stability': z
|
|
90
|
-
.enum([XScalarStability.Deprecated, XScalarStability.Experimental, XScalarStability.Stable])
|
|
91
|
-
.optional()
|
|
92
|
-
.catch(undefined),
|
|
93
|
-
});
|
|
94
|
-
/**
|
|
95
|
-
* Extended properties added to the spec definition for client usage
|
|
96
|
-
*
|
|
97
|
-
* WARNING: DO NOT ADD PROPERTIES THAT SHARE A NAME WITH OAS OPERATION ENTITIES
|
|
98
|
-
*
|
|
99
|
-
* This object is directly converted to a spec operation during saving
|
|
100
|
-
*/
|
|
101
|
-
const extendedRequestSchema = z.object({
|
|
102
|
-
type: z.literal('request').optional().default('request'),
|
|
103
|
-
uid: nanoidSchema.brand(),
|
|
104
|
-
/** Path Key */
|
|
105
|
-
path: z.string().optional().default(''),
|
|
106
|
-
/** Request Method */
|
|
107
|
-
method: z.enum(requestMethods).default('get'),
|
|
108
|
-
/** List of server UIDs specific to the request */
|
|
109
|
-
servers: z.string().brand().array().default([]),
|
|
110
|
-
/** The currently selected server */
|
|
111
|
-
selectedServerUid: z.string().brand().optional().nullable().default(null),
|
|
112
|
-
/** List of example UIDs associated with the request */
|
|
113
|
-
examples: z.string().brand().array().default([]),
|
|
114
|
-
/** List of security scheme UIDs associated with the request */
|
|
115
|
-
selectedSecuritySchemeUids: selectedSecuritySchemeUidSchema,
|
|
116
|
-
});
|
|
117
|
-
/** Unified request schema for client usage */
|
|
118
|
-
export const requestSchema = oasRequestSchema
|
|
119
|
-
.omit({ 'x-scalar-examples': true })
|
|
120
|
-
.merge(xCodeSamplesSchema)
|
|
121
|
-
.merge(ScalarStabilitySchema)
|
|
122
|
-
.merge(extendedRequestSchema)
|
|
123
|
-
.merge(xPostResponseSchema);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const serverSchema: z.ZodObject<{
|
|
3
|
-
url: z.ZodString;
|
|
4
|
-
description: z.ZodOptional<z.ZodString>;
|
|
5
|
-
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
6
|
-
enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
7
|
-
default: z.ZodOptional<z.ZodString>;
|
|
8
|
-
description: z.ZodOptional<z.ZodString>;
|
|
9
|
-
value: z.ZodOptional<z.ZodString>;
|
|
10
|
-
}, z.core.$strip>>>;
|
|
11
|
-
uid: z.core.$ZodBranded<z.ZodDefault<z.ZodString>, "server", "out">;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
export type Server = z.infer<typeof serverSchema>;
|
|
14
|
-
export type ServerPayload = z.input<typeof serverSchema>;
|
|
15
|
-
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAqEvB,eAAO,MAAM,YAAY;;;;;;;;;;iBAEvB,CAAA;AAEF,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;AACjD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { nanoidSchema } from '@scalar/types/utils';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
/**
|
|
4
|
-
* Server Variable Object
|
|
5
|
-
*
|
|
6
|
-
* An object representing a Server Variable for server URL template substitution.
|
|
7
|
-
*
|
|
8
|
-
* @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#server-variable-object
|
|
9
|
-
*/
|
|
10
|
-
const oasServerVariableSchema = z.object({
|
|
11
|
-
/**
|
|
12
|
-
* An enumeration of string values to be used if the substitution options are from a limited set. The array MUST NOT be empty.
|
|
13
|
-
*/
|
|
14
|
-
enum: z.array(z.string()).optional(),
|
|
15
|
-
/**
|
|
16
|
-
* REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value is not supplied.
|
|
17
|
-
* Note this behavior is different than the Schema Object's treatment of default values, because in those cases
|
|
18
|
-
* parameter values are optional. If the enum is defined, the value MUST exist in the enum's values.
|
|
19
|
-
*/
|
|
20
|
-
default: z.string().optional(),
|
|
21
|
-
/**
|
|
22
|
-
* An optional description for the server variable. CommonMark syntax MAY be used for rich text representation.
|
|
23
|
-
*/
|
|
24
|
-
description: z.string().optional(),
|
|
25
|
-
});
|
|
26
|
-
/** Extended schema for server variables */
|
|
27
|
-
const extendedServerVariableSchema = oasServerVariableSchema
|
|
28
|
-
.extend({
|
|
29
|
-
/** The value of the variable */
|
|
30
|
-
value: z.string().optional(),
|
|
31
|
-
})
|
|
32
|
-
.refine((data) => {
|
|
33
|
-
// Set default to the first enum value if invalid
|
|
34
|
-
if (Array.isArray(data.enum) && !data.enum.includes(data.default ?? '') && data.enum.length > 0) {
|
|
35
|
-
data.default = data.enum[0];
|
|
36
|
-
}
|
|
37
|
-
if (Array.isArray(data.enum) && data.enum.length === 0) {
|
|
38
|
-
delete data.enum;
|
|
39
|
-
}
|
|
40
|
-
// Always return true since we've modified the data to be valid
|
|
41
|
-
return true;
|
|
42
|
-
});
|
|
43
|
-
/**
|
|
44
|
-
* Server Object
|
|
45
|
-
*
|
|
46
|
-
* An object representing a Server.
|
|
47
|
-
*
|
|
48
|
-
* @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#server-object
|
|
49
|
-
*/
|
|
50
|
-
const oasServerSchema = z.object({
|
|
51
|
-
/**
|
|
52
|
-
* REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that
|
|
53
|
-
* the host location is relative to the location where the OpenAPI document is being served. Variable substitutions
|
|
54
|
-
* will be made when a variable is named in {brackets}.
|
|
55
|
-
*/
|
|
56
|
-
url: z.string(),
|
|
57
|
-
/**
|
|
58
|
-
* An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text
|
|
59
|
-
* representation.
|
|
60
|
-
*/
|
|
61
|
-
description: z.string().optional(),
|
|
62
|
-
/** A map between a variable name and its value. The value is used for substitution in the server's URL template. */
|
|
63
|
-
variables: z.record(z.string(), extendedServerVariableSchema).optional(),
|
|
64
|
-
});
|
|
65
|
-
export const serverSchema = oasServerSchema.extend({
|
|
66
|
-
uid: nanoidSchema.brand(),
|
|
67
|
-
});
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* License Object
|
|
4
|
-
*
|
|
5
|
-
* License information for the exposed API.
|
|
6
|
-
*
|
|
7
|
-
* @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#license-object
|
|
8
|
-
*/
|
|
9
|
-
export declare const oasLicenseSchema: z.ZodPipe<z.ZodObject<{
|
|
10
|
-
name: z.ZodCatch<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
11
|
-
identifier: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
12
|
-
url: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
13
|
-
}, z.core.$strip>, z.ZodTransform<{
|
|
14
|
-
name?: string | null | undefined;
|
|
15
|
-
identifier?: string | undefined;
|
|
16
|
-
url?: string | undefined;
|
|
17
|
-
}, {
|
|
18
|
-
name?: string | null | undefined;
|
|
19
|
-
identifier?: string | undefined;
|
|
20
|
-
url?: string | undefined;
|
|
21
|
-
}>>;
|
|
22
|
-
/**
|
|
23
|
-
* Contact Object
|
|
24
|
-
*
|
|
25
|
-
* Contact information for the exposed API.
|
|
26
|
-
*
|
|
27
|
-
* @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#contact-object
|
|
28
|
-
*/
|
|
29
|
-
export declare const oasContactSchema: z.ZodPipe<z.ZodObject<{
|
|
30
|
-
name: z.ZodOptional<z.ZodString>;
|
|
31
|
-
url: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
32
|
-
email: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
33
|
-
}, z.core.$strip>, z.ZodTransform<{
|
|
34
|
-
name?: string | undefined;
|
|
35
|
-
url?: string | undefined;
|
|
36
|
-
email?: string | undefined;
|
|
37
|
-
}, {
|
|
38
|
-
name?: string | undefined;
|
|
39
|
-
url?: string | undefined;
|
|
40
|
-
email?: string | undefined;
|
|
41
|
-
}>>;
|
|
42
|
-
/**
|
|
43
|
-
* Info Object
|
|
44
|
-
*
|
|
45
|
-
* The object provides metadata about the API. The metadata MAY be used by the clients if needed,
|
|
46
|
-
* and MAY be presented in editing or documentation generation tools for convenience.
|
|
47
|
-
*
|
|
48
|
-
* @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#info-object
|
|
49
|
-
*/
|
|
50
|
-
export declare const oasInfoSchema: z.ZodPipe<z.ZodObject<{
|
|
51
|
-
title: z.ZodCatch<z.ZodString>;
|
|
52
|
-
summary: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
53
|
-
description: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
54
|
-
termsOfService: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
55
|
-
contact: z.ZodCatch<z.ZodOptional<z.ZodPipe<z.ZodObject<{
|
|
56
|
-
name: z.ZodOptional<z.ZodString>;
|
|
57
|
-
url: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
58
|
-
email: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
59
|
-
}, z.core.$strip>, z.ZodTransform<{
|
|
60
|
-
name?: string | undefined;
|
|
61
|
-
url?: string | undefined;
|
|
62
|
-
email?: string | undefined;
|
|
63
|
-
}, {
|
|
64
|
-
name?: string | undefined;
|
|
65
|
-
url?: string | undefined;
|
|
66
|
-
email?: string | undefined;
|
|
67
|
-
}>>>>;
|
|
68
|
-
license: z.ZodCatch<z.ZodOptional<z.ZodPipe<z.ZodObject<{
|
|
69
|
-
name: z.ZodCatch<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
70
|
-
identifier: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
71
|
-
url: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
72
|
-
}, z.core.$strip>, z.ZodTransform<{
|
|
73
|
-
name?: string | null | undefined;
|
|
74
|
-
identifier?: string | undefined;
|
|
75
|
-
url?: string | undefined;
|
|
76
|
-
}, {
|
|
77
|
-
name?: string | null | undefined;
|
|
78
|
-
identifier?: string | undefined;
|
|
79
|
-
url?: string | undefined;
|
|
80
|
-
}>>>>;
|
|
81
|
-
version: z.ZodCatch<z.ZodString>;
|
|
82
|
-
'x-scalar-sdk-installation': z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
83
|
-
lang: z.ZodString;
|
|
84
|
-
source: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
85
|
-
description: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
86
|
-
}, z.core.$strip>>>>;
|
|
87
|
-
}, z.core.$strip>, z.ZodTransform<{
|
|
88
|
-
title: string;
|
|
89
|
-
version: string;
|
|
90
|
-
summary?: string | undefined;
|
|
91
|
-
description?: string | undefined;
|
|
92
|
-
termsOfService?: string | undefined;
|
|
93
|
-
contact?: {
|
|
94
|
-
name?: string | undefined;
|
|
95
|
-
url?: string | undefined;
|
|
96
|
-
email?: string | undefined;
|
|
97
|
-
} | undefined;
|
|
98
|
-
license?: {
|
|
99
|
-
name?: string | null | undefined;
|
|
100
|
-
identifier?: string | undefined;
|
|
101
|
-
url?: string | undefined;
|
|
102
|
-
} | undefined;
|
|
103
|
-
'x-scalar-sdk-installation'?: {
|
|
104
|
-
lang: string;
|
|
105
|
-
source?: string | undefined;
|
|
106
|
-
description?: string | undefined;
|
|
107
|
-
}[] | undefined;
|
|
108
|
-
}, {
|
|
109
|
-
title: string;
|
|
110
|
-
version: string;
|
|
111
|
-
summary?: string | undefined;
|
|
112
|
-
description?: string | undefined;
|
|
113
|
-
termsOfService?: string | undefined;
|
|
114
|
-
contact?: {
|
|
115
|
-
name?: string | undefined;
|
|
116
|
-
url?: string | undefined;
|
|
117
|
-
email?: string | undefined;
|
|
118
|
-
} | undefined;
|
|
119
|
-
license?: {
|
|
120
|
-
name?: string | null | undefined;
|
|
121
|
-
identifier?: string | undefined;
|
|
122
|
-
url?: string | undefined;
|
|
123
|
-
} | undefined;
|
|
124
|
-
'x-scalar-sdk-installation'?: {
|
|
125
|
-
lang: string;
|
|
126
|
-
source?: string | undefined;
|
|
127
|
-
description?: string | undefined;
|
|
128
|
-
}[] | undefined;
|
|
129
|
-
}>>;
|
|
130
|
-
/**
|
|
131
|
-
* External Documentation Object
|
|
132
|
-
*
|
|
133
|
-
* Allows referencing an external resource for extended documentation.
|
|
134
|
-
*
|
|
135
|
-
* @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#external-documentation-object
|
|
136
|
-
*/
|
|
137
|
-
export declare const oasExternalDocumentationSchema: z.ZodPipe<z.ZodObject<{
|
|
138
|
-
description: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
139
|
-
url: z.ZodString;
|
|
140
|
-
}, z.core.$strip>, z.ZodTransform<{
|
|
141
|
-
url: string;
|
|
142
|
-
description?: string | undefined;
|
|
143
|
-
}, {
|
|
144
|
-
url: string;
|
|
145
|
-
description?: string | undefined;
|
|
146
|
-
}>>;
|
|
147
|
-
export declare const tagSchema: z.ZodObject<{
|
|
148
|
-
type: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"tag">>>;
|
|
149
|
-
name: z.ZodString;
|
|
150
|
-
description: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
151
|
-
externalDocs: z.ZodOptional<z.ZodPipe<z.ZodObject<{
|
|
152
|
-
description: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
153
|
-
url: z.ZodString;
|
|
154
|
-
}, z.core.$strip>, z.ZodTransform<{
|
|
155
|
-
url: string;
|
|
156
|
-
description?: string | undefined;
|
|
157
|
-
}, {
|
|
158
|
-
url: string;
|
|
159
|
-
description?: string | undefined;
|
|
160
|
-
}>>>;
|
|
161
|
-
'x-scalar-children': z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
162
|
-
tagName: z.ZodString;
|
|
163
|
-
}, z.core.$strip>>>>;
|
|
164
|
-
'x-internal': z.ZodOptional<z.ZodBoolean>;
|
|
165
|
-
'x-scalar-ignore': z.ZodOptional<z.ZodBoolean>;
|
|
166
|
-
uid: z.core.$ZodBranded<z.ZodDefault<z.ZodString>, "tag", "out">;
|
|
167
|
-
children: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.core.$ZodBranded<z.ZodString, "operation", "out">, z.core.$ZodBranded<z.ZodString, "tag", "out">]>>>;
|
|
168
|
-
}, z.core.$strip>;
|
|
169
|
-
export type Tag = z.infer<typeof tagSchema>;
|
|
170
|
-
export type TagPayload = z.input<typeof tagSchema>;
|
|
171
|
-
//# sourceMappingURL=spec-objects.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spec-objects.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/spec-objects.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAcvB;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;GAWI,CAAA;AAEjC;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;GASI,CAAA;AAEjC;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqBO,CAAA;AAEjC;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;GAOV,CAAA;AAqCjC,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;iBAMpB,CAAA;AAEF,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAC3C,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA"}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { omitUndefinedValues } from '@scalar/helpers/object/omit-undefined-values';
|
|
2
|
-
import { nanoidSchema } from '@scalar/types/utils';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
const xScalarSdkInstallationSchema = z.object({
|
|
5
|
-
'x-scalar-sdk-installation': z
|
|
6
|
-
.object({
|
|
7
|
-
lang: z.string(),
|
|
8
|
-
source: z.string().optional().catch(undefined),
|
|
9
|
-
description: z.string().optional().catch(undefined),
|
|
10
|
-
})
|
|
11
|
-
.array()
|
|
12
|
-
.optional()
|
|
13
|
-
.catch(undefined),
|
|
14
|
-
});
|
|
15
|
-
/**
|
|
16
|
-
* License Object
|
|
17
|
-
*
|
|
18
|
-
* License information for the exposed API.
|
|
19
|
-
*
|
|
20
|
-
* @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#license-object
|
|
21
|
-
*/
|
|
22
|
-
export const oasLicenseSchema = z
|
|
23
|
-
.object({
|
|
24
|
-
/** REQUIRED. The license name used for the API. */
|
|
25
|
-
name: z.string().optional().nullable().catch(null),
|
|
26
|
-
/** An SPDX license expression for the API. The identifier field is mutually exclusive of the url field. */
|
|
27
|
-
identifier: z.string().optional().catch(undefined),
|
|
28
|
-
/**
|
|
29
|
-
* A URI for the license used for the API. This MUST be in the form of a URI. The url field is mutually exclusive of the identifier field.
|
|
30
|
-
*/
|
|
31
|
-
url: z.string().url().optional().catch(undefined),
|
|
32
|
-
})
|
|
33
|
-
.transform(omitUndefinedValues);
|
|
34
|
-
/**
|
|
35
|
-
* Contact Object
|
|
36
|
-
*
|
|
37
|
-
* Contact information for the exposed API.
|
|
38
|
-
*
|
|
39
|
-
* @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#contact-object
|
|
40
|
-
*/
|
|
41
|
-
export const oasContactSchema = z
|
|
42
|
-
.object({
|
|
43
|
-
/** The identifying name of the contact person/organization. */
|
|
44
|
-
name: z.string().optional(),
|
|
45
|
-
/** The URL pointing to the contact information. This MUST be in the form of a URL. */
|
|
46
|
-
url: z.string().url().optional().catch(undefined),
|
|
47
|
-
/** The email address of the contact person/organization. This MUST be in the form of an email address. */
|
|
48
|
-
email: z.string().optional().catch(undefined),
|
|
49
|
-
})
|
|
50
|
-
.transform(omitUndefinedValues);
|
|
51
|
-
/**
|
|
52
|
-
* Info Object
|
|
53
|
-
*
|
|
54
|
-
* The object provides metadata about the API. The metadata MAY be used by the clients if needed,
|
|
55
|
-
* and MAY be presented in editing or documentation generation tools for convenience.
|
|
56
|
-
*
|
|
57
|
-
* @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#info-object
|
|
58
|
-
*/
|
|
59
|
-
export const oasInfoSchema = z
|
|
60
|
-
.object({
|
|
61
|
-
/** REQUIRED. The title of the API. */
|
|
62
|
-
title: z.string().catch('API'),
|
|
63
|
-
/** A short summary of the API. */
|
|
64
|
-
summary: z.string().optional().catch(undefined),
|
|
65
|
-
/** A description of the API. CommonMark syntax MAY be used for rich text representation. */
|
|
66
|
-
description: z.string().optional().catch(undefined),
|
|
67
|
-
/** A URL to the Terms of Service for the API. This MUST be in the form of a URL. */
|
|
68
|
-
termsOfService: z.string().url().optional().catch(undefined),
|
|
69
|
-
/** The contact information for the exposed API. */
|
|
70
|
-
contact: oasContactSchema.optional().catch(undefined),
|
|
71
|
-
/** The license information for the exposed API. */
|
|
72
|
-
license: oasLicenseSchema.optional().catch(undefined),
|
|
73
|
-
/**
|
|
74
|
-
* REQUIRED. The version of the OpenAPI Document (which is distinct from the OpenAPI Specification version or the
|
|
75
|
-
* version of the API being described or the version of the OpenAPI Description).
|
|
76
|
-
*/
|
|
77
|
-
version: z.string().catch('1.0'),
|
|
78
|
-
})
|
|
79
|
-
.merge(xScalarSdkInstallationSchema)
|
|
80
|
-
.transform(omitUndefinedValues);
|
|
81
|
-
/**
|
|
82
|
-
* External Documentation Object
|
|
83
|
-
*
|
|
84
|
-
* Allows referencing an external resource for extended documentation.
|
|
85
|
-
*
|
|
86
|
-
* @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#external-documentation-object
|
|
87
|
-
*/
|
|
88
|
-
export const oasExternalDocumentationSchema = z
|
|
89
|
-
.object({
|
|
90
|
-
/** A description of the target documentation. CommonMark syntax MAY be used for rich text representation. */
|
|
91
|
-
description: z.string().optional().catch(undefined),
|
|
92
|
-
/** REQUIRED. The URL for the target documentation. This MUST be in the form of a URL. */
|
|
93
|
-
url: z.string(),
|
|
94
|
-
})
|
|
95
|
-
.transform(omitUndefinedValues);
|
|
96
|
-
// not used but kept for consistency
|
|
97
|
-
// export type ExternalDocumentation = z.infer<typeof oasExternalDocumentationSchema>
|
|
98
|
-
const xScalarNestedSchema = z
|
|
99
|
-
.object({
|
|
100
|
-
tagName: z.string(),
|
|
101
|
-
})
|
|
102
|
-
.array();
|
|
103
|
-
/**
|
|
104
|
-
* Tag Object
|
|
105
|
-
*
|
|
106
|
-
* Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag
|
|
107
|
-
* defined in the Operation Object instances.
|
|
108
|
-
*
|
|
109
|
-
* @see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#tag-object
|
|
110
|
-
*/
|
|
111
|
-
const oasTagSchema = z.object({
|
|
112
|
-
// TODO: Remove
|
|
113
|
-
/**
|
|
114
|
-
* @deprecated Needs to be remove as it is not a spec property
|
|
115
|
-
*/
|
|
116
|
-
'type': z.literal('tag').optional().default('tag'),
|
|
117
|
-
/** REQUIRED. The name of the tag. */
|
|
118
|
-
'name': z.string(),
|
|
119
|
-
/** A description for the tag. CommonMark syntax MAY be used for rich text representation. */
|
|
120
|
-
'description': z.string().optional().catch(undefined),
|
|
121
|
-
/** Additional external documentation for this tag. */
|
|
122
|
-
'externalDocs': oasExternalDocumentationSchema.optional(),
|
|
123
|
-
'x-scalar-children': xScalarNestedSchema.default([]).optional(),
|
|
124
|
-
/** Hide collections */
|
|
125
|
-
'x-internal': z.boolean().optional(),
|
|
126
|
-
'x-scalar-ignore': z.boolean().optional(),
|
|
127
|
-
});
|
|
128
|
-
export const tagSchema = oasTagSchema.extend({
|
|
129
|
-
uid: nanoidSchema.brand(),
|
|
130
|
-
children: z
|
|
131
|
-
.union([z.string().brand(), z.string().brand()])
|
|
132
|
-
.array()
|
|
133
|
-
.default([]),
|
|
134
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
declare const xScalarEnvironmentSchema: z.ZodObject<{
|
|
3
|
-
description: z.ZodOptional<z.ZodString>;
|
|
4
|
-
color: z.ZodOptional<z.ZodString>;
|
|
5
|
-
variables: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
6
|
-
description: z.ZodOptional<z.ZodString>;
|
|
7
|
-
default: z.ZodDefault<z.ZodString>;
|
|
8
|
-
}, z.core.$strip>, z.ZodString]>>;
|
|
9
|
-
}, z.core.$strip>;
|
|
10
|
-
/** A map of environments by name */
|
|
11
|
-
export declare const xScalarEnvironmentsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
12
|
-
description: z.ZodOptional<z.ZodString>;
|
|
13
|
-
color: z.ZodOptional<z.ZodString>;
|
|
14
|
-
variables: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
15
|
-
description: z.ZodOptional<z.ZodString>;
|
|
16
|
-
default: z.ZodDefault<z.ZodString>;
|
|
17
|
-
}, z.core.$strip>, z.ZodString]>>;
|
|
18
|
-
}, z.core.$strip>>;
|
|
19
|
-
export type XScalarEnvironment = z.infer<typeof xScalarEnvironmentSchema>;
|
|
20
|
-
export type XScalarEnvironments = z.infer<typeof xScalarEnvironmentsSchema>;
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=x-scalar-environments.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x-scalar-environments.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/x-scalar-environments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAYvB,QAAA,MAAM,wBAAwB;;;;;;;iBAK5B,CAAA;AAEF,oCAAoC;AACpC,eAAO,MAAM,yBAAyB;;;;;;;kBAKrC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AACzE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
const xScalarEnvVarSchema = z.union([
|
|
3
|
-
z.object({
|
|
4
|
-
description: z.string().optional(),
|
|
5
|
-
default: z.string().default(''),
|
|
6
|
-
}),
|
|
7
|
-
z.string(),
|
|
8
|
-
]);
|
|
9
|
-
// not used but kept for consistency
|
|
10
|
-
// export type XScalarEnvVar = z.infer<typeof xScalarEnvVarSchema>
|
|
11
|
-
const xScalarEnvironmentSchema = z.object({
|
|
12
|
-
description: z.string().optional(),
|
|
13
|
-
color: z.string().optional(),
|
|
14
|
-
/** A map of variables by name */
|
|
15
|
-
variables: z.record(z.string(), xScalarEnvVarSchema),
|
|
16
|
-
});
|
|
17
|
-
/** A map of environments by name */
|
|
18
|
-
export const xScalarEnvironmentsSchema = z.record(
|
|
19
|
-
/** Name */
|
|
20
|
-
z.string(),
|
|
21
|
-
/** Environment definition */
|
|
22
|
-
xScalarEnvironmentSchema);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"x-scalar-secrets.d.ts","sourceRoot":"","sources":["../../../src/entities/spec/x-scalar-secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,eAAO,MAAM,oBAAoB;;;kBAA+C,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
const xScalarSecretVarSchema = z.object({
|
|
3
|
-
description: z.string().optional(),
|
|
4
|
-
example: z.string().optional(),
|
|
5
|
-
});
|
|
6
|
-
export const xScalarSecretsSchema = z.record(z.string(), xScalarSecretVarSchema);
|
|
7
|
-
// not used but kept for consistency
|
|
8
|
-
// export type XScalarSecrets = z.infer<typeof xScalarSecretsSchema>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entities/workspace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,eAAe,GAChB,MAAM,aAAa,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { workspaceSchema, } from './workspace.js';
|