@looker/api-explorer 0.9.22 → 0.9.27

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 (353) hide show
  1. package/CHANGELOG.md +126 -0
  2. package/e2e/e2e.spec.ts +1 -1
  3. package/lib/ApiExplorer.d.ts +4 -43
  4. package/lib/ApiExplorer.js +71 -93
  5. package/lib/ApiExplorer.js.map +1 -1
  6. package/lib/App.d.ts +1 -0
  7. package/lib/App.js +29 -0
  8. package/lib/App.js.map +1 -0
  9. package/lib/StandaloneApiExplorer.js +36 -53
  10. package/lib/StandaloneApiExplorer.js.map +1 -1
  11. package/lib/components/Banner/Banner.d.ts +8 -0
  12. package/lib/components/Banner/Banner.js +70 -0
  13. package/lib/components/Banner/Banner.js.map +1 -0
  14. package/lib/components/Banner/index.d.ts +1 -0
  15. package/lib/components/Banner/index.js +14 -0
  16. package/lib/components/Banner/index.js.map +1 -0
  17. package/lib/components/DocMarkdown/DocMarkdown.js +5 -5
  18. package/lib/components/DocMarkdown/DocMarkdown.js.map +1 -1
  19. package/lib/components/DocSDKs/DocSDKs.js +3 -3
  20. package/lib/components/DocSDKs/DocSDKs.js.map +1 -1
  21. package/lib/components/DocSdkUsage/DocSdkUsage.js +3 -6
  22. package/lib/components/DocSdkUsage/DocSdkUsage.js.map +1 -1
  23. package/lib/components/DocSource/DocSource.js +5 -7
  24. package/lib/components/DocSource/DocSource.js.map +1 -1
  25. package/lib/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/SomethingWentWrongGraphic.d.ts +1 -1
  26. package/lib/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/SomethingWentWrongGraphic.js +152 -8
  27. package/lib/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/SomethingWentWrongGraphic.js.map +1 -1
  28. package/lib/components/ExploreType/ExploreType.js +3 -5
  29. package/lib/components/ExploreType/ExploreType.js.map +1 -1
  30. package/lib/components/Header/Header.d.ts +2 -5
  31. package/lib/components/Header/Header.js +1 -5
  32. package/lib/components/Header/Header.js.map +1 -1
  33. package/lib/components/SelectorContainer/ApiSpecSelector.d.ts +2 -5
  34. package/lib/components/SelectorContainer/ApiSpecSelector.js +5 -5
  35. package/lib/components/SelectorContainer/ApiSpecSelector.js.map +1 -1
  36. package/lib/components/SelectorContainer/SdkLanguageSelector.js +1 -1
  37. package/lib/components/SelectorContainer/SdkLanguageSelector.js.map +1 -1
  38. package/lib/components/SelectorContainer/SelectorContainer.d.ts +2 -5
  39. package/lib/components/SelectorContainer/SelectorContainer.js +3 -7
  40. package/lib/components/SelectorContainer/SelectorContainer.js.map +1 -1
  41. package/lib/components/SideNav/SideNav.d.ts +2 -5
  42. package/lib/components/SideNav/SideNav.js +1 -1
  43. package/lib/components/SideNav/SideNav.js.map +1 -1
  44. package/lib/components/common/Loader.d.ts +1 -1
  45. package/lib/components/common/Loader.js.map +1 -1
  46. package/lib/components/index.d.ts +1 -0
  47. package/lib/components/index.js +8 -0
  48. package/lib/components/index.js.map +1 -1
  49. package/lib/esm/ApiExplorer.js +71 -92
  50. package/lib/esm/ApiExplorer.js.map +1 -1
  51. package/lib/esm/App.js +19 -0
  52. package/lib/esm/App.js.map +1 -0
  53. package/lib/esm/StandaloneApiExplorer.js +36 -53
  54. package/lib/esm/StandaloneApiExplorer.js.map +1 -1
  55. package/lib/esm/components/Banner/Banner.js +54 -0
  56. package/lib/esm/components/Banner/Banner.js.map +1 -0
  57. package/lib/esm/components/Banner/index.js +2 -0
  58. package/lib/esm/{test-utils/envAdaptor.js.map → components/Banner/index.js.map} +1 -1
  59. package/lib/esm/components/DocMarkdown/DocMarkdown.js +3 -3
  60. package/lib/esm/components/DocMarkdown/DocMarkdown.js.map +1 -1
  61. package/lib/esm/components/DocSDKs/DocSDKs.js +2 -2
  62. package/lib/esm/components/DocSDKs/DocSDKs.js.map +1 -1
  63. package/lib/esm/components/DocSdkUsage/DocSdkUsage.js +5 -7
  64. package/lib/esm/components/DocSdkUsage/DocSdkUsage.js.map +1 -1
  65. package/lib/esm/components/DocSource/DocSource.js +4 -5
  66. package/lib/esm/components/DocSource/DocSource.js.map +1 -1
  67. package/lib/esm/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/SomethingWentWrongGraphic.js +153 -6
  68. package/lib/esm/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/SomethingWentWrongGraphic.js.map +1 -1
  69. package/lib/esm/components/ExploreType/ExploreType.js +3 -4
  70. package/lib/esm/components/ExploreType/ExploreType.js.map +1 -1
  71. package/lib/esm/components/Header/Header.js +1 -5
  72. package/lib/esm/components/Header/Header.js.map +1 -1
  73. package/lib/esm/components/SelectorContainer/ApiSpecSelector.js +4 -5
  74. package/lib/esm/components/SelectorContainer/ApiSpecSelector.js.map +1 -1
  75. package/lib/esm/components/SelectorContainer/SdkLanguageSelector.js +2 -2
  76. package/lib/esm/components/SelectorContainer/SdkLanguageSelector.js.map +1 -1
  77. package/lib/esm/components/SelectorContainer/SelectorContainer.js +3 -7
  78. package/lib/esm/components/SelectorContainer/SelectorContainer.js.map +1 -1
  79. package/lib/esm/components/SideNav/SideNav.js +2 -2
  80. package/lib/esm/components/SideNav/SideNav.js.map +1 -1
  81. package/lib/esm/components/common/Loader.js.map +1 -1
  82. package/lib/esm/components/index.js +1 -0
  83. package/lib/esm/components/index.js.map +1 -1
  84. package/lib/esm/index.js +5 -18
  85. package/lib/esm/index.js.map +1 -1
  86. package/lib/esm/routes/AppRouter.js +3 -7
  87. package/lib/esm/routes/AppRouter.js.map +1 -1
  88. package/lib/esm/scenes/DiffScene/DiffScene.js +43 -99
  89. package/lib/esm/scenes/DiffScene/DiffScene.js.map +1 -1
  90. package/lib/esm/scenes/DiffScene/DocDiff/DiffItem.js +9 -13
  91. package/lib/esm/scenes/DiffScene/DocDiff/DiffItem.js.map +1 -1
  92. package/lib/esm/scenes/DiffScene/DocDiff/DocDiff.js +2 -2
  93. package/lib/esm/scenes/DiffScene/DocDiff/DocDiff.js.map +1 -1
  94. package/lib/esm/scenes/MethodScene/MethodScene.js +12 -15
  95. package/lib/esm/scenes/MethodScene/MethodScene.js.map +1 -1
  96. package/lib/esm/state/index.js +2 -0
  97. package/lib/esm/state/index.js.map +1 -1
  98. package/lib/esm/state/lodes/index.js +3 -0
  99. package/lib/{test-utils/envAdaptor.js.map → esm/state/lodes/index.js.map} +1 -1
  100. package/lib/esm/state/lodes/sagas.js +25 -0
  101. package/lib/esm/state/lodes/sagas.js.map +1 -0
  102. package/lib/esm/state/lodes/selectors.js +5 -0
  103. package/lib/esm/state/lodes/selectors.js.map +1 -0
  104. package/lib/esm/state/lodes/slice.js +30 -0
  105. package/lib/esm/state/lodes/slice.js.map +1 -0
  106. package/lib/esm/state/settings/sagas.js +28 -16
  107. package/lib/esm/state/settings/sagas.js.map +1 -1
  108. package/lib/esm/state/settings/selectors.js +5 -5
  109. package/lib/esm/state/settings/selectors.js.map +1 -1
  110. package/lib/esm/state/settings/slice.js +8 -8
  111. package/lib/esm/state/settings/slice.js.map +1 -1
  112. package/lib/esm/state/specs/index.js +3 -0
  113. package/lib/esm/state/specs/index.js.map +1 -0
  114. package/lib/esm/state/specs/sagas.js +58 -0
  115. package/lib/esm/state/specs/sagas.js.map +1 -0
  116. package/lib/esm/state/specs/selectors.js +8 -0
  117. package/lib/esm/state/specs/selectors.js.map +1 -0
  118. package/lib/esm/state/specs/slice.js +55 -0
  119. package/lib/esm/state/specs/slice.js.map +1 -0
  120. package/lib/esm/state/store.js +57 -3
  121. package/lib/esm/state/store.js.map +1 -1
  122. package/lib/esm/test-utils/index.js +1 -2
  123. package/lib/esm/test-utils/index.js.map +1 -1
  124. package/lib/esm/test-utils/lodes.js +12 -0
  125. package/lib/esm/test-utils/lodes.js.map +1 -0
  126. package/lib/esm/test-utils/redux.js +16 -9
  127. package/lib/esm/test-utils/redux.js.map +1 -1
  128. package/lib/esm/utils/adaptorUtils.js +101 -0
  129. package/lib/esm/utils/adaptorUtils.js.map +1 -0
  130. package/lib/esm/utils/apixAdaptor.js +48 -0
  131. package/lib/esm/utils/apixAdaptor.js.map +1 -0
  132. package/lib/esm/utils/index.js +3 -2
  133. package/lib/esm/utils/index.js.map +1 -1
  134. package/lib/esm/utils/lodeUtils.js +3 -7
  135. package/lib/esm/utils/lodeUtils.js.map +1 -1
  136. package/lib/esm/utils/path.js +27 -2
  137. package/lib/esm/utils/path.js.map +1 -1
  138. package/lib/index.d.ts +5 -1
  139. package/lib/index.js +59 -17
  140. package/lib/index.js.map +1 -1
  141. package/lib/routes/AppRouter.d.ts +1 -5
  142. package/lib/routes/AppRouter.js +3 -7
  143. package/lib/routes/AppRouter.js.map +1 -1
  144. package/lib/scenes/DiffScene/DiffScene.js +45 -100
  145. package/lib/scenes/DiffScene/DiffScene.js.map +1 -1
  146. package/lib/scenes/DiffScene/DocDiff/DiffItem.js +9 -13
  147. package/lib/scenes/DiffScene/DocDiff/DiffItem.js.map +1 -1
  148. package/lib/scenes/DiffScene/DocDiff/DocDiff.js +2 -2
  149. package/lib/scenes/DiffScene/DocDiff/DocDiff.js.map +1 -1
  150. package/lib/scenes/MethodScene/MethodScene.d.ts +0 -4
  151. package/lib/scenes/MethodScene/MethodScene.js +11 -13
  152. package/lib/scenes/MethodScene/MethodScene.js.map +1 -1
  153. package/lib/state/index.d.ts +2 -0
  154. package/lib/state/index.js +26 -0
  155. package/lib/state/index.js.map +1 -1
  156. package/lib/state/lodes/index.d.ts +2 -0
  157. package/lib/state/lodes/index.js +32 -0
  158. package/lib/state/lodes/index.js.map +1 -0
  159. package/lib/state/lodes/sagas.d.ts +1 -0
  160. package/lib/state/lodes/sagas.js +34 -0
  161. package/lib/state/lodes/sagas.js.map +1 -0
  162. package/lib/state/lodes/selectors.d.ts +3 -0
  163. package/lib/state/lodes/selectors.js +17 -0
  164. package/lib/state/lodes/selectors.js.map +1 -0
  165. package/lib/state/lodes/slice.d.ts +29 -0
  166. package/lib/state/lodes/slice.js +45 -0
  167. package/lib/state/lodes/slice.js.map +1 -0
  168. package/lib/state/settings/sagas.js +28 -15
  169. package/lib/state/settings/sagas.js.map +1 -1
  170. package/lib/state/settings/selectors.d.ts +1 -1
  171. package/lib/state/settings/selectors.js +5 -5
  172. package/lib/state/settings/selectors.js.map +1 -1
  173. package/lib/state/settings/slice.d.ts +14 -14
  174. package/lib/state/settings/slice.js +13 -13
  175. package/lib/state/settings/slice.js.map +1 -1
  176. package/lib/state/specs/index.d.ts +2 -0
  177. package/lib/state/specs/index.js +32 -0
  178. package/lib/state/specs/index.js.map +1 -0
  179. package/lib/state/specs/sagas.d.ts +1 -0
  180. package/lib/state/specs/sagas.js +67 -0
  181. package/lib/state/specs/sagas.js.map +1 -0
  182. package/lib/state/specs/selectors.d.ts +4 -0
  183. package/lib/state/specs/selectors.js +20 -0
  184. package/lib/state/specs/selectors.js.map +1 -0
  185. package/lib/state/specs/slice.d.ts +49 -0
  186. package/lib/state/specs/slice.js +70 -0
  187. package/lib/state/specs/slice.js.map +1 -0
  188. package/lib/state/store.d.ts +6 -0
  189. package/lib/state/store.js +60 -2
  190. package/lib/state/store.js.map +1 -1
  191. package/lib/test-data/declarations.d.ts +2 -0
  192. package/lib/test-data/declarations.js +24 -0
  193. package/lib/test-data/declarations.js.map +1 -0
  194. package/lib/test-data/examples.d.ts +2 -0
  195. package/lib/test-data/index.d.ts +3 -0
  196. package/lib/test-data/index.js +29 -36
  197. package/lib/test-data/index.js.map +1 -1
  198. package/lib/test-data/specs.d.ts +10 -0
  199. package/lib/test-data/specs.js +6 -6
  200. package/lib/test-data/specs.js.map +1 -1
  201. package/lib/test-utils/index.d.ts +1 -2
  202. package/lib/test-utils/index.js +12 -28
  203. package/lib/test-utils/index.js.map +1 -1
  204. package/lib/test-utils/lodes.d.ts +4 -0
  205. package/lib/test-utils/lodes.js +23 -0
  206. package/lib/test-utils/lodes.js.map +1 -0
  207. package/lib/test-utils/redux.d.ts +4 -1
  208. package/lib/test-utils/redux.js +18 -9
  209. package/lib/test-utils/redux.js.map +1 -1
  210. package/lib/utils/adaptorUtils.d.ts +30 -0
  211. package/lib/utils/adaptorUtils.js +124 -0
  212. package/lib/utils/adaptorUtils.js.map +1 -0
  213. package/lib/utils/apixAdaptor.d.ts +15 -0
  214. package/lib/utils/apixAdaptor.js +67 -0
  215. package/lib/utils/apixAdaptor.js.map +1 -0
  216. package/lib/utils/index.d.ts +3 -2
  217. package/lib/utils/index.js +30 -39
  218. package/lib/utils/index.js.map +1 -1
  219. package/lib/utils/lodeUtils.d.ts +2 -2
  220. package/lib/utils/lodeUtils.js +3 -7
  221. package/lib/utils/lodeUtils.js.map +1 -1
  222. package/lib/utils/path.d.ts +3 -0
  223. package/lib/utils/path.js +32 -2
  224. package/lib/utils/path.js.map +1 -1
  225. package/package.json +11 -10
  226. package/public/Looker.3.1.json +1343 -412
  227. package/public/Looker.4.0.json +3305 -661
  228. package/src/ApiExplorer.tsx +114 -144
  229. package/src/{index.tsx → App.tsx} +0 -0
  230. package/src/StandaloneApiExplorer.tsx +38 -61
  231. package/src/components/Banner/Banner.spec.tsx +99 -0
  232. package/src/components/Banner/Banner.tsx +87 -0
  233. package/src/{reducers → components/Banner}/index.ts +1 -1
  234. package/src/components/DocMarkdown/DocMarkdown.tsx +3 -3
  235. package/src/components/DocSDKs/DocSDKs.tsx +4 -5
  236. package/src/components/DocSdkUsage/DocSdkUsage.spec.tsx +2 -2
  237. package/src/components/DocSdkUsage/DocSdkUsage.tsx +5 -5
  238. package/src/components/DocSource/DocSource.tsx +4 -3
  239. package/src/components/ErrorBoundary/components/SomethingWentWrong/SomethingWentWrong.spec.tsx +1 -1
  240. package/src/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/SomethingWentWrongGraphic.tsx +170 -6
  241. package/src/components/ExploreType/ExploreType.spec.tsx +0 -23
  242. package/src/components/ExploreType/ExploreType.tsx +5 -6
  243. package/src/components/ExploreType/exploreUtils.spec.tsx +1 -1
  244. package/src/components/Header/Header.spec.tsx +9 -30
  245. package/src/components/Header/Header.tsx +3 -10
  246. package/src/components/SelectorContainer/ApiSpecSelector.spec.tsx +31 -44
  247. package/src/components/SelectorContainer/ApiSpecSelector.tsx +6 -12
  248. package/src/components/SelectorContainer/SdkLanguageSelector.spec.tsx +3 -5
  249. package/src/components/SelectorContainer/SdkLanguageSelector.tsx +2 -2
  250. package/src/components/SelectorContainer/SelectorContainer.spec.tsx +7 -26
  251. package/src/components/SelectorContainer/SelectorContainer.tsx +4 -10
  252. package/src/components/SideNav/SideNav.spec.tsx +12 -45
  253. package/src/components/SideNav/SideNav.tsx +3 -9
  254. package/src/components/common/Loader.tsx +1 -1
  255. package/src/components/index.ts +1 -0
  256. package/src/{reducers/spec/index.ts → index.ts} +4 -2
  257. package/src/routes/AppRouter.tsx +26 -37
  258. package/src/scenes/DiffScene/DiffScene.tsx +47 -84
  259. package/src/scenes/DiffScene/DocDiff/DiffItem.spec.tsx +9 -16
  260. package/src/scenes/DiffScene/DocDiff/DiffItem.tsx +11 -12
  261. package/src/scenes/DiffScene/DocDiff/DocDiff.tsx +2 -2
  262. package/src/scenes/MethodScene/MethodScene.tsx +12 -18
  263. package/src/state/index.ts +2 -0
  264. package/src/{context → state/lodes}/index.ts +2 -1
  265. package/src/state/lodes/sagas.spec.ts +92 -0
  266. package/src/state/lodes/sagas.ts +51 -0
  267. package/src/state/lodes/selectors.spec.ts +42 -0
  268. package/src/{reducers/spec/actions.spec.ts → state/lodes/selectors.ts} +9 -11
  269. package/src/{test-utils/render_with_lode.tsx → state/lodes/slice.ts} +37 -37
  270. package/src/state/settings/sagas.spec.ts +25 -21
  271. package/src/state/settings/sagas.ts +16 -16
  272. package/src/state/settings/selectors.spec.ts +1 -5
  273. package/src/state/settings/selectors.ts +5 -5
  274. package/src/state/settings/slice.ts +12 -7
  275. package/src/{context/lode → state/specs}/index.ts +2 -1
  276. package/src/state/specs/sagas.spec.ts +135 -0
  277. package/src/state/specs/sagas.ts +81 -0
  278. package/src/{test-utils/envAdaptor.ts → state/specs/selectors.ts} +10 -4
  279. package/src/state/specs/slice.ts +109 -0
  280. package/src/state/store.ts +65 -2
  281. package/src/{context/lode/LodeContext.ts → test-data/declarations.ts} +17 -14
  282. package/src/test-data/index.ts +2 -8
  283. package/src/test-data/specs.ts +6 -6
  284. package/src/test-utils/index.ts +1 -5
  285. package/src/{reducers/spec/reducer.spec.ts → test-utils/lodes.tsx} +16 -19
  286. package/src/test-utils/redux.tsx +31 -8
  287. package/src/utils/adaptorUtils.ts +181 -0
  288. package/src/utils/apixAdaptor.ts +72 -0
  289. package/src/utils/index.ts +3 -8
  290. package/src/utils/lodeUtils.ts +4 -6
  291. package/src/utils/path.ts +25 -2
  292. package/webpack.dev.config.js +3 -0
  293. package/webpack.prod.config.js +4 -0
  294. package/lib/context/index.d.ts +0 -1
  295. package/lib/context/index.js +0 -20
  296. package/lib/context/index.js.map +0 -1
  297. package/lib/context/lode/LodeContext.d.ts +0 -9
  298. package/lib/context/lode/LodeContext.js +0 -21
  299. package/lib/context/lode/LodeContext.js.map +0 -1
  300. package/lib/context/lode/index.d.ts +0 -1
  301. package/lib/context/lode/index.js +0 -20
  302. package/lib/context/lode/index.js.map +0 -1
  303. package/lib/esm/context/index.js +0 -2
  304. package/lib/esm/context/index.js.map +0 -1
  305. package/lib/esm/context/lode/LodeContext.js +0 -11
  306. package/lib/esm/context/lode/LodeContext.js.map +0 -1
  307. package/lib/esm/context/lode/index.js +0 -2
  308. package/lib/esm/context/lode/index.js.map +0 -1
  309. package/lib/esm/reducers/index.js +0 -2
  310. package/lib/esm/reducers/index.js.map +0 -1
  311. package/lib/esm/reducers/spec/actions.js +0 -19
  312. package/lib/esm/reducers/spec/actions.js.map +0 -1
  313. package/lib/esm/reducers/spec/index.js +0 -4
  314. package/lib/esm/reducers/spec/index.js.map +0 -1
  315. package/lib/esm/reducers/spec/reducer.js +0 -62
  316. package/lib/esm/reducers/spec/reducer.js.map +0 -1
  317. package/lib/esm/reducers/spec/utils.js +0 -74
  318. package/lib/esm/reducers/spec/utils.js.map +0 -1
  319. package/lib/esm/test-utils/envAdaptor.js +0 -5
  320. package/lib/esm/test-utils/render_with_lode.js +0 -19
  321. package/lib/esm/test-utils/render_with_lode.js.map +0 -1
  322. package/lib/esm/utils/envAdaptor.js +0 -84
  323. package/lib/esm/utils/envAdaptor.js.map +0 -1
  324. package/lib/reducers/index.d.ts +0 -1
  325. package/lib/reducers/index.js +0 -19
  326. package/lib/reducers/index.js.map +0 -1
  327. package/lib/reducers/spec/actions.d.ts +0 -20
  328. package/lib/reducers/spec/actions.js +0 -31
  329. package/lib/reducers/spec/actions.js.map +0 -1
  330. package/lib/reducers/spec/index.d.ts +0 -3
  331. package/lib/reducers/spec/index.js +0 -45
  332. package/lib/reducers/spec/index.js.map +0 -1
  333. package/lib/reducers/spec/reducer.d.ts +0 -7
  334. package/lib/reducers/spec/reducer.js +0 -73
  335. package/lib/reducers/spec/reducer.js.map +0 -1
  336. package/lib/reducers/spec/utils.d.ts +0 -7
  337. package/lib/reducers/spec/utils.js +0 -91
  338. package/lib/reducers/spec/utils.js.map +0 -1
  339. package/lib/test-utils/envAdaptor.d.ts +0 -2
  340. package/lib/test-utils/envAdaptor.js +0 -15
  341. package/lib/test-utils/render_with_lode.d.ts +0 -7
  342. package/lib/test-utils/render_with_lode.js +0 -36
  343. package/lib/test-utils/render_with_lode.js.map +0 -1
  344. package/lib/utils/envAdaptor.d.ts +0 -31
  345. package/lib/utils/envAdaptor.js +0 -106
  346. package/lib/utils/envAdaptor.js.map +0 -1
  347. package/src/components/ErrorBoundary/components/SomethingWentWrong/components/SomethingWentWrongGraphic/somethingWentWrong.svg +0 -45
  348. package/src/reducers/spec/actions.ts +0 -62
  349. package/src/reducers/spec/reducer.ts +0 -69
  350. package/src/reducers/spec/utils.spec.ts +0 -138
  351. package/src/reducers/spec/utils.ts +0 -123
  352. package/src/utils/envAdaptor.spec.ts +0 -50
  353. package/src/utils/envAdaptor.ts +0 -147
@@ -38,17 +38,17 @@ const fetchLode = async (lodeUrl: string) => {
38
38
  }
39
39
 
40
40
  interface FullLode {
41
- examples: IExampleMine
41
+ examples?: IExampleMine
42
42
  declarations?: IDeclarationMine
43
43
  }
44
44
 
45
45
  export const getLoded = async (
46
- examplesLodeUrl: string,
46
+ examplesLodeUrl?: string,
47
47
  declarationsLodeUrl?: string
48
48
  ): Promise<FullLode> => {
49
49
  // First try to load from the apix-files server
50
50
  let examples = await fetchLode(`${apixFilesHost}/examplesIndex.json`)
51
- if (!examples) {
51
+ if (!examples && examplesLodeUrl) {
52
52
  examples = await fetchLode(examplesLodeUrl)
53
53
  }
54
54
 
@@ -57,9 +57,7 @@ export const getLoded = async (
57
57
  declarations = await fetchLode(declarationsLodeUrl)
58
58
  }
59
59
 
60
- const lode: FullLode = {
61
- examples: { commitHash: '', nuggets: {}, remoteOrigin: '', summaries: {} },
62
- }
60
+ const lode: FullLode = { examples: undefined, declarations: undefined }
63
61
  if (examples) {
64
62
  lode.examples = JSON.parse(examples)
65
63
  }
package/src/utils/path.ts CHANGED
@@ -25,7 +25,8 @@
25
25
  */
26
26
 
27
27
  import type { ApiModel, IMethod, IType } from '@looker/sdk-codegen'
28
- import { firstMethodRef, Method } from '@looker/sdk-codegen'
28
+ import { firstMethodRef } from '@looker/sdk-codegen'
29
+ import type { Location as HLocation } from 'history'
29
30
 
30
31
  /**
31
32
  * Builds a path matching the route used by MethodScene
@@ -66,6 +67,12 @@ const getMethodTag = (api: ApiModel, methodName: string) => {
66
67
  .map(([methodTag]) => methodTag)[0]
67
68
  }
68
69
 
70
+ /**
71
+ * Is this item a method? Check without requiring `instanceof Method`
72
+ * @param item to check for method or type
73
+ */
74
+ export const isMethod = (item: IMethod | IType) => 'params' in item
75
+
69
76
  /**
70
77
  * Return the tag for a give type
71
78
  * @param api Parsed api
@@ -89,7 +96,7 @@ export const buildPath = (
89
96
  specKey: string
90
97
  ) => {
91
98
  let path
92
- if (item instanceof Method) {
99
+ if (isMethod(item)) {
93
100
  const tag = getMethodTag(api, item.name)
94
101
  path = buildMethodPath(specKey, tag, item.name)
95
102
  } else {
@@ -98,3 +105,19 @@ export const buildPath = (
98
105
  }
99
106
  return path
100
107
  }
108
+
109
+ /**
110
+ * Determine API specification keys from URL pattern
111
+ * @param location service to examine
112
+ */
113
+ export const getSpecKey = (location: HLocation | Location): string | null => {
114
+ const pathname = location.pathname
115
+ let match
116
+ if (pathname.startsWith(`/${diffPath}`)) {
117
+ const pattern = new RegExp(`(?:/${diffPath})/(?<specKey>\\w+.\\w+)`)
118
+ match = pathname.match(pattern)
119
+ } else {
120
+ match = pathname.match(/\/(?<specKey>\w+\.\w+).*/)
121
+ }
122
+ return match?.groups?.specKey || null
123
+ }
@@ -30,6 +30,9 @@ const base = require('../../webpack.base.config')(__dirname)
30
30
  const browser = require('../../webpack.browser.config')()
31
31
 
32
32
  module.exports = merge(base, browser, {
33
+ entry: {
34
+ app: path.join(__dirname, 'src/App.tsx'),
35
+ },
33
36
  mode: 'development',
34
37
  devServer: {
35
38
  contentBase: path.join(__dirname, 'public'),
@@ -23,10 +23,14 @@
23
23
  SOFTWARE.
24
24
 
25
25
  */
26
+ const path = require('path')
26
27
  const { merge } = require('webpack-merge')
27
28
  const base = require('../../webpack.base.config')(__dirname)
28
29
  const browser = require('../../webpack.browser.config')()
29
30
 
30
31
  module.exports = merge(base, browser, {
32
+ entry: {
33
+ app: path.join(__dirname, 'src/index.ts'),
34
+ },
31
35
  mode: 'production',
32
36
  })
@@ -1 +0,0 @@
1
- export { LodeContext, defaultLodeContextValue } from './lode';
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "LodeContext", {
7
- enumerable: true,
8
- get: function get() {
9
- return _lode.LodeContext;
10
- }
11
- });
12
- Object.defineProperty(exports, "defaultLodeContextValue", {
13
- enumerable: true,
14
- get: function get() {
15
- return _lode.defaultLodeContextValue;
16
- }
17
- });
18
-
19
- var _lode = require("./lode");
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/context/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAyBA","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 { LodeContext, defaultLodeContextValue } from './lode'\n"],"file":"index.js"}
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import type { IDeclarationMine, IExampleMine } from '@looker/sdk-codegen';
3
- interface LodeContextProps {
4
- examples: IExampleMine;
5
- declarations?: IDeclarationMine;
6
- }
7
- export declare const defaultLodeContextValue: LodeContextProps;
8
- export declare const LodeContext: import("react").Context<LodeContextProps>;
9
- export {};
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.LodeContext = exports.defaultLodeContextValue = void 0;
7
-
8
- var _react = require("react");
9
-
10
- var defaultLodeContextValue = {
11
- examples: {
12
- commitHash: '',
13
- remoteOrigin: '',
14
- nuggets: {},
15
- summaries: {}
16
- }
17
- };
18
- exports.defaultLodeContextValue = defaultLodeContextValue;
19
- var LodeContext = (0, _react.createContext)(defaultLodeContextValue);
20
- exports.LodeContext = LodeContext;
21
- //# sourceMappingURL=LodeContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/context/lode/LodeContext.ts"],"names":["defaultLodeContextValue","examples","commitHash","remoteOrigin","nuggets","summaries","LodeContext"],"mappings":";;;;;;;AAyBA;;AAQO,IAAMA,uBAAyC,GAAG;AACvDC,EAAAA,QAAQ,EAAE;AAAEC,IAAAA,UAAU,EAAE,EAAd;AAAkBC,IAAAA,YAAY,EAAE,EAAhC;AAAoCC,IAAAA,OAAO,EAAE,EAA7C;AAAiDC,IAAAA,SAAS,EAAE;AAA5D;AAD6C,CAAlD;;AAIA,IAAMC,WAAW,GAAG,0BACzBN,uBADyB,CAApB","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 */\nimport { createContext } from 'react'\nimport type { IDeclarationMine, IExampleMine } from '@looker/sdk-codegen'\n\ninterface LodeContextProps {\n examples: IExampleMine\n declarations?: IDeclarationMine\n}\n\nexport const defaultLodeContextValue: LodeContextProps = {\n examples: { commitHash: '', remoteOrigin: '', nuggets: {}, summaries: {} },\n}\n\nexport const LodeContext = createContext<LodeContextProps>(\n defaultLodeContextValue\n)\n"],"file":"LodeContext.js"}
@@ -1 +0,0 @@
1
- export { defaultLodeContextValue, LodeContext } from './LodeContext';
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "defaultLodeContextValue", {
7
- enumerable: true,
8
- get: function get() {
9
- return _LodeContext.defaultLodeContextValue;
10
- }
11
- });
12
- Object.defineProperty(exports, "LodeContext", {
13
- enumerable: true,
14
- get: function get() {
15
- return _LodeContext.LodeContext;
16
- }
17
- });
18
-
19
- var _LodeContext = require("./LodeContext");
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/context/lode/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAyBA","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 { defaultLodeContextValue, LodeContext } from './LodeContext'\n"],"file":"index.js"}
@@ -1,2 +0,0 @@
1
- export { LodeContext, defaultLodeContextValue } from './lode';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/context/index.ts"],"names":["LodeContext","defaultLodeContextValue"],"mappings":"AAyBA,SAASA,WAAT,EAAsBC,uBAAtB,QAAqD,QAArD","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 { LodeContext, defaultLodeContextValue } from './lode'\n"],"file":"index.js"}
@@ -1,11 +0,0 @@
1
- import { createContext } from 'react';
2
- export var defaultLodeContextValue = {
3
- examples: {
4
- commitHash: '',
5
- remoteOrigin: '',
6
- nuggets: {},
7
- summaries: {}
8
- }
9
- };
10
- export var LodeContext = createContext(defaultLodeContextValue);
11
- //# sourceMappingURL=LodeContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/context/lode/LodeContext.ts"],"names":["createContext","defaultLodeContextValue","examples","commitHash","remoteOrigin","nuggets","summaries","LodeContext"],"mappings":"AAyBA,SAASA,aAAT,QAA8B,OAA9B;AAQA,OAAO,IAAMC,uBAAyC,GAAG;AACvDC,EAAAA,QAAQ,EAAE;AAAEC,IAAAA,UAAU,EAAE,EAAd;AAAkBC,IAAAA,YAAY,EAAE,EAAhC;AAAoCC,IAAAA,OAAO,EAAE,EAA7C;AAAiDC,IAAAA,SAAS,EAAE;AAA5D;AAD6C,CAAlD;AAIP,OAAO,IAAMC,WAAW,GAAGP,aAAa,CACtCC,uBADsC,CAAjC","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 */\nimport { createContext } from 'react'\nimport type { IDeclarationMine, IExampleMine } from '@looker/sdk-codegen'\n\ninterface LodeContextProps {\n examples: IExampleMine\n declarations?: IDeclarationMine\n}\n\nexport const defaultLodeContextValue: LodeContextProps = {\n examples: { commitHash: '', remoteOrigin: '', nuggets: {}, summaries: {} },\n}\n\nexport const LodeContext = createContext<LodeContextProps>(\n defaultLodeContextValue\n)\n"],"file":"LodeContext.js"}
@@ -1,2 +0,0 @@
1
- export { defaultLodeContextValue, LodeContext } from './LodeContext';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/context/lode/index.ts"],"names":["defaultLodeContextValue","LodeContext"],"mappings":"AAyBA,SAASA,uBAAT,EAAkCC,WAAlC,QAAqD,eAArD","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 { defaultLodeContextValue, LodeContext } from './LodeContext'\n"],"file":"index.js"}
@@ -1,2 +0,0 @@
1
- export * from './spec';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/reducers/index.ts"],"names":[],"mappings":"AAyBA,cAAc,QAAd","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 './spec'\n"],"file":"index.js"}
@@ -1,19 +0,0 @@
1
- export var Actions;
2
-
3
- (function (Actions) {
4
- Actions["SELECT_SPEC"] = "SELECT_SPEC";
5
- Actions["UPDATE_SPEC_API"] = "UPDATE_SPEC_API";
6
- })(Actions || (Actions = {}));
7
-
8
- export var selectSpec = specKey => ({
9
- type: Actions.SELECT_SPEC,
10
- payload: specKey
11
- });
12
- export var updateSpecApi = (specKey, api) => ({
13
- type: Actions.UPDATE_SPEC_API,
14
- payload: {
15
- specKey,
16
- api
17
- }
18
- });
19
- //# sourceMappingURL=actions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/reducers/spec/actions.ts"],"names":["Actions","selectSpec","specKey","type","SELECT_SPEC","payload","updateSpecApi","api","UPDATE_SPEC_API"],"mappings":"AA4BA,WAAYA,OAAZ;;WAAYA,O;AAAAA,EAAAA,O;AAAAA,EAAAA,O;GAAAA,O,KAAAA,O;;AAsBZ,OAAO,IAAMC,UAAU,GAAIC,OAAD,KAAwC;AAChEC,EAAAA,IAAI,EAAEH,OAAO,CAACI,WADkD;AAEhEC,EAAAA,OAAO,EAAEH;AAFuD,CAAxC,CAAnB;AAKP,OAAO,IAAMI,aAAa,GAAG,CAC3BJ,OAD2B,EAE3BK,GAF2B,MAGF;AACzBJ,EAAAA,IAAI,EAAEH,OAAO,CAACQ,eADW;AAEzBH,EAAAA,OAAO,EAAE;AAAEH,IAAAA,OAAF;AAAWK,IAAAA;AAAX;AAFgB,CAHE,CAAtB","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 } from '@looker/sdk-codegen'\n\nexport enum Actions {\n SELECT_SPEC = 'SELECT_SPEC',\n UPDATE_SPEC_API = 'UPDATE_SPEC_API',\n}\n\nexport interface ApiUpdatePayload {\n specKey: string\n api: ApiModel\n}\n\nexport interface UpdateSpecApiAction {\n type: Actions.UPDATE_SPEC_API\n payload: ApiUpdatePayload\n}\n\nexport interface SelectSpecAction {\n type: Actions.SELECT_SPEC\n payload: string\n}\n\nexport type SpecAction = SelectSpecAction | UpdateSpecApiAction\n\nexport const selectSpec = (specKey: string): SelectSpecAction => ({\n type: Actions.SELECT_SPEC,\n payload: specKey,\n})\n\nexport const updateSpecApi = (\n specKey: string,\n api: ApiModel\n): UpdateSpecApiAction => ({\n type: Actions.UPDATE_SPEC_API,\n payload: { specKey, api },\n})\n"],"file":"actions.js"}
@@ -1,4 +0,0 @@
1
- export * from './utils';
2
- export * from './actions';
3
- export * from './reducer';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/reducers/spec/index.ts"],"names":[],"mappings":"AAyBA,cAAc,SAAd;AACA,cAAc,WAAd;AACA,cAAc,WAAd","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 './utils'\nexport * from './actions'\nexport * from './reducer'\n"],"file":"index.js"}
@@ -1,62 +0,0 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2
-
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
-
5
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
7
- import { ApiModel } from '@looker/sdk-codegen';
8
- import { Actions } from '.';
9
- export var specReducer = (state, action) => {
10
- var {
11
- type,
12
- payload
13
- } = action;
14
-
15
- switch (type) {
16
- case Actions.UPDATE_SPEC_API:
17
- {
18
- var specList = _objectSpread({}, state.specList);
19
-
20
- var {
21
- specKey,
22
- api
23
- } = payload;
24
- var spec = specList[specKey];
25
-
26
- if (spec) {
27
- spec = _objectSpread(_objectSpread({}, spec), {}, {
28
- api
29
- });
30
- specList[specKey] = spec;
31
- }
32
-
33
- return {
34
- specList,
35
- spec
36
- };
37
- }
38
-
39
- case 'SELECT_SPEC':
40
- {
41
- var newState = _objectSpread({}, state);
42
-
43
- var _spec = newState.specList[payload];
44
-
45
- if (_spec) {
46
- if (!_spec.api && _spec.specContent) {
47
- _spec.api = ApiModel.fromJson(_spec.specContent);
48
- }
49
-
50
- return _objectSpread(_objectSpread({}, state), {}, {
51
- spec: _spec
52
- });
53
- }
54
-
55
- return state;
56
- }
57
-
58
- default:
59
- return state;
60
- }
61
- };
62
- //# sourceMappingURL=reducer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/reducers/spec/reducer.ts"],"names":["ApiModel","Actions","specReducer","state","action","type","payload","UPDATE_SPEC_API","specList","specKey","api","spec","newState","specContent","fromJson"],"mappings":";;;;;;AA2BA,SAASA,QAAT,QAAyB,qBAAzB;AAGA,SAASC,OAAT,QAAwB,GAAxB;AAOA,OAAO,IAAMC,WAAW,GAAG,CACzBC,KADyB,EAEzBC,MAFyB,KAGX;AACd,MAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAoBF,MAA1B;;AACA,UAAQC,IAAR;AACE,SAAKJ,OAAO,CAACM,eAAb;AAA8B;AAC5B,YAAMC,QAAQ,qBAAQL,KAAK,CAACK,QAAd,CAAd;;AACA,YAAM;AAAEC,UAAAA,OAAF;AAAWC,UAAAA;AAAX,YAAmBJ,OAAzB;AACA,YAAIK,IAAI,GAAGH,QAAQ,CAACC,OAAD,CAAnB;;AACA,YAAIE,IAAJ,EAAU;AACRA,UAAAA,IAAI,mCAAQA,IAAR;AAAcD,YAAAA;AAAd,YAAJ;AACAF,UAAAA,QAAQ,CAACC,OAAD,CAAR,GAAoBE,IAApB;AACD;;AACD,eAAO;AAAEH,UAAAA,QAAF;AAAYG,UAAAA;AAAZ,SAAP;AACD;;AACD,SAAK,aAAL;AAAoB;AAClB,YAAMC,QAAQ,qBAAQT,KAAR,CAAd;;AACA,YAAMQ,KAAI,GAAGC,QAAQ,CAACJ,QAAT,CAAkBF,OAAlB,CAAb;;AAEA,YAAIK,KAAJ,EAAU;AACR,cAAI,CAACA,KAAI,CAACD,GAAN,IAAaC,KAAI,CAACE,WAAtB,EAAmC;AACjCF,YAAAA,KAAI,CAACD,GAAL,GAAWV,QAAQ,CAACc,QAAT,CAAkBH,KAAI,CAACE,WAAvB,CAAX;AACD;;AACD,iDAAYV,KAAZ;AAAmBQ,YAAAA,IAAI,EAAJA;AAAnB;AACD;;AACD,eAAOR,KAAP;AACD;;AACD;AACE,aAAOA,KAAP;AAxBJ;AA0BD,CA/BM","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 { SpecItem, SpecList } from '@looker/sdk-codegen'\nimport { ApiModel } from '@looker/sdk-codegen'\nimport type { ApiUpdatePayload } from './actions'\nimport type { SpecAction } from '.'\nimport { Actions } from '.'\n\nexport interface SpecState {\n specList: SpecList\n spec: SpecItem\n}\n\nexport const specReducer = (\n state: SpecState,\n action: SpecAction\n): SpecState => {\n const { type, payload } = action\n switch (type) {\n case Actions.UPDATE_SPEC_API: {\n const specList = { ...state.specList }\n const { specKey, api } = payload as ApiUpdatePayload\n let spec = specList[specKey]\n if (spec) {\n spec = { ...spec, api }\n specList[specKey] = spec\n }\n return { specList, spec }\n }\n case 'SELECT_SPEC': {\n const newState = { ...state }\n const spec = newState.specList[payload as string]\n // Does extension API Explorer needs this?\n if (spec) {\n if (!spec.api && spec.specContent) {\n spec.api = ApiModel.fromJson(spec.specContent)\n }\n return { ...state, spec }\n }\n return state\n }\n default:\n return state\n }\n}\n"],"file":"reducer.js"}
@@ -1,74 +0,0 @@
1
- import { OAuthSession } from '@looker/sdk-rtl';
2
- import { diffPath, oAuthPath } from '../../utils';
3
- export var getDefaultSpecKey = specs => {
4
- var items = Object.entries(specs);
5
-
6
- if (items.length === 0) {
7
- throw Error('No specs found.');
8
- }
9
-
10
- var specKey = '';
11
- items.forEach(_ref => {
12
- var [key, item] = _ref;
13
-
14
- if (item.isDefault) {
15
- specKey = key;
16
- }
17
- });
18
-
19
- if (!specKey) {
20
- items.forEach(_ref2 => {
21
- var [key, item] = _ref2;
22
-
23
- if (item.status === 'current') {
24
- specKey = key;
25
- }
26
- });
27
- }
28
-
29
- if (!specKey) {
30
- specKey = Object.keys(specs)[0];
31
- }
32
-
33
- if (!specKey) {
34
- throw Error('No specs found.');
35
- }
36
-
37
- return specKey;
38
- };
39
- export var getSpecKey = (location, specs) => {
40
- var pathName = location.pathname;
41
-
42
- if (pathName === "/".concat(oAuthPath)) {
43
- var returnUrl = sessionStorage.getItem(OAuthSession.returnUrlKey);
44
-
45
- if (returnUrl) {
46
- pathName = returnUrl;
47
- }
48
- }
49
-
50
- var pathNodes = pathName.split('/');
51
- var specKey = '';
52
-
53
- if (pathNodes.length > 1 && pathNodes[1] && pathNodes[1] !== oAuthPath && pathNodes[1] !== diffPath) {
54
- specKey = pathNodes[1];
55
- } else if (specs) {
56
- specKey = getDefaultSpecKey(specs);
57
- }
58
-
59
- return specKey;
60
- };
61
- export var initDefaultSpecState = (specList, location) => {
62
- var specKey = getSpecKey(location, specList);
63
- var spec = specList[specKey];
64
-
65
- if (!spec) {
66
- spec = specList['4.0'];
67
- }
68
-
69
- return {
70
- specList,
71
- spec
72
- };
73
- };
74
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/reducers/spec/utils.ts"],"names":["OAuthSession","diffPath","oAuthPath","getDefaultSpecKey","specs","items","Object","entries","length","Error","specKey","forEach","key","item","isDefault","status","keys","getSpecKey","location","pathName","pathname","returnUrl","sessionStorage","getItem","returnUrlKey","pathNodes","split","initDefaultSpecState","specList","spec"],"mappings":"AA4BA,SAASA,YAAT,QAA6B,iBAA7B;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,aAApC;AAWA,OAAO,IAAMC,iBAAiB,GAAIC,KAAD,IAA6B;AAC5D,MAAMC,KAAK,GAAGC,MAAM,CAACC,OAAP,CAAeH,KAAf,CAAd;;AAEA,MAAIC,KAAK,CAACG,MAAN,KAAiB,CAArB,EAAwB;AACtB,UAAMC,KAAK,CAAC,iBAAD,CAAX;AACD;;AAED,MAAIC,OAAO,GAAG,EAAd;AACAL,EAAAA,KAAK,CAACM,OAAN,CAAc,QAAiB;AAAA,QAAhB,CAACC,GAAD,EAAMC,IAAN,CAAgB;;AAC7B,QAAIA,IAAI,CAACC,SAAT,EAAoB;AAClBJ,MAAAA,OAAO,GAAGE,GAAV;AACD;AACF,GAJD;;AAMA,MAAI,CAACF,OAAL,EAAc;AACZL,IAAAA,KAAK,CAACM,OAAN,CAAc,SAAiB;AAAA,UAAhB,CAACC,GAAD,EAAMC,IAAN,CAAgB;;AAC7B,UAAIA,IAAI,CAACE,MAAL,KAAgB,SAApB,EAA+B;AAC7BL,QAAAA,OAAO,GAAGE,GAAV;AACD;AACF,KAJD;AAKD;;AAED,MAAI,CAACF,OAAL,EAAc;AACZA,IAAAA,OAAO,GAAGJ,MAAM,CAACU,IAAP,CAAYZ,KAAZ,EAAmB,CAAnB,CAAV;AACD;;AAED,MAAI,CAACM,OAAL,EAAc;AACZ,UAAMD,KAAK,CAAC,iBAAD,CAAX;AACD;;AAED,SAAOC,OAAP;AACD,CA/BM;AAsCP,OAAO,IAAMO,UAAU,GAAG,CAACC,QAAD,EAA6Bd,KAA7B,KAAkD;AAC1E,MAAIe,QAAQ,GAAGD,QAAQ,CAACE,QAAxB;;AACA,MAAID,QAAQ,gBAASjB,SAAT,CAAZ,EAAkC;AAChC,QAAMmB,SAAS,GAAGC,cAAc,CAACC,OAAf,CAAuBvB,YAAY,CAACwB,YAApC,CAAlB;;AACA,QAAIH,SAAJ,EAAe;AACbF,MAAAA,QAAQ,GAAGE,SAAX;AACD;AACF;;AACD,MAAMI,SAAS,GAAGN,QAAQ,CAACO,KAAT,CAAe,GAAf,CAAlB;AACA,MAAIhB,OAAO,GAAG,EAAd;;AACA,MACEe,SAAS,CAACjB,MAAV,GAAmB,CAAnB,IACAiB,SAAS,CAAC,CAAD,CADT,IAEAA,SAAS,CAAC,CAAD,CAAT,KAAiBvB,SAFjB,IAGAuB,SAAS,CAAC,CAAD,CAAT,KAAiBxB,QAJnB,EAKE;AACAS,IAAAA,OAAO,GAAGe,SAAS,CAAC,CAAD,CAAnB;AACD,GAPD,MAOO,IAAIrB,KAAJ,EAAW;AAChBM,IAAAA,OAAO,GAAGP,iBAAiB,CAACC,KAAD,CAA3B;AACD;;AACD,SAAOM,OAAP;AACD,CArBM;AA8BP,OAAO,IAAMiB,oBAAoB,GAAG,CAClCC,QADkC,EAElCV,QAFkC,KAGpB;AACd,MAAMR,OAAO,GAAGO,UAAU,CAACC,QAAD,EAAWU,QAAX,CAA1B;AAEA,MAAIC,IAAI,GAAGD,QAAQ,CAAClB,OAAD,CAAnB;;AACA,MAAI,CAACmB,IAAL,EAAW;AACTA,IAAAA,IAAI,GAAGD,QAAQ,CAAC,KAAD,CAAf;AACD;;AACD,SAAO;AACLA,IAAAA,QADK;AAELC,IAAAA;AAFK,GAAP;AAID,CAdM","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 { SpecList } from '@looker/sdk-codegen'\nimport type { Location as HLocation } from 'history'\nimport { OAuthSession } from '@looker/sdk-rtl'\nimport { diffPath, oAuthPath } from '../../utils'\nimport type { SpecState } from './reducer'\n\nexport type AbstractLocation = HLocation | Location\n\n/**\n * Given a collection of specs, it returns the spec marked as default, the one\n * marked as current or the first one, in that order.\n * @param specs A collection of specs\n * @returns A spec\n */\nexport const getDefaultSpecKey = (specs: SpecList): string => {\n const items = Object.entries(specs)\n\n if (items.length === 0) {\n throw Error('No specs found.')\n }\n\n let specKey = ''\n items.forEach(([key, item]) => {\n if (item.isDefault) {\n specKey = key\n }\n })\n\n if (!specKey) {\n items.forEach(([key, item]) => {\n if (item.status === 'current') {\n specKey = key\n }\n })\n }\n\n if (!specKey) {\n specKey = Object.keys(specs)[0]\n }\n\n if (!specKey) {\n throw Error('No specs found.')\n }\n\n return specKey\n}\n\n/**\n * Determine the API specification key from URL pattern or default spec\n * @param location service to examine\n * @param specs to use to find the default spec key\n */\nexport const getSpecKey = (location: AbstractLocation, specs?: SpecList) => {\n let pathName = location.pathname\n if (pathName === `/${oAuthPath}`) {\n const returnUrl = sessionStorage.getItem(OAuthSession.returnUrlKey)\n if (returnUrl) {\n pathName = returnUrl\n }\n }\n const pathNodes = pathName.split('/')\n let specKey = ''\n if (\n pathNodes.length > 1 &&\n pathNodes[1] &&\n pathNodes[1] !== oAuthPath &&\n pathNodes[1] !== diffPath\n ) {\n specKey = pathNodes[1]\n } else if (specs) {\n specKey = getDefaultSpecKey(specs)\n }\n return specKey\n}\n\n/**\n * Creates a default state object with the spec matching the specKey defined\n * in the url or the default criteria in getDefaultSpecKey\n * @param specList A collection of specs\n * @param location Standalone or extension location\n * @returns An object to be used as default state\n */\nexport const initDefaultSpecState = (\n specList: SpecList,\n location: AbstractLocation\n): SpecState => {\n const specKey = getSpecKey(location, specList)\n // Handle bad spec in the URL. Fall back to 4.0\n let spec = specList[specKey]\n if (!spec) {\n spec = specList['4.0']\n }\n return {\n specList,\n spec,\n }\n}\n"],"file":"utils.js"}
@@ -1,5 +0,0 @@
1
- import { registerEnvAdaptor, StandaloneEnvAdaptor } from '../utils';
2
- export var registerTestEnvAdaptor = envAdaptor => {
3
- registerEnvAdaptor(envAdaptor || new StandaloneEnvAdaptor());
4
- };
5
- //# sourceMappingURL=envAdaptor.js.map
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { renderWithTheme } from '@looker/components-test-utils';
3
- import { LodeContext } from '../context';
4
- import { withReduxProvider } from './redux';
5
-
6
- var withLode = (consumer, examples, declarations) => {
7
- return React.createElement(LodeContext.Provider, {
8
- value: {
9
- examples,
10
- declarations
11
- }
12
- }, consumer);
13
- };
14
-
15
- export var renderWithLode = (component, examples, declarations, options) => {
16
- return renderWithTheme(withLode(component, examples, declarations), options);
17
- };
18
- export var renderWithReduxProviderAndLode = (component, examples, declarations, store, options) => renderWithTheme(withReduxProvider(withLode(component, examples, declarations), store), options);
19
- //# sourceMappingURL=render_with_lode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/test-utils/render_with_lode.tsx"],"names":["React","renderWithTheme","LodeContext","withReduxProvider","withLode","consumer","examples","declarations","renderWithLode","component","options","renderWithReduxProviderAndLode","store"],"mappings":"AA2BA,OAAOA,KAAP,MAAkB,OAAlB;AAIA,SAASC,eAAT,QAAgC,+BAAhC;AAEA,SAASC,WAAT,QAA4B,YAA5B;AAEA,SAASC,iBAAT,QAAkC,SAAlC;;AAEA,IAAMC,QAAQ,GAAG,CACfC,QADe,EAEfC,QAFe,EAGfC,YAHe,KAIZ;AACH,SACE,oBAAC,WAAD,CAAa,QAAb;AAAsB,IAAA,KAAK,EAAE;AAAED,MAAAA,QAAF;AAAYC,MAAAA;AAAZ;AAA7B,KACGF,QADH,CADF;AAKD,CAVD;;AAYA,OAAO,IAAMG,cAAc,GAAG,CAC5BC,SAD4B,EAE5BH,QAF4B,EAG5BC,YAH4B,EAI5BG,OAJ4B,KAKzB;AACH,SAAOT,eAAe,CAACG,QAAQ,CAACK,SAAD,EAAYH,QAAZ,EAAsBC,YAAtB,CAAT,EAA8CG,OAA9C,CAAtB;AACD,CAPM;AASP,OAAO,IAAMC,8BAA8B,GAAG,CAC5CF,SAD4C,EAE5CH,QAF4C,EAG5CC,YAH4C,EAI5CK,KAJ4C,EAK5CF,OAL4C,KAO5CT,eAAe,CACbE,iBAAiB,CAACC,QAAQ,CAACK,SAAD,EAAYH,QAAZ,EAAsBC,YAAtB,CAAT,EAA8CK,KAA9C,CADJ,EAEbF,OAFa,CAPV","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 { ReactElement } from 'react'\nimport React from 'react'\nimport type { RenderOptions } from '@testing-library/react'\nimport type { Store } from 'redux'\n\nimport { renderWithTheme } from '@looker/components-test-utils'\nimport type { IDeclarationMine, IExampleMine } from '@looker/sdk-codegen'\nimport { LodeContext } from '../context'\nimport type { RootState } from '../state'\nimport { withReduxProvider } from './redux'\n\nconst withLode = (\n consumer: ReactElement<any>,\n examples: IExampleMine,\n declarations?: IDeclarationMine\n) => {\n return (\n <LodeContext.Provider value={{ examples, declarations }}>\n {consumer}\n </LodeContext.Provider>\n )\n}\n\nexport const renderWithLode = (\n component: ReactElement<any>,\n examples: IExampleMine,\n declarations?: IDeclarationMine,\n options?: Omit<RenderOptions, 'queries'>\n) => {\n return renderWithTheme(withLode(component, examples, declarations), options)\n}\n\nexport const renderWithReduxProviderAndLode = (\n component: ReactElement<any>,\n examples: IExampleMine,\n declarations?: IDeclarationMine,\n store?: Store<RootState>,\n options?: Omit<RenderOptions, 'queries'>\n) =>\n renderWithTheme(\n withReduxProvider(withLode(component, examples, declarations), store),\n options\n )\n"],"file":"render_with_lode.js"}
@@ -1,84 +0,0 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
-
3
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
-
5
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
7
- export var getThemeOverrides = useGoogleFonts => useGoogleFonts ? {
8
- loadGoogleFonts: true,
9
- themeCustomizations: {
10
- fontFamilies: {
11
- brand: 'Google Sans'
12
- },
13
- colors: {
14
- key: '#1A73E8'
15
- }
16
- }
17
- } : {
18
- themeCustomizations: {
19
- colors: {
20
- key: '#1A73E8'
21
- }
22
- }
23
- };
24
- export class StandaloneEnvAdaptor {
25
- constructor() {
26
- _defineProperty(this, "_themeOverrides", void 0);
27
-
28
- var {
29
- hostname
30
- } = location;
31
- this._themeOverrides = getThemeOverrides(hostname.endsWith('.looker.com') || hostname.endsWith('.google.com') || hostname === 'localhost' || hostname.startsWith('looker-developer-portal') && hostname.endsWith('.web.app'));
32
- }
33
-
34
- localStorageGetItem(key) {
35
- return _asyncToGenerator(function* () {
36
- return localStorage.getItem(key);
37
- })();
38
- }
39
-
40
- localStorageSetItem(key, value) {
41
- return _asyncToGenerator(function* () {
42
- yield localStorage.setItem(key, value);
43
- })();
44
- }
45
-
46
- localStorageRemoveItem(key) {
47
- return _asyncToGenerator(function* () {
48
- yield localStorage.removeItem(key);
49
- })();
50
- }
51
-
52
- themeOverrides() {
53
- return this._themeOverrides;
54
- }
55
-
56
- openBrowserWindow(url, target) {
57
- window.open(url, target);
58
- }
59
-
60
- logError(_error, _componentStack) {}
61
-
62
- }
63
- export var EnvAdaptorConstants;
64
-
65
- (function (EnvAdaptorConstants) {
66
- EnvAdaptorConstants["LOCALSTORAGE_SDK_LANGUAGE_KEY"] = "sdkLanguage";
67
- EnvAdaptorConstants["LOCALSTORAGE_SETTINGS_KEY"] = "settings";
68
- })(EnvAdaptorConstants || (EnvAdaptorConstants = {}));
69
-
70
- var envAdaptor;
71
- export var registerEnvAdaptor = adaptor => {
72
- envAdaptor = adaptor;
73
- };
74
- export var unregisterEnvAdaptor = () => {
75
- envAdaptor = undefined;
76
- };
77
- export var getEnvAdaptor = () => {
78
- if (!envAdaptor) {
79
- throw new Error('Environment adaptor not initialized.');
80
- }
81
-
82
- return envAdaptor;
83
- };
84
- //# sourceMappingURL=envAdaptor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/envAdaptor.ts"],"names":["getThemeOverrides","useGoogleFonts","loadGoogleFonts","themeCustomizations","fontFamilies","brand","colors","key","StandaloneEnvAdaptor","constructor","hostname","location","_themeOverrides","endsWith","startsWith","localStorageGetItem","localStorage","getItem","localStorageSetItem","value","setItem","localStorageRemoveItem","removeItem","themeOverrides","openBrowserWindow","url","target","window","open","logError","_error","_componentStack","EnvAdaptorConstants","envAdaptor","registerEnvAdaptor","adaptor","unregisterEnvAdaptor","undefined","getEnvAdaptor","Error"],"mappings":";;;;;;AAyDA,OAAO,IAAMA,iBAAiB,GAAIC,cAAD,IAC/BA,cAAc,GACV;AACEC,EAAAA,eAAe,EAAE,IADnB;AAEEC,EAAAA,mBAAmB,EAAE;AACnBC,IAAAA,YAAY,EAAE;AAAEC,MAAAA,KAAK,EAAE;AAAT,KADK;AAEnBC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,GAAG,EAAE;AAAP;AAFW;AAFvB,CADU,GAQV;AACEJ,EAAAA,mBAAmB,EAAE;AACnBG,IAAAA,MAAM,EAAE;AAAEC,MAAAA,GAAG,EAAE;AAAP;AADW;AADvB,CATC;AAkBP,OAAO,MAAMC,oBAAN,CAAsD;AAG3DC,EAAAA,WAAW,GAAG;AAAA;;AACZ,QAAM;AAAEC,MAAAA;AAAF,QAAeC,QAArB;AACA,SAAKC,eAAL,GAAuBZ,iBAAiB,CACtCU,QAAQ,CAACG,QAAT,CAAkB,aAAlB,KACEH,QAAQ,CAACG,QAAT,CAAkB,aAAlB,CADF,IAEEH,QAAQ,KAAK,WAFf,IAMGA,QAAQ,CAACI,UAAT,CAAoB,yBAApB,KACCJ,QAAQ,CAACG,QAAT,CAAkB,UAAlB,CARkC,CAAxC;AAUD;;AAEKE,EAAAA,mBAAmB,CAACR,GAAD,EAAc;AAAA;AACrC,aAAOS,YAAY,CAACC,OAAb,CAAqBV,GAArB,CAAP;AADqC;AAEtC;;AAEKW,EAAAA,mBAAmB,CAACX,GAAD,EAAcY,KAAd,EAA6B;AAAA;AACpD,YAAMH,YAAY,CAACI,OAAb,CAAqBb,GAArB,EAA0BY,KAA1B,CAAN;AADoD;AAErD;;AAEKE,EAAAA,sBAAsB,CAACd,GAAD,EAAc;AAAA;AACxC,YAAMS,YAAY,CAACM,UAAb,CAAwBf,GAAxB,CAAN;AADwC;AAEzC;;AAEDgB,EAAAA,cAAc,GAAG;AACf,WAAO,KAAKX,eAAZ;AACD;;AAEDY,EAAAA,iBAAiB,CAACC,GAAD,EAAcC,MAAd,EAA+B;AAC9CC,IAAAA,MAAM,CAACC,IAAP,CAAYH,GAAZ,EAAiBC,MAAjB;AACD;;AAEDG,EAAAA,QAAQ,CAACC,MAAD,EAAgBC,eAAhB,EAA+C,CAEtD;;AAvC0D;AA0C7D,WAAYC,mBAAZ;;WAAYA,mB;AAAAA,EAAAA,mB;AAAAA,EAAAA,mB;GAAAA,mB,KAAAA,mB;;AAKZ,IAAIC,UAAJ;AAKA,OAAO,IAAMC,kBAAkB,GAAIC,OAAD,IAA8B;AAC9DF,EAAAA,UAAU,GAAGE,OAAb;AACD,CAFM;AAOP,OAAO,IAAMC,oBAAoB,GAAG,MAAM;AACxCH,EAAAA,UAAU,GAAGI,SAAb;AACD,CAFM;AAOP,OAAO,IAAMC,aAAa,GAAG,MAAM;AACjC,MAAI,CAACL,UAAL,EAAiB;AACf,UAAM,IAAIM,KAAJ,CAAU,sCAAV,CAAN;AACD;;AACD,SAAON,UAAP;AACD,CALM","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 { ThemeCustomizations } from '@looker/design-tokens'\n\n/**\n * NOTE: This interface should describe all methods that require an adaptor when running in standalone vs extension mode\n * Examples include: local storage operations, writing to clipboard and various link navigation functions amongst others\n */\nexport interface IApixEnvAdaptor {\n /** Method for retrieving a keyed value from local storage */\n localStorageGetItem(key: string): Promise<string | null>\n /** Method for setting a keyed value in local storage */\n localStorageSetItem(key: string, value: string): void\n /** Method for removing a keyed value from local storage */\n localStorageRemoveItem(key: string): void\n /** Theme settings for extension */\n themeOverrides(): ThemeOverrides\n /** Open a new browser window with the given url and target */\n openBrowserWindow: (url: string, target?: string) => void\n /** error logger */\n logError: (error: Error, componentStack: string) => void\n}\n\n/**\n * Theme overrides used to load google fonts in Google environments only.\n * Google fonts should NOT be used when it is not obvious that a Google\n * system is being used (for example an embedded extension).\n */\nexport interface ThemeOverrides {\n loadGoogleFonts?: boolean\n themeCustomizations?: ThemeCustomizations\n}\n\nexport const getThemeOverrides = (useGoogleFonts: boolean): ThemeOverrides =>\n useGoogleFonts\n ? {\n loadGoogleFonts: true,\n themeCustomizations: {\n fontFamilies: { brand: 'Google Sans' },\n colors: { key: '#1A73E8' },\n },\n }\n : {\n themeCustomizations: {\n colors: { key: '#1A73E8' },\n },\n }\n\n/**\n * An adaptor class for interacting with browser APIs when running in standalone mode\n */\nexport class StandaloneEnvAdaptor implements IApixEnvAdaptor {\n private _themeOverrides: ThemeOverrides\n\n constructor() {\n const { hostname } = location\n this._themeOverrides = getThemeOverrides(\n hostname.endsWith('.looker.com') ||\n hostname.endsWith('.google.com') ||\n hostname === 'localhost' ||\n // Include firebase staging dev portal for now. Can be removed\n // when dev portal gets its own APIX project. Also includes\n // PRs.\n (hostname.startsWith('looker-developer-portal') &&\n hostname.endsWith('.web.app'))\n )\n }\n\n async localStorageGetItem(key: string) {\n return localStorage.getItem(key)\n }\n\n async localStorageSetItem(key: string, value: string) {\n await localStorage.setItem(key, value)\n }\n\n async localStorageRemoveItem(key: string) {\n await localStorage.removeItem(key)\n }\n\n themeOverrides() {\n return this._themeOverrides\n }\n\n openBrowserWindow(url: string, target?: string) {\n window.open(url, target)\n }\n\n logError(_error: Error, _componentStack: string): void {\n // noop - error logging for standalone APIX TBD\n }\n}\n\nexport enum EnvAdaptorConstants {\n LOCALSTORAGE_SDK_LANGUAGE_KEY = 'sdkLanguage',\n LOCALSTORAGE_SETTINGS_KEY = 'settings',\n}\n\nlet envAdaptor: IApixEnvAdaptor | undefined\n\n/**\n * Register the environment adaptor. The API Explorer will automatically call this.\n */\nexport const registerEnvAdaptor = (adaptor: IApixEnvAdaptor) => {\n envAdaptor = adaptor\n}\n\n/**\n * Unregister the envAdaptor. The API Explorer will automatically call this when it is unmounted.\n */\nexport const unregisterEnvAdaptor = () => {\n envAdaptor = undefined\n}\n\n/**\n * Global access to the envAdaptor. An error will be thrown if accessed prematurely.\n */\nexport const getEnvAdaptor = () => {\n if (!envAdaptor) {\n throw new Error('Environment adaptor not initialized.')\n }\n return envAdaptor\n}\n"],"file":"envAdaptor.js"}
@@ -1 +0,0 @@
1
- export * from './spec';
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _spec = require("./spec");
8
-
9
- Object.keys(_spec).forEach(function (key) {
10
- if (key === "default" || key === "__esModule") return;
11
- if (key in exports && exports[key] === _spec[key]) return;
12
- Object.defineProperty(exports, key, {
13
- enumerable: true,
14
- get: function get() {
15
- return _spec[key];
16
- }
17
- });
18
- });
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/reducers/index.ts"],"names":[],"mappings":";;;;;;AAyBA;;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 './spec'\n"],"file":"index.js"}