@scalar/api-client 2.3.12 → 2.3.14

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 (33) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +6 -0
  3. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
  4. package/dist/components/Server/ServerDropdownItem.vue.d.ts.map +1 -1
  5. package/dist/components/Server/ServerDropdownItem.vue.js +1 -1
  6. package/dist/components/Server/ServerDropdownItem.vue2.js +25 -22
  7. package/dist/components/SideNav/SideNav.vue.d.ts.map +1 -1
  8. package/dist/components/SideNav/SideNav.vue.js +39 -39
  9. package/dist/layouts/App/create-api-client-app.d.ts +154 -4
  10. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  11. package/dist/layouts/Modal/create-api-client-modal.d.ts +308 -8
  12. package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
  13. package/dist/layouts/Web/create-api-client-web.d.ts +154 -4
  14. package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
  15. package/dist/libs/create-client.d.ts +154 -4
  16. package/dist/libs/create-client.d.ts.map +1 -1
  17. package/dist/libs/find-request.d.ts +15 -0
  18. package/dist/libs/find-request.d.ts.map +1 -1
  19. package/dist/libs/send-request/create-request-operation.test.d.ts +15 -0
  20. package/dist/libs/send-request/create-request-operation.test.d.ts.map +1 -1
  21. package/dist/store/active-entities.d.ts +15 -0
  22. package/dist/store/active-entities.d.ts.map +1 -1
  23. package/dist/store/requests.d.ts +169 -4
  24. package/dist/store/requests.d.ts.map +1 -1
  25. package/dist/store/store.d.ts +154 -4
  26. package/dist/store/store.d.ts.map +1 -1
  27. package/dist/store/tags.d.ts.map +1 -1
  28. package/dist/style.css +1 -1
  29. package/dist/views/Request/RequestSection/RequestCodeExample.vue.d.ts.map +1 -1
  30. package/dist/views/Request/RequestSection/RequestCodeExample.vue.js +2 -2
  31. package/dist/views/Request/RequestSection/RequestCodeExample.vue2.js +122 -78
  32. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  33. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"RequestCodeExample.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/RequestSection/RequestCodeExample.vue"],"names":[],"mappings":"AA8KA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,cAAc,EACd,MAAM,EACP,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAcrE,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,cAAc,CAAA;IACvB,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,SAAS,EAAE,SAAS,CAAA;CACrB,CAAC;;AA+PF,wBAOG"}
1
+ {"version":3,"file":"RequestCodeExample.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/RequestSection/RequestCodeExample.vue"],"names":[],"mappings":"AAwRA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,cAAc,EACd,MAAM,EACP,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAcrE,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,cAAc,CAAA;IACvB,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,SAAS,EAAE,SAAS,CAAA;CACrB,CAAC;;AA2WF,wBAOG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./RequestCodeExample.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-57c43f8c"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-fdb4baba"]]);
5
5
  export {
6
- r as default
6
+ p as default
7
7
  };
@@ -1,13 +1,13 @@
1
- import { defineComponent as b, computed as i, openBlock as w, createElementBlock as x, createVNode as n, withCtx as c, createTextVNode as S, createElementVNode as m, unref as r, toDisplayString as C } from "vue";
2
- import { ScalarCombobox as k, ScalarButton as $, ScalarIcon as g } from "@scalar/components";
3
- import { snippetz as K } from "@scalar/snippetz";
4
- import V from "../../../components/DataTable/DataTable.vue.js";
5
- import H from "../../../components/DataTable/DataTableRow.vue.js";
6
- import U from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
7
- import { filterSecurityRequirements as _ } from "./helpers/filter-security-requirements.js";
8
- import j from "../../Components/CodeSnippet/CodeSnippet.vue.js";
9
- import { useWorkspace as B } from "../../../store/store.js";
10
- const D = { class: "w-full" }, E = { class: "-mx-1 flex flex-1" }, N = { class: "bg-b-1 flex items-center justify-center overflow-hidden border-t" }, P = /* @__PURE__ */ b({
1
+ import { defineComponent as H, computed as a, ref as U, openBlock as v, createElementBlock as j, createVNode as i, withCtx as c, createTextVNode as D, createElementVNode as x, unref as r, toDisplayString as N, createBlock as C } from "vue";
2
+ import { ScalarCombobox as R, ScalarButton as T, ScalarIcon as W, ScalarCodeBlock as q } from "@scalar/components";
3
+ import { snippetz as z } from "@scalar/snippetz";
4
+ import I from "../../../components/DataTable/DataTable.vue.js";
5
+ import O from "../../../components/DataTable/DataTableRow.vue.js";
6
+ import M from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
7
+ import { filterSecurityRequirements as P } from "./helpers/filter-security-requirements.js";
8
+ import A from "../../Components/CodeSnippet/CodeSnippet.vue.js";
9
+ import { useWorkspace as F } from "../../../store/store.js";
10
+ const G = { class: "w-full" }, J = { class: "-mx-1 flex flex-1" }, L = { class: "bg-b-1 flex items-center justify-center overflow-hidden border-t" }, ne = /* @__PURE__ */ H({
11
11
  __name: "RequestCodeExample",
12
12
  props: {
13
13
  collection: {},
@@ -16,82 +16,120 @@ const D = { class: "w-full" }, E = { class: "-mx-1 flex flex-1" }, N = { class:
16
16
  server: {},
17
17
  workspace: {}
18
18
  },
19
- setup(o) {
20
- const { securitySchemes: u, workspaceMutators: p } = B(), f = i(
21
- () => _(
22
- o.operation.security || o.collection.security || [],
23
- o.operation.selectedSecuritySchemeUids || o.collection.selectedSecuritySchemeUids,
24
- u
19
+ setup(n) {
20
+ var b, K, S, h;
21
+ const { securitySchemes: k, workspaceMutators: w } = F(), f = a(() => {
22
+ var t, e, l;
23
+ return d.value.targetKey === "custom" && ((t = u.value) == null ? void 0 : t.some(
24
+ (o) => o.lang === d.value.clientKey
25
+ )) ? d.value : {
26
+ targetKey: ((e = n.workspace.selectedHttpClient) == null ? void 0 : e.targetKey) ?? "js",
27
+ clientKey: ((l = n.workspace.selectedHttpClient) == null ? void 0 : l.clientKey) ?? "fetch"
28
+ };
29
+ }), u = a(
30
+ () => n.operation["x-codeSamples"] || n.operation["x-code-samples"] || n.operation["x-custom-examples"]
31
+ ), d = U(
32
+ (b = u.value) != null && b.length ? {
33
+ targetKey: "custom",
34
+ clientKey: (K = u.value[0]) == null ? void 0 : K.lang
35
+ } : {
36
+ targetKey: ((S = n.workspace.selectedHttpClient) == null ? void 0 : S.targetKey) ?? "js",
37
+ clientKey: ((h = n.workspace.selectedHttpClient) == null ? void 0 : h.clientKey) ?? "fetch"
38
+ }
39
+ ), $ = a(
40
+ () => P(
41
+ n.operation.security || n.collection.security || [],
42
+ n.operation.selectedSecuritySchemeUids || n.collection.selectedSecuritySchemeUids,
43
+ k
25
44
  )
26
- ), a = i(() => {
27
- const e = {};
28
- return {
29
- options: K().clients().map((t) => ({
30
- label: t.title,
31
- options: t.clients.map((s) => (e[`${t.key},${s.client}`] = s.title, {
32
- id: `${t.key},${s.client}`,
33
- label: s.title
45
+ ), y = a(() => {
46
+ const t = {}, e = z().clients().map((o) => ({
47
+ label: o.title,
48
+ options: o.clients.map((p) => (t[`${o.key},${p.client}`] = p.title, {
49
+ id: `${o.key},${p.client}`,
50
+ label: p.title
51
+ }))
52
+ })), l = (n.operation["x-codeSamples"] || n.operation["x-code-samples"] || n.operation["x-custom-examples"] || []).map((o) => ({
53
+ id: `custom,${o.lang}`,
54
+ label: o.label || o.lang
55
+ })), m = l.length > 0 ? [
56
+ {
57
+ id: "customExamples",
58
+ label: "Code Examples",
59
+ options: l.map((o) => ({
60
+ id: o.id,
61
+ label: o.label ?? o.id
34
62
  }))
35
- })),
36
- dict: e
63
+ },
64
+ ...e
65
+ ] : e;
66
+ return l.forEach((o) => {
67
+ t[o.id] = o.label ?? o.id;
68
+ }), {
69
+ options: m,
70
+ dict: t
37
71
  };
38
- }), d = i(() => {
39
- var t;
40
- const e = o.workspace.selectedHttpClient;
41
- if (!e)
42
- return ((t = a.value.options[0]) == null ? void 0 : t.options[0]) ?? {
43
- id: "js,fetch",
44
- label: "Fetch"
72
+ }), s = a(() => {
73
+ const t = f.value;
74
+ if (t.targetKey === "custom") {
75
+ const l = `custom,${t.clientKey}`;
76
+ return {
77
+ id: l,
78
+ label: y.value.dict[l] ?? "Unknown"
45
79
  };
46
- const l = `${e.targetKey},${e.clientKey}`;
80
+ }
81
+ const e = `${t.targetKey},${t.clientKey}`;
47
82
  return {
48
- id: l,
49
- label: a.value.dict[l] ?? "Unknown"
83
+ id: e,
84
+ label: y.value.dict[e] ?? "Unknown"
50
85
  };
51
- }), y = i(
52
- () => {
53
- var e;
54
- return ((e = o.workspace.selectedHttpClient) == null ? void 0 : e.targetKey) ?? "js";
55
- }
56
- ), v = i(
57
- () => {
58
- var e;
59
- return ((e = o.workspace.selectedHttpClient) == null ? void 0 : e.clientKey) ?? "fetch";
60
- }
61
- ), h = ({ id: e }) => {
62
- const [l, t] = e.split(",");
63
- !l || !t || p.edit(o.workspace.uid, "selectedHttpClient", {
64
- targetKey: l,
65
- clientKey: t
66
- });
67
- };
68
- return (e, l) => (w(), x("div", D, [
69
- n(U, {
86
+ }), E = a(
87
+ () => f.value.targetKey
88
+ ), V = a(
89
+ () => f.value.clientKey
90
+ ), B = ({ id: t }) => {
91
+ const [e, l] = t.split(",");
92
+ !e || !l || (d.value = {
93
+ targetKey: e,
94
+ clientKey: l
95
+ }, e !== "custom" && w.edit(n.workspace.uid, "selectedHttpClient", {
96
+ targetKey: e,
97
+ clientKey: l
98
+ }));
99
+ }, g = a(() => {
100
+ var l;
101
+ if (!s.value.id.startsWith("custom,"))
102
+ return;
103
+ const t = s.value.id.split(",")[1], e = (l = u.value) == null ? void 0 : l.find((m) => m.lang === t);
104
+ return e == null ? void 0 : e.source;
105
+ });
106
+ return (t, e) => (v(), j("div", G, [
107
+ i(M, {
70
108
  class: "group/preview w-full border-b-0",
71
109
  defaultOpen: !0
72
110
  }, {
73
- title: c(() => l[0] || (l[0] = [
74
- S("Code Snippet")
111
+ title: c(() => e[0] || (e[0] = [
112
+ D("Code Snippet")
75
113
  ])),
76
114
  actions: c(() => [
77
- m("div", E, [
78
- n(r(k), {
79
- modelValue: d.value,
80
- options: a.value.options,
115
+ x("div", J, [
116
+ i(r(R), {
117
+ modelValue: s.value,
118
+ options: y.value.options,
81
119
  placement: "bottom-end",
82
- "onUpdate:modelValue": h
120
+ "onUpdate:modelValue": B
83
121
  }, {
84
122
  default: c(() => [
85
- n(r($), {
123
+ i(r(T), {
86
124
  class: "text-c-1 hover:bg-b-3 py-0.75 flex h-full w-fit gap-1.5 px-1.5 font-normal",
87
125
  fullWidth: "",
88
126
  variant: "ghost"
89
127
  }, {
90
128
  default: c(() => {
91
- var t;
129
+ var l;
92
130
  return [
93
- m("span", null, C((t = d.value) == null ? void 0 : t.label), 1),
94
- n(r(g), {
131
+ x("span", null, N((l = s.value) == null ? void 0 : l.label), 1),
132
+ i(r(W), {
95
133
  icon: "ChevronDown",
96
134
  size: "md"
97
135
  })
@@ -105,20 +143,26 @@ const D = { class: "w-full" }, E = { class: "-mx-1 flex flex-1" }, N = { class:
105
143
  ])
106
144
  ]),
107
145
  default: c(() => [
108
- n(V, { columns: [""] }, {
146
+ i(I, { columns: [""] }, {
109
147
  default: c(() => [
110
- n(H, null, {
148
+ i(O, null, {
111
149
  default: c(() => [
112
- m("div", N, [
113
- n(r(j), {
150
+ x("div", L, [
151
+ g.value ? (v(), C(r(q), {
152
+ key: 0,
153
+ class: "px-3 py-1.5",
154
+ content: g.value,
155
+ lang: s.value.id.split(",")[1] ?? "plaintext"
156
+ }, null, 8, ["content", "lang"])) : (v(), C(r(A), {
157
+ key: 1,
114
158
  class: "px-3 py-1.5",
115
- client: v.value,
116
- example: e.example,
117
- operation: e.operation,
118
- securitySchemes: f.value,
119
- server: e.server,
120
- target: y.value
121
- }, null, 8, ["client", "example", "operation", "securitySchemes", "server", "target"])
159
+ client: V.value,
160
+ example: t.example,
161
+ operation: t.operation,
162
+ securitySchemes: $.value,
163
+ server: t.server,
164
+ target: E.value
165
+ }, null, 8, ["client", "example", "operation", "securitySchemes", "server", "target"]))
122
166
  ])
123
167
  ]),
124
168
  _: 1
@@ -133,5 +177,5 @@ const D = { class: "w-full" }, E = { class: "-mx-1 flex flex-1" }, N = { class:
133
177
  }
134
178
  });
135
179
  export {
136
- P as default
180
+ ne as default
137
181
  };
@@ -37,7 +37,7 @@ const P = { class: "col-1 flex-center relative gap-6 p-2 capitalize" }, T = {
37
37
  }));
38
38
  }, y = (s) => {
39
39
  s != null && s.createNew && w.name === "request" && k();
40
- }, N = "2.3.12";
40
+ }, N = "2.3.14";
41
41
  return B(() => r.hotKeys.on(y)), E(() => r.hotKeys.off(y)), (s, e) => (u(), i("div", P, [
42
42
  o("div", {
43
43
  class: q(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "rest",
19
19
  "testing"
20
20
  ],
21
- "version": "2.3.12",
21
+ "version": "2.3.14",
22
22
  "engines": {
23
23
  "node": ">=18"
24
24
  },
@@ -189,21 +189,21 @@
189
189
  "whatwg-mimetype": "^4.0.0",
190
190
  "yaml": "^2.4.5",
191
191
  "zod": "^3.23.8",
192
- "@scalar/components": "0.13.43",
192
+ "@scalar/components": "0.13.45",
193
193
  "@scalar/draggable": "0.1.11",
194
- "@scalar/import": "0.3.9",
194
+ "@scalar/import": "0.3.11",
195
195
  "@scalar/icons": "0.1.3",
196
+ "@scalar/oas-utils": "0.2.128",
196
197
  "@scalar/object-utils": "1.1.13",
197
198
  "@scalar/openapi-parser": "0.10.14",
198
199
  "@scalar/openapi-types": "0.2.0",
199
- "@scalar/postman-to-openapi": "0.1.49",
200
- "@scalar/oas-utils": "0.2.126",
200
+ "@scalar/postman-to-openapi": "0.2.1",
201
201
  "@scalar/snippetz": "0.2.19",
202
202
  "@scalar/themes": "0.9.84",
203
203
  "@scalar/types": "0.1.6",
204
- "@scalar/use-codemirror": "0.11.88",
205
- "@scalar/use-toasts": "0.7.9",
206
204
  "@scalar/use-hooks": "0.1.38",
205
+ "@scalar/use-codemirror": "0.11.90",
206
+ "@scalar/use-toasts": "0.7.9",
207
207
  "@scalar/use-tooltip": "1.0.6"
208
208
  },
209
209
  "devDependencies": {