@openforis/arena-core 2.24.0 → 3.0.0

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 (899) hide show
  1. package/dist/app/appInfo.d.ts +1 -1
  2. package/dist/app/appInfo.js.map +1 -1
  3. package/dist/app/index.d.ts +1 -1
  4. package/dist/app/index.js.map +1 -1
  5. package/dist/auth/authGroup.d.ts +4 -4
  6. package/dist/auth/authGroup.js.map +1 -1
  7. package/dist/auth/authGroups.d.ts +9 -9
  8. package/dist/auth/authGroups.js.map +1 -1
  9. package/dist/auth/authorizer.d.ts +58 -58
  10. package/dist/auth/authorizer.js.map +1 -1
  11. package/dist/auth/factory.d.ts +4 -4
  12. package/dist/auth/factory.js.map +1 -1
  13. package/dist/auth/index.d.ts +6 -6
  14. package/dist/auth/index.js.map +1 -1
  15. package/dist/auth/user.d.ts +17 -17
  16. package/dist/auth/user.js.map +1 -1
  17. package/dist/auth/userAuth.d.ts +10 -10
  18. package/dist/auth/userAuth.js.map +1 -1
  19. package/dist/auth/userAuthTokenService.d.ts +11 -11
  20. package/dist/auth/userAuthTokenService.js.map +1 -1
  21. package/dist/auth/userGroup.d.ts +5 -5
  22. package/dist/auth/userGroup.js.map +1 -1
  23. package/dist/auth/userService.d.ts +14 -14
  24. package/dist/auth/userService.js.map +1 -1
  25. package/dist/auth/users.d.ts +11 -11
  26. package/dist/auth/users.js.map +1 -1
  27. package/dist/category/categories.d.ts +5 -5
  28. package/dist/category/categories.js.map +1 -1
  29. package/dist/category/category.d.ts +7 -7
  30. package/dist/category/category.js.map +1 -1
  31. package/dist/category/categoryImportSummary.d.ts +3 -3
  32. package/dist/category/categoryImportSummary.js.map +1 -1
  33. package/dist/category/categoryItemGenerator.d.ts +4 -4
  34. package/dist/category/categoryItemGenerator.js.map +1 -1
  35. package/dist/category/categoryItems.d.ts +5 -5
  36. package/dist/category/categoryItems.js.map +1 -1
  37. package/dist/category/factory.d.ts +11 -11
  38. package/dist/category/factory.js.map +1 -1
  39. package/dist/category/index.d.ts +7 -7
  40. package/dist/category/index.js.map +1 -1
  41. package/dist/category/item.d.ts +6 -6
  42. package/dist/category/item.js.map +1 -1
  43. package/dist/category/itemService.d.ts +16 -16
  44. package/dist/category/itemService.js.map +1 -1
  45. package/dist/category/level.d.ts +2 -2
  46. package/dist/category/level.js.map +1 -1
  47. package/dist/category/levelService.d.ts +15 -15
  48. package/dist/category/levelService.js.map +1 -1
  49. package/dist/category/service.d.ts +19 -19
  50. package/dist/category/service.js.map +1 -1
  51. package/dist/chain/chain.d.ts +7 -7
  52. package/dist/chain/chain.js.map +1 -1
  53. package/dist/chain/chainFactory.d.ts +3 -3
  54. package/dist/chain/chainFactory.js.map +1 -1
  55. package/dist/chain/chainNodeDef.d.ts +2 -2
  56. package/dist/chain/chainNodeDef.js.map +1 -1
  57. package/dist/chain/chainNodeDefAggregate.d.ts +4 -4
  58. package/dist/chain/chainNodeDefAggregate.js.map +1 -1
  59. package/dist/chain/chainNodeDefFactory.d.ts +3 -3
  60. package/dist/chain/chainNodeDefFactory.js.map +1 -1
  61. package/dist/chain/chainNodeDefService.d.ts +7 -7
  62. package/dist/chain/chainNodeDefService.js.map +1 -1
  63. package/dist/chain/chainService.d.ts +13 -13
  64. package/dist/chain/chainService.js.map +1 -1
  65. package/dist/chain/index.d.ts +5 -5
  66. package/dist/chain/index.js.map +1 -1
  67. package/dist/common/Dictionary.d.ts +1 -1
  68. package/dist/common/Dictionary.js.map +1 -1
  69. package/dist/common/factory.d.ts +1 -1
  70. package/dist/common/factory.js.map +1 -1
  71. package/dist/common/i18n.d.ts +1 -1
  72. package/dist/common/i18n.js.map +1 -1
  73. package/dist/common/index.d.ts +5 -5
  74. package/dist/common/index.js.map +1 -1
  75. package/dist/dataExport/ArenaExportInfo.d.ts +2 -2
  76. package/dist/dataExport/ArenaExportInfo.js.map +1 -1
  77. package/dist/dataExport/ArenaExportInfoFactory.d.ts +4 -4
  78. package/dist/dataExport/ArenaExportInfoFactory.js.map +1 -1
  79. package/dist/dataExport/FlatDataExportModel.d.ts +12 -12
  80. package/dist/dataExport/FlatDataExportModel.js +11 -11
  81. package/dist/dataExport/FlatDataExportModel.js.map +1 -1
  82. package/dist/dataExport/FlatDataExportOptions.d.ts +2 -2
  83. package/dist/dataExport/FlatDataExportOptions.js.map +1 -1
  84. package/dist/dataExport/FlatDataFiles.d.ts +2 -2
  85. package/dist/dataExport/FlatDataFiles.js.map +1 -1
  86. package/dist/dataExport/UniqueFileNamesGenerator.d.ts +3 -3
  87. package/dist/dataExport/UniqueFileNamesGenerator.js.map +1 -1
  88. package/dist/dataExport/index.d.ts +1 -1
  89. package/dist/dataExport/index.js.map +1 -1
  90. package/dist/dataQuery/dataQuery.d.ts +8 -8
  91. package/dist/dataQuery/dataQuery.js.map +1 -1
  92. package/dist/dataQuery/dataQuerySummaries.d.ts +16 -16
  93. package/dist/dataQuery/dataQuerySummaries.js.map +1 -1
  94. package/dist/dataQuery/index.d.ts +1 -1
  95. package/dist/dataQuery/index.js.map +1 -1
  96. package/dist/error/SystemError.d.ts +4 -4
  97. package/dist/error/SystemError.js.map +1 -1
  98. package/dist/esm/app/appInfo.js.map +1 -1
  99. package/dist/esm/app/index.js.map +1 -1
  100. package/dist/esm/auth/authGroup.js.map +1 -1
  101. package/dist/esm/auth/authGroups.js.map +1 -1
  102. package/dist/esm/auth/authorizer.js.map +1 -1
  103. package/dist/esm/auth/factory.js.map +1 -1
  104. package/dist/esm/auth/index.js.map +1 -1
  105. package/dist/esm/auth/user.js.map +1 -1
  106. package/dist/esm/auth/userAuth.js.map +1 -1
  107. package/dist/esm/auth/userAuthTokenService.js.map +1 -1
  108. package/dist/esm/auth/userGroup.js.map +1 -1
  109. package/dist/esm/auth/userService.js.map +1 -1
  110. package/dist/esm/auth/users.js.map +1 -1
  111. package/dist/esm/category/categories.js.map +1 -1
  112. package/dist/esm/category/category.js.map +1 -1
  113. package/dist/esm/category/categoryImportSummary.js.map +1 -1
  114. package/dist/esm/category/categoryItemGenerator.js.map +1 -1
  115. package/dist/esm/category/categoryItems.js.map +1 -1
  116. package/dist/esm/category/factory.js.map +1 -1
  117. package/dist/esm/category/index.js.map +1 -1
  118. package/dist/esm/category/item.js.map +1 -1
  119. package/dist/esm/category/itemService.js.map +1 -1
  120. package/dist/esm/category/level.js.map +1 -1
  121. package/dist/esm/category/levelService.js.map +1 -1
  122. package/dist/esm/category/service.js.map +1 -1
  123. package/dist/esm/chain/chain.js.map +1 -1
  124. package/dist/esm/chain/chainFactory.js.map +1 -1
  125. package/dist/esm/chain/chainNodeDef.js.map +1 -1
  126. package/dist/esm/chain/chainNodeDefAggregate.js.map +1 -1
  127. package/dist/esm/chain/chainNodeDefFactory.js.map +1 -1
  128. package/dist/esm/chain/chainNodeDefService.js.map +1 -1
  129. package/dist/esm/chain/chainService.js.map +1 -1
  130. package/dist/esm/chain/index.js.map +1 -1
  131. package/dist/esm/common/Dictionary.js.map +1 -1
  132. package/dist/esm/common/factory.js.map +1 -1
  133. package/dist/esm/common/i18n.js.map +1 -1
  134. package/dist/esm/common/index.js.map +1 -1
  135. package/dist/esm/dataExport/ArenaExportInfo.js.map +1 -1
  136. package/dist/esm/dataExport/ArenaExportInfoFactory.js.map +1 -1
  137. package/dist/esm/dataExport/FlatDataExportModel.js +12 -12
  138. package/dist/esm/dataExport/FlatDataExportModel.js.map +1 -1
  139. package/dist/esm/dataExport/FlatDataExportOptions.js.map +1 -1
  140. package/dist/esm/dataExport/FlatDataFiles.js.map +1 -1
  141. package/dist/esm/dataExport/UniqueFileNamesGenerator.js.map +1 -1
  142. package/dist/esm/dataExport/index.js.map +1 -1
  143. package/dist/esm/dataQuery/dataQuery.js.map +1 -1
  144. package/dist/esm/dataQuery/dataQuerySummaries.js.map +1 -1
  145. package/dist/esm/dataQuery/index.js.map +1 -1
  146. package/dist/esm/error/SystemError.js.map +1 -1
  147. package/dist/esm/expression/context.js.map +1 -1
  148. package/dist/esm/expression/evaluator.js.map +1 -1
  149. package/dist/esm/expression/function.js.map +1 -1
  150. package/dist/esm/expression/index.js.map +1 -1
  151. package/dist/esm/expression/javascript/evaluator.js.map +1 -1
  152. package/dist/esm/expression/javascript/functionsDefault.js.map +1 -1
  153. package/dist/esm/expression/javascript/global.js.map +1 -1
  154. package/dist/esm/expression/javascript/node/array.js.map +1 -1
  155. package/dist/esm/expression/javascript/node/binary.js.map +1 -1
  156. package/dist/esm/expression/javascript/node/call.js.map +1 -1
  157. package/dist/esm/expression/javascript/node/compound.js.map +1 -1
  158. package/dist/esm/expression/javascript/node/conditional.js.map +1 -1
  159. package/dist/esm/expression/javascript/node/identifier.js.map +1 -1
  160. package/dist/esm/expression/javascript/node/literal.js.map +1 -1
  161. package/dist/esm/expression/javascript/node/member.js.map +1 -1
  162. package/dist/esm/expression/javascript/node/sequence.js.map +1 -1
  163. package/dist/esm/expression/javascript/node/this.js.map +1 -1
  164. package/dist/esm/expression/javascript/node/unary.js.map +1 -1
  165. package/dist/esm/expression/javascript/parser/parser.js.map +1 -1
  166. package/dist/esm/expression/node.js.map +1 -1
  167. package/dist/esm/expression/parser.js.map +1 -1
  168. package/dist/esm/extraProp/extraProp.js.map +1 -1
  169. package/dist/esm/extraProp/extraProps.js.map +1 -1
  170. package/dist/esm/extraProp/extraPropsDataGenerator.js.map +1 -1
  171. package/dist/esm/extraProp/index.js.map +1 -1
  172. package/dist/esm/geo/areaOfInterest.js.map +1 -1
  173. package/dist/esm/geo/index.js.map +1 -1
  174. package/dist/esm/geo/point.js.map +1 -1
  175. package/dist/esm/geo/pointFactory.js.map +1 -1
  176. package/dist/esm/geo/points/bearing.js +1 -1
  177. package/dist/esm/geo/points/bearing.js.map +1 -1
  178. package/dist/esm/geo/points/distance.js +1 -1
  179. package/dist/esm/geo/points/distance.js.map +1 -1
  180. package/dist/esm/geo/points/distanceToPolygonBoundary.js +3 -3
  181. package/dist/esm/geo/points/distanceToPolygonBoundary.js.map +1 -1
  182. package/dist/esm/geo/points/equals.js.map +1 -1
  183. package/dist/esm/geo/points/getSrs.js.map +1 -1
  184. package/dist/esm/geo/points/isFilled.js.map +1 -1
  185. package/dist/esm/geo/points/isValid.js.map +1 -1
  186. package/dist/esm/geo/points/parse.js +1 -1
  187. package/dist/esm/geo/points/parse.js.map +1 -1
  188. package/dist/esm/geo/points/pointAtDistance.js.map +1 -1
  189. package/dist/esm/geo/points/toLatLong.js.map +1 -1
  190. package/dist/esm/geo/points/toString.js.map +1 -1
  191. package/dist/esm/geo/points/transform.js.map +1 -1
  192. package/dist/esm/index.js +2 -2
  193. package/dist/esm/index.js.map +1 -1
  194. package/dist/esm/job/JobBase.js +6 -1
  195. package/dist/esm/job/JobBase.js.map +1 -1
  196. package/dist/esm/job/index.js.map +1 -1
  197. package/dist/esm/job/job.js.map +1 -1
  198. package/dist/esm/job/jobContext.js.map +1 -1
  199. package/dist/esm/job/jobEvent.js.map +1 -1
  200. package/dist/esm/job/jobSerialized.js.map +1 -1
  201. package/dist/esm/language/index.js.map +1 -1
  202. package/dist/esm/language/labels.js.map +1 -1
  203. package/dist/esm/logger/index.js.map +1 -1
  204. package/dist/esm/logger/logger.js.map +1 -1
  205. package/dist/esm/message/index.js.map +1 -1
  206. package/dist/esm/message/message.js.map +1 -1
  207. package/dist/esm/message/messages.js.map +1 -1
  208. package/dist/esm/node/factory.js +1 -1
  209. package/dist/esm/node/factory.js.map +1 -1
  210. package/dist/esm/node/index.js +5 -5
  211. package/dist/esm/node/index.js.map +1 -1
  212. package/dist/esm/node/node.js +10 -10
  213. package/dist/esm/node/node.js.map +1 -1
  214. package/dist/esm/node/nodePointer.js.map +1 -1
  215. package/dist/esm/node/nodeValue/code.js.map +1 -1
  216. package/dist/esm/node/nodeValue/coordinate.js.map +1 -1
  217. package/dist/esm/node/nodeValue/file.js.map +1 -1
  218. package/dist/esm/node/nodeValue/index.js.map +1 -1
  219. package/dist/esm/node/nodeValue/taxon.js.map +1 -1
  220. package/dist/esm/node/nodeValueFormatter.js +5 -5
  221. package/dist/esm/node/nodeValueFormatter.js.map +1 -1
  222. package/dist/esm/node/nodeValues.js +2 -2
  223. package/dist/esm/node/nodeValues.js.map +1 -1
  224. package/dist/esm/node/nodes.js +4 -5
  225. package/dist/esm/node/nodes.js.map +1 -1
  226. package/dist/esm/node/service.js.map +1 -1
  227. package/dist/esm/nodeDef/factory.js.map +1 -1
  228. package/dist/esm/nodeDef/index.js.map +1 -1
  229. package/dist/esm/nodeDef/nodeDef.js.map +1 -1
  230. package/dist/esm/nodeDef/nodeDefs.js.map +1 -1
  231. package/dist/esm/nodeDef/service.js.map +1 -1
  232. package/dist/esm/nodeDef/types/boolean.js.map +1 -1
  233. package/dist/esm/nodeDef/types/code.js.map +1 -1
  234. package/dist/esm/nodeDef/types/coordinate.js.map +1 -1
  235. package/dist/esm/nodeDef/types/date.js.map +1 -1
  236. package/dist/esm/nodeDef/types/decimal.js.map +1 -1
  237. package/dist/esm/nodeDef/types/entity.js.map +1 -1
  238. package/dist/esm/nodeDef/types/file.js.map +1 -1
  239. package/dist/esm/nodeDef/types/formHeader.js.map +1 -1
  240. package/dist/esm/nodeDef/types/geo.js.map +1 -1
  241. package/dist/esm/nodeDef/types/integer.js.map +1 -1
  242. package/dist/esm/nodeDef/types/taxon.js.map +1 -1
  243. package/dist/esm/nodeDef/types/text.js.map +1 -1
  244. package/dist/esm/nodeDef/types/time.js.map +1 -1
  245. package/dist/esm/nodeDefExpressionEvaluator/areaOfInterestProvider.js.map +1 -1
  246. package/dist/esm/nodeDefExpressionEvaluator/categoryItemProvider.js.map +1 -1
  247. package/dist/esm/nodeDefExpressionEvaluator/context.js.map +1 -1
  248. package/dist/esm/nodeDefExpressionEvaluator/evaluator.js.map +1 -1
  249. package/dist/esm/nodeDefExpressionEvaluator/functions.js.map +1 -1
  250. package/dist/esm/nodeDefExpressionEvaluator/index.js.map +1 -1
  251. package/dist/esm/nodeDefExpressionEvaluator/node/identifier.js +3 -2
  252. package/dist/esm/nodeDefExpressionEvaluator/node/identifier.js.map +1 -1
  253. package/dist/esm/nodeDefExpressionEvaluator/node/member.js.map +1 -1
  254. package/dist/esm/nodeDefExpressionEvaluator/node/thisEvaluator.js.map +1 -1
  255. package/dist/esm/nodeDefExpressionEvaluator/taxonProvider.js.map +1 -1
  256. package/dist/esm/nodeDefExpressionEvaluator/validator.js.map +1 -1
  257. package/dist/esm/record/_records/nodeDefSelfReferences.js.map +1 -1
  258. package/dist/esm/record/_records/recordCompletion.js +8 -8
  259. package/dist/esm/record/_records/recordCompletion.js.map +1 -1
  260. package/dist/esm/record/_records/recordGetters.js +12 -12
  261. package/dist/esm/record/_records/recordGetters.js.map +1 -1
  262. package/dist/esm/record/_records/recordNodesIndexUpdater.js +3 -3
  263. package/dist/esm/record/_records/recordNodesIndexUpdater.js.map +1 -1
  264. package/dist/esm/record/_records/recordPagesValidation.js +3 -3
  265. package/dist/esm/record/_records/recordPagesValidation.js.map +1 -1
  266. package/dist/esm/record/_records/recordUpdateOptions.js.map +1 -1
  267. package/dist/esm/record/_records/recordUpdater.js.map +1 -1
  268. package/dist/esm/record/_records/recordUtils.js +2 -2
  269. package/dist/esm/record/_records/recordUtils.js.map +1 -1
  270. package/dist/esm/record/factory.js.map +1 -1
  271. package/dist/esm/record/index.js +1 -1
  272. package/dist/esm/record/index.js.map +1 -1
  273. package/dist/esm/record/nodePointers.js +1 -1
  274. package/dist/esm/record/nodePointers.js.map +1 -1
  275. package/dist/esm/record/record.js.map +1 -1
  276. package/dist/esm/record/recordCloner.js +8 -8
  277. package/dist/esm/record/recordCloner.js.map +1 -1
  278. package/dist/esm/record/recordExpressionEvaluator/context.js.map +1 -1
  279. package/dist/esm/record/recordExpressionEvaluator/functions.js +5 -5
  280. package/dist/esm/record/recordExpressionEvaluator/functions.js.map +1 -1
  281. package/dist/esm/record/recordExpressionEvaluator/index.js.map +1 -1
  282. package/dist/esm/record/recordExpressionEvaluator/node/identifier/identifier.js +3 -3
  283. package/dist/esm/record/recordExpressionEvaluator/node/identifier/identifier.js.map +1 -1
  284. package/dist/esm/record/recordExpressionEvaluator/node/identifier/nodesFinder.js +2 -2
  285. package/dist/esm/record/recordExpressionEvaluator/node/identifier/nodesFinder.js.map +1 -1
  286. package/dist/esm/record/recordExpressionEvaluator/node/thisEvaluator.js.map +1 -1
  287. package/dist/esm/record/recordExpressionEvaluator/nodeValueExtractor.js +9 -9
  288. package/dist/esm/record/recordExpressionEvaluator/nodeValueExtractor.js.map +1 -1
  289. package/dist/esm/record/recordExpressionEvaluator/recordExpressionEvaluator.js.map +1 -1
  290. package/dist/esm/record/recordFixer.js +6 -6
  291. package/dist/esm/record/recordFixer.js.map +1 -1
  292. package/dist/esm/record/recordNodesUpdater/index.js +0 -9
  293. package/dist/esm/record/recordNodesUpdater/index.js.map +1 -1
  294. package/dist/esm/record/recordNodesUpdater/recordEnumeratingItemsExpressionEvaluator.js.map +1 -1
  295. package/dist/esm/record/recordNodesUpdater/recordExpressionEvaluationContext.js.map +1 -1
  296. package/dist/esm/record/recordNodesUpdater/recordExpressionValueConverter.js +1 -1
  297. package/dist/esm/record/recordNodesUpdater/recordExpressionValueConverter.js.map +1 -1
  298. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsApplicableUpdater.js +8 -8
  299. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsApplicableUpdater.js.map +1 -1
  300. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsBooleanUpdater.js.map +1 -1
  301. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsCodeAttributesUpdater.js +5 -5
  302. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsCodeAttributesUpdater.js.map +1 -1
  303. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsCountUpdater.js +7 -3
  304. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsCountUpdater.js.map +1 -1
  305. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsDefaultValuesUpdater.js +11 -11
  306. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsDefaultValuesUpdater.js.map +1 -1
  307. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsEditableUpdater.js +3 -3
  308. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsEditableUpdater.js.map +1 -1
  309. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsEnumeratedEntitiesUpdater.js +3 -3
  310. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsEnumeratedEntitiesUpdater.js.map +1 -1
  311. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsEnumeratingItemsUpdater.js +5 -4
  312. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsEnumeratingItemsUpdater.js.map +1 -1
  313. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsFileNamesEvaluator.js +7 -7
  314. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsFileNamesEvaluator.js.map +1 -1
  315. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js +5 -5
  316. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -1
  317. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsUpdateParams.js.map +1 -1
  318. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsVisibleUpdater.js +3 -3
  319. package/dist/esm/record/recordNodesUpdater/recordNodeDependentsVisibleUpdater.js.map +1 -1
  320. package/dist/esm/record/recordNodesUpdater/recordNodesCreator.js +6 -6
  321. package/dist/esm/record/recordNodesUpdater/recordNodesCreator.js.map +1 -1
  322. package/dist/esm/record/recordNodesUpdater/recordNodesDeleter.js.map +1 -1
  323. package/dist/esm/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.js.map +1 -1
  324. package/dist/esm/record/recordNodesUpdater/recordNodesUpdater.js.map +1 -1
  325. package/dist/esm/record/recordNodesUpdater/recordUpdateResult.js.map +1 -1
  326. package/dist/esm/record/recordPrettyPrinter.js +8 -8
  327. package/dist/esm/record/recordPrettyPrinter.js.map +1 -1
  328. package/dist/esm/record/recordStep.js.map +1 -1
  329. package/dist/esm/record/recordUpdater.js +2 -2
  330. package/dist/esm/record/recordUpdater.js.map +1 -1
  331. package/dist/esm/record/recordValidations.js.map +1 -1
  332. package/dist/esm/record/recordValidator/attributeKeyValidator.js +5 -4
  333. package/dist/esm/record/recordValidator/attributeKeyValidator.js.map +1 -1
  334. package/dist/esm/record/recordValidator/attributeTypeValidator.js +14 -14
  335. package/dist/esm/record/recordValidator/attributeTypeValidator.js.map +1 -1
  336. package/dist/esm/record/recordValidator/attributeUniqueValidator.js +3 -3
  337. package/dist/esm/record/recordValidator/attributeUniqueValidator.js.map +1 -1
  338. package/dist/esm/record/recordValidator/attributeValidator.js +8 -8
  339. package/dist/esm/record/recordValidator/attributeValidator.js.map +1 -1
  340. package/dist/esm/record/recordValidator/countValidator.js +5 -5
  341. package/dist/esm/record/recordValidator/countValidator.js.map +1 -1
  342. package/dist/esm/record/recordValidator/index.js.map +1 -1
  343. package/dist/esm/record/recordValidator/recordValidator.js.map +1 -1
  344. package/dist/esm/record/records.js +0 -4
  345. package/dist/esm/record/records.js.map +1 -1
  346. package/dist/esm/record/service.js.map +1 -1
  347. package/dist/esm/registry/index.js.map +1 -1
  348. package/dist/esm/registry/serviceRegistry.js.map +1 -1
  349. package/dist/esm/registry/serviceTypeMap.js.map +1 -1
  350. package/dist/esm/srs/factory.js.map +1 -1
  351. package/dist/esm/srs/index.js.map +1 -1
  352. package/dist/esm/srs/srs.js.map +1 -1
  353. package/dist/esm/survey/factory.js.map +1 -1
  354. package/dist/esm/survey/index.js.map +1 -1
  355. package/dist/esm/survey/nodeDefsFixer.js.map +1 -1
  356. package/dist/esm/survey/refData/factory.js.map +1 -1
  357. package/dist/esm/survey/refData/index.js.map +1 -1
  358. package/dist/esm/survey/refData/refData.js.map +1 -1
  359. package/dist/esm/survey/service.js.map +1 -1
  360. package/dist/esm/survey/survey.js.map +1 -1
  361. package/dist/esm/survey/surveyDocImageFactory.js.map +1 -1
  362. package/dist/esm/survey/surveyDocImages.js.map +1 -1
  363. package/dist/esm/survey/surveyFileFactory.js.map +1 -1
  364. package/dist/esm/survey/surveys/_nodeDefs/nodeDefsIndex.js.map +1 -1
  365. package/dist/esm/survey/surveys/_nodeDefs/nodeDefsReader.js.map +1 -1
  366. package/dist/esm/survey/surveys/dependencies.js.map +1 -1
  367. package/dist/esm/survey/surveys/nodeDefs.js.map +1 -1
  368. package/dist/esm/survey/surveys/refsData.js.map +1 -1
  369. package/dist/esm/survey/surveys/surveyGettersSecurity.js.map +1 -1
  370. package/dist/esm/survey/surveys/surveysGetters.js.map +1 -1
  371. package/dist/esm/survey/surveys/surveysUtils.js.map +1 -1
  372. package/dist/esm/taxonomy/factory.js.map +1 -1
  373. package/dist/esm/taxonomy/index.js.map +1 -1
  374. package/dist/esm/taxonomy/service.js.map +1 -1
  375. package/dist/esm/taxonomy/taxa.js.map +1 -1
  376. package/dist/esm/taxonomy/taxon.js.map +1 -1
  377. package/dist/esm/taxonomy/taxonGenerator.js.map +1 -1
  378. package/dist/esm/taxonomy/taxonService.js.map +1 -1
  379. package/dist/esm/taxonomy/taxonVernacularName.js.map +1 -1
  380. package/dist/esm/taxonomy/taxonomies.js.map +1 -1
  381. package/dist/esm/taxonomy/taxonomy.js.map +1 -1
  382. package/dist/esm/tests/builder/recordBuilder/attributeBuilder.js +2 -2
  383. package/dist/esm/tests/builder/recordBuilder/attributeBuilder.js.map +1 -1
  384. package/dist/esm/tests/builder/recordBuilder/entityBuilder.js +2 -2
  385. package/dist/esm/tests/builder/recordBuilder/entityBuilder.js.map +1 -1
  386. package/dist/esm/tests/builder/recordBuilder/nodeBuilder.js.map +1 -1
  387. package/dist/esm/tests/builder/recordBuilder/recordBuilder.js.map +1 -1
  388. package/dist/esm/tests/builder/surveyBuilder/categoryBuilder.js +1 -1
  389. package/dist/esm/tests/builder/surveyBuilder/categoryBuilder.js.map +1 -1
  390. package/dist/esm/tests/builder/surveyBuilder/categoryItemBuilder.js.map +1 -1
  391. package/dist/esm/tests/builder/surveyBuilder/nodeDefAttributeBuilder.js.map +1 -1
  392. package/dist/esm/tests/builder/surveyBuilder/nodeDefBuilder.js.map +1 -1
  393. package/dist/esm/tests/builder/surveyBuilder/nodeDefCodeBuilder.js.map +1 -1
  394. package/dist/esm/tests/builder/surveyBuilder/nodeDefEntityBuilder.js.map +1 -1
  395. package/dist/esm/tests/builder/surveyBuilder/nodeDefTaxonBuilder.js.map +1 -1
  396. package/dist/esm/tests/builder/surveyBuilder/surveyBuilder.js.map +1 -1
  397. package/dist/esm/tests/builder/surveyBuilder/taxonBuilder.js.map +1 -1
  398. package/dist/esm/tests/builder/surveyBuilder/taxonomyBuilder.js.map +1 -1
  399. package/dist/esm/utils/fileProcessor.js.map +1 -1
  400. package/dist/esm/utils/index.js.map +1 -1
  401. package/dist/esm/utils/mutationOptions.js +1 -4
  402. package/dist/esm/utils/mutationOptions.js.map +1 -1
  403. package/dist/esm/utils/versions.js.map +1 -1
  404. package/dist/esm/validation/factory.js.map +1 -1
  405. package/dist/esm/validation/fieldValidator.js.map +1 -1
  406. package/dist/esm/validation/fieldValidators/email.js.map +1 -1
  407. package/dist/esm/validation/fieldValidators/name.js.map +1 -1
  408. package/dist/esm/validation/fieldValidators/notKeyword.js.map +1 -1
  409. package/dist/esm/validation/fieldValidators/numeric.js.map +1 -1
  410. package/dist/esm/validation/fieldValidators/numericPositive.js.map +1 -1
  411. package/dist/esm/validation/fieldValidators/required.js.map +1 -1
  412. package/dist/esm/validation/index.js.map +1 -1
  413. package/dist/esm/validation/validation.js.map +1 -1
  414. package/dist/esm/validation/validationResults.js.map +1 -1
  415. package/dist/esm/validation/validations.js +4 -5
  416. package/dist/esm/validation/validations.js.map +1 -1
  417. package/dist/esm/validation/validator.js.map +1 -1
  418. package/dist/expression/context.d.ts +1 -1
  419. package/dist/expression/context.js.map +1 -1
  420. package/dist/expression/evaluator.d.ts +6 -6
  421. package/dist/expression/evaluator.js.map +1 -1
  422. package/dist/expression/function.d.ts +4 -4
  423. package/dist/expression/function.js.map +1 -1
  424. package/dist/expression/index.d.ts +4 -4
  425. package/dist/expression/index.js.map +1 -1
  426. package/dist/expression/javascript/evaluator.d.ts +11 -11
  427. package/dist/expression/javascript/evaluator.js.map +1 -1
  428. package/dist/expression/javascript/functionsDefault.d.ts +3 -3
  429. package/dist/expression/javascript/functionsDefault.js.map +1 -1
  430. package/dist/expression/javascript/global.js.map +1 -1
  431. package/dist/expression/javascript/node/array.d.ts +3 -3
  432. package/dist/expression/javascript/node/array.js.map +1 -1
  433. package/dist/expression/javascript/node/binary.d.ts +4 -4
  434. package/dist/expression/javascript/node/binary.js.map +1 -1
  435. package/dist/expression/javascript/node/call.d.ts +4 -4
  436. package/dist/expression/javascript/node/call.js.map +1 -1
  437. package/dist/expression/javascript/node/compound.d.ts +3 -3
  438. package/dist/expression/javascript/node/compound.js.map +1 -1
  439. package/dist/expression/javascript/node/conditional.d.ts +3 -3
  440. package/dist/expression/javascript/node/conditional.js.map +1 -1
  441. package/dist/expression/javascript/node/identifier.d.ts +5 -5
  442. package/dist/expression/javascript/node/identifier.js.map +1 -1
  443. package/dist/expression/javascript/node/literal.d.ts +4 -4
  444. package/dist/expression/javascript/node/literal.js.map +1 -1
  445. package/dist/expression/javascript/node/member.d.ts +5 -5
  446. package/dist/expression/javascript/node/member.js.map +1 -1
  447. package/dist/expression/javascript/node/sequence.d.ts +4 -4
  448. package/dist/expression/javascript/node/sequence.js.map +1 -1
  449. package/dist/expression/javascript/node/this.d.ts +3 -3
  450. package/dist/expression/javascript/node/this.js.map +1 -1
  451. package/dist/expression/javascript/node/unary.d.ts +4 -4
  452. package/dist/expression/javascript/node/unary.js.map +1 -1
  453. package/dist/expression/javascript/parser/parser.d.ts +2 -2
  454. package/dist/expression/javascript/parser/parser.js.map +1 -1
  455. package/dist/expression/node.d.ts +32 -32
  456. package/dist/expression/node.js.map +1 -1
  457. package/dist/expression/parser.d.ts +2 -2
  458. package/dist/expression/parser.js.map +1 -1
  459. package/dist/extraProp/extraProp.d.ts +3 -3
  460. package/dist/extraProp/extraProp.js.map +1 -1
  461. package/dist/extraProp/extraProps.d.ts +5 -5
  462. package/dist/extraProp/extraProps.js.map +1 -1
  463. package/dist/extraProp/extraPropsDataGenerator.d.ts +2 -2
  464. package/dist/extraProp/extraPropsDataGenerator.js.map +1 -1
  465. package/dist/extraProp/index.d.ts +1 -1
  466. package/dist/extraProp/index.js.map +1 -1
  467. package/dist/geo/areaOfInterest.d.ts +4 -4
  468. package/dist/geo/areaOfInterest.js.map +1 -1
  469. package/dist/geo/index.d.ts +2 -2
  470. package/dist/geo/index.js.map +1 -1
  471. package/dist/geo/point.d.ts +1 -1
  472. package/dist/geo/point.js.map +1 -1
  473. package/dist/geo/pointFactory.d.ts +3 -3
  474. package/dist/geo/pointFactory.js.map +1 -1
  475. package/dist/geo/points/bearing.d.ts +4 -4
  476. package/dist/geo/points/bearing.js +1 -1
  477. package/dist/geo/points/bearing.js.map +1 -1
  478. package/dist/geo/points/distance.d.ts +4 -4
  479. package/dist/geo/points/distance.js +1 -1
  480. package/dist/geo/points/distance.js.map +1 -1
  481. package/dist/geo/points/distanceToPolygonBoundary.d.ts +7 -7
  482. package/dist/geo/points/distanceToPolygonBoundary.js +3 -3
  483. package/dist/geo/points/distanceToPolygonBoundary.js.map +1 -1
  484. package/dist/geo/points/equals.d.ts +2 -2
  485. package/dist/geo/points/equals.js.map +1 -1
  486. package/dist/geo/points/getSrs.d.ts +3 -3
  487. package/dist/geo/points/getSrs.js.map +1 -1
  488. package/dist/geo/points/isFilled.d.ts +2 -2
  489. package/dist/geo/points/isFilled.js.map +1 -1
  490. package/dist/geo/points/isValid.d.ts +3 -3
  491. package/dist/geo/points/isValid.js.map +1 -1
  492. package/dist/geo/points/parse.d.ts +3 -3
  493. package/dist/geo/points/parse.js +1 -1
  494. package/dist/geo/points/parse.js.map +1 -1
  495. package/dist/geo/points/pointAtDistance.d.ts +5 -5
  496. package/dist/geo/points/pointAtDistance.js.map +1 -1
  497. package/dist/geo/points/toLatLong.d.ts +3 -3
  498. package/dist/geo/points/toLatLong.js.map +1 -1
  499. package/dist/geo/points/toString.d.ts +2 -2
  500. package/dist/geo/points/toString.js.map +1 -1
  501. package/dist/geo/points/transform.d.ts +4 -4
  502. package/dist/geo/points/transform.js.map +1 -1
  503. package/dist/index.d.ts +26 -26
  504. package/dist/index.js +8 -8
  505. package/dist/index.js.map +1 -1
  506. package/dist/job/JobBase.d.ts +20 -20
  507. package/dist/job/JobBase.js +6 -1
  508. package/dist/job/JobBase.js.map +1 -1
  509. package/dist/job/index.d.ts +5 -5
  510. package/dist/job/index.js.map +1 -1
  511. package/dist/job/job.d.ts +3 -3
  512. package/dist/job/job.js.map +1 -1
  513. package/dist/job/jobContext.d.ts +5 -5
  514. package/dist/job/jobContext.js.map +1 -1
  515. package/dist/job/jobEvent.d.ts +1 -1
  516. package/dist/job/jobEvent.js.map +1 -1
  517. package/dist/job/jobSerialized.d.ts +2 -2
  518. package/dist/job/jobSerialized.js.map +1 -1
  519. package/dist/language/index.d.ts +1 -1
  520. package/dist/language/index.js.map +1 -1
  521. package/dist/language/labels.d.ts +2 -2
  522. package/dist/language/labels.js.map +1 -1
  523. package/dist/logger/index.d.ts +1 -1
  524. package/dist/logger/index.js.map +1 -1
  525. package/dist/logger/logger.d.ts +1 -1
  526. package/dist/logger/logger.js.map +1 -1
  527. package/dist/message/index.d.ts +1 -1
  528. package/dist/message/index.js.map +1 -1
  529. package/dist/message/message.d.ts +1 -1
  530. package/dist/message/message.js.map +1 -1
  531. package/dist/message/messages.d.ts +30 -30
  532. package/dist/message/messages.js.map +1 -1
  533. package/dist/node/factory.d.ts +2 -2
  534. package/dist/node/factory.js +2 -2
  535. package/dist/node/factory.js.map +1 -1
  536. package/dist/node/index.d.ts +9 -9
  537. package/dist/node/index.js +7 -7
  538. package/dist/node/index.js.map +1 -1
  539. package/dist/node/node.d.ts +11 -16
  540. package/dist/node/node.js +11 -11
  541. package/dist/node/node.js.map +1 -1
  542. package/dist/node/nodePointer.d.ts +3 -3
  543. package/dist/node/nodePointer.js.map +1 -1
  544. package/dist/node/nodeValue/code.d.ts +1 -1
  545. package/dist/node/nodeValue/code.js.map +1 -1
  546. package/dist/node/nodeValue/coordinate.d.ts +1 -1
  547. package/dist/node/nodeValue/coordinate.js.map +1 -1
  548. package/dist/node/nodeValue/file.d.ts +1 -1
  549. package/dist/node/nodeValue/file.js.map +1 -1
  550. package/dist/node/nodeValue/index.d.ts +4 -4
  551. package/dist/node/nodeValue/index.js.map +1 -1
  552. package/dist/node/nodeValue/taxon.d.ts +1 -1
  553. package/dist/node/nodeValue/taxon.js.map +1 -1
  554. package/dist/node/nodeValueFormatter.d.ts +5 -5
  555. package/dist/node/nodeValueFormatter.js +5 -5
  556. package/dist/node/nodeValueFormatter.js.map +1 -1
  557. package/dist/node/nodeValues.d.ts +13 -13
  558. package/dist/node/nodeValues.js +3 -3
  559. package/dist/node/nodeValues.js.map +1 -1
  560. package/dist/node/nodes.d.ts +11 -17
  561. package/dist/node/nodes.js +5 -6
  562. package/dist/node/nodes.js.map +1 -1
  563. package/dist/node/service.d.ts +5 -5
  564. package/dist/node/service.js.map +1 -1
  565. package/dist/nodeDef/factory.d.ts +6 -6
  566. package/dist/nodeDef/factory.js.map +1 -1
  567. package/dist/nodeDef/index.d.ts +15 -15
  568. package/dist/nodeDef/index.js.map +1 -1
  569. package/dist/nodeDef/nodeDef.d.ts +32 -32
  570. package/dist/nodeDef/nodeDef.js.map +1 -1
  571. package/dist/nodeDef/nodeDefs.d.ts +106 -106
  572. package/dist/nodeDef/nodeDefs.js.map +1 -1
  573. package/dist/nodeDef/service.d.ts +15 -15
  574. package/dist/nodeDef/service.js.map +1 -1
  575. package/dist/nodeDef/types/boolean.d.ts +3 -3
  576. package/dist/nodeDef/types/boolean.js.map +1 -1
  577. package/dist/nodeDef/types/code.d.ts +4 -4
  578. package/dist/nodeDef/types/code.js.map +1 -1
  579. package/dist/nodeDef/types/coordinate.d.ts +3 -3
  580. package/dist/nodeDef/types/coordinate.js.map +1 -1
  581. package/dist/nodeDef/types/date.d.ts +2 -2
  582. package/dist/nodeDef/types/date.js.map +1 -1
  583. package/dist/nodeDef/types/decimal.d.ts +3 -3
  584. package/dist/nodeDef/types/decimal.js.map +1 -1
  585. package/dist/nodeDef/types/entity.d.ts +9 -9
  586. package/dist/nodeDef/types/entity.js.map +1 -1
  587. package/dist/nodeDef/types/file.d.ts +3 -3
  588. package/dist/nodeDef/types/file.js.map +1 -1
  589. package/dist/nodeDef/types/formHeader.d.ts +3 -3
  590. package/dist/nodeDef/types/formHeader.js.map +1 -1
  591. package/dist/nodeDef/types/geo.d.ts +3 -3
  592. package/dist/nodeDef/types/geo.js.map +1 -1
  593. package/dist/nodeDef/types/integer.d.ts +2 -2
  594. package/dist/nodeDef/types/integer.js.map +1 -1
  595. package/dist/nodeDef/types/taxon.d.ts +3 -3
  596. package/dist/nodeDef/types/taxon.js.map +1 -1
  597. package/dist/nodeDef/types/text.d.ts +4 -4
  598. package/dist/nodeDef/types/text.js.map +1 -1
  599. package/dist/nodeDef/types/time.d.ts +3 -3
  600. package/dist/nodeDef/types/time.js.map +1 -1
  601. package/dist/nodeDefExpressionEvaluator/areaOfInterestProvider.d.ts +5 -5
  602. package/dist/nodeDefExpressionEvaluator/areaOfInterestProvider.js.map +1 -1
  603. package/dist/nodeDefExpressionEvaluator/categoryItemProvider.d.ts +9 -9
  604. package/dist/nodeDefExpressionEvaluator/categoryItemProvider.js.map +1 -1
  605. package/dist/nodeDefExpressionEvaluator/context.d.ts +16 -16
  606. package/dist/nodeDefExpressionEvaluator/context.js.map +1 -1
  607. package/dist/nodeDefExpressionEvaluator/evaluator.d.ts +6 -6
  608. package/dist/nodeDefExpressionEvaluator/evaluator.js.map +1 -1
  609. package/dist/nodeDefExpressionEvaluator/functions.d.ts +2 -2
  610. package/dist/nodeDefExpressionEvaluator/functions.js.map +1 -1
  611. package/dist/nodeDefExpressionEvaluator/index.d.ts +3 -3
  612. package/dist/nodeDefExpressionEvaluator/index.js.map +1 -1
  613. package/dist/nodeDefExpressionEvaluator/node/identifier.d.ts +4 -4
  614. package/dist/nodeDefExpressionEvaluator/node/identifier.js +2 -1
  615. package/dist/nodeDefExpressionEvaluator/node/identifier.js.map +1 -1
  616. package/dist/nodeDefExpressionEvaluator/node/member.d.ts +2 -2
  617. package/dist/nodeDefExpressionEvaluator/node/member.js.map +1 -1
  618. package/dist/nodeDefExpressionEvaluator/node/thisEvaluator.d.ts +1 -1
  619. package/dist/nodeDefExpressionEvaluator/node/thisEvaluator.js.map +1 -1
  620. package/dist/nodeDefExpressionEvaluator/taxonProvider.d.ts +7 -7
  621. package/dist/nodeDefExpressionEvaluator/taxonProvider.js.map +1 -1
  622. package/dist/nodeDefExpressionEvaluator/validator.d.ts +2 -2
  623. package/dist/nodeDefExpressionEvaluator/validator.js.map +1 -1
  624. package/dist/record/_records/nodeDefSelfReferences.d.ts +2 -2
  625. package/dist/record/_records/nodeDefSelfReferences.js.map +1 -1
  626. package/dist/record/_records/recordCompletion.d.ts +6 -6
  627. package/dist/record/_records/recordCompletion.js +7 -7
  628. package/dist/record/_records/recordCompletion.js.map +1 -1
  629. package/dist/record/_records/recordGetters.d.ts +21 -21
  630. package/dist/record/_records/recordGetters.js +9 -9
  631. package/dist/record/_records/recordGetters.js.map +1 -1
  632. package/dist/record/_records/recordNodesIndexUpdater.d.ts +4 -4
  633. package/dist/record/_records/recordNodesIndexUpdater.js +2 -2
  634. package/dist/record/_records/recordNodesIndexUpdater.js.map +1 -1
  635. package/dist/record/_records/recordPagesValidation.d.ts +12 -12
  636. package/dist/record/_records/recordPagesValidation.js +2 -2
  637. package/dist/record/_records/recordPagesValidation.js.map +1 -1
  638. package/dist/record/_records/recordUpdateOptions.d.ts +3 -3
  639. package/dist/record/_records/recordUpdateOptions.js.map +1 -1
  640. package/dist/record/_records/recordUpdater.d.ts +3 -3
  641. package/dist/record/_records/recordUpdater.js.map +1 -1
  642. package/dist/record/_records/recordUtils.d.ts +11 -11
  643. package/dist/record/_records/recordUtils.js +1 -1
  644. package/dist/record/_records/recordUtils.js.map +1 -1
  645. package/dist/record/factory.d.ts +6 -6
  646. package/dist/record/factory.js.map +1 -1
  647. package/dist/record/index.d.ts +8 -8
  648. package/dist/record/index.js +2 -2
  649. package/dist/record/index.js.map +1 -1
  650. package/dist/record/nodePointers.d.ts +4 -4
  651. package/dist/record/nodePointers.js +2 -2
  652. package/dist/record/nodePointers.js.map +1 -1
  653. package/dist/record/record.d.ts +5 -10
  654. package/dist/record/record.js.map +1 -1
  655. package/dist/record/recordCloner.d.ts +2 -2
  656. package/dist/record/recordCloner.js +6 -6
  657. package/dist/record/recordCloner.js.map +1 -1
  658. package/dist/record/recordExpressionEvaluator/context.d.ts +12 -12
  659. package/dist/record/recordExpressionEvaluator/context.js.map +1 -1
  660. package/dist/record/recordExpressionEvaluator/functions.d.ts +3 -3
  661. package/dist/record/recordExpressionEvaluator/functions.js +4 -4
  662. package/dist/record/recordExpressionEvaluator/functions.js.map +1 -1
  663. package/dist/record/recordExpressionEvaluator/index.d.ts +1 -1
  664. package/dist/record/recordExpressionEvaluator/index.js.map +1 -1
  665. package/dist/record/recordExpressionEvaluator/node/identifier/identifier.d.ts +4 -4
  666. package/dist/record/recordExpressionEvaluator/node/identifier/identifier.js +2 -2
  667. package/dist/record/recordExpressionEvaluator/node/identifier/identifier.js.map +1 -1
  668. package/dist/record/recordExpressionEvaluator/node/identifier/nodesFinder.d.ts +4 -4
  669. package/dist/record/recordExpressionEvaluator/node/identifier/nodesFinder.js +1 -1
  670. package/dist/record/recordExpressionEvaluator/node/identifier/nodesFinder.js.map +1 -1
  671. package/dist/record/recordExpressionEvaluator/node/thisEvaluator.d.ts +2 -2
  672. package/dist/record/recordExpressionEvaluator/node/thisEvaluator.js.map +1 -1
  673. package/dist/record/recordExpressionEvaluator/nodeValueExtractor.d.ts +4 -4
  674. package/dist/record/recordExpressionEvaluator/nodeValueExtractor.js +8 -8
  675. package/dist/record/recordExpressionEvaluator/nodeValueExtractor.js.map +1 -1
  676. package/dist/record/recordExpressionEvaluator/recordExpressionEvaluator.d.ts +10 -10
  677. package/dist/record/recordExpressionEvaluator/recordExpressionEvaluator.js.map +1 -1
  678. package/dist/record/recordFixer.d.ts +3 -3
  679. package/dist/record/recordFixer.js +5 -5
  680. package/dist/record/recordFixer.js.map +1 -1
  681. package/dist/record/recordNodesUpdater/index.d.ts +2 -11
  682. package/dist/record/recordNodesUpdater/index.js +0 -9
  683. package/dist/record/recordNodesUpdater/index.js.map +1 -1
  684. package/dist/record/recordNodesUpdater/recordEnumeratingItemsExpressionEvaluator.d.ts +6 -6
  685. package/dist/record/recordNodesUpdater/recordEnumeratingItemsExpressionEvaluator.js.map +1 -1
  686. package/dist/record/recordNodesUpdater/recordExpressionEvaluationContext.d.ts +12 -12
  687. package/dist/record/recordNodesUpdater/recordExpressionEvaluationContext.js.map +1 -1
  688. package/dist/record/recordNodesUpdater/recordExpressionValueConverter.d.ts +8 -8
  689. package/dist/record/recordNodesUpdater/recordExpressionValueConverter.js.map +1 -1
  690. package/dist/record/recordNodesUpdater/recordNodeDependentsApplicableUpdater.js +7 -7
  691. package/dist/record/recordNodesUpdater/recordNodeDependentsApplicableUpdater.js.map +1 -1
  692. package/dist/record/recordNodesUpdater/recordNodeDependentsBooleanUpdater.d.ts +7 -7
  693. package/dist/record/recordNodesUpdater/recordNodeDependentsBooleanUpdater.js.map +1 -1
  694. package/dist/record/recordNodesUpdater/recordNodeDependentsCodeAttributesUpdater.js +4 -4
  695. package/dist/record/recordNodesUpdater/recordNodeDependentsCodeAttributesUpdater.js.map +1 -1
  696. package/dist/record/recordNodesUpdater/recordNodeDependentsCountUpdater.js +6 -2
  697. package/dist/record/recordNodesUpdater/recordNodeDependentsCountUpdater.js.map +1 -1
  698. package/dist/record/recordNodesUpdater/recordNodeDependentsDefaultValuesUpdater.js +9 -9
  699. package/dist/record/recordNodesUpdater/recordNodeDependentsDefaultValuesUpdater.js.map +1 -1
  700. package/dist/record/recordNodesUpdater/recordNodeDependentsEditableUpdater.js +2 -2
  701. package/dist/record/recordNodesUpdater/recordNodeDependentsEditableUpdater.js.map +1 -1
  702. package/dist/record/recordNodesUpdater/recordNodeDependentsEnumeratedEntitiesUpdater.d.ts +4 -4
  703. package/dist/record/recordNodesUpdater/recordNodeDependentsEnumeratedEntitiesUpdater.js +2 -2
  704. package/dist/record/recordNodesUpdater/recordNodeDependentsEnumeratedEntitiesUpdater.js.map +1 -1
  705. package/dist/record/recordNodesUpdater/recordNodeDependentsEnumeratingItemsUpdater.d.ts +2 -2
  706. package/dist/record/recordNodesUpdater/recordNodeDependentsEnumeratingItemsUpdater.js +4 -3
  707. package/dist/record/recordNodesUpdater/recordNodeDependentsEnumeratingItemsUpdater.js.map +1 -1
  708. package/dist/record/recordNodesUpdater/recordNodeDependentsFileNamesEvaluator.js +5 -5
  709. package/dist/record/recordNodesUpdater/recordNodeDependentsFileNamesEvaluator.js.map +1 -1
  710. package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.d.ts +5 -5
  711. package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js +4 -4
  712. package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -1
  713. package/dist/record/recordNodesUpdater/recordNodeDependentsUpdateParams.d.ts +2 -2
  714. package/dist/record/recordNodesUpdater/recordNodeDependentsUpdateParams.js.map +1 -1
  715. package/dist/record/recordNodesUpdater/recordNodeDependentsVisibleUpdater.js +2 -2
  716. package/dist/record/recordNodesUpdater/recordNodeDependentsVisibleUpdater.js.map +1 -1
  717. package/dist/record/recordNodesUpdater/recordNodesCreator.d.ts +20 -20
  718. package/dist/record/recordNodesUpdater/recordNodesCreator.js +4 -4
  719. package/dist/record/recordNodesUpdater/recordNodesCreator.js.map +1 -1
  720. package/dist/record/recordNodesUpdater/recordNodesDeleter.d.ts +3 -3
  721. package/dist/record/recordNodesUpdater/recordNodesDeleter.js.map +1 -1
  722. package/dist/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.d.ts +9 -9
  723. package/dist/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.js.map +1 -1
  724. package/dist/record/recordNodesUpdater/recordNodesUpdater.d.ts +4 -4
  725. package/dist/record/recordNodesUpdater/recordNodesUpdater.js.map +1 -1
  726. package/dist/record/recordNodesUpdater/recordUpdateResult.d.ts +11 -11
  727. package/dist/record/recordNodesUpdater/recordUpdateResult.js.map +1 -1
  728. package/dist/record/recordPrettyPrinter.d.ts +6 -6
  729. package/dist/record/recordPrettyPrinter.js +7 -7
  730. package/dist/record/recordPrettyPrinter.js.map +1 -1
  731. package/dist/record/recordStep.d.ts +4 -4
  732. package/dist/record/recordStep.js.map +1 -1
  733. package/dist/record/recordUpdater.d.ts +7 -7
  734. package/dist/record/recordUpdater.js +1 -1
  735. package/dist/record/recordUpdater.js.map +1 -1
  736. package/dist/record/recordValidations.d.ts +3 -3
  737. package/dist/record/recordValidations.js.map +1 -1
  738. package/dist/record/recordValidator/attributeKeyValidator.d.ts +9 -9
  739. package/dist/record/recordValidator/attributeKeyValidator.js +4 -3
  740. package/dist/record/recordValidator/attributeKeyValidator.js.map +1 -1
  741. package/dist/record/recordValidator/attributeTypeValidator.d.ts +10 -10
  742. package/dist/record/recordValidator/attributeTypeValidator.js +11 -11
  743. package/dist/record/recordValidator/attributeTypeValidator.js.map +1 -1
  744. package/dist/record/recordValidator/attributeUniqueValidator.d.ts +6 -6
  745. package/dist/record/recordValidator/attributeUniqueValidator.js +2 -2
  746. package/dist/record/recordValidator/attributeUniqueValidator.js.map +1 -1
  747. package/dist/record/recordValidator/attributeValidator.d.ts +8 -8
  748. package/dist/record/recordValidator/attributeValidator.js +6 -6
  749. package/dist/record/recordValidator/attributeValidator.js.map +1 -1
  750. package/dist/record/recordValidator/countValidator.d.ts +10 -10
  751. package/dist/record/recordValidator/countValidator.js +4 -4
  752. package/dist/record/recordValidator/countValidator.js.map +1 -1
  753. package/dist/record/recordValidator/index.d.ts +1 -1
  754. package/dist/record/recordValidator/index.js.map +1 -1
  755. package/dist/record/recordValidator/recordValidator.d.ts +5 -5
  756. package/dist/record/recordValidator/recordValidator.js.map +1 -1
  757. package/dist/record/records.d.ts +1 -5
  758. package/dist/record/records.js +0 -4
  759. package/dist/record/records.js.map +1 -1
  760. package/dist/record/service.d.ts +7 -7
  761. package/dist/record/service.js.map +1 -1
  762. package/dist/registry/index.d.ts +1 -1
  763. package/dist/registry/index.js.map +1 -1
  764. package/dist/registry/serviceRegistry.d.ts +2 -2
  765. package/dist/registry/serviceRegistry.js.map +1 -1
  766. package/dist/registry/serviceTypeMap.d.ts +22 -22
  767. package/dist/registry/serviceTypeMap.js.map +1 -1
  768. package/dist/srs/factory.d.ts +3 -3
  769. package/dist/srs/factory.js.map +1 -1
  770. package/dist/srs/index.d.ts +1 -1
  771. package/dist/srs/index.js.map +1 -1
  772. package/dist/srs/srs.d.ts +5 -5
  773. package/dist/srs/srs.js.map +1 -1
  774. package/dist/survey/factory.d.ts +7 -7
  775. package/dist/survey/factory.js.map +1 -1
  776. package/dist/survey/index.d.ts +5 -5
  777. package/dist/survey/index.js.map +1 -1
  778. package/dist/survey/nodeDefsFixer.d.ts +6 -6
  779. package/dist/survey/nodeDefsFixer.js.map +1 -1
  780. package/dist/survey/refData/factory.d.ts +7 -7
  781. package/dist/survey/refData/factory.js.map +1 -1
  782. package/dist/survey/refData/index.d.ts +1 -1
  783. package/dist/survey/refData/index.js.map +1 -1
  784. package/dist/survey/refData/refData.d.ts +5 -5
  785. package/dist/survey/refData/refData.js.map +1 -1
  786. package/dist/survey/service.d.ts +18 -18
  787. package/dist/survey/service.js.map +1 -1
  788. package/dist/survey/survey.d.ts +42 -42
  789. package/dist/survey/survey.js.map +1 -1
  790. package/dist/survey/surveyDocImageFactory.d.ts +5 -5
  791. package/dist/survey/surveyDocImageFactory.js.map +1 -1
  792. package/dist/survey/surveyDocImages.d.ts +7 -7
  793. package/dist/survey/surveyDocImages.js.map +1 -1
  794. package/dist/survey/surveyFileFactory.d.ts +4 -4
  795. package/dist/survey/surveyFileFactory.js.map +1 -1
  796. package/dist/survey/surveys/_nodeDefs/nodeDefsIndex.d.ts +7 -7
  797. package/dist/survey/surveys/_nodeDefs/nodeDefsIndex.js.map +1 -1
  798. package/dist/survey/surveys/_nodeDefs/nodeDefsReader.d.ts +4 -4
  799. package/dist/survey/surveys/_nodeDefs/nodeDefsReader.js.map +1 -1
  800. package/dist/survey/surveys/dependencies.d.ts +12 -12
  801. package/dist/survey/surveys/dependencies.js.map +1 -1
  802. package/dist/survey/surveys/index.d.ts +3 -3
  803. package/dist/survey/surveys/nodeDefs.d.ts +80 -80
  804. package/dist/survey/surveys/nodeDefs.js.map +1 -1
  805. package/dist/survey/surveys/refsData.d.ts +23 -23
  806. package/dist/survey/surveys/refsData.js.map +1 -1
  807. package/dist/survey/surveys/surveyGettersSecurity.d.ts +10 -10
  808. package/dist/survey/surveys/surveyGettersSecurity.js.map +1 -1
  809. package/dist/survey/surveys/surveysGetters.d.ts +33 -33
  810. package/dist/survey/surveys/surveysGetters.js.map +1 -1
  811. package/dist/survey/surveys/surveysUtils.d.ts +7 -7
  812. package/dist/survey/surveys/surveysUtils.js.map +1 -1
  813. package/dist/taxonomy/factory.d.ts +13 -13
  814. package/dist/taxonomy/factory.js.map +1 -1
  815. package/dist/taxonomy/index.d.ts +6 -6
  816. package/dist/taxonomy/index.js.map +1 -1
  817. package/dist/taxonomy/service.d.ts +11 -11
  818. package/dist/taxonomy/service.js.map +1 -1
  819. package/dist/taxonomy/taxa.d.ts +7 -7
  820. package/dist/taxonomy/taxa.js.map +1 -1
  821. package/dist/taxonomy/taxon.d.ts +6 -6
  822. package/dist/taxonomy/taxon.js.map +1 -1
  823. package/dist/taxonomy/taxonGenerator.d.ts +4 -4
  824. package/dist/taxonomy/taxonGenerator.js.map +1 -1
  825. package/dist/taxonomy/taxonService.d.ts +10 -10
  826. package/dist/taxonomy/taxonService.js.map +1 -1
  827. package/dist/taxonomy/taxonVernacularName.d.ts +2 -2
  828. package/dist/taxonomy/taxonVernacularName.js.map +1 -1
  829. package/dist/taxonomy/taxonomies.d.ts +5 -5
  830. package/dist/taxonomy/taxonomies.js.map +1 -1
  831. package/dist/taxonomy/taxonomy.d.ts +6 -6
  832. package/dist/taxonomy/taxonomy.js.map +1 -1
  833. package/dist/tests/builder/recordBuilder/attributeBuilder.d.ts +2 -2
  834. package/dist/tests/builder/recordBuilder/attributeBuilder.js +1 -1
  835. package/dist/tests/builder/recordBuilder/attributeBuilder.js.map +1 -1
  836. package/dist/tests/builder/recordBuilder/entityBuilder.d.ts +2 -2
  837. package/dist/tests/builder/recordBuilder/entityBuilder.js +1 -1
  838. package/dist/tests/builder/recordBuilder/entityBuilder.js.map +1 -1
  839. package/dist/tests/builder/recordBuilder/nodeBuilder.d.ts +5 -5
  840. package/dist/tests/builder/recordBuilder/nodeBuilder.js.map +1 -1
  841. package/dist/tests/builder/recordBuilder/recordBuilder.d.ts +3 -3
  842. package/dist/tests/builder/recordBuilder/recordBuilder.js.map +1 -1
  843. package/dist/tests/builder/surveyBuilder/categoryBuilder.d.ts +5 -5
  844. package/dist/tests/builder/surveyBuilder/categoryBuilder.js.map +1 -1
  845. package/dist/tests/builder/surveyBuilder/categoryItemBuilder.d.ts +2 -2
  846. package/dist/tests/builder/surveyBuilder/categoryItemBuilder.js.map +1 -1
  847. package/dist/tests/builder/surveyBuilder/nodeDefAttributeBuilder.d.ts +5 -5
  848. package/dist/tests/builder/surveyBuilder/nodeDefAttributeBuilder.js.map +1 -1
  849. package/dist/tests/builder/surveyBuilder/nodeDefBuilder.d.ts +15 -15
  850. package/dist/tests/builder/surveyBuilder/nodeDefBuilder.js.map +1 -1
  851. package/dist/tests/builder/surveyBuilder/nodeDefCodeBuilder.d.ts +5 -5
  852. package/dist/tests/builder/surveyBuilder/nodeDefCodeBuilder.js.map +1 -1
  853. package/dist/tests/builder/surveyBuilder/nodeDefEntityBuilder.d.ts +5 -5
  854. package/dist/tests/builder/surveyBuilder/nodeDefEntityBuilder.js.map +1 -1
  855. package/dist/tests/builder/surveyBuilder/nodeDefTaxonBuilder.d.ts +5 -5
  856. package/dist/tests/builder/surveyBuilder/nodeDefTaxonBuilder.js.map +1 -1
  857. package/dist/tests/builder/surveyBuilder/surveyBuilder.d.ts +4 -4
  858. package/dist/tests/builder/surveyBuilder/surveyBuilder.js.map +1 -1
  859. package/dist/tests/builder/surveyBuilder/taxonBuilder.d.ts +2 -2
  860. package/dist/tests/builder/surveyBuilder/taxonBuilder.js.map +1 -1
  861. package/dist/tests/builder/surveyBuilder/taxonomyBuilder.d.ts +5 -5
  862. package/dist/tests/builder/surveyBuilder/taxonomyBuilder.js.map +1 -1
  863. package/dist/utils/fileProcessor.d.ts +2 -2
  864. package/dist/utils/fileProcessor.js.map +1 -1
  865. package/dist/utils/index.d.ts +3 -3
  866. package/dist/utils/index.js.map +1 -1
  867. package/dist/utils/mutationOptions.d.ts +1 -5
  868. package/dist/utils/mutationOptions.js +0 -6
  869. package/dist/utils/mutationOptions.js.map +1 -1
  870. package/dist/utils/versions.d.ts +2 -2
  871. package/dist/utils/versions.js.map +1 -1
  872. package/dist/validation/factory.d.ts +10 -10
  873. package/dist/validation/factory.js.map +1 -1
  874. package/dist/validation/fieldValidator.d.ts +2 -2
  875. package/dist/validation/fieldValidator.js.map +1 -1
  876. package/dist/validation/fieldValidators/email.d.ts +2 -2
  877. package/dist/validation/fieldValidators/email.js.map +1 -1
  878. package/dist/validation/fieldValidators/name.d.ts +2 -2
  879. package/dist/validation/fieldValidators/name.js.map +1 -1
  880. package/dist/validation/fieldValidators/notKeyword.d.ts +2 -2
  881. package/dist/validation/fieldValidators/notKeyword.js.map +1 -1
  882. package/dist/validation/fieldValidators/numeric.d.ts +2 -2
  883. package/dist/validation/fieldValidators/numeric.js.map +1 -1
  884. package/dist/validation/fieldValidators/numericPositive.d.ts +2 -2
  885. package/dist/validation/fieldValidators/numericPositive.js.map +1 -1
  886. package/dist/validation/fieldValidators/required.d.ts +2 -2
  887. package/dist/validation/fieldValidators/required.js.map +1 -1
  888. package/dist/validation/index.d.ts +3 -3
  889. package/dist/validation/index.js.map +1 -1
  890. package/dist/validation/validation.d.ts +11 -11
  891. package/dist/validation/validation.js.map +1 -1
  892. package/dist/validation/validationResults.d.ts +9 -9
  893. package/dist/validation/validationResults.js.map +1 -1
  894. package/dist/validation/validations.d.ts +35 -39
  895. package/dist/validation/validations.js +4 -5
  896. package/dist/validation/validations.js.map +1 -1
  897. package/dist/validation/validator.d.ts +4 -4
  898. package/dist/validation/validator.js.map +1 -1
  899. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"recordGetters.js","sourceRoot":"","sources":["../../../../src/record/_records/recordGetters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,cAAc,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAgC,KAAK,EAAY,MAAM,YAAY,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAwD,QAAQ,EAAe,MAAM,eAAe,CAAA;AAC3G,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAe,mBAAmB,EAAoB,MAAM,WAAW,CAAA;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAE/D,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAmB,EAAU,EAAE,wBAAC,MAAM,CAAC,KAAK,mCAAI,YAAY,GAAA,CAAA;AAErF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AED,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAmB,EAAU,EAAE,wBAAC,MAAM,CAAC,IAAI,mCAAI,mBAAmB,GAAA,CAAA;AAE1F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAmB,EAAW,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,sBAAsB,CAAA","sourcesContent":["import { Dictionary, TraverseMethod } from '../../common'\nimport { SystemError, SystemErrorKeys } from '../../error'\nimport { ArenaRecordNode, NodePointer, Nodes, NodesMap } from '../../node'\nimport { NodeValues } from '../../node/nodeValues'\nimport { NodeDef, NodeDefCode, NodeDefCodeProps, NodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { defaultCycle, Surveys } from '../../survey'\nimport { Survey, SurveyDependencyType } from '../../survey/survey'\nimport { Arrays, Queue } from '../../utils'\nimport { ArenaRecord, RECORD_STEP_DEFAULT, RecordNodesIndex } from '../record'\nimport { RecordStepAnalysisCode } from '../recordStep'\nimport { RecordNodesIndexReader } from './recordNodesIndexReader'\nimport { RecordNodesIndexUpdater } from './recordNodesIndexUpdater'\nimport { NodeDefSelfReferences } from './nodeDefSelfReferences'\n\nexport const getCycle = (record: ArenaRecord): string => record.cycle ?? defaultCycle\n\nexport const getNodes = (record: ArenaRecord): Dictionary<ArenaRecordNode> => record.nodes ?? {}\n\nexport const getNodesArray = (record: ArenaRecord): ArenaRecordNode[] => Object.values(getNodes(record))\n\n/**\n * Returns the nodes index of the record or, if missing, a new index built from all the record nodes (not stored in the record).\n * To be used before updating the index: a partial index would be trusted by the getters.\n */\nexport const getNodesIndexOrBuild = (record: ArenaRecord): RecordNodesIndex =>\n record._nodesIndex ?? RecordNodesIndexUpdater.initializeIndex(record)\n\n/**\n * Returns the node with the specified uuid, or undefined if not found.\n * Like the other node getters, it does not throw an error when the node is not found.\n */\nexport const getNodeByUuid =\n (uuid: string) =>\n (record: ArenaRecord): ArenaRecordNode | undefined =>\n record.nodes?.[uuid]\n\nexport const getNodesByUuids =\n (uuids: string[]) =>\n (record: ArenaRecord): ArenaRecordNode[] =>\n uuids.map((uuid: string) => record.nodes?.[uuid]) as ArenaRecordNode[]\n\n/**\n * Returns the root node, or undefined if the record has no nodes.\n */\nexport const getRoot = (record: ArenaRecord): ArenaRecordNode | undefined => {\n const rootUuid = record._nodesIndex ? RecordNodesIndexReader.getNodeRootUuid(record._nodesIndex) : null\n if (rootUuid) {\n return getNodeByUuid(rootUuid)(record)\n }\n return getNodesArray(record).find((node) => !node.parentUuid)\n}\n\nexport const getChildren =\n (parentNode: ArenaRecordNode, childDefUuid?: string) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const childrenUuids = childDefUuid\n ? RecordNodesIndexReader.getNodeUuidsByParentAndChildDef({\n parentNodeUuid: parentNode.uuid,\n childDefUuid,\n })(record._nodesIndex)\n : RecordNodesIndexReader.getNodeUuidsByParent(parentNode.uuid)(record._nodesIndex)\n return getNodesByUuids(childrenUuids)(record)\n }\n return getNodesArray(record).filter(\n (node) => node.parentUuid === parentNode.uuid && (!childDefUuid || node.nodeDefUuid == childDefUuid)\n )\n }\n\n/**\n * Returns the only child of the parent node with the specified node def, or undefined if not found.\n * Throws an error if more than one child is found.\n */\nexport const getChild =\n (parentNode: ArenaRecordNode, childDefUuid: string) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const children = getChildren(parentNode, childDefUuid)(record)\n if (children.length > 1) {\n const errorParams = { childDefUuid, parentNodeUuid: parentNode.uuid, recordUuid: record.uuid }\n throw new SystemError(SystemErrorKeys.record.multipleNodesFound, errorParams)\n }\n return children[0]\n }\n\n// called for every ancestor in the record update loops: keep it a plain lookup\nconst getParentNode = (record: ArenaRecord, node: ArenaRecordNode): ArenaRecordNode | undefined =>\n node.parentUuid ? record.nodes?.[node.parentUuid] : undefined\n\nexport const getParent =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): ArenaRecordNode | undefined =>\n getParentNode(record, node)\n\nexport const getNodesByDefUuid =\n (nodeDefUuid: string) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeUuidsByDef(nodeDefUuid)(record._nodesIndex)\n return getNodesByUuids(nodeUuids)(record)\n }\n return getNodesArray(record).filter((node) => node.nodeDefUuid === nodeDefUuid)\n }\n\nconst isNodeFlagTrue =\n (isChildFlagTrue: (parent: ArenaRecordNode, nodeDefUuid: string) => boolean) =>\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean => {\n let child = node\n let parent = getParentNode(record, child)\n while (parent) {\n if (!isChildFlagTrue(parent, child.nodeDefUuid)) return false\n child = parent\n parent = getParentNode(record, child)\n }\n return true\n }\n\nexport const isNodeApplicable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildApplicable(parent, nodeDefUuid))\nexport const isNodeEditable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildEditable(parent, nodeDefUuid))\nexport const isNodeVisible = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildVisible(parent, nodeDefUuid))\n\n/**\n * Whether a value is required for the node: key or always required attribute, or attribute with a \"required if\"\n * condition met in its parent entity (evaluated condition stored in the parent node meta).\n */\nexport const isNodeRequired =\n (nodeDef: NodeDef<NodeDefType>, node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean => {\n if (NodeDefs.isKey(nodeDef) || NodeDefs.isRequired(nodeDef)) return true\n if (!NodeDefs.isRequiredIfDefined(nodeDef)) return false\n const parent = getParentNode(record, node)\n return !!parent && Nodes.isChildRequired(parent, nodeDef.uuid)\n }\n\nexport const getDependentCodeAttributes =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeCodeDependentUuids(node.uuid)(record._nodesIndex)\n return getNodesByUuids(nodeUuids)(record)\n }\n throw new SystemError(SystemErrorKeys.record.nodesIndexNotInitialized)\n }\n\nexport const getParentCodeAttribute =\n (parentNode: ArenaRecordNode, nodeDef: NodeDefCode) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const parentCodeDefUuid = NodeDefs.getParentCodeDefUuid(nodeDef)\n if (!parentCodeDefUuid) return undefined\n\n const ancestors = getAncestorsAndSelf(parentNode)(record)\n for (const ancestor of ancestors) {\n const children = getChildren(ancestor, parentCodeDefUuid)(record)\n if (children.length === 1) {\n return children[0]\n }\n }\n return undefined\n }\n\n// ancestors\n\n/**\n * Visits the specified node and its ancestors, from the node up to the root: the visit stops when the visitor returns true.\n */\nexport const visitAncestorsAndSelf =\n (node: ArenaRecordNode, visitor: (node: ArenaRecordNode) => boolean | void) =>\n (record: ArenaRecord): void => {\n let currentNode: ArenaRecordNode | undefined = node\n while (currentNode) {\n if (visitor(currentNode)) return\n currentNode = getParentNode(record, currentNode)\n }\n }\n\n/**\n * Returns the first node satisfying the predicate among the specified node and its ancestors (from the node up to the root).\n */\nexport const findAncestor =\n (node: ArenaRecordNode, predicate: (node: ArenaRecordNode) => boolean) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n let result: ArenaRecordNode | undefined = undefined\n visitAncestorsAndSelf(node, (visitedNode) => {\n if (predicate(visitedNode)) {\n result = visitedNode\n return true\n }\n return false\n })(record)\n return result\n }\n\n/**\n * Returns the specified node, if it has the specified node def, or its ancestor with that node def; undefined if not found.\n */\nexport const getAncestor =\n (node: ArenaRecordNode, ancestorDefUuid: string) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n let ancestor: ArenaRecordNode | undefined = node\n while (ancestor && ancestor.nodeDefUuid !== ancestorDefUuid) {\n ancestor = getParentNode(record, ancestor)\n }\n return ancestor\n }\n\n/**\n * Returns the list of ancestors from the given node to the root entity\n */\nexport const getAncestorsAndSelf =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): Array<ArenaRecordNode> => {\n const ancestors: Array<ArenaRecordNode> = []\n let currentNode: ArenaRecordNode | undefined = node\n while (currentNode) {\n ancestors.push(currentNode)\n currentNode = getParentNode(record, currentNode)\n }\n return ancestors\n }\n\n// descendants\n\nexport const getDescendantsOrSelf =\n (node: ArenaRecordNode, nodeDefDescendant: NodeDef<any>) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (nodeDefDescendant.uuid === node.nodeDefUuid) return [node]\n\n const nodeDefDescendantFullHierarchy = [...nodeDefDescendant.meta.h, nodeDefDescendant.uuid]\n\n // 1. get the descendant node defs uuids starting from node nodeDefUuid (not inclusive) down to the specified nodeDefDescendant uuid\n const descendantNodeDefUuids = nodeDefDescendantFullHierarchy.slice(\n nodeDefDescendantFullHierarchy.indexOf(node.nodeDefUuid) + 1\n )\n // 2. for every level in the hierarchy, find the children having the nodeDefUuid equal to the current one\n let currentAncestors = [node]\n let currentDescendants: ArenaRecordNode[] = []\n for (const currentDescendantDefUuid of descendantNodeDefUuids) {\n for (const currentAncestor of currentAncestors) {\n for (const child of getChildren(currentAncestor, currentDescendantDefUuid)(record)) {\n currentDescendants.push(child)\n }\n }\n currentAncestors = currentDescendants\n currentDescendants = []\n }\n return currentAncestors // currentAncestors is equal to the currentDescendants of the last level\n }\n\n/**\n * Returns the first descendant (or the node itself) with the specified node def, or undefined if not found.\n */\nexport const getDescendant =\n (node: ArenaRecordNode, nodeDefDescendant: NodeDef<any>) =>\n (record: ArenaRecord): ArenaRecordNode | undefined =>\n getDescendantsOrSelf(node, nodeDefDescendant)(record)[0]\n\nexport const isDescendantOf = (node: ArenaRecordNode, ancestor: ArenaRecordNode): boolean =>\n Nodes.getHierarchy(node).includes(ancestor.uuid)\n\nexport const visitDescendantsAndSelf =\n (\n node: ArenaRecordNode,\n visitor: (node: ArenaRecordNode) => boolean | void,\n traverseMethod: TraverseMethod = TraverseMethod.bfs\n ) =>\n (record: ArenaRecord): void => {\n if (traverseMethod === TraverseMethod.bfs) {\n const queue = new Queue<ArenaRecordNode>()\n\n queue.enqueue(node)\n\n while (!queue.isEmpty()) {\n const visitedNode = queue.dequeue()!\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren(visitedNode)(record)\n queue.enqueueItems(children)\n }\n } else {\n const stack = []\n\n stack.push(node)\n\n while (stack.length > 0) {\n const visitedNode = stack.pop() as ArenaRecordNode\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren(visitedNode)(record)\n\n // add children to stack in reverse order\n for (let index = children.length - 1; index >= 0; index--) {\n const child = children[index]\n stack.push(child)\n }\n }\n }\n }\n\nexport const findDescendantOrSelf =\n (node: ArenaRecordNode, predicate: (node: ArenaRecordNode) => boolean) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n let found = undefined\n\n visitDescendantsAndSelf(node, (currentNode) => {\n if (predicate(currentNode)) {\n found = currentNode\n return true\n }\n return false\n })(record)\n return found\n }\n\nconst getClosestAncestorNode =\n (\n node: ArenaRecordNode,\n nodeDef: NodeDef<NodeDefType, NodeDefProps>,\n dependentDef: NodeDef<NodeDefType, NodeDefProps>,\n dependencyType: SurveyDependencyType\n ) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n // 1a if dependent def is the same as node def, potentially all nodes with\n // nodeDefUuid === dependentDef.uuid in record could be dependent of nodeDef;\n // consider the root node as the closest ancestor node,\n // unless the node def references itself only among the children of its parent entity (e.g. validation \"dbh > 0\")\n if (nodeDef.uuid === dependentDef.uuid) {\n return NodeDefSelfReferences.isSelfReferenceLocal({ nodeDef, dependencyType })\n ? getParent(node)(record)\n : getRoot(record)\n }\n // 1 find common ancestor def\n const commonAncestorDefUuid = Arrays.last(Arrays.intersection(nodeDef.meta.h, dependentDef.meta.h))\n if (!commonAncestorDefUuid) return undefined\n\n // 2 get ancestor node with common parent def\n return getAncestor(node, commonAncestorDefUuid)(record)\n }\n\ntype KeyDefs = NodeDef<NodeDefType, NodeDefProps>[]\n\n/**\n * Returns the key nodes of the entity, indexed by key def uuid; keyDefs, when specified, are used instead of the\n * entity def keys in the cycle.\n */\nexport const getEntityKeyNodesByDefUuid =\n (survey: Survey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): NodesMap => {\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: entity.nodeDefUuid })\n const nodeDefKeys = keyDefs ?? Surveys.getNodeDefKeys({ survey, cycle, nodeDef })\n return nodeDefKeys.reduce((acc: NodesMap, nodeDefKey) => {\n const nodeKey = getDescendant(entity, nodeDefKey)(record)\n // missing key nodes are kept as undefined entries\n acc[nodeDefKey.uuid] = nodeKey as ArenaRecordNode\n return acc\n }, {})\n }\n\nexport const getEntityKeyNodes =\n (survey: Survey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): ArenaRecordNode[] =>\n Object.values(getEntityKeyNodesByDefUuid(survey, entity, cycle, keyDefs)(record))\n\nexport const getEntityKeyValuesByDefUuid =\n (survey: Survey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): Dictionary<any> => {\n const keyNodesByDefUuid = getEntityKeyNodesByDefUuid(survey, entity, cycle, keyDefs)(record)\n return Object.entries(keyNodesByDefUuid).reduce((acc: Dictionary<any>, [uuid, keyNode]) => {\n acc[uuid] = keyNode?.value\n return acc\n }, {})\n }\n\nexport const getEntityKeyValues =\n (survey: Survey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): any[] =>\n Object.values(getEntityKeyValuesByDefUuid(survey, entity, cycle, keyDefs)(record))\n\nexport const getEntitySiblings =\n (entity: ArenaRecordNode, includeSelf = false) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n const parentEntity = getParent(entity)(record)\n if (!parentEntity) return []\n const siblingEntities = getChildren(parentEntity, entity.nodeDefUuid)(record)\n return includeSelf ? siblingEntities : siblingEntities.filter((sibling) => !Nodes.areEqual(sibling, entity))\n }\n\nexport const getAttributeSiblings =\n (node: ArenaRecordNode, nodeDef: NodeDef<NodeDefType, NodeDefProps>) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n const parentEntity = getParent(node)(record)\n if (!parentEntity) return []\n const siblingParentEntities = getEntitySiblings(parentEntity)(record)\n return siblingParentEntities.reduce((siblingsAcc: ArenaRecordNode[], siblingEntity) => {\n for (const sibling of getChildren(siblingEntity, nodeDef.uuid)(record)) {\n siblingsAcc.push(sibling)\n }\n return siblingsAcc\n }, [])\n }\n\nexport const getNodeIndex = (node: ArenaRecordNode) => (record: ArenaRecord) => {\n const parentEntity = getParent(node)(record)\n if (!parentEntity) return 0 // root entity\n const siblings = getChildren(parentEntity, node.nodeDefUuid)(record)\n // compared by uuid: the specified node can be a copy of the one in the record (e.g. an updated version of it)\n return siblings.findIndex((sibling) => sibling.uuid === node.uuid)\n}\n\nexport const findEntityByKeyValues =\n (\n survey: Survey,\n cycle: string,\n parentEntity: ArenaRecordNode,\n entityDefUuid: string,\n keyValuesByDefUuid: Dictionary<any>\n ) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const entityDef = Surveys.getNodeDefByUuid({ survey, uuid: entityDefUuid })\n const siblingEntities = getChildren(parentEntity, entityDefUuid)(record)\n if (NodeDefs.isSingle(entityDef)) {\n return siblingEntities[0]\n }\n const keyDefs = Surveys.getNodeDefKeys({ survey, cycle, nodeDef: entityDef })\n\n return siblingEntities.find((siblingEntity) => {\n const siblingEntityKeyValuesByDefUuid = getEntityKeyValuesByDefUuid(\n survey,\n siblingEntity,\n undefined,\n keyDefs\n )(record)\n return keyDefs.every((keyDef) => {\n const keyValue = siblingEntityKeyValuesByDefUuid[keyDef.uuid]\n const keyValueSearch = keyValuesByDefUuid[keyDef.uuid]\n return NodeValues.isValueEqual({\n survey,\n nodeDef: keyDef,\n value: keyValue,\n valueSearch: keyValueSearch,\n })\n })\n })\n }\n\nexport const findEntityWithSameKeysInAnotherRecord =\n (survey: Survey, cycle: string, entityUuid: string, recordOther: ArenaRecord) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const entity = getNodeByUuid(entityUuid)(record)\n if (!entity) return undefined\n\n let otherRecordCurrentParentEntity = getRoot(recordOther)\n if (!otherRecordCurrentParentEntity) return undefined\n\n const entityAncestorsAndSelf = getAncestorsAndSelf(entity)(record)\n const ancestorDefUuidsAndKeys = entityAncestorsAndSelf.map((ancestor) => ({\n entityDefUuid: ancestor.nodeDefUuid,\n keyValuesByDefUuid: getEntityKeyValuesByDefUuid(survey, ancestor)(record),\n }))\n\n const ancestorDefUuidsAndKeysToVisit = [...ancestorDefUuidsAndKeys].reverse()\n\n for (let index = 1; otherRecordCurrentParentEntity && index < ancestorDefUuidsAndKeysToVisit.length; index++) {\n const { entityDefUuid, keyValuesByDefUuid } = ancestorDefUuidsAndKeysToVisit[index]\n otherRecordCurrentParentEntity = findEntityByKeyValues(\n survey,\n cycle,\n otherRecordCurrentParentEntity,\n entityDefUuid,\n keyValuesByDefUuid\n )(recordOther)\n }\n return otherRecordCurrentParentEntity\n }\n\nexport const getDependentNodePointers =\n (\n survey: Survey,\n node: ArenaRecordNode,\n dependencyType: SurveyDependencyType,\n includeSelf = false,\n filterFn: ((nodePointer: NodePointer) => boolean) | null = null\n ) =>\n (record: ArenaRecord): NodePointer[] => {\n const nodeDefUuid = node.nodeDefUuid\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: nodeDefUuid })\n const dependentDefs = Surveys.getNodeDefDependents({ survey, nodeDefUuid, dependencyType })\n const nodePointers: Array<NodePointer> = []\n\n const addToNodePointers = (nodePointer: NodePointer): void => {\n if (filterFn === null || filterFn(nodePointer)) {\n nodePointers.push(nodePointer)\n }\n }\n\n for (const dependentDef of dependentDefs) {\n // 1 find common ancestor node\n const commonAncestorNode = getClosestAncestorNode(node, nodeDef, dependentDef, dependencyType)(record)\n if (!commonAncestorNode) continue\n\n const nodeDefDependentParent = Surveys.getNodeDefParent({ survey, nodeDef: dependentDef })\n if (!nodeDefDependentParent) throw new SystemError(SystemErrorKeys.record.dependencyOnRootFound)\n\n // 2 find descendant nodes of common parent node with nodeDefUuid = dependentDef uuid\n const dependentContextNodes = getDescendantsOrSelf(commonAncestorNode, nodeDefDependentParent)(record)\n\n for (const dependentContextNode of dependentContextNodes) {\n addToNodePointers({\n nodeCtx: dependentContextNode,\n nodeDef: dependentDef,\n })\n }\n }\n if (includeSelf) {\n const parentNode = getParent(node)(record)\n if (parentNode) {\n addToNodePointers({\n nodeCtx: parentNode,\n nodeDef,\n })\n }\n }\n\n return nodePointers\n }\n\n/**\n * Returns the code attributes the specified code attribute depends on, from the top level one to the parent one.\n */\nexport const getAncestorCodeAttributes =\n (survey: Survey, parentNode: ArenaRecordNode, nodeDef: NodeDefCode) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n const ancestorCodeAttributes = []\n let currentParentCodeAttribute = getParentCodeAttribute(parentNode, nodeDef)(record)\n while (currentParentCodeAttribute) {\n ancestorCodeAttributes.unshift(currentParentCodeAttribute)\n const ancestorCodeDef = Surveys.getNodeDefByUuid({\n survey,\n uuid: currentParentCodeAttribute.nodeDefUuid,\n }) as NodeDefCode\n currentParentCodeAttribute = getParentCodeAttribute(parentNode, ancestorCodeDef)(record)\n }\n return ancestorCodeAttributes\n }\n\nexport const getAncestorCodePath =\n (survey: Survey, parentNode: ArenaRecordNode, nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>) =>\n (record: ArenaRecord): string[] =>\n getAncestorCodeAttributes(\n survey,\n parentNode,\n nodeDef\n )(record).map((codeAttribute) => {\n const codeItemUuid = NodeValues.getItemUuid(codeAttribute)\n if (!codeItemUuid) return ''\n // items of big categories are not in the survey ref data: they can be in the node ref data\n const item =\n codeAttribute.refData?.categoryItem ?? Surveys.getCategoryItemByUuid({ survey, itemUuid: codeItemUuid })\n return item?.props.code ?? ''\n })\n\nexport const getCategoryItemUuid =\n (survey: Survey, nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>, parentNode: ArenaRecordNode, code: string) =>\n (record: ArenaRecord): string | undefined => {\n const categoryUuid = nodeDef.props.categoryUuid\n\n const codePaths = [...getAncestorCodePath(survey, parentNode, nodeDef)(record), code]\n\n const item = Surveys.getCategoryItemByCodePaths({ survey, categoryUuid, codePaths })\n\n return item?.uuid\n }\n\nexport const isNodeFilledByUser =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean =>\n !!findDescendantOrSelf(node, (visitedNode) => Nodes.hasUserInputValue(visitedNode))(record)\n\nexport const isNodeEmpty =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean =>\n !isNodeFilledByUser(node)(record)\n\nexport const isEmpty = (record: ArenaRecord): boolean => {\n const rootNode = getRoot(record)\n return rootNode ? isNodeEmpty(rootNode)(record) : true\n}\n\nexport const getStep = (record: ArenaRecord): string => record.step ?? RECORD_STEP_DEFAULT\n\nexport const isInAnalysisStep = (record: ArenaRecord): boolean => getStep(record) === RecordStepAnalysisCode\n"]}
1
+ {"version":3,"file":"recordGetters.js","sourceRoot":"","sources":["../../../../src/record/_records/recordGetters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,cAAc,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAA2C,WAAW,EAAuB,MAAM,YAAY,CAAA;AACtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAKL,QAAQ,GAET,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAe,mBAAmB,EAAoB,MAAM,WAAW,CAAA;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CA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E;IACtD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAChC,OAAO,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AACxD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAmB,EAAU,EAAE,wBAAC,MAAM,CAAC,IAAI,mCAAI,mBAAmB,GAAA,CAAA;AAE1F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAmB,EAAW,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,sBAAsB,CAAA","sourcesContent":["import { ArenaDictionary, TraverseMethod } from '../../common'\nimport { SystemError, SystemErrorKeys } from '../../error'\nimport { ArenaRecordNode, ArenaRecordNodePointer, RecordNodes, ArenaRecordNodesMap } from '../../node'\nimport { RecordNodeValues } from '../../node/nodeValues'\nimport {\n ArenaNodeDef,\n ArenaNodeDefCode,\n ArenaNodeDefCodeProps,\n ArenaNodeDefProps,\n NodeDefs,\n NodeDefType,\n} from '../../nodeDef'\nimport { defaultCycle, Surveys } from '../../survey'\nimport { ArenaSurvey, SurveyDependencyType } from '../../survey/survey'\nimport { Arrays, Queue } from '../../utils'\nimport { ArenaRecord, RECORD_STEP_DEFAULT, RecordNodesIndex } from '../record'\nimport { RecordStepAnalysisCode } from '../recordStep'\nimport { RecordNodesIndexReader } from './recordNodesIndexReader'\nimport { RecordNodesIndexUpdater } from './recordNodesIndexUpdater'\nimport { NodeDefSelfReferences } from './nodeDefSelfReferences'\n\nexport const getCycle = (record: ArenaRecord): string => record.cycle ?? defaultCycle\n\nexport const getNodes = (record: ArenaRecord): ArenaDictionary<ArenaRecordNode> => record.nodes ?? {}\n\nexport const getNodesArray = (record: ArenaRecord): ArenaRecordNode[] => Object.values(getNodes(record))\n\n/**\n * Returns the nodes index of the record or, if missing, a new index built from all the record nodes (not stored in the record).\n * To be used before updating the index: a partial index would be trusted by the getters.\n */\nexport const getNodesIndexOrBuild = (record: ArenaRecord): RecordNodesIndex =>\n record._nodesIndex ?? RecordNodesIndexUpdater.initializeIndex(record)\n\n/**\n * Returns the node with the specified uuid, or undefined if not found.\n * Like the other node getters, it does not throw an error when the node is not found.\n */\nexport const getNodeByUuid =\n (uuid: string) =>\n (record: ArenaRecord): ArenaRecordNode | undefined =>\n record.nodes?.[uuid]\n\nexport const getNodesByUuids =\n (uuids: string[]) =>\n (record: ArenaRecord): ArenaRecordNode[] =>\n uuids.map((uuid: string) => record.nodes?.[uuid]) as ArenaRecordNode[]\n\n/**\n * Returns the root node, or undefined if the record has no nodes.\n */\nexport const getRoot = (record: ArenaRecord): ArenaRecordNode | undefined => {\n const rootUuid = record._nodesIndex ? RecordNodesIndexReader.getNodeRootUuid(record._nodesIndex) : null\n if (rootUuid) {\n return getNodeByUuid(rootUuid)(record)\n }\n return getNodesArray(record).find((node) => !node.parentUuid)\n}\n\nexport const getChildren =\n (parentNode: ArenaRecordNode, childDefUuid?: string) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const childrenUuids = childDefUuid\n ? RecordNodesIndexReader.getNodeUuidsByParentAndChildDef({\n parentNodeUuid: parentNode.uuid,\n childDefUuid,\n })(record._nodesIndex)\n : RecordNodesIndexReader.getNodeUuidsByParent(parentNode.uuid)(record._nodesIndex)\n return getNodesByUuids(childrenUuids)(record)\n }\n return getNodesArray(record).filter(\n (node) => node.parentUuid === parentNode.uuid && (!childDefUuid || node.nodeDefUuid == childDefUuid)\n )\n }\n\n/**\n * Returns the only child of the parent node with the specified node def, or undefined if not found.\n * Throws an error if more than one child is found.\n */\nexport const getChild =\n (parentNode: ArenaRecordNode, childDefUuid: string) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const children = getChildren(parentNode, childDefUuid)(record)\n if (children.length > 1) {\n const errorParams = { childDefUuid, parentNodeUuid: parentNode.uuid, recordUuid: record.uuid }\n throw new SystemError(SystemErrorKeys.record.multipleNodesFound, errorParams)\n }\n return children[0]\n }\n\n// called for every ancestor in the record update loops: keep it a plain lookup\nconst getParentNode = (record: ArenaRecord, node: ArenaRecordNode): ArenaRecordNode | undefined =>\n node.parentUuid ? record.nodes?.[node.parentUuid] : undefined\n\nexport const getParent =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): ArenaRecordNode | undefined =>\n getParentNode(record, node)\n\nexport const getNodesByDefUuid =\n (nodeDefUuid: string) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeUuidsByDef(nodeDefUuid)(record._nodesIndex)\n return getNodesByUuids(nodeUuids)(record)\n }\n return getNodesArray(record).filter((node) => node.nodeDefUuid === nodeDefUuid)\n }\n\nconst isNodeFlagTrue =\n (isChildFlagTrue: (parent: ArenaRecordNode, nodeDefUuid: string) => boolean) =>\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean => {\n let child = node\n let parent = getParentNode(record, child)\n while (parent) {\n if (!isChildFlagTrue(parent, child.nodeDefUuid)) return false\n child = parent\n parent = getParentNode(record, child)\n }\n return true\n }\n\nexport const isNodeApplicable = isNodeFlagTrue((parent, nodeDefUuid) =>\n RecordNodes.isChildApplicable(parent, nodeDefUuid)\n)\nexport const isNodeEditable = isNodeFlagTrue((parent, nodeDefUuid) => RecordNodes.isChildEditable(parent, nodeDefUuid))\nexport const isNodeVisible = isNodeFlagTrue((parent, nodeDefUuid) => RecordNodes.isChildVisible(parent, nodeDefUuid))\n\n/**\n * Whether a value is required for the node: key or always required attribute, or attribute with a \"required if\"\n * condition met in its parent entity (evaluated condition stored in the parent node meta).\n */\nexport const isNodeRequired =\n (nodeDef: ArenaNodeDef<NodeDefType>, node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean => {\n if (NodeDefs.isKey(nodeDef) || NodeDefs.isRequired(nodeDef)) return true\n if (!NodeDefs.isRequiredIfDefined(nodeDef)) return false\n const parent = getParentNode(record, node)\n return !!parent && RecordNodes.isChildRequired(parent, nodeDef.uuid)\n }\n\nexport const getDependentCodeAttributes =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeCodeDependentUuids(node.uuid)(record._nodesIndex)\n return getNodesByUuids(nodeUuids)(record)\n }\n throw new SystemError(SystemErrorKeys.record.nodesIndexNotInitialized)\n }\n\nexport const getParentCodeAttribute =\n (parentNode: ArenaRecordNode, nodeDef: ArenaNodeDefCode) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const parentCodeDefUuid = NodeDefs.getParentCodeDefUuid(nodeDef)\n if (!parentCodeDefUuid) return undefined\n\n const ancestors = getAncestorsAndSelf(parentNode)(record)\n for (const ancestor of ancestors) {\n const children = getChildren(ancestor, parentCodeDefUuid)(record)\n if (children.length === 1) {\n return children[0]\n }\n }\n return undefined\n }\n\n// ancestors\n\n/**\n * Visits the specified node and its ancestors, from the node up to the root: the visit stops when the visitor returns true.\n */\nexport const visitAncestorsAndSelf =\n (node: ArenaRecordNode, visitor: (node: ArenaRecordNode) => boolean | void) =>\n (record: ArenaRecord): void => {\n let currentNode: ArenaRecordNode | undefined = node\n while (currentNode) {\n if (visitor(currentNode)) return\n currentNode = getParentNode(record, currentNode)\n }\n }\n\n/**\n * Returns the first node satisfying the predicate among the specified node and its ancestors (from the node up to the root).\n */\nexport const findAncestor =\n (node: ArenaRecordNode, predicate: (node: ArenaRecordNode) => boolean) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n let result: ArenaRecordNode | undefined = undefined\n visitAncestorsAndSelf(node, (visitedNode) => {\n if (predicate(visitedNode)) {\n result = visitedNode\n return true\n }\n return false\n })(record)\n return result\n }\n\n/**\n * Returns the specified node, if it has the specified node def, or its ancestor with that node def; undefined if not found.\n */\nexport const getAncestor =\n (node: ArenaRecordNode, ancestorDefUuid: string) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n let ancestor: ArenaRecordNode | undefined = node\n while (ancestor && ancestor.nodeDefUuid !== ancestorDefUuid) {\n ancestor = getParentNode(record, ancestor)\n }\n return ancestor\n }\n\n/**\n * Returns the list of ancestors from the given node to the root entity\n */\nexport const getAncestorsAndSelf =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): Array<ArenaRecordNode> => {\n const ancestors: Array<ArenaRecordNode> = []\n let currentNode: ArenaRecordNode | undefined = node\n while (currentNode) {\n ancestors.push(currentNode)\n currentNode = getParentNode(record, currentNode)\n }\n return ancestors\n }\n\n// descendants\n\nexport const getDescendantsOrSelf =\n (node: ArenaRecordNode, nodeDefDescendant: ArenaNodeDef<any>) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n if (nodeDefDescendant.uuid === node.nodeDefUuid) return [node]\n\n const nodeDefDescendantFullHierarchy = [...nodeDefDescendant.meta.h, nodeDefDescendant.uuid]\n\n // 1. get the descendant node defs uuids starting from node nodeDefUuid (not inclusive) down to the specified nodeDefDescendant uuid\n const descendantNodeDefUuids = nodeDefDescendantFullHierarchy.slice(\n nodeDefDescendantFullHierarchy.indexOf(node.nodeDefUuid) + 1\n )\n // 2. for every level in the hierarchy, find the children having the nodeDefUuid equal to the current one\n let currentAncestors = [node]\n let currentDescendants: ArenaRecordNode[] = []\n for (const currentDescendantDefUuid of descendantNodeDefUuids) {\n for (const currentAncestor of currentAncestors) {\n for (const child of getChildren(currentAncestor, currentDescendantDefUuid)(record)) {\n currentDescendants.push(child)\n }\n }\n currentAncestors = currentDescendants\n currentDescendants = []\n }\n return currentAncestors // currentAncestors is equal to the currentDescendants of the last level\n }\n\n/**\n * Returns the first descendant (or the node itself) with the specified node def, or undefined if not found.\n */\nexport const getDescendant =\n (node: ArenaRecordNode, nodeDefDescendant: ArenaNodeDef<any>) =>\n (record: ArenaRecord): ArenaRecordNode | undefined =>\n getDescendantsOrSelf(node, nodeDefDescendant)(record)[0]\n\nexport const isDescendantOf = (node: ArenaRecordNode, ancestor: ArenaRecordNode): boolean =>\n RecordNodes.getHierarchy(node).includes(ancestor.uuid)\n\nexport const visitDescendantsAndSelf =\n (\n node: ArenaRecordNode,\n visitor: (node: ArenaRecordNode) => boolean | void,\n traverseMethod: TraverseMethod = TraverseMethod.bfs\n ) =>\n (record: ArenaRecord): void => {\n if (traverseMethod === TraverseMethod.bfs) {\n const queue = new Queue<ArenaRecordNode>()\n\n queue.enqueue(node)\n\n while (!queue.isEmpty()) {\n const visitedNode = queue.dequeue()!\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren(visitedNode)(record)\n queue.enqueueItems(children)\n }\n } else {\n const stack = []\n\n stack.push(node)\n\n while (stack.length > 0) {\n const visitedNode = stack.pop() as ArenaRecordNode\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren(visitedNode)(record)\n\n // add children to stack in reverse order\n for (let index = children.length - 1; index >= 0; index--) {\n const child = children[index]\n stack.push(child)\n }\n }\n }\n }\n\nexport const findDescendantOrSelf =\n (node: ArenaRecordNode, predicate: (node: ArenaRecordNode) => boolean) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n let found = undefined\n\n visitDescendantsAndSelf(node, (currentNode) => {\n if (predicate(currentNode)) {\n found = currentNode\n return true\n }\n return false\n })(record)\n return found\n }\n\nconst getClosestAncestorNode =\n (\n node: ArenaRecordNode,\n nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>,\n dependentDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>,\n dependencyType: SurveyDependencyType\n ) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n // 1a if dependent def is the same as node def, potentially all nodes with\n // nodeDefUuid === dependentDef.uuid in record could be dependent of nodeDef;\n // consider the root node as the closest ancestor node,\n // unless the node def references itself only among the children of its parent entity (e.g. validation \"dbh > 0\")\n if (nodeDef.uuid === dependentDef.uuid) {\n return NodeDefSelfReferences.isSelfReferenceLocal({ nodeDef, dependencyType })\n ? getParent(node)(record)\n : getRoot(record)\n }\n // 1 find common ancestor def\n const commonAncestorDefUuid = Arrays.last(Arrays.intersection(nodeDef.meta.h, dependentDef.meta.h))\n if (!commonAncestorDefUuid) return undefined\n\n // 2 get ancestor node with common parent def\n return getAncestor(node, commonAncestorDefUuid)(record)\n }\n\ntype KeyDefs = ArenaNodeDef<NodeDefType, ArenaNodeDefProps>[]\n\n/**\n * Returns the key nodes of the entity, indexed by key def uuid; keyDefs, when specified, are used instead of the\n * entity def keys in the cycle.\n */\nexport const getEntityKeyNodesByDefUuid =\n (survey: ArenaSurvey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): ArenaRecordNodesMap => {\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: entity.nodeDefUuid })\n const nodeDefKeys = keyDefs ?? Surveys.getNodeDefKeys({ survey, cycle, nodeDef })\n return nodeDefKeys.reduce((acc: ArenaRecordNodesMap, nodeDefKey) => {\n const nodeKey = getDescendant(entity, nodeDefKey)(record)\n // missing key nodes are kept as undefined entries\n acc[nodeDefKey.uuid] = nodeKey as ArenaRecordNode\n return acc\n }, {})\n }\n\nexport const getEntityKeyNodes =\n (survey: ArenaSurvey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): ArenaRecordNode[] =>\n Object.values(getEntityKeyNodesByDefUuid(survey, entity, cycle, keyDefs)(record))\n\nexport const getEntityKeyValuesByDefUuid =\n (survey: ArenaSurvey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): ArenaDictionary<any> => {\n const keyNodesByDefUuid = getEntityKeyNodesByDefUuid(survey, entity, cycle, keyDefs)(record)\n return Object.entries(keyNodesByDefUuid).reduce((acc: ArenaDictionary<any>, [uuid, keyNode]) => {\n acc[uuid] = keyNode?.value\n return acc\n }, {})\n }\n\nexport const getEntityKeyValues =\n (survey: ArenaSurvey, entity: ArenaRecordNode, cycle?: string, keyDefs?: KeyDefs) =>\n (record: ArenaRecord): any[] =>\n Object.values(getEntityKeyValuesByDefUuid(survey, entity, cycle, keyDefs)(record))\n\nexport const getEntitySiblings =\n (entity: ArenaRecordNode, includeSelf = false) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n const parentEntity = getParent(entity)(record)\n if (!parentEntity) return []\n const siblingEntities = getChildren(parentEntity, entity.nodeDefUuid)(record)\n return includeSelf ? siblingEntities : siblingEntities.filter((sibling) => !RecordNodes.areEqual(sibling, entity))\n }\n\nexport const getAttributeSiblings =\n (node: ArenaRecordNode, nodeDef: ArenaNodeDef<NodeDefType, ArenaNodeDefProps>) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n const parentEntity = getParent(node)(record)\n if (!parentEntity) return []\n const siblingParentEntities = getEntitySiblings(parentEntity)(record)\n return siblingParentEntities.reduce((siblingsAcc: ArenaRecordNode[], siblingEntity) => {\n for (const sibling of getChildren(siblingEntity, nodeDef.uuid)(record)) {\n siblingsAcc.push(sibling)\n }\n return siblingsAcc\n }, [])\n }\n\nexport const getNodeIndex = (node: ArenaRecordNode) => (record: ArenaRecord) => {\n const parentEntity = getParent(node)(record)\n if (!parentEntity) return 0 // root entity\n const siblings = getChildren(parentEntity, node.nodeDefUuid)(record)\n // compared by uuid: the specified node can be a copy of the one in the record (e.g. an updated version of it)\n return siblings.findIndex((sibling) => sibling.uuid === node.uuid)\n}\n\nexport const findEntityByKeyValues =\n (\n survey: ArenaSurvey,\n cycle: string,\n parentEntity: ArenaRecordNode,\n entityDefUuid: string,\n keyValuesByDefUuid: ArenaDictionary<any>\n ) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const entityDef = Surveys.getNodeDefByUuid({ survey, uuid: entityDefUuid })\n const siblingEntities = getChildren(parentEntity, entityDefUuid)(record)\n if (NodeDefs.isSingle(entityDef)) {\n return siblingEntities[0]\n }\n const keyDefs = Surveys.getNodeDefKeys({ survey, cycle, nodeDef: entityDef })\n\n return siblingEntities.find((siblingEntity) => {\n const siblingEntityKeyValuesByDefUuid = getEntityKeyValuesByDefUuid(\n survey,\n siblingEntity,\n undefined,\n keyDefs\n )(record)\n return keyDefs.every((keyDef) => {\n const keyValue = siblingEntityKeyValuesByDefUuid[keyDef.uuid]\n const keyValueSearch = keyValuesByDefUuid[keyDef.uuid]\n return RecordNodeValues.isValueEqual({\n survey,\n nodeDef: keyDef,\n value: keyValue,\n valueSearch: keyValueSearch,\n })\n })\n })\n }\n\nexport const findEntityWithSameKeysInAnotherRecord =\n (survey: ArenaSurvey, cycle: string, entityUuid: string, recordOther: ArenaRecord) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const entity = getNodeByUuid(entityUuid)(record)\n if (!entity) return undefined\n\n let otherRecordCurrentParentEntity = getRoot(recordOther)\n if (!otherRecordCurrentParentEntity) return undefined\n\n const entityAncestorsAndSelf = getAncestorsAndSelf(entity)(record)\n const ancestorDefUuidsAndKeys = entityAncestorsAndSelf.map((ancestor) => ({\n entityDefUuid: ancestor.nodeDefUuid,\n keyValuesByDefUuid: getEntityKeyValuesByDefUuid(survey, ancestor)(record),\n }))\n\n const ancestorDefUuidsAndKeysToVisit = [...ancestorDefUuidsAndKeys].reverse()\n\n for (let index = 1; otherRecordCurrentParentEntity && index < ancestorDefUuidsAndKeysToVisit.length; index++) {\n const { entityDefUuid, keyValuesByDefUuid } = ancestorDefUuidsAndKeysToVisit[index]\n otherRecordCurrentParentEntity = findEntityByKeyValues(\n survey,\n cycle,\n otherRecordCurrentParentEntity,\n entityDefUuid,\n keyValuesByDefUuid\n )(recordOther)\n }\n return otherRecordCurrentParentEntity\n }\n\nexport const getDependentNodePointers =\n (\n survey: ArenaSurvey,\n node: ArenaRecordNode,\n dependencyType: SurveyDependencyType,\n includeSelf = false,\n filterFn: ((nodePointer: ArenaRecordNodePointer) => boolean) | null = null\n ) =>\n (record: ArenaRecord): ArenaRecordNodePointer[] => {\n const nodeDefUuid = node.nodeDefUuid\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: nodeDefUuid })\n const dependentDefs = Surveys.getNodeDefDependents({ survey, nodeDefUuid, dependencyType })\n const nodePointers: Array<ArenaRecordNodePointer> = []\n\n const addToNodePointers = (nodePointer: ArenaRecordNodePointer): void => {\n if (filterFn === null || filterFn(nodePointer)) {\n nodePointers.push(nodePointer)\n }\n }\n\n for (const dependentDef of dependentDefs) {\n // 1 find common ancestor node\n const commonAncestorNode = getClosestAncestorNode(node, nodeDef, dependentDef, dependencyType)(record)\n if (!commonAncestorNode) continue\n\n const nodeDefDependentParent = Surveys.getNodeDefParent({ survey, nodeDef: dependentDef })\n if (!nodeDefDependentParent) throw new SystemError(SystemErrorKeys.record.dependencyOnRootFound)\n\n // 2 find descendant nodes of common parent node with nodeDefUuid = dependentDef uuid\n const dependentContextNodes = getDescendantsOrSelf(commonAncestorNode, nodeDefDependentParent)(record)\n\n for (const dependentContextNode of dependentContextNodes) {\n addToNodePointers({\n nodeCtx: dependentContextNode,\n nodeDef: dependentDef,\n })\n }\n }\n if (includeSelf) {\n const parentNode = getParent(node)(record)\n if (parentNode) {\n addToNodePointers({\n nodeCtx: parentNode,\n nodeDef,\n })\n }\n }\n\n return nodePointers\n }\n\n/**\n * Returns the code attributes the specified code attribute depends on, from the top level one to the parent one.\n */\nexport const getAncestorCodeAttributes =\n (survey: ArenaSurvey, parentNode: ArenaRecordNode, nodeDef: ArenaNodeDefCode) =>\n (record: ArenaRecord): ArenaRecordNode[] => {\n const ancestorCodeAttributes = []\n let currentParentCodeAttribute = getParentCodeAttribute(parentNode, nodeDef)(record)\n while (currentParentCodeAttribute) {\n ancestorCodeAttributes.unshift(currentParentCodeAttribute)\n const ancestorCodeDef = Surveys.getNodeDefByUuid({\n survey,\n uuid: currentParentCodeAttribute.nodeDefUuid,\n }) as ArenaNodeDefCode\n currentParentCodeAttribute = getParentCodeAttribute(parentNode, ancestorCodeDef)(record)\n }\n return ancestorCodeAttributes\n }\n\nexport const getAncestorCodePath =\n (survey: ArenaSurvey, parentNode: ArenaRecordNode, nodeDef: ArenaNodeDef<NodeDefType.code, ArenaNodeDefCodeProps>) =>\n (record: ArenaRecord): string[] =>\n getAncestorCodeAttributes(\n survey,\n parentNode,\n nodeDef\n )(record).map((codeAttribute) => {\n const codeItemUuid = RecordNodeValues.getItemUuid(codeAttribute)\n if (!codeItemUuid) return ''\n // items of big categories are not in the survey ref data: they can be in the node ref data\n const item =\n codeAttribute.refData?.categoryItem ?? Surveys.getCategoryItemByUuid({ survey, itemUuid: codeItemUuid })\n return item?.props.code ?? ''\n })\n\nexport const getCategoryItemUuid =\n (\n survey: ArenaSurvey,\n nodeDef: ArenaNodeDef<NodeDefType.code, ArenaNodeDefCodeProps>,\n parentNode: ArenaRecordNode,\n code: string\n ) =>\n (record: ArenaRecord): string | undefined => {\n const categoryUuid = nodeDef.props.categoryUuid\n\n const codePaths = [...getAncestorCodePath(survey, parentNode, nodeDef)(record), code]\n\n const item = Surveys.getCategoryItemByCodePaths({ survey, categoryUuid, codePaths })\n\n return item?.uuid\n }\n\nexport const isNodeFilledByUser =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean =>\n !!findDescendantOrSelf(node, (visitedNode) => RecordNodes.hasUserInputValue(visitedNode))(record)\n\nexport const isNodeEmpty =\n (node: ArenaRecordNode) =>\n (record: ArenaRecord): boolean =>\n !isNodeFilledByUser(node)(record)\n\nexport const isEmpty = (record: ArenaRecord): boolean => {\n const rootNode = getRoot(record)\n return rootNode ? isNodeEmpty(rootNode)(record) : true\n}\n\nexport const getStep = (record: ArenaRecord): string => record.step ?? RECORD_STEP_DEFAULT\n\nexport const isInAnalysisStep = (record: ArenaRecord): boolean => getStep(record) === RecordStepAnalysisCode\n"]}
@@ -1,4 +1,4 @@
1
- import { Nodes } from '../../node';
1
+ import { RecordNodes } from '../../node';
2
2
  import { Objects } from '../../utils';
3
3
  const keys = {
4
4
  nodeRootUuid: 'nodeRootUuid',
@@ -13,7 +13,7 @@ const sortNodesByIdOrCreationDate = (nodeA, nodeB) => {
13
13
  return -1;
14
14
  if (!nodeB.parentUuid)
15
15
  return 1;
16
- // read the hierarchy length directly: Nodes.getHierarchy copies the array on every comparison
16
+ // read the hierarchy length directly: RecordNodes.getHierarchy copies the array on every comparison
17
17
  const hierarchyDepthA = (_e = (_b = (_a = nodeA.meta) === null || _a === void 0 ? void 0 : _a.h) === null || _b === void 0 ? void 0 : _b.length) !== null && _e !== void 0 ? _e : 0;
18
18
  const hierarchyDepthB = (_f = (_d = (_c = nodeB.meta) === null || _c === void 0 ? void 0 : _c.h) === null || _d === void 0 ? void 0 : _d.length) !== null && _f !== void 0 ? _f : 0;
19
19
  const depthDiff = hierarchyDepthA - hierarchyDepthB;
@@ -110,7 +110,7 @@ class NodesIndexDraft {
110
110
  }
111
111
  this.delete([keys.nodesByDef, nodeDefUuid, nodeUuid]);
112
112
  // code dependents
113
- for (const ancestorCodeAttributeUuid of Nodes.getHierarchyCode(node)) {
113
+ for (const ancestorCodeAttributeUuid of RecordNodes.getHierarchyCode(node)) {
114
114
  this.delete([keys.nodeCodeDependents, ancestorCodeAttributeUuid, nodeUuid]);
115
115
  }
116
116
  this.delete([keys.nodeCodeDependents, nodeUuid]);
@@ -1 +1 @@
1
- {"version":3,"file":"recordNodesIndexUpdater.js","sourceRoot":"","sources":["../../../../src/record/_records/recordNodesIndexUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAIrC,MAAM,IAAI,GAAG;IACX,YAAY,EAAE,cAAc;IAC5B,wBAAwB,EAAE,0BAA0B;IACpD,UAAU,EAAE,YAAY;IACxB,kBAAkB,EAAE,oBAAoB;CACzC,CAAA;AAED,MAAM,2BAA2B,GAAG,CAAC,KAAsB,EAAE,KAAsB,EAAU,EAAE;;;IAC7F,IAAI,CAAC,KAAK,CAAC,UAAU;QAAE,OAAO,CAAC,CAAC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ACpB,UAAU;IACV,WAAW;CACZ,CAAA","sourcesContent":["import { ArenaRecordNode, Nodes } from '../../node'\nimport { Objects } from '../../utils'\nimport { MutationOptions } from '../../utils/mutationOptions'\nimport { ArenaRecord, RecordNodesIndex } from '../record'\n\nconst keys = {\n nodeRootUuid: 'nodeRootUuid',\n nodesByParentAndChildDef: 'nodesByParentAndChildDef',\n nodesByDef: 'nodesByDef',\n nodeCodeDependents: 'nodeCodeDependents',\n}\n\nconst sortNodesByIdOrCreationDate = (nodeA: ArenaRecordNode, nodeB: ArenaRecordNode): number => {\n if (!nodeA.parentUuid) return -1\n if (!nodeB.parentUuid) return 1\n // read the hierarchy length directly: Nodes.getHierarchy copies the array on every comparison\n const hierarchyDepthA = nodeA.meta?.h?.length ?? 0\n const hierarchyDepthB = nodeB.meta?.h?.length ?? 0\n const depthDiff = hierarchyDepthA - hierarchyDepthB\n if (depthDiff !== 0) return depthDiff\n if (nodeA.id && nodeB.id) return nodeA.id - nodeB.id\n if (nodeA.dateCreated && nodeB.dateCreated) return nodeA.dateCreated.localeCompare(nodeB.dateCreated)\n return 0\n}\n\n/**\n * Mutable copy of a nodes index, used to apply many changes to it at once.\n * When sideEffect is false, every object along a modified path is copied only the first time it is modified\n * (copy on write): applying N changes costs one copy of each touched object instead of N copies.\n */\nclass NodesIndexDraft {\n readonly index: RecordNodesIndex\n private readonly sideEffect: boolean\n private readonly copiedObjects = new Set<object>()\n\n constructor(index: RecordNodesIndex, sideEffect: boolean) {\n this.sideEffect = sideEffect\n this.index = sideEffect ? index : this.markCopied({ ...index })\n }\n\n private markCopied<T extends object>(obj: T): T {\n this.copiedObjects.add(obj)\n return obj\n }\n\n private getWritableChild(parent: any, key: string, createIfMissing: boolean): any {\n const child = parent[key]\n if (child === undefined || child === null) {\n if (!createIfMissing) return undefined\n const childCreated = this.markCopied({})\n parent[key] = childCreated\n return childCreated\n }\n if (this.sideEffect || this.copiedObjects.has(child)) return child\n const childCopy = this.markCopied({ ...child })\n parent[key] = childCopy\n return childCopy\n }\n\n set(path: string[], value: any): void {\n let current: any = this.index\n for (let i = 0; i < path.length - 1; i++) {\n current = this.getWritableChild(current, path[i], true)\n }\n current[path.at(-1)!] = value\n }\n\n /**\n * Deletes the value at the specified path, then removes the objects along the path left empty.\n */\n delete(path: string[]): void {\n const containers: any[] = [this.index]\n let current: any = this.index\n for (let i = 0; i < path.length - 1; i++) {\n if (current[path[i]] === undefined) return\n current = this.getWritableChild(current, path[i], false)\n containers.push(current)\n }\n delete current[path.at(-1)!]\n for (let i = path.length - 2; i >= 0; i--) {\n if (!Objects.isEmpty(containers[i + 1])) break\n delete containers[i][path[i]]\n }\n }\n\n addNode(node: ArenaRecordNode): void {\n const { uuid: nodeUuid, nodeDefUuid, parentUuid } = node\n if (parentUuid) {\n // nodes by parent and child def uuid\n this.set([keys.nodesByParentAndChildDef, parentUuid, nodeDefUuid, nodeUuid], true)\n } else {\n // root entity index\n this.index.nodeRootUuid = nodeUuid\n }\n // nodes by def uuid\n this.set([keys.nodesByDef, nodeDefUuid, nodeUuid], true)\n // code dependents\n for (const ancestorCodeAttributeUuid of node.meta?.hCode ?? []) {\n this.set([keys.nodeCodeDependents, ancestorCodeAttributeUuid, nodeUuid], true)\n }\n }\n\n removeNode(node: ArenaRecordNode): void {\n const { uuid: nodeUuid, parentUuid, nodeDefUuid } = node\n if (parentUuid) {\n this.delete([keys.nodesByParentAndChildDef, parentUuid, nodeDefUuid, nodeUuid])\n } else {\n delete this.index.nodeRootUuid\n }\n this.delete([keys.nodesByDef, nodeDefUuid, nodeUuid])\n // code dependents\n for (const ancestorCodeAttributeUuid of Nodes.getHierarchyCode(node)) {\n this.delete([keys.nodeCodeDependents, ancestorCodeAttributeUuid, nodeUuid])\n }\n this.delete([keys.nodeCodeDependents, nodeUuid])\n }\n}\n\nconst addNodes =\n (nodes: { [key: string]: ArenaRecordNode }, options: MutationOptions & { sortNodes?: boolean } = {}) =>\n (index: RecordNodesIndex): RecordNodesIndex => {\n const { sideEffect = false, sortNodes = false } = options\n const draft = new NodesIndexDraft(index, sideEffect)\n const nodesArray = Object.values(nodes)\n if (sortNodes) {\n nodesArray.sort(sortNodesByIdOrCreationDate)\n }\n for (const node of nodesArray) {\n draft.addNode(node)\n }\n return draft.index\n }\n\nconst addNode =\n (node: ArenaRecordNode) =>\n (index: RecordNodesIndex): RecordNodesIndex =>\n addNodes({ [node.uuid]: node })(index)\n\nconst initializeIndex = (record: ArenaRecord): RecordNodesIndex =>\n addNodes(record.nodes ?? {}, { sideEffect: true, sortNodes: true })({})\n\nconst removeNodes =\n (nodes: ArenaRecordNode[], options: MutationOptions = {}) =>\n (index: RecordNodesIndex): RecordNodesIndex => {\n const { sideEffect = false } = options\n const draft = new NodesIndexDraft(index, sideEffect)\n for (const node of nodes) {\n draft.removeNode(node)\n }\n return draft.index\n }\n\nconst removeNode =\n (node: ArenaRecordNode, options: MutationOptions = {}) =>\n (index: RecordNodesIndex): RecordNodesIndex =>\n removeNodes([node], options)(index)\n\nconst _isSameHierarchyCode = (nodeA: ArenaRecordNode, nodeB: ArenaRecordNode): boolean => {\n const hCodeA = nodeA.meta?.hCode ?? []\n const hCodeB = nodeB.meta?.hCode ?? []\n return hCodeA.length === hCodeB.length && hCodeA.every((uuid, index) => uuid === hCodeB[index])\n}\n\n/**\n * Returns true if the index entries of the specified node would not change when the node replaces the previous version of it.\n */\nconst isNodeIndexUnchanged = (params: {\n index: RecordNodesIndex\n node: ArenaRecordNode\n nodePrev?: ArenaRecordNode\n}): boolean => {\n const { index, node, nodePrev } = params\n if (!nodePrev) return false\n const { uuid, parentUuid, nodeDefUuid } = node\n if (parentUuid !== nodePrev.parentUuid || nodeDefUuid !== nodePrev.nodeDefUuid) return false\n if (!_isSameHierarchyCode(node, nodePrev)) return false\n if (!index.nodesByDef?.[nodeDefUuid]?.[uuid]) return false\n return parentUuid\n ? !!index.nodesByParentAndChildDef?.[parentUuid]?.[nodeDefUuid]?.[uuid]\n : index.nodeRootUuid === uuid\n}\n\nexport const RecordNodesIndexUpdater = {\n addNode,\n addNodes,\n initializeIndex,\n isNodeIndexUnchanged,\n removeNode,\n removeNodes,\n}\n"]}
1
+ {"version":3,"file":"recordNodesIndexUpdater.js","sourceRoot":"","sources":["../../../../src/record/_records/recordNodesIndexUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,WAAW,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAIrC,MAAM,IAAI,GAAG;IACX,YAAY,EAAE,cAAc;IAC5B,wBAAwB,EAAE,0BAA0B;IACpD,UAAU,EAAE,YAAY;IACxB,kBAAkB,EAAE,oBAAoB;CACzC,CAAA;AAED,MAAM,2BAA2B,GAAG,CAAC,KAAsB,EAAE,KAAsB,EAAU,EAAE;;;IAC7F,IAAI,CAAC,KAAK,CAAC,UAAU;QAAE,OAAO,CAAC,CAAC,CAAA;IAChC,IAAI,CAAC,KAAK,CAAC,UAAU;QAAE,OAAO,CAAC,CAAA;IAC/B,oGAAoG;IACpG,MAAM,eAAe,SAAG,MAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,CAAC,0CAAE,MAAM,mCAAI,CAAC,CAAA;IAClD,MAAM,eAAe,SAAG,MAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,CAAC,0CAAE,MAAM,mCAAI,CAAC,CAAA;IAClD,MAAM,SAAS,GAAG,eAAe,GAAG,eAAe,CAAA;IACnD,IAAI,SAAS,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IACrC,IAAI,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,EAAE;QAAE,OAAO,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAA;IACpD,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW;QAAE,OAAO,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IACrG,OAAO,CAAC,CAAA;AACV,CAAC,CAAA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AW,KAAK,QAAQ,CAAC,WAAW;QAAE,OAAO,KAAK,CAAA;IAC5F,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAA;IACvD,IAAI,EAAC,MAAA,MAAA,KAAK,CAAC,UAAU,0CAAG,WAAW,CAAC,0CAAG,IAAI,CAAC,CAAA;QAAE,OAAO,KAAK,CAAA;IAC1D,OAAO,UAAU;QACf,CAAC,CAAC,CAAC,EAAC,MAAA,MAAA,MAAA,KAAK,CAAC,wBAAwB,0CAAG,UAAU,CAAC,0CAAG,WAAW,CAAC,0CAAG,IAAI,CAAC,CAAA;QACvE,CAAC,CAAC,KAAK,CAAC,YAAY,KAAK,IAAI,CAAA;AACjC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,OAAO;IACP,QAAQ;IACR,eAAe;IACf,oBAAoB;IACpB,UAAU;IACV,WAAW;CACZ,CAAA","sourcesContent":["import { ArenaRecordNode, RecordNodes } from '../../node'\nimport { Objects } from '../../utils'\nimport { ArenaMutationOptions } from '../../utils/mutationOptions'\nimport { ArenaRecord, RecordNodesIndex } from '../record'\n\nconst keys = {\n nodeRootUuid: 'nodeRootUuid',\n nodesByParentAndChildDef: 'nodesByParentAndChildDef',\n nodesByDef: 'nodesByDef',\n nodeCodeDependents: 'nodeCodeDependents',\n}\n\nconst sortNodesByIdOrCreationDate = (nodeA: ArenaRecordNode, nodeB: ArenaRecordNode): number => {\n if (!nodeA.parentUuid) return -1\n if (!nodeB.parentUuid) return 1\n // read the hierarchy length directly: RecordNodes.getHierarchy copies the array on every comparison\n const hierarchyDepthA = nodeA.meta?.h?.length ?? 0\n const hierarchyDepthB = nodeB.meta?.h?.length ?? 0\n const depthDiff = hierarchyDepthA - hierarchyDepthB\n if (depthDiff !== 0) return depthDiff\n if (nodeA.id && nodeB.id) return nodeA.id - nodeB.id\n if (nodeA.dateCreated && nodeB.dateCreated) return nodeA.dateCreated.localeCompare(nodeB.dateCreated)\n return 0\n}\n\n/**\n * Mutable copy of a nodes index, used to apply many changes to it at once.\n * When sideEffect is false, every object along a modified path is copied only the first time it is modified\n * (copy on write): applying N changes costs one copy of each touched object instead of N copies.\n */\nclass NodesIndexDraft {\n readonly index: RecordNodesIndex\n private readonly sideEffect: boolean\n private readonly copiedObjects = new Set<object>()\n\n constructor(index: RecordNodesIndex, sideEffect: boolean) {\n this.sideEffect = sideEffect\n this.index = sideEffect ? index : this.markCopied({ ...index })\n }\n\n private markCopied<T extends object>(obj: T): T {\n this.copiedObjects.add(obj)\n return obj\n }\n\n private getWritableChild(parent: any, key: string, createIfMissing: boolean): any {\n const child = parent[key]\n if (child === undefined || child === null) {\n if (!createIfMissing) return undefined\n const childCreated = this.markCopied({})\n parent[key] = childCreated\n return childCreated\n }\n if (this.sideEffect || this.copiedObjects.has(child)) return child\n const childCopy = this.markCopied({ ...child })\n parent[key] = childCopy\n return childCopy\n }\n\n set(path: string[], value: any): void {\n let current: any = this.index\n for (let i = 0; i < path.length - 1; i++) {\n current = this.getWritableChild(current, path[i], true)\n }\n current[path.at(-1)!] = value\n }\n\n /**\n * Deletes the value at the specified path, then removes the objects along the path left empty.\n */\n delete(path: string[]): void {\n const containers: any[] = [this.index]\n let current: any = this.index\n for (let i = 0; i < path.length - 1; i++) {\n if (current[path[i]] === undefined) return\n current = this.getWritableChild(current, path[i], false)\n containers.push(current)\n }\n delete current[path.at(-1)!]\n for (let i = path.length - 2; i >= 0; i--) {\n if (!Objects.isEmpty(containers[i + 1])) break\n delete containers[i][path[i]]\n }\n }\n\n addNode(node: ArenaRecordNode): void {\n const { uuid: nodeUuid, nodeDefUuid, parentUuid } = node\n if (parentUuid) {\n // nodes by parent and child def uuid\n this.set([keys.nodesByParentAndChildDef, parentUuid, nodeDefUuid, nodeUuid], true)\n } else {\n // root entity index\n this.index.nodeRootUuid = nodeUuid\n }\n // nodes by def uuid\n this.set([keys.nodesByDef, nodeDefUuid, nodeUuid], true)\n // code dependents\n for (const ancestorCodeAttributeUuid of node.meta?.hCode ?? []) {\n this.set([keys.nodeCodeDependents, ancestorCodeAttributeUuid, nodeUuid], true)\n }\n }\n\n removeNode(node: ArenaRecordNode): void {\n const { uuid: nodeUuid, parentUuid, nodeDefUuid } = node\n if (parentUuid) {\n this.delete([keys.nodesByParentAndChildDef, parentUuid, nodeDefUuid, nodeUuid])\n } else {\n delete this.index.nodeRootUuid\n }\n this.delete([keys.nodesByDef, nodeDefUuid, nodeUuid])\n // code dependents\n for (const ancestorCodeAttributeUuid of RecordNodes.getHierarchyCode(node)) {\n this.delete([keys.nodeCodeDependents, ancestorCodeAttributeUuid, nodeUuid])\n }\n this.delete([keys.nodeCodeDependents, nodeUuid])\n }\n}\n\nconst addNodes =\n (nodes: { [key: string]: ArenaRecordNode }, options: ArenaMutationOptions & { sortNodes?: boolean } = {}) =>\n (index: RecordNodesIndex): RecordNodesIndex => {\n const { sideEffect = false, sortNodes = false } = options\n const draft = new NodesIndexDraft(index, sideEffect)\n const nodesArray = Object.values(nodes)\n if (sortNodes) {\n nodesArray.sort(sortNodesByIdOrCreationDate)\n }\n for (const node of nodesArray) {\n draft.addNode(node)\n }\n return draft.index\n }\n\nconst addNode =\n (node: ArenaRecordNode) =>\n (index: RecordNodesIndex): RecordNodesIndex =>\n addNodes({ [node.uuid]: node })(index)\n\nconst initializeIndex = (record: ArenaRecord): RecordNodesIndex =>\n addNodes(record.nodes ?? {}, { sideEffect: true, sortNodes: true })({})\n\nconst removeNodes =\n (nodes: ArenaRecordNode[], options: ArenaMutationOptions = {}) =>\n (index: RecordNodesIndex): RecordNodesIndex => {\n const { sideEffect = false } = options\n const draft = new NodesIndexDraft(index, sideEffect)\n for (const node of nodes) {\n draft.removeNode(node)\n }\n return draft.index\n }\n\nconst removeNode =\n (node: ArenaRecordNode, options: ArenaMutationOptions = {}) =>\n (index: RecordNodesIndex): RecordNodesIndex =>\n removeNodes([node], options)(index)\n\nconst _isSameHierarchyCode = (nodeA: ArenaRecordNode, nodeB: ArenaRecordNode): boolean => {\n const hCodeA = nodeA.meta?.hCode ?? []\n const hCodeB = nodeB.meta?.hCode ?? []\n return hCodeA.length === hCodeB.length && hCodeA.every((uuid, index) => uuid === hCodeB[index])\n}\n\n/**\n * Returns true if the index entries of the specified node would not change when the node replaces the previous version of it.\n */\nconst isNodeIndexUnchanged = (params: {\n index: RecordNodesIndex\n node: ArenaRecordNode\n nodePrev?: ArenaRecordNode\n}): boolean => {\n const { index, node, nodePrev } = params\n if (!nodePrev) return false\n const { uuid, parentUuid, nodeDefUuid } = node\n if (parentUuid !== nodePrev.parentUuid || nodeDefUuid !== nodePrev.nodeDefUuid) return false\n if (!_isSameHierarchyCode(node, nodePrev)) return false\n if (!index.nodesByDef?.[nodeDefUuid]?.[uuid]) return false\n return parentUuid\n ? !!index.nodesByParentAndChildDef?.[parentUuid]?.[nodeDefUuid]?.[uuid]\n : index.nodeRootUuid === uuid\n}\n\nexport const RecordNodesIndexUpdater = {\n addNode,\n addNodes,\n initializeIndex,\n isNodeIndexUnchanged,\n removeNode,\n removeNodes,\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Nodes } from '../../node';
1
+ import { RecordNodes } from '../../node';
2
2
  import { NodeDefs } from '../../nodeDef';
3
3
  import { Surveys } from '../../survey';
4
4
  import { Validations } from '../../validation';
@@ -12,7 +12,7 @@ export const nodeBelongsToPage = (params) => {
12
12
  const { node, pageNodeDefUuid, record } = params;
13
13
  if (node.nodeDefUuid === pageNodeDefUuid)
14
14
  return true;
15
- return Nodes.getHierarchy(node).some((ancestorUuid) => {
15
+ return RecordNodes.getHierarchy(node).some((ancestorUuid) => {
16
16
  const ancestor = getNodeByUuid(ancestorUuid)(record);
17
17
  return (ancestor === null || ancestor === void 0 ? void 0 : ancestor.nodeDefUuid) === pageNodeDefUuid;
18
18
  });
@@ -79,7 +79,7 @@ const nodeIsUnderEntity = (params) => {
79
79
  const { node, entityUuid } = params;
80
80
  if (node.uuid === entityUuid)
81
81
  return true;
82
- return Nodes.getHierarchy(node).includes(entityUuid);
82
+ return RecordNodes.getHierarchy(node).includes(entityUuid);
83
83
  };
84
84
  const getOwnPageFieldValidationFlags = (params) => {
85
85
  const { nodeUuid, pageNodeDefUuid, descendantPageUuids, scopeEntityUuid, record, recordValidation } = params;
@@ -1 +1 @@
1
- {"version":3,"file":"recordPagesValidation.js","sourceRoot":"","sources":["../../../../src/record/_records/recordPagesValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAiB,QAAQ,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAAU,OAAO,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAmBrF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAIjC,EAAW,EAAE;IACZ,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;IAChD,IAAI,IAAI,CAAC,WAAW,KAAK,eAAe;QAAE,OAAO,IAAI,CAAA;IACrD,OAAO,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE;QACpD,MAAM,QAAQ,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;QACpD,OAAO,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,WAAW,MAAK,eAAe,CAAA;IAClD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,oBA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E,CAAA;AAC5C,CAAC,CAAA","sourcesContent":["import { ArenaRecordNode, Nodes } from '../../node'\nimport { NodeDefEntity, NodeDefs } from '../../nodeDef'\nimport { Survey, Surveys } from '../../survey'\nimport { Validations } from '../../validation'\nimport { ArenaRecord } from '../record'\nimport { RecordValidations } from '../recordValidations'\nimport { getEntityCompletionStats } from './recordCompletion'\nimport { getCycle, getNodeByUuid, getNodesByDefUuid, getRoot } from './recordGetters'\n\nexport type PageValidationStatus = {\n hasErrors: boolean\n hasWarnings: boolean\n}\n\nexport type EntitySubtreeStatus = {\n hasErrors: boolean\n hasWarnings: boolean\n isComplete: boolean\n}\n\nexport type PagesValidationProgress = {\n percent: number\n validCount: number\n totalCount: number\n}\n\n/**\n * Whether a node belongs under a page entity (itself or any descendant of that page).\n */\nexport const nodeBelongsToPage = (params: {\n node: ArenaRecordNode\n pageNodeDefUuid: string\n record: ArenaRecord\n}): boolean => {\n const { node, pageNodeDefUuid, record } = params\n if (node.nodeDefUuid === pageNodeDefUuid) return true\n return Nodes.getHierarchy(node).some((ancestorUuid) => {\n const ancestor = getNodeByUuid(ancestorUuid)(record)\n return ancestor?.nodeDefUuid === pageNodeDefUuid\n })\n}\n\n/**\n * Whether a node belongs to this page only — not to a nested descendant page entity.\n * When descendantPageUuids is empty, all nodes under the page hierarchy are included.\n */\nexport const nodeBelongsToOwnPage = (params: {\n node: ArenaRecordNode\n pageNodeDefUuid: string\n descendantPageUuids: string[]\n record: ArenaRecord\n}): boolean => {\n const { node, pageNodeDefUuid, descendantPageUuids, record } = params\n if (!nodeBelongsToPage({ node, pageNodeDefUuid, record })) return false\n if (descendantPageUuids.includes(node.nodeDefUuid)) return false\n return !descendantPageUuids.some((descendantUuid) =>\n nodeBelongsToPage({ node, pageNodeDefUuid: descendantUuid, record })\n )\n}\n\n/**\n * Child page-entity defs displayed in their own page under the given entity.\n */\nexport const getNodeDefChildrenInOwnPage = (params: {\n survey: Survey\n nodeDef: NodeDefEntity\n cycle: string\n}): NodeDefEntity[] => {\n const { survey, nodeDef, cycle } = params\n return Surveys.getNodeDefChildren({ survey, nodeDef, includeAnalysis: true }).filter(\n (child): child is NodeDefEntity => {\n if (!NodeDefs.isEntity(child)) return false\n return NodeDefs.isDisplayInOwnPage(cycle)(child as NodeDefEntity)\n }\n )\n}\n\n/**\n * Collects all page-entity node defs in the survey cycle (root + nested own-pages).\n */\nexport const getPageNodeDefs = (params: { survey: Survey; cycle: string }): NodeDefEntity[] => {\n const { survey, cycle } = params\n const root = Surveys.getNodeDefRoot({ survey }) as NodeDefEntity | undefined\n if (!root) return []\n\n const pages: NodeDefEntity[] = []\n const stack: NodeDefEntity[] = [root]\n while (stack.length > 0) {\n const current = stack.pop()\n if (!current) continue\n pages.push(current)\n stack.push(...getNodeDefChildrenInOwnPage({ survey, nodeDef: current, cycle }))\n }\n return pages\n}\n\n/**\n * Collects descendant page node def UUIDs under a page (not including the page itself).\n */\nexport const getDescendantPageNodeDefUuids = (params: {\n survey: Survey\n cycle: string\n pageNodeDef: NodeDefEntity\n}): string[] => {\n const { survey, cycle, pageNodeDef } = params\n const uuids: string[] = []\n const visit = (nodeDef: NodeDefEntity) => {\n const children = getNodeDefChildrenInOwnPage({ survey, nodeDef, cycle })\n for (const child of children) {\n uuids.push(child.uuid)\n visit(child)\n }\n }\n visit(pageNodeDef)\n return uuids\n}\n\nconst nodeIsUnderEntity = (params: { node: ArenaRecordNode; entityUuid: string }): boolean => {\n const { node, entityUuid } = params\n if (node.uuid === entityUuid) return true\n return Nodes.getHierarchy(node).includes(entityUuid)\n}\n\nconst getOwnPageFieldValidationFlags = (params: {\n nodeUuid: string\n pageNodeDefUuid: string\n descendantPageUuids: string[]\n scopeEntityUuid?: string\n record: ArenaRecord\n recordValidation: ReturnType<typeof Validations.getValidation>\n}): PageValidationStatus | null => {\n const { nodeUuid, pageNodeDefUuid, descendantPageUuids, scopeEntityUuid, record, recordValidation } = params\n\n if (RecordValidations.isValidationChildrenCountKey(nodeUuid)) {\n return getOwnPageChildrenCountValidationFlags({\n childrenCountKey: nodeUuid,\n pageNodeDefUuid,\n descendantPageUuids,\n scopeEntityUuid,\n record,\n recordValidation,\n })\n }\n\n const node = getNodeByUuid(nodeUuid)(record)\n if (!node || !nodeBelongsToOwnPage({ node, pageNodeDefUuid, descendantPageUuids, record })) return null\n if (scopeEntityUuid && !nodeIsUnderEntity({ node, entityUuid: scopeEntityUuid })) return null\n\n const nodeValidation = RecordValidations.getValidationNode({ nodeUuid })(recordValidation)\n if (!nodeValidation) return null\n\n return {\n hasErrors: Validations.hasErrors(nodeValidation),\n hasWarnings: Validations.hasWarnings(nodeValidation),\n }\n}\n\n/**\n * Children-count validations (file min count, inline multiple min/max, etc.) are keyed as\n * `childrenCount_{parentUuid}_{childDefUuid}`, not as node UUIDs.\n * Include them when the parent is on this page, but skip counts that refer to descendant\n * page entities (missing sub-page instances should not paint the parent page red).\n */\nconst getOwnPageChildrenCountValidationFlags = (params: {\n childrenCountKey: string\n pageNodeDefUuid: string\n descendantPageUuids: string[]\n scopeEntityUuid?: string\n record: ArenaRecord\n recordValidation: ReturnType<typeof Validations.getValidation>\n}): PageValidationStatus | null => {\n const { childrenCountKey, pageNodeDefUuid, descendantPageUuids, scopeEntityUuid, record, recordValidation } = params\n const parentUuid = RecordValidations.extractValidationChildrenCountKeyParentUuid(childrenCountKey)\n const childDefUuid = RecordValidations.extractValidationChildrenCountKeyNodeDefUuid(childrenCountKey)\n if (!parentUuid || !childDefUuid) return null\n\n // Sub-page entity min/max counts belong to navigation of nested pages, not this page's fields.\n if (descendantPageUuids.includes(childDefUuid)) return null\n\n const parentNode = getNodeByUuid(parentUuid)(record)\n if (!parentNode || !nodeBelongsToOwnPage({ node: parentNode, pageNodeDefUuid, descendantPageUuids, record })) {\n return null\n }\n if (scopeEntityUuid && !nodeIsUnderEntity({ node: parentNode, entityUuid: scopeEntityUuid })) return null\n\n const fieldValidation = Validations.getFieldValidation(childrenCountKey)(recordValidation)\n if (!fieldValidation) return null\n\n return {\n hasErrors: Validations.hasErrors(fieldValidation),\n hasWarnings: Validations.hasWarnings(fieldValidation),\n }\n}\n\n/**\n * Aggregates error/warning flags for a page.\n * When descendantPageUuids is non-empty, nested page entities are excluded (own-page scope).\n * When scopeEntityUuid is set, only validations for nodes under that entity instance are included.\n */\nexport const getPageValidationStatus = (params: {\n pageNodeDefUuid: string\n descendantPageUuids?: string[]\n record: ArenaRecord\n scopeEntityUuid?: string\n}): PageValidationStatus => {\n const { pageNodeDefUuid, descendantPageUuids = [], record, scopeEntityUuid } = params\n const recordValidation = Validations.getValidation(record)\n const fields = Validations.getFieldValidations(recordValidation)\n let hasErrors = false\n let hasWarnings = false\n\n for (const nodeUuid of Object.keys(fields)) {\n const flags = getOwnPageFieldValidationFlags({\n nodeUuid,\n pageNodeDefUuid,\n descendantPageUuids,\n scopeEntityUuid,\n record,\n recordValidation,\n })\n if (!flags) continue\n if (flags.hasErrors) hasErrors = true\n if (flags.hasWarnings) hasWarnings = true\n if (hasErrors && hasWarnings) break\n }\n\n return { hasErrors, hasWarnings }\n}\n\nconst aggregatePageValidationStatuses = (statuses: PageValidationStatus[]): PageValidationStatus => ({\n hasErrors: statuses.some((status) => status.hasErrors),\n hasWarnings: statuses.some((status) => status.hasWarnings),\n})\n\n/**\n * Validation and completion status for one entity instance and its descendant pages.\n * Returns null when the node is missing or is not an entity.\n */\nexport const getEntitySubtreeStatus = (params: {\n survey: Survey\n record: ArenaRecord\n entityUuid: string\n cycle?: string\n}): EntitySubtreeStatus | null => {\n const { survey, record, entityUuid } = params\n const entity = getNodeByUuid(entityUuid)(record)\n if (!entity) return null\n\n const entityDef = Surveys.getNodeDefByUuid({ survey, uuid: entity.nodeDefUuid })\n if (!NodeDefs.isEntity(entityDef)) return null\n\n const cycle = params.cycle ?? getCycle(record)\n const entityPageDef = entityDef as NodeDefEntity\n const descendantPageUuids = getDescendantPageNodeDefUuids({ survey, cycle, pageNodeDef: entityPageDef })\n const pageUuidsToCheck = [entity.nodeDefUuid, ...descendantPageUuids]\n\n const validationStatuses = pageUuidsToCheck.map((pageNodeDefUuid) => {\n const pageNodeDef = Surveys.getNodeDefByUuid({ survey, uuid: pageNodeDefUuid }) as NodeDefEntity\n const pageDescendantUuids = getDescendantPageNodeDefUuids({ survey, cycle, pageNodeDef })\n return getPageValidationStatus({\n pageNodeDefUuid,\n descendantPageUuids: pageDescendantUuids,\n record,\n scopeEntityUuid: entityUuid,\n })\n })\n\n const { hasErrors, hasWarnings } = aggregatePageValidationStatuses(validationStatuses)\n const { total, filled } = getEntityCompletionStats({ survey, record, entity })\n const isComplete = total > 0 && filled === total && !hasErrors && !hasWarnings\n\n return { hasErrors, hasWarnings, isComplete }\n}\n\n/**\n * Aggregates subtree status across instances of a multiple page entity.\n * When `scopeEntityUuid` is set, only instances under that ancestor entity are included\n * (needed for nested multiples, e.g. Tree under the currently selected Plot).\n * Empty instance lists return a non-complete status with no validation flags.\n */\nexport const getMultiplePageEntitiesStatus = (params: {\n survey: Survey\n record: ArenaRecord\n pageNodeDefUuid: string\n cycle?: string\n /** When set, only instances under this ancestor entity are aggregated. */\n scopeEntityUuid?: string\n}): EntitySubtreeStatus => {\n const { survey, record, pageNodeDefUuid, scopeEntityUuid } = params\n const instances = getNodesByDefUuid(pageNodeDefUuid)(record).filter((instance) =>\n scopeEntityUuid ? nodeIsUnderEntity({ node: instance, entityUuid: scopeEntityUuid }) : true\n )\n\n if (instances.length === 0) {\n return { hasErrors: false, hasWarnings: false, isComplete: false }\n }\n\n const instanceStatuses = instances\n .map((instance) => getEntitySubtreeStatus({ survey, record, entityUuid: instance.uuid, cycle: params.cycle }))\n .filter((status): status is EntitySubtreeStatus => status !== null)\n\n return {\n hasErrors: instanceStatuses.some((status) => status.hasErrors),\n hasWarnings: instanceStatuses.some((status) => status.hasWarnings),\n isComplete: instanceStatuses.length > 0 && instanceStatuses.every((status) => status.isComplete),\n }\n}\n\n/**\n * Whether the page has validation errors on its own fields (excluding nested page entities).\n */\nexport const pageHasOwnErrors = (params: {\n pageNodeDefUuid: string\n descendantPageUuids: string[]\n record: ArenaRecord\n}): boolean => getPageValidationStatus(params).hasErrors\n\n/**\n * Progress of pages without own-field validation errors over all survey pages.\n * Warnings do not reduce the score (matches Arena sidebar red-icon signal).\n */\nexport const getRecordPagesValidationProgress = (params: {\n survey: Survey\n record: ArenaRecord\n cycle?: string\n}): PagesValidationProgress | null => {\n const { survey, record } = params\n if (!getRoot(record)) return null\n\n const cycle = params.cycle ?? getCycle(record)\n const pageNodeDefs = getPageNodeDefs({ survey, cycle })\n const totalCount = pageNodeDefs.length\n if (totalCount === 0) return null\n\n let validCount = 0\n for (const pageNodeDef of pageNodeDefs) {\n const pageNodeDefUuid = pageNodeDef.uuid\n const descendantPageUuids = getDescendantPageNodeDefUuids({ survey, cycle, pageNodeDef })\n if (!pageHasOwnErrors({ pageNodeDefUuid, descendantPageUuids, record })) {\n validCount += 1\n }\n }\n\n const percent = Math.round((validCount / totalCount) * 100)\n return { percent, validCount, totalCount }\n}\n"]}
1
+ {"version":3,"file":"recordPagesValidation.js","sourceRoot":"","sources":["../../../../src/record/_records/recordPagesValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,WAAW,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAsB,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAe,OAAO,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAmBrF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAIjC,EAAW,EAAE;IACZ,MAAM,EAAE,IAAI,EAAE,eAAe,E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AAe,GAAG,WAAW,CAAC,IAAI,CAAA;QACxC,MAAM,mBAAmB,GAAG,6BAA6B,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAA;QACzF,IAAI,CAAC,gBAAgB,CAAC,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;YACxE,UAAU,IAAI,CAAC,CAAA;QACjB,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC,GAAG,GAAG,CAAC,CAAA;IAC3D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,CAAA;AAC5C,CAAC,CAAA","sourcesContent":["import { ArenaRecordNode, RecordNodes } from '../../node'\nimport { ArenaNodeDefEntity, NodeDefs } from '../../nodeDef'\nimport { ArenaSurvey, Surveys } from '../../survey'\nimport { Validations } from '../../validation'\nimport { ArenaRecord } from '../record'\nimport { RecordValidations } from '../recordValidations'\nimport { getEntityCompletionStats } from './recordCompletion'\nimport { getCycle, getNodeByUuid, getNodesByDefUuid, getRoot } from './recordGetters'\n\nexport type PageValidationStatus = {\n hasErrors: boolean\n hasWarnings: boolean\n}\n\nexport type EntitySubtreeStatus = {\n hasErrors: boolean\n hasWarnings: boolean\n isComplete: boolean\n}\n\nexport type PagesValidationProgress = {\n percent: number\n validCount: number\n totalCount: number\n}\n\n/**\n * Whether a node belongs under a page entity (itself or any descendant of that page).\n */\nexport const nodeBelongsToPage = (params: {\n node: ArenaRecordNode\n pageNodeDefUuid: string\n record: ArenaRecord\n}): boolean => {\n const { node, pageNodeDefUuid, record } = params\n if (node.nodeDefUuid === pageNodeDefUuid) return true\n return RecordNodes.getHierarchy(node).some((ancestorUuid) => {\n const ancestor = getNodeByUuid(ancestorUuid)(record)\n return ancestor?.nodeDefUuid === pageNodeDefUuid\n })\n}\n\n/**\n * Whether a node belongs to this page only — not to a nested descendant page entity.\n * When descendantPageUuids is empty, all nodes under the page hierarchy are included.\n */\nexport const nodeBelongsToOwnPage = (params: {\n node: ArenaRecordNode\n pageNodeDefUuid: string\n descendantPageUuids: string[]\n record: ArenaRecord\n}): boolean => {\n const { node, pageNodeDefUuid, descendantPageUuids, record } = params\n if (!nodeBelongsToPage({ node, pageNodeDefUuid, record })) return false\n if (descendantPageUuids.includes(node.nodeDefUuid)) return false\n return !descendantPageUuids.some((descendantUuid) =>\n nodeBelongsToPage({ node, pageNodeDefUuid: descendantUuid, record })\n )\n}\n\n/**\n * Child page-entity defs displayed in their own page under the given entity.\n */\nexport const getNodeDefChildrenInOwnPage = (params: {\n survey: ArenaSurvey\n nodeDef: ArenaNodeDefEntity\n cycle: string\n}): ArenaNodeDefEntity[] => {\n const { survey, nodeDef, cycle } = params\n return Surveys.getNodeDefChildren({ survey, nodeDef, includeAnalysis: true }).filter(\n (child): child is ArenaNodeDefEntity => {\n if (!NodeDefs.isEntity(child)) return false\n return NodeDefs.isDisplayInOwnPage(cycle)(child as ArenaNodeDefEntity)\n }\n )\n}\n\n/**\n * Collects all page-entity node defs in the survey cycle (root + nested own-pages).\n */\nexport const getPageNodeDefs = (params: { survey: ArenaSurvey; cycle: string }): ArenaNodeDefEntity[] => {\n const { survey, cycle } = params\n const root = Surveys.getNodeDefRoot({ survey }) as ArenaNodeDefEntity | undefined\n if (!root) return []\n\n const pages: ArenaNodeDefEntity[] = []\n const stack: ArenaNodeDefEntity[] = [root]\n while (stack.length > 0) {\n const current = stack.pop()\n if (!current) continue\n pages.push(current)\n stack.push(...getNodeDefChildrenInOwnPage({ survey, nodeDef: current, cycle }))\n }\n return pages\n}\n\n/**\n * Collects descendant page node def UUIDs under a page (not including the page itself).\n */\nexport const getDescendantPageNodeDefUuids = (params: {\n survey: ArenaSurvey\n cycle: string\n pageNodeDef: ArenaNodeDefEntity\n}): string[] => {\n const { survey, cycle, pageNodeDef } = params\n const uuids: string[] = []\n const visit = (nodeDef: ArenaNodeDefEntity) => {\n const children = getNodeDefChildrenInOwnPage({ survey, nodeDef, cycle })\n for (const child of children) {\n uuids.push(child.uuid)\n visit(child)\n }\n }\n visit(pageNodeDef)\n return uuids\n}\n\nconst nodeIsUnderEntity = (params: { node: ArenaRecordNode; entityUuid: string }): boolean => {\n const { node, entityUuid } = params\n if (node.uuid === entityUuid) return true\n return RecordNodes.getHierarchy(node).includes(entityUuid)\n}\n\nconst getOwnPageFieldValidationFlags = (params: {\n nodeUuid: string\n pageNodeDefUuid: string\n descendantPageUuids: string[]\n scopeEntityUuid?: string\n record: ArenaRecord\n recordValidation: ReturnType<typeof Validations.getValidation>\n}): PageValidationStatus | null => {\n const { nodeUuid, pageNodeDefUuid, descendantPageUuids, scopeEntityUuid, record, recordValidation } = params\n\n if (RecordValidations.isValidationChildrenCountKey(nodeUuid)) {\n return getOwnPageChildrenCountValidationFlags({\n childrenCountKey: nodeUuid,\n pageNodeDefUuid,\n descendantPageUuids,\n scopeEntityUuid,\n record,\n recordValidation,\n })\n }\n\n const node = getNodeByUuid(nodeUuid)(record)\n if (!node || !nodeBelongsToOwnPage({ node, pageNodeDefUuid, descendantPageUuids, record })) return null\n if (scopeEntityUuid && !nodeIsUnderEntity({ node, entityUuid: scopeEntityUuid })) return null\n\n const nodeValidation = RecordValidations.getValidationNode({ nodeUuid })(recordValidation)\n if (!nodeValidation) return null\n\n return {\n hasErrors: Validations.hasErrors(nodeValidation),\n hasWarnings: Validations.hasWarnings(nodeValidation),\n }\n}\n\n/**\n * Children-count validations (file min count, inline multiple min/max, etc.) are keyed as\n * `childrenCount_{parentUuid}_{childDefUuid}`, not as node UUIDs.\n * Include them when the parent is on this page, but skip counts that refer to descendant\n * page entities (missing sub-page instances should not paint the parent page red).\n */\nconst getOwnPageChildrenCountValidationFlags = (params: {\n childrenCountKey: string\n pageNodeDefUuid: string\n descendantPageUuids: string[]\n scopeEntityUuid?: string\n record: ArenaRecord\n recordValidation: ReturnType<typeof Validations.getValidation>\n}): PageValidationStatus | null => {\n const { childrenCountKey, pageNodeDefUuid, descendantPageUuids, scopeEntityUuid, record, recordValidation } = params\n const parentUuid = RecordValidations.extractValidationChildrenCountKeyParentUuid(childrenCountKey)\n const childDefUuid = RecordValidations.extractValidationChildrenCountKeyNodeDefUuid(childrenCountKey)\n if (!parentUuid || !childDefUuid) return null\n\n // Sub-page entity min/max counts belong to navigation of nested pages, not this page's fields.\n if (descendantPageUuids.includes(childDefUuid)) return null\n\n const parentNode = getNodeByUuid(parentUuid)(record)\n if (!parentNode || !nodeBelongsToOwnPage({ node: parentNode, pageNodeDefUuid, descendantPageUuids, record })) {\n return null\n }\n if (scopeEntityUuid && !nodeIsUnderEntity({ node: parentNode, entityUuid: scopeEntityUuid })) return null\n\n const fieldValidation = Validations.getFieldValidation(childrenCountKey)(recordValidation)\n if (!fieldValidation) return null\n\n return {\n hasErrors: Validations.hasErrors(fieldValidation),\n hasWarnings: Validations.hasWarnings(fieldValidation),\n }\n}\n\n/**\n * Aggregates error/warning flags for a page.\n * When descendantPageUuids is non-empty, nested page entities are excluded (own-page scope).\n * When scopeEntityUuid is set, only validations for nodes under that entity instance are included.\n */\nexport const getPageValidationStatus = (params: {\n pageNodeDefUuid: string\n descendantPageUuids?: string[]\n record: ArenaRecord\n scopeEntityUuid?: string\n}): PageValidationStatus => {\n const { pageNodeDefUuid, descendantPageUuids = [], record, scopeEntityUuid } = params\n const recordValidation = Validations.getValidation(record)\n const fields = Validations.getFieldValidations(recordValidation)\n let hasErrors = false\n let hasWarnings = false\n\n for (const nodeUuid of Object.keys(fields)) {\n const flags = getOwnPageFieldValidationFlags({\n nodeUuid,\n pageNodeDefUuid,\n descendantPageUuids,\n scopeEntityUuid,\n record,\n recordValidation,\n })\n if (!flags) continue\n if (flags.hasErrors) hasErrors = true\n if (flags.hasWarnings) hasWarnings = true\n if (hasErrors && hasWarnings) break\n }\n\n return { hasErrors, hasWarnings }\n}\n\nconst aggregatePageValidationStatuses = (statuses: PageValidationStatus[]): PageValidationStatus => ({\n hasErrors: statuses.some((status) => status.hasErrors),\n hasWarnings: statuses.some((status) => status.hasWarnings),\n})\n\n/**\n * Validation and completion status for one entity instance and its descendant pages.\n * Returns null when the node is missing or is not an entity.\n */\nexport const getEntitySubtreeStatus = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n entityUuid: string\n cycle?: string\n}): EntitySubtreeStatus | null => {\n const { survey, record, entityUuid } = params\n const entity = getNodeByUuid(entityUuid)(record)\n if (!entity) return null\n\n const entityDef = Surveys.getNodeDefByUuid({ survey, uuid: entity.nodeDefUuid })\n if (!NodeDefs.isEntity(entityDef)) return null\n\n const cycle = params.cycle ?? getCycle(record)\n const entityPageDef = entityDef as ArenaNodeDefEntity\n const descendantPageUuids = getDescendantPageNodeDefUuids({ survey, cycle, pageNodeDef: entityPageDef })\n const pageUuidsToCheck = [entity.nodeDefUuid, ...descendantPageUuids]\n\n const validationStatuses = pageUuidsToCheck.map((pageNodeDefUuid) => {\n const pageNodeDef = Surveys.getNodeDefByUuid({ survey, uuid: pageNodeDefUuid }) as ArenaNodeDefEntity\n const pageDescendantUuids = getDescendantPageNodeDefUuids({ survey, cycle, pageNodeDef })\n return getPageValidationStatus({\n pageNodeDefUuid,\n descendantPageUuids: pageDescendantUuids,\n record,\n scopeEntityUuid: entityUuid,\n })\n })\n\n const { hasErrors, hasWarnings } = aggregatePageValidationStatuses(validationStatuses)\n const { total, filled } = getEntityCompletionStats({ survey, record, entity })\n const isComplete = total > 0 && filled === total && !hasErrors && !hasWarnings\n\n return { hasErrors, hasWarnings, isComplete }\n}\n\n/**\n * Aggregates subtree status across instances of a multiple page entity.\n * When `scopeEntityUuid` is set, only instances under that ancestor entity are included\n * (needed for nested multiples, e.g. Tree under the currently selected Plot).\n * Empty instance lists return a non-complete status with no validation flags.\n */\nexport const getMultiplePageEntitiesStatus = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n pageNodeDefUuid: string\n cycle?: string\n /** When set, only instances under this ancestor entity are aggregated. */\n scopeEntityUuid?: string\n}): EntitySubtreeStatus => {\n const { survey, record, pageNodeDefUuid, scopeEntityUuid } = params\n const instances = getNodesByDefUuid(pageNodeDefUuid)(record).filter((instance) =>\n scopeEntityUuid ? nodeIsUnderEntity({ node: instance, entityUuid: scopeEntityUuid }) : true\n )\n\n if (instances.length === 0) {\n return { hasErrors: false, hasWarnings: false, isComplete: false }\n }\n\n const instanceStatuses = instances\n .map((instance) => getEntitySubtreeStatus({ survey, record, entityUuid: instance.uuid, cycle: params.cycle }))\n .filter((status): status is EntitySubtreeStatus => status !== null)\n\n return {\n hasErrors: instanceStatuses.some((status) => status.hasErrors),\n hasWarnings: instanceStatuses.some((status) => status.hasWarnings),\n isComplete: instanceStatuses.length > 0 && instanceStatuses.every((status) => status.isComplete),\n }\n}\n\n/**\n * Whether the page has validation errors on its own fields (excluding nested page entities).\n */\nexport const pageHasOwnErrors = (params: {\n pageNodeDefUuid: string\n descendantPageUuids: string[]\n record: ArenaRecord\n}): boolean => getPageValidationStatus(params).hasErrors\n\n/**\n * Progress of pages without own-field validation errors over all survey pages.\n * Warnings do not reduce the score (matches Arena sidebar red-icon signal).\n */\nexport const getRecordPagesValidationProgress = (params: {\n survey: ArenaSurvey\n record: ArenaRecord\n cycle?: string\n}): PagesValidationProgress | null => {\n const { survey, record } = params\n if (!getRoot(record)) return null\n\n const cycle = params.cycle ?? getCycle(record)\n const pageNodeDefs = getPageNodeDefs({ survey, cycle })\n const totalCount = pageNodeDefs.length\n if (totalCount === 0) return null\n\n let validCount = 0\n for (const pageNodeDef of pageNodeDefs) {\n const pageNodeDefUuid = pageNodeDef.uuid\n const descendantPageUuids = getDescendantPageNodeDefUuids({ survey, cycle, pageNodeDef })\n if (!pageHasOwnErrors({ pageNodeDefUuid, descendantPageUuids, record })) {\n validCount += 1\n }\n }\n\n const percent = Math.round((validCount / totalCount) * 100)\n return { percent, validCount, totalCount }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"recordUpdateOptions.js","sourceRoot":"","sources":["../../../../src/record/_records/recordUpdateOptions.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,2BAA2B,GAAwB;IAC9D,gBAAgB,EAAE,IAAI;IACtB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;CACjB,CAAA","sourcesContent":["import { MutationOptions } from '../../utils/mutationOptions'\n\nexport interface RecordUpdateOptions extends MutationOptions {\n updateNodesIndex?: boolean\n sortNodes?: boolean\n}\n\nexport const RecordUpdateOptionsDefaults: RecordUpdateOptions = {\n updateNodesIndex: true,\n sideEffect: false,\n sortNodes: false,\n}\n"]}
1
+ {"version":3,"file":"recordUpdateOptions.js","sourceRoot":"","sources":["../../../../src/record/_records/recordUpdateOptions.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,2BAA2B,GAA6B;IACnE,gBAAgB,EAAE,IAAI;IACtB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;CACjB,CAAA","sourcesContent":["import { ArenaMutationOptions } from '../../utils/mutationOptions'\n\nexport interface ArenaRecordUpdateOptions extends ArenaMutationOptions {\n updateNodesIndex?: boolean\n sortNodes?: boolean\n}\n\nexport const RecordUpdateOptionsDefaults: ArenaRecordUpdateOptions = {\n updateNodesIndex: true,\n sideEffect: false,\n sortNodes: false,\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"recordUpdater.js","sourceRoot":"","sources":["../../../../src/record/_records/recordUpdater.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAuB,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAExF,MAAM,CAAC,MAAM,QAAQ,GACnB,CAAC,KAAyC,EAAE,OAAO,GAAwB,2BAA2B,EAAE,EAAE,CAC1G,CAAC,MAAmB,EAAe,EAAE;IACnC,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE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CAAC,KAAK,CAAC;gBAClF,CAAC,CAAC,KAAK,CAAA;IACb,CAAC;IACD,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,OAAO,GAClB,CAAC,IAAqB,EAAE,OAAO,GAAwB,2BAA2B,EAAE,EAAE,CACtF,CAAC,MAAmB,EAAE,EAAE,CACtB,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA","sourcesContent":["import { ArenaRecordNode } from '../../node'\nimport { ArenaRecord } from '../record'\nimport * as RecordGetters from './recordGetters'\nimport { RecordNodesIndexUpdater } from './recordNodesIndexUpdater'\nimport { RecordUpdateOptions, RecordUpdateOptionsDefaults } from './recordUpdateOptions'\n\nexport const addNodes =\n (nodes: { [key: string]: ArenaRecordNode }, options: RecordUpdateOptions = RecordUpdateOptionsDefaults) =>\n (record: ArenaRecord): ArenaRecord => {\n const { sideEffect, updateNodesIndex, sortNodes } = { ...RecordUpdateOptionsDefaults, ...options }\n\n const recordUpdated = sideEffect ? record : { ...record }\n const recordNodes = RecordGetters.getNodes(recordUpdated)\n // index got before adding the new nodes (a missing index is built from the current record nodes)\n const index = updateNodesIndex ? RecordGetters.getNodesIndexOrBuild(recordUpdated) : {}\n\n // index only the nodes not already indexed with the same parent, node def and hierarchy code\n // (e.g. nodes with only an updated value don't need any index change)\n const nodesToIndex: { [key: string]: ArenaRecordNode } = {}\n if (updateNodesIndex) {\n for (const [nodeUuid, node] of Object.entries(nodes)) {\n const nodePrev = recordNodes[nodeUuid]\n if (!RecordNodesIndexUpdater.isNodeIndexUnchanged({ index, node, nodePrev })) {\n nodesToIndex[nodeUuid] = node\n }\n }\n }\n\n if (sideEffect) {\n recordUpdated.nodes = Object.assign(recordNodes, nodes)\n } else {\n recordUpdated.nodes = { ...recordNodes, ...nodes }\n }\n if (updateNodesIndex) {\n // store the index even with no nodes to add: it could have just been built, avoid building it again\n recordUpdated._nodesIndex =\n Object.keys(nodesToIndex).length > 0\n ? RecordNodesIndexUpdater.addNodes(nodesToIndex, { sideEffect, sortNodes })(index)\n : index\n }\n return recordUpdated\n }\n\nexport const addNode =\n (node: ArenaRecordNode, options: RecordUpdateOptions = RecordUpdateOptionsDefaults) =>\n (record: ArenaRecord) =>\n addNodes({ [node.uuid]: node }, options)(record)\n"]}
1
+ {"version":3,"file":"recordUpdater.js","sourceRoot":"","sources":["../../../../src/record/_records/recordUpdater.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAA4B,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AAE7F,MAAM,CAAC,MAAM,QAAQ,GACnB,CAAC,KAAyC,EAAE,OAAO,GAA6B,2BAA2B,EAAE,EAAE,CAC/G,CAAC,MAAmB,EAAe,EAAE;IACnC,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,mCAAQ,2BAA2B,GAAK,OAAO,CAAE,CAAA;IAElG,MAAM,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,mBAAM,MAAM,CAAE,CAAA;IACzD,MAAM,WAAW,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;IACzD,iGAAiG;IACjG,MAAM,KAAK,GAAG,gBAAgB,CAAC,CAAC,CAAC,aAAa,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAEvF,6FAA6F;IAC7F,sEAAsE;IACtE,MAAM,YAAY,GAAuC,EAAE,CAAA;IAC3D,IAAI,gBAAgB,EAAE,CAAC;QACrB,KAAK,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACrD,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAA;YACtC,IAAI,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;gBAC7E,YAAY,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACf,aAAa,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;IACzD,CAAC;SAAM,CAAC;QACN,aAAa,CAAC,KAAK,mCAAQ,WAAW,GAAK,KAAK,CAAE,CAAA;IACpD,CAAC;IACD,IAAI,gBAAgB,EAAE,CAAC;QACrB,oGAAoG;QACpG,aAAa,CAAC,WAAW;YACvB,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC;gBAClC,CAAC,CAAC,uBAAuB,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC;gBAClF,CAAC,CAAC,KAAK,CAAA;IACb,CAAC;IACD,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,OAAO,GAClB,CAAC,IAAqB,EAAE,OAAO,GAA6B,2BAA2B,EAAE,EAAE,CAC3F,CAAC,MAAmB,EAAE,EAAE,CACtB,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA","sourcesContent":["import { ArenaRecordNode } from '../../node'\nimport { ArenaRecord } from '../record'\nimport * as RecordGetters from './recordGetters'\nimport { RecordNodesIndexUpdater } from './recordNodesIndexUpdater'\nimport { ArenaRecordUpdateOptions, RecordUpdateOptionsDefaults } from './recordUpdateOptions'\n\nexport const addNodes =\n (nodes: { [key: string]: ArenaRecordNode }, options: ArenaRecordUpdateOptions = RecordUpdateOptionsDefaults) =>\n (record: ArenaRecord): ArenaRecord => {\n const { sideEffect, updateNodesIndex, sortNodes } = { ...RecordUpdateOptionsDefaults, ...options }\n\n const recordUpdated = sideEffect ? record : { ...record }\n const recordNodes = RecordGetters.getNodes(recordUpdated)\n // index got before adding the new nodes (a missing index is built from the current record nodes)\n const index = updateNodesIndex ? RecordGetters.getNodesIndexOrBuild(recordUpdated) : {}\n\n // index only the nodes not already indexed with the same parent, node def and hierarchy code\n // (e.g. nodes with only an updated value don't need any index change)\n const nodesToIndex: { [key: string]: ArenaRecordNode } = {}\n if (updateNodesIndex) {\n for (const [nodeUuid, node] of Object.entries(nodes)) {\n const nodePrev = recordNodes[nodeUuid]\n if (!RecordNodesIndexUpdater.isNodeIndexUnchanged({ index, node, nodePrev })) {\n nodesToIndex[nodeUuid] = node\n }\n }\n }\n\n if (sideEffect) {\n recordUpdated.nodes = Object.assign(recordNodes, nodes)\n } else {\n recordUpdated.nodes = { ...recordNodes, ...nodes }\n }\n if (updateNodesIndex) {\n // store the index even with no nodes to add: it could have just been built, avoid building it again\n recordUpdated._nodesIndex =\n Object.keys(nodesToIndex).length > 0\n ? RecordNodesIndexUpdater.addNodes(nodesToIndex, { sideEffect, sortNodes })(index)\n : index\n }\n return recordUpdated\n }\n\nexport const addNode =\n (node: ArenaRecordNode, options: ArenaRecordUpdateOptions = RecordUpdateOptionsDefaults) =>\n (record: ArenaRecord) =>\n addNodes({ [node.uuid]: node }, options)(record)\n"]}
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { NodeValues } from '../../node';
10
+ import { RecordNodeValues } from '../../node';
11
11
  import { NodeDefs, NodeDefType } from '../../nodeDef';
12
12
  import { Surveys } from '../../survey';
13
13
  import { getChildren, getDescendantsOrSelf, getParent, getParentCodeAttribute, getRoot, isNodeFilledByUser, } from './recordGetters';
@@ -46,7 +46,7 @@ export const getEnumeratingCategoryItems = (params) => (record) => __awaiter(voi
46
46
  const parentCodeDefUuid = NodeDefs.getParentCodeDefUuid(enumeratorDef);
47
47
  if (parentCodeDefUuid) {
48
48
  const parentCodeAttribute = getParentCodeAttribute(parentNode, enumeratorDef)(record);
49
- parentItemUuid = parentCodeAttribute ? NodeValues.getItemUuid(parentCodeAttribute) : null;
49
+ parentItemUuid = parentCodeAttribute ? RecordNodeValues.getItemUuid(parentCodeAttribute) : null;
50
50
  if (!parentItemUuid)
51
51
  return [];
52
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"recordUtils.js","sourceRoot":"","sources":["../../../../src/record/_records/recordUtils.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAmB,UAAU,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,EAAuC,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE1F,OAAO,EAAU,OAAO,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,SAAS,EACT,sBAAsB,EACtB,OAAO,EACP,kBAAkB,GACnB,MAAM,iBAAiB,CAAA;AAExB,MAAM,iCAAiC,GAAG,CAAC,MAAiD,EAAmB,EAAE;IAC/G,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAA;IAClC,MAAM,6BAA6B,GACjC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,IAAI;QAC5C,CAAC,CAAC,OAAO,CAAC,gCAAgC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAsB,EAAE,CAAC;QACvF,CAAC,CAAC,EAAE,CAAA;IAER,MAAM,uCAAuC,GAAG,OAAO,CAAC,2CAA2C,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;IACpH,6BAA6B,CAAC,IAAI,CAAC,GAAG,uCAAuC,CAAC,CAAA;IAE9E,OAAO,6B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AAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9F,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA,CAAA","sourcesContent":["import { CategoryItem } from '../../category'\nimport { ArenaRecordNode, NodeValues } from '../../node'\nimport { NodeDef, NodeDefCode, NodeDefEntity, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { CategoryItemProvider } from '../../nodeDefExpressionEvaluator/categoryItemProvider'\nimport { Survey, Surveys } from '../../survey'\nimport { ArenaRecord } from '../record'\nimport {\n getChildren,\n getDescendantsOrSelf,\n getParent,\n getParentCodeAttribute,\n getRoot,\n isNodeFilledByUser,\n} from './recordGetters'\n\nconst findDependentEnumeratedEntityDefs = (params: { survey: Survey; nodeDef: NodeDef<any> }): NodeDefEntity[] => {\n const { survey, nodeDef } = params\n const dependentEnumeratedEntityDefs =\n NodeDefs.getType(nodeDef) === NodeDefType.code\n ? Surveys.getDependentEnumeratedEntityDefs({ survey, nodeDef: nodeDef as NodeDefCode })\n : []\n\n const applicableDependentEnumeratedEntityDefs = Surveys.findApplicableDependentEnumeratedEntityDefs(nodeDef)(survey)\n dependentEnumeratedEntityDefs.push(...applicableDependentEnumeratedEntityDefs)\n\n return dependentEnumeratedEntityDefs\n}\n\nconst hasNodeNonEmptyDescendants = (params: {\n record: ArenaRecord\n parentNode: ArenaRecordNode | undefined\n nodeDefDescendant: NodeDefEntity\n}): boolean => {\n const { record, parentNode, nodeDefDescendant } = params\n const descendants = getDescendantsOrSelf(parentNode ?? getRoot(record)!, nodeDefDescendant)(record)\n const nonEmptyDescendants = descendants.filter((dependentEntity) =>\n getChildren(dependentEntity)(record).some((childNode) => isNodeFilledByUser(childNode)(record))\n )\n return nonEmptyDescendants.length > 0\n}\n\nexport const findDependentEnumeratedEntityDefsNotEmpty =\n (params: { survey: Survey; node: ArenaRecordNode; nodeDef: NodeDef<any> }) => (record: ArenaRecord) => {\n const { survey, node, nodeDef } = params\n const dependentEnumeratedEntityDefs = findDependentEnumeratedEntityDefs({ survey, nodeDef })\n if (dependentEnumeratedEntityDefs.length === 0) return []\n\n const parentNode = getParent(node)(record)\n\n return dependentEnumeratedEntityDefs.filter((dependentEnumeratedEntityDef) =>\n hasNodeNonEmptyDescendants({ record, parentNode, nodeDefDescendant: dependentEnumeratedEntityDef })\n )\n }\n\nexport const getEnumeratingCategoryItems =\n (params: {\n survey: Survey\n enumeratorDef: NodeDefCode\n parentNode: ArenaRecordNode\n categoryItemProvider?: CategoryItemProvider\n allowedCodes?: Set<string>\n }) =>\n async (record: ArenaRecord): Promise<CategoryItem[]> => {\n const { survey, enumeratorDef, parentNode, categoryItemProvider, allowedCodes } = params\n const categoryUuid = NodeDefs.getCategoryUuid(enumeratorDef)\n if (!categoryUuid) return []\n const category = Surveys.getCategoryByUuid({ survey, categoryUuid })\n if (!category) return []\n\n let parentItemUuid\n const parentCodeDefUuid = NodeDefs.getParentCodeDefUuid(enumeratorDef)\n if (parentCodeDefUuid) {\n const parentCodeAttribute = getParentCodeAttribute(parentNode, enumeratorDef)(record)\n parentItemUuid = parentCodeAttribute ? NodeValues.getItemUuid(parentCodeAttribute) : null\n if (!parentItemUuid) return []\n }\n let items = Surveys.getEnumeratingCategoryItems({ survey, enumerator: enumeratorDef, parentItemUuid })\n if (items.length === 0 && categoryItemProvider) {\n items = await categoryItemProvider.getItems({ survey, categoryUuid, parentItemUuid, draft: !!record.preview })\n }\n if (allowedCodes) {\n items = items.filter((item) => item.props.code != null && allowedCodes.has(item.props.code))\n }\n return items\n }\n"]}
1
+ {"version":3,"file":"recordUtils.js","sourceRoot":"","sources":["../../../../src/record/_records/recordUtils.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAmB,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAsD,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAA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,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA;QACrF,cAAc,GAAG,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAC/F,IAAI,CAAC,cAAc;YAAE,OAAO,EAAE,CAAA;IAChC,CAAC;IACD,IAAI,KAAK,GAAG,OAAO,CAAC,2BAA2B,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC,CAAA;IACtG,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,oBAAoB,EAAE,CAAC;QAC/C,KAAK,GAAG,MAAM,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;IAChH,CAAC;IACD,IAAI,YAAY,EAAE,CAAC;QACjB,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9F,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA,CAAA","sourcesContent":["import { ArenaCategoryItem } from '../../category'\nimport { ArenaRecordNode, RecordNodeValues } from '../../node'\nimport { ArenaNodeDef, ArenaNodeDefCode, ArenaNodeDefEntity, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { ArenaCategoryItemProvider } from '../../nodeDefExpressionEvaluator/categoryItemProvider'\nimport { ArenaSurvey, Surveys } from '../../survey'\nimport { ArenaRecord } from '../record'\nimport {\n getChildren,\n getDescendantsOrSelf,\n getParent,\n getParentCodeAttribute,\n getRoot,\n isNodeFilledByUser,\n} from './recordGetters'\n\nconst findDependentEnumeratedEntityDefs = (params: {\n survey: ArenaSurvey\n nodeDef: ArenaNodeDef<any>\n}): ArenaNodeDefEntity[] => {\n const { survey, nodeDef } = params\n const dependentEnumeratedEntityDefs =\n NodeDefs.getType(nodeDef) === NodeDefType.code\n ? Surveys.getDependentEnumeratedEntityDefs({ survey, nodeDef: nodeDef as ArenaNodeDefCode })\n : []\n\n const applicableDependentEnumeratedEntityDefs = Surveys.findApplicableDependentEnumeratedEntityDefs(nodeDef)(survey)\n dependentEnumeratedEntityDefs.push(...applicableDependentEnumeratedEntityDefs)\n\n return dependentEnumeratedEntityDefs\n}\n\nconst hasNodeNonEmptyDescendants = (params: {\n record: ArenaRecord\n parentNode: ArenaRecordNode | undefined\n nodeDefDescendant: ArenaNodeDefEntity\n}): boolean => {\n const { record, parentNode, nodeDefDescendant } = params\n const descendants = getDescendantsOrSelf(parentNode ?? getRoot(record)!, nodeDefDescendant)(record)\n const nonEmptyDescendants = descendants.filter((dependentEntity) =>\n getChildren(dependentEntity)(record).some((childNode) => isNodeFilledByUser(childNode)(record))\n )\n return nonEmptyDescendants.length > 0\n}\n\nexport const findDependentEnumeratedEntityDefsNotEmpty =\n (params: { survey: ArenaSurvey; node: ArenaRecordNode; nodeDef: ArenaNodeDef<any> }) => (record: ArenaRecord) => {\n const { survey, node, nodeDef } = params\n const dependentEnumeratedEntityDefs = findDependentEnumeratedEntityDefs({ survey, nodeDef })\n if (dependentEnumeratedEntityDefs.length === 0) return []\n\n const parentNode = getParent(node)(record)\n\n return dependentEnumeratedEntityDefs.filter((dependentEnumeratedEntityDef) =>\n hasNodeNonEmptyDescendants({ record, parentNode, nodeDefDescendant: dependentEnumeratedEntityDef })\n )\n }\n\nexport const getEnumeratingCategoryItems =\n (params: {\n survey: ArenaSurvey\n enumeratorDef: ArenaNodeDefCode\n parentNode: ArenaRecordNode\n categoryItemProvider?: ArenaCategoryItemProvider\n allowedCodes?: Set<string>\n }) =>\n async (record: ArenaRecord): Promise<ArenaCategoryItem[]> => {\n const { survey, enumeratorDef, parentNode, categoryItemProvider, allowedCodes } = params\n const categoryUuid = NodeDefs.getCategoryUuid(enumeratorDef)\n if (!categoryUuid) return []\n const category = Surveys.getCategoryByUuid({ survey, categoryUuid })\n if (!category) return []\n\n let parentItemUuid\n const parentCodeDefUuid = NodeDefs.getParentCodeDefUuid(enumeratorDef)\n if (parentCodeDefUuid) {\n const parentCodeAttribute = getParentCodeAttribute(parentNode, enumeratorDef)(record)\n parentItemUuid = parentCodeAttribute ? RecordNodeValues.getItemUuid(parentCodeAttribute) : null\n if (!parentItemUuid) return []\n }\n let items = Surveys.getEnumeratingCategoryItems({ survey, enumerator: enumeratorDef, parentItemUuid })\n if (items.length === 0 && categoryItemProvider) {\n items = await categoryItemProvider.getItems({ survey, categoryUuid, parentItemUuid, draft: !!record.preview })\n }\n if (allowedCodes) {\n items = items.filter((item) => item.props.code != null && allowedCodes.has(item.props.code))\n }\n return items\n }\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/record/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAQ,KAAK,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,EAAe,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAahC,MAAM,CAAC,MAAM,aAAa,GAA8C;IACtE,cAAc,EAAE,CAAC,MAA2B,EAAe,EAAE;;;QAC3D,MAAM,YAAY,GAAG;YACnB,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,mBAAmB;SAC1B,CAAA;QAED,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,mCACjE,YAAY,GACZ,MAAM,CACV,CAAA;QAED,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,UAAU,0CAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,UAAU,CAAC,CAAA;QACrF,MAAM,SAAS,SAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,mCAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;QAE1G,uBACE,KAAK;YACL,WAAW,EACX,UAAU,EAAE,IAAI,CAAC,KAAK,EACtB,SAAS,EAAE,IAAI,CAAC,IAAI,EACpB,SAAS,EACT,SAAS,EAAE,IAAI,CAAC,IAAI,EACpB,OAAO;YACP,IAAI;YACJ,UAAU,EACV,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,IACb,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EACvD;IACH,CAAC;CACF,CAAA","sourcesContent":["import { Factory } from '../common'\nimport { AuthGroupName, User, Users } from '../auth'\nimport { ArenaRecord, RECORD_STEP_DEFAULT } from './record'\nimport { UUIDs } from '../utils'\nimport { AppInfo } from '../app'\n\nexport type RecordFactoryParams = {\n cycle?: string\n dateCreated?: string\n preview?: boolean\n surveyUuid: string\n step?: string\n user: User\n appInfo?: AppInfo\n}\n\nexport const RecordFactory: Factory<ArenaRecord, RecordFactoryParams> = {\n createInstance: (params: RecordFactoryParams): ArenaRecord => {\n const defaultProps = {\n preview: false,\n step: RECORD_STEP_DEFAULT,\n }\n\n const { appInfo, cycle, dateCreated, preview, step, surveyUuid, user } = {\n ...defaultProps,\n ...params,\n }\n\n const surveyGroup = user.authGroups?.find((group) => group.surveyUuid === surveyUuid)\n const ownerRole = surveyGroup?.name ?? (Users.isSystemAdmin(user) ? AuthGroupName.systemAdmin : undefined)\n\n return {\n cycle,\n dateCreated,\n ownerEmail: user.email,\n ownerName: user.name,\n ownerRole,\n ownerUuid: user.uuid,\n preview,\n step,\n surveyUuid,\n uuid: UUIDs.v4(),\n ...(appInfo ? { info: { createdWith: appInfo } } : {}),\n }\n },\n}\n"]}
1
+ {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/record/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAa,KAAK,EAAE,MAAM,SAAS,CAAA;AACzD,OAAO,EAAe,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAahC,MAAM,CAAC,MAAM,aAAa,GAAmD;IAC3E,cAAc,EAAE,CAAC,MAA2B,EAAe,EAAE;;;QAC3D,MAAM,YAAY,GAAG;YACnB,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,mBAAmB;SAC1B,CAAA;QAED,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,mCACjE,YAAY,GACZ,MAAM,CACV,CAAA;QAED,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,UAAU,0CAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,KAAK,UAAU,CAAC,CAAA;QACrF,MAAM,SAAS,SAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,mCAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;QAE1G,uBACE,KAAK;YACL,WAAW,EACX,UAAU,EAAE,IAAI,CAAC,KAAK,EACtB,SAAS,EAAE,IAAI,CAAC,IAAI,EACpB,SAAS,EACT,SAAS,EAAE,IAAI,CAAC,IAAI,EACpB,OAAO;YACP,IAAI;YACJ,UAAU,EACV,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,IACb,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EACvD;IACH,CAAC;CACF,CAAA","sourcesContent":["import { ArenaFactory } from '../common'\nimport { AuthGroupName, ArenaUser, Users } from '../auth'\nimport { ArenaRecord, RECORD_STEP_DEFAULT } from './record'\nimport { UUIDs } from '../utils'\nimport { ArenaAppInfo } from '../app'\n\nexport type RecordFactoryParams = {\n cycle?: string\n dateCreated?: string\n preview?: boolean\n surveyUuid: string\n step?: string\n user: ArenaUser\n appInfo?: ArenaAppInfo\n}\n\nexport const RecordFactory: ArenaFactory<ArenaRecord, RecordFactoryParams> = {\n createInstance: (params: RecordFactoryParams): ArenaRecord => {\n const defaultProps = {\n preview: false,\n step: RECORD_STEP_DEFAULT,\n }\n\n const { appInfo, cycle, dateCreated, preview, step, surveyUuid, user } = {\n ...defaultProps,\n ...params,\n }\n\n const surveyGroup = user.authGroups?.find((group) => group.surveyUuid === surveyUuid)\n const ownerRole = surveyGroup?.name ?? (Users.isSystemAdmin(user) ? AuthGroupName.systemAdmin : undefined)\n\n return {\n cycle,\n dateCreated,\n ownerEmail: user.email,\n ownerName: user.name,\n ownerRole,\n ownerUuid: user.uuid,\n preview,\n step,\n surveyUuid,\n uuid: UUIDs.v4(),\n ...(appInfo ? { info: { createdWith: appInfo } } : {}),\n }\n },\n}\n"]}
@@ -1,4 +1,4 @@
1
- export { NodePointers } from './nodePointers';
1
+ export { RecordNodePointers } from './nodePointers';
2
2
  export { RECORD_STEP_DEFAULT } from './record';
3
3
  export { RecordStepAnalysisCode, RecordStepCleansingCode, RecordStepEntryCode, RecordStepNames, RecordSteps, RecordStepsList, } from './recordStep';
4
4
  export { Records } from './records';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/record/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAG9C,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,eAAe,GAChB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAE7E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAOnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAGzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA","sourcesContent":["export { NodePointers } from './nodePointers'\n\nexport type { ArenaRecord, Record } from './record'\nexport { RECORD_STEP_DEFAULT } from './record'\n\nexport type { RecordStep } from './recordStep'\nexport {\n RecordStepAnalysisCode,\n RecordStepCleansingCode,\n RecordStepEntryCode,\n RecordStepNames,\n RecordSteps,\n RecordStepsList,\n} from './recordStep'\n\nexport { Records } from './records'\nexport type { RecordUpdateOptions } from './records'\n\nexport { RecordCloner } from './recordCloner'\nexport { RecordExpressionEvaluator } from './recordExpressionEvaluator'\nexport type { RecordExpressionContext } from './recordExpressionEvaluator'\nexport { RecordFixer } from './recordFixer'\nexport { RecordNodesUpdater, RecordUpdateResult } from './recordNodesUpdater'\nexport type { NodeCreateParams, NodesUpdateParams, RecordExpressionEvaluationContext } from './recordNodesUpdater'\nexport { RecordUpdater } from './recordUpdater'\nexport { RecordValidator } from './recordValidator'\nexport type {\n AttributeValidatorParams,\n AttributesValidatorParams,\n RecordValidatorParams,\n SortedAttributesValidatorParams,\n} from './recordValidator'\nexport { RecordValidations } from './recordValidations'\n\nexport { RecordFactory } from './factory'\nexport type { RecordService } from './service'\n\nexport { RecordPrettyPrinter } from './recordPrettyPrinter'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/record/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAGnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAG9C,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,eAAe,GAChB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAM7E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAOnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAGzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA","sourcesContent":["export { RecordNodePointers } from './nodePointers'\n\nexport type { ArenaRecord } from './record'\nexport { RECORD_STEP_DEFAULT } from './record'\n\nexport type { ArenaRecordStep } from './recordStep'\nexport {\n RecordStepAnalysisCode,\n RecordStepCleansingCode,\n RecordStepEntryCode,\n RecordStepNames,\n RecordSteps,\n RecordStepsList,\n} from './recordStep'\n\nexport { Records } from './records'\nexport type { ArenaRecordUpdateOptions } from './records'\n\nexport { RecordCloner } from './recordCloner'\nexport { RecordExpressionEvaluator } from './recordExpressionEvaluator'\nexport type { ArenaRecordExpressionContext } from './recordExpressionEvaluator'\nexport { RecordFixer } from './recordFixer'\nexport { RecordNodesUpdater, RecordUpdateResult } from './recordNodesUpdater'\nexport type {\n ArenaRecordNodeCreateParams,\n ArenaRecordNodesUpdateParams,\n ArenaRecordExpressionEvaluationContext,\n} from './recordNodesUpdater'\nexport { RecordUpdater } from './recordUpdater'\nexport { RecordValidator } from './recordValidator'\nexport type {\n ArenaAttributeValidatorParams,\n ArenaAttributesValidatorParams,\n ArenaRecordValidatorParams,\n ArenaSortedAttributesValidatorParams,\n} from './recordValidator'\nexport { RecordValidations } from './recordValidations'\n\nexport { RecordFactory } from './factory'\nexport type { ArenaRecordService } from './service'\n\nexport { RecordPrettyPrinter } from './recordPrettyPrinter'\n"]}
@@ -11,7 +11,7 @@ const getNodesMapFromNodePointers = (params) => {
11
11
  }
12
12
  return nodesMap;
13
13
  };
14
- export const NodePointers = {
14
+ export const RecordNodePointers = {
15
15
  getNodesFromNodePointers,
16
16
  getNodesMapFromNodePointers,
17
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"nodePointers.js","sourceRoot":"","sources":["../../../src/record/nodePointers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,wBAAwB,GAAG,CAAC,MAA4D,EAAqB,EAAE;IACnH,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAAA;IAEvC,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAC1C,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAC3E,CAAA;AACH,CAAC,CAAA;AAED,MAAM,2BAA2B,GAAG,CAAC,MAGpC,EAAsC,EAAE;IACvC,MAAM,KAAK,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAA;IAC9C,MAAM,QAAQ,GAAuC,EAAE,CAAA;IACvD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC5B,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,wBAAwB;IACxB,2BAA2B;CAC5B,CAAA","sourcesContent":["import { ArenaRecordNode, NodePointer } from '../node'\nimport { ArenaRecord } from './record'\nimport { Records } from './records'\n\nconst getNodesFromNodePointers = (params: { record: ArenaRecord; nodePointers: NodePointer[] }): ArenaRecordNode[] => {\n const { record, nodePointers } = params\n\n return nodePointers.flatMap((nodePointer) =>\n Records.getChildren(nodePointer.nodeCtx, nodePointer.nodeDef.uuid)(record)\n )\n}\n\nconst getNodesMapFromNodePointers = (params: {\n record: ArenaRecord\n nodePointers: NodePointer[]\n}): { [key: string]: ArenaRecordNode } => {\n const nodes = getNodesFromNodePointers(params)\n const nodesMap: { [key: string]: ArenaRecordNode } = {}\n for (const node of nodes) {\n nodesMap[node.uuid] = node\n }\n return nodesMap\n}\n\nexport const NodePointers = {\n getNodesFromNodePointers,\n getNodesMapFromNodePointers,\n}\n"]}
1
+ {"version":3,"file":"nodePointers.js","sourceRoot":"","sources":["../../../src/record/nodePointers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,wBAAwB,GAAG,CAAC,MAGjC,EAAqB,EAAE;IACtB,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAAA;IAEvC,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAC1C,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAC3E,CAAA;AACH,CAAC,CAAA;AAED,MAAM,2BAA2B,GAAG,CAAC,MAGpC,EAAsC,EAAE;IACvC,MAAM,KAAK,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAA;IAC9C,MAAM,QAAQ,GAAuC,EAAE,CAAA;IACvD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC5B,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,wBAAwB;IACxB,2BAA2B;CAC5B,CAAA","sourcesContent":["import { ArenaRecordNode, ArenaRecordNodePointer } from '../node'\nimport { ArenaRecord } from './record'\nimport { Records } from './records'\n\nconst getNodesFromNodePointers = (params: {\n record: ArenaRecord\n nodePointers: ArenaRecordNodePointer[]\n}): ArenaRecordNode[] => {\n const { record, nodePointers } = params\n\n return nodePointers.flatMap((nodePointer) =>\n Records.getChildren(nodePointer.nodeCtx, nodePointer.nodeDef.uuid)(record)\n )\n}\n\nconst getNodesMapFromNodePointers = (params: {\n record: ArenaRecord\n nodePointers: ArenaRecordNodePointer[]\n}): { [key: string]: ArenaRecordNode } => {\n const nodes = getNodesFromNodePointers(params)\n const nodesMap: { [key: string]: ArenaRecordNode } = {}\n for (const node of nodes) {\n nodesMap[node.uuid] = node\n }\n return nodesMap\n}\n\nexport const RecordNodePointers = {\n getNodesFromNodePointers,\n getNodesMapFromNodePointers,\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"record.js","sourceRoot":"","sources":["../../../src/record/record.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAEtC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC,CAAA","sourcesContent":["import { AppInfo } from '../app'\nimport { ArenaRecordNode } from '../node'\nimport { Validation } from '../validation'\n\nexport const RECORD_STEP_DEFAULT = '1'\n\nexport const steps = ['entry', 'cleansing', 'analysis']\n\ninterface NodeUuidsPresence {\n [key: string]: boolean\n}\n\nexport interface RecordNodesIndex {\n /**\n * uuid of root entity\n */\n nodeRootUuid?: string\n /**\n * node uuids by parent entity uuid and child def uuid\n */\n nodesByParentAndChildDef?: { [key: string]: { [key: string]: NodeUuidsPresence } }\n /**\n * node uuids by node def uuid\n */\n nodesByDef?: { [key: string]: NodeUuidsPresence }\n /**\n * Code attribute uuids by ancenstor code attribute uuid\n */\n nodeCodeDependents?: { [key: string]: NodeUuidsPresence }\n}\n\nexport interface RecordInfo {\n createdWith?: AppInfo\n updatedWith?: AppInfo\n}\n\nexport interface ArenaRecord {\n cycle?: string\n dateCreated?: string\n dateModified?: string\n id?: number\n nodes?: { [uuid: string]: ArenaRecordNode }\n ownerEmail?: string\n ownerName: string\n ownerRole?: string\n ownerUuid: string\n preview?: boolean\n step: string // in steps\n surveyId?: number\n surveyUuid?: string\n uuid: string\n validation?: Validation\n\n _nodesIndex?: RecordNodesIndex\n\n info?: RecordInfo\n}\n\n/**\n * @deprecated Use ArenaRecord: this name shadows the TypeScript built-in Record utility type.\n * It will be removed in the next major version.\n */\nexport type Record = ArenaRecord\n"]}
1
+ {"version":3,"file":"record.js","sourceRoot":"","sources":["../../../src/record/record.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAEtC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC,CAAA","sourcesContent":["import { ArenaAppInfo } from '../app'\nimport { ArenaRecordNode } from '../node'\nimport { ArenaValidation } from '../validation'\n\nexport const RECORD_STEP_DEFAULT = '1'\n\nexport const steps = ['entry', 'cleansing', 'analysis']\n\ninterface NodeUuidsPresence {\n [key: string]: boolean\n}\n\nexport interface RecordNodesIndex {\n /**\n * uuid of root entity\n */\n nodeRootUuid?: string\n /**\n * node uuids by parent entity uuid and child def uuid\n */\n nodesByParentAndChildDef?: { [key: string]: { [key: string]: NodeUuidsPresence } }\n /**\n * node uuids by node def uuid\n */\n nodesByDef?: { [key: string]: NodeUuidsPresence }\n /**\n * Code attribute uuids by ancenstor code attribute uuid\n */\n nodeCodeDependents?: { [key: string]: NodeUuidsPresence }\n}\n\nexport interface RecordInfo {\n createdWith?: ArenaAppInfo\n updatedWith?: ArenaAppInfo\n}\n\nexport interface ArenaRecord {\n cycle?: string\n dateCreated?: string\n dateModified?: string\n id?: number\n nodes?: { [uuid: string]: ArenaRecordNode }\n ownerEmail?: string\n ownerName: string\n ownerRole?: string\n ownerUuid: string\n preview?: boolean\n step: string // in steps\n surveyId?: number\n surveyUuid?: string\n uuid: string\n validation?: ArenaValidation\n\n _nodesIndex?: RecordNodesIndex\n\n info?: RecordInfo\n}\n"]}