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

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 (39) hide show
  1. package/dist/commons/api/router.d.ts +8418 -4827
  2. package/dist/commons/conditionals/conditionals.d.ts +9 -70
  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/CountryConfigQueryInput.d.ts +1506 -0
  10. package/dist/commons/events/Draft.d.ts +38 -30
  11. package/dist/commons/events/EventConfig.d.ts +42787 -1385
  12. package/dist/commons/events/EventDocument.d.ts +413 -312
  13. package/dist/commons/events/EventIndex.d.ts +948 -155
  14. package/dist/commons/events/EventInput.d.ts +13 -0
  15. package/dist/commons/events/EventMetadata.d.ts +274 -11
  16. package/dist/commons/events/FieldConfig.d.ts +3778 -769
  17. package/dist/commons/events/FieldType.d.ts +3 -3
  18. package/dist/commons/events/FieldTypeMapping.d.ts +11 -4
  19. package/dist/commons/events/FieldValue.d.ts +7 -4
  20. package/dist/commons/events/FormConfig.d.ts +40417 -439
  21. package/dist/commons/events/PageConfig.d.ts +10077 -203
  22. package/dist/commons/events/SummaryConfig.d.ts +95 -39
  23. package/dist/commons/events/User.d.ts +31 -2
  24. package/dist/commons/events/WorkqueueColumnConfig.d.ts +42 -0
  25. package/dist/commons/events/WorkqueueConfig.d.ts +2834 -19
  26. package/dist/commons/events/defineConfig.d.ts +7008 -81
  27. package/dist/commons/events/event.d.ts +27 -0
  28. package/dist/commons/events/field.d.ts +68 -0
  29. package/dist/commons/events/index.d.ts +6 -0
  30. package/dist/commons/events/scopes.d.ts +26 -0
  31. package/dist/commons/events/serializer.d.ts +2 -0
  32. package/dist/commons/events/test.utils.d.ts +7 -44
  33. package/dist/commons/events/utils.d.ts +3551 -65
  34. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  35. package/dist/conditionals/index.js +54 -83
  36. package/dist/events/index.js +2044 -1072
  37. package/dist/scopes/index.d.ts +105 -1
  38. package/dist/scopes/index.js +140 -0
  39. package/package.json +3 -2
@@ -0,0 +1,3 @@
1
+ import { WorkqueueColumn } from './WorkqueueColumnConfig';
2
+ export declare const defaultWorkqueueColumns: WorkqueueColumn[];
3
+ //# sourceMappingURL=workqueueDefaultColumns.d.ts.map
@@ -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,
@@ -34,6 +33,23 @@ __export(conditionals_exports, {
34
33
  });
35
34
  module.exports = __toCommonJS(conditionals_exports);
36
35
 
36
+ // ../commons/src/events/serializers/user/serializer.ts
37
+ var import_zod = require("zod");
38
+ var SerializedUserField = import_zod.z.object({
39
+ $userField: import_zod.z.enum([
40
+ "id",
41
+ "name",
42
+ "role",
43
+ "signatureFilename",
44
+ "primaryOfficeId"
45
+ ])
46
+ });
47
+ function userSerializer(userField) {
48
+ return {
49
+ $userField: userField
50
+ };
51
+ }
52
+
37
53
  // ../commons/src/conditionals/conditionals.ts
38
54
  function defineConditional(schema) {
39
55
  return schema;
@@ -75,7 +91,7 @@ function not(condition) {
75
91
  function never() {
76
92
  return not(alwaysTrue());
77
93
  }
78
- var user = {
94
+ var user = Object.assign(userSerializer, {
79
95
  hasScope: (scope) => defineConditional({
80
96
  type: "object",
81
97
  properties: {
@@ -95,33 +111,39 @@ var user = {
95
111
  },
96
112
  required: ["$user"]
97
113
  })
98
- };
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"]
114
+ });
115
+ function createEventConditionals() {
116
+ return {
117
+ /**
118
+ * Checks if the event contains a specific action type.
119
+ * @param action - The action type to check for.
120
+ */
121
+ hasAction: (action) => defineConditional({
122
+ type: "object",
123
+ properties: {
124
+ $event: {
125
+ type: "object",
126
+ properties: {
127
+ actions: {
128
+ type: "array",
129
+ contains: {
130
+ type: "object",
131
+ properties: {
132
+ type: {
133
+ const: action
134
+ }
135
+ },
136
+ required: ["type"]
137
+ }
116
138
  }
117
- }
118
- },
119
- required: ["actions"]
120
- }
121
- },
122
- required: ["$event"]
123
- })
124
- };
139
+ },
140
+ required: ["actions"]
141
+ }
142
+ },
143
+ required: ["$event"]
144
+ })
145
+ };
146
+ }
125
147
  function getDateFromNow(days) {
126
148
  return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
127
149
  }
@@ -142,7 +164,7 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
142
164
  function isFieldReference(value) {
143
165
  return typeof value === "object" && value !== null && "_fieldId" in value;
144
166
  }
145
- function field(fieldId) {
167
+ function createFieldConditionals(fieldId) {
146
168
  const getDateRange = (date, clause) => ({
147
169
  type: "object",
148
170
  properties: {
@@ -155,10 +177,6 @@ function field(fieldId) {
155
177
  required: [fieldId]
156
178
  });
157
179
  return {
158
- /**
159
- * @private Internal property used for field reference tracking.
160
- */
161
- _fieldId: fieldId,
162
180
  isAfter: () => ({
163
181
  days: (days) => ({
164
182
  inPast: () => defineFormConditional(
@@ -326,53 +344,6 @@ function field(fieldId) {
326
344
  },
327
345
  required: [fieldId]
328
346
  }),
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" }
347
+ getId: () => ({ fieldId })
377
348
  };
378
349
  }