@scalar/oas-utils 0.1.16 → 0.2.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 +18 -0
- package/dist/entities/index.d.ts +2 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +1 -0
- package/dist/entities/workspace/collection/collection.d.ts +314 -0
- package/dist/entities/workspace/collection/collection.d.ts.map +1 -0
- package/dist/entities/workspace/collection/collection.js +112 -0
- package/dist/entities/workspace/collection/index.d.ts +2 -0
- package/dist/entities/workspace/collection/index.d.ts.map +1 -0
- package/dist/entities/workspace/collection/index.js +1 -0
- package/dist/entities/workspace/cookie/cookie.d.ts +84 -0
- package/dist/entities/workspace/cookie/cookie.d.ts.map +1 -0
- package/dist/entities/workspace/cookie/cookie.js +44 -0
- package/dist/entities/workspace/cookie/index.d.ts +2 -0
- package/dist/entities/workspace/cookie/index.d.ts.map +1 -0
- package/dist/entities/workspace/cookie/index.js +1 -0
- package/dist/entities/workspace/environment/environment.d.ts +55 -0
- package/dist/entities/workspace/environment/environment.d.ts.map +1 -0
- package/dist/entities/workspace/environment/environment.js +23 -0
- package/dist/entities/workspace/environment/index.d.ts +2 -0
- package/dist/entities/workspace/environment/index.d.ts.map +1 -0
- package/dist/entities/workspace/environment/index.js +1 -0
- package/dist/entities/workspace/folder/folder.d.ts +36 -0
- package/dist/entities/workspace/folder/folder.d.ts.map +1 -0
- package/dist/entities/workspace/folder/folder.js +21 -0
- package/dist/entities/workspace/folder/index.d.ts +2 -0
- package/dist/entities/workspace/folder/index.d.ts.map +1 -0
- package/dist/entities/workspace/folder/index.js +1 -0
- package/dist/entities/workspace/index.d.ts +2 -0
- package/dist/entities/workspace/index.d.ts.map +1 -0
- package/dist/entities/workspace/index.js +1 -0
- package/dist/entities/workspace/security-schemes/index.d.ts +2 -0
- package/dist/entities/workspace/security-schemes/index.d.ts.map +1 -0
- package/dist/entities/workspace/security-schemes/index.js +1 -0
- package/dist/entities/workspace/security-schemes/security-schemes.d.ts +19 -0
- package/dist/entities/workspace/security-schemes/security-schemes.d.ts.map +1 -0
- package/dist/entities/workspace/security-schemes/security-schemes.js +15 -0
- package/dist/entities/workspace/server/index.d.ts +2 -0
- package/dist/entities/workspace/server/index.d.ts.map +1 -0
- package/dist/entities/workspace/server/index.js +1 -0
- package/dist/entities/workspace/server/server.d.ts +84 -0
- package/dist/entities/workspace/server/server.d.ts.map +1 -0
- package/dist/entities/workspace/server/server.js +46 -0
- package/dist/entities/workspace/shared/index.d.ts +2 -0
- package/dist/entities/workspace/shared/index.d.ts.map +1 -0
- package/dist/entities/workspace/shared/index.js +1 -0
- package/dist/entities/workspace/shared/utility.d.ts +6 -0
- package/dist/entities/workspace/shared/utility.d.ts.map +1 -0
- package/dist/entities/workspace/shared/utility.js +11 -0
- package/dist/entities/workspace/spec/components.d.ts +3 -0
- package/dist/entities/workspace/spec/components.d.ts.map +1 -0
- package/dist/entities/workspace/spec/index.d.ts +5 -0
- package/dist/entities/workspace/spec/index.d.ts.map +1 -0
- package/dist/entities/workspace/spec/index.js +2 -0
- package/dist/entities/workspace/spec/parameters.d.ts +16 -0
- package/dist/entities/workspace/spec/parameters.d.ts.map +1 -0
- package/dist/entities/workspace/spec/refs.d.ts +30 -0
- package/dist/entities/workspace/spec/refs.d.ts.map +1 -0
- package/dist/entities/workspace/spec/refs.js +9 -0
- package/dist/entities/workspace/spec/request-examples.d.ts +479 -0
- package/dist/entities/workspace/spec/request-examples.d.ts.map +1 -0
- package/dist/entities/workspace/spec/request-examples.js +68 -0
- package/dist/entities/workspace/spec/requests.d.ts +149 -0
- package/dist/entities/workspace/spec/requests.d.ts.map +1 -0
- package/dist/entities/workspace/spec/requests.js +52 -0
- package/dist/entities/workspace/spec/spec.d.ts +18 -0
- package/dist/entities/workspace/spec/spec.d.ts.map +1 -0
- package/dist/entities/workspace/spec/spec.js +8 -0
- package/dist/entities/workspace/workspace.d.ts +45 -0
- package/dist/entities/workspace/workspace.d.ts.map +1 -0
- package/dist/entities/workspace/workspace.js +20 -0
- package/dist/helpers/createHash.d.ts.map +1 -0
- package/dist/helpers/createHash.js +20 -0
- package/dist/helpers/deepMerge.d.ts +7 -0
- package/dist/helpers/deepMerge.d.ts.map +1 -0
- package/dist/helpers/deepMerge.js +28 -0
- package/dist/helpers/fetchSpecFromUrl.d.ts.map +1 -0
- package/dist/helpers/fetchSpecFromUrl.js +31 -0
- package/dist/helpers/httpMethods.d.ts +93 -0
- package/dist/helpers/httpMethods.d.ts.map +1 -0
- package/dist/helpers/httpMethods.js +64 -0
- package/dist/helpers/httpStatusCodes.d.ts.map +1 -0
- package/dist/helpers/httpStatusCodes.js +252 -0
- package/dist/helpers/index.d.ts +14 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +13 -0
- package/dist/helpers/iterateTitle.d.ts +5 -0
- package/dist/helpers/iterateTitle.d.ts.map +1 -0
- package/dist/helpers/iterateTitle.js +15 -0
- package/dist/helpers/json2xml.d.ts.map +1 -0
- package/dist/helpers/json2xml.js +51 -0
- package/dist/{normalizeMimeType.d.ts → helpers/normalizeMimeType.d.ts} +1 -1
- package/dist/helpers/normalizeMimeType.d.ts.map +1 -0
- package/dist/helpers/normalizeMimeType.js +20 -0
- package/dist/{normalizeMimeTypeObject.d.ts → helpers/normalizeMimeTypeObject.d.ts} +1 -1
- package/dist/helpers/normalizeMimeTypeObject.d.ts.map +1 -0
- package/dist/helpers/normalizeMimeTypeObject.js +34 -0
- package/dist/helpers/objectMerge.d.ts +5 -0
- package/dist/helpers/objectMerge.d.ts.map +1 -0
- package/dist/helpers/objectMerge.js +16 -0
- package/dist/{parse.d.ts → helpers/parse.d.ts} +1 -1
- package/dist/helpers/parse.d.ts.map +1 -0
- package/dist/helpers/parse.js +89 -0
- package/dist/helpers/prettyPrintJson.d.ts.map +1 -0
- package/dist/helpers/prettyPrintJson.js +19 -0
- package/dist/helpers/schema-model.d.ts +5 -0
- package/dist/helpers/schema-model.d.ts.map +1 -0
- package/dist/helpers/schema-model.js +21 -0
- package/dist/{ssrState.d.ts → helpers/ssrState.d.ts} +1 -1
- package/dist/helpers/ssrState.d.ts.map +1 -0
- package/dist/helpers/ssrState.js +9 -0
- package/dist/index.d.ts +0 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -892
- package/dist/{getExampleFromSchema.d.ts → spec-getters/getExampleFromSchema.d.ts} +5 -1
- package/dist/spec-getters/getExampleFromSchema.d.ts.map +1 -0
- package/dist/spec-getters/getExampleFromSchema.js +246 -0
- package/dist/{getParametersFromOperation.d.ts → spec-getters/getParametersFromOperation.d.ts} +1 -1
- package/dist/spec-getters/getParametersFromOperation.d.ts.map +1 -0
- package/dist/spec-getters/getParametersFromOperation.js +44 -0
- package/dist/{getRequestBodyFromOperation.d.ts → spec-getters/getRequestBodyFromOperation.d.ts} +1 -1
- package/dist/spec-getters/getRequestBodyFromOperation.d.ts.map +1 -0
- package/dist/spec-getters/getRequestBodyFromOperation.js +199 -0
- package/dist/{getRequestFromOperation.d.ts → spec-getters/getRequestFromOperation.d.ts} +5 -1
- package/dist/spec-getters/getRequestFromOperation.d.ts.map +1 -0
- package/dist/spec-getters/getRequestFromOperation.js +49 -0
- package/dist/spec-getters/index.d.ts +5 -0
- package/dist/spec-getters/index.d.ts.map +1 -0
- package/dist/spec-getters/index.js +4 -0
- package/dist/transforms/import-spec.d.ts +67 -0
- package/dist/transforms/import-spec.d.ts.map +1 -0
- package/dist/transforms/import-spec.js +133 -0
- package/dist/transforms/index.d.ts +2 -0
- package/dist/transforms/index.d.ts.map +1 -0
- package/dist/transforms/index.js +1 -0
- package/dist/types.d.ts +43 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +62 -13
- package/dist/createHash.d.ts.map +0 -1
- package/dist/fetchSpecFromUrl.d.ts.map +0 -1
- package/dist/getExampleFromSchema.d.ts.map +0 -1
- package/dist/getHarRequest.d.ts +0 -4
- package/dist/getHarRequest.d.ts.map +0 -1
- package/dist/getParametersFromOperation.d.ts.map +0 -1
- package/dist/getRequestBodyFromOperation.d.ts.map +0 -1
- package/dist/getRequestFromOperation.d.ts.map +0 -1
- package/dist/httpStatusCodes.d.ts.map +0 -1
- package/dist/json2xml.d.ts.map +0 -1
- package/dist/normalizeMimeType.d.ts.map +0 -1
- package/dist/normalizeMimeTypeObject.d.ts.map +0 -1
- package/dist/parse.d.ts.map +0 -1
- package/dist/prettyPrintJson.d.ts.map +0 -1
- package/dist/ssrState.d.ts.map +0 -1
- /package/dist/{createHash.d.ts → helpers/createHash.d.ts} +0 -0
- /package/dist/{fetchSpecFromUrl.d.ts → helpers/fetchSpecFromUrl.d.ts} +0 -0
- /package/dist/{httpStatusCodes.d.ts → helpers/httpStatusCodes.d.ts} +0 -0
- /package/dist/{json2xml.d.ts → helpers/json2xml.d.ts} +0 -0
- /package/dist/{prettyPrintJson.d.ts → helpers/prettyPrintJson.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/environment/environment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUrB,CAAA;AAEF,kBAAkB;AAClB,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC3D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAElE,gCAAgC;AAChC,eAAO,MAAM,iBAAiB,YAAa,kBAAkB;;;;;;;;;;CACZ,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { nanoidSchema } from '../shared/utility.js';
|
|
3
|
+
import { deepMerge } from '../../../helpers/deepMerge.js';
|
|
4
|
+
|
|
5
|
+
const parsed = z.object({
|
|
6
|
+
key: z.string(),
|
|
7
|
+
value: z.string(),
|
|
8
|
+
});
|
|
9
|
+
const environmentSchema = z.object({
|
|
10
|
+
uid: nanoidSchema,
|
|
11
|
+
name: z.string().optional().default('Default Environment'),
|
|
12
|
+
color: z.string().optional().default('blue'),
|
|
13
|
+
raw: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.default(JSON.stringify({ exampleKey: 'exampleValue' }, null, 2)),
|
|
17
|
+
parsed: z.array(parsed).optional().default([]),
|
|
18
|
+
isDefault: z.boolean().optional(),
|
|
19
|
+
});
|
|
20
|
+
/** Create environment helper */
|
|
21
|
+
const createEnvironment = (payload) => deepMerge(environmentSchema.parse({}), payload);
|
|
22
|
+
|
|
23
|
+
export { createEnvironment };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/environment/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createEnvironment } from './environment.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const folderSchema: z.ZodObject<{
|
|
3
|
+
/** Used for database sync only */
|
|
4
|
+
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
5
|
+
/** Will correspond to the slash separate path some, some/nested or some/nested/folder */
|
|
6
|
+
name: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
7
|
+
/** Folder descriptions */
|
|
8
|
+
description: z.ZodOptional<z.ZodString>;
|
|
9
|
+
/**
|
|
10
|
+
* List of uids that correspond to requests or folders
|
|
11
|
+
* WARNING: while uids are used we must check that corresponding $refs are not duplicated
|
|
12
|
+
*/
|
|
13
|
+
childUids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
name: string;
|
|
16
|
+
uid: string;
|
|
17
|
+
childUids: string[];
|
|
18
|
+
description?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
uid?: string | undefined;
|
|
21
|
+
name?: string | undefined;
|
|
22
|
+
description?: string | undefined;
|
|
23
|
+
childUids?: string[] | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
/** Folders will correspond to the x- */
|
|
26
|
+
export type Folder = z.infer<typeof folderSchema>;
|
|
27
|
+
export type FolderPayload = z.input<typeof folderSchema>;
|
|
28
|
+
/** Create folder helper */
|
|
29
|
+
export declare const createFolder: (payload: FolderPayload) => {
|
|
30
|
+
name: string;
|
|
31
|
+
uid: string;
|
|
32
|
+
childUids: string[];
|
|
33
|
+
description?: string | undefined;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=folder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folder.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/folder/folder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,QAAA,MAAM,YAAY;IAChB,kCAAkC;;IAElC,yFAAyF;;IAEzF,0BAA0B;;IAE1B;;;OAGG;;;;;;;;;;;;EAEH,CAAA;AAEF,wCAAwC;AACxC,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;AAExD,2BAA2B;AAC3B,eAAO,MAAM,YAAY,YAAa,aAAa;;;;;CACP,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { nanoidSchema } from '../shared/utility.js';
|
|
3
|
+
import { deepMerge } from '../../../helpers/deepMerge.js';
|
|
4
|
+
|
|
5
|
+
const folderSchema = z.object({
|
|
6
|
+
/** Used for database sync only */
|
|
7
|
+
uid: nanoidSchema,
|
|
8
|
+
/** Will correspond to the slash separate path some, some/nested or some/nested/folder */
|
|
9
|
+
name: z.string().optional().default('Folder'),
|
|
10
|
+
/** Folder descriptions */
|
|
11
|
+
description: z.string().optional(),
|
|
12
|
+
/**
|
|
13
|
+
* List of uids that correspond to requests or folders
|
|
14
|
+
* WARNING: while uids are used we must check that corresponding $refs are not duplicated
|
|
15
|
+
*/
|
|
16
|
+
childUids: z.array(z.string()).default([]),
|
|
17
|
+
});
|
|
18
|
+
/** Create folder helper */
|
|
19
|
+
const createFolder = (payload) => deepMerge(folderSchema.parse({}), payload);
|
|
20
|
+
|
|
21
|
+
export { createFolder };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/folder/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createFolder } from './folder.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entities/workspace/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createWorkspace } from './workspace.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/security-schemes/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createSecurityScheme } from './security-schemes.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const securityScheme: z.ZodObject<{
|
|
3
|
+
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2",
|
|
4
|
+
* "openIdConnect". */
|
|
5
|
+
type: z.ZodDefault<z.ZodOptional<z.ZodEnum<["apiKey", "http", "mutualTLS", "oauth2"]>>>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
type: "apiKey" | "http" | "mutualTLS" | "oauth2";
|
|
8
|
+
}, {
|
|
9
|
+
type?: "apiKey" | "http" | "mutualTLS" | "oauth2" | undefined;
|
|
10
|
+
}>;
|
|
11
|
+
/** Folders will correspond to the x- */
|
|
12
|
+
export type SecurityScheme = z.infer<typeof securityScheme>;
|
|
13
|
+
export type SecuritySchemePayload = z.input<typeof securityScheme>;
|
|
14
|
+
/** Create Security Scheme with defaults */
|
|
15
|
+
export declare const createSecurityScheme: (payload: SecuritySchemePayload) => {
|
|
16
|
+
type: "apiKey" | "http" | "mutualTLS" | "oauth2";
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=security-schemes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-schemes.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/security-schemes/security-schemes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,QAAA,MAAM,cAAc;IAClB;0BACsB;;;;;;EAKtB,CAAA;AAEF,wCAAwC;AACxC,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAC3D,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAElE,2CAA2C;AAC3C,eAAO,MAAM,oBAAoB,YAAa,qBAAqB;;CACrB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { deepMerge } from '../../../helpers/deepMerge.js';
|
|
3
|
+
|
|
4
|
+
const securityScheme = z.object({
|
|
5
|
+
/** REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "mutualTLS", "oauth2",
|
|
6
|
+
* "openIdConnect". */
|
|
7
|
+
type: z
|
|
8
|
+
.enum(['apiKey', 'http', 'mutualTLS', 'oauth2'])
|
|
9
|
+
.optional()
|
|
10
|
+
.default('apiKey'),
|
|
11
|
+
});
|
|
12
|
+
/** Create Security Scheme with defaults */
|
|
13
|
+
const createSecurityScheme = (payload) => deepMerge(securityScheme.parse({}), payload);
|
|
14
|
+
|
|
15
|
+
export { createSecurityScheme };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createServer } from './server.js';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const serverSchema: z.ZodObject<{
|
|
3
|
+
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
4
|
+
/**
|
|
5
|
+
* REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that
|
|
6
|
+
* the host location is relative to the location where the OpenAPI document is being served. Variable substitutions
|
|
7
|
+
* will be made when a variable is named in {brackets}.
|
|
8
|
+
*/
|
|
9
|
+
url: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
10
|
+
/**
|
|
11
|
+
* An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text
|
|
12
|
+
* representation.
|
|
13
|
+
*/
|
|
14
|
+
description: z.ZodOptional<z.ZodString>;
|
|
15
|
+
/** A map between a variable name and its value. The value is used for substitution in the server’s URL template. */
|
|
16
|
+
variables: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
17
|
+
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
18
|
+
/**
|
|
19
|
+
* An enumeration of string values to be used if the substitution options are from a limited set.
|
|
20
|
+
* The array MUST NOT be empty.
|
|
21
|
+
*/
|
|
22
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
23
|
+
/**
|
|
24
|
+
* REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value is not supplied.
|
|
25
|
+
* Note this behavior is different than the Schema Object’s treatment of default values, because in those cases
|
|
26
|
+
* parameter values are optional. If the enum is defined, the value MUST exist in the enum’s values.
|
|
27
|
+
*/
|
|
28
|
+
default: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
29
|
+
/** An optional description for the server variable. CommonMark syntax MAY be used for rich text representation. */
|
|
30
|
+
description: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
default: string;
|
|
33
|
+
uid: string;
|
|
34
|
+
enum?: string[] | undefined;
|
|
35
|
+
description?: string | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
uid?: string | undefined;
|
|
38
|
+
enum?: string[] | undefined;
|
|
39
|
+
default?: string | undefined;
|
|
40
|
+
description?: string | undefined;
|
|
41
|
+
}>>>>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
url: string;
|
|
44
|
+
uid: string;
|
|
45
|
+
description?: string | undefined;
|
|
46
|
+
variables?: Record<string, {
|
|
47
|
+
default: string;
|
|
48
|
+
uid: string;
|
|
49
|
+
enum?: string[] | undefined;
|
|
50
|
+
description?: string | undefined;
|
|
51
|
+
}> | null | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
uid?: string | undefined;
|
|
54
|
+
url?: string | undefined;
|
|
55
|
+
description?: string | undefined;
|
|
56
|
+
variables?: Record<string, {
|
|
57
|
+
uid?: string | undefined;
|
|
58
|
+
enum?: string[] | undefined;
|
|
59
|
+
default?: string | undefined;
|
|
60
|
+
description?: string | undefined;
|
|
61
|
+
}> | null | undefined;
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Server object
|
|
65
|
+
* An object representing a Server.
|
|
66
|
+
*
|
|
67
|
+
* @see https://spec.openapis.org/oas/v3.1.0#server-object
|
|
68
|
+
*/
|
|
69
|
+
export type Server = z.infer<typeof serverSchema>;
|
|
70
|
+
export type ServerPayload = z.input<typeof serverSchema>;
|
|
71
|
+
/** Create server helper */
|
|
72
|
+
export declare const createServer: (payload: ServerPayload) => {
|
|
73
|
+
url: string;
|
|
74
|
+
uid: string;
|
|
75
|
+
description?: string | undefined;
|
|
76
|
+
variables?: Record<string, {
|
|
77
|
+
default: string;
|
|
78
|
+
uid: string;
|
|
79
|
+
enum?: string[] | undefined;
|
|
80
|
+
description?: string | undefined;
|
|
81
|
+
}> | null | undefined;
|
|
82
|
+
};
|
|
83
|
+
export {};
|
|
84
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/server/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA2BvB,QAAA,MAAM,YAAY;;IAEhB;;;;OAIG;;IAEH;;;OAGG;;IAEH,oHAAoH;;;QA5BpH;;;WAGG;;QAEH;;;;WAIG;;QAEH,mHAAmH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBnH,CAAA;AAEF;;;;;GAKG;AACH,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;AAExD,2BAA2B;AAC3B,eAAO,MAAM,YAAY,YAAa,aAAa;;;;;;;;;;CACP,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { nanoidSchema } from '../shared/utility.js';
|
|
3
|
+
import { deepMerge } from '../../../helpers/deepMerge.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Server variables
|
|
7
|
+
* An object representing a Server Variable for server URL template substitution.
|
|
8
|
+
*
|
|
9
|
+
* @see https://spec.openapis.org/oas/v3.1.0#server-variable-object
|
|
10
|
+
*/
|
|
11
|
+
const serverVariableSchema = z.object({
|
|
12
|
+
uid: nanoidSchema,
|
|
13
|
+
/**
|
|
14
|
+
* An enumeration of string values to be used if the substitution options are from a limited set.
|
|
15
|
+
* The array MUST NOT be empty.
|
|
16
|
+
*/
|
|
17
|
+
enum: z.array(z.string()).optional(),
|
|
18
|
+
/**
|
|
19
|
+
* REQUIRED. The default value to use for substitution, which SHALL be sent if an alternate value is not supplied.
|
|
20
|
+
* Note this behavior is different than the Schema Object’s treatment of default values, because in those cases
|
|
21
|
+
* parameter values are optional. If the enum is defined, the value MUST exist in the enum’s values.
|
|
22
|
+
*/
|
|
23
|
+
default: z.string().optional().default('default'),
|
|
24
|
+
/** An optional description for the server variable. CommonMark syntax MAY be used for rich text representation. */
|
|
25
|
+
description: z.string().optional(),
|
|
26
|
+
});
|
|
27
|
+
const serverSchema = z.object({
|
|
28
|
+
uid: nanoidSchema,
|
|
29
|
+
/**
|
|
30
|
+
* REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that
|
|
31
|
+
* the host location is relative to the location where the OpenAPI document is being served. Variable substitutions
|
|
32
|
+
* will be made when a variable is named in {brackets}.
|
|
33
|
+
*/
|
|
34
|
+
url: z.string().optional().default(''),
|
|
35
|
+
/**
|
|
36
|
+
* An optional string describing the host designated by the URL. CommonMark syntax MAY be used for rich text
|
|
37
|
+
* representation.
|
|
38
|
+
*/
|
|
39
|
+
description: z.string().optional(),
|
|
40
|
+
/** A map between a variable name and its value. The value is used for substitution in the server’s URL template. */
|
|
41
|
+
variables: z.record(z.string(), serverVariableSchema).nullable().optional(),
|
|
42
|
+
});
|
|
43
|
+
/** Create server helper */
|
|
44
|
+
const createServer = (payload) => deepMerge(serverSchema.parse({}), payload);
|
|
45
|
+
|
|
46
|
+
export { createServer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { nanoidSchema } from './utility.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/shared/utility.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,gCAAgC;AAChC,eAAO,MAAM,YAAY,0CAIC,CAAA;AAE1B,6BAA6B;AAC7B,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/spec/components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/spec/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SchemaObject } from '../../../entities/workspace/spec/components';
|
|
2
|
+
export type ParameterStyle = 'matrix' | 'simple' | 'form' | 'label' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
|
|
3
|
+
/** */
|
|
4
|
+
export type ParameterObject = {
|
|
5
|
+
name: string;
|
|
6
|
+
in: 'query' | 'path' | 'header' | 'cookie';
|
|
7
|
+
description?: string;
|
|
8
|
+
/** Defaulted to false */
|
|
9
|
+
required?: boolean;
|
|
10
|
+
/** Defaulted to false */
|
|
11
|
+
deprecated?: boolean;
|
|
12
|
+
/** Defaulted according to @url https://spec.openapis.org/oas/v3.1.0#parameter-object */
|
|
13
|
+
style: ParameterStyle;
|
|
14
|
+
schema: SchemaObject;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/spec/parameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AAExE,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,gBAAgB,GAChB,eAAe,GACf,YAAY,CAAA;AAChB,OAAO;AAEP,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,yBAAyB;IACzB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,wFAAwF;IACxF,KAAK,EAAE,cAAc,CAAA;IACrB,MAAM,EAAE,YAAY,CAAA;CACrB,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Internal type used to describe an OpenAPI spec $ref
|
|
4
|
+
*
|
|
5
|
+
* Where this type is used we can set the UI to readonly and redirect to the
|
|
6
|
+
* definition object to allow modification
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export type $REF = {
|
|
10
|
+
/** $ref string from the OpenAPI spec */
|
|
11
|
+
path: string;
|
|
12
|
+
/** If the reference is internal to a collection we include a dot separate path */
|
|
13
|
+
collectionRef?: string;
|
|
14
|
+
/** If the reference is external we can handle differently */
|
|
15
|
+
isExternal: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const $refSchema: z.ZodObject<{
|
|
18
|
+
path: z.ZodString;
|
|
19
|
+
collectionRef: z.ZodOptional<z.ZodString>;
|
|
20
|
+
isExternal: z.ZodBoolean;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
path: string;
|
|
23
|
+
isExternal: boolean;
|
|
24
|
+
collectionRef?: string | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
path: string;
|
|
27
|
+
isExternal: boolean;
|
|
28
|
+
collectionRef?: string | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=refs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/spec/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvC;;;;;;GAMG;AACH,MAAM,MAAM,IAAI,GAAG;IACjB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAA;IACZ,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,6DAA6D;IAC7D,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;EAIK,CAAA"}
|