@looker/extension-utils 0.1.23 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/lib/APIErrorDisplay/APIErrorContent.js.map +1 -1
  3. package/lib/APIErrorDisplay/APIErrorDetails.js.map +1 -1
  4. package/lib/APIErrorDisplay/APIErrorDialog.js.map +1 -1
  5. package/lib/APIErrorDisplay/APIErrorDisplay.js.map +1 -1
  6. package/lib/APIErrorDisplay/APIErrorDocLink.js.map +1 -1
  7. package/lib/APIErrorDisplay/index.js.map +1 -1
  8. package/lib/APIErrorDisplay/utils.js.map +1 -1
  9. package/lib/ExtMarkdown.js.map +1 -1
  10. package/lib/OAuthForm/index.d.ts +1 -0
  11. package/lib/OAuthForm/index.js +17 -0
  12. package/lib/OAuthForm/index.js.map +1 -0
  13. package/lib/{esm/OAuthConfigForm/Collapser → OAuthForm/src/components}/CollapserCard.js +1 -1
  14. package/lib/OAuthForm/src/components/CollapserCard.js.map +1 -0
  15. package/lib/{OAuthConfigForm → OAuthForm/src/components}/ConfigHeading.js +1 -1
  16. package/lib/OAuthForm/src/components/ConfigHeading.js.map +1 -0
  17. package/lib/{OAuthConfigForm/OAuthConfigForm.d.ts → OAuthForm/src/components/OAuthForm.d.ts} +1 -1
  18. package/lib/{OAuthConfigForm/OAuthConfigForm.js → OAuthForm/src/components/OAuthForm.js} +70 -60
  19. package/lib/OAuthForm/src/components/OAuthForm.js.map +1 -0
  20. package/lib/OAuthForm/src/components/index.d.ts +1 -0
  21. package/lib/OAuthForm/src/components/index.js +13 -0
  22. package/lib/OAuthForm/src/components/index.js.map +1 -0
  23. package/lib/OAuthForm/src/index.d.ts +2 -0
  24. package/lib/OAuthForm/src/index.js +28 -0
  25. package/lib/OAuthForm/src/index.js.map +1 -0
  26. package/lib/OAuthForm/src/state/index.d.ts +1 -0
  27. package/lib/OAuthForm/src/state/index.js +13 -0
  28. package/lib/OAuthForm/src/state/index.js.map +1 -0
  29. package/lib/OAuthForm/src/state/slice.d.ts +64 -0
  30. package/lib/OAuthForm/src/state/slice.js +83 -0
  31. package/lib/OAuthForm/src/state/slice.js.map +1 -0
  32. package/lib/OAuthForm/src/utils.js.map +1 -0
  33. package/lib/OAuthScene.js.map +1 -1
  34. package/lib/adaptorUtils.js.map +1 -1
  35. package/lib/authUtils.js.map +1 -1
  36. package/lib/browserAdaptor.js.map +1 -1
  37. package/lib/esm/APIErrorDisplay/APIErrorContent.js.map +1 -1
  38. package/lib/esm/APIErrorDisplay/APIErrorDetails.js.map +1 -1
  39. package/lib/esm/APIErrorDisplay/APIErrorDialog.js.map +1 -1
  40. package/lib/esm/APIErrorDisplay/APIErrorDisplay.js.map +1 -1
  41. package/lib/esm/APIErrorDisplay/APIErrorDocLink.js.map +1 -1
  42. package/lib/esm/APIErrorDisplay/index.js.map +1 -1
  43. package/lib/esm/APIErrorDisplay/utils.js.map +1 -1
  44. package/lib/esm/ExtMarkdown.js.map +1 -1
  45. package/lib/esm/OAuthForm/index.js +17 -0
  46. package/lib/esm/OAuthForm/index.js.map +1 -0
  47. package/lib/{OAuthConfigForm/Collapser → esm/OAuthForm/src/components}/CollapserCard.js +1 -1
  48. package/lib/esm/OAuthForm/src/components/CollapserCard.js.map +1 -0
  49. package/lib/esm/{OAuthConfigForm → OAuthForm/src/components}/ConfigHeading.js +1 -1
  50. package/lib/esm/OAuthForm/src/components/ConfigHeading.js.map +1 -0
  51. package/lib/esm/{OAuthConfigForm/OAuthConfigForm.js → OAuthForm/src/components/OAuthForm.js} +70 -60
  52. package/lib/esm/OAuthForm/src/components/OAuthForm.js.map +1 -0
  53. package/lib/esm/OAuthForm/src/components/index.js +13 -0
  54. package/lib/esm/OAuthForm/src/components/index.js.map +1 -0
  55. package/lib/esm/OAuthForm/src/index.js +28 -0
  56. package/lib/esm/OAuthForm/src/index.js.map +1 -0
  57. package/lib/esm/OAuthForm/src/state/index.js +13 -0
  58. package/lib/esm/OAuthForm/src/state/index.js.map +1 -0
  59. package/lib/esm/OAuthForm/src/state/slice.js +83 -0
  60. package/lib/esm/OAuthForm/src/state/slice.js.map +1 -0
  61. package/lib/esm/OAuthForm/src/utils.js.map +1 -0
  62. package/lib/esm/OAuthScene.js.map +1 -1
  63. package/lib/esm/adaptorUtils.js.map +1 -1
  64. package/lib/esm/authUtils.js.map +1 -1
  65. package/lib/esm/browserAdaptor.js.map +1 -1
  66. package/lib/esm/extensionAdaptor.js.map +1 -1
  67. package/lib/esm/index.js +4 -4
  68. package/lib/esm/index.js.map +1 -1
  69. package/lib/extensionAdaptor.js.map +1 -1
  70. package/lib/index.d.ts +1 -1
  71. package/lib/index.js +4 -4
  72. package/lib/index.js.map +1 -1
  73. package/package.json +10 -7
  74. package/lib/OAuthConfigForm/Collapser/CollapserCard.js.map +0 -1
  75. package/lib/OAuthConfigForm/Collapser/index.d.ts +0 -1
  76. package/lib/OAuthConfigForm/Collapser/index.js +0 -13
  77. package/lib/OAuthConfigForm/Collapser/index.js.map +0 -1
  78. package/lib/OAuthConfigForm/ConfigHeading.js.map +0 -1
  79. package/lib/OAuthConfigForm/OAuthConfigForm.js.map +0 -1
  80. package/lib/OAuthConfigForm/index.d.ts +0 -1
  81. package/lib/OAuthConfigForm/index.js +0 -13
  82. package/lib/OAuthConfigForm/index.js.map +0 -1
  83. package/lib/OAuthConfigForm/utils.js.map +0 -1
  84. package/lib/esm/OAuthConfigForm/Collapser/CollapserCard.js.map +0 -1
  85. package/lib/esm/OAuthConfigForm/Collapser/index.js +0 -13
  86. package/lib/esm/OAuthConfigForm/Collapser/index.js.map +0 -1
  87. package/lib/esm/OAuthConfigForm/ConfigHeading.js.map +0 -1
  88. package/lib/esm/OAuthConfigForm/OAuthConfigForm.js.map +0 -1
  89. package/lib/esm/OAuthConfigForm/index.js +0 -13
  90. package/lib/esm/OAuthConfigForm/index.js.map +0 -1
  91. package/lib/esm/OAuthConfigForm/utils.js.map +0 -1
  92. /package/lib/{OAuthConfigForm/Collapser → OAuthForm/src/components}/CollapserCard.d.ts +0 -0
  93. /package/lib/{OAuthConfigForm → OAuthForm/src/components}/ConfigHeading.d.ts +0 -0
  94. /package/lib/{OAuthConfigForm → OAuthForm/src}/utils.d.ts +0 -0
  95. /package/lib/{OAuthConfigForm → OAuthForm/src}/utils.js +0 -0
  96. /package/lib/esm/{OAuthConfigForm → OAuthForm/src}/utils.js +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"OAuthConfigForm.js","names":["readyToLogin","EmptyConfig","base_url","looker_url","OAuthConfigForm","setHasConfig","clientId","clientLabel","configKey","location","useLocation","redirect_uri","appPath","appConfig","adaptor","getEnvAdaptor","sdk","getConfig","data","localStorage","getItem","result","JSON","parse","config","apiServerUrl","setApiServerUrl","useState","fetchedUrl","setFetchedUrl","webUrl","setWebUrl","messageBarIntent","setMessageBarIntent","messageBarText","setMessageBarText","validationMessages","setValidationMessages","saved","setSaved","updateMessageBar","intent","message","isConfigured","fetchError","saveConfig","baseUrl","client_id","setItem","stringify","verifyUrl","versionsUrl","versions","getVersions","web_server_url","e","undefined","handleSave","api_server_url","handleVerify","handleClear","_e","removeItem","isAuthenticated","handleUrlChange","event","name","currentTarget","value","newValidationMessages","url","validateUrl","type","authSession","verifyButtonDisabled","trim","length","Object","keys","saveButtonDisabled","clearButtonDisabled","loginButtonDisabled","handleLogin","preventDefault","login","useEffect","window","origin"],"sources":["../../../src/OAuthConfigForm/OAuthConfigForm.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport type { BaseSyntheticEvent, Dispatch, FormEvent } from 'react'\nimport React, { useState, useEffect } from 'react'\nimport type { ValidationMessages, MessageBarIntent } from '@looker/components'\nimport {\n Button,\n ButtonTransparent,\n Divider,\n Fieldset,\n FieldText,\n Form,\n MessageBar,\n Paragraph,\n Link,\n Space,\n SpaceVertical,\n Span,\n Tooltip,\n} from '@looker/components'\nimport { CodeCopy } from '@looker/code-editor'\nimport type { ILookerVersions } from '@looker/sdk-codegen'\nimport { useLocation } from 'react-router-dom'\nimport { appPath, getEnvAdaptor } from '..'\nimport { ConfigHeading } from './ConfigHeading'\nimport { CollapserCard } from './Collapser'\nimport { getVersions, validateUrl } from './utils'\nimport type { ConfigValues } from './utils'\n\nexport const readyToLogin =\n 'OAuth is configured but your browser session is not authenticated. Click Login.'\n\nconst EmptyConfig = { base_url: '', looker_url: '' }\n\ninterface ConfigFormProps {\n /** A set state callback which allows for editing, setting or clearing OAuth configuration parameters if present */\n setHasConfig?: Dispatch<boolean>\n /** Local storage key value for storing config parameters */\n configKey: string\n /** OAuth client id */\n clientId: string\n /** OAuth client display label */\n clientLabel: string\n}\n\nexport const OAuthConfigForm = ({\n setHasConfig,\n clientId,\n clientLabel,\n configKey,\n}: ConfigFormProps) => {\n const location = useLocation()\n const redirect_uri = appPath(location, '/oauth')\n const appConfig = `// client_guid=${clientId}\n{\n \"redirect_uri\": \"${redirect_uri}\",\n \"display_name\": \"CORS ${clientLabel}\",\n \"description\": \"Looker ${clientLabel} using CORS\",\n \"enabled\": true\n}\n`\n const adaptor = getEnvAdaptor()\n const sdk = adaptor.sdk\n // See https://codesandbox.io/s/youthful-surf-0g27j?file=/src/index.tsx for a prototype from Luke\n // TODO see about useReducer to clean this up a bit more\n\n const getConfig = () => {\n // TODO: This is temporary until config settings are available in redux.\n // get configuration from storage, or default it\n const data = localStorage.getItem(configKey)\n const result = data ? JSON.parse(data) : EmptyConfig\n return result\n }\n\n const config = getConfig()\n const [apiServerUrl, setApiServerUrl] = useState('')\n const [fetchedUrl, setFetchedUrl] = useState('')\n const [webUrl, setWebUrl] = useState('')\n const [messageBarIntent, setMessageBarIntent] =\n useState<MessageBarIntent>('positive')\n const [messageBarText, setMessageBarText] = useState('')\n const [validationMessages, setValidationMessages] =\n useState<ValidationMessages>({})\n const [saved, setSaved] = useState<ConfigValues>(config)\n\n const updateMessageBar = (intent: MessageBarIntent, message: string) => {\n setMessageBarIntent(intent)\n setMessageBarText(message)\n }\n\n const isConfigured = () => {\n return (\n apiServerUrl === saved.base_url &&\n webUrl === saved.looker_url &&\n apiServerUrl !== '' &&\n webUrl !== ''\n )\n }\n\n const fetchError = (message: string) => {\n setWebUrl('')\n updateMessageBar('critical', message)\n }\n\n const saveConfig = (baseUrl: string, webUrl: string) => {\n const data = {\n base_url: baseUrl,\n looker_url: webUrl,\n client_id: clientId,\n redirect_uri,\n }\n // TODO: replace when redux is introduced\n localStorage.setItem(configKey, JSON.stringify(data))\n if (setHasConfig) setHasConfig(true)\n setSaved(data)\n updateMessageBar('positive', `Saved ${webUrl} as OAuth server`)\n }\n\n const verifyUrl = async (): Promise<ILookerVersions | undefined> => {\n updateMessageBar(messageBarIntent, '')\n const versionsUrl = `${apiServerUrl}/versions`\n try {\n setFetchedUrl(apiServerUrl)\n const versions = await getVersions(versionsUrl)\n\n if (versions) {\n updateMessageBar('positive', 'Configuration is valid')\n setWebUrl(versions.web_server_url)\n }\n\n return versions\n } catch (e: any) {\n fetchError(e.message)\n return undefined\n }\n }\n\n const handleSave = async () => {\n const versions = await verifyUrl()\n if (versions) {\n saveConfig(versions.api_server_url, versions.web_server_url)\n }\n }\n\n const handleVerify = () => {\n verifyUrl()\n }\n\n const handleClear = async (_e: BaseSyntheticEvent) => {\n // TODO: replace when redux is introduced to run it\n localStorage.removeItem(configKey)\n\n setApiServerUrl('')\n setFetchedUrl('')\n setWebUrl('')\n setMessageBarText('')\n setMessageBarIntent('critical')\n setSaved(EmptyConfig)\n\n if (setHasConfig) setHasConfig(false)\n if (isAuthenticated()) {\n updateMessageBar('warn', 'Please reload the browser page to log out')\n }\n }\n\n const handleUrlChange = (event: FormEvent<HTMLInputElement>) => {\n const name = event.currentTarget.name\n const value = event.currentTarget.value\n\n const newValidationMessages = { ...validationMessages }\n\n setApiServerUrl(value)\n setWebUrl('')\n\n const url = validateUrl(value)\n if (url) {\n delete newValidationMessages[name]\n // Update URL if it's been cleaned up\n setApiServerUrl(url)\n } else {\n newValidationMessages[name] = {\n message: `'${value}' is not a valid url`,\n type: 'error',\n }\n }\n\n setValidationMessages(newValidationMessages)\n }\n\n const isAuthenticated = () => sdk.authSession.isAuthenticated()\n\n const verifyButtonDisabled =\n apiServerUrl.trim().length === 0 ||\n Object.keys(validationMessages).length > 0\n\n const saveButtonDisabled =\n verifyButtonDisabled || webUrl.trim().length === 0 || isConfigured()\n\n const clearButtonDisabled = apiServerUrl.trim().length === 0\n\n const loginButtonDisabled =\n verifyButtonDisabled || !isConfigured() || isAuthenticated()\n\n const handleLogin = async (e: BaseSyntheticEvent) => {\n e.preventDefault()\n // This will set storage variables and return to OAuthScene when successful\n await adaptor.login()\n }\n\n useEffect(() => {\n const data = getConfig()\n const { base_url, looker_url } = data\n setApiServerUrl(base_url)\n setWebUrl(looker_url)\n }, [])\n\n return (\n <SpaceVertical gap=\"u2\">\n <ConfigHeading>Looker OAuth Configuration</ConfigHeading>\n <Span fontSize=\"small\">\n To configure Looker OAuth, you need to supply your API server URL, then\n authenticate into your Looker Instance\n </Span>\n <MessageBar\n intent={messageBarIntent}\n onPrimaryClick={() => updateMessageBar(messageBarIntent, '')}\n visible={messageBarText !== ''}\n >\n {messageBarText}\n </MessageBar>\n <CollapserCard\n heading=\"1. Supply API Server URL\"\n id=\"server_config\"\n divider={false}\n defaultOpen={!isAuthenticated()}\n >\n <SpaceVertical gap=\"u2\" pt=\"u3\" px=\"u6\">\n <Form validationMessages={validationMessages}>\n <Fieldset legend=\"Server locations\">\n <FieldText\n required\n label=\"API server URL\"\n placeholder=\"typically https://myserver.looker.com:19999\"\n name=\"baseUrl\"\n value={apiServerUrl}\n onChange={handleUrlChange}\n />\n <FieldText\n label=\"OAuth server URL\"\n placeholder=\"Click 'Verify' to retrieve\"\n name=\"webUrl\"\n value={webUrl}\n disabled={true}\n />\n </Fieldset>\n </Form>\n {fetchedUrl && (\n <>\n <Paragraph fontSize=\"small\">\n On {fetchedUrl}, enable {clientLabel} as a{' '}\n <Link\n href=\"https://github.com/looker-open-source/sdk-codegen/blob/main/docs/cors.md#reference-implementation\"\n target=\"_blank\"\n >\n Looker OAuth client\n </Link>{' '}\n by adding \"{(window as any).location.origin}\" to the{' '}\n <Link href={`${webUrl}/admin/embed`} target=\"_blank\">\n Embedded Domain Allowlist\n </Link>\n . If API Explorer is also installed, the configuration below can\n be used to{' '}\n <Link\n href={`${fetchedUrl}/extensions/marketplace_extension_api_explorer::api-explorer/4.0/methods/Auth/register_oauth_client_app`}\n target=\"_blank\"\n >\n register this API Explorer instance\n </Link>{' '}\n as an OAuth client.\n </Paragraph>\n <CodeCopy key=\"appConfig\" language=\"json\" code={appConfig} />\n </>\n )}\n <Space>\n <Tooltip content=\"Clear the configuration values\">\n <ButtonTransparent\n onClick={handleClear}\n disabled={clearButtonDisabled}\n >\n Clear\n </ButtonTransparent>\n </Tooltip>\n <Tooltip content={`Verify ${apiServerUrl}`}>\n <ButtonTransparent\n disabled={verifyButtonDisabled}\n onClick={handleVerify}\n mr=\"small\"\n >\n Verify\n </ButtonTransparent>\n </Tooltip>\n <Tooltip content=\"Save the configuration for this browser\">\n <Button\n disabled={saveButtonDisabled}\n onClick={handleSave}\n mr=\"small\"\n >\n Save\n </Button>\n </Tooltip>\n </Space>\n </SpaceVertical>\n </CollapserCard>\n <Divider appearance=\"light\" />\n <CollapserCard\n heading=\"2. Login to instance\"\n divider={false}\n id=\"login_section\"\n defaultOpen={!isAuthenticated()}\n >\n <SpaceVertical pt=\"u3\" px=\"u6\">\n {isAuthenticated() ? (\n <Span>You are already logged in. Reload the page to log out.</Span>\n ) : isConfigured() ? (\n <>\n <Span>{readyToLogin}</Span>\n </>\n ) : (\n <Span>\n You will be able to login after you Verify your API Server URL\n </Span>\n )}\n <Tooltip content={`Login to ${webUrl} using OAuth`}>\n <Button onClick={handleLogin} disabled={loginButtonDisabled}>\n Login\n </Button>\n </Tooltip>\n </SpaceVertical>\n </CollapserCard>\n </SpaceVertical>\n )\n}\n"],"mappings":";;;;;;AA0BA;AAEA;AAeA;AAEA;AACA;AACA;AACA;AACA;AAAkD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAG3C,IAAMA,YAAY,GACvB,iFAAiF;AAAA;AAEnF,IAAMC,WAAW,GAAG;EAAEC,QAAQ,EAAE,EAAE;EAAEC,UAAU,EAAE;AAAG,CAAC;AAa7C,IAAMC,eAAe,GAAG,QAKR;EAAA,IALS;IAC9BC,YAAY;IACZC,QAAQ;IACRC,WAAW;IACXC;EACe,CAAC;EAChB,IAAMC,QAAQ,GAAG,IAAAC,2BAAW,GAAE;EAC9B,IAAMC,YAAY,GAAG,IAAAC,SAAO,EAACH,QAAQ,EAAE,QAAQ,CAAC;EAChD,IAAMI,SAAS,4BAAqBP,QAAQ,wCAEzBK,YAAY,6CACPJ,WAAW,8CACVA,WAAW,6CAGrC;EACC,IAAMO,OAAO,GAAG,IAAAC,eAAa,GAAE;EAC/B,IAAMC,GAAG,GAAGF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I,CACF,CACF;AAEpB,CAAC;AAAA"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "OAuthConfigForm", {
7
- enumerable: true,
8
- get: function get() {
9
- return _OAuthConfigForm.OAuthConfigForm;
10
- }
11
- });
12
- var _OAuthConfigForm = require("./OAuthConfigForm");
13
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/OAuthConfigForm/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 { OAuthConfigForm } from './OAuthConfigForm'\n"],"mappings":";;;;;;;;;;;AAyBA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":["getUrl","url","settings","DefaultSettings","base_url","verify_ssl","xp","BrowserTransport","response","rawRequest","body","getVersions","versionsUrl","versions","content","JSON","parse","Error","validateUrl","result","URL","endsWith","origin"],"sources":["../../../src/OAuthConfigForm/utils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport { BrowserTransport, DefaultSettings } from '@looker/sdk-rtl'\nimport type { ILookerVersions } from '@looker/sdk-codegen'\n\nexport type ConfigValues = Record<string, any>\n\n/**\n * Use the browser transport to GET a url\n * @param url to fetch\n */\nexport const getUrl = async (url: string): Promise<string | ConfigValues> => {\n const settings = {\n ...DefaultSettings(),\n ...{ base_url: url, verify_ssl: false },\n }\n const xp = new BrowserTransport(settings)\n const response = await xp.rawRequest('GET', url)\n return response.body\n}\n\n/**\n * Gets the versions payload given a versions url\n * @param versionsUrl\n */\nexport const getVersions = async (\n versionsUrl: string\n): Promise<ILookerVersions | undefined> => {\n let versions\n try {\n const content = await getUrl(versionsUrl)\n versions = typeof content === 'string' ? JSON.parse(content) : content\n } catch {\n throw new Error('Invalid server configuration')\n }\n return versions\n}\n\n/**\n * Validates URL and standardizes it\n * @param url to validate\n * @returns the standardized url.origin if it's valid, or an empty string if it's not\n */\nexport const validateUrl = (url: string): string => {\n try {\n const result = new URL(url)\n if (url.endsWith(':')) return url\n return result.origin\n } catch {\n return ''\n }\n}\n"],"mappings":";;;;;;AAyBA;AAAmE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS5D,IAAMA,MAAM;EAAA,6BAAG,WAAOC,GAAW,EAAqC;IAC3E,IAAMC,QAAQ,mCACT,IAAAC,uBAAe,GAAE,GACjB;MAAEC,QAAQ,EAAEH,GAAG;MAAEI,UAAU,EAAE;IAAM,CAAC,CACxC;IACD,IAAMC,EAAE,GAAG,IAAIC,wBAAgB,CAACL,QAAQ,CAAC;IACzC,IAAMM,QAAQ,SAASF,EAAE,CAACG,UAAU,CAAC,KAAK,EAAER,GAAG,CAAC;IAChD,OAAOO,QAAQ,CAACE,IAAI;EACtB,CAAC;EAAA,gBARYV,MAAM;IAAA;EAAA;AAAA,GAQlB;AAAA;AAMM,IAAMW,WAAW;EAAA,8BAAG,WACzBC,WAAmB,EACsB;IACzC,IAAIC,QAAQ;IACZ,IAAI;MACF,IAAMC,OAAO,SAASd,MAAM,CAACY,WAAW,CAAC;MACzCC,QAAQ,GAAG,OAAOC,OAAO,KAAK,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAACF,OAAO,CAAC,GAAGA,OAAO;IACxE,CAAC,CAAC,gBAAM;MACN,MAAM,IAAIG,KAAK,CAAC,8BAA8B,CAAC;IACjD;IACA,OAAOJ,QAAQ;EACjB,CAAC;EAAA,gBAXYF,WAAW;IAAA;EAAA;AAAA,GAWvB;AAAA;AAOM,IAAMO,WAAW,GAAIjB,GAAW,IAAa;EAClD,IAAI;IACF,IAAMkB,MAAM,GAAG,IAAIC,GAAG,CAACnB,GAAG,CAAC;IAC3B,IAAIA,GAAG,CAACoB,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAOpB,GAAG;IACjC,OAAOkB,MAAM,CAACG,MAAM;EACtB,CAAC,CAAC,iBAAM;IACN,OAAO,EAAE;EACX;AACF,CAAC;AAAA"}
File without changes