@defra/forms-model 3.0.2

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 (336) hide show
  1. package/LICENCE +8 -0
  2. package/README.md +22 -0
  3. package/dist/browser/components/component-types.d.ts +3 -0
  4. package/dist/browser/components/component-types.d.ts.map +1 -0
  5. package/dist/browser/components/component-types.js +220 -0
  6. package/dist/browser/components/component-types.js.map +1 -0
  7. package/dist/browser/components/conditional-component-types.d.ts +3 -0
  8. package/dist/browser/components/conditional-component-types.d.ts.map +1 -0
  9. package/dist/browser/components/conditional-component-types.js +28 -0
  10. package/dist/browser/components/conditional-component-types.js.map +1 -0
  11. package/dist/browser/components/index.d.ts +4 -0
  12. package/dist/browser/components/index.d.ts.map +1 -0
  13. package/dist/browser/components/index.js +45 -0
  14. package/dist/browser/components/index.js.map +1 -0
  15. package/dist/browser/components/types.d.ts +244 -0
  16. package/dist/browser/components/types.d.ts.map +1 -0
  17. package/dist/browser/components/types.js +56 -0
  18. package/dist/browser/components/types.js.map +1 -0
  19. package/dist/browser/conditions/condition-abstract.d.ts +16 -0
  20. package/dist/browser/conditions/condition-abstract.d.ts.map +1 -0
  21. package/dist/browser/conditions/condition-abstract.js +62 -0
  22. package/dist/browser/conditions/condition-abstract.js.map +1 -0
  23. package/dist/browser/conditions/condition-field.d.ts +13 -0
  24. package/dist/browser/conditions/condition-field.d.ts.map +1 -0
  25. package/dist/browser/conditions/condition-field.js +45 -0
  26. package/dist/browser/conditions/condition-field.js.map +1 -0
  27. package/dist/browser/conditions/condition-group-def.d.ts +10 -0
  28. package/dist/browser/conditions/condition-group-def.d.ts.map +1 -0
  29. package/dist/browser/conditions/condition-group-def.js +45 -0
  30. package/dist/browser/conditions/condition-group-def.js.map +1 -0
  31. package/dist/browser/conditions/condition-group.d.ts +15 -0
  32. package/dist/browser/conditions/condition-group.d.ts.map +1 -0
  33. package/dist/browser/conditions/condition-group.js +64 -0
  34. package/dist/browser/conditions/condition-group.js.map +1 -0
  35. package/dist/browser/conditions/condition-model.d.ts +41 -0
  36. package/dist/browser/conditions/condition-model.d.ts.map +1 -0
  37. package/dist/browser/conditions/condition-model.js +214 -0
  38. package/dist/browser/conditions/condition-model.js.map +1 -0
  39. package/dist/browser/conditions/condition-operators.d.ts +248 -0
  40. package/dist/browser/conditions/condition-operators.d.ts.map +1 -0
  41. package/dist/browser/conditions/condition-operators.js +132 -0
  42. package/dist/browser/conditions/condition-operators.js.map +1 -0
  43. package/dist/browser/conditions/condition-ref.d.ts +12 -0
  44. package/dist/browser/conditions/condition-ref.d.ts.map +1 -0
  45. package/dist/browser/conditions/condition-ref.js +51 -0
  46. package/dist/browser/conditions/condition-ref.js.map +1 -0
  47. package/dist/browser/conditions/condition-value-abstract.d.ts +8 -0
  48. package/dist/browser/conditions/condition-value-abstract.d.ts.map +1 -0
  49. package/dist/browser/conditions/condition-value-abstract.js +41 -0
  50. package/dist/browser/conditions/condition-value-abstract.js.map +1 -0
  51. package/dist/browser/conditions/condition-value-registration.d.ts +10 -0
  52. package/dist/browser/conditions/condition-value-registration.d.ts.map +1 -0
  53. package/dist/browser/conditions/condition-value-registration.js +37 -0
  54. package/dist/browser/conditions/condition-value-registration.js.map +1 -0
  55. package/dist/browser/conditions/condition-values.d.ts +38 -0
  56. package/dist/browser/conditions/condition-values.d.ts.map +1 -0
  57. package/dist/browser/conditions/condition-values.js +127 -0
  58. package/dist/browser/conditions/condition-values.js.map +1 -0
  59. package/dist/browser/conditions/condition.d.ts +15 -0
  60. package/dist/browser/conditions/condition.d.ts.map +1 -0
  61. package/dist/browser/conditions/condition.js +56 -0
  62. package/dist/browser/conditions/condition.js.map +1 -0
  63. package/dist/browser/conditions/helpers.d.ts +3 -0
  64. package/dist/browser/conditions/helpers.d.ts.map +1 -0
  65. package/dist/browser/conditions/helpers.js +26 -0
  66. package/dist/browser/conditions/helpers.js.map +1 -0
  67. package/dist/browser/conditions/index.d.ts +11 -0
  68. package/dist/browser/conditions/index.d.ts.map +1 -0
  69. package/dist/browser/conditions/index.js +144 -0
  70. package/dist/browser/conditions/index.js.map +1 -0
  71. package/dist/browser/conditions/inline-condition-model.d.ts +86 -0
  72. package/dist/browser/conditions/inline-condition-model.d.ts.map +1 -0
  73. package/dist/browser/conditions/inline-condition-model.js +418 -0
  74. package/dist/browser/conditions/inline-condition-model.js.map +1 -0
  75. package/dist/browser/conditions/inline-condition-operators.d.ts +175 -0
  76. package/dist/browser/conditions/inline-condition-operators.d.ts.map +1 -0
  77. package/dist/browser/conditions/inline-condition-operators.js +132 -0
  78. package/dist/browser/conditions/inline-condition-operators.js.map +1 -0
  79. package/dist/browser/conditions/inline-condition-values.d.ts +93 -0
  80. package/dist/browser/conditions/inline-condition-values.d.ts.map +1 -0
  81. package/dist/browser/conditions/inline-condition-values.js +159 -0
  82. package/dist/browser/conditions/inline-condition-values.js.map +1 -0
  83. package/dist/browser/conditions/types.d.ts +38 -0
  84. package/dist/browser/conditions/types.d.ts.map +1 -0
  85. package/dist/browser/conditions/types.js +24 -0
  86. package/dist/browser/conditions/types.js.map +1 -0
  87. package/dist/browser/data-model/conditions-wrapper.d.ts +19 -0
  88. package/dist/browser/data-model/conditions-wrapper.d.ts.map +1 -0
  89. package/dist/browser/data-model/conditions-wrapper.js +49 -0
  90. package/dist/browser/data-model/conditions-wrapper.js.map +1 -0
  91. package/dist/browser/data-model/index.d.ts +4 -0
  92. package/dist/browser/data-model/index.d.ts.map +1 -0
  93. package/dist/browser/data-model/index.js +66 -0
  94. package/dist/browser/data-model/index.js.map +1 -0
  95. package/dist/browser/data-model/input-wrapper.d.ts +16 -0
  96. package/dist/browser/data-model/input-wrapper.d.ts.map +1 -0
  97. package/dist/browser/data-model/input-wrapper.js +49 -0
  98. package/dist/browser/data-model/input-wrapper.js.map +1 -0
  99. package/dist/browser/data-model/types.d.ts +153 -0
  100. package/dist/browser/data-model/types.d.ts.map +1 -0
  101. package/dist/browser/data-model/types.js +34 -0
  102. package/dist/browser/data-model/types.js.map +1 -0
  103. package/dist/browser/form/form-configuration.d.ts +8 -0
  104. package/dist/browser/form/form-configuration.d.ts.map +1 -0
  105. package/dist/browser/form/form-configuration.js +38 -0
  106. package/dist/browser/form/form-configuration.js.map +1 -0
  107. package/dist/browser/form/index.d.ts +2 -0
  108. package/dist/browser/form/index.d.ts.map +1 -0
  109. package/dist/browser/form/index.js +24 -0
  110. package/dist/browser/form/index.js.map +1 -0
  111. package/dist/browser/index.d.ts +12 -0
  112. package/dist/browser/index.d.ts.map +1 -0
  113. package/dist/browser/index.js +138 -0
  114. package/dist/browser/index.js.map +1 -0
  115. package/dist/browser/migration/index.d.ts +2 -0
  116. package/dist/browser/migration/index.d.ts.map +1 -0
  117. package/dist/browser/migration/index.js +24 -0
  118. package/dist/browser/migration/index.js.map +1 -0
  119. package/dist/browser/migration/migration.0-2.d.ts +3 -0
  120. package/dist/browser/migration/migration.0-2.d.ts.map +1 -0
  121. package/dist/browser/migration/migration.0-2.js +65 -0
  122. package/dist/browser/migration/migration.0-2.js.map +1 -0
  123. package/dist/browser/migration/migration.1-2.d.ts +3 -0
  124. package/dist/browser/migration/migration.1-2.d.ts.map +1 -0
  125. package/dist/browser/migration/migration.1-2.js +108 -0
  126. package/dist/browser/migration/migration.1-2.js.map +1 -0
  127. package/dist/browser/migration/types.d.ts +2 -0
  128. package/dist/browser/migration/types.d.ts.map +1 -0
  129. package/dist/browser/migration/types.js +16 -0
  130. package/dist/browser/migration/types.js.map +1 -0
  131. package/dist/browser/migration/whichMigrations.d.ts +7 -0
  132. package/dist/browser/migration/whichMigrations.d.ts.map +1 -0
  133. package/dist/browser/migration/whichMigrations.js +38 -0
  134. package/dist/browser/migration/whichMigrations.js.map +1 -0
  135. package/dist/browser/schema/index.d.ts +2 -0
  136. package/dist/browser/schema/index.d.ts.map +1 -0
  137. package/dist/browser/schema/index.js +30 -0
  138. package/dist/browser/schema/index.js.map +1 -0
  139. package/dist/browser/schema/schema.d.ts +20 -0
  140. package/dist/browser/schema/schema.d.ts.map +1 -0
  141. package/dist/browser/schema/schema.js +255 -0
  142. package/dist/browser/schema/schema.js.map +1 -0
  143. package/dist/browser/utils/helpers.d.ts +9 -0
  144. package/dist/browser/utils/helpers.d.ts.map +1 -0
  145. package/dist/browser/utils/helpers.js +48 -0
  146. package/dist/browser/utils/helpers.js.map +1 -0
  147. package/dist/browser/utils/logger.d.ts +11 -0
  148. package/dist/browser/utils/logger.d.ts.map +1 -0
  149. package/dist/browser/utils/logger.js +46 -0
  150. package/dist/browser/utils/logger.js.map +1 -0
  151. package/dist/module/components/component-types.d.ts +3 -0
  152. package/dist/module/components/component-types.d.ts.map +1 -0
  153. package/dist/module/components/component-types.js +206 -0
  154. package/dist/module/components/component-types.js.map +1 -0
  155. package/dist/module/components/conditional-component-types.d.ts +3 -0
  156. package/dist/module/components/conditional-component-types.d.ts.map +1 -0
  157. package/dist/module/components/conditional-component-types.js +14 -0
  158. package/dist/module/components/conditional-component-types.js.map +1 -0
  159. package/dist/module/components/index.d.ts +4 -0
  160. package/dist/module/components/index.d.ts.map +1 -0
  161. package/dist/module/components/index.js +34 -0
  162. package/dist/module/components/index.js.map +1 -0
  163. package/dist/module/components/types.d.ts +244 -0
  164. package/dist/module/components/types.d.ts.map +1 -0
  165. package/dist/module/components/types.js +42 -0
  166. package/dist/module/components/types.js.map +1 -0
  167. package/dist/module/conditions/condition-abstract.d.ts +16 -0
  168. package/dist/module/conditions/condition-abstract.d.ts.map +1 -0
  169. package/dist/module/conditions/condition-abstract.js +45 -0
  170. package/dist/module/conditions/condition-abstract.js.map +1 -0
  171. package/dist/module/conditions/condition-field.d.ts +13 -0
  172. package/dist/module/conditions/condition-field.d.ts.map +1 -0
  173. package/dist/module/conditions/condition-field.js +26 -0
  174. package/dist/module/conditions/condition-field.js.map +1 -0
  175. package/dist/module/conditions/condition-group-def.d.ts +10 -0
  176. package/dist/module/conditions/condition-group-def.d.ts.map +1 -0
  177. package/dist/module/conditions/condition-group-def.js +26 -0
  178. package/dist/module/conditions/condition-group-def.js.map +1 -0
  179. package/dist/module/conditions/condition-group.d.ts +15 -0
  180. package/dist/module/conditions/condition-group.d.ts.map +1 -0
  181. package/dist/module/conditions/condition-group.js +47 -0
  182. package/dist/module/conditions/condition-group.js.map +1 -0
  183. package/dist/module/conditions/condition-model.d.ts +41 -0
  184. package/dist/module/conditions/condition-model.d.ts.map +1 -0
  185. package/dist/module/conditions/condition-model.js +199 -0
  186. package/dist/module/conditions/condition-model.js.map +1 -0
  187. package/dist/module/conditions/condition-operators.d.ts +248 -0
  188. package/dist/module/conditions/condition-operators.d.ts.map +1 -0
  189. package/dist/module/conditions/condition-operators.js +119 -0
  190. package/dist/module/conditions/condition-operators.js.map +1 -0
  191. package/dist/module/conditions/condition-ref.d.ts +12 -0
  192. package/dist/module/conditions/condition-ref.d.ts.map +1 -0
  193. package/dist/module/conditions/condition-ref.js +33 -0
  194. package/dist/module/conditions/condition-ref.js.map +1 -0
  195. package/dist/module/conditions/condition-value-abstract.d.ts +8 -0
  196. package/dist/module/conditions/condition-value-abstract.d.ts.map +1 -0
  197. package/dist/module/conditions/condition-value-abstract.js +24 -0
  198. package/dist/module/conditions/condition-value-abstract.js.map +1 -0
  199. package/dist/module/conditions/condition-value-registration.d.ts +10 -0
  200. package/dist/module/conditions/condition-value-registration.d.ts.map +1 -0
  201. package/dist/module/conditions/condition-value-registration.js +19 -0
  202. package/dist/module/conditions/condition-value-registration.js.map +1 -0
  203. package/dist/module/conditions/condition-values.d.ts +38 -0
  204. package/dist/module/conditions/condition-values.d.ts.map +1 -0
  205. package/dist/module/conditions/condition-values.js +106 -0
  206. package/dist/module/conditions/condition-values.js.map +1 -0
  207. package/dist/module/conditions/condition.d.ts +15 -0
  208. package/dist/module/conditions/condition.d.ts.map +1 -0
  209. package/dist/module/conditions/condition.js +40 -0
  210. package/dist/module/conditions/condition.js.map +1 -0
  211. package/dist/module/conditions/helpers.d.ts +3 -0
  212. package/dist/module/conditions/helpers.d.ts.map +1 -0
  213. package/dist/module/conditions/helpers.js +12 -0
  214. package/dist/module/conditions/helpers.js.map +1 -0
  215. package/dist/module/conditions/index.d.ts +11 -0
  216. package/dist/module/conditions/index.d.ts.map +1 -0
  217. package/dist/module/conditions/index.js +140 -0
  218. package/dist/module/conditions/index.js.map +1 -0
  219. package/dist/module/conditions/inline-condition-model.d.ts +86 -0
  220. package/dist/module/conditions/inline-condition-model.d.ts.map +1 -0
  221. package/dist/module/conditions/inline-condition-model.js +384 -0
  222. package/dist/module/conditions/inline-condition-model.js.map +1 -0
  223. package/dist/module/conditions/inline-condition-operators.d.ts +175 -0
  224. package/dist/module/conditions/inline-condition-operators.d.ts.map +1 -0
  225. package/dist/module/conditions/inline-condition-operators.js +119 -0
  226. package/dist/module/conditions/inline-condition-operators.js.map +1 -0
  227. package/dist/module/conditions/inline-condition-values.d.ts +93 -0
  228. package/dist/module/conditions/inline-condition-values.d.ts.map +1 -0
  229. package/dist/module/conditions/inline-condition-values.js +134 -0
  230. package/dist/module/conditions/inline-condition-values.js.map +1 -0
  231. package/dist/module/conditions/types.d.ts +38 -0
  232. package/dist/module/conditions/types.d.ts.map +1 -0
  233. package/dist/module/conditions/types.js +10 -0
  234. package/dist/module/conditions/types.js.map +1 -0
  235. package/dist/module/data-model/conditions-wrapper.d.ts +19 -0
  236. package/dist/module/data-model/conditions-wrapper.d.ts.map +1 -0
  237. package/dist/module/data-model/conditions-wrapper.js +30 -0
  238. package/dist/module/data-model/conditions-wrapper.js.map +1 -0
  239. package/dist/module/data-model/index.d.ts +4 -0
  240. package/dist/module/data-model/index.d.ts.map +1 -0
  241. package/dist/module/data-model/index.js +55 -0
  242. package/dist/module/data-model/index.js.map +1 -0
  243. package/dist/module/data-model/input-wrapper.d.ts +16 -0
  244. package/dist/module/data-model/input-wrapper.d.ts.map +1 -0
  245. package/dist/module/data-model/input-wrapper.js +25 -0
  246. package/dist/module/data-model/input-wrapper.js.map +1 -0
  247. package/dist/module/data-model/types.d.ts +153 -0
  248. package/dist/module/data-model/types.d.ts.map +1 -0
  249. package/dist/module/data-model/types.js +20 -0
  250. package/dist/module/data-model/types.js.map +1 -0
  251. package/dist/module/form/form-configuration.d.ts +8 -0
  252. package/dist/module/form/form-configuration.d.ts.map +1 -0
  253. package/dist/module/form/form-configuration.js +17 -0
  254. package/dist/module/form/form-configuration.js.map +1 -0
  255. package/dist/module/form/index.d.ts +2 -0
  256. package/dist/module/form/index.d.ts.map +1 -0
  257. package/dist/module/form/index.js +11 -0
  258. package/dist/module/form/index.js.map +1 -0
  259. package/dist/module/index.d.ts +12 -0
  260. package/dist/module/index.d.ts.map +1 -0
  261. package/dist/module/index.js +135 -0
  262. package/dist/module/index.js.map +1 -0
  263. package/dist/module/migration/index.d.ts +2 -0
  264. package/dist/module/migration/index.d.ts.map +1 -0
  265. package/dist/module/migration/index.js +11 -0
  266. package/dist/module/migration/index.js.map +1 -0
  267. package/dist/module/migration/migration.0-2.d.ts +3 -0
  268. package/dist/module/migration/migration.0-2.d.ts.map +1 -0
  269. package/dist/module/migration/migration.0-2.js +42 -0
  270. package/dist/module/migration/migration.0-2.js.map +1 -0
  271. package/dist/module/migration/migration.1-2.d.ts +3 -0
  272. package/dist/module/migration/migration.1-2.d.ts.map +1 -0
  273. package/dist/module/migration/migration.1-2.js +90 -0
  274. package/dist/module/migration/migration.1-2.js.map +1 -0
  275. package/dist/module/migration/types.d.ts +2 -0
  276. package/dist/module/migration/types.d.ts.map +1 -0
  277. package/dist/module/migration/types.js +1 -0
  278. package/dist/module/migration/types.js.map +1 -0
  279. package/dist/module/migration/whichMigrations.d.ts +7 -0
  280. package/dist/module/migration/whichMigrations.d.ts.map +1 -0
  281. package/dist/module/migration/whichMigrations.js +26 -0
  282. package/dist/module/migration/whichMigrations.js.map +1 -0
  283. package/dist/module/schema/index.d.ts +2 -0
  284. package/dist/module/schema/index.d.ts.map +1 -0
  285. package/dist/module/schema/index.js +17 -0
  286. package/dist/module/schema/index.js.map +1 -0
  287. package/dist/module/schema/schema.d.ts +20 -0
  288. package/dist/module/schema/schema.d.ts.map +1 -0
  289. package/dist/module/schema/schema.js +239 -0
  290. package/dist/module/schema/schema.js.map +1 -0
  291. package/dist/module/utils/helpers.d.ts +9 -0
  292. package/dist/module/utils/helpers.d.ts.map +1 -0
  293. package/dist/module/utils/helpers.js +35 -0
  294. package/dist/module/utils/helpers.js.map +1 -0
  295. package/dist/module/utils/logger.d.ts +11 -0
  296. package/dist/module/utils/logger.d.ts.map +1 -0
  297. package/dist/module/utils/logger.js +27 -0
  298. package/dist/module/utils/logger.js.map +1 -0
  299. package/package.json +35 -0
  300. package/src/components/component-types.ts +229 -0
  301. package/src/components/conditional-component-types.ts +14 -0
  302. package/src/components/index.ts +3 -0
  303. package/src/components/types.ts +362 -0
  304. package/src/conditions/condition-abstract.ts +59 -0
  305. package/src/conditions/condition-field.ts +29 -0
  306. package/src/conditions/condition-group-def.ts +29 -0
  307. package/src/conditions/condition-group.ts +61 -0
  308. package/src/conditions/condition-model.ts +314 -0
  309. package/src/conditions/condition-operators.ts +176 -0
  310. package/src/conditions/condition-ref.ts +47 -0
  311. package/src/conditions/condition-value-abstract.ts +31 -0
  312. package/src/conditions/condition-value-registration.ts +18 -0
  313. package/src/conditions/condition-values.ts +146 -0
  314. package/src/conditions/condition.ts +64 -0
  315. package/src/conditions/helpers.ts +7 -0
  316. package/src/conditions/index.ts +27 -0
  317. package/src/conditions/inline-condition-model.ts +550 -0
  318. package/src/conditions/inline-condition-operators.ts +166 -0
  319. package/src/conditions/inline-condition-values.ts +153 -0
  320. package/src/conditions/types.ts +30 -0
  321. package/src/data-model/conditions-wrapper.ts +42 -0
  322. package/src/data-model/index.ts +3 -0
  323. package/src/data-model/input-wrapper.ts +40 -0
  324. package/src/data-model/types.ts +179 -0
  325. package/src/form/form-configuration.ts +21 -0
  326. package/src/form/index.ts +1 -0
  327. package/src/index.ts +11 -0
  328. package/src/migration/index.ts +1 -0
  329. package/src/migration/migration.0-2.ts +29 -0
  330. package/src/migration/migration.1-2.ts +105 -0
  331. package/src/migration/types.ts +1 -0
  332. package/src/migration/whichMigrations.ts +23 -0
  333. package/src/schema/index.ts +1 -0
  334. package/src/schema/schema.ts +300 -0
  335. package/src/utils/helpers.ts +37 -0
  336. package/src/utils/logger.ts +29 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-condition-model.js","names":["_componentTypes","require","_inlineConditionOperators","_inlineConditionValues","coordinators","exports","AND","OR","ConditionsModel","groupedConditions","userGroupedConditions","conditionName","constructor","clone","toReturn","map","it","clear","undefined","name","add","condition","coordinatorExpected","length","getCoordinator","Error","push","_applyGroups","replace","index","splice","remove","indexes","filter","_condition","includes","asFirstCondition","addGroups","groupDefs","_group","splitGroup","_ungroup","moveEarlier","switchCoordinators","moveLater","setCoordinator","asPerUserGroupings","hasConditions","lastIndex","toPresentationString","join","toExpression","correctedUserGroups","ConditionGroup","conditions","_autoGroupDefs","reduce","groups","groupDef","find","contains","startsWith","groupConditions","applyTo","splitIndex","isGroup","copy","getGroupedConditions","orPositions","forEach","hasAnd","hasOr","start","position","GroupDef","thisIsTheLastOr","thereAreMoreConditions","toJSON","from","obj","conditionFrom","ConditionRef","conditionDisplayName","coordinator","Condition","Field","field","operator","valueFrom","value","first","last","Array","isArray","coordinatorString","conditionString","conditionExpression","type","display","ComponentTypes","componentType","AbstractCondition","Object","values","_asFirstCondition","AbstractConditionValue","getExpression"],"sources":["../../../src/conditions/inline-condition-model.ts"],"sourcesContent":["import { ComponentTypes } from '../components/component-types'\nimport { getExpression } from './inline-condition-operators'\nimport { AbstractConditionValue, valueFrom } from './inline-condition-values'\n\nexport const coordinators = {\n AND: 'and',\n OR: 'or'\n}\n\nexport class ConditionsModel {\n #groupedConditions\n #userGroupedConditions\n #conditionName\n\n constructor() {\n this.#groupedConditions = []\n this.#userGroupedConditions = []\n }\n\n clone() {\n const toReturn = new ConditionsModel()\n toReturn.#groupedConditions = this.#groupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#userGroupedConditions = this.#userGroupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#conditionName = this.#conditionName\n return toReturn\n }\n\n clear() {\n this.#userGroupedConditions = []\n this.#groupedConditions = []\n this.#conditionName = undefined\n return this\n }\n\n set name(name) {\n this.#conditionName = name\n }\n\n get name() {\n return this.#conditionName\n }\n\n add(condition) {\n const coordinatorExpected = this.#userGroupedConditions.length !== 0\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n }\n this.#userGroupedConditions.push(condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n replace(index, condition) {\n const coordinatorExpected = index !== 0\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n } else if (index >= this.#userGroupedConditions.length) {\n throw Error(\n `Cannot replace condition ${index} as no such condition exists`\n )\n }\n this.#userGroupedConditions.splice(index, 1, condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n remove(indexes) {\n this.#userGroupedConditions = this.#userGroupedConditions\n .filter((_condition, index) => !indexes.includes(index))\n .map((condition, index) =>\n index === 0 ? condition.asFirstCondition() : condition\n )\n\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n addGroups(groupDefs) {\n this.#userGroupedConditions = this._group(\n this.#userGroupedConditions,\n groupDefs\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n splitGroup(index) {\n this.#userGroupedConditions = this._ungroup(\n this.#userGroupedConditions,\n index\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n moveEarlier(index) {\n if (index > 0 && index < this.#userGroupedConditions.length) {\n this.#userGroupedConditions.splice(\n index - 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 1) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n moveLater(index) {\n if (index >= 0 && index < this.#userGroupedConditions.length - 1) {\n this.#userGroupedConditions.splice(\n index + 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 0) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n switchCoordinators() {\n this.#userGroupedConditions[1].setCoordinator(\n this.#userGroupedConditions[0].getCoordinator()\n )\n this.#userGroupedConditions[0].setCoordinator(undefined)\n }\n\n get asPerUserGroupings() {\n return [...this.#userGroupedConditions]\n }\n\n get hasConditions() {\n return this.#userGroupedConditions.length > 0\n }\n\n get lastIndex() {\n return this.#userGroupedConditions.length - 1\n }\n\n toPresentationString() {\n return this.#groupedConditions\n .map((condition) => toPresentationString(condition))\n .join(' ')\n }\n\n toExpression() {\n return this.#groupedConditions\n .map((condition) => toExpression(condition))\n .join(' ')\n }\n\n _applyGroups(userGroupedConditions) {\n const correctedUserGroups = userGroupedConditions.map((condition) =>\n condition instanceof ConditionGroup && condition.conditions.length > 2\n ? new ConditionGroup(\n this._group(\n condition.conditions,\n this._autoGroupDefs(condition.conditions)\n )\n )\n : condition\n )\n return this._group(\n correctedUserGroups,\n this._autoGroupDefs(correctedUserGroups)\n )\n }\n\n _group(conditions, groupDefs) {\n return conditions.reduce((groups, condition, index, conditions) => {\n const groupDef = groupDefs.find((groupDef) => groupDef.contains(index))\n if (groupDef) {\n if (groupDef.startsWith(index)) {\n const groupConditions = groupDef.applyTo(conditions)\n groups.push(new ConditionGroup(groupConditions))\n }\n } else {\n groups.push(condition)\n }\n return groups\n }, [])\n }\n\n _ungroup(conditions, splitIndex) {\n if (conditions[splitIndex].isGroup()) {\n const copy = [...conditions]\n copy.splice(\n splitIndex,\n 1,\n ...conditions[splitIndex].getGroupedConditions()\n )\n return copy\n }\n return conditions\n }\n\n _autoGroupDefs(conditions) {\n const orPositions: number[] = []\n conditions.forEach((condition, index) => {\n if (condition.getCoordinator() === coordinators.OR) {\n orPositions.push(index)\n }\n })\n const hasAnd = !!conditions.find(\n (condition) => condition.getCoordinator() === coordinators.AND\n )\n const hasOr = orPositions.length > 0\n if (hasAnd && hasOr) {\n let start = 0\n const groupDefs: GroupDef[] = []\n orPositions.forEach((position, index) => {\n if (start < position - 1) {\n groupDefs.push(new GroupDef(start, position - 1))\n }\n const thisIsTheLastOr = orPositions.length === index + 1\n const thereAreMoreConditions = conditions.length - 1 > position\n if (thisIsTheLastOr && thereAreMoreConditions) {\n groupDefs.push(new GroupDef(position, conditions.length - 1))\n }\n start = position\n })\n return groupDefs\n }\n return []\n }\n\n toJSON() {\n const name = this.#conditionName\n const conditions = this.#userGroupedConditions\n return {\n name,\n conditions: conditions.map((it) => it.clone())\n }\n }\n\n static from(obj) {\n if (obj instanceof ConditionsModel) {\n return obj\n }\n const toReturn = new ConditionsModel()\n toReturn.#conditionName = obj.name\n toReturn.#userGroupedConditions = obj.conditions.map((it) =>\n conditionFrom(it)\n )\n toReturn.#groupedConditions = toReturn._applyGroups(\n toReturn.#userGroupedConditions\n )\n return toReturn\n }\n}\n\nfunction conditionFrom(it) {\n if (it.conditions) {\n return new ConditionGroup(\n it.conditions.map((condition) => conditionFrom(condition))\n )\n }\n if (it.conditionName) {\n return new ConditionRef(\n it.conditionName,\n it.conditionDisplayName,\n it.coordinator\n )\n }\n return new Condition(\n Field.from(it.field),\n it.operator,\n valueFrom(it.value),\n it.coordinator\n )\n}\n\nexport class GroupDef {\n first\n last\n\n constructor(first, last) {\n if (typeof first !== 'number' || typeof last !== 'number') {\n throw Error(`Cannot construct a group from ${first} and ${last}`)\n } else if (first >= last) {\n throw Error(`Last (${last}) must be greater than first (${first})`)\n }\n this.first = first\n this.last = last\n }\n\n contains(index) {\n return this.first <= index && this.last >= index\n }\n\n startsWith(index) {\n return this.first === index\n }\n\n applyTo(conditions) {\n return [...conditions].splice(this.first, this.last - this.first + 1)\n }\n}\n\nclass ConditionGroup {\n conditions\n\n constructor(conditions) {\n if (!Array.isArray(conditions) || conditions.length < 2) {\n throw Error('Cannot construct a condition group from a single condition')\n }\n this.conditions = conditions\n }\n\n coordinatorString() {\n return this.conditions[0].coordinatorString()\n }\n\n conditionString() {\n const copy = [...this.conditions]\n copy.splice(0, 1)\n return `(${this.conditions[0].conditionString()} ${copy\n .map((condition) => toPresentationString(condition))\n .join(' ')})`\n }\n\n conditionExpression() {\n const copy = [...this.conditions]\n copy.splice(0, 1)\n return `(${this.conditions[0].conditionExpression()} ${copy\n .map((condition) => toExpression(condition))\n .join(' ')})`\n }\n\n asFirstCondition() {\n this.conditions[0].asFirstCondition()\n return this\n }\n\n getCoordinator() {\n return this.conditions[0].getCoordinator()\n }\n\n setCoordinator(coordinator) {\n this.conditions[0].setCoordinator(coordinator)\n }\n\n isGroup() {\n return true\n }\n\n getGroupedConditions() {\n return this.conditions.map((condition) => condition.clone())\n }\n\n clone() {\n return new ConditionGroup(\n this.conditions.map((condition) => condition.clone())\n )\n }\n}\n\nexport function toPresentationString(condition) {\n return `${condition.coordinatorString()}${condition.conditionString()}`\n}\n\nexport function toExpression(condition) {\n return `${condition.coordinatorString()}${condition.conditionExpression()}`\n}\n\nexport class Field {\n name\n type\n display\n\n constructor(name, type, display) {\n if (!name || typeof name !== 'string') {\n throw Error(`name ${name} is not valid`)\n }\n if (!ComponentTypes.find((componentType) => componentType.name === type)) {\n throw Error(`type ${type} is not valid`)\n }\n if (!display || typeof display !== 'string') {\n throw Error(`display ${display} is not valid`)\n }\n this.name = name\n this.type = type\n this.display = display\n }\n\n static from(obj) {\n return new Field(obj.name, obj.type, obj.display)\n }\n}\n\nclass AbstractCondition {\n coordinator\n\n constructor(coordinator) {\n if (coordinator && !Object.values(coordinators).includes(coordinator)) {\n throw Error(`coordinator ${coordinator} is not a valid coordinator`)\n }\n this.coordinator = coordinator\n }\n\n coordinatorString() {\n return this.coordinator ? `${this.coordinator} ` : ''\n }\n\n getCoordinator() {\n return this.coordinator\n }\n\n setCoordinator(coordinator) {\n this.coordinator = coordinator\n }\n\n isGroup() {\n return false\n }\n\n getGroupedConditions() {\n return [this]\n }\n\n _asFirstCondition() {\n delete this.coordinator\n }\n\n asFirstCondition() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n\n clone() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n\n conditionString() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n\n conditionExpression() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n}\n\nexport class Condition extends AbstractCondition {\n field\n operator\n value\n\n constructor(field, operator, value, coordinator) {\n super(coordinator)\n if (!(field instanceof Field)) {\n throw Error(`field ${field} is not a valid Field object`)\n }\n if (typeof operator !== 'string') {\n throw Error(`operator ${operator} is not a valid operator`)\n }\n if (!(value instanceof AbstractConditionValue)) {\n throw Error(`value ${value} is not a valid value type`)\n }\n this.field = field\n this.operator = operator\n this.value = value\n }\n\n asFirstCondition() {\n this._asFirstCondition()\n return this\n }\n\n conditionString() {\n return `'${this.field.display}' ${\n this.operator\n } '${this.value.toPresentationString()}'`\n }\n\n conditionExpression() {\n return getExpression(\n this.field.type,\n this.field.name,\n this.operator,\n this.value\n )\n }\n\n clone() {\n return new Condition(\n Field.from(this.field),\n this.operator,\n this.value.clone(),\n this.coordinator\n )\n }\n}\n\nexport class ConditionRef extends AbstractCondition {\n conditionName\n conditionDisplayName\n\n constructor(conditionName, conditionDisplayName, coordinator) {\n super(coordinator)\n if (typeof conditionName !== 'string') {\n throw Error(`condition name ${conditionName} is not valid`)\n }\n if (typeof conditionDisplayName !== 'string') {\n throw Error(`condition display name ${conditionDisplayName} is not valid`)\n }\n this.conditionName = conditionName\n this.conditionDisplayName = conditionDisplayName\n }\n\n asFirstCondition() {\n this._asFirstCondition()\n return this\n }\n\n conditionString() {\n return `'${this.conditionDisplayName}'`\n }\n\n conditionExpression() {\n return this.conditionName\n }\n\n clone() {\n return new ConditionRef(\n this.conditionName,\n this.conditionDisplayName,\n this.coordinator\n )\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAEO,MAAMG,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC1BE,GAAG,EAAE,KAAK;EACVC,EAAE,EAAE;AACN,CAAC;AAEM,MAAMC,eAAe,CAAC;EAC3B,CAACC,iBAAiB;EAClB,CAACC,qBAAqB;EACtB,CAACC,aAAa;EAEdC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAAC,CAACH,iBAAiB,GAAG,EAAE;IAC5B,IAAI,CAAC,CAACC,qBAAqB,GAAG,EAAE;EAClC;EAEAG,KAAKA,CAAA,EAAG;IACN,MAAMC,QAAQ,GAAG,IAAIN,eAAe,CAAC,CAAC;IACtCM,QAAQ,CAAC,CAACL,iBAAiB,GAAG,IAAI,CAAC,CAACA,iBAAiB,CAACM,GAAG,CAAEC,EAAE,IAC3DA,EAAE,CAACH,KAAK,CAAC,CACX,CAAC;IACDC,QAAQ,CAAC,CAACJ,qBAAqB,GAAG,IAAI,CAAC,CAACA,qBAAqB,CAACK,GAAG,CAAEC,EAAE,IACnEA,EAAE,CAACH,KAAK,CAAC,CACX,CAAC;IACDC,QAAQ,CAAC,CAACH,aAAa,GAAG,IAAI,CAAC,CAACA,aAAa;IAC7C,OAAOG,QAAQ;EACjB;EAEAG,KAAKA,CAAA,EAAG;IACN,IAAI,CAAC,CAACP,qBAAqB,GAAG,EAAE;IAChC,IAAI,CAAC,CAACD,iBAAiB,GAAG,EAAE;IAC5B,IAAI,CAAC,CAACE,aAAa,GAAGO,SAAS;IAC/B,OAAO,IAAI;EACb;EAEA,IAAIC,IAAIA,CAACA,IAAI,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CAACuE,oBAAoB,GAAGA,oBAAoB;EAClD;EAEA9C,gBAAgBA,CAAA,EAAG;IACjB,IAAI,CAACoE,iBAAiB,CAAC,CAAC;IACxB,OAAO,IAAI;EACb;EAEAT,eAAeA,CAAA,EAAG;IAChB,OAAQ,IAAG,IAAI,CAACb,oBAAqB,GAAE;EACzC;EAEAc,mBAAmBA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACrF,aAAa;EAC3B;EAEAE,KAAKA,CAAA,EAAG;IACN,OAAO,IAAIoE,YAAY,CACrB,IAAI,CAACtE,aAAa,EAClB,IAAI,CAACuE,oBAAoB,EACzB,IAAI,CAACC,WACP,CAAC;EACH;AACF;AAAC9E,OAAA,CAAA4E,YAAA,GAAAA,YAAA"}
@@ -0,0 +1,175 @@
1
+ export declare const customOperators: {
2
+ CheckboxesField: {
3
+ contains: {
4
+ expression: (field: any, value: any) => string;
5
+ };
6
+ 'does not contain': {
7
+ expression: (field: any, value: any) => string;
8
+ };
9
+ };
10
+ NumberField: any;
11
+ DateField: {
12
+ is: {
13
+ expression: (field: any, value: any) => string;
14
+ };
15
+ 'is not': {
16
+ expression: (field: any, value: any) => string;
17
+ };
18
+ 'is before': {
19
+ expression: (field: any, value: any) => string;
20
+ };
21
+ 'is after': {
22
+ expression: (field: any, value: any) => string;
23
+ };
24
+ } & {
25
+ 'is at least': {
26
+ units: any;
27
+ expression: (field: any, value: any) => string;
28
+ };
29
+ 'is at most': {
30
+ units: any;
31
+ expression: (field: any, value: any) => string;
32
+ };
33
+ 'is less than': {
34
+ units: any;
35
+ expression: (field: any, value: any) => string;
36
+ };
37
+ 'is more than': {
38
+ units: any;
39
+ expression: (field: any, value: any) => string;
40
+ };
41
+ };
42
+ TimeField: {
43
+ is: {
44
+ expression: (field: any, value: any) => string;
45
+ };
46
+ 'is not': {
47
+ expression: (field: any, value: any) => string;
48
+ };
49
+ 'is before': {
50
+ expression: (field: any, value: any) => string;
51
+ };
52
+ 'is after': {
53
+ expression: (field: any, value: any) => string;
54
+ };
55
+ } & {
56
+ 'is at least': {
57
+ units: any;
58
+ expression: (field: any, value: any) => string;
59
+ };
60
+ 'is at most': {
61
+ units: any;
62
+ expression: (field: any, value: any) => string;
63
+ };
64
+ 'is less than': {
65
+ units: any;
66
+ expression: (field: any, value: any) => string;
67
+ };
68
+ 'is more than': {
69
+ units: any;
70
+ expression: (field: any, value: any) => string;
71
+ };
72
+ };
73
+ DatePartsField: {
74
+ is: {
75
+ expression: (field: any, value: any) => string;
76
+ };
77
+ 'is not': {
78
+ expression: (field: any, value: any) => string;
79
+ };
80
+ 'is before': {
81
+ expression: (field: any, value: any) => string;
82
+ };
83
+ 'is after': {
84
+ expression: (field: any, value: any) => string;
85
+ };
86
+ } & {
87
+ 'is at least': {
88
+ units: any;
89
+ expression: (field: any, value: any) => string;
90
+ };
91
+ 'is at most': {
92
+ units: any;
93
+ expression: (field: any, value: any) => string;
94
+ };
95
+ 'is less than': {
96
+ units: any;
97
+ expression: (field: any, value: any) => string;
98
+ };
99
+ 'is more than': {
100
+ units: any;
101
+ expression: (field: any, value: any) => string;
102
+ };
103
+ };
104
+ DateTimeField: {
105
+ is: {
106
+ expression: (field: any, value: any) => string;
107
+ };
108
+ 'is not': {
109
+ expression: (field: any, value: any) => string;
110
+ };
111
+ 'is before': {
112
+ expression: (field: any, value: any) => string;
113
+ };
114
+ 'is after': {
115
+ expression: (field: any, value: any) => string;
116
+ };
117
+ } & {
118
+ 'is at least': {
119
+ units: any;
120
+ expression: (field: any, value: any) => string;
121
+ };
122
+ 'is at most': {
123
+ units: any;
124
+ expression: (field: any, value: any) => string;
125
+ };
126
+ 'is less than': {
127
+ units: any;
128
+ expression: (field: any, value: any) => string;
129
+ };
130
+ 'is more than': {
131
+ units: any;
132
+ expression: (field: any, value: any) => string;
133
+ };
134
+ };
135
+ DateTimePartsField: {
136
+ is: {
137
+ expression: (field: any, value: any) => string;
138
+ };
139
+ 'is not': {
140
+ expression: (field: any, value: any) => string;
141
+ };
142
+ 'is before': {
143
+ expression: (field: any, value: any) => string;
144
+ };
145
+ 'is after': {
146
+ expression: (field: any, value: any) => string;
147
+ };
148
+ } & {
149
+ 'is at least': {
150
+ units: any;
151
+ expression: (field: any, value: any) => string;
152
+ };
153
+ 'is at most': {
154
+ units: any;
155
+ expression: (field: any, value: any) => string;
156
+ };
157
+ 'is less than': {
158
+ units: any;
159
+ expression: (field: any, value: any) => string;
160
+ };
161
+ 'is more than': {
162
+ units: any;
163
+ expression: (field: any, value: any) => string;
164
+ };
165
+ };
166
+ TextField: any;
167
+ MultilineTextField: any;
168
+ EmailAddressField: any;
169
+ };
170
+ export declare function getOperatorNames(fieldType: any): string[];
171
+ export declare function getExpression(fieldType: any, fieldName: any, operator: any, value: any): any;
172
+ export declare function getOperatorConfig(fieldType: any, operator: any): any;
173
+ export declare const absoluteDateOrTimeOperatorNames: string[];
174
+ export declare const relativeDateOrTimeOperatorNames: string[];
175
+ //# sourceMappingURL=inline-condition-operators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-condition-operators.d.ts","sourceRoot":"","sources":["../../../src/conditions/inline-condition-operators.ts"],"names":[],"mappings":"AAsCA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuC3B,CAAA;AAED,wBAAgB,gBAAgB,CAAC,SAAS,KAAA,YAEzC;AAED,wBAAgB,aAAa,CAAC,SAAS,KAAA,EAAE,SAAS,KAAA,EAAE,QAAQ,KAAA,EAAE,KAAK,KAAA,OAKlE;AAED,wBAAgB,iBAAiB,CAAC,SAAS,KAAA,EAAE,QAAQ,KAAA,OAEpD;AAyCD,eAAO,MAAM,+BAA+B,UAE3C,CAAA;AACD,eAAO,MAAM,+BAA+B,UAE3C,CAAA"}
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.customOperators = exports.absoluteDateOrTimeOperatorNames = void 0;
5
+ exports.getExpression = getExpression;
6
+ exports.getOperatorConfig = getOperatorConfig;
7
+ exports.getOperatorNames = getOperatorNames;
8
+ exports.relativeDateOrTimeOperatorNames = void 0;
9
+ var _inlineConditionValues = require("./inline-condition-values");
10
+ const defaultOperators = {
11
+ is: inline('=='),
12
+ 'is not': inline('!=')
13
+ };
14
+ function withDefaults(param) {
15
+ return Object.assign({}, param, defaultOperators);
16
+ }
17
+ const textBasedFieldCustomisations = {
18
+ 'is longer than': lengthIs('>'),
19
+ 'is shorter than': lengthIs('<'),
20
+ 'has length': lengthIs('==')
21
+ };
22
+ const absoluteDateTimeOperators = {
23
+ is: absoluteDateTime('=='),
24
+ 'is not': absoluteDateTime('!='),
25
+ 'is before': absoluteDateTime('<'),
26
+ 'is after': absoluteDateTime('>')
27
+ };
28
+ const relativeTimeOperators = units => ({
29
+ 'is at least': relativeTime('<=', '>=', units),
30
+ 'is at most': relativeTime('>=', '<=', units),
31
+ 'is less than': relativeTime('>', '<', units),
32
+ 'is more than': relativeTime('<', '>', units)
33
+ });
34
+ const customOperators = exports.customOperators = {
35
+ CheckboxesField: {
36
+ contains: reverseInline('in'),
37
+ 'does not contain': not(reverseInline('in'))
38
+ },
39
+ NumberField: withDefaults({
40
+ 'is at least': inline('>='),
41
+ 'is at most': inline('<='),
42
+ 'is less than': inline('<'),
43
+ 'is more than': inline('>')
44
+ }),
45
+ DateField: Object.assign({}, absoluteDateTimeOperators, relativeTimeOperators(_inlineConditionValues.dateUnits)),
46
+ TimeField: Object.assign({}, absoluteDateTimeOperators, relativeTimeOperators(_inlineConditionValues.timeUnits)),
47
+ DatePartsField: Object.assign({}, absoluteDateTimeOperators, relativeTimeOperators(_inlineConditionValues.dateUnits)),
48
+ DateTimeField: Object.assign({}, absoluteDateTimeOperators, relativeTimeOperators(_inlineConditionValues.dateTimeUnits)),
49
+ DateTimePartsField: Object.assign({}, absoluteDateTimeOperators, relativeTimeOperators(_inlineConditionValues.dateTimeUnits)),
50
+ TextField: withDefaults(textBasedFieldCustomisations),
51
+ MultilineTextField: withDefaults(textBasedFieldCustomisations),
52
+ EmailAddressField: withDefaults(textBasedFieldCustomisations)
53
+ };
54
+ function getOperatorNames(fieldType) {
55
+ return Object.keys(getConditionals(fieldType)).sort();
56
+ }
57
+ function getExpression(fieldType, fieldName, operator, value) {
58
+ return getConditionals(fieldType)[operator].expression({
59
+ type: fieldType,
60
+ name: fieldName
61
+ }, value);
62
+ }
63
+ function getOperatorConfig(fieldType, operator) {
64
+ return getConditionals(fieldType)[operator];
65
+ }
66
+ function getConditionals(fieldType) {
67
+ return customOperators[fieldType] || defaultOperators;
68
+ }
69
+ function inline(operator) {
70
+ return {
71
+ expression: (field, value) => `${field.name} ${operator} ${formatValue(field.type, value.value)}`
72
+ };
73
+ }
74
+ function lengthIs(operator) {
75
+ return {
76
+ expression: (field, value) => `length(${field.name}) ${operator} ${value.value}`
77
+ };
78
+ }
79
+ function reverseInline(operator) {
80
+ return {
81
+ expression: (field, value) => `${formatValue(field.type, value.value)} ${operator} ${field.name}`
82
+ };
83
+ }
84
+ function not(operatorDefinition) {
85
+ return {
86
+ expression: (field, value) => `not (${operatorDefinition.expression(field, value)})`
87
+ };
88
+ }
89
+ function formatValue(fieldType, value) {
90
+ if (fieldType === 'NumberField' || fieldType === 'YesNoField') {
91
+ return value;
92
+ }
93
+ return `'${value}'`;
94
+ }
95
+ const absoluteDateOrTimeOperatorNames = exports.absoluteDateOrTimeOperatorNames = Object.keys(absoluteDateTimeOperators);
96
+ const relativeDateOrTimeOperatorNames = exports.relativeDateOrTimeOperatorNames = Object.keys(relativeTimeOperators(_inlineConditionValues.dateTimeUnits));
97
+ function absoluteDateTime(operator) {
98
+ return {
99
+ expression: (field, value) => {
100
+ if (value instanceof _inlineConditionValues.ConditionValue) {
101
+ return `${field.name} ${operator} '${value.toExpression()}'`;
102
+ }
103
+ throw Error('only Value types are supported');
104
+ }
105
+ };
106
+ }
107
+ function relativeTime(pastOperator, futureOperator, units) {
108
+ return {
109
+ units,
110
+ expression: (field, value) => {
111
+ if (value instanceof _inlineConditionValues.RelativeTimeValue) {
112
+ const operator = value.direction === _inlineConditionValues.dateDirections.PAST ? pastOperator : futureOperator;
113
+ return `${field.name} ${operator} ${value.toExpression()}`;
114
+ }
115
+ throw Error('time shift requires a TimeShiftValue');
116
+ }
117
+ };
118
+ }
119
+ //# sourceMappingURL=inline-condition-operators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-condition-operators.js","names":["_inlineConditionValues","require","defaultOperators","is","inline","withDefaults","param","Object","assign","textBasedFieldCustomisations","lengthIs","absoluteDateTimeOperators","absoluteDateTime","relativeTimeOperators","units","relativeTime","customOperators","exports","CheckboxesField","contains","reverseInline","not","NumberField","DateField","dateUnits","TimeField","timeUnits","DatePartsField","DateTimeField","dateTimeUnits","DateTimePartsField","TextField","MultilineTextField","EmailAddressField","getOperatorNames","fieldType","keys","getConditionals","sort","getExpression","fieldName","operator","value","expression","type","name","getOperatorConfig","field","formatValue","operatorDefinition","absoluteDateOrTimeOperatorNames","relativeDateOrTimeOperatorNames","ConditionValue","toExpression","Error","pastOperator","futureOperator","RelativeTimeValue","direction","dateDirections","PAST"],"sources":["../../../src/conditions/inline-condition-operators.ts"],"sourcesContent":["import {\n ConditionValue,\n dateDirections,\n dateTimeUnits,\n dateUnits,\n RelativeTimeValue,\n timeUnits\n} from './inline-condition-values'\n\nconst defaultOperators = {\n is: inline('=='),\n 'is not': inline('!=')\n}\n\nfunction withDefaults(param) {\n return Object.assign({}, param, defaultOperators)\n}\n\nconst textBasedFieldCustomisations = {\n 'is longer than': lengthIs('>'),\n 'is shorter than': lengthIs('<'),\n 'has length': lengthIs('==')\n}\n\nconst absoluteDateTimeOperators = {\n is: absoluteDateTime('=='),\n 'is not': absoluteDateTime('!='),\n 'is before': absoluteDateTime('<'),\n 'is after': absoluteDateTime('>')\n}\n\nconst relativeTimeOperators = (units) => ({\n 'is at least': relativeTime('<=', '>=', units),\n 'is at most': relativeTime('>=', '<=', units),\n 'is less than': relativeTime('>', '<', units),\n 'is more than': relativeTime('<', '>', units)\n})\n\nexport const customOperators = {\n CheckboxesField: {\n contains: reverseInline('in'),\n 'does not contain': not(reverseInline('in'))\n },\n NumberField: withDefaults({\n 'is at least': inline('>='),\n 'is at most': inline('<='),\n 'is less than': inline('<'),\n 'is more than': inline('>')\n }),\n DateField: Object.assign(\n {},\n absoluteDateTimeOperators,\n relativeTimeOperators(dateUnits)\n ),\n TimeField: Object.assign(\n {},\n absoluteDateTimeOperators,\n relativeTimeOperators(timeUnits)\n ),\n DatePartsField: Object.assign(\n {},\n absoluteDateTimeOperators,\n relativeTimeOperators(dateUnits)\n ),\n DateTimeField: Object.assign(\n {},\n absoluteDateTimeOperators,\n relativeTimeOperators(dateTimeUnits)\n ),\n DateTimePartsField: Object.assign(\n {},\n absoluteDateTimeOperators,\n relativeTimeOperators(dateTimeUnits)\n ),\n TextField: withDefaults(textBasedFieldCustomisations),\n MultilineTextField: withDefaults(textBasedFieldCustomisations),\n EmailAddressField: withDefaults(textBasedFieldCustomisations)\n}\n\nexport function getOperatorNames(fieldType) {\n return Object.keys(getConditionals(fieldType)).sort()\n}\n\nexport function getExpression(fieldType, fieldName, operator, value) {\n return getConditionals(fieldType)[operator].expression(\n { type: fieldType, name: fieldName },\n value\n )\n}\n\nexport function getOperatorConfig(fieldType, operator) {\n return getConditionals(fieldType)[operator]\n}\n\nfunction getConditionals(fieldType) {\n return customOperators[fieldType] || defaultOperators\n}\n\nfunction inline(operator) {\n return {\n expression: (field, value) =>\n `${field.name} ${operator} ${formatValue(field.type, value.value)}`\n }\n}\n\nfunction lengthIs(operator) {\n return {\n expression: (field, value) =>\n `length(${field.name}) ${operator} ${value.value}`\n }\n}\n\nfunction reverseInline(operator) {\n return {\n expression: (field, value) =>\n `${formatValue(field.type, value.value)} ${operator} ${field.name}`\n }\n}\n\nfunction not(operatorDefinition) {\n return {\n expression: (field, value) =>\n `not (${operatorDefinition.expression(field, value)})`\n }\n}\n\nfunction formatValue(fieldType, value) {\n if (fieldType === 'NumberField' || fieldType === 'YesNoField') {\n return value\n }\n return `'${value}'`\n}\n\nexport const absoluteDateOrTimeOperatorNames = Object.keys(\n absoluteDateTimeOperators\n)\nexport const relativeDateOrTimeOperatorNames = Object.keys(\n relativeTimeOperators(dateTimeUnits)\n)\n\nfunction absoluteDateTime(operator) {\n return {\n expression: (field, value) => {\n if (value instanceof ConditionValue) {\n return `${field.name} ${operator} '${value.toExpression()}'`\n }\n throw Error('only Value types are supported')\n }\n }\n}\n\nfunction relativeTime(pastOperator, futureOperator, units) {\n return {\n units,\n expression: (field, value) => {\n if (value instanceof RelativeTimeValue) {\n const operator =\n value.direction === dateDirections.PAST\n ? pastOperator\n : futureOperator\n return `${field.name} ${operator} ${value.toExpression()}`\n }\n throw Error('time shift requires a TimeShiftValue')\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AASA,MAAMC,gBAAgB,GAAG;EACvBC,EAAE,EAAEC,MAAM,CAAC,IAAI,CAAC;EAChB,QAAQ,EAAEA,MAAM,CAAC,IAAI;AACvB,CAAC;AAED,SAASC,YAAYA,CAACC,KAAK,EAAE;EAC3B,OAAOC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEF,KAAK,EAAEJ,gBAAgB,CAAC;AACnD;AAEA,MAAMO,4BAA4B,GAAG;EACnC,gBAAgB,EAAEC,QAAQ,CAAC,GAAG,CAAC;EAC/B,iBAAiB,EAAEA,QAAQ,CAAC,GAAG,CAAC;EAChC,YAAY,EAAEA,QAAQ,CAAC,IAAI;AAC7B,CAAC;AAED,MAAMC,yBAAyB,GAAG;EAChCR,EAAE,EAAES,gBAAgB,CAAC,IAAI,CAAC;EAC1B,QAAQ,EAAEA,gBA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AC/C;EACF,CAAC;AACH;AAEA,SAASvC,YAAYA,CAACwC,YAAY,EAAEC,cAAc,EAAE1C,KAAK,EAAE;EACzD,OAAO;IACLA,KAAK;IACL6B,UAAU,EAAEA,CAACI,KAAK,EAAEL,KAAK,KAAK;MAC5B,IAAIA,KAAK,YAAYe,wCAAiB,EAAE;QACtC,MAAMhB,QAAQ,GACZC,KAAK,CAACgB,SAAS,KAAKC,qCAAc,CAACC,IAAI,GACnCL,YAAY,GACZC,cAAc;QACpB,OAAQ,GAAET,KAAK,CAACF,IAAK,IAAGJ,QAAS,IAAGC,KAAK,CAACW,YAAY,CAAC,CAAE,EAAC;MAC5D;MACA,MAAMC,KAAK,CAAC,sCAAsC,CAAC;IACrD;EACF,CAAC;AACH"}
@@ -0,0 +1,93 @@
1
+ declare class Registration {
2
+ type: any;
3
+ constructor(type: any, factory: any);
4
+ }
5
+ export declare class AbstractConditionValue {
6
+ type: any;
7
+ constructor(registration: any);
8
+ toPresentationString(): void;
9
+ toExpression(): void;
10
+ }
11
+ export declare class ConditionValue extends AbstractConditionValue {
12
+ value: any;
13
+ display: any;
14
+ constructor(value: any, display: any);
15
+ toPresentationString(): any;
16
+ toExpression(): any;
17
+ static from(obj: any): ConditionValue;
18
+ clone(): ConditionValue;
19
+ }
20
+ export declare const dateDirections: {
21
+ FUTURE: string;
22
+ PAST: string;
23
+ };
24
+ export declare const dateUnits: {
25
+ YEARS: {
26
+ display: string;
27
+ value: string;
28
+ };
29
+ MONTHS: {
30
+ display: string;
31
+ value: string;
32
+ };
33
+ DAYS: {
34
+ display: string;
35
+ value: string;
36
+ };
37
+ };
38
+ export declare const timeUnits: {
39
+ HOURS: {
40
+ display: string;
41
+ value: string;
42
+ };
43
+ MINUTES: {
44
+ display: string;
45
+ value: string;
46
+ };
47
+ SECONDS: {
48
+ display: string;
49
+ value: string;
50
+ };
51
+ };
52
+ export declare const dateTimeUnits: {
53
+ YEARS: {
54
+ display: string;
55
+ value: string;
56
+ };
57
+ MONTHS: {
58
+ display: string;
59
+ value: string;
60
+ };
61
+ DAYS: {
62
+ display: string;
63
+ value: string;
64
+ };
65
+ } & {
66
+ HOURS: {
67
+ display: string;
68
+ value: string;
69
+ };
70
+ MINUTES: {
71
+ display: string;
72
+ value: string;
73
+ };
74
+ SECONDS: {
75
+ display: string;
76
+ value: string;
77
+ };
78
+ };
79
+ export declare const relativeTimeValueType: Registration;
80
+ export declare class RelativeTimeValue extends AbstractConditionValue {
81
+ timePeriod: any;
82
+ timeUnit: any;
83
+ direction: any;
84
+ timeOnly: any;
85
+ constructor(timePeriod: any, timeUnit: any, direction: any, timeOnly?: boolean);
86
+ toPresentationString(): string;
87
+ toExpression(): string;
88
+ static from(obj: any): RelativeTimeValue;
89
+ clone(): RelativeTimeValue;
90
+ }
91
+ export declare function valueFrom(obj: any): any;
92
+ export {};
93
+ //# sourceMappingURL=inline-condition-values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-condition-values.d.ts","sourceRoot":"","sources":["../../../src/conditions/inline-condition-values.ts"],"names":[],"mappings":"AAEA,cAAM,YAAY;IAChB,IAAI,MAAA;gBAEQ,IAAI,KAAA,EAAE,OAAO,KAAA;CAI1B;AAED,qBAAa,sBAAsB;IACjC,IAAI,MAAA;gBAEQ,YAAY,KAAA;IAYxB,oBAAoB;IACpB,YAAY;CACb;AAGD,qBAAa,cAAe,SAAQ,sBAAsB;IACxD,KAAK,MAAA;IACL,OAAO,MAAA;gBAEK,KAAK,KAAA,EAAE,OAAO,KAAA;IAY1B,oBAAoB;IAIpB,YAAY;IAIZ,MAAM,CAAC,IAAI,CAAC,GAAG,KAAA;IAIf,KAAK;CAGN;AAED,eAAO,MAAM,cAAc;;;CAG1B,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;CAIrB,CAAA;AACD,eAAO,MAAM,SAAS;;;;;;;;;;;;;CAIrB,CAAA;AACD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;CAA0C,CAAA;AAEpE,eAAO,MAAM,qBAAqB,cAEjC,CAAA;AACD,qBAAa,iBAAkB,SAAQ,sBAAsB;IAC3D,UAAU,MAAA;IACV,QAAQ,MAAA;IACR,SAAS,MAAA;IACT,QAAQ,MAAA;gBAEI,UAAU,KAAA,EAAE,QAAQ,KAAA,EAAE,SAAS,KAAA,EAAE,QAAQ,UAAQ;IAqB7D,oBAAoB;IAIpB,YAAY;IAUZ,MAAM,CAAC,IAAI,CAAC,GAAG,KAAA;IASf,KAAK;CAGN;AAaD,wBAAgB,SAAS,CAAC,GAAG,KAAA,OAE5B"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.timeUnits = exports.relativeTimeValueType = exports.dateUnits = exports.dateTimeUnits = exports.dateDirections = exports.RelativeTimeValue = exports.ConditionValue = exports.AbstractConditionValue = void 0;
5
+ exports.valueFrom = valueFrom;
6
+ const conditionValueFactories = {};
7
+ class Registration {
8
+ constructor(type, factory) {
9
+ conditionValueFactories[type] = factory;
10
+ this.type = type;
11
+ }
12
+ }
13
+ class AbstractConditionValue {
14
+ constructor(registration) {
15
+ if (new.target === AbstractConditionValue) {
16
+ throw new TypeError('Cannot construct ConditionValue instances directly');
17
+ }
18
+ if (!(registration instanceof Registration)) {
19
+ throw new TypeError('You must register your value type! Call registerValueType!');
20
+ }
21
+ this.type = registration.type;
22
+ }
23
+ toPresentationString() {}
24
+ toExpression() {}
25
+ }
26
+ exports.AbstractConditionValue = AbstractConditionValue;
27
+ const valueType = registerValueType('Value', obj => ConditionValue.from(obj));
28
+ class ConditionValue extends AbstractConditionValue {
29
+ constructor(value, display) {
30
+ super(valueType);
31
+ if (!value || typeof value !== 'string') {
32
+ throw Error(`value ${value} is not valid`);
33
+ }
34
+ if (display && typeof display !== 'string') {
35
+ throw Error(`display ${display} is not valid`);
36
+ }
37
+ this.value = value;
38
+ this.display = display || value;
39
+ }
40
+ toPresentationString() {
41
+ return this.display;
42
+ }
43
+ toExpression() {
44
+ return this.value;
45
+ }
46
+ static from(obj) {
47
+ return new ConditionValue(obj.value, obj.display);
48
+ }
49
+ clone() {
50
+ return ConditionValue.from(this);
51
+ }
52
+ }
53
+ exports.ConditionValue = ConditionValue;
54
+ const dateDirections = exports.dateDirections = {
55
+ FUTURE: 'in the future',
56
+ PAST: 'in the past'
57
+ };
58
+ const dateUnits = exports.dateUnits = {
59
+ YEARS: {
60
+ display: 'year(s)',
61
+ value: 'years'
62
+ },
63
+ MONTHS: {
64
+ display: 'month(s)',
65
+ value: 'months'
66
+ },
67
+ DAYS: {
68
+ display: 'day(s)',
69
+ value: 'days'
70
+ }
71
+ };
72
+ const timeUnits = exports.timeUnits = {
73
+ HOURS: {
74
+ display: 'hour(s)',
75
+ value: 'hours'
76
+ },
77
+ MINUTES: {
78
+ display: 'minute(s)',
79
+ value: 'minutes'
80
+ },
81
+ SECONDS: {
82
+ display: 'second(s)',
83
+ value: 'seconds'
84
+ }
85
+ };
86
+ const dateTimeUnits = exports.dateTimeUnits = Object.assign({}, dateUnits, timeUnits);
87
+ const relativeTimeValueType = exports.relativeTimeValueType = registerValueType('RelativeTime', obj => RelativeTimeValue.from(obj));
88
+ class RelativeTimeValue extends AbstractConditionValue {
89
+ constructor(timePeriod, timeUnit, direction, timeOnly = false) {
90
+ super(relativeTimeValueType);
91
+ if (typeof timePeriod !== 'string') {
92
+ throw Error(`time period ${timePeriod} is not valid`);
93
+ }
94
+ if (!Object.values(dateTimeUnits).map(it => it.value).includes(timeUnit)) {
95
+ throw Error(`time unit ${timeUnit} is not valid`);
96
+ }
97
+ if (!Object.values(dateDirections).includes(direction)) {
98
+ throw Error(`direction ${direction} is not valid`);
99
+ }
100
+ this.timePeriod = timePeriod;
101
+ this.timeUnit = timeUnit;
102
+ this.direction = direction;
103
+ this.timeOnly = timeOnly;
104
+ }
105
+ toPresentationString() {
106
+ return `${this.timePeriod} ${this.timeUnit} ${this.direction}`;
107
+ }
108
+ toExpression() {
109
+ const timePeriod = this.direction === dateDirections.PAST ? 0 - Number(this.timePeriod) : this.timePeriod;
110
+ return this.timeOnly ? `timeForComparison(${timePeriod}, '${this.timeUnit}')` : `dateForComparison(${timePeriod}, '${this.timeUnit}')`;
111
+ }
112
+ static from(obj) {
113
+ return new RelativeTimeValue(obj.timePeriod, obj.timeUnit, obj.direction, obj.timeOnly);
114
+ }
115
+ clone() {
116
+ return RelativeTimeValue.from(this);
117
+ }
118
+ }
119
+
120
+ /**
121
+ * All value types should call this, and should be located in this file.
122
+ * Furthermore the types should be registered without the classes needing to be instantiated.
123
+ *
124
+ * Otherwise we can't guarantee they've been registered for deserialization before
125
+ * valueFrom is called
126
+ */
127
+ exports.RelativeTimeValue = RelativeTimeValue;
128
+ function registerValueType(type, factory) {
129
+ return new Registration(type, factory);
130
+ }
131
+ function valueFrom(obj) {
132
+ return conditionValueFactories[obj.type](obj);
133
+ }
134
+ //# sourceMappingURL=inline-condition-values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-condition-values.js","names":["conditionValueFactories","Registration","constructor","type","factory","AbstractConditionValue","registration","new","target","TypeError","toPresentationString","toExpression","exports","valueType","registerValueType","obj","ConditionValue","from","value","display","Error","clone","dateDirections","FUTURE","PAST","dateUnits","YEARS","MONTHS","DAYS","timeUnits","HOURS","MINUTES","SECONDS","dateTimeUnits","Object","assign","relativeTimeValueType","RelativeTimeValue","timePeriod","timeUnit","direction","timeOnly","values","map","it","includes","Number","valueFrom"],"sources":["../../../src/conditions/inline-condition-values.ts"],"sourcesContent":["const conditionValueFactories = {}\n\nclass Registration {\n type\n\n constructor(type, factory) {\n conditionValueFactories[type] = factory\n this.type = type\n }\n}\n\nexport class AbstractConditionValue {\n type\n\n constructor(registration) {\n if (new.target === AbstractConditionValue) {\n throw new TypeError('Cannot construct ConditionValue instances directly')\n }\n if (!(registration instanceof Registration)) {\n throw new TypeError(\n 'You must register your value type! Call registerValueType!'\n )\n }\n this.type = registration.type\n }\n\n toPresentationString() {}\n toExpression() {}\n}\n\nconst valueType = registerValueType('Value', (obj) => ConditionValue.from(obj))\nexport class ConditionValue extends AbstractConditionValue {\n value\n display\n\n constructor(value, display) {\n super(valueType)\n if (!value || typeof value !== 'string') {\n throw Error(`value ${value} is not valid`)\n }\n if (display && typeof display !== 'string') {\n throw Error(`display ${display} is not valid`)\n }\n this.value = value\n this.display = display || value\n }\n\n toPresentationString() {\n return this.display\n }\n\n toExpression() {\n return this.value\n }\n\n static from(obj) {\n return new ConditionValue(obj.value, obj.display)\n }\n\n clone() {\n return ConditionValue.from(this)\n }\n}\n\nexport const dateDirections = {\n FUTURE: 'in the future',\n PAST: 'in the past'\n}\n\nexport const dateUnits = {\n YEARS: { display: 'year(s)', value: 'years' },\n MONTHS: { display: 'month(s)', value: 'months' },\n DAYS: { display: 'day(s)', value: 'days' }\n}\nexport const timeUnits = {\n HOURS: { display: 'hour(s)', value: 'hours' },\n MINUTES: { display: 'minute(s)', value: 'minutes' },\n SECONDS: { display: 'second(s)', value: 'seconds' }\n}\nexport const dateTimeUnits = Object.assign({}, dateUnits, timeUnits)\n\nexport const relativeTimeValueType = registerValueType('RelativeTime', (obj) =>\n RelativeTimeValue.from(obj)\n)\nexport class RelativeTimeValue extends AbstractConditionValue {\n timePeriod\n timeUnit\n direction\n timeOnly\n\n constructor(timePeriod, timeUnit, direction, timeOnly = false) {\n super(relativeTimeValueType)\n if (typeof timePeriod !== 'string') {\n throw Error(`time period ${timePeriod} is not valid`)\n }\n if (\n !Object.values(dateTimeUnits)\n .map((it) => it.value)\n .includes(timeUnit)\n ) {\n throw Error(`time unit ${timeUnit} is not valid`)\n }\n if (!Object.values(dateDirections).includes(direction)) {\n throw Error(`direction ${direction} is not valid`)\n }\n this.timePeriod = timePeriod\n this.timeUnit = timeUnit\n this.direction = direction\n this.timeOnly = timeOnly\n }\n\n toPresentationString() {\n return `${this.timePeriod} ${this.timeUnit} ${this.direction}`\n }\n\n toExpression() {\n const timePeriod =\n this.direction === dateDirections.PAST\n ? 0 - Number(this.timePeriod)\n : this.timePeriod\n return this.timeOnly\n ? `timeForComparison(${timePeriod}, '${this.timeUnit}')`\n : `dateForComparison(${timePeriod}, '${this.timeUnit}')`\n }\n\n static from(obj) {\n return new RelativeTimeValue(\n obj.timePeriod,\n obj.timeUnit,\n obj.direction,\n obj.timeOnly\n )\n }\n\n clone() {\n return RelativeTimeValue.from(this)\n }\n}\n\n/**\n * All value types should call this, and should be located in this file.\n * Furthermore the types should be registered without the classes needing to be instantiated.\n *\n * Otherwise we can't guarantee they've been registered for deserialization before\n * valueFrom is called\n */\nfunction registerValueType(type, factory) {\n return new Registration(type, factory)\n}\n\nexport function valueFrom(obj) {\n return conditionValueFactories[obj.type](obj)\n}\n"],"mappings":";;;;;AAAA,MAAMA,uBAAuB,GAAG,CAAC,CAAC;AAElC,MAAMC,YAAY,CAAC;EAGjBC,WAAWA,CAACC,IAAI,EAAEC,OAAO,EAAE;IACzBJ,uBAAuB,CAACG,IAAI,CAAC,GAAGC,OAAO;IACvC,IAAI,CAACD,IAAI,GAAGA,IAAI;EAClB;AACF;AAEO,MAAME,sBAAsB,CAAC;EAGlCH,WAAWA,CAACI,YAAY,EAAE;IACxB,IAAIC,GAAG,CAACC,MAAM,KAAKH,sBAAsB,EAAE;MACzC,MAAM,IAAII,SAAS,CAAC,oDAAoD,CAAC;IAC3E;IACA,IAAI,EAAEH,YAAY,YAAYL,YAAY,CAAC,EAAE;MAC3C,MAAM,IAAIQ,SAAS,CACjB,4DACF,CAAC;IACH;IACA,IAAI,CAACN,IAAI,GAAGG,YAAY,CAACH,IAAI;EAC/B;EAEAO,oBAAoBA,CAAA,EAAG,CAAC;EACxBC,YAAYA,CAAA,EAAG,CAAC;AAClB;AAACC,OAAA,CAAAP,sBAAA,GAAAA,sBAAA;AAED,MAAMQ,SAAS,GAAGC,iBAAiB,CAAC,OAAO,EAAGC,GAAG,IAAKC,cAAc,CAACC,IAAI,CAACF,GAAG,CAAC,CAAC;AACxE,MAAMC,cAAc,SAAS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