@scalar/api-client 2.1.51 → 2.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.
Files changed (201) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/components/AddressBar/AddressBar.vue.d.ts.map +1 -1
  3. package/dist/components/AddressBar/AddressBar.vue.js +1 -1
  4. package/dist/components/AddressBar/AddressBar.vue2.js +35 -42
  5. package/dist/components/AddressBar/AddressBarHistory.vue.d.ts.map +1 -1
  6. package/dist/components/AddressBar/AddressBarHistory.vue.js +2 -2
  7. package/dist/components/AddressBar/AddressBarHistory.vue2.js +25 -24
  8. package/dist/components/AddressBar/AddressBarServer.vue.d.ts.map +1 -1
  9. package/dist/components/AddressBar/AddressBarServer.vue.js +32 -39
  10. package/dist/components/AddressBar/AddressBarServerItem.vue.d.ts.map +1 -1
  11. package/dist/components/AddressBar/AddressBarServerItem.vue.js +10 -15
  12. package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
  13. package/dist/components/CodeInput/CodeInput.vue.js +1 -1
  14. package/dist/components/CodeInput/CodeInput.vue2.js +48 -47
  15. package/dist/components/CodeInput/codeVariableWidget.d.ts +3 -2
  16. package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -1
  17. package/dist/components/CommandPalette/CommandPaletteCollection.vue.d.ts.map +1 -1
  18. package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +16 -15
  19. package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts.map +1 -1
  20. package/dist/components/CommandPalette/CommandPaletteExample.vue.js +18 -23
  21. package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
  22. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +27 -26
  23. package/dist/components/CommandPalette/CommandPaletteRequest.vue.d.ts.map +1 -1
  24. package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +19 -20
  25. package/dist/components/CommandPalette/CommandPaletteServer.vue.d.ts.map +1 -1
  26. package/dist/components/CommandPalette/CommandPaletteServer.vue.js +19 -24
  27. package/dist/components/CommandPalette/CommandPaletteTag.vue.d.ts.map +1 -1
  28. package/dist/components/CommandPalette/CommandPaletteTag.vue.js +23 -22
  29. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
  30. package/dist/components/CommandPalette/TheCommandPalette.vue.js +4 -4
  31. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +47 -46
  32. package/dist/components/DataTable/DataTableInput.vue.d.ts +1 -1
  33. package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
  34. package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.d.ts.map +1 -1
  35. package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +23 -28
  36. package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
  37. package/dist/components/IconSelector.vue.js +2 -2
  38. package/dist/components/ImportCollection/ImportCollectionModal.vue.d.ts.map +1 -1
  39. package/dist/components/ImportCollection/ImportCollectionModal.vue.js +127 -96
  40. package/dist/components/ImportCollection/ImportNowButton.vue.d.ts.map +1 -1
  41. package/dist/components/ImportCollection/ImportNowButton.vue.js +28 -27
  42. package/dist/components/ImportCollection/IntegrationLogo.vue.d.ts +1 -1
  43. package/dist/components/ImportCollection/IntegrationLogo.vue.d.ts.map +1 -1
  44. package/dist/components/ImportCollection/IntegrationLogo.vue.js +14 -18
  45. package/dist/components/ImportCollection/WorkspaceSelector.vue.d.ts.map +1 -1
  46. package/dist/components/ImportCollection/WorkspaceSelector.vue.js +15 -14
  47. package/dist/components/Search/useSearch.d.ts.map +1 -1
  48. package/dist/components/Search/useSearch.js +20 -19
  49. package/dist/components/SideNav/SideNavRouterLink.vue.js +9 -9
  50. package/dist/components/Sidebar/Sidebar.vue.d.ts.map +1 -1
  51. package/dist/components/Sidebar/Sidebar.vue.js +2 -2
  52. package/dist/components/Sidebar/Sidebar.vue2.js +37 -39
  53. package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
  54. package/dist/components/TopNav/TopNav.vue.js +1 -1
  55. package/dist/components/TopNav/TopNav.vue2.js +20 -19
  56. package/dist/components/TopNav/TopNavItem.vue.d.ts +2 -2
  57. package/dist/hooks/index.js +3 -2
  58. package/dist/hooks/useLayout.d.ts +2 -0
  59. package/dist/hooks/useLayout.d.ts.map +1 -1
  60. package/dist/hooks/useLayout.js +4 -3
  61. package/dist/layouts/App/ApiClientApp.vue.d.ts.map +1 -1
  62. package/dist/layouts/App/ApiClientApp.vue.js +38 -37
  63. package/dist/layouts/App/MainLayout.vue.d.ts.map +1 -1
  64. package/dist/layouts/App/MainLayout.vue.js +3 -3
  65. package/dist/layouts/App/create-api-client-app.d.ts +670 -1232
  66. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  67. package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
  68. package/dist/layouts/Modal/ApiClientModal.vue.js +2 -2
  69. package/dist/layouts/Modal/ApiClientModal.vue2.js +24 -23
  70. package/dist/layouts/Modal/create-api-client-modal.d.ts +1384 -2508
  71. package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
  72. package/dist/layouts/Web/ApiClientWeb.vue.d.ts.map +1 -1
  73. package/dist/layouts/Web/ApiClientWeb.vue.js +34 -33
  74. package/dist/layouts/Web/create-api-client-web.d.ts +670 -1232
  75. package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
  76. package/dist/libs/create-client.d.ts +675 -1236
  77. package/dist/libs/create-client.d.ts.map +1 -1
  78. package/dist/libs/create-client.js +100 -95
  79. package/dist/libs/hot-keys.d.ts +1 -1
  80. package/dist/libs/send-request.d.ts +3 -7
  81. package/dist/libs/send-request.d.ts.map +1 -1
  82. package/dist/libs/send-request.js +126 -119
  83. package/dist/libs/string-template.d.ts.map +1 -1
  84. package/dist/libs/string-template.js +23 -22
  85. package/dist/store/active-entities.d.ts +333 -0
  86. package/dist/store/active-entities.d.ts.map +1 -0
  87. package/dist/store/active-entities.js +97 -0
  88. package/dist/store/collections.d.ts +4 -274
  89. package/dist/store/collections.d.ts.map +1 -1
  90. package/dist/store/cookies.d.ts +4 -4
  91. package/dist/store/environment.d.ts +4 -4
  92. package/dist/store/import-spec.d.ts +0 -54
  93. package/dist/store/import-spec.d.ts.map +1 -1
  94. package/dist/store/index.js +4 -3
  95. package/dist/store/request-example.d.ts +4 -4
  96. package/dist/store/requests.d.ts +15 -15
  97. package/dist/store/security-schemes.d.ts +527 -317
  98. package/dist/store/security-schemes.d.ts.map +1 -1
  99. package/dist/store/security-schemes.js +33 -41
  100. package/dist/store/servers.d.ts +4 -4
  101. package/dist/store/store-context.d.ts +0 -3
  102. package/dist/store/store-context.d.ts.map +1 -1
  103. package/dist/store/store.d.ts +640 -5297
  104. package/dist/store/store.d.ts.map +1 -1
  105. package/dist/store/store.js +111 -189
  106. package/dist/store/tags.d.ts +4 -4
  107. package/dist/store/workspace.d.ts +14 -24
  108. package/dist/store/workspace.d.ts.map +1 -1
  109. package/dist/style.css +1 -1
  110. package/dist/views/Cookies/CookieForm.vue.d.ts.map +1 -1
  111. package/dist/views/Cookies/CookieForm.vue.js +14 -13
  112. package/dist/views/Cookies/CookieRaw.vue.d.ts.map +1 -1
  113. package/dist/views/Cookies/CookieRaw.vue.js +14 -13
  114. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts +3 -3
  115. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
  116. package/dist/views/Request/Request.vue.d.ts.map +1 -1
  117. package/dist/views/Request/Request.vue.js +2 -2
  118. package/dist/views/Request/Request.vue2.js +94 -94
  119. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts +2 -2
  120. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
  121. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +96 -99
  122. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts +2 -2
  123. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts.map +1 -1
  124. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.js +49 -46
  125. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
  126. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +2 -2
  127. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +94 -100
  128. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.d.ts.map +1 -1
  129. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.js +60 -67
  130. package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.d.ts +1 -1
  131. package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.d.ts.map +1 -1
  132. package/dist/views/Request/RequestSection/RequestBody.vue.d.ts.map +1 -1
  133. package/dist/views/Request/RequestSection/RequestBody.vue.js +2 -2
  134. package/dist/views/Request/RequestSection/RequestBody.vue2.js +29 -28
  135. package/dist/views/Request/RequestSection/RequestParams.vue.d.ts.map +1 -1
  136. package/dist/views/Request/RequestSection/RequestParams.vue.js +11 -10
  137. package/dist/views/Request/RequestSection/RequestPathParams.vue.d.ts.map +1 -1
  138. package/dist/views/Request/RequestSection/RequestPathParams.vue.js +24 -28
  139. package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
  140. package/dist/views/Request/RequestSection/RequestSection.vue.js +2 -2
  141. package/dist/views/Request/RequestSection/RequestSection.vue2.js +19 -18
  142. package/dist/views/Request/RequestSection/RequestTable.vue.d.ts +2 -2
  143. package/dist/views/Request/RequestSection/RequestTableTooltip.vue.d.ts.map +1 -1
  144. package/dist/views/Request/RequestSection/RequestTableTooltip.vue.js +27 -27
  145. package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
  146. package/dist/views/Request/RequestSidebar.vue.js +1 -1
  147. package/dist/views/Request/RequestSidebar.vue2.js +74 -75
  148. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  149. package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
  150. package/dist/views/Request/RequestSidebarItem.vue2.js +111 -109
  151. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
  152. package/dist/views/Request/RequestSidebarItemMenu.vue.js +2 -2
  153. package/dist/views/Request/RequestSidebarItemMenu.vue2.js +15 -16
  154. package/dist/views/Request/RequestSubpageHeader.vue.js +1 -1
  155. package/dist/views/Request/RequestSubpageHeader.vue2.js +14 -14
  156. package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.d.ts.map +1 -1
  157. package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.js +2 -2
  158. package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue2.js +35 -15
  159. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.d.ts.map +1 -1
  160. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +1 -1
  161. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +23 -22
  162. package/dist/views/Request/components/WorkspaceDropdown.vue.d.ts.map +1 -1
  163. package/dist/views/Request/components/WorkspaceDropdown.vue.js +32 -31
  164. package/dist/views/Request/consts/new-auth-options.d.ts +16 -8
  165. package/dist/views/Request/consts/new-auth-options.d.ts.map +1 -1
  166. package/dist/views/Request/consts/new-auth-options.js +16 -8
  167. package/dist/views/Request/handle-drag.d.ts +2 -1
  168. package/dist/views/Request/handle-drag.d.ts.map +1 -1
  169. package/dist/views/Request/handle-drag.js +23 -25
  170. package/dist/views/Request/hooks/useOpenApiWatcher.d.ts.map +1 -1
  171. package/dist/views/Request/hooks/useOpenApiWatcher.js +40 -39
  172. package/dist/views/Request/libs/auth.d.ts +1 -29
  173. package/dist/views/Request/libs/auth.d.ts.map +1 -1
  174. package/dist/views/Request/libs/auth.js +2 -9
  175. package/dist/views/Request/libs/index.js +6 -8
  176. package/dist/views/Request/libs/live-sync.d.ts +6 -5
  177. package/dist/views/Request/libs/live-sync.d.ts.map +1 -1
  178. package/dist/views/Request/libs/live-sync.js +164 -185
  179. package/dist/views/Request/libs/oauth2.d.ts +6 -10
  180. package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
  181. package/dist/views/Request/libs/oauth2.js +54 -69
  182. package/dist/views/Servers/ServerForm.vue.d.ts.map +1 -1
  183. package/dist/views/Servers/ServerForm.vue.js +14 -13
  184. package/dist/views/Servers/Servers.vue.d.ts.map +1 -1
  185. package/dist/views/Servers/Servers.vue2.js +18 -17
  186. package/dist/views/Settings/SettingsGeneral.vue.d.ts.map +1 -1
  187. package/dist/views/Settings/SettingsGeneral.vue.js +218 -126
  188. package/dist/views/Settings/{SettingsGeneralMode.vue.d.ts → components/SettingsAppearance.vue.d.ts} +2 -2
  189. package/dist/views/Settings/components/SettingsAppearance.vue.d.ts.map +1 -0
  190. package/dist/views/Settings/components/SettingsAppearance.vue.js +74 -0
  191. package/dist/views/Settings/components/SettingsAppearance.vue2.js +4 -0
  192. package/dist/views/Settings/components/SettingsSection.vue.d.ts +24 -0
  193. package/dist/views/Settings/components/SettingsSection.vue.d.ts.map +1 -0
  194. package/dist/views/Settings/components/SettingsSection.vue.js +24 -0
  195. package/dist/views/Settings/components/SettingsSection.vue2.js +4 -0
  196. package/package.json +12 -12
  197. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthModal.vue.d.ts +0 -16
  198. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthModal.vue.d.ts.map +0 -1
  199. package/dist/views/Settings/SettingsGeneralMode.vue.d.ts.map +0 -1
  200. package/dist/views/Settings/SettingsGeneralMode.vue.js +0 -78
  201. package/dist/views/Settings/SettingsGeneralMode.vue2.js +0 -4
@@ -1,66 +1,66 @@
1
1
  import { isHTTPMethod as D } from "../../../components/HttpMethod/helpers.js";
2
- import { collectionSchema as b, requestSchema as O, serverSchema as V, tagSchema as M, oasOauthFlowSchema as H, securitySchemeSchema as S, createExampleFromRequest as j } from "@scalar/oas-utils/entities/spec";
2
+ import { collectionSchema as b, requestSchema as O, serverSchema as V, tagSchema as M, securitySchemeSchema as S, createExampleFromRequest as H } from "@scalar/oas-utils/entities/spec";
3
3
  import { schemaModel as R } from "@scalar/oas-utils/helpers";
4
- import { getNestedValue as N } from "@scalar/object-utils/nested";
5
- import G from "microdiff";
4
+ import { getNestedValue as Z } from "@scalar/object-utils/nested";
5
+ import j from "microdiff";
6
6
  import { z as i } from "zod";
7
- const x = (e, r = []) => {
7
+ const x = (e, s = []) => {
8
8
  const t = [];
9
- let s = !1;
10
- for (let u = 0; u < e.length; u++) {
11
- if (s) {
12
- s = !1;
9
+ let a = !1;
10
+ for (let n = 0; n < e.length; n++) {
11
+ if (a) {
12
+ a = !1;
13
13
  continue;
14
14
  }
15
- const a = e[u], n = e[u + 1];
16
- if (r.length)
17
- a.path = [...r, ...a.path], n && (n.path = [...r, ...n.path]);
18
- else if (a.path[0] !== "paths") {
19
- t.push(a);
15
+ const r = e[n], u = e[n + 1];
16
+ if (s.length)
17
+ r.path = [...s, ...r.path], u && (u.path = [...s, ...u.path]);
18
+ else if (r.path[0] !== "paths") {
19
+ t.push(r);
20
20
  continue;
21
21
  }
22
- if (a.type === "REMOVE" && (n == null ? void 0 : n.type) === "CREATE") {
23
- const [, h, p] = a.path, [, o, l] = n.path, c = ["paths", o];
24
- if (h !== o && t.push({
22
+ if (r.type === "REMOVE" && (u == null ? void 0 : u.type) === "CREATE") {
23
+ const [, l, p] = r.path, [, o, h] = u.path, c = ["paths", o];
24
+ if (l !== o && t.push({
25
25
  type: "CHANGE",
26
26
  path: ["paths", "path"],
27
- oldValue: h,
27
+ oldValue: l,
28
28
  value: o
29
- }), p && l && p !== l && (t.push({
29
+ }), p && h && p !== h && (t.push({
30
30
  type: "CHANGE",
31
31
  path: ["paths", o, "method"],
32
32
  oldValue: p,
33
- value: l
34
- }), c.push(l)), r.length === 0) {
35
- const m = G(a.oldValue, n.value);
36
- if (m.length) {
37
- const E = x(m, c);
38
- t.push(...E);
33
+ value: h
34
+ }), c.push(h)), s.length === 0) {
35
+ const y = j(r.oldValue, u.value);
36
+ if (y.length) {
37
+ const f = x(y, c);
38
+ t.push(...f);
39
39
  }
40
40
  }
41
- s = !0;
42
- } else a.type === "CREATE" && a.path.length > 3 && typeof a.path.at(-1) != "number" ? t.push({ ...a, type: "CHANGE", oldValue: void 0 }) : a.type === "REMOVE" && a.path.length > 3 && typeof a.path.at(-1) != "number" ? t.push({ ...a, type: "CHANGE", value: void 0 }) : t.push(a);
41
+ a = !0;
42
+ } else r.type === "CREATE" && r.path.length > 3 && typeof r.path.at(-1) != "number" ? t.push({ ...r, type: "CHANGE", oldValue: void 0 }) : r.type === "REMOVE" && r.path.length > 3 && typeof r.path.at(-1) != "number" ? t.push({ ...r, type: "CHANGE", value: void 0 }) : t.push(r);
43
43
  }
44
44
  return t;
45
- }, v = (e, r, t) => {
46
- for (const s of e) {
47
- const u = r[s];
48
- if (t(u)) return u;
45
+ }, v = (e, s, t) => {
46
+ for (const a of e) {
47
+ const n = s[a];
48
+ if (t(n)) return n;
49
49
  }
50
50
  return null;
51
- }, y = (e) => e instanceof i.ZodOptional ? y(e.unwrap()) : e instanceof i.ZodDefault ? y(e._def.innerType) : e, C = (e, r) => {
51
+ }, d = (e) => e instanceof i.ZodOptional ? d(e.unwrap()) : e instanceof i.ZodDefault ? d(e._def.innerType) : e, G = (e, s) => {
52
52
  let t = e;
53
- for (const s of r) {
54
- if (t = y(t), t instanceof i.ZodAny)
53
+ for (const a of s) {
54
+ if (t = d(t), t instanceof i.ZodAny)
55
55
  return t;
56
- if (t instanceof i.ZodObject && typeof s == "string" && s in t.shape)
57
- t = t.shape[s];
56
+ if (t instanceof i.ZodObject && typeof a == "string" && a in t.shape)
57
+ t = t.shape[a];
58
58
  else if (t instanceof i.ZodArray)
59
- if (typeof s == "number")
59
+ if (typeof a == "number")
60
60
  t = t.element;
61
- else if (typeof s == "string")
62
- if (t = t.element, t instanceof i.ZodObject && s in t.shape)
63
- t = t.shape[s];
61
+ else if (typeof a == "string")
62
+ if (t = t.element, t instanceof i.ZodObject && a in t.shape)
63
+ t = t.shape[a];
64
64
  else
65
65
  return null;
66
66
  else
@@ -69,209 +69,188 @@ const x = (e, r = []) => {
69
69
  t = t.valueSchema;
70
70
  else
71
71
  return null;
72
- t = y(t);
72
+ t = d(t);
73
73
  }
74
74
  return t;
75
- }, f = (e, r) => {
76
- const t = C(e, r.path);
75
+ }, m = (e, s) => {
76
+ const t = G(e, s.path);
77
77
  if (!t) return null;
78
- const s = r.path.join("."), u = r.path.slice(0, -1).join(".");
79
- if (r.type === "REMOVE")
78
+ const a = s.path.join("."), n = s.path.slice(0, -1).join(".");
79
+ if (s.type === "REMOVE")
80
80
  return {
81
- path: s,
82
- pathMinusOne: u,
81
+ path: a,
82
+ pathMinusOne: n,
83
83
  value: void 0
84
84
  };
85
- const a = R(r.value, t, !1);
86
- return a ? {
87
- path: s,
88
- pathMinusOne: u,
89
- value: a
85
+ const r = R(s.value, t, !1);
86
+ return r ? {
87
+ path: a,
88
+ pathMinusOne: n,
89
+ value: r
90
90
  } : null;
91
- }, K = (e, { activeCollection: r, collectionMutators: t }) => {
92
- if (!r.value) return !1;
91
+ }, K = (e, { activeCollection: s }, { collectionMutators: t }) => {
92
+ if (!s.value) return !1;
93
93
  if (typeof e.path[e.path.length - 1] == "number" && (e.type === "CREATE" || e.type === "REMOVE")) {
94
- const s = f(b, {
94
+ const a = m(b, {
95
95
  ...e,
96
96
  path: e.path
97
97
  });
98
- if (!s) return !1;
99
- const u = [
100
- ...N(r.value, s.pathMinusOne)
98
+ if (!a) return !1;
99
+ const n = [
100
+ ...Z(s.value, a.pathMinusOne)
101
101
  ];
102
- e.type === "CREATE" ? u.push(s.value) : e.type === "REMOVE" && u.pop(), t.edit(
103
- r.value.uid,
104
- s.pathMinusOne,
105
- u
102
+ e.type === "CREATE" ? n.push(a.value) : e.type === "REMOVE" && n.pop(), t.edit(
103
+ s.value.uid,
104
+ a.pathMinusOne,
105
+ n
106
106
  );
107
107
  } else {
108
- const s = f(b, e);
109
- if (!s) return !1;
108
+ const a = m(b, e);
109
+ if (!a) return !1;
110
110
  t.edit(
111
- r.value.uid,
112
- s.path,
113
- s.value
111
+ s.value.uid,
112
+ a.path,
113
+ a.value
114
114
  );
115
115
  }
116
116
  return !0;
117
- }, T = (e, r) => {
118
- const { requests: t, requestExamples: s, requestExampleMutators: u } = r, a = t[e];
119
- a == null || a.examples.forEach((n) => {
120
- const h = j(
121
- a,
122
- s[n].name
117
+ }, T = (e, s) => {
118
+ const { requests: t, requestExamples: a, requestExampleMutators: n } = s, r = t[e];
119
+ r == null || r.examples.forEach((u) => {
120
+ const l = H(
121
+ r,
122
+ a[u].name
123
123
  );
124
- h && u.set({
125
- ...h,
126
- uid: n
124
+ l && n.set({
125
+ ...l,
126
+ uid: u
127
127
  });
128
128
  });
129
- }, L = (e, r) => {
130
- const { activeCollection: t, requests: s, requestMutators: u } = r;
131
- if (!t.value) return !1;
132
- const [, a, n, ...h] = e.path;
133
- if (a === "path" && e.type === "CHANGE")
134
- t.value.requests.forEach((p) => {
135
- s[p].path === e.oldValue && u.edit(p, "path", e.value);
129
+ }, L = (e, { activeCollection: s }, t) => {
130
+ if (!s.value) return !1;
131
+ const { requests: a, requestMutators: n } = t, [, r, u, ...l] = e.path;
132
+ if (r === "path" && e.type === "CHANGE")
133
+ s.value.requests.forEach((p) => {
134
+ a[p].path === e.oldValue && n.edit(p, "path", e.value);
136
135
  });
137
- else if (n === "method" && e.type === "CHANGE")
138
- t.value.requests.forEach((p) => {
139
- s[p].method === e.oldValue && s[p].path === a && u.edit(p, "method", e.value);
136
+ else if (u === "method" && e.type === "CHANGE")
137
+ s.value.requests.forEach((p) => {
138
+ a[p].method === e.oldValue && a[p].path === r && n.edit(p, "method", e.value);
140
139
  });
141
- else if (e.type !== "CHANGE" && typeof h.at(-1) == "number") {
140
+ else if (e.type !== "CHANGE" && typeof l.at(-1) == "number") {
142
141
  const p = v(
143
- t.value.requests,
144
- s,
145
- (c) => c.path === a && c.method === n
146
- ), o = f(O, {
142
+ s.value.requests,
143
+ a,
144
+ (c) => c.path === r && c.method === u
145
+ ), o = m(O, {
147
146
  ...e,
148
147
  path: e.path.slice(3)
149
148
  });
150
149
  if (!p || !o) return !1;
151
- const l = [...N(p, o.pathMinusOne)];
152
- e.type === "CREATE" ? l.push(o.value) : e.type === "REMOVE" && l.pop(), u.edit(p.uid, o.pathMinusOne, l), (e.path[3] === "parameters" || e.path[3] === "requestBody") && T(p.uid, r);
150
+ const h = [...Z(p, o.pathMinusOne)];
151
+ e.type === "CREATE" ? h.push(o.value) : e.type === "REMOVE" && h.pop(), n.edit(p.uid, o.pathMinusOne, h), (e.path[3] === "parameters" || e.path[3] === "requestBody") && T(p.uid, t);
153
152
  } else if (e.type === "CREATE") {
154
- const [[p, o]] = Object.entries(e.value), l = n ? e.value : o, c = n || p, m = V.array().parse(l.servers ?? []), { security: E, ...Z } = l, g = {
155
- ...Z,
153
+ const [[p, o]] = Object.entries(e.value), h = u ? e.value : o, c = u || p, y = V.array().parse(h.servers ?? []), { security: f, ...N } = h, g = {
154
+ ...N,
156
155
  method: D(c) ? c : "get",
157
- path: a,
158
- parameters: l.parameters ?? [],
159
- servers: m.map((d) => d.uid)
156
+ path: r,
157
+ parameters: h.parameters ?? [],
158
+ servers: y.map((E) => E.uid)
160
159
  };
161
- E != null && E.length && (g.security = E.map((d) => {
162
- if (Object.keys(d).length) {
163
- const [q] = Object.keys(d);
160
+ f != null && f.length && (g.security = f.map((E) => {
161
+ if (Object.keys(E).length) {
162
+ const [A] = Object.keys(E);
164
163
  return {
165
- [q]: d[q]
164
+ [A]: E[A]
166
165
  };
167
- } else return d;
166
+ } else return E;
168
167
  }));
169
- const A = R(g, O, !1);
170
- if (!A) return !1;
171
- u.add(A, t.value.uid);
168
+ const q = R(g, O, !1);
169
+ if (!q) return !1;
170
+ n.add(q, s.value.uid);
172
171
  } else if (e.type === "REMOVE") {
173
172
  const p = v(
174
- t.value.requests,
175
- s,
176
- (o) => o.path === a && o.method === n
173
+ s.value.requests,
174
+ a,
175
+ (o) => o.path === r && o.method === u
177
176
  );
178
177
  if (!p) return !1;
179
- u.delete(p, t.value.uid);
178
+ n.delete(p, s.value.uid);
180
179
  } else if (e.type === "CHANGE") {
181
180
  const p = v(
182
- t.value.requests,
183
- s,
184
- (l) => l.path === a && l.method === n
185
- ), o = f(O, { ...e, path: h });
181
+ s.value.requests,
182
+ a,
183
+ (h) => h.path === r && h.method === u
184
+ ), o = m(O, { ...e, path: l });
186
185
  if (!p || !o) return !1;
187
- u.edit(p.uid, o.path, o.value), (e.path[3] === "parameters" || e.path[3] === "requestBody") && T(p.uid, r);
186
+ n.edit(p.uid, o.path, o.value), (e.path[3] === "parameters" || e.path[3] === "requestBody") && T(p.uid, t);
188
187
  }
189
188
  return !0;
190
- }, W = (e, { activeCollection: r, servers: t, serverMutators: s }) => {
191
- if (!r.value) return !1;
192
- const [, u, ...a] = e.path;
193
- if (a != null && a.length) {
194
- const n = r.value.servers[u], h = t[n], p = f(V, { ...e, path: a });
195
- if (!h || !p) return !1;
196
- const l = e.type === "REMOVE" && a[a.length - 1] === "variables" ? {} : p.value;
197
- s.edit(n, p.path, l);
189
+ }, W = (e, { activeCollection: s }, { servers: t, serverMutators: a }) => {
190
+ if (!s.value) return !1;
191
+ const [, n, ...r] = e.path;
192
+ if (r != null && r.length) {
193
+ const u = s.value.servers[n], l = t[u], p = m(V, { ...e, path: r });
194
+ if (!l || !p) return !1;
195
+ const h = e.type === "REMOVE" && r[r.length - 1] === "variables" ? {} : p.value;
196
+ a.edit(u, p.path, h);
198
197
  } else if (e.type === "REMOVE") {
199
- if (!r.value.servers[u]) return !1;
200
- s.delete(
201
- r.value.servers[u],
202
- r.value.uid
198
+ if (!s.value.servers[n]) return !1;
199
+ a.delete(
200
+ s.value.servers[n],
201
+ s.value.uid
203
202
  );
204
203
  } else if (e.type === "CREATE") {
205
- const n = R(e.value, V, !1);
206
- if (!n) return !1;
207
- s.add(n, r.value.uid);
204
+ const u = R(e.value, V, !1);
205
+ if (!u) return !1;
206
+ a.add(u, s.value.uid);
208
207
  }
209
208
  return !0;
210
- }, I = (e, { activeCollection: r, tags: t, tagMutators: s }) => {
211
- if (!r.value) return !1;
212
- const [, u, ...a] = e.path;
213
- if (a != null && a.length) {
214
- const n = r.value.tags[u], h = t[n], p = f(M, { ...e, path: a });
215
- if (!h || !p) return !1;
216
- s.edit(n, p.path, p.value);
209
+ }, I = (e, { activeCollection: s }, { tags: t, tagMutators: a }) => {
210
+ if (!s.value) return !1;
211
+ const [, n, ...r] = e.path;
212
+ if (r != null && r.length) {
213
+ const u = s.value.tags[n], l = t[u], p = m(M, { ...e, path: r });
214
+ if (!l || !p) return !1;
215
+ a.edit(u, p.path, p.value);
217
216
  } else if (e.type === "REMOVE") {
218
- const n = r.value.tags[u], h = t[n];
219
- if (!h) return !1;
220
- s.delete(h, r.value.uid);
217
+ const u = s.value.tags[n], l = t[u];
218
+ if (!l) return !1;
219
+ a.delete(l, s.value.uid);
221
220
  } else if (e.type === "CREATE") {
222
- const n = R(e.value, M, !1);
223
- if (!n) return !1;
224
- s.add(n, r.value.uid);
221
+ const u = R(e.value, M, !1);
222
+ if (!u) return !1;
223
+ a.add(u, s.value.uid);
225
224
  }
226
225
  return !0;
227
- }, w = (e, r, t) => {
228
- const s = y(e);
229
- if (s instanceof i.ZodUnion || s instanceof i.ZodDiscriminatedUnion) {
230
- for (const u of s.options)
231
- if (u instanceof i.ZodObject && r in u.shape && u.shape[r] instanceof i.ZodLiteral && u.shape[r].value === t)
232
- return u;
226
+ }, w = (e, s, t) => {
227
+ const a = d(e);
228
+ if (a instanceof i.ZodUnion || a instanceof i.ZodDiscriminatedUnion) {
229
+ for (const n of a.options)
230
+ if (n instanceof i.ZodObject && s in n.shape && n.shape[s] instanceof i.ZodLiteral && n.shape[s].value === t)
231
+ return n;
233
232
  }
234
233
  return null;
235
- }, J = (e, { activeCollection: r, securitySchemes: t, securitySchemeMutators: s }) => {
236
- var h;
237
- if (!r.value) return !1;
238
- const [, , u, ...a] = e.path, n = t[u] ?? v(
239
- r.value.securitySchemes,
234
+ }, J = (e, { activeCollection: s }, { securitySchemes: t, securitySchemeMutators: a }) => {
235
+ if (!s.value) return !1;
236
+ const [, , n, ...r] = e.path, u = t[n] ?? v(
237
+ s.value.securitySchemes,
240
238
  t,
241
- (p) => p.nameKey === u
239
+ (l) => l.nameKey === n
242
240
  );
243
- if (a != null && a.length) {
244
- if (!n) return !1;
245
- const { schema: p, _path: o } = a[0] === "flows" && n.type === "oauth2" ? {
246
- schema: w(
247
- H,
248
- "type",
249
- (h = n == null ? void 0 : n.flow) == null ? void 0 : h.type
250
- ),
251
- _path: a.slice(2)
252
- } : {
253
- schema: w(
254
- S,
255
- "type",
256
- n == null ? void 0 : n.type
257
- ),
258
- _path: a
259
- };
260
- if (o[0] === "scopes" && n.type === "oauth2") {
261
- const m = { ...n.flow.scopes };
262
- return e.type === "CREATE" || e.type === "CHANGE" ? m[o[1]] = e.value : delete m[o[1]], s.edit(n.uid, "flow.scopes", m), !0;
263
- }
264
- if (!p) return !1;
265
- const l = f(p, { ...e, path: o });
241
+ if (r != null && r.length) {
242
+ const l = w(S, "type", u == null ? void 0 : u.type);
266
243
  if (!l) return !1;
267
- const c = a[0] === "flows" ? ["flow", ...o].join(".") : l.path;
268
- s.edit(n.uid, c, l.value);
244
+ const p = m(l, { ...e, path: r });
245
+ if (!p) return !1;
246
+ const o = p.path;
247
+ a.edit(u.uid, o, p.value);
269
248
  } else if (e.type === "REMOVE") {
270
- if (!n) return !1;
271
- s.delete(n.uid);
272
- } else e.type === "CREATE" && s.add(
249
+ if (!u) return !1;
250
+ a.delete(u.uid);
251
+ } else e.type === "CREATE" && a.add(
273
252
  S.parse(e.value),
274
- r.value.uid
253
+ s.value.uid
275
254
  );
276
255
  return !0;
277
256
  };
@@ -284,6 +263,6 @@ export {
284
263
  W as mutateServerDiff,
285
264
  I as mutateTagDiff,
286
265
  w as narrowUnionSchema,
287
- f as parseDiff,
288
- C as traverseZodSchema
266
+ m as parseDiff,
267
+ G as traverseZodSchema
289
268
  };
@@ -1,13 +1,9 @@
1
1
  import type { ErrorResponse } from '../../../libs/index.js';
2
- import type { SecuritySchemeExampleValue, SecuritySchemeOauth2, SecuritySchemeOauth2ExampleValue, Server } from '@scalar/oas-utils/entities/spec';
2
+ import type { Oauth2Flow, Server } from '@scalar/oas-utils/entities/spec';
3
3
  /** Oauth2 security schemes which are not implicit */
4
- type SecuritySchemeOauth2NonImplicit = Omit<SecuritySchemeOauth2, 'flow'> & {
5
- flow: Exclude<SecuritySchemeOauth2['flow'], {
6
- type: 'implicit';
7
- }>;
8
- };
9
- /** Type guard to check for oauth2 example */
10
- export declare const isOauth2Example: (example: SecuritySchemeExampleValue) => example is SecuritySchemeOauth2ExampleValue;
4
+ type NonImplicitFlow = Exclude<Oauth2Flow, {
5
+ type: 'implicit';
6
+ }>;
11
7
  type PKCEState = {
12
8
  codeVerifier: string;
13
9
  codeChallenge: string;
@@ -22,11 +18,11 @@ export declare const generateCodeChallenge: (verifier: string, encoding: "SHA-25
22
18
  *
23
19
  * @returns the accessToken
24
20
  */
25
- export declare const authorizeOauth2: (scheme: SecuritySchemeOauth2, example: SecuritySchemeOauth2ExampleValue, activeServer: Server) => Promise<ErrorResponse<string>>;
21
+ export declare const authorizeOauth2: (flow: Oauth2Flow, activeServer: Server) => Promise<ErrorResponse<string>>;
26
22
  /**
27
23
  * Makes the BE authorization call to grab the token server to server
28
24
  * Used for clientCredentials and authorizationCode
29
25
  */
30
- export declare const authorizeServers: (scheme: SecuritySchemeOauth2NonImplicit, example: SecuritySchemeOauth2ExampleValue, scopes: string, code?: string, pkce?: PKCEState | null) => Promise<ErrorResponse<string>>;
26
+ export declare const authorizeServers: (flow: NonImplicitFlow, scopes: string, code?: string, pkce?: PKCEState | null) => Promise<ErrorResponse<string>>;
31
27
  export {};
32
28
  //# sourceMappingURL=oauth2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauth2.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/libs/oauth2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,KAAK,EACV,0BAA0B,EAC1B,oBAAoB,EACpB,gCAAgC,EAChC,MAAM,EACP,MAAM,iCAAiC,CAAA;AAExC,qDAAqD;AACrD,KAAK,+BAA+B,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,GAAG;IAC1E,IAAI,EAAE,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAA;CAClE,CAAA;AAED,6CAA6C;AAC7C,eAAO,MAAM,eAAe,YACjB,0BAA0B,KAClC,OAAO,IAAI,gCACoB,CAAA;AAElC,KAAK,SAAS,GAAG;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAA;AAmBD;;GAEG;AACH,eAAO,MAAM,qBAAqB,aACtB,MAAM,YACN,SAAS,GAAG,OAAO,KAC5B,OAAO,CAAC,MAAM,CAahB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,WAClB,oBAAoB,WACnB,gCAAgC,gBAE3B,MAAM,KACnB,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CA8J/B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,WACnB,+BAA+B,WAC9B,gCAAgC,UACjC,MAAM,SACP,MAAM,SACN,SAAS,GAAG,IAAI,KACtB,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAgE/B,CAAA"}
1
+ {"version":3,"file":"oauth2.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/libs/oauth2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,KAAK,EACV,UAAU,EAEV,MAAM,EACP,MAAM,iCAAiC,CAAA;AAExC,qDAAqD;AACrD,KAAK,eAAe,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,CAAA;AAEhE,KAAK,SAAS,GAAG;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAA;AAmBD;;GAEG;AACH,eAAO,MAAM,qBAAqB,aACtB,MAAM,YACN,SAAS,GAAG,OAAO,KAC5B,OAAO,CAAC,MAAM,CAahB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,SACpB,UAAU,gBAEF,MAAM,KACnB,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAqJ/B,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,SACrB,eAAe,UACb,MAAM,SACP,MAAM,SACN,SAAS,GAAG,IAAI,KACtB,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAwD/B,CAAA"}