@defra/forms-model 3.0.9 → 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.
- package/dist/browser/components/component-types.js +201 -219
- package/dist/browser/components/component-types.js.map +1 -1
- package/dist/browser/components/conditional-component-types.js +9 -27
- package/dist/browser/components/conditional-component-types.js.map +1 -1
- package/dist/browser/components/enums.js +27 -45
- package/dist/browser/components/enums.js.map +1 -1
- package/dist/browser/components/index.js +3 -35
- package/dist/browser/components/index.js.map +1 -1
- package/dist/browser/components/types.js +1 -15
- package/dist/browser/conditions/condition-abstract.js +42 -60
- package/dist/browser/conditions/condition-abstract.js.map +1 -1
- package/dist/browser/conditions/condition-field.js +23 -41
- package/dist/browser/conditions/condition-field.js.map +1 -1
- package/dist/browser/conditions/condition-group-def.js +23 -42
- package/dist/browser/conditions/condition-group-def.js.map +1 -1
- package/dist/browser/conditions/condition-group.js +43 -61
- package/dist/browser/conditions/condition-group.js.map +1 -1
- package/dist/browser/conditions/condition-model.js +185 -196
- package/dist/browser/conditions/condition-model.js.map +1 -1
- package/dist/browser/conditions/condition-operators.js +103 -124
- package/dist/browser/conditions/condition-operators.js.map +1 -1
- package/dist/browser/conditions/condition-ref.js +29 -47
- package/dist/browser/conditions/condition-ref.js.map +1 -1
- package/dist/browser/conditions/condition-value-abstract.js +19 -37
- package/dist/browser/conditions/condition-value-abstract.js.map +1 -1
- package/dist/browser/conditions/condition-value-registration.js +15 -34
- package/dist/browser/conditions/condition-value-registration.js.map +1 -1
- package/dist/browser/conditions/condition-values.js +98 -118
- package/dist/browser/conditions/condition-values.js.map +1 -1
- package/dist/browser/conditions/condition.js +36 -51
- package/dist/browser/conditions/condition.js.map +1 -1
- package/dist/browser/conditions/enums.js +5 -23
- package/dist/browser/conditions/enums.js.map +1 -1
- package/dist/browser/conditions/helpers.js +6 -25
- package/dist/browser/conditions/helpers.js.map +1 -1
- package/dist/browser/conditions/index.js +10 -143
- package/dist/browser/conditions/index.js.map +1 -1
- package/dist/browser/conditions/inline-condition-model.js +372 -394
- package/dist/browser/conditions/inline-condition-model.js.map +1 -1
- package/dist/browser/conditions/inline-condition-operators.js +103 -124
- package/dist/browser/conditions/inline-condition-operators.js.map +1 -1
- package/dist/browser/conditions/inline-condition-values.js +123 -145
- package/dist/browser/conditions/inline-condition-values.js.map +1 -1
- package/dist/browser/conditions/types.js +1 -15
- package/dist/browser/conditions/types.js.map +1 -1
- package/dist/browser/data-model/conditions-wrapper.js +27 -45
- package/dist/browser/data-model/conditions-wrapper.js.map +1 -1
- package/dist/browser/data-model/enums.js +6 -24
- package/dist/browser/data-model/enums.js.map +1 -1
- package/dist/browser/data-model/index.js +3 -35
- package/dist/browser/data-model/index.js.map +1 -1
- package/dist/browser/data-model/input-wrapper.js +28 -46
- package/dist/browser/data-model/input-wrapper.js.map +1 -1
- package/dist/browser/data-model/types.js +7 -25
- package/dist/browser/data-model/types.js.map +1 -1
- package/dist/browser/form/form-configuration.js +16 -35
- package/dist/browser/form/form-configuration.js.map +1 -1
- package/dist/browser/form/index.js +1 -23
- package/dist/browser/form/index.js.map +1 -1
- package/dist/browser/index.js +8 -97
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/migration/index.js +1 -23
- package/dist/browser/migration/index.js.map +1 -1
- package/dist/browser/migration/migration.0-2.js +42 -60
- package/dist/browser/migration/migration.0-2.js.map +1 -1
- package/dist/browser/migration/migration.1-2.js +83 -99
- package/dist/browser/migration/migration.1-2.js.map +1 -1
- package/dist/browser/migration/types.js +1 -15
- package/dist/browser/migration/whichMigrations.js +20 -36
- package/dist/browser/migration/whichMigrations.js.map +1 -1
- package/dist/browser/schema/index.js +1 -29
- package/dist/browser/schema/index.js.map +1 -1
- package/dist/browser/schema/schema.js +231 -249
- package/dist/browser/schema/schema.js.map +1 -1
- package/dist/browser/utils/helpers.js +22 -43
- package/dist/browser/utils/helpers.js.map +1 -1
- package/dist/browser/utils/logger.js +24 -43
- package/dist/browser/utils/logger.js.map +1 -1
- package/dist/module/components/component-types.js +1 -5
- package/dist/module/components/component-types.js.map +1 -1
- package/dist/module/components/conditional-component-types.js +1 -5
- package/dist/module/components/conditional-component-types.js.map +1 -1
- package/dist/module/components/enums.js +1 -5
- package/dist/module/components/enums.js.map +1 -1
- package/dist/module/components/index.js +3 -24
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/types.js +2 -1
- package/dist/module/conditions/condition-abstract.js +3 -8
- package/dist/module/conditions/condition-abstract.js.map +1 -1
- package/dist/module/conditions/condition-field.js +3 -8
- package/dist/module/conditions/condition-field.js.map +1 -1
- package/dist/module/conditions/condition-group-def.js +1 -6
- package/dist/module/conditions/condition-group-def.js.map +1 -1
- package/dist/module/conditions/condition-group.js +4 -9
- package/dist/module/conditions/condition-group.js.map +1 -1
- package/dist/module/conditions/condition-model.js +20 -25
- package/dist/module/conditions/condition-model.js.map +1 -1
- package/dist/module/conditions/condition-operators.js +15 -23
- package/dist/module/conditions/condition-operators.js.map +1 -1
- package/dist/module/conditions/condition-ref.js +2 -7
- package/dist/module/conditions/condition-ref.js.map +1 -1
- package/dist/module/conditions/condition-value-abstract.js +3 -8
- package/dist/module/conditions/condition-value-abstract.js.map +1 -1
- package/dist/module/conditions/condition-value-registration.js +1 -6
- package/dist/module/conditions/condition-value-registration.js.map +1 -1
- package/dist/module/conditions/condition-values.js +12 -20
- package/dist/module/conditions/condition-values.js.map +1 -1
- package/dist/module/conditions/condition.js +9 -14
- package/dist/module/conditions/condition.js.map +1 -1
- package/dist/module/conditions/enums.js +1 -5
- package/dist/module/conditions/enums.js.map +1 -1
- package/dist/module/conditions/helpers.js +2 -7
- package/dist/module/conditions/helpers.js.map +1 -1
- package/dist/module/conditions/index.js +10 -139
- package/dist/module/conditions/index.js.map +1 -1
- package/dist/module/conditions/inline-condition-model.js +15 -26
- package/dist/module/conditions/inline-condition-model.js.map +1 -1
- package/dist/module/conditions/inline-condition-operators.js +15 -23
- package/dist/module/conditions/inline-condition-operators.js.map +1 -1
- package/dist/module/conditions/inline-condition-values.js +9 -17
- package/dist/module/conditions/inline-condition-values.js.map +1 -1
- package/dist/module/conditions/types.js +2 -1
- package/dist/module/conditions/types.js.map +1 -1
- package/dist/module/data-model/conditions-wrapper.js +3 -8
- package/dist/module/data-model/conditions-wrapper.js.map +1 -1
- package/dist/module/data-model/enums.js +1 -5
- package/dist/module/data-model/enums.js.map +1 -1
- package/dist/module/data-model/index.js +3 -24
- package/dist/module/data-model/index.js.map +1 -1
- package/dist/module/data-model/input-wrapper.js +3 -8
- package/dist/module/data-model/input-wrapper.js.map +1 -1
- package/dist/module/data-model/types.js +1 -5
- package/dist/module/data-model/types.js.map +1 -1
- package/dist/module/form/form-configuration.js +1 -6
- package/dist/module/form/form-configuration.js.map +1 -1
- package/dist/module/form/index.js +1 -10
- package/dist/module/form/index.js.map +1 -1
- package/dist/module/index.js +8 -91
- package/dist/module/index.js.map +1 -1
- package/dist/module/migration/index.js +1 -10
- package/dist/module/migration/index.js.map +1 -1
- package/dist/module/migration/migration.0-2.js +1 -5
- package/dist/module/migration/migration.0-2.js.map +1 -1
- package/dist/module/migration/migration.1-2.js +3 -6
- package/dist/module/migration/migration.1-2.js.map +1 -1
- package/dist/module/migration/types.js +2 -1
- package/dist/module/migration/whichMigrations.js +5 -9
- package/dist/module/migration/whichMigrations.js.map +1 -1
- package/dist/module/schema/index.js +1 -16
- package/dist/module/schema/index.js.map +1 -1
- package/dist/module/schema/schema.js +163 -167
- package/dist/module/schema/schema.js.map +1 -1
- package/dist/module/utils/helpers.js +5 -13
- package/dist/module/utils/helpers.js.map +1 -1
- package/dist/module/utils/logger.js +1 -6
- package/dist/module/utils/logger.js.map +1 -1
- package/dist/types/components/component-types.d.ts +1 -1
- package/dist/types/components/component-types.d.ts.map +1 -1
- package/dist/types/components/conditional-component-types.d.ts +1 -1
- package/dist/types/components/conditional-component-types.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +3 -3
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/conditions/condition-abstract.d.ts +1 -1
- package/dist/types/conditions/condition-abstract.d.ts.map +1 -1
- package/dist/types/conditions/condition-field.d.ts +1 -1
- package/dist/types/conditions/condition-field.d.ts.map +1 -1
- package/dist/types/conditions/condition-group-def.d.ts +2 -2
- package/dist/types/conditions/condition-group-def.d.ts.map +1 -1
- package/dist/types/conditions/condition-group.d.ts +2 -2
- package/dist/types/conditions/condition-group.d.ts.map +1 -1
- package/dist/types/conditions/condition-model.d.ts +5 -5
- package/dist/types/conditions/condition-model.d.ts.map +1 -1
- package/dist/types/conditions/condition-operators.d.ts +2 -2
- package/dist/types/conditions/condition-operators.d.ts.map +1 -1
- package/dist/types/conditions/condition-ref.d.ts +2 -2
- package/dist/types/conditions/condition-ref.d.ts.map +1 -1
- package/dist/types/conditions/condition-value-abstract.d.ts +1 -1
- package/dist/types/conditions/condition-value-abstract.d.ts.map +1 -1
- package/dist/types/conditions/condition-values.d.ts +3 -3
- package/dist/types/conditions/condition-values.d.ts.map +1 -1
- package/dist/types/conditions/condition.d.ts +4 -4
- package/dist/types/conditions/condition.d.ts.map +1 -1
- package/dist/types/conditions/index.d.ts +10 -10
- package/dist/types/conditions/index.d.ts.map +1 -1
- package/dist/types/conditions/types.d.ts +3 -3
- package/dist/types/conditions/types.d.ts.map +1 -1
- package/dist/types/data-model/conditions-wrapper.d.ts +1 -1
- package/dist/types/data-model/conditions-wrapper.d.ts.map +1 -1
- package/dist/types/data-model/index.d.ts +3 -3
- package/dist/types/data-model/index.d.ts.map +1 -1
- package/dist/types/data-model/input-wrapper.d.ts +2 -2
- package/dist/types/data-model/input-wrapper.d.ts.map +1 -1
- package/dist/types/data-model/types.d.ts +3 -3
- package/dist/types/data-model/types.d.ts.map +1 -1
- package/dist/types/form/index.d.ts +1 -1
- package/dist/types/form/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +11 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/migration/index.d.ts +1 -1
- package/dist/types/migration/index.d.ts.map +1 -1
- package/dist/types/migration/migration.0-2.d.ts +1 -1
- package/dist/types/migration/migration.0-2.d.ts.map +1 -1
- package/dist/types/migration/migration.1-2.d.ts +1 -1
- package/dist/types/migration/migration.1-2.d.ts.map +1 -1
- package/dist/types/migration/whichMigrations.d.ts +1 -1
- package/dist/types/migration/whichMigrations.d.ts.map +1 -1
- package/dist/types/schema/index.d.ts +1 -1
- package/dist/types/schema/index.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/components/component-types.ts +1 -1
- package/src/components/conditional-component-types.ts +1 -1
- package/src/components/index.ts +3 -3
- package/src/conditions/condition-abstract.ts +1 -1
- package/src/conditions/condition-field.ts +2 -2
- package/src/conditions/condition-group-def.ts +1 -1
- package/src/conditions/condition-group.ts +3 -3
- package/src/conditions/condition-model.ts +9 -9
- package/src/conditions/condition-operators.ts +6 -3
- package/src/conditions/condition-ref.ts +2 -2
- package/src/conditions/condition-value-abstract.ts +1 -1
- package/src/conditions/condition-values.ts +3 -3
- package/src/conditions/condition.ts +6 -6
- package/src/conditions/index.ts +10 -10
- package/src/conditions/inline-condition-model.ts +3 -3
- package/src/conditions/inline-condition-operators.ts +1 -1
- package/src/conditions/types.ts +3 -3
- package/src/data-model/conditions-wrapper.ts +2 -2
- package/src/data-model/index.ts +3 -3
- package/src/data-model/input-wrapper.ts +3 -3
- package/src/data-model/types.ts +3 -3
- package/src/form/index.ts +1 -1
- package/src/index.ts +11 -11
- package/src/migration/index.ts +1 -1
- package/src/migration/migration.0-2.ts +1 -1
- package/src/migration/migration.1-2.ts +2 -2
- package/src/migration/whichMigrations.ts +3 -3
- 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
|
-
|
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 =
|
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 =
|
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 =
|
87
|
-
const relativeTimeValueType =
|
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","
|
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":"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"}
|
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
export {};
|
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
|
-
|
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
|
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":["
|
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
|
-
|
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"
|
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
|
-
|
2
|
-
|
3
|
-
|
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":["
|
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
|
-
|
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 =
|
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":["
|
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
|
-
|
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":"
|
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
|
-
|
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"
|
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
|
-
|
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":["
|
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"}
|
package/dist/module/index.js
CHANGED
@@ -1,92 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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
|
package/dist/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
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
|
-
|
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":["
|
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":"
|
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
|
-
|
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 :
|
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":["
|
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 +1,2 @@
|
|
1
|
-
|
1
|
+
export {};
|
2
|
+
//# sourceMappingURL=types.js.map
|
@@ -1,24 +1,20 @@
|
|
1
|
-
|
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(
|
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(
|
17
|
+
migrations.add(V1_TO_V2);
|
22
18
|
break;
|
23
19
|
}
|
24
20
|
return migrations;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"whichMigrations.js","names":["
|
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"}
|