@opencrvs/mosip 2.0.0-rc.2 → 2.0.0-rc.20260515

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.
package/build/api.d.ts CHANGED
@@ -8,6 +8,15 @@ export declare const DeathRequestFieldsSchema: z.ZodObject<{
8
8
  deathCertificateNumber: z.ZodString;
9
9
  birthCertificateNumber: z.ZodOptional<z.ZodUndefined>;
10
10
  }, z.core.$loose>;
11
+ export declare const CorrectionRequestFieldsSchema: z.ZodObject<{
12
+ VID: z.ZodString;
13
+ fullName: z.ZodOptional<z.ZodString>;
14
+ dateOfBirth: z.ZodOptional<z.ZodString>;
15
+ gender: z.ZodOptional<z.ZodString>;
16
+ introducerInfoToken: z.ZodOptional<z.ZodString>;
17
+ birthCertificateNumber: z.ZodOptional<z.ZodUndefined>;
18
+ deathCertificateNumber: z.ZodOptional<z.ZodUndefined>;
19
+ }, z.core.$loose>;
11
20
  export declare const MosipNotificationSchema: z.ZodObject<{
12
21
  recipientFullName: z.ZodString;
13
22
  recipientEmail: z.ZodString;
@@ -26,11 +35,37 @@ export declare const MosipInteropPayloadSchema: z.ZodObject<{
26
35
  }, z.core.$loose>, z.ZodObject<{
27
36
  deathCertificateNumber: z.ZodString;
28
37
  birthCertificateNumber: z.ZodOptional<z.ZodUndefined>;
38
+ }, z.core.$loose>, z.ZodObject<{
39
+ VID: z.ZodString;
40
+ fullName: z.ZodOptional<z.ZodString>;
41
+ dateOfBirth: z.ZodOptional<z.ZodString>;
42
+ gender: z.ZodOptional<z.ZodString>;
43
+ introducerInfoToken: z.ZodOptional<z.ZodString>;
44
+ birthCertificateNumber: z.ZodOptional<z.ZodUndefined>;
45
+ deathCertificateNumber: z.ZodOptional<z.ZodUndefined>;
29
46
  }, z.core.$loose>]>;
30
47
  schemaJson: z.ZodOptional<z.ZodString>;
31
48
  metaInfo: z.ZodRecord<z.ZodString, z.ZodUnknown>;
32
49
  audit: z.ZodRecord<z.ZodString, z.ZodUnknown>;
33
50
  }, z.core.$strip>;
51
+ export declare const MosipCorrectionPayloadSchema: z.ZodObject<{
52
+ trackingId: z.ZodString;
53
+ notification: z.ZodObject<{
54
+ recipientFullName: z.ZodString;
55
+ recipientEmail: z.ZodString;
56
+ recipientPhone: z.ZodString;
57
+ }, z.core.$strip>;
58
+ requestFields: z.ZodObject<{
59
+ VID: z.ZodString;
60
+ fullName: z.ZodOptional<z.ZodString>;
61
+ dateOfBirth: z.ZodOptional<z.ZodString>;
62
+ gender: z.ZodOptional<z.ZodString>;
63
+ introducerInfoToken: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$strip>;
65
+ schemaJson: z.ZodOptional<z.ZodString>;
66
+ metaInfo: z.ZodRecord<z.ZodString, z.ZodUnknown>;
67
+ audit: z.ZodRecord<z.ZodString, z.ZodUnknown>;
68
+ }, z.core.$strip>;
34
69
  export declare const VerifyNidPayloadSchema: z.ZodObject<{
35
70
  nid: z.ZodCustom<FieldValue, FieldValue>;
36
71
  gender: z.ZodOptional<z.ZodCustom<FieldValue, FieldValue>>;
@@ -42,7 +77,9 @@ export declare const VerifyNidResponseSchema: z.ZodUnion<readonly [z.ZodLiteral<
42
77
  export declare const RegistrationEventResponseSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
43
78
  export type BirthRequestFields = z.infer<typeof BirthRequestFieldsSchema>;
44
79
  export type DeathRequestFields = z.infer<typeof DeathRequestFieldsSchema>;
80
+ export type CorrectionRequestFields = z.infer<typeof CorrectionRequestFieldsSchema>;
45
81
  export type MosipInteropPayload = z.infer<typeof MosipInteropPayloadSchema>;
82
+ export type MosipCorrectionPayload = z.infer<typeof MosipCorrectionPayloadSchema>;
46
83
  export type VerifyNidPayload = z.infer<typeof VerifyNidPayloadSchema>;
47
84
  export type VerifyNidResponse = z.infer<typeof VerifyNidResponseSchema>;
48
85
  export interface VerificationStatus {
@@ -54,5 +91,6 @@ export interface VerificationStatus {
54
91
  }
55
92
  export declare const createMosipInteropClient: (url: string, authorizationHeader: string) => {
56
93
  register: (payload: MosipInteropPayload) => Promise<Record<string, unknown>>;
57
- verifyNid: (payload: VerifyNidPayload) => Promise<"failed" | "verified">;
94
+ updateBiographics: (payload: MosipCorrectionPayload) => Promise<Record<string, unknown>>;
95
+ verifyNid: (payload: VerifyNidPayload) => Promise<"verified" | "failed">;
58
96
  };
package/build/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createMosipInteropClient = exports.RegistrationEventResponseSchema = exports.VerifyNidResponseSchema = exports.VerifyNidPayloadSchema = exports.MosipInteropPayloadSchema = exports.MosipNotificationSchema = exports.DeathRequestFieldsSchema = exports.BirthRequestFieldsSchema = void 0;
3
+ exports.createMosipInteropClient = exports.RegistrationEventResponseSchema = exports.VerifyNidResponseSchema = exports.VerifyNidPayloadSchema = exports.MosipCorrectionPayloadSchema = exports.MosipInteropPayloadSchema = exports.MosipNotificationSchema = exports.CorrectionRequestFieldsSchema = exports.DeathRequestFieldsSchema = exports.BirthRequestFieldsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.BirthRequestFieldsSchema = zod_1.z.looseObject({
6
6
  birthCertificateNumber: zod_1.z.string(),
@@ -10,6 +10,15 @@ exports.DeathRequestFieldsSchema = zod_1.z.looseObject({
10
10
  deathCertificateNumber: zod_1.z.string(),
11
11
  birthCertificateNumber: zod_1.z.undefined().optional(),
12
12
  });
13
+ exports.CorrectionRequestFieldsSchema = zod_1.z.looseObject({
14
+ VID: zod_1.z.string(),
15
+ fullName: zod_1.z.string().optional(),
16
+ dateOfBirth: zod_1.z.string().optional(),
17
+ gender: zod_1.z.string().optional(),
18
+ introducerInfoToken: zod_1.z.string().optional(),
19
+ birthCertificateNumber: zod_1.z.undefined().optional(),
20
+ deathCertificateNumber: zod_1.z.undefined().optional(),
21
+ });
13
22
  exports.MosipNotificationSchema = zod_1.z.object({
14
23
  recipientFullName: zod_1.z.string(),
15
24
  recipientEmail: zod_1.z.string(),
@@ -18,7 +27,25 @@ exports.MosipNotificationSchema = zod_1.z.object({
18
27
  exports.MosipInteropPayloadSchema = zod_1.z.object({
19
28
  trackingId: zod_1.z.string(),
20
29
  notification: exports.MosipNotificationSchema,
21
- requestFields: zod_1.z.union([exports.BirthRequestFieldsSchema, exports.DeathRequestFieldsSchema]),
30
+ requestFields: zod_1.z.union([
31
+ exports.BirthRequestFieldsSchema,
32
+ exports.DeathRequestFieldsSchema,
33
+ exports.CorrectionRequestFieldsSchema,
34
+ ]),
35
+ schemaJson: zod_1.z.string().optional(),
36
+ metaInfo: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
37
+ audit: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
38
+ });
39
+ exports.MosipCorrectionPayloadSchema = zod_1.z.object({
40
+ trackingId: zod_1.z.string(),
41
+ notification: exports.MosipNotificationSchema,
42
+ requestFields: zod_1.z.object({
43
+ VID: zod_1.z.string(),
44
+ fullName: zod_1.z.string().optional(),
45
+ dateOfBirth: zod_1.z.string().optional(),
46
+ gender: zod_1.z.string().optional(),
47
+ introducerInfoToken: zod_1.z.string().optional(),
48
+ }),
22
49
  schemaJson: zod_1.z.string().optional(),
23
50
  metaInfo: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
24
51
  audit: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
@@ -68,6 +95,22 @@ const createMosipInteropClient = (url, authorizationHeader) => {
68
95
  }
69
96
  return exports.RegistrationEventResponseSchema.parse(await response.json());
70
97
  },
98
+ updateBiographics: async (payload) => {
99
+ const parsedPayload = exports.MosipCorrectionPayloadSchema.parse(payload);
100
+ const MOSIP_API_CORRECTION_EVENT_URL = new URL("./events/update-biographics", url).href;
101
+ const response = await fetchWithTimeout(MOSIP_API_CORRECTION_EVENT_URL, {
102
+ method: "POST",
103
+ body: JSON.stringify(parsedPayload),
104
+ headers: {
105
+ Authorization: authorizationHeader,
106
+ "content-type": "application/json",
107
+ },
108
+ });
109
+ if (!response.ok) {
110
+ throw new Error(`Failed to update biographics: ${await response.text()}`);
111
+ }
112
+ return exports.RegistrationEventResponseSchema.parse(await response.json());
113
+ },
71
114
  verifyNid: async (payload) => {
72
115
  const parsedPayload = exports.VerifyNidPayloadSchema.parse(payload);
73
116
  const MOSIP_API_VERIFY_URL = new URL("./verify", url).href;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/mosip",
3
- "version": "2.0.0-rc.2",
3
+ "version": "2.0.0-rc.20260515",
4
4
  "license": "MPL-2.0",
5
5
  "main": "./build/index.js",
6
6
  "exports": {
@@ -15,7 +15,7 @@
15
15
  "zod": "^4.1.12"
16
16
  },
17
17
  "devDependencies": {
18
- "@opencrvs/toolkit": "1.9.10-rc.9afdb31",
18
+ "@opencrvs/toolkit": "1.9.12-rc.1b9bbf4",
19
19
  "@types/hapi__hapi": "^20.0.0",
20
20
  "@types/node-fetch": "^2.6.11",
21
21
  "node-fetch": "2.6.7",
package/src/api.ts CHANGED
@@ -11,6 +11,16 @@ export const DeathRequestFieldsSchema = z.looseObject({
11
11
  birthCertificateNumber: z.undefined().optional(),
12
12
  });
13
13
 
14
+ export const CorrectionRequestFieldsSchema = z.looseObject({
15
+ VID: z.string(),
16
+ fullName: z.string().optional(),
17
+ dateOfBirth: z.string().optional(),
18
+ gender: z.string().optional(),
19
+ introducerInfoToken: z.string().optional(),
20
+ birthCertificateNumber: z.undefined().optional(),
21
+ deathCertificateNumber: z.undefined().optional(),
22
+ });
23
+
14
24
  export const MosipNotificationSchema = z.object({
15
25
  recipientFullName: z.string(),
16
26
  recipientEmail: z.string(),
@@ -20,7 +30,26 @@ export const MosipNotificationSchema = z.object({
20
30
  export const MosipInteropPayloadSchema = z.object({
21
31
  trackingId: z.string(),
22
32
  notification: MosipNotificationSchema,
23
- requestFields: z.union([BirthRequestFieldsSchema, DeathRequestFieldsSchema]),
33
+ requestFields: z.union([
34
+ BirthRequestFieldsSchema,
35
+ DeathRequestFieldsSchema,
36
+ CorrectionRequestFieldsSchema,
37
+ ]),
38
+ schemaJson: z.string().optional(),
39
+ metaInfo: z.record(z.string(), z.unknown()),
40
+ audit: z.record(z.string(), z.unknown()),
41
+ });
42
+
43
+ export const MosipCorrectionPayloadSchema = z.object({
44
+ trackingId: z.string(),
45
+ notification: MosipNotificationSchema,
46
+ requestFields: z.object({
47
+ VID: z.string(),
48
+ fullName: z.string().optional(),
49
+ dateOfBirth: z.string().optional(),
50
+ gender: z.string().optional(),
51
+ introducerInfoToken: z.string().optional(),
52
+ }),
24
53
  schemaJson: z.string().optional(),
25
54
  metaInfo: z.record(z.string(), z.unknown()),
26
55
  audit: z.record(z.string(), z.unknown()),
@@ -48,7 +77,9 @@ export const RegistrationEventResponseSchema = z.record(
48
77
 
49
78
  export type BirthRequestFields = z.infer<typeof BirthRequestFieldsSchema>;
50
79
  export type DeathRequestFields = z.infer<typeof DeathRequestFieldsSchema>;
80
+ export type CorrectionRequestFields = z.infer<typeof CorrectionRequestFieldsSchema>;
51
81
  export type MosipInteropPayload = z.infer<typeof MosipInteropPayloadSchema>;
82
+ export type MosipCorrectionPayload = z.infer<typeof MosipCorrectionPayloadSchema>;
52
83
  export type VerifyNidPayload = z.infer<typeof VerifyNidPayloadSchema>;
53
84
  export type VerifyNidResponse = z.infer<typeof VerifyNidResponseSchema>;
54
85
 
@@ -109,6 +140,30 @@ export const createMosipInteropClient = (
109
140
 
110
141
  return RegistrationEventResponseSchema.parse(await response.json());
111
142
  },
143
+ updateBiographics: async (payload: MosipCorrectionPayload) => {
144
+ const parsedPayload = MosipCorrectionPayloadSchema.parse(payload);
145
+ const MOSIP_API_CORRECTION_EVENT_URL = new URL(
146
+ "./events/update-biographics",
147
+ url,
148
+ ).href;
149
+
150
+ const response = await fetchWithTimeout(MOSIP_API_CORRECTION_EVENT_URL, {
151
+ method: "POST",
152
+ body: JSON.stringify(parsedPayload),
153
+ headers: {
154
+ Authorization: authorizationHeader,
155
+ "content-type": "application/json",
156
+ },
157
+ });
158
+
159
+ if (!response.ok) {
160
+ throw new Error(
161
+ `Failed to update biographics: ${await response.text()}`,
162
+ );
163
+ }
164
+
165
+ return RegistrationEventResponseSchema.parse(await response.json());
166
+ },
112
167
  verifyNid: async (payload: VerifyNidPayload) => {
113
168
  const parsedPayload = VerifyNidPayloadSchema.parse(payload);
114
169
  const MOSIP_API_VERIFY_URL = new URL("./verify", url).href;