@scalar/api-client 2.23.4 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.js +2 -2
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +8 -0
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +33 -29
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +6 -0
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
- package/dist/v2/blocks/operation-block/components/Header.vue2.js +46 -29
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts +15 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js +125 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue2.js +4 -0
- package/dist/v2/components/sidebar/SidebarMenu.vue.js +6 -6
- package/dist/v2/features/app/App.vue.d.ts +5 -0
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +89 -108
- package/dist/v2/features/app/app-state.d.ts +5 -7
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +210 -205
- package/dist/v2/features/app/hooks/use-document-watcher.js +8 -8
- package/dist/v2/features/collection/components/Environment.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Environment.vue.js +12 -11
- package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Settings.vue.js +17 -25
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js +115 -118
- package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.d.ts.map +1 -1
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts +14 -4
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts.map +1 -1
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.js +5 -6
- package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.d.ts.map +1 -1
- package/dist/v2/features/command-palette/helpers/load-document-from-source.d.ts +16 -0
- package/dist/v2/features/command-palette/helpers/load-document-from-source.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/load-document-from-source.js +34 -0
- package/dist/v2/features/command-palette/index.d.ts +4 -0
- package/dist/v2/features/command-palette/index.d.ts.map +1 -0
- package/dist/v2/features/command-palette/index.js +8 -0
- package/dist/v2/features/environments/EnvironmentsList.vue.d.ts +4 -0
- package/dist/v2/features/environments/EnvironmentsList.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/EnvironmentsList.vue.js +29 -27
- package/dist/v2/features/environments/components/Environment.vue.d.ts +1 -0
- package/dist/v2/features/environments/components/Environment.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/Environment.vue.js +37 -24
- package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.js +2 -2
- package/dist/v2/features/modal/Modal.vue2.js +39 -38
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +35 -26
- package/dist/v2/workspace-events.d.ts.map +1 -1
- package/dist/v2/workspace-events.js +7 -0
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +15 -15
- package/dist/v2/features/import-listener/ImportListener.vue.d.ts +0 -52
- package/dist/v2/features/import-listener/ImportListener.vue.d.ts.map +0 -1
- package/dist/v2/features/import-listener/ImportListener.vue.js +0 -91
- package/dist/v2/features/import-listener/ImportListener.vue2.js +0 -4
- package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts +0 -7
- package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts.map +0 -1
- package/dist/v2/features/import-listener/components/DropEventListener.vue.js +0 -81
- package/dist/v2/features/import-listener/components/DropEventListener.vue2.js +0 -4
- package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts +0 -40
- package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts.map +0 -1
- package/dist/v2/features/import-listener/components/ImportModal.vue.js +0 -170
- package/dist/v2/features/import-listener/components/ImportModal.vue3.js +0 -5
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts +0 -29
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts.map +0 -1
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.js +0 -83
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue2.js +0 -4
- package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts +0 -8
- package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts.map +0 -1
- package/dist/v2/features/import-listener/helpers/get-url-query-parameter.js +0 -4
- package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts +0 -15
- package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts.map +0 -1
- package/dist/v2/features/import-listener/helpers/load-document-from-source.js +0 -28
- package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts +0 -15
- package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts.map +0 -1
- package/dist/v2/features/import-listener/helpers/wait-for-condition.js +0 -16
- package/dist/v2/features/import-listener/index.d.ts +0 -2
- package/dist/v2/features/import-listener/index.d.ts.map +0 -1
- package/dist/v2/features/import-listener/index.js +0 -4
- /package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.d.ts +0 -0
- /package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.js +0 -0
- /package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.d.ts +0 -0
- /package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.js +0 -0
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { isDefined as
|
|
2
|
-
import { sortByOrder as
|
|
3
|
-
import { isHttpMethod as
|
|
4
|
-
import { createSidebarState as
|
|
5
|
-
import { createWorkspaceStore as
|
|
6
|
-
import { createWorkspaceEventBus as
|
|
7
|
-
import { generateUniqueValue as
|
|
8
|
-
import { getParentEntry as
|
|
9
|
-
import { createWorkspaceStorePersistence as
|
|
10
|
-
import { persistencePlugin as
|
|
11
|
-
import { extensions as
|
|
12
|
-
import { shallowRef as
|
|
13
|
-
import { getActiveEnvironment as
|
|
1
|
+
import { isDefined as B } 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 z, generateReverseIndex as J } from "@scalar/sidebar";
|
|
5
|
+
import { createWorkspaceStore as O } from "@scalar/workspace-store/client";
|
|
6
|
+
import { createWorkspaceEventBus as M } from "@scalar/workspace-store/events";
|
|
7
|
+
import { generateUniqueValue as G } from "@scalar/workspace-store/helpers/generate-unique-value";
|
|
8
|
+
import { getParentEntry as v } from "@scalar/workspace-store/navigation";
|
|
9
|
+
import { createWorkspaceStorePersistence as Q } from "@scalar/workspace-store/persistence";
|
|
10
|
+
import { persistencePlugin as X } from "@scalar/workspace-store/plugins/client";
|
|
11
|
+
import { extensions as Z } from "@scalar/workspace-store/schemas/extensions";
|
|
12
|
+
import { shallowRef as T, computed as i, ref as p, watch as ee } from "vue";
|
|
13
|
+
import { getActiveEnvironment as te } from "../../helpers/get-active-environment.js";
|
|
14
14
|
import { getTabDetails as ae } from "../../helpers/get-tab-details.js";
|
|
15
|
-
import { slugify as
|
|
16
|
-
import { workspaceStorage as
|
|
17
|
-
import { initializeAppEventHandlers as
|
|
18
|
-
const
|
|
15
|
+
import { slugify as ne } from "../../helpers/slugify.js";
|
|
16
|
+
import { workspaceStorage as re } from "../../helpers/storage.js";
|
|
17
|
+
import { initializeAppEventHandlers as oe } from "./app-events.js";
|
|
18
|
+
const se = 1e3, b = M({
|
|
19
19
|
debug: !1
|
|
20
|
-
}),
|
|
21
|
-
|
|
22
|
-
e && e.afterEach((
|
|
20
|
+
}), f = p(void 0), E = p(void 0), k = p(void 0), L = p(void 0), N = p(void 0), P = p(void 0), x = p(!1), u = T(null);
|
|
21
|
+
ee(u, (e) => {
|
|
22
|
+
e && e.afterEach((t) => be(t));
|
|
23
23
|
});
|
|
24
|
-
const
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
if (typeof
|
|
28
|
-
return e === "method" ?
|
|
24
|
+
const d = i(() => u.value?.currentRoute.value ?? null);
|
|
25
|
+
function s(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);
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
(e) => e.map(({ teamUid:
|
|
33
|
-
id:
|
|
34
|
-
teamUid:
|
|
35
|
-
namespace:
|
|
30
|
+
const D = T(null), h = p([]), o = T(null), R = i(() => o.value?.workspace.documents[k.value ?? ""] || null), ce = i(() => te(o.value, R.value)), { workspace: y } = await Q(), w = (e, t) => `${e}/${t}`;
|
|
31
|
+
h.value = await y.getAll().then(
|
|
32
|
+
(e) => e.map(({ teamUid: t, namespace: a, slug: n, name: l }) => ({
|
|
33
|
+
id: w(a, n),
|
|
34
|
+
teamUid: t,
|
|
35
|
+
namespace: a,
|
|
36
36
|
slug: n,
|
|
37
|
-
label:
|
|
37
|
+
label: l
|
|
38
38
|
}))
|
|
39
39
|
);
|
|
40
|
-
const
|
|
40
|
+
const ue = async ({ namespace: e, slug: t }) => O({
|
|
41
41
|
plugins: [
|
|
42
|
-
await
|
|
42
|
+
await X({ workspaceId: w(e, t), debounceDelay: se })
|
|
43
43
|
]
|
|
44
|
-
}),
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
44
|
+
}), le = async (e, t) => {
|
|
45
|
+
const a = await y.getItem({ namespace: e, slug: t });
|
|
46
|
+
if (!a)
|
|
47
47
|
return {
|
|
48
48
|
success: !1
|
|
49
49
|
};
|
|
50
|
-
const n = await
|
|
51
|
-
return n.loadWorkspace(
|
|
50
|
+
const n = await ue({ namespace: e, slug: t });
|
|
51
|
+
return n.loadWorkspace(a.workspace), D.value = { id: w(a.namespace, a.slug), label: a.name }, o.value = n, {
|
|
52
52
|
success: !0,
|
|
53
53
|
workspace: n.workspace
|
|
54
54
|
};
|
|
55
|
-
},
|
|
55
|
+
}, ie = async ({
|
|
56
56
|
name: e,
|
|
57
|
-
teamUid:
|
|
58
|
-
namespace:
|
|
57
|
+
teamUid: t,
|
|
58
|
+
namespace: a,
|
|
59
59
|
slug: n
|
|
60
60
|
}) => {
|
|
61
|
-
const
|
|
62
|
-
await
|
|
61
|
+
const l = O();
|
|
62
|
+
await l.addDocument({
|
|
63
63
|
name: "drafts",
|
|
64
64
|
document: {
|
|
65
65
|
openapi: "3.1.0",
|
|
@@ -76,275 +76,280 @@ const ce = async ({ namespace: e, slug: a }) => C({
|
|
|
76
76
|
"x-scalar-icon": "interface-edit-tool-pencil"
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
-
const
|
|
80
|
-
{ namespace:
|
|
79
|
+
const c = await y.setItem(
|
|
80
|
+
{ namespace: a, slug: n },
|
|
81
81
|
{
|
|
82
82
|
name: e,
|
|
83
|
-
teamUid:
|
|
84
|
-
workspace:
|
|
83
|
+
teamUid: t,
|
|
84
|
+
workspace: l.exportWorkspace()
|
|
85
85
|
}
|
|
86
86
|
);
|
|
87
|
-
return
|
|
88
|
-
id:
|
|
89
|
-
teamUid:
|
|
90
|
-
namespace:
|
|
91
|
-
slug:
|
|
92
|
-
label:
|
|
93
|
-
}),
|
|
94
|
-
},
|
|
95
|
-
await
|
|
87
|
+
return h.value.push({
|
|
88
|
+
id: w(c.namespace, c.slug),
|
|
89
|
+
teamUid: c.teamUid,
|
|
90
|
+
namespace: c.namespace,
|
|
91
|
+
slug: c.slug,
|
|
92
|
+
label: c.name
|
|
93
|
+
}), c;
|
|
94
|
+
}, A = async (e, t) => {
|
|
95
|
+
await u.value?.push({
|
|
96
96
|
name: "workspace.environment",
|
|
97
|
-
params: { namespace: e, workspaceSlug:
|
|
97
|
+
params: { namespace: e, workspaceSlug: t }
|
|
98
98
|
});
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
}, _ = async ({
|
|
100
|
+
teamUid: e,
|
|
101
|
+
namespace: t,
|
|
102
|
+
slug: a,
|
|
103
|
+
name: n
|
|
102
104
|
}) => {
|
|
103
105
|
o.value = null;
|
|
104
|
-
const
|
|
105
|
-
defaultValue:
|
|
106
|
+
const l = await G({
|
|
107
|
+
defaultValue: a ?? n,
|
|
106
108
|
// Use the provided id if it exists, otherwise use the name
|
|
107
|
-
validation: async (
|
|
109
|
+
validation: async (g) => !await y.has({ namespace: t ?? "local", slug: g }),
|
|
108
110
|
maxRetries: 100,
|
|
109
|
-
transformation:
|
|
111
|
+
transformation: ne
|
|
110
112
|
});
|
|
111
|
-
if (!
|
|
113
|
+
if (!l)
|
|
112
114
|
return;
|
|
113
|
-
const
|
|
114
|
-
teamUid: e
|
|
115
|
-
namespace:
|
|
116
|
-
slug:
|
|
117
|
-
name:
|
|
118
|
-
}
|
|
119
|
-
return await
|
|
120
|
-
},
|
|
121
|
-
o.value = null,
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
path:
|
|
127
|
-
query:
|
|
128
|
-
}),
|
|
115
|
+
const m = await ie({
|
|
116
|
+
teamUid: e,
|
|
117
|
+
namespace: t,
|
|
118
|
+
slug: l,
|
|
119
|
+
name: n
|
|
120
|
+
});
|
|
121
|
+
return await A(m.namespace, m.slug), m;
|
|
122
|
+
}, pe = async (e, t) => {
|
|
123
|
+
o.value = null, x.value = !0;
|
|
124
|
+
const a = await le(e, t);
|
|
125
|
+
if (a.success) {
|
|
126
|
+
const c = a.workspace["x-scalar-active-tab"] ?? 0, m = a.workspace["x-scalar-tabs"], g = m?.[c];
|
|
127
|
+
g && await u.value?.replace({
|
|
128
|
+
path: g.path,
|
|
129
|
+
query: d.value?.query ?? {}
|
|
130
|
+
}), m && c >= m.length && b.emit("tabs:update:tabs", {
|
|
129
131
|
"x-scalar-active-tab": 0
|
|
130
|
-
}),
|
|
131
|
-
"x-scalar-tabs": [
|
|
132
|
+
}), m || b.emit("tabs:update:tabs", {
|
|
133
|
+
"x-scalar-tabs": [C(d.value)],
|
|
132
134
|
"x-scalar-active-tab": 0
|
|
133
|
-
}),
|
|
135
|
+
}), x.value = !1;
|
|
134
136
|
return;
|
|
135
137
|
}
|
|
136
|
-
const n =
|
|
138
|
+
const n = h.value.find((c) => c.slug === "default") ?? h.value[0];
|
|
139
|
+
if (n)
|
|
140
|
+
return A(n.namespace, n.slug);
|
|
141
|
+
const l = await _({
|
|
137
142
|
name: "Default Workspace",
|
|
138
|
-
|
|
143
|
+
slug: "default"
|
|
139
144
|
});
|
|
140
|
-
if (
|
|
145
|
+
if (x.value = !1, !l)
|
|
141
146
|
return console.error("Failed to create the default workspace, something went wrong, can not load the workspace");
|
|
142
147
|
r.reset();
|
|
143
|
-
},
|
|
148
|
+
}, $ = i(() => {
|
|
144
149
|
const e = o.value;
|
|
145
150
|
if (!e)
|
|
146
151
|
return [];
|
|
147
|
-
const
|
|
148
|
-
return
|
|
149
|
-
}), r =
|
|
152
|
+
const t = e.workspace["x-scalar-order"] ?? Object.keys(e.workspace.documents);
|
|
153
|
+
return Y(Object.keys(e.workspace.documents), t, (a) => a).map((a) => e.workspace.documents[a]?.["x-scalar-navigation"]).filter(B);
|
|
154
|
+
}), r = z($), W = ({
|
|
150
155
|
document: e,
|
|
151
|
-
path:
|
|
152
|
-
method:
|
|
156
|
+
path: t,
|
|
157
|
+
method: a,
|
|
153
158
|
example: n
|
|
154
|
-
}) => JSON.stringify([e,
|
|
155
|
-
() =>
|
|
156
|
-
items:
|
|
159
|
+
}) => JSON.stringify([e, t, a, n].filter(B)), U = i(
|
|
160
|
+
() => J({
|
|
161
|
+
items: $.value,
|
|
157
162
|
nestedKey: "children",
|
|
158
163
|
filter: (e) => e.type === "document" || e.type === "operation" || e.type === "example",
|
|
159
164
|
getId: (e) => {
|
|
160
|
-
const
|
|
161
|
-
return
|
|
162
|
-
document:
|
|
163
|
-
path:
|
|
164
|
-
method:
|
|
165
|
+
const t = v("document", e), a = v("operation", e);
|
|
166
|
+
return W({
|
|
167
|
+
document: t?.name ?? "",
|
|
168
|
+
path: a?.path,
|
|
169
|
+
method: a?.method,
|
|
165
170
|
example: e.type === "example" ? e.name : void 0
|
|
166
171
|
});
|
|
167
172
|
}
|
|
168
173
|
})
|
|
169
|
-
),
|
|
170
|
-
const
|
|
171
|
-
return
|
|
172
|
-
|
|
174
|
+
), S = (e) => {
|
|
175
|
+
const t = U.value.get(W(e));
|
|
176
|
+
return t || U.value.get(
|
|
177
|
+
W({
|
|
173
178
|
document: e.document,
|
|
174
179
|
path: e.path,
|
|
175
180
|
method: e.method
|
|
176
181
|
})
|
|
177
182
|
);
|
|
178
|
-
},
|
|
179
|
-
const
|
|
180
|
-
if (!
|
|
183
|
+
}, F = (e) => {
|
|
184
|
+
const t = r.getEntryById(e);
|
|
185
|
+
if (!t) {
|
|
181
186
|
console.warn(`Could not find sidebar entry with id ${e} to select`);
|
|
182
187
|
return;
|
|
183
188
|
}
|
|
184
|
-
if (
|
|
189
|
+
if (t.type === "document") {
|
|
185
190
|
if (r.selectedItem.value === e) {
|
|
186
191
|
r.setExpanded(e, !r.isExpanded(e));
|
|
187
192
|
return;
|
|
188
193
|
}
|
|
189
|
-
return r.setSelected(e), r.setExpanded(e, !0),
|
|
194
|
+
return r.setSelected(e), r.setExpanded(e, !0), u.value?.push({
|
|
190
195
|
name: "document.overview",
|
|
191
|
-
params: { documentSlug:
|
|
196
|
+
params: { documentSlug: t.name }
|
|
192
197
|
});
|
|
193
198
|
}
|
|
194
|
-
if (
|
|
199
|
+
if (t.type === "operation") {
|
|
195
200
|
if (r.isSelected(e)) {
|
|
196
201
|
r.setExpanded(e, !r.isExpanded(e));
|
|
197
202
|
return;
|
|
198
203
|
}
|
|
199
|
-
const
|
|
200
|
-
return
|
|
204
|
+
const a = t.children?.find((n) => n.type === "example");
|
|
205
|
+
return a ? (r.setSelected(a.id), r.setExpanded(a.id, !0)) : r.setSelected(e), u.value?.push({
|
|
201
206
|
name: "example",
|
|
202
207
|
params: {
|
|
203
|
-
documentSlug:
|
|
204
|
-
pathEncoded: encodeURIComponent(
|
|
205
|
-
method:
|
|
206
|
-
exampleName:
|
|
208
|
+
documentSlug: v("document", t)?.name,
|
|
209
|
+
pathEncoded: encodeURIComponent(t.path),
|
|
210
|
+
method: t.method,
|
|
211
|
+
exampleName: a?.name ?? "default"
|
|
207
212
|
}
|
|
208
213
|
});
|
|
209
214
|
}
|
|
210
|
-
if (
|
|
215
|
+
if (t.type === "example") {
|
|
211
216
|
r.setSelected(e);
|
|
212
|
-
const
|
|
213
|
-
return
|
|
217
|
+
const a = v("operation", t);
|
|
218
|
+
return u.value?.push({
|
|
214
219
|
name: "example",
|
|
215
220
|
params: {
|
|
216
|
-
documentSlug:
|
|
217
|
-
pathEncoded: encodeURIComponent(
|
|
218
|
-
method:
|
|
219
|
-
exampleName:
|
|
221
|
+
documentSlug: v("document", t)?.name,
|
|
222
|
+
pathEncoded: encodeURIComponent(a?.path ?? ""),
|
|
223
|
+
method: a?.method,
|
|
224
|
+
exampleName: t.name
|
|
220
225
|
}
|
|
221
226
|
});
|
|
222
227
|
}
|
|
223
|
-
if (
|
|
224
|
-
return
|
|
228
|
+
if (t.type === "text")
|
|
229
|
+
return u.value?.push({
|
|
225
230
|
name: "document.overview",
|
|
226
231
|
params: {
|
|
227
|
-
documentSlug:
|
|
232
|
+
documentSlug: v("document", t)?.name
|
|
228
233
|
}
|
|
229
234
|
});
|
|
230
235
|
r.setExpanded(e, !r.isExpanded(e));
|
|
231
|
-
},
|
|
236
|
+
}, me = async () => {
|
|
232
237
|
if (!o.value)
|
|
233
238
|
return;
|
|
234
|
-
const e = o.value.workspace["x-scalar-active-tab"] ?? 0,
|
|
235
|
-
|
|
236
|
-
},
|
|
239
|
+
const e = o.value.workspace["x-scalar-active-tab"] ?? 0, t = o.value.workspace["x-scalar-tabs"]?.[e];
|
|
240
|
+
t && await u.value?.replace(t.path);
|
|
241
|
+
}, K = (e) => {
|
|
237
242
|
e && o.value?.buildSidebar(e);
|
|
238
|
-
},
|
|
239
|
-
const
|
|
240
|
-
if (!
|
|
243
|
+
}, de = (e) => {
|
|
244
|
+
const t = R.value?.["x-scalar-navigation"]?.name;
|
|
245
|
+
if (!t)
|
|
241
246
|
return;
|
|
242
|
-
const
|
|
243
|
-
document:
|
|
247
|
+
const a = S({
|
|
248
|
+
document: t,
|
|
244
249
|
path: e.path,
|
|
245
250
|
method: e.method,
|
|
246
251
|
example: e.exampleKey
|
|
247
252
|
});
|
|
248
|
-
(!
|
|
249
|
-
},
|
|
250
|
-
const
|
|
253
|
+
(!a || a.type !== "example") && (K(t), d.value && V(d.value));
|
|
254
|
+
}, ve = 288, fe = i(() => o.value?.workspace?.["x-scalar-sidebar-width"] ?? ve), he = (e) => o.value?.update("x-scalar-sidebar-width", e), I = p(!0), we = "x-scalar-tabs", ge = "x-scalar-active-tab", C = (e) => {
|
|
255
|
+
const t = s("method", e), a = s("pathEncoded", e), n = s("documentSlug", e), l = s("workspaceSlug", e);
|
|
251
256
|
return {
|
|
252
257
|
...ae({
|
|
253
|
-
workspace:
|
|
258
|
+
workspace: l,
|
|
254
259
|
document: n,
|
|
255
|
-
path:
|
|
256
|
-
method:
|
|
257
|
-
getEntryByLocation:
|
|
260
|
+
path: a,
|
|
261
|
+
method: t,
|
|
262
|
+
getEntryByLocation: S
|
|
258
263
|
}),
|
|
259
|
-
path:
|
|
264
|
+
path: d.value?.path ?? ""
|
|
260
265
|
};
|
|
261
|
-
},
|
|
262
|
-
const
|
|
263
|
-
if (!
|
|
266
|
+
}, q = i(() => o.value?.workspace[we] ?? [C(d.value)]), xe = i(() => o.value?.workspace[ge] ?? 0), H = async (e) => {
|
|
267
|
+
const t = q.value[e];
|
|
268
|
+
if (!t) {
|
|
264
269
|
console.warn(`Cannot copy URL: tab at index ${e} does not exist`);
|
|
265
270
|
return;
|
|
266
271
|
}
|
|
267
|
-
const
|
|
272
|
+
const a = `${window.location.origin}${t.path}`;
|
|
268
273
|
try {
|
|
269
|
-
await navigator.clipboard.writeText(
|
|
274
|
+
await navigator.clipboard.writeText(a);
|
|
270
275
|
} catch (n) {
|
|
271
276
|
console.error("Failed to copy URL to clipboard:", n);
|
|
272
277
|
}
|
|
273
|
-
}, ge = (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);
|
|
279
|
-
}
|
|
280
278
|
}, be = (e) => {
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
279
|
+
const t = s("workspaceSlug", e), a = s("documentSlug", e);
|
|
280
|
+
if (f.value = s("namespace", e), E.value = t, k.value = a, L.value = s("method", e), N.value = s("pathEncoded", e), P.value = s("exampleName", e), !(!f.value || !t)) {
|
|
281
|
+
if (e.path !== "" && re.setCurrentPath(e.path), w(f.value, t) !== D.value?.id)
|
|
282
|
+
return pe(f.value, t);
|
|
283
|
+
a && a !== o.value?.workspace[Z.workspace.activeDocument] && o?.value?.update("x-scalar-active-document", a), ke(e), V(e);
|
|
284
|
+
}
|
|
285
|
+
}, ke = (e) => {
|
|
286
|
+
const t = o.value?.workspace["x-scalar-tabs"] ?? [], a = o.value?.workspace["x-scalar-active-tab"] ?? 0, n = t[a];
|
|
287
|
+
!n || n.path === e.path || (t[a] = C(e));
|
|
288
|
+
}, V = (e) => {
|
|
289
|
+
const t = s("documentSlug", e);
|
|
290
|
+
if (!t) {
|
|
286
291
|
r.setSelected(null);
|
|
287
292
|
return;
|
|
288
293
|
}
|
|
289
|
-
const
|
|
290
|
-
document:
|
|
291
|
-
path:
|
|
292
|
-
method:
|
|
293
|
-
example:
|
|
294
|
+
const a = S({
|
|
295
|
+
document: t,
|
|
296
|
+
path: s("pathEncoded", e),
|
|
297
|
+
method: s("method", e),
|
|
298
|
+
example: s("exampleName", e)
|
|
294
299
|
});
|
|
295
|
-
|
|
300
|
+
a && (r.setSelected(a.id), r.setExpanded(a.id, !0));
|
|
296
301
|
};
|
|
297
|
-
|
|
298
|
-
eventBus:
|
|
299
|
-
router:
|
|
302
|
+
oe({
|
|
303
|
+
eventBus: b,
|
|
304
|
+
router: u,
|
|
300
305
|
store: o,
|
|
301
|
-
navigateToCurrentTab:
|
|
302
|
-
rebuildSidebar:
|
|
303
|
-
onAfterExampleCreation:
|
|
304
|
-
onSelectSidebarItem:
|
|
305
|
-
onCopyTabUrl: (e) =>
|
|
306
|
-
onToggleSidebar: () =>
|
|
306
|
+
navigateToCurrentTab: me,
|
|
307
|
+
rebuildSidebar: K,
|
|
308
|
+
onAfterExampleCreation: de,
|
|
309
|
+
onSelectSidebarItem: F,
|
|
310
|
+
onCopyTabUrl: (e) => H(e),
|
|
311
|
+
onToggleSidebar: () => I.value = !I.value
|
|
307
312
|
});
|
|
308
|
-
function
|
|
309
|
-
return e && (
|
|
313
|
+
function $e(e) {
|
|
314
|
+
return e && (u.value = e), {
|
|
310
315
|
/** Active workspace store */
|
|
311
316
|
store: o,
|
|
312
317
|
sidebar: {
|
|
313
318
|
state: r,
|
|
314
|
-
width:
|
|
315
|
-
isOpen:
|
|
316
|
-
handleSelectItem:
|
|
317
|
-
handleSidebarWidthUpdate:
|
|
318
|
-
getEntryByLocation:
|
|
319
|
+
width: fe,
|
|
320
|
+
isOpen: I,
|
|
321
|
+
handleSelectItem: F,
|
|
322
|
+
handleSidebarWidthUpdate: he,
|
|
323
|
+
getEntryByLocation: S
|
|
319
324
|
},
|
|
320
325
|
tabs: {
|
|
321
|
-
state:
|
|
326
|
+
state: q,
|
|
322
327
|
activeTabIndex: xe,
|
|
323
|
-
copyTabUrl:
|
|
328
|
+
copyTabUrl: H
|
|
324
329
|
},
|
|
325
330
|
workspace: {
|
|
326
|
-
create:
|
|
327
|
-
workspaceList:
|
|
328
|
-
activeWorkspace:
|
|
329
|
-
navigateToWorkspace:
|
|
330
|
-
isOpen: i(() => !!(
|
|
331
|
+
create: _,
|
|
332
|
+
workspaceList: h,
|
|
333
|
+
activeWorkspace: D,
|
|
334
|
+
navigateToWorkspace: A,
|
|
335
|
+
isOpen: i(() => !!(E.value && !k.value))
|
|
331
336
|
},
|
|
332
|
-
eventBus:
|
|
333
|
-
router:
|
|
334
|
-
currentRoute:
|
|
335
|
-
loading:
|
|
337
|
+
eventBus: b,
|
|
338
|
+
router: u,
|
|
339
|
+
currentRoute: d,
|
|
340
|
+
loading: x,
|
|
336
341
|
activeEntities: {
|
|
337
|
-
namespace:
|
|
338
|
-
workspaceSlug:
|
|
339
|
-
documentSlug:
|
|
340
|
-
path:
|
|
341
|
-
method:
|
|
342
|
-
exampleName:
|
|
342
|
+
namespace: f,
|
|
343
|
+
workspaceSlug: E,
|
|
344
|
+
documentSlug: k,
|
|
345
|
+
path: N,
|
|
346
|
+
method: L,
|
|
347
|
+
exampleName: P
|
|
343
348
|
},
|
|
344
|
-
environment:
|
|
345
|
-
document:
|
|
349
|
+
environment: ce,
|
|
350
|
+
document: R
|
|
346
351
|
};
|
|
347
352
|
}
|
|
348
353
|
export {
|
|
349
|
-
|
|
354
|
+
$e as useAppState
|
|
350
355
|
};
|
|
@@ -29,32 +29,32 @@ const p = 5 * 1e3, M = 60 * 1e3, E = () => {
|
|
|
29
29
|
const a = g(() => {
|
|
30
30
|
const r = l(e), o = l(t);
|
|
31
31
|
return !r || !o ? null : r.workspace.documents[o];
|
|
32
|
-
}), c = E(),
|
|
33
|
-
|
|
32
|
+
}), c = E(), s = V(u), f = () => {
|
|
33
|
+
s.reset(), c.schedule(i, s.get());
|
|
34
34
|
}, d = () => {
|
|
35
|
-
|
|
35
|
+
s.backoff(), c.schedule(i, s.get());
|
|
36
36
|
}, i = async () => {
|
|
37
37
|
const r = l(e), o = l(t), m = a.value?.["x-scalar-original-source-url"];
|
|
38
38
|
if (!r || !o || !m)
|
|
39
39
|
return;
|
|
40
|
-
const
|
|
40
|
+
const n = await r.rebaseDocument({
|
|
41
41
|
name: o,
|
|
42
42
|
url: m
|
|
43
43
|
});
|
|
44
|
-
|
|
44
|
+
n?.ok ? (await n.applyChanges(k(n.conflicts)), f()) : n?.ok === !1 && n.type === "NO_CHANGES_DETECTED" ? f() : d();
|
|
45
45
|
};
|
|
46
46
|
h(
|
|
47
47
|
[() => a.value?.["x-scalar-original-source-url"], () => a.value?.["x-scalar-watch-mode"]],
|
|
48
|
-
([r, o = !
|
|
48
|
+
([r, o = !1]) => {
|
|
49
49
|
if (!l(e)) {
|
|
50
50
|
c.clear();
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
53
|
if (c.clear(), !r || !o) {
|
|
54
|
-
|
|
54
|
+
s.reset();
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
c.schedule(i,
|
|
57
|
+
c.schedule(i, s.get());
|
|
58
58
|
},
|
|
59
59
|
{ immediate: !0 }
|
|
60
60
|
), T(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Environment.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/collection/components/Environment.vue"],"names":[],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Environment.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/collection/components/Environment.vue"],"names":[],"mappings":";;;;;;;;;;;;;AA6JA,wBAMG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as a, computed as n, createElementBlock as s, openBlock as i, createStaticVNode as l, createVNode as r, unref as m } from "vue";
|
|
2
|
+
import v from "../../environments/EnvironmentsList.vue.js";
|
|
3
|
+
const u = { class: "flex flex-col gap-4" }, x = /* @__PURE__ */ a({
|
|
4
4
|
__name: "Environment",
|
|
5
5
|
props: {
|
|
6
6
|
documentSlug: {},
|
|
@@ -18,19 +18,20 @@ const v = { class: "flex flex-col gap-4" }, f = /* @__PURE__ */ o({
|
|
|
18
18
|
collectionType: {}
|
|
19
19
|
},
|
|
20
20
|
setup(e) {
|
|
21
|
-
const
|
|
21
|
+
const o = n(
|
|
22
22
|
() => (e.collectionType === "document" ? e.document["x-scalar-environments"] : e.workspaceStore.workspace["x-scalar-environments"]) ?? {}
|
|
23
|
-
);
|
|
24
|
-
return (d, t) => (
|
|
25
|
-
t[0] || (t[0] =
|
|
26
|
-
|
|
23
|
+
), c = n(() => e.workspaceStore.workspace["x-scalar-active-environment"]);
|
|
24
|
+
return (d, t) => (i(), s("div", u, [
|
|
25
|
+
t[0] || (t[0] = l('<div class="flex items-start justify-between gap-2"><div class="flex flex-col gap-2"><div class="flex h-8 items-center"><h3 class="font-bold">Environment Variables</h3></div><p class="text-c-2 mb-4 text-sm"> Set environment variables at your collection level. Use <code class="font-code text-c-2"> {{ variable }} </code> to add / search among the selected environment's variables in your request inputs. </p></div></div>', 1)),
|
|
26
|
+
r(m(v), {
|
|
27
|
+
activeEnvironment: c.value,
|
|
27
28
|
collectionType: e.collectionType,
|
|
28
|
-
environments:
|
|
29
|
+
environments: o.value,
|
|
29
30
|
eventBus: e.eventBus
|
|
30
|
-
}, null, 8, ["collectionType", "environments", "eventBus"])
|
|
31
|
+
}, null, 8, ["activeEnvironment", "collectionType", "environments", "eventBus"])
|
|
31
32
|
]));
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
+
x as default
|
|
36
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/collection/components/Settings.vue"],"names":[],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Settings.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/collection/components/Settings.vue"],"names":[],"mappings":";;;;;;;;;;;;;AA6KA,wBAMG"}
|