@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,140 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ Object.defineProperty(exports, "Condition", {
5
+ enumerable: true,
6
+ get: function () {
7
+ return _condition.Condition;
8
+ }
9
+ });
10
+ Object.defineProperty(exports, "ConditionField", {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _conditionField.ConditionField;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "ConditionGroup", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return _conditionGroup.ConditionGroup;
20
+ }
21
+ });
22
+ Object.defineProperty(exports, "ConditionGroupDef", {
23
+ enumerable: true,
24
+ get: function () {
25
+ return _conditionGroupDef.ConditionGroupDef;
26
+ }
27
+ });
28
+ Object.defineProperty(exports, "ConditionRef", {
29
+ enumerable: true,
30
+ get: function () {
31
+ return _conditionRef.ConditionRef;
32
+ }
33
+ });
34
+ Object.defineProperty(exports, "ConditionValue", {
35
+ enumerable: true,
36
+ get: function () {
37
+ return _conditionValues.ConditionValue;
38
+ }
39
+ });
40
+ Object.defineProperty(exports, "ConditionsModel", {
41
+ enumerable: true,
42
+ get: function () {
43
+ return _conditionModel.ConditionsModel;
44
+ }
45
+ });
46
+ Object.defineProperty(exports, "Coordinator", {
47
+ enumerable: true,
48
+ get: function () {
49
+ return _types.Coordinator;
50
+ }
51
+ });
52
+ Object.defineProperty(exports, "DateDirections", {
53
+ enumerable: true,
54
+ get: function () {
55
+ return _conditionValues.DateDirections;
56
+ }
57
+ });
58
+ Object.defineProperty(exports, "RelativeTimeValue", {
59
+ enumerable: true,
60
+ get: function () {
61
+ return _conditionValues.RelativeTimeValue;
62
+ }
63
+ });
64
+ Object.defineProperty(exports, "absoluteDateOrTimeOperatorNames", {
65
+ enumerable: true,
66
+ get: function () {
67
+ return _conditionOperators.absoluteDateOrTimeOperatorNames;
68
+ }
69
+ });
70
+ Object.defineProperty(exports, "conditionValueFrom", {
71
+ enumerable: true,
72
+ get: function () {
73
+ return _conditionValues.conditionValueFrom;
74
+ }
75
+ });
76
+ Object.defineProperty(exports, "dateTimeUnits", {
77
+ enumerable: true,
78
+ get: function () {
79
+ return _conditionValues.dateTimeUnits;
80
+ }
81
+ });
82
+ Object.defineProperty(exports, "dateUnits", {
83
+ enumerable: true,
84
+ get: function () {
85
+ return _conditionValues.dateUnits;
86
+ }
87
+ });
88
+ Object.defineProperty(exports, "getExpression", {
89
+ enumerable: true,
90
+ get: function () {
91
+ return _conditionOperators.getExpression;
92
+ }
93
+ });
94
+ Object.defineProperty(exports, "getOperatorConfig", {
95
+ enumerable: true,
96
+ get: function () {
97
+ return _conditionOperators.getOperatorConfig;
98
+ }
99
+ });
100
+ Object.defineProperty(exports, "getOperatorNames", {
101
+ enumerable: true,
102
+ get: function () {
103
+ return _conditionOperators.getOperatorNames;
104
+ }
105
+ });
106
+ Object.defineProperty(exports, "relativeDateOrTimeOperatorNames", {
107
+ enumerable: true,
108
+ get: function () {
109
+ return _conditionOperators.relativeDateOrTimeOperatorNames;
110
+ }
111
+ });
112
+ Object.defineProperty(exports, "timeUnits", {
113
+ enumerable: true,
114
+ get: function () {
115
+ return _conditionValues.timeUnits;
116
+ }
117
+ });
118
+ Object.defineProperty(exports, "toExpression", {
119
+ enumerable: true,
120
+ get: function () {
121
+ return _helpers.toExpression;
122
+ }
123
+ });
124
+ Object.defineProperty(exports, "toPresentationString", {
125
+ enumerable: true,
126
+ get: function () {
127
+ return _helpers.toPresentationString;
128
+ }
129
+ });
130
+ var _conditionOperators = require("./condition-operators");
131
+ var _conditionValues = require("./condition-values");
132
+ var _conditionField = require("./condition-field");
133
+ var _condition = require("./condition");
134
+ var _conditionRef = require("./condition-ref");
135
+ var _conditionGroup = require("./condition-group");
136
+ var _conditionModel = require("./condition-model");
137
+ var _conditionGroupDef = require("./condition-group-def");
138
+ var _helpers = require("./helpers");
139
+ var _types = require("./types");
140
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_conditionOperators","require","_conditionValues","_conditionField","_condition","_conditionRef","_conditionGroup","_conditionModel","_conditionGroupDef","_helpers","_types"],"sources":["../../../src/conditions/index.ts"],"sourcesContent":["export {\n getExpression,\n getOperatorConfig,\n getOperatorNames,\n absoluteDateOrTimeOperatorNames,\n relativeDateOrTimeOperatorNames\n} from './condition-operators'\n\nexport {\n timeUnits,\n dateUnits,\n dateTimeUnits,\n ConditionValue,\n DateDirections,\n RelativeTimeValue,\n conditionValueFrom\n} from './condition-values'\n\nexport { ConditionField } from './condition-field'\nexport { Condition } from './condition'\nexport { ConditionRef } from './condition-ref'\nexport { ConditionGroup } from './condition-group'\nexport { ConditionsModel } from './condition-model'\nexport { ConditionGroupDef } from './condition-group-def'\nexport { toExpression, toPresentationString } from './helpers'\n\nexport { Coordinator } from './types'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAQA,IAAAC,gBAAA,GAAAD,OAAA;AAUA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAEA,IAAAS,MAAA,GAAAT,OAAA"}
@@ -0,0 +1,86 @@
1
+ export declare const coordinators: {
2
+ AND: string;
3
+ OR: string;
4
+ };
5
+ export declare class ConditionsModel {
6
+ #private;
7
+ constructor();
8
+ clone(): ConditionsModel;
9
+ clear(): this;
10
+ set name(name: any);
11
+ get name(): any;
12
+ add(condition: any): this;
13
+ replace(index: any, condition: any): this;
14
+ remove(indexes: any): this;
15
+ addGroups(groupDefs: any): this;
16
+ splitGroup(index: any): this;
17
+ moveEarlier(index: any): this;
18
+ moveLater(index: any): this;
19
+ switchCoordinators(): void;
20
+ get asPerUserGroupings(): any[];
21
+ get hasConditions(): boolean;
22
+ get lastIndex(): number;
23
+ toPresentationString(): any;
24
+ toExpression(): any;
25
+ _applyGroups(userGroupedConditions: any): any;
26
+ _group(conditions: any, groupDefs: any): any;
27
+ _ungroup(conditions: any, splitIndex: any): any;
28
+ _autoGroupDefs(conditions: any): GroupDef[];
29
+ toJSON(): {
30
+ name: any;
31
+ conditions: any;
32
+ };
33
+ static from(obj: any): ConditionsModel;
34
+ }
35
+ export declare class GroupDef {
36
+ first: any;
37
+ last: any;
38
+ constructor(first: any, last: any);
39
+ contains(index: any): boolean;
40
+ startsWith(index: any): boolean;
41
+ applyTo(conditions: any): any[];
42
+ }
43
+ export declare function toPresentationString(condition: any): string;
44
+ export declare function toExpression(condition: any): string;
45
+ export declare class Field {
46
+ name: any;
47
+ type: any;
48
+ display: any;
49
+ constructor(name: any, type: any, display: any);
50
+ static from(obj: any): Field;
51
+ }
52
+ declare class AbstractCondition {
53
+ coordinator: any;
54
+ constructor(coordinator: any);
55
+ coordinatorString(): string;
56
+ getCoordinator(): any;
57
+ setCoordinator(coordinator: any): void;
58
+ isGroup(): boolean;
59
+ getGroupedConditions(): this[];
60
+ _asFirstCondition(): void;
61
+ asFirstCondition(): void;
62
+ clone(): void;
63
+ conditionString(): void;
64
+ conditionExpression(): void;
65
+ }
66
+ export declare class Condition extends AbstractCondition {
67
+ field: any;
68
+ operator: any;
69
+ value: any;
70
+ constructor(field: any, operator: any, value: any, coordinator: any);
71
+ asFirstCondition(): this;
72
+ conditionString(): string;
73
+ conditionExpression(): any;
74
+ clone(): Condition;
75
+ }
76
+ export declare class ConditionRef extends AbstractCondition {
77
+ conditionName: any;
78
+ conditionDisplayName: any;
79
+ constructor(conditionName: any, conditionDisplayName: any, coordinator: any);
80
+ asFirstCondition(): this;
81
+ conditionString(): string;
82
+ conditionExpression(): any;
83
+ clone(): ConditionRef;
84
+ }
85
+ export {};
86
+ //# sourceMappingURL=inline-condition-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-condition-model.d.ts","sourceRoot":"","sources":["../../../src/conditions/inline-condition-model.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;;CAGxB,CAAA;AAED,qBAAa,eAAe;;;IAU1B,KAAK;IAYL,KAAK;IAOL,IAAI,IAAI,CAAC,IAAI,KAAA,EAEZ;IAED,IAAI,IAAI,QAEP;IAED,GAAG,CAAC,SAAS,KAAA;IAYb,OAAO,CAAC,KAAK,KAAA,EAAE,SAAS,KAAA;IAgBxB,MAAM,CAAC,OAAO,KAAA;IAWd,SAAS,CAAC,SAAS,KAAA;IASnB,UAAU,CAAC,KAAK,KAAA;IAShB,WAAW,CAAC,KAAK,KAAA;IAejB,SAAS,CAAC,KAAK,KAAA;IAef,kBAAkB;IAOlB,IAAI,kBAAkB,UAErB;IAED,IAAI,aAAa,YAEhB;IAED,IAAI,SAAS,WAEZ;IAED,oBAAoB;IAMpB,YAAY;IAMZ,YAAY,CAAC,qBAAqB,KAAA;IAiBlC,MAAM,CAAC,UAAU,KAAA,EAAE,SAAS,KAAA;IAe5B,QAAQ,CAAC,UAAU,KAAA,EAAE,UAAU,KAAA;IAa/B,cAAc,CAAC,UAAU,KAAA;IA8BzB,MAAM;;;;IASN,MAAM,CAAC,IAAI,CAAC,GAAG,KAAA;CAchB;AAuBD,qBAAa,QAAQ;IACnB,KAAK,MAAA;IACL,IAAI,MAAA;gBAEQ,KAAK,KAAA,EAAE,IAAI,KAAA;IAUvB,QAAQ,CAAC,KAAK,KAAA;IAId,UAAU,CAAC,KAAK,KAAA;IAIhB,OAAO,CAAC,UAAU,KAAA;CAGnB;AA4DD,wBAAgB,oBAAoB,CAAC,SAAS,KAAA,UAE7C;AAED,wBAAgB,YAAY,CAAC,SAAS,KAAA,UAErC;AAED,qBAAa,KAAK;IAChB,IAAI,MAAA;IACJ,IAAI,MAAA;IACJ,OAAO,MAAA;gBAEK,IAAI,KAAA,EAAE,IAAI,KAAA,EAAE,OAAO,KAAA;IAe/B,MAAM,CAAC,IAAI,CAAC,GAAG,KAAA;CAGhB;AAED,cAAM,iBAAiB;IACrB,WAAW,MAAA;gBAEC,WAAW,KAAA;IAOvB,iBAAiB;IAIjB,cAAc;IAId,cAAc,CAAC,WAAW,KAAA;IAI1B,OAAO;IAIP,oBAAoB;IAIpB,iBAAiB;IAIjB,gBAAgB;IAMhB,KAAK;IAML,eAAe;IAMf,mBAAmB;CAKpB;AAED,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C,KAAK,MAAA;IACL,QAAQ,MAAA;IACR,KAAK,MAAA;gBAEO,KAAK,KAAA,EAAE,QAAQ,KAAA,EAAE,KAAK,KAAA,EAAE,WAAW,KAAA;IAgB/C,gBAAgB;IAKhB,eAAe;IAMf,mBAAmB;IASnB,KAAK;CAQN;AAED,qBAAa,YAAa,SAAQ,iBAAiB;IACjD,aAAa,MAAA;IACb,oBAAoB,MAAA;gBAER,aAAa,KAAA,EAAE,oBAAoB,KAAA,EAAE,WAAW,KAAA;IAY5D,gBAAgB;IAKhB,eAAe;IAIf,mBAAmB;IAInB,KAAK;CAON"}
@@ -0,0 +1,384 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.coordinators = exports.GroupDef = exports.Field = exports.ConditionsModel = exports.ConditionRef = exports.Condition = void 0;
5
+ exports.toExpression = toExpression;
6
+ exports.toPresentationString = toPresentationString;
7
+ var _componentTypes = require("../components/component-types");
8
+ var _inlineConditionOperators = require("./inline-condition-operators");
9
+ var _inlineConditionValues = require("./inline-condition-values");
10
+ const coordinators = exports.coordinators = {
11
+ AND: 'and',
12
+ OR: 'or'
13
+ };
14
+ class ConditionsModel {
15
+ #groupedConditions;
16
+ #userGroupedConditions;
17
+ #conditionName;
18
+ constructor() {
19
+ this.#groupedConditions = [];
20
+ this.#userGroupedConditions = [];
21
+ }
22
+ clone() {
23
+ const toReturn = new ConditionsModel();
24
+ toReturn.#groupedConditions = this.#groupedConditions.map(it => it.clone());
25
+ toReturn.#userGroupedConditions = this.#userGroupedConditions.map(it => it.clone());
26
+ toReturn.#conditionName = this.#conditionName;
27
+ return toReturn;
28
+ }
29
+ clear() {
30
+ this.#userGroupedConditions = [];
31
+ this.#groupedConditions = [];
32
+ this.#conditionName = undefined;
33
+ return this;
34
+ }
35
+ set name(name) {
36
+ this.#conditionName = name;
37
+ }
38
+ get name() {
39
+ return this.#conditionName;
40
+ }
41
+ add(condition) {
42
+ const coordinatorExpected = this.#userGroupedConditions.length !== 0;
43
+ if (condition.getCoordinator() && !coordinatorExpected) {
44
+ throw Error('No coordinator allowed on the first condition');
45
+ } else if (!condition.getCoordinator() && coordinatorExpected) {
46
+ throw Error('Coordinator must be present on subsequent conditions');
47
+ }
48
+ this.#userGroupedConditions.push(condition);
49
+ this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
50
+ return this;
51
+ }
52
+ replace(index, condition) {
53
+ const coordinatorExpected = index !== 0;
54
+ if (condition.getCoordinator() && !coordinatorExpected) {
55
+ throw Error('No coordinator allowed on the first condition');
56
+ } else if (!condition.getCoordinator() && coordinatorExpected) {
57
+ throw Error('Coordinator must be present on subsequent conditions');
58
+ } else if (index >= this.#userGroupedConditions.length) {
59
+ throw Error(`Cannot replace condition ${index} as no such condition exists`);
60
+ }
61
+ this.#userGroupedConditions.splice(index, 1, condition);
62
+ this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
63
+ return this;
64
+ }
65
+ remove(indexes) {
66
+ this.#userGroupedConditions = this.#userGroupedConditions.filter((_condition, index) => !indexes.includes(index)).map((condition, index) => index === 0 ? condition.asFirstCondition() : condition);
67
+ this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
68
+ return this;
69
+ }
70
+ addGroups(groupDefs) {
71
+ this.#userGroupedConditions = this._group(this.#userGroupedConditions, groupDefs);
72
+ this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
73
+ return this;
74
+ }
75
+ splitGroup(index) {
76
+ this.#userGroupedConditions = this._ungroup(this.#userGroupedConditions, index);
77
+ this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
78
+ return this;
79
+ }
80
+ moveEarlier(index) {
81
+ if (index > 0 && index < this.#userGroupedConditions.length) {
82
+ this.#userGroupedConditions.splice(index - 1, 0, this.#userGroupedConditions.splice(index, 1)[0]);
83
+ if (index === 1) {
84
+ this.switchCoordinators();
85
+ }
86
+ this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
87
+ }
88
+ return this;
89
+ }
90
+ moveLater(index) {
91
+ if (index >= 0 && index < this.#userGroupedConditions.length - 1) {
92
+ this.#userGroupedConditions.splice(index + 1, 0, this.#userGroupedConditions.splice(index, 1)[0]);
93
+ if (index === 0) {
94
+ this.switchCoordinators();
95
+ }
96
+ this.#groupedConditions = this._applyGroups(this.#userGroupedConditions);
97
+ }
98
+ return this;
99
+ }
100
+ switchCoordinators() {
101
+ this.#userGroupedConditions[1].setCoordinator(this.#userGroupedConditions[0].getCoordinator());
102
+ this.#userGroupedConditions[0].setCoordinator(undefined);
103
+ }
104
+ get asPerUserGroupings() {
105
+ return [...this.#userGroupedConditions];
106
+ }
107
+ get hasConditions() {
108
+ return this.#userGroupedConditions.length > 0;
109
+ }
110
+ get lastIndex() {
111
+ return this.#userGroupedConditions.length - 1;
112
+ }
113
+ toPresentationString() {
114
+ return this.#groupedConditions.map(condition => toPresentationString(condition)).join(' ');
115
+ }
116
+ toExpression() {
117
+ return this.#groupedConditions.map(condition => toExpression(condition)).join(' ');
118
+ }
119
+ _applyGroups(userGroupedConditions) {
120
+ const correctedUserGroups = userGroupedConditions.map(condition => condition instanceof ConditionGroup && condition.conditions.length > 2 ? new ConditionGroup(this._group(condition.conditions, this._autoGroupDefs(condition.conditions))) : condition);
121
+ return this._group(correctedUserGroups, this._autoGroupDefs(correctedUserGroups));
122
+ }
123
+ _group(conditions, groupDefs) {
124
+ return conditions.reduce((groups, condition, index, conditions) => {
125
+ const groupDef = groupDefs.find(groupDef => groupDef.contains(index));
126
+ if (groupDef) {
127
+ if (groupDef.startsWith(index)) {
128
+ const groupConditions = groupDef.applyTo(conditions);
129
+ groups.push(new ConditionGroup(groupConditions));
130
+ }
131
+ } else {
132
+ groups.push(condition);
133
+ }
134
+ return groups;
135
+ }, []);
136
+ }
137
+ _ungroup(conditions, splitIndex) {
138
+ if (conditions[splitIndex].isGroup()) {
139
+ const copy = [...conditions];
140
+ copy.splice(splitIndex, 1, ...conditions[splitIndex].getGroupedConditions());
141
+ return copy;
142
+ }
143
+ return conditions;
144
+ }
145
+ _autoGroupDefs(conditions) {
146
+ const orPositions = [];
147
+ conditions.forEach((condition, index) => {
148
+ if (condition.getCoordinator() === coordinators.OR) {
149
+ orPositions.push(index);
150
+ }
151
+ });
152
+ const hasAnd = !!conditions.find(condition => condition.getCoordinator() === coordinators.AND);
153
+ const hasOr = orPositions.length > 0;
154
+ if (hasAnd && hasOr) {
155
+ let start = 0;
156
+ const groupDefs = [];
157
+ orPositions.forEach((position, index) => {
158
+ if (start < position - 1) {
159
+ groupDefs.push(new GroupDef(start, position - 1));
160
+ }
161
+ const thisIsTheLastOr = orPositions.length === index + 1;
162
+ const thereAreMoreConditions = conditions.length - 1 > position;
163
+ if (thisIsTheLastOr && thereAreMoreConditions) {
164
+ groupDefs.push(new GroupDef(position, conditions.length - 1));
165
+ }
166
+ start = position;
167
+ });
168
+ return groupDefs;
169
+ }
170
+ return [];
171
+ }
172
+ toJSON() {
173
+ const name = this.#conditionName;
174
+ const conditions = this.#userGroupedConditions;
175
+ return {
176
+ name,
177
+ conditions: conditions.map(it => it.clone())
178
+ };
179
+ }
180
+ static from(obj) {
181
+ if (obj instanceof ConditionsModel) {
182
+ return obj;
183
+ }
184
+ const toReturn = new ConditionsModel();
185
+ toReturn.#conditionName = obj.name;
186
+ toReturn.#userGroupedConditions = obj.conditions.map(it => conditionFrom(it));
187
+ toReturn.#groupedConditions = toReturn._applyGroups(toReturn.#userGroupedConditions);
188
+ return toReturn;
189
+ }
190
+ }
191
+ exports.ConditionsModel = ConditionsModel;
192
+ function conditionFrom(it) {
193
+ if (it.conditions) {
194
+ return new ConditionGroup(it.conditions.map(condition => conditionFrom(condition)));
195
+ }
196
+ if (it.conditionName) {
197
+ return new ConditionRef(it.conditionName, it.conditionDisplayName, it.coordinator);
198
+ }
199
+ return new Condition(Field.from(it.field), it.operator, (0, _inlineConditionValues.valueFrom)(it.value), it.coordinator);
200
+ }
201
+ class GroupDef {
202
+ constructor(first, last) {
203
+ if (typeof first !== 'number' || typeof last !== 'number') {
204
+ throw Error(`Cannot construct a group from ${first} and ${last}`);
205
+ } else if (first >= last) {
206
+ throw Error(`Last (${last}) must be greater than first (${first})`);
207
+ }
208
+ this.first = first;
209
+ this.last = last;
210
+ }
211
+ contains(index) {
212
+ return this.first <= index && this.last >= index;
213
+ }
214
+ startsWith(index) {
215
+ return this.first === index;
216
+ }
217
+ applyTo(conditions) {
218
+ return [...conditions].splice(this.first, this.last - this.first + 1);
219
+ }
220
+ }
221
+ exports.GroupDef = GroupDef;
222
+ class ConditionGroup {
223
+ constructor(conditions) {
224
+ if (!Array.isArray(conditions) || conditions.length < 2) {
225
+ throw Error('Cannot construct a condition group from a single condition');
226
+ }
227
+ this.conditions = conditions;
228
+ }
229
+ coordinatorString() {
230
+ return this.conditions[0].coordinatorString();
231
+ }
232
+ conditionString() {
233
+ const copy = [...this.conditions];
234
+ copy.splice(0, 1);
235
+ return `(${this.conditions[0].conditionString()} ${copy.map(condition => toPresentationString(condition)).join(' ')})`;
236
+ }
237
+ conditionExpression() {
238
+ const copy = [...this.conditions];
239
+ copy.splice(0, 1);
240
+ return `(${this.conditions[0].conditionExpression()} ${copy.map(condition => toExpression(condition)).join(' ')})`;
241
+ }
242
+ asFirstCondition() {
243
+ this.conditions[0].asFirstCondition();
244
+ return this;
245
+ }
246
+ getCoordinator() {
247
+ return this.conditions[0].getCoordinator();
248
+ }
249
+ setCoordinator(coordinator) {
250
+ this.conditions[0].setCoordinator(coordinator);
251
+ }
252
+ isGroup() {
253
+ return true;
254
+ }
255
+ getGroupedConditions() {
256
+ return this.conditions.map(condition => condition.clone());
257
+ }
258
+ clone() {
259
+ return new ConditionGroup(this.conditions.map(condition => condition.clone()));
260
+ }
261
+ }
262
+ function toPresentationString(condition) {
263
+ return `${condition.coordinatorString()}${condition.conditionString()}`;
264
+ }
265
+ function toExpression(condition) {
266
+ return `${condition.coordinatorString()}${condition.conditionExpression()}`;
267
+ }
268
+ class Field {
269
+ constructor(name, type, display) {
270
+ if (!name || typeof name !== 'string') {
271
+ throw Error(`name ${name} is not valid`);
272
+ }
273
+ if (!_componentTypes.ComponentTypes.find(componentType => componentType.name === type)) {
274
+ throw Error(`type ${type} is not valid`);
275
+ }
276
+ if (!display || typeof display !== 'string') {
277
+ throw Error(`display ${display} is not valid`);
278
+ }
279
+ this.name = name;
280
+ this.type = type;
281
+ this.display = display;
282
+ }
283
+ static from(obj) {
284
+ return new Field(obj.name, obj.type, obj.display);
285
+ }
286
+ }
287
+ exports.Field = Field;
288
+ class AbstractCondition {
289
+ constructor(coordinator) {
290
+ if (coordinator && !Object.values(coordinators).includes(coordinator)) {
291
+ throw Error(`coordinator ${coordinator} is not a valid coordinator`);
292
+ }
293
+ this.coordinator = coordinator;
294
+ }
295
+ coordinatorString() {
296
+ return this.coordinator ? `${this.coordinator} ` : '';
297
+ }
298
+ getCoordinator() {
299
+ return this.coordinator;
300
+ }
301
+ setCoordinator(coordinator) {
302
+ this.coordinator = coordinator;
303
+ }
304
+ isGroup() {
305
+ return false;
306
+ }
307
+ getGroupedConditions() {
308
+ return [this];
309
+ }
310
+ _asFirstCondition() {
311
+ delete this.coordinator;
312
+ }
313
+ asFirstCondition() {
314
+ throw Error('Implement on the subclass (Why do we have to have this method here at all?!)');
315
+ }
316
+ clone() {
317
+ throw Error('Implement on the subclass (Why do we have to have this method here at all?!)');
318
+ }
319
+ conditionString() {
320
+ throw Error('Implement on the subclass (Why do we have to have this method here at all?!)');
321
+ }
322
+ conditionExpression() {
323
+ throw Error('Implement on the subclass (Why do we have to have this method here at all?!)');
324
+ }
325
+ }
326
+ class Condition extends AbstractCondition {
327
+ constructor(field, operator, value, coordinator) {
328
+ super(coordinator);
329
+ if (!(field instanceof Field)) {
330
+ throw Error(`field ${field} is not a valid Field object`);
331
+ }
332
+ if (typeof operator !== 'string') {
333
+ throw Error(`operator ${operator} is not a valid operator`);
334
+ }
335
+ if (!(value instanceof _inlineConditionValues.AbstractConditionValue)) {
336
+ throw Error(`value ${value} is not a valid value type`);
337
+ }
338
+ this.field = field;
339
+ this.operator = operator;
340
+ this.value = value;
341
+ }
342
+ asFirstCondition() {
343
+ this._asFirstCondition();
344
+ return this;
345
+ }
346
+ conditionString() {
347
+ return `'${this.field.display}' ${this.operator} '${this.value.toPresentationString()}'`;
348
+ }
349
+ conditionExpression() {
350
+ return (0, _inlineConditionOperators.getExpression)(this.field.type, this.field.name, this.operator, this.value);
351
+ }
352
+ clone() {
353
+ return new Condition(Field.from(this.field), this.operator, this.value.clone(), this.coordinator);
354
+ }
355
+ }
356
+ exports.Condition = Condition;
357
+ class ConditionRef extends AbstractCondition {
358
+ constructor(conditionName, conditionDisplayName, coordinator) {
359
+ super(coordinator);
360
+ if (typeof conditionName !== 'string') {
361
+ throw Error(`condition name ${conditionName} is not valid`);
362
+ }
363
+ if (typeof conditionDisplayName !== 'string') {
364
+ throw Error(`condition display name ${conditionDisplayName} is not valid`);
365
+ }
366
+ this.conditionName = conditionName;
367
+ this.conditionDisplayName = conditionDisplayName;
368
+ }
369
+ asFirstCondition() {
370
+ this._asFirstCondition();
371
+ return this;
372
+ }
373
+ conditionString() {
374
+ return `'${this.conditionDisplayName}'`;
375
+ }
376
+ conditionExpression() {
377
+ return this.conditionName;
378
+ }
379
+ clone() {
380
+ return new ConditionRef(this.conditionName, this.conditionDisplayName, this.coordinator);
381
+ }
382
+ }
383
+ exports.ConditionRef = ConditionRef;
384
+ //# sourceMappingURL=inline-condition-model.js.map