@scalar/api-client 2.2.22 → 2.2.23

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 (124) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/components/AddressBar/AddressBar.vue.d.ts.map +1 -1
  3. package/dist/components/AddressBar/AddressBar.vue.js +2 -2
  4. package/dist/components/AddressBar/AddressBar.vue2.js +69 -70
  5. package/dist/components/AddressBar/AddressBarServer.vue.js +26 -26
  6. package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
  7. package/dist/components/CodeInput/CodeInput.vue.js +2 -2
  8. package/dist/components/CodeInput/CodeInput.vue2.js +46 -46
  9. package/dist/components/CodeInput/codeVariableWidget.d.ts +4 -4
  10. package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -1
  11. package/dist/components/CodeInput/codeVariableWidget.js +42 -38
  12. package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +25 -24
  13. package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts +1 -1
  14. package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts.map +1 -1
  15. package/dist/components/CommandPalette/CommandPaletteExample.vue.js +64 -55
  16. package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
  17. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +110 -106
  18. package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +2 -2
  19. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +1 -1
  20. package/dist/components/CommandPalette/TheCommandPalette.vue.js +1 -1
  21. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +38 -37
  22. package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.d.ts.map +1 -1
  23. package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +52 -49
  24. package/dist/components/ImportCollection/DropEventListener.vue.d.ts.map +1 -1
  25. package/dist/components/ImportCollection/DropEventListener.vue.js +46 -43
  26. package/dist/components/ImportCollection/ImportCollectionModal.vue.js +40 -39
  27. package/dist/components/ImportCollection/ImportNowButton.vue.js +44 -42
  28. package/dist/components/ImportCollection/WorkspaceSelector.vue.js +76 -69
  29. package/dist/components/ScalarAsciiArt.vue.js +1 -1
  30. package/dist/components/ScalarAsciiArt.vue2.js +22 -19
  31. package/dist/components/Search/useSearch.d.ts.map +1 -1
  32. package/dist/components/Search/useSearch.js +57 -49
  33. package/dist/components/SideNav/SideNavRouterLink.vue.d.ts.map +1 -1
  34. package/dist/components/SideNav/SideNavRouterLink.vue.js +22 -19
  35. package/dist/components/Sidebar/SidebarListElement.vue.d.ts.map +1 -1
  36. package/dist/components/Sidebar/SidebarListElement.vue.js +2 -2
  37. package/dist/components/Sidebar/SidebarListElement.vue2.js +38 -36
  38. package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
  39. package/dist/components/TopNav/TopNav.vue.js +71 -64
  40. package/dist/layouts/App/ApiClientApp.vue.js +4 -1
  41. package/dist/layouts/Modal/ApiClientModal.vue.js +2 -2
  42. package/dist/layouts/Modal/ApiClientModal.vue2.js +22 -19
  43. package/dist/layouts/Web/ApiClientWeb.vue.js +4 -1
  44. package/dist/libs/create-client.d.ts +10 -10
  45. package/dist/libs/create-client.d.ts.map +1 -1
  46. package/dist/libs/create-client.js +42 -36
  47. package/dist/libs/extractAttachmentFilename.d.ts +3 -0
  48. package/dist/libs/extractAttachmentFilename.d.ts.map +1 -1
  49. package/dist/libs/extractAttachmentFilename.js +7 -7
  50. package/dist/libs/importers/curl.d.ts.map +1 -1
  51. package/dist/libs/importers/curl.js +18 -18
  52. package/dist/libs/normalize-headers.d.ts.map +1 -1
  53. package/dist/libs/normalize-headers.js +2 -2
  54. package/dist/libs/parse-curl.js +39 -36
  55. package/dist/store/active-entities.d.ts +4 -4
  56. package/dist/store/active-entities.d.ts.map +1 -1
  57. package/dist/store/active-entities.js +88 -86
  58. package/dist/store/collections.d.ts.map +1 -1
  59. package/dist/store/collections.js +29 -29
  60. package/dist/store/request-example.d.ts.map +1 -1
  61. package/dist/store/request-example.js +27 -23
  62. package/dist/store/requests.d.ts.map +1 -1
  63. package/dist/store/requests.js +94 -77
  64. package/dist/store/security-schemes.d.ts.map +1 -1
  65. package/dist/store/security-schemes.js +27 -27
  66. package/dist/store/servers.d.ts.map +1 -1
  67. package/dist/store/servers.js +18 -18
  68. package/dist/store/tags.d.ts.map +1 -1
  69. package/dist/store/tags.js +35 -33
  70. package/dist/style.css +1 -1
  71. package/dist/views/Cookies/CookieForm.vue.d.ts.map +1 -1
  72. package/dist/views/Cookies/CookieForm.vue.js +14 -9
  73. package/dist/views/Cookies/Cookies.vue.d.ts.map +1 -1
  74. package/dist/views/Cookies/Cookies.vue2.js +39 -37
  75. package/dist/views/Environment/Environment.vue.d.ts.map +1 -1
  76. package/dist/views/Environment/Environment.vue2.js +94 -89
  77. package/dist/views/Request/Request.vue.d.ts.map +1 -1
  78. package/dist/views/Request/Request.vue.js +1 -1
  79. package/dist/views/Request/Request.vue2.js +121 -119
  80. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
  81. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +28 -25
  82. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
  83. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +1 -1
  84. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +38 -37
  85. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts.map +1 -1
  86. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.js +2 -2
  87. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue2.js +76 -73
  88. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.js +2 -2
  89. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue2.js +80 -80
  90. package/dist/views/Request/RequestSection/RequestBody.vue.d.ts.map +1 -1
  91. package/dist/views/Request/RequestSection/RequestBody.vue.js +1 -1
  92. package/dist/views/Request/RequestSection/RequestBody.vue2.js +192 -178
  93. package/dist/views/Request/RequestSection/RequestParams.vue.d.ts.map +1 -1
  94. package/dist/views/Request/RequestSection/RequestParams.vue.js +80 -73
  95. package/dist/views/Request/RequestSection/RequestPathParams.vue.d.ts.map +1 -1
  96. package/dist/views/Request/RequestSection/RequestPathParams.vue.js +50 -48
  97. package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
  98. package/dist/views/Request/RequestSidebar.vue.js +1 -1
  99. package/dist/views/Request/RequestSidebar.vue2.js +149 -144
  100. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  101. package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
  102. package/dist/views/Request/RequestSidebarItem.vue2.js +168 -150
  103. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
  104. package/dist/views/Request/RequestSidebarItemMenu.vue.js +4 -4
  105. package/dist/views/Request/RequestSidebarItemMenu.vue2.js +80 -80
  106. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  107. package/dist/views/Request/ResponseSection/ResponseSection.vue.js +1 -1
  108. package/dist/views/Request/ResponseSection/ResponseSection.vue2.js +1 -1
  109. package/dist/views/Request/components/WorkspaceDropdown.vue.d.ts.map +1 -1
  110. package/dist/views/Request/components/WorkspaceDropdown.vue.js +166 -156
  111. package/dist/views/Request/handle-drag.d.ts.map +1 -1
  112. package/dist/views/Request/handle-drag.js +37 -31
  113. package/dist/views/Request/hooks/useOpenApiWatcher.js +27 -27
  114. package/dist/views/Request/libs/live-sync.d.ts.map +1 -1
  115. package/dist/views/Request/libs/live-sync.js +147 -130
  116. package/dist/views/Request/types/sidebar-item.d.ts +4 -1
  117. package/dist/views/Request/types/sidebar-item.d.ts.map +1 -1
  118. package/dist/views/Servers/ServerForm.vue.js +38 -35
  119. package/dist/views/Servers/Servers.vue2.js +38 -35
  120. package/dist/views/Settings/Settings.vue.d.ts.map +1 -1
  121. package/dist/views/Settings/Settings.vue2.js +15 -15
  122. package/dist/views/Settings/SettingsGeneral.vue.d.ts.map +1 -1
  123. package/dist/views/Settings/SettingsGeneral.vue.js +206 -174
  124. package/package.json +8 -8
@@ -1,53 +1,57 @@
1
- import { collectionSchema as b, requestSchema as O, serverSchema as V, tagSchema as M, securitySchemeSchema as S, createExampleFromRequest as D } from "@scalar/oas-utils/entities/spec";
2
- import { isHttpMethod as H, schemaModel as R } from "@scalar/oas-utils/helpers";
1
+ import { collectionSchema as M, requestSchema as V, serverSchema as q, tagSchema as S, securitySchemeSchema as Z, createExampleFromRequest as H } from "@scalar/oas-utils/entities/spec";
2
+ import { isHttpMethod as j, schemaModel as R } from "@scalar/oas-utils/helpers";
3
3
  import { getNestedValue as N } from "@scalar/object-utils/nested";
4
- import j from "microdiff";
4
+ import x from "microdiff";
5
5
  import { z as i } from "zod";
6
- const x = (e, s = []) => {
6
+ const G = (e, s = []) => {
7
7
  const t = [];
8
8
  let a = !1;
9
- for (let r = 0; r < e.length; r++) {
9
+ for (let u = 0; u < e.length; u++) {
10
10
  if (a) {
11
11
  a = !1;
12
12
  continue;
13
13
  }
14
- const n = e[r], u = e[r + 1];
15
- if (s.length)
16
- n.path = [...s, ...n.path], u && (u.path = [...s, ...u.path]);
17
- else if (n.path[0] !== "paths") {
18
- t.push(n);
19
- continue;
20
- }
21
- if (n.type === "REMOVE" && (u == null ? void 0 : u.type) === "CREATE") {
22
- const [, l, p] = n.path, [, o, h] = u.path, c = ["paths", o];
23
- if (l !== o && t.push({
24
- type: "CHANGE",
25
- path: ["paths", "path"],
26
- oldValue: l,
27
- value: o
28
- }), p && h && p !== h && (t.push({
29
- type: "CHANGE",
30
- path: ["paths", o, "method"],
31
- oldValue: p,
32
- value: h
33
- }), c.push(h)), s.length === 0) {
34
- const y = j(n.oldValue, u.value);
35
- if (y.length) {
36
- const E = x(y, c);
37
- t.push(...E);
38
- }
14
+ const r = e[u], n = e[u + 1];
15
+ if (r) {
16
+ if (s.length)
17
+ r.path = [...s, ...r.path], n && (n.path = [...s, ...n.path]);
18
+ else if (r.path[0] !== "paths") {
19
+ t.push(r);
20
+ continue;
39
21
  }
40
- a = !0;
41
- } else n.type === "CREATE" && n.path.length > 3 && typeof n.path.at(-1) != "number" ? t.push({ ...n, type: "CHANGE", oldValue: void 0 }) : n.type === "REMOVE" && n.path.length > 3 && typeof n.path.at(-1) != "number" ? t.push({ ...n, type: "CHANGE", value: void 0 }) : t.push(n);
22
+ if (r.type === "REMOVE" && (n == null ? void 0 : n.type) === "CREATE") {
23
+ const [, l, p] = r.path, [, o, h] = n.path, c = ["paths", o].filter(
24
+ (f) => typeof f == "string"
25
+ );
26
+ if (l !== o && t.push({
27
+ type: "CHANGE",
28
+ path: ["paths", "path"],
29
+ oldValue: l,
30
+ value: o
31
+ }), p && typeof h == "string" && p !== h && o && (t.push({
32
+ type: "CHANGE",
33
+ path: ["paths", o, "method"],
34
+ oldValue: p,
35
+ value: h
36
+ }), c.push(h)), s.length === 0) {
37
+ const f = x(r.oldValue, n.value);
38
+ if (f.length) {
39
+ const g = G(f, c);
40
+ t.push(...g);
41
+ }
42
+ }
43
+ a = !0;
44
+ } 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);
45
+ }
42
46
  }
43
47
  return t;
44
48
  }, v = (e, s, t) => {
45
49
  for (const a of e) {
46
- const r = s[a];
47
- if (t(r)) return r;
50
+ const u = s[a];
51
+ if (u && t(u)) return u;
48
52
  }
49
53
  return null;
50
- }, d = (e) => e instanceof i.ZodOptional ? d(e.unwrap()) : e instanceof i.ZodDefault ? d(e._def.innerType) : e, G = (e, s) => {
54
+ }, d = (e) => e instanceof i.ZodOptional ? d(e.unwrap()) : e instanceof i.ZodDefault ? d(e._def.innerType) : e, w = (e, s) => {
51
55
  let t = e;
52
56
  for (const a of s) {
53
57
  if (t = d(t), t instanceof i.ZodAny)
@@ -71,40 +75,40 @@ const x = (e, s = []) => {
71
75
  t = d(t);
72
76
  }
73
77
  return t;
74
- }, m = (e, s) => {
75
- const t = G(e, s.path);
78
+ }, E = (e, s) => {
79
+ const t = w(e, s.path);
76
80
  if (!t) return null;
77
- const a = s.path.join("."), r = s.path.slice(0, -1).join(".");
81
+ const a = s.path.join("."), u = s.path.slice(0, -1).join(".");
78
82
  if (s.type === "REMOVE")
79
83
  return {
80
84
  path: a,
81
- pathMinusOne: r,
85
+ pathMinusOne: u,
82
86
  value: void 0
83
87
  };
84
- const n = R(s.value, t, !1);
85
- return n ? {
88
+ const r = R(s.value, t, !1);
89
+ return r ? {
86
90
  path: a,
87
- pathMinusOne: r,
88
- value: n
91
+ pathMinusOne: u,
92
+ value: r
89
93
  } : null;
90
- }, K = (e, { activeCollection: s }, { collectionMutators: t }) => {
94
+ }, L = (e, { activeCollection: s }, { collectionMutators: t }) => {
91
95
  if (!s.value) return !1;
92
96
  if (typeof e.path[e.path.length - 1] == "number" && (e.type === "CREATE" || e.type === "REMOVE")) {
93
- const a = m(b, {
97
+ const a = E(M, {
94
98
  ...e,
95
99
  path: e.path
96
100
  });
97
101
  if (!a) return !1;
98
- const r = [
102
+ const u = [
99
103
  ...N(s.value, a.pathMinusOne)
100
104
  ];
101
- e.type === "CREATE" ? r.push(a.value) : e.type === "REMOVE" && r.pop(), t.edit(
105
+ e.type === "CREATE" ? u.push(a.value) : e.type === "REMOVE" && u.pop(), t.edit(
102
106
  s.value.uid,
103
107
  a.pathMinusOne,
104
- r
108
+ u
105
109
  );
106
110
  } else {
107
- const a = m(b, e);
111
+ const a = E(M, e);
108
112
  if (!a) return !1;
109
113
  t.edit(
110
114
  s.value.uid,
@@ -113,155 +117,168 @@ const x = (e, s = []) => {
113
117
  );
114
118
  }
115
119
  return !0;
116
- }, Z = (e, s) => {
117
- const { requests: t, requestExamples: a, requestExampleMutators: r } = s, n = t[e];
118
- n == null || n.examples.forEach((u) => {
119
- const l = D(
120
- n,
121
- a[u].name
120
+ }, D = (e, s) => {
121
+ const { requests: t, requestExamples: a, requestExampleMutators: u } = s, r = t[e];
122
+ r == null || r.examples.forEach((n) => {
123
+ var p;
124
+ const l = H(
125
+ r,
126
+ ((p = a[n]) == null ? void 0 : p.name) ?? "Default"
122
127
  );
123
- l && r.set({
128
+ l && u.set({
124
129
  ...l,
125
- uid: u
130
+ uid: n
126
131
  });
127
132
  });
128
- }, L = (e, { activeCollection: s }, t) => {
133
+ }, P = (e, { activeCollection: s }, t) => {
129
134
  if (!s.value) return !1;
130
- const { requests: a, requestMutators: r } = t, [, n, u, ...l] = e.path;
131
- if (n === "path" && e.type === "CHANGE")
135
+ const { requests: a, requestMutators: u } = t, [, r, n, ...l] = e.path;
136
+ if (r === "path" && e.type === "CHANGE")
132
137
  s.value.requests.forEach((p) => {
133
- a[p].path === e.oldValue && r.edit(p, "path", e.value);
138
+ var o;
139
+ ((o = a[p]) == null ? void 0 : o.path) === e.oldValue && u.edit(p, "path", e.value);
134
140
  });
135
- else if (u === "method" && e.type === "CHANGE")
141
+ else if (n === "method" && e.type === "CHANGE")
136
142
  s.value.requests.forEach((p) => {
137
- a[p].method === e.oldValue && a[p].path === n && r.edit(p, "method", e.value);
143
+ var o, h;
144
+ ((o = a[p]) == null ? void 0 : o.method) === e.oldValue && ((h = a[p]) == null ? void 0 : h.path) === r && u.edit(p, "method", e.value);
138
145
  });
139
146
  else if (e.type !== "CHANGE" && typeof l.at(-1) == "number") {
140
147
  const p = v(
141
148
  s.value.requests,
142
149
  a,
143
- (c) => c.path === n && c.method === u
144
- ), o = m(O, {
150
+ (c) => c.path === r && c.method === n
151
+ ), o = E(V, {
145
152
  ...e,
146
153
  path: e.path.slice(3)
147
154
  });
148
155
  if (!p || !o) return !1;
149
156
  const h = [...N(p, o.pathMinusOne)];
150
- 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") && Z(p.uid, t);
157
+ e.type === "CREATE" ? h.push(o.value) : e.type === "REMOVE" && h.pop(), u.edit(p.uid, o.pathMinusOne, h), (e.path[3] === "parameters" || e.path[3] === "requestBody") && D(p.uid, t);
151
158
  } else if (e.type === "CREATE") {
152
- const [[p, o]] = Object.entries(e.value), h = u ? e.value : o, c = u || p, y = V.array().parse(h.servers ?? []), { security: E, ...T } = h, g = {
159
+ const [p] = Object.entries(e.value ?? {}), [o, h] = p ?? [], c = n ? e.value : h, f = n || o, g = q.array().parse(c.servers ?? []), { security: y, ...T } = c, A = {
153
160
  ...T,
154
- method: H(c) ? c : "get",
155
- path: n,
156
- parameters: h.parameters ?? [],
157
- servers: y.map((f) => f.uid)
161
+ method: j(f) ? f : "get",
162
+ path: r,
163
+ parameters: c.parameters ?? [],
164
+ servers: g.map((m) => m.uid)
158
165
  };
159
- E != null && E.length && (g.security = E.map((f) => {
160
- if (Object.keys(f).length) {
161
- const [A] = Object.keys(f);
162
- return {
163
- [A]: f[A]
164
- };
165
- } else return f;
166
+ y != null && y.length && (A.security = y.map((m) => {
167
+ if (Object.keys(m).length) {
168
+ const [O] = Object.keys(m);
169
+ return O ? {
170
+ [O]: m[O]
171
+ } : m;
172
+ } else return m;
166
173
  }));
167
- const q = R(g, O, !1);
168
- if (!q) return !1;
169
- r.add(q, s.value.uid);
174
+ const b = R(A, V, !1);
175
+ if (!b) return !1;
176
+ u.add(b, s.value.uid);
170
177
  } else if (e.type === "REMOVE") {
171
178
  const p = v(
172
179
  s.value.requests,
173
180
  a,
174
- (o) => o.path === n && o.method === u
181
+ (o) => o.path === r && o.method === n
175
182
  );
176
183
  if (!p) return !1;
177
- r.delete(p, s.value.uid);
184
+ u.delete(p, s.value.uid);
178
185
  } else if (e.type === "CHANGE") {
179
186
  const p = v(
180
187
  s.value.requests,
181
188
  a,
182
- (h) => h.path === n && h.method === u
183
- ), o = m(O, { ...e, path: l });
189
+ (h) => h.path === r && h.method === n
190
+ ), o = E(V, { ...e, path: l });
184
191
  if (!p || !o) return !1;
185
- r.edit(p.uid, o.path, o.value), (e.path[3] === "parameters" || e.path[3] === "requestBody") && Z(p.uid, t);
192
+ u.edit(p.uid, o.path, o.value), (e.path[3] === "parameters" || e.path[3] === "requestBody") && D(p.uid, t);
186
193
  }
187
194
  return !0;
188
- }, P = (e, { activeCollection: s }, { servers: t, serverMutators: a }) => {
195
+ }, W = (e, { activeCollection: s }, { servers: t, serverMutators: a }) => {
189
196
  if (!s.value) return !1;
190
- const [, r, ...n] = e.path;
191
- if (n != null && n.length) {
192
- const u = s.value.servers[r], l = t[u], p = m(V, { ...e, path: n });
197
+ const [, u, ...r] = e.path;
198
+ if (r != null && r.length) {
199
+ const n = s.value.servers[u];
200
+ if (!n) return !1;
201
+ const l = t[n], p = E(q, { ...e, path: r });
193
202
  if (!l || !p) return !1;
194
- const h = e.type === "REMOVE" && n[n.length - 1] === "variables" ? {} : p.value;
195
- a.edit(u, p.path, h);
203
+ const h = e.type === "REMOVE" && r[r.length - 1] === "variables" ? {} : p.value;
204
+ a.edit(n, p.path, h);
196
205
  } else if (e.type === "REMOVE") {
197
- if (!s.value.servers[r]) return !1;
206
+ if (!s.value.servers[u]) return !1;
198
207
  a.delete(
199
- s.value.servers[r],
208
+ s.value.servers[u],
200
209
  s.value.uid
201
210
  );
202
211
  } else if (e.type === "CREATE") {
203
- const u = R(e.value, V, !1);
204
- if (!u) return !1;
205
- a.add(u, s.value.uid);
212
+ const n = R(e.value, q, !1);
213
+ if (!n) return !1;
214
+ a.add(n, s.value.uid);
206
215
  }
207
216
  return !0;
208
- }, W = (e, { activeCollection: s }, { tags: t, tagMutators: a }) => {
217
+ }, I = (e, { activeCollection: s }, { tags: t, tagMutators: a }) => {
209
218
  if (!s.value) return !1;
210
- const [, r, ...n] = e.path;
211
- if (n != null && n.length) {
212
- const u = s.value.tags[r], l = t[u], p = m(M, { ...e, path: n });
219
+ const [, u, ...r] = e.path;
220
+ if (r != null && r.length) {
221
+ const n = s.value.tags[u];
222
+ if (!n) return !1;
223
+ const l = t[n], p = E(S, { ...e, path: r });
213
224
  if (!l || !p) return !1;
214
- a.edit(u, p.path, p.value);
225
+ a.edit(n, p.path, p.value);
215
226
  } else if (e.type === "REMOVE") {
216
- const u = s.value.tags[r], l = t[u];
227
+ const n = s.value.tags[u];
228
+ if (!n) return !1;
229
+ const l = t[n];
217
230
  if (!l) return !1;
218
231
  a.delete(l, s.value.uid);
219
232
  } else if (e.type === "CREATE") {
220
- const u = R(e.value, M, !1);
221
- if (!u) return !1;
222
- a.add(u, s.value.uid);
233
+ const n = R(e.value, S, !1);
234
+ if (!n) return !1;
235
+ a.add(n, s.value.uid);
223
236
  }
224
237
  return !0;
225
- }, w = (e, s, t) => {
238
+ }, U = (e, s, t) => {
226
239
  const a = d(e);
227
240
  if (a instanceof i.ZodUnion || a instanceof i.ZodDiscriminatedUnion) {
228
- for (const r of a.options)
229
- if (r instanceof i.ZodObject && s in r.shape && r.shape[s] instanceof i.ZodLiteral && r.shape[s].value === t)
230
- return r;
241
+ for (const u of a.options)
242
+ if (u instanceof i.ZodObject && s in u.shape && u.shape[s] instanceof i.ZodLiteral && u.shape[s].value === t)
243
+ return u;
231
244
  }
232
245
  return null;
233
- }, I = (e, { activeCollection: s }, { securitySchemes: t, securitySchemeMutators: a }) => {
246
+ }, J = (e, { activeCollection: s }, { securitySchemes: t, securitySchemeMutators: a }) => {
234
247
  if (!s.value) return !1;
235
- const [, , r, ...n] = e.path, u = t[r] ?? v(
248
+ const [, , u, ...r] = e.path, n = t[u] ?? v(
236
249
  s.value.securitySchemes,
237
250
  t,
238
- (l) => l.nameKey === r
251
+ (l) => l.nameKey === u
239
252
  );
240
- if (n != null && n.length) {
241
- const l = w(S, "type", u == null ? void 0 : u.type);
242
- if (!l) return !1;
243
- const p = m(l, { ...e, path: n });
253
+ if (r != null && r.length) {
254
+ const l = U(
255
+ Z,
256
+ "type",
257
+ (n == null ? void 0 : n.type) ?? ""
258
+ );
259
+ if (!l || !n) return !1;
260
+ const p = E(l, { ...e, path: r });
244
261
  if (!p) return !1;
245
262
  const o = p.path;
246
- a.edit(u.uid, o, p.value);
263
+ a.edit(n.uid, o, p.value);
247
264
  } else if (e.type === "REMOVE") {
248
- if (!u) return !1;
249
- a.delete(u.uid);
265
+ if (!n) return !1;
266
+ a.delete(n.uid);
250
267
  } else e.type === "CREATE" && a.add(
251
- S.parse(e.value),
268
+ Z.parse(e.value),
252
269
  s.value.uid
253
270
  );
254
271
  return !0;
255
272
  };
256
273
  export {
257
- x as combineRenameDiffs,
274
+ G as combineRenameDiffs,
258
275
  v as findResource,
259
- K as mutateCollectionDiff,
260
- L as mutateRequestDiff,
261
- I as mutateSecuritySchemeDiff,
262
- P as mutateServerDiff,
263
- W as mutateTagDiff,
264
- w as narrowUnionSchema,
265
- m as parseDiff,
266
- G as traverseZodSchema
276
+ L as mutateCollectionDiff,
277
+ P as mutateRequestDiff,
278
+ J as mutateSecuritySchemeDiff,
279
+ W as mutateServerDiff,
280
+ I as mutateTagDiff,
281
+ U as narrowUnionSchema,
282
+ E as parseDiff,
283
+ w as traverseZodSchema
267
284
  };
@@ -2,7 +2,10 @@ import type { Collection, Request, RequestExample, RequestMethod, Tag } from '@s
2
2
  import type { RouteLocationRaw } from 'vue-router';
3
3
  export type SidebarItem = {
4
4
  title: string;
5
- entity: Collection | Tag | Request | RequestExample;
5
+ entity: Collection | Tag | Request | RequestExample | {
6
+ type: 'unknown';
7
+ uid: string;
8
+ };
6
9
  resourceTitle: string;
7
10
  children: string[];
8
11
  method?: RequestMethod;
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar-item.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/types/sidebar-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,aAAa,EACb,GAAG,EACJ,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,UAAU,GAAG,GAAG,GAAG,OAAO,GAAG,cAAc,CAAA;IACnD,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,qDAAqD;IACrD,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,iBAAiB,CAAA;IAC7B,8CAA8C;IAC9C,IAAI,EAAE,OAAO,CAAA;CACd,CAAA"}
1
+ {"version":3,"file":"sidebar-item.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/types/sidebar-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,aAAa,EACb,GAAG,EACJ,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EACF,UAAU,GACV,GAAG,GACH,OAAO,GACP,cAAc,GACd;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IACpC,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,qDAAqD;IACrD,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,iBAAiB,CAAA;IAC7B,8CAA8C;IAC9C,IAAI,EAAE,OAAO,CAAA;CACd,CAAA"}
@@ -1,68 +1,71 @@
1
- import { defineComponent as S, computed as l, openBlock as n, createElementBlock as d, Fragment as b, createVNode as g, createBlock as y, createCommentVNode as p } from "vue";
1
+ import { defineComponent as b, computed as l, openBlock as u, createElementBlock as p, Fragment as g, createVNode as y, createBlock as O, createCommentVNode as v } from "vue";
2
2
  import m from "../../components/Form/Form.vue.js";
3
- import { useActiveEntities as O } from "../../store/active-entities.js";
4
- import { useRoute as V } from "vue-router";
5
- import { useWorkspace as j } from "../../store/store.js";
6
- const B = { class: "w-full" }, N = /* @__PURE__ */ S({
3
+ import { useActiveEntities as V } from "../../store/active-entities.js";
4
+ import { useRoute as j } from "vue-router";
5
+ import { useWorkspace as B } from "../../store/store.js";
6
+ const C = { class: "w-full" }, R = /* @__PURE__ */ b({
7
7
  __name: "ServerForm",
8
- setup(C) {
9
- const { activeCollection: a } = O(), { servers: v, serverMutators: u } = j(), f = [
8
+ setup(U) {
9
+ const { activeCollection: s } = V(), { servers: f, serverMutators: n } = B(), _ = [
10
10
  { label: "URL", key: "url", placeholder: "https://void.scalar.com/api" },
11
11
  {
12
12
  label: "Label",
13
13
  key: "description",
14
14
  placeholder: "Production"
15
15
  }
16
- ], c = V(), o = l(
16
+ ], c = j(), r = l(
17
17
  () => {
18
18
  var e, t;
19
- return v[a.value && c.params.server === "default" ? (e = a.value) == null ? void 0 : e.servers[0] : ((t = a.value) == null ? void 0 : t.servers.find(
20
- (r) => r === c.params.server
19
+ return f[(s.value && c.params.server === "default" ? (e = s.value) == null ? void 0 : e.servers[0] : (t = s.value) == null ? void 0 : t.servers.find(
20
+ (o) => o === c.params.server
21
21
  )) ?? ""];
22
22
  }
23
- ), _ = (e, t) => {
24
- a.value && u.edit(o.value.uid, e, t);
25
- }, k = (e, t) => {
26
- a.value && u.edit(o.value.uid, `variables.${e}.value`, t);
27
- }, h = l(
23
+ ), k = (e, t) => {
24
+ !s.value || !r.value || n.edit(r.value.uid, e, t);
25
+ }, h = (e, t) => {
26
+ !s.value || !r.value || n.edit(r.value.uid, `variables.${e}.value`, t);
27
+ }, S = l(
28
28
  () => {
29
29
  var e;
30
- return Object.entries(((e = o.value) == null ? void 0 : e.variables) ?? {}).map(
31
- ([t, r]) => {
32
- var s;
30
+ return Object.entries(((e = r.value) == null ? void 0 : e.variables) ?? {}).map(
31
+ ([t, o]) => {
32
+ var a;
33
33
  return {
34
34
  key: t,
35
35
  label: t,
36
- placeholder: (r.default ?? ((s = r == null ? void 0 : r.enum) == null ? void 0 : s[0]) ?? "").toString()
36
+ placeholder: (o.default ?? ((a = o == null ? void 0 : o.enum) == null ? void 0 : a[0]) ?? "").toString()
37
37
  };
38
38
  }
39
39
  );
40
40
  }
41
41
  ), i = l(
42
- () => Object.entries(o.value.variables ?? {}).reduce((e, [t, r]) => {
43
- var s;
44
- return e[t] = (r.default ?? ((s = r == null ? void 0 : r.enum) == null ? void 0 : s[0]) ?? "").toString(), e;
45
- }, {})
42
+ () => {
43
+ var e;
44
+ return Object.entries(((e = r.value) == null ? void 0 : e.variables) ?? {}).reduce((t, [o, a]) => {
45
+ var d;
46
+ return t[o] = (a.default ?? ((d = a == null ? void 0 : a.enum) == null ? void 0 : d[0]) ?? "").toString(), t;
47
+ }, {});
48
+ }
46
49
  );
47
- return (e, t) => (n(), d("div", B, [
48
- o.value ? (n(), d(b, { key: 0 }, [
49
- g(m, {
50
- data: o.value,
51
- onUpdate: _,
52
- options: f,
50
+ return (e, t) => (u(), p("div", C, [
51
+ r.value ? (u(), p(g, { key: 0 }, [
52
+ y(m, {
53
+ data: r.value,
54
+ onUpdate: k,
55
+ options: _,
53
56
  title: "Server"
54
57
  }, null, 8, ["data"]),
55
- Object.keys(i.value).length ? (n(), y(m, {
58
+ Object.keys(i.value).length ? (u(), O(m, {
56
59
  key: 0,
57
60
  data: i.value,
58
- onUpdate: k,
59
- options: h.value,
61
+ onUpdate: h,
62
+ options: S.value,
60
63
  title: "Variables"
61
- }, null, 8, ["data", "options"])) : p("", !0)
62
- ], 64)) : p("", !0)
64
+ }, null, 8, ["data", "options"])) : v("", !0)
65
+ ], 64)) : v("", !0)
63
66
  ]));
64
67
  }
65
68
  });
66
69
  export {
67
- N as default
70
+ R as default
68
71
  };
@@ -1,46 +1,49 @@
1
- import { defineComponent as d, openBlock as a, createBlock as m, withCtx as e, createVNode as r, unref as n, createElementVNode as v, createElementBlock as _, Fragment as S, renderList as x, createTextVNode as b } from "vue";
2
- import k from "../../components/Sidebar/SidebarButton.vue.js";
3
- import h from "../../components/Sidebar/SidebarList.vue.js";
4
- import L from "../../components/Sidebar/SidebarListElement.vue.js";
5
- import V from "../../components/ViewLayout/ViewLayout.vue.js";
6
- import w from "../../components/ViewLayout/ViewLayoutContent.vue.js";
7
- import { useActiveEntities as y } from "../../store/active-entities.js";
8
- import { serverSchema as C } from "@scalar/oas-utils/entities/spec";
9
- import { useRouter as E } from "vue-router";
10
- import B from "./ServerForm.vue.js";
11
- import { useWorkspace as N } from "../../store/store.js";
12
- import A from "../../components/Sidebar/Sidebar.vue.js";
13
- const $ = { class: "flex-1" }, J = /* @__PURE__ */ d({
1
+ import { defineComponent as v, openBlock as a, createBlock as u, withCtx as e, createVNode as r, unref as n, createElementVNode as _, createElementBlock as S, Fragment as x, renderList as b, createTextVNode as k } from "vue";
2
+ import h from "../../components/Sidebar/SidebarButton.vue.js";
3
+ import L from "../../components/Sidebar/SidebarList.vue.js";
4
+ import V from "../../components/Sidebar/SidebarListElement.vue.js";
5
+ import w from "../../components/ViewLayout/ViewLayout.vue.js";
6
+ import y from "../../components/ViewLayout/ViewLayoutContent.vue.js";
7
+ import { useActiveEntities as C } from "../../store/active-entities.js";
8
+ import { serverSchema as E } from "@scalar/oas-utils/entities/spec";
9
+ import { useRouter as B } from "vue-router";
10
+ import N from "./ServerForm.vue.js";
11
+ import { useWorkspace as A } from "../../store/store.js";
12
+ import $ from "../../components/Sidebar/Sidebar.vue.js";
13
+ const g = { class: "flex-1" }, K = /* @__PURE__ */ v({
14
14
  __name: "Servers",
15
- setup(g) {
16
- const { activeCollection: t } = y(), { servers: u, serverMutators: c } = N(), { push: f } = E(), p = () => {
15
+ setup(F) {
16
+ const { activeCollection: t } = C(), { servers: c, serverMutators: f } = A(), { push: p } = B(), d = () => {
17
17
  if (!t.value) return;
18
- const o = C.parse({ url: "http://localhost" });
19
- c.add(o, t.value.uid), f({
18
+ const o = E.parse({ url: "http://localhost" });
19
+ f.add(o, t.value.uid), p({
20
20
  name: "servers",
21
21
  params: {
22
22
  server: o.uid
23
23
  }
24
24
  });
25
25
  };
26
- return (o, i) => (a(), m(V, null, {
26
+ return (o, i) => (a(), u(w, null, {
27
27
  default: e(() => [
28
- r(n(A), { title: "Servers" }, {
28
+ r(n($), { title: "Servers" }, {
29
29
  content: e(() => [
30
- v("div", $, [
31
- r(h, null, {
30
+ _("div", g, [
31
+ r(L, null, {
32
32
  default: e(() => {
33
33
  var l;
34
34
  return [
35
- (a(!0), _(S, null, x((l = n(t)) == null ? void 0 : l.servers, (s) => (a(), m(L, {
36
- key: s,
37
- class: "text-xs",
38
- type: "server",
39
- variable: {
40
- name: n(u)[s].url ?? "",
41
- uid: s
42
- }
43
- }, null, 8, ["variable"]))), 128))
35
+ (a(!0), S(x, null, b((l = n(t)) == null ? void 0 : l.servers, (s) => {
36
+ var m;
37
+ return a(), u(V, {
38
+ key: s,
39
+ class: "text-xs",
40
+ type: "server",
41
+ variable: {
42
+ name: ((m = n(c)[s]) == null ? void 0 : m.url) ?? "",
43
+ uid: s
44
+ }
45
+ }, null, 8, ["variable"]);
46
+ }), 128))
44
47
  ];
45
48
  }),
46
49
  _: 1
@@ -48,18 +51,18 @@ const $ = { class: "flex-1" }, J = /* @__PURE__ */ d({
48
51
  ])
49
52
  ]),
50
53
  button: e(() => [
51
- r(k, { click: p }, {
54
+ r(h, { click: d }, {
52
55
  title: e(() => i[0] || (i[0] = [
53
- b("Add Server")
56
+ k("Add Server")
54
57
  ])),
55
58
  _: 1
56
59
  })
57
60
  ]),
58
61
  _: 1
59
62
  }),
60
- r(w, { class: "flex-1" }, {
63
+ r(y, { class: "flex-1" }, {
61
64
  default: e(() => [
62
- r(B)
65
+ r(N)
63
66
  ]),
64
67
  _: 1
65
68
  })
@@ -69,5 +72,5 @@ const $ = { class: "flex-1" }, J = /* @__PURE__ */ d({
69
72
  }
70
73
  });
71
74
  export {
72
- J as default
75
+ K as default
73
76
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/Settings.vue"],"names":[],"mappings":"AAgCA,OAAO,EAAE,KAAK,eAAe,EAAO,MAAM,KAAK,CAAA;;AA8F/C,wBAMG"}
1
+ {"version":3,"file":"Settings.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/Settings.vue"],"names":[],"mappings":"AAkCA,OAAO,EAAE,KAAK,eAAe,EAAO,MAAM,KAAK,CAAA;;AAgG/C,wBAMG"}