@looker/api-explorer 0.9.36 → 0.9.38
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 +49 -1
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/e2e/MethodScene.spec.ts +80 -0
- package/e2e/diffScene.spec.ts +28 -20
- package/e2e/e2e.spec.ts +45 -7
- package/lib/ApiExplorer.js +17 -6
- package/lib/ApiExplorer.js.map +1 -1
- package/lib/components/DocMarkdown/DocMarkdown.js +3 -1
- package/lib/components/DocMarkdown/DocMarkdown.js.map +1 -1
- package/lib/components/DocSDKs/DocDeclarations.js +10 -15
- package/lib/components/DocSDKs/DocDeclarations.js.map +1 -1
- package/lib/components/SelectorContainer/ApiSpecSelector.js +3 -1
- package/lib/components/SelectorContainer/ApiSpecSelector.js.map +1 -1
- package/lib/components/SelectorContainer/SdkLanguageSelector.js +20 -21
- package/lib/components/SelectorContainer/SdkLanguageSelector.js.map +1 -1
- package/lib/components/SelectorContainer/SelectorContainer.js +4 -1
- package/lib/components/SelectorContainer/SelectorContainer.js.map +1 -1
- package/lib/components/SelectorContainer/utils.d.ts +2 -0
- package/lib/components/SelectorContainer/utils.js +32 -0
- package/lib/components/SelectorContainer/utils.js.map +1 -0
- package/lib/components/SideNav/SideNav.js +20 -9
- package/lib/components/SideNav/SideNav.js.map +1 -1
- package/lib/components/SideNav/SideNavMethods.js +7 -6
- package/lib/components/SideNav/SideNavMethods.js.map +1 -1
- package/lib/components/SideNav/SideNavTypes.js +5 -4
- package/lib/components/SideNav/SideNavTypes.js.map +1 -1
- package/lib/components/index.d.ts +0 -1
- package/lib/components/index.js +0 -8
- package/lib/components/index.js.map +1 -1
- package/lib/esm/ApiExplorer.js +19 -8
- package/lib/esm/ApiExplorer.js.map +1 -1
- package/lib/esm/components/DocMarkdown/DocMarkdown.js +3 -1
- package/lib/esm/components/DocMarkdown/DocMarkdown.js.map +1 -1
- package/lib/esm/components/DocSDKs/DocDeclarations.js +9 -14
- package/lib/esm/components/DocSDKs/DocDeclarations.js.map +1 -1
- package/lib/esm/components/SelectorContainer/ApiSpecSelector.js +3 -1
- package/lib/esm/components/SelectorContainer/ApiSpecSelector.js.map +1 -1
- package/lib/esm/components/SelectorContainer/SdkLanguageSelector.js +16 -18
- package/lib/esm/components/SelectorContainer/SdkLanguageSelector.js.map +1 -1
- package/lib/esm/components/SelectorContainer/SelectorContainer.js +5 -2
- package/lib/esm/components/SelectorContainer/SelectorContainer.js.map +1 -1
- package/lib/esm/components/SelectorContainer/utils.js +22 -0
- package/lib/esm/components/SelectorContainer/utils.js.map +1 -0
- package/lib/esm/components/SideNav/SideNav.js +20 -10
- package/lib/esm/components/SideNav/SideNav.js.map +1 -1
- package/lib/esm/components/SideNav/SideNavMethods.js +8 -7
- package/lib/esm/components/SideNav/SideNavMethods.js.map +1 -1
- package/lib/esm/components/SideNav/SideNavTypes.js +6 -5
- package/lib/esm/components/SideNav/SideNavTypes.js.map +1 -1
- package/lib/esm/components/index.js +0 -1
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/routes/AppRouter.js +6 -4
- package/lib/esm/routes/AppRouter.js.map +1 -1
- package/lib/esm/scenes/DiffScene/DiffScene.js +9 -7
- package/lib/esm/scenes/DiffScene/DiffScene.js.map +1 -1
- package/lib/esm/scenes/DiffScene/DocDiff/DiffItem.js +3 -1
- package/lib/esm/scenes/DiffScene/DocDiff/DiffItem.js.map +1 -1
- package/lib/esm/scenes/DiffScene/DocDiff/DocDiff.js +4 -4
- package/lib/esm/scenes/DiffScene/DocDiff/DocDiff.js.map +1 -1
- package/lib/esm/scenes/ErrorDetailScene/ErrorDetailScene.js +31 -0
- package/lib/esm/scenes/ErrorDetailScene/ErrorDetailScene.js.map +1 -0
- package/lib/esm/scenes/ErrorDetailScene/index.js +2 -0
- package/lib/esm/scenes/ErrorDetailScene/index.js.map +1 -0
- package/lib/esm/scenes/MethodScene/MethodScene.js +28 -9
- package/lib/esm/scenes/MethodScene/MethodScene.js.map +1 -1
- package/lib/esm/{components → scenes/MethodScene/components}/DocResponses/DocResponseTypes.js +1 -1
- package/lib/esm/scenes/MethodScene/components/DocResponses/DocResponseTypes.js.map +1 -0
- package/lib/esm/scenes/MethodScene/components/DocResponses/DocResponses.js +73 -0
- package/lib/esm/scenes/MethodScene/components/DocResponses/DocResponses.js.map +1 -0
- package/lib/esm/{components → scenes/MethodScene/components}/DocResponses/index.js +0 -0
- package/lib/esm/scenes/MethodScene/components/DocResponses/index.js.map +1 -0
- package/lib/esm/{components → scenes/MethodScene/components}/DocResponses/utils.js +0 -0
- package/lib/esm/scenes/MethodScene/components/DocResponses/utils.js.map +1 -0
- package/lib/esm/scenes/MethodScene/components/index.js +1 -0
- package/lib/esm/scenes/MethodScene/components/index.js.map +1 -1
- package/lib/esm/scenes/MethodTagScene/MethodTagScene.js +38 -11
- package/lib/esm/scenes/MethodTagScene/MethodTagScene.js.map +1 -1
- package/lib/esm/scenes/TypeScene/TypeScene.js +3 -1
- package/lib/esm/scenes/TypeScene/TypeScene.js.map +1 -1
- package/lib/esm/scenes/TypeTagScene/TypeTagScene.js +37 -10
- package/lib/esm/scenes/TypeTagScene/TypeTagScene.js.map +1 -1
- package/lib/esm/scenes/index.js +1 -0
- package/lib/esm/scenes/index.js.map +1 -1
- package/lib/esm/scenes/utils/hooks/index.js +2 -0
- package/lib/esm/scenes/utils/hooks/index.js.map +1 -0
- package/lib/esm/scenes/utils/hooks/tagStoreSync.js +37 -0
- package/lib/esm/scenes/utils/hooks/tagStoreSync.js.map +1 -0
- package/lib/esm/scenes/utils/index.js +2 -0
- package/lib/esm/scenes/utils/index.js.map +1 -0
- package/lib/esm/state/settings/selectors.js +1 -0
- package/lib/esm/state/settings/selectors.js.map +1 -1
- package/lib/esm/state/settings/slice.js +6 -1
- package/lib/esm/state/settings/slice.js.map +1 -1
- package/lib/esm/utils/hooks/globalStoreSync.js +53 -0
- package/lib/esm/utils/hooks/globalStoreSync.js.map +1 -0
- package/lib/esm/utils/hooks/index.js +4 -0
- package/lib/esm/utils/hooks/index.js.map +1 -0
- package/lib/esm/utils/hooks/navigation.js +72 -0
- package/lib/esm/utils/hooks/navigation.js.map +1 -0
- package/lib/esm/utils/hooks/useQuery.js +9 -0
- package/lib/esm/utils/hooks/useQuery.js.map +1 -0
- package/lib/esm/utils/index.js +2 -1
- package/lib/esm/utils/index.js.map +1 -1
- package/lib/esm/utils/path.js +21 -0
- package/lib/esm/utils/path.js.map +1 -1
- package/lib/esm/utils/sdkLanguage.js +42 -0
- package/lib/esm/utils/sdkLanguage.js.map +1 -0
- package/lib/routes/AppRouter.d.ts +1 -2
- package/lib/routes/AppRouter.js +5 -3
- package/lib/routes/AppRouter.js.map +1 -1
- package/lib/scenes/DiffScene/DiffScene.d.ts +0 -2
- package/lib/scenes/DiffScene/DiffScene.js +8 -6
- package/lib/scenes/DiffScene/DiffScene.js.map +1 -1
- package/lib/scenes/DiffScene/DocDiff/DiffItem.js +3 -1
- package/lib/scenes/DiffScene/DocDiff/DiffItem.js.map +1 -1
- package/lib/scenes/DiffScene/DocDiff/DocDiff.js +4 -4
- package/lib/scenes/DiffScene/DocDiff/DocDiff.js.map +1 -1
- package/lib/scenes/ErrorDetailScene/ErrorDetailScene.d.ts +7 -0
- package/lib/scenes/ErrorDetailScene/ErrorDetailScene.js +47 -0
- package/lib/scenes/ErrorDetailScene/ErrorDetailScene.js.map +1 -0
- package/lib/scenes/ErrorDetailScene/index.d.ts +1 -0
- package/lib/scenes/ErrorDetailScene/index.js +14 -0
- package/lib/{components/DocResponses → scenes/ErrorDetailScene}/index.js.map +1 -1
- package/lib/scenes/MethodScene/MethodScene.js +23 -4
- package/lib/scenes/MethodScene/MethodScene.js.map +1 -1
- package/lib/{components → scenes/MethodScene/components}/DocResponses/DocResponseTypes.d.ts +2 -2
- package/lib/{components → scenes/MethodScene/components}/DocResponses/DocResponseTypes.js +2 -2
- package/lib/scenes/MethodScene/components/DocResponses/DocResponseTypes.js.map +1 -0
- package/lib/scenes/MethodScene/components/DocResponses/DocResponses.d.ts +9 -0
- package/lib/scenes/MethodScene/components/DocResponses/DocResponses.js +93 -0
- package/lib/scenes/MethodScene/components/DocResponses/DocResponses.js.map +1 -0
- package/lib/{components → scenes/MethodScene/components}/DocResponses/index.d.ts +0 -0
- package/lib/{components → scenes/MethodScene/components}/DocResponses/index.js +0 -0
- package/lib/scenes/MethodScene/components/DocResponses/index.js.map +1 -0
- package/lib/{components → scenes/MethodScene/components}/DocResponses/utils.d.ts +0 -0
- package/lib/{components → scenes/MethodScene/components}/DocResponses/utils.js +0 -0
- package/lib/scenes/MethodScene/components/DocResponses/utils.js.map +1 -0
- package/lib/scenes/MethodScene/components/index.d.ts +1 -0
- package/lib/scenes/MethodScene/components/index.js +8 -0
- package/lib/scenes/MethodScene/components/index.js.map +1 -1
- package/lib/scenes/MethodTagScene/MethodTagScene.js +42 -12
- package/lib/scenes/MethodTagScene/MethodTagScene.js.map +1 -1
- package/lib/scenes/TypeScene/TypeScene.js +3 -1
- package/lib/scenes/TypeScene/TypeScene.js.map +1 -1
- package/lib/scenes/TypeTagScene/TypeTagScene.js +41 -11
- package/lib/scenes/TypeTagScene/TypeTagScene.js.map +1 -1
- package/lib/scenes/index.d.ts +1 -0
- package/lib/scenes/index.js +8 -0
- package/lib/scenes/index.js.map +1 -1
- package/lib/scenes/utils/hooks/index.d.ts +1 -0
- package/lib/scenes/utils/hooks/index.js +14 -0
- package/lib/scenes/utils/hooks/index.js.map +1 -0
- package/lib/scenes/utils/hooks/tagStoreSync.d.ts +1 -0
- package/lib/scenes/utils/hooks/tagStoreSync.js +51 -0
- package/lib/scenes/utils/hooks/tagStoreSync.js.map +1 -0
- package/lib/scenes/utils/index.d.ts +1 -0
- package/lib/scenes/utils/index.js +14 -0
- package/lib/scenes/utils/index.js.map +1 -0
- package/lib/state/settings/selectors.d.ts +2 -1
- package/lib/state/settings/selectors.js +5 -1
- package/lib/state/settings/selectors.js.map +1 -1
- package/lib/state/settings/slice.d.ts +7 -1
- package/lib/state/settings/slice.js +6 -1
- package/lib/state/settings/slice.js.map +1 -1
- package/lib/test-data/index.d.ts +1 -0
- package/lib/test-data/index.js +14 -0
- package/lib/test-data/index.js.map +1 -1
- package/lib/test-data/sdkLanguages.d.ts +10 -0
- package/lib/test-data/sdkLanguages.js +19 -0
- package/lib/test-data/sdkLanguages.js.map +1 -0
- package/lib/utils/hooks/globalStoreSync.d.ts +1 -0
- package/lib/utils/hooks/globalStoreSync.js +67 -0
- package/lib/utils/hooks/globalStoreSync.js.map +1 -0
- package/lib/utils/hooks/index.d.ts +3 -0
- package/lib/utils/hooks/index.js +30 -0
- package/lib/utils/hooks/index.js.map +1 -0
- package/lib/utils/hooks/navigation.d.ts +11 -0
- package/lib/utils/hooks/navigation.js +83 -0
- package/lib/utils/hooks/navigation.js.map +1 -0
- package/lib/utils/hooks/useQuery.d.ts +1 -0
- package/lib/utils/hooks/useQuery.js +20 -0
- package/lib/utils/hooks/useQuery.js.map +1 -0
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js +29 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/path.d.ts +4 -0
- package/lib/utils/path.js +32 -1
- package/lib/utils/path.js.map +1 -1
- package/lib/utils/sdkLanguage.d.ts +6 -0
- package/lib/utils/sdkLanguage.js +59 -0
- package/lib/utils/sdkLanguage.js.map +1 -0
- package/package.json +14 -14
- package/src/ApiExplorer.tsx +13 -8
- package/src/components/DocMarkdown/DocMarkdown.tsx +1 -1
- package/src/components/DocSDKs/DocDeclarations.tsx +11 -22
- package/src/components/DocSDKs/DocSDKs.spec.tsx +4 -1
- package/src/components/Header/Header.spec.tsx +1 -1
- package/src/components/SelectorContainer/ApiSpecSelector.tsx +1 -1
- package/src/components/SelectorContainer/SdkLanguageSelector.spec.tsx +60 -33
- package/src/components/SelectorContainer/SdkLanguageSelector.tsx +15 -22
- package/src/components/SelectorContainer/SelectorContainer.spec.tsx +1 -1
- package/src/components/SelectorContainer/SelectorContainer.tsx +18 -15
- package/src/{utils/hooks.ts → components/SelectorContainer/utils.ts} +13 -21
- package/src/components/SideNav/SideNav.tsx +26 -14
- package/src/components/SideNav/SideNavMethods.spec.tsx +6 -8
- package/src/components/SideNav/SideNavMethods.tsx +8 -12
- package/src/components/SideNav/SideNavTypes.tsx +5 -10
- package/src/components/index.ts +0 -1
- package/src/routes/AppRouter.tsx +7 -5
- package/src/scenes/DiffScene/DiffScene.tsx +8 -8
- package/src/scenes/DiffScene/DocDiff/DiffItem.tsx +1 -1
- package/src/scenes/DiffScene/DocDiff/DocDiff.spec.tsx +73 -2
- package/src/scenes/DiffScene/DocDiff/DocDiff.tsx +4 -4
- package/src/scenes/ErrorDetailScene/ErrorDetailScene.tsx +72 -0
- package/src/scenes/ErrorDetailScene/index.ts +26 -0
- package/src/scenes/MethodScene/MethodScene.tsx +21 -7
- package/src/{components → scenes/MethodScene/components}/DocResponses/DocResponseTypes.tsx +3 -6
- package/src/scenes/MethodScene/components/DocResponses/DocResponses.spec.tsx +153 -0
- package/src/scenes/MethodScene/components/DocResponses/DocResponses.tsx +103 -0
- package/src/{components → scenes/MethodScene/components}/DocResponses/index.ts +0 -0
- package/src/{components → scenes/MethodScene/components}/DocResponses/utils.spec.ts +1 -1
- package/src/{components → scenes/MethodScene/components}/DocResponses/utils.ts +0 -0
- package/src/scenes/MethodScene/components/index.ts +1 -0
- package/src/scenes/MethodTagScene/MethodTagScene.spec.tsx +25 -14
- package/src/scenes/MethodTagScene/MethodTagScene.tsx +42 -11
- package/src/scenes/TypeScene/TypeScene.tsx +1 -1
- package/src/scenes/TypeTagScene/TypeTagScene.spec.tsx +21 -11
- package/src/scenes/TypeTagScene/TypeTagScene.tsx +44 -11
- package/src/scenes/index.ts +1 -0
- package/src/scenes/utils/hooks/index.ts +27 -0
- package/src/scenes/utils/hooks/tagStoreSync.spec.ts +102 -0
- package/src/scenes/utils/hooks/tagStoreSync.ts +68 -0
- package/src/scenes/utils/index.ts +27 -0
- package/src/state/settings/selectors.spec.ts +5 -1
- package/src/state/settings/selectors.ts +3 -0
- package/src/state/settings/slice.ts +6 -0
- package/src/test-data/index.ts +1 -0
- package/src/test-data/sdkLanguages.ts +36 -0
- package/src/utils/hooks/globalStoreSync.spec.tsx +146 -0
- package/src/utils/hooks/globalStoreSync.ts +77 -0
- package/src/utils/hooks/index.ts +28 -0
- package/src/utils/hooks/navigation.spec.ts +118 -0
- package/src/utils/hooks/navigation.ts +121 -0
- package/src/utils/hooks/useQuery.ts +36 -0
- package/src/utils/index.ts +2 -1
- package/src/utils/path.spec.ts +67 -1
- package/src/utils/path.ts +35 -0
- package/src/utils/sdkLanguage.spec.ts +69 -0
- package/src/utils/sdkLanguage.ts +63 -0
- package/lib/components/DocResponses/DocResponseTypes.js.map +0 -1
- package/lib/components/DocResponses/DocResponses.d.ts +0 -8
- package/lib/components/DocResponses/DocResponses.js +0 -46
- package/lib/components/DocResponses/DocResponses.js.map +0 -1
- package/lib/components/DocResponses/utils.js.map +0 -1
- package/lib/esm/components/DocResponses/DocResponseTypes.js.map +0 -1
- package/lib/esm/components/DocResponses/DocResponses.js +0 -30
- package/lib/esm/components/DocResponses/DocResponses.js.map +0 -1
- package/lib/esm/components/DocResponses/index.js.map +0 -1
- package/lib/esm/components/DocResponses/utils.js.map +0 -1
- package/lib/esm/utils/hooks.js +0 -26
- package/lib/esm/utils/hooks.js.map +0 -1
- package/lib/utils/hooks.d.ts +0 -3
- package/lib/utils/hooks.js +0 -36
- package/lib/utils/hooks.js.map +0 -1
- package/src/components/DocResponses/DocResponses.spec.tsx +0 -60
- package/src/components/DocResponses/DocResponses.tsx +0 -69
- package/src/utils/hooks.spec.ts +0 -78
package/lib/test-data/index.js
CHANGED
|
@@ -42,4 +42,18 @@ Object.keys(_declarations).forEach(function (key) {
|
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
|
+
|
|
46
|
+
var _sdkLanguages = require("./sdkLanguages");
|
|
47
|
+
|
|
48
|
+
Object.keys(_sdkLanguages).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
51
|
+
if (key in exports && exports[key] === _sdkLanguages[key]) return;
|
|
52
|
+
Object.defineProperty(exports, key, {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function get() {
|
|
55
|
+
return _sdkLanguages[key];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
45
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test-data/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAyBA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","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 * from './specs'\nexport { examples } from './examples'\nexport * from './declarations'\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/test-data/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAyBA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","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 * from './specs'\nexport { examples } from './examples'\nexport * from './declarations'\nexport * from './sdkLanguages'\n"],"file":"index.js"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.languages = exports.sdkLanguageMapping = void 0;
|
|
7
|
+
var sdkLanguageMapping = {
|
|
8
|
+
py: 'Python',
|
|
9
|
+
ts: 'TypeScript',
|
|
10
|
+
cs: 'C#',
|
|
11
|
+
kt: 'Kotlin',
|
|
12
|
+
swift: 'Swift',
|
|
13
|
+
go: 'Go',
|
|
14
|
+
all: 'All'
|
|
15
|
+
};
|
|
16
|
+
exports.sdkLanguageMapping = sdkLanguageMapping;
|
|
17
|
+
var languages = Object.values(sdkLanguageMapping);
|
|
18
|
+
exports.languages = languages;
|
|
19
|
+
//# sourceMappingURL=sdkLanguages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/test-data/sdkLanguages.ts"],"names":["sdkLanguageMapping","py","ts","cs","kt","swift","go","all","languages","Object","values"],"mappings":";;;;;;AAyBO,IAAMA,kBAAkB,GAAG;AAChCC,EAAAA,EAAE,EAAE,QAD4B;AAEhCC,EAAAA,EAAE,EAAE,YAF4B;AAGhCC,EAAAA,EAAE,EAAE,IAH4B;AAIhCC,EAAAA,EAAE,EAAE,QAJ4B;AAKhCC,EAAAA,KAAK,EAAE,OALyB;AAMhCC,EAAAA,EAAE,EAAE,IAN4B;AAOhCC,EAAAA,GAAG,EAAE;AAP2B,CAA3B;;AAUA,IAAMC,SAAS,GAAGC,MAAM,CAACC,MAAP,CAAcV,kBAAd,CAAlB","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 sdkLanguageMapping = {\n py: 'Python',\n ts: 'TypeScript',\n cs: 'C#',\n kt: 'Kotlin',\n swift: 'Swift',\n go: 'Go',\n all: 'All',\n}\n\nexport const languages = Object.values(sdkLanguageMapping)\n"],"file":"sdkLanguages.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useGlobalStoreSync: () => void;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useGlobalStoreSync = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactRouterDom = require("react-router-dom");
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
var _reactRedux = require("react-redux");
|
|
13
|
+
|
|
14
|
+
var _index = require("../index");
|
|
15
|
+
|
|
16
|
+
var _state = require("../../state");
|
|
17
|
+
|
|
18
|
+
var useGlobalStoreSync = () => {
|
|
19
|
+
var location = (0, _reactRouterDom.useLocation)();
|
|
20
|
+
var {
|
|
21
|
+
navigate
|
|
22
|
+
} = (0, _index.useNavigation)();
|
|
23
|
+
var {
|
|
24
|
+
setSdkLanguageAction,
|
|
25
|
+
setSearchPatternAction
|
|
26
|
+
} = (0, _state.useSettingActions)();
|
|
27
|
+
var {
|
|
28
|
+
initialized
|
|
29
|
+
} = (0, _state.useSettingStoreState)();
|
|
30
|
+
var selectedSdkLanguage = (0, _reactRedux.useSelector)(_state.selectSdkLanguage);
|
|
31
|
+
(0, _react.useEffect)(() => {
|
|
32
|
+
if (initialized) {
|
|
33
|
+
var params = new URLSearchParams(location.search);
|
|
34
|
+
var searchParam = params.get('s');
|
|
35
|
+
|
|
36
|
+
if (searchParam) {
|
|
37
|
+
setSearchPatternAction({
|
|
38
|
+
searchPattern: searchParam
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var sdkParam = params.get('sdk') || '';
|
|
43
|
+
var sdk = (0, _index.findSdk)(sdkParam);
|
|
44
|
+
var validSdkParam = !sdkParam.localeCompare(sdk.alias, 'en', {
|
|
45
|
+
sensitivity: 'base'
|
|
46
|
+
}) || !sdkParam.localeCompare(sdk.language, 'en', {
|
|
47
|
+
sensitivity: 'base'
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
if (validSdkParam) {
|
|
51
|
+
setSdkLanguageAction({
|
|
52
|
+
sdkLanguage: sdk.language
|
|
53
|
+
});
|
|
54
|
+
} else {
|
|
55
|
+
var {
|
|
56
|
+
alias
|
|
57
|
+
} = (0, _index.findSdk)(selectedSdkLanguage);
|
|
58
|
+
navigate(location.pathname, {
|
|
59
|
+
sdk: alias === _index.allAlias ? null : alias
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, [initialized]);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
exports.useGlobalStoreSync = useGlobalStoreSync;
|
|
67
|
+
//# sourceMappingURL=globalStoreSync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/hooks/globalStoreSync.ts"],"names":["useGlobalStoreSync","location","navigate","setSdkLanguageAction","setSearchPatternAction","initialized","selectedSdkLanguage","selectSdkLanguage","params","URLSearchParams","search","searchParam","get","searchPattern","sdkParam","sdk","validSdkParam","localeCompare","alias","sensitivity","language","sdkLanguage","pathname","allAlias"],"mappings":";;;;;;;AAyBA;;AACA;;AACA;;AACA;;AACA;;AAUO,IAAMA,kBAAkB,GAAG,MAAM;AACtC,MAAMC,QAAQ,GAAG,kCAAjB;AACA,MAAM;AAAEC,IAAAA;AAAF,MAAe,2BAArB;AACA,MAAM;AAAEC,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MAAmD,+BAAzD;AACA,MAAM;AAAEC,IAAAA;AAAF,MAAkB,kCAAxB;AACA,MAAMC,mBAAmB,GAAG,6BAAYC,wBAAZ,CAA5B;AAEA,wBAAU,MAAM;AACd,QAAIF,WAAJ,EAAiB;AACf,UAAMG,MAAM,GAAG,IAAIC,eAAJ,CAAoBR,QAAQ,CAACS,MAA7B,CAAf;AAGA,UAAMC,WAAW,GAAGH,MAAM,CAACI,GAAP,CAAW,GAAX,CAApB;;AACA,UAAID,WAAJ,EAAiB;AACfP,QAAAA,sBAAsB,CAAC;AACrBS,UAAAA,aAAa,EAAEF;AADM,SAAD,CAAtB;AAGD;;AAGD,UAAMG,QAAQ,GAAGN,MAAM,CAACI,GAAP,CAAW,KAAX,KAAqB,EAAtC;AACA,UAAMG,GAAG,GAAG,oBAAQD,QAAR,CAAZ;AACA,UAAME,aAAa,GACjB,CAACF,QAAQ,CAACG,aAAT,CAAuBF,GAAG,CAACG,KAA3B,EAAkC,IAAlC,EAAwC;AAAEC,QAAAA,WAAW,EAAE;AAAf,OAAxC,CAAD,IACA,CAACL,QAAQ,CAACG,aAAT,CAAuBF,GAAG,CAACK,QAA3B,EAAqC,IAArC,EAA2C;AAAED,QAAAA,WAAW,EAAE;AAAf,OAA3C,CAFH;;AAGA,UAAIH,aAAJ,EAAmB;AACjBb,QAAAA,oBAAoB,CAAC;AACnBkB,UAAAA,WAAW,EAAEN,GAAG,CAACK;AADE,SAAD,CAApB;AAGD,OAJD,MAIO;AACL,YAAM;AAAEF,UAAAA;AAAF,YAAY,oBAAQZ,mBAAR,CAAlB;AACAJ,QAAAA,QAAQ,CAACD,QAAQ,CAACqB,QAAV,EAAoB;AAC1BP,UAAAA,GAAG,EAAEG,KAAK,KAAKK,eAAV,GAAqB,IAArB,GAA4BL;AADP,SAApB,CAAR;AAGD;AACF;AACF,GA7BD,EA6BG,CAACb,WAAD,CA7BH;AA8BD,CArCM","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 */\nimport { useLocation } from 'react-router-dom'\nimport { useEffect } from 'react'\nimport { useSelector } from 'react-redux'\nimport { allAlias, findSdk, useNavigation } from '../index'\nimport {\n selectSdkLanguage,\n useSettingActions,\n useSettingStoreState,\n} from '../../state'\n\n/**\n * Hook for syncing global URL params with the Redux store\n * Global search parameters: 's', 'sdk'\n */\nexport const useGlobalStoreSync = () => {\n const location = useLocation()\n const { navigate } = useNavigation()\n const { setSdkLanguageAction, setSearchPatternAction } = useSettingActions()\n const { initialized } = useSettingStoreState()\n const selectedSdkLanguage = useSelector(selectSdkLanguage)\n\n useEffect(() => {\n if (initialized) {\n const params = new URLSearchParams(location.search)\n\n // syncing search query\n const searchParam = params.get('s')\n if (searchParam) {\n setSearchPatternAction({\n searchPattern: searchParam,\n })\n }\n\n // syncing SDK language selection\n const sdkParam = params.get('sdk') || ''\n const sdk = findSdk(sdkParam)\n const validSdkParam =\n !sdkParam.localeCompare(sdk.alias, 'en', { sensitivity: 'base' }) ||\n !sdkParam.localeCompare(sdk.language, 'en', { sensitivity: 'base' })\n if (validSdkParam) {\n setSdkLanguageAction({\n sdkLanguage: sdk.language,\n })\n } else {\n const { alias } = findSdk(selectedSdkLanguage)\n navigate(location.pathname, {\n sdk: alias === allAlias ? null : alias,\n })\n }\n }\n }, [initialized])\n}\n"],"file":"globalStoreSync.js"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "useNavigation", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _navigation.useNavigation;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "useGlobalStoreSync", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _globalStoreSync.useGlobalStoreSync;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "useQuery", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _useQuery.useQuery;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
var _navigation = require("./navigation");
|
|
26
|
+
|
|
27
|
+
var _globalStoreSync = require("./globalStoreSync");
|
|
28
|
+
|
|
29
|
+
var _useQuery = require("./useQuery");
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyBA;;AACA;;AACA","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 { useNavigation } from './navigation'\nexport { useGlobalStoreSync } from './globalStoreSync'\nexport { useQuery } from './useQuery'\n"],"file":"index.js"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface QueryParamProps {
|
|
2
|
+
s?: string | null;
|
|
3
|
+
sdk?: string | null;
|
|
4
|
+
t?: string | null;
|
|
5
|
+
}
|
|
6
|
+
export declare const useNavigation: () => {
|
|
7
|
+
navigate: (path: string, queryParams?: QueryParamProps | null | undefined) => void;
|
|
8
|
+
navigateWithGlobalParams: (path: string) => void;
|
|
9
|
+
buildPathWithGlobalParams: (path: string, otherParams?: {}) => string;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useNavigation = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactRouterDom = require("react-router-dom");
|
|
9
|
+
|
|
10
|
+
var GLOBAL_PARAMS = ['s', 'sdk'];
|
|
11
|
+
|
|
12
|
+
var useNavigation = () => {
|
|
13
|
+
var history = (0, _reactRouterDom.useHistory)();
|
|
14
|
+
|
|
15
|
+
var navigate = (path, queryParams) => {
|
|
16
|
+
var urlParams = new URLSearchParams(history.location.search);
|
|
17
|
+
|
|
18
|
+
if (queryParams === undefined) {
|
|
19
|
+
history.push({
|
|
20
|
+
pathname: path,
|
|
21
|
+
search: urlParams.toString()
|
|
22
|
+
});
|
|
23
|
+
} else if (queryParams === null) {
|
|
24
|
+
history.push({
|
|
25
|
+
pathname: path
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
Object.keys(queryParams).forEach(key => {
|
|
29
|
+
if (queryParams[key] === null || queryParams[key] === '') {
|
|
30
|
+
urlParams.delete(key);
|
|
31
|
+
} else {
|
|
32
|
+
urlParams.set(key, queryParams[key]);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
history.push({
|
|
36
|
+
pathname: path,
|
|
37
|
+
search: urlParams.toString()
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var buildPathWithGlobalParams = function buildPathWithGlobalParams(path) {
|
|
43
|
+
var otherParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
44
|
+
var params = new URLSearchParams(history.location.search);
|
|
45
|
+
|
|
46
|
+
for (var key of params.keys()) {
|
|
47
|
+
if (!GLOBAL_PARAMS.includes(key)) {
|
|
48
|
+
params.delete(key);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var globalParams = params.toString();
|
|
53
|
+
var additionalParams = '';
|
|
54
|
+
Object.entries(otherParams).forEach(_ref => {
|
|
55
|
+
var [key, value] = _ref;
|
|
56
|
+
additionalParams += "".concat(key, "=").concat(value);
|
|
57
|
+
});
|
|
58
|
+
var queryString = '';
|
|
59
|
+
|
|
60
|
+
if (globalParams) {
|
|
61
|
+
queryString = globalParams;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (additionalParams) {
|
|
65
|
+
queryString += globalParams ? "&".concat(additionalParams) : additionalParams;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return "".concat(path).concat(queryString ? "?".concat(queryString) : '');
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var navigateWithGlobalParams = path => {
|
|
72
|
+
history.push(buildPathWithGlobalParams(path));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
navigate,
|
|
77
|
+
navigateWithGlobalParams,
|
|
78
|
+
buildPathWithGlobalParams
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
exports.useNavigation = useNavigation;
|
|
83
|
+
//# sourceMappingURL=navigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/hooks/navigation.ts"],"names":["GLOBAL_PARAMS","useNavigation","history","navigate","path","queryParams","urlParams","URLSearchParams","location","search","undefined","push","pathname","toString","Object","keys","forEach","key","delete","set","buildPathWithGlobalParams","otherParams","params","includes","globalParams","additionalParams","entries","value","queryString","navigateWithGlobalParams"],"mappings":";;;;;;;AAyBA;;AAEA,IAAMA,aAAa,GAAG,CAAC,GAAD,EAAM,KAAN,CAAtB;;AAcO,IAAMC,aAAa,GAAG,MAAM;AACjC,MAAMC,OAAO,GAAG,iCAAhB;;AAQA,MAAMC,QAAQ,GAAG,CAACC,IAAD,EAAeC,WAAf,KAAwD;AACvE,QAAMC,SAAS,GAAG,IAAIC,eAAJ,CAAoBL,OAAO,CAACM,QAAR,CAAiBC,MAArC,CAAlB;;AAEA,QAAIJ,WAAW,KAAKK,SAApB,EAA+B;AAE7BR,MAAAA,OAAO,CAACS,IAAR,CAAa;AAAEC,QAAAA,QAAQ,EAAER,IAAZ;AAAkBK,QAAAA,MAAM,EAAEH,SAAS,CAACO,QAAV;AAA1B,OAAb;AACD,KAHD,MAGO,IAAIR,WAAW,KAAK,IAApB,EAA0B;AAE/BH,MAAAA,OAAO,CAACS,IAAR,CAAa;AAAEC,QAAAA,QAAQ,EAAER;AAAZ,OAAb;AACD,KAHM,MAGA;AAELU,MAAAA,MAAM,CAACC,IAAP,CAAYV,WAAZ,EAAyBW,OAAzB,CAAkCC,GAAD,IAAS;AACxC,YAAIZ,WAAW,CAACY,GAAD,CAAX,KAAqB,IAArB,IAA6BZ,WAAW,CAACY,GAAD,CAAX,KAAqB,EAAtD,EAA0D;AACxDX,UAAAA,SAAS,CAACY,MAAV,CAAiBD,GAAjB;AACD,SAFD,MAEO;AACLX,UAAAA,SAAS,CAACa,GAAV,CAAcF,GAAd,EAAmBZ,WAAW,CAACY,GAAD,CAA9B;AACD;AACF,OAND;AAOAf,MAAAA,OAAO,CAACS,IAAR,CAAa;AAAEC,QAAAA,QAAQ,EAAER,IAAZ;AAAkBK,QAAAA,MAAM,EAAEH,SAAS,CAACO,QAAV;AAA1B,OAAb;AACD;AACF,GApBD;;AA6BA,MAAMO,yBAAyB,GAAG,SAA5BA,yBAA4B,CAAChB,IAAD,EAAoC;AAAA,QAArBiB,WAAqB,uEAAP,EAAO;AACpE,QAAMC,MAAM,GAAG,IAAIf,eAAJ,CAAoBL,OAAO,CAACM,QAAR,CAAiBC,MAArC,CAAf;;AAEA,SAAK,IAAMQ,GAAX,IAAkBK,MAAM,CAACP,IAAP,EAAlB,EAAiC;AAC/B,UAAI,CAACf,aAAa,CAACuB,QAAd,CAAuBN,GAAvB,CAAL,EAAkC;AAChCK,QAAAA,MAAM,CAACJ,MAAP,CAAcD,GAAd;AACD;AACF;;AACD,QAAMO,YAAY,GAAGF,MAAM,CAACT,QAAP,EAArB;AAEA,QAAIY,gBAAgB,GAAG,EAAvB;AACAX,IAAAA,MAAM,CAACY,OAAP,CAAeL,WAAf,EAA4BL,OAA5B,CAAoC,QAAkB;AAAA,UAAjB,CAACC,GAAD,EAAMU,KAAN,CAAiB;AACpDF,MAAAA,gBAAgB,cAAOR,GAAP,cAAcU,KAAd,CAAhB;AACD,KAFD;AAIA,QAAIC,WAAW,GAAG,EAAlB;;AACA,QAAIJ,YAAJ,EAAkB;AAChBI,MAAAA,WAAW,GAAGJ,YAAd;AACD;;AAED,QAAIC,gBAAJ,EAAsB;AACpBG,MAAAA,WAAW,IAAIJ,YAAY,cAAOC,gBAAP,IAA4BA,gBAAvD;AACD;;AAED,qBAAUrB,IAAV,SAAiBwB,WAAW,cAAOA,WAAP,IAAuB,EAAnD;AACD,GAzBD;;AAgCA,MAAMC,wBAAwB,GAAIzB,IAAD,IAAkB;AACjDF,IAAAA,OAAO,CAACS,IAAR,CAAaS,yBAAyB,CAAChB,IAAD,CAAtC;AACD,GAFD;;AAIA,SAAO;AACLD,IAAAA,QADK;AAEL0B,IAAAA,wBAFK;AAGLT,IAAAA;AAHK,GAAP;AAKD,CA/EM","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 */\nimport { useHistory } from 'react-router-dom'\n\nconst GLOBAL_PARAMS = ['s', 'sdk']\n\ninterface QueryParamProps {\n /** Search Query **/\n s?: string | null\n /** Chosen SDK Language **/\n sdk?: string | null\n /** Tag Scene Filter **/\n t?: string | null\n}\n\n/**\n * Hook for navigating to given route with query params\n */\nexport const useNavigation = () => {\n const history = useHistory()\n\n /**\n * Navigates to path including provided search parameters\n *\n * @param path Pathname to navigate to\n * @param queryParams Hash of query param name/value pairs to include in the destination url\n */\n const navigate = (path: string, queryParams?: QueryParamProps | null) => {\n const urlParams = new URLSearchParams(history.location.search)\n\n if (queryParams === undefined) {\n // if params passed in is undefined, maintain existing parameters in the URL\n history.push({ pathname: path, search: urlParams.toString() })\n } else if (queryParams === null) {\n // if params passed in is null, remove all parameters from the URL\n history.push({ pathname: path })\n } else {\n // push each key as new param to URL, excluding entries with value null\n Object.keys(queryParams).forEach((key) => {\n if (queryParams[key] === null || queryParams[key] === '') {\n urlParams.delete(key)\n } else {\n urlParams.set(key, queryParams[key])\n }\n })\n history.push({ pathname: path, search: urlParams.toString() })\n }\n }\n\n /**\n * Builds path to a scene and removes any scene-specific URL parameters\n *\n * @param path the destination path\n * @param otherParams other query parameters to append to url\n * @returns a path excluding scene-specific search parameters\n */\n const buildPathWithGlobalParams = (path: string, otherParams = {}) => {\n const params = new URLSearchParams(history.location.search)\n\n for (const key of params.keys()) {\n if (!GLOBAL_PARAMS.includes(key)) {\n params.delete(key)\n }\n }\n const globalParams = params.toString()\n\n let additionalParams = ''\n Object.entries(otherParams).forEach(([key, value]) => {\n additionalParams += `${key}=${value}`\n })\n\n let queryString = ''\n if (globalParams) {\n queryString = globalParams\n }\n\n if (additionalParams) {\n queryString += globalParams ? `&${additionalParams}` : additionalParams\n }\n\n return `${path}${queryString ? `?${queryString}` : ''}`\n }\n\n /**\n * Navigates to a scene removing any scene-specific URL parameters\n *\n * @param path Pathname to navigate to\n */\n const navigateWithGlobalParams = (path: string) => {\n history.push(buildPathWithGlobalParams(path))\n }\n\n return {\n navigate,\n navigateWithGlobalParams,\n buildPathWithGlobalParams,\n }\n}\n"],"file":"navigation.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useQuery: () => URLSearchParams;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useQuery = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _reactRouterDom = require("react-router-dom");
|
|
11
|
+
|
|
12
|
+
var useQuery = () => {
|
|
13
|
+
var {
|
|
14
|
+
search
|
|
15
|
+
} = (0, _reactRouterDom.useLocation)();
|
|
16
|
+
return (0, _react.useMemo)(() => new URLSearchParams(search), [search]);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.useQuery = useQuery;
|
|
20
|
+
//# sourceMappingURL=useQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/hooks/useQuery.ts"],"names":["useQuery","search","URLSearchParams"],"mappings":";;;;;;;AAyBA;;AACA;;AAKO,IAAMA,QAAQ,GAAG,MAAM;AAC5B,MAAM;AAAEC,IAAAA;AAAF,MAAa,kCAAnB;AAEA,SAAO,oBAAQ,MAAM,IAAIC,eAAJ,CAAoBD,MAApB,CAAd,EAA2C,CAACA,MAAD,CAA3C,CAAP;AACD,CAJM","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 */\nimport { useMemo } from 'react'\nimport { useLocation } from 'react-router-dom'\n\n/**\n * Hook for retrieving query params\n */\nexport const useQuery = () => {\n const { search } = useLocation()\n\n return useMemo(() => new URLSearchParams(search), [search])\n}\n"],"file":"useQuery.js"}
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { highlightHTML } from './highlight';
|
|
2
2
|
export * from './path';
|
|
3
|
+
export * from './sdkLanguage';
|
|
3
4
|
export { getLoded } from './lodeUtils';
|
|
4
5
|
export { useWindowSize } from './useWindowSize';
|
|
5
6
|
export * from './apixAdaptor';
|
|
6
7
|
export * from './adaptorUtils';
|
|
7
|
-
export { useNavigation } from './hooks';
|
|
8
|
+
export { useNavigation, useGlobalStoreSync, useQuery } from './hooks';
|
package/lib/utils/index.js
CHANGED
|
@@ -7,7 +7,9 @@ var _exportNames = {
|
|
|
7
7
|
highlightHTML: true,
|
|
8
8
|
getLoded: true,
|
|
9
9
|
useWindowSize: true,
|
|
10
|
-
useNavigation: true
|
|
10
|
+
useNavigation: true,
|
|
11
|
+
useGlobalStoreSync: true,
|
|
12
|
+
useQuery: true
|
|
11
13
|
};
|
|
12
14
|
Object.defineProperty(exports, "highlightHTML", {
|
|
13
15
|
enumerable: true,
|
|
@@ -33,6 +35,18 @@ Object.defineProperty(exports, "useNavigation", {
|
|
|
33
35
|
return _hooks.useNavigation;
|
|
34
36
|
}
|
|
35
37
|
});
|
|
38
|
+
Object.defineProperty(exports, "useGlobalStoreSync", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _hooks.useGlobalStoreSync;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "useQuery", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function get() {
|
|
47
|
+
return _hooks.useQuery;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
36
50
|
|
|
37
51
|
var _highlight = require("./highlight");
|
|
38
52
|
|
|
@@ -50,6 +64,20 @@ Object.keys(_path).forEach(function (key) {
|
|
|
50
64
|
});
|
|
51
65
|
});
|
|
52
66
|
|
|
67
|
+
var _sdkLanguage = require("./sdkLanguage");
|
|
68
|
+
|
|
69
|
+
Object.keys(_sdkLanguage).forEach(function (key) {
|
|
70
|
+
if (key === "default" || key === "__esModule") return;
|
|
71
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
72
|
+
if (key in exports && exports[key] === _sdkLanguage[key]) return;
|
|
73
|
+
Object.defineProperty(exports, key, {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function get() {
|
|
76
|
+
return _sdkLanguage[key];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
53
81
|
var _lodeUtils = require("./lodeUtils");
|
|
54
82
|
|
|
55
83
|
var _useWindowSize = require("./useWindowSize");
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA","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 { highlightHTML } from './highlight'\nexport * from './path'\nexport * from './sdkLanguage'\nexport { getLoded } from './lodeUtils'\nexport { useWindowSize } from './useWindowSize'\nexport * from './apixAdaptor'\nexport * from './adaptorUtils'\nexport { useNavigation, useGlobalStoreSync, useQuery } from './hooks'\n"],"file":"index.js"}
|
package/lib/utils/path.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ApiModel, IMethod, IType } from '@looker/sdk-codegen';
|
|
2
2
|
import type { Location as HLocation } from 'history';
|
|
3
|
+
export declare const methodFilterOptions: RegExp;
|
|
4
|
+
export declare const typeFilterOptions: RegExp;
|
|
3
5
|
export declare const buildMethodPath: (specKey: string, tag: string, methodName: string, params?: string | undefined) => string;
|
|
4
6
|
export declare const buildTypePath: (specKey: string, tag: string, typeName: string, params?: string | undefined) => string;
|
|
5
7
|
export declare const diffPath = "diff";
|
|
@@ -7,3 +9,5 @@ export declare const oAuthPath = "oauth";
|
|
|
7
9
|
export declare const isMethod: (item: IMethod | IType) => boolean;
|
|
8
10
|
export declare const buildPath: (api: ApiModel, item: IMethod | IType, specKey: string) => string;
|
|
9
11
|
export declare const getSpecKey: (location: HLocation | Location) => string | null;
|
|
12
|
+
export declare const getSceneType: (path: string) => string;
|
|
13
|
+
export declare const isValidFilter: (path: string, filter: string) => boolean;
|
package/lib/utils/path.js
CHANGED
|
@@ -3,16 +3,23 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getSpecKey = exports.buildPath = exports.isMethod = exports.oAuthPath = exports.diffPath = exports.buildTypePath = exports.buildMethodPath = void 0;
|
|
6
|
+
exports.isValidFilter = exports.getSceneType = exports.getSpecKey = exports.buildPath = exports.isMethod = exports.oAuthPath = exports.diffPath = exports.buildTypePath = exports.buildMethodPath = exports.typeFilterOptions = exports.methodFilterOptions = void 0;
|
|
7
7
|
|
|
8
8
|
var _sdkCodegen = require("@looker/sdk-codegen");
|
|
9
9
|
|
|
10
|
+
var _reactRouter = require("react-router");
|
|
11
|
+
|
|
10
12
|
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, undefined, groups); }; var _super = RegExp.prototype; var _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); _groups.set(_this, groups || _groups.get(re)); return _setPrototypeOf(_this, BabelRegExp.prototype); } _inherits(BabelRegExp, RegExp); BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) result.groups = buildGroups(result, this); return result; }; BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if (typeof substitution === "string") { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } else if (typeof substitution === "function") { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; if (typeof args[args.length - 1] !== "object") { args = [].slice.call(args); args.push(buildGroups(args, _this)); } return substitution.apply(this, args); }); } else { return _super[Symbol.replace].call(this, str, substitution); } }; function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { groups[name] = result[g[name]]; return groups; }, Object.create(null)); } return _wrapRegExp.apply(this, arguments); }
|
|
11
13
|
|
|
12
14
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
13
15
|
|
|
14
16
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
17
|
|
|
18
|
+
var methodFilterOptions = /GET$|POST$|PUT$|PATCH$|DELETE$/i;
|
|
19
|
+
exports.methodFilterOptions = methodFilterOptions;
|
|
20
|
+
var typeFilterOptions = /SPECIFICATION$|WRITE$|REQUEST$|ENUMERATED$/i;
|
|
21
|
+
exports.typeFilterOptions = typeFilterOptions;
|
|
22
|
+
|
|
16
23
|
var buildMethodPath = (specKey, tag, methodName, params) => "/".concat(specKey, "/methods/").concat(tag, "/").concat(methodName).concat(params ? "?".concat(params) : '');
|
|
17
24
|
|
|
18
25
|
exports.buildMethodPath = buildMethodPath;
|
|
@@ -80,4 +87,28 @@ var getSpecKey = location => {
|
|
|
80
87
|
};
|
|
81
88
|
|
|
82
89
|
exports.getSpecKey = getSpecKey;
|
|
90
|
+
|
|
91
|
+
var getSceneType = path => {
|
|
92
|
+
var match = (0, _reactRouter.matchPath)(path, {
|
|
93
|
+
path: '/:specKey/:tagType'
|
|
94
|
+
});
|
|
95
|
+
return match ? match.params.tagType : '';
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.getSceneType = getSceneType;
|
|
99
|
+
|
|
100
|
+
var isValidFilter = (path, filter) => {
|
|
101
|
+
var isValid;
|
|
102
|
+
var sceneType = getSceneType(path);
|
|
103
|
+
if (!sceneType) isValid = false;else if (!filter.localeCompare('all', 'en', {
|
|
104
|
+
sensitivity: 'base'
|
|
105
|
+
})) isValid = true;else if (sceneType === 'methods') {
|
|
106
|
+
isValid = methodFilterOptions.test(filter);
|
|
107
|
+
} else {
|
|
108
|
+
isValid = typeFilterOptions.test(filter);
|
|
109
|
+
}
|
|
110
|
+
return isValid;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
exports.isValidFilter = isValidFilter;
|
|
83
114
|
//# sourceMappingURL=path.js.map
|
package/lib/utils/path.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/path.ts"],"names":["buildMethodPath","specKey","tag","methodName","params","buildTypePath","typeName","diffPath","oAuthPath","getMethodTag","api","Object","entries","tags","filter","methods","map","methodTag","isMethod","item","getTypeTag","type","method","name","buildPath","path","getSpecKey","location","pathname","match","startsWith","pattern","RegExp","groups"],"mappings":";;;;;;;AA2BA;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../src/utils/path.ts"],"names":["methodFilterOptions","typeFilterOptions","buildMethodPath","specKey","tag","methodName","params","buildTypePath","typeName","diffPath","oAuthPath","getMethodTag","api","Object","entries","tags","filter","methods","map","methodTag","isMethod","item","getTypeTag","type","method","name","buildPath","path","getSpecKey","location","pathname","match","startsWith","pattern","RegExp","groups","getSceneType","tagType","isValidFilter","isValid","sceneType","localeCompare","sensitivity","test"],"mappings":";;;;;;;AA2BA;;AAEA;;;;;;;;AAEO,IAAMA,mBAAmB,GAAG,iCAA5B;;AACA,IAAMC,iBAAiB,GAAG,6CAA1B;;;AAUA,IAAMC,eAAe,GAAG,CAC7BC,OAD6B,EAE7BC,GAF6B,EAG7BC,UAH6B,EAI7BC,MAJ6B,gBAKtBH,OALsB,sBAKHC,GALG,cAKIC,UALJ,SAKiBC,MAAM,cAAOA,MAAP,IAAkB,EALzC,CAAxB;;;;AAeA,IAAMC,aAAa,GAAG,CAC3BJ,OAD2B,EAE3BC,GAF2B,EAG3BI,QAH2B,EAI3BF,MAJ2B,gBAKpBH,OALoB,oBAKHC,GALG,cAKII,QALJ,SAKeF,MAAM,cAAOA,MAAP,IAAkB,EALvC,CAAtB;;;AAOA,IAAMG,QAAQ,GAAG,MAAjB;;AACA,IAAMC,SAAS,GAAG,OAAlB;;;AAQP,IAAMC,YAAY,GAAG,CAACC,GAAD,EAAgBP,UAAhB,KAAuC;AAE1D,SAAOQ,MAAM,CAACC,OAAP,CAAeF,GAAG,CAACG,IAAnB,EACJC,MADI,CACG;AAAA,QAAC,GAAGC,OAAH,CAAD;AAAA,WAAiBZ,UAAU,IAAIY,OAA/B;AAAA,GADH,EAEJC,GAFI,CAEA;AAAA,QAAC,CAACC,SAAD,CAAD;AAAA,WAAiBA,SAAjB;AAAA,GAFA,EAE4B,CAF5B,CAAP;AAGD,CALD;;AAWO,IAAMC,QAAQ,GAAIC,IAAD,IAA2B,YAAYA,IAAxD;;;;AAOP,IAAMC,UAAU,GAAG,CAACV,GAAD,EAAgBW,IAAhB,KAAgC;AACjD,MAAMC,MAAM,GAAG,gCAAeZ,GAAf,EAAoBW,IAApB,CAAf;AACA,SAAOZ,YAAY,CAACC,GAAD,EAAMY,MAAM,CAACC,IAAb,CAAnB;AACD,CAHD;;AAYO,IAAMC,SAAS,GAAG,CACvBd,GADuB,EAEvBS,IAFuB,EAGvBlB,OAHuB,KAIpB;AACH,MAAIwB,IAAJ;;AACA,MAAIP,QAAQ,CAACC,IAAD,CAAZ,EAAoB;AAClB,QAAMjB,GAAG,GAAGO,YAAY,CAACC,GAAD,EAAMS,IAAI,CAACI,IAAX,CAAxB;AACAE,IAAAA,IAAI,GAAGzB,eAAe,CAACC,OAAD,EAAUC,GAAV,EAAeiB,IAAI,CAACI,IAApB,CAAtB;AACD,GAHD,MAGO;AACL,QAAMrB,IAAG,GAAGkB,UAAU,CAACV,GAAD,EAAMS,IAAN,CAAtB;;AACAM,IAAAA,IAAI,GAAGpB,aAAa,CAACJ,OAAD,EAAUC,IAAV,EAAeiB,IAAI,CAACI,IAApB,CAApB;AACD;;AACD,SAAOE,IAAP;AACD,CAdM;;;;AAoBA,IAAMC,UAAU,GAAIC,QAAD,IAAmD;AAAA;;AAC3E,MAAMC,QAAQ,GAAGD,QAAQ,CAACC,QAA1B;AACA,MAAIC,KAAJ;;AACA,MAAID,QAAQ,CAACE,UAAT,YAAwBvB,QAAxB,EAAJ,EAAyC;AACvC,QAAMwB,OAAO,GAAG,IAAIC,MAAJ,eAAkBzB,QAAlB,6BAAhB;AACAsB,IAAAA,KAAK,GAAGD,QAAQ,CAACC,KAAT,CAAeE,OAAf,CAAR;AACD,GAHD,MAGO;AACLF,IAAAA,KAAK,GAAGD,QAAQ,CAACC,KAAT,aAAe,oCAAf;AAAA;AAAA,OAAR;AACD;;AACD,SAAO,WAAAA,KAAK,UAAL,yDAAOI,MAAP,gEAAehC,OAAf,KAA0B,IAAjC;AACD,CAVM;;;;AAiBA,IAAMiC,YAAY,GAAIT,IAAD,IAAkB;AAC5C,MAAMI,KAAK,GAAG,4BAA+BJ,IAA/B,EAAqC;AACjDA,IAAAA,IAAI,EAAE;AAD2C,GAArC,CAAd;AAGA,SAAOI,KAAK,GAAGA,KAAK,CAAEzB,MAAP,CAAc+B,OAAjB,GAA2B,EAAvC;AACD,CALM;;;;AAYA,IAAMC,aAAa,GAAG,CAACX,IAAD,EAAeX,MAAf,KAAkC;AAC7D,MAAIuB,OAAJ;AACA,MAAMC,SAAS,GAAGJ,YAAY,CAACT,IAAD,CAA9B;AACA,MAAI,CAACa,SAAL,EAAgBD,OAAO,GAAG,KAAV,CAAhB,KACK,IAAI,CAACvB,MAAM,CAACyB,aAAP,CAAqB,KAArB,EAA4B,IAA5B,EAAkC;AAAEC,IAAAA,WAAW,EAAE;AAAf,GAAlC,CAAL,EACHH,OAAO,GAAG,IAAV,CADG,KAEA,IAAIC,SAAS,KAAK,SAAlB,EAA6B;AAChCD,IAAAA,OAAO,GAAGvC,mBAAmB,CAAC2C,IAApB,CAAyB3B,MAAzB,CAAV;AACD,GAFI,MAEE;AACLuB,IAAAA,OAAO,GAAGtC,iBAAiB,CAAC0C,IAAlB,CAAuB3B,MAAvB,CAAV;AACD;AACD,SAAOuB,OAAP;AACD,CAZM","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 { ApiModel, IMethod, IType } from '@looker/sdk-codegen'\nimport { firstMethodRef } from '@looker/sdk-codegen'\nimport type { Location as HLocation } from 'history'\nimport { matchPath } from 'react-router'\n\nexport const methodFilterOptions = /GET$|POST$|PUT$|PATCH$|DELETE$/i\nexport const typeFilterOptions = /SPECIFICATION$|WRITE$|REQUEST$|ENUMERATED$/i\n\n/**\n * Builds a path matching the route used by MethodScene\n * @param specKey A string to identify the spec in the URL\n * @param tag Corresponding method tag\n * @param methodName A method name\n * @param params Hash of query param name/value pairs to include in the destination url\n * @returns a Method path\n */\nexport const buildMethodPath = (\n specKey: string,\n tag: string,\n methodName: string,\n params?: string\n) => `/${specKey}/methods/${tag}/${methodName}${params ? `?${params}` : ''}`\n\n/**\n * Builds a path matching the route used by TypeScene\n * @param specKey A string to identify the spec in the URL\n * @param tag Corresponding type tag\n * @param typeName A type name\n * @param params Hash of query param name/value pairs to include in the destination url\n * @returns a Type path\n */\nexport const buildTypePath = (\n specKey: string,\n tag: string,\n typeName: string,\n params?: string\n) => `/${specKey}/types/${tag}/${typeName}${params ? `?${params}` : ''}`\n\nexport const diffPath = 'diff'\nexport const oAuthPath = 'oauth'\n\n/**\n * Returns the tag for a given method name\n * @param api Parsed api\n * @param methodName SDK method name\n * @returns Corresponding tag\n */\nconst getMethodTag = (api: ApiModel, methodName: string) => {\n // Find tag containing methodName\n return Object.entries(api.tags)\n .filter(([, methods]) => methodName in methods)\n .map(([methodTag]) => methodTag)[0]\n}\n\n/**\n * Is this item a method? Check without requiring `instanceof Method`\n * @param item to check for method or type\n */\nexport const isMethod = (item: IMethod | IType) => 'params' in item\n\n/**\n * Return the tag for a give type\n * @param api Parsed api\n * @param type to tag\n */\nconst getTypeTag = (api: ApiModel, type: IType) => {\n const method = firstMethodRef(api, type)\n return getMethodTag(api, method.name)\n}\n\n/**\n * Builds a path matching MethodScene or TypeScene route\n * @param api parsed api\n * @param item A method or type item\n * @param specKey A string to identify the spec in the url\n * @returns a method or type path\n */\nexport const buildPath = (\n api: ApiModel,\n item: IMethod | IType,\n specKey: string\n) => {\n let path\n if (isMethod(item)) {\n const tag = getMethodTag(api, item.name)\n path = buildMethodPath(specKey, tag, item.name)\n } else {\n const tag = getTypeTag(api, item as IType)\n path = buildTypePath(specKey, tag, item.name)\n }\n return path\n}\n\n/**\n * Determine API specification keys from URL pattern\n * @param location service to examine\n */\nexport const getSpecKey = (location: HLocation | Location): string | null => {\n const pathname = location.pathname\n let match\n if (pathname.startsWith(`/${diffPath}`)) {\n const pattern = new RegExp(`(?:/${diffPath})/(?<specKey>\\\\w+.\\\\w+)`)\n match = pathname.match(pattern)\n } else {\n match = pathname.match(/\\/(?<specKey>\\w+\\.\\w+).*/)\n }\n return match?.groups?.specKey || null\n}\n\n/**\n * Gets the scene type of the current page\n * @param path path of browser location\n * @returns string representing the scene type\n */\nexport const getSceneType = (path: string) => {\n const match = matchPath<{ tagType: string }>(path, {\n path: '/:specKey/:tagType',\n })\n return match ? match!.params.tagType : ''\n}\n\n/**\n * Confirms if filter is valid for a given method/type tag\n * @param path browser location pathname\n * @param filter filter tag for page\n */\nexport const isValidFilter = (path: string, filter: string) => {\n let isValid\n const sceneType = getSceneType(path)\n if (!sceneType) isValid = false\n else if (!filter.localeCompare('all', 'en', { sensitivity: 'base' }))\n isValid = true\n else if (sceneType === 'methods') {\n isValid = methodFilterOptions.test(filter)\n } else {\n isValid = typeFilterOptions.test(filter)\n }\n return isValid\n}\n"],"file":"path.js"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.findSdk = exports.allSdkLanguages = exports.allAlias = void 0;
|
|
7
|
+
|
|
8
|
+
var _sdkCodegen = require("@looker/sdk-codegen");
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
var allAlias = 'all';
|
|
17
|
+
exports.allAlias = allAlias;
|
|
18
|
+
|
|
19
|
+
var allSdkLanguages = () => {
|
|
20
|
+
var languages = {};
|
|
21
|
+
|
|
22
|
+
_sdkCodegen.codeGenerators.forEach(gen => {
|
|
23
|
+
var alias = gen.extension.toString().match(/\.(\w+)\b/)[1];
|
|
24
|
+
languages[alias] = gen.language;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return _objectSpread(_objectSpread({}, languages), {}, {
|
|
28
|
+
[allAlias]: 'All'
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.allSdkLanguages = allSdkLanguages;
|
|
33
|
+
|
|
34
|
+
var findSdk = label => {
|
|
35
|
+
var languages = allSdkLanguages();
|
|
36
|
+
var match = {
|
|
37
|
+
alias: allAlias,
|
|
38
|
+
language: languages[allAlias]
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
for (var [alias, language] of Object.entries(languages)) {
|
|
42
|
+
if (!label.localeCompare(alias, 'en', {
|
|
43
|
+
sensitivity: 'base'
|
|
44
|
+
}) || !label.localeCompare(language, 'en', {
|
|
45
|
+
sensitivity: 'base'
|
|
46
|
+
})) {
|
|
47
|
+
match = {
|
|
48
|
+
alias,
|
|
49
|
+
language
|
|
50
|
+
};
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return match;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
exports.findSdk = findSdk;
|
|
59
|
+
//# sourceMappingURL=sdkLanguage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/sdkLanguage.ts"],"names":["allAlias","allSdkLanguages","languages","codeGenerators","forEach","gen","alias","extension","toString","match","language","findSdk","label","Object","entries","localeCompare","sensitivity"],"mappings":";;;;;;;AA0BA;;;;;;;;AAEO,IAAMA,QAAQ,GAAG,KAAjB;;;AAMA,IAAMC,eAAe,GAAG,MAA8B;AAC3D,MAAMC,SAAS,GAAG,EAAlB;;AACAC,6BAAeC,OAAf,CAAwBC,GAAD,IAAS;AAC9B,QAAMC,KAAK,GAAGD,GAAG,CAACE,SAAJ,CAAcC,QAAd,GAAyBC,KAAzB,CAA+B,WAA/B,EAA6C,CAA7C,CAAd;AACAP,IAAAA,SAAS,CAACI,KAAD,CAAT,GAAmBD,GAAG,CAACK,QAAvB;AACD,GAHD;;AAKA,yCAAYR,SAAZ;AAAuB,KAACF,QAAD,GAAY;AAAnC;AACD,CARM;;;;AAeA,IAAMW,OAAO,GAAIC,KAAD,IAAmB;AACxC,MAAMV,SAAS,GAAGD,eAAe,EAAjC;AACA,MAAIQ,KAAK,GAAG;AAAEH,IAAAA,KAAK,EAAEN,QAAT;AAAmBU,IAAAA,QAAQ,EAAER,SAAS,CAACF,QAAD;AAAtC,GAAZ;;AACA,OAAK,IAAM,CAACM,KAAD,EAAQI,QAAR,CAAX,IAAgCG,MAAM,CAACC,OAAP,CAAeZ,SAAf,CAAhC,EAA2D;AACzD,QACE,CAACU,KAAK,CAACG,aAAN,CAAoBT,KAApB,EAA2B,IAA3B,EAAiC;AAAEU,MAAAA,WAAW,EAAE;AAAf,KAAjC,CAAD,IACA,CAACJ,KAAK,CAACG,aAAN,CAAoBL,QAApB,EAA8B,IAA9B,EAAoC;AAAEM,MAAAA,WAAW,EAAE;AAAf,KAApC,CAFH,EAGE;AACAP,MAAAA,KAAK,GAAG;AAAEH,QAAAA,KAAF;AAASI,QAAAA;AAAT,OAAR;AACA;AACD;AACF;;AACD,SAAOD,KAAP;AACD,CAbM","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 { codeGenerators } from '@looker/sdk-codegen'\n\nexport const allAlias = 'all'\n\n/**\n * Gets all supported sdk languages\n * @returns mapping of sdk language aliases to name\n */\nexport const allSdkLanguages = (): Record<string, string> => {\n const languages = {}\n codeGenerators.forEach((gen) => {\n const alias = gen.extension.toString().match(/\\.(\\w+)\\b/)![1]\n languages[alias] = gen.language\n })\n\n return { ...languages, [allAlias]: 'All' }\n}\n\n/**\n * Searches for sdk language details given label\n * @param label label to search by\n * @returns language name and alias\n */\nexport const findSdk = (label: string) => {\n const languages = allSdkLanguages()\n let match = { alias: allAlias, language: languages[allAlias] }\n for (const [alias, language] of Object.entries(languages)) {\n if (\n !label.localeCompare(alias, 'en', { sensitivity: 'base' }) ||\n !label.localeCompare(language, 'en', { sensitivity: 'base' })\n ) {\n match = { alias, language }\n break\n }\n }\n return match\n}\n"],"file":"sdkLanguage.js"}
|