@cubejs-client/playground 0.30.64 → 0.30.69

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 (343) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/build/asset-manifest.json +38 -39
  3. package/build/index.html +1 -1
  4. package/build/static/js/{0.02594f93.chunk.js → 0.64a77202.chunk.js} +1 -1
  5. package/build/static/js/{1.c8a06f5c.chunk.js → 1.84dc809f.chunk.js} +1 -1
  6. package/build/static/js/12.bcc341fd.chunk.js +2 -0
  7. package/build/static/js/{12.cd98c051.chunk.js.LICENSE.txt → 12.bcc341fd.chunk.js.LICENSE.txt} +0 -0
  8. package/build/static/js/{13.d556f12b.chunk.js → 13.225a41b0.chunk.js} +2 -2
  9. package/build/static/js/{13.d556f12b.chunk.js.LICENSE.txt → 13.225a41b0.chunk.js.LICENSE.txt} +0 -0
  10. package/build/static/js/{14.121a8fef.chunk.js → 14.830e2de8.chunk.js} +1 -1
  11. package/build/static/js/{15.aa6297f6.chunk.js → 15.1cf21005.chunk.js} +1 -1
  12. package/build/static/js/{16.85736550.chunk.js → 16.b594c6b9.chunk.js} +1 -1
  13. package/build/static/js/{17.658b5ae1.chunk.js → 17.ef03a4ef.chunk.js} +1 -1
  14. package/build/static/js/{18.255a8226.chunk.js → 18.6fe6ea03.chunk.js} +1 -1
  15. package/build/static/js/{19.ea7b6d45.chunk.js → 19.bee7028d.chunk.js} +1 -1
  16. package/build/static/js/{2.736436ed.chunk.js → 2.6529d325.chunk.js} +1 -1
  17. package/build/static/js/{20.af7e46bc.chunk.js → 20.fbfe38ad.chunk.js} +1 -1
  18. package/build/static/js/{21.680b5025.chunk.js → 21.3b846768.chunk.js} +1 -1
  19. package/build/static/js/{22.7a7eb58a.chunk.js → 22.3d831bdd.chunk.js} +1 -1
  20. package/build/static/js/{23.8b5fb329.chunk.js → 23.11879d84.chunk.js} +1 -1
  21. package/build/static/js/{24.ca541af2.chunk.js → 24.ea6b5783.chunk.js} +1 -1
  22. package/build/static/js/{25.7d0691ff.chunk.js → 25.28af9662.chunk.js} +1 -1
  23. package/build/static/js/{26.9deefb3c.chunk.js → 26.2802b54d.chunk.js} +1 -1
  24. package/build/static/js/{27.b6d827bc.chunk.js → 27.9343a566.chunk.js} +1 -1
  25. package/build/static/js/{28.8a8aa58b.chunk.js → 28.6a697bc1.chunk.js} +1 -1
  26. package/build/static/js/{29.c98301d1.chunk.js → 29.48a92736.chunk.js} +1 -1
  27. package/build/static/js/{3.aad06a38.chunk.js → 3.89438de0.chunk.js} +1 -1
  28. package/build/static/js/{30.f6f33bfe.chunk.js → 30.c51d2183.chunk.js} +1 -1
  29. package/build/static/js/{31.a8b8f949.chunk.js → 31.769aa91a.chunk.js} +1 -1
  30. package/build/static/js/{32.499a9ec8.chunk.js → 32.5178d5a8.chunk.js} +1 -1
  31. package/build/static/js/{4.579a085f.chunk.js → 4.bbae5da8.chunk.js} +1 -1
  32. package/build/static/js/{5.64175f9b.chunk.js → 5.90428482.chunk.js} +1 -1
  33. package/build/static/js/{6.09b8a8f5.chunk.js → 6.174bdcce.chunk.js} +1 -1
  34. package/build/static/js/{7.f285bcb4.chunk.js → 7.9e2df43e.chunk.js} +1 -1
  35. package/build/static/js/{8.55aa8b64.chunk.js → 8.c6ac4466.chunk.js} +1 -1
  36. package/build/static/js/{9.20453ec7.chunk.js → 9.880d5f22.chunk.js} +1 -1
  37. package/build/static/js/main.c5efa901.chunk.js +1 -0
  38. package/build/static/js/runtime-main.89368897.js +1 -0
  39. package/lib/.tsbuildinfo +1 -1
  40. package/lib/App.js +99 -0
  41. package/lib/App.js.map +1 -0
  42. package/lib/ChartContainer.js +269 -0
  43. package/lib/ChartContainer.js.map +1 -0
  44. package/lib/DashboardSource.js +98 -0
  45. package/lib/DashboardSource.js.map +1 -0
  46. package/lib/PrismCode.js +15 -0
  47. package/lib/PrismCode.js.map +1 -0
  48. package/lib/QueryBuilder/ButtonDropdown.js +8 -0
  49. package/lib/QueryBuilder/ButtonDropdown.js.map +1 -0
  50. package/lib/QueryBuilder/FilterGroup.js +17 -0
  51. package/lib/QueryBuilder/FilterGroup.js.map +1 -0
  52. package/lib/QueryBuilder/FilterInput.js +21 -0
  53. package/lib/QueryBuilder/FilterInput.js.map +1 -0
  54. package/lib/QueryBuilder/MemberDropdown.js +130 -0
  55. package/lib/QueryBuilder/MemberDropdown.js.map +1 -0
  56. package/lib/QueryBuilder/MemberGroup.js +16 -0
  57. package/lib/QueryBuilder/MemberGroup.js.map +1 -0
  58. package/lib/QueryBuilder/MissingMemberTooltip.js +6 -0
  59. package/lib/QueryBuilder/MissingMemberTooltip.js.map +1 -0
  60. package/lib/QueryBuilder/RemoveButtonGroup.js +87 -0
  61. package/lib/QueryBuilder/RemoveButtonGroup.js.map +1 -0
  62. package/lib/QueryBuilder/SelectChartType.js +19 -0
  63. package/lib/QueryBuilder/SelectChartType.js.map +1 -0
  64. package/lib/QueryBuilder/TimeGroup.js +68 -0
  65. package/lib/QueryBuilder/TimeGroup.js.map +1 -0
  66. package/lib/__tests__/cube-graphql-converter.test.js +167 -0
  67. package/lib/__tests__/cube-graphql-converter.test.js.map +1 -0
  68. package/lib/atoms/Alert.js +31 -0
  69. package/lib/atoms/Alert.js.map +1 -0
  70. package/lib/atoms/Button.js +102 -0
  71. package/lib/atoms/Button.js.map +1 -0
  72. package/lib/atoms/Card.js +38 -0
  73. package/lib/atoms/Card.js.map +1 -0
  74. package/lib/atoms/CodeSnippet.js +51 -0
  75. package/lib/atoms/CodeSnippet.js.map +1 -0
  76. package/lib/atoms/CubeLoader.js +132 -0
  77. package/lib/atoms/CubeLoader.js.map +1 -0
  78. package/lib/atoms/Popover.js +10 -0
  79. package/lib/atoms/Popover.js.map +1 -0
  80. package/lib/atoms/index.d.ts +0 -1
  81. package/lib/atoms/index.js +7 -0
  82. package/lib/atoms/index.js.map +1 -0
  83. package/lib/{playground/cloud → cloud}/CloudProvider.d.ts +1 -1
  84. package/lib/cloud/CloudProvider.js +21 -0
  85. package/lib/cloud/CloudProvider.js.map +1 -0
  86. package/lib/{playground/cloud → cloud}/index.d.ts +0 -0
  87. package/lib/cloud/index.js +2 -0
  88. package/lib/cloud/index.js.map +1 -0
  89. package/lib/cloud/package.json +6 -0
  90. package/lib/components/AppContext.js +34 -0
  91. package/lib/components/AppContext.js.map +1 -0
  92. package/lib/components/CachePane.js +80 -0
  93. package/lib/components/CachePane.js.map +1 -0
  94. package/lib/components/ChartRenderer/ChartRenderer.js +119 -0
  95. package/lib/components/ChartRenderer/ChartRenderer.js.map +1 -0
  96. package/lib/components/CopiableInput.js +13 -0
  97. package/lib/components/CopiableInput.js.map +1 -0
  98. package/lib/components/DrilldownModal/DrilldownModal.js +22 -0
  99. package/lib/components/DrilldownModal/DrilldownModal.js.map +1 -0
  100. package/lib/components/DrilldownModal/TableQueryRenderer.js +52 -0
  101. package/lib/components/DrilldownModal/TableQueryRenderer.js.map +1 -0
  102. package/lib/{atoms → components/Error}/FatalError.d.ts +0 -0
  103. package/lib/components/Error/FatalError.js +23 -0
  104. package/lib/components/Error/FatalError.js.map +1 -0
  105. package/lib/components/Error/utils.d.ts +1 -0
  106. package/lib/components/Error/utils.js +69 -0
  107. package/lib/components/Error/utils.js.map +1 -0
  108. package/lib/components/GlobalStyles.js +291 -0
  109. package/lib/components/GlobalStyles.js.map +1 -0
  110. package/lib/components/GraphQL/CubeGraphQLConverter.js +445 -0
  111. package/lib/components/GraphQL/CubeGraphQLConverter.js.map +1 -0
  112. package/lib/components/GraphQL/GraphiQLSandbox.js +74 -0
  113. package/lib/components/GraphQL/GraphiQLSandbox.js.map +1 -0
  114. package/lib/components/Header/Header.js +28 -0
  115. package/lib/components/Header/Header.js.map +1 -0
  116. package/lib/components/Header/Menu.js +70 -0
  117. package/lib/components/Header/Menu.js.map +1 -0
  118. package/lib/components/Header/RunOnCubeCloud.js +36 -0
  119. package/lib/components/Header/RunOnCubeCloud.js.map +1 -0
  120. package/lib/components/Input.js +19 -0
  121. package/lib/components/Input.js.map +1 -0
  122. package/lib/components/LivePreviewContext/LivePreviewBar.js +18 -0
  123. package/lib/components/LivePreviewContext/LivePreviewBar.js.map +1 -0
  124. package/lib/components/LivePreviewContext/LivePreviewContextProvider.js +111 -0
  125. package/lib/components/LivePreviewContext/LivePreviewContextProvider.js.map +1 -0
  126. package/lib/components/Menu.js +33 -0
  127. package/lib/components/Menu.js.map +1 -0
  128. package/lib/components/Order/DraggableItem.js +18 -0
  129. package/lib/components/Order/DraggableItem.js.map +1 -0
  130. package/lib/components/Order/OrderGroup.js +9 -0
  131. package/lib/components/Order/OrderGroup.js.map +1 -0
  132. package/lib/components/Pivot/Axes.js +18 -0
  133. package/lib/components/Pivot/Axes.js.map +1 -0
  134. package/lib/components/Pivot/DroppableArea.js +22 -0
  135. package/lib/components/Pivot/DroppableArea.js.map +1 -0
  136. package/lib/components/Pivot/Item.js +14 -0
  137. package/lib/components/Pivot/Item.js.map +1 -0
  138. package/lib/components/Pivot/Options.js +8 -0
  139. package/lib/components/Pivot/Options.js.map +1 -0
  140. package/lib/components/PlaygroundQueryBuilder/QueryBuilderContainer.js +66 -0
  141. package/lib/components/PlaygroundQueryBuilder/QueryBuilderContainer.js.map +1 -0
  142. package/lib/components/PlaygroundQueryBuilder/components/PlaygroundQueryBuilder.js +216 -0
  143. package/lib/components/PlaygroundQueryBuilder/components/PlaygroundQueryBuilder.js.map +1 -0
  144. package/lib/components/PlaygroundQueryBuilder/components/PreAggregationStatus.js +25 -0
  145. package/lib/components/PlaygroundQueryBuilder/components/PreAggregationStatus.js.map +1 -0
  146. package/lib/components/PlaygroundQueryBuilder/components/index.js +2 -0
  147. package/lib/components/PlaygroundQueryBuilder/components/index.js.map +1 -0
  148. package/lib/components/QueryTabs/ChartRendererStateProvider.js +108 -0
  149. package/lib/components/QueryTabs/ChartRendererStateProvider.js.map +1 -0
  150. package/lib/components/QueryTabs/QueryTabs.js +188 -0
  151. package/lib/components/QueryTabs/QueryTabs.js.map +1 -0
  152. package/lib/components/SectionHeader.js +12 -0
  153. package/lib/components/SectionHeader.js.map +1 -0
  154. package/lib/components/SectionRow.js +14 -0
  155. package/lib/components/SectionRow.js.map +1 -0
  156. package/lib/components/SecurityContext/SecurityContext.js +103 -0
  157. package/lib/components/SecurityContext/SecurityContext.js.map +1 -0
  158. package/lib/components/SecurityContext/SecurityContextProvider.js +75 -0
  159. package/lib/components/SecurityContext/SecurityContextProvider.js.map +1 -0
  160. package/lib/components/Select.js +70 -0
  161. package/lib/components/Select.js.map +1 -0
  162. package/lib/components/Settings/Settings.js +25 -0
  163. package/lib/components/Settings/Settings.js.map +1 -0
  164. package/lib/components/SqlQueryTab.js +29 -0
  165. package/lib/components/SqlQueryTab.js.map +1 -0
  166. package/lib/components/Tabs.js +16 -0
  167. package/lib/components/Tabs.js.map +1 -0
  168. package/lib/components/Tree.js +17 -0
  169. package/lib/components/Tree.js.map +1 -0
  170. package/lib/components/index.js +8 -0
  171. package/lib/components/index.js.map +1 -0
  172. package/lib/events.js +82 -0
  173. package/lib/events.js.map +1 -0
  174. package/lib/grid/Box.js +6 -0
  175. package/lib/grid/Box.js.map +1 -0
  176. package/lib/grid/Flex.js +72 -0
  177. package/lib/grid/Flex.js.map +1 -0
  178. package/lib/grid/index.js +3 -0
  179. package/lib/grid/index.js.map +1 -0
  180. package/lib/hooks/app-context.js +18 -0
  181. package/lib/hooks/app-context.js.map +1 -0
  182. package/lib/hooks/cubejs-api.js +13 -0
  183. package/lib/hooks/cubejs-api.js.map +1 -0
  184. package/lib/hooks/deep-compare-memoize.js +10 -0
  185. package/lib/hooks/deep-compare-memoize.js.map +1 -0
  186. package/lib/hooks/deep-dependencies.js +10 -0
  187. package/lib/hooks/deep-dependencies.js.map +1 -0
  188. package/lib/hooks/deep-effect.js +7 -0
  189. package/lib/hooks/deep-effect.js.map +1 -0
  190. package/lib/hooks/deep-memo.js +7 -0
  191. package/lib/hooks/deep-memo.js.map +1 -0
  192. package/lib/hooks/identifier.js +6 -0
  193. package/lib/hooks/identifier.js.map +1 -0
  194. package/lib/hooks/index.js +16 -0
  195. package/lib/hooks/index.js.map +1 -0
  196. package/lib/hooks/is-mounted.js +13 -0
  197. package/lib/hooks/is-mounted.js.map +1 -0
  198. package/lib/hooks/live-preview-context.js +6 -0
  199. package/lib/hooks/live-preview-context.js.map +1 -0
  200. package/lib/hooks/local-storage.js +84 -0
  201. package/lib/hooks/local-storage.js.map +1 -0
  202. package/lib/hooks/security-context.js +6 -0
  203. package/lib/hooks/security-context.js.map +1 -0
  204. package/lib/hooks/server-core-version.js +17 -0
  205. package/lib/hooks/server-core-version.js.map +1 -0
  206. package/lib/hooks/setter.js +11 -0
  207. package/lib/hooks/setter.js.map +1 -0
  208. package/lib/hooks/toggle.js +6 -0
  209. package/lib/hooks/toggle.js.map +1 -0
  210. package/lib/hooks/window-size.js +27 -0
  211. package/lib/hooks/window-size.js.map +1 -0
  212. package/lib/img/db/athena.svg +21 -0
  213. package/lib/img/db/bigquery.svg +7 -0
  214. package/lib/img/db/clickhouse.svg +15 -0
  215. package/lib/img/db/crate.svg +9 -0
  216. package/lib/img/db/databricks.svg +17 -0
  217. package/lib/img/db/druid.svg +6 -0
  218. package/lib/img/db/firebolt.svg +11 -0
  219. package/lib/img/db/hive.svg +37 -0
  220. package/lib/img/db/materialize.svg +7 -0
  221. package/lib/img/db/mongodb.svg +5 -0
  222. package/lib/img/db/mssql.svg +19 -0
  223. package/lib/img/db/mysql.svg +10 -0
  224. package/lib/img/db/oracle.svg +10 -0
  225. package/lib/img/db/postgres.svg +10 -0
  226. package/lib/img/db/presto.svg +23 -0
  227. package/lib/img/db/questdb.svg +53 -0
  228. package/lib/img/db/redshift.svg +9 -0
  229. package/lib/img/db/snowflake.svg +9 -0
  230. package/lib/index.js +43 -25
  231. package/lib/index.js.map +1 -1
  232. package/lib/pages/ConnectionWizard/ConnectionWizardPage.js +185 -0
  233. package/lib/pages/ConnectionWizard/ConnectionWizardPage.js.map +1 -0
  234. package/lib/pages/ConnectionWizard/components/Base64Upload.js +55 -0
  235. package/lib/pages/ConnectionWizard/components/Base64Upload.js.map +1 -0
  236. package/lib/pages/ConnectionWizard/components/ConnectionTest.js +16 -0
  237. package/lib/pages/ConnectionWizard/components/ConnectionTest.js.map +1 -0
  238. package/lib/pages/ConnectionWizard/components/DatabaseCard.js +15 -0
  239. package/lib/pages/ConnectionWizard/components/DatabaseCard.js.map +1 -0
  240. package/lib/pages/ConnectionWizard/components/DatabaseForm.js +31 -0
  241. package/lib/pages/ConnectionWizard/components/DatabaseForm.js.map +1 -0
  242. package/lib/pages/ConnectionWizard/components/LocalhostTipBox.js +26 -0
  243. package/lib/pages/ConnectionWizard/components/LocalhostTipBox.js.map +1 -0
  244. package/lib/pages/Dashboard/DashboardPage.js +88 -0
  245. package/lib/pages/Dashboard/DashboardPage.js.map +1 -0
  246. package/lib/pages/Explore/ExplorePage.js +43 -0
  247. package/lib/pages/Explore/ExplorePage.js.map +1 -0
  248. package/lib/pages/Index/IndexPage.js +35 -0
  249. package/lib/pages/Index/IndexPage.js.map +1 -0
  250. package/lib/pages/Schema/SchemaPage.js +151 -0
  251. package/lib/pages/Schema/SchemaPage.js.map +1 -0
  252. package/lib/pages/TemplateGallery/CreateOwnModal.js +79 -0
  253. package/lib/pages/TemplateGallery/CreateOwnModal.js.map +1 -0
  254. package/lib/pages/TemplateGallery/TemplateGalleryPage.js +221 -0
  255. package/lib/pages/TemplateGallery/TemplateGalleryPage.js.map +1 -0
  256. package/lib/pages/index.js +7 -0
  257. package/lib/pages/index.js.map +1 -0
  258. package/lib/playground/components/PlaygroundWrapper.js +14 -0
  259. package/lib/playground/components/PlaygroundWrapper.js.map +1 -0
  260. package/lib/playground/components/QueryBuilder.js +11 -0
  261. package/lib/playground/components/QueryBuilder.js.map +1 -0
  262. package/lib/playground/index.d.ts +0 -3
  263. package/lib/playground/index.js +5 -0
  264. package/lib/playground/index.js.map +1 -0
  265. package/lib/{components/RollupDesigner → rollup-designer}/Context.d.ts +0 -0
  266. package/lib/rollup-designer/Context.js +67 -0
  267. package/lib/rollup-designer/Context.js.map +1 -0
  268. package/lib/{components/RollupDesigner → rollup-designer}/RollupDesigner.d.ts +0 -0
  269. package/lib/rollup-designer/RollupDesigner.js +289 -0
  270. package/lib/rollup-designer/RollupDesigner.js.map +1 -0
  271. package/lib/{components/RollupDesigner → rollup-designer}/components/Cubes.d.ts +1 -1
  272. package/lib/rollup-designer/components/Cubes.js +150 -0
  273. package/lib/rollup-designer/components/Cubes.js.map +1 -0
  274. package/lib/{components/RollupDesigner → rollup-designer}/components/MemberTag.d.ts +0 -0
  275. package/lib/rollup-designer/components/MemberTag.js +23 -0
  276. package/lib/rollup-designer/components/MemberTag.js.map +1 -0
  277. package/lib/{components/RollupDesigner → rollup-designer}/components/Members.d.ts +0 -0
  278. package/lib/rollup-designer/components/Members.js +19 -0
  279. package/lib/rollup-designer/components/Members.js.map +1 -0
  280. package/lib/{components/RollupDesigner → rollup-designer}/components/RollupDesignerModal.d.ts +0 -0
  281. package/lib/rollup-designer/components/RollupDesignerModal.js +12 -0
  282. package/lib/rollup-designer/components/RollupDesignerModal.js.map +1 -0
  283. package/lib/{components/RollupDesigner → rollup-designer}/components/Settings.d.ts +0 -0
  284. package/lib/rollup-designer/components/Settings.js +129 -0
  285. package/lib/rollup-designer/components/Settings.js.map +1 -0
  286. package/lib/{components/RollupDesigner → rollup-designer}/components/TimeDimension.d.ts +0 -0
  287. package/lib/rollup-designer/components/TimeDimension.js +13 -0
  288. package/lib/rollup-designer/components/TimeDimension.js.map +1 -0
  289. package/lib/{components/RollupDesigner → rollup-designer}/components/cube-member-search.d.ts +0 -0
  290. package/lib/rollup-designer/components/cube-member-search.js +42 -0
  291. package/lib/rollup-designer/components/cube-member-search.js.map +1 -0
  292. package/lib/{components/RollupDesigner → rollup-designer}/index.d.ts +0 -0
  293. package/lib/rollup-designer/index.js +3 -0
  294. package/lib/rollup-designer/index.js.map +1 -0
  295. package/lib/rollup-designer/package.json +6 -0
  296. package/lib/{components/RollupDesigner → rollup-designer}/utils.d.ts +1 -1
  297. package/lib/rollup-designer/utils.js +177 -0
  298. package/lib/rollup-designer/utils.js.map +1 -0
  299. package/lib/shared/env-vars-db-map.js +146 -0
  300. package/lib/shared/env-vars-db-map.js.map +1 -0
  301. package/lib/shared/helpers.d.ts +0 -22
  302. package/lib/shared/helpers.js +57 -0
  303. package/lib/shared/helpers.js.map +1 -0
  304. package/lib/shared/icons/CubejsIcon.js +6 -0
  305. package/lib/shared/icons/CubejsIcon.js.map +1 -0
  306. package/lib/shared/icons/DiscourseIcon.js +3 -0
  307. package/lib/shared/icons/DiscourseIcon.js.map +1 -0
  308. package/lib/shared/icons/GraphQLIcon.js +6 -0
  309. package/lib/shared/icons/GraphQLIcon.js.map +1 -0
  310. package/lib/shared/icons/LightningIcon.js +3 -0
  311. package/lib/shared/icons/LightningIcon.js.map +1 -0
  312. package/lib/shared/members.d.ts +12 -0
  313. package/lib/shared/members.js +32 -0
  314. package/lib/shared/members.js.map +1 -0
  315. package/lib/shared/request.d.ts +10 -0
  316. package/lib/shared/request.js +20 -0
  317. package/lib/shared/request.js.map +1 -0
  318. package/lib/shared/time-zones.js +352 -0
  319. package/lib/shared/time-zones.js.map +1 -0
  320. package/lib/theme.js +11 -0
  321. package/lib/theme.js.map +1 -0
  322. package/lib/types.js +2 -0
  323. package/lib/types.js.map +1 -0
  324. package/lib/utils.js +191 -0
  325. package/lib/utils.js.map +1 -0
  326. package/lib/variables.js +78 -0
  327. package/lib/variables.js.map +1 -0
  328. package/package.json +9 -13
  329. package/build/static/js/12.cd98c051.chunk.js +0 -2
  330. package/build/static/js/main.7e80ccd9.chunk.js +0 -1
  331. package/build/static/js/runtime-main.16dc4544.js +0 -1
  332. package/build/static/media/index.a22be0b6.less +0 -19
  333. package/lib/CachePane-fd78a370.js +0 -110
  334. package/lib/CachePane-fd78a370.js.map +0 -1
  335. package/lib/GraphiQLSandbox-8fe8a7e7.js +0 -519
  336. package/lib/GraphiQLSandbox-8fe8a7e7.js.map +0 -1
  337. package/lib/SqlQueryTab-d97bd53f.js +0 -55
  338. package/lib/SqlQueryTab-d97bd53f.js.map +0 -1
  339. package/lib/antd.min.css +0 -2
  340. package/lib/index-0dc9f6d3.js +0 -5800
  341. package/lib/index-0dc9f6d3.js.map +0 -1
  342. package/lib/sqlFormatter-e711219f.js +0 -1611
  343. package/lib/sqlFormatter-e711219f.js.map +0 -1
@@ -1 +0,0 @@
1
- !function(e){function t(t){for(var n,a,f=t[0],u=t[1],d=t[2],i=0,s=[];i<f.length;i++)a=f[i],Object.prototype.hasOwnProperty.call(c,a)&&c[a]&&s.push(c[a][0]),c[a]=0;for(n in u)Object.prototype.hasOwnProperty.call(u,n)&&(e[n]=u[n]);for(l&&l(t);s.length;)s.shift()();return o.push.apply(o,d||[]),r()}function r(){for(var e,t=0;t<o.length;t++){for(var r=o[t],n=!0,a=1;a<r.length;a++){var u=r[a];0!==c[u]&&(n=!1)}n&&(o.splice(t--,1),e=f(f.s=r[0]))}return e}var n={},a={11:0},c={11:0},o=[];function f(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.e=function(e){var t=[];a[e]?t.push(a[e]):0!==a[e]&&{13:1}[e]&&t.push(a[e]=new Promise((function(t,r){for(var n="static/css/"+({}[e]||e)+"."+{0:"31d6cfe0",1:"31d6cfe0",2:"31d6cfe0",3:"31d6cfe0",4:"31d6cfe0",5:"31d6cfe0",6:"31d6cfe0",7:"31d6cfe0",8:"31d6cfe0",9:"31d6cfe0",13:"ea0ece1a",14:"31d6cfe0",15:"31d6cfe0",16:"31d6cfe0",17:"31d6cfe0",18:"31d6cfe0",19:"31d6cfe0",20:"31d6cfe0",21:"31d6cfe0",22:"31d6cfe0",23:"31d6cfe0",24:"31d6cfe0",25:"31d6cfe0",26:"31d6cfe0",27:"31d6cfe0",28:"31d6cfe0",29:"31d6cfe0",30:"31d6cfe0",31:"31d6cfe0",32:"31d6cfe0"}[e]+".chunk.css",c=f.p+n,o=document.getElementsByTagName("link"),u=0;u<o.length;u++){var d=(l=o[u]).getAttribute("data-href")||l.getAttribute("href");if("stylesheet"===l.rel&&(d===n||d===c))return t()}var i=document.getElementsByTagName("style");for(u=0;u<i.length;u++){var l;if((d=(l=i[u]).getAttribute("data-href"))===n||d===c)return t()}var s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.onload=t,s.onerror=function(t){var n=t&&t.target&&t.target.src||c,o=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");o.code="CSS_CHUNK_LOAD_FAILED",o.request=n,delete a[e],s.parentNode.removeChild(s),r(o)},s.href=c,document.getElementsByTagName("head")[0].appendChild(s)})).then((function(){a[e]=0})));var r=c[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=c[e]=[t,n]}));t.push(r[2]=n);var o,u=document.createElement("script");u.charset="utf-8",u.timeout=120,f.nc&&u.setAttribute("nonce",f.nc),u.src=function(e){return f.p+"static/js/"+({}[e]||e)+"."+{0:"02594f93",1:"c8a06f5c",2:"736436ed",3:"aad06a38",4:"579a085f",5:"64175f9b",6:"09b8a8f5",7:"f285bcb4",8:"55aa8b64",9:"20453ec7",13:"d556f12b",14:"121a8fef",15:"aa6297f6",16:"85736550",17:"658b5ae1",18:"255a8226",19:"ea7b6d45",20:"af7e46bc",21:"680b5025",22:"7a7eb58a",23:"8b5fb329",24:"ca541af2",25:"7d0691ff",26:"9deefb3c",27:"b6d827bc",28:"8a8aa58b",29:"c98301d1",30:"f6f33bfe",31:"a8b8f949",32:"499a9ec8"}[e]+".chunk.js"}(e);var d=new Error;o=function(t){u.onerror=u.onload=null,clearTimeout(i);var r=c[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;d.message="Loading chunk "+e+" failed.\n("+n+": "+a+")",d.name="ChunkLoadError",d.type=n,d.request=a,r[1](d)}c[e]=void 0}};var i=setTimeout((function(){o({type:"timeout",target:u})}),12e4);u.onerror=u.onload=o,document.head.appendChild(u)}return Promise.all(t)},f.m=e,f.c=n,f.d=function(e,t,r){f.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},f.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,t){if(1&t&&(e=f(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(f.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)f.d(r,n,function(t){return e[t]}.bind(null,n));return r},f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,"a",t),t},f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f.p="./",f.oe=function(e){throw console.error(e),e};var u=this["webpackJsonp@cubejs-client/playground"]=this["webpackJsonp@cubejs-client/playground"]||[],d=u.push.bind(u);u.push=t,u=u.slice();for(var i=0;i<u.length;i++)t(u[i]);var l=d;r()}([]);
@@ -1,19 +0,0 @@
1
- @import '../../node_modules/antd/dist/antd.less';
2
- @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap&css');
3
-
4
- .ant-tabs-dropdown-menu-item {
5
- display: flex;
6
- place-content: center space-between;
7
- }
8
-
9
- button.ant-tabs-dropdown-menu-item-remove {
10
- -webkit-appearance: none;
11
- border: none;
12
- border-radius: var(--radius);
13
- background: rgba(var(--purple-color-rgb), 0);
14
- cursor: pointer;
15
- }
16
-
17
- button.ant-tabs-dropdown-menu-item-remove:hover {
18
- background: rgba(var(--purple-color-rgb), .16);
19
- }
@@ -1,110 +0,0 @@
1
- import { _ as __assign, F as FatalError, P as PrismCode } from './index-0dc9f6d3.js';
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { CheckOutlined, CloseOutlined } from '@ant-design/icons';
4
- import { Tabs, Table } from 'antd';
5
- import { QueryRenderer } from '@cubejs-client/react';
6
- import { s as sqlFormatter } from './sqlFormatter-e711219f.js';
7
- import 'react';
8
- import 'fast-deep-equal';
9
- import 'react-router-dom';
10
- import 'styled-components';
11
- import 'jwt-decode';
12
- import '@cubejs-client/core';
13
- import 'anser';
14
- import 'html-entities';
15
- import 'mitt';
16
- import 'flexsearch';
17
- import 'cron-validator';
18
- import 'camel-case';
19
- import 'uuid';
20
- import 'codesandbox-import-utils/lib/api/define';
21
- import 'react-hotkeys-hook';
22
- import 'antd/lib/typography/Text';
23
- import 'react-beautiful-dnd';
24
- import 'throttle-debounce';
25
- import 'moment';
26
-
27
- var CachePane = function (_a) {
28
- var query = _a.query;
29
- return (jsx(QueryRenderer, { loadSql: true, query: __assign(__assign({}, query), { renewQuery: true }), render: function (_a) {
30
- var _b;
31
- var sqlQuery = _a.sqlQuery, resultSet = _a.resultSet, error = _a.error;
32
- if (error) {
33
- return jsx(FatalError, { error: error }, void 0);
34
- }
35
- var rs = (resultSet === null || resultSet === void 0 ? void 0 : resultSet.serialize()) || {};
36
- var rawQuery = sqlQuery === null || sqlQuery === void 0 ? void 0 : sqlQuery.rawQuery();
37
- var loadResponse = (_b = rs.loadResponse) === null || _b === void 0 ? void 0 : _b.results[0];
38
- return (jsxs(Tabs, __assign({ defaultActiveKey: "refreshKeys", tabBarExtraContent: jsxs("span", { children: ["Last Refresh Time:\u00A0", jsx("b", { children: loadResponse === null || loadResponse === void 0 ? void 0 : loadResponse.lastRefreshTime }, void 0)] }, void 0) }, { children: [jsx(Tabs.TabPane, __assign({ tab: "Refresh Keys" }, { children: jsx(Table, { loading: !sqlQuery, pagination: false, scroll: { x: true }, columns: [
39
- {
40
- title: 'Refresh Key SQL',
41
- key: 'refreshKey',
42
- render: function (text, record) { return (jsx(PrismCode, { code: sqlFormatter.format(record[0]) }, void 0)); },
43
- },
44
- {
45
- title: 'Value',
46
- key: 'value',
47
- render: function (text, record) { return (jsx(PrismCode, { code: (loadResponse === null || loadResponse === void 0 ? void 0 : loadResponse.refreshKeyValues) &&
48
- rawQuery &&
49
- JSON.stringify(loadResponse.refreshKeyValues[rawQuery.cacheKeyQueries.indexOf(record)], null, 2) }, void 0)); },
50
- },
51
- ], dataSource: rawQuery === null || rawQuery === void 0 ? void 0 : rawQuery.cacheKeyQueries }, void 0) }), "refreshKeys"), jsx(Tabs.TabPane, __assign({ tab: "Pre-aggregations" }, { children: jsx(Table, { loading: !sqlQuery, pagination: false, scroll: { x: true }, columns: [
52
- {
53
- title: 'Table Name',
54
- key: 'tableName',
55
- dataIndex: 'tableName',
56
- render: function (text) { return jsx("b", { children: text }, void 0); },
57
- },
58
- {
59
- title: 'Refresh Key SQL',
60
- key: 'refreshKey',
61
- dataIndex: 'invalidateKeyQueries',
62
- render: function (refreshKeyQueries) {
63
- return refreshKeyQueries.map(function (q) { return (jsx(PrismCode, { code: sqlFormatter.format(q[0]) }, q[0])); });
64
- },
65
- },
66
- {
67
- title: 'Refresh Key Value',
68
- key: 'value',
69
- render: function (text, record) {
70
- var _a, _b;
71
- var refreshKeyValues = (_b = (_a = loadResponse === null || loadResponse === void 0 ? void 0 : loadResponse.usedPreAggregations) === null || _a === void 0 ? void 0 : _a[record.tableName]) === null || _b === void 0 ? void 0 : _b.refreshKeyValues;
72
- if (Array.isArray(refreshKeyValues)) {
73
- refreshKeyValues = refreshKeyValues.reduce(function (a, b) { return a.concat(b); }, []);
74
- }
75
- return refreshKeyValues === null || refreshKeyValues === void 0 ? void 0 : refreshKeyValues.map(function (k) { return (jsx(PrismCode, { code: JSON.stringify(k, null, 2) }, JSON.stringify(k))); });
76
- }
77
- },
78
- ], dataSource: rawQuery === null || rawQuery === void 0 ? void 0 : rawQuery.preAggregations }, void 0) }), "preAggregations"), jsx(Tabs.TabPane, __assign({ tab: "Rollup Match Results" }, { children: jsx(Table, { loading: !sqlQuery, pagination: false, scroll: { x: true }, columns: [
79
- {
80
- title: 'Rollup Name',
81
- key: 'name',
82
- dataIndex: 'name',
83
- render: function (text) { return jsx("b", { children: text }, void 0); },
84
- },
85
- {
86
- title: 'Rollup Definition',
87
- key: 'rollup',
88
- dataIndex: 'references',
89
- render: function (text) { return (jsx(PrismCode, { code: JSON.stringify(text, null, 2) }, void 0)); },
90
- },
91
- {
92
- title: 'Can Be Used',
93
- key: 'canUsePreAggregation',
94
- dataIndex: 'canUsePreAggregation',
95
- render: function (text) {
96
- return text ? (jsx(CheckOutlined, { style: {
97
- color: '#52c41a',
98
- fontSize: '2em',
99
- } }, void 0)) : (jsx(CloseOutlined, { style: {
100
- color: '#c2371b',
101
- fontSize: '2em',
102
- } }, void 0));
103
- },
104
- },
105
- ], dataSource: rawQuery === null || rawQuery === void 0 ? void 0 : rawQuery.rollupMatchResults }, void 0) }), "rollupMatchResults")] }), void 0));
106
- } }, void 0));
107
- };
108
-
109
- export { CachePane as default };
110
- //# sourceMappingURL=CachePane-fd78a370.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CachePane-fd78a370.js","sources":["../src/components/CachePane.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","format"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;IAQM,SAAS,GAAG,UAAC,EAAS;QAAP,KAAK,WAAA;IAAO,QAC/BA,IAAC,aAAa,IACZ,OAAO,QACP,KAAK,wBAAO,KAAK,KAAE,UAAU,EAAE,IAAI,KACnC,MAAM,EAAE,UAAC,EAA8B;;gBAA5B,QAAQ,cAAA,EAAE,SAAS,eAAA,EAAE,KAAK,WAAA;YACnC,IAAI,KAAK,EAAE;gBACT,OAAOA,IAAC,UAAU,IAAC,KAAK,EAAE,KAAK,WAAI,CAAC;aACrC;YAED,IAAM,EAAE,GAAQ,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS,EAAE,KAAI,EAAE,CAAC;YAC7C,IAAM,QAAQ,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,EAAE,CAAC;YACtC,IAAM,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@@
1
- import { u as uniqArray, a as unCapitalize, _ as __assign, b as __spreadArray, c as useSecurityContext, d as useToken, m as metaToTypes, e as useDeepMemo, f as __makeTemplateObject } from './index-0dc9f6d3.js';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { createGraphiQLFetcher } from '@graphiql/toolkit';
4
- import GraphiQL from 'graphiql';
5
- import styled from 'styled-components';
6
- import { useMemo } from 'react';
7
- import 'graphiql/graphiql.min.css';
8
- import * as t from 'graphql/language';
9
- import '@cubejs-client/core';
10
- import 'fast-deep-equal';
11
- import 'react-router-dom';
12
- import 'jwt-decode';
13
- import 'antd';
14
- import '@ant-design/icons';
15
- import 'anser';
16
- import 'html-entities';
17
- import 'mitt';
18
- import '@cubejs-client/react';
19
- import 'flexsearch';
20
- import 'cron-validator';
21
- import 'camel-case';
22
- import 'uuid';
23
- import 'codesandbox-import-utils/lib/api/define';
24
- import 'react-hotkeys-hook';
25
- import 'antd/lib/typography/Text';
26
- import 'react-beautiful-dnd';
27
- import 'throttle-debounce';
28
- import 'moment';
29
-
30
- var singleValueOperators = ['gt', 'gte', 'lt', 'lte'];
31
- var operatorsMap = {
32
- equals: 'in',
33
- notEquals: 'notIn',
34
- notSet: 'set',
35
- };
36
- var FilterKind;
37
- (function (FilterKind) {
38
- FilterKind["AND"] = "AND";
39
- FilterKind["OR"] = "OR";
40
- FilterKind["PLAIN"] = "PLAIN";
41
- })(FilterKind || (FilterKind = {}));
42
- function baseCubeQuery(args, members, name) {
43
- if (name === void 0) { name = 'CubeQuery'; }
44
- return {
45
- kind: t.Kind.DOCUMENT,
46
- definitions: [
47
- {
48
- kind: t.Kind.OPERATION_DEFINITION,
49
- name: {
50
- kind: t.Kind.NAME,
51
- value: name,
52
- },
53
- operation: 'query',
54
- selectionSet: {
55
- kind: t.Kind.SELECTION_SET,
56
- selections: [
57
- {
58
- kind: t.Kind.FIELD,
59
- name: {
60
- kind: t.Kind.NAME,
61
- value: 'cube',
62
- },
63
- arguments: args,
64
- selectionSet: {
65
- kind: t.Kind.SELECTION_SET,
66
- selections: members,
67
- },
68
- },
69
- ],
70
- },
71
- },
72
- ],
73
- };
74
- }
75
- var CubeGraphQLConverter = /** @class */ (function () {
76
- function CubeGraphQLConverter(cubeQuery, types) {
77
- this.cubeQuery = cubeQuery;
78
- this.types = types;
79
- this.cubes = {};
80
- this.prepareCubes();
81
- }
82
- CubeGraphQLConverter.prototype.convert = function () {
83
- return t.print(baseCubeQuery(this.getCubeArgs(), this.getFieldsSelections()));
84
- };
85
- CubeGraphQLConverter.prototype.resolveFilter = function (filter, parent) {
86
- var _this = this;
87
- var plainFilters = Object.values(filter.reduce(function (memo, f) {
88
- if (f.or || f.and) {
89
- return memo;
90
- }
91
- var _a = (f.member || f.dimension).split('.'), cubeName = _a[0], field = _a[1];
92
- if (!memo[cubeName]) {
93
- memo[cubeName] = {
94
- kind: FilterKind.PLAIN,
95
- cubeName: cubeName,
96
- fields: [],
97
- filters: [],
98
- };
99
- }
100
- memo[cubeName].fields.push(field);
101
- memo[cubeName].filters.push(f);
102
- return memo;
103
- }, {}));
104
- var booleanFilters = filter
105
- .map(function (f) {
106
- if (f.and || f.or) {
107
- return {
108
- kind: f.and ? FilterKind.AND : FilterKind.OR,
109
- filters: f.and || f.or,
110
- };
111
- }
112
- return false;
113
- })
114
- .filter(Boolean);
115
- var groupedFilters = plainFilters.concat(booleanFilters);
116
- return groupedFilters.map(function (item) {
117
- if (item.kind !== FilterKind.PLAIN) {
118
- if (parent) {
119
- return _this.objectValue([
120
- _this.booleanFilter(item.kind, _this.resolveFilter(item.filters, item)),
121
- ]);
122
- }
123
- return _this.booleanFilter(item.kind, _this.resolveFilter(item.filters, item));
124
- }
125
- if (item.fields.length === uniqArray(item.fields).length) {
126
- if (parent) {
127
- return _this.objectValue(_this.objectFieldFilter(item.filters), unCapitalize(item.cubeName));
128
- }
129
- return _this.objectFieldFilter(item.filters, unCapitalize(item.cubeName));
130
- }
131
- else {
132
- return _this.objectField(_this.booleanFilter((parent === null || parent === void 0 ? void 0 : parent.kind) || 'AND', item.filters.map(function (f) {
133
- if (f.and || f.or) {
134
- _this.resolveFilter(item.filters, item.kind);
135
- }
136
- return _this.objectValue(_this.objectFieldFilter(f));
137
- })), unCapitalize(item.cubeName));
138
- }
139
- });
140
- };
141
- CubeGraphQLConverter.prototype.objectValue = function (fields, filedName) {
142
- if (filedName) {
143
- return {
144
- kind: t.Kind.OBJECT,
145
- fields: [
146
- {
147
- kind: t.Kind.OBJECT_FIELD,
148
- name: {
149
- kind: t.Kind.NAME,
150
- value: filedName,
151
- },
152
- value: {
153
- kind: t.Kind.OBJECT,
154
- fields: Array.isArray(fields) ? fields : [fields],
155
- },
156
- },
157
- ],
158
- };
159
- }
160
- return {
161
- kind: t.Kind.OBJECT,
162
- fields: Array.isArray(fields) ? fields : [fields],
163
- };
164
- };
165
- CubeGraphQLConverter.prototype.objectFieldFilter = function (filter, parentName) {
166
- var _this = this;
167
- var filters = Array.isArray(filter) ? filter : [filter];
168
- var value = function (f) {
169
- var kind = _this.types[f.member || f.dimension] === 'number'
170
- ? t.Kind.FLOAT
171
- : t.Kind.STRING;
172
- if (['set', 'notSet'].includes(f.operator)) {
173
- return {
174
- kind: t.Kind.BOOLEAN,
175
- value: f.operator === 'set',
176
- };
177
- }
178
- if (typeof f.values === 'string') {
179
- return {
180
- kind: kind,
181
- value: f.values,
182
- };
183
- }
184
- if (f.values.length === 1) {
185
- return {
186
- kind: kind,
187
- value: f.values[0].toString(),
188
- };
189
- }
190
- return {
191
- kind: t.Kind.LIST,
192
- values: f.values.map(function (v) { return ({
193
- kind: kind,
194
- value: v,
195
- }); }),
196
- };
197
- };
198
- var fields = filters.map(function (f) {
199
- var memberName = f.member || f.dimension;
200
- if (!_this.types[memberName]) {
201
- throw new Error("Unknown member type for \"".concat(memberName, "\". Make sure \"").concat(memberName, "\" exists in the schema."));
202
- }
203
- if (singleValueOperators.includes(f.operator) &&
204
- (f.values || []).length > 1) {
205
- throw new Error("Filter operator \"".concat(f.operator, "\" must have a single value"));
206
- }
207
- return {
208
- kind: t.Kind.OBJECT_FIELD,
209
- name: {
210
- kind: t.Kind.NAME,
211
- value: memberName.split('.')[1],
212
- },
213
- value: {
214
- kind: t.Kind.OBJECT,
215
- fields: f.values === undefined && !['set', 'notSet'].includes(f.operator)
216
- ? []
217
- : [
218
- {
219
- kind: t.Kind.OBJECT_FIELD,
220
- name: {
221
- kind: t.Kind.NAME,
222
- // A single value maps to "equals"
223
- // Whereas multiple values for "equals" operator maps to "in"
224
- // value: operatorsMap[f.operator] || f.operator,
225
- value: f.operator === 'equals' && (f.values || []).length <= 1
226
- ? f.operator
227
- : operatorsMap[f.operator] || f.operator,
228
- },
229
- value: value(f),
230
- },
231
- ],
232
- },
233
- };
234
- });
235
- if (parentName) {
236
- return [
237
- {
238
- kind: t.Kind.OBJECT_FIELD,
239
- name: {
240
- kind: t.Kind.NAME,
241
- value: parentName,
242
- },
243
- value: {
244
- kind: t.Kind.OBJECT,
245
- fields: fields,
246
- },
247
- },
248
- ];
249
- }
250
- return fields;
251
- };
252
- CubeGraphQLConverter.prototype.objectField = function (fields, fieldName) {
253
- return {
254
- kind: t.Kind.OBJECT_FIELD,
255
- name: {
256
- kind: t.Kind.NAME,
257
- value: fieldName,
258
- },
259
- value: {
260
- kind: t.Kind.OBJECT,
261
- fields: Array.isArray(fields) ? fields : [fields],
262
- },
263
- };
264
- };
265
- // OR: [{ orders: { status: { equals: "active"} }}]
266
- CubeGraphQLConverter.prototype.booleanFilter = function (kind, values) {
267
- return {
268
- kind: t.Kind.OBJECT_FIELD,
269
- name: {
270
- kind: t.Kind.NAME,
271
- value: kind,
272
- },
273
- value: {
274
- kind: t.Kind.LIST,
275
- values: values,
276
- },
277
- };
278
- };
279
- CubeGraphQLConverter.prototype.orderByArg = function (orderBy) {
280
- return {
281
- kind: t.Kind.ARGUMENT,
282
- name: {
283
- kind: t.Kind.NAME,
284
- value: 'orderBy',
285
- },
286
- value: {
287
- kind: t.Kind.OBJECT,
288
- fields: orderBy.map(function (_a) {
289
- var field = _a[0], value = _a[1];
290
- return ({
291
- kind: t.Kind.OBJECT_FIELD,
292
- name: {
293
- kind: t.Kind.NAME,
294
- value: field,
295
- },
296
- value: {
297
- kind: t.Kind.ENUM,
298
- value: value,
299
- },
300
- });
301
- }),
302
- },
303
- };
304
- };
305
- CubeGraphQLConverter.prototype.getFieldsSelections = function () {
306
- var _this = this;
307
- var selections = [];
308
- Object.entries(this.cubes).forEach(function (_a) {
309
- var cubeName = _a[0], _b = _a[1], fields = _b.fields, orderBy = _b.orderBy;
310
- selections.push({
311
- kind: t.Kind.FIELD,
312
- name: {
313
- kind: t.Kind.NAME,
314
- value: cubeName,
315
- },
316
- arguments: orderBy.length ? [_this.orderByArg(orderBy)] : [],
317
- selectionSet: {
318
- kind: t.Kind.SELECTION_SET,
319
- selections: fields.map(function (field) {
320
- var granularitySelection = null;
321
- if (field.granularities) {
322
- granularitySelection = {
323
- selectionSet: {
324
- kind: t.Kind.SELECTION_SET,
325
- selections: field.granularities.map(function (value) { return ({
326
- kind: t.Kind.FIELD,
327
- name: {
328
- kind: t.Kind.NAME,
329
- value: value,
330
- },
331
- }); }),
332
- },
333
- };
334
- }
335
- return __assign({ kind: t.Kind.FIELD, name: {
336
- kind: t.Kind.NAME,
337
- value: field.name,
338
- } }, granularitySelection);
339
- }),
340
- },
341
- });
342
- });
343
- return selections;
344
- };
345
- CubeGraphQLConverter.prototype.getCubeArgs = function () {
346
- var _this = this;
347
- var cubeArgsKeys = [
348
- ['timezone', t.Kind.STRING],
349
- ['limit', t.Kind.INT],
350
- ['offset', t.Kind.INT],
351
- ];
352
- var cubeArgs = [];
353
- cubeArgsKeys.forEach(function (_a) {
354
- var key = _a[0], kind = _a[1];
355
- if (_this.cubeQuery[key]) {
356
- cubeArgs.push({
357
- kind: t.Kind.ARGUMENT,
358
- name: {
359
- kind: t.Kind.NAME,
360
- value: key,
361
- },
362
- value: {
363
- kind: kind,
364
- value: _this.cubeQuery[key],
365
- },
366
- });
367
- }
368
- });
369
- var filters = __spreadArray([], (this.cubeQuery.filters || []), true);
370
- (this.cubeQuery.timeDimensions || []).forEach(function (td) {
371
- if (td.dateRange) {
372
- filters.push({
373
- member: td.dimension,
374
- operator: 'inDateRange',
375
- values: td.dateRange,
376
- });
377
- }
378
- });
379
- if (filters.length) {
380
- cubeArgs.push({
381
- kind: t.Kind.ARGUMENT,
382
- name: {
383
- kind: t.Kind.NAME,
384
- value: 'where',
385
- },
386
- value: {
387
- kind: t.Kind.OBJECT,
388
- fields: this.resolveFilter(filters),
389
- },
390
- });
391
- }
392
- return cubeArgs;
393
- };
394
- CubeGraphQLConverter.prototype.prepareCubes = function () {
395
- var _this = this;
396
- var _a;
397
- var initCube = function (cubeName) {
398
- if (!_this.cubes[cubeName]) {
399
- _this.cubes[cubeName] = {
400
- fields: [],
401
- filters: [],
402
- orderBy: [],
403
- };
404
- }
405
- };
406
- ['measures', 'dimensions', 'segments'].forEach(function (key) {
407
- if (!_this.cubeQuery[key]) {
408
- return;
409
- }
410
- _this.cubeQuery[key].forEach(function (value) {
411
- var _a = value.split('.'), name = _a[0], field = _a[1], granularity = _a[2];
412
- var cubeName = unCapitalize(name);
413
- var gqlGranularity = granularity;
414
- if (_this.types["".concat(name, ".").concat(field)] === 'time') {
415
- gqlGranularity = 'value';
416
- }
417
- initCube(cubeName);
418
- // eslint-disable-next-line
419
- var currentField = _this.cubes[cubeName].fields.find(function (_a) {
420
- var name = _a.name;
421
- return name === field;
422
- });
423
- _this.cubes[cubeName].fields.push(__assign({ name: field }, (gqlGranularity
424
- ? {
425
- granularities: __spreadArray(__spreadArray([], ((currentField === null || currentField === void 0 ? void 0 : currentField.granularities) || []), true), [
426
- gqlGranularity,
427
- ], false),
428
- }
429
- : null)));
430
- });
431
- });
432
- var map = {};
433
- (_a = this.cubeQuery.timeDimensions) === null || _a === void 0 ? void 0 : _a.forEach(function (td) {
434
- var _a = td.dimension.split('.'), name = _a[0], field = _a[1];
435
- var cubeFieldName = "".concat(name, ".").concat(field);
436
- if (td.granularity) {
437
- map[cubeFieldName] = (map[cubeFieldName] || []).concat([
438
- td.granularity,
439
- ]);
440
- }
441
- });
442
- Object.entries(map).forEach(function (_a) {
443
- var cubeField = _a[0], granularities = _a[1];
444
- var _b = cubeField.split('.'), name = _b[0], field = _b[1];
445
- var cubeName = unCapitalize(name);
446
- initCube(cubeName);
447
- var existingField = _this.cubes[cubeName].fields.find(function (f) { return f.name === field; });
448
- if (existingField) {
449
- existingField.granularities = uniqArray(__spreadArray(__spreadArray([], (existingField.granularities || []), true), granularities, true));
450
- }
451
- else {
452
- _this.cubes[cubeName].fields.push({
453
- name: field,
454
- granularities: granularities,
455
- });
456
- }
457
- });
458
- if (this.cubeQuery.order) {
459
- var orderBy = Array.isArray(this.cubeQuery.order)
460
- ? this.cubeQuery.order
461
- : Object.entries(this.cubeQuery.order);
462
- orderBy.forEach(function (_a) {
463
- var key = _a[0], order = _a[1];
464
- var _b = key.split('.'), cubeName = _b[0], member = _b[1];
465
- var gqlCubeName = unCapitalize(cubeName);
466
- if (!_this.cubes[gqlCubeName]) {
467
- throw new Error("Order without selecting the cube is not allowed. Did you forget to include the \"".concat(cubeName, "\" cube?"));
468
- }
469
- var exists = _this.cubes[gqlCubeName].fields.find(function (_a) {
470
- var name = _a.name;
471
- return name === member;
472
- });
473
- if (!exists) {
474
- throw new Error("Order without selecting the member is not allowed. Did you forget to include the \"".concat(member, "\" member?"));
475
- }
476
- _this.cubes[gqlCubeName].orderBy.push([member, order]);
477
- });
478
- }
479
- };
480
- return CubeGraphQLConverter;
481
- }());
482
-
483
- var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-top: -15px;\n height: 400px;\n border-radius: 8px;\n overflow: hidden;\n\n .graphiql-container {\n box-sizing: initial;\n\n * {\n box-sizing: initial;\n }\n\n .topBar {\n background: none;\n }\n\n .docExplorerShow {\n border-left: none;\n background: none;\n }\n\n .CodeMirror-scroll,\n .CodeMirror-lines {\n background: white;\n }\n\n .doc-explorer-title-bar {\n height: 50px;\n }\n }\n"], ["\n margin-top: -15px;\n height: 400px;\n border-radius: 8px;\n overflow: hidden;\n\n .graphiql-container {\n box-sizing: initial;\n\n * {\n box-sizing: initial;\n }\n\n .topBar {\n background: none;\n }\n\n .docExplorerShow {\n border-left: none;\n background: none;\n }\n\n .CodeMirror-scroll,\n .CodeMirror-lines {\n background: white;\n }\n\n .doc-explorer-title-bar {\n height: 50px;\n }\n }\n"])));
484
- function GraphiQLSandbox(_a) {
485
- var apiUrl = _a.apiUrl, query = _a.query, meta = _a.meta;
486
- var securityContextToken = useSecurityContext().token;
487
- var playgroundToken = useToken();
488
- var token = securityContextToken || playgroundToken;
489
- var fetcher = useMemo(function () {
490
- return createGraphiQLFetcher({
491
- url: apiUrl.replace('/v1', '/graphql'),
492
- headers: token
493
- ? {
494
- authorization: token,
495
- }
496
- : {},
497
- });
498
- }, [apiUrl, token]);
499
- var types = useMemo(function () {
500
- return metaToTypes(meta);
501
- }, [meta]);
502
- var gqlQuery = useDeepMemo(function () {
503
- if (!types) {
504
- return '';
505
- }
506
- try {
507
- var converter = new CubeGraphQLConverter(query, types);
508
- return converter.convert().replace('{', ' { ').replace('}', ' } ');
509
- }
510
- catch (error) {
511
- return "# ".concat(error, "\n");
512
- }
513
- }, [query, types]);
514
- return (jsx(Wrapper, { children: jsx(GraphiQL, { query: gqlQuery, fetcher: fetcher }, void 0) }, void 0));
515
- }
516
- var templateObject_1;
517
-
518
- export { GraphiQLSandbox as default };
519
- //# sourceMappingURL=GraphiQLSandbox-8fe8a7e7.js.map