@scalar/api-client 2.5.32 → 2.5.33
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 +20 -0
- package/dist/components/AddressBar/AddressBar.vue.js +1 -1
- package/dist/components/AddressBar/AddressBar.vue2.js +120 -128
- package/dist/components/AddressBar/AddressBarHistory.vue.js +1 -1
- package/dist/components/AddressBar/AddressBarHistory.vue2.js +57 -63
- package/dist/components/CodeInput/CodeInput.vue.js +2 -2
- package/dist/components/CodeInput/CodeInput.vue2.js +143 -150
- package/dist/components/CodeInput/codeVariableWidget.js +70 -75
- package/dist/components/CommandPalette/CommandActionInput.vue.js +17 -19
- package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +26 -27
- package/dist/components/CommandPalette/CommandPaletteExample.vue.js +53 -55
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +129 -133
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue.js +1 -1
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue2.js +84 -98
- package/dist/components/CommandPalette/CommandPaletteServer.vue.js +64 -74
- package/dist/components/CommandPalette/CommandPaletteTag.vue.js +5 -11
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +164 -183
- package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableInput.vue.js +4 -4
- package/dist/components/DataTable/DataTableInput.vue2.js +31 -31
- package/dist/components/DataTable/DataTableInputSelect.vue.js +1 -2
- package/dist/components/EmptyState.vue.js +1 -1
- package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +75 -84
- package/dist/components/Form/LabelInput.vue.js +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.js +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue2.js +11 -11
- package/dist/components/ImportCollection/DropEventListener.vue.js +42 -44
- package/dist/components/ImportCollection/ImportCollectionListener.vue.js +22 -23
- package/dist/components/ImportCollection/ImportCollectionModal.vue.js +141 -149
- package/dist/components/ImportCollection/ImportCollectionModal.vue3.js +1 -1
- package/dist/components/ImportCollection/ImportNowButton.vue.js +22 -23
- package/dist/components/ImportCollection/IntegrationLogo.vue.js +12 -13
- package/dist/components/ImportCollection/PasteEventListener.vue.js +11 -12
- package/dist/components/ImportCollection/WorkspaceSelector.vue.js +69 -76
- package/dist/components/ImportCollection/utils/get-openapi-version.js +8 -8
- package/dist/components/ImportCollection/utils/import-collection.js +14 -14
- package/dist/components/OpenApiClientButton.vue.js +1 -1
- package/dist/components/OpenApiClientButton.vue2.js +10 -10
- package/dist/components/ScalarAsciiArt.vue.js +1 -1
- package/dist/components/ScalarAsciiArt.vue2.js +19 -22
- package/dist/components/Search/useSearch.js +51 -61
- package/dist/components/SectionFilter.vue.js +1 -1
- package/dist/components/SectionFilter.vue2.js +26 -29
- package/dist/components/Server/ServerDropdown.vue.js +70 -96
- package/dist/components/Server/ServerDropdownItem.vue.js +1 -1
- package/dist/components/Server/ServerDropdownItem.vue2.js +57 -67
- package/dist/components/Server/ServerSelector.vue.js +44 -55
- package/dist/components/Server/ServerVariablesForm.vue.js +36 -42
- package/dist/components/Server/ServerVariablesSelect.vue.js +6 -6
- package/dist/components/SideNav/DownloadAppButton.vue.js +1 -1
- package/dist/components/SideNav/SideNav.vue.js +68 -74
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +1 -1
- package/dist/components/Sidebar/Sidebar.vue.js +1 -1
- package/dist/components/Sidebar/SidebarListElement.vue.js +2 -2
- package/dist/components/TopNav/TopNav.vue.js +107 -122
- package/dist/components/TopNav/TopNavItem.vue.js +1 -1
- package/dist/hooks/useFileDialog.js +12 -12
- package/dist/hooks/useResponseBody.js +14 -16
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/layouts/App/ApiClientApp.vue.js +50 -56
- package/dist/layouts/App/ApiClientApp.vue3.js +1 -1
- package/dist/layouts/App/create-api-client-app.js +19 -20
- package/dist/layouts/App/index.js +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.js +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue2.js +18 -21
- package/dist/layouts/Web/ApiClientWeb.vue.js +45 -51
- package/dist/layouts/Web/ApiClientWeb.vue3.js +1 -1
- package/dist/layouts/Web/create-api-client-web.js +19 -20
- package/dist/layouts/Web/index.js +1 -1
- package/dist/libs/create-client.js +102 -109
- package/dist/libs/env-helpers.js +3 -3
- package/dist/libs/event-bus.js +15 -15
- package/dist/libs/extractAttachmentFilename.js +5 -6
- package/dist/libs/find-request.js +9 -10
- package/dist/libs/get-request-uid-by-path-method.js +12 -12
- package/dist/libs/getOpenApiDocumentDetails.js +7 -7
- package/dist/libs/importers/curl.js +3 -3
- package/dist/libs/normalize-headers.js +9 -10
- package/dist/libs/postman.js +15 -17
- package/dist/libs/send-request/build-request-security.js +9 -10
- package/dist/libs/send-request/create-fetch-body.js +11 -12
- package/dist/libs/send-request/create-fetch-query-params.js +13 -13
- package/dist/libs/send-request/create-request-operation.js +83 -84
- package/dist/libs/send-request/decode-buffer.d.ts.map +1 -1
- package/dist/libs/send-request/set-request-cookies.js +12 -12
- package/dist/libs/string-template.js +21 -21
- package/dist/libs/validate-parameters.js +5 -8
- package/dist/plugins/plugin-manager.js +11 -17
- package/dist/store/active-entities.js +90 -117
- package/dist/store/collections.js +41 -42
- package/dist/store/import-spec.js +25 -26
- package/dist/store/request-example.js +20 -24
- package/dist/store/requests.js +63 -81
- package/dist/store/router-params.js +7 -7
- package/dist/store/security-schemes.js +35 -36
- package/dist/store/store.js +2 -2
- package/dist/store/tags.js +20 -21
- package/dist/style.css +1 -1
- package/dist/views/Collection/Collection.vue2.js +21 -22
- package/dist/views/Collection/CollectionAuthentication.vue.js +1 -1
- package/dist/views/Collection/CollectionAuthentication.vue2.js +43 -47
- package/dist/views/Collection/CollectionEnvironment.vue.js +1 -1
- package/dist/views/Collection/CollectionEnvironment.vue2.js +196 -207
- package/dist/views/Collection/CollectionInfoForm.vue.js +1 -1
- package/dist/views/Collection/CollectionInfoForm.vue2.js +34 -41
- package/dist/views/Collection/CollectionNavigation.vue.js +116 -125
- package/dist/views/Collection/CollectionOverview.vue2.js +22 -25
- package/dist/views/Collection/CollectionServerForm.vue.js +39 -45
- package/dist/views/Collection/CollectionServers.vue2.js +88 -98
- package/dist/views/Collection/CollectionSettings.vue.js +1 -1
- package/dist/views/Collection/CollectionSettings.vue2.js +101 -108
- package/dist/views/Collection/components/EnvironmentForm.vue.js +1 -1
- package/dist/views/Collection/components/EnvironmentForm.vue2.js +141 -145
- package/dist/views/Collection/components/MarkdownInput.vue.js +1 -1
- package/dist/views/Collection/components/MarkdownInput.vue2.js +1 -2
- package/dist/views/Components/CodeSnippet/CodeSnippet.vue.js +15 -15
- package/dist/views/Components/CodeSnippet/helpers/convert-to-har-request.js +15 -16
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +61 -64
- package/dist/views/Components/CodeSnippet/helpers/get-snippet.js +9 -10
- package/dist/views/Cookies/CookieModal.vue.js +1 -1
- package/dist/views/Cookies/Cookies.vue2.js +90 -93
- package/dist/views/Environment/Environment.vue2.js +267 -295
- package/dist/views/Environment/EnvironmentModal.vue.js +63 -70
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +38 -42
- package/dist/views/Request/Request.vue.js +1 -1
- package/dist/views/Request/Request.vue2.js +60 -67
- package/dist/views/Request/RequestRoot.vue.js +1 -1
- package/dist/views/Request/RequestRoot.vue2.js +78 -89
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.js +37 -44
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +44 -45
- package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.js +111 -127
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +120 -139
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.js +97 -97
- package/dist/views/Request/RequestSection/RequestBody.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestBody.vue2.js +287 -310
- package/dist/views/Request/RequestSection/RequestCodeExample.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestCodeExample.vue2.js +86 -94
- package/dist/views/Request/RequestSection/RequestParams.vue.js +37 -38
- package/dist/views/Request/RequestSection/RequestPathParams.vue.js +36 -38
- package/dist/views/Request/RequestSection/RequestSection.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestSection.vue2.js +28 -31
- package/dist/views/Request/RequestSection/RequestTable.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue2.js +49 -52
- package/dist/views/Request/RequestSection/RequestTableTooltip.vue.js +1 -1
- package/dist/views/Request/RequestSection/helpers/filter-security-requirements.js +16 -16
- package/dist/views/Request/RequestSection/helpers/getting-started.js +7 -11
- package/dist/views/Request/RequestSection/helpers/update-scheme.js +7 -8
- package/dist/views/Request/RequestSidebar.vue.js +1 -1
- package/dist/views/Request/RequestSidebar.vue2.js +199 -211
- package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
- package/dist/views/Request/RequestSidebarItem.vue2.js +332 -349
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +210 -240
- package/dist/views/Request/RequestSubpageHeader.vue.js +1 -1
- package/dist/views/Request/ResponseSection/RequestHeaders.vue.js +38 -41
- package/dist/views/Request/ResponseSection/ResponseBody.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseBody.vue2.js +58 -64
- package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue.js +1 -2
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue2.js +20 -23
- package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue3.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +29 -30
- package/dist/views/Request/ResponseSection/ResponseHeaders.vue.js +38 -41
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.js +28 -29
- package/dist/views/Request/ResponseSection/ResponseSection.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseSection.vue2.js +128 -140
- package/dist/views/Request/components/WorkspaceDropdown.vue.js +116 -124
- package/dist/views/Request/consts/mediaTypes.js +2 -3
- package/dist/views/Request/handle-drag.js +24 -28
- package/dist/views/Request/hooks/useOpenApiWatcher.js +26 -33
- package/dist/views/Request/libs/auth.js +37 -43
- package/dist/views/Request/libs/oauth2.js +30 -32
- package/dist/views/Request/libs/watch-mode.js +100 -103
- package/dist/views/Settings/SettingsGeneral.vue.js +206 -236
- package/package.json +22 -22
- package/dist/components/AddressBar/AddressBar.vue3.js +0 -4
- package/dist/components/AddressBar/AddressBarHistory.vue3.js +0 -4
- package/dist/components/CodeInput/CodeInput.vue3.js +0 -4
- package/dist/components/CodeInput/CodeInput.vue4.js +0 -4
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue3.js +0 -4
- package/dist/components/CommandPalette/TheCommandPalette.vue3.js +0 -4
- package/dist/components/DataTable/DataTableInput.vue3.js +0 -4
- package/dist/components/EmptyState.vue3.js +0 -4
- package/dist/components/Form/LabelInput.vue3.js +0 -4
- package/dist/components/HttpMethod/HttpMethod.vue3.js +0 -4
- package/dist/components/ImportCollection/ImportCollectionModal.vue2.js +0 -4
- package/dist/components/OpenApiClientButton.vue3.js +0 -4
- package/dist/components/ScalarAsciiArt.vue3.js +0 -4
- package/dist/components/SectionFilter.vue3.js +0 -4
- package/dist/components/Server/ServerDropdownItem.vue3.js +0 -4
- package/dist/components/SideNav/DownloadAppButton.vue3.js +0 -4
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue3.js +0 -4
- package/dist/components/Sidebar/Sidebar.vue3.js +0 -4
- package/dist/components/Sidebar/SidebarListElement.vue3.js +0 -4
- package/dist/components/Sidebar/SidebarListElement.vue4.js +0 -4
- package/dist/components/TopNav/TopNavItem.vue3.js +0 -4
- package/dist/layouts/App/ApiClientApp.vue2.js +0 -4
- package/dist/layouts/Modal/ApiClientModal.vue3.js +0 -4
- package/dist/layouts/Web/ApiClientWeb.vue2.js +0 -4
- package/dist/style.css.js +0 -4
- package/dist/views/Collection/CollectionAuthentication.vue3.js +0 -4
- package/dist/views/Collection/CollectionEnvironment.vue3.js +0 -4
- package/dist/views/Collection/CollectionInfoForm.vue3.js +0 -4
- package/dist/views/Collection/CollectionSettings.vue3.js +0 -4
- package/dist/views/Collection/components/EnvironmentForm.vue3.js +0 -4
- package/dist/views/Collection/components/MarkdownInput.vue3.js +0 -4
- package/dist/views/Cookies/CookieModal.vue3.js +0 -4
- package/dist/views/Request/Request.vue3.js +0 -4
- package/dist/views/Request/RequestRoot.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestBody.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestCodeExample.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestSection.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestTable.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestTableTooltip.vue3.js +0 -4
- package/dist/views/Request/RequestSidebar.vue3.js +0 -4
- package/dist/views/Request/RequestSidebarItem.vue3.js +0 -4
- package/dist/views/Request/RequestSidebarItem.vue4.js +0 -4
- package/dist/views/Request/RequestSidebarItemMenu.vue3.js +0 -4
- package/dist/views/Request/RequestSubpageHeader.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBody.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue2.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseSection.vue3.js +0 -4
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { collectionSchema as M, requestSchema as
|
|
2
|
-
import { schemaModel as
|
|
1
|
+
import { collectionSchema as M, requestSchema as O, serverSchema as V, tagSchema as S, securitySchemeSchema as Z, createExampleFromRequest as x } from "@scalar/oas-utils/entities/spec";
|
|
2
|
+
import { schemaModel as v, isHttpMethod as k } from "@scalar/oas-utils/helpers";
|
|
3
3
|
import { getNestedValue as D } from "@scalar/object-utils/nested";
|
|
4
|
-
import
|
|
4
|
+
import H from "microdiff";
|
|
5
5
|
import { z as i } from "zod";
|
|
6
|
-
const
|
|
6
|
+
const j = (e, s = []) => {
|
|
7
7
|
const t = [];
|
|
8
8
|
let a = !1;
|
|
9
|
-
for (let
|
|
9
|
+
for (let r = 0; r < e.length; r++) {
|
|
10
10
|
if (a) {
|
|
11
11
|
a = !1;
|
|
12
12
|
continue;
|
|
13
13
|
}
|
|
14
|
-
const n = e[
|
|
14
|
+
const n = e[r], u = e[r + 1];
|
|
15
15
|
if (n) {
|
|
16
16
|
if (s.length)
|
|
17
|
-
n.path = [...s, ...n.path],
|
|
17
|
+
n.path = [...s, ...n.path], u && (u.path = [...s, ...u.path]);
|
|
18
18
|
else if (n.path[0] !== "paths") {
|
|
19
19
|
t.push(n);
|
|
20
20
|
continue;
|
|
21
21
|
}
|
|
22
|
-
if (n.type === "REMOVE" &&
|
|
23
|
-
const [, l, p] = n.path, [, o, h] =
|
|
22
|
+
if (n.type === "REMOVE" && u?.type === "CREATE") {
|
|
23
|
+
const [, l, p] = n.path, [, o, h] = u.path, c = ["paths", o].filter((f) => typeof f == "string");
|
|
24
24
|
if (l !== o && t.push({
|
|
25
25
|
type: "CHANGE",
|
|
26
26
|
path: ["paths", "path"],
|
|
@@ -32,10 +32,10 @@ const G = (e, s = []) => {
|
|
|
32
32
|
oldValue: p,
|
|
33
33
|
value: h
|
|
34
34
|
}), c.push(h)), s.length === 0) {
|
|
35
|
-
const f =
|
|
35
|
+
const f = H(n.oldValue, u.value);
|
|
36
36
|
if (f.length) {
|
|
37
|
-
const
|
|
38
|
-
t.push(...
|
|
37
|
+
const R = j(f, c);
|
|
38
|
+
t.push(...R);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
a = !0;
|
|
@@ -43,17 +43,17 @@ const G = (e, s = []) => {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
return t;
|
|
46
|
-
},
|
|
46
|
+
}, E = (e, s, t) => {
|
|
47
47
|
for (const a of e) {
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
return
|
|
48
|
+
const r = s[a];
|
|
49
|
+
if (r && t(r))
|
|
50
|
+
return r;
|
|
51
51
|
}
|
|
52
52
|
return null;
|
|
53
|
-
},
|
|
53
|
+
}, y = (e) => e instanceof i.ZodOptional ? y(e.unwrap()) : e instanceof i.ZodDefault ? y(e._def.innerType) : e instanceof i.ZodEffects ? y(e._def.schema) : e instanceof i.ZodCatch ? y(e._def.innerType) : e, G = (e, s) => {
|
|
54
54
|
let t = e;
|
|
55
55
|
for (const a of s) {
|
|
56
|
-
if (t =
|
|
56
|
+
if (t = y(t), t instanceof i.ZodAny)
|
|
57
57
|
return t;
|
|
58
58
|
if (t instanceof i.ZodObject && typeof a == "string" && a in t.shape)
|
|
59
59
|
t = t.shape[a];
|
|
@@ -71,215 +71,212 @@ const G = (e, s = []) => {
|
|
|
71
71
|
t = t.valueSchema;
|
|
72
72
|
else
|
|
73
73
|
return null;
|
|
74
|
-
t =
|
|
74
|
+
t = y(t);
|
|
75
75
|
}
|
|
76
76
|
return t;
|
|
77
|
-
},
|
|
78
|
-
const t =
|
|
77
|
+
}, d = (e, s) => {
|
|
78
|
+
const t = G(e, s.path);
|
|
79
79
|
if (!t)
|
|
80
80
|
return null;
|
|
81
|
-
const a = s.path.join("."),
|
|
81
|
+
const a = s.path.join("."), r = s.path.slice(0, -1).join(".");
|
|
82
82
|
if (s.type === "REMOVE")
|
|
83
83
|
return {
|
|
84
84
|
path: a,
|
|
85
|
-
pathMinusOne:
|
|
85
|
+
pathMinusOne: r,
|
|
86
86
|
value: void 0
|
|
87
87
|
};
|
|
88
|
-
const n =
|
|
88
|
+
const n = v(s.value, t, !1);
|
|
89
89
|
return typeof n > "u" || n === null ? null : {
|
|
90
90
|
path: a,
|
|
91
|
-
pathMinusOne:
|
|
91
|
+
pathMinusOne: r,
|
|
92
92
|
value: n
|
|
93
93
|
};
|
|
94
94
|
}, L = (e, { activeCollection: s }, { collectionMutators: t }) => {
|
|
95
95
|
if (!s.value)
|
|
96
96
|
return !1;
|
|
97
97
|
if (typeof e.path[e.path.length - 1] == "number" && (e.type === "CREATE" || e.type === "REMOVE")) {
|
|
98
|
-
const a =
|
|
98
|
+
const a = d(M, {
|
|
99
99
|
...e,
|
|
100
100
|
path: e.path
|
|
101
101
|
});
|
|
102
102
|
if (!a)
|
|
103
103
|
return !1;
|
|
104
|
-
const
|
|
105
|
-
e.type === "CREATE" ?
|
|
104
|
+
const r = [...D(s.value, a.pathMinusOne)];
|
|
105
|
+
e.type === "CREATE" ? r.push(a.value) : e.type === "REMOVE" && r.pop(), t.edit(s.value.uid, a.pathMinusOne, r);
|
|
106
106
|
} else {
|
|
107
|
-
const a =
|
|
107
|
+
const a = d(M, e);
|
|
108
108
|
if (!a)
|
|
109
109
|
return !1;
|
|
110
110
|
t.edit(s.value.uid, a.path, a.value);
|
|
111
111
|
}
|
|
112
112
|
return !0;
|
|
113
113
|
}, T = (e, s) => {
|
|
114
|
-
const { requests: t, requestExamples: a, requestExampleMutators:
|
|
115
|
-
n
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
l && u.set({
|
|
114
|
+
const { requests: t, requestExamples: a, requestExampleMutators: r } = s, n = t[e];
|
|
115
|
+
n?.examples.forEach((u) => {
|
|
116
|
+
const l = x(n, a[u]?.name ?? "Default");
|
|
117
|
+
l && r.set({
|
|
119
118
|
...l,
|
|
120
|
-
uid:
|
|
119
|
+
uid: u
|
|
121
120
|
});
|
|
122
121
|
});
|
|
123
122
|
}, P = (e, { activeCollection: s }, t) => {
|
|
124
123
|
if (!s.value)
|
|
125
124
|
return !1;
|
|
126
|
-
const { requests: a, requestMutators:
|
|
125
|
+
const { requests: a, requestMutators: r } = t, [, n, u, ...l] = e.path;
|
|
127
126
|
if (n === "path" && e.type === "CHANGE")
|
|
128
127
|
s.value.requests.forEach((p) => {
|
|
129
|
-
|
|
130
|
-
((o = a[p]) == null ? void 0 : o.path) === e.oldValue && u.edit(p, "path", e.value);
|
|
128
|
+
a[p]?.path === e.oldValue && r.edit(p, "path", e.value);
|
|
131
129
|
});
|
|
132
|
-
else if (
|
|
130
|
+
else if (u === "method" && e.type === "CHANGE")
|
|
133
131
|
s.value.requests.forEach((p) => {
|
|
134
|
-
|
|
135
|
-
((o = a[p]) == null ? void 0 : o.method) === e.oldValue && ((h = a[p]) == null ? void 0 : h.path) === n && u.edit(p, "method", e.value);
|
|
132
|
+
a[p]?.method === e.oldValue && a[p]?.path === n && r.edit(p, "method", e.value);
|
|
136
133
|
});
|
|
137
134
|
else if (e.type !== "CHANGE" && typeof l.at(-1) == "number") {
|
|
138
|
-
const p =
|
|
135
|
+
const p = E(
|
|
139
136
|
s.value.requests,
|
|
140
137
|
a,
|
|
141
|
-
(c) => c.path === n && c.method ===
|
|
142
|
-
), o =
|
|
138
|
+
(c) => c.path === n && c.method === u
|
|
139
|
+
), o = d(O, {
|
|
143
140
|
...e,
|
|
144
141
|
path: e.path.slice(3)
|
|
145
142
|
});
|
|
146
143
|
if (!p || !o)
|
|
147
144
|
return !1;
|
|
148
145
|
const h = [...D(p, o.pathMinusOne)];
|
|
149
|
-
e.type === "CREATE" ? h.push(o.value) : e.type === "REMOVE" && h.pop(),
|
|
146
|
+
e.type === "CREATE" ? h.push(o.value) : e.type === "REMOVE" && h.pop(), r.edit(p.uid, o.pathMinusOne, h), (e.path[3] === "parameters" || e.path[3] === "requestBody") && T(p.uid, t);
|
|
150
147
|
} else if (e.type === "CREATE") {
|
|
151
|
-
const [p] = Object.entries(e.value ?? {}), [o, h] = p ?? [], c =
|
|
148
|
+
const [p] = Object.entries(e.value ?? {}), [o, h] = p ?? [], c = u ? e.value : h, f = u || o, R = V.array().parse(c.servers ?? []), { security: q, ...N } = c, A = {
|
|
152
149
|
...N,
|
|
153
|
-
method:
|
|
150
|
+
method: k(f) ? f : "get",
|
|
154
151
|
path: n,
|
|
155
152
|
parameters: c.parameters ?? [],
|
|
156
|
-
servers:
|
|
153
|
+
servers: R.map((m) => m.uid)
|
|
157
154
|
};
|
|
158
|
-
|
|
155
|
+
q?.length && (A.security = q.map((m) => {
|
|
159
156
|
if (Object.keys(m).length) {
|
|
160
|
-
const [
|
|
161
|
-
return
|
|
162
|
-
[
|
|
157
|
+
const [g] = Object.keys(m);
|
|
158
|
+
return g ? {
|
|
159
|
+
[g]: m[g]
|
|
163
160
|
} : m;
|
|
164
161
|
}
|
|
165
162
|
return m;
|
|
166
163
|
}));
|
|
167
|
-
const b =
|
|
164
|
+
const b = v(A, O, !1);
|
|
168
165
|
if (!b)
|
|
169
166
|
return !1;
|
|
170
|
-
|
|
167
|
+
r.add(b, s.value.uid);
|
|
171
168
|
} else if (e.type === "REMOVE") {
|
|
172
|
-
const p =
|
|
169
|
+
const p = E(
|
|
173
170
|
s.value.requests,
|
|
174
171
|
a,
|
|
175
|
-
(o) => o.path === n && o.method ===
|
|
172
|
+
(o) => o.path === n && o.method === u
|
|
176
173
|
);
|
|
177
174
|
if (!p)
|
|
178
175
|
return !1;
|
|
179
|
-
|
|
176
|
+
r.delete(p, s.value.uid);
|
|
180
177
|
} else if (e.type === "CHANGE") {
|
|
181
|
-
const p =
|
|
178
|
+
const p = E(
|
|
182
179
|
s.value.requests,
|
|
183
180
|
a,
|
|
184
|
-
(h) => h.path === n && h.method ===
|
|
185
|
-
), o =
|
|
181
|
+
(h) => h.path === n && h.method === u
|
|
182
|
+
), o = d(O, { ...e, path: l });
|
|
186
183
|
if (!p || !o)
|
|
187
184
|
return !1;
|
|
188
|
-
|
|
185
|
+
r.edit(p.uid, o.path, o.value), (e.path[3] === "parameters" || e.path[3] === "requestBody") && T(p.uid, t);
|
|
189
186
|
}
|
|
190
187
|
return !0;
|
|
191
188
|
}, W = (e, { activeCollection: s }, { servers: t, serverMutators: a }) => {
|
|
192
189
|
if (!s.value)
|
|
193
190
|
return !1;
|
|
194
|
-
const [,
|
|
195
|
-
if (n
|
|
196
|
-
const
|
|
197
|
-
if (!
|
|
191
|
+
const [, r, ...n] = e.path;
|
|
192
|
+
if (n?.length) {
|
|
193
|
+
const u = s.value.servers[r];
|
|
194
|
+
if (!u)
|
|
198
195
|
return !1;
|
|
199
|
-
const l = t[
|
|
196
|
+
const l = t[u], p = d(V, { ...e, path: n });
|
|
200
197
|
if (!l || !p)
|
|
201
198
|
return !1;
|
|
202
199
|
const h = e.type === "REMOVE" && n[n.length - 1] === "variables" ? {} : p.value;
|
|
203
|
-
a.edit(
|
|
200
|
+
a.edit(u, p.path, h);
|
|
204
201
|
} else if (e.type === "REMOVE") {
|
|
205
|
-
if (!s.value.servers[
|
|
202
|
+
if (!s.value.servers[r])
|
|
206
203
|
return !1;
|
|
207
|
-
a.delete(s.value.servers[
|
|
204
|
+
a.delete(s.value.servers[r], s.value.uid);
|
|
208
205
|
} else if (e.type === "CREATE") {
|
|
209
|
-
const
|
|
210
|
-
if (!
|
|
206
|
+
const u = v(e.value, V, !1);
|
|
207
|
+
if (!u)
|
|
211
208
|
return !1;
|
|
212
|
-
a.add(
|
|
209
|
+
a.add(u, s.value.uid);
|
|
213
210
|
}
|
|
214
211
|
return !0;
|
|
215
212
|
}, I = (e, { activeCollection: s }, { tags: t, tagMutators: a }) => {
|
|
216
213
|
if (!s.value)
|
|
217
214
|
return !1;
|
|
218
|
-
const [,
|
|
219
|
-
if (n
|
|
220
|
-
const
|
|
221
|
-
if (!
|
|
215
|
+
const [, r, ...n] = e.path;
|
|
216
|
+
if (n?.length) {
|
|
217
|
+
const u = s.value.tags[r];
|
|
218
|
+
if (!u)
|
|
222
219
|
return !1;
|
|
223
|
-
const l = t[
|
|
220
|
+
const l = t[u], p = d(S, { ...e, path: n });
|
|
224
221
|
if (!l || !p)
|
|
225
222
|
return !1;
|
|
226
|
-
a.edit(
|
|
223
|
+
a.edit(u, p.path, p.value);
|
|
227
224
|
} else if (e.type === "REMOVE") {
|
|
228
|
-
const
|
|
229
|
-
if (!
|
|
225
|
+
const u = s.value.tags[r];
|
|
226
|
+
if (!u)
|
|
230
227
|
return !1;
|
|
231
|
-
const l = t[
|
|
228
|
+
const l = t[u];
|
|
232
229
|
if (!l)
|
|
233
230
|
return !1;
|
|
234
231
|
a.delete(l, s.value.uid);
|
|
235
232
|
} else if (e.type === "CREATE") {
|
|
236
|
-
const
|
|
237
|
-
if (!
|
|
233
|
+
const u = v(e.value, S, !1);
|
|
234
|
+
if (!u)
|
|
238
235
|
return !1;
|
|
239
|
-
a.add(
|
|
236
|
+
a.add(u, s.value.uid);
|
|
240
237
|
}
|
|
241
238
|
return !0;
|
|
242
|
-
},
|
|
243
|
-
const a =
|
|
239
|
+
}, _ = (e, s, t) => {
|
|
240
|
+
const a = y(e);
|
|
244
241
|
if (a instanceof i.ZodUnion || a instanceof i.ZodDiscriminatedUnion) {
|
|
245
|
-
for (const
|
|
246
|
-
if (
|
|
247
|
-
return
|
|
242
|
+
for (const r of a.options)
|
|
243
|
+
if (r instanceof i.ZodObject && s in r.shape && r.shape[s] instanceof i.ZodLiteral && r.shape[s].value === t)
|
|
244
|
+
return r;
|
|
248
245
|
}
|
|
249
246
|
return null;
|
|
250
247
|
}, J = (e, { activeCollection: s }, { securitySchemes: t, securitySchemeMutators: a }) => {
|
|
251
248
|
if (!s.value)
|
|
252
249
|
return !1;
|
|
253
|
-
const [, ,
|
|
250
|
+
const [, , r, ...n] = e.path, u = t[r] ?? E(
|
|
254
251
|
s.value.securitySchemes,
|
|
255
252
|
t,
|
|
256
|
-
(l) => l.nameKey ===
|
|
253
|
+
(l) => l.nameKey === r
|
|
257
254
|
);
|
|
258
|
-
if (n
|
|
259
|
-
const l =
|
|
260
|
-
if (!l || !
|
|
255
|
+
if (n?.length) {
|
|
256
|
+
const l = _(Z, "type", u?.type ?? "");
|
|
257
|
+
if (!l || !u)
|
|
261
258
|
return !1;
|
|
262
|
-
const p =
|
|
259
|
+
const p = d(l, { ...e, path: n });
|
|
263
260
|
if (!p)
|
|
264
261
|
return !1;
|
|
265
262
|
const o = p.path;
|
|
266
|
-
a.edit(
|
|
263
|
+
a.edit(u.uid, o, p.value);
|
|
267
264
|
} else if (e.type === "REMOVE") {
|
|
268
|
-
if (!
|
|
265
|
+
if (!u)
|
|
269
266
|
return !1;
|
|
270
|
-
a.delete(
|
|
267
|
+
a.delete(u.uid);
|
|
271
268
|
} else e.type === "CREATE" && a.add(Z.parse(e.value), s.value.uid);
|
|
272
269
|
return !0;
|
|
273
270
|
};
|
|
274
271
|
export {
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
j as combineRenameDiffs,
|
|
273
|
+
E as findResource,
|
|
277
274
|
L as mutateCollectionDiff,
|
|
278
275
|
P as mutateRequestDiff,
|
|
279
276
|
J as mutateSecuritySchemeDiff,
|
|
280
277
|
W as mutateServerDiff,
|
|
281
278
|
I as mutateTagDiff,
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
279
|
+
_ as narrowUnionSchema,
|
|
280
|
+
d as parseDiff,
|
|
281
|
+
G as traverseZodSchema
|
|
285
282
|
};
|