@scalar/api-client 2.36.0 → 2.36.2

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 (144) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/dist/monacoeditorwork/editor.worker.bundle.js +14463 -0
  3. package/dist/monacoeditorwork/json.worker.bundle.js +22211 -0
  4. package/dist/monacoeditorwork/yaml.worker.bundle.js +46771 -0
  5. package/dist/style.css +1 -1
  6. package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
  7. package/dist/v2/blocks/operation-block/helpers/build-request-body.js +28 -27
  8. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts.map +1 -1
  9. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.js +12 -11
  10. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
  11. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +47 -42
  12. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  13. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  14. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +65 -59
  15. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  16. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +57 -42
  17. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  18. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +44 -41
  19. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +2 -2
  20. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +1 -1
  21. package/dist/v2/components/resize/index.d.ts +1 -0
  22. package/dist/v2/components/resize/index.d.ts.map +1 -1
  23. package/dist/v2/components/resize/index.js +4 -2
  24. package/dist/v2/components/resize/use-split-resize.d.ts +27 -0
  25. package/dist/v2/components/resize/use-split-resize.d.ts.map +1 -0
  26. package/dist/v2/components/resize/use-split-resize.js +57 -0
  27. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  28. package/dist/v2/components/sidebar/Sidebar.vue.js +38 -34
  29. package/dist/v2/features/app/App.vue.d.ts +5 -0
  30. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  31. package/dist/v2/features/app/App.vue.js +71 -63
  32. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
  33. package/dist/v2/features/app/components/DesktopTabs.vue.js +34 -30
  34. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +7 -1
  35. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  36. package/dist/v2/features/app/helpers/create-api-client-app.js +15 -10
  37. package/dist/v2/features/app/helpers/routes.d.ts +6 -0
  38. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  39. package/dist/v2/features/app/helpers/routes.js +3 -2
  40. package/dist/v2/features/app/hooks/use-document-watcher.js +13 -13
  41. package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
  42. package/dist/v2/features/collection/DocumentCollection.vue.js +292 -100
  43. package/dist/v2/features/collection/DocumentCollection.vue3.js +5 -0
  44. package/dist/v2/features/collection/OperationCollection.vue.js +20 -19
  45. package/dist/v2/features/collection/WorkspaceCollection.vue.js +6 -5
  46. package/dist/v2/features/collection/components/Authentication.vue2.js +16 -15
  47. package/dist/v2/features/collection/components/Cookies.vue.js +7 -6
  48. package/dist/v2/features/collection/components/Editor/Editor.vue.d.ts.map +1 -1
  49. package/dist/v2/features/collection/components/Editor/Editor.vue.js +3 -3
  50. package/dist/v2/features/collection/components/Editor/Editor.vue2.js +182 -171
  51. package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts +2 -1
  52. package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts.map +1 -1
  53. package/dist/v2/features/collection/components/Environment.vue.js +13 -12
  54. package/dist/v2/features/collection/components/Overview.vue2.js +7 -6
  55. package/dist/v2/features/collection/components/Servers.vue.js +64 -63
  56. package/dist/v2/features/collection/components/Settings.vue.js +8 -7
  57. package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.d.ts +18 -0
  58. package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.d.ts.map +1 -0
  59. package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.js +7 -0
  60. package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue2.js +136 -0
  61. package/dist/v2/features/editor/config.d.ts +16 -0
  62. package/dist/v2/features/editor/config.d.ts.map +1 -0
  63. package/dist/v2/features/editor/config.js +16 -0
  64. package/dist/v2/features/editor/helpers/configure-language-support.d.ts +13 -0
  65. package/dist/v2/features/editor/helpers/configure-language-support.d.ts.map +1 -0
  66. package/dist/v2/features/{collection/components/Editor → editor}/helpers/configure-language-support.js +6 -7
  67. package/dist/v2/features/editor/helpers/ensure-monaco-environment.d.ts.map +1 -0
  68. package/dist/v2/features/{collection/components/Editor → editor}/helpers/ensure-monaco-environment.js +9 -12
  69. package/dist/v2/features/editor/helpers/json/create-json-model.d.ts +12 -0
  70. package/dist/v2/features/editor/helpers/json/create-json-model.d.ts.map +1 -0
  71. package/dist/v2/features/editor/helpers/json/create-json-model.js +19 -0
  72. package/dist/v2/features/editor/helpers/json/get-json-ast-node-from-path.d.ts.map +1 -0
  73. package/dist/v2/features/editor/helpers/json/json-ast.d.ts.map +1 -0
  74. package/dist/v2/features/editor/helpers/json/json-pointer-links.d.ts.map +1 -0
  75. package/dist/v2/features/editor/helpers/json/json-pointer-path.d.ts.map +1 -0
  76. package/dist/v2/features/editor/helpers/json/json-pointer-path.js +21 -0
  77. package/dist/v2/features/editor/helpers/model.d.ts +9 -0
  78. package/dist/v2/features/editor/helpers/model.d.ts.map +1 -0
  79. package/dist/v2/features/editor/helpers/range-to-whole-line.d.ts +14 -0
  80. package/dist/v2/features/editor/helpers/range-to-whole-line.d.ts.map +1 -0
  81. package/dist/v2/features/editor/helpers/range-to-whole-line.js +8 -0
  82. package/dist/v2/features/editor/helpers/theme/apply-scalar-theme.d.ts.map +1 -0
  83. package/dist/v2/features/editor/helpers/theme/load-css-variables.d.ts.map +1 -0
  84. package/dist/v2/features/editor/helpers/yaml/create-yaml-model.d.ts +13 -0
  85. package/dist/v2/features/editor/helpers/yaml/create-yaml-model.d.ts.map +1 -0
  86. package/dist/v2/features/editor/helpers/yaml/create-yaml-model.js +19 -0
  87. package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/yaml}/get-yaml-node-range-from-path.d.ts +2 -2
  88. package/dist/v2/features/editor/helpers/yaml/get-yaml-node-range-from-path.d.ts.map +1 -0
  89. package/dist/v2/features/editor/hooks/use-editor-markers.d.ts.map +1 -0
  90. package/dist/v2/features/editor/hooks/use-editor.d.ts +39 -0
  91. package/dist/v2/features/editor/hooks/use-editor.d.ts.map +1 -0
  92. package/dist/v2/features/editor/hooks/use-editor.js +107 -0
  93. package/dist/v2/features/editor/hooks/use-json-pointer-link-support.d.ts +16 -0
  94. package/dist/v2/features/editor/hooks/use-json-pointer-link-support.d.ts.map +1 -0
  95. package/dist/v2/features/editor/hooks/use-json-pointer-link-support.js +27 -0
  96. package/dist/v2/features/editor/hooks/use-three-way-merge-editor.d.ts +77 -0
  97. package/dist/v2/features/editor/hooks/use-three-way-merge-editor.d.ts.map +1 -0
  98. package/dist/v2/features/editor/hooks/use-three-way-merge-editor.js +316 -0
  99. package/dist/v2/features/editor/index.d.ts +5 -0
  100. package/dist/v2/features/editor/index.d.ts.map +1 -0
  101. package/dist/v2/features/editor/index.js +10 -0
  102. package/dist/v2/features/operation/Operation.vue.js +18 -17
  103. package/dist/v2/types/configuration.d.ts +11 -0
  104. package/dist/v2/types/configuration.d.ts.map +1 -0
  105. package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts.map +1 -1
  106. package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +44 -45
  107. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  108. package/package.json +24 -18
  109. package/dist/assets/yaml.worker-CcQnAKCg.js +0 -490
  110. package/dist/v2/features/collection/DocumentCollection.vue2.js +0 -4
  111. package/dist/v2/features/collection/components/Editor/helpers/apply-scalar-theme.d.ts.map +0 -1
  112. package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.d.ts +0 -7
  113. package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.d.ts.map +0 -1
  114. package/dist/v2/features/collection/components/Editor/helpers/ensure-monaco-environment.d.ts.map +0 -1
  115. package/dist/v2/features/collection/components/Editor/helpers/get-json-ast-node-from-path.d.ts.map +0 -1
  116. package/dist/v2/features/collection/components/Editor/helpers/get-yaml-node-range-from-path.d.ts.map +0 -1
  117. package/dist/v2/features/collection/components/Editor/helpers/json-ast.d.ts.map +0 -1
  118. package/dist/v2/features/collection/components/Editor/helpers/json-pointer-links.d.ts.map +0 -1
  119. package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.d.ts.map +0 -1
  120. package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.js +0 -20
  121. package/dist/v2/features/collection/components/Editor/helpers/load-css-variables.d.ts.map +0 -1
  122. package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.d.ts +0 -2
  123. package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.d.ts.map +0 -1
  124. package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.js +0 -11
  125. package/dist/v2/features/collection/components/Editor/hooks/use-editor-markers.d.ts.map +0 -1
  126. package/dist/v2/features/collection/components/Editor/hooks/use-editor.d.ts +0 -39
  127. package/dist/v2/features/collection/components/Editor/hooks/use-editor.d.ts.map +0 -1
  128. package/dist/v2/features/collection/components/Editor/hooks/use-editor.js +0 -153
  129. /package/dist/v2/features/{collection/components/Editor → editor}/helpers/ensure-monaco-environment.d.ts +0 -0
  130. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/get-json-ast-node-from-path.d.ts +0 -0
  131. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/get-json-ast-node-from-path.js +0 -0
  132. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-ast.d.ts +0 -0
  133. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-ast.js +0 -0
  134. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-pointer-links.d.ts +0 -0
  135. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-pointer-links.js +0 -0
  136. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-pointer-path.d.ts +0 -0
  137. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/apply-scalar-theme.d.ts +0 -0
  138. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/apply-scalar-theme.js +0 -0
  139. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/load-css-variables.d.ts +0 -0
  140. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/load-css-variables.js +0 -0
  141. /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/yaml}/get-yaml-node-range-from-path.js +0 -0
  142. /package/dist/v2/features/{collection/components/Editor → editor}/hooks/use-editor-markers.d.ts +0 -0
  143. /package/dist/v2/features/{collection/components/Editor → editor}/hooks/use-editor-markers.js +0 -0
  144. /package/dist/v2/features/{collection/components/Editor → editor}/schemas/openapi-3.1-schema.json.js +0 -0
@@ -0,0 +1,316 @@
1
+ import { apply as _ } from "@scalar/json-magic/diff";
2
+ import { deepClone as A } from "@scalar/workspace-store/helpers/deep-clone";
3
+ import * as i from "monaco-editor";
4
+ import { ref as ae, shallowRef as L, computed as E, toValue as h, watch as ge, markRaw as pe } from "vue";
5
+ import { createJsonModel as V } from "../helpers/json/create-json-model.js";
6
+ import { ensureJsonPointerLinkSupport as he } from "../helpers/json/json-pointer-links.js";
7
+ import { parseJsonPointerPath as ve } from "../helpers/json/json-pointer-path.js";
8
+ import { rangeToWholeLine as Ce } from "../helpers/range-to-whole-line.js";
9
+ function Je(se) {
10
+ const { baseDocument: ie, resolvedDocument: P, conflicts: w, onApplyChanges: le, onError: F } = se, f = ae([]), S = L([]), Y = L([]), z = L([]), H = ae(-1), M = L(), N = L(), v = L();
11
+ let b, O;
12
+ const x = [];
13
+ let J = [];
14
+ const g = E(() => h(w).map((s) => {
15
+ const r = s[0], d = s[1];
16
+ let u = r[0].path;
17
+ for (const m of r)
18
+ m.path.length < u.length && (u = m.path);
19
+ for (const m of d)
20
+ m.path.length < u.length && (u = m.path);
21
+ return {
22
+ local: {
23
+ path: u,
24
+ changes: r,
25
+ type: r[0].type
26
+ },
27
+ remote: {
28
+ path: u,
29
+ changes: d,
30
+ type: d[0].type
31
+ }
32
+ };
33
+ })), re = E(
34
+ () => _(
35
+ A(h(P)),
36
+ h(w).flatMap((o) => o[0])
37
+ )
38
+ ), ce = E(
39
+ () => _(
40
+ A(h(P)),
41
+ h(w).flatMap((o) => o[1])
42
+ )
43
+ ), U = E(() => f.value.filter((o) => o === "idle").length);
44
+ ge(
45
+ g,
46
+ (o) => {
47
+ f.value = o.map((s, r) => f.value[r] ?? "idle");
48
+ },
49
+ { immediate: !0 }
50
+ );
51
+ const j = (o, s) => {
52
+ if (!o || !s)
53
+ return;
54
+ const r = o.getModifiedEditor(), d = new i.Range(s.startLineNumber, s.startColumn, s.endLineNumber, s.endColumn);
55
+ r.setSelection(d), r.revealRangeNearTop(d);
56
+ };
57
+ return {
58
+ init: (o) => {
59
+ const s = h(ie), r = h(P), d = re.value, u = ce.value, m = i.editor.createModel(JSON.stringify(r, null, 2), "json"), c = V(JSON.stringify(d, null, 2)), D = i.editor.createModel(JSON.stringify(r, null, 2), "json"), I = V(JSON.stringify(u, null, 2)), $ = i.editor.createModel(JSON.stringify(s, null, 2), "json"), p = V(JSON.stringify(r, null, 2));
60
+ J = [
61
+ m,
62
+ c.model,
63
+ D,
64
+ I.model,
65
+ $,
66
+ p.model
67
+ ];
68
+ const q = i.editor.createDiffEditor(o.local, {
69
+ originalEditable: !1,
70
+ readOnly: !0,
71
+ automaticLayout: !0,
72
+ renderSideBySide: !1
73
+ });
74
+ q.setModel({
75
+ original: m,
76
+ modified: c.model
77
+ }), M.value = q;
78
+ const G = i.editor.createDiffEditor(o.remote, {
79
+ originalEditable: !1,
80
+ readOnly: !0,
81
+ automaticLayout: !0,
82
+ renderSideBySide: !1
83
+ });
84
+ G.setModel({
85
+ original: D,
86
+ modified: I.model
87
+ }), N.value = G;
88
+ const T = i.editor.createDiffEditor(o.result, {
89
+ originalEditable: !1,
90
+ readOnly: !1,
91
+ renderSideBySide: !1,
92
+ automaticLayout: !0
93
+ });
94
+ T.setModel({
95
+ original: $,
96
+ modified: p.model
97
+ });
98
+ const C = T.getModifiedEditor();
99
+ C.updateOptions({ codeLens: !0 });
100
+ const de = async (t) => {
101
+ const e = await p.getRangeFromPath(t);
102
+ if (!e)
103
+ return;
104
+ const n = new i.Range(e.startLineNumber, e.startColumn, e.endLineNumber, e.endColumn);
105
+ C.setSelection(n), C.revealRangeNearTop(n);
106
+ };
107
+ O = he(async (t) => {
108
+ const e = ve(t);
109
+ e && await de(e);
110
+ }).dispose;
111
+ let K = [], W = 0;
112
+ const Q = "scalar.conflict.applyCurrent", X = "scalar.conflict.applyRemote", Z = "scalar.conflict.ignore", ue = C.addCommand(0, () => {
113
+ }) ?? "scalar.conflict.status.noop", me = (t) => {
114
+ const e = t.startLineNumber, n = t.endLineNumber;
115
+ if (e === n)
116
+ return [
117
+ {
118
+ range: t,
119
+ options: {
120
+ isWholeLine: !0,
121
+ className: "json-focus-highlight-box-single"
122
+ }
123
+ }
124
+ ];
125
+ const a = new i.Range(e, 1, e, t.endColumn), l = new i.Range(e + 1, 1, Math.max(e + 1, n - 1), 1), R = new i.Range(n, 1, n, t.endColumn), y = [
126
+ {
127
+ range: a,
128
+ options: {
129
+ isWholeLine: !0,
130
+ className: "json-focus-highlight-box-top"
131
+ }
132
+ },
133
+ {
134
+ range: R,
135
+ options: {
136
+ isWholeLine: !0,
137
+ className: "json-focus-highlight-box-bottom"
138
+ }
139
+ }
140
+ ];
141
+ return n - e > 1 && y.push({
142
+ range: l,
143
+ options: {
144
+ isWholeLine: !0,
145
+ className: "json-focus-highlight-box-middle"
146
+ }
147
+ }), y;
148
+ }, k = () => {
149
+ b?.dispose(), b = i.languages.registerCodeLensProvider("json", {
150
+ provideCodeLenses: (t) => t.uri.toString() !== p.model.uri.toString() ? { lenses: [], dispose: () => {
151
+ } } : {
152
+ lenses: S.value.flatMap((e) => {
153
+ const n = new i.Range(
154
+ e.range.startLineNumber,
155
+ 1,
156
+ e.range.startLineNumber,
157
+ 1
158
+ );
159
+ return [
160
+ {
161
+ range: n,
162
+ command: {
163
+ id: ue,
164
+ title: `Status: ${f.value[e.index] ?? "idle"}`
165
+ }
166
+ },
167
+ {
168
+ range: n,
169
+ command: {
170
+ id: Q,
171
+ title: "Accept Current",
172
+ arguments: [e.index]
173
+ }
174
+ },
175
+ {
176
+ range: n,
177
+ command: {
178
+ id: X,
179
+ title: "Accept Remote",
180
+ arguments: [e.index]
181
+ }
182
+ },
183
+ {
184
+ range: n,
185
+ command: {
186
+ id: Z,
187
+ title: "Ignore",
188
+ arguments: [e.index]
189
+ }
190
+ }
191
+ ];
192
+ }),
193
+ dispose: () => {
194
+ }
195
+ }
196
+ });
197
+ }, B = async (t, e, n) => {
198
+ const { model: a } = t, l = new i.Range(1, 1, 1, a.getLineMaxColumn(1));
199
+ let R = null;
200
+ for (let y = n.length; y >= 0; y -= 1) {
201
+ const fe = n.slice(0, y), ne = await t.getRangeFromPath(fe);
202
+ if (ne) {
203
+ R = Ce(a, ne);
204
+ break;
205
+ }
206
+ }
207
+ return {
208
+ index: e,
209
+ path: n,
210
+ range: pe(R ?? l)
211
+ };
212
+ }, ee = async () => {
213
+ const [t, e, n] = await Promise.all([
214
+ Promise.all(
215
+ g.value.map(
216
+ (a, l) => B(p, l, a.local.path)
217
+ )
218
+ ),
219
+ Promise.all(
220
+ g.value.map(
221
+ (a, l) => B(c, l, a.local.path)
222
+ )
223
+ ),
224
+ Promise.all(
225
+ g.value.map(
226
+ (a, l) => B(I, l, a.local.path)
227
+ )
228
+ )
229
+ ]);
230
+ S.value = t.filter((a) => !!a), Y.value = e.filter((a) => !!a), z.value = n.filter((a) => !!a), K = C.deltaDecorations(
231
+ K,
232
+ S.value.flatMap((a) => me(a.range))
233
+ ), k();
234
+ }, oe = (t, e) => {
235
+ f.value[t] = e, k();
236
+ }, te = async (t, e) => {
237
+ const n = g.value[t];
238
+ if (!n)
239
+ return;
240
+ let a = null;
241
+ try {
242
+ a = JSON.parse(p.model.getValue());
243
+ } catch {
244
+ return;
245
+ }
246
+ const l = e === "local" ? n.local.changes : n.remote.changes, R = _(A(a), l);
247
+ W += 1, p.model.setValue(JSON.stringify(R, null, 2)), oe(t, e), await ee();
248
+ };
249
+ x.push(
250
+ i.editor.registerCommand(Q, (t, e) => {
251
+ te(e, "local");
252
+ })
253
+ ), x.push(
254
+ i.editor.registerCommand(X, (t, e) => {
255
+ te(e, "remote");
256
+ })
257
+ ), x.push(
258
+ i.editor.registerCommand(Z, (t, e) => {
259
+ oe(e, "ignore");
260
+ })
261
+ ), ee(), C.onDidChangeModelContent((t) => {
262
+ if (W > 0) {
263
+ W -= 1;
264
+ return;
265
+ }
266
+ let e = !1;
267
+ for (const n of t.changes) {
268
+ const a = S.value.filter(
269
+ (l) => i.Range.areIntersectingOrTouching(n.range, l.range)
270
+ );
271
+ a.length && a.forEach((l) => {
272
+ f.value[l.index] !== "manual" && (f.value[l.index] = "manual", e = !0);
273
+ });
274
+ }
275
+ e && k();
276
+ }), v.value = T;
277
+ },
278
+ dispose: () => {
279
+ M.value?.dispose(), M.value = void 0, N.value?.dispose(), N.value = void 0, v.value?.dispose(), v.value = void 0;
280
+ for (const o of J)
281
+ o.dispose();
282
+ J = [], b?.dispose(), b = void 0, O?.(), O = void 0, x.forEach((o) => o.dispose()), x.length = 0;
283
+ },
284
+ conflictsLeft: U,
285
+ goToNextConflict: () => {
286
+ const o = g.value.map((c, D) => D).filter((c) => f.value[c] === "idle");
287
+ if (!o.length)
288
+ return;
289
+ const s = o.find((c) => c > H.value) ?? o[0];
290
+ if (s === void 0 || !g.value[s])
291
+ return;
292
+ const d = Y.value.find((c) => c.index === s)?.range, u = z.value.find((c) => c.index === s)?.range, m = S.value.find((c) => c.index === s)?.range;
293
+ j(M.value, d), j(N.value, u), j(v.value, m), v.value?.getModifiedEditor().focus(), H.value = s;
294
+ },
295
+ applyResolvedConflicts: () => {
296
+ if (U.value > 0) {
297
+ F?.("You have conflicts left");
298
+ return;
299
+ }
300
+ const o = v.value?.getModel()?.modified;
301
+ if (!o)
302
+ return;
303
+ let s = null;
304
+ try {
305
+ s = JSON.parse(o.getValue());
306
+ } catch {
307
+ F?.("You have formatting errors");
308
+ return;
309
+ }
310
+ le(s);
311
+ }
312
+ };
313
+ }
314
+ export {
315
+ Je as useThreeWayMergeEditor
316
+ };
@@ -0,0 +1,5 @@
1
+ export { useMonacoEditorConfiguration } from './config.js';
2
+ export { rangeToWholeLine } from './helpers/range-to-whole-line.js';
3
+ export { useEditor } from './hooks/use-editor.js';
4
+ export { useJsonPointerLinkSupport } from './hooks/use-json-pointer-link-support.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { useMonacoEditorConfiguration as e } from "./config.js";
2
+ import { rangeToWholeLine as n } from "./helpers/range-to-whole-line.js";
3
+ import { useEditor as p } from "./hooks/use-editor.js";
4
+ import { useJsonPointerLinkSupport as u } from "./hooks/use-json-pointer-link-support.js";
5
+ export {
6
+ n as rangeToWholeLine,
7
+ p as useEditor,
8
+ u as useJsonPointerLinkSupport,
9
+ e as useMonacoEditorConfiguration
10
+ };
@@ -5,12 +5,12 @@ import { combineParams as M } from "./helpers/combine-params.js";
5
5
  import { getSelectedServer as N } from "./helpers/get-selected-server.js";
6
6
  import { getActiveProxyUrl as A } from "../../helpers/get-active-proxy-url.js";
7
7
  import { getServers as E } from "../../helpers/get-servers.js";
8
- import V from "../../blocks/operation-block/OperationBlock.vue.js";
9
- const P = {
8
+ import R from "../../blocks/operation-block/OperationBlock.vue.js";
9
+ const V = {
10
10
  key: 1,
11
11
  class: "flex h-full w-full items-center justify-center"
12
- }, R = {}, W = /* @__PURE__ */ w({
13
- ...R,
12
+ }, P = {}, L = /* @__PURE__ */ w({
13
+ ...P,
14
14
  __name: "Operation",
15
15
  props: {
16
16
  documentSlug: {},
@@ -28,19 +28,20 @@ const P = {
28
28
  customThemes: {},
29
29
  currentTheme: {},
30
30
  isDarkMode: { type: Boolean },
31
+ fetchRegistryDocument: { type: Function },
31
32
  options: {}
32
33
  },
33
34
  setup(e) {
34
- const l = t(() => e.path ? s(e.document?.paths?.[e.path]) : null), r = t(() => {
35
+ const u = t(() => e.path ? s(e.document?.paths?.[e.path]) : null), r = t(() => {
35
36
  if (!e.path || !e.method)
36
37
  return null;
37
38
  const n = s(e.document?.paths?.[e.path]?.[e.method]);
38
39
  if (!n)
39
40
  return null;
40
- if (!l.value)
41
+ if (!u.value)
41
42
  return n;
42
43
  const o = M(
43
- l.value.parameters,
44
+ u.value.parameters,
44
45
  n.parameters
45
46
  );
46
47
  return { ...n, parameters: o };
@@ -53,7 +54,7 @@ const P = {
53
54
  ...n,
54
55
  location: "document"
55
56
  }))
56
- ]), u = t(() => {
57
+ ]), l = t(() => {
57
58
  const n = a(e.options)?.servers ?? r.value?.servers ?? // pathItem.value?.servers ?? TODO: add support for pathItem servers
58
59
  e.document?.servers;
59
60
  return E(n, {
@@ -61,7 +62,7 @@ const P = {
61
62
  documentUrl: e.document?.["x-scalar-original-source-url"]
62
63
  });
63
64
  }), v = t(() => a(e.options)?.servers != null ? e.document?.["x-scalar-selected-server"] : r.value?.servers != null ? r.value["x-scalar-selected-server"] : e.document?.["x-scalar-selected-server"]), h = t(
64
- () => N(u.value, v.value)
65
+ () => N(l.value, v.value)
65
66
  ), S = t(() => r.value?.servers != null ? { type: "operation", path: e.path ?? "", method: e.method ?? "get" } : { type: "document" }), y = t(() => e.workspaceStore.auth.getAuthSelectedSchemas({
66
67
  type: "document",
67
68
  documentName: e.documentSlug
@@ -81,13 +82,13 @@ const P = {
81
82
  ...e.workspaceStore.workspace["x-scalar-environments"]
82
83
  })
83
84
  )
84
- )), x = t(
85
+ )), g = t(
85
86
  () => b(a(e.options)?.hiddenClients)
86
- ), g = "2.36.0";
87
- return (n, o) => e.path && e.method && e.exampleName && r.value ? (m(), C(c(V), {
87
+ ), x = "2.36.2";
88
+ return (n, o) => e.path && e.method && e.exampleName && r.value ? (m(), C(c(R), {
88
89
  key: 0,
89
90
  activeEnvironment: e.workspaceStore.workspace["x-scalar-active-environment"],
90
- appVersion: c(g),
91
+ appVersion: c(x),
91
92
  authMeta: f.value,
92
93
  documentSecurity: e.document?.security ?? [],
93
94
  documentSelectedSecurity: y.value,
@@ -99,7 +100,7 @@ const P = {
99
100
  globalCookies: d.value,
100
101
  hideClientButton: a(e.options)?.hideClientButton ?? !1,
101
102
  history: e.workspaceStore.history.getHistory(e.documentSlug, e.path, e.method),
102
- httpClients: x.value,
103
+ httpClients: g.value,
103
104
  layout: e.layout,
104
105
  method: e.method,
105
106
  operation: r.value,
@@ -114,12 +115,12 @@ const P = {
114
115
  selectedClient: e.workspaceStore.workspace["x-scalar-default-client"],
115
116
  server: h.value,
116
117
  serverMeta: S.value,
117
- servers: u.value
118
- }, null, 8, ["activeEnvironment", "appVersion", "authMeta", "documentSecurity", "documentSelectedSecurity", "documentUrl", "environment", "environments", "eventBus", "exampleKey", "globalCookies", "hideClientButton", "history", "httpClients", "layout", "method", "operation", "operationSelectedSecurity", "path", "plugins", "proxyUrl", "securitySchemes", "selectedClient", "server", "serverMeta", "servers"])) : (m(), B("div", P, [...o[0] || (o[0] = [
118
+ servers: l.value
119
+ }, null, 8, ["activeEnvironment", "appVersion", "authMeta", "documentSecurity", "documentSelectedSecurity", "documentUrl", "environment", "environments", "eventBus", "exampleKey", "globalCookies", "hideClientButton", "history", "httpClients", "layout", "method", "operation", "operationSelectedSecurity", "path", "plugins", "proxyUrl", "securitySchemes", "selectedClient", "server", "serverMeta", "servers"])) : (m(), B("div", V, [...o[0] || (o[0] = [
119
120
  U("span", { class: "text-c-3" }, "Select an operation to view details", -1)
120
121
  ])]));
121
122
  }
122
123
  });
123
124
  export {
124
- W as default
125
+ L as default
125
126
  };
@@ -0,0 +1,11 @@
1
+ export type ImportDocumentFromRegistry = (meta: {
2
+ namespace: string;
3
+ slug: string;
4
+ }) => Promise<{
5
+ ok: true;
6
+ data: Record<string, unknown>;
7
+ } | {
8
+ ok: false;
9
+ error: string;
10
+ }>;
11
+ //# sourceMappingURL=configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../src/v2/types/configuration.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAC3F;IACE,EAAE,EAAE,IAAI,CAAA;IACR,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B,GACD;IACE,EAAE,EAAE,KAAK,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;CACd,CACJ,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-har-request.d.ts","sourceRoot":"","sources":["../../../../../src/views/Components/CodeSnippet/helpers/get-har-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAExG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAQtD;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,+DAM3B;IACD,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IACjC,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,eAAe,CAAC,EAAE,cAAc,EAAE,CAAA;IAClC,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACvC,KAAG,UA0GH,CAAA"}
1
+ {"version":3,"file":"get-har-request.d.ts","sourceRoot":"","sources":["../../../../../src/views/Components/CodeSnippet/helpers/get-har-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAExG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAQtD;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,+DAM3B;IACD,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IACjC,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,eAAe,CAAC,EAAE,cAAc,EAAE,CAAA;IAClC,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACvC,KAAG,UA2GH,CAAA"}
@@ -2,82 +2,81 @@ import { REGEX as t } from "@scalar/oas-utils/helpers";
2
2
  import { buildRequestSecurity as T } from "../../../../libs/send-request/build-request-security.js";
3
3
  import { replaceTemplateVariables as a } from "../../../../libs/string-template.js";
4
4
  import { convertToHarRequest as P } from "./convert-to-har-request.js";
5
- const S = "YOUR_SECRET_TOKEN", O = ({
6
- operation: d,
7
- example: s,
8
- server: l,
9
- securitySchemes: c = [],
10
- environment: A
5
+ const y = "YOUR_SECRET_TOKEN", h = ({
6
+ operation: c,
7
+ example: o,
8
+ server: s,
9
+ securitySchemes: m = [],
10
+ environment: n
11
11
  }) => {
12
- const r = A && Array.isArray(A) ? Object.fromEntries(A.map((e) => [e.key, e.value])) : A || {}, p = (() => {
13
- if (l?.url && (t.VARIABLES.test(l.url) || t.PATH.test(l.url))) {
14
- const e = Object.entries(l?.variables || {}).reduce(
15
- (u, [o, n]) => {
16
- const m = s?.parameters?.path.find((v) => v.enabled && v.key === o)?.value;
17
- return m ? u[o] = a(m, r) : n.default && (u[o] = a(n.default, r)), u;
18
- },
12
+ const u = n && Array.isArray(n) ? Object.fromEntries(n.map((e) => [e.key, e.value])) : n || {}, A = (o?.parameters?.path ?? []).reduce((e, r) => {
13
+ if (r.enabled) {
14
+ const l = a(r.value, u);
15
+ e[r.key] = encodeURIComponent(l);
16
+ }
17
+ return e;
18
+ }, {}), v = (() => {
19
+ if (s?.url && (t.VARIABLES.test(s.url) || t.PATH.test(s.url))) {
20
+ const e = Object.entries(s?.variables || {}).reduce(
21
+ (r, [l, i]) => (A[l] ? r[l] = A[l] : i.default && (r[l] = a(i.default, u)), r),
19
22
  {}
20
23
  );
21
- return a(a(l.url, r), e);
24
+ return a(a(s.url, u), e);
22
25
  }
23
- return l?.url;
24
- })(), E = (() => {
25
- const e = d?.path ?? "/";
26
- if (e && (t.VARIABLES.test(e) || t.PATH.test(e))) {
27
- const u = (s?.parameters?.path ?? []).reduce((o, n) => (n.enabled && (o[n.key] = a(n.value, r)), o), {});
28
- return a(a(e, r), u);
29
- }
30
- return e;
31
- })(), i = T(c, r, S), f = [
32
- ...(s?.parameters.headers ?? []).map((e) => ({
26
+ return s?.url;
27
+ })(), p = (() => {
28
+ const e = c?.path ?? "/";
29
+ return e && (t.VARIABLES.test(e) || t.PATH.test(e)) ? a(a(e, u), A) : e;
30
+ })(), d = T(m, u, y), E = [
31
+ ...(o?.parameters.headers ?? []).map((e) => ({
33
32
  ...e,
34
- value: t.VARIABLES.test(e.value) || t.PATH.test(e.value) ? a(e.value, r) : e.value
33
+ value: t.VARIABLES.test(e.value) || t.PATH.test(e.value) ? a(e.value, u) : e.value
35
34
  })) ?? [],
36
- ...Object.entries(i.headers).map(([e, u]) => ({
35
+ ...Object.entries(d.headers).map(([e, r]) => ({
37
36
  key: e,
38
- value: u,
37
+ value: r,
39
38
  enabled: !0
40
39
  }))
41
40
  ], b = [
42
- ...(s?.parameters.cookies ?? []).map((e) => ({
41
+ ...(o?.parameters.cookies ?? []).map((e) => ({
43
42
  ...e,
44
- value: t.VARIABLES.test(e.value) || t.PATH.test(e.value) ? a(e.value, r) : e.value
43
+ value: t.VARIABLES.test(e.value) || t.PATH.test(e.value) ? a(e.value, u) : e.value
45
44
  })) ?? [],
46
- ...i.cookies.map((e) => ({
45
+ ...d.cookies.map((e) => ({
47
46
  key: e.name,
48
47
  value: e.value,
49
48
  enabled: !0
50
49
  }))
51
- ], R = [
52
- ...(s?.parameters.query ?? []).map((e) => ({
50
+ ], f = [
51
+ ...(o?.parameters.query ?? []).map((e) => ({
53
52
  ...e,
54
- value: t.VARIABLES.test(e.value) || t.PATH.test(e.value) ? a(e.value, r) : e.value
53
+ value: t.VARIABLES.test(e.value) || t.PATH.test(e.value) ? a(e.value, u) : e.value
55
54
  })) ?? [],
56
- ...Array.from(i.urlParams.entries()).map(([e, u]) => ({
55
+ ...Array.from(d.urlParams.entries()).map(([e, r]) => ({
57
56
  key: e,
58
- value: u,
57
+ value: r,
59
58
  enabled: !0
60
59
  }))
61
- ], y = (() => {
62
- const e = s?.body;
60
+ ], R = (() => {
61
+ const e = o?.body;
63
62
  return e?.raw?.value && (t.VARIABLES.test(e.raw.value) || t.PATH.test(e.raw.value)) ? {
64
63
  ...e,
65
64
  raw: {
66
65
  ...e.raw,
67
- value: a(e.raw.value, r)
66
+ value: a(e.raw.value, u)
68
67
  }
69
68
  } : e;
70
69
  })();
71
70
  return P({
72
- baseUrl: p,
73
- method: d?.method ?? "get",
74
- path: E,
75
- body: y,
71
+ baseUrl: v,
72
+ method: c?.method ?? "get",
73
+ path: p,
74
+ body: R,
76
75
  cookies: b,
77
- headers: f,
78
- query: R
76
+ headers: E,
77
+ query: f
79
78
  });
80
79
  };
81
80
  export {
82
- O as getHarRequest
81
+ h as getHarRequest
83
82
  };
@@ -33,7 +33,7 @@ const W = { class: "flex-center relative flex flex-1 flex-col gap-6 p-2 capitali
33
33
  }));
34
34
  }, f = (u) => {
35
35
  u?.createNew && g.name === "request" && p();
36
- }, v = "2.36.0";
36
+ }, v = "2.36.2";
37
37
  return q(() => a.hotKeys.on(f)), R(() => a.hotKeys.off(f)), (u, e) => (l(), n("div", W, [
38
38
  s("div", {
39
39
  class: y(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {