@opencrvs/toolkit 1.9.6-rc.78b4928 → 1.9.6-rc.7fd066c

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.
@@ -1768,15 +1768,20 @@ declare const DateField: z.ZodObject<z.objectUtil.extendShape<{
1768
1768
  analytics: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1769
1769
  }, {
1770
1770
  type: z.ZodLiteral<"DATE">;
1771
- defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
1772
- $$date: z.ZodLiteral<"now">;
1773
- $$time: z.ZodLiteral<"now">;
1771
+ defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodObject<{
1772
+ $$date: z.ZodOptional<z.ZodLiteral<"now">>;
1773
+ $$time: z.ZodOptional<z.ZodLiteral<"now">>;
1774
1774
  }, "strip", z.ZodTypeAny, {
1775
- $$date: "now";
1776
- $$time: "now";
1775
+ $$date?: "now" | undefined;
1776
+ $$time?: "now" | undefined;
1777
1777
  }, {
1778
+ $$date?: "now" | undefined;
1779
+ $$time?: "now" | undefined;
1780
+ }>, {
1778
1781
  $$date: "now";
1779
- $$time: "now";
1782
+ }, {
1783
+ $$date?: "now" | undefined;
1784
+ $$time?: "now" | undefined;
1780
1785
  }>, z.ZodString]>>;
1781
1786
  configuration: z.ZodOptional<z.ZodObject<{
1782
1787
  notice: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
@@ -1836,7 +1841,6 @@ declare const DateField: z.ZodObject<z.objectUtil.extendShape<{
1836
1841
  analytics?: boolean | undefined;
1837
1842
  defaultValue?: string | {
1838
1843
  $$date: "now";
1839
- $$time: "now";
1840
1844
  } | undefined;
1841
1845
  configuration?: {
1842
1846
  notice?: TranslationConfig | undefined;
@@ -1903,8 +1907,8 @@ declare const DateField: z.ZodObject<z.objectUtil.extendShape<{
1903
1907
  uncorrectable?: boolean | undefined;
1904
1908
  analytics?: boolean | undefined;
1905
1909
  defaultValue?: string | {
1906
- $$date: "now";
1907
- $$time: "now";
1910
+ $$date?: "now" | undefined;
1911
+ $$time?: "now" | undefined;
1908
1912
  } | undefined;
1909
1913
  configuration?: {
1910
1914
  notice?: {
@@ -2280,15 +2284,20 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2280
2284
  analytics: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2281
2285
  }, {
2282
2286
  type: z.ZodLiteral<"TIME">;
2283
- defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
2284
- $$date: z.ZodLiteral<"now">;
2285
- $$time: z.ZodLiteral<"now">;
2287
+ defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodObject<{
2288
+ $$date: z.ZodOptional<z.ZodLiteral<"now">>;
2289
+ $$time: z.ZodOptional<z.ZodLiteral<"now">>;
2286
2290
  }, "strip", z.ZodTypeAny, {
2287
- $$date: "now";
2288
- $$time: "now";
2291
+ $$date?: "now" | undefined;
2292
+ $$time?: "now" | undefined;
2289
2293
  }, {
2290
- $$date: "now";
2294
+ $$date?: "now" | undefined;
2295
+ $$time?: "now" | undefined;
2296
+ }>, {
2291
2297
  $$time: "now";
2298
+ }, {
2299
+ $$date?: "now" | undefined;
2300
+ $$time?: "now" | undefined;
2292
2301
  }>, z.ZodString]>>;
2293
2302
  configuration: z.ZodOptional<z.ZodObject<{
2294
2303
  use12HourFormat: z.ZodOptional<z.ZodBoolean>;
@@ -2350,7 +2359,6 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2350
2359
  uncorrectable?: boolean | undefined;
2351
2360
  analytics?: boolean | undefined;
2352
2361
  defaultValue?: string | {
2353
- $$date: "now";
2354
2362
  $$time: "now";
2355
2363
  } | undefined;
2356
2364
  configuration?: {
@@ -2419,8 +2427,8 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2419
2427
  uncorrectable?: boolean | undefined;
2420
2428
  analytics?: boolean | undefined;
2421
2429
  defaultValue?: string | {
2422
- $$date: "now";
2423
- $$time: "now";
2430
+ $$date?: "now" | undefined;
2431
+ $$time?: "now" | undefined;
2424
2432
  } | undefined;
2425
2433
  configuration?: {
2426
2434
  notice?: {
@@ -2432,6 +2440,7 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2432
2440
  } | undefined;
2433
2441
  }>;
2434
2442
  export type TimeField = z.infer<typeof TimeField>;
2443
+ export type TimeField2 = z.input<typeof TimeField>;
2435
2444
  declare const DateRangeField: z.ZodObject<z.objectUtil.extendShape<{
2436
2445
  id: z.ZodEffects<z.ZodString, string, string>;
2437
2446
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
@@ -8,6 +8,8 @@ import { FieldValue } from './FieldValue';
8
8
  * Available system variables for configuration.
9
9
  */
10
10
  export type SystemVariables = {
11
+ $$date: string;
12
+ $$time: string;
11
13
  user: {
12
14
  id: string;
13
15
  province?: string;
@@ -110,8 +110,8 @@ function omitKeyDeep(obj, keyToRemove) {
110
110
  // ../commons/src/events/serializers/date/serializer.ts
111
111
  var import_zod2 = require("zod");
112
112
  var SerializedNowDateTime = import_zod2.z.object({
113
- $$date: import_zod2.z.literal("now"),
114
- $$time: import_zod2.z.literal("now")
113
+ $$date: import_zod2.z.literal("now").optional(),
114
+ $$time: import_zod2.z.literal("now").optional()
115
115
  });
116
116
  function todayDateTimeValueSerializer() {
117
117
  return {
@@ -1909,8 +1909,8 @@ var SearchScopeAccessLevels = {
1909
1909
  // ../commons/src/events/serializers/date/serializer.ts
1910
1910
  var import_zod15 = require("zod");
1911
1911
  var SerializedNowDateTime = import_zod15.z.object({
1912
- $$date: import_zod15.z.literal("now"),
1913
- $$time: import_zod15.z.literal("now")
1912
+ $$date: import_zod15.z.literal("now").optional(),
1913
+ $$time: import_zod15.z.literal("now").optional()
1914
1914
  });
1915
1915
  function todayDateTimeValueSerializer() {
1916
1916
  return {
@@ -2052,7 +2052,9 @@ var EmailField = BaseField.extend({
2052
2052
  });
2053
2053
  var DateField = BaseField.extend({
2054
2054
  type: import_zod16.z.literal(FieldType.DATE),
2055
- defaultValue: SerializedNowDateTime.or(DateValue).optional(),
2055
+ defaultValue: SerializedNowDateTime.transform(() => ({
2056
+ $$date: "now"
2057
+ })).or(DateValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default date value(yyyy-MM-dd)"),
2056
2058
  configuration: import_zod16.z.object({
2057
2059
  notice: TranslationConfig.describe(
2058
2060
  "Text to display above the date input"
@@ -2070,7 +2072,9 @@ var AgeField = BaseField.extend({
2070
2072
  }).describe("An age input field which uses the current date as the asOfDate");
2071
2073
  var TimeField = BaseField.extend({
2072
2074
  type: import_zod16.z.literal(FieldType.TIME),
2073
- defaultValue: SerializedNowDateTime.or(TimeValue).optional(),
2075
+ defaultValue: SerializedNowDateTime.transform(() => ({
2076
+ $$time: "now"
2077
+ })).or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
2074
2078
  configuration: import_zod16.z.object({
2075
2079
  use12HourFormat: import_zod16.z.boolean().optional().describe("Whether to use 12-hour format"),
2076
2080
  notice: TranslationConfig.describe(
@@ -8903,7 +8907,8 @@ function isFieldValueWithoutTemplates(value) {
8903
8907
  if (isTemplateVariable(value)) {
8904
8908
  return false;
8905
8909
  }
8906
- if (typeof value === "object" && value !== null && Object.values(value).some((val) => isTemplateVariable(val))) {
8910
+ if (typeof value === "object" && value !== null && // template variable can exist in both keys and values of an object
8911
+ (Object.values(value).some((val) => isTemplateVariable(val)) || Object.keys(value).some((val) => isTemplateVariable(val)))) {
8907
8912
  return false;
8908
8913
  }
8909
8914
  return true;
@@ -1431,8 +1431,8 @@ var SearchQuery = import_zod14.z.object({
1431
1431
  // ../commons/src/events/serializers/date/serializer.ts
1432
1432
  var import_zod15 = require("zod");
1433
1433
  var SerializedNowDateTime = import_zod15.z.object({
1434
- $$date: import_zod15.z.literal("now"),
1435
- $$time: import_zod15.z.literal("now")
1434
+ $$date: import_zod15.z.literal("now").optional(),
1435
+ $$time: import_zod15.z.literal("now").optional()
1436
1436
  });
1437
1437
  function todayDateTimeValueSerializer() {
1438
1438
  return {
@@ -1574,7 +1574,9 @@ var EmailField = BaseField.extend({
1574
1574
  });
1575
1575
  var DateField = BaseField.extend({
1576
1576
  type: import_zod16.z.literal(FieldType.DATE),
1577
- defaultValue: SerializedNowDateTime.or(DateValue).optional(),
1577
+ defaultValue: SerializedNowDateTime.transform(() => ({
1578
+ $$date: "now"
1579
+ })).or(DateValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default date value(yyyy-MM-dd)"),
1578
1580
  configuration: import_zod16.z.object({
1579
1581
  notice: TranslationConfig.describe(
1580
1582
  "Text to display above the date input"
@@ -1592,7 +1594,9 @@ var AgeField = BaseField.extend({
1592
1594
  }).describe("An age input field which uses the current date as the asOfDate");
1593
1595
  var TimeField = BaseField.extend({
1594
1596
  type: import_zod16.z.literal(FieldType.TIME),
1595
- defaultValue: SerializedNowDateTime.or(TimeValue).optional(),
1597
+ defaultValue: SerializedNowDateTime.transform(() => ({
1598
+ $$time: "now"
1599
+ })).or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
1596
1600
  configuration: import_zod16.z.object({
1597
1601
  use12HourFormat: import_zod16.z.boolean().optional().describe("Whether to use 12-hour format"),
1598
1602
  notice: TranslationConfig.describe(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.9.6-rc.78b4928",
3
+ "version": "1.9.6-rc.7fd066c",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {