@opencrvs/toolkit 1.9.8-rc.d187100 → 1.9.8-rc.f0948d3

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.
@@ -249,7 +249,7 @@ __export(events_exports, {
249
249
  eventPayloadGenerator: () => eventPayloadGenerator,
250
250
  eventQueryDataGenerator: () => eventQueryDataGenerator,
251
251
  extractPotentialDuplicatesFromActions: () => extractPotentialDuplicatesFromActions,
252
- field: () => field,
252
+ field: () => field2,
253
253
  fieldConfigsToActionPayload: () => fieldConfigsToActionPayload,
254
254
  fieldTypes: () => fieldTypes,
255
255
  findActiveDraftForEvent: () => findActiveDraftForEvent,
@@ -2857,7 +2857,7 @@ var BaseField3 = import_zod24.z.object({
2857
2857
  label would be "Applicant Applicant's First Name", which is redundant and awkward.
2858
2858
 
2859
2859
  By setting searchCriteriaLabelPrefix to a translation config object, we can explicitly define the desired prefix
2860
- in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
2860
+ in the country-config > event.advancedSearch configuration. For example: event.declaration("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
2861
2861
  `
2862
2862
  ),
2863
2863
  conditionals: import_zod24.z.array(FieldConditional).default([]).optional().describe(
@@ -4069,6 +4069,76 @@ var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
4069
4069
  // ../commons/src/events/WorkqueueConfig.ts
4070
4070
  var import_zod31 = require("zod");
4071
4071
 
4072
+ // ../commons/src/searchConfigs.ts
4073
+ function createSearchConfig(baseField) {
4074
+ return {
4075
+ /**
4076
+ * Creates a range configuration for the specified field.
4077
+ *
4078
+ * @returns An object containing the field ID and a configuration object with a type of 'range'.
4079
+ *
4080
+ * @example event('legalStatuses.REGISTERED.acceptedAt').range()
4081
+ * // {
4082
+ * // ...
4083
+ * // config: { type: 'range' }
4084
+ * // }
4085
+ */
4086
+ range: () => ({
4087
+ ...baseField,
4088
+ config: { type: "range" }
4089
+ }),
4090
+ /**
4091
+ * Creates a configuration for exact matching of the specified field.
4092
+ * @returns An object containing the field ID and a configuration object with a type of 'exact'.
4093
+ * @example event.declaration('dob').exact()
4094
+ * // {
4095
+ * // ...
4096
+ * // config: { type: 'exact' }
4097
+ * // }
4098
+ */
4099
+ exact: () => ({
4100
+ ...baseField,
4101
+ config: { type: "exact" }
4102
+ }),
4103
+ /**
4104
+ * Creates a configuration for fuzzy matching of the specified field.
4105
+ * @returns An object containing the field ID and a configuration object with a type of 'exact'.
4106
+ * @example event.declaration('name').fuzzy()
4107
+ * // {
4108
+ * // ...
4109
+ * // config: { type: 'fuzzy' }
4110
+ * // }
4111
+ */
4112
+ fuzzy: () => ({
4113
+ ...baseField,
4114
+ config: { type: "fuzzy" }
4115
+ }),
4116
+ /**
4117
+ * Creates a configuration for matching locations and the child locations
4118
+ * @returns An object containing the field ID and a configuration object with a type of 'within'.
4119
+ * @example event.declaration('createdAtLocation').within()
4120
+ * // {
4121
+ * // ...
4122
+ * // config: { type: 'within' }
4123
+ * // }
4124
+ */
4125
+ within: () => ({
4126
+ ...baseField,
4127
+ config: { type: "within" }
4128
+ })
4129
+ };
4130
+ }
4131
+
4132
+ // ../commons/src/field-config/field-configuration.ts
4133
+ function createFieldConfig(fieldId, options) {
4134
+ const baseField = {
4135
+ fieldId,
4136
+ fieldType: "field",
4137
+ ...options
4138
+ };
4139
+ return createSearchConfig(baseField);
4140
+ }
4141
+
4072
4142
  // ../commons/src/conditionals/conditionals.ts
4073
4143
  var objectHash = __toESM(require("object-hash"));
4074
4144
  function defineConditional(schema) {
@@ -4463,7 +4533,7 @@ function createFieldConditionals(fieldId) {
4463
4533
  },
4464
4534
  /**
4465
4535
  * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
4466
- * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
4536
+ * @example event.declaration('recommender.none').isFalsy() vs not(event.declaration('recommender.none').isEqualTo(true))
4467
4537
  * @returns whether the field is falsy (undefined, false, null, empty string)
4468
4538
  *
4469
4539
  * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
@@ -4611,11 +4681,11 @@ function createFieldConditionals(fieldId) {
4611
4681
  getId: () => ({ fieldId }),
4612
4682
  /**
4613
4683
  * @deprecated
4614
- * use field(fieldId).get(nestedProperty) instead
4684
+ * use event.declaration(fieldId).get(nestedProperty) instead
4615
4685
  * with 'and' combinator e.g.
4616
4686
  * and(
4617
- * field('child.name').get('firstname').isEqualTo('John'),
4618
- * field('child.name').get('surname').isEqualTo('Doe')
4687
+ * event.declaration('child.name').get('firstname').isEqualTo('John'),
4688
+ * event.declaration('child.name').get('surname').isEqualTo('Doe')
4619
4689
  * )
4620
4690
  */
4621
4691
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -4637,66 +4707,6 @@ function createFieldConditionals(fieldId) {
4637
4707
  };
4638
4708
  }
4639
4709
 
4640
- // ../commons/src/searchConfigs.ts
4641
- function createSearchConfig(baseField) {
4642
- return {
4643
- /**
4644
- * Creates a range configuration for the specified field.
4645
- *
4646
- * @returns An object containing the field ID and a configuration object with a type of 'range'.
4647
- *
4648
- * @example event('legalStatuses.REGISTERED.acceptedAt').range()
4649
- * // {
4650
- * // ...
4651
- * // config: { type: 'range' }
4652
- * // }
4653
- */
4654
- range: () => ({
4655
- ...baseField,
4656
- config: { type: "range" }
4657
- }),
4658
- /**
4659
- * Creates a configuration for exact matching of the specified field.
4660
- * @returns An object containing the field ID and a configuration object with a type of 'exact'.
4661
- * @example field('dob').exact()
4662
- * // {
4663
- * // ...
4664
- * // config: { type: 'exact' }
4665
- * // }
4666
- */
4667
- exact: () => ({
4668
- ...baseField,
4669
- config: { type: "exact" }
4670
- }),
4671
- /**
4672
- * Creates a configuration for fuzzy matching of the specified field.
4673
- * @returns An object containing the field ID and a configuration object with a type of 'exact'.
4674
- * @example field('name').fuzzy()
4675
- * // {
4676
- * // ...
4677
- * // config: { type: 'fuzzy' }
4678
- * // }
4679
- */
4680
- fuzzy: () => ({
4681
- ...baseField,
4682
- config: { type: "fuzzy" }
4683
- }),
4684
- /**
4685
- * Creates a configuration for matching locations and the child locations
4686
- * @returns An object containing the field ID and a configuration object with a type of 'within'.
4687
- * @example field('createdAtLocation').within()
4688
- * // {
4689
- * // ...
4690
- * // config: { type: 'within' }
4691
- * // }
4692
- */
4693
- within: () => ({
4694
- ...baseField,
4695
- config: { type: "within" }
4696
- })
4697
- };
4698
- }
4699
-
4700
4710
  // ../commons/src/event-config/event-configuration.ts
4701
4711
  function createEventFieldConfig(fieldId) {
4702
4712
  const baseField = {
@@ -4818,6 +4828,27 @@ var event = Object.assign(eventFn, {
4818
4828
  return {
4819
4829
  $event: field3
4820
4830
  };
4831
+ },
4832
+ /**
4833
+ * Creates a function that acts like a callable + static method container.
4834
+ * @param fieldId - The ID of the event metadata field to create a search config for.
4835
+ * @example
4836
+ * event('status') // → returns search config
4837
+ * event.hasAction('CLICKED') // → returns conditional
4838
+ */
4839
+ metadata(fieldId) {
4840
+ return createEventFieldConfig(fieldId);
4841
+ },
4842
+ /**
4843
+ * Entry point for defining conditional logic or configuration for a form field.
4844
+ * @param fieldId - The ID of the field to define rules or config for.
4845
+ * @returns An object combining conditional methods and configuration builders.
4846
+ */
4847
+ declaration(fieldId, options = {}) {
4848
+ return {
4849
+ ...createFieldConditionals(fieldId),
4850
+ ...createFieldConfig(fieldId, options)
4851
+ };
4821
4852
  }
4822
4853
  });
4823
4854
 
@@ -5693,24 +5724,6 @@ function generateTransactionId() {
5693
5724
  var import_lodash4 = require("lodash");
5694
5725
  var import_date_fns4 = require("date-fns");
5695
5726
 
5696
- // ../commons/src/field-config/field-configuration.ts
5697
- function createFieldConfig(fieldId, options) {
5698
- const baseField = {
5699
- fieldId,
5700
- fieldType: "field",
5701
- ...options
5702
- };
5703
- return createSearchConfig(baseField);
5704
- }
5705
-
5706
- // ../commons/src/events/field.ts
5707
- function field(fieldId, options = {}) {
5708
- return {
5709
- ...createFieldConditionals(fieldId),
5710
- ...createFieldConfig(fieldId, options)
5711
- };
5712
- }
5713
-
5714
5727
  // ../commons/src/fixtures/forms.ts
5715
5728
  var import_date_fns3 = require("date-fns");
5716
5729
  var PRINT_CERTIFICATE_FORM = defineActionForm({
@@ -6332,7 +6345,7 @@ var PRINT_CERTIFICATE_FORM = defineActionForm({
6332
6345
  id: "collector.identity.verify",
6333
6346
  type: PageTypes.enum.VERIFICATION,
6334
6347
  requireCompletionToContinue: true,
6335
- conditional: field("collector.requesterId").isEqualTo("INFORMANT"),
6348
+ conditional: event.declaration("collector.requesterId").isEqualTo("INFORMANT"),
6336
6349
  title: {
6337
6350
  id: "event.tennis-club-membership.action.print.verifyIdentity",
6338
6351
  defaultMessage: "Verify their identity",
@@ -6404,14 +6417,14 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
6404
6417
  };
6405
6418
  function isInternationalAddress() {
6406
6419
  return and(
6407
- not(field("country").isUndefined()),
6408
- field("addressType").isEqualTo(AddressType.INTERNATIONAL)
6420
+ not(event.declaration("country").isUndefined()),
6421
+ event.declaration("addressType").isEqualTo(AddressType.INTERNATIONAL)
6409
6422
  );
6410
6423
  }
6411
6424
  function isDomesticAddress() {
6412
6425
  return and(
6413
- not(field("country").isUndefined()),
6414
- field("addressType").isEqualTo(AddressType.DOMESTIC)
6426
+ not(event.declaration("country").isUndefined()),
6427
+ event.declaration("addressType").isEqualTo(AddressType.DOMESTIC)
6415
6428
  );
6416
6429
  }
6417
6430
  var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
@@ -6449,9 +6462,9 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6449
6462
  },
6450
6463
  validation: [
6451
6464
  {
6452
- validator: field("applicant.name").object({
6453
- firstname: field("firstname").isValidEnglishName(),
6454
- surname: field("surname").isValidEnglishName()
6465
+ validator: event.declaration("applicant.name").object({
6466
+ firstname: event.declaration("firstname").isValidEnglishName(),
6467
+ surname: event.declaration("surname").isValidEnglishName()
6455
6468
  }),
6456
6469
  message: {
6457
6470
  defaultMessage: "Input contains invalid characters. Please use only letters (a-z, A-Z), numbers (0-9), hyphens (-), apostrophes(') and underscores (_)",
@@ -6485,13 +6498,13 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6485
6498
  description: "This is the error message for invalid date",
6486
6499
  id: "event.tennis-club-membership.action.declare.form.section.who.field.dob.error"
6487
6500
  },
6488
- validator: field("applicant.dob").isBefore().now()
6501
+ validator: event.declaration("applicant.dob").isBefore().now()
6489
6502
  }
6490
6503
  ],
6491
6504
  conditionals: [
6492
6505
  {
6493
6506
  type: ConditionalType.SHOW,
6494
- conditional: field("applicant.dobUnknown").isFalsy()
6507
+ conditional: event.declaration("applicant.dobUnknown").isFalsy()
6495
6508
  }
6496
6509
  ],
6497
6510
  label: {
@@ -6529,7 +6542,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6529
6542
  conditionals: [
6530
6543
  {
6531
6544
  type: ConditionalType.SHOW,
6532
- conditional: field("applicant.dobUnknown").isEqualTo(true)
6545
+ conditional: event.declaration("applicant.dobUnknown").isEqualTo(true)
6533
6546
  }
6534
6547
  ]
6535
6548
  },
@@ -6562,7 +6575,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6562
6575
  description: "Error message when generic field is invalid",
6563
6576
  id: "error.invalid"
6564
6577
  },
6565
- validator: field("applicant.address").isValidAdministrativeLeafLevel()
6578
+ validator: event.declaration("applicant.address").isValidAdministrativeLeafLevel()
6566
6579
  }
6567
6580
  ],
6568
6581
  configuration: {
@@ -6570,7 +6583,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6570
6583
  {
6571
6584
  id: "town",
6572
6585
  required: false,
6573
- parent: field("country"),
6586
+ parent: event.declaration("country"),
6574
6587
  label: {
6575
6588
  id: "field.address.town.label",
6576
6589
  defaultMessage: "Town",
@@ -6581,7 +6594,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6581
6594
  type: ConditionalType.SHOW,
6582
6595
  conditional: and(
6583
6596
  isDomesticAddress(),
6584
- not(field("district").isUndefined())
6597
+ not(event.declaration("district").isUndefined())
6585
6598
  )
6586
6599
  }
6587
6600
  ],
@@ -6590,7 +6603,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6590
6603
  {
6591
6604
  id: "residentialArea",
6592
6605
  required: false,
6593
- parent: field("country"),
6606
+ parent: event.declaration("country"),
6594
6607
  label: {
6595
6608
  id: "field.address.residentialArea.label",
6596
6609
  defaultMessage: "Residential Area",
@@ -6601,7 +6614,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6601
6614
  type: ConditionalType.SHOW,
6602
6615
  conditional: and(
6603
6616
  isDomesticAddress(),
6604
- not(field("district").isUndefined())
6617
+ not(event.declaration("district").isUndefined())
6605
6618
  )
6606
6619
  }
6607
6620
  ],
@@ -6610,7 +6623,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6610
6623
  {
6611
6624
  id: "street",
6612
6625
  required: false,
6613
- parent: field("country"),
6626
+ parent: event.declaration("country"),
6614
6627
  label: {
6615
6628
  id: "field.address.street.label",
6616
6629
  defaultMessage: "Street",
@@ -6621,7 +6634,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6621
6634
  type: ConditionalType.SHOW,
6622
6635
  conditional: and(
6623
6636
  isDomesticAddress(),
6624
- not(field("district").isUndefined())
6637
+ not(event.declaration("district").isUndefined())
6625
6638
  )
6626
6639
  }
6627
6640
  ],
@@ -6630,7 +6643,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6630
6643
  {
6631
6644
  id: "number",
6632
6645
  required: false,
6633
- parent: field("country"),
6646
+ parent: event.declaration("country"),
6634
6647
  label: {
6635
6648
  id: "field.address.number.label",
6636
6649
  defaultMessage: "Number",
@@ -6641,7 +6654,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6641
6654
  type: ConditionalType.SHOW,
6642
6655
  conditional: and(
6643
6656
  isDomesticAddress(),
6644
- not(field("district").isUndefined())
6657
+ not(event.declaration("district").isUndefined())
6645
6658
  )
6646
6659
  }
6647
6660
  ],
@@ -6650,7 +6663,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6650
6663
  {
6651
6664
  id: "zipCode",
6652
6665
  required: false,
6653
- parent: field("country"),
6666
+ parent: event.declaration("country"),
6654
6667
  label: {
6655
6668
  id: "field.address.postcodeOrZip.label",
6656
6669
  defaultMessage: "Postcode / Zip",
@@ -6661,7 +6674,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6661
6674
  type: ConditionalType.SHOW,
6662
6675
  conditional: and(
6663
6676
  isDomesticAddress(),
6664
- not(field("district").isUndefined())
6677
+ not(event.declaration("district").isUndefined())
6665
6678
  )
6666
6679
  }
6667
6680
  ],
@@ -6675,7 +6688,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6675
6688
  conditional: isInternationalAddress()
6676
6689
  }
6677
6690
  ],
6678
- parent: field("country"),
6691
+ parent: event.declaration("country"),
6679
6692
  required: true,
6680
6693
  label: {
6681
6694
  id: "field.address.state.label",
@@ -6686,7 +6699,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6686
6699
  },
6687
6700
  {
6688
6701
  id: "district2",
6689
- parent: field("country"),
6702
+ parent: event.declaration("country"),
6690
6703
  conditionals: [
6691
6704
  {
6692
6705
  type: ConditionalType.SHOW,
@@ -6703,7 +6716,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6703
6716
  },
6704
6717
  {
6705
6718
  id: "cityOrTown",
6706
- parent: field("country"),
6719
+ parent: event.declaration("country"),
6707
6720
  conditionals: [
6708
6721
  {
6709
6722
  type: ConditionalType.SHOW,
@@ -6720,7 +6733,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6720
6733
  },
6721
6734
  {
6722
6735
  id: "addressLine1",
6723
- parent: field("country"),
6736
+ parent: event.declaration("country"),
6724
6737
  conditionals: [
6725
6738
  {
6726
6739
  type: ConditionalType.SHOW,
@@ -6737,7 +6750,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6737
6750
  },
6738
6751
  {
6739
6752
  id: "addressLine2",
6740
- parent: field("country"),
6753
+ parent: event.declaration("country"),
6741
6754
  conditionals: [
6742
6755
  {
6743
6756
  type: ConditionalType.SHOW,
@@ -6754,7 +6767,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6754
6767
  },
6755
6768
  {
6756
6769
  id: "addressLine3",
6757
- parent: field("country"),
6770
+ parent: event.declaration("country"),
6758
6771
  conditionals: [
6759
6772
  {
6760
6773
  type: ConditionalType.SHOW,
@@ -6771,7 +6784,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6771
6784
  },
6772
6785
  {
6773
6786
  id: "postcodeOrZip",
6774
- parent: field("country"),
6787
+ parent: event.declaration("country"),
6775
6788
  conditionals: [
6776
6789
  {
6777
6790
  type: ConditionalType.SHOW,
@@ -6810,7 +6823,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6810
6823
  },
6811
6824
  {
6812
6825
  id: "senior-pass",
6813
- conditional: field("applicant.dob").isBefore().date("1950-01-01"),
6826
+ conditional: event.declaration("applicant.dob").isBefore().date("1950-01-01"),
6814
6827
  title: {
6815
6828
  id: "event.tennis-club-membership.action.declare.form.section.senior-pass.title",
6816
6829
  defaultMessage: "Assign senior pass for applicant",
@@ -6831,7 +6844,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6831
6844
  id: "senior-pass.recommender",
6832
6845
  type: "CHECKBOX",
6833
6846
  required: true,
6834
- parent: field("recommender.none"),
6847
+ parent: event.declaration("recommender.none"),
6835
6848
  defaultValue: false,
6836
6849
  conditionals: [],
6837
6850
  label: {
@@ -6869,7 +6882,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6869
6882
  conditionals: [
6870
6883
  {
6871
6884
  type: ConditionalType.SHOW,
6872
- conditional: field("recommender.none").isFalsy()
6885
+ conditional: event.declaration("recommender.none").isFalsy()
6873
6886
  }
6874
6887
  ],
6875
6888
  label: {
@@ -6885,7 +6898,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
6885
6898
  conditionals: [
6886
6899
  {
6887
6900
  type: ConditionalType.SHOW,
6888
- conditional: field("recommender.none").isFalsy()
6901
+ conditional: event.declaration("recommender.none").isFalsy()
6889
6902
  }
6890
6903
  ],
6891
6904
  label: {
@@ -7318,10 +7331,10 @@ var tennisClubMembershipEvent = defineConfig({
7318
7331
  id: "advancedSearch.form.registrationDetails"
7319
7332
  },
7320
7333
  fields: [
7321
- event("legalStatuses.REGISTERED.createdAtLocation").exact(),
7322
- event("legalStatuses.REGISTERED.acceptedAt").range(),
7323
- event("status").exact(),
7324
- event("updatedAt").range()
7334
+ event.metadata("legalStatuses.REGISTERED.createdAtLocation").exact(),
7335
+ event.metadata("legalStatuses.REGISTERED.acceptedAt").range(),
7336
+ event.metadata("status").exact(),
7337
+ event.metadata("updatedAt").range()
7325
7338
  ]
7326
7339
  },
7327
7340
  {
@@ -7331,9 +7344,9 @@ var tennisClubMembershipEvent = defineConfig({
7331
7344
  id: "event.tennis-club-membership.search.applicants"
7332
7345
  },
7333
7346
  fields: [
7334
- field("applicant.name").fuzzy(),
7335
- field("applicant.dob").range(),
7336
- field("applicant.email").exact()
7347
+ event.declaration("applicant.name").fuzzy(),
7348
+ event.declaration("applicant.dob").range(),
7349
+ event.declaration("applicant.email").exact()
7337
7350
  ]
7338
7351
  },
7339
7352
  {
@@ -7342,7 +7355,7 @@ var tennisClubMembershipEvent = defineConfig({
7342
7355
  description: "Recommender details search field section title",
7343
7356
  id: "event.tennis-club-membership.search.recommender"
7344
7357
  },
7345
- fields: [field("recommender.name").fuzzy()]
7358
+ fields: [event.declaration("recommender.name").fuzzy()]
7346
7359
  }
7347
7360
  ],
7348
7361
  declaration: TENNIS_CLUB_DECLARATION_FORM
@@ -7677,10 +7690,10 @@ var footballClubMembershipEvent = defineConfig({
7677
7690
  id: "advancedSearch.form.registrationDetails"
7678
7691
  },
7679
7692
  fields: [
7680
- event("legalStatuses.REGISTERED.createdAtLocation").exact(),
7681
- event("legalStatuses.REGISTERED.acceptedAt").range(),
7682
- event("status").exact(),
7683
- event("updatedAt").range()
7693
+ event.metadata("legalStatuses.REGISTERED.createdAtLocation").exact(),
7694
+ event.metadata("legalStatuses.REGISTERED.acceptedAt").range(),
7695
+ event.metadata("status").exact(),
7696
+ event.metadata("updatedAt").range()
7684
7697
  ]
7685
7698
  },
7686
7699
  {
@@ -7690,9 +7703,9 @@ var footballClubMembershipEvent = defineConfig({
7690
7703
  id: "event.football-club-membership.search.applicants"
7691
7704
  },
7692
7705
  fields: [
7693
- field("applicant.name").fuzzy(),
7694
- field("applicant.dob").range(),
7695
- field("applicant.email").exact()
7706
+ event.declaration("applicant.name").fuzzy(),
7707
+ event.declaration("applicant.dob").range(),
7708
+ event.declaration("applicant.email").exact()
7696
7709
  ]
7697
7710
  },
7698
7711
  {
@@ -7701,7 +7714,7 @@ var footballClubMembershipEvent = defineConfig({
7701
7714
  description: "Recommender details search field section title",
7702
7715
  id: "event.football-club-membership.search.recommender"
7703
7716
  },
7704
- fields: [field("recommender.name").fuzzy()]
7717
+ fields: [event.declaration("recommender.name").fuzzy()]
7705
7718
  }
7706
7719
  ],
7707
7720
  declaration: TENNIS_CLUB_DECLARATION_FORM
@@ -7823,7 +7836,9 @@ var mother = defineFormPage({
7823
7836
  conditionals: [
7824
7837
  {
7825
7838
  type: "SHOW",
7826
- conditional: not(field("mother.dobUnknown").isEqualTo(true))
7839
+ conditional: not(
7840
+ event.declaration("mother.dobUnknown").isEqualTo(true)
7841
+ )
7827
7842
  }
7828
7843
  ]
7829
7844
  },
@@ -7840,12 +7855,12 @@ var mother = defineFormPage({
7840
7855
  analytics: true,
7841
7856
  label: generateTranslationConfig("Age of mother"),
7842
7857
  configuration: {
7843
- asOfDate: field("child.dob")
7858
+ asOfDate: event.declaration("child.dob")
7844
7859
  },
7845
7860
  conditionals: [
7846
7861
  {
7847
7862
  type: "SHOW",
7848
- conditional: field("mother.dobUnknown").isEqualTo(true)
7863
+ conditional: event.declaration("mother.dobUnknown").isEqualTo(true)
7849
7864
  }
7850
7865
  ]
7851
7866
  },
@@ -7983,7 +7998,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
7983
7998
  id: "event.digital-identity.certificate.fetch.label"
7984
7999
  },
7985
8000
  configuration: {
7986
- trigger: field("identity.http-button"),
8001
+ trigger: event.declaration("identity.http-button"),
7987
8002
  url: "/api/digital-identity/certificate",
7988
8003
  timeout: 5e3,
7989
8004
  method: "POST",
@@ -8007,15 +8022,15 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
8007
8022
  {
8008
8023
  type: ConditionalType.ENABLE,
8009
8024
  conditional: and(
8010
- field("identity.http-fetch").isUndefined(),
8025
+ event.declaration("identity.http-fetch").isUndefined(),
8011
8026
  user.isOnline()
8012
8027
  )
8013
8028
  },
8014
8029
  {
8015
8030
  type: ConditionalType.SHOW,
8016
8031
  conditional: and(
8017
- field("identity.http-fetch").get("loading").isFalsy(),
8018
- field("identity.http-fetch").get("data").isFalsy()
8032
+ event.declaration("identity.http-fetch").get("loading").isFalsy(),
8033
+ event.declaration("identity.http-fetch").get("data").isFalsy()
8019
8034
  )
8020
8035
  }
8021
8036
  ],
@@ -8043,7 +8058,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
8043
8058
  },
8044
8059
  {
8045
8060
  type: ConditionalType.SHOW,
8046
- conditional: field("identity.http-fetch").get("loading").isEqualTo(true)
8061
+ conditional: event.declaration("identity.http-fetch").get("loading").isEqualTo(true)
8047
8062
  }
8048
8063
  ],
8049
8064
  configuration: {
@@ -8070,7 +8085,9 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
8070
8085
  },
8071
8086
  {
8072
8087
  type: ConditionalType.SHOW,
8073
- conditional: not(field("identity.certificateId").isFalsy())
8088
+ conditional: not(
8089
+ event.declaration("identity.certificateId").isFalsy()
8090
+ )
8074
8091
  }
8075
8092
  ],
8076
8093
  configuration: {
@@ -8085,7 +8102,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
8085
8102
  {
8086
8103
  id: "identity.certificateId",
8087
8104
  type: FieldType.TEXT,
8088
- parent: field("identity.http-fetch"),
8105
+ parent: event.declaration("identity.http-fetch"),
8089
8106
  label: {
8090
8107
  defaultMessage: "Certificate ID",
8091
8108
  description: "Issued digital identity certificate identifier",
@@ -8097,7 +8114,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
8097
8114
  conditional: never()
8098
8115
  }
8099
8116
  ],
8100
- value: field("identity.http-fetch").get("data.certificateId")
8117
+ value: event.declaration("identity.http-fetch").get("data.certificateId")
8101
8118
  }
8102
8119
  ]
8103
8120
  }
@@ -9218,6 +9235,14 @@ function getFilePathsFromEvent(event2) {
9218
9235
  return (0, import_lodash6.uniq)(filepaths);
9219
9236
  }
9220
9237
 
9238
+ // ../commons/src/events/field.ts
9239
+ function field2(fieldId, options = {}) {
9240
+ return {
9241
+ ...createFieldConditionals(fieldId),
9242
+ ...createFieldConfig(fieldId, options)
9243
+ };
9244
+ }
9245
+
9221
9246
  // ../commons/src/events/locations.ts
9222
9247
  var import_zod37 = require("zod");
9223
9248
  var LocationType = import_zod37.z.enum([