@openfn/language-ghana-bdr 0.1.0
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/LICENSE +674 -0
- package/LICENSE.LESSER +165 -0
- package/README.md +29 -0
- package/ast.json +683 -0
- package/configuration-schema.json +29 -0
- package/dist/index.cjs +301 -0
- package/dist/index.js +278 -0
- package/package.json +49 -0
- package/types/Adaptor.d.ts +93 -0
- package/types/index.d.ts +3 -0
- package/types/mock.d.ts +10 -0
- package/types/util.d.ts +3 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executes an operation.
|
|
3
|
+
* @function
|
|
4
|
+
* @private
|
|
5
|
+
* @param {Operation} operations - Operations
|
|
6
|
+
* @returns {State}
|
|
7
|
+
*/
|
|
8
|
+
export function execute(...operations: Operation): State;
|
|
9
|
+
/**
|
|
10
|
+
/**
|
|
11
|
+
* State object
|
|
12
|
+
* @typedef {Object} HttpState
|
|
13
|
+
* @property data - the parsed response body
|
|
14
|
+
* @property response - the response from the HTTP server, including headers, statusCode, body, etc
|
|
15
|
+
* @property references - an array of all previous data objects used in the Job
|
|
16
|
+
**/
|
|
17
|
+
/**
|
|
18
|
+
* Make a GET request
|
|
19
|
+
* @example
|
|
20
|
+
* get("patient");
|
|
21
|
+
* @function
|
|
22
|
+
* @public
|
|
23
|
+
* @param {string} path - Path to resource
|
|
24
|
+
* @param {object} query - An object of query parameters to be encoded into the URL.
|
|
25
|
+
* @returns {Operation}
|
|
26
|
+
* @state {HttpState}
|
|
27
|
+
*/
|
|
28
|
+
export function get(path: string, query: object): Operation;
|
|
29
|
+
/**
|
|
30
|
+
* Make a POST request
|
|
31
|
+
* @example
|
|
32
|
+
* post("patient", { "name":"Bukayo" });
|
|
33
|
+
* @function
|
|
34
|
+
* @public
|
|
35
|
+
* @param {string} path - Path to resource
|
|
36
|
+
* @param {object} data - body data to append to the request. JSON will be converted to a string (but a content-type header will not be attached to the request).
|
|
37
|
+
* @returns {Operation}
|
|
38
|
+
* @state {HttpState}
|
|
39
|
+
*/
|
|
40
|
+
export function post(path: string, data: object): Operation;
|
|
41
|
+
/**
|
|
42
|
+
* Generate a birth certificate
|
|
43
|
+
* @example
|
|
44
|
+
* sendBirthNotification({
|
|
45
|
+
* babyData: {
|
|
46
|
+
* dateOfBirth: "string",
|
|
47
|
+
* fatherName: "string",
|
|
48
|
+
* forenames: "string",
|
|
49
|
+
* gender: "string",
|
|
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"
|
|
67
|
+
* })
|
|
68
|
+
* @function
|
|
69
|
+
* @public
|
|
70
|
+
* @param {object} data - body data to append to the request. JSON will be converted to a string (but a content-type header will not be attached to the request).
|
|
71
|
+
* @returns {Operation}
|
|
72
|
+
* @state {HttpState}
|
|
73
|
+
*/
|
|
74
|
+
export function sendBirthNotification(data: object): Operation;
|
|
75
|
+
/**
|
|
76
|
+
* /**
|
|
77
|
+
* State object
|
|
78
|
+
*/
|
|
79
|
+
export type HttpState = {
|
|
80
|
+
/**
|
|
81
|
+
* - the parsed response body
|
|
82
|
+
*/
|
|
83
|
+
data: any;
|
|
84
|
+
/**
|
|
85
|
+
* - the response from the HTTP server, including headers, statusCode, body, etc
|
|
86
|
+
*/
|
|
87
|
+
response: any;
|
|
88
|
+
/**
|
|
89
|
+
* - an array of all previous data objects used in the Job
|
|
90
|
+
*/
|
|
91
|
+
references: any;
|
|
92
|
+
};
|
|
93
|
+
export { fn, fnIf, each, merge, field, fields, cursor, dateFns, dataPath, dataValue, sourceValue, lastReferenceValue } from "@openfn/language-common";
|
package/types/index.d.ts
ADDED
package/types/mock.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function createServer(url?: string): {
|
|
2
|
+
agent: MockAgent<MockAgent.Options>;
|
|
3
|
+
request: ({ method, path, data, ...rest }: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
method: any;
|
|
6
|
+
path: any;
|
|
7
|
+
data: any;
|
|
8
|
+
}) => Promise<import("undici/types/dispatcher").default.ResponseData>;
|
|
9
|
+
};
|
|
10
|
+
import { MockAgent } from "undici/types";
|
package/types/util.d.ts
ADDED