@opencrvs/toolkit 1.9.6-rc.54e1cbb → 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.
@@ -4,6 +4,7 @@ import { ITokenPayload as TokenPayload, Scope } from '../authentication';
4
4
  import { PartialSchema as AjvJSONSchemaType } from 'ajv/dist/types/json-schema';
5
5
  import { userSerializer } from '../events/serializers/user/serializer';
6
6
  import { UUID } from '../uuid';
7
+ import { todayDateTimeValueSerializer } from '../events/serializers/date/serializer';
7
8
  /** @knipignore */
8
9
  export type JSONSchema = {
9
10
  $id: string;
@@ -64,6 +65,10 @@ type FieldReference = {
64
65
  $$field: string;
65
66
  $$subfield: string[];
66
67
  };
68
+ /**
69
+ * Generate conditional rules for current date
70
+ */
71
+ export declare const now: typeof todayDateTimeValueSerializer;
67
72
  /**
68
73
  *
69
74
  * Generate conditional rules for user.
@@ -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.ZodString>;
1771
+ defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"$$now">, z.ZodString]>>;
1772
1772
  configuration: z.ZodOptional<z.ZodObject<{
1773
1773
  notice: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
1774
1774
  id: string;
@@ -2265,7 +2265,7 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2265
2265
  analytics: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2266
2266
  }, {
2267
2267
  type: z.ZodLiteral<"TIME">;
2268
- defaultValue: z.ZodOptional<z.ZodString>;
2268
+ defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"$$now">, z.ZodString]>>;
2269
2269
  configuration: z.ZodOptional<z.ZodObject<{
2270
2270
  use12HourFormat: z.ZodOptional<z.ZodBoolean>;
2271
2271
  notice: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
@@ -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<{
@@ -38,6 +38,7 @@ __export(conditionals_exports, {
38
38
  isFieldReference: () => isFieldReference,
39
39
  never: () => never,
40
40
  not: () => not,
41
+ now: () => now,
41
42
  or: () => or,
42
43
  user: () => user
43
44
  });
@@ -106,6 +107,13 @@ function omitKeyDeep(obj, keyToRemove) {
106
107
  return newObj;
107
108
  }
108
109
 
110
+ // ../commons/src/events/serializers/date/serializer.ts
111
+ var import_zod2 = require("zod");
112
+ var SerializedNowDateTime = import_zod2.z.literal("$$now");
113
+ function todayDateTimeValueSerializer() {
114
+ return "$$now";
115
+ }
116
+
109
117
  // ../commons/src/conditionals/conditionals.ts
110
118
  function defineConditional(schema) {
111
119
  const schemaWithooutIDRef = omitKeyDeep(schema, "$id");
@@ -179,6 +187,7 @@ function wrapToPathOptional(condition, path) {
179
187
  };
180
188
  }, condition);
181
189
  }
190
+ var now = Object.assign(todayDateTimeValueSerializer, {});
182
191
  var user = Object.assign(userSerializer, {
183
192
  hasScope: (scope) => defineConditional({
184
193
  type: "object",