@scalar/api-client 2.22.3 → 2.23.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 (121) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/style.css +1 -1
  3. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +13 -3
  4. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +68 -68
  6. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +5 -3
  7. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +1 -1
  8. package/dist/v2/blocks/operation-block/helpers/build-request-security.js +1 -1
  9. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +3 -2
  10. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
  11. package/dist/v2/blocks/operation-block/index.d.ts +2 -1
  12. package/dist/v2/blocks/operation-block/index.d.ts.map +1 -1
  13. package/dist/v2/blocks/operation-block/index.js +7 -4
  14. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +3 -2
  15. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  16. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +2 -2
  17. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +3 -2
  18. package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -1
  19. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts +2 -2
  20. package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts.map +1 -1
  21. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +3 -2
  22. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  23. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts +2 -2
  24. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts.map +1 -1
  25. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +8 -5
  26. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  27. package/dist/v2/blocks/request-block/RequestBlock.vue.js +2 -2
  28. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +4 -4
  29. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
  30. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js +49 -45
  31. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  32. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +4 -2
  33. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  34. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +18 -181
  35. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  36. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +118 -107
  37. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +3 -2
  38. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
  39. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js +30 -33
  40. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +11 -178
  41. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  42. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +107 -110
  43. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts.map +1 -1
  44. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js +5 -29
  45. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts +6 -0
  46. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -0
  47. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +85 -0
  48. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts +9 -0
  49. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts.map +1 -0
  50. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.js +15 -0
  51. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +3 -2
  52. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  53. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +23 -0
  54. package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +1 -0
  55. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts +2 -2
  56. package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
  57. package/dist/v2/blocks/scalar-auth-selector-block/index.js +4 -6
  58. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  59. package/dist/v2/features/app/App.vue.js +127 -92
  60. package/dist/v2/features/app/app-state.d.ts +1 -1
  61. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  62. package/dist/v2/features/app/app-state.js +145 -142
  63. package/dist/v2/features/app/helpers/routes.d.ts +1 -1
  64. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  65. package/dist/v2/features/app/helpers/routes.js +31 -25
  66. package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
  67. package/dist/v2/features/collection/components/Authentication.vue.js +1 -1
  68. package/dist/v2/features/collection/components/Authentication.vue2.js +14 -11
  69. package/dist/v2/features/import-listener/ImportListener.vue.d.ts +52 -0
  70. package/dist/v2/features/import-listener/ImportListener.vue.d.ts.map +1 -0
  71. package/dist/v2/features/import-listener/ImportListener.vue.js +91 -0
  72. package/dist/v2/features/import-listener/ImportListener.vue2.js +4 -0
  73. package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts +7 -0
  74. package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts.map +1 -0
  75. package/dist/v2/features/import-listener/components/DropEventListener.vue.js +81 -0
  76. package/dist/v2/features/import-listener/components/DropEventListener.vue2.js +4 -0
  77. package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts +40 -0
  78. package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts.map +1 -0
  79. package/dist/v2/features/import-listener/components/ImportModal.vue.js +170 -0
  80. package/dist/v2/features/import-listener/components/ImportModal.vue3.js +5 -0
  81. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts +29 -0
  82. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts.map +1 -0
  83. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.js +83 -0
  84. package/dist/v2/features/import-listener/components/WorkspaceSelector.vue2.js +4 -0
  85. package/dist/v2/features/import-listener/helpers/generate-unique-slug.d.ts +16 -0
  86. package/dist/v2/features/import-listener/helpers/generate-unique-slug.d.ts.map +1 -0
  87. package/dist/v2/features/import-listener/helpers/generate-unique-slug.js +11 -0
  88. package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts +8 -0
  89. package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts.map +1 -0
  90. package/dist/v2/features/import-listener/helpers/get-url-query-parameter.js +4 -0
  91. package/dist/v2/features/import-listener/helpers/import-document-to-workspace.d.ts +30 -0
  92. package/dist/v2/features/import-listener/helpers/import-document-to-workspace.d.ts.map +1 -0
  93. package/dist/v2/features/import-listener/helpers/import-document-to-workspace.js +33 -0
  94. package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts +15 -0
  95. package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts.map +1 -0
  96. package/dist/v2/features/import-listener/helpers/load-document-from-source.js +28 -0
  97. package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts +15 -0
  98. package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts.map +1 -0
  99. package/dist/v2/features/import-listener/helpers/wait-for-condition.js +16 -0
  100. package/dist/v2/features/import-listener/index.d.ts +2 -0
  101. package/dist/v2/features/import-listener/index.d.ts.map +1 -0
  102. package/dist/v2/features/import-listener/index.js +4 -0
  103. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  104. package/dist/v2/features/modal/Modal.vue.js +1 -1
  105. package/dist/v2/features/modal/Modal.vue2.js +14 -12
  106. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  107. package/dist/v2/features/operation/Operation.vue.js +44 -35
  108. package/dist/v2/features/operation/helpers/get-selected-security.d.ts +3 -5
  109. package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -1
  110. package/dist/v2/workspace-events.d.ts.map +1 -1
  111. package/dist/v2/workspace-events.js +116 -109
  112. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  113. package/package.json +19 -14
  114. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.bench.d.ts +0 -2
  115. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.bench.d.ts.map +0 -1
  116. package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.d.ts +0 -8
  117. package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.d.ts.map +0 -1
  118. package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.js +0 -33
  119. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.d.ts +0 -7
  120. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.d.ts.map +0 -1
  121. package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.js +0 -13
@@ -1,59 +1,61 @@
1
1
  import { isDefined as A } from "@scalar/helpers/array/is-defined";
2
- import { sortByOrder as Y } from "@scalar/helpers/array/sort-by-order";
3
- import { isHttpMethod as j } from "@scalar/helpers/http/is-http-method";
4
- import { createSidebarState as q, generateReverseIndex as z } from "@scalar/sidebar";
2
+ import { sortByOrder as V } from "@scalar/helpers/array/sort-by-order";
3
+ import { isHttpMethod as Y } from "@scalar/helpers/http/is-http-method";
4
+ import { createSidebarState as j, generateReverseIndex as z } from "@scalar/sidebar";
5
5
  import { createWorkspaceStore as C } from "@scalar/workspace-store/client";
6
6
  import { createWorkspaceEventBus as J } from "@scalar/workspace-store/events";
7
7
  import { generateUniqueValue as M } from "@scalar/workspace-store/helpers/generate-unique-value";
8
- import { getParentEntry as m } from "@scalar/workspace-store/navigation";
8
+ import { getParentEntry as d } from "@scalar/workspace-store/navigation";
9
9
  import { createWorkspaceStorePersistence as G } from "@scalar/workspace-store/persistence";
10
10
  import { persistencePlugin as Q } from "@scalar/workspace-store/plugins/client";
11
11
  import { extensions as X } from "@scalar/workspace-store/schemas/extensions";
12
12
  import { shallowRef as E, computed as i, ref as p, watch as Z } from "vue";
13
13
  import { getActiveEnvironment as ee } from "../../helpers/get-active-environment.js";
14
- import { getTabDetails as te } from "../../helpers/get-tab-details.js";
15
- import { slugify as ae } from "../../helpers/slugify.js";
14
+ import { getTabDetails as ae } from "../../helpers/get-tab-details.js";
15
+ import { slugify as te } from "../../helpers/slugify.js";
16
16
  import { workspaceStorage as ne } from "../../helpers/storage.js";
17
17
  import { initializeAppEventHandlers as re } from "./app-events.js";
18
- const oe = 1e3, h = J({
18
+ const oe = 1e3, w = J({
19
19
  debug: !1
20
- }), v = p(void 0), k = p(void 0), w = p(void 0), B = p(void 0), O = p(void 0), $ = p(void 0), f = p(!1), l = E(null);
20
+ }), v = p(void 0), k = p(void 0), x = p(void 0), B = p(void 0), O = p(void 0), L = p(void 0), h = p(!1), l = E(null);
21
21
  Z(l, (e) => {
22
- e && e.afterEach((t) => ge(t));
22
+ e && e.afterEach((a) => ge(a));
23
23
  });
24
- const d = i(() => l.value?.currentRoute.value ?? null);
25
- function c(e, t) {
26
- const a = t?.params[e];
27
- if (typeof a == "string")
28
- return e === "method" ? a && j(a) ? a : void 0 : decodeURIComponent(a);
24
+ const m = i(() => l.value?.currentRoute.value ?? null);
25
+ function c(e, a) {
26
+ const t = a?.params[e];
27
+ if (typeof t == "string")
28
+ return e === "method" ? t && Y(t) ? t : void 0 : decodeURIComponent(t);
29
29
  }
30
- const W = E(null), I = p([]), o = E(null), T = i(() => o.value?.workspace.documents[w.value ?? ""] || null), se = i(() => ee(o.value, T.value)), { workspace: x } = await G(), g = (e, t) => `${e}/${t}`;
31
- I.value = await x.getAll().then(
32
- (e) => e.map(({ teamUid: t, namespace: a, slug: n, name: u }) => ({
33
- id: g(a, n),
34
- teamUid: t,
35
- namespace: a,
30
+ const W = E(null), I = p([]), o = E(null), T = i(() => o.value?.workspace.documents[x.value ?? ""] || null), se = i(() => ee(o.value, T.value)), { workspace: g } = await G(), f = (e, a) => `${e}/${a}`;
31
+ I.value = await g.getAll().then(
32
+ (e) => e.map(({ teamUid: a, namespace: t, slug: n, name: u }) => ({
33
+ id: f(t, n),
34
+ teamUid: a,
35
+ namespace: t,
36
36
  slug: n,
37
37
  label: u
38
38
  }))
39
39
  );
40
- const ce = async ({ namespace: e, slug: t }) => C({
41
- plugins: [await Q({ workspaceId: `${e}-${t}`, debounceDelay: oe })]
42
- }), ue = async (e, t) => {
43
- const a = await x.getItem({ namespace: e, slug: t });
44
- if (!a)
40
+ const ce = async ({ namespace: e, slug: a }) => C({
41
+ plugins: [
42
+ await Q({ workspaceId: f(e, a), debounceDelay: oe })
43
+ ]
44
+ }), ue = async (e, a) => {
45
+ const t = await g.getItem({ namespace: e, slug: a });
46
+ if (!t)
45
47
  return {
46
48
  success: !1
47
49
  };
48
- const n = await ce({ namespace: e, slug: t });
49
- return n.loadWorkspace(a.workspace), W.value = { id: g(a.namespace, a.slug), label: a.name }, o.value = n, {
50
+ const n = await ce({ namespace: e, slug: a });
51
+ return n.loadWorkspace(t.workspace), W.value = { id: f(t.namespace, t.slug), label: t.name }, o.value = n, {
50
52
  success: !0,
51
53
  workspace: n.workspace
52
54
  };
53
55
  }, le = async ({
54
56
  name: e,
55
- teamUid: t,
56
- namespace: a,
57
+ teamUid: a,
58
+ namespace: t,
57
59
  slug: n
58
60
  }) => {
59
61
  const u = C();
@@ -74,274 +76,275 @@ const ce = async ({ namespace: e, slug: t }) => C({
74
76
  "x-scalar-icon": "interface-edit-tool-pencil"
75
77
  }
76
78
  });
77
- const s = await x.setItem(
78
- { namespace: a, slug: n },
79
+ const s = await g.setItem(
80
+ { namespace: t, slug: n },
79
81
  {
80
82
  name: e,
81
- teamUid: t,
83
+ teamUid: a,
82
84
  workspace: u.exportWorkspace()
83
85
  }
84
86
  );
85
87
  return I.value.push({
86
- id: g(s.namespace, s.slug),
88
+ id: f(s.namespace, s.slug),
87
89
  teamUid: s.teamUid,
88
90
  namespace: s.namespace,
89
91
  slug: s.slug,
90
92
  label: s.name
91
93
  }), s;
92
- }, L = async (e, t) => {
94
+ }, N = async (e, a) => {
93
95
  await l.value?.push({
94
96
  name: "workspace.environment",
95
- params: { namespace: e, workspaceSlug: t }
97
+ params: { namespace: e, workspaceSlug: a }
96
98
  });
97
- }, N = async ({
99
+ }, P = async ({
98
100
  key: e,
99
- name: t
101
+ name: a
100
102
  }) => {
101
103
  o.value = null;
102
- const a = await M({
103
- defaultValue: e?.slug ?? t,
104
+ const t = await M({
105
+ defaultValue: e?.slug ?? a,
104
106
  // Use the provided id if it exists, otherwise use the name
105
- validation: async (s) => !await x.has({ namespace: e?.namespace ?? "local", slug: s }),
107
+ validation: async (s) => !await g.has({ namespace: e?.namespace ?? "local", slug: s }),
106
108
  maxRetries: 100,
107
- transformation: ae
109
+ transformation: te
108
110
  });
109
- if (!a)
111
+ if (!t)
110
112
  return;
111
113
  const n = {
112
114
  teamUid: e?.teamUid,
113
115
  namespace: e?.namespace,
114
- slug: a,
115
- name: t
116
+ slug: t,
117
+ name: a
116
118
  }, u = await le(n);
117
- return await L(u.namespace, u.slug), u;
118
- }, ie = async (e, t) => {
119
- o.value = null, f.value = !0;
120
- const a = await ue(e, t);
121
- if (a.success) {
122
- const u = a.workspace["x-scalar-active-tab"] ?? 0, s = a.workspace["x-scalar-tabs"], D = s?.[u];
123
- D && await l.value?.replace(D.path), s && u >= s.length && h.emit("tabs:update:tabs", {
119
+ return await N(u.namespace, u.slug), u;
120
+ }, ie = async (e, a) => {
121
+ o.value = null, h.value = !0;
122
+ const t = await ue(e, a);
123
+ if (t.success) {
124
+ const u = t.workspace["x-scalar-active-tab"] ?? 0, s = t.workspace["x-scalar-tabs"], D = s?.[u];
125
+ D && await l.value?.replace({
126
+ path: D.path,
127
+ query: m.value?.query ?? {}
128
+ }), s && u >= s.length && w.emit("tabs:update:tabs", {
124
129
  "x-scalar-active-tab": 0
125
- }), s || h.emit("tabs:update:tabs", {
126
- "x-scalar-tabs": [U(d.value)],
130
+ }), s || w.emit("tabs:update:tabs", {
131
+ "x-scalar-tabs": [U(m.value)],
127
132
  "x-scalar-active-tab": 0
128
- }), f.value = !1;
133
+ }), h.value = !1;
129
134
  return;
130
135
  }
131
- const n = await N({
136
+ const n = await P({
132
137
  name: "Default Workspace",
133
138
  key: { slug: "default" }
134
139
  });
135
- if (f.value = !1, !n)
140
+ if (h.value = !1, !n)
136
141
  return console.error("Failed to create the default workspace, something went wrong, can not load the workspace");
137
142
  r.reset();
138
- }, P = i(() => {
143
+ }, _ = i(() => {
139
144
  const e = o.value;
140
145
  if (!e)
141
146
  return [];
142
- const t = e.workspace["x-scalar-order"] ?? Object.keys(e.workspace.documents);
143
- return Y(Object.keys(e.workspace.documents), t, (a) => a).map((a) => e.workspace.documents[a]?.["x-scalar-navigation"]).filter(A);
144
- }), r = q(P), S = ({
147
+ const a = e.workspace["x-scalar-order"] ?? Object.keys(e.workspace.documents);
148
+ return V(Object.keys(e.workspace.documents), a, (t) => t).map((t) => e.workspace.documents[t]?.["x-scalar-navigation"]).filter(A);
149
+ }), r = j(_), y = ({
145
150
  document: e,
146
- path: t,
147
- method: a,
151
+ path: a,
152
+ method: t,
148
153
  example: n
149
- }) => JSON.stringify([e, t, a, n].filter(A)), R = i(
154
+ }) => JSON.stringify([e, a, t, n].filter(A)), R = i(
150
155
  () => z({
151
- items: P.value,
156
+ items: _.value,
152
157
  nestedKey: "children",
153
158
  filter: (e) => e.type === "document" || e.type === "operation" || e.type === "example",
154
159
  getId: (e) => {
155
- const t = m("document", e), a = m("operation", e);
156
- return S({
157
- document: t?.name ?? "",
158
- path: a?.path,
159
- method: a?.method,
160
+ const a = d("document", e), t = d("operation", e);
161
+ return y({
162
+ document: a?.name ?? "",
163
+ path: t?.path,
164
+ method: t?.method,
160
165
  example: e.type === "example" ? e.name : void 0
161
166
  });
162
167
  }
163
168
  })
164
169
  ), b = (e) => {
165
- const t = R.value.get(S(e));
166
- return t || R.value.get(
167
- S({
170
+ const a = R.value.get(y(e));
171
+ return a || R.value.get(
172
+ y({
168
173
  document: e.document,
169
174
  path: e.path,
170
175
  method: e.method
171
176
  })
172
177
  );
173
- }, _ = (e) => {
174
- const t = r.getEntryById(e);
175
- if (!t) {
178
+ }, $ = (e) => {
179
+ const a = r.getEntryById(e);
180
+ if (!a) {
176
181
  console.warn(`Could not find sidebar entry with id ${e} to select`);
177
182
  return;
178
183
  }
179
- if (t.type === "document") {
184
+ if (a.type === "document") {
180
185
  if (r.selectedItem.value === e) {
181
186
  r.setExpanded(e, !r.isExpanded(e));
182
187
  return;
183
188
  }
184
189
  return r.setSelected(e), r.setExpanded(e, !0), l.value?.push({
185
190
  name: "document.overview",
186
- params: { documentSlug: t.name }
191
+ params: { documentSlug: a.name }
187
192
  });
188
193
  }
189
- if (t.type === "operation") {
194
+ if (a.type === "operation") {
190
195
  if (r.isSelected(e)) {
191
196
  r.setExpanded(e, !r.isExpanded(e));
192
197
  return;
193
198
  }
194
- const a = t.children?.find((n) => n.type === "example");
195
- return a ? (r.setSelected(a.id), r.setExpanded(a.id, !0)) : r.setSelected(e), l.value?.push({
199
+ const t = a.children?.find((n) => n.type === "example");
200
+ return t ? (r.setSelected(t.id), r.setExpanded(t.id, !0)) : r.setSelected(e), l.value?.push({
196
201
  name: "example",
197
202
  params: {
198
- documentSlug: m("document", t)?.name,
199
- pathEncoded: encodeURIComponent(t.path),
200
- method: t.method,
201
- exampleName: a?.name ?? "default"
203
+ documentSlug: d("document", a)?.name,
204
+ pathEncoded: encodeURIComponent(a.path),
205
+ method: a.method,
206
+ exampleName: t?.name ?? "default"
202
207
  }
203
208
  });
204
209
  }
205
- if (t.type === "example") {
210
+ if (a.type === "example") {
206
211
  r.setSelected(e);
207
- const a = m("operation", t);
212
+ const t = d("operation", a);
208
213
  return l.value?.push({
209
214
  name: "example",
210
215
  params: {
211
- documentSlug: m("document", t)?.name,
212
- pathEncoded: encodeURIComponent(a?.path ?? ""),
213
- method: a?.method,
214
- exampleName: t.name
216
+ documentSlug: d("document", a)?.name,
217
+ pathEncoded: encodeURIComponent(t?.path ?? ""),
218
+ method: t?.method,
219
+ exampleName: a.name
215
220
  }
216
221
  });
217
222
  }
218
- if (t.type === "text")
223
+ if (a.type === "text")
219
224
  return l.value?.push({
220
225
  name: "document.overview",
221
226
  params: {
222
- documentSlug: m("document", t)?.name
227
+ documentSlug: d("document", a)?.name
223
228
  }
224
229
  });
225
230
  r.setExpanded(e, !r.isExpanded(e));
226
231
  }, pe = async () => {
227
232
  if (!o.value)
228
233
  return;
229
- const e = o.value.workspace["x-scalar-active-tab"] ?? 0, t = o.value.workspace["x-scalar-tabs"]?.[e];
230
- t && await l.value?.replace(t.path);
234
+ const e = o.value.workspace["x-scalar-active-tab"] ?? 0, a = o.value.workspace["x-scalar-tabs"]?.[e];
235
+ a && await l.value?.replace(a.path);
231
236
  }, F = (e) => {
232
237
  e && o.value?.buildSidebar(e);
233
238
  }, me = (e) => {
234
- const t = T.value?.["x-scalar-navigation"]?.name;
235
- if (!t)
239
+ const a = T.value?.["x-scalar-navigation"]?.name;
240
+ if (!a)
236
241
  return;
237
- const a = b({
238
- document: t,
242
+ const t = b({
243
+ document: a,
239
244
  path: e.path,
240
245
  method: e.method,
241
246
  example: e.exampleKey
242
247
  });
243
- (!a || a.type !== "example") && (F(t), d.value && V(d.value));
244
- }, de = 288, ve = i(() => o.value?.workspace?.["x-scalar-sidebar-width"] ?? de), fe = (e) => o.value?.update("x-scalar-sidebar-width", e), y = p(!0), he = "x-scalar-tabs", we = "x-scalar-active-tab", U = (e) => {
245
- const t = c("method", e), a = c("pathEncoded", e), n = c("documentSlug", e), u = c("workspaceSlug", e);
248
+ (!t || t.type !== "example") && (F(a), m.value && H(m.value));
249
+ }, de = 288, ve = i(() => o.value?.workspace?.["x-scalar-sidebar-width"] ?? de), fe = (e) => o.value?.update("x-scalar-sidebar-width", e), S = p(!0), he = "x-scalar-tabs", we = "x-scalar-active-tab", U = (e) => {
250
+ const a = c("method", e), t = c("pathEncoded", e), n = c("documentSlug", e), u = c("workspaceSlug", e);
246
251
  return {
247
- ...te({
252
+ ...ae({
248
253
  workspace: u,
249
254
  document: n,
250
- path: a,
251
- method: t,
255
+ path: t,
256
+ method: a,
252
257
  getEntryByLocation: b
253
258
  }),
254
- path: d.value?.path ?? ""
259
+ path: m.value?.path ?? ""
255
260
  };
256
- }, K = i(() => o.value?.workspace[he] ?? [U(d.value)]), xe = i(() => o.value?.workspace[we] ?? 0), H = async (e) => {
257
- const t = K.value[e];
258
- if (!t) {
261
+ }, K = i(() => o.value?.workspace[he] ?? [U(m.value)]), xe = i(() => o.value?.workspace[we] ?? 0), q = async (e) => {
262
+ const a = K.value[e];
263
+ if (!a) {
259
264
  console.warn(`Cannot copy URL: tab at index ${e} does not exist`);
260
265
  return;
261
266
  }
262
- const a = `${window.location.origin}${t.path}`;
267
+ const t = `${window.location.origin}${a.path}`;
263
268
  try {
264
- await navigator.clipboard.writeText(a);
269
+ await navigator.clipboard.writeText(t);
265
270
  } catch (n) {
266
271
  console.error("Failed to copy URL to clipboard:", n);
267
272
  }
268
273
  }, ge = (e) => {
269
- const t = c("workspaceSlug", e), a = c("documentSlug", e);
270
- if (v.value = c("namespace", e), k.value = t, w.value = a, B.value = c("method", e), O.value = c("pathEncoded", e), $.value = c("exampleName", e), !(!v.value || !t)) {
271
- if (e.path !== "" && ne.setCurrentPath(e.path), g(v.value, t) !== W.value?.id)
272
- return ie(v.value, t);
273
- if (a && a !== o.value?.workspace[X.workspace.activeDocument])
274
- return o?.value?.update("x-scalar-active-document", a);
275
- be(e), V(e);
274
+ const a = c("workspaceSlug", e), t = c("documentSlug", e);
275
+ if (v.value = c("namespace", e), k.value = a, x.value = t, B.value = c("method", e), O.value = c("pathEncoded", e), L.value = c("exampleName", e), !(!v.value || !a)) {
276
+ if (e.path !== "" && ne.setCurrentPath(e.path), f(v.value, a) !== W.value?.id)
277
+ return ie(v.value, a);
278
+ t && t !== o.value?.workspace[X.workspace.activeDocument] && o?.value?.update("x-scalar-active-document", t), be(e), H(e);
276
279
  }
277
280
  }, be = (e) => {
278
- const t = o.value?.workspace["x-scalar-tabs"] ?? [], a = o.value?.workspace["x-scalar-active-tab"] ?? 0, n = t[a];
279
- !n || n.path === e.path || (t[a] = U(e));
280
- }, V = (e) => {
281
- const t = c("documentSlug", e);
282
- if (!t) {
281
+ const a = o.value?.workspace["x-scalar-tabs"] ?? [], t = o.value?.workspace["x-scalar-active-tab"] ?? 0, n = a[t];
282
+ !n || n.path === e.path || (a[t] = U(e));
283
+ }, H = (e) => {
284
+ const a = c("documentSlug", e);
285
+ if (!a) {
283
286
  r.setSelected(null);
284
287
  return;
285
288
  }
286
- const a = b({
287
- document: t,
289
+ const t = b({
290
+ document: a,
288
291
  path: c("pathEncoded", e),
289
292
  method: c("method", e),
290
293
  example: c("exampleName", e)
291
294
  });
292
- a && (r.setSelected(a.id), r.setExpanded(a.id, !0));
295
+ t && (r.setSelected(t.id), r.setExpanded(t.id, !0));
293
296
  };
294
297
  re({
295
- eventBus: h,
298
+ eventBus: w,
296
299
  router: l,
297
300
  store: o,
298
301
  navigateToCurrentTab: pe,
299
302
  rebuildSidebar: F,
300
303
  onAfterExampleCreation: me,
301
- onSelectSidebarItem: _,
302
- onCopyTabUrl: (e) => H(e),
303
- onToggleSidebar: () => y.value = !y.value
304
+ onSelectSidebarItem: $,
305
+ onCopyTabUrl: (e) => q(e),
306
+ onToggleSidebar: () => S.value = !S.value
304
307
  });
305
- function Pe(e) {
308
+ function _e(e) {
306
309
  return e && (l.value = e), {
307
310
  /** Active workspace store */
308
311
  store: o,
309
312
  sidebar: {
310
313
  state: r,
311
314
  width: ve,
312
- isOpen: y,
313
- handleSelectItem: _,
315
+ isOpen: S,
316
+ handleSelectItem: $,
314
317
  handleSidebarWidthUpdate: fe,
315
318
  getEntryByLocation: b
316
319
  },
317
320
  tabs: {
318
321
  state: K,
319
322
  activeTabIndex: xe,
320
- copyTabUrl: H
323
+ copyTabUrl: q
321
324
  },
322
325
  workspace: {
323
- create: N,
326
+ create: P,
324
327
  workspaceList: I,
325
328
  activeWorkspace: W,
326
- navigateToWorkspace: L,
327
- isOpen: i(() => !!(k.value && !w.value))
329
+ navigateToWorkspace: N,
330
+ isOpen: i(() => !!(k.value && !x.value))
328
331
  },
329
- eventBus: h,
332
+ eventBus: w,
330
333
  router: l,
331
- currentRoute: d,
332
- loading: f,
334
+ currentRoute: m,
335
+ loading: h,
333
336
  activeEntities: {
334
337
  namespace: v,
335
338
  workspaceSlug: k,
336
- documentSlug: w,
339
+ documentSlug: x,
337
340
  path: O,
338
341
  method: B,
339
- exampleName: $
342
+ exampleName: L
340
343
  },
341
344
  environment: se,
342
345
  document: T
343
346
  };
344
347
  }
345
348
  export {
346
- Pe as useAppState
349
+ _e as useAppState
347
350
  };
@@ -3,7 +3,7 @@ import type { WorkspaceStore } from '@scalar/workspace-store/client';
3
3
  import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
4
4
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
5
5
  import type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace';
6
- import type { MergedSecuritySchemes } from '../../../../v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.js';
6
+ import type { MergedSecuritySchemes } from '../../../../v2/blocks/scalar-auth-selector-block/helpers/merge-security.js';
7
7
  import type { ClientPlugin } from '../../../../v2/helpers/plugins.js';
8
8
  import type { ClientLayout } from '../../../../v2/types/layout';
9
9
  /** These props are provided at the route level */
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAGlF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kEAAkE,CAAA;AAU7G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,kDAAkD;AAClD,MAAM,MAAM,UAAU,GAAG;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,MAAM,EAAE,YAAY,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,eAAe,EAAE,qBAAqB,CAAA;IACtC,cAAc,EAAE,cAAc,CAAA;IAC9B,eAAe,EAAE;QAAE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WAAW;0BACjB,IAAI;;;;;;;;;IAgIM,CAAA"}
@@ -1,14 +1,15 @@
1
- import n from "../../collection/components/Authentication.vue.js";
2
- import e from "../../collection/components/Cookies.vue.js";
3
- import o from "../../collection/components/Environment.vue.js";
4
- import m from "../../collection/components/Overview.vue.js";
5
- import a from "../../collection/components/Servers.vue.js";
6
- import t from "../../collection/components/Settings.vue.js";
7
- import c from "../../collection/DocumentCollection.vue.js";
8
- import p from "../../collection/WorkspaceCollection.vue.js";
9
- import r from "../../operation/Operation.vue.js";
10
- import { workspaceStorage as i } from "../../../helpers/storage.js";
11
- const g = [
1
+ import { mergeSearchParams as i } from "@scalar/helpers/url/merge-urls";
2
+ import s from "../../collection/components/Authentication.vue.js";
3
+ import o from "../../collection/components/Cookies.vue.js";
4
+ import n from "../../collection/components/Environment.vue.js";
5
+ import h from "../../collection/components/Overview.vue.js";
6
+ import d from "../../collection/components/Servers.vue.js";
7
+ import a from "../../collection/components/Settings.vue.js";
8
+ import f from "../../collection/DocumentCollection.vue.js";
9
+ import u from "../../collection/WorkspaceCollection.vue.js";
10
+ import l from "../../operation/Operation.vue.js";
11
+ import { workspaceStorage as m } from "../../../helpers/storage.js";
12
+ const A = [
12
13
  {
13
14
  path: "/@:namespace/:workspaceSlug",
14
15
  children: [
@@ -19,13 +20,13 @@ const g = [
19
20
  {
20
21
  name: "example",
21
22
  path: "path/:pathEncoded/method/:method/example/:exampleName",
22
- component: r
23
+ component: l
23
24
  },
24
25
  // Document Page
25
26
  {
26
27
  name: "document",
27
28
  path: "",
28
- component: c,
29
+ component: f,
29
30
  children: [
30
31
  // Redirect to overview
31
32
  {
@@ -39,37 +40,37 @@ const g = [
39
40
  {
40
41
  name: "document.overview",
41
42
  path: "overview",
42
- component: m
43
+ component: h
43
44
  },
44
45
  // Document servers
45
46
  {
46
47
  name: "document.servers",
47
48
  path: "servers",
48
- component: a
49
+ component: d
49
50
  },
50
51
  // Document environment
51
52
  {
52
53
  name: "document.environment",
53
54
  path: "environment",
54
- component: o
55
+ component: n
55
56
  },
56
57
  // Document authentication
57
58
  {
58
59
  name: "document.authentication",
59
60
  path: "authentication",
60
- component: n
61
+ component: s
61
62
  },
62
63
  // Document cookies
63
64
  {
64
65
  name: "document.cookies",
65
66
  path: "cookies",
66
- component: e
67
+ component: o
67
68
  },
68
69
  // Document settings
69
70
  {
70
71
  name: "document.settings",
71
72
  path: "settings",
72
- component: t
73
+ component: a
73
74
  }
74
75
  ]
75
76
  }
@@ -79,25 +80,25 @@ const g = [
79
80
  {
80
81
  name: "workspace",
81
82
  path: "",
82
- component: p,
83
+ component: u,
83
84
  children: [
84
85
  // Workspace environment
85
86
  {
86
87
  name: "workspace.environment",
87
88
  path: "environment",
88
- component: o
89
+ component: n
89
90
  },
90
91
  // Workspace cookies
91
92
  {
92
93
  name: "workspace.cookies",
93
94
  path: "cookies",
94
- component: e
95
+ component: o
95
96
  },
96
97
  // Workspace settings
97
98
  {
98
99
  name: "workspace.settings",
99
100
  path: "settings",
100
- component: t
101
+ component: a
101
102
  }
102
103
  ]
103
104
  }
@@ -105,9 +106,14 @@ const g = [
105
106
  },
106
107
  {
107
108
  path: "/:pathMatch(.*)*",
108
- redirect: () => i.getLastPath() ?? "/@local/local/drafts/overview"
109
+ redirect: () => {
110
+ const e = "/@local/local/drafts/overview", r = m.getLastPath() ?? e;
111
+ m.setCurrentPath(e);
112
+ const t = new URL(r, "http://example.com"), c = new URLSearchParams(window.location.search), p = i(t.searchParams, c);
113
+ return `${t.pathname}?${p.toString()}`;
114
+ }
109
115
  }
110
116
  ];
111
117
  export {
112
- g as ROUTES
118
+ A as ROUTES
113
119
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Authentication.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/collection/components/Authentication.vue"],"names":[],"mappings":";;;;;;;;;;;;;AAgOA,wBAMG"}
1
+ {"version":3,"file":"Authentication.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/collection/components/Authentication.vue"],"names":[],"mappings":";;;;;;;;;;;;;AA+OA,wBAMG"}
@@ -1,7 +1,7 @@
1
1
  import t from "./Authentication.vue2.js";
2
2
  /* empty css */
3
3
  import o from "../../../../_virtual/_plugin-vue_export-helper.js";
4
- const c = /* @__PURE__ */ o(t, [["__scopeId", "data-v-dc159f6f"]]);
4
+ const c = /* @__PURE__ */ o(t, [["__scopeId", "data-v-1bfafc56"]]);
5
5
  export {
6
6
  c as default
7
7
  };