@scalar/api-client 2.17.2 → 2.17.4
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 +87 -0
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +15 -10
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +70 -55
- package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-body.js +12 -8
- package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +3 -5
- package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-security.js +31 -31
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +4 -6
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request.js +20 -21
- package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/get-example.js +22 -16
- package/dist/v2/blocks/operation-block/helpers/send-request.js +26 -26
- package/dist/v2/blocks/operation-block/index.d.ts +1 -0
- package/dist/v2/blocks/operation-block/index.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/index.js +4 -2
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +9 -4
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +81 -88
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +4 -4
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +1 -1
- package/dist/v2/blocks/operation-code-sample/index.d.ts +1 -0
- package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/index.js +11 -9
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +3 -2
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js +2 -2
- package/dist/v2/blocks/request-block/RequestBlock.vue2.js +59 -63
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
- package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +78 -74
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js +3 -3
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +43 -42
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +96 -86
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.d.ts +8 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.js +33 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.d.ts +7 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.js +13 -0
- package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts +3 -0
- package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/index.js +8 -2
- package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.js +2 -2
- package/dist/v2/components/data-table/DataTableInput.vue2.js +25 -24
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +34 -33
- package/dist/v2/features/app/helpers/routes.d.ts +2 -0
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts.map +1 -1
- package/dist/v2/features/app/hooks/use-workspace-client-app-events.js +29 -29
- package/dist/v2/features/collection/DocumentCollection.vue.js +4 -3
- package/dist/v2/features/collection/WorkspaceCollection.vue.js +8 -7
- package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.js +1 -1
- package/dist/v2/features/collection/components/Authentication.vue2.js +7 -6
- package/dist/v2/features/collection/components/Cookies.vue.js +1 -0
- package/dist/v2/features/collection/components/Environment.vue.js +1 -0
- package/dist/v2/features/collection/components/Overview.vue2.js +8 -7
- package/dist/v2/features/collection/components/Servers.vue.js +25 -24
- package/dist/v2/features/collection/components/Settings.vue.js +8 -7
- package/dist/v2/features/modal/Modal.vue.d.ts +6 -0
- 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 +66 -62
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +16 -16
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
- package/dist/v2/features/modal/helpers/create-api-client-modal.js +36 -29
- package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts.map +1 -1
- package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.js +25 -12
- package/dist/v2/features/modal/index.d.ts +2 -1
- package/dist/v2/features/modal/index.d.ts.map +1 -1
- package/dist/v2/features/modal/index.js +3 -1
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +54 -62
- package/dist/v2/features/operation/helpers/get-security-requirements.d.ts +1 -1
- package/dist/v2/features/operation/helpers/get-security-requirements.d.ts.map +1 -1
- package/dist/v2/features/operation/helpers/get-security-requirements.js +2 -2
- package/dist/v2/features/operation/helpers/get-selected-security.d.ts +5 -2
- package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -1
- package/dist/v2/features/operation/helpers/get-selected-security.js +11 -11
- package/dist/v2/features/operation/helpers/get-selected-server.d.ts +10 -0
- package/dist/v2/features/operation/helpers/get-selected-server.d.ts.map +1 -0
- package/dist/v2/features/operation/helpers/get-selected-server.js +4 -0
- package/dist/v2/features/operation/index.d.ts +3 -0
- package/dist/v2/features/operation/index.d.ts.map +1 -1
- package/dist/v2/features/operation/index.js +8 -2
- package/dist/v2/helpers/index.d.ts +3 -0
- package/dist/v2/helpers/index.d.ts.map +1 -0
- package/dist/v2/helpers/index.js +4 -0
- package/dist/v2/helpers/plugins.d.ts +7 -1
- package/dist/v2/helpers/plugins.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +22 -17
|
@@ -9,6 +9,7 @@ import type { OpenApiDocument, ServerObject } from '@scalar/workspace-store/sche
|
|
|
9
9
|
import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation';
|
|
10
10
|
import type { ClientLayout } from '../../../hooks/index.js';
|
|
11
11
|
import { type History } from '../../../v2/blocks/scalar-address-bar-block/index.js';
|
|
12
|
+
import type { MergedSecuritySchemes } from '../../../v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.js';
|
|
12
13
|
import { type ClientPlugin } from '../../../v2/helpers/plugins.js';
|
|
13
14
|
/**
|
|
14
15
|
* OperationBlock
|
|
@@ -26,6 +27,10 @@ import { type ClientPlugin } from '../../../v2/helpers/plugins.js';
|
|
|
26
27
|
declare const _default: import("vue").DefineComponent<{
|
|
27
28
|
/** Event bus */
|
|
28
29
|
eventBus: WorkspaceEventBus;
|
|
30
|
+
/** Document defined security */
|
|
31
|
+
documentSecurity: OpenApiDocument["security"];
|
|
32
|
+
/** Document selected security */
|
|
33
|
+
documentSelectedSecurity: OpenApiDocument["x-scalar-selected-security"];
|
|
29
34
|
/** Application version */
|
|
30
35
|
appVersion: string;
|
|
31
36
|
/** Workspace/document cookies */
|
|
@@ -58,16 +63,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
58
63
|
source?: "gitbook" | "api-reference";
|
|
59
64
|
/** Operation object */
|
|
60
65
|
operation: OperationObject;
|
|
66
|
+
/** Whether to set security at the operation level */
|
|
67
|
+
setOperationSecurity: boolean;
|
|
61
68
|
/** Currently selected example key for the current operation */
|
|
62
69
|
exampleKey: string;
|
|
63
70
|
/** Meta information for the auth update */
|
|
64
71
|
authMeta: AuthMeta;
|
|
65
72
|
/** Document defined security schemes */
|
|
66
|
-
securitySchemes:
|
|
67
|
-
/** Currently selected security for the current operation */
|
|
68
|
-
selectedSecurity: OpenApiDocument["x-scalar-selected-security"];
|
|
69
|
-
/** Required security for the operation/document */
|
|
70
|
-
securityRequirements: OpenApiDocument["security"];
|
|
73
|
+
securitySchemes: MergedSecuritySchemes;
|
|
71
74
|
/** Client plugins */
|
|
72
75
|
plugins: ClientPlugin[];
|
|
73
76
|
/** For environment variables in the inputs */
|
|
@@ -79,6 +82,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
79
82
|
}, string, import("vue").PublicProps, Readonly<{
|
|
80
83
|
/** Event bus */
|
|
81
84
|
eventBus: WorkspaceEventBus;
|
|
85
|
+
/** Document defined security */
|
|
86
|
+
documentSecurity: OpenApiDocument["security"];
|
|
87
|
+
/** Document selected security */
|
|
88
|
+
documentSelectedSecurity: OpenApiDocument["x-scalar-selected-security"];
|
|
82
89
|
/** Application version */
|
|
83
90
|
appVersion: string;
|
|
84
91
|
/** Workspace/document cookies */
|
|
@@ -111,16 +118,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
111
118
|
source?: "gitbook" | "api-reference";
|
|
112
119
|
/** Operation object */
|
|
113
120
|
operation: OperationObject;
|
|
121
|
+
/** Whether to set security at the operation level */
|
|
122
|
+
setOperationSecurity: boolean;
|
|
114
123
|
/** Currently selected example key for the current operation */
|
|
115
124
|
exampleKey: string;
|
|
116
125
|
/** Meta information for the auth update */
|
|
117
126
|
authMeta: AuthMeta;
|
|
118
127
|
/** Document defined security schemes */
|
|
119
|
-
securitySchemes:
|
|
120
|
-
/** Currently selected security for the current operation */
|
|
121
|
-
selectedSecurity: OpenApiDocument["x-scalar-selected-security"];
|
|
122
|
-
/** Required security for the operation/document */
|
|
123
|
-
securityRequirements: OpenApiDocument["security"];
|
|
128
|
+
securitySchemes: MergedSecuritySchemes;
|
|
124
129
|
/** Client plugins */
|
|
125
130
|
plugins: ClientPlugin[];
|
|
126
131
|
/** For environment variables in the inputs */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OperationBlock.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"names":[],"mappings":"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"}
|
|
@@ -1,27 +1,32 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { AVAILABLE_CLIENTS as
|
|
3
|
-
import { useToasts as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { ERRORS as
|
|
7
|
-
import { createStoreEvents as
|
|
8
|
-
import { buildRequest as
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
1
|
+
import { defineComponent as R, computed as s, ref as a, onMounted as C, onBeforeUnmount as U, watch as k, createElementBlock as E, openBlock as b, createElementVNode as O, createVNode as n, withCtx as S, unref as m } from "vue";
|
|
2
|
+
import { AVAILABLE_CLIENTS as V } from "@scalar/types/snippetz";
|
|
3
|
+
import { useToasts as K } from "@scalar/use-toasts";
|
|
4
|
+
import w from "../../../components/ViewLayout/ViewLayout.vue.js";
|
|
5
|
+
import P from "../../../components/ViewLayout/ViewLayoutContent.vue.js";
|
|
6
|
+
import { ERRORS as M } from "../../../libs/errors.js";
|
|
7
|
+
import { createStoreEvents as A } from "../../../store/events.js";
|
|
8
|
+
import { buildRequest as L } from "./helpers/build-request.js";
|
|
9
|
+
import { getSecuritySchemes as T } from "./helpers/build-request-security.js";
|
|
10
|
+
import { sendRequest as N } from "./helpers/send-request.js";
|
|
11
|
+
import I from "./components/Header.vue.js";
|
|
12
|
+
import { generateClientOptions as $ } from "../operation-code-sample/helpers/generate-client-options.js";
|
|
13
|
+
import { getSecurityRequirements as j } from "../../features/operation/helpers/get-security-requirements.js";
|
|
14
|
+
import { getSelectedSecurity as D } from "../../features/operation/helpers/get-selected-security.js";
|
|
15
|
+
import H from "../request-block/RequestBlock.vue.js";
|
|
16
|
+
import Q from "../response-block/ResponseBlock.vue.js";
|
|
17
|
+
const z = { class: "bg-b-1 flex h-full flex-col" }, F = { class: "lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0" }, G = {
|
|
15
18
|
name: "OperationBlock"
|
|
16
|
-
},
|
|
17
|
-
...
|
|
19
|
+
}, ae = /* @__PURE__ */ R({
|
|
20
|
+
...G,
|
|
18
21
|
props: {
|
|
19
22
|
eventBus: {},
|
|
23
|
+
documentSecurity: {},
|
|
24
|
+
documentSelectedSecurity: {},
|
|
20
25
|
appVersion: {},
|
|
21
26
|
globalCookies: { default: () => [] },
|
|
22
27
|
path: {},
|
|
23
28
|
method: {},
|
|
24
|
-
httpClients: { default: () =>
|
|
29
|
+
httpClients: { default: () => V },
|
|
25
30
|
layout: {},
|
|
26
31
|
server: {},
|
|
27
32
|
selectedClient: {},
|
|
@@ -33,56 +38,65 @@ const I = { class: "bg-b-1 flex h-full flex-col" }, $ = { class: "lg:min-h-heade
|
|
|
33
38
|
documentUrl: {},
|
|
34
39
|
source: {},
|
|
35
40
|
operation: {},
|
|
41
|
+
setOperationSecurity: { type: Boolean },
|
|
36
42
|
exampleKey: {},
|
|
37
43
|
authMeta: {},
|
|
38
44
|
securitySchemes: {},
|
|
39
|
-
selectedSecurity: {},
|
|
40
|
-
securityRequirements: {},
|
|
41
45
|
plugins: { default: () => [] },
|
|
42
46
|
environment: {},
|
|
43
47
|
proxyUrl: {}
|
|
44
48
|
},
|
|
45
49
|
emits: ["update:servers"],
|
|
46
|
-
setup(t, { emit:
|
|
47
|
-
const
|
|
48
|
-
|
|
50
|
+
setup(t, { emit: B }) {
|
|
51
|
+
const g = B, q = s(() => $(t.httpClients)), c = s(
|
|
52
|
+
() => j(t.documentSecurity, t.operation.security)
|
|
53
|
+
), d = s(
|
|
54
|
+
() => D(
|
|
55
|
+
t.documentSelectedSecurity,
|
|
56
|
+
t.operation["x-scalar-selected-security"],
|
|
57
|
+
c.value,
|
|
58
|
+
t.setOperationSecurity
|
|
59
|
+
)
|
|
60
|
+
), v = s(
|
|
61
|
+
() => T(t.securitySchemes, d.value.selectedSchemes)
|
|
62
|
+
), { toast: y } = K(), h = a(null), u = a(null), l = a(null), p = () => h.value?.abort(M.REQUEST_ABORTED), r = async () => {
|
|
63
|
+
const [e, o] = L({
|
|
49
64
|
environment: t.environment,
|
|
50
65
|
exampleKey: t.exampleKey,
|
|
51
66
|
globalCookies: t.globalCookies,
|
|
52
67
|
method: t.method,
|
|
53
68
|
operation: t.operation,
|
|
54
69
|
path: t.path,
|
|
55
|
-
|
|
56
|
-
selectedSecurity: t.selectedSecurity?.selectedSchemes ?? [],
|
|
70
|
+
selectedSecuritySchemes: v.value,
|
|
57
71
|
server: t.server,
|
|
58
72
|
proxyUrl: t.proxyUrl
|
|
59
73
|
});
|
|
60
74
|
if (e) {
|
|
61
|
-
|
|
75
|
+
y(e.message, "error");
|
|
62
76
|
return;
|
|
63
77
|
}
|
|
64
|
-
|
|
65
|
-
const [
|
|
66
|
-
isUsingProxy:
|
|
78
|
+
h.value = o.controller, t.eventBus.emit("hooks:on:request:sent");
|
|
79
|
+
const [i, f] = await N({
|
|
80
|
+
isUsingProxy: o.isUsingProxy,
|
|
67
81
|
operation: t.operation,
|
|
68
82
|
plugins: t.plugins,
|
|
69
|
-
request:
|
|
83
|
+
request: o.request
|
|
70
84
|
});
|
|
71
|
-
if (t.eventBus.emit("hooks:on:request:complete"),
|
|
72
|
-
|
|
85
|
+
if (t.eventBus.emit("hooks:on:request:complete"), i) {
|
|
86
|
+
y(i.message, "error");
|
|
73
87
|
return;
|
|
74
88
|
}
|
|
75
|
-
|
|
89
|
+
u.value = f.response, l.value = f.request;
|
|
76
90
|
};
|
|
77
|
-
return
|
|
78
|
-
t.eventBus.on("operation:send:request:hotkey", r), t.eventBus.on("operation:cancel:request",
|
|
79
|
-
}),
|
|
80
|
-
t.eventBus.off("operation:send:request:hotkey", r), t.eventBus.off("operation:cancel:request",
|
|
81
|
-
}),
|
|
82
|
-
|
|
83
|
-
}), (e,
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
return C(() => {
|
|
92
|
+
t.eventBus.on("operation:send:request:hotkey", r), t.eventBus.on("operation:cancel:request", p);
|
|
93
|
+
}), U(() => {
|
|
94
|
+
t.eventBus.off("operation:send:request:hotkey", r), t.eventBus.off("operation:cancel:request", p);
|
|
95
|
+
}), k([() => t.path, () => t.method, () => t.exampleKey], () => {
|
|
96
|
+
u.value = null, l.value = null;
|
|
97
|
+
}), (e, o) => (b(), E("div", z, [
|
|
98
|
+
O("div", F, [
|
|
99
|
+
n(I, {
|
|
86
100
|
documentUrl: e.documentUrl,
|
|
87
101
|
environment: e.environment,
|
|
88
102
|
eventBus: e.eventBus,
|
|
@@ -96,16 +110,16 @@ const I = { class: "bg-b-1 flex h-full flex-col" }, $ = { class: "lg:min-h-heade
|
|
|
96
110
|
servers: e.servers,
|
|
97
111
|
source: e.source,
|
|
98
112
|
onExecute: r,
|
|
99
|
-
"onUpdate:servers":
|
|
113
|
+
"onUpdate:servers": o[0] || (o[0] = (i) => g("update:servers"))
|
|
100
114
|
}, null, 8, ["documentUrl", "environment", "eventBus", "hideClientButton", "history", "integration", "layout", "method", "path", "server", "servers", "source"])
|
|
101
115
|
]),
|
|
102
|
-
|
|
103
|
-
default:
|
|
104
|
-
|
|
105
|
-
default:
|
|
106
|
-
|
|
116
|
+
n(w, { class: "border-t" }, {
|
|
117
|
+
default: S(() => [
|
|
118
|
+
n(P, { class: "flex-1" }, {
|
|
119
|
+
default: S(() => [
|
|
120
|
+
n(m(H), {
|
|
107
121
|
authMeta: e.authMeta,
|
|
108
|
-
clientOptions:
|
|
122
|
+
clientOptions: q.value,
|
|
109
123
|
environment: e.environment,
|
|
110
124
|
eventBus: e.eventBus,
|
|
111
125
|
exampleKey: e.exampleKey,
|
|
@@ -115,20 +129,21 @@ const I = { class: "bg-b-1 flex h-full flex-col" }, $ = { class: "lg:min-h-heade
|
|
|
115
129
|
path: e.path,
|
|
116
130
|
plugins: e.plugins,
|
|
117
131
|
proxyUrl: e.proxyUrl,
|
|
118
|
-
securityRequirements:
|
|
132
|
+
securityRequirements: c.value,
|
|
119
133
|
securitySchemes: e.securitySchemes,
|
|
120
134
|
selectedClient: e.selectedClient,
|
|
121
|
-
selectedSecurity:
|
|
135
|
+
selectedSecurity: d.value,
|
|
136
|
+
selectedSecuritySchemes: v.value,
|
|
122
137
|
server: e.server
|
|
123
|
-
}, null, 8, ["authMeta", "clientOptions", "environment", "eventBus", "exampleKey", "layout", "method", "operation", "path", "plugins", "proxyUrl", "securityRequirements", "securitySchemes", "selectedClient", "selectedSecurity", "server"]),
|
|
124
|
-
|
|
138
|
+
}, null, 8, ["authMeta", "clientOptions", "environment", "eventBus", "exampleKey", "layout", "method", "operation", "path", "plugins", "proxyUrl", "securityRequirements", "securitySchemes", "selectedClient", "selectedSecurity", "selectedSecuritySchemes", "server"]),
|
|
139
|
+
n(m(Q), {
|
|
125
140
|
appVersion: e.appVersion,
|
|
126
141
|
eventBus: e.eventBus,
|
|
127
|
-
events:
|
|
142
|
+
events: m(A)(),
|
|
128
143
|
layout: e.layout,
|
|
129
144
|
plugins: e.plugins,
|
|
130
145
|
request: l.value,
|
|
131
|
-
response:
|
|
146
|
+
response: u.value,
|
|
132
147
|
totalPerformedRequests: e.totalPerformedRequests,
|
|
133
148
|
onSendRequest: r
|
|
134
149
|
}, null, 8, ["appVersion", "eventBus", "events", "layout", "plugins", "request", "response", "totalPerformedRequests"])
|
|
@@ -142,5 +157,5 @@ const I = { class: "bg-b-1 flex h-full flex-col" }, $ = { class: "lg:min-h-heade
|
|
|
142
157
|
}
|
|
143
158
|
});
|
|
144
159
|
export {
|
|
145
|
-
|
|
160
|
+
ae as default
|
|
146
161
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-request-body.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-body.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-request-body.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-body.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAA;AAIjG;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,aAAa,iBAAiB,GAAG,SAAS;AAC1C,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qCAAqC;AACrC,mBAAsB,KACrB,QAAQ,GAAG,IAwDb,CAAA"}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { replaceEnvVariables as i } from "@scalar/helpers/regex/replace-variables";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { unpackProxyObject as m } from "@scalar/workspace-store/helpers/unpack-proxy";
|
|
3
|
+
import { getExampleFromBody as u } from "../../request-block/helpers/get-request-body-example.js";
|
|
4
|
+
const b = (r, e = {}, p = "default") => {
|
|
4
5
|
if (!r)
|
|
5
6
|
return null;
|
|
6
|
-
const a = r?.["x-scalar-selected-content-type"]?.[
|
|
7
|
+
const a = r?.["x-scalar-selected-content-type"]?.[p] ?? Object.keys(r?.content ?? {})[0] ?? "application/json", t = u(r, a, p);
|
|
7
8
|
if (!t)
|
|
8
9
|
return null;
|
|
9
10
|
if ((a === "multipart/form-data" || a === "application/x-www-form-urlencoded") && Array.isArray(t.value)) {
|
|
10
11
|
const n = a === "multipart/form-data" ? new FormData() : new URLSearchParams();
|
|
11
|
-
return t.value.forEach(({ name:
|
|
12
|
-
if (!
|
|
12
|
+
return t.value.forEach(({ name: l, value: o }) => {
|
|
13
|
+
if (!l)
|
|
13
14
|
return;
|
|
14
|
-
const
|
|
15
|
-
o instanceof File && n instanceof FormData
|
|
15
|
+
const c = i(l, e);
|
|
16
|
+
if (o instanceof File && n instanceof FormData) {
|
|
17
|
+
const f = m(o);
|
|
18
|
+
n.append(c, f, f.name);
|
|
19
|
+
} else typeof o == "string" && n.append(c, i(o, e));
|
|
16
20
|
}), n;
|
|
17
21
|
}
|
|
18
22
|
return typeof t.value == "object" ? i(JSON.stringify(t.value), e) : typeof t.value == "string" ? i(t.value, e) : t.value;
|
|
19
23
|
};
|
|
20
24
|
export {
|
|
21
|
-
|
|
25
|
+
b as buildRequestBody
|
|
22
26
|
};
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { type XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
|
|
2
2
|
import type { OpenApiDocument, SecurityRequirementObject, SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
3
3
|
/**
|
|
4
|
-
* Get the selected security schemes from
|
|
4
|
+
* Get the selected security schemes from security requirements.
|
|
5
5
|
* Takes security requirement objects and resolves them to actual security scheme objects.
|
|
6
6
|
*/
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const getSecuritySchemes: (securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"], selectedSecurity: SecurityRequirementObject[]) => SecuritySchemeObject[];
|
|
8
8
|
/**
|
|
9
9
|
* Generates the headers, cookies and query params for selected security schemes
|
|
10
10
|
* In the future we can add customization for where the security is applied
|
|
11
11
|
*/
|
|
12
12
|
export declare const buildRequestSecurity: (
|
|
13
|
-
/** Document defined security schemes */
|
|
14
|
-
securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"],
|
|
15
13
|
/** Currently selected security for the current operation */
|
|
16
|
-
|
|
14
|
+
selectedSecuritySchemes: SecuritySchemeObject[],
|
|
17
15
|
/** Environment variables flattened into a key-value object */
|
|
18
16
|
env?: Record<string, string>,
|
|
19
17
|
/** Include this parameter to set the placeholder for empty tokens */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-request-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-security.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,8DAA8D,CAAA;AAGrE;;;GAGG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"build-request-security.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request-security.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,8DAA8D,CAAA;AAGrE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,iBAAiB,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,EAC9E,kBAAkB,yBAAyB,EAAE,KAC5C,oBAAoB,EAUd,CAAA;AAET;;;GAGG;AACH,eAAO,MAAM,oBAAoB;AAC/B,4DAA4D;AAC5D,yBAAyB,oBAAoB,EAAE;AAC/C,8DAA8D;AAC9D,MAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;AAChC,qEAAqE;AACrE,8BAA0B,KACzB;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,SAAS,EAAE,eAAe,CAAA;CAuDzF,CAAA"}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import { isDefined as p } from "@scalar/helpers/array/is-defined";
|
|
2
|
-
import { objectKeys as
|
|
2
|
+
import { objectKeys as l } from "@scalar/helpers/object/object-keys";
|
|
3
3
|
import { replaceEnvVariables as s } from "@scalar/helpers/regex/replace-variables";
|
|
4
|
-
import { getResolvedRef as
|
|
5
|
-
import { xScalarCookieSchema as
|
|
4
|
+
import { getResolvedRef as m } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
5
|
+
import { xScalarCookieSchema as d } from "@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies";
|
|
6
6
|
import { coerceValue as x } from "@scalar/workspace-store/schemas/typebox-coerce";
|
|
7
|
-
import { encode as
|
|
8
|
-
const
|
|
9
|
-
(
|
|
10
|
-
const
|
|
11
|
-
return
|
|
7
|
+
import { encode as k } from "js-base64";
|
|
8
|
+
const A = (f, o) => o.flatMap(
|
|
9
|
+
(i) => l(i).flatMap((a) => {
|
|
10
|
+
const n = m(f?.[a]);
|
|
11
|
+
return n || [];
|
|
12
12
|
})
|
|
13
|
-
) ?? [],
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
if (
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
x(
|
|
20
|
-
name:
|
|
21
|
-
value:
|
|
13
|
+
) ?? [], B = (f, o = {}, i = "") => {
|
|
14
|
+
const a = {}, n = [], u = new URLSearchParams();
|
|
15
|
+
return f.forEach((r) => {
|
|
16
|
+
if (r.type === "apiKey") {
|
|
17
|
+
const t = s(r.name, o), e = s(r["x-scalar-secret-token"], o) || i;
|
|
18
|
+
r.in === "header" && (a[t] = e), r.in === "query" && u.append(t, e), r.in === "cookie" && n.push(
|
|
19
|
+
x(d, {
|
|
20
|
+
name: t,
|
|
21
|
+
value: e,
|
|
22
22
|
path: "/"
|
|
23
23
|
})
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
|
-
if (
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
29
|
-
|
|
26
|
+
if (r.type === "http")
|
|
27
|
+
if (r.scheme === "basic") {
|
|
28
|
+
const t = s(r["x-scalar-secret-username"], o), e = s(r["x-scalar-secret-password"], o), c = `${t}:${e}`;
|
|
29
|
+
a.Authorization = `Basic ${c === ":" ? "username:password" : k(c)}`;
|
|
30
30
|
} else {
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const t = s(r["x-scalar-secret-token"], o);
|
|
32
|
+
a.Authorization = `Bearer ${t || i}`;
|
|
33
33
|
}
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
if (r.type === "oauth2") {
|
|
35
|
+
const t = Object.values(r.flows), e = s(
|
|
36
|
+
t.filter(p).find((c) => c["x-scalar-secret-token"])?.["x-scalar-secret-token"] ?? "",
|
|
37
|
+
o
|
|
38
38
|
);
|
|
39
|
-
|
|
39
|
+
a.Authorization = `Bearer ${e || i}`;
|
|
40
40
|
}
|
|
41
|
-
}), { headers:
|
|
41
|
+
}), { headers: a, cookies: n, urlParams: u };
|
|
42
42
|
};
|
|
43
43
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
B as buildRequestSecurity,
|
|
45
|
+
A as getSecuritySchemes
|
|
46
46
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
2
|
import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
|
|
3
3
|
import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
|
|
4
|
-
import type {
|
|
4
|
+
import type { SecuritySchemeObject, ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
5
5
|
import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation';
|
|
6
6
|
import { type ErrorResponse } from '../../../../libs/errors.js';
|
|
7
7
|
/**
|
|
@@ -16,7 +16,7 @@ import { type ErrorResponse } from '../../../../libs/errors.js';
|
|
|
16
16
|
*
|
|
17
17
|
* @returns A tuple containing either an error or the request object with an abort controller
|
|
18
18
|
*/
|
|
19
|
-
export declare const buildRequest: ({ environment, exampleKey, globalCookies, method, operation, path, proxyUrl, server,
|
|
19
|
+
export declare const buildRequest: ({ environment, exampleKey, globalCookies, method, operation, path, proxyUrl, server, selectedSecuritySchemes, }: {
|
|
20
20
|
/** For environment variables in the inputs */
|
|
21
21
|
environment: XScalarEnvironment;
|
|
22
22
|
/** The key of the current example */
|
|
@@ -31,12 +31,10 @@ export declare const buildRequest: ({ environment, exampleKey, globalCookies, me
|
|
|
31
31
|
path: string;
|
|
32
32
|
/** The proxy URL for cookie domain determination */
|
|
33
33
|
proxyUrl: string;
|
|
34
|
-
/** Document defined security schemes */
|
|
35
|
-
securitySchemes: NonNullable<OpenApiDocument["components"]>["securitySchemes"];
|
|
36
|
-
/** Currently selected security for the current operation */
|
|
37
|
-
selectedSecurity: SecurityRequirementObject[];
|
|
38
34
|
/** The server object */
|
|
39
35
|
server: ServerObject | null;
|
|
36
|
+
/** The selected security schemes for the current operation */
|
|
37
|
+
selectedSecuritySchemes: SecuritySchemeObject[];
|
|
40
38
|
}) => ErrorResponse<{
|
|
41
39
|
controller: AbortController;
|
|
42
40
|
request: Request;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAKnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAKnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AACtH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAI5F,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAO1E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,iHAU1B;IACD,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,mCAAmC;IACnC,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,uCAAuC;IACvC,MAAM,EAAE,UAAU,CAAA;IAClB,2BAA2B;IAC3B,SAAS,EAAE,eAAe,CAAA;IAC1B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,8DAA8D;IAC9D,uBAAuB,EAAE,oBAAoB,EAAE,CAAA;CAChD,KAAG,aAAa,CAAC;IAChB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB,CAwFA,CAAA"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { replaceVariables as U } from "@scalar/helpers/regex/replace-variables";
|
|
2
|
-
import { mergeUrls as
|
|
3
|
-
import { shouldUseProxy as
|
|
4
|
-
import { getResolvedRef as
|
|
5
|
-
import { objectEntries as
|
|
2
|
+
import { mergeUrls as L } from "@scalar/helpers/url/merge-urls";
|
|
3
|
+
import { shouldUseProxy as x, redirectToProxy as I } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import { getResolvedRef as T } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
5
|
+
import { objectEntries as V } from "@vueuse/core";
|
|
6
6
|
import { isElectron as k } from "../../../../libs/electron.js";
|
|
7
|
-
import { ERRORS as q, normalizeError as
|
|
8
|
-
import { buildRequestBody as
|
|
9
|
-
import { buildRequestCookieHeader as
|
|
10
|
-
import { buildRequestParameters as
|
|
11
|
-
import { buildRequestSecurity as
|
|
12
|
-
const
|
|
7
|
+
import { ERRORS as q, normalizeError as _ } from "../../../../libs/errors.js";
|
|
8
|
+
import { buildRequestBody as D } from "./build-request-body.js";
|
|
9
|
+
import { buildRequestCookieHeader as j } from "./build-request-cookie-header.js";
|
|
10
|
+
import { buildRequestParameters as z } from "./build-request-parameters.js";
|
|
11
|
+
import { buildRequestSecurity as F } from "./build-request-security.js";
|
|
12
|
+
const K = ({
|
|
13
13
|
environment: y,
|
|
14
14
|
exampleKey: u = "default",
|
|
15
15
|
globalCookies: h,
|
|
@@ -18,22 +18,21 @@ const ee = ({
|
|
|
18
18
|
path: a,
|
|
19
19
|
proxyUrl: c,
|
|
20
20
|
server: d,
|
|
21
|
-
|
|
22
|
-
selectedSecurity: C
|
|
21
|
+
selectedSecuritySchemes: E
|
|
23
22
|
}) => {
|
|
24
23
|
try {
|
|
25
24
|
const e = y.variables.reduce(
|
|
26
25
|
(t, o) => (t[o.name] = typeof o.value == "string" ? o.value : o.value.default, t),
|
|
27
26
|
{}
|
|
28
|
-
),
|
|
27
|
+
), C = V(d?.variables ?? {}).reduce(
|
|
29
28
|
(t, [o, P]) => (P.default && (t[o] = P.default), t),
|
|
30
29
|
{}
|
|
31
|
-
), i = U(d?.url ?? "", { ...e, ...
|
|
30
|
+
), i = U(d?.url ?? "", { ...e, ...C }), A = T(m.requestBody);
|
|
32
31
|
if (!i && !a)
|
|
33
32
|
throw q.URL_EMPTY;
|
|
34
|
-
const s =
|
|
33
|
+
const s = z(m.parameters ?? [], e, u), H = D(A, e, u), n = F(E, e), r = { ...s.headers, ...n.headers }, S = new URLSearchParams([...s.urlParams, ...n.urlParams]), f = U(a, { ...e, ...s.pathVariables }), p = L(i, f, S), R = x(c, p), w = I(c, p), b = r["User-Agent"] || r["user-agent"];
|
|
35
34
|
k() && b && (r["X-Scalar-User-Agent"] = b);
|
|
36
|
-
const l =
|
|
35
|
+
const l = j({
|
|
37
36
|
paramCookies: [...s.cookies, ...n.cookies],
|
|
38
37
|
globalCookies: h,
|
|
39
38
|
env: e,
|
|
@@ -43,24 +42,24 @@ const ee = ({
|
|
|
43
42
|
useCustomCookieHeader: k() || R
|
|
44
43
|
});
|
|
45
44
|
l && (r[l.name] = l.value);
|
|
46
|
-
const g = new AbortController(),
|
|
45
|
+
const g = new AbortController(), B = new Request(w, {
|
|
47
46
|
method: v,
|
|
48
47
|
headers: r,
|
|
49
48
|
signal: g.signal,
|
|
50
|
-
body:
|
|
49
|
+
body: H
|
|
51
50
|
});
|
|
52
51
|
return [
|
|
53
52
|
null,
|
|
54
53
|
{
|
|
55
54
|
controller: g,
|
|
56
55
|
isUsingProxy: R,
|
|
57
|
-
request:
|
|
56
|
+
request: B
|
|
58
57
|
}
|
|
59
58
|
];
|
|
60
59
|
} catch (e) {
|
|
61
|
-
return [
|
|
60
|
+
return [_(e, q.BUILDING_REQUEST_FAILED), null];
|
|
62
61
|
}
|
|
63
62
|
};
|
|
64
63
|
export {
|
|
65
|
-
|
|
64
|
+
K as buildRequest
|
|
66
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-example.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EAClB,MAAM,8DAA8D,CAAA;AAIrE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,eAAe,GAAG,iBAAiB,EAC1C,YAAY,MAAM,GAAG,SAAS,EAC9B,aAAa,MAAM,GAAG,SAAS,KAC9B,aAAa,GAAG,
|
|
1
|
+
{"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-example.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EAClB,MAAM,8DAA8D,CAAA;AAIrE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,eAAe,GAAG,iBAAiB,EAC1C,YAAY,MAAM,GAAG,SAAS,EAC9B,aAAa,MAAM,GAAG,SAAS,KAC9B,aAAa,GAAG,SAuDlB,CAAA"}
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import { getResolvedRef as
|
|
2
|
-
import { getResolvedRefDeep as
|
|
3
|
-
const
|
|
4
|
-
if ("content" in
|
|
5
|
-
const t =
|
|
6
|
-
return typeof i < "u" ? i : typeof
|
|
1
|
+
import { getResolvedRef as l } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
2
|
+
import { getResolvedRefDeep as s } from "../../operation-code-sample/helpers/get-resolved-ref-deep.js";
|
|
3
|
+
const d = (n, o, u) => {
|
|
4
|
+
if ("content" in n) {
|
|
5
|
+
const t = n.content?.[u ?? Object.keys(n.content)[0] ?? ""], c = t?.examples ?? {}, f = o ?? Object.keys(c)[0] ?? "", i = s(c[f]);
|
|
6
|
+
return typeof i < "u" ? i : typeof o > "u" && t?.example ? { value: s(t.example) } : void 0;
|
|
7
7
|
}
|
|
8
|
-
if ("examples" in
|
|
9
|
-
const t =
|
|
10
|
-
if (typeof
|
|
11
|
-
return
|
|
12
|
-
if (typeof
|
|
13
|
-
return { value:
|
|
8
|
+
if ("examples" in n || "example" in n) {
|
|
9
|
+
const t = l(n.examples) ?? {}, c = o ?? Object.keys(t)[0] ?? "", f = s(t?.[c]);
|
|
10
|
+
if (typeof f < "u")
|
|
11
|
+
return f;
|
|
12
|
+
if (typeof o > "u" && n.example)
|
|
13
|
+
return { value: s(n.example) };
|
|
14
|
+
}
|
|
15
|
+
const e = s(n);
|
|
16
|
+
if ("schema" in e && e.schema) {
|
|
17
|
+
if ("default" in e.schema && typeof e.schema.default < "u")
|
|
18
|
+
return { value: e.schema.default };
|
|
19
|
+
if ("enum" in e.schema && e.schema.enum?.[0])
|
|
20
|
+
return { value: e.schema.enum[0] };
|
|
21
|
+
if ("examples" in e.schema && e.schema.examples?.[0])
|
|
22
|
+
return { value: e.schema.examples[0] };
|
|
14
23
|
}
|
|
15
|
-
const n = o(e);
|
|
16
|
-
if ("schema" in n && n.schema && "default" in n.schema && typeof n.schema.default < "u")
|
|
17
|
-
return { value: n.schema.default };
|
|
18
24
|
};
|
|
19
25
|
export {
|
|
20
|
-
|
|
26
|
+
d as getExample
|
|
21
27
|
};
|