@swiss-ai-hub/web 0.290.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +479 -0
  3. package/app.config.ts +1 -0
  4. package/app.vue +52 -0
  5. package/assets/css/main.css +4 -0
  6. package/assets/images/logo.png +0 -0
  7. package/components/Agent/Avatar.vue +40 -0
  8. package/components/Agent/Card.vue +139 -0
  9. package/components/Agent/Configuration.vue +20 -0
  10. package/components/Agent/CreateModal.vue +287 -0
  11. package/components/Agent/EmptyCard.vue +35 -0
  12. package/components/Agent/List.vue +85 -0
  13. package/components/Agent/TemplateCard.vue +58 -0
  14. package/components/AppLoader.vue +55 -0
  15. package/components/Chat/Message.vue +90 -0
  16. package/components/Chat/SourceNodes.vue +120 -0
  17. package/components/Chat/Thread.vue +134 -0
  18. package/components/Costs/Table.vue +56 -0
  19. package/components/Dashboard/Component/BarChart.vue +46 -0
  20. package/components/Dashboard/Component/LineChart.vue +138 -0
  21. package/components/Dashboard/Component/Number.vue +31 -0
  22. package/components/Dashboard/Grid.vue +214 -0
  23. package/components/Dashboard/Item.vue +75 -0
  24. package/components/Dashboard/Trend.vue +34 -0
  25. package/components/Display/List/DisplayList.vue +93 -0
  26. package/components/Evaluation/Dataset/Card.vue +70 -0
  27. package/components/Evaluation/Dataset/Create.vue +81 -0
  28. package/components/Evaluation/Dataset/Edit.vue +132 -0
  29. package/components/Event/Display/AddMemoryToChatHistoryEvent.vue +60 -0
  30. package/components/Event/Display/AgentInTheLoopRequestEvent.vue +56 -0
  31. package/components/Event/Display/AgentInTheLoopResponseEvent.vue +17 -0
  32. package/components/Event/Display/Base.vue +125 -0
  33. package/components/Event/Display/BaseRetrieveMemoryEvent.vue +101 -0
  34. package/components/Event/Display/BaseStoreMemoryEvent.vue +182 -0
  35. package/components/Event/Display/ChunkEvent.vue +40 -0
  36. package/components/Event/Display/EmbeddingEvent.vue +25 -0
  37. package/components/Event/Display/ExceptionEvent.vue +21 -0
  38. package/components/Event/Display/GuardAcceptEvent.vue +25 -0
  39. package/components/Event/Display/GuardEvent.vue +17 -0
  40. package/components/Event/Display/GuardRejectionEvent.vue +25 -0
  41. package/components/Event/Display/HumanInTheLoopRequestEvent.vue +53 -0
  42. package/components/Event/Display/HumanInTheLoopResponseEvent.vue +40 -0
  43. package/components/Event/Display/LLMCostEvent.vue +25 -0
  44. package/components/Event/Display/LLMEvent.vue +92 -0
  45. package/components/Event/Display/LimitChatHistoryEvent.vue +60 -0
  46. package/components/Event/Display/RAGFailureStopEvent.vue +28 -0
  47. package/components/Event/Display/RAGStartEvent.vue +77 -0
  48. package/components/Event/Display/RAGSuccessStopEvent.vue +16 -0
  49. package/components/Event/Display/RawDataContent.vue +69 -0
  50. package/components/Event/Display/RerankerEvent.vue +39 -0
  51. package/components/Event/Display/RetrieverEvent.vue +22 -0
  52. package/components/Event/Display/RouterEvent.vue +54 -0
  53. package/components/Event/Display/StandaloneQuestionCondenserEvent.vue +38 -0
  54. package/components/Event/Display/StopEvent.vue +16 -0
  55. package/components/Event/Display/ThoughtEvent.vue +20 -0
  56. package/components/Event/Display/ToolEvent.vue +38 -0
  57. package/components/Event/Display/UnknownEvent.vue +17 -0
  58. package/components/Event/Display/UserMessageEvent.vue +35 -0
  59. package/components/Event/List/EventList.vue +249 -0
  60. package/components/Event/Statistics.vue +49 -0
  61. package/components/Event/Timeseries.vue +224 -0
  62. package/components/FormKit/AgentSelector.vue +307 -0
  63. package/components/FormKit/ChipsInput.vue +62 -0
  64. package/components/FormKit/DynamicConfiguration.vue +155 -0
  65. package/components/FormKit/IconSelector.vue +72 -0
  66. package/components/FormKit/KnowledgeDatabaseSelector.vue +92 -0
  67. package/components/FormKit/LocaleInput.vue +150 -0
  68. package/components/FormKit/ModelSelect.vue +110 -0
  69. package/components/FormKit/Repeater.vue +93 -0
  70. package/components/FormKit/VectorStoreInput.vue +247 -0
  71. package/components/Knowledge/Document/List.vue +140 -0
  72. package/components/Knowledge/Document/Overview.vue +28 -0
  73. package/components/Knowledge/Document/UploadModal.vue +298 -0
  74. package/components/Knowledge/Document/WithNodes.vue +105 -0
  75. package/components/Knowledge/Namespace/Card.vue +108 -0
  76. package/components/Knowledge/Namespace/CreateModal.vue +203 -0
  77. package/components/Knowledge/Namespace/EditModal.vue +134 -0
  78. package/components/Knowledge/Namespace/EmptyCard.vue +35 -0
  79. package/components/Knowledge/Node/Content.vue +71 -0
  80. package/components/Markdown/Renderer.vue +87 -0
  81. package/components/Memory/DetailPage.vue +48 -0
  82. package/components/Memory/Edit.vue +241 -0
  83. package/components/Memory/Graph.vue +318 -0
  84. package/components/Memory/List.vue +155 -0
  85. package/components/Memory/MemoryManagementPage.vue +178 -0
  86. package/components/Memory/OpenWebUIContent.vue +96 -0
  87. package/components/Memory/PageLayout.vue +72 -0
  88. package/components/Models/ModelDetailsPanel.vue +250 -0
  89. package/components/Models/NamespaceCard.vue +79 -0
  90. package/components/Navigation/Left.vue +85 -0
  91. package/components/Navigation/Top.vue +31 -0
  92. package/components/Notification/Item.vue +88 -0
  93. package/components/Notification/NotificationsOverlay.vue +164 -0
  94. package/components/Process/Card.vue +119 -0
  95. package/components/Process/Configuration.vue +20 -0
  96. package/components/Process/CreateModal.vue +276 -0
  97. package/components/Process/EmptyCard.vue +35 -0
  98. package/components/Process/Form.vue +153 -0
  99. package/components/Process/Starts.vue +44 -0
  100. package/components/Process/Walkthrough/List.vue +162 -0
  101. package/components/Role/AccessRulesEditor.vue +132 -0
  102. package/components/Role/Card.vue +68 -0
  103. package/components/Role/Create.vue +55 -0
  104. package/components/Role/Edit.vue +82 -0
  105. package/components/Role/UsageLimitsEditor.vue +225 -0
  106. package/components/Service/Selection.vue +148 -0
  107. package/components/Structural/Column.vue +74 -0
  108. package/components/Structural/Screen.vue +10 -0
  109. package/components/Structural/Substructure.vue +5 -0
  110. package/components/Tenant/Switcher.vue +102 -0
  111. package/components/Thread/Details.vue +135 -0
  112. package/components/Thread/Hierarchy.vue +136 -0
  113. package/components/Thread/Info.vue +41 -0
  114. package/components/Thread/List.vue +136 -0
  115. package/components/User/Bar.vue +74 -0
  116. package/components/User/List.vue +86 -0
  117. package/components/User/RoleChips.vue +83 -0
  118. package/components/User/Settings.vue +79 -0
  119. package/components/Workflow/Modal.vue +39 -0
  120. package/components/Workflow/NodeCard.vue +41 -0
  121. package/components/Workflow/StartNode.vue +24 -0
  122. package/components/Workflow/StepNode.vue +27 -0
  123. package/components/Workflow/StopNode.vue +24 -0
  124. package/components/Workflow/Visualization.vue +265 -0
  125. package/components/mdc/MarkdownFigure.vue +9 -0
  126. package/components/mdc/MarkdownTable.vue +9 -0
  127. package/components/mdc/ResolveImageComponent.vue +58 -0
  128. package/composables/agent/useAgentClass.ts +27 -0
  129. package/composables/agent/useAgentClassInstances.ts +27 -0
  130. package/composables/agent/useAgentClasses.ts +27 -0
  131. package/composables/agent/useAgentIconFromThread.ts +8 -0
  132. package/composables/agent/useAgentInstance.ts +28 -0
  133. package/composables/agent/useAgentInstanceThreads.ts +76 -0
  134. package/composables/agent/useAgentInstances.ts +25 -0
  135. package/composables/agent/useAgentNavigation.ts +35 -0
  136. package/composables/agent/useCreateAgentInstance.ts +33 -0
  137. package/composables/agent/useDeleteAgentInstance.ts +31 -0
  138. package/composables/agent/useUpdateAgentInstance.ts +40 -0
  139. package/composables/auth/useAuth.ts +54 -0
  140. package/composables/auth/useAuthProviders.ts +14 -0
  141. package/composables/chat/useChatCompletions.ts +30 -0
  142. package/composables/dashboard/useAgentNameFromDashboardWidget.ts +27 -0
  143. package/composables/dashboard/useDashboardComponent.ts +27 -0
  144. package/composables/dashboard/useSaveDashboard.ts +21 -0
  145. package/composables/document/useCreateNamespace.ts +26 -0
  146. package/composables/document/useDatabases.ts +23 -0
  147. package/composables/document/useDocument.ts +29 -0
  148. package/composables/document/useDocumentUrl.ts +20 -0
  149. package/composables/document/useDocuments.ts +107 -0
  150. package/composables/document/useNodes.ts +29 -0
  151. package/composables/document/useSummaryNodes.ts +32 -0
  152. package/composables/document/useUpdateNamespace.ts +22 -0
  153. package/composables/evaluation/useCreateDataset.ts +19 -0
  154. package/composables/evaluation/useDataset.ts +26 -0
  155. package/composables/evaluation/useDatasets.ts +25 -0
  156. package/composables/evaluation/useUpdateDataset.ts +23 -0
  157. package/composables/event/useBasicEventStatistics.ts +83 -0
  158. package/composables/event/useEventColor.ts +25 -0
  159. package/composables/event/useEventComponent.ts +87 -0
  160. package/composables/event/useEventTimeseries.ts +39 -0
  161. package/composables/event/useEventTimeseriesStats.ts +26 -0
  162. package/composables/file/useFileUpload.ts +91 -0
  163. package/composables/file/useSupportedFileTypes.ts +22 -0
  164. package/composables/form/useCreateInstanceForm.ts +251 -0
  165. package/composables/form/useFormKitTransform.ts +753 -0
  166. package/composables/memory/useMemoryCRUD.ts +88 -0
  167. package/composables/memory/useMemoryFactory.ts +319 -0
  168. package/composables/memory/useMemorySearchFilter.ts +74 -0
  169. package/composables/models/useModelsList.ts +24 -0
  170. package/composables/models/useSingleModel.ts +30 -0
  171. package/composables/notification/useNotificationPoller.ts +58 -0
  172. package/composables/notification/useNotifications.ts +57 -0
  173. package/composables/notification/useUpdateMultipleNotifications.ts +17 -0
  174. package/composables/notification/useUpdateNotification.ts +17 -0
  175. package/composables/process/useCreateProcessInstance.ts +32 -0
  176. package/composables/process/useDeleteProcessInstance.ts +31 -0
  177. package/composables/process/useProcessClasses.ts +27 -0
  178. package/composables/process/useProcessInstance.ts +28 -0
  179. package/composables/process/useProcessInstances.ts +27 -0
  180. package/composables/process/useProcessWalkthroughs.ts +73 -0
  181. package/composables/process/useSendProcessStartForm.ts +43 -0
  182. package/composables/process/useUpdateProcessInstance.ts +40 -0
  183. package/composables/role/useCreateRole.ts +19 -0
  184. package/composables/role/useDeleteRole.ts +21 -0
  185. package/composables/role/useRole.ts +30 -0
  186. package/composables/role/useRoles.ts +25 -0
  187. package/composables/role/useUpdateRole.ts +22 -0
  188. package/composables/suite/useApps.ts +31 -0
  189. package/composables/suite/useSuite.ts +26 -0
  190. package/composables/tenant/useActiveTenant.ts +27 -0
  191. package/composables/tenant/useSysadminNavigation.ts +19 -0
  192. package/composables/tenant/useTenant.ts +38 -0
  193. package/composables/tenant/useTenantMemberships.ts +15 -0
  194. package/composables/tenant/useTenantPath.ts +20 -0
  195. package/composables/tenant/useTenantPolling.ts +30 -0
  196. package/composables/tenant/useTenantReady.ts +12 -0
  197. package/composables/theme/useDarkMode.ts +5 -0
  198. package/composables/thread/useThread.ts +27 -0
  199. package/composables/thread/useThreadEvents.ts +91 -0
  200. package/composables/thread/useThreadUtils.ts +49 -0
  201. package/composables/thread/useThreads.ts +64 -0
  202. package/composables/thread/useThreadsInfinite.ts +56 -0
  203. package/composables/translation/useTranslate.ts +20 -0
  204. package/composables/useRouteReady.ts +21 -0
  205. package/composables/useTimeAgo.ts +40 -0
  206. package/composables/user/useAssignRoleToUser.ts +22 -0
  207. package/composables/user/useMyUser.ts +25 -0
  208. package/composables/user/useRevokeRoleFromUser.ts +21 -0
  209. package/composables/user/useUser.ts +30 -0
  210. package/composables/user/useUsers.ts +63 -0
  211. package/composables/utils/useJsonTree.ts +138 -0
  212. package/formkit.config.ts +44 -0
  213. package/i18n/locales/de.yaml +815 -0
  214. package/i18n/locales/en.yaml +804 -0
  215. package/i18n/locales/fr.yaml +812 -0
  216. package/i18n/locales/it.yaml +808 -0
  217. package/layouts/anonymous.vue +8 -0
  218. package/layouts/default.vue +116 -0
  219. package/middleware/auth.global.ts +62 -0
  220. package/nuxt.config.ts +145 -0
  221. package/package.json +114 -0
  222. package/pages/[tenant]/index.vue +31 -0
  223. package/pages/[tenant]/notifications/index.vue +235 -0
  224. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/chat.vue +67 -0
  225. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/configuration.vue +122 -0
  226. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/memories/[memory_id].vue +3 -0
  227. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/memories.vue +20 -0
  228. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/overview.vue +72 -0
  229. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/threads.vue +52 -0
  230. package/pages/[tenant]/service/agents/[agent_class]-[agent_id]/workflow.vue +19 -0
  231. package/pages/[tenant]/service/agents/[agent_class]-[agent_id].vue +63 -0
  232. package/pages/[tenant]/service/agents/templates.vue +102 -0
  233. package/pages/[tenant]/service/agents.vue +185 -0
  234. package/pages/[tenant]/service/datasets/[dataset_id].vue +81 -0
  235. package/pages/[tenant]/service/datasets.vue +53 -0
  236. package/pages/[tenant]/service/health/index.vue +3 -0
  237. package/pages/[tenant]/service/knowledge/[db]/[namespace]/[document_id]/nodes.vue +20 -0
  238. package/pages/[tenant]/service/knowledge/[db]/[namespace]/[document_id]/overview.vue +40 -0
  239. package/pages/[tenant]/service/knowledge/[db]/[namespace]/[document_id]/summary.vue +88 -0
  240. package/pages/[tenant]/service/knowledge/[db]/[namespace]/[document_id].vue +48 -0
  241. package/pages/[tenant]/service/knowledge/[db]/[namespace].vue +144 -0
  242. package/pages/[tenant]/service/knowledge.vue +126 -0
  243. package/pages/[tenant]/service/models/[model_name].vue +84 -0
  244. package/pages/[tenant]/service/models.vue +61 -0
  245. package/pages/[tenant]/service/my-account.vue +117 -0
  246. package/pages/[tenant]/service/openai/[thread_id]/[display_id]/memories.vue +66 -0
  247. package/pages/[tenant]/service/openai/[thread_id]/[display_id]/sources.vue +100 -0
  248. package/pages/[tenant]/service/openai/[thread_id]/[display_id]/tracing.vue +49 -0
  249. package/pages/[tenant]/service/openai.vue +101 -0
  250. package/pages/[tenant]/service/organization-memories/graph.vue +97 -0
  251. package/pages/[tenant]/service/organization-memories/list/[memory_id].vue +3 -0
  252. package/pages/[tenant]/service/organization-memories/list.vue +150 -0
  253. package/pages/[tenant]/service/organization-memories.vue +3 -0
  254. package/pages/[tenant]/service/processes/[process_class]-[process_id]/[process_walkthrough_id].vue +7 -0
  255. package/pages/[tenant]/service/processes/[process_class]-[process_id]/configuration.vue +106 -0
  256. package/pages/[tenant]/service/processes/[process_class]-[process_id]/overview.vue +67 -0
  257. package/pages/[tenant]/service/processes/[process_class]-[process_id]/start.vue +26 -0
  258. package/pages/[tenant]/service/processes/[process_class]-[process_id]/walkthroughs/[process_walkthrough_id]/overview.vue +14 -0
  259. package/pages/[tenant]/service/processes/[process_class]-[process_id]/walkthroughs.vue +54 -0
  260. package/pages/[tenant]/service/processes/[process_class]-[process_id].vue +60 -0
  261. package/pages/[tenant]/service/processes.vue +129 -0
  262. package/pages/[tenant]/service/roles/[role_id].vue +54 -0
  263. package/pages/[tenant]/service/roles.vue +84 -0
  264. package/pages/[tenant]/service/threads/[thread_id]/chat.vue +51 -0
  265. package/pages/[tenant]/service/threads/[thread_id]/display/[display_id].vue +21 -0
  266. package/pages/[tenant]/service/threads/[thread_id]/display.vue +29 -0
  267. package/pages/[tenant]/service/threads/[thread_id]/hierarchy.vue +14 -0
  268. package/pages/[tenant]/service/threads/[thread_id]/memories/[memory_id].vue +3 -0
  269. package/pages/[tenant]/service/threads/[thread_id]/memories.vue +19 -0
  270. package/pages/[tenant]/service/threads/[thread_id]/overview.vue +100 -0
  271. package/pages/[tenant]/service/threads/[thread_id].vue +54 -0
  272. package/pages/[tenant]/service/threads.vue +52 -0
  273. package/pages/[tenant]/service/user-memories/graph.vue +97 -0
  274. package/pages/[tenant]/service/user-memories/list/[memory_id].vue +3 -0
  275. package/pages/[tenant]/service/user-memories/list.vue +150 -0
  276. package/pages/[tenant]/service/user-memories.vue +3 -0
  277. package/pages/[tenant]/service/users/[user_id].vue +117 -0
  278. package/pages/[tenant]/service/users.vue +88 -0
  279. package/pages/auth/callback.vue +52 -0
  280. package/pages/auth/login.vue +80 -0
  281. package/pages/auth/renew.vue +24 -0
  282. package/pages/index.vue +59 -0
  283. package/pages/select-tenant.vue +76 -0
  284. package/plugins/0.runtime-config.client.ts +55 -0
  285. package/plugins/apexcharts.client.ts +5 -0
  286. package/plugins/api-client.client.ts +38 -0
  287. package/plugins/dark-mode.client.ts +12 -0
  288. package/plugins/keycloak-client.ts +41 -0
  289. package/plugins/oidc-client.ts +78 -0
  290. package/sdk/client/client/client.gen.ts +237 -0
  291. package/sdk/client/client/index.ts +24 -0
  292. package/sdk/client/client/types.gen.ts +213 -0
  293. package/sdk/client/client/utils.gen.ts +407 -0
  294. package/sdk/client/client.gen.ts +25 -0
  295. package/sdk/client/core/auth.gen.ts +42 -0
  296. package/sdk/client/core/bodySerializer.gen.ts +96 -0
  297. package/sdk/client/core/params.gen.ts +181 -0
  298. package/sdk/client/core/pathSerializer.gen.ts +180 -0
  299. package/sdk/client/core/queryKeySerializer.gen.ts +136 -0
  300. package/sdk/client/core/serverSentEvents.gen.ts +265 -0
  301. package/sdk/client/core/types.gen.ts +118 -0
  302. package/sdk/client/core/utils.gen.ts +143 -0
  303. package/sdk/client/index.ts +1013 -0
  304. package/sdk/client/schemas.gen.ts +35395 -0
  305. package/sdk/client/sdk.gen.ts +3438 -0
  306. package/sdk/client/transformers.gen.ts +143 -0
  307. package/sdk/client/types.gen.ts +27567 -0
  308. package/tailwind.config.mjs +27 -0
  309. package/themes/aihub-theme.ts +125 -0
  310. package/types/DashboardWidget.ts +13 -0
  311. package/types/EventChartInput.ts +7 -0
  312. package/types/NavItem.ts +6 -0
  313. package/types/TimeseriesInput.ts +7 -0
@@ -0,0 +1,213 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import type {
4
+ AsyncDataOptions,
5
+ useAsyncData,
6
+ useFetch,
7
+ UseFetchOptions,
8
+ useLazyAsyncData,
9
+ useLazyFetch,
10
+ } from "nuxt/app";
11
+ import type { Ref } from "vue";
12
+
13
+ import type { Auth } from "../core/auth.gen";
14
+ import type { QuerySerializerOptions } from "../core/bodySerializer.gen";
15
+ import type {
16
+ ServerSentEventsOptions,
17
+ ServerSentEventsResult,
18
+ } from "../core/serverSentEvents.gen";
19
+ import type {
20
+ Client as CoreClient,
21
+ Config as CoreConfig,
22
+ } from "../core/types.gen";
23
+
24
+ export type ArraySeparatorStyle = ArrayStyle | MatrixStyle;
25
+ type ArrayStyle = "form" | "spaceDelimited" | "pipeDelimited";
26
+ type MatrixStyle = "label" | "matrix" | "simple";
27
+ export type ObjectSeparatorStyle = ObjectStyle | MatrixStyle;
28
+ type ObjectStyle = "form" | "deepObject";
29
+
30
+ export type QuerySerializer = (
31
+ query: Parameters<Client["buildUrl"]>[0]["query"],
32
+ ) => string;
33
+
34
+ type WithRefs<TData> = {
35
+ [K in keyof TData]: NonNullable<TData[K]> extends object
36
+ ?
37
+ | WithRefs<NonNullable<TData[K]>>
38
+ | Ref<NonNullable<TData[K]>>
39
+ | Extract<TData[K], null>
40
+ :
41
+ | NonNullable<TData[K]>
42
+ | Ref<NonNullable<TData[K]>>
43
+ | Extract<TData[K], null>;
44
+ };
45
+
46
+ // copied from Nuxt
47
+ export type KeysOf<T> = Array<
48
+ T extends T ? (keyof T extends string ? keyof T : never) : never
49
+ >;
50
+
51
+ export interface Config<T extends ClientOptions = ClientOptions>
52
+ extends
53
+ Omit<
54
+ FetchOptions<unknown>,
55
+ "baseURL" | "body" | "headers" | "method" | "query"
56
+ >,
57
+ WithRefs<Pick<FetchOptions<unknown>, "query">>,
58
+ Omit<CoreConfig, "querySerializer"> {
59
+ /**
60
+ * Base URL for all requests made by this client.
61
+ */
62
+ baseURL?: T["baseURL"];
63
+ /**
64
+ * A function for serializing request query parameters. By default, arrays
65
+ * will be exploded in form style, objects will be exploded in deepObject
66
+ * style, and reserved characters are percent-encoded.
67
+ *
68
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
69
+ */
70
+ querySerializer?: QuerySerializer | QuerySerializerOptions;
71
+ }
72
+
73
+ export interface RequestOptions<
74
+ TComposable extends Composable = "$fetch",
75
+ ResT = unknown,
76
+ DefaultT = undefined,
77
+ Url extends string = string,
78
+ >
79
+ extends
80
+ Config,
81
+ WithRefs<{
82
+ path?: FetchOptions<unknown>["query"];
83
+ query?: FetchOptions<unknown>["query"];
84
+ }>,
85
+ Pick<
86
+ ServerSentEventsOptions<ResT>,
87
+ | "onSseError"
88
+ | "onSseEvent"
89
+ | "sseDefaultRetryDelay"
90
+ | "sseMaxRetryAttempts"
91
+ | "sseMaxRetryDelay"
92
+ > {
93
+ asyncDataOptions?: AsyncDataOptions<ResT, ResT, KeysOf<ResT>, DefaultT>;
94
+ /**
95
+ * Any body that you want to add to your request.
96
+ *
97
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
98
+ */
99
+ body?: NonNullable<unknown> | Ref<NonNullable<unknown>> | null;
100
+ composable?: TComposable;
101
+ key?: string;
102
+ rawBody?: NonNullable<unknown> | Ref<NonNullable<unknown>> | null;
103
+ /**
104
+ * Security mechanism(s) to use for the request.
105
+ */
106
+ security?: ReadonlyArray<Auth>;
107
+ url: Url;
108
+ }
109
+
110
+ export type RequestResult<
111
+ TComposable extends Composable,
112
+ ResT,
113
+ TError,
114
+ > = TComposable extends "$fetch"
115
+ ? ReturnType<typeof $fetch<ResT>>
116
+ : TComposable extends "useAsyncData"
117
+ ? ReturnType<typeof useAsyncData<ResT | null, TError>>
118
+ : TComposable extends "useFetch"
119
+ ? ReturnType<typeof useFetch<ResT | null, TError>>
120
+ : TComposable extends "useLazyAsyncData"
121
+ ? ReturnType<typeof useLazyAsyncData<ResT | null, TError>>
122
+ : TComposable extends "useLazyFetch"
123
+ ? ReturnType<typeof useLazyFetch<ResT | null, TError>>
124
+ : never;
125
+
126
+ export interface ClientOptions {
127
+ baseURL?: string;
128
+ }
129
+
130
+ type MethodFn = <
131
+ TComposable extends Composable = "$fetch",
132
+ ResT = unknown,
133
+ TError = unknown,
134
+ DefaultT = undefined,
135
+ >(
136
+ options: Omit<RequestOptions<TComposable, ResT, DefaultT>, "method">,
137
+ ) => RequestResult<TComposable, ResT, TError>;
138
+
139
+ type SseFn = <
140
+ TComposable extends Composable = "$fetch",
141
+ ResT = unknown,
142
+ TError = unknown,
143
+ DefaultT = undefined,
144
+ >(
145
+ options: Omit<RequestOptions<TComposable, ResT, DefaultT>, "method">,
146
+ ) => Promise<ServerSentEventsResult<RequestResult<TComposable, ResT, TError>>>;
147
+
148
+ type RequestFn = <
149
+ TComposable extends Composable = "$fetch",
150
+ ResT = unknown,
151
+ TError = unknown,
152
+ DefaultT = undefined,
153
+ >(
154
+ options: Omit<RequestOptions<TComposable, ResT, DefaultT>, "method"> &
155
+ Pick<Required<RequestOptions<TComposable, ResT, DefaultT>>, "method">,
156
+ ) => RequestResult<TComposable, ResT, TError>;
157
+
158
+ /**
159
+ * The `createClientConfig()` function will be called on client initialization
160
+ * and the returned object will become the client's initial configuration.
161
+ *
162
+ * You may want to initialize your client this way instead of calling
163
+ * `setConfig()`. This is useful for example if you're using Next.js
164
+ * to ensure your client always has the correct values.
165
+ */
166
+ export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
167
+ override?: Config<ClientOptions & T>,
168
+ ) => Config<Required<ClientOptions> & T>;
169
+
170
+ export interface TDataShape {
171
+ body?: unknown;
172
+ headers?: unknown;
173
+ path?: FetchOptions<unknown>["query"];
174
+ query?: FetchOptions<unknown>["query"];
175
+ url: string;
176
+ }
177
+
178
+ export type BuildUrlOptions<
179
+ TData extends Omit<TDataShape, "headers"> = Omit<TDataShape, "headers">,
180
+ > = Pick<WithRefs<TData>, "path" | "query"> &
181
+ Pick<TData, "url"> &
182
+ Pick<Options<"$fetch", TData>, "baseURL" | "querySerializer">;
183
+
184
+ type BuildUrlFn = <TData extends Omit<TDataShape, "headers">>(
185
+ options: BuildUrlOptions<TData>,
186
+ ) => string;
187
+
188
+ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>;
189
+
190
+ type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
191
+
192
+ export type Options<
193
+ TComposable extends Composable = "$fetch",
194
+ TData extends TDataShape = TDataShape,
195
+ ResT = unknown,
196
+ DefaultT = undefined,
197
+ > = OmitKeys<
198
+ RequestOptions<TComposable, ResT, DefaultT>,
199
+ "body" | "path" | "query" | "url"
200
+ > &
201
+ ([TData] extends [never] ? unknown : WithRefs<Omit<TData, "url">>);
202
+
203
+ type FetchOptions<TData> = Omit<
204
+ UseFetchOptions<TData, TData>,
205
+ keyof AsyncDataOptions<TData>
206
+ >;
207
+
208
+ export type Composable =
209
+ | "$fetch"
210
+ | "useAsyncData"
211
+ | "useFetch"
212
+ | "useLazyAsyncData"
213
+ | "useLazyFetch";
@@ -0,0 +1,407 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import type { ComputedRef, Ref } from "vue";
4
+ import { isRef, toValue, unref } from "vue";
5
+
6
+ import { getAuthToken } from "../core/auth.gen";
7
+ import type { QuerySerializerOptions } from "../core/bodySerializer.gen";
8
+ import { jsonBodySerializer } from "../core/bodySerializer.gen";
9
+ import {
10
+ serializeArrayParam,
11
+ serializeObjectParam,
12
+ serializePrimitiveParam,
13
+ } from "../core/pathSerializer.gen";
14
+ import type {
15
+ ArraySeparatorStyle,
16
+ BuildUrlOptions,
17
+ Client,
18
+ ClientOptions,
19
+ Config,
20
+ QuerySerializer,
21
+ RequestOptions,
22
+ } from "./types.gen";
23
+
24
+ type PathSerializer = Pick<Required<BuildUrlOptions>, "path" | "url">;
25
+
26
+ const PATH_PARAM_RE = /\{[^{}]+\}/g;
27
+
28
+ type MaybeArray<T> = T | T[];
29
+
30
+ const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
31
+ let url = _url;
32
+ const matches = _url.match(PATH_PARAM_RE);
33
+ if (matches) {
34
+ for (const match of matches) {
35
+ let explode = false;
36
+ let name = match.substring(1, match.length - 1);
37
+ let style: ArraySeparatorStyle = "simple";
38
+
39
+ if (name.endsWith("*")) {
40
+ explode = true;
41
+ name = name.substring(0, name.length - 1);
42
+ }
43
+
44
+ if (name.startsWith(".")) {
45
+ name = name.substring(1);
46
+ style = "label";
47
+ } else if (name.startsWith(";")) {
48
+ name = name.substring(1);
49
+ style = "matrix";
50
+ }
51
+
52
+ const value = toValue(
53
+ (toValue(path) as Record<string, unknown> | undefined)?.[name],
54
+ );
55
+
56
+ if (value === undefined || value === null) {
57
+ continue;
58
+ }
59
+
60
+ if (Array.isArray(value)) {
61
+ url = url.replace(
62
+ match,
63
+ serializeArrayParam({ explode, name, style, value }),
64
+ );
65
+ continue;
66
+ }
67
+
68
+ if (typeof value === "object") {
69
+ url = url.replace(
70
+ match,
71
+ serializeObjectParam({
72
+ explode,
73
+ name,
74
+ style,
75
+ value: value as Record<string, unknown>,
76
+ valueOnly: true,
77
+ }),
78
+ );
79
+ continue;
80
+ }
81
+
82
+ if (style === "matrix") {
83
+ url = url.replace(
84
+ match,
85
+ `;${serializePrimitiveParam({
86
+ name,
87
+ value: value as string,
88
+ })}`,
89
+ );
90
+ continue;
91
+ }
92
+
93
+ const replaceValue = encodeURIComponent(
94
+ style === "label" ? `.${value as string}` : (value as string),
95
+ );
96
+ url = url.replace(match, replaceValue);
97
+ }
98
+ }
99
+ return url;
100
+ };
101
+
102
+ export const createQuerySerializer = <T = unknown>({
103
+ parameters = {},
104
+ ...args
105
+ }: QuerySerializerOptions = {}) => {
106
+ const querySerializer = (queryParams: T) => {
107
+ const search: string[] = [];
108
+ const qParams = toValue(queryParams);
109
+ if (qParams && typeof qParams === "object") {
110
+ for (const name in qParams) {
111
+ const value = toValue(qParams[name]);
112
+
113
+ if (value === undefined || value === null) {
114
+ continue;
115
+ }
116
+
117
+ const options = parameters[name] || args;
118
+
119
+ if (Array.isArray(value)) {
120
+ const serializedArray = serializeArrayParam({
121
+ allowReserved: options.allowReserved,
122
+ explode: true,
123
+ name,
124
+ style: "form",
125
+ value,
126
+ ...options.array,
127
+ });
128
+ if (serializedArray) search.push(serializedArray);
129
+ } else if (typeof value === "object") {
130
+ const serializedObject = serializeObjectParam({
131
+ allowReserved: options.allowReserved,
132
+ explode: true,
133
+ name,
134
+ style: "deepObject",
135
+ value: value as Record<string, unknown>,
136
+ ...options.object,
137
+ });
138
+ if (serializedObject) search.push(serializedObject);
139
+ } else {
140
+ const serializedPrimitive = serializePrimitiveParam({
141
+ allowReserved: options.allowReserved,
142
+ name,
143
+ value: value as string,
144
+ });
145
+ if (serializedPrimitive) search.push(serializedPrimitive);
146
+ }
147
+ }
148
+ }
149
+ return search.join("&");
150
+ };
151
+ return querySerializer;
152
+ };
153
+
154
+ const checkForExistence = (
155
+ options: Pick<RequestOptions, "auth" | "query"> & {
156
+ headers: Headers;
157
+ },
158
+ name?: string,
159
+ ): boolean => {
160
+ if (!name) {
161
+ return false;
162
+ }
163
+ if (
164
+ options.headers.has(name) ||
165
+ (toValue(options.query) as Record<string, unknown> | undefined)?.[name] ||
166
+ options.headers.get("Cookie")?.includes(`${name}=`)
167
+ ) {
168
+ return true;
169
+ }
170
+ return false;
171
+ };
172
+
173
+ export const setAuthParams = async ({
174
+ security,
175
+ ...options
176
+ }: Pick<Required<RequestOptions>, "security"> &
177
+ Pick<RequestOptions, "auth" | "query"> & {
178
+ headers: Headers;
179
+ }) => {
180
+ for (const auth of security) {
181
+ if (checkForExistence(options, auth.name)) {
182
+ continue;
183
+ }
184
+ const token = await getAuthToken(auth, options.auth);
185
+
186
+ if (!token) {
187
+ continue;
188
+ }
189
+
190
+ const name = auth.name ?? "Authorization";
191
+
192
+ switch (auth.in) {
193
+ case "query": {
194
+ if (!options.query) {
195
+ options.query = {};
196
+ }
197
+ const queryValue = toValue(options.query) as
198
+ | Record<string, unknown>
199
+ | undefined;
200
+ if (queryValue) {
201
+ queryValue[name] = token;
202
+ }
203
+ break;
204
+ }
205
+ case "cookie":
206
+ options.headers.append("Cookie", `${name}=${token}`);
207
+ break;
208
+ case "header":
209
+ default:
210
+ options.headers.set(name, token);
211
+ break;
212
+ }
213
+ }
214
+ };
215
+
216
+ export const buildUrl: Client["buildUrl"] = (options) => {
217
+ const url = getUrl({
218
+ baseUrl: options.baseURL as string,
219
+ path: options.path,
220
+ query: options.query,
221
+ querySerializer:
222
+ typeof options.querySerializer === "function"
223
+ ? options.querySerializer
224
+ : createQuerySerializer(options.querySerializer),
225
+ url: options.url,
226
+ });
227
+ return url;
228
+ };
229
+
230
+ export const getUrl = ({
231
+ baseUrl,
232
+ path,
233
+ query,
234
+ querySerializer,
235
+ url: _url,
236
+ }: Pick<BuildUrlOptions, "path" | "query" | "url"> & {
237
+ baseUrl?: string;
238
+ querySerializer: QuerySerializer;
239
+ }) => {
240
+ const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
241
+ let url = (baseUrl ?? "") + pathUrl;
242
+ if (path) {
243
+ url = defaultPathSerializer({ path, url });
244
+ }
245
+ let search = query ? querySerializer(query) : "";
246
+ if (search.startsWith("?")) {
247
+ search = search.substring(1);
248
+ }
249
+ if (search) {
250
+ url += `?${search}`;
251
+ }
252
+ return url;
253
+ };
254
+
255
+ export const mergeConfigs = (a: Config, b: Config): Config => {
256
+ const config = { ...a, ...b };
257
+ if (config.baseURL?.endsWith("/")) {
258
+ config.baseURL = config.baseURL.substring(0, config.baseURL.length - 1);
259
+ }
260
+ config.headers = mergeHeaders(a.headers, b.headers);
261
+ return config;
262
+ };
263
+
264
+ const headersEntries = (headers: Headers): Array<[string, string]> => {
265
+ const entries: Array<[string, string]> = [];
266
+ headers.forEach((value, key) => {
267
+ entries.push([key, value]);
268
+ });
269
+ return entries;
270
+ };
271
+
272
+ export const mergeHeaders = (
273
+ ...headers: Array<Required<Config>["headers"] | undefined>
274
+ ): Headers => {
275
+ const mergedHeaders = new Headers();
276
+ for (const header of headers) {
277
+ if (!header || typeof header !== "object") {
278
+ continue;
279
+ }
280
+
281
+ let h: unknown = header;
282
+ if (isRef(h)) {
283
+ h = unref(h);
284
+ }
285
+
286
+ const iterator =
287
+ h instanceof Headers
288
+ ? headersEntries(h)
289
+ : Object.entries(h as Record<string, unknown>);
290
+
291
+ for (const [key, value] of iterator) {
292
+ if (value === null) {
293
+ mergedHeaders.delete(key);
294
+ } else if (Array.isArray(value)) {
295
+ for (const v of value) {
296
+ mergedHeaders.append(key, unwrapRefs(v) as string);
297
+ }
298
+ } else if (value !== undefined) {
299
+ const v = unwrapRefs(value);
300
+ // assume object headers are meant to be JSON stringified, i.e., their
301
+ // content value in OpenAPI specification is 'application/json'
302
+ mergedHeaders.set(
303
+ key,
304
+ typeof v === "object" ? JSON.stringify(v) : (v as string),
305
+ );
306
+ }
307
+ }
308
+ }
309
+ return mergedHeaders;
310
+ };
311
+
312
+ export const mergeInterceptors = <T>(...args: Array<MaybeArray<T>>): Array<T> =>
313
+ args.reduce<Array<T>>((acc, item) => {
314
+ if (typeof item === "function") {
315
+ acc.push(item);
316
+ } else if (Array.isArray(item)) {
317
+ return acc.concat(item);
318
+ }
319
+ return acc;
320
+ }, []);
321
+
322
+ const defaultQuerySerializer = createQuerySerializer({
323
+ allowReserved: false,
324
+ array: {
325
+ explode: true,
326
+ style: "form",
327
+ },
328
+ object: {
329
+ explode: true,
330
+ style: "deepObject",
331
+ },
332
+ });
333
+
334
+ const defaultHeaders = {
335
+ "Content-Type": "application/json",
336
+ };
337
+
338
+ export const createConfig = <T extends ClientOptions = ClientOptions>(
339
+ override: Config<Omit<ClientOptions, keyof T> & T> = {},
340
+ ): Config<Omit<ClientOptions, keyof T> & T> => ({
341
+ ...jsonBodySerializer,
342
+ headers: defaultHeaders,
343
+ querySerializer: defaultQuerySerializer,
344
+ ...override,
345
+ });
346
+
347
+ type UnwrapRefs<T> =
348
+ T extends Ref<infer V>
349
+ ? V
350
+ : T extends ComputedRef<infer V>
351
+ ? V
352
+ : T extends Record<string, unknown> // this doesn't handle functions well
353
+ ? { [K in keyof T]: UnwrapRefs<T[K]> }
354
+ : T;
355
+
356
+ export const unwrapRefs = <T>(value: T): UnwrapRefs<T> => {
357
+ if (value === null || typeof value !== "object" || value instanceof Headers) {
358
+ return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>;
359
+ }
360
+
361
+ if (
362
+ value instanceof Blob ||
363
+ value instanceof FormData ||
364
+ value instanceof ReadableStream ||
365
+ value instanceof AbortSignal
366
+ ) {
367
+ return value as UnwrapRefs<T>;
368
+ }
369
+
370
+ if (Array.isArray(value)) {
371
+ return value.map((item) => unwrapRefs(item)) as UnwrapRefs<T>;
372
+ }
373
+
374
+ if (isRef(value)) {
375
+ return unwrapRefs(unref(value) as T);
376
+ }
377
+
378
+ // unwrap into new object to avoid modifying the source
379
+ const result: Record<string, unknown> = {};
380
+ for (const key in value) {
381
+ result[key] = unwrapRefs(value[key] as T);
382
+ }
383
+ return result as UnwrapRefs<T>;
384
+ };
385
+
386
+ export const serializeBody = (
387
+ opts: Pick<Parameters<Client["request"]>[0], "body" | "bodySerializer">,
388
+ ) => {
389
+ if (opts.body && opts.bodySerializer) {
390
+ return opts.bodySerializer(opts.body);
391
+ }
392
+ return opts.body;
393
+ };
394
+
395
+ export const executeFetchFn = (
396
+ opts: Omit<Parameters<Client["request"]>[0], "composable">,
397
+ fetchFn: Required<Config>["$fetch"],
398
+ ) => {
399
+ const unwrappedOpts = unwrapRefs(opts);
400
+ unwrappedOpts.rawBody = unwrappedOpts.body;
401
+ unwrappedOpts.body = serializeBody(unwrappedOpts);
402
+ return fetchFn(
403
+ buildUrl(opts),
404
+ // @ts-expect-error
405
+ unwrappedOpts,
406
+ );
407
+ };
@@ -0,0 +1,25 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import {
4
+ type ClientOptions,
5
+ type Config,
6
+ createClient,
7
+ createConfig,
8
+ } from "./client";
9
+ import type { ClientOptions as ClientOptions2 } from "./types.gen";
10
+
11
+ /**
12
+ * The `createClientConfig()` function will be called on client initialization
13
+ * and the returned object will become the client's initial configuration.
14
+ *
15
+ * You may want to initialize your client this way instead of calling
16
+ * `setConfig()`. This is useful for example if you're using Next.js
17
+ * to ensure your client always has the correct values.
18
+ */
19
+ export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (
20
+ override?: Config<ClientOptions & T>,
21
+ ) => Config<Required<ClientOptions> & T>;
22
+
23
+ export const client = createClient(
24
+ createConfig<ClientOptions2>({ baseURL: "/api/v1" }),
25
+ );
@@ -0,0 +1,42 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ export type AuthToken = string | undefined;
4
+
5
+ export interface Auth {
6
+ /**
7
+ * Which part of the request do we use to send the auth?
8
+ *
9
+ * @default 'header'
10
+ */
11
+ in?: "header" | "query" | "cookie";
12
+ /**
13
+ * Header or query parameter name.
14
+ *
15
+ * @default 'Authorization'
16
+ */
17
+ name?: string;
18
+ scheme?: "basic" | "bearer";
19
+ type: "apiKey" | "http";
20
+ }
21
+
22
+ export const getAuthToken = async (
23
+ auth: Auth,
24
+ callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,
25
+ ): Promise<string | undefined> => {
26
+ const token =
27
+ typeof callback === "function" ? await callback(auth) : callback;
28
+
29
+ if (!token) {
30
+ return;
31
+ }
32
+
33
+ if (auth.scheme === "bearer") {
34
+ return `Bearer ${token}`;
35
+ }
36
+
37
+ if (auth.scheme === "basic") {
38
+ return `Basic ${btoa(token)}`;
39
+ }
40
+
41
+ return token;
42
+ };