@openfn/language-ghana-bdr 0.1.2 → 0.1.4

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 CHANGED
@@ -1,5 +1,62 @@
1
1
  {
2
2
  "operations": [
3
+ {
4
+ "name": "get",
5
+ "params": [
6
+ "path",
7
+ "query"
8
+ ],
9
+ "docs": {
10
+ "description": "Make a GET request",
11
+ "tags": [
12
+ {
13
+ "title": "example",
14
+ "description": "get(\"patient\");"
15
+ },
16
+ {
17
+ "title": "function",
18
+ "description": null,
19
+ "name": null
20
+ },
21
+ {
22
+ "title": "public",
23
+ "description": null,
24
+ "type": null
25
+ },
26
+ {
27
+ "title": "param",
28
+ "description": "Path to resource",
29
+ "type": {
30
+ "type": "NameExpression",
31
+ "name": "string"
32
+ },
33
+ "name": "path"
34
+ },
35
+ {
36
+ "title": "param",
37
+ "description": "An object of query parameters to be encoded into the URL.",
38
+ "type": {
39
+ "type": "NameExpression",
40
+ "name": "object"
41
+ },
42
+ "name": "query"
43
+ },
44
+ {
45
+ "title": "returns",
46
+ "description": null,
47
+ "type": {
48
+ "type": "NameExpression",
49
+ "name": "Operation"
50
+ }
51
+ },
52
+ {
53
+ "title": "state",
54
+ "description": "{HttpState}"
55
+ }
56
+ ]
57
+ },
58
+ "valid": true
59
+ },
3
60
  {
4
61
  "name": "post",
5
62
  "params": [
@@ -67,7 +124,7 @@
67
124
  "tags": [
68
125
  {
69
126
  "title": "example",
70
- "description": "sendBirthNotification({\n child: {},\n mother: {},\n father: {},\n health_facility: {},\n birth_informant: {}\n})"
127
+ "description": "sendBirthNotification({\n registry_code: 'abc123',\n child: {},\n mother: {},\n father: {},\n})"
71
128
  },
72
129
  {
73
130
  "title": "function",
package/dist/index.cjs CHANGED
@@ -147,7 +147,7 @@ var request = (path, options) => {
147
147
  };
148
148
  if (data.username || data.password) {
149
149
  (0, import_util.throwError)(
150
- "Please don't supply `username` and `password` in your request body."
150
+ "Please don't supply `username` and `password` in your request body. The adaptor will append it automatically."
151
151
  );
152
152
  }
153
153
  if (data) {
@@ -158,6 +158,7 @@ var request = (path, options) => {
158
158
  password
159
159
  })
160
160
  );
161
+ args.data = { ...data, username, password };
161
162
  }
162
163
  const response = await client.request(args);
163
164
  if (response.statusCode >= 400) {
@@ -247,7 +248,8 @@ function createServer(url = "http://tracker.chimgh.org") {
247
248
  agent.disableNetConnect();
248
249
  const mockPool = agent.get(url);
249
250
  const sendBirthNotification2 = (req) => {
250
- if (validateRequestBody(JSON.parse(req.body), sampleRequestBody)) {
251
+ const body = JSON.parse(req.body);
252
+ if (validateRequestBody(body, sampleRequestBody)) {
251
253
  return {
252
254
  statusCode: 200,
253
255
  responseOptions: {
package/dist/index.js CHANGED
@@ -110,7 +110,7 @@ var request = (path, options) => {
110
110
  };
111
111
  if (data.username || data.password) {
112
112
  throwError(
113
- "Please don't supply `username` and `password` in your request body."
113
+ "Please don't supply `username` and `password` in your request body. The adaptor will append it automatically."
114
114
  );
115
115
  }
116
116
  if (data) {
@@ -121,6 +121,7 @@ var request = (path, options) => {
121
121
  password
122
122
  })
123
123
  );
124
+ args.data = { ...data, username, password };
124
125
  }
125
126
  const response = await client.request(args);
126
127
  if (response.statusCode >= 400) {
@@ -210,7 +211,8 @@ function createServer(url = "http://tracker.chimgh.org") {
210
211
  agent.disableNetConnect();
211
212
  const mockPool = agent.get(url);
212
213
  const sendBirthNotification2 = (req) => {
213
- if (validateRequestBody(JSON.parse(req.body), sampleRequestBody)) {
214
+ const body = JSON.parse(req.body);
215
+ if (validateRequestBody(body, sampleRequestBody)) {
214
216
  return {
215
217
  statusCode: 200,
216
218
  responseOptions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-ghana-bdr",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "OpenFn ghana-bdr adaptor",
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "ajv": "^6.12.6",
24
24
  "undici": "^5.22.1",
25
- "@openfn/language-common": "2.3.0"
25
+ "@openfn/language-common": "2.3.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "assertion-error": "2.0.0",
@@ -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