drizzle-cube 0.5.5 → 0.5.7

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 (241) hide show
  1. package/dist/{server/dist-DxegvyZF.cjs → adapters/dist-BOdf-GQO.cjs} +1 -1
  2. package/dist/adapters/express/index.cjs +1 -1
  3. package/dist/adapters/express/index.js +4 -4
  4. package/dist/adapters/fastify/index.cjs +2 -2
  5. package/dist/adapters/fastify/index.js +4 -4
  6. package/dist/adapters/{google-CT4kgmBf.js → google-CFYljAOF.js} +1 -1
  7. package/dist/adapters/{google-Dgo9-Kb5.cjs → google-DUlXeeDA.cjs} +1 -1
  8. package/dist/adapters/{handler-C1Qs8JMY.cjs → handler-C63rJUUK.cjs} +3 -3
  9. package/dist/adapters/{handler-CoaNnZyf.js → handler-Dz1F4iwf.js} +7 -4
  10. package/dist/adapters/hono/index.cjs +1 -1
  11. package/dist/adapters/hono/index.js +4 -4
  12. package/dist/adapters/{locale-CTuvUGBs.cjs → locale-CTNwPVZI.cjs} +6 -6
  13. package/dist/adapters/{locale-wMBdZ3Ks.js → locale-gU_d1Wja.js} +19 -2
  14. package/dist/adapters/mcp-tools.cjs +1 -1
  15. package/dist/adapters/mcp-tools.js +2 -2
  16. package/dist/adapters/mcp-transport-C4J4SAcn.cjs +40 -0
  17. package/dist/adapters/mcp-transport-CVUiifEc.js +579 -0
  18. package/dist/adapters/nextjs/index.cjs +1 -1
  19. package/dist/adapters/nextjs/index.js +4 -4
  20. package/dist/adapters/{openai-BjLV_Wjx.cjs → openai-6wrBvAnv.cjs} +1 -1
  21. package/dist/adapters/openai-BDwb2u7y.cjs +17 -0
  22. package/dist/{server/openai-CLWSwD-D.js → adapters/openai-DiVskd89.js} +1 -1
  23. package/dist/{server/openai-zpXlGbbF.js → adapters/openai-y7GhJNdn.js} +2062 -928
  24. package/dist/adapters/{utils-CIRA5_JO.cjs → utils-CkEkU8Bo.cjs} +4 -4
  25. package/dist/adapters/{utils-hC7Z8V39.js → utils-DosuoabY.js} +33 -19
  26. package/dist/adapters/utils.cjs +1 -1
  27. package/dist/adapters/utils.js +1 -1
  28. package/dist/client/charts.js +13 -13
  29. package/dist/client/chunks/{DashboardEditModal-DayTXEH0.js → DashboardEditModal-6KRE36mm.js} +6232 -3454
  30. package/dist/client/chunks/DashboardEditModal-6KRE36mm.js.map +1 -0
  31. package/dist/client/chunks/{RetentionCombinedChart-D3dRmoos.js → RetentionCombinedChart-CCpu0C-s.js} +4 -4
  32. package/dist/client/chunks/{RetentionCombinedChart-D3dRmoos.js.map → RetentionCombinedChart-CCpu0C-s.js.map} +1 -1
  33. package/dist/client/chunks/{RetentionHeatmap-DHPnn0qH.js → RetentionHeatmap-B24PiIfr.js} +3 -3
  34. package/dist/client/chunks/{RetentionHeatmap-DHPnn0qH.js.map → RetentionHeatmap-B24PiIfr.js.map} +1 -1
  35. package/dist/client/chunks/{af-ZA-BtTNqvHF.js → af-ZA-BTaChuqI.js} +3 -1
  36. package/dist/client/chunks/af-ZA-BTaChuqI.js.map +1 -0
  37. package/dist/client/chunks/{analysis-builder-shared-6BRZcEnu.js → analysis-builder-shared-x576-O5p.js} +289 -289
  38. package/dist/client/chunks/{analysis-builder-shared-6BRZcEnu.js.map → analysis-builder-shared-x576-O5p.js.map} +1 -1
  39. package/dist/client/chunks/{analysis-builder-lcGl099d.js → analysis-builder-zd48FVJO.js} +244 -244
  40. package/dist/client/chunks/{analysis-builder-lcGl099d.js.map → analysis-builder-zd48FVJO.js.map} +1 -1
  41. package/dist/client/chunks/{chart-activity-grid-BnY-jaoa.js → chart-activity-grid-CiHrLH6Y.js} +8 -6
  42. package/dist/client/chunks/chart-activity-grid-CiHrLH6Y.js.map +1 -0
  43. package/dist/client/chunks/{chart-area-G3OvLLK4.js → chart-area-CXFK-Grv.js} +39 -38
  44. package/dist/client/chunks/chart-area-CXFK-Grv.js.map +1 -0
  45. package/dist/client/chunks/{chart-bar-MLIWiLrc.js → chart-bar-DKXfLoGG.js} +53 -52
  46. package/dist/client/chunks/chart-bar-DKXfLoGG.js.map +1 -0
  47. package/dist/client/chunks/{chart-box-plot-c2XqKTWq.js → chart-box-plot-Bu9hy-17.js} +3 -3
  48. package/dist/client/chunks/{chart-box-plot-c2XqKTWq.js.map → chart-box-plot-Bu9hy-17.js.map} +1 -1
  49. package/dist/client/chunks/{chart-bubble-CAGvnYb1.js → chart-bubble-DGkTQlxM.js} +3 -3
  50. package/dist/client/chunks/{chart-bubble-CAGvnYb1.js.map → chart-bubble-DGkTQlxM.js.map} +1 -1
  51. package/dist/client/chunks/{chart-candlestick-oSPk-KQp.js → chart-candlestick-Dau5AF4E.js} +3 -3
  52. package/dist/client/chunks/{chart-candlestick-oSPk-KQp.js.map → chart-candlestick-Dau5AF4E.js.map} +1 -1
  53. package/dist/client/chunks/{chart-config-activity-grid-Dssynumw.js → chart-config-activity-grid-D_UX4NHC.js} +2 -2
  54. package/dist/client/chunks/{chart-config-activity-grid-Dssynumw.js.map → chart-config-activity-grid-D_UX4NHC.js.map} +1 -1
  55. package/dist/client/chunks/{chart-config-area-40fbx2Ah.js → chart-config-area-Bq_UsW3x.js} +3 -2
  56. package/dist/client/chunks/chart-config-area-Bq_UsW3x.js.map +1 -0
  57. package/dist/client/chunks/{chart-config-bar-CUWHwOPN.js → chart-config-bar-_JEGZnAu.js} +3 -2
  58. package/dist/client/chunks/chart-config-bar-_JEGZnAu.js.map +1 -0
  59. package/dist/client/chunks/{chart-config-box-plot-D3Y0ien3.js → chart-config-box-plot-DJ-dWWXA.js} +2 -2
  60. package/dist/client/chunks/{chart-config-box-plot-D3Y0ien3.js.map → chart-config-box-plot-DJ-dWWXA.js.map} +1 -1
  61. package/dist/client/chunks/{chart-config-bubble-BXSTKLn-.js → chart-config-bubble-gIoqVyjZ.js} +2 -2
  62. package/dist/client/chunks/{chart-config-bubble-BXSTKLn-.js.map → chart-config-bubble-gIoqVyjZ.js.map} +1 -1
  63. package/dist/client/chunks/{chart-config-candlestick-DEuD2Av0.js → chart-config-candlestick-N6DchAA3.js} +2 -2
  64. package/dist/client/chunks/{chart-config-candlestick-DEuD2Av0.js.map → chart-config-candlestick-N6DchAA3.js.map} +1 -1
  65. package/dist/client/chunks/{chart-config-data-table-BQXSn4b_.js → chart-config-data-table-d7VBY-y_.js} +2 -2
  66. package/dist/client/chunks/{chart-config-data-table-BQXSn4b_.js.map → chart-config-data-table-d7VBY-y_.js.map} +1 -1
  67. package/dist/client/chunks/{chart-config-funnel-BzEsHmjR.js → chart-config-funnel-DEYMcxsD.js} +2 -2
  68. package/dist/client/chunks/{chart-config-funnel-BzEsHmjR.js.map → chart-config-funnel-DEYMcxsD.js.map} +1 -1
  69. package/dist/client/chunks/{chart-config-gauge-CCva3FfA.js → chart-config-gauge-DSwC04l0.js} +2 -2
  70. package/dist/client/chunks/{chart-config-gauge-CCva3FfA.js.map → chart-config-gauge-DSwC04l0.js.map} +1 -1
  71. package/dist/client/chunks/{chart-config-heat-map-Db4Z8UUn.js → chart-config-heat-map-CfRnRNcw.js} +2 -2
  72. package/dist/client/chunks/{chart-config-heat-map-Db4Z8UUn.js.map → chart-config-heat-map-CfRnRNcw.js.map} +1 -1
  73. package/dist/client/chunks/{chart-config-kpi-delta-BfLf3iyi.js → chart-config-kpi-delta-D6BIkHL3.js} +2 -2
  74. package/dist/client/chunks/{chart-config-kpi-delta-BfLf3iyi.js.map → chart-config-kpi-delta-D6BIkHL3.js.map} +1 -1
  75. package/dist/client/chunks/{chart-config-kpi-number-DWKFc9PX.js → chart-config-kpi-number-Bx-V9a62.js} +2 -2
  76. package/dist/client/chunks/{chart-config-kpi-number-DWKFc9PX.js.map → chart-config-kpi-number-Bx-V9a62.js.map} +1 -1
  77. package/dist/client/chunks/{chart-config-kpi-text-Dr4OG6cY.js → chart-config-kpi-text-CcqC1u-8.js} +2 -2
  78. package/dist/client/chunks/{chart-config-kpi-text-Dr4OG6cY.js.map → chart-config-kpi-text-CcqC1u-8.js.map} +1 -1
  79. package/dist/client/chunks/{chart-config-line-DGYYdDw9.js → chart-config-line-Db3jDsWc.js} +3 -2
  80. package/dist/client/chunks/chart-config-line-Db3jDsWc.js.map +1 -0
  81. package/dist/client/chunks/{chart-config-markdown-C-_g_8te.js → chart-config-markdown-BtRIe8JN.js} +2 -2
  82. package/dist/client/chunks/{chart-config-markdown-C-_g_8te.js.map → chart-config-markdown-BtRIe8JN.js.map} +1 -1
  83. package/dist/client/chunks/{chart-config-measure-profile-sB3n_Azv.js → chart-config-measure-profile-DxRGa-zf.js} +2 -2
  84. package/dist/client/chunks/{chart-config-measure-profile-sB3n_Azv.js.map → chart-config-measure-profile-DxRGa-zf.js.map} +1 -1
  85. package/dist/client/chunks/{chart-config-pie-kte7OXa9.js → chart-config-pie-DD4SmRTF.js} +2 -2
  86. package/dist/client/chunks/{chart-config-pie-kte7OXa9.js.map → chart-config-pie-DD4SmRTF.js.map} +1 -1
  87. package/dist/client/chunks/{chart-config-radar-C9IxP5tc.js → chart-config-radar-CC2XAaGr.js} +2 -2
  88. package/dist/client/chunks/{chart-config-radar-C9IxP5tc.js.map → chart-config-radar-CC2XAaGr.js.map} +1 -1
  89. package/dist/client/chunks/{chart-config-radial-bar-C3WJ8Uhm.js → chart-config-radial-bar-DmxKx1R0.js} +2 -2
  90. package/dist/client/chunks/{chart-config-radial-bar-C3WJ8Uhm.js.map → chart-config-radial-bar-DmxKx1R0.js.map} +1 -1
  91. package/dist/client/chunks/{chart-config-sankey-DGAThN9i.js → chart-config-sankey-BTnWA7EW.js} +2 -2
  92. package/dist/client/chunks/{chart-config-sankey-DGAThN9i.js.map → chart-config-sankey-BTnWA7EW.js.map} +1 -1
  93. package/dist/client/chunks/{chart-config-scatter-BVN_29G5.js → chart-config-scatter-DSYTjwRb.js} +2 -2
  94. package/dist/client/chunks/{chart-config-scatter-BVN_29G5.js.map → chart-config-scatter-DSYTjwRb.js.map} +1 -1
  95. package/dist/client/chunks/{chart-config-sunburst-utejM2YS.js → chart-config-sunburst-Bwjtdf7X.js} +2 -2
  96. package/dist/client/chunks/{chart-config-sunburst-utejM2YS.js.map → chart-config-sunburst-Bwjtdf7X.js.map} +1 -1
  97. package/dist/client/chunks/{chart-config-tree-map-meeJEDi8.js → chart-config-tree-map-BI-oQStO.js} +2 -2
  98. package/dist/client/chunks/{chart-config-tree-map-meeJEDi8.js.map → chart-config-tree-map-BI-oQStO.js.map} +1 -1
  99. package/dist/client/chunks/{chart-config-waterfall-CaPeWZMl.js → chart-config-waterfall-DSnyixbI.js} +2 -2
  100. package/dist/client/chunks/{chart-config-waterfall-CaPeWZMl.js.map → chart-config-waterfall-DSnyixbI.js.map} +1 -1
  101. package/dist/client/chunks/{chart-data-table-BRXHT2H-.js → chart-data-table-Cm5jrpaw.js} +853 -843
  102. package/dist/client/chunks/chart-data-table-Cm5jrpaw.js.map +1 -0
  103. package/dist/client/chunks/{chart-funnel-aQ7G_CqU.js → chart-funnel-Eke8IPtG.js} +3 -3
  104. package/dist/client/chunks/{chart-funnel-aQ7G_CqU.js.map → chart-funnel-Eke8IPtG.js.map} +1 -1
  105. package/dist/client/chunks/{chart-gauge-DqbDKr9E.js → chart-gauge-DeRZNsyl.js} +3 -3
  106. package/dist/client/chunks/{chart-gauge-DqbDKr9E.js.map → chart-gauge-DeRZNsyl.js.map} +1 -1
  107. package/dist/client/chunks/{chart-heat-map--6QnhUM8.js → chart-heat-map-C86thSJ4.js} +3 -3
  108. package/dist/client/chunks/{chart-heat-map--6QnhUM8.js.map → chart-heat-map-C86thSJ4.js.map} +1 -1
  109. package/dist/client/chunks/{chart-kpi-delta-DOSpRjfs.js → chart-kpi-delta-CxOYD2f1.js} +74 -72
  110. package/dist/client/chunks/{chart-kpi-delta-DOSpRjfs.js.map → chart-kpi-delta-CxOYD2f1.js.map} +1 -1
  111. package/dist/client/chunks/{chart-kpi-number-BcMjeKm8.js → chart-kpi-number-C6gWz-x4.js} +65 -64
  112. package/dist/client/chunks/{chart-kpi-number-BcMjeKm8.js.map → chart-kpi-number-C6gWz-x4.js.map} +1 -1
  113. package/dist/client/chunks/{chart-kpi-text-BI9isc2i.js → chart-kpi-text-dDONrhS-.js} +27 -26
  114. package/dist/client/chunks/{chart-kpi-text-BI9isc2i.js.map → chart-kpi-text-dDONrhS-.js.map} +1 -1
  115. package/dist/client/chunks/{chart-line-C0IHQteu.js → chart-line-r4iWevKZ.js} +119 -118
  116. package/dist/client/chunks/chart-line-r4iWevKZ.js.map +1 -0
  117. package/dist/client/chunks/{chart-markdown-BmgSMqPg.js → chart-markdown-BPW-EAm9.js} +940 -943
  118. package/dist/client/chunks/chart-markdown-BPW-EAm9.js.map +1 -0
  119. package/dist/client/chunks/{chart-measure-profile-DEyLW1fd.js → chart-measure-profile-BI3kADCp.js} +4 -4
  120. package/dist/client/chunks/{chart-measure-profile-DEyLW1fd.js.map → chart-measure-profile-BI3kADCp.js.map} +1 -1
  121. package/dist/client/chunks/{chart-pie-DSIekr7p.js → chart-pie-yqH2YVEI.js} +4 -4
  122. package/dist/client/chunks/{chart-pie-DSIekr7p.js.map → chart-pie-yqH2YVEI.js.map} +1 -1
  123. package/dist/client/chunks/{chart-radar-SGl62hK8.js → chart-radar-B-_3v-rE.js} +4 -4
  124. package/dist/client/chunks/{chart-radar-SGl62hK8.js.map → chart-radar-B-_3v-rE.js.map} +1 -1
  125. package/dist/client/chunks/{chart-radial-bar-C42EykOa.js → chart-radial-bar-C0EgzfAF.js} +4 -4
  126. package/dist/client/chunks/{chart-radial-bar-C42EykOa.js.map → chart-radial-bar-C0EgzfAF.js.map} +1 -1
  127. package/dist/client/chunks/{chart-sankey-DguImp0W.js → chart-sankey-CFzjGvZX.js} +3 -3
  128. package/dist/client/chunks/{chart-sankey-DguImp0W.js.map → chart-sankey-CFzjGvZX.js.map} +1 -1
  129. package/dist/client/chunks/{chart-scatter-Doeox4OP.js → chart-scatter-DZPirzwX.js} +4 -4
  130. package/dist/client/chunks/{chart-scatter-Doeox4OP.js.map → chart-scatter-DZPirzwX.js.map} +1 -1
  131. package/dist/client/chunks/{chart-sunburst-F3tgCpL-.js → chart-sunburst-91Q2tzaB.js} +4 -4
  132. package/dist/client/chunks/{chart-sunburst-F3tgCpL-.js.map → chart-sunburst-91Q2tzaB.js.map} +1 -1
  133. package/dist/client/chunks/{chart-tree-map-DvuSCIc8.js → chart-tree-map-Bi4axCvh.js} +4 -4
  134. package/dist/client/chunks/{chart-tree-map-DvuSCIc8.js.map → chart-tree-map-Bi4axCvh.js.map} +1 -1
  135. package/dist/client/chunks/{chart-waterfall-Be5duXlO.js → chart-waterfall-DcHbbPaG.js} +4 -4
  136. package/dist/client/chunks/{chart-waterfall-Be5duXlO.js.map → chart-waterfall-DcHbbPaG.js.map} +1 -1
  137. package/dist/client/chunks/{charts-core-XlOwoP_r.js → charts-core-CrBDYN6N.js} +2 -2
  138. package/dist/client/chunks/{charts-core-XlOwoP_r.js.map → charts-core-CrBDYN6N.js.map} +1 -1
  139. package/dist/client/chunks/{core-Dk6z6kC0.js → core-DsAWNRRv.js} +87 -85
  140. package/dist/client/chunks/{core-Dk6z6kC0.js.map → core-DsAWNRRv.js.map} +1 -1
  141. package/dist/client/chunks/{dist-eZurnOde.js → dist-zPWyTBdU.js} +38 -32
  142. package/dist/client/chunks/dist-zPWyTBdU.js.map +1 -0
  143. package/dist/client/chunks/{en-US-5xPTdCXg.js → en-US-BE6VoG0o.js} +1 -1
  144. package/dist/client/chunks/{en-US-5xPTdCXg.js.map → en-US-BE6VoG0o.js.map} +1 -1
  145. package/dist/client/chunks/{exceljs.min-DaJsLlWM.js → exceljs.min-CIqBqwTW.js} +71 -45
  146. package/dist/client/chunks/{exceljs.min-DaJsLlWM.js.map → exceljs.min-CIqBqwTW.js.map} +1 -1
  147. package/dist/client/chunks/{javascript-DFvvCuoP.js → javascript-DFnKaHmQ.js} +3 -3
  148. package/dist/client/chunks/{javascript-DFvvCuoP.js.map → javascript-DFnKaHmQ.js.map} +1 -1
  149. package/dist/client/chunks/{json-BBm9TlrA.js → json-Cu6rbgWf.js} +1 -1
  150. package/dist/client/chunks/{json-BBm9TlrA.js.map → json-Cu6rbgWf.js.map} +1 -1
  151. package/dist/client/chunks/{nl-NL-BLDeSy_P.js → nl-NL-oyr2wENY.js} +3 -1
  152. package/dist/client/chunks/nl-NL-oyr2wENY.js.map +1 -0
  153. package/dist/client/chunks/{providers-DX3Vw5kc.js → providers-DwQCKdGW.js} +1 -1
  154. package/dist/client/chunks/{providers-DX3Vw5kc.js.map → providers-DwQCKdGW.js.map} +1 -1
  155. package/dist/client/chunks/{retention-YhT1Oohi.js → retention-ChW9jYdy.js} +1 -1
  156. package/dist/client/chunks/{retention-YhT1Oohi.js.map → retention-ChW9jYdy.js.map} +1 -1
  157. package/dist/client/chunks/{rolldown-runtime-CCl2IeXn.js → rolldown-runtime-CWhphoD1.js} +1 -1
  158. package/dist/client/chunks/{schema-visualization-CM5ikSWB.js → schema-visualization-BszcrmZX.js} +294 -290
  159. package/dist/client/chunks/{schema-visualization-CM5ikSWB.js.map → schema-visualization-BszcrmZX.js.map} +1 -1
  160. package/dist/client/chunks/{sql-k0GA6oZ_.js → sql-CmVzGP4w.js} +1 -1
  161. package/dist/client/chunks/{sql-k0GA6oZ_.js.map → sql-CmVzGP4w.js.map} +1 -1
  162. package/dist/client/chunks/{useDebounce-NEZQbfxN.js → useDirtyStateTracking-B5wCDJSj.js} +99 -37
  163. package/dist/client/chunks/useDirtyStateTracking-B5wCDJSj.js.map +1 -0
  164. package/dist/client/chunks/{useExplainAI-DivfI0dW.js → useExplainAI-CCeCYzDm.js} +19 -19
  165. package/dist/client/chunks/{useExplainAI-DivfI0dW.js.map → useExplainAI-CCeCYzDm.js.map} +1 -1
  166. package/dist/client/chunks/{useNotebookLayout-DKkMenhj.js → useNotebookLayout-Ck3Z3uzg.js} +2 -2
  167. package/dist/client/chunks/{useNotebookLayout-DKkMenhj.js.map → useNotebookLayout-Ck3Z3uzg.js.map} +1 -1
  168. package/dist/client/chunks/{utils-Ctl_cVNR.js → utils-kqa-JIMg.js} +40 -13
  169. package/dist/client/chunks/utils-kqa-JIMg.js.map +1 -0
  170. package/dist/client/chunks/{vendor-BcLQ6iVZ.js → vendor-0hJNlZXQ.js} +102 -97
  171. package/dist/client/chunks/vendor-0hJNlZXQ.js.map +1 -0
  172. package/dist/client/components/DashboardGrid.d.ts +3 -1
  173. package/dist/client/components/dashboard/DashboardContext.d.ts +113 -0
  174. package/dist/client/components/dashboard/DashboardCoordinator.d.ts +2 -0
  175. package/dist/client/components/dashboard/DashboardFilterBar.d.ts +8 -0
  176. package/dist/client/components/dashboard/DashboardGridSurface.d.ts +8 -0
  177. package/dist/client/components/dashboard/DashboardModals.d.ts +8 -0
  178. package/dist/client/components/dashboard/DashboardProvider.d.ts +2 -0
  179. package/dist/client/components/dashboard/DashboardToolbar.d.ts +11 -0
  180. package/dist/client/components/dashboard/dashboardGridUtils.d.ts +17 -0
  181. package/dist/client/components/dashboard/index.d.ts +13 -0
  182. package/dist/client/components.d.ts +2 -0
  183. package/dist/client/components.js +3 -4
  184. package/dist/client/hooks.js +5 -6
  185. package/dist/client/icons.js +2 -2
  186. package/dist/client/index.d.ts +2 -0
  187. package/dist/client/index.js +161 -163
  188. package/dist/client/index.js.map +1 -1
  189. package/dist/client/providers.js +3 -3
  190. package/dist/client/schema.js +1 -1
  191. package/dist/client/types.d.ts +1 -0
  192. package/dist/client/utils.js +6 -7
  193. package/dist/client-bundle-stats.html +1 -1
  194. package/dist/mcp-app/mcp-app.html +77 -51
  195. package/dist/{adapters/dist-Boc63-1q.cjs → server/dist-BOdf-GQO.cjs} +1 -1
  196. package/dist/server/{google-BXwMolCu.js → google-CFYljAOF.js} +1 -1
  197. package/dist/server/{google-DzQWXFwF.cjs → google-DUlXeeDA.cjs} +1 -1
  198. package/dist/server/index.cjs +9 -9
  199. package/dist/server/index.js +57 -23
  200. package/dist/server/{openai-BfiZU0rG.cjs → openai-6wrBvAnv.cjs} +1 -1
  201. package/dist/server/openai-BDwb2u7y.cjs +17 -0
  202. package/dist/{adapters/openai-DQawCWQb.js → server/openai-DiVskd89.js} +1 -1
  203. package/dist/{adapters/openai-CuUGrKaK.js → server/openai-y7GhJNdn.js} +2062 -928
  204. package/package.json +3 -3
  205. package/dist/adapters/mcp-transport-B_HoB1HQ.js +0 -579
  206. package/dist/adapters/mcp-transport-bQzyrBPI.cjs +0 -40
  207. package/dist/adapters/openai-Bgri5TJc.cjs +0 -16
  208. package/dist/client/chunks/DashboardEditModal-DayTXEH0.js.map +0 -1
  209. package/dist/client/chunks/FieldSearchModal-B7Mr8UNT.js +0 -2644
  210. package/dist/client/chunks/FieldSearchModal-B7Mr8UNT.js.map +0 -1
  211. package/dist/client/chunks/KpiDelta-C-hZ1x01.js +0 -2
  212. package/dist/client/chunks/KpiNumber-Beo8CK0a.js +0 -2
  213. package/dist/client/chunks/KpiText-ytYiRTRO.js +0 -2
  214. package/dist/client/chunks/SchemaVisualization-DbYZBTyi.js +0 -2
  215. package/dist/client/chunks/SchemaVisualizationLazy-BGo-1S3q.js +0 -2
  216. package/dist/client/chunks/af-ZA-BtTNqvHF.js.map +0 -1
  217. package/dist/client/chunks/chart-activity-grid-BnY-jaoa.js.map +0 -1
  218. package/dist/client/chunks/chart-area-G3OvLLK4.js.map +0 -1
  219. package/dist/client/chunks/chart-bar-MLIWiLrc.js.map +0 -1
  220. package/dist/client/chunks/chart-config-area-40fbx2Ah.js.map +0 -1
  221. package/dist/client/chunks/chart-config-bar-CUWHwOPN.js.map +0 -1
  222. package/dist/client/chunks/chart-config-line-DGYYdDw9.js.map +0 -1
  223. package/dist/client/chunks/chart-data-table-BRXHT2H-.js.map +0 -1
  224. package/dist/client/chunks/chart-line-C0IHQteu.js.map +0 -1
  225. package/dist/client/chunks/chart-markdown-BmgSMqPg.js.map +0 -1
  226. package/dist/client/chunks/dist-eZurnOde.js.map +0 -1
  227. package/dist/client/chunks/nl-NL-BLDeSy_P.js.map +0 -1
  228. package/dist/client/chunks/syntaxHighlighting-D8J6Yt9j.js +0 -30
  229. package/dist/client/chunks/syntaxHighlighting-D8J6Yt9j.js.map +0 -1
  230. package/dist/client/chunks/useDebounce-NEZQbfxN.js.map +0 -1
  231. package/dist/client/chunks/useDirtyStateTracking-KAjwj1Ht.js +0 -66
  232. package/dist/client/chunks/useDirtyStateTracking-KAjwj1Ht.js.map +0 -1
  233. package/dist/client/chunks/utils-Ctl_cVNR.js.map +0 -1
  234. package/dist/client/chunks/vendor-BcLQ6iVZ.js.map +0 -1
  235. package/dist/server/openai-BwsBio1K.cjs +0 -16
  236. /package/dist/adapters/{anthropic-B_rg0BhK.js → anthropic-CZh4hB-m.js} +0 -0
  237. /package/dist/adapters/{anthropic-BIva8k1r.cjs → anthropic-DG4r1LSm.cjs} +0 -0
  238. /package/dist/adapters/{dist-De5fzUEM.js → dist-CH3hwAUk.js} +0 -0
  239. /package/dist/server/{anthropic-BsNspi1r.js → anthropic-CZh4hB-m.js} +0 -0
  240. /package/dist/server/{anthropic-DsCEX6Fm.cjs → anthropic-DG4r1LSm.cjs} +0 -0
  241. /package/dist/server/{dist-CMWZC51B.js → dist-CH3hwAUk.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"retention-YhT1Oohi.js","names":[],"sources":["../../../src/client/types/retention.ts"],"sourcesContent":["/**\n * Retention Analysis Types\n *\n * Types for Retention analysis mode which tracks cohort-based retention over time.\n * Retention analysis measures what percentage of users from each cohort return\n * in subsequent time periods.\n */\n\nimport type { Filter } from '../types'\nimport type { FunnelBindingKey } from './funnel'\n\n// ============================================================================\n// Date Range Types\n// ============================================================================\n\n/**\n * Date range for cohort analysis (REQUIRED)\n * Matches server's RetentionDateRange interface\n */\nexport interface DateRange {\n /** Start date (inclusive), ISO 8601 format (YYYY-MM-DD) */\n start: string\n /** End date (inclusive), ISO 8601 format (YYYY-MM-DD) */\n end: string\n}\n\n/**\n * Preset date range type\n */\nexport type DateRangePreset =\n | 'last_30_days'\n | 'last_3_months'\n | 'last_6_months'\n | 'last_12_months'\n | 'this_year'\n | 'last_year'\n | 'custom'\n\n/**\n * Preset date range options for the UI\n */\nexport const RETENTION_DATE_RANGE_PRESETS: { value: DateRangePreset; label: string }[] = [\n { value: 'last_30_days', label: 'Last 30 days' },\n { value: 'last_3_months', label: 'Last 3 months' },\n { value: 'last_6_months', label: 'Last 6 months' },\n { value: 'last_12_months', label: 'Last 12 months' },\n { value: 'this_year', label: 'This year' },\n { value: 'last_year', label: 'Last year' },\n { value: 'custom', label: 'Custom range' },\n]\n\n/**\n * Default preset for retention date range\n */\nexport const DEFAULT_DATE_RANGE_PRESET: DateRangePreset = 'last_3_months'\n\n/**\n * Calculate date range from a preset value\n * Returns ISO date strings (YYYY-MM-DD)\n */\nexport function getDateRangeFromPreset(preset: DateRangePreset): DateRange {\n const now = new Date()\n const today = new Date(now.getFullYear(), now.getMonth(), now.getDate())\n\n switch (preset) {\n case 'last_30_days': {\n const start = new Date(today)\n start.setDate(start.getDate() - 30)\n return {\n start: formatDateToISO(start),\n end: formatDateToISO(today),\n }\n }\n case 'last_3_months': {\n // Start of 3 months ago to end of last month\n const start = new Date(today.getFullYear(), today.getMonth() - 3, 1)\n const end = new Date(today.getFullYear(), today.getMonth(), 0) // Last day of previous month\n return {\n start: formatDateToISO(start),\n end: formatDateToISO(end),\n }\n }\n case 'last_6_months': {\n const start = new Date(today.getFullYear(), today.getMonth() - 6, 1)\n const end = new Date(today.getFullYear(), today.getMonth(), 0)\n return {\n start: formatDateToISO(start),\n end: formatDateToISO(end),\n }\n }\n case 'last_12_months': {\n const start = new Date(today.getFullYear(), today.getMonth() - 12, 1)\n const end = new Date(today.getFullYear(), today.getMonth(), 0)\n return {\n start: formatDateToISO(start),\n end: formatDateToISO(end),\n }\n }\n case 'this_year': {\n const start = new Date(today.getFullYear(), 0, 1)\n return {\n start: formatDateToISO(start),\n end: formatDateToISO(today),\n }\n }\n case 'last_year': {\n const start = new Date(today.getFullYear() - 1, 0, 1)\n const end = new Date(today.getFullYear() - 1, 11, 31)\n return {\n start: formatDateToISO(start),\n end: formatDateToISO(end),\n }\n }\n case 'custom':\n default:\n // For custom, return last 3 months as fallback\n return getDateRangeFromPreset('last_3_months')\n }\n}\n\n/**\n * Format a Date object to ISO date string (YYYY-MM-DD)\n */\nfunction formatDateToISO(date: Date): string {\n const year = date.getFullYear()\n const month = String(date.getMonth() + 1).padStart(2, '0')\n const day = String(date.getDate()).padStart(2, '0')\n return `${year}-${month}-${day}`\n}\n\n/**\n * Detect which preset a date range matches, if any\n */\nexport function detectDateRangePreset(range: DateRange): DateRangePreset {\n for (const preset of RETENTION_DATE_RANGE_PRESETS) {\n if (preset.value === 'custom') continue\n const presetRange = getDateRangeFromPreset(preset.value)\n if (presetRange.start === range.start && presetRange.end === range.end) {\n return preset.value\n }\n }\n return 'custom'\n}\n\n// ============================================================================\n// Server Query Format\n// ============================================================================\n\n/**\n * Server retention query format\n * This is the shape sent to the server for execution\n * Wrapped in { retention: {...} } similar to funnel queries\n */\nexport interface ServerRetentionQuery {\n retention: RetentionQueryConfig\n}\n\n/**\n * Retention query configuration\n * Contains all parameters needed for server-side retention analysis\n *\n * Simplified Mixpanel-style format:\n * - Single cube and timestamp dimension\n * - Single cohort (date range defines the cohort, not granularity)\n * - Optional breakdown dimension for segmentation\n */\nexport interface RetentionQueryConfig {\n /**\n * Single timestamp dimension for the analysis.\n * String format (e.g., 'Events.timestamp'),\n * Object format for multi-cube with explicit cube reference.\n */\n timeDimension: string | { cube: string; dimension: string }\n\n /**\n * Binding key - dimension that links users across events.\n * This is typically a user ID or other entity identifier.\n * String for single-cube (e.g., 'Events.userId'),\n * Array for multi-cube with different column names per cube.\n */\n bindingKey: string | { cube: string; dimension: string }[]\n\n /**\n * Date range for cohort analysis (REQUIRED).\n * Users who first performed the cohort action within this range are included.\n */\n dateRange: DateRange\n\n /**\n * Granularity for viewing retention periods.\n * Determines how retention periods are measured (day/week/month).\n */\n granularity: RetentionGranularity\n\n /**\n * Number of periods to calculate (e.g., 12 for 12 weeks).\n * Period 0 is always the cohort entry period.\n */\n periods: number\n\n /**\n * Retention type:\n * - 'classic': User returned exactly in period N (bounded)\n * - 'rolling': User returned in period N or any later period (unbounded)\n */\n retentionType: RetentionType\n\n /**\n * Optional filters on cohort entry events.\n * Applied when identifying which users enter the cohort.\n */\n cohortFilters?: Filter | Filter[]\n\n /**\n * Optional filters on return activity events.\n * Applied when checking for user activity in each period.\n */\n activityFilters?: Filter | Filter[]\n\n /**\n * Optional breakdown dimensions for segmenting the cohort.\n * When provided, retention is calculated per breakdown value combination.\n * e.g., [\"Events.country\"] or [\"Events.country\", \"Events.plan\"]\n */\n breakdownDimensions?: string[]\n}\n\n// ============================================================================\n// Enums and Unions\n// ============================================================================\n\n/**\n * Supported granularity levels for retention analysis\n */\nexport type RetentionGranularity = 'day' | 'week' | 'month'\n\n/**\n * Retention calculation types\n * - classic: User active exactly in period N\n * - rolling: User active in period N or any later period\n */\nexport type RetentionType = 'classic' | 'rolling'\n\n// ============================================================================\n// Result Types\n// ============================================================================\n\n/**\n * Single retention data point returned from server\n * Results are returned as a flat array; client transforms to matrix if needed\n */\nexport interface RetentionResultRow {\n /** Period number (0 = cohort entry, 1 = first retention period, etc.) */\n period: number\n\n /** Number of users in the cohort */\n cohortSize: number\n\n /** Number of users retained in this period */\n retainedUsers: number\n\n /** Retention rate as decimal (0-1), e.g., 0.45 for 45% */\n retentionRate: number\n\n /** Breakdown value when breakdown dimension is specified (e.g., \"US\", \"UK\") */\n breakdownValue?: string | null\n}\n\n/**\n * Retention chart data format for visualization\n * Supports both heatmap and line chart modes\n */\nexport interface RetentionChartData {\n rows: RetentionResultRow[]\n /** Period numbers (0 to periods) */\n periods: number[]\n /** Breakdown values when breakdown dimension is specified */\n breakdownValues?: string[]\n /** Summary statistics */\n summary?: RetentionSummary\n /** Granularity of retention periods (day/week/month) for period label formatting */\n granularity?: RetentionGranularity\n /** Human-readable label extracted from the binding key dimension (e.g., \"userId\" from \"Users.userId\") */\n bindingKeyLabel?: string\n}\n\n/**\n * Summary statistics for retention analysis\n */\nexport interface RetentionSummary {\n /** Total unique users in the cohort */\n totalUsers: number\n /** Average retention rate across all periods for period 1 */\n avgPeriod1Retention: number\n /** Highest retention rate for period 1 */\n maxPeriod1Retention: number\n /** Lowest retention rate for period 1 */\n minPeriod1Retention: number\n /** Number of breakdown segments (1 if no breakdown) */\n segmentCount?: number\n}\n\n// ============================================================================\n// Breakdown Types\n// ============================================================================\n\n/**\n * Breakdown item for retention analysis (single dimension)\n * Follows Mixpanel pattern - one breakdown dimension only\n */\nexport interface RetentionBreakdownItem {\n /** Full dimension name (e.g., \"Events.country\") */\n field: string\n /** Display label for the dimension */\n label?: string\n}\n\n// ============================================================================\n// Slice State (for Zustand store)\n// ============================================================================\n\n/**\n * Retention mode state for the AnalysisBuilder store\n * Simplified Mixpanel-style with single global configuration\n *\n * Key simplifications from previous version:\n * - Single cube for all (no separate cohort/activity cubes)\n * - Single timestamp dimension\n * - Single cohort with breakdown support (no cohort explosion)\n * - Granularity = viewing periods only\n */\nexport interface RetentionSliceState {\n /** Single cube for retention analysis */\n retentionCube: string | null\n\n /** Binding key that identifies entities (reuses funnel binding key type) */\n retentionBindingKey: FunnelBindingKey | null\n\n /** Single timestamp dimension for both cohort entry and activity */\n retentionTimeDimension: string | null\n\n /** Date range for cohort analysis (REQUIRED) */\n retentionDateRange: DateRange\n\n /** Filters that define who enters the cohort */\n retentionCohortFilters: Filter[]\n\n /** Filters that define what counts as a return */\n retentionActivityFilters: Filter[]\n\n /** Optional breakdown dimensions for segmenting the cohort */\n retentionBreakdowns: RetentionBreakdownItem[]\n\n /** Granularity for viewing retention periods (day/week/month) */\n retentionViewGranularity: RetentionGranularity\n\n /** Number of periods to analyze (1-52) */\n retentionPeriods: number\n\n /** Type of retention calculation */\n retentionType: RetentionType\n}\n\n/**\n * Retention slice actions for the store\n */\nexport interface RetentionSliceActions {\n /** Set the single cube for retention analysis */\n setRetentionCube: (cube: string | null) => void\n /** Set the retention binding key */\n setRetentionBindingKey: (key: FunnelBindingKey | null) => void\n /** Set the single timestamp dimension */\n setRetentionTimeDimension: (dim: string | null) => void\n /** Set the date range (REQUIRED) */\n setRetentionDateRange: (range: DateRange) => void\n /** Set all cohort filters at once */\n setRetentionCohortFilters: (filters: Filter[]) => void\n /** Add a cohort filter */\n addRetentionCohortFilter: (filter: Filter) => void\n /** Remove a cohort filter by index */\n removeRetentionCohortFilter: (index: number) => void\n /** Update a cohort filter by index */\n updateRetentionCohortFilter: (index: number, filter: Filter) => void\n /** Set all activity filters at once */\n setRetentionActivityFilters: (filters: Filter[]) => void\n /** Add an activity filter */\n addRetentionActivityFilter: (filter: Filter) => void\n /** Remove an activity filter by index */\n removeRetentionActivityFilter: (index: number) => void\n /** Update an activity filter by index */\n updateRetentionActivityFilter: (index: number, filter: Filter) => void\n /** Set all breakdown dimensions */\n setRetentionBreakdowns: (breakdowns: RetentionBreakdownItem[]) => void\n /** Add a breakdown dimension */\n addRetentionBreakdown: (breakdown: RetentionBreakdownItem) => void\n /** Remove a breakdown dimension by field name */\n removeRetentionBreakdown: (field: string) => void\n /** Set the view granularity */\n setRetentionViewGranularity: (granularity: RetentionGranularity) => void\n /** Set the number of periods */\n setRetentionPeriods: (periods: number) => void\n /** Set the retention type */\n setRetentionType: (type: RetentionType) => void\n /** Check if in retention mode (analysisType === 'retention') */\n isRetentionMode: () => boolean\n /** Check if retention mode is properly configured and ready for execution */\n isRetentionModeEnabled: () => boolean\n /** Build ServerRetentionQuery from retention state */\n buildRetentionQuery: () => ServerRetentionQuery | null\n /** Get validation errors explaining why retention query cannot be built */\n getRetentionValidation: () => { isValid: boolean; errors: string[]; warnings: string[] }\n}\n\n// ============================================================================\n// Type Guards\n// ============================================================================\n\n/**\n * Type guard to check if data is retention chart data\n */\nexport function isRetentionData(data: unknown): data is RetentionChartData {\n if (!data || typeof data !== 'object') return false\n const d = data as Record<string, unknown>\n return (\n Array.isArray(d.rows) &&\n Array.isArray(d.periods)\n )\n}\n\n/**\n * Type guard to detect server retention query format\n * Used to distinguish { retention: {...} } from CubeQuery, etc.\n */\nexport function isServerRetentionQuery(obj: unknown): obj is ServerRetentionQuery {\n return (\n typeof obj === 'object' &&\n obj !== null &&\n 'retention' in obj &&\n typeof (obj as { retention: unknown }).retention === 'object'\n )\n}\n\n/**\n * Type guard for retention result row\n */\nexport function isRetentionResultRow(row: unknown): row is RetentionResultRow {\n if (!row || typeof row !== 'object') return false\n const r = row as Record<string, unknown>\n return (\n typeof r.cohortPeriod === 'string' &&\n typeof r.period === 'number' &&\n typeof r.cohortSize === 'number' &&\n typeof r.retainedUsers === 'number' &&\n typeof r.retentionRate === 'number'\n )\n}\n\n// ============================================================================\n// Default Values\n// ============================================================================\n\n/**\n * Default retention slice state for store initialization\n */\nexport const defaultRetentionSliceState: RetentionSliceState = {\n retentionCube: null,\n retentionBindingKey: null,\n retentionTimeDimension: null,\n retentionDateRange: getDateRangeFromPreset(DEFAULT_DATE_RANGE_PRESET),\n retentionCohortFilters: [],\n retentionActivityFilters: [],\n retentionBreakdowns: [],\n retentionViewGranularity: 'week',\n retentionPeriods: 12,\n retentionType: 'classic',\n}\n\n/**\n * Minimum and maximum values for retention periods\n */\nexport const RETENTION_MIN_PERIODS = 1\nexport const RETENTION_MAX_PERIODS = 52\n\n/**\n * Available granularity options\n */\nexport const RETENTION_GRANULARITY_OPTIONS: { value: RetentionGranularity; label: string }[] = [\n { value: 'day', label: 'Daily' },\n { value: 'week', label: 'Weekly' },\n { value: 'month', label: 'Monthly' },\n]\n\n/**\n * Available retention type options\n */\nexport const RETENTION_TYPE_OPTIONS: { value: RetentionType; label: string; description: string }[] = [\n {\n value: 'classic',\n label: 'Classic',\n description: 'User was active in exactly period N',\n },\n {\n value: 'rolling',\n label: 'Rolling',\n description: 'User was active in period N or later',\n },\n]\n"],"mappings":";AAyCA,IAAa,IAA4E;CACvF;EAAE,OAAO;EAAgB,OAAO;EAAgB;CAChD;EAAE,OAAO;EAAiB,OAAO;EAAiB;CAClD;EAAE,OAAO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kBAAkB;CAClB,eAAe;CAChB,EAWY,IAAkF;CAC7F;EAAE,OAAO;EAAO,OAAO;EAAS;CAChC;EAAE,OAAO;EAAQ,OAAO;EAAU;CAClC;EAAE,OAAO;EAAS,OAAO;EAAW;CACrC,EAKY,IAAyF,CACpG;CACE,OAAO;CACP,OAAO;CACP,aAAa;CACd,EACD;CACE,OAAO;CACP,OAAO;CACP,aAAa;CACd,CACF"}
1
+ {"version":3,"file":"retention-ChW9jYdy.js","names":[],"sources":["../../../src/client/types/retention.ts"],"sourcesContent":["/**\n * Retention Analysis Types\n *\n * Types for Retention analysis mode which tracks cohort-based retention over time.\n * Retention analysis measures what percentage of users from each cohort return\n * in subsequent time periods.\n */\n\nimport type { Filter } from '../types'\nimport type { FunnelBindingKey } from './funnel'\n\n// ============================================================================\n// Date Range Types\n// ============================================================================\n\n/**\n * Date range for cohort analysis (REQUIRED)\n * Matches server's RetentionDateRange interface\n */\nexport interface DateRange {\n /** Start date (inclusive), ISO 8601 format (YYYY-MM-DD) */\n start: string\n /** End date (inclusive), ISO 8601 format (YYYY-MM-DD) */\n end: string\n}\n\n/**\n * Preset date range type\n */\nexport type DateRangePreset =\n | 'last_30_days'\n | 'last_3_months'\n | 'last_6_months'\n | 'last_12_months'\n | 'this_year'\n | 'last_year'\n | 'custom'\n\n/**\n * Preset date range options for the UI\n */\nexport const RETENTION_DATE_RANGE_PRESETS: { value: DateRangePreset; label: string }[] = [\n { value: 'last_30_days', label: 'Last 30 days' },\n { value: 'last_3_months', label: 'Last 3 months' },\n { value: 'last_6_months', label: 'Last 6 months' },\n { value: 'last_12_months', label: 'Last 12 months' },\n { value: 'this_year', label: 'This year' },\n { value: 'last_year', label: 'Last year' },\n { value: 'custom', label: 'Custom range' },\n]\n\n/**\n * Default preset for retention date range\n */\nexport const DEFAULT_DATE_RANGE_PRESET: DateRangePreset = 'last_3_months'\n\n/**\n * Calculate date range from a preset value\n * Returns ISO date strings (YYYY-MM-DD)\n */\nexport function getDateRangeFromPreset(preset: DateRangePreset): DateRange {\n const now = new Date()\n const today = new Date(now.getFullYear(), now.getMonth(), now.getDate())\n\n switch (preset) {\n case 'last_30_days': {\n const start = new Date(today)\n start.setDate(start.getDate() - 30)\n return {\n start: formatDateToISO(start),\n end: formatDateToISO(today),\n }\n }\n case 'last_3_months': {\n // Start of 3 months ago to end of last month\n const start = new Date(today.getFullYear(), today.getMonth() - 3, 1)\n const end = new Date(today.getFullYear(), today.getMonth(), 0) // Last day of previous month\n return {\n start: formatDateToISO(start),\n end: formatDateToISO(end),\n }\n }\n case 'last_6_months': {\n const start = new Date(today.getFullYear(), today.getMonth() - 6, 1)\n const end = new Date(today.getFullYear(), today.getMonth(), 0)\n return {\n start: formatDateToISO(start),\n end: formatDateToISO(end),\n }\n }\n case 'last_12_months': {\n const start = new Date(today.getFullYear(), today.getMonth() - 12, 1)\n const end = new Date(today.getFullYear(), today.getMonth(), 0)\n return {\n start: formatDateToISO(start),\n end: formatDateToISO(end),\n }\n }\n case 'this_year': {\n const start = new Date(today.getFullYear(), 0, 1)\n return {\n start: formatDateToISO(start),\n end: formatDateToISO(today),\n }\n }\n case 'last_year': {\n const start = new Date(today.getFullYear() - 1, 0, 1)\n const end = new Date(today.getFullYear() - 1, 11, 31)\n return {\n start: formatDateToISO(start),\n end: formatDateToISO(end),\n }\n }\n case 'custom':\n default:\n // For custom, return last 3 months as fallback\n return getDateRangeFromPreset('last_3_months')\n }\n}\n\n/**\n * Format a Date object to ISO date string (YYYY-MM-DD)\n */\nfunction formatDateToISO(date: Date): string {\n const year = date.getFullYear()\n const month = String(date.getMonth() + 1).padStart(2, '0')\n const day = String(date.getDate()).padStart(2, '0')\n return `${year}-${month}-${day}`\n}\n\n/**\n * Detect which preset a date range matches, if any\n */\nexport function detectDateRangePreset(range: DateRange): DateRangePreset {\n for (const preset of RETENTION_DATE_RANGE_PRESETS) {\n if (preset.value === 'custom') continue\n const presetRange = getDateRangeFromPreset(preset.value)\n if (presetRange.start === range.start && presetRange.end === range.end) {\n return preset.value\n }\n }\n return 'custom'\n}\n\n// ============================================================================\n// Server Query Format\n// ============================================================================\n\n/**\n * Server retention query format\n * This is the shape sent to the server for execution\n * Wrapped in { retention: {...} } similar to funnel queries\n */\nexport interface ServerRetentionQuery {\n retention: RetentionQueryConfig\n}\n\n/**\n * Retention query configuration\n * Contains all parameters needed for server-side retention analysis\n *\n * Simplified Mixpanel-style format:\n * - Single cube and timestamp dimension\n * - Single cohort (date range defines the cohort, not granularity)\n * - Optional breakdown dimension for segmentation\n */\nexport interface RetentionQueryConfig {\n /**\n * Single timestamp dimension for the analysis.\n * String format (e.g., 'Events.timestamp'),\n * Object format for multi-cube with explicit cube reference.\n */\n timeDimension: string | { cube: string; dimension: string }\n\n /**\n * Binding key - dimension that links users across events.\n * This is typically a user ID or other entity identifier.\n * String for single-cube (e.g., 'Events.userId'),\n * Array for multi-cube with different column names per cube.\n */\n bindingKey: string | { cube: string; dimension: string }[]\n\n /**\n * Date range for cohort analysis (REQUIRED).\n * Users who first performed the cohort action within this range are included.\n */\n dateRange: DateRange\n\n /**\n * Granularity for viewing retention periods.\n * Determines how retention periods are measured (day/week/month).\n */\n granularity: RetentionGranularity\n\n /**\n * Number of periods to calculate (e.g., 12 for 12 weeks).\n * Period 0 is always the cohort entry period.\n */\n periods: number\n\n /**\n * Retention type:\n * - 'classic': User returned exactly in period N (bounded)\n * - 'rolling': User returned in period N or any later period (unbounded)\n */\n retentionType: RetentionType\n\n /**\n * Optional filters on cohort entry events.\n * Applied when identifying which users enter the cohort.\n */\n cohortFilters?: Filter | Filter[]\n\n /**\n * Optional filters on return activity events.\n * Applied when checking for user activity in each period.\n */\n activityFilters?: Filter | Filter[]\n\n /**\n * Optional breakdown dimensions for segmenting the cohort.\n * When provided, retention is calculated per breakdown value combination.\n * e.g., [\"Events.country\"] or [\"Events.country\", \"Events.plan\"]\n */\n breakdownDimensions?: string[]\n}\n\n// ============================================================================\n// Enums and Unions\n// ============================================================================\n\n/**\n * Supported granularity levels for retention analysis\n */\nexport type RetentionGranularity = 'day' | 'week' | 'month'\n\n/**\n * Retention calculation types\n * - classic: User active exactly in period N\n * - rolling: User active in period N or any later period\n */\nexport type RetentionType = 'classic' | 'rolling'\n\n// ============================================================================\n// Result Types\n// ============================================================================\n\n/**\n * Single retention data point returned from server\n * Results are returned as a flat array; client transforms to matrix if needed\n */\nexport interface RetentionResultRow {\n /** Period number (0 = cohort entry, 1 = first retention period, etc.) */\n period: number\n\n /** Number of users in the cohort */\n cohortSize: number\n\n /** Number of users retained in this period */\n retainedUsers: number\n\n /** Retention rate as decimal (0-1), e.g., 0.45 for 45% */\n retentionRate: number\n\n /** Breakdown value when breakdown dimension is specified (e.g., \"US\", \"UK\") */\n breakdownValue?: string | null\n}\n\n/**\n * Retention chart data format for visualization\n * Supports both heatmap and line chart modes\n */\nexport interface RetentionChartData {\n rows: RetentionResultRow[]\n /** Period numbers (0 to periods) */\n periods: number[]\n /** Breakdown values when breakdown dimension is specified */\n breakdownValues?: string[]\n /** Summary statistics */\n summary?: RetentionSummary\n /** Granularity of retention periods (day/week/month) for period label formatting */\n granularity?: RetentionGranularity\n /** Human-readable label extracted from the binding key dimension (e.g., \"userId\" from \"Users.userId\") */\n bindingKeyLabel?: string\n}\n\n/**\n * Summary statistics for retention analysis\n */\nexport interface RetentionSummary {\n /** Total unique users in the cohort */\n totalUsers: number\n /** Average retention rate across all periods for period 1 */\n avgPeriod1Retention: number\n /** Highest retention rate for period 1 */\n maxPeriod1Retention: number\n /** Lowest retention rate for period 1 */\n minPeriod1Retention: number\n /** Number of breakdown segments (1 if no breakdown) */\n segmentCount?: number\n}\n\n// ============================================================================\n// Breakdown Types\n// ============================================================================\n\n/**\n * Breakdown item for retention analysis (single dimension)\n * Follows Mixpanel pattern - one breakdown dimension only\n */\nexport interface RetentionBreakdownItem {\n /** Full dimension name (e.g., \"Events.country\") */\n field: string\n /** Display label for the dimension */\n label?: string\n}\n\n// ============================================================================\n// Slice State (for Zustand store)\n// ============================================================================\n\n/**\n * Retention mode state for the AnalysisBuilder store\n * Simplified Mixpanel-style with single global configuration\n *\n * Key simplifications from previous version:\n * - Single cube for all (no separate cohort/activity cubes)\n * - Single timestamp dimension\n * - Single cohort with breakdown support (no cohort explosion)\n * - Granularity = viewing periods only\n */\nexport interface RetentionSliceState {\n /** Single cube for retention analysis */\n retentionCube: string | null\n\n /** Binding key that identifies entities (reuses funnel binding key type) */\n retentionBindingKey: FunnelBindingKey | null\n\n /** Single timestamp dimension for both cohort entry and activity */\n retentionTimeDimension: string | null\n\n /** Date range for cohort analysis (REQUIRED) */\n retentionDateRange: DateRange\n\n /** Filters that define who enters the cohort */\n retentionCohortFilters: Filter[]\n\n /** Filters that define what counts as a return */\n retentionActivityFilters: Filter[]\n\n /** Optional breakdown dimensions for segmenting the cohort */\n retentionBreakdowns: RetentionBreakdownItem[]\n\n /** Granularity for viewing retention periods (day/week/month) */\n retentionViewGranularity: RetentionGranularity\n\n /** Number of periods to analyze (1-52) */\n retentionPeriods: number\n\n /** Type of retention calculation */\n retentionType: RetentionType\n}\n\n/**\n * Retention slice actions for the store\n */\nexport interface RetentionSliceActions {\n /** Set the single cube for retention analysis */\n setRetentionCube: (cube: string | null) => void\n /** Set the retention binding key */\n setRetentionBindingKey: (key: FunnelBindingKey | null) => void\n /** Set the single timestamp dimension */\n setRetentionTimeDimension: (dim: string | null) => void\n /** Set the date range (REQUIRED) */\n setRetentionDateRange: (range: DateRange) => void\n /** Set all cohort filters at once */\n setRetentionCohortFilters: (filters: Filter[]) => void\n /** Add a cohort filter */\n addRetentionCohortFilter: (filter: Filter) => void\n /** Remove a cohort filter by index */\n removeRetentionCohortFilter: (index: number) => void\n /** Update a cohort filter by index */\n updateRetentionCohortFilter: (index: number, filter: Filter) => void\n /** Set all activity filters at once */\n setRetentionActivityFilters: (filters: Filter[]) => void\n /** Add an activity filter */\n addRetentionActivityFilter: (filter: Filter) => void\n /** Remove an activity filter by index */\n removeRetentionActivityFilter: (index: number) => void\n /** Update an activity filter by index */\n updateRetentionActivityFilter: (index: number, filter: Filter) => void\n /** Set all breakdown dimensions */\n setRetentionBreakdowns: (breakdowns: RetentionBreakdownItem[]) => void\n /** Add a breakdown dimension */\n addRetentionBreakdown: (breakdown: RetentionBreakdownItem) => void\n /** Remove a breakdown dimension by field name */\n removeRetentionBreakdown: (field: string) => void\n /** Set the view granularity */\n setRetentionViewGranularity: (granularity: RetentionGranularity) => void\n /** Set the number of periods */\n setRetentionPeriods: (periods: number) => void\n /** Set the retention type */\n setRetentionType: (type: RetentionType) => void\n /** Check if in retention mode (analysisType === 'retention') */\n isRetentionMode: () => boolean\n /** Check if retention mode is properly configured and ready for execution */\n isRetentionModeEnabled: () => boolean\n /** Build ServerRetentionQuery from retention state */\n buildRetentionQuery: () => ServerRetentionQuery | null\n /** Get validation errors explaining why retention query cannot be built */\n getRetentionValidation: () => { isValid: boolean; errors: string[]; warnings: string[] }\n}\n\n// ============================================================================\n// Type Guards\n// ============================================================================\n\n/**\n * Type guard to check if data is retention chart data\n */\nexport function isRetentionData(data: unknown): data is RetentionChartData {\n if (!data || typeof data !== 'object') return false\n const d = data as Record<string, unknown>\n return (\n Array.isArray(d.rows) &&\n Array.isArray(d.periods)\n )\n}\n\n/**\n * Type guard to detect server retention query format\n * Used to distinguish { retention: {...} } from CubeQuery, etc.\n */\nexport function isServerRetentionQuery(obj: unknown): obj is ServerRetentionQuery {\n return (\n typeof obj === 'object' &&\n obj !== null &&\n 'retention' in obj &&\n typeof (obj as { retention: unknown }).retention === 'object'\n )\n}\n\n/**\n * Type guard for retention result row\n */\nexport function isRetentionResultRow(row: unknown): row is RetentionResultRow {\n if (!row || typeof row !== 'object') return false\n const r = row as Record<string, unknown>\n return (\n typeof r.cohortPeriod === 'string' &&\n typeof r.period === 'number' &&\n typeof r.cohortSize === 'number' &&\n typeof r.retainedUsers === 'number' &&\n typeof r.retentionRate === 'number'\n )\n}\n\n// ============================================================================\n// Default Values\n// ============================================================================\n\n/**\n * Default retention slice state for store initialization\n */\nexport const defaultRetentionSliceState: RetentionSliceState = {\n retentionCube: null,\n retentionBindingKey: null,\n retentionTimeDimension: null,\n retentionDateRange: getDateRangeFromPreset(DEFAULT_DATE_RANGE_PRESET),\n retentionCohortFilters: [],\n retentionActivityFilters: [],\n retentionBreakdowns: [],\n retentionViewGranularity: 'week',\n retentionPeriods: 12,\n retentionType: 'classic',\n}\n\n/**\n * Minimum and maximum values for retention periods\n */\nexport const RETENTION_MIN_PERIODS = 1\nexport const RETENTION_MAX_PERIODS = 52\n\n/**\n * Available granularity options\n */\nexport const RETENTION_GRANULARITY_OPTIONS: { value: RetentionGranularity; label: string }[] = [\n { value: 'day', label: 'Daily' },\n { value: 'week', label: 'Weekly' },\n { value: 'month', label: 'Monthly' },\n]\n\n/**\n * Available retention type options\n */\nexport const RETENTION_TYPE_OPTIONS: { value: RetentionType; label: string; description: string }[] = [\n {\n value: 'classic',\n label: 'Classic',\n description: 'User was active in exactly period N',\n },\n {\n value: 'rolling',\n label: 'Rolling',\n description: 'User was active in period N or later',\n },\n]\n"],"mappings":";AAyCA,IAAa,IAA4E;CACvF;EAAE,OAAO;EAAgB,OAAO;CAAe;CAC/C;EAAE,OAAO;EAAiB,OAAO;CAAgB;CACjD;EAAE,OAAO;EAAiB,OAAO;CAAgB;CACjD;EAAE,OAAO;EAAkB,OAAO;CAAiB;CACnD;EAAE,OAAO;EAAa,OAAO;CAAY;CACzC;EAAE,OAAO;EAAa,OAAO;CAAY;CACzC;EAAE,OAAO;EAAU,OAAO;CAAe;AAC3C,GAKa,IAA6C;AAM1D,SAAgB,EAAuB,GAAoC;CACzE,IAAM,oBAAM,IAAI,KAAK,GACf,IAAQ,IAAI,KAAK,EAAI,YAAY,GAAG,EAAI,SAAS,GAAG,EAAI,QAAQ,CAAC;CAEvE,QAAQ,GAAR;EACE,KAAK,gBAAgB;GACnB,IAAM,IAAQ,IAAI,KAAK,CAAK;GAE5B,OADA,EAAM,QAAQ,EAAM,QAAQ,IA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,GAHM,EAAK,YAGR,EAAK,GAFD,OAAO,EAAK,SAAS,IAAI,CAAC,EAAE,SAAS,GAAG,GAEpC,EAAM,GADZ,OAAO,EAAK,QAAQ,CAAC,EAAE,SAAS,GAAG,GACpB;AAC7B;AAKA,SAAgB,EAAsB,GAAmC;CACvE,KAAK,IAAM,KAAU,GAA8B;EACjD,IAAI,EAAO,UAAU,UAAU;EAC/B,IAAM,IAAc,EAAuB,EAAO,KAAK;EACvD,IAAI,EAAY,UAAU,EAAM,SAAS,EAAY,QAAQ,EAAM,KACjE,OAAO,EAAO;CAElB;CACA,OAAO;AACT;AAsRA,SAAgB,EAAgB,GAA2C;CACzE,IAAI,CAAC,KAAQ,OAAO,KAAS,UAAU,OAAO;CAC9C,IAAM,IAAI;CACV,OACE,MAAM,QAAQ,EAAE,IAAI,KACpB,MAAM,QAAQ,EAAE,OAAO;AAE3B;AAMA,SAAgB,EAAuB,GAA2C;CAChF,OACE,OAAO,KAAQ,cACf,KACA,eAAe,KACf,OAAQ,EAA+B,aAAc;AAEzD;AAwBA,IAAa,IAAkD;CAC7D,eAAe;CACf,qBAAqB;CACrB,wBAAwB;CACxB,oBAAoB,EAAuB,CAAyB;CACpE,wBAAwB,CAAC;CACzB,0BAA0B,CAAC;CAC3B,qBAAqB,CAAC;CACtB,0BAA0B;CAC1B,kBAAkB;CAClB,eAAe;AACjB,GAWa,IAAkF;CAC7F;EAAE,OAAO;EAAO,OAAO;CAAQ;CAC/B;EAAE,OAAO;EAAQ,OAAO;CAAS;CACjC;EAAE,OAAO;EAAS,OAAO;CAAU;AACrC,GAKa,IAAyF,CACpG;CACE,OAAO;CACP,OAAO;CACP,aAAa;AACf,GACA;CACE,OAAO;CACP,OAAO;CACP,aAAa;AACf,CACF"}
@@ -1,5 +1,5 @@
1
1
  //#region \0rolldown/runtime.js
2
- var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), s = (e, n) => {
2
+ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
3
3
  let r = {};
4
4
  for (var i in e) t(r, i, {
5
5
  get: e[i],