@opencrvs/toolkit 1.9.6-rc.489ac9f → 1.9.6-rc.5fa8b99

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,21 +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<{
1772
- $$date: z.ZodOptional<z.ZodLiteral<"now">>;
1773
- $$time: z.ZodOptional<z.ZodLiteral<"now">>;
1774
- }, "strip", z.ZodTypeAny, {
1775
- $$date?: "now" | undefined;
1776
- $$time?: "now" | undefined;
1777
- }, {
1778
- $$date?: "now" | undefined;
1779
- $$time?: "now" | undefined;
1780
- }>, {
1781
- $$date: "now";
1782
- }, {
1783
- $$date?: "now" | undefined;
1784
- $$time?: "now" | undefined;
1785
- }>, z.ZodString]>>;
1771
+ defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"$$now">, z.ZodString]>>;
1786
1772
  configuration: z.ZodOptional<z.ZodObject<{
1787
1773
  notice: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
1788
1774
  id: string;
@@ -1839,9 +1825,7 @@ declare const DateField: z.ZodObject<z.objectUtil.extendShape<{
1839
1825
  hideLabel?: boolean | undefined;
1840
1826
  uncorrectable?: boolean | undefined;
1841
1827
  analytics?: boolean | undefined;
1842
- defaultValue?: string | {
1843
- $$date: "now";
1844
- } | undefined;
1828
+ defaultValue?: string | undefined;
1845
1829
  configuration?: {
1846
1830
  notice?: TranslationConfig | undefined;
1847
1831
  } | undefined;
@@ -1906,10 +1890,7 @@ declare const DateField: z.ZodObject<z.objectUtil.extendShape<{
1906
1890
  hideLabel?: boolean | undefined;
1907
1891
  uncorrectable?: boolean | undefined;
1908
1892
  analytics?: boolean | undefined;
1909
- defaultValue?: string | {
1910
- $$date?: "now" | undefined;
1911
- $$time?: "now" | undefined;
1912
- } | undefined;
1893
+ defaultValue?: string | undefined;
1913
1894
  configuration?: {
1914
1895
  notice?: {
1915
1896
  id: string;
@@ -2284,21 +2265,7 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2284
2265
  analytics: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2285
2266
  }, {
2286
2267
  type: z.ZodLiteral<"TIME">;
2287
- defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodObject<{
2288
- $$date: z.ZodOptional<z.ZodLiteral<"now">>;
2289
- $$time: z.ZodOptional<z.ZodLiteral<"now">>;
2290
- }, "strip", z.ZodTypeAny, {
2291
- $$date?: "now" | undefined;
2292
- $$time?: "now" | undefined;
2293
- }, {
2294
- $$date?: "now" | undefined;
2295
- $$time?: "now" | undefined;
2296
- }>, {
2297
- $$time: "now";
2298
- }, {
2299
- $$date?: "now" | undefined;
2300
- $$time?: "now" | undefined;
2301
- }>, z.ZodString]>>;
2268
+ defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"$$now">, z.ZodString]>>;
2302
2269
  configuration: z.ZodOptional<z.ZodObject<{
2303
2270
  use12HourFormat: z.ZodOptional<z.ZodBoolean>;
2304
2271
  notice: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
@@ -2358,9 +2325,7 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2358
2325
  hideLabel?: boolean | undefined;
2359
2326
  uncorrectable?: boolean | undefined;
2360
2327
  analytics?: boolean | undefined;
2361
- defaultValue?: string | {
2362
- $$time: "now";
2363
- } | undefined;
2328
+ defaultValue?: string | undefined;
2364
2329
  configuration?: {
2365
2330
  notice?: TranslationConfig | undefined;
2366
2331
  use12HourFormat?: boolean | undefined;
@@ -2426,10 +2391,7 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2426
2391
  hideLabel?: boolean | undefined;
2427
2392
  uncorrectable?: boolean | undefined;
2428
2393
  analytics?: boolean | undefined;
2429
- defaultValue?: string | {
2430
- $$date?: "now" | undefined;
2431
- $$time?: "now" | undefined;
2432
- } | undefined;
2394
+ defaultValue?: string | undefined;
2433
2395
  configuration?: {
2434
2396
  notice?: {
2435
2397
  id: string;
@@ -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<{
@@ -8,8 +8,6 @@ import { FieldValue } from './FieldValue';
8
8
  * Available system variables for configuration.
9
9
  */
10
10
  export type SystemVariables = {
11
- $$date: string;
12
- $$time: string;
13
11
  user: {
14
12
  id: string;
15
13
  province?: string;
@@ -109,15 +109,9 @@ function omitKeyDeep(obj, keyToRemove) {
109
109
 
110
110
  // ../commons/src/events/serializers/date/serializer.ts
111
111
  var import_zod2 = require("zod");
112
- var SerializedNowDateTime = import_zod2.z.object({
113
- $$date: import_zod2.z.literal("now").optional(),
114
- $$time: import_zod2.z.literal("now").optional()
115
- });
112
+ var SerializedNowDateTime = import_zod2.z.literal("$$now");
116
113
  function todayDateTimeValueSerializer() {
117
- return {
118
- $$date: "now",
119
- $$time: "now"
120
- };
114
+ return "$$now";
121
115
  }
122
116
 
123
117
  // ../commons/src/conditionals/conditionals.ts
@@ -1908,15 +1908,9 @@ var SearchScopeAccessLevels = {
1908
1908
 
1909
1909
  // ../commons/src/events/serializers/date/serializer.ts
1910
1910
  var import_zod15 = require("zod");
1911
- var SerializedNowDateTime = import_zod15.z.object({
1912
- $$date: import_zod15.z.literal("now").optional(),
1913
- $$time: import_zod15.z.literal("now").optional()
1914
- });
1911
+ var SerializedNowDateTime = import_zod15.z.literal("$$now");
1915
1912
  function todayDateTimeValueSerializer() {
1916
- return {
1917
- $$date: "now",
1918
- $$time: "now"
1919
- };
1913
+ return "$$now";
1920
1914
  }
1921
1915
 
1922
1916
  // ../commons/src/events/FieldConfig.ts
@@ -2052,9 +2046,7 @@ var EmailField = BaseField.extend({
2052
2046
  });
2053
2047
  var DateField = BaseField.extend({
2054
2048
  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)"),
2049
+ defaultValue: SerializedNowDateTime.or(DateValue).optional().openapi({ effectType: "input", type: "string" }).describe("Default date value(yyyy-MM-dd)"),
2058
2050
  configuration: import_zod16.z.object({
2059
2051
  notice: TranslationConfig.describe(
2060
2052
  "Text to display above the date input"
@@ -2072,9 +2064,7 @@ var AgeField = BaseField.extend({
2072
2064
  }).describe("An age input field which uses the current date as the asOfDate");
2073
2065
  var TimeField = BaseField.extend({
2074
2066
  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)"),
2067
+ defaultValue: SerializedNowDateTime.or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
2078
2068
  configuration: import_zod16.z.object({
2079
2069
  use12HourFormat: import_zod16.z.boolean().optional().describe("Whether to use 12-hour format"),
2080
2070
  notice: TranslationConfig.describe(
@@ -8897,8 +8887,12 @@ var window2 = () => ({
8897
8887
  }
8898
8888
  }
8899
8889
  });
8890
+ var KNOWN_SYSTEM_KEYS = ["$$date", "$$time"];
8900
8891
  function isTemplateVariable(value) {
8901
- return typeof value === "string" && value.startsWith("$");
8892
+ if (typeof value === "string" && KNOWN_SYSTEM_KEYS.includes(value)) {
8893
+ return true;
8894
+ }
8895
+ return false;
8902
8896
  }
8903
8897
  function isFieldValue(value) {
8904
8898
  return FieldValue.safeParse(value).success;
@@ -8907,8 +8901,7 @@ function isFieldValueWithoutTemplates(value) {
8907
8901
  if (isTemplateVariable(value)) {
8908
8902
  return false;
8909
8903
  }
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)))) {
8904
+ if (typeof value === "object" && value !== null && Object.values(value).some((val) => isTemplateVariable(val))) {
8912
8905
  return false;
8913
8906
  }
8914
8907
  return true;
@@ -1430,15 +1430,9 @@ var SearchQuery = import_zod14.z.object({
1430
1430
 
1431
1431
  // ../commons/src/events/serializers/date/serializer.ts
1432
1432
  var import_zod15 = require("zod");
1433
- var SerializedNowDateTime = import_zod15.z.object({
1434
- $$date: import_zod15.z.literal("now").optional(),
1435
- $$time: import_zod15.z.literal("now").optional()
1436
- });
1433
+ var SerializedNowDateTime = import_zod15.z.literal("$$now");
1437
1434
  function todayDateTimeValueSerializer() {
1438
- return {
1439
- $$date: "now",
1440
- $$time: "now"
1441
- };
1435
+ return "$$now";
1442
1436
  }
1443
1437
 
1444
1438
  // ../commons/src/events/FieldConfig.ts
@@ -1574,9 +1568,7 @@ var EmailField = BaseField.extend({
1574
1568
  });
1575
1569
  var DateField = BaseField.extend({
1576
1570
  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)"),
1571
+ defaultValue: SerializedNowDateTime.or(DateValue).optional().openapi({ effectType: "input", type: "string" }).describe("Default date value(yyyy-MM-dd)"),
1580
1572
  configuration: import_zod16.z.object({
1581
1573
  notice: TranslationConfig.describe(
1582
1574
  "Text to display above the date input"
@@ -1594,9 +1586,7 @@ var AgeField = BaseField.extend({
1594
1586
  }).describe("An age input field which uses the current date as the asOfDate");
1595
1587
  var TimeField = BaseField.extend({
1596
1588
  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)"),
1589
+ defaultValue: SerializedNowDateTime.or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
1600
1590
  configuration: import_zod16.z.object({
1601
1591
  use12HourFormat: import_zod16.z.boolean().optional().describe("Whether to use 12-hour format"),
1602
1592
  notice: TranslationConfig.describe(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.9.6-rc.489ac9f",
3
+ "version": "1.9.6-rc.5fa8b99",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {