@openfn/language-ghana-bdr 0.1.0 → 0.1.2
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 +113 -76
- package/dist/index.js +114 -78
- package/package.json +2 -1
- package/types/Adaptor.d.ts +5 -22
- 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 child: {},\n mother: {},\n father: {},\n health_facility: {},\n birth_informant: {}\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,30 @@ 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."
|
|
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
|
+
);
|
|
130
161
|
}
|
|
131
162
|
const response = await client.request(args);
|
|
132
163
|
if (response.statusCode >= 400) {
|
|
@@ -143,92 +174,98 @@ var request = (path, options) => {
|
|
|
143
174
|
|
|
144
175
|
// src/mock.js
|
|
145
176
|
var import_undici2 = require("undici");
|
|
146
|
-
var
|
|
147
|
-
registry_code: "
|
|
177
|
+
var sampleRequestBody = {
|
|
178
|
+
registry_code: "011803",
|
|
148
179
|
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,
|
|
180
|
+
first_name: "Test",
|
|
181
|
+
middle_name: "",
|
|
182
|
+
Surname: "Testerson",
|
|
183
|
+
birth_date: "2024/03/04",
|
|
156
184
|
birth_type_code: "1",
|
|
157
185
|
gender_code: "2",
|
|
186
|
+
place_of_delivery_code: "7",
|
|
158
187
|
attendant_at_birth_code: "1",
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
birth_attendant_phone: "0556969609"
|
|
188
|
+
bith_attendant_full_name: "Helen",
|
|
189
|
+
bith_attendant_phone: "0248403076"
|
|
162
190
|
},
|
|
163
191
|
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
|
|
192
|
+
national_id_number: "GHA-000000000-2",
|
|
193
|
+
first_name: "fake",
|
|
194
|
+
middle_name: "",
|
|
195
|
+
maiden_name: "fakerson",
|
|
196
|
+
phone: "0248403076",
|
|
197
|
+
occupation_code: "29",
|
|
198
|
+
age: 25
|
|
185
199
|
},
|
|
186
200
|
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"
|
|
201
|
+
national_id_number: "",
|
|
202
|
+
first_name: "john",
|
|
203
|
+
middle_name: "",
|
|
204
|
+
Surname: "doe",
|
|
205
|
+
phone: "0248403076",
|
|
206
|
+
occupation_code: "115",
|
|
207
|
+
age: 39
|
|
218
208
|
}
|
|
219
209
|
};
|
|
210
|
+
var birthNotificationResponse = {
|
|
211
|
+
birth_certificate_number: "000000-00-2024",
|
|
212
|
+
first_name: "Test",
|
|
213
|
+
middle_name: "",
|
|
214
|
+
Surname: "sample surname",
|
|
215
|
+
birth_date: "04 Mar 2024",
|
|
216
|
+
national_id_number: "",
|
|
217
|
+
place_of_delivery: "MATERNITY HOME",
|
|
218
|
+
Health_facility: "",
|
|
219
|
+
birth_type: null,
|
|
220
|
+
gender: "MALE",
|
|
221
|
+
house_number: "",
|
|
222
|
+
street_name: "",
|
|
223
|
+
district: "",
|
|
224
|
+
region: "",
|
|
225
|
+
town_or_village: "",
|
|
226
|
+
m_first_name: "sample mom",
|
|
227
|
+
m_middle_name: "",
|
|
228
|
+
m_maiden_name: "sample surname",
|
|
229
|
+
m_surname: "",
|
|
230
|
+
m_national_id_number: "GHA-000000000-0",
|
|
231
|
+
m_nationality: "",
|
|
232
|
+
f_first_name: "father fname",
|
|
233
|
+
f_middle_name: "",
|
|
234
|
+
f_Surname: "father sur",
|
|
235
|
+
f_nationality: "",
|
|
236
|
+
f_national_id_number: "",
|
|
237
|
+
reference_id: "abc123de-1995",
|
|
238
|
+
document_number: "1995/000000/XX0000000A1B2C3",
|
|
239
|
+
created_at: "05 Mar 2024",
|
|
240
|
+
last_updated_at: null,
|
|
241
|
+
issuccessful: true,
|
|
242
|
+
message: "record reference_id : abc123de-1995 , created successfully",
|
|
243
|
+
messagecode: "200"
|
|
244
|
+
};
|
|
220
245
|
function createServer(url = "http://tracker.chimgh.org") {
|
|
221
246
|
const agent = new import_undici2.MockAgent();
|
|
222
247
|
agent.disableNetConnect();
|
|
223
248
|
const mockPool = agent.get(url);
|
|
224
249
|
const sendBirthNotification2 = (req) => {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
250
|
+
if (validateRequestBody(JSON.parse(req.body), sampleRequestBody)) {
|
|
251
|
+
return {
|
|
252
|
+
statusCode: 200,
|
|
253
|
+
responseOptions: {
|
|
254
|
+
headers: { "Content-Type": "application/json" }
|
|
255
|
+
},
|
|
256
|
+
data: JSON.stringify(JSON.stringify(birthNotificationResponse))
|
|
257
|
+
};
|
|
258
|
+
} else {
|
|
259
|
+
return {
|
|
260
|
+
statusCode: 417,
|
|
261
|
+
responseOptions: {
|
|
262
|
+
headers: { "Content-Type": "application/json" }
|
|
263
|
+
},
|
|
264
|
+
data: {
|
|
265
|
+
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.)'
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}
|
|
232
269
|
};
|
|
233
270
|
mockPool.intercept({ method: "post", path: /api\/notification/ }).reply(sendBirthNotification2).persist();
|
|
234
271
|
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,30 @@ 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."
|
|
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
|
+
);
|
|
94
124
|
}
|
|
95
125
|
const response = await client.request(args);
|
|
96
126
|
if (response.statusCode >= 400) {
|
|
@@ -107,92 +137,98 @@ var request = (path, options) => {
|
|
|
107
137
|
|
|
108
138
|
// src/mock.js
|
|
109
139
|
import { MockAgent } from "undici";
|
|
110
|
-
var
|
|
111
|
-
registry_code: "
|
|
140
|
+
var sampleRequestBody = {
|
|
141
|
+
registry_code: "011803",
|
|
112
142
|
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,
|
|
143
|
+
first_name: "Test",
|
|
144
|
+
middle_name: "",
|
|
145
|
+
Surname: "Testerson",
|
|
146
|
+
birth_date: "2024/03/04",
|
|
120
147
|
birth_type_code: "1",
|
|
121
148
|
gender_code: "2",
|
|
149
|
+
place_of_delivery_code: "7",
|
|
122
150
|
attendant_at_birth_code: "1",
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
birth_attendant_phone: "0556969609"
|
|
151
|
+
bith_attendant_full_name: "Helen",
|
|
152
|
+
bith_attendant_phone: "0248403076"
|
|
126
153
|
},
|
|
127
154
|
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
|
|
155
|
+
national_id_number: "GHA-000000000-2",
|
|
156
|
+
first_name: "fake",
|
|
157
|
+
middle_name: "",
|
|
158
|
+
maiden_name: "fakerson",
|
|
159
|
+
phone: "0248403076",
|
|
160
|
+
occupation_code: "29",
|
|
161
|
+
age: 25
|
|
149
162
|
},
|
|
150
163
|
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"
|
|
164
|
+
national_id_number: "",
|
|
165
|
+
first_name: "john",
|
|
166
|
+
middle_name: "",
|
|
167
|
+
Surname: "doe",
|
|
168
|
+
phone: "0248403076",
|
|
169
|
+
occupation_code: "115",
|
|
170
|
+
age: 39
|
|
182
171
|
}
|
|
183
172
|
};
|
|
173
|
+
var birthNotificationResponse = {
|
|
174
|
+
birth_certificate_number: "000000-00-2024",
|
|
175
|
+
first_name: "Test",
|
|
176
|
+
middle_name: "",
|
|
177
|
+
Surname: "sample surname",
|
|
178
|
+
birth_date: "04 Mar 2024",
|
|
179
|
+
national_id_number: "",
|
|
180
|
+
place_of_delivery: "MATERNITY HOME",
|
|
181
|
+
Health_facility: "",
|
|
182
|
+
birth_type: null,
|
|
183
|
+
gender: "MALE",
|
|
184
|
+
house_number: "",
|
|
185
|
+
street_name: "",
|
|
186
|
+
district: "",
|
|
187
|
+
region: "",
|
|
188
|
+
town_or_village: "",
|
|
189
|
+
m_first_name: "sample mom",
|
|
190
|
+
m_middle_name: "",
|
|
191
|
+
m_maiden_name: "sample surname",
|
|
192
|
+
m_surname: "",
|
|
193
|
+
m_national_id_number: "GHA-000000000-0",
|
|
194
|
+
m_nationality: "",
|
|
195
|
+
f_first_name: "father fname",
|
|
196
|
+
f_middle_name: "",
|
|
197
|
+
f_Surname: "father sur",
|
|
198
|
+
f_nationality: "",
|
|
199
|
+
f_national_id_number: "",
|
|
200
|
+
reference_id: "abc123de-1995",
|
|
201
|
+
document_number: "1995/000000/XX0000000A1B2C3",
|
|
202
|
+
created_at: "05 Mar 2024",
|
|
203
|
+
last_updated_at: null,
|
|
204
|
+
issuccessful: true,
|
|
205
|
+
message: "record reference_id : abc123de-1995 , created successfully",
|
|
206
|
+
messagecode: "200"
|
|
207
|
+
};
|
|
184
208
|
function createServer(url = "http://tracker.chimgh.org") {
|
|
185
209
|
const agent = new MockAgent();
|
|
186
210
|
agent.disableNetConnect();
|
|
187
211
|
const mockPool = agent.get(url);
|
|
188
212
|
const sendBirthNotification2 = (req) => {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
213
|
+
if (validateRequestBody(JSON.parse(req.body), sampleRequestBody)) {
|
|
214
|
+
return {
|
|
215
|
+
statusCode: 200,
|
|
216
|
+
responseOptions: {
|
|
217
|
+
headers: { "Content-Type": "application/json" }
|
|
218
|
+
},
|
|
219
|
+
data: JSON.stringify(JSON.stringify(birthNotificationResponse))
|
|
220
|
+
};
|
|
221
|
+
} else {
|
|
222
|
+
return {
|
|
223
|
+
statusCode: 417,
|
|
224
|
+
responseOptions: {
|
|
225
|
+
headers: { "Content-Type": "application/json" }
|
|
226
|
+
},
|
|
227
|
+
data: {
|
|
228
|
+
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.)'
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
196
232
|
};
|
|
197
233
|
mockPool.intercept({ method: "post", path: /api\/notification/ }).reply(sendBirthNotification2).persist();
|
|
198
234
|
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.2",
|
|
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,28 +42,11 @@ export function post(path: string, data: object): Operation;
|
|
|
42
42
|
* Generate a birth certificate
|
|
43
43
|
* @example
|
|
44
44
|
* sendBirthNotification({
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* lightwaveETrackerID: "string",
|
|
51
|
-
* motherName: "string",
|
|
52
|
-
* noSiblingsInDelivery: "string",
|
|
53
|
-
* placeOfBirth: "string",
|
|
54
|
-
* surname: "string",
|
|
55
|
-
* timeOfbirth: "string",
|
|
56
|
-
* weightAtBirth: "string",
|
|
57
|
-
* babyPicture: "string"
|
|
58
|
-
* },
|
|
59
|
-
* personVouching: {
|
|
60
|
-
* etrackerLightwaveID: "string",
|
|
61
|
-
* ghanaCardPIN: "string",
|
|
62
|
-
* relationToBaby: "string",
|
|
63
|
-
* relativePhone: "string",
|
|
64
|
-
* relativePicture: "string"
|
|
65
|
-
* },
|
|
66
|
-
* merchantKey: "XXXXXXXXXXXXXXXXXXXXXX"
|
|
45
|
+
* child: {},
|
|
46
|
+
* mother: {},
|
|
47
|
+
* father: {},
|
|
48
|
+
* health_facility: {},
|
|
49
|
+
* birth_informant: {}
|
|
67
50
|
* })
|
|
68
51
|
* @function
|
|
69
52
|
* @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>;
|