@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.
@@ -1 +1 @@
1
- {"version":3,"file":"ApiClientModal.vue.d.ts","sourceRoot":"","sources":["../../src/components/ApiClientModal.vue"],"names":[],"mappings":"AAiFA,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
+ {"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 S, ref as l, onMounted as U, watch as _, onBeforeUnmount as h, openBlock as x, createElementBlock as y } from "vue";
2
- import { modalStateBus as B, apiClientBus as A } from "./api-client-bus.js";
3
- import { useServerStore as C } from "../legacy/stores/useServerStore.js";
4
- import { getUrlFromServerState as k } from "../legacy/helpers/getUrlFromServerState.js";
5
- import { useAuthenticationStore as M } from "../legacy/stores/useAuthenticationStore.js";
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(u) {
14
- const t = u, o = l(null), p = l(null), { authentication: c } = M(), { server: i } = C();
15
- return U(async () => {
16
- if (!o.value) return;
17
- const { createApiClientModal: r } = await import("@scalar/api-client"), { app: n, open: m, updateAuth: f, updateServerUrl: d, modalState: v, updateSpec: a } = await r(o.value, {
18
- spec: t.spec ?? {},
19
- proxyUrl: t.proxyUrl,
20
- servers: t.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
- B.emit(v), A.on((e) => {
23
- if (e.open) {
24
- f(c);
25
- const s = k(i);
26
- s && d(s), m(e.open);
27
- }
28
- e.updateSpec && a(e.updateSpec);
29
- }), _(
30
- () => t.spec,
31
- (e) => e && a(e),
32
- { deep: !0 }
33
- ), p.value = n;
34
- }), h(() => {
35
- var r;
36
- return (r = p.value) == null ? void 0 : r.unmount();
37
- }), (r, n) => (x(), y("div", {
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: o
44
+ ref: a
40
45
  }, null, 512));
41
46
  }
42
47
  });
43
48
  export {
44
- b as default
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,KAgB9B,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAmBjC,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,KAkC7B,CAAA"}
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 { AuthenticationState, SpecConfiguration } from '@scalar/types/legacy';
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?: AuthenticationState;
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;AAEhE,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAElD,KAAK,eAAe,GAAG,iBAAiB,CAAC;IACvC,IAAI,CAAC,EAAE,iBAAiB,CAAA;IACxB,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC,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
+ {"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":"AA4XA,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,sBAAsB,CAAA;AA8P7B,iBAAS,cAAc;oBAiNM,GAAG;oBACH,GAAG;EAmC/B;AACD,QAAA,MAAM,eAAe;eArdR,oBAAoB;;eAApB,oBAAoB;aA2d/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
+ {"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-292a80da"]]);
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 b, computed as d, watch as L, inject as I, onServerPrefetch as M, useSSRContext as P, unref as r, openBlock as f, createBlock as V, withCtx as u, createVNode as m, createElementBlock as v, Fragment as O, createTextVNode as R, toDisplayString as g, createElementVNode as H, renderSlot as N, createCommentVNode as h } from "vue";
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 Q } from "@scalar/oas-utils/spec-getters";
5
- import { asyncComputed as W } from "@vueuse/core";
6
- import X from "./ExamplePicker.vue.js";
7
- import Z from "./TextSelect.vue.js";
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 G } from "../../helpers/provideSymbols.js";
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 { getApiClientRequest as ue } from "../../helpers/getApiClientRequest.js";
20
- import { useAuthenticationStore as me } from "../../legacy/stores/useAuthenticationStore.js";
21
- import { getHarRequest as pe } from "../../helpers/getHarRequest.js";
22
- import { getUrlFromServerState as de } from "../../legacy/helpers/getUrlFromServerState.js";
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
- }, Je = /* @__PURE__ */ U({
25
+ }, we = /* @__PURE__ */ U({
27
26
  __name: "ExampleRequest",
28
27
  props: {
29
28
  operation: {}
30
29
  },
31
- setup(B) {
32
- const n = B, K = `components-Content-Operation-Example-Request${D(
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
- )}`, x = b(), {
35
- httpClient: a,
36
- setHttpClient: $,
37
- availableTargets: C,
38
- httpTargetTitle: j,
39
- httpClientTitle: F
40
- } = ie(), { server: S } = ce(), { authentication: y } = me(), i = d(() => {
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
- }), s = b(
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: a.targetKey,
56
- clientKey: a.clientKey
54
+ targetKey: s.targetKey,
55
+ clientKey: s.clientKey
57
56
  }
58
57
  )
59
58
  );
60
- L(a, () => {
61
- s.value = {
62
- targetKey: a.targetKey,
63
- clientKey: a.clientKey
59
+ L(s, () => {
60
+ a.value = {
61
+ targetKey: s.targetKey,
62
+ clientKey: s.clientKey
64
63
  };
65
64
  });
66
- const E = d(
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
- ), c = I(G);
74
- async function k() {
75
- var l, p;
76
- if (s.value.targetKey === "customExamples")
77
- return ((l = i.value[s.value.clientKey]) == null ? void 0 : l.source) ?? "";
78
- const e = pe(
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: de(S)
79
+ url: pe(F)
81
80
  },
82
- Q(
81
+ G(
83
82
  n.operation,
84
83
  {
85
84
  replaceVariables: !0
86
85
  },
87
- x.value
86
+ K.value
88
87
  ),
89
88
  ne(
90
- y,
91
- ((p = n.operation.information) == null ? void 0 : p.security) ?? (c == null ? void 0 : c())
89
+ C,
90
+ ((m = n.operation.information) == null ? void 0 : m.security) ?? (f == null ? void 0 : f())
92
91
  )
93
- ), t = a.clientKey === "undici" || a.clientKey === "fetch" || a.clientKey === "ofetch" ? a.clientKey : null, o = a.targetKey;
92
+ ), t = s.clientKey, o = s.targetKey;
94
93
  return await le(e, o, t) ?? "";
95
94
  }
96
- const q = W(async () => {
95
+ const k = Q(async () => {
97
96
  try {
98
- return await k();
97
+ return await E();
99
98
  } catch (e) {
100
99
  return console.error("[generateSnippet]", e), "";
101
100
  }
102
- }, z[K] ?? "");
101
+ }, z[h] ?? "");
103
102
  M(async () => {
104
103
  const e = P();
105
- e.payload.data[K] = await k();
106
- }), d(() => ue({
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 = s.value) == null ? void 0 : t.targetKey) === "customExamples" ? ((o = i.value[s.value.clientKey]) == null ? void 0 : o.lang) ?? "plaintext" : (
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
- a.targetKey
112
+ s.targetKey
119
113
  )
120
114
  );
121
- return e === "shell" && q.value.includes("curl") ? "curl" : e === "Objective-C" ? "objc" : e;
115
+ return e === "shell" && k.value.includes("curl") ? "curl" : e === "Objective-C" ? "objc" : e;
122
116
  }), w = d(() => {
123
- const e = C.value.map((t) => ({
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" ? s.value = t : $(t);
142
+ t.targetKey === "customExamples" ? a.value = t : B(t);
149
143
  }
150
- return (e, t) => r(C).length || i.value.length ? (f(), V(r(ee), {
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: u(() => [
155
- m(r(te), { muted: "" }, {
156
- actions: u(() => [
157
- m(Z, {
148
+ default: c(() => [
149
+ u(r(te), { muted: "" }, {
150
+ actions: c(() => [
151
+ u(X, {
158
152
  class: "request-client-picker",
159
- modelValue: JSON.stringify(s.value),
153
+ modelValue: JSON.stringify(a.value),
160
154
  options: w.value,
161
155
  "onUpdate:modelValue": A
162
156
  }, {
163
- default: u(() => [
164
- s.value.targetKey === "customExamples" ? (f(), v(O, { key: 0 }, [
165
- R(g(i.value[s.value.clientKey].label ?? "Example"), 1)
166
- ], 64)) : (f(), v(O, { key: 1 }, [
167
- R(g(r(j)) + " " + g(r(F)), 1)
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: u(() => [
174
- H("div", fe, [
175
- m(r(oe), {
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
- m(r(re), {
179
+ u(r(re), {
186
180
  borderless: "",
187
181
  class: "request-editor-section custom-scroll",
188
182
  frameless: ""
189
183
  }, {
190
- default: u(() => [
191
- H("div", ye, [
192
- m(r(Y), {
184
+ default: c(() => [
185
+ H("div", fe, [
186
+ u(r(Y), {
193
187
  class: "bg-b-2",
194
- content: r(q),
195
- hideCredentials: r(ae)(r(y)),
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
- E.value || e.$slots.footer ? (f(), V(r(se), {
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: u(() => {
209
- var o, l, p, _;
202
+ default: c(() => {
203
+ var o, l, m, b;
210
204
  return [
211
- E.value ? (f(), v("div", ve, [
212
- m(X, {
205
+ S.value ? (p(), y("div", ye, [
206
+ u(W, {
213
207
  class: "request-example-selector",
214
- examples: ((_ = (p = (l = (o = e.operation.information) == null ? void 0 : o.requestBody) == null ? void 0 : l.content) == null ? void 0 : p["application/json"]) == null ? void 0 : _.examples) ?? [],
215
- "onUpdate:modelValue": t[0] || (t[0] = (J) => x.value = 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
- ])) : h("", !0),
211
+ ])) : g("", !0),
218
212
  N(e.$slots, "footer", {}, void 0, !0)
219
213
  ];
220
214
  }),
221
215
  _: 3
222
- })) : h("", !0)
216
+ })) : g("", !0)
223
217
  ]),
224
218
  _: 3
225
- })) : h("", !0);
219
+ })) : g("", !0);
226
220
  }
227
221
  });
228
222
  export {
229
- Je as default
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,mBA8BjB"}
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 p } from "@scalar/snippetz";
2
- import { HTTPSnippet as i } from "httpsnippet-lite";
3
- async function s(o, t, r) {
4
- const n = t.replace("javascript", "js");
5
- if (p().hasPlugin(n, r))
6
- return p().print(
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 e = await new i(o).convert(
13
- t,
14
- r
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 e == "string") return e;
17
- } catch (e) {
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
- e
23
+ p
21
24
  );
22
25
  }
23
26
  return "";
24
27
  }
25
28
  export {
26
- s as getExampleCode
29
+ m as getExampleCode
27
30
  };