@opencrvs/toolkit 1.9.6-rc.cb62364 → 1.9.6-rc.d73f8b6

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,7 +1768,7 @@ 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.ZodEffects<z.ZodObject<{
1771
+ defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
1772
1772
  $$date: z.ZodOptional<z.ZodLiteral<"now">>;
1773
1773
  $$time: z.ZodOptional<z.ZodLiteral<"now">>;
1774
1774
  }, "strip", z.ZodTypeAny, {
@@ -1777,9 +1777,7 @@ declare const DateField: z.ZodObject<z.objectUtil.extendShape<{
1777
1777
  }, {
1778
1778
  $$date?: "now" | undefined;
1779
1779
  $$time?: "now" | undefined;
1780
- }>, {
1781
- $$date: "now";
1782
- }, {
1780
+ }>, z.ZodLiteral<"$$date">]>, z.ZodLiteral<"$$time">]>, "$$date", "$$date" | "$$time" | {
1783
1781
  $$date?: "now" | undefined;
1784
1782
  $$time?: "now" | undefined;
1785
1783
  }>, z.ZodString]>>;
@@ -1839,9 +1837,7 @@ declare const DateField: z.ZodObject<z.objectUtil.extendShape<{
1839
1837
  hideLabel?: boolean | undefined;
1840
1838
  uncorrectable?: boolean | undefined;
1841
1839
  analytics?: boolean | undefined;
1842
- defaultValue?: string | {
1843
- $$date: "now";
1844
- } | undefined;
1840
+ defaultValue?: string | undefined;
1845
1841
  configuration?: {
1846
1842
  notice?: TranslationConfig | undefined;
1847
1843
  } | undefined;
@@ -2284,7 +2280,7 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2284
2280
  analytics: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2285
2281
  }, {
2286
2282
  type: z.ZodLiteral<"TIME">;
2287
- defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodObject<{
2283
+ defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
2288
2284
  $$date: z.ZodOptional<z.ZodLiteral<"now">>;
2289
2285
  $$time: z.ZodOptional<z.ZodLiteral<"now">>;
2290
2286
  }, "strip", z.ZodTypeAny, {
@@ -2293,9 +2289,7 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2293
2289
  }, {
2294
2290
  $$date?: "now" | undefined;
2295
2291
  $$time?: "now" | undefined;
2296
- }>, {
2297
- $$time: "now";
2298
- }, {
2292
+ }>, z.ZodLiteral<"$$date">]>, z.ZodLiteral<"$$time">]>, "$$time", "$$date" | "$$time" | {
2299
2293
  $$date?: "now" | undefined;
2300
2294
  $$time?: "now" | undefined;
2301
2295
  }>, z.ZodString]>>;
@@ -2358,9 +2352,7 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2358
2352
  hideLabel?: boolean | undefined;
2359
2353
  uncorrectable?: boolean | undefined;
2360
2354
  analytics?: boolean | undefined;
2361
- defaultValue?: string | {
2362
- $$time: "now";
2363
- } | undefined;
2355
+ defaultValue?: string | undefined;
2364
2356
  configuration?: {
2365
2357
  notice?: TranslationConfig | undefined;
2366
2358
  use12HourFormat?: boolean | undefined;
@@ -38,6 +38,7 @@ export declare const AgeUpdateValue: z.ZodNullable<z.ZodOptional<z.ZodObject<{
38
38
  asOfDateRef: string;
39
39
  }>>>;
40
40
  export declare const TimeValue: z.ZodString;
41
+ export type TimeValue = z.infer<typeof TimeValue>;
41
42
  export declare const DatetimeValue: z.ZodString;
42
43
  export declare const SelectDateRangeValue: z.ZodEnum<["last7Days", "last30Days", "last90Days", "last365Days"]>;
43
44
  export declare const DateRangeFieldValue: z.ZodUnion<[z.ZodObject<{
@@ -112,7 +112,7 @@ var import_zod2 = require("zod");
112
112
  var SerializedNowDateTime = import_zod2.z.object({
113
113
  $$date: import_zod2.z.literal("now").optional(),
114
114
  $$time: import_zod2.z.literal("now").optional()
115
- });
115
+ }).or(import_zod2.z.literal("$$date")).or(import_zod2.z.literal("$$time"));
116
116
  function todayDateTimeValueSerializer() {
117
117
  return {
118
118
  $$date: "now",
@@ -1911,7 +1911,7 @@ var import_zod15 = require("zod");
1911
1911
  var SerializedNowDateTime = import_zod15.z.object({
1912
1912
  $$date: import_zod15.z.literal("now").optional(),
1913
1913
  $$time: import_zod15.z.literal("now").optional()
1914
- });
1914
+ }).or(import_zod15.z.literal("$$date")).or(import_zod15.z.literal("$$time"));
1915
1915
  function todayDateTimeValueSerializer() {
1916
1916
  return {
1917
1917
  $$date: "now",
@@ -2052,9 +2052,7 @@ var EmailField = BaseField.extend({
2052
2052
  });
2053
2053
  var DateField = BaseField.extend({
2054
2054
  type: import_zod16.z.literal(FieldType.DATE),
2055
- defaultValue: SerializedNowDateTime.transform(() => ({
2056
- $$date: "now"
2057
- })).or(DateValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default date value(yyyy-MM-dd)"),
2055
+ defaultValue: SerializedNowDateTime.transform(() => "$$date").or(DateValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default date value(yyyy-MM-dd)"),
2058
2056
  configuration: import_zod16.z.object({
2059
2057
  notice: TranslationConfig.describe(
2060
2058
  "Text to display above the date input"
@@ -2072,9 +2070,7 @@ var AgeField = BaseField.extend({
2072
2070
  }).describe("An age input field which uses the current date as the asOfDate");
2073
2071
  var TimeField = BaseField.extend({
2074
2072
  type: import_zod16.z.literal(FieldType.TIME),
2075
- defaultValue: SerializedNowDateTime.transform(() => ({
2076
- $$time: "now"
2077
- })).or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
2073
+ defaultValue: SerializedNowDateTime.transform(() => "$$time").or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
2078
2074
  configuration: import_zod16.z.object({
2079
2075
  use12HourFormat: import_zod16.z.boolean().optional().describe("Whether to use 12-hour format"),
2080
2076
  notice: TranslationConfig.describe(
@@ -8897,8 +8893,12 @@ var window2 = () => ({
8897
8893
  }
8898
8894
  }
8899
8895
  });
8896
+ var KNOWN_SYSTEM_KEYS = ["$$date", "$$time"];
8900
8897
  function isTemplateVariable(value) {
8901
- return typeof value === "string" && value.startsWith("$");
8898
+ if (typeof value === "string" && KNOWN_SYSTEM_KEYS.includes(value)) {
8899
+ return true;
8900
+ }
8901
+ return false;
8902
8902
  }
8903
8903
  function isFieldValue(value) {
8904
8904
  return FieldValue.safeParse(value).success;
@@ -8907,8 +8907,7 @@ function isFieldValueWithoutTemplates(value) {
8907
8907
  if (isTemplateVariable(value)) {
8908
8908
  return false;
8909
8909
  }
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)))) {
8910
+ if (typeof value === "object" && value !== null && Object.values(value).some((val) => isTemplateVariable(val))) {
8912
8911
  return false;
8913
8912
  }
8914
8913
  return true;
@@ -1433,7 +1433,7 @@ var import_zod15 = require("zod");
1433
1433
  var SerializedNowDateTime = import_zod15.z.object({
1434
1434
  $$date: import_zod15.z.literal("now").optional(),
1435
1435
  $$time: import_zod15.z.literal("now").optional()
1436
- });
1436
+ }).or(import_zod15.z.literal("$$date")).or(import_zod15.z.literal("$$time"));
1437
1437
  function todayDateTimeValueSerializer() {
1438
1438
  return {
1439
1439
  $$date: "now",
@@ -1574,9 +1574,7 @@ var EmailField = BaseField.extend({
1574
1574
  });
1575
1575
  var DateField = BaseField.extend({
1576
1576
  type: import_zod16.z.literal(FieldType.DATE),
1577
- defaultValue: SerializedNowDateTime.transform(() => ({
1578
- $$date: "now"
1579
- })).or(DateValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default date value(yyyy-MM-dd)"),
1577
+ defaultValue: SerializedNowDateTime.transform(() => "$$date").or(DateValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default date value(yyyy-MM-dd)"),
1580
1578
  configuration: import_zod16.z.object({
1581
1579
  notice: TranslationConfig.describe(
1582
1580
  "Text to display above the date input"
@@ -1594,9 +1592,7 @@ var AgeField = BaseField.extend({
1594
1592
  }).describe("An age input field which uses the current date as the asOfDate");
1595
1593
  var TimeField = BaseField.extend({
1596
1594
  type: import_zod16.z.literal(FieldType.TIME),
1597
- defaultValue: SerializedNowDateTime.transform(() => ({
1598
- $$time: "now"
1599
- })).or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
1595
+ defaultValue: SerializedNowDateTime.transform(() => "$$time").or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
1600
1596
  configuration: import_zod16.z.object({
1601
1597
  use12HourFormat: import_zod16.z.boolean().optional().describe("Whether to use 12-hour format"),
1602
1598
  notice: TranslationConfig.describe(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.9.6-rc.cb62364",
3
+ "version": "1.9.6-rc.d73f8b6",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {