@scalar/agent-chat 0.2.3 → 0.2.5
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/LICENSE +21 -0
- package/dist/App.vue.d.ts +3 -2
- package/dist/App.vue.d.ts.map +1 -1
- package/dist/App.vue.js +32 -0
- package/dist/App.vue2.js +4 -0
- package/dist/Chat.vue.d.ts.map +1 -1
- package/dist/Chat.vue.js +23 -0
- package/dist/Chat.vue2.js +4 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/api.d.ts +50 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +68 -0
- package/dist/components/ApprovalSection.vue.d.ts.map +1 -1
- package/dist/components/ApprovalSection.vue.js +7 -0
- package/dist/components/ApprovalSection.vue2.js +42 -0
- package/dist/components/AuthenticationProvided.vue.d.ts +3 -0
- package/dist/components/AuthenticationProvided.vue.d.ts.map +1 -0
- package/dist/components/AuthenticationProvided.vue.js +13 -0
- package/dist/components/AuthenticationRequired.vue.d.ts +3 -0
- package/dist/components/AuthenticationRequired.vue.d.ts.map +1 -0
- package/dist/components/AuthenticationRequired.vue.js +13 -0
- package/dist/components/AutosendPaused.vue.d.ts.map +1 -1
- package/dist/components/AutosendPaused.vue.js +13 -0
- package/dist/components/ContextItem.vue.d.ts.map +1 -1
- package/dist/components/ContextItem.vue.js +7 -0
- package/dist/components/ContextItem.vue2.js +19 -0
- package/dist/components/ErrorMessage.vue.d.ts +2 -1
- package/dist/components/ErrorMessage.vue.d.ts.map +1 -1
- package/dist/components/ErrorMessage.vue.js +7 -0
- package/dist/components/ErrorMessage.vue2.js +22 -0
- package/dist/components/LoadingMiniOpenAPIDoc.vue.d.ts.map +1 -1
- package/dist/components/LoadingMiniOpenAPIDoc.vue.js +14 -0
- package/dist/components/LoadingOpenAPISpecsSummary.vue.d.ts.map +1 -1
- package/dist/components/LoadingOpenAPISpecsSummary.vue.js +14 -0
- package/dist/components/Logo.vue.d.ts.map +1 -1
- package/dist/components/Logo.vue.js +23 -0
- package/dist/components/PaymentSection.vue.d.ts.map +1 -1
- package/dist/components/PaymentSection.vue.js +7 -0
- package/dist/components/PaymentSection.vue2.js +34 -0
- package/dist/components/RequestApproved.vue.d.ts.map +1 -1
- package/dist/components/RequestApproved.vue.js +13 -0
- package/dist/components/RequestFailed.vue.d.ts.map +1 -1
- package/dist/components/RequestFailed.vue.js +24 -0
- package/dist/components/RequestPreview.vue.d.ts +1 -1
- package/dist/components/RequestPreview.vue.d.ts.map +1 -1
- package/dist/components/RequestPreview.vue.js +7 -0
- package/dist/components/RequestPreview.vue2.js +123 -0
- package/dist/components/RequestRejected.vue.d.ts.map +1 -1
- package/dist/components/RequestRejected.vue.js +22 -0
- package/dist/components/RequestSuccess.vue.d.ts.map +1 -1
- package/dist/components/RequestSuccess.vue.js +13 -0
- package/dist/components/ResponseBody/ResponseBody.vue.d.ts +1 -1
- package/dist/components/ResponseBody/ResponseBody.vue.d.ts.map +1 -1
- package/dist/components/ResponseBody/ResponseBody.vue.js +41 -0
- package/dist/components/ResponseBody/ResponseBody.vue2.js +4 -0
- package/dist/components/ResponseBody/ResponseBodyInfo.vue.d.ts.map +1 -1
- package/dist/components/ResponseBody/ResponseBodyInfo.vue.js +14 -0
- package/dist/components/ResponseBody/ResponseBodyPreview.vue.d.ts +1 -1
- package/dist/components/ResponseBody/ResponseBodyPreview.vue.d.ts.map +1 -1
- package/dist/components/ResponseBody/ResponseBodyPreview.vue.js +7 -0
- package/dist/components/ResponseBody/ResponseBodyPreview.vue2.js +65 -0
- package/dist/components/ResponseBody/ResponseBodyRaw.vue.d.ts.map +1 -1
- package/dist/components/ResponseBody/ResponseBodyRaw.vue.js +20 -0
- package/dist/components/ResponseBody/ResponseBodyRaw.vue2.js +4 -0
- package/dist/components/ResponseBody/ResponseBodyToggle.vue.d.ts +2 -2
- package/dist/components/ResponseBody/ResponseBodyToggle.vue.d.ts.map +1 -1
- package/dist/components/ResponseBody/ResponseBodyToggle.vue.js +26 -0
- package/dist/components/ResponseBody/ResponseBodyToggle.vue2.js +4 -0
- package/dist/components/ResponseBody/helpers/media-types.js +130 -0
- package/dist/components/ResponseBody/helpers/process-response-body.d.ts +1 -1
- package/dist/components/ResponseBody/helpers/process-response-body.d.ts.map +1 -1
- package/dist/components/ResponseBody/helpers/process-response-body.js +33 -0
- package/dist/components/SearchPopover.vue.d.ts +2 -2
- package/dist/components/SearchPopover.vue.d.ts.map +1 -1
- package/dist/components/SearchPopover.vue.js +7 -0
- package/dist/components/SearchPopover.vue2.js +67 -0
- package/dist/components/SendingRequest.vue.d.ts.map +1 -1
- package/dist/components/SendingRequest.vue.js +24 -0
- package/dist/components/Suggestion.vue.d.ts.map +1 -1
- package/dist/components/TestRequestButton.vue.d.ts.map +1 -1
- package/dist/components/{Endpoint.vue.d.ts → UploadSection.vue.d.ts} +3 -5
- package/dist/components/UploadSection.vue.d.ts.map +1 -0
- package/dist/components/UploadSection.vue.js +7 -0
- package/dist/components/UploadSection.vue2.js +62 -0
- package/dist/entities/prompt/constants.d.ts +2 -0
- package/dist/entities/prompt/constants.d.ts.map +1 -0
- package/dist/entities/prompt/constants.js +4 -0
- package/dist/entities/registry/document.d.ts +21 -0
- package/dist/entities/registry/document.d.ts.map +1 -0
- package/dist/entities/registry/document.js +12 -0
- package/dist/entities/tools/ask-for-authentication.d.ts +7 -0
- package/dist/entities/tools/ask-for-authentication.d.ts.map +1 -0
- package/dist/entities/tools/ask-for-authentication.js +8 -0
- package/dist/entities/tools/constants.d.ts +2 -0
- package/dist/entities/tools/constants.d.ts.map +1 -0
- package/dist/entities/tools/constants.js +4 -0
- package/dist/entities/tools/execute-request.d.ts +42 -0
- package/dist/entities/tools/execute-request.d.ts.map +1 -0
- package/dist/entities/tools/execute-request.js +11 -0
- package/dist/entities/tools/get-mini-openapi-spec.d.ts +12 -0
- package/dist/entities/tools/get-mini-openapi-spec.d.ts.map +1 -0
- package/dist/entities/tools/get-mini-openapi-spec.js +8 -0
- package/dist/entities/tools/get-openapi-spec-summary.d.ts +10 -0
- package/dist/entities/tools/get-openapi-spec-summary.d.ts.map +1 -0
- package/dist/entities/tools/get-openapi-spec-summary.js +4 -0
- package/dist/helpers.d.ts +20 -12
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +115 -0
- package/dist/hooks/{useChatApprovals.d.ts → use-chat-approvals.d.ts} +1 -1
- package/dist/hooks/use-chat-approvals.d.ts.map +1 -0
- package/dist/hooks/use-chat-approvals.js +21 -0
- package/dist/hooks/use-chat-error.d.ts +14 -0
- package/dist/hooks/use-chat-error.d.ts.map +1 -0
- package/dist/hooks/use-chat-error.js +23 -0
- package/dist/hooks/use-chat-pending-client-tool-parts.d.ts +19 -0
- package/dist/hooks/use-chat-pending-client-tool-parts.d.ts.map +1 -0
- package/dist/hooks/use-chat-pending-client-tool-parts.js +12 -0
- package/dist/hooks/{useChatScroll.d.ts → use-chat-scroll.d.ts} +1 -1
- package/dist/hooks/use-chat-scroll.d.ts.map +1 -0
- package/dist/hooks/use-chat-scroll.js +16 -0
- package/dist/hooks/{useSearch.d.ts → use-search.d.ts} +11 -11
- package/dist/hooks/use-search.d.ts.map +1 -0
- package/dist/hooks/use-search.js +25 -0
- package/dist/hooks/use-term-and-conditions.d.ts +6 -0
- package/dist/hooks/use-term-and-conditions.d.ts.map +1 -0
- package/dist/hooks/use-term-and-conditions.js +16 -0
- package/dist/hooks/use-upload-tmp-document.d.ts +19 -0
- package/dist/hooks/use-upload-tmp-document.d.ts.map +1 -0
- package/dist/hooks/use-upload-tmp-document.js +64 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/package.json +35 -23
- package/dist/registry/add-documents-to-store.d.ts +6 -6
- package/dist/registry/add-documents-to-store.d.ts.map +1 -1
- package/dist/registry/add-documents-to-store.js +39 -0
- package/dist/registry/create-document-name.d.ts +2 -0
- package/dist/registry/create-document-name.d.ts.map +1 -0
- package/dist/registry/create-document-name.js +6 -0
- package/dist/state/state.d.ts +20 -8
- package/dist/state/state.d.ts.map +1 -1
- package/dist/state/state.js +110 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/views/Chat/Chat.vue.d.ts.map +1 -1
- package/dist/views/Chat/Chat.vue.js +7 -0
- package/dist/views/Chat/Chat.vue2.js +77 -0
- package/dist/views/Chat/Messages/AskForAuthentication.vue.d.ts +10 -0
- package/dist/views/Chat/Messages/AskForAuthentication.vue.d.ts.map +1 -0
- package/dist/views/Chat/Messages/AskForAuthentication.vue.js +7 -0
- package/dist/views/Chat/Messages/AskForAuthentication.vue2.js +89 -0
- package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts +2 -2
- package/dist/views/Chat/Messages/ExecuteRequestTool.vue.d.ts.map +1 -1
- package/dist/views/Chat/Messages/ExecuteRequestTool.vue.js +7 -0
- package/dist/views/Chat/Messages/ExecuteRequestTool.vue2.js +23 -0
- package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.d.ts +2 -2
- package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.d.ts.map +1 -1
- package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue.js +7 -0
- package/dist/views/Chat/Messages/GetMiniOpenAPIDocTool.vue2.js +56 -0
- package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.d.ts +2 -2
- package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.d.ts.map +1 -1
- package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue.js +26 -0
- package/dist/views/Chat/Messages/GetOpenAPISpecsSummary.vue2.js +4 -0
- package/dist/views/Chat/Messages/Text.vue.d.ts.map +1 -1
- package/dist/views/Chat/Messages/Text.vue.js +16 -0
- package/dist/views/Chat/Messages/Text.vue2.js +4 -0
- package/dist/views/Layout.vue.d.ts.map +1 -1
- package/dist/views/Layout.vue.js +7 -0
- package/dist/views/Layout.vue2.js +23 -0
- package/dist/views/PromptForm.vue.d.ts.map +1 -1
- package/dist/views/PromptForm.vue.js +7 -0
- package/dist/views/PromptForm.vue2.js +212 -0
- package/dist/views/Settings/Auth.vue.d.ts.map +1 -1
- package/dist/views/Settings/Auth.vue.js +67 -0
- package/dist/views/Settings/Auth.vue2.js +4 -0
- package/dist/views/Settings/DocSettings.vue.d.ts.map +1 -1
- package/dist/views/Settings/DocSettings.vue.js +7 -0
- package/dist/views/Settings/DocSettings.vue2.js +43 -0
- package/dist/views/Settings/Settings.vue.d.ts.map +1 -1
- package/dist/views/Settings/Settings.vue.js +8 -0
- package/dist/views/Settings/Settings.vue2.js +67 -0
- package/dist/views/Start.vue.d.ts.map +1 -1
- package/dist/views/Start.vue.js +7 -0
- package/dist/views/Start.vue2.js +41 -0
- package/package.json +53 -7
- package/dist/Tooltip-Cm82QgNj.js +0 -575
- package/dist/__vite-optional-peer-dep_stream-markdown_markstream-vue_false-sdjmOmXd.js +0 -5
- package/dist/__vite-optional-peer-dep_stream-monaco_markstream-vue_false-HdL4xm5U.js +0 -5
- package/dist/__vite-optional-peer-dep_vue-i18n_markstream-vue_false-B9Pwe5kz.js +0 -5
- package/dist/_basePickBy-hHD8tMGb.js +0 -151
- package/dist/_baseUniq-DTF1wuF6.js +0 -614
- package/dist/arc-Dw2RQerU.js +0 -83
- package/dist/architecture-U656AL7Q-B00Z9eXr.js +0 -36
- package/dist/architectureDiagram-VXUJARFQ-BtOffFaM.js +0 -4662
- package/dist/blockDiagram-VD42YOAC-BUqFMMQe.js +0 -2261
- package/dist/c4Diagram-YG6GDRKO-NrM1YcpG.js +0 -1579
- package/dist/channel-105myCGU.js +0 -5
- package/dist/chunk-4BX2VUAB-TAxJli7C.js +0 -8
- package/dist/chunk-55IACEB6-VXFJ4bz5.js +0 -8
- package/dist/chunk-B4BG7PRW-CZDQpfj5.js +0 -1375
- package/dist/chunk-DI55MBZ5-D3l7TA-E.js +0 -1370
- package/dist/chunk-FMBD7UC4-BMXFm8I3.js +0 -19
- package/dist/chunk-QN33PNHL-BOUpbpWp.js +0 -19
- package/dist/chunk-QZHKN3VN-C-TEEx05.js +0 -15
- package/dist/chunk-TZMSLE5B-BUiROKNR.js +0 -64
- package/dist/classDiagram-2ON5EDUG-HQET4ybK.js +0 -16
- package/dist/classDiagram-v2-WZHVMYZB-HQET4ybK.js +0 -16
- package/dist/clone-CIIO71O9.js +0 -8
- package/dist/components/Endpoint.vue.d.ts.map +0 -1
- package/dist/cose-bilkent-S5V4N54A-CMsF4n-5.js +0 -2609
- package/dist/cytoscape.esm-DfdJODL8.js +0 -18735
- package/dist/dagre-6UL2VRFP-DqzdQ6Qg.js +0 -444
- package/dist/defaultLocale-BEa-49Qz.js +0 -171
- package/dist/diagram-PSM6KHXK-1xyGntw2.js +0 -531
- package/dist/diagram-QEK2KX5R-DdZdlAm1.js +0 -217
- package/dist/diagram-S2PKOQOG-C80Eo2jp.js +0 -142
- package/dist/erDiagram-Q2GNP2WA-DFVRrMXT.js +0 -841
- package/dist/flowDiagram-NV44I4VS-D9QK_qqB.js +0 -1620
- package/dist/ganttDiagram-LVOFAZNH-Bo1NTkeQ.js +0 -2506
- package/dist/gitGraph-F6HP7TQM-C5hdgcgO.js +0 -27
- package/dist/gitGraphDiagram-NY62KEGX-BZqnqZh6.js +0 -699
- package/dist/graph-Dth4IhEK.js +0 -247
- package/dist/hooks/useChatApprovals.d.ts.map +0 -1
- package/dist/hooks/useChatOperationBlocks.d.ts +0 -3
- package/dist/hooks/useChatOperationBlocks.d.ts.map +0 -1
- package/dist/hooks/useChatScroll.d.ts.map +0 -1
- package/dist/hooks/useSearch.d.ts.map +0 -1
- package/dist/index-BOvT43H8.js +0 -111780
- package/dist/index2-B36B-gt0.js +0 -69
- package/dist/index3-CtIyYUnG.js +0 -70
- package/dist/index4-Dzz91Ao2.js +0 -537
- package/dist/index5-Bmz0gMSP.js +0 -590
- package/dist/index6-DMB3qTSV.js +0 -196
- package/dist/info-NVLQJR56-azt5obk5.js +0 -27
- package/dist/infoDiagram-ER5ION4S-DD4Jtctm.js +0 -24
- package/dist/infographic_markstream-vue_false-BfsmcXxk.js +0 -5
- package/dist/init-DjUOC4st.js +0 -16
- package/dist/journeyDiagram-XKPGCS4Q-CXL6UO0r.js +0 -834
- package/dist/kanban-definition-3W4ZIXB7-B57do5Wg.js +0 -719
- package/dist/katex-SsTUIUTC.js +0 -11688
- package/dist/layout-7TCY8eA2.js +0 -1332
- package/dist/linear-DSm5i91N.js +0 -625
- package/dist/mermaid-parser.core-CUQWpAMM.js +0 -12746
- package/dist/mermaid.core-QjuzH7xx.js +0 -14164
- package/dist/mhchem-XHl7cef5.js +0 -2306
- package/dist/mindmap-definition-VGOIOE7T-DAQyGNAM.js +0 -784
- package/dist/ordinal-DfAQgscy.js +0 -61
- package/dist/packet-BFZMPI3H-CixuxAEA.js +0 -27
- package/dist/pie-7BOR55EZ-D3cgnzR1.js +0 -32
- package/dist/pieDiagram-ADFJNKIX-BqxgYwrL.js +0 -161
- package/dist/quadrantDiagram-AYHSOK5B-CQ4v-9Hh.js +0 -1022
- package/dist/radar-NHE76QYJ-DhV0Od_M.js +0 -27
- package/dist/requirementDiagram-UZGBJVZJ-ncWNAgFi.js +0 -850
- package/dist/safeRaf-I3a3-dyJ.js +0 -10
- package/dist/sankeyDiagram-TZEHDZUN-yCR2_cH5.js +0 -810
- package/dist/sequenceDiagram-WL72ISMW-DZ7wqFyd.js +0 -2511
- package/dist/stateDiagram-FKZM4ZOC-Dra68Tzi.js +0 -263
- package/dist/stateDiagram-v2-4FDKWEC3-CARbPECD.js +0 -16
- package/dist/timeline-definition-IT6M3QCI-DEbG9QIM.js +0 -795
- package/dist/treemap-KMMF4GRG-CQbPsyWe.js +0 -81
- package/dist/xychartDiagram-PRI3JC2R-C94Pu8hL.js +0 -1340
package/dist/helpers.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { getSelectedServer as E } from "@scalar/api-client/v2/features/operation";
|
|
2
|
+
import { isObject as u } from "@scalar/helpers/object/is-object";
|
|
3
|
+
import { REFERENCE_LS_KEYS as d, safeLocalStorage as O } from "@scalar/helpers/object/local-storage";
|
|
4
|
+
import { getResolvedRef as h } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
5
|
+
import { coerceValue as f } from "@scalar/workspace-store/schemas/typebox-coerce";
|
|
6
|
+
import { XScalarSelectedSecuritySchema as I, SecuritySchemesSchema as b } from "@scalar/workspace-store/schemas/v3.1/strict/openapi-document";
|
|
7
|
+
function M(e) {
|
|
8
|
+
return Object.values(e.paths ?? {}).flatMap((s) => Object.values(s ?? {}));
|
|
9
|
+
}
|
|
10
|
+
function j(e) {
|
|
11
|
+
const c = (e["x-scalar-selected-security"]?.selectedSchemes ?? []).flatMap((r) => Object.keys(r)), t = e.components?.securitySchemes;
|
|
12
|
+
return t ? c.reduce((r, n) => {
|
|
13
|
+
const o = t[n];
|
|
14
|
+
return o && r.push(h(o)), r;
|
|
15
|
+
}, []) : [];
|
|
16
|
+
}
|
|
17
|
+
function R(e) {
|
|
18
|
+
return Object.fromEntries(
|
|
19
|
+
Object.entries(e.workspace.documents).map(([s, c]) => [
|
|
20
|
+
s,
|
|
21
|
+
{
|
|
22
|
+
activeServer: E(c),
|
|
23
|
+
securitySchemes: j(c)
|
|
24
|
+
}
|
|
25
|
+
])
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
const a = O(), y = () => {
|
|
29
|
+
const e = d.AUTH_SCHEMES, s = d.SELECTED_AUTH_SCHEMES, c = (t, r) => `${r}-${((o) => o === "schemas" ? e : s)(t)}`;
|
|
30
|
+
return {
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves and coerces the authentication schemes stored in local storage.
|
|
33
|
+
*/
|
|
34
|
+
getSchemas: (t) => {
|
|
35
|
+
const r = JSON.parse(a.getItem(c("schemas", t)) ?? "{}");
|
|
36
|
+
return f(b, r);
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Stores the authentication schemes in local storage.
|
|
40
|
+
* @param value The SecuritySchemes object to stringify and store.
|
|
41
|
+
*/
|
|
42
|
+
setSchemas: (t, r) => {
|
|
43
|
+
a.setItem(c("schemas", t), JSON.stringify(r));
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Retrieves and coerces the selected authentication schemes stored in local storage.
|
|
47
|
+
*/
|
|
48
|
+
getSelectedSchemes: (t) => {
|
|
49
|
+
const r = JSON.parse(a.getItem(c("selectedSchemes", t)) ?? "{}");
|
|
50
|
+
return f(I, r);
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Stores the user's selected authentication schemes in local storage.
|
|
54
|
+
* @param value The XScalarSelectedSecurity object to stringify and store.
|
|
55
|
+
*/
|
|
56
|
+
setSelectedSchemes: (t, r) => {
|
|
57
|
+
a.setItem(c("selectedSchemes", t), JSON.stringify(r));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}, p = (e, s) => {
|
|
61
|
+
if (!(!u(e) || !u(s)))
|
|
62
|
+
for (const [c, t] of Object.entries(s)) {
|
|
63
|
+
if (typeof t != "object") {
|
|
64
|
+
e[c] = t;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
p(h(e[c]), t);
|
|
68
|
+
}
|
|
69
|
+
}, x = (e, s) => Object.keys(e).every((c) => s.has(c)), v = (e, s) => e >= s ? s - 1 : e, D = ({
|
|
70
|
+
documentName: e,
|
|
71
|
+
workspaceStore: s
|
|
72
|
+
}) => {
|
|
73
|
+
const c = y().getSchemas(e), t = s.workspace.documents[e];
|
|
74
|
+
if (!t) return;
|
|
75
|
+
const n = y().getSelectedSchemes(e), o = new Set(Object.keys(t.components?.securitySchemes ?? {})), m = n["x-scalar-selected-security"]?.selectedSchemes?.filter((S) => x(S, o));
|
|
76
|
+
if (!t["x-scalar-selected-security"] && m && m.length > 0) {
|
|
77
|
+
const S = n["x-scalar-selected-security"]?.selectedIndex, i = v(S ?? 0, m.length);
|
|
78
|
+
t["x-scalar-selected-security"] = {
|
|
79
|
+
selectedIndex: i,
|
|
80
|
+
selectedSchemes: m
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const g = t.components?.securitySchemes ?? {};
|
|
84
|
+
for (const [S, i] of Object.entries(c)) {
|
|
85
|
+
const l = h(g[S]);
|
|
86
|
+
u(l) && p(l, i);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
function T(e) {
|
|
90
|
+
try {
|
|
91
|
+
return JSON.parse(e);
|
|
92
|
+
} catch {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const L = {
|
|
97
|
+
LIMIT_REACHED: "LIMIT_REACHED"
|
|
98
|
+
};
|
|
99
|
+
function N(e, s) {
|
|
100
|
+
return {
|
|
101
|
+
code: e,
|
|
102
|
+
detail: s
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export {
|
|
106
|
+
L as AgentErrorCodes,
|
|
107
|
+
y as authStorage,
|
|
108
|
+
R as createDocumentSettings,
|
|
109
|
+
N as createError,
|
|
110
|
+
M as getOperations,
|
|
111
|
+
j as getSecurityFromDocument,
|
|
112
|
+
p as mergeSecrets,
|
|
113
|
+
D as restoreAuthSecretsFromStorage,
|
|
114
|
+
T as safeParseJson
|
|
115
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-chat-approvals.d.ts","sourceRoot":"","sources":["../../src/hooks/use-chat-approvals.ts"],"names":[],"mappings":"AAWA,wBAAgB,gBAAgB;;;;;;;;;;;;;;;oBAuB648C,CAAC;kBAAuB,CAAC;;;eA7B/48C,oBAAoB;;mCAgB7B,OAAO;EAYpD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { computed as l } from "vue";
|
|
2
|
+
import { useState as n } from "../state/state.js";
|
|
3
|
+
function e(t) {
|
|
4
|
+
return t.type.startsWith("tool") && t.state === "approval-requested";
|
|
5
|
+
}
|
|
6
|
+
function c() {
|
|
7
|
+
const t = n(), a = l(() => t.chat.messages.filter((o) => o.parts.some(e)).flatMap((o) => o.parts).filter(e));
|
|
8
|
+
async function s(o) {
|
|
9
|
+
const r = a.value.map(
|
|
10
|
+
(p) => t.chat.addToolApprovalResponse({
|
|
11
|
+
id: p.approval.id,
|
|
12
|
+
approved: o
|
|
13
|
+
})
|
|
14
|
+
);
|
|
15
|
+
await Promise.all(r);
|
|
16
|
+
}
|
|
17
|
+
return { approvalRequestedParts: a, respondToToolCalls: s };
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
c as useChatApprovals
|
|
21
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod/mini';
|
|
2
|
+
declare const chatErrorSchema: z.ZodMiniObject<{
|
|
3
|
+
message: z.ZodMiniString<string>;
|
|
4
|
+
code: z.ZodMiniString<string>;
|
|
5
|
+
status: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type ChatError = z.infer<typeof chatErrorSchema>;
|
|
8
|
+
export declare function useChatError(): import("vue").ComputedRef<{
|
|
9
|
+
message: string;
|
|
10
|
+
code: string;
|
|
11
|
+
status?: number | undefined;
|
|
12
|
+
} | undefined>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=use-chat-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-chat-error.d.ts","sourceRoot":"","sources":["../../src/hooks/use-chat-error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAA;AAK5B,QAAA,MAAM,eAAe;;;;iBAInB,CAAA;AACF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEvD,wBAAgB,YAAY;;;;eAiB3B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { computed as t } from "vue";
|
|
2
|
+
import { z as r } from "zod/mini";
|
|
3
|
+
import { safeParseJson as a } from "../helpers.js";
|
|
4
|
+
import { useState as n } from "../state/state.js";
|
|
5
|
+
const m = r.object({
|
|
6
|
+
message: r.string(),
|
|
7
|
+
code: r.string(),
|
|
8
|
+
status: r.optional(r.number())
|
|
9
|
+
});
|
|
10
|
+
function p() {
|
|
11
|
+
const { chat: e } = n();
|
|
12
|
+
return t(() => {
|
|
13
|
+
if (!e.error) return;
|
|
14
|
+
const o = a(e.error.message), s = m.safeParse(o);
|
|
15
|
+
return !o || !s.success ? {
|
|
16
|
+
message: e.error.message,
|
|
17
|
+
code: "UNKNOWN_ERROR"
|
|
18
|
+
} : s.data;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
p as useChatError
|
|
23
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare function useChatPendingClientToolParts(): {
|
|
2
|
+
pendingClientToolParts: import("vue").ComputedRef<({
|
|
3
|
+
type: `tool-${string}`;
|
|
4
|
+
} & {
|
|
5
|
+
toolCallId: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
providerExecuted?: boolean;
|
|
8
|
+
} & {
|
|
9
|
+
state: "input-available";
|
|
10
|
+
input: unknown;
|
|
11
|
+
output?: never;
|
|
12
|
+
errorText?: never;
|
|
13
|
+
callProviderMetadata?: import("ai").ProviderMetadata;
|
|
14
|
+
approval?: never;
|
|
15
|
+
} & {
|
|
16
|
+
state: "input-available";
|
|
17
|
+
})[]>;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=use-chat-pending-client-tool-parts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-chat-pending-client-tool-parts.d.ts","sourceRoot":"","sources":["../../src/hooks/use-chat-pending-client-tool-parts.ts"],"names":[],"mappings":"AAWA,wBAAgB,6BAA6B;;;;;;;;;;;;;;;eANM,iBAAiB;;EAiBnE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { computed as o } from "vue";
|
|
2
|
+
import { useState as r } from "../state/state.js";
|
|
3
|
+
function n(t) {
|
|
4
|
+
return t.type.startsWith("tool") && t.state === "input-available";
|
|
5
|
+
}
|
|
6
|
+
function l() {
|
|
7
|
+
const t = r();
|
|
8
|
+
return { pendingClientToolParts: o(() => t.chat.messages.filter((e) => e.parts.some(n)).flatMap((e) => e.parts).filter(n)) };
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
l as useChatPendingClientToolParts
|
|
12
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function useChatScroll(): void;
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=use-chat-scroll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-chat-scroll.d.ts","sourceRoot":"","sources":["../../src/hooks/use-chat-scroll.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa,SAgB5B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { watch as r, nextTick as s } from "vue";
|
|
2
|
+
import { useState as n } from "../state/state.js";
|
|
3
|
+
function u() {
|
|
4
|
+
const e = n();
|
|
5
|
+
function o(a) {
|
|
6
|
+
const t = a?.parts.at(-1);
|
|
7
|
+
if (t && t.type === "text")
|
|
8
|
+
return t.text;
|
|
9
|
+
}
|
|
10
|
+
r([() => e.chat.status, () => o(e.chat.lastMessage)], async () => {
|
|
11
|
+
await s(), window.scrollTo(0, document.body.scrollHeight);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
u as useChatScroll
|
|
16
|
+
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
export declare function useSearch(
|
|
1
|
+
export declare function useSearch(): {
|
|
2
2
|
query: import("vue").WritableComputedRef<string, string>;
|
|
3
3
|
results: import("vue").Ref<{
|
|
4
|
-
namespace: string;
|
|
5
|
-
slug: string;
|
|
6
4
|
id: string;
|
|
7
5
|
title: string;
|
|
8
|
-
logoUrl: string | null;
|
|
9
|
-
currentVersion: string;
|
|
10
|
-
}[], {
|
|
11
6
|
namespace: string;
|
|
7
|
+
currentVersion: string;
|
|
8
|
+
logoUrl: string | null;
|
|
12
9
|
slug: string;
|
|
10
|
+
}[], {
|
|
13
11
|
id: string;
|
|
14
12
|
title: string;
|
|
15
|
-
logoUrl: string | null;
|
|
16
|
-
currentVersion: string;
|
|
17
|
-
}[] | {
|
|
18
13
|
namespace: string;
|
|
14
|
+
currentVersion: string;
|
|
15
|
+
logoUrl: string | null;
|
|
19
16
|
slug: string;
|
|
17
|
+
}[] | {
|
|
20
18
|
id: string;
|
|
21
19
|
title: string;
|
|
22
|
-
|
|
20
|
+
namespace: string;
|
|
23
21
|
currentVersion: string;
|
|
22
|
+
logoUrl: string | null;
|
|
23
|
+
slug: string;
|
|
24
24
|
}[]>;
|
|
25
25
|
};
|
|
26
|
-
//# sourceMappingURL=
|
|
26
|
+
//# sourceMappingURL=use-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-search.d.ts","sourceRoot":"","sources":["../../src/hooks/use-search.ts"],"names":[],"mappings":"AAOA,wBAAgB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;EAoCxB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useDebounceFn as m } from "@vueuse/core";
|
|
2
|
+
import { ref as c, computed as f } from "vue";
|
|
3
|
+
import { api as i } from "../api.js";
|
|
4
|
+
import { useState as p } from "../state/state.js";
|
|
5
|
+
function d() {
|
|
6
|
+
const { baseUrl: u, getAccessToken: n } = p(), s = c(""), r = m(async (e) => {
|
|
7
|
+
const o = await i({
|
|
8
|
+
baseUrl: u,
|
|
9
|
+
getAccessToken: n
|
|
10
|
+
}).search(e);
|
|
11
|
+
o.success && (t.value = o.data.results);
|
|
12
|
+
}, 200), a = f({
|
|
13
|
+
get: () => s.value,
|
|
14
|
+
set: (e) => {
|
|
15
|
+
r(e), s.value = e;
|
|
16
|
+
}
|
|
17
|
+
}), t = c([]);
|
|
18
|
+
return r(""), {
|
|
19
|
+
query: a,
|
|
20
|
+
results: t
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
d as useSearch
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-term-and-conditions.d.ts","sourceRoot":"","sources":["../../src/hooks/use-term-and-conditions.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B,gCAAgC,CAAA;AAExE,wBAAgB,qBAAqB;;;EAapC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ref as r, onMounted as a } from "vue";
|
|
2
|
+
const t = "scalar/agent-terms-accepted";
|
|
3
|
+
function n() {
|
|
4
|
+
const e = r(!1);
|
|
5
|
+
a(() => {
|
|
6
|
+
e.value = localStorage.getItem(t) === "true";
|
|
7
|
+
});
|
|
8
|
+
function o() {
|
|
9
|
+
e.value = !0, localStorage.setItem(t, "true");
|
|
10
|
+
}
|
|
11
|
+
return { accepted: e, accept: o };
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
t as TERMS_AND_CONDITIONS_LS_KEY,
|
|
15
|
+
n as useTermsAndConditions
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { WorkspaceDocument } from '@scalar/workspace-store/schemas';
|
|
2
|
+
export type UploadTmpDocumentState = {
|
|
3
|
+
type: 'error';
|
|
4
|
+
error: unknown;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'uploading';
|
|
7
|
+
} | {
|
|
8
|
+
type: 'processing';
|
|
9
|
+
} | {
|
|
10
|
+
type: 'done';
|
|
11
|
+
};
|
|
12
|
+
export declare function useUploadTmpDocument(): {
|
|
13
|
+
uploadTempDocument: (document: WorkspaceDocument) => Promise<{
|
|
14
|
+
namespace: string;
|
|
15
|
+
slug: string;
|
|
16
|
+
} | undefined>;
|
|
17
|
+
uploadState: import("vue").Ref<UploadTmpDocumentState | undefined, UploadTmpDocumentState | undefined>;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=use-upload-tmp-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-upload-tmp-document.d.ts","sourceRoot":"","sources":["../../src/hooks/use-upload-tmp-document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAMxE,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpB,wBAAgB,oBAAoB;mCAeU,iBAAiB;;;;;EAgE9D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ref as p } from "vue";
|
|
2
|
+
import { z as n } from "zod/mini";
|
|
3
|
+
import { useState as d } from "../state/state.js";
|
|
4
|
+
function g() {
|
|
5
|
+
const u = d(), e = p();
|
|
6
|
+
function s(r) {
|
|
7
|
+
const t = `${u.baseUrl}${r}`;
|
|
8
|
+
if (t.startsWith("/")) return t;
|
|
9
|
+
const o = new URLSearchParams({ scalar_url: t.toString() });
|
|
10
|
+
return new URL(`https://proxy.scalar.com/?${o}`);
|
|
11
|
+
}
|
|
12
|
+
async function c(r) {
|
|
13
|
+
try {
|
|
14
|
+
e.value = { type: "uploading" };
|
|
15
|
+
const t = await fetch(s("/core/share/upload/apis"), {
|
|
16
|
+
method: "POST",
|
|
17
|
+
headers: { "Content-Type": "application/json" },
|
|
18
|
+
body: JSON.stringify({ document: JSON.stringify(r) })
|
|
19
|
+
});
|
|
20
|
+
if (!t.ok) {
|
|
21
|
+
e.value = {
|
|
22
|
+
type: "error",
|
|
23
|
+
error: "Failed to upload document."
|
|
24
|
+
};
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const o = await t.json(), { success: i, data: a } = n.object({ namespace: n.string(), slug: n.string() }).safeParse(o);
|
|
28
|
+
if (!i) {
|
|
29
|
+
e.value = {
|
|
30
|
+
type: "error",
|
|
31
|
+
error: "Failed to process document."
|
|
32
|
+
};
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (e.value = {
|
|
36
|
+
type: "processing"
|
|
37
|
+
}, !(await fetch(
|
|
38
|
+
s(`/vector/registry/embeddings/${a.namespace}/${a.slug}`),
|
|
39
|
+
{
|
|
40
|
+
method: "GET"
|
|
41
|
+
}
|
|
42
|
+
)).ok) {
|
|
43
|
+
e.value = {
|
|
44
|
+
type: "error",
|
|
45
|
+
error: "Failed to embed document."
|
|
46
|
+
};
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
return e.value = { type: "done" }, setTimeout(() => {
|
|
50
|
+
e.value = void 0;
|
|
51
|
+
}, 2e3), a;
|
|
52
|
+
} catch {
|
|
53
|
+
e.value = { type: "error", error: "Failed to upload document." };
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
uploadTempDocument: c,
|
|
59
|
+
uploadState: e
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
g as useUploadTmpDocument
|
|
64
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/package.json
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalar/agent-chat",
|
|
3
3
|
"description": "Agent chat components",
|
|
4
|
-
"
|
|
5
|
-
"author": "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": "Scalar (https://github.com/scalar)",
|
|
6
|
+
"homepage": "https://github.com/scalar/scalar",
|
|
7
|
+
"bugs": "https://github.com/scalar/scalar/issues/new/choose",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/scalar/scalar.git",
|
|
11
|
+
"directory": "packages/agent-chat"
|
|
12
|
+
},
|
|
13
|
+
"version": "0.2.4",
|
|
8
14
|
"engines": {
|
|
9
|
-
"node": ">=
|
|
15
|
+
"node": ">=20"
|
|
10
16
|
},
|
|
11
17
|
"scripts": {
|
|
12
18
|
"build": "scalar-build-vite && cp package.json dist",
|
|
@@ -23,6 +29,11 @@
|
|
|
23
29
|
"types": "./dist/index.d.ts",
|
|
24
30
|
"default": "./dist/index.js"
|
|
25
31
|
},
|
|
32
|
+
"./entities/*": {
|
|
33
|
+
"import": "./dist/entities/*",
|
|
34
|
+
"require": "./dist/entities/*",
|
|
35
|
+
"default": "./dist/entities/*"
|
|
36
|
+
},
|
|
26
37
|
"./*.css": {
|
|
27
38
|
"import": "./dist/*.css",
|
|
28
39
|
"require": "./dist/*.css",
|
|
@@ -38,30 +49,31 @@
|
|
|
38
49
|
"dist"
|
|
39
50
|
],
|
|
40
51
|
"dependencies": {
|
|
41
|
-
"@ai-sdk/vue": "
|
|
42
|
-
"@
|
|
43
|
-
"@scalar-
|
|
44
|
-
"@scalar
|
|
45
|
-
"@scalar/
|
|
46
|
-
"@scalar/
|
|
47
|
-
"@scalar/
|
|
48
|
-
"@scalar/
|
|
49
|
-
"@scalar/
|
|
50
|
-
"@scalar/
|
|
51
|
-
"@scalar/
|
|
52
|
-
"@scalar/
|
|
53
|
-
"@scalar/types": "catalog:scalar",
|
|
54
|
-
"@scalar/workspace-store": "catalog:scalar",
|
|
52
|
+
"@ai-sdk/vue": "catalog:*",
|
|
53
|
+
"@modelcontextprotocol/sdk": "catalog:*",
|
|
54
|
+
"@scalar/api-client": "workspace:*",
|
|
55
|
+
"@scalar/api-reference": "workspace:*",
|
|
56
|
+
"@scalar/components": "workspace:*",
|
|
57
|
+
"@scalar/helpers": "workspace:*",
|
|
58
|
+
"@scalar/icons": "workspace:*",
|
|
59
|
+
"@scalar/json-magic": "workspace:*",
|
|
60
|
+
"@scalar/openapi-types": "workspace:*",
|
|
61
|
+
"@scalar/themes": "workspace:*",
|
|
62
|
+
"@scalar/types": "workspace:*",
|
|
63
|
+
"@scalar/workspace-store": "workspace:*",
|
|
55
64
|
"@vueuse/core": "catalog:*",
|
|
56
|
-
"ai": "
|
|
57
|
-
"
|
|
65
|
+
"ai": "catalog:*",
|
|
66
|
+
"neverpanic": "catalog:*",
|
|
58
67
|
"vue": "catalog:*",
|
|
59
|
-
"whatwg-mimetype": "catalog:*"
|
|
68
|
+
"whatwg-mimetype": "catalog:*",
|
|
69
|
+
"zod": "catalog:*"
|
|
60
70
|
},
|
|
61
71
|
"devDependencies": {
|
|
62
|
-
"@scalar/build-tooling": "
|
|
72
|
+
"@scalar/build-tooling": "workspace:*",
|
|
73
|
+
"@tailwindcss/vite": "catalog:*",
|
|
63
74
|
"@types/whatwg-mimetype": "catalog:*",
|
|
64
75
|
"@vitejs/plugin-vue": "catalog:*",
|
|
76
|
+
"tailwindcss": "catalog:*",
|
|
65
77
|
"vite": "catalog:*"
|
|
66
78
|
}
|
|
67
79
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ApiReferenceConfiguration } from '@scalar/types';
|
|
1
|
+
import type { ApiReferenceConfiguration } from '@scalar/types/api-reference';
|
|
3
2
|
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
4
|
-
import type {
|
|
3
|
+
import type { Ref } from 'vue';
|
|
4
|
+
import type { ApiMetadata } from '../entities/registry/document.js';
|
|
5
5
|
export declare function loadDocument({ namespace, slug, workspaceStore, registryDocuments, registryUrl, baseUrl, config, getAccessToken, }: {
|
|
6
6
|
namespace: string;
|
|
7
7
|
slug: string;
|
|
@@ -12,11 +12,11 @@ export declare function loadDocument({ namespace, slug, workspaceStore, registry
|
|
|
12
12
|
registryUrl: string;
|
|
13
13
|
getAccessToken: () => string;
|
|
14
14
|
}): Promise<{
|
|
15
|
-
namespace: string;
|
|
16
|
-
slug: string;
|
|
17
15
|
id: string;
|
|
18
16
|
title: string;
|
|
19
|
-
|
|
17
|
+
namespace: string;
|
|
20
18
|
currentVersion: string;
|
|
19
|
+
logoUrl: string | null;
|
|
20
|
+
slug: string;
|
|
21
21
|
} | undefined>;
|
|
22
22
|
//# sourceMappingURL=add-documents-to-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-documents-to-store.d.ts","sourceRoot":"","sources":["../../src/registry/add-documents-to-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-documents-to-store.d.ts","sourceRoot":"","sources":["../../src/registry/add-documents-to-store.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAG9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAI/D,wBAAsB,YAAY,CAAC,EACjC,SAAS,EACT,IAAI,EACJ,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,MAAM,EACN,cAAc,GACf,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC,CAAA;IACrC,cAAc,EAAE,cAAc,CAAA;IAC9B,MAAM,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAA;IAC1C,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,MAAM,CAAA;CAC7B;;;;;;;eAmCA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { mapConfiguration as d } from "@scalar/api-reference/helpers";
|
|
2
|
+
import { bundle as p } from "@scalar/json-magic/bundle";
|
|
3
|
+
import { fetchUrls as l } from "@scalar/json-magic/bundle/plugins/browser";
|
|
4
|
+
import { api as g } from "../api.js";
|
|
5
|
+
import { restoreAuthSecretsFromStorage as D } from "../helpers.js";
|
|
6
|
+
import { createDocumentName as h } from "./create-document-name.js";
|
|
7
|
+
async function U({
|
|
8
|
+
namespace: t,
|
|
9
|
+
slug: o,
|
|
10
|
+
workspaceStore: e,
|
|
11
|
+
registryDocuments: m,
|
|
12
|
+
registryUrl: n,
|
|
13
|
+
baseUrl: i,
|
|
14
|
+
config: u,
|
|
15
|
+
getAccessToken: c
|
|
16
|
+
}) {
|
|
17
|
+
const r = await g({
|
|
18
|
+
baseUrl: i,
|
|
19
|
+
getAccessToken: c
|
|
20
|
+
}).getDocument({
|
|
21
|
+
namespace: t,
|
|
22
|
+
slug: o
|
|
23
|
+
});
|
|
24
|
+
if (!r.success)
|
|
25
|
+
return;
|
|
26
|
+
m.value.push(r.data);
|
|
27
|
+
const f = new URL(`/@${t}/apis/${o}/latest`, n), s = await p(f.toString(), {
|
|
28
|
+
plugins: [l()],
|
|
29
|
+
treeShake: !1
|
|
30
|
+
}), a = h(t, o);
|
|
31
|
+
return await e.addDocument({
|
|
32
|
+
name: a,
|
|
33
|
+
document: s,
|
|
34
|
+
config: d(u)
|
|
35
|
+
}), e.update("x-scalar-active-document", a), D({ documentName: a, workspaceStore: e }), r.data;
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
U as loadDocument
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-document-name.d.ts","sourceRoot":"","sources":["../../src/registry/create-document-name.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAEjE"}
|