@nocobase/plugin-flow-engine 2.1.0-alpha.13 → 2.1.0-alpha.15

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 (661) hide show
  1. package/dist/ai/ai-employees/nathan/index.js +1 -112
  2. package/dist/ai/ai-employees/nathan/prompt.md +132 -0
  3. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/getContextApis.js +2 -2
  4. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/getContextEnvs.js +2 -2
  5. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/getContextVars.js +2 -2
  6. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/lintAndTestJS.js +2 -2
  7. package/dist/client/index.js +1 -1
  8. package/dist/externalVersion.js +10 -13
  9. package/dist/locale/en-US.json +1 -0
  10. package/dist/locale/index.d.ts +2 -0
  11. package/dist/locale/zh-CN.json +1 -0
  12. package/dist/node_modules/ses/package.json +1 -1
  13. package/dist/node_modules/zod/package.json +1 -1
  14. package/dist/server/flow-surfaces/action-scope.d.ts +37 -0
  15. package/dist/server/flow-surfaces/action-scope.js +146 -0
  16. package/dist/server/flow-surfaces/builder.d.ts +209 -0
  17. package/dist/server/flow-surfaces/builder.js +858 -0
  18. package/dist/server/flow-surfaces/catalog.d.ts +65 -0
  19. package/dist/server/flow-surfaces/catalog.js +2766 -0
  20. package/dist/server/flow-surfaces/chart-config.d.ts +121 -0
  21. package/dist/server/flow-surfaces/chart-config.js +1394 -0
  22. package/dist/server/flow-surfaces/compiler.d.ts +22 -0
  23. package/dist/server/flow-surfaces/compiler.js +1129 -0
  24. package/dist/server/flow-surfaces/configure-options.d.ts +23 -0
  25. package/dist/server/flow-surfaces/configure-options.js +671 -0
  26. package/dist/server/flow-surfaces/constants.d.ts +13 -0
  27. package/dist/server/flow-surfaces/constants.js +137 -0
  28. package/dist/server/flow-surfaces/context.d.ts +72 -0
  29. package/dist/server/flow-surfaces/context.js +556 -0
  30. package/dist/server/flow-surfaces/contract-guard.d.ts +19 -0
  31. package/dist/server/flow-surfaces/contract-guard.js +411 -0
  32. package/dist/server/flow-surfaces/errors.d.ts +47 -0
  33. package/dist/server/flow-surfaces/errors.js +145 -0
  34. package/dist/server/flow-surfaces/executor.d.ts +13 -0
  35. package/dist/server/flow-surfaces/executor.js +97 -0
  36. package/dist/server/flow-surfaces/field-semantics.d.ts +15 -0
  37. package/dist/server/flow-surfaces/field-semantics.js +80 -0
  38. package/dist/server/{flow-schema-registry → flow-surfaces}/index.d.ts +3 -2
  39. package/dist/server/flow-surfaces/index.js +352 -0
  40. package/dist/server/flow-surfaces/locator.d.ts +28 -0
  41. package/dist/server/flow-surfaces/locator.js +238 -0
  42. package/dist/server/flow-surfaces/placement.d.ts +33 -0
  43. package/dist/server/flow-surfaces/placement.js +192 -0
  44. package/dist/server/flow-surfaces/route-sync.d.ts +47 -0
  45. package/dist/server/flow-surfaces/route-sync.js +392 -0
  46. package/dist/server/flow-surfaces/service.d.ts +530 -0
  47. package/dist/server/flow-surfaces/service.js +7736 -0
  48. package/dist/server/flow-surfaces/support-matrix.d.ts +28 -0
  49. package/dist/server/flow-surfaces/support-matrix.js +246 -0
  50. package/dist/server/flow-surfaces/surface-context.d.ts +51 -0
  51. package/dist/server/flow-surfaces/surface-context.js +356 -0
  52. package/dist/server/flow-surfaces/types.d.ts +192 -0
  53. package/dist/server/index.d.ts +1 -1
  54. package/dist/server/index.js +6 -4
  55. package/dist/server/plugin.d.ts +0 -3
  56. package/dist/server/plugin.js +7 -36
  57. package/dist/server/repository.d.ts +9 -68
  58. package/dist/server/repository.js +106 -420
  59. package/dist/server/server.d.ts +0 -7
  60. package/dist/server/server.js +53 -23
  61. package/dist/server/variables/resolve.d.ts +21 -0
  62. package/dist/server/variables/resolve.js +79 -0
  63. package/dist/swagger/flow-surfaces.d.ts +3186 -0
  64. package/dist/swagger/flow-surfaces.js +4320 -0
  65. package/dist/swagger/index.d.ts +2837 -810
  66. package/dist/swagger/index.js +14 -696
  67. package/package.json +2 -4
  68. package/dist/node_modules/ajv/.runkit_example.js +0 -23
  69. package/dist/node_modules/ajv/LICENSE +0 -22
  70. package/dist/node_modules/ajv/dist/2019.d.ts +0 -19
  71. package/dist/node_modules/ajv/dist/2019.js +0 -61
  72. package/dist/node_modules/ajv/dist/2020.d.ts +0 -19
  73. package/dist/node_modules/ajv/dist/2020.js +0 -55
  74. package/dist/node_modules/ajv/dist/ajv.d.ts +0 -18
  75. package/dist/node_modules/ajv/dist/ajv.js +0 -7
  76. package/dist/node_modules/ajv/dist/compile/codegen/code.d.ts +0 -40
  77. package/dist/node_modules/ajv/dist/compile/codegen/code.js +0 -156
  78. package/dist/node_modules/ajv/dist/compile/codegen/index.d.ts +0 -79
  79. package/dist/node_modules/ajv/dist/compile/codegen/index.js +0 -697
  80. package/dist/node_modules/ajv/dist/compile/codegen/scope.d.ts +0 -79
  81. package/dist/node_modules/ajv/dist/compile/codegen/scope.js +0 -143
  82. package/dist/node_modules/ajv/dist/compile/errors.d.ts +0 -13
  83. package/dist/node_modules/ajv/dist/compile/errors.js +0 -123
  84. package/dist/node_modules/ajv/dist/compile/index.d.ts +0 -80
  85. package/dist/node_modules/ajv/dist/compile/index.js +0 -242
  86. package/dist/node_modules/ajv/dist/compile/jtd/parse.d.ts +0 -4
  87. package/dist/node_modules/ajv/dist/compile/jtd/parse.js +0 -350
  88. package/dist/node_modules/ajv/dist/compile/jtd/serialize.d.ts +0 -4
  89. package/dist/node_modules/ajv/dist/compile/jtd/serialize.js +0 -236
  90. package/dist/node_modules/ajv/dist/compile/jtd/types.d.ts +0 -6
  91. package/dist/node_modules/ajv/dist/compile/jtd/types.js +0 -14
  92. package/dist/node_modules/ajv/dist/compile/names.d.ts +0 -20
  93. package/dist/node_modules/ajv/dist/compile/names.js +0 -28
  94. package/dist/node_modules/ajv/dist/compile/ref_error.d.ts +0 -6
  95. package/dist/node_modules/ajv/dist/compile/ref_error.js +0 -12
  96. package/dist/node_modules/ajv/dist/compile/resolve.d.ts +0 -12
  97. package/dist/node_modules/ajv/dist/compile/resolve.js +0 -155
  98. package/dist/node_modules/ajv/dist/compile/rules.d.ts +0 -28
  99. package/dist/node_modules/ajv/dist/compile/rules.js +0 -26
  100. package/dist/node_modules/ajv/dist/compile/util.d.ts +0 -40
  101. package/dist/node_modules/ajv/dist/compile/util.js +0 -178
  102. package/dist/node_modules/ajv/dist/compile/validate/applicability.d.ts +0 -6
  103. package/dist/node_modules/ajv/dist/compile/validate/applicability.js +0 -19
  104. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.d.ts +0 -4
  105. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -50
  106. package/dist/node_modules/ajv/dist/compile/validate/dataType.d.ts +0 -17
  107. package/dist/node_modules/ajv/dist/compile/validate/dataType.js +0 -203
  108. package/dist/node_modules/ajv/dist/compile/validate/defaults.d.ts +0 -2
  109. package/dist/node_modules/ajv/dist/compile/validate/defaults.js +0 -35
  110. package/dist/node_modules/ajv/dist/compile/validate/index.d.ts +0 -42
  111. package/dist/node_modules/ajv/dist/compile/validate/index.js +0 -520
  112. package/dist/node_modules/ajv/dist/compile/validate/keyword.d.ts +0 -8
  113. package/dist/node_modules/ajv/dist/compile/validate/keyword.js +0 -124
  114. package/dist/node_modules/ajv/dist/compile/validate/subschema.d.ts +0 -47
  115. package/dist/node_modules/ajv/dist/compile/validate/subschema.js +0 -81
  116. package/dist/node_modules/ajv/dist/core.d.ts +0 -174
  117. package/dist/node_modules/ajv/dist/core.js +0 -618
  118. package/dist/node_modules/ajv/dist/jtd.d.ts +0 -47
  119. package/dist/node_modules/ajv/dist/jtd.js +0 -72
  120. package/dist/node_modules/ajv/dist/refs/data.json +0 -13
  121. package/dist/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts +0 -2
  122. package/dist/node_modules/ajv/dist/refs/json-schema-2019-09/index.js +0 -28
  123. package/dist/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json +0 -53
  124. package/dist/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json +0 -17
  125. package/dist/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json +0 -57
  126. package/dist/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json +0 -14
  127. package/dist/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json +0 -37
  128. package/dist/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json +0 -90
  129. package/dist/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json +0 -39
  130. package/dist/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts +0 -2
  131. package/dist/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +0 -30
  132. package/dist/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json +0 -48
  133. package/dist/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json +0 -17
  134. package/dist/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json +0 -51
  135. package/dist/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json +0 -14
  136. package/dist/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json +0 -37
  137. package/dist/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json +0 -15
  138. package/dist/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json +0 -90
  139. package/dist/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json +0 -55
  140. package/dist/node_modules/ajv/dist/refs/json-schema-draft-06.json +0 -137
  141. package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json +0 -151
  142. package/dist/node_modules/ajv/dist/refs/json-schema-secure.json +0 -88
  143. package/dist/node_modules/ajv/dist/refs/jtd-schema.d.ts +0 -3
  144. package/dist/node_modules/ajv/dist/refs/jtd-schema.js +0 -118
  145. package/dist/node_modules/ajv/dist/runtime/equal.d.ts +0 -6
  146. package/dist/node_modules/ajv/dist/runtime/equal.js +0 -7
  147. package/dist/node_modules/ajv/dist/runtime/parseJson.d.ts +0 -18
  148. package/dist/node_modules/ajv/dist/runtime/parseJson.js +0 -185
  149. package/dist/node_modules/ajv/dist/runtime/quote.d.ts +0 -5
  150. package/dist/node_modules/ajv/dist/runtime/quote.js +0 -30
  151. package/dist/node_modules/ajv/dist/runtime/re2.d.ts +0 -6
  152. package/dist/node_modules/ajv/dist/runtime/re2.js +0 -6
  153. package/dist/node_modules/ajv/dist/runtime/timestamp.d.ts +0 -5
  154. package/dist/node_modules/ajv/dist/runtime/timestamp.js +0 -42
  155. package/dist/node_modules/ajv/dist/runtime/ucs2length.d.ts +0 -5
  156. package/dist/node_modules/ajv/dist/runtime/ucs2length.js +0 -24
  157. package/dist/node_modules/ajv/dist/runtime/uri.d.ts +0 -6
  158. package/dist/node_modules/ajv/dist/runtime/uri.js +0 -6
  159. package/dist/node_modules/ajv/dist/runtime/validation_error.d.ts +0 -7
  160. package/dist/node_modules/ajv/dist/runtime/validation_error.js +0 -11
  161. package/dist/node_modules/ajv/dist/standalone/index.d.ts +0 -6
  162. package/dist/node_modules/ajv/dist/standalone/index.js +0 -90
  163. package/dist/node_modules/ajv/dist/standalone/instance.d.ts +0 -12
  164. package/dist/node_modules/ajv/dist/standalone/instance.js +0 -35
  165. package/dist/node_modules/ajv/dist/types/index.d.ts +0 -183
  166. package/dist/node_modules/ajv/dist/types/index.js +0 -3
  167. package/dist/node_modules/ajv/dist/types/json-schema.d.ts +0 -125
  168. package/dist/node_modules/ajv/dist/types/json-schema.js +0 -3
  169. package/dist/node_modules/ajv/dist/types/jtd-schema.d.ts +0 -174
  170. package/dist/node_modules/ajv/dist/types/jtd-schema.js +0 -3
  171. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts +0 -8
  172. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -49
  173. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts +0 -6
  174. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -106
  175. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts +0 -3
  176. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -23
  177. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts +0 -4
  178. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -12
  179. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts +0 -7
  180. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -95
  181. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts +0 -21
  182. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -85
  183. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts +0 -3
  184. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +0 -11
  185. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.d.ts +0 -6
  186. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -66
  187. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.d.ts +0 -13
  188. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -44
  189. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.d.ts +0 -5
  190. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -52
  191. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts +0 -6
  192. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -30
  193. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.d.ts +0 -4
  194. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -26
  195. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts +0 -6
  196. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -60
  197. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts +0 -3
  198. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -75
  199. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts +0 -3
  200. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -12
  201. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts +0 -3
  202. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -54
  203. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts +0 -6
  204. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -38
  205. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts +0 -3
  206. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -13
  207. package/dist/node_modules/ajv/dist/vocabularies/code.d.ts +0 -17
  208. package/dist/node_modules/ajv/dist/vocabularies/code.js +0 -131
  209. package/dist/node_modules/ajv/dist/vocabularies/core/id.d.ts +0 -3
  210. package/dist/node_modules/ajv/dist/vocabularies/core/id.js +0 -10
  211. package/dist/node_modules/ajv/dist/vocabularies/core/index.d.ts +0 -3
  212. package/dist/node_modules/ajv/dist/vocabularies/core/index.js +0 -16
  213. package/dist/node_modules/ajv/dist/vocabularies/core/ref.d.ts +0 -8
  214. package/dist/node_modules/ajv/dist/vocabularies/core/ref.js +0 -122
  215. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts +0 -5
  216. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -104
  217. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts +0 -10
  218. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -9
  219. package/dist/node_modules/ajv/dist/vocabularies/draft2020.d.ts +0 -3
  220. package/dist/node_modules/ajv/dist/vocabularies/draft2020.js +0 -23
  221. package/dist/node_modules/ajv/dist/vocabularies/draft7.d.ts +0 -3
  222. package/dist/node_modules/ajv/dist/vocabularies/draft7.js +0 -17
  223. package/dist/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts +0 -5
  224. package/dist/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +0 -30
  225. package/dist/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts +0 -5
  226. package/dist/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +0 -51
  227. package/dist/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts +0 -3
  228. package/dist/node_modules/ajv/dist/vocabularies/dynamic/index.js +0 -9
  229. package/dist/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts +0 -3
  230. package/dist/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +0 -16
  231. package/dist/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts +0 -3
  232. package/dist/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +0 -10
  233. package/dist/node_modules/ajv/dist/vocabularies/errors.d.ts +0 -9
  234. package/dist/node_modules/ajv/dist/vocabularies/errors.js +0 -3
  235. package/dist/node_modules/ajv/dist/vocabularies/format/format.d.ts +0 -8
  236. package/dist/node_modules/ajv/dist/vocabularies/format/format.js +0 -92
  237. package/dist/node_modules/ajv/dist/vocabularies/format/index.d.ts +0 -3
  238. package/dist/node_modules/ajv/dist/vocabularies/format/index.js +0 -6
  239. package/dist/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts +0 -6
  240. package/dist/node_modules/ajv/dist/vocabularies/jtd/discriminator.js +0 -71
  241. package/dist/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts +0 -5
  242. package/dist/node_modules/ajv/dist/vocabularies/jtd/elements.js +0 -24
  243. package/dist/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts +0 -6
  244. package/dist/node_modules/ajv/dist/vocabularies/jtd/enum.js +0 -43
  245. package/dist/node_modules/ajv/dist/vocabularies/jtd/error.d.ts +0 -9
  246. package/dist/node_modules/ajv/dist/vocabularies/jtd/error.js +0 -20
  247. package/dist/node_modules/ajv/dist/vocabularies/jtd/index.d.ts +0 -10
  248. package/dist/node_modules/ajv/dist/vocabularies/jtd/index.js +0 -29
  249. package/dist/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts +0 -5
  250. package/dist/node_modules/ajv/dist/vocabularies/jtd/metadata.js +0 -25
  251. package/dist/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts +0 -4
  252. package/dist/node_modules/ajv/dist/vocabularies/jtd/nullable.js +0 -22
  253. package/dist/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts +0 -3
  254. package/dist/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js +0 -15
  255. package/dist/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts +0 -22
  256. package/dist/node_modules/ajv/dist/vocabularies/jtd/properties.js +0 -149
  257. package/dist/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts +0 -4
  258. package/dist/node_modules/ajv/dist/vocabularies/jtd/ref.js +0 -67
  259. package/dist/node_modules/ajv/dist/vocabularies/jtd/type.d.ts +0 -10
  260. package/dist/node_modules/ajv/dist/vocabularies/jtd/type.js +0 -69
  261. package/dist/node_modules/ajv/dist/vocabularies/jtd/union.d.ts +0 -3
  262. package/dist/node_modules/ajv/dist/vocabularies/jtd/union.js +0 -12
  263. package/dist/node_modules/ajv/dist/vocabularies/jtd/values.d.ts +0 -5
  264. package/dist/node_modules/ajv/dist/vocabularies/jtd/values.js +0 -51
  265. package/dist/node_modules/ajv/dist/vocabularies/metadata.d.ts +0 -3
  266. package/dist/node_modules/ajv/dist/vocabularies/metadata.js +0 -18
  267. package/dist/node_modules/ajv/dist/vocabularies/next.d.ts +0 -3
  268. package/dist/node_modules/ajv/dist/vocabularies/next.js +0 -8
  269. package/dist/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts +0 -3
  270. package/dist/node_modules/ajv/dist/vocabularies/unevaluated/index.js +0 -7
  271. package/dist/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts +0 -6
  272. package/dist/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +0 -40
  273. package/dist/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts +0 -6
  274. package/dist/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +0 -65
  275. package/dist/node_modules/ajv/dist/vocabularies/validation/const.d.ts +0 -6
  276. package/dist/node_modules/ajv/dist/vocabularies/validation/const.js +0 -25
  277. package/dist/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts +0 -5
  278. package/dist/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +0 -12
  279. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.d.ts +0 -8
  280. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -48
  281. package/dist/node_modules/ajv/dist/vocabularies/validation/index.d.ts +0 -16
  282. package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +0 -33
  283. package/dist/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts +0 -3
  284. package/dist/node_modules/ajv/dist/vocabularies/validation/limitContains.js +0 -15
  285. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts +0 -3
  286. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -24
  287. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts +0 -3
  288. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -27
  289. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts +0 -11
  290. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -27
  291. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts +0 -3
  292. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -24
  293. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts +0 -8
  294. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -26
  295. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts +0 -8
  296. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -33
  297. package/dist/node_modules/ajv/dist/vocabularies/validation/required.d.ts +0 -8
  298. package/dist/node_modules/ajv/dist/vocabularies/validation/required.js +0 -79
  299. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts +0 -9
  300. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -64
  301. package/dist/node_modules/ajv/lib/2019.ts +0 -81
  302. package/dist/node_modules/ajv/lib/2020.ts +0 -75
  303. package/dist/node_modules/ajv/lib/ajv.ts +0 -70
  304. package/dist/node_modules/ajv/lib/compile/codegen/code.ts +0 -169
  305. package/dist/node_modules/ajv/lib/compile/codegen/index.ts +0 -852
  306. package/dist/node_modules/ajv/lib/compile/codegen/scope.ts +0 -215
  307. package/dist/node_modules/ajv/lib/compile/errors.ts +0 -184
  308. package/dist/node_modules/ajv/lib/compile/index.ts +0 -324
  309. package/dist/node_modules/ajv/lib/compile/jtd/parse.ts +0 -411
  310. package/dist/node_modules/ajv/lib/compile/jtd/serialize.ts +0 -277
  311. package/dist/node_modules/ajv/lib/compile/jtd/types.ts +0 -16
  312. package/dist/node_modules/ajv/lib/compile/names.ts +0 -27
  313. package/dist/node_modules/ajv/lib/compile/ref_error.ts +0 -13
  314. package/dist/node_modules/ajv/lib/compile/resolve.ts +0 -149
  315. package/dist/node_modules/ajv/lib/compile/rules.ts +0 -50
  316. package/dist/node_modules/ajv/lib/compile/util.ts +0 -213
  317. package/dist/node_modules/ajv/lib/compile/validate/applicability.ts +0 -22
  318. package/dist/node_modules/ajv/lib/compile/validate/boolSchema.ts +0 -47
  319. package/dist/node_modules/ajv/lib/compile/validate/dataType.ts +0 -230
  320. package/dist/node_modules/ajv/lib/compile/validate/defaults.ts +0 -32
  321. package/dist/node_modules/ajv/lib/compile/validate/index.ts +0 -582
  322. package/dist/node_modules/ajv/lib/compile/validate/keyword.ts +0 -171
  323. package/dist/node_modules/ajv/lib/compile/validate/subschema.ts +0 -135
  324. package/dist/node_modules/ajv/lib/core.ts +0 -892
  325. package/dist/node_modules/ajv/lib/jtd.ts +0 -132
  326. package/dist/node_modules/ajv/lib/refs/data.json +0 -13
  327. package/dist/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts +0 -28
  328. package/dist/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json +0 -53
  329. package/dist/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json +0 -17
  330. package/dist/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json +0 -57
  331. package/dist/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json +0 -14
  332. package/dist/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json +0 -37
  333. package/dist/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json +0 -90
  334. package/dist/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json +0 -39
  335. package/dist/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts +0 -30
  336. package/dist/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json +0 -48
  337. package/dist/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json +0 -17
  338. package/dist/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json +0 -51
  339. package/dist/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json +0 -14
  340. package/dist/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json +0 -37
  341. package/dist/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json +0 -15
  342. package/dist/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json +0 -90
  343. package/dist/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json +0 -55
  344. package/dist/node_modules/ajv/lib/refs/json-schema-draft-06.json +0 -137
  345. package/dist/node_modules/ajv/lib/refs/json-schema-draft-07.json +0 -151
  346. package/dist/node_modules/ajv/lib/refs/json-schema-secure.json +0 -88
  347. package/dist/node_modules/ajv/lib/refs/jtd-schema.ts +0 -130
  348. package/dist/node_modules/ajv/lib/runtime/equal.ts +0 -7
  349. package/dist/node_modules/ajv/lib/runtime/parseJson.ts +0 -177
  350. package/dist/node_modules/ajv/lib/runtime/quote.ts +0 -31
  351. package/dist/node_modules/ajv/lib/runtime/re2.ts +0 -6
  352. package/dist/node_modules/ajv/lib/runtime/timestamp.ts +0 -46
  353. package/dist/node_modules/ajv/lib/runtime/ucs2length.ts +0 -20
  354. package/dist/node_modules/ajv/lib/runtime/uri.ts +0 -6
  355. package/dist/node_modules/ajv/lib/runtime/validation_error.ts +0 -13
  356. package/dist/node_modules/ajv/lib/standalone/index.ts +0 -100
  357. package/dist/node_modules/ajv/lib/standalone/instance.ts +0 -36
  358. package/dist/node_modules/ajv/lib/types/index.ts +0 -244
  359. package/dist/node_modules/ajv/lib/types/json-schema.ts +0 -187
  360. package/dist/node_modules/ajv/lib/types/jtd-schema.ts +0 -273
  361. package/dist/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts +0 -56
  362. package/dist/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts +0 -118
  363. package/dist/node_modules/ajv/lib/vocabularies/applicator/allOf.ts +0 -22
  364. package/dist/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts +0 -14
  365. package/dist/node_modules/ajv/lib/vocabularies/applicator/contains.ts +0 -109
  366. package/dist/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts +0 -112
  367. package/dist/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts +0 -11
  368. package/dist/node_modules/ajv/lib/vocabularies/applicator/if.ts +0 -80
  369. package/dist/node_modules/ajv/lib/vocabularies/applicator/index.ts +0 -53
  370. package/dist/node_modules/ajv/lib/vocabularies/applicator/items.ts +0 -59
  371. package/dist/node_modules/ajv/lib/vocabularies/applicator/items2020.ts +0 -36
  372. package/dist/node_modules/ajv/lib/vocabularies/applicator/not.ts +0 -38
  373. package/dist/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts +0 -82
  374. package/dist/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts +0 -91
  375. package/dist/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts +0 -12
  376. package/dist/node_modules/ajv/lib/vocabularies/applicator/properties.ts +0 -57
  377. package/dist/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts +0 -50
  378. package/dist/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts +0 -13
  379. package/dist/node_modules/ajv/lib/vocabularies/code.ts +0 -168
  380. package/dist/node_modules/ajv/lib/vocabularies/core/id.ts +0 -10
  381. package/dist/node_modules/ajv/lib/vocabularies/core/index.ts +0 -16
  382. package/dist/node_modules/ajv/lib/vocabularies/core/ref.ts +0 -129
  383. package/dist/node_modules/ajv/lib/vocabularies/discriminator/index.ts +0 -113
  384. package/dist/node_modules/ajv/lib/vocabularies/discriminator/types.ts +0 -12
  385. package/dist/node_modules/ajv/lib/vocabularies/draft2020.ts +0 -23
  386. package/dist/node_modules/ajv/lib/vocabularies/draft7.ts +0 -17
  387. package/dist/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts +0 -31
  388. package/dist/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts +0 -51
  389. package/dist/node_modules/ajv/lib/vocabularies/dynamic/index.ts +0 -9
  390. package/dist/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts +0 -14
  391. package/dist/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts +0 -10
  392. package/dist/node_modules/ajv/lib/vocabularies/errors.ts +0 -18
  393. package/dist/node_modules/ajv/lib/vocabularies/format/format.ts +0 -120
  394. package/dist/node_modules/ajv/lib/vocabularies/format/index.ts +0 -6
  395. package/dist/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts +0 -89
  396. package/dist/node_modules/ajv/lib/vocabularies/jtd/elements.ts +0 -32
  397. package/dist/node_modules/ajv/lib/vocabularies/jtd/enum.ts +0 -45
  398. package/dist/node_modules/ajv/lib/vocabularies/jtd/error.ts +0 -23
  399. package/dist/node_modules/ajv/lib/vocabularies/jtd/index.ts +0 -37
  400. package/dist/node_modules/ajv/lib/vocabularies/jtd/metadata.ts +0 -24
  401. package/dist/node_modules/ajv/lib/vocabularies/jtd/nullable.ts +0 -21
  402. package/dist/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts +0 -15
  403. package/dist/node_modules/ajv/lib/vocabularies/jtd/properties.ts +0 -184
  404. package/dist/node_modules/ajv/lib/vocabularies/jtd/ref.ts +0 -76
  405. package/dist/node_modules/ajv/lib/vocabularies/jtd/type.ts +0 -75
  406. package/dist/node_modules/ajv/lib/vocabularies/jtd/union.ts +0 -12
  407. package/dist/node_modules/ajv/lib/vocabularies/jtd/values.ts +0 -58
  408. package/dist/node_modules/ajv/lib/vocabularies/metadata.ts +0 -17
  409. package/dist/node_modules/ajv/lib/vocabularies/next.ts +0 -8
  410. package/dist/node_modules/ajv/lib/vocabularies/unevaluated/index.ts +0 -7
  411. package/dist/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts +0 -47
  412. package/dist/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts +0 -85
  413. package/dist/node_modules/ajv/lib/vocabularies/validation/const.ts +0 -28
  414. package/dist/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts +0 -23
  415. package/dist/node_modules/ajv/lib/vocabularies/validation/enum.ts +0 -54
  416. package/dist/node_modules/ajv/lib/vocabularies/validation/index.ts +0 -49
  417. package/dist/node_modules/ajv/lib/vocabularies/validation/limitContains.ts +0 -16
  418. package/dist/node_modules/ajv/lib/vocabularies/validation/limitItems.ts +0 -26
  419. package/dist/node_modules/ajv/lib/vocabularies/validation/limitLength.ts +0 -30
  420. package/dist/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts +0 -42
  421. package/dist/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts +0 -26
  422. package/dist/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts +0 -34
  423. package/dist/node_modules/ajv/lib/vocabularies/validation/pattern.ts +0 -39
  424. package/dist/node_modules/ajv/lib/vocabularies/validation/required.ts +0 -98
  425. package/dist/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts +0 -79
  426. package/dist/node_modules/ajv/package.json +0 -1
  427. package/dist/server/flow-models/action-handlers.d.ts +0 -26
  428. package/dist/server/flow-models/action-handlers.js +0 -209
  429. package/dist/server/flow-models/http-error-adapter.d.ts +0 -10
  430. package/dist/server/flow-models/http-error-adapter.js +0 -58
  431. package/dist/server/flow-models/mutate-executor.d.ts +0 -17
  432. package/dist/server/flow-models/mutate-executor.js +0 -309
  433. package/dist/server/flow-models/repository-internals/duplicate-helpers.d.ts +0 -12
  434. package/dist/server/flow-models/repository-internals/duplicate-helpers.js +0 -121
  435. package/dist/server/flow-models/repository-internals/ensure-lock.d.ts +0 -15
  436. package/dist/server/flow-models/repository-internals/ensure-lock.js +0 -117
  437. package/dist/server/flow-models/repository-internals/errors.d.ts +0 -21
  438. package/dist/server/flow-models/repository-internals/errors.js +0 -78
  439. package/dist/server/flow-models/schema-contribution-collector.d.ts +0 -28
  440. package/dist/server/flow-models/schema-contribution-collector.js +0 -238
  441. package/dist/server/flow-models/validation-facade.d.ts +0 -29
  442. package/dist/server/flow-models/validation-facade.js +0 -181
  443. package/dist/server/flow-schema-contributions/actions/aclCheck.d.ts +0 -10
  444. package/dist/server/flow-schema-contributions/actions/aclCheck.js +0 -46
  445. package/dist/server/flow-schema-contributions/actions/aclCheckRefresh.d.ts +0 -10
  446. package/dist/server/flow-schema-contributions/actions/aclCheckRefresh.js +0 -46
  447. package/dist/server/flow-schema-contributions/actions/actionLinkageRules.d.ts +0 -10
  448. package/dist/server/flow-schema-contributions/actions/actionLinkageRules.js +0 -48
  449. package/dist/server/flow-schema-contributions/actions/confirm.d.ts +0 -10
  450. package/dist/server/flow-schema-contributions/actions/confirm.js +0 -73
  451. package/dist/server/flow-schema-contributions/actions/customVariable.d.ts +0 -10
  452. package/dist/server/flow-schema-contributions/actions/customVariable.js +0 -76
  453. package/dist/server/flow-schema-contributions/actions/dataScope.d.ts +0 -10
  454. package/dist/server/flow-schema-contributions/actions/dataScope.js +0 -79
  455. package/dist/server/flow-schema-contributions/actions/detailsFieldLinkageRules.d.ts +0 -10
  456. package/dist/server/flow-schema-contributions/actions/detailsFieldLinkageRules.js +0 -62
  457. package/dist/server/flow-schema-contributions/actions/fieldLinkageRules.d.ts +0 -10
  458. package/dist/server/flow-schema-contributions/actions/fieldLinkageRules.js +0 -62
  459. package/dist/server/flow-schema-contributions/actions/filterFormDefaultValues.d.ts +0 -10
  460. package/dist/server/flow-schema-contributions/actions/filterFormDefaultValues.js +0 -80
  461. package/dist/server/flow-schema-contributions/actions/formAssignRules.d.ts +0 -10
  462. package/dist/server/flow-schema-contributions/actions/formAssignRules.js +0 -62
  463. package/dist/server/flow-schema-contributions/actions/index.d.ts +0 -31
  464. package/dist/server/flow-schema-contributions/actions/index.js +0 -117
  465. package/dist/server/flow-schema-contributions/actions/layout.d.ts +0 -10
  466. package/dist/server/flow-schema-contributions/actions/layout.js +0 -68
  467. package/dist/server/flow-schema-contributions/actions/linkageRulesRefresh.d.ts +0 -10
  468. package/dist/server/flow-schema-contributions/actions/linkageRulesRefresh.js +0 -50
  469. package/dist/server/flow-schema-contributions/actions/navigateToURL.d.ts +0 -10
  470. package/dist/server/flow-schema-contributions/actions/navigateToURL.js +0 -82
  471. package/dist/server/flow-schema-contributions/actions/openView.d.ts +0 -10
  472. package/dist/server/flow-schema-contributions/actions/openView.js +0 -68
  473. package/dist/server/flow-schema-contributions/actions/refreshTargetBlocks.d.ts +0 -10
  474. package/dist/server/flow-schema-contributions/actions/refreshTargetBlocks.js +0 -56
  475. package/dist/server/flow-schema-contributions/actions/runjs.d.ts +0 -10
  476. package/dist/server/flow-schema-contributions/actions/runjs.js +0 -55
  477. package/dist/server/flow-schema-contributions/actions/setTargetDataScope.d.ts +0 -10
  478. package/dist/server/flow-schema-contributions/actions/setTargetDataScope.js +0 -59
  479. package/dist/server/flow-schema-contributions/actions/showMessage.d.ts +0 -10
  480. package/dist/server/flow-schema-contributions/actions/showMessage.js +0 -69
  481. package/dist/server/flow-schema-contributions/actions/showNotification.d.ts +0 -10
  482. package/dist/server/flow-schema-contributions/actions/showNotification.js +0 -76
  483. package/dist/server/flow-schema-contributions/actions/sortingRule.d.ts +0 -10
  484. package/dist/server/flow-schema-contributions/actions/sortingRule.js +0 -67
  485. package/dist/server/flow-schema-contributions/field-models.d.ts +0 -12
  486. package/dist/server/flow-schema-contributions/field-models.js +0 -693
  487. package/dist/server/flow-schema-contributions/index.d.ts +0 -13
  488. package/dist/server/flow-schema-contributions/index.js +0 -64
  489. package/dist/server/flow-schema-contributions/models/ActionBulkEditModel.d.ts +0 -10
  490. package/dist/server/flow-schema-contributions/models/ActionBulkEditModel.js +0 -382
  491. package/dist/server/flow-schema-contributions/models/ActionBulkUpdateModel.d.ts +0 -10
  492. package/dist/server/flow-schema-contributions/models/ActionBulkUpdateModel.js +0 -169
  493. package/dist/server/flow-schema-contributions/models/ActionCustomRequestModel.d.ts +0 -11
  494. package/dist/server/flow-schema-contributions/models/ActionCustomRequestModel.js +0 -115
  495. package/dist/server/flow-schema-contributions/models/ActionDuplicateModel.d.ts +0 -10
  496. package/dist/server/flow-schema-contributions/models/ActionDuplicateModel.js +0 -169
  497. package/dist/server/flow-schema-contributions/models/ActionExportModel.d.ts +0 -10
  498. package/dist/server/flow-schema-contributions/models/ActionExportModel.js +0 -141
  499. package/dist/server/flow-schema-contributions/models/ActionImportModel.d.ts +0 -10
  500. package/dist/server/flow-schema-contributions/models/ActionImportModel.js +0 -122
  501. package/dist/server/flow-schema-contributions/models/ActionModel.d.ts +0 -10
  502. package/dist/server/flow-schema-contributions/models/ActionModel.js +0 -202
  503. package/dist/server/flow-schema-contributions/models/AddChildActionModel.d.ts +0 -10
  504. package/dist/server/flow-schema-contributions/models/AddChildActionModel.js +0 -47
  505. package/dist/server/flow-schema-contributions/models/AddNewActionModel.d.ts +0 -10
  506. package/dist/server/flow-schema-contributions/models/AddNewActionModel.js +0 -93
  507. package/dist/server/flow-schema-contributions/models/AssignFormGridModel.d.ts +0 -10
  508. package/dist/server/flow-schema-contributions/models/AssignFormGridModel.js +0 -82
  509. package/dist/server/flow-schema-contributions/models/AssignFormItemModel.d.ts +0 -10
  510. package/dist/server/flow-schema-contributions/models/AssignFormItemModel.js +0 -80
  511. package/dist/server/flow-schema-contributions/models/AssignFormModel.d.ts +0 -10
  512. package/dist/server/flow-schema-contributions/models/AssignFormModel.js +0 -122
  513. package/dist/server/flow-schema-contributions/models/BasePageTabModel.d.ts +0 -10
  514. package/dist/server/flow-schema-contributions/models/BasePageTabModel.js +0 -71
  515. package/dist/server/flow-schema-contributions/models/BlockGridCardModel.d.ts +0 -10
  516. package/dist/server/flow-schema-contributions/models/BlockGridCardModel.js +0 -449
  517. package/dist/server/flow-schema-contributions/models/BlockGridModel.d.ts +0 -10
  518. package/dist/server/flow-schema-contributions/models/BlockGridModel.js +0 -81
  519. package/dist/server/flow-schema-contributions/models/BlockIframeModel.d.ts +0 -10
  520. package/dist/server/flow-schema-contributions/models/BlockIframeModel.js +0 -143
  521. package/dist/server/flow-schema-contributions/models/BlockListModel.d.ts +0 -10
  522. package/dist/server/flow-schema-contributions/models/BlockListModel.js +0 -435
  523. package/dist/server/flow-schema-contributions/models/BlockMarkdownModel.d.ts +0 -10
  524. package/dist/server/flow-schema-contributions/models/BlockMarkdownModel.js +0 -108
  525. package/dist/server/flow-schema-contributions/models/BlockWorkbenchModel.d.ts +0 -10
  526. package/dist/server/flow-schema-contributions/models/BlockWorkbenchModel.js +0 -173
  527. package/dist/server/flow-schema-contributions/models/BulkDeleteActionModel.d.ts +0 -10
  528. package/dist/server/flow-schema-contributions/models/BulkDeleteActionModel.js +0 -47
  529. package/dist/server/flow-schema-contributions/models/ChildPageModel.d.ts +0 -10
  530. package/dist/server/flow-schema-contributions/models/ChildPageModel.js +0 -106
  531. package/dist/server/flow-schema-contributions/models/ChildPageTabModel.d.ts +0 -10
  532. package/dist/server/flow-schema-contributions/models/ChildPageTabModel.js +0 -114
  533. package/dist/server/flow-schema-contributions/models/CommentsModel.d.ts +0 -10
  534. package/dist/server/flow-schema-contributions/models/CommentsModel.js +0 -255
  535. package/dist/server/flow-schema-contributions/models/CreateFormModel.d.ts +0 -10
  536. package/dist/server/flow-schema-contributions/models/CreateFormModel.js +0 -54
  537. package/dist/server/flow-schema-contributions/models/DataVisualizationModel.d.ts +0 -10
  538. package/dist/server/flow-schema-contributions/models/DataVisualizationModel.js +0 -240
  539. package/dist/server/flow-schema-contributions/models/DeleteActionModel.d.ts +0 -10
  540. package/dist/server/flow-schema-contributions/models/DeleteActionModel.js +0 -47
  541. package/dist/server/flow-schema-contributions/models/DetailsBlockModel.d.ts +0 -10
  542. package/dist/server/flow-schema-contributions/models/DetailsBlockModel.js +0 -179
  543. package/dist/server/flow-schema-contributions/models/DetailsGridModel.d.ts +0 -10
  544. package/dist/server/flow-schema-contributions/models/DetailsGridModel.js +0 -82
  545. package/dist/server/flow-schema-contributions/models/DetailsItemModel.d.ts +0 -10
  546. package/dist/server/flow-schema-contributions/models/DetailsItemModel.js +0 -77
  547. package/dist/server/flow-schema-contributions/models/EditActionModel.d.ts +0 -10
  548. package/dist/server/flow-schema-contributions/models/EditActionModel.js +0 -93
  549. package/dist/server/flow-schema-contributions/models/EditFormModel.d.ts +0 -10
  550. package/dist/server/flow-schema-contributions/models/EditFormModel.js +0 -103
  551. package/dist/server/flow-schema-contributions/models/ExpandCollapseActionModel.d.ts +0 -10
  552. package/dist/server/flow-schema-contributions/models/ExpandCollapseActionModel.js +0 -47
  553. package/dist/server/flow-schema-contributions/models/FieldAttachmentUrlModel.d.ts +0 -10
  554. package/dist/server/flow-schema-contributions/models/FieldAttachmentUrlModel.js +0 -87
  555. package/dist/server/flow-schema-contributions/models/FieldCodeModel.d.ts +0 -10
  556. package/dist/server/flow-schema-contributions/models/FieldCodeModel.js +0 -99
  557. package/dist/server/flow-schema-contributions/models/FieldFormulaModel.d.ts +0 -10
  558. package/dist/server/flow-schema-contributions/models/FieldFormulaModel.js +0 -152
  559. package/dist/server/flow-schema-contributions/models/FieldMarkdownVditorModel.d.ts +0 -10
  560. package/dist/server/flow-schema-contributions/models/FieldMarkdownVditorModel.js +0 -92
  561. package/dist/server/flow-schema-contributions/models/FieldSequenceModel.d.ts +0 -10
  562. package/dist/server/flow-schema-contributions/models/FieldSequenceModel.js +0 -60
  563. package/dist/server/flow-schema-contributions/models/FieldSortModel.d.ts +0 -10
  564. package/dist/server/flow-schema-contributions/models/FieldSortModel.js +0 -87
  565. package/dist/server/flow-schema-contributions/models/FileManagerModel.d.ts +0 -10
  566. package/dist/server/flow-schema-contributions/models/FileManagerModel.js +0 -115
  567. package/dist/server/flow-schema-contributions/models/FilterActionModel.d.ts +0 -10
  568. package/dist/server/flow-schema-contributions/models/FilterActionModel.js +0 -57
  569. package/dist/server/flow-schema-contributions/models/FilterFormBlockModel.d.ts +0 -10
  570. package/dist/server/flow-schema-contributions/models/FilterFormBlockModel.js +0 -155
  571. package/dist/server/flow-schema-contributions/models/FilterFormCollapseActionModel.d.ts +0 -10
  572. package/dist/server/flow-schema-contributions/models/FilterFormCollapseActionModel.js +0 -85
  573. package/dist/server/flow-schema-contributions/models/FilterFormCustomFieldModel.d.ts +0 -10
  574. package/dist/server/flow-schema-contributions/models/FilterFormCustomFieldModel.js +0 -89
  575. package/dist/server/flow-schema-contributions/models/FilterFormGridModel.d.ts +0 -10
  576. package/dist/server/flow-schema-contributions/models/FilterFormGridModel.js +0 -82
  577. package/dist/server/flow-schema-contributions/models/FilterFormItemModel.d.ts +0 -10
  578. package/dist/server/flow-schema-contributions/models/FilterFormItemModel.js +0 -77
  579. package/dist/server/flow-schema-contributions/models/FilterFormJSActionModel.d.ts +0 -10
  580. package/dist/server/flow-schema-contributions/models/FilterFormJSActionModel.js +0 -108
  581. package/dist/server/flow-schema-contributions/models/FilterFormResetActionModel.d.ts +0 -10
  582. package/dist/server/flow-schema-contributions/models/FilterFormResetActionModel.js +0 -87
  583. package/dist/server/flow-schema-contributions/models/FilterFormSubmitActionModel.d.ts +0 -10
  584. package/dist/server/flow-schema-contributions/models/FilterFormSubmitActionModel.js +0 -87
  585. package/dist/server/flow-schema-contributions/models/FormAssociationItemModel.d.ts +0 -10
  586. package/dist/server/flow-schema-contributions/models/FormAssociationItemModel.js +0 -78
  587. package/dist/server/flow-schema-contributions/models/FormBlockModel.d.ts +0 -10
  588. package/dist/server/flow-schema-contributions/models/FormBlockModel.js +0 -45
  589. package/dist/server/flow-schema-contributions/models/FormGridModel.d.ts +0 -10
  590. package/dist/server/flow-schema-contributions/models/FormGridModel.js +0 -67
  591. package/dist/server/flow-schema-contributions/models/FormItemModel.d.ts +0 -10
  592. package/dist/server/flow-schema-contributions/models/FormItemModel.js +0 -77
  593. package/dist/server/flow-schema-contributions/models/FormSubmitActionModel.d.ts +0 -10
  594. package/dist/server/flow-schema-contributions/models/FormSubmitActionModel.js +0 -87
  595. package/dist/server/flow-schema-contributions/models/JSActionModel.d.ts +0 -10
  596. package/dist/server/flow-schema-contributions/models/JSActionModel.js +0 -65
  597. package/dist/server/flow-schema-contributions/models/JSBlockModel.d.ts +0 -10
  598. package/dist/server/flow-schema-contributions/models/JSBlockModel.js +0 -90
  599. package/dist/server/flow-schema-contributions/models/JSCollectionActionModel.d.ts +0 -10
  600. package/dist/server/flow-schema-contributions/models/JSCollectionActionModel.js +0 -47
  601. package/dist/server/flow-schema-contributions/models/JSColumnModel.d.ts +0 -10
  602. package/dist/server/flow-schema-contributions/models/JSColumnModel.js +0 -100
  603. package/dist/server/flow-schema-contributions/models/JSFormActionModel.d.ts +0 -10
  604. package/dist/server/flow-schema-contributions/models/JSFormActionModel.js +0 -47
  605. package/dist/server/flow-schema-contributions/models/JSItemModel.d.ts +0 -10
  606. package/dist/server/flow-schema-contributions/models/JSItemModel.js +0 -87
  607. package/dist/server/flow-schema-contributions/models/JSRecordActionModel.d.ts +0 -10
  608. package/dist/server/flow-schema-contributions/models/JSRecordActionModel.js +0 -47
  609. package/dist/server/flow-schema-contributions/models/LinkActionModel.d.ts +0 -10
  610. package/dist/server/flow-schema-contributions/models/LinkActionModel.js +0 -47
  611. package/dist/server/flow-schema-contributions/models/MapModel.d.ts +0 -10
  612. package/dist/server/flow-schema-contributions/models/MapModel.js +0 -427
  613. package/dist/server/flow-schema-contributions/models/PageModel.d.ts +0 -10
  614. package/dist/server/flow-schema-contributions/models/PageModel.js +0 -159
  615. package/dist/server/flow-schema-contributions/models/PageTabModel.d.ts +0 -10
  616. package/dist/server/flow-schema-contributions/models/PageTabModel.js +0 -69
  617. package/dist/server/flow-schema-contributions/models/PopupActionModel.d.ts +0 -10
  618. package/dist/server/flow-schema-contributions/models/PopupActionModel.js +0 -92
  619. package/dist/server/flow-schema-contributions/models/PopupCollectionActionModel.d.ts +0 -10
  620. package/dist/server/flow-schema-contributions/models/PopupCollectionActionModel.js +0 -119
  621. package/dist/server/flow-schema-contributions/models/RefreshActionModel.d.ts +0 -10
  622. package/dist/server/flow-schema-contributions/models/RefreshActionModel.js +0 -47
  623. package/dist/server/flow-schema-contributions/models/RootPageModel.d.ts +0 -10
  624. package/dist/server/flow-schema-contributions/models/RootPageModel.js +0 -124
  625. package/dist/server/flow-schema-contributions/models/RootPageTabModel.d.ts +0 -10
  626. package/dist/server/flow-schema-contributions/models/RootPageTabModel.js +0 -69
  627. package/dist/server/flow-schema-contributions/models/RouteModel.d.ts +0 -10
  628. package/dist/server/flow-schema-contributions/models/RouteModel.js +0 -121
  629. package/dist/server/flow-schema-contributions/models/TableActionsColumnModel.d.ts +0 -10
  630. package/dist/server/flow-schema-contributions/models/TableActionsColumnModel.js +0 -93
  631. package/dist/server/flow-schema-contributions/models/TableBlockModel.d.ts +0 -10
  632. package/dist/server/flow-schema-contributions/models/TableBlockModel.js +0 -254
  633. package/dist/server/flow-schema-contributions/models/TableColumnModel.d.ts +0 -10
  634. package/dist/server/flow-schema-contributions/models/TableColumnModel.js +0 -77
  635. package/dist/server/flow-schema-contributions/models/TableCustomColumnModel.d.ts +0 -10
  636. package/dist/server/flow-schema-contributions/models/TableCustomColumnModel.js +0 -66
  637. package/dist/server/flow-schema-contributions/models/UiTemplatesModel.d.ts +0 -10
  638. package/dist/server/flow-schema-contributions/models/UiTemplatesModel.js +0 -130
  639. package/dist/server/flow-schema-contributions/models/UpdateRecordActionModel.d.ts +0 -10
  640. package/dist/server/flow-schema-contributions/models/UpdateRecordActionModel.js +0 -173
  641. package/dist/server/flow-schema-contributions/models/ViewActionModel.d.ts +0 -10
  642. package/dist/server/flow-schema-contributions/models/ViewActionModel.js +0 -123
  643. package/dist/server/flow-schema-contributions/models/index.d.ts +0 -71
  644. package/dist/server/flow-schema-contributions/models/index.js +0 -371
  645. package/dist/server/flow-schema-contributions/shared.d.ts +0 -501
  646. package/dist/server/flow-schema-contributions/shared.js +0 -1649
  647. package/dist/server/flow-schema-registry/FlowSchemaRegistry.d.ts +0 -154
  648. package/dist/server/flow-schema-registry/FlowSchemaRegistry.js +0 -1424
  649. package/dist/server/flow-schema-registry/flow-schema-registry/fieldBinding.d.ts +0 -32
  650. package/dist/server/flow-schema-registry/flow-schema-registry/fieldBinding.js +0 -159
  651. package/dist/server/flow-schema-registry/flow-schema-registry/modelPatches.d.ts +0 -16
  652. package/dist/server/flow-schema-registry/flow-schema-registry/modelPatches.js +0 -226
  653. package/dist/server/flow-schema-registry/flow-schema-registry/schemaInference.d.ts +0 -17
  654. package/dist/server/flow-schema-registry/flow-schema-registry/schemaInference.js +0 -204
  655. package/dist/server/flow-schema-registry/flow-schema-registry/utils.d.ts +0 -25
  656. package/dist/server/flow-schema-registry/flow-schema-registry/utils.js +0 -278
  657. package/dist/server/flow-schema-registry/index.js +0 -32
  658. package/dist/server/flow-schema-registry/types.d.ts +0 -244
  659. package/dist/server/flow-schema-service.d.ts +0 -87
  660. package/dist/server/flow-schema-service.js +0 -963
  661. /package/dist/server/{flow-schema-registry → flow-surfaces}/types.js +0 -0
@@ -0,0 +1,1394 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+ var chart_config_exports = {};
38
+ __export(chart_config_exports, {
39
+ CHART_BASIC_VISUAL_TYPES: () => CHART_BASIC_VISUAL_TYPES,
40
+ CHART_DEFAULT_DATA_SOURCE_KEY: () => CHART_DEFAULT_DATA_SOURCE_KEY,
41
+ CHART_FUNNEL_SORTS: () => CHART_FUNNEL_SORTS,
42
+ CHART_LABEL_TYPES: () => CHART_LABEL_TYPES,
43
+ CHART_QUERY_AGGREGATIONS: () => CHART_QUERY_AGGREGATIONS,
44
+ CHART_QUERY_MODES: () => CHART_QUERY_MODES,
45
+ CHART_SORT_DIRECTIONS: () => CHART_SORT_DIRECTIONS,
46
+ CHART_SORT_NULLS: () => CHART_SORT_NULLS,
47
+ CHART_VISUAL_MODES: () => CHART_VISUAL_MODES,
48
+ buildChartConfigureFromSemanticChanges: () => buildChartConfigureFromSemanticChanges,
49
+ canonicalizeChartConfigure: () => canonicalizeChartConfigure,
50
+ deriveChartSemanticState: () => deriveChartSemanticState,
51
+ getChartBuilderQueryAliases: () => getChartBuilderQueryAliases,
52
+ getChartBuilderQueryOutputs: () => getChartBuilderQueryOutputs,
53
+ getChartBuilderResourceInit: () => getChartBuilderResourceInit,
54
+ getChartRiskyPatternHints: () => getChartRiskyPatternHints,
55
+ getChartSafeDefaultHints: () => getChartSafeDefaultHints,
56
+ getChartSupportedMappingsByType: () => getChartSupportedMappingsByType,
57
+ getChartSupportedStylesByType: () => getChartSupportedStylesByType,
58
+ getChartSupportedVisualTypes: () => getChartSupportedVisualTypes,
59
+ getChartUnsupportedPatternHints: () => getChartUnsupportedPatternHints,
60
+ getChartVisualCommonStyleKeys: () => getChartVisualCommonStyleKeys,
61
+ getChartVisualMappingAliases: () => getChartVisualMappingAliases,
62
+ isChartBuilderQuery: () => isChartBuilderQuery
63
+ });
64
+ module.exports = __toCommonJS(chart_config_exports);
65
+ var import_lodash = __toESM(require("lodash"));
66
+ var import_errors = require("./errors");
67
+ const CHART_DEFAULT_DATA_SOURCE_KEY = "main";
68
+ const CHART_QUERY_MODES = ["builder", "sql"];
69
+ const CHART_VISUAL_MODES = ["basic", "custom"];
70
+ const CHART_BASIC_VISUAL_TYPES = [
71
+ "line",
72
+ "area",
73
+ "bar",
74
+ "barHorizontal",
75
+ "pie",
76
+ "doughnut",
77
+ "funnel",
78
+ "scatter"
79
+ ];
80
+ const CHART_QUERY_AGGREGATIONS = ["sum", "count", "avg", "max", "min"];
81
+ const CHART_SORT_DIRECTIONS = ["asc", "desc"];
82
+ const CHART_SORT_NULLS = ["default", "first", "last"];
83
+ const CHART_LABEL_TYPES = ["value", "percent"];
84
+ const CHART_FUNNEL_SORTS = ["descending", "ascending"];
85
+ const EMPTY_FILTER_GROUP = {
86
+ logic: "$and",
87
+ items: []
88
+ };
89
+ const CHART_SAFE_DEFAULT_HINTS = [
90
+ {
91
+ key: "builder_basic_minimal",
92
+ title: "Use builder + basic first",
93
+ description: "Prefer query.mode='builder' with visual.mode='basic', a single measure, explicit mappings, and no sorting on the first attempt."
94
+ },
95
+ {
96
+ key: "block_outer_props_only",
97
+ title: "Keep block chrome minimal",
98
+ description: "Expose only the minimal block chrome settings first, then add richer chart query or visual settings only when the first render is stable."
99
+ }
100
+ ];
101
+ const CHART_RISKY_PATTERN_HINTS = [
102
+ {
103
+ key: "basic_multi_measure",
104
+ title: "Basic visual with multiple measures",
105
+ description: "Basic visual mappings with multiple measures often need manual tuning and browser verification."
106
+ },
107
+ {
108
+ key: "custom_visual_raw",
109
+ title: "Custom visual raw option",
110
+ description: "visual.mode='custom' relies on raw ECharts option code and is not schema-validated by FlowSurfaces."
111
+ },
112
+ {
113
+ key: "events_raw",
114
+ title: "Raw chart events",
115
+ description: "events.raw executes custom JS against the chart instance and should always be browser-verified."
116
+ }
117
+ ];
118
+ const CHART_UNSUPPORTED_PATTERN_HINTS = [
119
+ {
120
+ key: "builder_measure_sorting",
121
+ title: "Builder sorting on derived measure outputs",
122
+ description: "Builder query.sorting cannot target aggregated measure outputs or custom measure aliases because the current runtime rejects that shape."
123
+ }
124
+ ];
125
+ const CHART_QUERY_MODE_SET = new Set(CHART_QUERY_MODES);
126
+ const CHART_VISUAL_MODE_SET = new Set(CHART_VISUAL_MODES);
127
+ const CHART_BASIC_VISUAL_TYPE_SET = new Set(CHART_BASIC_VISUAL_TYPES);
128
+ const CHART_QUERY_AGGREGATION_SET = new Set(CHART_QUERY_AGGREGATIONS);
129
+ const CHART_SORT_DIRECTION_SET = new Set(CHART_SORT_DIRECTIONS);
130
+ const CHART_SORT_NULLS_SET = new Set(CHART_SORT_NULLS);
131
+ const CHART_LABEL_TYPE_SET = new Set(CHART_LABEL_TYPES);
132
+ const CHART_FUNNEL_SORT_SET = new Set(CHART_FUNNEL_SORTS);
133
+ const CHART_MAPPING_KEYS = /* @__PURE__ */ new Set(["x", "y", "category", "value", "series", "size"]);
134
+ const CHART_STYLE_KEYS = /* @__PURE__ */ new Set([
135
+ "legend",
136
+ "tooltip",
137
+ "label",
138
+ "boundaryGap",
139
+ "xAxisLabelRotate",
140
+ "yAxisSplitLine",
141
+ "smooth",
142
+ "stack",
143
+ "radiusInner",
144
+ "radiusOuter",
145
+ "labelType",
146
+ "sort",
147
+ "minSize",
148
+ "maxSize"
149
+ ]);
150
+ const CHART_COMMON_STYLE_KEYS = /* @__PURE__ */ new Set(["legend", "tooltip", "label"]);
151
+ const CHART_STYLE_KEYS_BY_TYPE = {
152
+ line: /* @__PURE__ */ new Set(["legend", "tooltip", "label", "boundaryGap", "xAxisLabelRotate", "yAxisSplitLine", "smooth"]),
153
+ area: /* @__PURE__ */ new Set(["legend", "tooltip", "label", "boundaryGap", "xAxisLabelRotate", "yAxisSplitLine", "smooth", "stack"]),
154
+ bar: /* @__PURE__ */ new Set(["legend", "tooltip", "label", "boundaryGap", "xAxisLabelRotate", "yAxisSplitLine", "stack"]),
155
+ barHorizontal: /* @__PURE__ */ new Set(["legend", "tooltip", "label", "boundaryGap", "xAxisLabelRotate", "yAxisSplitLine", "stack"]),
156
+ scatter: /* @__PURE__ */ new Set(["legend", "tooltip", "label", "xAxisLabelRotate", "yAxisSplitLine"]),
157
+ pie: /* @__PURE__ */ new Set(["legend", "tooltip", "label", "radiusInner", "radiusOuter", "labelType"]),
158
+ doughnut: /* @__PURE__ */ new Set(["legend", "tooltip", "label", "radiusInner", "radiusOuter", "labelType"]),
159
+ funnel: /* @__PURE__ */ new Set(["legend", "tooltip", "label", "sort", "minSize", "maxSize"])
160
+ };
161
+ const CHART_MAPPING_KEYS_BY_TYPE = {
162
+ line: /* @__PURE__ */ new Set(["x", "y", "series"]),
163
+ area: /* @__PURE__ */ new Set(["x", "y", "series"]),
164
+ bar: /* @__PURE__ */ new Set(["x", "y", "series"]),
165
+ barHorizontal: /* @__PURE__ */ new Set(["x", "y", "series"]),
166
+ scatter: /* @__PURE__ */ new Set(["x", "y", "series", "size"]),
167
+ pie: /* @__PURE__ */ new Set(["category", "value"]),
168
+ doughnut: /* @__PURE__ */ new Set(["category", "value"]),
169
+ funnel: /* @__PURE__ */ new Set(["category", "value"])
170
+ };
171
+ const CHART_REQUIRED_MAPPING_KEYS_BY_TYPE = {
172
+ line: /* @__PURE__ */ new Set(["x", "y"]),
173
+ area: /* @__PURE__ */ new Set(["x", "y"]),
174
+ bar: /* @__PURE__ */ new Set(["x", "y"]),
175
+ barHorizontal: /* @__PURE__ */ new Set(["x", "y"]),
176
+ scatter: /* @__PURE__ */ new Set(["x", "y"]),
177
+ pie: /* @__PURE__ */ new Set(["category", "value"]),
178
+ doughnut: /* @__PURE__ */ new Set(["category", "value"]),
179
+ funnel: /* @__PURE__ */ new Set(["category", "value"])
180
+ };
181
+ const CHART_STYLE_SUPPORT_BY_KEY = {
182
+ legend: {
183
+ type: "boolean",
184
+ description: "Show or hide legend"
185
+ },
186
+ tooltip: {
187
+ type: "boolean",
188
+ description: "Show or hide tooltip"
189
+ },
190
+ label: {
191
+ type: "boolean",
192
+ description: "Show or hide series labels"
193
+ },
194
+ boundaryGap: {
195
+ type: "boolean",
196
+ description: "Whether the category axis keeps boundary gap"
197
+ },
198
+ xAxisLabelRotate: {
199
+ type: "number",
200
+ min: 0,
201
+ max: 90,
202
+ description: "Rotate x-axis labels in degrees"
203
+ },
204
+ yAxisSplitLine: {
205
+ type: "boolean",
206
+ description: "Show or hide y-axis split lines"
207
+ },
208
+ smooth: {
209
+ type: "boolean",
210
+ description: "Render smooth curves for line and area charts"
211
+ },
212
+ stack: {
213
+ type: "boolean",
214
+ description: "Stack compatible series together"
215
+ },
216
+ radiusInner: {
217
+ type: "number",
218
+ min: 0,
219
+ max: 100,
220
+ description: "Inner radius percentage; when radiusOuter is also set it must be less than or equal to radiusOuter"
221
+ },
222
+ radiusOuter: {
223
+ type: "number",
224
+ min: 0,
225
+ max: 100,
226
+ description: "Outer radius percentage; when radiusInner is also set it must be greater than or equal to radiusInner"
227
+ },
228
+ labelType: {
229
+ type: "string",
230
+ enumValues: [...CHART_LABEL_TYPES],
231
+ description: "Pie or doughnut label content mode"
232
+ },
233
+ sort: {
234
+ type: "string",
235
+ enumValues: [...CHART_FUNNEL_SORTS],
236
+ description: "Funnel ordering direction"
237
+ },
238
+ minSize: {
239
+ type: "number",
240
+ min: 0,
241
+ max: 100,
242
+ description: "Funnel minimum percentage size; when maxSize is also set it must be less than or equal to maxSize"
243
+ },
244
+ maxSize: {
245
+ type: "number",
246
+ min: 0,
247
+ max: 100,
248
+ description: "Funnel maximum percentage size; when minSize is also set it must be greater than or equal to minSize"
249
+ }
250
+ };
251
+ function hasOwn(input, key) {
252
+ return Object.prototype.hasOwnProperty.call(input || {}, key);
253
+ }
254
+ function hasAnyOwn(input, keys) {
255
+ return keys.some((key) => hasOwn(input, key));
256
+ }
257
+ function hasMeaningfulSemanticPatch(input, key) {
258
+ if (!hasOwn(input, key)) {
259
+ return false;
260
+ }
261
+ const value = input == null ? void 0 : input[key];
262
+ if (import_lodash.default.isNull(value)) {
263
+ return true;
264
+ }
265
+ if (import_lodash.default.isPlainObject(value)) {
266
+ return Object.keys(value).length > 0;
267
+ }
268
+ return !import_lodash.default.isUndefined(value);
269
+ }
270
+ function buildDefinedObject(input) {
271
+ const result = {};
272
+ for (const [key, value] of Object.entries(input)) {
273
+ if (!import_lodash.default.isUndefined(value)) {
274
+ result[key] = value;
275
+ }
276
+ }
277
+ return result;
278
+ }
279
+ function ensurePlainObject(input, label) {
280
+ if (!import_lodash.default.isPlainObject(input)) {
281
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} must be an object`);
282
+ }
283
+ return input;
284
+ }
285
+ function normalizeTrimmedString(input, label, options = {}) {
286
+ if (typeof input !== "string") {
287
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} must be a string`);
288
+ }
289
+ const normalized = input.trim();
290
+ if (!options.allowEmpty && !normalized) {
291
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} cannot be empty`);
292
+ }
293
+ return normalized;
294
+ }
295
+ function normalizeOptionalTrimmedString(input, label) {
296
+ if (import_lodash.default.isUndefined(input) || import_lodash.default.isNull(input)) {
297
+ return void 0;
298
+ }
299
+ return normalizeTrimmedString(input, label);
300
+ }
301
+ function normalizeBoolean(input, label) {
302
+ if (!import_lodash.default.isBoolean(input)) {
303
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} must be a boolean`);
304
+ }
305
+ return input;
306
+ }
307
+ function normalizeOptionalBoolean(input, label) {
308
+ if (import_lodash.default.isUndefined(input) || import_lodash.default.isNull(input)) {
309
+ return void 0;
310
+ }
311
+ return normalizeBoolean(input, label);
312
+ }
313
+ function normalizeInteger(input, label, options = {}) {
314
+ if (!import_lodash.default.isFinite(input) || !Number.isInteger(input)) {
315
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} must be an integer`);
316
+ }
317
+ const normalized = Number(input);
318
+ if (!import_lodash.default.isUndefined(options.min) && normalized < options.min) {
319
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} must be greater than or equal to ${options.min}`);
320
+ }
321
+ if (!import_lodash.default.isUndefined(options.max) && normalized > options.max) {
322
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} must be less than or equal to ${options.max}`);
323
+ }
324
+ return normalized;
325
+ }
326
+ function normalizeOptionalInteger(input, label, options = {}) {
327
+ if (import_lodash.default.isUndefined(input) || import_lodash.default.isNull(input)) {
328
+ return void 0;
329
+ }
330
+ return normalizeInteger(input, label, options);
331
+ }
332
+ function normalizeEnumValue(input, allowed, label, options = {}) {
333
+ if (import_lodash.default.isUndefined(input) || import_lodash.default.isNull(input) || String(input).trim() === "") {
334
+ if (!import_lodash.default.isUndefined(options.fallback)) {
335
+ return options.fallback;
336
+ }
337
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} is required`);
338
+ }
339
+ const normalized = String(input).trim();
340
+ if (!allowed.has(normalized)) {
341
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} is invalid: ${normalized}`);
342
+ }
343
+ return normalized;
344
+ }
345
+ function normalizeOptionalEnumValue(input, allowed, label) {
346
+ if (import_lodash.default.isUndefined(input) || import_lodash.default.isNull(input) || String(input).trim() === "") {
347
+ return void 0;
348
+ }
349
+ return normalizeEnumValue(input, allowed, label);
350
+ }
351
+ function normalizeFieldPathValue(input, label, options = {}) {
352
+ if (import_lodash.default.isUndefined(input) || import_lodash.default.isNull(input)) {
353
+ if (options.required) {
354
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} is required`);
355
+ }
356
+ return void 0;
357
+ }
358
+ if (typeof input === "string") {
359
+ const normalized = input.trim();
360
+ if (!normalized) {
361
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} cannot be empty`);
362
+ }
363
+ return normalized;
364
+ }
365
+ if (Array.isArray(input)) {
366
+ const normalized = input.map((segment) => normalizeTrimmedString(segment, `${label}[]`));
367
+ if (!normalized.length) {
368
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} cannot be empty`);
369
+ }
370
+ return normalized;
371
+ }
372
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} must be a string or string[]`);
373
+ }
374
+ function aliasOfFieldValue(input) {
375
+ if (Array.isArray(input)) {
376
+ return input.filter(Boolean).map((item) => String(item)).join(".");
377
+ }
378
+ return String(input || "").trim();
379
+ }
380
+ function aliasOfSelection(input) {
381
+ const explicitAlias = typeof (input == null ? void 0 : input.alias) === "string" ? input.alias.trim() : "";
382
+ if (explicitAlias) {
383
+ return explicitAlias;
384
+ }
385
+ return aliasOfFieldValue(input == null ? void 0 : input.field);
386
+ }
387
+ function normalizeDirectionLike(input, label) {
388
+ const raw = normalizeTrimmedString(input, label).toLowerCase();
389
+ if (!CHART_SORT_DIRECTION_SET.has(raw)) {
390
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} is invalid: ${input}`);
391
+ }
392
+ return raw;
393
+ }
394
+ function toPersistedOrder(direction) {
395
+ return direction.toUpperCase();
396
+ }
397
+ function fromPersistedOrder(input) {
398
+ if (import_lodash.default.isUndefined(input) || import_lodash.default.isNull(input) || String(input).trim() === "") {
399
+ return void 0;
400
+ }
401
+ const normalized = String(input).trim().toLowerCase();
402
+ return CHART_SORT_DIRECTION_SET.has(normalized) ? normalized : void 0;
403
+ }
404
+ function createEmptyFilterGroup() {
405
+ return import_lodash.default.cloneDeep(EMPTY_FILTER_GROUP);
406
+ }
407
+ function assertAllowedKeys(input, allowed, label) {
408
+ const unknownKeys = Object.keys(input).filter((key) => !allowed.has(key));
409
+ if (unknownKeys.length) {
410
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} does not support: ${unknownKeys.join(", ")}`);
411
+ }
412
+ }
413
+ function mergeReplaceArrays(base, patch) {
414
+ return import_lodash.default.mergeWith({}, import_lodash.default.cloneDeep(base || {}), import_lodash.default.cloneDeep(patch || {}), (_objValue, srcValue) => {
415
+ if (Array.isArray(srcValue)) {
416
+ return srcValue;
417
+ }
418
+ return void 0;
419
+ });
420
+ }
421
+ function normalizeChartResourceFromCollectionPath(collectionPath, label, options = {}) {
422
+ if (import_lodash.default.isUndefined(collectionPath) || import_lodash.default.isNull(collectionPath)) {
423
+ if (options.required) {
424
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} is required`);
425
+ }
426
+ return void 0;
427
+ }
428
+ if (!Array.isArray(collectionPath)) {
429
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} must be a string[]`);
430
+ }
431
+ const collectionName = normalizeTrimmedString(collectionPath[1], `${label}[1]`);
432
+ const dataSourceKey = import_lodash.default.isUndefined(collectionPath[0]) || import_lodash.default.isNull(collectionPath[0]) || String(collectionPath[0]).trim() === "" ? CHART_DEFAULT_DATA_SOURCE_KEY : normalizeTrimmedString(collectionPath[0], `${label}[0]`);
433
+ return {
434
+ dataSourceKey,
435
+ collectionName
436
+ };
437
+ }
438
+ function normalizeChartResource(input, label, options = {}) {
439
+ if (import_lodash.default.isUndefined(input) || import_lodash.default.isNull(input)) {
440
+ if (options.required) {
441
+ throw new import_errors.FlowSurfaceBadRequestError(`${label} is required`);
442
+ }
443
+ return void 0;
444
+ }
445
+ const normalized = ensurePlainObject(input, label);
446
+ const collectionName = normalizeTrimmedString(normalized.collectionName, `${label}.collectionName`);
447
+ const dataSourceKey = import_lodash.default.isUndefined(normalized.dataSourceKey) || import_lodash.default.isNull(normalized.dataSourceKey) ? CHART_DEFAULT_DATA_SOURCE_KEY : normalizeTrimmedString(normalized.dataSourceKey, `${label}.dataSourceKey`);
448
+ return {
449
+ dataSourceKey,
450
+ collectionName
451
+ };
452
+ }
453
+ function normalizeMergedChartResource(query, options = {}) {
454
+ if (hasOwn(query, "resource") && hasOwn(query, "collectionPath")) {
455
+ const resource = normalizeChartResource(query.resource, "chart query.resource");
456
+ const collectionPathResource = normalizeChartResourceFromCollectionPath(
457
+ query.collectionPath,
458
+ "chart query.collectionPath"
459
+ );
460
+ if (!import_lodash.default.isEqual(resource, collectionPathResource)) {
461
+ throw new import_errors.FlowSurfaceBadRequestError(
462
+ "chart query.resource and chart query.collectionPath must reference the same collection"
463
+ );
464
+ }
465
+ return resource;
466
+ }
467
+ if (hasOwn(query, "resource")) {
468
+ return normalizeChartResource(query.resource, "chart query.resource", options);
469
+ }
470
+ if (hasOwn(query, "collectionPath")) {
471
+ return normalizeChartResourceFromCollectionPath(query.collectionPath, "chart query.collectionPath", options);
472
+ }
473
+ if (options.required) {
474
+ throw new import_errors.FlowSurfaceBadRequestError("chart query.resource is required");
475
+ }
476
+ return void 0;
477
+ }
478
+ function normalizeChartMeasure(input, index) {
479
+ const label = `chart query.measures[${index}]`;
480
+ const normalized = ensurePlainObject(input, label);
481
+ const aggregation = normalizeOptionalEnumValue(
482
+ normalized.aggregation,
483
+ CHART_QUERY_AGGREGATION_SET,
484
+ `${label}.aggregation`
485
+ );
486
+ return buildDefinedObject({
487
+ field: normalizeFieldPathValue(normalized.field, `${label}.field`, { required: true }),
488
+ aggregation,
489
+ alias: normalizeOptionalTrimmedString(normalized.alias, `${label}.alias`),
490
+ distinct: normalizeOptionalBoolean(normalized.distinct, `${label}.distinct`)
491
+ });
492
+ }
493
+ function normalizeChartDimension(input, index) {
494
+ const label = `chart query.dimensions[${index}]`;
495
+ const normalized = ensurePlainObject(input, label);
496
+ return buildDefinedObject({
497
+ field: normalizeFieldPathValue(normalized.field, `${label}.field`, { required: true }),
498
+ format: normalizeOptionalTrimmedString(normalized.format, `${label}.format`),
499
+ alias: normalizeOptionalTrimmedString(normalized.alias, `${label}.alias`)
500
+ });
501
+ }
502
+ function normalizeChartSortingItem(input, index) {
503
+ const label = `chart query.sorting[${index}]`;
504
+ const normalized = ensurePlainObject(input, label);
505
+ const directionSource = hasOwn(normalized, "direction") ? normalized.direction : normalized.order;
506
+ const direction = normalizeDirectionLike(
507
+ directionSource,
508
+ `${label}.${hasOwn(normalized, "direction") ? "direction" : "order"}`
509
+ );
510
+ return buildDefinedObject({
511
+ field: normalizeFieldPathValue(normalized.field, `${label}.field`, { required: true }),
512
+ order: toPersistedOrder(direction),
513
+ nulls: normalizeOptionalEnumValue(normalized.nulls, CHART_SORT_NULLS_SET, `${label}.nulls`)
514
+ });
515
+ }
516
+ function normalizeFilterGroupValue(input, label) {
517
+ if (import_lodash.default.isUndefined(input) || import_lodash.default.isNull(input)) {
518
+ return void 0;
519
+ }
520
+ const normalized = ensurePlainObject(input, label);
521
+ validateFilterGroupPaths(normalized, label);
522
+ return import_lodash.default.cloneDeep(normalized);
523
+ }
524
+ function validateFilterGroupPaths(input, label) {
525
+ const items = Array.isArray(input == null ? void 0 : input.items) ? input.items : [];
526
+ for (let index = 0; index < items.length; index += 1) {
527
+ const item = items[index];
528
+ if (!item || typeof item !== "object") {
529
+ continue;
530
+ }
531
+ if (Array.isArray(item.items)) {
532
+ validateFilterGroupPaths(item, `${label}.items[${index}]`);
533
+ continue;
534
+ }
535
+ if (hasOwn(item, "path")) {
536
+ const path = item.path;
537
+ if (typeof path !== "string" || !path.trim()) {
538
+ throw new import_errors.FlowSurfaceBadRequestError(`${label}.items[${index}].path cannot be empty`);
539
+ }
540
+ }
541
+ }
542
+ }
543
+ function inferQueryMode(query) {
544
+ if (hasOwn(query, "mode") && !import_lodash.default.isUndefined(query.mode) && !import_lodash.default.isNull(query.mode)) {
545
+ return normalizeEnumValue(query.mode, CHART_QUERY_MODE_SET, "chart query.mode");
546
+ }
547
+ if (hasAnyOwn(query, ["sql", "sqlDatasource"])) {
548
+ return "sql";
549
+ }
550
+ return "builder";
551
+ }
552
+ function validateLooseChartQuery(query) {
553
+ inferQueryMode(query);
554
+ if (!hasOwn(query, "resource") || !hasOwn(query, "collectionPath")) {
555
+ return;
556
+ }
557
+ const resource = normalizeChartResource(query.resource, "chart query.resource");
558
+ const collectionPathResource = normalizeChartResourceFromCollectionPath(
559
+ query.collectionPath,
560
+ "chart query.collectionPath"
561
+ );
562
+ if (!import_lodash.default.isEqual(resource, collectionPathResource)) {
563
+ throw new import_errors.FlowSurfaceBadRequestError(
564
+ "chart query.resource and chart query.collectionPath must reference the same collection"
565
+ );
566
+ }
567
+ }
568
+ function canStrictNormalizeChartQuery(query) {
569
+ validateLooseChartQuery(query);
570
+ const mode = inferQueryMode(query);
571
+ if (mode === "sql") {
572
+ return typeof (query == null ? void 0 : query.sql) === "string" && !!query.sql.trim();
573
+ }
574
+ if (!Array.isArray(query == null ? void 0 : query.measures)) {
575
+ return false;
576
+ }
577
+ return !!normalizeMergedChartResource(query);
578
+ }
579
+ function mergeChartQuerySection(current, patch) {
580
+ if (import_lodash.default.isUndefined(patch)) {
581
+ return import_lodash.default.isUndefined(current) ? void 0 : import_lodash.default.cloneDeep(current);
582
+ }
583
+ if (import_lodash.default.isNull(patch)) {
584
+ return void 0;
585
+ }
586
+ const normalizedPatch = ensurePlainObject(patch, "chart query");
587
+ const currentMode = import_lodash.default.isPlainObject(current) ? inferQueryMode(current) : void 0;
588
+ const nextMode = inferQueryMode(normalizedPatch);
589
+ const modeChanged = currentMode && currentMode !== nextMode;
590
+ const base = modeChanged ? {} : current || {};
591
+ const merged = mergeReplaceArrays(base, normalizedPatch);
592
+ if (nextMode !== "builder") {
593
+ return merged;
594
+ }
595
+ const currentResource = currentMode === "builder" ? normalizeMergedChartResource(current || {}) : void 0;
596
+ const nextResource = normalizeMergedChartResource(merged, { required: true });
597
+ const resourceChanged = currentMode === "builder" && !import_lodash.default.isEqual(currentResource, nextResource);
598
+ if (!resourceChanged) {
599
+ return merged;
600
+ }
601
+ return {
602
+ ...merged,
603
+ ...hasOwn(normalizedPatch, "measures") ? {} : { measures: [] },
604
+ ...hasOwn(normalizedPatch, "dimensions") ? {} : { dimensions: [] },
605
+ ...hasOwn(normalizedPatch, "sorting") || hasOwn(normalizedPatch, "orders") ? {} : { sorting: [] },
606
+ ...hasOwn(normalizedPatch, "filter") ? {} : { filter: createEmptyFilterGroup() }
607
+ };
608
+ }
609
+ function inferVisualMode(visual) {
610
+ if (hasOwn(visual, "mode") && !import_lodash.default.isUndefined(visual.mode) && !import_lodash.default.isNull(visual.mode)) {
611
+ return normalizeEnumValue(visual.mode, CHART_VISUAL_MODE_SET, "chart visual.mode");
612
+ }
613
+ if (hasOwn(visual, "raw")) {
614
+ return "custom";
615
+ }
616
+ return "basic";
617
+ }
618
+ function inferBasicVisualType(visual) {
619
+ return normalizeEnumValue(visual.type, CHART_BASIC_VISUAL_TYPE_SET, "chart visual.type", { fallback: "line" });
620
+ }
621
+ function canDeriveSemanticVisualFromOption(option) {
622
+ var _a;
623
+ const mode = inferVisualMode(option);
624
+ if (mode === "custom") {
625
+ const raw = option.raw ?? ((_a = option.builder) == null ? void 0 : _a.raw);
626
+ return typeof raw === "string" && !!raw.trim();
627
+ }
628
+ const builder = import_lodash.default.isPlainObject(option.builder) ? option.builder : option;
629
+ if (!import_lodash.default.isPlainObject(builder)) {
630
+ return false;
631
+ }
632
+ if (typeof builder.type === "string" && builder.type.trim()) {
633
+ return true;
634
+ }
635
+ const mappingKeys = [
636
+ "xField",
637
+ "yField",
638
+ "seriesField",
639
+ "sizeField",
640
+ "pieCategory",
641
+ "pieValue",
642
+ "doughnutCategory",
643
+ "doughnutValue",
644
+ "funnelCategory",
645
+ "funnelValue"
646
+ ];
647
+ if (mappingKeys.some((key) => hasOwn(builder, key))) {
648
+ return true;
649
+ }
650
+ const scalarCompatibilityChecks = [
651
+ ["legend", import_lodash.default.isBoolean],
652
+ ["tooltip", import_lodash.default.isBoolean],
653
+ ["label", import_lodash.default.isBoolean],
654
+ ["boundaryGap", import_lodash.default.isBoolean],
655
+ ["yAxisSplitLine", import_lodash.default.isBoolean],
656
+ ["smooth", import_lodash.default.isBoolean],
657
+ ["stack", import_lodash.default.isBoolean],
658
+ ["xAxisLabelRotate", import_lodash.default.isFinite],
659
+ ["pieRadiusInner", import_lodash.default.isFinite],
660
+ ["pieRadiusOuter", import_lodash.default.isFinite],
661
+ ["doughnutRadiusInner", import_lodash.default.isFinite],
662
+ ["doughnutRadiusOuter", import_lodash.default.isFinite],
663
+ ["funnelMinSize", import_lodash.default.isFinite],
664
+ ["funnelMaxSize", import_lodash.default.isFinite],
665
+ ["pieLabelType", (value) => typeof value === "string"],
666
+ ["doughnutLabelType", (value) => typeof value === "string"],
667
+ ["funnelSort", (value) => typeof value === "string"]
668
+ ];
669
+ return scalarCompatibilityChecks.some(([key, predicate]) => hasOwn(builder, key) && predicate(builder[key]));
670
+ }
671
+ function filterVisualStateForType(current, type) {
672
+ const filteredMappings = import_lodash.default.pick(
673
+ ensurePlainObject(current.mappings || {}, "chart visual.mappings"),
674
+ Array.from(CHART_MAPPING_KEYS_BY_TYPE[type] || [])
675
+ );
676
+ const filteredStyle = import_lodash.default.pick(
677
+ ensurePlainObject(current.style || {}, "chart visual.style"),
678
+ Array.from(CHART_STYLE_KEYS_BY_TYPE[type] || [])
679
+ );
680
+ return buildDefinedObject({
681
+ mode: "basic",
682
+ type,
683
+ ...Object.keys(filteredMappings).length ? { mappings: filteredMappings } : {},
684
+ ...Object.keys(filteredStyle).length ? { style: filteredStyle } : {}
685
+ });
686
+ }
687
+ function sanitizeBasicVisualForBuilderQuery(visual, query) {
688
+ if (!import_lodash.default.isPlainObject(visual) || inferVisualMode(visual) !== "basic" || (query == null ? void 0 : query.mode) !== "builder") {
689
+ return visual;
690
+ }
691
+ const type = inferBasicVisualType(visual);
692
+ const allowedOutputs = collectBuilderQueryOutputFields(query);
693
+ if (!allowedOutputs.size) {
694
+ return buildDefinedObject({
695
+ mode: "basic",
696
+ type,
697
+ ...Object.keys(ensurePlainObject(visual.style || {}, "chart visual.style")).length ? { style: import_lodash.default.cloneDeep(visual.style) } : {}
698
+ });
699
+ }
700
+ const filteredMappings = import_lodash.default.pickBy(
701
+ import_lodash.default.pick(
702
+ ensurePlainObject(visual.mappings || {}, "chart visual.mappings"),
703
+ Array.from(CHART_MAPPING_KEYS_BY_TYPE[type] || [])
704
+ ),
705
+ (value) => {
706
+ const alias = aliasOfFieldValue(value);
707
+ return !!alias && allowedOutputs.has(alias);
708
+ }
709
+ );
710
+ const requiredKeys = Array.from(CHART_REQUIRED_MAPPING_KEYS_BY_TYPE[type] || []);
711
+ const hasAllRequiredMappings = !requiredKeys.length || requiredKeys.every((key) => Object.prototype.hasOwnProperty.call(filteredMappings, key));
712
+ return buildDefinedObject({
713
+ mode: "basic",
714
+ type,
715
+ ...hasAllRequiredMappings && Object.keys(filteredMappings).length ? { mappings: filteredMappings } : {},
716
+ ...Object.keys(ensurePlainObject(visual.style || {}, "chart visual.style")).length ? { style: import_lodash.default.cloneDeep(visual.style) } : {}
717
+ });
718
+ }
719
+ function sanitizeBasicVisualForSqlQuery(visual) {
720
+ if (!import_lodash.default.isPlainObject(visual) || inferVisualMode(visual) !== "basic") {
721
+ return visual;
722
+ }
723
+ return buildDefinedObject({
724
+ mode: "basic",
725
+ type: inferBasicVisualType(visual),
726
+ ...Object.keys(ensurePlainObject(visual.style || {}, "chart visual.style")).length ? { style: import_lodash.default.cloneDeep(visual.style) } : {}
727
+ });
728
+ }
729
+ function mergeChartVisualSection(current, patch) {
730
+ if (import_lodash.default.isUndefined(patch)) {
731
+ return import_lodash.default.isUndefined(current) ? void 0 : import_lodash.default.cloneDeep(current);
732
+ }
733
+ if (import_lodash.default.isNull(patch)) {
734
+ return void 0;
735
+ }
736
+ const normalizedPatch = ensurePlainObject(patch, "chart visual");
737
+ const currentMode = import_lodash.default.isPlainObject(current) ? inferVisualMode(current) : void 0;
738
+ const nextMode = inferVisualMode(normalizedPatch);
739
+ const modeChanged = currentMode && currentMode !== nextMode;
740
+ if (modeChanged) {
741
+ return mergeReplaceArrays({}, normalizedPatch);
742
+ }
743
+ if (nextMode !== "basic") {
744
+ return mergeReplaceArrays(current || {}, normalizedPatch);
745
+ }
746
+ const currentType = currentMode === "basic" && import_lodash.default.isPlainObject(current) ? inferBasicVisualType(current) : void 0;
747
+ const nextType = inferBasicVisualType(mergeReplaceArrays(current || {}, normalizedPatch));
748
+ if (currentType && currentType !== nextType) {
749
+ return mergeReplaceArrays(filterVisualStateForType(current || {}, nextType), normalizedPatch);
750
+ }
751
+ return mergeReplaceArrays(current || {}, normalizedPatch);
752
+ }
753
+ function mergeChartSection(current, patch, label) {
754
+ if (import_lodash.default.isUndefined(patch)) {
755
+ return import_lodash.default.isUndefined(current) ? void 0 : import_lodash.default.cloneDeep(current);
756
+ }
757
+ if (import_lodash.default.isNull(patch)) {
758
+ return void 0;
759
+ }
760
+ const normalizedPatch = ensurePlainObject(patch, label);
761
+ return mergeReplaceArrays(current || {}, normalizedPatch);
762
+ }
763
+ function collectBuilderQueryOutputFields(query) {
764
+ const outputs = /* @__PURE__ */ new Set();
765
+ for (const dimension of import_lodash.default.castArray((query == null ? void 0 : query.dimensions) || [])) {
766
+ const alias = aliasOfSelection(dimension);
767
+ if (alias) {
768
+ outputs.add(alias);
769
+ }
770
+ }
771
+ for (const measure of import_lodash.default.castArray((query == null ? void 0 : query.measures) || [])) {
772
+ const alias = aliasOfSelection(measure);
773
+ if (alias) {
774
+ outputs.add(alias);
775
+ }
776
+ }
777
+ return outputs;
778
+ }
779
+ function buildBuilderQueryOutputs(query) {
780
+ const outputs = [];
781
+ for (const dimension of import_lodash.default.castArray((query == null ? void 0 : query.dimensions) || [])) {
782
+ const alias = aliasOfSelection(dimension);
783
+ if (!alias) {
784
+ continue;
785
+ }
786
+ outputs.push({
787
+ alias,
788
+ source: "builder",
789
+ kind: "dimension",
790
+ field: import_lodash.default.cloneDeep(dimension.field),
791
+ format: dimension.format
792
+ });
793
+ }
794
+ for (const measure of import_lodash.default.castArray((query == null ? void 0 : query.measures) || [])) {
795
+ const alias = aliasOfSelection(measure);
796
+ if (!alias) {
797
+ continue;
798
+ }
799
+ outputs.push({
800
+ alias,
801
+ source: "builder",
802
+ kind: "measure",
803
+ field: import_lodash.default.cloneDeep(measure.field),
804
+ aggregation: measure.aggregation,
805
+ distinct: measure.distinct
806
+ });
807
+ }
808
+ return outputs;
809
+ }
810
+ function assertBuilderSortingFields(query, sorting) {
811
+ const hasAggregation = import_lodash.default.castArray((query == null ? void 0 : query.measures) || []).some((item) => !!(item == null ? void 0 : item.aggregation));
812
+ if (!hasAggregation || !(sorting == null ? void 0 : sorting.length)) {
813
+ return;
814
+ }
815
+ const allowedFields = collectBuilderQueryOutputFields(query);
816
+ for (const item of sorting) {
817
+ const alias = aliasOfFieldValue(item.field);
818
+ if (!alias || !allowedFields.has(alias)) {
819
+ throw new import_errors.FlowSurfaceBadRequestError("chart query.sorting only supports selected dimension/measure fields");
820
+ }
821
+ }
822
+ }
823
+ function assertBuilderRuntimeCompatibleSorting(query, sorting) {
824
+ if (!(sorting == null ? void 0 : sorting.length)) {
825
+ return;
826
+ }
827
+ const unsupportedMeasureOutputs = /* @__PURE__ */ new Set();
828
+ for (const measure of import_lodash.default.castArray((query == null ? void 0 : query.measures) || [])) {
829
+ const outputAlias = aliasOfSelection(measure);
830
+ const rawFieldAlias = aliasOfFieldValue(measure == null ? void 0 : measure.field);
831
+ if (!outputAlias) {
832
+ continue;
833
+ }
834
+ if ((measure == null ? void 0 : measure.aggregation) || rawFieldAlias && outputAlias !== rawFieldAlias) {
835
+ unsupportedMeasureOutputs.add(outputAlias);
836
+ }
837
+ }
838
+ for (const item of sorting) {
839
+ const sortingField = aliasOfFieldValue(item == null ? void 0 : item.field);
840
+ if (sortingField && unsupportedMeasureOutputs.has(sortingField)) {
841
+ throw new import_errors.FlowSurfaceBadRequestError(
842
+ "chart query.sorting does not support aggregated measure outputs or custom measure aliases in builder mode"
843
+ );
844
+ }
845
+ }
846
+ }
847
+ function normalizeBuilderQuery(query) {
848
+ const resource = normalizeMergedChartResource(query, { required: true });
849
+ const measures = Array.isArray(query.measures) ? query.measures.map((item, index) => normalizeChartMeasure(item, index)) : (() => {
850
+ throw new import_errors.FlowSurfaceBadRequestError("chart query.measures must be an array");
851
+ })();
852
+ if (!measures.length) {
853
+ throw new import_errors.FlowSurfaceBadRequestError("chart query.measures cannot be empty");
854
+ }
855
+ const dimensions = import_lodash.default.isUndefined(query.dimensions) ? void 0 : Array.isArray(query.dimensions) ? query.dimensions.map((item, index) => normalizeChartDimension(item, index)) : (() => {
856
+ throw new import_errors.FlowSurfaceBadRequestError("chart query.dimensions must be an array");
857
+ })();
858
+ const rawSorting = hasOwn(query, "sorting") ? query.sorting : query.orders;
859
+ const sorting = import_lodash.default.isUndefined(rawSorting) ? void 0 : Array.isArray(rawSorting) ? rawSorting.map((item, index) => normalizeChartSortingItem(item, index)) : (() => {
860
+ throw new import_errors.FlowSurfaceBadRequestError("chart query.sorting must be an array");
861
+ })();
862
+ const filter = normalizeFilterGroupValue(query.filter, "chart query.filter");
863
+ assertBuilderSortingFields({ measures, dimensions }, sorting || []);
864
+ assertBuilderRuntimeCompatibleSorting({ measures, dimensions }, sorting || []);
865
+ return buildDefinedObject({
866
+ mode: "builder",
867
+ collectionPath: [resource.dataSourceKey, resource.collectionName],
868
+ measures,
869
+ dimensions,
870
+ filter,
871
+ orders: sorting,
872
+ limit: normalizeOptionalInteger(query.limit, "chart query.limit", { min: 0 }),
873
+ offset: normalizeOptionalInteger(query.offset, "chart query.offset", { min: 0 })
874
+ });
875
+ }
876
+ function normalizeSqlQuery(query) {
877
+ const unsupportedKeys = [
878
+ "resource",
879
+ "collectionPath",
880
+ "measures",
881
+ "dimensions",
882
+ "filter",
883
+ "sorting",
884
+ "orders",
885
+ "limit",
886
+ "offset"
887
+ ].filter((key) => hasOwn(query, key));
888
+ if (unsupportedKeys.length) {
889
+ throw new import_errors.FlowSurfaceBadRequestError(`chart query.mode='sql' does not support: ${unsupportedKeys.join(", ")}`);
890
+ }
891
+ return buildDefinedObject({
892
+ mode: "sql",
893
+ sql: normalizeTrimmedString(query.sql, "chart query.sql"),
894
+ sqlDatasource: import_lodash.default.isUndefined(query.sqlDatasource) || import_lodash.default.isNull(query.sqlDatasource) ? void 0 : normalizeTrimmedString(query.sqlDatasource, "chart query.sqlDatasource")
895
+ });
896
+ }
897
+ function normalizeChartQuery(query) {
898
+ const normalized = ensurePlainObject(query, "chart query");
899
+ const mode = inferQueryMode(normalized);
900
+ return mode === "sql" ? normalizeSqlQuery(normalized) : normalizeBuilderQuery(normalized);
901
+ }
902
+ function normalizeCommonChartStyle(style) {
903
+ return buildDefinedObject({
904
+ legend: normalizeOptionalBoolean(style.legend, "chart visual.style.legend"),
905
+ tooltip: normalizeOptionalBoolean(style.tooltip, "chart visual.style.tooltip"),
906
+ label: normalizeOptionalBoolean(style.label, "chart visual.style.label")
907
+ });
908
+ }
909
+ function normalizeBasicVisual(visual) {
910
+ const type = inferBasicVisualType(visual);
911
+ if (hasOwn(visual, "raw")) {
912
+ throw new import_errors.FlowSurfaceBadRequestError("chart visual.mode='basic' does not support raw");
913
+ }
914
+ const mappings = import_lodash.default.isUndefined(visual.mappings) ? {} : ensurePlainObject(visual.mappings, "chart visual.mappings");
915
+ const style = import_lodash.default.isUndefined(visual.style) ? {} : ensurePlainObject(visual.style, "chart visual.style");
916
+ const requireRequiredMappings = Object.keys(mappings).length > 0;
917
+ assertAllowedKeys(mappings, CHART_MAPPING_KEYS, "chart visual.mappings");
918
+ assertAllowedKeys(style, CHART_STYLE_KEYS, "chart visual.style");
919
+ const allowedStyleKeys = CHART_STYLE_KEYS_BY_TYPE[type] || /* @__PURE__ */ new Set();
920
+ const invalidStyleKeys = Object.keys(style).filter((key) => !allowedStyleKeys.has(key));
921
+ if (invalidStyleKeys.length) {
922
+ throw new import_errors.FlowSurfaceBadRequestError(
923
+ `chart visual.type='${type}' does not support style keys: ${invalidStyleKeys.join(", ")}`
924
+ );
925
+ }
926
+ const builder = {
927
+ type,
928
+ ...normalizeCommonChartStyle(style)
929
+ };
930
+ switch (type) {
931
+ case "line":
932
+ case "area":
933
+ case "bar":
934
+ case "barHorizontal":
935
+ builder.xField = normalizeFieldPathValue(mappings.x, "chart visual.mappings.x", {
936
+ required: requireRequiredMappings
937
+ });
938
+ builder.yField = normalizeFieldPathValue(mappings.y, "chart visual.mappings.y", {
939
+ required: requireRequiredMappings
940
+ });
941
+ builder.seriesField = normalizeFieldPathValue(mappings.series, "chart visual.mappings.series");
942
+ builder.boundaryGap = normalizeOptionalBoolean(style.boundaryGap, "chart visual.style.boundaryGap");
943
+ builder.xAxisLabelRotate = normalizeOptionalInteger(
944
+ style.xAxisLabelRotate,
945
+ "chart visual.style.xAxisLabelRotate",
946
+ {
947
+ min: 0,
948
+ max: 90
949
+ }
950
+ );
951
+ builder.yAxisSplitLine = normalizeOptionalBoolean(style.yAxisSplitLine, "chart visual.style.yAxisSplitLine");
952
+ if (type === "line" || type === "area") {
953
+ builder.smooth = normalizeOptionalBoolean(style.smooth, "chart visual.style.smooth");
954
+ }
955
+ if (type === "area" || type === "bar" || type === "barHorizontal") {
956
+ builder.stack = normalizeOptionalBoolean(style.stack, "chart visual.style.stack");
957
+ }
958
+ break;
959
+ case "scatter":
960
+ builder.xField = normalizeFieldPathValue(mappings.x, "chart visual.mappings.x", {
961
+ required: requireRequiredMappings
962
+ });
963
+ builder.yField = normalizeFieldPathValue(mappings.y, "chart visual.mappings.y", {
964
+ required: requireRequiredMappings
965
+ });
966
+ builder.seriesField = normalizeFieldPathValue(mappings.series, "chart visual.mappings.series");
967
+ builder.sizeField = normalizeFieldPathValue(mappings.size, "chart visual.mappings.size");
968
+ builder.xAxisLabelRotate = normalizeOptionalInteger(
969
+ style.xAxisLabelRotate,
970
+ "chart visual.style.xAxisLabelRotate",
971
+ {
972
+ min: 0,
973
+ max: 90
974
+ }
975
+ );
976
+ builder.yAxisSplitLine = normalizeOptionalBoolean(style.yAxisSplitLine, "chart visual.style.yAxisSplitLine");
977
+ break;
978
+ case "pie":
979
+ case "doughnut":
980
+ builder[type === "pie" ? "pieCategory" : "doughnutCategory"] = normalizeFieldPathValue(
981
+ mappings.category,
982
+ "chart visual.mappings.category",
983
+ { required: requireRequiredMappings }
984
+ );
985
+ builder[type === "pie" ? "pieValue" : "doughnutValue"] = normalizeFieldPathValue(
986
+ mappings.value,
987
+ "chart visual.mappings.value",
988
+ { required: requireRequiredMappings }
989
+ );
990
+ builder[type === "pie" ? "pieRadiusInner" : "doughnutRadiusInner"] = normalizeOptionalInteger(
991
+ style.radiusInner,
992
+ "chart visual.style.radiusInner",
993
+ { min: 0, max: 100 }
994
+ );
995
+ builder[type === "pie" ? "pieRadiusOuter" : "doughnutRadiusOuter"] = normalizeOptionalInteger(
996
+ style.radiusOuter,
997
+ "chart visual.style.radiusOuter",
998
+ { min: 0, max: 100 }
999
+ );
1000
+ builder[type === "pie" ? "pieLabelType" : "doughnutLabelType"] = normalizeOptionalEnumValue(
1001
+ style.labelType,
1002
+ CHART_LABEL_TYPE_SET,
1003
+ "chart visual.style.labelType"
1004
+ );
1005
+ {
1006
+ const inner = builder[type === "pie" ? "pieRadiusInner" : "doughnutRadiusInner"];
1007
+ const outer = builder[type === "pie" ? "pieRadiusOuter" : "doughnutRadiusOuter"];
1008
+ if (!import_lodash.default.isUndefined(inner) && !import_lodash.default.isUndefined(outer) && inner > outer) {
1009
+ throw new import_errors.FlowSurfaceBadRequestError(
1010
+ "chart visual.style.radiusOuter must be greater than or equal to radiusInner"
1011
+ );
1012
+ }
1013
+ }
1014
+ break;
1015
+ case "funnel":
1016
+ builder.funnelCategory = normalizeFieldPathValue(mappings.category, "chart visual.mappings.category", {
1017
+ required: requireRequiredMappings
1018
+ });
1019
+ builder.funnelValue = normalizeFieldPathValue(mappings.value, "chart visual.mappings.value", {
1020
+ required: requireRequiredMappings
1021
+ });
1022
+ builder.funnelSort = normalizeOptionalEnumValue(style.sort, CHART_FUNNEL_SORT_SET, "chart visual.style.sort");
1023
+ builder.funnelMinSize = normalizeOptionalInteger(style.minSize, "chart visual.style.minSize", {
1024
+ min: 0,
1025
+ max: 100
1026
+ });
1027
+ builder.funnelMaxSize = normalizeOptionalInteger(style.maxSize, "chart visual.style.maxSize", {
1028
+ min: 0,
1029
+ max: 100
1030
+ });
1031
+ if (!import_lodash.default.isUndefined(builder.funnelMinSize) && !import_lodash.default.isUndefined(builder.funnelMaxSize) && builder.funnelMinSize > builder.funnelMaxSize) {
1032
+ throw new import_errors.FlowSurfaceBadRequestError("chart visual.style.maxSize must be greater than or equal to minSize");
1033
+ }
1034
+ break;
1035
+ default:
1036
+ break;
1037
+ }
1038
+ return {
1039
+ mode: "basic",
1040
+ builder: buildDefinedObject(builder)
1041
+ };
1042
+ }
1043
+ function normalizeCustomVisual(visual) {
1044
+ const unsupportedKeys = ["type", "mappings", "style"].filter((key) => hasOwn(visual, key));
1045
+ if (unsupportedKeys.length) {
1046
+ throw new import_errors.FlowSurfaceBadRequestError(`chart visual.mode='custom' does not support: ${unsupportedKeys.join(", ")}`);
1047
+ }
1048
+ return {
1049
+ mode: "custom",
1050
+ raw: normalizeTrimmedString(visual.raw, "chart visual.raw")
1051
+ };
1052
+ }
1053
+ function assertBasicVisualMappingsAgainstBuilderQuery(builderVisual, query) {
1054
+ const allowedOutputs = collectBuilderQueryOutputFields(query);
1055
+ if (!allowedOutputs.size) {
1056
+ return;
1057
+ }
1058
+ const mappingValues = [
1059
+ builderVisual.xField,
1060
+ builderVisual.yField,
1061
+ builderVisual.seriesField,
1062
+ builderVisual.sizeField,
1063
+ builderVisual.pieCategory,
1064
+ builderVisual.pieValue,
1065
+ builderVisual.doughnutCategory,
1066
+ builderVisual.doughnutValue,
1067
+ builderVisual.funnelCategory,
1068
+ builderVisual.funnelValue
1069
+ ].filter((value) => !import_lodash.default.isUndefined(value) && !import_lodash.default.isNull(value)).map((value) => aliasOfFieldValue(value));
1070
+ for (const value of mappingValues) {
1071
+ if (!value || !allowedOutputs.has(value)) {
1072
+ throw new import_errors.FlowSurfaceBadRequestError(
1073
+ `chart visual mappings only support query output fields: ${Array.from(allowedOutputs).join(", ")}`
1074
+ );
1075
+ }
1076
+ }
1077
+ }
1078
+ function normalizeChartVisual(visual, query) {
1079
+ const normalized = ensurePlainObject(visual, "chart visual");
1080
+ const mode = inferVisualMode(normalized);
1081
+ if (mode === "custom") {
1082
+ return normalizeCustomVisual(normalized);
1083
+ }
1084
+ const visualConfig = normalizeBasicVisual(normalized);
1085
+ if ((query == null ? void 0 : query.mode) === "builder") {
1086
+ assertBasicVisualMappingsAgainstBuilderQuery(visualConfig.builder || {}, query);
1087
+ }
1088
+ return visualConfig;
1089
+ }
1090
+ function normalizeChartEvents(events) {
1091
+ const normalized = ensurePlainObject(events, "chart events");
1092
+ const unsupportedKeys = Object.keys(normalized).filter((key) => key !== "raw");
1093
+ if (unsupportedKeys.length) {
1094
+ throw new import_errors.FlowSurfaceBadRequestError(`chart events does not support: ${unsupportedKeys.join(", ")}`);
1095
+ }
1096
+ if (import_lodash.default.isUndefined(normalized.raw) || import_lodash.default.isNull(normalized.raw)) {
1097
+ return void 0;
1098
+ }
1099
+ return {
1100
+ mode: "custom",
1101
+ raw: normalizeTrimmedString(normalized.raw, "chart events.raw")
1102
+ };
1103
+ }
1104
+ function deriveChartSortingItem(item) {
1105
+ if (!import_lodash.default.isPlainObject(item)) {
1106
+ return void 0;
1107
+ }
1108
+ const direction = fromPersistedOrder(item.order) || fromPersistedOrder(item.direction);
1109
+ return buildDefinedObject({
1110
+ field: import_lodash.default.cloneDeep(item.field),
1111
+ direction,
1112
+ nulls: item.nulls
1113
+ });
1114
+ }
1115
+ function deriveChartQuery(configure) {
1116
+ const query = configure == null ? void 0 : configure.query;
1117
+ if (!import_lodash.default.isPlainObject(query)) {
1118
+ return void 0;
1119
+ }
1120
+ if (!canStrictNormalizeChartQuery(query)) {
1121
+ return void 0;
1122
+ }
1123
+ if (query.mode === "sql") {
1124
+ return buildDefinedObject({
1125
+ mode: "sql",
1126
+ sql: query.sql,
1127
+ sqlDatasource: query.sqlDatasource
1128
+ });
1129
+ }
1130
+ return buildDefinedObject({
1131
+ mode: query.mode || "builder",
1132
+ resource: getChartBuilderResourceInit(configure),
1133
+ measures: import_lodash.default.cloneDeep(query.measures),
1134
+ dimensions: import_lodash.default.cloneDeep(query.dimensions),
1135
+ filter: import_lodash.default.cloneDeep(query.filter),
1136
+ sorting: import_lodash.default.castArray(hasOwn(query, "sorting") ? query.sorting : query.orders).map((item) => deriveChartSortingItem(item)).filter(Boolean),
1137
+ limit: query.limit,
1138
+ offset: query.offset
1139
+ });
1140
+ }
1141
+ function deriveChartVisual(configure) {
1142
+ var _a;
1143
+ const option = (_a = configure == null ? void 0 : configure.chart) == null ? void 0 : _a.option;
1144
+ if (!import_lodash.default.isPlainObject(option)) {
1145
+ return void 0;
1146
+ }
1147
+ if (!canDeriveSemanticVisualFromOption(option)) {
1148
+ return void 0;
1149
+ }
1150
+ if (option.mode === "custom") {
1151
+ return buildDefinedObject({
1152
+ mode: "custom",
1153
+ raw: option.raw
1154
+ });
1155
+ }
1156
+ const builder = import_lodash.default.isPlainObject(option.builder) ? option.builder : import_lodash.default.isPlainObject(option) ? option : {};
1157
+ const type = String(builder.type || "line");
1158
+ const style = buildDefinedObject({
1159
+ legend: builder.legend,
1160
+ tooltip: builder.tooltip,
1161
+ label: builder.label,
1162
+ boundaryGap: builder.boundaryGap,
1163
+ xAxisLabelRotate: builder.xAxisLabelRotate,
1164
+ yAxisSplitLine: builder.yAxisSplitLine,
1165
+ smooth: builder.smooth,
1166
+ stack: builder.stack,
1167
+ radiusInner: builder.pieRadiusInner ?? builder.doughnutRadiusInner,
1168
+ radiusOuter: builder.pieRadiusOuter ?? builder.doughnutRadiusOuter,
1169
+ labelType: builder.pieLabelType ?? builder.doughnutLabelType,
1170
+ sort: builder.funnelSort,
1171
+ minSize: builder.funnelMinSize,
1172
+ maxSize: builder.funnelMaxSize
1173
+ });
1174
+ const mappings = buildDefinedObject({
1175
+ x: builder.xField,
1176
+ y: builder.yField,
1177
+ category: builder.pieCategory ?? builder.doughnutCategory ?? builder.funnelCategory,
1178
+ value: builder.pieValue ?? builder.doughnutValue ?? builder.funnelValue,
1179
+ series: builder.seriesField,
1180
+ size: builder.sizeField
1181
+ });
1182
+ return buildDefinedObject({
1183
+ mode: "basic",
1184
+ type,
1185
+ ...Object.keys(mappings).length ? { mappings } : {},
1186
+ ...Object.keys(style).length ? { style } : {}
1187
+ });
1188
+ }
1189
+ function deriveChartEvents(configure) {
1190
+ var _a;
1191
+ const events = (_a = configure == null ? void 0 : configure.chart) == null ? void 0 : _a.events;
1192
+ if (!import_lodash.default.isPlainObject(events)) {
1193
+ return void 0;
1194
+ }
1195
+ return buildDefinedObject({
1196
+ raw: events.raw
1197
+ });
1198
+ }
1199
+ function rebuildChartConfigureFromSemanticState(nextState) {
1200
+ const nextConfigure = {};
1201
+ if (nextState.query) {
1202
+ nextConfigure.query = normalizeChartQuery(nextState.query);
1203
+ }
1204
+ if (nextState.visual || nextState.events) {
1205
+ nextConfigure.chart = buildDefinedObject({
1206
+ option: nextState.visual ? normalizeChartVisual(nextState.visual, nextConfigure.query) : void 0,
1207
+ events: nextState.events ? normalizeChartEvents(nextState.events) : void 0
1208
+ });
1209
+ }
1210
+ return nextConfigure;
1211
+ }
1212
+ function deriveChartSemanticState(configure) {
1213
+ return buildDefinedObject({
1214
+ query: deriveChartQuery(configure),
1215
+ visual: deriveChartVisual(configure),
1216
+ events: deriveChartEvents(configure)
1217
+ });
1218
+ }
1219
+ function getChartBuilderResourceInit(configure) {
1220
+ const query = configure == null ? void 0 : configure.query;
1221
+ if (!import_lodash.default.isPlainObject(query) || query.mode === "sql") {
1222
+ return null;
1223
+ }
1224
+ return normalizeMergedChartResource(query) || null;
1225
+ }
1226
+ function getChartBuilderQueryOutputs(configure) {
1227
+ var _a;
1228
+ const query = (_a = deriveChartSemanticState(configure)) == null ? void 0 : _a.query;
1229
+ if ((query == null ? void 0 : query.mode) !== "builder") {
1230
+ return [];
1231
+ }
1232
+ return buildBuilderQueryOutputs(query);
1233
+ }
1234
+ function getChartBuilderQueryAliases(configure) {
1235
+ return Array.from(
1236
+ new Set(
1237
+ getChartBuilderQueryOutputs(configure).map((output) => typeof (output == null ? void 0 : output.alias) === "string" ? output.alias.trim() : "").filter((alias) => !!alias)
1238
+ )
1239
+ );
1240
+ }
1241
+ function getChartSupportedVisualTypes() {
1242
+ return [...CHART_BASIC_VISUAL_TYPES];
1243
+ }
1244
+ function getChartSupportedMappingsByType() {
1245
+ return Object.fromEntries(
1246
+ Object.entries(CHART_MAPPING_KEYS_BY_TYPE).map(([type, mappings]) => [
1247
+ type,
1248
+ {
1249
+ allowed: Array.from(mappings),
1250
+ required: Array.from(CHART_REQUIRED_MAPPING_KEYS_BY_TYPE[type] || [])
1251
+ }
1252
+ ])
1253
+ );
1254
+ }
1255
+ function getChartSupportedStylesByType() {
1256
+ return import_lodash.default.cloneDeep(
1257
+ Object.fromEntries(
1258
+ Object.entries(CHART_STYLE_KEYS_BY_TYPE).map(([type, styleKeys]) => [
1259
+ type,
1260
+ Object.fromEntries(
1261
+ Array.from(styleKeys).map((styleKey) => [styleKey, import_lodash.default.cloneDeep(CHART_STYLE_SUPPORT_BY_KEY[styleKey])])
1262
+ )
1263
+ ])
1264
+ )
1265
+ );
1266
+ }
1267
+ function getChartSafeDefaultHints() {
1268
+ return import_lodash.default.cloneDeep(CHART_SAFE_DEFAULT_HINTS);
1269
+ }
1270
+ function getChartRiskyPatternHints() {
1271
+ return import_lodash.default.cloneDeep(CHART_RISKY_PATTERN_HINTS);
1272
+ }
1273
+ function getChartUnsupportedPatternHints() {
1274
+ return import_lodash.default.cloneDeep(CHART_UNSUPPORTED_PATTERN_HINTS);
1275
+ }
1276
+ function getChartVisualMappingAliases(input) {
1277
+ const visual = (input == null ? void 0 : input.visual) ? input.visual : input;
1278
+ if (!import_lodash.default.isPlainObject(visual)) {
1279
+ return [];
1280
+ }
1281
+ const semanticVisual = (visual == null ? void 0 : visual.mode) || (visual == null ? void 0 : visual.mappings) || (visual == null ? void 0 : visual.type) ? visual : deriveChartVisual({ chart: { option: visual } });
1282
+ if (!semanticVisual || semanticVisual.mode !== "basic" || !import_lodash.default.isPlainObject(semanticVisual.mappings)) {
1283
+ return [];
1284
+ }
1285
+ return import_lodash.default.uniq(
1286
+ Object.values(semanticVisual.mappings).map((value) => aliasOfFieldValue(value)).filter(Boolean)
1287
+ );
1288
+ }
1289
+ function canonicalizeChartConfigure(configure) {
1290
+ if (import_lodash.default.isUndefined(configure) || import_lodash.default.isNull(configure)) {
1291
+ return configure;
1292
+ }
1293
+ ensurePlainObject(configure, "chart configure");
1294
+ const cloned = import_lodash.default.cloneDeep(configure);
1295
+ const nextConfigure = import_lodash.default.omit(cloned, ["query", "chart"]);
1296
+ const rawQuery = import_lodash.default.isUndefined(cloned.query) ? void 0 : ensurePlainObject(cloned.query, "chart query");
1297
+ const rawChart = import_lodash.default.isUndefined(cloned.chart) ? void 0 : ensurePlainObject(cloned.chart, "chart chart");
1298
+ const rawOption = import_lodash.default.isUndefined(rawChart == null ? void 0 : rawChart.option) ? void 0 : ensurePlainObject(rawChart.option, "chart option");
1299
+ const rawEvents = import_lodash.default.isUndefined(rawChart == null ? void 0 : rawChart.events) ? void 0 : ensurePlainObject(rawChart.events, "chart events");
1300
+ if (!import_lodash.default.isUndefined(rawQuery)) {
1301
+ nextConfigure.query = canStrictNormalizeChartQuery(rawQuery) ? normalizeChartQuery(rawQuery) : import_lodash.default.cloneDeep(rawQuery);
1302
+ }
1303
+ if (!import_lodash.default.isUndefined(rawChart)) {
1304
+ const nextChart = import_lodash.default.omit(import_lodash.default.cloneDeep(rawChart), ["option", "events"]);
1305
+ const strictQuery = nextConfigure.query;
1306
+ if (!import_lodash.default.isUndefined(rawOption)) {
1307
+ if (canDeriveSemanticVisualFromOption(rawOption)) {
1308
+ const semanticVisual = deriveChartVisual({ chart: { option: rawOption } });
1309
+ nextChart.option = semanticVisual ? normalizeChartVisual(semanticVisual, (strictQuery == null ? void 0 : strictQuery.mode) === "builder" ? strictQuery : void 0) : import_lodash.default.cloneDeep(rawOption);
1310
+ } else {
1311
+ if (hasOwn(rawOption, "mode")) {
1312
+ inferVisualMode(rawOption);
1313
+ }
1314
+ nextChart.option = import_lodash.default.cloneDeep(rawOption);
1315
+ }
1316
+ }
1317
+ if (!import_lodash.default.isUndefined(rawEvents)) {
1318
+ if (hasOwn(rawEvents, "raw") || hasOwn(rawEvents, "mode")) {
1319
+ const semanticEvents = deriveChartEvents({ chart: { events: rawEvents } });
1320
+ nextChart.events = semanticEvents ? normalizeChartEvents(semanticEvents) : void 0;
1321
+ } else {
1322
+ nextChart.events = import_lodash.default.cloneDeep(rawEvents);
1323
+ }
1324
+ }
1325
+ if (Object.keys(nextChart).length) {
1326
+ nextConfigure.chart = nextChart;
1327
+ }
1328
+ }
1329
+ return nextConfigure;
1330
+ }
1331
+ function buildChartConfigureFromSemanticChanges(currentConfigure, changes) {
1332
+ var _a, _b, _c, _d;
1333
+ if (hasOwn(changes, "configure") && ["query", "visual", "events"].some((key) => hasOwn(changes, key))) {
1334
+ throw new import_errors.FlowSurfaceBadRequestError(
1335
+ "chart configure cannot mix legacy configure with semantic query/visual/events changes"
1336
+ );
1337
+ }
1338
+ if (hasOwn(changes, "configure")) {
1339
+ return canonicalizeChartConfigure(changes.configure);
1340
+ }
1341
+ const hasSemanticChanges = ["query", "visual", "events"].some((key) => hasOwn(changes, key));
1342
+ if (!hasSemanticChanges) {
1343
+ return import_lodash.default.cloneDeep(currentConfigure) || {};
1344
+ }
1345
+ const nextQueryPatch = hasMeaningfulSemanticPatch(changes, "query") ? changes.query : void 0;
1346
+ const nextVisualPatch = hasMeaningfulSemanticPatch(changes, "visual") ? changes.visual : void 0;
1347
+ const nextEventsPatch = hasMeaningfulSemanticPatch(changes, "events") ? changes.events : void 0;
1348
+ const currentState = deriveChartSemanticState(currentConfigure);
1349
+ const nextState = {
1350
+ query: mergeChartQuerySection(currentState.query, nextQueryPatch),
1351
+ visual: mergeChartVisualSection(currentState.visual, nextVisualPatch),
1352
+ events: mergeChartSection(currentState.events, nextEventsPatch, "chart events")
1353
+ };
1354
+ if (hasMeaningfulSemanticPatch(changes, "query") && !hasMeaningfulSemanticPatch(changes, "visual") && ((_a = nextState.query) == null ? void 0 : _a.mode) === "builder" && ((_b = nextState.visual) == null ? void 0 : _b.mode) === "basic") {
1355
+ nextState.visual = sanitizeBasicVisualForBuilderQuery(nextState.visual, nextState.query);
1356
+ }
1357
+ if (hasMeaningfulSemanticPatch(changes, "query") && !hasMeaningfulSemanticPatch(changes, "visual") && ((_c = nextState.query) == null ? void 0 : _c.mode) === "sql" && ((_d = nextState.visual) == null ? void 0 : _d.mode) === "basic") {
1358
+ nextState.visual = sanitizeBasicVisualForSqlQuery(nextState.visual);
1359
+ }
1360
+ return rebuildChartConfigureFromSemanticState(nextState);
1361
+ }
1362
+ function isChartBuilderQuery(configure) {
1363
+ return !!getChartBuilderResourceInit(configure);
1364
+ }
1365
+ function getChartVisualCommonStyleKeys() {
1366
+ return Array.from(CHART_COMMON_STYLE_KEYS);
1367
+ }
1368
+ // Annotate the CommonJS export names for ESM import in node:
1369
+ 0 && (module.exports = {
1370
+ CHART_BASIC_VISUAL_TYPES,
1371
+ CHART_DEFAULT_DATA_SOURCE_KEY,
1372
+ CHART_FUNNEL_SORTS,
1373
+ CHART_LABEL_TYPES,
1374
+ CHART_QUERY_AGGREGATIONS,
1375
+ CHART_QUERY_MODES,
1376
+ CHART_SORT_DIRECTIONS,
1377
+ CHART_SORT_NULLS,
1378
+ CHART_VISUAL_MODES,
1379
+ buildChartConfigureFromSemanticChanges,
1380
+ canonicalizeChartConfigure,
1381
+ deriveChartSemanticState,
1382
+ getChartBuilderQueryAliases,
1383
+ getChartBuilderQueryOutputs,
1384
+ getChartBuilderResourceInit,
1385
+ getChartRiskyPatternHints,
1386
+ getChartSafeDefaultHints,
1387
+ getChartSupportedMappingsByType,
1388
+ getChartSupportedStylesByType,
1389
+ getChartSupportedVisualTypes,
1390
+ getChartUnsupportedPatternHints,
1391
+ getChartVisualCommonStyleKeys,
1392
+ getChartVisualMappingAliases,
1393
+ isChartBuilderQuery
1394
+ });