@opencrvs/toolkit 1.9.2 → 1.9.3-rc.0263d03

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 (59) hide show
  1. package/dist/commons/api/router.d.ts +28094 -2317
  2. package/dist/commons/conditionals/conditionals.d.ts +54 -1
  3. package/dist/commons/conditionals/validate.d.ts +12 -4
  4. package/dist/commons/events/ActionConfig.d.ts +23125 -1523
  5. package/dist/commons/events/ActionDocument.d.ts +840 -1849
  6. package/dist/commons/events/ActionInput.d.ts +290 -1066
  7. package/dist/commons/events/ActionType.d.ts +91 -8
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +222 -1238
  9. package/dist/commons/events/CompositeFieldValue.d.ts +25 -176
  10. package/dist/commons/events/Conditional.d.ts +26 -38
  11. package/dist/commons/events/Constants.d.ts +1 -1
  12. package/dist/commons/events/CountryConfigQueryInput.d.ts +931 -4169
  13. package/dist/commons/events/CreatedAtLocation.d.ts +1 -1
  14. package/dist/commons/events/DeduplicationConfig.d.ts +15 -150
  15. package/dist/commons/events/Draft.d.ts +72 -105
  16. package/dist/commons/events/DynamicFieldValue.d.ts +7 -91
  17. package/dist/commons/events/EventConfig.d.ts +18322 -2096
  18. package/dist/commons/events/EventConfigInput.d.ts +1 -1
  19. package/dist/commons/events/EventDocument.d.ts +336 -1326
  20. package/dist/commons/events/EventIndex.d.ts +197 -967
  21. package/dist/commons/events/EventInput.d.ts +2 -8
  22. package/dist/commons/events/EventMetadata.d.ts +106 -346
  23. package/dist/commons/events/FieldConfig.d.ts +4173 -11778
  24. package/dist/commons/events/FieldType.d.ts +9 -4
  25. package/dist/commons/events/FieldTypeMapping.d.ts +172 -811
  26. package/dist/commons/events/FieldValue.d.ts +82 -355
  27. package/dist/commons/events/Flag.d.ts +70 -0
  28. package/dist/commons/events/FormConfig.d.ts +12882 -697
  29. package/dist/commons/events/PageConfig.d.ts +8605 -314
  30. package/dist/commons/events/SummaryConfig.d.ts +14 -161
  31. package/dist/commons/events/TemplateConfig.d.ts +3 -3
  32. package/dist/commons/events/TranslationConfig.d.ts +2 -2
  33. package/dist/commons/events/WorkqueueColumnConfig.d.ts +74 -37
  34. package/dist/commons/events/WorkqueueConfig.d.ts +1695 -7156
  35. package/dist/commons/events/deduplication.d.ts +3 -3
  36. package/dist/commons/events/defineConfig.d.ts +25160 -147
  37. package/dist/commons/events/event.d.ts +4 -4
  38. package/dist/commons/events/field.d.ts +110 -0
  39. package/dist/commons/events/index.d.ts +1 -0
  40. package/dist/commons/events/locations.d.ts +15 -19
  41. package/dist/commons/events/scopes.d.ts +3 -1
  42. package/dist/commons/events/state/availableActions.d.ts +2 -1
  43. package/dist/commons/events/state/flags.d.ts +21 -3
  44. package/dist/commons/events/state/index.d.ts +23 -19
  45. package/dist/commons/events/state/utils.d.ts +142 -110
  46. package/dist/commons/events/test.utils.d.ts +23 -6
  47. package/dist/commons/events/transactions.d.ts +1 -1
  48. package/dist/commons/events/utils.d.ts +50377 -357
  49. package/dist/commons/notification/UserNotifications.d.ts +55 -636
  50. package/dist/conditionals/index.d.ts.map +1 -1
  51. package/dist/conditionals/index.js +103 -10
  52. package/dist/events/deduplication.d.ts +3 -3
  53. package/dist/events/index.js +1921 -1501
  54. package/dist/notification/index.d.ts.map +1 -1
  55. package/dist/notification/index.js +1645 -1471
  56. package/dist/scopes/index.d.ts +138 -138
  57. package/dist/scopes/index.d.ts.map +1 -1
  58. package/dist/scopes/index.js +123 -93
  59. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conditionals/index.ts"],"names":[],"mappings":"AAUA,cAAc,gCAAgC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conditionals/index.ts"],"names":[],"mappings":"AAaA,cAAc,gCAAgC,CAAA"}
@@ -35,21 +35,24 @@ __export(conditionals_exports, {
35
35
  createFieldConditionals: () => createFieldConditionals,
36
36
  defineConditional: () => defineConditional,
37
37
  defineFormConditional: () => defineFormConditional,
38
+ flag: () => flag,
38
39
  isFieldReference: () => isFieldReference,
39
40
  never: () => never,
40
41
  not: () => not,
41
42
  or: () => or,
43
+ status: () => status,
42
44
  user: () => user
43
45
  });
44
46
  module.exports = __toCommonJS(conditionals_exports);
47
+ var z3 = __toESM(require("zod/v4"));
45
48
 
46
49
  // ../commons/src/conditionals/conditionals.ts
47
50
  var objectHash = __toESM(require("object-hash"));
48
51
 
49
52
  // ../commons/src/events/serializers/user/serializer.ts
50
- var import_zod = require("zod");
51
- var SerializedUserField = import_zod.z.object({
52
- $userField: import_zod.z.enum([
53
+ var z = __toESM(require("zod/v4"));
54
+ var SerializedUserField = z.object({
55
+ $userField: z.enum([
53
56
  "id",
54
57
  "name",
55
58
  "role",
@@ -57,7 +60,7 @@ var SerializedUserField = import_zod.z.object({
57
60
  "avatar",
58
61
  "primaryOfficeId"
59
62
  ]),
60
- $location: import_zod.z.string().optional()
63
+ $location: z.string().optional()
61
64
  });
62
65
  function userSerializer(userField) {
63
66
  return {
@@ -77,7 +80,7 @@ function userSerializer(userField) {
77
80
  }
78
81
 
79
82
  // ../commons/src/utils.ts
80
- var z2 = __toESM(require("zod"));
83
+ var z2 = __toESM(require("zod/v4"));
81
84
  var FullNameV1 = z2.array(
82
85
  z2.object({
83
86
  use: z2.string(),
@@ -251,6 +254,34 @@ function getDateRangeToFieldReference(field, comparedField, clause) {
251
254
  required: [field.$$field]
252
255
  };
253
256
  }
257
+ function getDayRangeToFieldReference(field, comparedField, days, clause) {
258
+ return {
259
+ type: "object",
260
+ properties: {
261
+ [field.$$field]: wrapToPath(
262
+ {
263
+ type: "string",
264
+ format: "date",
265
+ daysFromDate: {
266
+ referenceDate: {
267
+ $data: `${field.$$subfield.length + 1}/${jsonFieldPath(
268
+ comparedField
269
+ )}`
270
+ },
271
+ clause,
272
+ days
273
+ }
274
+ },
275
+ field.$$subfield
276
+ ),
277
+ [comparedField.$$field]: wrapToPath(
278
+ { type: "string", format: "date" },
279
+ comparedField.$$subfield
280
+ )
281
+ },
282
+ required: [field.$$field]
283
+ };
284
+ }
254
285
  function defineComparison(field, value, keyword) {
255
286
  if (isFieldReference(value)) {
256
287
  const comparedField = value;
@@ -285,17 +316,45 @@ function defineComparison(field, value, keyword) {
285
316
  required: [field.$$field]
286
317
  });
287
318
  }
319
+ function flag(flagvalue) {
320
+ return defineConditional({
321
+ type: "object",
322
+ properties: {
323
+ $flags: {
324
+ type: "array",
325
+ contains: {
326
+ type: "string",
327
+ const: flagvalue
328
+ }
329
+ }
330
+ },
331
+ required: ["$flags"]
332
+ });
333
+ }
334
+ function status(statusValue) {
335
+ return defineConditional({
336
+ type: "object",
337
+ properties: {
338
+ $status: {
339
+ type: "string",
340
+ const: statusValue
341
+ }
342
+ },
343
+ required: ["$status"]
344
+ });
345
+ }
288
346
  function createFieldConditionals(fieldId) {
289
- const getDayRange = (field, days, clause) => ({
347
+ const getDayRange = (field, days, clause, referenceDate) => ({
290
348
  type: "object",
291
349
  properties: {
292
350
  [field.$$field]: wrapToPath(
293
351
  {
294
352
  type: "string",
295
353
  format: "date",
296
- daysFromNow: {
354
+ daysFromDate: {
297
355
  days,
298
- clause
356
+ clause,
357
+ referenceDate
299
358
  }
300
359
  },
301
360
  field.$$subfield
@@ -348,7 +407,19 @@ function createFieldConditionals(fieldId) {
348
407
  return {
349
408
  days: (days) => ({
350
409
  inPast: () => defineFormConditional(getDayRange(this, -days, "after")),
351
- inFuture: () => defineFormConditional(getDayRange(this, days, "after"))
410
+ inFuture: () => defineFormConditional(getDayRange(this, days, "after")),
411
+ fromDate: (date) => {
412
+ if (isFieldReference(date)) {
413
+ const comparedField = date;
414
+ return defineFormConditional(
415
+ getDayRangeToFieldReference(this, comparedField, days, "after")
416
+ );
417
+ }
418
+ return defineFormConditional(getDayRange(this, days, "after", date));
419
+ },
420
+ fromNow: () => {
421
+ return defineFormConditional(getDayRange(this, days, "after"));
422
+ }
352
423
  }),
353
424
  date: (date) => {
354
425
  if (isFieldReference(date)) {
@@ -370,7 +441,26 @@ function createFieldConditionals(fieldId) {
370
441
  return {
371
442
  days: (days) => ({
372
443
  inPast: () => defineFormConditional(getDayRange(this, -days, "before")),
373
- inFuture: () => defineFormConditional(getDayRange(this, days, "before"))
444
+ inFuture: () => defineFormConditional(getDayRange(this, days, "before")),
445
+ fromDate: (date) => {
446
+ if (isFieldReference(date)) {
447
+ const comparedField = date;
448
+ return defineFormConditional(
449
+ getDayRangeToFieldReference(
450
+ this,
451
+ comparedField,
452
+ -days,
453
+ "before"
454
+ )
455
+ );
456
+ }
457
+ return defineFormConditional(
458
+ getDayRange(this, -days, "before", date)
459
+ );
460
+ },
461
+ fromNow: () => {
462
+ return defineFormConditional(getDayRange(this, -days, "before"));
463
+ }
374
464
  }),
375
465
  date: (date) => {
376
466
  if (isFieldReference(date)) {
@@ -606,3 +696,6 @@ function createFieldConditionals(fieldId) {
606
696
  })
607
697
  };
608
698
  }
699
+
700
+ // src/conditionals/index.ts
701
+ z3.globalRegistry.clear();
@@ -7,16 +7,16 @@ export declare function field(fieldId: string): {
7
7
  fieldId: string;
8
8
  type: "fuzzy";
9
9
  options: {
10
- boost?: number | undefined;
11
10
  fuzziness?: string | number | undefined;
11
+ boost?: number | undefined;
12
12
  } | undefined;
13
13
  };
14
14
  strictMatches: (options?: StrictMatcherOptions) => {
15
15
  fieldId: string;
16
16
  type: "strict";
17
17
  options: {
18
- value?: string | undefined;
19
18
  boost?: number | undefined;
19
+ value?: string | undefined;
20
20
  } | undefined;
21
21
  };
22
22
  dateRangeMatches: (options: DateRangeMatcherOptions) => {
@@ -24,8 +24,8 @@ export declare function field(fieldId: string): {
24
24
  type: "dateRange";
25
25
  options: {
26
26
  days: number;
27
- boost?: number | undefined;
28
27
  pivot?: number | undefined;
28
+ boost?: number | undefined;
29
29
  };
30
30
  };
31
31
  };