@looker/extension-sdk 24.12.1 → 24.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [24.14.0](https://github.com/looker-open-source/sdk-codegen/compare/extension-sdk-v24.12.1...extension-sdk-v24.14.0) (2024-08-12)
9
+
10
+
11
+ ### Miscellaneous Chores
12
+
13
+ * **extension-sdk:** Synchronize undefined versions
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * The following workspace dependencies were updated
19
+ * dependencies
20
+ * @looker/sdk bumped from 24.12.1 to 24.14.0
21
+
8
22
  ## [24.12.1](https://github.com/looker-open-source/sdk-codegen/compare/extension-sdk-v24.12.0...extension-sdk-v24.12.1) (2024-07-29)
9
23
 
10
24
 
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["ExtensionEvent","exports","ExtensionRequestType","ApiVersion","FetchResponseBodyType","ExtensionNotificationType","MountPoint"],"sources":["../../src/connect/types.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { ChattyHostConnection } from '@looker/chatty';\nimport type {\n RawVisualizationData,\n VisualizationDataReceivedCallback,\n VisualizationSDK,\n} from './visualization';\nimport type {\n TileHostData,\n TileHostDataChangedCallback,\n TileSDK,\n} from './tile';\n\n/**\n * Extension event used for chatty communication\n */\nexport enum ExtensionEvent {\n /**\n * Notification from host to client\n */\n EXTENSION_HOST_NOTIFICATION = 'EXTENSION_NOTIFICATION',\n /**\n * Process request from client.\n */\n EXTENSION_API_REQUEST = 'EXTENSION_API_REQUEST',\n}\n\n/**\n * Request types used by the underlying API. The ENTENSION_API_REQUEST delegates\n * work based upon the request type\n */\nexport enum ExtensionRequestType {\n /**\n * Context data request\n */\n CONTEXT_DATA = 'CONTEXT_DATA',\n /**\n * Verify that the host exists and is working correctly. Host is the Looker window\n * instance that owns the client IFRAME.\n */\n VERIFY_HOST = 'VERIFY_HOST',\n /**\n * Execute a call on the Looker CORE SDK\n */\n INVOKE_CORE_SDK = 'INVOKE_CORE_SDK',\n /**\n * Execute a raw request on the Looker CORE SDK\n */\n RAW_INVOKE_CORE_SDK = 'RAW_INVOKE_CORE_SDK',\n /**\n * Update title\n */\n UPDATE_TITLE = 'UPDATE_TITLE',\n /**\n * Update location\n */\n UPDATE_LOCATION = 'UPDATE_LOCATION',\n /**\n * Location route changed\n */\n ROUTE_CHANGED = 'ROUTE_CHANGED',\n /**\n * Close popovers in the looker host\n */\n CLOSE_HOST_POPOVERS = 'CLOSE_HOST_POPOVERS',\n /**\n * Clipboard request\n */\n CLIPBOARD = 'CLIPBOARD',\n /**\n * Local storage request\n */\n LOCAL_STORAGE = 'LOCAL_STORAGE',\n /**\n * Read user attribute action\n */\n USER_ATTRIBUTE = 'USER_ATTRIBUTE',\n /**\n * Track action\n */\n TRACK_ACTION = 'TRACK_ACTION',\n /**\n * Error event\n */\n ERROR_EVENT = 'ERROR_EVENT',\n /**\n * Invoke external API\n */\n INVOKE_EXTERNAL_API = 'INVOKE_EXTERNAL_API',\n /**\n * Extension unloaded\n */\n EXTENSION_UNLOADED = 'EXTENSION_UNLOADED',\n /**\n * Log out of Looker from /spartan extension\n *\n * Only works from within the /spartan context. It will not work for\n * extensions running under /extensions\n */\n SPARTAN_LOGOUT = 'SPARTAN_LOGOUT',\n /**\n * Extension rendered\n */\n RENDERED = 'RENDERED',\n /**\n * Set up the visConfig options that should be present in an explore\n */\n VIS_DEFAULT_CONFIG = 'VIS_DEFAULT_CONFIG',\n /**\n * Change visualization configuration after intial load\n */\n VIS_CONFIG_UPDATE = 'VIS_CONFIG_UPDATE',\n /**\n * Tile add error messages\n */\n TILE_ADD_ERRORS = 'TILE_ADD_ERRORS',\n /**\n * Tile clear error messages\n */\n TILE_CLEAR_ERRORS = 'TILE_CLEAR_ERRORS',\n /**\n * Tile open drill menu\n */\n TILE_OPEN_DRILL_MENU = 'TILE_OPEN_DRILL_MENU',\n /**\n * Tile toggle cross filter\n */\n TILE_TOGGLE_CROSS_FILTER = 'TILE_TOGGLE_CROSS_FILTER',\n /**\n * Tile update row limit\n */\n TILE_ROW_LIMIT_UPDATE = 'TILE_ROW_LIMIT_UPDATE',\n /**\n * Tile run dashboard. Indicates that the dashboard queries should be run.\n */\n TILE_RUN_DASHBOARD = 'TILE_RUN_DASHBOARD',\n /**\n * Tile stop dashboard. Indicates to a dashboard that a queries should be stopped\n */\n TILE_STOP_DASHBOARD = 'TILE_STOP_DASHBOARD',\n /**\n * Tile update filters. Update the filters of the dashboard.\n */\n TILE_UPDATE_FILTERS = 'TILE_UPDATE_FILTERS',\n /**\n * Open schedule dialog.\n */\n TILE_OPEN_SCHEDULE_DIALOG = 'TILE_OPEN_SCHEDULE_DIALOG',\n}\n\n/**\n * The message that is associated with the Chatty EXTENSION_API_REQUEST event\n */\nexport interface ExtensionRequest {\n /**\n * Extension request type\n */\n type: ExtensionRequestType;\n /**\n * Optional payload associated with extension request type\n */\n payload?: InvokeCoreSdkRequest | undefined;\n}\n\nexport enum ApiVersion {\n sdk40 = '4.0',\n}\n\nexport interface InvokeCoreSdkRequest {\n apiMethodName?: string;\n httpMethod?: string;\n path?: string;\n body?: any;\n params?: any;\n options?: any;\n apiVersion?: ApiVersion;\n}\n\nexport interface UpdateTitleRequest {\n title: string;\n}\n\nexport interface UpdateLocationRequest {\n url: string;\n state?: any;\n}\n\nexport interface ExtensionHostApi extends ExtensionSDK {\n isDashboardMountSupported: boolean;\n handleNotification(\n message: ExtensionNotification\n ): ExtensionInitializationResponse | undefined;\n invokeCoreSdk(\n httpMethod: string,\n path: string,\n body?: any,\n params?: any,\n authenticator?: any,\n options?: any,\n apiVersion?: ApiVersion\n ): Promise<any>;\n invokeCoreSdkRaw(\n httpMethod: string,\n path: string,\n body?: any,\n params?: any,\n apiVersion?: ApiVersion\n ): Promise<any>;\n unloaded(): void;\n}\n\nexport interface ExtensionClientApi {\n handleRequest(message: ExtensionRequest): any | void;\n}\n\nexport interface ContextDataRequest {\n type: 'save' | 'refresh';\n contextData?: string;\n}\n\nexport interface RouteChangeRequest {\n route: string;\n}\n\nexport interface ClipboardRequest {\n type: 'write';\n value: string;\n}\n\nexport interface LocalStorageRequest {\n type: 'get' | 'set' | 'remove';\n name: string;\n value?: string;\n}\n\nexport interface TrackActionRequest {\n name: string;\n trackAction: string;\n attributes?: Record<string, any>;\n}\n\nexport interface ErrorEventRequest {\n errorEvent: ErrorEvent;\n}\n\nexport enum FetchResponseBodyType {\n json = 'json',\n text = 'text',\n}\n\nexport interface FetchDataRequest {\n resource: string;\n init?: Extract<RequestInit, 'method' | 'headers' | 'body' | 'credentials'>;\n responseBodyType?: FetchResponseBodyType;\n}\n\n/**\n * Notification type\n */\nexport enum ExtensionNotificationType {\n /**\n * Route change message sent when the route changes in the host\n * (browser forward or back buttons)\n */\n ROUTE_CHANGED = 'ROUTE_CHANGED',\n /**\n * Initialize message sent when chatty host and client have established\n * communication\n */\n INITIALIZE = 'INITIALIZE',\n /**\n * Visualization data\n */\n VISUALIZATION_DATA = 'VISUALIZATION_DATA',\n /**\n * Tile host data changed\n */\n TILE_HOST_DATA = 'TILE_HOST_DATA',\n}\n\n/**\n * Extension initialize message. Will be received once\n * when the extension is first instantiated\n */\nexport interface ExtensionInitializeMessage {\n type: ExtensionNotificationType.INITIALIZE;\n payload: LookerHostData;\n}\n\n/**\n * Route changed message. Received when the host route changes.\n * This happens when the user clicks the browser backward or\n * forward button.\n */\nexport interface ExtensionRouteChangedMessage {\n type: ExtensionNotificationType.ROUTE_CHANGED;\n payload: RouteChangeData;\n}\n\n/**\n * Visualization data. Only received by extensions visualizations.\n * <code>Looker >=22.8</code>\n */\nexport interface ExtensionVisualizationDataMessage {\n type: ExtensionNotificationType.VISUALIZATION_DATA;\n payload: RawVisualizationData;\n}\n\n/**\n * Tile Host Data Changed notificaction\n * <code>Looker >=22.8</code>\n */\nexport interface TileHostDataChangedMessage {\n type: ExtensionNotificationType.TILE_HOST_DATA;\n payload: Partial<TileHostData>;\n}\n\n/**\n * Extension notification\n */\nexport type ExtensionNotification =\n | ExtensionInitializeMessage\n | ExtensionRouteChangedMessage\n | ExtensionVisualizationDataMessage\n | TileHostDataChangedMessage;\n\n/**\n * Route change data\n */\nexport interface RouteChangeData {\n /**\n * Changed route for the extension\n */\n route?: string;\n /**\n * Changed route state\n */\n routeState?: any;\n}\n\n/**\n * Looker host type.\n * standard - Standard Looker host with the navigation bar.\n * embed - Embedded Looker host.\n * spartan - Spartan Looker host.\n */\nexport type HostType = 'standard' | 'embed' | 'spartan';\n\n/**\n * Extension mount type.\n * Fullscreen mount.\n * @deprecated <code>Looker >=22.8</code>. Use MountPoint (fullscreen is equivalent of standalone)\n */\nexport type MountType = 'fullscreen' | undefined;\n\n/**\n * Extension mount point\n * <code>Looker >=22.8</code>\n */\nexport enum MountPoint {\n standalone = 'standalone',\n dashboardVisualization = 'dashboard-visualization',\n dashboardTile = 'dashboard-tile',\n dashboardTilePopup = 'dashboard-tile-popup',\n}\n\n/**\n * Initialization data. Looker host data.\n */\nexport interface LookerHostData {\n /**\n * Extension id\n */\n extensionId: string;\n /**\n * Version of looker\n */\n lookerVersion: string;\n /**\n * Initial route for the extension\n */\n route?: string;\n /**\n * route state\n */\n routeState?: any;\n /**\n * Origin of Looker host\n * @deprecated\n */\n hostUrl?: string;\n /**\n * Origin of Looker host\n * <code>Looker >=21.8</code>\n */\n hostOrigin?: string;\n /**\n * Looker host type (standard, embed, spartan)\n * <code>Looker >=21.8</code>\n */\n hostType?: HostType;\n /**\n * Extension mount type.\n * <code>Looker >=21.8</code>\n */\n mountType?: MountType;\n /**\n * Extension mount point.\n * <code>Looker >=22.8</code>\n */\n mountPoint: MountPoint;\n /**\n * Extension context data\n */\n contextData?: string;\n /**\n * The extension is rendering to a PDF or image.\n * <code>Looker >=22.8</code>\n */\n isRendering?: boolean;\n /**\n * When true the dashboard tile has been enabled.\n * <code>Looker >=22.8</code>\n */\n extensionDashboardTileEnabled: boolean;\n}\n\n/**\n * Response returned from initialization\n */\nexport interface ExtensionInitializationResponse {\n /**\n * Version of the SDK\n */\n extensionSdkVersion: string;\n /**\n * initialization error message\n */\n errorMessage?: string;\n}\n\n/**\n * Extension host configuration\n */\nexport interface ExtensionHostConfiguration {\n /**\n * Callback once extension initialized\n * @param errorMessage details of any errors that have\n * occured during initialization\n */\n initializedCallback?: (errorMessage?: string) => void;\n /**\n * Callback to set the initial route to be restored. Ignored if\n * route tracking off\n */\n setInitialRoute?: (route: string, routeState?: any) => void;\n /**\n * Required looker version. An error will be thrown if the host\n * Looker is not at the version specified.\n */\n requiredLookerVersion?: string;\n /**\n * Callback to notify extension that host has changed the route.\n * The host changes the route when browser back or forward button\n * pressed.\n */\n hostChangedRoute?: (route: string, routeState?: any) => void;\n /**\n * Timeout for messages sent via chatty. Defaults to 30000 milliseconds.\n * Set to -1 for no timeout.\n */\n chattyTimeout?: number;\n /**\n * Callback called when visualization data received\n */\n visualizationDataReceivedCallback?: VisualizationDataReceivedCallback;\n\n /**\n * Callback called when the host is updated\n */\n tileHostDataChangedCallback?: TileHostDataChangedCallback;\n}\n\nexport interface ExtensionHostApiConfiguration\n extends ExtensionHostConfiguration {\n chattyHost: ChattyHostConnection;\n}\n\n/**\n * Custom parameters for fetch proxy\n */\nexport interface FetchCustomParameters {\n /**\n * Http method\n */\n method?: 'POST' | 'GET' | 'DELETE' | 'PATCH' | 'PUT' | 'HEAD';\n /**\n * Request headers\n */\n headers?: Record<string, string>;\n /**\n * Request body\n */\n body?: string;\n /**\n * Credentials. Controls how cookies are sent to the external API server.\n * For external APIs this should be set to include if cookies suppor is\n * credentials are or omitted or the init object is omitted, the credentials\n * desired.\n */\n credentials?: 'omit' | 'same-origin' | 'include';\n}\n\n/**\n * Fetch proxy response\n */\nexport interface FetchProxyDataResponse {\n /**\n * true if status in the 200 range\n */\n ok: boolean;\n /**\n * http response status\n */\n status: number;\n /**\n * description of the status\n */\n statusText?: string;\n /**\n * response headers\n */\n headers: Record<string, string>;\n /**\n * response body\n */\n body?: any;\n}\n\n/**\n * Fetch proxy instance. A fetch proxy can be created with a base URL and prepopulated\n * init and response body type. This allows init header setup to be centralized rather\n * than duplicating code for each fetch proxy call\n */\nexport interface FetchProxy {\n /**\n * External API proxy to the browser fetch API. Merges arguments with arguments specified\n * when the fetch proxy was created. The arguments in the call override the arguments specified\n * when the proxy was created.\n * @param resource url to call. will be concatenated to base URL is base URL was specified.\n * @param init. object containing custom parameters for fetch. Will be merged with init\n * object defined when the proxy was created.\n * @param responseBodyType indicates how to handle the response body. Overrides responseBodyType\n * specifed when proxy created.\n */\n fetchProxy(\n resource: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): Promise<FetchProxyDataResponse>;\n}\n\n/**\n * Public extension SDK\n */\nexport interface ExtensionSDK {\n /**\n * Looker host data\n */\n lookerHostData?: Readonly<LookerHostData>;\n\n /**\n * Create a tag that the Looker server will recognize as a\n * secret key to evaluated and replaced. The tag is name spaced\n * to the extension.\n * @param keyName for which a tag is required\n */\n createSecretKeyTag(keyName: string): string;\n\n /**\n * Verify that looker host is available\n */\n verifyHostConnection(): Promise<boolean>;\n\n /**\n * Update window title (if allowed)\n * @param title new window title\n */\n updateTitle(title: string): void;\n\n /**\n * Update location of current window (if allowed). Navigating to\n * a new host is NOT allowed\n * @param url - new url - should begin with '/'\n * @param state push state\n * @param target when set opens new browser window. Use\n * openBrowserWindow instead.\n */\n updateLocation(url: string, state?: any, target?: string): void;\n\n /**\n * Open new browser window with URL\n * @param url for window\n * @param target name of window. Defaults to _blank\n */\n openBrowserWindow(url: string, target?: string): void;\n\n /**\n * Close currently opened popovers (menus for example)\n */\n closeHostPopovers(): void;\n\n /**\n * Store an item in local storage. Note that local storage is name\n * spaced to the extension. It is not necessary to include the extension\n * name in the name of the item.\n * @param name of item\n * @param value to store in local storage\n */\n localStorageSetItem(name: string, value?: string): Promise<boolean>;\n\n /**\n * Get an item from local storage. Note that local storage is name\n * spaced to the extension. It is not necessary to include the extension\n * name in the name of the item.\n * @param name of item\n */\n localStorageRemoveItem(name: string): Promise<boolean>;\n\n /**\n * Remove an item from local storage. Note that local storage is name\n * spaced to the extension. It is not necessary to include the extension\n * name in the name of the item.\n * @param name of item\n */\n localStorageGetItem(name: string): Promise<string | null>;\n\n /**\n * Write string to clipboard.\n * @param value to write to clipboard.\n */\n clipboardWrite(value: string): Promise<void>;\n\n /**\n * Set a user attribute value.\n * @param name of item\n * @param value to store in local storage\n */\n userAttributeSetItem(name: string, value?: string): Promise<boolean>;\n /**\n * Get a user attribute value.\n * @param name of item\n */\n userAttributeGetItem(name: string): Promise<string | null>;\n /**\n * Reset a user attribute value to the default\n * @param name of item\n */\n userAttributeResetItem(name: string): Promise<void>;\n /**\n * Track some kind of action.\n * @param name of action\n * @param trackAction of action\n * @param attributes associated with action\n */\n track(\n name: string,\n trackAction: string,\n attributes?: Record<string, any>\n ): void;\n\n /**\n * Error event details. Report error details to the Looker host\n * Notes:\n * 1. Because crossorigin is not set on the script tag that loads the extension\n * details of the error cannot be determined.\n * 2. In development mode (at least if react is being used), an error will\n * be recorded twice. This is because react reports the failure to get\n * details of the error as an error.\n */\n error(errorEvent: ErrorEvent): void;\n\n /**\n * Notify host that client route has changed\n * @param route\n * @param routeState state of route\n */\n clientRouteChanged(route: string, routeState?: any): void;\n\n /**\n * Get the context associated with the extension. The context can be of any\n * JSON serializable type.\n *\n * Note that a separate copy of the context will be returned each time getContext\n * is called so an update to context object will not be reflected in subsequent\n * calls UNLESS saveContext is called.\n */\n getContextData(): any;\n\n /**\n * Save the context data in the Looker server and return a copy of the context data.\n * Subsequent calls to getContext will return the updated context data.\n *\n * Note that context data is shared amongst all users of the extension regardless of\n * role (in otherwords context does not support permissions). Care should be taken when\n * updating context data as the last write wins and extensions generally read the context data\n * once on extension load (see refreshContext for exception). The context should only be used\n * for data that rarely changes.\n *\n * @param contextData to save\n * @return current context data\n */\n saveContextData(contextData: any): Promise<any>;\n\n /**\n * Get the lastest version of context data from the Looker server.\n *\n * Should another user update the context data this method can be used to get the lastest data\n * without reloading the extension. Note that there is not a mechanism to indicate\n * that the context data has been modified.\n */\n refreshContextData(): Promise<any>;\n\n /**\n * Create a fetch proxy instance. Allows set up init parameter to be centalized into one place\n * @param baseUrl root URL to call. The resource on the fetch call will be appended to the baseUrl\n * @param init. object containing custom parameters for fetch.\n * @param responseBodyType indicates how to handle the response body. If omitted an attempt will be made\n * to determine how to handle the response body based upon the content type of the\n * response. Ultimately it defaults to a text response.\n * @return current context data\n */\n createFetchProxy(\n baseUrl?: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): FetchProxy;\n\n /**\n * External API proxy to the browser fetch API.\n * Do not attempt to call internal Looker APIs. Any attempt to do so will be rejected.\n * Protocol MUST be https.\n * Entitlements must be defined for the extension in the manifest application in order to use this feature.\n * At a minimum, the domain and top level domain must be specified in the entitlements.\n * @param resource url to call\n * @param init. object containing custom parameters for fetch.\n * @param responseBodyType indicates how to handle the response body. If omitted an attempt will be made\n * to determine how to handle the response body based upon the content type of the\n * response. Ultimately it defaults to a text response.\n */\n fetchProxy(\n resource: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): Promise<FetchProxyDataResponse>;\n\n /**\n * External API server proxy. Similar to fetch proxy except that external API calls are made\n * through the Looker instance. This allows the request to be embedded with secret keys stored\n * in the Looker server. This method should only be used for secret key/token exchange calls\n * as it adds additional overhead to the external API (network and competing for resources on\n * the Looker server). Note that there is no server proxy equivalent to createFetchProxy.\n * Entitlements must be defined for the extension in the manifest application in order to use this feature.\n * At a minimum, the domain and top level domain must be specified in the entitlements.\n * The Looker server will examine the request URL, headers amd body for handlebar ({{ KEY_NAME }}) expressions.\n * If found, the expression will be substituted with key values obtained from user attributes where the user\n * attribute is a combination of EXTENSION_ID::KEY_NAME.\n * @param resource url to call\n * @param init. object containing custom parameters for server call.\n * @param responseBodyType indicates how to handle the response body. If omitted an attempt will be made\n * to determine how to handle the response body based upon the content type of the\n * response. Ultimately it defaults to a text response.\n */\n serverProxy(\n resource: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): Promise<FetchProxyDataResponse>;\n\n /**\n * Oauth2 authentication. Authentication relies on a new window being\n * created and a form being submitted. The authParameters become inputs\n * to the form submission.\n * @param authEndpoint endpoint responsible for the authentication.\n * An oauth2 url entitlement MUST be defined for\n * the end point.\n * @param authParameters parameters to be included in the request.\n * client_id MUST be included\n * scope MUST be included\n * redirect_uri MUST NOT be included - will be set by host\n * response_type MUST NOT be included - will be set to 'token' by host\n * state OPTIONAL - If omitted will be generated by host.\n * code_challenge_method optional - set to 'S256' to use code challenge\n * rather than secret key.\n * @param httpMethod used for submission. Defaults to 'POST'.\n */\n oauth2Authenticate(\n authEndpoint: string,\n authParameters: Record<string, string>,\n httpMethod?: string\n ): Promise<any>;\n\n /**\n * Oauth2 exchange code for token. This is actually a wrapper around\n * serverProxy or fetch with some specialized processing. If the code_challenge_method\n * was used in the oauth2Authenticate call then fetch is used otherwise serverProxy is\n * used. It is expected that this method is called immediately after oauth2Authenticate.\n * The state, redirect url and code verifier (code_challenge_method only)\n * are saved from the oauth2Authenticate call and included in the exchange\n * for token call.\n * Note, currently code_challenge_method and secret key usage are mutually exclusive.\n * @param authEndpoint endpoint responsible for the code exchange\n * An oauth2 url entitlement MUST be defined for\n * the end point.\n * @param authParameters parameters to be included in the request.\n * Note that state and redirect_uri parameters\n * will automatically be added to this object.\n * If code challenge is not being used a client secret tag\n * must be added to the request. The client\n * secret tag is generated using the createSecretKeyTag\n * method.\n * If code challenge is being used the code_verifier is added\n * to the message.\n */\n oauth2ExchangeCodeForToken(\n authEndpoint: string,\n authParameters: Record<string, string>\n ): Promise<any>;\n\n /**\n * Log user out of Looker. Only works when running under /spartan\n */\n spartanLogout(): void;\n\n /**\n * Indicate that an extension has been rendered.\n * <code>Looker >=22.8</code>\n */\n rendered(failureMessage?: string): void;\n\n /**\n * Visualization API.\n */\n visualizationSDK: VisualizationSDK;\n\n /**\n * Tile API.\n */\n tileSDK: TileSDK;\n\n /**\n * Returns true if dashboard mount is supported. There are two\n * checks involved:\n * 1. The extension mount point is configured correctly\n * 2. The Looker host system supports it.\n */\n isDashboardMountSupported: boolean;\n}\n"],"mappings":";;;;;;IAyCYA,cAAc,GAAAC,OAAA,CAAAD,cAAA,aAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAAA,IAedE,oBAAoB,GAAAD,OAAA,CAAAC,oBAAA,aAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAAA,IAqIpBC,UAAU,GAAAF,OAAA,CAAAE,UAAA,aAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAAA,IAiFVC,qBAAqB,GAAAH,OAAA,CAAAG,qBAAA,aAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAAA,IAcrBC,yBAAyB,GAAAJ,OAAA,CAAAI,yBAAA,aAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA;AAAA,IAoGzBC,UAAU,GAAAL,OAAA,CAAAK,UAAA,aAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA"}
1
+ {"version":3,"file":"types.js","names":["ExtensionEvent","exports","ExtensionRequestType","ApiVersion","FetchResponseBodyType","ExtensionNotificationType","MountPoint"],"sources":["../../src/connect/types.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { ChattyHostConnection } from '@looker/chatty';\nimport type {\n RawVisualizationData,\n VisualizationDataReceivedCallback,\n VisualizationSDK,\n} from './visualization';\nimport type {\n TileHostData,\n TileHostDataChangedCallback,\n TileSDK,\n} from './tile';\n\n/**\n * Extension event used for chatty communication\n */\nexport enum ExtensionEvent {\n /**\n * Notification from host to client\n */\n EXTENSION_HOST_NOTIFICATION = 'EXTENSION_NOTIFICATION',\n /**\n * Process request from client.\n */\n EXTENSION_API_REQUEST = 'EXTENSION_API_REQUEST',\n}\n\n/**\n * Request types used by the underlying API. The ENTENSION_API_REQUEST delegates\n * work based upon the request type\n */\nexport enum ExtensionRequestType {\n /**\n * Context data request\n */\n CONTEXT_DATA = 'CONTEXT_DATA',\n /**\n * Verify that the host exists and is working correctly. Host is the Looker window\n * instance that owns the client IFRAME.\n */\n VERIFY_HOST = 'VERIFY_HOST',\n /**\n * Execute a call on the Looker CORE SDK\n */\n INVOKE_CORE_SDK = 'INVOKE_CORE_SDK',\n /**\n * Execute a raw request on the Looker CORE SDK\n */\n RAW_INVOKE_CORE_SDK = 'RAW_INVOKE_CORE_SDK',\n /**\n * Update title\n */\n UPDATE_TITLE = 'UPDATE_TITLE',\n /**\n * Update location\n */\n UPDATE_LOCATION = 'UPDATE_LOCATION',\n /**\n * Location route changed\n */\n ROUTE_CHANGED = 'ROUTE_CHANGED',\n /**\n * Close popovers in the looker host\n */\n CLOSE_HOST_POPOVERS = 'CLOSE_HOST_POPOVERS',\n /**\n * Clipboard request\n */\n CLIPBOARD = 'CLIPBOARD',\n /**\n * Local storage request\n */\n LOCAL_STORAGE = 'LOCAL_STORAGE',\n /**\n * Read user attribute action\n */\n USER_ATTRIBUTE = 'USER_ATTRIBUTE',\n /**\n * Track action\n */\n TRACK_ACTION = 'TRACK_ACTION',\n /**\n * Error event\n */\n ERROR_EVENT = 'ERROR_EVENT',\n /**\n * Invoke external API\n */\n INVOKE_EXTERNAL_API = 'INVOKE_EXTERNAL_API',\n /**\n * Extension unloaded\n */\n EXTENSION_UNLOADED = 'EXTENSION_UNLOADED',\n /**\n * Log out of Looker from /spartan extension\n *\n * Only works from within the /spartan context. It will not work for\n * extensions running under /extensions\n */\n SPARTAN_LOGOUT = 'SPARTAN_LOGOUT',\n /**\n * Extension rendered\n */\n RENDERED = 'RENDERED',\n /**\n * Set up the visConfig options that should be present in an explore\n */\n VIS_DEFAULT_CONFIG = 'VIS_DEFAULT_CONFIG',\n /**\n * Change visualization configuration after intial load\n */\n VIS_CONFIG_UPDATE = 'VIS_CONFIG_UPDATE',\n /**\n * Tile add error messages\n */\n TILE_ADD_ERRORS = 'TILE_ADD_ERRORS',\n /**\n * Tile clear error messages\n */\n TILE_CLEAR_ERRORS = 'TILE_CLEAR_ERRORS',\n /**\n * Tile open drill menu\n */\n TILE_OPEN_DRILL_MENU = 'TILE_OPEN_DRILL_MENU',\n /**\n * Tile toggle cross filter\n */\n TILE_TOGGLE_CROSS_FILTER = 'TILE_TOGGLE_CROSS_FILTER',\n /**\n * Tile update row limit\n */\n TILE_ROW_LIMIT_UPDATE = 'TILE_ROW_LIMIT_UPDATE',\n /**\n * Tile run dashboard. Indicates that the dashboard queries should be run.\n */\n TILE_RUN_DASHBOARD = 'TILE_RUN_DASHBOARD',\n /**\n * Tile stop dashboard. Indicates to a dashboard that a queries should be stopped\n */\n TILE_STOP_DASHBOARD = 'TILE_STOP_DASHBOARD',\n /**\n * Tile update filters. Update the filters of the dashboard.\n */\n TILE_UPDATE_FILTERS = 'TILE_UPDATE_FILTERS',\n /**\n * Open schedule dialog.\n */\n TILE_OPEN_SCHEDULE_DIALOG = 'TILE_OPEN_SCHEDULE_DIALOG',\n}\n\n/**\n * The message that is associated with the Chatty EXTENSION_API_REQUEST event\n */\nexport interface ExtensionRequest {\n /**\n * Extension request type\n */\n type: ExtensionRequestType;\n /**\n * Optional payload associated with extension request type\n */\n payload?: InvokeCoreSdkRequest | undefined;\n}\n\nexport enum ApiVersion {\n sdk40 = '4.0',\n}\n\nexport interface InvokeCoreSdkRequest {\n apiMethodName?: string;\n httpMethod?: string;\n path?: string;\n body?: any;\n params?: any;\n options?: any;\n apiVersion?: ApiVersion;\n}\n\nexport interface UpdateTitleRequest {\n title: string;\n}\n\nexport interface UpdateLocationRequest {\n url: string;\n state?: any;\n}\n\nexport interface ExtensionHostApi extends ExtensionSDK {\n isDashboardMountSupported: boolean;\n handleNotification(\n message: ExtensionNotification\n ): ExtensionInitializationResponse | undefined;\n invokeCoreSdk(\n httpMethod: string,\n path: string,\n body?: any,\n params?: any,\n authenticator?: any,\n options?: any,\n apiVersion?: ApiVersion\n ): Promise<any>;\n invokeCoreSdkRaw(\n httpMethod: string,\n path: string,\n body?: any,\n params?: any,\n apiVersion?: ApiVersion\n ): Promise<any>;\n unloaded(): void;\n}\n\nexport interface ExtensionClientApi {\n handleRequest(message: ExtensionRequest): any | void;\n}\n\nexport interface ContextDataRequest {\n type: 'save' | 'refresh';\n contextData?: string;\n}\n\nexport interface RouteChangeRequest {\n route: string;\n}\n\nexport interface ClipboardRequest {\n type: 'write';\n value: string;\n}\n\nexport interface LocalStorageRequest {\n type: 'get' | 'set' | 'remove';\n name: string;\n value?: string;\n}\n\nexport interface TrackActionRequest {\n name: string;\n trackAction: string;\n attributes?: Record<string, any>;\n}\n\nexport interface ErrorEventRequest {\n errorEvent: ErrorEvent;\n}\n\nexport enum FetchResponseBodyType {\n json = 'json',\n text = 'text',\n}\n\nexport interface FetchDataRequest {\n resource: string;\n init?: Extract<RequestInit, 'method' | 'headers' | 'body' | 'credentials'>;\n responseBodyType?: FetchResponseBodyType;\n}\n\n/**\n * Notification type\n */\nexport enum ExtensionNotificationType {\n /**\n * Route change message sent when the route changes in the host\n * (browser forward or back buttons)\n */\n ROUTE_CHANGED = 'ROUTE_CHANGED',\n /**\n * Initialize message sent when chatty host and client have established\n * communication\n */\n INITIALIZE = 'INITIALIZE',\n /**\n * Visualization data\n */\n VISUALIZATION_DATA = 'VISUALIZATION_DATA',\n /**\n * Tile host data changed\n */\n TILE_HOST_DATA = 'TILE_HOST_DATA',\n}\n\n/**\n * Extension initialize message. Will be received once\n * when the extension is first instantiated\n */\nexport interface ExtensionInitializeMessage {\n type: ExtensionNotificationType.INITIALIZE;\n payload: LookerHostData;\n}\n\n/**\n * Route changed message. Received when the host route changes.\n * This happens when the user clicks the browser backward or\n * forward button.\n */\nexport interface ExtensionRouteChangedMessage {\n type: ExtensionNotificationType.ROUTE_CHANGED;\n payload: RouteChangeData;\n}\n\n/**\n * Visualization data. Only received by extensions visualizations.\n * <code>Looker >=22.8</code>\n */\nexport interface ExtensionVisualizationDataMessage {\n type: ExtensionNotificationType.VISUALIZATION_DATA;\n payload: RawVisualizationData;\n}\n\n/**\n * Tile Host Data Changed notificaction\n * <code>Looker >=22.8</code>\n */\nexport interface TileHostDataChangedMessage {\n type: ExtensionNotificationType.TILE_HOST_DATA;\n payload: Partial<TileHostData>;\n}\n\n/**\n * Extension notification\n */\nexport type ExtensionNotification =\n | ExtensionInitializeMessage\n | ExtensionRouteChangedMessage\n | ExtensionVisualizationDataMessage\n | TileHostDataChangedMessage;\n\n/**\n * Route change data\n */\nexport interface RouteChangeData {\n /**\n * Changed route for the extension\n */\n route?: string;\n /**\n * Changed route state\n */\n routeState?: any;\n}\n\n/**\n * Looker host type.\n * standard - Standard Looker host with the navigation bar.\n * embed - Embedded Looker host.\n * spartan - Spartan Looker host.\n */\nexport type HostType = 'standard' | 'embed' | 'spartan';\n\n/**\n * Extension mount type.\n * Fullscreen mount.\n * @deprecated <code>Looker >=22.8</code>. Use MountPoint (fullscreen is equivalent of standalone)\n */\nexport type MountType = 'fullscreen' | undefined;\n\n/**\n * Extension mount point\n * <code>Looker >=22.8</code>\n */\nexport enum MountPoint {\n standalone = 'standalone',\n dashboardVisualization = 'dashboard-visualization',\n dashboardTile = 'dashboard-tile',\n dashboardTilePopup = 'dashboard-tile-popup',\n}\n\n/**\n * Initialization data. Looker host data.\n */\nexport interface LookerHostData {\n /**\n * Extension id\n */\n extensionId: string;\n /**\n * Version of looker\n */\n lookerVersion: string;\n /**\n * Initial route for the extension\n */\n route?: string;\n /**\n * route state\n */\n routeState?: any;\n /**\n * Origin of Looker host\n * @deprecated\n */\n hostUrl?: string;\n /**\n * Origin of Looker host\n * <code>Looker >=21.8</code>\n */\n hostOrigin?: string;\n /**\n * Looker host type (standard, embed, spartan)\n * <code>Looker >=21.8</code>\n */\n hostType?: HostType;\n /**\n * Extension mount type.\n * <code>Looker >=21.8</code>\n */\n mountType?: MountType;\n /**\n * Extension mount point.\n * <code>Looker >=22.8</code>\n */\n mountPoint: MountPoint;\n /**\n * Extension context data\n */\n contextData?: string;\n /**\n * The extension is rendering to a PDF or image.\n * <code>Looker >=22.8</code>\n */\n isRendering?: boolean;\n /**\n * When true the dashboard tile has been enabled.\n * <code>Looker >=22.8</code>\n */\n extensionDashboardTileEnabled: boolean;\n}\n\n/**\n * Response returned from initialization\n */\nexport interface ExtensionInitializationResponse {\n /**\n * Version of the SDK\n */\n extensionSdkVersion: string;\n /**\n * initialization error message\n */\n errorMessage?: string;\n}\n\n/**\n * Extension host configuration\n */\nexport interface ExtensionHostConfiguration {\n /**\n * Callback once extension initialized\n * @param errorMessage details of any errors that have\n * occured during initialization\n */\n initializedCallback?: (errorMessage?: string) => void;\n /**\n * Callback to set the initial route to be restored. Ignored if\n * route tracking off\n */\n setInitialRoute?: (route: string, routeState?: any) => void;\n /**\n * Required looker version. An error will be thrown if the host\n * Looker is not at the version specified.\n */\n requiredLookerVersion?: string;\n /**\n * Callback to notify extension that host has changed the route.\n * The host changes the route when browser back or forward button\n * pressed.\n */\n hostChangedRoute?: (route: string, routeState?: any) => void;\n /**\n * Timeout for messages sent via chatty. Defaults to 30000 milliseconds.\n * Set to -1 for no timeout.\n */\n chattyTimeout?: number;\n /**\n * Callback called when visualization data received\n */\n visualizationDataReceivedCallback?: VisualizationDataReceivedCallback;\n\n /**\n * Callback called when the host is updated\n */\n tileHostDataChangedCallback?: TileHostDataChangedCallback;\n}\n\nexport interface ExtensionHostApiConfiguration\n extends ExtensionHostConfiguration {\n chattyHost: ChattyHostConnection;\n}\n\n/**\n * Custom parameters for fetch proxy\n */\nexport interface FetchCustomParameters {\n /**\n * Http method\n */\n method?: 'POST' | 'GET' | 'DELETE' | 'PATCH' | 'PUT' | 'HEAD';\n /**\n * Request headers\n */\n headers?: Record<string, string>;\n /**\n * Request body\n */\n body?: string;\n /**\n * Credentials. Controls how cookies are sent to the external API server.\n * For external APIs this should be set to include if cookies suppor is\n * credentials are or omitted or the init object is omitted, the credentials\n * desired.\n */\n credentials?: 'omit' | 'same-origin' | 'include';\n}\n\n/**\n * Fetch proxy response\n */\nexport interface FetchProxyDataResponse {\n /**\n * true if status in the 200 range\n */\n ok: boolean;\n /**\n * http response status\n */\n status: number;\n /**\n * description of the status\n */\n statusText?: string;\n /**\n * response headers\n */\n headers: Record<string, string>;\n /**\n * response body\n */\n body?: any;\n}\n\n/**\n * Fetch proxy instance. A fetch proxy can be created with a base URL and prepopulated\n * init and response body type. This allows init header setup to be centralized rather\n * than duplicating code for each fetch proxy call\n */\nexport interface FetchProxy {\n /**\n * External API proxy to the browser fetch API. Merges arguments with arguments specified\n * when the fetch proxy was created. The arguments in the call override the arguments specified\n * when the proxy was created.\n * @param resource url to call. will be concatenated to base URL is base URL was specified.\n * @param init. object containing custom parameters for fetch. Will be merged with init\n * object defined when the proxy was created.\n * @param responseBodyType indicates how to handle the response body. Overrides responseBodyType\n * specifed when proxy created.\n */\n fetchProxy(\n resource: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): Promise<FetchProxyDataResponse>;\n}\n\n/**\n * Public extension SDK\n */\nexport interface ExtensionSDK {\n /**\n * Looker host data\n */\n lookerHostData?: Readonly<LookerHostData>;\n\n /**\n * Create a tag that the Looker server will recognize as a\n * secret key to evaluated and replaced. The tag is name spaced\n * to the extension.\n * @param keyName for which a tag is required\n */\n createSecretKeyTag(keyName: string): string;\n\n /**\n * Verify that looker host is available\n */\n verifyHostConnection(): Promise<boolean>;\n\n /**\n * Update window title (if allowed)\n * @param title new window title\n */\n updateTitle(title: string): void;\n\n /**\n * Update location of current window (if allowed). Navigating to\n * a new host is NOT allowed\n * @param url - new url - should begin with '/'\n * @param state push state\n * @param target when set opens new browser window. Use\n * openBrowserWindow instead.\n */\n updateLocation(url: string, state?: any, target?: string): void;\n\n /**\n * Open new browser window with URL\n * @param url for window\n * @param target name of window. Defaults to _blank\n */\n openBrowserWindow(url: string, target?: string): void;\n\n /**\n * Close currently opened popovers (menus for example)\n */\n closeHostPopovers(): void;\n\n /**\n * Store an item in local storage. Note that local storage is name\n * spaced to the extension. It is not necessary to include the extension\n * name in the name of the item.\n * @param name of item\n * @param value to store in local storage\n */\n localStorageSetItem(name: string, value?: string): Promise<boolean>;\n\n /**\n * Get an item from local storage. Note that local storage is name\n * spaced to the extension. It is not necessary to include the extension\n * name in the name of the item.\n * @param name of item\n */\n localStorageRemoveItem(name: string): Promise<boolean>;\n\n /**\n * Remove an item from local storage. Note that local storage is name\n * spaced to the extension. It is not necessary to include the extension\n * name in the name of the item.\n * @param name of item\n */\n localStorageGetItem(name: string): Promise<string | null>;\n\n /**\n * Write string to clipboard.\n * @param value to write to clipboard.\n */\n clipboardWrite(value: string): Promise<void>;\n\n /**\n * Set a user attribute value.\n * @param name of item\n * @param value to store in local storage\n */\n userAttributeSetItem(name: string, value?: string): Promise<boolean>;\n /**\n * Get a user attribute value.\n * @param name of item\n */\n userAttributeGetItem(name: string): Promise<string | null>;\n /**\n * Reset a user attribute value to the default\n * @param name of item\n */\n userAttributeResetItem(name: string): Promise<void>;\n /**\n * Track some kind of action.\n * @param name of action\n * @param trackAction of action\n * @param attributes associated with action\n */\n track(\n name: string,\n trackAction: string,\n attributes?: Record<string, any>\n ): void;\n\n /**\n * Error event details. Report error details to the Looker host\n * Notes:\n * 1. Because crossorigin is not set on the script tag that loads the extension\n * details of the error cannot be determined.\n * 2. In development mode (at least if react is being used), an error will\n * be recorded twice. This is because react reports the failure to get\n * details of the error as an error.\n */\n error(errorEvent: ErrorEvent): void;\n\n /**\n * Notify host that client route has changed\n * @param route\n * @param routeState state of route\n */\n clientRouteChanged(route: string, routeState?: any): void;\n\n /**\n * Get the context associated with the extension. The context can be of any\n * JSON serializable type.\n *\n * Note that a separate copy of the context will be returned each time getContext\n * is called so an update to context object will not be reflected in subsequent\n * calls UNLESS saveContext is called.\n */\n getContextData(): any;\n\n /**\n * Save the context data in the Looker server and return a copy of the context data.\n * Subsequent calls to getContext will return the updated context data.\n *\n * Note that context data is shared amongst all users of the extension regardless of\n * role (in otherwords context does not support permissions). Care should be taken when\n * updating context data as the last write wins and extensions generally read the context data\n * once on extension load (see refreshContext for exception). The context should only be used\n * for data that rarely changes.\n *\n * @param contextData to save\n * @return current context data\n */\n saveContextData(contextData: any): Promise<any>;\n\n /**\n * Get the lastest version of context data from the Looker server.\n *\n * Should another user update the context data this method can be used to get the lastest data\n * without reloading the extension. Note that there is not a mechanism to indicate\n * that the context data has been modified.\n */\n refreshContextData(): Promise<any>;\n\n /**\n * Create a fetch proxy instance. Allows set up init parameter to be centalized into one place\n * @param baseUrl root URL to call. The resource on the fetch call will be appended to the baseUrl\n * @param init. object containing custom parameters for fetch.\n * @param responseBodyType indicates how to handle the response body. If omitted an attempt will be made\n * to determine how to handle the response body based upon the content type of the\n * response. Ultimately it defaults to a text response.\n * @return current context data\n */\n createFetchProxy(\n baseUrl?: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): FetchProxy;\n\n /**\n * External API proxy to the browser fetch API.\n * Do not attempt to call internal Looker APIs. Any attempt to do so will be rejected.\n * Protocol MUST be https.\n * Entitlements must be defined for the extension in the manifest application in order to use this feature.\n * At a minimum, the domain and top level domain must be specified in the entitlements.\n * @param resource url to call\n * @param init. object containing custom parameters for fetch.\n * @param responseBodyType indicates how to handle the response body. If omitted an attempt will be made\n * to determine how to handle the response body based upon the content type of the\n * response. Ultimately it defaults to a text response.\n */\n fetchProxy(\n resource: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): Promise<FetchProxyDataResponse>;\n\n /**\n * External API server proxy. Similar to fetch proxy except that external API calls are made\n * through the Looker instance. This allows the request to be embedded with secret keys stored\n * in the Looker server. This method should only be used for secret key/token exchange calls\n * as it adds additional overhead to the external API (network and competing for resources on\n * the Looker server). Note that there is no server proxy equivalent to createFetchProxy.\n * Entitlements must be defined for the extension in the manifest application in order to use this feature.\n * At a minimum, the domain and top level domain must be specified in the entitlements.\n * The Looker server will examine the request URL, headers amd body for handlebar ({{ KEY_NAME }}) expressions.\n * If found, the expression will be substituted with key values obtained from user attributes where the user\n * attribute is a combination of EXTENSION_ID::KEY_NAME.\n * @param resource url to call\n * @param init. object containing custom parameters for server call.\n * @param responseBodyType indicates how to handle the response body. If omitted an attempt will be made\n * to determine how to handle the response body based upon the content type of the\n * response. Ultimately it defaults to a text response.\n */\n serverProxy(\n resource: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): Promise<FetchProxyDataResponse>;\n\n /**\n * Oauth2 authentication. Authentication relies on a new window being\n * created and a form being submitted. The authParameters become inputs\n * to the form submission.\n * @param authEndpoint endpoint responsible for the authentication.\n * An oauth2 url entitlement MUST be defined for\n * the end point.\n * @param authParameters parameters to be included in the request.\n * client_id MUST be included\n * scope MUST be included\n * redirect_uri MUST NOT be included - will be set by host\n * response_type MUST NOT be included - will be set to 'token' by host\n * state OPTIONAL - If omitted will be generated by host.\n * code_challenge_method optional - set to 'S256' to use code challenge\n * rather than secret key.\n * @param httpMethod used for submission. Defaults to 'POST'.\n * @deprecated\n */\n oauth2Authenticate(\n authEndpoint: string,\n authParameters: Record<string, string>,\n httpMethod?: string\n ): Promise<any>;\n\n /**\n * Oauth2 exchange code for token. This is actually a wrapper around\n * serverProxy or fetch with some specialized processing. If the code_challenge_method\n * was used in the oauth2Authenticate call then fetch is used otherwise serverProxy is\n * used. It is expected that this method is called immediately after oauth2Authenticate.\n * The state, redirect url and code verifier (code_challenge_method only)\n * are saved from the oauth2Authenticate call and included in the exchange\n * for token call.\n * Note, currently code_challenge_method and secret key usage are mutually exclusive.\n * @param authEndpoint endpoint responsible for the code exchange\n * An oauth2 url entitlement MUST be defined for\n * the end point.\n * @param authParameters parameters to be included in the request.\n * Note that state and redirect_uri parameters\n * will automatically be added to this object.\n * If code challenge is not being used a client secret tag\n * must be added to the request. The client\n * secret tag is generated using the createSecretKeyTag\n * method.\n * If code challenge is being used the code_verifier is added\n * to the message.\n * @deprecated\n */\n oauth2ExchangeCodeForToken(\n authEndpoint: string,\n authParameters: Record<string, string>\n ): Promise<any>;\n\n /**\n * Log user out of Looker. Only works when running under /spartan\n */\n spartanLogout(): void;\n\n /**\n * Indicate that an extension has been rendered.\n * <code>Looker >=22.8</code>\n */\n rendered(failureMessage?: string): void;\n\n /**\n * Visualization API.\n */\n visualizationSDK: VisualizationSDK;\n\n /**\n * Tile API.\n */\n tileSDK: TileSDK;\n\n /**\n * Returns true if dashboard mount is supported. There are two\n * checks involved:\n * 1. The extension mount point is configured correctly\n * 2. The Looker host system supports it.\n */\n isDashboardMountSupported: boolean;\n}\n"],"mappings":";;;;;;IAyCYA,cAAc,GAAAC,OAAA,CAAAD,cAAA,aAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAAA,IAedE,oBAAoB,GAAAD,OAAA,CAAAC,oBAAA,aAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAAA,IAqIpBC,UAAU,GAAAF,OAAA,CAAAE,UAAA,aAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAAA,IAiFVC,qBAAqB,GAAAH,OAAA,CAAAG,qBAAA,aAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAAA,IAcrBC,yBAAyB,GAAAJ,OAAA,CAAAI,yBAAA,aAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA;AAAA,IAoGzBC,UAAU,GAAAL,OAAA,CAAAK,UAAA,aAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["ExtensionEvent","ExtensionRequestType","ApiVersion","FetchResponseBodyType","ExtensionNotificationType","MountPoint"],"sources":["../../../src/connect/types.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { ChattyHostConnection } from '@looker/chatty';\nimport type {\n RawVisualizationData,\n VisualizationDataReceivedCallback,\n VisualizationSDK,\n} from './visualization';\nimport type {\n TileHostData,\n TileHostDataChangedCallback,\n TileSDK,\n} from './tile';\n\n/**\n * Extension event used for chatty communication\n */\nexport enum ExtensionEvent {\n /**\n * Notification from host to client\n */\n EXTENSION_HOST_NOTIFICATION = 'EXTENSION_NOTIFICATION',\n /**\n * Process request from client.\n */\n EXTENSION_API_REQUEST = 'EXTENSION_API_REQUEST',\n}\n\n/**\n * Request types used by the underlying API. The ENTENSION_API_REQUEST delegates\n * work based upon the request type\n */\nexport enum ExtensionRequestType {\n /**\n * Context data request\n */\n CONTEXT_DATA = 'CONTEXT_DATA',\n /**\n * Verify that the host exists and is working correctly. Host is the Looker window\n * instance that owns the client IFRAME.\n */\n VERIFY_HOST = 'VERIFY_HOST',\n /**\n * Execute a call on the Looker CORE SDK\n */\n INVOKE_CORE_SDK = 'INVOKE_CORE_SDK',\n /**\n * Execute a raw request on the Looker CORE SDK\n */\n RAW_INVOKE_CORE_SDK = 'RAW_INVOKE_CORE_SDK',\n /**\n * Update title\n */\n UPDATE_TITLE = 'UPDATE_TITLE',\n /**\n * Update location\n */\n UPDATE_LOCATION = 'UPDATE_LOCATION',\n /**\n * Location route changed\n */\n ROUTE_CHANGED = 'ROUTE_CHANGED',\n /**\n * Close popovers in the looker host\n */\n CLOSE_HOST_POPOVERS = 'CLOSE_HOST_POPOVERS',\n /**\n * Clipboard request\n */\n CLIPBOARD = 'CLIPBOARD',\n /**\n * Local storage request\n */\n LOCAL_STORAGE = 'LOCAL_STORAGE',\n /**\n * Read user attribute action\n */\n USER_ATTRIBUTE = 'USER_ATTRIBUTE',\n /**\n * Track action\n */\n TRACK_ACTION = 'TRACK_ACTION',\n /**\n * Error event\n */\n ERROR_EVENT = 'ERROR_EVENT',\n /**\n * Invoke external API\n */\n INVOKE_EXTERNAL_API = 'INVOKE_EXTERNAL_API',\n /**\n * Extension unloaded\n */\n EXTENSION_UNLOADED = 'EXTENSION_UNLOADED',\n /**\n * Log out of Looker from /spartan extension\n *\n * Only works from within the /spartan context. It will not work for\n * extensions running under /extensions\n */\n SPARTAN_LOGOUT = 'SPARTAN_LOGOUT',\n /**\n * Extension rendered\n */\n RENDERED = 'RENDERED',\n /**\n * Set up the visConfig options that should be present in an explore\n */\n VIS_DEFAULT_CONFIG = 'VIS_DEFAULT_CONFIG',\n /**\n * Change visualization configuration after intial load\n */\n VIS_CONFIG_UPDATE = 'VIS_CONFIG_UPDATE',\n /**\n * Tile add error messages\n */\n TILE_ADD_ERRORS = 'TILE_ADD_ERRORS',\n /**\n * Tile clear error messages\n */\n TILE_CLEAR_ERRORS = 'TILE_CLEAR_ERRORS',\n /**\n * Tile open drill menu\n */\n TILE_OPEN_DRILL_MENU = 'TILE_OPEN_DRILL_MENU',\n /**\n * Tile toggle cross filter\n */\n TILE_TOGGLE_CROSS_FILTER = 'TILE_TOGGLE_CROSS_FILTER',\n /**\n * Tile update row limit\n */\n TILE_ROW_LIMIT_UPDATE = 'TILE_ROW_LIMIT_UPDATE',\n /**\n * Tile run dashboard. Indicates that the dashboard queries should be run.\n */\n TILE_RUN_DASHBOARD = 'TILE_RUN_DASHBOARD',\n /**\n * Tile stop dashboard. Indicates to a dashboard that a queries should be stopped\n */\n TILE_STOP_DASHBOARD = 'TILE_STOP_DASHBOARD',\n /**\n * Tile update filters. Update the filters of the dashboard.\n */\n TILE_UPDATE_FILTERS = 'TILE_UPDATE_FILTERS',\n /**\n * Open schedule dialog.\n */\n TILE_OPEN_SCHEDULE_DIALOG = 'TILE_OPEN_SCHEDULE_DIALOG',\n}\n\n/**\n * The message that is associated with the Chatty EXTENSION_API_REQUEST event\n */\nexport interface ExtensionRequest {\n /**\n * Extension request type\n */\n type: ExtensionRequestType;\n /**\n * Optional payload associated with extension request type\n */\n payload?: InvokeCoreSdkRequest | undefined;\n}\n\nexport enum ApiVersion {\n sdk40 = '4.0',\n}\n\nexport interface InvokeCoreSdkRequest {\n apiMethodName?: string;\n httpMethod?: string;\n path?: string;\n body?: any;\n params?: any;\n options?: any;\n apiVersion?: ApiVersion;\n}\n\nexport interface UpdateTitleRequest {\n title: string;\n}\n\nexport interface UpdateLocationRequest {\n url: string;\n state?: any;\n}\n\nexport interface ExtensionHostApi extends ExtensionSDK {\n isDashboardMountSupported: boolean;\n handleNotification(\n message: ExtensionNotification\n ): ExtensionInitializationResponse | undefined;\n invokeCoreSdk(\n httpMethod: string,\n path: string,\n body?: any,\n params?: any,\n authenticator?: any,\n options?: any,\n apiVersion?: ApiVersion\n ): Promise<any>;\n invokeCoreSdkRaw(\n httpMethod: string,\n path: string,\n body?: any,\n params?: any,\n apiVersion?: ApiVersion\n ): Promise<any>;\n unloaded(): void;\n}\n\nexport interface ExtensionClientApi {\n handleRequest(message: ExtensionRequest): any | void;\n}\n\nexport interface ContextDataRequest {\n type: 'save' | 'refresh';\n contextData?: string;\n}\n\nexport interface RouteChangeRequest {\n route: string;\n}\n\nexport interface ClipboardRequest {\n type: 'write';\n value: string;\n}\n\nexport interface LocalStorageRequest {\n type: 'get' | 'set' | 'remove';\n name: string;\n value?: string;\n}\n\nexport interface TrackActionRequest {\n name: string;\n trackAction: string;\n attributes?: Record<string, any>;\n}\n\nexport interface ErrorEventRequest {\n errorEvent: ErrorEvent;\n}\n\nexport enum FetchResponseBodyType {\n json = 'json',\n text = 'text',\n}\n\nexport interface FetchDataRequest {\n resource: string;\n init?: Extract<RequestInit, 'method' | 'headers' | 'body' | 'credentials'>;\n responseBodyType?: FetchResponseBodyType;\n}\n\n/**\n * Notification type\n */\nexport enum ExtensionNotificationType {\n /**\n * Route change message sent when the route changes in the host\n * (browser forward or back buttons)\n */\n ROUTE_CHANGED = 'ROUTE_CHANGED',\n /**\n * Initialize message sent when chatty host and client have established\n * communication\n */\n INITIALIZE = 'INITIALIZE',\n /**\n * Visualization data\n */\n VISUALIZATION_DATA = 'VISUALIZATION_DATA',\n /**\n * Tile host data changed\n */\n TILE_HOST_DATA = 'TILE_HOST_DATA',\n}\n\n/**\n * Extension initialize message. Will be received once\n * when the extension is first instantiated\n */\nexport interface ExtensionInitializeMessage {\n type: ExtensionNotificationType.INITIALIZE;\n payload: LookerHostData;\n}\n\n/**\n * Route changed message. Received when the host route changes.\n * This happens when the user clicks the browser backward or\n * forward button.\n */\nexport interface ExtensionRouteChangedMessage {\n type: ExtensionNotificationType.ROUTE_CHANGED;\n payload: RouteChangeData;\n}\n\n/**\n * Visualization data. Only received by extensions visualizations.\n * <code>Looker >=22.8</code>\n */\nexport interface ExtensionVisualizationDataMessage {\n type: ExtensionNotificationType.VISUALIZATION_DATA;\n payload: RawVisualizationData;\n}\n\n/**\n * Tile Host Data Changed notificaction\n * <code>Looker >=22.8</code>\n */\nexport interface TileHostDataChangedMessage {\n type: ExtensionNotificationType.TILE_HOST_DATA;\n payload: Partial<TileHostData>;\n}\n\n/**\n * Extension notification\n */\nexport type ExtensionNotification =\n | ExtensionInitializeMessage\n | ExtensionRouteChangedMessage\n | ExtensionVisualizationDataMessage\n | TileHostDataChangedMessage;\n\n/**\n * Route change data\n */\nexport interface RouteChangeData {\n /**\n * Changed route for the extension\n */\n route?: string;\n /**\n * Changed route state\n */\n routeState?: any;\n}\n\n/**\n * Looker host type.\n * standard - Standard Looker host with the navigation bar.\n * embed - Embedded Looker host.\n * spartan - Spartan Looker host.\n */\nexport type HostType = 'standard' | 'embed' | 'spartan';\n\n/**\n * Extension mount type.\n * Fullscreen mount.\n * @deprecated <code>Looker >=22.8</code>. Use MountPoint (fullscreen is equivalent of standalone)\n */\nexport type MountType = 'fullscreen' | undefined;\n\n/**\n * Extension mount point\n * <code>Looker >=22.8</code>\n */\nexport enum MountPoint {\n standalone = 'standalone',\n dashboardVisualization = 'dashboard-visualization',\n dashboardTile = 'dashboard-tile',\n dashboardTilePopup = 'dashboard-tile-popup',\n}\n\n/**\n * Initialization data. Looker host data.\n */\nexport interface LookerHostData {\n /**\n * Extension id\n */\n extensionId: string;\n /**\n * Version of looker\n */\n lookerVersion: string;\n /**\n * Initial route for the extension\n */\n route?: string;\n /**\n * route state\n */\n routeState?: any;\n /**\n * Origin of Looker host\n * @deprecated\n */\n hostUrl?: string;\n /**\n * Origin of Looker host\n * <code>Looker >=21.8</code>\n */\n hostOrigin?: string;\n /**\n * Looker host type (standard, embed, spartan)\n * <code>Looker >=21.8</code>\n */\n hostType?: HostType;\n /**\n * Extension mount type.\n * <code>Looker >=21.8</code>\n */\n mountType?: MountType;\n /**\n * Extension mount point.\n * <code>Looker >=22.8</code>\n */\n mountPoint: MountPoint;\n /**\n * Extension context data\n */\n contextData?: string;\n /**\n * The extension is rendering to a PDF or image.\n * <code>Looker >=22.8</code>\n */\n isRendering?: boolean;\n /**\n * When true the dashboard tile has been enabled.\n * <code>Looker >=22.8</code>\n */\n extensionDashboardTileEnabled: boolean;\n}\n\n/**\n * Response returned from initialization\n */\nexport interface ExtensionInitializationResponse {\n /**\n * Version of the SDK\n */\n extensionSdkVersion: string;\n /**\n * initialization error message\n */\n errorMessage?: string;\n}\n\n/**\n * Extension host configuration\n */\nexport interface ExtensionHostConfiguration {\n /**\n * Callback once extension initialized\n * @param errorMessage details of any errors that have\n * occured during initialization\n */\n initializedCallback?: (errorMessage?: string) => void;\n /**\n * Callback to set the initial route to be restored. Ignored if\n * route tracking off\n */\n setInitialRoute?: (route: string, routeState?: any) => void;\n /**\n * Required looker version. An error will be thrown if the host\n * Looker is not at the version specified.\n */\n requiredLookerVersion?: string;\n /**\n * Callback to notify extension that host has changed the route.\n * The host changes the route when browser back or forward button\n * pressed.\n */\n hostChangedRoute?: (route: string, routeState?: any) => void;\n /**\n * Timeout for messages sent via chatty. Defaults to 30000 milliseconds.\n * Set to -1 for no timeout.\n */\n chattyTimeout?: number;\n /**\n * Callback called when visualization data received\n */\n visualizationDataReceivedCallback?: VisualizationDataReceivedCallback;\n\n /**\n * Callback called when the host is updated\n */\n tileHostDataChangedCallback?: TileHostDataChangedCallback;\n}\n\nexport interface ExtensionHostApiConfiguration\n extends ExtensionHostConfiguration {\n chattyHost: ChattyHostConnection;\n}\n\n/**\n * Custom parameters for fetch proxy\n */\nexport interface FetchCustomParameters {\n /**\n * Http method\n */\n method?: 'POST' | 'GET' | 'DELETE' | 'PATCH' | 'PUT' | 'HEAD';\n /**\n * Request headers\n */\n headers?: Record<string, string>;\n /**\n * Request body\n */\n body?: string;\n /**\n * Credentials. Controls how cookies are sent to the external API server.\n * For external APIs this should be set to include if cookies suppor is\n * credentials are or omitted or the init object is omitted, the credentials\n * desired.\n */\n credentials?: 'omit' | 'same-origin' | 'include';\n}\n\n/**\n * Fetch proxy response\n */\nexport interface FetchProxyDataResponse {\n /**\n * true if status in the 200 range\n */\n ok: boolean;\n /**\n * http response status\n */\n status: number;\n /**\n * description of the status\n */\n statusText?: string;\n /**\n * response headers\n */\n headers: Record<string, string>;\n /**\n * response body\n */\n body?: any;\n}\n\n/**\n * Fetch proxy instance. A fetch proxy can be created with a base URL and prepopulated\n * init and response body type. This allows init header setup to be centralized rather\n * than duplicating code for each fetch proxy call\n */\nexport interface FetchProxy {\n /**\n * External API proxy to the browser fetch API. Merges arguments with arguments specified\n * when the fetch proxy was created. The arguments in the call override the arguments specified\n * when the proxy was created.\n * @param resource url to call. will be concatenated to base URL is base URL was specified.\n * @param init. object containing custom parameters for fetch. Will be merged with init\n * object defined when the proxy was created.\n * @param responseBodyType indicates how to handle the response body. Overrides responseBodyType\n * specifed when proxy created.\n */\n fetchProxy(\n resource: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): Promise<FetchProxyDataResponse>;\n}\n\n/**\n * Public extension SDK\n */\nexport interface ExtensionSDK {\n /**\n * Looker host data\n */\n lookerHostData?: Readonly<LookerHostData>;\n\n /**\n * Create a tag that the Looker server will recognize as a\n * secret key to evaluated and replaced. The tag is name spaced\n * to the extension.\n * @param keyName for which a tag is required\n */\n createSecretKeyTag(keyName: string): string;\n\n /**\n * Verify that looker host is available\n */\n verifyHostConnection(): Promise<boolean>;\n\n /**\n * Update window title (if allowed)\n * @param title new window title\n */\n updateTitle(title: string): void;\n\n /**\n * Update location of current window (if allowed). Navigating to\n * a new host is NOT allowed\n * @param url - new url - should begin with '/'\n * @param state push state\n * @param target when set opens new browser window. Use\n * openBrowserWindow instead.\n */\n updateLocation(url: string, state?: any, target?: string): void;\n\n /**\n * Open new browser window with URL\n * @param url for window\n * @param target name of window. Defaults to _blank\n */\n openBrowserWindow(url: string, target?: string): void;\n\n /**\n * Close currently opened popovers (menus for example)\n */\n closeHostPopovers(): void;\n\n /**\n * Store an item in local storage. Note that local storage is name\n * spaced to the extension. It is not necessary to include the extension\n * name in the name of the item.\n * @param name of item\n * @param value to store in local storage\n */\n localStorageSetItem(name: string, value?: string): Promise<boolean>;\n\n /**\n * Get an item from local storage. Note that local storage is name\n * spaced to the extension. It is not necessary to include the extension\n * name in the name of the item.\n * @param name of item\n */\n localStorageRemoveItem(name: string): Promise<boolean>;\n\n /**\n * Remove an item from local storage. Note that local storage is name\n * spaced to the extension. It is not necessary to include the extension\n * name in the name of the item.\n * @param name of item\n */\n localStorageGetItem(name: string): Promise<string | null>;\n\n /**\n * Write string to clipboard.\n * @param value to write to clipboard.\n */\n clipboardWrite(value: string): Promise<void>;\n\n /**\n * Set a user attribute value.\n * @param name of item\n * @param value to store in local storage\n */\n userAttributeSetItem(name: string, value?: string): Promise<boolean>;\n /**\n * Get a user attribute value.\n * @param name of item\n */\n userAttributeGetItem(name: string): Promise<string | null>;\n /**\n * Reset a user attribute value to the default\n * @param name of item\n */\n userAttributeResetItem(name: string): Promise<void>;\n /**\n * Track some kind of action.\n * @param name of action\n * @param trackAction of action\n * @param attributes associated with action\n */\n track(\n name: string,\n trackAction: string,\n attributes?: Record<string, any>\n ): void;\n\n /**\n * Error event details. Report error details to the Looker host\n * Notes:\n * 1. Because crossorigin is not set on the script tag that loads the extension\n * details of the error cannot be determined.\n * 2. In development mode (at least if react is being used), an error will\n * be recorded twice. This is because react reports the failure to get\n * details of the error as an error.\n */\n error(errorEvent: ErrorEvent): void;\n\n /**\n * Notify host that client route has changed\n * @param route\n * @param routeState state of route\n */\n clientRouteChanged(route: string, routeState?: any): void;\n\n /**\n * Get the context associated with the extension. The context can be of any\n * JSON serializable type.\n *\n * Note that a separate copy of the context will be returned each time getContext\n * is called so an update to context object will not be reflected in subsequent\n * calls UNLESS saveContext is called.\n */\n getContextData(): any;\n\n /**\n * Save the context data in the Looker server and return a copy of the context data.\n * Subsequent calls to getContext will return the updated context data.\n *\n * Note that context data is shared amongst all users of the extension regardless of\n * role (in otherwords context does not support permissions). Care should be taken when\n * updating context data as the last write wins and extensions generally read the context data\n * once on extension load (see refreshContext for exception). The context should only be used\n * for data that rarely changes.\n *\n * @param contextData to save\n * @return current context data\n */\n saveContextData(contextData: any): Promise<any>;\n\n /**\n * Get the lastest version of context data from the Looker server.\n *\n * Should another user update the context data this method can be used to get the lastest data\n * without reloading the extension. Note that there is not a mechanism to indicate\n * that the context data has been modified.\n */\n refreshContextData(): Promise<any>;\n\n /**\n * Create a fetch proxy instance. Allows set up init parameter to be centalized into one place\n * @param baseUrl root URL to call. The resource on the fetch call will be appended to the baseUrl\n * @param init. object containing custom parameters for fetch.\n * @param responseBodyType indicates how to handle the response body. If omitted an attempt will be made\n * to determine how to handle the response body based upon the content type of the\n * response. Ultimately it defaults to a text response.\n * @return current context data\n */\n createFetchProxy(\n baseUrl?: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): FetchProxy;\n\n /**\n * External API proxy to the browser fetch API.\n * Do not attempt to call internal Looker APIs. Any attempt to do so will be rejected.\n * Protocol MUST be https.\n * Entitlements must be defined for the extension in the manifest application in order to use this feature.\n * At a minimum, the domain and top level domain must be specified in the entitlements.\n * @param resource url to call\n * @param init. object containing custom parameters for fetch.\n * @param responseBodyType indicates how to handle the response body. If omitted an attempt will be made\n * to determine how to handle the response body based upon the content type of the\n * response. Ultimately it defaults to a text response.\n */\n fetchProxy(\n resource: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): Promise<FetchProxyDataResponse>;\n\n /**\n * External API server proxy. Similar to fetch proxy except that external API calls are made\n * through the Looker instance. This allows the request to be embedded with secret keys stored\n * in the Looker server. This method should only be used for secret key/token exchange calls\n * as it adds additional overhead to the external API (network and competing for resources on\n * the Looker server). Note that there is no server proxy equivalent to createFetchProxy.\n * Entitlements must be defined for the extension in the manifest application in order to use this feature.\n * At a minimum, the domain and top level domain must be specified in the entitlements.\n * The Looker server will examine the request URL, headers amd body for handlebar ({{ KEY_NAME }}) expressions.\n * If found, the expression will be substituted with key values obtained from user attributes where the user\n * attribute is a combination of EXTENSION_ID::KEY_NAME.\n * @param resource url to call\n * @param init. object containing custom parameters for server call.\n * @param responseBodyType indicates how to handle the response body. If omitted an attempt will be made\n * to determine how to handle the response body based upon the content type of the\n * response. Ultimately it defaults to a text response.\n */\n serverProxy(\n resource: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): Promise<FetchProxyDataResponse>;\n\n /**\n * Oauth2 authentication. Authentication relies on a new window being\n * created and a form being submitted. The authParameters become inputs\n * to the form submission.\n * @param authEndpoint endpoint responsible for the authentication.\n * An oauth2 url entitlement MUST be defined for\n * the end point.\n * @param authParameters parameters to be included in the request.\n * client_id MUST be included\n * scope MUST be included\n * redirect_uri MUST NOT be included - will be set by host\n * response_type MUST NOT be included - will be set to 'token' by host\n * state OPTIONAL - If omitted will be generated by host.\n * code_challenge_method optional - set to 'S256' to use code challenge\n * rather than secret key.\n * @param httpMethod used for submission. Defaults to 'POST'.\n */\n oauth2Authenticate(\n authEndpoint: string,\n authParameters: Record<string, string>,\n httpMethod?: string\n ): Promise<any>;\n\n /**\n * Oauth2 exchange code for token. This is actually a wrapper around\n * serverProxy or fetch with some specialized processing. If the code_challenge_method\n * was used in the oauth2Authenticate call then fetch is used otherwise serverProxy is\n * used. It is expected that this method is called immediately after oauth2Authenticate.\n * The state, redirect url and code verifier (code_challenge_method only)\n * are saved from the oauth2Authenticate call and included in the exchange\n * for token call.\n * Note, currently code_challenge_method and secret key usage are mutually exclusive.\n * @param authEndpoint endpoint responsible for the code exchange\n * An oauth2 url entitlement MUST be defined for\n * the end point.\n * @param authParameters parameters to be included in the request.\n * Note that state and redirect_uri parameters\n * will automatically be added to this object.\n * If code challenge is not being used a client secret tag\n * must be added to the request. The client\n * secret tag is generated using the createSecretKeyTag\n * method.\n * If code challenge is being used the code_verifier is added\n * to the message.\n */\n oauth2ExchangeCodeForToken(\n authEndpoint: string,\n authParameters: Record<string, string>\n ): Promise<any>;\n\n /**\n * Log user out of Looker. Only works when running under /spartan\n */\n spartanLogout(): void;\n\n /**\n * Indicate that an extension has been rendered.\n * <code>Looker >=22.8</code>\n */\n rendered(failureMessage?: string): void;\n\n /**\n * Visualization API.\n */\n visualizationSDK: VisualizationSDK;\n\n /**\n * Tile API.\n */\n tileSDK: TileSDK;\n\n /**\n * Returns true if dashboard mount is supported. There are two\n * checks involved:\n * 1. The extension mount point is configured correctly\n * 2. The Looker host system supports it.\n */\n isDashboardMountSupported: boolean;\n}\n"],"mappings":"AAyCA,WAAYA,cAAc,aAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAe1B,WAAYC,oBAAoB,aAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAqIhC,WAAYC,UAAU,aAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAiFtB,WAAYC,qBAAqB,aAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAcjC,WAAYC,yBAAyB,aAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA;AAoGrC,WAAYC,UAAU,aAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA"}
1
+ {"version":3,"file":"types.js","names":["ExtensionEvent","ExtensionRequestType","ApiVersion","FetchResponseBodyType","ExtensionNotificationType","MountPoint"],"sources":["../../../src/connect/types.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { ChattyHostConnection } from '@looker/chatty';\nimport type {\n RawVisualizationData,\n VisualizationDataReceivedCallback,\n VisualizationSDK,\n} from './visualization';\nimport type {\n TileHostData,\n TileHostDataChangedCallback,\n TileSDK,\n} from './tile';\n\n/**\n * Extension event used for chatty communication\n */\nexport enum ExtensionEvent {\n /**\n * Notification from host to client\n */\n EXTENSION_HOST_NOTIFICATION = 'EXTENSION_NOTIFICATION',\n /**\n * Process request from client.\n */\n EXTENSION_API_REQUEST = 'EXTENSION_API_REQUEST',\n}\n\n/**\n * Request types used by the underlying API. The ENTENSION_API_REQUEST delegates\n * work based upon the request type\n */\nexport enum ExtensionRequestType {\n /**\n * Context data request\n */\n CONTEXT_DATA = 'CONTEXT_DATA',\n /**\n * Verify that the host exists and is working correctly. Host is the Looker window\n * instance that owns the client IFRAME.\n */\n VERIFY_HOST = 'VERIFY_HOST',\n /**\n * Execute a call on the Looker CORE SDK\n */\n INVOKE_CORE_SDK = 'INVOKE_CORE_SDK',\n /**\n * Execute a raw request on the Looker CORE SDK\n */\n RAW_INVOKE_CORE_SDK = 'RAW_INVOKE_CORE_SDK',\n /**\n * Update title\n */\n UPDATE_TITLE = 'UPDATE_TITLE',\n /**\n * Update location\n */\n UPDATE_LOCATION = 'UPDATE_LOCATION',\n /**\n * Location route changed\n */\n ROUTE_CHANGED = 'ROUTE_CHANGED',\n /**\n * Close popovers in the looker host\n */\n CLOSE_HOST_POPOVERS = 'CLOSE_HOST_POPOVERS',\n /**\n * Clipboard request\n */\n CLIPBOARD = 'CLIPBOARD',\n /**\n * Local storage request\n */\n LOCAL_STORAGE = 'LOCAL_STORAGE',\n /**\n * Read user attribute action\n */\n USER_ATTRIBUTE = 'USER_ATTRIBUTE',\n /**\n * Track action\n */\n TRACK_ACTION = 'TRACK_ACTION',\n /**\n * Error event\n */\n ERROR_EVENT = 'ERROR_EVENT',\n /**\n * Invoke external API\n */\n INVOKE_EXTERNAL_API = 'INVOKE_EXTERNAL_API',\n /**\n * Extension unloaded\n */\n EXTENSION_UNLOADED = 'EXTENSION_UNLOADED',\n /**\n * Log out of Looker from /spartan extension\n *\n * Only works from within the /spartan context. It will not work for\n * extensions running under /extensions\n */\n SPARTAN_LOGOUT = 'SPARTAN_LOGOUT',\n /**\n * Extension rendered\n */\n RENDERED = 'RENDERED',\n /**\n * Set up the visConfig options that should be present in an explore\n */\n VIS_DEFAULT_CONFIG = 'VIS_DEFAULT_CONFIG',\n /**\n * Change visualization configuration after intial load\n */\n VIS_CONFIG_UPDATE = 'VIS_CONFIG_UPDATE',\n /**\n * Tile add error messages\n */\n TILE_ADD_ERRORS = 'TILE_ADD_ERRORS',\n /**\n * Tile clear error messages\n */\n TILE_CLEAR_ERRORS = 'TILE_CLEAR_ERRORS',\n /**\n * Tile open drill menu\n */\n TILE_OPEN_DRILL_MENU = 'TILE_OPEN_DRILL_MENU',\n /**\n * Tile toggle cross filter\n */\n TILE_TOGGLE_CROSS_FILTER = 'TILE_TOGGLE_CROSS_FILTER',\n /**\n * Tile update row limit\n */\n TILE_ROW_LIMIT_UPDATE = 'TILE_ROW_LIMIT_UPDATE',\n /**\n * Tile run dashboard. Indicates that the dashboard queries should be run.\n */\n TILE_RUN_DASHBOARD = 'TILE_RUN_DASHBOARD',\n /**\n * Tile stop dashboard. Indicates to a dashboard that a queries should be stopped\n */\n TILE_STOP_DASHBOARD = 'TILE_STOP_DASHBOARD',\n /**\n * Tile update filters. Update the filters of the dashboard.\n */\n TILE_UPDATE_FILTERS = 'TILE_UPDATE_FILTERS',\n /**\n * Open schedule dialog.\n */\n TILE_OPEN_SCHEDULE_DIALOG = 'TILE_OPEN_SCHEDULE_DIALOG',\n}\n\n/**\n * The message that is associated with the Chatty EXTENSION_API_REQUEST event\n */\nexport interface ExtensionRequest {\n /**\n * Extension request type\n */\n type: ExtensionRequestType;\n /**\n * Optional payload associated with extension request type\n */\n payload?: InvokeCoreSdkRequest | undefined;\n}\n\nexport enum ApiVersion {\n sdk40 = '4.0',\n}\n\nexport interface InvokeCoreSdkRequest {\n apiMethodName?: string;\n httpMethod?: string;\n path?: string;\n body?: any;\n params?: any;\n options?: any;\n apiVersion?: ApiVersion;\n}\n\nexport interface UpdateTitleRequest {\n title: string;\n}\n\nexport interface UpdateLocationRequest {\n url: string;\n state?: any;\n}\n\nexport interface ExtensionHostApi extends ExtensionSDK {\n isDashboardMountSupported: boolean;\n handleNotification(\n message: ExtensionNotification\n ): ExtensionInitializationResponse | undefined;\n invokeCoreSdk(\n httpMethod: string,\n path: string,\n body?: any,\n params?: any,\n authenticator?: any,\n options?: any,\n apiVersion?: ApiVersion\n ): Promise<any>;\n invokeCoreSdkRaw(\n httpMethod: string,\n path: string,\n body?: any,\n params?: any,\n apiVersion?: ApiVersion\n ): Promise<any>;\n unloaded(): void;\n}\n\nexport interface ExtensionClientApi {\n handleRequest(message: ExtensionRequest): any | void;\n}\n\nexport interface ContextDataRequest {\n type: 'save' | 'refresh';\n contextData?: string;\n}\n\nexport interface RouteChangeRequest {\n route: string;\n}\n\nexport interface ClipboardRequest {\n type: 'write';\n value: string;\n}\n\nexport interface LocalStorageRequest {\n type: 'get' | 'set' | 'remove';\n name: string;\n value?: string;\n}\n\nexport interface TrackActionRequest {\n name: string;\n trackAction: string;\n attributes?: Record<string, any>;\n}\n\nexport interface ErrorEventRequest {\n errorEvent: ErrorEvent;\n}\n\nexport enum FetchResponseBodyType {\n json = 'json',\n text = 'text',\n}\n\nexport interface FetchDataRequest {\n resource: string;\n init?: Extract<RequestInit, 'method' | 'headers' | 'body' | 'credentials'>;\n responseBodyType?: FetchResponseBodyType;\n}\n\n/**\n * Notification type\n */\nexport enum ExtensionNotificationType {\n /**\n * Route change message sent when the route changes in the host\n * (browser forward or back buttons)\n */\n ROUTE_CHANGED = 'ROUTE_CHANGED',\n /**\n * Initialize message sent when chatty host and client have established\n * communication\n */\n INITIALIZE = 'INITIALIZE',\n /**\n * Visualization data\n */\n VISUALIZATION_DATA = 'VISUALIZATION_DATA',\n /**\n * Tile host data changed\n */\n TILE_HOST_DATA = 'TILE_HOST_DATA',\n}\n\n/**\n * Extension initialize message. Will be received once\n * when the extension is first instantiated\n */\nexport interface ExtensionInitializeMessage {\n type: ExtensionNotificationType.INITIALIZE;\n payload: LookerHostData;\n}\n\n/**\n * Route changed message. Received when the host route changes.\n * This happens when the user clicks the browser backward or\n * forward button.\n */\nexport interface ExtensionRouteChangedMessage {\n type: ExtensionNotificationType.ROUTE_CHANGED;\n payload: RouteChangeData;\n}\n\n/**\n * Visualization data. Only received by extensions visualizations.\n * <code>Looker >=22.8</code>\n */\nexport interface ExtensionVisualizationDataMessage {\n type: ExtensionNotificationType.VISUALIZATION_DATA;\n payload: RawVisualizationData;\n}\n\n/**\n * Tile Host Data Changed notificaction\n * <code>Looker >=22.8</code>\n */\nexport interface TileHostDataChangedMessage {\n type: ExtensionNotificationType.TILE_HOST_DATA;\n payload: Partial<TileHostData>;\n}\n\n/**\n * Extension notification\n */\nexport type ExtensionNotification =\n | ExtensionInitializeMessage\n | ExtensionRouteChangedMessage\n | ExtensionVisualizationDataMessage\n | TileHostDataChangedMessage;\n\n/**\n * Route change data\n */\nexport interface RouteChangeData {\n /**\n * Changed route for the extension\n */\n route?: string;\n /**\n * Changed route state\n */\n routeState?: any;\n}\n\n/**\n * Looker host type.\n * standard - Standard Looker host with the navigation bar.\n * embed - Embedded Looker host.\n * spartan - Spartan Looker host.\n */\nexport type HostType = 'standard' | 'embed' | 'spartan';\n\n/**\n * Extension mount type.\n * Fullscreen mount.\n * @deprecated <code>Looker >=22.8</code>. Use MountPoint (fullscreen is equivalent of standalone)\n */\nexport type MountType = 'fullscreen' | undefined;\n\n/**\n * Extension mount point\n * <code>Looker >=22.8</code>\n */\nexport enum MountPoint {\n standalone = 'standalone',\n dashboardVisualization = 'dashboard-visualization',\n dashboardTile = 'dashboard-tile',\n dashboardTilePopup = 'dashboard-tile-popup',\n}\n\n/**\n * Initialization data. Looker host data.\n */\nexport interface LookerHostData {\n /**\n * Extension id\n */\n extensionId: string;\n /**\n * Version of looker\n */\n lookerVersion: string;\n /**\n * Initial route for the extension\n */\n route?: string;\n /**\n * route state\n */\n routeState?: any;\n /**\n * Origin of Looker host\n * @deprecated\n */\n hostUrl?: string;\n /**\n * Origin of Looker host\n * <code>Looker >=21.8</code>\n */\n hostOrigin?: string;\n /**\n * Looker host type (standard, embed, spartan)\n * <code>Looker >=21.8</code>\n */\n hostType?: HostType;\n /**\n * Extension mount type.\n * <code>Looker >=21.8</code>\n */\n mountType?: MountType;\n /**\n * Extension mount point.\n * <code>Looker >=22.8</code>\n */\n mountPoint: MountPoint;\n /**\n * Extension context data\n */\n contextData?: string;\n /**\n * The extension is rendering to a PDF or image.\n * <code>Looker >=22.8</code>\n */\n isRendering?: boolean;\n /**\n * When true the dashboard tile has been enabled.\n * <code>Looker >=22.8</code>\n */\n extensionDashboardTileEnabled: boolean;\n}\n\n/**\n * Response returned from initialization\n */\nexport interface ExtensionInitializationResponse {\n /**\n * Version of the SDK\n */\n extensionSdkVersion: string;\n /**\n * initialization error message\n */\n errorMessage?: string;\n}\n\n/**\n * Extension host configuration\n */\nexport interface ExtensionHostConfiguration {\n /**\n * Callback once extension initialized\n * @param errorMessage details of any errors that have\n * occured during initialization\n */\n initializedCallback?: (errorMessage?: string) => void;\n /**\n * Callback to set the initial route to be restored. Ignored if\n * route tracking off\n */\n setInitialRoute?: (route: string, routeState?: any) => void;\n /**\n * Required looker version. An error will be thrown if the host\n * Looker is not at the version specified.\n */\n requiredLookerVersion?: string;\n /**\n * Callback to notify extension that host has changed the route.\n * The host changes the route when browser back or forward button\n * pressed.\n */\n hostChangedRoute?: (route: string, routeState?: any) => void;\n /**\n * Timeout for messages sent via chatty. Defaults to 30000 milliseconds.\n * Set to -1 for no timeout.\n */\n chattyTimeout?: number;\n /**\n * Callback called when visualization data received\n */\n visualizationDataReceivedCallback?: VisualizationDataReceivedCallback;\n\n /**\n * Callback called when the host is updated\n */\n tileHostDataChangedCallback?: TileHostDataChangedCallback;\n}\n\nexport interface ExtensionHostApiConfiguration\n extends ExtensionHostConfiguration {\n chattyHost: ChattyHostConnection;\n}\n\n/**\n * Custom parameters for fetch proxy\n */\nexport interface FetchCustomParameters {\n /**\n * Http method\n */\n method?: 'POST' | 'GET' | 'DELETE' | 'PATCH' | 'PUT' | 'HEAD';\n /**\n * Request headers\n */\n headers?: Record<string, string>;\n /**\n * Request body\n */\n body?: string;\n /**\n * Credentials. Controls how cookies are sent to the external API server.\n * For external APIs this should be set to include if cookies suppor is\n * credentials are or omitted or the init object is omitted, the credentials\n * desired.\n */\n credentials?: 'omit' | 'same-origin' | 'include';\n}\n\n/**\n * Fetch proxy response\n */\nexport interface FetchProxyDataResponse {\n /**\n * true if status in the 200 range\n */\n ok: boolean;\n /**\n * http response status\n */\n status: number;\n /**\n * description of the status\n */\n statusText?: string;\n /**\n * response headers\n */\n headers: Record<string, string>;\n /**\n * response body\n */\n body?: any;\n}\n\n/**\n * Fetch proxy instance. A fetch proxy can be created with a base URL and prepopulated\n * init and response body type. This allows init header setup to be centralized rather\n * than duplicating code for each fetch proxy call\n */\nexport interface FetchProxy {\n /**\n * External API proxy to the browser fetch API. Merges arguments with arguments specified\n * when the fetch proxy was created. The arguments in the call override the arguments specified\n * when the proxy was created.\n * @param resource url to call. will be concatenated to base URL is base URL was specified.\n * @param init. object containing custom parameters for fetch. Will be merged with init\n * object defined when the proxy was created.\n * @param responseBodyType indicates how to handle the response body. Overrides responseBodyType\n * specifed when proxy created.\n */\n fetchProxy(\n resource: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): Promise<FetchProxyDataResponse>;\n}\n\n/**\n * Public extension SDK\n */\nexport interface ExtensionSDK {\n /**\n * Looker host data\n */\n lookerHostData?: Readonly<LookerHostData>;\n\n /**\n * Create a tag that the Looker server will recognize as a\n * secret key to evaluated and replaced. The tag is name spaced\n * to the extension.\n * @param keyName for which a tag is required\n */\n createSecretKeyTag(keyName: string): string;\n\n /**\n * Verify that looker host is available\n */\n verifyHostConnection(): Promise<boolean>;\n\n /**\n * Update window title (if allowed)\n * @param title new window title\n */\n updateTitle(title: string): void;\n\n /**\n * Update location of current window (if allowed). Navigating to\n * a new host is NOT allowed\n * @param url - new url - should begin with '/'\n * @param state push state\n * @param target when set opens new browser window. Use\n * openBrowserWindow instead.\n */\n updateLocation(url: string, state?: any, target?: string): void;\n\n /**\n * Open new browser window with URL\n * @param url for window\n * @param target name of window. Defaults to _blank\n */\n openBrowserWindow(url: string, target?: string): void;\n\n /**\n * Close currently opened popovers (menus for example)\n */\n closeHostPopovers(): void;\n\n /**\n * Store an item in local storage. Note that local storage is name\n * spaced to the extension. It is not necessary to include the extension\n * name in the name of the item.\n * @param name of item\n * @param value to store in local storage\n */\n localStorageSetItem(name: string, value?: string): Promise<boolean>;\n\n /**\n * Get an item from local storage. Note that local storage is name\n * spaced to the extension. It is not necessary to include the extension\n * name in the name of the item.\n * @param name of item\n */\n localStorageRemoveItem(name: string): Promise<boolean>;\n\n /**\n * Remove an item from local storage. Note that local storage is name\n * spaced to the extension. It is not necessary to include the extension\n * name in the name of the item.\n * @param name of item\n */\n localStorageGetItem(name: string): Promise<string | null>;\n\n /**\n * Write string to clipboard.\n * @param value to write to clipboard.\n */\n clipboardWrite(value: string): Promise<void>;\n\n /**\n * Set a user attribute value.\n * @param name of item\n * @param value to store in local storage\n */\n userAttributeSetItem(name: string, value?: string): Promise<boolean>;\n /**\n * Get a user attribute value.\n * @param name of item\n */\n userAttributeGetItem(name: string): Promise<string | null>;\n /**\n * Reset a user attribute value to the default\n * @param name of item\n */\n userAttributeResetItem(name: string): Promise<void>;\n /**\n * Track some kind of action.\n * @param name of action\n * @param trackAction of action\n * @param attributes associated with action\n */\n track(\n name: string,\n trackAction: string,\n attributes?: Record<string, any>\n ): void;\n\n /**\n * Error event details. Report error details to the Looker host\n * Notes:\n * 1. Because crossorigin is not set on the script tag that loads the extension\n * details of the error cannot be determined.\n * 2. In development mode (at least if react is being used), an error will\n * be recorded twice. This is because react reports the failure to get\n * details of the error as an error.\n */\n error(errorEvent: ErrorEvent): void;\n\n /**\n * Notify host that client route has changed\n * @param route\n * @param routeState state of route\n */\n clientRouteChanged(route: string, routeState?: any): void;\n\n /**\n * Get the context associated with the extension. The context can be of any\n * JSON serializable type.\n *\n * Note that a separate copy of the context will be returned each time getContext\n * is called so an update to context object will not be reflected in subsequent\n * calls UNLESS saveContext is called.\n */\n getContextData(): any;\n\n /**\n * Save the context data in the Looker server and return a copy of the context data.\n * Subsequent calls to getContext will return the updated context data.\n *\n * Note that context data is shared amongst all users of the extension regardless of\n * role (in otherwords context does not support permissions). Care should be taken when\n * updating context data as the last write wins and extensions generally read the context data\n * once on extension load (see refreshContext for exception). The context should only be used\n * for data that rarely changes.\n *\n * @param contextData to save\n * @return current context data\n */\n saveContextData(contextData: any): Promise<any>;\n\n /**\n * Get the lastest version of context data from the Looker server.\n *\n * Should another user update the context data this method can be used to get the lastest data\n * without reloading the extension. Note that there is not a mechanism to indicate\n * that the context data has been modified.\n */\n refreshContextData(): Promise<any>;\n\n /**\n * Create a fetch proxy instance. Allows set up init parameter to be centalized into one place\n * @param baseUrl root URL to call. The resource on the fetch call will be appended to the baseUrl\n * @param init. object containing custom parameters for fetch.\n * @param responseBodyType indicates how to handle the response body. If omitted an attempt will be made\n * to determine how to handle the response body based upon the content type of the\n * response. Ultimately it defaults to a text response.\n * @return current context data\n */\n createFetchProxy(\n baseUrl?: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): FetchProxy;\n\n /**\n * External API proxy to the browser fetch API.\n * Do not attempt to call internal Looker APIs. Any attempt to do so will be rejected.\n * Protocol MUST be https.\n * Entitlements must be defined for the extension in the manifest application in order to use this feature.\n * At a minimum, the domain and top level domain must be specified in the entitlements.\n * @param resource url to call\n * @param init. object containing custom parameters for fetch.\n * @param responseBodyType indicates how to handle the response body. If omitted an attempt will be made\n * to determine how to handle the response body based upon the content type of the\n * response. Ultimately it defaults to a text response.\n */\n fetchProxy(\n resource: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): Promise<FetchProxyDataResponse>;\n\n /**\n * External API server proxy. Similar to fetch proxy except that external API calls are made\n * through the Looker instance. This allows the request to be embedded with secret keys stored\n * in the Looker server. This method should only be used for secret key/token exchange calls\n * as it adds additional overhead to the external API (network and competing for resources on\n * the Looker server). Note that there is no server proxy equivalent to createFetchProxy.\n * Entitlements must be defined for the extension in the manifest application in order to use this feature.\n * At a minimum, the domain and top level domain must be specified in the entitlements.\n * The Looker server will examine the request URL, headers amd body for handlebar ({{ KEY_NAME }}) expressions.\n * If found, the expression will be substituted with key values obtained from user attributes where the user\n * attribute is a combination of EXTENSION_ID::KEY_NAME.\n * @param resource url to call\n * @param init. object containing custom parameters for server call.\n * @param responseBodyType indicates how to handle the response body. If omitted an attempt will be made\n * to determine how to handle the response body based upon the content type of the\n * response. Ultimately it defaults to a text response.\n */\n serverProxy(\n resource: string,\n init?: FetchCustomParameters,\n responseBodyType?: FetchResponseBodyType\n ): Promise<FetchProxyDataResponse>;\n\n /**\n * Oauth2 authentication. Authentication relies on a new window being\n * created and a form being submitted. The authParameters become inputs\n * to the form submission.\n * @param authEndpoint endpoint responsible for the authentication.\n * An oauth2 url entitlement MUST be defined for\n * the end point.\n * @param authParameters parameters to be included in the request.\n * client_id MUST be included\n * scope MUST be included\n * redirect_uri MUST NOT be included - will be set by host\n * response_type MUST NOT be included - will be set to 'token' by host\n * state OPTIONAL - If omitted will be generated by host.\n * code_challenge_method optional - set to 'S256' to use code challenge\n * rather than secret key.\n * @param httpMethod used for submission. Defaults to 'POST'.\n * @deprecated\n */\n oauth2Authenticate(\n authEndpoint: string,\n authParameters: Record<string, string>,\n httpMethod?: string\n ): Promise<any>;\n\n /**\n * Oauth2 exchange code for token. This is actually a wrapper around\n * serverProxy or fetch with some specialized processing. If the code_challenge_method\n * was used in the oauth2Authenticate call then fetch is used otherwise serverProxy is\n * used. It is expected that this method is called immediately after oauth2Authenticate.\n * The state, redirect url and code verifier (code_challenge_method only)\n * are saved from the oauth2Authenticate call and included in the exchange\n * for token call.\n * Note, currently code_challenge_method and secret key usage are mutually exclusive.\n * @param authEndpoint endpoint responsible for the code exchange\n * An oauth2 url entitlement MUST be defined for\n * the end point.\n * @param authParameters parameters to be included in the request.\n * Note that state and redirect_uri parameters\n * will automatically be added to this object.\n * If code challenge is not being used a client secret tag\n * must be added to the request. The client\n * secret tag is generated using the createSecretKeyTag\n * method.\n * If code challenge is being used the code_verifier is added\n * to the message.\n * @deprecated\n */\n oauth2ExchangeCodeForToken(\n authEndpoint: string,\n authParameters: Record<string, string>\n ): Promise<any>;\n\n /**\n * Log user out of Looker. Only works when running under /spartan\n */\n spartanLogout(): void;\n\n /**\n * Indicate that an extension has been rendered.\n * <code>Looker >=22.8</code>\n */\n rendered(failureMessage?: string): void;\n\n /**\n * Visualization API.\n */\n visualizationSDK: VisualizationSDK;\n\n /**\n * Tile API.\n */\n tileSDK: TileSDK;\n\n /**\n * Returns true if dashboard mount is supported. There are two\n * checks involved:\n * 1. The extension mount point is configured correctly\n * 2. The Looker host system supports it.\n */\n isDashboardMountSupported: boolean;\n}\n"],"mappings":"AAyCA,WAAYA,cAAc,aAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAe1B,WAAYC,oBAAoB,aAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAqIhC,WAAYC,UAAU,aAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAiFtB,WAAYC,qBAAqB,aAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAcjC,WAAYC,yBAAyB,aAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA;AAoGrC,WAAYC,UAAU,aAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@looker/extension-sdk",
3
- "version": "24.12.1",
3
+ "version": "24.14.0",
4
4
  "description": "Looker Extension SDK",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@looker/chatty": "2.3.9",
43
- "@looker/sdk": "24.12.1",
43
+ "@looker/sdk": "24.14.0",
44
44
  "@looker/sdk-rtl": "21.6.1",
45
45
  "deepmerge": "^4.2.2",
46
46
  "readable-stream": "^3.4.0",
@@ -52,5 +52,5 @@
52
52
  "Looker",
53
53
  "extension-sdk"
54
54
  ],
55
- "gitHead": "e593102f095685cbdb55e573f085d338209f38d8"
55
+ "gitHead": "0c6b5c02305ad67f559213a281667ba5cbb3b3c3"
56
56
  }