@openfn/language-satusehat 2.0.5 → 2.0.7
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 +39 -14
- package/package.json +2 -2
- package/types/Adaptor.d.ts +63 -34
package/ast.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"callback"
|
|
9
9
|
],
|
|
10
10
|
"docs": {
|
|
11
|
-
"description": "Make a GET request to Satusehat",
|
|
11
|
+
"description": "Make a GET request to Satusehat. Use this to fetch resources directly from the Satusehat REST API.\nYou can pass Satusehat query parameters as an object of key value pairs, which will map to parameters\nin the URL.",
|
|
12
12
|
"tags": [
|
|
13
13
|
{
|
|
14
14
|
"title": "public",
|
|
@@ -17,7 +17,13 @@
|
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"title": "example",
|
|
20
|
-
"description": "get(\"Organization\"
|
|
20
|
+
"description": "get(\"Organization/abcde\")",
|
|
21
|
+
"caption": "Get a resource by Id. Equivalent to GET `<baseUrl>/Organization/abcde`"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"title": "example",
|
|
25
|
+
"description": "get('/Patient', {\n identifier:'https://fhir.kemkes.go.id/id/nik|9271060312000001'\n});",
|
|
26
|
+
"caption": "Get resources with a query. Equivalent to GET `<baseUrl>/Patient?identifier=https://fhir.kemkes.go.id/id/nik|9271060312000001`"
|
|
21
27
|
},
|
|
22
28
|
{
|
|
23
29
|
"title": "function",
|
|
@@ -35,7 +41,7 @@
|
|
|
35
41
|
},
|
|
36
42
|
{
|
|
37
43
|
"title": "param",
|
|
38
|
-
"description": "Optional
|
|
44
|
+
"description": "Optional object of query parameters to include in the request",
|
|
39
45
|
"type": {
|
|
40
46
|
"type": "NameExpression",
|
|
41
47
|
"name": "object"
|
|
@@ -58,6 +64,10 @@
|
|
|
58
64
|
"type": "NameExpression",
|
|
59
65
|
"name": "Operation"
|
|
60
66
|
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"title": "state",
|
|
70
|
+
"description": "{SatusehatHttpState}"
|
|
61
71
|
}
|
|
62
72
|
]
|
|
63
73
|
},
|
|
@@ -72,11 +82,12 @@
|
|
|
72
82
|
"callback"
|
|
73
83
|
],
|
|
74
84
|
"docs": {
|
|
75
|
-
"description": "Make a POST request to Satusehat",
|
|
85
|
+
"description": "Make a POST request to Satusehat. Use this to send resources directly to Satusehat REST API.\nYou can pass Satusehat body data as a JSON FHIR object.",
|
|
76
86
|
"tags": [
|
|
77
87
|
{
|
|
78
88
|
"title": "example",
|
|
79
|
-
"description": "post(
|
|
89
|
+
"description": "post('Encounter', { resourceType: 'Encounter', ...state.data });",
|
|
90
|
+
"caption": "Create an encounter resource. Equivalent to POST `<baseUrl>/Encounter`"
|
|
80
91
|
},
|
|
81
92
|
{
|
|
82
93
|
"title": "function",
|
|
@@ -99,7 +110,7 @@
|
|
|
99
110
|
},
|
|
100
111
|
{
|
|
101
112
|
"title": "param",
|
|
102
|
-
"description": "
|
|
113
|
+
"description": "JSON FHIR object to create a resource",
|
|
103
114
|
"type": {
|
|
104
115
|
"type": "NameExpression",
|
|
105
116
|
"name": "object"
|
|
@@ -108,7 +119,7 @@
|
|
|
108
119
|
},
|
|
109
120
|
{
|
|
110
121
|
"title": "param",
|
|
111
|
-
"description": "Optional request
|
|
122
|
+
"description": "Optional object of query parameters to include in the request",
|
|
112
123
|
"type": {
|
|
113
124
|
"type": "NameExpression",
|
|
114
125
|
"name": "Object"
|
|
@@ -134,6 +145,10 @@
|
|
|
134
145
|
"type": "NameExpression",
|
|
135
146
|
"name": "Operation"
|
|
136
147
|
}
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"title": "state",
|
|
151
|
+
"description": "{SatusehatHttpState}"
|
|
137
152
|
}
|
|
138
153
|
]
|
|
139
154
|
},
|
|
@@ -148,11 +163,12 @@
|
|
|
148
163
|
"callback"
|
|
149
164
|
],
|
|
150
165
|
"docs": {
|
|
151
|
-
"description": "Make a PUT request to Satusehat",
|
|
166
|
+
"description": "Make a PUT request to Satusehat. Use this to directly update resources on Satusehat REST API.\nYou can pass Satusehat body data as a JSON FHIR object. You can also pass Satusehat query parameters as an object of key value pairs, which will map to parameters\nin the URL.",
|
|
152
167
|
"tags": [
|
|
153
168
|
{
|
|
154
169
|
"title": "example",
|
|
155
|
-
"description": "put(
|
|
170
|
+
"description": "put('Organization/abcde', { resourceType: 'Organization', active: false });",
|
|
171
|
+
"caption": "Update a resource. Equivalent to PUT `<baseurl>/Organization/abcde`"
|
|
156
172
|
},
|
|
157
173
|
{
|
|
158
174
|
"title": "function",
|
|
@@ -175,7 +191,7 @@
|
|
|
175
191
|
},
|
|
176
192
|
{
|
|
177
193
|
"title": "param",
|
|
178
|
-
"description": "
|
|
194
|
+
"description": "JSON FHIR object to update the resource",
|
|
179
195
|
"type": {
|
|
180
196
|
"type": "NameExpression",
|
|
181
197
|
"name": "object"
|
|
@@ -184,7 +200,7 @@
|
|
|
184
200
|
},
|
|
185
201
|
{
|
|
186
202
|
"title": "param",
|
|
187
|
-
"description": "Optional request
|
|
203
|
+
"description": "Optional object of query parameters to include in the request",
|
|
188
204
|
"type": {
|
|
189
205
|
"type": "NameExpression",
|
|
190
206
|
"name": "Object"
|
|
@@ -210,6 +226,10 @@
|
|
|
210
226
|
"type": "NameExpression",
|
|
211
227
|
"name": "Operation"
|
|
212
228
|
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"title": "state",
|
|
232
|
+
"description": "{SatusehatHttpState}"
|
|
213
233
|
}
|
|
214
234
|
]
|
|
215
235
|
},
|
|
@@ -224,11 +244,12 @@
|
|
|
224
244
|
"callback"
|
|
225
245
|
],
|
|
226
246
|
"docs": {
|
|
227
|
-
"description": "Make a PATCH request to Satusehat",
|
|
247
|
+
"description": "Make a PATCH request to Satusehat. Use this to directly update resources on Satusehat REST API.\nYou can pass Satusehat an array of objects which contains `op`, `path`, and `value` as the body. You can also pass Satusehat query parameters as an object of key value pairs, which will map to parameters\nin the URL.",
|
|
228
248
|
"tags": [
|
|
229
249
|
{
|
|
230
250
|
"title": "example",
|
|
231
|
-
"description": "patch(
|
|
251
|
+
"description": "patch('Organization/abcde', [\n{\n op: 'replace',\n path: '/language', // Name of property/element of resource to be replaced\n value: 'id', // Value to be replaced\n},\n]);",
|
|
252
|
+
"caption": "Update a property of a resource. Equivalent to PATCH `<baseurl>/Organization/abcde`"
|
|
232
253
|
},
|
|
233
254
|
{
|
|
234
255
|
"title": "function",
|
|
@@ -260,7 +281,7 @@
|
|
|
260
281
|
},
|
|
261
282
|
{
|
|
262
283
|
"title": "param",
|
|
263
|
-
"description": "Optional request
|
|
284
|
+
"description": "Optional object of query parameters to include in the request.",
|
|
264
285
|
"type": {
|
|
265
286
|
"type": "NameExpression",
|
|
266
287
|
"name": "Object"
|
|
@@ -286,6 +307,10 @@
|
|
|
286
307
|
"type": "NameExpression",
|
|
287
308
|
"name": "Operation"
|
|
288
309
|
}
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"title": "state",
|
|
313
|
+
"description": "{SatusehatHttpState}"
|
|
289
314
|
}
|
|
290
315
|
]
|
|
291
316
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-satusehat",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "OpenFn Satusehat adaptor",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"configuration-schema.json"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@openfn/language-common": "2.
|
|
23
|
+
"@openfn/language-common": "2.2.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"assertion-error": "2.0.0",
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State object
|
|
3
|
+
* @typedef {Object} SatusehatHttpState
|
|
4
|
+
* @property data - The response body (as JSON)
|
|
5
|
+
* @property response - The HTTP response from the Satusehat server (excluding the body)
|
|
6
|
+
* @property references - An array of all previous data objects used in the Job
|
|
7
|
+
*/
|
|
1
8
|
/**
|
|
2
9
|
* Execute a sequence of operations.
|
|
3
10
|
* Wraps `language-common/execute` to make working with this API easier.
|
|
@@ -12,70 +19,92 @@
|
|
|
12
19
|
*/
|
|
13
20
|
export function execute(...operations: Operations): Operation;
|
|
14
21
|
/**
|
|
15
|
-
* Make a GET request to Satusehat
|
|
22
|
+
* Make a GET request to Satusehat. Use this to fetch resources directly from the Satusehat REST API.
|
|
23
|
+
* You can pass Satusehat query parameters as an object of key value pairs, which will map to parameters
|
|
24
|
+
* in the URL.
|
|
16
25
|
* @public
|
|
17
|
-
* @example
|
|
18
|
-
* get("Organization"
|
|
26
|
+
* @example <caption>Get a resource by Id. Equivalent to GET `<baseUrl>/Organization/abcde`</caption>
|
|
27
|
+
* get("Organization/abcde")
|
|
28
|
+
* @example <caption>Get resources with a query. Equivalent to GET `<baseUrl>/Patient?identifier=https://fhir.kemkes.go.id/id/nik|9271060312000001`</caption>
|
|
29
|
+
* get('/Patient', {
|
|
30
|
+
* identifier:'https://fhir.kemkes.go.id/id/nik|9271060312000001'
|
|
31
|
+
* });
|
|
19
32
|
* @function
|
|
20
33
|
* @param {string} path - Path to resource
|
|
21
|
-
* @param {object} params - Optional
|
|
34
|
+
* @param {object} params - Optional object of query parameters to include in the request
|
|
22
35
|
* @param {function} callback - An optional callback to handle the response
|
|
23
36
|
* @returns {Operation}
|
|
37
|
+
* @state {SatusehatHttpState}
|
|
24
38
|
*/
|
|
25
39
|
export function get(path: string, params?: object, callback?: Function): Operation;
|
|
26
40
|
/**
|
|
27
|
-
* Make a POST request to Satusehat
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* { "resourceType": "Organization", "active": true,
|
|
32
|
-
* }
|
|
33
|
-
* );
|
|
41
|
+
* Make a POST request to Satusehat. Use this to send resources directly to Satusehat REST API.
|
|
42
|
+
* You can pass Satusehat body data as a JSON FHIR object.
|
|
43
|
+
* @example <caption>Create an encounter resource. Equivalent to POST `<baseUrl>/Encounter`</caption>
|
|
44
|
+
* post('Encounter', { resourceType: 'Encounter', ...state.data });
|
|
34
45
|
* @function
|
|
35
46
|
* @public
|
|
36
47
|
* @param {string} path - Path to resource
|
|
37
|
-
* @param {object} data -
|
|
38
|
-
* @param {Object} params - Optional request
|
|
48
|
+
* @param {object} data - JSON FHIR object to create a resource
|
|
49
|
+
* @param {Object} params - Optional object of query parameters to include in the request
|
|
39
50
|
* @param {function} [callback] - Optional callback to handle the response
|
|
40
51
|
* @returns {Operation}
|
|
52
|
+
* @state {SatusehatHttpState}
|
|
41
53
|
*/
|
|
42
54
|
export function post(path: string, data: object, params?: any, callback?: Function): Operation;
|
|
43
55
|
/**
|
|
44
|
-
* Make a PUT request to Satusehat
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* }
|
|
50
|
-
* );
|
|
56
|
+
* Make a PUT request to Satusehat. Use this to directly update resources on Satusehat REST API.
|
|
57
|
+
* You can pass Satusehat body data as a JSON FHIR object. You can also pass Satusehat query parameters as an object of key value pairs, which will map to parameters
|
|
58
|
+
* in the URL.
|
|
59
|
+
* @example <caption>Update a resource. Equivalent to PUT `<baseurl>/Organization/abcde`</caption>
|
|
60
|
+
* put('Organization/abcde', { resourceType: 'Organization', active: false });
|
|
51
61
|
* @function
|
|
52
62
|
* @public
|
|
53
63
|
* @param {string} path - Path to resource and exact item to be updated
|
|
54
|
-
* @param {object} data -
|
|
55
|
-
* @param {Object} params - Optional request
|
|
64
|
+
* @param {object} data - JSON FHIR object to update the resource
|
|
65
|
+
* @param {Object} params - Optional object of query parameters to include in the request
|
|
56
66
|
* @param {function} [callback] - Optional callback to handle the response
|
|
57
67
|
* @returns {Operation}
|
|
68
|
+
* @state {SatusehatHttpState}
|
|
58
69
|
*/
|
|
59
70
|
export function put(path: string, data: object, params?: any, callback?: Function): Operation;
|
|
60
71
|
/**
|
|
61
|
-
* Make a PATCH request to Satusehat
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* );
|
|
72
|
+
* Make a PATCH request to Satusehat. Use this to directly update resources on Satusehat REST API.
|
|
73
|
+
* You can pass Satusehat an array of objects which contains `op`, `path`, and `value` as the body. You can also pass Satusehat query parameters as an object of key value pairs, which will map to parameters
|
|
74
|
+
* in the URL.
|
|
75
|
+
* @example <caption>Update a property of a resource. Equivalent to PATCH `<baseurl>/Organization/abcde`</caption>
|
|
76
|
+
* patch('Organization/abcde', [
|
|
77
|
+
* {
|
|
78
|
+
* op: 'replace',
|
|
79
|
+
* path: '/language', // Name of property/element of resource to be replaced
|
|
80
|
+
* value: 'id', // Value to be replaced
|
|
81
|
+
* },
|
|
82
|
+
* ]);
|
|
72
83
|
* @function
|
|
73
84
|
* @public
|
|
74
85
|
* @param {string} path - Path to resource and exact item to be partially updated
|
|
75
86
|
* @param {Array} data - An array of objects which defines data that will be used to partially update a given instance of resource
|
|
76
|
-
* @param {Object} params - Optional request
|
|
87
|
+
* @param {Object} params - Optional object of query parameters to include in the request.
|
|
77
88
|
* @param {function} [callback] - Optional callback to handle the response
|
|
78
89
|
* @returns {Operation}
|
|
90
|
+
* @state {SatusehatHttpState}
|
|
79
91
|
*/
|
|
80
92
|
export function patch(path: string, data: any[], params?: any, callback?: Function): Operation;
|
|
93
|
+
/**
|
|
94
|
+
* State object
|
|
95
|
+
*/
|
|
96
|
+
export type SatusehatHttpState = {
|
|
97
|
+
/**
|
|
98
|
+
* - The response body (as JSON)
|
|
99
|
+
*/
|
|
100
|
+
data: any;
|
|
101
|
+
/**
|
|
102
|
+
* - The HTTP response from the Satusehat server (excluding the body)
|
|
103
|
+
*/
|
|
104
|
+
response: any;
|
|
105
|
+
/**
|
|
106
|
+
* - An array of all previous data objects used in the Job
|
|
107
|
+
*/
|
|
108
|
+
references: any;
|
|
109
|
+
};
|
|
81
110
|
export { fn, fnIf, alterState, arrayToString, combine, dataPath, dataValue, each, field, fields, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
|