@scalar/api-reference 1.25.11 → 1.25.12
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 +38 -0
- package/dist/browser/standalone.js +12142 -11718
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiClientModal.vue.d.ts.map +1 -1
- package/dist/components/ApiClientModal.vue.js +37 -32
- package/dist/components/Content/Authentication/Authentication.stories.d.ts.map +1 -1
- package/dist/components/api-client-bus.d.ts +3 -3
- package/dist/components/api-client-bus.d.ts.map +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue.js +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue2.js +81 -87
- package/dist/helpers/getExampleCode.d.ts.map +1 -1
- package/dist/helpers/getExampleCode.js +18 -15
- package/dist/index.js +1 -1
- package/dist/legacy/components/SecurityScheme.vue.d.ts.map +1 -1
- package/dist/legacy/components/SecurityScheme.vue.js +1 -1
- package/dist/legacy/components/SecurityScheme.vue2.js +158 -129
- package/dist/legacy/fixtures/httpRequestMethods.d.ts +1 -1
- package/dist/legacy/fixtures/httpRequestMethods.d.ts.map +1 -1
- package/dist/legacy/helpers/normalizeHeaders.js +5 -5
- package/dist/legacy/helpers/normalizeRequestMethod.d.ts +1 -1
- package/dist/legacy/helpers/normalizeRequestMethod.d.ts.map +1 -1
- package/dist/legacy/helpers/normalizeRequestMethod.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiClientModal.vue.d.ts","sourceRoot":"","sources":["../../src/components/ApiClientModal.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApiClientModal.vue.d.ts","sourceRoot":"","sources":["../../src/components/ApiClientModal.vue"],"names":[],"mappings":"AA2EA,OAAO,KAAK,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;;eAQtD,MAAM;WACV,iBAAiB;cACd,IAAI,CAAC,SAAS,CAAC;;eAFd,MAAM;WACV,iBAAiB;cACd,IAAI,CAAC,SAAS,CAAC;;AA8F3B,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
|
|
@@ -1,45 +1,50 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { modalStateBus as
|
|
3
|
-
import { useServerStore as
|
|
4
|
-
import { getUrlFromServerState as
|
|
5
|
-
|
|
6
|
-
const b = /* @__PURE__ */ S({
|
|
1
|
+
import { defineComponent as v, ref as l, onMounted as S, watch as n, onBeforeUnmount as _, openBlock as U, createElementBlock as h } from "vue";
|
|
2
|
+
import { modalStateBus as x, apiClientBus as y } from "./api-client-bus.js";
|
|
3
|
+
import { useServerStore as A } from "../legacy/stores/useServerStore.js";
|
|
4
|
+
import { getUrlFromServerState as B } from "../legacy/helpers/getUrlFromServerState.js";
|
|
5
|
+
const g = /* @__PURE__ */ v({
|
|
7
6
|
__name: "ApiClientModal",
|
|
8
7
|
props: {
|
|
9
8
|
proxyUrl: {},
|
|
10
9
|
spec: {},
|
|
11
10
|
servers: {}
|
|
12
11
|
},
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
if (!
|
|
17
|
-
const { createApiClientModal:
|
|
18
|
-
spec:
|
|
19
|
-
proxyUrl:
|
|
20
|
-
servers:
|
|
12
|
+
setup(s) {
|
|
13
|
+
const p = s, a = l(null), o = l(null), { server: c } = A();
|
|
14
|
+
return S(async () => {
|
|
15
|
+
if (!a.value) return;
|
|
16
|
+
const { createApiClientModal: e } = await import("@scalar/api-client"), { app: r, open: i, updateAuth: m, modalState: d, updateSpec: u, updateServer: f } = await e(a.value, {
|
|
17
|
+
spec: p.spec ?? {},
|
|
18
|
+
proxyUrl: p.proxyUrl,
|
|
19
|
+
servers: p.servers
|
|
21
20
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
o.value = {
|
|
22
|
+
// @ts-expect-error not sure what the beef with app is, possible router related
|
|
23
|
+
app: r,
|
|
24
|
+
updateSpec: u,
|
|
25
|
+
updateServer: f
|
|
26
|
+
}, x.emit(d), y.on((t) => {
|
|
27
|
+
t.open && i(t.open), t.updateSpec && u(t.updateSpec), t.updateAuth && m(t.updateAuth);
|
|
28
|
+
});
|
|
29
|
+
}), n(c, (e) => {
|
|
30
|
+
const r = B(e);
|
|
31
|
+
r && o.value && o.value.updateServer(r);
|
|
32
|
+
}), n(
|
|
33
|
+
() => p.spec,
|
|
34
|
+
(e) => {
|
|
35
|
+
var r;
|
|
36
|
+
return e && ((r = o.value) == null ? void 0 : r.updateSpec(e));
|
|
37
|
+
},
|
|
38
|
+
{ deep: !0 }
|
|
39
|
+
), _(() => {
|
|
40
|
+
var e;
|
|
41
|
+
return (e = o.value) == null ? void 0 : e.app.unmount();
|
|
42
|
+
}), (e, r) => (U(), h("div", {
|
|
38
43
|
ref_key: "el",
|
|
39
|
-
ref:
|
|
44
|
+
ref: a
|
|
40
45
|
}, null, 512));
|
|
41
46
|
}
|
|
42
47
|
});
|
|
43
48
|
export {
|
|
44
|
-
|
|
49
|
+
g as default
|
|
45
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Authentication.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Authentication/Authentication.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,cAAc,MAAM,sBAAsB,CAAA;AAEjD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAIrC,CAAA;AAED,eAAe,IAAI,CAAA;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAA;AAE5C,eAAO,MAAM,OAAO,EAAE,KAoBrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"Authentication.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Authentication/Authentication.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAErD,OAAO,cAAc,MAAM,sBAAsB,CAAA;AAEjD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAIrC,CAAA;AAED,eAAe,IAAI,CAAA;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAA;AAE5C,eAAO,MAAM,OAAO,EAAE,KAoBrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAe9B,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAkBjC,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE,KAoBlC,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,KAmBpB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAkCvB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KA+B7B,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { OpenClientPayload } from '@scalar/api-client/libs';
|
|
2
|
-
import type {
|
|
1
|
+
import type { ApiClient, OpenClientPayload } from '@scalar/api-client/libs';
|
|
2
|
+
import type { SpecConfiguration } from '@scalar/types/legacy';
|
|
3
3
|
import type { RequireAtLeastOne } from 'type-fest';
|
|
4
4
|
type ApiClientEvents = RequireAtLeastOne<{
|
|
5
5
|
open?: OpenClientPayload;
|
|
6
|
-
updateAuth?:
|
|
6
|
+
updateAuth?: Parameters<ApiClient['updateAuth']>[0];
|
|
7
7
|
updateSpec?: SpecConfiguration;
|
|
8
8
|
}>;
|
|
9
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client-bus.d.ts","sourceRoot":"","sources":["../../src/components/api-client-bus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"api-client-bus.d.ts","sourceRoot":"","sources":["../../src/components/api-client-bus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAE3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAElD,KAAK,eAAe,GAAG,iBAAiB,CAAC;IACvC,IAAI,CAAC,EAAE,iBAAiB,CAAA;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACnD,UAAU,CAAC,EAAE,iBAAiB,CAAA;CAC/B,CAAC,CAAA;AAIF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,gEAA+B,CAAA;AACxD,eAAO,MAAM,aAAa;;;;OAAyC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleRequest.vue.d.ts","sourceRoot":"","sources":["../../../src/features/ExampleRequest/ExampleRequest.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExampleRequest.vue.d.ts","sourceRoot":"","sources":["../../../src/features/ExampleRequest/ExampleRequest.vue"],"names":[],"mappings":"AA4WA,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,sBAAsB,CAAA;AA8O7B,iBAAS,cAAc;oBAiNM,GAAG;oBACH,GAAG;EAmC/B;AACD,QAAA,MAAM,eAAe;eArcR,oBAAoB;;eAApB,oBAAoB;aA2c/B,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;AAOxG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACpC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC;AAEN,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./ExampleRequest.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-77ab5d94"]]);
|
|
5
5
|
export {
|
|
6
6
|
p as default
|
|
7
7
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as U, ref as
|
|
1
|
+
import { defineComponent as U, ref as q, computed as d, watch as L, inject as I, onServerPrefetch as M, useSSRContext as P, unref as r, openBlock as p, createBlock as _, withCtx as c, createVNode as u, createElementBlock as y, Fragment as V, createTextVNode as O, toDisplayString as v, createElementVNode as H, renderSlot as N, createCommentVNode as g } from "vue";
|
|
2
2
|
import { ScalarCodeBlock as Y } from "@scalar/components";
|
|
3
3
|
import { createHash as D, ssrState as z } from "@scalar/oas-utils/helpers";
|
|
4
|
-
import { getRequestFromOperation as
|
|
5
|
-
import { asyncComputed as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
4
|
+
import { getRequestFromOperation as G } from "@scalar/oas-utils/spec-getters";
|
|
5
|
+
import { asyncComputed as Q } from "@vueuse/core";
|
|
6
|
+
import W from "./ExamplePicker.vue.js";
|
|
7
|
+
import X from "./TextSelect.vue.js";
|
|
8
8
|
/* empty css */
|
|
9
|
-
import { GLOBAL_SECURITY_SYMBOL as
|
|
9
|
+
import { GLOBAL_SECURITY_SYMBOL as Z } from "../../helpers/provideSymbols.js";
|
|
10
10
|
import ee from "../../components/Card/Card.vue.js";
|
|
11
11
|
import te from "../../components/Card/CardHeader.vue.js";
|
|
12
12
|
import oe from "../../components/HttpMethod/HttpMethod.vue.js";
|
|
@@ -16,35 +16,34 @@ import se from "../../components/Card/CardFooter.vue.js";
|
|
|
16
16
|
import { getExampleCode as le } from "../../helpers/getExampleCode.js";
|
|
17
17
|
import { useHttpClientStore as ie } from "../../stores/useHttpClientStore.js";
|
|
18
18
|
import { useServerStore as ce } from "../../legacy/stores/useServerStore.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
const fe = { class: "request-header" }, ye = { class: "code-snippet" }, ve = {
|
|
19
|
+
import { useAuthenticationStore as ue } from "../../legacy/stores/useAuthenticationStore.js";
|
|
20
|
+
import { getHarRequest as me } from "../../helpers/getHarRequest.js";
|
|
21
|
+
import { getUrlFromServerState as pe } from "../../legacy/helpers/getUrlFromServerState.js";
|
|
22
|
+
const de = { class: "request-header" }, fe = { class: "code-snippet" }, ye = {
|
|
24
23
|
key: 0,
|
|
25
24
|
class: "request-card-footer-addon"
|
|
26
|
-
},
|
|
25
|
+
}, we = /* @__PURE__ */ U({
|
|
27
26
|
__name: "ExampleRequest",
|
|
28
27
|
props: {
|
|
29
28
|
operation: {}
|
|
30
29
|
},
|
|
31
|
-
setup(
|
|
32
|
-
const n =
|
|
30
|
+
setup(R) {
|
|
31
|
+
const n = R, h = `components-Content-Operation-Example-Request${D(
|
|
33
32
|
n.operation.path + n.operation.httpVerb + n.operation.operationId
|
|
34
|
-
)}`,
|
|
35
|
-
httpClient:
|
|
36
|
-
setHttpClient:
|
|
37
|
-
availableTargets:
|
|
38
|
-
httpTargetTitle:
|
|
39
|
-
httpClientTitle:
|
|
40
|
-
} = ie(), { server:
|
|
33
|
+
)}`, K = q(), {
|
|
34
|
+
httpClient: s,
|
|
35
|
+
setHttpClient: B,
|
|
36
|
+
availableTargets: x,
|
|
37
|
+
httpTargetTitle: $,
|
|
38
|
+
httpClientTitle: j
|
|
39
|
+
} = ie(), { server: F } = ce(), { authentication: C } = ue(), i = d(() => {
|
|
41
40
|
var t;
|
|
42
41
|
const e = ["x-custom-examples", "x-codeSamples", "x-code-samples"];
|
|
43
42
|
for (const o of e)
|
|
44
43
|
if ((t = n.operation.information) != null && t[o])
|
|
45
44
|
return n.operation.information[o] ?? [];
|
|
46
45
|
return [];
|
|
47
|
-
}),
|
|
46
|
+
}), a = q(
|
|
48
47
|
// Default to first custom example
|
|
49
48
|
i.value.length ? {
|
|
50
49
|
targetKey: "customExamples",
|
|
@@ -52,75 +51,70 @@ const fe = { class: "request-header" }, ye = { class: "code-snippet" }, ve = {
|
|
|
52
51
|
} : (
|
|
53
52
|
// Otherwise use the globally selected HTTP client
|
|
54
53
|
{
|
|
55
|
-
targetKey:
|
|
56
|
-
clientKey:
|
|
54
|
+
targetKey: s.targetKey,
|
|
55
|
+
clientKey: s.clientKey
|
|
57
56
|
}
|
|
58
57
|
)
|
|
59
58
|
);
|
|
60
|
-
L(
|
|
61
|
-
|
|
62
|
-
targetKey:
|
|
63
|
-
clientKey:
|
|
59
|
+
L(s, () => {
|
|
60
|
+
a.value = {
|
|
61
|
+
targetKey: s.targetKey,
|
|
62
|
+
clientKey: s.clientKey
|
|
64
63
|
};
|
|
65
64
|
});
|
|
66
|
-
const
|
|
65
|
+
const S = d(
|
|
67
66
|
() => {
|
|
68
67
|
var e, t, o, l;
|
|
69
68
|
return Object.keys(
|
|
70
69
|
((l = (o = (t = (e = n.operation.information) == null ? void 0 : e.requestBody) == null ? void 0 : t.content) == null ? void 0 : o["application/json"]) == null ? void 0 : l.examples) ?? {}
|
|
71
70
|
).length > 1;
|
|
72
71
|
}
|
|
73
|
-
),
|
|
74
|
-
async function
|
|
75
|
-
var l,
|
|
76
|
-
if (
|
|
77
|
-
return ((l = i.value[
|
|
78
|
-
const e =
|
|
72
|
+
), f = I(Z);
|
|
73
|
+
async function E() {
|
|
74
|
+
var l, m;
|
|
75
|
+
if (a.value.targetKey === "customExamples")
|
|
76
|
+
return ((l = i.value[a.value.clientKey]) == null ? void 0 : l.source) ?? "";
|
|
77
|
+
const e = me(
|
|
79
78
|
{
|
|
80
|
-
url:
|
|
79
|
+
url: pe(F)
|
|
81
80
|
},
|
|
82
|
-
|
|
81
|
+
G(
|
|
83
82
|
n.operation,
|
|
84
83
|
{
|
|
85
84
|
replaceVariables: !0
|
|
86
85
|
},
|
|
87
|
-
|
|
86
|
+
K.value
|
|
88
87
|
),
|
|
89
88
|
ne(
|
|
90
|
-
|
|
91
|
-
((
|
|
89
|
+
C,
|
|
90
|
+
((m = n.operation.information) == null ? void 0 : m.security) ?? (f == null ? void 0 : f())
|
|
92
91
|
)
|
|
93
|
-
), t =
|
|
92
|
+
), t = s.clientKey, o = s.targetKey;
|
|
94
93
|
return await le(e, o, t) ?? "";
|
|
95
94
|
}
|
|
96
|
-
const
|
|
95
|
+
const k = Q(async () => {
|
|
97
96
|
try {
|
|
98
|
-
return await
|
|
97
|
+
return await E();
|
|
99
98
|
} catch (e) {
|
|
100
99
|
return console.error("[generateSnippet]", e), "";
|
|
101
100
|
}
|
|
102
|
-
}, z[
|
|
101
|
+
}, z[h] ?? "");
|
|
103
102
|
M(async () => {
|
|
104
103
|
const e = P();
|
|
105
|
-
e.payload.data[
|
|
106
|
-
})
|
|
107
|
-
serverState: S,
|
|
108
|
-
authenticationState: y,
|
|
109
|
-
operation: n.operation,
|
|
110
|
-
globalSecurity: c == null ? void 0 : c()
|
|
111
|
-
}));
|
|
104
|
+
e.payload.data[h] = await E();
|
|
105
|
+
});
|
|
112
106
|
const T = d(() => {
|
|
113
107
|
var t, o;
|
|
114
108
|
const e = (
|
|
115
109
|
// Specified language
|
|
116
|
-
((t =
|
|
110
|
+
((t = a.value) == null ? void 0 : t.targetKey) === "customExamples" ? ((o = i.value[a.value.clientKey]) == null ? void 0 : o.lang) ?? "plaintext" : (
|
|
117
111
|
// Or language for the globally selected HTTP client
|
|
118
|
-
|
|
112
|
+
s.targetKey
|
|
119
113
|
)
|
|
120
114
|
);
|
|
121
|
-
return e === "shell" &&
|
|
115
|
+
return e === "shell" && k.value.includes("curl") ? "curl" : e === "Objective-C" ? "objc" : e;
|
|
122
116
|
}), w = d(() => {
|
|
123
|
-
const e =
|
|
117
|
+
const e = x.value.map((t) => ({
|
|
124
118
|
value: t.key,
|
|
125
119
|
label: t.title,
|
|
126
120
|
options: t.clients.map((o) => ({
|
|
@@ -145,34 +139,34 @@ const fe = { class: "request-header" }, ye = { class: "code-snippet" }, ve = {
|
|
|
145
139
|
});
|
|
146
140
|
function A(e) {
|
|
147
141
|
const t = JSON.parse(e);
|
|
148
|
-
t.targetKey === "customExamples" ?
|
|
142
|
+
t.targetKey === "customExamples" ? a.value = t : B(t);
|
|
149
143
|
}
|
|
150
|
-
return (e, t) => r(
|
|
144
|
+
return (e, t) => r(x).length || i.value.length ? (p(), _(r(ee), {
|
|
151
145
|
key: 0,
|
|
152
146
|
class: "dark-mode"
|
|
153
147
|
}, {
|
|
154
|
-
default:
|
|
155
|
-
|
|
156
|
-
actions:
|
|
157
|
-
|
|
148
|
+
default: c(() => [
|
|
149
|
+
u(r(te), { muted: "" }, {
|
|
150
|
+
actions: c(() => [
|
|
151
|
+
u(X, {
|
|
158
152
|
class: "request-client-picker",
|
|
159
|
-
modelValue: JSON.stringify(
|
|
153
|
+
modelValue: JSON.stringify(a.value),
|
|
160
154
|
options: w.value,
|
|
161
155
|
"onUpdate:modelValue": A
|
|
162
156
|
}, {
|
|
163
|
-
default:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
], 64)) : (
|
|
167
|
-
|
|
157
|
+
default: c(() => [
|
|
158
|
+
a.value.targetKey === "customExamples" ? (p(), y(V, { key: 0 }, [
|
|
159
|
+
O(v(i.value[a.value.clientKey].label ?? "Example"), 1)
|
|
160
|
+
], 64)) : (p(), y(V, { key: 1 }, [
|
|
161
|
+
O(v(r($)) + " " + v(r(j)), 1)
|
|
168
162
|
], 64))
|
|
169
163
|
]),
|
|
170
164
|
_: 1
|
|
171
165
|
}, 8, ["modelValue", "options"])
|
|
172
166
|
]),
|
|
173
|
-
default:
|
|
174
|
-
H("div",
|
|
175
|
-
|
|
167
|
+
default: c(() => [
|
|
168
|
+
H("div", de, [
|
|
169
|
+
u(r(oe), {
|
|
176
170
|
as: "span",
|
|
177
171
|
class: "request-method",
|
|
178
172
|
method: e.operation.httpVerb
|
|
@@ -182,17 +176,17 @@ const fe = { class: "request-header" }, ye = { class: "code-snippet" }, ve = {
|
|
|
182
176
|
]),
|
|
183
177
|
_: 3
|
|
184
178
|
}),
|
|
185
|
-
|
|
179
|
+
u(r(re), {
|
|
186
180
|
borderless: "",
|
|
187
181
|
class: "request-editor-section custom-scroll",
|
|
188
182
|
frameless: ""
|
|
189
183
|
}, {
|
|
190
|
-
default:
|
|
191
|
-
H("div",
|
|
192
|
-
|
|
184
|
+
default: c(() => [
|
|
185
|
+
H("div", fe, [
|
|
186
|
+
u(r(Y), {
|
|
193
187
|
class: "bg-b-2",
|
|
194
|
-
content: r(
|
|
195
|
-
hideCredentials: r(ae)(r(
|
|
188
|
+
content: r(k),
|
|
189
|
+
hideCredentials: r(ae)(r(C)),
|
|
196
190
|
lang: T.value,
|
|
197
191
|
lineNumbers: ""
|
|
198
192
|
}, null, 8, ["content", "hideCredentials", "lang"])
|
|
@@ -200,31 +194,31 @@ const fe = { class: "request-header" }, ye = { class: "code-snippet" }, ve = {
|
|
|
200
194
|
]),
|
|
201
195
|
_: 1
|
|
202
196
|
}),
|
|
203
|
-
|
|
197
|
+
S.value || e.$slots.footer ? (p(), _(r(se), {
|
|
204
198
|
key: 0,
|
|
205
199
|
class: "request-card-footer",
|
|
206
200
|
contrast: ""
|
|
207
201
|
}, {
|
|
208
|
-
default:
|
|
209
|
-
var o, l,
|
|
202
|
+
default: c(() => {
|
|
203
|
+
var o, l, m, b;
|
|
210
204
|
return [
|
|
211
|
-
|
|
212
|
-
|
|
205
|
+
S.value ? (p(), y("div", ye, [
|
|
206
|
+
u(W, {
|
|
213
207
|
class: "request-example-selector",
|
|
214
|
-
examples: ((
|
|
215
|
-
"onUpdate:modelValue": t[0] || (t[0] = (J) =>
|
|
208
|
+
examples: ((b = (m = (l = (o = e.operation.information) == null ? void 0 : o.requestBody) == null ? void 0 : l.content) == null ? void 0 : m["application/json"]) == null ? void 0 : b.examples) ?? [],
|
|
209
|
+
"onUpdate:modelValue": t[0] || (t[0] = (J) => K.value = J)
|
|
216
210
|
}, null, 8, ["examples"])
|
|
217
|
-
])) :
|
|
211
|
+
])) : g("", !0),
|
|
218
212
|
N(e.$slots, "footer", {}, void 0, !0)
|
|
219
213
|
];
|
|
220
214
|
}),
|
|
221
215
|
_: 3
|
|
222
|
-
})) :
|
|
216
|
+
})) : g("", !0)
|
|
223
217
|
]),
|
|
224
218
|
_: 3
|
|
225
|
-
})) :
|
|
219
|
+
})) : g("", !0);
|
|
226
220
|
}
|
|
227
221
|
});
|
|
228
222
|
export {
|
|
229
|
-
|
|
223
|
+
we as default
|
|
230
224
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getExampleCode.d.ts","sourceRoot":"","sources":["../../src/helpers/getExampleCode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,QAAQ,IAAI,gBAAgB,EACjC,KAAK,QAAQ,IAAI,gBAAgB,EAElC,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAEL,KAAK,QAAQ,IAAI,uBAAuB,EACxC,KAAK,QAAQ,IAAI,uBAAuB,EACzC,MAAM,kBAAkB,CAAA;AAEzB,MAAM,MAAM,QAAQ,GAAG,uBAAuB,GAAG,gBAAgB,CAAA;AACjE,MAAM,MAAM,QAAQ,GAAG,uBAAuB,GAAG,gBAAgB,CAAA;AAEjE;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"getExampleCode.d.ts","sourceRoot":"","sources":["../../src/helpers/getExampleCode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,QAAQ,IAAI,gBAAgB,EACjC,KAAK,QAAQ,IAAI,gBAAgB,EAElC,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAEL,KAAK,QAAQ,IAAI,uBAAuB,EACxC,KAAK,QAAQ,IAAI,uBAAuB,EACzC,MAAM,kBAAkB,CAAA;AAEzB,MAAM,MAAM,QAAQ,GAAG,uBAAuB,GAAG,gBAAgB,CAAA;AACjE,MAAM,MAAM,QAAQ,GAAG,uBAAuB,GAAG,gBAAgB,CAAA;AAEjE;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,QAAQ,mBAoCjB"}
|
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
import { snippetz as
|
|
2
|
-
import { HTTPSnippet as
|
|
3
|
-
async function
|
|
4
|
-
const
|
|
5
|
-
if (
|
|
6
|
-
return
|
|
1
|
+
import { snippetz as o } from "@scalar/snippetz";
|
|
2
|
+
import { HTTPSnippet as c } from "httpsnippet-lite";
|
|
3
|
+
async function m(r, e, t) {
|
|
4
|
+
const i = e;
|
|
5
|
+
if (o().hasPlugin(i, t))
|
|
6
|
+
return o().print(
|
|
7
|
+
e,
|
|
7
8
|
t,
|
|
8
|
-
r
|
|
9
|
-
o
|
|
9
|
+
r
|
|
10
10
|
);
|
|
11
11
|
try {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const p = e.replace(
|
|
13
|
+
"js",
|
|
14
|
+
"javascript"
|
|
15
|
+
), a = t, n = await new c(r).convert(
|
|
16
|
+
p,
|
|
17
|
+
a
|
|
15
18
|
);
|
|
16
|
-
if (typeof
|
|
17
|
-
} catch (
|
|
19
|
+
if (typeof n == "string") return n;
|
|
20
|
+
} catch (p) {
|
|
18
21
|
console.error(
|
|
19
22
|
"[getExampleCode] Failed to generate example code with httpsnippet-lite:",
|
|
20
|
-
|
|
23
|
+
p
|
|
21
24
|
);
|
|
22
25
|
}
|
|
23
26
|
return "";
|
|
24
27
|
}
|
|
25
28
|
export {
|
|
26
|
-
|
|
29
|
+
m as getExampleCode
|
|
27
30
|
};
|