@opencrvs/toolkit 1.9.6-rc.01f84ce → 1.9.6-rc.0dc792c

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,13 @@ 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.ZodObject<{
1772
+ $$now: z.ZodLiteral<true>;
1773
+ }, "strip", z.ZodTypeAny, {
1774
+ $$now: true;
1775
+ }, {
1776
+ $$now: true;
1777
+ }>, z.ZodString]>>;
1772
1778
  configuration: z.ZodOptional<z.ZodObject<{
1773
1779
  notice: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
1774
1780
  id: string;
@@ -1825,7 +1831,9 @@ declare const DateField: z.ZodObject<z.objectUtil.extendShape<{
1825
1831
  hideLabel?: boolean | undefined;
1826
1832
  uncorrectable?: boolean | undefined;
1827
1833
  analytics?: boolean | undefined;
1828
- defaultValue?: string | undefined;
1834
+ defaultValue?: string | {
1835
+ $$now: true;
1836
+ } | undefined;
1829
1837
  configuration?: {
1830
1838
  notice?: TranslationConfig | undefined;
1831
1839
  } | undefined;
@@ -1890,7 +1898,9 @@ declare const DateField: z.ZodObject<z.objectUtil.extendShape<{
1890
1898
  hideLabel?: boolean | undefined;
1891
1899
  uncorrectable?: boolean | undefined;
1892
1900
  analytics?: boolean | undefined;
1893
- defaultValue?: string | undefined;
1901
+ defaultValue?: string | {
1902
+ $$now: true;
1903
+ } | undefined;
1894
1904
  configuration?: {
1895
1905
  notice?: {
1896
1906
  id: string;
@@ -2265,7 +2275,13 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2265
2275
  analytics: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2266
2276
  }, {
2267
2277
  type: z.ZodLiteral<"TIME">;
2268
- defaultValue: z.ZodOptional<z.ZodString>;
2278
+ defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
2279
+ $$now: z.ZodLiteral<true>;
2280
+ }, "strip", z.ZodTypeAny, {
2281
+ $$now: true;
2282
+ }, {
2283
+ $$now: true;
2284
+ }>, z.ZodString]>>;
2269
2285
  configuration: z.ZodOptional<z.ZodObject<{
2270
2286
  use12HourFormat: z.ZodOptional<z.ZodBoolean>;
2271
2287
  notice: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
@@ -2325,7 +2341,9 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2325
2341
  hideLabel?: boolean | undefined;
2326
2342
  uncorrectable?: boolean | undefined;
2327
2343
  analytics?: boolean | undefined;
2328
- defaultValue?: string | undefined;
2344
+ defaultValue?: string | {
2345
+ $$now: true;
2346
+ } | undefined;
2329
2347
  configuration?: {
2330
2348
  notice?: TranslationConfig | undefined;
2331
2349
  use12HourFormat?: boolean | undefined;
@@ -2391,7 +2409,9 @@ declare const TimeField: z.ZodObject<z.objectUtil.extendShape<{
2391
2409
  hideLabel?: boolean | undefined;
2392
2410
  uncorrectable?: boolean | undefined;
2393
2411
  analytics?: boolean | undefined;
2394
- defaultValue?: string | undefined;
2412
+ defaultValue?: string | {
2413
+ $$now: true;
2414
+ } | undefined;
2395
2415
  configuration?: {
2396
2416
  notice?: {
2397
2417
  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<{
@@ -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,15 @@ 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.object({
113
+ $$now: import_zod2.z.literal(true)
114
+ });
115
+ function todayDateTimeValueSerializer() {
116
+ return { $$now: true };
117
+ }
118
+
109
119
  // ../commons/src/conditionals/conditionals.ts
110
120
  function defineConditional(schema) {
111
121
  const schemaWithooutIDRef = omitKeyDeep(schema, "$id");
@@ -179,6 +189,7 @@ function wrapToPathOptional(condition, path) {
179
189
  };
180
190
  }, condition);
181
191
  }
192
+ var now = Object.assign(todayDateTimeValueSerializer, {});
182
193
  var user = Object.assign(userSerializer, {
183
194
  hasScope: (scope) => defineConditional({
184
195
  type: "object",