@looker/extension-sdk 26.6.0 → 26.8.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/lib/connect/connect_extension_host.js +66 -65
  3. package/lib/connect/connect_extension_host.js.map +1 -1
  4. package/lib/connect/extension_host_api.js +40 -40
  5. package/lib/connect/extension_host_api.js.map +1 -1
  6. package/lib/connect/fetch_proxy.js +3 -3
  7. package/lib/connect/fetch_proxy.js.map +1 -1
  8. package/lib/connect/global_listener.js.map +1 -1
  9. package/lib/connect/index.js.map +1 -1
  10. package/lib/connect/tile/index.js.map +1 -1
  11. package/lib/connect/tile/tile_sdk.js +2 -2
  12. package/lib/connect/tile/tile_sdk.js.map +1 -1
  13. package/lib/connect/tile/types.js.map +1 -1
  14. package/lib/connect/types.js.map +1 -1
  15. package/lib/connect/visualization/index.js.map +1 -1
  16. package/lib/connect/visualization/types.js +4 -0
  17. package/lib/connect/visualization/types.js.map +1 -1
  18. package/lib/connect/visualization/visualization_sdk.js +6 -6
  19. package/lib/connect/visualization/visualization_sdk.js.map +1 -1
  20. package/lib/esm/connect/connect_extension_host.js +66 -65
  21. package/lib/esm/connect/connect_extension_host.js.map +1 -1
  22. package/lib/esm/connect/extension_host_api.js +39 -39
  23. package/lib/esm/connect/extension_host_api.js.map +1 -1
  24. package/lib/esm/connect/fetch_proxy.js +2 -2
  25. package/lib/esm/connect/fetch_proxy.js.map +1 -1
  26. package/lib/esm/connect/global_listener.js.map +1 -1
  27. package/lib/esm/connect/index.js.map +1 -1
  28. package/lib/esm/connect/tile/index.js.map +1 -1
  29. package/lib/esm/connect/tile/tile_sdk.js +2 -2
  30. package/lib/esm/connect/tile/tile_sdk.js.map +1 -1
  31. package/lib/esm/connect/tile/types.js.map +1 -1
  32. package/lib/esm/connect/types.js.map +1 -1
  33. package/lib/esm/connect/visualization/index.js.map +1 -1
  34. package/lib/esm/connect/visualization/types.js +1 -1
  35. package/lib/esm/connect/visualization/types.js.map +1 -1
  36. package/lib/esm/connect/visualization/visualization_sdk.js +6 -6
  37. package/lib/esm/connect/visualization/visualization_sdk.js.map +1 -1
  38. package/lib/esm/index.js.map +1 -1
  39. package/lib/esm/sdk/extension_sdk.js.map +1 -1
  40. package/lib/esm/sdk/index.js.map +1 -1
  41. package/lib/esm/sdk/sdk_connection.js +2 -2
  42. package/lib/esm/sdk/sdk_connection.js.map +1 -1
  43. package/lib/esm/util/errors.js.map +1 -1
  44. package/lib/esm/util/index.js.map +1 -1
  45. package/lib/esm/util/logger.js.map +1 -1
  46. package/lib/index.js.map +1 -1
  47. package/lib/sdk/extension_sdk.js.map +1 -1
  48. package/lib/sdk/index.js.map +1 -1
  49. package/lib/sdk/sdk_connection.js +2 -2
  50. package/lib/sdk/sdk_connection.js.map +1 -1
  51. package/lib/util/errors.js.map +1 -1
  52. package/lib/util/index.js.map +1 -1
  53. package/lib/util/logger.js.map +1 -1
  54. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/connect/visualization/types.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 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 { Row } from '../tile';\n\n/**\n * Callback that is invoked when visualization data is received\n * <code>Looker >=22.8</code>\n */\nexport type VisualizationDataReceivedCallback = (\n visualizationData: RawVisualizationData\n) => void;\n\n/**\n * Raw visualization data. Basic typing for configuration data\n * and query data.\n * <code>Looker >=22.8</code>\n */\nexport interface RawVisualizationData {\n visConfig: RawVisConfig;\n queryResponse: RawVisQueryResponse;\n}\n\n/**\n * Visualization configuration. Configuration data set in the\n * explore.\n * <code>Looker >=22.8</code>\n */\nexport interface RawVisConfig {\n [key: string]: RawVisConfigValue;\n}\n\nexport type RawVisConfigValue = any;\n\n/**\n * Query response data\n * <code>Looker >=22.8</code>\n */\nexport interface RawVisQueryResponse {\n [key: string]: any;\n data: RawVisData;\n fields: {\n [key: string]: any[];\n };\n pivots: RawPivotConfig[];\n}\n\nexport type RawVisData = Row[];\n\nexport interface RawPivotConfig {\n key: string;\n is_total: boolean;\n data: { [key: string]: string };\n metadata: { [key: string]: { [key: string]: string } };\n}\n\nexport interface Measure extends RawVisConfig {\n [key: string]: any;\n}\n\nexport interface Dimension extends RawVisConfig {\n [key: string]: any;\n}\n\nexport interface TableCalculation {\n [key: string]: any;\n}\n\nexport interface PivotConfig extends RawPivotConfig {\n [key: string]: any;\n}\n\n/**\n * Visualization configuration data.\n */\nexport interface VisualizationConfig {\n /**\n * Measure information\n */\n queryFieldMeasures: Measure[];\n /**\n * Dimension information\n */\n queryFieldDimensions: Dimension[];\n /**\n * Table calculation information\n */\n queryFieldTableCalculations: TableCalculation[];\n /**\n * Pivot information\n */\n queryFieldPivots: PivotConfig[];\n /**\n * Visual configuration data. This should be merged with the default\n * configuration and applied to the visualization rendered by the\n * extension.\n */\n visConfig: RawVisConfig;\n}\n\nexport interface QueryResponse {\n /**\n * Row data.\n */\n data: Row[];\n /**\n * Field measure information\n */\n fieldMeasures: Measure[];\n /**\n * Field dimension information\n */\n fieldDimensions: Dimension[];\n /**\n * Field table calculation information\n */\n fieldTableCalculations: TableCalculation[];\n /**\n * Field pivot information\n */\n fieldPivots: PivotConfig[];\n /*\n * A concatenated array of field measure information and table calculations\n * that behave like measures.\n */\n fieldMeasureLike: Measure[];\n /*\n * A concatenated array of field dimension information and table calculations\n * that behave like dimensions.\n */\n fieldDimensionLike: Dimension[];\n}\n\n/**\n * For internal use only.\n */\nexport interface VisualizationSDKInternal extends VisualizationSDK {\n updateVisData: (rawVisData: RawVisualizationData) => void;\n}\n\n/**\n * Extension visualization SDK\n */\nexport interface VisualizationSDK {\n /**\n * Visualization (combination of visConfig and queryResponse data)\n */\n visualizationData?: RawVisualizationData;\n /**\n * Visualization configuration data.\n * - measure configurations\n * - dimension configurations\n * - table calculations\n * - pivot configurations\n * - visualization configurations. These would be used to customize\n * the look and feel of a visualization in an explore.\n */\n visConfig: VisualizationConfig;\n /**\n * Response data from query.\n * - row data\n * - field measures\n * - field table calculations\n * - field pivots\n * - field measure like\n * - field dimension like\n */\n queryResponse: QueryResponse;\n /**\n * Set the default configurations for an extension visualization.\n * The configurations will be rendered inside of the explore\n * visualization editor. This should only be called once.\n */\n configureVisualization: (options: VisOptions) => void;\n /**\n * Update the visualization configuration.\n */\n setVisConfig: (config: RawVisConfig) => void;\n /**\n * Update the query row limit.\n */\n updateRowLimit: (rowLimit: number) => void;\n}\n\nexport interface VisOptionValue {\n [label: string]: string;\n}\n\nexport interface VisOption {\n type: string;\n values?: VisOptionValue[];\n display?: string;\n default?: any;\n label?: string;\n section?: string;\n placeholder?: string;\n display_size?: 'half' | 'third' | 'normal';\n order?: number;\n hidden?: (setOptions: RawVisConfig) => boolean;\n disabledReason?: (\n setOptions: RawVisConfig,\n queryResponse: QueryResponse\n ) => string | null;\n min?: number;\n max?: number;\n required?: boolean;\n words?: VisOptionValue[];\n supports?: string[];\n color_application?: string;\n sublabel?: string;\n}\n\nexport interface VisOptions {\n [optionName: string]: VisOption;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/connect/visualization/types.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 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 { Row } from '../tile';\n\n/**\n * Callback that is invoked when visualization data is received\n * <code>Looker >=22.8</code>\n */\nexport type VisualizationDataReceivedCallback = (\n visualizationData: RawVisualizationData\n) => void;\n\n/**\n * Raw visualization data. Basic typing for configuration data\n * and query data.\n * <code>Looker >=22.8</code>\n */\nexport interface RawVisualizationData {\n visConfig: RawVisConfig;\n queryResponse: RawVisQueryResponse;\n}\n\n/**\n * Visualization configuration. Configuration data set in the\n * explore.\n * <code>Looker >=22.8</code>\n */\nexport interface RawVisConfig {\n [key: string]: RawVisConfigValue;\n}\n\nexport type RawVisConfigValue = any;\n\n/**\n * Query response data\n * <code>Looker >=22.8</code>\n */\nexport interface RawVisQueryResponse {\n [key: string]: any;\n data: RawVisData;\n fields: {\n [key: string]: any[];\n };\n pivots: RawPivotConfig[];\n}\n\nexport type RawVisData = Row[];\n\nexport interface RawPivotConfig {\n key: string;\n is_total: boolean;\n data: { [key: string]: string };\n metadata: { [key: string]: { [key: string]: string } };\n}\n\nexport interface Measure extends RawVisConfig {\n [key: string]: any;\n}\n\nexport interface Dimension extends RawVisConfig {\n [key: string]: any;\n}\n\nexport interface TableCalculation {\n [key: string]: any;\n}\n\nexport interface PivotConfig extends RawPivotConfig {\n [key: string]: any;\n}\n\n/**\n * Visualization configuration data.\n */\nexport interface VisualizationConfig {\n /**\n * Measure information\n */\n queryFieldMeasures: Measure[];\n /**\n * Dimension information\n */\n queryFieldDimensions: Dimension[];\n /**\n * Table calculation information\n */\n queryFieldTableCalculations: TableCalculation[];\n /**\n * Pivot information\n */\n queryFieldPivots: PivotConfig[];\n /**\n * Visual configuration data. This should be merged with the default\n * configuration and applied to the visualization rendered by the\n * extension.\n */\n visConfig: RawVisConfig;\n}\n\nexport interface QueryResponse {\n /**\n * Row data.\n */\n data: Row[];\n /**\n * Field measure information\n */\n fieldMeasures: Measure[];\n /**\n * Field dimension information\n */\n fieldDimensions: Dimension[];\n /**\n * Field table calculation information\n */\n fieldTableCalculations: TableCalculation[];\n /**\n * Field pivot information\n */\n fieldPivots: PivotConfig[];\n /*\n * A concatenated array of field measure information and table calculations\n * that behave like measures.\n */\n fieldMeasureLike: Measure[];\n /*\n * A concatenated array of field dimension information and table calculations\n * that behave like dimensions.\n */\n fieldDimensionLike: Dimension[];\n}\n\n/**\n * For internal use only.\n */\nexport interface VisualizationSDKInternal extends VisualizationSDK {\n updateVisData: (rawVisData: RawVisualizationData) => void;\n}\n\n/**\n * Extension visualization SDK\n */\nexport interface VisualizationSDK {\n /**\n * Visualization (combination of visConfig and queryResponse data)\n */\n visualizationData?: RawVisualizationData;\n /**\n * Visualization configuration data.\n * - measure configurations\n * - dimension configurations\n * - table calculations\n * - pivot configurations\n * - visualization configurations. These would be used to customize\n * the look and feel of a visualization in an explore.\n */\n visConfig: VisualizationConfig;\n /**\n * Response data from query.\n * - row data\n * - field measures\n * - field table calculations\n * - field pivots\n * - field measure like\n * - field dimension like\n */\n queryResponse: QueryResponse;\n /**\n * Set the default configurations for an extension visualization.\n * The configurations will be rendered inside of the explore\n * visualization editor. This should only be called once.\n */\n configureVisualization: (options: VisOptions) => void;\n /**\n * Update the visualization configuration.\n */\n setVisConfig: (config: RawVisConfig) => void;\n /**\n * Update the query row limit.\n */\n updateRowLimit: (rowLimit: number) => void;\n}\n\nexport interface VisOptionValue {\n [label: string]: string;\n}\n\nexport interface VisOption {\n type: string;\n values?: VisOptionValue[];\n display?: string;\n default?: any;\n label?: string;\n section?: string;\n placeholder?: string;\n display_size?: 'half' | 'third' | 'normal';\n order?: number;\n hidden?: (setOptions: RawVisConfig) => boolean;\n disabledReason?: (\n setOptions: RawVisConfig,\n queryResponse: QueryResponse\n ) => string | null;\n min?: number;\n max?: number;\n required?: boolean;\n words?: VisOptionValue[];\n supports?: string[];\n color_application?: string;\n sublabel?: string;\n}\n\nexport interface VisOptions {\n [optionName: string]: VisOption;\n}\n"],"mappings":"","ignoreList":[]}
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.VisualizationSDKImpl = void 0;
7
7
  var _errors = require("../../util/errors");
8
8
  var _types = require("../types");
9
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
9
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
10
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
11
11
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
12
12
  class QueryResponseImpl {
13
13
  constructor(queryResponse) {
@@ -38,12 +38,12 @@ class QueryResponseImpl {
38
38
  return ((_this$_queryResponse8 = this._queryResponse) === null || _this$_queryResponse8 === void 0 ? void 0 : (_this$_queryResponse9 = _this$_queryResponse8.fields) === null || _this$_queryResponse9 === void 0 ? void 0 : _this$_queryResponse9.measure_like) || [];
39
39
  }
40
40
  get fieldDimensionLike() {
41
- var _this$_queryResponse10, _this$_queryResponse11;
42
- return ((_this$_queryResponse10 = this._queryResponse) === null || _this$_queryResponse10 === void 0 ? void 0 : (_this$_queryResponse11 = _this$_queryResponse10.fields) === null || _this$_queryResponse11 === void 0 ? void 0 : _this$_queryResponse11.dimension_like) || [];
41
+ var _this$_queryResponse0, _this$_queryResponse1;
42
+ return ((_this$_queryResponse0 = this._queryResponse) === null || _this$_queryResponse0 === void 0 ? void 0 : (_this$_queryResponse1 = _this$_queryResponse0.fields) === null || _this$_queryResponse1 === void 0 ? void 0 : _this$_queryResponse1.dimension_like) || [];
43
43
  }
44
44
  get data() {
45
- var _this$_queryResponse12;
46
- return ((_this$_queryResponse12 = this._queryResponse) === null || _this$_queryResponse12 === void 0 ? void 0 : _this$_queryResponse12.data) || [];
45
+ var _this$_queryResponse10;
46
+ return ((_this$_queryResponse10 = this._queryResponse) === null || _this$_queryResponse10 === void 0 ? void 0 : _this$_queryResponse10.data) || [];
47
47
  }
48
48
  }
49
49
  class VisualizationConfigImpl {
@@ -1 +1 @@
1
- {"version":3,"file":"visualization_sdk.js","names":["_errors","require","_types","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","QueryResponseImpl","constructor","queryResponse","_queryResponse","update","fieldMeasures","_this$_queryResponse","_this$_queryResponse$","fields","measures","fieldDimensions","_this$_queryResponse2","_this$_queryResponse3","dimensions","fieldTableCalculations","_this$_queryResponse4","_this$_queryResponse5","table_calculations","fieldPivots","_this$_queryResponse6","_this$_queryResponse7","pivots","fieldMeasureLike","_this$_queryResponse8","_this$_queryResponse9","measure_like","fieldDimensionLike","_this$_queryResponse10","_this$_queryResponse11","dimension_like","data","_this$_queryResponse12","VisualizationConfigImpl","visConfig","_visConfig","queryFieldMeasures","_this$_visConfig","_this$_visConfig$quer","query_fields","queryFieldDimensions","_this$_visConfig2","_this$_visConfig2$que","queryFieldTableCalculations","_this$_visConfig3","_this$_visConfig3$que","queryFieldPivots","_this$_visConfig4","_this$_visConfig4$que","VisualizationSDKImpl","hostApi","updateVisData","visualizationData","isDashboardMountSupported","configureVisualization","options","send","ExtensionRequestType","VIS_DEFAULT_CONFIG","NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR","setVisConfig","config","VIS_CONFIG_UPDATE","updatedConfig","_this$visualizationDa","updateRowLimit","rowLimit","TILE_ROW_LIMIT_UPDATE","_this$visualizationDa2","exports"],"sources":["../../../src/connect/visualization/visualization_sdk.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 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 { NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR } from '../../util/errors';\nimport type { ExtensionHostApiImpl } from '../extension_host_api';\nimport { ExtensionRequestType } from '../types';\nimport type { Row } from '../tile';\nimport type {\n Dimension,\n Measure,\n PivotConfig,\n QueryResponse,\n RawVisConfig,\n RawVisQueryResponse,\n RawVisualizationData,\n TableCalculation,\n VisOptions,\n VisualizationConfig,\n VisualizationSDKInternal,\n} from './types';\n\nclass QueryResponseImpl implements QueryResponse {\n _queryResponse?: RawVisQueryResponse;\n\n constructor(queryResponse?: RawVisQueryResponse) {\n this._queryResponse = queryResponse;\n }\n\n update(queryResponse: RawVisQueryResponse) {\n this._queryResponse = queryResponse;\n }\n\n get fieldMeasures(): Measure[] {\n return this._queryResponse?.fields?.measures || [];\n }\n\n get fieldDimensions(): Dimension[] {\n return this._queryResponse?.fields?.dimensions || [];\n }\n\n get fieldTableCalculations(): TableCalculation[] {\n return this._queryResponse?.fields?.table_calculations || [];\n }\n\n get fieldPivots(): PivotConfig[] {\n return this._queryResponse?.fields?.pivots || [];\n }\n\n get fieldMeasureLike(): Measure[] {\n return this._queryResponse?.fields?.measure_like || [];\n }\n\n get fieldDimensionLike(): Dimension[] {\n return this._queryResponse?.fields?.dimension_like || [];\n }\n\n get data(): Row[] {\n return this._queryResponse?.data || [];\n }\n}\n\nclass VisualizationConfigImpl implements VisualizationConfig {\n _visConfig?: RawVisConfig;\n\n constructor(visConfig?: RawVisConfig) {\n this._visConfig = visConfig;\n }\n\n update(visConfig: RawVisConfig) {\n this._visConfig = visConfig;\n }\n\n get visConfig(): RawVisConfig {\n return this._visConfig || {};\n }\n\n get queryFieldMeasures(): Measure[] {\n return this._visConfig?.query_fields?.measures || [];\n }\n\n get queryFieldDimensions(): Dimension[] {\n return this._visConfig?.query_fields?.dimensions || [];\n }\n\n get queryFieldTableCalculations(): TableCalculation[] {\n return this._visConfig?.query_fields?.table_calculations || [];\n }\n\n get queryFieldPivots(): PivotConfig[] {\n return this._visConfig?.query_fields?.pivots || [];\n }\n}\n\nexport class VisualizationSDKImpl implements VisualizationSDKInternal {\n hostApi: ExtensionHostApiImpl;\n visualizationData?: RawVisualizationData;\n _visConfig?: VisualizationConfigImpl;\n _queryResponse?: QueryResponseImpl;\n\n constructor(hostApi: ExtensionHostApiImpl) {\n this.hostApi = hostApi;\n }\n\n updateVisData(visualizationData: RawVisualizationData) {\n // Ignore update messages if dashboard mounts not supported.\n // Should never happen.\n if (this.hostApi.isDashboardMountSupported) {\n this.visualizationData = visualizationData;\n if (this.visConfig && this._visConfig) {\n this._visConfig.update(this.visualizationData.visConfig);\n }\n if (this.queryResponse && this._queryResponse) {\n this._queryResponse.update(this.visualizationData.queryResponse);\n }\n }\n }\n\n configureVisualization(options: VisOptions): void {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.VIS_DEFAULT_CONFIG, { options });\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;\n }\n }\n\n setVisConfig(config: RawVisConfig) {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.VIS_CONFIG_UPDATE, {\n updatedConfig: config,\n });\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;\n }\n }\n\n get visConfig(): VisualizationConfig {\n if (!this._visConfig) {\n this._visConfig = new VisualizationConfigImpl(\n this.visualizationData?.visConfig\n );\n }\n return this._visConfig;\n }\n\n updateRowLimit(rowLimit: number) {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.TILE_ROW_LIMIT_UPDATE, {\n rowLimit,\n });\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;\n }\n }\n\n get queryResponse(): QueryResponse {\n if (!this._queryResponse) {\n this._queryResponse = new QueryResponseImpl(\n this.visualizationData?.queryResponse\n );\n }\n return this._queryResponse;\n }\n}\n"],"mappings":";;;;;;AA0BA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAAgD,SAAAE,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAE,MAAA,CAAAF,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAI,CAAA,2BAAAJ,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAK,CAAA,GAAAL,CAAA,CAAAM,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAJ,CAAA,GAAAI,CAAA,CAAAG,IAAA,CAAAR,CAAA,EAAAI,CAAA,uCAAAH,CAAA,SAAAA,CAAA,YAAAQ,SAAA,yEAAAL,CAAA,GAAAD,MAAA,GAAAO,MAAA,EAAAV,CAAA;AAgBhD,MAAMW,iBAAiB,CAA0B;EAG/CC,WAAWA,CAACC,aAAmC,EAAE;IAAAvB,eAAA;IAC/C,IAAI,CAACwB,cAAc,GAAGD,aAAa;EACrC;EAEAE,MAAMA,CAACF,aAAkC,EAAE;IACzC,IAAI,CAACC,cAAc,GAAGD,aAAa;EACrC;EAEA,IAAIG,aAAaA,CAAA,EAAc;IAAA,IAA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F;EAEAC,YAAYA,CAACC,MAAoB,EAAE;IACjC,IAAI,IAAI,CAACX,OAAO,CAACG,yBAAyB,EAAE;MAC1C,IAAI,CAACH,OAAO,CAACM,IAAI,CAACC,2BAAoB,CAACK,iBAAiB,EAAE;QACxDC,aAAa,EAAEF;MACjB,CAAC,CAAC;IACJ,CAAC,MAAM;MACL,MAAMF,+CAAuC;IAC/C;EACF;EAEA,IAAIzB,SAASA,CAAA,EAAwB;IACnC,IAAI,CAAC,IAAI,CAACC,UAAU,EAAE;MAAA,IAAA6B,qBAAA;MACpB,IAAI,CAAC7B,UAAU,GAAG,IAAIF,uBAAuB,EAAA+B,qBAAA,GAC3C,IAAI,CAACZ,iBAAiB,cAAAY,qBAAA,uBAAtBA,qBAAA,CAAwB9B,SAC1B,CAAC;IACH;IACA,OAAO,IAAI,CAACC,UAAU;EACxB;EAEA8B,cAAcA,CAACC,QAAgB,EAAE;IAC/B,IAAI,IAAI,CAAChB,OAAO,CAACG,yBAAyB,EAAE;MAC1C,IAAI,CAACH,OAAO,CAACM,IAAI,CAACC,2BAAoB,CAACU,qBAAqB,EAAE;QAC5DD;MACF,CAAC,CAAC;IACJ,CAAC,MAAM;MACL,MAAMP,+CAAuC;IAC/C;EACF;EAEA,IAAIxD,aAAaA,CAAA,EAAkB;IACjC,IAAI,CAAC,IAAI,CAACC,cAAc,EAAE;MAAA,IAAAgE,sBAAA;MACxB,IAAI,CAAChE,cAAc,GAAG,IAAIH,iBAAiB,EAAAmE,sBAAA,GACzC,IAAI,CAAChB,iBAAiB,cAAAgB,sBAAA,uBAAtBA,sBAAA,CAAwBjE,aAC1B,CAAC;IACH;IACA,OAAO,IAAI,CAACC,cAAc;EAC5B;AACF;AAACiE,OAAA,CAAApB,oBAAA,GAAAA,oBAAA"}
1
+ {"version":3,"file":"visualization_sdk.js","names":["_errors","require","_types","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","QueryResponseImpl","constructor","queryResponse","_queryResponse","update","fieldMeasures","_this$_queryResponse","_this$_queryResponse$","fields","measures","fieldDimensions","_this$_queryResponse2","_this$_queryResponse3","dimensions","fieldTableCalculations","_this$_queryResponse4","_this$_queryResponse5","table_calculations","fieldPivots","_this$_queryResponse6","_this$_queryResponse7","pivots","fieldMeasureLike","_this$_queryResponse8","_this$_queryResponse9","measure_like","fieldDimensionLike","_this$_queryResponse0","_this$_queryResponse1","dimension_like","data","_this$_queryResponse10","VisualizationConfigImpl","visConfig","_visConfig","queryFieldMeasures","_this$_visConfig","_this$_visConfig$quer","query_fields","queryFieldDimensions","_this$_visConfig2","_this$_visConfig2$que","queryFieldTableCalculations","_this$_visConfig3","_this$_visConfig3$que","queryFieldPivots","_this$_visConfig4","_this$_visConfig4$que","VisualizationSDKImpl","hostApi","updateVisData","visualizationData","isDashboardMountSupported","configureVisualization","options","send","ExtensionRequestType","VIS_DEFAULT_CONFIG","NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR","setVisConfig","config","VIS_CONFIG_UPDATE","updatedConfig","_this$visualizationDa","updateRowLimit","rowLimit","TILE_ROW_LIMIT_UPDATE","_this$visualizationDa2","exports"],"sources":["../../../src/connect/visualization/visualization_sdk.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 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 { NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR } from '../../util/errors';\nimport type { ExtensionHostApiImpl } from '../extension_host_api';\nimport { ExtensionRequestType } from '../types';\nimport type { Row } from '../tile';\nimport type {\n Dimension,\n Measure,\n PivotConfig,\n QueryResponse,\n RawVisConfig,\n RawVisQueryResponse,\n RawVisualizationData,\n TableCalculation,\n VisOptions,\n VisualizationConfig,\n VisualizationSDKInternal,\n} from './types';\n\nclass QueryResponseImpl implements QueryResponse {\n _queryResponse?: RawVisQueryResponse;\n\n constructor(queryResponse?: RawVisQueryResponse) {\n this._queryResponse = queryResponse;\n }\n\n update(queryResponse: RawVisQueryResponse) {\n this._queryResponse = queryResponse;\n }\n\n get fieldMeasures(): Measure[] {\n return this._queryResponse?.fields?.measures || [];\n }\n\n get fieldDimensions(): Dimension[] {\n return this._queryResponse?.fields?.dimensions || [];\n }\n\n get fieldTableCalculations(): TableCalculation[] {\n return this._queryResponse?.fields?.table_calculations || [];\n }\n\n get fieldPivots(): PivotConfig[] {\n return this._queryResponse?.fields?.pivots || [];\n }\n\n get fieldMeasureLike(): Measure[] {\n return this._queryResponse?.fields?.measure_like || [];\n }\n\n get fieldDimensionLike(): Dimension[] {\n return this._queryResponse?.fields?.dimension_like || [];\n }\n\n get data(): Row[] {\n return this._queryResponse?.data || [];\n }\n}\n\nclass VisualizationConfigImpl implements VisualizationConfig {\n _visConfig?: RawVisConfig;\n\n constructor(visConfig?: RawVisConfig) {\n this._visConfig = visConfig;\n }\n\n update(visConfig: RawVisConfig) {\n this._visConfig = visConfig;\n }\n\n get visConfig(): RawVisConfig {\n return this._visConfig || {};\n }\n\n get queryFieldMeasures(): Measure[] {\n return this._visConfig?.query_fields?.measures || [];\n }\n\n get queryFieldDimensions(): Dimension[] {\n return this._visConfig?.query_fields?.dimensions || [];\n }\n\n get queryFieldTableCalculations(): TableCalculation[] {\n return this._visConfig?.query_fields?.table_calculations || [];\n }\n\n get queryFieldPivots(): PivotConfig[] {\n return this._visConfig?.query_fields?.pivots || [];\n }\n}\n\nexport class VisualizationSDKImpl implements VisualizationSDKInternal {\n hostApi: ExtensionHostApiImpl;\n visualizationData?: RawVisualizationData;\n _visConfig?: VisualizationConfigImpl;\n _queryResponse?: QueryResponseImpl;\n\n constructor(hostApi: ExtensionHostApiImpl) {\n this.hostApi = hostApi;\n }\n\n updateVisData(visualizationData: RawVisualizationData) {\n // Ignore update messages if dashboard mounts not supported.\n // Should never happen.\n if (this.hostApi.isDashboardMountSupported) {\n this.visualizationData = visualizationData;\n if (this.visConfig && this._visConfig) {\n this._visConfig.update(this.visualizationData.visConfig);\n }\n if (this.queryResponse && this._queryResponse) {\n this._queryResponse.update(this.visualizationData.queryResponse);\n }\n }\n }\n\n configureVisualization(options: VisOptions): void {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.VIS_DEFAULT_CONFIG, { options });\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;\n }\n }\n\n setVisConfig(config: RawVisConfig) {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.VIS_CONFIG_UPDATE, {\n updatedConfig: config,\n });\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;\n }\n }\n\n get visConfig(): VisualizationConfig {\n if (!this._visConfig) {\n this._visConfig = new VisualizationConfigImpl(\n this.visualizationData?.visConfig\n );\n }\n return this._visConfig;\n }\n\n updateRowLimit(rowLimit: number) {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.TILE_ROW_LIMIT_UPDATE, {\n rowLimit,\n });\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;\n }\n }\n\n get queryResponse(): QueryResponse {\n if (!this._queryResponse) {\n this._queryResponse = new QueryResponseImpl(\n this.visualizationData?.queryResponse\n );\n }\n return this._queryResponse;\n }\n}\n"],"mappings":";;;;;;AA0BA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAAgD,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAgBhD,MAAMgB,iBAAiB,CAA0B;EAG/CC,WAAWA,CAACC,aAAmC,EAAE;IAAArB,eAAA;IAC/C,IAAI,CAACsB,cAAc,GAAGD,aAAa;EACrC;EAEAE,MAAMA,CAACF,aAAkC,EAAE;IACzC,IAAI,CAACC,cAAc,GAAGD,aAAa;EACrC;EAEA,IAAIG,aAAaA,CAAA,EAAc;IAAA,IAAAC,oBA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YAAYA,CAACC,MAAoB,EAAE;IACjC,IAAI,IAAI,CAACX,OAAO,CAACG,yBAAyB,EAAE;MAC1C,IAAI,CAACH,OAAO,CAACM,IAAI,CAACC,2BAAoB,CAACK,iBAAiB,EAAE;QACxDC,aAAa,EAAEF;MACjB,CAAC,CAAC;IACJ,CAAC,MAAM;MACL,MAAMF,+CAAuC;IAC/C;EACF;EAEA,IAAIzB,SAASA,CAAA,EAAwB;IACnC,IAAI,CAAC,IAAI,CAACC,UAAU,EAAE;MAAA,IAAA6B,qBAAA;MACpB,IAAI,CAAC7B,UAAU,GAAG,IAAIF,uBAAuB,EAAA+B,qBAAA,GAC3C,IAAI,CAACZ,iBAAiB,cAAAY,qBAAA,uBAAtBA,qBAAA,CAAwB9B,SAC1B,CAAC;IACH;IACA,OAAO,IAAI,CAACC,UAAU;EACxB;EAEA8B,cAAcA,CAACC,QAAgB,EAAE;IAC/B,IAAI,IAAI,CAAChB,OAAO,CAACG,yBAAyB,EAAE;MAC1C,IAAI,CAACH,OAAO,CAACM,IAAI,CAACC,2BAAoB,CAACU,qBAAqB,EAAE;QAC5DD;MACF,CAAC,CAAC;IACJ,CAAC,MAAM;MACL,MAAMP,+CAAuC;IAC/C;EACF;EAEA,IAAIxD,aAAaA,CAAA,EAAkB;IACjC,IAAI,CAAC,IAAI,CAACC,cAAc,EAAE;MAAA,IAAAgE,sBAAA;MACxB,IAAI,CAAChE,cAAc,GAAG,IAAIH,iBAAiB,EAAAmE,sBAAA,GACzC,IAAI,CAAChB,iBAAiB,cAAAgB,sBAAA,uBAAtBA,sBAAA,CAAwBjE,aAC1B,CAAC;IACH;IACA,OAAO,IAAI,CAACC,cAAc;EAC5B;AACF;AAACiE,OAAA,CAAApB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -1,10 +1,10 @@
1
1
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
2
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
3
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
5
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
7
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
6
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
7
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
8
8
  import { Chatty } from '@looker/chatty';
9
9
  import { ExtensionHostApiImpl } from './extension_host_api';
10
10
  import { registerHostApi } from './global_listener';
@@ -12,74 +12,75 @@ import { ExtensionEvent } from './types';
12
12
  export var connectExtensionHost = function () {
13
13
  var _ref = _asyncToGenerator(function* () {
14
14
  var configuration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15
- return new Promise(function () {
16
- var _ref2 = _asyncToGenerator(function* (resolve, reject) {
17
- var initializationTimer = window.setTimeout(() => reject(new Error('Failed to establish communication with Looker host')), 30000);
18
- var {
19
- initializedCallback,
20
- chattyTimeout
21
- } = configuration;
22
- var extensionHost;
23
- var targetOrigin;
24
- var initialized = initializationResponse => {
25
- if (initializationResponse) {
26
- var {
27
- errorMessage
28
- } = initializationResponse;
29
- if (initializedCallback) {
30
- initializedCallback(errorMessage);
31
- }
32
- if (errorMessage) {
33
- reject(new Error(errorMessage));
15
+ return (new Promise(function () {
16
+ var _ref2 = _asyncToGenerator(function* (resolve, reject) {
17
+ var initializationTimer = window.setTimeout(() => reject(new Error('Failed to establish communication with Looker host')), 30000);
18
+ var {
19
+ initializedCallback,
20
+ chattyTimeout
21
+ } = configuration;
22
+ var extensionHost;
23
+ var targetOrigin;
24
+ var initialized = initializationResponse => {
25
+ if (initializationResponse) {
26
+ var {
27
+ errorMessage
28
+ } = initializationResponse;
29
+ if (initializedCallback) {
30
+ initializedCallback(errorMessage);
31
+ }
32
+ if (errorMessage) {
33
+ reject(new Error(errorMessage));
34
+ } else {
35
+ resolve(extensionHost);
36
+ }
34
37
  } else {
35
- resolve(extensionHost);
38
+ reject(new Error('Unexpected response from initialization'));
36
39
  }
37
- } else {
38
- reject(new Error('Unexpected response from initialization'));
40
+ };
41
+ try {
42
+ targetOrigin = window.parent.location.origin;
43
+ } catch (err) {
44
+ targetOrigin = '*';
39
45
  }
40
- };
41
- try {
42
- targetOrigin = window.parent.location.origin;
43
- } catch (err) {
44
- targetOrigin = '*';
45
- }
46
- try {
47
- var chattyHost = yield Chatty.createClient().on(ExtensionEvent.EXTENSION_HOST_NOTIFICATION, message => {
48
- var messageResponse;
49
- if (message) {
50
- if (initializationTimer) {
51
- window.clearTimeout(initializationTimer);
52
- initializationTimer = undefined;
53
- if (extensionHost) {
54
- try {
55
- messageResponse = extensionHost.handleNotification(message);
56
- initialized(messageResponse);
57
- } catch (error) {
58
- reject(error);
46
+ try {
47
+ var chattyHost = yield Chatty.createClient().on(ExtensionEvent.EXTENSION_HOST_NOTIFICATION, message => {
48
+ var messageResponse;
49
+ if (message) {
50
+ if (initializationTimer) {
51
+ window.clearTimeout(initializationTimer);
52
+ initializationTimer = undefined;
53
+ if (extensionHost) {
54
+ try {
55
+ messageResponse = extensionHost.handleNotification(message);
56
+ initialized(messageResponse);
57
+ } catch (error) {
58
+ reject(error);
59
+ }
60
+ } else {
61
+ reject(new Error('Extension host not created'));
59
62
  }
60
63
  } else {
61
- reject(new Error('Extension host not created'));
64
+ messageResponse = extensionHost.handleNotification(message);
62
65
  }
63
- } else {
64
- messageResponse = extensionHost.handleNotification(message);
65
66
  }
66
- }
67
- return messageResponse;
68
- }).withTargetOrigin(targetOrigin).withDefaultTimeout(chattyTimeout || 30000).build().connect();
69
- extensionHost = new ExtensionHostApiImpl(_objectSpread({
70
- chattyHost
71
- }, configuration));
72
- registerHostApi(extensionHost);
73
- } catch (error) {
74
- window.clearTimeout(initializationTimer);
75
- initializationTimer = undefined;
76
- reject(error);
77
- }
78
- });
79
- return function (_x, _x2) {
80
- return _ref2.apply(this, arguments);
81
- };
82
- }());
67
+ return messageResponse;
68
+ }).withTargetOrigin(targetOrigin).withDefaultTimeout(chattyTimeout || 30000).build().connect();
69
+ extensionHost = new ExtensionHostApiImpl(_objectSpread({
70
+ chattyHost
71
+ }, configuration));
72
+ registerHostApi(extensionHost);
73
+ } catch (error) {
74
+ window.clearTimeout(initializationTimer);
75
+ initializationTimer = undefined;
76
+ reject(error);
77
+ }
78
+ });
79
+ return function (_x, _x2) {
80
+ return _ref2.apply(this, arguments);
81
+ };
82
+ }())
83
+ );
83
84
  });
84
85
  return function connectExtensionHost() {
85
86
  return _ref.apply(this, arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"connect_extension_host.js","names":["Chatty","ExtensionHostApiImpl","registerHostApi","ExtensionEvent","connectExtensionHost","_ref","_asyncToGenerator","configuration","arguments","length","undefined","Promise","_ref2","resolve","reject","initializationTimer","window","setTimeout","Error","initializedCallback","chattyTimeout","extensionHost","targetOrigin","initialized","initializationResponse","errorMessage","parent","location","origin","err","chattyHost","createClient","on","EXTENSION_HOST_NOTIFICATION","message","messageResponse","clearTimeout","handleNotification","error","withTargetOrigin","withDefaultTimeout","build","connect","_objectSpread","_x","_x2","apply"],"sources":["../../../src/connect/connect_extension_host.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 { Chatty } from '@looker/chatty';\nimport { ExtensionHostApiImpl } from './extension_host_api';\nimport { registerHostApi } from './global_listener';\nimport type {\n ExtensionHostApi,\n ExtensionHostConfiguration,\n ExtensionInitializationResponse,\n ExtensionNotification,\n} from './types';\nimport { ExtensionEvent } from './types';\n\n/**\n * Connect extension to Looker host. React extensions using the extension-sdk-react\n * package and ExtensionProvider do not need to call this as the ExtensionProvider\n * sets up the connection.\n * @param configuration\n */\nexport const connectExtensionHost = async (\n configuration: ExtensionHostConfiguration = {}\n): Promise<ExtensionHostApi> =>\n // eslint-disable-next-line no-async-promise-executor\n new Promise(async (resolve, reject) => {\n // Timer to handle the unlikely event that an initialization message\n // is not received from the host. If this happens it's a bug in the\n // host code.\n let initializationTimer: number | undefined = window.setTimeout(\n () =>\n reject(new Error('Failed to establish communication with Looker host')),\n 30000\n );\n // Legacy callback to indicate that connection is established\n const { initializedCallback, chattyTimeout } = configuration;\n let extensionHost: ExtensionHostApi;\n let targetOrigin;\n // The initialized function replaces the need the legacy callback as it\n // resolves/rejects the promise that now wraps the chatty promise that\n // was originally returned.\n const initialized = (\n initializationResponse?: ExtensionInitializationResponse\n ) => {\n // An initialization response is expected but the handle notification\n // method can return undefined.\n if (initializationResponse) {\n // The initialization can fail, for example, Looker host is not\n // at the right version.\n const { errorMessage } = initializationResponse;\n if (initializedCallback) {\n initializedCallback(errorMessage);\n }\n if (errorMessage) {\n reject(new Error(errorMessage));\n } else {\n resolve(extensionHost);\n }\n } else {\n reject(new Error('Unexpected response from initialization'));\n }\n };\n try {\n // if extension is not sandboxed the following will succeed\n targetOrigin = window.parent.location.origin;\n } catch (err) {\n // failure indicates running in a sandboxed environment\n targetOrigin = '*';\n }\n try {\n const chattyHost = await Chatty.createClient()\n .on(\n ExtensionEvent.EXTENSION_HOST_NOTIFICATION,\n (\n message?: ExtensionNotification\n ): ExtensionInitializationResponse | undefined => {\n // Handle messages from the looker host. The first message should\n // be an initialization message containing information about the host\n // and host extension (looker version, extension id for example).\n let messageResponse: ExtensionInitializationResponse | undefined;\n if (message) {\n if (initializationTimer) {\n // The initialization timer is present so assume this is an initialization\n // message. The initialization timer is now cleared.\n window.clearTimeout(initializationTimer);\n initializationTimer = undefined;\n if (extensionHost) {\n try {\n messageResponse = extensionHost.handleNotification(message);\n initialized(messageResponse);\n } catch (error) {\n // Handle invalid extension host initialization failure\n reject(error);\n }\n } else {\n // The extension host should be initialized if we get here\n // so this should never happen.\n reject(new Error('Extension host not created'));\n }\n } else {\n // All other extension host messages\n messageResponse = extensionHost.handleNotification(message);\n }\n }\n return messageResponse;\n }\n )\n .withTargetOrigin(targetOrigin)\n .withDefaultTimeout(chattyTimeout || 30000)\n .build()\n .connect();\n // Create the extension host (a extension specific wrapper around the\n // chatty host)\n extensionHost = new ExtensionHostApiImpl({\n chattyHost,\n ...configuration,\n });\n // Register the extension host so that global event listeners can send\n // messages to the looker host (for example beforeUnload event).\n registerHostApi(extensionHost);\n } catch (error) {\n window.clearTimeout(initializationTimer);\n initializationTimer = undefined;\n reject(error);\n }\n });\n"],"mappings":";;;;;;;AA0BA,SAASA,MAAM,QAAQ,gBAAgB;AACvC,SAASC,oBAAoB,QAAQ,sBAAsB;AAC3D,SAASC,eAAe,QAAQ,mBAAmB;AAOnD,SAASC,cAAc,QAAQ,SAAS;AAQxC,OAAO,IAAMC,oBAAoB;EAAA,IAAAC,IAAA,GAAAC,iBAAA,CAAG;IAAA,IAClCC,aAAyC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAAA,OAG9C,IAAIG,OAAO;MAAA,IAAAC,KAAA,GAAAN,iBAAA,CAAC,WAAOO,OAAO,EAAEC,MAAM,EAAK;QAIrC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AAK,EAAE;oBAEdxB,MAAM,CAACwB,KAAK,CAAC;kBACf;gBACF,CAAC,MAAM;kBAGLxB,MAAM,CAAC,IAAII,KAAK,CAAC,4BAA4B,CAAC,CAAC;gBACjD;cACF,CAAC,MAAM;gBAELiB,eAAe,GAAGd,aAAa,CAACgB,kBAAkB,CAACH,OAAO,CAAC;cAC7D;YACF;YACA,OAAOC,eAAe;UACxB,CACF,CAAC,CACAI,gBAAgB,CAACjB,YAAY,CAAC,CAC9BkB,kBAAkB,CAACpB,aAAa,IAAI,KAAK,CAAC,CAC1CqB,KAAK,CAAC,CAAC,CACPC,OAAO,CAAC,CAAC;UAGZrB,aAAa,GAAG,IAAIpB,oBAAoB,CAAA0C,aAAA;YACtCb;UAAU,GACPvB,aAAa,CACjB,CAAC;UAGFL,eAAe,CAACmB,aAAa,CAAC;QAChC,CAAC,CAAC,OAAOiB,KAAK,EAAE;UACdtB,MAAM,CAACoB,YAAY,CAACrB,mBAAmB,CAAC;UACxCA,mBAAmB,GAAGL,SAAS;UAC/BI,MAAM,CAACwB,KAAK,CAAC;QACf;MACF,CAAC;MAAA,iBAAAM,EAAA,EAAAC,GAAA;QAAA,OAAAjC,KAAA,CAAAkC,KAAA,OAAAtC,SAAA;MAAA;IAAA,IAAC;EAAA;EAAA,gBAxGSJ,oBAAoBA,CAAA;IAAA,OAAAC,IAAA,CAAAyC,KAAA,OAAAtC,SAAA;EAAA;AAAA,GAwG7B"}
1
+ {"version":3,"file":"connect_extension_host.js","names":["Chatty","ExtensionHostApiImpl","registerHostApi","ExtensionEvent","connectExtensionHost","_ref","_asyncToGenerator","configuration","arguments","length","undefined","Promise","_ref2","resolve","reject","initializationTimer","window","setTimeout","Error","initializedCallback","chattyTimeout","extensionHost","targetOrigin","initialized","initializationResponse","errorMessage","parent","location","origin","err","chattyHost","createClient","on","EXTENSION_HOST_NOTIFICATION","message","messageResponse","clearTimeout","handleNotification","error","withTargetOrigin","withDefaultTimeout","build","connect","_objectSpread","_x","_x2","apply"],"sources":["../../../src/connect/connect_extension_host.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 { Chatty } from '@looker/chatty';\nimport { ExtensionHostApiImpl } from './extension_host_api';\nimport { registerHostApi } from './global_listener';\nimport type {\n ExtensionHostApi,\n ExtensionHostConfiguration,\n ExtensionInitializationResponse,\n ExtensionNotification,\n} from './types';\nimport { ExtensionEvent } from './types';\n\n/**\n * Connect extension to Looker host. React extensions using the extension-sdk-react\n * package and ExtensionProvider do not need to call this as the ExtensionProvider\n * sets up the connection.\n * @param configuration\n */\nexport const connectExtensionHost = async (\n configuration: ExtensionHostConfiguration = {}\n): Promise<ExtensionHostApi> =>\n // eslint-disable-next-line no-async-promise-executor\n new Promise(async (resolve, reject) => {\n // Timer to handle the unlikely event that an initialization message\n // is not received from the host. If this happens it's a bug in the\n // host code.\n let initializationTimer: number | undefined = window.setTimeout(\n () =>\n reject(new Error('Failed to establish communication with Looker host')),\n 30000\n );\n // Legacy callback to indicate that connection is established\n const { initializedCallback, chattyTimeout } = configuration;\n let extensionHost: ExtensionHostApi;\n let targetOrigin;\n // The initialized function replaces the need the legacy callback as it\n // resolves/rejects the promise that now wraps the chatty promise that\n // was originally returned.\n const initialized = (\n initializationResponse?: ExtensionInitializationResponse\n ) => {\n // An initialization response is expected but the handle notification\n // method can return undefined.\n if (initializationResponse) {\n // The initialization can fail, for example, Looker host is not\n // at the right version.\n const { errorMessage } = initializationResponse;\n if (initializedCallback) {\n initializedCallback(errorMessage);\n }\n if (errorMessage) {\n reject(new Error(errorMessage));\n } else {\n resolve(extensionHost);\n }\n } else {\n reject(new Error('Unexpected response from initialization'));\n }\n };\n try {\n // if extension is not sandboxed the following will succeed\n targetOrigin = window.parent.location.origin;\n } catch (err) {\n // failure indicates running in a sandboxed environment\n targetOrigin = '*';\n }\n try {\n const chattyHost = await Chatty.createClient()\n .on(\n ExtensionEvent.EXTENSION_HOST_NOTIFICATION,\n (\n message?: ExtensionNotification\n ): ExtensionInitializationResponse | undefined => {\n // Handle messages from the looker host. The first message should\n // be an initialization message containing information about the host\n // and host extension (looker version, extension id for example).\n let messageResponse: ExtensionInitializationResponse | undefined;\n if (message) {\n if (initializationTimer) {\n // The initialization timer is present so assume this is an initialization\n // message. The initialization timer is now cleared.\n window.clearTimeout(initializationTimer);\n initializationTimer = undefined;\n if (extensionHost) {\n try {\n messageResponse = extensionHost.handleNotification(message);\n initialized(messageResponse);\n } catch (error) {\n // Handle invalid extension host initialization failure\n reject(error);\n }\n } else {\n // The extension host should be initialized if we get here\n // so this should never happen.\n reject(new Error('Extension host not created'));\n }\n } else {\n // All other extension host messages\n messageResponse = extensionHost.handleNotification(message);\n }\n }\n return messageResponse;\n }\n )\n .withTargetOrigin(targetOrigin)\n .withDefaultTimeout(chattyTimeout || 30000)\n .build()\n .connect();\n // Create the extension host (a extension specific wrapper around the\n // chatty host)\n extensionHost = new ExtensionHostApiImpl({\n chattyHost,\n ...configuration,\n });\n // Register the extension host so that global event listeners can send\n // messages to the looker host (for example beforeUnload event).\n registerHostApi(extensionHost);\n } catch (error) {\n window.clearTimeout(initializationTimer);\n initializationTimer = undefined;\n reject(error);\n }\n });\n"],"mappings":";;;;;;;AA0BA,SAASA,MAAM,QAAQ,gBAAgB;AACvC,SAASC,oBAAoB,QAAQ,sBAAsB;AAC3D,SAASC,eAAe,QAAQ,mBAAmB;AAOnD,SAASC,cAAc,QAAQ,SAAS;AAQxC,OAAO,IAAMC,oBAAoB;EAAA,IAAAC,IAAA,GAAAC,iBAAA,CAAG;IAAA,IAClCC,aAAyC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAAA,QAG9C,IAAIG,OAAO;QAAA,IAAAC,KAAA,GAAAN,iBAAA,CAAC,WAAOO,OAAO,EAAEC,MAAM,EAAK;UAIrC,IAAIC,mBAAuC,GAAGC,MAAM,CAACC,UAAU,CAC7D,MACEH,MAAM,CAAC,IAAII,KAAK,CAAC,oDAAoD,CAAC,CAAC,EACzE,KACF,CAAC;UAED,IAAM;YAAEC,mBAAmB;YAAEC;UAAc,CAAC,GAAGb,aAAa;UAC5D,IAAIc,aAA+B;UACnC,IAAIC,YAAY;UAIhB,IAAMC,WAAW,GACfC,sBAAwD,IACrD;YAGH,IAAIA,sBAAsB,EAAE;cAG1B,IAAM;gBAAEC;cAAa,CAAC,GAAGD,sBAAsB;cAC/C,IAAIL,mBAAmB,EAAE;gBACvBA,mBAAmB,CAACM,YAAY,CAAC;cACnC;cACA,IAAIA,YAAY,EAAE;gBAChBX,MAAM,CAAC,IAAII,KAAK,CAACO,YAAY,CAAC,CAAC;cACjC,CAAC,MAAM;gBACLZ,OAAO,CAACQ,aAAa,CAAC;cACxB;YACF,CAAC,MAAM;cACLP,MAAM,CAAC,IAAII,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAC9D;UACF,CAAC;UACD,IAAI;YAEFI,YAAY,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,KAAK,CAAC;UACf;QACF,CAAC;QAAA,iBAAAM,EAAA,EAAAC,GAAA;UAAA,OAAAjC,KAAA,CAAAkC,KAAA,OAAAtC,SAAA;QAAA;MAAA;IAAC;EAAA;EAAA,gBAxGSJ,oBAAoBA,CAAA;IAAA,OAAAC,IAAA,CAAAyC,KAAA,OAAAtC,SAAA;EAAA;AAAA,GAwG7B","ignoreList":[]}
@@ -1,7 +1,7 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
3
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
1
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
2
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
3
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
5
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
6
  import intersects from 'semver/ranges/intersects';
7
7
  import { logError } from '../util';
@@ -67,11 +67,11 @@ export class ExtensionHostApiImpl {
67
67
  } = message;
68
68
  if (this.hostChangedRoute && payload) {
69
69
  var {
70
- route: _route,
71
- routeState: _routeState
70
+ route,
71
+ routeState
72
72
  } = payload;
73
- if (_route) {
74
- this.hostChangedRoute(_route, _routeState);
73
+ if (route) {
74
+ this.hostChangedRoute(route, routeState);
75
75
  }
76
76
  }
77
77
  return undefined;
@@ -118,11 +118,11 @@ export class ExtensionHostApiImpl {
118
118
  }
119
119
  if (this.setInitialRoute && _payload3) {
120
120
  var {
121
- route: _route2,
122
- routeState: _routeState2
121
+ route: _route,
122
+ routeState: _routeState
123
123
  } = _payload3;
124
- if (_route2) {
125
- this.setInitialRoute(_route2, _routeState2);
124
+ if (_route) {
125
+ this.setInitialRoute(_route, _routeState);
126
126
  }
127
127
  }
128
128
  return {
@@ -290,13 +290,13 @@ export class ExtensionHostApiImpl {
290
290
  })();
291
291
  }
292
292
  userAttributeResetItem(name) {
293
- var _this10 = this;
293
+ var _this0 = this;
294
294
  return _asyncToGenerator(function* () {
295
- var errorMessage = _this10.verifyLookerVersion('>=7.15');
295
+ var errorMessage = _this0.verifyLookerVersion('>=7.15');
296
296
  if (errorMessage) {
297
297
  return Promise.reject(new Error(errorMessage));
298
298
  }
299
- return _this10.sendAndReceive(ExtensionRequestType.USER_ATTRIBUTE, {
299
+ return _this0.sendAndReceive(ExtensionRequestType.USER_ATTRIBUTE, {
300
300
  type: 'reset',
301
301
  name
302
302
  });
@@ -314,9 +314,9 @@ export class ExtensionHostApiImpl {
314
314
  }
315
315
  }
316
316
  saveContextData(context) {
317
- var _this11 = this;
317
+ var _this1 = this;
318
318
  return _asyncToGenerator(function* () {
319
- var errorMessage = _this11.verifyLookerVersion('>=7.13');
319
+ var errorMessage = _this1.verifyLookerVersion('>=7.13');
320
320
  if (errorMessage) {
321
321
  return Promise.reject(new Error(errorMessage));
322
322
  }
@@ -330,24 +330,24 @@ export class ExtensionHostApiImpl {
330
330
  } else {
331
331
  contextData = undefined;
332
332
  }
333
- yield _this11.sendAndReceive(ExtensionRequestType.CONTEXT_DATA, {
333
+ yield _this1.sendAndReceive(ExtensionRequestType.CONTEXT_DATA, {
334
334
  type: 'save',
335
335
  contextData
336
336
  });
337
- return _this11.getContextData();
337
+ return _this1.getContextData();
338
338
  })();
339
339
  }
340
340
  refreshContextData() {
341
- var _this12 = this;
341
+ var _this10 = this;
342
342
  return _asyncToGenerator(function* () {
343
- var errorMessage = _this12.verifyLookerVersion('>=7.13');
343
+ var errorMessage = _this10.verifyLookerVersion('>=7.13');
344
344
  if (errorMessage) {
345
345
  return Promise.reject(new Error(errorMessage));
346
346
  }
347
- _this12.contextData = yield _this12.sendAndReceive(ExtensionRequestType.CONTEXT_DATA, {
347
+ _this10.contextData = yield _this10.sendAndReceive(ExtensionRequestType.CONTEXT_DATA, {
348
348
  type: 'refresh'
349
349
  });
350
- return _this12.getContextData();
350
+ return _this10.getContextData();
351
351
  })();
352
352
  }
353
353
  track(name, trackAction, attributes) {
@@ -384,13 +384,13 @@ export class ExtensionHostApiImpl {
384
384
  return new FetchProxyImpl(this, baseUrl, init, responseBodyType);
385
385
  }
386
386
  fetchProxy(resource, init, responseBodyType) {
387
- var _this13 = this;
387
+ var _this11 = this;
388
388
  return _asyncToGenerator(function* () {
389
- var errorMessage = _this13.verifyLookerVersion('>=7.9');
389
+ var errorMessage = _this11.verifyLookerVersion('>=7.9');
390
390
  if (errorMessage) {
391
391
  return Promise.reject(new Error(errorMessage));
392
392
  }
393
- return _this13.sendAndReceive(ExtensionRequestType.INVOKE_EXTERNAL_API, {
393
+ return _this11.sendAndReceive(ExtensionRequestType.INVOKE_EXTERNAL_API, {
394
394
  type: 'fetch',
395
395
  payload: {
396
396
  resource,
@@ -401,13 +401,13 @@ export class ExtensionHostApiImpl {
401
401
  })();
402
402
  }
403
403
  serverProxy(resource, init, responseBodyType) {
404
- var _this14 = this;
404
+ var _this12 = this;
405
405
  return _asyncToGenerator(function* () {
406
- var errorMessage = _this14.verifyLookerVersion('>=7.11');
406
+ var errorMessage = _this12.verifyLookerVersion('>=7.11');
407
407
  if (errorMessage) {
408
408
  return Promise.reject(new Error(errorMessage));
409
409
  }
410
- return _this14.sendAndReceive(ExtensionRequestType.INVOKE_EXTERNAL_API, {
410
+ return _this12.sendAndReceive(ExtensionRequestType.INVOKE_EXTERNAL_API, {
411
411
  type: 'server-proxy',
412
412
  payload: {
413
413
  resource,
@@ -419,18 +419,18 @@ export class ExtensionHostApiImpl {
419
419
  }
420
420
  oauth2Authenticate(authEndpoint, authParameters) {
421
421
  var _arguments3 = arguments,
422
- _this15 = this;
422
+ _this13 = this;
423
423
  return _asyncToGenerator(function* () {
424
424
  var httpMethod = _arguments3.length > 2 && _arguments3[2] !== undefined ? _arguments3[2] : 'POST';
425
- var errorMessage = _this15.verifyLookerVersion('>=7.9');
425
+ var errorMessage = _this13.verifyLookerVersion('>=7.9');
426
426
  if (errorMessage) {
427
427
  return Promise.reject(new Error(errorMessage));
428
428
  }
429
- errorMessage = _this15.validateAuthParameters(authParameters);
429
+ errorMessage = _this13.validateAuthParameters(authParameters);
430
430
  if (errorMessage) {
431
431
  return Promise.reject(new Error(errorMessage));
432
432
  }
433
- return _this15.sendAndReceive(ExtensionRequestType.INVOKE_EXTERNAL_API, {
433
+ return _this13.sendAndReceive(ExtensionRequestType.INVOKE_EXTERNAL_API, {
434
434
  type: 'oauth2_authenticate',
435
435
  payload: {
436
436
  authEndpoint,
@@ -443,13 +443,13 @@ export class ExtensionHostApiImpl {
443
443
  })();
444
444
  }
445
445
  oauth2ExchangeCodeForToken(authEndpoint, authParameters) {
446
- var _this16 = this;
446
+ var _this14 = this;
447
447
  return _asyncToGenerator(function* () {
448
- var errorMessage = _this16.verifyLookerVersion('>=7.11');
448
+ var errorMessage = _this14.verifyLookerVersion('>=7.11');
449
449
  if (errorMessage) {
450
450
  return Promise.reject(new Error(errorMessage));
451
451
  }
452
- return _this16.sendAndReceive(ExtensionRequestType.INVOKE_EXTERNAL_API, {
452
+ return _this14.sendAndReceive(ExtensionRequestType.INVOKE_EXTERNAL_API, {
453
453
  type: 'oauth2_exchange_code',
454
454
  payload: {
455
455
  authEndpoint,
@@ -464,9 +464,9 @@ export class ExtensionHostApiImpl {
464
464
  });
465
465
  }
466
466
  sendAndReceive(type, payload, options) {
467
- var _this17 = this;
467
+ var _this15 = this;
468
468
  return _asyncToGenerator(function* () {
469
- if (!_this17._lookerHostData) {
469
+ if (!_this15._lookerHostData) {
470
470
  return Promise.reject(new Error('Looker host connection not established'));
471
471
  }
472
472
  var messagePayload = {
@@ -474,7 +474,7 @@ export class ExtensionHostApiImpl {
474
474
  payload
475
475
  };
476
476
  var chattyPayload = options ? [messagePayload, options] : [messagePayload];
477
- return _this17.chattyHost.sendAndReceive(ExtensionEvent.EXTENSION_API_REQUEST, ...chattyPayload).then(values => values[0]);
477
+ return _this15.chattyHost.sendAndReceive(ExtensionEvent.EXTENSION_API_REQUEST, ...chattyPayload).then(values => values[0]);
478
478
  })();
479
479
  }
480
480
  send(type, payload) {