@openfn/language-openhim 1.0.0 → 2.0.1
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 +9 -52
- package/dist/index.cjs +7 -26
- package/dist/index.js +5 -23
- package/package.json +2 -2
- package/types/Adaptor.d.ts +4 -22
package/ast.json
CHANGED
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"valid": true
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
|
-
"name": "
|
|
115
|
+
"name": "createClient",
|
|
116
116
|
"params": [
|
|
117
117
|
"body"
|
|
118
118
|
],
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"tags": [
|
|
122
122
|
{
|
|
123
123
|
"title": "example",
|
|
124
|
-
"description": "
|
|
124
|
+
"description": "createClient({\n roles: ['fhir'],\n clientID: 'fhir-server-7',\n name: 'FHIR Server',\n passwordAlgorithm: 'sha512',\n passwordSalt: '3e74a280c568f27241e48e938edf21bf',\n passwordHash:\n '9a5158dc87a25da9d8822d48ed831a88bb4ba7fa636ddb6d6a725f73688546052cb7f2c355758e4839f9416e6cc0e37e1e3070f597af2836d39768a5ecc050db',\n});",
|
|
125
125
|
"caption": "Create a client record"
|
|
126
126
|
},
|
|
127
127
|
{
|
|
@@ -159,54 +159,6 @@
|
|
|
159
159
|
},
|
|
160
160
|
"valid": true
|
|
161
161
|
},
|
|
162
|
-
{
|
|
163
|
-
"name": "updateClient",
|
|
164
|
-
"params": [
|
|
165
|
-
"body"
|
|
166
|
-
],
|
|
167
|
-
"docs": {
|
|
168
|
-
"description": "Make a request to OpenHIM to update a client record",
|
|
169
|
-
"tags": [
|
|
170
|
-
{
|
|
171
|
-
"title": "example",
|
|
172
|
-
"description": "updateClient({\n _id:'6870c19870b851d7a22b8d27',\n roles: ['fhir', 'testing'],\n clientID: 'fhir-server-7',\n name: 'FHIR Server Testing',\n passwordAlgorithm: 'sha512',\n passwordSalt: '3e74a280c568f27241e48e938edf21bf',\n passwordHash:\n '9a5158dc87a25da9d8822d48ed831a88bb4ba7fa636ddb6d6a725f73688546052cb7f2c355758e4839f9416e6cc0e37e1e3070f597af2836d39768a5ecc050db',\n});",
|
|
173
|
-
"caption": "Update a client record"
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
"title": "function",
|
|
177
|
-
"description": null,
|
|
178
|
-
"name": null
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
"title": "public",
|
|
182
|
-
"description": null,
|
|
183
|
-
"type": null
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
"title": "param",
|
|
187
|
-
"description": "The client data to update.",
|
|
188
|
-
"type": {
|
|
189
|
-
"type": "NameExpression",
|
|
190
|
-
"name": "object"
|
|
191
|
-
},
|
|
192
|
-
"name": "body"
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
"title": "returns",
|
|
196
|
-
"description": null,
|
|
197
|
-
"type": {
|
|
198
|
-
"type": "NameExpression",
|
|
199
|
-
"name": "Operation"
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"title": "state",
|
|
204
|
-
"description": "{HttpState}"
|
|
205
|
-
}
|
|
206
|
-
]
|
|
207
|
-
},
|
|
208
|
-
"valid": true
|
|
209
|
-
},
|
|
210
162
|
{
|
|
211
163
|
"name": "getChannels",
|
|
212
164
|
"params": [
|
|
@@ -318,9 +270,14 @@
|
|
|
318
270
|
"tags": [
|
|
319
271
|
{
|
|
320
272
|
"title": "example",
|
|
321
|
-
"description": "getTasks(
|
|
273
|
+
"description": "getTasks()",
|
|
322
274
|
"caption": "Get all tasks"
|
|
323
275
|
},
|
|
276
|
+
{
|
|
277
|
+
"title": "example",
|
|
278
|
+
"description": "getTasks({\n filterLimit: 10,\n filterPage: 0,\n filters: '{}',\n});",
|
|
279
|
+
"caption": "Get all tasks with pagination options"
|
|
280
|
+
},
|
|
324
281
|
{
|
|
325
282
|
"title": "example",
|
|
326
283
|
"description": "getTasks({\n taskId: '6870fbf470b851d7a22e9f05',\n filterLimit: 10,\n filterPage: 0,\n filters: '{}',\n});",
|
|
@@ -462,7 +419,7 @@
|
|
|
462
419
|
"operation"
|
|
463
420
|
],
|
|
464
421
|
"docs": {
|
|
465
|
-
"description": "
|
|
422
|
+
"description": "Execute a function only when the condition returns true",
|
|
466
423
|
"tags": [
|
|
467
424
|
{
|
|
468
425
|
"title": "public",
|
package/dist/index.cjs
CHANGED
|
@@ -21,6 +21,7 @@ var src_exports = {};
|
|
|
21
21
|
__export(src_exports, {
|
|
22
22
|
as: () => import_language_common3.as,
|
|
23
23
|
createChannel: () => createChannel,
|
|
24
|
+
createClient: () => createClient,
|
|
24
25
|
createEncounter: () => createEncounter,
|
|
25
26
|
createTask: () => createTask,
|
|
26
27
|
cursor: () => import_language_common3.cursor,
|
|
@@ -42,9 +43,7 @@ __export(src_exports, {
|
|
|
42
43
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
43
44
|
map: () => import_language_common3.map,
|
|
44
45
|
merge: () => import_language_common3.merge,
|
|
45
|
-
|
|
46
|
-
sourceValue: () => import_language_common3.sourceValue,
|
|
47
|
-
updateClient: () => updateClient
|
|
46
|
+
sourceValue: () => import_language_common3.sourceValue
|
|
48
47
|
});
|
|
49
48
|
module.exports = __toCommonJS(src_exports);
|
|
50
49
|
|
|
@@ -53,6 +52,7 @@ var Adaptor_exports = {};
|
|
|
53
52
|
__export(Adaptor_exports, {
|
|
54
53
|
as: () => import_language_common3.as,
|
|
55
54
|
createChannel: () => createChannel,
|
|
55
|
+
createClient: () => createClient,
|
|
56
56
|
createEncounter: () => createEncounter,
|
|
57
57
|
createTask: () => createTask,
|
|
58
58
|
cursor: () => import_language_common3.cursor,
|
|
@@ -72,9 +72,7 @@ __export(Adaptor_exports, {
|
|
|
72
72
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
73
73
|
map: () => import_language_common3.map,
|
|
74
74
|
merge: () => import_language_common3.merge,
|
|
75
|
-
|
|
76
|
-
sourceValue: () => import_language_common3.sourceValue,
|
|
77
|
-
updateClient: () => updateClient
|
|
75
|
+
sourceValue: () => import_language_common3.sourceValue
|
|
78
76
|
});
|
|
79
77
|
var import_language_common2 = require("@openfn/language-common");
|
|
80
78
|
var import_util2 = require("@openfn/language-common/util");
|
|
@@ -167,7 +165,7 @@ function getClients(clientId) {
|
|
|
167
165
|
return prepareNextState(state, response);
|
|
168
166
|
};
|
|
169
167
|
}
|
|
170
|
-
function
|
|
168
|
+
function createClient(body) {
|
|
171
169
|
return async (state) => {
|
|
172
170
|
const [resolvedBody] = (0, import_util2.expandReferences)(state, body);
|
|
173
171
|
const response = await request(
|
|
@@ -182,22 +180,6 @@ function registerClient(body) {
|
|
|
182
180
|
return prepareNextState(state, response);
|
|
183
181
|
};
|
|
184
182
|
}
|
|
185
|
-
function updateClient(body) {
|
|
186
|
-
return async (state) => {
|
|
187
|
-
const [resolvedBody] = (0, import_util2.expandReferences)(state, body);
|
|
188
|
-
const { _id } = resolvedBody;
|
|
189
|
-
const response = await request(
|
|
190
|
-
state.configuration,
|
|
191
|
-
"PUT",
|
|
192
|
-
`/clients/${_id}`,
|
|
193
|
-
{
|
|
194
|
-
body: resolvedBody,
|
|
195
|
-
parseAs: "text"
|
|
196
|
-
}
|
|
197
|
-
);
|
|
198
|
-
return prepareNextState(state, response);
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
183
|
function getChannels(channelId) {
|
|
202
184
|
return async (state) => {
|
|
203
185
|
const [resolvedChannelId] = (0, import_util2.expandReferences)(state, channelId);
|
|
@@ -296,6 +278,7 @@ var src_default = Adaptor_exports;
|
|
|
296
278
|
0 && (module.exports = {
|
|
297
279
|
as,
|
|
298
280
|
createChannel,
|
|
281
|
+
createClient,
|
|
299
282
|
createEncounter,
|
|
300
283
|
createTask,
|
|
301
284
|
cursor,
|
|
@@ -316,7 +299,5 @@ var src_default = Adaptor_exports;
|
|
|
316
299
|
lastReferenceValue,
|
|
317
300
|
map,
|
|
318
301
|
merge,
|
|
319
|
-
|
|
320
|
-
sourceValue,
|
|
321
|
-
updateClient
|
|
302
|
+
sourceValue
|
|
322
303
|
});
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var Adaptor_exports = {};
|
|
|
9
9
|
__export(Adaptor_exports, {
|
|
10
10
|
as: () => as,
|
|
11
11
|
createChannel: () => createChannel,
|
|
12
|
+
createClient: () => createClient,
|
|
12
13
|
createEncounter: () => createEncounter,
|
|
13
14
|
createTask: () => createTask,
|
|
14
15
|
cursor: () => cursor,
|
|
@@ -28,9 +29,7 @@ __export(Adaptor_exports, {
|
|
|
28
29
|
lastReferenceValue: () => lastReferenceValue,
|
|
29
30
|
map: () => map,
|
|
30
31
|
merge: () => merge,
|
|
31
|
-
|
|
32
|
-
sourceValue: () => sourceValue,
|
|
33
|
-
updateClient: () => updateClient
|
|
32
|
+
sourceValue: () => sourceValue
|
|
34
33
|
});
|
|
35
34
|
import { execute as commonExecute } from "@openfn/language-common";
|
|
36
35
|
import { expandReferences } from "@openfn/language-common/util";
|
|
@@ -142,7 +141,7 @@ function getClients(clientId) {
|
|
|
142
141
|
return prepareNextState(state, response);
|
|
143
142
|
};
|
|
144
143
|
}
|
|
145
|
-
function
|
|
144
|
+
function createClient(body) {
|
|
146
145
|
return async (state) => {
|
|
147
146
|
const [resolvedBody] = expandReferences(state, body);
|
|
148
147
|
const response = await request(
|
|
@@ -157,22 +156,6 @@ function registerClient(body) {
|
|
|
157
156
|
return prepareNextState(state, response);
|
|
158
157
|
};
|
|
159
158
|
}
|
|
160
|
-
function updateClient(body) {
|
|
161
|
-
return async (state) => {
|
|
162
|
-
const [resolvedBody] = expandReferences(state, body);
|
|
163
|
-
const { _id } = resolvedBody;
|
|
164
|
-
const response = await request(
|
|
165
|
-
state.configuration,
|
|
166
|
-
"PUT",
|
|
167
|
-
`/clients/${_id}`,
|
|
168
|
-
{
|
|
169
|
-
body: resolvedBody,
|
|
170
|
-
parseAs: "text"
|
|
171
|
-
}
|
|
172
|
-
);
|
|
173
|
-
return prepareNextState(state, response);
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
159
|
function getChannels(channelId) {
|
|
177
160
|
return async (state) => {
|
|
178
161
|
const [resolvedChannelId] = expandReferences(state, channelId);
|
|
@@ -270,6 +253,7 @@ var src_default = Adaptor_exports;
|
|
|
270
253
|
export {
|
|
271
254
|
as,
|
|
272
255
|
createChannel,
|
|
256
|
+
createClient,
|
|
273
257
|
createEncounter,
|
|
274
258
|
createTask,
|
|
275
259
|
cursor,
|
|
@@ -291,7 +275,5 @@ export {
|
|
|
291
275
|
lastReferenceValue,
|
|
292
276
|
map,
|
|
293
277
|
merge,
|
|
294
|
-
|
|
295
|
-
sourceValue,
|
|
296
|
-
updateClient
|
|
278
|
+
sourceValue
|
|
297
279
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-openhim",
|
|
3
3
|
"label": "OpenHIM",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"description": "OpenFn adaptor for OpenHIM",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"author": "Open Function Group",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"JSONPath": "^0.10.0",
|
|
17
17
|
"lodash-fp": "^0.10.4",
|
|
18
|
-
"@openfn/language-common": "3.0.
|
|
18
|
+
"@openfn/language-common": "3.0.3"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"assertion-error": "^1.1.0",
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ export function getClients(clientId: string): Operation;
|
|
|
74
74
|
/**
|
|
75
75
|
* Make a request to OpenHIM to create a new client record
|
|
76
76
|
* @example <caption>Create a client record</caption>
|
|
77
|
-
*
|
|
77
|
+
* createClient({
|
|
78
78
|
* roles: ['fhir'],
|
|
79
79
|
* clientID: 'fhir-server-7',
|
|
80
80
|
* name: 'FHIR Server',
|
|
@@ -89,27 +89,7 @@ export function getClients(clientId: string): Operation;
|
|
|
89
89
|
* @returns {Operation}
|
|
90
90
|
* @state {HttpState}
|
|
91
91
|
*/
|
|
92
|
-
export function
|
|
93
|
-
/**
|
|
94
|
-
* Make a request to OpenHIM to update a client record
|
|
95
|
-
* @example <caption>Update a client record</caption>
|
|
96
|
-
* updateClient({
|
|
97
|
-
* _id:'6870c19870b851d7a22b8d27',
|
|
98
|
-
* roles: ['fhir', 'testing'],
|
|
99
|
-
* clientID: 'fhir-server-7',
|
|
100
|
-
* name: 'FHIR Server Testing',
|
|
101
|
-
* passwordAlgorithm: 'sha512',
|
|
102
|
-
* passwordSalt: '3e74a280c568f27241e48e938edf21bf',
|
|
103
|
-
* passwordHash:
|
|
104
|
-
* '9a5158dc87a25da9d8822d48ed831a88bb4ba7fa636ddb6d6a725f73688546052cb7f2c355758e4839f9416e6cc0e37e1e3070f597af2836d39768a5ecc050db',
|
|
105
|
-
* });
|
|
106
|
-
* @function
|
|
107
|
-
* @public
|
|
108
|
-
* @param {object} body - The client data to update.
|
|
109
|
-
* @returns {Operation}
|
|
110
|
-
* @state {HttpState}
|
|
111
|
-
*/
|
|
112
|
-
export function updateClient(body: object): Operation;
|
|
92
|
+
export function createClient(body: object): Operation;
|
|
113
93
|
/**
|
|
114
94
|
* Make a request to OpenHIM to get all channel records
|
|
115
95
|
* @example <caption>Get all channels</caption>
|
|
@@ -167,6 +147,8 @@ export function createChannel(body: object): Operation;
|
|
|
167
147
|
/**
|
|
168
148
|
* Make a request to OpenHIM to get all tasks
|
|
169
149
|
* @example <caption>Get all tasks</caption>
|
|
150
|
+
* getTasks()
|
|
151
|
+
* @example <caption>Get all tasks with pagination options</caption>
|
|
170
152
|
* getTasks({
|
|
171
153
|
* filterLimit: 10,
|
|
172
154
|
* filterPage: 0,
|