/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$ } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { ConsumerMetadata, ConsumerMetadata$Outbound, ConsumerMetadata$outboundSchema, } from "./consumermetadata.js"; import { UnifiedApiId, UnifiedApiId$outboundSchema } from "./unifiedapiid.js"; export const AllowActions = { Delete: "delete", Disconnect: "disconnect", Reauthorize: "reauthorize", Disable: "disable", } as const; export type AllowActions = OpenEnum; /** * Settings to change the way the Vault is displayed. */ export type Settings = { /** * Provide the IDs of the Unified APIs you want to be visible. Leaving it empty or omitting this field will show all Unified APIs. */ unifiedApis?: Array | undefined; /** * A boolean that controls the display of the configurable resources for an integration. When set to true, the resource configuration options will be hidden and not shown to the user. When set to false, the resource configuration options will be displayed to the user. */ hideResourceSettings?: boolean | undefined; /** * Configure [Vault](/apis/vault/reference#section/Get-Started) to show a banner informing the logged in user is in a test environment. */ sandboxMode?: boolean | undefined; /** * Configure [Vault](/apis/vault/reference#section/Get-Started) to run in isolation mode, meaning it only shows the connection settings and hides the navigation items. */ isolationMode?: boolean | undefined; /** * The duration of time the session is valid for (maximum 1 week). */ sessionLength?: string | undefined; /** * Configure [Vault](/apis/vault/reference#section/Get-Started) to show the logs page. Defaults to `true`. */ showLogs?: boolean | undefined; /** * Configure [Vault](/apis/vault/reference#section/Get-Started) to show the suggestions page. Defaults to `false`. */ showSuggestions?: boolean | undefined; /** * Configure [Vault](/apis/vault/reference#section/Get-Started) to show the sidebar. Defaults to `true`. */ showSidebar?: boolean | undefined; /** * Automatically redirect to redirect uri after the connection has been configured as callable. Defaults to `false`. */ autoRedirect?: boolean | undefined; /** * Hide Apideck connection guides in [Vault](/apis/vault/reference#section/Get-Started). Defaults to `false`. */ hideGuides?: boolean | undefined; /** * Hide actions from your users in [Vault](/apis/vault/reference#section/Get-Started). Actions in `allow_actions` will be shown on a connection in Vault. * * @remarks * Available actions are: `delete`, `disconnect`, `reauthorize` and `disable`. * Empty array will hide all actions. By default all actions are visible. */ allowActions?: Array | undefined; }; /** * Theming options to change the look and feel of Vault. */ export type Theme = { /** * The URL to the favicon to use for Vault. */ favicon?: string | undefined; /** * The URL to the logo to use for Vault. */ logo?: string | undefined; /** * The primary color to use for Vault. */ primaryColor?: string | undefined; /** * The background color to use for the sidebar. */ sidepanelBackgroundColor?: string | undefined; /** * The text color to use for the sidebar. */ sidepanelTextColor?: string | undefined; /** * The name that will be shown in the sidebar. */ vaultName?: string | undefined; /** * The URL to the privacy policy that will be shown in the sidebar. */ privacyUrl?: string | undefined; /** * The URL to the terms and conditions that will be shown in the sidebar. */ termsUrl?: string | undefined; }; export type Session = { /** * The metadata of the consumer. This is used to display the consumer in the sidebar. This is optional, but recommended. */ consumerMetadata?: ConsumerMetadata | undefined; /** * The URL to redirect the user to after the session has been configured. When your application's OAuth protection mode is `enforced`, this value must match one of the application's allowed redirect URLs or redirect URIs (the Hosted Vault callback page is always allowed, and the integration page when its query is empty or a single registered `redirectToAppUrl`); an unregistered value is rejected with a 400 `RequestValidationError` and no session is created. */ redirectUri?: string | undefined; /** * Settings to change the way the Vault is displayed. */ settings?: Settings | undefined; /** * Theming options to change the look and feel of Vault. */ theme?: Theme | undefined; /** * Custom consumer settings that are passed as part of the session. */ customConsumerSettings?: { [k: string]: any } | undefined; }; /** @internal */ export const AllowActions$outboundSchema: z.ZodType< string, z.ZodTypeDef, AllowActions > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(AllowActions)); /** @internal */ export type Settings$Outbound = { unified_apis?: Array | undefined; hide_resource_settings: boolean; sandbox_mode: boolean; isolation_mode: boolean; session_length: string; show_logs: boolean; show_suggestions: boolean; show_sidebar: boolean; auto_redirect: boolean; hide_guides: boolean; allow_actions?: Array | undefined; }; /** @internal */ export const Settings$outboundSchema: z.ZodType< Settings$Outbound, z.ZodTypeDef, Settings > = /* @__PURE__ */ lazySchema$(() => z.object({ unifiedApis: z.array(UnifiedApiId$outboundSchema).optional(), hideResourceSettings: z.boolean().default(false), sandboxMode: z.boolean().default(false), isolationMode: z.boolean().default(false), sessionLength: z.string().default("1h"), showLogs: z.boolean().default(true), showSuggestions: z.boolean().default(false), showSidebar: z.boolean().default(true), autoRedirect: z.boolean().default(false), hideGuides: z.boolean().default(false), allowActions: z.array(AllowActions$outboundSchema).optional(), }).transform((v) => { return remap$(v, { unifiedApis: "unified_apis", hideResourceSettings: "hide_resource_settings", sandboxMode: "sandbox_mode", isolationMode: "isolation_mode", sessionLength: "session_length", showLogs: "show_logs", showSuggestions: "show_suggestions", showSidebar: "show_sidebar", autoRedirect: "auto_redirect", hideGuides: "hide_guides", allowActions: "allow_actions", }); }) ); export function settingsToJSON(settings: Settings): string { return JSON.stringify(Settings$outboundSchema.parse(settings)); } /** @internal */ export type Theme$Outbound = { favicon?: string | undefined; logo?: string | undefined; primary_color?: string | undefined; sidepanel_background_color?: string | undefined; sidepanel_text_color?: string | undefined; vault_name?: string | undefined; privacy_url?: string | undefined; terms_url?: string | undefined; }; /** @internal */ export const Theme$outboundSchema: z.ZodType< Theme$Outbound, z.ZodTypeDef, Theme > = /* @__PURE__ */ lazySchema$(() => z.object({ favicon: z.string().optional(), logo: z.string().optional(), primaryColor: z.string().optional(), sidepanelBackgroundColor: z.string().optional(), sidepanelTextColor: z.string().optional(), vaultName: z.string().optional(), privacyUrl: z.string().optional(), termsUrl: z.string().optional(), }).transform((v) => { return remap$(v, { primaryColor: "primary_color", sidepanelBackgroundColor: "sidepanel_background_color", sidepanelTextColor: "sidepanel_text_color", vaultName: "vault_name", privacyUrl: "privacy_url", termsUrl: "terms_url", }); }) ); export function themeToJSON(theme: Theme): string { return JSON.stringify(Theme$outboundSchema.parse(theme)); } /** @internal */ export type Session$Outbound = { consumer_metadata?: ConsumerMetadata$Outbound | undefined; redirect_uri?: string | undefined; settings?: Settings$Outbound | undefined; theme?: Theme$Outbound | undefined; custom_consumer_settings?: { [k: string]: any } | undefined; }; /** @internal */ export const Session$outboundSchema: z.ZodType< Session$Outbound, z.ZodTypeDef, Session > = /* @__PURE__ */ lazySchema$(() => z.object({ consumerMetadata: ConsumerMetadata$outboundSchema.optional(), redirectUri: z.string().optional(), settings: z.lazy(() => Settings$outboundSchema).optional(), theme: z.lazy(() => Theme$outboundSchema).optional(), customConsumerSettings: z.record(z.any()).optional(), }).transform((v) => { return remap$(v, { consumerMetadata: "consumer_metadata", redirectUri: "redirect_uri", customConsumerSettings: "custom_consumer_settings", }); }) ); export function sessionToJSON(session: Session): string { return JSON.stringify(Session$outboundSchema.parse(session)); }