@looker/run-it 0.9.23 → 0.9.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. package/CHANGELOG.md +82 -1
  2. package/lib/RunIt.d.ts +2 -2
  3. package/lib/RunIt.js +18 -30
  4. package/lib/RunIt.js.map +1 -1
  5. package/lib/RunItProvider.d.ts +0 -4
  6. package/lib/RunItProvider.js +2 -7
  7. package/lib/RunItProvider.js.map +1 -1
  8. package/lib/components/ConfigForm/ConfigForm.d.ts +1 -6
  9. package/lib/components/ConfigForm/ConfigForm.js +39 -48
  10. package/lib/components/ConfigForm/ConfigForm.js.map +1 -1
  11. package/lib/components/ConfigForm/index.d.ts +1 -1
  12. package/lib/components/ConfigForm/index.js +4 -4
  13. package/lib/components/ConfigForm/index.js.map +1 -1
  14. package/lib/components/ConfigForm/utils.d.ts +11 -0
  15. package/lib/components/ConfigForm/utils.js +81 -0
  16. package/lib/components/ConfigForm/utils.js.map +1 -0
  17. package/lib/components/LoginForm/LoginForm.d.ts +3 -8
  18. package/lib/components/LoginForm/LoginForm.js +9 -8
  19. package/lib/components/LoginForm/LoginForm.js.map +1 -1
  20. package/lib/components/PerfTracker/PerfTracker.d.ts +0 -2
  21. package/lib/components/PerfTracker/PerfTracker.js +7 -8
  22. package/lib/components/PerfTracker/PerfTracker.js.map +1 -1
  23. package/lib/components/RequestForm/RequestForm.d.ts +0 -6
  24. package/lib/components/RequestForm/RequestForm.js +0 -7
  25. package/lib/components/RequestForm/RequestForm.js.map +1 -1
  26. package/lib/components/common/index.d.ts +0 -1
  27. package/lib/components/common/index.js +0 -18
  28. package/lib/components/common/index.js.map +1 -1
  29. package/lib/esm/RunIt.js +19 -32
  30. package/lib/esm/RunIt.js.map +1 -1
  31. package/lib/esm/RunItProvider.js +2 -7
  32. package/lib/esm/RunItProvider.js.map +1 -1
  33. package/lib/esm/components/ConfigForm/ConfigForm.js +36 -46
  34. package/lib/esm/components/ConfigForm/ConfigForm.js.map +1 -1
  35. package/lib/esm/components/ConfigForm/index.js +1 -1
  36. package/lib/esm/components/ConfigForm/index.js.map +1 -1
  37. package/lib/esm/components/ConfigForm/utils.js +61 -0
  38. package/lib/esm/components/ConfigForm/utils.js.map +1 -0
  39. package/lib/esm/components/LoginForm/LoginForm.js +7 -7
  40. package/lib/esm/components/LoginForm/LoginForm.js.map +1 -1
  41. package/lib/esm/components/PerfTracker/PerfTracker.js +7 -8
  42. package/lib/esm/components/PerfTracker/PerfTracker.js.map +1 -1
  43. package/lib/esm/components/RequestForm/RequestForm.js +0 -7
  44. package/lib/esm/components/RequestForm/RequestForm.js.map +1 -1
  45. package/lib/esm/components/common/index.js +0 -1
  46. package/lib/esm/components/common/index.js.map +1 -1
  47. package/lib/esm/index.js +0 -1
  48. package/lib/esm/index.js.map +1 -1
  49. package/lib/esm/utils/RunItSDK.js +8 -78
  50. package/lib/esm/utils/RunItSDK.js.map +1 -1
  51. package/lib/esm/utils/requestUtils.js +21 -14
  52. package/lib/esm/utils/requestUtils.js.map +1 -1
  53. package/lib/index.d.ts +0 -1
  54. package/lib/index.js +0 -13
  55. package/lib/index.js.map +1 -1
  56. package/lib/test-data/responses.js +9 -0
  57. package/lib/test-data/responses.js.map +1 -1
  58. package/lib/utils/RunItSDK.d.ts +1 -17
  59. package/lib/utils/RunItSDK.js +10 -88
  60. package/lib/utils/RunItSDK.js.map +1 -1
  61. package/lib/utils/requestUtils.d.ts +2 -3
  62. package/lib/utils/requestUtils.js +22 -15
  63. package/lib/utils/requestUtils.js.map +1 -1
  64. package/package.json +8 -7
  65. package/lib/components/ConfigForm/configUtils.d.ts +0 -39
  66. package/lib/components/ConfigForm/configUtils.js +0 -232
  67. package/lib/components/ConfigForm/configUtils.js.map +0 -1
  68. package/lib/components/common/StandaloneConfigurator.d.ts +0 -7
  69. package/lib/components/common/StandaloneConfigurator.js +0 -61
  70. package/lib/components/common/StandaloneConfigurator.js.map +0 -1
  71. package/lib/esm/components/ConfigForm/configUtils.js +0 -196
  72. package/lib/esm/components/ConfigForm/configUtils.js.map +0 -1
  73. package/lib/esm/components/common/StandaloneConfigurator.js +0 -51
  74. package/lib/esm/components/common/StandaloneConfigurator.js.map +0 -1
  75. package/lib/esm/scenes/OAuthScene/OAuthScene.js +0 -64
  76. package/lib/esm/scenes/OAuthScene/OAuthScene.js.map +0 -1
  77. package/lib/esm/scenes/OAuthScene/index.js +0 -2
  78. package/lib/esm/scenes/OAuthScene/index.js.map +0 -1
  79. package/lib/esm/scenes/index.js +0 -2
  80. package/lib/esm/scenes/index.js.map +0 -1
  81. package/lib/scenes/OAuthScene/OAuthScene.d.ts +0 -2
  82. package/lib/scenes/OAuthScene/OAuthScene.js +0 -81
  83. package/lib/scenes/OAuthScene/OAuthScene.js.map +0 -1
  84. package/lib/scenes/OAuthScene/index.d.ts +0 -1
  85. package/lib/scenes/OAuthScene/index.js +0 -14
  86. package/lib/scenes/OAuthScene/index.js.map +0 -1
  87. package/lib/scenes/index.d.ts +0 -1
  88. package/lib/scenes/index.js +0 -14
  89. package/lib/scenes/index.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,86 @@
1
1
  # Changelog
2
2
 
3
+ ### [0.9.27](https://www.github.com/looker-open-source/sdk-codegen/compare/run-it-v0.9.26...run-it-v0.9.27) (2022-02-14)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * The following workspace dependencies were updated
9
+ * dependencies
10
+ * @looker/code-editor bumped from ^0.1.17 to ^0.1.18
11
+ * @looker/extension-utils bumped from ^0.1.3 to ^0.1.4
12
+ * @looker/sdk-codegen bumped from ^21.3.2 to ^21.4.0
13
+
14
+ ### [0.9.26](https://www.github.com/looker-open-source/sdk-codegen/compare/run-it-v0.9.23...run-it-v0.9.26) (2022-01-27)
15
+
16
+
17
+ ### Features
18
+
19
+ * add http method to IRawResponse ([#925](https://www.github.com/looker-open-source/sdk-codegen/issues/925)) ([25cef47](https://www.github.com/looker-open-source/sdk-codegen/commit/25cef47fa61a5f15565560b48f5e0c45a0cd9b44))
20
+ * OAuthConfigProvider ([209f399](https://www.github.com/looker-open-source/sdk-codegen/commit/209f399a089beb28405a178d3dc8f769478ae97b))
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * hackathon build ([#915](https://www.github.com/looker-open-source/sdk-codegen/issues/915)) ([67df146](https://www.github.com/looker-open-source/sdk-codegen/commit/67df1465d1ec04709c0c20d9a1b157f9199f795e))
26
+
27
+
28
+ ### Dependencies
29
+
30
+ * The following workspace dependencies were updated
31
+ * dependencies
32
+ * @looker/sdk bumped from ^21.20.0 to ^21.20.1
33
+
34
+ ### [0.9.26](https://www.github.com/looker-open-source/sdk-codegen/compare/run-it-v0.9.25...run-it-v0.9.26) (2021-12-20)
35
+
36
+
37
+ ### Dependencies
38
+
39
+ * The following workspace dependencies were updated
40
+ * dependencies
41
+ * @looker/code-editor bumped from ^0.1.16 to ^0.1.17
42
+ * @looker/extension-utils bumped from ^0.1.2 to ^0.1.3
43
+ * @looker/sdk-codegen bumped from ^21.3.0 to ^21.3.1
44
+ * @looker/sdk-rtl bumped from ^21.3.0 to ^21.3.1
45
+
46
+ ### [0.9.25](https://www.github.com/looker-open-source/sdk-codegen/compare/run-it-v0.9.24...run-it-v0.9.25) (2021-12-16)
47
+
48
+
49
+ ### Features
50
+
51
+ * add http method to IRawResponse ([#925](https://www.github.com/looker-open-source/sdk-codegen/issues/925)) ([25cef47](https://www.github.com/looker-open-source/sdk-codegen/commit/25cef47fa61a5f15565560b48f5e0c45a0cd9b44))
52
+
53
+
54
+ ### Dependencies
55
+
56
+ * The following workspace dependencies were updated
57
+ * dependencies
58
+ * @looker/code-editor bumped from ^0.1.15 to ^0.1.16
59
+ * @looker/extension-utils bumped from ^0.1.1 to ^0.1.2
60
+ * @looker/sdk-codegen bumped from ^21.2.1 to ^21.3.0
61
+ * @looker/sdk-rtl bumped from ^21.2.0 to ^21.3.0
62
+
63
+ ### [0.9.24](https://www.github.com/looker-open-source/sdk-codegen/compare/run-it-v0.9.23...run-it-v0.9.24) (2021-12-06)
64
+
65
+
66
+ ### Features
67
+
68
+ * OAuthConfigProvider ([209f399](https://www.github.com/looker-open-source/sdk-codegen/commit/209f399a089beb28405a178d3dc8f769478ae97b))
69
+
70
+
71
+ ### Bug Fixes
72
+
73
+ * hackathon build ([#915](https://www.github.com/looker-open-source/sdk-codegen/issues/915)) ([67df146](https://www.github.com/looker-open-source/sdk-codegen/commit/67df1465d1ec04709c0c20d9a1b157f9199f795e))
74
+
75
+
76
+ ### Dependencies
77
+
78
+ * The following workspace dependencies were updated
79
+ * dependencies
80
+ * @looker/code-editor bumped from ^0.1.14 to ^0.1.15
81
+ * @looker/extension-utils bumped from ^0.1.0 to ^0.1.1
82
+ * @looker/sdk-codegen bumped from ^21.2.0 to ^21.2.1
83
+
3
84
  ### [0.9.23](https://www.github.com/looker-open-source/sdk-codegen/compare/run-it-v0.9.22...run-it-v0.9.23) (2021-11-10)
4
85
 
5
86
 
@@ -345,4 +426,4 @@
345
426
  * @looker/sdk bumped from ^21.0.10 to ^21.4.0
346
427
  * @looker/sdk-codegen bumped from ^21.0.10 to ^21.0.11
347
428
  * @looker/sdk-codegen-utils bumped from ^21.0.10 to ^21.0.11
348
- * @looker/sdk-rtl bumped from ^21.0.10 to ^21.0.11
429
+ * @looker/sdk-rtl bumped from ^21.0.10 to ^21.0.11
package/lib/RunIt.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { FC } from 'react';
2
2
  import type { ApiModel, IMethod } from '@looker/sdk-codegen';
3
- import type { RunItSetter } from '.';
3
+ import type { IEnvironmentAdaptor } from '@looker/extension-utils';
4
4
  export declare type RunItHttpMethod = 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE';
5
5
  export declare type RunItValues = Record<string, any>;
6
6
  declare type RunItInputType = 'boolean' | 'int64' | 'integer' | 'float' | 'double' | 'string' | 'hostname' | 'uuid' | 'uri' | 'ipv4' | 'ipv6' | 'email' | 'password' | 'datetime';
@@ -13,9 +13,9 @@ export interface RunItInput {
13
13
  description: string;
14
14
  }
15
15
  interface RunItProps {
16
+ adaptor: IEnvironmentAdaptor;
16
17
  api: ApiModel;
17
18
  method: IMethod;
18
- setVersionsUrl: RunItSetter;
19
19
  sdkLanguage?: string;
20
20
  }
21
21
  export declare const RunIt: FC<RunItProps>;
package/lib/RunIt.js CHANGED
@@ -9,6 +9,8 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _components = require("@looker/components");
11
11
 
12
+ var _extensionUtils = require("@looker/extension-utils");
13
+
12
14
  var _components2 = require("./components");
13
15
 
14
16
  var _utils = require("./utils");
@@ -27,42 +29,33 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
27
29
 
28
30
  var RunIt = _ref => {
29
31
  var {
32
+ adaptor,
30
33
  api,
31
34
  method,
32
- setVersionsUrl = _.runItNoSet,
33
35
  sdkLanguage = 'All'
34
36
  } = _ref;
35
37
  var httpMethod = method.httpMethod;
36
38
  var endpoint = method.endpoint;
39
+ var sdk = adaptor.sdk;
40
+ var [initialized, setInitialized] = (0, _react.useState)(false);
37
41
  var {
38
- sdk,
39
- configurator,
40
42
  basePath
41
43
  } = (0, _react.useContext)(_.RunItContext);
42
44
  var [inputs] = (0, _react.useState)(() => (0, _utils.createInputs)(api, method));
43
- var [requestContent, setRequestContent] = (0, _react.useState)(() => (0, _utils.initRequestContent)(configurator, inputs));
45
+ var [requestContent, setRequestContent] = (0, _react.useState)((0, _utils.initRequestContent)(inputs));
44
46
  var [activePathParams, setActivePathParams] = (0, _react.useState)({});
45
47
  var [loading, setLoading] = (0, _react.useState)(false);
46
48
  var [responseContent, setResponseContent] = (0, _react.useState)(undefined);
47
- var [isExtension, setIsExtension] = (0, _react.useState)(false);
48
- var [hasConfig, setHasConfig] = (0, _react.useState)(true);
49
- var [needsAuth, setNeedsAuth] = (0, _react.useState)(() => (0, _utils.sdkNeedsAuth)(sdk));
49
+ var isExtension = adaptor.isExtension();
50
+ var [hasConfig, setHasConfig] = (0, _react.useState)(isExtension || sdk.authSession.settings.authIsConfigured());
51
+ var [needsAuth] = (0, _react.useState)(() => !isExtension && !sdk.authSession.isAuthenticated());
50
52
  var [validationMessage, setValidationMessage] = (0, _react.useState)('');
51
53
  var tabs = (0, _components.useTabs)();
52
54
  var perf = new _components2.PerfTimings();
53
55
  (0, _react.useEffect)(() => {
54
- if (sdk) {
55
- var settings = sdk.authSession.settings;
56
- var configIsNeeded = (0, _utils.sdkNeedsConfig)(sdk);
57
- setIsExtension(!configIsNeeded);
58
- setHasConfig(!configIsNeeded || settings.authIsConfigured());
59
- setNeedsAuth(configIsNeeded && !sdk.authSession.isAuthenticated());
60
- } else {
61
- setIsExtension(true);
62
- setHasConfig(true);
63
- setNeedsAuth(false);
64
- }
65
- }, [sdk]);
56
+ (0, _extensionUtils.registerEnvAdaptor)(adaptor);
57
+ setInitialized(true);
58
+ }, []);
66
59
 
67
60
  var handleConfig = _e => {
68
61
  tabs.onSelectTab(4);
@@ -114,12 +107,13 @@ var RunIt = _ref => {
114
107
  };
115
108
  }();
116
109
 
117
- if (!sdk) return _react.default.createElement(_react.default.Fragment, null);
118
110
  return _react.default.createElement(_components.Box, {
119
111
  bg: "background",
120
112
  py: "large",
121
113
  height: "100%"
122
- }, _react.default.createElement(_components.TabList, _extends({
114
+ }, !initialized ? _react.default.createElement(_components2.Loading, {
115
+ loading: true
116
+ }) : _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_components.TabList, _extends({
123
117
  distribute: true
124
118
  }, tabs), _react.default.createElement(_components.Tab, {
125
119
  key: "request"
@@ -139,7 +133,6 @@ var RunIt = _ref => {
139
133
  }), _react.default.createElement(_components.TabPanel, {
140
134
  key: "request"
141
135
  }, _react.default.createElement(_components2.RequestForm, {
142
- sdk: sdk,
143
136
  httpMethod: httpMethod,
144
137
  inputs: inputs,
145
138
  requestContent: requestContent,
@@ -149,11 +142,9 @@ var RunIt = _ref => {
149
142
  hasConfig: hasConfig,
150
143
  handleConfig: handleConfig,
151
144
  setHasConfig: setHasConfig,
152
- configurator: configurator,
153
145
  isExtension: isExtension,
154
146
  validationMessage: validationMessage,
155
- setValidationMessage: setValidationMessage,
156
- setVersionsUrl: setVersionsUrl
147
+ setValidationMessage: setValidationMessage
157
148
  })), _react.default.createElement(_components.TabPanel, {
158
149
  key: "response"
159
150
  }, _react.default.createElement(_components2.Loading, {
@@ -173,16 +164,13 @@ var RunIt = _ref => {
173
164
  })), isExtension ? _react.default.createElement(_react.default.Fragment, null) : _react.default.createElement(_components.TabPanel, {
174
165
  key: "performance"
175
166
  }, _react.default.createElement(_components2.PerfTracker, {
176
- perf: perf,
177
- configurator: configurator
167
+ perf: perf
178
168
  })), isExtension ? _react.default.createElement(_react.default.Fragment, null) : _react.default.createElement(_components.TabPanel, {
179
169
  key: "config"
180
170
  }, _react.default.createElement(_components2.ConfigForm, {
181
171
  setHasConfig: setHasConfig,
182
- configurator: configurator,
183
- setVersionsUrl: setVersionsUrl,
184
172
  requestContent: requestContent
185
- }))));
173
+ })))));
186
174
  };
187
175
 
188
176
  exports.RunIt = RunIt;
package/lib/RunIt.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/RunIt.tsx"],"names":["RunIt","api","method","setVersionsUrl","runItNoSet","sdkLanguage","httpMethod","endpoint","sdk","configurator","basePath","RunItContext","inputs","requestContent","setRequestContent","activePathParams","setActivePathParams","loading","setLoading","responseContent","setResponseContent","undefined","isExtension","setIsExtension","hasConfig","setHasConfig","needsAuth","setNeedsAuth","validationMessage","setValidationMessage","tabs","perf","PerfTimings","settings","authSession","configIsNeeded","authIsConfigured","isAuthenticated","handleConfig","_e","onSelectTab","handleSubmit","e","preventDefault","pathParams","queryParams","body","bodyParam","bodyParams","requiredKeys","Object","keys","type","requiredProperties","message","response","err","ok","statusMessage","statusCode","contentType","JSON","stringify","headers"],"mappings":";;;;;;;AA2BA;;AACA;;AAUA;;AAWA;;AAWA;;;;;;;;;;;;AAsDO,IAAMA,KAAqB,GAAG,QAK/B;AAAA,MALgC;AACpCC,IAAAA,GADoC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D;AAAU,IAAA,GAAG,EAAC;AAAd,KACE,6BAAC,wBAAD;AAAa,IAAA,IAAI,EAAES,IAAnB;AAAyB,IAAA,YAAY,EAAEtB;AAAvC,IADF,CA1CJ,EA8CGa,WAAW,GACV,2DADU,GAGV,6BAAC,oBAAD;AAAU,IAAA,GAAG,EAAC;AAAd,KACE,6BAAC,uBAAD;AACE,IAAA,YAAY,EAAEG,YADhB;AAEE,IAAA,YAAY,EAAEhB,YAFhB;AAGE,IAAA,cAAc,EAAEN,cAHlB;AAIE,IAAA,cAAc,EAAEU;AAJlB,IADF,CAjDJ,CARF,CADF;AAsED,CAtKM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { BaseSyntheticEvent, FC } from 'react'\nimport React, { useContext, useState, useEffect } from 'react'\nimport {\n Box,\n Tab,\n TabList,\n TabPanels,\n TabPanel,\n useTabs,\n} from '@looker/components'\nimport type { ApiModel, IMethod } from '@looker/sdk-codegen'\nimport type { ResponseContent } from './components'\nimport {\n RequestForm,\n ResponseExplorer,\n Loading,\n DocSdkCalls,\n ConfigForm,\n validateBody,\n PerfTimings,\n PerfTracker,\n} from './components'\nimport type { RunItSettings } from './utils'\nimport {\n initRequestContent,\n createRequestParams,\n runRequest,\n pathify,\n sdkNeedsConfig,\n prepareInputs,\n sdkNeedsAuth,\n createInputs,\n} from './utils'\nimport type { RunItSetter } from '.'\nimport { runItNoSet, RunItContext } from '.'\n\nexport type RunItHttpMethod = 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE'\n\n/**\n * Generic collection\n */\nexport type RunItValues = Record<string, any>\n\ntype RunItInputType =\n | 'boolean'\n | 'int64'\n | 'integer'\n | 'float'\n | 'double'\n | 'string'\n | 'hostname'\n | 'uuid'\n | 'uri'\n | 'ipv4'\n | 'ipv6'\n | 'email'\n | 'password'\n | 'datetime'\n\ntype RunItInputLocation = 'body' | 'path' | 'query' | 'header' | 'cookie'\n\n/**\n * A RunIt input type describing a single REST request's parameter or a structure\n */\nexport interface RunItInput {\n name: string\n location: RunItInputLocation\n /** A RunItInputType or a structure */\n type: RunItInputType | any\n required: boolean\n description: string\n}\n\ninterface RunItProps {\n /** spec model to use for sdk call generation */\n api: ApiModel\n /** Method to test */\n method: IMethod\n /** Set versions Url callback */\n setVersionsUrl: RunItSetter\n /** Sdk language to use for generating call syntax */\n sdkLanguage?: string\n}\n\n/**\n * Given an array of inputs, a method, and an api model it renders a REST request form\n * which on submit performs a REST request and renders the response with the appropriate MIME type handler\n */\nexport const RunIt: FC<RunItProps> = ({\n api,\n method,\n setVersionsUrl = runItNoSet,\n sdkLanguage = 'All',\n}) => {\n const httpMethod = method.httpMethod as RunItHttpMethod\n const endpoint = method.endpoint\n const { sdk, configurator, basePath } = useContext(RunItContext)\n const [inputs] = useState(() => createInputs(api, method))\n const [requestContent, setRequestContent] = useState(() =>\n initRequestContent(configurator, inputs)\n )\n const [activePathParams, setActivePathParams] = useState({})\n const [loading, setLoading] = useState(false)\n const [responseContent, setResponseContent] =\n useState<ResponseContent>(undefined)\n const [isExtension, setIsExtension] = useState<boolean>(false)\n const [hasConfig, setHasConfig] = useState<boolean>(true)\n const [needsAuth, setNeedsAuth] = useState<boolean>(() => sdkNeedsAuth(sdk))\n const [validationMessage, setValidationMessage] = useState<string>('')\n const tabs = useTabs()\n\n const perf = new PerfTimings()\n\n useEffect(() => {\n if (sdk) {\n const settings = sdk.authSession.settings as RunItSettings\n const configIsNeeded = sdkNeedsConfig(sdk)\n setIsExtension(!configIsNeeded)\n setHasConfig(!configIsNeeded || settings.authIsConfigured())\n setNeedsAuth(configIsNeeded && !sdk.authSession.isAuthenticated())\n } else {\n setIsExtension(true)\n setHasConfig(true)\n setNeedsAuth(false)\n }\n }, [sdk])\n\n const handleConfig = (_e: BaseSyntheticEvent) => {\n tabs.onSelectTab(4)\n }\n\n const handleSubmit = async (e: BaseSyntheticEvent) => {\n e.preventDefault()\n\n const [pathParams, queryParams, body] = createRequestParams(\n inputs,\n requestContent\n )\n if (body) {\n const [bodyParam] = method.bodyParams\n const requiredKeys = Object.keys(bodyParam.type.requiredProperties)\n const message = validateBody(body, requiredKeys)\n setValidationMessage(message)\n if (message) {\n // body has an error, don't run\n return\n }\n }\n setActivePathParams(pathParams)\n tabs.onSelectTab(1)\n if (sdk) {\n setLoading(true)\n let response: ResponseContent\n try {\n response = await runRequest(\n sdk,\n basePath,\n httpMethod,\n endpoint,\n pathParams,\n queryParams,\n body\n )\n } catch (err: any) {\n // This should not happen but it could. runRequest uses\n // sdk.ok to login once. sdk.ok throws an error so fake\n // out the response so something can be rendered.\n response = {\n ok: false,\n statusMessage: err.message ? err.message : 'Unknown error!',\n statusCode: -1,\n contentType: 'application/json',\n body: JSON.stringify(err),\n headers: {},\n } as ResponseContent\n }\n setResponseContent(response)\n setLoading(false)\n }\n }\n\n // No SDK, no RunIt for you!\n if (!sdk) return <></>\n\n return (\n <Box bg=\"background\" py=\"large\" height=\"100%\">\n <TabList distribute {...tabs}>\n <Tab key=\"request\">Request</Tab>\n <Tab key=\"response\">Response</Tab>\n <Tab key=\"makeTheCall\">SDK Call</Tab>\n {isExtension ? <></> : <Tab key=\"performance\">Performance</Tab>}\n {isExtension ? <></> : <Tab key=\"configuration\">Configure</Tab>}\n </TabList>\n <TabPanels px=\"xxlarge\" {...tabs} overflow=\"auto\" height=\"87vh\">\n <TabPanel key=\"request\">\n <RequestForm\n sdk={sdk}\n httpMethod={httpMethod}\n inputs={inputs}\n requestContent={requestContent}\n setRequestContent={setRequestContent}\n handleSubmit={handleSubmit}\n needsAuth={needsAuth}\n hasConfig={hasConfig}\n handleConfig={handleConfig}\n setHasConfig={setHasConfig}\n configurator={configurator}\n isExtension={isExtension}\n validationMessage={validationMessage}\n setValidationMessage={setValidationMessage}\n setVersionsUrl={setVersionsUrl}\n />\n </TabPanel>\n <TabPanel key=\"response\">\n <Loading\n loading={loading}\n message={`${httpMethod} ${pathify(endpoint, activePathParams)}`}\n />\n <ResponseExplorer\n response={responseContent}\n verb={httpMethod}\n path={pathify(endpoint, activePathParams)}\n />\n </TabPanel>\n <TabPanel key=\"makeTheCall\">\n <DocSdkCalls\n sdkLanguage={sdkLanguage}\n api={api}\n method={method}\n inputs={prepareInputs(inputs, requestContent)}\n />\n </TabPanel>\n {isExtension ? (\n <></>\n ) : (\n <TabPanel key=\"performance\">\n <PerfTracker perf={perf} configurator={configurator} />\n </TabPanel>\n )}\n {isExtension ? (\n <></>\n ) : (\n <TabPanel key=\"config\">\n <ConfigForm\n setHasConfig={setHasConfig}\n configurator={configurator}\n setVersionsUrl={setVersionsUrl}\n requestContent={requestContent}\n />\n </TabPanel>\n )}\n </TabPanels>\n </Box>\n )\n}\n"],"file":"RunIt.js"}
1
+ {"version":3,"sources":["../src/RunIt.tsx"],"names":["RunIt","adaptor","api","method","sdkLanguage","httpMethod","endpoint","sdk","initialized","setInitialized","basePath","RunItContext","inputs","requestContent","setRequestContent","activePathParams","setActivePathParams","loading","setLoading","responseContent","setResponseContent","undefined","isExtension","hasConfig","setHasConfig","authSession","settings","authIsConfigured","needsAuth","isAuthenticated","validationMessage","setValidationMessage","tabs","perf","PerfTimings","handleConfig","_e","onSelectTab","handleSubmit","e","preventDefault","pathParams","queryParams","body","bodyParam","bodyParams","requiredKeys","Object","keys","type","requiredProperties","message","response","err","ok","statusMessage","statusCode","contentType","JSON","stringify","headers"],"mappings":";;;;;;;AA2BA;;AACA;;AAaA;;AAGA;;AAUA;;AAQA;;;;;;;;;;;;AAqDO,IAAMA,KAAqB,GAAG,QAK/B;AAAA,MALgC;AACpCC,IAAAA,OADoC;AAEpCC,IAAAA,GAFoC;AAGpCC,IAAAA,MAHoC;AAIpCC,IAAAA,WAAW,GAAG;AAJsB,GAKhC;AACJ,MAAMC,UAAU,GAAGF,MAAM,CAACE,UAA1B;AACA,MAAMC,QAAQ,GAAGH,MAAM,CAACG,QAAxB;AACA,MAAMC,GAAG,GAAGN,OAAO,CAACM,GAApB;AACA,MAAM,CAACC,WAAD,EAAcC,cAAd,IAAgC,qBAAS,KAAT,CAAtC;AACA,MAAM;AAAEC,IAAAA;AAAF,MAAe,uBAAWC,cAAX,CAArB;AACA,MAAM,CAACC,MAAD,IAAW,qBAAS,MAAM,yBAAaV,GAAb,EAAkBC,MAAlB,CAAf,CAAjB;AAGA,MAAM,CAACU,cAAD,EAAiBC,iBAAjB,IAAsC,qBAC1C,+BAAmBF,MAAnB,CAD0C,CAA5C;AAGA,MAAM,CAACG,gBAAD,EAAmBC,mBAAnB,IAA0C,qBAAS,EAAT,CAAhD;AACA,MAAM,CAACC,OAAD,EAAUC,UAAV,IAAwB,qBAAS,KAAT,CAA9B;AACA,MAAM,CAACC,eAAD,EAAkBC,kBAAlB,IACJ,qBAA0BC,SAA1B,CADF;AAIA,MAAMC,WAAW,GAAGrB,OAAO,CAACqB,WAAR,EAApB;AACA,MAAM,CAACC,SAAD,EAAYC,YAAZ,IAA4B,qBAChCF,WAAW,IACRf,GAAG,CAACkB,W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EAAC;AAAd,KACE,6BAAC,wBAAD;AAAa,IAAA,IAAI,EAAEW;AAAnB,IADF,CAvCJ,EA2CGX,WAAW,GACV,2DADU,GAGV,6BAAC,oBAAD;AAAU,IAAA,GAAG,EAAC;AAAd,KACE,6BAAC,uBAAD;AACE,IAAA,YAAY,EAAEE,YADhB;AAEE,IAAA,cAAc,EAAEX;AAFlB,IADF,CA9CJ,CARF,CAJJ,CADF;AAuED,CAvKM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { BaseSyntheticEvent, FC } from 'react'\nimport React, { useContext, useState, useEffect } from 'react'\nimport {\n Box,\n Tab,\n TabList,\n TabPanels,\n TabPanel,\n useTabs,\n} from '@looker/components'\nimport type { ApiModel, IMethod } from '@looker/sdk-codegen'\nimport type {\n IEnvironmentAdaptor,\n OAuthConfigProvider,\n} from '@looker/extension-utils'\nimport { registerEnvAdaptor } from '@looker/extension-utils'\n\nimport type { ResponseContent } from './components'\nimport {\n RequestForm,\n ResponseExplorer,\n Loading,\n DocSdkCalls,\n ConfigForm,\n validateBody,\n PerfTimings,\n PerfTracker,\n} from './components'\nimport {\n initRequestContent,\n createRequestParams,\n runRequest,\n pathify,\n prepareInputs,\n createInputs,\n} from './utils'\nimport { RunItContext } from '.'\n\nexport type RunItHttpMethod = 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE'\n\n/**\n * Generic collection\n */\nexport type RunItValues = Record<string, any>\n\ntype RunItInputType =\n | 'boolean'\n | 'int64'\n | 'integer'\n | 'float'\n | 'double'\n | 'string'\n | 'hostname'\n | 'uuid'\n | 'uri'\n | 'ipv4'\n | 'ipv6'\n | 'email'\n | 'password'\n | 'datetime'\n\ntype RunItInputLocation = 'body' | 'path' | 'query' | 'header' | 'cookie'\n\n/**\n * A RunIt input type describing a single REST request's parameter or a structure\n */\nexport interface RunItInput {\n name: string\n location: RunItInputLocation\n /** A RunItInputType or a structure */\n type: RunItInputType | any\n required: boolean\n description: string\n}\n\ninterface RunItProps {\n adaptor: IEnvironmentAdaptor\n /** spec model to use for sdk call generation */\n api: ApiModel\n /** Method to test */\n method: IMethod\n /** Sdk language to use for generating call syntax */\n sdkLanguage?: string\n}\n\n/**\n * Given an array of inputs, a method, and an api model it renders a REST request form\n * which on submit performs a REST request and renders the response with the appropriate MIME type handler\n */\nexport const RunIt: FC<RunItProps> = ({\n adaptor,\n api,\n method,\n sdkLanguage = 'All',\n}) => {\n const httpMethod = method.httpMethod as RunItHttpMethod\n const endpoint = method.endpoint\n const sdk = adaptor.sdk\n const [initialized, setInitialized] = useState(false)\n const { basePath } = useContext(RunItContext)\n const [inputs] = useState(() => createInputs(api, method))\n\n /** Request related state */\n const [requestContent, setRequestContent] = useState(\n initRequestContent(inputs)\n )\n const [activePathParams, setActivePathParams] = useState({})\n const [loading, setLoading] = useState(false)\n const [responseContent, setResponseContent] =\n useState<ResponseContent>(undefined)\n\n /** Auth config related state */\n const isExtension = adaptor.isExtension()\n const [hasConfig, setHasConfig] = useState<boolean>(\n isExtension ||\n (sdk.authSession.settings as OAuthConfigProvider).authIsConfigured()\n )\n const [needsAuth] = useState<boolean>(\n () => !isExtension && !sdk.authSession.isAuthenticated()\n )\n\n const [validationMessage, setValidationMessage] = useState<string>('')\n const tabs = useTabs()\n\n const perf = new PerfTimings()\n\n useEffect(() => {\n registerEnvAdaptor(adaptor)\n setInitialized(true)\n }, [])\n\n const handleConfig = (_e: BaseSyntheticEvent) => {\n tabs.onSelectTab(4)\n }\n\n const handleSubmit = async (e: BaseSyntheticEvent) => {\n e.preventDefault()\n\n const [pathParams, queryParams, body] = createRequestParams(\n inputs,\n requestContent\n )\n if (body) {\n const [bodyParam] = method.bodyParams\n const requiredKeys = Object.keys(bodyParam.type.requiredProperties)\n const message = validateBody(body, requiredKeys)\n setValidationMessage(message)\n if (message) {\n // body has an error, don't run\n return\n }\n }\n setActivePathParams(pathParams)\n tabs.onSelectTab(1)\n if (sdk) {\n setLoading(true)\n let response: ResponseContent\n try {\n response = await runRequest(\n sdk,\n basePath,\n httpMethod,\n endpoint,\n pathParams,\n queryParams,\n body\n )\n } catch (err: any) {\n // This should not happen but it could. runRequest uses\n // sdk.ok to login once. sdk.ok throws an error so fake\n // out the response so something can be rendered.\n response = {\n ok: false,\n statusMessage: err.message ? err.message : 'Unknown error!',\n statusCode: -1,\n contentType: 'application/json',\n body: JSON.stringify(err),\n headers: {},\n } as ResponseContent\n }\n setResponseContent(response)\n setLoading(false)\n }\n }\n\n return (\n <Box bg=\"background\" py=\"large\" height=\"100%\">\n {!initialized ? (\n <Loading loading={true} />\n ) : (\n <>\n <TabList distribute {...tabs}>\n <Tab key=\"request\">Request</Tab>\n <Tab key=\"response\">Response</Tab>\n <Tab key=\"makeTheCall\">SDK Call</Tab>\n {isExtension ? <></> : <Tab key=\"performance\">Performance</Tab>}\n {isExtension ? <></> : <Tab key=\"configuration\">Configure</Tab>}\n </TabList>\n <TabPanels px=\"xxlarge\" {...tabs} overflow=\"auto\" height=\"87vh\">\n <TabPanel key=\"request\">\n <RequestForm\n httpMethod={httpMethod}\n inputs={inputs}\n requestContent={requestContent}\n setRequestContent={setRequestContent}\n handleSubmit={handleSubmit}\n needsAuth={needsAuth}\n hasConfig={hasConfig}\n handleConfig={handleConfig}\n setHasConfig={setHasConfig}\n isExtension={isExtension}\n validationMessage={validationMessage}\n setValidationMessage={setValidationMessage}\n />\n </TabPanel>\n <TabPanel key=\"response\">\n <Loading\n loading={loading}\n message={`${httpMethod} ${pathify(endpoint, activePathParams)}`}\n />\n <ResponseExplorer\n response={responseContent}\n verb={httpMethod}\n path={pathify(endpoint, activePathParams)}\n />\n </TabPanel>\n <TabPanel key=\"makeTheCall\">\n <DocSdkCalls\n sdkLanguage={sdkLanguage}\n api={api}\n method={method}\n inputs={prepareInputs(inputs, requestContent)}\n />\n </TabPanel>\n {isExtension ? (\n <></>\n ) : (\n <TabPanel key=\"performance\">\n <PerfTracker perf={perf} />\n </TabPanel>\n )}\n {isExtension ? (\n <></>\n ) : (\n <TabPanel key=\"config\">\n <ConfigForm\n setHasConfig={setHasConfig}\n requestContent={requestContent}\n />\n </TabPanel>\n )}\n </TabPanels>\n </>\n )}\n </Box>\n )\n}\n"],"file":"RunIt.js"}
@@ -1,11 +1,7 @@
1
1
  import type { FC, ReactElement } from 'react';
2
2
  import React from 'react';
3
- import type { IAPIMethods } from '@looker/sdk-rtl';
4
- import type { RunItConfigurator } from './components';
5
3
  export interface RunItContextProps {
6
4
  basePath: string;
7
- sdk?: IAPIMethods | undefined;
8
- configurator: RunItConfigurator;
9
5
  }
10
6
  export interface RunItProviderProps extends RunItContextProps {
11
7
  children: ReactElement<any> | ReactElement[];
@@ -12,8 +12,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
12
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
13
 
14
14
  var defaultRunItContextValue = {
15
- basePath: '',
16
- configurator: {}
15
+ basePath: ''
17
16
  };
18
17
  var RunItContext = (0, _react.createContext)(defaultRunItContextValue);
19
18
  exports.RunItContext = RunItContext;
@@ -21,14 +20,10 @@ exports.RunItContext = RunItContext;
21
20
  var RunItProvider = _ref => {
22
21
  var {
23
22
  children,
24
- sdk,
25
- basePath,
26
- configurator
23
+ basePath
27
24
  } = _ref;
28
25
  return _react.default.createElement(RunItContext.Provider, {
29
26
  value: {
30
- sdk,
31
- configurator,
32
27
  basePath
33
28
  }
34
29
  }, children);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/RunItProvider.tsx"],"names":["defaultRunItContextValue","basePath","configurator","RunItContext","RunItProvider","children","sdk"],"mappings":";;;;;;;AA2BA;;;;;;AAcA,IAAMA,wBAA2C,GAAG;AAClDC,EAAAA,QAAQ,EAAE,EADwC;AAElDC,EAAAA,YAAY,EAAE;AAFoC,CAApD;AAKO,IAAMC,YAAY,GAAG,0BAC1BH,wBAD0B,CAArB;;;AAIA,IAAMI,aAAqC,GAAG,QAK/C;AAAA,MALgD;AACpDC,IAAAA,QADoD;AAEpDC,IAAAA,GAFoD;AAGpDL,IAAAA,QAHoD;AAIpDC,IAAAA;AAJoD,GAKhD;AACJ,SACE,6BAAC,YAAD,CAAc,QAAd;AAAuB,IAAA,KAAK,EAAE;AAAEI,MAAAA,GAAF;AAAOJ,MAAAA,YAAP;AAAqBD,MAAAA;AAArB;AAA9B,KACGI,QADH,CADF;AAKD,CAXM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC, ReactElement } from 'react'\nimport React, { createContext } from 'react'\nimport type { IAPIMethods } from '@looker/sdk-rtl'\nimport type { RunItConfigurator } from './components'\n\nexport interface RunItContextProps {\n basePath: string\n sdk?: IAPIMethods | undefined\n configurator: RunItConfigurator\n}\n\nexport interface RunItProviderProps extends RunItContextProps {\n children: ReactElement<any> | ReactElement[]\n}\n\nconst defaultRunItContextValue: RunItContextProps = {\n basePath: '',\n configurator: {} as RunItConfigurator,\n}\n\nexport const RunItContext = createContext<RunItContextProps>(\n defaultRunItContextValue\n)\n\nexport const RunItProvider: FC<RunItProviderProps> = ({\n children,\n sdk,\n basePath,\n configurator,\n}) => {\n return (\n <RunItContext.Provider value={{ sdk, configurator, basePath }}>\n {children}\n </RunItContext.Provider>\n )\n}\n"],"file":"RunItProvider.js"}
1
+ {"version":3,"sources":["../src/RunItProvider.tsx"],"names":["defaultRunItContextValue","basePath","RunItContext","RunItProvider","children"],"mappings":";;;;;;;AA2BA;;;;;;AAUA,IAAMA,wBAA2C,GAAG;AAClDC,EAAAA,QAAQ,EAAE;AADwC,CAApD;AAIO,IAAMC,YAAY,GAAG,0BAC1BF,wBAD0B,CAArB;;;AASA,IAAMG,aAAqC,GAAG,QAG/C;AAAA,MAHgD;AACpDC,IAAAA,QADoD;AAEpDH,IAAAA;AAFoD,GAGhD;AACJ,SACE,6BAAC,YAAD,CAAc,QAAd;AAAuB,IAAA,KAAK,EAAE;AAAEA,MAAAA;AAAF;AAA9B,KACGG,QADH,CADF;AAKD,CATM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC, ReactElement } from 'react'\nimport React, { createContext } from 'react'\n\nexport interface RunItContextProps {\n basePath: string\n}\n\nexport interface RunItProviderProps extends RunItContextProps {\n children: ReactElement<any> | ReactElement[]\n}\n\nconst defaultRunItContextValue: RunItContextProps = {\n basePath: '',\n}\n\nexport const RunItContext = createContext<RunItContextProps>(\n defaultRunItContextValue\n)\n\n/**\n * TODO: Eliminate this provider. Configurator currently duplicates adaptor\n * functionality. basePath can be passed as a prop and should be stored using\n * redux when RunIt has it.\n */\nexport const RunItProvider: FC<RunItProviderProps> = ({\n children,\n basePath,\n}) => {\n return (\n <RunItContext.Provider value={{ basePath }}>\n {children}\n </RunItContext.Provider>\n )\n}\n"],"file":"RunItProvider.js"}
@@ -1,14 +1,9 @@
1
1
  import type { Dispatch, FC } from 'react';
2
- import type { IAPIMethods } from '@looker/sdk-rtl';
3
- import type { RunItSetter, RunItValues } from '../..';
4
- import type { RunItConfigurator } from './configUtils';
2
+ import type { RunItValues } from '../..';
5
3
  interface ConfigFormProps {
6
- configurator: RunItConfigurator;
7
- setVersionsUrl: RunItSetter;
8
4
  requestContent: RunItValues;
9
5
  title?: string;
10
6
  setHasConfig?: Dispatch<boolean>;
11
- sdk?: IAPIMethods;
12
7
  }
13
8
  export declare const ConfigForm: FC<ConfigFormProps>;
14
9
  export {};
@@ -11,9 +11,11 @@ var _components = require("@looker/components");
11
11
 
12
12
  var _codeEditor = require("@looker/code-editor");
13
13
 
14
+ var _extensionUtils = require("@looker/extension-utils");
15
+
14
16
  var _ = require("../..");
15
17
 
16
- var _configUtils = require("./configUtils");
18
+ var _utils = require("./utils");
17
19
 
18
20
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
21
 
@@ -33,19 +35,14 @@ var POSITIVE = 'positive';
33
35
  var defaultFieldValues = {
34
36
  baseUrl: '',
35
37
  webUrl: '',
36
- headless: false,
37
- specs: {},
38
38
  fetchResult: '',
39
39
  fetchIntent: POSITIVE
40
40
  };
41
41
 
42
42
  var ConfigForm = _ref => {
43
43
  var {
44
- configurator,
45
- setVersionsUrl,
46
44
  title,
47
45
  requestContent,
48
- sdk = _.runItSDK,
49
46
  setHasConfig
50
47
  } = _ref;
51
48
  var BASE_URL = 'baseUrl';
@@ -54,14 +51,13 @@ var ConfigForm = _ref => {
54
51
  var FETCH_RESULT = 'fetchResult';
55
52
  var CRITICAL = 'critical';
56
53
  var appConfig = "{\n \"client_guid\": \"looker.api-explorer\",\n \"redirect_uri\": \"".concat(window.location.origin, "/oauth\",\n \"display_name\": \"CORS API Explorer\",\n \"description\": \"Looker API Explorer using CORS\",\n \"enabled\": true\n}\n");
54
+ var adaptor = (0, _extensionUtils.getEnvAdaptor)();
55
+ var sdk = adaptor.sdk;
57
56
  title = title || 'RunIt Configuration';
58
57
 
59
58
  var getConfig = () => {
60
- var data = configurator.getStorage(_configUtils.RunItConfigKey);
61
- var result = data.value ? JSON.parse(data.value) : {
62
- base_url: '',
63
- looker_url: ''
64
- };
59
+ var data = localStorage.getItem(_utils.RunItConfigKey);
60
+ var result = data ? JSON.parse(data) : _utils.RunItNoConfig;
65
61
  return result;
66
62
  };
67
63
 
@@ -90,14 +86,14 @@ var ConfigForm = _ref => {
90
86
  var {
91
87
  base_url,
92
88
  looker_url
93
- } = getConfig();
89
+ } = data;
94
90
  setSaved(data);
95
91
  updateFields({
96
92
  [BASE_URL]: base_url,
97
93
  [WEB_URL]: looker_url,
98
94
  [FETCH_INTENT]: base_url !== '' && looker_url !== '' ? POSITIVE : CRITICAL
99
95
  });
100
- }, [configurator]);
96
+ }, []);
101
97
  var [validationMessages, setValidationMessages] = (0, _react.useState)({});
102
98
 
103
99
  var updateMessage = (intent, message) => {
@@ -108,7 +104,7 @@ var ConfigForm = _ref => {
108
104
  };
109
105
 
110
106
  var isConfigured = () => {
111
- return saved !== _.RunItNoConfig && fields[BASE_URL] === saved.base_url && fields[WEB_URL] === saved.looker_url;
107
+ return saved !== _utils.RunItNoConfig && fields[BASE_URL] === saved.base_url && fields[WEB_URL] === saved.looker_url;
112
108
  };
113
109
 
114
110
  var fetchError = message => {
@@ -118,37 +114,32 @@ var ConfigForm = _ref => {
118
114
 
119
115
  var updateForm = function () {
120
116
  var _ref2 = _asyncToGenerator(function* (_e, save) {
117
+ updateMessage('inform', '');
118
+ var versionsUrl = "".concat(fields.baseUrl, "/versions");
119
+
121
120
  try {
122
- updateMessage('inform', '');
123
- var versionsUrl = "".concat(fields.baseUrl, "/versions");
124
121
  var {
125
- webUrl,
126
- baseUrl
127
- } = yield (0, _configUtils.loadSpecsFromVersions)(versionsUrl);
128
-
129
- if (!baseUrl || !webUrl) {
130
- fetchError('Invalid server configuration');
131
- } else {
132
- updateFields({
133
- [BASE_URL]: baseUrl,
134
- [WEB_URL]: webUrl
135
- });
136
- updateMessage(POSITIVE, 'Configuration is valid');
137
-
138
- if (save) {
139
- var data = {
140
- base_url: baseUrl,
141
- looker_url: webUrl
142
- };
143
- configurator.setStorage(_configUtils.RunItConfigKey, JSON.stringify(data), 'local');
144
- if (setHasConfig) setHasConfig(true);
145
- setSaved(data);
146
- setVersionsUrl(versionsUrl);
147
- updateMessage(POSITIVE, "Saved ".concat(webUrl, " as OAuth server"));
148
- }
122
+ web_server_url: webUrl,
123
+ api_server_url: baseUrl
124
+ } = yield (0, _utils.getVersions)(versionsUrl);
125
+ updateFields({
126
+ [BASE_URL]: baseUrl,
127
+ [WEB_URL]: webUrl
128
+ });
129
+ updateMessage(POSITIVE, 'Configuration is valid');
130
+
131
+ if (save) {
132
+ var data = {
133
+ base_url: baseUrl,
134
+ looker_url: webUrl
135
+ };
136
+ localStorage.setItem(_utils.RunItConfigKey, JSON.stringify(data));
137
+ if (setHasConfig) setHasConfig(true);
138
+ setSaved(data);
139
+ updateMessage(POSITIVE, "Saved ".concat(webUrl, " as OAuth server"));
149
140
  }
150
- } catch (err) {
151
- fetchError(err.message);
141
+ } catch (e) {
142
+ fetchError(e.message);
152
143
  }
153
144
  });
154
145
 
@@ -179,14 +170,14 @@ var ConfigForm = _ref => {
179
170
 
180
171
  var handleClear = function () {
181
172
  var _ref5 = _asyncToGenerator(function* (_e) {
182
- configurator.removeStorage(_configUtils.RunItConfigKey);
173
+ localStorage.removeItem(_utils.RunItConfigKey);
183
174
  updateFields({
184
175
  [BASE_URL]: '',
185
176
  [WEB_URL]: '',
186
177
  [FETCH_INTENT]: CRITICAL,
187
178
  [FETCH_RESULT]: ''
188
179
  });
189
- setSaved(_.RunItNoConfig);
180
+ setSaved(_utils.RunItNoConfig);
190
181
  if (setHasConfig) setHasConfig(false);
191
182
 
192
183
  if (isAuthenticated()) {
@@ -204,7 +195,7 @@ var ConfigForm = _ref => {
204
195
 
205
196
  var newValidationMessages = _objectSpread({}, validationMessages);
206
197
 
207
- var url = (0, _configUtils.validateUrl)(event.currentTarget.value);
198
+ var url = (0, _utils.validateUrl)(event.currentTarget.value);
208
199
 
209
200
  if (url) {
210
201
  delete newValidationMessages[name];
@@ -223,7 +214,7 @@ var ConfigForm = _ref => {
223
214
  setValidationMessages(newValidationMessages);
224
215
  };
225
216
 
226
- var isAuthenticated = () => sdk === null || sdk === void 0 ? void 0 : sdk.authSession.isAuthenticated();
217
+ var isAuthenticated = () => sdk.authSession.isAuthenticated();
227
218
 
228
219
  var verifyButtonDisabled = fields.baseUrl.trim().length === 0 || Object.keys(validationMessages).length > 0;
229
220
  var saveButtonDisabled = verifyButtonDisabled || fields.webUrl.trim().length === 0 || isConfigured();
@@ -235,10 +226,10 @@ var ConfigForm = _ref => {
235
226
  e.preventDefault();
236
227
 
237
228
  if (requestContent) {
238
- configurator.setStorage(_.RunItFormKey, JSON.stringify(requestContent), 'local');
229
+ localStorage.setItem(_utils.RunItFormKey, JSON.stringify(requestContent));
239
230
  }
240
231
 
241
- yield sdk === null || sdk === void 0 ? void 0 : sdk.authSession.login();
232
+ yield adaptor.login();
242
233
  });
243
234
 
244
235
  return function handleLogin(_x6) {