@openfn/language-ghana-bdr 0.1.1 → 0.1.3
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/ast.json +1 -1
- package/dist/index.cjs +115 -76
- package/dist/index.js +116 -78
- package/package.json +2 -1
- package/types/Adaptor.d.ts +1 -2
- package/types/util.d.ts +1 -0
package/ast.json
CHANGED
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"tags": [
|
|
68
68
|
{
|
|
69
69
|
"title": "example",
|
|
70
|
-
"description": "sendBirthNotification({\n
|
|
70
|
+
"description": "sendBirthNotification({\n registry_code: 'abc123',\n child: {},\n mother: {},\n father: {},\n})"
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
"title": "function",
|
package/dist/index.cjs
CHANGED
|
@@ -83,14 +83,36 @@ var getClient = (baseUrl) => {
|
|
|
83
83
|
var setMockClient = (mockClient) => {
|
|
84
84
|
client = mockClient;
|
|
85
85
|
};
|
|
86
|
+
var validateRequestBody = (request2, sample) => {
|
|
87
|
+
const sampleKeys = Object.keys(sample);
|
|
88
|
+
const requestKeys = Object.keys(request2);
|
|
89
|
+
for (const key of sampleKeys) {
|
|
90
|
+
if (!requestKeys.includes(key)) {
|
|
91
|
+
console.log("Key missing:", key);
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
if (typeof sample[key] != typeof request2[key]) {
|
|
95
|
+
console.log("Key with wrong value type:", key);
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
if (typeof sample[key] === "object" && sample[key] !== null) {
|
|
99
|
+
if (!validateRequestBody(request2[key], sample[key])) {
|
|
100
|
+
console.log("Failed check at:", key);
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return true;
|
|
106
|
+
};
|
|
86
107
|
var prepareNextState = async (state, response) => {
|
|
87
108
|
const { body, ...responseWithoutBody } = response;
|
|
88
109
|
const result = await body.json();
|
|
110
|
+
const resultAsJson = JSON.parse(result);
|
|
89
111
|
if (!state.references) {
|
|
90
112
|
state.references = [];
|
|
91
113
|
}
|
|
92
114
|
const nextState = {
|
|
93
|
-
...(0, import_language_common.composeNextState)(state,
|
|
115
|
+
...(0, import_language_common.composeNextState)(state, resultAsJson),
|
|
94
116
|
response: responseWithoutBody
|
|
95
117
|
};
|
|
96
118
|
return nextState;
|
|
@@ -112,21 +134,31 @@ var request = (path, options) => {
|
|
|
112
134
|
query,
|
|
113
135
|
...otherOptions
|
|
114
136
|
} = resolvedoptions;
|
|
115
|
-
const addAuth = (0, import_util.makeBasicAuthHeader)(username, password);
|
|
116
137
|
const safePath = resolvedPath ? import_node_path.default.join(basePath, resolvedPath) : basePath;
|
|
117
138
|
const args = {
|
|
118
139
|
path: safePath,
|
|
119
140
|
data,
|
|
120
141
|
headers: {
|
|
121
|
-
...headers
|
|
122
|
-
...addAuth
|
|
142
|
+
...headers
|
|
123
143
|
},
|
|
124
144
|
method,
|
|
125
145
|
query,
|
|
126
146
|
...otherOptions
|
|
127
147
|
};
|
|
148
|
+
if (data.username || data.password) {
|
|
149
|
+
(0, import_util.throwError)(
|
|
150
|
+
"Please don't supply `username` and `password` in your request body. The adaptor will append it automatically."
|
|
151
|
+
);
|
|
152
|
+
}
|
|
128
153
|
if (data) {
|
|
129
|
-
args.body = JSON.stringify(
|
|
154
|
+
args.body = JSON.stringify(
|
|
155
|
+
JSON.stringify({
|
|
156
|
+
...data,
|
|
157
|
+
username,
|
|
158
|
+
password
|
|
159
|
+
})
|
|
160
|
+
);
|
|
161
|
+
args.data = { ...data, username, password };
|
|
130
162
|
}
|
|
131
163
|
const response = await client.request(args);
|
|
132
164
|
if (response.statusCode >= 400) {
|
|
@@ -143,92 +175,99 @@ var request = (path, options) => {
|
|
|
143
175
|
|
|
144
176
|
// src/mock.js
|
|
145
177
|
var import_undici2 = require("undici");
|
|
146
|
-
var
|
|
147
|
-
registry_code: "
|
|
178
|
+
var sampleRequestBody = {
|
|
179
|
+
registry_code: "011803",
|
|
148
180
|
child: {
|
|
149
|
-
first_name: "
|
|
150
|
-
middle_name: "
|
|
151
|
-
|
|
152
|
-
birth_date: "
|
|
153
|
-
national_id_number: "90282901892",
|
|
154
|
-
place_of_delivery_code: "2",
|
|
155
|
-
place_of_delivery_other: null,
|
|
181
|
+
first_name: "Test",
|
|
182
|
+
middle_name: "",
|
|
183
|
+
Surname: "Testerson",
|
|
184
|
+
birth_date: "2024/03/04",
|
|
156
185
|
birth_type_code: "1",
|
|
157
186
|
gender_code: "2",
|
|
187
|
+
place_of_delivery_code: "7",
|
|
158
188
|
attendant_at_birth_code: "1",
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
birth_attendant_phone: "0556969609"
|
|
189
|
+
bith_attendant_full_name: "Helen",
|
|
190
|
+
bith_attendant_phone: "0248403076"
|
|
162
191
|
},
|
|
163
192
|
mother: {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
phone: "
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
nationality_code: "131",
|
|
172
|
-
house_number: "No 4536",
|
|
173
|
-
street_name: "Accra city Ghana",
|
|
174
|
-
district_code: "10",
|
|
175
|
-
region_code: "10",
|
|
176
|
-
town_or_village: "Ajiringanor",
|
|
177
|
-
number_of_children_ever_born_alive: 5,
|
|
178
|
-
born_alive_are_living: 5,
|
|
179
|
-
live_birth_order: 5,
|
|
180
|
-
born_alive_are_dead: 0,
|
|
181
|
-
education_level_code: "6",
|
|
182
|
-
education_level_other: null,
|
|
183
|
-
occupation_code: "13",
|
|
184
|
-
occupation_other: null
|
|
193
|
+
national_id_number: "GHA-000000000-2",
|
|
194
|
+
first_name: "fake",
|
|
195
|
+
middle_name: "",
|
|
196
|
+
maiden_name: "fakerson",
|
|
197
|
+
phone: "0248403076",
|
|
198
|
+
occupation_code: "29",
|
|
199
|
+
age: 25
|
|
185
200
|
},
|
|
186
201
|
father: {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
age:
|
|
194
|
-
education_level_code: "13",
|
|
195
|
-
occupation_code: "13",
|
|
196
|
-
religion_code: "1",
|
|
197
|
-
education_level_other: null,
|
|
198
|
-
occupation_other: null,
|
|
199
|
-
religion_other: null,
|
|
200
|
-
is_gainfully_employed_code: "1"
|
|
201
|
-
},
|
|
202
|
-
health_facility: {
|
|
203
|
-
name: "Korlebu General Hospital",
|
|
204
|
-
house_number: "No 4536",
|
|
205
|
-
street_name: "Adjiringano",
|
|
206
|
-
town_code: "12",
|
|
207
|
-
town_other: null,
|
|
208
|
-
district_code: "11",
|
|
209
|
-
region_code: "12"
|
|
210
|
-
},
|
|
211
|
-
birth_informant: {
|
|
212
|
-
relationship_code: "2",
|
|
213
|
-
relationship_other: null,
|
|
214
|
-
full_name: "Kufor Mensa",
|
|
215
|
-
phone: "055646874",
|
|
216
|
-
digital_address: "No. 64 Ajiringanor",
|
|
217
|
-
national_id_number: "993993939-0303"
|
|
202
|
+
national_id_number: "",
|
|
203
|
+
first_name: "john",
|
|
204
|
+
middle_name: "",
|
|
205
|
+
Surname: "doe",
|
|
206
|
+
phone: "0248403076",
|
|
207
|
+
occupation_code: "115",
|
|
208
|
+
age: 39
|
|
218
209
|
}
|
|
219
210
|
};
|
|
211
|
+
var birthNotificationResponse = {
|
|
212
|
+
birth_certificate_number: "000000-00-2024",
|
|
213
|
+
first_name: "Test",
|
|
214
|
+
middle_name: "",
|
|
215
|
+
Surname: "sample surname",
|
|
216
|
+
birth_date: "04 Mar 2024",
|
|
217
|
+
national_id_number: "",
|
|
218
|
+
place_of_delivery: "MATERNITY HOME",
|
|
219
|
+
Health_facility: "",
|
|
220
|
+
birth_type: null,
|
|
221
|
+
gender: "MALE",
|
|
222
|
+
house_number: "",
|
|
223
|
+
street_name: "",
|
|
224
|
+
district: "",
|
|
225
|
+
region: "",
|
|
226
|
+
town_or_village: "",
|
|
227
|
+
m_first_name: "sample mom",
|
|
228
|
+
m_middle_name: "",
|
|
229
|
+
m_maiden_name: "sample surname",
|
|
230
|
+
m_surname: "",
|
|
231
|
+
m_national_id_number: "GHA-000000000-0",
|
|
232
|
+
m_nationality: "",
|
|
233
|
+
f_first_name: "father fname",
|
|
234
|
+
f_middle_name: "",
|
|
235
|
+
f_Surname: "father sur",
|
|
236
|
+
f_nationality: "",
|
|
237
|
+
f_national_id_number: "",
|
|
238
|
+
reference_id: "abc123de-1995",
|
|
239
|
+
document_number: "1995/000000/XX0000000A1B2C3",
|
|
240
|
+
created_at: "05 Mar 2024",
|
|
241
|
+
last_updated_at: null,
|
|
242
|
+
issuccessful: true,
|
|
243
|
+
message: "record reference_id : abc123de-1995 , created successfully",
|
|
244
|
+
messagecode: "200"
|
|
245
|
+
};
|
|
220
246
|
function createServer(url = "http://tracker.chimgh.org") {
|
|
221
247
|
const agent = new import_undici2.MockAgent();
|
|
222
248
|
agent.disableNetConnect();
|
|
223
249
|
const mockPool = agent.get(url);
|
|
224
250
|
const sendBirthNotification2 = (req) => {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
251
|
+
const body = JSON.parse(req.body);
|
|
252
|
+
if (validateRequestBody(body, sampleRequestBody)) {
|
|
253
|
+
return {
|
|
254
|
+
statusCode: 200,
|
|
255
|
+
responseOptions: {
|
|
256
|
+
headers: { "Content-Type": "application/json" }
|
|
257
|
+
},
|
|
258
|
+
data: JSON.stringify(JSON.stringify(birthNotificationResponse))
|
|
259
|
+
};
|
|
260
|
+
} else {
|
|
261
|
+
return {
|
|
262
|
+
statusCode: 417,
|
|
263
|
+
responseOptions: {
|
|
264
|
+
headers: { "Content-Type": "application/json" }
|
|
265
|
+
},
|
|
266
|
+
data: {
|
|
267
|
+
Message: '{"issuccessful":false,"message":"Record failed to save with this error --> Modify the clause to make sure that a column is updated only once. If this statement updates or inserts columns into a view, column aliasing can conceal the duplication in your code.","messagecode":"210"} (Note that this is just a sample error from a mock endpoint.)'
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
}
|
|
232
271
|
};
|
|
233
272
|
mockPool.intercept({ method: "post", path: /api\/notification/ }).reply(sendBirthNotification2).persist();
|
|
234
273
|
return {
|
package/dist/index.js
CHANGED
|
@@ -32,8 +32,7 @@ import nodepath from "path";
|
|
|
32
32
|
import {
|
|
33
33
|
throwError,
|
|
34
34
|
logResponse,
|
|
35
|
-
expandReferences
|
|
36
|
-
makeBasicAuthHeader
|
|
35
|
+
expandReferences
|
|
37
36
|
} from "@openfn/language-common/util";
|
|
38
37
|
import { composeNextState } from "@openfn/language-common";
|
|
39
38
|
var client;
|
|
@@ -47,14 +46,36 @@ var getClient = (baseUrl) => {
|
|
|
47
46
|
var setMockClient = (mockClient) => {
|
|
48
47
|
client = mockClient;
|
|
49
48
|
};
|
|
49
|
+
var validateRequestBody = (request2, sample) => {
|
|
50
|
+
const sampleKeys = Object.keys(sample);
|
|
51
|
+
const requestKeys = Object.keys(request2);
|
|
52
|
+
for (const key of sampleKeys) {
|
|
53
|
+
if (!requestKeys.includes(key)) {
|
|
54
|
+
console.log("Key missing:", key);
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
if (typeof sample[key] != typeof request2[key]) {
|
|
58
|
+
console.log("Key with wrong value type:", key);
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
if (typeof sample[key] === "object" && sample[key] !== null) {
|
|
62
|
+
if (!validateRequestBody(request2[key], sample[key])) {
|
|
63
|
+
console.log("Failed check at:", key);
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
};
|
|
50
70
|
var prepareNextState = async (state, response) => {
|
|
51
71
|
const { body, ...responseWithoutBody } = response;
|
|
52
72
|
const result = await body.json();
|
|
73
|
+
const resultAsJson = JSON.parse(result);
|
|
53
74
|
if (!state.references) {
|
|
54
75
|
state.references = [];
|
|
55
76
|
}
|
|
56
77
|
const nextState = {
|
|
57
|
-
...composeNextState(state,
|
|
78
|
+
...composeNextState(state, resultAsJson),
|
|
58
79
|
response: responseWithoutBody
|
|
59
80
|
};
|
|
60
81
|
return nextState;
|
|
@@ -76,21 +97,31 @@ var request = (path, options) => {
|
|
|
76
97
|
query,
|
|
77
98
|
...otherOptions
|
|
78
99
|
} = resolvedoptions;
|
|
79
|
-
const addAuth = makeBasicAuthHeader(username, password);
|
|
80
100
|
const safePath = resolvedPath ? nodepath.join(basePath, resolvedPath) : basePath;
|
|
81
101
|
const args = {
|
|
82
102
|
path: safePath,
|
|
83
103
|
data,
|
|
84
104
|
headers: {
|
|
85
|
-
...headers
|
|
86
|
-
...addAuth
|
|
105
|
+
...headers
|
|
87
106
|
},
|
|
88
107
|
method,
|
|
89
108
|
query,
|
|
90
109
|
...otherOptions
|
|
91
110
|
};
|
|
111
|
+
if (data.username || data.password) {
|
|
112
|
+
throwError(
|
|
113
|
+
"Please don't supply `username` and `password` in your request body. The adaptor will append it automatically."
|
|
114
|
+
);
|
|
115
|
+
}
|
|
92
116
|
if (data) {
|
|
93
|
-
args.body = JSON.stringify(
|
|
117
|
+
args.body = JSON.stringify(
|
|
118
|
+
JSON.stringify({
|
|
119
|
+
...data,
|
|
120
|
+
username,
|
|
121
|
+
password
|
|
122
|
+
})
|
|
123
|
+
);
|
|
124
|
+
args.data = { ...data, username, password };
|
|
94
125
|
}
|
|
95
126
|
const response = await client.request(args);
|
|
96
127
|
if (response.statusCode >= 400) {
|
|
@@ -107,92 +138,99 @@ var request = (path, options) => {
|
|
|
107
138
|
|
|
108
139
|
// src/mock.js
|
|
109
140
|
import { MockAgent } from "undici";
|
|
110
|
-
var
|
|
111
|
-
registry_code: "
|
|
141
|
+
var sampleRequestBody = {
|
|
142
|
+
registry_code: "011803",
|
|
112
143
|
child: {
|
|
113
|
-
first_name: "
|
|
114
|
-
middle_name: "
|
|
115
|
-
|
|
116
|
-
birth_date: "
|
|
117
|
-
national_id_number: "90282901892",
|
|
118
|
-
place_of_delivery_code: "2",
|
|
119
|
-
place_of_delivery_other: null,
|
|
144
|
+
first_name: "Test",
|
|
145
|
+
middle_name: "",
|
|
146
|
+
Surname: "Testerson",
|
|
147
|
+
birth_date: "2024/03/04",
|
|
120
148
|
birth_type_code: "1",
|
|
121
149
|
gender_code: "2",
|
|
150
|
+
place_of_delivery_code: "7",
|
|
122
151
|
attendant_at_birth_code: "1",
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
birth_attendant_phone: "0556969609"
|
|
152
|
+
bith_attendant_full_name: "Helen",
|
|
153
|
+
bith_attendant_phone: "0248403076"
|
|
126
154
|
},
|
|
127
155
|
mother: {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
phone: "
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
nationality_code: "131",
|
|
136
|
-
house_number: "No 4536",
|
|
137
|
-
street_name: "Accra city Ghana",
|
|
138
|
-
district_code: "10",
|
|
139
|
-
region_code: "10",
|
|
140
|
-
town_or_village: "Ajiringanor",
|
|
141
|
-
number_of_children_ever_born_alive: 5,
|
|
142
|
-
born_alive_are_living: 5,
|
|
143
|
-
live_birth_order: 5,
|
|
144
|
-
born_alive_are_dead: 0,
|
|
145
|
-
education_level_code: "6",
|
|
146
|
-
education_level_other: null,
|
|
147
|
-
occupation_code: "13",
|
|
148
|
-
occupation_other: null
|
|
156
|
+
national_id_number: "GHA-000000000-2",
|
|
157
|
+
first_name: "fake",
|
|
158
|
+
middle_name: "",
|
|
159
|
+
maiden_name: "fakerson",
|
|
160
|
+
phone: "0248403076",
|
|
161
|
+
occupation_code: "29",
|
|
162
|
+
age: 25
|
|
149
163
|
},
|
|
150
164
|
father: {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
age:
|
|
158
|
-
education_level_code: "13",
|
|
159
|
-
occupation_code: "13",
|
|
160
|
-
religion_code: "1",
|
|
161
|
-
education_level_other: null,
|
|
162
|
-
occupation_other: null,
|
|
163
|
-
religion_other: null,
|
|
164
|
-
is_gainfully_employed_code: "1"
|
|
165
|
-
},
|
|
166
|
-
health_facility: {
|
|
167
|
-
name: "Korlebu General Hospital",
|
|
168
|
-
house_number: "No 4536",
|
|
169
|
-
street_name: "Adjiringano",
|
|
170
|
-
town_code: "12",
|
|
171
|
-
town_other: null,
|
|
172
|
-
district_code: "11",
|
|
173
|
-
region_code: "12"
|
|
174
|
-
},
|
|
175
|
-
birth_informant: {
|
|
176
|
-
relationship_code: "2",
|
|
177
|
-
relationship_other: null,
|
|
178
|
-
full_name: "Kufor Mensa",
|
|
179
|
-
phone: "055646874",
|
|
180
|
-
digital_address: "No. 64 Ajiringanor",
|
|
181
|
-
national_id_number: "993993939-0303"
|
|
165
|
+
national_id_number: "",
|
|
166
|
+
first_name: "john",
|
|
167
|
+
middle_name: "",
|
|
168
|
+
Surname: "doe",
|
|
169
|
+
phone: "0248403076",
|
|
170
|
+
occupation_code: "115",
|
|
171
|
+
age: 39
|
|
182
172
|
}
|
|
183
173
|
};
|
|
174
|
+
var birthNotificationResponse = {
|
|
175
|
+
birth_certificate_number: "000000-00-2024",
|
|
176
|
+
first_name: "Test",
|
|
177
|
+
middle_name: "",
|
|
178
|
+
Surname: "sample surname",
|
|
179
|
+
birth_date: "04 Mar 2024",
|
|
180
|
+
national_id_number: "",
|
|
181
|
+
place_of_delivery: "MATERNITY HOME",
|
|
182
|
+
Health_facility: "",
|
|
183
|
+
birth_type: null,
|
|
184
|
+
gender: "MALE",
|
|
185
|
+
house_number: "",
|
|
186
|
+
street_name: "",
|
|
187
|
+
district: "",
|
|
188
|
+
region: "",
|
|
189
|
+
town_or_village: "",
|
|
190
|
+
m_first_name: "sample mom",
|
|
191
|
+
m_middle_name: "",
|
|
192
|
+
m_maiden_name: "sample surname",
|
|
193
|
+
m_surname: "",
|
|
194
|
+
m_national_id_number: "GHA-000000000-0",
|
|
195
|
+
m_nationality: "",
|
|
196
|
+
f_first_name: "father fname",
|
|
197
|
+
f_middle_name: "",
|
|
198
|
+
f_Surname: "father sur",
|
|
199
|
+
f_nationality: "",
|
|
200
|
+
f_national_id_number: "",
|
|
201
|
+
reference_id: "abc123de-1995",
|
|
202
|
+
document_number: "1995/000000/XX0000000A1B2C3",
|
|
203
|
+
created_at: "05 Mar 2024",
|
|
204
|
+
last_updated_at: null,
|
|
205
|
+
issuccessful: true,
|
|
206
|
+
message: "record reference_id : abc123de-1995 , created successfully",
|
|
207
|
+
messagecode: "200"
|
|
208
|
+
};
|
|
184
209
|
function createServer(url = "http://tracker.chimgh.org") {
|
|
185
210
|
const agent = new MockAgent();
|
|
186
211
|
agent.disableNetConnect();
|
|
187
212
|
const mockPool = agent.get(url);
|
|
188
213
|
const sendBirthNotification2 = (req) => {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
214
|
+
const body = JSON.parse(req.body);
|
|
215
|
+
if (validateRequestBody(body, sampleRequestBody)) {
|
|
216
|
+
return {
|
|
217
|
+
statusCode: 200,
|
|
218
|
+
responseOptions: {
|
|
219
|
+
headers: { "Content-Type": "application/json" }
|
|
220
|
+
},
|
|
221
|
+
data: JSON.stringify(JSON.stringify(birthNotificationResponse))
|
|
222
|
+
};
|
|
223
|
+
} else {
|
|
224
|
+
return {
|
|
225
|
+
statusCode: 417,
|
|
226
|
+
responseOptions: {
|
|
227
|
+
headers: { "Content-Type": "application/json" }
|
|
228
|
+
},
|
|
229
|
+
data: {
|
|
230
|
+
Message: '{"issuccessful":false,"message":"Record failed to save with this error --> Modify the clause to make sure that a column is updated only once. If this statement updates or inserts columns into a view, column aliasing can conceal the duplication in your code.","messagecode":"210"} (Note that this is just a sample error from a mock endpoint.)'
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
}
|
|
196
234
|
};
|
|
197
235
|
mockPool.intercept({ method: "post", path: /api\/notification/ }).reply(sendBirthNotification2).persist();
|
|
198
236
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-ghana-bdr",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "OpenFn ghana-bdr adaptor",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"configuration-schema.json"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"ajv": "^6.12.6",
|
|
23
24
|
"undici": "^5.22.1",
|
|
24
25
|
"@openfn/language-common": "2.3.0"
|
|
25
26
|
},
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -42,11 +42,10 @@ export function post(path: string, data: object): Operation;
|
|
|
42
42
|
* Generate a birth certificate
|
|
43
43
|
* @example
|
|
44
44
|
* sendBirthNotification({
|
|
45
|
+
* registry_code: 'abc123',
|
|
45
46
|
* child: {},
|
|
46
47
|
* mother: {},
|
|
47
48
|
* father: {},
|
|
48
|
-
* health_facility: {},
|
|
49
|
-
* birth_informant: {}
|
|
50
49
|
* })
|
|
51
50
|
* @function
|
|
52
51
|
* @public
|
package/types/util.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export function setMockClient(mockClient: any): void;
|
|
2
|
+
export function validateRequestBody(request: any, sample: any): boolean;
|
|
2
3
|
export function prepareNextState(state: any, response: any): Promise<any>;
|
|
3
4
|
export function request(path: any, options: any): (state: any) => Promise<any>;
|