@scalar/api-client 2.1.48 → 2.1.49
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 +14 -0
- package/dist/assets/keycap.ascii.js +25 -0
- package/dist/components/CodeInput/codeVariableWidget.js +12 -12
- package/dist/components/ViewLayout/ViewLayoutSection.vue.js +2 -2
- package/dist/store/requests.d.ts +40 -0
- package/dist/store/requests.d.ts.map +1 -1
- package/dist/store/requests.js +65 -55
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/store/workspace.js +24 -29
- package/dist/style.css +1 -1
- package/dist/views/Request/RequestSection/RequestPathParams.vue.js +23 -23
- package/dist/views/Request/RequestSidebar.vue.d.ts +2 -0
- package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebar.vue.js +2 -2
- package/dist/views/Request/RequestSidebar.vue2.js +169 -133
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItem.vue2.js +181 -155
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts +2 -0
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +3 -3
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +155 -96
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +74 -34
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @scalar/api-client
|
|
2
2
|
|
|
3
|
+
## 2.1.49
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 49ccdee: refactor: updates regexHelpers
|
|
8
|
+
- 45342e3: style(api-client): add import button and command k ascii art in empty state
|
|
9
|
+
- d0c93f5: feat: adds clear drafts action to draft collection
|
|
10
|
+
- 8b54fac: fix(api-client): overflow scroll mobile on api client
|
|
11
|
+
- Updated dependencies [49ccdee]
|
|
12
|
+
- Updated dependencies [0a34402]
|
|
13
|
+
- @scalar/oas-utils@0.2.75
|
|
14
|
+
- @scalar/components@0.12.69
|
|
15
|
+
- @scalar/use-codemirror@0.11.36
|
|
16
|
+
|
|
3
17
|
## 2.1.48
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const n = ` .:=+++++=================-
|
|
2
|
+
.--#* :.
|
|
3
|
+
.-:-** -.
|
|
4
|
+
.:-::-+* =:
|
|
5
|
+
.:-:::-=# ::
|
|
6
|
+
.-:::----** ..
|
|
7
|
+
.-:::::---=# ..
|
|
8
|
+
:-::::::----** ..
|
|
9
|
+
.:-::::::::----*= ..
|
|
10
|
+
.-::::::::------+- ..
|
|
11
|
+
..::::::::-------= ..
|
|
12
|
+
.:::::----------++ ..
|
|
13
|
+
.:::----------+**+*++*+*++*+++*++++++++++:.
|
|
14
|
+
------------+*+=-=======================.
|
|
15
|
+
.----------+*+=========================:.
|
|
16
|
+
:--------+*+=-========================.
|
|
17
|
+
.=------+*+=-========================:.
|
|
18
|
+
.=----+*+=-------=================+-.
|
|
19
|
+
.----+*+=----------================.
|
|
20
|
+
.:=-+*+=----------=-==============-
|
|
21
|
+
.-+*+=----------------===========.
|
|
22
|
+
.-+=------------------====-====:.`;
|
|
23
|
+
export {
|
|
24
|
+
n as default
|
|
25
|
+
};
|
|
@@ -2,11 +2,11 @@ var m = Object.defineProperty;
|
|
|
2
2
|
var v = (n, t, e) => t in n ? m(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
3
|
var l = (n, t, e) => v(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import { ScalarButton as h, ScalarIcon as f, ScalarTooltip as b } from "@scalar/components";
|
|
5
|
-
import {
|
|
5
|
+
import { REGEX as g } from "@scalar/oas-utils/helpers";
|
|
6
6
|
import { ViewPlugin as E, RangeSetBuilder as y, Decoration as x, EditorView as w, WidgetType as N } from "@scalar/use-codemirror";
|
|
7
|
-
import { defineComponent as C, h as o, createApp as
|
|
8
|
-
import { parseEnvVariables as
|
|
9
|
-
const
|
|
7
|
+
import { defineComponent as C, h as o, createApp as R } from "vue";
|
|
8
|
+
import { parseEnvVariables as S } from "../../libs/environment-parser.js";
|
|
9
|
+
const V = (n) => n.value ? n.value.color : "#8E8E8E";
|
|
10
10
|
class d extends N {
|
|
11
11
|
constructor(e, a, i, s) {
|
|
12
12
|
super();
|
|
@@ -22,9 +22,9 @@ class d extends N {
|
|
|
22
22
|
const a = C({
|
|
23
23
|
props: { variableName: { type: String, default: null } },
|
|
24
24
|
render: () => {
|
|
25
|
-
const i =
|
|
25
|
+
const i = S(this.activeEnvVariables.value).find(
|
|
26
26
|
(c) => c.key === this.variableName
|
|
27
|
-
), s = i && this.activeEnvironment.value ?
|
|
27
|
+
), s = i && this.activeEnvironment.value ? V(this.activeEnvironment) : "#8E8E8E";
|
|
28
28
|
e.style.setProperty("--tw-bg-base", s), e.style.opacity = i != null && i.value ? "1" : "0.5";
|
|
29
29
|
const r = i != null && i.value ? o("div", { class: "p-2" }, i.value) : o("div", { class: "divide-y divide-1/2 grid" }, [
|
|
30
30
|
o("span", { class: "p-2 opacity-25" }, "No value"),
|
|
@@ -74,7 +74,7 @@ class d extends N {
|
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
-
return this.app =
|
|
77
|
+
return this.app = R(a, { variableName: this.variableName }), this.app.mount(e), e;
|
|
78
78
|
}
|
|
79
79
|
destroy() {
|
|
80
80
|
this.app && this.app.unmount();
|
|
@@ -86,7 +86,7 @@ class d extends N {
|
|
|
86
86
|
return !1;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
const
|
|
89
|
+
const I = (n) => E.fromClass(
|
|
90
90
|
class {
|
|
91
91
|
constructor(t) {
|
|
92
92
|
l(this, "decorations");
|
|
@@ -100,7 +100,7 @@ const T = (n) => E.fromClass(
|
|
|
100
100
|
for (const { from: a, to: i } of t.visibleRanges) {
|
|
101
101
|
const s = t.state.doc.sliceString(a, i);
|
|
102
102
|
let r;
|
|
103
|
-
for (; (r = g.exec(s)) !== null; ) {
|
|
103
|
+
for (; (r = g.VARIABLES.exec(s)) !== null; ) {
|
|
104
104
|
const c = a + r.index, p = c + r[0].length, u = r[1];
|
|
105
105
|
e.add(
|
|
106
106
|
c,
|
|
@@ -123,7 +123,7 @@ const T = (n) => E.fromClass(
|
|
|
123
123
|
{
|
|
124
124
|
decorations: (t) => t.decorations
|
|
125
125
|
}
|
|
126
|
-
),
|
|
126
|
+
), T = w.domEventHandlers({
|
|
127
127
|
keydown(n, t) {
|
|
128
128
|
if (n.key === "Backspace") {
|
|
129
129
|
const { state: e } = t, { from: a, to: i } = e.selection.main;
|
|
@@ -142,6 +142,6 @@ const T = (n) => E.fromClass(
|
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
export {
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
T as backspaceCommand,
|
|
146
|
+
I as pillPlugin
|
|
147
147
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { openBlock as o, createElementBlock as l, createElementVNode as n, renderSlot as t } from "vue";
|
|
2
2
|
import s from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
-
const r = {}, c = { class: "flex h-full xl:min-w-0 xl:flex-1 flex-col xl:custom-scroll bg-b-1" }, i = { class: "min-h-12 xl:min-h-header flex items-center border-b-1/2 px-3.5 py-1.5 md:px-4 md:py-2 xl:px-6 xl:pr-5 text-sm font-medium sticky top-0 bg-b-1 xl:rounded-none z-1" };
|
|
4
|
-
function m(e,
|
|
3
|
+
const r = {}, c = { class: "flex xl:h-full xl:min-w-0 xl:flex-1 flex-col xl:custom-scroll bg-b-1" }, i = { class: "min-h-12 xl:min-h-header flex items-center border-b-1/2 px-3.5 py-1.5 md:px-4 md:py-2 xl:px-6 xl:pr-5 text-sm font-medium sticky top-0 bg-b-1 xl:rounded-none z-1" };
|
|
4
|
+
function m(e, x) {
|
|
5
5
|
return o(), l("section", c, [
|
|
6
6
|
n("div", i, [
|
|
7
7
|
t(e.$slots, "title")
|
package/dist/store/requests.d.ts
CHANGED
|
@@ -389,5 +389,45 @@ export declare function findRequestParentsFactory({ collections, tags, }: {
|
|
|
389
389
|
collections: Record<string, Collection>;
|
|
390
390
|
tags: Record<string, Tag>;
|
|
391
391
|
}): (r: Request) => string[];
|
|
392
|
+
/** First draft request" */
|
|
393
|
+
export declare function createInitialRequest(): {
|
|
394
|
+
request: {
|
|
395
|
+
path: string;
|
|
396
|
+
type: "request";
|
|
397
|
+
uid: string;
|
|
398
|
+
selectedSecuritySchemeUids: string[];
|
|
399
|
+
selectedServerUid: string;
|
|
400
|
+
servers: string[];
|
|
401
|
+
examples: string[];
|
|
402
|
+
method: "options" | "delete" | "get" | "connect" | "head" | "patch" | "post" | "put" | "trace";
|
|
403
|
+
description?: string | undefined;
|
|
404
|
+
summary?: string | undefined;
|
|
405
|
+
externalDocs?: {
|
|
406
|
+
url: string;
|
|
407
|
+
description?: string | undefined;
|
|
408
|
+
} | undefined;
|
|
409
|
+
security?: Record<string, string[]>[] | undefined;
|
|
410
|
+
tags?: string[] | undefined;
|
|
411
|
+
deprecated?: boolean | undefined;
|
|
412
|
+
operationId?: string | undefined;
|
|
413
|
+
parameters?: {
|
|
414
|
+
required: boolean;
|
|
415
|
+
name: string;
|
|
416
|
+
in: "path" | "query" | "header" | "cookie";
|
|
417
|
+
deprecated: boolean;
|
|
418
|
+
description?: string | undefined;
|
|
419
|
+
schema?: unknown;
|
|
420
|
+
content?: unknown;
|
|
421
|
+
style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
|
|
422
|
+
example?: unknown;
|
|
423
|
+
examples?: Record<string, {
|
|
424
|
+
value?: unknown;
|
|
425
|
+
summary?: string | undefined;
|
|
426
|
+
}> | undefined;
|
|
427
|
+
}[] | undefined;
|
|
428
|
+
requestBody?: any;
|
|
429
|
+
responses?: Record<string, any> | undefined;
|
|
430
|
+
};
|
|
431
|
+
};
|
|
392
432
|
export {};
|
|
393
433
|
//# sourceMappingURL=requests.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/store/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EACL,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,GAAG,EAGT,MAAM,iCAAiC,CAAA;AAKxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEnD,wDAAwD;AACxD,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,OAAO;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/store/requests.ts"],"names":[],"mappings":"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"}
|
package/dist/store/requests.js
CHANGED
|
@@ -1,107 +1,117 @@
|
|
|
1
|
-
import { requestSchema as
|
|
1
|
+
import { requestSchema as x, createExampleFromRequest as y } from "@scalar/oas-utils/entities/spec";
|
|
2
2
|
import { LS_KEYS as F, schemaModel as T, iterateTitle as A } from "@scalar/oas-utils/helpers";
|
|
3
3
|
import { mutationFactory as D } from "@scalar/object-utils/mutator-record";
|
|
4
|
-
import { reactive as
|
|
5
|
-
function
|
|
6
|
-
const s =
|
|
4
|
+
import { reactive as E } from "vue";
|
|
5
|
+
function j(m) {
|
|
6
|
+
const s = E({}), h = D(
|
|
7
7
|
s,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
E({}),
|
|
9
|
+
m && F.REQUEST
|
|
10
10
|
);
|
|
11
11
|
return {
|
|
12
12
|
requests: s,
|
|
13
13
|
requestMutators: h
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
requestExamples:
|
|
16
|
+
function v({
|
|
17
|
+
requestExamples: m,
|
|
18
18
|
requestExampleMutators: s,
|
|
19
19
|
requestMutators: h,
|
|
20
|
-
collectionMutators:
|
|
21
|
-
collections:
|
|
20
|
+
collectionMutators: f,
|
|
21
|
+
collections: r,
|
|
22
22
|
tags: u,
|
|
23
23
|
tagMutators: q
|
|
24
24
|
}, R) {
|
|
25
25
|
return {
|
|
26
|
-
addRequest: (
|
|
27
|
-
var
|
|
28
|
-
const e = T(
|
|
29
|
-
if (!e) return console.error("INVALID REQUEST DATA",
|
|
30
|
-
const
|
|
26
|
+
addRequest: (t, a) => {
|
|
27
|
+
var l;
|
|
28
|
+
const e = T(t, x, !1);
|
|
29
|
+
if (!e) return console.error("INVALID REQUEST DATA", t);
|
|
30
|
+
const o = r[a], i = y(
|
|
31
31
|
e,
|
|
32
32
|
A(
|
|
33
33
|
(e.summary ?? "Example") + " #1",
|
|
34
|
-
(
|
|
34
|
+
(c) => e.examples.some((p) => c === m[p].name)
|
|
35
35
|
)
|
|
36
36
|
);
|
|
37
|
-
return e.examples.push(i.uid), h.add(e), s.add(i),
|
|
38
|
-
...
|
|
37
|
+
return e.examples.push(i.uid), h.add(e), s.add(i), f.edit(a, "requests", [
|
|
38
|
+
...o.requests,
|
|
39
39
|
e.uid
|
|
40
|
-
]), (
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
...u[
|
|
40
|
+
]), (l = e.tags) != null && l.length ? e.tags.forEach((c) => {
|
|
41
|
+
const p = o.tags.find((S) => u[S].name === c);
|
|
42
|
+
p ? q.edit(p, "children", [
|
|
43
|
+
...u[p].children,
|
|
44
44
|
e.uid
|
|
45
|
-
]) : R({ name:
|
|
46
|
-
}) :
|
|
47
|
-
...
|
|
45
|
+
]) : R({ name: c, children: [e.uid] }, a);
|
|
46
|
+
}) : f.edit(a, "children", [
|
|
47
|
+
...o.children,
|
|
48
48
|
e.uid
|
|
49
49
|
]), e;
|
|
50
50
|
},
|
|
51
|
-
deleteRequest: (
|
|
52
|
-
var
|
|
53
|
-
const e =
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
deleteRequest: (t, a) => {
|
|
52
|
+
var o;
|
|
53
|
+
const e = r[a];
|
|
54
|
+
t.examples.forEach((i) => s.delete(i)), f.edit(
|
|
55
|
+
a,
|
|
56
56
|
"requests",
|
|
57
|
-
e.requests.filter((i) => i !==
|
|
58
|
-
),
|
|
59
|
-
|
|
57
|
+
e.requests.filter((i) => i !== t.uid)
|
|
58
|
+
), f.edit(
|
|
59
|
+
a,
|
|
60
60
|
"children",
|
|
61
|
-
e.children.filter((i) => i !==
|
|
62
|
-
), (
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
e.children.filter((i) => i !== t.uid)
|
|
62
|
+
), (o = t.tags) == null || o.forEach((i) => {
|
|
63
|
+
const l = e.tags.find((c) => u[c].name === i);
|
|
64
|
+
l && q.edit(
|
|
65
|
+
l,
|
|
66
66
|
"children",
|
|
67
|
-
u[
|
|
67
|
+
u[l].children.filter((c) => c !== t.uid)
|
|
68
68
|
);
|
|
69
|
-
}), h.delete(
|
|
69
|
+
}), h.delete(t.uid);
|
|
70
70
|
},
|
|
71
|
-
findRequestParents:
|
|
71
|
+
findRequestParents: I({ collections: r, tags: u })
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
collections:
|
|
74
|
+
function I({
|
|
75
|
+
collections: m,
|
|
76
76
|
tags: s
|
|
77
77
|
}) {
|
|
78
|
-
function h(
|
|
79
|
-
const
|
|
78
|
+
function h(f) {
|
|
79
|
+
const r = Object.values(m).find(
|
|
80
80
|
(n) => {
|
|
81
81
|
var d;
|
|
82
|
-
return (d = n.requests) == null ? void 0 : d.includes(
|
|
82
|
+
return (d = n.requests) == null ? void 0 : d.includes(f.uid);
|
|
83
83
|
}
|
|
84
84
|
);
|
|
85
|
-
if (!
|
|
85
|
+
if (!r) return [];
|
|
86
86
|
const u = Object.keys(s).reduce(
|
|
87
87
|
(n, d) => (n[d] = [], n),
|
|
88
|
-
{ [
|
|
88
|
+
{ [r == null ? void 0 : r.uid]: [] }
|
|
89
89
|
);
|
|
90
90
|
function q(n, d) {
|
|
91
|
-
d.forEach((
|
|
92
|
-
s[
|
|
91
|
+
d.forEach((t) => u[t].push(...n.children)), n.children.forEach((t) => {
|
|
92
|
+
s[t] && q(s[t], [...d, t]);
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
q(
|
|
95
|
+
q(r, [r.uid]);
|
|
96
96
|
const R = /* @__PURE__ */ new Set();
|
|
97
97
|
return Object.entries(u).forEach(([n, d]) => {
|
|
98
|
-
d.includes(
|
|
98
|
+
d.includes(f.uid) && R.add(n);
|
|
99
99
|
}), [...R];
|
|
100
100
|
}
|
|
101
101
|
return h;
|
|
102
102
|
}
|
|
103
|
+
function C() {
|
|
104
|
+
return { request: x.parse({
|
|
105
|
+
method: "get",
|
|
106
|
+
parameters: [],
|
|
107
|
+
path: "",
|
|
108
|
+
summary: "My First Request",
|
|
109
|
+
examples: []
|
|
110
|
+
}) };
|
|
111
|
+
}
|
|
103
112
|
export {
|
|
104
|
-
C as
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
C as createInitialRequest,
|
|
114
|
+
j as createStoreRequests,
|
|
115
|
+
v as extendedRequestDataFactory,
|
|
116
|
+
I as findRequestParentsFactory
|
|
107
117
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/store/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/store/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAKzD,OAAO,EACL,KAAK,SAAS,EAEf,MAAM,sCAAsC,CAAA;AAO7C,4CAA4C;AAC5C,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,OAAO;;;;;;;;;;;;;mBAsE+7L,CAAC;;yBAAq4B,CAAC;;;;;;;;;;;;;;;;;;uBAAv4B,CAAC;;6BAAq4B,CAAC;;;;;;;;;;;;;;;;;;uBAAv4B,CAAC;;6BAAq4B,CAAC;;;;;;;;;;;;;;;;;uBAAv4B,CAAC;;6BAAq4B,CAAC;;;;;;;;;;;;;;;;uBAAv4B,CAAC;;6BAAq4B,CAAC;;;;;;;;;;;;;;;;uBAAv4B,CAAC;;6BAAq4B,CAAC;;;;;;;;;;;;;;;;;uBAAv4B,CAAC;;6BAAq4B,CAAC;;;;;;;;;;;;;;;;uBAAv4B,CAAC;;6BAAq4B,CAAC;;;;;;;;;;;;;;;;uBAAv4B,CAAC;;6BAAq4B,CAAC;;;;;;;;;EAzDn4N;AAED,oDAAoD;AACpD,wBAAgB,4BAA4B,CAAC,EAC3C,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,GACvB,EAAE,YAAY;6BACkB,OAAO,CAAC,SAAS,CAAC;;;;;;;;;;;;mBA+C08L,CAAC;;yBAAq4B,CAAC;;;;;2BAbp2N,MAAM;EAYrC"}
|
package/dist/store/workspace.js
CHANGED
|
@@ -1,53 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { workspaceSchema as
|
|
1
|
+
import { requestExampleSchema as m, collectionSchema as l } from "@scalar/oas-utils/entities/spec";
|
|
2
|
+
import { workspaceSchema as u } from "@scalar/oas-utils/entities/workspace";
|
|
3
3
|
import { LS_KEYS as f } from "@scalar/oas-utils/helpers";
|
|
4
|
-
import { mutationFactory as
|
|
5
|
-
import { reactive as
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { mutationFactory as k } from "@scalar/object-utils/mutator-record";
|
|
5
|
+
import { reactive as d } from "vue";
|
|
6
|
+
import { createInitialRequest as h } from "./requests.js";
|
|
7
|
+
function D(o) {
|
|
8
|
+
const e = d({}), r = k(
|
|
8
9
|
e,
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
d({}),
|
|
11
|
+
o && f.WORKSPACE
|
|
11
12
|
);
|
|
12
13
|
return {
|
|
13
14
|
workspaces: e,
|
|
14
|
-
workspaceMutators:
|
|
15
|
+
workspaceMutators: r
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
workspaces:
|
|
18
|
+
function F({
|
|
19
|
+
workspaces: o,
|
|
19
20
|
workspaceMutators: e,
|
|
20
|
-
collectionMutators:
|
|
21
|
-
requestMutators:
|
|
22
|
-
requestExampleMutators:
|
|
21
|
+
collectionMutators: r,
|
|
22
|
+
requestMutators: i,
|
|
23
|
+
requestExampleMutators: p
|
|
23
24
|
}) {
|
|
24
25
|
return {
|
|
25
26
|
addWorkspace: (a = {}) => {
|
|
26
|
-
const t =
|
|
27
|
-
method: "get",
|
|
28
|
-
parameters: [],
|
|
29
|
-
path: "",
|
|
30
|
-
summary: "My First Request",
|
|
31
|
-
examples: []
|
|
32
|
-
}), s = l.parse({
|
|
27
|
+
const { request: t } = h(), c = m.parse({
|
|
33
28
|
name: "Example",
|
|
34
29
|
requestUid: t.uid
|
|
35
30
|
});
|
|
36
|
-
t.examples.push(
|
|
37
|
-
const
|
|
31
|
+
t.examples.push(c.uid);
|
|
32
|
+
const s = l.parse({
|
|
38
33
|
info: {
|
|
39
34
|
title: "Drafts"
|
|
40
35
|
},
|
|
41
36
|
children: [t.uid],
|
|
42
37
|
requests: [t.uid]
|
|
43
|
-
}), n =
|
|
38
|
+
}), n = u.parse({
|
|
44
39
|
...a,
|
|
45
|
-
collections: [
|
|
40
|
+
collections: [s.uid]
|
|
46
41
|
});
|
|
47
|
-
return
|
|
42
|
+
return p.add(c), i.add(t), r.add(s), e.add(n), n;
|
|
48
43
|
},
|
|
49
44
|
deleteWorkspace: (a) => {
|
|
50
|
-
if (Object.keys(
|
|
45
|
+
if (Object.keys(o).length <= 1) {
|
|
51
46
|
console.warn("The last workspace cannot be deleted.");
|
|
52
47
|
return;
|
|
53
48
|
}
|
|
@@ -56,6 +51,6 @@ function b({
|
|
|
56
51
|
};
|
|
57
52
|
}
|
|
58
53
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
D as createStoreWorkspaces,
|
|
55
|
+
F as extendedWorkspaceDataFactory
|
|
61
56
|
};
|