@scalar/oas-utils 0.2.42 → 0.2.44
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 +24 -0
- package/dist/diff/diff.d.ts +13 -0
- package/dist/diff/diff.d.ts.map +1 -0
- package/dist/diff/index.d.ts +1 -0
- package/dist/diff/index.d.ts.map +1 -0
- package/dist/diff/index.js +1 -0
- package/dist/entities/{workspace/cookie → cookie}/cookie.d.ts +1 -17
- package/dist/entities/cookie/cookie.d.ts.map +1 -0
- package/dist/entities/{workspace/cookie → cookie}/cookie.js +1 -4
- package/dist/entities/cookie/index.d.ts.map +1 -0
- package/dist/entities/cookie/index.js +1 -0
- package/dist/entities/environment/environment.d.ts +24 -0
- package/dist/entities/environment/environment.d.ts.map +1 -0
- package/dist/entities/environment/environment.js +12 -0
- package/dist/entities/environment/index.d.ts.map +1 -0
- package/dist/entities/environment/index.js +1 -0
- package/dist/entities/{workspace/consts/hot-keys.d.ts → hotkeys/hotkeys.d.ts} +2 -2
- package/dist/entities/hotkeys/hotkeys.d.ts.map +1 -0
- package/dist/entities/{workspace/consts/hot-keys.js → hotkeys/hotkeys.js} +1 -0
- package/dist/entities/hotkeys/index.d.ts +2 -0
- package/dist/entities/hotkeys/index.d.ts.map +1 -0
- package/dist/entities/hotkeys/index.js +1 -0
- package/dist/entities/index.d.ts +1 -1
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +1 -1
- package/dist/entities/shared/index.d.ts.map +1 -0
- package/dist/entities/shared/utility.d.ts.map +1 -0
- package/dist/entities/spec/collection.d.ts +489 -0
- package/dist/entities/spec/collection.d.ts.map +1 -0
- package/dist/entities/spec/collection.js +63 -0
- package/dist/entities/spec/index.d.ts +10 -0
- package/dist/entities/spec/index.d.ts.map +1 -0
- package/dist/entities/spec/index.js +7 -0
- package/dist/entities/spec/parameters.d.ts +42 -0
- package/dist/entities/spec/parameters.d.ts.map +1 -0
- package/dist/entities/spec/parameters.js +30 -0
- package/dist/entities/spec/request-examples.d.ts +915 -0
- package/dist/entities/spec/request-examples.d.ts.map +1 -0
- package/dist/entities/spec/request-examples.js +168 -0
- package/dist/entities/spec/requests.d.ts +317 -0
- package/dist/entities/spec/requests.d.ts.map +1 -0
- package/dist/entities/{workspace/spec → spec}/requests.js +56 -32
- package/dist/entities/spec/security.d.ts +964 -0
- package/dist/entities/spec/security.d.ts.map +1 -0
- package/dist/entities/spec/security.js +222 -0
- package/dist/entities/spec/server.d.ts +82 -0
- package/dist/entities/spec/server.d.ts.map +1 -0
- package/dist/entities/{workspace/server → spec}/server.js +11 -13
- package/dist/entities/spec/spec-objects.d.ts +279 -0
- package/dist/entities/spec/spec-objects.d.ts.map +1 -0
- package/dist/entities/{workspace/collection/collection.js → spec/spec-objects.js} +21 -45
- package/dist/entities/workspace/index.js +1 -1
- package/dist/entities/workspace/workspace.d.ts +24 -43
- package/dist/entities/workspace/workspace.d.ts.map +1 -1
- package/dist/entities/workspace/workspace.js +6 -7
- package/dist/helpers/httpMethods.d.ts +16 -82
- package/dist/helpers/httpMethods.d.ts.map +1 -1
- package/dist/helpers/httpMethods.js +45 -41
- package/dist/helpers/index.d.ts +2 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +4 -2
- package/dist/helpers/local-storage.d.ts +16 -0
- package/dist/helpers/local-storage.d.ts.map +1 -0
- package/dist/helpers/local-storage.js +17 -0
- package/dist/helpers/redirectToProxy.d.ts +2 -0
- package/dist/helpers/redirectToProxy.d.ts.map +1 -1
- package/dist/helpers/redirectToProxy.js +6 -7
- package/dist/helpers/regexHelpers.d.ts +2 -0
- package/dist/helpers/regexHelpers.d.ts.map +1 -0
- package/dist/helpers/regexHelpers.js +3 -0
- package/dist/helpers/schema-model.d.ts +2 -2
- package/dist/helpers/schema-model.d.ts.map +1 -1
- package/dist/helpers/schema-model.js +11 -17
- package/dist/migrations/data-version.d.ts +12 -0
- package/dist/migrations/data-version.d.ts.map +1 -0
- package/dist/migrations/data-version.js +13 -0
- package/dist/migrations/generate-types.d.ts +2 -0
- package/dist/migrations/generate-types.d.ts.map +1 -0
- package/dist/migrations/index.d.ts +4 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +3 -0
- package/dist/migrations/local-storage.d.ts +8 -0
- package/dist/migrations/local-storage.d.ts.map +1 -0
- package/dist/migrations/local-storage.js +36 -0
- package/dist/migrations/migrator.d.ts +4 -0
- package/dist/migrations/migrator.d.ts.map +1 -0
- package/dist/migrations/migrator.js +40 -0
- package/dist/migrations/semver.d.ts +5 -0
- package/dist/migrations/semver.d.ts.map +1 -0
- package/dist/migrations/semver.js +25 -0
- package/dist/migrations/v-0.0.0/index.d.ts +2 -0
- package/dist/migrations/v-0.0.0/index.d.ts.map +1 -0
- package/dist/migrations/v-0.0.0/index.js +1 -0
- package/dist/migrations/v-0.0.0/types.generated.d.ts +347 -0
- package/dist/migrations/v-0.0.0/types.generated.d.ts.map +1 -0
- package/dist/migrations/v-2.1.0/index.d.ts +3 -0
- package/dist/migrations/v-2.1.0/index.d.ts.map +1 -0
- package/dist/migrations/v-2.1.0/index.js +1 -0
- package/dist/migrations/v-2.1.0/migration.d.ts +334 -0
- package/dist/migrations/v-2.1.0/migration.d.ts.map +1 -0
- package/dist/migrations/v-2.1.0/migration.js +249 -0
- package/dist/migrations/v-2.1.0/types.generated.d.ts +42 -0
- package/dist/migrations/v-2.1.0/types.generated.d.ts.map +1 -0
- package/dist/spec-getters/getExampleFromSchema.d.ts.map +1 -1
- package/dist/spec-getters/getExampleFromSchema.js +21 -8
- package/dist/spec-getters/getParametersFromOperation.d.ts +1 -1
- package/dist/spec-getters/getParametersFromOperation.d.ts.map +1 -1
- package/dist/spec-getters/getParametersFromOperation.js +8 -7
- package/dist/spec-getters/getRequestBodyFromOperation.d.ts +12 -40
- package/dist/spec-getters/getRequestBodyFromOperation.d.ts.map +1 -1
- package/dist/spec-getters/getRequestBodyFromOperation.js +34 -23
- package/dist/spec-getters/getRequestFromOperation.d.ts.map +1 -1
- package/dist/spec-getters/getRequestFromOperation.js +1 -2
- package/dist/spec-getters/getServerVariableExamples.d.ts +4 -0
- package/dist/spec-getters/getServerVariableExamples.d.ts.map +1 -0
- package/dist/spec-getters/getServerVariableExamples.js +12 -0
- package/dist/spec-getters/index.d.ts +1 -0
- package/dist/spec-getters/index.d.ts.map +1 -1
- package/dist/spec-getters/index.js +1 -0
- package/dist/transforms/export-spec.d.ts +68 -0
- package/dist/transforms/export-spec.d.ts.map +1 -0
- package/dist/transforms/import-spec.d.ts +20 -68
- package/dist/transforms/import-spec.d.ts.map +1 -1
- package/dist/transforms/import-spec.js +209 -126
- package/package.json +43 -37
- package/dist/entities/workspace/collection/collection.d.ts +0 -330
- package/dist/entities/workspace/collection/collection.d.ts.map +0 -1
- package/dist/entities/workspace/collection/index.d.ts +0 -2
- package/dist/entities/workspace/collection/index.d.ts.map +0 -1
- package/dist/entities/workspace/collection/index.js +0 -1
- package/dist/entities/workspace/consts/hot-keys.d.ts.map +0 -1
- package/dist/entities/workspace/consts/index.d.ts +0 -2
- package/dist/entities/workspace/consts/index.d.ts.map +0 -1
- package/dist/entities/workspace/consts/index.js +0 -1
- package/dist/entities/workspace/cookie/cookie.d.ts.map +0 -1
- package/dist/entities/workspace/cookie/index.d.ts.map +0 -1
- package/dist/entities/workspace/cookie/index.js +0 -1
- package/dist/entities/workspace/environment/environment.d.ts +0 -55
- package/dist/entities/workspace/environment/environment.d.ts.map +0 -1
- package/dist/entities/workspace/environment/environment.js +0 -23
- package/dist/entities/workspace/environment/index.d.ts.map +0 -1
- package/dist/entities/workspace/environment/index.js +0 -1
- package/dist/entities/workspace/folder/folder.d.ts +0 -36
- package/dist/entities/workspace/folder/folder.d.ts.map +0 -1
- package/dist/entities/workspace/folder/folder.js +0 -21
- package/dist/entities/workspace/folder/index.d.ts +0 -2
- package/dist/entities/workspace/folder/index.d.ts.map +0 -1
- package/dist/entities/workspace/folder/index.js +0 -1
- package/dist/entities/workspace/security/index.d.ts +0 -3
- package/dist/entities/workspace/security/index.d.ts.map +0 -1
- package/dist/entities/workspace/security/index.js +0 -2
- package/dist/entities/workspace/security/security-requirement.d.ts +0 -13
- package/dist/entities/workspace/security/security-requirement.d.ts.map +0 -1
- package/dist/entities/workspace/security/security-requirement.js +0 -15
- package/dist/entities/workspace/security/security-schemes.d.ts +0 -696
- package/dist/entities/workspace/security/security-schemes.d.ts.map +0 -1
- package/dist/entities/workspace/security/security-schemes.js +0 -139
- package/dist/entities/workspace/server/index.d.ts +0 -2
- package/dist/entities/workspace/server/index.d.ts.map +0 -1
- package/dist/entities/workspace/server/index.js +0 -1
- package/dist/entities/workspace/server/server.d.ts +0 -91
- package/dist/entities/workspace/server/server.d.ts.map +0 -1
- package/dist/entities/workspace/shared/index.d.ts.map +0 -1
- package/dist/entities/workspace/shared/utility.d.ts.map +0 -1
- package/dist/entities/workspace/spec/components.d.ts +0 -3
- package/dist/entities/workspace/spec/components.d.ts.map +0 -1
- package/dist/entities/workspace/spec/index.d.ts +0 -5
- package/dist/entities/workspace/spec/index.d.ts.map +0 -1
- package/dist/entities/workspace/spec/index.js +0 -2
- package/dist/entities/workspace/spec/parameters.d.ts +0 -16
- package/dist/entities/workspace/spec/parameters.d.ts.map +0 -1
- package/dist/entities/workspace/spec/refs.d.ts +0 -30
- package/dist/entities/workspace/spec/refs.d.ts.map +0 -1
- package/dist/entities/workspace/spec/refs.js +0 -9
- package/dist/entities/workspace/spec/request-examples.d.ts +0 -1573
- package/dist/entities/workspace/spec/request-examples.d.ts.map +0 -1
- package/dist/entities/workspace/spec/request-examples.js +0 -96
- package/dist/entities/workspace/spec/requests.d.ts +0 -181
- package/dist/entities/workspace/spec/requests.d.ts.map +0 -1
- package/dist/entities/workspace/spec/spec.d.ts +0 -18
- package/dist/entities/workspace/spec/spec.d.ts.map +0 -1
- package/dist/entities/workspace/spec/spec.js +0 -8
- /package/dist/entities/{workspace/cookie → cookie}/index.d.ts +0 -0
- /package/dist/entities/{workspace/environment → environment}/index.d.ts +0 -0
- /package/dist/entities/{workspace/shared → shared}/index.d.ts +0 -0
- /package/dist/entities/{workspace/shared → shared}/index.js +0 -0
- /package/dist/entities/{workspace/shared → shared}/utility.d.ts +0 -0
- /package/dist/entities/{workspace/shared → shared}/utility.js +0 -0
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { deepMerge } from '@scalar/object-utils/merge';
|
|
2
1
|
import { z } from 'zod';
|
|
3
|
-
import { securityRequirement } from '../security/security-requirement.js';
|
|
4
2
|
import { nanoidSchema } from '../shared/utility.js';
|
|
5
3
|
|
|
6
4
|
/**
|
|
@@ -8,7 +6,7 @@ import { nanoidSchema } from '../shared/utility.js';
|
|
|
8
6
|
*
|
|
9
7
|
* @see https://spec.openapis.org/oas/latest.html#license-object
|
|
10
8
|
*/
|
|
11
|
-
const
|
|
9
|
+
const oasLicenseSchema = z.object({
|
|
12
10
|
/** REQUIRED. The license name used for the API. */
|
|
13
11
|
name: z.string().optional().default('name'),
|
|
14
12
|
/** An SPDX license expression for the API. The identifier field is mutually exclusive of the url field. */
|
|
@@ -25,7 +23,7 @@ const licenseSchema = z.object({
|
|
|
25
23
|
*
|
|
26
24
|
* @see https://spec.openapis.org/oas/latest.html#contact-object
|
|
27
25
|
*/
|
|
28
|
-
const
|
|
26
|
+
const oasContactSchema = z.object({
|
|
29
27
|
/** The identifying name of the contact person/organization. */
|
|
30
28
|
name: z.string().optional(),
|
|
31
29
|
/** The URL pointing to the contact information. This MUST be in the form of a URL. */
|
|
@@ -40,9 +38,9 @@ const contactSchema = z.object({
|
|
|
40
38
|
*
|
|
41
39
|
* @see https://spec.openapis.org/oas/latest.html#info-object
|
|
42
40
|
*/
|
|
43
|
-
const
|
|
41
|
+
const oasInfoSchema = z.object({
|
|
44
42
|
/** REQUIRED. The title of the API. */
|
|
45
|
-
title: z.string().optional().default('
|
|
43
|
+
title: z.string().optional().default('OpenAPI Spec'),
|
|
46
44
|
/** A short summary of the API. */
|
|
47
45
|
summary: z.string().optional(),
|
|
48
46
|
/** A description of the API. CommonMark syntax MAY be used for rich text representation. */
|
|
@@ -50,9 +48,9 @@ const infoSchema = z.object({
|
|
|
50
48
|
/** A URL to the Terms of Service for the API. This MUST be in the form of a URL. */
|
|
51
49
|
termsOfService: z.string().optional(),
|
|
52
50
|
/** The contact information for the exposed API. */
|
|
53
|
-
contact:
|
|
51
|
+
contact: oasContactSchema.optional(),
|
|
54
52
|
/** The license information for the exposed API. */
|
|
55
|
-
license:
|
|
53
|
+
license: oasLicenseSchema.optional(),
|
|
56
54
|
/**
|
|
57
55
|
* REQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI
|
|
58
56
|
* Specification version or the API implementation version).
|
|
@@ -65,12 +63,17 @@ const infoSchema = z.object({
|
|
|
65
63
|
*
|
|
66
64
|
* @see https://spec.openapis.org/oas/latest.html#external-documentation-object
|
|
67
65
|
*/
|
|
68
|
-
const
|
|
66
|
+
const oasExternalDocumentationSchema = z.object({
|
|
69
67
|
/** A description of the target documentation. CommonMark syntax MAY be used for rich text representation. */
|
|
70
68
|
description: z.string().optional(),
|
|
71
69
|
/** REQUIRED. The URL for the target documentation. This MUST be in the form of a URL. */
|
|
72
70
|
url: z.string().default(''),
|
|
73
71
|
});
|
|
72
|
+
const xScalarNestedSchema = z
|
|
73
|
+
.object({
|
|
74
|
+
tagName: z.string(),
|
|
75
|
+
})
|
|
76
|
+
.array();
|
|
74
77
|
/**
|
|
75
78
|
* Tag
|
|
76
79
|
* Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag
|
|
@@ -78,46 +81,19 @@ const exteralDocumentationSchema = z.object({
|
|
|
78
81
|
*
|
|
79
82
|
* @see https://spec.openapis.org/oas/latest.html#tag-object
|
|
80
83
|
*/
|
|
81
|
-
const
|
|
84
|
+
const oasTagSchema = z.object({
|
|
85
|
+
'type': z.literal('tag').optional().default('tag'),
|
|
82
86
|
/** REQUIRED. The name of the tag. */
|
|
83
|
-
name: z.string()
|
|
87
|
+
'name': z.string(),
|
|
84
88
|
/** A description for the tag. CommonMark syntax MAY be used for rich text representation. */
|
|
85
|
-
description: z.string().optional(),
|
|
89
|
+
'description': z.string().optional(),
|
|
86
90
|
/** Additional external documentation for this tag. */
|
|
87
|
-
externalDocs:
|
|
88
|
-
|
|
89
|
-
const specSchema = z.object({
|
|
90
|
-
openapi: z
|
|
91
|
-
.union([z.string(), z.literal('3.1.0'), z.literal('4.0.0')])
|
|
92
|
-
.optional()
|
|
93
|
-
.default('3.1.0'),
|
|
94
|
-
/**
|
|
95
|
-
* A declaration of which security mechanisms can be used across the API. The list of
|
|
96
|
-
* values includes alternative security requirement objects that can be used. Only
|
|
97
|
-
* one of the security requirement objects need to be satisfied to authorize a request.
|
|
98
|
-
* Individual operations can override this definition. To make security optional, an empty
|
|
99
|
-
* security requirement ({}) can be included in the array.
|
|
100
|
-
*/
|
|
101
|
-
security: z.array(securityRequirement).optional().default([]),
|
|
102
|
-
/** OAS info */
|
|
103
|
-
info: infoSchema.optional(),
|
|
104
|
-
/** Uids which refer to servers on the workspace base */
|
|
105
|
-
serverUids: z.array(z.string()).default([]),
|
|
106
|
-
/** OAS Tags */
|
|
107
|
-
tags: z.array(tagSchema).default([]),
|
|
108
|
-
externalDocs: exteralDocumentationSchema.optional(),
|
|
91
|
+
'externalDocs': oasExternalDocumentationSchema.optional(),
|
|
92
|
+
'x-scalar-children': xScalarNestedSchema.default([]),
|
|
109
93
|
});
|
|
110
|
-
const
|
|
94
|
+
const tagSchema = oasTagSchema.extend({
|
|
111
95
|
uid: nanoidSchema,
|
|
112
|
-
|
|
113
|
-
/** A dictionary which maps the openapi spec name keys to the security-scheme UID's for lookup */
|
|
114
|
-
securitySchemeDict: z.record(z.string(), z.string()).optional().default({}),
|
|
115
|
-
/** The currently selected server */
|
|
116
|
-
selectedServerUid: z.string().default(''),
|
|
117
|
-
/** List of uids that correspond to collection requests or folders */
|
|
118
|
-
childUids: z.array(z.string()).default([]),
|
|
96
|
+
children: nanoidSchema.array().default([]),
|
|
119
97
|
});
|
|
120
|
-
/** Create Collction helper */
|
|
121
|
-
const createCollection = (payload) => deepMerge(collectionSchema.parse({}), payload);
|
|
122
98
|
|
|
123
|
-
export {
|
|
99
|
+
export { oasContactSchema, oasExternalDocumentationSchema, oasInfoSchema, oasLicenseSchema, oasTagSchema, tagSchema, xScalarNestedSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { workspaceSchema } from './workspace.js';
|
|
@@ -3,16 +3,16 @@ declare const modifiers: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDefault<z.Zo
|
|
|
3
3
|
export type HotKeyModifiers = z.infer<typeof modifiers>;
|
|
4
4
|
declare const hotKeys: z.ZodRecord<z.ZodEnum<["Space", "Backspace", "Tab", "Enter", "Escape", "ArrowDown", "ArrowLeft", "ArrowRight", "ArrowUp", "End", "Home", "PageDown", "PageUp", "Delete", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "+", "-", ".", "/", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", ";", "=", ",", "-", ".", "/", "`", "[", "\\", "]", ""]>, z.ZodObject<{
|
|
5
5
|
modifiers: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodEnum<["Meta", "Control", "Shift", "Alt", "default"]>>>, "many">>>>;
|
|
6
|
-
event: z.ZodEnum<["closeModal", "navigateSearchResultsDown", "selectSearchResult", "navigateSearchResultsUp", "openCommandPalette", "toggleSidebar", "addTopNav", "closeTopNav", "navigateTopNavLeft", "navigateTopNavRight", "focusAddressBar", "jumpToTab", "jumpToLastTab", "focusRequestSearch"]>;
|
|
6
|
+
event: z.ZodEnum<["closeModal", "navigateSearchResultsDown", "selectSearchResult", "navigateSearchResultsUp", "openCommandPalette", "openCommandPaletteRequest", "toggleSidebar", "addTopNav", "closeTopNav", "navigateTopNavLeft", "navigateTopNavRight", "focusAddressBar", "jumpToTab", "jumpToLastTab", "focusRequestSearch"]>;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
8
|
+
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "openCommandPaletteRequest" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
9
9
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default")[] | undefined;
|
|
10
10
|
}, {
|
|
11
|
-
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
11
|
+
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "openCommandPaletteRequest" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
12
12
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default" | undefined)[] | undefined;
|
|
13
13
|
}>>;
|
|
14
14
|
export type HotKeyConfig = z.infer<typeof hotKeys>;
|
|
15
|
-
declare const workspaceSchema: z.ZodObject<{
|
|
15
|
+
export declare const workspaceSchema: z.ZodObject<{
|
|
16
16
|
uid: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
17
17
|
name: z.ZodDefault<z.ZodString>;
|
|
18
18
|
/** Workspace description */
|
|
@@ -20,39 +20,39 @@ declare const workspaceSchema: z.ZodObject<{
|
|
|
20
20
|
/** Controls read only mode for most entitites, but not things like params */
|
|
21
21
|
isReadOnly: z.ZodDefault<z.ZodBoolean>;
|
|
22
22
|
/** List of all collection uids in a given workspace */
|
|
23
|
-
|
|
23
|
+
collections: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
24
24
|
/** List of all environment uids in a given workspace */
|
|
25
|
-
|
|
25
|
+
environments: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
26
26
|
/** Customize hotkeys */
|
|
27
27
|
hotKeyConfig: z.ZodOptional<z.ZodObject<{
|
|
28
28
|
modifiers: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodEnum<["Meta", "Control", "Shift", "Alt", "default"]>>>, "many">>>;
|
|
29
29
|
hotKeys: z.ZodOptional<z.ZodRecord<z.ZodEnum<["Space", "Backspace", "Tab", "Enter", "Escape", "ArrowDown", "ArrowLeft", "ArrowRight", "ArrowUp", "End", "Home", "PageDown", "PageUp", "Delete", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "+", "-", ".", "/", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", ";", "=", ",", "-", ".", "/", "`", "[", "\\", "]", ""]>, z.ZodObject<{
|
|
30
30
|
modifiers: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDefault<z.ZodOptional<z.ZodEnum<["Meta", "Control", "Shift", "Alt", "default"]>>>, "many">>>>;
|
|
31
|
-
event: z.ZodEnum<["closeModal", "navigateSearchResultsDown", "selectSearchResult", "navigateSearchResultsUp", "openCommandPalette", "toggleSidebar", "addTopNav", "closeTopNav", "navigateTopNavLeft", "navigateTopNavRight", "focusAddressBar", "jumpToTab", "jumpToLastTab", "focusRequestSearch"]>;
|
|
31
|
+
event: z.ZodEnum<["closeModal", "navigateSearchResultsDown", "selectSearchResult", "navigateSearchResultsUp", "openCommandPalette", "openCommandPaletteRequest", "toggleSidebar", "addTopNav", "closeTopNav", "navigateTopNavLeft", "navigateTopNavRight", "focusAddressBar", "jumpToTab", "jumpToLastTab", "focusRequestSearch"]>;
|
|
32
32
|
}, "strip", z.ZodTypeAny, {
|
|
33
|
-
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
33
|
+
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "openCommandPaletteRequest" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
34
34
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default")[] | undefined;
|
|
35
35
|
}, {
|
|
36
|
-
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
36
|
+
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "openCommandPaletteRequest" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
37
37
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default" | undefined)[] | undefined;
|
|
38
38
|
}>>>;
|
|
39
39
|
}, "strip", z.ZodTypeAny, {
|
|
40
40
|
modifiers: ("Meta" | "Control" | "Shift" | "Alt" | "default")[];
|
|
41
|
-
hotKeys?: Partial<Record<"" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "
|
|
42
|
-
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
41
|
+
hotKeys?: Partial<Record<"" | "/" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
|
|
42
|
+
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "openCommandPaletteRequest" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
43
43
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default")[] | undefined;
|
|
44
44
|
}>> | undefined;
|
|
45
45
|
}, {
|
|
46
46
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default" | undefined)[] | undefined;
|
|
47
|
-
hotKeys?: Partial<Record<"" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "
|
|
48
|
-
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
47
|
+
hotKeys?: Partial<Record<"" | "/" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
|
|
48
|
+
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "openCommandPaletteRequest" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
49
49
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default" | undefined)[] | undefined;
|
|
50
50
|
}>> | undefined;
|
|
51
51
|
}>>;
|
|
52
52
|
/** Active Environment ID to use for requests */
|
|
53
53
|
activeEnvironmentId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
54
54
|
/** List of all cookie uids in a given workspace */
|
|
55
|
-
|
|
55
|
+
cookies: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
56
56
|
/** Workspace level proxy for all requests to be sent through */
|
|
57
57
|
proxyUrl: z.ZodOptional<z.ZodString>;
|
|
58
58
|
/** Workspace level theme, we might move this to user level later */
|
|
@@ -62,15 +62,15 @@ declare const workspaceSchema: z.ZodObject<{
|
|
|
62
62
|
name: string;
|
|
63
63
|
description: string;
|
|
64
64
|
isReadOnly: boolean;
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
collections: string[];
|
|
66
|
+
environments: string[];
|
|
67
67
|
activeEnvironmentId: string;
|
|
68
|
-
|
|
68
|
+
cookies: string[];
|
|
69
69
|
themeId: "default" | "alternate" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "mars" | "none";
|
|
70
70
|
hotKeyConfig?: {
|
|
71
71
|
modifiers: ("Meta" | "Control" | "Shift" | "Alt" | "default")[];
|
|
72
|
-
hotKeys?: Partial<Record<"" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "
|
|
73
|
-
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
72
|
+
hotKeys?: Partial<Record<"" | "/" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
|
|
73
|
+
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "openCommandPaletteRequest" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
74
74
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default")[] | undefined;
|
|
75
75
|
}>> | undefined;
|
|
76
76
|
} | undefined;
|
|
@@ -80,41 +80,22 @@ declare const workspaceSchema: z.ZodObject<{
|
|
|
80
80
|
name?: string | undefined;
|
|
81
81
|
description?: string | undefined;
|
|
82
82
|
isReadOnly?: boolean | undefined;
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
collections?: string[] | undefined;
|
|
84
|
+
environments?: string[] | undefined;
|
|
85
85
|
hotKeyConfig?: {
|
|
86
86
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default" | undefined)[] | undefined;
|
|
87
|
-
hotKeys?: Partial<Record<"" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "
|
|
88
|
-
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
87
|
+
hotKeys?: Partial<Record<"" | "/" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
|
|
88
|
+
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "openCommandPaletteRequest" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
89
89
|
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default" | undefined)[] | undefined;
|
|
90
90
|
}>> | undefined;
|
|
91
91
|
} | undefined;
|
|
92
92
|
activeEnvironmentId?: string | undefined;
|
|
93
|
-
|
|
93
|
+
cookies?: string[] | undefined;
|
|
94
94
|
proxyUrl?: string | undefined;
|
|
95
95
|
themeId?: "default" | "alternate" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "mars" | "none" | undefined;
|
|
96
96
|
}>;
|
|
97
97
|
/** The base scalar workspace */
|
|
98
98
|
export type Workspace = z.infer<typeof workspaceSchema>;
|
|
99
99
|
export type WorkspacePayload = z.input<typeof workspaceSchema>;
|
|
100
|
-
export declare const createWorkspace: (payload: WorkspacePayload) => {
|
|
101
|
-
uid: string;
|
|
102
|
-
name: string;
|
|
103
|
-
description: string;
|
|
104
|
-
isReadOnly: boolean;
|
|
105
|
-
collectionUids: string[];
|
|
106
|
-
environmentUids: string[];
|
|
107
|
-
activeEnvironmentId: string;
|
|
108
|
-
cookieUids: string[];
|
|
109
|
-
themeId: "default" | "alternate" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "mars" | "none";
|
|
110
|
-
hotKeyConfig?: {
|
|
111
|
-
modifiers: ("Meta" | "Control" | "Shift" | "Alt" | "default")[];
|
|
112
|
-
hotKeys?: Partial<Record<"" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "*" | "+" | "-" | "." | "/" | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "," | "`" | "[" | "\\" | "]", {
|
|
113
|
-
event: "closeModal" | "navigateSearchResultsDown" | "selectSearchResult" | "navigateSearchResultsUp" | "openCommandPalette" | "toggleSidebar" | "addTopNav" | "closeTopNav" | "navigateTopNavLeft" | "navigateTopNavRight" | "focusAddressBar" | "jumpToTab" | "jumpToLastTab" | "focusRequestSearch";
|
|
114
|
-
modifiers?: ("Meta" | "Control" | "Shift" | "Alt" | "default")[] | undefined;
|
|
115
|
-
}>> | undefined;
|
|
116
|
-
} | undefined;
|
|
117
|
-
proxyUrl?: string | undefined;
|
|
118
|
-
};
|
|
119
100
|
export {};
|
|
120
101
|
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/entities/workspace/workspace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/entities/workspace/workspace.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB,QAAA,MAAM,SAAS,yIAAoD,CAAA;AAEnE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAEvD,QAAA,MAAM,OAAO;;;;;;;;;GAMZ,CAAA;AACD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAA;AASlD,eAAO,MAAM,eAAe;;;IAG1B,4BAA4B;;IAE5B,6EAA6E;;IAE7E,uDAAuD;;IAEvD,wDAAwD;;IAExD,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;IAExB,iDAAiD;;IAEjD,mDAAmD;;IAEnD,gEAAgE;;IAEhE,oEAAoE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEpE,CAAA;AAEF,gCAAgC;AAChC,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AACvD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { themeIds } from '@scalar/themes';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { KEYDOWN_KEYS, HOTKEY_EVENT_NAMES } from '
|
|
4
|
-
import { nanoidSchema } from '
|
|
3
|
+
import { KEYDOWN_KEYS, HOTKEY_EVENT_NAMES } from '../hotkeys/hotkeys.js';
|
|
4
|
+
import { nanoidSchema } from '../shared/utility.js';
|
|
5
5
|
|
|
6
6
|
const modifier = z
|
|
7
7
|
.enum(['Meta', 'Control', 'Shift', 'Alt', 'default'])
|
|
@@ -26,20 +26,19 @@ const workspaceSchema = z.object({
|
|
|
26
26
|
/** Controls read only mode for most entitites, but not things like params */
|
|
27
27
|
isReadOnly: z.boolean().default(false),
|
|
28
28
|
/** List of all collection uids in a given workspace */
|
|
29
|
-
|
|
29
|
+
collections: z.array(z.string()).default([]),
|
|
30
30
|
/** List of all environment uids in a given workspace */
|
|
31
|
-
|
|
31
|
+
environments: z.array(z.string()).default([]),
|
|
32
32
|
/** Customize hotkeys */
|
|
33
33
|
hotKeyConfig: hotKeyConfigSchema,
|
|
34
34
|
/** Active Environment ID to use for requests */
|
|
35
35
|
activeEnvironmentId: z.string().optional().default('default'),
|
|
36
36
|
/** List of all cookie uids in a given workspace */
|
|
37
|
-
|
|
37
|
+
cookies: z.array(z.string()).default([]),
|
|
38
38
|
/** Workspace level proxy for all requests to be sent through */
|
|
39
39
|
proxyUrl: z.string().optional(),
|
|
40
40
|
/** Workspace level theme, we might move this to user level later */
|
|
41
41
|
themeId: z.enum(themeIds).optional().default('default'),
|
|
42
42
|
});
|
|
43
|
-
const createWorkspace = (payload) => workspaceSchema.parse(payload);
|
|
44
43
|
|
|
45
|
-
export {
|
|
44
|
+
export { workspaceSchema };
|
|
@@ -1,93 +1,27 @@
|
|
|
1
|
+
import type { RequestMethod } from '../entities/spec/requests.js';
|
|
2
|
+
/**
|
|
3
|
+
* HTTP methods in a specific order
|
|
4
|
+
* Do not change the order
|
|
5
|
+
*/
|
|
1
6
|
export declare const REQUEST_METHODS: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
readonly DELETE: {
|
|
8
|
-
readonly short: "DEL";
|
|
9
|
-
readonly color: "text-red";
|
|
10
|
-
readonly backgroundColor: "bg-red";
|
|
11
|
-
};
|
|
12
|
-
readonly GET: {
|
|
13
|
-
readonly short: "GET";
|
|
14
|
-
readonly color: "text-blue";
|
|
15
|
-
readonly backgroundColor: "bg-blue";
|
|
16
|
-
};
|
|
17
|
-
readonly HEAD: {
|
|
18
|
-
readonly short: "HEAD";
|
|
19
|
-
readonly color: "text-scalar-c-2";
|
|
20
|
-
readonly backgroundColor: "bg-c-2";
|
|
21
|
-
};
|
|
22
|
-
readonly OPTIONS: {
|
|
23
|
-
readonly short: "OPTS";
|
|
24
|
-
readonly color: "text-purple";
|
|
25
|
-
readonly backgroundColor: "bg-purple";
|
|
26
|
-
};
|
|
27
|
-
readonly PATCH: {
|
|
28
|
-
readonly short: "PATCH";
|
|
29
|
-
readonly color: "text-yellow";
|
|
30
|
-
readonly backgroundColor: "bg-yellow";
|
|
31
|
-
};
|
|
32
|
-
readonly POST: {
|
|
33
|
-
readonly short: "POST";
|
|
34
|
-
readonly color: "text-green";
|
|
35
|
-
readonly backgroundColor: "bg-green";
|
|
36
|
-
};
|
|
37
|
-
readonly PUT: {
|
|
38
|
-
readonly short: "PUT";
|
|
39
|
-
readonly color: "text-orange";
|
|
40
|
-
readonly backgroundColor: "bg-orange";
|
|
41
|
-
};
|
|
42
|
-
readonly TRACE: {
|
|
43
|
-
readonly short: "TRACE";
|
|
44
|
-
readonly color: "text-c-2";
|
|
45
|
-
readonly backgroundColor: "bg-c-2";
|
|
7
|
+
[x in RequestMethod]: {
|
|
8
|
+
short: string;
|
|
9
|
+
color: string;
|
|
10
|
+
backgroundColor: string;
|
|
46
11
|
};
|
|
47
12
|
};
|
|
48
|
-
|
|
13
|
+
/** HTTP Methods which can have a body */
|
|
14
|
+
declare const BODY_METHODS: readonly ["post", "put", "patch", "delete"];
|
|
15
|
+
type BodyMethod = (typeof BODY_METHODS)[number];
|
|
16
|
+
/** Makes a check to see if this method CAN have a body */
|
|
17
|
+
export declare const canMethodHaveBody: (method: RequestMethod) => method is BodyMethod;
|
|
49
18
|
/**
|
|
50
19
|
* Accepts an HTTP Method name and returns some properties for the tag
|
|
51
20
|
*/
|
|
52
|
-
export declare const
|
|
53
|
-
readonly short: "CONN";
|
|
54
|
-
readonly color: "text-c-2";
|
|
55
|
-
readonly backgroundColor: "bg-c-2";
|
|
56
|
-
} | {
|
|
57
|
-
readonly short: "DEL";
|
|
58
|
-
readonly color: "text-red";
|
|
59
|
-
readonly backgroundColor: "bg-red";
|
|
60
|
-
} | {
|
|
61
|
-
readonly short: "GET";
|
|
62
|
-
readonly color: "text-blue";
|
|
63
|
-
readonly backgroundColor: "bg-blue";
|
|
64
|
-
} | {
|
|
65
|
-
readonly short: "HEAD";
|
|
66
|
-
readonly color: "text-scalar-c-2";
|
|
67
|
-
readonly backgroundColor: "bg-c-2";
|
|
68
|
-
} | {
|
|
69
|
-
readonly short: "OPTS";
|
|
70
|
-
readonly color: "text-purple";
|
|
71
|
-
readonly backgroundColor: "bg-purple";
|
|
72
|
-
} | {
|
|
73
|
-
readonly short: "PATCH";
|
|
74
|
-
readonly color: "text-yellow";
|
|
75
|
-
readonly backgroundColor: "bg-yellow";
|
|
76
|
-
} | {
|
|
77
|
-
readonly short: "POST";
|
|
78
|
-
readonly color: "text-green";
|
|
79
|
-
readonly backgroundColor: "bg-green";
|
|
80
|
-
} | {
|
|
81
|
-
readonly short: "PUT";
|
|
82
|
-
readonly color: "text-orange";
|
|
83
|
-
readonly backgroundColor: "bg-orange";
|
|
84
|
-
} | {
|
|
85
|
-
readonly short: "TRACE";
|
|
86
|
-
readonly color: "text-c-2";
|
|
87
|
-
readonly backgroundColor: "bg-c-2";
|
|
88
|
-
} | {
|
|
21
|
+
export declare const getHttpMethodInfo: (methodName: string) => {
|
|
89
22
|
short: string;
|
|
90
23
|
color: string;
|
|
91
24
|
backgroundColor: string;
|
|
92
25
|
};
|
|
26
|
+
export {};
|
|
93
27
|
//# sourceMappingURL=httpMethods.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpMethods.d.ts","sourceRoot":"","sources":["../../src/helpers/httpMethods.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"httpMethods.d.ts","sourceRoot":"","sources":["../../src/helpers/httpMethods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAE7D;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE;KAC3B,CAAC,IAAI,aAAa,GAAG;QACpB,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,MAAM,CAAA;QACb,eAAe,EAAE,MAAM,CAAA;KACxB;CA+CO,CAAA;AAEV,yCAAyC;AACzC,QAAA,MAAM,YAAY,6CAA8C,CAAA;AAChE,KAAK,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/C,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,WACpB,aAAa,KACpB,MAAM,IAAI,UAAyD,CAAA;AAEtE;;GAEG;AACH,eAAO,MAAM,iBAAiB,eAAgB,MAAM;WAhEzC,MAAM;WACN,MAAM;qBACI,MAAM;CAuE1B,CAAA"}
|
|
@@ -1,64 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP methods in a specific order
|
|
3
|
+
* Do not change the order
|
|
4
|
+
*/
|
|
1
5
|
const REQUEST_METHODS = {
|
|
2
|
-
|
|
3
|
-
short: 'CONN',
|
|
4
|
-
color: 'text-c-2',
|
|
5
|
-
backgroundColor: 'bg-c-2',
|
|
6
|
-
},
|
|
7
|
-
DELETE: {
|
|
8
|
-
short: 'DEL',
|
|
9
|
-
color: 'text-red',
|
|
10
|
-
backgroundColor: 'bg-red',
|
|
11
|
-
},
|
|
12
|
-
GET: {
|
|
6
|
+
get: {
|
|
13
7
|
short: 'GET',
|
|
14
8
|
color: 'text-blue',
|
|
15
9
|
backgroundColor: 'bg-blue',
|
|
16
10
|
},
|
|
17
|
-
|
|
18
|
-
short: 'HEAD',
|
|
19
|
-
color: 'text-scalar-c-2',
|
|
20
|
-
backgroundColor: 'bg-c-2',
|
|
21
|
-
},
|
|
22
|
-
OPTIONS: {
|
|
23
|
-
short: 'OPTS',
|
|
24
|
-
color: 'text-purple',
|
|
25
|
-
backgroundColor: 'bg-purple',
|
|
26
|
-
},
|
|
27
|
-
PATCH: {
|
|
28
|
-
short: 'PATCH',
|
|
29
|
-
color: 'text-yellow',
|
|
30
|
-
backgroundColor: 'bg-yellow',
|
|
31
|
-
},
|
|
32
|
-
POST: {
|
|
11
|
+
post: {
|
|
33
12
|
short: 'POST',
|
|
34
13
|
color: 'text-green',
|
|
35
14
|
backgroundColor: 'bg-green',
|
|
36
15
|
},
|
|
37
|
-
|
|
16
|
+
put: {
|
|
38
17
|
short: 'PUT',
|
|
39
18
|
color: 'text-orange',
|
|
40
19
|
backgroundColor: 'bg-orange',
|
|
41
20
|
},
|
|
42
|
-
|
|
21
|
+
patch: {
|
|
22
|
+
short: 'PATCH',
|
|
23
|
+
color: 'text-yellow',
|
|
24
|
+
backgroundColor: 'bg-yellow',
|
|
25
|
+
},
|
|
26
|
+
delete: {
|
|
27
|
+
short: 'DEL',
|
|
28
|
+
color: 'text-red',
|
|
29
|
+
backgroundColor: 'bg-red',
|
|
30
|
+
},
|
|
31
|
+
options: {
|
|
32
|
+
short: 'OPTS',
|
|
33
|
+
color: 'text-purple',
|
|
34
|
+
backgroundColor: 'bg-purple',
|
|
35
|
+
},
|
|
36
|
+
head: {
|
|
37
|
+
short: 'HEAD',
|
|
38
|
+
color: 'text-scalar-c-2',
|
|
39
|
+
backgroundColor: 'bg-c-2',
|
|
40
|
+
},
|
|
41
|
+
connect: {
|
|
42
|
+
short: 'CONN',
|
|
43
|
+
color: 'text-c-2',
|
|
44
|
+
backgroundColor: 'bg-c-2',
|
|
45
|
+
},
|
|
46
|
+
trace: {
|
|
43
47
|
short: 'TRACE',
|
|
44
48
|
color: 'text-c-2',
|
|
45
49
|
backgroundColor: 'bg-c-2',
|
|
46
50
|
},
|
|
47
51
|
};
|
|
52
|
+
/** HTTP Methods which can have a body */
|
|
53
|
+
const BODY_METHODS = ['post', 'put', 'patch', 'delete'];
|
|
54
|
+
/** Makes a check to see if this method CAN have a body */
|
|
55
|
+
const canMethodHaveBody = (method) => BODY_METHODS.includes(method);
|
|
48
56
|
/**
|
|
49
57
|
* Accepts an HTTP Method name and returns some properties for the tag
|
|
50
58
|
*/
|
|
51
|
-
const
|
|
52
|
-
const normalizedMethod = methodName.trim().
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
color: 'text-c-2',
|
|
59
|
-
backgroundColor: 'bg-c-2',
|
|
60
|
-
};
|
|
61
|
-
}
|
|
59
|
+
const getHttpMethodInfo = (methodName) => {
|
|
60
|
+
const normalizedMethod = methodName.trim().toLowerCase();
|
|
61
|
+
return (REQUEST_METHODS[normalizedMethod] ?? {
|
|
62
|
+
short: normalizedMethod,
|
|
63
|
+
color: 'text-c-2',
|
|
64
|
+
backgroundColor: 'bg-c-2',
|
|
65
|
+
});
|
|
62
66
|
};
|
|
63
67
|
|
|
64
|
-
export { REQUEST_METHODS,
|
|
68
|
+
export { REQUEST_METHODS, canMethodHaveBody, getHttpMethodInfo };
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './findVariables.js';
|
|
|
5
5
|
export * from './httpMethods.js';
|
|
6
6
|
export * from './httpStatusCodes.js';
|
|
7
7
|
export * from './iterateTitle.js';
|
|
8
|
+
export * from './local-storage.js';
|
|
8
9
|
export * from './normalizeMimeType.js';
|
|
9
10
|
export * from './normalizeMimeTypeObject.js';
|
|
10
11
|
export * from './object.js';
|
|
@@ -16,4 +17,5 @@ export * from './schema-model.js';
|
|
|
16
17
|
export * from './ssrState.js';
|
|
17
18
|
export * from './string.js';
|
|
18
19
|
export * from './isValidUrl.js';
|
|
20
|
+
export * from './regexHelpers.js';
|
|
19
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA"}
|
package/dist/helpers/index.js
CHANGED
|
@@ -2,17 +2,19 @@ export { concatenateUrlAndPath } from './concatenateUrlAndPath.js';
|
|
|
2
2
|
export { createHash } from './createHash.js';
|
|
3
3
|
export { fetchSpecFromUrl } from './fetchSpecFromUrl.js';
|
|
4
4
|
export { findVariables } from './findVariables.js';
|
|
5
|
-
export { REQUEST_METHODS,
|
|
5
|
+
export { REQUEST_METHODS, canMethodHaveBody, getHttpMethodInfo } from './httpMethods.js';
|
|
6
6
|
export { httpStatusCodes } from './httpStatusCodes.js';
|
|
7
7
|
export { iterateTitle } from './iterateTitle.js';
|
|
8
|
+
export { LS_KEYS } from './local-storage.js';
|
|
8
9
|
export { normalizeMimeType } from './normalizeMimeType.js';
|
|
9
10
|
export { normalizeMimeTypeObject } from './normalizeMimeTypeObject.js';
|
|
10
11
|
export { getObjectKeys, objectMerge } from './object.js';
|
|
11
12
|
export { formatJsonOrYamlString, isJsonString, json, parseJsonOrYaml, transformToJson, yaml } from './parse.js';
|
|
12
13
|
export { prettyPrintJson, replaceCircularDependencies } from './prettyPrintJson.js';
|
|
13
|
-
export { isRequestToLocalhost, redirectToProxy, shouldUseProxy } from './redirectToProxy.js';
|
|
14
|
+
export { isRelativePath, isRequestToLocalhost, redirectToProxy, shouldUseProxy } from './redirectToProxy.js';
|
|
14
15
|
export { replaceVariables } from './replaceVariables.js';
|
|
15
16
|
export { schemaModel } from './schema-model.js';
|
|
16
17
|
export { defaultStateFactory, ssrState } from './ssrState.js';
|
|
17
18
|
export { camelToTitleWords, capitalize } from './string.js';
|
|
18
19
|
export { isValidUrl } from './isValidUrl.js';
|
|
20
|
+
export { variableRegex } from './regexHelpers.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* localStorage keys for resources
|
|
3
|
+
* DO NOT CHANGE THESE AS IT WILL BREAK THE MIGRATION
|
|
4
|
+
*/
|
|
5
|
+
export declare const LS_KEYS: {
|
|
6
|
+
readonly COLLECTION: "collection";
|
|
7
|
+
readonly COOKIE: "cookie";
|
|
8
|
+
readonly ENVIRONMENT: "environment";
|
|
9
|
+
readonly REQUEST: "request";
|
|
10
|
+
readonly REQUEST_EXAMPLE: "requestExample";
|
|
11
|
+
readonly SECURITY_SCHEME: "securityScheme";
|
|
12
|
+
readonly SERVER: "server";
|
|
13
|
+
readonly TAG: "tag";
|
|
14
|
+
readonly WORKSPACE: "workspace";
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=local-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../../src/helpers/local-storage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;CAUV,CAAA"}
|