@looker/extension-sdk 22.20.2-alpha.1650 → 23.2.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 +30 -1
- package/README.md +1 -9
- package/lib/connect/connect_extension_host.js +5 -24
- package/lib/connect/connect_extension_host.js.map +1 -1
- package/lib/connect/extension_host_api.d.ts +3 -14
- package/lib/connect/extension_host_api.js +26 -230
- package/lib/connect/extension_host_api.js.map +1 -1
- package/lib/connect/fetch_proxy.js +0 -13
- package/lib/connect/fetch_proxy.js.map +1 -1
- package/lib/connect/global_listener.js +3 -17
- package/lib/connect/global_listener.js.map +1 -1
- package/lib/connect/index.d.ts +0 -2
- package/lib/connect/index.js +1 -34
- package/lib/connect/index.js.map +1 -1
- package/lib/connect/types.d.ts +7 -51
- package/lib/connect/types.js +1 -33
- package/lib/connect/types.js.map +1 -1
- package/lib/esm/connect/connect_extension_host.js +19 -25
- package/lib/esm/connect/connect_extension_host.js.map +1 -1
- package/lib/esm/connect/extension_host_api.js +71 -256
- package/lib/esm/connect/extension_host_api.js.map +1 -1
- package/lib/esm/connect/fetch_proxy.js +11 -12
- package/lib/esm/connect/fetch_proxy.js.map +1 -1
- package/lib/esm/connect/global_listener.js +11 -12
- package/lib/esm/connect/global_listener.js.map +1 -1
- package/lib/esm/connect/index.js +39 -5
- package/lib/esm/connect/index.js.map +1 -1
- package/lib/esm/connect/types.js +21 -41
- package/lib/esm/connect/types.js.map +1 -1
- package/lib/esm/index.js +82 -10
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/sdk/extension_sdk.js +13 -9
- package/lib/esm/sdk/extension_sdk.js.map +1 -1
- package/lib/esm/sdk/extension_sdk_31.js +12 -6
- package/lib/esm/sdk/extension_sdk_31.js.map +1 -1
- package/lib/esm/sdk/extension_sdk_40.js +12 -6
- package/lib/esm/sdk/extension_sdk_40.js.map +1 -1
- package/lib/esm/sdk/index.js +16 -1
- package/lib/esm/sdk/index.js.map +1 -1
- package/lib/esm/sdk/sdk_connection.js +8 -9
- package/lib/esm/sdk/sdk_connection.js.map +1 -1
- package/lib/index.d.ts +0 -3
- package/lib/index.js +1 -54
- package/lib/index.js.map +1 -1
- package/lib/sdk/extension_sdk.js +0 -8
- package/lib/sdk/extension_sdk.js.map +1 -1
- package/lib/sdk/extension_sdk_31.js +0 -6
- package/lib/sdk/extension_sdk_31.js.map +1 -1
- package/lib/sdk/extension_sdk_40.js +0 -6
- package/lib/sdk/extension_sdk_40.js.map +1 -1
- package/lib/sdk/index.js +0 -2
- package/lib/sdk/index.js.map +1 -1
- package/lib/sdk/sdk_connection.js +0 -10
- package/lib/sdk/sdk_connection.js.map +1 -1
- package/package.json +4 -4
- package/lib/connect/tile/index.d.ts +0 -1
- package/lib/connect/tile/index.js +0 -19
- package/lib/connect/tile/index.js.map +0 -1
- package/lib/connect/tile/tile_sdk.d.ts +0 -24
- package/lib/connect/tile/tile_sdk.js +0 -153
- package/lib/connect/tile/tile_sdk.js.map +0 -1
- package/lib/connect/tile/types.d.ts +0 -86
- package/lib/connect/tile/types.js +0 -15
- package/lib/connect/tile/types.js.map +0 -1
- package/lib/connect/visualization/index.d.ts +0 -2
- package/lib/connect/visualization/index.js +0 -32
- package/lib/connect/visualization/index.js.map +0 -1
- package/lib/connect/visualization/types.d.ts +0 -62
- package/lib/connect/visualization/types.js +0 -2
- package/lib/connect/visualization/types.js.map +0 -1
- package/lib/connect/visualization/visualization_sdk.d.ts +0 -36
- package/lib/connect/visualization/visualization_sdk.js +0 -166
- package/lib/connect/visualization/visualization_sdk.js.map +0 -1
- package/lib/esm/connect/tile/index.js +0 -2
- package/lib/esm/connect/tile/index.js.map +0 -1
- package/lib/esm/connect/tile/tile_sdk.js +0 -140
- package/lib/esm/connect/tile/tile_sdk.js.map +0 -1
- package/lib/esm/connect/tile/types.js +0 -8
- package/lib/esm/connect/tile/types.js.map +0 -1
- package/lib/esm/connect/visualization/index.js +0 -3
- package/lib/esm/connect/visualization/index.js.map +0 -1
- package/lib/esm/connect/visualization/types.js +0 -2
- package/lib/esm/connect/visualization/types.js.map +0 -1
- package/lib/esm/connect/visualization/visualization_sdk.js +0 -156
- package/lib/esm/connect/visualization/visualization_sdk.js.map +0 -1
- package/lib/esm/util/errors.js +0 -2
- package/lib/esm/util/errors.js.map +0 -1
- package/lib/esm/util/index.js +0 -3
- package/lib/esm/util/index.js.map +0 -1
- package/lib/esm/util/logger.js +0 -15
- package/lib/esm/util/logger.js.map +0 -1
- package/lib/util/errors.d.ts +0 -1
- package/lib/util/errors.js +0 -9
- package/lib/util/errors.js.map +0 -1
- package/lib/util/index.d.ts +0 -2
- package/lib/util/index.js +0 -32
- package/lib/util/index.js.map +0 -1
- package/lib/util/logger.d.ts +0 -2
- package/lib/util/logger.js +0 -27
- package/lib/util/logger.js.map +0 -1
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.VisualizationSDKImpl = void 0;
|
|
7
|
-
|
|
8
|
-
var _errors = require("../../util/errors");
|
|
9
|
-
|
|
10
|
-
var _types = require("../types");
|
|
11
|
-
|
|
12
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
|
|
14
|
-
class QueryResponseImpl {
|
|
15
|
-
constructor(queryResponse) {
|
|
16
|
-
_defineProperty(this, "_queryResponse", void 0);
|
|
17
|
-
|
|
18
|
-
this._queryResponse = queryResponse;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
update(queryResponse) {
|
|
22
|
-
this._queryResponse = queryResponse;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
get fieldMeasures() {
|
|
26
|
-
var _this$_queryResponse, _this$_queryResponse$;
|
|
27
|
-
|
|
28
|
-
return ((_this$_queryResponse = this._queryResponse) === null || _this$_queryResponse === void 0 ? void 0 : (_this$_queryResponse$ = _this$_queryResponse.fields) === null || _this$_queryResponse$ === void 0 ? void 0 : _this$_queryResponse$.measures) || [];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
get fieldDimensions() {
|
|
32
|
-
var _this$_queryResponse2, _this$_queryResponse3;
|
|
33
|
-
|
|
34
|
-
return ((_this$_queryResponse2 = this._queryResponse) === null || _this$_queryResponse2 === void 0 ? void 0 : (_this$_queryResponse3 = _this$_queryResponse2.fields) === null || _this$_queryResponse3 === void 0 ? void 0 : _this$_queryResponse3.dimensions) || [];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get fieldTableCalculations() {
|
|
38
|
-
var _this$_queryResponse4, _this$_queryResponse5;
|
|
39
|
-
|
|
40
|
-
return ((_this$_queryResponse4 = this._queryResponse) === null || _this$_queryResponse4 === void 0 ? void 0 : (_this$_queryResponse5 = _this$_queryResponse4.fields) === null || _this$_queryResponse5 === void 0 ? void 0 : _this$_queryResponse5.table_calculations) || [];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
get fieldPivots() {
|
|
44
|
-
var _this$_queryResponse6, _this$_queryResponse7;
|
|
45
|
-
|
|
46
|
-
return ((_this$_queryResponse6 = this._queryResponse) === null || _this$_queryResponse6 === void 0 ? void 0 : (_this$_queryResponse7 = _this$_queryResponse6.fields) === null || _this$_queryResponse7 === void 0 ? void 0 : _this$_queryResponse7.pivots) || [];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
get fieldMeasureLike() {
|
|
50
|
-
var _this$_queryResponse8, _this$_queryResponse9;
|
|
51
|
-
|
|
52
|
-
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) || [];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
get fieldDimensionLike() {
|
|
56
|
-
var _this$_queryResponse10, _this$_queryResponse11;
|
|
57
|
-
|
|
58
|
-
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) || [];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
get data() {
|
|
62
|
-
var _this$_queryResponse12;
|
|
63
|
-
|
|
64
|
-
return ((_this$_queryResponse12 = this._queryResponse) === null || _this$_queryResponse12 === void 0 ? void 0 : _this$_queryResponse12.data) || [];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
class VisualizationConfigImpl {
|
|
70
|
-
constructor(visConfig) {
|
|
71
|
-
_defineProperty(this, "_visConfig", void 0);
|
|
72
|
-
|
|
73
|
-
this._visConfig = visConfig;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
update(visConfig) {
|
|
77
|
-
this._visConfig = visConfig;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
get queryFieldMeasures() {
|
|
81
|
-
var _this$_visConfig, _this$_visConfig$quer;
|
|
82
|
-
|
|
83
|
-
return ((_this$_visConfig = this._visConfig) === null || _this$_visConfig === void 0 ? void 0 : (_this$_visConfig$quer = _this$_visConfig.query_fields) === null || _this$_visConfig$quer === void 0 ? void 0 : _this$_visConfig$quer.measures) || [];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
get queryFieldDimensions() {
|
|
87
|
-
var _this$_visConfig2, _this$_visConfig2$que;
|
|
88
|
-
|
|
89
|
-
return ((_this$_visConfig2 = this._visConfig) === null || _this$_visConfig2 === void 0 ? void 0 : (_this$_visConfig2$que = _this$_visConfig2.query_fields) === null || _this$_visConfig2$que === void 0 ? void 0 : _this$_visConfig2$que.dimensions) || [];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
get queryFieldTableCalculations() {
|
|
93
|
-
var _this$_visConfig3, _this$_visConfig3$que;
|
|
94
|
-
|
|
95
|
-
return ((_this$_visConfig3 = this._visConfig) === null || _this$_visConfig3 === void 0 ? void 0 : (_this$_visConfig3$que = _this$_visConfig3.query_fields) === null || _this$_visConfig3$que === void 0 ? void 0 : _this$_visConfig3$que.table_calculations) || [];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
get queryFieldPivots() {
|
|
99
|
-
var _this$_visConfig4, _this$_visConfig4$que;
|
|
100
|
-
|
|
101
|
-
return ((_this$_visConfig4 = this._visConfig) === null || _this$_visConfig4 === void 0 ? void 0 : (_this$_visConfig4$que = _this$_visConfig4.query_fields) === null || _this$_visConfig4$que === void 0 ? void 0 : _this$_visConfig4$que.pivots) || [];
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
class VisualizationSDKImpl {
|
|
107
|
-
constructor(hostApi) {
|
|
108
|
-
_defineProperty(this, "hostApi", void 0);
|
|
109
|
-
|
|
110
|
-
_defineProperty(this, "visualizationData", void 0);
|
|
111
|
-
|
|
112
|
-
_defineProperty(this, "_visConfig", void 0);
|
|
113
|
-
|
|
114
|
-
_defineProperty(this, "_queryResponse", void 0);
|
|
115
|
-
|
|
116
|
-
this.hostApi = hostApi;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
updateVisData(visualizationData) {
|
|
120
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
121
|
-
this.visualizationData = visualizationData;
|
|
122
|
-
|
|
123
|
-
if (this._visConfig) {
|
|
124
|
-
this._visConfig.update(this.visualizationData.visConfig);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (this._queryResponse) {
|
|
128
|
-
this._queryResponse.update(this.visualizationData.queryResponse);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
configureVisualization(options) {
|
|
134
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
135
|
-
this.hostApi.send(_types.ExtensionRequestType.VIS_DEFAULT_CONFIG, {
|
|
136
|
-
options
|
|
137
|
-
});
|
|
138
|
-
} else {
|
|
139
|
-
throw _errors.NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
get visConfig() {
|
|
144
|
-
if (!this._visConfig) {
|
|
145
|
-
var _this$visualizationDa;
|
|
146
|
-
|
|
147
|
-
this._visConfig = new VisualizationConfigImpl((_this$visualizationDa = this.visualizationData) === null || _this$visualizationDa === void 0 ? void 0 : _this$visualizationDa.visConfig);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return this._visConfig;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
get queryResponse() {
|
|
154
|
-
if (!this._queryResponse) {
|
|
155
|
-
var _this$visualizationDa2;
|
|
156
|
-
|
|
157
|
-
this._queryResponse = new QueryResponseImpl((_this$visualizationDa2 = this.visualizationData) === null || _this$visualizationDa2 === void 0 ? void 0 : _this$visualizationDa2.queryResponse);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return this._queryResponse;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
exports.VisualizationSDKImpl = VisualizationSDKImpl;
|
|
166
|
-
//# sourceMappingURL=visualization_sdk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/connect/visualization/visualization_sdk.ts"],"names":["QueryResponseImpl","constructor","queryResponse","_queryResponse","update","fieldMeasures","fields","measures","fieldDimensions","dimensions","fieldTableCalculations","table_calculations","fieldPivots","pivots","fieldMeasureLike","measure_like","fieldDimensionLike","dimension_like","data","VisualizationConfigImpl","visConfig","_visConfig","queryFieldMeasures","query_fields","queryFieldDimensions","queryFieldTableCalculations","queryFieldPivots","VisualizationSDKImpl","hostApi","updateVisData","visualizationData","isDashboardMountSupported","configureVisualization","options","send","ExtensionRequ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QAAAA;AAAF,OAA3D;AACD,KAFD,MAEO;AACL,YAAMI,+CAAN;AACD;AACF;;AAEY,MAATjB,SAAS,GAAwB;AACnC,QAAI,CAAC,KAAKC,UAAV,EAAsB;AAAA;;AACpB,WAAKA,UAAL,GAAkB,IAAIF,uBAAJ,0BAChB,KAAKW,iBADW,0DAChB,sBAAwBV,SADR,CAAlB;AAGD;;AACD,WAAO,KAAKC,UAAZ;AACD;;AAEgB,MAAbnB,aAAa,GAAkB;AACjC,QAAI,CAAC,KAAKC,cAAV,EAA0B;AAAA;;AACxB,WAAKA,cAAL,GAAsB,IAAIH,iBAAJ,2BACpB,KAAK8B,iBADe,2DACpB,uBAAwB5B,aADJ,CAAtB;AAGD;;AACD,WAAO,KAAKC,cAAZ;AACD;;AAhD2D","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 VisualizationSDK,\n RawVisualizationData,\n RawVisConfig,\n VisualizationConfig,\n QueryResponse,\n Measure,\n Dimension,\n TableCalculation,\n PivotConfig,\n RawVisQueryResponse,\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 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 VisualizationSDK {\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) {\n this._visConfig.update(this.visualizationData.visConfig)\n }\n if (this._queryResponse) {\n this._queryResponse.update(this.visualizationData.queryResponse)\n }\n }\n }\n\n configureVisualization(options: RawVisConfig): 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 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 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"],"file":"visualization_sdk.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/connect/tile/index.ts"],"names":[],"mappings":"AAyBA,cAAc,SAAd","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 */\nexport * from './types'\n"],"file":"index.js"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
4
|
-
|
|
5
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
|
|
7
|
-
import { NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR } from '../../util/errors';
|
|
8
|
-
import { ExtensionRequestType } from '../types';
|
|
9
|
-
import { DashboardRunState } from './types';
|
|
10
|
-
var defaultHostData = {
|
|
11
|
-
isDashboardEditing: false,
|
|
12
|
-
dashboardRunState: DashboardRunState.UNKNOWN,
|
|
13
|
-
dashboardFilters: {}
|
|
14
|
-
};
|
|
15
|
-
export class TileSDKImpl {
|
|
16
|
-
constructor(hostApi) {
|
|
17
|
-
_defineProperty(this, "hostApi", void 0);
|
|
18
|
-
|
|
19
|
-
_defineProperty(this, "tileHostData", void 0);
|
|
20
|
-
|
|
21
|
-
this.hostApi = hostApi;
|
|
22
|
-
this.tileHostData = _objectSpread({}, defaultHostData);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
tileHostDataChanged(partialHostData) {
|
|
26
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
27
|
-
this.tileHostData = _objectSpread(_objectSpread({}, this.tileHostData), partialHostData);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
addErrors() {
|
|
32
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
33
|
-
for (var _len = arguments.length, errors = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34
|
-
errors[_key] = arguments[_key];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
this.hostApi.send(ExtensionRequestType.TILE_ADD_ERRORS, {
|
|
38
|
-
errors
|
|
39
|
-
});
|
|
40
|
-
} else {
|
|
41
|
-
throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
clearErrors(group) {
|
|
46
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
47
|
-
this.hostApi.send(ExtensionRequestType.TILE_CLEAR_ERRORS, {
|
|
48
|
-
group
|
|
49
|
-
});
|
|
50
|
-
} else {
|
|
51
|
-
throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
trigger(message, config, event) {
|
|
56
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
57
|
-
this.hostApi.send(ExtensionRequestType.TILE_TRIGGER, {
|
|
58
|
-
message,
|
|
59
|
-
config,
|
|
60
|
-
event: this.sanitizeEvent(event)
|
|
61
|
-
});
|
|
62
|
-
} else {
|
|
63
|
-
throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
openDrillMenu(options, event) {
|
|
68
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
69
|
-
this.hostApi.send(ExtensionRequestType.TILE_OPEN_DRILL_MENU, {
|
|
70
|
-
options,
|
|
71
|
-
event: this.sanitizeEvent(event)
|
|
72
|
-
});
|
|
73
|
-
} else {
|
|
74
|
-
throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
toggleCrossFilter(options, event) {
|
|
79
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
80
|
-
this.hostApi.send(ExtensionRequestType.TILE_TOGGLE_CROSS_FILTER, {
|
|
81
|
-
options,
|
|
82
|
-
event: this.sanitizeEvent(event)
|
|
83
|
-
});
|
|
84
|
-
} else {
|
|
85
|
-
throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
runDashboard() {
|
|
90
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
91
|
-
this.hostApi.send(ExtensionRequestType.TILE_RUN_DASHBOARD, {});
|
|
92
|
-
} else {
|
|
93
|
-
throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
stopDashboard() {
|
|
98
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
99
|
-
this.hostApi.send(ExtensionRequestType.TILE_STOP_DASHBOARD, {});
|
|
100
|
-
} else {
|
|
101
|
-
throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
updateFilters(filters) {
|
|
106
|
-
var runDashboard = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
107
|
-
|
|
108
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
109
|
-
this.hostApi.send(ExtensionRequestType.TILE_UPDATE_FILTERS, {
|
|
110
|
-
filters,
|
|
111
|
-
runDashboard
|
|
112
|
-
});
|
|
113
|
-
} else {
|
|
114
|
-
throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
openScheduleDialog() {
|
|
119
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
120
|
-
return this.hostApi.sendAndReceive(ExtensionRequestType.TILE_OPEN_SCHEDULE_DIALOG, {});
|
|
121
|
-
} else {
|
|
122
|
-
throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
sanitizeEvent(event) {
|
|
127
|
-
if (event) {
|
|
128
|
-
return {
|
|
129
|
-
metaKey: event.metaKey,
|
|
130
|
-
pageX: event.pageX,
|
|
131
|
-
pageY: event.pageY,
|
|
132
|
-
type: event.type
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return undefined;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
//# sourceMappingURL=tile_sdk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/connect/tile/tile_sdk.ts"],"names":["NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR","ExtensionRequestType","DashboardRunState","defaultHostData","isDashboardEditing","dashboardRunState","UNKNOWN","dashboardFilters","TileSDKImpl","constructor","hostApi","tileHostData","tileHostDataChanged","partialHostData","isDashboardMountSupported","addErrors","errors","send","TILE_ADD_ERRORS","clearErrors","group","TILE_CLEAR_ERRORS","trigger","message","config","event","TILE_TRIGGER","sanitizeEvent","openDrillMenu","options","TILE_OPEN_DRILL_MENU","toggleCrossFilter","TILE_TOGGLE_CROSS_FILTER","runDashboard","TILE_RUN_DASHBOARD","stopDashboard","TILE_STOP_DASHBOARD","updateFilters","filters","TILE_UPDATE_FILTERS","openScheduleDialog","sendAndReceive","TILE_OPEN_SCHEDULE_DIALOG","metaKey","pageX","pageY","type","undefined"],"mappings":";;;;;;AA2BA,SAASA,uCAAT,QAAwD,mBAAxD;AACA,SAASC,oBAAT,QAAqC,UAArC;AAWA,SAASC,iBAAT,QAAkC,SAAlC;AAEA,IAAMC,eAA6B,GAAG;AACpCC,EAAAA,kBAAkB,EAAE,KADgB;AAEpCC,EAAAA,iBAAiB,EAAEH,iBAAiB,CAACI,OAFD;AAGpCC,EAAAA,gBAAgB,EAAE;AAHkB,CAAtC;AAKA,OAAO,MAAMC,WAAN,CAAqC;AAI1CC,EAAAA,WAAW,CAACC,OAAD,EAAgC;AAAA;;AAAA;;AACzC,SAAKA,OAAL,GAAeA,OAAf;AACA,SAAKC,YAAL,qBAAyBR,eAAzB;AACD;;AAEDS,EAAAA,mBAAmB,CAACC,eAAD,EAAyC;AAG1D,QAAI,KAAKH,OAAL,CAAaI,yBAAjB,EAA4C;AAC1C,WAAKH,YAAL,mCAAyB,KAAKA,YAA9B,GAA+CE,eAA/C;AACD;AACF;;AAEDE,EAAAA,SAAS,GAAyB;AAChC,QAAI,KAAKL,OAAL,CAAaI,yBAAjB,EAA4C;AAAA,wCADjCE,MACiC;AADjCA,QAAAA,MACiC;AAAA;;AAC1C,WAAKN,OAAL,CAAaO,IAAb,CAAkBhB,oBAAoB,CAACiB,eAAvC,EAAwD;AAAEF,QAAAA;AAAF,OAAxD;AACD,KAFD,MAEO;AACL,YAAMhB,uCAAN;AACD;AACF;;AAEDmB,EAAAA,WAAW,CAACC,KAAD,EAAiB;AAC1B,QAAI,KAAKV,OAAL,CAAaI,yBAAjB,EAA4C;AAC1C,WAAKJ,OAAL,CAAaO,IAAb,CAAkBhB,oBAAoB,CAACoB,iBAAvC,EAA0D;AAAED,QAAAA;AAAF,O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AEO;AACL,YAAMlC,uCAAN;AACD;AACF;;AAEDmC,EAAAA,aAAa,GAAG;AACd,QAAI,KAAKzB,OAAL,CAAaI,yBAAjB,EAA4C;AAC1C,WAAKJ,OAAL,CAAaO,IAAb,CAAkBhB,oBAAoB,CAACmC,mBAAvC,EAA4D,EAA5D;AACD,KAFD,MAEO;AACL,YAAMpC,uCAAN;AACD;AACF;;AAEDqC,EAAAA,aAAa,CAACC,OAAD,EAAyC;AAAA,QAAtBL,YAAsB,uEAAP,KAAO;;AACpD,QAAI,KAAKvB,OAAL,CAAaI,yBAAjB,EAA4C;AAC1C,WAAKJ,OAAL,CAAaO,IAAb,CAAkBhB,oBAAoB,CAACsC,mBAAvC,EAA4D;AAC1DD,QAAAA,OAD0D;AAE1DL,QAAAA;AAF0D,OAA5D;AAID,KALD,MAKO;AACL,YAAMjC,uCAAN;AACD;AACF;;AAEDwC,EAAAA,kBAAkB,GAAG;AACnB,QAAI,KAAK9B,OAAL,CAAaI,yBAAjB,EAA4C;AAC1C,aAAO,KAAKJ,OAAL,CAAa+B,cAAb,CACLxC,oBAAoB,CAACyC,yBADhB,EAEL,EAFK,CAAP;AAID,KALD,MAKO;AACL,YAAM1C,uCAAN;AACD;AACF;;AAED2B,EAAAA,aAAa,CAACF,KAAD,EAAqB;AAChC,QAAIA,KAAJ,EAAW;AACT,aAAO;AACLkB,QAAAA,OAAO,EAAElB,KAAK,CAACkB,OADV;AAELC,QAAAA,KAAK,EAAEnB,KAAK,CAACmB,KAFR;AAGLC,QAAAA,KAAK,EAAEpB,KAAK,CAACoB,KAHR;AAILC,QAAAA,IAAI,EAAErB,KAAK,CAACqB;AAJP,OAAP;AAMD;;AACD,WAAOC,SAAP;AACD;;AAnHyC","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 { MouseEvent } from 'react'\nimport { NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR } from '../../util/errors'\nimport { ExtensionRequestType } from '../types'\nimport type { ExtensionHostApiImpl } from '../extension_host_api'\nimport type {\n TileSDK,\n TileError,\n DrillMenuOptions,\n TriggerConfig,\n CrossFilterOptions,\n Filters,\n TileHostData,\n} from './types'\nimport { DashboardRunState } from './types'\n\nconst defaultHostData: TileHostData = {\n isDashboardEditing: false,\n dashboardRunState: DashboardRunState.UNKNOWN,\n dashboardFilters: {},\n}\nexport class TileSDKImpl implements TileSDK {\n hostApi: ExtensionHostApiImpl\n tileHostData: TileHostData\n\n constructor(hostApi: ExtensionHostApiImpl) {\n this.hostApi = hostApi\n this.tileHostData = { ...defaultHostData }\n }\n\n tileHostDataChanged(partialHostData: Partial<TileHostData>) {\n // Ignore update messages if dashboard mounts not supported.\n // Should never happen.\n if (this.hostApi.isDashboardMountSupported) {\n this.tileHostData = { ...this.tileHostData, ...partialHostData }\n }\n }\n\n addErrors(...errors: TileError[]) {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.TILE_ADD_ERRORS, { errors })\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR\n }\n }\n\n clearErrors(group?: string) {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.TILE_CLEAR_ERRORS, { group })\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR\n }\n }\n\n trigger(message: string, config: TriggerConfig[], event?: MouseEvent) {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.TILE_TRIGGER, {\n message,\n config,\n event: this.sanitizeEvent(event),\n })\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR\n }\n }\n\n openDrillMenu(options: DrillMenuOptions, event?: MouseEvent) {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.TILE_OPEN_DRILL_MENU, {\n options,\n event: this.sanitizeEvent(event),\n })\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR\n }\n }\n\n toggleCrossFilter(options: CrossFilterOptions, event?: MouseEvent) {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.TILE_TOGGLE_CROSS_FILTER, {\n options,\n event: this.sanitizeEvent(event),\n })\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR\n }\n }\n\n runDashboard() {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.TILE_RUN_DASHBOARD, {})\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR\n }\n }\n\n stopDashboard() {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.TILE_STOP_DASHBOARD, {})\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR\n }\n }\n\n updateFilters(filters: Filters, runDashboard = false) {\n if (this.hostApi.isDashboardMountSupported) {\n this.hostApi.send(ExtensionRequestType.TILE_UPDATE_FILTERS, {\n filters,\n runDashboard,\n })\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR\n }\n }\n\n openScheduleDialog() {\n if (this.hostApi.isDashboardMountSupported) {\n return this.hostApi.sendAndReceive(\n ExtensionRequestType.TILE_OPEN_SCHEDULE_DIALOG,\n {}\n )\n } else {\n throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR\n }\n }\n\n sanitizeEvent(event?: MouseEvent) {\n if (event) {\n return {\n metaKey: event.metaKey,\n pageX: event.pageX,\n pageY: event.pageY,\n type: event.type,\n }\n }\n return undefined\n }\n}\n"],"file":"tile_sdk.js"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export var DashboardRunState;
|
|
2
|
-
|
|
3
|
-
(function (DashboardRunState) {
|
|
4
|
-
DashboardRunState["UNKNOWN"] = "UNKNOWN";
|
|
5
|
-
DashboardRunState["RUNNING"] = "RUNNING";
|
|
6
|
-
DashboardRunState["NOT_RUNNING"] = "NOT_RUNNING";
|
|
7
|
-
})(DashboardRunState || (DashboardRunState = {}));
|
|
8
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/connect/tile/types.ts"],"names":["DashboardRunState"],"mappings":"AAuCA,WAAYA,iBAAZ;;WAAYA,iB;AAAAA,EAAAA,iB;AAAAA,EAAAA,iB;AAAAA,EAAAA,iB;GAAAA,iB,KAAAA,iB","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 { MouseEvent } from 'react'\n\n/**\n * Callback that is invoked when a change in the host happens\n * <code>Looker >=22.8</code>\n */\nexport type TileHostDataChangedCallback = (\n tileHostData: Partial<TileHostData>\n) => void\n\n/**\n * Defines the current run state of the dashboard\n */\nexport enum DashboardRunState {\n UNKNOWN = 'UNKNOWN',\n RUNNING = 'RUNNING',\n NOT_RUNNING = 'NOT_RUNNING',\n}\n\nexport interface TileHostData {\n /**\n * When true indicates that the tile is being configured as\n * a visualization inside of an explore.\n */\n isExploring?: boolean\n /**\n * The dashboard id the tile is being rendered in. If the tile\n * is being configured as an explore this will not be populated.\n */\n dashboardId?: string\n /**\n * The element id of the tile being rendered. If the tile\n * is being configured as an explore this will not be populated.\n */\n elementId?: string\n /**\n * The query id of the tile being rendered if it is associated with\n * a visualization. If the tile is being configured as an explore\n * this will not be populated.\n *\n * Note that queryId is that of the query created when the visualization\n * is built in the Looker explore. It does not contain any filters or\n * cross filtering applied to the dashboard. Filters and cross filters\n * will need to be applied and a new query generated in order to reflect\n * the data shown in the QueryResponse. As such the queryId may not be\n * that useful.\n */\n queryId?: string\n /**\n * The query slug of the tile being rendered if it is associated with\n * a visualization. If the tile is being configured as an explore\n * this will not be populated.\n *\n * Note that querySlug is that of the query created when the visualization\n * is built in the Looker explore. It does not contain any filters or\n * cross filtering applied to the dashboard. Filters and cross filters\n * will need to be applied and a new query generated in order to reflect\n * the data shown in the QueryResponse. As such the queryId may not be\n * that useful.\n */\n querySlug?: string\n /**\n * The filters being applied to the dashboard. If the tile\n * is being configured as an explore this will not be populated.\n */\n dashboardFilters?: Filters\n /**\n * Indicates whether the dashboard is running. If the tile\n * is being configured as an explore the state will be UNKNOWN.\n * Note that for dashboard performance reasons, the runstate\n * may NEVER be shown as running. This generally will happen\n * if there no other tiles associated with a query (including\n * the one the extension is associated with).\n * If the extension needs to know for certain that a dashboard\n * has been run, detecting differences in the lastRunStartTime\n * is the reliable way.\n */\n dashboardRunState?: DashboardRunState\n /**\n * When true, the dashboard is being edited. If the tile\n * is being configured as an explore this will not be populated.\n */\n isDashboardEditing?: boolean\n /**\n * When true, cross filtering. If the tile\n * is being configured as an explore this will not be populated.\n */\n isDashboardCrossFilteringEnabled?: boolean\n /**\n * The id of the tile extension element that triggered the last\n * dashboard run. The id will be undefined if the dashboard run\n * was triggered by the dashboard run button or auto run or if\n * the run was triggered using the embed SDK. If the tile\n * is being configured as an explore this will not be populated.\n * Note that the lastRunSourceElementId CAN be the same as the\n * element id of the current extension instance, in other words,\n * if the extension triggers a dashboard run, it will be notified\n * when the dashboard run starts and finishes.\n */\n lastRunSourceElementId?: string\n /**\n * Indicates the last dashboard run start time. If the tile\n * is being configured as an explore this will not be populated.\n * Note that the start and end times reported should not\n * used for capturing performance metrics.\n */\n lastRunStartTime?: number\n /**\n * Indicates the last dashboard run end time. If the tile\n * is being configured as an explore this will not be populated.\n * If the tile is running, this will not be populated.\n * Note that the start and end times reported should not\n * used for capturing performance metrics.\n */\n lastRunEndTime?: number\n /**\n * Indicates whether the last dashboard run was succesful or not.\n * If the tile is being configured as an explore this will not be\n * populated.\n * If the tile is running, this will not be populated.\n */\n lastRunSuccess?: boolean\n}\n\nexport interface Pivot {\n key: string\n is_total: boolean\n data: { [key: string]: string }\n metadata: { [key: string]: { [key: string]: string | Link[] } }\n labels: { [key: string]: string }\n sort_values?: { [key: string]: string }\n}\n\nexport interface Cell {\n [key: string]: any\n value: any\n rendered?: string\n html?: string\n links?: Link[]\n}\n\nexport interface Link {\n label: string\n type: string\n type_label: string\n url: string\n}\n\nexport interface PivotCell {\n [pivotKey: string]: Cell\n}\n\nexport interface Row {\n [fieldName: string]: PivotCell | Cell\n}\n\nexport interface TileError {\n title: string\n message: string\n group: string\n}\n\nexport interface CrossFilterOptions {\n pivot: Pivot\n row: Row\n}\n\n// TODO build out type\nexport type TriggerConfig = any\n\n// TODO build out type\nexport type DrillMenuOptions = any\n\nexport interface Filters {\n [key: string]: string\n}\n\nexport interface TileSDK {\n tileHostData: TileHostData\n tileHostDataChanged: (hostData: Partial<TileHostData>) => void\n addErrors: (...errors: TileError[]) => void\n clearErrors: (group?: string) => void\n trigger: (\n message: string,\n config: TriggerConfig[],\n event?: MouseEvent\n ) => void\n openDrillMenu: (options: DrillMenuOptions, event?: MouseEvent) => void\n toggleCrossFilter: (options: CrossFilterOptions, event?: MouseEvent) => void\n runDashboard: () => void\n stopDashboard: () => void\n updateFilters: (filters: Filters, runDashboard?: boolean) => void\n openScheduleDialog: () => Promise<void>\n}\n"],"file":"types.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/connect/visualization/index.ts"],"names":[],"mappings":"AA0BA,cAAc,SAAd;AACA,cAAc,qBAAd","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\nexport * from './types'\nexport * from './visualization_sdk'\n"],"file":"index.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
|
-
import { NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR } from '../../util/errors';
|
|
4
|
-
import { ExtensionRequestType } from '../types';
|
|
5
|
-
|
|
6
|
-
class QueryResponseImpl {
|
|
7
|
-
constructor(queryResponse) {
|
|
8
|
-
_defineProperty(this, "_queryResponse", void 0);
|
|
9
|
-
|
|
10
|
-
this._queryResponse = queryResponse;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
update(queryResponse) {
|
|
14
|
-
this._queryResponse = queryResponse;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
get fieldMeasures() {
|
|
18
|
-
var _this$_queryResponse, _this$_queryResponse$;
|
|
19
|
-
|
|
20
|
-
return ((_this$_queryResponse = this._queryResponse) === null || _this$_queryResponse === void 0 ? void 0 : (_this$_queryResponse$ = _this$_queryResponse.fields) === null || _this$_queryResponse$ === void 0 ? void 0 : _this$_queryResponse$.measures) || [];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
get fieldDimensions() {
|
|
24
|
-
var _this$_queryResponse2, _this$_queryResponse3;
|
|
25
|
-
|
|
26
|
-
return ((_this$_queryResponse2 = this._queryResponse) === null || _this$_queryResponse2 === void 0 ? void 0 : (_this$_queryResponse3 = _this$_queryResponse2.fields) === null || _this$_queryResponse3 === void 0 ? void 0 : _this$_queryResponse3.dimensions) || [];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get fieldTableCalculations() {
|
|
30
|
-
var _this$_queryResponse4, _this$_queryResponse5;
|
|
31
|
-
|
|
32
|
-
return ((_this$_queryResponse4 = this._queryResponse) === null || _this$_queryResponse4 === void 0 ? void 0 : (_this$_queryResponse5 = _this$_queryResponse4.fields) === null || _this$_queryResponse5 === void 0 ? void 0 : _this$_queryResponse5.table_calculations) || [];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
get fieldPivots() {
|
|
36
|
-
var _this$_queryResponse6, _this$_queryResponse7;
|
|
37
|
-
|
|
38
|
-
return ((_this$_queryResponse6 = this._queryResponse) === null || _this$_queryResponse6 === void 0 ? void 0 : (_this$_queryResponse7 = _this$_queryResponse6.fields) === null || _this$_queryResponse7 === void 0 ? void 0 : _this$_queryResponse7.pivots) || [];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get fieldMeasureLike() {
|
|
42
|
-
var _this$_queryResponse8, _this$_queryResponse9;
|
|
43
|
-
|
|
44
|
-
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) || [];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
get fieldDimensionLike() {
|
|
48
|
-
var _this$_queryResponse10, _this$_queryResponse11;
|
|
49
|
-
|
|
50
|
-
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) || [];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
get data() {
|
|
54
|
-
var _this$_queryResponse12;
|
|
55
|
-
|
|
56
|
-
return ((_this$_queryResponse12 = this._queryResponse) === null || _this$_queryResponse12 === void 0 ? void 0 : _this$_queryResponse12.data) || [];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
class VisualizationConfigImpl {
|
|
62
|
-
constructor(visConfig) {
|
|
63
|
-
_defineProperty(this, "_visConfig", void 0);
|
|
64
|
-
|
|
65
|
-
this._visConfig = visConfig;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
update(visConfig) {
|
|
69
|
-
this._visConfig = visConfig;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
get queryFieldMeasures() {
|
|
73
|
-
var _this$_visConfig, _this$_visConfig$quer;
|
|
74
|
-
|
|
75
|
-
return ((_this$_visConfig = this._visConfig) === null || _this$_visConfig === void 0 ? void 0 : (_this$_visConfig$quer = _this$_visConfig.query_fields) === null || _this$_visConfig$quer === void 0 ? void 0 : _this$_visConfig$quer.measures) || [];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
get queryFieldDimensions() {
|
|
79
|
-
var _this$_visConfig2, _this$_visConfig2$que;
|
|
80
|
-
|
|
81
|
-
return ((_this$_visConfig2 = this._visConfig) === null || _this$_visConfig2 === void 0 ? void 0 : (_this$_visConfig2$que = _this$_visConfig2.query_fields) === null || _this$_visConfig2$que === void 0 ? void 0 : _this$_visConfig2$que.dimensions) || [];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
get queryFieldTableCalculations() {
|
|
85
|
-
var _this$_visConfig3, _this$_visConfig3$que;
|
|
86
|
-
|
|
87
|
-
return ((_this$_visConfig3 = this._visConfig) === null || _this$_visConfig3 === void 0 ? void 0 : (_this$_visConfig3$que = _this$_visConfig3.query_fields) === null || _this$_visConfig3$que === void 0 ? void 0 : _this$_visConfig3$que.table_calculations) || [];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
get queryFieldPivots() {
|
|
91
|
-
var _this$_visConfig4, _this$_visConfig4$que;
|
|
92
|
-
|
|
93
|
-
return ((_this$_visConfig4 = this._visConfig) === null || _this$_visConfig4 === void 0 ? void 0 : (_this$_visConfig4$que = _this$_visConfig4.query_fields) === null || _this$_visConfig4$que === void 0 ? void 0 : _this$_visConfig4$que.pivots) || [];
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export class VisualizationSDKImpl {
|
|
99
|
-
constructor(hostApi) {
|
|
100
|
-
_defineProperty(this, "hostApi", void 0);
|
|
101
|
-
|
|
102
|
-
_defineProperty(this, "visualizationData", void 0);
|
|
103
|
-
|
|
104
|
-
_defineProperty(this, "_visConfig", void 0);
|
|
105
|
-
|
|
106
|
-
_defineProperty(this, "_queryResponse", void 0);
|
|
107
|
-
|
|
108
|
-
this.hostApi = hostApi;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
updateVisData(visualizationData) {
|
|
112
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
113
|
-
this.visualizationData = visualizationData;
|
|
114
|
-
|
|
115
|
-
if (this._visConfig) {
|
|
116
|
-
this._visConfig.update(this.visualizationData.visConfig);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (this._queryResponse) {
|
|
120
|
-
this._queryResponse.update(this.visualizationData.queryResponse);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
configureVisualization(options) {
|
|
126
|
-
if (this.hostApi.isDashboardMountSupported) {
|
|
127
|
-
this.hostApi.send(ExtensionRequestType.VIS_DEFAULT_CONFIG, {
|
|
128
|
-
options
|
|
129
|
-
});
|
|
130
|
-
} else {
|
|
131
|
-
throw NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
get visConfig() {
|
|
136
|
-
if (!this._visConfig) {
|
|
137
|
-
var _this$visualizationDa;
|
|
138
|
-
|
|
139
|
-
this._visConfig = new VisualizationConfigImpl((_this$visualizationDa = this.visualizationData) === null || _this$visualizationDa === void 0 ? void 0 : _this$visualizationDa.visConfig);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return this._visConfig;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
get queryResponse() {
|
|
146
|
-
if (!this._queryResponse) {
|
|
147
|
-
var _this$visualizationDa2;
|
|
148
|
-
|
|
149
|
-
this._queryResponse = new QueryResponseImpl((_this$visualizationDa2 = this.visualizationData) === null || _this$visualizationDa2 === void 0 ? void 0 : _this$visualizationDa2.queryResponse);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return this._queryResponse;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
//# sourceMappingURL=visualization_sdk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/connect/visualization/visualization_sdk.ts"],"names":["NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR","ExtensionRequestType","QueryResponseImpl","constructor","queryResponse","_queryResponse","update","fieldMeasures","fields","measures","fieldDimensions","dimensions","fieldTableCalculations","table_calculations","fieldPivots","pivots","fieldMeasureLike","measure_like","fieldDimensionLike","dimension_like","data","VisualizationConfigImpl","visConfig","_visConfig","queryFieldMeasures","query_fields","queryFieldDimensions","queryFieldTableCalculations","queryFieldPivots","VisualizationSDKImpl","hostApi","updateVisData","visualizationData","isDashboardMountSupported","configureVisualization","options","send","VIS_DEFAULT_CONFIG"],"mappings":";;AA0BA,SAASA,uCAAT,QAAwD,mBAAxD;AAEA,SAASC,oBAAT,QAAqC,UAArC;;AAeA,MAAMC,iBAAN,CAAiD;AAG/CC,EAAAA,WAAW,CAACC,aAAD,EAAsC;AAAA;;AAC/C,SAAKC,cAAL,GAAsBD,aAAtB;AACD;;AAEDE,EAAAA,MAAM,CAACF,aAAD,EAAqC;AACzC,SAAK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C,UAAZ;AACD;;AAEgB,MAAbnB,aAAa,GAAkB;AACjC,QAAI,CAAC,KAAKC,cAAV,EAA0B;AAAA;;AACxB,WAAKA,cAAL,GAAsB,IAAIH,iBAAJ,2BACpB,KAAK8B,iBADe,2DACpB,uBAAwB5B,aADJ,CAAtB;AAGD;;AACD,WAAO,KAAKC,cAAZ;AACD;;AAhD2D","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 VisualizationSDK,\n RawVisualizationData,\n RawVisConfig,\n VisualizationConfig,\n QueryResponse,\n Measure,\n Dimension,\n TableCalculation,\n PivotConfig,\n RawVisQueryResponse,\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 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 VisualizationSDK {\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) {\n this._visConfig.update(this.visualizationData.visConfig)\n }\n if (this._queryResponse) {\n this._queryResponse.update(this.visualizationData.queryResponse)\n }\n }\n }\n\n configureVisualization(options: RawVisConfig): 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 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 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"],"file":"visualization_sdk.js"}
|
package/lib/esm/util/errors.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/util/errors.ts"],"names":["NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR","Error"],"mappings":"AAyBA,OAAO,IAAMA,uCAAuC,GAAG,IAAIC,KAAJ,CACrD,oDADqD,CAAhD","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 */\nexport const NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR = new Error(\n 'Mounting dashboards in extensions is not supported'\n)\n"],"file":"errors.js"}
|
package/lib/esm/util/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/util/index.ts"],"names":[],"mappings":"AA0BA,cAAc,UAAd;AACA,cAAc,UAAd","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\nexport * from './logger'\nexport * from './errors'\n"],"file":"index.js"}
|
package/lib/esm/util/logger.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export var logError = function logError(message) {
|
|
2
|
-
for (var _len = arguments.length, optionalParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
3
|
-
optionalParams[_key - 1] = arguments[_key];
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
console.error(message, optionalParams);
|
|
7
|
-
};
|
|
8
|
-
export var logWarn = function logWarn(message) {
|
|
9
|
-
for (var _len2 = arguments.length, optionalParams = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
10
|
-
optionalParams[_key2 - 1] = arguments[_key2];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
console.warn(message, optionalParams);
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=logger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/util/logger.ts"],"names":["logError","message","optionalParams","console","error","logWarn","warn"],"mappings":"AAyBA,OAAO,IAAMA,QAAQ,GAAG,SAAXA,QAAW,CAACC,OAAD,EAA6C;AAAA,oCAA1BC,cAA0B;AAA1BA,IAAAA,cAA0B;AAAA;;AAEnEC,EAAAA,OAAO,CAACC,KAAR,CAAcH,OAAd,EAAuBC,cAAvB;AACD,CAHM;AAKP,OAAO,IAAMG,OAAO,GAAG,SAAVA,OAAU,CAACJ,OAAD,EAA6C;AAAA,qCAA1BC,cAA0B;AAA1BA,IAAAA,cAA0B;AAAA;;AAElEC,EAAAA,OAAO,CAACG,IAAR,CAAaL,OAAb,EAAsBC,cAAtB;AACD,CAHM","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 */\nexport const logError = (message?: any, ...optionalParams: any[]) => {\n // eslint-disable-next-line no-console\n console.error(message, optionalParams)\n}\n\nexport const logWarn = (message?: any, ...optionalParams: any[]) => {\n // eslint-disable-next-line no-console\n console.warn(message, optionalParams)\n}\n"],"file":"logger.js"}
|
package/lib/util/errors.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR: Error;
|
package/lib/util/errors.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR = void 0;
|
|
7
|
-
var NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR = new Error('Mounting dashboards in extensions is not supported');
|
|
8
|
-
exports.NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR = NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR;
|
|
9
|
-
//# sourceMappingURL=errors.js.map
|
package/lib/util/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/errors.ts"],"names":["NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR","Error"],"mappings":";;;;;;AAyBO,IAAMA,uCAAuC,GAAG,IAAIC,KAAJ,CACrD,oDADqD,CAAhD","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 */\nexport const NOT_DASHBOARD_MOUNT_NOT_SUPPORTED_ERROR = new Error(\n 'Mounting dashboards in extensions is not supported'\n)\n"],"file":"errors.js"}
|