@lightdash/common 0.2104.6 → 0.2104.8

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 (752) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -0
  2. package/dist/cjs/authorization/index.d.ts +1 -4
  3. package/dist/cjs/authorization/index.d.ts.map +1 -1
  4. package/dist/cjs/authorization/index.js +0 -4
  5. package/dist/cjs/authorization/index.js.map +1 -1
  6. package/dist/cjs/ee/AiAgent/chartConfig/web/getWebAiChartConfig.d.ts +8 -8
  7. package/dist/cjs/ee/AiAgent/index.d.ts +2 -2
  8. package/dist/cjs/ee/AiAgent/schemas/parser.d.ts +24 -24
  9. package/dist/cjs/ee/AiAgent/schemas/tools/toolDashboardV2Args.d.ts +96 -96
  10. package/dist/cjs/ee/AiAgent/schemas/tools/toolRunQueryArgs.d.ts +48 -48
  11. package/dist/cjs/ee/AiAgent/utils.d.ts +8 -8
  12. package/dist/cjs/index.d.ts +23 -449
  13. package/dist/cjs/index.d.ts.map +1 -1
  14. package/dist/cjs/index.js +21 -55
  15. package/dist/cjs/index.js.map +1 -1
  16. package/dist/cjs/pivot/index.d.ts +1 -0
  17. package/dist/cjs/pivot/index.d.ts.map +1 -1
  18. package/dist/cjs/pivot/index.js +1 -0
  19. package/dist/cjs/pivot/index.js.map +1 -1
  20. package/dist/cjs/pivot/pivotConfig.d.ts +7 -0
  21. package/dist/cjs/pivot/pivotConfig.d.ts.map +1 -0
  22. package/dist/cjs/pivot/pivotConfig.js +32 -0
  23. package/dist/cjs/pivot/pivotConfig.js.map +1 -0
  24. package/dist/cjs/types/api.d.ts +447 -0
  25. package/dist/cjs/types/api.d.ts.map +1 -1
  26. package/dist/cjs/types/api.js +50 -1
  27. package/dist/cjs/types/api.js.map +1 -1
  28. package/dist/cjs/types/auth.d.ts +2 -1
  29. package/dist/cjs/types/auth.d.ts.map +1 -1
  30. package/dist/cjs/types/auth.js +4 -4
  31. package/dist/cjs/types/auth.js.map +1 -1
  32. package/dist/cjs/types/changeset.d.ts +10 -10
  33. package/dist/cjs/types/pivot.d.ts +0 -2
  34. package/dist/cjs/types/pivot.d.ts.map +1 -1
  35. package/dist/cjs/types/pivot.js +0 -29
  36. package/dist/cjs/types/pivot.js.map +1 -1
  37. package/dist/cjs/types/resourceViewItem.d.ts +1 -1
  38. package/dist/esm/.tsbuildinfo +1 -0
  39. package/dist/esm/authorization/index.d.ts +1 -4
  40. package/dist/esm/authorization/index.d.ts.map +1 -1
  41. package/dist/esm/authorization/index.js +0 -4
  42. package/dist/esm/authorization/index.js.map +1 -1
  43. package/dist/esm/ee/AiAgent/chartConfig/web/getWebAiChartConfig.d.ts +8 -8
  44. package/dist/esm/ee/AiAgent/index.d.ts +2 -2
  45. package/dist/esm/ee/AiAgent/schemas/parser.d.ts +24 -24
  46. package/dist/esm/ee/AiAgent/schemas/tools/toolDashboardV2Args.d.ts +96 -96
  47. package/dist/esm/ee/AiAgent/schemas/tools/toolRunQueryArgs.d.ts +48 -48
  48. package/dist/esm/ee/AiAgent/utils.d.ts +8 -8
  49. package/dist/esm/index.d.ts +23 -449
  50. package/dist/esm/index.d.ts.map +1 -1
  51. package/dist/esm/index.js +16 -50
  52. package/dist/esm/index.js.map +1 -1
  53. package/dist/esm/pivot/index.d.ts +1 -0
  54. package/dist/esm/pivot/index.d.ts.map +1 -1
  55. package/dist/esm/pivot/index.js +1 -0
  56. package/dist/esm/pivot/index.js.map +1 -1
  57. package/dist/esm/pivot/pivotConfig.d.ts +7 -0
  58. package/dist/esm/pivot/pivotConfig.d.ts.map +1 -0
  59. package/dist/esm/pivot/pivotConfig.js +28 -0
  60. package/dist/esm/pivot/pivotConfig.js.map +1 -0
  61. package/dist/esm/types/api.d.ts +447 -0
  62. package/dist/esm/types/api.d.ts.map +1 -1
  63. package/dist/esm/types/api.js +46 -0
  64. package/dist/esm/types/api.js.map +1 -1
  65. package/dist/esm/types/auth.d.ts +2 -1
  66. package/dist/esm/types/auth.d.ts.map +1 -1
  67. package/dist/esm/types/auth.js +2 -2
  68. package/dist/esm/types/auth.js.map +1 -1
  69. package/dist/esm/types/changeset.d.ts +10 -10
  70. package/dist/esm/types/pivot.d.ts +0 -2
  71. package/dist/esm/types/pivot.d.ts.map +1 -1
  72. package/dist/esm/types/pivot.js +1 -27
  73. package/dist/esm/types/pivot.js.map +1 -1
  74. package/dist/esm/types/resourceViewItem.d.ts +1 -1
  75. package/dist/types/.tsbuildinfo +1 -0
  76. package/dist/types/authorization/buildAccountHelpers.js +11 -0
  77. package/dist/types/authorization/buildAccountHelpers.js.map +1 -0
  78. package/dist/types/authorization/index.d.ts +1 -4
  79. package/dist/types/authorization/index.d.ts.map +1 -1
  80. package/dist/types/authorization/index.js +62 -0
  81. package/dist/types/authorization/index.js.map +1 -0
  82. package/dist/types/authorization/index.mock.js +42 -0
  83. package/dist/types/authorization/index.mock.js.map +1 -0
  84. package/dist/types/authorization/index.test.js +220 -0
  85. package/dist/types/authorization/index.test.js.map +1 -0
  86. package/dist/types/authorization/jwtAbility.js +77 -0
  87. package/dist/types/authorization/jwtAbility.js.map +1 -0
  88. package/dist/types/authorization/jwtAbility.test.js +416 -0
  89. package/dist/types/authorization/jwtAbility.test.js.map +1 -0
  90. package/dist/types/authorization/organizationMemberAbility.js +318 -0
  91. package/dist/types/authorization/organizationMemberAbility.js.map +1 -0
  92. package/dist/types/authorization/organizationMemberAbility.mock.js +34 -0
  93. package/dist/types/authorization/organizationMemberAbility.mock.js.map +1 -0
  94. package/dist/types/authorization/organizationMemberAbility.test.js +1265 -0
  95. package/dist/types/authorization/organizationMemberAbility.test.js.map +1 -0
  96. package/dist/types/authorization/parseAccount.js +28 -0
  97. package/dist/types/authorization/parseAccount.js.map +1 -0
  98. package/dist/types/authorization/parseScopes.js +31 -0
  99. package/dist/types/authorization/parseScopes.js.map +1 -0
  100. package/dist/types/authorization/parseScopes.test.js +102 -0
  101. package/dist/types/authorization/parseScopes.test.js.map +1 -0
  102. package/dist/types/authorization/projectMemberAbility.js +239 -0
  103. package/dist/types/authorization/projectMemberAbility.js.map +1 -0
  104. package/dist/types/authorization/projectMemberAbility.mock.js +27 -0
  105. package/dist/types/authorization/projectMemberAbility.mock.js.map +1 -0
  106. package/dist/types/authorization/projectMemberAbility.test.js +1031 -0
  107. package/dist/types/authorization/projectMemberAbility.test.js.map +1 -0
  108. package/dist/types/authorization/roleToScopeMapping.js +150 -0
  109. package/dist/types/authorization/roleToScopeMapping.js.map +1 -0
  110. package/dist/types/authorization/roleToScopeMapping.test.js +561 -0
  111. package/dist/types/authorization/roleToScopeMapping.test.js.map +1 -0
  112. package/dist/types/authorization/roleToScopeMapping.testUtils.js +319 -0
  113. package/dist/types/authorization/roleToScopeMapping.testUtils.js.map +1 -0
  114. package/dist/types/authorization/roleToScopeParity.test.js +194 -0
  115. package/dist/types/authorization/roleToScopeParity.test.js.map +1 -0
  116. package/dist/types/authorization/scopeAbilityBuilder.js +57 -0
  117. package/dist/types/authorization/scopeAbilityBuilder.js.map +1 -0
  118. package/dist/types/authorization/scopeAbilityBuilder.test.js +1348 -0
  119. package/dist/types/authorization/scopeAbilityBuilder.test.js.map +1 -0
  120. package/dist/types/authorization/scopes.js +613 -0
  121. package/dist/types/authorization/scopes.js.map +1 -0
  122. package/dist/types/authorization/serviceAccountAbility.js +303 -0
  123. package/dist/types/authorization/serviceAccountAbility.js.map +1 -0
  124. package/dist/types/authorization/types.js +2 -0
  125. package/dist/types/authorization/types.js.map +1 -0
  126. package/dist/types/compiler/exploreCompiler.js +462 -0
  127. package/dist/types/compiler/exploreCompiler.js.map +1 -0
  128. package/dist/types/compiler/exploreCompiler.mock.js +2016 -0
  129. package/dist/types/compiler/exploreCompiler.mock.js.map +1 -0
  130. package/dist/types/compiler/exploreCompiler.test.js +679 -0
  131. package/dist/types/compiler/exploreCompiler.test.js.map +1 -0
  132. package/dist/types/compiler/fieldSetExpander.js +119 -0
  133. package/dist/types/compiler/fieldSetExpander.js.map +1 -0
  134. package/dist/types/compiler/fieldSetExpander.test.js +184 -0
  135. package/dist/types/compiler/fieldSetExpander.test.js.map +1 -0
  136. package/dist/types/compiler/filtersCompiler.js +337 -0
  137. package/dist/types/compiler/filtersCompiler.js.map +1 -0
  138. package/dist/types/compiler/filtersCompiler.mock.js +496 -0
  139. package/dist/types/compiler/filtersCompiler.mock.js.map +1 -0
  140. package/dist/types/compiler/filtersCompiler.test.js +570 -0
  141. package/dist/types/compiler/filtersCompiler.test.js.map +1 -0
  142. package/dist/types/compiler/lightdashProjectConfig.js +37 -0
  143. package/dist/types/compiler/lightdashProjectConfig.js.map +1 -0
  144. package/dist/types/compiler/parameters.js +75 -0
  145. package/dist/types/compiler/parameters.js.map +1 -0
  146. package/dist/types/compiler/parameters.test.js +216 -0
  147. package/dist/types/compiler/parameters.test.js.map +1 -0
  148. package/dist/types/compiler/translator.js +707 -0
  149. package/dist/types/compiler/translator.js.map +1 -0
  150. package/dist/types/compiler/translator.mock.js +1901 -0
  151. package/dist/types/compiler/translator.mock.js.map +1 -0
  152. package/dist/types/compiler/translator.test.js +323 -0
  153. package/dist/types/compiler/translator.test.js.map +1 -0
  154. package/dist/types/constants/pivot.js +7 -0
  155. package/dist/types/constants/pivot.js.map +1 -0
  156. package/dist/types/constants/sessionStorageKeys.js +6 -0
  157. package/dist/types/constants/sessionStorageKeys.js.map +1 -0
  158. package/dist/types/constants/sqlRunner.js +3 -0
  159. package/dist/types/constants/sqlRunner.js.map +1 -0
  160. package/dist/types/dbt/DbtSchemaEditor/DbtSchemaEditor.js +285 -0
  161. package/dist/types/dbt/DbtSchemaEditor/DbtSchemaEditor.js.map +1 -0
  162. package/dist/types/dbt/DbtSchemaEditor/DbtSchemaEditor.mock.js +224 -0
  163. package/dist/types/dbt/DbtSchemaEditor/DbtSchemaEditor.mock.js.map +1 -0
  164. package/dist/types/dbt/DbtSchemaEditor/DbtSchemaEditor.test.js +129 -0
  165. package/dist/types/dbt/DbtSchemaEditor/DbtSchemaEditor.test.js.map +1 -0
  166. package/dist/types/dbt/schemas/lightdashMetadata.json +385 -0
  167. package/dist/types/dbt/schemas/lightdashV10.json +72 -0
  168. package/dist/types/dbt/schemas/lightdashV11.json +72 -0
  169. package/dist/types/dbt/schemas/lightdashV12.json +63 -0
  170. package/dist/types/dbt/schemas/lightdashV7.json +72 -0
  171. package/dist/types/dbt/schemas/lightdashV8.json +76 -0
  172. package/dist/types/dbt/schemas/lightdashV9.json +72 -0
  173. package/dist/types/dbt/schemas/manifestV10.json +5545 -0
  174. package/dist/types/dbt/schemas/manifestV11.json +6041 -0
  175. package/dist/types/dbt/schemas/manifestV12.json +22567 -0
  176. package/dist/types/dbt/schemas/manifestV7.json +6481 -0
  177. package/dist/types/dbt/schemas/manifestV8.json +4358 -0
  178. package/dist/types/dbt/schemas/manifestV9.json +4879 -0
  179. package/dist/types/dbt/validation.js +67 -0
  180. package/dist/types/dbt/validation.js.map +1 -0
  181. package/dist/types/ee/AiAgent/adminTypes.js +2 -0
  182. package/dist/types/ee/AiAgent/adminTypes.js.map +1 -0
  183. package/dist/types/ee/AiAgent/chartConfig/shared/formatFieldLabel.js +10 -0
  184. package/dist/types/ee/AiAgent/chartConfig/shared/formatFieldLabel.js.map +1 -0
  185. package/dist/types/ee/AiAgent/chartConfig/slack/generateBarVizConfigTool/getVerticalBarChartEchartsConfig.js +60 -0
  186. package/dist/types/ee/AiAgent/chartConfig/slack/generateBarVizConfigTool/getVerticalBarChartEchartsConfig.js.map +1 -0
  187. package/dist/types/ee/AiAgent/chartConfig/slack/generateTimeSeriesVizConfigTool/getTimeSeriesChartEchartsConfig.js +60 -0
  188. package/dist/types/ee/AiAgent/chartConfig/slack/generateTimeSeriesVizConfigTool/getTimeSeriesChartEchartsConfig.js.map +1 -0
  189. package/dist/types/ee/AiAgent/chartConfig/slack/getSlackAiEchartsConfig.js +33 -0
  190. package/dist/types/ee/AiAgent/chartConfig/slack/getSlackAiEchartsConfig.js.map +1 -0
  191. package/dist/types/ee/AiAgent/chartConfig/slack/index.js +2 -0
  192. package/dist/types/ee/AiAgent/chartConfig/slack/index.js.map +1 -0
  193. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/getRunQueryEchartsConfig.js +43 -0
  194. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/getRunQueryEchartsConfig.js.map +1 -0
  195. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/viz/bar.js +98 -0
  196. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/viz/bar.js.map +1 -0
  197. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/viz/funnel.js +38 -0
  198. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/viz/funnel.js.map +1 -0
  199. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/viz/horizontalBar.js +65 -0
  200. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/viz/horizontalBar.js.map +1 -0
  201. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/viz/line.js +105 -0
  202. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/viz/line.js.map +1 -0
  203. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/viz/pie.js +34 -0
  204. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/viz/pie.js.map +1 -0
  205. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/viz/scatter.js +66 -0
  206. package/dist/types/ee/AiAgent/chartConfig/slack/runQueryTool/viz/scatter.js.map +1 -0
  207. package/dist/types/ee/AiAgent/chartConfig/slack/shared/getCommonEChartsConfig.js +104 -0
  208. package/dist/types/ee/AiAgent/chartConfig/slack/shared/getCommonEChartsConfig.js.map +1 -0
  209. package/dist/types/ee/AiAgent/chartConfig/slack/types.js +2 -0
  210. package/dist/types/ee/AiAgent/chartConfig/slack/types.js.map +1 -0
  211. package/dist/types/ee/AiAgent/chartConfig/web/generateBarVizConfigTool/getVerticalBarChartConfig.js +65 -0
  212. package/dist/types/ee/AiAgent/chartConfig/web/generateBarVizConfigTool/getVerticalBarChartConfig.js.map +1 -0
  213. package/dist/types/ee/AiAgent/chartConfig/web/generateTableVizConfigTool/getTableChartConfig.js +5 -0
  214. package/dist/types/ee/AiAgent/chartConfig/web/generateTableVizConfigTool/getTableChartConfig.js.map +1 -0
  215. package/dist/types/ee/AiAgent/chartConfig/web/generateTimeSeriesVizConfigTool/getTimeSeriesChartConfig.js +63 -0
  216. package/dist/types/ee/AiAgent/chartConfig/web/generateTimeSeriesVizConfigTool/getTimeSeriesChartConfig.js.map +1 -0
  217. package/dist/types/ee/AiAgent/chartConfig/web/getWebAiChartConfig.d.ts +8 -8
  218. package/dist/types/ee/AiAgent/chartConfig/web/getWebAiChartConfig.js +51 -0
  219. package/dist/types/ee/AiAgent/chartConfig/web/getWebAiChartConfig.js.map +1 -0
  220. package/dist/types/ee/AiAgent/chartConfig/web/index.js +6 -0
  221. package/dist/types/ee/AiAgent/chartConfig/web/index.js.map +1 -0
  222. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/getRunQueryChartConfig.js +73 -0
  223. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/getRunQueryChartConfig.js.map +1 -0
  224. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/viz/bar.js +91 -0
  225. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/viz/bar.js.map +1 -0
  226. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/viz/funnel.js +17 -0
  227. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/viz/funnel.js.map +1 -0
  228. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/viz/horizontalBar.js +52 -0
  229. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/viz/horizontalBar.js.map +1 -0
  230. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/viz/line.js +96 -0
  231. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/viz/line.js.map +1 -0
  232. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/viz/pie.js +15 -0
  233. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/viz/pie.js.map +1 -0
  234. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/viz/scatter.js +66 -0
  235. package/dist/types/ee/AiAgent/chartConfig/web/runQueryTool/viz/scatter.js.map +1 -0
  236. package/dist/types/ee/AiAgent/chartConfig/web/shared/canRenderAsChart.js +24 -0
  237. package/dist/types/ee/AiAgent/chartConfig/web/shared/canRenderAsChart.js.map +1 -0
  238. package/dist/types/ee/AiAgent/chartConfig/web/shared/formatPivotValueLabel.js +15 -0
  239. package/dist/types/ee/AiAgent/chartConfig/web/shared/formatPivotValueLabel.js.map +1 -0
  240. package/dist/types/ee/AiAgent/chartConfig/web/shared/getAvailableChartTypes.js +11 -0
  241. package/dist/types/ee/AiAgent/chartConfig/web/shared/getAvailableChartTypes.js.map +1 -0
  242. package/dist/types/ee/AiAgent/chartConfig/web/shared/getGroupByDimensions.js +15 -0
  243. package/dist/types/ee/AiAgent/chartConfig/web/shared/getGroupByDimensions.js.map +1 -0
  244. package/dist/types/ee/AiAgent/chartConfig/web/types.js +2 -0
  245. package/dist/types/ee/AiAgent/chartConfig/web/types.js.map +1 -0
  246. package/dist/types/ee/AiAgent/constants.js +2 -0
  247. package/dist/types/ee/AiAgent/constants.js.map +1 -0
  248. package/dist/types/ee/AiAgent/filterExploreByTags.js +94 -0
  249. package/dist/types/ee/AiAgent/filterExploreByTags.js.map +1 -0
  250. package/dist/types/ee/AiAgent/filterExploreByTags.test.js +634 -0
  251. package/dist/types/ee/AiAgent/filterExploreByTags.test.js.map +1 -0
  252. package/dist/types/ee/AiAgent/followUpTools.js +33 -0
  253. package/dist/types/ee/AiAgent/followUpTools.js.map +1 -0
  254. package/dist/types/ee/AiAgent/index.d.ts +2 -2
  255. package/dist/types/ee/AiAgent/index.js +43 -0
  256. package/dist/types/ee/AiAgent/index.js.map +1 -0
  257. package/dist/types/ee/AiAgent/requestTypes.js +2 -0
  258. package/dist/types/ee/AiAgent/requestTypes.js.map +1 -0
  259. package/dist/types/ee/AiAgent/schemas/customMetrics.js +50 -0
  260. package/dist/types/ee/AiAgent/schemas/customMetrics.js.map +1 -0
  261. package/dist/types/ee/AiAgent/schemas/fieldId.js +11 -0
  262. package/dist/types/ee/AiAgent/schemas/fieldId.js.map +1 -0
  263. package/dist/types/ee/AiAgent/schemas/filters/booleanFilters.js +29 -0
  264. package/dist/types/ee/AiAgent/schemas/filters/booleanFilters.js.map +1 -0
  265. package/dist/types/ee/AiAgent/schemas/filters/dateFilters.js +84 -0
  266. package/dist/types/ee/AiAgent/schemas/filters/dateFilters.js.map +1 -0
  267. package/dist/types/ee/AiAgent/schemas/filters/index.js +98 -0
  268. package/dist/types/ee/AiAgent/schemas/filters/index.js.map +1 -0
  269. package/dist/types/ee/AiAgent/schemas/filters/numberFilters.js +53 -0
  270. package/dist/types/ee/AiAgent/schemas/filters/numberFilters.js.map +1 -0
  271. package/dist/types/ee/AiAgent/schemas/filters/stringFilters.js +33 -0
  272. package/dist/types/ee/AiAgent/schemas/filters/stringFilters.js.map +1 -0
  273. package/dist/types/ee/AiAgent/schemas/index.js +9 -0
  274. package/dist/types/ee/AiAgent/schemas/index.js.map +1 -0
  275. package/dist/types/ee/AiAgent/schemas/outputMetadata.js +5 -0
  276. package/dist/types/ee/AiAgent/schemas/outputMetadata.js.map +1 -0
  277. package/dist/types/ee/AiAgent/schemas/parser.d.ts +24 -24
  278. package/dist/types/ee/AiAgent/schemas/parser.js +43 -0
  279. package/dist/types/ee/AiAgent/schemas/parser.js.map +1 -0
  280. package/dist/types/ee/AiAgent/schemas/sortField.js +14 -0
  281. package/dist/types/ee/AiAgent/schemas/sortField.js.map +1 -0
  282. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcBaseSchemas.js +28 -0
  283. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcBaseSchemas.js.map +1 -0
  284. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcPercentChangeFromPrevious.js +14 -0
  285. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcPercentChangeFromPrevious.js.map +1 -0
  286. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcPercentOfColumnTotal.js +14 -0
  287. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcPercentOfColumnTotal.js.map +1 -0
  288. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcPercentOfPreviousValue.js +14 -0
  289. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcPercentOfPreviousValue.js.map +1 -0
  290. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcRankInColumn.js +10 -0
  291. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcRankInColumn.js.map +1 -0
  292. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcRunningTotal.js +10 -0
  293. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcRunningTotal.js.map +1 -0
  294. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcWindowFunction.js +105 -0
  295. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcWindowFunction.js.map +1 -0
  296. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcs.js +168 -0
  297. package/dist/types/ee/AiAgent/schemas/tableCalcs/tableCalcs.js.map +1 -0
  298. package/dist/types/ee/AiAgent/schemas/toolSchemaBuilder.js +37 -0
  299. package/dist/types/ee/AiAgent/schemas/toolSchemaBuilder.js.map +1 -0
  300. package/dist/types/ee/AiAgent/schemas/tools/index.js +16 -0
  301. package/dist/types/ee/AiAgent/schemas/tools/index.js.map +1 -0
  302. package/dist/types/ee/AiAgent/schemas/tools/toolDashboardArgs.js +103 -0
  303. package/dist/types/ee/AiAgent/schemas/tools/toolDashboardArgs.js.map +1 -0
  304. package/dist/types/ee/AiAgent/schemas/tools/toolDashboardV2Args.d.ts +96 -96
  305. package/dist/types/ee/AiAgent/schemas/tools/toolDashboardV2Args.js +50 -0
  306. package/dist/types/ee/AiAgent/schemas/tools/toolDashboardV2Args.js.map +1 -0
  307. package/dist/types/ee/AiAgent/schemas/tools/toolFindChartsArgs.js +34 -0
  308. package/dist/types/ee/AiAgent/schemas/tools/toolFindChartsArgs.js.map +1 -0
  309. package/dist/types/ee/AiAgent/schemas/tools/toolFindContentArgs.js +33 -0
  310. package/dist/types/ee/AiAgent/schemas/tools/toolFindContentArgs.js.map +1 -0
  311. package/dist/types/ee/AiAgent/schemas/tools/toolFindDashboardsArgs.js +36 -0
  312. package/dist/types/ee/AiAgent/schemas/tools/toolFindDashboardsArgs.js.map +1 -0
  313. package/dist/types/ee/AiAgent/schemas/tools/toolFindExploresArgs.js +45 -0
  314. package/dist/types/ee/AiAgent/schemas/tools/toolFindExploresArgs.js.map +1 -0
  315. package/dist/types/ee/AiAgent/schemas/tools/toolFindFieldsArgs.js +34 -0
  316. package/dist/types/ee/AiAgent/schemas/tools/toolFindFieldsArgs.js.map +1 -0
  317. package/dist/types/ee/AiAgent/schemas/tools/toolImproveContextArgs.js +60 -0
  318. package/dist/types/ee/AiAgent/schemas/tools/toolImproveContextArgs.js.map +1 -0
  319. package/dist/types/ee/AiAgent/schemas/tools/toolProposeChangeArgs.js +157 -0
  320. package/dist/types/ee/AiAgent/schemas/tools/toolProposeChangeArgs.js.map +1 -0
  321. package/dist/types/ee/AiAgent/schemas/tools/toolRunMetricQueryArgs.js +41 -0
  322. package/dist/types/ee/AiAgent/schemas/tools/toolRunMetricQueryArgs.js.map +1 -0
  323. package/dist/types/ee/AiAgent/schemas/tools/toolRunQueryArgs.d.ts +48 -48
  324. package/dist/types/ee/AiAgent/schemas/tools/toolRunQueryArgs.js +151 -0
  325. package/dist/types/ee/AiAgent/schemas/tools/toolRunQueryArgs.js.map +1 -0
  326. package/dist/types/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.js +46 -0
  327. package/dist/types/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.js.map +1 -0
  328. package/dist/types/ee/AiAgent/schemas/tools/toolTableVizArgs.js +53 -0
  329. package/dist/types/ee/AiAgent/schemas/tools/toolTableVizArgs.js.map +1 -0
  330. package/dist/types/ee/AiAgent/schemas/tools/toolTimeSeriesArgs.js +58 -0
  331. package/dist/types/ee/AiAgent/schemas/tools/toolTimeSeriesArgs.js.map +1 -0
  332. package/dist/types/ee/AiAgent/schemas/tools/toolVerticalBarArgs.js +53 -0
  333. package/dist/types/ee/AiAgent/schemas/tools/toolVerticalBarArgs.js.map +1 -0
  334. package/dist/types/ee/AiAgent/schemas/visualizationMetadata.js +9 -0
  335. package/dist/types/ee/AiAgent/schemas/visualizationMetadata.js.map +1 -0
  336. package/dist/types/ee/AiAgent/schemas/visualizations/index.js +58 -0
  337. package/dist/types/ee/AiAgent/schemas/visualizations/index.js.map +1 -0
  338. package/dist/types/ee/AiAgent/schemas/visualizations/tableViz.js +38 -0
  339. package/dist/types/ee/AiAgent/schemas/visualizations/tableViz.js.map +1 -0
  340. package/dist/types/ee/AiAgent/schemas/visualizations/timeSeriesViz.js +63 -0
  341. package/dist/types/ee/AiAgent/schemas/visualizations/timeSeriesViz.js.map +1 -0
  342. package/dist/types/ee/AiAgent/schemas/visualizations/verticalBarViz.js +68 -0
  343. package/dist/types/ee/AiAgent/schemas/visualizations/verticalBarViz.js.map +1 -0
  344. package/dist/types/ee/AiAgent/types.js +12 -0
  345. package/dist/types/ee/AiAgent/types.js.map +1 -0
  346. package/dist/types/ee/AiAgent/utils.d.ts +8 -8
  347. package/dist/types/ee/AiAgent/utils.js +82 -0
  348. package/dist/types/ee/AiAgent/utils.js.map +1 -0
  349. package/dist/types/ee/AiAgent/validators.js +10 -0
  350. package/dist/types/ee/AiAgent/validators.js.map +1 -0
  351. package/dist/types/ee/commercialFeatureFlags.js +10 -0
  352. package/dist/types/ee/commercialFeatureFlags.js.map +1 -0
  353. package/dist/types/ee/embed/index.js +90 -0
  354. package/dist/types/ee/embed/index.js.map +1 -0
  355. package/dist/types/ee/index.js +19 -0
  356. package/dist/types/ee/index.js.map +1 -0
  357. package/dist/types/ee/scim/errors.js +22 -0
  358. package/dist/types/ee/scim/errors.js.map +1 -0
  359. package/dist/types/ee/scim/types.js +2 -0
  360. package/dist/types/ee/scim/types.js.map +1 -0
  361. package/dist/types/ee/serviceAccounts/types.js +8 -0
  362. package/dist/types/ee/serviceAccounts/types.js.map +1 -0
  363. package/dist/types/index.d.ts +23 -449
  364. package/dist/types/index.d.ts.map +1 -1
  365. package/dist/types/index.js +652 -0
  366. package/dist/types/index.js.map +1 -0
  367. package/dist/types/index.mock.js +44 -0
  368. package/dist/types/index.mock.js.map +1 -0
  369. package/dist/types/index.test.js +123 -0
  370. package/dist/types/index.test.js.map +1 -0
  371. package/dist/types/pivot/derivePivotConfigFromChart.js +206 -0
  372. package/dist/types/pivot/derivePivotConfigFromChart.js.map +1 -0
  373. package/dist/types/pivot/derivePivotConfigFromChart.mock.js +112 -0
  374. package/dist/types/pivot/derivePivotConfigFromChart.mock.js.map +1 -0
  375. package/dist/types/pivot/derivePivotConfigFromChart.test.js +418 -0
  376. package/dist/types/pivot/derivePivotConfigFromChart.test.js.map +1 -0
  377. package/dist/types/pivot/index.d.ts +1 -0
  378. package/dist/types/pivot/index.d.ts.map +1 -1
  379. package/dist/types/pivot/index.js +5 -0
  380. package/dist/types/pivot/index.js.map +1 -0
  381. package/dist/types/pivot/pivotConfig.d.ts +7 -0
  382. package/dist/types/pivot/pivotConfig.d.ts.map +1 -0
  383. package/dist/types/pivot/pivotConfig.js +28 -0
  384. package/dist/types/pivot/pivotConfig.js.map +1 -0
  385. package/dist/types/pivot/pivotQueryResults.js +1034 -0
  386. package/dist/types/pivot/pivotQueryResults.js.map +1 -0
  387. package/dist/types/pivot/pivotQueryResults.mock.js +2412 -0
  388. package/dist/types/pivot/pivotQueryResults.mock.js.map +1 -0
  389. package/dist/types/pivot/pivotQueryResults.test.js +1222 -0
  390. package/dist/types/pivot/pivotQueryResults.test.js.map +1 -0
  391. package/dist/types/pivot/utils.js +14 -0
  392. package/dist/types/pivot/utils.js.map +1 -0
  393. package/dist/types/schemas/json/chart-as-code-1.0.json +436 -0
  394. package/dist/types/schemas/json/dashboard-as-code-1.0.json +349 -0
  395. package/dist/types/schemas/json/lightdash-dbt-2.0.json +1417 -0
  396. package/dist/types/schemas/json/lightdash-project-config-1.0.json +138 -0
  397. package/dist/types/templating/template.js +30 -0
  398. package/dist/types/templating/template.js.map +1 -0
  399. package/dist/types/templating/template.mock.js +45 -0
  400. package/dist/types/templating/template.mock.js.map +1 -0
  401. package/dist/types/templating/template.test.js +21 -0
  402. package/dist/types/templating/template.test.js.map +1 -0
  403. package/dist/types/types/SshKeyPair.js +2 -0
  404. package/dist/types/types/SshKeyPair.js.map +1 -0
  405. package/dist/types/types/account.js +2 -0
  406. package/dist/types/types/account.js.map +1 -0
  407. package/dist/types/types/analytics.js +29 -0
  408. package/dist/types/types/analytics.js.map +1 -0
  409. package/dist/types/types/any.js +2 -0
  410. package/dist/types/types/any.js.map +1 -0
  411. package/dist/types/types/api/comments.js +2 -0
  412. package/dist/types/types/api/comments.js.map +1 -0
  413. package/dist/types/types/api/email.js +2 -0
  414. package/dist/types/types/api/email.js.map +1 -0
  415. package/dist/types/types/api/errors.js +2 -0
  416. package/dist/types/types/api/errors.js.map +1 -0
  417. package/dist/types/types/api/notifications.js +5 -0
  418. package/dist/types/types/api/notifications.js.map +1 -0
  419. package/dist/types/types/api/paginatedQuery.js +3 -0
  420. package/dist/types/types/api/paginatedQuery.js.map +1 -0
  421. package/dist/types/types/api/parameters.js +2 -0
  422. package/dist/types/types/api/parameters.js.map +1 -0
  423. package/dist/types/types/api/share.js +2 -0
  424. package/dist/types/types/api/share.js.map +1 -0
  425. package/dist/types/types/api/sort.js +2 -0
  426. package/dist/types/types/api/sort.js.map +1 -0
  427. package/dist/types/types/api/spotlight.js +2 -0
  428. package/dist/types/types/api/spotlight.js.map +1 -0
  429. package/dist/types/types/api/success.js +2 -0
  430. package/dist/types/types/api/success.js.map +1 -0
  431. package/dist/types/types/api/uuid.js +2 -0
  432. package/dist/types/types/api/uuid.js.map +1 -0
  433. package/dist/types/types/api.d.ts +447 -0
  434. package/dist/types/types/api.d.ts.map +1 -1
  435. package/dist/types/types/api.js +57 -0
  436. package/dist/types/types/api.js.map +1 -0
  437. package/dist/types/types/applyDimensionOverrides.test.js +338 -0
  438. package/dist/types/types/applyDimensionOverrides.test.js.map +1 -0
  439. package/dist/types/types/auth.d.ts +2 -1
  440. package/dist/types/types/auth.d.ts.map +1 -1
  441. package/dist/types/types/auth.js +42 -0
  442. package/dist/types/types/auth.js.map +1 -0
  443. package/dist/types/types/bigQuerySSO.js +2 -0
  444. package/dist/types/types/bigQuerySSO.js.map +1 -0
  445. package/dist/types/types/catalog.js +50 -0
  446. package/dist/types/types/catalog.js.map +1 -0
  447. package/dist/types/types/changeset.d.ts +10 -10
  448. package/dist/types/types/changeset.js +72 -0
  449. package/dist/types/types/changeset.js.map +1 -0
  450. package/dist/types/types/coder.js +2 -0
  451. package/dist/types/types/coder.js.map +1 -0
  452. package/dist/types/types/comments.js +2 -0
  453. package/dist/types/types/comments.js.map +1 -0
  454. package/dist/types/types/conditionalFormatting.js +25 -0
  455. package/dist/types/types/conditionalFormatting.js.map +1 -0
  456. package/dist/types/types/content.js +19 -0
  457. package/dist/types/types/content.js.map +1 -0
  458. package/dist/types/types/csv.js +2 -0
  459. package/dist/types/types/csv.js.map +1 -0
  460. package/dist/types/types/dashboard.js +46 -0
  461. package/dist/types/types/dashboard.js.map +1 -0
  462. package/dist/types/types/dbt.js +262 -0
  463. package/dist/types/types/dbt.js.map +1 -0
  464. package/dist/types/types/dbtFromSchema.js +2 -0
  465. package/dist/types/types/dbtFromSchema.js.map +1 -0
  466. package/dist/types/types/deepPartial.js +7 -0
  467. package/dist/types/types/deepPartial.js.map +1 -0
  468. package/dist/types/types/downloadFile.js +9 -0
  469. package/dist/types/types/downloadFile.js.map +1 -0
  470. package/dist/types/types/email.js +2 -0
  471. package/dist/types/types/email.js.map +1 -0
  472. package/dist/types/types/errors.js +496 -0
  473. package/dist/types/types/errors.js.map +1 -0
  474. package/dist/types/types/explore.js +24 -0
  475. package/dist/types/types/explore.js.map +1 -0
  476. package/dist/types/types/featureFlags.js +62 -0
  477. package/dist/types/types/featureFlags.js.map +1 -0
  478. package/dist/types/types/field.js +473 -0
  479. package/dist/types/types/field.js.map +1 -0
  480. package/dist/types/types/field.test.js +90 -0
  481. package/dist/types/types/field.test.js.map +1 -0
  482. package/dist/types/types/fieldMatch.js +2 -0
  483. package/dist/types/types/fieldMatch.js.map +1 -0
  484. package/dist/types/types/filter.js +287 -0
  485. package/dist/types/types/filter.js.map +1 -0
  486. package/dist/types/types/filter.test.js +372 -0
  487. package/dist/types/types/filter.test.js.map +1 -0
  488. package/dist/types/types/filterGrammar.js +358 -0
  489. package/dist/types/types/filterGrammar.js.map +1 -0
  490. package/dist/types/types/filterGrammar.test.js +549 -0
  491. package/dist/types/types/filterGrammar.test.js.map +1 -0
  492. package/dist/types/types/filterGrammarConversion.js +94 -0
  493. package/dist/types/types/filterGrammarConversion.js.map +1 -0
  494. package/dist/types/types/filterGrammarConversion.test.js +260 -0
  495. package/dist/types/types/filterGrammarConversion.test.js.map +1 -0
  496. package/dist/types/types/gdrive.js +2 -0
  497. package/dist/types/types/gdrive.js.map +1 -0
  498. package/dist/types/types/gitIntegration.js +2 -0
  499. package/dist/types/types/gitIntegration.js.map +1 -0
  500. package/dist/types/types/groups.js +4 -0
  501. package/dist/types/types/groups.js.map +1 -0
  502. package/dist/types/types/job.js +67 -0
  503. package/dist/types/types/job.js.map +1 -0
  504. package/dist/types/types/knex-paginate.js +2 -0
  505. package/dist/types/types/knex-paginate.js.map +1 -0
  506. package/dist/types/types/lightdashProjectConfig.js +4 -0
  507. package/dist/types/types/lightdashProjectConfig.js.map +1 -0
  508. package/dist/types/types/metricQuery.js +20 -0
  509. package/dist/types/types/metricQuery.js.map +1 -0
  510. package/dist/types/types/metricsExplorer.js +12 -0
  511. package/dist/types/types/metricsExplorer.js.map +1 -0
  512. package/dist/types/types/notifications.js +2 -0
  513. package/dist/types/types/notifications.js.map +1 -0
  514. package/dist/types/types/oauth.js +2 -0
  515. package/dist/types/types/oauth.js.map +1 -0
  516. package/dist/types/types/openIdIdentity.js +12 -0
  517. package/dist/types/types/openIdIdentity.js.map +1 -0
  518. package/dist/types/types/organization.js +20 -0
  519. package/dist/types/types/organization.js.map +1 -0
  520. package/dist/types/types/organizationMemberProfile.js +30 -0
  521. package/dist/types/types/organizationMemberProfile.js.map +1 -0
  522. package/dist/types/types/organizationWarehouseCredentials.js +2 -0
  523. package/dist/types/types/organizationWarehouseCredentials.js.map +1 -0
  524. package/dist/types/types/paginateResults.js +2 -0
  525. package/dist/types/types/paginateResults.js.map +1 -0
  526. package/dist/types/types/parameters.js +2 -0
  527. package/dist/types/types/parameters.js.map +1 -0
  528. package/dist/types/types/personalAccessToken.js +2 -0
  529. package/dist/types/types/personalAccessToken.js.map +1 -0
  530. package/dist/types/types/pinning.js +5 -0
  531. package/dist/types/types/pinning.js.map +1 -0
  532. package/dist/types/types/pivot.d.ts +0 -2
  533. package/dist/types/types/pivot.d.ts.map +1 -1
  534. package/dist/types/types/pivot.js +2 -0
  535. package/dist/types/types/pivot.js.map +1 -0
  536. package/dist/types/types/projectGroupAccess.js +2 -0
  537. package/dist/types/types/projectGroupAccess.js.map +1 -0
  538. package/dist/types/types/projectMemberProfile.js +2 -0
  539. package/dist/types/types/projectMemberProfile.js.map +1 -0
  540. package/dist/types/types/projectMemberRole.js +30 -0
  541. package/dist/types/types/projectMemberRole.js.map +1 -0
  542. package/dist/types/types/projects.js +149 -0
  543. package/dist/types/types/projects.js.map +1 -0
  544. package/dist/types/types/promotion.js +8 -0
  545. package/dist/types/types/promotion.js.map +1 -0
  546. package/dist/types/types/queryHistory.js +8 -0
  547. package/dist/types/types/queryHistory.js.map +1 -0
  548. package/dist/types/types/rename.js +6 -0
  549. package/dist/types/types/rename.js.map +1 -0
  550. package/dist/types/types/resourceViewItem.d.ts +1 -1
  551. package/dist/types/types/resourceViewItem.js +103 -0
  552. package/dist/types/types/resourceViewItem.js.map +1 -0
  553. package/dist/types/types/results.js +51 -0
  554. package/dist/types/types/results.js.map +1 -0
  555. package/dist/types/types/roles.js +2 -0
  556. package/dist/types/types/roles.js.map +1 -0
  557. package/dist/types/types/savedCharts.js +225 -0
  558. package/dist/types/types/savedCharts.js.map +1 -0
  559. package/dist/types/types/scheduler.js +87 -0
  560. package/dist/types/types/scheduler.js.map +1 -0
  561. package/dist/types/types/schedulerLog.js +2 -0
  562. package/dist/types/types/schedulerLog.js.map +1 -0
  563. package/dist/types/types/schedulerTaskList.js +31 -0
  564. package/dist/types/types/schedulerTaskList.js.map +1 -0
  565. package/dist/types/types/scopes.js +14 -0
  566. package/dist/types/types/scopes.js.map +1 -0
  567. package/dist/types/types/search.js +53 -0
  568. package/dist/types/types/search.js.map +1 -0
  569. package/dist/types/types/share.js +2 -0
  570. package/dist/types/types/share.js.map +1 -0
  571. package/dist/types/types/slack.js +2 -0
  572. package/dist/types/types/slack.js.map +1 -0
  573. package/dist/types/types/slackSettings.js +2 -0
  574. package/dist/types/types/slackSettings.js.map +1 -0
  575. package/dist/types/types/space.js +7 -0
  576. package/dist/types/types/space.js.map +1 -0
  577. package/dist/types/types/spotlightTableConfig.js +17 -0
  578. package/dist/types/types/spotlightTableConfig.js.map +1 -0
  579. package/dist/types/types/sqlRunner.js +41 -0
  580. package/dist/types/types/sqlRunner.js.map +1 -0
  581. package/dist/types/types/table.js +6 -0
  582. package/dist/types/types/table.js.map +1 -0
  583. package/dist/types/types/tags.js +2 -0
  584. package/dist/types/types/tags.js.map +1 -0
  585. package/dist/types/types/timeFrames.js +42 -0
  586. package/dist/types/types/timeFrames.js.map +1 -0
  587. package/dist/types/types/timezone.js +33 -0
  588. package/dist/types/types/timezone.js.map +1 -0
  589. package/dist/types/types/user.js +23 -0
  590. package/dist/types/types/user.js.map +1 -0
  591. package/dist/types/types/userAttributes.js +2 -0
  592. package/dist/types/types/userAttributes.js.map +1 -0
  593. package/dist/types/types/userWarehouseCredentials.js +2 -0
  594. package/dist/types/types/userWarehouseCredentials.js.map +1 -0
  595. package/dist/types/types/validation.js +29 -0
  596. package/dist/types/types/validation.js.map +1 -0
  597. package/dist/types/types/warehouse.js +6 -0
  598. package/dist/types/types/warehouse.js.map +1 -0
  599. package/dist/types/types/yamlSchema.js +2 -0
  600. package/dist/types/types/yamlSchema.js.map +1 -0
  601. package/dist/types/utils/accessors.js +27 -0
  602. package/dist/types/utils/accessors.js.map +1 -0
  603. package/dist/types/utils/accessors.test.js +45 -0
  604. package/dist/types/utils/accessors.test.js.map +1 -0
  605. package/dist/types/utils/additionalMetrics.js +54 -0
  606. package/dist/types/utils/additionalMetrics.js.map +1 -0
  607. package/dist/types/utils/api.js +5 -0
  608. package/dist/types/utils/api.js.map +1 -0
  609. package/dist/types/utils/assertUnreachable.js +10 -0
  610. package/dist/types/utils/assertUnreachable.js.map +1 -0
  611. package/dist/types/utils/booleanConverter.js +27 -0
  612. package/dist/types/utils/booleanConverter.js.map +1 -0
  613. package/dist/types/utils/booleanConverter.test.js +59 -0
  614. package/dist/types/utils/booleanConverter.test.js.map +1 -0
  615. package/dist/types/utils/catalogMetricsTree.js +2 -0
  616. package/dist/types/utils/catalogMetricsTree.js.map +1 -0
  617. package/dist/types/utils/changeset.js +132 -0
  618. package/dist/types/utils/changeset.js.map +1 -0
  619. package/dist/types/utils/changeset.mock.js +146 -0
  620. package/dist/types/utils/changeset.mock.js.map +1 -0
  621. package/dist/types/utils/changeset.test.js +248 -0
  622. package/dist/types/utils/changeset.test.js.map +1 -0
  623. package/dist/types/utils/charts.js +74 -0
  624. package/dist/types/utils/charts.js.map +1 -0
  625. package/dist/types/utils/colors.js +15 -0
  626. package/dist/types/utils/colors.js.map +1 -0
  627. package/dist/types/utils/colors.test.js +85 -0
  628. package/dist/types/utils/colors.test.js.map +1 -0
  629. package/dist/types/utils/conditionalFormatting.js +436 -0
  630. package/dist/types/utils/conditionalFormatting.js.map +1 -0
  631. package/dist/types/utils/conditionalFormatting.test.js +105 -0
  632. package/dist/types/utils/conditionalFormatting.test.js.map +1 -0
  633. package/dist/types/utils/convertCustomDimensionsToYaml.js +115 -0
  634. package/dist/types/utils/convertCustomDimensionsToYaml.js.map +1 -0
  635. package/dist/types/utils/convertCustomMetricsToYaml.js +15 -0
  636. package/dist/types/utils/convertCustomMetricsToYaml.js.map +1 -0
  637. package/dist/types/utils/customDimensions.js +27 -0
  638. package/dist/types/utils/customDimensions.js.map +1 -0
  639. package/dist/types/utils/dashboard.js +35 -0
  640. package/dist/types/utils/dashboard.js.map +1 -0
  641. package/dist/types/utils/dashboard.test.js +36 -0
  642. package/dist/types/utils/dashboard.test.js.map +1 -0
  643. package/dist/types/utils/dbt.js +4 -0
  644. package/dist/types/utils/dbt.js.map +1 -0
  645. package/dist/types/utils/dbt.test.js +39 -0
  646. package/dist/types/utils/dbt.test.js.map +1 -0
  647. package/dist/types/utils/dependencyGraph.js +51 -0
  648. package/dist/types/utils/dependencyGraph.js.map +1 -0
  649. package/dist/types/utils/dependencyGraph.test.js +113 -0
  650. package/dist/types/utils/dependencyGraph.test.js.map +1 -0
  651. package/dist/types/utils/email.js +76 -0
  652. package/dist/types/utils/email.js.map +1 -0
  653. package/dist/types/utils/email.test.js +49 -0
  654. package/dist/types/utils/email.test.js.map +1 -0
  655. package/dist/types/utils/fields.js +183 -0
  656. package/dist/types/utils/fields.js.map +1 -0
  657. package/dist/types/utils/fields.mock.js +150 -0
  658. package/dist/types/utils/fields.mock.js.map +1 -0
  659. package/dist/types/utils/fields.test.js +259 -0
  660. package/dist/types/utils/fields.test.js.map +1 -0
  661. package/dist/types/utils/filters.js +763 -0
  662. package/dist/types/utils/filters.js.map +1 -0
  663. package/dist/types/utils/filters.mock.js +450 -0
  664. package/dist/types/utils/filters.mock.js.map +1 -0
  665. package/dist/types/utils/filters.test.js +360 -0
  666. package/dist/types/utils/filters.test.js.map +1 -0
  667. package/dist/types/utils/formatting.js +552 -0
  668. package/dist/types/utils/formatting.js.map +1 -0
  669. package/dist/types/utils/formatting.mock.js +28 -0
  670. package/dist/types/utils/formatting.mock.js.map +1 -0
  671. package/dist/types/utils/formatting.test.js +1047 -0
  672. package/dist/types/utils/formatting.test.js.map +1 -0
  673. package/dist/types/utils/github.js +11 -0
  674. package/dist/types/utils/github.js.map +1 -0
  675. package/dist/types/utils/i18n/abstract.js +3 -0
  676. package/dist/types/utils/i18n/abstract.js.map +1 -0
  677. package/dist/types/utils/i18n/chartAsCode.js +132 -0
  678. package/dist/types/utils/i18n/chartAsCode.js.map +1 -0
  679. package/dist/types/utils/i18n/chartAsCode.test.js +350 -0
  680. package/dist/types/utils/i18n/chartAsCode.test.js.map +1 -0
  681. package/dist/types/utils/i18n/dashboardAsCode.js +58 -0
  682. package/dist/types/utils/i18n/dashboardAsCode.js.map +1 -0
  683. package/dist/types/utils/i18n/index.js +5 -0
  684. package/dist/types/utils/i18n/index.js.map +1 -0
  685. package/dist/types/utils/i18n/merge.js +20 -0
  686. package/dist/types/utils/i18n/merge.js.map +1 -0
  687. package/dist/types/utils/i18n/types.js +2 -0
  688. package/dist/types/utils/i18n/types.js.map +1 -0
  689. package/dist/types/utils/item.js +154 -0
  690. package/dist/types/utils/item.js.map +1 -0
  691. package/dist/types/utils/loadLightdashProjectConfig.js +49 -0
  692. package/dist/types/utils/loadLightdashProjectConfig.js.map +1 -0
  693. package/dist/types/utils/loadLightdashProjectConfig.mock.js +127 -0
  694. package/dist/types/utils/loadLightdashProjectConfig.mock.js.map +1 -0
  695. package/dist/types/utils/loadLightdashProjectConfig.test.js +137 -0
  696. package/dist/types/utils/loadLightdashProjectConfig.test.js.map +1 -0
  697. package/dist/types/utils/metricsExplorer.js +365 -0
  698. package/dist/types/utils/metricsExplorer.js.map +1 -0
  699. package/dist/types/utils/oauth.js +242 -0
  700. package/dist/types/utils/oauth.js.map +1 -0
  701. package/dist/types/utils/organization.js +23 -0
  702. package/dist/types/utils/organization.js.map +1 -0
  703. package/dist/types/utils/projectMemberRole.js +85 -0
  704. package/dist/types/utils/projectMemberRole.js.map +1 -0
  705. package/dist/types/utils/projectMemberRole.test.js +36 -0
  706. package/dist/types/utils/projectMemberRole.test.js.map +1 -0
  707. package/dist/types/utils/promises.js +5 -0
  708. package/dist/types/utils/promises.js.map +1 -0
  709. package/dist/types/utils/sanitizeHtml.js +111 -0
  710. package/dist/types/utils/sanitizeHtml.js.map +1 -0
  711. package/dist/types/utils/sanitizeHtml.test.js +101 -0
  712. package/dist/types/utils/sanitizeHtml.test.js.map +1 -0
  713. package/dist/types/utils/scheduler.js +85 -0
  714. package/dist/types/utils/scheduler.js.map +1 -0
  715. package/dist/types/utils/scheduler.test.js +41 -0
  716. package/dist/types/utils/scheduler.test.js.map +1 -0
  717. package/dist/types/utils/searchParams.js +8 -0
  718. package/dist/types/utils/searchParams.js.map +1 -0
  719. package/dist/types/utils/sleep.js +6 -0
  720. package/dist/types/utils/sleep.js.map +1 -0
  721. package/dist/types/utils/slug.test.js +129 -0
  722. package/dist/types/utils/slug.test.js.map +1 -0
  723. package/dist/types/utils/slugs.js +55 -0
  724. package/dist/types/utils/slugs.js.map +1 -0
  725. package/dist/types/utils/subtotals.js +4 -0
  726. package/dist/types/utils/subtotals.js.map +1 -0
  727. package/dist/types/utils/time.js +25 -0
  728. package/dist/types/utils/time.js.map +1 -0
  729. package/dist/types/utils/timeFrames.js +529 -0
  730. package/dist/types/utils/timeFrames.js.map +1 -0
  731. package/dist/types/utils/timeFrames.test.js +50 -0
  732. package/dist/types/utils/timeFrames.test.js.map +1 -0
  733. package/dist/types/utils/virtualView.js +98 -0
  734. package/dist/types/utils/virtualView.js.map +1 -0
  735. package/dist/types/utils/warehouse.js +57 -0
  736. package/dist/types/utils/warehouse.js.map +1 -0
  737. package/dist/types/visualizations/CartesianChartDataModel.js +515 -0
  738. package/dist/types/visualizations/CartesianChartDataModel.js.map +1 -0
  739. package/dist/types/visualizations/PieChartDataModel.js +258 -0
  740. package/dist/types/visualizations/PieChartDataModel.js.map +1 -0
  741. package/dist/types/visualizations/TableDataModel.js +96 -0
  742. package/dist/types/visualizations/TableDataModel.js.map +1 -0
  743. package/dist/types/visualizations/chartTransformations.js +107 -0
  744. package/dist/types/visualizations/chartTransformations.js.map +1 -0
  745. package/dist/types/visualizations/helpers/getCartesianAxisFormatterConfig.js +142 -0
  746. package/dist/types/visualizations/helpers/getCartesianAxisFormatterConfig.js.map +1 -0
  747. package/dist/types/visualizations/types/IResultsRunner.js +2 -0
  748. package/dist/types/visualizations/types/IResultsRunner.js.map +1 -0
  749. package/dist/types/visualizations/types/index.js +78 -0
  750. package/dist/types/visualizations/types/index.js.map +1 -0
  751. package/package.json +1 -1
  752. package/dist/tsconfig.types.tsbuildinfo +0 -1
@@ -0,0 +1,1265 @@
1
+ import { Ability, AbilityBuilder, subject } from '@casl/ability';
2
+ import { OrganizationMemberRole, } from '../types/organizationMemberProfile';
3
+ import { ProjectType } from '../types/projects';
4
+ import { SpaceMemberRole } from '../types/space';
5
+ import applyOrganizationMemberAbilities from './organizationMemberAbility';
6
+ import { ORGANIZATION_ADMIN, ORGANIZATION_DEVELOPER, ORGANIZATION_EDITOR, ORGANIZATION_INTERACTIVE_VIEWER, ORGANIZATION_MEMBER, ORGANIZATION_VIEWER, } from './organizationMemberAbility.mock';
7
+ const defineAbilityForOrganizationMember = (member, permissionsConfig) => {
8
+ const builder = new AbilityBuilder(Ability);
9
+ if (member) {
10
+ applyOrganizationMemberAbilities({
11
+ role: member.role,
12
+ member,
13
+ builder,
14
+ permissionsConfig: permissionsConfig ?? {
15
+ pat: {
16
+ enabled: true,
17
+ allowedOrgRoles: Object.values(OrganizationMemberRole),
18
+ },
19
+ },
20
+ });
21
+ }
22
+ return builder.build();
23
+ };
24
+ describe('Organization member permissions', () => {
25
+ describe('Member permissions', () => {
26
+ let ability = defineAbilityForOrganizationMember(ORGANIZATION_VIEWER);
27
+ describe('when user is an organization admin', () => {
28
+ beforeEach(() => {
29
+ ability =
30
+ defineAbilityForOrganizationMember(ORGANIZATION_ADMIN);
31
+ });
32
+ it('can manage organizations', () => {
33
+ expect(ability.can('manage', 'Organization')).toEqual(true);
34
+ });
35
+ it('cannot manage another organization', () => {
36
+ const org = { organizationUuid: '789' };
37
+ expect(ability.can('manage', subject('Organization', org))).toEqual(false);
38
+ });
39
+ it('can manage their own organization', () => {
40
+ const org = { organizationUuid: '456' };
41
+ expect(ability.can('manage', subject('Organization', org))).toEqual(true);
42
+ });
43
+ it('can manage member profiles', () => {
44
+ expect(ability.can('manage', 'OrganizationMemberProfile')).toEqual(true);
45
+ });
46
+ it('cannot manage other members from another organization', () => {
47
+ expect(ability.can('manage', subject('OrganizationMemberProfile', {
48
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
49
+ }))).toEqual(true);
50
+ expect(ability.can('manage', subject('OrganizationMemberProfile', {
51
+ organizationUuid: 'notmine',
52
+ }))).toEqual(false);
53
+ });
54
+ it('can view and manage all kinds of dashboards', () => {
55
+ expect(ability.can('view', subject('Dashboard', {
56
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
57
+ isPrivate: false,
58
+ }))).toEqual(true);
59
+ expect(ability.can('manage', subject('Dashboard', {
60
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
61
+ isPrivate: false,
62
+ }))).toEqual(true);
63
+ expect(ability.can('view', subject('Dashboard', {
64
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
65
+ isPrivate: true,
66
+ access: [],
67
+ }))).toEqual(true);
68
+ expect(ability.can('manage', subject('Dashboard', {
69
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
70
+ isPrivate: true,
71
+ access: [],
72
+ }))).toEqual(true);
73
+ expect(ability.can('view', subject('Dashboard', {
74
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
75
+ isPrivate: true,
76
+ access: [
77
+ {
78
+ userUuid: ORGANIZATION_ADMIN.userUuid,
79
+ role: SpaceMemberRole.VIEWER,
80
+ },
81
+ ],
82
+ }))).toEqual(true);
83
+ expect(ability.can('manage', subject('Dashboard', {
84
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
85
+ isPrivate: true,
86
+ access: [
87
+ {
88
+ userUuid: ORGANIZATION_ADMIN.userUuid,
89
+ role: SpaceMemberRole.VIEWER,
90
+ },
91
+ ],
92
+ }))).toEqual(true);
93
+ expect(ability.can('view', subject('Dashboard', {
94
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
95
+ isPrivate: true,
96
+ access: [
97
+ {
98
+ userUuid: ORGANIZATION_ADMIN.userUuid,
99
+ role: SpaceMemberRole.EDITOR,
100
+ },
101
+ ],
102
+ }))).toEqual(true);
103
+ expect(ability.can('manage', subject('Dashboard', {
104
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
105
+ isPrivate: true,
106
+ access: [
107
+ {
108
+ userUuid: ORGANIZATION_ADMIN.userUuid,
109
+ role: SpaceMemberRole.EDITOR,
110
+ },
111
+ ],
112
+ }))).toEqual(true);
113
+ });
114
+ it('can view and manage all kinds of saved charts', () => {
115
+ expect(ability.can('view', subject('SavedChart', {
116
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
117
+ isPrivate: false,
118
+ }))).toEqual(true);
119
+ expect(ability.can('manage', subject('SavedChart', {
120
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
121
+ isPrivate: false,
122
+ }))).toEqual(true);
123
+ expect(ability.can('view', subject('SavedChart', {
124
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
125
+ isPrivate: true,
126
+ access: [],
127
+ }))).toEqual(true);
128
+ expect(ability.can('manage', subject('SavedChart', {
129
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
130
+ isPrivate: true,
131
+ access: [],
132
+ }))).toEqual(true);
133
+ expect(ability.can('view', subject('SavedChart', {
134
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
135
+ isPrivate: true,
136
+ access: [
137
+ {
138
+ userUuid: ORGANIZATION_ADMIN.userUuid,
139
+ role: SpaceMemberRole.VIEWER,
140
+ },
141
+ ],
142
+ }))).toEqual(true);
143
+ expect(ability.can('manage', subject('SavedChart', {
144
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
145
+ isPrivate: true,
146
+ access: [
147
+ {
148
+ userUuid: ORGANIZATION_ADMIN.userUuid,
149
+ role: SpaceMemberRole.VIEWER,
150
+ },
151
+ ],
152
+ }))).toEqual(true);
153
+ expect(ability.can('view', subject('SavedChart', {
154
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
155
+ isPrivate: true,
156
+ access: [
157
+ {
158
+ userUuid: ORGANIZATION_ADMIN.userUuid,
159
+ role: SpaceMemberRole.EDITOR,
160
+ },
161
+ ],
162
+ }))).toEqual(true);
163
+ expect(ability.can('manage', subject('SavedChart', {
164
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
165
+ isPrivate: true,
166
+ access: [
167
+ {
168
+ userUuid: ORGANIZATION_ADMIN.userUuid,
169
+ role: SpaceMemberRole.EDITOR,
170
+ },
171
+ ],
172
+ }))).toEqual(true);
173
+ });
174
+ it('can view and manage all kinds of space', () => {
175
+ expect(ability.can('view', subject('Space', {
176
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
177
+ isPrivate: false,
178
+ }))).toEqual(true);
179
+ expect(ability.can('manage', subject('Space', {
180
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
181
+ isPrivate: false,
182
+ }))).toEqual(true);
183
+ expect(ability.can('view', subject('Space', {
184
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
185
+ isPrivate: true,
186
+ access: [],
187
+ }))).toEqual(true);
188
+ expect(ability.can('manage', subject('Space', {
189
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
190
+ isPrivate: true,
191
+ access: [],
192
+ }))).toEqual(true);
193
+ expect(ability.can('view', subject('Space', {
194
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
195
+ isPrivate: true,
196
+ access: [
197
+ {
198
+ userUuid: ORGANIZATION_ADMIN.userUuid,
199
+ role: SpaceMemberRole.VIEWER,
200
+ },
201
+ ],
202
+ }))).toEqual(true);
203
+ expect(ability.can('manage', subject('Space', {
204
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
205
+ isPrivate: true,
206
+ access: [
207
+ {
208
+ userUuid: ORGANIZATION_ADMIN.userUuid,
209
+ role: SpaceMemberRole.VIEWER,
210
+ },
211
+ ],
212
+ }))).toEqual(true);
213
+ expect(ability.can('view', subject('Space', {
214
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
215
+ isPrivate: true,
216
+ access: [
217
+ {
218
+ userUuid: ORGANIZATION_ADMIN.userUuid,
219
+ role: SpaceMemberRole.EDITOR,
220
+ },
221
+ ],
222
+ }))).toEqual(true);
223
+ expect(ability.can('manage', subject('Space', {
224
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
225
+ isPrivate: true,
226
+ access: [
227
+ {
228
+ userUuid: ORGANIZATION_ADMIN.userUuid,
229
+ role: SpaceMemberRole.EDITOR,
230
+ },
231
+ ],
232
+ }))).toEqual(true);
233
+ });
234
+ describe('JobStatus', () => {
235
+ it('can view his own job status', () => {
236
+ expect(ability.can('view', subject('JobStatus', {
237
+ createdByUserUuid: ORGANIZATION_ADMIN.userUuid,
238
+ }))).toEqual(true);
239
+ });
240
+ it('cannot view job status from the organization', () => {
241
+ expect(ability.can('view', subject('JobStatus', {
242
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
243
+ createdByUserUuid: undefined,
244
+ }))).toEqual(true);
245
+ });
246
+ it('cannot view job status from another organization', () => {
247
+ expect(ability.can('view', subject('JobStatus', { organizationUuid: '54678' }))).toEqual(false);
248
+ });
249
+ });
250
+ describe('AiAgent', () => {
251
+ it('can manage AiAgent', () => {
252
+ expect(ability.can('manage', subject('AiAgent', {
253
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
254
+ }))).toEqual(true);
255
+ });
256
+ it('cannot manage AiAgent from another organization', () => {
257
+ expect(ability.can('manage', subject('AiAgent', { organizationUuid: '5678' }))).toEqual(false);
258
+ });
259
+ });
260
+ describe('AiAgentThread', () => {
261
+ it('can view all AiAgentThreads in the organization', () => {
262
+ expect(ability.can('view', subject('AiAgentThread', {
263
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
264
+ }))).toEqual(true);
265
+ });
266
+ it('can manage all AiAgentThreads in the organization', () => {
267
+ expect(ability.can('manage', subject('AiAgentThread', {
268
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
269
+ }))).toEqual(true);
270
+ });
271
+ it('cannot view AiAgentThread from another organization', () => {
272
+ expect(ability.can('view', subject('AiAgentThread', {
273
+ organizationUuid: '5678',
274
+ }))).toEqual(false);
275
+ });
276
+ it('cannot manage AiAgentThread from another organization', () => {
277
+ expect(ability.can('manage', subject('AiAgentThread', {
278
+ organizationUuid: '5678',
279
+ }))).toEqual(false);
280
+ });
281
+ });
282
+ });
283
+ describe('when user is an editor', () => {
284
+ beforeEach(() => {
285
+ ability =
286
+ defineAbilityForOrganizationMember(ORGANIZATION_EDITOR);
287
+ });
288
+ it('cannot manage organizations', () => {
289
+ expect(ability.can('manage', 'Organization')).toEqual(false);
290
+ });
291
+ it('can view and manage public & accessable dashboards', () => {
292
+ expect(ability.can('view', subject('Dashboard', {
293
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
294
+ isPrivate: false,
295
+ }))).toEqual(true);
296
+ expect(ability.can('manage', subject('Dashboard', {
297
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
298
+ isPrivate: false,
299
+ }))).toEqual(false);
300
+ expect(ability.can('view', subject('Dashboard', {
301
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
302
+ isPrivate: true,
303
+ access: [],
304
+ }))).toEqual(false);
305
+ expect(ability.can('manage', subject('Dashboard', {
306
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
307
+ isPrivate: true,
308
+ access: [],
309
+ }))).toEqual(false);
310
+ expect(ability.can('view', subject('Dashboard', {
311
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
312
+ isPrivate: true,
313
+ access: [
314
+ {
315
+ userUuid: ORGANIZATION_EDITOR.userUuid,
316
+ role: SpaceMemberRole.VIEWER,
317
+ },
318
+ ],
319
+ }))).toEqual(true);
320
+ expect(ability.can('manage', subject('Dashboard', {
321
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
322
+ isPrivate: true,
323
+ access: [
324
+ {
325
+ userUuid: ORGANIZATION_EDITOR.userUuid,
326
+ role: SpaceMemberRole.VIEWER,
327
+ },
328
+ ],
329
+ }))).toEqual(false);
330
+ expect(ability.can('view', subject('Dashboard', {
331
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
332
+ isPrivate: true,
333
+ access: [
334
+ {
335
+ userUuid: ORGANIZATION_EDITOR.userUuid,
336
+ role: SpaceMemberRole.EDITOR,
337
+ },
338
+ ],
339
+ }))).toEqual(true);
340
+ expect(ability.can('manage', subject('Dashboard', {
341
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
342
+ isPrivate: true,
343
+ access: [
344
+ {
345
+ userUuid: ORGANIZATION_EDITOR.userUuid,
346
+ role: SpaceMemberRole.EDITOR,
347
+ },
348
+ ],
349
+ }))).toEqual(true);
350
+ });
351
+ it('can view and manage public & accessable saved charts', () => {
352
+ expect(ability.can('view', subject('SavedChart', {
353
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
354
+ isPrivate: false,
355
+ }))).toEqual(true);
356
+ expect(ability.can('manage', subject('SavedChart', {
357
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
358
+ isPrivate: false,
359
+ }))).toEqual(false);
360
+ expect(ability.can('view', subject('SavedChart', {
361
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
362
+ isPrivate: true,
363
+ access: [],
364
+ }))).toEqual(false);
365
+ expect(ability.can('manage', subject('SavedChart', {
366
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
367
+ isPrivate: true,
368
+ access: [],
369
+ }))).toEqual(false);
370
+ expect(ability.can('view', subject('SavedChart', {
371
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
372
+ isPrivate: true,
373
+ access: [
374
+ {
375
+ userUuid: ORGANIZATION_EDITOR.userUuid,
376
+ role: SpaceMemberRole.VIEWER,
377
+ },
378
+ ],
379
+ }))).toEqual(true);
380
+ expect(ability.can('manage', subject('SavedChart', {
381
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
382
+ isPrivate: true,
383
+ access: [
384
+ {
385
+ userUuid: ORGANIZATION_EDITOR.userUuid,
386
+ role: SpaceMemberRole.VIEWER,
387
+ },
388
+ ],
389
+ }))).toEqual(false);
390
+ expect(ability.can('view', subject('SavedChart', {
391
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
392
+ isPrivate: true,
393
+ access: [
394
+ {
395
+ userUuid: ORGANIZATION_EDITOR.userUuid,
396
+ role: SpaceMemberRole.EDITOR,
397
+ },
398
+ ],
399
+ }))).toEqual(true);
400
+ expect(ability.can('manage', subject('SavedChart', {
401
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
402
+ isPrivate: true,
403
+ access: [
404
+ {
405
+ userUuid: ORGANIZATION_EDITOR.userUuid,
406
+ role: SpaceMemberRole.EDITOR,
407
+ },
408
+ ],
409
+ }))).toEqual(true);
410
+ });
411
+ it('can create a space', () => {
412
+ expect(ability.can('create', subject('Space', {
413
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
414
+ }))).toEqual(true);
415
+ });
416
+ it('can view and manage public & accessable space', () => {
417
+ expect(ability.can('view', subject('Space', {
418
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
419
+ isPrivate: false,
420
+ }))).toEqual(true);
421
+ expect(ability.can('manage', subject('Space', {
422
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
423
+ isPrivate: false,
424
+ }))).toEqual(true);
425
+ expect(ability.can('view', subject('Space', {
426
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
427
+ isPrivate: true,
428
+ access: [],
429
+ }))).toEqual(false);
430
+ expect(ability.can('manage', subject('Space', {
431
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
432
+ isPrivate: true,
433
+ access: [],
434
+ }))).toEqual(false);
435
+ expect(ability.can('view', subject('Space', {
436
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
437
+ isPrivate: true,
438
+ access: [
439
+ {
440
+ userUuid: ORGANIZATION_EDITOR.userUuid,
441
+ role: SpaceMemberRole.VIEWER,
442
+ },
443
+ ],
444
+ }))).toEqual(true);
445
+ expect(ability.can('manage', subject('Space', {
446
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
447
+ isPrivate: true,
448
+ access: [
449
+ {
450
+ userUuid: ORGANIZATION_EDITOR.userUuid,
451
+ role: SpaceMemberRole.VIEWER,
452
+ },
453
+ ],
454
+ }))).toEqual(false);
455
+ expect(ability.can('view', subject('Space', {
456
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
457
+ isPrivate: true,
458
+ access: [
459
+ {
460
+ userUuid: ORGANIZATION_EDITOR.userUuid,
461
+ role: SpaceMemberRole.EDITOR,
462
+ },
463
+ ],
464
+ }))).toEqual(true);
465
+ expect(ability.can('manage', subject('Space', {
466
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
467
+ isPrivate: true,
468
+ access: [
469
+ {
470
+ userUuid: ORGANIZATION_EDITOR.userUuid,
471
+ role: SpaceMemberRole.EDITOR,
472
+ },
473
+ ],
474
+ }))).toEqual(false);
475
+ expect(ability.can('manage', subject('Space', {
476
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
477
+ isPrivate: true,
478
+ access: [
479
+ {
480
+ userUuid: ORGANIZATION_EDITOR.userUuid,
481
+ role: SpaceMemberRole.ADMIN,
482
+ },
483
+ ],
484
+ }))).toEqual(true);
485
+ });
486
+ it('can manage public dashboards from their own organization', () => {
487
+ expect(ability.can('manage', subject('Dashboard', {
488
+ organizationUuid: '456',
489
+ isPrivate: false,
490
+ access: [],
491
+ }))).toEqual(false);
492
+ });
493
+ it('cannot manage public dashboards from another organization', () => {
494
+ expect(ability.can('manage', subject('Dashboard', {
495
+ organizationUuid: '789',
496
+ isPrivate: false,
497
+ access: [],
498
+ }))).toEqual(false);
499
+ });
500
+ it('can view member profiles', () => {
501
+ expect(ability.can('view', 'OrganizationMemberProfile')).toEqual(true);
502
+ });
503
+ it('can create invite links', () => {
504
+ expect(ability.can('create', 'InviteLink')).toEqual(false);
505
+ });
506
+ it('cannot run SQL Queries', () => {
507
+ expect(ability.can('manage', 'SqlRunner')).toEqual(false);
508
+ });
509
+ it('can use the SemanticViewer', () => {
510
+ expect(ability.can('manage', 'SemanticViewer')).toEqual(true);
511
+ });
512
+ describe('JobStatus', () => {
513
+ it('can view his own job status', () => {
514
+ expect(ability.can('view', subject('JobStatus', {
515
+ createdByUserUuid: ORGANIZATION_EDITOR.userUuid,
516
+ }))).toEqual(true);
517
+ });
518
+ it('cannot view job status from the organization', () => {
519
+ expect(ability.can('view', subject('JobStatus', {
520
+ organizationUuid: ORGANIZATION_EDITOR.organizationUuid,
521
+ createdByUserUuid: undefined,
522
+ }))).toEqual(false);
523
+ });
524
+ it('cannot view job status from another organization', () => {
525
+ expect(ability.can('view', subject('JobStatus', { organizationUuid: '54678' }))).toEqual(false);
526
+ });
527
+ });
528
+ });
529
+ describe('when user is an developer', () => {
530
+ beforeEach(() => {
531
+ ability = defineAbilityForOrganizationMember(ORGANIZATION_DEVELOPER);
532
+ });
533
+ it('can run SQL Queries', () => {
534
+ expect(ability.can('manage', 'SqlRunner')).toEqual(true);
535
+ });
536
+ it('can use the SemanticViewer', () => {
537
+ expect(ability.can('manage', 'SemanticViewer')).toEqual(true);
538
+ });
539
+ describe('JobStatus', () => {
540
+ it('can view his own job status', () => {
541
+ expect(ability.can('view', subject('JobStatus', {
542
+ createdByUserUuid: ORGANIZATION_DEVELOPER.userUuid,
543
+ }))).toEqual(true);
544
+ });
545
+ it('cannot view job status from the organization', () => {
546
+ expect(ability.can('view', subject('JobStatus', {
547
+ organizationUuid: ORGANIZATION_DEVELOPER.organizationUuid,
548
+ createdByUserUuid: undefined,
549
+ }))).toEqual(true);
550
+ });
551
+ it('cannot view job status from another organization', () => {
552
+ expect(ability.can('view', subject('JobStatus', { organizationUuid: '54678' }))).toEqual(false);
553
+ });
554
+ });
555
+ describe('AiAgent', () => {
556
+ it('can manage AiAgent', () => {
557
+ expect(ability.can('manage', subject('AiAgent', {
558
+ organizationUuid: ORGANIZATION_DEVELOPER.organizationUuid,
559
+ }))).toEqual(true);
560
+ });
561
+ it('cannot manage AiAgent from another organization', () => {
562
+ expect(ability.can('manage', subject('AiAgent', { organizationUuid: '5678' }))).toEqual(false);
563
+ });
564
+ });
565
+ describe('AiAgentThread', () => {
566
+ it('can manage only his own AiAgentThread', () => {
567
+ expect(ability.can('manage', subject('AiAgentThread', {
568
+ organizationUuid: ORGANIZATION_DEVELOPER.organizationUuid,
569
+ userUuid: ORGANIZATION_DEVELOPER.userUuid,
570
+ }))).toEqual(true);
571
+ });
572
+ it('cannot manage other users AiAgentThread', () => {
573
+ expect(ability.can('manage', subject('AiAgentThread', {
574
+ organizationUuid: ORGANIZATION_DEVELOPER.organizationUuid,
575
+ userUuid: 'another-user-uuid',
576
+ }))).toEqual(false);
577
+ });
578
+ it('cannot manage AiAgentThread from another organization', () => {
579
+ expect(ability.can('manage', subject('AiAgentThread', {
580
+ organizationUuid: '5678',
581
+ }))).toEqual(false);
582
+ });
583
+ });
584
+ });
585
+ describe('when user is a member', () => {
586
+ beforeEach(() => {
587
+ ability =
588
+ defineAbilityForOrganizationMember(ORGANIZATION_MEMBER);
589
+ });
590
+ it('can view member profiles', () => {
591
+ expect(ability.can('view', 'OrganizationMemberProfile')).toEqual(true);
592
+ });
593
+ it('can create invitations', () => {
594
+ expect(ability.can('create', 'InviteLink')).toEqual(false);
595
+ });
596
+ it('cannot view organizations', () => {
597
+ expect(ability.can('view', 'Organization')).toEqual(false);
598
+ });
599
+ it('cannot view charts', () => {
600
+ expect(ability.can('view', 'SavedChart')).toEqual(false);
601
+ });
602
+ describe('JobStatus', () => {
603
+ it('can view his own job status', () => {
604
+ expect(ability.can('view', subject('JobStatus', {
605
+ createdByUserUuid: ORGANIZATION_DEVELOPER.userUuid,
606
+ }))).toEqual(true);
607
+ });
608
+ it('cannot view job status from the organization', () => {
609
+ expect(ability.can('view', subject('JobStatus', {
610
+ organizationUuid: ORGANIZATION_DEVELOPER.organizationUuid,
611
+ createdByUserUuid: undefined,
612
+ }))).toEqual(false);
613
+ });
614
+ it('cannot view job status from another organization', () => {
615
+ expect(ability.can('view', subject('JobStatus', { organizationUuid: '54678' }))).toEqual(false);
616
+ });
617
+ });
618
+ });
619
+ describe('when user is a viewer', () => {
620
+ beforeEach(() => {
621
+ ability =
622
+ defineAbilityForOrganizationMember(ORGANIZATION_VIEWER);
623
+ });
624
+ it('can only view public & accessable dashboards', () => {
625
+ expect(ability.can('view', subject('Dashboard', {
626
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
627
+ isPrivate: false,
628
+ }))).toEqual(true);
629
+ expect(ability.can('manage', subject('Dashboard', {
630
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
631
+ isPrivate: false,
632
+ }))).toEqual(false);
633
+ expect(ability.can('view', subject('Dashboard', {
634
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
635
+ isPrivate: true,
636
+ access: [],
637
+ }))).toEqual(false);
638
+ expect(ability.can('manage', subject('Dashboard', {
639
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
640
+ isPrivate: true,
641
+ access: [],
642
+ }))).toEqual(false);
643
+ expect(ability.can('view', subject('Dashboard', {
644
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
645
+ isPrivate: true,
646
+ access: [
647
+ {
648
+ userUuid: ORGANIZATION_VIEWER.userUuid,
649
+ role: SpaceMemberRole.VIEWER,
650
+ },
651
+ ],
652
+ }))).toEqual(true);
653
+ expect(ability.can('manage', subject('Dashboard', {
654
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
655
+ isPrivate: true,
656
+ access: [
657
+ {
658
+ userUuid: ORGANIZATION_VIEWER.userUuid,
659
+ role: SpaceMemberRole.VIEWER,
660
+ },
661
+ ],
662
+ }))).toEqual(false);
663
+ expect(ability.can('view', subject('Dashboard', {
664
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
665
+ isPrivate: true,
666
+ access: [
667
+ {
668
+ userUuid: ORGANIZATION_VIEWER.userUuid,
669
+ role: SpaceMemberRole.EDITOR,
670
+ },
671
+ ],
672
+ }))).toEqual(true);
673
+ expect(ability.can('manage', subject('Dashboard', {
674
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
675
+ isPrivate: true,
676
+ access: [
677
+ {
678
+ userUuid: ORGANIZATION_VIEWER.userUuid,
679
+ role: SpaceMemberRole.EDITOR,
680
+ },
681
+ ],
682
+ }))).toEqual(false);
683
+ });
684
+ it('can view and manage public & accessable saved charts', () => {
685
+ expect(ability.can('view', subject('SavedChart', {
686
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
687
+ isPrivate: false,
688
+ }))).toEqual(true);
689
+ expect(ability.can('manage', subject('SavedChart', {
690
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
691
+ isPrivate: false,
692
+ }))).toEqual(false);
693
+ expect(ability.can('view', subject('SavedChart', {
694
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
695
+ isPrivate: true,
696
+ access: [],
697
+ }))).toEqual(false);
698
+ expect(ability.can('manage', subject('SavedChart', {
699
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
700
+ isPrivate: true,
701
+ access: [],
702
+ }))).toEqual(false);
703
+ expect(ability.can('view', subject('SavedChart', {
704
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
705
+ isPrivate: true,
706
+ access: [
707
+ {
708
+ userUuid: ORGANIZATION_VIEWER.userUuid,
709
+ role: SpaceMemberRole.VIEWER,
710
+ },
711
+ ],
712
+ }))).toEqual(true);
713
+ expect(ability.can('manage', subject('SavedChart', {
714
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
715
+ isPrivate: true,
716
+ access: [
717
+ {
718
+ userUuid: ORGANIZATION_VIEWER.userUuid,
719
+ role: SpaceMemberRole.VIEWER,
720
+ },
721
+ ],
722
+ }))).toEqual(false);
723
+ expect(ability.can('view', subject('SavedChart', {
724
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
725
+ isPrivate: true,
726
+ access: [
727
+ {
728
+ userUuid: ORGANIZATION_VIEWER.userUuid,
729
+ role: SpaceMemberRole.EDITOR,
730
+ },
731
+ ],
732
+ }))).toEqual(true);
733
+ expect(ability.can('manage', subject('SavedChart', {
734
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
735
+ isPrivate: true,
736
+ access: [
737
+ {
738
+ userUuid: ORGANIZATION_VIEWER.userUuid,
739
+ role: SpaceMemberRole.EDITOR,
740
+ },
741
+ ],
742
+ }))).toEqual(false);
743
+ });
744
+ it('can view and manage public & accessable space', () => {
745
+ expect(ability.can('view', subject('Space', {
746
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
747
+ isPrivate: false,
748
+ }))).toEqual(true);
749
+ expect(ability.can('manage', subject('Space', {
750
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
751
+ isPrivate: false,
752
+ }))).toEqual(false);
753
+ expect(ability.can('view', subject('Space', {
754
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
755
+ isPrivate: true,
756
+ access: [],
757
+ }))).toEqual(false);
758
+ expect(ability.can('manage', subject('Space', {
759
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
760
+ isPrivate: true,
761
+ access: [],
762
+ }))).toEqual(false);
763
+ expect(ability.can('view', subject('Space', {
764
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
765
+ isPrivate: true,
766
+ access: [
767
+ {
768
+ userUuid: ORGANIZATION_VIEWER.userUuid,
769
+ role: SpaceMemberRole.VIEWER,
770
+ },
771
+ ],
772
+ }))).toEqual(true);
773
+ expect(ability.can('manage', subject('Space', {
774
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
775
+ isPrivate: true,
776
+ access: [
777
+ {
778
+ userUuid: ORGANIZATION_VIEWER.userUuid,
779
+ role: SpaceMemberRole.VIEWER,
780
+ },
781
+ ],
782
+ }))).toEqual(false);
783
+ expect(ability.can('view', subject('Space', {
784
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
785
+ isPrivate: true,
786
+ access: [
787
+ {
788
+ userUuid: ORGANIZATION_VIEWER.userUuid,
789
+ role: SpaceMemberRole.EDITOR,
790
+ },
791
+ ],
792
+ }))).toEqual(true);
793
+ expect(ability.can('manage', subject('Space', {
794
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
795
+ isPrivate: true,
796
+ access: [
797
+ {
798
+ userUuid: ORGANIZATION_VIEWER.userUuid,
799
+ role: SpaceMemberRole.EDITOR,
800
+ },
801
+ ],
802
+ }))).toEqual(false);
803
+ });
804
+ it('can view member profiles', () => {
805
+ expect(ability.can('view', subject('OrganizationMemberProfile', {
806
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
807
+ }))).toEqual(true);
808
+ });
809
+ it('can create invitations', () => {
810
+ expect(ability.can('create', subject('InviteLink', {}))).toEqual(false);
811
+ });
812
+ it('cannot create a project in organization they belong to', () => {
813
+ const check = {
814
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
815
+ };
816
+ expect(ability.can('create', subject('Project', check))).toEqual(false);
817
+ });
818
+ it('cannot create any resource, except space when have editor space role', () => {
819
+ expect(ability.can('create', subject('Space', {
820
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
821
+ }))).toEqual(false);
822
+ expect(ability.can('create', subject('Dashboard', {
823
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
824
+ }))).toEqual(false);
825
+ expect(ability.can('create', subject('SavedChart', {
826
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
827
+ }))).toEqual(false);
828
+ expect(ability.can('create', subject('Organization', {
829
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
830
+ }))).toEqual(false);
831
+ });
832
+ it('cannot run SQL queries', () => {
833
+ expect(ability.can('manage', subject('SqlRunner', {}))).toEqual(false);
834
+ });
835
+ it('cannot update any resource, except space when have editor space role', () => {
836
+ expect(ability.can('update', subject('Space', {
837
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
838
+ }))).toEqual(false);
839
+ expect(ability.can('update', subject('Dashboard', {
840
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
841
+ }))).toEqual(false);
842
+ expect(ability.can('update', subject('SavedChart', {
843
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
844
+ }))).toEqual(false);
845
+ expect(ability.can('update', subject('Project', {
846
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
847
+ }))).toEqual(false);
848
+ expect(ability.can('update', subject('Organization', {
849
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
850
+ }))).toEqual(false);
851
+ expect(ability.can('update', subject('InviteLink', {
852
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
853
+ }))).toEqual(false);
854
+ });
855
+ it('cannot delete any resource, except space when have editor space role', () => {
856
+ expect(ability.can('delete', subject('Space', {
857
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
858
+ }))).toEqual(false);
859
+ expect(ability.can('delete', subject('Dashboard', {
860
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
861
+ }))).toEqual(false);
862
+ expect(ability.can('delete', subject('SavedChart', {
863
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
864
+ }))).toEqual(false);
865
+ expect(ability.can('delete', subject('Project', {
866
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
867
+ }))).toEqual(false);
868
+ expect(ability.can('delete', subject('Organization', {
869
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
870
+ }))).toEqual(false);
871
+ expect(ability.can('delete', subject('InviteLink', {
872
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
873
+ }))).toEqual(false);
874
+ });
875
+ it('can view their own organization', () => {
876
+ const org = { organizationUuid: '456' };
877
+ expect(ability.can('view', subject('Organization', org))).toEqual(true);
878
+ });
879
+ it('cannot view another organization', () => {
880
+ const org = { organizationUuid: '789' };
881
+ expect(ability.can('view', subject('Organization', org))).toEqual(false);
882
+ });
883
+ it('can view dashboards from their own organization', () => {
884
+ const org = { organizationUuid: '456', isPrivate: false };
885
+ expect(ability.can('view', subject('Dashboard', org))).toEqual(true);
886
+ });
887
+ it('cannot view dashboards from another organization', () => {
888
+ expect(ability.can('view', subject('Dashboard', { organizationUuid: '789' }))).toEqual(false);
889
+ });
890
+ it('can view savedCharts from their own organization', () => {
891
+ expect(ability.can('view', subject('SavedChart', {
892
+ organizationUuid: '456',
893
+ isPrivate: false,
894
+ }))).toEqual(true);
895
+ });
896
+ it('cannot view savedCharts from another organization', () => {
897
+ expect(ability.can('view', subject('SavedChart', {
898
+ organizationUuid: '789',
899
+ isPrivate: false,
900
+ }))).toEqual(false);
901
+ });
902
+ it('can view projects from their own organization', () => {
903
+ expect(ability.can('view', subject('Project', { organizationUuid: '456' }))).toEqual(true);
904
+ });
905
+ it('cannot view projects from another organization', () => {
906
+ expect(ability.can('view', subject('Project', { organizationUuid: '789' }))).toEqual(false);
907
+ });
908
+ it('can view their own jobs', () => {
909
+ expect(ability.can('view', subject('Job', {
910
+ userUuid: ORGANIZATION_VIEWER.userUuid,
911
+ }))).toEqual(false);
912
+ });
913
+ it('cannot view jobs from another user', () => {
914
+ expect(ability.can('view', subject('Job', { userUuid: 'another-user-uuid' }))).toEqual(false);
915
+ });
916
+ it('cannot view the SemanticViewer', () => {
917
+ expect(ability.can('view', 'SemanticViewer')).toEqual(false);
918
+ });
919
+ describe('AiAgent', () => {
920
+ it('cannot view AiAgent', () => {
921
+ expect(ability.can('view', subject('AiAgent', {
922
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
923
+ }))).toEqual(false);
924
+ });
925
+ it('cannot manage AiAgent', () => {
926
+ expect(ability.can('manage', subject('AiAgent', {
927
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
928
+ }))).toEqual(false);
929
+ });
930
+ });
931
+ describe('AiAgentThread', () => {
932
+ it('can view only his own AiAgentThread', () => {
933
+ expect(ability.can('view', subject('AiAgentThread', {
934
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
935
+ userUuid: ORGANIZATION_VIEWER.userUuid,
936
+ }))).toEqual(true);
937
+ });
938
+ it('cannot view other users AiAgentThread', () => {
939
+ expect(ability.can('view', subject('AiAgentThread', {
940
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
941
+ userUuid: 'another-user-uuid',
942
+ }))).toEqual(false);
943
+ });
944
+ it('cannot manage his own AiAgentThread', () => {
945
+ expect(ability.can('manage', subject('AiAgentThread', {
946
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
947
+ userUuid: ORGANIZATION_VIEWER.userUuid,
948
+ }))).toEqual(false);
949
+ });
950
+ it('cannot create AiAgentThread', () => {
951
+ expect(ability.can('create', subject('AiAgentThread', {
952
+ organizationUuid: ORGANIZATION_VIEWER.organizationUuid,
953
+ }))).toEqual(false);
954
+ });
955
+ it('cannot view AiAgentThread from another organization', () => {
956
+ expect(ability.can('view', subject('AiAgentThread', {
957
+ organizationUuid: '5678',
958
+ }))).toEqual(false);
959
+ });
960
+ });
961
+ });
962
+ describe('when user is an interactive viewer', () => {
963
+ beforeEach(() => {
964
+ ability = defineAbilityForOrganizationMember(ORGANIZATION_INTERACTIVE_VIEWER);
965
+ });
966
+ it('can view member profiles', () => {
967
+ expect(ability.can('view', subject('OrganizationMemberProfile', {
968
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
969
+ }))).toEqual(true);
970
+ });
971
+ it('can create invitations', () => {
972
+ expect(ability.can('create', subject('InviteLink', {}))).toEqual(false);
973
+ });
974
+ it('cannot create any resource, except space when have editor space role', () => {
975
+ expect(ability.can('create', subject('Space', {
976
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
977
+ }))).toEqual(false);
978
+ expect(ability.can('create', subject('Dashboard', {
979
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
980
+ }))).toEqual(false);
981
+ expect(ability.can('create', subject('SavedChart', {
982
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
983
+ }))).toEqual(false);
984
+ expect(ability.can('create', subject('Organization', {
985
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
986
+ }))).toEqual(false);
987
+ });
988
+ it('cannot run SQL queries', () => {
989
+ expect(ability.can('manage', subject('SqlRunner', {
990
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
991
+ }))).toEqual(false);
992
+ });
993
+ it('cannot use the SemanticViewer', () => {
994
+ expect(ability.can('manage', subject('SemanticViewer', {
995
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
996
+ }))).toEqual(false);
997
+ });
998
+ it('cannot update any resource, except space when have editor space role', () => {
999
+ expect(ability.can('update', subject('Space', {
1000
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1001
+ }))).toEqual(false);
1002
+ expect(ability.can('update', subject('Dashboard', {
1003
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1004
+ }))).toEqual(false);
1005
+ expect(ability.can('update', subject('SavedChart', {
1006
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1007
+ }))).toEqual(false);
1008
+ expect(ability.can('update', subject('Project', {
1009
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1010
+ }))).toEqual(false);
1011
+ expect(ability.can('update', subject('Organization', {
1012
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1013
+ }))).toEqual(false);
1014
+ expect(ability.can('update', subject('InviteLink', {
1015
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1016
+ }))).toEqual(false);
1017
+ });
1018
+ it('cannot delete any resource, except space when have editor space role', () => {
1019
+ expect(ability.can('delete', subject('Space', {
1020
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1021
+ }))).toEqual(false);
1022
+ expect(ability.can('delete', subject('Dashboard', {
1023
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1024
+ }))).toEqual(false);
1025
+ expect(ability.can('delete', subject('SavedChart', {
1026
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1027
+ }))).toEqual(false);
1028
+ expect(ability.can('delete', subject('Project', {
1029
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1030
+ }))).toEqual(false);
1031
+ expect(ability.can('delete', subject('Organization', {
1032
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1033
+ }))).toEqual(false);
1034
+ expect(ability.can('delete', subject('InviteLink', {
1035
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1036
+ }))).toEqual(false);
1037
+ });
1038
+ it('can view their own organization', () => {
1039
+ const org = { organizationUuid: '456' };
1040
+ expect(ability.can('view', subject('Organization', org))).toEqual(true);
1041
+ });
1042
+ it('cannot view another organization', () => {
1043
+ const org = { organizationUuid: '789' };
1044
+ expect(ability.can('view', subject('Organization', org))).toEqual(false);
1045
+ });
1046
+ it('can view dashboards from their own organization', () => {
1047
+ const org = { organizationUuid: '456', isPrivate: false };
1048
+ expect(ability.can('view', subject('Dashboard', org))).toEqual(true);
1049
+ });
1050
+ it('cannot view dashboards from another organization', () => {
1051
+ expect(ability.can('view', subject('Dashboard', {
1052
+ organizationUuid: '789',
1053
+ isPrivate: false,
1054
+ }))).toEqual(false);
1055
+ });
1056
+ it('can view savedCharts from their own organization', () => {
1057
+ expect(ability.can('view', subject('SavedChart', {
1058
+ organizationUuid: '456',
1059
+ isPrivate: false,
1060
+ }))).toEqual(true);
1061
+ });
1062
+ it('cannot view savedCharts from another organization', () => {
1063
+ expect(ability.can('view', subject('SavedChart', {
1064
+ organizationUuid: '789',
1065
+ isPrivate: false,
1066
+ }))).toEqual(false);
1067
+ });
1068
+ it('can view projects from their own organization', () => {
1069
+ expect(ability.can('view', subject('Project', { organizationUuid: '456' }))).toEqual(true);
1070
+ });
1071
+ it('cannot view projects from another organization', () => {
1072
+ expect(ability.can('view', subject('Project', { organizationUuid: '789' }))).toEqual(false);
1073
+ });
1074
+ it('can view their own jobs', () => {
1075
+ expect(ability.can('view', subject('Job', {
1076
+ userUuid: ORGANIZATION_INTERACTIVE_VIEWER.userUuid,
1077
+ }))).toEqual(true);
1078
+ });
1079
+ it('cannot view jobs from another user', () => {
1080
+ expect(ability.can('view', subject('Job', { userUuid: 'another-user-uuid' }))).toEqual(false);
1081
+ });
1082
+ describe('AiAgent', () => {
1083
+ it('can view AiAgent', () => {
1084
+ expect(ability.can('view', subject('AiAgent', {
1085
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1086
+ }))).toEqual(true);
1087
+ });
1088
+ it('cannot manage AiAgent', () => {
1089
+ expect(ability.can('manage', subject('AiAgent', {
1090
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1091
+ }))).toEqual(false);
1092
+ });
1093
+ it('cannot view AiAgent from another organization', () => {
1094
+ expect(ability.can('view', subject('AiAgent', { organizationUuid: '5678' }))).toEqual(false);
1095
+ });
1096
+ });
1097
+ describe('AiAgentThread', () => {
1098
+ it('can create AiAgentThread', () => {
1099
+ expect(ability.can('create', subject('AiAgentThread', {
1100
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1101
+ }))).toEqual(true);
1102
+ });
1103
+ it('can view only his own AiAgentThread', () => {
1104
+ expect(ability.can('view', subject('AiAgentThread', {
1105
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1106
+ userUuid: ORGANIZATION_INTERACTIVE_VIEWER.userUuid,
1107
+ }))).toEqual(true);
1108
+ });
1109
+ it('cannot view other users AiAgentThread', () => {
1110
+ expect(ability.can('view', subject('AiAgentThread', {
1111
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1112
+ userUuid: 'another-user-uuid',
1113
+ }))).toEqual(false);
1114
+ });
1115
+ it('cannot manage his own AiAgentThread', () => {
1116
+ expect(ability.can('manage', subject('AiAgentThread', {
1117
+ organizationUuid: ORGANIZATION_INTERACTIVE_VIEWER.organizationUuid,
1118
+ userUuid: ORGANIZATION_INTERACTIVE_VIEWER.userUuid,
1119
+ }))).toEqual(false);
1120
+ });
1121
+ it('cannot create AiAgentThread in another organization', () => {
1122
+ expect(ability.can('create', subject('AiAgentThread', {
1123
+ organizationUuid: '5678',
1124
+ }))).toEqual(false);
1125
+ });
1126
+ });
1127
+ });
1128
+ });
1129
+ describe('Project creation permissions', () => {
1130
+ [
1131
+ {
1132
+ membership: ORGANIZATION_ADMIN,
1133
+ canCreateProject: true,
1134
+ canCreatePreview: true,
1135
+ canDeleteProject: true,
1136
+ canDeletePreview: true,
1137
+ },
1138
+ {
1139
+ membership: ORGANIZATION_DEVELOPER,
1140
+ canCreateProject: false,
1141
+ canCreatePreview: true,
1142
+ canDeleteProject: false,
1143
+ canDeletePreview: true,
1144
+ },
1145
+ {
1146
+ membership: ORGANIZATION_MEMBER,
1147
+ canCreateProject: false,
1148
+ canCreatePreview: false,
1149
+ canDeleteProject: false,
1150
+ canDeletePreview: false,
1151
+ },
1152
+ {
1153
+ membership: ORGANIZATION_VIEWER,
1154
+ canCreateProject: false,
1155
+ canCreatePreview: false,
1156
+ canDeleteProject: false,
1157
+ canDeletePreview: false,
1158
+ },
1159
+ {
1160
+ membership: ORGANIZATION_INTERACTIVE_VIEWER,
1161
+ canCreateProject: false,
1162
+ canCreatePreview: false,
1163
+ canDeleteProject: false,
1164
+ canDeletePreview: false,
1165
+ },
1166
+ {
1167
+ membership: ORGANIZATION_EDITOR,
1168
+ canCreateProject: false,
1169
+ canCreatePreview: false,
1170
+ canDeleteProject: false,
1171
+ canDeletePreview: false,
1172
+ },
1173
+ ].forEach(({ membership, canCreateProject, canCreatePreview, canDeleteProject, canDeletePreview, }) => {
1174
+ const ability = defineAbilityForOrganizationMember(membership);
1175
+ describe(`user is '${membership.role}' role`, () => {
1176
+ it('checks if users can create project in organization they belong to', () => {
1177
+ expect(ability.can('create', subject('Project', {
1178
+ organizationUuid: membership.organizationUuid,
1179
+ type: ProjectType.DEFAULT,
1180
+ }))).toEqual(canCreateProject);
1181
+ });
1182
+ it('checks that users cannot create a project in another organization', () => {
1183
+ expect(ability.can('create', subject('Project', {
1184
+ organizationUuid: '789',
1185
+ type: ProjectType.DEFAULT,
1186
+ }))).toEqual(false);
1187
+ });
1188
+ it('checks if users can create a PREVIEW project in organization they belong to', () => {
1189
+ expect(ability.can('create', subject('Project', {
1190
+ organizationUuid: membership.organizationUuid,
1191
+ type: ProjectType.PREVIEW,
1192
+ }))).toEqual(canCreatePreview);
1193
+ });
1194
+ it('checks that users cannot create a PREVIEW project in another organization', () => {
1195
+ expect(ability.can('create', subject('Project', {
1196
+ organizationUuid: '789',
1197
+ type: ProjectType.PREVIEW,
1198
+ }))).toEqual(false);
1199
+ });
1200
+ it('checks if users can delete a project in organization they belong to', () => {
1201
+ expect(ability.can('delete', subject('Project', {
1202
+ organizationUuid: membership.organizationUuid,
1203
+ }))).toEqual(canDeleteProject);
1204
+ });
1205
+ it('checks that users cannot delete a project in another organization', () => {
1206
+ expect(ability.can('delete', subject('Project', {
1207
+ organizationUuid: '789',
1208
+ }))).toEqual(false);
1209
+ });
1210
+ it('checks if users can delete a PREVIEW project in organization they belong to', () => {
1211
+ expect(ability.can('delete', subject('Project', {
1212
+ organizationUuid: membership.organizationUuid,
1213
+ type: ProjectType.PREVIEW,
1214
+ }))).toEqual(canDeletePreview);
1215
+ });
1216
+ it('checks that users cannot delete a PREVIEW project in another organization', () => {
1217
+ expect(ability.can('delete', subject('Project', {
1218
+ organizationUuid: '789',
1219
+ type: ProjectType.PREVIEW,
1220
+ }))).toEqual(false);
1221
+ });
1222
+ });
1223
+ });
1224
+ });
1225
+ // test permissionsConfig
1226
+ describe('Personal Access Tokens permissions', () => {
1227
+ it('cannot create a personal access token as PAT is disabled', () => {
1228
+ const ability = defineAbilityForOrganizationMember(ORGANIZATION_ADMIN, {
1229
+ pat: {
1230
+ enabled: false,
1231
+ allowedOrgRoles: Object.values(OrganizationMemberRole),
1232
+ },
1233
+ });
1234
+ expect(ability.can('create', subject('PersonalAccessToken', {
1235
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
1236
+ userUuid: ORGANIZATION_ADMIN.userUuid,
1237
+ }))).toEqual(false);
1238
+ });
1239
+ it('cannot create a personal access token as PAT allowed roles dont match', () => {
1240
+ const ability = defineAbilityForOrganizationMember(ORGANIZATION_DEVELOPER, {
1241
+ pat: {
1242
+ enabled: true,
1243
+ allowedOrgRoles: [OrganizationMemberRole.ADMIN],
1244
+ },
1245
+ });
1246
+ expect(ability.can('create', subject('PersonalAccessToken', {
1247
+ organizationUuid: ORGANIZATION_DEVELOPER.organizationUuid,
1248
+ userUuid: ORGANIZATION_DEVELOPER.userUuid,
1249
+ }))).toEqual(false);
1250
+ });
1251
+ it('can create a personal access token as PAT is enabled', () => {
1252
+ const ability = defineAbilityForOrganizationMember(ORGANIZATION_ADMIN, {
1253
+ pat: {
1254
+ enabled: true,
1255
+ allowedOrgRoles: [OrganizationMemberRole.ADMIN],
1256
+ },
1257
+ });
1258
+ expect(ability.can('create', subject('PersonalAccessToken', {
1259
+ organizationUuid: ORGANIZATION_ADMIN.organizationUuid,
1260
+ userUuid: ORGANIZATION_ADMIN.userUuid,
1261
+ }))).toEqual(true);
1262
+ });
1263
+ });
1264
+ });
1265
+ //# sourceMappingURL=organizationMemberAbility.test.js.map