@onvo-ai/js
Version:
The javascript SDK for Onvo AI dashboard builder
1 lines • 56.1 kB
JavaScript
import{OpenAPIRegistry as de,extendZodWithOpenApi as le}from"@asteasolutions/zod-to-openapi";import{z as e}from"zod";le(e);var r=new de;var ee=r.register("MetadataItem",e.object({label:e.string().openapi({description:"The label for the metadata item.",example:"User ID"}),value:e.string().openapi({description:"The value of the metadata item.",example:"usr_12345"}),secure:e.boolean().optional().openapi({description:"Indicates if the metadata value should be treated as secure.",example:!1})}).openapi({description:"A metadata item."}));import{OpenApiGeneratorV3 as ue,extendZodWithOpenApi as me}from"@asteasolutions/zod-to-openapi";var Ee={public:{Enums:{"Datasource method":["table","query","ai"],"LLM hosting type":["default","custom","openai","anthropic","groq","ollama","gemini","openrouter","ai-gateway"],"Vote type":["up","down"]}}};var te=(o=>(o.Countries="countries",o.Invites="invites",o.ItineraryInvites="itinerary_invites",o.Itineraries="itineraries",o.Members="members",o.Teams="teams",o.Travelers="travelers",o.Accounts="accounts",o.DataSources="datasources",o.EmbedUsers="embed_users",o.APIKeys="api_keys",o.Widgets="widgets",o.Dashboards="dashboards",o.DashboardDatasources="dashboard_datasources",o.Sessions="sessions",o.Questions="questions",o.Integrations="integrations",o.IntegrationTables="integration_tables",o.DecryptedIntegrations="decrypted_integrations",o.DecryptedSessions="decrypted_sessions",o.DecryptedWidgets="decrypted_widgets",o.DecryptedDatasources="decrypted_datasources",o.Subscriptions="subscriptions",o.SubscriptionPlans="subscription_plans",o.Automations="automations",o.AutomationRuns="automation_runs",o.Logs="logs",o.Messages="messages",o.WidgetSuggestions="widget_suggestions",o.LLMSettings="llm_settings",o.SelfHostingSettings="self_hosting_settings",o))(te||{});var Ce=!0;var Ue=r.register("Account",e.object({id:e.string().uuid().openapi({description:"The unique identifier for the account.",example:"5899f99d-a449-4bfa-8769-19c097aaf1f5"}),full_name:e.string().nullable().optional().openapi({description:"The full name of the account holder.",example:"Demo User"}),email:e.string().email().nullable().optional().openapi({description:"The email address associated with the account.",example:"info@onvo.ai"}),avatar_url:e.string().url().nullable().optional().openapi({description:"The URL of the account's avatar image.",example:"https://upload.wikimedia.org/wikipedia/commons/8/89/Portrait_Placeholder.png"}),phone_number:e.string().nullable().optional().openapi({description:"The phone number associated with the account.",example:"1234567890"}),updated_at:e.string().datetime().nullable().optional().openapi({description:"The date and time when the account was last updated.",readOnly:!0,example:"2024-01-17T10:14:12.62603+00:00"})}).openapi({description:"An account that represents a user or organization."}));import{z as s}from"zod";import{extendZodWithOpenApi as pe}from"@asteasolutions/zod-to-openapi";pe(s);var Le=r.register("DashboardSyncSettings",s.object({metadata:s.object({all:s.boolean().openapi({description:"Whether all metadata are included.",example:!1}),include:s.array(s.string()).openapi({description:"List of metadata fields to include.",example:["title","description"]})}).openapi({description:"Metadata sync settings."}),settings:s.object({all:s.boolean().openapi({description:"Whether all settings are included.",example:!1}),include:s.array(s.string()).openapi({description:"List of settings fields to include.",example:["theme","timezone"]})}).openapi({description:"Settings sync settings."}),tabs:s.object({all:s.boolean().openapi({description:"Whether all tabs are included.",example:!1}),include:s.array(s.string()).openapi({description:"List of tab ids to include.",example:["tab1","tab2"]})}).openapi({description:"Tabs sync settings."}),datasources:s.object({all:s.boolean().openapi({description:"Whether all datasources are included.",example:!1}),include:s.array(s.string()).openapi({description:"List of datasource ids to include.",example:["ds1","ds2"]})}).openapi({description:"Datasources sync settings."}),widgets:s.object({all:s.boolean().openapi({description:"Whether all widgets are included.",example:!1}),include:s.array(s.string()).openapi({description:"List of tab ids to include.",example:["tab1","tab2"]})}).openapi({description:"Widgets sync settings."})}).openapi({description:"Dashboard sync settings."})),Ze={metadata:{all:!0,include:[]},settings:{all:!0,include:[]},tabs:{all:!0,include:[]},datasources:{all:!0,include:[]},widgets:{all:!0,include:[]}},qe=r.register("DashboardSettings",s.object({filters:s.boolean().openapi({description:"Whether filters are enabled for the dashboard.",example:!0}),theme:s.enum(["dark","light","auto"]).openapi({description:"Color theme for the dashboard.",example:"auto"}),font:s.string().openapi({description:"Font used in the dashboard.",example:"Inter"}),dark_background:s.string().openapi({description:"Background color for dark theme.",example:"#18181b"}),dark_foreground:s.string().openapi({description:"Foreground color for dark theme.",example:"#23232a"}),dark_text:s.string().openapi({description:"Text color for dark theme.",example:"#fff"}),light_background:s.string().openapi({description:"Background color for light theme.",example:"#fff"}),light_foreground:s.string().openapi({description:"Foreground color for light theme.",example:"#f4f4f5"}),light_text:s.string().openapi({description:"Text color for light theme.",example:"#18181b"}),hide_header:s.boolean().openapi({description:"Whether to hide the dashboard header.",example:!1}),grid_spacing:s.number().int().openapi({description:"Spacing between grid items.",example:16}),grid_height:s.number().int().openapi({description:"Height of the dashboard grid.",example:8}),border_radius:s.number().openapi({description:"Border radius for dashboard elements.",example:8}),custom_css:s.string().openapi({description:"Custom CSS for the dashboard.",example:""}),copilot_title:s.string().openapi({description:"Title for the dashboard copilot.",example:"AI Copilot"}),copilot_description:s.string().openapi({description:"Description for the dashboard copilot.",example:"Ask questions about your data."}),help_url:s.string().url().optional().openapi({description:"URL for dashboard help.",example:"https://docs.onvo.ai"}),enable_advanced_widget_creator:s.boolean().optional().openapi({description:"Enables advanced widget creator.",example:!0}),enable_widget_insights:s.boolean().optional().openapi({description:"Enables widget insights.",example:!1}),can_ask_questions:s.boolean().openapi({description:"Whether users can ask questions.",example:!0}),can_edit_widgets:s.boolean().openapi({description:"Whether users can edit widgets.",example:!0}),can_edit_widget_layout:s.boolean().openapi({description:"Whether users can edit widget layout.",example:!0}),can_create_widgets:s.boolean().openapi({description:"Whether users can create widgets.",example:!0}),can_delete_widgets:s.boolean().openapi({description:"Whether users can delete widgets.",example:!1}),can_schedule_reports:s.boolean().optional().openapi({description:"Whether users can schedule reports.",example:!1}),disable_download_images:s.boolean().openapi({description:"Disable image downloads.",example:!1}),disable_download_reports:s.boolean().openapi({description:"Disable report downloads.",example:!1}),disable_download_documents:s.boolean().openapi({description:"Disable document downloads.",example:!1}),pdf_orientation:s.enum(["portrait","landscape"]).optional().openapi({description:"PDF orientation for downloads.",example:"portrait"})}).openapi({description:"Settings for a dashboard."})),ze=r.register("DashboardFilter",s.discriminatedUnion("type",[s.object({label:s.string().openapi({description:"Filter label.",example:"Status"}),type:s.literal("text").openapi({description:"Text filter type."}),options:s.array(s.string()).openapi({description:"Available string options.",example:["Active","Inactive"]}),values:s.array(s.string()).openapi({description:"Selected string values.",example:["Active"]})}),s.object({label:s.string().openapi({description:"Filter label.",example:"Range"}),type:s.literal("number").openapi({description:"Number filter type."}),options:s.tuple([s.number(),s.number()]).openapi({description:"Available number range.",example:[0,100]}),values:s.tuple([s.number(),s.number()]).openapi({description:"Selected number range.",example:[10,90]})}),s.object({label:s.string().openapi({description:"Filter label.",example:"Date Range"}),type:s.literal("date").openapi({description:"Date filter type."}),options:s.tuple([s.string(),s.string()]).openapi({description:"Available date range.",example:["2023-01-01","2023-12-31"]}),values:s.tuple([s.string(),s.string()]).openapi({description:"Selected date range.",example:["2023-02-01","2023-02-28"]}),max_days:s.number().optional().openapi({description:"Max selectable days.",example:30})})]).openapi({description:"A filter for a dashboard."})),Fe=r.register("DashboardTab",s.object({id:s.number().int().openapi({description:"Tab ID.",example:1}),label:s.string().openapi({description:"Tab label.",example:"Overview"}),hidden:s.boolean().optional().openapi({description:"Whether the tab is hidden.",example:!1})}).openapi({description:"A tab in a dashboard."})),Ke=r.register("DashboardMeta",s.object({created_by:s.string().openapi({description:"ID of the account that created the dashboard.",example:"user_abc123"}),last_updated_by:s.string().optional().openapi({description:"ID of the account that last updated the dashboard.",example:"user_xyz789"}),widgets:s.number().openapi({description:"Number of widgets in the dashboard.",example:5}),datasources:s.number().openapi({description:"Number of datasources in the dashboard.",example:2})}).openapi({description:"Metadata associated with a dashboard."})),$e=r.register("Dashboard",s.object({id:s.string().uuid().openapi({description:"Unique dashboard ID.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),created_at:s.string().openapi({description:"Creation timestamp.",example:"2024-01-17T10:14:12.62603+00:00"}),created_by:s.string().uuid().nullable().openapi({description:"ID of the account that created the dashboard.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"}),description:s.string().nullable().openapi({description:"Dashboard description.",example:"A dashboard for sales analytics."}),filters:s.any().openapi({description:"Dashboard filters (arbitrary object)."}),last_updated_at:s.string().openapi({description:"Last update timestamp.",example:"2024-02-01T08:00:00.000Z"}),last_updated_by:s.string().uuid().nullable().openapi({description:"ID of the account that last updated the dashboard.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"}),metadata:s.any().openapi({description:"Dashboard metadata (arbitrary object)."}),parent_dashboard:s.string().uuid().nullable().optional().openapi({description:"Parent dashboard ID, if this dashboard is nested.",example:null}),root_dashboard:s.string().uuid().nullable().optional().openapi({description:"Root dashboard ID, if this dashboard is nested.",example:null}),settings:s.any().openapi({description:"Dashboard settings (arbitrary object)."}),tabs:s.any().openapi({description:"Dashboard tabs (arbitrary object)."}),team:s.string().uuid().openapi({description:"Team ID associated with the dashboard.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"}),thumbnail:s.string().nullable().openapi({description:"URL to the dashboard's thumbnail image.",example:"https://example.com/thumbnail.png"}),title:s.string().openapi({description:"Dashboard title.",example:"Sales Dashboard"}),sync_settings:s.any().openapi({description:"Dashboard sync settings (arbitrary object)."})}).openapi({description:"A dashboard that displays data in a visual format."}));var ce=r.register("AutomationCondition",e.object({operand_id:e.string().openapi({description:"The ID of the operand (e.g., a widget or datasource field) to check."}),reference_type:e.enum(["static","dynamic"]).openapi({description:"Whether the reference value is static or dynamic (coming from another field)."}),reference_id:e.string().nullable().optional().openapi({description:"The ID of the dynamic reference field (required if reference_type is 'dynamic')."}),reference_value:e.string().nullable().optional().openapi({description:"The static reference value (required if reference_type is 'static')."}),operator:e.string().openapi({description:"The comparison operator (e.g., '=', '!=', '>', '<')."})}).openapi({description:"An automation condition that must be met for the automation to run."})),Ve=r.register("Automation",e.object({id:e.string().uuid().openapi({description:"The unique identifier for the automation.",example:"09110e5b-ae18-4d19-82ca-6d90f5a33bfd"}),title:e.string().openapi({description:"The title of the automation.",example:"Daily Sales Report Automation"}),description:e.string().nullable().optional().openapi({description:"A description for the automation.",example:"Sends the daily sales report every morning."}),dashboard:e.string().uuid().openapi({description:"The ID of the dashboard associated with the automation.",example:"0f6ec2a8-b4d9-4cba-898d-df126e4b5051"}),team:e.string().uuid().openapi({description:"The ID of the team the automation belongs to."}),enabled:e.boolean().default(!0).openapi({description:"Whether the automation is currently active."}),schedule:e.string().openapi({description:"The cron schedule for the automation.",example:"0 9 * * 1-5"}),timezone:e.string().default("UTC").openapi({description:"The timezone for the schedule.",example:"America/New_York"}),method:e.string().openapi({description:"The delivery method (e.g., 'email', 'webhook').",example:"email"}),output_format:e.string().openapi({description:"The output format for reports (e.g., 'pdf', 'csv').",example:"pdf"}),email_to:e.string().email().nullable().optional().openapi({description:"Primary recipient email address (for method 'email').",example:"recipient@example.com"}),email_cc:e.array(e.string().email()).nullable().optional().openapi({description:"CC recipient email addresses (for method 'email')."}),email_subject:e.string().openapi({description:"Email subject line (for method 'email').",example:"Daily Sales Report"}),email_body:e.string().openapi({description:"Email body content (for method 'email').",example:"Please find attached the daily sales report."}),webhook_url:e.string().url().nullable().optional().openapi({description:"The URL for the webhook (for method 'webhook')."}),condition_operator:e.enum(["AND","OR"]).nullable().optional().openapi({description:"Logical operator to combine conditions ('AND' or 'OR')."}),conditions:e.array(ce).openapi({description:"An array of conditions that must be met for the automation to run."}),created_at:e.string().datetime().openapi({description:"The date and time when the automation was created.",readOnly:!0,example:"2025-04-01T12:34:56.789Z"}),last_updated_at:e.string().datetime().openapi({description:"The date and time when the automation was last updated.",readOnly:!0,example:"2025-04-02T09:00:00.000Z"}),last_run_at:e.string().datetime().nullable().optional().openapi({description:"The date and time when the automation last ran.",readOnly:!0}),next_run_at:e.string().datetime().nullable().optional().openapi({description:"The date and time when the automation is scheduled to run next.",readOnly:!0})}).openapi({description:"An automation that runs at a scheduled time."})),Xe=r.register("AutomationRun",e.object({automation:e.string().uuid().openapi({description:"The ID of the associated automation.",example:"a1b2c3d4-e5f6-7890-1234-567890abcdef"}),conditions_passed:e.boolean().nullable().openapi({description:"Whether the automation conditions passed for this run.",example:!0}),error:e.string().nullable().openapi({description:"Any error message if the run failed.",example:"Webhook failed to send."}),id:e.string().uuid().openapi({description:"The unique identifier for the automation run.",example:"b2c3d4e5-f6a7-8901-2345-67890abcdef0"}),method:e.string().openapi({description:"The method used for the automation action (e.g., email, webhook).",example:"email"}),recipient_emails:e.array(e.string().email()).nullable().openapi({description:"List of recipient emails if the method was email.",example:["test@example.com","another@example.com"]}),run_at:e.string().datetime().openapi({description:"Timestamp of when the automation ran.",example:"2024-05-01T16:57:49.123Z"}),status:e.string().openapi({description:"The status of the automation run (e.g., success, failure).",example:"success"}),team:e.string().uuid().openapi({description:"The ID of the team associated with this run.",example:"c3d4e5f6-a7b8-9012-3456-7890abcdef01"}),webhook_sent:e.boolean().nullable().openapi({description:"Whether the webhook was successfully sent if the method was webhook.",example:null})}).openapi({description:"An automation run that has occurred."}));me(e);var ge=(c=>(c.ViewDashboard="view-dashboard",c.EditDashboard="edit-dashboard",c.CreateWidget="create-widget",c.DeleteWidget="delete-widget",c.EditWidget="edit-widget",c))(ge||{}),it=r.register("Message",e.object({id:e.string().uuid().openapi({description:"Message ID.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),content:e.string().optional().openapi({description:"Message content.",example:"Hello!"}),created_at:e.string().openapi({description:"Timestamp when the message was created.",example:"2024-05-01T16:58:00.000Z"}),dashboard:e.string().uuid().nullable().openapi({description:"Dashboard ID associated with the message, if any.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),question:e.string().uuid().openapi({description:"Question ID associated with the message.",example:"question_123"}),role:e.enum(["user","assistant","tool"]).nullable().openapi({description:"Role of the message sender.",example:"user"}),team:e.string().uuid().openapi({description:"Team ID associated with the message.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"}),tool_call_id:e.string().uuid().nullable().openapi({description:"Tool call ID associated with the message, if any.",example:"toolcall_123"}),tool_calls:e.array(e.any()).nullable().openapi({description:"Tool calls associated with the message.",example:[]}),vote:e.enum(["up","down"]).nullable().openapi({description:"Vote associated with the message.",example:"up"}),vote_reason:e.string().nullable().openapi({description:"Vote reason associated with the message.",example:"I like it!"})}).openapi({description:"A message in a conversation."})),rt=r.register("Invite",e.object({created_at:e.string().openapi({description:"Timestamp when the invite was created.",example:"2024-05-01T16:58:00.000Z"}),email:e.string().email().openapi({description:"The email address the invite was sent to.",example:"invitee@example.com"}),name:e.string().openapi({description:"The name of the invitee.",example:"Jane Doe"}),team:e.string().uuid().openapi({description:"The ID of the team the invite is for.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"})}).openapi({description:"An invite to join a team."})),ot=r.register("Member",e.object({account:e.string().uuid().openapi({description:"The ID of the account that is a member.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),team:e.string().uuid().openapi({description:"The ID of the team the member belongs to.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"})}).openapi({description:"A member of a team."})),dt=r.register("Team",e.object({created_at:e.string().nullable().openapi({description:"Timestamp when the team was created.",example:"2024-05-01T16:58:00.000Z"}),email:e.string().email().nullable().openapi({description:"The team's contact email address.",example:"team@example.com"}),id:e.string().uuid().openapi({description:"Team ID.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"}),logo:e.string().nullable().openapi({description:"URL to the team's logo.",example:"https://example.com/logo.png"}),name:e.string().nullable().openapi({description:"The team's name.",example:"Acme Corp"}),phone_number:e.string().nullable().openapi({description:"The team's contact phone number.",example:"+1234567890"}),stripe_id:e.string().nullable().openapi({description:"Stripe customer ID for the team.",example:"cus_abc123"})}).openapi({description:"A team that represents a group of users."})),lt=r.register("DataSource",e.object({columns:e.array(e.object({title:e.string().openapi({description:"Column title.",example:"Name"}),description:e.string().openapi({description:"Column description.",example:"The name of the entity."}),type:e.string().optional().openapi({description:"Column type.",example:"text"}),hidden:e.boolean().optional().openapi({description:"Column hidden.",example:!1})})).openapi({description:"Datasource columns."}),config:e.any().openapi({description:"Datasource config (arbitrary object)."}),created_at:e.string().openapi({description:"Timestamp when the datasource was created.",example:"2024-05-01T16:58:00.000Z"}),created_by:e.string().uuid().nullable().openapi({description:"ID of the account that created the datasource.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),description:e.string().nullable().openapi({description:"Description of the datasource.",example:"This datasource contains sales data."}),filters:e.array(e.object({column:e.string().openapi({description:"Filter column.",example:"age"}),type:e.enum(["text","number","date"]).openapi({description:"Filter type.",example:"number"}),label:e.string().openapi({description:"Filter label.",example:"Age"}),max_days:e.number().optional().openapi({description:"Max selectable days.",example:30})})).openapi({description:"Datasource filters."}),id:e.string().uuid().openapi({description:"Datasource ID.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),integration:e.string().uuid().nullable().openapi({description:"Integration ID associated with the datasource, if any.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),last_updated_at:e.string().openapi({description:"Timestamp when the datasource was last updated.",example:"2024-05-02T10:00:00.000Z"}),last_updated_by:e.string().uuid().nullable().openapi({description:"ID of the account that last updated the datasource.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),metadata:e.array(ee).openapi({description:"Datasource metadata."}),parameters:e.array(e.object({id:e.string().openapi({description:"Parameter ID.",example:"param1"}),wrap:e.string().optional().openapi({description:"Wrap option for parameter.",example:"quotes"}),default:e.string().openapi({description:"Default value for parameter.",example:"default_value"})})).openapi({description:"Datasource parameters."}),size:e.number().openapi({description:"Size of the datasource.",example:1e3}),source:e.string().openapi({description:"Source of the datasource.",example:"csv"}),team:e.string().uuid().openapi({description:"Team ID that owns the datasource.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"}),title:e.string().openapi({description:"Title of the datasource.",example:"Sales Data"})}).openapi({description:"A datasource that provides data for visualizations."})),pt=r.register("EmbedUser",e.object({created_at:e.string().openapi({description:"Timestamp when the embed user was created.",example:"2024-05-01T16:58:00.000Z"}),email:e.string().email().nullable().openapi({description:"Email address of the embed user.",example:"embeduser@example.com"}),id:e.string().uuid().openapi({description:"Embed user ID.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),last_updated_at:e.string().openapi({description:"Timestamp when the embed user was last updated.",example:"2024-05-02T10:00:00.000Z"}),name:e.string().openapi({description:"Name of the embed user.",example:"John Doe"}),parameters:e.any().nullable().openapi({description:"Parameters for the embed user (arbitrary object)."}),team:e.string().uuid().openapi({description:"Team ID that the embed user belongs to.",example:"team_123"})}).openapi({description:"An embed user."})),ct=r.register("Subscription",e.object({amount:e.number().openapi({description:"Subscription amount.",example:1999}),created_at:e.string().openapi({description:"Timestamp when the subscription was created.",example:"2024-05-01T16:58:00.000Z"}),currency:e.string().openapi({description:"Currency of the subscription.",example:"USD"}),integrations:e.array(e.string()).openapi({description:"Integrations included in the subscription.",example:["slack","github"]}),interval:e.string().openapi({description:"Billing interval.",example:"month"}),period_end:e.string().openapi({description:"End of the current billing period.",example:"2024-06-01T16:58:00.000Z"}),period_start:e.string().openapi({description:"Start of the current billing period.",example:"2024-05-01T16:58:00.000Z"}),product_name:e.string().openapi({description:"Product name of the subscription.",example:"Pro Plan"}),stripe_customer_id:e.string().openapi({description:"Stripe customer ID.",example:"cus_abc123"}),stripe_product_id:e.string().openapi({description:"Stripe product ID.",example:"prod_abc123"}),stripe_subscription_id:e.string().openapi({description:"Stripe subscription ID.",example:"sub_abc123"}),team:e.string().uuid().openapi({description:"Team ID associated with the subscription.",example:"team_123"})})),ut=r.register("SubscriptionPlan",e.object({accounts:e.number().nullable().openapi({description:"Number of accounts allowed in the plan.",example:10}),automations:e.boolean().openapi({description:"Whether automations are enabled in the plan.",example:!0}),connected_datasources:e.number().openapi({description:"Number of connected datasources allowed.",example:5}),copilot:e.boolean().openapi({description:"Whether copilot is enabled in the plan.",example:!0}),custom_llm:e.boolean().openapi({description:"Whether custom LLM is enabled in the plan.",example:!1}),embed_users:e.number().openapi({description:"Number of embed users allowed.",example:100}),name:e.string().openapi({description:"Name of the subscription plan.",example:"Pro"}),premium_integrations:e.number().openapi({description:"Number of premium integrations allowed.",example:2})}).openapi({description:"A subscription plan."})),mt=r.register("APIKey",e.object({created_at:e.string().openapi({description:"Timestamp when the API key was created.",example:"2024-05-01T16:58:00.000Z"}),description:e.string().nullable().openapi({description:"Description of the API key.",example:"Key for production environment"}),id:e.string().uuid().openapi({description:"API Key ID.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),key:e.string().openapi({description:"The API key string.",example:"ey.1234567890"}),last_used_at:e.string().nullable().openapi({description:"Timestamp when the API key was last used.",example:"2024-05-02T12:00:00.000Z"}),team:e.string().uuid().openapi({description:"Team ID associated with the API key.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"})}).openapi({description:"An API key."})),gt=r.register("Widget",e.object({settings:e.object({css_id:e.string().optional().openapi({description:"Widget CSS ID.",example:"widget-123"}),css_classnames:e.string().optional().openapi({description:"Widget CSS class names.",example:"widget-class"})}).optional().openapi({description:"Widget settings."}),messages:e.array(e.object({role:e.enum(["user","assistant"]).openapi({description:"Widget message role.",example:"user"}),content:e.string().openapi({description:"Widget message content.",example:"Hello from widget!"})})).openapi({description:"Widget messages."}),layouts:e.object({lg:e.object({x:e.number().openapi({description:"X position.",example:0}),y:e.number().openapi({description:"Y position.",example:0}),w:e.number().openapi({description:"Width.",example:4}),h:e.number().openapi({description:"Height.",example:3})}),sm:e.object({x:e.number().openapi({description:"X position (sm).",example:0}),y:e.number().openapi({description:"Y position (sm).",example:0}),w:e.number().openapi({description:"Width (sm).",example:2}),h:e.number().openapi({description:"Height (sm).",example:2})}).optional()}).openapi({description:"Widget layouts."}),drilldown_widget:e.string().uuid().nullable().openapi({description:"Drilldown widget ID associated with the widget, if any.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"})}).openapi({description:"A widget."})),ht=r.register("WidgetSuggestions",e.object({id:e.string().uuid().openapi({description:"Widget suggestion ID.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),dashboard:e.string().uuid().openapi({description:"Dashboard ID associated with the suggestion.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),team:e.string().uuid().openapi({description:"Team ID associated with the suggestion.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"}),created_at:e.string().openapi({description:"Timestamp when the suggestion was created.",example:"2024-05-01T16:58:00.000Z"}),widget:e.string().uuid().openapi({description:"Widget ID associated with the suggestion.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"}),title:e.string().openapi({description:"Title of the widget suggestion.",example:"Widget Suggestion"}),description:e.string().openapi({description:"Description of the widget suggestion.",example:"This is a widget suggestion."})}).openapi({description:"A widget suggestion."})),bt=r.register("DashboardDatasource",e.object({dashboard:e.string().uuid().openapi({description:"Dashboard ID associated with the datasource.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),datasource:e.string().uuid().openapi({description:"Datasource ID associated with the dashboard.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),team:e.string().uuid().openapi({description:"Team ID associated with the dashboard datasource.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"})}).openapi({description:"A dashboard datasource."})),ft=r.register("Session",e.object({created_at:e.string().openapi({description:"Timestamp when the session was created.",example:"2024-05-01T16:58:00.000Z"}),dashboard:e.string().uuid().openapi({description:"Dashboard ID associated with the session.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),embed_user:e.string().uuid().openapi({description:"Embed user ID associated with the session.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),parameters:e.any().openapi({description:"Session parameters (arbitrary object)."}),team:e.string().uuid().openapi({description:"Team ID associated with the session.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"})}).openapi({description:"A user session."})),_t=r.register("Question",e.object({created_at:e.string().openapi({description:"Timestamp when the question was created.",example:"2024-05-01T16:58:00.000Z"}),dashboard:e.string().uuid().openapi({description:"Dashboard ID associated with the question.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),id:e.string().uuid().openapi({description:"Question ID.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"}),messages:e.any().openapi({description:"Messages associated with the question (arbitrary object)."}),query:e.string().openapi({description:"Query text of the question.",example:"What were last month's sales?"}),team:e.string().uuid().nullable().openapi({description:"Team ID associated with the question, if any.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"})}).openapi({description:"A question asked in the dashboard."})),yt=r.register("Integration",e.object({config:e.any().openapi({description:"Integration config (arbitrary object)."}),created_at:e.string().openapi({description:"Timestamp when the integration was created.",example:"2024-05-01T16:58:00.000Z"}),id:e.string().uuid().openapi({description:"Integration ID.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),provider:e.string().openapi({description:"Integration provider.",example:"slack"}),status:e.string().openapi({description:"Integration status.",example:"active"}),team:e.string().uuid().openapi({description:"Team ID associated with the integration.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"}),title:e.string().nullable().openapi({description:"Title of the integration.",example:"Slack Integration"}),parameters:e.array(e.object({id:e.string().openapi({description:"Parameter ID.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),wrap:e.string().optional().openapi({description:"Parameter wrap.",example:"slack"}),default:e.string().openapi({description:"Parameter default.",example:"active"})})).openapi({description:"Integration parameters."})}).openapi({description:"An integration with an external service."})),xt=r.register("IntegrationTable",e.object({id:e.string().uuid().openapi({description:"Integration ID.",example:"9b7deda3-7e2d-458e-84e9-632e47fbe682"}),columns:e.array(e.object({name:e.string().openapi({description:"Field name.",example:"name"}),type:e.string().openapi({description:"Field type.",example:"text"}),description:e.string().openapi({description:"Field description.",example:"The name of the entity."}),hidden:e.boolean().optional().openapi({description:"Field hidden.",example:!1})})).openapi({description:"Integration fields."}),rows:e.number().openapi({description:"Number of rows in the integration table.",example:100}),errors:e.string().nullable().openapi({description:"Any errors in the integration table.",example:""}),team:e.string().uuid().openapi({description:"Team ID associated with the integration table.",example:"92c680a3-a9c4-4c02-bb2d-a5d049789662"}),title:e.string().nullable().openapi({description:"Title of the integration table.",example:"Slack Integration Table"}),description:e.string().nullable().openapi({description:"Description of the integration table.",example:"This integration table is used to connect to Slack."})}).openapi({description:"A table under an integration."})),ae=e.enum(["default","custom"]).openapi({description:"Specifies if the LLM is hosted by Onvo or self-hosted."}),wt=r.register("LLMSettings",e.object({analyst_agent_type:ae,programmer_agent_type:ae,analyst_agent_api_url:e.string().url().nullable().openapi({description:"URL for self-hosted API.",example:"http://localhost:11434"}),analyst_agent_api_key:e.string().nullable().openapi({description:"API key for custom models (write-only).",example:"sk-...",format:"password"}),programmer_agent_api_url:e.string().url().nullable().openapi({description:"URL for self-hosted API.",example:"http://localhost:11434"}),programmer_agent_api_key:e.string().nullable().openapi({description:"API key for custom models (write-only).",example:"sk-...",format:"password"}),programmer_agent_model:e.string().openapi({description:"Model used for the programmer agent.",example:"openai/gpt-3.5-turbo"}),analyst_agent_model:e.string().openapi({description:"Model used for the analyst agent.",example:"openai/gpt-4-turbo"}),programmer_agent_prompt:e.string().nullable().openapi({description:"Custom prompt for the programmer agent.",example:"You are a helpful AI assistant specialized in code generation."}),analyst_agent_prompt:e.string().nullable().openapi({description:"Custom prompt for the analyst agent.",example:"You are a helpful AI assistant specialized in data analysis."}),team:e.string().uuid().openapi({description:"The ID of the team these settings belong to (read-only).",example:"d4e5f6a7-b8c9-0123-4567-890abcdef012",readOnly:!0}),updated:e.boolean().openapi({description:"Indicates if the settings have been updated from defaults (read-only).",example:!0,readOnly:!0})}).openapi({description:"LLM settings"})),Tt=r.register("SelfHostingSettings",e.object({team:e.string().uuid().openapi({description:"The ID of the team these settings belong to (read-only).",example:"d4e5f6a7-b8c9-0123-4567-890abcdef012",readOnly:!0}),data_service_endpoint:e.string().openapi({description:"The endpoint for the data service.",example:"https://data-service.example.com"}),data_service_secret:e.string().openapi({description:"The secret for the data service.",example:"data-service-secret"}),s3_credentials:e.string().openapi({description:"The credentials for the S3 service.",example:"s3-credentials"}),google_sheets_credentials:e.string().openapi({description:"The credentials for the Google service.",example:"google-credentials"}),airtable_credentials:e.string().openapi({description:"The credentials for the Airtable service.",example:"airtable-credentials"})}).openapi({description:"Self-hosting settings"})),Dt=r.register("Log",e.object({account:e.string().uuid().nullable().openapi({description:"ID of the account that generated the log, if applicable.",example:"e5f6a7b8-c9d0-1234-5678-90abcdef0123"}),created_at:e.string().datetime().openapi({description:"Timestamp when the log was created.",example:"2024-05-01T16:58:00.000Z"}),dashboard:e.string().uuid().nullable().openapi({description:"ID of the dashboard related to the log, if applicable.",example:"f6a7b8c9-d0e1-2345-6789-0abcdef01234"}),embed_user:e.string().nullable().openapi({description:"ID of the embed user related to the log, if applicable.",example:"embed-user-xyz789"}),id:e.string().uuid().openapi({description:"The unique identifier for the log entry.",example:"01234567-89ab-cdef-0123-456789abcdef"}),team:e.string().uuid().nullable().openapi({description:"ID of the team associated with the log.",example:"12345678-9abc-def0-1234-56789abcdef0"}),type:e.string().openapi({description:"The type or category of the log event.",example:"widget_interaction"}),widget:e.string().uuid().nullable().openapi({description:"ID of the widget related to the log, if applicable.",example:"23456789-abcd-ef01-2345-6789abcdef01"})}).openapi({description:"A log entry recording an event within the system."})),he=new ue(r.definitions),Ot=he.generateComponents();import{generateCodeVerifier as be,OAuth2Client as fe,OAuth2Fetch as _e}from"@badgateway/oauth2-client";import{nanoid as ye}from"nanoid";var x=class{id="";provider="";teamId;baseUrl="";authorizationEndpoint="";tokenEndpoint="";scopes=[];extraParams={};authenticationMethod;clientId="";clientSecret="";scope="";refreshToken="";oauthClient;fetcher;supabaseClient;constructor(t,a,n,d){this.teamId=t,this.supabaseClient=a,this.id=n||"",d&&(this.clientId=d?.clientId||"",this.clientSecret=d?.clientSecret||""),this.initializeOauthClient()}initializeOauthClient(){this.oauthClient=new fe({clientId:this.clientId,clientSecret:this.clientSecret,authorizationEndpoint:this.authorizationEndpoint,tokenEndpoint:this.tokenEndpoint,server:this.baseUrl,authenticationMethod:this.authenticationMethod||void 0}),this.fetcher=new _e({client:this.oauthClient,getNewToken:async()=>{if(!this.id||this.id==="")return null;let{data:t,error:a}=await this.supabaseClient.from("integrations").select().eq("id",this.id).maybeSingle();if(a||!t||!t.config)return null;let n=t.config;return await this.oauthClient.refreshToken({accessToken:n.access_token,refreshToken:n.refresh_token,expiresAt:new Date(n.access_expires_at).getTime()})},storeToken:async t=>{if(!this.supabaseClient)return null;let{error:a}=await this.supabaseClient.from("integrations").update({provider:this.provider,team:this.teamId,config:{access_token:t.accessToken,refresh_token:t.refreshToken||this.refreshToken,access_expires_at:new Date(t.expiresAt||new Date(2040,1,1).getTime()).toISOString()}}).eq("id",this.id)},getStoredToken:async()=>{if(!this.supabaseClient||!this.id||this.id==="")return null;let{data:t,error:a}=await this.supabaseClient.from("integrations").select().eq("id",this.id).maybeSingle();if(a||!t||!t.config)return null;let n=t.config;return this.refreshToken=n.refresh_token,{accessToken:n.access_token,refreshToken:n.refresh_token,expiresAt:new Date(n.access_expires_at).getTime()}}})}async startAuthFlow(){let t=ye(16),a=await be();return{url:await this.oauthClient.authorizationCode.getAuthorizeUri({redirectUri:`${process.env.NEXT_PUBLIC_DASHBOARD_URL||""}/api/internal/oauth/${this.provider}/redirect`,scope:this.scopes,extraParams:this.extraParams,state:t,codeVerifier:a}),code_verifier:a,state:t}}async completeAuthFlow(t){let a=t.nextUrl.href,n=t.cookies.get("code_verifier")?.value,d=t.nextUrl.searchParams.get("state");if(!a)throw new Error("No code found in URL");if(!this.teamId)throw new Error("Not connected to an team");let c;try{c=await this.oauthClient.authorizationCode.getTokenFromCodeRedirect(a,{redirectUri:`${process.env.NEXT_PUBLIC_DASHBOARD_URL||""}/api/internal/oauth/${this.provider}/redirect`,codeVerifier:n||void 0,state:d||void 0})}catch(g){throw console.log("Failed to get token from code: ",g),new Error("Failed to get token from code: "+g.message)}let{data:u,error:h}=await this.supabaseClient.from("integrations").update({status:"healthy",config:{access_token:c.accessToken,refresh_token:c.refreshToken,access_expires_at:new Date(c.expiresAt).toISOString()}}).eq("id",this.id).select().single();if(this.refreshToken=c.refreshToken,h)throw new Error("Failed to save integration to DB: "+h.message);return{success:!0,...c}}};var S=class extends x{provider="airtable";baseUrl="https://www.airtable.com";clientId=process.env.AIRTABLE_CLIENT_ID||"";clientSecret=process.env.AIRTABLE_CLIENT_SECRET||"";authorizationEndpoint="/oauth2/v1/authorize";tokenEndpoint="/oauth2/v1/token";scopes=["schema.bases:read","data.records:read"];constructor(t,a,n,d){super(t,a,n,d)}async getRecords(t,a){try{let c=[],u;do{let h=0;for(;;)try{let g=new URL(`https://api.airtable.com/v0/${t}/${a}`);u&&g.searchParams.append("offset",u);let m=await(await this.fetcher.fetch(g.toString())).json();if(m?.errors&&m?.errors[0]&&m?.errors[0].error==="RATE_LIMIT_REACHED"){if(h>=5)throw new Error("Rate limit exceeded. Max retries reached.");let w=1e3*Math.pow(2,h);await new Promise(b=>setTimeout(b,w)),h++;continue}c=c.concat(m.records.map(w=>{let b={_id:w.id,...w.fields};return Object.keys(b).forEach(f=>{Array.isArray(b[f])&&(b[f]=b[f].join(","))}),b})),u=m.offset;break}catch(g){throw console.log("AIRTABLE ERROR: ",g),g}}while(u);return c}catch(c){throw new Error(c.message)}}};var v=class extends x{provider="google_sheets";baseUrl="https://accounts.google.com";authorizationEndpoint="/o/oauth2/v2/auth";tokenEndpoint="https://oauth2.googleapis.com/token";clientId=process.env.GOOGLE_CLIENT_ID||"";clientSecret=process.env.GOOGLE_CLIENT_SECRET||"";scopes=["https://www.googleapis.com/auth/spreadsheets.readonly","https://www.googleapis.com/auth/drive.readonly"];extraParams={access_type:"offline",prompt:"consent"};constructor(t,a,n,d){super(t,a,n,d),this.initializeOauthClient()}async getRecords(t,a){let n=`https://docs.google.com/spreadsheets/d/${t}/gviz/tq?tqx=out:csv&sheet=${a}`;return await this.fetcher.fetch(n)}};var Kt={airtable:S,google_sheets:v};import xe from"pusher-js";var i=class{#e;_endpoint;async _fetchBase(t,a,n,d){let c={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,PATCH,OPTIONS"};this.#e&&this.#e.trim()!==""&&(c["x-api-key"]=this.#e),d||(c["Content-Type"]="application/json");let u=await fetch(this._endpoint+t,{method:a||"GET",headers:c,body:d?n:n?JSON.stringify(n):void 0});if(u.ok)return await u.json();{let h=await u.json();throw new Error(h.message)}}async _fetchStreamBase(t,a,n,d){let c={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,PATCH,OPTIONS","Content-Type":"application/json"};this.#e&&this.#e.trim()!==""&&(c["x-api-key"]=this.#e);let u=await fetch(this._endpoint+t,{method:a||"POST",headers:c,body:n?JSON.stringify(n):void 0});if(u.status===202){let g=await u.json().catch(()=>({status:"accepted"})),Q=g?.channel||g?.jobId,m=g?.socket;return!Q||!m?g:await new Promise((w,b)=>{try{let f=m.wsHost.includes("localhost")||m.wsHost.includes("host.docker.internal"),[ne,V]=m.wsHost.split(":"),ie=V?parseInt(V,10):m.wsPort,re={wsHost:ne,wsPort:ie,wssPort:m.wssPort,forceTLS:f?!1:!!m.forceTLS,disableStats:!0,enabledTransports:f?["ws"]:["ws","wss"],cluster:m.cluster||"mt1"},T=new xe(m.key,re),_=T.subscribe(Q),X=!1,O=!1,Y=()=>{if(!X){X=!0;try{_.unbind_all()}catch{}try{T.connection.unbind("error")}catch{}try{T.connection.unbind("state_change")}catch{}try{let l=T?.connection?.state;l&&l!=="disconnected"&&l!=="failed"&&T.disconnect()}catch{}}},D=l=>{if(typeof d=="function")try{d(l)}catch{}},y=null;y=setTimeout(()=>{console.error("[Onvo] WebSocket subscription timed out."),P(new Error("WebSocket subscription timeout"))},1e4);let oe=l=>{if(!O){O=!0;try{w(l.data)}finally{setTimeout(()=>{if(y)try{clearTimeout(y)}catch{}Y()},0)}}},P=l=>{if(!O){O=!0;try{b(l)}finally{setTimeout(()=>{if(y)try{clearTimeout(y)}catch{}Y()},0)}}};_.bind("pusher:subscription_succeeded",()=>{y&&clearTimeout(y),_.bind("job.accepted",l=>D({...l||{},status:"waiting"})),_.bind("job.waiting",l=>D(l)),_.bind("job.progress",l=>D(l)),_.bind("job.error",l=>{D(l),P(new Error(l&&l.data&&l.data.error||"Job failed"))}),_.bind("job.completed",l=>{D({...l||{},status:"completed"}),oe(l)})}),_.bind("pusher:subscription_error",l=>{console.error("[Onvo] Pusher subscription failed with status:",l),P(new Error(`Subscription error: ${l||"unknown"}`))}),T.connection.bind("error",l=>{console.error("[Onvo] Pusher connection error:",l),P(new Error(l?.message||"WebSocket connection error"))})}catch(f){b(f)}})}else if(u.status===200)return(await u.json().catch(()=>({})))?.data;let h=await u.json().catch(()=>({}));if(!u.ok)throw new Error(h&&h.message||"Request failed");return h?.data}async _fetchBlob(t){try{let a={"Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET,PUT,POST,DELETE,PATCH,OPTIONS"};return this.#e&&this.#e.trim()!==""&&(a["x-api-key"]=this.#e),await fetch(this._endpoint+t,{method:"GET",headers:a}).then(d=>d.blob())}catch(a){throw new Error("Error in making the request: "+a.message)}}constructor(t,a){if(t==null)throw new Error("API key is required");this.#e=t,this._endpoint=a?.endpoint||"https://dashboard.onvo.ai"}};var I=class extends i{list(){return this._fetchBase("/api/accounts")}get(t){return this._fetchBase("/api/accounts/"+t)}};var k=class extends i{list(){return this._fetchBase("/api/teams")}get(t){return this._fetchBase("/api/teams/"+t)}update(t,a){return this._fetchBase("/api/teams/"+t,"PUT",a)}async create(t,a){try{let n=await this._fetchBase("/api/teams","POST",a);return await this._fetchBase(`/api/accounts/${t}/update-team`,"POST",{teamId:n.id}),n}catch(n){throw console.error("Error creating team:",n),new Error(n.message||"Failed to create team")}}};var E=class extends i{list(){return this._fetchBase("/api/embed-users")}get(t){return this._fetchBase("/api/embed-users/"+t)}delete(t){return this._fetchBase("/api/embed-users/"+t,"DELETE")}upsert(t,a){return this._fetchBase("/api/embed-users","POST",{id:t,name:a.name,email:a.email||"",parameters:a.parameters})}};var A=class extends i{list(t){return t&&t.integration?this._fetchBase("/api/datasources?integration="+t.integration):t&&t.dashboard?this._fetchBase("/api/datasources?dashboard="+t.dashboard):this._fetchBase("/api/datasources")}get(t){return this._fetchBase("/api/datasources/"+t)}delete(t){return this._fetchBase("/api/datasources/"+t,"DELETE")}update(t,a){return this._fetchBase("/api/datasources/"+t,"PUT",a)}create(t){return this._fetchBase("/api/datasources","POST",t)}};var R=class extends i{list(t){return t?this._fetchBase("/api/automations?dashboard="+t.dashboard):this._fetchBase("/api/automations")}get(t){return this._fetchBase("/api/automations/"+t)}delete(t){return this._fetchBase("/api/automations/"+t,"DELETE")}update(t,a){return this._fetchBase("/api/automations/"+t,"PUT",a)}create(t){return this._fetchBase("/api/automations","POST",t)}};var C=class extends i{list(t){let a="/api/dashboards";if(t){let n=new URLSearchParams;t.parent_dashboard&&n.append("parent_dashboard",t.parent_dashboard),t.root_dashboard&&n.append("root_dashboard",t.root_dashboard);let d=n.toString();d&&(a+="?"+d)}return this._fetchBase(a).catch(n=>{throw n})}get(t){return this._fetchBase("/api/dashboards/"+t).catch(a=>{throw a})}delete(t){return this._fetchBase("/api/dashboards/"+t,"DELETE")}update(t,a){return this._fetchBase("/api/dashboards/"+t,"PUT",a)}create(t){return this._fetchBase("/api/dashboards","POST",t)}};var B=class extends i{#e;constructor(t,a,n){super(a,n),this.#e=t}unlink(t){return this._fetchBase("/api/dashboards/"+this.#e+"/datasources/"+t,"DELETE")}link(t){return this._fetchBase("/api/dashboards/"+this.#e+"/datasources","POST",{datasourceId:t})}linkMultiple(t){return this._fetchBase("/api/dashboards/"+this.#e+"/datasources","POST",{datasourceIds:t})}};var N=class extends i{#e;constructor(t,a,n){super(a,n),this.#e=t}list(){return this._fetchBase("/api/dashboards/"+this.#e+"/widget-suggestions","GET")}delete(t){return this._fetchBase("/api/dashboards/"+this.#e+"/widget-suggestions/"+t,"DELETE")}};var U=class extends i{datasources;widgetSuggestions;#e;constructor(t,a,n){super(a,n),this.#e=t,this.datasources=new B(t,a,n),this.widgetSuggestions=new N(t,a,n)}updateCache(t,a){let n=[];a?.rejectCache&&n.push("rejectCache=true"),a?.rejectFilterCache&&n.push("rejectFilterCache=true");let d="";return n.length>0&&(d="?"+n.join("&")),this._fetchStreamBase(`/api/dashboards/${this.#e}/update-cache${d}`,"POST",void 0,t)}export(t,a="light",n=0,d){return this._fetchStreamBase(`/api/dashboards/${this.#e}/export?theme=${a}&format=${t}&tab=${n}`,"GET",void 0,d)}duplicate(){return this._fetchBase(`/api/dashboards/${this.#e}/duplicate`,"POST")}summarize(t){return this._fetchStreamBase(`/api/dashboards/${this.#e}/summarize`,"POST",{prompt:t})}sync(){return this._fetchBase(`/api/dashboards/${this.#e}/sync`,"POST")}generateWidgetSuggestions(){return this._fetchStreamBase(`/api/dashboards/${this.#e}/generate-suggestions`,"POST")}};var W=class extends i{#e;constructor(t,a,n){super(a,n),this.#e=t}getAccessToken(){return this._fetchBase("/api/embed-users/"+this.#e+"/token")}};var J=class extends i{#e;constructor(t,a,n){super(a,n),this.#e=t}initialize(t){return this._fetchStreamBase("/api/datasources/"+this.#e+"/initialize","GET",void 0,t)}generateQuery(t,a){return this._fetchStreamBase("/api/data