@opencrvs/toolkit 1.8.0-rc.f8e4107 → 1.8.0-rc.f966df9

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 (35) hide show
  1. package/dist/commons/api/router.d.ts +8083 -4833
  2. package/dist/commons/conditionals/conditionals.d.ts +7 -69
  3. package/dist/commons/conditionals/validate.d.ts +4 -6
  4. package/dist/commons/events/ActionConfig.d.ts +90025 -1680
  5. package/dist/commons/events/ActionDocument.d.ts +643 -417
  6. package/dist/commons/events/ActionInput.d.ts +248 -240
  7. package/dist/commons/events/AdvancedSearchConfig.d.ts +274 -23
  8. package/dist/commons/events/CompositeFieldValue.d.ts +3 -0
  9. package/dist/commons/events/Draft.d.ts +38 -30
  10. package/dist/commons/events/EventConfig.d.ts +42787 -1385
  11. package/dist/commons/events/EventDocument.d.ts +413 -312
  12. package/dist/commons/events/EventIndex.d.ts +862 -155
  13. package/dist/commons/events/EventInput.d.ts +13 -0
  14. package/dist/commons/events/EventMetadata.d.ts +271 -11
  15. package/dist/commons/events/FieldConfig.d.ts +3778 -769
  16. package/dist/commons/events/FieldType.d.ts +3 -3
  17. package/dist/commons/events/FieldTypeMapping.d.ts +11 -4
  18. package/dist/commons/events/FieldValue.d.ts +7 -4
  19. package/dist/commons/events/FormConfig.d.ts +40417 -439
  20. package/dist/commons/events/PageConfig.d.ts +10077 -203
  21. package/dist/commons/events/SummaryConfig.d.ts +95 -39
  22. package/dist/commons/events/User.d.ts +5 -0
  23. package/dist/commons/events/WorkqueueConfig.d.ts +1257 -19
  24. package/dist/commons/events/defineConfig.d.ts +7008 -81
  25. package/dist/commons/events/event.d.ts +27 -0
  26. package/dist/commons/events/field.d.ts +68 -0
  27. package/dist/commons/events/index.d.ts +3 -0
  28. package/dist/commons/events/scopes.d.ts +45 -0
  29. package/dist/commons/events/test.utils.d.ts +7 -44
  30. package/dist/commons/events/utils.d.ts +3551 -65
  31. package/dist/conditionals/index.js +35 -81
  32. package/dist/events/index.js +1691 -1021
  33. package/dist/scopes/index.d.ts +137 -1
  34. package/dist/scopes/index.js +147 -0
  35. package/package.json +3 -2
@@ -22,11 +22,10 @@ var conditionals_exports = {};
22
22
  __export(conditionals_exports, {
23
23
  alwaysTrue: () => alwaysTrue,
24
24
  and: () => and,
25
+ createEventConditionals: () => createEventConditionals,
26
+ createFieldConditionals: () => createFieldConditionals,
25
27
  defineConditional: () => defineConditional,
26
28
  defineFormConditional: () => defineFormConditional,
27
- event: () => event,
28
- eventField: () => eventField,
29
- field: () => field,
30
29
  never: () => never,
31
30
  not: () => not,
32
31
  or: () => or,
@@ -96,32 +95,38 @@ var user = {
96
95
  required: ["$user"]
97
96
  })
98
97
  };
99
- var event = {
100
- hasAction: (action) => defineConditional({
101
- type: "object",
102
- properties: {
103
- $event: {
104
- type: "object",
105
- properties: {
106
- actions: {
107
- type: "array",
108
- contains: {
109
- type: "object",
110
- properties: {
111
- type: {
112
- const: action
113
- }
114
- },
115
- required: ["type"]
98
+ function createEventConditionals() {
99
+ return {
100
+ /**
101
+ * Checks if the event contains a specific action type.
102
+ * @param action - The action type to check for.
103
+ */
104
+ hasAction: (action) => defineConditional({
105
+ type: "object",
106
+ properties: {
107
+ $event: {
108
+ type: "object",
109
+ properties: {
110
+ actions: {
111
+ type: "array",
112
+ contains: {
113
+ type: "object",
114
+ properties: {
115
+ type: {
116
+ const: action
117
+ }
118
+ },
119
+ required: ["type"]
120
+ }
116
121
  }
117
- }
118
- },
119
- required: ["actions"]
120
- }
121
- },
122
- required: ["$event"]
123
- })
124
- };
122
+ },
123
+ required: ["actions"]
124
+ }
125
+ },
126
+ required: ["$event"]
127
+ })
128
+ };
129
+ }
125
130
  function getDateFromNow(days) {
126
131
  return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
127
132
  }
@@ -142,7 +147,7 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
142
147
  function isFieldReference(value) {
143
148
  return typeof value === "object" && value !== null && "_fieldId" in value;
144
149
  }
145
- function field(fieldId) {
150
+ function createFieldConditionals(fieldId) {
146
151
  const getDateRange = (date, clause) => ({
147
152
  type: "object",
148
153
  properties: {
@@ -155,10 +160,6 @@ function field(fieldId) {
155
160
  required: [fieldId]
156
161
  });
157
162
  return {
158
- /**
159
- * @private Internal property used for field reference tracking.
160
- */
161
- _fieldId: fieldId,
162
163
  isAfter: () => ({
163
164
  days: (days) => ({
164
165
  inPast: () => defineFormConditional(
@@ -326,53 +327,6 @@ function field(fieldId) {
326
327
  },
327
328
  required: [fieldId]
328
329
  }),
329
- /**
330
- * Creates a range configuration for the specified field.
331
- *
332
- * @returns An object containing the field ID and a configuration object with a type of 'RANGE'.
333
- *
334
- * @example field('age').range()
335
- * // {
336
- * // fieldId: 'age',
337
- * // config: { type: 'RANGE' }
338
- * // }
339
- */
340
- range: () => ({
341
- fieldId,
342
- config: { type: "RANGE" }
343
- }),
344
- /**
345
- * Creates a configuration for exact matching of the specified field.
346
- * @returns An object containing the field ID and a configuration object with a type of 'EXACT'.
347
- * @example field('dob').exact()
348
- * // {
349
- * // fieldId: 'dob',
350
- * // config: { type: 'EXACT' }
351
- * // }
352
- */
353
- exact: () => ({
354
- fieldId,
355
- config: { type: "EXACT" }
356
- }),
357
- /**
358
- * Creates a configuration for fuzzy matching of the specified field.
359
- * @returns An object containing the field ID and a configuration object with a type of 'EXACT'.
360
- * @example field('name').fuzzy()
361
- * // {
362
- * // fieldId: 'name',
363
- * // config: { type: 'FUZZY' }
364
- * // }
365
- */
366
- fuzzy: () => ({
367
- fieldId,
368
- config: { type: "FUZZY" }
369
- })
370
- };
371
- }
372
- function eventField(fieldId, options) {
373
- return {
374
- fieldId,
375
- options,
376
- config: { type: "EXACT" }
330
+ getId: () => ({ fieldId })
377
331
  };
378
332
  }