@defra/forms-model 3.0.11 → 3.0.13

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 (134) hide show
  1. package/dist/module/components/types.js.map +1 -1
  2. package/dist/module/conditions/condition-group.js.map +1 -1
  3. package/dist/module/conditions/condition-model.js +2 -2
  4. package/dist/module/conditions/condition-model.js.map +1 -1
  5. package/dist/module/conditions/condition-operators.js.map +1 -1
  6. package/dist/module/conditions/condition-ref.js.map +1 -1
  7. package/dist/module/conditions/condition.js +1 -1
  8. package/dist/module/conditions/condition.js.map +1 -1
  9. package/dist/module/conditions/types.js.map +1 -1
  10. package/dist/module/data-model/types.js.map +1 -1
  11. package/dist/module/migration/migration.1-2.js +2 -2
  12. package/dist/module/migration/migration.1-2.js.map +1 -1
  13. package/dist/module/migration/whichMigrations.js +0 -1
  14. package/dist/module/migration/whichMigrations.js.map +1 -1
  15. package/dist/module/schema/schema.js +1 -1
  16. package/dist/module/schema/schema.js.map +1 -1
  17. package/dist/module/utils/helpers.js.map +1 -1
  18. package/dist/types/components/types.d.ts +4 -4
  19. package/dist/types/components/types.d.ts.map +1 -1
  20. package/dist/types/conditions/condition-group-def.d.ts +1 -1
  21. package/dist/types/conditions/condition-group.d.ts +1 -1
  22. package/dist/types/conditions/condition-group.d.ts.map +1 -1
  23. package/dist/types/conditions/condition-model.d.ts +3 -3
  24. package/dist/types/conditions/condition-model.d.ts.map +1 -1
  25. package/dist/types/conditions/condition-operators.d.ts +1 -1
  26. package/dist/types/conditions/condition-operators.d.ts.map +1 -1
  27. package/dist/types/conditions/condition-ref.d.ts +1 -1
  28. package/dist/types/conditions/condition-ref.d.ts.map +1 -1
  29. package/dist/types/conditions/condition.d.ts +3 -3
  30. package/dist/types/conditions/condition.d.ts.map +1 -1
  31. package/dist/types/conditions/types.d.ts +6 -6
  32. package/dist/types/conditions/types.d.ts.map +1 -1
  33. package/dist/types/data-model/types.d.ts +28 -30
  34. package/dist/types/data-model/types.d.ts.map +1 -1
  35. package/dist/types/migration/migration.1-2.d.ts.map +1 -1
  36. package/dist/types/migration/whichMigrations.d.ts +0 -1
  37. package/dist/types/migration/whichMigrations.d.ts.map +1 -1
  38. package/dist/types/schema/schema.d.ts +1 -1
  39. package/dist/types/schema/schema.d.ts.map +1 -1
  40. package/dist/types/utils/helpers.d.ts +1 -3
  41. package/dist/types/utils/helpers.d.ts.map +1 -1
  42. package/package.json +2 -4
  43. package/src/components/types.ts +2 -2
  44. package/src/conditions/condition-group.ts +1 -1
  45. package/src/conditions/condition-model.ts +21 -22
  46. package/src/conditions/condition-operators.ts +1 -1
  47. package/src/conditions/condition-ref.ts +1 -1
  48. package/src/conditions/condition.ts +5 -5
  49. package/src/conditions/types.ts +4 -4
  50. package/src/data-model/types.ts +15 -17
  51. package/src/migration/migration.1-2.ts +6 -6
  52. package/src/migration/whichMigrations.ts +0 -1
  53. package/src/schema/schema.ts +1 -1
  54. package/src/utils/helpers.ts +1 -1
  55. package/dist/browser/components/component-types.js +0 -202
  56. package/dist/browser/components/component-types.js.map +0 -1
  57. package/dist/browser/components/conditional-component-types.js +0 -10
  58. package/dist/browser/components/conditional-component-types.js.map +0 -1
  59. package/dist/browser/components/enums.js +0 -28
  60. package/dist/browser/components/enums.js.map +0 -1
  61. package/dist/browser/components/index.js +0 -4
  62. package/dist/browser/components/index.js.map +0 -1
  63. package/dist/browser/components/types.js +0 -2
  64. package/dist/browser/components/types.js.map +0 -1
  65. package/dist/browser/conditions/condition-abstract.js +0 -44
  66. package/dist/browser/conditions/condition-abstract.js.map +0 -1
  67. package/dist/browser/conditions/condition-field.js +0 -27
  68. package/dist/browser/conditions/condition-field.js.map +0 -1
  69. package/dist/browser/conditions/condition-group-def.js +0 -26
  70. package/dist/browser/conditions/condition-group-def.js.map +0 -1
  71. package/dist/browser/conditions/condition-group.js +0 -46
  72. package/dist/browser/conditions/condition-group.js.map +0 -1
  73. package/dist/browser/conditions/condition-model.js +0 -203
  74. package/dist/browser/conditions/condition-model.js.map +0 -1
  75. package/dist/browser/conditions/condition-operators.js +0 -111
  76. package/dist/browser/conditions/condition-operators.js.map +0 -1
  77. package/dist/browser/conditions/condition-ref.js +0 -33
  78. package/dist/browser/conditions/condition-ref.js.map +0 -1
  79. package/dist/browser/conditions/condition-value-abstract.js +0 -23
  80. package/dist/browser/conditions/condition-value-abstract.js.map +0 -1
  81. package/dist/browser/conditions/condition-value-registration.js +0 -18
  82. package/dist/browser/conditions/condition-value-registration.js.map +0 -1
  83. package/dist/browser/conditions/condition-values.js +0 -107
  84. package/dist/browser/conditions/condition-values.js.map +0 -1
  85. package/dist/browser/conditions/condition.js +0 -41
  86. package/dist/browser/conditions/condition.js.map +0 -1
  87. package/dist/browser/conditions/enums.js +0 -6
  88. package/dist/browser/conditions/enums.js.map +0 -1
  89. package/dist/browser/conditions/helpers.js +0 -7
  90. package/dist/browser/conditions/helpers.js.map +0 -1
  91. package/dist/browser/conditions/index.js +0 -11
  92. package/dist/browser/conditions/index.js.map +0 -1
  93. package/dist/browser/conditions/inline-condition-model.js +0 -396
  94. package/dist/browser/conditions/inline-condition-model.js.map +0 -1
  95. package/dist/browser/conditions/inline-condition-operators.js +0 -111
  96. package/dist/browser/conditions/inline-condition-operators.js.map +0 -1
  97. package/dist/browser/conditions/inline-condition-values.js +0 -137
  98. package/dist/browser/conditions/inline-condition-values.js.map +0 -1
  99. package/dist/browser/conditions/types.js +0 -2
  100. package/dist/browser/conditions/types.js.map +0 -1
  101. package/dist/browser/data-model/conditions-wrapper.js +0 -31
  102. package/dist/browser/data-model/conditions-wrapper.js.map +0 -1
  103. package/dist/browser/data-model/enums.js +0 -7
  104. package/dist/browser/data-model/enums.js.map +0 -1
  105. package/dist/browser/data-model/index.js +0 -4
  106. package/dist/browser/data-model/index.js.map +0 -1
  107. package/dist/browser/data-model/input-wrapper.js +0 -31
  108. package/dist/browser/data-model/input-wrapper.js.map +0 -1
  109. package/dist/browser/data-model/types.js +0 -9
  110. package/dist/browser/data-model/types.js.map +0 -1
  111. package/dist/browser/form/form-configuration.js +0 -19
  112. package/dist/browser/form/form-configuration.js.map +0 -1
  113. package/dist/browser/form/index.js +0 -2
  114. package/dist/browser/form/index.js.map +0 -1
  115. package/dist/browser/index.js +0 -9
  116. package/dist/browser/index.js.map +0 -1
  117. package/dist/browser/migration/index.js +0 -2
  118. package/dist/browser/migration/index.js.map +0 -1
  119. package/dist/browser/migration/migration.0-2.js +0 -47
  120. package/dist/browser/migration/migration.0-2.js.map +0 -1
  121. package/dist/browser/migration/migration.1-2.js +0 -92
  122. package/dist/browser/migration/migration.1-2.js.map +0 -1
  123. package/dist/browser/migration/types.js +0 -2
  124. package/dist/browser/migration/types.js.map +0 -1
  125. package/dist/browser/migration/whichMigrations.js +0 -22
  126. package/dist/browser/migration/whichMigrations.js.map +0 -1
  127. package/dist/browser/schema/index.js +0 -2
  128. package/dist/browser/schema/index.js.map +0 -1
  129. package/dist/browser/schema/schema.js +0 -237
  130. package/dist/browser/schema/schema.js.map +0 -1
  131. package/dist/browser/utils/helpers.js +0 -27
  132. package/dist/browser/utils/helpers.js.map +0 -1
  133. package/dist/browser/utils/logger.js +0 -27
  134. package/dist/browser/utils/logger.js.map +0 -1
@@ -1,41 +0,0 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
3
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
- import { ConditionField } from "./condition-field.js";
5
- import { ConditionAbstract } from "./condition-abstract.js";
6
- import { getExpression } from "./condition-operators.js";
7
- import { ConditionValueAbstract } from "./condition-value-abstract.js";
8
- export class Condition extends ConditionAbstract {
9
- constructor(field, operator, value, coordinator) {
10
- super(coordinator);
11
- _defineProperty(this, "field", void 0);
12
- _defineProperty(this, "operator", void 0);
13
- _defineProperty(this, "value", void 0);
14
- if (!(field instanceof ConditionField)) {
15
- throw Error(`field ${field} is not a valid ConditionField object`);
16
- }
17
- if (typeof operator !== 'string') {
18
- throw Error(`operator ${operator} is not a valid operator`);
19
- }
20
- if (!(value instanceof ConditionValueAbstract)) {
21
- throw Error(`value ${value} is not a valid value type`);
22
- }
23
- this.field = field;
24
- this.operator = operator;
25
- this.value = value;
26
- }
27
- asFirstCondition() {
28
- this._asFirstCondition();
29
- return this;
30
- }
31
- conditionString() {
32
- return `'${this.field.display}' ${this.operator} '${this.value.toPresentationString()}'`;
33
- }
34
- conditionExpression() {
35
- return getExpression(this.field.type, this.field.name, this.operator, this.value);
36
- }
37
- clone() {
38
- return new Condition(ConditionField.from(this.field), this.operator, this.value.clone(), this.coordinator);
39
- }
40
- }
41
- //# sourceMappingURL=condition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"condition.js","names":["ConditionField","ConditionAbstract","getExpression","ConditionValueAbstract","Condition","constructor","field","operator","value","coordinator","_defineProperty","Error","asFirstCondition","_asFirstCondition","conditionString","display","toPresentationString","conditionExpression","type","name","clone","from"],"sources":["../../../src/conditions/condition.ts"],"sourcesContent":["import { ConditionField } from '~/src/conditions/condition-field.js'\nimport { ConditionAbstract } from '~/src/conditions/condition-abstract.js'\nimport { getExpression } from '~/src/conditions/condition-operators.js'\nimport {\n ConditionValue,\n RelativeTimeValue\n} from '~/src/conditions/condition-values.js'\nimport { ConditionValueAbstract } from '~/src/conditions/condition-value-abstract.js'\nimport { Coordinator } from '~/src/conditions/enums.js'\n\nexport class Condition extends ConditionAbstract {\n field: ConditionField\n operator: string\n value: ConditionValue | RelativeTimeValue\n\n constructor(\n field: ConditionField,\n operator: string,\n value: ConditionValue | RelativeTimeValue,\n coordinator?: Coordinator\n ) {\n super(coordinator)\n\n if (!(field instanceof ConditionField)) {\n throw Error(`field ${field} is not a valid ConditionField object`)\n }\n if (typeof operator !== 'string') {\n throw Error(`operator ${operator} is not a valid operator`)\n }\n if (!(value instanceof ConditionValueAbstract)) {\n throw Error(`value ${value} is not a valid value type`)\n }\n\n this.field = field\n this.operator = operator\n this.value = value\n }\n\n asFirstCondition() {\n this._asFirstCondition()\n return this\n }\n\n conditionString() {\n return `'${this.field.display}' ${\n this.operator\n } '${this.value.toPresentationString()}'`\n }\n\n conditionExpression() {\n return getExpression(\n this.field.type,\n this.field.name,\n this.operator,\n this.value\n )\n }\n\n clone() {\n return new Condition(\n ConditionField.from(this.field),\n this.operator,\n this.value.clone(),\n this.coordinator\n )\n }\n}\n"],"mappings":";;;AAAA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAC1B,SAASC,aAAa;AAKtB,SAASC,sBAAsB;AAG/B,OAAO,MAAMC,SAAS,SAASH,iBAAiB,CAAC;EAK/CI,WAAWA,CACTC,KAAqB,EACrBC,QAAgB,EAChBC,KAAyC,EACzCC,WAAyB,EACzB;IACA,KAAK,CAACA,WAAW,CAAC;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAElB,IAAI,EAAEJ,KAAK,YAAYN,cAAc,CAAC,EAAE;MACtC,MAAMW,KAAK,CAAE,SAAQL,KAAM,uCAAsC,CAAC;IACpE;IACA,IAAI,OAAOC,QAAQ,KAAK,QAAQ,EAAE;MAChC,MAAMI,KAAK,CAAE,YAAWJ,QAAS,0BAAyB,CAAC;IAC7D;IACA,IAAI,EAAEC,KAAK,YAAYL,sBAAsB,CAAC,EAAE;MAC9C,MAAMQ,KAAK,CAAE,SAAQH,KAAM,4BAA2B,CAAC;IACzD;IAEA,IAAI,CAACF,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,KAAK,GAAGA,KAAK;EACpB;EAEAI,gBAAgBA,CAAA,EAAG;IACjB,IAAI,CAACC,iBAAiB,CAAC,CAAC;IACxB,OAAO,IAAI;EACb;EAEAC,eAAeA,CAAA,EAAG;IAChB,OAAQ,IAAG,IAAI,CAACR,KAAK,CAACS,OAAQ,KAC5B,IAAI,CAACR,QACN,KAAI,IAAI,CAACC,KAAK,CAACQ,oBAAoB,CAAC,CAAE,GAAE;EAC3C;EAEAC,mBAAmBA,CAAA,EAAG;IACpB,OAAOf,aAAa,CAClB,IAAI,CAACI,KAAK,CAACY,IAAI,EACf,IAAI,CAACZ,KAAK,CAACa,IAAI,EACf,IAAI,CAACZ,QAAQ,EACb,IAAI,CAACC,KACP,CAAC;EACH;EAEAY,KAAKA,CAAA,EAAG;IACN,OAAO,IAAIhB,SAAS,CAClBJ,cAAc,CAACqB,IAAI,CAAC,IAAI,CAACf,KAAK,CAAC,EAC/B,IAAI,CAACC,QAAQ,EACb,IAAI,CAACC,KAAK,CAACY,KAAK,CAAC,CAAC,EAClB,IAAI,CAACX,WACP,CAAC;EACH;AACF"}
@@ -1,6 +0,0 @@
1
- export let Coordinator = /*#__PURE__*/function (Coordinator) {
2
- Coordinator["AND"] = "and";
3
- Coordinator["OR"] = "or";
4
- return Coordinator;
5
- }({});
6
- //# sourceMappingURL=enums.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"enums.js","names":["Coordinator"],"sources":["../../../src/conditions/enums.ts"],"sourcesContent":["export enum Coordinator {\n AND = 'and',\n OR = 'or'\n}\n"],"mappings":"AAAA,WAAYA,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA"}
@@ -1,7 +0,0 @@
1
- export function toPresentationString(condition) {
2
- return `${condition.coordinatorString()}${condition.conditionString()}`;
3
- }
4
- export function toExpression(condition) {
5
- return `${condition.coordinatorString()}${condition.conditionExpression()}`;
6
- }
7
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","names":["toPresentationString","condition","coordinatorString","conditionString","toExpression","conditionExpression"],"sources":["../../../src/conditions/helpers.ts"],"sourcesContent":["export function toPresentationString(condition) {\n return `${condition.coordinatorString()}${condition.conditionString()}`\n}\n\nexport function toExpression(condition) {\n return `${condition.coordinatorString()}${condition.conditionExpression()}`\n}\n"],"mappings":"AAAA,OAAO,SAASA,oBAAoBA,CAACC,SAAS,EAAE;EAC9C,OAAQ,GAAEA,SAAS,CAACC,iBAAiB,CAAC,CAAE,GAAED,SAAS,CAACE,eAAe,CAAC,CAAE,EAAC;AACzE;AAEA,OAAO,SAASC,YAAYA,CAACH,SAAS,EAAE;EACtC,OAAQ,GAAEA,SAAS,CAACC,iBAAiB,CAAC,CAAE,GAAED,SAAS,CAACI,mBAAmB,CAAC,CAAE,EAAC;AAC7E"}
@@ -1,11 +0,0 @@
1
- export { getExpression, getOperatorConfig, getOperatorNames, absoluteDateOrTimeOperatorNames, relativeDateOrTimeOperatorNames } from "./condition-operators.js";
2
- export { timeUnits, dateUnits, dateTimeUnits, ConditionValue, DateDirections, RelativeTimeValue, conditionValueFrom } from "./condition-values.js";
3
- export { ConditionField } from "./condition-field.js";
4
- export { Condition } from "./condition.js";
5
- export { ConditionRef } from "./condition-ref.js";
6
- export { ConditionGroup } from "./condition-group.js";
7
- export { ConditionsModel } from "./condition-model.js";
8
- export { ConditionGroupDef } from "./condition-group-def.js";
9
- export { toExpression, toPresentationString } from "./helpers.js";
10
- export { Coordinator } from "./enums.js";
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["getExpression","getOperatorConfig","getOperatorNames","absoluteDateOrTimeOperatorNames","relativeDateOrTimeOperatorNames","timeUnits","dateUnits","dateTimeUnits","ConditionValue","DateDirections","RelativeTimeValue","conditionValueFrom","ConditionField","Condition","ConditionRef","ConditionGroup","ConditionsModel","ConditionGroupDef","toExpression","toPresentationString","Coordinator"],"sources":["../../../src/conditions/index.ts"],"sourcesContent":["export {\n getExpression,\n getOperatorConfig,\n getOperatorNames,\n absoluteDateOrTimeOperatorNames,\n relativeDateOrTimeOperatorNames\n} from '~/src/conditions/condition-operators.js'\n\nexport {\n timeUnits,\n dateUnits,\n dateTimeUnits,\n ConditionValue,\n DateDirections,\n RelativeTimeValue,\n conditionValueFrom\n} from '~/src/conditions/condition-values.js'\n\nexport { ConditionField } from '~/src/conditions/condition-field.js'\nexport { Condition } from '~/src/conditions/condition.js'\nexport { ConditionRef } from '~/src/conditions/condition-ref.js'\nexport { ConditionGroup } from '~/src/conditions/condition-group.js'\nexport { ConditionsModel } from '~/src/conditions/condition-model.js'\nexport { ConditionGroupDef } from '~/src/conditions/condition-group-def.js'\nexport { toExpression, toPresentationString } from '~/src/conditions/helpers.js'\n\nexport { Coordinator } from '~/src/conditions/enums.js'\n"],"mappings":"AAAA,SACEA,aAAa,EACbC,iBAAiB,EACjBC,gBAAgB,EAChBC,+BAA+B,EAC/BC,+BAA+B;AAGjC,SACEC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,cAAc,EACdC,cAAc,EACdC,iBAAiB,EACjBC,kBAAkB;AAGpB,SAASC,cAAc;AACvB,SAASC,SAAS;AAClB,SAASC,YAAY;AACrB,SAASC,cAAc;AACvB,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,YAAY,EAAEC,oBAAoB;AAE3C,SAASC,WAAW"}
@@ -1,396 +0,0 @@
1
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
3
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
5
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
6
- function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
7
- function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
8
- function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
9
- import { ComponentTypes } from "../components/component-types.js";
10
- import { getExpression } from "./inline-condition-operators.js";
11
- import { AbstractConditionValue, valueFrom } from "./inline-condition-values.js";
12
- export const coordinators = {
13
- AND: 'and',
14
- OR: 'or'
15
- };
16
- var _groupedConditions = /*#__PURE__*/new WeakMap();
17
- var _userGroupedConditions = /*#__PURE__*/new WeakMap();
18
- var _conditionName = /*#__PURE__*/new WeakMap();
19
- export class ConditionsModel {
20
- constructor() {
21
- _classPrivateFieldInitSpec(this, _groupedConditions, void 0);
22
- _classPrivateFieldInitSpec(this, _userGroupedConditions, void 0);
23
- _classPrivateFieldInitSpec(this, _conditionName, void 0);
24
- _classPrivateFieldSet(_groupedConditions, this, []);
25
- _classPrivateFieldSet(_userGroupedConditions, this, []);
26
- }
27
- clone() {
28
- const toReturn = new ConditionsModel();
29
- _classPrivateFieldSet(_groupedConditions, toReturn, _classPrivateFieldGet(_groupedConditions, this).map(it => it.clone()));
30
- _classPrivateFieldSet(_userGroupedConditions, toReturn, _classPrivateFieldGet(_userGroupedConditions, this).map(it => it.clone()));
31
- _classPrivateFieldSet(_conditionName, toReturn, _classPrivateFieldGet(_conditionName, this));
32
- return toReturn;
33
- }
34
- clear() {
35
- _classPrivateFieldSet(_userGroupedConditions, this, []);
36
- _classPrivateFieldSet(_groupedConditions, this, []);
37
- _classPrivateFieldSet(_conditionName, this, undefined);
38
- return this;
39
- }
40
- set name(name) {
41
- _classPrivateFieldSet(_conditionName, this, name);
42
- }
43
- get name() {
44
- return _classPrivateFieldGet(_conditionName, this);
45
- }
46
- add(condition) {
47
- const coordinatorExpected = _classPrivateFieldGet(_userGroupedConditions, this).length !== 0;
48
- if (condition.getCoordinator() && !coordinatorExpected) {
49
- throw Error('No coordinator allowed on the first condition');
50
- } else if (!condition.getCoordinator() && coordinatorExpected) {
51
- throw Error('Coordinator must be present on subsequent conditions');
52
- }
53
- _classPrivateFieldGet(_userGroupedConditions, this).push(condition);
54
- _classPrivateFieldSet(_groupedConditions, this, this._applyGroups(_classPrivateFieldGet(_userGroupedConditions, this)));
55
- return this;
56
- }
57
- replace(index, condition) {
58
- const coordinatorExpected = index !== 0;
59
- if (condition.getCoordinator() && !coordinatorExpected) {
60
- throw Error('No coordinator allowed on the first condition');
61
- } else if (!condition.getCoordinator() && coordinatorExpected) {
62
- throw Error('Coordinator must be present on subsequent conditions');
63
- } else if (index >= _classPrivateFieldGet(_userGroupedConditions, this).length) {
64
- throw Error(`Cannot replace condition ${index} as no such condition exists`);
65
- }
66
- _classPrivateFieldGet(_userGroupedConditions, this).splice(index, 1, condition);
67
- _classPrivateFieldSet(_groupedConditions, this, this._applyGroups(_classPrivateFieldGet(_userGroupedConditions, this)));
68
- return this;
69
- }
70
- remove(indexes) {
71
- _classPrivateFieldSet(_userGroupedConditions, this, _classPrivateFieldGet(_userGroupedConditions, this).filter((_condition, index) => !indexes.includes(index)).map((condition, index) => index === 0 ? condition.asFirstCondition() : condition));
72
- _classPrivateFieldSet(_groupedConditions, this, this._applyGroups(_classPrivateFieldGet(_userGroupedConditions, this)));
73
- return this;
74
- }
75
- addGroups(groupDefs) {
76
- _classPrivateFieldSet(_userGroupedConditions, this, this._group(_classPrivateFieldGet(_userGroupedConditions, this), groupDefs));
77
- _classPrivateFieldSet(_groupedConditions, this, this._applyGroups(_classPrivateFieldGet(_userGroupedConditions, this)));
78
- return this;
79
- }
80
- splitGroup(index) {
81
- _classPrivateFieldSet(_userGroupedConditions, this, this._ungroup(_classPrivateFieldGet(_userGroupedConditions, this), index));
82
- _classPrivateFieldSet(_groupedConditions, this, this._applyGroups(_classPrivateFieldGet(_userGroupedConditions, this)));
83
- return this;
84
- }
85
- moveEarlier(index) {
86
- if (index > 0 && index < _classPrivateFieldGet(_userGroupedConditions, this).length) {
87
- _classPrivateFieldGet(_userGroupedConditions, this).splice(index - 1, 0, _classPrivateFieldGet(_userGroupedConditions, this).splice(index, 1)[0]);
88
- if (index === 1) {
89
- this.switchCoordinators();
90
- }
91
- _classPrivateFieldSet(_groupedConditions, this, this._applyGroups(_classPrivateFieldGet(_userGroupedConditions, this)));
92
- }
93
- return this;
94
- }
95
- moveLater(index) {
96
- if (index >= 0 && index < _classPrivateFieldGet(_userGroupedConditions, this).length - 1) {
97
- _classPrivateFieldGet(_userGroupedConditions, this).splice(index + 1, 0, _classPrivateFieldGet(_userGroupedConditions, this).splice(index, 1)[0]);
98
- if (index === 0) {
99
- this.switchCoordinators();
100
- }
101
- _classPrivateFieldSet(_groupedConditions, this, this._applyGroups(_classPrivateFieldGet(_userGroupedConditions, this)));
102
- }
103
- return this;
104
- }
105
- switchCoordinators() {
106
- _classPrivateFieldGet(_userGroupedConditions, this)[1].setCoordinator(_classPrivateFieldGet(_userGroupedConditions, this)[0].getCoordinator());
107
- _classPrivateFieldGet(_userGroupedConditions, this)[0].setCoordinator(undefined);
108
- }
109
- get asPerUserGroupings() {
110
- return [..._classPrivateFieldGet(_userGroupedConditions, this)];
111
- }
112
- get hasConditions() {
113
- return _classPrivateFieldGet(_userGroupedConditions, this).length > 0;
114
- }
115
- get lastIndex() {
116
- return _classPrivateFieldGet(_userGroupedConditions, this).length - 1;
117
- }
118
- toPresentationString() {
119
- return _classPrivateFieldGet(_groupedConditions, this).map(condition => toPresentationString(condition)).join(' ');
120
- }
121
- toExpression() {
122
- return _classPrivateFieldGet(_groupedConditions, this).map(condition => toExpression(condition)).join(' ');
123
- }
124
- _applyGroups(userGroupedConditions) {
125
- const correctedUserGroups = userGroupedConditions.map(condition => condition instanceof ConditionGroup && condition.conditions.length > 2 ? new ConditionGroup(this._group(condition.conditions, this._autoGroupDefs(condition.conditions))) : condition);
126
- return this._group(correctedUserGroups, this._autoGroupDefs(correctedUserGroups));
127
- }
128
- _group(conditions, groupDefs) {
129
- return conditions.reduce((groups, condition, index, conditions) => {
130
- const groupDef = groupDefs.find(groupDef => groupDef.contains(index));
131
- if (groupDef) {
132
- if (groupDef.startsWith(index)) {
133
- const groupConditions = groupDef.applyTo(conditions);
134
- groups.push(new ConditionGroup(groupConditions));
135
- }
136
- } else {
137
- groups.push(condition);
138
- }
139
- return groups;
140
- }, []);
141
- }
142
- _ungroup(conditions, splitIndex) {
143
- if (conditions[splitIndex].isGroup()) {
144
- const copy = [...conditions];
145
- copy.splice(splitIndex, 1, ...conditions[splitIndex].getGroupedConditions());
146
- return copy;
147
- }
148
- return conditions;
149
- }
150
- _autoGroupDefs(conditions) {
151
- const orPositions = [];
152
- conditions.forEach((condition, index) => {
153
- if (condition.getCoordinator() === coordinators.OR) {
154
- orPositions.push(index);
155
- }
156
- });
157
- const hasAnd = !!conditions.find(condition => condition.getCoordinator() === coordinators.AND);
158
- const hasOr = orPositions.length > 0;
159
- if (hasAnd && hasOr) {
160
- let start = 0;
161
- const groupDefs = [];
162
- orPositions.forEach((position, index) => {
163
- if (start < position - 1) {
164
- groupDefs.push(new GroupDef(start, position - 1));
165
- }
166
- const thisIsTheLastOr = orPositions.length === index + 1;
167
- const thereAreMoreConditions = conditions.length - 1 > position;
168
- if (thisIsTheLastOr && thereAreMoreConditions) {
169
- groupDefs.push(new GroupDef(position, conditions.length - 1));
170
- }
171
- start = position;
172
- });
173
- return groupDefs;
174
- }
175
- return [];
176
- }
177
- toJSON() {
178
- const name = _classPrivateFieldGet(_conditionName, this);
179
- const conditions = _classPrivateFieldGet(_userGroupedConditions, this);
180
- return {
181
- name,
182
- conditions: conditions.map(it => it.clone())
183
- };
184
- }
185
- static from(obj) {
186
- if (obj instanceof ConditionsModel) {
187
- return obj;
188
- }
189
- const toReturn = new ConditionsModel();
190
- _classPrivateFieldSet(_conditionName, toReturn, obj.name);
191
- _classPrivateFieldSet(_userGroupedConditions, toReturn, obj.conditions.map(it => conditionFrom(it)));
192
- _classPrivateFieldSet(_groupedConditions, toReturn, toReturn._applyGroups(_classPrivateFieldGet(_userGroupedConditions, toReturn)));
193
- return toReturn;
194
- }
195
- }
196
- function conditionFrom(it) {
197
- if (it.conditions) {
198
- return new ConditionGroup(it.conditions.map(condition => conditionFrom(condition)));
199
- }
200
- if (it.conditionName) {
201
- return new ConditionRef(it.conditionName, it.conditionDisplayName, it.coordinator);
202
- }
203
- return new Condition(Field.from(it.field), it.operator, valueFrom(it.value), it.coordinator);
204
- }
205
- export class GroupDef {
206
- constructor(first, last) {
207
- _defineProperty(this, "first", void 0);
208
- _defineProperty(this, "last", void 0);
209
- if (typeof first !== 'number' || typeof last !== 'number') {
210
- throw Error(`Cannot construct a group from ${first} and ${last}`);
211
- } else if (first >= last) {
212
- throw Error(`Last (${last}) must be greater than first (${first})`);
213
- }
214
- this.first = first;
215
- this.last = last;
216
- }
217
- contains(index) {
218
- return this.first <= index && this.last >= index;
219
- }
220
- startsWith(index) {
221
- return this.first === index;
222
- }
223
- applyTo(conditions) {
224
- return [...conditions].splice(this.first, this.last - this.first + 1);
225
- }
226
- }
227
- class ConditionGroup {
228
- constructor(conditions) {
229
- _defineProperty(this, "conditions", void 0);
230
- if (!Array.isArray(conditions) || conditions.length < 2) {
231
- throw Error('Cannot construct a condition group from a single condition');
232
- }
233
- this.conditions = conditions;
234
- }
235
- coordinatorString() {
236
- return this.conditions[0].coordinatorString();
237
- }
238
- conditionString() {
239
- const copy = [...this.conditions];
240
- copy.splice(0, 1);
241
- return `(${this.conditions[0].conditionString()} ${copy.map(condition => toPresentationString(condition)).join(' ')})`;
242
- }
243
- conditionExpression() {
244
- const copy = [...this.conditions];
245
- copy.splice(0, 1);
246
- return `(${this.conditions[0].conditionExpression()} ${copy.map(condition => toExpression(condition)).join(' ')})`;
247
- }
248
- asFirstCondition() {
249
- this.conditions[0].asFirstCondition();
250
- return this;
251
- }
252
- getCoordinator() {
253
- return this.conditions[0].getCoordinator();
254
- }
255
- setCoordinator(coordinator) {
256
- this.conditions[0].setCoordinator(coordinator);
257
- }
258
- isGroup() {
259
- return true;
260
- }
261
- getGroupedConditions() {
262
- return this.conditions.map(condition => condition.clone());
263
- }
264
- clone() {
265
- return new ConditionGroup(this.conditions.map(condition => condition.clone()));
266
- }
267
- }
268
- export function toPresentationString(condition) {
269
- return `${condition.coordinatorString()}${condition.conditionString()}`;
270
- }
271
- export function toExpression(condition) {
272
- return `${condition.coordinatorString()}${condition.conditionExpression()}`;
273
- }
274
- export class Field {
275
- constructor(name, type, display) {
276
- _defineProperty(this, "name", void 0);
277
- _defineProperty(this, "type", void 0);
278
- _defineProperty(this, "display", void 0);
279
- if (!name || typeof name !== 'string') {
280
- throw Error(`name ${name} is not valid`);
281
- }
282
- if (!ComponentTypes.find(componentType => componentType.name === type)) {
283
- throw Error(`type ${type} is not valid`);
284
- }
285
- if (!display || typeof display !== 'string') {
286
- throw Error(`display ${display} is not valid`);
287
- }
288
- this.name = name;
289
- this.type = type;
290
- this.display = display;
291
- }
292
- static from(obj) {
293
- return new Field(obj.name, obj.type, obj.display);
294
- }
295
- }
296
- class AbstractCondition {
297
- constructor(coordinator) {
298
- _defineProperty(this, "coordinator", void 0);
299
- if (coordinator && !Object.values(coordinators).includes(coordinator)) {
300
- throw Error(`coordinator ${coordinator} is not a valid coordinator`);
301
- }
302
- this.coordinator = coordinator;
303
- }
304
- coordinatorString() {
305
- return this.coordinator ? `${this.coordinator} ` : '';
306
- }
307
- getCoordinator() {
308
- return this.coordinator;
309
- }
310
- setCoordinator(coordinator) {
311
- this.coordinator = coordinator;
312
- }
313
- isGroup() {
314
- return false;
315
- }
316
- getGroupedConditions() {
317
- return [this];
318
- }
319
- _asFirstCondition() {
320
- delete this.coordinator;
321
- }
322
- asFirstCondition() {
323
- throw Error('Implement on the subclass (Why do we have to have this method here at all?!)');
324
- }
325
- clone() {
326
- throw Error('Implement on the subclass (Why do we have to have this method here at all?!)');
327
- }
328
- conditionString() {
329
- throw Error('Implement on the subclass (Why do we have to have this method here at all?!)');
330
- }
331
- conditionExpression() {
332
- throw Error('Implement on the subclass (Why do we have to have this method here at all?!)');
333
- }
334
- }
335
- export class Condition extends AbstractCondition {
336
- constructor(field, operator, value, coordinator) {
337
- super(coordinator);
338
- _defineProperty(this, "field", void 0);
339
- _defineProperty(this, "operator", void 0);
340
- _defineProperty(this, "value", void 0);
341
- if (!(field instanceof Field)) {
342
- throw Error(`field ${field} is not a valid Field object`);
343
- }
344
- if (typeof operator !== 'string') {
345
- throw Error(`operator ${operator} is not a valid operator`);
346
- }
347
- if (!(value instanceof AbstractConditionValue)) {
348
- throw Error(`value ${value} is not a valid value type`);
349
- }
350
- this.field = field;
351
- this.operator = operator;
352
- this.value = value;
353
- }
354
- asFirstCondition() {
355
- this._asFirstCondition();
356
- return this;
357
- }
358
- conditionString() {
359
- return `'${this.field.display}' ${this.operator} '${this.value.toPresentationString()}'`;
360
- }
361
- conditionExpression() {
362
- return getExpression(this.field.type, this.field.name, this.operator, this.value);
363
- }
364
- clone() {
365
- return new Condition(Field.from(this.field), this.operator, this.value.clone(), this.coordinator);
366
- }
367
- }
368
- export class ConditionRef extends AbstractCondition {
369
- constructor(conditionName, conditionDisplayName, coordinator) {
370
- super(coordinator);
371
- _defineProperty(this, "conditionName", void 0);
372
- _defineProperty(this, "conditionDisplayName", void 0);
373
- if (typeof conditionName !== 'string') {
374
- throw Error(`condition name ${conditionName} is not valid`);
375
- }
376
- if (typeof conditionDisplayName !== 'string') {
377
- throw Error(`condition display name ${conditionDisplayName} is not valid`);
378
- }
379
- this.conditionName = conditionName;
380
- this.conditionDisplayName = conditionDisplayName;
381
- }
382
- asFirstCondition() {
383
- this._asFirstCondition();
384
- return this;
385
- }
386
- conditionString() {
387
- return `'${this.conditionDisplayName}'`;
388
- }
389
- conditionExpression() {
390
- return this.conditionName;
391
- }
392
- clone() {
393
- return new ConditionRef(this.conditionName, this.conditionDisplayName, this.coordinator);
394
- }
395
- }
396
- //# sourceMappingURL=inline-condition-model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inline-condition-model.js","names":["ComponentTypes","getExpression","AbstractConditionValue","valueFrom","coordinators","AND","OR","_groupedConditions","WeakMap","_userGroupedConditions","_conditionName","ConditionsModel","constructor","_classPrivateFieldInitSpec","_classPrivateFieldSet","clone","toReturn","_classPrivateFieldGet","map","it","clear","undefined","name","add","condition","coordinatorExpected","length","getCoordinator","Error","push","_applyGroups","replace","index","splice","remove","indexes","filter","_condition","includes","asFirstCondition","addGroups","groupDefs","_group","splitGroup","_ungroup","moveEarlier","switchCoordinators","moveLater","setCoordinator","asPerUserGroupings","hasConditions","lastIndex","toPresentationString","join","toExpression","userGroupedConditions","correctedUserGroups","ConditionGroup","conditions","_autoGroupDefs","reduce","groups","groupDef","find","contains","startsWith","groupConditions","applyTo","splitIndex","isGroup","copy","getGroupedConditions","orPositions","forEach","hasAnd","hasOr","start","position","GroupDef","thisIsTheLastOr","thereAreMoreConditions","toJSON","from","obj","conditionFrom","conditionName","ConditionRef","conditionDisplayName","coordinator","Condition","Field","field","operator","value","first","last","_defineProperty","Array","isArray","coordinatorString","conditionString","conditionExpression","type","display","componentType","AbstractCondition","Object","values","_asFirstCondition"],"sources":["../../../src/conditions/inline-condition-model.ts"],"sourcesContent":["import { ComponentTypes } from '~/src/components/component-types.js'\nimport { getExpression } from '~/src/conditions/inline-condition-operators.js'\nimport {\n AbstractConditionValue,\n valueFrom\n} from '~/src/conditions/inline-condition-values.js'\n\nexport const coordinators = {\n AND: 'and',\n OR: 'or'\n}\n\nexport class ConditionsModel {\n #groupedConditions\n #userGroupedConditions\n #conditionName\n\n constructor() {\n this.#groupedConditions = []\n this.#userGroupedConditions = []\n }\n\n clone() {\n const toReturn = new ConditionsModel()\n toReturn.#groupedConditions = this.#groupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#userGroupedConditions = this.#userGroupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#conditionName = this.#conditionName\n return toReturn\n }\n\n clear() {\n this.#userGroupedConditions = []\n this.#groupedConditions = []\n this.#conditionName = undefined\n return this\n }\n\n set name(name) {\n this.#conditionName = name\n }\n\n get name() {\n return this.#conditionName\n }\n\n add(condition) {\n const coordinatorExpected = this.#userGroupedConditions.length !== 0\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n }\n this.#userGroupedConditions.push(condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n replace(index, condition) {\n const coordinatorExpected = index !== 0\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n } else if (index >= this.#userGroupedConditions.length) {\n throw Error(\n `Cannot replace condition ${index} as no such condition exists`\n )\n }\n this.#userGroupedConditions.splice(index, 1, condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n remove(indexes) {\n this.#userGroupedConditions = this.#userGroupedConditions\n .filter((_condition, index) => !indexes.includes(index))\n .map((condition, index) =>\n index === 0 ? condition.asFirstCondition() : condition\n )\n\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n addGroups(groupDefs) {\n this.#userGroupedConditions = this._group(\n this.#userGroupedConditions,\n groupDefs\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n splitGroup(index) {\n this.#userGroupedConditions = this._ungroup(\n this.#userGroupedConditions,\n index\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n moveEarlier(index) {\n if (index > 0 && index < this.#userGroupedConditions.length) {\n this.#userGroupedConditions.splice(\n index - 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 1) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n moveLater(index) {\n if (index >= 0 && index < this.#userGroupedConditions.length - 1) {\n this.#userGroupedConditions.splice(\n index + 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 0) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n switchCoordinators() {\n this.#userGroupedConditions[1].setCoordinator(\n this.#userGroupedConditions[0].getCoordinator()\n )\n this.#userGroupedConditions[0].setCoordinator(undefined)\n }\n\n get asPerUserGroupings() {\n return [...this.#userGroupedConditions]\n }\n\n get hasConditions() {\n return this.#userGroupedConditions.length > 0\n }\n\n get lastIndex() {\n return this.#userGroupedConditions.length - 1\n }\n\n toPresentationString() {\n return this.#groupedConditions\n .map((condition) => toPresentationString(condition))\n .join(' ')\n }\n\n toExpression() {\n return this.#groupedConditions\n .map((condition) => toExpression(condition))\n .join(' ')\n }\n\n _applyGroups(userGroupedConditions) {\n const correctedUserGroups = userGroupedConditions.map((condition) =>\n condition instanceof ConditionGroup && condition.conditions.length > 2\n ? new ConditionGroup(\n this._group(\n condition.conditions,\n this._autoGroupDefs(condition.conditions)\n )\n )\n : condition\n )\n return this._group(\n correctedUserGroups,\n this._autoGroupDefs(correctedUserGroups)\n )\n }\n\n _group(conditions, groupDefs) {\n return conditions.reduce((groups, condition, index, conditions) => {\n const groupDef = groupDefs.find((groupDef) => groupDef.contains(index))\n if (groupDef) {\n if (groupDef.startsWith(index)) {\n const groupConditions = groupDef.applyTo(conditions)\n groups.push(new ConditionGroup(groupConditions))\n }\n } else {\n groups.push(condition)\n }\n return groups\n }, [])\n }\n\n _ungroup(conditions, splitIndex) {\n if (conditions[splitIndex].isGroup()) {\n const copy = [...conditions]\n copy.splice(\n splitIndex,\n 1,\n ...conditions[splitIndex].getGroupedConditions()\n )\n return copy\n }\n return conditions\n }\n\n _autoGroupDefs(conditions) {\n const orPositions: number[] = []\n conditions.forEach((condition, index) => {\n if (condition.getCoordinator() === coordinators.OR) {\n orPositions.push(index)\n }\n })\n const hasAnd = !!conditions.find(\n (condition) => condition.getCoordinator() === coordinators.AND\n )\n const hasOr = orPositions.length > 0\n if (hasAnd && hasOr) {\n let start = 0\n const groupDefs: GroupDef[] = []\n orPositions.forEach((position, index) => {\n if (start < position - 1) {\n groupDefs.push(new GroupDef(start, position - 1))\n }\n const thisIsTheLastOr = orPositions.length === index + 1\n const thereAreMoreConditions = conditions.length - 1 > position\n if (thisIsTheLastOr && thereAreMoreConditions) {\n groupDefs.push(new GroupDef(position, conditions.length - 1))\n }\n start = position\n })\n return groupDefs\n }\n return []\n }\n\n toJSON() {\n const name = this.#conditionName\n const conditions = this.#userGroupedConditions\n return {\n name,\n conditions: conditions.map((it) => it.clone())\n }\n }\n\n static from(obj) {\n if (obj instanceof ConditionsModel) {\n return obj\n }\n const toReturn = new ConditionsModel()\n toReturn.#conditionName = obj.name\n toReturn.#userGroupedConditions = obj.conditions.map((it) =>\n conditionFrom(it)\n )\n toReturn.#groupedConditions = toReturn._applyGroups(\n toReturn.#userGroupedConditions\n )\n return toReturn\n }\n}\n\nfunction conditionFrom(it) {\n if (it.conditions) {\n return new ConditionGroup(\n it.conditions.map((condition) => conditionFrom(condition))\n )\n }\n if (it.conditionName) {\n return new ConditionRef(\n it.conditionName,\n it.conditionDisplayName,\n it.coordinator\n )\n }\n return new Condition(\n Field.from(it.field),\n it.operator,\n valueFrom(it.value),\n it.coordinator\n )\n}\n\nexport class GroupDef {\n first\n last\n\n constructor(first, last) {\n if (typeof first !== 'number' || typeof last !== 'number') {\n throw Error(`Cannot construct a group from ${first} and ${last}`)\n } else if (first >= last) {\n throw Error(`Last (${last}) must be greater than first (${first})`)\n }\n this.first = first\n this.last = last\n }\n\n contains(index) {\n return this.first <= index && this.last >= index\n }\n\n startsWith(index) {\n return this.first === index\n }\n\n applyTo(conditions) {\n return [...conditions].splice(this.first, this.last - this.first + 1)\n }\n}\n\nclass ConditionGroup {\n conditions\n\n constructor(conditions) {\n if (!Array.isArray(conditions) || conditions.length < 2) {\n throw Error('Cannot construct a condition group from a single condition')\n }\n this.conditions = conditions\n }\n\n coordinatorString() {\n return this.conditions[0].coordinatorString()\n }\n\n conditionString() {\n const copy = [...this.conditions]\n copy.splice(0, 1)\n return `(${this.conditions[0].conditionString()} ${copy\n .map((condition) => toPresentationString(condition))\n .join(' ')})`\n }\n\n conditionExpression() {\n const copy = [...this.conditions]\n copy.splice(0, 1)\n return `(${this.conditions[0].conditionExpression()} ${copy\n .map((condition) => toExpression(condition))\n .join(' ')})`\n }\n\n asFirstCondition() {\n this.conditions[0].asFirstCondition()\n return this\n }\n\n getCoordinator() {\n return this.conditions[0].getCoordinator()\n }\n\n setCoordinator(coordinator) {\n this.conditions[0].setCoordinator(coordinator)\n }\n\n isGroup() {\n return true\n }\n\n getGroupedConditions() {\n return this.conditions.map((condition) => condition.clone())\n }\n\n clone() {\n return new ConditionGroup(\n this.conditions.map((condition) => condition.clone())\n )\n }\n}\n\nexport function toPresentationString(condition) {\n return `${condition.coordinatorString()}${condition.conditionString()}`\n}\n\nexport function toExpression(condition) {\n return `${condition.coordinatorString()}${condition.conditionExpression()}`\n}\n\nexport class Field {\n name\n type\n display\n\n constructor(name, type, display) {\n if (!name || typeof name !== 'string') {\n throw Error(`name ${name} is not valid`)\n }\n if (!ComponentTypes.find((componentType) => componentType.name === type)) {\n throw Error(`type ${type} is not valid`)\n }\n if (!display || typeof display !== 'string') {\n throw Error(`display ${display} is not valid`)\n }\n this.name = name\n this.type = type\n this.display = display\n }\n\n static from(obj) {\n return new Field(obj.name, obj.type, obj.display)\n }\n}\n\nclass AbstractCondition {\n coordinator\n\n constructor(coordinator) {\n if (coordinator && !Object.values(coordinators).includes(coordinator)) {\n throw Error(`coordinator ${coordinator} is not a valid coordinator`)\n }\n this.coordinator = coordinator\n }\n\n coordinatorString() {\n return this.coordinator ? `${this.coordinator} ` : ''\n }\n\n getCoordinator() {\n return this.coordinator\n }\n\n setCoordinator(coordinator) {\n this.coordinator = coordinator\n }\n\n isGroup() {\n return false\n }\n\n getGroupedConditions() {\n return [this]\n }\n\n _asFirstCondition() {\n delete this.coordinator\n }\n\n asFirstCondition() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n\n clone() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n\n conditionString() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n\n conditionExpression() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n}\n\nexport class Condition extends AbstractCondition {\n field\n operator\n value\n\n constructor(field, operator, value, coordinator) {\n super(coordinator)\n if (!(field instanceof Field)) {\n throw Error(`field ${field} is not a valid Field object`)\n }\n if (typeof operator !== 'string') {\n throw Error(`operator ${operator} is not a valid operator`)\n }\n if (!(value instanceof AbstractConditionValue)) {\n throw Error(`value ${value} is not a valid value type`)\n }\n this.field = field\n this.operator = operator\n this.value = value\n }\n\n asFirstCondition() {\n this._asFirstCondition()\n return this\n }\n\n conditionString() {\n return `'${this.field.display}' ${\n this.operator\n } '${this.value.toPresentationString()}'`\n }\n\n conditionExpression() {\n return getExpression(\n this.field.type,\n this.field.name,\n this.operator,\n this.value\n )\n }\n\n clone() {\n return new Condition(\n Field.from(this.field),\n this.operator,\n this.value.clone(),\n this.coordinator\n )\n }\n}\n\nexport class ConditionRef extends AbstractCondition {\n conditionName\n conditionDisplayName\n\n constructor(conditionName, conditionDisplayName, coordinator) {\n super(coordinator)\n if (typeof conditionName !== 'string') {\n throw Error(`condition name ${conditionName} is not valid`)\n }\n if (typeof conditionDisplayName !== 'string') {\n throw Error(`condition display name ${conditionDisplayName} is not valid`)\n }\n this.conditionName = conditionName\n this.conditionDisplayName = conditionDisplayName\n }\n\n asFirstCondition() {\n this._asFirstCondition()\n return this\n }\n\n conditionString() {\n return `'${this.conditionDisplayName}'`\n }\n\n conditionExpression() {\n return this.conditionName\n }\n\n clone() {\n return new ConditionRef(\n this.conditionName,\n this.conditionDisplayName,\n this.coordinator\n )\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAASA,cAAc;AACvB,SAASC,aAAa;AACtB,SACEC,sBAAsB,EACtBC,SAAS;AAGX,OAAO,MAAMC,YAAY,GAAG;EAC1BC,GAAG,EAAE,KAAK;EACVC,EAAE,EAAE;AACN,CAAC;AAAA,IAAAC,kBAAA,oBAAAC,OAAA;AAAA,IAAAC,sBAAA,oBAAAD,OAAA;AAAA,IAAAE,cAAA,oBAAAF,OAAA;AAED,OAAO,MAAMG,eAAe,CAAC;EAK3BC,WAAWA,CAAA,EAAG;IAAAC,0BAAA,OAAAN,kBAAA;IAAAM,0BAAA,OAAAJ,sBAAA;IAAAI,0BAAA,OAAAH,cAAA;IACZI,qBAAA,CAAAP,kBAAA,MAAI,EAAsB,EAAE;IAC5BO,qBAAA,CAAAL,sBAAA,MAAI,EAA0B,EAAE;EAClC;EAEAM,KAAKA,CAAA,EAAG;IACN,MAAMC,QAAQ,GAAG,IAAIL,eAAe,CAAC,CAAC;IACtCG,qBAAA,CAAAP,kBAAA,EAAAS,QAAQ,EAAsBC,qBAAA,CAAAV,kBAAA,MAAI,EAAoBW,GAAG,CAAEC,EAAE,IAC3DA,EAAE,CAACJ,KAAK,CAAC,CACX,CAAC;IACDD,qBAAA,CAAAL,sBAAA,EAAAO,QAAQ,EAA0BC,qBAAA,CAAAR,sBAAA,MAAI,EAAwBS,GAAG,CAAEC,EAAE,IACnEA,EAAE,CAACJ,KAAK,CAAC,CACX,CAAC;IACDD,qBAAA,CAAAJ,cAAA,EAAAM,QAAQ,EAAAC,qBAAA,CAAAP,cAAA,EAAkB,IAAI;IAC9B,OAAOM,QAAQ;EACj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