@defra/forms-model 3.0.10 → 3.0.11

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 (237) hide show
  1. package/dist/browser/components/component-types.js +201 -219
  2. package/dist/browser/components/component-types.js.map +1 -1
  3. package/dist/browser/components/conditional-component-types.js +9 -27
  4. package/dist/browser/components/conditional-component-types.js.map +1 -1
  5. package/dist/browser/components/enums.js +27 -45
  6. package/dist/browser/components/enums.js.map +1 -1
  7. package/dist/browser/components/index.js +3 -35
  8. package/dist/browser/components/index.js.map +1 -1
  9. package/dist/browser/components/types.js +1 -15
  10. package/dist/browser/conditions/condition-abstract.js +42 -60
  11. package/dist/browser/conditions/condition-abstract.js.map +1 -1
  12. package/dist/browser/conditions/condition-field.js +23 -41
  13. package/dist/browser/conditions/condition-field.js.map +1 -1
  14. package/dist/browser/conditions/condition-group-def.js +23 -42
  15. package/dist/browser/conditions/condition-group-def.js.map +1 -1
  16. package/dist/browser/conditions/condition-group.js +43 -61
  17. package/dist/browser/conditions/condition-group.js.map +1 -1
  18. package/dist/browser/conditions/condition-model.js +185 -196
  19. package/dist/browser/conditions/condition-model.js.map +1 -1
  20. package/dist/browser/conditions/condition-operators.js +103 -124
  21. package/dist/browser/conditions/condition-operators.js.map +1 -1
  22. package/dist/browser/conditions/condition-ref.js +29 -47
  23. package/dist/browser/conditions/condition-ref.js.map +1 -1
  24. package/dist/browser/conditions/condition-value-abstract.js +19 -37
  25. package/dist/browser/conditions/condition-value-abstract.js.map +1 -1
  26. package/dist/browser/conditions/condition-value-registration.js +15 -34
  27. package/dist/browser/conditions/condition-value-registration.js.map +1 -1
  28. package/dist/browser/conditions/condition-values.js +98 -118
  29. package/dist/browser/conditions/condition-values.js.map +1 -1
  30. package/dist/browser/conditions/condition.js +36 -51
  31. package/dist/browser/conditions/condition.js.map +1 -1
  32. package/dist/browser/conditions/enums.js +5 -23
  33. package/dist/browser/conditions/enums.js.map +1 -1
  34. package/dist/browser/conditions/helpers.js +6 -25
  35. package/dist/browser/conditions/helpers.js.map +1 -1
  36. package/dist/browser/conditions/index.js +10 -143
  37. package/dist/browser/conditions/index.js.map +1 -1
  38. package/dist/browser/conditions/inline-condition-model.js +372 -394
  39. package/dist/browser/conditions/inline-condition-model.js.map +1 -1
  40. package/dist/browser/conditions/inline-condition-operators.js +103 -124
  41. package/dist/browser/conditions/inline-condition-operators.js.map +1 -1
  42. package/dist/browser/conditions/inline-condition-values.js +123 -145
  43. package/dist/browser/conditions/inline-condition-values.js.map +1 -1
  44. package/dist/browser/conditions/types.js +1 -15
  45. package/dist/browser/conditions/types.js.map +1 -1
  46. package/dist/browser/data-model/conditions-wrapper.js +27 -45
  47. package/dist/browser/data-model/conditions-wrapper.js.map +1 -1
  48. package/dist/browser/data-model/enums.js +6 -24
  49. package/dist/browser/data-model/enums.js.map +1 -1
  50. package/dist/browser/data-model/index.js +3 -35
  51. package/dist/browser/data-model/index.js.map +1 -1
  52. package/dist/browser/data-model/input-wrapper.js +28 -46
  53. package/dist/browser/data-model/input-wrapper.js.map +1 -1
  54. package/dist/browser/data-model/types.js +7 -25
  55. package/dist/browser/data-model/types.js.map +1 -1
  56. package/dist/browser/form/form-configuration.js +16 -35
  57. package/dist/browser/form/form-configuration.js.map +1 -1
  58. package/dist/browser/form/index.js +1 -23
  59. package/dist/browser/form/index.js.map +1 -1
  60. package/dist/browser/index.js +8 -97
  61. package/dist/browser/index.js.map +1 -1
  62. package/dist/browser/migration/index.js +1 -23
  63. package/dist/browser/migration/index.js.map +1 -1
  64. package/dist/browser/migration/migration.0-2.js +42 -60
  65. package/dist/browser/migration/migration.0-2.js.map +1 -1
  66. package/dist/browser/migration/migration.1-2.js +83 -99
  67. package/dist/browser/migration/migration.1-2.js.map +1 -1
  68. package/dist/browser/migration/types.js +1 -15
  69. package/dist/browser/migration/whichMigrations.js +20 -36
  70. package/dist/browser/migration/whichMigrations.js.map +1 -1
  71. package/dist/browser/schema/index.js +1 -29
  72. package/dist/browser/schema/index.js.map +1 -1
  73. package/dist/browser/schema/schema.js +231 -249
  74. package/dist/browser/schema/schema.js.map +1 -1
  75. package/dist/browser/utils/helpers.js +22 -43
  76. package/dist/browser/utils/helpers.js.map +1 -1
  77. package/dist/browser/utils/logger.js +24 -43
  78. package/dist/browser/utils/logger.js.map +1 -1
  79. package/dist/module/components/component-types.js +1 -5
  80. package/dist/module/components/component-types.js.map +1 -1
  81. package/dist/module/components/conditional-component-types.js +1 -5
  82. package/dist/module/components/conditional-component-types.js.map +1 -1
  83. package/dist/module/components/enums.js +1 -5
  84. package/dist/module/components/enums.js.map +1 -1
  85. package/dist/module/components/index.js +3 -24
  86. package/dist/module/components/index.js.map +1 -1
  87. package/dist/module/components/types.js +1 -1
  88. package/dist/module/conditions/condition-abstract.js +3 -8
  89. package/dist/module/conditions/condition-abstract.js.map +1 -1
  90. package/dist/module/conditions/condition-field.js +3 -8
  91. package/dist/module/conditions/condition-field.js.map +1 -1
  92. package/dist/module/conditions/condition-group-def.js +1 -6
  93. package/dist/module/conditions/condition-group-def.js.map +1 -1
  94. package/dist/module/conditions/condition-group.js +4 -9
  95. package/dist/module/conditions/condition-group.js.map +1 -1
  96. package/dist/module/conditions/condition-model.js +20 -25
  97. package/dist/module/conditions/condition-model.js.map +1 -1
  98. package/dist/module/conditions/condition-operators.js +15 -23
  99. package/dist/module/conditions/condition-operators.js.map +1 -1
  100. package/dist/module/conditions/condition-ref.js +2 -7
  101. package/dist/module/conditions/condition-ref.js.map +1 -1
  102. package/dist/module/conditions/condition-value-abstract.js +3 -8
  103. package/dist/module/conditions/condition-value-abstract.js.map +1 -1
  104. package/dist/module/conditions/condition-value-registration.js +1 -6
  105. package/dist/module/conditions/condition-value-registration.js.map +1 -1
  106. package/dist/module/conditions/condition-values.js +12 -20
  107. package/dist/module/conditions/condition-values.js.map +1 -1
  108. package/dist/module/conditions/condition.js +9 -14
  109. package/dist/module/conditions/condition.js.map +1 -1
  110. package/dist/module/conditions/enums.js +1 -5
  111. package/dist/module/conditions/enums.js.map +1 -1
  112. package/dist/module/conditions/helpers.js +2 -7
  113. package/dist/module/conditions/helpers.js.map +1 -1
  114. package/dist/module/conditions/index.js +10 -139
  115. package/dist/module/conditions/index.js.map +1 -1
  116. package/dist/module/conditions/inline-condition-model.js +15 -26
  117. package/dist/module/conditions/inline-condition-model.js.map +1 -1
  118. package/dist/module/conditions/inline-condition-operators.js +15 -23
  119. package/dist/module/conditions/inline-condition-operators.js.map +1 -1
  120. package/dist/module/conditions/inline-condition-values.js +9 -17
  121. package/dist/module/conditions/inline-condition-values.js.map +1 -1
  122. package/dist/module/conditions/types.js +1 -1
  123. package/dist/module/conditions/types.js.map +1 -1
  124. package/dist/module/data-model/conditions-wrapper.js +3 -8
  125. package/dist/module/data-model/conditions-wrapper.js.map +1 -1
  126. package/dist/module/data-model/enums.js +1 -5
  127. package/dist/module/data-model/enums.js.map +1 -1
  128. package/dist/module/data-model/index.js +3 -24
  129. package/dist/module/data-model/index.js.map +1 -1
  130. package/dist/module/data-model/input-wrapper.js +3 -8
  131. package/dist/module/data-model/input-wrapper.js.map +1 -1
  132. package/dist/module/data-model/types.js +1 -5
  133. package/dist/module/data-model/types.js.map +1 -1
  134. package/dist/module/form/form-configuration.js +1 -6
  135. package/dist/module/form/form-configuration.js.map +1 -1
  136. package/dist/module/form/index.js +1 -10
  137. package/dist/module/form/index.js.map +1 -1
  138. package/dist/module/index.js +8 -91
  139. package/dist/module/index.js.map +1 -1
  140. package/dist/module/migration/index.js +1 -10
  141. package/dist/module/migration/index.js.map +1 -1
  142. package/dist/module/migration/migration.0-2.js +1 -5
  143. package/dist/module/migration/migration.0-2.js.map +1 -1
  144. package/dist/module/migration/migration.1-2.js +3 -6
  145. package/dist/module/migration/migration.1-2.js.map +1 -1
  146. package/dist/module/migration/types.js +1 -1
  147. package/dist/module/migration/whichMigrations.js +5 -9
  148. package/dist/module/migration/whichMigrations.js.map +1 -1
  149. package/dist/module/schema/index.js +1 -16
  150. package/dist/module/schema/index.js.map +1 -1
  151. package/dist/module/schema/schema.js +163 -167
  152. package/dist/module/schema/schema.js.map +1 -1
  153. package/dist/module/utils/helpers.js +5 -13
  154. package/dist/module/utils/helpers.js.map +1 -1
  155. package/dist/module/utils/logger.js +1 -6
  156. package/dist/module/utils/logger.js.map +1 -1
  157. package/dist/types/components/component-types.d.ts +1 -1
  158. package/dist/types/components/component-types.d.ts.map +1 -1
  159. package/dist/types/components/conditional-component-types.d.ts +1 -1
  160. package/dist/types/components/conditional-component-types.d.ts.map +1 -1
  161. package/dist/types/components/index.d.ts +3 -3
  162. package/dist/types/components/index.d.ts.map +1 -1
  163. package/dist/types/conditions/condition-abstract.d.ts +1 -1
  164. package/dist/types/conditions/condition-abstract.d.ts.map +1 -1
  165. package/dist/types/conditions/condition-field.d.ts +1 -1
  166. package/dist/types/conditions/condition-field.d.ts.map +1 -1
  167. package/dist/types/conditions/condition-group-def.d.ts +2 -2
  168. package/dist/types/conditions/condition-group-def.d.ts.map +1 -1
  169. package/dist/types/conditions/condition-group.d.ts +2 -2
  170. package/dist/types/conditions/condition-group.d.ts.map +1 -1
  171. package/dist/types/conditions/condition-model.d.ts +5 -5
  172. package/dist/types/conditions/condition-model.d.ts.map +1 -1
  173. package/dist/types/conditions/condition-operators.d.ts +2 -2
  174. package/dist/types/conditions/condition-operators.d.ts.map +1 -1
  175. package/dist/types/conditions/condition-ref.d.ts +2 -2
  176. package/dist/types/conditions/condition-ref.d.ts.map +1 -1
  177. package/dist/types/conditions/condition-value-abstract.d.ts +1 -1
  178. package/dist/types/conditions/condition-value-abstract.d.ts.map +1 -1
  179. package/dist/types/conditions/condition-values.d.ts +3 -3
  180. package/dist/types/conditions/condition-values.d.ts.map +1 -1
  181. package/dist/types/conditions/condition.d.ts +4 -4
  182. package/dist/types/conditions/condition.d.ts.map +1 -1
  183. package/dist/types/conditions/index.d.ts +10 -10
  184. package/dist/types/conditions/index.d.ts.map +1 -1
  185. package/dist/types/conditions/types.d.ts +3 -3
  186. package/dist/types/conditions/types.d.ts.map +1 -1
  187. package/dist/types/data-model/conditions-wrapper.d.ts +1 -1
  188. package/dist/types/data-model/conditions-wrapper.d.ts.map +1 -1
  189. package/dist/types/data-model/index.d.ts +3 -3
  190. package/dist/types/data-model/index.d.ts.map +1 -1
  191. package/dist/types/data-model/input-wrapper.d.ts +2 -2
  192. package/dist/types/data-model/input-wrapper.d.ts.map +1 -1
  193. package/dist/types/data-model/types.d.ts +3 -3
  194. package/dist/types/data-model/types.d.ts.map +1 -1
  195. package/dist/types/form/index.d.ts +1 -1
  196. package/dist/types/form/index.d.ts.map +1 -1
  197. package/dist/types/index.d.ts +11 -11
  198. package/dist/types/index.d.ts.map +1 -1
  199. package/dist/types/migration/index.d.ts +1 -1
  200. package/dist/types/migration/index.d.ts.map +1 -1
  201. package/dist/types/migration/migration.0-2.d.ts +1 -1
  202. package/dist/types/migration/migration.0-2.d.ts.map +1 -1
  203. package/dist/types/migration/migration.1-2.d.ts +1 -1
  204. package/dist/types/migration/migration.1-2.d.ts.map +1 -1
  205. package/dist/types/migration/whichMigrations.d.ts +1 -1
  206. package/dist/types/migration/whichMigrations.d.ts.map +1 -1
  207. package/dist/types/schema/index.d.ts +1 -1
  208. package/dist/types/schema/index.d.ts.map +1 -1
  209. package/package.json +2 -1
  210. package/src/components/component-types.ts +1 -1
  211. package/src/components/conditional-component-types.ts +1 -1
  212. package/src/components/index.ts +3 -3
  213. package/src/conditions/condition-abstract.ts +1 -1
  214. package/src/conditions/condition-field.ts +2 -2
  215. package/src/conditions/condition-group-def.ts +1 -1
  216. package/src/conditions/condition-group.ts +3 -3
  217. package/src/conditions/condition-model.ts +9 -9
  218. package/src/conditions/condition-operators.ts +6 -3
  219. package/src/conditions/condition-ref.ts +2 -2
  220. package/src/conditions/condition-value-abstract.ts +1 -1
  221. package/src/conditions/condition-values.ts +3 -3
  222. package/src/conditions/condition.ts +6 -6
  223. package/src/conditions/index.ts +10 -10
  224. package/src/conditions/inline-condition-model.ts +3 -3
  225. package/src/conditions/inline-condition-operators.ts +1 -1
  226. package/src/conditions/types.ts +3 -3
  227. package/src/data-model/conditions-wrapper.ts +2 -2
  228. package/src/data-model/index.ts +3 -3
  229. package/src/data-model/input-wrapper.ts +3 -3
  230. package/src/data-model/types.ts +3 -3
  231. package/src/form/index.ts +1 -1
  232. package/src/index.ts +11 -11
  233. package/src/migration/index.ts +1 -1
  234. package/src/migration/migration.0-2.ts +1 -1
  235. package/src/migration/migration.1-2.ts +2 -2
  236. package/src/migration/whichMigrations.ts +3 -3
  237. package/src/schema/index.ts +1 -1
@@ -1,8 +1,3 @@
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
1
  const conditionValueFactories = {};
7
2
  class Registration {
8
3
  constructor(type, factory) {
@@ -10,7 +5,7 @@ class Registration {
10
5
  this.type = type;
11
6
  }
12
7
  }
13
- class AbstractConditionValue {
8
+ export class AbstractConditionValue {
14
9
  constructor(registration) {
15
10
  if (new.target === AbstractConditionValue) {
16
11
  throw new TypeError('Cannot construct ConditionValue instances directly');
@@ -23,9 +18,8 @@ class AbstractConditionValue {
23
18
  toPresentationString() {}
24
19
  toExpression() {}
25
20
  }
26
- exports.AbstractConditionValue = AbstractConditionValue;
27
21
  const valueType = registerValueType('Value', obj => ConditionValue.from(obj));
28
- class ConditionValue extends AbstractConditionValue {
22
+ export class ConditionValue extends AbstractConditionValue {
29
23
  constructor(value, display) {
30
24
  super(valueType);
31
25
  if (!value || typeof value !== 'string') {
@@ -50,12 +44,11 @@ class ConditionValue extends AbstractConditionValue {
50
44
  return ConditionValue.from(this);
51
45
  }
52
46
  }
53
- exports.ConditionValue = ConditionValue;
54
- const dateDirections = exports.dateDirections = {
47
+ export const dateDirections = {
55
48
  FUTURE: 'in the future',
56
49
  PAST: 'in the past'
57
50
  };
58
- const dateUnits = exports.dateUnits = {
51
+ export const dateUnits = {
59
52
  YEARS: {
60
53
  display: 'year(s)',
61
54
  value: 'years'
@@ -69,7 +62,7 @@ const dateUnits = exports.dateUnits = {
69
62
  value: 'days'
70
63
  }
71
64
  };
72
- const timeUnits = exports.timeUnits = {
65
+ export const timeUnits = {
73
66
  HOURS: {
74
67
  display: 'hour(s)',
75
68
  value: 'hours'
@@ -83,9 +76,9 @@ const timeUnits = exports.timeUnits = {
83
76
  value: 'seconds'
84
77
  }
85
78
  };
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 {
79
+ export const dateTimeUnits = Object.assign({}, dateUnits, timeUnits);
80
+ export const relativeTimeValueType = registerValueType('RelativeTime', obj => RelativeTimeValue.from(obj));
81
+ export class RelativeTimeValue extends AbstractConditionValue {
89
82
  constructor(timePeriod, timeUnit, direction, timeOnly = false) {
90
83
  super(relativeTimeValueType);
91
84
  if (typeof timePeriod !== 'string') {
@@ -124,11 +117,10 @@ class RelativeTimeValue extends AbstractConditionValue {
124
117
  * Otherwise we can't guarantee they've been registered for deserialization before
125
118
  * valueFrom is called
126
119
  */
127
- exports.RelativeTimeValue = RelativeTimeValue;
128
120
  function registerValueType(type, factory) {
129
121
  return new Registration(type, factory);
130
122
  }
131
- function valueFrom(obj) {
123
+ export function valueFrom(obj) {
132
124
  return conditionValueFactories[obj.type](obj);
133
125
  }
134
126
  //# sourceMappingURL=inline-condition-values.js.map
@@ -1 +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;MACz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AAC,IAAI,CAAC;EACrC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AANAL,OAAA,CAAAyB,iBAAA,GAAAA,iBAAA;AAOA,SAASvB,iBAAiBA,CAACX,IAAI,EAAEC,OAAO,EAAE;EACxC,OAAO,IAAIH,YAAY,CAACE,IAAI,EAAEC,OAAO,CAAC;AACxC;AAEO,SAAS2C,SAASA,CAAChC,GAAG,EAAE;EAC7B,OAAOf,uBAAuB,CAACe,GAAG,CAACZ,IAAI,CAAC,CAACY,GAAG,CAAC;AAC/C"}
1
+ {"version":3,"file":"inline-condition-values.js","names":["conditionValueFactories","Registration","constructor","type","factory","AbstractConditionValue","registration","new","target","TypeError","toPresentationString","toExpression","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;AAEA,OAAO,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;AAEA,MAAMC,SAAS,GAAGC,iBAAiB,CAAC,OAAO,EAAGC,GAAG,IAAKC,cAAc,CAACC,IAAI,CAACF,GAAG,CAAC,CAAC;AAC/E,OAAO,MAAMC,cAAc,SAASV,sBAAsB,CAAC;EAIzDH,WAAWA,CAACe,KAAK,EAAEC,OAAO,EAAE;IAC1B,KAAK,CAACN,SAAS,CAAC;IAChB,IAAI,CAACK,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MACvC,MAAME,KAAK,CAAE,SAAQF,KAAM,eAAc,CAAC;IAC5C;IACA,IAAIC,OAAO,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MAC1C,MAAMC,KAAK,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BH,UAAW,MAAK,IAAI,CAACC,QAAS,IAAG,GACrD,qBAAoBD,UAAW,MAAK,IAAI,CAACC,QAAS,IAAG;EAC5D;EAEA,OAAOtB,IAAIA,CAACF,GAAG,EAAE;IACf,OAAO,IAAIsB,iBAAiB,CAC1BtB,GAAG,CAACuB,UAAU,EACdvB,GAAG,CAACwB,QAAQ,EACZxB,GAAG,CAACyB,SAAS,EACbzB,GAAG,CAAC0B,QACN,CAAC;EACH;EAEApB,KAAKA,CAAA,EAAG;IACN,OAAOgB,iBAAiB,CAACpB,IAAI,CAAC,IAAI,CAAC;EACrC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASH,iBAAiBA,CAACV,IAAI,EAAEC,OAAO,EAAE;EACxC,OAAO,IAAIH,YAAY,CAACE,IAAI,EAAEC,OAAO,CAAC;AACxC;AAEA,OAAO,SAAS0C,SAASA,CAAChC,GAAG,EAAE;EAC7B,OAAOd,uBAAuB,CAACc,GAAG,CAACX,IAAI,CAAC,CAACW,GAAG,CAAC;AAC/C"}
@@ -1,2 +1,2 @@
1
- "use strict";
1
+ export {};
2
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/conditions/types.ts"],"sourcesContent":["import { type Condition } from '~/src/conditions/condition'\nimport { type ConditionRef } from '~/src/conditions/condition-ref'\nimport { type ConditionGroup } from '~/src/conditions/condition-group'\n\nexport type ConditionsArray = (Condition | ConditionGroup | ConditionRef)[]\n\nexport type DateTimeUnitValues =\n | 'years'\n | 'months'\n | 'days'\n | 'hours'\n | 'minutes'\n | 'seconds'\n\nexport type DateUnits = {\n YEARS: { display: 'year(s)'; value: 'years' }\n MONTHS: { display: 'month(s)'; value: 'months' }\n DAYS: { display: 'day(s)'; value: 'days' }\n}\n\nexport type TimeUnits = {\n HOURS: { display: 'hour(s)'; value: 'hours' }\n MINUTES: { display: 'minute(s)'; value: 'minutes' }\n SECONDS: { display: 'second(s)'; value: 'seconds' }\n}\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/conditions/types.ts"],"sourcesContent":["import { type Condition } from '~/src/conditions/condition.js'\nimport { type ConditionRef } from '~/src/conditions/condition-ref.js'\nimport { type ConditionGroup } from '~/src/conditions/condition-group.js'\n\nexport type ConditionsArray = (Condition | ConditionGroup | ConditionRef)[]\n\nexport type DateTimeUnitValues =\n | 'years'\n | 'months'\n | 'days'\n | 'hours'\n | 'minutes'\n | 'seconds'\n\nexport type DateUnits = {\n YEARS: { display: 'year(s)'; value: 'years' }\n MONTHS: { display: 'month(s)'; value: 'months' }\n DAYS: { display: 'day(s)'; value: 'days' }\n}\n\nexport type TimeUnits = {\n HOURS: { display: 'hour(s)'; value: 'hours' }\n MINUTES: { display: 'minute(s)'; value: 'minutes' }\n SECONDS: { display: 'second(s)'; value: 'seconds' }\n}\n"],"mappings":""}
@@ -1,9 +1,5 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.ConditionsWrapper = void 0;
5
- var _conditionModel = require("../conditions/condition-model");
6
- class ConditionsWrapper {
1
+ import { ConditionsModel } from "../conditions/condition-model.js";
2
+ export class ConditionsWrapper {
7
3
  constructor(rawData) {
8
4
  const {
9
5
  name,
@@ -20,11 +16,10 @@ class ConditionsWrapper {
20
16
  // keep this so application can support legacy forms exports.
21
17
  return this.value;
22
18
  }
23
- return _conditionModel.ConditionsModel.from(this.value).toExpression();
19
+ return ConditionsModel.from(this.value).toExpression();
24
20
  }
25
21
  clone() {
26
22
  return new ConditionsWrapper(this);
27
23
  }
28
24
  }
29
- exports.ConditionsWrapper = ConditionsWrapper;
30
25
  //# sourceMappingURL=conditions-wrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conditions-wrapper.js","names":["_conditionModel","require","ConditionsWrapper","constructor","rawData","name","displayName","value","expression","ConditionsModel","from","toExpression","clone","exports"],"sources":["../../../src/data-model/conditions-wrapper.ts"],"sourcesContent":["import { ConditionsModel } from '~/src/conditions/condition-model'\nimport {\n type ConditionRawData,\n type ConditionWrapperValue\n} from '~/src/data-model/types'\n\nexport class ConditionsWrapper {\n name: string\n displayName: string\n value: ConditionWrapperValue\n\n constructor(rawData: ConditionRawData) {\n const { name, displayName, value } = rawData\n this.displayName = displayName || name\n this.value = value\n this.name = name\n }\n\n get expression() {\n if (typeof this.value === 'string') {\n // Previously conditions were defined as strings, e.g: \"section.age < 18\"\n // keep this so application can support legacy forms exports.\n return this.value\n }\n\n return ConditionsModel.from(this.value).toExpression()\n }\n\n clone(): ConditionsWrapper {\n return new ConditionsWrapper(this)\n }\n}\n"],"mappings":";;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAMO,MAAMC,iBAAiB,CAAC;EAK7BC,WAAWA,CAACC,OAAyB,EAAE;IACrC,MAAM;MAAEC,IAAI;MAAEC,WAAW;MAAEC;IAAM,CAAC,GAAGH,OAAO;IAC5C,IAAI,CAACE,WAAW,GAAGA,WAAW,IAAID,IAAI;IACtC,IAAI,CAACE,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACF,IAAI,GAAGA,IAAI;EAClB;EAEA,IAAIG,UAAUA,CAAA,EAAG;IACf,IAAI,OAAO,IAAI,CAACD,KAAK,KAAK,QAAQ,EAAE;MAClC;MACA;MACA,OAAO,IAAI,CAACA,KAAK;IACnB;IAEA,OAAOE,+BAAe,CAACC,IAAI,CAAC,IAAI,CAACH,KAAK,CAAC,CAACI,YAAY,CAAC,CAAC;EACxD;EAEAC,KAAKA,CAAA,EAAsB;IACzB,OAAO,IAAIV,iBAAiB,CAAC,IAAI,CAAC;EACpC;AACF;AAACW,OAAA,CAAAX,iBAAA,GAAAA,iBAAA"}
1
+ {"version":3,"file":"conditions-wrapper.js","names":["ConditionsModel","ConditionsWrapper","constructor","rawData","name","displayName","value","expression","from","toExpression","clone"],"sources":["../../../src/data-model/conditions-wrapper.ts"],"sourcesContent":["import { ConditionsModel } from '~/src/conditions/condition-model.js'\nimport {\n type ConditionRawData,\n type ConditionWrapperValue\n} from '~/src/data-model/types.js'\n\nexport class ConditionsWrapper {\n name: string\n displayName: string\n value: ConditionWrapperValue\n\n constructor(rawData: ConditionRawData) {\n const { name, displayName, value } = rawData\n this.displayName = displayName || name\n this.value = value\n this.name = name\n }\n\n get expression() {\n if (typeof this.value === 'string') {\n // Previously conditions were defined as strings, e.g: \"section.age < 18\"\n // keep this so application can support legacy forms exports.\n return this.value\n }\n\n return ConditionsModel.from(this.value).toExpression()\n }\n\n clone(): ConditionsWrapper {\n return new ConditionsWrapper(this)\n }\n}\n"],"mappings":"AAAA,SAASA,eAAe;AAMxB,OAAO,MAAMC,iBAAiB,CAAC;EAK7BC,WAAWA,CAACC,OAAyB,EAAE;IACrC,MAAM;MAAEC,IAAI;MAAEC,WAAW;MAAEC;IAAM,CAAC,GAAGH,OAAO;IAC5C,IAAI,CAACE,WAAW,GAAGA,WAAW,IAAID,IAAI;IACtC,IAAI,CAACE,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACF,IAAI,GAAGA,IAAI;EAClB;EAEA,IAAIG,UAAUA,CAAA,EAAG;IACf,IAAI,OAAO,IAAI,CAACD,KAAK,KAAK,QAAQ,EAAE;MAClC;MACA;MACA,OAAO,IAAI,CAACA,KAAK;IACnB;IAEA,OAAON,eAAe,CAACQ,IAAI,CAAC,IAAI,CAACF,KAAK,CAAC,CAACG,YAAY,CAAC,CAAC;EACxD;EAEAC,KAAKA,CAAA,EAAsB;IACzB,OAAO,IAAIT,iBAAiB,CAAC,IAAI,CAAC;EACpC;AACF"}
@@ -1,8 +1,4 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.OutputType = void 0;
5
- let OutputType = exports.OutputType = /*#__PURE__*/function (OutputType) {
1
+ export let OutputType = /*#__PURE__*/function (OutputType) {
6
2
  OutputType["Email"] = "email";
7
3
  OutputType["Notify"] = "notify";
8
4
  OutputType["Webhook"] = "webhook";
@@ -1 +1 @@
1
- {"version":3,"file":"enums.js","names":["OutputType","exports"],"sources":["../../../src/data-model/enums.ts"],"sourcesContent":["export enum OutputType {\n Email = 'email',\n Notify = 'notify',\n Webhook = 'webhook'\n}\n"],"mappings":";;;;IAAYA,UAAU,GAAAC,OAAA,CAAAD,UAAA,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA"}
1
+ {"version":3,"file":"enums.js","names":["OutputType"],"sources":["../../../src/data-model/enums.ts"],"sourcesContent":["export enum OutputType {\n Email = 'email',\n Notify = 'notify',\n Webhook = 'webhook'\n}\n"],"mappings":"AAAA,WAAYA,UAAU,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA"}
@@ -1,25 +1,4 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- Object.defineProperty(exports, "ConditionsWrapper", {
5
- enumerable: true,
6
- get: function () {
7
- return _conditionsWrapper.ConditionsWrapper;
8
- }
9
- });
10
- Object.defineProperty(exports, "InputWrapper", {
11
- enumerable: true,
12
- get: function () {
13
- return _inputWrapper.InputWrapper;
14
- }
15
- });
16
- Object.defineProperty(exports, "OutputType", {
17
- enumerable: true,
18
- get: function () {
19
- return _enums.OutputType;
20
- }
21
- });
22
- var _inputWrapper = require("./input-wrapper");
23
- var _conditionsWrapper = require("./conditions-wrapper");
24
- var _enums = require("./enums");
1
+ export { InputWrapper } from "./input-wrapper.js";
2
+ export { ConditionsWrapper } from "./conditions-wrapper.js";
3
+ export { OutputType } from "./enums.js";
25
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_inputWrapper","require","_conditionsWrapper","_enums"],"sources":["../../../src/data-model/index.ts"],"sourcesContent":["export { InputWrapper } from '~/src/data-model/input-wrapper'\nexport { ConditionsWrapper } from '~/src/data-model/conditions-wrapper'\nexport { OutputType } from '~/src/data-model/enums'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA"}
1
+ {"version":3,"file":"index.js","names":["InputWrapper","ConditionsWrapper","OutputType"],"sources":["../../../src/data-model/index.ts"],"sourcesContent":["export { InputWrapper } from '~/src/data-model/input-wrapper.js'\nexport { ConditionsWrapper } from '~/src/data-model/conditions-wrapper.js'\nexport { OutputType } from '~/src/data-model/enums.js'\n"],"mappings":"AAAA,SAASA,YAAY;AACrB,SAASC,iBAAiB;AAC1B,SAASC,UAAU"}
@@ -1,16 +1,12 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.InputWrapper = void 0;
5
- var _helpers = require("../utils/helpers");
6
- class InputWrapper {
1
+ import { clone } from "../utils/helpers.js";
2
+ export class InputWrapper {
7
3
  name = undefined;
8
4
  title = undefined;
9
5
  type = undefined;
10
6
  #parentItemName;
11
7
  constructor(rawData, page, options) {
12
8
  Object.assign(this, rawData);
13
- const myPage = (0, _helpers.clone)(page);
9
+ const myPage = clone(page);
14
10
  delete myPage.components;
15
11
  this.page = myPage;
16
12
  this.propertyPath = !options.ignoreSection && page.section ? `${page.section}.${this.name}` : this.name;
@@ -21,5 +17,4 @@ class InputWrapper {
21
17
  return this.page.section ? `${titleWithContext} in ${this.page.section}` : titleWithContext;
22
18
  }
23
19
  }
24
- exports.InputWrapper = InputWrapper;
25
20
  //# sourceMappingURL=input-wrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-wrapper.js","names":["_helpers","require","InputWrapper","name","undefined","title","type","parentItemName","constructor","rawData","page","options","Object","assign","myPage","clone","components","propertyPath","ignoreSection","section","displayName","titleWithContext","exports"],"sources":["../../../src/data-model/input-wrapper.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types'\nimport { type Page } from '~/src/data-model/types'\nimport { clone } from '~/src/utils/helpers'\n\nexport class InputWrapper {\n name: string | undefined = undefined\n title: string | undefined = undefined\n type: string | undefined = undefined\n propertyPath: string | undefined\n #parentItemName: string | undefined\n page: Page\n\n constructor(\n rawData: ComponentDef,\n page: Page,\n options: { ignoreSection?: boolean; parentItemName?: string }\n ) {\n Object.assign(this, rawData)\n const myPage = clone(page)\n\n delete myPage.components\n\n this.page = myPage\n this.propertyPath =\n !options.ignoreSection && page.section\n ? `${page.section}.${this.name}`\n : this.name\n this.#parentItemName = options.parentItemName\n }\n\n get displayName(): string | undefined {\n const titleWithContext = this.#parentItemName\n ? `${this.title} under ${this.#parentItemName}`\n : this.title\n\n return this.page.section\n ? `${titleWithContext} in ${this.page.section}`\n : titleWithContext\n }\n}\n"],"mappings":";;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAEO,MAAMC,YAAY,CAAC;EACxBC,IAAI,GAAuBC,SAAS;EACpCC,KAAK,GAAuBD,SAAS;EACrCE,IAAI,GAAuBF,SAAS;EAEpC,CAACG,cAAc;EAGfC,WAAWA,CACTC,OAAqB,EACrBC,IAAU,EACVC,OAA6D,EAC7D;IACAC,MAAM,CAACC,MAAM,CAAC,IAAI,EAAEJ,OAAO,CAAC;IAC5B,MAAMK,MAAM,GAAG,IAAAC,cAAK,EAACL,IAAI,CAAC;IAE1B,OAAOI,MAAM,CAACE,UAAU;IAExB,IAAI,CAACN,IAAI,GAAGI,MAAM;IAClB,IAAI,CAACG,YAAY,GACf,CAACN,OAAO,CAACO,aAAa,IAAIR,IAAI,CAACS,OAAO,GACjC,GAAET,IAAI,CAACS,OAAQ,IAAG,IAAI,CAAChB,IAAK,EAAC,GAC9B,IAAI,CAACA,IAAI;IACf,IAAI,CAAC,CAACI,cAAc,GAAGI,OAAO,CAACJ,cAAc;EAC/C;EAEA,IAAIa,WAAWA,CAAA,EAAuB;IACpC,MAAMC,gBAAgB,GAAG,IAAI,CAAC,CAACd,cAAc,GACxC,GAAE,IAAI,CAACF,KAAM,UAAS,IAAI,CAAC,CAACE,cAAe,EAAC,GAC7C,IAAI,CAACF,KAAK;IAEd,OAAO,IAAI,CAACK,IAAI,CAACS,OAAO,GACnB,GAAEE,gBAAiB,OAAM,IAAI,CAACX,IAAI,CAACS,OAAQ,EAAC,GAC7CE,gBAAgB;EACtB;AACF;AAACC,OAAA,CAAApB,YAAA,GAAAA,YAAA"}
1
+ {"version":3,"file":"input-wrapper.js","names":["clone","InputWrapper","name","undefined","title","type","parentItemName","constructor","rawData","page","options","Object","assign","myPage","components","propertyPath","ignoreSection","section","displayName","titleWithContext"],"sources":["../../../src/data-model/input-wrapper.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport { type Page } from '~/src/data-model/types.js'\nimport { clone } from '~/src/utils/helpers.js'\n\nexport class InputWrapper {\n name: string | undefined = undefined\n title: string | undefined = undefined\n type: string | undefined = undefined\n propertyPath: string | undefined\n #parentItemName: string | undefined\n page: Page\n\n constructor(\n rawData: ComponentDef,\n page: Page,\n options: { ignoreSection?: boolean; parentItemName?: string }\n ) {\n Object.assign(this, rawData)\n const myPage = clone(page)\n\n delete myPage.components\n\n this.page = myPage\n this.propertyPath =\n !options.ignoreSection && page.section\n ? `${page.section}.${this.name}`\n : this.name\n this.#parentItemName = options.parentItemName\n }\n\n get displayName(): string | undefined {\n const titleWithContext = this.#parentItemName\n ? `${this.title} under ${this.#parentItemName}`\n : this.title\n\n return this.page.section\n ? `${titleWithContext} in ${this.page.section}`\n : titleWithContext\n }\n}\n"],"mappings":"AAEA,SAASA,KAAK;AAEd,OAAO,MAAMC,YAAY,CAAC;EACxBC,IAAI,GAAuBC,SAAS;EACpCC,KAAK,GAAuBD,SAAS;EACrCE,IAAI,GAAuBF,SAAS;EAEpC,CAACG,cAAc;EAGfC,WAAWA,CACTC,OAAqB,EACrBC,IAAU,EACVC,OAA6D,EAC7D;IACAC,MAAM,CAACC,MAAM,CAAC,IAAI,EAAEJ,OAAO,CAAC;IAC5B,MAAMK,MAAM,GAAGb,KAAK,CAACS,IAAI,CAAC;IAE1B,OAAOI,MAAM,CAACC,UAAU;IAExB,IAAI,CAACL,IAAI,GAAGI,MAAM;IAClB,IAAI,CAACE,YAAY,GACf,CAACL,OAAO,CAACM,aAAa,IAAIP,IAAI,CAACQ,OAAO,GACjC,GAAER,IAAI,CAACQ,OAAQ,IAAG,IAAI,CAACf,IAAK,EAAC,GAC9B,IAAI,CAACA,IAAI;IACf,IAAI,CAAC,CAACI,cAAc,GAAGI,OAAO,CAACJ,cAAc;EAC/C;EAEA,IAAIY,WAAWA,CAAA,EAAuB;IACpC,MAAMC,gBAAgB,GAAG,IAAI,CAAC,CAACb,cAAc,GACxC,GAAE,IAAI,CAACF,KAAM,UAAS,IAAI,CAAC,CAACE,cAAe,EAAC,GAC7C,IAAI,CAACF,KAAK;IAEd,OAAO,IAAI,CAACK,IAAI,CAACQ,OAAO,GACnB,GAAEE,gBAAiB,OAAM,IAAI,CAACV,IAAI,CAACQ,OAAQ,EAAC,GAC7CE,gBAAgB;EACtB;AACF"}
@@ -1,8 +1,4 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.isMultipleApiKey = isMultipleApiKey;
5
- function isMultipleApiKey(payApiKey) {
1
+ export function isMultipleApiKey(payApiKey) {
6
2
  const obj = payApiKey;
7
3
  return obj.test !== undefined || obj.production !== undefined;
8
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["isMultipleApiKey","payApiKey","obj","test","undefined","production"],"sources":["../../../src/data-model/types.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types'\nimport { type Condition } from '~/src/conditions/condition'\nimport { type OutputType } from '~/src/data-model/enums'\n\ntype Toggleable<T> = boolean | T\n\nexport interface Next {\n path: string\n condition?: string\n}\nexport type Link = Next\n\nexport interface Page {\n title: string\n path: string\n controller: string\n components?: ComponentDef[]\n section: string // the section ID\n next?: { path: string; condition?: string }[]\n}\n\nexport interface RepeatingFieldPage extends Page {\n controller: 'RepeatingFieldPageController'\n options: {\n summaryDisplayMode?: {\n samePage?: boolean\n separatePage?: boolean\n hideRowTitles?: boolean\n }\n customText?: {\n separatePageTitle?: string\n }\n }\n}\n\nexport interface Section {\n name: string\n title: string\n hideTitle: boolean\n}\n\nexport interface Item {\n text: string\n value: string | number | boolean\n description?: string\n condition?: string\n}\n\nexport interface List {\n name: string\n title: string\n type: 'string' | 'number' | 'boolean'\n items: Item[]\n}\n\nexport interface Feedback {\n feedbackForm?: boolean\n url?: string\n emailAddress?: string\n}\n\nexport type PhaseBanner = {\n phase?: 'alpha' | 'beta'\n feedbackUrl?: string\n}\n\nexport type MultipleApiKeys = {\n test?: string\n production?: string\n}\n\nexport type EmailOutputConfiguration = {\n emailAddress: string\n}\n\nexport type NotifyOutputConfiguration = {\n apiKey: string\n templateId: string\n emailField: string\n personalisation: string[]\n personalisationFieldCustomisation?: {\n [personalisationName: string]: string[]\n }\n addReferencesToPersonalisation?: boolean\n emailReplyToIdConfiguration?: {\n emailReplyToId: string\n condition?: string | undefined\n }[]\n}\n\nexport type WebhookOutputConfiguration = {\n url: string\n}\n\nexport type OutputConfiguration =\n | EmailOutputConfiguration\n | NotifyOutputConfiguration\n | WebhookOutputConfiguration\n\nexport type Output = {\n name: string\n title: string\n type: OutputType\n outputConfiguration: OutputConfiguration\n}\n\nexport type ConfirmationPage = {\n customText: {\n title: string\n paymentSkipped: Toggleable<string>\n nextSteps: Toggleable<string>\n }\n components: ComponentDef[]\n}\n\nexport type PaymentSkippedWarningPage = {\n customText: {\n title: string\n caption: string\n body: string\n }\n}\n\nexport type SpecialPages = {\n confirmationPage?: ConfirmationPage\n paymentSkippedWarningPage?: PaymentSkippedWarningPage\n}\n\nexport function isMultipleApiKey(\n payApiKey: string | MultipleApiKeys | undefined\n): payApiKey is MultipleApiKeys {\n const obj = payApiKey as MultipleApiKeys\n return obj.test !== undefined || obj.production !== undefined\n}\n\nexport type Fee = {\n description: string\n amount: number\n multiplier?: string\n condition?: string\n prefix?: string\n}\n\nexport type FeeOptions = {\n paymentReferenceFormat?: string\n payReturnUrl?: string\n allowSubmissionWithoutPayment: boolean\n maxAttempts: number\n customPayErrorMessage?: string\n showPaymentSkippedWarningPage: boolean\n}\n\nexport type ConditionWrapperValue =\n | string\n | {\n name: string\n conditions: Condition[]\n }\n\nexport type ConditionRawData = {\n name: string\n displayName: string\n value: ConditionWrapperValue\n}\n\n/**\n * `FormDefinition` is a typescript representation of `Schema`\n */\nexport type FormDefinition = {\n pages: Array<Page | RepeatingFieldPage>\n conditions: ConditionRawData[]\n lists: List[]\n sections: Section[]\n startPage?: Page['path'] | undefined\n name?: string | undefined\n feedback?: Feedback\n phaseBanner?: PhaseBanner\n fees: Fee[]\n skipSummary?: boolean | undefined\n outputs: Output[]\n declaration?: string | undefined\n metadata?: Record<string, any>\n payApiKey?: string | MultipleApiKeys | undefined\n specialPages?: SpecialPages\n paymentReferenceFormat?: string\n feeOptions: FeeOptions\n}\n"],"mappings":";;;;AAgIO,SAASA,gBAAgBA,CAC9BC,SAA+C,EACjB;EAC9B,MAAMC,GAAG,GAAGD,SAA4B;EACxC,OAAOC,GAAG,CAACC,IAAI,KAAKC,SAAS,IAAIF,GAAG,CAACG,UAAU,KAAKD,SAAS;AAC/D;;AAgCA;AACA;AACA"}
1
+ {"version":3,"file":"types.js","names":["isMultipleApiKey","payApiKey","obj","test","undefined","production"],"sources":["../../../src/data-model/types.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport { type Condition } from '~/src/conditions/condition.js'\nimport { type OutputType } from '~/src/data-model/enums.js'\n\ntype Toggleable<T> = boolean | T\n\nexport interface Next {\n path: string\n condition?: string\n}\nexport type Link = Next\n\nexport interface Page {\n title: string\n path: string\n controller: string\n components?: ComponentDef[]\n section: string // the section ID\n next?: { path: string; condition?: string }[]\n}\n\nexport interface RepeatingFieldPage extends Page {\n controller: 'RepeatingFieldPageController'\n options: {\n summaryDisplayMode?: {\n samePage?: boolean\n separatePage?: boolean\n hideRowTitles?: boolean\n }\n customText?: {\n separatePageTitle?: string\n }\n }\n}\n\nexport interface Section {\n name: string\n title: string\n hideTitle: boolean\n}\n\nexport interface Item {\n text: string\n value: string | number | boolean\n description?: string\n condition?: string\n}\n\nexport interface List {\n name: string\n title: string\n type: 'string' | 'number' | 'boolean'\n items: Item[]\n}\n\nexport interface Feedback {\n feedbackForm?: boolean\n url?: string\n emailAddress?: string\n}\n\nexport type PhaseBanner = {\n phase?: 'alpha' | 'beta'\n feedbackUrl?: string\n}\n\nexport type MultipleApiKeys = {\n test?: string\n production?: string\n}\n\nexport type EmailOutputConfiguration = {\n emailAddress: string\n}\n\nexport type NotifyOutputConfiguration = {\n apiKey: string\n templateId: string\n emailField: string\n personalisation: string[]\n personalisationFieldCustomisation?: {\n [personalisationName: string]: string[]\n }\n addReferencesToPersonalisation?: boolean\n emailReplyToIdConfiguration?: {\n emailReplyToId: string\n condition?: string | undefined\n }[]\n}\n\nexport type WebhookOutputConfiguration = {\n url: string\n}\n\nexport type OutputConfiguration =\n | EmailOutputConfiguration\n | NotifyOutputConfiguration\n | WebhookOutputConfiguration\n\nexport type Output = {\n name: string\n title: string\n type: OutputType\n outputConfiguration: OutputConfiguration\n}\n\nexport type ConfirmationPage = {\n customText: {\n title: string\n paymentSkipped: Toggleable<string>\n nextSteps: Toggleable<string>\n }\n components: ComponentDef[]\n}\n\nexport type PaymentSkippedWarningPage = {\n customText: {\n title: string\n caption: string\n body: string\n }\n}\n\nexport type SpecialPages = {\n confirmationPage?: ConfirmationPage\n paymentSkippedWarningPage?: PaymentSkippedWarningPage\n}\n\nexport function isMultipleApiKey(\n payApiKey: string | MultipleApiKeys | undefined\n): payApiKey is MultipleApiKeys {\n const obj = payApiKey as MultipleApiKeys\n return obj.test !== undefined || obj.production !== undefined\n}\n\nexport type Fee = {\n description: string\n amount: number\n multiplier?: string\n condition?: string\n prefix?: string\n}\n\nexport type FeeOptions = {\n paymentReferenceFormat?: string\n payReturnUrl?: string\n allowSubmissionWithoutPayment: boolean\n maxAttempts: number\n customPayErrorMessage?: string\n showPaymentSkippedWarningPage: boolean\n}\n\nexport type ConditionWrapperValue =\n | string\n | {\n name: string\n conditions: Condition[]\n }\n\nexport type ConditionRawData = {\n name: string\n displayName: string\n value: ConditionWrapperValue\n}\n\n/**\n * `FormDefinition` is a typescript representation of `Schema`\n */\nexport type FormDefinition = {\n pages: Array<Page | RepeatingFieldPage>\n conditions: ConditionRawData[]\n lists: List[]\n sections: Section[]\n startPage?: Page['path'] | undefined\n name?: string | undefined\n feedback?: Feedback\n phaseBanner?: PhaseBanner\n fees: Fee[]\n skipSummary?: boolean | undefined\n outputs: Output[]\n declaration?: string | undefined\n metadata?: Record<string, any>\n payApiKey?: string | MultipleApiKeys | undefined\n specialPages?: SpecialPages\n paymentReferenceFormat?: string\n feeOptions: FeeOptions\n}\n"],"mappings":"AAgIA,OAAO,SAASA,gBAAgBA,CAC9BC,SAA+C,EACjB;EAC9B,MAAMC,GAAG,GAAGD,SAA4B;EACxC,OAAOC,GAAG,CAACC,IAAI,KAAKC,SAAS,IAAIF,GAAG,CAACG,UAAU,KAAKD,SAAS;AAC/D;;AAgCA;AACA;AACA"}
@@ -1,8 +1,4 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.FormConfiguration = void 0;
5
- class FormConfiguration {
1
+ export class FormConfiguration {
6
2
  constructor(Key, DisplayName, LastModified, feedbackForm) {
7
3
  if (!Key) {
8
4
  throw Error('Form configuration must have a key');
@@ -13,5 +9,4 @@ class FormConfiguration {
13
9
  this.feedbackForm = feedbackForm || false;
14
10
  }
15
11
  }
16
- exports.FormConfiguration = FormConfiguration;
17
12
  //# sourceMappingURL=form-configuration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-configuration.js","names":["FormConfiguration","constructor","Key","DisplayName","LastModified","feedbackForm","Error","exports"],"sources":["../../../src/form/form-configuration.ts"],"sourcesContent":["export class FormConfiguration {\n Key: string\n DisplayName: string\n LastModified: string | undefined\n feedbackForm: boolean | undefined\n\n constructor(\n Key: string,\n DisplayName?: string,\n LastModified?: string,\n feedbackForm?: boolean\n ) {\n if (!Key) {\n throw Error('Form configuration must have a key')\n }\n this.Key = Key\n this.DisplayName = DisplayName || Key\n this.LastModified = LastModified\n this.feedbackForm = feedbackForm || false\n }\n}\n"],"mappings":";;;;AAAO,MAAMA,iBAAiB,CAAC;EAM7BC,WAAWA,CACTC,GAAW,EACXC,WAAoB,EACpBC,YAAqB,EACrBC,YAAsB,EACtB;IACA,IAAI,CAACH,GAAG,EAAE;MACR,MAAMI,KAAK,CAAC,oCAAoC,CAAC;IACnD;IACA,IAAI,CAACJ,GAAG,GAAGA,GAAG;IACd,IAAI,CAACC,WAAW,GAAGA,WAAW,IAAID,GAAG;IACrC,IAAI,CAACE,YAAY,GAAGA,YAAY;IAChC,IAAI,CAACC,YAAY,GAAGA,YAAY,IAAI,KAAK;EAC3C;AACF;AAACE,OAAA,CAAAP,iBAAA,GAAAA,iBAAA"}
1
+ {"version":3,"file":"form-configuration.js","names":["FormConfiguration","constructor","Key","DisplayName","LastModified","feedbackForm","Error"],"sources":["../../../src/form/form-configuration.ts"],"sourcesContent":["export class FormConfiguration {\n Key: string\n DisplayName: string\n LastModified: string | undefined\n feedbackForm: boolean | undefined\n\n constructor(\n Key: string,\n DisplayName?: string,\n LastModified?: string,\n feedbackForm?: boolean\n ) {\n if (!Key) {\n throw Error('Form configuration must have a key')\n }\n this.Key = Key\n this.DisplayName = DisplayName || Key\n this.LastModified = LastModified\n this.feedbackForm = feedbackForm || false\n }\n}\n"],"mappings":"AAAA,OAAO,MAAMA,iBAAiB,CAAC;EAM7BC,WAAWA,CACTC,GAAW,EACXC,WAAoB,EACpBC,YAAqB,EACrBC,YAAsB,EACtB;IACA,IAAI,CAACH,GAAG,EAAE;MACR,MAAMI,KAAK,CAAC,oCAAoC,CAAC;IACnD;IACA,IAAI,CAACJ,GAAG,GAAGA,GAAG;IACd,IAAI,CAACC,WAAW,GAAGA,WAAW,IAAID,GAAG;IACrC,IAAI,CAACE,YAAY,GAAGA,YAAY;IAChC,IAAI,CAACC,YAAY,GAAGA,YAAY,IAAI,KAAK;EAC3C;AACF"}
@@ -1,11 +1,2 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- Object.defineProperty(exports, "FormConfiguration", {
5
- enumerable: true,
6
- get: function () {
7
- return _formConfiguration.FormConfiguration;
8
- }
9
- });
10
- var _formConfiguration = require("./form-configuration");
1
+ export { FormConfiguration } from "./form-configuration.js";
11
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_formConfiguration","require"],"sources":["../../../src/form/index.ts"],"sourcesContent":["export { FormConfiguration } from '~/src/form/form-configuration'\n"],"mappings":";;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA"}
1
+ {"version":3,"file":"index.js","names":["FormConfiguration"],"sources":["../../../src/form/index.ts"],"sourcesContent":["export { FormConfiguration } from '~/src/form/form-configuration.js'\n"],"mappings":"AAAA,SAASA,iBAAiB"}
@@ -1,92 +1,9 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- var _schema = require("./schema");
5
- Object.keys(_schema).forEach(function (key) {
6
- if (key === "default" || key === "__esModule") return;
7
- if (key in exports && exports[key] === _schema[key]) return;
8
- Object.defineProperty(exports, key, {
9
- enumerable: true,
10
- get: function () {
11
- return _schema[key];
12
- }
13
- });
14
- });
15
- var _dataModel = require("./data-model");
16
- Object.keys(_dataModel).forEach(function (key) {
17
- if (key === "default" || key === "__esModule") return;
18
- if (key in exports && exports[key] === _dataModel[key]) return;
19
- Object.defineProperty(exports, key, {
20
- enumerable: true,
21
- get: function () {
22
- return _dataModel[key];
23
- }
24
- });
25
- });
26
- var _logger = require("./utils/logger");
27
- Object.keys(_logger).forEach(function (key) {
28
- if (key === "default" || key === "__esModule") return;
29
- if (key in exports && exports[key] === _logger[key]) return;
30
- Object.defineProperty(exports, key, {
31
- enumerable: true,
32
- get: function () {
33
- return _logger[key];
34
- }
35
- });
36
- });
37
- var _form = require("./form");
38
- Object.keys(_form).forEach(function (key) {
39
- if (key === "default" || key === "__esModule") return;
40
- if (key in exports && exports[key] === _form[key]) return;
41
- Object.defineProperty(exports, key, {
42
- enumerable: true,
43
- get: function () {
44
- return _form[key];
45
- }
46
- });
47
- });
48
- var _components = require("./components");
49
- Object.keys(_components).forEach(function (key) {
50
- if (key === "default" || key === "__esModule") return;
51
- if (key in exports && exports[key] === _components[key]) return;
52
- Object.defineProperty(exports, key, {
53
- enumerable: true,
54
- get: function () {
55
- return _components[key];
56
- }
57
- });
58
- });
59
- var _conditions = require("./conditions");
60
- Object.keys(_conditions).forEach(function (key) {
61
- if (key === "default" || key === "__esModule") return;
62
- if (key in exports && exports[key] === _conditions[key]) return;
63
- Object.defineProperty(exports, key, {
64
- enumerable: true,
65
- get: function () {
66
- return _conditions[key];
67
- }
68
- });
69
- });
70
- var _helpers = require("./utils/helpers");
71
- Object.keys(_helpers).forEach(function (key) {
72
- if (key === "default" || key === "__esModule") return;
73
- if (key in exports && exports[key] === _helpers[key]) return;
74
- Object.defineProperty(exports, key, {
75
- enumerable: true,
76
- get: function () {
77
- return _helpers[key];
78
- }
79
- });
80
- });
81
- var _migration = require("./migration");
82
- Object.keys(_migration).forEach(function (key) {
83
- if (key === "default" || key === "__esModule") return;
84
- if (key in exports && exports[key] === _migration[key]) return;
85
- Object.defineProperty(exports, key, {
86
- enumerable: true,
87
- get: function () {
88
- return _migration[key];
89
- }
90
- });
91
- });
1
+ export * from "./schema/index.js";
2
+ export * from "./data-model/index.js";
3
+ export * from "./utils/logger.js";
4
+ export * from "./form/index.js";
5
+ export * from "./components/index.js";
6
+ export * from "./conditions/index.js";
7
+ export * from "./utils/helpers.js";
8
+ export * from "./migration/index.js";
92
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_schema","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_dataModel","_logger","_form","_components","_conditions","_helpers","_migration"],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/schema'\nexport * from '~/src/data-model'\nexport * from '~/src/utils/logger'\nexport * from '~/src/form'\nexport * from '~/src/components'\nexport * from '~/src/conditions'\nexport * from '~/src/utils/helpers'\nexport * from '~/src/migration'\nexport type * from '~/src/components/types'\nexport type * from '~/src/conditions/types'\nexport type * from '~/src/data-model/types'\n"],"mappings":";;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,UAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,UAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,UAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,OAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,OAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,OAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,O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AA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAU,QAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAM,QAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AACA,IAAAW,UAAA,GAAAf,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAa,UAAA,EAAAZ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAW,UAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAO,UAAA,CAAAX,GAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from '~/src/schema/index.js'\nexport * from '~/src/data-model/index.js'\nexport * from '~/src/utils/logger.js'\nexport * from '~/src/form/index.js'\nexport * from '~/src/components/index.js'\nexport * from '~/src/conditions/index.js'\nexport * from '~/src/utils/helpers.js'\nexport * from '~/src/migration/index.js'\nexport type * from '~/src/components/types.js'\nexport type * from '~/src/conditions/types.js'\nexport type * from '~/src/data-model/types.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -1,11 +1,2 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- Object.defineProperty(exports, "whichMigrations", {
5
- enumerable: true,
6
- get: function () {
7
- return _whichMigrations.whichMigrations;
8
- }
9
- });
10
- var _whichMigrations = require("./whichMigrations");
1
+ export { whichMigrations } from "./whichMigrations.js";
11
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_whichMigrations","require"],"sources":["../../../src/migration/index.ts"],"sourcesContent":["export { whichMigrations } from '~/src/migration/whichMigrations'\n"],"mappings":";;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA"}
1
+ {"version":3,"file":"index.js","names":["whichMigrations"],"sources":["../../../src/migration/index.ts"],"sourcesContent":["export { whichMigrations } from '~/src/migration/whichMigrations.js'\n"],"mappings":"AAAA,SAASA,eAAe"}
@@ -1,11 +1,7 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.migrate = migrate;
5
1
  function needsUpgrade(data) {
6
2
  return !!(data.pages ?? []).flatMap(page => page.components).find(component => component.options?.list);
7
3
  }
8
- function migrate(data) {
4
+ export function migrate(data) {
9
5
  if (!needsUpgrade(data)) {
10
6
  return {
11
7
  ...data,
@@ -1 +1 @@
1
- {"version":3,"file":"migration.0-2.js","names":["needsUpgrade","data","pages","flatMap","page","components","find","component","options","list","migrate","version","newPages","map","rest"],"sources":["../../../src/migration/migration.0-2.ts"],"sourcesContent":["import { type MigrationScript } from '~/src/migration/types'\n\nfunction needsUpgrade(data) {\n return !!(data.pages ?? [])\n .flatMap((page) => page.components)\n .find((component) => component.options?.list)\n}\n\nexport function migrate(data): MigrationScript {\n if (!needsUpgrade(data)) {\n return { ...data, version: 2 }\n }\n const { pages } = data\n const newPages = pages.flatMap((page) => {\n return page.components.map((component) => {\n if (!component.options?.list) {\n return component\n }\n const { list, ...rest } = component.options\n return { ...component, list, options: { ...rest } }\n })\n })\n\n return {\n ...data,\n pages: newPages,\n version: 2\n }\n}\n"],"mappings":";;;;AAEA,SAASA,YAAYA,CAACC,IAAI,EAAE;EAC1B,OAAO,CAAC,CAAC,CAACA,IAAI,CAACC,KAAK,IAAI,EAAE,EACvBC,OAAO,CAAEC,IAAI,IAAKA,IAAI,CAACC,UAAU,CAAC,CAClCC,IAAI,CAAEC,SAAS,IAAKA,SAAS,CAACC,OAAO,EAAEC,IAAI,CAAC;AACjD;AAEO,SAASC,OAAOA,CAACT,IAAI,EAAmB;EAC7C,IAAI,CAACD,YAAY,CAACC,IAAI,CAAC,EAAE;IACvB,OAAO;MAAE,GAAGA,IAAI;MAAEU,OAAO,EAAE;IAAE,CAAC;EAChC;EACA,MAAM;IAAET;EAAM,CAAC,GAAGD,IAAI;EACtB,MAAMW,QAAQ,GAAGV,KAAK,CAACC,OAAO,CAAEC,IAAI,IAAK;IACvC,OAAOA,IAAI,CAACC,UAAU,CAACQ,GAAG,CAAEN,SAAS,IAAK;MACxC,IAAI,CAACA,SAAS,CAACC,OAAO,EAAEC,IAAI,EAAE;QAC5B,OAAOF,SAAS;MAClB;MACA,MAAM;QAAEE,IAAI;QAAE,GAAGK;MAAK,CAAC,GAAGP,SAAS,CAACC,OAAO;MAC3C,OAAO;QAAE,GAAGD,SAAS;QAAEE,IAAI;QAAED,OAAO,EAAE;UAAE,GAAGM;QAAK;MAAE,CAAC;IACrD,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACL,GAAGb,IAAI;IACPC,KAAK,EAAEU,QAAQ;IACfD,OAAO,EAAE;EACX,CAAC;AACH"}
1
+ {"version":3,"file":"migration.0-2.js","names":["needsUpgrade","data","pages","flatMap","page","components","find","component","options","list","migrate","version","newPages","map","rest"],"sources":["../../../src/migration/migration.0-2.ts"],"sourcesContent":["import { type MigrationScript } from '~/src/migration/types.js'\n\nfunction needsUpgrade(data) {\n return !!(data.pages ?? [])\n .flatMap((page) => page.components)\n .find((component) => component.options?.list)\n}\n\nexport function migrate(data): MigrationScript {\n if (!needsUpgrade(data)) {\n return { ...data, version: 2 }\n }\n const { pages } = data\n const newPages = pages.flatMap((page) => {\n return page.components.map((component) => {\n if (!component.options?.list) {\n return component\n }\n const { list, ...rest } = component.options\n return { ...component, list, options: { ...rest } }\n })\n })\n\n return {\n ...data,\n pages: newPages,\n version: 2\n }\n}\n"],"mappings":"AAEA,SAASA,YAAYA,CAACC,IAAI,EAAE;EAC1B,OAAO,CAAC,CAAC,CAACA,IAAI,CAACC,KAAK,IAAI,EAAE,EACvBC,OAAO,CAAEC,IAAI,IAAKA,IAAI,CAACC,UAAU,CAAC,CAClCC,IAAI,CAAEC,SAAS,IAAKA,SAAS,CAACC,OAAO,EAAEC,IAAI,CAAC;AACjD;AAEA,OAAO,SAASC,OAAOA,CAACT,IAAI,EAAmB;EAC7C,IAAI,CAACD,YAAY,CAACC,IAAI,CAAC,EAAE;IACvB,OAAO;MAAE,GAAGA,IAAI;MAAEU,OAAO,EAAE;IAAE,CAAC;EAChC;EACA,MAAM;IAAET;EAAM,CAAC,GAAGD,IAAI;EACtB,MAAMW,QAAQ,GAAGV,KAAK,CAACC,OAAO,CAAEC,IAAI,IAAK;IACvC,OAAOA,IAAI,CAACC,UAAU,CAACQ,GAAG,CAAEN,SAAS,IAAK;MACxC,IAAI,CAACA,SAAS,CAACC,OAAO,EAAEC,IAAI,EAAE;QAC5B,OAAOF,SAAS;MAClB;MACA,MAAM;QAAEE,IAAI;QAAE,GAAGK;MAAK,CAAC,GAAGP,SAAS,CAACC,OAAO;MAC3C,OAAO;QAAE,GAAGD,SAAS;QAAEE,IAAI;QAAED,OAAO,EAAE;UAAE,GAAGM;QAAK;MAAE,CAAC;IACrD,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACL,GAAGb,IAAI;IACPC,KAAK,EAAEU,QAAQ;IACfD,OAAO,EAAE;EACX,CAAC;AACH"}
@@ -1,8 +1,5 @@
1
- "use strict";
1
+ import { nanoid } from "../utils/helpers.js";
2
2
 
3
- exports.__esModule = true;
4
- exports.migrate = migrate;
5
- var _helpers = require("../utils/helpers");
6
3
  /**
7
4
  * @private
8
5
  * StaticItem is a deprecated Type.
@@ -38,7 +35,7 @@ function addListId(component) {
38
35
  } = component;
39
36
  return {
40
37
  ...component,
41
- list: values.type === 'listRef' ? values.list : (0, _helpers.nanoid)()
38
+ list: values.type === 'listRef' ? values.list : nanoid()
42
39
  };
43
40
  }
44
41
  function migratePage(page) {
@@ -64,7 +61,7 @@ function removeValues(page) {
64
61
  function needsUpgrade(data) {
65
62
  return !!data.pages.flatMap(page => page.components).find(component => component.values);
66
63
  }
67
- function migrate(data) {
64
+ export function migrate(data) {
68
65
  if (!needsUpgrade(data)) {
69
66
  return {
70
67
  ...data,
@@ -1 +1 @@
1
- {"version":3,"file":"migration.1-2.js","names":["_helpers","require","recastItem","label","value","condition","hint","item","title","conditions","addListId","component","values","list","type","nanoid","migratePage","page","components","map","removeValues","rest","needsUpgrade","data","pages","flatMap","find","migrate","version","componentsWithList","filter","c","items","valuesAsLists","name","lists"],"sources":["../../../src/migration/migration.1-2.ts"],"sourcesContent":["import { nanoid } from '~/src/utils/helpers'\nimport { type MigrationScript } from '~/src/migration/types'\n\n/**\n * @private\n * StaticItem is a deprecated Type.\n * It should only be used for aiding migration scripts.\n */\ntype StaticItem = {\n label: string\n value: string | number | boolean\n hint?: string\n condition?: string\n}\n\n/**\n * @private\n * StaticComponentValues is a deprecated Type.\n * It should only be used for aiding migration scripts.\n */\ntype StaticComponentValues = {\n list: any\n type: 'static' | 'listRef'\n valueType: string | number\n items: StaticItem[]\n}\n\ntype Item = {\n title: string\n value: any\n conditions?: any\n hint?: string\n}\n\nfunction recastItem({ label, value, condition, hint }: StaticItem) {\n const item: Item = {\n title: label,\n value\n }\n\n condition && (item.conditions = condition)\n hint && (item.hint = hint)\n return item\n}\n\nfunction addListId(component: { values: StaticComponentValues }) {\n if (!component.values) {\n return component\n }\n const { values } = component\n return {\n ...component,\n list: values.type === 'listRef' ? values.list : nanoid()\n }\n}\n\nfunction migratePage(page) {\n return {\n ...page,\n components: page.components.map(addListId)\n }\n}\n\nfunction removeValues(page) {\n return {\n ...page,\n components: page.components.map((component) => {\n const { values, ...rest } = component\n return {\n ...rest\n }\n })\n }\n}\n\nfunction needsUpgrade(data) {\n return !!data.pages\n .flatMap((page) => page.components)\n .find((component) => component.values)\n}\n\nexport function migrate(data): MigrationScript {\n if (!needsUpgrade(data)) {\n return { ...data, version: 2 }\n }\n const pages = data.pages.map(migratePage)\n const componentsWithList = pages.flatMap((page) =>\n page.components.filter((c) => c.values?.items)\n )\n\n const valuesAsLists = componentsWithList.map((component) => {\n return {\n title: component.title,\n name: component.list,\n items: component.values.items.map((item) => recastItem(item))\n }\n })\n\n return {\n ...data,\n pages: pages.map(removeValues),\n lists: [...(data.lists ?? []), ...valuesAsLists],\n version: 2\n }\n}\n"],"mappings":";;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;;AAeA,SAASC,UAAUA,CAAC;EAAEC,KAAK;EAAEC,KAAK;EAAEC,SAAS;EAAEC;AAAiB,CAAC,EAAE;EACjE,MAAMC,IAAU,GAAG;IACjBC,KAAK,EAAEL,KAAK;IACZC;EACF,CAAC;EAEDC,SAAS,KAAKE,IAAI,CAACE,UAAU,GAAGJ,SAAS,CAAC;EAC1CC,IAAI,KAAKC,IAAI,CAACD,IAAI,GAAGA,IAAI,CAAC;EAC1B,OAAOC,IAAI;AACb;AAEA,SAASG,SAASA,CAACC,SAA4C,EAAE;EAC/D,IAAI,CAACA,SAAS,CAACC,MAAM,EAAE;IACrB,OAAOD,SAAS;EAClB;EACA,MAAM;IAAEC;EAAO,CAAC,GAAGD,SAAS;EAC5B,OAAO;IACL,GAAGA,SAAS;IACZE,IAAI,EAAED,MAAM,CAACE,IAAI,KAAK,SAAS,GAAGF,MAAM,CAACC,IAAI,GAAG,IAAAE,eAAM,EAAC;EACzD,CAAC;AACH;AAEA,SAASC,WAAWA,CAACC,IAAI,EAAE;EACzB,OAAO;IACL,GAAGA,IAAI;IACPC,UAAU,EAAED,IAAI,CAACC,UAAU,CAACC,GAAG,CAACT,SAAS;EAC3C,CAAC;AACH;AAEA,SAASU,YAAYA,CAACH,IAAI,EAAE;EAC1B,OAAO;IACL,GAAGA,IAAI;IACPC,UAAU,EAAED,IAAI,CAACC,UAAU,CAACC,GAAG,CAAER,SAAS,IAAK;MAC7C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ACH"}
1
+ {"version":3,"file":"migration.1-2.js","names":["nanoid","recastItem","label","value","condition","hint","item","title","conditions","addListId","component","values","list","type","migratePage","page","components","map","removeValues","rest","needsUpgrade","data","pages","flatMap","find","migrate","version","componentsWithList","filter","c","items","valuesAsLists","name","lists"],"sources":["../../../src/migration/migration.1-2.ts"],"sourcesContent":["import { nanoid } from '~/src/utils/helpers.js'\nimport { type MigrationScript } from '~/src/migration/types.js'\n\n/**\n * @private\n * StaticItem is a deprecated Type.\n * It should only be used for aiding migration scripts.\n */\ntype StaticItem = {\n label: string\n value: string | number | boolean\n hint?: string\n condition?: string\n}\n\n/**\n * @private\n * StaticComponentValues is a deprecated Type.\n * It should only be used for aiding migration scripts.\n */\ntype StaticComponentValues = {\n list: any\n type: 'static' | 'listRef'\n valueType: string | number\n items: StaticItem[]\n}\n\ntype Item = {\n title: string\n value: any\n conditions?: any\n hint?: string\n}\n\nfunction recastItem({ label, value, condition, hint }: StaticItem) {\n const item: Item = {\n title: label,\n value\n }\n\n condition && (item.conditions = condition)\n hint && (item.hint = hint)\n return item\n}\n\nfunction addListId(component: { values: StaticComponentValues }) {\n if (!component.values) {\n return component\n }\n const { values } = component\n return {\n ...component,\n list: values.type === 'listRef' ? values.list : nanoid()\n }\n}\n\nfunction migratePage(page) {\n return {\n ...page,\n components: page.components.map(addListId)\n }\n}\n\nfunction removeValues(page) {\n return {\n ...page,\n components: page.components.map((component) => {\n const { values, ...rest } = component\n return {\n ...rest\n }\n })\n }\n}\n\nfunction needsUpgrade(data) {\n return !!data.pages\n .flatMap((page) => page.components)\n .find((component) => component.values)\n}\n\nexport function migrate(data): MigrationScript {\n if (!needsUpgrade(data)) {\n return { ...data, version: 2 }\n }\n const pages = data.pages.map(migratePage)\n const componentsWithList = pages.flatMap((page) =>\n page.components.filter((c) => c.values?.items)\n )\n\n const valuesAsLists = componentsWithList.map((component) => {\n return {\n title: component.title,\n name: component.list,\n items: component.values.items.map((item) => recastItem(item))\n }\n })\n\n return {\n ...data,\n pages: pages.map(removeValues),\n lists: [...(data.lists ?? []), ...valuesAsLists],\n version: 2\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM;;AAGf;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;;AAeA,SAASC,UAAUA,CAAC;EAAEC,KAAK;EAAEC,KAAK;EAAEC,SAAS;EAAEC;AAAiB,CAAC,EAAE;EACjE,MAAMC,IAAU,GAAG;IACjBC,KAAK,EAAEL,KAAK;IACZC;EACF,CAAC;EAEDC,SAAS,KAAKE,IAAI,CAACE,UAAU,GAAGJ,SAAS,CAAC;EAC1CC,IAAI,KAAKC,IAAI,CAACD,IAAI,GAAGA,IAAI,CAAC;EAC1B,OAAOC,IAAI;AACb;AAEA,SAASG,SAASA,CAACC,SAA4C,EAAE;EAC/D,IAAI,CAACA,SAAS,CAACC,MAAM,EAAE;IACrB,OAAOD,SAAS;EAClB;EACA,MAAM;IAAEC;EAAO,CAAC,GAAGD,SAAS;EAC5B,OAAO;IACL,GAAGA,SAAS;IACZE,IAAI,EAAED,MAAM,CAACE,IAAI,KAAK,SAAS,GAAGF,MAAM,CAACC,IAAI,GAAGZ,MAAM,CAAC;EACzD,CAAC;AACH;AAEA,SAASc,WAAWA,CAACC,IAAI,EAAE;EACzB,OAAO;IACL,GAAGA,IAAI;IACPC,UAAU,EAAED,IAAI,CAACC,UAAU,CAACC,GAAG,CAACR,SAAS;EAC3C,CAAC;AACH;AAEA,SAASS,YAAYA,CAACH,IAAI,EAAE;EAC1B,OAAO;IACL,GAAGA,IAAI;IACPC,UAAU,EAAED,IAAI,CAACC,UAAU,CAACC,GAAG,CAAEP,SAAS,IAAK;MAC7C,MAAM;QAAEC,MAAM;QAAE,GAAGQ;MAAK,CAAC,GAAGT,SAAS;MACrC,OAAO;QACL,GAAGS;MACL,CAAC;IACH,CAAC;EACH,CAAC;AACH;AAEA,SAASC,YAAYA,CAACC,IAAI,EAAE;EAC1B,OAAO,CAAC,CAACA,IAAI,CAACC,KAAK,CAChBC,OAAO,CAAER,IAAI,IAAKA,IAAI,CAACC,UAAU,CAAC,CAClCQ,IAAI,CAAEd,SAAS,IAAKA,SAAS,CAACC,MAAM,CAAC;AAC1C;AAEA,OAAO,SAASc,OAAOA,CAACJ,IAAI,EAAmB;EAC7C,IAAI,CAACD,YAAY,CAACC,IAAI,CAAC,EAAE;IACvB,OAAO;MAAE,GAAGA,IAAI;MAAEK,OAAO,EAAE;IAAE,CAAC;EAChC;EACA,MAAMJ,KAAK,GAAGD,IAAI,CAACC,KAAK,CAACL,GAAG,CAACH,WAAW,CAAC;EACzC,MAAMa,kBAAkB,GAAGL,KAAK,CAACC,OAAO,CAAER,IAAI,IAC5CA,IAAI,CAACC,UAAU,CAACY,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAAClB,MAAM,EAAEmB,KAAK,CAC/C,CAAC;EAED,MAAMC,aAAa,GAAGJ,kBAAkB,CAACV,GAAG,CAAEP,SAAS,IAAK;IAC1D,OAAO;MACLH,KAAK,EAAEG,SAAS,CAACH,KAAK;MACtByB,IAAI,EAAEtB,SAAS,CAACE,IAAI;MACpBkB,KAAK,EAAEpB,SAAS,CAACC,MAAM,CAACmB,KAAK,CAACb,GAAG,CAAEX,IAAI,IAAKL,UAAU,CAACK,IAAI,CAAC;IAC9D,CAAC;EACH,CAAC,CAAC;EAEF,OAAO;IACL,GAAGe,IAAI;IACPC,KAAK,EAAEA,KAAK,CAACL,GAAG,CAACC,YAAY,CAAC;IAC9Be,KAAK,EAAE,CAAC,IAAIZ,IAAI,CAACY,KAAK,IAAI,EAAE,CAAC,EAAE,GAAGF,aAAa,CAAC;IAChDL,OAAO,EAAE;EACX,CAAC;AACH"}
@@ -1,2 +1,2 @@
1
- "use strict";
1
+ export {};
2
2
  //# sourceMappingURL=types.js.map
@@ -1,24 +1,20 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.whichMigrations = whichMigrations;
5
- var _migration = require("./migration.0-2");
6
- var _migration2 = require("./migration.1-2");
1
+ import { migrate as V0_TO_V2 } from "./migration.0-2.js";
2
+ import { migrate as V1_TO_V2 } from "./migration.1-2.js";
7
3
  /**
8
4
  * Returns which migrations that should be run against your Object with the given version
9
5
  * @param version
10
6
  */
11
- function whichMigrations(version) {
7
+ export function whichMigrations(version) {
12
8
  const migrations = new Set();
13
9
  switch (version) {
14
10
  case 0:
15
- migrations.add(_migration.migrate);
11
+ migrations.add(V0_TO_V2);
16
12
  /**
17
13
  * we are skipping v1 entirely. If we weren't you would do migrations.add([V1_TO_V2, V2_TO_V3]) for example.
18
14
  */
19
15
  break;
20
16
  case 1:
21
- migrations.add(_migration2.migrate);
17
+ migrations.add(V1_TO_V2);
22
18
  break;
23
19
  }
24
20
  return migrations;
@@ -1 +1 @@
1
- {"version":3,"file":"whichMigrations.js","names":["_migration","require","_migration2","whichMigrations","version","migrations","Set","add","V0_TO_V2","V1_TO_V2"],"sources":["../../../src/migration/whichMigrations.ts"],"sourcesContent":["import { migrate as V0_TO_V2 } from '~/src/migration/migration.0-2'\nimport { migrate as V1_TO_V2 } from '~/src/migration/migration.1-2'\nimport { type MigrationScript } from '~/src/migration/types'\n\n/**\n * Returns which migrations that should be run against your Object with the given version\n * @param version\n */\nexport function whichMigrations(version: number) {\n const migrations = new Set<MigrationScript>()\n switch (version) {\n case 0:\n migrations.add(V0_TO_V2)\n /**\n * we are skipping v1 entirely. If we weren't you would do migrations.add([V1_TO_V2, V2_TO_V3]) for example.\n */\n break\n case 1:\n migrations.add(V1_TO_V2)\n break\n }\n return migrations\n}\n"],"mappings":";;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACO,SAASE,eAAeA,CAACC,OAAe,EAAE;EAC/C,MAAMC,UAAU,GAAG,IAAIC,GAAG,CAAkB,CAAC;EAC7C,QAAQF,OAAO;IACb,KAAK,CAAC;MACJC,UAAU,CAACE,GAAG,CAACC,kBAAQ,CAAC;MACxB;AACN;AACA;MACM;IACF,KAAK,CAAC;MACJH,UAAU,CAACE,GAAG,CAACE,mBAAQ,CAAC;MACxB;EACJ;EACA,OAAOJ,UAAU;AACnB"}
1
+ {"version":3,"file":"whichMigrations.js","names":["migrate","V0_TO_V2","V1_TO_V2","whichMigrations","version","migrations","Set","add"],"sources":["../../../src/migration/whichMigrations.ts"],"sourcesContent":["import { migrate as V0_TO_V2 } from '~/src/migration/migration.0-2.js'\nimport { migrate as V1_TO_V2 } from '~/src/migration/migration.1-2.js'\nimport { type MigrationScript } from '~/src/migration/types.js'\n\n/**\n * Returns which migrations that should be run against your Object with the given version\n * @param version\n */\nexport function whichMigrations(version: number) {\n const migrations = new Set<MigrationScript>()\n switch (version) {\n case 0:\n migrations.add(V0_TO_V2)\n /**\n * we are skipping v1 entirely. If we weren't you would do migrations.add([V1_TO_V2, V2_TO_V3]) for example.\n */\n break\n case 1:\n migrations.add(V1_TO_V2)\n break\n }\n return migrations\n}\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,QAAQ;AAC5B,SAASD,OAAO,IAAIE,QAAQ;AAG5B;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAACC,OAAe,EAAE;EAC/C,MAAMC,UAAU,GAAG,IAAIC,GAAG,CAAkB,CAAC;EAC7C,QAAQF,OAAO;IACb,KAAK,CAAC;MACJC,UAAU,CAACE,GAAG,CAACN,QAAQ,CAAC;MACxB;AACN;AACA;MACM;IACF,KAAK,CAAC;MACJI,UAAU,CAACE,GAAG,CAACL,QAAQ,CAAC;MACxB;EACJ;EACA,OAAOG,UAAU;AACnB"}